UNPKG

trtc-sdk-v5

Version:
1 lines 562 kB
"use strict";var VirtualBackground=(()=>{var Ho=Object.defineProperty,Cu=Object.defineProperties,yu=Object.getOwnPropertyDescriptor,wu=Object.getOwnPropertyDescriptors,bu=Object.getOwnPropertyNames,_c=Object.getOwnPropertySymbols;var hc=Object.prototype.hasOwnProperty,Du=Object.prototype.propertyIsEnumerable;var oc=($,N,n)=>N in $?Ho($,N,{enumerable:!0,configurable:!0,writable:!0,value:n}):$[N]=n,Ic=($,N)=>{for(var n in N||(N={}))hc.call(N,n)&&oc($,n,N[n]);if(_c)for(var n of _c(N))Du.call(N,n)&&oc($,n,N[n]);return $},mc=($,N)=>Cu($,wu(N));var Cc=($=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy($,{get:(N,n)=>(typeof require!="undefined"?require:N)[n]}):$)(function($){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var Bu=($,N)=>{for(var n in N)Ho($,n,{get:N[n],enumerable:!0})},Ou=($,N,n,ge)=>{if(N&&typeof N=="object"||typeof N=="function")for(let F of bu(N))!hc.call($,F)&&F!==n&&Ho($,F,{get:()=>N[F],enumerable:!(ge=yu(N,F))||ge.enumerable});return $};var Tu=$=>Ou(Ho({},"__esModule",{value:!0}),$);var Le=($,N,n)=>oc($,typeof N!="symbol"?N+"":N,n);var al={};Bu(al,{VirtualBackground:()=>Vo,default:()=>ol});async function yc({sdkAppId:$,userId:N,userSig:n,core:ge}){var st;let F=ge.schedule.getAbilityConfigUrl($),Ne=Math.round(new Date().getTime()/1e3),we=`${F}?sdkAppId=${$}&userId=${N}&userSig=${n}&timestamp=${Ne}`;try{let Je=await(await fetch(we)).json();ge.log.info(`virtual background send ${we}, response: ${JSON.stringify(Je)}`);let{data:Xe}=Je;return(st=Xe==null?void 0:Xe.trtcAutoConf)!=null&&st.web_ar?{auth:!0,timestamp:Ne}:{auth:!1}}catch(mt){return ge.log.error("virtual background fetch error",mt),{auth:!1}}}var vu={sdkAppId:{required:!0,type:"number"},userId:{required:!0,type:"string"},userSig:{required:!0,type:"string"}};function wc($){return{name:"VirtualBackgroundOptions",type:"object",required:!0,allowEmpty:!1,properties:mc(Ic({},vu),{type:{required:!1,type:"string",values:["image","blur"]},src:{required:!1,type:"string"},blurLevel:{required:!1,type:"number",min:1,max:10},onAbort:{required:!1}}),validate(N,n,ge,F){var ze;let{RtcError:Ne,ErrorCode:we,ErrorCodeDictionary:st}=$.errorModule;if(!N)return;let{type:mt,src:Je,onAbort:Xe}=N;if(mt==="image"&&!Je)throw new Ne({code:we.INVALID_PARAMETER,extraCode:st.INVALID_PARAMETER_REQUIRED,fnName:ge,messageParams:{key:"src"}});if(Xe&&!$.utils.isFunction(Xe))throw new Ne({code:we.INVALID_PARAMETER,extraCode:st.INVALID_PARAMETER_TYPE,fnName:ge,messageParams:{key:"onAbort",value:typeof Xe,rule:{type:"Function"}}});if(!((ze=$.room.videoManager.cameraTrack)!=null&&ze.mediaTrack))throw new Ne({code:we.INVALID_OPERATION,extraCode:st.INVALID_OPERATION_NEED_VIDEO,fnName:ge})}}}function bc($){return{name:"UpdateVirtualBackgroundOptions",type:"object",required:!0,allowEmpty:!1,properties:{type:{required:!0,type:"string",values:["image","blur"]},src:{required:!1,type:"string"},blurLevel:{required:!1,type:"number",min:1,max:10}},validate(N,n,ge,F){if(!N)return;let{RtcError:Ne,ErrorCode:we,ErrorCodeDictionary:st}=$.errorModule,{type:mt,src:Je}=N;if(mt==="image"&&!Je)throw new Ne({code:we.INVALID_PARAMETER,extraCode:st.INVALID_PARAMETER_REQUIRED,fnName:ge,messageParams:{key:"src"}})}}}function Dc($){return{name:"StopVirtualBackgroundOptions",required:!1}}var Qu=function(){let $=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&($=$||__filename),function(N){N=N||{};let n=typeof N!="undefined"?N:{},ge,F;n.ready=new Promise((e,t)=>{ge=e,F=t}),Object.getOwnPropertyDescriptor(n.ready,"_main")||(Object.defineProperty(n.ready,"_main",{configurable:!0,get(){_("You are getting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_main",{configurable:!0,set(){_("You are setting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_emscripten_stack_get_end")||(Object.defineProperty(n.ready,"_emscripten_stack_get_end",{configurable:!0,get(){_("You are getting _emscripten_stack_get_end on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_emscripten_stack_get_end",{configurable:!0,set(){_("You are setting _emscripten_stack_get_end on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_emscripten_stack_get_free")||(Object.defineProperty(n.ready,"_emscripten_stack_get_free",{configurable:!0,get(){_("You are getting _emscripten_stack_get_free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_emscripten_stack_get_free",{configurable:!0,set(){_("You are setting _emscripten_stack_get_free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_emscripten_stack_init")||(Object.defineProperty(n.ready,"_emscripten_stack_init",{configurable:!0,get(){_("You are getting _emscripten_stack_init on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_emscripten_stack_init",{configurable:!0,set(){_("You are setting _emscripten_stack_init on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_stackSave")||(Object.defineProperty(n.ready,"_stackSave",{configurable:!0,get(){_("You are getting _stackSave on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_stackSave",{configurable:!0,set(){_("You are setting _stackSave on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_stackRestore")||(Object.defineProperty(n.ready,"_stackRestore",{configurable:!0,get(){_("You are getting _stackRestore on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_stackRestore",{configurable:!0,set(){_("You are setting _stackRestore on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_stackAlloc")||(Object.defineProperty(n.ready,"_stackAlloc",{configurable:!0,get(){_("You are getting _stackAlloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_stackAlloc",{configurable:!0,set(){_("You are setting _stackAlloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"___wasm_call_ctors")||(Object.defineProperty(n.ready,"___wasm_call_ctors",{configurable:!0,get(){_("You are getting ___wasm_call_ctors on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"___wasm_call_ctors",{configurable:!0,set(){_("You are setting ___wasm_call_ctors on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_fflush")||(Object.defineProperty(n.ready,"_fflush",{configurable:!0,get(){_("You are getting _fflush on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_fflush",{configurable:!0,set(){_("You are setting _fflush on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"___errno_location")||(Object.defineProperty(n.ready,"___errno_location",{configurable:!0,get(){_("You are getting ___errno_location on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"___errno_location",{configurable:!0,set(){_("You are setting ___errno_location on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_malloc")||(Object.defineProperty(n.ready,"_malloc",{configurable:!0,get(){_("You are getting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_malloc",{configurable:!0,set(){_("You are setting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_free")||(Object.defineProperty(n.ready,"_free",{configurable:!0,get(){_("You are getting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_free",{configurable:!0,set(){_("You are setting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_setThrew")||(Object.defineProperty(n.ready,"_setThrew",{configurable:!0,get(){_("You are getting _setThrew on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_setThrew",{configurable:!0,set(){_("You are setting _setThrew on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"___cxa_is_pointer_type")||(Object.defineProperty(n.ready,"___cxa_is_pointer_type",{configurable:!0,get(){_("You are getting ___cxa_is_pointer_type on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"___cxa_is_pointer_type",{configurable:!0,set(){_("You are setting ___cxa_is_pointer_type on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"___cxa_can_catch")||(Object.defineProperty(n.ready,"___cxa_can_catch",{configurable:!0,get(){_("You are getting ___cxa_can_catch on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"___cxa_can_catch",{configurable:!0,set(){_("You are setting ___cxa_can_catch on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_saveSetjmp")||(Object.defineProperty(n.ready,"_saveSetjmp",{configurable:!0,get(){_("You are getting _saveSetjmp on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_saveSetjmp",{configurable:!0,set(){_("You are setting _saveSetjmp on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_memalign")||(Object.defineProperty(n.ready,"_memalign",{configurable:!0,get(){_("You are getting _memalign on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_memalign",{configurable:!0,set(){_("You are setting _memalign on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_emscripten_main_thread_process_queued_calls")||(Object.defineProperty(n.ready,"_emscripten_main_thread_process_queued_calls",{configurable:!0,get(){_("You are getting _emscripten_main_thread_process_queued_calls on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_emscripten_main_thread_process_queued_calls",{configurable:!0,set(){_("You are setting _emscripten_main_thread_process_queued_calls on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_emscripten_webgl_make_context_current")||(Object.defineProperty(n.ready,"_emscripten_webgl_make_context_current",{configurable:!0,get(){_("You are getting _emscripten_webgl_make_context_current on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_emscripten_webgl_make_context_current",{configurable:!0,set(){_("You are setting _emscripten_webgl_make_context_current on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_emscripten_webgl_get_current_context")||(Object.defineProperty(n.ready,"_emscripten_webgl_get_current_context",{configurable:!0,get(){_("You are getting _emscripten_webgl_get_current_context on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_emscripten_webgl_get_current_context",{configurable:!0,set(){_("You are setting _emscripten_webgl_get_current_context on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"__get_tzname")||(Object.defineProperty(n.ready,"__get_tzname",{configurable:!0,get(){_("You are getting __get_tzname on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"__get_tzname",{configurable:!0,set(){_("You are setting __get_tzname on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"__get_daylight")||(Object.defineProperty(n.ready,"__get_daylight",{configurable:!0,get(){_("You are getting __get_daylight on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"__get_daylight",{configurable:!0,set(){_("You are setting __get_daylight on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"__get_timezone")||(Object.defineProperty(n.ready,"__get_timezone",{configurable:!0,get(){_("You are getting __get_timezone on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"__get_timezone",{configurable:!0,set(){_("You are setting __get_timezone on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_emscripten_builtin_malloc")||(Object.defineProperty(n.ready,"_emscripten_builtin_malloc",{configurable:!0,get(){_("You are getting _emscripten_builtin_malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_emscripten_builtin_malloc",{configurable:!0,set(){_("You are setting _emscripten_builtin_malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_emscripten_builtin_free")||(Object.defineProperty(n.ready,"_emscripten_builtin_free",{configurable:!0,get(){_("You are getting _emscripten_builtin_free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_emscripten_builtin_free",{configurable:!0,set(){_("You are setting _emscripten_builtin_free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"_emscripten_builtin_memalign")||(Object.defineProperty(n.ready,"_emscripten_builtin_memalign",{configurable:!0,get(){_("You are getting _emscripten_builtin_memalign on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"_emscripten_builtin_memalign",{configurable:!0,set(){_("You are setting _emscripten_builtin_memalign on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"___getTypeName")||(Object.defineProperty(n.ready,"___getTypeName",{configurable:!0,get(){_("You are getting ___getTypeName on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"___getTypeName",{configurable:!0,set(){_("You are setting ___getTypeName on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"___embind_register_native_and_builtin_types")||(Object.defineProperty(n.ready,"___embind_register_native_and_builtin_types",{configurable:!0,get(){_("You are getting ___embind_register_native_and_builtin_types on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"___embind_register_native_and_builtin_types",{configurable:!0,set(){_("You are setting ___embind_register_native_and_builtin_types on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(n.ready,"onRuntimeInitialized")||(Object.defineProperty(n.ready,"onRuntimeInitialized",{configurable:!0,get(){_("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(n.ready,"onRuntimeInitialized",{configurable:!0,set(){_("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}));let Ne={},we;for(we in n)n.hasOwnProperty(we)&&(Ne[we]=n[we]);let st=[],mt="./this.program",Je=function(e,t){throw t},Xe=typeof window=="object",ze=typeof importScripts=="function",Ct=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",Qi=!Xe&&!Ct&&!ze;if(n.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)");let Te="";function Pi(e){return n.locateFile?n.locateFile(e,Te):Te+e}let Mr,tr,Fr,on,Ze,Ee;if(Xe||ze){if(ze?Te=self.location.href:typeof document!="undefined"&&document.currentScript&&(Te=document.currentScript.src),$&&(Te=$),Te.indexOf("blob:")!==0?Te=Te.substr(0,Te.lastIndexOf("/")+1):Te="",!(typeof window=="object"||typeof importScripts=="function"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");Mr=function(e){let t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},ze&&(Fr=function(e){let t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),tr=function(e,t,r){let o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="arraybuffer",o.onload=function(){if(o.status==200||o.status==0&&o.response){t(o.response);return}r()},o.onerror=r,o.send(null)},on=function(e){document.title=e}}else throw new Error("environment detection error");let Re=n.print||console.log.bind(console),_e=n.printErr||console.warn.bind(console);for(we in Ne)Ne.hasOwnProperty(we)&&(n[we]=Ne[we]);Ne=null,n.arguments&&(st=n.arguments),Object.getOwnPropertyDescriptor(n,"arguments")||Object.defineProperty(n,"arguments",{configurable:!0,get(){_("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),n.thisProgram&&(mt=n.thisProgram),Object.getOwnPropertyDescriptor(n,"thisProgram")||Object.defineProperty(n,"thisProgram",{configurable:!0,get(){_("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),n.quit&&(Je=n.quit),Object.getOwnPropertyDescriptor(n,"quit")||Object.defineProperty(n,"quit",{configurable:!0,get(){_("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),z(typeof n.memoryInitializerPrefixURL=="undefined","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),z(typeof n.pthreadMainPrefixURL=="undefined","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),z(typeof n.cdInitializerPrefixURL=="undefined","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),z(typeof n.filePackagePrefixURL=="undefined","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),z(typeof n.read=="undefined","Module.read option was removed (modify read_ in JS)"),z(typeof n.readAsync=="undefined","Module.readAsync option was removed (modify readAsync in JS)"),z(typeof n.readBinary=="undefined","Module.readBinary option was removed (modify readBinary in JS)"),z(typeof n.setWindowTitle=="undefined","Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),z(typeof n.TOTAL_MEMORY=="undefined","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),Object.getOwnPropertyDescriptor(n,"read")||Object.defineProperty(n,"read",{configurable:!0,get(){_("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(n,"readAsync")||Object.defineProperty(n,"readAsync",{configurable:!0,get(){_("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(n,"readBinary")||Object.defineProperty(n,"readBinary",{configurable:!0,get(){_("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(n,"setWindowTitle")||Object.defineProperty(n,"setWindowTitle",{configurable:!0,get(){_("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),z(!Qi,"shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable.");function nt(e){nt.shown||(nt.shown={}),nt.shown[e]||(nt.shown[e]=1,_e(e))}function Ir(e,t){if(typeof WebAssembly.Function=="function"){let I={i:"i32",j:"i64",f:"f32",d:"f64"},m={parameters:[],results:t[0]=="v"?[]:[I[t[0]]]};for(var r=1;r<t.length;++r)m.parameters.push(I[t[r]]);return new WebAssembly.Function(m,e)}let o=[1,0,1,96],a=t.slice(0,1),s=t.slice(1),A={i:127,j:126,f:125,d:124};o.push(s.length);for(var r=0;r<s.length;++r)o.push(A[s[r]]);a=="v"?o.push(0):o=o.concat([1,A[a]]),o[1]=o.length-2;let c=new Uint8Array([0,97,115,109,1,0,0,0].concat(o,[2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0])),u=new WebAssembly.Module(c);return new WebAssembly.Instance(u,{e:{f:e}}).exports.f}let Lt=[],He;function mr(){if(Lt.length)return Lt.pop();try{W.grow(1)}catch(e){throw e instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":e}return W.length-1}function yt(e,t){if(!He){He=new WeakMap;for(let o=0;o<W.length;o++){let a=W.get(o);a&&He.set(a,o)}}if(He.has(e))return He.get(e);let r=mr();try{W.set(r,e)}catch(o){if(!(o instanceof TypeError))throw o;z(typeof t!="undefined",`Missing signature argument to addFunction: ${e}`);let a=Ir(e,t);W.set(r,a)}return He.set(e,r),r}let Cr=0,pe=function(e){Cr=e},Gn=function(){return Cr},Ht;n.wasmBinary&&(Ht=n.wasmBinary),Object.getOwnPropertyDescriptor(n,"wasmBinary")||Object.defineProperty(n,"wasmBinary",{configurable:!0,get(){_("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}});let Gt=n.noExitRuntime||!0;Object.getOwnPropertyDescriptor(n,"noExitRuntime")||Object.defineProperty(n,"noExitRuntime",{configurable:!0,get(){_("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),typeof WebAssembly!="object"&&_("no native wasm support detected");let Rt,V=!1,kr;function z(e,t){e||_(`Assertion failed: ${t}`)}function po(e){let t=n[`_${e}`];return z(t,`Cannot call unknown function ${e}, make sure it is exported`),t}function Ri(e,t,r,o,a){let s={string(m){let y=0;if(m!=null&&m!==0){let v=(m.length<<2)+1;y=lo(v),rr(m,y,v)}return y},array(m){let y=lo(m.length);return Vn(m,y),y}};function A(m){return t==="string"?et(m):t==="boolean"?!!m:m}let c=po(e),u=[],d=0;if(z(t!=="array",'Return type should not be "array".'),o)for(let m=0;m<o.length;m++){let y=s[r[m]];y?(d===0&&(d=L()),u[m]=y(o[m])):u[m]=o[m]}let h=c.apply(null,u);function I(m){return d!==0&&te(d),A(m)}return h=I(h),h}let Nr=1,At=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;function St(e,t,r){let o=t+r,a=t;for(;e[a]&&!(a>=o);)++a;if(a-t>16&&e.subarray&&At)return At.decode(e.subarray(t,a));let s="";for(;t<a;){let A=e[t++];if(!(A&128)){s+=String.fromCharCode(A);continue}let c=e[t++]&63;if((A&224)==192){s+=String.fromCharCode((A&31)<<6|c);continue}let u=e[t++]&63;if((A&240)==224?A=(A&15)<<12|c<<6|u:((A&248)!=240&&nt(`Invalid UTF-8 leading byte 0x${A.toString(16)} encountered when deserializing a UTF-8 string in wasm memory to a JS string!`),A=(A&7)<<18|c<<12|u<<6|e[t++]&63),A<65536)s+=String.fromCharCode(A);else{let d=A-65536;s+=String.fromCharCode(55296|d>>10,56320|d&1023)}}return s}function et(e,t){return e?St(ve,e,t):""}function tt(e,t,r,o){if(!(o>0))return 0;let a=r,s=r+o-1;for(let A=0;A<e.length;++A){let c=e.charCodeAt(A);if(c>=55296&&c<=57343){let u=e.charCodeAt(++A);c=65536+((c&1023)<<10)|u&1023}if(c<=127){if(r>=s)break;t[r++]=c}else if(c<=2047){if(r+1>=s)break;t[r++]=192|c>>6,t[r++]=128|c&63}else if(c<=65535){if(r+2>=s)break;t[r++]=224|c>>12,t[r++]=128|c>>6&63,t[r++]=128|c&63}else{if(r+3>=s)break;c>=2097152&&nt(`Invalid Unicode code point 0x${c.toString(16)} encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x1FFFFF).`),t[r++]=240|c>>18,t[r++]=128|c>>12&63,t[r++]=128|c>>6&63,t[r++]=128|c&63}}return t[r]=0,r-a}function rr(e,t,r){return z(typeof r=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),tt(e,ve,t,r)}function Bt(e){let t=0;for(let r=0;r<e.length;++r){let o=e.charCodeAt(r);o>=55296&&o<=57343&&(o=65536+((o&1023)<<10)|e.charCodeAt(++r)&1023),o<=127?++t:o<=2047?t+=2:o<=65535?t+=3:t+=4}return t}let Yn=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0;function Si(e,t){z(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");let r=e,o=r>>1,a=o+t/2;for(;!(o>=a)&&De[o];)++o;if(r=o<<1,r-e>32&&Yn)return Yn.decode(ve.subarray(e,r));let s="";for(let A=0;!(A>=t/2);++A){let c=T[e+A*2>>1];if(c==0)break;s+=String.fromCharCode(c)}return s}function mn(e,t,r){if(z(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),z(typeof r=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),r===void 0&&(r=2147483647),r<2)return 0;r-=2;let o=t,a=r<e.length*2?r/2:e.length;for(let s=0;s<a;++s){let A=e.charCodeAt(s);T[t>>1]=A,t+=2}return T[t>>1]=0,t-o}function Xn(e){return e.length*2}function Mi(e,t){z(e%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");let r=0,o="";for(;!(r>=t/4);){let a=D[e+r*4>>2];if(a==0)break;if(++r,a>=65536){let s=a-65536;o+=String.fromCharCode(55296|s>>10,56320|s&1023)}else o+=String.fromCharCode(a)}return o}function Cn(e,t,r){if(z(t%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),z(typeof r=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),r===void 0&&(r=2147483647),r<4)return 0;let o=t,a=o+r-4;for(let s=0;s<e.length;++s){let A=e.charCodeAt(s);if(A>=55296&&A<=57343){let c=e.charCodeAt(++s);A=65536+((A&1023)<<10)|c&1023}if(D[t>>2]=A,t+=4,t+4>a)break}return D[t>>2]=0,t-o}function xr(e){let t=0;for(let r=0;r<e.length;++r){let o=e.charCodeAt(r);o>=55296&&o<=57343&&++r,t+=4}return t}function yn(e){let t=Bt(e)+1,r=rn(t);return r&&tt(e,be,r,t),r}function Vn(e,t){z(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),be.set(e,t)}function Ur(e,t,r){for(let o=0;o<e.length;++o)z(e.charCodeAt(o)===e.charCodeAt(o)&255),be[t++>>0]=e.charCodeAt(o);r||(be[t>>0]=0)}function xe(e,t){return e%t>0&&(e+=t-e%t),e}let Se,be,ve,T,De,D,Qe,$e,jr;function an(e){Se=e,n.HEAP8=be=new Int8Array(e),n.HEAP16=T=new Int16Array(e),n.HEAP32=D=new Int32Array(e),n.HEAPU8=ve=new Uint8Array(e),n.HEAPU16=De=new Uint16Array(e),n.HEAPU32=Qe=new Uint32Array(e),n.HEAPF32=$e=new Float32Array(e),n.HEAPF64=jr=new Float64Array(e)}let J=5242880;n.TOTAL_STACK&&z(J===n.TOTAL_STACK,"the stack size can no longer be determined at runtime");let Lr=n.INITIAL_MEMORY||16777216;Object.getOwnPropertyDescriptor(n,"INITIAL_MEMORY")||Object.defineProperty(n,"INITIAL_MEMORY",{configurable:!0,get(){_("Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),z(Lr>=J,`INITIAL_MEMORY should be larger than TOTAL_STACK, was ${Lr}! (TOTAL_STACK=${J})`),z(typeof Int32Array!="undefined"&&typeof Float64Array!="undefined"&&Int32Array.prototype.subarray!==void 0&&Int32Array.prototype.set!==void 0,"JS engine does not provide full typed array support"),z(!n.wasmMemory,"Use of `wasmMemory` detected. Use -s IMPORTED_MEMORY to define wasmMemory externally"),z(Lr==16777216,"Detected runtime INITIAL_MEMORY setting. Use -s IMPORTED_MEMORY to define wasmMemory dynamically");let W;function Yt(){let e=nn();z((e&3)==0),Qe[(e>>2)+1]=34821223,Qe[(e>>2)+2]=2310721022,D[0]=1668509029}function ct(){if(V)return;let e=nn(),t=Qe[(e>>2)+1],r=Qe[(e>>2)+2];(t!=34821223||r!=2310721022)&&_(`Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x${r.toString(16)} ${t.toString(16)}`),D[0]!==1668509029&&_("Runtime error: The application has corrupted its heap memory area (address zero)!")}(function(){let e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,t[0]!==115||t[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)"})();let Hr=[],Xt=[],de=[],sn=[],yr=!1,Ot=!1,Fi=0;function wt(){return Gt||Fi>0}function Vt(){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)bn(n.preRun.shift());Tn(Hr)}function ki(){ct(),z(!yr),yr=!0,!n.noFSInit&&!l.init.initialized&&l.init(),l.ignorePermissions=!1,bt.init(),Tn(Xt)}function Ni(){ct(),Ot=!0}function wn(){if(ct(),n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;)nr(n.postRun.shift());Tn(sn)}function bn(e){Hr.unshift(e)}function Wt(e){Xt.unshift(e)}function nr(e){sn.unshift(e)}z(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),z(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),z(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),z(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");let ft=0,ut=null,ir=null,Mt={};function wr(e){let t=e;for(;;){if(!Mt[e])return e;e=t+Math.random()}}function p(e){ft++,n.monitorRunDependencies&&n.monitorRunDependencies(ft),e?(z(!Mt[e]),Mt[e]=1,ut===null&&typeof setInterval!="undefined"&&(ut=setInterval(()=>{if(V){clearInterval(ut),ut=null;return}let t=!1;for(let r in Mt)t||(t=!0,_e("still waiting on run dependencies:")),_e(`dependency: ${r}`);t&&_e("(end of list)")},1e4))):_e("warning: run dependency added without ID")}function or(e){if(ft--,n.monitorRunDependencies&&n.monitorRunDependencies(ft),e?(z(Mt[e]),delete Mt[e]):_e("warning: run dependency removed without ID"),ft==0&&(ut!==null&&(clearInterval(ut),ut=null),ir)){let t=ir;ir=null,t()}}n.preloadedImages={},n.preloadedAudios={};function _(e){n.onAbort&&n.onAbort(e),e+="",_e(e),V=!0,kr=1,e=`abort(${e}) at ${ji()}`;let r=new WebAssembly.RuntimeError(e);throw F(r),r}let Dn="data:application/octet-stream;base64,";function le(e){return e.startsWith(Dn)}function Ge(e){return e.startsWith("file://")}function ce(e,t){return function(){let r=e,o=t;return t||(o=n.asm),z(yr,`native function \`${r}\` called before runtime initialization`),z(!Ot,`native function \`${r}\` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)`),o[e]||z(o[e],`exported native function \`${r}\` not found`),o[e].apply(null,arguments)}}let br;br="selfie_segmentation_solution_simd_wasm_bin.wasm",le(br)||(br=Pi(br));function Bn(e){try{if(e==br&&Ht)return new Uint8Array(Ht);if(Fr)return Fr(e);throw"both async and sync fetching of the wasm failed"}catch(t){_(t)}}function Ve(){let e={env:iA,wasi_snapshot_preview1:iA};function t(a,s){let{exports:A}=a;n.asm=A,Rt=n.asm.memory,z(Rt,"memory not found in wasm exports"),an(Rt.buffer),W=n.asm.__indirect_function_table,z(W,"table not found in wasm exports"),Wt(n.asm.__wasm_call_ctors),or("wasm-instantiate")}p("wasm-instantiate");let r=n;function o(a){z(n===r,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),r=null,t(a)}if(n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(a){return _e(`Module.instantiateWasm callback failed with error: ${a}`),!1}return n.loadWasm(br,e).then(o).catch(F),{}}let ye,Tt,Gr={460656(){let e=!0;if(e){let t=oo;if(typeof t!="function"){typeof console!="undefined"&&console.error('Expected Emscripten global function "findCanvasEventTarget" not found. WebGL context creation may fail.');return}oo=function(r){if(r==0){if(n&&n.canvas)return n.canvas;if(n&&n.canvasCssSelector)return t(n.canvasCssSelector);typeof console!="undefined"&&console.warn("Module properties canvas and canvasCssSelector not found during WebGL context creation.")}return t(r)},e=!1}},461441(){return typeof wasmOffsetConverter!="undefined"}};function Dr(){return typeof wasmOffsetConverter!="undefined"}function vt(e,t){if(Q.mainLoop.timingMode=e,Q.mainLoop.timingValue=t,!Q.mainLoop.func)return _e("emscripten_set_main_loop_timing: Cannot set timing mode for main loop since a main loop does not exist! Call emscripten_set_main_loop first to set one up."),1;if(Q.mainLoop.running||(Q.mainLoop.running=!0),e==0)Q.mainLoop.scheduler=function(){let o=Math.max(0,Q.mainLoop.tickStartTime+t-Br())|0;setTimeout(Q.mainLoop.runner,o)},Q.mainLoop.method="timeout";else if(e==1)Q.mainLoop.scheduler=function(){Q.requestAnimationFrame(Q.mainLoop.runner)},Q.mainLoop.method="rAF";else if(e==2){if(typeof setImmediate=="undefined"){let r=[],o="setimmediate",a=function(s){(s.data===o||s.data.target===o)&&(s.stopPropagation(),r.shift()())};addEventListener("message",a,!0),setImmediate=function(A){r.push(A),ze?(n.setImmediates===void 0&&(n.setImmediates=[]),n.setImmediates.push(A),postMessage({target:o})):postMessage(o,"*")}}Q.mainLoop.scheduler=function(){setImmediate(Q.mainLoop.runner)},Q.mainLoop.method="immediate"}return 0}let Br;Ct?Br=function(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}:Br=function(){return performance.now()};function xi(){return!w.currentContext||!w.currentContext.GLctx?-3:w.currentContext.defaultFbo?(w.blitOffscreenFramebuffer(w.currentContext),0):w.currentContext.attributes.explicitSwapControl?0:-3}function Wn(e){Lo(e)}function Ui(){if(!wt())try{Wn(kr)}catch(e){if(e instanceof fo)return;throw e}}function On(e,t,r,o,a){z(!Q.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."),Q.mainLoop.func=e,Q.mainLoop.arg=o;let s=Q.mainLoop.currentlyRunningMainloop;function A(){return s<Q.mainLoop.currentlyRunningMainloop?(Ui(),!1):!0}if(Q.mainLoop.running=!1,Q.mainLoop.runner=function(){if(!V){if(Q.mainLoop.queue.length>0){let u=Date.now(),d=Q.mainLoop.queue.shift();if(d.func(d.arg),Q.mainLoop.remainingBlockers){let h=Q.mainLoop.remainingBlockers,I=h%1==0?h-1:Math.floor(h);d.counted?Q.mainLoop.remainingBlockers=I:(I=I+.5,Q.mainLoop.remainingBlockers=(8*h+I)/9)}if(Re(`main loop blocker "${d.name}" took ${Date.now()-u} ms`),Q.mainLoop.updateStatus(),!A())return;setTimeout(Q.mainLoop.runner,0);return}if(A()){if(Q.mainLoop.currentFrameNumber=Q.mainLoop.currentFrameNumber+1|0,Q.mainLoop.timingMode==1&&Q.mainLoop.timingValue>1&&Q.mainLoop.currentFrameNumber%Q.mainLoop.timingValue!=0){Q.mainLoop.scheduler();return}Q.mainLoop.timingMode==0&&(Q.mainLoop.tickStartTime=Br()),w.newRenderingFrameStarted(),typeof w!="undefined"&&w.currentContext&&!w.currentContextIsProxied&&!w.currentContext.attributes.explicitSwapControl&&w.currentContext.GLctx.commit&&w.currentContext.GLctx.commit(),Q.mainLoop.method==="timeout"&&n.ctx&&(nt("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!"),Q.mainLoop.method=""),Q.mainLoop.runIter(e),ct(),A()&&(typeof SDL=="object"&&SDL.audio&&SDL.audio.queueNewAudioData&&SDL.audio.queueNewAudioData(),Q.mainLoop.scheduler())}}},a||(t&&t>0?vt(0,1e3/t):vt(1,1),Q.mainLoop.scheduler()),r)throw"unwind"}function ar(e,t){if(V){_e("user callback triggered after application aborted. Ignoring.");return}if(t){e();return}try{e()}catch(r){if(r instanceof fo)return;if(r!=="unwind")throw r&&typeof r=="object"&&r.stack&&_e(`exception thrown: ${[r,r.stack]}`),r}}function P(e,t){return setTimeout(()=>{ar(e)},t)}var Q={mainLoop:{running:!1,scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause(){Q.mainLoop.scheduler=null,Q.mainLoop.currentlyRunningMainloop++},resume(){Q.mainLoop.currentlyRunningMainloop++;let{timingMode:e}=Q.mainLoop,{timingValue:t}=Q.mainLoop,{func:r}=Q.mainLoop;Q.mainLoop.func=null,On(r,0,!1,Q.mainLoop.arg,!0),vt(e,t),Q.mainLoop.scheduler()},updateStatus(){if(n.setStatus){let e=n.statusMessage||"Please wait...",t=Q.mainLoop.remainingBlockers,r=Q.mainLoop.expectedBlockers;t?t<r?n.setStatus(`${e} (${r-t}/${r})`):n.setStatus(e):n.setStatus("")}},runIter(e){V||n.preMainLoop&&n.preMainLoop()===!1||(ar(e),n.postMainLoop&&n.postMainLoop())}},isFullscreen:!1,pointerLock:!1,moduleContextCreatedCallbacks:[],workers:[],init(){if(n.preloadPlugins||(n.preloadPlugins=[]),Q.initted)return;Q.initted=!0;try{new Blob,Q.hasBlobConstructor=!0}catch(a){Q.hasBlobConstructor=!1,Re("warning: no blob constructor, cannot create blobs with mimetypes")}Q.BlobBuilder=typeof MozBlobBuilder!="undefined"?MozBlobBuilder:typeof WebKitBlobBuilder!="undefined"?WebKitBlobBuilder:Q.hasBlobConstructor?null:Re("warning: no BlobBuilder"),Q.URLObject=typeof window!="undefined"?window.URL?window.URL:window.webkitURL:void 0,!n.noImageDecoding&&typeof Q.URLObject=="undefined"&&(Re("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available."),n.noImageDecoding=!0);let e={};e.canHandle=function(s){return!n.noImageDecoding&&/\.(jpg|jpeg|png|bmp)$/i.test(s)},e.handle=function(s,A,c,u){let d=null;if(Q.hasBlobConstructor)try{d=new Blob([s],{type:Q.getMimetype(A)}),d.size!==s.length&&(d=new Blob([new Uint8Array(s).buffer],{type:Q.getMimetype(A)}))}catch(m){nt(`Blob constructor present but fails: ${m}; falling back to blob builder`)}if(!d){let m=new Q.BlobBuilder;m.append(new Uint8Array(s).buffer),d=m.getBlob()}let h=Q.URLObject.createObjectURL(d);z(typeof h=="string","createObjectURL must return a url as a string");let I=new Image;I.onload=function(){z(I.complete,`Image ${A} could not be decoded`);let y=document.createElement("canvas");y.width=I.width,y.height=I.height,y.getContext("2d").drawImage(I,0,0),n.preloadedImages[A]=y,Q.URLObject.revokeObjectURL(h),c&&c(s)},I.onerror=function(y){Re(`Image ${h} could not be decoded`),u&&u()},I.src=h},n.preloadPlugins.push(e);let t={};t.canHandle=function(s){return!n.noAudioDecoding&&s.substr(-4)in{".ogg":1,".wav":1,".mp3":1}},t.handle=function(s,A,c,u){let d=!1;function h(y){d||(d=!0,n.preloadedAudios[A]=y,c&&c(s))}function I(){d||(d=!0,n.preloadedAudios[A]=new Audio,u&&u())}if(Q.hasBlobConstructor){try{var m=new Blob([s],{type:Q.getMimetype(A)})}catch(U){return I()}let y=Q.URLObject.createObjectURL(m);z(typeof y=="string","createObjectURL must return a url as a string");let v=new Audio;v.addEventListener("canplaythrough",()=>{h(v)},!1),v.onerror=function(G){if(d)return;Re(`warning: browser could not fully decode audio ${A}, trying slower base64 approach`);function R(b){let x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K="=",Y="",Ce=0,ke=0;for(let hr=0;hr<b.length;hr++)for(Ce=Ce<<8|b[hr],ke+=8;ke>=6;){let mu=Ce>>ke-6&63;ke-=6,Y+=x[mu]}return ke==2?(Y+=x[(Ce&3)<<4],Y+=K+K):ke==4&&(Y+=x[(Ce&15)<<2],Y+=K),Y}v.src=`data:audio/x-${A.substr(-3)};base64,${R(s)}`,h(v)},v.src=y,P(()=>{h(v)},1e4)}else return I()},n.preloadPlugins.push(t);function r(){Q.pointerLock=document.pointerLockElement===n.canvas||document.mozPointerLockElement===n.canvas||document.webkitPointerLockElement===n.canvas||document.msPointerLockElement===n.canvas}let{canvas:o}=n},createContext(e,t,r,o){if(t&&n.ctx&&e==n.canvas)return n.ctx;let a,s;if(t){let A={antialias:!1,alpha:!1,majorVersion:typeof WebGL2RenderingContext!="undefined"?2:1};if(o)for(let c in o)A[c]=o[c];typeof w!="undefined"&&(s=w.createContext(e,A),s&&(a=w.getContext(s).GLctx))}else a=e.getContext("2d");return a?(r&&(t||z(typeof S=="undefined","cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),n.ctx=a,t&&w.makeContextCurrent(s),n.useWebGL=t,Q.moduleContextCreatedCallbacks.forEach(A=>{A()}),Q.init()),a):null},destroyContext(e,t,r){},fullscreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullscreen(e,t){Q.lockPointer=e,Q.resizeCanvas=t,typeof Q.lockPointer=="undefined"&&(Q.lockPointer=!0),typeof Q.resizeCanvas=="undefined"&&(Q.resizeCanvas=!1);let{canvas:r}=n;function o(){Q.isFullscreen=!1;let s=r.parentNode;(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===s?(r.exitFullscreen=Q.exitFullscreen,Q.lockPointer&&r.requestPointerLock(),Q.isFullscreen=!0,Q.resizeCanvas?Q.setFullscreenCanvasSize():Q.updateCanvasDimensions(r)):(s.parentNode.insertBefore(r,s),s.parentNode.removeChild(s),Q.resizeCanvas?Q.setWindowedCanvasSize():Q.updateCanvasDimensions(r)),n.onFullScreen&&n.onFullScreen(Q.isFullscreen),n.onFullscreen&&n.onFullscreen(Q.isFullscreen)}Q.fullscreenHandlersInstalled||(Q.fullscreenHandlersInstalled=!0);let a=document.createElement("div");r.parentNode.insertBefore(a,r),a.appendChild(r),a.requestFullscreen=a.requestFullscreen||a.mozRequestFullScreen||a.msRequestFullscreen||(a.webkitRequestFullscreen?function(){a.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}:null)||(a.webkitRequestFullScreen?function(){a.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),a.requestFullscreen()},requestFullScreen(){_("Module.requestFullScreen has been replaced by Module.requestFullscreen (without a capital S)")},exitFullscreen(){return Q.isFullscreen?((document.exitFullscreen||document.cancelFullScreen||document.mozCancelFullScreen||document.msExitFullscreen||document.webkitCancelFullScreen||function(){}).apply(document,[]),!0):!1},nextRAF:0,fakeRequestAnimationFrame(e){let t=Date.now();if(Q.nextRAF===0)Q.nextRAF=t+1e3/60;else for(;t+2>=Q.nextRAF;)Q.nextRAF+=1e3/60;let r=Math.max(Q.nextRAF-t,0);setTimeout(e,r)},requestAnimationFrame(e){if(typeof requestAnimationFrame=="function"){requestAnimationFrame(e);return}let t=Q.fakeRequestAnimationFrame;t(e)},safeSetTimeout(e){return P(e)},safeRequestAnimationFrame(e){return Q.requestAnimationFrame(()=>{ar(e)})},getMimetype(e){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.substr(e.lastIndexOf(".")+1)]},getUserMedia(e){window.getUserMedia||(window.getUserMedia=navigator.getUserMedia||navigator.mozGetUserMedia),window.getUserMedia(e)},getMovementX(e){return e.movementX||e.mozMovementX||e.webkitMovementX||0},getMovementY(e){return e.movementY||e.mozMovementY||e.webkitMovementY||0},getMouseWheelDelta(e){let t=0;switch(e.type){case"DOMMouseScroll":t=e.detail/3;break;case"mousewheel":t=e.wheelDelta/120;break;case"wheel":switch(t=e.deltaY,e.deltaMode){case 0:t/=100;break;case 1:t/=3;break;case 2:t*=80;break;default:throw`unrecognized mouse wheel delta mode: ${e.deltaMode}`}break;default:throw`unrecognized mouse wheel event: ${e.type}`}return t},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent(e){if(Q.pointerLock)e.type!="mousemove"&&"mozMovementX"in e?Q.mouseMovementX=Q.mouseMovementY=0:(Q.mouseMovementX=Q.getMovementX(e),Q.mouseMovementY=Q.getMovementY(e)),typeof SDL!="undefined"?(Q.mouseX=SDL.mouseX+Q.mouseMovementX,Q.mouseY=SDL.mouseY+Q.mouseMovementY):(Q.mouseX+=Q.mouseMovementX,Q.mouseY+=Q.mouseMovementY);else{let t=n.canvas.getBoundingClientRect(),r=n.canvas.width,o=n.canvas.height,a=typeof window.scrollX!="undefined"?window.scrollX:window.pageXOffset,s=typeof window.scrollY!="undefined"?window.scrollY:window.pageYOffset;if(z(typeof a!="undefined"&&typeof s!="undefined","Unable to retrieve scroll position, mouse positions likely broken."),e.type==="touchstart"||e.type==="touchend"||e.type==="touchmove"){let{touch:u}=e;if(u===void 0)return;let d=u.pageX-(a+t.left),h=u.pageY-(s+t.top);d=d*(r/t.width),h=h*(o/t.height);let I={x:d,y:h};if(e.type==="touchstart")Q.lastTouches[u.identifier]=I,Q.touches[u.identifier]=I;else if(e.type==="touchend"||e.type==="touchmove"){let m=Q.touches[u.identifier];m||(m=I),Q.lastTouches[u.identifier]=m,Q.touches[u.identifier]=I}return}let A=e.pageX-(a+t.left),c=e.pageY-(s+t.top);A=A*(r/t.width),c=c*(o/t.height),Q.mouseMovementX=A-Q.mouseX,Q.mouse