UNPKG

cloudpilot-emu-embedded

Version:

Embedded version of the CloudpilotEmu PalmOS emulator

1 lines 61.3 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.cloudpilot=t():e.cloudpilot=t()}(self,()=>(()=>{var e={84:(e,t,r)=>{"use strict";var n=r(360);t.J=n.default},360:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=[];r[0]=function(){return function(){}},r[1]=function(e,t){return void 0===t?e:function(r){e(r,t)}};var n=function(){function e(){this.hasHandlers=!1,this._handlers=[],this._contexts=[],this._createDispatcher()}return e.prototype.addHandler=function(e,t){return this.isHandlerAttached(e,t)||(this._handlers.push(e),this._contexts.push(t),this._createDispatcher(),this._updateHasHandlers()),this},e.prototype.removeHandler=function(e,t){var r=this._getHandlerIndex(e,t);return void 0!==r&&(this._handlers.splice(r,1),this._contexts.splice(r,1),this._createDispatcher(),this._updateHasHandlers()),this},e.prototype.isHandlerAttached=function(e,t){return void 0!==this._getHandlerIndex(e,t)},e.prototype._updateHasHandlers=function(){this.hasHandlers=!!this._handlers.length},e.prototype._getHandlerIndex=function(e,t){var r,n=this._handlers.length;for(r=0;r<n&&(this._handlers[r]!==e||this._contexts[r]!==t);r++);return r<n?r:void 0},e.prototype._createDispatcher=function(){var e;this.dispatch=(e=this._handlers.length,r[e]||(r[e]=function(e){for(var t="return function dispatcher"+e+"(payload) {\n",r=[],n=[],i=0;i<e;i++)r.push("cb"+i),n.push("ctx"+i),t+=" cb"+i+"(payload, ctx"+i+");\n";return t+="};",new(Function.bind.apply(Function,[void 0].concat(r.concat(n),[t])))}(e)),r[e]).apply(this,this._handlers.concat(this._contexts))},e}();t.default=n},426:e=>{var t,r=(t="undefined"!=typeof document?document.currentScript?.src:void 0,async function(e={}){var r=e,n="object"==typeof window,i="undefined"!=typeof WorkerGlobalScope,a=("object"==typeof process&&process.versions?.node&&process.type,"./this.program"),s=(e,t)=>{throw t};i&&(t=self.location.href);var o,p,c="";if(n||i){try{c=new URL(".",t).href}catch{}i&&(p=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=async e=>{var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)}}var u,d,_=console.log.bind(console),m=console.error.bind(console),h=!1;function l(e,t){e||M(t)}var y,S,f,b,g,v,D,P,U,G=!1;function I(){var e=f.buffer;b=new Int8Array(e),new Int16Array(e),r.HEAPU8=g=new Uint8Array(e),new Uint16Array(e),v=new Int32Array(e),r.HEAPU32=D=new Uint32Array(e),new Float32Array(e),P=new Float64Array(e),U=new BigInt64Array(e),new BigUint64Array(e)}var w,z=0,C=null;function M(e){r.onAbort?.(e),m(e="Aborted("+e+")"),h=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw S?.(t),t}async function k(e,t,r){if(!e&&"function"==typeof WebAssembly.instantiateStreaming)try{var n=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,r)}catch(e){m(`wasm streaming compile failed: ${e}`),m("falling back to ArrayBuffer instantiation")}return async function(e,t){try{var r=await async function(e){if(!u)try{var t=await o(e);return new Uint8Array(t)}catch{}return function(e){if(e==w&&u)return new Uint8Array(u);if(p)return p(e);throw"both async and sync fetching of the wasm failed"}(e)}(e);return await WebAssembly.instantiate(r,t)}catch(e){m(`failed to asynchronously prepare wasm: ${e}`),M(e)}}(t,r)}class N{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var E,F=e=>{for(;e.length>0;)e.shift()(r)},j=[],A=e=>j.push(e),T=[],B=e=>T.push(e),R=!0,H="undefined"!=typeof TextDecoder?new TextDecoder:void 0,L=(e,t=0,r=NaN)=>{for(var n=t+r,i=t;e[i]&&!(i>=n);)++i;if(i-t>16&&e.buffer&&H)return H.decode(e.subarray(t,i));for(var a="";t<i;){var s=e[t++];if(128&s){var o=63&e[t++];if(192!=(224&s)){var p=63&e[t++];if((s=224==(240&s)?(15&s)<<12|o<<6|p:(7&s)<<18|o<<12|p<<6|63&e[t++])<65536)a+=String.fromCharCode(s);else{var c=s-65536;a+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else a+=String.fromCharCode((31&s)<<6|o)}else a+=String.fromCharCode(s)}return a},x=(e,t)=>e?L(g,e,t):"",O=e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e),V=0,Q=[0,31,60,91,121,152,182,213,244,274,305,335],K=[0,31,59,90,120,151,181,212,243,273,304,334],$=e=>{var t;return((t=e.getFullYear())%4!=0||t%100==0&&t%400!=0?K:Q)[e.getMonth()]+e.getDate()-1},W={},Y=e=>{if(e instanceof N||"unwind"==e)return d;s(0,e)},J=()=>R||V>0,X=e=>{d=e,J()||(r.onExit?.(e),h=!0),s(0,new N(e))},Z=(e,t)=>{d=e,X(e)},q=Z,ee=()=>performance.now(),te=(e,t,r,n)=>{if(!(n>0))return 0;for(var i=r,a=r+n-1,s=0;s<e.length;++s){var o=e.codePointAt(s);if(o<=127){if(r>=a)break;t[r++]=o}else if(o<=2047){if(r+1>=a)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=a)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=a)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o,s++}}return t[r]=0,r-i},re=(e,t,r)=>te(e,g,t,r),ne=()=>Date.now(),ie=[],ae=(e,t)=>Math.ceil(e/t)*t,se=e=>{var t=(e-f.buffer.byteLength+65535)/65536|0;try{return f.grow(t),I(),1}catch(e){}},oe={},pe=()=>{if(!pe.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.language||"C").replace("-","_")+".UTF-8",_:a||"./this.program"};for(var t in oe)void 0===oe[t]?delete e[t]:e[t]=oe[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);pe.strings=r}return pe.strings},ce=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},ue=[null,[],[]],de=(e,t)=>{var r=ue[e];0===t||10===t?((1===e?_:m)(L(r)),r.length=0):r.push(t)},_e=[];r.noExitRuntime&&(R=r.noExitRuntime),r.print&&(_=r.print),r.printErr&&(m=r.printErr),r.wasmBinary&&(u=r.wasmBinary),r.arguments&&r.arguments,r.thisProgram&&(a=r.thisProgram),r.callMain=_r,r.wasmTable=E;var me,he,le,ye,Se,fe,be,ge,ve,De,Pe,Ue,Ge,Ie,we,ze,Ce,Me,ke,Ne,Ee,Fe,je,Ae,Te,Be,Re,He,Le,xe,Oe,Ve,Qe,Ke,$e,We,Ye,Je,Xe,Ze,qe,et,tt,rt,nt,it,at,st,ot,pt,ct,ut,dt,_t,mt,ht,lt,yt,St,ft,bt,gt,vt,Dt,Pt,Ut,Gt,It,wt,zt,Ct,Mt,kt,Nt,Et,Ft,jt,At,Tt,Bt,Rt,Ht,Lt,xt,Ot,Vt,Qt,Kt,$t,Wt,Yt,Jt,Xt,Zt,qt,er,tr,rr,nr,ir,ar,sr,or,pr,cr={72734:e=>{E.grow(65536);for(let t=0;t<=65535;t++)E.set(E.length-65535-1+t,E.get(D[(e>>>2)+t]));return E.length-65535-1}},ur={__assert_fail:(e,t,r,n)=>M(`Assertion failed: ${x(e)}, at: `+[t?x(t):"unknown filename",r,n?x(n):"unknown function"]),__emscripten_abort:function(){throw new Error("emulator terminated")},__syscall_ftruncate64:function(e,t){t=O(t)},_abort_js:()=>M(""),_emscripten_runtime_keepalive_clear:()=>{R=!1,V=0},_localtime_js:function(e,t){e=O(e);var r=new Date(1e3*e);v[t>>2]=r.getSeconds(),v[t+4>>2]=r.getMinutes(),v[t+8>>2]=r.getHours(),v[t+12>>2]=r.getDate(),v[t+16>>2]=r.getMonth(),v[t+20>>2]=r.getFullYear()-1900,v[t+24>>2]=r.getDay();var n=0|$(r);v[t+28>>2]=n,v[t+36>>2]=-60*r.getTimezoneOffset();var i=new Date(r.getFullYear(),0,1),a=new Date(r.getFullYear(),6,1).getTimezoneOffset(),s=i.getTimezoneOffset(),o=0|(a!=s&&r.getTimezoneOffset()==Math.min(s,a));v[t+32>>2]=o},_mktime_js:function(e){var t=(()=>{var t=new Date(v[e+20>>2]+1900,v[e+16>>2],v[e+12>>2],v[e+8>>2],v[e+4>>2],v[e>>2],0),r=v[e+32>>2],n=t.getTimezoneOffset(),i=new Date(t.getFullYear(),0,1),a=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=i.getTimezoneOffset(),o=Math.min(s,a);if(r<0)v[e+32>>2]=Number(a!=s&&o==n);else if(r>0!=(o==n)){var p=Math.max(s,a),c=r>0?o:p;t.setTime(t.getTime()+6e4*(c-n))}v[e+24>>2]=t.getDay();var u=0|$(t);v[e+28>>2]=u,v[e>>2]=t.getSeconds(),v[e+4>>2]=t.getMinutes(),v[e+8>>2]=t.getHours(),v[e+12>>2]=t.getDate(),v[e+16>>2]=t.getMonth(),v[e+20>>2]=t.getYear();var d=t.getTime();return isNaN(d)?-1:d/1e3})();return BigInt(t)},_setitimer_js:(e,t)=>{if(W[e]&&(clearTimeout(W[e].id),delete W[e]),!t)return 0;var r=setTimeout(()=>{delete W[e],(e=>{if(!h)try{e(),(()=>{if(!J())try{q(d)}catch(e){Y(e)}})()}catch(e){Y(e)}})(()=>pr(e,ee()))},t);return W[e]={id:r,timeout_ms:t},0},_tzset_js:(e,t,r,n)=>{var i=(new Date).getFullYear(),a=new Date(i,0,1),s=new Date(i,6,1),o=a.getTimezoneOffset(),p=s.getTimezoneOffset(),c=Math.max(o,p);D[e>>2]=60*c,v[t>>2]=Number(o!=p);var u=e=>{var t=e>=0?"-":"+",r=Math.abs(e);return`UTC${t}${String(Math.floor(r/60)).padStart(2,"0")}${String(r%60).padStart(2,"0")}`},d=u(o),_=u(p);p<o?(re(d,r,17),re(_,n,17)):(re(d,n,17),re(_,r,17))},clock_time_get:function(e,t,r){if(t=O(t),!((n=e)>=0&&n<=3))return 28;var n,i;i=0===e?ne():ee();var a=Math.round(1e3*i*1e3);return U[r>>3]=BigInt(a),0},emscripten_asm_const_int:(e,t,r)=>((e,t,r)=>{var n=((e,t)=>{var r;for(ie.length=0;r=g[e++];){var n=105!=r;t+=(n&=112!=r)&&t%8?4:0,ie.push(112==r?D[t>>2]:106==r?U[t>>3]:105==r?v[t>>2]:P[t>>3]),t+=n?8:4}return ie})(t,r);return cr[e](...n)})(e,t,r),emscripten_date_now:ne,emscripten_resize_heap:e=>{var t=g.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n=1;n<=4;n*=2){var i=t*(1+.2/n);i=Math.min(i,e+100663296);var a=Math.min(r,ae(Math.max(e,i),65536));if(se(a))return!0}return!1},environ_get:(e,t)=>{var r=0,n=0;for(var i of pe()){var a=t+r;D[e+n>>2]=a,r+=re(i,a,1/0)+1,n+=4}return 0},environ_sizes_get:(e,t)=>{var r=pe();D[e>>2]=r.length;var n=0;for(var i of r)n+=ce(i)+1;return D[t>>2]=n,0},fd_close:e=>52,fd_read:(e,t,r,n)=>52,fd_seek:function(e,t,r,n){return t=O(t),70},fd_write:(e,t,r,n)=>{for(var i=0,a=0;a<r;a++){var s=D[t>>2],o=D[t+4>>2];t+=8;for(var p=0;p<o;p++)de(e,g[s+p]);i+=o}return D[n>>2]=i,0},proc_exit:X},dr=await async function(){function e(e,t){return dr=e.exports,f=dr.memory,I(),E=dr.__indirect_function_table,r.wasmTable=E,function(e){r._main=me=e.main,r._webidl_free=e.webidl_free,r._webidl_malloc=e.webidl_malloc,r._emscripten_bind_VoidPtr___destroy___0=he=e.emscripten_bind_VoidPtr___destroy___0,r._emscripten_bind_Uarm_Uarm_0=le=e.emscripten_bind_Uarm_Uarm_0,r._emscripten_bind_Uarm_SetRamSize_1=ye=e.emscripten_bind_Uarm_SetRamSize_1,r._emscripten_bind_Uarm_SetNand_2=Se=e.emscripten_bind_Uarm_SetNand_2,r._emscripten_bind_Uarm_SetMemory_2=fe=e.emscripten_bind_Uarm_SetMemory_2,r._emscripten_bind_Uarm_SetSavestate_2=be=e.emscripten_bind_Uarm_SetSavestate_2,r._emscripten_bind_Uarm_SetSd_3=ge=e.emscripten_bind_Uarm_SetSd_3,r._emscripten_bind_Uarm_SetDefaultMips_1=ve=e.emscripten_bind_Uarm_SetDefaultMips_1,r._emscripten_bind_Uarm_Launch_2=De=e.emscripten_bind_Uarm_Launch_2,r._emscripten_bind_Uarm_Cycle_1=Pe=e.emscripten_bind_Uarm_Cycle_1,r._emscripten_bind_Uarm_GetFrame_0=Ue=e.emscripten_bind_Uarm_GetFrame_0,r._emscripten_bind_Uarm_ResetFrame_0=Ge=e.emscripten_bind_Uarm_ResetFrame_0,r._emscripten_bind_Uarm_GetTimesliceSizeUsec_0=Ie=e.emscripten_bind_Uarm_GetTimesliceSizeUsec_0,r._emscripten_bind_Uarm_PenDown_2=we=e.emscripten_bind_Uarm_PenDown_2,r._emscripten_bind_Uarm_PenUp_0=ze=e.emscripten_bind_Uarm_PenUp_0,r._emscripten_bind_Uarm_CurrentIps_0=Ce=e.emscripten_bind_Uarm_CurrentIps_0,r._emscripten_bind_Uarm_CurrentIpsMax_0=Me=e.emscripten_bind_Uarm_CurrentIpsMax_0,r._emscripten_bind_Uarm_SetMaxLoad_1=ke=e.emscripten_bind_Uarm_SetMaxLoad_1,r._emscripten_bind_Uarm_SetCyclesPerSecondLimit_1=Ne=e.emscripten_bind_Uarm_SetCyclesPerSecondLimit_1,r._emscripten_bind_Uarm_GetTimestampUsec_0=Ee=e.emscripten_bind_Uarm_GetTimestampUsec_0,r._emscripten_bind_Uarm_KeyDown_1=Fe=e.emscripten_bind_Uarm_KeyDown_1,r._emscripten_bind_Uarm_KeyUp_1=je=e.emscripten_bind_Uarm_KeyUp_1,r._emscripten_bind_Uarm_PendingSamples_0=Ae=e.emscripten_bind_Uarm_PendingSamples_0,r._emscripten_bind_Uarm_PopQueuedSamples_0=Te=e.emscripten_bind_Uarm_PopQueuedSamples_0,r._emscripten_bind_Uarm_GetSampleQueueSize_0=Be=e.emscripten_bind_Uarm_GetSampleQueueSize_0,r._emscripten_bind_Uarm_SetPcmOutputEnabled_1=Re=e.emscripten_bind_Uarm_SetPcmOutputEnabled_1,r._emscripten_bind_Uarm_SetPcmSuspended_1=He=e.emscripten_bind_Uarm_SetPcmSuspended_1,r._emscripten_bind_Uarm_GetRomDataSize_0=Le=e.emscripten_bind_Uarm_GetRomDataSize_0,r._emscripten_bind_Uarm_GetRomData_0=xe=e.emscripten_bind_Uarm_GetRomData_0,r._emscripten_bind_Uarm_GetNandDataSize_0=Oe=e.emscripten_bind_Uarm_GetNandDataSize_0,r._emscripten_bind_Uarm_GetNandData_0=Ve=e.emscripten_bind_Uarm_GetNandData_0,r._emscripten_bind_Uarm_GetNandDirtyPages_0=Qe=e.emscripten_bind_Uarm_GetNandDirtyPages_0,r._emscripten_bind_Uarm_IsNandDirty_0=Ke=e.emscripten_bind_Uarm_IsNandDirty_0,r._emscripten_bind_Uarm_SetNandDirty_1=$e=e.emscripten_bind_Uarm_SetNandDirty_1,r._emscripten_bind_Uarm_GetSdCardDataSize_0=We=e.emscripten_bind_Uarm_GetSdCardDataSize_0,r._emscripten_bind_Uarm_GetSdCardData_0=Ye=e.emscripten_bind_Uarm_GetSdCardData_0,r._emscripten_bind_Uarm_GetSdCardDirtyPages_0=Je=e.emscripten_bind_Uarm_GetSdCardDirtyPages_0,r._emscripten_bind_Uarm_IsSdCardDirty_0=Xe=e.emscripten_bind_Uarm_IsSdCardDirty_0,r._emscripten_bind_Uarm_SetSdCardDirty_1=Ze=e.emscripten_bind_Uarm_SetSdCardDirty_1,r._emscripten_bind_Uarm_GetMemoryDataSize_0=qe=e.emscripten_bind_Uarm_GetMemoryDataSize_0,r._emscripten_bind_Uarm_GetMemoryData_0=et=e.emscripten_bind_Uarm_GetMemoryData_0,r._emscripten_bind_Uarm_GetMemoryDirtyPages_0=tt=e.emscripten_bind_Uarm_GetMemoryDirtyPages_0,r._emscripten_bind_Uarm_GetDeviceType_0=rt=e.emscripten_bind_Uarm_GetDeviceType_0,r._emscripten_bind_Uarm_SdCardInsert_3=nt=e.emscripten_bind_Uarm_SdCardInsert_3,r._emscripten_bind_Uarm_SdCardEject_0=it=e.emscripten_bind_Uarm_SdCardEject_0,r._emscripten_bind_Uarm_SdCardInitialized_0=at=e.emscripten_bind_Uarm_SdCardInitialized_0,r._emscripten_bind_Uarm_GetSdCardId_0=st=e.emscripten_bind_Uarm_GetSdCardId_0,r._emscripten_bind_Uarm_Reset_0=ot=e.emscripten_bind_Uarm_Reset_0,r._emscripten_bind_Uarm_Save_0=pt=e.emscripten_bind_Uarm_Save_0,r._emscripten_bind_Uarm_GetSavestateSize_0=ct=e.emscripten_bind_Uarm_GetSavestateSize_0,r._emscripten_bind_Uarm_GetSavestateData_0=ut=e.emscripten_bind_Uarm_GetSavestateData_0,r._emscripten_bind_Uarm_IsSdInserted_0=dt=e.emscripten_bind_Uarm_IsSdInserted_0,r._emscripten_bind_Uarm_GetRamSize_0=_t=e.emscripten_bind_Uarm_GetRamSize_0,r._emscripten_bind_Uarm_JamKey_2=mt=e.emscripten_bind_Uarm_JamKey_2,r._emscripten_bind_Uarm_IsUiInitialized_0=ht=e.emscripten_bind_Uarm_IsUiInitialized_0,r._emscripten_bind_Uarm_IsOsVersionSet_0=lt=e.emscripten_bind_Uarm_IsOsVersionSet_0,r._emscripten_bind_Uarm_GetOsVersion_0=yt=e.emscripten_bind_Uarm_GetOsVersion_0,r._emscripten_bind_Uarm_IsLcdEnabled_0=St=e.emscripten_bind_Uarm_IsLcdEnabled_0,r._emscripten_bind_Uarm_InstallDatabase_2=ft=e.emscripten_bind_Uarm_InstallDatabase_2,r._emscripten_bind_Uarm_NewDbBackup_1=bt=e.emscripten_bind_Uarm_NewDbBackup_1,r._emscripten_bind_Uarm_LaunchAppByName_1=gt=e.emscripten_bind_Uarm_LaunchAppByName_1,r._emscripten_bind_Uarm_LaunchAppByDbHeader_2=vt=e.emscripten_bind_Uarm_LaunchAppByDbHeader_2,r._emscripten_bind_Uarm___destroy___0=Dt=e.emscripten_bind_Uarm___destroy___0,r._emscripten_bind_DbBackup_Init_0=Pt=e.emscripten_bind_DbBackup_Init_0,r._emscripten_bind_DbBackup_GetState_0=Ut=e.emscripten_bind_DbBackup_GetState_0,r._emscripten_bind_DbBackup_Continue_0=Gt=e.emscripten_bind_DbBackup_Continue_0,r._emscripten_bind_DbBackup_HasLastProcessedDb_0=It=e.emscripten_bind_DbBackup_HasLastProcessedDb_0,r._emscripten_bind_DbBackup_GetLastProcessedDb_0=wt=e.emscripten_bind_DbBackup_GetLastProcessedDb_0,r._emscripten_bind_DbBackup_GetArchiveData_0=zt=e.emscripten_bind_DbBackup_GetArchiveData_0,r._emscripten_bind_DbBackup_GetArchiveSize_0=Ct=e.emscripten_bind_DbBackup_GetArchiveSize_0,r._emscripten_bind_DbBackup___destroy___0=Mt=e.emscripten_bind_DbBackup___destroy___0,r._emscripten_bind_Bridge_Bridge_0=kt=e.emscripten_bind_Bridge_Bridge_0,r._emscripten_bind_Bridge_Malloc_1=Nt=e.emscripten_bind_Bridge_Malloc_1,r._emscripten_bind_Bridge_Free_1=Et=e.emscripten_bind_Bridge_Free_1,r._emscripten_bind_Bridge___destroy___0=Ft=e.emscripten_bind_Bridge___destroy___0,r._emscripten_bind_SessionFile5_SessionFile5_0=jt=e.emscripten_bind_SessionFile5_SessionFile5_0,r._emscripten_bind_SessionFile5_IsSessionFile_2=At=e.emscripten_bind_SessionFile5_IsSessionFile_2,r._emscripten_bind_SessionFile5_GetDeviceId_0=Tt=e.emscripten_bind_SessionFile5_GetDeviceId_0,r._emscripten_bind_SessionFile5_SetDeviceId_1=Bt=e.emscripten_bind_SessionFile5_SetDeviceId_1,r._emscripten_bind_SessionFile5_GetMetadata_0=Rt=e.emscripten_bind_SessionFile5_GetMetadata_0,r._emscripten_bind_SessionFile5_GetMetadataSize_0=Ht=e.emscripten_bind_SessionFile5_GetMetadataSize_0,r._emscripten_bind_SessionFile5_SetMetadata_2=Lt=e.emscripten_bind_SessionFile5_SetMetadata_2,r._emscripten_bind_SessionFile5_GetNor_0=xt=e.emscripten_bind_SessionFile5_GetNor_0,r._emscripten_bind_SessionFile5_GetNorSize_0=Ot=e.emscripten_bind_SessionFile5_GetNorSize_0,r._emscripten_bind_SessionFile5_SetNor_2=Vt=e.emscripten_bind_SessionFile5_SetNor_2,r._emscripten_bind_SessionFile5_GetNand_0=Qt=e.emscripten_bind_SessionFile5_GetNand_0,r._emscripten_bind_SessionFile5_GetNandSize_0=Kt=e.emscripten_bind_SessionFile5_GetNandSize_0,r._emscripten_bind_SessionFile5_SetNand_2=$t=e.emscripten_bind_SessionFile5_SetNand_2,r._emscripten_bind_SessionFile5_GetMemory_0=Wt=e.emscripten_bind_SessionFile5_GetMemory_0,r._emscripten_bind_SessionFile5_GetMemorySize_0=Yt=e.emscripten_bind_SessionFile5_GetMemorySize_0,r._emscripten_bind_SessionFile5_SetMemory_2=Jt=e.emscripten_bind_SessionFile5_SetMemory_2,r._emscripten_bind_SessionFile5_GetSavestate_0=Xt=e.emscripten_bind_SessionFile5_GetSavestate_0,r._emscripten_bind_SessionFile5_GetSavestateSize_0=Zt=e.emscripten_bind_SessionFile5_GetSavestateSize_0,r._emscripten_bind_SessionFile5_SetSavestate_2=qt=e.emscripten_bind_SessionFile5_SetSavestate_2,r._emscripten_bind_SessionFile5_GetRamSize_0=er=e.emscripten_bind_SessionFile5_GetRamSize_0,r._emscripten_bind_SessionFile5_SetRamSize_1=tr=e.emscripten_bind_SessionFile5_SetRamSize_1,r._emscripten_bind_SessionFile5_Serialize_0=rr=e.emscripten_bind_SessionFile5_Serialize_0,r._emscripten_bind_SessionFile5_GetSerializedSession_0=nr=e.emscripten_bind_SessionFile5_GetSerializedSession_0,r._emscripten_bind_SessionFile5_GetSerializedSessionSize_0=ir=e.emscripten_bind_SessionFile5_GetSerializedSessionSize_0,r._emscripten_bind_SessionFile5_GetVersion_0=ar=e.emscripten_bind_SessionFile5_GetVersion_0,r._emscripten_bind_SessionFile5_Deserialize_2=sr=e.emscripten_bind_SessionFile5_Deserialize_2,r._emscripten_bind_SessionFile5___destroy___0=or=e.emscripten_bind_SessionFile5___destroy___0,pr=e._emscripten_timeout,e._emscripten_stack_restore,e._emscripten_stack_alloc,e.emscripten_stack_get_current,e.__cxa_increment_exception_refcount}(dr),function(){if(z--,r.monitorRunDependencies?.(z),0==z&&C){var e=C;C=null,e()}}(),dr}z++,r.monitorRunDependencies?.(z);var t,n={env:ur,wasi_snapshot_preview1:ur};return r.instantiateWasm?new Promise((t,i)=>{r.instantiateWasm(n,(r,n)=>{t(e(r))})}):(w??=(t="uarm_web.wasm",r.locateFile?r.locateFile(t,c):c+t),e((await k(u,w,n)).instance))}();function _r(){var e=me;try{var t=e(0,0);return Z(t),t}catch(e){return Y(e)}}function mr(){}function hr(e){return(e||mr).__cache__}function lr(e,t){var r=hr(t),n=r[e];return n||((n=Object.create((t||mr).prototype)).ptr=e,r[e]=n)}!function(){if(r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.shift()()}(),function e(){function t(){r.calledRun=!0,h||(G=!0,F(_e),dr.__wasm_call_ctors(),y?.(r),r.onRuntimeInitialized?.(),r.noInitialRun||_r(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)A(r.postRun.shift());F(j)}())}z>0?C=e:(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)B(r.preRun.shift());F(T)}(),z>0?C=e:r.setStatus?(r.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>r.setStatus(""),1),t()},1)):t())}(),mr.prototype=Object.create(mr.prototype),mr.prototype.constructor=mr,mr.prototype.__class__=mr,mr.__cache__={},r.WrapperObject=mr,r.getCache=hr,r.wrapPointer=lr,r.castObject=function(e,t){return lr(e.ptr,t)},r.NULL=lr(0),r.destroy=function(e){if(!e.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";e.__destroy__(),delete hr(e.__class__)[e.ptr]},r.compare=function(e,t){return e.ptr===t.ptr},r.getPointer=function(e){return e.ptr},r.getClass=function(e){return e.__class__};var yr={buffer:0,size:0,pos:0,temps:[],needed:0,prepare(){if(yr.needed){for(var e=0;e<yr.temps.length;e++)r._webidl_free(yr.temps[e]);yr.temps.length=0,r._webidl_free(yr.buffer),yr.buffer=0,yr.size+=yr.needed,yr.needed=0}yr.buffer||(yr.size+=128,yr.buffer=r._webidl_malloc(yr.size),l(yr.buffer)),yr.pos=0},alloc(e,t){l(yr.buffer);var n,i=t.BYTES_PER_ELEMENT,a=e.length*i;return a=ae(a,8),yr.pos+a>=yr.size?(l(a>0),yr.needed+=a,n=r._webidl_malloc(a),yr.temps.push(n)):(n=yr.buffer+yr.pos,yr.pos+=a),n},copy(e,t,r){r/=t.BYTES_PER_ELEMENT;for(var n=0;n<e.length;n++)t[r+n]=e[n]}};function Sr(e){if("string"==typeof e){var t=(i=ce(n=e)+1,a=new Array(i),te(n,a,0,a.length),a),r=yr.alloc(t,b);return yr.copy(t,b,r),r}var n,i,a;return e}function fr(){throw"cannot construct a VoidPtr, no constructor in IDL"}function br(){this.ptr=le(),hr(br)[this.ptr]=this}function gr(){throw"cannot construct a DbBackup, no constructor in IDL"}function vr(){this.ptr=kt(),hr(vr)[this.ptr]=this}function Dr(){this.ptr=jt(),hr(Dr)[this.ptr]=this}return fr.prototype=Object.create(mr.prototype),fr.prototype.constructor=fr,fr.prototype.__class__=fr,fr.__cache__={},r.VoidPtr=fr,fr.prototype.__destroy__=fr.prototype.__destroy__=function(){var e=this.ptr;he(e)},br.prototype=Object.create(mr.prototype),br.prototype.constructor=br,br.prototype.__class__=br,br.__cache__={},r.Uarm=br,br.prototype.SetRamSize=br.prototype.SetRamSize=function(e){var t=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),lr(ye(t,e),br)},br.prototype.SetNand=br.prototype.SetNand=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),lr(Se(r,e,t),br)},br.prototype.SetMemory=br.prototype.SetMemory=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),lr(fe(r,e,t),br)},br.prototype.SetSavestate=br.prototype.SetSavestate=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),lr(be(r,e,t),br)},br.prototype.SetSd=br.prototype.SetSd=function(e,t,r){var n=this.ptr;return yr.prepare(),e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),r=r&&"object"==typeof r?r.ptr:Sr(r),lr(ge(n,e,t,r),br)},br.prototype.SetDefaultMips=br.prototype.SetDefaultMips=function(e){var t=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),lr(ve(t,e),br)},br.prototype.Launch=br.prototype.Launch=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),!!De(r,e,t)},br.prototype.Cycle=br.prototype.Cycle=function(e){var t=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),Pe(t,e)},br.prototype.GetFrame=br.prototype.GetFrame=function(){var e=this.ptr;return lr(Ue(e),fr)},br.prototype.ResetFrame=br.prototype.ResetFrame=function(){var e=this.ptr;Ge(e)},br.prototype.GetTimesliceSizeUsec=br.prototype.GetTimesliceSizeUsec=function(){var e=this.ptr;return Ie(e)},br.prototype.PenDown=br.prototype.PenDown=function(e,t){var r=this.ptr;e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),we(r,e,t)},br.prototype.PenUp=br.prototype.PenUp=function(){var e=this.ptr;ze(e)},br.prototype.CurrentIps=br.prototype.CurrentIps=function(){var e=this.ptr;return Ce(e)},br.prototype.CurrentIpsMax=br.prototype.CurrentIpsMax=function(){var e=this.ptr;return Me(e)},br.prototype.SetMaxLoad=br.prototype.SetMaxLoad=function(e){var t=this.ptr;e&&"object"==typeof e&&(e=e.ptr),ke(t,e)},br.prototype.SetCyclesPerSecondLimit=br.prototype.SetCyclesPerSecondLimit=function(e){var t=this.ptr;e&&"object"==typeof e&&(e=e.ptr),Ne(t,e)},br.prototype.GetTimestampUsec=br.prototype.GetTimestampUsec=function(){var e=this.ptr;return Ee(e)},br.prototype.KeyDown=br.prototype.KeyDown=function(e){var t=this.ptr;e&&"object"==typeof e&&(e=e.ptr),Fe(t,e)},br.prototype.KeyUp=br.prototype.KeyUp=function(e){var t=this.ptr;e&&"object"==typeof e&&(e=e.ptr),je(t,e)},br.prototype.PendingSamples=br.prototype.PendingSamples=function(){var e=this.ptr;return Ae(e)},br.prototype.PopQueuedSamples=br.prototype.PopQueuedSamples=function(){var e=this.ptr;return lr(Te(e),fr)},br.prototype.GetSampleQueueSize=br.prototype.GetSampleQueueSize=function(){var e=this.ptr;return Be(e)},br.prototype.SetPcmOutputEnabled=br.prototype.SetPcmOutputEnabled=function(e){var t=this.ptr;e&&"object"==typeof e&&(e=e.ptr),Re(t,e)},br.prototype.SetPcmSuspended=br.prototype.SetPcmSuspended=function(e){var t=this.ptr;e&&"object"==typeof e&&(e=e.ptr),He(t,e)},br.prototype.GetRomDataSize=br.prototype.GetRomDataSize=function(){var e=this.ptr;return Le(e)},br.prototype.GetRomData=br.prototype.GetRomData=function(){var e=this.ptr;return lr(xe(e),fr)},br.prototype.GetNandDataSize=br.prototype.GetNandDataSize=function(){var e=this.ptr;return Oe(e)},br.prototype.GetNandData=br.prototype.GetNandData=function(){var e=this.ptr;return lr(Ve(e),fr)},br.prototype.GetNandDirtyPages=br.prototype.GetNandDirtyPages=function(){var e=this.ptr;return lr(Qe(e),fr)},br.prototype.IsNandDirty=br.prototype.IsNandDirty=function(){var e=this.ptr;return!!Ke(e)},br.prototype.SetNandDirty=br.prototype.SetNandDirty=function(e){var t=this.ptr;e&&"object"==typeof e&&(e=e.ptr),$e(t,e)},br.prototype.GetSdCardDataSize=br.prototype.GetSdCardDataSize=function(){var e=this.ptr;return We(e)},br.prototype.GetSdCardData=br.prototype.GetSdCardData=function(){var e=this.ptr;return lr(Ye(e),fr)},br.prototype.GetSdCardDirtyPages=br.prototype.GetSdCardDirtyPages=function(){var e=this.ptr;return lr(Je(e),fr)},br.prototype.IsSdCardDirty=br.prototype.IsSdCardDirty=function(){var e=this.ptr;return!!Xe(e)},br.prototype.SetSdCardDirty=br.prototype.SetSdCardDirty=function(e){var t=this.ptr;e&&"object"==typeof e&&(e=e.ptr),Ze(t,e)},br.prototype.GetMemoryDataSize=br.prototype.GetMemoryDataSize=function(){var e=this.ptr;return qe(e)},br.prototype.GetMemoryData=br.prototype.GetMemoryData=function(){var e=this.ptr;return lr(et(e),fr)},br.prototype.GetMemoryDirtyPages=br.prototype.GetMemoryDirtyPages=function(){var e=this.ptr;return lr(tt(e),fr)},br.prototype.GetDeviceType=br.prototype.GetDeviceType=function(){var e=this.ptr;return rt(e)},br.prototype.SdCardInsert=br.prototype.SdCardInsert=function(e,t,r){var n=this.ptr;return yr.prepare(),e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),r=r&&"object"==typeof r?r.ptr:Sr(r),!!nt(n,e,t,r)},br.prototype.SdCardEject=br.prototype.SdCardEject=function(){var e=this.ptr;it(e)},br.prototype.SdCardInitialized=br.prototype.SdCardInitialized=function(){var e=this.ptr;return!!at(e)},br.prototype.GetSdCardId=br.prototype.GetSdCardId=function(){var e=this.ptr;return x(st(e))},br.prototype.Reset=br.prototype.Reset=function(){var e=this.ptr;ot(e)},br.prototype.Save=br.prototype.Save=function(){var e=this.ptr;pt(e)},br.prototype.GetSavestateSize=br.prototype.GetSavestateSize=function(){var e=this.ptr;return ct(e)},br.prototype.GetSavestateData=br.prototype.GetSavestateData=function(){var e=this.ptr;return lr(ut(e),fr)},br.prototype.IsSdInserted=br.prototype.IsSdInserted=function(){var e=this.ptr;return!!dt(e)},br.prototype.GetRamSize=br.prototype.GetRamSize=function(){var e=this.ptr;return _t(e)},br.prototype.JamKey=br.prototype.JamKey=function(e,t){var r=this.ptr;e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),mt(r,e,t)},br.prototype.IsUiInitialized=br.prototype.IsUiInitialized=function(){var e=this.ptr;return!!ht(e)},br.prototype.IsOsVersionSet=br.prototype.IsOsVersionSet=function(){var e=this.ptr;return!!lt(e)},br.prototype.GetOsVersion=br.prototype.GetOsVersion=function(){var e=this.ptr;return yt(e)},br.prototype.IsLcdEnabled=br.prototype.IsLcdEnabled=function(){var e=this.ptr;return!!St(e)},br.prototype.InstallDatabase=br.prototype.InstallDatabase=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),ft(r,e,t)},br.prototype.NewDbBackup=br.prototype.NewDbBackup=function(e){var t=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),lr(bt(t,e),gr)},br.prototype.LaunchAppByName=br.prototype.LaunchAppByName=function(e){var t=this.ptr;return yr.prepare(),e=e&&"object"==typeof e?e.ptr:Sr(e),!!gt(t,e)},br.prototype.LaunchAppByDbHeader=br.prototype.LaunchAppByDbHeader=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),!!vt(r,e,t)},br.prototype.__destroy__=br.prototype.__destroy__=function(){var e=this.ptr;Dt(e)},gr.prototype=Object.create(mr.prototype),gr.prototype.constructor=gr,gr.prototype.__class__=gr,gr.__cache__={},r.DbBackup=gr,gr.prototype.Init=gr.prototype.Init=function(){var e=this.ptr;return!!Pt(e)},gr.prototype.GetState=gr.prototype.GetState=function(){var e=this.ptr;return Ut(e)},gr.prototype.Continue=gr.prototype.Continue=function(){var e=this.ptr;return!!Gt(e)},gr.prototype.HasLastProcessedDb=gr.prototype.HasLastProcessedDb=function(){var e=this.ptr;return!!It(e)},gr.prototype.GetLastProcessedDb=gr.prototype.GetLastProcessedDb=function(){var e=this.ptr;return x(wt(e))},gr.prototype.GetArchiveData=gr.prototype.GetArchiveData=function(){var e=this.ptr;return lr(zt(e),fr)},gr.prototype.GetArchiveSize=gr.prototype.GetArchiveSize=function(){var e=this.ptr;return Ct(e)},gr.prototype.__destroy__=gr.prototype.__destroy__=function(){var e=this.ptr;Mt(e)},vr.prototype=Object.create(mr.prototype),vr.prototype.constructor=vr,vr.prototype.__class__=vr,vr.__cache__={},r.Bridge=vr,vr.prototype.Malloc=vr.prototype.Malloc=function(e){var t=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),lr(Nt(t,e),fr)},vr.prototype.Free=vr.prototype.Free=function(e){var t=this.ptr;e&&"object"==typeof e&&(e=e.ptr),Et(t,e)},vr.prototype.__destroy__=vr.prototype.__destroy__=function(){var e=this.ptr;Ft(e)},Dr.prototype=Object.create(mr.prototype),Dr.prototype.constructor=Dr,Dr.prototype.__class__=Dr,Dr.__cache__={},r.SessionFile5=Dr,Dr.prototype.IsSessionFile=Dr.prototype.IsSessionFile=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),!!At(r,e,t)},Dr.prototype.GetDeviceId=Dr.prototype.GetDeviceId=function(){var e=this.ptr;return Tt(e)},Dr.prototype.SetDeviceId=Dr.prototype.SetDeviceId=function(e){var t=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),lr(Bt(t,e),Dr)},Dr.prototype.GetMetadata=Dr.prototype.GetMetadata=function(){var e=this.ptr;return lr(Rt(e),fr)},Dr.prototype.GetMetadataSize=Dr.prototype.GetMetadataSize=function(){var e=this.ptr;return Ht(e)},Dr.prototype.SetMetadata=Dr.prototype.SetMetadata=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),lr(Lt(r,e,t),Dr)},Dr.prototype.GetNor=Dr.prototype.GetNor=function(){var e=this.ptr;return lr(xt(e),fr)},Dr.prototype.GetNorSize=Dr.prototype.GetNorSize=function(){var e=this.ptr;return Ot(e)},Dr.prototype.SetNor=Dr.prototype.SetNor=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),lr(Vt(r,e,t),Dr)},Dr.prototype.GetNand=Dr.prototype.GetNand=function(){var e=this.ptr;return lr(Qt(e),fr)},Dr.prototype.GetNandSize=Dr.prototype.GetNandSize=function(){var e=this.ptr;return Kt(e)},Dr.prototype.SetNand=Dr.prototype.SetNand=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),lr($t(r,e,t),Dr)},Dr.prototype.GetMemory=Dr.prototype.GetMemory=function(){var e=this.ptr;return lr(Wt(e),fr)},Dr.prototype.GetMemorySize=Dr.prototype.GetMemorySize=function(){var e=this.ptr;return Yt(e)},Dr.prototype.SetMemory=Dr.prototype.SetMemory=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),lr(Jt(r,e,t),Dr)},Dr.prototype.GetSavestate=Dr.prototype.GetSavestate=function(){var e=this.ptr;return lr(Xt(e),fr)},Dr.prototype.GetSavestateSize=Dr.prototype.GetSavestateSize=function(){var e=this.ptr;return Zt(e)},Dr.prototype.SetSavestate=Dr.prototype.SetSavestate=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),lr(qt(r,e,t),Dr)},Dr.prototype.GetRamSize=Dr.prototype.GetRamSize=function(){var e=this.ptr;return er(e)},Dr.prototype.SetRamSize=Dr.prototype.SetRamSize=function(e){var t=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),lr(tr(t,e),Dr)},Dr.prototype.Serialize=Dr.prototype.Serialize=function(){var e=this.ptr;return!!rr(e)},Dr.prototype.GetSerializedSession=Dr.prototype.GetSerializedSession=function(){var e=this.ptr;return lr(nr(e),fr)},Dr.prototype.GetSerializedSessionSize=Dr.prototype.GetSerializedSessionSize=function(){var e=this.ptr;return ir(e)},Dr.prototype.GetVersion=Dr.prototype.GetVersion=function(){var e=this.ptr;return ar(e)},Dr.prototype.Deserialize=Dr.prototype.Deserialize=function(e,t){var r=this.ptr;return e&&"object"==typeof e&&(e=e.ptr),t&&"object"==typeof t&&(t=t.ptr),!!sr(r,e,t)},Dr.prototype.__destroy__=Dr.prototype.__destroy__=function(){var e=this.ptr;or(e)},G?r:new Promise((e,t)=>{y=e,S=t})});e.exports=r,e.exports.default=r},791:function(e,t,r){!function(e){"use strict";if(!e.setImmediate){var t,r,n,i,a,s=1,o={},p=!1,c=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?t=function(e){process.nextTick(function(){_(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?(i="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(i)&&_(+t.data.slice(i.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),t=function(t){e.postMessage(i+t,"*")}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){_(e.data)},t=function(e){n.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(r=c.documentElement,t=function(e){var t=c.createElement("script");t.onreadystatechange=function(){_(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):t=function(e){setTimeout(_,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var r=new Array(arguments.length-1),n=0;n<r.length;n++)r[n]=arguments[n+1];var i={callback:e,args:r};return o[s]=i,t(s),s++},u.clearImmediate=d}function d(e){delete o[e]}function _(e){if(p)setTimeout(_,0,e);else{var t=o[e];if(t){p=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}finally{d(e),p=!1}}}}}("undefined"==typeof self?void 0===r.g?this:r.g:self)}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";function e(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s}function t(e,t,r,n){return new(r||(r=Promise))(function(i,a){function s(e){try{p(n.next(e))}catch(e){a(e)}}function o(e){try{p(n.throw(e))}catch(e){a(e)}}function p(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,o)}p((n=n.apply(e,t||[])).next())})}var n;Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError,function(e){e.palmPilot="PalmPilot",e.pilot="Pilot",e.iii="PalmIII",e.palmVx="PalmVx",e.palmV="PalmV",e.palmVII="PalmVII",e.palmVIIEZ="PalmVIIEZ",e.palmVIIx="PalmVIIx",e.iiic="PalmIIIc",e.iiix="PalmIIIx",e.iiixe="PalmIIIxe",e.iiie="PalmIIIe",e.m500="PalmM500",e.m505="PalmM505",e.m515="PalmM515",e.m520="PalmM520",e.m100="PalmM100",e.m105="PalmM105",e.m125="PalmM125",e.m130="PalmM130",e.i705="Palmi705",e.i710="PalmI710",e.handera330="HandEra330",e.handera330c="HandEra330c",e.pegS300="PEG-S300",e.pegS320="PEG-S320",e.pegS500c="PEG-S500C",e.pegT400="PEG-T400",e.pegN600c="PEG-N600C/N610C",e.pegT600c="PEG-T600",e.pegN700c="PEG-N700C/N710C",e.pegT650c="YSX1230",e.pegNR70="NR70",e.acerS11="Acer-S11",e.lp168="Legend-P168",e.te2="Tungsten-E2",e.frankene2="Franken-E2"}(n||(n={}));var i=r(426),a=r.n(i),s=r(84);let o=0;function p(e){switch(e){case 0:return 1;case 1:return 2;case 2:return 3;case 3:return 4;case 4:return 5;case 5:return 6;case 6:return 10;case 14:return 7;case 15:return 8;case 16:return 9;default:return 0}}function c(){return(e,t,r)=>{const n=r.value;return r.value=function(e,t){return this.guard(()=>n.call(this,e,t))},r}}class u{constructor(e){this.module=e,this.fatalErrorEvent=new s.J,this.amIdead=!1,this.uarm=new e.Uarm,this.bridge=new e.Bridge}static create(e){return t(this,void 0,void 0,function*(){const t=o++;return new u(yield a()({print:e=>console.log(`${t}: ${e}`),printErr:e=>console.warn(`${t}: ${e}`),instantiateWasm:(t,r)=>{WebAssembly.instantiate(e,t).then(e=>r(e))}}))})}setRamSize(e){this.uarm.SetRamSize(e)}setMemory(e){this.uarm.SetMemory(e.length,this.copyIn(e))}setNand(e){this.uarm.SetNand(e.length,this.copyIn(e))}setSd(e,t){this.uarm.SetSd(e.length,this.copyIn(e),t)}setSavestate(e){this.uarm.SetSavestate(e.length,this.copyIn(e))}launch(e){return this.uarm.Launch(e.length,this.copyIn(e))}buttonUp(e){const t=p(e);t>=0&&this.uarm.KeyUp(t)}buttonDown(e){const t=p(e);t>=0&&this.uarm.KeyDown(t)}penDown(e,t){this.uarm.PenDown(e,t)}penUp(){this.uarm.PenUp()}getTimestampUsec(){return this.uarm.GetTimestampUsec()}cycle(e){return this.uarm.Cycle(e)}getTimesliceSizeUsec(){return this.uarm.GetTimesliceSizeUsec()}getDevice(){const e=this.uarm.GetDeviceType();switch(e){case 0:return n.te2;case 1:return n.frankene2;default:throw new Error(`invalid device ID ${e}`)}}getFrame(e){const t=this.module.getPointer(this.uarm.GetFrame())>>>2;return 0===t?void 0:this.module.HEAPU32.subarray(t,t+320*e)}resetFrame(){this.uarm.ResetFrame()}setTargetMips(e){this.uarm.SetCyclesPerSecondLimit(1e6*e)}setMaxHostLoad(e){this.uarm.SetMaxLoad(100*e)}getMemorySize(){return this.uarm.GetMemoryDataSize()}getMemoryData(){const e=this.module.getPointer(this.uarm.GetMemoryData());return this.module.HEAPU8.subarray(e,e+this.uarm.GetMemoryDataSize())}getMemoryDirtyPages(){const e=this.module.getPointer(this.uarm.GetMemoryDirtyPages()),t=this.uarm.GetMemoryDataSize()>>>10,r=e>>>2;let n=t>>>5;return 32*n<t&&n++,this.module.HEAPU32.subarray(r,r+n)}getSdCardSize(){return this.uarm.GetSdCardDataSize()}getSdCardData(){const e=this.module.getPointer(this.uarm.GetSdCardData());if(0!==e)return this.module.HEAPU8.subarray(e,e+this.uarm.GetSdCardDataSize())}getSdCardDirtyPages(){const e=this.module.getPointer(this.uarm.GetSdCardDirtyPages());if(0===e)return;const t=this.uarm.GetSdCardDataSize()>>>13,r=e>>>2;let n=t>>>5;return 32*n<t&&n++,this.module.HEAPU32.subarray(r,r+n)}isSdCardDirty(){return this.uarm.IsSdCardDirty()}setSdCardDirty(e){this.uarm.SetSdCardDirty(e)}getNandSize(){return this.uarm.GetNandDataSize()}getNandData(){const e=this.module.getPointer(this.uarm.GetNandData());return this.module.HEAPU8.subarray(e,e+this.uarm.GetNandDataSize())}getNandDirtyPages(){const e=this.module.getPointer(this.uarm.GetNandDirtyPages()),t=this.uarm.GetNandDataSize()/4224|0,r=e>>>2;let n=t>>>5;return 32*n<t&&n++,this.module.HEAPU32.subarray(r,r+n)}isNandDirty(){return this.uarm.IsNandDirty()}setNandDirty(e){this.uarm.SetNandDirty(e)}saveState(){this.uarm.Save();const e=this.module.getPointer(this.uarm.GetSavestateData());return this.module.HEAPU8.subarray(e,e+this.uarm.GetSavestateSize())}getCurrentIps(){return this.uarm.CurrentIps()}getCurrentIpsMax(){return Number(this.uarm.CurrentIpsMax())}getSdCardKey(){return this.uarm.SdCardInitialized()?this.uarm.GetSdCardId():void 0}sdCardInsert(e,t){const r=this.copyIn(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));return!!this.uarm.SdCardInsert(r,4*e.length,t)||(this.bridge.Free(r),!1)}sdCardEject(){this.uarm.SdCardEject()}sdCardInserted(){return this.uarm.IsSdInserted()}clearSampleQueue(){this.uarm.PopQueuedSamples()}getQueuedSamples(){const e=this.uarm.PendingSamples();if(0===e)return;const t=this.module.getPointer(this.uarm.PopQueuedSamples())>>>2;return this.module.HEAPU32.subarray(t,t+e)}getSampleQueueSize(){return this.uarm.GetSampleQueueSize()}disablePcm(e){this.uarm.SetPcmOutputEnabled(!e)}suspendPcm(e){this.uarm.SetPcmSuspended(e)}reset(){this.uarm.Reset()}jamButton(e,t){this.uarm.JamKey(p(e),t)}installDb(e){const t=this.copyIn(e),r=this.uarm.InstallDatabase(e.length,t);return this.bridge.Free(t),function(e){switch(e){case 0:return 1;case 1:return 2;case-2:return-4;case-4:return-3;case-5:return-6;case-7:case-6:return-7;case-3:return-2;case-8:return-1}}(r)}createDbBackup(e){const t=this.uarm.NewDbBackup(e?1:0);if(t.Init())return{getState:()=>this.guard(()=>t.GetState()),continue:()=>this.guard(()=>t.Continue()),getLastProcessedDb:()=>this.guard(()=>t.HasLastProcessedDb()?t.GetLastProcessedDb():void 0),getArchive:()=>this.guard(()=>{const e=this.module.getPointer(t.GetArchiveData());if(0!==e)return this.module.HEAPU8.subarray(e,e+t.GetArchiveSize())}),destroy:()=>this.guard(()=>this.module.destroy(t))};this.module.destroy(t)}getRomData(){const e=this.module.getPointer(this.uarm.GetRomData());return new Uint8Array(this.module.HEAPU8.subarray(e,e+this.uarm.GetRomDataSize()))}isUiInitialized(){return this.uarm.IsUiInitialized()}getOsVersion(){return this.uarm.IsOsVersionSet()?this.uarm.GetOsVersion():void 0}isLcdEnabled(){return this.uarm.IsLcdEnabled()}launchAppByName(e){return this.uarm.LaunchAppByName(e)}launchAppByDbHeader(e){if(e.length<32)return!1;const t=this.copyIn(e.subarray(0,32)),r=this.uarm.LaunchAppByDbHeader(t,32);return this.bridge.Free(t),r}dead(){return this.amIdead}guard(e){if(this.amIdead)throw new Error("uarm instance is dead");try{return e()}catch(e){throw this.amIdead=!0,this.uarm=void 0,this.fatalErrorEvent.dispatch(e instanceof Error?e:new Error("unknown error")),e}}copyIn(e){const t=this.bridge.Malloc(e.length),r=this.module.getPointer(t);return this.module.HEAPU8.subarray(r,r+e.length).set(e),t}}e([c()],u.prototype,"setRamSize",null),e([c()],u.prototype,"setMemory",null),e([c()],u.prototype,"setNand",null),e([c()],u.prototype,"setSd",null),e([c()],u.prototype,"setSavestate",null),e([c()],u.prototype,"launch",null),e([c()],u.prototype,"buttonUp",null),e([c()],u.prototype,"buttonDown",null),e([c()],u.prototype,"penDown",null),e([c()],u.prototype,"penUp",null),e([c()],u.prototype,"getTimestampUsec",null),e([c()],u.prototype,"cycle",null),e([c()],u.prototype,"getTimesliceSizeUsec",null),e([c()],u.prototype,"getDevice",null),e([c()],u.prototype,"getFrame",null),e([c()],u.prototype,"resetFrame",null),e([c()],u.prototype,"setTargetMips",null),e([c()],u.prototype,"setMaxHostLoad",null),e([c()],u.prototype,"getMemorySize",null),e([c()],u.prototype,"getMemoryData",null),e([c()],u.prototype,"getMemoryDirtyPages",null),e([c()],u.prototype,"getSdCardSize",null),e([c()],u.prototype,"getSdCardData",null),e([c()],u.prototype,"getSdCardDirtyPages",null),e([c()],u.prototype,"isSdCardDirty",null),e([c()],u.prototype,"setSdCardDirty",null),e([c()],u.prototype,"getNandSize",null),e([c()],u.prototype,"getNandData",null),e([c()],u.prototype,"getNandDirtyPages",null),e([c()],u.prototype,"isNandDirty",null),e([c()],u.prototype,"setNandDirty",null),e([c()],u.prototype,"saveState",null),e([c()],u.prototype,"getCurrentIps",null),e([c()],u.prototype,"getCurrentIpsMax",null),e([c()],u.prototype,"getSdCardKey",null),e([c()],u.prototype,"sdCardInsert",null),e([c()],u.prototype,"sdCardEject",null),e([c()],u.prototype,"sdCardInserted",null),e([c()],u.prototype,"clearSampleQueue",null),e([c()],u.prototype,"getQueuedSamples",null),e([c()],u.prototype,"getSampleQueueSize",null),e([c()],u.prototype,"disablePcm",null),e([c()],u.prototype,"suspendPcm",null),e([c()],u.prototype,"reset",null),e([c()],u.prototype,"jamButton",null),e([c()],u.prototype,"installDb",null),e([c()],u.prototype,"createDbBackup",null),e([c()],u.prototype,"getRomData",null),e([c()],u.prototype,"isUiInitialized",null),e([c()],u.prototype,"getOsVersion",null),e([c()],u.prototype,"isLcdEnabled",null),e([c()],u.prototype,"launchAppByName",null),e([c()],u.prototype,"launchAppByDbHeader",null),r(791);const d=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function _(e){let t=-1;for(let r=0;r<e.length;r++)t=d[255&(t^e[r])]^t>>>8;return~t}class m{constructor(e,t,r,n,i){this.pageSize=e,this.pageCount=t,this.name=r,this.crcCheck=n,this.adapter=i,this.scheduledPageCount=0,this.dirtyPagesSize4=t>>>5,32*this.dirtyPagesSize4<t&&this.dirtyPagesSize4++,this.scheduledPages=new Uint32Array(t),this.pagePool=new Uint8Array(256*e)}takeSnapshot(){if(this.scheduledPageCount>0&&console.warn(`${this.name} pending, skipping snapshot...`),!this.adapter.isDirty())return;const e=this.adapter.getData(),t=this.adapter.getDirtyPages();if(!e||!t)return;let r=0,n=0;for(let i=0;i<t.length;i++){let a=t[i];if(0!==a){for(let t=0;t<4;t++){const t=255&a;if(a>>>=8,0!==t)for(let i=1;i<256;i<<=1){if(!(t&i)){n++;continue}this.scheduledPages[r]=n;const a=r*this.pageSize,s=n*this.pageSize;a>=this.pagePool.length&&this.growPagePool(),this.pagePool.subarray(a,a+this.pageSize).set(e.subarray(s,s+this.pageSize)),r++,n++}else n+=8}t[i]=0}else n+=32}return this.scheduledPageCount=r,this.scheduledPageCount>0?(this.adapter.setDirty(!1),{scheduledPageCount:this.scheduledPageCount,scheduledPages:this.scheduledPages.buffer,pagePool:this.pagePool.buffer,crc:this.crcCheck?_(e):void 0}):void 0}getTransferables(){return this.scheduledPageCount>0?[this.scheduledPages.buffer,this.pagePool.buffer]:[]}returnSnapshot(e,t){if(!t)return;const r=this.scheduledPageCount;if(this.scheduledPages=new Uint32Array(t.scheduledPages),this.pagePool=new Uint8Array(t.pagePool),this.scheduledPageCount=0,e)return;const n=this.adapter.getDirtyPages();if(n)for(let e=0;e<r;e++){const t=this.scheduledPages[e];n[t>>>5]|=1<<(31&t)}this.adapter.setDirty(!0)}enableCrc(e){this.crcCheck=e}growPagePool(){const e=new Uint8Array(Math.min(Math.ceil(1.5*this.pagePool.length/this.pageSize)*this.pageSize,this.pageCount*this.pageSize));console.log(`growing ${this.name} page pool to ${e.length} bytes`),e.set(this.pagePool),this.pagePool=e}}class h{constructor(e,t,r){this.uarm=e,this.settings=t,this.pcmPort=r,this.timesliceTask=()=>{const e=this.uarm.getTimestampUsec(),t=Number(e),r=this.uarm.cycle(e),n=(this.uarm.getTimesliceSizeUsec()-Number(this.uarm.getTimestampUsec())+t)/1e3;this.timeoutHandle=this.immediateHandle=void 0,n<5?this.immediateHandle=setImmediate(this.timesliceTask):this.timeoutHandle=setTimeo