(function(){'use strict';const da=["DEBUG","INFO","WARN","ERROR"];var ea="main",fa=null;function ja(a,b,d){if(!(1>a)){var c="EagRuntimeJS: ["+(new Date).toLocaleTimeString()+"]["+ea+"/"+(da[a]||"UNKNOWN")+"] ";a:{if(0<d.length){for(var g=[],h=0;h<d.length;++h){var v=b.indexOf("{}");if(-1!=v)g.push(b.substring(0,v)),g.push(d[h]),b=b.substring(v+2);else break}if(0<g.length){g.push(b);d=g.join("");break a}}d=b}b=c+d;3<=a?console.error(b):console.log(b);fa&&fa(b,3<=a)}}function e(a,...b){ja(1,a,b)}
function ka(a,...b){ja(2,a,b)}function k(a,...b){ja(3,a,b)}function la(a,b){if(b){if(b.message?ja(3,'{}: {} - "{}"',[a,b.name,b.message]):ja(3,"{}: {}",[a,b.name]),"string"===typeof b.stack)for(b=ma(b.stack),a=0;a<b.length;++a)ja(3,"    at "+b[a],[])}else ja(3,"{}: <null>",[a])}function na(a){return function(){k("Unsupported function called: {}.{}",a);return 0}}function D(a,b){a[b]=na(b)}function pa(a){return new Promise(function(b){setTimeout(b,a)})}
class ra{constructor(){this.G=this.o=null;this.u=0}K(){return this.u}push(a){this.G&&(this.G._next=a);this.G=a;this.o||(this.o=a);++this.u}j(){if(this.o){const a=this.o;(this.o=a._next||null)?a._next=null:this.G=null;--this.u;return a}return null}};var sa={},H={},ta={},ua={},xa={},J={},ya={},K={},Aa={},Ba={},Ca={},N={},Da={},Ea={},Ga={},Ha=null,Ia=null,Ja=null,Ka=null,Na=null,Oa=null,Pa=null,Qa=null,O=null,Ra=null,Sa=null,S=null,T=null,Ta=null,Ua=!1,Va=0,Ya=null,Za=!1,$a=null,ab=null,bb=!1;const cb=[];var db=null,eb="_eaglercraftX",fb=!1,hb=!1,ib=!1,jb=!0,kb=!1,lb=!1,mb=!0,nb=!0,ob=!1;
function pb(){"string"===typeof O.localStorageNamespace&&(eb=O.localStorageNamespace);"boolean"===typeof O.openDebugConsoleOnLaunch&&(fb=O.openDebugConsoleOnLaunch);"boolean"===typeof O.fixDebugConsoleUnloadListener&&(hb=O.fixDebugConsoleUnloadListener);"boolean"===typeof O.forceWebViewSupport&&(ib=O.forceWebViewSupport);"boolean"===typeof O.enableWebViewCSP&&(jb=O.enableWebViewCSP);"boolean"===typeof O.forceWebGL1&&(kb=O.forceWebGL1);"boolean"===typeof O.forceWebGL2&&(lb=O.forceWebGL2);"boolean"===
typeof O.allowExperimentalWebGL1&&(mb=O.allowExperimentalWebGL1);"boolean"===typeof O.useWebGLExt&&(nb=O.useWebGLExt);"boolean"===typeof O.useDelayOnSwap&&(ob=O.useDelayOnSwap)}
async function qb(){function a(){try{v=new AudioContext,b(),d()}catch(w){la("Could not initialize audio context",w)}}function b(){if(!I){I=!0;var w=function(){d()};window.addEventListener("keydown",w);S.addEventListener("mousedown",w);S.addEventListener("touchstart",w);S.addEventListener("pointerdown",w);document.addEventListener("visibilitychange",w)}}function d(){if(v&&"suspended"===v.state)try{var w=v.resume();w&&"function"===typeof w.catch&&w.catch(function(){})}catch(C){}}pb();fa=Lb;"yes"!==
window.__isEaglerX188UnloadListenerSet&&(window.onbeforeunload=function(){window.__curEaglerX188UnloadListenerCB&&window.__curEaglerX188UnloadListenerCB();return!1},window.__isEaglerX188UnloadListenerSet="yes");e("Initializing EagRuntime JS context...");await Mb();Nb();Ob();Pb();Qb();Rb();Sb();D(Ga,"sendPacket");D(Ga,"getAvailablePackets");D(Ga,"getNextPacket");D(Ga,"setCrashCallback");D(Ga,"isTabAboutToClose");Sa.classList.add("_eaglercraftX_root_element");Sa.style.overflow="hidden";for(var c=null,
g;g=Sa.lastChild;)c||=g,Sa.removeChild(g);S=document.createElement("div");S.classList.add("_eaglercraftX_wrapper_element");S.style.position="relative";S.style.width="100%";S.style.height="100%";S.style.overflow="hidden";S.style.backgroundColor="black";Sa.appendChild(S);c&&(c.style.position="absolute",c.style.top="0px",c.style.left="0px",c.style.right="0px",c.style.bottom="0px",c.style.zIndex="2",c.classList.add("_eaglercraftX_early_splash_element"),S.appendChild(c));await pa(10);g=window.devicePixelRatio;
c=g*S.clientWidth|0;g=g*S.clientHeight|0;e("Initializing audio context");if("function"===typeof document.exitPointerLock){var h=navigator.userAgent;null!==h?(h=h.toLowerCase(),Za=-1!==h.indexOf("mobi")||-1!==h.indexOf("tablet")):Za=!1}else Za=!0;var v=null,I=!1;!Za&&navigator.userActivation&&navigator.userActivation.hasBeenActive?a():(h=document.createElement("div"),h.classList.add("_eaglercraftX_press_any_key_image"),h.style.position="absolute",h.style.top="0px",h.style.left="0px",h.style.right=
"0px",h.style.bottom="0px",h.style.width="100%",h.style.height="100%",h.style.zIndex="3",h.style.touchAction="pan-x pan-y",h.style.background='center / contain no-repeat url("'+Oa+'"), left / 1000000% 100% no-repeat url("'+Oa+'") white',h.style.setProperty("image-rendering","pixelated"),S.appendChild(h),await new Promise(function(w,C){function E(){if(!P){P=!0;Za?S.removeChild(Q):(window.removeEventListener("keydown",E),S.removeEventListener("mousedown",E),S.removeEventListener("touchstart",E));try{a()}catch(t){C(t);
return}w()}}var P=!1;if(Za){var Q=document.createElement("div");Q.classList.add("_eaglercraftX_mobile_press_any_key");Q.setAttribute("style","position:absolute;background-color:white;font-family:sans-serif;top:10%;left:10%;right:10%;bottom:10%;border:5px double black;padding:calc(5px + 7vh) 15px;text-align:center;font-size:20px;user-select:none;z-index:10;");Q.innerHTML='<h3 style="margin-block-start:0px;margin-block-end:0px;margin:20px 5px;">Mobile Browser Detected</h3><p style="margin-block-start:0px;margin-block-end:0px;margin:20px 5px;">Warning: EaglercraftX WASM-GC requires a lot of memory and may not be stable on most mobile devices!</p><p style="margin-block-start:0px;margin-block-end:0px;margin:20px 2px;"><button style="font: 24px sans-serif;font-weight:bold;" class="_eaglercraftX_mobile_launch_client">Launch EaglercraftX</button></p><p style="margin-block-start:0px;margin-block-end:0px;margin:25px 5px;">(Tablets and phones with large screens work best)</p>';
Q.querySelector("._eaglercraftX_mobile_launch_client").addEventListener("click",E);S.appendChild(Q)}else window.addEventListener("keydown",E),S.addEventListener("mousedown",E),S.addEventListener("touchstart",E)}),S.removeChild(h));v?(d(),Tb(v)):Ub();e("Creating main canvas");T=document.createElement("canvas");T.classList.add("_eaglercraftX_canvas_element");T.style.width="100%";T.style.height="100%";T.style.zIndex="1";T.style.touchAction="pan-x pan-y";T.style.setProperty("-webkit-touch-callout","none");
T.style.setProperty("-webkit-tap-highlight-color","rgba(255, 255, 255, 0)");T.style.setProperty("image-rendering","pixelated");T.width=c;T.height=g;S.appendChild(T);await Vb();e("Creating WebGL context");S.addEventListener("webglcontextcreationerror",function(w){k("[WebGL Error]: {}",w.statusMessage)});c={antialias:!1,depth:!1,powerPreference:"high-performance",desynchronized:!0,preserveDrawingBuffer:!1,premultipliedAlpha:!1,alpha:!1};h=!1;if(lb){e("Note: Forcing WebGL 2.0 context");g=300;var x=T.getContext("webgl2",
c);if(!x)return Wb("WebGL 2.0 is not supported on this device!"),!1}else if(kb){if(e("Note: Forcing WebGL 1.0 context"),g=200,x=T.getContext("webgl",c),!x)if(mb){if(h=!0,x=T.getContext("experimental-webgl",c),!x)return Wb("WebGL is not supported on this device!"),!1}else return Wb("WebGL is not supported on this device!"),!1}else if(g=300,x=T.getContext("webgl2",c),!x&&(g=200,x=T.getContext("webgl",c),!x))if(mb){if(h=!0,x=T.getContext("experimental-webgl",c),!x)return Wb("WebGL is not supported on this device!"),
!1}else return Wb("WebGL is not supported on this device!"),!1;h&&alert('WARNING: Detected "experimental" WebGL 1.0 support, certain graphics API features may be missing, and therefore EaglercraftX may malfunction and crash!');Va=g;Ta=x;Ua=h;Xb(x,g);e("OpenGL Version: {}",K.glGetString(7938));e("OpenGL Renderer: {}",K.glGetString(7937));c=K.dumpActiveExtensions();if(0===c.length)e("Unlocked the following OpenGL ES extensions: (NONE)");else for(c.sort(),e("Unlocked the following OpenGL ES extensions:"),
g=0;g<c.length;++g)e(" - {}",c[g]);K.glClearColor(0,0,0,1);K.glClear(16384);await pa(20);e("EagRuntime JS context initialization complete");return!0}
async function Yb(){pb();fa=function(a,b){postMessage({ch:"~!LOGGER",txt:a,err:b})};e("Initializing EagRuntime worker JS context...");await Mb();D(H,"setClipboard");D(H,"getClipboard");D(H,"displayFileChooser");D(H,"fileChooserHasResult");D(H,"getFileChooserResult");D(H,"clearFileChooserResult");D(H,"downloadFileWithNameU8");D(H,"downloadFileWithNameA");D(H,"downloadScreenshot");D(H,"showDebugConsole");D(H,"addLogMessage");D(H,"isShowingDebugConsole");D(H,"getFaviconURL");Ub();D(J,"keyboardLayoutSupported");
D(J,"iterateKeyboardLayout");D(J,"updateCanvasSize");D(J,"updatePlatformAndSleep");D(J,"isVSyncSupported");D(J,"mouseSetGrabbed");D(J,"isMouseGrabSupported");D(J,"isMouseGrabbed");D(J,"isPointerLocked");D(J,"supportsFullscreen");D(J,"toggleFullscreen");D(J,"isFullscreen");D(J,"touchSetOpenKeyboardZone");D(J,"touchCloseDeviceKeyboard");D(J,"touchIsDeviceKeyboardOpenMAYBE");D(J,"gamepadSupported");D(J,"isVisualViewport");D(K,"getCapBits");D(K,"glEnable");D(K,"glDisable");D(K,"glClearColor");D(K,"glClearDepth");
D(K,"glClear");D(K,"glDepthFunc");D(K,"glDepthMask");D(K,"glCullFace");D(K,"glViewport");D(K,"glBlendFunc");D(K,"glBlendFuncSeparate");D(K,"glBlendEquation");D(K,"glBlendColor");D(K,"glColorMask");D(K,"glDrawBuffers");D(K,"glReadBuffer");D(K,"glReadPixels");D(K,"glPolygonOffset");D(K,"glLineWidth");D(K,"glGenBuffers");D(K,"glGenTextures");D(K,"glCreateProgram");D(K,"glCreateShader");D(K,"glCreateFramebuffer");D(K,"glCreateRenderbuffer");D(K,"glGenQueries");D(K,"glDeleteBuffers");D(K,"glDeleteTextures");
D(K,"glDeleteProgram");D(K,"glDeleteShader");D(K,"glDeleteFramebuffer");D(K,"glDeleteRenderbuffer");D(K,"glDeleteQueries");D(K,"glBindBuffer");D(K,"glBufferData");D(K,"glBufferSubData");D(K,"glEnableVertexAttribArray");D(K,"glDisableVertexAttribArray");D(K,"glVertexAttribPointer");D(K,"glActiveTexture");D(K,"glBindTexture");D(K,"glTexParameterf");D(K,"glTexParameteri");D(K,"glTexImage3D");D(K,"glTexImage2D");D(K,"glTexSubImage2D");D(K,"glCopyTexSubImage2D");D(K,"glTexStorage2D");D(K,"glPixelStorei");
D(K,"glGenerateMipmap");D(K,"glShaderSource");D(K,"glCompileShader");D(K,"glGetShaderi");D(K,"glGetShaderInfoLog");D(K,"glUseProgram");D(K,"glAttachShader");D(K,"glDetachShader");D(K,"glLinkProgram");D(K,"glGetProgrami");D(K,"glGetProgramInfoLog");D(K,"glDrawArrays");D(K,"glDrawElements");D(K,"glBindAttribLocation");D(K,"glGetAttribLocation");D(K,"glGetUniformLocation");D(K,"glGetUniformBlockIndex");D(K,"glBindBufferRange");D(K,"glUniformBlockBinding");D(K,"glUniform1f");D(K,"glUniform2f");D(K,"glUniform3f");
D(K,"glUniform4f");D(K,"glUniform1i");D(K,"glUniform2i");D(K,"glUniform3i");D(K,"glUniform4i");D(K,"glUniformMatrix2fv");D(K,"glUniformMatrix3fv");D(K,"glUniformMatrix4fv");D(K,"glUniformMatrix3x2fv");D(K,"glUniformMatrix4x2fv");D(K,"glUniformMatrix4x3fv");D(K,"glBindFramebuffer");D(K,"glCheckFramebufferStatus");D(K,"glBlitFramebuffer");D(K,"glRenderbufferStorage");D(K,"glFramebufferTexture2D");D(K,"glFramebufferTextureLayer");D(K,"glBindRenderbuffer");D(K,"glFramebufferRenderbuffer");D(K,"glGetInteger");
D(K,"glGetError");D(K,"getAllExtensions");D(K,"dumpActiveExtensions");D(K,"glGetString");D(K,"glGenVertexArrays");D(K,"glDeleteVertexArrays");D(K,"glBindVertexArray");D(K,"glVertexAttribDivisor");D(K,"glDrawArraysInstanced");D(K,"glDrawElementsInstanced");D(K,"isContextLost");D(Ba,"getMic");D(Ba,"setDataAvailableHandler");D(Ba,"setClipDataHandler");D(Ba,"stopClipDataHandler");D(Ba,"resetClipData");D(Ba,"getClipChunkCount");D(Ba,"exportClip");D(Ca,"isSupported");D(Ca,"createRTCPeerConnection");D(N,
"supported");D(N,"clientLANReadyState");D(N,"clientLANCloseConnection");D(N,"clientLANSendPacket");D(N,"clientLANReadPacket");D(N,"clientLANAvailable");D(N,"clientLANSetICEServersAndConnect");D(N,"clearLANClientState");D(N,"clientLANAwaitICECandidate");D(N,"clientLANAwaitDescription");D(N,"clientLANAwaitChannel");D(N,"clientLANClosed");D(N,"clientLANSetICECandidate");D(N,"clientLANSetDescription");D(N,"clientLANClosed");D(N,"serverLANInitializeServer");D(N,"serverLANCloseServer");D(N,"serverLANCreatePeer");
D(Da,"checkSupported");D(Da,"checkCSPSupported");D(Da,"sendStringMessage");D(Da,"sendBinaryMessage");D(Da,"beginShowing");D(Da,"resize");D(Da,"endShowing");D(Ea,"startIntegratedServer");D(Ea,"sendPacket");D(Ea,"getAvailablePackets");D(Ea,"getNextPacket");D(Ea,"killWorker");D(Ea,"showCrashReportOverlay");D(Ea,"hideCrashReportOverlay");Zb();e("EagRuntime worker JS context initialization complete")}
function $b(a){Ya=a.buffer;e("WebAssembly direct memory resized to {} MiB",.01*(Ya.byteLength/1024/10.24|0));new Uint8Array(Ya);new Int8Array(Ya);new Uint16Array(Ya);new Int16Array(Ya);new Uint32Array(Ya);new Int32Array(Ya);new Float32Array(Ya)}const ac=new ra;function W(a,b,d){ac.push({eventType:a<<5|b,eventObj:d,_next:null})}let bc=/.+:wasm-function\[[0-9]+]:0x([0-9a-f]+).*/;
function ma(a){if(!a)return null;const b=[];for(let d of a.split("\n")){if(Ka&&(a=bc.exec(d),null!==a&&2<=a.length&&(a=parseInt(a[1],16),!isNaN(a))))try{const c=Ka([a]);if(0<c.length){for(let g of c)b.push(""+g.className+"."+g.method+"("+g.file+":"+g.line+")");continue}}catch(c){}d=d.trim();d.startsWith("at ")&&(d=d.substring(3));b.push(d)}return b}
function cc(a){const b=a?ma(a.stack):null;a="Native Browser Exception\n----------------------------------\n  Line: "+(a&&"string"===typeof a.fileName?a.fileName:"unknown")+":"+(a&&"number"===typeof a.lineNumber?a.lineNumber:"unknown")+":"+(a&&"number"===typeof a.columnNumber?a.columnNumber:"unknown")+"\n  Type: "+(a&&"string"===typeof a.name?a.name:"unknown")+"\n  Desc: "+(a&&"string"===typeof a.message?a.message:"null")+"\n----------------------------------\n\nDeobfuscated stack trace:\n    at "+
(b?b.join("\n    at "):"null")+"\n\nThis exception was not handled by the WASM binary\n";if("undefined"!==typeof window)dc(a,!0);else if(ec){k("\n{}",a);try{ec(a,!0)}catch(d){console.log(d)}}else k("\n{}",a)}
function dc(a,b){k("Game crashed!");var d="Game Crashed! I have fallen and I can't get up!\n\n"+a+"\n\n",c='eaglercraft.version = "'+cb[0]+'"\neaglercraft.minecraft = "'+cb[2]+'"\neaglercraft.brand = "'+cb[1]+'"\n\n'+fc()+"\nwindow.eaglercraftXOpts = "+JSON.stringify(O)+"\n\ncurrentTime = "+(new Date).toLocaleString()+"\n\n"+gc("userAgent")+gc("vendor")+gc("language")+gc("hardwareConcurrency")+gc("deviceMemory")+gc("platform")+gc("product")+hc()+"\n"+ic("localStorage")+ic("sessionStorage")+ic("indexedDB")+
"\nrootElement.clientWidth = "+(S?S.clientWidth:"undefined")+"\nrootElement.clientHeight = "+(S?S.clientHeight:"undefined")+"\n"+ic("innerWidth")+ic("innerHeight")+ic("outerWidth")+ic("outerHeight")+ic("devicePixelRatio")+jc("availWidth")+jc("availHeight")+jc("colorDepth")+jc("pixelDepth")+"\n"+kc()+"\n",g=d+c;const h=[];try{"object"===typeof O&&"object"===typeof O.hooks&&"function"===typeof O.hooks.crashReportShow&&O.hooks.crashReportShow(g,function(v){h.push(v)})}catch(v){la("Uncaught exception invoking crash report hook",
v)}if(bb){k("");k("An additional crash report was supressed:");g=a.split(/[\r\n]+/);for(a=0;a<g.length;++a)k("  {}",g[a]);if(0<h.length)for(a=0;a<h.length;++a)if(g=h[a]){k("");k("  ----------[ CRASH HOOK ]----------");g=g.split(/[\r\n]+/);for(a=0;a<g.length;++a)k("  {}",g[a]);k("  ----------------------------------")}}else{bb=!0;if(0<h.length){g=d+"Got the following messages from the crash report hook registered in eaglercraftXOpts:\n\n";for(a=0;a<h.length;++a)g+="----------[ CRASH HOOK ]----------\n"+
h[a]+"\n----------------------------------\n\n";g+=c}(c=S||Sa)?(b&&k("\n{}",g),b=document.createElement("img"),a=document.createElement("div"),b.setAttribute("style","z-index:100;position:absolute;top:10px;left:calc(50% - 151px);"),b.src=Pa,a.setAttribute("style","z-index:100;position:absolute;top:135px;left:10%;right:10%;bottom:50px;background-color:white;border:1px solid #cccccc;overflow-x:hidden;overflow-y:scroll;overflow-wrap:break-word;white-space:pre-wrap;font: 14px monospace;padding:10px;"),
a.classList.add("_eaglercraftX_crash_element"),c.appendChild(b),c.appendChild(a),a.appendChild(document.createTextNode(g)),db&&db(),window.__curEaglerX188UnloadListenerCB=null):(alert("Root element not found, crash report was printed to console"),k("\n{}",g))}}
function Wb(a){if(!bb){bb=!0;var b=S||Sa;k("Compatibility error: {}",a);if(b){var d=document.createElement("img"),c=document.createElement("div");d.setAttribute("style","z-index:100;position:absolute;top:10px;left:calc(50% - 151px);");d.src=Pa;c.setAttribute("style","z-index:100;position:absolute;top:135px;left:10%;right:10%;bottom:50px;background-color:white;border:1px solid #cccccc;overflow-x:hidden;overflow-y:scroll;font:18px sans-serif;padding:40px;");c.classList.add("_eaglercraftX_incompatible_element");
b.appendChild(d);b.appendChild(c);c.innerHTML='<h2><svg style="vertical-align:middle;margin:0px 16px 8px 8px;" xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="none"><path stroke="#000000" stroke-width="3" stroke-linecap="square" d="M1.5 8.5v34h45v-28m-3-3h-10v-3m-3-3h-10m15 6h-18v-3m-3-3h-10"/><path stroke="#000000" stroke-width="2" stroke-linecap="square" d="M12 21h0m0 4h0m4 0h0m0-4h0m-2 2h0m20-2h0m0 4h0m4 0h0m0-4h0m-2 2h0"/><path stroke="#000000" stroke-width="2" stroke-linecap="square" d="M20 30h0 m2 2h0 m2 2h0 m2 2h0 m2 -2h0 m2 -2h0 m2 -2h0"/></svg>+ This device is incompatible with Eaglercraft&ensp;:(</h2><div style="margin-left:40px;"><p style="font-size:1.2em;"><b style="font-size:1.1em;">Issue:</b> <span style="color:#BB0000;" id="_eaglercraftX_crashReason"></span><br /></p><p style="margin-left:10px;font:0.9em monospace;" id="_eaglercraftX_crashUserAgent"></p><p style="margin-left:10px;font:0.9em monospace;" id="_eaglercraftX_crashWebGL"></p><p style="margin-left:10px;font:0.9em monospace;">Current Date: '+
(new Date).toLocaleString()+'</p><p><br /><span style="font-size:1.1em;border-bottom:1px dashed #AAAAAA;padding-bottom:5px;">Things you can try:</span></p><ol><li><span style="font-weight:bold;">Just try using Eaglercraft on a different device</span>, it isn\'t a bug it\'s common sense</li><li style="margin-top:7px;">If this screen just appeared randomly, try restarting your browser or device</li><li style="margin-top:7px;">If you are not using Chrome/Edge, try installing the latest Google Chrome</li><li style="margin-top:7px;">If your browser is out of date, please update it to the latest version</li></ol></div>';
c.querySelector("#_eaglercraftX_crashReason").appendChild(document.createTextNode(a));try{var g=window.navigator.userAgent}catch(v){g="<error>"}c.querySelector("#_eaglercraftX_crashUserAgent").appendChild(document.createTextNode(g));db&&db();window.__curEaglerX188UnloadListenerCB=null;a="No GL_RENDERER string could be queried";try{const v=document.createElement("canvas");v.width=64;v.height=64;const I=v.getContext("webgl");if(I){if(I.getExtension("WEBGL_debug_renderer_info"))var h=I.getParameter(37446);
else(h=I.getParameter(WebGLRenderingContext.RENDERER))&&(h+=" [masked]");h&&(a=h)}}catch(v){}c.querySelector("#_eaglercraftX_crashWebGL").appendChild(document.createTextNode(a))}else alert("Compatibility error: "+a)}}var lc=null;
function fc(){if(lc)return lc;try{var a=Ta,b=Ua;if(!a){b=!1;var d=document.createElement("canvas");d.width=64;d.height=64;a=d.getContext("webgl2");a||(a=d.getContext("webgl"),a||(b=!0,a=d.getContext("experimental-webgl")))}return a?(d="",0<Va&&(d+="webgl.version = "+a.getParameter(7938)+"\n"),d=a.getExtension("WEBGL_debug_renderer_info")?d+("webgl.renderer = "+a.getParameter(37446)+"\nwebgl.vendor = "+a.getParameter(37445)+"\n"):d+("webgl.renderer = "+a.getParameter(7937)+" [masked]\nwebgl.vendor = "+
a.getParameter(7936)+" [masked]\n"),0<Va?(d+="\nwebgl.version.id = "+Va+"\nwebgl.experimental = "+b,200===Va?d+="\nwebgl.ext.ANGLE_instanced_arrays = "+!!a.getExtension("ANGLE_instanced_arrays")+"\nwebgl.ext.EXT_color_buffer_half_float = "+!!a.getExtension("EXT_color_buffer_half_float")+"\nwebgl.ext.EXT_shader_texture_lod = "+!!a.getExtension("EXT_shader_texture_lod")+"\nwebgl.ext.OES_fbo_render_mipmap = "+!!a.getExtension("OES_fbo_render_mipmap")+"\nwebgl.ext.OES_texture_float = "+!!a.getExtension("OES_texture_float")+
"\nwebgl.ext.OES_texture_half_float = "+!!a.getExtension("OES_texture_half_float")+"\nwebgl.ext.OES_texture_half_float_linear = "+!!a.getExtension("OES_texture_half_float_linear"):300<=Va&&(d+="\nwebgl.ext.EXT_color_buffer_float = "+!!a.getExtension("EXT_color_buffer_float")+"\nwebgl.ext.EXT_color_buffer_half_float = "+!!a.getExtension("EXT_color_buffer_half_float")+"\nwebgl.ext.OES_texture_float_linear = "+!!a.getExtension("OES_texture_float_linear")),d+="\nwebgl.ext.EXT_texture_filter_anisotropic = "+
!!a.getExtension("EXT_texture_filter_anisotropic")+"\n"):d+="webgl.ext.ANGLE_instanced_arrays = "+!!a.getExtension("ANGLE_instanced_arrays")+"\nwebgl.ext.EXT_color_buffer_float = "+!!a.getExtension("EXT_color_buffer_float")+"\nwebgl.ext.EXT_color_buffer_half_float = "+!!a.getExtension("EXT_color_buffer_half_float")+"\nwebgl.ext.EXT_shader_texture_lod = "+!!a.getExtension("EXT_shader_texture_lod")+"\nwebgl.ext.OES_fbo_render_mipmap = "+!!a.getExtension("OES_fbo_render_mipmap")+"\nwebgl.ext.OES_texture_float = "+
!!a.getExtension("OES_texture_float")+"\nwebgl.ext.OES_texture_float_linear = "+!!a.getExtension("OES_texture_float_linear")+"\nwebgl.ext.OES_texture_half_float = "+!!a.getExtension("OES_texture_half_float")+"\nwebgl.ext.OES_texture_half_float_linear = "+!!a.getExtension("OES_texture_half_float_linear")+"\nwebgl.ext.EXT_texture_filter_anisotropic = "+!!a.getExtension("EXT_texture_filter_anisotropic")+"\n",lc=d):lc="Failed to query GPU info!\n"}catch(c){return lc="ERROR: could not query webgl info - "+
c+"\n"}}function gc(a){try{var b=window.navigator[a]}catch(d){b="<error>"}return"window.navigator."+a+" = "+b+"\n"}function hc(){try{var a=[];if("object"===typeof navigator.plugins){var b=navigator.plugins.length;if(0<b)for(var d=0;d<b;++d){var c=navigator.plugins[d];a.push({name:c.name,filename:c.filename,desc:c.description})}}var g=JSON.stringify(a)}catch(h){g="<error>"}return"window.navigator.plugins = "+g+"\n"}
function jc(a){try{var b=window.screen[a]}catch(d){b="<error>"}return"window.screen."+a+" = "+b+"\n"}function kc(){try{var a=window.location.href}catch(b){a="<error>"}return"window.location.href = "+a+"\n"}function ic(a){try{var b=window[a]}catch(d){b="<error>"}return"window."+a+" = "+b+"\n"};function mc(a,b,d){const c=document.createElement("a");c.style.position="absolute";c.style.left="0px";c.style.top="0px";c.style.zIndex="-100";c.style.color="transparent";c.innerText="Download File";c.href=b;c.target="_blank";c.download=a;S.appendChild(c);setTimeout(function(){c.click();setTimeout(function(){S.removeChild(c)},50);d&&setTimeout(d,6E4)},50)}var nc=0,oc=null,pc=null,qc=null,rc=null;
function Lb(a,b){if(qc)rc&&rc(a,b);else for(a={msg:a,err:b,next:null},pc&&(pc.next=a),oc||=a,pc=a,++nc;256<nc;)--nc,oc&&=oc.next}
function Nb(){function a(q){let p=!1;try{const y=document.createElement("textarea");y.value=q;y.setAttribute("readonly","readonly");y.style.position="fixed";y.style.left="-10000px";y.style.top="0";y.style.opacity="0";document.body.appendChild(y);y.focus();y.select();p=document.execCommand("copy");document.body.removeChild(y)}catch(y){}return!!p}function b(){x=!1;w=null;null!==E?(S.removeChild(E),C=E=null):null!==C&&(S.removeChild(C),C=null)}function d(q){try{window.localStorage&&window.localStorage.setItem(m,
q?"true":"false")}catch(p){}}function c(){try{if(window.localStorage){const q=window.localStorage.getItem(m);return q&&"true"===q.toLowerCase()}return!1}catch(q){return!1}}function g(){if(qc)qc.focus();else{var q=Math.round(1E3*window.devicePixelRatio);const p=Math.round(400*window.devicePixelRatio);if(qc=window.open("","_blank","top="+Math.round((window.screen.height-p)/2)+",left="+Math.round((window.screen.width-q)/2)+",width="+q+",height="+p+",menubar=0,status=0,titlebar=0,toolbar=0")){qc.focus();
P=qc.document;P.write('<!DOCTYPE html><html><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Debug Console</title><link type="image/png" rel="shortcut icon" href="'+Qa+'" /></head><body style="overflow-x:hidden;overflow-y:scroll;padding:0px;"><p id="loggerMessageContainer" style="overflow-wrap:break-word;white-space:pre-wrap;font:14px monospace;padding:10px;"></p></body></html>');P.close();Q=P.body;t=P.getElementById("loggerMessageContainer");
for(q=oc;q;)h(q.msg+"\n",q.err?"#DD0000":"#000000"),q=q.next;pc=oc=null;nc=0;v();q=()=>{null!=qc&&(qc=null,d(!1))};qc.addEventListener("beforeunload",q);qc.addEventListener("unload",q)}else k("Logger popup was blocked!"),window.alert("ERROR: Popup blocked!\n\nPlease make sure you have popups enabled for this site!")}}function h(q,p){var y=P.createElement("span");y.innerText=q;y.style.color=p;t.appendChild(y);for(q=t.children;2048<q.length;)q[0].remove()}function v(){setTimeout(()=>{qc.scrollTo(0,
Q.scrollHeight||Q.clientHeight)},1)}let I="";H.setClipboard=function(q){I=q;try{if(a(q))return!0;if(window.navigator.clipboard&&window.isSecureContext)return window.navigator.clipboard.writeText(q).then(function(){I=q}).catch(function(){k("Clipboard API write failed!")}),!0}catch(p){k("Failed to set clipboard data!")}return!1};H.getClipboard=new WebAssembly.Suspending(async function(){var q=null;try{window.navigator.clipboard&&window.isSecureContext&&(q=await navigator.clipboard.readText())}catch(p){k("Failed to read clipboard data!")}(null===
q||void 0===q||0===q.length)&&0<I.length&&(q=I);return q});var x=!1,w=null,C=null,E=null;H.displayFileChooser=function(q,p){b();if(Za){const f=E=document.createElement("div");f.classList.add("_eaglercraftX_mobile_file_chooser_popup");f.style.position="absolute";f.style.backgroundColor="white";f.style.fontFamily="sans-serif";f.style.top="10%";f.style.left="10%";f.style.right="10%";f.style.border="5px double black";f.style.padding="15px";f.style.textAlign="left";f.style.fontSize="20px";f.style.userSelect=
"none";f.style.zIndex="150";var y=document.createElement("h3");y.appendChild(document.createTextNode("File Chooser"));f.appendChild(y);y=document.createElement("p");const u=C=document.createElement("input");u.type="file";u.accept=null===q?"."+p:q;u.multiple=!1;y.appendChild(u);f.appendChild(y);q=document.createElement("p");p=document.createElement("button");p.classList.add("_eaglercraftX_mobile_file_chooser_btn_cancel");p.style.fontSize="1.0em";p.addEventListener("click",function(){E===f&&(S.removeChild(f),
C=E=null)});p.appendChild(document.createTextNode("Cancel"));q.appendChild(p);q.appendChild(document.createTextNode(" "));p=document.createElement("button");p.classList.add("_eaglercraftX_mobile_file_chooser_btn_done");p.style.fontSize="1.0em";p.style.fontWeight="bold";p.addEventListener("click",function(){if(E===f){if(0<u.files.length){const A=u.files[0];A.arrayBuffer().then(function(F){x=!0;w={fileName:A.name,fileData:F}}).catch(function(){x=!0;w=null})}else x=!0,w=null;S.removeChild(f);C=E=null}});
p.appendChild(document.createTextNode("Done"));q.appendChild(p);f.appendChild(q);S.appendChild(f)}else{const f=C=document.createElement("input");f.type="file";f.style.position="absolute";f.style.left="0px";f.style.top="0px";f.style.zIndex="-100";f.accept=null===q?"."+p:q;f.multiple=!1;f.addEventListener("change",function(){if(C===f){if(0<f.files.length){const u=f.files[0];u.arrayBuffer().then(function(A){x=!0;w={fileName:u.name,fileData:A}}).catch(function(){x=!0;w=null})}else x=!0,w=null;S.removeChild(f);
C=null}});S.appendChild(f);window.setTimeout(function(){f.click()},50)}};H.fileChooserHasResult=function(){return x};H.getFileChooserResult=function(){x=!1;const q=w;w=null;return q};H.clearFileChooserResult=b;H.downloadFileWithNameU8=function(q,p){const y=URL.createObjectURL(new Blob([p],{type:"application/octet-stream"}));mc(q,y,function(){URL.revokeObjectURL(y)})};H.downloadFileWithNameA=function(q,p){const y=URL.createObjectURL(new Blob([p],{type:"application/octet-stream"}));mc(q,y,function(){URL.revokeObjectURL(y)})};
H.downloadScreenshot=function(q,p){mc(q,p.toDataURL("image/png"),null)};var P=null,Q=null,t=null;const m=eb+"showDebugConsole",z=hb?"beforeunload":"unload";try{window.addEventListener(z,()=>{if(qc){var q=qc;t=Q=P=qc=null;q.close()}})}catch(q){}(fb||c())&&g();rc=function(q,p){var y=qc.innerHeight+qc.pageYOffset>=Q.offsetHeight;h(q+"\n",p?"#DD0000":"#000000");y&&v()};H.showDebugConsole=function(){d(!0);g()};H.addLogMessage=Lb;H.isShowingDebugConsole=function(){return!!qc};H.getFaviconURL=function(){return Qa}}
;ta.getEPKFileData=function(a){const b=Na[a];Na[a]=null;return b};ta.getEPKFileCount=function(){return Na.length};
if("undefined"!==typeof window){ta.loadImageFile0=new WebAssembly.Suspending(function(a,b){return new Promise(function(d){const c=URL.createObjectURL(new Blob([a],{type:b}));if(c){const g=document.createElement("img");g.addEventListener("load",function(){URL.revokeObjectURL(c);d({width:g.width,height:g.height,img:g})});g.addEventListener("error",function(){URL.revokeObjectURL(c);d(null)});g.src=c}else d(null)})});var sc=null,tc=null;ta.loadImageFile1=function(a,b){const d=a.width,c=a.height;if(a=
a.img)sc||=document.createElement("canvas"),sc.width<d&&(sc.width=d),sc.height<c&&(sc.height=c),tc||(tc=sc.getContext("2d",{willReadFrequently:!0}),tc.imageSmoothingEnabled=!1),tc.clearRect(0,0,d,c),tc.drawImage(a,0,0,d,c),b.set(tc.getImageData(0,0,d,c).data,0)}}else D(ta,"loadImageFile0"),D(ta,"loadImageFile1");function Tb(a){ua.getContext=function(){return a};ua.registerIsEndedHandler=function(b,d){d.selfEndHandler||(d.selfEndHandler=function(){d.isEnded=!0});b.addEventListener("ended",d.selfEndHandler)};ua.releaseIsEndedHandler=function(b,d){d.selfEndHandler&&b.removeEventListener("ended",d.selfEndHandler)};ua.decodeAudioBrowser=new WebAssembly.Suspending(function(b,d){return new Promise(function(c){const g=new Uint8Array(b.length);g.set(b,0);a.decodeAudioData(g.buffer,c,function(){k("Failed to load audio: {}",
d);c(null)})})})}function Ub(){ua.getContext=function(){return null};D(ua,"registerIsEndedHandler");D(ua,"releaseIsEndedHandler");D(ua,"decodeAudioBrowser")};function uc(a){return"string"===typeof a?a:"undefined"===typeof a?null:"string"===typeof a[0]?a[0]:null}function vc(a){return"undefined"===typeof a?null:"undefined"===typeof a.data?null:a.data}
xa.openDB=new WebAssembly.Suspending(function(a){return new Promise(function(b){if("undefined"===typeof indexedDB)b({failedInit:!0,failedLocked:!1,failedError:"IndexedDB not supported",database:null});else{try{var d=indexedDB.open(a,1)}catch(g){b({failedInit:!0,failedLocked:!1,failedError:"Exception opening database",database:null});return}var c=b;d.addEventListener("success",function(){c&&c({failedInit:!1,failedLocked:!1,failedError:null,database:d.result});c=null});d.addEventListener("blocked",
function(){c&&c({failedInit:!1,failedLocked:!0,failedError:"Database is locked",database:null});c=null});d.addEventListener("error",function(){c&&c({failedInit:!0,failedLocked:!1,failedError:"Opening database failed",database:null});c=null});d.addEventListener("upgradeneeded",function(){d.result.createObjectStore("filesystem",{keyPath:["path"]})})}})});
function wc(a,b){return new Promise(function(d){const c=a.transaction("filesystem","readwrite").objectStore("filesystem").delete([b]);c.addEventListener("success",function(){d(!0)});c.addEventListener("error",function(){d(!1)})})}xa.eaglerDelete=new WebAssembly.Suspending(wc);
function xc(a,b){return new Promise(function(d){const c=a.transaction("filesystem","readonly").objectStore("filesystem").get([b]);c.addEventListener("success",function(){d(vc(c.result))});c.addEventListener("error",function(){d(null)})})}xa.eaglerRead=new WebAssembly.Suspending(xc);
function yc(a,b,d){return new Promise(function(c){const g=a.transaction("filesystem","readwrite").objectStore("filesystem").put({path:b,data:d});g.addEventListener("success",function(){c(!0)});g.addEventListener("error",function(){c(!1)})})}xa.eaglerWrite=new WebAssembly.Suspending(yc);
xa.eaglerExists=new WebAssembly.Suspending(function(a,b){return new Promise(function(d){const c=a.transaction("filesystem","readonly").objectStore("filesystem").count([b]);c.addEventListener("success",function(){d(0<c.result)});c.addEventListener("error",function(){d(!1)})})});xa.eaglerMove=new WebAssembly.Suspending(async function(a,b,d){const c=await xc(a,b);return c&&await yc(a,d,c)?await wc(a,b):!1});
xa.eaglerCopy=new WebAssembly.Suspending(async function(a,b,d){return(b=await xc(a,b))&&await yc(a,d,b)});xa.eaglerSize=new WebAssembly.Suspending(function(a,b){return new Promise(function(d){const c=a.transaction("filesystem","readonly").objectStore("filesystem").get([b]);c.addEventListener("success",function(){const g=vc(c.result);d(g?g.byteLength:-1)});c.addEventListener("error",function(){d(-1)})})});
function zc(a){if(0===a.length)return-1;for(var b=0,d=0,c=a.length;d<c;++d)47===a.charCodeAt(d)&&++b;return b}
xa.eaglerIterate=new WebAssembly.Suspending(function(a,b,d){return new Promise(function(c){const g=[],h=a.transaction("filesystem","readonly").objectStore("filesystem").openCursor(),v=0===b.length,I=d?-1:zc(b);h.addEventListener("success",function(){const x=h.result;if(null===x||null===x.key)c({length:g.length,getRow:function(C){return g[C]}});else{var w=uc(x.key);null!=w&&(!v&&!w.startsWith(b)||!d&&zc(w)!==I||g.push(w));x.continue()}});h.addEventListener("error",function(){c(null)})})});async function Vb(){function a(){var l=window.devicePixelRatio;.01>l&&(l=1);Q=P=0;for(var B=T;B&&!isNaN(B.offsetLeft)&&!isNaN(B.offsetTop);)P+=B.offsetLeft-B.scrollLeft,Q+=B.offsetTop-B.scrollTop,B=B.offsetParent;B=S.clientWidth*l|0;var X=S.clientHeight*l|0,R=0,aa=0,qa=B,oa=X;if(Y){oa=window.visualViewport;var ba=oa.scale;R=oa.pageLeft*l*ba;aa=oa.pageTop*l*ba;qa=oa.width*l*ba;oa=oa.height*l*ba;1>qa&&(qa=1);1>oa&&(oa=1);0>R?(qa+=R,R=0):R>=B&&(R=B-1);0>aa?(oa+=aa,aa=0):aa>=X&&(aa=X-1);R+qa>B&&(qa=B-
R);aa+oa>X&&(oa=X-aa)}ba={eventTypeMask:0};L!==l&&(L=l,ba.eventTypeMask|=4,ba.windowDPI=l);if(A!==B||F!==X)A=B,F=X,ba.eventTypeMask|=1,ba.windowWidth=B,ba.windowHeight=X;if(U!==R||Z!==aa||La!==qa||gb!==oa)U=R,Z=aa,La=qa,gb=oa,ba.eventTypeMask|=2,ba.visualViewportX=R,ba.visualViewportY=aa,ba.visualViewportW=qa,ba.visualViewportH=oa;0!==ba.eventTypeMask&&W(0,9,ba)}function b(l){const B=l.length,X=Array(B);for(var R=0;R<B;++R){const aa=l.item(R);X[R]={pointX:aa.pageX-P,pointY:aa.pageY-Q,radius:.5*(aa.radiusX+
aa.radiusY),force:aa.force,pointUID:aa.identifier}}return X}function d(l,B){return{eventType:l,keyCode:B.code||null,keyName:B.key||null,legacyCode:"number"===typeof B.which?B.which:"number"===typeof B.keyCode?B.keyCode:0,location:B.location,mods:(B.ctrlKey?1:0)|(B.shiftKey?2:0)|(B.metaKey?4:0)}}function c(){return new Promise(function(l){if(-1!==M)throw Error("Main thread is already waiting for VSync!");const B=[!1];window.requestAnimationFrame(function(){B[0]||(B[0]=!0,-1!==M&&(window.clearTimeout(M),
M=-1),l())});M=window.setTimeout(function(){B[0]||(B[0]=!0,M=-1,l())},20)})}function g(l){return new Promise(function(B){setTimeout(B,l)})}function h(l){if(0<l&&1E3>=l){const X=1E3/l;if(0===ha)ha=performance.now()+X;else{l=performance.now();var B=ha-l|0;if(0<B)return!ob&&Ac?Bc().then(function(){var R=performance.now(),aa=ha-R|0;if(0<aa)return g(aa).then(function(){var qa=performance.now();(ha+=X)<qa&&(ha=qa)});(ha+=X)<R&&(ha=R)}):g(B).then(function(){var R=performance.now();(ha+=X)<R&&(ha=R)});(ha+=
X)<l&&(ha=l)}}else ha=0;return ob?Cc(0):Bc()}function v(l){if(Fa){za=!!l;var B=performance.now()|0;if(l){Ma=!0;try{T.requestPointerLock()}catch(X){}-1!==va&&window.clearTimeout(va);va=-1;3E3>B-Wa&&(va=window.setTimeout(function(){try{T.requestPointerLock()}catch(X){}},3100-(B-Wa)))}else if(-1!==va&&window.clearTimeout(va),va=-1,!Ma)try{document.exitPointerLock()}catch(X){}}}function I(){if(ia)if(n.matches){if(r)try{navigator.keyboard.unlock()}catch(l){}try{document.exitFullscreen()}catch(l){}}else{if(r)try{navigator.keyboard.lock()}catch(l){}try{T.requestFullscreen()}catch(l){}}}
function x(){C()?w():m?(m.blur(),m.value="",setTimeout(function(){m&&(t?t.removeChild(m):m.remove(),m=null);t&&(S.removeChild(t),t=null)},10)):(t&&(S.removeChild(t),t=null),t=document.createElement("form"),t.setAttribute("autocomplete","off"),t.classList.add("_eaglercraftX_text_input_wrapper"),t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.right="0px",t.style.bottom="0px",t.style.zIndex="-100",t.style.margin="0px",t.style.padding="0px",t.style.border="none",t.addEventListener("submit",
function(l){l.preventDefault();l.stopPropagation();l=l.timeStamp;l&&(0!==y&&10>l-y||0!==f&&10>l-f||0!==u&&10>l-u)||(p||(e("Note: Generating return keystroke from submit event on form, this browser probably doesn't generate keydown/beforeinput/input when enter/return is pressed on the on-screen keyboard"),p=!0),W(0,3,{eventType:0,absoluteCode:28,absoluteChar:10}))}),m=document.createElement("input"),m.type="password",m.value=" ",m.classList.add("_eaglercraftX_text_input_element"),m.setAttribute("autocomplete",
"off"),m.style.position="absolute",m.style.top="0px",m.style.left="0px",m.style.right="0px",m.style.bottom="0px",m.style.zIndex="-100",m.style.margin="0px",m.style.padding="0px",m.style.border="none",m.style.setProperty("-webkit-touch-callout","default"),m.addEventListener("beforeinput",function(l){if(m===l.target){z||(e("Note: Caught beforeinput event from on-screen keyboard, browser probably does not generate global keydown/keyup events on text fields, or does not respond to cancelling keydown"),
z=!0);var B=l.timeStamp;if(B){if(0!==y&&10>B-y)return;f=B}l.preventDefault();l.stopPropagation();switch(l.inputType){case "insertParagraph":case "insertLineBreak":W(0,3,{eventType:0,absoluteCode:28,absoluteChar:10});break;case "deleteWordBackward":case "deleteSoftLineBackward":case "deleteHardLineBackward":case "deleteEntireSoftLine":case "deleteContentBackward":case "deleteContent":W(0,3,{eventType:0,absoluteCode:14,absoluteChar:0});break;case "deleteWordForward":case "deleteSoftLineForward":case "deleteHardLineForward":case "deleteContentForward":W(0,
3,{eventType:0,absoluteCode:211,absoluteChar:0});break;case "insertText":case "insertCompositionText":case "insertReplacementText":(l=l.data)&&0<l.length&&W(0,3,{eventType:1,codepoints:l});break;case "insertFromPaste":case "insertFromPasteAsQuotation":case "insertFromDrop":case "insertFromYank":case "insertLink":(l=l.data)&&0<l.length&&W(0,4,l);break;case "historyUndo":case "historyRedo":case "deleteByDrag":case "deleteByCut":break;default:e('Ignoring InputEvent.inputType "{}" from on-screen keyboard',
l.inputType)}}}),m.addEventListener("input",function(l){if(m===l.target){q||(e("Note: Caught legacy input events from on-screen keyboard, browser could be outdated and doesn't support beforeinput event, or does not respond to cancelling beforeinput"),q=!0);if(l=l.timeStamp){if(0!==y&&10>l-y||0!==f&&10>l-f)return;u=l}l=m.value;var B=l.length;0===B?W(0,3,{eventType:0,absoluteCode:14,absoluteChar:0}):1===B?W(0,3,{eventType:1,codepoints:l}):(l=l.trim(),B=l.length,0===B?W(0,3,{eventType:0,absoluteCode:57,
absoluteChar:32}):W(0,3,{eventType:1,codepoints:l.charAt(B-1)}));m.value=" ";m.setSelectionRange(1,1)}}),m.addEventListener("focus",function(l){m===l.target&&(m.value=" ",m.setSelectionRange(1,1))}),m.addEventListener("select",function(l){m===l.target&&(l.preventDefault(),l.stopPropagation(),m.value=" ",m.setSelectionRange(1,1))}),t.appendChild(m),S.appendChild(t),m.value=" ",m.focus(),m.select(),m.setSelectionRange(1,1))}function w(){if(m){m.blur();m.value="";const l=m,B=t;window.setTimeout(function(){null!==
B?(B.removeChild(l),B.remove()):l.remove()},10);t=m=null}else t&&(S?S.removeChild(t):t.remove(),t=null)}function C(){return!!m&&document.activeElement===m}var E=null,P=0,Q=0,t=null,m=null,z=!1,q=!1,p=!1,y=0,f=0,u=0,A=-1,F=-1,L=-1,Y=!1,U=-1,Z=-1,La=-1,gb=-1,Fa=!1,za=!1,Ma=!1,Wa=0,va=-1,ia=!1,n=null,r=!1,G=!1,M=-1,V=!1,ca=null,wa=null,Xa=null,rb=null,sb=null,tb=null,ub=null,vb=null,wb=null,xb=null,yb=null,zb=null,Ab=null,Bb=null,Cb=null,Db=null,Eb=null,Fb=null,Gb=null,Hb=null,Ib=null,Jb=null,Kb=null;
E=document.createElement("div");E.classList.add("_eaglercraftX_keyboard_open_zone");E.style.display="none";E.style.position="absolute";E.style.backgroundColor="transparent";E.style.top="0px";E.style.left="0px";E.style.width="0px";E.style.height="0px";E.style.zIndex="100";E.style.touchAction="pan-x pan-y";E.style.setProperty("-webkit-touch-callout","none");E.style.setProperty("-webkit-tap-highlight-color","rgba(255, 255, 255, 0)");S.appendChild(E);a();S.addEventListener("contextmenu",ca=function(l){l.target!==
Dc&&(l.preventDefault(),l.stopPropagation())});T.addEventListener("mousedown",wa=function(l){l.preventDefault();l.stopPropagation();Fa&&za&&document.pointerLockElement!==T?v(1):W(0,0,{eventType:0,posX:l.offsetX,posY:l.offsetY,button:l.button})});T.addEventListener("mouseup",Xa=function(l){l.preventDefault();l.stopPropagation();W(0,0,{eventType:1,posX:l.offsetX,posY:l.offsetY,button:l.button})});T.addEventListener("mousemove",rb=function(l){l.preventDefault();l.stopPropagation();W(0,0,{eventType:2,
posX:l.offsetX,posY:l.offsetY,movementX:l.movementX,movementY:l.movementY})});T.addEventListener("mouseenter",sb=function(){W(0,7,null)});T.addEventListener("mouseleave",tb=function(){W(0,8,null)});T.addEventListener("touchstart",ub=function(l){l.preventDefault();l.stopPropagation();W(0,2,{eventType:0,changedTouches:b(l.changedTouches),targetTouches:b(l.targetTouches)});w()});T.addEventListener("touchend",vb=function(l){l.preventDefault();l.stopPropagation();W(0,2,{eventType:2,changedTouches:b(l.changedTouches),
targetTouches:b(l.targetTouches)})});T.addEventListener("touchmove",wb=function(l){l.preventDefault();l.stopPropagation();W(0,2,{eventType:1,changedTouches:b(l.changedTouches),targetTouches:b(l.targetTouches)})});T.addEventListener("touchcancel",xb=function(l){W(0,2,{eventType:2,changedTouches:b(l.changedTouches),targetTouches:b(l.targetTouches)})});T.addEventListener("wheel",Fb=function(l){l.preventDefault();l.stopPropagation();W(0,0,{eventType:3,posX:l.offsetX,posY:l.offsetY,wheel:l.deltaY})});
window.addEventListener("blur",Hb=function(){W(0,6,null)});window.addEventListener("focus",Gb=function(){W(0,5,null)});window.addEventListener("keydown",Ab=function(l){Ec||(l.preventDefault(),l.stopPropagation());"F11"!==l.key||l.repeat?(W(0,1,d(l.repeat?2:0,l)),l.timeStamp&&"Unidentified"!==l.key&&(y=l.timeStamp)):I()});window.addEventListener("keyup",Bb=function(l){Ec||(l.preventDefault(),l.stopPropagation());W(0,1,d(1,l))});E.addEventListener("touchstart",Cb=function(l){l.preventDefault();l.stopPropagation()});
E.addEventListener("touchend",Db=function(l){l.preventDefault();l.stopPropagation();x()});E.addEventListener("touchmove",Eb=function(l){l.preventDefault();l.stopPropagation()});(Fa="function"===typeof document.exitPointerLock)?(document.addEventListener("pointerlockchange",Ib=function(){window.setTimeout(function(){const l=document.pointerLockElement===T;l||za&&(Wa=performance.now()|0);za=l},60);Ma=!1}),document.addEventListener("pointerlockerror",Jb=function(){Ma=!1})):k("Pointer lock is not supported on this browser");
(ia="function"===typeof document.exitFullscreen)?(n=window.matchMedia("(display-mode: fullscreen)"),(r=!(!navigator.keyboard||!navigator.keyboard.lock))&&n.addEventListener("change",Kb=function(){n.matches||navigator.keyboard.unlock()})):k("Fullscreen is not supported on this browser");if("undefined"!==typeof window.visualViewport)if("body"===Sa.tagName.toLowerCase())Y=!0;else{const l=document.body;10>=Math.abs(l.clientWidth-S.clientWidth)&&10>=Math.abs(l.clientHeight-S.clientHeight)&&(Y=!0)}else Y=
!1;Y&&e("Note: Detected game is embedded in body, some screens may be resized to window.visualViewport instead for a better mobile experience");try{await c(),G=!0}catch(l){G=!1}G||k("VSync is not supported on this browser");(V="function"===typeof navigator.getGamepads)?(window.addEventListener("gamepadconnected",yb=function(){W(0,10,{eventType:0})}),window.addEventListener("gamepaddisconnected",zb=function(l){W(0,10,{eventType:1,gamepad:l.gamepad})})):k("Gamepad detected as unsupported!");J.keyboardLayoutSupported=
function(){return!(!navigator.keyboard||!navigator.keyboard.getLayoutMap)};J.iterateKeyboardLayout=new WebAssembly.Suspending(async function(){const l=[];try{const B=await navigator.keyboard.getLayoutMap();B&&B.forEach&&B.forEach(function(X,R){l.push({key:X,value:R})})}catch(B){}return l});J.updateCanvasSize=function(l,B){T.width!==l&&(T.width=l);T.height!==B&&(T.height=B)};var ha=0;J.updatePlatformAndSleep=new WebAssembly.Suspending(function(l,B){a();if("string"!==typeof document.visibilityState||
"visible"===document.visibilityState)return G&&B?(ha=0,c()):0>=l?(ha=0,ob?Cc(0):Bc()):h(l);ha=0;return g(50)});J.isVSyncSupported=function(){return G};J.mouseSetGrabbed=v;J.isMouseGrabSupported=function(){return Fa};J.isMouseGrabbed=function(){return za};J.isPointerLocked=function(){return Fa&&(Ma||document.pointerLockElement===T)};J.supportsFullscreen=function(){return ia};J.toggleFullscreen=I;J.isFullscreen=function(){return ia&&n.matches};J.touchSetOpenKeyboardZone=function(l,B,X,R){0!==X&&0!==
R?(E.style.display="block",E.style.top=""+(F-B-R)/L+"px",E.style.left=""+l/L+"px",E.style.width=""+X/L+"px",E.style.height=""+R/L+"px"):(E.style.display="none",E.style.top="0px",E.style.left="0px",E.style.width="0px",E.style.height="0px")};J.touchCloseDeviceKeyboard=w;J.touchIsDeviceKeyboardOpenMAYBE=C;J.gamepadSupported=function(){return V};J.isVisualViewport=function(){return Y};db=function(){try{ca&&(S.removeEventListener("contextmenu",ca),ca=null),wa&&(T.removeEventListener("mousedown",wa),wa=
null),Xa&&(T.removeEventListener("mouseup",Xa),Xa=null),rb&&(T.removeEventListener("mousemove",rb),rb=null),sb&&(T.removeEventListener("mouseenter",sb),sb=null),tb&&(T.removeEventListener("mouseleave",tb),tb=null),ub&&(T.removeEventListener("touchstart",ub),ub=null),vb&&(T.removeEventListener("touchend",vb),vb=null),wb&&(T.removeEventListener("touchmove",wb),wb=null),xb&&(T.removeEventListener("touchcancel",xb),xb=null),yb&&(window.removeEventListener("gamepadconnected",yb),yb=null),zb&&(window.removeEventListener("gamepaddisconnected",
zb),zb=null),Ab&&(window.removeEventListener("keydown",Ab),Ab=null),Bb&&(window.removeEventListener("keyup",Bb),Bb=null),Cb&&(E.removeEventListener("touchstart",Cb),Cb=null),Db&&(E.removeEventListener("touchend",Db),Db=null),Eb&&(E.removeEventListener("touchmove",Eb),Eb=null),Fb&&(T.removeEventListener("wheel",Fb),Fb=null),Gb&&(window.removeEventListener("focus",Gb),Gb=null),Hb&&(window.removeEventListener("blur",Hb),Hb=null),Ib&&(document.removeEventListener("pointerlockchange",Ib),Ib=null),Jb&&
(document.removeEventListener("pointerlockerror",Jb),Jb=null),Kb&&(n.removeEventListener("change",Kb),Kb=null)}catch(l){k("Failed to remove event listeners! {}",l)}db=null}};(function(){function a(){this._socket.close()}function b(f){this._socket.send(f)}function d(f){this._socket.send(f)}function c(){return this._frameCountStr+this._frameCountBin}function g(){const f=this._queue;return f?(f._next===f&&f._prev===f?this._queue=null:(this._queue=f._next,f._prev._next=f._next,f._next._prev=f._prev),f._next=null,f._prev=null,0===f.type?--this._frameCountStr:--this._frameCountBin,f):null}function h(){var f=this._frameCountStr+this._frameCountBin;if(0===f)return null;f=Array(f);
var u=0,A=this._queue;const F=A;do{f[u++]=A;var L=A._next;A._next=null;A._prev=null;A=L}while(A!==F);this._queue=null;this._frameCountBin=this._frameCountStr=0;return f}function v(){this._queue=null;this._frameCountBin=this._frameCountStr=0}function I(f,u){var A=f._queue;if(!A)return null;const F=A;do{var L=A._next;if(A.type===u)return u=A._prev,L===A&&u===A?f._queue=null:(A===F&&(f._queue=L),u._next=L,L._prev=u),A._next=null,A._prev=null,A;A=L}while(A!==F);return null}function x(f,u,A){var F=0,L=
f._queue,Y=L;do{var U=L._next;L.type===u&&(A[F++]=L);L=U}while(L!==Y);A.length=F;for(Y=0;Y<F;++Y)L=A[Y],U=L._next,u=L._prev,U===L&&u===L?f._queue=null:(L===f._queue&&(f._queue=U),u._next=U,U._prev=u)}function w(){return this._frameCountStr}function C(){if(0===this._frameCountStr)return null;const f=I(this,0);f?--this._frameCountStr:this._frameCountStr=0;return f}function E(){var f=this._frameCountStr;if(0===f)return null;f=Array(f);x(this,0,f);this._frameCountStr=0;return f}function P(){const f=this._frameCountStr;
if(0===f)return null;x(this,0,Array(f));this._frameCountStr=0}function Q(){return this._frameCountBin}function t(){if(0===this._frameCountBin)return null;const f=I(this,1);f?--this._frameCountBin:this._frameCountBin=0;return f}function m(){var f=this._frameCountBin;if(0===f)return null;f=Array(f);x(this,1,f);this._frameCountBin=0;return f}function z(){const f=this._frameCountBin;if(0===f)return null;x(this,1,Array(f));this._frameCountBin=0}function q(f){this._enableStringFrames=f}function p(f){this._enableBinaryFrames=
f}function y(f){const u="string"===typeof f;if(u){if(!this._enableStringFrames)return}else if(!this._enableBinaryFrames)return;f={type:u?0:1,data:f,timestamp:performance.now(),_next:null,_prev:null};const A=this._queue;if(A){const F=A._prev;F._next=f;f._prev=F;f._next=A;A._prev=f}else this._queue=f,f._next=f,f._prev=f;u?++this._frameCountStr:++this._frameCountBin}ya.createWebSocketHandle=function(f){let u;try{u=new WebSocket(f)}catch(F){return k("Failed to create WebSocket: {}",f),la("Exception Caught",
F),null}u.binaryType="arraybuffer";const A={state:1,_socket:u,_queue:null,_frameCountStr:0,_frameCountBin:0,_addRecievedFrame:y,_enableStringFrames:!0,_enableBinaryFrames:!0,closeSocket:a,sendStringFrame:b,sendBinaryFrame:d,availableFrames:c,getNextFrame:g,getAllFrames:h,clearFrames:v,availableStringFrames:w,getNextStringFrame:C,getAllStringFrames:E,clearStringFrames:P,availableBinaryFrames:Q,getNextBinaryFrame:t,getAllBinaryFrames:m,clearBinaryFrames:z,setEnableStringFrames:q,setEnableBinaryFrames:p};
u.addEventListener("open",function(){A.state=2});u.addEventListener("message",function(F){A._addRecievedFrame(F.data)});u.addEventListener("close",function(){3!==A.state&&(A.state=0)});u.addEventListener("error",function(){1===A.state&&(A.state=3)});return A}})();function Xb(a,b){var d=nb;const c=d&&200===b?a.getExtension("OES_vertex_array_object"):null,g=d&&200===b?a.getExtension("ANGLE_instanced_arrays"):null,h=d&&200===b&&null!==g,v=d&&(310===b||300===b)&&null!==a.getExtension("EXT_color_buffer_float"),I=d&&!v&&(310===b||300===b||200===b)&&null!==a.getExtension("EXT_color_buffer_half_float"),x=d&&200===b&&null!==a.getExtension("EXT_shader_texture_lod"),w=d&&200===b&&null!==a.getExtension("OES_fbo_render_mipmap"),C=d&&200===b&&null!==c,E=d&&200===b&&null!==
a.getExtension("OES_texture_float"),P=d&&300<=b&&null!==a.getExtension("OES_texture_float_linear"),Q=d&&200===b&&null!==a.getExtension("OES_texture_half_float"),t=d&&200===b&&null!==a.getExtension("OES_texture_half_float_linear");d=d&&null!==a.getExtension("EXT_texture_filter_anisotropic");const m=null!==a.getExtension("WEBGL_debug_renderer_info"),z=300<=b?0:200===b&&C?1:-1,q=300<=b?0:200===b&&h?1:-1,p=[b,z,q,0,0];if(300<=b||w)p[3]|=4;if(300<=b||x)p[3]|=8;300<=b&&(p[3]|=16);(320<=b||(300<=b||E)&&
(v||I))&&(p[3]|=32);(320<=b||(300<=b||Q)&&v)&&(p[3]|=64);d&&(p[3]|=128);(300<=b||t)&&(p[4]|=1);300<=b&&P&&(p[4]|=2);K.getCapBits=function(f){return p[f]};K.glEnable=a.enable.bind(a);K.glDisable=a.disable.bind(a);K.glClearColor=a.clearColor.bind(a);K.glClearDepth=a.clearDepth.bind(a);K.glClear=a.clear.bind(a);K.glDepthFunc=a.depthFunc.bind(a);K.glDepthMask=a.depthMask.bind(a);K.glCullFace=a.cullFace.bind(a);K.glViewport=a.viewport.bind(a);K.glBlendFunc=a.blendFunc.bind(a);K.glBlendFuncSeparate=a.blendFuncSeparate.bind(a);
K.glBlendEquation=a.blendEquation.bind(a);K.glBlendColor=a.blendColor.bind(a);K.glColorMask=a.colorMask.bind(a);K.glDrawBuffers=300<=b?a.drawBuffers.bind(a):na("glDrawBuffers");K.glReadBuffer=300<=b?a.readBuffer.bind(a):na("glReadBuffer");K.glReadPixels=a.readPixels.bind(a);K.glPolygonOffset=a.polygonOffset.bind(a);K.glLineWidth=a.lineWidth.bind(a);K.glGenBuffers=a.createBuffer.bind(a);K.glGenTextures=a.createTexture.bind(a);K.glCreateProgram=a.createProgram.bind(a);K.glCreateShader=a.createShader.bind(a);
K.glCreateFramebuffer=a.createFramebuffer.bind(a);K.glCreateRenderbuffer=a.createRenderbuffer.bind(a);K.glGenQueries=300<=b?a.createQuery.bind(a):na("glGenQueries");K.glDeleteBuffers=a.deleteBuffer.bind(a);K.glDeleteTextures=a.deleteTexture.bind(a);K.glDeleteProgram=a.deleteProgram.bind(a);K.glDeleteShader=a.deleteShader.bind(a);K.glDeleteFramebuffer=a.deleteFramebuffer.bind(a);K.glDeleteRenderbuffer=a.deleteRenderbuffer.bind(a);K.glDeleteQueries=300<=b?a.deleteQuery.bind(a):na("glDeleteQueries");
K.glBindBuffer=a.bindBuffer.bind(a);K.glBufferData=a.bufferData.bind(a);K.glBufferSubData=a.bufferSubData.bind(a);K.glEnableVertexAttribArray=a.enableVertexAttribArray.bind(a);K.glDisableVertexAttribArray=a.disableVertexAttribArray.bind(a);K.glVertexAttribPointer=a.vertexAttribPointer.bind(a);K.glActiveTexture=a.activeTexture.bind(a);K.glBindTexture=a.bindTexture.bind(a);K.glTexParameterf=a.texParameterf.bind(a);K.glTexParameteri=a.texParameteri.bind(a);K.glTexImage3D=300<=b?a.texImage3D.bind(a):
na("glTexImage3D");K.glTexImage2D=a.texImage2D.bind(a);K.glTexSubImage2D=a.texSubImage2D.bind(a);K.glCopyTexSubImage2D=a.copyTexSubImage2D.bind(a);K.glTexStorage2D=300<=b?a.texStorage2D.bind(a):na("glTexStorage2D");K.glPixelStorei=a.pixelStorei.bind(a);K.glGenerateMipmap=a.generateMipmap.bind(a);K.glShaderSource=a.shaderSource.bind(a);K.glCompileShader=a.compileShader.bind(a);K.glGetShaderi=a.getShaderParameter.bind(a);K.glGetShaderInfoLog=a.getShaderInfoLog.bind(a);K.glUseProgram=a.useProgram.bind(a);
K.glAttachShader=a.attachShader.bind(a);K.glDetachShader=a.detachShader.bind(a);K.glLinkProgram=a.linkProgram.bind(a);K.glGetProgrami=a.getProgramParameter.bind(a);K.glGetProgramInfoLog=a.getProgramInfoLog.bind(a);K.glDrawArrays=a.drawArrays.bind(a);K.glDrawElements=a.drawElements.bind(a);K.glBindAttribLocation=a.bindAttribLocation.bind(a);K.glGetAttribLocation=a.getAttribLocation.bind(a);K.glGetUniformLocation=a.getUniformLocation.bind(a);K.glGetUniformBlockIndex=300<=b?a.getUniformBlockIndex.bind(a):
na("glGetUniformBlockIndex");K.glBindBufferRange=300<=b?a.bindBufferRange.bind(a):na("glBindBufferRange");K.glUniformBlockBinding=300<=b?a.uniformBlockBinding.bind(a):na("glUniformBlockBinding");K.glUniform1f=a.uniform1f.bind(a);K.glUniform2f=a.uniform2f.bind(a);K.glUniform3f=a.uniform3f.bind(a);K.glUniform4f=a.uniform4f.bind(a);K.glUniform1i=a.uniform1i.bind(a);K.glUniform2i=a.uniform2i.bind(a);K.glUniform3i=a.uniform3i.bind(a);K.glUniform4i=a.uniform4i.bind(a);K.glUniformMatrix2fv=a.uniformMatrix2fv.bind(a);
K.glUniformMatrix3fv=a.uniformMatrix3fv.bind(a);K.glUniformMatrix4fv=a.uniformMatrix4fv.bind(a);K.glUniformMatrix3x2fv=300<=b?a.uniformMatrix3x2fv.bind(a):na("glUniformMatrix3x2fv");K.glUniformMatrix4x2fv=300<=b?a.uniformMatrix4x2fv.bind(a):na("glUniformMatrix4x2fv");K.glUniformMatrix4x3fv=300<=b?a.uniformMatrix4x3fv.bind(a):na("glUniformMatrix4x3fv");K.glBindFramebuffer=a.bindFramebuffer.bind(a);K.glCheckFramebufferStatus=a.checkFramebufferStatus.bind(a);K.glBlitFramebuffer=300<=b?a.blitFramebuffer.bind(a):
na("glBlitFramebuffer");K.glRenderbufferStorage=a.renderbufferStorage.bind(a);K.glFramebufferTexture2D=a.framebufferTexture2D.bind(a);K.glFramebufferTextureLayer=300<=b?a.framebufferTextureLayer.bind(a):na("glFramebufferTextureLayer");K.glBindRenderbuffer=a.bindRenderbuffer.bind(a);K.glFramebufferRenderbuffer=a.framebufferRenderbuffer.bind(a);K.glGetError=a.getError.bind(a);K.getAllExtensions=a.getSupportedExtensions.bind(a);K.isContextLost=a.isContextLost.bind(a);const y=[];h&&y.push("ANGLE_instanced_arrays");
v&&y.push("EXT_color_buffer_float");I&&y.push("EXT_color_buffer_half_float");x&&y.push("EXT_shader_texture_lod");w&&y.push("OES_fbo_render_mipmap");C&&y.push("OES_vertex_array_object");E&&y.push("OES_texture_float");P&&y.push("OES_texture_float_linear");Q&&y.push("OES_texture_half_float");t&&y.push("OES_texture_half_float_linear");d&&y.push("EXT_texture_filter_anisotropic");m&&y.push("WEBGL_debug_renderer_info");K.dumpActiveExtensions=function(){return y};K.glGetInteger=function(f){f=a.getParameter(f);
return"number"===typeof f?f:0};K.glGetString=function(f){if(m)switch(f){case 7936:f=a.getParameter(37445);null==f&&(f=a.getParameter(7936));break;case 7937:f=a.getParameter(37446);null==f&&(f=a.getParameter(7937));break;default:f=a.getParameter(f)}else f=a.getParameter(f);return"string"===typeof f?f:null};switch(z){case 0:K.glGenVertexArrays=a.createVertexArray.bind(a);K.glDeleteVertexArrays=a.deleteVertexArray.bind(a);K.glBindVertexArray=a.bindVertexArray.bind(a);break;case 1:K.glGenVertexArrays=
c.createVertexArrayOES.bind(c);K.glDeleteVertexArrays=c.deleteVertexArrayOES.bind(c);K.glBindVertexArray=c.bindVertexArrayOES.bind(c);break;default:D(K,"glGenVertexArrays"),D(K,"glDeleteVertexArrays"),D(K,"glBindVertexArray")}switch(q){case 0:K.glVertexAttribDivisor=a.vertexAttribDivisor.bind(a);K.glDrawArraysInstanced=a.drawArraysInstanced.bind(a);K.glDrawElementsInstanced=a.drawElementsInstanced.bind(a);break;case 1:K.glVertexAttribDivisor=g.vertexAttribDivisorANGLE.bind(g);K.glDrawArraysInstanced=
g.drawArraysInstancedANGLE.bind(g);K.glDrawElementsInstanced=g.drawElementsInstancedANGLE.bind(g);break;default:D(K,"glVertexAttribDivisor"),D(K,"glDrawArraysInstanced"),D(K,"glDrawElementsInstanced")}};var Ac=!1;const Fc=new MessageChannel;var Gc=null;Fc.port2.addEventListener("message",function(){Gc()});async function Mb(){Fc.port1.start();Fc.port2.start();Gc=function(){Gc=null};Fc.port1.postMessage(0);Gc?await new Promise(function(a){setTimeout(function(){Gc?k("Immediate continue hack is not supported"):Ac=!0;a()},25)}):k("Immediate continue hack is not supported")}Aa.getRootElement=function(){return Sa};Aa.getParentElement=function(){return S};Aa.getCanvasElement=function(){return T};
Aa.getEaglercraftXOpts=function(){return O};Aa.getEventCount=ac.K.bind(ac);Aa.getNextEvent=ac.j.bind(ac);
Aa.queueAsyncDownload=function(a,b,d){try{fetch(a,{cache:b?"force-cache":"no-store",mode:"cors"}).then(function(c){return c.arrayBuffer()}).then(function(c){W(1,0,{requestId:d,arrayBuffer:c})}).catch(function(c){k("Failed to complete async download: {}",a);la("Exception Caught",c);W(1,0,{requestId:d,arrayBuffer:null})})}catch(c){k("Failed to fetch: {}",a),la("Exception Caught",c),W(1,0,{requestId:d,arrayBuffer:null})}};
Aa.download=new WebAssembly.Suspending(function(a,b){return new Promise(function(d){try{fetch(a,{cache:b?"force-cache":"no-store",mode:"cors"}).then(function(c){return c.arrayBuffer()}).then(function(c){d(c)}).catch(function(c){k("Failed to complete download: {}",a);la("Exception Caught",c);d(null)})}catch(c){k("Failed to fetch: {}",a),la("Exception Caught",c),d(null)}})});Aa.writeCrashReport=function(a){dc(a,!1)};Aa.steadyTimeMillis=performance.now.bind(performance);
function Cc(a){return new Promise(function(b){setTimeout(b,a)})}Aa.sleep=new WebAssembly.Suspending(Cc);function Hc(a){Ac?(Gc=a,Fc.port1.postMessage(0)):setTimeout(a,0)}function Bc(){return new Promise(Hc)}Aa.immediateContinue=new WebAssembly.Suspending(Bc);Aa.immediateContinueSupported=function(){return Ac};Aa.setCrashReportString=function(a,b){cb[a]=b};var Ic="undefined"!==typeof window,Jc=null,Kc=[],Lc=[],Mc="video/webm",Nc=!1,Oc=null,Pc=15E3;
function Qc(){return new Promise(function(a){if("navigator"in window&&"mediaDevices"in window.navigator&&"getUserMedia"in window.navigator.mediaDevices)try{window.navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(b){a(b)}).catch(function(b){k("getUserMedia Error! (async)");la("Exception Caught",b);a(null)})}catch(b){k("getUserMedia Error!"),a(null)}else k("No getUserMedia!"),a(null)})}async function Rc(){return Ic?null===Jc&&(Jc=await Qc(),null===Jc)?(Ic=!1,null):Jc:null}
function Ob(){function a(b){const d=new Date;return b.replace("${date}",d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)+" "+("0"+d.getHours()).slice(-2)+"-"+("0"+d.getMinutes()).slice(-2)+"-"+("0"+d.getSeconds()).slice(-2))}Ba.getMic=new WebAssembly.Suspending(Rc);Ba.setDataAvailableHandler=function(b,d,c){const g=performance.now();b.addEventListener("dataavailable",function(h){if(d)Sc(h.data,performance.now()-g|0,function(v){const I=URL.createObjectURL(v);mc(a(c),
I,function(){URL.revokeObjectURL(I)})},{U:function(v){e(v)}});else{const v=URL.createObjectURL(h.data);mc(a(c),v,function(){URL.revokeObjectURL(v)})}})};Ba.setClipDataHandler=function(b,d){function c(){Oc&&clearTimeout(Oc);Oc=setTimeout(function(){Oc=null;Nc&&"recording"===b.state&&b.stop()},Pc)}Kc=[];Lc=[];Mc=b.mimeType||"video/webm";Nc=!0;Pc=Math.max(5E3,250*d);b.addEventListener("dataavailable",function(g){g&&g.data&&0<g.data.size&&(Lc.push(g.data),b.mimeType&&(Mc=b.mimeType))});b.addEventListener("stop",
function(){if(0<Lc.length){var g=new Blob(Lc,{type:Mc});if(0<g.size)for(Kc.push(g);5<Kc.length;)Kc.shift();Lc=[]}Nc&&setTimeout(function(){if(Nc)try{b.start(),c()}catch(h){Nc=!1}},50)});c()};Ba.stopClipDataHandler=function(){Nc=!1;Oc&&(clearTimeout(Oc),Oc=null)};Ba.resetClipData=function(){Nc=!1;Oc&&(clearTimeout(Oc),Oc=null);Kc=[];Lc=[];Mc="video/webm"};Ba.getClipChunkCount=function(){return Lc.length+Kc.length};Ba.exportClip=function(b,d,c,g){Mc.startsWith("video/webm")&&".mp4"===g.slice(-4)&&(g=
g.slice(0,-4)+".webm");if(0<Lc.length&&(b=new Blob(0<d&&Lc.length>d+1?[Lc[0]].concat(Lc.slice(-d)):Lc,{type:Mc}),0<b.size)){var h=URL.createObjectURL(b);mc(g,h,function(){URL.revokeObjectURL(h)});return!0}if(0===Kc.length)return!1;b=Kc[Kc.length-1];h=URL.createObjectURL(b);mc(g,h,function(){URL.revokeObjectURL(h)});return!0}};function Pb(){function a(g){try{const h=JSON.parse(g);this._peerConnection.setRemoteDescription(h).then(()=>{h.hasOwnProperty("type")&&"offer"===h.type&&this._peerConnection.createAnswer().then(v=>{this._peerConnection.setLocalDescription(v).then(()=>{W(2,1,{objId:this.objId,data:JSON.stringify(v)})}).catch(I=>{k('Failed to set local description for "{}"! {}',this.objId,I.message);W(2,3,{objId:this.objId})})}).catch(v=>{k('Failed to create answer for "{}"! {}',this.objId,v.message);W(2,3,{objId:this.objId})})}).catch(v=>
{k('Failed to set remote description for "{}"! {}',this.objId,v.message);W(2,3,{objId:this.objId})})}catch(h){k(h.message),W(2,3,{objId:this.objId})}}function b(g){try{this._peerConnection.addIceCandidate(new RTCIceCandidate(JSON.parse(g))).catch(h=>{k('Failed to parse ice candidate for "{}"! {}',this.objId,h.message);W(2,3,{objId:this.objId})})}catch(h){k(h.message),W(2,3,{objId:this.objId})}}function d(){this._peerConnection.close()}Ca.isSupported=function(){return"undefined"!==typeof navigator.mediaDevices&&
"undefined"!==typeof navigator.mediaDevices.getUserMedia&&"srcObject"in HTMLAudioElement.prototype};let c=0;Ca.createRTCPeerConnection=function(g,h,v){try{const x=c++;var I;const w=new RTCPeerConnection({iceServers:JSON.parse(g),optional:[{DtlsSrtpKeyAgreement:!0}]});w.addEventListener("icecandidate",C=>{C.candidate&&W(2,0,{objId:x,data:JSON.stringify({sdpMLineIndex:""+C.candidate.sdpMLineIndex,candidate:C.candidate.candidate})})});w.addEventListener("track",C=>{C=C.streams[0];I._aud=document.createElement("audio");
I._aud.autoplay=!0;I._aud.muted=!0;I._aud.srcObject=C;W(2,2,{objId:x,stream:C})});v.getTracks().forEach(function(C){w.addTrack(C,v)});h&&w.createOffer().then(C=>{w.setLocalDescription(C).then(()=>{W(2,1,{objId:x,data:JSON.stringify(C)})}).catch(E=>{k('Failed to set local description for "{}"! {}',x,E.message);W(2,3,{objId:x})})}).catch(C=>{k('Failed to set create offer for "{}"! {}',x,C.message);W(2,3,{objId:x})});w.addEventListener("connectionstatechange",()=>{const C=w.connectionState;"disconnected"!==
C&&"failed"!==C||W(2,3,{objId:x})});return I={objId:x,_peerConnection:w,setRemoteDescription:a,addRemoteICECandidate:b,closeHandle:d}}catch(x){return k(x.message),null}}};function Qb(){const a=new ra;let b;b={iceServers:[],g:null,h:null,readyState:1,v:null,description:null,D:!1,C:!0,disconnect:function(c){if(b.h){try{b.h.close()}catch(g){}b.h=null}if(b.g){try{b.g.close()}catch(g){}b.g=null}c||(b.C=!0);b.readyState=0}};N.supported=function(){return"undefined"!==typeof RTCPeerConnection};N.clientLANReadyState=function(){return b.readyState};N.clientLANCloseConnection=function(){b.disconnect(!1)};N.clientLANSendPacket=function(c){if(null!==b.h&&"open"===b.h.readyState)try{b.h.send(c)}catch(g){b.disconnect(!1)}else b.disconnect(!1)};
N.clientLANReadPacket=function(){const c=a.j();return c?new Uint8Array(c.data):null};N.clientLANAvailable=function(){return a.u};N.clientLANSetICEServersAndConnect=function(c){b.iceServers.length=0;for(let g of c)c=g.split(";"),1===c.length?b.iceServers.push({urls:c[0]}):3===c.length&&b.iceServers.push({urls:c[0],username:c[1],credential:c[2]});2!==b.readyState&&1!==b.readyState||b.disconnect(!0);try{if(b.h){try{b.h.close()}catch(g){}b.h=null}if(b.g)try{b.g.close()}catch(g){}b.g=new RTCPeerConnection({iceServers:b.iceServers,
optional:[{DtlsSrtpKeyAgreement:!0}]});b.readyState=1}catch(g){la("Could not create LAN client RTCPeerConnection!",g);b.readyState=-2;return}try{const g=[];b.g.addEventListener("icecandidate",v=>{if(v.candidate){if(0===g.length){const I=[0,0],x=()=>{if(null!==b.g&&"disconnected"!==b.g.connectionState){const w=++I[1];I[0]!==g.length&&3>w?(I[0]=g.length,setTimeout(x,2E3)):(b.v=JSON.stringify(g),g.length=0)}};setTimeout(x,2E3)}g.push({sdpMLineIndex:v.candidate.sdpMLineIndex,candidate:v.candidate.candidate})}});
b.h=b.g.createDataChannel("lan");b.h.binaryType="arraybuffer";let h;h=()=>{0<g.length?setTimeout(h,10):(b.C=!1,b.D=!0)};b.h.addEventListener("open",h);b.h.addEventListener("message",v=>{a.push({data:v.data,_next:null})});b.g.createOffer().then(v=>{b.g.setLocalDescription(v).then(()=>{b.description=JSON.stringify(v)}).catch(I=>{k("Failed to set local description! {}",I.message);b.readyState=-1;b.disconnect(!1)})}).catch(v=>{k("Failed to set create offer! {}",v.message);b.readyState=-1;b.disconnect(!1)});
b.g.addEventListener("connectionstatechange",()=>{var v=b.g.connectionState;"disconnected"===v?b.disconnect(!1):"connected"===v?b.readyState=2:"failed"===v&&(b.readyState=-1,b.disconnect(!1))})}catch(g){if(b.h){try{b.h.close()}catch(h){}b.h=null}if(b.g){try{b.g.close()}catch(h){}b.g=null}la("Could not create LAN client RTCDataChannel!",g);b.readyState=-2}};N.clearLANClientState=function(){b.v=b.description=null;b.D=!1;b.C=!0};N.clientLANAwaitICECandidate=function(){if(null===b.v)return null;const c=
b.v;b.v=null;return c};N.clientLANAwaitDescription=function(){if(null===b.description)return null;const c=b.description;b.description=null;return c};N.clientLANAwaitChannel=function(){return b.D?(b.D=!1,!0):!1};N.clientLANClosed=function(){return b.C};N.clientLANSetICECandidate=function(c){try{const g=JSON.parse(c);for(c=0;c<g.length;++c)b.g.addIceCandidate(new RTCIceCandidate(g[c]))}catch(g){la("Uncaught exception setting remote ICE candidates",g),b.readyState=-1,b.disconnect(!1)}};N.clientLANSetDescription=
function(c){try{b.g.setRemoteDescription(JSON.parse(c))}catch(g){la("Uncaught exception setting remote description",g),b.readyState=-1,b.disconnect(!1)}};let d;d={iceServers:[],A:new Map,F:new Map,disconnect:function(c){const g=d.A.get(c);if(g){d.A.delete(c);g.l&&d.F.delete(g.l);try{g.disconnect()}catch(h){}g.s(4,null)}}};N.serverLANInitializeServer=function(c){d.iceServers.length=0;for(let g of c)c=g.split(";"),1===c.length?d.iceServers.push({urls:c[0]}):3===c.length&&d.iceServers.push({urls:c[0],
username:c[1],credential:c[2]})};N.serverLANCloseServer=function(){for(let c of Object.values(d.A))if(c){try{c.disconnect()}catch(g){}c.s(4,null)}d.A.clear()};N.serverLANCreatePeer=function(c){try{const g=new ra;let h;h={i:c,g:new RTCPeerConnection({iceServers:d.iceServers,optional:[{DtlsSrtpKeyAgreement:!0}]}),h:null,l:null,s:function(x,w){g.push({type:x,data:w,_next:null})},disconnect:function(){h.h&&h.h.close();h.g.close()}};d.A.set(h.i,h);const v=[];h.g.addEventListener("icecandidate",x=>{if(x.candidate){if(0===
v.length){const w=[0,0],C=()=>{if(null!==h.g&&"disconnected"!==h.g.connectionState){const E=++w[1];w[0]!==v.length&&3>E?(w[0]=v.length,setTimeout(C,2E3)):(h.s(0,JSON.stringify(v)),v.length=0)}};setTimeout(C,2E3)}v.push({sdpMLineIndex:x.candidate.sdpMLineIndex,candidate:x.candidate.candidate})}});let I;I=x=>{0<v.length?setTimeout(I,10,x):x.channel&&(x=x.channel,null!==h.h?x.close():(h.h=x,h.s(2,null),h.h.addEventListener("message",w=>{w=w.data;h.l?ab(h.l,w):h.s(3,new Uint8Array(w))})))};h.g.addEventListener("datachannel",
I);h.g.addEventListener("connectionstatechange",()=>{const x=h.g.connectionState;"disconnected"!==x&&"failed"!==x||d.disconnect(h.i)});return{peerId:h.i,countAvailableEvents:function(){return g.u},nextEvent:function(){return g.j()},writePacket:function(x){let w=!1;if(null!==h.h&&"open"===h.h.readyState)try{h.h.send(x)}catch(C){w=!0}else w=!0;w&&d.disconnect(h.i)},handleRemoteICECandidates:function(x){try{const w=JSON.parse(x);for(let C of w)h.g.addIceCandidate(new RTCIceCandidate(C))}catch(w){k('Failed to parse ice candidate for "{}"! {}',
h.i,w.message),d.disconnect(h.i)}},handleRemoteDescription:function(x){try{const w=JSON.parse(x);h.g.setRemoteDescription(w).then(()=>{w.hasOwnProperty("type")&&"offer"===w.type&&h.g.createAnswer().then(C=>{h.g.setLocalDescription(C).then(()=>{h.s(1,JSON.stringify(C))}).catch(E=>{k('Failed to set local description for "{}"! {}',h.i,E.message);d.disconnect(h.i)})}).catch(C=>{k('Failed to create answer for "{}"! {}',h.i,C.message);d.disconnect(h.i)})}).catch(C=>{k('Failed to set remote description for "{}"! {}',
h.i,C.message);d.disconnect(h.i)})}catch(w){k('Failed to parse remote description for "{}"! {}',h.i,w.message),d.disconnect(h.i)}},mapIPC:function(x){h.l?x||(d.F.delete(h.l),h.l=null):x&&(h.l=x,d.F.set(x,h))},disconnect:function(){d.disconnect(h.i)}}}catch(g){return la("Failed to create WebRTC LAN peer!",g),null}};$a=function(c,g){if(c=d.F.get(c)){let h=!1;if(c.h&&"open"===c.h.readyState)try{c.h.send(g)}catch(v){h=!0}else h=!0;h&&d.disconnect(c.i);return!0}return!1}};function Rb(){function a(f,u){f.allow=u;return f.allow===u}function b(f,u){const A=f.sandbox;for(var F=0;F<u.length;++F)A.add(u[F]);for(F=0;F<u.length;++F)if(!A.contains(u[F]))return!1;for(F=0;F<A.length;++F)if(!u.find(L=>L===A[F]))return!1;return!0}function d(f){if(E)p=document.createElement("iframe"),p.allow="",p.referrerPolicy="strict-origin",p.sandbox.add("allow-downloads"),f.scriptEnabled&&(p.sandbox.add("allow-scripts"),p.sandbox.add("allow-pointer-lock"));else{p=document.createElement("iframe");
p.referrerPolicy="strict-origin";var u=["allow-downloads"];f.scriptEnabled&&(u.push("allow-scripts"),u.push("allow-pointer-lock"));if(!a(p,"")||!b(p,u)){k("Caught safety exception while opening webview!");null!==p&&(p.remove(),p=null);k("Things you can try:");k("1. Set window.eaglercraftXOpts.forceWebViewSupport to true");k("2. Set window.eaglercraftXOpts.enableWebViewCSP to false");k("(these settings may compromise security)");c();q.innerHTML='<div style="padding-top:13vh;"><h1 style="text-align:center;"><img width="48" height="48" style="vertical-align:middle;" src="'+
Qa+'">&emsp;IFrame Safety Error</h1><h4 style="text-align:center;">The content cannot be displayed safely!</h4><h4 style="text-align:center;">Check console for more details</h4></div>';return}}p.j=!0;p.o="lazy";u=!1;if(1===f.contentMode){if(P&&C)if("string"===typeof p.csp){var A="default-src 'none';",F=f.strictCSPEnable?"":t?" https:":" http: https:";A=f.scriptEnabled?A+(" script-src 'unsafe-eval' 'unsafe-inline' data: blob:"+F+"; style-src 'unsafe-eval' 'unsafe-inline' data: blob:")+(F+"; img-src data: blob:")+
(F+"; font-src data: blob:")+(F+"; child-src data: blob:")+(F+"; frame-src data: blob:; media-src data: mediastream: blob:")+(F+"; connect-src data: blob:")+(F+"; worker-src data: blob:")+(F+";"):A+(" style-src data: 'unsafe-inline'"+F+"; img-src data:")+(F+"; font-src data:")+(F+"; media-src data:")+(F+";");p.csp=A}else ka("This browser does not support CSP attribute on iframes! (try Chrome)"),u=!0;else u=!0;u&&f.strictCSPEnable&&ka("Strict CSP was requested for this webview, but that feature is not available!")}else u=
!0;p.style.border="none";p.style.backgroundColor="white";p.style.width="100%";p.style.height="100%";p.classList.add("_eaglercraftX_webview_iframe_element");z.appendChild(p);1===f.contentMode?(A=x.decode(f.blob),f.blob=null,p.srcdoc=A):p.src=f.uri;const L=m,Y=p;let U=!1;p.addEventListener("mouseover",function(){L!==m||Y!==p||U||(U=!0,p.contentWindow.focus())});p.addEventListener("mouseout",function(){L===m&&Y===p&&U&&(U=!1,window.focus())});f.scriptEnabled&&f.serverMessageAPIEnabled&&(y=function(Z){if(L===
m&&Y===p&&Z.source===Y.contentWindow){Z=Z.data;if("object"===typeof Z&&1===Z.ver&&"string"===typeof Z.channel&&0<Z.channel.length){if("boolean"===typeof Z.open){W(3,0,{eventType:Z.open?0:1,channelName:Z.channel});return}if("string"===typeof Z.data){W(3,1,{eventType:0,channelName:Z.channel,eventData:Z.data});return}if(Z.data instanceof ArrayBuffer){W(3,1,{eventType:1,channelName:Z.channel,eventData:Z.data});return}}ka("WebView sent an invalid message!")}else ka("Recieved message from on dead IFrame handler: (#{}) {}",
L,Y.src)});e('WebView is loading: "{}"',1===f.contentMode?"about:srcdoc":p.src);e("JavaScript: {}, Strict CSP: {}, Message API: {}",f.scriptEnabled,f.strictCSPEnable&&!u,f.serverMessageAPIEnabled)}function c(){null!==q&&(++m,q.remove(),q=null);q=document.createElement("div");q.style.backgroundColor="white";q.style.width="100%";q.style.height="100%";q.classList.add("_eaglercraftX_webview_permission_screen");z.appendChild(q)}function g(f){c();q.innerHTML='<div style="padding-top:13vh;"><div style="margin:auto;max-width:450px;border:6px double black;text-align:center;padding:20px;"><h2><img width="32" height="32" style="vertical-align:middle;" src="'+
Qa+'">&emsp;Allow JavaScript</h2><p style="font-family:monospace;text-decoration:underline;word-wrap:break-word;" class="_eaglercraftX_permission_target_url"></p><h4 style="line-height:1.4em;">Strict CSP: '+(1!==f.contentMode?'<span style="color:red;">Impossible</span>':C&&P?f.strictCSPEnable?'<span style="color:green;">Enabled</span>':'<span style="color:red;">Disabled</span>':'<span style="color:red;">Unsupported</span>')+"&ensp;|&ensp;Message API: "+(f.serverMessageAPIEnabled?'<span style="color:red;">Enabled</span>':
'<span style="color:green;">Disabled</span>')+'</h4><p><input class="_eaglercraftX_remember_javascript" type="checkbox" checked> Remember my choice</p><p><button style="font-size:1.5em;" class="_eaglercraftX_allow_javascript">Allow</button>&emsp;<button style="font-size:1.5em;" class="_eaglercraftX_block_javascript">Block</button></p></div></div>';const u=m;if(1!==f.contentMode){const A=f.url;q.querySelector("._eaglercraftX_permission_target_url").innerText=255<A.length()?A.substring(0,253)+"...":
A}q.querySelector("._eaglercraftX_allow_javascript").addEventListener("click",function(){if(m===u&&null!==q){const A=q.querySelector("._eaglercraftX_remember_javascript");null!==A&&A.checked&&W(3,2,null);q.remove();q=null;++m;d(f)}});q.querySelector("._eaglercraftX_block_javascript").addEventListener("click",function(){if(m===u&&null!==q){const A=q.querySelector("._eaglercraftX_remember_javascript");null!==A&&A.checked&&W(3,3,null);h(f)}})}function h(f){c();q.innerHTML='<div style="padding-top:13vh;"><h1 style="text-align:center;"><img width="48" height="48" style="vertical-align:middle;" src="'+
Qa+'">&emsp;Content Blocked</h1><h4 style="text-align:center;">You chose to block JavaScript execution for this embed</h4><p style="text-align:center;"><button style="font-size:1.0em;" class="_eaglercraftX_re_evaluate_javascript">Re-evaluate</button></p></div>';const u=m;q.querySelector("._eaglercraftX_re_evaluate_javascript").addEventListener("click",function(){m===u&&null!==q&&(W(3,4,null),g(f))})}function v(f,u,A,F){if(z){const L=window.devicePixelRatio;z.style.top=""+u/L+"px";z.style.left=""+
f/L+"px";z.style.width=""+(A/L-10)+"px";z.style.height=""+(F/L-10)+"px"}}function I(){++m;p&&(p.remove(),p=null);y=null;q&&(q.remove(),q=null);z&&(z.remove(),z=null);window.focus()}const x=new TextDecoder("utf-8");var w=!1,C=!1,E=ib,P=jb;if(E)C=w=!0;else{C=w=!1;try{var Q=document.createElement("iframe");w=null!=Q&&"string"===typeof Q.allow&&"object"===typeof Q.sandbox;C=P&&w&&"string"===typeof Q.csp}catch(f){k("Error checking iframe support"),k(f)}}w?!C&&P&&ka("This browser does not support CSP attribute on iframes! (try Chrome)"):
k("This browser does not meet the safety requirements for webview support, this feature will be disabled");const t=location.protocol&&"https:"===location.protocol.toLowerCase();var m=0,z=null,q=null,p=null,y=null;window.addEventListener("message",function(f){y&&f.source!==window&&y(f)});Da.checkSupported=function(){return w};Da.checkCSPSupported=function(){return C};Da.sendStringMessage=function(f,u){try{var A;null!=p&&null!=(A=p.contentWindow)?A.postMessage({ver:1,channel:f,type:"string",data:u},
"*"):k("Server tried to send the WebView a message, but the message channel is not open!")}catch(F){la("Failed to send string message to WebView!",F)}};Da.sendBinaryMessage=function(f,u){try{var A;if(null!=p&&null!=(A=p.contentWindow)){const F=new Uint8Array(u.length);F.set(u,0);A.postMessage({ver:1,channel:f,type:"binary",data:F.buffer},"*")}else k("Server tried to send the WebView a message, but the message channel is not open!")}catch(F){la("Failed to send string message to WebView!",F)}};Da.beginShowing=
function(f,u,A,F,L,Y){if(w)try{switch(null!==z&&I(),z=document.createElement("div"),z.classList.add("_eaglercraftX_webview_container_element"),z.style.border="5px solid #333333",z.style.zIndex="11",z.style.position="absolute",z.style.backgroundColor="#DDDDDD",z.style.fontFamily="sans-serif",v(A,F,L,Y),S.appendChild(z),f){case 0:d(u);break;case 1:if(1===u.contentMode){const U=new Uint8Array(u.blob.length);U.set(u.blob,0);u.blob=U}g(u);break;case 2:if(1===u.contentMode){const U=new Uint8Array(u.blob.length);
U.set(u.blob,0);u.blob=U}h(u)}}catch(U){la("Failed to begin showing WebView!",U)}};Da.resize=v;Da.endShowing=I};var Dc=null,Ec=!1;
function Sb(){var a=null;const b=new ra;var d=null;Ea.startIntegratedServer=new WebAssembly.Suspending(async function(){d||=URL.createObjectURL(new Blob(['"use strict"; (function(ctx, globals) {globals.__eaglerXOnMessage = function(o) {globals.__eaglerXOnMessage = function(oo) { console.error("Dropped IPC packet that was sent too early!"); };const eagRuntimeJSURL = URL.createObjectURL(new Blob([ o.eagruntimeJS ], { type: "text/javascript;charset=utf-8" }));ctx.getEaglercraftXOpts = function() { return o.eaglercraftXOpts; };ctx.getEagRuntimeJSURL = function() { return eagRuntimeJSURL; };ctx.getClassesWASMURL = function() { return o.classesWASM; };ctx.getClassesDeobfWASMURL = function() { return o.classesDeobfWASM; };ctx.getClassesTEADBGURL = function() { return o.classesTEADBG; };ctx.getEPKFiles = function() { return null; };ctx.getRootElement = function() { return null; };ctx.getMainArgs = function() { return ["_worker_process_"]; };ctx.getImageURL = function(idx) { return null; };ctx.runMain = function(mainFunc) { mainFunc(); };importScripts(eagRuntimeJSURL);};addEventListener("message", function(evt) { globals.__eaglerXOnMessage(evt.data); });})(self.__eaglercraftXLoaderContext = {}, self);'],{type:"text/javascript;charset=utf8"}));
try{a=new Worker(d)}catch(h){return la("Failed to create worker",h),!1}a.addEventListener("error",function(h){la("Worker Error",h.error)});a.addEventListener("message",function(h){const v=h.data.ch;v?"~!LOGGER"===v?Lb(h.data.txt,h.data.err):(h=h.data.dat)?$a(v,h)||b.push({ch:v,data:new Uint8Array(h),_next:null}):k("Recieved IPC packet with null buffer"):k("Recieved IPC packet with null channel")});const c=new Int8Array(Ja.length);c.set(Ja,0);try{var g=await fetch(Ra,{cache:"force-cache"}).then(h=>
h.arrayBuffer())}catch(h){la("Failed to fetch eagruntime.js contents",h);try{a.terminate()}catch(v){}return!1}a.postMessage({eaglercraftXOpts:O,eagruntimeJS:g,classesWASM:Ha,classesDeobfWASM:Ia,classesTEADBG:c.buffer});return!0});Ea.sendPacket=function(c,g){if(a){const h=new Uint8Array(g.length);h.set(g,0);a.postMessage({ch:c,dat:h.buffer},[h.buffer])}};ab=function(c,g){a&&a.postMessage({ch:c,dat:g},[g])};Ea.getAvailablePackets=b.K.bind(b);Ea.getNextPacket=b.j.bind(b);Ea.killWorker=function(){a&&
(a.terminate(),a=null)};Ea.showCrashReportOverlay=function(c,g,h,v,I){Dc||(Dc=document.createElement("div"),Dc.setAttribute("style","z-index:99;position:absolute;background-color:black;color:white;overflow-x:hidden;overflow-y:scroll;overflow-wrap:break-word;white-space:pre-wrap;font:18px sans-serif;padding:20px;display:none;"),Dc.classList.add("_eaglercraftX_integratedserver_crash_element"),S.appendChild(Dc));Dc.innerText="";Dc.innerText="CURRENT DATE: "+(new Date).toLocaleString()+"\n\n"+c;c=window.devicePixelRatio;
Dc.style.top=""+h/c+"px";Dc.style.left=""+g/c+"px";Dc.style.width=""+(v/c-20)+"px";Dc.style.height=""+(I/c-20)+"px";Dc.style.display="block";Ec=!0};Ea.hideCrashReportOverlay=function(){Dc&&(Dc.style.display="none");Ec=!1};window.__curEaglerX188UnloadListenerCB=function(){a&&a.postMessage({ch:"~!WASM_AUTOSAVE"})}};var ec=null,Tc=!1;
function Zb(){const a=new ra;self.__eaglerXOnMessage=function(b){const d=b.ch;b=b.dat;d?"~!WASM_AUTOSAVE"===d?Tc=!0:b?a.push({ch:d,data:new Uint8Array(b),_next:null}):k("Recieved IPC packet with null buffer"):k("Recieved IPC packet with null channel")};Ga.sendPacket=function(b,d){const c=new Uint8Array(d.length);c.set(d,0);postMessage({ch:b,dat:c.buffer},[c.buffer])};Ga.getAvailablePackets=a.K.bind(a);Ga.getNextPacket=a.j.bind(a);Ga.setCrashCallback=function(){return{call:function(b){ec=b}}};Ga.isTabAboutToClose=
function(){const b=Tc;Tc=!1;return b}};sa.getByteBufferView=function(a,b){return new Int8Array(Ya,a,b)};sa.getUnsignedByteBufferView=function(a,b){return new Uint8Array(Ya,a,b)};sa.getUnsignedClampedByteBufferView=function(a,b){return new Uint8ClampedArray(Ya,a,b)};sa.getShortBufferView=function(a,b){return new Int16Array(Ya,a,b)};sa.getUnsignedShortBufferView=function(a,b){return new Uint16Array(Ya,a,b)};sa.getIntBufferView=function(a,b){return new Int32Array(Ya,a,b)};sa.getFloatBufferView=function(a,b){return new Float32Array(Ya,a,b)};const Uc={172351395:{name:"EBML",type:"Container"},646:{name:"EBMLVersion",type:"Uint"},759:{name:"EBMLReadVersion",type:"Uint"},754:{name:"EBMLMaxIDLength",type:"Uint"},755:{name:"EBMLMaxSizeLength",type:"Uint"},642:{name:"DocType",type:"String"},647:{name:"DocTypeVersion",type:"Uint"},645:{name:"DocTypeReadVersion",type:"Uint"},108:{name:"Void",type:"Binary"},63:{name:"CRC-32",type:"Binary"},190023271:{name:"SignatureSlot",type:"Container"},16010:{name:"SignatureAlgo",type:"Uint"},16026:{name:"SignatureHash",
type:"Uint"},16037:{name:"SignaturePublicKey",type:"Binary"},16053:{name:"Signature",type:"Binary"},15963:{name:"SignatureElements",type:"Container"},15995:{name:"SignatureElementList",type:"Container"},9522:{name:"SignedElement",type:"Binary"},139690087:{name:"Segment",type:"Container"},21863284:{name:"SeekHead",type:"Container"},3515:{name:"Seek",type:"Container"},5035:{name:"SeekID",type:"Binary"},5036:{name:"SeekPosition",type:"Uint"},88713574:{name:"Info",type:"Container"},13220:{name:"SegmentUID",
type:"Binary"},13188:{name:"SegmentFilename",type:"String"},1882403:{name:"PrevUID",type:"Binary"},1868715:{name:"PrevFilename",type:"String"},2013475:{name:"NextUID",type:"Binary"},1999803:{name:"NextFilename",type:"String"},1092:{name:"SegmentFamily",type:"Binary"},10532:{name:"ChapterTranslate",type:"Container"},10748:{name:"ChapterTranslateEditionUID",type:"Uint"},10687:{name:"ChapterTranslateCodec",type:"Uint"},10661:{name:"ChapterTranslateID",type:"Binary"},710577:{name:"TimecodeScale",type:"Uint"},
1161:{name:"Duration",type:"Float"},1121:{name:"DateUTC",type:"Date"},15273:{name:"Title",type:"String"},3456:{name:"MuxingApp",type:"String"},5953:{name:"WritingApp",type:"String"},103:{name:"Timecode",type:"Uint"},6228:{name:"SilentTracks",type:"Container"},6359:{name:"SilentTrackNumber",type:"Uint"},39:{name:"Position",type:"Uint"},43:{name:"PrevSize",type:"Uint"},35:{name:"SimpleBlock",type:"Binary"},32:{name:"BlockGroup",type:"Container"},33:{name:"Block",type:"Binary"},34:{name:"BlockVirtual",
type:"Binary"},13729:{name:"BlockAdditions",type:"Container"},38:{name:"BlockMore",type:"Container"},110:{name:"BlockAddID",type:"Uint"},37:{name:"BlockAdditional",type:"Binary"},27:{name:"BlockDuration",type:"Uint"},122:{name:"ReferencePriority",type:"Uint"},123:{name:"ReferenceBlock",type:"Int"},125:{name:"ReferenceVirtual",type:"Int"},36:{name:"CodecState",type:"Binary"},13730:{name:"DiscardPadding",type:"Int"},14:{name:"Slices",type:"Container"},104:{name:"TimeSlice",type:"Container"},76:{name:"LaceNumber",
type:"Uint"},77:{name:"FrameNumber",type:"Uint"},75:{name:"BlockAdditionID",type:"Uint"},78:{name:"Delay",type:"Uint"},79:{name:"SliceDuration",type:"Uint"},72:{name:"ReferenceFrame",type:"Container"},73:{name:"ReferenceOffset",type:"Uint"},74:{name:"ReferenceTimeCode",type:"Uint"},47:{name:"EncryptedBlock",type:"Binary"},106212971:{name:"Tracks",type:"Container"},46:{name:"TrackEntry",type:"Container"},87:{name:"TrackNumber",type:"Uint"},13253:{name:"TrackUID",type:"Uint"},3:{name:"TrackType",type:"Uint"},
57:{name:"FlagEnabled",type:"Uint"},8:{name:"FlagDefault",type:"Uint"},5546:{name:"FlagForced",type:"Uint"},28:{name:"FlagLacing",type:"Uint"},11751:{name:"MinCache",type:"Uint"},11768:{name:"MaxCache",type:"Uint"},254851:{name:"DefaultDuration",type:"Uint"},216698:{name:"DefaultDecodedFieldDuration",type:"Uint"},209231:{name:"TrackTimecodeScale",type:"Float"},4991:{name:"TrackOffset",type:"Int"},5614:{name:"MaxBlockAdditionID",type:"Uint"},4974:{name:"Name",type:"String"},177564:{name:"Language",
type:"String"},6:{name:"CodecID",type:"String"},9122:{name:"CodecPrivate",type:"Binary"},362120:{name:"CodecName",type:"String"},13382:{name:"AttachmentLink",type:"Uint"},1742487:{name:"CodecSettings",type:"String"},1785920:{name:"CodecInfoURL",type:"String"},438848:{name:"CodecDownloadURL",type:"String"},42:{name:"CodecDecodeAll",type:"Uint"},12203:{name:"TrackOverlay",type:"Uint"},5802:{name:"CodecDelay",type:"Uint"},5819:{name:"SeekPreRoll",type:"Uint"},9764:{name:"TrackTranslate",type:"Container"},
9980:{name:"TrackTranslateEditionUID",type:"Uint"},9919:{name:"TrackTranslateCodec",type:"Uint"},9893:{name:"TrackTranslateTrackID",type:"Binary"},96:{name:"Video",type:"Container"},26:{name:"FlagInterlaced",type:"Uint"},5048:{name:"StereoMode",type:"Uint"},5056:{name:"AlphaMode",type:"Uint"},5049:{name:"OldStereoMode",type:"Uint"},48:{name:"PixelWidth",type:"Uint"},58:{name:"PixelHeight",type:"Uint"},5290:{name:"PixelCropBottom",type:"Uint"},5307:{name:"PixelCropTop",type:"Uint"},5324:{name:"PixelCropLeft",
type:"Uint"},5341:{name:"PixelCropRight",type:"Uint"},5296:{name:"DisplayWidth",type:"Uint"},5306:{name:"DisplayHeight",type:"Uint"},5298:{name:"DisplayUnit",type:"Uint"},5299:{name:"AspectRatioType",type:"Uint"},963876:{name:"ColourSpace",type:"Binary"},1029411:{name:"GammaValue",type:"Float"},230371:{name:"FrameRate",type:"Float"},97:{name:"Audio",type:"Container"},53:{name:"SamplingFrequency",type:"Float"},14517:{name:"OutputSamplingFrequency",type:"Float"},31:{name:"Channels",type:"Uint"},15739:{name:"ChannelPositions",
type:"Binary"},8804:{name:"BitDepth",type:"Uint"},98:{name:"TrackOperation",type:"Container"},99:{name:"TrackCombinePlanes",type:"Container"},100:{name:"TrackPlane",type:"Container"},101:{name:"TrackPlaneUID",type:"Uint"},102:{name:"TrackPlaneType",type:"Uint"},105:{name:"TrackJoinBlocks",type:"Container"},109:{name:"TrackJoinUID",type:"Uint"},64:{name:"TrickTrackUID",type:"Uint"},65:{name:"TrickTrackSegmentUID",type:"Binary"},70:{name:"TrickTrackFlag",type:"Uint"},71:{name:"TrickMasterTrackUID",
type:"Uint"},68:{name:"TrickMasterTrackSegmentUID",type:"Binary"},11648:{name:"ContentEncodings",type:"Container"},8768:{name:"ContentEncoding",type:"Container"},4145:{name:"ContentEncodingOrder",type:"Uint"},4146:{name:"ContentEncodingScope",type:"Uint"},4147:{name:"ContentEncodingType",type:"Uint"},4148:{name:"ContentCompression",type:"Container"},596:{name:"ContentCompAlgo",type:"Uint"},597:{name:"ContentCompSettings",type:"Binary"},4149:{name:"ContentEncryption",type:"Container"},2017:{name:"ContentEncAlgo",
type:"Uint"},2018:{name:"ContentEncKeyID",type:"Binary"},2019:{name:"ContentSignature",type:"Binary"},2020:{name:"ContentSigKeyID",type:"Binary"},2021:{name:"ContentSigAlgo",type:"Uint"},2022:{name:"ContentSigHashAlgo",type:"Uint"},206814059:{name:"Cues",type:"Container"},59:{name:"CuePoint",type:"Container"},51:{name:"CueTime",type:"Uint"},55:{name:"CueTrackPositions",type:"Container"},119:{name:"CueTrack",type:"Uint"},113:{name:"CueClusterPosition",type:"Uint"},112:{name:"CueRelativePosition",type:"Uint"},
50:{name:"CueDuration",type:"Uint"},4984:{name:"CueBlockNumber",type:"Uint"},106:{name:"CueCodecState",type:"Uint"},91:{name:"CueReference",type:"Container"},22:{name:"CueRefTime",type:"Uint"},23:{name:"CueRefCluster",type:"Uint"},4959:{name:"CueRefNumber",type:"Uint"},107:{name:"CueRefCodecState",type:"Uint"},155296873:{name:"Attachments",type:"Container"},8615:{name:"AttachedFile",type:"Container"},1662:{name:"FileDescription",type:"String"},1646:{name:"FileName",type:"String"},1632:{name:"FileMimeType",
type:"String"},1628:{name:"FileData",type:"Binary"},1710:{name:"FileUID",type:"Uint"},1653:{name:"FileReferral",type:"Binary"},1633:{name:"FileUsedStartTime",type:"Uint"},1634:{name:"FileUsedEndTime",type:"Uint"},4433776:{name:"Chapters",type:"Container"},1465:{name:"EditionEntry",type:"Container"},1468:{name:"EditionUID",type:"Uint"},1469:{name:"EditionFlagHidden",type:"Uint"},1499:{name:"EditionFlagDefault",type:"Uint"},1501:{name:"EditionFlagOrdered",type:"Uint"},54:{name:"ChapterAtom",type:"Container"},
13252:{name:"ChapterUID",type:"Uint"},5716:{name:"ChapterStringUID",type:"String"},17:{name:"ChapterTimeStart",type:"Uint"},18:{name:"ChapterTimeEnd",type:"Uint"},24:{name:"ChapterFlagHidden",type:"Uint"},1432:{name:"ChapterFlagEnabled",type:"Uint"},11879:{name:"ChapterSegmentUID",type:"Binary"},11964:{name:"ChapterSegmentEditionUID",type:"Uint"},9155:{name:"ChapterPhysicalEquiv",type:"Uint"},15:{name:"ChapterTrack",type:"Container"},9:{name:"ChapterTrackNumber",type:"Uint"},0:{name:"ChapterDisplay",
type:"Container"},5:{name:"ChapString",type:"String"},892:{name:"ChapLanguage",type:"String"},894:{name:"ChapCountry",type:"String"},10564:{name:"ChapProcess",type:"Container"},10581:{name:"ChapProcessCodecID",type:"Uint"},1293:{name:"ChapProcessPrivate",type:"Binary"},10513:{name:"ChapProcessCommand",type:"Container"},10530:{name:"ChapProcessTime",type:"Uint"},10547:{name:"ChapProcessData",type:"Binary"},39109479:{name:"Tags",type:"Container"},13171:{name:"Tag",type:"Container"},9152:{name:"Targets",
type:"Container"},10442:{name:"TargetTypeValue",type:"Uint"},9162:{name:"TargetType",type:"String"},9157:{name:"TagTrackUID",type:"Uint"},9161:{name:"TagEditionUID",type:"Uint"},9156:{name:"TagChapterUID",type:"Uint"},9158:{name:"TagAttachmentUID",type:"Uint"},10184:{name:"SimpleTag",type:"Container"},1443:{name:"TagName",type:"String"},1146:{name:"TagLanguage",type:"String"},1156:{name:"TagDefault",type:"Uint"},1159:{name:"TagString",type:"String"},1157:{name:"TagBinary",type:"Binary"}};
function Vc(a,b){a.prototype=Object.create(b.prototype);a.prototype.constructor=a}function Wc(a,b){this.name=a||"Unknown";this.type=b||"Unknown"}Wc.prototype.j=function(){};Wc.prototype.m=function(){};function Xc(a,b){Wc.call(this,a,b||"Uint")}Vc(Xc,Wc);Xc.prototype.j=function(){this.data="";for(var a=0;a<this.source.length;a++){var b=this.source[a].toString(16);this.data+=1===b.length%2?"0"+b:b}};
Xc.prototype.m=function(){var a=this.data.length/2;this.source=new Uint8Array(a);for(var b=0;b<a;b++)this.source[b]=parseInt(this.data.substr(2*b,2),16)};Xc.prototype.L=function(){return parseInt(this.data,16)};Xc.prototype.H=function(a){a=a.toString(16);this.data=1===a.length%2?"0"+a:a;this.m()};function Yc(a,b){Wc.call(this,a,b||"Float")}Vc(Yc,Wc);Yc.prototype.j=function(){var a=this.source.reverse();this.data=(new (this.source&&4===this.source.length?Float32Array:Float64Array)(a.buffer))[0]};
Yc.prototype.m=function(){var a=new (this.source&&4===this.source.length?Float32Array:Float64Array)([this.data]);this.source=(new Uint8Array(a.buffer)).reverse()};Yc.prototype.L=function(){return this.data};Yc.prototype.H=function(a){this.data=a;this.m()};function Zc(a,b){Wc.call(this,a,b||"Container")}Vc(Zc,Wc);function $c(a){var b=a.source[a.offset++],d=8-b.toString(2).length;b-=1<<7-d;for(var c=0;c<d;c++)b*=256,b+=a.source[a.offset++];return b}
Zc.prototype.j=function(){this.data=[];for(this.offset=0;this.offset<this.source.length;this.offset=b){var a=$c(this);var b=$c(this);b=Math.min(this.offset+b,this.source.length);var d=this.source.slice(this.offset,b),c=Uc[a]||{name:"Unknown",type:"Unknown"},g=Wc;switch(c.type){case "Container":g=Zc;break;case "Uint":g=Xc;break;case "Float":g=Yc}g=c=new g(c.name,c.type);g.source=d;g.j();this.data.push({id:a,$:a.toString(16),data:c})}};
function ad(a,b,d){for(var c=1,g=128;b>=g&&8>c;c++,g*=128);if(!d)for(b=g+b,d=c-1;0<=d;d--)g=b%256,a.source[a.offset+d]=g,b=(b-g)/256;a.offset+=c}function bd(a,b){for(var d=a.offset=0;d<a.data.length;d++){var c=a.data[d],g=c.data.source,h=g.length;ad(a,c.id,b);ad(a,h,b);b||a.source.set(g,a.offset);a.offset+=h}return a.offset}Zc.prototype.m=function(){var a=bd(this,"draft");this.source=new Uint8Array(a);bd(this,null)};
function cd(a,b){for(var d=0;d<a.data.length;d++){var c=a.data[d];if(c.id===b)return c.data}return null}function dd(a){Zc.call(this,"File","File");this.source=a;this.j()}Vc(dd,Zc);
function ed(a,b,d){d=d&&d.U;void 0===d?d=function(I){console.log(I)}:d||=function(){};var c=cd(a,139690087);if(!c)return d("[fix-webm-duration] Segment section is missing"),!1;var g=cd(c,88713574);if(!g)return d("[fix-webm-duration] Info section is missing"),!1;var h=cd(g,710577);if(!h)return d("[fix-webm-duration] TimecodeScale section is missing"),!1;var v=cd(g,1161);if(v)if(0>=v.L())d("[fix-webm-duration] Duration section is present, but the value is empty"),v.H(b);else return d("[fix-webm-duration] Duration section is present"),
!1;else d("[fix-webm-duration] Duration section is missing"),v=new Yc("Duration","Float"),v.H(b),g.data.push({id:1161,data:v});h.H(1E6);g.m();c.m();a.m();return!0}function Sc(a,b,d,c){try{var g=new FileReader;g.onloadend=function(){try{var h=new dd(new Uint8Array(g.result));ed(h,b,c)&&(a=new Blob([h.source.buffer],{type:a.type||"video/webm"}))}catch(v){}d(a)};g.readAsArrayBuffer(a)}catch(h){d(a)}};var fd;
(function(){function a(t){let m=C.get(t);"undefined"===typeof m&&(m=new Function("return "+t+";"),C.set(t,m));return m()}function b(t){let m={exports:null,B:null,I:null};d(t);c(t);g(t,m);h(t,m);t.teavmMath=Math;return{O(z){m.exports=z},Y(z){m.B=z},X(z){m.I=z}}}function d(t){t.teavmDate={currentTimeMillis:()=>(new Date).getTime(),dateToString:m=>(new Date(m)).toString(),getYear:m=>(new Date(m)).getFullYear(),setYear:(m,z)=>{m=new Date(m);m.setFullYear(z);return m.getTime()},getMonth:m=>(new Date(m)).getMonth(),setMonth:(m,
z)=>{m=new Date(m);m.setMonth(z);return m.getTime()},getDate:m=>(new Date(m)).getDate(),setDate:(m,z)=>{m=new Date(m);m.setDate(z);return m.getTime()},create:(m,z,q,p,y,f)=>(new Date(m,z,q,p,y,f)).getTime(),createFromUTC:(m,z,q,p,y,f)=>Date.UTC(m,z,q,p,y,f)}}function c(t){let m=[],z=[];t.teavmConsole={putcharStderr:function(q){10===q?(q=String.fromCharCode(...m),console.error(q),fa&&fa(q,!0),m.length=0):m.push(q)},putcharStdout:function(q){10===q?(q=String.fromCharCode(...z),console.log(q),fa&&fa(q,
!1),z.length=0):z.push(q)}}}function g(t,m){let z=new FinalizationRegistry(p=>{let y=m.exports["teavm.reportGarbageCollectedValue"];"undefined"!==typeof y&&m.I(function(){y(p.V,p.W)})}),q=new FinalizationRegistry(p=>{let y=m.exports["teavm.reportGarbageCollectedString"];"function"===typeof y&&m.I(function(){y(p)})});t.teavm={createWeakRef:(p,y,f)=>{null!==f&&z.register(p,{W:y,V:f});return new WeakRef(p)},deref:p=>p.deref(),createStringWeakRef:(p,y)=>{q.register(p,y);return new WeakRef(p)},stringDeref:p=>
p.deref(),takeStackTrace:()=>{var p=Error().stack;let y=[];for(let f of p.split("\n"))p=E.exec(f),null!==p&&2<=p.length&&y.push(parseInt(p[1],16));return{getStack:function(){let f;if(m.B)try{f=m.B(y)}catch(u){console.warn("Could not deobfuscate stack",u)}f||=y.map(u=>({className:"java.lang.Throwable$FakeClass",method:"fakeMethod",file:"Throwable.java",line:u}));return f}}},decorateException:p=>{new Q(m,p)}}}function h(t,m){function z(n){return n}function q(n){var r=n.charAt(0);var G=""+(p(r)?r:"_");
for(r=1;r<n.length;++r){let V=n.charAt(r);var M=V;M=p(M)||"0"<=M&&"9">=M;G+=M?V:"_"}return G}function p(n){return"A"<=n&&"Z">=n||"a"<=n&&"z">=n||"_"===n||"$"===n}function y(n,r,G){null===n?(new Function("value",r+" = value;"))(G):n[r]=G}function f(n){m.exports["teavm.js.throwException"](P in n?n[P]:m.exports["teavm.js.wrapException"](n))}function u(n){a:{if(n instanceof WebAssembly.Exception){var r=m.exports["teavm.javaException"];var G=m.exports["teavm.getJsException"];if(n.is(r)){n=n.getArg(r,0);
r=m.exports["teavm.js.extractException"](n);if(null!==r){G=r;break a}G=G(n);"undefined"===typeof G&&(G=new Q(m,n));break a}}G=n}throw G;}function A(n){var r=[];for(let G=0;G<n.length;++G)r.push("p"+G);r=0===r.length?"":r.join(", ");r=(new Function("rethrowJavaAsJs","fn",`return function(${r}) {\n`+"    try {\n"+`        return fn(${r});\n`+"    } catch (e) {\n        rethrowJavaAsJs(e);\n    }\n};"))(u,n);r.__impl=n;r.__rethrow=u;return r}function F(n,r){return(new Function("constructor",`return function ${n}(marker, javaObject) {\n`+
"    return constructor.call(this, marker, javaObject);\n}\n"))(r)}function L(n){try{return n()}catch(r){f(r)}}let Y=Symbol("javaObject"),U=Symbol("functions"),Z=Symbol("functionOrigin"),La=Symbol("wrapperCallMarker"),gb=new WeakMap,Fa=new WeakMap,za=new Map,Ma=new FinalizationRegistry(n=>za.delete(n)),Wa=new WeakMap,va=2463534242;t.teavmJso={emptyString:()=>"",stringFromCharCode:n=>String.fromCharCode(n),concatStrings:(n,r)=>n+r,stringLength:n=>n.length,charAt:(n,r)=>n.charCodeAt(r),emptyArray:()=>
[],appendToArray:(n,r)=>n.push(r),unwrapBoolean:n=>n?1:0,wrapBoolean:n=>!!n,getProperty:function(n,r){try{return null!==n?n[r]:a(r)}catch(G){f(G)}},setProperty:y,setPropertyPure:y,global:n=>{try{return a(n)}catch(r){f(r)}},createClass:(n,r,G)=>{n=q(n||"JavaObject");let M;M=null===r?function(ca){this[Y]=ca;this[U]=null}:function(ca){r.call(this,ca)};let V=F(n,function(ca,wa){if(ca===La)M.call(this,wa);else{if(null===G)throw Error("This class can't be instantiated directly");try{return G.apply(null,
arguments)}catch(Xa){u(Xa)}}});V.prototype=Object.create(r||Object.prototype);V.prototype.constructor=V;n=F(n,function(ca){return V.call(this,La,ca)});n[La]=V;n.prototype=V.prototype;return n},exportClass:n=>n[La],defineMethod:(n,r,G)=>{let M=[];for(let V=1;V<G.length;++V)M.push("p"+V);n.prototype[r]=(new Function("rethrowJavaAsJs","fn",`return function(${0===M.length?"":M.join(", ")}) {\n`+"    try {\n"+`        return fn(${["this",M].join(", ")});\n`+"    } catch (e) {\n        rethrowJavaAsJs(e);\n    }\n};"))(u,
G)},defineStaticMethod:(n,r,G)=>{n[r]=A(G)},defineFunction:A,defineProperty:(n,r,G,M)=>{let V={get(){try{return G(this)}catch(ca){u(ca)}}};null!==M&&(V.set=function(ca){try{M(this,ca)}catch(wa){u(wa)}});Object.defineProperty(n.prototype,r,V)},defineStaticProperty:(n,r,G,M)=>{let V={get(){try{return G()}catch(ca){u(ca)}}};null!==M&&(V.set=function(ca){try{M(ca)}catch(wa){u(wa)}});Object.defineProperty(n,r,V)},javaObjectToJS:(n,r)=>{if(null===n)return null;var G=gb.get(n);if("undefined"!=typeof G&&
(G=G.deref(),"undefined"!==typeof G))return G;r=new r(n);gb.set(n,new WeakRef(r));return r},unwrapJavaObject:n=>n[Y],asFunction:(n,r)=>{let G=n[U];null===G&&(G=Object.create(null),n[U]=G);let M=G[r];"function"!==typeof M&&(M=function(){return n[r].apply(n,arguments)},M[Z]=n,G[r]=M);return M},functionAsObject:(n,r)=>{let G=n[Z];if("undefined"!==typeof G){let M=G[U];if(void 0!==M&&M[r]===n)return G}return{[r]:function(...M){try{return n(...M)}catch(V){u(V)}}}},wrapObject:n=>{if(null===n)return null;
if("object"===typeof n||"function"===typeof n){var r=n[Y];if("object"===typeof r)return r;r=Fa.get(n);if(void 0!==r&&(r=r.deref(),void 0!==r))return r;r=m.exports["teavm.jso.createWrapper"](n);Fa.set(n,new WeakRef(r));return r}r=za.get(n);if(void 0!==r&&(r=r.deref(),void 0!==r))return r;r=m.exports["teavm.jso.createWrapper"](n);za.set(n,new WeakRef(r));Ma.register(r,n);return r},isPrimitive:(n,r)=>typeof n===r,instanceOf:(n,r)=>n instanceof r,instanceOfOrNull:(n,r)=>null===n||n instanceof r,sameRef:(n,
r)=>n===r,hashCode:n=>{if("object"===typeof n||"function"===typeof n||"symbol"===typeof n){var r=Wa.get(n);if("number"===typeof r)return r;r=va;r^=r<<13;r^=r>>>17;va=r^=r<<5;Wa.set(n,r);return r}return"number"===typeof n?n|0:"bigint"===typeof n?BigInt.asIntN(32,n):"boolean"===typeof n?n?1:0:0},apply:(n,r,G)=>{try{return null===n?a(r)(...G):n[r](...G)}catch(M){f(M)}},concatArray:(n,r)=>n.concat(r),getJavaException:n=>n[P]};for(var ia of"wrapByte wrapShort wrapChar wrapInt wrapFloat wrapDouble unwrapByte unwrapShort unwrapChar unwrapInt unwrapFloat unwrapDouble".split(" "))t.teavmJso[ia]=
z;ia=[];for(let n=0;32>n;++n){let r=0===ia.length?"":ia.join(", "),G=[...ia,"body"].join(", ");t.teavmJso["createFunction"+n]=(new Function("wrapCallFromJavaToJs",...ia,"body",`return new Function('wrapCallFromJavaToJs', ${G}).bind(this, wrapCallFromJavaToJs);`)).bind(null,L);t.teavmJso["bindFunction"+n]=(M,...V)=>M.bind(null,...V);t.teavmJso["callFunction"+n]=(new Function("rethrowJsAsJava","fn",...ia,"try {\n"+`    return fn(${r});\n`+"} catch (e) {\n    rethrowJsAsJava(e);\n}")).bind(null,f);t.teavmJso["callMethod"+
n]=(new Function("rethrowJsAsJava","getGlobalName","instance","method",...ia,"try {\n     return instance !== null\n"+`        ? instance[method](${r})\n`+`        : getGlobalName(method)(${r});\n`+"} catch (e) {\n    rethrowJsAsJava(e);\n}")).bind(null,f,a);t.teavmJso["construct"+n]=(new Function("rethrowJsAsJava","constructor",...ia,"try {\n"+`    return new constructor(${r});\n`+"} catch (e) {\n    rethrowJsAsJava(e);\n}")).bind(null,f);t.teavmJso["arrayOf"+n]=new Function(...ia,"return ["+r+"]");
ia.push("p"+(n+1))}}async function v(t){try{const m={},z=b(m),q=t.path instanceof WebAssembly.Module?t.path:await WebAssembly.compileStreaming(fetch(t.path)),p=new WebAssembly.Instance(q,m);z.O(p.exports);return{module:q,instance:p}}catch(m){return console.warn("Could not load deobfuscator",m),null}}function I(t,m,z){let q=null,p=!1;return y=>{if(!p){p=!0;if(null!==m)try{q=z.exports.createFromExternalFile.value(m)}catch(f){console.warn("Could not load create deobfuscator",f)}if(null==q&&null!==t)try{q=
z.exports.createForModule.value(t)}catch(f){console.warn("Could not create deobfuscator from module data",f)}}return null!==q?q.deobfuscate(y):[]}}async function x(t,m){if(!m.enabled||"auto"!==t&&"external"!==t)return null;if(m.J instanceof ArrayBuffer)return new Int8Array(m.J);t=await fetch(m.J);return t.ok?new Int8Array(await t.arrayBuffer()):null}function w(t){const m=new ra;t.teavm.pollAsyncCallbacks=function(){for(var z;z=m.j();)z.fn()};return function(z){m.push({fn:z,_next:null})}}let C=new Map,
E=/.+:wasm-function\[[0-9]+]:0x([0-9a-f]+).*/,P=Symbol("javaException");class Q extends Error{constructor(t,m){super();this.j=t;this[P]=m;t.exports["teavm.setJsException"](m,this)}get message(){var t=this.j.exports["teavm.exceptionMessage"];return"function"===typeof t&&(t=t(this[P]),null!=t)?t:"(could not fetch message)"}}fd={load:async function(t,m){m||={};var z=m.B||{};let [q,p,y]=await Promise.all([z.enabled?v(z):Promise.resolve(null),t instanceof WebAssembly.Module?Promise.resolve(t):WebAssembly.compileStreaming(fetch(t)),
x(z.T,z)]);z={};t=b(z);"undefined"!==typeof m.M&&m.M(z);t.X(w(z));m=await WebAssembly.instantiate(p,z);z={};t.O(m.exports);if(q){let f=I(null,y,q.instance);null!==f&&(t.Y(f),z.deobfuscator=f)}t={exports:z,instance:m,N:{P:p,S:q?q.module:null}};for(let f in m.exports){let u=m.exports[f];u instanceof WebAssembly.Global?Object.defineProperty(z,f,{get:()=>u.value}):"function"===typeof u&&(z[f]=u)}z.memory=m.exports["teavm.memory"];z.R=y;return t},Z:b,aa:function(t){return new Proxy(t,{get(m,z){return new WebAssembly.Global({value:"externref",
mutable:!1},m[z])}})}}})();async function gd(){try{Error.stackTraceLimit=1024;O=self.__eaglercraftXLoaderContext.getEaglercraftXOpts();Ra=self.__eaglercraftXLoaderContext.getEagRuntimeJSURL();const a=self.__eaglercraftXLoaderContext.getClassesWASMURL(),b=self.__eaglercraftXLoaderContext.getClassesDeobfWASMURL(),d=self.__eaglercraftXLoaderContext.getClassesTEADBGURL();Na=self.__eaglercraftXLoaderContext.getEPKFiles();Sa=self.__eaglercraftXLoaderContext.getRootElement();self.__eaglercraftXLoaderContext.getImageURL(0);Oa=self.__eaglercraftXLoaderContext.getImageURL(1);
Pa=self.__eaglercraftXLoaderContext.getImageURL(2);Qa=self.__eaglercraftXLoaderContext.getImageURL(3);const c=self.__eaglercraftXLoaderContext.getMainArgs();delete self.__eaglercraftXLoaderContext;if("_worker_process_"!==c[0]){if(!await qb())return}else ea="worker",await Yb();e("Loading EaglercraftX WASM GC binary...");const g=await fd.load(a,{B:{enabled:!0,path:b,T:"external",J:d},M:function(h){h.WASMGCBufferAllocator=sa;h.platformApplication=H;h.platformAssets=ta;h.platformAudio=ua;h.platformFilesystem=
xa;h.platformInput=J;h.platformNetworking=ya;h.platformOpenGL=K;h.platformRuntime=Aa;h.platformScreenRecord=Ba;h.platformVoiceClient=Ca;h.platformWebRTC=N;h.platformWebView=Da;h.clientPlatformSingleplayer=Ea;h.serverPlatformSingleplayer=Ga;h.teavm.notifyHeapResized=function(){$b(g.exports.memory)}}});Ha=g.N.P;Ia=g.N.S;Ja=g.exports.R;$b(g.exports.memory);Ka=g.exports.deobfuscator;e("Calling entry point with args: {}",JSON.stringify(c));try{await WebAssembly.promising(g.exports.main.__impl)(c)}catch(h){g.exports.main.__rethrow(h)}finally{ka("Main function has returned!")}}catch(a){cc(a)}}
"object"===typeof self.__eaglercraftXLoaderContext?self.__eaglercraftXLoaderContext.runMain(gd):console.error("???");}).call(this);
