"use strict"; var _createPyodideModule = (() => { var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; return ( function(_createPyodideModule) { _createPyodideModule = _createPyodideModule || {}; var Module=typeof _createPyodideModule!="undefined"?_createPyodideModule:{};if(typeof globalThis.BigInt64Array==="undefined"){function partsToBigIntSigned(lower,upper){return BigInt(lower)|BigInt(upper+2*(upper&2147483648))<<32n}function partsToBigIntUnsigned(lower,upper){return BigInt(lower)|BigInt(upper)<<32n}function bigIntToParts(value){var lower=Number(BigInt(value)&BigInt(4294967295))|0;var upper=Number(BigInt(value)>>32n)|0;return[lower,upper]}function createBigIntArrayShim(partsToBigInt){function createBigInt64Array(array){if(typeof array==="number"){array=new Uint32Array(2*array)}var orig_array;if(!ArrayBuffer.isView(array)){if(array.constructor&&array.constructor.name==="ArrayBuffer"){array=new Uint32Array(array)}else{orig_array=array;array=new Uint32Array(array.length*2)}}var proxy=new Proxy({slice:function(min,max){if(max===undefined){max=array.length}var new_buf=array.slice(min*2,max*2);return createBigInt64Array(new_buf)},subarray:function(min,max){var new_buf=array.subarray(min*2,max*2);return createBigInt64Array(new_buf)},[Symbol.iterator]:function*(){for(var i=0;iarray.length){throw new RangeError("offset is out of bounds")}for(var i=0;iObject.prototype.toString.call(x);API.getTypeTag=getTypeTag;!function(exports){"use strict";const IN_NODE="undefined"!=typeof process&&process.release&&"node"===process.release.name&&void 0===process.browser;let nodeFetch,nodePath,nodeFsPromisesMod,resolvePath,loadBinaryFile;if(resolvePath=IN_NODE?function(path,base){return nodePath.resolve(base||".",path)}:function(path,base){return void 0===base&&(base=location),new URL(path,base).toString()},loadBinaryFile=IN_NODE?async function(path,_file_sub_resource_hash){if(path.startsWith("file://")&&(path=path.slice("file://".length)),path.includes("://")){let response=await nodeFetch(path);if(!response.ok)throw new Error(`Failed to load '${path}': request failed.`);return new Uint8Array(await response.arrayBuffer())}{const data=await nodeFsPromisesMod.readFile(path);return new Uint8Array(data.buffer,data.byteOffset,data.byteLength)}}:async function(path,subResourceHash){const url=new URL(path,location);let options=subResourceHash?{integrity:subResourceHash}:{},response=await fetch(url,options);if(!response.ok)throw new Error(`Failed to load '${url}': request failed.`);return new Uint8Array(await response.arrayBuffer())},globalThis.document);else if(globalThis.importScripts);else if(!IN_NODE)throw new Error("Cannot determine runtime environment");function createLock(){let _lock=Promise.resolve();return async function(){const old_lock=_lock;let releaseLock;return _lock=new Promise(resolve=>releaseLock=resolve),await old_lock,releaseLock}}const acquireDynlibLock=createLock();async function loadDynlib(lib,global,searchDirs,readFileFunc){const releaseDynlibLock=await acquireDynlibLock();const fs=function(lib,searchDirs,readFileFunc){const dirname=lib.substring(0,lib.lastIndexOf("/"));let _searchDirs=searchDirs||[];_searchDirs=_searchDirs.concat(API.defaultLdLibraryPath,[dirname]);const resolvePath=path=>{for(const dir of _searchDirs){const fullPath=Module.PATH.join2(dir,path);if(null!==Module.FS.findObject(fullPath))return fullPath}return path};let readFile=path=>Module.FS.readFile(resolvePath(path));return void 0!==readFileFunc&&(readFile=path=>readFileFunc(resolvePath(path))),{findObject:(path,dontResolveLastLink)=>Module.FS.findObject(resolvePath(path),dontResolveLastLink),readFile:readFile}}(lib,searchDirs,readFileFunc);try{if(await Module.loadDynamicLibrary(lib,{loadAsync:!0,nodelete:!0,allowUndefined:!0,global:global,fs:fs}),global&&Module.PATH.isAbs(lib)){const libName=Module.PATH.basename(lib);Module.LDSO.loadedLibsByName[libName]||(Module.LDSO.loadedLibsByName[libName]=Module.LDSO.loadedLibsByName[lib])}}catch(e){if(e&&e.message&&e.message.includes("need to see wasm magic number"))return void console.warn(`Failed to load dynlib ${lib}. We probably just tried to load a linux .so file or something.`);throw e}finally{releaseDynlibLock()}}async function loadDynlibsFromPackage(pkg,dynlibPaths){const auditWheelLibDir=`${API.sitepackages}/${pkg.file_name.split("-")[0]}.libs`,readFileMemoized=(fn=>{let cache={};return(...args)=>{let n=args[0];if(n in cache)return cache[n];{let result=fn(n);return cache[n]=result,result}}})(Module.FS.readFile);let dynlibs;if(!!pkg.shared_library)dynlibs=dynlibPaths.map(path=>({path:path,global:!0}));else{const globalLibs=function(libs,readFileFunc){let readFile=Module.FS.readFile;void 0!==readFileFunc&&(readFile=readFileFunc);const globalLibs=new Set;return libs.forEach(lib=>{const binary=readFile(lib);Module.getDylinkMetadata(binary).neededDynlibs.forEach(lib=>{globalLibs.add(lib)})}),globalLibs}(dynlibPaths,readFileMemoized);dynlibs=dynlibPaths.map(path=>({path:path,global:globalLibs.has(Module.PATH.basename(path))||!!pkg.shared_library}))}dynlibs.sort((lib1,lib2)=>Number(lib2.global)-Number(lib1.global));for(const{path:path,global:global}of dynlibs)await loadDynlib(path,global,[auditWheelLibDir],readFileMemoized)}function __await(v){return this instanceof __await?(this.v=v,this):new __await(v)}function __asyncGenerator(thisArg,_arguments,generator){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,g=generator.apply(thisArg,_arguments||[]),q=[];return i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i;function verb(n){g[n]&&(i[n]=function(v){return new Promise(function(a,b){q.push([n,v,a,b])>1||resume(n,v)})})}function resume(n,v){try{(r=g[n](v)).value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}catch(e){settle(q[0][3],e)}var r}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){f(v),q.shift(),q.length&&resume(q[0][0],q[0][1])}}function isPyProxy(jsobj){return!!jsobj&&void 0!==jsobj.$$&&"PyProxy"===jsobj.$$.type}API.loadDynlib=loadDynlib,API.loadDynlibsFromPackage=loadDynlibsFromPackage,API.isPyProxy=isPyProxy,globalThis.FinalizationRegistry?Module.finalizationRegistry=new FinalizationRegistry(([ptr,cache])=>{cache&&(cache.leaked=!0,pyproxy_decref_cache(cache));try{Module._Py_DecRef(ptr)}catch(e){API.fatal_error(e)}}):Module.finalizationRegistry={register(){},unregister(){}};let trace_pyproxy_alloc,trace_pyproxy_dealloc,pyproxy_alloc_map=new Map;function pyproxy_new(ptrobj,{flags:flags_arg,cache:cache,props:props,$$:$$}={}){const flags=void 0!==flags_arg?flags_arg:Module._pyproxy_getflags(ptrobj);-1===flags&&Module._pythonexc2js();const cls=Module.getPyProxyClass(flags);let target;256&flags?(target=function(){},Object.setPrototypeOf(target,cls.prototype),delete target.length,delete target.name,target.prototype=void 0):target=Object.create(cls.prototype);const isAlias=!!$$;if(!isAlias){if(!cache){cache={cacheId:Hiwire.new_value(new Map),refcnt:0}}cache.refcnt++,$$={ptr:ptrobj,type:"PyProxy",cache:cache,flags:flags},Module.finalizationRegistry.register($$,[ptrobj,cache],$$),Module._Py_IncRef(ptrobj)}Object.defineProperty(target,"$$",{value:$$}),props||(props={}),props=Object.assign({isBound:!1,captureThis:!1,boundArgs:[],roundtrip:!1},props),Object.defineProperty(target,"$$props",{value:props});let proxy=new Proxy(target,PyProxyHandlers);return isAlias||trace_pyproxy_alloc(proxy),proxy}function _getPtr(jsobj){let ptr=jsobj.$$.ptr;if(0===ptr)throw new Error(jsobj.$$.destroyed_msg);return ptr}function _adjustArgs(proxyobj,jsthis,jsargs){const{captureThis:captureThis,boundArgs:boundArgs,boundThis:boundThis,isBound:isBound}=proxyobj.$$props;return captureThis?isBound?[boundThis].concat(boundArgs,jsargs):[jsthis].concat(jsargs):isBound?boundArgs.concat(jsargs):jsargs}Module.pyproxy_alloc_map=pyproxy_alloc_map,Module.enable_pyproxy_allocation_tracing=function(){trace_pyproxy_alloc=function(proxy){pyproxy_alloc_map.set(proxy,Error().stack)},trace_pyproxy_dealloc=function(proxy){pyproxy_alloc_map.delete(proxy)}},Module.disable_pyproxy_allocation_tracing=function(){trace_pyproxy_alloc=function(proxy){},trace_pyproxy_dealloc=function(proxy){}},Module.disable_pyproxy_allocation_tracing(),Module.pyproxy_new=pyproxy_new;let pyproxyClassMap=new Map;Module.getPyProxyClass=function(flags){const FLAG_TYPE_PAIRS=[[1,PyProxyLengthMethods],[2,PyProxyGetItemMethods],[4,PyProxySetItemMethods],[8,PyProxyContainsMethods],[16,PyProxyIterableMethods],[32,PyProxyIteratorMethods],[2048,PyProxyGeneratorMethods],[512,PyProxyAsyncIterableMethods],[1024,PyProxyAsyncIteratorMethods],[4096,PyProxyAsyncGeneratorMethods],[64,PyProxyAwaitableMethods],[128,PyProxyBufferMethods],[256,PyProxyCallableMethods]];let result=pyproxyClassMap.get(flags);if(result)return result;let descriptors={};for(let[feature_flag,methods]of FLAG_TYPE_PAIRS)flags&feature_flag&&Object.assign(descriptors,Object.getOwnPropertyDescriptors(methods.prototype));descriptors.constructor=Object.getOwnPropertyDescriptor(PyProxyClass.prototype,"constructor"),Object.assign(descriptors,Object.getOwnPropertyDescriptors({$$flags:flags}));let new_proto=Object.create(PyProxyClass.prototype,descriptors);function NewPyProxyClass(){}return NewPyProxyClass.prototype=new_proto,pyproxyClassMap.set(flags,NewPyProxyClass),NewPyProxyClass},Module.PyProxy_getPtr=_getPtr;function pyproxy_decref_cache(cache){if(cache&&(cache.refcnt--,0===cache.refcnt)){let cache_map=Hiwire.pop_value(cache.cacheId);for(let proxy_id of cache_map.values()){const cache_entry=Hiwire.pop_value(proxy_id);cache.leaked||Module.pyproxy_destroy(cache_entry,"This borrowed attribute proxy was automatically destroyed in the process of destroying the proxy it was borrowed from. Try using the 'copy' method.",!0)}}}Module.pyproxy_destroy=function(proxy,destroyed_msg,destroy_roundtrip){if(0===proxy.$$.ptr)return;if(!destroy_roundtrip&&proxy.$$props.roundtrip)return;let ptrobj=_getPtr(proxy);Module.finalizationRegistry.unregister(proxy.$$),destroyed_msg=destroyed_msg||"Object has already been destroyed";let proxy_repr,proxy_type=proxy.type;try{proxy_repr=proxy.toString()}catch(e){if(e.pyodide_fatal_error)throw e}proxy.$$.ptr=0,destroyed_msg+=`\nThe object was of type "${proxy_type}" and `,destroyed_msg+=proxy_repr?`had repr "${proxy_repr}"`:"an error was raised when trying to generate its repr",proxy.$$.destroyed_msg=destroyed_msg,pyproxy_decref_cache(proxy.$$.cache);try{Module._Py_DecRef(ptrobj),trace_pyproxy_dealloc(proxy)}catch(e){API.fatal_error(e)}},Module.callPyObjectKwargs=function(ptrobj,jsargs,kwargs){let num_pos_args=jsargs.length,kwargs_names=Object.keys(kwargs),kwargs_values=Object.values(kwargs),num_kwargs=kwargs_names.length;jsargs.push(...kwargs_values);let idresult,idargs=Hiwire.new_value(jsargs),idkwnames=Hiwire.new_value(kwargs_names);try{idresult=Module.__pyproxy_apply(ptrobj,idargs,num_pos_args,idkwnames,num_kwargs)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idargs),Hiwire.decref(idkwnames)}0===idresult&&Module._pythonexc2js();let result=Hiwire.pop_value(idresult);return result&&"coroutine"===result.type&&result._ensure_future&&result._ensure_future(),result},Module.callPyObject=function(ptrobj,jsargs){return Module.callPyObjectKwargs(ptrobj,jsargs,{})};let DESTROY_MSG_POSITIONAL_ARG_WARNED=!1;class PyProxyClass{constructor(){throw new TypeError("PyProxy is not a constructor")}get[Symbol.toStringTag](){return"PyProxy"}get type(){let ptrobj=_getPtr(this);return Hiwire.pop_value(Module.__pyproxy_type(ptrobj))}toString(){let jsref_repr,ptrobj=_getPtr(this);try{jsref_repr=Module.__pyproxy_repr(ptrobj)}catch(e){API.fatal_error(e)}return 0===jsref_repr&&Module._pythonexc2js(),Hiwire.pop_value(jsref_repr)}destroy(options={}){"string"==typeof options&&(DESTROY_MSG_POSITIONAL_ARG_WARNED||(DESTROY_MSG_POSITIONAL_ARG_WARNED=!0,console.warn("Using a positional argument for the message argument for 'destroy' is deprecated and will be removed in v0.23")),options={message:options}),options=Object.assign({message:"",destroyRoundtrip:!0},options);const{message:m,destroyRoundtrip:d}=options;Module.pyproxy_destroy(this,m,d)}copy(){return pyproxy_new(_getPtr(this),{flags:this.$$flags,cache:this.$$.cache,props:this.$$props})}toJs({depth:depth=-1,pyproxies:pyproxies,create_pyproxies:create_pyproxies=!0,dict_converter:dict_converter,default_converter:default_converter}={}){let idresult,proxies_id,ptrobj=_getPtr(this),dict_converter_id=0,default_converter_id=0;proxies_id=create_pyproxies?pyproxies?Hiwire.new_value(pyproxies):Hiwire.new_value([]):0,dict_converter&&(dict_converter_id=Hiwire.new_value(dict_converter)),default_converter&&(default_converter_id=Hiwire.new_value(default_converter));try{idresult=Module._python2js_custom(ptrobj,depth,proxies_id,dict_converter_id,default_converter_id)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(proxies_id),Hiwire.decref(dict_converter_id),Hiwire.decref(default_converter_id)}return 0===idresult&&Module._pythonexc2js(),Hiwire.pop_value(idresult)}supportsLength(){return!!(1&this.$$flags)}supportsGet(){return!!(2&this.$$flags)}supportsSet(){return!!(4&this.$$flags)}supportsHas(){return!!(8&this.$$flags)}isIterable(){return!!(48&this.$$flags)}isIterator(){return!!(32&this.$$flags)}isAwaitable(){return!!(64&this.$$flags)}isBuffer(){return!!(128&this.$$flags)}isCallable(){return!!(256&this.$$flags)}}class PyProxyLengthMethods{get length(){let length,ptrobj=_getPtr(this);try{length=Module._PyObject_Size(ptrobj)}catch(e){API.fatal_error(e)}return-1===length&&Module._pythonexc2js(),length}}class PyProxyGetItemMethods{get(key){let idresult,ptrobj=_getPtr(this),idkey=Hiwire.new_value(key);try{idresult=Module.__pyproxy_getitem(ptrobj,idkey)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idkey)}if(0===idresult){if(!Module._PyErr_Occurred())return;Module._pythonexc2js()}return Hiwire.pop_value(idresult)}}class PyProxySetItemMethods{set(key,value){let errcode,ptrobj=_getPtr(this),idkey=Hiwire.new_value(key),idval=Hiwire.new_value(value);try{errcode=Module.__pyproxy_setitem(ptrobj,idkey,idval)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idkey),Hiwire.decref(idval)}-1===errcode&&Module._pythonexc2js()}delete(key){let errcode,ptrobj=_getPtr(this),idkey=Hiwire.new_value(key);try{errcode=Module.__pyproxy_delitem(ptrobj,idkey)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idkey)}-1===errcode&&Module._pythonexc2js()}}class PyProxyContainsMethods{has(key){let result,ptrobj=_getPtr(this),idkey=Hiwire.new_value(key);try{result=Module.__pyproxy_contains(ptrobj,idkey)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idkey)}return-1===result&&Module._pythonexc2js(),1===result}}class PyProxyIterableMethods{[Symbol.iterator](){let iterptr,ptrobj=_getPtr(this),token={};try{iterptr=Module._PyObject_GetIter(ptrobj)}catch(e){API.fatal_error(e)}0===iterptr&&Module._pythonexc2js();let result=function*(iterptr,token){try{for(;;){const item=Module.__pyproxy_iter_next(iterptr);if(0===item)break;yield Hiwire.pop_value(item)}}catch(e){API.fatal_error(e)}finally{Module.finalizationRegistry.unregister(token),Module._Py_DecRef(iterptr)}Module._PyErr_Occurred()&&Module._pythonexc2js()}(iterptr,token);return Module.finalizationRegistry.register(result,[iterptr,void 0],token),result}}class PyProxyAsyncIterableMethods{[Symbol.asyncIterator](){let iterptr,ptrobj=_getPtr(this),token={};try{iterptr=Module._PyObject_GetAIter(ptrobj)}catch(e){API.fatal_error(e)}0===iterptr&&Module._pythonexc2js();let result=function(iterptr,token){return __asyncGenerator(this,arguments,function*(){try{for(;;){let item,p;try{if(item=Module.__pyproxy_aiter_next(iterptr),0===item)break;p=Hiwire.pop_value(item)}catch(e){API.fatal_error(e)}try{yield yield __await(yield __await(p))}catch(e){if(e&&"object"==typeof e&&"StopAsyncIteration"===e.type)return yield __await(void 0);throw e}finally{p.destroy()}}}finally{Module.finalizationRegistry.unregister(token),Module._Py_DecRef(iterptr)}Module._PyErr_Occurred()&&Module._pythonexc2js()})}(iterptr,token);return Module.finalizationRegistry.register(result,[iterptr,void 0],token),result}}class PyProxyIteratorMethods{[Symbol.iterator](){return this}next(arg){let status,done,idarg=Hiwire.new_value(arg),stackTop=Module.stackSave(),res_ptr=Module.stackAlloc(4);try{status=Module.__pyproxyGen_Send(_getPtr(this),idarg,res_ptr)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idarg)}let idresult=HEAPU32[0+(res_ptr>>2)];return Module.stackRestore(stackTop),-1===status&&Module._pythonexc2js(),done=0===status,{done:done,value:Hiwire.pop_value(idresult)}}}class PyProxyGeneratorMethods{throw(exc){let status,done,idarg=Hiwire.new_value(exc),stackTop=Module.stackSave(),res_ptr=Module.stackAlloc(4);try{status=Module.__pyproxyGen_throw(_getPtr(this),idarg,res_ptr)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idarg)}let idresult=HEAPU32[0+(res_ptr>>2)];return Module.stackRestore(stackTop),-1===status&&Module._pythonexc2js(),done=0===status,{done:done,value:Hiwire.pop_value(idresult)}}return(v){let status,done,idarg=Hiwire.new_value(v),stackTop=Module.stackSave(),res_ptr=Module.stackAlloc(4);try{status=Module.__pyproxyGen_return(_getPtr(this),idarg,res_ptr)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idarg)}let idresult=HEAPU32[0+(res_ptr>>2)];return Module.stackRestore(stackTop),-1===status&&Module._pythonexc2js(),done=0===status,{done:done,value:Hiwire.pop_value(idresult)}}}class PyProxyAsyncIteratorMethods{async next(arg){let idresult,idarg=Hiwire.new_value(arg);try{idresult=Module.__pyproxyGen_asend(_getPtr(this),idarg)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idarg)}0===idresult&&Module._pythonexc2js();const p=Hiwire.pop_value(idresult);let value;try{value=await p}catch(e){if(e&&"object"==typeof e&&"StopAsyncIteration"===e.type)return{done:!0,value:value};throw e}finally{p.destroy()}return{done:!1,value:value}}}class PyProxyAsyncGeneratorMethods{async throw(exc){let idresult,idarg=Hiwire.new_value(exc);try{idresult=Module.__pyproxyGen_athrow(_getPtr(this),idarg)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idarg)}0===idresult&&Module._pythonexc2js();const p=Hiwire.pop_value(idresult);let value;try{value=await p}catch(e){if(e&&"object"==typeof e){if("StopAsyncIteration"===e.type)return{done:!0,value:value};if("GeneratorExit"===e.type)return{done:!0,value:value}}throw e}finally{p.destroy()}return{done:!1,value:value}}async return(v){let idresult;try{idresult=Module.__pyproxyGen_areturn(_getPtr(this))}catch(e){API.fatal_error(e)}0===idresult&&Module._pythonexc2js();const p=Hiwire.pop_value(idresult);let value;try{value=await p}catch(e){if(e&&"object"==typeof e){if("StopAsyncIteration"===e.type)return{done:!0,value:value};if("GeneratorExit"===e.type)return{done:!0,value:v}}throw e}finally{p.destroy()}return{done:!1,value:value}}}let PyProxyHandlers={isExtensible:()=>!0,has:(jsobj,jskey)=>!!Reflect.has(jsobj,jskey)||"symbol"!=typeof jskey&&(jskey.startsWith("$")&&(jskey=jskey.slice(1)),function(jsobj,jskey){let result,ptrobj=_getPtr(jsobj),idkey=Hiwire.new_value(jskey);try{result=Module.__pyproxy_hasattr(ptrobj,idkey)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idkey)}return-1===result&&Module._pythonexc2js(),0!==result}(jsobj,jskey)),get(jsobj,jskey){if(jskey in jsobj||"symbol"==typeof jskey)return Reflect.get(jsobj,jskey);jskey.startsWith("$")&&(jskey=jskey.slice(1));let idresult=function(jsobj,jskey){let idresult,ptrobj=_getPtr(jsobj),idkey=Hiwire.new_value(jskey),cacheId=jsobj.$$.cache.cacheId;try{idresult=Module.__pyproxy_getattr(ptrobj,idkey,cacheId)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idkey)}return 0===idresult&&Module._PyErr_Occurred()&&Module._pythonexc2js(),idresult}(jsobj,jskey);return 0!==idresult?Hiwire.pop_value(idresult):void 0},set(jsobj,jskey,jsval){let descr=Object.getOwnPropertyDescriptor(jsobj,jskey);if(descr&&!descr.writable)throw new TypeError(`Cannot set read only field '${jskey}'`);return"symbol"==typeof jskey?Reflect.set(jsobj,jskey,jsval):(jskey.startsWith("$")&&(jskey=jskey.slice(1)),function(jsobj,jskey,jsval){let errcode,ptrobj=_getPtr(jsobj),idkey=Hiwire.new_value(jskey),idval=Hiwire.new_value(jsval);try{errcode=Module.__pyproxy_setattr(ptrobj,idkey,idval)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idkey),Hiwire.decref(idval)}-1===errcode&&Module._pythonexc2js()}(jsobj,jskey,jsval),!0)},deleteProperty(jsobj,jskey){let descr=Object.getOwnPropertyDescriptor(jsobj,jskey);if(descr&&!descr.writable)throw new TypeError(`Cannot delete read only field '${jskey}'`);return"symbol"==typeof jskey?Reflect.deleteProperty(jsobj,jskey):(jskey.startsWith("$")&&(jskey=jskey.slice(1)),function(jsobj,jskey){let errcode,ptrobj=_getPtr(jsobj),idkey=Hiwire.new_value(jskey);try{errcode=Module.__pyproxy_delattr(ptrobj,idkey)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(idkey)}-1===errcode&&Module._pythonexc2js()}(jsobj,jskey),!descr||!!descr.configurable)},ownKeys(jsobj){let idresult,ptrobj=_getPtr(jsobj);try{idresult=Module.__pyproxy_ownKeys(ptrobj)}catch(e){API.fatal_error(e)}0===idresult&&Module._pythonexc2js();let result=Hiwire.pop_value(idresult);return result.push(...Reflect.ownKeys(jsobj)),result},apply:(jsobj,jsthis,jsargs)=>jsobj.apply(jsthis,jsargs)};class PyProxyAwaitableMethods{_ensure_future(){if(this.$$.promise)return this.$$.promise;let resolveHandle,rejectHandle,errcode,ptrobj=_getPtr(this),promise=new Promise((resolve,reject)=>{resolveHandle=resolve,rejectHandle=reject}),resolve_handle_id=Hiwire.new_value(resolveHandle),reject_handle_id=Hiwire.new_value(rejectHandle);try{errcode=Module.__pyproxy_ensure_future(ptrobj,resolve_handle_id,reject_handle_id)}catch(e){API.fatal_error(e)}finally{Hiwire.decref(reject_handle_id),Hiwire.decref(resolve_handle_id)}return-1===errcode&&Module._pythonexc2js(),this.$$.promise=promise,this.destroy(),promise}then(onFulfilled,onRejected){return this._ensure_future().then(onFulfilled,onRejected)}catch(onRejected){return this._ensure_future().catch(onRejected)}finally(onFinally){return this._ensure_future().finally(onFinally)}}class PyProxyCallableMethods{apply(thisArg,jsargs){return jsargs=_adjustArgs(this,thisArg,jsargs=function(...args){return args}.apply(void 0,jsargs)),Module.callPyObject(_getPtr(this),jsargs)}call(thisArg,...jsargs){return jsargs=_adjustArgs(this,thisArg,jsargs),Module.callPyObject(_getPtr(this),jsargs)}callKwargs(...jsargs){if(0===jsargs.length)throw new TypeError("callKwargs requires at least one argument (the key word argument object)");let kwargs=jsargs.pop();if(void 0!==kwargs.constructor&&"Object"!==kwargs.constructor.name)throw new TypeError("kwargs argument is not an object");return Module.callPyObjectKwargs(_getPtr(this),jsargs,kwargs)}bind(thisArg,...jsargs){const{boundArgs:boundArgsOld,boundThis:boundThisOld,isBound:isBound}=this.$$props;let boundThis=thisArg;isBound&&(boundThis=boundThisOld);let boundArgs=boundArgsOld.concat(jsargs);const props=Object.assign({},this.$$props,{boundArgs:boundArgs,isBound:!0,boundThis:boundThis}),$$=this.$$;return pyproxy_new(_getPtr(this),{$$:$$,flags:this.$$flags,props:props})}captureThis(){const props=Object.assign({},this.$$props,{captureThis:!0});return pyproxy_new(_getPtr(this),{$$:this.$$,flags:this.$$flags,props:props})}}PyProxyCallableMethods.prototype.prototype=Function.prototype;let cdnURL,type_to_array_map=new Map([["i8",Int8Array],["u8",Uint8Array],["u8clamped",Uint8ClampedArray],["i16",Int16Array],["u16",Uint16Array],["i32",Int32Array],["u32",Uint32Array],["i32",Int32Array],["u32",Uint32Array],["i64",globalThis.BigInt64Array],["u64",globalThis.BigUint64Array],["f32",Float32Array],["f64",Float64Array],["dataview",DataView]]);class PyProxyBufferMethods{getBuffer(type){let ArrayType;if(type&&(ArrayType=type_to_array_map.get(type),void 0===ArrayType))throw new Error(`Unknown type ${type}`);let errcode,orig_stack_ptr=Module.stackSave(),buffer_struct_ptr=Module.stackAlloc(HEAPU32[0+(Module._buffer_struct_size>>2)]),this_ptr=_getPtr(this);try{errcode=Module.__pyproxy_get_buffer(buffer_struct_ptr,this_ptr)}catch(e){API.fatal_error(e)}-1===errcode&&Module._pythonexc2js();let startByteOffset=HEAPU32[0+(buffer_struct_ptr>>2)],minByteOffset=HEAPU32[1+(buffer_struct_ptr>>2)],maxByteOffset=HEAPU32[2+(buffer_struct_ptr>>2)],readonly=!!HEAPU32[3+(buffer_struct_ptr>>2)],format_ptr=HEAPU32[4+(buffer_struct_ptr>>2)],itemsize=HEAPU32[5+(buffer_struct_ptr>>2)],shape=Hiwire.pop_value(HEAPU32[6+(buffer_struct_ptr>>2)]),strides=Hiwire.pop_value(HEAPU32[7+(buffer_struct_ptr>>2)]),view_ptr=HEAPU32[8+(buffer_struct_ptr>>2)],c_contiguous=!!HEAPU32[9+(buffer_struct_ptr>>2)],f_contiguous=!!HEAPU32[10+(buffer_struct_ptr>>2)],format=Module.UTF8ToString(format_ptr);Module.stackRestore(orig_stack_ptr);let success=!1;try{let bigEndian=!1;void 0===ArrayType&&([ArrayType,bigEndian]=Module.processBufferFormatString(format," In this case, you can pass an explicit type argument."));let alignment=parseInt(ArrayType.name.replace(/[^0-9]/g,""))/8||1;if(bigEndian&&alignment>1)throw new Error("Javascript has no native support for big endian buffers. In this case, you can pass an explicit type argument. For instance, `getBuffer('dataview')` will return a `DataView`which has native support for reading big endian data. Alternatively, toJs will automatically convert the buffer to little endian.");let numBytes=maxByteOffset-minByteOffset;if(0!==numBytes&&(startByteOffset%alignment!=0||minByteOffset%alignment!=0||maxByteOffset%alignment!=0))throw new Error(`Buffer does not have valid alignment for a ${ArrayType.name}`);let data,numEntries=numBytes/alignment,offset=(startByteOffset-minByteOffset)/alignment;data=0===numBytes?new ArrayType:new ArrayType(HEAPU32.buffer,minByteOffset,numEntries);for(let i of strides.keys())strides[i]/=alignment;return success=!0,Object.create(PyBuffer.prototype,Object.getOwnPropertyDescriptors({offset:offset,readonly:readonly,format:format,itemsize:itemsize,ndim:shape.length,nbytes:numBytes,shape:shape,strides:strides,data:data,c_contiguous:c_contiguous,f_contiguous:f_contiguous,_view_ptr:view_ptr,_released:!1}))}finally{if(!success)try{Module._PyBuffer_Release(view_ptr),Module._PyMem_Free(view_ptr)}catch(e){API.fatal_error(e)}}}}class PyBuffer{constructor(){throw new TypeError("PyBuffer is not a constructor")}release(){if(!this._released){try{Module._PyBuffer_Release(this._view_ptr),Module._PyMem_Free(this._view_ptr)}catch(e){API.fatal_error(e)}this._released=!0,this.data=null}}}API.packageIndexReady=async function(lockFileURL){let repodata;if(IN_NODE){await async function(){if(!IN_NODE)return;if((await import("url")).default,nodeFsPromisesMod=await import("fs/promises"),nodeFetch=globalThis.fetch?fetch:(await import("node-fetch")).default,(await import("vm")).default,nodePath=await import("path"),"undefined"!=typeof require)return;const node_modules={fs:await import("fs"),crypto:await import("crypto"),ws:await import("ws"),child_process:await import("child_process")};globalThis.require=function(mod){return node_modules[mod]}}();const package_string=await nodeFsPromisesMod.readFile(lockFileURL);repodata=JSON.parse(package_string)}else{let response=await fetch(lockFileURL);repodata=await response.json()}if(!repodata.packages)throw new Error("Loaded repodata.json does not contain the expected key 'packages'.");API.repodata_info=repodata.info,API.repodata_packages=repodata.packages,API._import_name_to_package_name=new Map;for(let name of Object.keys(API.repodata_packages))for(let import_name of API.repodata_packages[name].imports)API._import_name_to_package_name.set(import_name,name)}(API.config.lockFileURL),API.setCdnUrl=function(url){cdnURL=url};const package_uri_regexp=/^.*?([^\/]*)\.whl$/;function _uri_to_package_name(package_uri){let match=package_uri_regexp.exec(package_uri);if(match){return match[1].toLowerCase().split("-").slice(0,-4).join("-")}}function createDonePromise(){let _resolve=()=>{},_reject=()=>{};const p=new Promise((resolve,reject)=>{_resolve=resolve,_reject=reject});return p.resolve=_resolve,p.reject=_reject,p}function addPackageToLoad(name,toLoad){if(name=name.toLowerCase(),toLoad.has(name))return;const pkg_info=API.repodata_packages[name];if(!pkg_info)throw new Error(`No known package with name '${name}'`);if(toLoad.set(name,{name:name,channel:"default channel",depends:pkg_info.depends,installPromise:void 0,done:createDonePromise()}),void 0===loadedPackages[name])for(let dep_name of pkg_info.depends)addPackageToLoad(dep_name,toLoad)}async function downloadAndInstall(name,toLoad,loaded,failed,checkIntegrity=!0){if(void 0!==loadedPackages[name])return;const pkg=toLoad.get(name);try{const buffer=await async function(name,channel,checkIntegrity=!0){let file_name,uri,file_sub_resource_hash;if("default channel"===channel){if(!(name in API.repodata_packages))throw new Error(`Internal error: no entry for package named ${name}`);file_name=API.repodata_packages[name].file_name,uri=resolvePath(file_name,API.config.indexURL),file_sub_resource_hash=API.package_loader.sub_resource_hash(API.repodata_packages[name].sha256)}else uri=channel,file_sub_resource_hash=void 0;checkIntegrity||(file_sub_resource_hash=void 0);try{return await loadBinaryFile(uri,file_sub_resource_hash)}catch(e){if(!IN_NODE||"default channel"!==channel)throw e}console.log(`Didn't find package ${file_name} locally, attempting to load from ${cdnURL}`);let binary=await loadBinaryFile(cdnURL+file_name);return console.log(`Package ${file_name} loaded from ${cdnURL}, caching the wheel in node_modules for future use.`),await nodeFsPromisesMod.writeFile(uri,binary),binary}(pkg.name,pkg.channel,checkIntegrity),installPromisDependencies=pkg.depends.map(dependency=>toLoad.has(dependency)?toLoad.get(dependency).done:Promise.resolve());await Promise.all(installPromisDependencies),await async function(name,buffer,channel){let pkg=API.repodata_packages[name];pkg||(pkg={file_name:".whl",shared_library:!1,depends:[],imports:[],install_dir:"site"});const filename=pkg.file_name,dynlibs=API.package_loader.unpack_buffer.callKwargs({buffer:buffer,filename:filename,target:pkg.install_dir,calculate_dynlibs:!0,installer:"pyodide.loadPackage",source:"default channel"===channel?"pyodide":channel});await loadDynlibsFromPackage(pkg,dynlibs)}(pkg.name,buffer,pkg.channel),loaded.add(pkg.name),loadedPackages[pkg.name]=pkg.channel}catch(err){failed.set(name,err)}finally{pkg.done.resolve()}}const acquirePackageLock=createLock();let loadPackagePositionalCallbackDeprecationWarned=!1;async function loadPackage(names,options={checkIntegrity:!0},errorCallbackDeprecated){"function"==typeof options&&(loadPackagePositionalCallbackDeprecationWarned||(console.warn("Passing a messageCallback or errorCallback as the second or third argument to loadPackage is deprecated and will be removed in v0.24. Instead use { messageCallback : callbackFunc }"),options={messageCallback:options,errorCallback:errorCallbackDeprecated},loadPackagePositionalCallbackDeprecationWarned=!0));const messageCallback=options.messageCallback||console.log,errorCallback=options.errorCallback||console.error;isPyProxy(names)&&(names=names.toJs()),Array.isArray(names)||(names=[names]);const toLoad=function(names,errorCallback){const toLoad=new Map;for(let name of names){const pkgname=_uri_to_package_name(name);if(void 0===pkgname){addPackageToLoad(name,toLoad);continue}const channel=name;toLoad.has(pkgname)&&toLoad.get(pkgname).channel!==channel?errorCallback(`Loading same package ${pkgname} from ${channel} and ${toLoad.get(pkgname).channel}`):toLoad.set(pkgname,{name:pkgname,channel:channel,depends:[],installPromise:void 0,done:createDonePromise()})}return toLoad}(names,errorCallback);for(const[pkg,pkg_metadata]of toLoad){const loaded=loadedPackages[pkg];void 0!==loaded&&(toLoad.delete(pkg),loaded===pkg_metadata.channel||"default channel"===pkg_metadata.channel?messageCallback(`${pkg} already loaded from ${loaded}`):errorCallback(`URI mismatch, attempting to load package ${pkg} from ${pkg_metadata.channel} while it is already loaded from ${loaded}. To override a dependency, load the custom package first.`))}if(0===toLoad.size)return void messageCallback("No new packages to load");const packageNames=[...toLoad.keys()].join(", "),loaded=new Set,failed=new Map,releaseLock=await acquirePackageLock();try{messageCallback(`Loading ${packageNames}`);for(const[name]of toLoad)loadedPackages[name]?toLoad.delete(name):toLoad.get(name).installPromise=downloadAndInstall(name,toLoad,loaded,failed,options.checkIntegrity);if(await Promise.all(Array.from(toLoad.values()).map(({installPromise:installPromise})=>installPromise)),Module.reportUndefinedSymbols(),loaded.size>0){messageCallback(`Loaded ${Array.from(loaded).join(", ")}`)}if(failed.size>0){messageCallback(`Failed to load ${Array.from(failed.keys()).join(", ")}`);for(const[name,err]of failed)errorCallback(`The following error occurred while loading ${name}:`),errorCallback(err.message)}API.importlib.invalidate_caches()}finally{releaseLock()}}let loadedPackages={};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var errorStackParser={exports:{}},stackframe={exports:{}};stackframe.exports=function(){function _isNumber(n){return!isNaN(parseFloat(n))&&isFinite(n)}function _capitalize(str){return str.charAt(0).toUpperCase()+str.substring(1)}function _getter(p){return function(){return this[p]}}var booleanProps=["isConstructor","isEval","isNative","isToplevel"],numericProps=["columnNumber","lineNumber"],stringProps=["fileName","functionName","source"],arrayProps=["args"],objectProps=["evalOrigin"],props=booleanProps.concat(numericProps,stringProps,arrayProps,objectProps);function StackFrame(obj){if(obj)for(var i=0;i-1&&(line=line.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var sanitizedLine=line.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),location=sanitizedLine.match(/ (\(.+\)$)/);sanitizedLine=location?sanitizedLine.replace(location[0],""):sanitizedLine;var locationParts=this.extractLocation(location?location[1]:sanitizedLine),functionName=location&&sanitizedLine||void 0,fileName=["eval",""].indexOf(locationParts[0])>-1?void 0:locationParts[0];return new StackFrame({functionName:functionName,fileName:fileName,lineNumber:locationParts[1],columnNumber:locationParts[2],source:line})},this)},parseFFOrSafari:function(error){return error.stack.split("\n").filter(function(line){return!line.match(SAFARI_NATIVE_CODE_REGEXP)},this).map(function(line){if(line.indexOf(" > eval")>-1&&(line=line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===line.indexOf("@")&&-1===line.indexOf(":"))return new StackFrame({functionName:line});var functionNameRegex=/((.*".+"[^@]*)?[^@]*)(?:@)/,matches=line.match(functionNameRegex),functionName=matches&&matches[1]?matches[1]:void 0,locationParts=this.extractLocation(line.replace(functionNameRegex,""));return new StackFrame({functionName:functionName,fileName:locationParts[0],lineNumber:locationParts[1],columnNumber:locationParts[2],source:line})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var lineRE=/Line (\d+).*script (?:in )?(\S+)/i,lines=e.message.split("\n"),result=[],i=2,len=lines.length;i/,"$2").replace(/\([^)]*\)/g,"")||void 0;functionCall.match(/\(([^)]*)\)/)&&(argsRaw=functionCall.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var args=void 0===argsRaw||"[arguments not available]"===argsRaw?void 0:argsRaw.split(",");return new StackFrame({functionName:functionName,args:args,fileName:locationParts[0],lineNumber:locationParts[1],columnNumber:locationParts[2],source:line})},this)}})}(errorStackParser);var ErrorStackParser=errorStackParser.exports;function ensureCaughtObjectIsError(e){if("string"==typeof e)e=new Error(e);else if("object"!=typeof e||null===e||"string"!=typeof e.stack||"string"!=typeof e.message){let msg=`A value of type ${typeof e} with tag ${API.getTypeTag(e)} was thrown as an error!`;try{msg+=`\nString interpolation of the thrown value gives """${e}""".`}catch(e){msg+="\nString interpolation of the thrown value fails."}try{msg+=`\nThe thrown value's toString method returns """${e.toString()}""".`}catch(e){msg+="\nThe thrown value's toString method fails."}e=new Error(msg)}return e}class CppException extends Error{constructor(ty,msg,ptr){msg||(msg=`The exception is an object of type ${ty} at address ${ptr} which does not inherit from std::exception`),super(msg),this.ty=ty}}function convertCppException(e){let[ty,msg]=Module.getExceptionMessage(e);return new CppException(ty,msg,e)}Object.defineProperty(CppException.prototype,"name",{get(){return`${this.constructor.name} ${this.ty}`}}),Tests.convertCppException=convertCppException;let fatal_error_occurred=!1;API.fatal_error=function(e){if(!e||!e.pyodide_fatal_error){if(fatal_error_occurred)return console.error("Recursive call to fatal_error. Inner error was:"),void console.error(e);(e="number"==typeof e?convertCppException(e):ensureCaughtObjectIsError(e)).pyodide_fatal_error=!0,fatal_error_occurred=!0,console.error("Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers."),console.error("The cause of the fatal error was:"),API.inTestHoist?(console.error(e.toString()),console.error(e.stack)):console.error(e);try{Module._dump_traceback();for(let key of Object.keys(API.public_api))key.startsWith("_")||"version"===key||Object.defineProperty(API.public_api,key,{enumerable:!0,configurable:!0,get:()=>{throw new Error("Pyodide already fatally failed and can no longer be used.")}});API.on_fatal&&API.on_fatal(e)}catch(err2){console.error("Another error occurred while handling the fatal error:"),console.error(err2)}throw e}};class FatalPyodideError extends Error{}Object.defineProperty(FatalPyodideError.prototype,"name",{value:FatalPyodideError.name});let stderr_chars=[];function isPyodideFrame(frame){if(!frame)return!1;const fileName=frame.fileName||"";if(fileName.includes("wasm-function"))return!0;if(!fileName.includes("pyodide.asm.js"))return!1;let funcName=frame.functionName||"";return funcName.startsWith("Object.")&&(funcName=funcName.slice("Object.".length)),!(funcName in API.public_api)||"PythonError"===funcName||(frame.functionName=funcName,!1)}API.capture_stderr=function(){stderr_chars=[];const FS=Module.FS;FS.createDevice("/dev","capture_stderr",null,e=>stderr_chars.push(e)),FS.closeStream(2),FS.open("/dev/capture_stderr",1)},API.restore_stderr=function(){const FS=Module.FS;return FS.closeStream(2),FS.unlink("/dev/capture_stderr"),FS.open("/dev/stderr",1),(new TextDecoder).decode(new Uint8Array(stderr_chars))},API.fatal_loading_error=function(...args){let message=args.join(" ");if(Module._PyErr_Occurred()){API.capture_stderr(),Module._PyErr_Print();message+="\n"+API.restore_stderr()}throw new FatalPyodideError(message)},Module.handle_js_error=function(e){if(e&&e.pyodide_fatal_error)throw e;if(e instanceof Module._PropagatePythonError)return;let stack,weirdCatch,restored_error=!1;e instanceof API.PythonError&&(restored_error=Module._restore_sys_last_exception(e.__error_address));try{stack=ErrorStackParser.parse(e)}catch(_){weirdCatch=!0}if(weirdCatch&&(e=ensureCaughtObjectIsError(e)),!restored_error){let eidx=Hiwire.new_value(e),err=Module._JsProxy_create(eidx);Module._set_error(err),Module._Py_DecRef(err),Hiwire.decref(eidx)}if(!weirdCatch){if(function(frame){if(!isPyodideFrame(frame))return!1;const funcName=frame.functionName;return"PythonError"===funcName||"new_error"===funcName}(stack[0]))for(;isPyodideFrame(stack[0]);)stack.shift();for(const frame of stack){if(isPyodideFrame(frame))break;const funcnameAddr=Module.stringToNewUTF8(frame.functionName||"???"),fileNameAddr=Module.stringToNewUTF8(frame.fileName||"???.js");Module.__PyTraceback_Add(funcnameAddr,fileNameAddr,frame.lineNumber),Module._free(funcnameAddr),Module._free(fileNameAddr)}}};class PythonError extends Error{constructor(type,message,error_address){const oldLimit=Error.stackTraceLimit;Error.stackTraceLimit=1/0,super(message),Error.stackTraceLimit=oldLimit,this.type=type,this.__error_address=error_address}}Object.defineProperty(PythonError.prototype,"name",{value:PythonError.name}),API.PythonError=PythonError;class _PropagatePythonError extends Error{constructor(){API.fail_test=!0,super("If you are seeing this message, an internal Pyodide error has occurred. Please report it to the Pyodide maintainers.")}}Object.defineProperty(_PropagatePythonError.prototype,"name",{value:_PropagatePythonError.name}),Module._PropagatePythonError=_PropagatePythonError;let INITIALIZED=!1;const ttyout_ops={},ttyerr_ops={},isattys={};function refreshStreams(){INITIALIZED&&(FS.unlink("/dev/stdin"),FS.unlink("/dev/stdout"),FS.unlink("/dev/stderr"),isattys.stdin?FS.symlink("/dev/tty","/dev/stdin"):FS.createDevice("/dev","stdin",ttyout_ops.get_char),isattys.stdout?FS.symlink("/dev/tty","/dev/stdout"):FS.createDevice("/dev","stdout",null,ttyout_ops.put_char.bind(void 0,void 0)),isattys.stderr?FS.symlink("/dev/tty","/dev/stderr"):FS.createDevice("/dev","stderr",null,ttyerr_ops.put_char.bind(void 0,void 0)),FS.closeStream(0),FS.closeStream(1),FS.closeStream(2),FS.open("/dev/stdin",0),FS.open("/dev/stdout",1),FS.open("/dev/stderr",1))}function setStdinError(){isattys.stdin=!1;const get_char=()=>{throw 0};ttyout_ops.get_char=get_char,ttyerr_ops.get_char=get_char,refreshStreams()}function setStdin(options={}){if(options.error)setStdinError();else{if(options.stdin){isattys.stdin=!!options.isatty;const get_char=function(infunc){let index=0,buf=new Uint8Array(0);return function(){try{if(index>=buf.length){let input=infunc();if(null==input)return null;if("string"==typeof input)input.endsWith("\n")||(input+="\n"),buf=textencoder.encode(input);else if(ArrayBuffer.isView(input)){if(1!==input.BYTES_PER_ELEMENT)throw new Error("Expected BYTES_PER_ELEMENT to be 1");buf=input}else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(input))throw new Error("Expected result to be undefined, null, string, array buffer, or array buffer view");buf=new Uint8Array(input)}if(0===buf.length)return null;index=0}return buf[index++]}catch(e){throw console.error("Error thrown in stdin:"),console.error(e),e}}}(options.stdin);return ttyout_ops.get_char=get_char,ttyerr_ops.get_char=get_char,void refreshStreams()}!function(){if(IN_NODE){const BUFSIZE=256,buf=Buffer.alloc(BUFSIZE),fs=require("fs");setStdin({stdin:function(){let bytesRead;try{bytesRead=fs.readSync(process.stdin.fd,buf,0,BUFSIZE,-1)}catch(e){if(!e.toString().includes("EOF"))throw e;bytesRead=0}return 0===bytesRead?null:buf.subarray(0,bytesRead)},isatty:require("tty").isatty(process.stdin.fd)})}else setStdinError()}()}}function setDefaultStdout(){if(IN_NODE){setStdout({raw:x=>process.stdout.write(Buffer.from([x])),isatty:require("tty").isatty(process.stdout.fd)})}else setStdout({batched:x=>console.log(x)})}function setStdout(options={}){return options.raw?(isattys.stdout=!!options.isatty,Object.assign(ttyout_ops,make_unbatched_put_char(options.raw)),void refreshStreams()):options.batched?(isattys.stdout=!1,Object.assign(ttyout_ops,make_batched_put_char(options.batched)),void refreshStreams()):void setDefaultStdout()}function setDefaultStderr(){if(IN_NODE){setStderr({raw:x=>process.stderr.write(Buffer.from([x])),isatty:require("tty").isatty(process.stderr.fd)})}else setStderr({batched:x=>console.warn(x)})}function setStderr(options={}){return options.raw?(isattys.stderr=!!options.isatty,Object.assign(ttyerr_ops,make_unbatched_put_char(options.raw)),void refreshStreams()):options.batched?(isattys.stderr=!1,Object.assign(ttyerr_ops,make_batched_put_char(options.batched)),void refreshStreams()):void setDefaultStderr()}API.initializeStreams=function(stdin,stdout,stderr){setStdin({stdin:stdin}),stdout?setStdout({batched:stdout}):setDefaultStdout(),stderr?setStderr({batched:stderr}):setDefaultStderr();const ttyout_dev=FS.makedev(5,0),ttyerr_dev=FS.makedev(6,0);TTY.register(ttyout_dev,ttyout_ops),TTY.register(ttyerr_dev,ttyerr_ops),INITIALIZED=!0,refreshStreams()};const textencoder=new TextEncoder,textdecoder=new TextDecoder;function make_unbatched_put_char(out){return{put_char(tty,val){out(val)},fsync(){}}}function make_batched_put_char(out){let output=[];return{put_char(tty,val){null===val||10===val?(out(textdecoder.decode(new Uint8Array(output))),output=[]):0!==val&&output.push(val)},fsync(tty){output&&output.length>0&&(out(textdecoder.decode(new Uint8Array(output))),output=[])}}}function runPython(code,options={}){return options.globals||(options.globals=API.globals),API.pyodide_code.eval_code(code,options.globals)}API.loadBinaryFile=loadBinaryFile,API.rawRun=function(code){const code_ptr=Module.stringToNewUTF8(code);Module.API.capture_stderr();let errcode=Module._PyRun_SimpleString(code_ptr);Module._free(code_ptr);return[errcode,Module.API.restore_stderr().trim()]},API.runPythonInternal=function(code){return API._pyodide._base.eval_code(code,API.runPythonInternal_dict)},API.runPython=runPython;let loadPackagesFromImportsPositionalCallbackDeprecationWarned=!1;async function loadPackagesFromImports(code,options={checkIntegrity:!0},errorCallbackDeprecated){"function"==typeof options&&(loadPackagesFromImportsPositionalCallbackDeprecationWarned||(console.warn("Passing a messageCallback or errorCallback as the second or third argument to loadPackagesFromImports is deprecated and will be removed in v0.24. Instead use { messageCallback : callbackFunc }"),options={messageCallback:options,errorCallback:errorCallbackDeprecated},loadPackagesFromImportsPositionalCallbackDeprecationWarned=!0));let imports,pyimports=API.pyodide_code.find_imports(code);try{imports=pyimports.toJs()}finally{pyimports.destroy()}if(0===imports.length)return;let packageNames=API._import_name_to_package_name,packages=new Set;for(let name of imports)packageNames.has(name)&&packages.add(packageNames.get(name));packages.size&&await loadPackage(Array.from(packages),options)}async function runPythonAsync(code,options={}){return options.globals||(options.globals=API.globals),await API.pyodide_code.eval_code_async(code,options.globals)}function registerJsModule(name,module){API.pyodide_ffi.register_js_module(name,module)}function registerComlink(Comlink){API._Comlink=Comlink}function unregisterJsModule(name){API.pyodide_ffi.unregister_js_module(name)}function toPy(obj,{depth:depth,defaultConverter:defaultConverter}={depth:-1}){switch(typeof obj){case"string":case"number":case"boolean":case"bigint":case"undefined":return obj}if(!obj||API.isPyProxy(obj))return obj;let obj_id=0,py_result=0,result=0;try{obj_id=Hiwire.new_value(obj);try{py_result=Module.js2python_convert(obj_id,{depth:depth,defaultConverter:defaultConverter})}catch(e){throw e instanceof Module._PropagatePythonError&&Module._pythonexc2js(),e}if(Module._JsProxy_Check(py_result))return obj;result=Module._python2js(py_result),0===result&&Module._pythonexc2js()}finally{Hiwire.decref(obj_id),Module._Py_DecRef(py_result)}return Hiwire.pop_value(result)}function pyimport(mod_name){return API.importlib.import_module(mod_name)}function unpackArchive(buffer,format,options={}){if(!ArrayBuffer.isView(buffer)&&"[object ArrayBuffer]"!==API.getTypeTag(buffer))throw new TypeError("Expected argument 'buffer' to be an ArrayBuffer or an ArrayBuffer view");API.typedArrayAsUint8Array(buffer);let extract_dir=options.extractDir;API.package_loader.unpack_buffer.callKwargs({buffer:buffer,format:format,extract_dir:extract_dir,installer:"pyodide.unpackArchive"})}async function mountNativeFS(path,fileSystemHandle){if("FileSystemDirectoryHandle"!==fileSystemHandle.constructor.name)throw new TypeError("Expected argument 'fileSystemHandle' to be a FileSystemDirectoryHandle");return null==Module.FS.findObject(path)&&Module.FS.mkdirTree(path),Module.FS.mount(Module.FS.filesystems.NATIVEFS_ASYNC,{fileSystemHandle:fileSystemHandle},path),await new Promise((resolve,_)=>Module.FS.syncfs(!0,resolve)),{syncfs:async()=>new Promise((resolve,_)=>Module.FS.syncfs(!1,resolve))}}function setInterruptBuffer(interrupt_buffer){Module.HEAP8[Module._Py_EMSCRIPTEN_SIGNAL_HANDLING]=!!interrupt_buffer,Module.Py_EmscriptenSignalBuffer=interrupt_buffer}function checkInterrupt(){Module.__PyErr_CheckSignals()&&Module._pythonexc2js()}API.runPythonAsync=runPythonAsync,API.saveState=()=>API.pyodide_py._state.save_state(),API.restoreState=state=>API.pyodide_py._state.restore_state(state),exports.FS=void 0,exports.PATH=void 0,exports.ERRNO_CODES=void 0,API.makePublicAPI=function(){exports.FS=Module.FS,exports.PATH=Module.PATH,exports.ERRNO_CODES=Module.ERRNO_CODES;let namespace={globals:undefined,FS:exports.FS,PATH:exports.PATH,ERRNO_CODES:exports.ERRNO_CODES,pyodide_py:undefined,version:"0.22.0.dev0",loadPackage:loadPackage,loadPackagesFromImports:loadPackagesFromImports,loadedPackages:loadedPackages,isPyProxy:isPyProxy,runPython:runPython,runPythonAsync:runPythonAsync,registerJsModule:registerJsModule,unregisterJsModule:unregisterJsModule,setInterruptBuffer:setInterruptBuffer,checkInterrupt:checkInterrupt,toPy:toPy,pyimport:pyimport,unpackArchive:unpackArchive,mountNativeFS:mountNativeFS,registerComlink:registerComlink,PythonError:PythonError,PyBuffer:PyBuffer,_module:Module,_api:API,setStdin:setStdin,setStdout:setStdout,setStderr:setStderr};return API.public_api=namespace,namespace},exports.checkInterrupt=checkInterrupt,exports.globals=undefined,exports.isPyProxy=isPyProxy,exports.loadPackage=loadPackage,exports.loadPackagesFromImports=loadPackagesFromImports,exports.loadedPackages=loadedPackages,exports.mountNativeFS=mountNativeFS,exports.pyimport=pyimport,exports.pyodide_py=undefined,exports.registerComlink=registerComlink,exports.registerJsModule=registerJsModule,exports.runPython=runPython,exports.runPythonAsync=runPythonAsync,exports.setInterruptBuffer=setInterruptBuffer,exports.toPy=toPy,exports.unpackArchive=unpackArchive,exports.unregisterJsModule=unregisterJsModule,Object.defineProperty(exports,"__esModule",{value:!0})}({});var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",function(reason){throw reason});quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var STACK_ALIGN=16;var POINTER_SIZE=4;function getNativeTypeSize(type){switch(type){case"i1":case"i8":case"u8":return 1;case"i16":case"u16":return 2;case"i32":case"u32":return 4;case"i64":case"u64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return POINTER_SIZE}if(type[0]==="i"){const bits=Number(type.substr(1));assert(bits%8===0,"getNativeTypeSize invalid bits "+bits+", type "+type);return bits/8}return 0}}}var dynamicLibraries=Module["dynamicLibraries"]||[];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf);Module["HEAP64"]=HEAP64=new BigInt64Array(buf);Module["HEAPU64"]=HEAPU64=new BigUint64Array(buf)}var STACK_SIZE=5242880;var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||20971520;if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":2147483648/65536})}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable=new WebAssembly.Table({"initial":6078,"element":"anyfunc"});var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var __RELOC_FUNCS__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__RELOC_FUNCS__);if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPreMain(cb){__ATMAIN__.unshift(cb)}function addOnExit(cb){}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="pyodide.asm.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg,"GOT.mem":new Proxy(asmLibraryArg,GOTHandler),"GOT.func":new Proxy(asmLibraryArg,GOTHandler)};function receiveInstance(instance,module){var exports=instance.exports;exports=relocateExports(exports,1024);var metadata=getDylinkMetadata(module);if(metadata.neededDynlibs){dynamicLibraries=metadata.neededDynlibs.concat(dynamicLibraries)}mergeLibSymbols(exports,"main");Module["asm"]=exports;addOnInit(Module["asm"]["__wasm_call_ctors"]);__RELOC_FUNCS__.push(Module["asm"]["__wasm_apply_data_relocs"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"],result["module"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);readyPromiseReject(e)}}instantiateAsync().catch(readyPromiseReject);return{}}var tempDouble;var tempI64;var ASM_CONSTS={3092302:()=>{throw new Error("intentionally triggered fatal error!")},3092359:$0=>{Hiwire.get_value($0)()},3092382:$0=>{API._pyodide=Hiwire.pop_value($0)},3092423:($0,$1)=>{Hiwire.get_value($1).push(...Hiwire.get_value($0))},3092479:$0=>{for(let v of Hiwire.get_value($0)){if(typeof v.destroy==="function"){try{v.destroy()}catch(e){console.warn("Weird error:",e)}}}},3092628:$0=>{if(!$0){AL.alcErr=40964;return 1}},3092676:$0=>{if(!AL.currentCtx){err("alGetProcAddress() called without a valid context");return 1}if(!$0){AL.currentCtx.err=40963;return 1}}};function console_error(msg){let jsmsg=UTF8ToString(msg);console.error(jsmsg)}function console_error_obj(obj){console.error(Hiwire.get_value(obj))}function new_error(type,msg,err){"use strict";try{return Hiwire.new_value(new API.PythonError(UTF8ToString(type),UTF8ToString(msg),err))}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function fail_test(){API.fail_test=true}function hiwire_to_bool(val){return!!Hiwire.get_value(val)}function hiwire_init(){"use strict";try{let _hiwire={objects:new Map,obj_to_key:new Map,counter:new Uint32Array([1])};Hiwire.UNDEFINED=HEAPU8[_Js_undefined+0];_hiwire.objects.set(Hiwire.UNDEFINED,[undefined,-1]);_hiwire.obj_to_key.set(undefined,Hiwire.UNDEFINED);Hiwire.JSNULL=HEAPU8[_Js_null+0];_hiwire.objects.set(Hiwire.JSNULL,[null,-1]);_hiwire.obj_to_key.set(null,Hiwire.JSNULL);Hiwire.TRUE=HEAPU8[_Js_true+0];_hiwire.objects.set(Hiwire.TRUE,[!!1,-1]);_hiwire.obj_to_key.set(!!1,Hiwire.TRUE);Hiwire.FALSE=HEAPU8[_Js_false+0];_hiwire.objects.set(Hiwire.FALSE,[!!0,-1]);_hiwire.obj_to_key.set(!!0,Hiwire.FALSE);let hiwire_next_permanent=HEAPU8[_Js_novalue]+2;Hiwire.new_value=function(jsval){let idval=_hiwire.obj_to_key.get(jsval);if(idval!==undefined){_hiwire.objects.get(idval)[1]++;return idval}while(_hiwire.objects.has(_hiwire.counter[0])){_hiwire.counter[0]+=2}idval=_hiwire.counter[0];_hiwire.objects.set(idval,[jsval,1]);_hiwire.obj_to_key.set(jsval,idval);_hiwire.counter[0]+=2;return idval};Hiwire.intern_object=function(obj){let id=hiwire_next_permanent;hiwire_next_permanent+=2;_hiwire.objects.set(id,[obj,-1]);return id};Hiwire.num_keys=function(){return Array.from(_hiwire.objects.keys()).filter(x=>x%2).length};Hiwire.get_value=function(idval){if(!idval){API.fail_test=!!1;if(_PyErr_Occurred()){let exc=_wrap_exception();let e=Hiwire.pop_value(exc);console.error(`Pyodide internal error: Argument '${idval}' to hiwire.get_value is falsy. `+"This was probably because the Python error indicator was set when get_value was called. "+"The Python error that caused this was:",e);throw e}else{console.error(`Pyodide internal error: Argument '${idval}' to hiwire.get_value is falsy`+" (but error indicator is not set).");throw new Error(`Pyodide internal error: Argument '${idval}' to hiwire.get_value is falsy`+" (but error indicator is not set).")}}if(!_hiwire.objects.has(idval)){API.fail_test=!!1;console.error(`Pyodide internal error: Undefined id ${idval}`);throw new Error(`Undefined id ${idval}`)}return _hiwire.objects.get(idval)[0]};Hiwire.decref=function(idval){if((idval&1)===0){return}let pair=_hiwire.objects.get(idval);let new_refcnt=--pair[1];if(new_refcnt===0){_hiwire.objects.delete(idval);_hiwire.obj_to_key.delete(pair[0])}};Hiwire.incref=function(idval){if((idval&1)===0){return}_hiwire.objects.get(idval)[1]++};Hiwire.pop_value=function(idval){let result=Hiwire.get_value(idval);Hiwire.decref(idval);return result};Hiwire.isPromise=function(obj){try{return!!obj&&typeof obj.then==="function"}catch(e){return!!0}};API.typedArrayAsUint8Array=function(arg){if(ArrayBuffer.isView(arg)){return new Uint8Array(arg.buffer,arg.byteOffset,arg.byteLength)}else{return new Uint8Array(arg)}};{let dtypes_str=["b","B","h","H","i","I","f","d"].join(String.fromCharCode(0));let dtypes_ptr=stringToNewUTF8(dtypes_str);let dtypes_map={};for(let[idx,val]of Object.entries(dtypes_str)){dtypes_map[val]=dtypes_ptr+Number(idx)}let buffer_datatype_map=new Map([["Int8Array",[dtypes_map["b"],1,!!1]],["Uint8Array",[dtypes_map["B"],1,!!1]],["Uint8ClampedArray",[dtypes_map["B"],1,!!1]],["Int16Array",[dtypes_map["h"],2,!!1]],["Uint16Array",[dtypes_map["H"],2,!!1]],["Int32Array",[dtypes_map["i"],4,!!1]],["Uint32Array",[dtypes_map["I"],4,!!1]],["Float32Array",[dtypes_map["f"],4,!!1]],["Float64Array",[dtypes_map["d"],8,!!1]],["DataView",[dtypes_map["B"],1,!!0]],["ArrayBuffer",[dtypes_map["B"],1,!!0]]]);Module.get_buffer_datatype=function(jsobj){return buffer_datatype_map.get(jsobj.constructor.name)||[0,0,!!0]}}Module.iterObject=function*(object){for(let k in object){if(Object.prototype.hasOwnProperty.call(object,k)){yield k}}};if(globalThis.BigInt){Module.BigInt=BigInt}else{Module.BigInt=Number}return 0}catch(e){Module.handle_js_error(e);return-1}return 0}function hiwire_incref(idval){if(idval&1){Hiwire.incref(idval)}return idval}function hiwire_decref(idval){Hiwire.decref(idval)}function hiwire_int(val){"use strict";try{return Hiwire.new_value(val)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function hiwire_int_from_digits(digits,ndigits){"use strict";try{let result=BigInt(0);for(let i=0;i>2)+i])<>2)+ndigits-1]&2147483648)<2147483647){return-4}return result}catch(e){Module.handle_js_error(e);return-1}return 0}function hiwire_get_length_string(idobj){"use strict";try{const val=Hiwire.get_value(idobj);let result;if(typeof val.size==="number"){result=val.size}else if(typeof val.length==="number"){result=val.length}return stringToNewUTF8(" "+result.toString())}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function hiwire_get_bool(idobj){"use strict";try{let val=Hiwire.get_value(idobj);if(!val){return!!0}if(val.size===0){if(/HTML[A-Za-z]*Element/.test(getTypeTag(val))){return!!1}return!!0}if(val.length===0&&JsArray_Check(idobj)){return!!0}if(val.byteLength===0){return!!0}return!!1}catch(e){return!!0}}function hiwire_is_function(idobj){"use strict";try{return typeof Hiwire.get_value(idobj)==="function"}catch(e){return!!0}}function hiwire_is_generator(idobj){"use strict";try{return getTypeTag(Hiwire.get_value(idobj))==="[object Generator]"}catch(e){return!!0}}function hiwire_is_async_generator(idobj){"use strict";try{return Object.prototype.toString.call(Hiwire.get_value(idobj))==="[object AsyncGenerator]"}catch(e){return!!0}}function hiwire_is_comlink_proxy(idobj){"use strict";try{let value=Hiwire.get_value(idobj);return!!(API.Comlink&&value[API.Comlink.createEndpoint])}catch(e){return!!0}}function hiwire_is_error(idobj){"use strict";try{let value=Hiwire.get_value(idobj);return!!(value&&typeof value.stack==="string"&&typeof value.message==="string")}catch(e){return!!0}}function hiwire_is_promise(idobj){"use strict";try{let obj=Hiwire.get_value(idobj);return Hiwire.isPromise(obj)}catch(e){return!!0}}function hiwire_resolve_promise(idobj){"use strict";try{let obj=Hiwire.get_value(idobj);let result=Promise.resolve(obj);return Hiwire.new_value(result)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function hiwire_to_string(idobj){"use strict";try{return Hiwire.new_value(Hiwire.get_value(idobj).toString())}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function hiwire_typeof(idobj){return Hiwire.new_value(typeof Hiwire.get_value(idobj))}function hiwire_constructor_name(idobj){"use strict";try{return stringToNewUTF8(Hiwire.get_value(idobj).constructor.name)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function hiwire_less_than(ida,idb){"use strict";try{return!!(Hiwire.get_value(ida)Hiwire.get_value(idb))}catch(e){return!!0}}function hiwire_greater_than_equal(ida,idb){"use strict";try{return!!(Hiwire.get_value(ida)>=Hiwire.get_value(idb))}catch(e){return!!0}}function hiwire_reversed_iterator(idarray){"use strict";try{if(!Module._reversedIterator){Module._reversedIterator=class ReversedIterator{constructor(array){this._array=array;this._i=array.length-1}__length_hint__(){return this._array.length}[Symbol.toStringTag](){return"ReverseIterator"}next(){const i=this._i;const a=this._array;const done=i<0;const value=done?undefined:a[i];this._i--;return{done:done,value:value}}}}let array=Hiwire.get_value(idarray);return Hiwire.new_value(new Module._reversedIterator(array))}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function hiwire_assign_to_ptr(idobj,ptr){"use strict";try{let jsobj=Hiwire.get_value(idobj);Module.HEAPU8.set(API.typedArrayAsUint8Array(jsobj),ptr)}catch(e){Module.handle_js_error(e);return-1}return 0}function hiwire_assign_from_ptr(idobj,ptr){"use strict";try{let jsobj=Hiwire.get_value(idobj);API.typedArrayAsUint8Array(jsobj).set(Module.HEAPU8.subarray(ptr,ptr+jsobj.byteLength))}catch(e){Module.handle_js_error(e);return-1}return 0}function hiwire_read_from_file(idobj,fd){"use strict";try{let jsobj=Hiwire.get_value(idobj);let uint8_buffer=API.typedArrayAsUint8Array(jsobj);let stream=Module.FS.streams[fd];Module.FS.read(stream,uint8_buffer,0,uint8_buffer.byteLength)}catch(e){Module.handle_js_error(e);return-1}return 0}function hiwire_write_to_file(idobj,fd){"use strict";try{let jsobj=Hiwire.get_value(idobj);let uint8_buffer=API.typedArrayAsUint8Array(jsobj);let stream=Module.FS.streams[fd];Module.FS.write(stream,uint8_buffer,0,uint8_buffer.byteLength)}catch(e){Module.handle_js_error(e);return-1}return 0}function hiwire_into_file(idobj,fd){"use strict";try{let jsobj=Hiwire.get_value(idobj);let uint8_buffer=API.typedArrayAsUint8Array(jsobj);let stream=Module.FS.streams[fd];Module.FS.write(stream,uint8_buffer,0,uint8_buffer.byteLength,undefined,!!1)}catch(e){Module.handle_js_error(e);return-1}return 0}function hiwire_get_buffer_info(idobj,byteLength_ptr,format_ptr,size_ptr,checked_ptr){let jsobj=Hiwire.get_value(idobj);let byteLength=jsobj.byteLength;let[format_utf8,size,checked]=Module.get_buffer_datatype(jsobj);HEAPU32[(byteLength_ptr>>2)+0]=byteLength;HEAPU32[(format_ptr>>2)+0]=format_utf8;HEAPU32[(size_ptr>>2)+0]=size;HEAPU8[checked_ptr+0]=checked}function hiwire_subarray(idarr,start,end){"use strict";try{let jsarr=Hiwire.get_value(idarr);let jssub=jsarr.subarray(start,end);return Hiwire.new_value(jssub)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsArray_Check(idobj){"use strict";try{let obj=Hiwire.get_value(idobj);if(Array.isArray(obj)){return!!1}let typeTag=getTypeTag(obj);if(typeTag==="[object HTMLCollection]"||typeTag==="[object NodeList]"){return!!1}if(ArrayBuffer.isView(obj)&&obj.constructor.name!=="DataView"){return!!1}return!!0}catch(e){return!!0}}function JsArray_New(){"use strict";try{return Hiwire.new_value([])}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsArray_Push(idarr,idval){"use strict";try{Hiwire.get_value(idarr).push(Hiwire.get_value(idval))}catch(e){Module.handle_js_error(e);return-1}return 0}function JsArray_Push_unchecked(idarr,idval){const arr=Hiwire.get_value(idarr);arr.push(Hiwire.get_value(idval));return arr.length-1}function JsArray_Get(idobj,idx){"use strict";try{let obj=Hiwire.get_value(idobj);let result=obj[idx];if(result===undefined&&!(idx in obj)){return 0}return Hiwire.new_value(result)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsArray_Set(idobj,idx,idval){"use strict";try{Hiwire.get_value(idobj)[idx]=Hiwire.get_value(idval)}catch(e){Module.handle_js_error(e);return-1}return 0}function JsArray_Delete(idobj,idx){"use strict";try{let obj=Hiwire.get_value(idobj);if(idx<0||idx>=obj.length){return-1}obj.splice(idx,1)}catch(e){Module.handle_js_error(e);return-1}return 0}function JsArray_Splice(idobj,idx){"use strict";try{let obj=Hiwire.get_value(idobj);if(idx<0||idx>=obj.length){return 0}return Hiwire.new_value(obj.splice(idx,1))}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsArray_slice(idobj,length,start,stop,step){"use strict";try{let obj=Hiwire.get_value(idobj);let result;if(step===1){result=obj.slice(start,stop)}else{result=Array.from({length:length},(_,i)=>obj[start+i*step])}return Hiwire.new_value(result)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsArray_slice_assign(idobj,slicelength,start,stop,step,values_length,values){"use strict";try{let obj=Hiwire.get_value(idobj);let jsvalues=[];for(let i=0;i>2)+i]);if(ref===0){return-1}jsvalues.push(Hiwire.pop_value(ref))}if(step===1){obj.splice(start,slicelength,...jsvalues)}else{if(values!==0){for(let i=0;i=0;i--){obj.splice(start+i*step,1)}}}}catch(e){Module.handle_js_error(e);return-1}return 0}function JsArray_Clear(idobj){"use strict";try{let obj=Hiwire.get_value(idobj);obj.splice(0,obj.length)}catch(e){Module.handle_js_error(e);return-1}return 0}function JsObject_New(){"use strict";try{return Hiwire.new_value({})}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsObject_GetString(idobj,ptrkey){"use strict";try{let jsobj=Hiwire.get_value(idobj);let jskey=UTF8ToString(ptrkey);let result=jsobj[jskey];if(result===undefined&&!(jskey in jsobj)){return 0}return Hiwire.new_value(result)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsObject_SetString(idobj,ptrkey,idval){"use strict";try{let jsobj=Hiwire.get_value(idobj);let jskey=UTF8ToString(ptrkey);let jsval=Hiwire.get_value(idval);jsobj[jskey]=jsval}catch(e){Module.handle_js_error(e);return-1}return 0}function JsObject_DeleteString(idobj,ptrkey){"use strict";try{let jsobj=Hiwire.get_value(idobj);let jskey=UTF8ToString(ptrkey);delete jsobj[jskey]}catch(e){Module.handle_js_error(e);return-1}return 0}function JsObject_Dir(idobj){"use strict";try{let jsobj=Hiwire.get_value(idobj);let result=[];do{result.push(...Object.getOwnPropertyNames(jsobj).filter(s=>{let c=s.charCodeAt(0);return c<48||c>57}))}while(jsobj=Object.getPrototypeOf(jsobj));return Hiwire.new_value(result)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsObject_Entries(idobj){"use strict";try{let jsobj=Hiwire.get_value(idobj);return Hiwire.new_value(Object.entries(jsobj))}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsObject_Keys(idobj){"use strict";try{let jsobj=Hiwire.get_value(idobj);return Hiwire.new_value(Object.keys(jsobj))}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsObject_Values(idobj){"use strict";try{let jsobj=Hiwire.get_value(idobj);return Hiwire.new_value(Object.values(jsobj))}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsString_InternFromCString(str){"use strict";try{let jsstring=UTF8ToString(str);return Hiwire.intern_object(jsstring)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsMap_New(){"use strict";try{return Hiwire.new_value(new Map)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsMap_Set(mapid,keyid,valueid){"use strict";try{let map=Hiwire.get_value(mapid);let key=Hiwire.get_value(keyid);let value=Hiwire.get_value(valueid);map.set(key,value)}catch(e){Module.handle_js_error(e);return-1}return 0}function JsSet_New(){"use strict";try{return Hiwire.new_value(new Set)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsSet_Add(mapid,keyid){"use strict";try{let set=Hiwire.get_value(mapid);let key=Hiwire.get_value(keyid);set.add(key)}catch(e){Module.handle_js_error(e);return-1}return 0}function js2python(id){"use strict";try{let value=Hiwire.get_value(id);let result=Module.js2python_convertImmutable(value,id);if(result!==undefined){return result}return _JsProxy_create(id)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function js2python_convert(id,depth,default_converter){"use strict";try{let defaultConverter=default_converter?Module.hiwire.get_value(default_converter):undefined;return Module.js2python_convert(id,{depth:depth,defaultConverter:defaultConverter})}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function js2python_init(){"use strict";try{{0;let PropagateError=Module._PropagatePythonError;function js2python_string(value){let max_code_point=0;let num_code_points=0;for(let c of value){num_code_points++;let code_point=c.codePointAt(0);max_code_point=code_point>max_code_point?code_point:max_code_point}let result=_PyUnicode_New(num_code_points,max_code_point);if(result===0){throw new PropagateError}let ptr=_PyUnicode_Data(result);if(max_code_point>65535){for(let c of value){HEAPU32[ptr/4]=c.codePointAt(0);ptr+=4}}else if(max_code_point>255){for(let c of value){HEAPU16[ptr/2]=c.codePointAt(0);ptr+=2}}else{for(let c of value){HEAPU8[ptr]=c.codePointAt(0);ptr+=1}}return result}function js2python_bigint(value){let value_orig=value;let length=0;if(value<0){value=-value}value<<=BigInt(1);while(value){length++;value>>=BigInt(32)}let stackTop=stackSave();let ptr=stackAlloc(length*4);value=value_orig;for(let i=0;i>2)+i]=Number(value&BigInt(4294967295));value>>=BigInt(32)}let result=__PyLong_FromByteArray(ptr,length*4,!!1,!!1);stackRestore(stackTop);return result}function js2python_convertImmutable(value,id){let result=js2python_convertImmutableInner(value,id);if(result===0){throw new PropagateError}return result}Module.js2python_convertImmutable=js2python_convertImmutable;function js2python_convertImmutableInner(value,id){let type=typeof value;if(type==="string"){return js2python_string(value)}else if(type==="number"){if(Number.isSafeInteger(value)){return _PyLong_FromDouble(value)}else{return _PyFloat_FromDouble(value)}}else if(type==="bigint"){return js2python_bigint(value)}else if(value===undefined||value===null){return __js2python_none()}else if(value===!!1){return __js2python_true()}else if(value===!!0){return __js2python_false()}else if(API.isPyProxy(value)){if(value.$$.ptr==0){Module.PyProxy_getPtr(value)}if(value.$$props.roundtrip){if(id===undefined){id=Hiwire.new_value(value)}return _JsProxy_create(id)}else{return __js2python_pyproxy(Module.PyProxy_getPtr(value))}}return undefined}function js2python_convertList(obj,context){let list=_PyList_New(obj.length);if(list===0){return 0}let entryid=0;let item=0;try{context.cache.set(obj,list);for(let i=0;i>2)+0]=stringToNewUTF8(errmsg);return-1}let result_id=Hiwire.new_value(res.value);HEAPU32[(result_ptr>>2)+0]=result_id;return res.done}catch(e){Module.handle_js_error(e);return-1}return 0}function JsProxy_GetAsyncIter_js(idobj){"use strict";try{let jsobj=Hiwire.get_value(idobj);return Hiwire.new_value(jsobj[Symbol.asyncIterator]())}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function _agen_handle_result_js(promiseid,msg,set_result,set_exception,closing){"use strict";try{let p=Hiwire.get_value(promiseid);let errmsg;if(typeof p!=="object"){errmsg=`Result of anext() should be object not ${typeof p}`}else if(typeof p.then!=="function"){if(typeof p.done==="boolean"){errmsg=`Result of anext() was not a promise, use next() instead.`}else{errmsg=`Result of anext() was not a promise.`}}if(errmsg){HEAPU32[(msg>>2)+0]=stringToNewUTF8(errmsg);return-1}_Py_IncRef(set_result);_Py_IncRef(set_exception);p.then(({done:done,value:value})=>{let id=Hiwire.new_value(value);__agen_handle_result_js_c(set_result,set_exception,done,id,closing);Hiwire.decref(id)},err=>{let id=Hiwire.new_value(err);__agen_handle_result_js_c(set_result,set_exception,-1,id,closing);Hiwire.decref(id)}).finally(()=>{_Py_DecRef(set_result);_Py_DecRef(set_exception)});return 0}catch(e){Module.handle_js_error(e);return-1}return 0}function JsArray_index_helper(list,value,start,stop){"use strict";try{let o=Hiwire.get_value(list);let v=Hiwire.get_value(value);for(let i=start;iModule.pyproxy_destroy(px,msg))}function wrap(funcname){return function(val){if(API.isPyProxy(val)){val=val.copy();proxies.add(val)}let res;try{res=gen[funcname](val)}catch(e){cleanup();throw e}if(res.done){proxies.delete(res.value);cleanup()}return res}}return Hiwire.new_value({get[Symbol.toStringTag](){return"Generator"},[Symbol.iterator](){return this},next:wrap("next"),throw:wrap("throw"),return:wrap("return")})}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function wrap_async_generator(genid,proxiesid){"use strict";try{const proxies=new Set(Hiwire.get_value(proxiesid));const gen=Hiwire.get_value(genid);const msg="This borrowed proxy was automatically destroyed "+"when an asynchronous generator completed execution. Try "+"using create_proxy or create_once_callable.";function cleanup(){proxies.forEach(px=>Module.pyproxy_destroy(px,msg))}function wrap(funcname){return async function(val){if(API.isPyProxy(val)){val=val.copy();proxies.add(val)}let res;try{res=await gen[funcname](val)}catch(e){cleanup();throw e}if(res.done){proxies.delete(res.value);cleanup()}return res}}return Hiwire.new_value({get[Symbol.toStringTag](){return"AsyncGenerator"},[Symbol.asyncIterator](){return this},next:wrap("next"),throw:wrap("throw"),return:wrap("return")})}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsBuffer_DecodeString_js(jsbuffer_id,encoding){"use strict";try{let buffer=Hiwire.get_value(jsbuffer_id);let encoding_js;if(encoding){encoding_js=UTF8ToString(encoding)}let decoder=new TextDecoder(encoding_js,{fatal:!!1,ignoreBOM:!!1});let res;try{res=decoder.decode(buffer)}catch(e){if(e instanceof TypeError){return 0}throw e}return Hiwire.new_value(res)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function JsDoubleProxy_unwrap_helper(id){"use strict";try{return Module.PyProxy_getPtr(Hiwire.get_value(id))}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function compute_typeflags(idobj){"use strict";try{let obj=Hiwire.get_value(idobj);let type_flags=0;if(API.isPyProxy(obj)&&obj.$$.ptr===0){return 0}const constructorName=obj.constructor?obj.constructor.name:"";let typeTag=getTypeTag(obj);if(typeof obj==="function"){type_flags|=1<<9}if(typeof obj.then==="function"){type_flags|=1<<7}if(typeof obj[Symbol.iterator]==="function"){type_flags|=1<<0}if(typeof obj[Symbol.asyncIterator]==="function"){type_flags|=1<<15}if(typeof obj.next==="function"&&(typeof obj[Symbol.iterator]==="function"||typeof obj[Symbol.asyncIterator]!=="function")){type_flags|=1<<1}if(typeof obj.next==="function"&&(typeof obj[Symbol.iterator]!=="function"||typeof obj[Symbol.asyncIterator]==="function")){type_flags|=1<<18}if(typeof obj.size==="number"||typeof obj.length==="number"&&typeof obj!=="function"){type_flags|=1<<2}if(typeof obj.get==="function"){type_flags|=1<<3}if(typeof obj.set==="function"){type_flags|=1<<4}if(typeof obj.has==="function"){type_flags|=1<<5}if(typeof obj.includes==="function"){type_flags|=1<<6}if(ArrayBuffer.isView(obj)||constructorName==="ArrayBuffer"){type_flags|=1<<8}if(API.isPyProxy(obj)){type_flags|=1<<13}if(Array.isArray(obj)){type_flags|=1<<10}if(typeTag==="[object HTMLCollection]"||typeTag==="[object NodeList]"){type_flags|=1<<11}if(ArrayBuffer.isView(obj)&&obj.constructor.name!=="DataView"){type_flags|=1<<12}if(typeTag==="[object Generator]"){type_flags|=1<<16}if(typeTag==="[object AsyncGenerator]"){type_flags|=1<<17}return type_flags}catch(e){Module.handle_js_error(e);return-1}return 0}function pyproxy_Check(x){if(x==0){return false}let val=Hiwire.get_value(x);return API.isPyProxy(val)}function pyproxy_AsPyObject(x){if(x==0){return 0}let val=Hiwire.get_value(x);if(!API.isPyProxy(val)){return 0}return Module.PyProxy_getPtr(val)}function destroy_proxies(proxies_id,msg_ptr){let msg=undefined;if(msg_ptr){msg=UTF8ToString(msg_ptr)}let proxies=Hiwire.get_value(proxies_id);for(let px of proxies){Module.pyproxy_destroy(px,msg,false)}}function destroy_proxy(proxy_id,msg_ptr){let px=Module.hiwire.get_value(proxy_id);if(px.$$props.roundtrip){return}let msg=undefined;if(msg_ptr){msg=UTF8ToString(msg_ptr)}Module.pyproxy_destroy(px,msg,false)}function proxy_cache_get(proxyCacheId,descr){let proxyCache=Hiwire.get_value(proxyCacheId);let proxyId=proxyCache.get(descr);if(!proxyId){return undefined}if(Hiwire.get_value(proxyId).$$.ptr){return proxyId}else{proxyCache.delete(descr);Hiwire.decref(proxyId);return undefined}}function proxy_cache_set(proxyCacheId,descr,proxy){let proxyCache=Hiwire.get_value(proxyCacheId);proxyCache.set(descr,proxy)}function array_to_js(array,len){return Hiwire.new_value(Array.from(HEAP32.subarray(array/4,array/4+len)))}function pyproxy_new_ex(ptrobj,capture_this,roundtrip){"use strict";try{return Hiwire.new_value(Module.pyproxy_new(ptrobj,{props:{captureThis:!!capture_this,roundtrip:!!roundtrip}}))}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function pyproxy_new(ptrobj){"use strict";try{return Hiwire.new_value(Module.pyproxy_new(ptrobj))}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function create_once_callable(obj){"use strict";try{_Py_IncRef(obj);let alreadyCalled=!!0;function wrapper(...args){if(alreadyCalled){throw new Error("OnceProxy can only be called once")}try{return Module.callPyObject(obj,args)}finally{wrapper.destroy()}}wrapper.destroy=function(){if(alreadyCalled){throw new Error("OnceProxy has already been destroyed")}alreadyCalled=!!1;Module.finalizationRegistry.unregister(wrapper);_Py_DecRef(obj)};Module.finalizationRegistry.register(wrapper,[obj,undefined],wrapper);return Hiwire.new_value(wrapper)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function create_promise_handles(handle_result,handle_exception,done_callback_id){"use strict";try{if(handle_result){_Py_IncRef(handle_result)}if(handle_exception){_Py_IncRef(handle_exception)}let done_callback=x=>{};if(done_callback_id){done_callback=Hiwire.get_value(done_callback_id)}let used=!!0;function checkUsed(){if(used){throw new Error("One of the promise handles has already been called.")}}function destroy(){checkUsed();used=!!1;if(handle_result){_Py_DecRef(handle_result)}if(handle_exception){_Py_DecRef(handle_exception)}}function onFulfilled(res){checkUsed();try{if(handle_result){return Module.callPyObject(handle_result,[res])}}finally{done_callback(res);destroy()}}function onRejected(err){checkUsed();try{if(handle_exception){return Module.callPyObject(handle_exception,[err])}}finally{done_callback(undefined);destroy()}}onFulfilled.destroy=destroy;onRejected.destroy=destroy;return Hiwire.new_value([onFulfilled,onRejected])}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function _python2js_buffer_inner(buf,itemsize,ndim,format,shape,strides,suboffsets){"use strict";try{let converter=Module.get_converter(format,itemsize);let result=Module._python2js_buffer_recursive(buf,0,{ndim:ndim,format:format,itemsize:itemsize,shape:shape,strides:strides,suboffsets:suboffsets,converter:converter});return Hiwire.new_value(result)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function python2js_buffer_init(){"use strict";try{{0;Module.processBufferFormatString=function(formatStr,errorMessage=""){if(formatStr.length>2){throw new Error("Expected format string to have length <= 2, "+`got '${formatStr}'.`+errorMessage)}let formatChar=formatStr.slice(-1);let alignChar=formatStr.slice(0,-1);let bigEndian;switch(alignChar){case"!":case">":bigEndian=!!1;break;case"<":case"@":case"=":case"":bigEndian=!!0;break;default:throw new Error(`Unrecognized alignment character ${alignChar}.`+errorMessage)}let arrayType;switch(formatChar){case"b":arrayType=Int8Array;break;case"s":case"p":case"c":case"B":case"?":arrayType=Uint8Array;break;case"h":arrayType=Int16Array;break;case"H":arrayType=Uint16Array;break;case"i":case"l":case"n":arrayType=Int32Array;break;case"I":case"L":case"N":case"P":arrayType=Uint32Array;break;case"q":if(globalThis.BigInt64Array===undefined){throw new Error("BigInt64Array is not supported on this browser."+errorMessage)}arrayType=BigInt64Array;break;case"Q":if(globalThis.BigUint64Array===undefined){throw new Error("BigUint64Array is not supported on this browser."+errorMessage)}arrayType=BigUint64Array;break;case"f":arrayType=Float32Array;break;case"d":arrayType=Float64Array;break;case"e":throw new Error("Javascript has no Float16 support.");default:throw new Error(`Unrecognized format character '${formatChar}'.`+errorMessage)}return[arrayType,bigEndian]};Module.python2js_buffer_1d_contiguous=function(ptr,stride,n){"use strict";let byteLength=stride*n;return HEAP8.slice(ptr,ptr+byteLength).buffer};Module.python2js_buffer_1d_noncontiguous=function(ptr,stride,suboffset,n,itemsize){"use strict";let byteLength=itemsize*n;let buffer=new Uint8Array(byteLength);for(let i=0;i=0){curptr=HEAPU32[(curptr>>2)+0]+suboffset}buffer.set(HEAP8.subarray(curptr,curptr+itemsize),i*itemsize)}return buffer.buffer};Module._python2js_buffer_recursive=function(ptr,curdim,bufferData){"use strict";let n=HEAPU32[(bufferData.shape>>2)+curdim];let stride=HEAP32[(bufferData.strides>>2)+curdim];let suboffset=-1;if(bufferData.suboffsets!==0){suboffset=HEAP32[(bufferData.suboffsets>>2)+curdim]}if(curdim===bufferData.ndim-1){let arraybuffer;if(stride===bufferData.itemsize&&suboffset<0){arraybuffer=Module.python2js_buffer_1d_contiguous(ptr,stride,n)}else{arraybuffer=Module.python2js_buffer_1d_noncontiguous(ptr,stride,suboffset,n,bufferData.itemsize)}return bufferData.converter(arraybuffer)}let result=[];for(let i=0;i=0){curptr=HEAPU32[(curptr>>2)+0]+suboffset}result.push(Module._python2js_buffer_recursive(curPtr,curdim+1,bufferData))}return result};Module.get_converter=function(format,itemsize){"use strict";let formatStr=UTF8ToString(format);let[ArrayType,bigEndian]=Module.processBufferFormatString(formatStr);let formatChar=formatStr.slice(-1);switch(formatChar){case"s":let decoder=new TextDecoder("utf8",{ignoreBOM:!!1});return buff=>decoder.decode(buff);case"?":return buff=>Array.from(new Uint8Array(buff),x=>!!x)}if(!bigEndian){return buff=>new ArrayType(buff)}let getFuncName;let setFuncName;switch(itemsize){case 2:getFuncName="getUint16";setFuncName="setUint16";break;case 4:getFuncName="getUint32";setFuncName="setUint32";break;case 8:getFuncName="getFloat64";setFuncName="setFloat64";break;default:throw new Error(`Unexpected size ${itemsize}`)}function swapFunc(buff){let dataview=new DataView(buff);let getFunc=dataview[getFuncName].bind(dataview);let setFunc=dataview[setFuncName].bind(dataview);for(let byte=0;bytenew ArrayType(swapFunc(buff))}}return 0}catch(e){Module.handle_js_error(e);return-1}return 0}function _python2js_addto_postprocess_list(idlist,idparent,idkey,value){const list=Hiwire.get_value(idlist);const parent=Hiwire.get_value(idparent);const key=Hiwire.get_value(idkey);list.push([parent,key,value])}function _python2js_handle_postprocess_list(idlist,idcache){const list=Hiwire.get_value(idlist);const cache=Hiwire.get_value(idcache);for(const[parent,key,value]of list){let out_value=Hiwire.get_value(cache.get(value));if(parent.constructor.name==="Map"){parent.set(key,out_value)}else{parent[key]=out_value}}}function _python2js_ucs1(ptr,len){"use strict";try{let jsstr="";for(let i=0;i>1)+i])}return Hiwire.new_value(jsstr)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function _python2js_ucs4(ptr,len){"use strict";try{let jsstr="";for(let i=0;i>2)+i])}return Hiwire.new_value(jsstr)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function _python2js_add_to_cache(cacheid,pyparent,jsparent){"use strict";try{const cache=Hiwire.get_value(cacheid);const old_value=cache.get(pyparent);if(old_value!==undefined){Hiwire.decref(old_value)}Hiwire.incref(jsparent);cache.set(pyparent,jsparent)}catch(e){Module.handle_js_error(e);return-1}return 0}function _python2js_destroy_cache(cacheid){const cache=Hiwire.get_value(cacheid);for(const[k,v]of cache.entries()){Hiwire.decref(v)}}function _python2js_cache_lookup(cacheid,pyparent){return Hiwire.get_value(cacheid).get(pyparent)}function _JsArray_PushEntry_helper(array,key,value){"use strict";try{Hiwire.get_value(array).push([Hiwire.get_value(key),Hiwire.get_value(value)])}catch(e){Module.handle_js_error(e);return-1}return 0}function _JsArray_PostProcess_helper(jscontext,array){"use strict";try{return Hiwire.new_value(Hiwire.get_value(jscontext).dict_converter(Hiwire.get_value(array)))}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function python2js__default_converter(jscontext,object){"use strict";try{let context=Hiwire.get_value(jscontext);let proxy=Module.pyproxy_new(object);let result=context.default_converter(proxy,context.converter,context.cacheConversion);proxy.destroy();return Hiwire.new_value(result)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function python2js_custom__create_jscontext(context,idcache,dict_converter,default_converter){"use strict";try{let jscontext={};if(dict_converter!==0){jscontext.dict_converter=Hiwire.get_value(dict_converter)}if(default_converter!==0){jscontext.default_converter=Hiwire.get_value(default_converter);jscontext.cacheConversion=function(input,output){if(!API.isPyProxy(input)){throw new TypeError("The first argument to cacheConversion must be a PyProxy.")}let input_ptr=Module.PyProxy_getPtr(input);let output_key=Hiwire.new_value(output);Hiwire.get_value(idcache).set(input_ptr,output_key)};jscontext.converter=function(x){if(!API.isPyProxy(x)){return x}let ptr=Module.PyProxy_getPtr(x);let res=__python2js(context,ptr);return Hiwire.pop_value(res)}}return Hiwire.new_value(jscontext)}catch(e){Module.handle_js_error(e);return 0}throw new Error("Assertion error: control reached end of function without return")}function destroy_proxies_js(proxies_id){"use strict";try{for(let proxy of Hiwire.get_value(proxies_id)){proxy.destroy()}}catch(e){Module.handle_js_error(e);return-1}return 0}function getter_call_trampoline(get,obj,closure){return wasmTable.get(get)(obj,closure)}function setter_call_trampoline(set,obj,value,closure){return wasmTable.get(set)(obj,value,closure)}function method_call_trampoline(func,self,arg1,arg2){return wasmTable.get(func)(self,arg1,arg2)}function em_call_init_function(f){return Module.wasmTable.get(f)()}function _Py_CheckEmscriptenSignals_Helper(){if(!Module.Py_EmscriptenSignalBuffer){return 0}try{let result=Module.Py_EmscriptenSignalBuffer[0];Module.Py_EmscriptenSignalBuffer[0]=0;return result}catch(e){return 0}}function unbox_small_structs(type_ptr){var type_id=HEAPU16[(type_ptr+6>>1)+0];while(type_id===13){var elements=HEAPU32[(type_ptr+8>>2)+0];var first_element=HEAPU32[(elements>>2)+0];if(first_element===0){type_id=0;break}else if(HEAPU32[(elements>>2)+1]===0){type_ptr=first_element;type_id=HEAPU16[(first_element+6>>1)+0]}else{break}}return[type_ptr,type_id]}function ffi_call(cif,fn,rvalue,avalue){var abi=HEAPU32[(cif>>2)+0];var nargs=HEAPU32[(cif>>2)+1];var nfixedargs=HEAPU32[(cif>>2)+6];var arg_types_ptr=HEAPU32[(cif>>2)+2];var rtype_unboxed=unbox_small_structs(HEAPU32[(cif>>2)+3]);var rtype_ptr=rtype_unboxed[0];var rtype_id=rtype_unboxed[1];var orig_stack_ptr=stackSave();var cur_stack_ptr=orig_stack_ptr;var args=[];var ret_by_arg=false;if(rtype_id===15){throw new Error("complex ret marshalling nyi")}if(rtype_id<0||rtype_id>15){throw new Error("Unexpected rtype "+rtype_id)}if(rtype_id===4||rtype_id===13){args.push(rvalue);ret_by_arg=true}for(var i=0;i>2)+i];var arg_unboxed=unbox_small_structs(HEAPU32[(arg_types_ptr>>2)+i]);var arg_type_ptr=arg_unboxed[0];var arg_type_id=arg_unboxed[1];switch(arg_type_id){case 1:case 10:case 9:case 14:args.push(HEAPU32[(arg_ptr>>2)+0]);break;case 2:args.push(HEAPF32[(arg_ptr>>2)+0]);break;case 3:args.push(HEAPF64[(arg_ptr>>3)+0]);break;case 5:args.push(HEAPU8[arg_ptr+0]);break;case 6:args.push(HEAP8[arg_ptr+0]);break;case 7:args.push(HEAPU16[(arg_ptr>>1)+0]);break;case 8:args.push(HEAP16[(arg_ptr>>1)+0]);break;case 11:case 12:args.push(BigInt(HEAPU32[(arg_ptr>>2)+0*2])|BigInt(HEAPU32[(arg_ptr>>2)+0*2+1])<>2)+0*2])|BigInt(HEAPU32[(arg_ptr>>2)+0*2+1])<>2)+1*2])|BigInt(HEAPU32[(arg_ptr>>2)+1*2+1])<>2)+0];var align=HEAPU16[(arg_type_ptr+4>>1)+0];cur_stack_ptr-=size,cur_stack_ptr&=~(align-1);HEAP8.subarray(cur_stack_ptr,cur_stack_ptr+size).set(HEAP8.subarray(arg_ptr,arg_ptr+size));args.push(cur_stack_ptr);break;case 15:throw new Error("complex marshalling nyi");default:throw new Error("Unexpected type "+arg_type_id)}}if(nfixedargs!=nargs){var struct_arg_info=[];for(var i=nargs-1;i>=nfixedargs;i--){var arg_ptr=HEAPU32[(avalue>>2)+i];var arg_unboxed=unbox_small_structs(HEAPU32[(arg_types_ptr>>2)+i]);var arg_type_ptr=arg_unboxed[0];var arg_type_id=arg_unboxed[1];switch(arg_type_id){case 5:case 6:cur_stack_ptr-=1,cur_stack_ptr&=~(1-1);HEAPU8[cur_stack_ptr+0]=HEAPU8[arg_ptr+0];break;case 7:case 8:cur_stack_ptr-=2,cur_stack_ptr&=~(2-1);HEAPU16[(cur_stack_ptr>>1)+0]=HEAPU16[(arg_ptr>>1)+0];break;case 1:case 9:case 10:case 14:case 2:cur_stack_ptr-=4,cur_stack_ptr&=~(4-1);HEAPU32[(cur_stack_ptr>>2)+0]=HEAPU32[(arg_ptr>>2)+0];break;case 3:case 11:case 12:cur_stack_ptr-=8,cur_stack_ptr&=~(8-1);HEAPU32[(cur_stack_ptr>>2)+0]=HEAPU32[(arg_ptr>>2)+0];HEAPU32[(cur_stack_ptr>>2)+1]=HEAPU32[(arg_ptr>>2)+1];break;case 4:cur_stack_ptr-=16,cur_stack_ptr&=~(8-1);HEAPU32[(cur_stack_ptr>>2)+0]=HEAPU32[(arg_ptr>>2)+0];HEAPU32[(cur_stack_ptr>>2)+1]=HEAPU32[(arg_ptr>>2)+1];HEAPU32[(cur_stack_ptr>>2)+2]=HEAPU32[(arg_ptr>>2)+1];HEAPU32[(cur_stack_ptr>>2)+3]=HEAPU32[(arg_ptr>>2)+1];break;case 13:cur_stack_ptr-=4,cur_stack_ptr&=~(4-1);struct_arg_info.push([cur_stack_ptr,arg_ptr,HEAPU32[(arg_type_ptr>>2)+0],HEAPU16[(arg_type_ptr+4>>1)+0]]);break;case 15:throw new Error("complex arg marshalling nyi");default:throw new Error("Unexpected argtype "+arg_type_id)}}args.push(cur_stack_ptr);for(var i=0;i>2)+0]=cur_stack_ptr}}cur_stack_ptr-=0,cur_stack_ptr&=~(8-1);stackRestore(cur_stack_ptr);var result=wasmTable.get(fn).apply(null,args);stackRestore(orig_stack_ptr);if(ret_by_arg){return}switch(rtype_id){case 0:break;case 1:case 9:case 10:case 14:HEAPU32[(rvalue>>2)+0]=result;break;case 2:HEAPF32[(rvalue>>2)+0]=result;break;case 3:HEAPF64[(rvalue>>3)+0]=result;break;case 5:case 6:HEAPU8[rvalue+0]=result;break;case 7:case 8:HEAPU16[(rvalue>>1)+0]=result;break;case 11:case 12:HEAPU32[(rvalue>>2)+0*2]=Number(result&BigInt(4294967295))|0,HEAPU32[(rvalue>>2)+0*2+1]=Number(result>>BigInt(32))|0;break;case 15:throw new Error("complex ret marshalling nyi");default:throw new Error("Unexpected rtype "+rtype_id)}}function ffi_closure_alloc_helper(size,code){var closure=_malloc(size);var index=getEmptyTableSlot();HEAPU32[(code>>2)+0]=index;HEAPU32[(closure>>2)+0]=index;return closure}function ffi_closure_free_helper(closure){var index=HEAPU32[(closure>>2)+0];freeTableIndexes.push(index);_free(closure)}function ffi_prep_closure_loc_helper(closure,cif,fun,user_data,codeloc){var abi=HEAPU32[(cif>>2)+0];var nargs=HEAPU32[(cif>>2)+1];var nfixedargs=HEAPU32[(cif>>2)+6];var arg_types_ptr=HEAPU32[(cif>>2)+2];var rtype_unboxed=unbox_small_structs(HEAPU32[(cif>>2)+3]);var rtype_ptr=rtype_unboxed[0];var rtype_id=rtype_unboxed[1];var sig;var ret_by_arg=false;switch(rtype_id){case 0:sig="v";break;case 13:case 4:sig="vi";ret_by_arg=true;break;case 1:case 5:case 6:case 7:case 8:case 9:case 10:case 14:sig="i";break;case 2:sig="f";break;case 3:sig="d";break;case 11:case 12:sig="j";break;case 15:throw new Error("complex ret marshalling nyi");default:throw new Error("Unexpected rtype "+rtype_id)}var unboxed_arg_type_id_list=[];var unboxed_arg_type_info_list=[];for(var i=0;i>2)+i]);var arg_type_ptr=arg_unboxed[0];var arg_type_id=arg_unboxed[1];unboxed_arg_type_id_list.push(arg_type_id);unboxed_arg_type_info_list.push([HEAPU32[(arg_type_ptr>>2)+0],HEAPU16[(arg_type_ptr+4>>1)+0]])}for(var i=0;i>2)+carg_idx]=cur_ptr;HEAPU8[cur_ptr+0]=cur_arg;break;case 7:case 8:cur_ptr-=2,cur_ptr&=~(4-1);HEAPU32[(args_ptr>>2)+carg_idx]=cur_ptr;HEAPU16[(cur_ptr>>1)+0]=cur_arg;break;case 1:case 9:case 10:case 14:cur_ptr-=4,cur_ptr&=~(4-1);HEAPU32[(args_ptr>>2)+carg_idx]=cur_ptr;HEAPU32[(cur_ptr>>2)+0]=cur_arg;break;case 13:cur_ptr-=arg_size,cur_ptr&=~(arg_align-1);HEAP8.subarray(cur_ptr,cur_ptr+arg_size).set(HEAP8.subarray(cur_arg,cur_arg+arg_size));HEAPU32[(args_ptr>>2)+carg_idx]=cur_ptr;break;case 2:cur_ptr-=4,cur_ptr&=~(4-1);HEAPU32[(args_ptr>>2)+carg_idx]=cur_ptr;HEAPF32[(cur_ptr>>2)+0]=cur_arg;break;case 3:cur_ptr-=8,cur_ptr&=~(8-1);HEAPU32[(args_ptr>>2)+carg_idx]=cur_ptr;HEAPF64[(cur_ptr>>3)+0]=cur_arg;break;case 11:case 12:cur_ptr-=8,cur_ptr&=~(8-1);HEAPU32[(args_ptr>>2)+carg_idx]=cur_ptr;HEAPU32[(cur_ptr>>2)+0*2]=Number(cur_arg&BigInt(4294967295))|0,HEAPU32[(cur_ptr>>2)+0*2+1]=Number(cur_arg>>BigInt(32))|0;break;case 4:cur_ptr-=16,cur_ptr&=~(8-1);HEAPU32[(args_ptr>>2)+carg_idx]=cur_ptr;HEAPU32[(cur_ptr>>2)+0*2]=Number(cur_arg&BigInt(4294967295))|0,HEAPU32[(cur_ptr>>2)+0*2+1]=Number(cur_arg>>BigInt(32))|0;cur_arg=args[jsarg_idx++];HEAPU32[(cur_ptr>>2)+1*2]=Number(cur_arg&BigInt(4294967295))|0,HEAPU32[(cur_ptr>>2)+1*2+1]=Number(cur_arg>>BigInt(32))|0;break}}var varargs=args[args.length-1];for(var carg_idx=nfixedargs;carg_idx>2)+0];cur_ptr-=arg_size,cur_ptr&=~(arg_align-1);HEAP8.subarray(cur_ptr,cur_ptr+arg_size).set(HEAP8.subarray(struct_ptr,struct_ptr+arg_size));HEAPU32[(args_ptr>>2)+carg_idx]=cur_ptr}else{HEAPU32[(args_ptr>>2)+carg_idx]=varargs}varargs+=4}cur_ptr-=0,cur_ptr&=~(8-1);stackRestore(cur_ptr);wasmTable.get(HEAPU32[(closure>>2)+2]).apply(null,[HEAPU32[(closure>>2)+1],ret_ptr,args_ptr,HEAPU32[(closure>>2)+3]]);stackRestore(orig_stack_ptr);if(!ret_by_arg){switch(sig[0]){case"i":return HEAPU32[(ret_ptr>>2)+0];case"j":return BigInt(HEAPU32[(ret_ptr>>2)+0*2])|BigInt(HEAPU32[(ret_ptr>>2)+0*2+1])<>3)+0];case"f":return HEAPF32[(ret_ptr>>2)+0]}}}try{var wasm_trampoline=convertJsFunctionToWasm(trampoline,sig)}catch(e){return FFI_BAD_TYPEDEF}wasmTable.set(codeloc,wasm_trampoline);HEAPU32[(closure>>2)+1]=cif;HEAPU32[(closure>>2)+2]=fun;HEAPU32[(closure>>2)+3]=user_data;return 0}function _emscripten_set_main_loop_timing(mode,value){Browser.mainLoop.timingMode=mode;Browser.mainLoop.timingValue=value;if(!Browser.mainLoop.func){return 1}if(!Browser.mainLoop.running){Browser.mainLoop.running=true}if(mode==0){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setTimeout(){var timeUntilNextTick=Math.max(0,Browser.mainLoop.tickStartTime+value-_emscripten_get_now())|0;setTimeout(Browser.mainLoop.runner,timeUntilNextTick)};Browser.mainLoop.method="timeout"}else if(mode==1){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_rAF(){Browser.requestAnimationFrame(Browser.mainLoop.runner)};Browser.mainLoop.method="rAF"}else if(mode==2){if(typeof setImmediate=="undefined"){var setImmediates=[];var emscriptenMainLoopMessageId="setimmediate";var Browser_setImmediate_messageHandler=event=>{if(event.data===emscriptenMainLoopMessageId||event.data.target===emscriptenMainLoopMessageId){event.stopPropagation();setImmediates.shift()()}};addEventListener("message",Browser_setImmediate_messageHandler,true);setImmediate=function Browser_emulated_setImmediate(func){setImmediates.push(func);if(ENVIRONMENT_IS_WORKER){if(Module["setImmediates"]===undefined)Module["setImmediates"]=[];Module["setImmediates"].push(func);postMessage({target:emscriptenMainLoopMessageId})}else postMessage(emscriptenMainLoopMessageId,"*")}}Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setImmediate(){setImmediate(Browser.mainLoop.runner)};Browser.mainLoop.method="immediate"}return 0}Module["_emscripten_set_main_loop_timing"]=_emscripten_set_main_loop_timing;_emscripten_set_main_loop_timing.sig="iii";var _emscripten_get_now;if(ENVIRONMENT_IS_NODE){_emscripten_get_now=()=>{var t=process["hrtime"]();return t[0]*1e3+t[1]/1e6}}else _emscripten_get_now=()=>performance.now();Module["_emscripten_get_now"]=_emscripten_get_now;_emscripten_get_now.sig="d";function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}Module["ExitStatus"]=ExitStatus;var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};Module["PATH"]=PATH;function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");return()=>crypto_module["randomBytes"](1)[0]}catch(e){}}return()=>abort("randomDevice")}Module["getRandomDevice"]=getRandomDevice;var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}Module["intArrayFromString"]=intArrayFromString;var TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};Module["TTY"]=TTY;function zeroMemory(address,size){HEAPU8.fill(0,address,address+size);return address}Module["zeroMemory"]=zeroMemory;function alignMemory(size,alignment){return Math.ceil(size/alignment)*alignment}Module["alignMemory"]=alignMemory;function mmapAlloc(size){size=alignMemory(size,65536);var ptr=_emscripten_builtin_memalign(65536,size);if(!ptr)return 0;return zeroMemory(ptr,size)}Module["mmapAlloc"]=mmapAlloc;var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage:function(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr:function(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}Module["asyncLoad"]=asyncLoad;var IDBFS={dbs:{},indexedDB:()=>{if(typeof indexedDB!="undefined")return indexedDB;var ret=null;if(typeof window=="object")ret=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB;assert(ret,"IDBFS used, but indexedDB not supported");return ret},DB_VERSION:21,DB_STORE_NAME:"FILE_DATA",mount:function(mount){return MEMFS.mount.apply(null,arguments)},syncfs:(mount,populate,callback)=>{IDBFS.getLocalSet(mount,(err,local)=>{if(err)return callback(err);IDBFS.getRemoteSet(mount,(err,remote)=>{if(err)return callback(err);var src=populate?remote:local;var dst=populate?local:remote;IDBFS.reconcile(src,dst,callback)})})},quit:()=>{Object.values(IDBFS.dbs).forEach(value=>value.close());IDBFS.dbs={}},getDB:(name,callback)=>{var db=IDBFS.dbs[name];if(db){return callback(null,db)}var req;try{req=IDBFS.indexedDB().open(name,IDBFS.DB_VERSION)}catch(e){return callback(e)}if(!req){return callback("Unable to connect to IndexedDB")}req.onupgradeneeded=e=>{var db=e.target.result;var transaction=e.target.transaction;var fileStore;if(db.objectStoreNames.contains(IDBFS.DB_STORE_NAME)){fileStore=transaction.objectStore(IDBFS.DB_STORE_NAME)}else{fileStore=db.createObjectStore(IDBFS.DB_STORE_NAME)}if(!fileStore.indexNames.contains("timestamp")){fileStore.createIndex("timestamp","timestamp",{unique:false})}};req.onsuccess=()=>{db=req.result;IDBFS.dbs[name]=db;callback(null,db)};req.onerror=e=>{callback(this.error);e.preventDefault()}},getLocalSet:(mount,callback)=>{var entries={};function isRealDir(p){return p!=="."&&p!==".."}function toAbsolute(root){return p=>{return PATH.join2(root,p)}}var check=FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));while(check.length){var path=check.pop();var stat;try{stat=FS.stat(path)}catch(e){return callback(e)}if(FS.isDir(stat.mode)){check.push.apply(check,FS.readdir(path).filter(isRealDir).map(toAbsolute(path)))}entries[path]={"timestamp":stat.mtime}}return callback(null,{type:"local",entries:entries})},getRemoteSet:(mount,callback)=>{var entries={};IDBFS.getDB(mount.mountpoint,(err,db)=>{if(err)return callback(err);try{var transaction=db.transaction([IDBFS.DB_STORE_NAME],"readonly");transaction.onerror=e=>{callback(this.error);e.preventDefault()};var store=transaction.objectStore(IDBFS.DB_STORE_NAME);var index=store.index("timestamp");index.openKeyCursor().onsuccess=event=>{var cursor=event.target.result;if(!cursor){return callback(null,{type:"remote",db:db,entries:entries})}entries[cursor.primaryKey]={"timestamp":cursor.key};cursor.continue()}}catch(e){return callback(e)}})},loadLocalEntry:(path,callback)=>{var stat,node;try{var lookup=FS.lookupPath(path);node=lookup.node;stat=FS.stat(path)}catch(e){return callback(e)}if(FS.isDir(stat.mode)){return callback(null,{"timestamp":stat.mtime,"mode":stat.mode})}else if(FS.isFile(stat.mode)){node.contents=MEMFS.getFileDataAsTypedArray(node);return callback(null,{"timestamp":stat.mtime,"mode":stat.mode,"contents":node.contents})}else{return callback(new Error("node type not supported"))}},storeLocalEntry:(path,entry,callback)=>{try{if(FS.isDir(entry["mode"])){FS.mkdirTree(path,entry["mode"])}else if(FS.isFile(entry["mode"])){FS.writeFile(path,entry["contents"],{canOwn:true})}else{return callback(new Error("node type not supported"))}FS.chmod(path,entry["mode"]);FS.utime(path,entry["timestamp"],entry["timestamp"])}catch(e){return callback(e)}callback(null)},removeLocalEntry:(path,callback)=>{try{var stat=FS.stat(path);if(FS.isDir(stat.mode)){FS.rmdir(path)}else if(FS.isFile(stat.mode)){FS.unlink(path)}}catch(e){return callback(e)}callback(null)},loadRemoteEntry:(store,path,callback)=>{var req=store.get(path);req.onsuccess=event=>{callback(null,event.target.result)};req.onerror=e=>{callback(this.error);e.preventDefault()}},storeRemoteEntry:(store,path,entry,callback)=>{try{var req=store.put(entry,path)}catch(e){callback(e);return}req.onsuccess=()=>{callback(null)};req.onerror=e=>{callback(this.error);e.preventDefault()}},removeRemoteEntry:(store,path,callback)=>{var req=store.delete(path);req.onsuccess=()=>{callback(null)};req.onerror=e=>{callback(this.error);e.preventDefault()}},reconcile:(src,dst,callback)=>{var total=0;var create=[];Object.keys(src.entries).forEach(function(key){var e=src.entries[key];var e2=dst.entries[key];if(!e2||e["timestamp"].getTime()!=e2["timestamp"].getTime()){create.push(key);total++}});var remove=[];Object.keys(dst.entries).forEach(function(key){if(!src.entries[key]){remove.push(key);total++}});if(!total){return callback(null)}var errored=false;var db=src.type==="remote"?src.db:dst.db;var transaction=db.transaction([IDBFS.DB_STORE_NAME],"readwrite");var store=transaction.objectStore(IDBFS.DB_STORE_NAME);function done(err){if(err&&!errored){errored=true;return callback(err)}}transaction.onerror=e=>{done(this.error);e.preventDefault()};transaction.oncomplete=e=>{if(!errored){callback(null)}};create.sort().forEach(path=>{if(dst.type==="local"){IDBFS.loadRemoteEntry(store,path,(err,entry)=>{if(err)return done(err);IDBFS.storeLocalEntry(path,entry,done)})}else{IDBFS.loadLocalEntry(path,(err,entry)=>{if(err)return done(err);IDBFS.storeRemoteEntry(store,path,entry,done)})}});remove.sort().reverse().forEach(path=>{if(dst.type==="local"){IDBFS.removeLocalEntry(path,done)}else{IDBFS.removeRemoteEntry(store,path,done)}})}};Module["IDBFS"]=IDBFS;var ERRNO_CODES={};Module["ERRNO_CODES"]=ERRNO_CODES;var NODEFS={isWindows:false,staticInit:()=>{NODEFS.isWindows=!!process.platform.match(/^win/);var flags=process["binding"]("constants");if(flags["fs"]){flags=flags["fs"]}NODEFS.flagsForNodeMap={1024:flags["O_APPEND"],64:flags["O_CREAT"],128:flags["O_EXCL"],256:flags["O_NOCTTY"],0:flags["O_RDONLY"],2:flags["O_RDWR"],4096:flags["O_SYNC"],512:flags["O_TRUNC"],1:flags["O_WRONLY"],131072:flags["O_NOFOLLOW"]}},convertNodeCode:e=>{var code=e.code;return ERRNO_CODES[code]},mount:mount=>{return NODEFS.createNode(null,"/",NODEFS.getMode(mount.opts.root),0)},createNode:(parent,name,mode,dev)=>{if(!FS.isDir(mode)&&!FS.isFile(mode)&&!FS.isLink(mode)){throw new FS.ErrnoError(28)}var node=FS.createNode(parent,name,mode);node.node_ops=NODEFS.node_ops;node.stream_ops=NODEFS.stream_ops;return node},getMode:path=>{var stat;try{stat=fs.lstatSync(path);if(NODEFS.isWindows){stat.mode=stat.mode|(stat.mode&292)>>2}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}return stat.mode},realPath:node=>{var parts=[];while(node.parent!==node){parts.push(node.name);node=node.parent}parts.push(node.mount.opts.root);parts.reverse();return PATH.join.apply(null,parts)},flagsForNode:flags=>{flags&=~2097152;flags&=~2048;flags&=~32768;flags&=~524288;flags&=~65536;var newFlags=0;for(var k in NODEFS.flagsForNodeMap){if(flags&k){newFlags|=NODEFS.flagsForNodeMap[k];flags^=k}}if(flags){throw new FS.ErrnoError(28)}return newFlags},node_ops:{getattr:node=>{var path=NODEFS.realPath(node);var stat;try{stat=fs.lstatSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}if(NODEFS.isWindows&&!stat.blksize){stat.blksize=4096}if(NODEFS.isWindows&&!stat.blocks){stat.blocks=(stat.size+stat.blksize-1)/stat.blksize|0}return{dev:stat.dev,ino:stat.ino,mode:stat.mode,nlink:stat.nlink,uid:stat.uid,gid:stat.gid,rdev:stat.rdev,size:stat.size,atime:stat.atime,mtime:stat.mtime,ctime:stat.ctime,blksize:stat.blksize,blocks:stat.blocks}},setattr:(node,attr)=>{var path=NODEFS.realPath(node);try{if(attr.mode!==undefined){fs.chmodSync(path,attr.mode);node.mode=attr.mode}if(attr.timestamp!==undefined){var date=new Date(attr.timestamp);fs.utimesSync(path,date,date)}if(attr.size!==undefined){fs.truncateSync(path,attr.size)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}},lookup:(parent,name)=>{var path=PATH.join2(NODEFS.realPath(parent),name);var mode=NODEFS.getMode(path);return NODEFS.createNode(parent,name,mode)},mknod:(parent,name,mode,dev)=>{var node=NODEFS.createNode(parent,name,mode,dev);var path=NODEFS.realPath(node);try{if(FS.isDir(node.mode)){fs.mkdirSync(path,node.mode)}else{fs.writeFileSync(path,"",{mode:node.mode})}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}return node},rename:(oldNode,newDir,newName)=>{var oldPath=NODEFS.realPath(oldNode);var newPath=PATH.join2(NODEFS.realPath(newDir),newName);try{fs.renameSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}oldNode.name=newName},unlink:(parent,name)=>{var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.unlinkSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}},rmdir:(parent,name)=>{var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.rmdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}},readdir:node=>{var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}},symlink:(parent,newName,oldPath)=>{var newPath=PATH.join2(NODEFS.realPath(parent),newName);try{fs.symlinkSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}},readlink:node=>{var path=NODEFS.realPath(node);try{path=fs.readlinkSync(path);path=nodePath.relative(nodePath.resolve(node.mount.opts.root),path);return path}catch(e){if(!e.code)throw e;if(e.code==="UNKNOWN")throw new FS.ErrnoError(28);throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}}},stream_ops:{open:stream=>{var path=NODEFS.realPath(stream.node);try{if(FS.isFile(stream.node.mode)){stream.nfd=fs.openSync(path,NODEFS.flagsForNode(stream.flags))}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}},close:stream=>{try{if(FS.isFile(stream.node.mode)&&stream.nfd){fs.closeSync(stream.nfd)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}},read:(stream,buffer,offset,length,position)=>{if(length===0)return 0;try{return fs.readSync(stream.nfd,Buffer.from(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}},write:(stream,buffer,offset,length,position)=>{try{return fs.writeSync(stream.nfd,Buffer.from(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}},llseek:(stream,offset,whence)=>{var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){try{var stat=fs.fstatSync(stream.nfd);position+=stat.size}catch(e){throw new FS.ErrnoError(NODEFS.convertNodeCode(e))}}}if(position<0){throw new FS.ErrnoError(28)}return position},mmap:(stream,length,position,prot,flags)=>{if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}var ptr=mmapAlloc(length);NODEFS.stream_ops.read(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true}},msync:(stream,buffer,offset,length,mmapFlags)=>{NODEFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};Module["NODEFS"]=NODEFS;var WORKERFS={DIR_MODE:16895,FILE_MODE:33279,reader:null,mount:function(mount){assert(ENVIRONMENT_IS_WORKER);if(!WORKERFS.reader)WORKERFS.reader=new FileReaderSync;var root=WORKERFS.createNode(null,"/",WORKERFS.DIR_MODE,0);var createdParents={};function ensureParent(path){var parts=path.split("/");var parent=root;for(var i=0;i=stream.node.size)return 0;var chunk=stream.node.contents.slice(position,position+length);var ab=WORKERFS.reader.readAsArrayBuffer(chunk);buffer.set(new Uint8Array(ab),offset);return chunk.size},write:function(stream,buffer,offset,length,position){throw new FS.ErrnoError(29)},llseek:function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.size}}if(position<0){throw new FS.ErrnoError(28)}return position}}};Module["WORKERFS"]=WORKERFS;var PROXYFS={mount:function(mount){return PROXYFS.createNode(null,"/",mount.opts.fs.lstat(mount.opts.root).mode,0)},createNode:function(parent,name,mode,dev){if(!FS.isDir(mode)&&!FS.isFile(mode)&&!FS.isLink(mode)){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var node=FS.createNode(parent,name,mode);node.node_ops=PROXYFS.node_ops;node.stream_ops=PROXYFS.stream_ops;return node},realPath:function(node){var parts=[];while(node.parent!==node){parts.push(node.name);node=node.parent}parts.push(node.mount.opts.root);parts.reverse();return PATH.join.apply(null,parts)},node_ops:{getattr:function(node){var path=PROXYFS.realPath(node);var stat;try{stat=node.mount.opts.fs.lstat(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return{dev:stat.dev,ino:stat.ino,mode:stat.mode,nlink:stat.nlink,uid:stat.uid,gid:stat.gid,rdev:stat.rdev,size:stat.size,atime:stat.atime,mtime:stat.mtime,ctime:stat.ctime,blksize:stat.blksize,blocks:stat.blocks}},setattr:function(node,attr){var path=PROXYFS.realPath(node);try{if(attr.mode!==undefined){node.mount.opts.fs.chmod(path,attr.mode);node.mode=attr.mode}if(attr.timestamp!==undefined){var date=new Date(attr.timestamp);node.mount.opts.fs.utime(path,date,date)}if(attr.size!==undefined){node.mount.opts.fs.truncate(path,attr.size)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},lookup:function(parent,name){try{var path=PATH.join2(PROXYFS.realPath(parent),name);var mode=parent.mount.opts.fs.lstat(path).mode;var node=PROXYFS.createNode(parent,name,mode);return node}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},mknod:function(parent,name,mode,dev){var node=PROXYFS.createNode(parent,name,mode,dev);var path=PROXYFS.realPath(node);try{if(FS.isDir(node.mode)){node.mount.opts.fs.mkdir(path,node.mode)}else{node.mount.opts.fs.writeFile(path,"",{mode:node.mode})}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return node},rename:function(oldNode,newDir,newName){var oldPath=PROXYFS.realPath(oldNode);var newPath=PATH.join2(PROXYFS.realPath(newDir),newName);try{oldNode.mount.opts.fs.rename(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},unlink:function(parent,name){var path=PATH.join2(PROXYFS.realPath(parent),name);try{parent.mount.opts.fs.unlink(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},rmdir:function(parent,name){var path=PATH.join2(PROXYFS.realPath(parent),name);try{parent.mount.opts.fs.rmdir(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readdir:function(node){var path=PROXYFS.realPath(node);try{return node.mount.opts.fs.readdir(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},symlink:function(parent,newName,oldPath){var newPath=PATH.join2(PROXYFS.realPath(parent),newName);try{parent.mount.opts.fs.symlink(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readlink:function(node){var path=PROXYFS.realPath(node);try{return node.mount.opts.fs.readlink(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}},stream_ops:{open:function(stream){var path=PROXYFS.realPath(stream.node);try{stream.nfd=stream.node.mount.opts.fs.open(path,stream.flags)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},close:function(stream){try{stream.node.mount.opts.fs.close(stream.nfd)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},read:function(stream,buffer,offset,length,position){try{return stream.node.mount.opts.fs.read(stream.nfd,buffer,offset,length,position)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},write:function(stream,buffer,offset,length,position){try{return stream.node.mount.opts.fs.write(stream.nfd,buffer,offset,length,position)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},llseek:function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){try{var stat=stream.node.node_ops.getattr(stream.node);position+=stat.size}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}}}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}return position}}};Module["PROXYFS"]=PROXYFS;var LZ4={DIR_MODE:16895,FILE_MODE:33279,CHUNK_SIZE:-1,codec:null,init:function(){if(LZ4.codec)return;LZ4.codec=function(){var MiniLZ4=function(){var exports={};exports.uncompress=function(input,output,sIdx,eIdx){sIdx=sIdx||0;eIdx=eIdx||input.length-sIdx;for(var i=sIdx,n=eIdx,j=0;i>4;if(literals_length>0){var l=literals_length+240;while(l===255){l=input[i++];literals_length+=l}var end=i+literals_length;while(ij)return-(i-2);var match_length=token&15;var l=match_length+240;while(l===255){l=input[i++];match_length+=l}var pos=j-offset;var end=j+match_length+4;while(jmaxInputSize?0:isize+isize/255+16|0};exports.compress=function(src,dst,sIdx,eIdx){hashTable.set(empty);return compressBlock(src,dst,0,sIdx||0,eIdx||dst.length)};function compressBlock(src,dst,pos,sIdx,eIdx){var dpos=sIdx;var dlen=eIdx-sIdx;var anchor=0;if(src.length>=maxInputSize)throw new Error("input too large");if(src.length>mfLimit){var n=exports.compressBound(src.length);if(dlen>>hashShift;var ref=hashTable[hash]-1;hashTable[hash]=pos+1;if(ref<0||pos-ref>>>16>0||((src[ref+3]<<8|src[ref+2])!=sequenceHighBits||(src[ref+1]<<8|src[ref])!=sequenceLowBits)){step=findMatchAttempts++>>skipStrength;pos+=step;continue}findMatchAttempts=(1<=runMask){dst[dpos++]=(runMask<254;len-=255){dst[dpos++]=255}dst[dpos++]=len}else{dst[dpos++]=(literals_length<>8;if(match_length>=mlMask){match_length-=mlMask;while(match_length>=255){match_length-=255;dst[dpos++]=255}dst[dpos++]=match_length}anchor=pos}}if(anchor==0)return 0;literals_length=src.length-anchor;if(literals_length>=runMask){dst[dpos++]=runMask<254;ln-=255){dst[dpos++]=255}dst[dpos++]=ln}else{dst[dpos++]=literals_length<0){assert(compressedSize<=bound);compressed=compressed.subarray(0,compressedSize);compressedChunks.push(compressed);total+=compressedSize;successes.push(1);if(verify){var back=exports.uncompress(compressed,temp);assert(back===chunk.length,[back,chunk.length]);for(var i=0;i=0){currChunk=compressedData["cachedChunks"][found]}else{compressedData["cachedIndexes"].pop();compressedData["cachedIndexes"].unshift(chunkIndex);currChunk=compressedData["cachedChunks"].pop();compressedData["cachedChunks"].unshift(currChunk);if(compressedData["debug"]){out("decompressing chunk "+chunkIndex);Module["decompressedChunks"]=(Module["decompressedChunks"]||0)+1}var compressed=compressedData["data"].subarray(compressedStart,compressedStart+compressedSize);var originalSize=LZ4.codec.uncompress(compressed,currChunk);if(chunkIndex{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:node=>{var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:node=>{var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:(parent,name)=>{var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:(parent,name,mode,rdev)=>{var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:node=>{FS.hashRemoveNode(node)},isRoot:node=>{return node===node.parent},isMountpoint:node=>{return!!node.mounted},isFile:mode=>{return(mode&61440)===32768},isDir:mode=>{return(mode&61440)===16384},isLink:mode=>{return(mode&61440)===40960},isChrdev:mode=>{return(mode&61440)===8192},isBlkdev:mode=>{return(mode&61440)===24576},isFIFO:mode=>{return(mode&61440)===4096},isSocket:mode=>{return(mode&49152)===49152},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},flagsToPermissionString:flag=>{var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions:(node,perms)=>{if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup:dir=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:()=>{throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice:(dev,ops)=>{FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts:mount=>{var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:mountpoint=>{var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:(path,mode)=>{var dirs=path.split("/");var d="";for(var i=0;i{if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir:path=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink:path=>{var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chmod(stream.node,mode)},chown:(path,uid,gid,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown:(path,uid,gid)=>{FS.chown(path,uid,gid,true)},fchown:(fd,uid,gid)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chown(stream.node,uid,gid)},truncate:(path,len)=>{if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate:(fd,len)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:(stream,offset,length)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap:(stream,length,position,prot,flags)=>{if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:()=>{var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS,"IDBFS":IDBFS,"NODEFS":NODEFS,"WORKERFS":WORKERFS,"PROXYFS":PROXYFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;_fflush(0);for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},findObject:(path,dontResolveLastLink)=>{var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath:(path,dontResolveLastLink)=>{try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath:(parent,path,canRead,canWrite)=>{parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile:(parent,name,properties,canRead,canWrite)=>{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile:(parent,name,data,canRead,canWrite,canOwn)=>{var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){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.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node},createPreloadedFile:(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency("cp "+fullname);function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};Module["FS"]=FS;var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();tempI64=[Math.floor(atime/1e3)>>>0,(tempDouble=Math.floor(atime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=atime%1e3*1e3;tempI64=[Math.floor(mtime/1e3)>>>0,(tempDouble=Math.floor(mtime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=mtime%1e3*1e3;tempI64=[Math.floor(ctime/1e3)>>>0,(tempDouble=Math.floor(ctime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=ctime%1e3*1e3;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};Module["SYSCALLS"]=SYSCALLS;function _proc_exit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){if(Module["onExit"])Module["onExit"](code);ABORT=true}quit_(code,new ExitStatus(code))}Module["_proc_exit"]=_proc_exit;_proc_exit.sig="vi";function exitJS(status,implicit){EXITSTATUS=status;_proc_exit(status)}Module["exitJS"]=exitJS;var _exit=exitJS;Module["_exit"]=_exit;_exit.sig="vi";function handleException(e){if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)}Module["handleException"]=handleException;function maybeExit(){}Module["maybeExit"]=maybeExit;function setMainLoop(browserIterationFunc,fps,simulateInfiniteLoop,arg,noSetTiming){assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.");Browser.mainLoop.func=browserIterationFunc;Browser.mainLoop.arg=arg;var thisMainLoopId=Browser.mainLoop.currentlyRunningMainloop;function checkIsRunning(){if(thisMainLoopId0){var start=Date.now();var blocker=Browser.mainLoop.queue.shift();blocker.func(blocker.arg);if(Browser.mainLoop.remainingBlockers){var remaining=Browser.mainLoop.remainingBlockers;var next=remaining%1==0?remaining-1:Math.floor(remaining);if(blocker.counted){Browser.mainLoop.remainingBlockers=next}else{next=next+.5;Browser.mainLoop.remainingBlockers=(8*remaining+next)/9}}out('main loop blocker "'+blocker.name+'" took '+(Date.now()-start)+" ms");Browser.mainLoop.updateStatus();if(!checkIsRunning())return;setTimeout(Browser.mainLoop.runner,0);return}if(!checkIsRunning())return;Browser.mainLoop.currentFrameNumber=Browser.mainLoop.currentFrameNumber+1|0;if(Browser.mainLoop.timingMode==1&&Browser.mainLoop.timingValue>1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}else if(Browser.mainLoop.timingMode==0){Browser.mainLoop.tickStartTime=_emscripten_get_now()}Browser.mainLoop.runIter(browserIterationFunc);if(!checkIsRunning())return;if(typeof SDL=="object"&&SDL.audio&&SDL.audio.queueNewAudioData)SDL.audio.queueNewAudioData();Browser.mainLoop.scheduler()};if(!noSetTiming){if(fps&&fps>0)_emscripten_set_main_loop_timing(0,1e3/fps);else _emscripten_set_main_loop_timing(1,1);Browser.mainLoop.scheduler()}if(simulateInfiniteLoop){throw"unwind"}}Module["setMainLoop"]=setMainLoop;function callUserCallback(func){if(ABORT){return}try{func()}catch(e){handleException(e)}}Module["callUserCallback"]=callUserCallback;function safeSetTimeout(func,timeout){return setTimeout(function(){callUserCallback(func)},timeout)}Module["safeSetTimeout"]=safeSetTimeout;function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text="warning: "+text;err(text)}}Module["warnOnce"]=warnOnce;var Browser={mainLoop:{running:false,scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null;Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var timingMode=Browser.mainLoop.timingMode;var timingValue=Browser.mainLoop.timingValue;var func=Browser.mainLoop.func;Browser.mainLoop.func=null;setMainLoop(func,0,false,Browser.mainLoop.arg,true);_emscripten_set_main_loop_timing(timingMode,timingValue);Browser.mainLoop.scheduler()},updateStatus:function(){if(Module["setStatus"]){var message=Module["statusMessage"]||"Please wait...";var remaining=Browser.mainLoop.remainingBlockers;var expected=Browser.mainLoop.expectedBlockers;if(remaining){if(remaining{assert(img.complete,"Image "+name+" could not be decoded");var canvas=document.createElement("canvas");canvas.width=img.width;canvas.height=img.height;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);preloadedImages[name]=canvas;Browser.URLObject.revokeObjectURL(url);if(onload)onload(byteArray)};img.onerror=event=>{out("Image "+url+" could not be decoded");if(onerror)onerror()};img.src=url};Module["preloadPlugins"].push(imagePlugin);var audioPlugin={};audioPlugin["canHandle"]=function audioPlugin_canHandle(name){return!Module.noAudioDecoding&&name.substr(-4)in{".ogg":1,".wav":1,".mp3":1}};audioPlugin["handle"]=function audioPlugin_handle(byteArray,name,onload,onerror){var done=false;function finish(audio){if(done)return;done=true;preloadedAudios[name]=audio;if(onload)onload(byteArray)}function fail(){if(done)return;done=true;preloadedAudios[name]=new Audio;if(onerror)onerror()}if(Browser.hasBlobConstructor){try{var b=new Blob([byteArray],{type:Browser.getMimetype(name)})}catch(e){return fail()}var url=Browser.URLObject.createObjectURL(b);var audio=new Audio;audio.addEventListener("canplaythrough",()=>finish(audio),false);audio.onerror=function audio_onerror(event){if(done)return;err("warning: browser could not fully decode audio "+name+", trying slower base64 approach");function encode64(data){var BASE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var PAD="=";var ret="";var leftchar=0;var leftbits=0;for(var i=0;i=6){var curr=leftchar>>leftbits-6&63;leftbits-=6;ret+=BASE[curr]}}if(leftbits==2){ret+=BASE[(leftchar&3)<<4];ret+=PAD+PAD}else if(leftbits==4){ret+=BASE[(leftchar&15)<<2];ret+=PAD}return ret}audio.src="data:audio/x-"+name.substr(-3)+";base64,"+encode64(byteArray);finish(audio)};audio.src=url;safeSetTimeout(function(){finish(audio)},1e4)}else{return fail()}};Module["preloadPlugins"].push(audioPlugin);var wasmPlugin={"asyncWasmLoadPromise":new Promise(function(resolve,reject){return resolve()}),"canHandle":function(name){return!Module.noWasmDecoding&&name.endsWith(".so")},"handle":function(byteArray,name,onload,onerror){wasmPlugin["asyncWasmLoadPromise"]=wasmPlugin["asyncWasmLoadPromise"].then(()=>loadWebAssemblyModule(byteArray,{loadAsync:true,nodelete:true})).then(module=>{preloadedWasm[name]=module;onload()},err=>{console.warn("Couldn't instantiate wasm: "+name+" '"+err+"'");onerror()})}};Module["preloadPlugins"].push(wasmPlugin);function pointerLockChange(){Browser.pointerLock=document["pointerLockElement"]===Module["canvas"]||document["mozPointerLockElement"]===Module["canvas"]||document["webkitPointerLockElement"]===Module["canvas"]||document["msPointerLockElement"]===Module["canvas"]}var canvas=Module["canvas"];if(canvas){canvas.requestPointerLock=canvas["requestPointerLock"]||canvas["mozRequestPointerLock"]||canvas["webkitRequestPointerLock"]||canvas["msRequestPointerLock"]||(()=>{});canvas.exitPointerLock=document["exitPointerLock"]||document["mozExitPointerLock"]||document["webkitExitPointerLock"]||document["msExitPointerLock"]||(()=>{});canvas.exitPointerLock=canvas.exitPointerLock.bind(document);document.addEventListener("pointerlockchange",pointerLockChange,false);document.addEventListener("mozpointerlockchange",pointerLockChange,false);document.addEventListener("webkitpointerlockchange",pointerLockChange,false);document.addEventListener("mspointerlockchange",pointerLockChange,false);if(Module["elementPointerLock"]){canvas.addEventListener("click",ev=>{if(!Browser.pointerLock&&Module["canvas"].requestPointerLock){Module["canvas"].requestPointerLock();ev.preventDefault()}},false)}}},handledByPreloadPlugin:function(byteArray,fullname,finish,onerror){Browser.init();var handled=false;Module["preloadPlugins"].forEach(function(plugin){if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true}});return handled},createContext:function(canvas,useWebGL,setInModule,webGLContextAttributes){if(useWebGL&&Module.ctx&&canvas==Module.canvas)return Module.ctx;var ctx;var contextHandle;if(useWebGL){var contextAttributes={antialias:false,alpha:false,majorVersion:1};if(webGLContextAttributes){for(var attribute in webGLContextAttributes){contextAttributes[attribute]=webGLContextAttributes[attribute]}}if(typeof GL!="undefined"){contextHandle=GL.createContext(canvas,contextAttributes);if(contextHandle){ctx=GL.getContext(contextHandle).GLctx}}}else{ctx=canvas.getContext("2d")}if(!ctx)return null;if(setInModule){if(!useWebGL)assert(typeof GLctx=="undefined","cannot set in module if GLctx is used, but we are a non-GL context that would replace it");Module.ctx=ctx;if(useWebGL)GL.makeContextCurrent(contextHandle);Module.useWebGL=useWebGL;Browser.moduleContextCreatedCallbacks.forEach(function(callback){callback()});Browser.init()}return ctx},destroyContext:function(canvas,useWebGL,setInModule){},fullscreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullscreen:function(lockPointer,resizeCanvas){Browser.lockPointer=lockPointer;Browser.resizeCanvas=resizeCanvas;if(typeof Browser.lockPointer=="undefined")Browser.lockPointer=true;if(typeof Browser.resizeCanvas=="undefined")Browser.resizeCanvas=false;var canvas=Module["canvas"];function fullscreenChange(){Browser.isFullscreen=false;var canvasContainer=canvas.parentNode;if((document["fullscreenElement"]||document["mozFullScreenElement"]||document["msFullscreenElement"]||document["webkitFullscreenElement"]||document["webkitCurrentFullScreenElement"])===canvasContainer){canvas.exitFullscreen=Browser.exitFullscreen;if(Browser.lockPointer)canvas.requestPointerLock();Browser.isFullscreen=true;if(Browser.resizeCanvas){Browser.setFullscreenCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}else{canvasContainer.parentNode.insertBefore(canvas,canvasContainer);canvasContainer.parentNode.removeChild(canvasContainer);if(Browser.resizeCanvas){Browser.setWindowedCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}if(Module["onFullScreen"])Module["onFullScreen"](Browser.isFullscreen);if(Module["onFullscreen"])Module["onFullscreen"](Browser.isFullscreen)}if(!Browser.fullscreenHandlersInstalled){Browser.fullscreenHandlersInstalled=true;document.addEventListener("fullscreenchange",fullscreenChange,false);document.addEventListener("mozfullscreenchange",fullscreenChange,false);document.addEventListener("webkitfullscreenchange",fullscreenChange,false);document.addEventListener("MSFullscreenChange",fullscreenChange,false)}var canvasContainer=document.createElement("div");canvas.parentNode.insertBefore(canvasContainer,canvas);canvasContainer.appendChild(canvas);canvasContainer.requestFullscreen=canvasContainer["requestFullscreen"]||canvasContainer["mozRequestFullScreen"]||canvasContainer["msRequestFullscreen"]||(canvasContainer["webkitRequestFullscreen"]?()=>canvasContainer["webkitRequestFullscreen"](Element["ALLOW_KEYBOARD_INPUT"]):null)||(canvasContainer["webkitRequestFullScreen"]?()=>canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]):null);canvasContainer.requestFullscreen()},exitFullscreen:function(){if(!Browser.isFullscreen){return false}var CFS=document["exitFullscreen"]||document["cancelFullScreen"]||document["mozCancelFullScreen"]||document["msExitFullscreen"]||document["webkitCancelFullScreen"]||function(){};CFS.apply(document,[]);return true},nextRAF:0,fakeRequestAnimationFrame:function(func){var now=Date.now();if(Browser.nextRAF===0){Browser.nextRAF=now+1e3/60}else{while(now+2>=Browser.nextRAF){Browser.nextRAF+=1e3/60}}var delay=Math.max(Browser.nextRAF-now,0);setTimeout(func,delay)},requestAnimationFrame:function(func){if(typeof requestAnimationFrame=="function"){requestAnimationFrame(func);return}var RAF=Browser.fakeRequestAnimationFrame;RAF(func)},safeSetTimeout:function(func,timeout){return safeSetTimeout(func,timeout)},safeRequestAnimationFrame:function(func){return Browser.requestAnimationFrame(function(){callUserCallback(func)})},getMimetype:function(name){return{"jpg":"image/jpeg","jpeg":"image/jpeg","png":"image/png","bmp":"image/bmp","ogg":"audio/ogg","wav":"audio/wav","mp3":"audio/mpeg"}[name.substr(name.lastIndexOf(".")+1)]},getUserMedia:function(func){if(!window.getUserMedia){window.getUserMedia=navigator["getUserMedia"]||navigator["mozGetUserMedia"]}window.getUserMedia(func)},getMovementX:function(event){return event["movementX"]||event["mozMovementX"]||event["webkitMovementX"]||0},getMovementY:function(event){return event["movementY"]||event["mozMovementY"]||event["webkitMovementY"]||0},getMouseWheelDelta:function(event){var delta=0;switch(event.type){case"DOMMouseScroll":delta=event.detail/3;break;case"mousewheel":delta=event.wheelDelta/120;break;case"wheel":delta=event.deltaY;switch(event.deltaMode){case 0:delta/=100;break;case 1:delta/=3;break;case 2:delta*=80;break;default:throw"unrecognized mouse wheel delta mode: "+event.deltaMode}break;default:throw"unrecognized mouse wheel event: "+event.type}return delta},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(event){if(Browser.pointerLock){if(event.type!="mousemove"&&"mozMovementX"in event){Browser.mouseMovementX=Browser.mouseMovementY=0}else{Browser.mouseMovementX=Browser.getMovementX(event);Browser.mouseMovementY=Browser.getMovementY(event)}if(typeof SDL!="undefined"){Browser.mouseX=SDL.mouseX+Browser.mouseMovementX;Browser.mouseY=SDL.mouseY+Browser.mouseMovementY}else{Browser.mouseX+=Browser.mouseMovementX;Browser.mouseY+=Browser.mouseMovementY}}else{var rect=Module["canvas"].getBoundingClientRect();var cw=Module["canvas"].width;var ch=Module["canvas"].height;var scrollX=typeof window.scrollX!="undefined"?window.scrollX:window.pageXOffset;var scrollY=typeof window.scrollY!="undefined"?window.scrollY:window.pageYOffset;if(event.type==="touchstart"||event.type==="touchend"||event.type==="touchmove"){var touch=event.touch;if(touch===undefined){return}var adjustedX=touch.pageX-(scrollX+rect.left);var adjustedY=touch.pageY-(scrollY+rect.top);adjustedX=adjustedX*(cw/rect.width);adjustedY=adjustedY*(ch/rect.height);var coords={x:adjustedX,y:adjustedY};if(event.type==="touchstart"){Browser.lastTouches[touch.identifier]=coords;Browser.touches[touch.identifier]=coords}else if(event.type==="touchend"||event.type==="touchmove"){var last=Browser.touches[touch.identifier];if(!last)last=coords;Browser.lastTouches[touch.identifier]=last;Browser.touches[touch.identifier]=coords}return}var x=event.pageX-(scrollX+rect.left);var y=event.pageY-(scrollY+rect.top);x=x*(cw/rect.width);y=y*(ch/rect.height);Browser.mouseMovementX=x-Browser.mouseX;Browser.mouseMovementY=y-Browser.mouseY;Browser.mouseX=x;Browser.mouseY=y}},resizeListeners:[],updateResizeListeners:function(){var canvas=Module["canvas"];Browser.resizeListeners.forEach(function(listener){listener(canvas.width,canvas.height)})},setCanvasSize:function(width,height,noUpdates){var canvas=Module["canvas"];Browser.updateCanvasDimensions(canvas,width,height);if(!noUpdates)Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags|8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags&~8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},updateCanvasDimensions:function(canvas,wNative,hNative){if(wNative&&hNative){canvas.widthNative=wNative;canvas.heightNative=hNative}else{wNative=canvas.widthNative;hNative=canvas.heightNative}var w=wNative;var h=hNative;if(Module["forcedAspectRatio"]&&Module["forcedAspectRatio"]>0){if(w/h0){callbacks.shift()(Module)}}Module["callRuntimeCallbacks"]=callRuntimeCallbacks;function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=Module["___cxa_is_pointer_type"](this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}Module["ExceptionInfo"]=ExceptionInfo;function ___cxa_free_exception(ptr){return _free(new ExceptionInfo(ptr).ptr)}Module["___cxa_free_exception"]=___cxa_free_exception;___cxa_free_exception.sig="vp";var wasmTableMirror=[];Module["wasmTableMirror"]=wasmTableMirror;function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}Module["getWasmTableEntry"]=getWasmTableEntry;function exception_decRef(info){if(info.release_ref()&&!info.get_rethrown()){var destructor=info.get_destructor();if(destructor){getWasmTableEntry(destructor)(info.excPtr)}___cxa_free_exception(info.excPtr)}}Module["exception_decRef"]=exception_decRef;function ___cxa_decrement_exception_refcount(ptr){if(!ptr)return;exception_decRef(new ExceptionInfo(ptr))}Module["___cxa_decrement_exception_refcount"]=___cxa_decrement_exception_refcount;___cxa_decrement_exception_refcount.sig="vp";function decrementExceptionRefcount(ptr){___cxa_decrement_exception_refcount(ptr)}Module["decrementExceptionRefcount"]=decrementExceptionRefcount;function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}Module["withStackSave"]=withStackSave;function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(HEAP32[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}Module["demangle"]=demangle;function getDylinkMetadata(binary){var offset=0;var end=0;function getU8(){return binary[offset++]}function getLEB(){var ret=0;var mul=1;while(1){var byte=binary[offset++];ret+=(byte&127)*mul;mul*=128;if(!(byte&128))break}return ret}function getString(){var len=getLEB();offset+=len;return UTF8ArrayToString(binary,offset-len,len)}function failIf(condition,message){if(condition)throw new Error(message)}var name="dylink.0";if(binary instanceof WebAssembly.Module){var dylinkSection=WebAssembly.Module.customSections(binary,name);if(dylinkSection.length===0){name="dylink";dylinkSection=WebAssembly.Module.customSections(binary,name)}failIf(dylinkSection.length===0,"need dylink section");binary=new Uint8Array(dylinkSection[0]);end=binary.length}else{var int32View=new Uint32Array(new Uint8Array(binary.subarray(0,24)).buffer);var magicNumberFound=int32View[0]==1836278016;failIf(!magicNumberFound,"need to see wasm magic number");failIf(binary[8]!==0,"need the dylink section to be first");offset=9;var section_size=getLEB();end=offset+section_size;name=getString()}var customSection={neededDynlibs:[],tlsExports:new Set,weakImports:new Set};if(name=="dylink"){customSection.memorySize=getLEB();customSection.memoryAlign=getLEB();customSection.tableSize=getLEB();customSection.tableAlign=getLEB();var neededDynlibsCount=getLEB();for(var i=0;i>2];var message_addr=HEAPU32[message_addr_addr>>2];var type=UTF8ToString(type_addr);_free(type_addr);var message;if(message_addr){message=UTF8ToString(message_addr);_free(message_addr)}return[type,message]})}Module["getExceptionMessageCommon"]=getExceptionMessageCommon;function getExceptionMessage(ptr){return getExceptionMessageCommon(ptr)}Module["getExceptionMessage"]=getExceptionMessage;function getValue(ptr,type="i8"){if(type.endsWith("*"))type="*";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP64[ptr>>3];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];case"*":return HEAPU32[ptr>>2];default:abort("invalid type for getValue: "+type)}return null}Module["getValue"]=getValue;function exception_addRef(info){info.add_ref()}Module["exception_addRef"]=exception_addRef;function ___cxa_increment_exception_refcount(ptr){if(!ptr)return;exception_addRef(new ExceptionInfo(ptr))}Module["___cxa_increment_exception_refcount"]=___cxa_increment_exception_refcount;___cxa_increment_exception_refcount.sig="vp";function incrementExceptionRefcount(ptr){___cxa_increment_exception_refcount(ptr)}Module["incrementExceptionRefcount"]=incrementExceptionRefcount;function asmjsMangle(x){var unmangledSymbols=["stackAlloc","stackSave","stackRestore","getTempRet0","setTempRet0"];return x.indexOf("dynCall_")==0||unmangledSymbols.includes(x)?x:"_"+x}Module["asmjsMangle"]=asmjsMangle;function mergeLibSymbols(exports,libName){for(var sym in exports){if(!exports.hasOwnProperty(sym)){continue}if(!asmLibraryArg.hasOwnProperty(sym)){asmLibraryArg[sym]=exports[sym]}var module_sym=asmjsMangle(sym);if(!Module.hasOwnProperty(module_sym)){Module[module_sym]=exports[sym]}if(sym=="__main_argc_argv"){Module["_main"]=exports[sym]}}}Module["mergeLibSymbols"]=mergeLibSymbols;var LDSO={loadedLibsByName:{},loadedLibsByHandle:{}};Module["LDSO"]=LDSO;function dynCall(sig,ptr,args){var rtn=getWasmTableEntry(ptr).apply(null,args);return rtn}Module["dynCall"]=dynCall;function createInvokeFunction(sig){return function(){var sp=stackSave();try{return dynCall(sig,arguments[0],Array.prototype.slice.call(arguments,1))}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}}Module["createInvokeFunction"]=createInvokeFunction;var ___heap_base=8402016;Module["___heap_base"]=___heap_base;function getMemory(size){if(runtimeInitialized){return zeroMemory(_malloc(size),size)}var ret=___heap_base;var end=ret+size+15&-16;___heap_base=end;GOT["__heap_base"].value=end;return ret}Module["getMemory"]=getMemory;function isInternalSym(symName){return["__cpp_exception","__c_longjmp","__wasm_apply_data_relocs","__dso_handle","__tls_size","__tls_align","__set_stack_limits","_emscripten_tls_init","__wasm_init_tls","__wasm_call_ctors","__start_em_asm","__stop_em_asm"].includes(symName)}Module["isInternalSym"]=isInternalSym;function uleb128Encode(n,target){if(n<128){target.push(n)}else{target.push(n%128|128,n>>7)}}Module["uleb128Encode"]=uleb128Encode;function sigToWasmTypes(sig){var typeNames={"i":"i32","j":"i32","f":"f32","d":"f64","p":"i32"};var type={parameters:[],results:sig[0]=="v"?[]:[typeNames[sig[0]]]};for(var i=1;i>0];if(needsAllocation){var memAlign=Math.pow(2,metadata.memoryAlign);memAlign=Math.max(memAlign,STACK_ALIGN);var memoryBase=metadata.memorySize?alignMemory(getMemory(metadata.memorySize+memAlign),memAlign):0;var tableBase=metadata.tableSize?wasmTable.length:0;if(handle){HEAP8[handle+24>>0]=1;HEAPU32[handle+28>>2]=memoryBase;HEAP32[handle+32>>2]=metadata.memorySize;HEAPU32[handle+36>>2]=tableBase;HEAP32[handle+40>>2]=metadata.tableSize}}else{memoryBase=HEAPU32[handle+28>>2];tableBase=HEAPU32[handle+36>>2]}var tableGrowthNeeded=tableBase+metadata.tableSize-wasmTable.length;if(tableGrowthNeeded>0){wasmTable.grow(tableGrowthNeeded)}var moduleExports;function resolveSymbol(sym){var resolved=resolveGlobalSymbol(sym,false);if(!resolved){resolved=moduleExports[sym]}return resolved}var proxyHandler={"get":function(stubs,prop){switch(prop){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(prop in asmLibraryArg){return asmLibraryArg[prop]}if(!(prop in stubs)){var resolved;stubs[prop]=function(){if(!resolved)resolved=resolveSymbol(prop);return resolved.apply(null,arguments)}}return stubs[prop]}};var proxy=new Proxy({},proxyHandler);var info={"GOT.mem":new Proxy({},GOTHandler),"GOT.func":new Proxy({},GOTHandler),"env":proxy,wasi_snapshot_preview1:proxy};function postInstantiation(instance){updateTableMap(tableBase,metadata.tableSize);moduleExports=relocateExports(instance.exports,memoryBase);if(!flags.allowUndefined){reportUndefinedSymbols()}function addEmAsm(addr,body){var args=[];var arity=0;for(;arity<16;arity++){if(body.indexOf("$"+arity)!=-1){args.push("$"+arity)}else{break}}args=args.join(",");var func="("+args+" ) => { "+body+"};";ASM_CONSTS[start]=eval(func)}if("__start_em_asm"in moduleExports){var start=moduleExports["__start_em_asm"];var stop=moduleExports["__stop_em_asm"];while(startresolve(new Uint8Array(data)),reject)})}if(!readBinary){throw new Error(libFile+": file not found, and synchronous loading of external files is not available")}return readBinary(libFile)}function getLibModule(){if(typeof preloadedWasm!="undefined"&&preloadedWasm[lib]){var libModule=preloadedWasm[lib];return flags.loadAsync?Promise.resolve(libModule):libModule}if(flags.loadAsync){return loadLibData(lib).then(function(libData){return loadWebAssemblyModule(libData,flags,handle)})}return loadWebAssemblyModule(loadLibData(lib),flags,handle)}function moduleLoaded(libModule){if(dso.global){mergeLibSymbols(libModule,lib)}dso.module=libModule}if(flags.loadAsync){return getLibModule().then(function(libModule){moduleLoaded(libModule);return true})}moduleLoaded(getLibModule());return true}Module["loadDynamicLibrary"]=loadDynamicLibrary;function reportUndefinedSymbols(){for(var symName in GOT){if(GOT[symName].value==0){var value=resolveGlobalSymbol(symName,true);if(!value&&!GOT[symName].required){continue}if(typeof value=="function"){GOT[symName].value=addFunction(value,value.sig)}else if(typeof value=="number"){GOT[symName].value=value}else{throw new Error("bad export type for `"+symName+"`: "+typeof value)}}}}Module["reportUndefinedSymbols"]=reportUndefinedSymbols;function preloadDylibs(){if(!dynamicLibraries.length){reportUndefinedSymbols();return}addRunDependency("preloadDylibs");dynamicLibraries.reduce(function(chain,lib){return chain.then(function(){return loadDynamicLibrary(lib,{loadAsync:true,global:true,nodelete:true,allowUndefined:true})})},Promise.resolve()).then(function(){reportUndefinedSymbols();removeRunDependency("preloadDylibs")})}Module["preloadDylibs"]=preloadDylibs;function setValue(ptr,value,type="i8"){if(type.endsWith("*"))type="*";switch(type){case"i1":HEAP8[ptr>>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;case"*":HEAPU32[ptr>>2]=value;break;default:abort("invalid type for setValue: "+type)}}Module["setValue"]=setValue;function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}Module["jsStackTrace"]=jsStackTrace;function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}Module["demangleAll"]=demangleAll;function stackTrace(){var js=jsStackTrace();if(Module["extraStackTrace"])js+="\n"+Module["extraStackTrace"]();return demangleAll(js)}Module["stackTrace"]=stackTrace;function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}Module["___assert_fail"]=___assert_fail;___assert_fail.sig="vppip";function ___call_sighandler(fp,sig){getWasmTableEntry(fp)(sig)}Module["___call_sighandler"]=___call_sighandler;___call_sighandler.sig="vpi";function ___cxa_allocate_exception(size){return _malloc(size+24)+24}Module["___cxa_allocate_exception"]=___cxa_allocate_exception;___cxa_allocate_exception.sig="pp";var exceptionCaught=[];Module["exceptionCaught"]=exceptionCaught;var uncaughtExceptionCount=0;Module["uncaughtExceptionCount"]=uncaughtExceptionCount;function ___cxa_begin_catch(ptr){var info=new ExceptionInfo(ptr);if(!info.get_caught()){info.set_caught(true);uncaughtExceptionCount--}info.set_rethrown(false);exceptionCaught.push(info);exception_addRef(info);return info.get_exception_ptr()}Module["___cxa_begin_catch"]=___cxa_begin_catch;___cxa_begin_catch.sig="pp";function ___cxa_current_primary_exception(){if(!exceptionCaught.length){return 0}var info=exceptionCaught[exceptionCaught.length-1];exception_addRef(info);return info.excPtr}Module["___cxa_current_primary_exception"]=___cxa_current_primary_exception;var exceptionLast=0;Module["exceptionLast"]=exceptionLast;function ___cxa_end_catch(){_setThrew(0);var info=exceptionCaught.pop();exception_decRef(info);exceptionLast=0}Module["___cxa_end_catch"]=___cxa_end_catch;___cxa_end_catch.sig="v";function ___resumeException(ptr){if(!exceptionLast){exceptionLast=ptr}throw ptr}Module["___resumeException"]=___resumeException;___resumeException.sig="vp";function ___cxa_find_matching_catch_2(){var thrown=exceptionLast;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var i=0;i>2]:0,srcReadHigh=readfds?HEAP32[readfds+4>>2]:0;var srcWriteLow=writefds?HEAP32[writefds>>2]:0,srcWriteHigh=writefds?HEAP32[writefds+4>>2]:0;var srcExceptLow=exceptfds?HEAP32[exceptfds>>2]:0,srcExceptHigh=exceptfds?HEAP32[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?HEAP32[readfds>>2]:0)|(writefds?HEAP32[writefds>>2]:0)|(exceptfds?HEAP32[exceptfds>>2]:0);var allHigh=(readfds?HEAP32[readfds+4>>2]:0)|(writefds?HEAP32[writefds+4>>2]:0)|(exceptfds?HEAP32[exceptfds+4>>2]:0);var check=function(fd,low,high,val){return fd<32?low&val:high&val};for(var fd=0;fd>2]=dstReadLow;HEAP32[readfds+4>>2]=dstReadHigh}if(writefds){HEAP32[writefds>>2]=dstWriteLow;HEAP32[writefds+4>>2]=dstWriteHigh}if(exceptfds){HEAP32[exceptfds>>2]=dstExceptLow;HEAP32[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall__newselect"]=___syscall__newselect;var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;if(ENVIRONMENT_IS_NODE){WebSocketConstructor=require("ws")}else{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}Module["setErrNo"]=setErrNo;var Sockets={BUFFER_SIZE:10240,MAX_BUFFER_SIZE:10485760,nextFd:1,fds:{},nextport:1,maxport:65535,peer:null,connections:{},portmap:{},localAddr:4261412874,addrPool:[33554442,50331658,67108874,83886090,100663306,117440522,134217738,150994954,167772170,184549386,201326602,218103818,234881034]};Module["Sockets"]=Sockets;function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}Module["inetPton4"]=inetPton4;function jstoi_q(str){return parseInt(str)}Module["jstoi_q"]=jstoi_q;function inetPton6(str){var words;var w,offset,z,i;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>2]=16}HEAP16[sa>>1]=family;HEAP32[sa+4>>2]=addr;HEAP16[sa+2>>1]=_htons(port);break;case 10:addr=inetPton6(addr);zeroMemory(sa,28);if(addrlen){HEAP32[addrlen>>2]=28}HEAP32[sa>>2]=family;HEAP32[sa+8>>2]=addr[0];HEAP32[sa+12>>2]=addr[1];HEAP32[sa+16>>2]=addr[2];HEAP32[sa+20>>2]=addr[3];HEAP16[sa+2>>1]=_htons(port);break;default:return 5}return 0}Module["writeSockaddr"]=writeSockaddr;var DNS={address_map:{id:1,addrs:{},names:{}},lookup_name:function(name){var res=inetPton4(name);if(res!==null){return name}res=inetPton6(name);if(res!==null){return name}var addr;if(DNS.address_map.addrs[name]){addr=DNS.address_map.addrs[name]}else{var id=DNS.address_map.id++;assert(id<65535,"exceeded max address mappings of 65535");addr="172.29."+(id&255)+"."+(id&65280);DNS.address_map.names[addr]=name;DNS.address_map.addrs[name]=addr}return addr},lookup_addr:function(addr){if(DNS.address_map.names[addr]){return DNS.address_map.names[addr]}return null}};Module["DNS"]=DNS;function ___syscall_accept4(fd,addr,addrlen,flags){try{var sock=getSocketFromFD(fd);var newsock=sock.sock_ops.accept(sock);if(addr){var errno=writeSockaddr(addr,newsock.family,DNS.lookup_name(newsock.daddr),newsock.dport,addrlen)}return newsock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_accept4"]=___syscall_accept4;function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}Module["inetNtop4"]=inetNtop4;function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(HEAPU16[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=HEAP32[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[HEAP32[sa+8>>2],HEAP32[sa+12>>2],HEAP32[sa+16>>2],HEAP32[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}Module["readSockaddr"]=readSockaddr;function getSocketAddress(addrp,addrlen,allowNull){if(allowNull&&addrp===0)return null;var info=readSockaddr(addrp,addrlen);if(info.errno)throw new FS.ErrnoError(info.errno);info.addr=DNS.lookup_addr(info.addr)||info.addr;return info}Module["getSocketAddress"]=getSocketAddress;function ___syscall_bind(fd,addr,addrlen){try{var sock=getSocketFromFD(fd);var info=getSocketAddress(addr,addrlen);sock.sock_ops.bind(sock,info.addr,info.port);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_bind"]=___syscall_bind;___syscall_bind.sig="iipi";function ___syscall_chdir(path){try{path=SYSCALLS.getStr(path);FS.chdir(path);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_chdir"]=___syscall_chdir;___syscall_chdir.sig="ip";function ___syscall_chmod(path,mode){try{path=SYSCALLS.getStr(path);FS.chmod(path,mode);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_chmod"]=___syscall_chmod;___syscall_chmod.sig="ipi";function ___syscall_connect(fd,addr,addrlen){try{var sock=getSocketFromFD(fd);var info=getSocketAddress(addr,addrlen);sock.sock_ops.connect(sock,info.addr,info.port);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_connect"]=___syscall_connect;___syscall_connect.sig="iipi";function ___syscall_dup(fd){try{var old=SYSCALLS.getStreamFromFD(fd);return FS.createStream(old,0).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_dup"]=___syscall_dup;___syscall_dup.sig="ii";function ___syscall_dup3(fd,suggestFD,flags){try{var old=SYSCALLS.getStreamFromFD(fd);if(old.fd===suggestFD)return-28;var suggest=FS.getStream(suggestFD);if(suggest)FS.close(suggest);return FS.createStream(old,suggestFD,suggestFD+1).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_dup3"]=___syscall_dup3;function ___syscall_faccessat(dirfd,path,amode,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(amode&~7){return-28}var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node){return-44}var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-2}return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_faccessat"]=___syscall_faccessat;___syscall_faccessat.sig="iipii";function ___syscall_fadvise64(fd,offset,len,advice){return 0}Module["___syscall_fadvise64"]=___syscall_fadvise64;var MAX_INT53=9007199254740992;Module["MAX_INT53"]=MAX_INT53;var MIN_INT53=-9007199254740992;Module["MIN_INT53"]=MIN_INT53;function bigintToI53Checked(num){return numMAX_INT53?NaN:Number(num)}Module["bigintToI53Checked"]=bigintToI53Checked;function ___syscall_fallocate(fd,mode,offset,len){try{offset=bigintToI53Checked(offset);if(isNaN(offset))return-61;len=bigintToI53Checked(len);if(isNaN(len))return-61;var stream=SYSCALLS.getStreamFromFD(fd);FS.allocate(stream,offset,len);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_fallocate"]=___syscall_fallocate;function ___syscall_fchdir(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.chdir(stream.path);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_fchdir"]=___syscall_fchdir;function ___syscall_fchmod(fd,mode){try{FS.fchmod(fd,mode);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_fchmod"]=___syscall_fchmod;function ___syscall_fchmodat(dirfd,path,mode,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);FS.chmod(path,mode);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_fchmodat"]=___syscall_fchmodat;___syscall_fchmodat.sig="iipip";function ___syscall_fchown32(fd,owner,group){try{FS.fchown(fd,owner,group);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_fchown32"]=___syscall_fchown32;function ___syscall_fchownat(dirfd,path,owner,group,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;flags=flags&~256;path=SYSCALLS.calculateAt(dirfd,path);(nofollow?FS.lchown:FS.chown)(path,owner,group);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_fchownat"]=___syscall_fchownat;___syscall_fchownat.sig="iipiii";function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_fcntl64"]=___syscall_fcntl64;___syscall_fcntl64.sig="iiip";function ___syscall_fdatasync(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_fdatasync"]=___syscall_fdatasync;function ___syscall_fstat64(fd,buf){try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_fstat64"]=___syscall_fstat64;___syscall_fstat64.sig="iip";function ___syscall_statfs64(path,size,buf){try{path=SYSCALLS.getStr(path);HEAP32[buf+4>>2]=4096;HEAP32[buf+40>>2]=4096;HEAP32[buf+8>>2]=1e6;HEAP32[buf+12>>2]=5e5;HEAP32[buf+16>>2]=5e5;HEAP32[buf+20>>2]=FS.nextInode;HEAP32[buf+24>>2]=1e6;HEAP32[buf+28>>2]=42;HEAP32[buf+44>>2]=2;HEAP32[buf+36>>2]=255;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_statfs64"]=___syscall_statfs64;___syscall_statfs64.sig="ippp";function ___syscall_fstatfs64(fd,size,buf){try{var stream=SYSCALLS.getStreamFromFD(fd);return ___syscall_statfs64(0,size,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_fstatfs64"]=___syscall_fstatfs64;function ___syscall_ftruncate64(fd,length){try{length=bigintToI53Checked(length);if(isNaN(length))return-61;FS.ftruncate(fd,length);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_ftruncate64"]=___syscall_ftruncate64;___syscall_ftruncate64.sig="iij";function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>>0,(tempDouble=id,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[dirp+pos>>2]=tempI64[0],HEAP32[dirp+pos+4>>2]=tempI64[1];tempI64=[(idx+1)*struct_size>>>0,(tempDouble=(idx+1)*struct_size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[dirp+pos+8>>2]=tempI64[0],HEAP32[dirp+pos+12>>2]=tempI64[1];HEAP16[dirp+pos+16>>1]=280;HEAP8[dirp+pos+18>>0]=type;stringToUTF8(name,dirp+pos+19,256);pos+=struct_size;idx+=1}FS.llseek(stream,idx*struct_size,0);return pos}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_getdents64"]=___syscall_getdents64;___syscall_getdents64.sig="iipi";function ___syscall_getpeername(fd,addr,addrlen){try{var sock=getSocketFromFD(fd);if(!sock.daddr){return-53}var errno=writeSockaddr(addr,sock.family,DNS.lookup_name(sock.daddr),sock.dport,addrlen);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_getpeername"]=___syscall_getpeername;function ___syscall_getsockname(fd,addr,addrlen){try{err("__syscall_getsockname "+fd);var sock=getSocketFromFD(fd);var errno=writeSockaddr(addr,sock.family,DNS.lookup_name(sock.saddr||"0.0.0.0"),sock.sport,addrlen);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_getsockname"]=___syscall_getsockname;function ___syscall_getsockopt(fd,level,optname,optval,optlen){try{var sock=getSocketFromFD(fd);if(level===1){if(optname===4){HEAP32[optval>>2]=sock.error;HEAP32[optlen>>2]=4;sock.error=null;return 0}}return-50}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_getsockopt"]=___syscall_getsockopt;function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:case 21505:{if(!stream.tty)return-59;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-59;return 0}case 21519:{if(!stream.tty)return-59;var argp=SYSCALLS.get();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_ioctl"]=___syscall_ioctl;___syscall_ioctl.sig="iiip";function ___syscall_linkat(olddirfd,oldpath,newdirfd,newpath,flags){return-34}Module["___syscall_linkat"]=___syscall_linkat;function ___syscall_listen(fd,backlog){try{var sock=getSocketFromFD(fd);sock.sock_ops.listen(sock,backlog);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_listen"]=___syscall_listen;function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_lstat64"]=___syscall_lstat64;___syscall_lstat64.sig="ipp";function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_mkdirat"]=___syscall_mkdirat;___syscall_mkdirat.sig="iipi";function ___syscall_mknodat(dirfd,path,mode,dev){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);switch(mode&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}FS.mknod(path,mode,dev);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_mknodat"]=___syscall_mknodat;___syscall_mknodat.sig="iipii";function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_newfstatat"]=___syscall_newfstatat;___syscall_newfstatat.sig="iippi";function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_openat"]=___syscall_openat;___syscall_openat.sig="iipip";var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};Module["PIPEFS"]=PIPEFS;function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_pipe"]=___syscall_pipe;___syscall_pipe.sig="ip";function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_poll"]=___syscall_poll;___syscall_poll.sig="ipii";function ___syscall_readlinkat(dirfd,path,buf,bufsize){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(bufsize<=0)return-28;var ret=FS.readlink(path);var len=Math.min(bufsize,lengthBytesUTF8(ret));var endChar=HEAP8[buf+len];stringToUTF8(ret,buf,bufsize+1);HEAP8[buf+len]=endChar;return len}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_readlinkat"]=___syscall_readlinkat;___syscall_readlinkat.sig="vippp";function ___syscall_recvfrom(fd,buf,len,flags,addr,addrlen){try{var sock=getSocketFromFD(fd);var msg=sock.sock_ops.recvmsg(sock,len);if(!msg)return 0;if(addr){var errno=writeSockaddr(addr,sock.family,DNS.lookup_name(msg.addr),msg.port,addrlen)}HEAPU8.set(msg.buffer,buf);return msg.buffer.byteLength}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_recvfrom"]=___syscall_recvfrom;function ___syscall_recvmsg(fd,message,flags){try{var sock=getSocketFromFD(fd);var iov=HEAPU32[message+8>>2];var num=HEAP32[message+12>>2];var total=0;for(var i=0;i>2]}var msg=sock.sock_ops.recvmsg(sock,total);if(!msg)return 0;var name=HEAPU32[message>>2];if(name){var errno=writeSockaddr(name,sock.family,DNS.lookup_name(msg.addr),msg.port)}var bytesRead=0;var bytesRemaining=msg.buffer.byteLength;for(var i=0;bytesRemaining>0&&i>2];var iovlen=HEAP32[iov+(8*i+4)>>2];if(!iovlen){continue}var length=Math.min(iovlen,bytesRemaining);var buf=msg.buffer.subarray(bytesRead,bytesRead+length);HEAPU8.set(buf,iovbase+bytesRead);bytesRead+=length;bytesRemaining-=length}return bytesRead}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_recvmsg"]=___syscall_recvmsg;function ___syscall_renameat(olddirfd,oldpath,newdirfd,newpath){try{oldpath=SYSCALLS.getStr(oldpath);newpath=SYSCALLS.getStr(newpath);oldpath=SYSCALLS.calculateAt(olddirfd,oldpath);newpath=SYSCALLS.calculateAt(newdirfd,newpath);FS.rename(oldpath,newpath);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_renameat"]=___syscall_renameat;___syscall_renameat.sig="iipip";function ___syscall_rmdir(path){try{path=SYSCALLS.getStr(path);FS.rmdir(path);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_rmdir"]=___syscall_rmdir;___syscall_rmdir.sig="ip";function ___syscall_sendmsg(fd,message,flags){try{var sock=getSocketFromFD(fd);var iov=HEAPU32[message+8>>2];var num=HEAP32[message+12>>2];var addr,port;var name=HEAPU32[message>>2];var namelen=HEAP32[message+4>>2];if(name){var info=readSockaddr(name,namelen);if(info.errno)return-info.errno;port=info.port;addr=DNS.lookup_addr(info.addr)||info.addr}var total=0;for(var i=0;i>2]}var view=new Uint8Array(total);var offset=0;for(var i=0;i>2];var iovlen=HEAP32[iov+(8*i+4)>>2];for(var j=0;j>0]}}return sock.sock_ops.sendmsg(sock,view,0,total,addr,port)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_sendmsg"]=___syscall_sendmsg;function ___syscall_sendto(fd,message,length,flags,addr,addr_len){try{var sock=getSocketFromFD(fd);var dest=getSocketAddress(addr,addr_len,true);if(!dest){return FS.write(sock.stream,HEAP8,message,length)}return sock.sock_ops.sendmsg(sock,HEAP8,message,length,dest.addr,dest.port)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_sendto"]=___syscall_sendto;___syscall_sendto.sig="iipiipi";function ___syscall_socket(domain,type,protocol){try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_socket"]=___syscall_socket;function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_stat64"]=___syscall_stat64;___syscall_stat64.sig="ipp";function ___syscall_symlink(target,linkpath){try{target=SYSCALLS.getStr(target);linkpath=SYSCALLS.getStr(linkpath);FS.symlink(target,linkpath);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_symlink"]=___syscall_symlink;___syscall_symlink.sig="ipp";function ___syscall_symlinkat(target,newdirfd,linkpath){try{linkpath=SYSCALLS.calculateAt(newdirfd,linkpath);FS.symlink(target,linkpath);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_symlinkat"]=___syscall_symlinkat;function ___syscall_truncate64(path,length){try{length=bigintToI53Checked(length);if(isNaN(length))return-61;path=SYSCALLS.getStr(path);FS.truncate(path,length);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_truncate64"]=___syscall_truncate64;___syscall_truncate64.sig="ipj";function ___syscall_unlinkat(dirfd,path,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(flags===0){FS.unlink(path)}else if(flags===512){FS.rmdir(path)}else{abort("Invalid flags passed to unlinkat")}return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_unlinkat"]=___syscall_unlinkat;___syscall_unlinkat.sig="iipi";function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}Module["readI53FromI64"]=readI53FromI64;function ___syscall_utimensat(dirfd,path,times,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path,true);if(!times){var atime=Date.now();var mtime=atime}else{var seconds=readI53FromI64(times);var nanoseconds=HEAP32[times+8>>2];atime=seconds*1e3+nanoseconds/(1e3*1e3);times+=16;seconds=readI53FromI64(times);nanoseconds=HEAP32[times+8>>2];mtime=seconds*1e3+nanoseconds/(1e3*1e3)}FS.utime(path,atime,mtime);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_utimensat"]=___syscall_utimensat;___syscall_utimensat.sig="iippi";var ___table_base=new WebAssembly.Global({"value":"i32","mutable":false},1);Module["___table_base"]=___table_base;function __dlinit(main_dso_handle){var dso={refcount:Infinity,name:"__main__",module:Module["asm"],global:true};LDSO.loadedLibsByName[dso.name]=dso;LDSO.loadedLibsByHandle[main_dso_handle]=dso}Module["__dlinit"]=__dlinit;var ENV={};Module["ENV"]=ENV;function allocateUTF8OnStack(str){var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8Array(str,HEAP8,ret,size);return ret}Module["allocateUTF8OnStack"]=allocateUTF8OnStack;function dlSetError(msg){withStackSave(function(){var cmsg=allocateUTF8OnStack(msg);___dl_seterr(cmsg,0)})}Module["dlSetError"]=dlSetError;function dlopenInternal(handle,jsflags){var filename=UTF8ToString(handle+44);var flags=HEAP32[handle+20>>2];filename=PATH.normalize(filename);var searchpaths=[];var isValidFile=filename=>{var target=FS.findObject(filename);return target&&!target.isFolder&&!target.isDevice};if(!isValidFile(filename)){if(ENV["LD_LIBRARY_PATH"]){searchpaths=ENV["LD_LIBRARY_PATH"].split(":")}for(var ident in searchpaths){var searchfile=PATH.join2(searchpaths[ident],filename);if(isValidFile(searchfile)){filename=searchfile;break}}}var combinedFlags={global:Boolean(flags&256),nodelete:Boolean(flags&4096),loadAsync:jsflags.loadAsync,fs:jsflags.fs};if(jsflags.loadAsync){return loadDynamicLibrary(filename,combinedFlags,handle)}try{return loadDynamicLibrary(filename,combinedFlags,handle)}catch(e){dlSetError("Could not load dynamic lib: "+filename+"\n"+e);return 0}}Module["dlopenInternal"]=dlopenInternal;function __dlopen_js(handle){var jsflags={loadAsync:false,fs:FS};return dlopenInternal(handle,jsflags)}Module["__dlopen_js"]=__dlopen_js;__dlopen_js.sig="pp";function __dlsym_js(handle,symbol){symbol=UTF8ToString(symbol);var result;if(handle==0){result=resolveGlobalSymbol(symbol,true);if(!result){dlSetError('Tried to lookup unknown symbol "'+symbol+'" in dynamic lib: RTLD_DEFAULT');return 0}}else{var lib=LDSO.loadedLibsByHandle[handle];if(!lib.module.hasOwnProperty(symbol)){dlSetError('Tried to lookup unknown symbol "'+symbol+'" in dynamic lib: '+lib.name);return 0}result=lib.module[symbol]}if(typeof result=="function"){result=addFunction(result,result.sig)}return result}Module["__dlsym_js"]=__dlsym_js;__dlsym_js.sig="ppp";function __emscripten_dlopen_js(handle,onsuccess,onerror){function errorCallback(e){var filename=UTF8ToString(HEAPU32[handle+44>>2]);dlSetError("Could not load dynamic lib: "+filename+"\n"+e);callUserCallback(function(){getWasmTableEntry(onerror)(handle)})}function successCallback(){callUserCallback(function(){getWasmTableEntry(onsuccess)(handle)})}var promise=dlopenInternal(handle,{loadAsync:true});if(promise){promise.then(successCallback,errorCallback)}else{errorCallback()}}Module["__emscripten_dlopen_js"]=__emscripten_dlopen_js;__emscripten_dlopen_js.sig="vppp";function __emscripten_err(str){err(UTF8ToString(str))}Module["__emscripten_err"]=__emscripten_err;__emscripten_err.sig="vp";var nowIsMonotonic=true;Module["nowIsMonotonic"]=nowIsMonotonic;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}Module["__emscripten_get_now_is_monotonic"]=__emscripten_get_now_is_monotonic;__emscripten_get_now_is_monotonic.sig="i";function __emscripten_get_progname(str,len){stringToUTF8(thisProgram,str,len)}Module["__emscripten_get_progname"]=__emscripten_get_progname;__emscripten_get_progname.sig="vpp";function __emscripten_out(str){out(UTF8ToString(str))}Module["__emscripten_out"]=__emscripten_out;__emscripten_out.sig="vp";function __emscripten_throw_longjmp(){throw Infinity}Module["__emscripten_throw_longjmp"]=__emscripten_throw_longjmp;__emscripten_throw_longjmp.sig="v";function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday}Module["__gmtime_js"]=__gmtime_js;__gmtime_js.sig="ipp";function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}Module["__isLeapYear"]=__isLeapYear;var __MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];Module["__MONTH_DAYS_LEAP_CUMULATIVE"]=__MONTH_DAYS_LEAP_CUMULATIVE;var __MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];Module["__MONTH_DAYS_REGULAR_CUMULATIVE"]=__MONTH_DAYS_REGULAR_CUMULATIVE;function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}Module["__yday_from_date"]=__yday_from_date;function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=__yday_from_date(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}Module["__localtime_js"]=__localtime_js;__localtime_js.sig="ipp";function __mktime_js(tmPtr){var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=__yday_from_date(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getYear();return date.getTime()/1e3|0}Module["__mktime_js"]=__mktime_js;__mktime_js.sig="ip";function __mmap_js(len,prot,flags,fd,off,allocated,addr){try{var stream=SYSCALLS.getStreamFromFD(fd);var res=FS.mmap(stream,len,off,prot,flags);var ptr=res.ptr;HEAP32[allocated>>2]=res.allocated;HEAPU32[addr>>2]=ptr;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["__mmap_js"]=__mmap_js;__mmap_js.sig="ipiiippp";function __msync_js(addr,len,prot,flags,fd,offset){try{SYSCALLS.doMsync(addr,SYSCALLS.getStreamFromFD(fd),len,flags,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["__msync_js"]=__msync_js;__msync_js.sig="ippiiip";function __munmap_js(addr,len,prot,flags,fd,offset){try{var stream=SYSCALLS.getStreamFromFD(fd);if(prot&2){SYSCALLS.doMsync(addr,stream,len,flags,offset)}FS.munmap(stream)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["__munmap_js"]=__munmap_js;__munmap_js.sig="ippiiip";function __timegm_js(tmPtr){var time=Date.UTC(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var date=new Date(time);HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;return date.getTime()/1e3|0}Module["__timegm_js"]=__timegm_js;__timegm_js.sig="ip";function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}Module["allocateUTF8"]=allocateUTF8;function __tzset_js(timezone,daylight,tzname){var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}Module["__tzset_js"]=__tzset_js;__tzset_js.sig="vppp";function _abort(){abort("")}Module["_abort"]=_abort;_abort.sig="v";var AL={QUEUE_INTERVAL:25,QUEUE_LOOKAHEAD:.1,DEVICE_NAME:"Emscripten OpenAL",CAPTURE_DEVICE_NAME:"Emscripten OpenAL capture",ALC_EXTENSIONS:{ALC_SOFT_pause_device:true,ALC_SOFT_HRTF:true},AL_EXTENSIONS:{AL_EXT_float32:true,AL_SOFT_loop_points:true,AL_SOFT_source_length:true,AL_EXT_source_distance_model:true,AL_SOFT_source_spatialize:true},_alcErr:0,alcErr:0,deviceRefCounts:{},alcStringCache:{},paused:false,stringCache:{},contexts:{},currentCtx:null,buffers:{0:{id:0,refCount:0,audioBuf:null,frequency:0,bytesPerSample:2,channels:1,length:0}},paramArray:[],_nextId:1,newId:function(){return AL.freeIds.length>0?AL.freeIds.pop():AL._nextId++},freeIds:[],scheduleContextAudio:function(ctx){if(Browser.mainLoop.timingMode===1&&document["visibilityState"]!="visible"){return}for(var i in ctx.sources){AL.scheduleSourceAudio(ctx.sources[i])}},scheduleSourceAudio:function(src,lookahead){if(Browser.mainLoop.timingMode===1&&document["visibilityState"]!="visible"){return}if(src.state!==4114){return}var currentTime=AL.updateSourceTime(src);var startTime=src.bufStartTime;var startOffset=src.bufOffset;var bufCursor=src.bufsProcessed;for(var i=0;i=src.bufQueue.length){if(src.looping){bufCursor%=src.bufQueue.length}else{break}}var buf=src.bufQueue[bufCursor%src.bufQueue.length];if(buf.length===0){skipCount++;if(skipCount===src.bufQueue.length){break}}else{var audioSrc=src.context.audioCtx.createBufferSource();audioSrc.buffer=buf.audioBuf;audioSrc.playbackRate.value=src.playbackRate;if(buf.audioBuf._loopStart||buf.audioBuf._loopEnd){audioSrc.loopStart=buf.audioBuf._loopStart;audioSrc.loopEnd=buf.audioBuf._loopEnd}var duration=0;if(src.type===4136&&src.looping){duration=Number.POSITIVE_INFINITY;audioSrc.loop=true;if(buf.audioBuf._loopStart){audioSrc.loopStart=buf.audioBuf._loopStart}if(buf.audioBuf._loopEnd){audioSrc.loopEnd=buf.audioBuf._loopEnd}}else{duration=(buf.audioBuf.duration-startOffset)/src.playbackRate}audioSrc._startOffset=startOffset;audioSrc._duration=duration;audioSrc._skipCount=skipCount;skipCount=0;audioSrc.connect(src.gain);if(typeof audioSrc.start!="undefined"){startTime=Math.max(startTime,src.context.audioCtx.currentTime);audioSrc.start(startTime,startOffset)}else if(typeof audioSrc.noteOn!="undefined"){startTime=Math.max(startTime,src.context.audioCtx.currentTime);audioSrc.noteOn(startTime)}audioSrc._startTime=startTime;src.audioQueue.push(audioSrc);startTime+=duration}startOffset=0;bufCursor++}},updateSourceTime:function(src){var currentTime=src.context.audioCtx.currentTime;if(src.state!==4114){return currentTime}if(!isFinite(src.bufStartTime)){src.bufStartTime=currentTime-src.bufOffset/src.playbackRate;src.bufOffset=0}var nextStartTime=0;while(src.audioQueue.length){var audioSrc=src.audioQueue[0];src.bufsProcessed+=audioSrc._skipCount;nextStartTime=audioSrc._startTime+audioSrc._duration;if(currentTime=src.bufQueue.length&&!src.looping){AL.setSourceState(src,4116)}else if(src.type===4136&&src.looping){var buf=src.bufQueue[0];if(buf.length===0){src.bufOffset=0}else{var delta=(currentTime-src.bufStartTime)*src.playbackRate;var loopStart=buf.audioBuf._loopStart||0;var loopEnd=buf.audioBuf._loopEnd||buf.audioBuf.duration;if(loopEnd<=loopStart){loopEnd=buf.audioBuf.duration}if(delta0){src.bufStartTime+=Math.floor((currentTime-src.bufStartTime)/srcDuration)*srcDuration}}for(var i=0;i=src.bufQueue.length){if(src.looping){src.bufsProcessed%=src.bufQueue.length}else{AL.setSourceState(src,4116);break}}var buf=src.bufQueue[src.bufsProcessed];if(buf.length>0){nextStartTime=src.bufStartTime+buf.audioBuf.duration/src.playbackRate;if(currentTime1){src.audioQueue.length=1}},stopSourceAudio:function(src){for(var i=0;isrc.bufQueue[src.bufsProcessed].audioBuf.duration){offset-=src.bufQueue[src.bufsProcessed].audiobuf.duration;src.bufsProcessed++}src.bufOffset=offset}if(playing){AL.setSourceState(src,4114)}},getGlobalParam:function(funcname,param){if(!AL.currentCtx){return null}switch(param){case 49152:return AL.currentCtx.dopplerFactor;case 49155:return AL.currentCtx.speedOfSound;case 53248:return AL.currentCtx.distanceModel;default:AL.currentCtx.err=40962;return null}},setGlobalParam:function(funcname,param,value){if(!AL.currentCtx){return}switch(param){case 49152:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}AL.currentCtx.dopplerFactor=value;AL.updateListenerSpace(AL.currentCtx);break;case 49155:if(!Number.isFinite(value)||value<=0){AL.currentCtx.err=40963;return}AL.currentCtx.speedOfSound=value;AL.updateListenerSpace(AL.currentCtx);break;case 53248:switch(value){case 0:case 53249:case 53250:case 53251:case 53252:case 53253:case 53254:AL.currentCtx.distanceModel=value;AL.updateContextGlobal(AL.currentCtx);break;default:AL.currentCtx.err=40963;return}break;default:AL.currentCtx.err=40962;return}},getListenerParam:function(funcname,param){if(!AL.currentCtx){return null}switch(param){case 4100:return AL.currentCtx.listener.position;case 4102:return AL.currentCtx.listener.velocity;case 4111:return AL.currentCtx.listener.direction.concat(AL.currentCtx.listener.up);case 4106:return AL.currentCtx.gain.gain.value;default:AL.currentCtx.err=40962;return null}},setListenerParam:function(funcname,param,value){if(!AL.currentCtx){return}if(value===null){AL.currentCtx.err=40962;return}var listener=AL.currentCtx.listener;switch(param){case 4100:if(!Number.isFinite(value[0])||!Number.isFinite(value[1])||!Number.isFinite(value[2])){AL.currentCtx.err=40963;return}listener.position[0]=value[0];listener.position[1]=value[1];listener.position[2]=value[2];AL.updateListenerSpace(AL.currentCtx);break;case 4102:if(!Number.isFinite(value[0])||!Number.isFinite(value[1])||!Number.isFinite(value[2])){AL.currentCtx.err=40963;return}listener.velocity[0]=value[0];listener.velocity[1]=value[1];listener.velocity[2]=value[2];AL.updateListenerSpace(AL.currentCtx);break;case 4106:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}AL.currentCtx.gain.gain.value=value;break;case 4111:if(!Number.isFinite(value[0])||!Number.isFinite(value[1])||!Number.isFinite(value[2])||!Number.isFinite(value[3])||!Number.isFinite(value[4])||!Number.isFinite(value[5])){AL.currentCtx.err=40963;return}listener.direction[0]=value[0];listener.direction[1]=value[1];listener.direction[2]=value[2];listener.up[0]=value[3];listener.up[1]=value[4];listener.up[2]=value[5];AL.updateListenerSpace(AL.currentCtx);break;default:AL.currentCtx.err=40962;return}},getBufferParam:function(funcname,bufferId,param){if(!AL.currentCtx){return}var buf=AL.buffers[bufferId];if(!buf||bufferId===0){AL.currentCtx.err=40961;return}switch(param){case 8193:return buf.frequency;case 8194:return buf.bytesPerSample*8;case 8195:return buf.channels;case 8196:return buf.length*buf.bytesPerSample*buf.channels;case 8213:if(buf.length===0){return[0,0]}return[(buf.audioBuf._loopStart||0)*buf.frequency,(buf.audioBuf._loopEnd||buf.length)*buf.frequency];default:AL.currentCtx.err=40962;return null}},setBufferParam:function(funcname,bufferId,param,value){if(!AL.currentCtx){return}var buf=AL.buffers[bufferId];if(!buf||bufferId===0){AL.currentCtx.err=40961;return}if(value===null){AL.currentCtx.err=40962;return}switch(param){case 8196:if(value!==0){AL.currentCtx.err=40963;return}break;case 8213:if(value[0]<0||value[0]>buf.length||value[1]<0||value[1]>buf.Length||value[0]>=value[1]){AL.currentCtx.err=40963;return}if(buf.refCount>0){AL.currentCtx.err=40964;return}if(buf.audioBuf){buf.audioBuf._loopStart=value[0]/buf.frequency;buf.audioBuf._loopEnd=value[1]/buf.frequency}break;default:AL.currentCtx.err=40962;return}},getSourceParam:function(funcname,sourceId,param){if(!AL.currentCtx){return null}var src=AL.currentCtx.sources[sourceId];if(!src){AL.currentCtx.err=40961;return null}switch(param){case 514:return src.relative;case 4097:return src.coneInnerAngle;case 4098:return src.coneOuterAngle;case 4099:return src.pitch;case 4100:return src.position;case 4101:return src.direction;case 4102:return src.velocity;case 4103:return src.looping;case 4105:if(src.type===4136){return src.bufQueue[0].id}return 0;case 4106:return src.gain.gain.value;case 4109:return src.minGain;case 4110:return src.maxGain;case 4112:return src.state;case 4117:if(src.bufQueue.length===1&&src.bufQueue[0].id===0){return 0}return src.bufQueue.length;case 4118:if(src.bufQueue.length===1&&src.bufQueue[0].id===0||src.looping){return 0}return src.bufsProcessed;case 4128:return src.refDistance;case 4129:return src.rolloffFactor;case 4130:return src.coneOuterGain;case 4131:return src.maxDistance;case 4132:return AL.sourceTell(src);case 4133:var offset=AL.sourceTell(src);if(offset>0){offset*=src.bufQueue[0].frequency}return offset;case 4134:var offset=AL.sourceTell(src);if(offset>0){offset*=src.bufQueue[0].frequency*src.bufQueue[0].bytesPerSample}return offset;case 4135:return src.type;case 4628:return src.spatialize;case 8201:var length=0;var bytesPerFrame=0;for(var i=0;i0){var audioSrc=src.audioQueue[0];audioSrc.loop=true;audioSrc._duration=Number.POSITIVE_INFINITY}}else if(value===0){src.looping=false;var currentTime=AL.updateSourceTime(src);if(src.type===4136&&src.audioQueue.length>0){var audioSrc=src.audioQueue[0];audioSrc.loop=false;audioSrc._duration=src.bufQueue[0].audioBuf.duration/src.playbackRate;audioSrc._startTime=currentTime-src.bufOffset/src.playbackRate}}else{AL.currentCtx.err=40963;return}break;case 4105:if(src.state===4114||src.state===4115){AL.currentCtx.err=40964;return}if(value===0){for(var i in src.bufQueue){src.bufQueue[i].refCount--}src.bufQueue.length=1;src.bufQueue[0]=AL.buffers[0];src.bufsProcessed=0;src.type=4144}else{var buf=AL.buffers[value];if(!buf){AL.currentCtx.err=40963;return}for(var i in src.bufQueue){src.bufQueue[i].refCount--}src.bufQueue.length=0;buf.refCount++;src.bufQueue=[buf];src.bufsProcessed=0;src.type=4136}AL.initSourcePanner(src);AL.scheduleSourceAudio(src);break;case 4106:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}src.gain.gain.value=value;break;case 4109:if(!Number.isFinite(value)||value<0||value>Math.min(src.maxGain,1)){AL.currentCtx.err=40963;return}src.minGain=value;break;case 4110:if(!Number.isFinite(value)||value1){AL.currentCtx.err=40963;return}src.maxGain=value;break;case 4128:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}src.refDistance=value;if(src.panner){src.panner.refDistance=value}break;case 4129:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}src.rolloffFactor=value;if(src.panner){src.panner.rolloffFactor=value}break;case 4130:if(!Number.isFinite(value)||value<0||value>1){AL.currentCtx.err=40963;return}src.coneOuterGain=value;if(src.panner){src.panner.coneOuterGain=value}break;case 4131:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}src.maxDistance=value;if(src.panner){src.panner.maxDistance=value}break;case 4132:if(value<0||value>AL.sourceDuration(src)){AL.currentCtx.err=40963;return}AL.sourceSeek(src,value);break;case 4133:var srcLen=AL.sourceDuration(src);if(srcLen>0){var frequency;for(var bufId in src.bufQueue){if(bufId){frequency=src.bufQueue[bufId].frequency;break}}value/=frequency}if(value<0||value>srcLen){AL.currentCtx.err=40963;return}AL.sourceSeek(src,value);break;case 4134:var srcLen=AL.sourceDuration(src);if(srcLen>0){var bytesPerSec;for(var bufId in src.bufQueue){if(bufId){var buf=src.bufQueue[bufId];bytesPerSec=buf.frequency*buf.bytesPerSample*buf.channels;break}}value/=bytesPerSec}if(value<0||value>srcLen){AL.currentCtx.err=40963;return}AL.sourceSeek(src,value);break;case 4628:if(value!==0&&value!==1&&value!==2){AL.currentCtx.err=40963;return}src.spatialize=value;AL.initSourcePanner(src);break;case 8201:case 8202:case 8203:AL.currentCtx.err=40964;break;case 53248:switch(value){case 0:case 53249:case 53250:case 53251:case 53252:case 53253:case 53254:src.distanceModel=value;if(AL.currentCtx.sourceDistanceModel){AL.updateContextGlobal(AL.currentCtx)}break;default:AL.currentCtx.err=40963;return}break;default:AL.currentCtx.err=40962;return}},captures:{},sharedCaptureAudioCtx:null,requireValidCaptureDevice:function(deviceId,funcname){if(deviceId===0){AL.alcErr=40961;return null}var c=AL.captures[deviceId];if(!c){AL.alcErr=40961;return null}var err=c.mediaStreamError;if(err){AL.alcErr=40961;return null}return c}};Module["AL"]=AL;function _alBuffer3f(bufferId,param,value0,value1,value2){AL.setBufferParam("alBuffer3f",bufferId,param,null)}Module["_alBuffer3f"]=_alBuffer3f;_alBuffer3f.sig="viifff";function _alBuffer3i(bufferId,param,value0,value1,value2){AL.setBufferParam("alBuffer3i",bufferId,param,null)}Module["_alBuffer3i"]=_alBuffer3i;_alBuffer3i.sig="viiiii";function _alBufferData(bufferId,format,pData,size,freq){if(!AL.currentCtx){return}var buf=AL.buffers[bufferId];if(!buf){AL.currentCtx.err=40963;return}if(freq<=0){AL.currentCtx.err=40963;return}var audioBuf=null;try{switch(format){case 4352:if(size>0){audioBuf=AL.currentCtx.audioCtx.createBuffer(1,size,freq);var channel0=audioBuf.getChannelData(0);for(var i=0;i0){audioBuf=AL.currentCtx.audioCtx.createBuffer(1,size>>1,freq);var channel0=audioBuf.getChannelData(0);pData>>=1;for(var i=0;i>1;++i){channel0[i]=HEAP16[pData++]*30517578125e-15}}buf.bytesPerSample=2;buf.channels=1;buf.length=size>>1;break;case 4354:if(size>0){audioBuf=AL.currentCtx.audioCtx.createBuffer(2,size>>1,freq);var channel0=audioBuf.getChannelData(0);var channel1=audioBuf.getChannelData(1);for(var i=0;i>1;++i){channel0[i]=HEAPU8[pData++]*.0078125-1;channel1[i]=HEAPU8[pData++]*.0078125-1}}buf.bytesPerSample=1;buf.channels=2;buf.length=size>>1;break;case 4355:if(size>0){audioBuf=AL.currentCtx.audioCtx.createBuffer(2,size>>2,freq);var channel0=audioBuf.getChannelData(0);var channel1=audioBuf.getChannelData(1);pData>>=1;for(var i=0;i>2;++i){channel0[i]=HEAP16[pData++]*30517578125e-15;channel1[i]=HEAP16[pData++]*30517578125e-15}}buf.bytesPerSample=2;buf.channels=2;buf.length=size>>2;break;case 65552:if(size>0){audioBuf=AL.currentCtx.audioCtx.createBuffer(1,size>>2,freq);var channel0=audioBuf.getChannelData(0);pData>>=2;for(var i=0;i>2;++i){channel0[i]=HEAPF32[pData++]}}buf.bytesPerSample=4;buf.channels=1;buf.length=size>>2;break;case 65553:if(size>0){audioBuf=AL.currentCtx.audioCtx.createBuffer(2,size>>3,freq);var channel0=audioBuf.getChannelData(0);var channel1=audioBuf.getChannelData(1);pData>>=2;for(var i=0;i>3;++i){channel0[i]=HEAPF32[pData++];channel1[i]=HEAPF32[pData++]}}buf.bytesPerSample=4;buf.channels=2;buf.length=size>>3;break;default:AL.currentCtx.err=40963;return}buf.frequency=freq;buf.audioBuf=audioBuf}catch(e){AL.currentCtx.err=40963;return}}Module["_alBufferData"]=_alBufferData;_alBufferData.sig="viiiii";function _alBufferf(bufferId,param,value){AL.setBufferParam("alBufferf",bufferId,param,null)}Module["_alBufferf"]=_alBufferf;_alBufferf.sig="viif";function _alBufferfv(bufferId,param,pValues){if(!AL.currentCtx){return}if(!pValues){AL.currentCtx.err=40963;return}AL.setBufferParam("alBufferfv",bufferId,param,null)}Module["_alBufferfv"]=_alBufferfv;_alBufferfv.sig="viii";function _alBufferi(bufferId,param,value){AL.setBufferParam("alBufferi",bufferId,param,null)}Module["_alBufferi"]=_alBufferi;_alBufferi.sig="viii";function _alBufferiv(bufferId,param,pValues){if(!AL.currentCtx){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 8213:AL.paramArray[0]=HEAP32[pValues>>2];AL.paramArray[1]=HEAP32[pValues+4>>2];AL.setBufferParam("alBufferiv",bufferId,param,AL.paramArray);break;default:AL.setBufferParam("alBufferiv",bufferId,param,null);break}}Module["_alBufferiv"]=_alBufferiv;_alBufferiv.sig="viii";function _alDeleteBuffers(count,pBufferIds){if(!AL.currentCtx){return}for(var i=0;i>2];if(bufId===0){continue}if(!AL.buffers[bufId]){AL.currentCtx.err=40961;return}if(AL.buffers[bufId].refCount){AL.currentCtx.err=40964;return}}for(var i=0;i>2];if(bufId===0){continue}AL.deviceRefCounts[AL.buffers[bufId].deviceId]--;delete AL.buffers[bufId];AL.freeIds.push(bufId)}}Module["_alDeleteBuffers"]=_alDeleteBuffers;_alDeleteBuffers.sig="vii";function _alSourcei(sourceId,param,value){switch(param){case 514:case 4097:case 4098:case 4103:case 4105:case 4128:case 4129:case 4131:case 4132:case 4133:case 4134:case 4628:case 8201:case 8202:case 53248:AL.setSourceParam("alSourcei",sourceId,param,value);break;default:AL.setSourceParam("alSourcei",sourceId,param,null);break}}Module["_alSourcei"]=_alSourcei;_alSourcei.sig="viii";function _alDeleteSources(count,pSourceIds){if(!AL.currentCtx){return}for(var i=0;i>2];if(!AL.currentCtx.sources[srcId]){AL.currentCtx.err=40961;return}}for(var i=0;i>2];AL.setSourceState(AL.currentCtx.sources[srcId],4116);_alSourcei(srcId,4105,0);delete AL.currentCtx.sources[srcId];AL.freeIds.push(srcId)}}Module["_alDeleteSources"]=_alDeleteSources;_alDeleteSources.sig="vii";function _alDisable(param){if(!AL.currentCtx){return}switch(param){case"AL_SOURCE_DISTANCE_MODEL":AL.currentCtx.sourceDistanceModel=false;AL.updateContextGlobal(AL.currentCtx);break;default:AL.currentCtx.err=40962;return}}Module["_alDisable"]=_alDisable;_alDisable.sig="vi";function _alDistanceModel(model){AL.setGlobalParam("alDistanceModel",53248,model)}Module["_alDistanceModel"]=_alDistanceModel;_alDistanceModel.sig="vi";function _alDopplerFactor(value){AL.setGlobalParam("alDopplerFactor",49152,value)}Module["_alDopplerFactor"]=_alDopplerFactor;_alDopplerFactor.sig="vi";function _alDopplerVelocity(value){warnOnce("alDopplerVelocity() is deprecated, and only kept for compatibility with OpenAL 1.0. Use alSpeedOfSound() instead.");if(!AL.currentCtx){return}if(value<=0){AL.currentCtx.err=40963;return}}Module["_alDopplerVelocity"]=_alDopplerVelocity;_alDopplerVelocity.sig="vi";function _alEnable(param){if(!AL.currentCtx){return}switch(param){case"AL_SOURCE_DISTANCE_MODEL":AL.currentCtx.sourceDistanceModel=true;AL.updateContextGlobal(AL.currentCtx);break;default:AL.currentCtx.err=40962;return}}Module["_alEnable"]=_alEnable;_alEnable.sig="vi";function _alGenBuffers(count,pBufferIds){if(!AL.currentCtx){return}for(var i=0;i>2]=buf.id}}Module["_alGenBuffers"]=_alGenBuffers;_alGenBuffers.sig="vii";function _alGenSources(count,pSourceIds){if(!AL.currentCtx){return}for(var i=0;i>2]=src.id}}Module["_alGenSources"]=_alGenSources;_alGenSources.sig="vii";function _alGetBoolean(param){var val=AL.getGlobalParam("alGetBoolean",param);if(val===null){return 0}switch(param){case 49152:case 49155:case 53248:return val!==0?1:0;default:AL.currentCtx.err=40962;return 0}}Module["_alGetBoolean"]=_alGetBoolean;_alGetBoolean.sig="ii";function _alGetBooleanv(param,pValues){var val=AL.getGlobalParam("alGetBooleanv",param);if(val===null||!pValues){return}switch(param){case 49152:case 49155:case 53248:HEAP8[pValues>>0]=val;break;default:AL.currentCtx.err=40962;return}}Module["_alGetBooleanv"]=_alGetBooleanv;_alGetBooleanv.sig="vii";function _alGetBuffer3f(bufferId,param,pValue0,pValue1,pValue2){var val=AL.getBufferParam("alGetBuffer3f",bufferId,param);if(val===null){return}if(!pValue0||!pValue1||!pValue2){AL.currentCtx.err=40963;return}AL.currentCtx.err=40962}Module["_alGetBuffer3f"]=_alGetBuffer3f;_alGetBuffer3f.sig="viiiii";function _alGetBuffer3i(bufferId,param,pValue0,pValue1,pValue2){var val=AL.getBufferParam("alGetBuffer3i",bufferId,param);if(val===null){return}if(!pValue0||!pValue1||!pValue2){AL.currentCtx.err=40963;return}AL.currentCtx.err=40962}Module["_alGetBuffer3i"]=_alGetBuffer3i;_alGetBuffer3i.sig="viiiii";function _alGetBufferf(bufferId,param,pValue){var val=AL.getBufferParam("alGetBufferf",bufferId,param);if(val===null){return}if(!pValue){AL.currentCtx.err=40963;return}AL.currentCtx.err=40962}Module["_alGetBufferf"]=_alGetBufferf;_alGetBufferf.sig="viii";function _alGetBufferfv(bufferId,param,pValues){var val=AL.getBufferParam("alGetBufferfv",bufferId,param);if(val===null){return}if(!pValues){AL.currentCtx.err=40963;return}AL.currentCtx.err=40962}Module["_alGetBufferfv"]=_alGetBufferfv;_alGetBufferfv.sig="viii";function _alGetBufferi(bufferId,param,pValue){var val=AL.getBufferParam("alGetBufferi",bufferId,param);if(val===null){return}if(!pValue){AL.currentCtx.err=40963;return}switch(param){case 8193:case 8194:case 8195:case 8196:HEAP32[pValue>>2]=val;break;default:AL.currentCtx.err=40962;return}}Module["_alGetBufferi"]=_alGetBufferi;_alGetBufferi.sig="viii";function _alGetBufferiv(bufferId,param,pValues){var val=AL.getBufferParam("alGetBufferiv",bufferId,param);if(val===null){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 8193:case 8194:case 8195:case 8196:HEAP32[pValues>>2]=val;break;case 8213:HEAP32[pValues>>2]=val[0];HEAP32[pValues+4>>2]=val[1];break;default:AL.currentCtx.err=40962;return}}Module["_alGetBufferiv"]=_alGetBufferiv;_alGetBufferiv.sig="viii";function _alGetDouble(param){var val=AL.getGlobalParam("alGetDouble",param);if(val===null){return 0}switch(param){case 49152:case 49155:case 53248:return val;default:AL.currentCtx.err=40962;return 0}}Module["_alGetDouble"]=_alGetDouble;_alGetDouble.sig="di";function _alGetDoublev(param,pValues){var val=AL.getGlobalParam("alGetDoublev",param);if(val===null||!pValues){return}switch(param){case 49152:case 49155:case 53248:HEAPF64[pValues>>3]=val;break;default:AL.currentCtx.err=40962;return}}Module["_alGetDoublev"]=_alGetDoublev;_alGetDoublev.sig="vii";function _alGetEnumValue(pEnumName){if(!AL.currentCtx){return 0}if(!pEnumName){AL.currentCtx.err=40963;return 0}var name=UTF8ToString(pEnumName);switch(name){case"AL_BITS":return 8194;case"AL_BUFFER":return 4105;case"AL_BUFFERS_PROCESSED":return 4118;case"AL_BUFFERS_QUEUED":return 4117;case"AL_BYTE_OFFSET":return 4134;case"AL_CHANNELS":return 8195;case"AL_CONE_INNER_ANGLE":return 4097;case"AL_CONE_OUTER_ANGLE":return 4098;case"AL_CONE_OUTER_GAIN":return 4130;case"AL_DIRECTION":return 4101;case"AL_DISTANCE_MODEL":return 53248;case"AL_DOPPLER_FACTOR":return 49152;case"AL_DOPPLER_VELOCITY":return 49153;case"AL_EXPONENT_DISTANCE":return 53253;case"AL_EXPONENT_DISTANCE_CLAMPED":return 53254;case"AL_EXTENSIONS":return 45060;case"AL_FORMAT_MONO16":return 4353;case"AL_FORMAT_MONO8":return 4352;case"AL_FORMAT_STEREO16":return 4355;case"AL_FORMAT_STEREO8":return 4354;case"AL_FREQUENCY":return 8193;case"AL_GAIN":return 4106;case"AL_INITIAL":return 4113;case"AL_INVALID":return-1;case"AL_ILLEGAL_ENUM":case"AL_INVALID_ENUM":return 40962;case"AL_INVALID_NAME":return 40961;case"AL_ILLEGAL_COMMAND":case"AL_INVALID_OPERATION":return 40964;case"AL_INVALID_VALUE":return 40963;case"AL_INVERSE_DISTANCE":return 53249;case"AL_INVERSE_DISTANCE_CLAMPED":return 53250;case"AL_LINEAR_DISTANCE":return 53251;case"AL_LINEAR_DISTANCE_CLAMPED":return 53252;case"AL_LOOPING":return 4103;case"AL_MAX_DISTANCE":return 4131;case"AL_MAX_GAIN":return 4110;case"AL_MIN_GAIN":return 4109;case"AL_NONE":return 0;case"AL_NO_ERROR":return 0;case"AL_ORIENTATION":return 4111;case"AL_OUT_OF_MEMORY":return 40965;case"AL_PAUSED":return 4115;case"AL_PENDING":return 8209;case"AL_PITCH":return 4099;case"AL_PLAYING":return 4114;case"AL_POSITION":return 4100;case"AL_PROCESSED":return 8210;case"AL_REFERENCE_DISTANCE":return 4128;case"AL_RENDERER":return 45059;case"AL_ROLLOFF_FACTOR":return 4129;case"AL_SAMPLE_OFFSET":return 4133;case"AL_SEC_OFFSET":return 4132;case"AL_SIZE":return 8196;case"AL_SOURCE_RELATIVE":return 514;case"AL_SOURCE_STATE":return 4112;case"AL_SOURCE_TYPE":return 4135;case"AL_SPEED_OF_SOUND":return 49155;case"AL_STATIC":return 4136;case"AL_STOPPED":return 4116;case"AL_STREAMING":return 4137;case"AL_UNDETERMINED":return 4144;case"AL_UNUSED":return 8208;case"AL_VELOCITY":return 4102;case"AL_VENDOR":return 45057;case"AL_VERSION":return 45058;case"AL_AUTO_SOFT":return 2;case"AL_SOURCE_DISTANCE_MODEL":return 512;case"AL_SOURCE_SPATIALIZE_SOFT":return 4628;case"AL_LOOP_POINTS_SOFT":return 8213;case"AL_BYTE_LENGTH_SOFT":return 8201;case"AL_SAMPLE_LENGTH_SOFT":return 8202;case"AL_SEC_LENGTH_SOFT":return 8203;case"AL_FORMAT_MONO_FLOAT32":return 65552;case"AL_FORMAT_STEREO_FLOAT32":return 65553;default:AL.currentCtx.err=40963;return 0}}Module["_alGetEnumValue"]=_alGetEnumValue;_alGetEnumValue.sig="ii";function _alGetError(){if(!AL.currentCtx){return 40964}var err=AL.currentCtx.err;AL.currentCtx.err=0;return err}Module["_alGetError"]=_alGetError;_alGetError.sig="i";function _alGetFloat(param){var val=AL.getGlobalParam("alGetFloat",param);if(val===null){return 0}switch(param){case 49152:case 49155:case 53248:return val;default:return 0}}Module["_alGetFloat"]=_alGetFloat;_alGetFloat.sig="fi";function _alGetFloatv(param,pValues){var val=AL.getGlobalParam("alGetFloatv",param);if(val===null||!pValues){return}switch(param){case 49152:case 49155:case 53248:HEAPF32[pValues>>2]=val;break;default:AL.currentCtx.err=40962;return}}Module["_alGetFloatv"]=_alGetFloatv;_alGetFloatv.sig="vii";function _alGetInteger(param){var val=AL.getGlobalParam("alGetInteger",param);if(val===null){return 0}switch(param){case 49152:case 49155:case 53248:return val;default:AL.currentCtx.err=40962;return 0}}Module["_alGetInteger"]=_alGetInteger;_alGetInteger.sig="ii";function _alGetIntegerv(param,pValues){var val=AL.getGlobalParam("alGetIntegerv",param);if(val===null||!pValues){return}switch(param){case 49152:case 49155:case 53248:HEAP32[pValues>>2]=val;break;default:AL.currentCtx.err=40962;return}}Module["_alGetIntegerv"]=_alGetIntegerv;_alGetIntegerv.sig="vii";function _alGetListener3f(param,pValue0,pValue1,pValue2){var val=AL.getListenerParam("alGetListener3f",param);if(val===null){return}if(!pValue0||!pValue1||!pValue2){AL.currentCtx.err=40963;return}switch(param){case 4100:case 4102:HEAPF32[pValue0>>2]=val[0];HEAPF32[pValue1>>2]=val[1];HEAPF32[pValue2>>2]=val[2];break;default:AL.currentCtx.err=40962;return}}Module["_alGetListener3f"]=_alGetListener3f;_alGetListener3f.sig="viiii";function _alGetListener3i(param,pValue0,pValue1,pValue2){var val=AL.getListenerParam("alGetListener3i",param);if(val===null){return}if(!pValue0||!pValue1||!pValue2){AL.currentCtx.err=40963;return}switch(param){case 4100:case 4102:HEAP32[pValue0>>2]=val[0];HEAP32[pValue1>>2]=val[1];HEAP32[pValue2>>2]=val[2];break;default:AL.currentCtx.err=40962;return}}Module["_alGetListener3i"]=_alGetListener3i;_alGetListener3i.sig="viiii";function _alGetListenerf(param,pValue){var val=AL.getListenerParam("alGetListenerf",param);if(val===null){return}if(!pValue){AL.currentCtx.err=40963;return}switch(param){case 4106:HEAPF32[pValue>>2]=val;break;default:AL.currentCtx.err=40962;return}}Module["_alGetListenerf"]=_alGetListenerf;_alGetListenerf.sig="vii";function _alGetListenerfv(param,pValues){var val=AL.getListenerParam("alGetListenerfv",param);if(val===null){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 4100:case 4102:HEAPF32[pValues>>2]=val[0];HEAPF32[pValues+4>>2]=val[1];HEAPF32[pValues+8>>2]=val[2];break;case 4111:HEAPF32[pValues>>2]=val[0];HEAPF32[pValues+4>>2]=val[1];HEAPF32[pValues+8>>2]=val[2];HEAPF32[pValues+12>>2]=val[3];HEAPF32[pValues+16>>2]=val[4];HEAPF32[pValues+20>>2]=val[5];break;default:AL.currentCtx.err=40962;return}}Module["_alGetListenerfv"]=_alGetListenerfv;_alGetListenerfv.sig="vii";function _alGetListeneri(param,pValue){var val=AL.getListenerParam("alGetListeneri",param);if(val===null){return}if(!pValue){AL.currentCtx.err=40963;return}AL.currentCtx.err=40962}Module["_alGetListeneri"]=_alGetListeneri;_alGetListeneri.sig="vii";function _alGetListeneriv(param,pValues){var val=AL.getListenerParam("alGetListeneriv",param);if(val===null){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 4100:case 4102:HEAP32[pValues>>2]=val[0];HEAP32[pValues+4>>2]=val[1];HEAP32[pValues+8>>2]=val[2];break;case 4111:HEAP32[pValues>>2]=val[0];HEAP32[pValues+4>>2]=val[1];HEAP32[pValues+8>>2]=val[2];HEAP32[pValues+12>>2]=val[3];HEAP32[pValues+16>>2]=val[4];HEAP32[pValues+20>>2]=val[5];break;default:AL.currentCtx.err=40962;return}}Module["_alGetListeneriv"]=_alGetListeneriv;_alGetListeneriv.sig="vii";function _alGetSource3f(sourceId,param,pValue0,pValue1,pValue2){var val=AL.getSourceParam("alGetSource3f",sourceId,param);if(val===null){return}if(!pValue0||!pValue1||!pValue2){AL.currentCtx.err=40963;return}switch(param){case 4100:case 4101:case 4102:HEAPF32[pValue0>>2]=val[0];HEAPF32[pValue1>>2]=val[1];HEAPF32[pValue2>>2]=val[2];break;default:AL.currentCtx.err=40962;return}}Module["_alGetSource3f"]=_alGetSource3f;_alGetSource3f.sig="viiiii";function _alGetSource3i(sourceId,param,pValue0,pValue1,pValue2){var val=AL.getSourceParam("alGetSource3i",sourceId,param);if(val===null){return}if(!pValue0||!pValue1||!pValue2){AL.currentCtx.err=40963;return}switch(param){case 4100:case 4101:case 4102:HEAP32[pValue0>>2]=val[0];HEAP32[pValue1>>2]=val[1];HEAP32[pValue2>>2]=val[2];break;default:AL.currentCtx.err=40962;return}}Module["_alGetSource3i"]=_alGetSource3i;_alGetSource3i.sig="viiiii";function _alGetSourcef(sourceId,param,pValue){var val=AL.getSourceParam("alGetSourcef",sourceId,param);if(val===null){return}if(!pValue){AL.currentCtx.err=40963;return}switch(param){case 4097:case 4098:case 4099:case 4106:case 4109:case 4110:case 4128:case 4129:case 4130:case 4131:case 4132:case 4133:case 4134:case 8203:HEAPF32[pValue>>2]=val;break;default:AL.currentCtx.err=40962;return}}Module["_alGetSourcef"]=_alGetSourcef;_alGetSourcef.sig="viii";function _alGetSourcefv(sourceId,param,pValues){var val=AL.getSourceParam("alGetSourcefv",sourceId,param);if(val===null){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 4097:case 4098:case 4099:case 4106:case 4109:case 4110:case 4128:case 4129:case 4130:case 4131:case 4132:case 4133:case 4134:case 8203:HEAPF32[pValues>>2]=val[0];break;case 4100:case 4101:case 4102:HEAPF32[pValues>>2]=val[0];HEAPF32[pValues+4>>2]=val[1];HEAPF32[pValues+8>>2]=val[2];break;default:AL.currentCtx.err=40962;return}}Module["_alGetSourcefv"]=_alGetSourcefv;_alGetSourcefv.sig="viii";function _alGetSourcei(sourceId,param,pValue){var val=AL.getSourceParam("alGetSourcei",sourceId,param);if(val===null){return}if(!pValue){AL.currentCtx.err=40963;return}switch(param){case 514:case 4097:case 4098:case 4103:case 4105:case 4112:case 4117:case 4118:case 4128:case 4129:case 4131:case 4132:case 4133:case 4134:case 4135:case 4628:case 8201:case 8202:case 53248:HEAP32[pValue>>2]=val;break;default:AL.currentCtx.err=40962;return}}Module["_alGetSourcei"]=_alGetSourcei;_alGetSourcei.sig="viii";function _alGetSourceiv(sourceId,param,pValues){var val=AL.getSourceParam("alGetSourceiv",sourceId,param);if(val===null){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 514:case 4097:case 4098:case 4103:case 4105:case 4112:case 4117:case 4118:case 4128:case 4129:case 4131:case 4132:case 4133:case 4134:case 4135:case 4628:case 8201:case 8202:case 53248:HEAP32[pValues>>2]=val;break;case 4100:case 4101:case 4102:HEAP32[pValues>>2]=val[0];HEAP32[pValues+4>>2]=val[1];HEAP32[pValues+8>>2]=val[2];break;default:AL.currentCtx.err=40962;return}}Module["_alGetSourceiv"]=_alGetSourceiv;_alGetSourceiv.sig="viii";function _alGetString(param){if(AL.stringCache[param]){return AL.stringCache[param]}var ret;switch(param){case 0:ret="No Error";break;case 40961:ret="Invalid Name";break;case 40962:ret="Invalid Enum";break;case 40963:ret="Invalid Value";break;case 40964:ret="Invalid Operation";break;case 40965:ret="Out of Memory";break;case 45057:ret="Emscripten";break;case 45058:ret="1.1";break;case 45059:ret="WebAudio";break;case 45060:ret="";for(var ext in AL.AL_EXTENSIONS){ret=ret.concat(ext);ret=ret.concat(" ")}ret=ret.trim();break;default:if(AL.currentCtx){AL.currentCtx.err=40962}else{}return 0}ret=allocateUTF8(ret);AL.stringCache[param]=ret;return ret}Module["_alGetString"]=_alGetString;_alGetString.sig="ii";function _alIsBuffer(bufferId){if(!AL.currentCtx){return false}if(bufferId>AL.buffers.length){return false}if(!AL.buffers[bufferId]){return false}return true}Module["_alIsBuffer"]=_alIsBuffer;_alIsBuffer.sig="ii";function _alIsEnabled(param){if(!AL.currentCtx){return 0}switch(param){case"AL_SOURCE_DISTANCE_MODEL":return AL.currentCtx.sourceDistanceModel?0:1;default:AL.currentCtx.err=40962;return 0}}Module["_alIsEnabled"]=_alIsEnabled;_alIsEnabled.sig="ii";function _alIsExtensionPresent(pExtName){var name=UTF8ToString(pExtName);return AL.AL_EXTENSIONS[name]?1:0}Module["_alIsExtensionPresent"]=_alIsExtensionPresent;_alIsExtensionPresent.sig="ii";function _alIsSource(sourceId){if(!AL.currentCtx){return false}if(!AL.currentCtx.sources[sourceId]){return false}return true}Module["_alIsSource"]=_alIsSource;_alIsSource.sig="ii";function _alListener3f(param,value0,value1,value2){switch(param){case 4100:case 4102:AL.paramArray[0]=value0;AL.paramArray[1]=value1;AL.paramArray[2]=value2;AL.setListenerParam("alListener3f",param,AL.paramArray);break;default:AL.setListenerParam("alListener3f",param,null);break}}Module["_alListener3f"]=_alListener3f;_alListener3f.sig="vifff";function _alListener3i(param,value0,value1,value2){switch(param){case 4100:case 4102:AL.paramArray[0]=value0;AL.paramArray[1]=value1;AL.paramArray[2]=value2;AL.setListenerParam("alListener3i",param,AL.paramArray);break;default:AL.setListenerParam("alListener3i",param,null);break}}Module["_alListener3i"]=_alListener3i;_alListener3i.sig="viiii";function _alListenerf(param,value){switch(param){case 4106:AL.setListenerParam("alListenerf",param,value);break;default:AL.setListenerParam("alListenerf",param,null);break}}Module["_alListenerf"]=_alListenerf;_alListenerf.sig="vif";function _alListenerfv(param,pValues){if(!AL.currentCtx){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 4100:case 4102:AL.paramArray[0]=HEAPF32[pValues>>2];AL.paramArray[1]=HEAPF32[pValues+4>>2];AL.paramArray[2]=HEAPF32[pValues+8>>2];AL.setListenerParam("alListenerfv",param,AL.paramArray);break;case 4111:AL.paramArray[0]=HEAPF32[pValues>>2];AL.paramArray[1]=HEAPF32[pValues+4>>2];AL.paramArray[2]=HEAPF32[pValues+8>>2];AL.paramArray[3]=HEAPF32[pValues+12>>2];AL.paramArray[4]=HEAPF32[pValues+16>>2];AL.paramArray[5]=HEAPF32[pValues+20>>2];AL.setListenerParam("alListenerfv",param,AL.paramArray);break;default:AL.setListenerParam("alListenerfv",param,null);break}}Module["_alListenerfv"]=_alListenerfv;_alListenerfv.sig="vii";function _alListeneri(param,value){AL.setListenerParam("alListeneri",param,null)}Module["_alListeneri"]=_alListeneri;_alListeneri.sig="vii";function _alListeneriv(param,pValues){if(!AL.currentCtx){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 4100:case 4102:AL.paramArray[0]=HEAP32[pValues>>2];AL.paramArray[1]=HEAP32[pValues+4>>2];AL.paramArray[2]=HEAP32[pValues+8>>2];AL.setListenerParam("alListeneriv",param,AL.paramArray);break;case 4111:AL.paramArray[0]=HEAP32[pValues>>2];AL.paramArray[1]=HEAP32[pValues+4>>2];AL.paramArray[2]=HEAP32[pValues+8>>2];AL.paramArray[3]=HEAP32[pValues+12>>2];AL.paramArray[4]=HEAP32[pValues+16>>2];AL.paramArray[5]=HEAP32[pValues+20>>2];AL.setListenerParam("alListeneriv",param,AL.paramArray);break;default:AL.setListenerParam("alListeneriv",param,null);break}}Module["_alListeneriv"]=_alListeneriv;_alListeneriv.sig="vii";function _alSource3f(sourceId,param,value0,value1,value2){switch(param){case 4100:case 4101:case 4102:AL.paramArray[0]=value0;AL.paramArray[1]=value1;AL.paramArray[2]=value2;AL.setSourceParam("alSource3f",sourceId,param,AL.paramArray);break;default:AL.setSourceParam("alSource3f",sourceId,param,null);break}}Module["_alSource3f"]=_alSource3f;_alSource3f.sig="viifff";function _alSource3i(sourceId,param,value0,value1,value2){switch(param){case 4100:case 4101:case 4102:AL.paramArray[0]=value0;AL.paramArray[1]=value1;AL.paramArray[2]=value2;AL.setSourceParam("alSource3i",sourceId,param,AL.paramArray);break;default:AL.setSourceParam("alSource3i",sourceId,param,null);break}}Module["_alSource3i"]=_alSource3i;_alSource3i.sig="viiiii";function _alSourcePause(sourceId){if(!AL.currentCtx){return}var src=AL.currentCtx.sources[sourceId];if(!src){AL.currentCtx.err=40961;return}AL.setSourceState(src,4115)}Module["_alSourcePause"]=_alSourcePause;_alSourcePause.sig="vi";function _alSourcePausev(count,pSourceIds){if(!AL.currentCtx){return}if(!pSourceIds){AL.currentCtx.err=40963}for(var i=0;i>2]]){AL.currentCtx.err=40961;return}}for(var i=0;i>2];AL.setSourceState(AL.currentCtx.sources[srcId],4115)}}Module["_alSourcePausev"]=_alSourcePausev;_alSourcePausev.sig="vii";function _alSourcePlay(sourceId){if(!AL.currentCtx){return}var src=AL.currentCtx.sources[sourceId];if(!src){AL.currentCtx.err=40961;return}AL.setSourceState(src,4114)}Module["_alSourcePlay"]=_alSourcePlay;_alSourcePlay.sig="vi";function _alSourcePlayv(count,pSourceIds){if(!AL.currentCtx){return}if(!pSourceIds){AL.currentCtx.err=40963}for(var i=0;i>2]]){AL.currentCtx.err=40961;return}}for(var i=0;i>2];AL.setSourceState(AL.currentCtx.sources[srcId],4114)}}Module["_alSourcePlayv"]=_alSourcePlayv;_alSourcePlayv.sig="vii";function _alSourceQueueBuffers(sourceId,count,pBufferIds){if(!AL.currentCtx){return}var src=AL.currentCtx.sources[sourceId];if(!src){AL.currentCtx.err=40961;return}if(src.type===4136){AL.currentCtx.err=40964;return}if(count===0){return}var templateBuf=AL.buffers[0];for(var i=0;i>2];var buf=AL.buffers[bufId];if(!buf){AL.currentCtx.err=40961;return}if(templateBuf.id!==0&&(buf.frequency!==templateBuf.frequency||buf.bytesPerSample!==templateBuf.bytesPerSample||buf.channels!==templateBuf.channels)){AL.currentCtx.err=40964}}if(src.bufQueue.length===1&&src.bufQueue[0].id===0){src.bufQueue.length=0}src.type=4137;for(var i=0;i>2];var buf=AL.buffers[bufId];buf.refCount++;src.bufQueue.push(buf)}if(src.looping){AL.cancelPendingSourceAudio(src)}AL.initSourcePanner(src);AL.scheduleSourceAudio(src)}Module["_alSourceQueueBuffers"]=_alSourceQueueBuffers;_alSourceQueueBuffers.sig="viii";function _alSourceRewind(sourceId){if(!AL.currentCtx){return}var src=AL.currentCtx.sources[sourceId];if(!src){AL.currentCtx.err=40961;return}AL.setSourceState(src,4116);AL.setSourceState(src,4113)}Module["_alSourceRewind"]=_alSourceRewind;_alSourceRewind.sig="vi";function _alSourceRewindv(count,pSourceIds){if(!AL.currentCtx){return}if(!pSourceIds){AL.currentCtx.err=40963}for(var i=0;i>2]]){AL.currentCtx.err=40961;return}}for(var i=0;i>2];AL.setSourceState(AL.currentCtx.sources[srcId],4113)}}Module["_alSourceRewindv"]=_alSourceRewindv;_alSourceRewindv.sig="vii";function _alSourceStop(sourceId){if(!AL.currentCtx){return}var src=AL.currentCtx.sources[sourceId];if(!src){AL.currentCtx.err=40961;return}AL.setSourceState(src,4116)}Module["_alSourceStop"]=_alSourceStop;_alSourceStop.sig="vi";function _alSourceStopv(count,pSourceIds){if(!AL.currentCtx){return}if(!pSourceIds){AL.currentCtx.err=40963}for(var i=0;i>2]]){AL.currentCtx.err=40961;return}}for(var i=0;i>2];AL.setSourceState(AL.currentCtx.sources[srcId],4116)}}Module["_alSourceStopv"]=_alSourceStopv;_alSourceStopv.sig="vii";function _alSourceUnqueueBuffers(sourceId,count,pBufferIds){if(!AL.currentCtx){return}var src=AL.currentCtx.sources[sourceId];if(!src){AL.currentCtx.err=40961;return}if(count>(src.bufQueue.length===1&&src.bufQueue[0].id===0?0:src.bufsProcessed)){AL.currentCtx.err=40963;return}if(count===0){return}for(var i=0;i>2]=buf.id;src.bufsProcessed--}if(src.bufQueue.length===0){src.bufQueue.push(AL.buffers[0])}AL.initSourcePanner(src);AL.scheduleSourceAudio(src)}Module["_alSourceUnqueueBuffers"]=_alSourceUnqueueBuffers;_alSourceUnqueueBuffers.sig="viii";function _alSourcef(sourceId,param,value){switch(param){case 4097:case 4098:case 4099:case 4106:case 4109:case 4110:case 4128:case 4129:case 4130:case 4131:case 4132:case 4133:case 4134:case 8203:AL.setSourceParam("alSourcef",sourceId,param,value);break;default:AL.setSourceParam("alSourcef",sourceId,param,null);break}}Module["_alSourcef"]=_alSourcef;_alSourcef.sig="viif";function _alSourcefv(sourceId,param,pValues){if(!AL.currentCtx){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 4097:case 4098:case 4099:case 4106:case 4109:case 4110:case 4128:case 4129:case 4130:case 4131:case 4132:case 4133:case 4134:case 8203:var val=HEAPF32[pValues>>2];AL.setSourceParam("alSourcefv",sourceId,param,val);break;case 4100:case 4101:case 4102:AL.paramArray[0]=HEAPF32[pValues>>2];AL.paramArray[1]=HEAPF32[pValues+4>>2];AL.paramArray[2]=HEAPF32[pValues+8>>2];AL.setSourceParam("alSourcefv",sourceId,param,AL.paramArray);break;default:AL.setSourceParam("alSourcefv",sourceId,param,null);break}}Module["_alSourcefv"]=_alSourcefv;_alSourcefv.sig="viii";function _alSourceiv(sourceId,param,pValues){if(!AL.currentCtx){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 514:case 4097:case 4098:case 4103:case 4105:case 4128:case 4129:case 4131:case 4132:case 4133:case 4134:case 4628:case 8201:case 8202:case 53248:var val=HEAP32[pValues>>2];AL.setSourceParam("alSourceiv",sourceId,param,val);break;case 4100:case 4101:case 4102:AL.paramArray[0]=HEAP32[pValues>>2];AL.paramArray[1]=HEAP32[pValues+4>>2];AL.paramArray[2]=HEAP32[pValues+8>>2];AL.setSourceParam("alSourceiv",sourceId,param,AL.paramArray);break;default:AL.setSourceParam("alSourceiv",sourceId,param,null);break}}Module["_alSourceiv"]=_alSourceiv;_alSourceiv.sig="viii";function _alSpeedOfSound(value){AL.setGlobalParam("alSpeedOfSound",49155,value)}Module["_alSpeedOfSound"]=_alSpeedOfSound;_alSpeedOfSound.sig="vi";function _alarm(seconds){setTimeout(function(){callUserCallback(function(){_raise(14)})},seconds*1e3)}Module["_alarm"]=_alarm;function _alcCaptureCloseDevice(deviceId){var c=AL.requireValidCaptureDevice(deviceId,"alcCaptureCloseDevice");if(!c)return false;delete AL.captures[deviceId];AL.freeIds.push(deviceId);if(c.mediaStreamSourceNode)c.mediaStreamSourceNode.disconnect();if(c.mergerNode)c.mergerNode.disconnect();if(c.splitterNode)c.splitterNode.disconnect();if(c.scriptProcessorNode)c.scriptProcessorNode.disconnect();if(c.mediaStream){c.mediaStream.getTracks().forEach(function(track){track.stop()})}delete c.buffers;c.capturedFrameCount=0;c.isCapturing=false;return true}Module["_alcCaptureCloseDevice"]=_alcCaptureCloseDevice;_alcCaptureCloseDevice.sig="ii";function listenOnce(object,event,func){object.addEventListener(event,func,{"once":true})}Module["listenOnce"]=listenOnce;function autoResumeAudioContext(ctx,elements){if(!elements){elements=[document,document.getElementById("canvas")]}["keydown","mousedown","touchstart"].forEach(function(event){elements.forEach(function(element){if(element){listenOnce(element,event,()=>{if(ctx.state==="suspended")ctx.resume()})}})})}Module["autoResumeAudioContext"]=autoResumeAudioContext;function _alcCaptureOpenDevice(pDeviceName,requestedSampleRate,format,bufferFrameCapacity){var resolvedDeviceName=AL.CAPTURE_DEVICE_NAME;if(pDeviceName!==0){resolvedDeviceName=UTF8ToString(pDeviceName);if(resolvedDeviceName!==AL.CAPTURE_DEVICE_NAME){AL.alcErr=40965;return 0}}if(bufferFrameCapacity<0){AL.alcErr=40964;return 0}navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;var has_getUserMedia=navigator.getUserMedia||navigator.mediaDevices&&navigator.mediaDevices.getUserMedia;if(!has_getUserMedia){AL.alcErr=40965;return 0}var AudioContext=window.AudioContext||window.webkitAudioContext;if(!AL.sharedCaptureAudioCtx){try{AL.sharedCaptureAudioCtx=new AudioContext}catch(e){AL.alcErr=40965;return 0}}autoResumeAudioContext(AL.sharedCaptureAudioCtx);var outputChannelCount;switch(format){case 65552:case 4353:case 4352:outputChannelCount=1;break;case 65553:case 4355:case 4354:outputChannelCount=2;break;default:AL.alcErr=40964;return 0}function newF32Array(cap){return new Float32Array(cap)}function newI16Array(cap){return new Int16Array(cap)}function newU8Array(cap){return new Uint8Array(cap)}var requestedSampleType;var newSampleArray;switch(format){case 65552:case 65553:requestedSampleType="f32";newSampleArray=newF32Array;break;case 4353:case 4355:requestedSampleType="i16";newSampleArray=newI16Array;break;case 4352:case 4354:requestedSampleType="u8";newSampleArray=newU8Array;break}var buffers=[];try{for(var chan=0;chanoutputChannelCount){newCapture.mergerNode=newCapture.audioCtx.createChannelMerger(inputChannelCount);newCapture.mediaStreamSourceNode.connect(newCapture.mergerNode);newCapture.mergerNode.connect(newCapture.scriptProcessorNode)}else if(inputChannelCountc.capturedFrameCount/fratio){AL.alcErr=40964;return}function setF32Sample(i,sample){HEAPF32[pFrames+4*i>>2]=sample}function setI16Sample(i,sample){HEAP16[pFrames+2*i>>1]=sample}function setU8Sample(i,sample){HEAP8[pFrames+i>>0]=sample}var setSample;switch(c.requestedSampleType){case"f32":setSample=setF32Sample;break;case"i16":setSample=setI16Sample;break;case"u8":setSample=setU8Sample;break;default:return}if(Math.floor(fratio)==fratio){for(var i=0,frame_i=0;frame_i0){return 0}delete AL.deviceRefCounts[deviceId];AL.freeIds.push(deviceId);return 1}Module["_alcCloseDevice"]=_alcCloseDevice;_alcCloseDevice.sig="ii";function _alcCreateContext(deviceId,pAttrList){if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return 0}var options=null;var attrs=[];var hrtf=null;pAttrList>>=2;if(pAttrList){var attr=0;var val=0;while(true){attr=HEAP32[pAttrList++];attrs.push(attr);if(attr===0){break}val=HEAP32[pAttrList++];attrs.push(val);switch(attr){case 4103:if(!options){options={}}options.sampleRate=val;break;case 4112:case 4113:break;case 6546:switch(val){case 0:hrtf=false;break;case 1:hrtf=true;break;case 2:break;default:AL.alcErr=40964;return 0}break;case 6550:if(val!==0){AL.alcErr=40964;return 0}break;default:AL.alcErr=40964;return 0}}}var AudioContext=window.AudioContext||window.webkitAudioContext;var ac=null;try{if(options){ac=new AudioContext(options)}else{ac=new AudioContext}}catch(e){if(e.name==="NotSupportedError"){AL.alcErr=40964}else{AL.alcErr=40961}return 0}autoResumeAudioContext(ac);if(typeof ac.createGain=="undefined"){ac.createGain=ac.createGainNode}var gain=ac.createGain();gain.connect(ac.destination);var ctx={deviceId:deviceId,id:AL.newId(),attrs:attrs,audioCtx:ac,listener:{position:[0,0,0],velocity:[0,0,0],direction:[0,0,0],up:[0,0,0]},sources:[],interval:setInterval(function(){AL.scheduleContextAudio(ctx)},AL.QUEUE_INTERVAL),gain:gain,distanceModel:53250,speedOfSound:343.3,dopplerFactor:1,sourceDistanceModel:false,hrtf:hrtf||false,_err:0,get err(){return this._err},set err(val){if(this._err===0||val===0){this._err=val}}};AL.deviceRefCounts[deviceId]++;AL.contexts[ctx.id]=ctx;if(hrtf!==null){for(var ctxId in AL.contexts){var c=AL.contexts[ctxId];if(c.deviceId===deviceId){c.hrtf=hrtf;AL.updateContextGlobal(c)}}}return ctx.id}Module["_alcCreateContext"]=_alcCreateContext;_alcCreateContext.sig="iii";function _alcDestroyContext(contextId){var ctx=AL.contexts[contextId];if(AL.currentCtx===ctx){AL.alcErr=40962;return}if(AL.contexts[contextId].interval){clearInterval(AL.contexts[contextId].interval)}AL.deviceRefCounts[ctx.deviceId]--;delete AL.contexts[contextId];AL.freeIds.push(contextId)}Module["_alcDestroyContext"]=_alcDestroyContext;_alcDestroyContext.sig="vi";function _alcGetContextsDevice(contextId){if(contextId in AL.contexts){return AL.contexts[contextId].deviceId}return 0}Module["_alcGetContextsDevice"]=_alcGetContextsDevice;_alcGetContextsDevice.sig="ii";function _alcGetCurrentContext(){if(AL.currentCtx!==null){return AL.currentCtx.id}return 0}Module["_alcGetCurrentContext"]=_alcGetCurrentContext;_alcGetCurrentContext.sig="i";function _alcGetEnumValue(deviceId,pEnumName){if(deviceId!==0&&!(deviceId in AL.deviceRefCounts)){return 0}else if(!pEnumName){AL.alcErr=40964;return 0}var name=UTF8ToString(pEnumName);switch(name){case"ALC_NO_ERROR":return 0;case"ALC_INVALID_DEVICE":return 40961;case"ALC_INVALID_CONTEXT":return 40962;case"ALC_INVALID_ENUM":return 40963;case"ALC_INVALID_VALUE":return 40964;case"ALC_OUT_OF_MEMORY":return 40965;case"ALC_MAJOR_VERSION":return 4096;case"ALC_MINOR_VERSION":return 4097;case"ALC_ATTRIBUTES_SIZE":return 4098;case"ALC_ALL_ATTRIBUTES":return 4099;case"ALC_DEFAULT_DEVICE_SPECIFIER":return 4100;case"ALC_DEVICE_SPECIFIER":return 4101;case"ALC_EXTENSIONS":return 4102;case"ALC_FREQUENCY":return 4103;case"ALC_REFRESH":return 4104;case"ALC_SYNC":return 4105;case"ALC_MONO_SOURCES":return 4112;case"ALC_STEREO_SOURCES":return 4113;case"ALC_CAPTURE_DEVICE_SPECIFIER":return 784;case"ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER":return 785;case"ALC_CAPTURE_SAMPLES":return 786;case"ALC_HRTF_SOFT":return 6546;case"ALC_HRTF_ID_SOFT":return 6550;case"ALC_DONT_CARE_SOFT":return 2;case"ALC_HRTF_STATUS_SOFT":return 6547;case"ALC_NUM_HRTF_SPECIFIERS_SOFT":return 6548;case"ALC_HRTF_SPECIFIER_SOFT":return 6549;case"ALC_HRTF_DISABLED_SOFT":return 0;case"ALC_HRTF_ENABLED_SOFT":return 1;case"ALC_HRTF_DENIED_SOFT":return 2;case"ALC_HRTF_REQUIRED_SOFT":return 3;case"ALC_HRTF_HEADPHONES_DETECTED_SOFT":return 4;case"ALC_HRTF_UNSUPPORTED_FORMAT_SOFT":return 5;default:AL.alcErr=40964;return 0}}Module["_alcGetEnumValue"]=_alcGetEnumValue;_alcGetEnumValue.sig="iii";function _alcGetError(deviceId){var err=AL.alcErr;AL.alcErr=0;return err}Module["_alcGetError"]=_alcGetError;_alcGetError.sig="ii";function _alcGetIntegerv(deviceId,param,size,pValues){if(size===0||!pValues){return}switch(param){case 4096:HEAP32[pValues>>2]=1;break;case 4097:HEAP32[pValues>>2]=1;break;case 4098:if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return}if(!AL.currentCtx){AL.alcErr=40962;return}HEAP32[pValues>>2]=AL.currentCtx.attrs.length;break;case 4099:if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return}if(!AL.currentCtx){AL.alcErr=40962;return}for(var i=0;i>2]=AL.currentCtx.attrs[i]}break;case 4103:if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return}if(!AL.currentCtx){AL.alcErr=40962;return}HEAP32[pValues>>2]=AL.currentCtx.audioCtx.sampleRate;break;case 4112:case 4113:if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return}if(!AL.currentCtx){AL.alcErr=40962;return}HEAP32[pValues>>2]=2147483647;break;case 6546:case 6547:if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return}var hrtfStatus=0;for(var ctxId in AL.contexts){var ctx=AL.contexts[ctxId];if(ctx.deviceId===deviceId){hrtfStatus=ctx.hrtf?1:0}}HEAP32[pValues>>2]=hrtfStatus;break;case 6548:if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return}HEAP32[pValues>>2]=1;break;case 131075:if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return}if(!AL.currentCtx){AL.alcErr=40962;return}HEAP32[pValues>>2]=1;case 786:var c=AL.requireValidCaptureDevice(deviceId,"alcGetIntegerv");if(!c){return}var n=c.capturedFrameCount;var dstfreq=c.requestedSampleRate;var srcfreq=c.audioCtx.sampleRate;var nsamples=Math.floor(n*(dstfreq/srcfreq));HEAP32[pValues>>2]=nsamples;break;default:AL.alcErr=40963;return}}Module["_alcGetIntegerv"]=_alcGetIntegerv;_alcGetIntegerv.sig="viiii";function _alcGetString(deviceId,param){if(AL.alcStringCache[param]){return AL.alcStringCache[param]}var ret;switch(param){case 0:ret="No Error";break;case 40961:ret="Invalid Device";break;case 40962:ret="Invalid Context";break;case 40963:ret="Invalid Enum";break;case 40964:ret="Invalid Value";break;case 40965:ret="Out of Memory";break;case 4100:if(typeof AudioContext!="undefined"||typeof webkitAudioContext!="undefined"){ret=AL.DEVICE_NAME}else{return 0}break;case 4101:if(typeof AudioContext!="undefined"||typeof webkitAudioContext!="undefined"){ret=AL.DEVICE_NAME.concat("\0")}else{ret="\0"}break;case 785:ret=AL.CAPTURE_DEVICE_NAME;break;case 784:if(deviceId===0)ret=AL.CAPTURE_DEVICE_NAME.concat("\0");else{var c=AL.requireValidCaptureDevice(deviceId,"alcGetString");if(!c){return 0}ret=c.deviceName}break;case 4102:if(!deviceId){AL.alcErr=40961;return 0}ret="";for(var ext in AL.ALC_EXTENSIONS){ret=ret.concat(ext);ret=ret.concat(" ")}ret=ret.trim();break;default:AL.alcErr=40963;return 0}ret=allocateUTF8(ret);AL.alcStringCache[param]=ret;return ret}Module["_alcGetString"]=_alcGetString;_alcGetString.sig="iii";function _alcIsExtensionPresent(deviceId,pExtName){var name=UTF8ToString(pExtName);return AL.ALC_EXTENSIONS[name]?1:0}Module["_alcIsExtensionPresent"]=_alcIsExtensionPresent;_alcIsExtensionPresent.sig="iii";function _alcMakeContextCurrent(contextId){if(contextId===0){AL.currentCtx=null}else{AL.currentCtx=AL.contexts[contextId]}return 1}Module["_alcMakeContextCurrent"]=_alcMakeContextCurrent;_alcMakeContextCurrent.sig="ii";function _alcOpenDevice(pDeviceName){if(pDeviceName){var name=UTF8ToString(pDeviceName);if(name!==AL.DEVICE_NAME){return 0}}if(typeof AudioContext!="undefined"||typeof webkitAudioContext!="undefined"){var deviceId=AL.newId();AL.deviceRefCounts[deviceId]=0;return deviceId}return 0}Module["_alcOpenDevice"]=_alcOpenDevice;_alcOpenDevice.sig="ii";function _alcProcessContext(contextId){}Module["_alcProcessContext"]=_alcProcessContext;_alcProcessContext.sig="vi";function _alcSuspendContext(contextId){}Module["_alcSuspendContext"]=_alcSuspendContext;_alcSuspendContext.sig="vi";function _emscripten_alcDevicePauseSOFT(deviceId){if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return}if(AL.paused){return}AL.paused=true;for(var ctxId in AL.contexts){var ctx=AL.contexts[ctxId];if(ctx.deviceId!==deviceId){continue}ctx.audioCtx.suspend();clearInterval(ctx.interval);ctx.interval=null}}Module["_emscripten_alcDevicePauseSOFT"]=_emscripten_alcDevicePauseSOFT;_emscripten_alcDevicePauseSOFT.sig="vi";function _emscripten_alcDeviceResumeSOFT(deviceId){if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return}if(!AL.paused){return}AL.paused=false;for(var ctxId in AL.contexts){var ctx=AL.contexts[ctxId];if(ctx.deviceId!==deviceId){continue}ctx.interval=setInterval(function(){AL.scheduleContextAudio(ctx)},AL.QUEUE_INTERVAL);ctx.audioCtx.resume()}}Module["_emscripten_alcDeviceResumeSOFT"]=_emscripten_alcDeviceResumeSOFT;_emscripten_alcDeviceResumeSOFT.sig="vi";function _emscripten_alcGetStringiSOFT(deviceId,param,index){if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return 0}if(AL.alcStringCache[param]){return AL.alcStringCache[param]}var ret;switch(param){case 6549:if(index===0){ret="Web Audio HRTF"}else{AL.alcErr=40964;return 0}break;default:if(index!==0){AL.alcErr=40963;return 0}return _alcGetString(deviceId,param)}ret=allocateUTF8(ret);AL.alcStringCache[param]=ret;return ret}Module["_emscripten_alcGetStringiSOFT"]=_emscripten_alcGetStringiSOFT;_emscripten_alcGetStringiSOFT.sig="iiii";function _emscripten_alcResetDeviceSOFT(deviceId,pAttrList){if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return 0}var hrtf=null;pAttrList>>=2;if(pAttrList){var attr=0;var val=0;while(true){attr=HEAP32[pAttrList++];if(attr===0){break}val=HEAP32[pAttrList++];switch(attr){case 6546:if(val===1){hrtf=true}else if(val===0){hrtf=false}break}}}if(hrtf!==null){for(var ctxId in AL.contexts){var ctx=AL.contexts[ctxId];if(ctx.deviceId===deviceId){ctx.hrtf=hrtf;AL.updateContextGlobal(ctx)}}}return 1}Module["_emscripten_alcResetDeviceSOFT"]=_emscripten_alcResetDeviceSOFT;_emscripten_alcResetDeviceSOFT.sig="iii";var readEmAsmArgsArray=[];Module["readEmAsmArgsArray"]=readEmAsmArgsArray;function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?HEAP32[buf]:(ch==106?HEAP64:HEAPF64)[buf++>>1]);++buf}return readEmAsmArgsArray}Module["readEmAsmArgs"]=readEmAsmArgs;function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}Module["runEmAsmFunction"]=runEmAsmFunction;runEmAsmFunction.sig="ippp";function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}Module["_emscripten_asm_const_int"]=_emscripten_asm_const_int;_emscripten_asm_const_int.sig="ippp";function _emscripten_console_error(str){console.error(UTF8ToString(str))}Module["_emscripten_console_error"]=_emscripten_console_error;_emscripten_console_error.sig="vp";function _emscripten_console_log(str){console.log(UTF8ToString(str))}Module["_emscripten_console_log"]=_emscripten_console_log;_emscripten_console_log.sig="vp";function _emscripten_console_warn(str){console.warn(UTF8ToString(str))}Module["_emscripten_console_warn"]=_emscripten_console_warn;_emscripten_console_warn.sig="vp";function _emscripten_date_now(){return Date.now()}Module["_emscripten_date_now"]=_emscripten_date_now;_emscripten_date_now.sig="d";function _emscripten_exit_with_live_runtime(){throw"unwind"}Module["_emscripten_exit_with_live_runtime"]=_emscripten_exit_with_live_runtime;_emscripten_exit_with_live_runtime.sig="v";function getHeapMax(){return 2147483648}Module["getHeapMax"]=getHeapMax;function _emscripten_get_heap_max(){return getHeapMax()}Module["_emscripten_get_heap_max"]=_emscripten_get_heap_max;_emscripten_get_heap_max.sig="p";function _emscripten_get_now_res(){if(ENVIRONMENT_IS_NODE){return 1}else return 1e3}Module["_emscripten_get_now_res"]=_emscripten_get_now_res;function __webgl_enable_ANGLE_instanced_arrays(ctx){var ext=ctx.getExtension("ANGLE_instanced_arrays");if(ext){ctx["vertexAttribDivisor"]=function(index,divisor){ext["vertexAttribDivisorANGLE"](index,divisor)};ctx["drawArraysInstanced"]=function(mode,first,count,primcount){ext["drawArraysInstancedANGLE"](mode,first,count,primcount)};ctx["drawElementsInstanced"]=function(mode,count,type,indices,primcount){ext["drawElementsInstancedANGLE"](mode,count,type,indices,primcount)};return 1}}Module["__webgl_enable_ANGLE_instanced_arrays"]=__webgl_enable_ANGLE_instanced_arrays;function __webgl_enable_OES_vertex_array_object(ctx){var ext=ctx.getExtension("OES_vertex_array_object");if(ext){ctx["createVertexArray"]=function(){return ext["createVertexArrayOES"]()};ctx["deleteVertexArray"]=function(vao){ext["deleteVertexArrayOES"](vao)};ctx["bindVertexArray"]=function(vao){ext["bindVertexArrayOES"](vao)};ctx["isVertexArray"]=function(vao){return ext["isVertexArrayOES"](vao)};return 1}}Module["__webgl_enable_OES_vertex_array_object"]=__webgl_enable_OES_vertex_array_object;function __webgl_enable_WEBGL_draw_buffers(ctx){var ext=ctx.getExtension("WEBGL_draw_buffers");if(ext){ctx["drawBuffers"]=function(n,bufs){ext["drawBuffersWEBGL"](n,bufs)};return 1}}Module["__webgl_enable_WEBGL_draw_buffers"]=__webgl_enable_WEBGL_draw_buffers;function __webgl_enable_WEBGL_multi_draw(ctx){return!!(ctx.multiDrawWebgl=ctx.getExtension("WEBGL_multi_draw"))}Module["__webgl_enable_WEBGL_multi_draw"]=__webgl_enable_WEBGL_multi_draw;var GL={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],stringCache:{},unpackAlignment:4,recordError:function recordError(errorCode){if(!GL.lastError){GL.lastError=errorCode}},getNewId:function(table){var ret=GL.counter++;for(var i=table.length;i>2]:-1;source+=UTF8ToString(HEAP32[string+i*4>>2],len<0?undefined:len)}return source},createContext:function(canvas,webGLContextAttributes){if(!canvas.getContextSafariWebGL2Fixed){canvas.getContextSafariWebGL2Fixed=canvas.getContext;function fixedGetContext(ver,attrs){var gl=canvas.getContextSafariWebGL2Fixed(ver,attrs);return ver=="webgl"==gl instanceof WebGLRenderingContext?gl:null}canvas.getContext=fixedGetContext}var ctx=canvas.getContext("webgl",webGLContextAttributes);if(!ctx)return 0;var handle=GL.registerContext(ctx,webGLContextAttributes);return handle},registerContext:function(ctx,webGLContextAttributes){var handle=GL.getNewId(GL.contexts);var context={handle:handle,attributes:webGLContextAttributes,version:webGLContextAttributes.majorVersion,GLctx:ctx};if(ctx.canvas)ctx.canvas.GLctxObject=context;GL.contexts[handle]=context;if(typeof webGLContextAttributes.enableExtensionsByDefault=="undefined"||webGLContextAttributes.enableExtensionsByDefault){GL.initExtensions(context)}return handle},makeContextCurrent:function(contextHandle){GL.currentContext=GL.contexts[contextHandle];Module.ctx=GLctx=GL.currentContext&&GL.currentContext.GLctx;return!(contextHandle&&!GLctx)},getContext:function(contextHandle){return GL.contexts[contextHandle]},deleteContext:function(contextHandle){if(GL.currentContext===GL.contexts[contextHandle])GL.currentContext=null;if(typeof JSEvents=="object")JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas);if(GL.contexts[contextHandle]&&GL.contexts[contextHandle].GLctx.canvas)GL.contexts[contextHandle].GLctx.canvas.GLctxObject=undefined;GL.contexts[contextHandle]=null},initExtensions:function(context){if(!context)context=GL.currentContext;if(context.initExtensionsDone)return;context.initExtensionsDone=true;var GLctx=context.GLctx;__webgl_enable_ANGLE_instanced_arrays(GLctx);__webgl_enable_OES_vertex_array_object(GLctx);__webgl_enable_WEBGL_draw_buffers(GLctx);{GLctx.disjointTimerQueryExt=GLctx.getExtension("EXT_disjoint_timer_query")}__webgl_enable_WEBGL_multi_draw(GLctx);var exts=GLctx.getSupportedExtensions()||[];exts.forEach(function(ext){if(!ext.includes("lose_context")&&!ext.includes("debug")){GLctx.getExtension(ext)}})}};Module["GL"]=GL;function _emscripten_glActiveTexture(x0){GLctx["activeTexture"](x0)}Module["_emscripten_glActiveTexture"]=_emscripten_glActiveTexture;_emscripten_glActiveTexture.sig="vi";function _emscripten_glAttachShader(program,shader){GLctx.attachShader(GL.programs[program],GL.shaders[shader])}Module["_emscripten_glAttachShader"]=_emscripten_glAttachShader;_emscripten_glAttachShader.sig="vii";function _emscripten_glBeginQueryEXT(target,id){GLctx.disjointTimerQueryExt["beginQueryEXT"](target,GL.queries[id])}Module["_emscripten_glBeginQueryEXT"]=_emscripten_glBeginQueryEXT;_emscripten_glBeginQueryEXT.sig="vii";function _emscripten_glBindAttribLocation(program,index,name){GLctx.bindAttribLocation(GL.programs[program],index,UTF8ToString(name))}Module["_emscripten_glBindAttribLocation"]=_emscripten_glBindAttribLocation;_emscripten_glBindAttribLocation.sig="viii";function _emscripten_glBindBuffer(target,buffer){GLctx.bindBuffer(target,GL.buffers[buffer])}Module["_emscripten_glBindBuffer"]=_emscripten_glBindBuffer;_emscripten_glBindBuffer.sig="vii";function _emscripten_glBindFramebuffer(target,framebuffer){GLctx.bindFramebuffer(target,GL.framebuffers[framebuffer])}Module["_emscripten_glBindFramebuffer"]=_emscripten_glBindFramebuffer;_emscripten_glBindFramebuffer.sig="vii";function _emscripten_glBindRenderbuffer(target,renderbuffer){GLctx.bindRenderbuffer(target,GL.renderbuffers[renderbuffer])}Module["_emscripten_glBindRenderbuffer"]=_emscripten_glBindRenderbuffer;_emscripten_glBindRenderbuffer.sig="vii";function _emscripten_glBindTexture(target,texture){GLctx.bindTexture(target,GL.textures[texture])}Module["_emscripten_glBindTexture"]=_emscripten_glBindTexture;_emscripten_glBindTexture.sig="vii";function _emscripten_glBindVertexArrayOES(vao){GLctx["bindVertexArray"](GL.vaos[vao])}Module["_emscripten_glBindVertexArrayOES"]=_emscripten_glBindVertexArrayOES;_emscripten_glBindVertexArrayOES.sig="vi";function _emscripten_glBlendColor(x0,x1,x2,x3){GLctx["blendColor"](x0,x1,x2,x3)}Module["_emscripten_glBlendColor"]=_emscripten_glBlendColor;_emscripten_glBlendColor.sig="vffff";function _emscripten_glBlendEquation(x0){GLctx["blendEquation"](x0)}Module["_emscripten_glBlendEquation"]=_emscripten_glBlendEquation;_emscripten_glBlendEquation.sig="vi";function _emscripten_glBlendEquationSeparate(x0,x1){GLctx["blendEquationSeparate"](x0,x1)}Module["_emscripten_glBlendEquationSeparate"]=_emscripten_glBlendEquationSeparate;_emscripten_glBlendEquationSeparate.sig="vii";function _emscripten_glBlendFunc(x0,x1){GLctx["blendFunc"](x0,x1)}Module["_emscripten_glBlendFunc"]=_emscripten_glBlendFunc;_emscripten_glBlendFunc.sig="vii";function _emscripten_glBlendFuncSeparate(x0,x1,x2,x3){GLctx["blendFuncSeparate"](x0,x1,x2,x3)}Module["_emscripten_glBlendFuncSeparate"]=_emscripten_glBlendFuncSeparate;_emscripten_glBlendFuncSeparate.sig="viiii";function _emscripten_glBufferData(target,size,data,usage){GLctx.bufferData(target,data?HEAPU8.subarray(data,data+size):size,usage)}Module["_emscripten_glBufferData"]=_emscripten_glBufferData;_emscripten_glBufferData.sig="viiii";function _emscripten_glBufferSubData(target,offset,size,data){GLctx.bufferSubData(target,offset,HEAPU8.subarray(data,data+size))}Module["_emscripten_glBufferSubData"]=_emscripten_glBufferSubData;_emscripten_glBufferSubData.sig="viiii";function _emscripten_glCheckFramebufferStatus(x0){return GLctx["checkFramebufferStatus"](x0)}Module["_emscripten_glCheckFramebufferStatus"]=_emscripten_glCheckFramebufferStatus;_emscripten_glCheckFramebufferStatus.sig="ii";function _emscripten_glClear(x0){GLctx["clear"](x0)}Module["_emscripten_glClear"]=_emscripten_glClear;_emscripten_glClear.sig="vi";function _emscripten_glClearColor(x0,x1,x2,x3){GLctx["clearColor"](x0,x1,x2,x3)}Module["_emscripten_glClearColor"]=_emscripten_glClearColor;_emscripten_glClearColor.sig="vffff";function _emscripten_glClearDepthf(x0){GLctx["clearDepth"](x0)}Module["_emscripten_glClearDepthf"]=_emscripten_glClearDepthf;_emscripten_glClearDepthf.sig="vf";function _emscripten_glClearStencil(x0){GLctx["clearStencil"](x0)}Module["_emscripten_glClearStencil"]=_emscripten_glClearStencil;_emscripten_glClearStencil.sig="vi";function _emscripten_glColorMask(red,green,blue,alpha){GLctx.colorMask(!!red,!!green,!!blue,!!alpha)}Module["_emscripten_glColorMask"]=_emscripten_glColorMask;_emscripten_glColorMask.sig="viiii";function _emscripten_glCompileShader(shader){GLctx.compileShader(GL.shaders[shader])}Module["_emscripten_glCompileShader"]=_emscripten_glCompileShader;_emscripten_glCompileShader.sig="vi";function _emscripten_glCompressedTexImage2D(target,level,internalFormat,width,height,border,imageSize,data){GLctx["compressedTexImage2D"](target,level,internalFormat,width,height,border,data?HEAPU8.subarray(data,data+imageSize):null)}Module["_emscripten_glCompressedTexImage2D"]=_emscripten_glCompressedTexImage2D;_emscripten_glCompressedTexImage2D.sig="viiiiiiii";function _emscripten_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imageSize,data){GLctx["compressedTexSubImage2D"](target,level,xoffset,yoffset,width,height,format,data?HEAPU8.subarray(data,data+imageSize):null)}Module["_emscripten_glCompressedTexSubImage2D"]=_emscripten_glCompressedTexSubImage2D;_emscripten_glCompressedTexSubImage2D.sig="viiiiiiiii";function _emscripten_glCopyTexImage2D(x0,x1,x2,x3,x4,x5,x6,x7){GLctx["copyTexImage2D"](x0,x1,x2,x3,x4,x5,x6,x7)}Module["_emscripten_glCopyTexImage2D"]=_emscripten_glCopyTexImage2D;_emscripten_glCopyTexImage2D.sig="viiiiiiii";function _emscripten_glCopyTexSubImage2D(x0,x1,x2,x3,x4,x5,x6,x7){GLctx["copyTexSubImage2D"](x0,x1,x2,x3,x4,x5,x6,x7)}Module["_emscripten_glCopyTexSubImage2D"]=_emscripten_glCopyTexSubImage2D;_emscripten_glCopyTexSubImage2D.sig="viiiiiiii";function _emscripten_glCreateProgram(){var id=GL.getNewId(GL.programs);var program=GLctx.createProgram();program.name=id;program.maxUniformLength=program.maxAttributeLength=program.maxUniformBlockNameLength=0;program.uniformIdCounter=1;GL.programs[id]=program;return id}Module["_emscripten_glCreateProgram"]=_emscripten_glCreateProgram;_emscripten_glCreateProgram.sig="i";function _emscripten_glCreateShader(shaderType){var id=GL.getNewId(GL.shaders);GL.shaders[id]=GLctx.createShader(shaderType);return id}Module["_emscripten_glCreateShader"]=_emscripten_glCreateShader;_emscripten_glCreateShader.sig="ii";function _emscripten_glCullFace(x0){GLctx["cullFace"](x0)}Module["_emscripten_glCullFace"]=_emscripten_glCullFace;_emscripten_glCullFace.sig="vi";function _emscripten_glDeleteBuffers(n,buffers){for(var i=0;i>2];var buffer=GL.buffers[id];if(!buffer)continue;GLctx.deleteBuffer(buffer);buffer.name=0;GL.buffers[id]=null}}Module["_emscripten_glDeleteBuffers"]=_emscripten_glDeleteBuffers;_emscripten_glDeleteBuffers.sig="vii";function _emscripten_glDeleteFramebuffers(n,framebuffers){for(var i=0;i>2];var framebuffer=GL.framebuffers[id];if(!framebuffer)continue;GLctx.deleteFramebuffer(framebuffer);framebuffer.name=0;GL.framebuffers[id]=null}}Module["_emscripten_glDeleteFramebuffers"]=_emscripten_glDeleteFramebuffers;_emscripten_glDeleteFramebuffers.sig="vii";function _emscripten_glDeleteProgram(id){if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null}Module["_emscripten_glDeleteProgram"]=_emscripten_glDeleteProgram;_emscripten_glDeleteProgram.sig="vi";function _emscripten_glDeleteQueriesEXT(n,ids){for(var i=0;i>2];var query=GL.queries[id];if(!query)continue;GLctx.disjointTimerQueryExt["deleteQueryEXT"](query);GL.queries[id]=null}}Module["_emscripten_glDeleteQueriesEXT"]=_emscripten_glDeleteQueriesEXT;_emscripten_glDeleteQueriesEXT.sig="vii";function _emscripten_glDeleteRenderbuffers(n,renderbuffers){for(var i=0;i>2];var renderbuffer=GL.renderbuffers[id];if(!renderbuffer)continue;GLctx.deleteRenderbuffer(renderbuffer);renderbuffer.name=0;GL.renderbuffers[id]=null}}Module["_emscripten_glDeleteRenderbuffers"]=_emscripten_glDeleteRenderbuffers;_emscripten_glDeleteRenderbuffers.sig="vii";function _emscripten_glDeleteShader(id){if(!id)return;var shader=GL.shaders[id];if(!shader){GL.recordError(1281);return}GLctx.deleteShader(shader);GL.shaders[id]=null}Module["_emscripten_glDeleteShader"]=_emscripten_glDeleteShader;_emscripten_glDeleteShader.sig="vi";function _emscripten_glDeleteTextures(n,textures){for(var i=0;i>2];var texture=GL.textures[id];if(!texture)continue;GLctx.deleteTexture(texture);texture.name=0;GL.textures[id]=null}}Module["_emscripten_glDeleteTextures"]=_emscripten_glDeleteTextures;_emscripten_glDeleteTextures.sig="vii";function _emscripten_glDeleteVertexArraysOES(n,vaos){for(var i=0;i>2];GLctx["deleteVertexArray"](GL.vaos[id]);GL.vaos[id]=null}}Module["_emscripten_glDeleteVertexArraysOES"]=_emscripten_glDeleteVertexArraysOES;_emscripten_glDeleteVertexArraysOES.sig="vii";function _emscripten_glDepthFunc(x0){GLctx["depthFunc"](x0)}Module["_emscripten_glDepthFunc"]=_emscripten_glDepthFunc;_emscripten_glDepthFunc.sig="vi";function _emscripten_glDepthMask(flag){GLctx.depthMask(!!flag)}Module["_emscripten_glDepthMask"]=_emscripten_glDepthMask;_emscripten_glDepthMask.sig="vi";function _emscripten_glDepthRangef(x0,x1){GLctx["depthRange"](x0,x1)}Module["_emscripten_glDepthRangef"]=_emscripten_glDepthRangef;_emscripten_glDepthRangef.sig="vii";function _emscripten_glDetachShader(program,shader){GLctx.detachShader(GL.programs[program],GL.shaders[shader])}Module["_emscripten_glDetachShader"]=_emscripten_glDetachShader;_emscripten_glDetachShader.sig="vii";function _emscripten_glDisable(x0){GLctx["disable"](x0)}Module["_emscripten_glDisable"]=_emscripten_glDisable;_emscripten_glDisable.sig="vi";function _emscripten_glDisableVertexAttribArray(index){GLctx.disableVertexAttribArray(index)}Module["_emscripten_glDisableVertexAttribArray"]=_emscripten_glDisableVertexAttribArray;_emscripten_glDisableVertexAttribArray.sig="vi";function _emscripten_glDrawArrays(mode,first,count){GLctx.drawArrays(mode,first,count)}Module["_emscripten_glDrawArrays"]=_emscripten_glDrawArrays;_emscripten_glDrawArrays.sig="viii";function _emscripten_glDrawArraysInstancedANGLE(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}Module["_emscripten_glDrawArraysInstancedANGLE"]=_emscripten_glDrawArraysInstancedANGLE;_emscripten_glDrawArraysInstancedANGLE.sig="viiii";var tempFixedLengthArray=[];Module["tempFixedLengthArray"]=tempFixedLengthArray;function _emscripten_glDrawBuffersWEBGL(n,bufs){var bufArray=tempFixedLengthArray[n];for(var i=0;i>2]}GLctx["drawBuffers"](bufArray)}Module["_emscripten_glDrawBuffersWEBGL"]=_emscripten_glDrawBuffersWEBGL;_emscripten_glDrawBuffersWEBGL.sig="vii";function _emscripten_glDrawElements(mode,count,type,indices){GLctx.drawElements(mode,count,type,indices)}Module["_emscripten_glDrawElements"]=_emscripten_glDrawElements;_emscripten_glDrawElements.sig="viiii";function _emscripten_glDrawElementsInstancedANGLE(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}Module["_emscripten_glDrawElementsInstancedANGLE"]=_emscripten_glDrawElementsInstancedANGLE;_emscripten_glDrawElementsInstancedANGLE.sig="viiiii";function _emscripten_glEnable(x0){GLctx["enable"](x0)}Module["_emscripten_glEnable"]=_emscripten_glEnable;_emscripten_glEnable.sig="vi";function _emscripten_glEnableVertexAttribArray(index){GLctx.enableVertexAttribArray(index)}Module["_emscripten_glEnableVertexAttribArray"]=_emscripten_glEnableVertexAttribArray;_emscripten_glEnableVertexAttribArray.sig="vi";function _emscripten_glEndQueryEXT(target){GLctx.disjointTimerQueryExt["endQueryEXT"](target)}Module["_emscripten_glEndQueryEXT"]=_emscripten_glEndQueryEXT;_emscripten_glEndQueryEXT.sig="vi";function _emscripten_glFinish(){GLctx["finish"]()}Module["_emscripten_glFinish"]=_emscripten_glFinish;_emscripten_glFinish.sig="v";function _emscripten_glFlush(){GLctx["flush"]()}Module["_emscripten_glFlush"]=_emscripten_glFlush;_emscripten_glFlush.sig="v";function _emscripten_glFramebufferRenderbuffer(target,attachment,renderbuffertarget,renderbuffer){GLctx.framebufferRenderbuffer(target,attachment,renderbuffertarget,GL.renderbuffers[renderbuffer])}Module["_emscripten_glFramebufferRenderbuffer"]=_emscripten_glFramebufferRenderbuffer;_emscripten_glFramebufferRenderbuffer.sig="viiii";function _emscripten_glFramebufferTexture2D(target,attachment,textarget,texture,level){GLctx.framebufferTexture2D(target,attachment,textarget,GL.textures[texture],level)}Module["_emscripten_glFramebufferTexture2D"]=_emscripten_glFramebufferTexture2D;_emscripten_glFramebufferTexture2D.sig="viiiii";function _emscripten_glFrontFace(x0){GLctx["frontFace"](x0)}Module["_emscripten_glFrontFace"]=_emscripten_glFrontFace;_emscripten_glFrontFace.sig="vi";function __glGenObject(n,buffers,createFunction,objectTable){for(var i=0;i>2]=id}}Module["__glGenObject"]=__glGenObject;__glGenObject.sig="vii";function _emscripten_glGenBuffers(n,buffers){__glGenObject(n,buffers,"createBuffer",GL.buffers)}Module["_emscripten_glGenBuffers"]=_emscripten_glGenBuffers;_emscripten_glGenBuffers.sig="vii";function _emscripten_glGenFramebuffers(n,ids){__glGenObject(n,ids,"createFramebuffer",GL.framebuffers)}Module["_emscripten_glGenFramebuffers"]=_emscripten_glGenFramebuffers;_emscripten_glGenFramebuffers.sig="vii";function _emscripten_glGenQueriesEXT(n,ids){for(var i=0;i>2]=0;return}var id=GL.getNewId(GL.queries);query.name=id;GL.queries[id]=query;HEAP32[ids+i*4>>2]=id}}Module["_emscripten_glGenQueriesEXT"]=_emscripten_glGenQueriesEXT;_emscripten_glGenQueriesEXT.sig="vii";function _emscripten_glGenRenderbuffers(n,renderbuffers){__glGenObject(n,renderbuffers,"createRenderbuffer",GL.renderbuffers)}Module["_emscripten_glGenRenderbuffers"]=_emscripten_glGenRenderbuffers;_emscripten_glGenRenderbuffers.sig="vii";function _emscripten_glGenTextures(n,textures){__glGenObject(n,textures,"createTexture",GL.textures)}Module["_emscripten_glGenTextures"]=_emscripten_glGenTextures;_emscripten_glGenTextures.sig="vii";function _emscripten_glGenVertexArraysOES(n,arrays){__glGenObject(n,arrays,"createVertexArray",GL.vaos)}Module["_emscripten_glGenVertexArraysOES"]=_emscripten_glGenVertexArraysOES;_emscripten_glGenVertexArraysOES.sig="vii";function _emscripten_glGenerateMipmap(x0){GLctx["generateMipmap"](x0)}Module["_emscripten_glGenerateMipmap"]=_emscripten_glGenerateMipmap;_emscripten_glGenerateMipmap.sig="vi";function __glGetActiveAttribOrUniform(funcName,program,index,bufSize,length,size,type,name){program=GL.programs[program];var info=GLctx[funcName](program,index);if(info){var numBytesWrittenExclNull=name&&stringToUTF8(info.name,name,bufSize);if(length)HEAP32[length>>2]=numBytesWrittenExclNull;if(size)HEAP32[size>>2]=info.size;if(type)HEAP32[type>>2]=info.type}}Module["__glGetActiveAttribOrUniform"]=__glGetActiveAttribOrUniform;function _emscripten_glGetActiveAttrib(program,index,bufSize,length,size,type,name){__glGetActiveAttribOrUniform("getActiveAttrib",program,index,bufSize,length,size,type,name)}Module["_emscripten_glGetActiveAttrib"]=_emscripten_glGetActiveAttrib;_emscripten_glGetActiveAttrib.sig="viiiiiii";function _emscripten_glGetActiveUniform(program,index,bufSize,length,size,type,name){__glGetActiveAttribOrUniform("getActiveUniform",program,index,bufSize,length,size,type,name)}Module["_emscripten_glGetActiveUniform"]=_emscripten_glGetActiveUniform;_emscripten_glGetActiveUniform.sig="viiiiiii";function _emscripten_glGetAttachedShaders(program,maxCount,count,shaders){var result=GLctx.getAttachedShaders(GL.programs[program]);var len=result.length;if(len>maxCount){len=maxCount}HEAP32[count>>2]=len;for(var i=0;i>2]=id}}Module["_emscripten_glGetAttachedShaders"]=_emscripten_glGetAttachedShaders;_emscripten_glGetAttachedShaders.sig="viiii";function _emscripten_glGetAttribLocation(program,name){return GLctx.getAttribLocation(GL.programs[program],UTF8ToString(name))}Module["_emscripten_glGetAttribLocation"]=_emscripten_glGetAttribLocation;_emscripten_glGetAttribLocation.sig="iii";function writeI53ToI64(ptr,num){HEAPU32[ptr>>2]=num;HEAPU32[ptr+4>>2]=(num-HEAPU32[ptr>>2])/4294967296}Module["writeI53ToI64"]=writeI53ToI64;function emscriptenWebGLGet(name_,p,type){if(!p){GL.recordError(1281);return}var ret=undefined;switch(name_){case 36346:ret=1;break;case 36344:if(type!=0&&type!=1){GL.recordError(1280)}return;case 36345:ret=0;break;case 34466:var formats=GLctx.getParameter(34467);ret=formats?formats.length:0;break}if(ret===undefined){var result=GLctx.getParameter(name_);switch(typeof result){case"number":ret=result;break;case"boolean":ret=result?1:0;break;case"string":GL.recordError(1280);return;case"object":if(result===null){switch(name_){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 34068:{ret=0;break}default:{GL.recordError(1280);return}}}else if(result instanceof Float32Array||result instanceof Uint32Array||result instanceof Int32Array||result instanceof Array){for(var i=0;i>2]=result[i];break;case 2:HEAPF32[p+i*4>>2]=result[i];break;case 4:HEAP8[p+i>>0]=result[i]?1:0;break}}return}else{try{ret=result.name|0}catch(e){GL.recordError(1280);err("GL_INVALID_ENUM in glGet"+type+"v: Unknown object returned from WebGL getParameter("+name_+")! (error: "+e+")");return}}break;default:GL.recordError(1280);err("GL_INVALID_ENUM in glGet"+type+"v: Native code calling glGet"+type+"v("+name_+") and it returns "+result+" of type "+typeof result+"!");return}}switch(type){case 1:writeI53ToI64(p,ret);break;case 0:HEAP32[p>>2]=ret;break;case 2:HEAPF32[p>>2]=ret;break;case 4:HEAP8[p>>0]=ret?1:0;break}}Module["emscriptenWebGLGet"]=emscriptenWebGLGet;function _emscripten_glGetBooleanv(name_,p){emscriptenWebGLGet(name_,p,4)}Module["_emscripten_glGetBooleanv"]=_emscripten_glGetBooleanv;_emscripten_glGetBooleanv.sig="vii";function _emscripten_glGetBufferParameteriv(target,value,data){if(!data){GL.recordError(1281);return}HEAP32[data>>2]=GLctx.getBufferParameter(target,value)}Module["_emscripten_glGetBufferParameteriv"]=_emscripten_glGetBufferParameteriv;_emscripten_glGetBufferParameteriv.sig="viii";function _emscripten_glGetError(){var error=GLctx.getError()||GL.lastError;GL.lastError=0;return error}Module["_emscripten_glGetError"]=_emscripten_glGetError;_emscripten_glGetError.sig="i";function _emscripten_glGetFloatv(name_,p){emscriptenWebGLGet(name_,p,2)}Module["_emscripten_glGetFloatv"]=_emscripten_glGetFloatv;_emscripten_glGetFloatv.sig="vii";function _emscripten_glGetFramebufferAttachmentParameteriv(target,attachment,pname,params){var result=GLctx.getFramebufferAttachmentParameter(target,attachment,pname);if(result instanceof WebGLRenderbuffer||result instanceof WebGLTexture){result=result.name|0}HEAP32[params>>2]=result}Module["_emscripten_glGetFramebufferAttachmentParameteriv"]=_emscripten_glGetFramebufferAttachmentParameteriv;_emscripten_glGetFramebufferAttachmentParameteriv.sig="viiii";function _emscripten_glGetIntegerv(name_,p){emscriptenWebGLGet(name_,p,0)}Module["_emscripten_glGetIntegerv"]=_emscripten_glGetIntegerv;_emscripten_glGetIntegerv.sig="vii";function _emscripten_glGetProgramInfoLog(program,maxLength,length,infoLog){var log=GLctx.getProgramInfoLog(GL.programs[program]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}Module["_emscripten_glGetProgramInfoLog"]=_emscripten_glGetProgramInfoLog;_emscripten_glGetProgramInfoLog.sig="viiii";function _emscripten_glGetProgramiv(program,pname,p){if(!p){GL.recordError(1281);return}if(program>=GL.counter){GL.recordError(1281);return}program=GL.programs[program];if(pname==35716){var log=GLctx.getProgramInfoLog(program);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35719){if(!program.maxUniformLength){for(var i=0;i>2]=program.maxUniformLength}else if(pname==35722){if(!program.maxAttributeLength){for(var i=0;i>2]=program.maxAttributeLength}else if(pname==35381){if(!program.maxUniformBlockNameLength){for(var i=0;i>2]=program.maxUniformBlockNameLength}else{HEAP32[p>>2]=GLctx.getProgramParameter(program,pname)}}Module["_emscripten_glGetProgramiv"]=_emscripten_glGetProgramiv;_emscripten_glGetProgramiv.sig="viii";function _emscripten_glGetQueryObjecti64vEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param;{param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname)}var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}writeI53ToI64(params,ret)}Module["_emscripten_glGetQueryObjecti64vEXT"]=_emscripten_glGetQueryObjecti64vEXT;_emscripten_glGetQueryObjecti64vEXT.sig="viii";function _emscripten_glGetQueryObjectivEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}HEAP32[params>>2]=ret}Module["_emscripten_glGetQueryObjectivEXT"]=_emscripten_glGetQueryObjectivEXT;_emscripten_glGetQueryObjectivEXT.sig="viii";function _emscripten_glGetQueryObjectui64vEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param;{param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname)}var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}writeI53ToI64(params,ret)}Module["_emscripten_glGetQueryObjectui64vEXT"]=_emscripten_glGetQueryObjectui64vEXT;_emscripten_glGetQueryObjectui64vEXT.sig="viii";function _emscripten_glGetQueryObjectuivEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}HEAP32[params>>2]=ret}Module["_emscripten_glGetQueryObjectuivEXT"]=_emscripten_glGetQueryObjectuivEXT;_emscripten_glGetQueryObjectuivEXT.sig="viii";function _emscripten_glGetQueryivEXT(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.disjointTimerQueryExt["getQueryEXT"](target,pname)}Module["_emscripten_glGetQueryivEXT"]=_emscripten_glGetQueryivEXT;_emscripten_glGetQueryivEXT.sig="viii";function _emscripten_glGetRenderbufferParameteriv(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getRenderbufferParameter(target,pname)}Module["_emscripten_glGetRenderbufferParameteriv"]=_emscripten_glGetRenderbufferParameteriv;_emscripten_glGetRenderbufferParameteriv.sig="viii";function _emscripten_glGetShaderInfoLog(shader,maxLength,length,infoLog){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}Module["_emscripten_glGetShaderInfoLog"]=_emscripten_glGetShaderInfoLog;_emscripten_glGetShaderInfoLog.sig="viiii";function _emscripten_glGetShaderPrecisionFormat(shaderType,precisionType,range,precision){var result=GLctx.getShaderPrecisionFormat(shaderType,precisionType);HEAP32[range>>2]=result.rangeMin;HEAP32[range+4>>2]=result.rangeMax;HEAP32[precision>>2]=result.precision}Module["_emscripten_glGetShaderPrecisionFormat"]=_emscripten_glGetShaderPrecisionFormat;_emscripten_glGetShaderPrecisionFormat.sig="viiii";function _emscripten_glGetShaderSource(shader,bufSize,length,source){var result=GLctx.getShaderSource(GL.shaders[shader]);if(!result)return;var numBytesWrittenExclNull=bufSize>0&&source?stringToUTF8(result,source,bufSize):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}Module["_emscripten_glGetShaderSource"]=_emscripten_glGetShaderSource;_emscripten_glGetShaderSource.sig="viiii";function _emscripten_glGetShaderiv(shader,pname,p){if(!p){GL.recordError(1281);return}if(pname==35716){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var logLength=log?log.length+1:0;HEAP32[p>>2]=logLength}else if(pname==35720){var source=GLctx.getShaderSource(GL.shaders[shader]);var sourceLength=source?source.length+1:0;HEAP32[p>>2]=sourceLength}else{HEAP32[p>>2]=GLctx.getShaderParameter(GL.shaders[shader],pname)}}Module["_emscripten_glGetShaderiv"]=_emscripten_glGetShaderiv;_emscripten_glGetShaderiv.sig="viii";function stringToNewUTF8(jsString){var length=lengthBytesUTF8(jsString)+1;var cString=_malloc(length);stringToUTF8(jsString,cString,length);return cString}Module["stringToNewUTF8"]=stringToNewUTF8;function _emscripten_glGetString(name_){var ret=GL.stringCache[name_];if(!ret){switch(name_){case 7939:var exts=GLctx.getSupportedExtensions()||[];exts=exts.concat(exts.map(function(e){return"GL_"+e}));ret=stringToNewUTF8(exts.join(" "));break;case 7936:case 7937:case 37445:case 37446:var s=GLctx.getParameter(name_);if(!s){GL.recordError(1280)}ret=s&&stringToNewUTF8(s);break;case 7938:var glVersion=GLctx.getParameter(7938);{glVersion="OpenGL ES 2.0 ("+glVersion+")"}ret=stringToNewUTF8(glVersion);break;case 35724:var glslVersion=GLctx.getParameter(35724);var ver_re=/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/;var ver_num=glslVersion.match(ver_re);if(ver_num!==null){if(ver_num[1].length==3)ver_num[1]=ver_num[1]+"0";glslVersion="OpenGL ES GLSL ES "+ver_num[1]+" ("+glslVersion+")"}ret=stringToNewUTF8(glslVersion);break;default:GL.recordError(1280)}GL.stringCache[name_]=ret}return ret}Module["_emscripten_glGetString"]=_emscripten_glGetString;_emscripten_glGetString.sig="ii";function _emscripten_glGetTexParameterfv(target,pname,params){if(!params){GL.recordError(1281);return}HEAPF32[params>>2]=GLctx.getTexParameter(target,pname)}Module["_emscripten_glGetTexParameterfv"]=_emscripten_glGetTexParameterfv;_emscripten_glGetTexParameterfv.sig="viii";function _emscripten_glGetTexParameteriv(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getTexParameter(target,pname)}Module["_emscripten_glGetTexParameteriv"]=_emscripten_glGetTexParameteriv;_emscripten_glGetTexParameteriv.sig="viii";function webglGetLeftBracePos(name){return name.slice(-1)=="]"&&name.lastIndexOf("[")}Module["webglGetLeftBracePos"]=webglGetLeftBracePos;function webglPrepareUniformLocationsBeforeFirstUse(program){var uniformLocsById=program.uniformLocsById,uniformSizeAndIdsByName=program.uniformSizeAndIdsByName,i,j;if(!uniformLocsById){program.uniformLocsById=uniformLocsById={};program.uniformArrayNamesById={};for(i=0;i0?nm.slice(0,lb):nm;var id=program.uniformIdCounter;program.uniformIdCounter+=sz;uniformSizeAndIdsByName[arrayName]=[sz,id];for(j=0;j0){arrayIndex=jstoi_q(name.slice(leftBrace+1))>>>0;uniformBaseName=name.slice(0,leftBrace)}var sizeAndId=program.uniformSizeAndIdsByName[uniformBaseName];if(sizeAndId&&arrayIndex0?"["+webglLoc+"]":""))}return webglLoc}else{GL.recordError(1282)}}Module["webglGetUniformLocation"]=webglGetUniformLocation;function emscriptenWebGLGetUniform(program,location,params,type){if(!params){GL.recordError(1281);return}program=GL.programs[program];webglPrepareUniformLocationsBeforeFirstUse(program);var data=GLctx.getUniform(program,webglGetUniformLocation(location));if(typeof data=="number"||typeof data=="boolean"){switch(type){case 0:HEAP32[params>>2]=data;break;case 2:HEAPF32[params>>2]=data;break}}else{for(var i=0;i>2]=data[i];break;case 2:HEAPF32[params+i*4>>2]=data[i];break}}}}Module["emscriptenWebGLGetUniform"]=emscriptenWebGLGetUniform;function _emscripten_glGetUniformfv(program,location,params){emscriptenWebGLGetUniform(program,location,params,2)}Module["_emscripten_glGetUniformfv"]=_emscripten_glGetUniformfv;_emscripten_glGetUniformfv.sig="viii";function _emscripten_glGetUniformiv(program,location,params){emscriptenWebGLGetUniform(program,location,params,0)}Module["_emscripten_glGetUniformiv"]=_emscripten_glGetUniformiv;_emscripten_glGetUniformiv.sig="viii";function _emscripten_glGetVertexAttribPointerv(index,pname,pointer){if(!pointer){GL.recordError(1281);return}HEAP32[pointer>>2]=GLctx.getVertexAttribOffset(index,pname)}Module["_emscripten_glGetVertexAttribPointerv"]=_emscripten_glGetVertexAttribPointerv;_emscripten_glGetVertexAttribPointerv.sig="viii";function emscriptenWebGLGetVertexAttrib(index,pname,params,type){if(!params){GL.recordError(1281);return}var data=GLctx.getVertexAttrib(index,pname);if(pname==34975){HEAP32[params>>2]=data&&data["name"]}else if(typeof data=="number"||typeof data=="boolean"){switch(type){case 0:HEAP32[params>>2]=data;break;case 2:HEAPF32[params>>2]=data;break;case 5:HEAP32[params>>2]=Math.fround(data);break}}else{for(var i=0;i>2]=data[i];break;case 2:HEAPF32[params+i*4>>2]=data[i];break;case 5:HEAP32[params+i*4>>2]=Math.fround(data[i]);break}}}}Module["emscriptenWebGLGetVertexAttrib"]=emscriptenWebGLGetVertexAttrib;function _emscripten_glGetVertexAttribfv(index,pname,params){emscriptenWebGLGetVertexAttrib(index,pname,params,2)}Module["_emscripten_glGetVertexAttribfv"]=_emscripten_glGetVertexAttribfv;_emscripten_glGetVertexAttribfv.sig="viii";function _emscripten_glGetVertexAttribiv(index,pname,params){emscriptenWebGLGetVertexAttrib(index,pname,params,5)}Module["_emscripten_glGetVertexAttribiv"]=_emscripten_glGetVertexAttribiv;_emscripten_glGetVertexAttribiv.sig="viii";function _emscripten_glHint(x0,x1){GLctx["hint"](x0,x1)}Module["_emscripten_glHint"]=_emscripten_glHint;_emscripten_glHint.sig="vii";function _emscripten_glIsBuffer(buffer){var b=GL.buffers[buffer];if(!b)return 0;return GLctx.isBuffer(b)}Module["_emscripten_glIsBuffer"]=_emscripten_glIsBuffer;_emscripten_glIsBuffer.sig="ii";function _emscripten_glIsEnabled(x0){return GLctx["isEnabled"](x0)}Module["_emscripten_glIsEnabled"]=_emscripten_glIsEnabled;_emscripten_glIsEnabled.sig="ii";function _emscripten_glIsFramebuffer(framebuffer){var fb=GL.framebuffers[framebuffer];if(!fb)return 0;return GLctx.isFramebuffer(fb)}Module["_emscripten_glIsFramebuffer"]=_emscripten_glIsFramebuffer;_emscripten_glIsFramebuffer.sig="ii";function _emscripten_glIsProgram(program){program=GL.programs[program];if(!program)return 0;return GLctx.isProgram(program)}Module["_emscripten_glIsProgram"]=_emscripten_glIsProgram;_emscripten_glIsProgram.sig="ii";function _emscripten_glIsQueryEXT(id){var query=GL.queries[id];if(!query)return 0;return GLctx.disjointTimerQueryExt["isQueryEXT"](query)}Module["_emscripten_glIsQueryEXT"]=_emscripten_glIsQueryEXT;_emscripten_glIsQueryEXT.sig="ii";function _emscripten_glIsRenderbuffer(renderbuffer){var rb=GL.renderbuffers[renderbuffer];if(!rb)return 0;return GLctx.isRenderbuffer(rb)}Module["_emscripten_glIsRenderbuffer"]=_emscripten_glIsRenderbuffer;_emscripten_glIsRenderbuffer.sig="ii";function _emscripten_glIsShader(shader){var s=GL.shaders[shader];if(!s)return 0;return GLctx.isShader(s)}Module["_emscripten_glIsShader"]=_emscripten_glIsShader;_emscripten_glIsShader.sig="ii";function _emscripten_glIsTexture(id){var texture=GL.textures[id];if(!texture)return 0;return GLctx.isTexture(texture)}Module["_emscripten_glIsTexture"]=_emscripten_glIsTexture;_emscripten_glIsTexture.sig="ii";function _emscripten_glIsVertexArrayOES(array){var vao=GL.vaos[array];if(!vao)return 0;return GLctx["isVertexArray"](vao)}Module["_emscripten_glIsVertexArrayOES"]=_emscripten_glIsVertexArrayOES;_emscripten_glIsVertexArrayOES.sig="ii";function _emscripten_glLineWidth(x0){GLctx["lineWidth"](x0)}Module["_emscripten_glLineWidth"]=_emscripten_glLineWidth;_emscripten_glLineWidth.sig="vf";function _emscripten_glLinkProgram(program){program=GL.programs[program];GLctx.linkProgram(program);program.uniformLocsById=0;program.uniformSizeAndIdsByName={}}Module["_emscripten_glLinkProgram"]=_emscripten_glLinkProgram;_emscripten_glLinkProgram.sig="vi";function _emscripten_glPixelStorei(pname,param){if(pname==3317){GL.unpackAlignment=param}GLctx.pixelStorei(pname,param)}Module["_emscripten_glPixelStorei"]=_emscripten_glPixelStorei;_emscripten_glPixelStorei.sig="vii";function _emscripten_glPolygonOffset(x0,x1){GLctx["polygonOffset"](x0,x1)}Module["_emscripten_glPolygonOffset"]=_emscripten_glPolygonOffset;_emscripten_glPolygonOffset.sig="vff";function _emscripten_glQueryCounterEXT(id,target){GLctx.disjointTimerQueryExt["queryCounterEXT"](GL.queries[id],target)}Module["_emscripten_glQueryCounterEXT"]=_emscripten_glQueryCounterEXT;_emscripten_glQueryCounterEXT.sig="vii";function computeUnpackAlignedImageSize(width,height,sizePerPixel,alignment){function roundedToNextMultipleOf(x,y){return x+y-1&-y}var plainRowSize=width*sizePerPixel;var alignedRowSize=roundedToNextMultipleOf(plainRowSize,alignment);return height*alignedRowSize}Module["computeUnpackAlignedImageSize"]=computeUnpackAlignedImageSize;function __colorChannelsInGlTextureFormat(format){var colorChannels={5:3,6:4,8:2,29502:3,29504:4};return colorChannels[format-6402]||1}Module["__colorChannelsInGlTextureFormat"]=__colorChannelsInGlTextureFormat;function heapObjectForWebGLType(type){type-=5120;if(type==1)return HEAPU8;if(type==4)return HEAP32;if(type==6)return HEAPF32;if(type==5||type==28922)return HEAPU32;return HEAPU16}Module["heapObjectForWebGLType"]=heapObjectForWebGLType;function heapAccessShiftForWebGLHeap(heap){return 31-Math.clz32(heap.BYTES_PER_ELEMENT)}Module["heapAccessShiftForWebGLHeap"]=heapAccessShiftForWebGLHeap;function emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat){var heap=heapObjectForWebGLType(type);var shift=heapAccessShiftForWebGLHeap(heap);var byteSize=1<>shift,pixels+bytes>>shift)}Module["emscriptenWebGLGetTexPixelData"]=emscriptenWebGLGetTexPixelData;function _emscripten_glReadPixels(x,y,width,height,format,type,pixels){var pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,format);if(!pixelData){GL.recordError(1280);return}GLctx.readPixels(x,y,width,height,format,type,pixelData)}Module["_emscripten_glReadPixels"]=_emscripten_glReadPixels;_emscripten_glReadPixels.sig="viiiiiii";function _emscripten_glReleaseShaderCompiler(){}Module["_emscripten_glReleaseShaderCompiler"]=_emscripten_glReleaseShaderCompiler;_emscripten_glReleaseShaderCompiler.sig="v";function _emscripten_glRenderbufferStorage(x0,x1,x2,x3){GLctx["renderbufferStorage"](x0,x1,x2,x3)}Module["_emscripten_glRenderbufferStorage"]=_emscripten_glRenderbufferStorage;_emscripten_glRenderbufferStorage.sig="viiii";function _emscripten_glSampleCoverage(value,invert){GLctx.sampleCoverage(value,!!invert)}Module["_emscripten_glSampleCoverage"]=_emscripten_glSampleCoverage;_emscripten_glSampleCoverage.sig="vii";function _emscripten_glScissor(x0,x1,x2,x3){GLctx["scissor"](x0,x1,x2,x3)}Module["_emscripten_glScissor"]=_emscripten_glScissor;_emscripten_glScissor.sig="viiii";function _emscripten_glShaderBinary(){GL.recordError(1280)}Module["_emscripten_glShaderBinary"]=_emscripten_glShaderBinary;_emscripten_glShaderBinary.sig="v";function _emscripten_glShaderSource(shader,count,string,length){var source=GL.getSource(shader,count,string,length);GLctx.shaderSource(GL.shaders[shader],source)}Module["_emscripten_glShaderSource"]=_emscripten_glShaderSource;_emscripten_glShaderSource.sig="viiii";function _emscripten_glStencilFunc(x0,x1,x2){GLctx["stencilFunc"](x0,x1,x2)}Module["_emscripten_glStencilFunc"]=_emscripten_glStencilFunc;_emscripten_glStencilFunc.sig="viii";function _emscripten_glStencilFuncSeparate(x0,x1,x2,x3){GLctx["stencilFuncSeparate"](x0,x1,x2,x3)}Module["_emscripten_glStencilFuncSeparate"]=_emscripten_glStencilFuncSeparate;_emscripten_glStencilFuncSeparate.sig="viiii";function _emscripten_glStencilMask(x0){GLctx["stencilMask"](x0)}Module["_emscripten_glStencilMask"]=_emscripten_glStencilMask;_emscripten_glStencilMask.sig="vi";function _emscripten_glStencilMaskSeparate(x0,x1){GLctx["stencilMaskSeparate"](x0,x1)}Module["_emscripten_glStencilMaskSeparate"]=_emscripten_glStencilMaskSeparate;_emscripten_glStencilMaskSeparate.sig="vii";function _emscripten_glStencilOp(x0,x1,x2){GLctx["stencilOp"](x0,x1,x2)}Module["_emscripten_glStencilOp"]=_emscripten_glStencilOp;_emscripten_glStencilOp.sig="viii";function _emscripten_glStencilOpSeparate(x0,x1,x2,x3){GLctx["stencilOpSeparate"](x0,x1,x2,x3)}Module["_emscripten_glStencilOpSeparate"]=_emscripten_glStencilOpSeparate;_emscripten_glStencilOpSeparate.sig="viiii";function _emscripten_glTexImage2D(target,level,internalFormat,width,height,border,format,type,pixels){GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixels?emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat):null)}Module["_emscripten_glTexImage2D"]=_emscripten_glTexImage2D;_emscripten_glTexImage2D.sig="viiiiiiiii";function _emscripten_glTexParameterf(x0,x1,x2){GLctx["texParameterf"](x0,x1,x2)}Module["_emscripten_glTexParameterf"]=_emscripten_glTexParameterf;_emscripten_glTexParameterf.sig="viii";function _emscripten_glTexParameterfv(target,pname,params){var param=HEAPF32[params>>2];GLctx.texParameterf(target,pname,param)}Module["_emscripten_glTexParameterfv"]=_emscripten_glTexParameterfv;_emscripten_glTexParameterfv.sig="viii";function _emscripten_glTexParameteri(x0,x1,x2){GLctx["texParameteri"](x0,x1,x2)}Module["_emscripten_glTexParameteri"]=_emscripten_glTexParameteri;_emscripten_glTexParameteri.sig="viii";function _emscripten_glTexParameteriv(target,pname,params){var param=HEAP32[params>>2];GLctx.texParameteri(target,pname,param)}Module["_emscripten_glTexParameteriv"]=_emscripten_glTexParameteriv;_emscripten_glTexParameteriv.sig="viii";function _emscripten_glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels){var pixelData=null;if(pixels)pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,0);GLctx.texSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixelData)}Module["_emscripten_glTexSubImage2D"]=_emscripten_glTexSubImage2D;_emscripten_glTexSubImage2D.sig="viiiiiiiii";function _emscripten_glUniform1f(location,v0){GLctx.uniform1f(webglGetUniformLocation(location),v0)}Module["_emscripten_glUniform1f"]=_emscripten_glUniform1f;_emscripten_glUniform1f.sig="vif";var miniTempWebGLFloatBuffers=[];Module["miniTempWebGLFloatBuffers"]=miniTempWebGLFloatBuffers;function _emscripten_glUniform1fv(location,count,value){if(count<=288){var view=miniTempWebGLFloatBuffers[count-1];for(var i=0;i>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1fv(webglGetUniformLocation(location),view)}Module["_emscripten_glUniform1fv"]=_emscripten_glUniform1fv;_emscripten_glUniform1fv.sig="viii";function _emscripten_glUniform1i(location,v0){GLctx.uniform1i(webglGetUniformLocation(location),v0)}Module["_emscripten_glUniform1i"]=_emscripten_glUniform1i;_emscripten_glUniform1i.sig="vii";var __miniTempWebGLIntBuffers=[];Module["__miniTempWebGLIntBuffers"]=__miniTempWebGLIntBuffers;function _emscripten_glUniform1iv(location,count,value){if(count<=288){var view=__miniTempWebGLIntBuffers[count-1];for(var i=0;i>2]}}else{var view=HEAP32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1iv(webglGetUniformLocation(location),view)}Module["_emscripten_glUniform1iv"]=_emscripten_glUniform1iv;_emscripten_glUniform1iv.sig="viii";function _emscripten_glUniform2f(location,v0,v1){GLctx.uniform2f(webglGetUniformLocation(location),v0,v1)}Module["_emscripten_glUniform2f"]=_emscripten_glUniform2f;_emscripten_glUniform2f.sig="viff";function _emscripten_glUniform2fv(location,count,value){if(count<=144){var view=miniTempWebGLFloatBuffers[2*count-1];for(var i=0;i<2*count;i+=2){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2fv(webglGetUniformLocation(location),view)}Module["_emscripten_glUniform2fv"]=_emscripten_glUniform2fv;_emscripten_glUniform2fv.sig="viii";function _emscripten_glUniform2i(location,v0,v1){GLctx.uniform2i(webglGetUniformLocation(location),v0,v1)}Module["_emscripten_glUniform2i"]=_emscripten_glUniform2i;_emscripten_glUniform2i.sig="viii";function _emscripten_glUniform2iv(location,count,value){if(count<=144){var view=__miniTempWebGLIntBuffers[2*count-1];for(var i=0;i<2*count;i+=2){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2iv(webglGetUniformLocation(location),view)}Module["_emscripten_glUniform2iv"]=_emscripten_glUniform2iv;_emscripten_glUniform2iv.sig="viii";function _emscripten_glUniform3f(location,v0,v1,v2){GLctx.uniform3f(webglGetUniformLocation(location),v0,v1,v2)}Module["_emscripten_glUniform3f"]=_emscripten_glUniform3f;_emscripten_glUniform3f.sig="vifff";function _emscripten_glUniform3fv(location,count,value){if(count<=96){var view=miniTempWebGLFloatBuffers[3*count-1];for(var i=0;i<3*count;i+=3){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3fv(webglGetUniformLocation(location),view)}Module["_emscripten_glUniform3fv"]=_emscripten_glUniform3fv;_emscripten_glUniform3fv.sig="viii";function _emscripten_glUniform3i(location,v0,v1,v2){GLctx.uniform3i(webglGetUniformLocation(location),v0,v1,v2)}Module["_emscripten_glUniform3i"]=_emscripten_glUniform3i;_emscripten_glUniform3i.sig="viiii";function _emscripten_glUniform3iv(location,count,value){if(count<=96){var view=__miniTempWebGLIntBuffers[3*count-1];for(var i=0;i<3*count;i+=3){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3iv(webglGetUniformLocation(location),view)}Module["_emscripten_glUniform3iv"]=_emscripten_glUniform3iv;_emscripten_glUniform3iv.sig="viii";function _emscripten_glUniform4f(location,v0,v1,v2,v3){GLctx.uniform4f(webglGetUniformLocation(location),v0,v1,v2,v3)}Module["_emscripten_glUniform4f"]=_emscripten_glUniform4f;_emscripten_glUniform4f.sig="viffff";function _emscripten_glUniform4fv(location,count,value){if(count<=72){var view=miniTempWebGLFloatBuffers[4*count-1];var heap=HEAPF32;value>>=2;for(var i=0;i<4*count;i+=4){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4fv(webglGetUniformLocation(location),view)}Module["_emscripten_glUniform4fv"]=_emscripten_glUniform4fv;_emscripten_glUniform4fv.sig="viii";function _emscripten_glUniform4i(location,v0,v1,v2,v3){GLctx.uniform4i(webglGetUniformLocation(location),v0,v1,v2,v3)}Module["_emscripten_glUniform4i"]=_emscripten_glUniform4i;_emscripten_glUniform4i.sig="viiiii";function _emscripten_glUniform4iv(location,count,value){if(count<=72){var view=__miniTempWebGLIntBuffers[4*count-1];for(var i=0;i<4*count;i+=4){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2];view[i+3]=HEAP32[value+(4*i+12)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4iv(webglGetUniformLocation(location),view)}Module["_emscripten_glUniform4iv"]=_emscripten_glUniform4iv;_emscripten_glUniform4iv.sig="viii";function _emscripten_glUniformMatrix2fv(location,count,transpose,value){if(count<=72){var view=miniTempWebGLFloatBuffers[4*count-1];for(var i=0;i<4*count;i+=4){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniformMatrix2fv(webglGetUniformLocation(location),!!transpose,view)}Module["_emscripten_glUniformMatrix2fv"]=_emscripten_glUniformMatrix2fv;_emscripten_glUniformMatrix2fv.sig="viiii";function _emscripten_glUniformMatrix3fv(location,count,transpose,value){if(count<=32){var view=miniTempWebGLFloatBuffers[9*count-1];for(var i=0;i<9*count;i+=9){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2];view[i+4]=HEAPF32[value+(4*i+16)>>2];view[i+5]=HEAPF32[value+(4*i+20)>>2];view[i+6]=HEAPF32[value+(4*i+24)>>2];view[i+7]=HEAPF32[value+(4*i+28)>>2];view[i+8]=HEAPF32[value+(4*i+32)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*36>>2)}GLctx.uniformMatrix3fv(webglGetUniformLocation(location),!!transpose,view)}Module["_emscripten_glUniformMatrix3fv"]=_emscripten_glUniformMatrix3fv;_emscripten_glUniformMatrix3fv.sig="viiii";function _emscripten_glUniformMatrix4fv(location,count,transpose,value){if(count<=18){var view=miniTempWebGLFloatBuffers[16*count-1];var heap=HEAPF32;value>>=2;for(var i=0;i<16*count;i+=16){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3];view[i+4]=heap[dst+4];view[i+5]=heap[dst+5];view[i+6]=heap[dst+6];view[i+7]=heap[dst+7];view[i+8]=heap[dst+8];view[i+9]=heap[dst+9];view[i+10]=heap[dst+10];view[i+11]=heap[dst+11];view[i+12]=heap[dst+12];view[i+13]=heap[dst+13];view[i+14]=heap[dst+14];view[i+15]=heap[dst+15]}}else{var view=HEAPF32.subarray(value>>2,value+count*64>>2)}GLctx.uniformMatrix4fv(webglGetUniformLocation(location),!!transpose,view)}Module["_emscripten_glUniformMatrix4fv"]=_emscripten_glUniformMatrix4fv;_emscripten_glUniformMatrix4fv.sig="viiii";function _emscripten_glUseProgram(program){program=GL.programs[program];GLctx.useProgram(program);GLctx.currentProgram=program}Module["_emscripten_glUseProgram"]=_emscripten_glUseProgram;_emscripten_glUseProgram.sig="vi";function _emscripten_glValidateProgram(program){GLctx.validateProgram(GL.programs[program])}Module["_emscripten_glValidateProgram"]=_emscripten_glValidateProgram;_emscripten_glValidateProgram.sig="vi";function _emscripten_glVertexAttrib1f(x0,x1){GLctx["vertexAttrib1f"](x0,x1)}Module["_emscripten_glVertexAttrib1f"]=_emscripten_glVertexAttrib1f;_emscripten_glVertexAttrib1f.sig="vif";function _emscripten_glVertexAttrib1fv(index,v){GLctx.vertexAttrib1f(index,HEAPF32[v>>2])}Module["_emscripten_glVertexAttrib1fv"]=_emscripten_glVertexAttrib1fv;_emscripten_glVertexAttrib1fv.sig="vii";function _emscripten_glVertexAttrib2f(x0,x1,x2){GLctx["vertexAttrib2f"](x0,x1,x2)}Module["_emscripten_glVertexAttrib2f"]=_emscripten_glVertexAttrib2f;_emscripten_glVertexAttrib2f.sig="viff";function _emscripten_glVertexAttrib2fv(index,v){GLctx.vertexAttrib2f(index,HEAPF32[v>>2],HEAPF32[v+4>>2])}Module["_emscripten_glVertexAttrib2fv"]=_emscripten_glVertexAttrib2fv;_emscripten_glVertexAttrib2fv.sig="vii";function _emscripten_glVertexAttrib3f(x0,x1,x2,x3){GLctx["vertexAttrib3f"](x0,x1,x2,x3)}Module["_emscripten_glVertexAttrib3f"]=_emscripten_glVertexAttrib3f;_emscripten_glVertexAttrib3f.sig="vifff";function _emscripten_glVertexAttrib3fv(index,v){GLctx.vertexAttrib3f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2])}Module["_emscripten_glVertexAttrib3fv"]=_emscripten_glVertexAttrib3fv;_emscripten_glVertexAttrib3fv.sig="vii";function _emscripten_glVertexAttrib4f(x0,x1,x2,x3,x4){GLctx["vertexAttrib4f"](x0,x1,x2,x3,x4)}Module["_emscripten_glVertexAttrib4f"]=_emscripten_glVertexAttrib4f;_emscripten_glVertexAttrib4f.sig="viffff";function _emscripten_glVertexAttrib4fv(index,v){GLctx.vertexAttrib4f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2],HEAPF32[v+12>>2])}Module["_emscripten_glVertexAttrib4fv"]=_emscripten_glVertexAttrib4fv;_emscripten_glVertexAttrib4fv.sig="vii";function _emscripten_glVertexAttribDivisorANGLE(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}Module["_emscripten_glVertexAttribDivisorANGLE"]=_emscripten_glVertexAttribDivisorANGLE;_emscripten_glVertexAttribDivisorANGLE.sig="vii";function _emscripten_glVertexAttribPointer(index,size,type,normalized,stride,ptr){GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)}Module["_emscripten_glVertexAttribPointer"]=_emscripten_glVertexAttribPointer;_emscripten_glVertexAttribPointer.sig="viiiiii";function _emscripten_glViewport(x0,x1,x2,x3){GLctx["viewport"](x0,x1,x2,x3)}Module["_emscripten_glViewport"]=_emscripten_glViewport;_emscripten_glViewport.sig="viiii";function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}Module["_emscripten_memcpy_big"]=_emscripten_memcpy_big;_emscripten_memcpy_big.sig="vppp";function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}Module["emscripten_realloc_buffer"]=emscripten_realloc_buffer;function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}Module["_emscripten_resize_heap"]=_emscripten_resize_heap;_emscripten_resize_heap.sig="ip";function getExecutableName(){return thisProgram||"./this.program"}Module["getExecutableName"]=getExecutableName;function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}Module["getEnvStrings"]=getEnvStrings;function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}Module["writeAsciiToMemory"]=writeAsciiToMemory;function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}Module["_environ_get"]=_environ_get;_environ_get.sig="ipp";function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}Module["_environ_sizes_get"]=_environ_sizes_get;_environ_sizes_get.sig="ipp";function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}Module["_fd_close"]=_fd_close;_fd_close.sig="ii";function _fd_fdstat_get(fd,pbuf){try{var stream=SYSCALLS.getStreamFromFD(fd);var type=stream.tty?2:FS.isDir(stream.mode)?3:FS.isLink(stream.mode)?7:4;HEAP8[pbuf>>0]=type;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}Module["_fd_fdstat_get"]=_fd_fdstat_get;_fd_fdstat_get.sig="iip";function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}Module["_fd_pread"]=_fd_pread;_fd_pread.sig="iippjp";function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret}Module["doWritev"]=doWritev;function _fd_pwrite(fd,iov,iovcnt,offset,pnum){try{offset=bigintToI53Checked(offset);if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt,offset);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}Module["_fd_pwrite"]=_fd_pwrite;_fd_pwrite.sig="iippjp";function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}Module["_fd_read"]=_fd_read;_fd_read.sig="iippp";function _fd_seek(fd,offset,whence,newOffset){try{offset=bigintToI53Checked(offset);if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}Module["_fd_seek"]=_fd_seek;_fd_seek.sig="iijip";function _fd_sync(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);if(stream.stream_ops&&stream.stream_ops.fsync){return stream.stream_ops.fsync(stream)}return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}Module["_fd_sync"]=_fd_sync;_fd_sync.sig="ii";function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}Module["_fd_write"]=_fd_write;_fd_write.sig="iippp";function _getaddrinfo(node,service,hint,out){var addrs=[];var canon=null;var addr=0;var port=0;var flags=0;var family=0;var type=0;var proto=0;var ai,last;function allocaddrinfo(family,type,proto,canon,addr,port){var sa,salen,ai;var errno;salen=family===10?28:16;addr=family===10?inetNtop6(addr):inetNtop4(addr);sa=_malloc(salen);errno=writeSockaddr(sa,family,addr,port);assert(!errno);ai=_malloc(32);HEAP32[ai+4>>2]=family;HEAP32[ai+8>>2]=type;HEAP32[ai+12>>2]=proto;HEAP32[ai+24>>2]=canon;HEAPU32[ai+20>>2]=sa;if(family===10){HEAP32[ai+16>>2]=28}else{HEAP32[ai+16>>2]=16}HEAP32[ai+28>>2]=0;return ai}if(hint){flags=HEAP32[hint>>2];family=HEAP32[hint+4>>2];type=HEAP32[hint+8>>2];proto=HEAP32[hint+12>>2]}if(type&&!proto){proto=type===2?17:6}if(!type&&proto){type=proto===17?2:1}if(proto===0){proto=6}if(type===0){type=1}if(!node&&!service){return-2}if(flags&~(1|2|4|1024|8|16|32)){return-1}if(hint!==0&&HEAP32[hint>>2]&2&&!node){return-1}if(flags&32){return-2}if(type!==0&&type!==1&&type!==2){return-7}if(family!==0&&family!==2&&family!==10){return-6}if(service){service=UTF8ToString(service);port=parseInt(service,10);if(isNaN(port)){if(flags&1024){return-2}return-8}}if(!node){if(family===0){family=2}if((flags&1)===0){if(family===2){addr=_htonl(2130706433)}else{addr=[0,0,0,1]}}ai=allocaddrinfo(family,type,proto,null,addr,port);HEAPU32[out>>2]=ai;return 0}node=UTF8ToString(node);addr=inetPton4(node);if(addr!==null){if(family===0||family===2){family=2}else if(family===10&&flags&8){addr=[0,0,_htonl(65535),addr];family=10}else{return-2}}else{addr=inetPton6(node);if(addr!==null){if(family===0||family===10){family=10}else{return-2}}}if(addr!=null){ai=allocaddrinfo(family,type,proto,node,addr,port);HEAPU32[out>>2]=ai;return 0}if(flags&4){return-2}node=DNS.lookup_name(node);addr=inetPton4(node);if(family===0){family=2}else if(family===10){addr=[0,0,_htonl(65535),addr]}ai=allocaddrinfo(family,type,proto,null,addr,port);HEAPU32[out>>2]=ai;return 0}Module["_getaddrinfo"]=_getaddrinfo;_getaddrinfo.sig="ipppp";function _getentropy(buffer,size){if(!_getentropy.randomDevice){_getentropy.randomDevice=getRandomDevice()}for(var i=0;i>0]=_getentropy.randomDevice()}return 0}Module["_getentropy"]=_getentropy;_getentropy.sig="ipp";function getHostByName(name){var ret=_malloc(20);var nameBuf=_malloc(name.length+1);stringToUTF8(name,nameBuf,name.length+1);HEAPU32[ret>>2]=nameBuf;var aliasesBuf=_malloc(4);HEAPU32[aliasesBuf>>2]=0;HEAPU32[ret+4>>2]=aliasesBuf;var afinet=2;HEAP32[ret+8>>2]=afinet;HEAP32[ret+12>>2]=4;var addrListBuf=_malloc(12);HEAPU32[addrListBuf>>2]=addrListBuf+8;HEAPU32[addrListBuf+4>>2]=0;HEAP32[addrListBuf+8>>2]=inetPton4(DNS.lookup_name(name));HEAPU32[ret+16>>2]=addrListBuf;return ret}Module["getHostByName"]=getHostByName;function _gethostbyaddr(addr,addrlen,type){if(type!==2){setErrNo(5);return null}addr=HEAP32[addr>>2];var host=inetNtop4(addr);var lookup=DNS.lookup_addr(host);if(lookup){host=lookup}return getHostByName(host)}Module["_gethostbyaddr"]=_gethostbyaddr;_gethostbyaddr.sig="ipii";function _gethostbyname(name){return getHostByName(UTF8ToString(name))}Module["_gethostbyname"]=_gethostbyname;_gethostbyname.sig="pp";function _getloadavg(loadavg,nelem){var limit=Math.min(nelem,3);var doubleSize=8;for(var i=0;i>3]=.1}return limit}Module["_getloadavg"]=_getloadavg;_getloadavg.sig="ipi";function _getnameinfo(sa,salen,node,nodelen,serv,servlen,flags){var info=readSockaddr(sa,salen);if(info.errno){return-6}var port=info.port;var addr=info.addr;var overflowed=false;if(node&&nodelen){var lookup;if(flags&1||!(lookup=DNS.lookup_addr(addr))){if(flags&8){return-2}}else{addr=lookup}var numBytesWrittenExclNull=stringToUTF8(addr,node,nodelen);if(numBytesWrittenExclNull+1>=nodelen){overflowed=true}}if(serv&&servlen){port=""+port;var numBytesWrittenExclNull=stringToUTF8(port,serv,servlen);if(numBytesWrittenExclNull+1>=servlen){overflowed=true}}if(overflowed){return-12}return 0}Module["_getnameinfo"]=_getnameinfo;_getnameinfo.sig="ipipipii";var Protocols={list:[],map:{}};Module["Protocols"]=Protocols;function _setprotoent(stayopen){function allocprotoent(name,proto,aliases){var nameBuf=_malloc(name.length+1);writeAsciiToMemory(name,nameBuf);var j=0;var length=aliases.length;var aliasListBuf=_malloc((length+1)*4);for(var i=0;i>2]=aliasBuf}HEAPU32[aliasListBuf+j>>2]=0;var pe=_malloc(12);HEAPU32[pe>>2]=nameBuf;HEAPU32[pe+4>>2]=aliasListBuf;HEAP32[pe+8>>2]=proto;return pe}var list=Protocols.list;var map=Protocols.map;if(list.length===0){var entry=allocprotoent("tcp",6,["TCP"]);list.push(entry);map["tcp"]=map["6"]=entry;entry=allocprotoent("udp",17,["UDP"]);list.push(entry);map["udp"]=map["17"]=entry}_setprotoent.index=0}Module["_setprotoent"]=_setprotoent;function _getprotobyname(name){name=UTF8ToString(name);_setprotoent(true);var result=Protocols.map[name];return result}Module["_getprotobyname"]=_getprotobyname;function __arraySum(array,index){var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum}Module["__arraySum"]=__arraySum;var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];Module["__MONTH_DAYS_LEAP"]=__MONTH_DAYS_LEAP;var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];Module["__MONTH_DAYS_REGULAR"]=__MONTH_DAYS_REGULAR;function __addDays(date,days){var newDate=new Date(date.getTime());while(days>0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}Module["__addDays"]=__addDays;function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}Module["writeArrayToMemory"]=writeArrayToMemory;function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}Module["_strftime"]=_strftime;_strftime.sig="ppppp";function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}Module["_strftime_l"]=_strftime_l;_strftime_l.sig="pppppp";function _system(command){if(ENVIRONMENT_IS_NODE){if(!command)return 1;var cmdstr=UTF8ToString(command);if(!cmdstr.length)return 0;var cp=require("child_process");var ret=cp.spawnSync(cmdstr,[],{shell:true,stdio:"inherit"});var _W_EXITCODE=(ret,sig)=>ret<<8|sig;if(ret.status===null){var signalToNumber=sig=>{switch(sig){case"SIGHUP":return 1;case"SIGINT":return 2;case"SIGQUIT":return 3;case"SIGFPE":return 8;case"SIGKILL":return 9;case"SIGALRM":return 14;case"SIGTERM":return 15}return 2};return _W_EXITCODE(0,signalToNumber(ret.signal))}return _W_EXITCODE(ret.status,0)}if(!command)return 0;setErrNo(52);return-1}Module["_system"]=_system;_system.sig="ip";function ptrToString(ptr){return"0x"+ptr.toString(16).padStart(8,"0")}Module["ptrToString"]=ptrToString;function _emscripten_notify_memory_growth(memoryIndex){updateGlobalBufferAndViews(wasmMemory.buffer)}Module["_emscripten_notify_memory_growth"]=_emscripten_notify_memory_growth;function ___asctime_r(tmPtr,buf){var date={tm_sec:HEAP32[tmPtr>>2],tm_min:HEAP32[tmPtr+4>>2],tm_hour:HEAP32[tmPtr+8>>2],tm_mday:HEAP32[tmPtr+12>>2],tm_mon:HEAP32[tmPtr+16>>2],tm_year:HEAP32[tmPtr+20>>2],tm_wday:HEAP32[tmPtr+24>>2]};var days=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var s=days[date.tm_wday]+" "+months[date.tm_mon]+(date.tm_mday<10?" ":" ")+date.tm_mday+(date.tm_hour<10?" 0":" ")+date.tm_hour+(date.tm_min<10?":0":":")+date.tm_min+(date.tm_sec<10?":0":":")+date.tm_sec+" "+(1900+date.tm_year)+"\n";stringToUTF8(s,buf,26);return buf}Module["___asctime_r"]=___asctime_r;___asctime_r.sig="ppp";function _strptime(buf,format,tm){var pattern=UTF8ToString(format);var SPECIAL_CHARS="\\!@#$^&*()+=-[]/{}|:<>?,.";for(var i=0,ii=SPECIAL_CHARS.length;i=0;i=pattern.indexOf("%")){capture.push(pattern[i+1]);pattern=pattern.replace(new RegExp("\\%"+pattern[i+1],"g"),"")}var matches=new RegExp("^"+pattern,"i").exec(UTF8ToString(buf));function initDate(){function fixup(value,min,max){return typeof value!="number"||isNaN(value)?min:value>=min?value<=max?value:max:min}return{year:fixup(HEAP32[tm+20>>2]+1900,1970,9999),month:fixup(HEAP32[tm+16>>2],0,11),day:fixup(HEAP32[tm+12>>2],1,31),hour:fixup(HEAP32[tm+8>>2],0,23),min:fixup(HEAP32[tm+4>>2],0,59),sec:fixup(HEAP32[tm>>2],0,59)}}if(matches){var date=initDate();var value;var getMatch=symbol=>{var pos=capture.indexOf(symbol);if(pos>=0){return matches[pos+1]}return};if(value=getMatch("S")){date.sec=jstoi_q(value)}if(value=getMatch("M")){date.min=jstoi_q(value)}if(value=getMatch("H")){date.hour=jstoi_q(value)}else if(value=getMatch("I")){var hour=jstoi_q(value);if(value=getMatch("p")){hour+=value.toUpperCase()[0]==="P"?12:0}date.hour=hour}if(value=getMatch("Y")){date.year=jstoi_q(value)}else if(value=getMatch("y")){var year=jstoi_q(value);if(value=getMatch("C")){year+=jstoi_q(value)*100}else{year+=year<69?2e3:1900}date.year=year}if(value=getMatch("m")){date.month=jstoi_q(value)-1}else if(value=getMatch("b")){date.month=MONTH_NUMBERS[value.substring(0,3).toUpperCase()]||0}if(value=getMatch("d")){date.day=jstoi_q(value)}else if(value=getMatch("j")){var day=jstoi_q(value);var leapYear=__isLeapYear(date.year);for(var month=0;month<12;++month){var daysUntilMonth=__arraySum(leapYear?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,month-1);if(day<=daysUntilMonth+(leapYear?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[month]){date.day=day-daysUntilMonth}}}else if(value=getMatch("a")){var weekDay=value.substring(0,3).toUpperCase();if(value=getMatch("U")){var weekDayNumber=DAY_NUMBERS_SUN_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===0){endDate=__addDays(janFirst,weekDayNumber+7*(weekNumber-1))}else{endDate=__addDays(janFirst,7-janFirst.getDay()+weekDayNumber+7*(weekNumber-1))}date.day=endDate.getDate();date.month=endDate.getMonth()}else if(value=getMatch("W")){var weekDayNumber=DAY_NUMBERS_MON_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===1){endDate=__addDays(janFirst,weekDayNumber+7*(weekNumber-1))}else{endDate=__addDays(janFirst,7-janFirst.getDay()+1+weekDayNumber+7*(weekNumber-1))}date.day=endDate.getDate();date.month=endDate.getMonth()}}var fullDate=new Date(date.year,date.month,date.day,date.hour,date.min,date.sec,0);HEAP32[tm>>2]=fullDate.getSeconds();HEAP32[tm+4>>2]=fullDate.getMinutes();HEAP32[tm+8>>2]=fullDate.getHours();HEAP32[tm+12>>2]=fullDate.getDate();HEAP32[tm+16>>2]=fullDate.getMonth();HEAP32[tm+20>>2]=fullDate.getFullYear()-1900;HEAP32[tm+24>>2]=fullDate.getDay();HEAP32[tm+28>>2]=__arraySum(__isLeapYear(fullDate.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,fullDate.getMonth()-1)+fullDate.getDate()-1;HEAP32[tm+32>>2]=0;return buf+intArrayFromString(matches[0]).length-1}return 0}Module["_strptime"]=_strptime;_strptime.sig="pppp";function _strptime_l(buf,format,tm){return _strptime(buf,format,tm)}Module["_strptime_l"]=_strptime_l;_strptime_l.sig="pppp";var ERRNO_MESSAGES={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"};Module["ERRNO_MESSAGES"]=ERRNO_MESSAGES;function _gethostbyname_r(name,ret,buf,buflen,out,err){var data=_gethostbyname(name);_memcpy(ret,data,20);_free(data);HEAP32[err>>2]=0;HEAPU32[out>>2]=ret;return 0}Module["_gethostbyname_r"]=_gethostbyname_r;_gethostbyname_r.sig="ipppipp";function _endprotoent(){}Module["_endprotoent"]=_endprotoent;function _getprotoent(number){if(_setprotoent.index===Protocols.list.length){return 0}var result=Protocols.list[_setprotoent.index++];return result}Module["_getprotoent"]=_getprotoent;function _getprotobynumber(number){_setprotoent(true);var result=Protocols.map[number];return result}Module["_getprotobynumber"]=_getprotobynumber;function _emscripten_run_script(ptr){eval(UTF8ToString(ptr))}Module["_emscripten_run_script"]=_emscripten_run_script;_emscripten_run_script.sig="vp";function _emscripten_run_script_int(ptr){return eval(UTF8ToString(ptr))|0}Module["_emscripten_run_script_int"]=_emscripten_run_script_int;_emscripten_run_script_int.sig="ip";function _emscripten_run_script_string(ptr){var s=eval(UTF8ToString(ptr));if(s==null){return 0}s+="";var me=_emscripten_run_script_string;var len=lengthBytesUTF8(s);if(!me.bufferSize||me.bufferSize=4){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]|0}else{callstack+=line+"\n";continue}}var haveSourceMap=false;if(flags&8){var orig=emscripten_source_map.originalPositionFor({line:lineno,column:column});haveSourceMap=orig&&orig.source;if(haveSourceMap){if(flags&64){orig.source=orig.source.substring(orig.source.replace(/\\/g,"/").lastIndexOf("/")+1)}callstack+=" at "+symbolName+" ("+orig.source+":"+orig.line+":"+orig.column+")\n"}}if(flags&16||!haveSourceMap){if(flags&64){file=file.substring(file.replace(/\\/g,"/").lastIndexOf("/")+1)}callstack+=(haveSourceMap?" = "+symbolName:" at "+symbolName)+" ("+file+":"+lineno+":"+column+")\n"}if(flags&128&&stack_args[0]){if(stack_args[1]==symbolName&&stack_args[2].length>0){callstack=callstack.replace(/\s+$/,"");callstack+=" with values: "+stack_args[1]+stack_args[2]+"\n"}stack_args=traverseStack(stack_args[0])}}callstack=callstack.replace(/\s+$/,"");return callstack}Module["_emscripten_get_callstack_js"]=_emscripten_get_callstack_js;function _emscripten_get_callstack(flags,str,maxbytes){var callstack=_emscripten_get_callstack_js(flags);if(!str||maxbytes<=0){return lengthBytesUTF8(callstack)+1}var bytesWrittenExcludingNull=stringToUTF8(callstack,str,maxbytes);return bytesWrittenExcludingNull+1}Module["_emscripten_get_callstack"]=_emscripten_get_callstack;function _emscripten_log_js(flags,str){if(flags&24){str=str.replace(/\s+$/,"");str+=(str.length>0?"\n":"")+_emscripten_get_callstack_js(flags)}if(flags&1){if(flags&4){console.error(str)}else if(flags&2){console.warn(str)}else if(flags&512){console.info(str)}else if(flags&256){console.debug(str)}else{console.log(str)}}else if(flags&6){err(str)}else{out(str)}}Module["_emscripten_log_js"]=_emscripten_log_js;function reallyNegative(x){return x<0||x===0&&1/x===-Infinity}Module["reallyNegative"]=reallyNegative;function convertI32PairToI53(lo,hi){return(lo>>>0)+hi*4294967296}Module["convertI32PairToI53"]=convertI32PairToI53;function convertU32PairToI53(lo,hi){return(lo>>>0)+(hi>>>0)*4294967296}Module["convertU32PairToI53"]=convertU32PairToI53;function reSign(value,bits){if(value<=0){return value}var half=bits<=32?Math.abs(1<=half&&(bits<=32||value>half)){value=-2*half+value}return value}Module["reSign"]=reSign;function unSign(value,bits){if(value>=0){return value}return bits<=32?2*Math.abs(1<>3];argIndex+=8}else if(type=="i64"){ret=[HEAP32[argIndex>>2],HEAP32[argIndex+4>>2]];argIndex+=8}else{type="i32";ret=HEAP32[argIndex>>2];argIndex+=4}return ret}var ret=[];var curr,next,currArg;while(1){var startTextIndex=textIndex;curr=HEAP8[textIndex>>0];if(curr===0)break;next=HEAP8[textIndex+1>>0];if(curr==37){var flagAlwaysSigned=false;var flagLeftAlign=false;var flagAlternative=false;var flagZeroPad=false;var flagPadSign=false;flagsLoop:while(1){switch(next){case 43:flagAlwaysSigned=true;break;case 45:flagLeftAlign=true;break;case 35:flagAlternative=true;break;case 48:if(flagZeroPad){break flagsLoop}else{flagZeroPad=true;break}case 32:flagPadSign=true;break;default:break flagsLoop}textIndex++;next=HEAP8[textIndex+1>>0]}var width=0;if(next==42){width=getNextArg("i32");textIndex++;next=HEAP8[textIndex+1>>0]}else{while(next>=48&&next<=57){width=width*10+(next-48);textIndex++;next=HEAP8[textIndex+1>>0]}}var precisionSet=false,precision=-1;if(next==46){precision=0;precisionSet=true;textIndex++;next=HEAP8[textIndex+1>>0];if(next==42){precision=getNextArg("i32");textIndex++}else{while(1){var precisionChr=HEAP8[textIndex+1>>0];if(precisionChr<48||precisionChr>57)break;precision=precision*10+(precisionChr-48);textIndex++}}next=HEAP8[textIndex+1>>0]}if(precision<0){precision=6;precisionSet=false}var argSize;switch(String.fromCharCode(next)){case"h":var nextNext=HEAP8[textIndex+2>>0];if(nextNext==104){textIndex++;argSize=1}else{argSize=2}break;case"l":var nextNext=HEAP8[textIndex+2>>0];if(nextNext==108){textIndex++;argSize=8}else{argSize=4}break;case"L":case"q":case"j":argSize=8;break;case"z":case"t":case"I":argSize=4;break;default:argSize=null}if(argSize)textIndex++;next=HEAP8[textIndex+1>>0];switch(String.fromCharCode(next)){case"d":case"i":case"u":case"o":case"x":case"X":case"p":{var signed=next==100||next==105;argSize=argSize||4;currArg=getNextArg("i"+argSize*8);var argText;if(argSize==8){currArg=next==117?convertU32PairToI53(currArg[0],currArg[1]):convertI32PairToI53(currArg[0],currArg[1])}if(argSize<=4){var limit=Math.pow(256,argSize)-1;currArg=(signed?reSign:unSign)(currArg&limit,argSize*8)}var currAbsArg=Math.abs(currArg);var prefix="";if(next==100||next==105){argText=reSign(currArg,8*argSize).toString(10)}else if(next==117){argText=unSign(currArg,8*argSize).toString(10);currArg=Math.abs(currArg)}else if(next==111){argText=(flagAlternative?"0":"")+currAbsArg.toString(8)}else if(next==120||next==88){prefix=flagAlternative&&currArg!=0?"0x":"";if(currArg<0){currArg=-currArg;argText=(currAbsArg-1).toString(16);var buffer=[];for(var i=0;i=0){if(flagAlwaysSigned){prefix="+"+prefix}else if(flagPadSign){prefix=" "+prefix}}if(argText.charAt(0)=="-"){prefix="-"+prefix;argText=argText.substr(1)}while(prefix.length+argText.lengthexponent&&exponent>=-4){next=(next==103?"f":"F").charCodeAt(0);precision-=exponent+1}else{next=(next==103?"e":"E").charCodeAt(0);precision--}effectivePrecision=Math.min(precision,20)}if(next==101||next==69){argText=currArg.toExponential(effectivePrecision);if(/[eE][-+]\d$/.test(argText)){argText=argText.slice(0,-1)+"0"+argText.slice(-1)}}else if(next==102||next==70){argText=currArg.toFixed(effectivePrecision);if(currArg===0&&reallyNegative(currArg)){argText="-"+argText}}var parts=argText.split("e");if(isGeneral&&!flagAlternative){while(parts[0].length>1&&parts[0].includes(".")&&(parts[0].slice(-1)=="0"||parts[0].slice(-1)==".")){parts[0]=parts[0].slice(0,-1)}}else{if(flagAlternative&&argText.indexOf(".")==-1)parts[0]+=".";while(precision>effectivePrecision++)parts[0]+="0"}argText=parts[0]+(parts.length>1?"e"+parts[1]:"");if(next==69)argText=argText.toUpperCase();if(currArg>=0){if(flagAlwaysSigned){argText="+"+argText}else if(flagPadSign){argText=" "+argText}}}while(argText.length>0])}}else{ret=ret.concat(intArrayFromString("(null)".substr(0,argLength),true))}if(flagLeftAlign){while(argLength0){ret.push(32)}if(!flagLeftAlign)ret.push(getNextArg("i8"));break}case"n":{var ptr=getNextArg("i32*");HEAP32[ptr>>2]=ret.length;break}case"%":{ret.push(curr);break}default:{for(var i=startTextIndex;i>0])}}}textIndex+=2}else{ret.push(curr);textIndex+=1}}return ret}Module["formatString"]=formatString;function _emscripten_log(flags,format,varargs){var result=formatString(format,varargs);var str=UTF8ArrayToString(result,0);_emscripten_log_js(flags,str)}Module["_emscripten_log"]=_emscripten_log;_emscripten_log.sig="vipp";function _emscripten_get_compiler_setting(name){throw"You must build with -sRETAIN_COMPILER_SETTINGS for getCompilerSetting or emscripten_get_compiler_setting to work"}Module["_emscripten_get_compiler_setting"]=_emscripten_get_compiler_setting;_emscripten_get_compiler_setting.sig="pp";function _emscripten_has_asyncify(){return 0}Module["_emscripten_has_asyncify"]=_emscripten_has_asyncify;function _emscripten_debugger(){debugger}Module["_emscripten_debugger"]=_emscripten_debugger;function _emscripten_print_double(x,to,max){var str=x+"";if(to)return stringToUTF8(str,to,max);else return lengthBytesUTF8(str)}Module["_emscripten_print_double"]=_emscripten_print_double;_emscripten_print_double.sig="iipi";function convertFrameToPC(frame){abort("Cannot use convertFrameToPC (needed by __builtin_return_address) without -sUSE_OFFSET_CONVERTER");return 0}Module["convertFrameToPC"]=convertFrameToPC;function _emscripten_return_address(level){var callstack=jsStackTrace().split("\n");if(callstack[0]=="Error"){callstack.shift()}var caller=callstack[level+3];return convertFrameToPC(caller)}Module["_emscripten_return_address"]=_emscripten_return_address;_emscripten_return_address.sig="pi";var UNWIND_CACHE={};Module["UNWIND_CACHE"]=UNWIND_CACHE;function saveInUnwindCache(callstack){callstack.forEach(frame=>{var pc=convertFrameToPC(frame);if(pc){UNWIND_CACHE[pc]=frame}})}Module["saveInUnwindCache"]=saveInUnwindCache;function _emscripten_stack_snapshot(){var callstack=jsStackTrace().split("\n");if(callstack[0]=="Error"){callstack.shift()}saveInUnwindCache(callstack);UNWIND_CACHE.last_addr=convertFrameToPC(callstack[3]);UNWIND_CACHE.last_stack=callstack;return UNWIND_CACHE.last_addr}Module["_emscripten_stack_snapshot"]=_emscripten_stack_snapshot;_emscripten_stack_snapshot.sig="p";function _emscripten_stack_unwind_buffer(addr,buffer,count){var stack;if(UNWIND_CACHE.last_addr==addr){stack=UNWIND_CACHE.last_stack}else{stack=jsStackTrace().split("\n");if(stack[0]=="Error"){stack.shift()}saveInUnwindCache(stack)}var offset=3;while(stack[offset]&&convertFrameToPC(stack[offset])!=addr){++offset}for(var i=0;i>2]=convertFrameToPC(stack[i+offset])}return i}Module["_emscripten_stack_unwind_buffer"]=_emscripten_stack_unwind_buffer;_emscripten_stack_unwind_buffer.sig="ippi";function _emscripten_pc_get_function(pc){abort("Cannot use emscripten_pc_get_function without -sUSE_OFFSET_CONVERTER")}Module["_emscripten_pc_get_function"]=_emscripten_pc_get_function;function convertPCtoSourceLocation(pc){if(UNWIND_CACHE.last_get_source_pc==pc)return UNWIND_CACHE.last_source;var match;var source;if(!source){var frame=UNWIND_CACHE[pc];if(!frame)return null;if(match=/\((.*):(\d+):(\d+)\)$/.exec(frame)){source={file:match[1],line:match[2],column:match[3]}}else if(match=/@(.*):(\d+):(\d+)/.exec(frame)){source={file:match[1],line:match[2],column:match[3]}}}UNWIND_CACHE.last_get_source_pc=pc;UNWIND_CACHE.last_source=source;return source}Module["convertPCtoSourceLocation"]=convertPCtoSourceLocation;function _emscripten_pc_get_file(pc){var result=convertPCtoSourceLocation(pc);if(!result)return 0;if(_emscripten_pc_get_file.ret)_free(_emscripten_pc_get_file.ret);_emscripten_pc_get_file.ret=allocateUTF8(result.file);return _emscripten_pc_get_file.ret}Module["_emscripten_pc_get_file"]=_emscripten_pc_get_file;_emscripten_pc_get_file.sig="pp";function _emscripten_pc_get_line(pc){var result=convertPCtoSourceLocation(pc);return result?result.line:0}Module["_emscripten_pc_get_line"]=_emscripten_pc_get_line;_emscripten_pc_get_line.sig="ip";function _emscripten_pc_get_column(pc){var result=convertPCtoSourceLocation(pc);return result?result.column||0:0}Module["_emscripten_pc_get_column"]=_emscripten_pc_get_column;_emscripten_pc_get_column.sig="ip";function _emscripten_get_module_name(buf,length){return stringToUTF8(wasmBinaryFile,buf,length)}Module["_emscripten_get_module_name"]=_emscripten_get_module_name;_emscripten_get_module_name.sig="ppp";function _emscripten_asm_const_double(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}Module["_emscripten_asm_const_double"]=_emscripten_asm_const_double;_emscripten_asm_const_double.sig="dppp";var _emscripten_asm_const_ptr=_emscripten_asm_const_int;Module["_emscripten_asm_const_ptr"]=_emscripten_asm_const_ptr;function runMainThreadEmAsm(code,sigPtr,argbuf,sync){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}Module["runMainThreadEmAsm"]=runMainThreadEmAsm;runMainThreadEmAsm.sig="iippi";function _emscripten_asm_const_int_sync_on_main_thread(code,sigPtr,argbuf){return runMainThreadEmAsm(code,sigPtr,argbuf,1)}Module["_emscripten_asm_const_int_sync_on_main_thread"]=_emscripten_asm_const_int_sync_on_main_thread;_emscripten_asm_const_int_sync_on_main_thread.sig="iiii";var _emscripten_asm_const_double_sync_on_main_thread=_emscripten_asm_const_int_sync_on_main_thread;Module["_emscripten_asm_const_double_sync_on_main_thread"]=_emscripten_asm_const_double_sync_on_main_thread;function _emscripten_asm_const_async_on_main_thread(code,sigPtr,argbuf){return runMainThreadEmAsm(code,sigPtr,argbuf,0)}Module["_emscripten_asm_const_async_on_main_thread"]=_emscripten_asm_const_async_on_main_thread;function jstoi_s(str){return Number(str)}Module["jstoi_s"]=jstoi_s;function __Unwind_Backtrace(func,arg){var trace=_emscripten_get_callstack_js();var parts=trace.split("\n");for(var i=0;i>2];ptr+=4;var len=HEAPU32[ptr>>2];ptr+=4;var content=HEAPU32[ptr>>2];ptr+=4;var name=UTF8ToString(name_addr);FS.createPath("/",PATH.dirname(name),true,true);FS.createDataFile(name,null,HEAP8.subarray(content,content+len),true,true,true)}while(HEAPU32[ptr>>2])}Module["__emscripten_fs_load_embedded_files"]=__emscripten_fs_load_embedded_files;__emscripten_fs_load_embedded_files.sig="vp";function writeI53ToI64Clamped(ptr,num){if(num>0x8000000000000000){HEAPU32[ptr>>2]=4294967295;HEAPU32[ptr+4>>2]=2147483647}else if(num<-0x8000000000000000){HEAPU32[ptr>>2]=0;HEAPU32[ptr+4>>2]=2147483648}else{HEAPU32[ptr>>2]=num;HEAPU32[ptr+4>>2]=(num-HEAPU32[ptr>>2])/4294967296}}Module["writeI53ToI64Clamped"]=writeI53ToI64Clamped;function writeI53ToI64Signaling(ptr,num){if(num>0x8000000000000000||num<-0x8000000000000000){throw"RangeError:"+num}HEAPU32[ptr>>2]=num;HEAPU32[ptr+4>>2]=(num-HEAPU32[ptr>>2])/4294967296}Module["writeI53ToI64Signaling"]=writeI53ToI64Signaling;function writeI53ToU64Clamped(ptr,num){if(num>0x10000000000000000)HEAPU32[ptr>>2]=HEAPU32[ptr+4>>2]=4294967295;else if(num<0)HEAPU32[ptr>>2]=HEAPU32[ptr+4>>2]=0;else{HEAPU32[ptr>>2]=num;HEAPU32[ptr+4>>2]=(num-HEAPU32[ptr>>2])/4294967296}}Module["writeI53ToU64Clamped"]=writeI53ToU64Clamped;function writeI53ToU64Signaling(ptr,num){if(num<0||num>0x10000000000000000){throw"RangeError:"+num}HEAPU32[ptr>>2]=num;HEAPU32[ptr+4>>2]=(num-HEAPU32[ptr>>2])/4294967296}Module["writeI53ToU64Signaling"]=writeI53ToU64Signaling;function readI53FromU64(ptr){return HEAPU32[ptr>>2]+HEAPU32[ptr+4>>2]*4294967296}Module["readI53FromU64"]=readI53FromU64;function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}Module["convertI32PairToI53Checked"]=convertI32PairToI53Checked;function getCFunc(ident){var func=Module["_"+ident];return func}Module["getCFunc"]=getCFunc;function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},"array":arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;itype==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}Module["cwrap"]=cwrap;function removeFunction(index){functionsInTableMap.delete(getWasmTableEntry(index));freeTableIndexes.push(index)}Module["removeFunction"]=removeFunction;function _emscripten_math_cbrt(x){return Math.cbrt(x)}Module["_emscripten_math_cbrt"]=_emscripten_math_cbrt;function _emscripten_math_pow(x,y){return Math.pow(x,y)}Module["_emscripten_math_pow"]=_emscripten_math_pow;function _emscripten_math_random(){return Math.random()}Module["_emscripten_math_random"]=_emscripten_math_random;function _emscripten_math_sign(x){return Math.sign(x)}Module["_emscripten_math_sign"]=_emscripten_math_sign;function _emscripten_math_sqrt(x){return Math.sqrt(x)}Module["_emscripten_math_sqrt"]=_emscripten_math_sqrt;function _emscripten_math_exp(x){return Math.exp(x)}Module["_emscripten_math_exp"]=_emscripten_math_exp;function _emscripten_math_expm1(x){return Math.expm1(x)}Module["_emscripten_math_expm1"]=_emscripten_math_expm1;function _emscripten_math_fmod(x,y){return x%y}Module["_emscripten_math_fmod"]=_emscripten_math_fmod;function _emscripten_math_log(x){return Math.log(x)}Module["_emscripten_math_log"]=_emscripten_math_log;function _emscripten_math_log1p(x){return Math.log1p(x)}Module["_emscripten_math_log1p"]=_emscripten_math_log1p;function _emscripten_math_log10(x){return Math.log10(x)}Module["_emscripten_math_log10"]=_emscripten_math_log10;function _emscripten_math_log2(x){return Math.log2(x)}Module["_emscripten_math_log2"]=_emscripten_math_log2;function _emscripten_math_round(x){return Math.round(x)}Module["_emscripten_math_round"]=_emscripten_math_round;function _emscripten_math_acos(x){return Math.acos(x)}Module["_emscripten_math_acos"]=_emscripten_math_acos;function _emscripten_math_acosh(x){return Math.acosh(x)}Module["_emscripten_math_acosh"]=_emscripten_math_acosh;function _emscripten_math_asin(x){return Math.asin(x)}Module["_emscripten_math_asin"]=_emscripten_math_asin;function _emscripten_math_asinh(x){return Math.asinh(x)}Module["_emscripten_math_asinh"]=_emscripten_math_asinh;function _emscripten_math_atan(x){return Math.atan(x)}Module["_emscripten_math_atan"]=_emscripten_math_atan;function _emscripten_math_atanh(x){return Math.atanh(x)}Module["_emscripten_math_atanh"]=_emscripten_math_atanh;function _emscripten_math_atan2(y,x){return Math.atan2(y,x)}Module["_emscripten_math_atan2"]=_emscripten_math_atan2;function _emscripten_math_cos(x){return Math.cos(x)}Module["_emscripten_math_cos"]=_emscripten_math_cos;function _emscripten_math_cosh(x){return Math.cosh(x)}Module["_emscripten_math_cosh"]=_emscripten_math_cosh;function _emscripten_math_hypot(count,varargs){var args=[];for(var i=0;i>3)+i]);return Math.hypot.apply(null,args)}Module["_emscripten_math_hypot"]=_emscripten_math_hypot;_emscripten_math_hypot.sig="iip";function _emscripten_math_sin(x){return Math.sin(x)}Module["_emscripten_math_sin"]=_emscripten_math_sin;function _emscripten_math_sinh(x){return Math.sinh(x)}Module["_emscripten_math_sinh"]=_emscripten_math_sinh;function _emscripten_math_tan(x){return Math.tan(x)}Module["_emscripten_math_tan"]=_emscripten_math_tan;function _emscripten_math_tanh(x){return Math.tanh(x)}Module["_emscripten_math_tanh"]=_emscripten_math_tanh;function intArrayToString(array){var ret=[];for(var i=0;i255){if(ASSERTIONS){assert(false,"Character code "+chr+" ("+String.fromCharCode(chr)+") at offset "+i+" not in 0x00-0xFF.")}chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}Module["intArrayToString"]=intArrayToString;function AsciiToString(ptr){var str="";while(1){var ch=HEAPU8[ptr++>>0];if(!ch)return str;str+=String.fromCharCode(ch)}}Module["AsciiToString"]=AsciiToString;function stringToAscii(str,outPtr){return writeAsciiToMemory(str,outPtr,false)}Module["stringToAscii"]=stringToAscii;var UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):undefined;Module["UTF16Decoder"]=UTF16Decoder;function UTF16ToString(ptr,maxBytesToRead){var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str}Module["UTF16ToString"]=UTF16ToString;function stringToUTF16(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr}Module["stringToUTF16"]=stringToUTF16;function lengthBytesUTF16(str){return str.length*2}Module["lengthBytesUTF16"]=lengthBytesUTF16;function UTF32ToString(ptr,maxBytesToRead){var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str}Module["UTF32ToString"]=UTF32ToString;function stringToUTF32(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr}Module["stringToUTF32"]=stringToUTF32;function lengthBytesUTF32(str){var len=0;for(var i=0;i=55296&&codeUnit<=57343)++i;len+=4}return len}Module["lengthBytesUTF32"]=lengthBytesUTF32;function writeStringToMemory(string,buffer,dontAddNull){warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var lastChar,end;if(dontAddNull){end=buffer+lengthBytesUTF8(string);lastChar=HEAP8[end]}stringToUTF8(string,buffer,Infinity);if(dontAddNull)HEAP8[end]=lastChar}Module["writeStringToMemory"]=writeStringToMemory;function ___syscall_rename(old_path,new_path){try{old_path=SYSCALLS.getStr(old_path);new_path=SYSCALLS.getStr(new_path);FS.rename(old_path,new_path);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}Module["___syscall_rename"]=___syscall_rename;___syscall_rename.sig="ipp";var JSEvents={inEventHandler:0,removeAllEventListeners:function(){for(var i=JSEvents.eventHandlers.length-1;i>=0;--i){JSEvents._removeHandler(i)}JSEvents.eventHandlers=[];JSEvents.deferredCalls=[]},registerRemoveEventListeners:function(){if(!JSEvents.removeEventListenersRegistered){__ATEXIT__.push(JSEvents.removeAllEventListeners);JSEvents.removeEventListenersRegistered=true}},deferredCalls:[],deferCall:function(targetFunction,precedence,argsList){function arraysHaveEqualContent(arrA,arrB){if(arrA.length!=arrB.length)return false;for(var i in arrA){if(arrA[i]!=arrB[i])return false}return true}for(var i in JSEvents.deferredCalls){var call=JSEvents.deferredCalls[i];if(call.targetFunction==targetFunction&&arraysHaveEqualContent(call.argsList,argsList)){return}}JSEvents.deferredCalls.push({targetFunction:targetFunction,precedence:precedence,argsList:argsList});JSEvents.deferredCalls.sort(function(x,y){return x.precedence2?UTF8ToString(cString):cString}Module["maybeCStringToJsString"]=maybeCStringToJsString;var specialHTMLTargets=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];Module["specialHTMLTargets"]=specialHTMLTargets;function findEventTarget(target){target=maybeCStringToJsString(target);var domElement=specialHTMLTargets[target]||(typeof document!="undefined"?document.querySelector(target):undefined);return domElement}Module["findEventTarget"]=findEventTarget;function registerKeyEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.keyEvent)JSEvents.keyEvent=_malloc(176);var keyEventHandlerFunc=function(e){var keyEventData=JSEvents.keyEvent;HEAPF64[keyEventData>>3]=e.timeStamp;var idx=keyEventData>>2;HEAP32[idx+2]=e.location;HEAP32[idx+3]=e.ctrlKey;HEAP32[idx+4]=e.shiftKey;HEAP32[idx+5]=e.altKey;HEAP32[idx+6]=e.metaKey;HEAP32[idx+7]=e.repeat;HEAP32[idx+8]=e.charCode;HEAP32[idx+9]=e.keyCode;HEAP32[idx+10]=e.which;stringToUTF8(e.key||"",keyEventData+44,32);stringToUTF8(e.code||"",keyEventData+76,32);stringToUTF8(e.char||"",keyEventData+108,32);stringToUTF8(e.locale||"",keyEventData+140,32);if(getWasmTableEntry(callbackfunc)(eventTypeId,keyEventData,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),allowsDeferredCalls:true,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:keyEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerKeyEventCallback"]=registerKeyEventCallback;function findCanvasEventTarget(target){return findEventTarget(target)}Module["findCanvasEventTarget"]=findCanvasEventTarget;function _emscripten_set_keypress_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerKeyEventCallback(target,userData,useCapture,callbackfunc,1,"keypress",targetThread);return 0}Module["_emscripten_set_keypress_callback_on_thread"]=_emscripten_set_keypress_callback_on_thread;_emscripten_set_keypress_callback_on_thread.sig="iiiiii";function _emscripten_set_keydown_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerKeyEventCallback(target,userData,useCapture,callbackfunc,2,"keydown",targetThread);return 0}Module["_emscripten_set_keydown_callback_on_thread"]=_emscripten_set_keydown_callback_on_thread;_emscripten_set_keydown_callback_on_thread.sig="iiiiii";function _emscripten_set_keyup_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerKeyEventCallback(target,userData,useCapture,callbackfunc,3,"keyup",targetThread);return 0}Module["_emscripten_set_keyup_callback_on_thread"]=_emscripten_set_keyup_callback_on_thread;_emscripten_set_keyup_callback_on_thread.sig="iiiiii";function getBoundingClientRect(e){return specialHTMLTargets.indexOf(e)<0?e.getBoundingClientRect():{"left":0,"top":0}}Module["getBoundingClientRect"]=getBoundingClientRect;function fillMouseEventData(eventStruct,e,target){HEAPF64[eventStruct>>3]=e.timeStamp;var idx=eventStruct>>2;HEAP32[idx+2]=e.screenX;HEAP32[idx+3]=e.screenY;HEAP32[idx+4]=e.clientX;HEAP32[idx+5]=e.clientY;HEAP32[idx+6]=e.ctrlKey;HEAP32[idx+7]=e.shiftKey;HEAP32[idx+8]=e.altKey;HEAP32[idx+9]=e.metaKey;HEAP16[idx*2+20]=e.button;HEAP16[idx*2+21]=e.buttons;HEAP32[idx+11]=e["movementX"];HEAP32[idx+12]=e["movementY"];var rect=getBoundingClientRect(target);HEAP32[idx+13]=e.clientX-rect.left;HEAP32[idx+14]=e.clientY-rect.top}Module["fillMouseEventData"]=fillMouseEventData;function registerMouseEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.mouseEvent)JSEvents.mouseEvent=_malloc(72);target=findEventTarget(target);var mouseEventHandlerFunc=function(ev){var e=ev||event;fillMouseEventData(JSEvents.mouseEvent,e,target);if(getWasmTableEntry(callbackfunc)(eventTypeId,JSEvents.mouseEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:eventTypeString!="mousemove"&&eventTypeString!="mouseenter"&&eventTypeString!="mouseleave",eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:mouseEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerMouseEventCallback"]=registerMouseEventCallback;function _emscripten_set_click_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,4,"click",targetThread);return 0}Module["_emscripten_set_click_callback_on_thread"]=_emscripten_set_click_callback_on_thread;_emscripten_set_click_callback_on_thread.sig="iiiiii";function _emscripten_set_mousedown_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,5,"mousedown",targetThread);return 0}Module["_emscripten_set_mousedown_callback_on_thread"]=_emscripten_set_mousedown_callback_on_thread;_emscripten_set_mousedown_callback_on_thread.sig="iiiiii";function _emscripten_set_mouseup_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,6,"mouseup",targetThread);return 0}Module["_emscripten_set_mouseup_callback_on_thread"]=_emscripten_set_mouseup_callback_on_thread;_emscripten_set_mouseup_callback_on_thread.sig="iiiiii";function _emscripten_set_dblclick_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,7,"dblclick",targetThread);return 0}Module["_emscripten_set_dblclick_callback_on_thread"]=_emscripten_set_dblclick_callback_on_thread;_emscripten_set_dblclick_callback_on_thread.sig="iiiiii";function _emscripten_set_mousemove_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,8,"mousemove",targetThread);return 0}Module["_emscripten_set_mousemove_callback_on_thread"]=_emscripten_set_mousemove_callback_on_thread;_emscripten_set_mousemove_callback_on_thread.sig="iiiiii";function _emscripten_set_mouseenter_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,33,"mouseenter",targetThread);return 0}Module["_emscripten_set_mouseenter_callback_on_thread"]=_emscripten_set_mouseenter_callback_on_thread;_emscripten_set_mouseenter_callback_on_thread.sig="iiiiii";function _emscripten_set_mouseleave_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,34,"mouseleave",targetThread);return 0}Module["_emscripten_set_mouseleave_callback_on_thread"]=_emscripten_set_mouseleave_callback_on_thread;_emscripten_set_mouseleave_callback_on_thread.sig="iiiiii";function _emscripten_set_mouseover_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,35,"mouseover",targetThread);return 0}Module["_emscripten_set_mouseover_callback_on_thread"]=_emscripten_set_mouseover_callback_on_thread;_emscripten_set_mouseover_callback_on_thread.sig="iiiiii";function _emscripten_set_mouseout_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,36,"mouseout",targetThread);return 0}Module["_emscripten_set_mouseout_callback_on_thread"]=_emscripten_set_mouseout_callback_on_thread;_emscripten_set_mouseout_callback_on_thread.sig="iiiiii";function _emscripten_get_mouse_status(mouseState){if(!JSEvents.mouseEvent)return-7;HEAP8.set(HEAP8.subarray(JSEvents.mouseEvent,JSEvents.mouseEvent+72),mouseState);return 0}Module["_emscripten_get_mouse_status"]=_emscripten_get_mouse_status;_emscripten_get_mouse_status.sig="ii";function registerWheelEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.wheelEvent)JSEvents.wheelEvent=_malloc(104);var wheelHandlerFunc=function(ev){var e=ev||event;var wheelEvent=JSEvents.wheelEvent;fillMouseEventData(wheelEvent,e,target);HEAPF64[wheelEvent+72>>3]=e["deltaX"];HEAPF64[wheelEvent+80>>3]=e["deltaY"];HEAPF64[wheelEvent+88>>3]=e["deltaZ"];HEAP32[wheelEvent+96>>2]=e["deltaMode"];if(getWasmTableEntry(callbackfunc)(eventTypeId,wheelEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:true,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:wheelHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerWheelEventCallback"]=registerWheelEventCallback;function _emscripten_set_wheel_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target=findEventTarget(target);if(typeof target.onwheel!="undefined"){registerWheelEventCallback(target,userData,useCapture,callbackfunc,9,"wheel",targetThread);return 0}else{return-1}}Module["_emscripten_set_wheel_callback_on_thread"]=_emscripten_set_wheel_callback_on_thread;_emscripten_set_wheel_callback_on_thread.sig="iiiiii";function registerUiEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.uiEvent)JSEvents.uiEvent=_malloc(36);target=findEventTarget(target);var uiEventHandlerFunc=function(ev){var e=ev||event;if(e.target!=target){return}var b=document.body;if(!b){return}var uiEvent=JSEvents.uiEvent;HEAP32[uiEvent>>2]=e.detail;HEAP32[uiEvent+4>>2]=b.clientWidth;HEAP32[uiEvent+8>>2]=b.clientHeight;HEAP32[uiEvent+12>>2]=innerWidth;HEAP32[uiEvent+16>>2]=innerHeight;HEAP32[uiEvent+20>>2]=outerWidth;HEAP32[uiEvent+24>>2]=outerHeight;HEAP32[uiEvent+28>>2]=pageXOffset;HEAP32[uiEvent+32>>2]=pageYOffset;if(getWasmTableEntry(callbackfunc)(eventTypeId,uiEvent,userData))e.preventDefault()};var eventHandler={target:target,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:uiEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerUiEventCallback"]=registerUiEventCallback;function _emscripten_set_resize_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerUiEventCallback(target,userData,useCapture,callbackfunc,10,"resize",targetThread);return 0}Module["_emscripten_set_resize_callback_on_thread"]=_emscripten_set_resize_callback_on_thread;_emscripten_set_resize_callback_on_thread.sig="iiiiii";function _emscripten_set_scroll_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerUiEventCallback(target,userData,useCapture,callbackfunc,11,"scroll",targetThread);return 0}Module["_emscripten_set_scroll_callback_on_thread"]=_emscripten_set_scroll_callback_on_thread;_emscripten_set_scroll_callback_on_thread.sig="iiiiii";function registerFocusEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.focusEvent)JSEvents.focusEvent=_malloc(256);var focusEventHandlerFunc=function(ev){var e=ev||event;var nodeName=JSEvents.getNodeNameForTarget(e.target);var id=e.target.id?e.target.id:"";var focusEvent=JSEvents.focusEvent;stringToUTF8(nodeName,focusEvent+0,128);stringToUTF8(id,focusEvent+128,128);if(getWasmTableEntry(callbackfunc)(eventTypeId,focusEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:focusEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerFocusEventCallback"]=registerFocusEventCallback;function _emscripten_set_blur_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerFocusEventCallback(target,userData,useCapture,callbackfunc,12,"blur",targetThread);return 0}Module["_emscripten_set_blur_callback_on_thread"]=_emscripten_set_blur_callback_on_thread;_emscripten_set_blur_callback_on_thread.sig="iiiiii";function _emscripten_set_focus_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerFocusEventCallback(target,userData,useCapture,callbackfunc,13,"focus",targetThread);return 0}Module["_emscripten_set_focus_callback_on_thread"]=_emscripten_set_focus_callback_on_thread;_emscripten_set_focus_callback_on_thread.sig="iiiiii";function _emscripten_set_focusin_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerFocusEventCallback(target,userData,useCapture,callbackfunc,14,"focusin",targetThread);return 0}Module["_emscripten_set_focusin_callback_on_thread"]=_emscripten_set_focusin_callback_on_thread;_emscripten_set_focusin_callback_on_thread.sig="iiiiii";function _emscripten_set_focusout_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerFocusEventCallback(target,userData,useCapture,callbackfunc,15,"focusout",targetThread);return 0}Module["_emscripten_set_focusout_callback_on_thread"]=_emscripten_set_focusout_callback_on_thread;_emscripten_set_focusout_callback_on_thread.sig="iiiiii";function fillDeviceOrientationEventData(eventStruct,e,target){HEAPF64[eventStruct>>3]=e.alpha;HEAPF64[eventStruct+8>>3]=e.beta;HEAPF64[eventStruct+16>>3]=e.gamma;HEAP32[eventStruct+24>>2]=e.absolute}Module["fillDeviceOrientationEventData"]=fillDeviceOrientationEventData;function registerDeviceOrientationEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.deviceOrientationEvent)JSEvents.deviceOrientationEvent=_malloc(32);var deviceOrientationEventHandlerFunc=function(ev){var e=ev||event;fillDeviceOrientationEventData(JSEvents.deviceOrientationEvent,e,target);if(getWasmTableEntry(callbackfunc)(eventTypeId,JSEvents.deviceOrientationEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:deviceOrientationEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerDeviceOrientationEventCallback"]=registerDeviceOrientationEventCallback;function _emscripten_set_deviceorientation_callback_on_thread(userData,useCapture,callbackfunc,targetThread){registerDeviceOrientationEventCallback(2,userData,useCapture,callbackfunc,16,"deviceorientation",targetThread);return 0}Module["_emscripten_set_deviceorientation_callback_on_thread"]=_emscripten_set_deviceorientation_callback_on_thread;_emscripten_set_deviceorientation_callback_on_thread.sig="iiiii";function _emscripten_get_deviceorientation_status(orientationState){if(!JSEvents.deviceOrientationEvent)return-7;HEAP32.set(HEAP32.subarray(JSEvents.deviceOrientationEvent,32),orientationState);return 0}Module["_emscripten_get_deviceorientation_status"]=_emscripten_get_deviceorientation_status;_emscripten_get_deviceorientation_status.sig="ii";function fillDeviceMotionEventData(eventStruct,e,target){var supportedFields=0;var a=e["acceleration"];supportedFields|=a&&1;var ag=e["accelerationIncludingGravity"];supportedFields|=ag&&2;var rr=e["rotationRate"];supportedFields|=rr&&4;a=a||{};ag=ag||{};rr=rr||{};HEAPF64[eventStruct>>3]=a["x"];HEAPF64[eventStruct+8>>3]=a["y"];HEAPF64[eventStruct+16>>3]=a["z"];HEAPF64[eventStruct+24>>3]=ag["x"];HEAPF64[eventStruct+32>>3]=ag["y"];HEAPF64[eventStruct+40>>3]=ag["z"];HEAPF64[eventStruct+48>>3]=rr["alpha"];HEAPF64[eventStruct+56>>3]=rr["beta"];HEAPF64[eventStruct+64>>3]=rr["gamma"]}Module["fillDeviceMotionEventData"]=fillDeviceMotionEventData;function registerDeviceMotionEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.deviceMotionEvent)JSEvents.deviceMotionEvent=_malloc(80);var deviceMotionEventHandlerFunc=function(ev){var e=ev||event;fillDeviceMotionEventData(JSEvents.deviceMotionEvent,e,target);if(getWasmTableEntry(callbackfunc)(eventTypeId,JSEvents.deviceMotionEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:deviceMotionEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerDeviceMotionEventCallback"]=registerDeviceMotionEventCallback;function _emscripten_set_devicemotion_callback_on_thread(userData,useCapture,callbackfunc,targetThread){registerDeviceMotionEventCallback(2,userData,useCapture,callbackfunc,17,"devicemotion",targetThread);return 0}Module["_emscripten_set_devicemotion_callback_on_thread"]=_emscripten_set_devicemotion_callback_on_thread;_emscripten_set_devicemotion_callback_on_thread.sig="iiiii";function _emscripten_get_devicemotion_status(motionState){if(!JSEvents.deviceMotionEvent)return-7;HEAP32.set(HEAP32.subarray(JSEvents.deviceMotionEvent,80),motionState);return 0}Module["_emscripten_get_devicemotion_status"]=_emscripten_get_devicemotion_status;_emscripten_get_devicemotion_status.sig="ii";function screenOrientation(){if(!screen)return undefined;return screen.orientation||screen.mozOrientation||screen.webkitOrientation||screen.msOrientation}Module["screenOrientation"]=screenOrientation;function fillOrientationChangeEventData(eventStruct){var orientations=["portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];var orientations2=["portrait","portrait","landscape","landscape"];var orientationString=screenOrientation();var orientation=orientations.indexOf(orientationString);if(orientation==-1){orientation=orientations2.indexOf(orientationString)}HEAP32[eventStruct>>2]=1<>2]=orientation}Module["fillOrientationChangeEventData"]=fillOrientationChangeEventData;function registerOrientationChangeEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.orientationChangeEvent)JSEvents.orientationChangeEvent=_malloc(8);var orientationChangeEventHandlerFunc=function(ev){var e=ev||event;var orientationChangeEvent=JSEvents.orientationChangeEvent;fillOrientationChangeEventData(orientationChangeEvent);if(getWasmTableEntry(callbackfunc)(eventTypeId,orientationChangeEvent,userData))e.preventDefault()};if(eventTypeString=="orientationchange"&&screen.mozOrientation!==undefined){eventTypeString="mozorientationchange"}var eventHandler={target:target,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:orientationChangeEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerOrientationChangeEventCallback"]=registerOrientationChangeEventCallback;function _emscripten_set_orientationchange_callback_on_thread(userData,useCapture,callbackfunc,targetThread){if(!screen||!screen["addEventListener"])return-1;registerOrientationChangeEventCallback(screen,userData,useCapture,callbackfunc,18,"orientationchange",targetThread);return 0}Module["_emscripten_set_orientationchange_callback_on_thread"]=_emscripten_set_orientationchange_callback_on_thread;_emscripten_set_orientationchange_callback_on_thread.sig="iiiii";function _emscripten_get_orientation_status(orientationChangeEvent){if(!screenOrientation()&&typeof orientation=="undefined")return-1;fillOrientationChangeEventData(orientationChangeEvent);return 0}Module["_emscripten_get_orientation_status"]=_emscripten_get_orientation_status;_emscripten_get_orientation_status.sig="ii";function _emscripten_lock_orientation(allowedOrientations){var orientations=[];if(allowedOrientations&1)orientations.push("portrait-primary");if(allowedOrientations&2)orientations.push("portrait-secondary");if(allowedOrientations&4)orientations.push("landscape-primary");if(allowedOrientations&8)orientations.push("landscape-secondary");var succeeded;if(screen.lockOrientation){succeeded=screen.lockOrientation(orientations)}else if(screen.mozLockOrientation){succeeded=screen.mozLockOrientation(orientations)}else if(screen.webkitLockOrientation){succeeded=screen.webkitLockOrientation(orientations)}else if(screen.msLockOrientation){succeeded=screen.msLockOrientation(orientations)}else{return-1}if(succeeded){return 0}return-6}Module["_emscripten_lock_orientation"]=_emscripten_lock_orientation;_emscripten_lock_orientation.sig="ii";function _emscripten_unlock_orientation(){if(screen.unlockOrientation){screen.unlockOrientation()}else if(screen.mozUnlockOrientation){screen.mozUnlockOrientation()}else if(screen.webkitUnlockOrientation){screen.webkitUnlockOrientation()}else if(screen.msUnlockOrientation){screen.msUnlockOrientation()}else{return-1}return 0}Module["_emscripten_unlock_orientation"]=_emscripten_unlock_orientation;_emscripten_unlock_orientation.sig="i";function fillFullscreenChangeEventData(eventStruct){var fullscreenElement=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;var isFullscreen=!!fullscreenElement;HEAP32[eventStruct>>2]=isFullscreen;HEAP32[eventStruct+4>>2]=JSEvents.fullscreenEnabled();var reportedElement=isFullscreen?fullscreenElement:JSEvents.previousFullscreenElement;var nodeName=JSEvents.getNodeNameForTarget(reportedElement);var id=reportedElement&&reportedElement.id?reportedElement.id:"";stringToUTF8(nodeName,eventStruct+8,128);stringToUTF8(id,eventStruct+136,128);HEAP32[eventStruct+264>>2]=reportedElement?reportedElement.clientWidth:0;HEAP32[eventStruct+268>>2]=reportedElement?reportedElement.clientHeight:0;HEAP32[eventStruct+272>>2]=screen.width;HEAP32[eventStruct+276>>2]=screen.height;if(isFullscreen){JSEvents.previousFullscreenElement=fullscreenElement}}Module["fillFullscreenChangeEventData"]=fillFullscreenChangeEventData;function registerFullscreenChangeEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.fullscreenChangeEvent)JSEvents.fullscreenChangeEvent=_malloc(280);var fullscreenChangeEventhandlerFunc=function(ev){var e=ev||event;var fullscreenChangeEvent=JSEvents.fullscreenChangeEvent;fillFullscreenChangeEventData(fullscreenChangeEvent);if(getWasmTableEntry(callbackfunc)(eventTypeId,fullscreenChangeEvent,userData))e.preventDefault()};var eventHandler={target:target,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:fullscreenChangeEventhandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerFullscreenChangeEventCallback"]=registerFullscreenChangeEventCallback;function _emscripten_set_fullscreenchange_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){if(!JSEvents.fullscreenEnabled())return-1;target=findEventTarget(target);if(!target)return-4;registerFullscreenChangeEventCallback(target,userData,useCapture,callbackfunc,19,"fullscreenchange",targetThread);registerFullscreenChangeEventCallback(target,userData,useCapture,callbackfunc,19,"webkitfullscreenchange",targetThread);return 0}Module["_emscripten_set_fullscreenchange_callback_on_thread"]=_emscripten_set_fullscreenchange_callback_on_thread;_emscripten_set_fullscreenchange_callback_on_thread.sig="iiiiii";function _emscripten_get_fullscreen_status(fullscreenStatus){if(!JSEvents.fullscreenEnabled())return-1;fillFullscreenChangeEventData(fullscreenStatus);return 0}Module["_emscripten_get_fullscreen_status"]=_emscripten_get_fullscreen_status;_emscripten_get_fullscreen_status.sig="ii";function _emscripten_get_canvas_element_size(target,width,height){var canvas=findCanvasEventTarget(target);if(!canvas)return-4;HEAP32[width>>2]=canvas.width;HEAP32[height>>2]=canvas.height}Module["_emscripten_get_canvas_element_size"]=_emscripten_get_canvas_element_size;_emscripten_get_canvas_element_size.sig="ippp";function getCanvasElementSize(target){return withStackSave(function(){var w=stackAlloc(8);var h=w+4;var targetInt=stackAlloc(target.id.length+1);stringToUTF8(target.id,targetInt,target.id.length+1);var ret=_emscripten_get_canvas_element_size(targetInt,w,h);var size=[HEAP32[w>>2],HEAP32[h>>2]];return size})}Module["getCanvasElementSize"]=getCanvasElementSize;function _emscripten_set_canvas_element_size(target,width,height){var canvas=findCanvasEventTarget(target);if(!canvas)return-4;canvas.width=width;canvas.height=height;return 0}Module["_emscripten_set_canvas_element_size"]=_emscripten_set_canvas_element_size;_emscripten_set_canvas_element_size.sig="iiii";function setCanvasElementSize(target,width,height){if(!target.controlTransferredOffscreen){target.width=width;target.height=height}else{withStackSave(function(){var targetInt=stackAlloc(target.id.length+1);stringToUTF8(target.id,targetInt,target.id.length+1);_emscripten_set_canvas_element_size(targetInt,width,height)})}}Module["setCanvasElementSize"]=setCanvasElementSize;function registerRestoreOldStyle(canvas){var canvasSize=getCanvasElementSize(canvas);var oldWidth=canvasSize[0];var oldHeight=canvasSize[1];var oldCssWidth=canvas.style.width;var oldCssHeight=canvas.style.height;var oldBackgroundColor=canvas.style.backgroundColor;var oldDocumentBackgroundColor=document.body.style.backgroundColor;var oldPaddingLeft=canvas.style.paddingLeft;var oldPaddingRight=canvas.style.paddingRight;var oldPaddingTop=canvas.style.paddingTop;var oldPaddingBottom=canvas.style.paddingBottom;var oldMarginLeft=canvas.style.marginLeft;var oldMarginRight=canvas.style.marginRight;var oldMarginTop=canvas.style.marginTop;var oldMarginBottom=canvas.style.marginBottom;var oldDocumentBodyMargin=document.body.style.margin;var oldDocumentOverflow=document.documentElement.style.overflow;var oldDocumentScroll=document.body.scroll;var oldImageRendering=canvas.style.imageRendering;function restoreOldStyle(){var fullscreenElement=document.fullscreenElement||document.webkitFullscreenElement;if(!fullscreenElement){document.removeEventListener("fullscreenchange",restoreOldStyle);document.removeEventListener("webkitfullscreenchange",restoreOldStyle);setCanvasElementSize(canvas,oldWidth,oldHeight);canvas.style.width=oldCssWidth;canvas.style.height=oldCssHeight;canvas.style.backgroundColor=oldBackgroundColor;if(!oldDocumentBackgroundColor)document.body.style.backgroundColor="white";document.body.style.backgroundColor=oldDocumentBackgroundColor;canvas.style.paddingLeft=oldPaddingLeft;canvas.style.paddingRight=oldPaddingRight;canvas.style.paddingTop=oldPaddingTop;canvas.style.paddingBottom=oldPaddingBottom;canvas.style.marginLeft=oldMarginLeft;canvas.style.marginRight=oldMarginRight;canvas.style.marginTop=oldMarginTop;canvas.style.marginBottom=oldMarginBottom;document.body.style.margin=oldDocumentBodyMargin;document.documentElement.style.overflow=oldDocumentOverflow;document.body.scroll=oldDocumentScroll;canvas.style.imageRendering=oldImageRendering;if(canvas.GLctxObject)canvas.GLctxObject.GLctx.viewport(0,0,oldWidth,oldHeight);if(currentFullscreenStrategy.canvasResizedCallback){getWasmTableEntry(currentFullscreenStrategy.canvasResizedCallback)(37,0,currentFullscreenStrategy.canvasResizedCallbackUserData)}}}document.addEventListener("fullscreenchange",restoreOldStyle);document.addEventListener("webkitfullscreenchange",restoreOldStyle);return restoreOldStyle}Module["registerRestoreOldStyle"]=registerRestoreOldStyle;function setLetterbox(element,topBottom,leftRight){element.style.paddingLeft=element.style.paddingRight=leftRight+"px";element.style.paddingTop=element.style.paddingBottom=topBottom+"px"}Module["setLetterbox"]=setLetterbox;function JSEvents_resizeCanvasForFullscreen(target,strategy){var restoreOldStyle=registerRestoreOldStyle(target);var cssWidth=strategy.softFullscreen?innerWidth:screen.width;var cssHeight=strategy.softFullscreen?innerHeight:screen.height;var rect=getBoundingClientRect(target);var windowedCssWidth=rect.width;var windowedCssHeight=rect.height;var canvasSize=getCanvasElementSize(target);var windowedRttWidth=canvasSize[0];var windowedRttHeight=canvasSize[1];if(strategy.scaleMode==3){setLetterbox(target,(cssHeight-windowedCssHeight)/2,(cssWidth-windowedCssWidth)/2);cssWidth=windowedCssWidth;cssHeight=windowedCssHeight}else if(strategy.scaleMode==2){if(cssWidth*windowedRttHeightx*h)w=h*x/y|0;topMargin=(screenHeight-h)/2|0}if(inPixelPerfectFullscreenMode){setCanvasElementSize(canvas,w,h);if(canvas.GLctxObject)canvas.GLctxObject.GLctx.viewport(0,0,w,h)}if(inHiDPIFullscreenMode){topMargin/=dpr;w/=dpr;h/=dpr;w=Math.round(w*1e4)/1e4;h=Math.round(h*1e4)/1e4;topMargin=Math.round(topMargin*1e4)/1e4}if(inCenteredWithoutScalingFullscreenMode){var t=(innerHeight-jstoi_q(canvas.style.height))/2;var b=(innerWidth-jstoi_q(canvas.style.width))/2;setLetterbox(canvas,t,b)}else{canvas.style.width=w+"px";canvas.style.height=h+"px";var b=(innerWidth-w)/2;setLetterbox(canvas,topMargin,b)}if(!inCenteredWithoutScalingFullscreenMode&¤tFullscreenStrategy.canvasResizedCallback){getWasmTableEntry(currentFullscreenStrategy.canvasResizedCallback)(37,0,currentFullscreenStrategy.canvasResizedCallbackUserData)}}Module["softFullscreenResizeWebGLRenderTarget"]=softFullscreenResizeWebGLRenderTarget;function doRequestFullscreen(target,strategy){if(!JSEvents.fullscreenEnabled())return-1;target=findEventTarget(target);if(!target)return-4;if(!target.requestFullscreen&&!target.webkitRequestFullscreen){return-3}var canPerformRequests=JSEvents.canPerformEventHandlerRequests();if(!canPerformRequests){if(strategy.deferUntilInEventHandler){JSEvents.deferCall(JSEvents_requestFullscreen,1,[target,strategy]);return 1}return-2}return JSEvents_requestFullscreen(target,strategy)}Module["doRequestFullscreen"]=doRequestFullscreen;function _emscripten_request_fullscreen(target,deferUntilInEventHandler){var strategy={scaleMode:0,canvasResolutionScaleMode:0,filteringMode:0,deferUntilInEventHandler:deferUntilInEventHandler,canvasResizedCallbackTargetThread:2};return doRequestFullscreen(target,strategy)}Module["_emscripten_request_fullscreen"]=_emscripten_request_fullscreen;_emscripten_request_fullscreen.sig="iii";function _emscripten_request_fullscreen_strategy(target,deferUntilInEventHandler,fullscreenStrategy){var strategy={scaleMode:HEAP32[fullscreenStrategy>>2],canvasResolutionScaleMode:HEAP32[fullscreenStrategy+4>>2],filteringMode:HEAP32[fullscreenStrategy+8>>2],deferUntilInEventHandler:deferUntilInEventHandler,canvasResizedCallback:HEAP32[fullscreenStrategy+12>>2],canvasResizedCallbackUserData:HEAP32[fullscreenStrategy+16>>2]};return doRequestFullscreen(target,strategy)}Module["_emscripten_request_fullscreen_strategy"]=_emscripten_request_fullscreen_strategy;_emscripten_request_fullscreen_strategy.sig="iiii";function _emscripten_enter_soft_fullscreen(target,fullscreenStrategy){target=findEventTarget(target);if(!target)return-4;var strategy={scaleMode:HEAP32[fullscreenStrategy>>2],canvasResolutionScaleMode:HEAP32[fullscreenStrategy+4>>2],filteringMode:HEAP32[fullscreenStrategy+8>>2],canvasResizedCallback:HEAP32[fullscreenStrategy+12>>2],canvasResizedCallbackUserData:HEAP32[fullscreenStrategy+16>>2],target:target,softFullscreen:true};var restoreOldStyle=JSEvents_resizeCanvasForFullscreen(target,strategy);document.documentElement.style.overflow="hidden";document.body.scroll="no";document.body.style.margin="0px";var hiddenElements=hideEverythingExceptGivenElement(target);function restoreWindowedState(){restoreOldStyle();restoreHiddenElements(hiddenElements);removeEventListener("resize",softFullscreenResizeWebGLRenderTarget);if(strategy.canvasResizedCallback){getWasmTableEntry(strategy.canvasResizedCallback)(37,0,strategy.canvasResizedCallbackUserData)}currentFullscreenStrategy=0}restoreOldWindowedStyle=restoreWindowedState;currentFullscreenStrategy=strategy;addEventListener("resize",softFullscreenResizeWebGLRenderTarget);if(strategy.canvasResizedCallback){getWasmTableEntry(strategy.canvasResizedCallback)(37,0,strategy.canvasResizedCallbackUserData)}return 0}Module["_emscripten_enter_soft_fullscreen"]=_emscripten_enter_soft_fullscreen;_emscripten_enter_soft_fullscreen.sig="iii";function _emscripten_exit_soft_fullscreen(){if(restoreOldWindowedStyle)restoreOldWindowedStyle();restoreOldWindowedStyle=null;return 0}Module["_emscripten_exit_soft_fullscreen"]=_emscripten_exit_soft_fullscreen;_emscripten_exit_soft_fullscreen.sig="i";function _emscripten_exit_fullscreen(){if(!JSEvents.fullscreenEnabled())return-1;JSEvents.removeDeferredCalls(JSEvents_requestFullscreen);var d=specialHTMLTargets[1];if(d.exitFullscreen){d.fullscreenElement&&d.exitFullscreen()}else if(d.webkitExitFullscreen){d.webkitFullscreenElement&&d.webkitExitFullscreen()}else{return-1}return 0}Module["_emscripten_exit_fullscreen"]=_emscripten_exit_fullscreen;_emscripten_exit_fullscreen.sig="i";function fillPointerlockChangeEventData(eventStruct){var pointerLockElement=document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement||document.msPointerLockElement;var isPointerlocked=!!pointerLockElement;HEAP32[eventStruct>>2]=isPointerlocked;var nodeName=JSEvents.getNodeNameForTarget(pointerLockElement);var id=pointerLockElement&&pointerLockElement.id?pointerLockElement.id:"";stringToUTF8(nodeName,eventStruct+4,128);stringToUTF8(id,eventStruct+132,128)}Module["fillPointerlockChangeEventData"]=fillPointerlockChangeEventData;function registerPointerlockChangeEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.pointerlockChangeEvent)JSEvents.pointerlockChangeEvent=_malloc(260);var pointerlockChangeEventHandlerFunc=function(ev){var e=ev||event;var pointerlockChangeEvent=JSEvents.pointerlockChangeEvent;fillPointerlockChangeEventData(pointerlockChangeEvent);if(getWasmTableEntry(callbackfunc)(eventTypeId,pointerlockChangeEvent,userData))e.preventDefault()};var eventHandler={target:target,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:pointerlockChangeEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerPointerlockChangeEventCallback"]=registerPointerlockChangeEventCallback;function _emscripten_set_pointerlockchange_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){if(!document||!document.body||!document.body.requestPointerLock&&!document.body.mozRequestPointerLock&&!document.body.webkitRequestPointerLock&&!document.body.msRequestPointerLock){return-1}target=findEventTarget(target);if(!target)return-4;registerPointerlockChangeEventCallback(target,userData,useCapture,callbackfunc,20,"pointerlockchange",targetThread);registerPointerlockChangeEventCallback(target,userData,useCapture,callbackfunc,20,"mozpointerlockchange",targetThread);registerPointerlockChangeEventCallback(target,userData,useCapture,callbackfunc,20,"webkitpointerlockchange",targetThread);registerPointerlockChangeEventCallback(target,userData,useCapture,callbackfunc,20,"mspointerlockchange",targetThread);return 0}Module["_emscripten_set_pointerlockchange_callback_on_thread"]=_emscripten_set_pointerlockchange_callback_on_thread;_emscripten_set_pointerlockchange_callback_on_thread.sig="iiiiii";function registerPointerlockErrorEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){var pointerlockErrorEventHandlerFunc=function(ev){var e=ev||event;if(getWasmTableEntry(callbackfunc)(eventTypeId,0,userData))e.preventDefault()};var eventHandler={target:target,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:pointerlockErrorEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerPointerlockErrorEventCallback"]=registerPointerlockErrorEventCallback;function _emscripten_set_pointerlockerror_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){if(!document||!document.body.requestPointerLock&&!document.body.mozRequestPointerLock&&!document.body.webkitRequestPointerLock&&!document.body.msRequestPointerLock){return-1}target=findEventTarget(target);if(!target)return-4;registerPointerlockErrorEventCallback(target,userData,useCapture,callbackfunc,38,"pointerlockerror",targetThread);registerPointerlockErrorEventCallback(target,userData,useCapture,callbackfunc,38,"mozpointerlockerror",targetThread);registerPointerlockErrorEventCallback(target,userData,useCapture,callbackfunc,38,"webkitpointerlockerror",targetThread);registerPointerlockErrorEventCallback(target,userData,useCapture,callbackfunc,38,"mspointerlockerror",targetThread);return 0}Module["_emscripten_set_pointerlockerror_callback_on_thread"]=_emscripten_set_pointerlockerror_callback_on_thread;_emscripten_set_pointerlockerror_callback_on_thread.sig="iiiiii";function _emscripten_get_pointerlock_status(pointerlockStatus){if(pointerlockStatus)fillPointerlockChangeEventData(pointerlockStatus);if(!document.body||!document.body.requestPointerLock&&!document.body.mozRequestPointerLock&&!document.body.webkitRequestPointerLock&&!document.body.msRequestPointerLock){return-1}return 0}Module["_emscripten_get_pointerlock_status"]=_emscripten_get_pointerlock_status;_emscripten_get_pointerlock_status.sig="ii";function requestPointerLock(target){if(target.requestPointerLock){target.requestPointerLock()}else{if(document.body.requestPointerLock){return-3}return-1}return 0}Module["requestPointerLock"]=requestPointerLock;function _emscripten_request_pointerlock(target,deferUntilInEventHandler){target=findEventTarget(target);if(!target)return-4;if(!target.requestPointerLock){return-1}var canPerformRequests=JSEvents.canPerformEventHandlerRequests();if(!canPerformRequests){if(deferUntilInEventHandler){JSEvents.deferCall(requestPointerLock,2,[target]);return 1}return-2}return requestPointerLock(target)}Module["_emscripten_request_pointerlock"]=_emscripten_request_pointerlock;_emscripten_request_pointerlock.sig="iii";function _emscripten_exit_pointerlock(){JSEvents.removeDeferredCalls(requestPointerLock);if(document.exitPointerLock){document.exitPointerLock()}else{return-1}return 0}Module["_emscripten_exit_pointerlock"]=_emscripten_exit_pointerlock;_emscripten_exit_pointerlock.sig="i";function _emscripten_vibrate(msecs){if(!navigator.vibrate)return-1;navigator.vibrate(msecs);return 0}Module["_emscripten_vibrate"]=_emscripten_vibrate;_emscripten_vibrate.sig="ii";function _emscripten_vibrate_pattern(msecsArray,numEntries){if(!navigator.vibrate)return-1;var vibrateList=[];for(var i=0;i>2];vibrateList.push(msecs)}navigator.vibrate(vibrateList);return 0}Module["_emscripten_vibrate_pattern"]=_emscripten_vibrate_pattern;_emscripten_vibrate_pattern.sig="iii";function fillVisibilityChangeEventData(eventStruct){var visibilityStates=["hidden","visible","prerender","unloaded"];var visibilityState=visibilityStates.indexOf(document.visibilityState);HEAP32[eventStruct>>2]=document.hidden;HEAP32[eventStruct+4>>2]=visibilityState}Module["fillVisibilityChangeEventData"]=fillVisibilityChangeEventData;function registerVisibilityChangeEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.visibilityChangeEvent)JSEvents.visibilityChangeEvent=_malloc(8);var visibilityChangeEventHandlerFunc=function(ev){var e=ev||event;var visibilityChangeEvent=JSEvents.visibilityChangeEvent;fillVisibilityChangeEventData(visibilityChangeEvent);if(getWasmTableEntry(callbackfunc)(eventTypeId,visibilityChangeEvent,userData))e.preventDefault()};var eventHandler={target:target,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:visibilityChangeEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerVisibilityChangeEventCallback"]=registerVisibilityChangeEventCallback;function _emscripten_set_visibilitychange_callback_on_thread(userData,useCapture,callbackfunc,targetThread){if(!specialHTMLTargets[1]){return-4}registerVisibilityChangeEventCallback(specialHTMLTargets[1],userData,useCapture,callbackfunc,21,"visibilitychange",targetThread);return 0}Module["_emscripten_set_visibilitychange_callback_on_thread"]=_emscripten_set_visibilitychange_callback_on_thread;_emscripten_set_visibilitychange_callback_on_thread.sig="iiiii";function _emscripten_get_visibility_status(visibilityStatus){if(typeof document.visibilityState=="undefined"&&typeof document.hidden=="undefined"){return-1}fillVisibilityChangeEventData(visibilityStatus);return 0}Module["_emscripten_get_visibility_status"]=_emscripten_get_visibility_status;_emscripten_get_visibility_status.sig="ii";function registerTouchEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.touchEvent)JSEvents.touchEvent=_malloc(1696);target=findEventTarget(target);var touchEventHandlerFunc=function(e){var t,touches={},et=e.touches;for(var i=0;i>3]=e.timeStamp;var idx=touchEvent>>2;HEAP32[idx+3]=e.ctrlKey;HEAP32[idx+4]=e.shiftKey;HEAP32[idx+5]=e.altKey;HEAP32[idx+6]=e.metaKey;idx+=7;var targetRect=getBoundingClientRect(target);var numTouches=0;for(var i in touches){t=touches[i];HEAP32[idx+0]=t.identifier;HEAP32[idx+1]=t.screenX;HEAP32[idx+2]=t.screenY;HEAP32[idx+3]=t.clientX;HEAP32[idx+4]=t.clientY;HEAP32[idx+5]=t.pageX;HEAP32[idx+6]=t.pageY;HEAP32[idx+7]=t.isChanged;HEAP32[idx+8]=t.onTarget;HEAP32[idx+9]=t.clientX-targetRect.left;HEAP32[idx+10]=t.clientY-targetRect.top;idx+=13;if(++numTouches>31){break}}HEAP32[touchEvent+8>>2]=numTouches;if(getWasmTableEntry(callbackfunc)(eventTypeId,touchEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:eventTypeString=="touchstart"||eventTypeString=="touchend",eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:touchEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerTouchEventCallback"]=registerTouchEventCallback;function _emscripten_set_touchstart_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,22,"touchstart",targetThread);return 0}Module["_emscripten_set_touchstart_callback_on_thread"]=_emscripten_set_touchstart_callback_on_thread;_emscripten_set_touchstart_callback_on_thread.sig="iiiiii";function _emscripten_set_touchend_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,23,"touchend",targetThread);return 0}Module["_emscripten_set_touchend_callback_on_thread"]=_emscripten_set_touchend_callback_on_thread;_emscripten_set_touchend_callback_on_thread.sig="iiiiii";function _emscripten_set_touchmove_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,24,"touchmove",targetThread);return 0}Module["_emscripten_set_touchmove_callback_on_thread"]=_emscripten_set_touchmove_callback_on_thread;_emscripten_set_touchmove_callback_on_thread.sig="iiiiii";function _emscripten_set_touchcancel_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,25,"touchcancel",targetThread);return 0}Module["_emscripten_set_touchcancel_callback_on_thread"]=_emscripten_set_touchcancel_callback_on_thread;_emscripten_set_touchcancel_callback_on_thread.sig="iiiiii";function fillGamepadEventData(eventStruct,e){HEAPF64[eventStruct>>3]=e.timestamp;for(var i=0;i>3]=e.axes[i]}for(var i=0;i>3]=e.buttons[i].value}else{HEAPF64[eventStruct+i*8+528>>3]=e.buttons[i]}}for(var i=0;i>2]=e.buttons[i].pressed}else{HEAP32[eventStruct+i*4+1040>>2]=e.buttons[i]==1}}HEAP32[eventStruct+1296>>2]=e.connected;HEAP32[eventStruct+1300>>2]=e.index;HEAP32[eventStruct+8>>2]=e.axes.length;HEAP32[eventStruct+12>>2]=e.buttons.length;stringToUTF8(e.id,eventStruct+1304,64);stringToUTF8(e.mapping,eventStruct+1368,64)}Module["fillGamepadEventData"]=fillGamepadEventData;function registerGamepadEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.gamepadEvent)JSEvents.gamepadEvent=_malloc(1432);var gamepadEventHandlerFunc=function(ev){var e=ev||event;var gamepadEvent=JSEvents.gamepadEvent;fillGamepadEventData(gamepadEvent,e["gamepad"]);if(getWasmTableEntry(callbackfunc)(eventTypeId,gamepadEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),allowsDeferredCalls:true,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:gamepadEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerGamepadEventCallback"]=registerGamepadEventCallback;function _emscripten_set_gamepadconnected_callback_on_thread(userData,useCapture,callbackfunc,targetThread){if(!navigator.getGamepads&&!navigator.webkitGetGamepads)return-1;registerGamepadEventCallback(2,userData,useCapture,callbackfunc,26,"gamepadconnected",targetThread);return 0}Module["_emscripten_set_gamepadconnected_callback_on_thread"]=_emscripten_set_gamepadconnected_callback_on_thread;_emscripten_set_gamepadconnected_callback_on_thread.sig="iiiii";function _emscripten_set_gamepaddisconnected_callback_on_thread(userData,useCapture,callbackfunc,targetThread){if(!navigator.getGamepads&&!navigator.webkitGetGamepads)return-1;registerGamepadEventCallback(2,userData,useCapture,callbackfunc,27,"gamepaddisconnected",targetThread);return 0}Module["_emscripten_set_gamepaddisconnected_callback_on_thread"]=_emscripten_set_gamepaddisconnected_callback_on_thread;_emscripten_set_gamepaddisconnected_callback_on_thread.sig="iiiii";function _emscripten_sample_gamepad_data(){return(JSEvents.lastGamepadState=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():null)?0:-1}Module["_emscripten_sample_gamepad_data"]=_emscripten_sample_gamepad_data;_emscripten_sample_gamepad_data.sig="i";function _emscripten_get_num_gamepads(){return JSEvents.lastGamepadState.length}Module["_emscripten_get_num_gamepads"]=_emscripten_get_num_gamepads;_emscripten_get_num_gamepads.sig="i";function _emscripten_get_gamepad_status(index,gamepadState){if(index<0||index>=JSEvents.lastGamepadState.length)return-5;if(!JSEvents.lastGamepadState[index])return-7;fillGamepadEventData(gamepadState,JSEvents.lastGamepadState[index]);return 0}Module["_emscripten_get_gamepad_status"]=_emscripten_get_gamepad_status;_emscripten_get_gamepad_status.sig="iii";function registerBeforeUnloadEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString){var beforeUnloadEventHandlerFunc=function(ev){var e=ev||event;var confirmationMessage=getWasmTableEntry(callbackfunc)(eventTypeId,0,userData);if(confirmationMessage){confirmationMessage=UTF8ToString(confirmationMessage)}if(confirmationMessage){e.preventDefault();e.returnValue=confirmationMessage;return confirmationMessage}};var eventHandler={target:findEventTarget(target),eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:beforeUnloadEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerBeforeUnloadEventCallback"]=registerBeforeUnloadEventCallback;function _emscripten_set_beforeunload_callback_on_thread(userData,callbackfunc,targetThread){if(typeof onbeforeunload=="undefined")return-1;if(targetThread!==1)return-5;registerBeforeUnloadEventCallback(2,userData,true,callbackfunc,28,"beforeunload");return 0}Module["_emscripten_set_beforeunload_callback_on_thread"]=_emscripten_set_beforeunload_callback_on_thread;_emscripten_set_beforeunload_callback_on_thread.sig="iii";function fillBatteryEventData(eventStruct,e){HEAPF64[eventStruct>>3]=e.chargingTime;HEAPF64[eventStruct+8>>3]=e.dischargingTime;HEAPF64[eventStruct+16>>3]=e.level;HEAP32[eventStruct+24>>2]=e.charging}Module["fillBatteryEventData"]=fillBatteryEventData;function battery(){return navigator.battery||navigator.mozBattery||navigator.webkitBattery}Module["battery"]=battery;function registerBatteryEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.batteryEvent)JSEvents.batteryEvent=_malloc(32);var batteryEventHandlerFunc=function(ev){var e=ev||event;var batteryEvent=JSEvents.batteryEvent;fillBatteryEventData(batteryEvent,battery());if(getWasmTableEntry(callbackfunc)(eventTypeId,batteryEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:batteryEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["registerBatteryEventCallback"]=registerBatteryEventCallback;function _emscripten_set_batterychargingchange_callback_on_thread(userData,callbackfunc,targetThread){if(!battery())return-1;registerBatteryEventCallback(battery(),userData,true,callbackfunc,29,"chargingchange",targetThread);return 0}Module["_emscripten_set_batterychargingchange_callback_on_thread"]=_emscripten_set_batterychargingchange_callback_on_thread;_emscripten_set_batterychargingchange_callback_on_thread.sig="iii";function _emscripten_set_batterylevelchange_callback_on_thread(userData,callbackfunc,targetThread){if(!battery())return-1;registerBatteryEventCallback(battery(),userData,true,callbackfunc,30,"levelchange",targetThread);return 0}Module["_emscripten_set_batterylevelchange_callback_on_thread"]=_emscripten_set_batterylevelchange_callback_on_thread;_emscripten_set_batterylevelchange_callback_on_thread.sig="iii";function _emscripten_get_battery_status(batteryState){if(!battery())return-1;fillBatteryEventData(batteryState,battery());return 0}Module["_emscripten_get_battery_status"]=_emscripten_get_battery_status;_emscripten_get_battery_status.sig="ii";function _emscripten_set_element_css_size(target,width,height){target=findEventTarget(target);if(!target)return-4;target.style.width=width+"px";target.style.height=height+"px";return 0}Module["_emscripten_set_element_css_size"]=_emscripten_set_element_css_size;_emscripten_set_element_css_size.sig="iiii";function _emscripten_get_element_css_size(target,width,height){target=findEventTarget(target);if(!target)return-4;var rect=getBoundingClientRect(target);HEAPF64[width>>3]=rect.width;HEAPF64[height>>3]=rect.height;return 0}Module["_emscripten_get_element_css_size"]=_emscripten_get_element_css_size;_emscripten_get_element_css_size.sig="iiii";function _emscripten_html5_remove_all_event_listeners(){JSEvents.removeAllEventListeners()}Module["_emscripten_html5_remove_all_event_listeners"]=_emscripten_html5_remove_all_event_listeners;_emscripten_html5_remove_all_event_listeners.sig="v";function _emscripten_request_animation_frame(cb,userData){return requestAnimationFrame(function(timeStamp){getWasmTableEntry(cb)(timeStamp,userData)})}Module["_emscripten_request_animation_frame"]=_emscripten_request_animation_frame;function _emscripten_cancel_animation_frame(id){cancelAnimationFrame(id)}Module["_emscripten_cancel_animation_frame"]=_emscripten_cancel_animation_frame;function _emscripten_request_animation_frame_loop(cb,userData){function tick(timeStamp){if(getWasmTableEntry(cb)(timeStamp,userData)){requestAnimationFrame(tick)}}return requestAnimationFrame(tick)}Module["_emscripten_request_animation_frame_loop"]=_emscripten_request_animation_frame_loop;function _emscripten_performance_now(){return performance.now()}Module["_emscripten_performance_now"]=_emscripten_performance_now;function _emscripten_get_device_pixel_ratio(){return typeof devicePixelRatio=="number"&&devicePixelRatio||1}Module["_emscripten_get_device_pixel_ratio"]=_emscripten_get_device_pixel_ratio;_emscripten_get_device_pixel_ratio.sig="d";function checkWasiClock(clock_id){return clock_id==0||clock_id==1||clock_id==2||clock_id==3}Module["checkWasiClock"]=checkWasiClock;function _clock_time_get(clk_id,ignored_precision,ptime){if(!checkWasiClock(clk_id)){return 28}var now;if(clk_id===0){now=Date.now()}else if(nowIsMonotonic){now=_emscripten_get_now()}else{return 52}var nsec=Math.round(now*1e3*1e3);HEAP32[ptime>>2]=nsec>>>0;HEAP32[ptime+4>>2]=nsec/Math.pow(2,32)>>>0;return 0}Module["_clock_time_get"]=_clock_time_get;_clock_time_get.sig="iijp";function _clock_res_get(clk_id,pres){if(!checkWasiClock(clk_id)){return 28}var nsec;if(clk_id===0){nsec=1e3*1e3}else if(nowIsMonotonic){nsec=_emscripten_get_now_res()}else{return 52}HEAP32[pres>>2]=nsec>>>0;HEAP32[pres+4>>2]=nsec/Math.pow(2,32)>>>0;return 0}Module["_clock_res_get"]=_clock_res_get;_clock_res_get.sig="iip";function createDyncallWrapper(sig){var sections=[];var prelude=[0,97,115,109,1,0,0,0];sections.push(prelude);var wrappersig=[sig[0].replace("j","i"),"i",sig.slice(1).replace(/j/g,"ii")].join("");var typeSectionBody=[3];generateFuncType(wrappersig,typeSectionBody);generateFuncType(sig,typeSectionBody);generateFuncType("vi",typeSectionBody);var typeSection=[1];uleb128Encode(typeSectionBody.length,typeSection);typeSection.push.apply(typeSection,typeSectionBody);sections.push(typeSection);var importSection=[2,15,2,1,101,1,116,1,112,0,0,1,101,1,114,0,2];sections.push(importSection);var functionSection=[3,2,1,0];sections.push(functionSection);var exportSection=[7,5,1,1,102,0,1];sections.push(exportSection);var convert_code=[];if(sig[0]==="j"){convert_code=[1,1,126]}else{convert_code.push(0)}function localGet(j){convert_code.push(32);uleb128Encode(j,convert_code)}var j=1;for(var i=1;i{setImmediateWrapped.mapping[id]=undefined;func()});return id}Module["setImmediateWrapped"]=setImmediateWrapped;function clearImmediateWrapped(id){clearImmediate(setImmediateWrapped.mapping[id]);setImmediateWrapped.mapping[id]=undefined}Module["clearImmediateWrapped"]=clearImmediateWrapped;function polyfillSetImmediate(){}Module["polyfillSetImmediate"]=polyfillSetImmediate;function _emscripten_set_immediate(cb,userData){polyfillSetImmediate();return emSetImmediate(function(){callUserCallback(function(){getWasmTableEntry(cb)(userData)})})}Module["_emscripten_set_immediate"]=_emscripten_set_immediate;_emscripten_set_immediate.sig="ipp";function _emscripten_clear_immediate(id){emClearImmediate(id)}Module["_emscripten_clear_immediate"]=_emscripten_clear_immediate;_emscripten_clear_immediate.sig="vi";function _emscripten_set_immediate_loop(cb,userData){polyfillSetImmediate();function tick(){callUserCallback(function(){if(getWasmTableEntry(cb)(userData)){emSetImmediate(tick)}})}return emSetImmediate(tick)}Module["_emscripten_set_immediate_loop"]=_emscripten_set_immediate_loop;_emscripten_set_immediate_loop.sig="vpp";function _emscripten_set_timeout(cb,msecs,userData){return safeSetTimeout(()=>getWasmTableEntry(cb)(userData),msecs)}Module["_emscripten_set_timeout"]=_emscripten_set_timeout;_emscripten_set_timeout.sig="ipdp";function _emscripten_clear_timeout(id){clearTimeout(id)}Module["_emscripten_clear_timeout"]=_emscripten_clear_timeout;_emscripten_clear_timeout.sig="vi";function _emscripten_set_timeout_loop(cb,msecs,userData){function tick(){var t=performance.now();var n=t+msecs;callUserCallback(function(){if(getWasmTableEntry(cb)(t,userData)){setTimeout(tick,n-performance.now())}})}return setTimeout(tick,0)}Module["_emscripten_set_timeout_loop"]=_emscripten_set_timeout_loop;_emscripten_set_timeout_loop.sig="vpdp";function _emscripten_set_interval(cb,msecs,userData){return setInterval(function(){callUserCallback(function(){getWasmTableEntry(cb)(userData)})},msecs)}Module["_emscripten_set_interval"]=_emscripten_set_interval;_emscripten_set_interval.sig="ipdp";function _emscripten_clear_interval(id){clearInterval(id)}Module["_emscripten_clear_interval"]=_emscripten_clear_interval;_emscripten_clear_interval.sig="vi";function _llvm_eh_typeid_for(type){return type}Module["_llvm_eh_typeid_for"]=_llvm_eh_typeid_for;_llvm_eh_typeid_for.sig="ip";function ___cxa_get_exception_ptr(ptr){return new ExceptionInfo(ptr).get_exception_ptr()}Module["___cxa_get_exception_ptr"]=___cxa_get_exception_ptr;___cxa_get_exception_ptr.sig="pp";function ___cxa_call_unexpected(exception){err("Unexpected exception thrown, this is not properly supported - aborting");ABORT=true;throw exception}Module["___cxa_call_unexpected"]=___cxa_call_unexpected;function ___cxa_find_matching_catch(){var thrown=exceptionLast;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var i=0;i{if(onload)getWasmTableEntry(onload)(file)},()=>{if(onerror)getWasmTableEntry(onerror)(file)},true);return 0}Module["_emscripten_run_preload_plugins"]=_emscripten_run_preload_plugins;_emscripten_run_preload_plugins.sig="iiii";function _emscripten_run_preload_plugins_data(data,size,suffix,arg,onload,onerror){var _suffix=UTF8ToString(suffix);if(!Browser.asyncPrepareDataCounter)Browser.asyncPrepareDataCounter=0;var name="prepare_data_"+Browser.asyncPrepareDataCounter+++"."+_suffix;var lengthAsUTF8=lengthBytesUTF8(name);var cname=_malloc(lengthAsUTF8+1);stringToUTF8(name,cname,lengthAsUTF8+1);FS.createPreloadedFile("/",name,HEAPU8.subarray(data,data+size),true,true,()=>{if(onload)getWasmTableEntry(onload)(arg,cname)},()=>{if(onerror)getWasmTableEntry(onerror)(arg)},true)}Module["_emscripten_run_preload_plugins_data"]=_emscripten_run_preload_plugins_data;_emscripten_run_preload_plugins_data.sig="viiiiii";function _emscripten_async_run_script(script,millis){safeSetTimeout(function(){_emscripten_run_script(script)},millis)}Module["_emscripten_async_run_script"]=_emscripten_async_run_script;function _emscripten_async_load_script(url,onload,onerror){onload=getWasmTableEntry(onload);onerror=getWasmTableEntry(onerror);assert(runDependencies===0,"async_load_script must be run when no other dependencies are active");var script=document.createElement("script");script.onload=function script_onload(){if(onload){if(runDependencies>0){dependenciesFulfilled=onload}else{onload()}}};script.onerror=()=>{if(onerror)onerror()};script.src=UTF8ToString(url);document.body.appendChild(script)}Module["_emscripten_async_load_script"]=_emscripten_async_load_script;function _emscripten_get_main_loop_timing(mode,value){if(mode)HEAP32[mode>>2]=Browser.mainLoop.timingMode;if(value)HEAP32[value>>2]=Browser.mainLoop.timingValue}Module["_emscripten_get_main_loop_timing"]=_emscripten_get_main_loop_timing;_emscripten_get_main_loop_timing.sig="vii";function _emscripten_set_main_loop(func,fps,simulateInfiniteLoop){var browserIterationFunc=getWasmTableEntry(func);setMainLoop(browserIterationFunc,fps,simulateInfiniteLoop)}Module["_emscripten_set_main_loop"]=_emscripten_set_main_loop;_emscripten_set_main_loop.sig="viii";function _emscripten_set_main_loop_arg(func,arg,fps,simulateInfiniteLoop){var browserIterationFunc=()=>getWasmTableEntry(func)(arg);setMainLoop(browserIterationFunc,fps,simulateInfiniteLoop,arg)}Module["_emscripten_set_main_loop_arg"]=_emscripten_set_main_loop_arg;_emscripten_set_main_loop_arg.sig="viiii";function _emscripten_cancel_main_loop(){Browser.mainLoop.pause();Browser.mainLoop.func=null}Module["_emscripten_cancel_main_loop"]=_emscripten_cancel_main_loop;_emscripten_cancel_main_loop.sig="v";function _emscripten_pause_main_loop(){Browser.mainLoop.pause()}Module["_emscripten_pause_main_loop"]=_emscripten_pause_main_loop;_emscripten_pause_main_loop.sig="v";function _emscripten_resume_main_loop(){Browser.mainLoop.resume()}Module["_emscripten_resume_main_loop"]=_emscripten_resume_main_loop;_emscripten_resume_main_loop.sig="v";function __emscripten_push_main_loop_blocker(func,arg,name){Browser.mainLoop.queue.push({func:function(){getWasmTableEntry(func)(arg)},name:UTF8ToString(name),counted:true});Browser.mainLoop.updateStatus()}Module["__emscripten_push_main_loop_blocker"]=__emscripten_push_main_loop_blocker;function __emscripten_push_uncounted_main_loop_blocker(func,arg,name){Browser.mainLoop.queue.push({func:function(){getWasmTableEntry(func)(arg)},name:UTF8ToString(name),counted:false});Browser.mainLoop.updateStatus()}Module["__emscripten_push_uncounted_main_loop_blocker"]=__emscripten_push_uncounted_main_loop_blocker;function _emscripten_set_main_loop_expected_blockers(num){Browser.mainLoop.expectedBlockers=num;Browser.mainLoop.remainingBlockers=num;Browser.mainLoop.updateStatus()}Module["_emscripten_set_main_loop_expected_blockers"]=_emscripten_set_main_loop_expected_blockers;_emscripten_set_main_loop_expected_blockers.sig="vi";function _emscripten_async_call(func,arg,millis){function wrapper(){getWasmTableEntry(func)(arg)}if(millis>=0||ENVIRONMENT_IS_NODE){safeSetTimeout(wrapper,millis)}else{Browser.safeRequestAnimationFrame(wrapper)}}Module["_emscripten_async_call"]=_emscripten_async_call;_emscripten_async_call.sig="vppi";function _emscripten_get_window_title(){var buflen=256;if(!_emscripten_get_window_title.buffer){_emscripten_get_window_title.buffer=_malloc(buflen)}stringToUTF8(document.title,_emscripten_get_window_title.buffer,buflen);return _emscripten_get_window_title.buffer}Module["_emscripten_get_window_title"]=_emscripten_get_window_title;_emscripten_get_window_title.sig="iv";function _emscripten_set_window_title(title){setWindowTitle(UTF8ToString(title))}Module["_emscripten_set_window_title"]=_emscripten_set_window_title;_emscripten_set_window_title.sig="vi";function _emscripten_get_screen_size(width,height){HEAP32[width>>2]=screen.width;HEAP32[height>>2]=screen.height}Module["_emscripten_get_screen_size"]=_emscripten_get_screen_size;_emscripten_get_screen_size.sig="vii";function _emscripten_hide_mouse(){var styleSheet=document.styleSheets[0];var rules=styleSheet.cssRules;for(var i=0;i>2]=canvas.width;HEAP32[height>>2]=canvas.height;HEAP32[isFullscreen>>2]=Browser.isFullscreen?1:0}Module["_emscripten_get_canvas_size"]=_emscripten_get_canvas_size;_emscripten_get_canvas_size.sig="viii";function _emscripten_create_worker(url){url=UTF8ToString(url);var id=Browser.workers.length;var info={worker:new Worker(url),callbacks:[],awaited:0,buffer:0,bufferSize:0};info.worker.onmessage=function info_worker_onmessage(msg){if(ABORT)return;var info=Browser.workers[id];if(!info)return;var callbackId=msg.data["callbackId"];var callbackInfo=info.callbacks[callbackId];if(!callbackInfo)return;if(msg.data["finalResponse"]){info.awaited--;info.callbacks[callbackId]=null}var data=msg.data["data"];if(data){if(!data.byteLength)data=new Uint8Array(data);if(!info.buffer||info.bufferSize>2]=canvas.width;HEAP32[h>>2]=canvas.height;return buf}return 0}Module["_emscripten_get_preloaded_image_data"]=_emscripten_get_preloaded_image_data;_emscripten_get_preloaded_image_data.sig="iiii";function _emscripten_get_preloaded_image_data_from_FILE(file,w,h){var fd=Module["_fileno"](file);var stream=FS.getStream(fd);if(stream){return _emscripten_get_preloaded_image_data(stream.path,w,h)}return 0}Module["_emscripten_get_preloaded_image_data_from_FILE"]=_emscripten_get_preloaded_image_data_from_FILE;_emscripten_get_preloaded_image_data_from_FILE.sig="iiii";var wget={wgetRequests:{},nextWgetRequestHandle:0,getNextWgetRequestHandle:function(){var handle=wget.nextWgetRequestHandle;wget.nextWgetRequestHandle++;return handle}};Module["wget"]=wget;function _emscripten_async_wget(url,file,onload,onerror){var _url=UTF8ToString(url);var _file=UTF8ToString(file);_file=PATH_FS.resolve(_file);function doCallback(callback){if(callback){callUserCallback(function(){withStackSave(function(){getWasmTableEntry(callback)(allocateUTF8OnStack(_file))})})}}var destinationDirectory=PATH.dirname(_file);FS.createPreloadedFile(destinationDirectory,PATH.basename(_file),_url,true,true,function(){doCallback(onload)},function(){doCallback(onerror)},false,false,function(){try{FS.unlink(_file)}catch(e){}FS.mkdirTree(destinationDirectory)})}Module["_emscripten_async_wget"]=_emscripten_async_wget;_emscripten_async_wget.sig="viiii";function _emscripten_async_wget_data(url,arg,onload,onerror){asyncLoad(UTF8ToString(url),function(byteArray){callUserCallback(function(){var buffer=_malloc(byteArray.length);HEAPU8.set(byteArray,buffer);getWasmTableEntry(onload)(arg,buffer,byteArray.length);_free(buffer)})},function(){if(onerror){callUserCallback(function(){getWasmTableEntry(onerror)(arg)})}},true)}Module["_emscripten_async_wget_data"]=_emscripten_async_wget_data;_emscripten_async_wget_data.sig="viiii";function _emscripten_async_wget2(url,file,request,param,arg,onload,onerror,onprogress){var _url=UTF8ToString(url);var _file=UTF8ToString(file);_file=PATH_FS.resolve(_file);var _request=UTF8ToString(request);var _param=UTF8ToString(param);var index=_file.lastIndexOf("/");var http=new XMLHttpRequest;http.open(_request,_url,true);http.responseType="arraybuffer";var handle=wget.getNextWgetRequestHandle();var destinationDirectory=PATH.dirname(_file);http.onload=function http_onload(e){if(http.status>=200&&http.status<300){try{FS.unlink(_file)}catch(e){}FS.mkdirTree(destinationDirectory);FS.createDataFile(_file.substr(0,index),_file.substr(index+1),new Uint8Array(http.response),true,true,false);if(onload){withStackSave(function(){getWasmTableEntry(onload)(handle,arg,allocateUTF8OnStack(_file))})}}else{if(onerror)getWasmTableEntry(onerror)(handle,arg,http.status)}delete wget.wgetRequests[handle]};http.onerror=function http_onerror(e){if(onerror)getWasmTableEntry(onerror)(handle,arg,http.status);delete wget.wgetRequests[handle]};http.onprogress=function http_onprogress(e){if(e.lengthComputable||e.lengthComputable===undefined&&e.total!=0){var percentComplete=e.loaded/e.total*100;if(onprogress)getWasmTableEntry(onprogress)(handle,arg,percentComplete)}};http.onabort=function http_onabort(e){delete wget.wgetRequests[handle]};if(_request=="POST"){http.setRequestHeader("Content-type","application/x-www-form-urlencoded");http.send(_param)}else{http.send(null)}wget.wgetRequests[handle]=http;return handle}Module["_emscripten_async_wget2"]=_emscripten_async_wget2;_emscripten_async_wget2.sig="iiiiiiiii";function _emscripten_async_wget2_data(url,request,param,arg,free,onload,onerror,onprogress){var _url=UTF8ToString(url);var _request=UTF8ToString(request);var _param=UTF8ToString(param);var http=new XMLHttpRequest;http.open(_request,_url,true);http.responseType="arraybuffer";var handle=wget.getNextWgetRequestHandle();function onerrorjs(){if(onerror){var statusText=0;if(http.statusText){var len=lengthBytesUTF8(http.statusText)+1;statusText=stackAlloc(len);stringToUTF8(http.statusText,statusText,len)}getWasmTableEntry(onerror)(handle,arg,http.status,statusText)}}http.onload=function http_onload(e){if(http.status>=200&&http.status<300||http.status===0&&_url.substr(0,4).toLowerCase()!="http"){var byteArray=new Uint8Array(http.response);var buffer=_malloc(byteArray.length);HEAPU8.set(byteArray,buffer);if(onload)getWasmTableEntry(onload)(handle,arg,buffer,byteArray.length);if(free)_free(buffer)}else{onerrorjs()}delete wget.wgetRequests[handle]};http.onerror=function http_onerror(e){onerrorjs();delete wget.wgetRequests[handle]};http.onprogress=function http_onprogress(e){if(onprogress)getWasmTableEntry(onprogress)(handle,arg,e.loaded,e.lengthComputable||e.lengthComputable===undefined?e.total:0)};http.onabort=function http_onabort(e){delete wget.wgetRequests[handle]};if(_request=="POST"){http.setRequestHeader("Content-type","application/x-www-form-urlencoded");http.send(_param)}else{http.send(null)}wget.wgetRequests[handle]=http;return handle}Module["_emscripten_async_wget2_data"]=_emscripten_async_wget2_data;_emscripten_async_wget2_data.sig="iiiiiiiii";function _emscripten_async_wget2_abort(handle){var http=wget.wgetRequests[handle];if(http){http.abort()}}Module["_emscripten_async_wget2_abort"]=_emscripten_async_wget2_abort;_emscripten_async_wget2_abort.sig="vi";function _setNetworkCallback(event,userData,callback){function _callback(data){try{if(event==="error"){withStackSave(function(){var msg=allocateUTF8OnStack(data[2]);getWasmTableEntry(callback)(data[0],data[1],msg,userData)})}else{getWasmTableEntry(callback)(data,userData)}}catch(e){if(!(e instanceof ExitStatus)){if(e&&typeof e=="object"&&e.stack)err("exception thrown: "+[e,e.stack]);throw e}}}Module["websocket"]["on"](event,callback?_callback:null)}Module["_setNetworkCallback"]=_setNetworkCallback;function _emscripten_set_socket_error_callback(userData,callback){_setNetworkCallback("error",userData,callback)}Module["_emscripten_set_socket_error_callback"]=_emscripten_set_socket_error_callback;function _emscripten_set_socket_open_callback(userData,callback){_setNetworkCallback("open",userData,callback)}Module["_emscripten_set_socket_open_callback"]=_emscripten_set_socket_open_callback;function _emscripten_set_socket_listen_callback(userData,callback){_setNetworkCallback("listen",userData,callback)}Module["_emscripten_set_socket_listen_callback"]=_emscripten_set_socket_listen_callback;function _emscripten_set_socket_connection_callback(userData,callback){_setNetworkCallback("connection",userData,callback)}Module["_emscripten_set_socket_connection_callback"]=_emscripten_set_socket_connection_callback;function _emscripten_set_socket_message_callback(userData,callback){_setNetworkCallback("message",userData,callback)}Module["_emscripten_set_socket_message_callback"]=_emscripten_set_socket_message_callback;function _emscripten_set_socket_close_callback(userData,callback){_setNetworkCallback("close",userData,callback)}Module["_emscripten_set_socket_close_callback"]=_emscripten_set_socket_close_callback;function _emscripten_webgl_enable_ANGLE_instanced_arrays(ctx){return __webgl_enable_ANGLE_instanced_arrays(GL.contexts[ctx].GLctx)}Module["_emscripten_webgl_enable_ANGLE_instanced_arrays"]=_emscripten_webgl_enable_ANGLE_instanced_arrays;function _emscripten_webgl_enable_OES_vertex_array_object(ctx){return __webgl_enable_OES_vertex_array_object(GL.contexts[ctx].GLctx)}Module["_emscripten_webgl_enable_OES_vertex_array_object"]=_emscripten_webgl_enable_OES_vertex_array_object;function _emscripten_webgl_enable_WEBGL_draw_buffers(ctx){return __webgl_enable_WEBGL_draw_buffers(GL.contexts[ctx].GLctx)}Module["_emscripten_webgl_enable_WEBGL_draw_buffers"]=_emscripten_webgl_enable_WEBGL_draw_buffers;function _emscripten_webgl_enable_WEBGL_multi_draw(ctx){return __webgl_enable_WEBGL_multi_draw(GL.contexts[ctx].GLctx)}Module["_emscripten_webgl_enable_WEBGL_multi_draw"]=_emscripten_webgl_enable_WEBGL_multi_draw;function _glPixelStorei(pname,param){if(pname==3317){GL.unpackAlignment=param}GLctx.pixelStorei(pname,param)}Module["_glPixelStorei"]=_glPixelStorei;_glPixelStorei.sig="vii";function _glGetString(name_){var ret=GL.stringCache[name_];if(!ret){switch(name_){case 7939:var exts=GLctx.getSupportedExtensions()||[];exts=exts.concat(exts.map(function(e){return"GL_"+e}));ret=stringToNewUTF8(exts.join(" "));break;case 7936:case 7937:case 37445:case 37446:var s=GLctx.getParameter(name_);if(!s){GL.recordError(1280)}ret=s&&stringToNewUTF8(s);break;case 7938:var glVersion=GLctx.getParameter(7938);{glVersion="OpenGL ES 2.0 ("+glVersion+")"}ret=stringToNewUTF8(glVersion);break;case 35724:var glslVersion=GLctx.getParameter(35724);var ver_re=/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/;var ver_num=glslVersion.match(ver_re);if(ver_num!==null){if(ver_num[1].length==3)ver_num[1]=ver_num[1]+"0";glslVersion="OpenGL ES GLSL ES "+ver_num[1]+" ("+glslVersion+")"}ret=stringToNewUTF8(glslVersion);break;default:GL.recordError(1280)}GL.stringCache[name_]=ret}return ret}Module["_glGetString"]=_glGetString;_glGetString.sig="ii";function _glGetIntegerv(name_,p){emscriptenWebGLGet(name_,p,0)}Module["_glGetIntegerv"]=_glGetIntegerv;_glGetIntegerv.sig="vii";function _glGetFloatv(name_,p){emscriptenWebGLGet(name_,p,2)}Module["_glGetFloatv"]=_glGetFloatv;_glGetFloatv.sig="vii";function _glGetBooleanv(name_,p){emscriptenWebGLGet(name_,p,4)}Module["_glGetBooleanv"]=_glGetBooleanv;_glGetBooleanv.sig="vii";function _glDeleteTextures(n,textures){for(var i=0;i>2];var texture=GL.textures[id];if(!texture)continue;GLctx.deleteTexture(texture);texture.name=0;GL.textures[id]=null}}Module["_glDeleteTextures"]=_glDeleteTextures;_glDeleteTextures.sig="vii";function _glCompressedTexImage2D(target,level,internalFormat,width,height,border,imageSize,data){GLctx["compressedTexImage2D"](target,level,internalFormat,width,height,border,data?HEAPU8.subarray(data,data+imageSize):null)}Module["_glCompressedTexImage2D"]=_glCompressedTexImage2D;_glCompressedTexImage2D.sig="viiiiiiii";function _glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imageSize,data){GLctx["compressedTexSubImage2D"](target,level,xoffset,yoffset,width,height,format,data?HEAPU8.subarray(data,data+imageSize):null)}Module["_glCompressedTexSubImage2D"]=_glCompressedTexSubImage2D;_glCompressedTexSubImage2D.sig="viiiiiiiii";function _glTexImage2D(target,level,internalFormat,width,height,border,format,type,pixels){GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixels?emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat):null)}Module["_glTexImage2D"]=_glTexImage2D;_glTexImage2D.sig="viiiiiiiii";function _glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels){var pixelData=null;if(pixels)pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,0);GLctx.texSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixelData)}Module["_glTexSubImage2D"]=_glTexSubImage2D;_glTexSubImage2D.sig="viiiiiiiii";function _glReadPixels(x,y,width,height,format,type,pixels){var pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,format);if(!pixelData){GL.recordError(1280);return}GLctx.readPixels(x,y,width,height,format,type,pixelData)}Module["_glReadPixels"]=_glReadPixels;_glReadPixels.sig="viiiiiii";function _glBindTexture(target,texture){GLctx.bindTexture(target,GL.textures[texture])}Module["_glBindTexture"]=_glBindTexture;_glBindTexture.sig="vii";function _glGetTexParameterfv(target,pname,params){if(!params){GL.recordError(1281);return}HEAPF32[params>>2]=GLctx.getTexParameter(target,pname)}Module["_glGetTexParameterfv"]=_glGetTexParameterfv;_glGetTexParameterfv.sig="viii";function _glGetTexParameteriv(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getTexParameter(target,pname)}Module["_glGetTexParameteriv"]=_glGetTexParameteriv;_glGetTexParameteriv.sig="viii";function _glTexParameterfv(target,pname,params){var param=HEAPF32[params>>2];GLctx.texParameterf(target,pname,param)}Module["_glTexParameterfv"]=_glTexParameterfv;_glTexParameterfv.sig="viii";function _glTexParameteriv(target,pname,params){var param=HEAP32[params>>2];GLctx.texParameteri(target,pname,param)}Module["_glTexParameteriv"]=_glTexParameteriv;_glTexParameteriv.sig="viii";function _glIsTexture(id){var texture=GL.textures[id];if(!texture)return 0;return GLctx.isTexture(texture)}Module["_glIsTexture"]=_glIsTexture;_glIsTexture.sig="ii";function _glGenBuffers(n,buffers){__glGenObject(n,buffers,"createBuffer",GL.buffers)}Module["_glGenBuffers"]=_glGenBuffers;_glGenBuffers.sig="vii";function _glGenTextures(n,textures){__glGenObject(n,textures,"createTexture",GL.textures)}Module["_glGenTextures"]=_glGenTextures;_glGenTextures.sig="vii";function _glDeleteBuffers(n,buffers){for(var i=0;i>2];var buffer=GL.buffers[id];if(!buffer)continue;GLctx.deleteBuffer(buffer);buffer.name=0;GL.buffers[id]=null}}Module["_glDeleteBuffers"]=_glDeleteBuffers;_glDeleteBuffers.sig="vii";function _glGetBufferParameteriv(target,value,data){if(!data){GL.recordError(1281);return}HEAP32[data>>2]=GLctx.getBufferParameter(target,value)}Module["_glGetBufferParameteriv"]=_glGetBufferParameteriv;_glGetBufferParameteriv.sig="viii";function _glBufferData(target,size,data,usage){GLctx.bufferData(target,data?HEAPU8.subarray(data,data+size):size,usage)}Module["_glBufferData"]=_glBufferData;_glBufferData.sig="viiii";function _glBufferSubData(target,offset,size,data){GLctx.bufferSubData(target,offset,HEAPU8.subarray(data,data+size))}Module["_glBufferSubData"]=_glBufferSubData;_glBufferSubData.sig="viiii";function _glGenQueriesEXT(n,ids){for(var i=0;i>2]=0;return}var id=GL.getNewId(GL.queries);query.name=id;GL.queries[id]=query;HEAP32[ids+i*4>>2]=id}}Module["_glGenQueriesEXT"]=_glGenQueriesEXT;_glGenQueriesEXT.sig="vii";function _glDeleteQueriesEXT(n,ids){for(var i=0;i>2];var query=GL.queries[id];if(!query)continue;GLctx.disjointTimerQueryExt["deleteQueryEXT"](query);GL.queries[id]=null}}Module["_glDeleteQueriesEXT"]=_glDeleteQueriesEXT;_glDeleteQueriesEXT.sig="vii";function _glIsQueryEXT(id){var query=GL.queries[id];if(!query)return 0;return GLctx.disjointTimerQueryExt["isQueryEXT"](query)}Module["_glIsQueryEXT"]=_glIsQueryEXT;_glIsQueryEXT.sig="ii";function _glBeginQueryEXT(target,id){GLctx.disjointTimerQueryExt["beginQueryEXT"](target,GL.queries[id])}Module["_glBeginQueryEXT"]=_glBeginQueryEXT;_glBeginQueryEXT.sig="vii";function _glEndQueryEXT(target){GLctx.disjointTimerQueryExt["endQueryEXT"](target)}Module["_glEndQueryEXT"]=_glEndQueryEXT;_glEndQueryEXT.sig="vi";function _glQueryCounterEXT(id,target){GLctx.disjointTimerQueryExt["queryCounterEXT"](GL.queries[id],target)}Module["_glQueryCounterEXT"]=_glQueryCounterEXT;_glQueryCounterEXT.sig="vii";function _glGetQueryivEXT(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.disjointTimerQueryExt["getQueryEXT"](target,pname)}Module["_glGetQueryivEXT"]=_glGetQueryivEXT;_glGetQueryivEXT.sig="viii";function _glGetQueryObjectivEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}HEAP32[params>>2]=ret}Module["_glGetQueryObjectivEXT"]=_glGetQueryObjectivEXT;_glGetQueryObjectivEXT.sig="viii";function _glGetQueryObjectuivEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}HEAP32[params>>2]=ret}Module["_glGetQueryObjectuivEXT"]=_glGetQueryObjectuivEXT;_glGetQueryObjectuivEXT.sig="viii";function _glGetQueryObjecti64vEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param;{param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname)}var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}writeI53ToI64(params,ret)}Module["_glGetQueryObjecti64vEXT"]=_glGetQueryObjecti64vEXT;_glGetQueryObjecti64vEXT.sig="viii";function _glGetQueryObjectui64vEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param;{param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname)}var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}writeI53ToI64(params,ret)}Module["_glGetQueryObjectui64vEXT"]=_glGetQueryObjectui64vEXT;_glGetQueryObjectui64vEXT.sig="viii";function _glIsBuffer(buffer){var b=GL.buffers[buffer];if(!b)return 0;return GLctx.isBuffer(b)}Module["_glIsBuffer"]=_glIsBuffer;_glIsBuffer.sig="ii";function _glGenRenderbuffers(n,renderbuffers){__glGenObject(n,renderbuffers,"createRenderbuffer",GL.renderbuffers)}Module["_glGenRenderbuffers"]=_glGenRenderbuffers;_glGenRenderbuffers.sig="vii";function _glDeleteRenderbuffers(n,renderbuffers){for(var i=0;i>2];var renderbuffer=GL.renderbuffers[id];if(!renderbuffer)continue;GLctx.deleteRenderbuffer(renderbuffer);renderbuffer.name=0;GL.renderbuffers[id]=null}}Module["_glDeleteRenderbuffers"]=_glDeleteRenderbuffers;_glDeleteRenderbuffers.sig="vii";function _glBindRenderbuffer(target,renderbuffer){GLctx.bindRenderbuffer(target,GL.renderbuffers[renderbuffer])}Module["_glBindRenderbuffer"]=_glBindRenderbuffer;_glBindRenderbuffer.sig="vii";function _glGetRenderbufferParameteriv(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getRenderbufferParameter(target,pname)}Module["_glGetRenderbufferParameteriv"]=_glGetRenderbufferParameteriv;_glGetRenderbufferParameteriv.sig="viii";function _glIsRenderbuffer(renderbuffer){var rb=GL.renderbuffers[renderbuffer];if(!rb)return 0;return GLctx.isRenderbuffer(rb)}Module["_glIsRenderbuffer"]=_glIsRenderbuffer;_glIsRenderbuffer.sig="ii";function _glGetUniformfv(program,location,params){emscriptenWebGLGetUniform(program,location,params,2)}Module["_glGetUniformfv"]=_glGetUniformfv;_glGetUniformfv.sig="viii";function _glGetUniformiv(program,location,params){emscriptenWebGLGetUniform(program,location,params,0)}Module["_glGetUniformiv"]=_glGetUniformiv;_glGetUniformiv.sig="viii";function _glGetUniformLocation(program,name){name=UTF8ToString(name);if(program=GL.programs[program]){webglPrepareUniformLocationsBeforeFirstUse(program);var uniformLocsById=program.uniformLocsById;var arrayIndex=0;var uniformBaseName=name;var leftBrace=webglGetLeftBracePos(name);if(leftBrace>0){arrayIndex=jstoi_q(name.slice(leftBrace+1))>>>0;uniformBaseName=name.slice(0,leftBrace)}var sizeAndId=program.uniformSizeAndIdsByName[uniformBaseName];if(sizeAndId&&arrayIndex>2]=GLctx.getVertexAttribOffset(index,pname)}Module["_glGetVertexAttribPointerv"]=_glGetVertexAttribPointerv;_glGetVertexAttribPointerv.sig="viii";function _glUniform1f(location,v0){GLctx.uniform1f(webglGetUniformLocation(location),v0)}Module["_glUniform1f"]=_glUniform1f;_glUniform1f.sig="vif";function _glUniform2f(location,v0,v1){GLctx.uniform2f(webglGetUniformLocation(location),v0,v1)}Module["_glUniform2f"]=_glUniform2f;_glUniform2f.sig="viff";function _glUniform3f(location,v0,v1,v2){GLctx.uniform3f(webglGetUniformLocation(location),v0,v1,v2)}Module["_glUniform3f"]=_glUniform3f;_glUniform3f.sig="vifff";function _glUniform4f(location,v0,v1,v2,v3){GLctx.uniform4f(webglGetUniformLocation(location),v0,v1,v2,v3)}Module["_glUniform4f"]=_glUniform4f;_glUniform4f.sig="viffff";function _glUniform1i(location,v0){GLctx.uniform1i(webglGetUniformLocation(location),v0)}Module["_glUniform1i"]=_glUniform1i;_glUniform1i.sig="vii";function _glUniform2i(location,v0,v1){GLctx.uniform2i(webglGetUniformLocation(location),v0,v1)}Module["_glUniform2i"]=_glUniform2i;_glUniform2i.sig="viii";function _glUniform3i(location,v0,v1,v2){GLctx.uniform3i(webglGetUniformLocation(location),v0,v1,v2)}Module["_glUniform3i"]=_glUniform3i;_glUniform3i.sig="viiii";function _glUniform4i(location,v0,v1,v2,v3){GLctx.uniform4i(webglGetUniformLocation(location),v0,v1,v2,v3)}Module["_glUniform4i"]=_glUniform4i;_glUniform4i.sig="viiiii";function _glUniform1iv(location,count,value){if(count<=288){var view=__miniTempWebGLIntBuffers[count-1];for(var i=0;i>2]}}else{var view=HEAP32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1iv(webglGetUniformLocation(location),view)}Module["_glUniform1iv"]=_glUniform1iv;_glUniform1iv.sig="viii";function _glUniform2iv(location,count,value){if(count<=144){var view=__miniTempWebGLIntBuffers[2*count-1];for(var i=0;i<2*count;i+=2){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2iv(webglGetUniformLocation(location),view)}Module["_glUniform2iv"]=_glUniform2iv;_glUniform2iv.sig="viii";function _glUniform3iv(location,count,value){if(count<=96){var view=__miniTempWebGLIntBuffers[3*count-1];for(var i=0;i<3*count;i+=3){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3iv(webglGetUniformLocation(location),view)}Module["_glUniform3iv"]=_glUniform3iv;_glUniform3iv.sig="viii";function _glUniform4iv(location,count,value){if(count<=72){var view=__miniTempWebGLIntBuffers[4*count-1];for(var i=0;i<4*count;i+=4){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2];view[i+3]=HEAP32[value+(4*i+12)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4iv(webglGetUniformLocation(location),view)}Module["_glUniform4iv"]=_glUniform4iv;_glUniform4iv.sig="viii";function _glUniform1fv(location,count,value){if(count<=288){var view=miniTempWebGLFloatBuffers[count-1];for(var i=0;i>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1fv(webglGetUniformLocation(location),view)}Module["_glUniform1fv"]=_glUniform1fv;_glUniform1fv.sig="viii";function _glUniform2fv(location,count,value){if(count<=144){var view=miniTempWebGLFloatBuffers[2*count-1];for(var i=0;i<2*count;i+=2){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2fv(webglGetUniformLocation(location),view)}Module["_glUniform2fv"]=_glUniform2fv;_glUniform2fv.sig="viii";function _glUniform3fv(location,count,value){if(count<=96){var view=miniTempWebGLFloatBuffers[3*count-1];for(var i=0;i<3*count;i+=3){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3fv(webglGetUniformLocation(location),view)}Module["_glUniform3fv"]=_glUniform3fv;_glUniform3fv.sig="viii";function _glUniform4fv(location,count,value){if(count<=72){var view=miniTempWebGLFloatBuffers[4*count-1];var heap=HEAPF32;value>>=2;for(var i=0;i<4*count;i+=4){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4fv(webglGetUniformLocation(location),view)}Module["_glUniform4fv"]=_glUniform4fv;_glUniform4fv.sig="viii";function _glUniformMatrix2fv(location,count,transpose,value){if(count<=72){var view=miniTempWebGLFloatBuffers[4*count-1];for(var i=0;i<4*count;i+=4){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniformMatrix2fv(webglGetUniformLocation(location),!!transpose,view)}Module["_glUniformMatrix2fv"]=_glUniformMatrix2fv;_glUniformMatrix2fv.sig="viiii";function _glUniformMatrix3fv(location,count,transpose,value){if(count<=32){var view=miniTempWebGLFloatBuffers[9*count-1];for(var i=0;i<9*count;i+=9){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2];view[i+4]=HEAPF32[value+(4*i+16)>>2];view[i+5]=HEAPF32[value+(4*i+20)>>2];view[i+6]=HEAPF32[value+(4*i+24)>>2];view[i+7]=HEAPF32[value+(4*i+28)>>2];view[i+8]=HEAPF32[value+(4*i+32)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*36>>2)}GLctx.uniformMatrix3fv(webglGetUniformLocation(location),!!transpose,view)}Module["_glUniformMatrix3fv"]=_glUniformMatrix3fv;_glUniformMatrix3fv.sig="viiii";function _glUniformMatrix4fv(location,count,transpose,value){if(count<=18){var view=miniTempWebGLFloatBuffers[16*count-1];var heap=HEAPF32;value>>=2;for(var i=0;i<16*count;i+=16){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3];view[i+4]=heap[dst+4];view[i+5]=heap[dst+5];view[i+6]=heap[dst+6];view[i+7]=heap[dst+7];view[i+8]=heap[dst+8];view[i+9]=heap[dst+9];view[i+10]=heap[dst+10];view[i+11]=heap[dst+11];view[i+12]=heap[dst+12];view[i+13]=heap[dst+13];view[i+14]=heap[dst+14];view[i+15]=heap[dst+15]}}else{var view=HEAPF32.subarray(value>>2,value+count*64>>2)}GLctx.uniformMatrix4fv(webglGetUniformLocation(location),!!transpose,view)}Module["_glUniformMatrix4fv"]=_glUniformMatrix4fv;_glUniformMatrix4fv.sig="viiii";function _glBindBuffer(target,buffer){GLctx.bindBuffer(target,GL.buffers[buffer])}Module["_glBindBuffer"]=_glBindBuffer;_glBindBuffer.sig="vii";function _glVertexAttrib1fv(index,v){GLctx.vertexAttrib1f(index,HEAPF32[v>>2])}Module["_glVertexAttrib1fv"]=_glVertexAttrib1fv;_glVertexAttrib1fv.sig="vii";function _glVertexAttrib2fv(index,v){GLctx.vertexAttrib2f(index,HEAPF32[v>>2],HEAPF32[v+4>>2])}Module["_glVertexAttrib2fv"]=_glVertexAttrib2fv;_glVertexAttrib2fv.sig="vii";function _glVertexAttrib3fv(index,v){GLctx.vertexAttrib3f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2])}Module["_glVertexAttrib3fv"]=_glVertexAttrib3fv;_glVertexAttrib3fv.sig="vii";function _glVertexAttrib4fv(index,v){GLctx.vertexAttrib4f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2],HEAPF32[v+12>>2])}Module["_glVertexAttrib4fv"]=_glVertexAttrib4fv;_glVertexAttrib4fv.sig="vii";function _glGetAttribLocation(program,name){return GLctx.getAttribLocation(GL.programs[program],UTF8ToString(name))}Module["_glGetAttribLocation"]=_glGetAttribLocation;_glGetAttribLocation.sig="iii";function _glGetActiveAttrib(program,index,bufSize,length,size,type,name){__glGetActiveAttribOrUniform("getActiveAttrib",program,index,bufSize,length,size,type,name)}Module["_glGetActiveAttrib"]=_glGetActiveAttrib;_glGetActiveAttrib.sig="viiiiiii";function _glGetActiveUniform(program,index,bufSize,length,size,type,name){__glGetActiveAttribOrUniform("getActiveUniform",program,index,bufSize,length,size,type,name)}Module["_glGetActiveUniform"]=_glGetActiveUniform;_glGetActiveUniform.sig="viiiiiii";function _glCreateShader(shaderType){var id=GL.getNewId(GL.shaders);GL.shaders[id]=GLctx.createShader(shaderType);return id}Module["_glCreateShader"]=_glCreateShader;_glCreateShader.sig="ii";function _glDeleteShader(id){if(!id)return;var shader=GL.shaders[id];if(!shader){GL.recordError(1281);return}GLctx.deleteShader(shader);GL.shaders[id]=null}Module["_glDeleteShader"]=_glDeleteShader;_glDeleteShader.sig="vi";function _glGetAttachedShaders(program,maxCount,count,shaders){var result=GLctx.getAttachedShaders(GL.programs[program]);var len=result.length;if(len>maxCount){len=maxCount}HEAP32[count>>2]=len;for(var i=0;i>2]=id}}Module["_glGetAttachedShaders"]=_glGetAttachedShaders;_glGetAttachedShaders.sig="viiii";function _glShaderSource(shader,count,string,length){var source=GL.getSource(shader,count,string,length);GLctx.shaderSource(GL.shaders[shader],source)}Module["_glShaderSource"]=_glShaderSource;_glShaderSource.sig="viiii";function _glGetShaderSource(shader,bufSize,length,source){var result=GLctx.getShaderSource(GL.shaders[shader]);if(!result)return;var numBytesWrittenExclNull=bufSize>0&&source?stringToUTF8(result,source,bufSize):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}Module["_glGetShaderSource"]=_glGetShaderSource;_glGetShaderSource.sig="viiii";function _glCompileShader(shader){GLctx.compileShader(GL.shaders[shader])}Module["_glCompileShader"]=_glCompileShader;_glCompileShader.sig="vi";function _glGetShaderInfoLog(shader,maxLength,length,infoLog){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}Module["_glGetShaderInfoLog"]=_glGetShaderInfoLog;_glGetShaderInfoLog.sig="viiii";function _glGetShaderiv(shader,pname,p){if(!p){GL.recordError(1281);return}if(pname==35716){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var logLength=log?log.length+1:0;HEAP32[p>>2]=logLength}else if(pname==35720){var source=GLctx.getShaderSource(GL.shaders[shader]);var sourceLength=source?source.length+1:0;HEAP32[p>>2]=sourceLength}else{HEAP32[p>>2]=GLctx.getShaderParameter(GL.shaders[shader],pname)}}Module["_glGetShaderiv"]=_glGetShaderiv;_glGetShaderiv.sig="viii";function _glGetProgramiv(program,pname,p){if(!p){GL.recordError(1281);return}if(program>=GL.counter){GL.recordError(1281);return}program=GL.programs[program];if(pname==35716){var log=GLctx.getProgramInfoLog(program);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35719){if(!program.maxUniformLength){for(var i=0;i>2]=program.maxUniformLength}else if(pname==35722){if(!program.maxAttributeLength){for(var i=0;i>2]=program.maxAttributeLength}else if(pname==35381){if(!program.maxUniformBlockNameLength){for(var i=0;i>2]=program.maxUniformBlockNameLength}else{HEAP32[p>>2]=GLctx.getProgramParameter(program,pname)}}Module["_glGetProgramiv"]=_glGetProgramiv;_glGetProgramiv.sig="viii";function _glIsShader(shader){var s=GL.shaders[shader];if(!s)return 0;return GLctx.isShader(s)}Module["_glIsShader"]=_glIsShader;_glIsShader.sig="ii";function _glCreateProgram(){var id=GL.getNewId(GL.programs);var program=GLctx.createProgram();program.name=id;program.maxUniformLength=program.maxAttributeLength=program.maxUniformBlockNameLength=0;program.uniformIdCounter=1;GL.programs[id]=program;return id}Module["_glCreateProgram"]=_glCreateProgram;_glCreateProgram.sig="i";function _glDeleteProgram(id){if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null}Module["_glDeleteProgram"]=_glDeleteProgram;_glDeleteProgram.sig="vi";function _glAttachShader(program,shader){GLctx.attachShader(GL.programs[program],GL.shaders[shader])}Module["_glAttachShader"]=_glAttachShader;_glAttachShader.sig="vii";function _glDetachShader(program,shader){GLctx.detachShader(GL.programs[program],GL.shaders[shader])}Module["_glDetachShader"]=_glDetachShader;_glDetachShader.sig="vii";function _glGetShaderPrecisionFormat(shaderType,precisionType,range,precision){var result=GLctx.getShaderPrecisionFormat(shaderType,precisionType);HEAP32[range>>2]=result.rangeMin;HEAP32[range+4>>2]=result.rangeMax;HEAP32[precision>>2]=result.precision}Module["_glGetShaderPrecisionFormat"]=_glGetShaderPrecisionFormat;_glGetShaderPrecisionFormat.sig="viiii";function _glLinkProgram(program){program=GL.programs[program];GLctx.linkProgram(program);program.uniformLocsById=0;program.uniformSizeAndIdsByName={}}Module["_glLinkProgram"]=_glLinkProgram;_glLinkProgram.sig="vi";function _glGetProgramInfoLog(program,maxLength,length,infoLog){var log=GLctx.getProgramInfoLog(GL.programs[program]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}Module["_glGetProgramInfoLog"]=_glGetProgramInfoLog;_glGetProgramInfoLog.sig="viiii";function _glUseProgram(program){program=GL.programs[program];GLctx.useProgram(program);GLctx.currentProgram=program}Module["_glUseProgram"]=_glUseProgram;_glUseProgram.sig="vi";function _glValidateProgram(program){GLctx.validateProgram(GL.programs[program])}Module["_glValidateProgram"]=_glValidateProgram;_glValidateProgram.sig="vi";function _glIsProgram(program){program=GL.programs[program];if(!program)return 0;return GLctx.isProgram(program)}Module["_glIsProgram"]=_glIsProgram;_glIsProgram.sig="ii";function _glBindAttribLocation(program,index,name){GLctx.bindAttribLocation(GL.programs[program],index,UTF8ToString(name))}Module["_glBindAttribLocation"]=_glBindAttribLocation;_glBindAttribLocation.sig="viii";function _glBindFramebuffer(target,framebuffer){GLctx.bindFramebuffer(target,GL.framebuffers[framebuffer])}Module["_glBindFramebuffer"]=_glBindFramebuffer;_glBindFramebuffer.sig="vii";function _glGenFramebuffers(n,ids){__glGenObject(n,ids,"createFramebuffer",GL.framebuffers)}Module["_glGenFramebuffers"]=_glGenFramebuffers;_glGenFramebuffers.sig="vii";function _glDeleteFramebuffers(n,framebuffers){for(var i=0;i>2];var framebuffer=GL.framebuffers[id];if(!framebuffer)continue;GLctx.deleteFramebuffer(framebuffer);framebuffer.name=0;GL.framebuffers[id]=null}}Module["_glDeleteFramebuffers"]=_glDeleteFramebuffers;_glDeleteFramebuffers.sig="vii";function _glFramebufferRenderbuffer(target,attachment,renderbuffertarget,renderbuffer){GLctx.framebufferRenderbuffer(target,attachment,renderbuffertarget,GL.renderbuffers[renderbuffer])}Module["_glFramebufferRenderbuffer"]=_glFramebufferRenderbuffer;_glFramebufferRenderbuffer.sig="viiii";function _glFramebufferTexture2D(target,attachment,textarget,texture,level){GLctx.framebufferTexture2D(target,attachment,textarget,GL.textures[texture],level)}Module["_glFramebufferTexture2D"]=_glFramebufferTexture2D;_glFramebufferTexture2D.sig="viiiii";function _glGetFramebufferAttachmentParameteriv(target,attachment,pname,params){var result=GLctx.getFramebufferAttachmentParameter(target,attachment,pname);if(result instanceof WebGLRenderbuffer||result instanceof WebGLTexture){result=result.name|0}HEAP32[params>>2]=result}Module["_glGetFramebufferAttachmentParameteriv"]=_glGetFramebufferAttachmentParameteriv;_glGetFramebufferAttachmentParameteriv.sig="viiii";function _glIsFramebuffer(framebuffer){var fb=GL.framebuffers[framebuffer];if(!fb)return 0;return GLctx.isFramebuffer(fb)}Module["_glIsFramebuffer"]=_glIsFramebuffer;_glIsFramebuffer.sig="ii";function _glGenVertexArrays(n,arrays){__glGenObject(n,arrays,"createVertexArray",GL.vaos)}Module["_glGenVertexArrays"]=_glGenVertexArrays;_glGenVertexArrays.sig="vii";function _glDeleteVertexArrays(n,vaos){for(var i=0;i>2];GLctx["deleteVertexArray"](GL.vaos[id]);GL.vaos[id]=null}}Module["_glDeleteVertexArrays"]=_glDeleteVertexArrays;_glDeleteVertexArrays.sig="vii";function _glBindVertexArray(vao){GLctx["bindVertexArray"](GL.vaos[vao])}Module["_glBindVertexArray"]=_glBindVertexArray;_glBindVertexArray.sig="vi";function _glIsVertexArray(array){var vao=GL.vaos[array];if(!vao)return 0;return GLctx["isVertexArray"](vao)}Module["_glIsVertexArray"]=_glIsVertexArray;_glIsVertexArray.sig="ii";function _glVertexPointer(){throw"Legacy GL function (glVertexPointer) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation."}Module["_glVertexPointer"]=_glVertexPointer;function _glMatrixMode(){throw"Legacy GL function (glMatrixMode) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation."}Module["_glMatrixMode"]=_glMatrixMode;function _glBegin(){throw"Legacy GL function (glBegin) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation."}Module["_glBegin"]=_glBegin;function _glLoadIdentity(){throw"Legacy GL function (glLoadIdentity) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation."}Module["_glLoadIdentity"]=_glLoadIdentity;function _glGenVertexArraysOES(n,arrays){__glGenObject(n,arrays,"createVertexArray",GL.vaos)}Module["_glGenVertexArraysOES"]=_glGenVertexArraysOES;_glGenVertexArraysOES.sig="vii";function _glDeleteVertexArraysOES(n,vaos){for(var i=0;i>2];GLctx["deleteVertexArray"](GL.vaos[id]);GL.vaos[id]=null}}Module["_glDeleteVertexArraysOES"]=_glDeleteVertexArraysOES;_glDeleteVertexArraysOES.sig="vii";function _glBindVertexArrayOES(vao){GLctx["bindVertexArray"](GL.vaos[vao])}Module["_glBindVertexArrayOES"]=_glBindVertexArrayOES;_glBindVertexArrayOES.sig="vi";function _glIsVertexArrayOES(array){var vao=GL.vaos[array];if(!vao)return 0;return GLctx["isVertexArray"](vao)}Module["_glIsVertexArrayOES"]=_glIsVertexArrayOES;_glIsVertexArrayOES.sig="ii";function _glVertexAttribPointer(index,size,type,normalized,stride,ptr){GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)}Module["_glVertexAttribPointer"]=_glVertexAttribPointer;_glVertexAttribPointer.sig="viiiiii";function _glEnableVertexAttribArray(index){GLctx.enableVertexAttribArray(index)}Module["_glEnableVertexAttribArray"]=_glEnableVertexAttribArray;_glEnableVertexAttribArray.sig="vi";function _glDisableVertexAttribArray(index){GLctx.disableVertexAttribArray(index)}Module["_glDisableVertexAttribArray"]=_glDisableVertexAttribArray;_glDisableVertexAttribArray.sig="vi";function _glDrawArrays(mode,first,count){GLctx.drawArrays(mode,first,count)}Module["_glDrawArrays"]=_glDrawArrays;_glDrawArrays.sig="viii";function _glDrawElements(mode,count,type,indices){GLctx.drawElements(mode,count,type,indices)}Module["_glDrawElements"]=_glDrawElements;_glDrawElements.sig="viiii";function _glShaderBinary(){GL.recordError(1280)}Module["_glShaderBinary"]=_glShaderBinary;_glShaderBinary.sig="v";function _glReleaseShaderCompiler(){}Module["_glReleaseShaderCompiler"]=_glReleaseShaderCompiler;_glReleaseShaderCompiler.sig="v";function _glGetError(){var error=GLctx.getError()||GL.lastError;GL.lastError=0;return error}Module["_glGetError"]=_glGetError;_glGetError.sig="i";function _glVertexAttribDivisor(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}Module["_glVertexAttribDivisor"]=_glVertexAttribDivisor;_glVertexAttribDivisor.sig="vii";function _glDrawArraysInstanced(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}Module["_glDrawArraysInstanced"]=_glDrawArraysInstanced;_glDrawArraysInstanced.sig="viiii";function _glDrawElementsInstanced(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}Module["_glDrawElementsInstanced"]=_glDrawElementsInstanced;_glDrawElementsInstanced.sig="viiiii";function _glVertexAttribDivisorNV(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}Module["_glVertexAttribDivisorNV"]=_glVertexAttribDivisorNV;_glVertexAttribDivisorNV.sig="vii";function _glDrawArraysInstancedNV(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}Module["_glDrawArraysInstancedNV"]=_glDrawArraysInstancedNV;_glDrawArraysInstancedNV.sig="viiii";function _glDrawElementsInstancedNV(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}Module["_glDrawElementsInstancedNV"]=_glDrawElementsInstancedNV;_glDrawElementsInstancedNV.sig="viiiii";function _glVertexAttribDivisorEXT(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}Module["_glVertexAttribDivisorEXT"]=_glVertexAttribDivisorEXT;_glVertexAttribDivisorEXT.sig="vii";function _glDrawArraysInstancedEXT(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}Module["_glDrawArraysInstancedEXT"]=_glDrawArraysInstancedEXT;_glDrawArraysInstancedEXT.sig="viiii";function _glDrawElementsInstancedEXT(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}Module["_glDrawElementsInstancedEXT"]=_glDrawElementsInstancedEXT;_glDrawElementsInstancedEXT.sig="viiiii";function _glVertexAttribDivisorARB(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}Module["_glVertexAttribDivisorARB"]=_glVertexAttribDivisorARB;_glVertexAttribDivisorARB.sig="vii";function _glDrawArraysInstancedARB(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}Module["_glDrawArraysInstancedARB"]=_glDrawArraysInstancedARB;_glDrawArraysInstancedARB.sig="viiii";function _glDrawElementsInstancedARB(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}Module["_glDrawElementsInstancedARB"]=_glDrawElementsInstancedARB;_glDrawElementsInstancedARB.sig="viiiii";function _glVertexAttribDivisorANGLE(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}Module["_glVertexAttribDivisorANGLE"]=_glVertexAttribDivisorANGLE;_glVertexAttribDivisorANGLE.sig="vii";function _glDrawArraysInstancedANGLE(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}Module["_glDrawArraysInstancedANGLE"]=_glDrawArraysInstancedANGLE;_glDrawArraysInstancedANGLE.sig="viiii";function _glDrawElementsInstancedANGLE(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}Module["_glDrawElementsInstancedANGLE"]=_glDrawElementsInstancedANGLE;_glDrawElementsInstancedANGLE.sig="viiiii";function _glDrawBuffers(n,bufs){var bufArray=tempFixedLengthArray[n];for(var i=0;i>2]}GLctx["drawBuffers"](bufArray)}Module["_glDrawBuffers"]=_glDrawBuffers;_glDrawBuffers.sig="vii";function _glDrawBuffersEXT(n,bufs){var bufArray=tempFixedLengthArray[n];for(var i=0;i>2]}GLctx["drawBuffers"](bufArray)}Module["_glDrawBuffersEXT"]=_glDrawBuffersEXT;_glDrawBuffersEXT.sig="vii";function _glDrawBuffersWEBGL(n,bufs){var bufArray=tempFixedLengthArray[n];for(var i=0;i>2]}GLctx["drawBuffers"](bufArray)}Module["_glDrawBuffersWEBGL"]=_glDrawBuffersWEBGL;_glDrawBuffersWEBGL.sig="vii";function _glColorMask(red,green,blue,alpha){GLctx.colorMask(!!red,!!green,!!blue,!!alpha)}Module["_glColorMask"]=_glColorMask;_glColorMask.sig="viiii";function _glDepthMask(flag){GLctx.depthMask(!!flag)}Module["_glDepthMask"]=_glDepthMask;_glDepthMask.sig="vi";function _glSampleCoverage(value,invert){GLctx.sampleCoverage(value,!!invert)}Module["_glSampleCoverage"]=_glSampleCoverage;_glSampleCoverage.sig="vii";function _glMultiDrawArrays(mode,firsts,counts,drawcount){GLctx.multiDrawWebgl["multiDrawArraysWEBGL"](mode,HEAP32,firsts>>2,HEAP32,counts>>2,drawcount)}Module["_glMultiDrawArrays"]=_glMultiDrawArrays;_glMultiDrawArrays.sig="viiii";function _glMultiDrawArraysANGLE(mode,firsts,counts,drawcount){GLctx.multiDrawWebgl["multiDrawArraysWEBGL"](mode,HEAP32,firsts>>2,HEAP32,counts>>2,drawcount)}Module["_glMultiDrawArraysANGLE"]=_glMultiDrawArraysANGLE;_glMultiDrawArraysANGLE.sig="viiii";function _glMultiDrawArraysWEBGL(mode,firsts,counts,drawcount){GLctx.multiDrawWebgl["multiDrawArraysWEBGL"](mode,HEAP32,firsts>>2,HEAP32,counts>>2,drawcount)}Module["_glMultiDrawArraysWEBGL"]=_glMultiDrawArraysWEBGL;_glMultiDrawArraysWEBGL.sig="viiii";function _glMultiDrawArraysInstancedANGLE(mode,firsts,counts,instanceCounts,drawcount){GLctx.multiDrawWebgl["multiDrawArraysInstancedWEBGL"](mode,HEAP32,firsts>>2,HEAP32,counts>>2,HEAP32,instanceCounts>>2,drawcount)}Module["_glMultiDrawArraysInstancedANGLE"]=_glMultiDrawArraysInstancedANGLE;_glMultiDrawArraysInstancedANGLE.sig="viiiii";function _glMultiDrawArraysInstancedWEBGL(mode,firsts,counts,instanceCounts,drawcount){GLctx.multiDrawWebgl["multiDrawArraysInstancedWEBGL"](mode,HEAP32,firsts>>2,HEAP32,counts>>2,HEAP32,instanceCounts>>2,drawcount)}Module["_glMultiDrawArraysInstancedWEBGL"]=_glMultiDrawArraysInstancedWEBGL;_glMultiDrawArraysInstancedWEBGL.sig="viiiii";function _glMultiDrawElements(mode,counts,type,offsets,drawcount){GLctx.multiDrawWebgl["multiDrawElementsWEBGL"](mode,HEAP32,counts>>2,type,HEAP32,offsets>>2,drawcount)}Module["_glMultiDrawElements"]=_glMultiDrawElements;_glMultiDrawElements.sig="viiiii";function _glMultiDrawElementsANGLE(mode,counts,type,offsets,drawcount){GLctx.multiDrawWebgl["multiDrawElementsWEBGL"](mode,HEAP32,counts>>2,type,HEAP32,offsets>>2,drawcount)}Module["_glMultiDrawElementsANGLE"]=_glMultiDrawElementsANGLE;_glMultiDrawElementsANGLE.sig="viiiii";function _glMultiDrawElementsWEBGL(mode,counts,type,offsets,drawcount){GLctx.multiDrawWebgl["multiDrawElementsWEBGL"](mode,HEAP32,counts>>2,type,HEAP32,offsets>>2,drawcount)}Module["_glMultiDrawElementsWEBGL"]=_glMultiDrawElementsWEBGL;_glMultiDrawElementsWEBGL.sig="viiiii";function _glMultiDrawElementsInstancedANGLE(mode,counts,type,offsets,instanceCounts,drawcount){GLctx.multiDrawWebgl["multiDrawElementsInstancedWEBGL"](mode,HEAP32,counts>>2,type,HEAP32,offsets>>2,HEAP32,instanceCounts>>2,drawcount)}Module["_glMultiDrawElementsInstancedANGLE"]=_glMultiDrawElementsInstancedANGLE;_glMultiDrawElementsInstancedANGLE.sig="viiiiii";function _glMultiDrawElementsInstancedWEBGL(mode,counts,type,offsets,instanceCounts,drawcount){GLctx.multiDrawWebgl["multiDrawElementsInstancedWEBGL"](mode,HEAP32,counts>>2,type,HEAP32,offsets>>2,HEAP32,instanceCounts>>2,drawcount)}Module["_glMultiDrawElementsInstancedWEBGL"]=_glMultiDrawElementsInstancedWEBGL;_glMultiDrawElementsInstancedWEBGL.sig="viiiiii";function _glFinish(){GLctx["finish"]()}Module["_glFinish"]=_glFinish;_glFinish.sig="v";function _glFlush(){GLctx["flush"]()}Module["_glFlush"]=_glFlush;_glFlush.sig="v";function _glClearDepth(x0){GLctx["clearDepth"](x0)}Module["_glClearDepth"]=_glClearDepth;_glClearDepth.sig="vi";function _glClearDepthf(x0){GLctx["clearDepth"](x0)}Module["_glClearDepthf"]=_glClearDepthf;_glClearDepthf.sig="vf";function _glDepthFunc(x0){GLctx["depthFunc"](x0)}Module["_glDepthFunc"]=_glDepthFunc;_glDepthFunc.sig="vi";function _glEnable(x0){GLctx["enable"](x0)}Module["_glEnable"]=_glEnable;_glEnable.sig="vi";function _glDisable(x0){GLctx["disable"](x0)}Module["_glDisable"]=_glDisable;_glDisable.sig="vi";function _glFrontFace(x0){GLctx["frontFace"](x0)}Module["_glFrontFace"]=_glFrontFace;_glFrontFace.sig="vi";function _glCullFace(x0){GLctx["cullFace"](x0)}Module["_glCullFace"]=_glCullFace;_glCullFace.sig="vi";function _glClear(x0){GLctx["clear"](x0)}Module["_glClear"]=_glClear;_glClear.sig="vi";function _glLineWidth(x0){GLctx["lineWidth"](x0)}Module["_glLineWidth"]=_glLineWidth;_glLineWidth.sig="vf";function _glClearStencil(x0){GLctx["clearStencil"](x0)}Module["_glClearStencil"]=_glClearStencil;_glClearStencil.sig="vi";function _glStencilMask(x0){GLctx["stencilMask"](x0)}Module["_glStencilMask"]=_glStencilMask;_glStencilMask.sig="vi";function _glCheckFramebufferStatus(x0){return GLctx["checkFramebufferStatus"](x0)}Module["_glCheckFramebufferStatus"]=_glCheckFramebufferStatus;_glCheckFramebufferStatus.sig="ii";function _glGenerateMipmap(x0){GLctx["generateMipmap"](x0)}Module["_glGenerateMipmap"]=_glGenerateMipmap;_glGenerateMipmap.sig="vi";function _glActiveTexture(x0){GLctx["activeTexture"](x0)}Module["_glActiveTexture"]=_glActiveTexture;_glActiveTexture.sig="vi";function _glBlendEquation(x0){GLctx["blendEquation"](x0)}Module["_glBlendEquation"]=_glBlendEquation;_glBlendEquation.sig="vi";function _glIsEnabled(x0){return GLctx["isEnabled"](x0)}Module["_glIsEnabled"]=_glIsEnabled;_glIsEnabled.sig="ii";function _glBlendFunc(x0,x1){GLctx["blendFunc"](x0,x1)}Module["_glBlendFunc"]=_glBlendFunc;_glBlendFunc.sig="vii";function _glBlendEquationSeparate(x0,x1){GLctx["blendEquationSeparate"](x0,x1)}Module["_glBlendEquationSeparate"]=_glBlendEquationSeparate;_glBlendEquationSeparate.sig="vii";function _glDepthRange(x0,x1){GLctx["depthRange"](x0,x1)}Module["_glDepthRange"]=_glDepthRange;_glDepthRange.sig="vii";function _glDepthRangef(x0,x1){GLctx["depthRange"](x0,x1)}Module["_glDepthRangef"]=_glDepthRangef;_glDepthRangef.sig="vii";function _glStencilMaskSeparate(x0,x1){GLctx["stencilMaskSeparate"](x0,x1)}Module["_glStencilMaskSeparate"]=_glStencilMaskSeparate;_glStencilMaskSeparate.sig="vii";function _glHint(x0,x1){GLctx["hint"](x0,x1)}Module["_glHint"]=_glHint;_glHint.sig="vii";function _glPolygonOffset(x0,x1){GLctx["polygonOffset"](x0,x1)}Module["_glPolygonOffset"]=_glPolygonOffset;_glPolygonOffset.sig="vff";function _glVertexAttrib1f(x0,x1){GLctx["vertexAttrib1f"](x0,x1)}Module["_glVertexAttrib1f"]=_glVertexAttrib1f;_glVertexAttrib1f.sig="vif";function _glTexParameteri(x0,x1,x2){GLctx["texParameteri"](x0,x1,x2)}Module["_glTexParameteri"]=_glTexParameteri;_glTexParameteri.sig="viii";function _glTexParameterf(x0,x1,x2){GLctx["texParameterf"](x0,x1,x2)}Module["_glTexParameterf"]=_glTexParameterf;_glTexParameterf.sig="viii";function _glVertexAttrib2f(x0,x1,x2){GLctx["vertexAttrib2f"](x0,x1,x2)}Module["_glVertexAttrib2f"]=_glVertexAttrib2f;_glVertexAttrib2f.sig="viff";function _glStencilFunc(x0,x1,x2){GLctx["stencilFunc"](x0,x1,x2)}Module["_glStencilFunc"]=_glStencilFunc;_glStencilFunc.sig="viii";function _glStencilOp(x0,x1,x2){GLctx["stencilOp"](x0,x1,x2)}Module["_glStencilOp"]=_glStencilOp;_glStencilOp.sig="viii";function _glViewport(x0,x1,x2,x3){GLctx["viewport"](x0,x1,x2,x3)}Module["_glViewport"]=_glViewport;_glViewport.sig="viiii";function _glClearColor(x0,x1,x2,x3){GLctx["clearColor"](x0,x1,x2,x3)}Module["_glClearColor"]=_glClearColor;_glClearColor.sig="vffff";function _glScissor(x0,x1,x2,x3){GLctx["scissor"](x0,x1,x2,x3)}Module["_glScissor"]=_glScissor;_glScissor.sig="viiii";function _glVertexAttrib3f(x0,x1,x2,x3){GLctx["vertexAttrib3f"](x0,x1,x2,x3)}Module["_glVertexAttrib3f"]=_glVertexAttrib3f;_glVertexAttrib3f.sig="vifff";function _glRenderbufferStorage(x0,x1,x2,x3){GLctx["renderbufferStorage"](x0,x1,x2,x3)}Module["_glRenderbufferStorage"]=_glRenderbufferStorage;_glRenderbufferStorage.sig="viiii";function _glBlendFuncSeparate(x0,x1,x2,x3){GLctx["blendFuncSeparate"](x0,x1,x2,x3)}Module["_glBlendFuncSeparate"]=_glBlendFuncSeparate;_glBlendFuncSeparate.sig="viiii";function _glBlendColor(x0,x1,x2,x3){GLctx["blendColor"](x0,x1,x2,x3)}Module["_glBlendColor"]=_glBlendColor;_glBlendColor.sig="vffff";function _glStencilFuncSeparate(x0,x1,x2,x3){GLctx["stencilFuncSeparate"](x0,x1,x2,x3)}Module["_glStencilFuncSeparate"]=_glStencilFuncSeparate;_glStencilFuncSeparate.sig="viiii";function _glStencilOpSeparate(x0,x1,x2,x3){GLctx["stencilOpSeparate"](x0,x1,x2,x3)}Module["_glStencilOpSeparate"]=_glStencilOpSeparate;_glStencilOpSeparate.sig="viiii";function _glVertexAttrib4f(x0,x1,x2,x3,x4){GLctx["vertexAttrib4f"](x0,x1,x2,x3,x4)}Module["_glVertexAttrib4f"]=_glVertexAttrib4f;_glVertexAttrib4f.sig="viffff";function _glCopyTexImage2D(x0,x1,x2,x3,x4,x5,x6,x7){GLctx["copyTexImage2D"](x0,x1,x2,x3,x4,x5,x6,x7)}Module["_glCopyTexImage2D"]=_glCopyTexImage2D;_glCopyTexImage2D.sig="viiiiiiii";function _glCopyTexSubImage2D(x0,x1,x2,x3,x4,x5,x6,x7){GLctx["copyTexSubImage2D"](x0,x1,x2,x3,x4,x5,x6,x7)}Module["_glCopyTexSubImage2D"]=_glCopyTexSubImage2D;_glCopyTexSubImage2D.sig="viiiiiiii";function _emscripten_glGenVertexArrays(n,arrays){__glGenObject(n,arrays,"createVertexArray",GL.vaos)}Module["_emscripten_glGenVertexArrays"]=_emscripten_glGenVertexArrays;_emscripten_glGenVertexArrays.sig="vii";function _emscripten_glDeleteVertexArrays(n,vaos){for(var i=0;i>2];GLctx["deleteVertexArray"](GL.vaos[id]);GL.vaos[id]=null}}Module["_emscripten_glDeleteVertexArrays"]=_emscripten_glDeleteVertexArrays;_emscripten_glDeleteVertexArrays.sig="vii";function _emscripten_glBindVertexArray(vao){GLctx["bindVertexArray"](GL.vaos[vao])}Module["_emscripten_glBindVertexArray"]=_emscripten_glBindVertexArray;_emscripten_glBindVertexArray.sig="vi";function _emscripten_glIsVertexArray(array){var vao=GL.vaos[array];if(!vao)return 0;return GLctx["isVertexArray"](vao)}Module["_emscripten_glIsVertexArray"]=_emscripten_glIsVertexArray;_emscripten_glIsVertexArray.sig="ii";function _emscripten_glVertexPointer(){throw"Legacy GL function (glVertexPointer) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation."}Module["_emscripten_glVertexPointer"]=_emscripten_glVertexPointer;function _emscripten_glMatrixMode(){throw"Legacy GL function (glMatrixMode) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation."}Module["_emscripten_glMatrixMode"]=_emscripten_glMatrixMode;function _emscripten_glBegin(){throw"Legacy GL function (glBegin) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation."}Module["_emscripten_glBegin"]=_emscripten_glBegin;function _emscripten_glLoadIdentity(){throw"Legacy GL function (glLoadIdentity) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation."}Module["_emscripten_glLoadIdentity"]=_emscripten_glLoadIdentity;function _emscripten_glVertexAttribDivisor(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}Module["_emscripten_glVertexAttribDivisor"]=_emscripten_glVertexAttribDivisor;_emscripten_glVertexAttribDivisor.sig="vii";function _emscripten_glDrawArraysInstanced(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}Module["_emscripten_glDrawArraysInstanced"]=_emscripten_glDrawArraysInstanced;_emscripten_glDrawArraysInstanced.sig="viiii";function _emscripten_glDrawElementsInstanced(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}Module["_emscripten_glDrawElementsInstanced"]=_emscripten_glDrawElementsInstanced;_emscripten_glDrawElementsInstanced.sig="viiiii";function _emscripten_glVertexAttribDivisorNV(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}Module["_emscripten_glVertexAttribDivisorNV"]=_emscripten_glVertexAttribDivisorNV;_emscripten_glVertexAttribDivisorNV.sig="vii";function _emscripten_glDrawArraysInstancedNV(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}Module["_emscripten_glDrawArraysInstancedNV"]=_emscripten_glDrawArraysInstancedNV;_emscripten_glDrawArraysInstancedNV.sig="viiii";function _emscripten_glDrawElementsInstancedNV(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}Module["_emscripten_glDrawElementsInstancedNV"]=_emscripten_glDrawElementsInstancedNV;_emscripten_glDrawElementsInstancedNV.sig="viiiii";function _emscripten_glVertexAttribDivisorEXT(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}Module["_emscripten_glVertexAttribDivisorEXT"]=_emscripten_glVertexAttribDivisorEXT;_emscripten_glVertexAttribDivisorEXT.sig="vii";function _emscripten_glDrawArraysInstancedEXT(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}Module["_emscripten_glDrawArraysInstancedEXT"]=_emscripten_glDrawArraysInstancedEXT;_emscripten_glDrawArraysInstancedEXT.sig="viiii";function _emscripten_glDrawElementsInstancedEXT(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}Module["_emscripten_glDrawElementsInstancedEXT"]=_emscripten_glDrawElementsInstancedEXT;_emscripten_glDrawElementsInstancedEXT.sig="viiiii";function _emscripten_glVertexAttribDivisorARB(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}Module["_emscripten_glVertexAttribDivisorARB"]=_emscripten_glVertexAttribDivisorARB;_emscripten_glVertexAttribDivisorARB.sig="vii";function _emscripten_glDrawArraysInstancedARB(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}Module["_emscripten_glDrawArraysInstancedARB"]=_emscripten_glDrawArraysInstancedARB;_emscripten_glDrawArraysInstancedARB.sig="viiii";function _emscripten_glDrawElementsInstancedARB(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}Module["_emscripten_glDrawElementsInstancedARB"]=_emscripten_glDrawElementsInstancedARB;_emscripten_glDrawElementsInstancedARB.sig="viiiii";function _emscripten_glDrawBuffers(n,bufs){var bufArray=tempFixedLengthArray[n];for(var i=0;i>2]}GLctx["drawBuffers"](bufArray)}Module["_emscripten_glDrawBuffers"]=_emscripten_glDrawBuffers;_emscripten_glDrawBuffers.sig="vii";function _emscripten_glDrawBuffersEXT(n,bufs){var bufArray=tempFixedLengthArray[n];for(var i=0;i>2]}GLctx["drawBuffers"](bufArray)}Module["_emscripten_glDrawBuffersEXT"]=_emscripten_glDrawBuffersEXT;_emscripten_glDrawBuffersEXT.sig="vii";function _emscripten_glMultiDrawArrays(mode,firsts,counts,drawcount){GLctx.multiDrawWebgl["multiDrawArraysWEBGL"](mode,HEAP32,firsts>>2,HEAP32,counts>>2,drawcount)}Module["_emscripten_glMultiDrawArrays"]=_emscripten_glMultiDrawArrays;_emscripten_glMultiDrawArrays.sig="viiii";function _emscripten_glMultiDrawArraysANGLE(mode,firsts,counts,drawcount){GLctx.multiDrawWebgl["multiDrawArraysWEBGL"](mode,HEAP32,firsts>>2,HEAP32,counts>>2,drawcount)}Module["_emscripten_glMultiDrawArraysANGLE"]=_emscripten_glMultiDrawArraysANGLE;_emscripten_glMultiDrawArraysANGLE.sig="viiii";function _emscripten_glMultiDrawArraysWEBGL(mode,firsts,counts,drawcount){GLctx.multiDrawWebgl["multiDrawArraysWEBGL"](mode,HEAP32,firsts>>2,HEAP32,counts>>2,drawcount)}Module["_emscripten_glMultiDrawArraysWEBGL"]=_emscripten_glMultiDrawArraysWEBGL;_emscripten_glMultiDrawArraysWEBGL.sig="viiii";function _emscripten_glMultiDrawArraysInstancedANGLE(mode,firsts,counts,instanceCounts,drawcount){GLctx.multiDrawWebgl["multiDrawArraysInstancedWEBGL"](mode,HEAP32,firsts>>2,HEAP32,counts>>2,HEAP32,instanceCounts>>2,drawcount)}Module["_emscripten_glMultiDrawArraysInstancedANGLE"]=_emscripten_glMultiDrawArraysInstancedANGLE;_emscripten_glMultiDrawArraysInstancedANGLE.sig="viiiii";function _emscripten_glMultiDrawArraysInstancedWEBGL(mode,firsts,counts,instanceCounts,drawcount){GLctx.multiDrawWebgl["multiDrawArraysInstancedWEBGL"](mode,HEAP32,firsts>>2,HEAP32,counts>>2,HEAP32,instanceCounts>>2,drawcount)}Module["_emscripten_glMultiDrawArraysInstancedWEBGL"]=_emscripten_glMultiDrawArraysInstancedWEBGL;_emscripten_glMultiDrawArraysInstancedWEBGL.sig="viiiii";function _emscripten_glMultiDrawElements(mode,counts,type,offsets,drawcount){GLctx.multiDrawWebgl["multiDrawElementsWEBGL"](mode,HEAP32,counts>>2,type,HEAP32,offsets>>2,drawcount)}Module["_emscripten_glMultiDrawElements"]=_emscripten_glMultiDrawElements;_emscripten_glMultiDrawElements.sig="viiiii";function _emscripten_glMultiDrawElementsANGLE(mode,counts,type,offsets,drawcount){GLctx.multiDrawWebgl["multiDrawElementsWEBGL"](mode,HEAP32,counts>>2,type,HEAP32,offsets>>2,drawcount)}Module["_emscripten_glMultiDrawElementsANGLE"]=_emscripten_glMultiDrawElementsANGLE;_emscripten_glMultiDrawElementsANGLE.sig="viiiii";function _emscripten_glMultiDrawElementsWEBGL(mode,counts,type,offsets,drawcount){GLctx.multiDrawWebgl["multiDrawElementsWEBGL"](mode,HEAP32,counts>>2,type,HEAP32,offsets>>2,drawcount)}Module["_emscripten_glMultiDrawElementsWEBGL"]=_emscripten_glMultiDrawElementsWEBGL;_emscripten_glMultiDrawElementsWEBGL.sig="viiiii";function _emscripten_glMultiDrawElementsInstancedANGLE(mode,counts,type,offsets,instanceCounts,drawcount){GLctx.multiDrawWebgl["multiDrawElementsInstancedWEBGL"](mode,HEAP32,counts>>2,type,HEAP32,offsets>>2,HEAP32,instanceCounts>>2,drawcount)}Module["_emscripten_glMultiDrawElementsInstancedANGLE"]=_emscripten_glMultiDrawElementsInstancedANGLE;_emscripten_glMultiDrawElementsInstancedANGLE.sig="viiiiii";function _emscripten_glMultiDrawElementsInstancedWEBGL(mode,counts,type,offsets,instanceCounts,drawcount){GLctx.multiDrawWebgl["multiDrawElementsInstancedWEBGL"](mode,HEAP32,counts>>2,type,HEAP32,offsets>>2,HEAP32,instanceCounts>>2,drawcount)}Module["_emscripten_glMultiDrawElementsInstancedWEBGL"]=_emscripten_glMultiDrawElementsInstancedWEBGL;_emscripten_glMultiDrawElementsInstancedWEBGL.sig="viiiiii";function _emscripten_glClearDepth(x0){GLctx["clearDepth"](x0)}Module["_emscripten_glClearDepth"]=_emscripten_glClearDepth;_emscripten_glClearDepth.sig="vi";function _emscripten_glDepthRange(x0,x1){GLctx["depthRange"](x0,x1)}Module["_emscripten_glDepthRange"]=_emscripten_glDepthRange;_emscripten_glDepthRange.sig="vii";function writeGLArray(arr,dst,dstLength,heapType){var len=arr.length;var writeLength=dstLength>2)+i]=arr[i]}return len}Module["writeGLArray"]=writeGLArray;function _emscripten_webgl_init_context_attributes(attributes){var a=attributes>>2;for(var i=0;i<56>>2;++i){HEAP32[a+i]=0}HEAP32[a+(0>>2)]=HEAP32[a+(4>>2)]=HEAP32[a+(12>>2)]=HEAP32[a+(16>>2)]=HEAP32[a+(32>>2)]=HEAP32[a+(40>>2)]=1}Module["_emscripten_webgl_init_context_attributes"]=_emscripten_webgl_init_context_attributes;var __emscripten_webgl_power_preferences=["default","low-power","high-performance"];Module["__emscripten_webgl_power_preferences"]=__emscripten_webgl_power_preferences;function _emscripten_webgl_do_create_context(target,attributes){var a=attributes>>2;var powerPreference=HEAP32[a+(24>>2)];var contextAttributes={"alpha":!!HEAP32[a+(0>>2)],"depth":!!HEAP32[a+(4>>2)],"stencil":!!HEAP32[a+(8>>2)],"antialias":!!HEAP32[a+(12>>2)],"premultipliedAlpha":!!HEAP32[a+(16>>2)],"preserveDrawingBuffer":!!HEAP32[a+(20>>2)],"powerPreference":__emscripten_webgl_power_preferences[powerPreference],"failIfMajorPerformanceCaveat":!!HEAP32[a+(28>>2)],majorVersion:HEAP32[a+(32>>2)],minorVersion:HEAP32[a+(36>>2)],enableExtensionsByDefault:HEAP32[a+(40>>2)],explicitSwapControl:HEAP32[a+(44>>2)],proxyContextToMainThread:HEAP32[a+(48>>2)],renderViaOffscreenBackBuffer:HEAP32[a+(52>>2)]};var canvas=findCanvasEventTarget(target);if(!canvas){return 0}if(contextAttributes.explicitSwapControl){return 0}var contextHandle=GL.createContext(canvas,contextAttributes);return contextHandle}Module["_emscripten_webgl_do_create_context"]=_emscripten_webgl_do_create_context;_emscripten_webgl_do_create_context.sig="iii";var _emscripten_webgl_create_context=_emscripten_webgl_do_create_context;Module["_emscripten_webgl_create_context"]=_emscripten_webgl_create_context;_emscripten_webgl_create_context.sig="iii";function _emscripten_webgl_do_get_current_context(){return GL.currentContext?GL.currentContext.handle:0}Module["_emscripten_webgl_do_get_current_context"]=_emscripten_webgl_do_get_current_context;var _emscripten_webgl_get_current_context=_emscripten_webgl_do_get_current_context;Module["_emscripten_webgl_get_current_context"]=_emscripten_webgl_get_current_context;_emscripten_webgl_get_current_context.sig="i";function _emscripten_webgl_do_commit_frame(){if(!GL.currentContext||!GL.currentContext.GLctx){return-3}if(!GL.currentContext.attributes.explicitSwapControl){return-3}return 0}Module["_emscripten_webgl_do_commit_frame"]=_emscripten_webgl_do_commit_frame;_emscripten_webgl_do_commit_frame.sig="i";var _emscripten_webgl_commit_frame=_emscripten_webgl_do_commit_frame;Module["_emscripten_webgl_commit_frame"]=_emscripten_webgl_commit_frame;_emscripten_webgl_commit_frame.sig="i";function _emscripten_webgl_make_context_current(contextHandle){var success=GL.makeContextCurrent(contextHandle);return success?0:-5}Module["_emscripten_webgl_make_context_current"]=_emscripten_webgl_make_context_current;_emscripten_webgl_make_context_current.sig="ii";function _emscripten_webgl_get_drawing_buffer_size(contextHandle,width,height){var GLContext=GL.getContext(contextHandle);if(!GLContext||!GLContext.GLctx||!width||!height){return-5}HEAP32[width>>2]=GLContext.GLctx.drawingBufferWidth;HEAP32[height>>2]=GLContext.GLctx.drawingBufferHeight;return 0}Module["_emscripten_webgl_get_drawing_buffer_size"]=_emscripten_webgl_get_drawing_buffer_size;_emscripten_webgl_get_drawing_buffer_size.sig="iiii";function _emscripten_webgl_get_context_attributes(c,a){if(!a)return-5;c=GL.contexts[c];if(!c)return-3;var t=c.GLctx;if(!t)return-3;t=t.getContextAttributes();HEAP32[a>>2]=t.alpha;HEAP32[a+4>>2]=t.depth;HEAP32[a+8>>2]=t.stencil;HEAP32[a+12>>2]=t.antialias;HEAP32[a+16>>2]=t.premultipliedAlpha;HEAP32[a+20>>2]=t.preserveDrawingBuffer;var power=t["powerPreference"]&&__emscripten_webgl_power_preferences.indexOf(t["powerPreference"]);HEAP32[a+24>>2]=power;HEAP32[a+28>>2]=t.failIfMajorPerformanceCaveat;HEAP32[a+32>>2]=c.version;HEAP32[a+36>>2]=0;HEAP32[a+40>>2]=c.attributes.enableExtensionsByDefault;return 0}Module["_emscripten_webgl_get_context_attributes"]=_emscripten_webgl_get_context_attributes;_emscripten_webgl_get_context_attributes.sig="iii";function _emscripten_webgl_destroy_context(contextHandle){if(GL.currentContext==contextHandle)GL.currentContext=0;GL.deleteContext(contextHandle)}Module["_emscripten_webgl_destroy_context"]=_emscripten_webgl_destroy_context;_emscripten_webgl_destroy_context.sig="vi";function _emscripten_webgl_enable_extension(contextHandle,extension){var context=GL.getContext(contextHandle);var extString=UTF8ToString(extension);if(extString.startsWith("GL_"))extString=extString.substr(3);if(extString=="ANGLE_instanced_arrays")__webgl_enable_ANGLE_instanced_arrays(GLctx);if(extString=="OES_vertex_array_object")__webgl_enable_OES_vertex_array_object(GLctx);if(extString=="WEBGL_draw_buffers")__webgl_enable_WEBGL_draw_buffers(GLctx);if(extString=="WEBGL_multi_draw")__webgl_enable_WEBGL_multi_draw(GLctx);var ext=context.GLctx.getExtension(extString);return!!ext}Module["_emscripten_webgl_enable_extension"]=_emscripten_webgl_enable_extension;_emscripten_webgl_enable_extension.sig="iii";function _emscripten_supports_offscreencanvas(){return 0}Module["_emscripten_supports_offscreencanvas"]=_emscripten_supports_offscreencanvas;function __registerWebGlEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){var webGlEventHandlerFunc=function(ev){var e=ev||event;if(getWasmTableEntry(callbackfunc)(eventTypeId,0,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:webGlEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}Module["__registerWebGlEventCallback"]=__registerWebGlEventCallback;function _emscripten_set_webglcontextlost_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){__registerWebGlEventCallback(target,userData,useCapture,callbackfunc,31,"webglcontextlost",targetThread);return 0}Module["_emscripten_set_webglcontextlost_callback_on_thread"]=_emscripten_set_webglcontextlost_callback_on_thread;_emscripten_set_webglcontextlost_callback_on_thread.sig="iiiiii";function _emscripten_set_webglcontextrestored_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){__registerWebGlEventCallback(target,userData,useCapture,callbackfunc,32,"webglcontextrestored",targetThread);return 0}Module["_emscripten_set_webglcontextrestored_callback_on_thread"]=_emscripten_set_webglcontextrestored_callback_on_thread;_emscripten_set_webglcontextrestored_callback_on_thread.sig="iiiiii";function _emscripten_is_webgl_context_lost(contextHandle){return!GL.contexts[contextHandle]||GL.contexts[contextHandle].GLctx.isContextLost()}Module["_emscripten_is_webgl_context_lost"]=_emscripten_is_webgl_context_lost;_emscripten_is_webgl_context_lost.sig="ii";function _emscripten_webgl_get_supported_extensions(){return stringToNewUTF8(GLctx.getSupportedExtensions().join(" "))}Module["_emscripten_webgl_get_supported_extensions"]=_emscripten_webgl_get_supported_extensions;_emscripten_webgl_get_supported_extensions.sig="i";function _emscripten_webgl_get_program_parameter_d(program,param){return GLctx.getProgramParameter(GL.programs[program],param)}Module["_emscripten_webgl_get_program_parameter_d"]=_emscripten_webgl_get_program_parameter_d;_emscripten_webgl_get_program_parameter_d.sig="fii";function _emscripten_webgl_get_program_info_log_utf8(program){return stringToNewUTF8(GLctx.getProgramInfoLog(GL.programs[program]))}Module["_emscripten_webgl_get_program_info_log_utf8"]=_emscripten_webgl_get_program_info_log_utf8;_emscripten_webgl_get_program_info_log_utf8.sig="ii";function _emscripten_webgl_get_shader_parameter_d(shader,param){return GLctx.getShaderParameter(GL.shaders[shader],param)}Module["_emscripten_webgl_get_shader_parameter_d"]=_emscripten_webgl_get_shader_parameter_d;_emscripten_webgl_get_shader_parameter_d.sig="fii";function _emscripten_webgl_get_shader_info_log_utf8(shader){return stringToNewUTF8(GLctx.getShaderInfoLog(GL.shaders[shader]))}Module["_emscripten_webgl_get_shader_info_log_utf8"]=_emscripten_webgl_get_shader_info_log_utf8;_emscripten_webgl_get_shader_info_log_utf8.sig="ii";function _emscripten_webgl_get_shader_source_utf8(shader){return stringToNewUTF8(GLctx.getShaderSource(GL.shaders[shader]))}Module["_emscripten_webgl_get_shader_source_utf8"]=_emscripten_webgl_get_shader_source_utf8;_emscripten_webgl_get_shader_source_utf8.sig="ii";function _emscripten_webgl_get_vertex_attrib_d(index,param){return GLctx.getVertexAttrib(index,param)}Module["_emscripten_webgl_get_vertex_attrib_d"]=_emscripten_webgl_get_vertex_attrib_d;_emscripten_webgl_get_vertex_attrib_d.sig="iii";function _emscripten_webgl_get_vertex_attrib_o(index,param){var obj=GLctx.getVertexAttrib(index,param);return obj&&obj.name}Module["_emscripten_webgl_get_vertex_attrib_o"]=_emscripten_webgl_get_vertex_attrib_o;_emscripten_webgl_get_vertex_attrib_o.sig="iii";function _emscripten_webgl_get_vertex_attrib_v(index,param,dst,dstLength,dstType){return writeGLArray(GLctx.getVertexAttrib(index,param),dst,dstLength,dstType)}Module["_emscripten_webgl_get_vertex_attrib_v"]=_emscripten_webgl_get_vertex_attrib_v;_emscripten_webgl_get_vertex_attrib_v.sig="iiiiii";function _emscripten_webgl_get_uniform_d(program,location){return GLctx.getUniform(GL.programs[program],webglGetUniformLocation(location))}Module["_emscripten_webgl_get_uniform_d"]=_emscripten_webgl_get_uniform_d;_emscripten_webgl_get_uniform_d.sig="fii";function _emscripten_webgl_get_uniform_v(program,location,dst,dstLength,dstType){return writeGLArray(GLctx.getUniform(GL.programs[program],webglGetUniformLocation(location)),dst,dstLength,dstType)}Module["_emscripten_webgl_get_uniform_v"]=_emscripten_webgl_get_uniform_v;_emscripten_webgl_get_uniform_v.sig="iiiiii";function _emscripten_webgl_get_parameter_v(param,dst,dstLength,dstType){return writeGLArray(GLctx.getParameter(param),dst,dstLength,dstType)}Module["_emscripten_webgl_get_parameter_v"]=_emscripten_webgl_get_parameter_v;_emscripten_webgl_get_parameter_v.sig="iiiii";function _emscripten_webgl_get_parameter_d(param){return GLctx.getParameter(param)}Module["_emscripten_webgl_get_parameter_d"]=_emscripten_webgl_get_parameter_d;_emscripten_webgl_get_parameter_d.sig="fi";function _emscripten_webgl_get_parameter_o(param){var obj=GLctx.getParameter(param);return obj&&obj.name}Module["_emscripten_webgl_get_parameter_o"]=_emscripten_webgl_get_parameter_o;_emscripten_webgl_get_parameter_o.sig="ii";function _emscripten_webgl_get_parameter_utf8(param){return stringToNewUTF8(GLctx.getParameter(param))}Module["_emscripten_webgl_get_parameter_utf8"]=_emscripten_webgl_get_parameter_utf8;_emscripten_webgl_get_parameter_utf8.sig="ii";function _emscripten_webgl_get_parameter_i64v(param,dst){writeI53ToI64(dst,GLctx.getParameter(param))}Module["_emscripten_webgl_get_parameter_i64v"]=_emscripten_webgl_get_parameter_i64v;_emscripten_webgl_get_parameter_i64v.sig="vii";function _SDL_GetTicks(){return Date.now()-SDL.startTime|0}Module["_SDL_GetTicks"]=_SDL_GetTicks;_SDL_GetTicks.sig="i";function _SDL_LockSurface(surf){var surfData=SDL.surfaces[surf];surfData.locked++;if(surfData.locked>1)return 0;if(!surfData.buffer){surfData.buffer=_malloc(surfData.width*surfData.height*4);HEAPU32[surf+20>>2]=surfData.buffer}HEAPU32[surf+20>>2]=surfData.buffer;if(surf==SDL.screen&&Module.screenIsReadOnly&&surfData.image)return 0;if(SDL.defaults.discardOnLock){if(!surfData.image){surfData.image=surfData.ctx.createImageData(surfData.width,surfData.height)}if(!SDL.defaults.opaqueFrontBuffer)return}else{surfData.image=surfData.ctx.getImageData(0,0,surfData.width,surfData.height)}if(surf==SDL.screen&&SDL.defaults.opaqueFrontBuffer){var data=surfData.image.data;var num=data.length;for(var i=0;i>2],y:HEAP32[rect+4>>2],w:HEAP32[rect+8>>2],h:HEAP32[rect+12>>2]}},updateRect:function(rect,r){HEAP32[rect>>2]=r.x;HEAP32[rect+4>>2]=r.y;HEAP32[rect+8>>2]=r.w;HEAP32[rect+12>>2]=r.h},intersectionOfRects:function(first,second){var leftX=Math.max(first.x,second.x);var leftY=Math.max(first.y,second.y);var rightX=Math.min(first.x+first.w,second.x+second.w);var rightY=Math.min(first.y+first.h,second.y+second.h);return{x:leftX,y:leftY,w:Math.max(leftX,rightX)-leftX,h:Math.max(leftY,rightY)-leftY}},checkPixelFormat:function(fmt){},loadColorToCSSRGB:function(color){var rgba=HEAP32[color>>2];return"rgb("+(rgba&255)+","+(rgba>>8&255)+","+(rgba>>16&255)+")"},loadColorToCSSRGBA:function(color){var rgba=HEAP32[color>>2];return"rgba("+(rgba&255)+","+(rgba>>8&255)+","+(rgba>>16&255)+","+(rgba>>24&255)/255+")"},translateColorToCSSRGBA:function(rgba){return"rgba("+(rgba&255)+","+(rgba>>8&255)+","+(rgba>>16&255)+","+(rgba>>>24)/255+")"},translateRGBAToCSSRGBA:function(r,g,b,a){return"rgba("+(r&255)+","+(g&255)+","+(b&255)+","+(a&255)/255+")"},translateRGBAToColor:function(r,g,b,a){return r|g<<8|b<<16|a<<24},makeSurface:function(width,height,flags,usePageCanvas,source,rmask,gmask,bmask,amask){flags=flags||0;var is_SDL_HWSURFACE=flags&1;var is_SDL_HWPALETTE=flags&2097152;var is_SDL_OPENGL=flags&67108864;var surf=_malloc(60);var pixelFormat=_malloc(44);var bpp=is_SDL_HWPALETTE?1:4;var buffer=0;if(!is_SDL_HWSURFACE&&!is_SDL_OPENGL){buffer=_malloc(width*height*4)}HEAP32[surf>>2]=flags;HEAPU32[surf+4>>2]=pixelFormat;HEAP32[surf+8>>2]=width;HEAP32[surf+12>>2]=height;HEAP32[surf+16>>2]=width*bpp;HEAPU32[surf+20>>2]=buffer;HEAP32[surf+36>>2]=0;HEAP32[surf+40>>2]=0;HEAP32[surf+44>>2]=Module["canvas"].width;HEAP32[surf+48>>2]=Module["canvas"].height;HEAP32[surf+56>>2]=1;HEAP32[pixelFormat>>2]=-2042224636;HEAP32[pixelFormat+4>>2]=0;HEAP8[pixelFormat+8>>0]=bpp*8;HEAP8[pixelFormat+9>>0]=bpp;HEAP32[pixelFormat+12>>2]=rmask||255;HEAP32[pixelFormat+16>>2]=gmask||65280;HEAP32[pixelFormat+20>>2]=bmask||16711680;HEAP32[pixelFormat+24>>2]=amask||4278190080;SDL.GL=SDL.GL||is_SDL_OPENGL;var canvas;if(!usePageCanvas){if(SDL.canvasPool.length>0){canvas=SDL.canvasPool.pop()}else{canvas=document.createElement("canvas")}canvas.width=width;canvas.height=height}else{canvas=Module["canvas"]}var webGLContextAttributes={antialias:SDL.glAttributes[13]!=0&&SDL.glAttributes[14]>1,depth:SDL.glAttributes[6]>0,stencil:SDL.glAttributes[7]>0,alpha:SDL.glAttributes[3]>0};var ctx=Browser.createContext(canvas,is_SDL_OPENGL,usePageCanvas,webGLContextAttributes);SDL.surfaces[surf]={width:width,height:height,canvas:canvas,ctx:ctx,surf:surf,buffer:buffer,pixelFormat:pixelFormat,alpha:255,flags:flags,locked:0,usePageCanvas:usePageCanvas,source:source,isFlagSet:function(flag){return flags&flag}};return surf},copyIndexedColorData:function(surfData,rX,rY,rW,rH){if(!surfData.colors){return}var fullWidth=Module["canvas"].width;var fullHeight=Module["canvas"].height;var startX=rX||0;var startY=rY||0;var endX=(rW||fullWidth-startX)+startX;var endY=(rH||fullHeight-startY)+startY;var buffer=surfData.buffer;if(!surfData.image.data32){surfData.image.data32=new Uint32Array(surfData.image.data.buffer)}var data32=surfData.image.data32;var colors32=surfData.colors32;for(var y=startY;y>0]]}}},freeSurface:function(surf){var refcountPointer=surf+56;var refcount=HEAP32[refcountPointer>>2];if(refcount>1){HEAP32[refcountPointer>>2]=refcount-1;return}var info=SDL.surfaces[surf];if(!info.usePageCanvas&&info.canvas)SDL.canvasPool.push(info.canvas);if(info.buffer)_free(info.buffer);_free(info.pixelFormat);_free(surf);SDL.surfaces[surf]=null;if(surf===SDL.screen){SDL.screen=null}},blitSurface:function(src,srcrect,dst,dstrect,scale){var srcData=SDL.surfaces[src];var dstData=SDL.surfaces[dst];var sr,dr;if(srcrect){sr=SDL.loadRect(srcrect)}else{sr={x:0,y:0,w:srcData.width,h:srcData.height}}if(dstrect){dr=SDL.loadRect(dstrect)}else{dr={x:0,y:0,w:srcData.width,h:srcData.height}}if(dstData.clipRect){var widthScale=!scale||sr.w===0?1:sr.w/dr.w;var heightScale=!scale||sr.h===0?1:sr.h/dr.h;dr=SDL.intersectionOfRects(dstData.clipRect,dr);sr.w=dr.w*widthScale;sr.h=dr.h*heightScale;if(dstrect){SDL.updateRect(dstrect,dr)}}var blitw,blith;if(scale){blitw=dr.w;blith=dr.h}else{blitw=sr.w;blith=sr.h}if(sr.w===0||sr.h===0||blitw===0||blith===0){return 0}var oldAlpha=dstData.ctx.globalAlpha;dstData.ctx.globalAlpha=srcData.alpha/255;dstData.ctx.drawImage(srcData.canvas,sr.x,sr.y,sr.w,sr.h,dr.x,dr.y,blitw,blith);dstData.ctx.globalAlpha=oldAlpha;if(dst!=SDL.screen){warnOnce("WARNING: copying canvas data to memory for compatibility");_SDL_LockSurface(dst);dstData.locked--}return 0},downFingers:{},savedKeydown:null,receiveEvent:function(event){function unpressAllPressedKeys(){for(var code in SDL.keyboardMap){SDL.events.push({type:"keyup",keyCode:SDL.keyboardMap[code]})}}switch(event.type){case"touchstart":case"touchmove":{event.preventDefault();var touches=[];if(event.type==="touchstart"){for(var i=0;i0?Math.max(delta,1):Math.min(delta,-1);var button=delta>0?3:4;SDL.events.push({type:"mousedown",button:button,pageX:event.pageX,pageY:event.pageY});SDL.events.push({type:"mouseup",button:button,pageX:event.pageX,pageY:event.pageY});SDL.events.push({type:"wheel",deltaX:0,deltaY:delta});event.preventDefault();break;case"mousemove":if(SDL.DOMButtons[0]===1){SDL.events.push({type:"touchmove",touch:{identifier:0,deviceID:-1,pageX:event.pageX,pageY:event.pageY}})}if(Browser.pointerLock){if("mozMovementX"in event){event["movementX"]=event["mozMovementX"];event["movementY"]=event["mozMovementY"]}if(event["movementX"]==0&&event["movementY"]==0){event.preventDefault();return}}case"keydown":case"keyup":case"keypress":case"mousedown":case"mouseup":if(event.type!=="keydown"||!SDL_unicode()&&!SDL.textInput||(event.keyCode===8||event.keyCode===9)){event.preventDefault()}if(event.type=="mousedown"){SDL.DOMButtons[event.button]=1;SDL.events.push({type:"touchstart",touch:{identifier:0,deviceID:-1,pageX:event.pageX,pageY:event.pageY}})}else if(event.type=="mouseup"){if(!SDL.DOMButtons[event.button]){return}SDL.events.push({type:"touchend",touch:{identifier:0,deviceID:-1,pageX:event.pageX,pageY:event.pageY}});SDL.DOMButtons[event.button]=0}if(event.type==="keydown"||event.type==="mousedown"){SDL.canRequestFullscreen=true}else if(event.type==="keyup"||event.type==="mouseup"){if(SDL.isRequestingFullscreen){Module["requestFullscreen"](true,true);SDL.isRequestingFullscreen=false}SDL.canRequestFullscreen=false}if(event.type==="keypress"&&SDL.savedKeydown){SDL.savedKeydown.keypressCharCode=event.charCode;SDL.savedKeydown=null}else if(event.type==="keydown"){SDL.savedKeydown=event}if(event.type!=="keypress"||SDL.textInput){SDL.events.push(event)}break;case"mouseout":for(var i=0;i<3;i++){if(SDL.DOMButtons[i]){SDL.events.push({type:"mouseup",button:i,pageX:event.pageX,pageY:event.pageY});SDL.DOMButtons[i]=0}}event.preventDefault();break;case"focus":SDL.events.push(event);event.preventDefault();break;case"blur":SDL.events.push(event);unpressAllPressedKeys();event.preventDefault();break;case"visibilitychange":SDL.events.push({type:"visibilitychange",visible:!document.hidden});unpressAllPressedKeys();event.preventDefault();break;case"unload":if(Browser.mainLoop.runner){SDL.events.push(event);Browser.mainLoop.runner()}return;case"resize":SDL.events.push(event);if(event.preventDefault){event.preventDefault()}break}if(SDL.events.length>=1e4){err("SDL event queue full, dropping events");SDL.events=SDL.events.slice(0,1e4)}SDL.flushEventsToHandler();return},lookupKeyCodeForEvent:function(event){var code=event.keyCode;if(code>=65&&code<=90){code+=32}else{code=SDL.keyCodes[event.keyCode]||event.keyCode;if(event.location===2&&code>=(224|1<<10)&&code<=(227|1<<10)){code+=4}}return code},handleEvent:function(event){if(event.handled)return;event.handled=true;switch(event.type){case"touchstart":case"touchend":case"touchmove":{Browser.calculateMouseEvent(event);break}case"keydown":case"keyup":{var down=event.type==="keydown";var code=SDL.lookupKeyCodeForEvent(event);HEAP8[SDL.keyboardState+code>>0]=down;SDL.modState=(HEAP8[SDL.keyboardState+1248>>0]?64:0)|(HEAP8[SDL.keyboardState+1249>>0]?1:0)|(HEAP8[SDL.keyboardState+1250>>0]?256:0)|(HEAP8[SDL.keyboardState+1252>>0]?128:0)|(HEAP8[SDL.keyboardState+1253>>0]?2:0)|(HEAP8[SDL.keyboardState+1254>>0]?512:0);if(down){SDL.keyboardMap[code]=event.keyCode}else{delete SDL.keyboardMap[code]}break}case"mousedown":case"mouseup":if(event.type=="mousedown"){SDL.buttonState|=1<0){if(SDL.makeCEvent(SDL.events.shift(),ptr)!==false)return 1}return 0}return SDL.events.length>0},makeCEvent:function(event,ptr){if(typeof event=="number"){_memcpy(ptr,event,28);_free(event);return}SDL.handleEvent(event);switch(event.type){case"keydown":case"keyup":{var down=event.type==="keydown";var key=SDL.lookupKeyCodeForEvent(event);var scan;if(key>=1024){scan=key-1024}else{scan=SDL.scanCodes[key]||key}HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];HEAP8[ptr+8>>0]=down?1:0;HEAP8[ptr+9>>0]=0;HEAP32[ptr+12>>2]=scan;HEAP32[ptr+16>>2]=key;HEAP16[ptr+20>>1]=SDL.modState;HEAP32[ptr+24>>2]=event.keypressCharCode||key;break}case"keypress":{HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];var cStr=intArrayFromString(String.fromCharCode(event.charCode));for(var i=0;i>0]=cStr[i]}break}case"mousedown":case"mouseup":case"mousemove":{if(event.type!="mousemove"){var down=event.type==="mousedown";HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];HEAP32[ptr+4>>2]=0;HEAP32[ptr+8>>2]=0;HEAP32[ptr+12>>2]=0;HEAP8[ptr+16>>0]=event.button+1;HEAP8[ptr+17>>0]=down?1:0;HEAP32[ptr+20>>2]=Browser.mouseX;HEAP32[ptr+24>>2]=Browser.mouseY}else{HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];HEAP32[ptr+4>>2]=0;HEAP32[ptr+8>>2]=0;HEAP32[ptr+12>>2]=0;HEAP32[ptr+16>>2]=SDL.buttonState;HEAP32[ptr+20>>2]=Browser.mouseX;HEAP32[ptr+24>>2]=Browser.mouseY;HEAP32[ptr+28>>2]=Browser.mouseMovementX;HEAP32[ptr+32>>2]=Browser.mouseMovementY}break}case"wheel":{HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];HEAP32[ptr+16>>2]=event.deltaX;HEAP32[ptr+20>>2]=event.deltaY;break}case"touchstart":case"touchend":case"touchmove":{var touch=event.touch;if(!Browser.touches[touch.identifier])break;var w=Module["canvas"].width;var h=Module["canvas"].height;var x=Browser.touches[touch.identifier].x/w;var y=Browser.touches[touch.identifier].y/h;var lx=Browser.lastTouches[touch.identifier].x/w;var ly=Browser.lastTouches[touch.identifier].y/h;var dx=x-lx;var dy=y-ly;if(touch["deviceID"]===undefined)touch.deviceID=SDL.TOUCH_DEFAULT_ID;if(dx===0&&dy===0&&event.type==="touchmove")return false;HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];HEAP32[ptr+4>>2]=_SDL_GetTicks();tempI64=[touch.deviceID>>>0,(tempDouble=touch.deviceID,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[ptr+8>>2]=tempI64[0],HEAP32[ptr+12>>2]=tempI64[1];tempI64=[touch.identifier>>>0,(tempDouble=touch.identifier,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[ptr+16>>2]=tempI64[0],HEAP32[ptr+20>>2]=tempI64[1];HEAPF32[ptr+24>>2]=x;HEAPF32[ptr+28>>2]=y;HEAPF32[ptr+32>>2]=dx;HEAPF32[ptr+36>>2]=dy;if(touch.force!==undefined){HEAPF32[ptr+40>>2]=touch.force}else{HEAPF32[ptr+40>>2]=event.type=="touchend"?0:1}break}case"unload":{HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];break}case"resize":{HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];HEAP32[ptr+4>>2]=event.w;HEAP32[ptr+8>>2]=event.h;break}case"joystick_button_up":case"joystick_button_down":{var state=event.type==="joystick_button_up"?0:1;HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];HEAP8[ptr+4>>0]=event.index;HEAP8[ptr+5>>0]=event.button;HEAP8[ptr+6>>0]=state;break}case"joystick_axis_motion":{HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];HEAP8[ptr+4>>0]=event.index;HEAP8[ptr+5>>0]=event.axis;HEAP32[ptr+8>>2]=SDL.joystickAxisValueConversion(event.value);break}case"focus":{var SDL_WINDOWEVENT_FOCUS_GAINED=12;HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];HEAP32[ptr+4>>2]=0;HEAP8[ptr+8>>0]=SDL_WINDOWEVENT_FOCUS_GAINED;break}case"blur":{var SDL_WINDOWEVENT_FOCUS_LOST=13;HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];HEAP32[ptr+4>>2]=0;HEAP8[ptr+8>>0]=SDL_WINDOWEVENT_FOCUS_LOST;break}case"visibilitychange":{var SDL_WINDOWEVENT_SHOWN=1;var SDL_WINDOWEVENT_HIDDEN=2;var visibilityEventID=event.visible?SDL_WINDOWEVENT_SHOWN:SDL_WINDOWEVENT_HIDDEN;HEAP32[ptr>>2]=SDL.DOMEventToSDLEvent[event.type];HEAP32[ptr+4>>2]=0;HEAP8[ptr+8>>0]=visibilityEventID;break}default:throw"Unhandled SDL event: "+event.type}},makeFontString:function(height,fontName){if(fontName.charAt(0)!="'"&&fontName.charAt(0)!='"'){fontName='"'+fontName+'"'}return height+"px "+fontName+", serif"},estimateTextWidth:function(fontData,text){var h=fontData.size;var fontString=SDL.makeFontString(h,fontData.name);var tempCtx=SDL_ttfContext();tempCtx.font=fontString;var ret=tempCtx.measureText(text).width|0;return ret},allocateChannels:function(num){if(SDL.numChannels&&SDL.numChannels>=num&&num!=0)return;SDL.numChannels=num;SDL.channels=[];for(var i=0;i>1]/32768}}else if(audio.format==8){for(var j=0;j>0];channelData[j]=(v>=0?v-128:v+128)/128}}else if(audio.format==33056){for(var j=0;j>2]}}else{throw"Invalid SDL audio format "+audio.format+"!"}}},debugSurface:function(surfData){out("dumping surface "+[surfData.surf,surfData.source,surfData.width,surfData.height]);var image=surfData.ctx.getImageData(0,0,surfData.width,surfData.height);var data=image.data;var num=Math.min(surfData.width,surfData.height);for(var i=0;i0},queryJoysticks:function(){for(var joystick in SDL.lastJoystickState){var state=SDL.getGamepad(joystick-1);var prevState=SDL.lastJoystickState[joystick];if(typeof state=="undefined")return;if(state===null)return;if(typeof state.timestamp!="number"||state.timestamp!=prevState.timestamp||!state.timestamp){var i;for(i=0;ideviceIndex&&deviceIndex>=0){return gamepads[deviceIndex]}return null}};Module["SDL"]=SDL;function SDL_unicode(){return SDL.unicode}Module["SDL_unicode"]=SDL_unicode;function _SDL_Linked_Version(){if(SDL.version===null){SDL.version=_malloc(3);HEAP8[SDL.version+0>>0]=1;HEAP8[SDL.version+1>>0]=3;HEAP8[SDL.version+2>>0]=0}return SDL.version}Module["_SDL_Linked_Version"]=_SDL_Linked_Version;_SDL_Linked_Version.sig="i";function _SDL_Init(initFlags){SDL.startTime=Date.now();SDL.initFlags=initFlags;if(!Module["doNotCaptureKeyboard"]){var keyboardListeningElement=Module["keyboardListeningElement"]||document;keyboardListeningElement.addEventListener("keydown",SDL.receiveEvent);keyboardListeningElement.addEventListener("keyup",SDL.receiveEvent);keyboardListeningElement.addEventListener("keypress",SDL.receiveEvent);window.addEventListener("focus",SDL.receiveEvent);window.addEventListener("blur",SDL.receiveEvent);document.addEventListener("visibilitychange",SDL.receiveEvent)}window.addEventListener("unload",SDL.receiveEvent);SDL.keyboardState=_malloc(65536);zeroMemory(SDL.keyboardState,65536);SDL.DOMEventToSDLEvent["keydown"]=768;SDL.DOMEventToSDLEvent["keyup"]=769;SDL.DOMEventToSDLEvent["keypress"]=771;SDL.DOMEventToSDLEvent["mousedown"]=1025;SDL.DOMEventToSDLEvent["mouseup"]=1026;SDL.DOMEventToSDLEvent["mousemove"]=1024;SDL.DOMEventToSDLEvent["wheel"]=1027;SDL.DOMEventToSDLEvent["touchstart"]=1792;SDL.DOMEventToSDLEvent["touchend"]=1793;SDL.DOMEventToSDLEvent["touchmove"]=1794;SDL.DOMEventToSDLEvent["unload"]=256;SDL.DOMEventToSDLEvent["resize"]=28673;SDL.DOMEventToSDLEvent["visibilitychange"]=512;SDL.DOMEventToSDLEvent["focus"]=512;SDL.DOMEventToSDLEvent["blur"]=512;SDL.DOMEventToSDLEvent["joystick_axis_motion"]=1536;SDL.DOMEventToSDLEvent["joystick_button_down"]=1539;SDL.DOMEventToSDLEvent["joystick_button_up"]=1540;return 0}Module["_SDL_Init"]=_SDL_Init;_SDL_Init.sig="ii";function _SDL_WasInit(){if(SDL.startTime===null){_SDL_Init()}return 1}Module["_SDL_WasInit"]=_SDL_WasInit;_SDL_WasInit.sig="i";function _SDL_GetVideoInfo(){var ret=_malloc(20);zeroMemory(ret,3);HEAP32[ret+12>>2]=Module["canvas"].width;HEAP32[ret+16>>2]=Module["canvas"].height;return ret}Module["_SDL_GetVideoInfo"]=_SDL_GetVideoInfo;_SDL_GetVideoInfo.sig="i";function _SDL_ListModes(format,flags){return-1}Module["_SDL_ListModes"]=_SDL_ListModes;function _SDL_VideoModeOK(width,height,depth,flags){return depth}Module["_SDL_VideoModeOK"]=_SDL_VideoModeOK;function _SDL_VideoDriverName(buf,max_size){if(SDL.startTime===null){return 0}var driverName=[101,109,115,99,114,105,112,116,101,110,95,115,100,108,95,100,114,105,118,101,114];var index=0;var size=driverName.length;if(max_size<=size){size=max_size-1}while(index>0]=value;index++}HEAP8[buf+index>>0]=0;return buf}Module["_SDL_VideoDriverName"]=_SDL_VideoDriverName;_SDL_VideoDriverName.sig="iii";function _SDL_AudioDriverName(buf,max_size){return _SDL_VideoDriverName(buf,max_size)}Module["_SDL_AudioDriverName"]=_SDL_AudioDriverName;function _SDL_SetVideoMode(width,height,depth,flags){["touchstart","touchend","touchmove","mousedown","mouseup","mousemove","DOMMouseScroll","mousewheel","wheel","mouseout"].forEach(function(event){Module["canvas"].addEventListener(event,SDL.receiveEvent,true)});var canvas=Module["canvas"];if(width==0&&height==0){width=canvas.width;height=canvas.height}if(!SDL.addedResizeListener){SDL.addedResizeListener=true;Browser.resizeListeners.push(function(w,h){if(!SDL.settingVideoMode){SDL.receiveEvent({type:"resize",w:w,h:h})}})}SDL.settingVideoMode=true;Browser.setCanvasSize(width,height);SDL.settingVideoMode=false;if(SDL.screen){SDL.freeSurface(SDL.screen);assert(!SDL.screen)}if(SDL.GL)flags=flags|67108864;SDL.screen=SDL.makeSurface(width,height,flags,true,"screen");return SDL.screen}Module["_SDL_SetVideoMode"]=_SDL_SetVideoMode;_SDL_SetVideoMode.sig="iiiii";function _SDL_GetVideoSurface(){return SDL.screen}Module["_SDL_GetVideoSurface"]=_SDL_GetVideoSurface;_SDL_GetVideoSurface.sig="i";function _SDL_AudioQuit(){for(var i=0;i0){return}if(surfData.isFlagSet(2097152)){SDL.copyIndexedColorData(surfData)}else if(!surfData.colors){var data=surfData.image.data;var buffer=surfData.buffer;assert(buffer%4==0,"Invalid buffer offset: "+buffer);var src=buffer>>2;var dst=0;var isScreen=surf==SDL.screen;var num;if(typeof CanvasPixelArray!="undefined"&&data instanceof CanvasPixelArray){num=data.length;while(dst>8&255;data[dst+2]=val>>16&255;data[dst+3]=isScreen?255:val>>24&255;src++;dst+=4}}else{var data32=new Uint32Array(data.buffer);if(isScreen&&SDL.defaults.opaqueFrontBuffer){num=data32.length;data32.set(HEAP32.subarray(src,src+num));var data8=new Uint8Array(data.buffer);var i=3;var j=i+4*num;if(num%8==0){while(i>0]*4;var start=base+x*4;data[start]=colors[val];data[start+1]=colors[val+1];data[start+2]=colors[val+2]}s+=width*3}}surfData.ctx.putImageData(surfData.image,0,0)}Module["_SDL_UnlockSurface"]=_SDL_UnlockSurface;_SDL_UnlockSurface.sig="vi";function _SDL_Flip(surf){}Module["_SDL_Flip"]=_SDL_Flip;function _SDL_UpdateRect(surf,x,y,w,h){}Module["_SDL_UpdateRect"]=_SDL_UpdateRect;function _SDL_UpdateRects(surf,numrects,rects){}Module["_SDL_UpdateRects"]=_SDL_UpdateRects;function _SDL_Delay(delay){if(!ENVIRONMENT_IS_WORKER)abort("SDL_Delay called on the main thread! Potential infinite loop, quitting. (consider building with async support like ASYNCIFY)");var now=Date.now();while(Date.now()-now>2]=65536}return SDL.keyboardState}Module["_SDL_GetKeyboardState"]=_SDL_GetKeyboardState;_SDL_GetKeyboardState.sig="ii";function _SDL_GetKeyState(){return _SDL_GetKeyboardState()}Module["_SDL_GetKeyState"]=_SDL_GetKeyState;function _SDL_GetKeyName(key){if(!SDL.keyName){SDL.keyName=allocateUTF8("unknown key")}return SDL.keyName}Module["_SDL_GetKeyName"]=_SDL_GetKeyName;_SDL_GetKeyName.sig="ii";function _SDL_GetModState(){return SDL.modState}Module["_SDL_GetModState"]=_SDL_GetModState;_SDL_GetModState.sig="i";function _SDL_GetMouseState(x,y){if(x)HEAP32[x>>2]=Browser.mouseX;if(y)HEAP32[y>>2]=Browser.mouseY;return SDL.buttonState}Module["_SDL_GetMouseState"]=_SDL_GetMouseState;_SDL_GetMouseState.sig="iii";function _SDL_WarpMouse(x,y){return}Module["_SDL_WarpMouse"]=_SDL_WarpMouse;_SDL_WarpMouse.sig="vii";function _SDL_ShowCursor(toggle){switch(toggle){case 0:if(Browser.isFullscreen){Module["canvas"].requestPointerLock();return 0}return 1;case 1:Module["canvas"].exitPointerLock();return 1;case-1:return!Browser.pointerLock;default:out("SDL_ShowCursor called with unknown toggle parameter value: "+toggle+".");break}}Module["_SDL_ShowCursor"]=_SDL_ShowCursor;_SDL_ShowCursor.sig="ii";function _SDL_GetError(){if(!SDL.errorMessage){SDL.errorMessage=allocateUTF8("unknown SDL-emscripten error")}return SDL.errorMessage}Module["_SDL_GetError"]=_SDL_GetError;_SDL_GetError.sig="i";function _SDL_SetError(){}Module["_SDL_SetError"]=_SDL_SetError;function _SDL_malloc(size){return _malloc(size)}Module["_SDL_malloc"]=_SDL_malloc;_SDL_malloc.sig="ii";function _SDL_free(ptr){_free(ptr)}Module["_SDL_free"]=_SDL_free;_SDL_free.sig="vi";function _SDL_CreateRGBSurface(flags,width,height,depth,rmask,gmask,bmask,amask){return SDL.makeSurface(width,height,flags,false,"CreateRGBSurface",rmask,gmask,bmask,amask)}Module["_SDL_CreateRGBSurface"]=_SDL_CreateRGBSurface;_SDL_CreateRGBSurface.sig="iiiiiiiii";function _SDL_CreateRGBSurfaceFrom(pixels,width,height,depth,pitch,rmask,gmask,bmask,amask){var surf=SDL.makeSurface(width,height,0,false,"CreateRGBSurfaceFrom",rmask,gmask,bmask,amask);if(depth!==32){out("TODO: Partially unimplemented SDL_CreateRGBSurfaceFrom called!");return surf}var data=SDL.surfaces[surf];var image=data.ctx.createImageData(width,height);var pitchOfDst=width*4;for(var row=0;row>0]}}data.ctx.putImageData(image,0,0);return surf}Module["_SDL_CreateRGBSurfaceFrom"]=_SDL_CreateRGBSurfaceFrom;_SDL_CreateRGBSurfaceFrom.sig="iiiiiiiiii";function _SDL_ConvertSurface(surf,format,flags){if(format){SDL.checkPixelFormat(format)}var oldData=SDL.surfaces[surf];var ret=SDL.makeSurface(oldData.width,oldData.height,oldData.flags,false,"copy:"+oldData.source);var newData=SDL.surfaces[ret];newData.ctx.globalCompositeOperation="copy";newData.ctx.drawImage(oldData.canvas,0,0);newData.ctx.globalCompositeOperation=oldData.ctx.globalCompositeOperation;return ret}Module["_SDL_ConvertSurface"]=_SDL_ConvertSurface;_SDL_ConvertSurface.sig="iiii";function _SDL_DisplayFormatAlpha(surf){return _SDL_ConvertSurface(surf)}Module["_SDL_DisplayFormatAlpha"]=_SDL_DisplayFormatAlpha;function _SDL_FreeSurface(surf){if(surf)SDL.freeSurface(surf)}Module["_SDL_FreeSurface"]=_SDL_FreeSurface;_SDL_FreeSurface.sig="vi";function _SDL_UpperBlit(src,srcrect,dst,dstrect){return SDL.blitSurface(src,srcrect,dst,dstrect,false)}Module["_SDL_UpperBlit"]=_SDL_UpperBlit;_SDL_UpperBlit.sig="iiiii";function _SDL_UpperBlitScaled(src,srcrect,dst,dstrect){return SDL.blitSurface(src,srcrect,dst,dstrect,true)}Module["_SDL_UpperBlitScaled"]=_SDL_UpperBlitScaled;_SDL_UpperBlitScaled.sig="iiiii";var _SDL_LowerBlit=_SDL_UpperBlit;Module["_SDL_LowerBlit"]=_SDL_LowerBlit;var _SDL_LowerBlitScaled=_SDL_UpperBlitScaled;Module["_SDL_LowerBlitScaled"]=_SDL_LowerBlitScaled;function _SDL_GetClipRect(surf,rect){assert(rect);var surfData=SDL.surfaces[surf];var r=surfData.clipRect||{x:0,y:0,w:surfData.width,h:surfData.height};SDL.updateRect(rect,r)}Module["_SDL_GetClipRect"]=_SDL_GetClipRect;_SDL_GetClipRect.sig="vii";function _SDL_SetClipRect(surf,rect){var surfData=SDL.surfaces[surf];if(rect){surfData.clipRect=SDL.intersectionOfRects({x:0,y:0,w:surfData.width,h:surfData.height},SDL.loadRect(rect))}else{delete surfData.clipRect}}Module["_SDL_SetClipRect"]=_SDL_SetClipRect;_SDL_SetClipRect.sig="vii";function _SDL_FillRect(surf,rect,color){var surfData=SDL.surfaces[surf];assert(!surfData.locked);if(surfData.isFlagSet(2097152)){color=surfData.colors32[color]}var r=rect?SDL.loadRect(rect):{x:0,y:0,w:surfData.width,h:surfData.height};if(surfData.clipRect){r=SDL.intersectionOfRects(surfData.clipRect,r);if(rect){SDL.updateRect(rect,r)}}surfData.ctx.save();surfData.ctx.fillStyle=SDL.translateColorToCSSRGBA(color);surfData.ctx.fillRect(r.x,r.y,r.w,r.h);surfData.ctx.restore();return 0}Module["_SDL_FillRect"]=_SDL_FillRect;_SDL_FillRect.sig="iiii";function _SDL_BlitSurface(src,srcrect,dst,dstrect){return SDL.blitSurface(src,srcrect,dst,dstrect,false)}Module["_SDL_BlitSurface"]=_SDL_BlitSurface;_SDL_BlitSurface.sig="iiiii";function _SDL_BlitScaled(src,srcrect,dst,dstrect){return SDL.blitSurface(src,srcrect,dst,dstrect,true)}Module["_SDL_BlitScaled"]=_SDL_BlitScaled;_SDL_BlitScaled.sig="iiiii";function _zoomSurface(src,x,y,smooth){var srcData=SDL.surfaces[src];var w=srcData.width*x;var h=srcData.height*y;var ret=SDL.makeSurface(Math.abs(w),Math.abs(h),srcData.flags,false,"zoomSurface");var dstData=SDL.surfaces[ret];if(x>=0&&y>=0)dstData.ctx.drawImage(srcData.canvas,0,0,w,h);else{dstData.ctx.save();dstData.ctx.scale(x<0?-1:1,y<0?-1:1);dstData.ctx.drawImage(srcData.canvas,w<0?w:0,h<0?h:0,Math.abs(w),Math.abs(h));dstData.ctx.restore()}return ret}Module["_zoomSurface"]=_zoomSurface;function _rotozoomSurface(src,angle,zoom,smooth){if(angle%360===0){return _zoomSurface(src,zoom,zoom,smooth)}var srcData=SDL.surfaces[src];var w=srcData.width*zoom;var h=srcData.height*zoom;var diagonal=Math.ceil(Math.sqrt(Math.pow(w,2)+Math.pow(h,2)));var ret=SDL.makeSurface(diagonal,diagonal,srcData.flags,false,"rotozoomSurface");var dstData=SDL.surfaces[ret];dstData.ctx.translate(diagonal/2,diagonal/2);dstData.ctx.rotate(-angle*Math.PI/180);dstData.ctx.drawImage(srcData.canvas,-w/2,-h/2,w,h);return ret}Module["_rotozoomSurface"]=_rotozoomSurface;function _SDL_SetAlpha(surf,flag,alpha){var surfData=SDL.surfaces[surf];surfData.alpha=alpha;if(!(flag&65536)){surfData.alpha=255}}Module["_SDL_SetAlpha"]=_SDL_SetAlpha;_SDL_SetAlpha.sig="iiii";function _SDL_SetColorKey(surf,flag,key){warnOnce("SDL_SetColorKey is a no-op for performance reasons");return 0}Module["_SDL_SetColorKey"]=_SDL_SetColorKey;function _SDL_PollEvent(ptr){return SDL.pollEvent(ptr)}Module["_SDL_PollEvent"]=_SDL_PollEvent;_SDL_PollEvent.sig="ii";function _SDL_PushEvent(ptr){var copy=_malloc(28);_memcpy(copy,ptr,28);SDL.events.push(copy);return 0}Module["_SDL_PushEvent"]=_SDL_PushEvent;_SDL_PushEvent.sig="ii";function _SDL_PeepEvents(events,requestedEventCount,action,from,to){switch(action){case 2:{assert(requestedEventCount==1);var index=0;var retrievedEventCount=0;while(index>0];surfData.colors[index+1]=HEAPU8[colors+(i*4+1)>>0];surfData.colors[index+2]=HEAPU8[colors+(i*4+2)>>0];surfData.colors[index+3]=255}return 1}Module["_SDL_SetColors"]=_SDL_SetColors;_SDL_SetColors.sig="iiiii";function _SDL_SetPalette(surf,flags,colors,firstColor,nColors){return _SDL_SetColors(surf,colors,firstColor,nColors)}Module["_SDL_SetPalette"]=_SDL_SetPalette;function _SDL_MapRGB(fmt,r,g,b){SDL.checkPixelFormat(fmt);return r&255|(g&255)<<8|(b&255)<<16|4278190080}Module["_SDL_MapRGB"]=_SDL_MapRGB;_SDL_MapRGB.sig="iiiii";function _SDL_MapRGBA(fmt,r,g,b,a){SDL.checkPixelFormat(fmt);return r&255|(g&255)<<8|(b&255)<<16|(a&255)<<24}Module["_SDL_MapRGBA"]=_SDL_MapRGBA;_SDL_MapRGBA.sig="iiiiii";function _SDL_GetRGB(pixel,fmt,r,g,b){SDL.checkPixelFormat(fmt);if(r){HEAP8[r>>0]=pixel&255}if(g){HEAP8[g>>0]=pixel>>8&255}if(b){HEAP8[b>>0]=pixel>>16&255}}Module["_SDL_GetRGB"]=_SDL_GetRGB;_SDL_GetRGB.sig="viiiii";function _SDL_GetRGBA(pixel,fmt,r,g,b,a){SDL.checkPixelFormat(fmt);if(r){HEAP8[r>>0]=pixel&255}if(g){HEAP8[g>>0]=pixel>>8&255}if(b){HEAP8[b>>0]=pixel>>16&255}if(a){HEAP8[a>>0]=pixel>>24&255}}Module["_SDL_GetRGBA"]=_SDL_GetRGBA;_SDL_GetRGBA.sig="viiiiii";function _SDL_GetAppState(){var state=0;if(Browser.pointerLock){state|=1}if(document.hasFocus()){state|=2}state|=4;return state}Module["_SDL_GetAppState"]=_SDL_GetAppState;_SDL_GetAppState.sig="i";function _SDL_WM_GrabInput(){}Module["_SDL_WM_GrabInput"]=_SDL_WM_GrabInput;function _SDL_WM_ToggleFullScreen(surf){if(Browser.exitFullscreen()){return 1}if(!SDL.canRequestFullscreen){return 0}SDL.isRequestingFullscreen=true;return 1}Module["_SDL_WM_ToggleFullScreen"]=_SDL_WM_ToggleFullScreen;_SDL_WM_ToggleFullScreen.sig="ii";function _IMG_Init(flags){return flags}Module["_IMG_Init"]=_IMG_Init;function _SDL_FreeRW(rwopsID){SDL.rwops[rwopsID]=null;while(SDL.rwops.length>0&&SDL.rwops[SDL.rwops.length-1]===null){SDL.rwops.pop()}}Module["_SDL_FreeRW"]=_SDL_FreeRW;_SDL_FreeRW.sig="vi";function _IMG_Load_RW(rwopsID,freeSrc){try{var cleanup=function(){if(rwops&&freeSrc)_SDL_FreeRW(rwopsID)};var addCleanup=function(func){var old=cleanup;cleanup=function added_cleanup(){old();func()}};var callStbImage=function(func,params){var x=Module["_malloc"](4);var y=Module["_malloc"](4);var comp=Module["_malloc"](4);addCleanup(function(){Module["_free"](x);Module["_free"](y);Module["_free"](comp);if(data)Module["_stbi_image_free"](data)});var data=Module["_"+func].apply(null,params.concat([x,y,comp,0]));if(!data)return null;return{rawData:true,data:data,width:HEAP32[x>>2],height:HEAP32[y>>2],size:HEAP32[x>>2]*HEAP32[y>>2]*HEAP32[comp>>2],bpp:HEAP32[comp>>2]}};var rwops=SDL.rwops[rwopsID];if(rwops===undefined){return 0}var raw;var filename=rwops.filename;if(filename===undefined){warnOnce("Only file names that have been preloaded are supported for IMG_Load_RW. Consider using STB_IMAGE=1 if you want synchronous image decoding (see settings.js), or package files with --use-preload-plugins");return 0}if(!raw){filename=PATH_FS.resolve(filename);raw=preloadedImages[filename];if(!raw){if(raw===null)err("Trying to reuse preloaded image, but freePreloadedMediaOnUse is set!");warnOnce("Cannot find preloaded image "+filename);warnOnce("Cannot find preloaded image "+filename+". Consider using STB_IMAGE=1 if you want synchronous image decoding (see settings.js), or package files with --use-preload-plugins");return 0}else if(Module["freePreloadedMediaOnUse"]){preloadedImages[filename]=null}}var surf=SDL.makeSurface(raw.width,raw.height,0,false,"load:"+filename);var surfData=SDL.surfaces[surf];surfData.ctx.globalCompositeOperation="copy";if(!raw.rawData){surfData.ctx.drawImage(raw,0,0,raw.width,raw.height,0,0,raw.width,raw.height)}else{var imageData=surfData.ctx.getImageData(0,0,surfData.width,surfData.height);if(raw.bpp==4){imageData.data.set(HEAPU8.subarray(raw.data,raw.data+raw.size))}else if(raw.bpp==3){var pixels=raw.size/3;var data=imageData.data;var sourcePtr=raw.data;var destPtr=0;for(var i=0;i>0];data[destPtr++]=HEAPU8[sourcePtr++>>0];data[destPtr++]=HEAPU8[sourcePtr++>>0];data[destPtr++]=255}}else if(raw.bpp==2){var pixels=raw.size;var data=imageData.data;var sourcePtr=raw.data;var destPtr=0;for(var i=0;i>0];var alpha=HEAPU8[sourcePtr++>>0];data[destPtr++]=gray;data[destPtr++]=gray;data[destPtr++]=gray;data[destPtr++]=alpha}}else if(raw.bpp==1){var pixels=raw.size;var data=imageData.data;var sourcePtr=raw.data;var destPtr=0;for(var i=0;i>0];data[destPtr++]=value;data[destPtr++]=value;data[destPtr++]=value;data[destPtr++]=255}}else{err("cannot handle bpp "+raw.bpp);return 0}surfData.ctx.putImageData(imageData,0,0)}surfData.ctx.globalCompositeOperation="source-over";_SDL_LockSurface(surf);surfData.locked--;if(SDL.GL){surfData.canvas=surfData.ctx=null}return surf}finally{cleanup()}}Module["_IMG_Load_RW"]=_IMG_Load_RW;_IMG_Load_RW.sig="iii";function _SDL_RWFromFile(_name,mode){var id=SDL.rwops.length;var name=UTF8ToString(_name);SDL.rwops.push({filename:name,mimetype:Browser.getMimetype(name)});return id}Module["_SDL_RWFromFile"]=_SDL_RWFromFile;_SDL_RWFromFile.sig="iii";function _IMG_Load(filename){var rwops=_SDL_RWFromFile(filename);var result=_IMG_Load_RW(rwops,1);return result}Module["_IMG_Load"]=_IMG_Load;_IMG_Load.sig="ii";var _SDL_LoadBMP=_IMG_Load;Module["_SDL_LoadBMP"]=_SDL_LoadBMP;var _SDL_LoadBMP_RW=_IMG_Load_RW;Module["_SDL_LoadBMP_RW"]=_SDL_LoadBMP_RW;function _IMG_Quit(){out("IMG_Quit called (and ignored)")}Module["_IMG_Quit"]=_IMG_Quit;function _SDL_OpenAudio(desired,obtained){try{SDL.audio={freq:HEAPU32[desired>>2],format:HEAPU16[desired+4>>1],channels:HEAPU8[desired+6>>0],samples:HEAPU16[desired+8>>1],callback:HEAPU32[desired+16>>2],userdata:HEAPU32[desired+20>>2],paused:true,timer:null};if(SDL.audio.format==8){SDL.audio.silence=128}else if(SDL.audio.format==32784){SDL.audio.silence=0}else if(SDL.audio.format==33056){SDL.audio.silence=0}else{throw"Invalid SDL audio format "+SDL.audio.format+"!"}if(SDL.audio.freq<=0){throw"Unsupported sound frequency "+SDL.audio.freq+"!"}else if(SDL.audio.freq<=22050){SDL.audio.freq=22050}else if(SDL.audio.freq<=32e3){SDL.audio.freq=32e3}else if(SDL.audio.freq<=44100){SDL.audio.freq=44100}else if(SDL.audio.freq<=48e3){SDL.audio.freq=48e3}else if(SDL.audio.freq<=96e3){SDL.audio.freq=96e3}else{throw"Unsupported sound frequency "+SDL.audio.freq+"!"}if(SDL.audio.channels==0){SDL.audio.channels=1}else if(SDL.audio.channels<0||SDL.audio.channels>32){throw"Unsupported number of audio channels for SDL audio: "+SDL.audio.channels+"!"}else if(SDL.audio.channels!=1&&SDL.audio.channels!=2){out("Warning: Using untested number of audio channels "+SDL.audio.channels)}if(SDL.audio.samples<128||SDL.audio.samples>524288){throw"Unsupported audio callback buffer size "+SDL.audio.samples+"!"}else if((SDL.audio.samples&SDL.audio.samples-1)!=0){throw"Audio callback buffer size "+SDL.audio.samples+" must be a power-of-two!"}var totalSamples=SDL.audio.samples*SDL.audio.channels;if(SDL.audio.format==8){SDL.audio.bytesPerSample=1}else if(SDL.audio.format==32784){SDL.audio.bytesPerSample=2}else if(SDL.audio.format==33056){SDL.audio.bytesPerSample=4}else{throw"Invalid SDL audio format "+SDL.audio.format+"!"}SDL.audio.bufferSize=totalSamples*SDL.audio.bytesPerSample;SDL.audio.bufferDurationSecs=SDL.audio.bufferSize/SDL.audio.bytesPerSample/SDL.audio.channels/SDL.audio.freq;SDL.audio.bufferingDelay=50/1e3;SDL.audio.buffer=_malloc(SDL.audio.bufferSize);SDL.audio.numSimultaneouslyQueuedBuffers=Module["SDL_numSimultaneouslyQueuedBuffers"]||5;SDL.audio.queueNewAudioData=function SDL_queueNewAudioData(){if(!SDL.audio)return;for(var i=0;i=SDL.audio.bufferingDelay+SDL.audio.bufferDurationSecs*SDL.audio.numSimultaneouslyQueuedBuffers)return;getWasmTableEntry(SDL.audio.callback)(SDL.audio.userdata,SDL.audio.buffer,SDL.audio.bufferSize);SDL.audio.pushAudio(SDL.audio.buffer,SDL.audio.bufferSize)}};SDL.audio.caller=function SDL_audioCaller(){if(!SDL.audio)return;--SDL.audio.numAudioTimersPending;SDL.audio.queueNewAudioData();var secsUntilNextPlayStart=SDL.audio.nextPlayTime-SDL.audioContext["currentTime"];var preemptBufferFeedSecs=SDL.audio.bufferDurationSecs/2;if(SDL.audio.numAudioTimersPending>2]=SDL.audio.freq;HEAP16[obtained+4>>1]=SDL.audio.format;HEAP8[obtained+6>>0]=SDL.audio.channels;HEAP8[obtained+7>>0]=SDL.audio.silence;HEAP16[obtained+8>>1]=SDL.audio.samples;HEAPU32[obtained+16>>2]=SDL.audio.callback;HEAPU32[obtained+20>>2]=SDL.audio.userdata}SDL.allocateChannels(32)}catch(e){out('Initializing SDL audio threw an exception: "'+e.toString()+'"! Continuing without audio.');SDL.audio=null;SDL.allocateChannels(0);if(obtained){HEAP32[obtained>>2]=0;HEAP16[obtained+4>>1]=0;HEAP8[obtained+6>>0]=0;HEAP8[obtained+7>>0]=0;HEAP16[obtained+8>>1]=0;HEAPU32[obtained+16>>2]=0;HEAPU32[obtained+20>>2]=0}}if(!SDL.audio){return-1}return 0}Module["_SDL_OpenAudio"]=_SDL_OpenAudio;_SDL_OpenAudio.sig="iii";function _SDL_PauseAudio(pauseOn){if(!SDL.audio){return}if(pauseOn){if(SDL.audio.timer!==undefined){clearTimeout(SDL.audio.timer);SDL.audio.numAudioTimersPending=0;SDL.audio.timer=undefined}}else if(!SDL.audio.timer){SDL.audio.numAudioTimersPending=1;SDL.audio.timer=safeSetTimeout(SDL.audio.caller,1)}SDL.audio.paused=pauseOn}Module["_SDL_PauseAudio"]=_SDL_PauseAudio;_SDL_PauseAudio.sig="vi";function _SDL_CloseAudio(){if(SDL.audio){if(SDL.audio.callbackRemover){SDL.audio.callbackRemover();SDL.audio.callbackRemover=null}_SDL_PauseAudio(1);_free(SDL.audio.buffer);SDL.audio=null;SDL.allocateChannels(0)}}Module["_SDL_CloseAudio"]=_SDL_CloseAudio;_SDL_CloseAudio.sig="v";function _SDL_LockAudio(){}Module["_SDL_LockAudio"]=_SDL_LockAudio;function _SDL_UnlockAudio(){}Module["_SDL_UnlockAudio"]=_SDL_UnlockAudio;function _SDL_CreateMutex(){return 0}Module["_SDL_CreateMutex"]=_SDL_CreateMutex;function _SDL_LockMutex(){}Module["_SDL_LockMutex"]=_SDL_LockMutex;function _SDL_UnlockMutex(){}Module["_SDL_UnlockMutex"]=_SDL_UnlockMutex;function _SDL_mutexP(){return 0}Module["_SDL_mutexP"]=_SDL_mutexP;function _SDL_mutexV(){return 0}Module["_SDL_mutexV"]=_SDL_mutexV;function _SDL_DestroyMutex(){}Module["_SDL_DestroyMutex"]=_SDL_DestroyMutex;function _SDL_CreateCond(){return 0}Module["_SDL_CreateCond"]=_SDL_CreateCond;function _SDL_CondSignal(){}Module["_SDL_CondSignal"]=_SDL_CondSignal;function _SDL_CondWait(){}Module["_SDL_CondWait"]=_SDL_CondWait;function _SDL_DestroyCond(){}Module["_SDL_DestroyCond"]=_SDL_DestroyCond;function _SDL_StartTextInput(){SDL.textInput=true}Module["_SDL_StartTextInput"]=_SDL_StartTextInput;_SDL_StartTextInput.sig="v";function _SDL_StopTextInput(){SDL.textInput=false}Module["_SDL_StopTextInput"]=_SDL_StopTextInput;_SDL_StopTextInput.sig="v";function _Mix_Init(flags){if(!flags)return 0;return 8}Module["_Mix_Init"]=_Mix_Init;function _Mix_Quit(){}Module["_Mix_Quit"]=_Mix_Quit;function _Mix_OpenAudio(frequency,format,channels,chunksize){SDL.openAudioContext();autoResumeAudioContext(SDL.audioContext);SDL.allocateChannels(32);SDL.mixerFrequency=frequency;SDL.mixerFormat=format;SDL.mixerNumChannels=channels;SDL.mixerChunkSize=chunksize;return 0}Module["_Mix_OpenAudio"]=_Mix_OpenAudio;_Mix_OpenAudio.sig="iiiii";var _Mix_CloseAudio=_SDL_CloseAudio;Module["_Mix_CloseAudio"]=_Mix_CloseAudio;function _Mix_AllocateChannels(num){SDL.allocateChannels(num);return num}Module["_Mix_AllocateChannels"]=_Mix_AllocateChannels;_Mix_AllocateChannels.sig="ii";function _Mix_ChannelFinished(func){SDL.channelFinished=func}Module["_Mix_ChannelFinished"]=_Mix_ChannelFinished;_Mix_ChannelFinished.sig="vi";function _Mix_Volume(channel,volume){if(channel==-1){for(var i=0;i>1;var buffer=new Float32Array(numSamples);for(var i=0;i>1]/32768}if(SDL.webAudioAvailable()){webAudio={};webAudio.decodedBuffer=buffer}else{audio=new Audio;audio.mozAudioChannelType="content";audio.numChannels=SDL.mixerNumChannels;audio.frequency=SDL.mixerFrequency}var id=SDL.audios.length;SDL.audios.push({source:"",audio:audio,webAudio:webAudio,buffer:buffer});return id}Module["_Mix_QuickLoad_RAW"]=_Mix_QuickLoad_RAW;_Mix_QuickLoad_RAW.sig="iii";function _Mix_FreeChunk(id){SDL.audios[id]=null}Module["_Mix_FreeChunk"]=_Mix_FreeChunk;_Mix_FreeChunk.sig="vi";function _Mix_ReserveChannels(num){SDL.channelMinimumNumber=num}Module["_Mix_ReserveChannels"]=_Mix_ReserveChannels;_Mix_ReserveChannels.sig="ii";function _Mix_PlayChannel(channel,id,loops){var info=SDL.audios[id];if(!info)return-1;if(!info.audio&&!info.webAudio)return-1;if(channel==-1){for(var i=SDL.channelMinimumNumber;i>2]=SDL.estimateTextWidth(fontData,UTF8ToString(text))}if(h){HEAP32[h>>2]=fontData.size}return 0}Module["_TTF_SizeText"]=_TTF_SizeText;_TTF_SizeText.sig="iiiii";var _TTF_SizeUTF8=_TTF_SizeText;Module["_TTF_SizeUTF8"]=_TTF_SizeUTF8;function _TTF_GlyphMetrics(font,ch,minx,maxx,miny,maxy,advance){var fontData=SDL.fonts[font];var width=SDL.estimateTextWidth(fontData,String.fromCharCode(ch));if(advance){HEAP32[advance>>2]=width}if(minx){HEAP32[minx>>2]=0}if(maxx){HEAP32[maxx>>2]=width}if(miny){HEAP32[miny>>2]=0}if(maxy){HEAP32[maxy>>2]=fontData.size}}Module["_TTF_GlyphMetrics"]=_TTF_GlyphMetrics;_TTF_GlyphMetrics.sig="iiiiiiii";function _TTF_FontAscent(font){var fontData=SDL.fonts[font];return fontData.size*.98|0}Module["_TTF_FontAscent"]=_TTF_FontAscent;_TTF_FontAscent.sig="ii";function _TTF_FontDescent(font){var fontData=SDL.fonts[font];return fontData.size*.02|0}Module["_TTF_FontDescent"]=_TTF_FontDescent;_TTF_FontDescent.sig="ii";function _TTF_FontHeight(font){var fontData=SDL.fonts[font];return fontData.size}Module["_TTF_FontHeight"]=_TTF_FontHeight;_TTF_FontHeight.sig="ii";var _TTF_FontLineSkip=_TTF_FontHeight;Module["_TTF_FontLineSkip"]=_TTF_FontLineSkip;function _TTF_Quit(){out("TTF_Quit called (and ignored)")}Module["_TTF_Quit"]=_TTF_Quit;var SDL_gfx={drawRectangle:function(surf,x1,y1,x2,y2,action,cssColor){x1=x1<<16>>16;y1=y1<<16>>16;x2=x2<<16>>16;y2=y2<<16>>16;var surfData=SDL.surfaces[surf];assert(!surfData.locked);var x=x1>16;y1=y1<<16>>16;x2=x2<<16>>16;y2=y2<<16>>16;var surfData=SDL.surfaces[surf];assert(!surfData.locked);surfData.ctx.save();surfData.ctx.strokeStyle=cssColor;surfData.ctx.beginPath();surfData.ctx.moveTo(x1,y1);surfData.ctx.lineTo(x2,y2);surfData.ctx.stroke();surfData.ctx.restore()},drawEllipse:function(surf,x,y,rx,ry,action,cssColor){x=x<<16>>16;y=y<<16>>16;rx=rx<<16>>16;ry=ry<<16>>16;var surfData=SDL.surfaces[surf];assert(!surfData.locked);surfData.ctx.save();surfData.ctx.beginPath();surfData.ctx.translate(x,y);surfData.ctx.scale(rx,ry);surfData.ctx.arc(0,0,1,0,2*Math.PI);surfData.ctx.restore();surfData.ctx.save();surfData.ctx[action+"Style"]=cssColor;surfData.ctx[action]();surfData.ctx.restore()},translateColorToCSSRGBA:function(rgba){return"rgba("+(rgba>>>24)+","+(rgba>>16&255)+","+(rgba>>8&255)+","+(rgba&255)+")"}};Module["SDL_gfx"]=SDL_gfx;function _boxColor(surf,x1,y1,x2,y2,color){return SDL_gfx.drawRectangle(surf,x1,y1,x2,y2,"fill",SDL_gfx.translateColorToCSSRGBA(color))}Module["_boxColor"]=_boxColor;function _boxRGBA(surf,x1,y1,x2,y2,r,g,b,a){return SDL_gfx.drawRectangle(surf,x1,y1,x2,y2,"fill",SDL.translateRGBAToCSSRGBA(r,g,b,a))}Module["_boxRGBA"]=_boxRGBA;function _rectangleColor(surf,x1,y1,x2,y2,color){return SDL_gfx.drawRectangle(surf,x1,y1,x2,y2,"stroke",SDL_gfx.translateColorToCSSRGBA(color))}Module["_rectangleColor"]=_rectangleColor;function _rectangleRGBA(surf,x1,y1,x2,y2,r,g,b,a){return SDL_gfx.drawRectangle(surf,x1,y1,x2,y2,"stroke",SDL.translateRGBAToCSSRGBA(r,g,b,a))}Module["_rectangleRGBA"]=_rectangleRGBA;function _ellipseColor(surf,x,y,rx,ry,color){return SDL_gfx.drawEllipse(surf,x,y,rx,ry,"stroke",SDL_gfx.translateColorToCSSRGBA(color))}Module["_ellipseColor"]=_ellipseColor;function _ellipseRGBA(surf,x,y,rx,ry,r,g,b,a){return SDL_gfx.drawEllipse(surf,x,y,rx,ry,"stroke",SDL.translateRGBAToCSSRGBA(r,g,b,a))}Module["_ellipseRGBA"]=_ellipseRGBA;function _filledEllipseColor(surf,x,y,rx,ry,color){return SDL_gfx.drawEllipse(surf,x,y,rx,ry,"fill",SDL_gfx.translateColorToCSSRGBA(color))}Module["_filledEllipseColor"]=_filledEllipseColor;function _filledEllipseRGBA(surf,x,y,rx,ry,r,g,b,a){return SDL_gfx.drawEllipse(surf,x,y,rx,ry,"fill",SDL.translateRGBAToCSSRGBA(r,g,b,a))}Module["_filledEllipseRGBA"]=_filledEllipseRGBA;function _lineColor(surf,x1,y1,x2,y2,color){return SDL_gfx.drawLine(surf,x1,y1,x2,y2,SDL_gfx.translateColorToCSSRGBA(color))}Module["_lineColor"]=_lineColor;function _lineRGBA(surf,x1,y1,x2,y2,r,g,b,a){return SDL_gfx.drawLine(surf,x1,y1,x2,y2,SDL.translateRGBAToCSSRGBA(r,g,b,a))}Module["_lineRGBA"]=_lineRGBA;function _pixelRGBA(surf,x1,y1,r,g,b,a){_boxRGBA(surf,x1,y1,x1,y1,r,g,b,a)}Module["_pixelRGBA"]=_pixelRGBA;function _SDL_GL_SetAttribute(attr,value){if(!(attr in SDL.glAttributes)){abort("Unknown SDL GL attribute ("+attr+"). Please check if your SDL version is supported.")}SDL.glAttributes[attr]=value}Module["_SDL_GL_SetAttribute"]=_SDL_GL_SetAttribute;_SDL_GL_SetAttribute.sig="iii";function _SDL_GL_GetAttribute(attr,value){if(!(attr in SDL.glAttributes)){abort("Unknown SDL GL attribute ("+attr+"). Please check if your SDL version is supported.")}if(value)HEAP32[value>>2]=SDL.glAttributes[attr];return 0}Module["_SDL_GL_GetAttribute"]=_SDL_GL_GetAttribute;_SDL_GL_GetAttribute.sig="iii";function _SDL_GL_SwapBuffers(){if(Browser.doSwapBuffers)Browser.doSwapBuffers()}Module["_SDL_GL_SwapBuffers"]=_SDL_GL_SwapBuffers;_SDL_GL_SwapBuffers.sig="v";function _SDL_GL_ExtensionSupported(extension){return Module.ctx.getExtension(extension)|0}Module["_SDL_GL_ExtensionSupported"]=_SDL_GL_ExtensionSupported;_SDL_GL_ExtensionSupported.sig="ii";function _SDL_DestroyWindow(window){}Module["_SDL_DestroyWindow"]=_SDL_DestroyWindow;function _SDL_DestroyRenderer(renderer){}Module["_SDL_DestroyRenderer"]=_SDL_DestroyRenderer;function _SDL_GetWindowFlags(){}Module["_SDL_GetWindowFlags"]=_SDL_GetWindowFlags;_SDL_GetWindowFlags.sig="iii";function _SDL_GL_SwapWindow(window){}Module["_SDL_GL_SwapWindow"]=_SDL_GL_SwapWindow;function _SDL_GL_MakeCurrent(window,context){}Module["_SDL_GL_MakeCurrent"]=_SDL_GL_MakeCurrent;function _SDL_GL_DeleteContext(context){}Module["_SDL_GL_DeleteContext"]=_SDL_GL_DeleteContext;function _SDL_GL_GetSwapInterval(state){if(Browser.mainLoop.timingMode==1)return Browser.mainLoop.timingValue;else return 0}Module["_SDL_GL_GetSwapInterval"]=_SDL_GL_GetSwapInterval;_SDL_GL_GetSwapInterval.sig="ii";function _SDL_GL_SetSwapInterval(state){_emscripten_set_main_loop_timing(1,state)}Module["_SDL_GL_SetSwapInterval"]=_SDL_GL_SetSwapInterval;function _SDL_SetWindowTitle(window,title){if(title)document.title=UTF8ToString(title)}Module["_SDL_SetWindowTitle"]=_SDL_SetWindowTitle;_SDL_SetWindowTitle.sig="vii";function _SDL_GetWindowSize(window,width,height){var w=Module["canvas"].width;var h=Module["canvas"].height;if(width)HEAP32[width>>2]=w;if(height)HEAP32[height>>2]=h}Module["_SDL_GetWindowSize"]=_SDL_GetWindowSize;_SDL_GetWindowSize.sig="viii";function _SDL_LogSetOutputFunction(callback,userdata){}Module["_SDL_LogSetOutputFunction"]=_SDL_LogSetOutputFunction;function _SDL_SetWindowFullscreen(window,fullscreen){if(Browser.isFullscreen){Module["canvas"].exitFullscreen();return 1}return 0}Module["_SDL_SetWindowFullscreen"]=_SDL_SetWindowFullscreen;_SDL_SetWindowFullscreen.sig="iii";function _SDL_ClearError(){}Module["_SDL_ClearError"]=_SDL_ClearError;function _SDL_SetGamma(r,g,b){return-1}Module["_SDL_SetGamma"]=_SDL_SetGamma;function _SDL_SetGammaRamp(redTable,greenTable,blueTable){return-1}Module["_SDL_SetGammaRamp"]=_SDL_SetGammaRamp;function _SDL_NumJoysticks(){var count=0;var gamepads=SDL.getGamepads();for(var i=0;iaxis){return SDL.joystickAxisValueConversion(gamepad.axes[axis])}return 0}Module["_SDL_JoystickGetAxis"]=_SDL_JoystickGetAxis;_SDL_JoystickGetAxis.sig="iii";function _SDL_JoystickGetHat(joystick,hat){return 0}Module["_SDL_JoystickGetHat"]=_SDL_JoystickGetHat;function _SDL_JoystickGetBall(joystick,ball,dxptr,dyptr){return-1}Module["_SDL_JoystickGetBall"]=_SDL_JoystickGetBall;function _SDL_JoystickGetButton(joystick,button){var gamepad=SDL.getGamepad(joystick-1);if(gamepad&&gamepad.buttons.length>button){return SDL.getJoystickButtonState(gamepad.buttons[button])?1:0}return 0}Module["_SDL_JoystickGetButton"]=_SDL_JoystickGetButton;_SDL_JoystickGetButton.sig="iii";function _SDL_JoystickClose(joystick){delete SDL.lastJoystickState[joystick]}Module["_SDL_JoystickClose"]=_SDL_JoystickClose;_SDL_JoystickClose.sig="vi";function _SDL_InitSubSystem(flags){return 0}Module["_SDL_InitSubSystem"]=_SDL_InitSubSystem;function _SDL_RWFromConstMem(mem,size){var id=SDL.rwops.length;SDL.rwops.push({bytes:mem,count:size});return id}Module["_SDL_RWFromConstMem"]=_SDL_RWFromConstMem;_SDL_RWFromConstMem.sig="iii";var _SDL_RWFromMem=_SDL_RWFromConstMem;Module["_SDL_RWFromMem"]=_SDL_RWFromMem;function _SDL_GetNumAudioDrivers(){return 1}Module["_SDL_GetNumAudioDrivers"]=_SDL_GetNumAudioDrivers;function _SDL_GetCurrentAudioDriver(){return allocateUTF8("Emscripten Audio")}Module["_SDL_GetCurrentAudioDriver"]=_SDL_GetCurrentAudioDriver;function _SDL_GetScancodeFromKey(key){return SDL.scanCodes[key]}Module["_SDL_GetScancodeFromKey"]=_SDL_GetScancodeFromKey;function _SDL_GetAudioDriver(index){return _SDL_GetCurrentAudioDriver()}Module["_SDL_GetAudioDriver"]=_SDL_GetAudioDriver;function _SDL_EnableUNICODE(on){var ret=SDL.unicode||0;SDL.unicode=on;return ret}Module["_SDL_EnableUNICODE"]=_SDL_EnableUNICODE;_SDL_EnableUNICODE.sig="ii";function _SDL_AddTimer(interval,callback,param){return safeSetTimeout(()=>getWasmTableEntry(callback)(interval,param),interval)}Module["_SDL_AddTimer"]=_SDL_AddTimer;_SDL_AddTimer.sig="iiii";function _SDL_RemoveTimer(id){clearTimeout(id);return true}Module["_SDL_RemoveTimer"]=_SDL_RemoveTimer;_SDL_RemoveTimer.sig="ii";function _SDL_CreateThread(){throw"SDL threads cannot be supported in the web platform because they assume shared state. See emscripten_create_worker etc. for a message-passing concurrency model that does let you run code in another thread."}Module["_SDL_CreateThread"]=_SDL_CreateThread;function _SDL_WaitThread(){throw"SDL_WaitThread"}Module["_SDL_WaitThread"]=_SDL_WaitThread;function _SDL_GetThreadID(){throw"SDL_GetThreadID"}Module["_SDL_GetThreadID"]=_SDL_GetThreadID;function _SDL_ThreadID(){return 0}Module["_SDL_ThreadID"]=_SDL_ThreadID;function _SDL_AllocRW(){throw"SDL_AllocRW: TODO"}Module["_SDL_AllocRW"]=_SDL_AllocRW;function _SDL_CondBroadcast(){throw"SDL_CondBroadcast: TODO"}Module["_SDL_CondBroadcast"]=_SDL_CondBroadcast;function _SDL_CondWaitTimeout(){throw"SDL_CondWaitTimeout: TODO"}Module["_SDL_CondWaitTimeout"]=_SDL_CondWaitTimeout;function _SDL_WM_IconifyWindow(){throw"SDL_WM_IconifyWindow TODO"}Module["_SDL_WM_IconifyWindow"]=_SDL_WM_IconifyWindow;function _Mix_SetPostMix(){warnOnce("Mix_SetPostMix: TODO")}Module["_Mix_SetPostMix"]=_Mix_SetPostMix;function _Mix_VolumeChunk(chunk,volume){throw"Mix_VolumeChunk: TODO"}Module["_Mix_VolumeChunk"]=_Mix_VolumeChunk;function _Mix_SetPosition(channel,angle,distance){throw"Mix_SetPosition: TODO"}Module["_Mix_SetPosition"]=_Mix_SetPosition;function _Mix_QuerySpec(){throw"Mix_QuerySpec: TODO"}Module["_Mix_QuerySpec"]=_Mix_QuerySpec;function _Mix_FadeInChannelTimed(){throw"Mix_FadeInChannelTimed"}Module["_Mix_FadeInChannelTimed"]=_Mix_FadeInChannelTimed;function _Mix_FadeOutChannel(){throw"Mix_FadeOutChannel"}Module["_Mix_FadeOutChannel"]=_Mix_FadeOutChannel;function _Mix_Linked_Version(){throw"Mix_Linked_Version: TODO"}Module["_Mix_Linked_Version"]=_Mix_Linked_Version;function _SDL_SaveBMP_RW(){throw"SDL_SaveBMP_RW: TODO"}Module["_SDL_SaveBMP_RW"]=_SDL_SaveBMP_RW;function _SDL_WM_SetIcon(){}Module["_SDL_WM_SetIcon"]=_SDL_WM_SetIcon;function _SDL_HasRDTSC(){return 0}Module["_SDL_HasRDTSC"]=_SDL_HasRDTSC;function _SDL_HasMMX(){return 0}Module["_SDL_HasMMX"]=_SDL_HasMMX;function _SDL_HasMMXExt(){return 0}Module["_SDL_HasMMXExt"]=_SDL_HasMMXExt;function _SDL_Has3DNow(){return 0}Module["_SDL_Has3DNow"]=_SDL_Has3DNow;function _SDL_Has3DNowExt(){return 0}Module["_SDL_Has3DNowExt"]=_SDL_Has3DNowExt;function _SDL_HasSSE(){return 0}Module["_SDL_HasSSE"]=_SDL_HasSSE;function _SDL_HasSSE2(){return 0}Module["_SDL_HasSSE2"]=_SDL_HasSSE2;function _SDL_HasAltiVec(){return 0}Module["_SDL_HasAltiVec"]=_SDL_HasAltiVec;function _glutPostRedisplay(){if(GLUT.displayFunc&&!GLUT.requestedAnimationFrame){GLUT.requestedAnimationFrame=true;Browser.requestAnimationFrame(function(){GLUT.requestedAnimationFrame=false;Browser.mainLoop.runIter(function(){getWasmTableEntry(GLUT.displayFunc)()})})}}Module["_glutPostRedisplay"]=_glutPostRedisplay;_glutPostRedisplay.sig="v";var GLUT={initTime:null,idleFunc:null,displayFunc:null,keyboardFunc:null,keyboardUpFunc:null,specialFunc:null,specialUpFunc:null,reshapeFunc:null,motionFunc:null,passiveMotionFunc:null,mouseFunc:null,buttons:0,modifiers:0,initWindowWidth:256,initWindowHeight:256,initDisplayMode:18,windowX:0,windowY:0,windowWidth:0,windowHeight:0,requestedAnimationFrame:false,saveModifiers:function(event){GLUT.modifiers=0;if(event["shiftKey"])GLUT.modifiers+=1;if(event["ctrlKey"])GLUT.modifiers+=2;if(event["altKey"])GLUT.modifiers+=4},onMousemove:function(event){var lastX=Browser.mouseX;var lastY=Browser.mouseY;Browser.calculateMouseEvent(event);var newX=Browser.mouseX;var newY=Browser.mouseY;if(newX==lastX&&newY==lastY)return;if(GLUT.buttons==0&&event.target==Module["canvas"]&&GLUT.passiveMotionFunc){event.preventDefault();GLUT.saveModifiers(event);getWasmTableEntry(GLUT.passiveMotionFunc)(lastX,lastY)}else if(GLUT.buttons!=0&&GLUT.motionFunc){event.preventDefault();GLUT.saveModifiers(event);getWasmTableEntry(GLUT.motionFunc)(lastX,lastY)}},getSpecialKey:function(keycode){var key=null;switch(keycode){case 8:key=120;break;case 46:key=111;break;case 112:key=1;break;case 113:key=2;break;case 114:key=3;break;case 115:key=4;break;case 116:key=5;break;case 117:key=6;break;case 118:key=7;break;case 119:key=8;break;case 120:key=9;break;case 121:key=10;break;case 122:key=11;break;case 123:key=12;break;case 37:key=100;break;case 38:key=101;break;case 39:key=102;break;case 40:key=103;break;case 33:key=104;break;case 34:key=105;break;case 36:key=106;break;case 35:key=107;break;case 45:key=108;break;case 16:case 5:key=112;break;case 6:key=113;break;case 17:case 3:key=114;break;case 4:key=115;break;case 18:case 2:key=116;break;case 1:key=117;break}return key},getASCIIKey:function(event){if(event["ctrlKey"]||event["altKey"]||event["metaKey"])return null;var keycode=event["keyCode"];if(48<=keycode&&keycode<=57)return keycode;if(65<=keycode&&keycode<=90)return event["shiftKey"]?keycode:keycode+32;if(96<=keycode&&keycode<=105)return keycode-48;if(106<=keycode&&keycode<=111)return keycode-106+42;switch(keycode){case 9:case 13:case 27:case 32:case 61:return keycode}var s=event["shiftKey"];switch(keycode){case 186:return s?58:59;case 187:return s?43:61;case 188:return s?60:44;case 189:return s?95:45;case 190:return s?62:46;case 191:return s?63:47;case 219:return s?123:91;case 220:return s?124:47;case 221:return s?125:93;case 222:return s?34:39}return null},onKeydown:function(event){if(GLUT.specialFunc||GLUT.keyboardFunc){var key=GLUT.getSpecialKey(event["keyCode"]);if(key!==null){if(GLUT.specialFunc){event.preventDefault();GLUT.saveModifiers(event);getWasmTableEntry(GLUT.specialFunc)(key,Browser.mouseX,Browser.mouseY)}}else{key=GLUT.getASCIIKey(event);if(key!==null&&GLUT.keyboardFunc){event.preventDefault();GLUT.saveModifiers(event);getWasmTableEntry(GLUT.keyboardFunc)(key,Browser.mouseX,Browser.mouseY)}}}},onKeyup:function(event){if(GLUT.specialUpFunc||GLUT.keyboardUpFunc){var key=GLUT.getSpecialKey(event["keyCode"]);if(key!==null){if(GLUT.specialUpFunc){event.preventDefault();GLUT.saveModifiers(event);getWasmTableEntry(GLUT.specialUpFunc)(key,Browser.mouseX,Browser.mouseY)}}else{key=GLUT.getASCIIKey(event);if(key!==null&&GLUT.keyboardUpFunc){event.preventDefault();GLUT.saveModifiers(event);getWasmTableEntry(GLUT.keyboardUpFunc)(key,Browser.mouseX,Browser.mouseY)}}}},touchHandler:function(event){if(event.target!=Module["canvas"]){return}var touches=event.changedTouches,main=touches[0],type="";switch(event.type){case"touchstart":type="mousedown";break;case"touchmove":type="mousemove";break;case"touchend":type="mouseup";break;default:return}var simulatedEvent=document.createEvent("MouseEvent");simulatedEvent.initMouseEvent(type,true,true,window,1,main.screenX,main.screenY,main.clientX,main.clientY,false,false,false,false,0,null);main.target.dispatchEvent(simulatedEvent);event.preventDefault()},onMouseButtonDown:function(event){Browser.calculateMouseEvent(event);GLUT.buttons|=1<0?Math.max(delta,1):Math.min(delta,-1);var button=3;if(delta<0){button=4}if(GLUT.mouseFunc){event.preventDefault();GLUT.saveModifiers(event);getWasmTableEntry(GLUT.mouseFunc)(button,0,Browser.mouseX,Browser.mouseY)}},onFullscreenEventChange:function(event){var width;var height;if(document["fullscreen"]||document["fullScreen"]||document["mozFullScreen"]||document["webkitIsFullScreen"]){width=screen["width"];height=screen["height"]}else{width=GLUT.windowWidth;height=GLUT.windowHeight;document.removeEventListener("fullscreenchange",GLUT.onFullscreenEventChange,true);document.removeEventListener("mozfullscreenchange",GLUT.onFullscreenEventChange,true);document.removeEventListener("webkitfullscreenchange",GLUT.onFullscreenEventChange,true)}Browser.setCanvasSize(width,height,true);if(GLUT.reshapeFunc){getWasmTableEntry(GLUT.reshapeFunc)(width,height)}_glutPostRedisplay()}};Module["GLUT"]=GLUT;function _glutGetModifiers(){return GLUT.modifiers}Module["_glutGetModifiers"]=_glutGetModifiers;_glutGetModifiers.sig="i";function _glutInit(argcp,argv){GLUT.initTime=Date.now();var isTouchDevice="ontouchstart"in document.documentElement;if(isTouchDevice){window.addEventListener("touchmove",GLUT.touchHandler,true);window.addEventListener("touchstart",GLUT.touchHandler,true);window.addEventListener("touchend",GLUT.touchHandler,true)}window.addEventListener("keydown",GLUT.onKeydown,true);window.addEventListener("keyup",GLUT.onKeyup,true);window.addEventListener("mousemove",GLUT.onMousemove,true);window.addEventListener("mousedown",GLUT.onMouseButtonDown,true);window.addEventListener("mouseup",GLUT.onMouseButtonUp,true);window.addEventListener("mousewheel",GLUT.onMouseWheel,true);window.addEventListener("DOMMouseScroll",GLUT.onMouseWheel,true);Browser.resizeListeners.push(function(width,height){if(GLUT.reshapeFunc){getWasmTableEntry(GLUT.reshapeFunc)(width,height)}});__ATEXIT__.push(function(){if(isTouchDevice){window.removeEventListener("touchmove",GLUT.touchHandler,true);window.removeEventListener("touchstart",GLUT.touchHandler,true);window.removeEventListener("touchend",GLUT.touchHandler,true)}window.removeEventListener("keydown",GLUT.onKeydown,true);window.removeEventListener("keyup",GLUT.onKeyup,true);window.removeEventListener("mousemove",GLUT.onMousemove,true);window.removeEventListener("mousedown",GLUT.onMouseButtonDown,true);window.removeEventListener("mouseup",GLUT.onMouseButtonUp,true);window.removeEventListener("mousewheel",GLUT.onMouseWheel,true);window.removeEventListener("DOMMouseScroll",GLUT.onMouseWheel,true);Module["canvas"].width=Module["canvas"].height=1})}Module["_glutInit"]=_glutInit;_glutInit.sig="vii";function _glutInitWindowSize(width,height){Browser.setCanvasSize(GLUT.initWindowWidth=width,GLUT.initWindowHeight=height)}Module["_glutInitWindowSize"]=_glutInitWindowSize;_glutInitWindowSize.sig="vii";function _glutInitWindowPosition(x,y){}Module["_glutInitWindowPosition"]=_glutInitWindowPosition;_glutInitWindowPosition.sig="vii";function _glutGet(type){switch(type){case 100:return 0;case 101:return 0;case 102:return Module["canvas"].width;case 103:return Module["canvas"].height;case 200:return Module["canvas"].width;case 201:return Module["canvas"].height;case 500:return 0;case 501:return 0;case 502:return GLUT.initWindowWidth;case 503:return GLUT.initWindowHeight;case 700:var now=Date.now();return now-GLUT.initTime;case 105:return Module.ctx.getContextAttributes().stencil?8:0;case 106:return Module.ctx.getContextAttributes().depth?8:0;case 110:return Module.ctx.getContextAttributes().alpha?8:0;case 120:return Module.ctx.getContextAttributes().antialias?1:0;default:throw"glutGet("+type+") not implemented yet"}}Module["_glutGet"]=_glutGet;function _glutIdleFunc(func){function callback(){if(GLUT.idleFunc){getWasmTableEntry(GLUT.idleFunc)();safeSetTimeout(callback,4)}}if(!GLUT.idleFunc){safeSetTimeout(callback,0)}GLUT.idleFunc=func}Module["_glutIdleFunc"]=_glutIdleFunc;_glutIdleFunc.sig="vi";function _glutTimerFunc(msec,func,value){safeSetTimeout(function(){getWasmTableEntry(func)(value)},msec)}Module["_glutTimerFunc"]=_glutTimerFunc;_glutTimerFunc.sig="viii";function _glutDisplayFunc(func){GLUT.displayFunc=func}Module["_glutDisplayFunc"]=_glutDisplayFunc;_glutDisplayFunc.sig="vi";function _glutKeyboardFunc(func){GLUT.keyboardFunc=func}Module["_glutKeyboardFunc"]=_glutKeyboardFunc;_glutKeyboardFunc.sig="vi";function _glutKeyboardUpFunc(func){GLUT.keyboardUpFunc=func}Module["_glutKeyboardUpFunc"]=_glutKeyboardUpFunc;_glutKeyboardUpFunc.sig="vi";function _glutSpecialFunc(func){GLUT.specialFunc=func}Module["_glutSpecialFunc"]=_glutSpecialFunc;_glutSpecialFunc.sig="vi";function _glutSpecialUpFunc(func){GLUT.specialUpFunc=func}Module["_glutSpecialUpFunc"]=_glutSpecialUpFunc;_glutSpecialUpFunc.sig="vi";function _glutReshapeFunc(func){GLUT.reshapeFunc=func}Module["_glutReshapeFunc"]=_glutReshapeFunc;_glutReshapeFunc.sig="vi";function _glutMotionFunc(func){GLUT.motionFunc=func}Module["_glutMotionFunc"]=_glutMotionFunc;_glutMotionFunc.sig="vi";function _glutPassiveMotionFunc(func){GLUT.passiveMotionFunc=func}Module["_glutPassiveMotionFunc"]=_glutPassiveMotionFunc;_glutPassiveMotionFunc.sig="vi";function _glutMouseFunc(func){GLUT.mouseFunc=func}Module["_glutMouseFunc"]=_glutMouseFunc;_glutMouseFunc.sig="vi";function _glutSetCursor(cursor){var cursorStyle="auto";switch(cursor){case 0:break;case 1:break;case 2:cursorStyle="pointer";break;case 3:break;case 4:cursorStyle="help";break;case 5:break;case 6:break;case 7:cursorStyle="wait";break;case 8:cursorStyle="text";break;case 9:case 102:cursorStyle="crosshair";break;case 10:cursorStyle="ns-resize";break;case 11:cursorStyle="ew-resize";break;case 12:cursorStyle="n-resize";break;case 13:cursorStyle="s-resize";break;case 14:cursorStyle="w-resize";break;case 15:cursorStyle="e-resize";break;case 16:cursorStyle="nw-resize";break;case 17:cursorStyle="ne-resize";break;case 18:cursorStyle="se-resize";break;case 19:cursorStyle="sw-resize";break;case 100:break;case 101:cursorStyle="none";break;default:throw"glutSetCursor: Unknown cursor type: "+cursor}Module["canvas"].style.cursor=cursorStyle}Module["_glutSetCursor"]=_glutSetCursor;_glutSetCursor.sig="vi";function _glutCreateWindow(name){var contextAttributes={antialias:(GLUT.initDisplayMode&128)!=0,depth:(GLUT.initDisplayMode&16)!=0,stencil:(GLUT.initDisplayMode&32)!=0,alpha:(GLUT.initDisplayMode&8)!=0};Module.ctx=Browser.createContext(Module["canvas"],true,true,contextAttributes);return Module.ctx?1:0}Module["_glutCreateWindow"]=_glutCreateWindow;_glutCreateWindow.sig="ii";function _glutDestroyWindow(name){Module.ctx=Browser.destroyContext(Module["canvas"],true,true);return 1}Module["_glutDestroyWindow"]=_glutDestroyWindow;_glutDestroyWindow.sig="ii";function _glutReshapeWindow(width,height){Browser.exitFullscreen();Browser.setCanvasSize(width,height,true);if(GLUT.reshapeFunc){getWasmTableEntry(GLUT.reshapeFunc)(width,height)}_glutPostRedisplay()}Module["_glutReshapeWindow"]=_glutReshapeWindow;_glutReshapeWindow.sig="vi";function _glutPositionWindow(x,y){Browser.exitFullscreen();_glutPostRedisplay()}Module["_glutPositionWindow"]=_glutPositionWindow;_glutPositionWindow.sig="vii";function _glutFullScreen(){GLUT.windowX=0;GLUT.windowY=0;GLUT.windowWidth=Module["canvas"].width;GLUT.windowHeight=Module["canvas"].height;document.addEventListener("fullscreenchange",GLUT.onFullscreenEventChange,true);document.addEventListener("mozfullscreenchange",GLUT.onFullscreenEventChange,true);document.addEventListener("webkitfullscreenchange",GLUT.onFullscreenEventChange,true);Browser.requestFullscreen(false,false)}Module["_glutFullScreen"]=_glutFullScreen;_glutFullScreen.sig="v";function _glutInitDisplayMode(mode){GLUT.initDisplayMode=mode}Module["_glutInitDisplayMode"]=_glutInitDisplayMode;_glutInitDisplayMode.sig="vi";function _glutSwapBuffers(){}Module["_glutSwapBuffers"]=_glutSwapBuffers;_glutSwapBuffers.sig="v";function _glutMainLoop(){_glutReshapeWindow(Module["canvas"].width,Module["canvas"].height);_glutPostRedisplay();throw"unwind"}Module["_glutMainLoop"]=_glutMainLoop;_glutMainLoop.sig="v";function _XOpenDisplay(){return 1}Module["_XOpenDisplay"]=_XOpenDisplay;function _XCreateWindow(display,parent,x,y,width,height,border_width,depth,class_,visual,valuemask,attributes){Browser.setCanvasSize(width,height);return 2}Module["_XCreateWindow"]=_XCreateWindow;function _XChangeWindowAttributes(){}Module["_XChangeWindowAttributes"]=_XChangeWindowAttributes;function _XSetWMHints(){}Module["_XSetWMHints"]=_XSetWMHints;function _XMapWindow(){}Module["_XMapWindow"]=_XMapWindow;function _XStoreName(){}Module["_XStoreName"]=_XStoreName;function _XInternAtom(display,name_,hmm){return 0}Module["_XInternAtom"]=_XInternAtom;function _XSendEvent(){}Module["_XSendEvent"]=_XSendEvent;function _XPending(display){return 0}Module["_XPending"]=_XPending;var EGL={errorCode:12288,defaultDisplayInitialized:false,currentContext:0,currentReadSurface:0,currentDrawSurface:0,contextAttributes:{alpha:false,depth:false,stencil:false,antialias:false},stringCache:{},setErrorCode:function(code){EGL.errorCode=code},chooseConfig:function(display,attribList,config,config_size,numConfigs){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(attribList){for(;;){var param=HEAP32[attribList>>2];if(param==12321){var alphaSize=HEAP32[attribList+4>>2];EGL.contextAttributes.alpha=alphaSize>0}else if(param==12325){var depthSize=HEAP32[attribList+4>>2];EGL.contextAttributes.depth=depthSize>0}else if(param==12326){var stencilSize=HEAP32[attribList+4>>2];EGL.contextAttributes.stencil=stencilSize>0}else if(param==12337){var samples=HEAP32[attribList+4>>2];EGL.contextAttributes.antialias=samples>0}else if(param==12338){var samples=HEAP32[attribList+4>>2];EGL.contextAttributes.antialias=samples==1}else if(param==12544){var requestedPriority=HEAP32[attribList+4>>2];EGL.contextAttributes.lowLatency=requestedPriority!=12547}else if(param==12344){break}attribList+=8}}if((!config||!config_size)&&!numConfigs){EGL.setErrorCode(12300);return 0}if(numConfigs){HEAP32[numConfigs>>2]=1}if(config&&config_size>0){HEAP32[config>>2]=62002}EGL.setErrorCode(12288);return 1}};Module["EGL"]=EGL;function _eglGetDisplay(nativeDisplayType){EGL.setErrorCode(12288);return 62e3}Module["_eglGetDisplay"]=_eglGetDisplay;_eglGetDisplay.sig="ii";function _eglInitialize(display,majorVersion,minorVersion){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(majorVersion){HEAP32[majorVersion>>2]=1}if(minorVersion){HEAP32[minorVersion>>2]=4}EGL.defaultDisplayInitialized=true;EGL.setErrorCode(12288);return 1}Module["_eglInitialize"]=_eglInitialize;_eglInitialize.sig="iiii";function _eglTerminate(display){if(display!=62e3){EGL.setErrorCode(12296);return 0}EGL.currentContext=0;EGL.currentReadSurface=0;EGL.currentDrawSurface=0;EGL.defaultDisplayInitialized=false;EGL.setErrorCode(12288);return 1}Module["_eglTerminate"]=_eglTerminate;_eglTerminate.sig="ii";function _eglGetConfigs(display,configs,config_size,numConfigs){return EGL.chooseConfig(display,0,configs,config_size,numConfigs)}Module["_eglGetConfigs"]=_eglGetConfigs;_eglGetConfigs.sig="iiiii";function _eglChooseConfig(display,attrib_list,configs,config_size,numConfigs){return EGL.chooseConfig(display,attrib_list,configs,config_size,numConfigs)}Module["_eglChooseConfig"]=_eglChooseConfig;_eglChooseConfig.sig="iiiiii";function _eglGetConfigAttrib(display,config,attribute,value){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(config!=62002){EGL.setErrorCode(12293);return 0}if(!value){EGL.setErrorCode(12300);return 0}EGL.setErrorCode(12288);switch(attribute){case 12320:HEAP32[value>>2]=EGL.contextAttributes.alpha?32:24;return 1;case 12321:HEAP32[value>>2]=EGL.contextAttributes.alpha?8:0;return 1;case 12322:HEAP32[value>>2]=8;return 1;case 12323:HEAP32[value>>2]=8;return 1;case 12324:HEAP32[value>>2]=8;return 1;case 12325:HEAP32[value>>2]=EGL.contextAttributes.depth?24:0;return 1;case 12326:HEAP32[value>>2]=EGL.contextAttributes.stencil?8:0;return 1;case 12327:HEAP32[value>>2]=12344;return 1;case 12328:HEAP32[value>>2]=62002;return 1;case 12329:HEAP32[value>>2]=0;return 1;case 12330:HEAP32[value>>2]=4096;return 1;case 12331:HEAP32[value>>2]=16777216;return 1;case 12332:HEAP32[value>>2]=4096;return 1;case 12333:HEAP32[value>>2]=0;return 1;case 12334:HEAP32[value>>2]=0;return 1;case 12335:HEAP32[value>>2]=12344;return 1;case 12337:HEAP32[value>>2]=EGL.contextAttributes.antialias?4:0;return 1;case 12338:HEAP32[value>>2]=EGL.contextAttributes.antialias?1:0;return 1;case 12339:HEAP32[value>>2]=4;return 1;case 12340:HEAP32[value>>2]=12344;return 1;case 12341:case 12342:case 12343:HEAP32[value>>2]=-1;return 1;case 12345:case 12346:HEAP32[value>>2]=0;return 1;case 12347:HEAP32[value>>2]=0;return 1;case 12348:HEAP32[value>>2]=1;return 1;case 12349:case 12350:HEAP32[value>>2]=0;return 1;case 12351:HEAP32[value>>2]=12430;return 1;case 12352:HEAP32[value>>2]=4;return 1;case 12354:HEAP32[value>>2]=0;return 1;default:EGL.setErrorCode(12292);return 0}}Module["_eglGetConfigAttrib"]=_eglGetConfigAttrib;_eglGetConfigAttrib.sig="iiiii";function _eglCreateWindowSurface(display,config,win,attrib_list){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(config!=62002){EGL.setErrorCode(12293);return 0}EGL.setErrorCode(12288);return 62006}Module["_eglCreateWindowSurface"]=_eglCreateWindowSurface;_eglCreateWindowSurface.sig="iiiii";function _eglDestroySurface(display,surface){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(surface!=62006){EGL.setErrorCode(12301);return 1}if(EGL.currentReadSurface==surface){EGL.currentReadSurface=0}if(EGL.currentDrawSurface==surface){EGL.currentDrawSurface=0}EGL.setErrorCode(12288);return 1}Module["_eglDestroySurface"]=_eglDestroySurface;_eglDestroySurface.sig="iii";function _eglCreateContext(display,config,hmm,contextAttribs){if(display!=62e3){EGL.setErrorCode(12296);return 0}var glesContextVersion=1;for(;;){var param=HEAP32[contextAttribs>>2];if(param==12440){glesContextVersion=HEAP32[contextAttribs+4>>2]}else if(param==12344){break}else{EGL.setErrorCode(12292);return 0}contextAttribs+=8}if(glesContextVersion!=2){EGL.setErrorCode(12293);return 0}EGL.contextAttributes.majorVersion=glesContextVersion-1;EGL.contextAttributes.minorVersion=0;EGL.context=GL.createContext(Module["canvas"],EGL.contextAttributes);if(EGL.context!=0){EGL.setErrorCode(12288);GL.makeContextCurrent(EGL.context);Module.useWebGL=true;Browser.moduleContextCreatedCallbacks.forEach(function(callback){callback()});GL.makeContextCurrent(null);return 62004}else{EGL.setErrorCode(12297);return 0}}Module["_eglCreateContext"]=_eglCreateContext;_eglCreateContext.sig="iiiii";function _eglDestroyContext(display,context){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(context!=62004){EGL.setErrorCode(12294);return 0}GL.deleteContext(EGL.context);EGL.setErrorCode(12288);if(EGL.currentContext==context){EGL.currentContext=0}return 1}Module["_eglDestroyContext"]=_eglDestroyContext;_eglDestroyContext.sig="iii";function _eglQuerySurface(display,surface,attribute,value){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(surface!=62006){EGL.setErrorCode(12301);return 0}if(!value){EGL.setErrorCode(12300);return 0}EGL.setErrorCode(12288);switch(attribute){case 12328:HEAP32[value>>2]=62002;return 1;case 12376:return 1;case 12375:HEAP32[value>>2]=Module["canvas"].width;return 1;case 12374:HEAP32[value>>2]=Module["canvas"].height;return 1;case 12432:HEAP32[value>>2]=-1;return 1;case 12433:HEAP32[value>>2]=-1;return 1;case 12434:HEAP32[value>>2]=-1;return 1;case 12422:HEAP32[value>>2]=12420;return 1;case 12441:HEAP32[value>>2]=12442;return 1;case 12435:HEAP32[value>>2]=12437;return 1;case 12416:case 12417:case 12418:case 12419:return 1;default:EGL.setErrorCode(12292);return 0}}Module["_eglQuerySurface"]=_eglQuerySurface;_eglQuerySurface.sig="iiiii";function _eglQueryContext(display,context,attribute,value){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(context!=62004){EGL.setErrorCode(12294);return 0}if(!value){EGL.setErrorCode(12300);return 0}EGL.setErrorCode(12288);switch(attribute){case 12328:HEAP32[value>>2]=62002;return 1;case 12439:HEAP32[value>>2]=12448;return 1;case 12440:HEAP32[value>>2]=EGL.contextAttributes.majorVersion+1;return 1;case 12422:HEAP32[value>>2]=12420;return 1;default:EGL.setErrorCode(12292);return 0}}Module["_eglQueryContext"]=_eglQueryContext;_eglQueryContext.sig="iiiii";function _eglGetError(){return EGL.errorCode}Module["_eglGetError"]=_eglGetError;_eglGetError.sig="i";function _eglQueryString(display,name){if(display!=62e3){EGL.setErrorCode(12296);return 0}EGL.setErrorCode(12288);if(EGL.stringCache[name])return EGL.stringCache[name];var ret;switch(name){case 12371:ret=allocateUTF8("Emscripten");break;case 12372:ret=allocateUTF8("1.4 Emscripten EGL");break;case 12373:ret=allocateUTF8("");break;case 12429:ret=allocateUTF8("OpenGL_ES");break;default:EGL.setErrorCode(12300);return 0}EGL.stringCache[name]=ret;return ret}Module["_eglQueryString"]=_eglQueryString;_eglQueryString.sig="iii";function _eglBindAPI(api){if(api==12448){EGL.setErrorCode(12288);return 1}EGL.setErrorCode(12300);return 0}Module["_eglBindAPI"]=_eglBindAPI;_eglBindAPI.sig="ii";function _eglQueryAPI(){EGL.setErrorCode(12288);return 12448}Module["_eglQueryAPI"]=_eglQueryAPI;_eglQueryAPI.sig="i";function _eglWaitClient(){EGL.setErrorCode(12288);return 1}Module["_eglWaitClient"]=_eglWaitClient;_eglWaitClient.sig="i";function _eglWaitNative(nativeEngineId){EGL.setErrorCode(12288);return 1}Module["_eglWaitNative"]=_eglWaitNative;_eglWaitNative.sig="ii";var _eglWaitGL=_eglWaitClient;Module["_eglWaitGL"]=_eglWaitGL;function _eglSwapInterval(display,interval){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(interval==0)_emscripten_set_main_loop_timing(0,0);else _emscripten_set_main_loop_timing(1,interval);EGL.setErrorCode(12288);return 1}Module["_eglSwapInterval"]=_eglSwapInterval;_eglSwapInterval.sig="iii";function _eglMakeCurrent(display,draw,read,context){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(context!=0&&context!=62004){EGL.setErrorCode(12294);return 0}if(read!=0&&read!=62006||draw!=0&&draw!=62006){EGL.setErrorCode(12301);return 0}GL.makeContextCurrent(context?EGL.context:null);EGL.currentContext=context;EGL.currentDrawSurface=draw;EGL.currentReadSurface=read;EGL.setErrorCode(12288);return 1}Module["_eglMakeCurrent"]=_eglMakeCurrent;_eglMakeCurrent.sig="iiiii";function _eglGetCurrentContext(){return EGL.currentContext}Module["_eglGetCurrentContext"]=_eglGetCurrentContext;_eglGetCurrentContext.sig="i";function _eglGetCurrentSurface(readdraw){if(readdraw==12378){return EGL.currentReadSurface}else if(readdraw==12377){return EGL.currentDrawSurface}else{EGL.setErrorCode(12300);return 0}}Module["_eglGetCurrentSurface"]=_eglGetCurrentSurface;_eglGetCurrentSurface.sig="ii";function _eglGetCurrentDisplay(){return EGL.currentContext?62e3:0}Module["_eglGetCurrentDisplay"]=_eglGetCurrentDisplay;_eglGetCurrentDisplay.sig="i";function _eglSwapBuffers(){if(!EGL.defaultDisplayInitialized){EGL.setErrorCode(12289)}else if(!Module.ctx){EGL.setErrorCode(12290)}else if(Module.ctx.isContextLost()){EGL.setErrorCode(12302)}else{EGL.setErrorCode(12288);return 1}return 0}Module["_eglSwapBuffers"]=_eglSwapBuffers;_eglSwapBuffers.sig="iii";function _eglReleaseThread(){EGL.currentContext=0;EGL.currentReadSurface=0;EGL.currentDrawSurface=0;EGL.setErrorCode(12288);return 1}Module["_eglReleaseThread"]=_eglReleaseThread;_eglReleaseThread.sig="i";var GLFW={WindowFromId:function(id){if(id<=0||!GLFW.windows)return null;return GLFW.windows[id-1]},joystickFunc:null,errorFunc:null,monitorFunc:null,active:null,windows:null,monitors:null,monitorString:null,versionString:null,initialTime:null,extensions:null,hints:null,defaultHints:{131073:0,131074:0,131075:1,131076:1,131077:1,135169:8,135170:8,135171:8,135172:8,135173:24,135174:8,135175:0,135176:0,135177:0,135178:0,135179:0,135180:0,135181:0,135182:0,135183:0,139265:196609,139266:1,139267:0,139268:0,139269:0,139270:0,139271:0,139272:0},DOMToGLFWKeyCode:function(keycode){switch(keycode){case 32:return 32;case 222:return 39;case 188:return 44;case 173:return 45;case 189:return 45;case 190:return 46;case 191:return 47;case 48:return 48;case 49:return 49;case 50:return 50;case 51:return 51;case 52:return 52;case 53:return 53;case 54:return 54;case 55:return 55;case 56:return 56;case 57:return 57;case 59:return 59;case 61:return 61;case 187:return 61;case 65:return 65;case 66:return 66;case 67:return 67;case 68:return 68;case 69:return 69;case 70:return 70;case 71:return 71;case 72:return 72;case 73:return 73;case 74:return 74;case 75:return 75;case 76:return 76;case 77:return 77;case 78:return 78;case 79:return 79;case 80:return 80;case 81:return 81;case 82:return 82;case 83:return 83;case 84:return 84;case 85:return 85;case 86:return 86;case 87:return 87;case 88:return 88;case 89:return 89;case 90:return 90;case 219:return 91;case 220:return 92;case 221:return 93;case 192:return 96;case 27:return 256+1;case 112:return 256+2;case 113:return 256+3;case 114:return 256+4;case 115:return 256+5;case 116:return 256+6;case 117:return 256+7;case 118:return 256+8;case 119:return 256+9;case 120:return 256+10;case 121:return 256+11;case 122:return 256+12;case 123:return 256+13;case 124:return 256+14;case 125:return 256+15;case 126:return 256+16;case 127:return 256+17;case 128:return 256+18;case 129:return 256+19;case 130:return 256+20;case 131:return 256+21;case 132:return 256+22;case 133:return 256+23;case 134:return 256+24;case 135:return 256+25;case 136:return 256+26;case 39:return 256+30;case 37:return 256+29;case 40:return 256+28;case 38:return 256+27;case 16:return 256+31;case 17:return 256+33;case 18:return 256+35;case 9:return 256+37;case 13:return 256+38;case 8:return 256+39;case 45:return 256+40;case 46:return 256+41;case 33:return 256+42;case 34:return 256+43;case 36:return 256+44;case 35:return 256+45;case 96:return 256+46;case 97:return 256+47;case 98:return 256+48;case 99:return 256+49;case 100:return 256+50;case 101:return 256+51;case 102:return 256+52;case 103:return 256+53;case 104:return 256+54;case 105:return 256+55;case 111:return 256+56;case 106:return 256+57;case 109:return 256+58;case 107:return 256+59;case 110:return 256+60;case 144:return 256+63;case 20:return 256+64;case 145:return 256+65;case 19:return 256+66;case 91:return 256+67;case 93:return 256+69;default:return-1}},getModBits:function(win){var mod=0;if(win.keys[340])mod|=1;if(win.keys[341])mod|=2;if(win.keys[342])mod|=4;if(win.keys[343])mod|=8;return mod},onKeyPress:function(event){if(!GLFW.active||!GLFW.active.charFunc)return;if(event.ctrlKey||event.metaKey)return;var charCode=event.charCode;if(charCode==0||charCode>=0&&charCode<=31)return;getWasmTableEntry(GLFW.active.charFunc)(charCode,1)},onKeyChanged:function(keyCode,status){if(!GLFW.active)return;var key=GLFW.DOMToGLFWKeyCode(keyCode);if(key==-1)return;GLFW.active.keys[key]=status;GLFW.active.domKeys[keyCode]=status;if(!GLFW.active.keyFunc)return;getWasmTableEntry(GLFW.active.keyFunc)(key,status)},onGamepadConnected:function(event){GLFW.refreshJoysticks()},onGamepadDisconnected:function(event){GLFW.refreshJoysticks()},onKeydown:function(event){GLFW.onKeyChanged(event.keyCode,1);if(event.keyCode===8||event.keyCode===9){event.preventDefault()}},onKeyup:function(event){GLFW.onKeyChanged(event.keyCode,0)},onBlur:function(event){if(!GLFW.active)return;for(var i=0;i0){if(eventButton==1){eventButton=2}else{eventButton=1}}return eventButton},onMouseenter:function(event){if(!GLFW.active)return;if(event.target!=Module["canvas"]||!GLFW.active.cursorEnterFunc)return},onMouseleave:function(event){if(!GLFW.active)return;if(event.target!=Module["canvas"]||!GLFW.active.cursorEnterFunc)return},onMouseButtonChanged:function(event,status){if(!GLFW.active)return;Browser.calculateMouseEvent(event);if(event.target!=Module["canvas"])return;var eventButton=GLFW.DOMToGLFWMouseButton(event);if(status==1){GLFW.active.buttons|=1<0?Math.max(delta,1):Math.min(delta,-1);GLFW.wheelPos+=delta;if(!GLFW.active||!GLFW.active.scrollFunc||event.target!=Module["canvas"])return;getWasmTableEntry(GLFW.active.scrollFunc)(GLFW.wheelPos);event.preventDefault()},onCanvasResize:function(width,height){if(!GLFW.active)return;var resizeNeeded=true;if(document["fullscreen"]||document["fullScreen"]||document["mozFullScreen"]||document["webkitIsFullScreen"]){GLFW.active.storedX=GLFW.active.x;GLFW.active.storedY=GLFW.active.y;GLFW.active.storedWidth=GLFW.active.width;GLFW.active.storedHeight=GLFW.active.height;GLFW.active.x=GLFW.active.y=0;GLFW.active.width=screen.width;GLFW.active.height=screen.height;GLFW.active.fullscreen=true}else if(GLFW.active.fullscreen==true){GLFW.active.x=GLFW.active.storedX;GLFW.active.y=GLFW.active.storedY;GLFW.active.width=GLFW.active.storedWidth;GLFW.active.height=GLFW.active.storedHeight;GLFW.active.fullscreen=false}else if(GLFW.active.width!=width||GLFW.active.height!=height){GLFW.active.width=width;GLFW.active.height=height}else{resizeNeeded=false}if(resizeNeeded){Browser.setCanvasSize(GLFW.active.width,GLFW.active.height,true);GLFW.onWindowSizeChanged();GLFW.onFramebufferSizeChanged()}},onWindowSizeChanged:function(){if(!GLFW.active)return;if(!GLFW.active.windowSizeFunc)return;getWasmTableEntry(GLFW.active.windowSizeFunc)(GLFW.active.width,GLFW.active.height)},onFramebufferSizeChanged:function(){if(!GLFW.active)return;if(!GLFW.active.framebufferSizeFunc)return},getTime:function(){return _emscripten_get_now()/1e3},setWindowTitle:function(winid,title){var win=GLFW.WindowFromId(winid);if(!win)return;win.title=UTF8ToString(title);if(GLFW.active.id==win.id){document.title=win.title}},setJoystickCallback:function(cbfun){GLFW.joystickFunc=cbfun;GLFW.refreshJoysticks()},joys:{},lastGamepadState:[],lastGamepadStateFrame:null,refreshJoysticks:function(){if(Browser.mainLoop.currentFrameNumber!==GLFW.lastGamepadStateFrame||!Browser.mainLoop.currentFrameNumber){GLFW.lastGamepadState=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads:[];GLFW.lastGamepadStateFrame=Browser.mainLoop.currentFrameNumber;for(var joy=0;joy>0]=gamepad.buttons[i].pressed}for(var i=0;i>2]=gamepad.axes[i]}}else{if(GLFW.joys[joy]){out("glfw joystick disconnected",joy);if(GLFW.joystickFunc){getWasmTableEntry(GLFW.joystickFunc)(joy,262146)}_free(GLFW.joys[joy].id);_free(GLFW.joys[joy].buttons);_free(GLFW.joys[joy].axes);delete GLFW.joys[joy]}}}}},setKeyCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.keyFunc;win.keyFunc=cbfun;return prevcbfun},setCharCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.charFunc;win.charFunc=cbfun;return prevcbfun},setMouseButtonCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.mouseButtonFunc;win.mouseButtonFunc=cbfun;return prevcbfun},setCursorPosCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.cursorPosFunc;win.cursorPosFunc=cbfun;return prevcbfun},setScrollCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.scrollFunc;win.scrollFunc=cbfun;return prevcbfun},setDropCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.dropFunc;win.dropFunc=cbfun;return prevcbfun},onDrop:function(event){if(!GLFW.active||!GLFW.active.dropFunc)return;if(!event.dataTransfer||!event.dataTransfer.files||event.dataTransfer.files.length==0)return;event.preventDefault();var filenames=_malloc(event.dataTransfer.files.length*4);var filenamesArray=[];var count=event.dataTransfer.files.length;var written=0;var drop_dir=".glfw_dropped_files";FS.createPath("/",drop_dir);function save(file){var path="/"+drop_dir+"/"+file.name.replace(/\//g,"_");var reader=new FileReader;reader.onloadend=e=>{if(reader.readyState!=2){++written;out("failed to read dropped file: "+file.name+": "+reader.error);return}var data=e.target.result;FS.writeFile(path,new Uint8Array(data));if(++written===count){getWasmTableEntry(GLFW.active.dropFunc)(GLFW.active.id,count,filenames);for(var i=0;i>2]=filename}for(var i=0;i0},getCursorPos:function(winid,x,y){HEAPF64[x>>3]=Browser.mouseX;HEAPF64[y>>3]=Browser.mouseY},getMousePos:function(winid,x,y){HEAP32[x>>2]=Browser.mouseX;HEAP32[y>>2]=Browser.mouseY},setCursorPos:function(winid,x,y){},getWindowPos:function(winid,x,y){var wx=0;var wy=0;var win=GLFW.WindowFromId(winid);if(win){wx=win.x;wy=win.y}if(x){HEAP32[x>>2]=wx}if(y){HEAP32[y>>2]=wy}},setWindowPos:function(winid,x,y){var win=GLFW.WindowFromId(winid);if(!win)return;win.x=x;win.y=y},getWindowSize:function(winid,width,height){var ww=0;var wh=0;var win=GLFW.WindowFromId(winid);if(win){ww=win.width;wh=win.height}if(width){HEAP32[width>>2]=ww}if(height){HEAP32[height>>2]=wh}},setWindowSize:function(winid,width,height){var win=GLFW.WindowFromId(winid);if(!win)return;if(GLFW.active.id==win.id){if(width==screen.width&&height==screen.height){Browser.requestFullscreen()}else{Browser.exitFullscreen();Browser.setCanvasSize(width,height);win.width=width;win.height=height}}if(!win.windowSizeFunc)return;getWasmTableEntry(win.windowSizeFunc)(width,height)},createWindow:function(width,height,title,monitor,share){var i,id;for(i=0;i0)throw"glfwCreateWindow only supports one window at time currently";id=i+1;if(width<=0||height<=0)return 0;if(monitor){Browser.requestFullscreen()}else{Browser.setCanvasSize(width,height)}for(i=0;i0;if(i==GLFW.windows.length){if(useWebGL){var contextAttributes={antialias:GLFW.hints[135181]>1,depth:GLFW.hints[135173]>0,stencil:GLFW.hints[135174]>0,alpha:GLFW.hints[135172]>0};Module.ctx=Browser.createContext(Module["canvas"],true,true,contextAttributes)}else{Browser.init()}}if(!Module.ctx&&useWebGL)return 0;var win=new GLFW_Window(id,width,height,title,monitor,share);if(id-1==GLFW.windows.length){GLFW.windows.push(win)}else{GLFW.windows[id-1]=win}GLFW.active=win;return win.id},destroyWindow:function(winid){var win=GLFW.WindowFromId(winid);if(!win)return;GLFW.windows[win.id-1]=null;if(GLFW.active.id==win.id)GLFW.active=null;for(var i=0;i{GLFW.onCanvasResize(width,height)});return 1}Module["_glfwInit"]=_glfwInit;_glfwInit.sig="i";function _glfwTerminate(){window.removeEventListener("gamepadconnected",GLFW.onGamepadConnected,true);window.removeEventListener("gamepaddisconnected",GLFW.onGamepadDisconnected,true);window.removeEventListener("keydown",GLFW.onKeydown,true);window.removeEventListener("keypress",GLFW.onKeyPress,true);window.removeEventListener("keyup",GLFW.onKeyup,true);window.removeEventListener("blur",GLFW.onBlur,true);Module["canvas"].removeEventListener("touchmove",GLFW.onMousemove,true);Module["canvas"].removeEventListener("touchstart",GLFW.onMouseButtonDown,true);Module["canvas"].removeEventListener("touchcancel",GLFW.onMouseButtonUp,true);Module["canvas"].removeEventListener("touchend",GLFW.onMouseButtonUp,true);Module["canvas"].removeEventListener("mousemove",GLFW.onMousemove,true);Module["canvas"].removeEventListener("mousedown",GLFW.onMouseButtonDown,true);Module["canvas"].removeEventListener("mouseup",GLFW.onMouseButtonUp,true);Module["canvas"].removeEventListener("wheel",GLFW.onMouseWheel,true);Module["canvas"].removeEventListener("mousewheel",GLFW.onMouseWheel,true);Module["canvas"].removeEventListener("mouseenter",GLFW.onMouseenter,true);Module["canvas"].removeEventListener("mouseleave",GLFW.onMouseleave,true);Module["canvas"].removeEventListener("drop",GLFW.onDrop,true);Module["canvas"].removeEventListener("dragover",GLFW.onDragover,true);Module["canvas"].width=Module["canvas"].height=1;GLFW.windows=null;GLFW.active=null}Module["_glfwTerminate"]=_glfwTerminate;_glfwTerminate.sig="v";function _glfwGetVersion(major,minor,rev){HEAP32[major>>2]=2;HEAP32[minor>>2]=7;HEAP32[rev>>2]=7}Module["_glfwGetVersion"]=_glfwGetVersion;_glfwGetVersion.sig="viii";function _glfwPollEvents(){}Module["_glfwPollEvents"]=_glfwPollEvents;_glfwPollEvents.sig="v";function _glfwWaitEvents(){}Module["_glfwWaitEvents"]=_glfwWaitEvents;_glfwWaitEvents.sig="v";function _glfwGetTime(){return GLFW.getTime()-GLFW.initialTime}Module["_glfwGetTime"]=_glfwGetTime;_glfwGetTime.sig="d";function _glfwSetTime(time){GLFW.initialTime=GLFW.getTime()-time}Module["_glfwSetTime"]=_glfwSetTime;_glfwSetTime.sig="vd";function _glfwExtensionSupported(extension){if(!GLFW.extensions){GLFW.extensions=UTF8ToString(_glGetString(7939)).split(" ")}if(GLFW.extensions.includes(extension))return 1;return GLFW.extensions.includes("GL_"+extension)}Module["_glfwExtensionSupported"]=_glfwExtensionSupported;_glfwExtensionSupported.sig="ii";function _glfwSwapInterval(interval){interval=Math.abs(interval);if(interval==0)_emscripten_set_main_loop_timing(0,0);else _emscripten_set_main_loop_timing(1,interval)}Module["_glfwSwapInterval"]=_glfwSwapInterval;_glfwSwapInterval.sig="vi";function _glfwOpenWindow(width,height,redbits,greenbits,bluebits,alphabits,depthbits,stencilbits,mode){GLFW.hints[135169]=redbits;GLFW.hints[135170]=greenbits;GLFW.hints[135171]=bluebits;GLFW.hints[135172]=alphabits;GLFW.hints[135173]=depthbits;GLFW.hints[135174]=stencilbits;GLFW.createWindow(width,height,"GLFW2 Window",0,0);return 1}Module["_glfwOpenWindow"]=_glfwOpenWindow;function _glfwCloseWindow(){GLFW.destroyWindow(GLFW.active.id)}Module["_glfwCloseWindow"]=_glfwCloseWindow;function _glfwOpenWindowHint(target,hint){target=GLFW.GLFW2ParamToGLFW3Param(target);GLFW.hints[target]=hint}Module["_glfwOpenWindowHint"]=_glfwOpenWindowHint;function _glfwGetWindowSize(width,height){GLFW.getWindowSize(GLFW.active.id,width,height)}Module["_glfwGetWindowSize"]=_glfwGetWindowSize;function _glfwSetWindowSize(width,height){GLFW.setWindowSize(GLFW.active.id,width,height)}Module["_glfwSetWindowSize"]=_glfwSetWindowSize;function _glfwGetWindowPos(x,y){GLFW.getWindowPos(GLFW.active.id,x,y)}Module["_glfwGetWindowPos"]=_glfwGetWindowPos;function _glfwSetWindowPos(x,y){GLFW.setWindowPos(GLFW.active.id,x,y)}Module["_glfwSetWindowPos"]=_glfwSetWindowPos;function _glfwSetWindowTitle(title){GLFW.setWindowTitle(GLFW.active.id,title)}Module["_glfwSetWindowTitle"]=_glfwSetWindowTitle;function _glfwIconifyWindow(){}Module["_glfwIconifyWindow"]=_glfwIconifyWindow;function _glfwRestoreWindow(){}Module["_glfwRestoreWindow"]=_glfwRestoreWindow;function _glfwSwapBuffers(){GLFW.swapBuffers(GLFW.active.id)}Module["_glfwSwapBuffers"]=_glfwSwapBuffers;function _glfwGetWindowParam(param){param=GLFW.GLFW2ParamToGLFW3Param(param);return GLFW.hints[param]}Module["_glfwGetWindowParam"]=_glfwGetWindowParam;function _glfwSetWindowSizeCallback(cbfun){GLFW.setWindowSizeCallback(GLFW.active.id,cbfun)}Module["_glfwSetWindowSizeCallback"]=_glfwSetWindowSizeCallback;function _glfwSetWindowCloseCallback(cbfun){GLFW.setWindowCloseCallback(GLFW.active.id,cbfun)}Module["_glfwSetWindowCloseCallback"]=_glfwSetWindowCloseCallback;function _glfwSetWindowRefreshCallback(cbfun){GLFW.setWindowRefreshCallback(GLFW.active.id,cbfun)}Module["_glfwSetWindowRefreshCallback"]=_glfwSetWindowRefreshCallback;function _glfwGetKey(key){return GLFW.getKey(GLFW.active.id,key)}Module["_glfwGetKey"]=_glfwGetKey;function _glfwGetMouseButton(button){return GLFW.getMouseButton(GLFW.active.id,button)}Module["_glfwGetMouseButton"]=_glfwGetMouseButton;function _glfwGetMousePos(x,y){GLFW.getMousePos(GLFW.active.id,x,y)}Module["_glfwGetMousePos"]=_glfwGetMousePos;function _glfwSetMousePos(x,y){GLFW.setCursorPos(GLFW.active.id,x,y)}Module["_glfwSetMousePos"]=_glfwSetMousePos;function _glfwGetMouseWheel(){return 0}Module["_glfwGetMouseWheel"]=_glfwGetMouseWheel;function _glfwSetMouseWheel(pos){}Module["_glfwSetMouseWheel"]=_glfwSetMouseWheel;function _glfwSetKeyCallback(cbfun){GLFW.setKeyCallback(GLFW.active.id,cbfun)}Module["_glfwSetKeyCallback"]=_glfwSetKeyCallback;function _glfwSetCharCallback(cbfun){GLFW.setCharCallback(GLFW.active.id,cbfun)}Module["_glfwSetCharCallback"]=_glfwSetCharCallback;function _glfwSetMouseButtonCallback(cbfun){GLFW.setMouseButtonCallback(GLFW.active.id,cbfun)}Module["_glfwSetMouseButtonCallback"]=_glfwSetMouseButtonCallback;function _glfwSetMousePosCallback(cbfun){GLFW.setCursorPosCallback(GLFW.active.id,cbfun)}Module["_glfwSetMousePosCallback"]=_glfwSetMousePosCallback;function _glfwSetMouseWheelCallback(cbfun){GLFW.setScrollCallback(GLFW.active.id,cbfun)}Module["_glfwSetMouseWheelCallback"]=_glfwSetMouseWheelCallback;function _glfwGetDesktopMode(mode){throw"glfwGetDesktopMode is not implemented."}Module["_glfwGetDesktopMode"]=_glfwGetDesktopMode;function _glfwSleep(time){_sleep(time)}Module["_glfwSleep"]=_glfwSleep;function _glfwEnable(target){target=GLFW.GLFW2ParamToGLFW3Param(target);GLFW.hints[target]=false}Module["_glfwEnable"]=_glfwEnable;function _glfwDisable(target){target=GLFW.GLFW2ParamToGLFW3Param(target);GLFW.hints[target]=true}Module["_glfwDisable"]=_glfwDisable;function _glfwGetGLVersion(major,minor,rev){HEAP32[major>>2]=0;HEAP32[minor>>2]=0;HEAP32[rev>>2]=1}Module["_glfwGetGLVersion"]=_glfwGetGLVersion;function _glfwCreateThread(fun,arg){getWasmTableEntry(fun)(arg);return 0}Module["_glfwCreateThread"]=_glfwCreateThread;function _glfwDestroyThread(ID){}Module["_glfwDestroyThread"]=_glfwDestroyThread;function _glfwWaitThread(ID,waitmode){}Module["_glfwWaitThread"]=_glfwWaitThread;function _glfwGetThreadID(){return 0}Module["_glfwGetThreadID"]=_glfwGetThreadID;function _glfwCreateMutex(){throw"glfwCreateMutex is not implemented."}Module["_glfwCreateMutex"]=_glfwCreateMutex;function _glfwDestroyMutex(mutex){throw"glfwDestroyMutex is not implemented."}Module["_glfwDestroyMutex"]=_glfwDestroyMutex;function _glfwLockMutex(mutex){throw"glfwLockMutex is not implemented."}Module["_glfwLockMutex"]=_glfwLockMutex;function _glfwUnlockMutex(mutex){throw"glfwUnlockMutex is not implemented."}Module["_glfwUnlockMutex"]=_glfwUnlockMutex;function _glfwCreateCond(){throw"glfwCreateCond is not implemented."}Module["_glfwCreateCond"]=_glfwCreateCond;function _glfwDestroyCond(cond){throw"glfwDestroyCond is not implemented."}Module["_glfwDestroyCond"]=_glfwDestroyCond;function _glfwWaitCond(cond,mutex,timeout){throw"glfwWaitCond is not implemented."}Module["_glfwWaitCond"]=_glfwWaitCond;function _glfwSignalCond(cond){throw"glfwSignalCond is not implemented."}Module["_glfwSignalCond"]=_glfwSignalCond;function _glfwBroadcastCond(cond){throw"glfwBroadcastCond is not implemented."}Module["_glfwBroadcastCond"]=_glfwBroadcastCond;function _glfwGetNumberOfProcessors(){return 1}Module["_glfwGetNumberOfProcessors"]=_glfwGetNumberOfProcessors;function _glfwReadImage(name,img,flags){throw"glfwReadImage is not implemented."}Module["_glfwReadImage"]=_glfwReadImage;function _glfwReadMemoryImage(data,size,img,flags){throw"glfwReadMemoryImage is not implemented."}Module["_glfwReadMemoryImage"]=_glfwReadMemoryImage;function _glfwFreeImage(img){throw"glfwFreeImage is not implemented."}Module["_glfwFreeImage"]=_glfwFreeImage;function _glfwLoadTexture2D(name,flags){throw"glfwLoadTexture2D is not implemented."}Module["_glfwLoadTexture2D"]=_glfwLoadTexture2D;function _glfwLoadMemoryTexture2D(data,size,flags){throw"glfwLoadMemoryTexture2D is not implemented."}Module["_glfwLoadMemoryTexture2D"]=_glfwLoadMemoryTexture2D;function _glfwLoadTextureImage2D(img,flags){throw"glfwLoadTextureImage2D is not implemented."}Module["_glfwLoadTextureImage2D"]=_glfwLoadTextureImage2D;function _uuid_clear(uu){zeroMemory(uu,16)}Module["_uuid_clear"]=_uuid_clear;function _uuid_compare(uu1,uu2){return _memcmp(uu1,uu2,16)}Module["_uuid_compare"]=_uuid_compare;function _uuid_copy(dst,src){_memcpy(dst,src,16)}Module["_uuid_copy"]=_uuid_copy;function _uuid_generate(out){var uuid=null;if(ENVIRONMENT_IS_NODE){try{var rb=require("crypto")["randomBytes"];uuid=rb(16)}catch(e){}}else if(ENVIRONMENT_IS_WEB&&typeof window.crypto!="undefined"&&typeof window.crypto.getRandomValues!="undefined"){uuid=new Uint8Array(16);window.crypto.getRandomValues(uuid)}if(!uuid){uuid=new Array(16);var d=(new Date).getTime();for(var i=0;i<16;i++){var r=(d+Math.random()*256)%256|0;d=d/256|0;uuid[i]=r}}uuid[6]=uuid[6]&15|64;uuid[8]=uuid[8]&63|128;writeArrayToMemory(uuid,out)}Module["_uuid_generate"]=_uuid_generate;function _uuid_is_null(uu){for(var i=0;i<4;i++,uu=uu+4|0){var val=HEAP32[uu>>2];if(val){return 0}}return 1}Module["_uuid_is_null"]=_uuid_is_null;function _uuid_parse(inp,uu){inp=UTF8ToString(inp);if(inp.length===36){var i=0;var uuid=new Array(16);inp.toLowerCase().replace(/[0-9a-f]{2}/g,function(byte){if(i<16){uuid[i++]=parseInt(byte,16)}});if(i<16){return-1}writeArrayToMemory(uuid,uu);return 0}return-1}Module["_uuid_parse"]=_uuid_parse;function _uuid_unparse(uu,out,upper){var i=0;var uuid="xxxx-xx-xx-xx-xxxxxx".replace(/[x]/g,function(c){var r=upper?HEAPU8[uu+i>>0].toString(16).toUpperCase():HEAPU8[uu+i>>0].toString(16);r=r.length===1?"0"+r:r;i++;return r});stringToUTF8(uuid,out,37)}Module["_uuid_unparse"]=_uuid_unparse;function _uuid_unparse_lower(uu,out){_uuid_unparse(uu,out)}Module["_uuid_unparse_lower"]=_uuid_unparse_lower;function _uuid_unparse_upper(uu,out){_uuid_unparse(uu,out,true)}Module["_uuid_unparse_upper"]=_uuid_unparse_upper;function _uuid_type(uu){return 4}Module["_uuid_type"]=_uuid_type;function _uuid_variant(uu){return 1}Module["_uuid_variant"]=_uuid_variant;var GLEW={isLinaroFork:1,extensions:null,error:{0:null,1:null,2:null,3:null,4:null,5:null,6:null,7:null,8:null},version:{1:null,2:null,3:null,4:null},errorStringConstantFromCode:function(error){if(GLEW.isLinaroFork){switch(error){case 4:return"OpenGL ES lib expected, found OpenGL lib";case 5:return"OpenGL lib expected, found OpenGL ES lib";case 6:return"Missing EGL version";case 7:return"EGL 1.1 and up are supported";default:break}}switch(error){case 0:return"No error";case 1:return"Missing GL version";case 2:return"GL 1.1 and up are supported";case 3:return"GLX 1.2 and up are supported";default:return null}},errorString:function(error){if(!GLEW.error[error]){var string=GLEW.errorStringConstantFromCode(error);if(!string){string="Unknown error";error=8}GLEW.error[error]=allocateUTF8(string)}return GLEW.error[error]},versionStringConstantFromCode:function(name){switch(name){case 1:return"1.10.0";case 2:return"1";case 3:return"10";case 4:return"0";default:return null}},versionString:function(name){if(!GLEW.version[name]){var string=GLEW.versionStringConstantFromCode(name);if(!string)return 0;GLEW.version[name]=allocateUTF8(string)}return GLEW.version[name]},extensionIsSupported:function(name){if(!GLEW.extensions){GLEW.extensions=UTF8ToString(_glGetString(7939)).split(" ")}if(GLEW.extensions.includes(name))return 1;return GLEW.extensions.includes("GL_"+name)}};Module["GLEW"]=GLEW;function _glewInit(){return 0}Module["_glewInit"]=_glewInit;function _glewIsSupported(name){var exts=UTF8ToString(name).split(" ");for(var i=0;i0)};req.onerror=function(error){callback(error)}})}};Module["IDBStore"]=IDBStore;function _emscripten_idb_async_load(db,id,arg,onload,onerror){IDBStore.getFile(UTF8ToString(db),UTF8ToString(id),function(error,byteArray){if(error){if(onerror)getWasmTableEntry(onerror)(arg);return}var buffer=_malloc(byteArray.length);HEAPU8.set(byteArray,buffer);getWasmTableEntry(onload)(arg,buffer,byteArray.length);_free(buffer)})}Module["_emscripten_idb_async_load"]=_emscripten_idb_async_load;_emscripten_idb_async_load.sig="vppppp";function _emscripten_idb_async_store(db,id,ptr,num,arg,onstore,onerror){IDBStore.setFile(UTF8ToString(db),UTF8ToString(id),new Uint8Array(HEAPU8.subarray(ptr,ptr+num)),function(error){if(error){if(onerror)getWasmTableEntry(onerror)(arg);return}if(onstore)getWasmTableEntry(onstore)(arg)})}Module["_emscripten_idb_async_store"]=_emscripten_idb_async_store;_emscripten_idb_async_store.sig="vpppippp";function _emscripten_idb_async_delete(db,id,arg,ondelete,onerror){IDBStore.deleteFile(UTF8ToString(db),UTF8ToString(id),function(error){if(error){if(onerror)getWasmTableEntry(onerror)(arg);return}if(ondelete)getWasmTableEntry(ondelete)(arg)})}Module["_emscripten_idb_async_delete"]=_emscripten_idb_async_delete;_emscripten_idb_async_delete.sig="vppppp";function _emscripten_idb_async_exists(db,id,arg,oncheck,onerror){IDBStore.existsFile(UTF8ToString(db),UTF8ToString(id),function(error,exists){if(error){if(onerror)getWasmTableEntry(onerror)(arg);return}if(oncheck)getWasmTableEntry(oncheck)(arg,exists)})}Module["_emscripten_idb_async_exists"]=_emscripten_idb_async_exists;_emscripten_idb_async_exists.sig="vppppp";function _emscripten_idb_load(){throw"Please compile your program with async support in order to use synchronous operations like emscripten_idb_load, etc."}Module["_emscripten_idb_load"]=_emscripten_idb_load;function _emscripten_idb_store(){throw"Please compile your program with async support in order to use synchronous operations like emscripten_idb_store, etc."}Module["_emscripten_idb_store"]=_emscripten_idb_store;function _emscripten_idb_delete(){throw"Please compile your program with async support in order to use synchronous operations like emscripten_idb_delete, etc."}Module["_emscripten_idb_delete"]=_emscripten_idb_delete;function _emscripten_idb_exists(){throw"Please compile your program with async support in order to use synchronous operations like emscripten_idb_exists, etc."}Module["_emscripten_idb_exists"]=_emscripten_idb_exists;function runAndAbortIfError(func){try{return func()}catch(e){abort(e)}}Module["runAndAbortIfError"]=runAndAbortIfError;function _emscripten_sleep(){throw"Please compile your program with async support in order to use asynchronous operations like emscripten_sleep"}Module["_emscripten_sleep"]=_emscripten_sleep;function _emscripten_wget(){throw"Please compile your program with async support in order to use asynchronous operations like emscripten_wget"}Module["_emscripten_wget"]=_emscripten_wget;function _emscripten_wget_data(){throw"Please compile your program with async support in order to use asynchronous operations like emscripten_wget_data"}Module["_emscripten_wget_data"]=_emscripten_wget_data;function _emscripten_scan_registers(){throw"Please compile your program with async support in order to use asynchronous operations like emscripten_scan_registers"}Module["_emscripten_scan_registers"]=_emscripten_scan_registers;function _emscripten_fiber_init(){throw"Please compile your program with async support in order to use asynchronous operations like emscripten_fiber_init"}Module["_emscripten_fiber_init"]=_emscripten_fiber_init;function _emscripten_fiber_init_from_current_context(){throw"Please compile your program with async support in order to use asynchronous operations like emscripten_fiber_init_from_current_context"}Module["_emscripten_fiber_init_from_current_context"]=_emscripten_fiber_init_from_current_context;function _emscripten_fiber_swap(){throw"Please compile your program with async support in order to use asynchronous operations like emscripten_fiber_swap"}Module["_emscripten_fiber_swap"]=_emscripten_fiber_swap;var ALLOC_NORMAL=0;Module["ALLOC_NORMAL"]=ALLOC_NORMAL;var ALLOC_STACK=1;Module["ALLOC_STACK"]=ALLOC_STACK;function allocate(slab,allocator){var ret;if(allocator==ALLOC_STACK){ret=stackAlloc(slab.length)}else{ret=_malloc(slab.length)}if(!slab.subarray&&!slab.slice){slab=new Uint8Array(slab)}HEAPU8.set(slab,ret);return ret}Module["allocate"]=allocate;function _emscripten_is_main_browser_thread(){return!ENVIRONMENT_IS_WORKER}Module["_emscripten_is_main_browser_thread"]=_emscripten_is_main_browser_thread;var WS={sockets:[null],socketEvent:null};Module["WS"]=WS;function _emscripten_websocket_get_ready_state(socketId,readyState){var socket=WS.sockets[socketId];if(!socket){return-3}HEAP16[readyState>>1]=socket.readyState;return 0}Module["_emscripten_websocket_get_ready_state"]=_emscripten_websocket_get_ready_state;_emscripten_websocket_get_ready_state.sig="iii";function _emscripten_websocket_get_buffered_amount(socketId,bufferedAmount){var socket=WS.sockets[socketId];if(!socket){return-3}tempI64=[socket.bufferedAmount>>>0,(tempDouble=socket.bufferedAmount,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[bufferedAmount>>2]=tempI64[0],HEAP32[bufferedAmount+4>>2]=tempI64[1];return 0}Module["_emscripten_websocket_get_buffered_amount"]=_emscripten_websocket_get_buffered_amount;_emscripten_websocket_get_buffered_amount.sig="iii";function _emscripten_websocket_get_extensions(socketId,extensions,extensionsLength){var socket=WS.sockets[socketId];if(!socket){return-3}if(!extensions)return-5;stringToUTF8(socket.extensions,extensions,extensionsLength);return 0}Module["_emscripten_websocket_get_extensions"]=_emscripten_websocket_get_extensions;_emscripten_websocket_get_extensions.sig="iiii";function _emscripten_websocket_get_extensions_length(socketId,extensionsLength){var socket=WS.sockets[socketId];if(!socket){return-3}if(!extensionsLength)return-5;HEAP32[extensionsLength>>2]=lengthBytesUTF8(socket.extensions)+1;return 0}Module["_emscripten_websocket_get_extensions_length"]=_emscripten_websocket_get_extensions_length;_emscripten_websocket_get_extensions_length.sig="iii";function _emscripten_websocket_get_protocol(socketId,protocol,protocolLength){var socket=WS.sockets[socketId];if(!socket){return-3}if(!protocol)return-5;stringToUTF8(socket.protocol,protocol,protocolLength);return 0}Module["_emscripten_websocket_get_protocol"]=_emscripten_websocket_get_protocol;_emscripten_websocket_get_protocol.sig="iiii";function _emscripten_websocket_get_protocol_length(socketId,protocolLength){var socket=WS.sockets[socketId];if(!socket){return-3}if(!protocolLength)return-5;HEAP32[protocolLength>>2]=lengthBytesUTF8(socket.protocol)+1;return 0}Module["_emscripten_websocket_get_protocol_length"]=_emscripten_websocket_get_protocol_length;_emscripten_websocket_get_protocol_length.sig="iii";function _emscripten_websocket_get_url(socketId,url,urlLength){var socket=WS.sockets[socketId];if(!socket){return-3}if(!url)return-5;stringToUTF8(socket.url,url,urlLength);return 0}Module["_emscripten_websocket_get_url"]=_emscripten_websocket_get_url;_emscripten_websocket_get_url.sig="iiii";function _emscripten_websocket_get_url_length(socketId,urlLength){var socket=WS.sockets[socketId];if(!socket){return-3}if(!urlLength)return-5;HEAP32[urlLength>>2]=lengthBytesUTF8(socket.url)+1;return 0}Module["_emscripten_websocket_get_url_length"]=_emscripten_websocket_get_url_length;_emscripten_websocket_get_url_length.sig="iii";function _emscripten_websocket_set_onopen_callback_on_thread(socketId,userData,callbackFunc,thread){if(!WS.socketEvent)WS.socketEvent=_malloc(1024);var socket=WS.sockets[socketId];if(!socket){return-3}socket.onopen=function(e){HEAPU32[WS.socketEvent>>2]=socketId;getWasmTableEntry(callbackFunc)(0,WS.socketEvent,userData)};return 0}Module["_emscripten_websocket_set_onopen_callback_on_thread"]=_emscripten_websocket_set_onopen_callback_on_thread;_emscripten_websocket_set_onopen_callback_on_thread.sig="iiiii";function _emscripten_websocket_set_onerror_callback_on_thread(socketId,userData,callbackFunc,thread){if(!WS.socketEvent)WS.socketEvent=_malloc(1024);var socket=WS.sockets[socketId];if(!socket){return-3}socket.onerror=function(e){HEAPU32[WS.socketEvent>>2]=socketId;getWasmTableEntry(callbackFunc)(0,WS.socketEvent,userData)};return 0}Module["_emscripten_websocket_set_onerror_callback_on_thread"]=_emscripten_websocket_set_onerror_callback_on_thread;_emscripten_websocket_set_onerror_callback_on_thread.sig="iiiii";function _emscripten_websocket_set_onclose_callback_on_thread(socketId,userData,callbackFunc,thread){if(!WS.socketEvent)WS.socketEvent=_malloc(1024);var socket=WS.sockets[socketId];if(!socket){return-3}socket.onclose=function(e){HEAPU32[WS.socketEvent>>2]=socketId;HEAPU32[WS.socketEvent+4>>2]=e.wasClean;HEAPU32[WS.socketEvent+8>>2]=e.code;stringToUTF8(e.reason,WS.socketEvent+10,512);getWasmTableEntry(callbackFunc)(0,WS.socketEvent,userData)};return 0}Module["_emscripten_websocket_set_onclose_callback_on_thread"]=_emscripten_websocket_set_onclose_callback_on_thread;_emscripten_websocket_set_onclose_callback_on_thread.sig="iiiii";function _emscripten_websocket_set_onmessage_callback_on_thread(socketId,userData,callbackFunc,thread){if(!WS.socketEvent)WS.socketEvent=_malloc(1024);var socket=WS.sockets[socketId];if(!socket){return-3}socket.onmessage=function(e){HEAPU32[WS.socketEvent>>2]=socketId;if(typeof e.data=="string"){var len=lengthBytesUTF8(e.data)+1;var buf=_malloc(len);stringToUTF8(e.data,buf,len);HEAPU32[WS.socketEvent+12>>2]=1}else{var len=e.data.byteLength;var buf=_malloc(len);HEAP8.set(new Uint8Array(e.data),buf);HEAPU32[WS.socketEvent+12>>2]=0}HEAPU32[WS.socketEvent+4>>2]=buf;HEAPU32[WS.socketEvent+8>>2]=len;getWasmTableEntry(callbackFunc)(0,WS.socketEvent,userData);_free(buf)};return 0}Module["_emscripten_websocket_set_onmessage_callback_on_thread"]=_emscripten_websocket_set_onmessage_callback_on_thread;_emscripten_websocket_set_onmessage_callback_on_thread.sig="iiiii";function _emscripten_websocket_new(createAttributes){if(typeof WebSocket=="undefined"){return-1}if(!createAttributes){return-5}var createAttrs=createAttributes>>2;var url=UTF8ToString(HEAP32[createAttrs]);var protocols=HEAP32[createAttrs+1];var socket=protocols?new WebSocket(url,UTF8ToString(protocols).split(",")):new WebSocket(url);socket.binaryType="arraybuffer";var socketId=WS.sockets.length;WS.sockets[socketId]=socket;return socketId}Module["_emscripten_websocket_new"]=_emscripten_websocket_new;_emscripten_websocket_new.sig="ii";function _emscripten_websocket_send_utf8_text(socketId,textData){var socket=WS.sockets[socketId];if(!socket){return-3}var str=UTF8ToString(textData);socket.send(str);return 0}Module["_emscripten_websocket_send_utf8_text"]=_emscripten_websocket_send_utf8_text;_emscripten_websocket_send_utf8_text.sig="iii";function _emscripten_websocket_send_binary(socketId,binaryData,dataLength){var socket=WS.sockets[socketId];if(!socket){return-3}socket.send(HEAPU8.subarray(binaryData,binaryData+dataLength));return 0}Module["_emscripten_websocket_send_binary"]=_emscripten_websocket_send_binary;_emscripten_websocket_send_binary.sig="iiii";function _emscripten_websocket_close(socketId,code,reason){var socket=WS.sockets[socketId];if(!socket){return-3}var reasonStr=reason?UTF8ToString(reason):undefined;if(reason)socket.close(code||undefined,UTF8ToString(reason));else if(code)socket.close(code);else socket.close();return 0}Module["_emscripten_websocket_close"]=_emscripten_websocket_close;_emscripten_websocket_close.sig="iiii";function _emscripten_websocket_delete(socketId){var socket=WS.sockets[socketId];if(!socket){return-3}socket.onopen=socket.onerror=socket.onclose=socket.onmessage=null;delete WS.sockets[socketId];return 0}Module["_emscripten_websocket_delete"]=_emscripten_websocket_delete;_emscripten_websocket_delete.sig="ii";function _emscripten_websocket_is_supported(){return typeof WebSocket!="undefined"}Module["_emscripten_websocket_is_supported"]=_emscripten_websocket_is_supported;_emscripten_websocket_is_supported.sig="i";function _emscripten_websocket_deinitialize(){for(var i in WS.sockets){var socket=WS.sockets[i];if(socket){socket.close();_emscripten_websocket_delete(i)}}WS.sockets=[]}Module["_emscripten_websocket_deinitialize"]=_emscripten_websocket_deinitialize;_emscripten_websocket_deinitialize.sig="v";Module["requestFullscreen"]=function Module_requestFullscreen(lockPointer,resizeCanvas){Browser.requestFullscreen(lockPointer,resizeCanvas)};Module["requestAnimationFrame"]=function Module_requestAnimationFrame(func){Browser.requestAnimationFrame(func)};Module["setCanvasSize"]=function Module_setCanvasSize(width,height,noUpdates){Browser.setCanvasSize(width,height,noUpdates)};Module["pauseMainLoop"]=function Module_pauseMainLoop(){Browser.mainLoop.pause()};Module["resumeMainLoop"]=function Module_resumeMainLoop(){Browser.mainLoop.resume()};Module["getUserMedia"]=function Module_getUserMedia(){Browser.getUserMedia()};Module["createContext"]=function Module_createContext(canvas,useWebGL,setInModule,webGLContextAttributes){return Browser.createContext(canvas,useWebGL,setInModule,webGLContextAttributes)};var preloadedWasm={};var preloadedImages={};var preloadedAudios={};var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_unlink"]=FS.unlink;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createDevice"]=FS.createDevice;if(ENVIRONMENT_IS_NODE){NODEFS.staticInit()}ERRNO_CODES={"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};var GLctx;for(var i=0;i<32;++i)tempFixedLengthArray.push(new Array(i));var miniTempWebGLFloatBuffersStorage=new Float32Array(288);for(var i=0;i<288;++i){miniTempWebGLFloatBuffers[i]=miniTempWebGLFloatBuffersStorage.subarray(0,i+1)}var __miniTempWebGLIntBuffersStorage=new Int32Array(288);for(var i=0;i<288;++i){__miniTempWebGLIntBuffers[i]=__miniTempWebGLIntBuffersStorage.subarray(0,i+1)}var emSetImmediate;var emClearImmediate;if(typeof setImmediate!="undefined"){emSetImmediate=setImmediateWrapped;emClearImmediate=clearImmediateWrapped}else if(typeof addEventListener=="function"){var __setImmediate_id_counter=0;var __setImmediate_queue=[];var __setImmediate_message_id="_si";var __setImmediate_cb=e=>{if(e.data===__setImmediate_message_id){e.stopPropagation();__setImmediate_queue.shift()();++__setImmediate_id_counter}};addEventListener("message",__setImmediate_cb,true);emSetImmediate=func=>{postMessage(__setImmediate_message_id,"*");return __setImmediate_id_counter+__setImmediate_queue.push(func)-1};emClearImmediate=id=>{var index=id-__setImmediate_id_counter;if(index>=0&&index<__setImmediate_queue.length)__setImmediate_queue[index]=()=>{}}}var ASSERTIONS=false;var decodeBase64=typeof atob=="function"?atob:function(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i>2;args.forEach(arg=>{HEAP32[argv_ptr++]=allocateUTF8OnStack(arg)});HEAP32[argv_ptr]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}var dylibsLoaded=false;function run(args){args=args||arguments_;if(runDependencies>0){return}if(!dylibsLoaded){preloadDylibs();dylibsLoaded=true;if(runDependencies>0){return}}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(shouldRunNow)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"])shouldRunNow=false;run();Module.UTF8ToString=UTF8ToString;Module.wasmTable=wasmTable;Module.ERRNO_CODES=ERRNO_CODES; return _createPyodideModule.ready } ); })(); globalThis._createPyodideModule = _createPyodideModule;