diff --git a/dist/_astro/hoisted.B2kBaBR1.js b/dist/_astro/hoisted.B2kBaBR1.js new file mode 100644 index 0000000..ec7f9c3 --- /dev/null +++ b/dist/_astro/hoisted.B2kBaBR1.js @@ -0,0 +1,6 @@ +import{_ as bn}from"./preload-helper.Cd0R8zjt.js";const Qe=document.querySelector("#talvos svg.vis0"),Ze=Qe.querySelector("tspan.physical"),Zt=Qe.querySelector("tspan.logical"),kn=Qe.querySelectorAll(".lane");for(const d of kn)d.addEventListener("mouseenter",function(){Ze.textContent=this.dataset.phyCoords,Zt.textContent=this.dataset.logCoords??"N/A"}),d.addEventListener("mouseleave",function(){Ze.textContent="N/A",Zt.textContent="N/A"}),d.addEventListener("click",function(){this.classList.contains(".disabled")||this.classList.toggle("selected")});const An=Qe.querySelectorAll(".ctrl");for(const[d,l]of An.entries())l.addEventListener("mouseenter",function(){Ze.textContent=`{ ${d}, [${d*8}-${d*8+7}] }`}),l.addEventListener("mouseleave",function(){Ze.textContent="N/A"}),l.addEventListener("click",function(){if(!!!this.parentNode.querySelector('.lane[data-state="active"], .lane[data-state="inactive"]'))return;const i=!this.parentNode.querySelector(".lane.selected");this.parentNode.querySelectorAll(".lane").forEach(g=>{g.classList.toggle("selected",i)})});(async()=>{const d=[{label:"%2",kind:"alu",values:function*(){let y=281474976710656;for(;;){const N=`0x${y.toString(16)}`;y+=4,yield N}}},{label:"%3",kind:"mem",values:function*(){let y=0;for(;;)yield`${y++}`}},{label:"%4",kind:"alu",values:function*(){let y=0;for(;;){const N=y;y+=4,yield`0x20..${N.toString(16).padStart(2,"0")}`}}},{label:"st",kind:"mem",values:function*(){for(;;)yield"✔"}}];var l;function f(){l={cur:1,last:["completed"],gen:(()=>{const y=d[1].values();return y.next(),y})()}}f(),document.querySelector("#talvos .controls button.reset").addEventListener("click",function(){f(),p()}),document.querySelector("#talvos .controls button.vis.step0").addEventListener("click",function(){if(l.cur>=d.length)return;switch(d[l.cur]?.kind){case"alu":l.last=[...l.last,...[...w.querySelectorAll(`:nth-child(${l.cur+1} of :has(g.results)) g.results .dispatched:not(.completed)`)].map(N=>"completed")];break;case"mem":l.last=[...l.last,"completed"];break;default:throw new Error(`unknown op kind: ${d[l.cur]?.kind}`)}const y=parseInt(w.dataset.lanes||"");l.last.length>=y&&(l={cur:l.cur+1,last:[]}),p()}),document.querySelector("#talvos .controls button.vis.step1").addEventListener("click",function(){l={cur:l.cur+1,last:[]},p()});const w=await new Promise(async(y,N)=>{await customElements.whenDefined("shadow-root");const A=document.querySelectorAll("#talvos shadow-root");for(const z of A){const W=z.shadowRoot.querySelector("svg.vis1");if(W){y(W);return}}N("el not found")});function p(){w.replaceChildren(...w.querySelectorAll("style,defs"),(y=>(y.setAttribute("href","#step"),y.setAttribute("width","60px"),y.setAttribute("height","240px"),y.setAttribute("x",`${(l.cur||1)*60}`),y))(document.createElementNS("http://www.w3.org/2000/svg","use")),...d.map((y,N)=>{const A=document.createElementNS("http://www.w3.org/2000/svg","svg");A.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),A.setAttribute("viewBox","0 0 60 240"),A.setAttribute("width","60px"),A.setAttribute("height","240px"),A.setAttribute("x",`${N*60}`);const z=A.appendChild(document.createElementNS("http://www.w3.org/2000/svg","circle"));z.setAttribute("cx","30"),z.setAttribute("cy","55"),z.setAttribute("r","12");const W=A.appendChild(document.createElementNS("http://www.w3.org/2000/svg","text"));W.setAttribute("x","30"),W.setAttribute("y","55"),W.setAttribute("dominant-baseline","middle"),W.setAttribute("text-anchor","middle"),W.append(y.label);const ne=A.appendChild(document.createElementNS("http://www.w3.org/2000/svg","g"));ne.classList.add("results");const oe=y.values();for(var I=0;I{if(d.length>16){const{written:N}=Tn.encodeInto(d,l.subarray(f,i));return N}for(var g=f,_=f+i-1,w=0;w=55296&&p<=57343){var y=d.charCodeAt(++w);p=65536+((p&1023)<<10)|y&1023}if(p<=127){if(f>=_)break;l[f++]=p}else if(p<=2047){if(f+1>=_)break;l[f++]=192|p>>6,l[f++]=128|p&63}else if(p<=65535){if(f+2>=_)break;l[f++]=224|p>>12,l[f++]=128|p>>6&63,l[f++]=128|p&63}else{if(f+3>=_)break;if(p>1114111)throw new Error("Invalid Unicode code point");l[f++]=240|p>>18,l[f++]=128|p>>12&63,l[f++]=128|p>>6&63,l[f++]=128|p&63}}return l[f]=0,f-g},Vt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Nn=(d,l,f,i)=>{const g=l+f,_=(()=>{let z=l;for(;d[z]&&!(z>=g);)++z;return z})();if(_-l>16&&d.buffer&&Vt)return Vt.decode(d.subarray(l,_));for(var w="";l<_;){var p=d[l++];if(!(p&128)){w+=String.fromCharCode(p);continue}var y=d[l++]&63;if((p&224)==192){w+=String.fromCharCode((p&31)<<6|y);continue}var N=d[l++]&63;if((p&240)==224)p=(p&15)<<12|y<<6|N;else{if((p&248)!=240)throw new Error("Invalid Unicode code point");p=(p&7)<<18|y<<12|N<<6|d[l++]&63}if(p<65536)w+=String.fromCharCode(p);else{var A=p-65536;w+=String.fromCharCode(55296|A>>10,56320|A&1023)}}return w};class On{next;dtor;constructor(l,f){this.next=l,this.dtor=f??(()=>{})}alloc(l){if(l>this.size)throw new Error(`OOM: Arena out of memory: requested ${l} bytes but only ${this.size} bytes remain`);const[f,i]=this.next.reslice(l);return this.next=i,f}free(l){}get size(){return this.next.byteLength}__destroy__(){this.dtor()}}const Le=!0;function Ln(d){class l{static get SIZE(){return re.SIZE}constructor(i){return new d(i.deref(0,d.SIZE,Le))}}return l}const Mn=6,Cn=await WebAssembly.instantiateStreaming(fetch("data:application/wasm;base64,AGFzbQEAAAABBgFgAX4BfwMCAQAHDgEKaTY0LnBvcGNudAAACggBBgAgAHunCwAKBG5hbWUCAwEAAA=="),{}),In=Cn.instance,Dn=In.exports["i64.popcnt"];class Ve{words;growable;constructor(l,{data:f}={}){this.words=new BigUint64Array(f.buffer,f.byteOffset,f.byteLength>>3),this.growable=!1;for(const i of l??[])this.add(i)}asRef(){return this.words.byteOffset}#e(l){const f=this.words;if(f.length<<6>l)return;if(!this.growable)throw new Error("TODO message");const i=l+64>>>Mn,g=Math.max(i<<3,f.byteLength<<4);var _=new BigUint64Array(new ArrayBuffer(g));_.set(this.words),this.words=_}add(l){this.#e(l);const f=l>>>6,i=1n<>>6,i=1n<({size:l.size*d})}function Rn(...d){return{size:d.reduce((l,f)=>l+f.size,0)}}class Xe{constructor(l){if(this.ptr=l,l.byteLength!=Xe.SIZE)throw new Error(`bad size! got ${l.byteLength} wanted ${Xe.SIZE}`)}static get SIZE(){return 12}get X(){return this.ptr.data.getUint32(0,We)}get Y(){return this.ptr.data.getUint32(4,We)}get Z(){return this.ptr.data.getUint32(8,We)}}class Ke{constructor(l){if(this.ptr=l,l.byteLength!=Ke.SIZE)throw new Error(`bad size! got ${l.byteLength} wanted ${Ke.SIZE}`)}static get SIZE(){return 2}get Core(){return this.ptr.data.getUint8(0)}get Lane(){return this.ptr.data.getUint8(1)}}var ce=(d=>(d[d.Active=0]="Active",d[d.Inactive=1]="Inactive",d[d.AtBarrier=2]="AtBarrier",d[d.AtBreakpoint=3]="AtBreakpoint",d[d.AtAssert=4]="AtAssert",d[d.AtException=5]="AtException",d[d.NotLaunched=6]="NotLaunched",d[d.Exited=7]="Exited",d[d.UNKNOWN=8]="UNKNOWN",d))(ce||{});class V{constructor(l){if(this.ptr=l,l.byteLength!=V.SIZE)throw new Error(`bad size! got ${l.byteLength} wanted ${V.SIZE}`)}static get SIZE(){return 1304}static get OFFSETS(){return{cores:0,lanes:1,result:2,steppedCores:8,steppedLanes:16,laneStates:24}}static get TYPES(){return{cores:Xt,lanes:Xt,steppedCores:Kt,steppedLanes:Kt,laneStates:Pn(Jt)(Rn())}}asRef(){return this.ptr.asRef()}get Cores(){return V.TYPES.cores.get(this.ptr,V.OFFSETS.cores)}get Lanes(){return V.TYPES.lanes.get(this.ptr,V.OFFSETS.lanes)}get SteppedCores(){return new Ve(void 0,{data:this.ptr.slice(V.OFFSETS.steppedCores,V.OFFSETS.steppedCores+V.TYPES.steppedCores.size).data})}get SteppedLanes(){return new Ve(void 0,{data:this.ptr.slice(V.OFFSETS.steppedLanes,V.OFFSETS.steppedLanes+V.TYPES.steppedLanes.size).data})}get LaneStates(){var l=Math.min(this.Cores*this.Lanes,Jt);const f=this.ptr.slice(24),i={get(g){const _=f.slice(20*g,20*g+20);return{get PhyCoord(){return new Ke(_.slice(0,2))},get LogCoord(){return new Xe(_.slice(4,16))},get State(){return _.data.getInt32(16,We)}}},[Symbol.iterator]:()=>{var g=0;return{next(){return g>=l?{done:!0,value:void 0}:{done:!1,value:i.get(g++)}}}}};return i}}const Jt=64;var xn=new TextDecoder("utf8");class Je{constructor(l){this.ptr=l}static get SIZE(){return 12}get __is_long(){return!!(this.ptr.data.getUint8(11)&128)}get data(){return this.__is_long?this.ptr.deref(0,this.length,Le):this.ptr.slice(0,this.length)}get length(){return this.__is_long?this.ptr.data.getUint32(4,Le):this.ptr.data.getUint8(11)&127}get capacity(){return this.__is_long?this.ptr.data.getUint32(8,Le)^2147483648:10}asString(){return xn.decode(this.data.as(Uint8Array))}get[Symbol.toStringTag](){return`std::string(${this.asString})`}}function ge(d){return class{constructor(l){this.ptr=l}static get T(){return d}static get SIZE(){return ge.SIZE}get(l){const[f,i]=[this.ptr.deref(0*re.SIZE,void 0,!0),this.ptr.deref(1*re.SIZE,void 0,!0)],g=d.SIZE,_=(i.addr-f.addr)/g;if(l<0||l>_)throw new Error(`out of bounds access: for index ${l} with elements [0..${_})`);const w=l*g;return new d(f.slice(w,w+g))}[Symbol.iterator](){const[l,f]=[this.ptr.deref(0*re.SIZE,void 0,!0),this.ptr.deref(1*re.SIZE,0,!0)],i=d.SIZE;var g=l;return{next(){if(g.addr>=f.addr)return{done:!0,value:void 0};const _={done:!1,value:new d(g.slice(0,i))};return g=g.slice(i),_}}}}}ge.SIZE=12;function Un(d){return class{constructor(l){this.ptr=l}static get T(){return d}static get SIZE(){return console.assert(d==Je),4+d.SIZE}get __engaged_(){return!!(this.ptr.data.getUint8(d.SIZE)&1)}deref(){if(this.__engaged_)return new d(this.ptr.slice(0,d.SIZE))}}}const Te=!0;class Qt{constructor(l){this.ptr=l}static get SIZE(){return 64}get EntryName(){return Nn(this.ptr.slice(0,64).as(Uint8Array),0,64)}set EntryName(l){if(Fn(l,this.ptr.slice(0,64).as(Uint8Array),0,64)>48n,w=Number(l&BigInt.asUintN(64,2n**64n-1n>>i)),p=this.Allocs.get(Number(_));return console.assert(w+f<=p.NumBytes),p.Data.slice(w,f)}get Allocs(){return new(ge(zn))(this.ptr.slice(2432,2432+ge.SIZE))}}class Hn{constructor(l){this.ptr=l}static get SIZE(){return 20}get Data(){return this.ptr.deref(4,void 0,Te)}}class nr{constructor(l){this.ptr=l}static get SIZE(){return 272}get Objects(){return new(ge(Hn))(this.ptr.slice(32,32+ge.SIZE))}}class or{constructor(l){this.ptr=l}static get SIZE(){return 112}get GlobalMemory(){return new rr(this.ptr.deref(16,rr.SIZE,Te))}get PipelineExecutor(){return new nr(this.ptr.deref(32,nr.SIZE,Te))}}var qn=(()=>{var d=import.meta.url;return async function(l={}){var f,i=Object.assign({},l),g,_,w=new Promise((e,t)=>{g=e,_=t});["_malloc","_free","getExceptionMessage","$incrementExceptionRefcount","$decrementExceptionRefcount","_memory","_assertion","_Session__create__","_Session__destroy__","_Session__params_ref","_Session__module_ref","_Session__device_ref","_Session_run","_Session_dumpBuffers","_Session_start","_Session_printContext","_Session_step","_Session_continue","_Session_print","_Session_switch","_validate_wasm","_test_entry","_test_entry_no_tcf","_run_wasm","_debug_wasm","_Session_fetch_shrubbery","_exception","___indirect_function_table","onRuntimeInitialized"].forEach(e=>{Object.getOwnPropertyDescriptor(w,e)||Object.defineProperty(w,e,{get:()=>H("You are getting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"),set:()=>H("You are setting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")})});var p=typeof window=="object",y=typeof importScripts=="function",N=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",A=!p&&!N&&!y;if(i.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");if(N){const{createRequire:e}=await bn(()=>import("./__vite-browser-external.BIHI7g3E.js"),[]);var z=e(import.meta.url)}var W=Object.assign({},i),ne="./this.program",oe=(e,t)=>{throw t},I="";function J(e){return i.locateFile?i.locateFile(e,I):I+e}var Q,K,_e;if(N){if(typeof process>"u"||!process.release||process.release.name!=="node")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");var Be=process.versions.node,se=Be.split(".").slice(0,3);if(se=se[0]*1e4+se[1]*100+se[2].split("-")[0]*1,se<16e4)throw new Error("This emscripten-generated code requires node v16.0.0 (detected v"+Be+")");var Ce=z("fs"),Ie=z("path");y?I=Ie.dirname(I)+"/":I=z("url").fileURLToPath(new URL("./",import.meta.url)),Q=(e,t)=>(e=ot(e)?new URL(e):Ie.normalize(e),Ce.readFileSync(e,t?void 0:"utf8")),_e=e=>{var t=Q(e,!0);return t.buffer||(t=new Uint8Array(t)),h(t.buffer),t},K=(e,t,r,o=!0)=>{e=ot(e)?new URL(e):Ie.normalize(e),Ce.readFile(e,o?void 0:"utf8",(a,s)=>{a?r(a):t(o?s.buffer:s)})},!i.thisProgram&&process.argv.length>1&&(ne=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),oe=(e,t)=>{throw process.exitCode=e,t}}else if(A){if(typeof process=="object"&&typeof z=="function"||typeof window=="object"||typeof importScripts=="function")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)")}else if(p||y){if(y?I=self.location.href:typeof document<"u"&&document.currentScript&&(I=document.currentScript.src),d&&(I=d),I.startsWith("blob:")?I="":I=I.substr(0,I.replace(/[?#].*/,"").lastIndexOf("/")+1),!(typeof window=="object"||typeof importScripts=="function"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");Q=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},y&&(_e=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),K=(e,t,r)=>{var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="arraybuffer",o.onload=()=>{if(o.status==200||o.status==0&&o.response){t(o.response);return}r()},o.onerror=r,o.send(null)}}else throw new Error("environment detection error");var Ee=i.print||console.log.bind(console),U=i.printErr||console.error.bind(console);Object.assign(i,W),W=null,pn(),i.arguments&&i.arguments,he("arguments","arguments_"),i.thisProgram&&(ne=i.thisProgram),he("thisProgram","thisProgram"),i.quit&&(oe=i.quit),he("quit","quit_"),h(typeof i.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),h(typeof i.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),h(typeof i.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),h(typeof i.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),h(typeof i.read>"u","Module.read option was removed (modify read_ in JS)"),h(typeof i.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),h(typeof i.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),h(typeof i.setWindowTitle>"u","Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),h(typeof i.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),he("asm","wasmExports"),he("read","read_"),he("readAsync","readAsync"),he("readBinary","readBinary"),he("setWindowTitle","setWindowTitle"),h(!y,"worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable."),h(!A,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");var Se;i.wasmBinary&&(Se=i.wasmBinary),he("wasmBinary","wasmBinary"),typeof WebAssembly!="object"&&U("no native wasm support detected");var ue,le=!1;function h(e,t){e||H("Assertion failed"+(t?": "+t:""))}var L,G,de,C,B,fe;function lr(){var e=ue.buffer;i.HEAP8=L=new Int8Array(e),i.HEAP16=de=new Int16Array(e),i.HEAPU8=G=new Uint8Array(e),i.HEAPU16=new Uint16Array(e),i.HEAP32=C=new Int32Array(e),i.HEAPU32=B=new Uint32Array(e),i.HEAPF32=new Float32Array(e),i.HEAPF64=new Float64Array(e),i.HEAP64=fe=new BigInt64Array(e),i.HEAPU64=new BigUint64Array(e)}h(!i.STACK_SIZE,"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"),h(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,"JS engine does not provide full typed array support"),h(!i.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),h(!i.INITIAL_MEMORY,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");function cr(){var e=ht();h((e&3)==0),e==0&&(e+=4),B[e>>2]=34821223,B[e+4>>2]=2310721022,B[0]=1668509029}function rt(){if(!le){var e=ht();e==0&&(e+=4);var t=B[e>>2],r=B[e+4>>2];(t!=34821223||r!=2310721022)&&H(`Stack overflow! Stack cookie has been overwritten at ${Re(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${Re(r)} ${Re(t)}`),B[0]!=1668509029&&H("Runtime error: The application has corrupted its heap memory area (address zero)!")}}(function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,t[0]!==115||t[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})();var gt=[],Et=[],wt=[],$e=!1;function ur(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)mr(i.preRun.shift());at(gt)}function dr(){h(!$e),$e=!0,rt(),!i.noFSInit&&!n.init.initialized&&n.init(),n.ignorePermissions=!1,at(Et)}function fr(){if(rt(),i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)pr(i.postRun.shift());at(wt)}function mr(e){gt.unshift(e)}function hr(e){Et.unshift(e)}function pr(e){wt.unshift(e)}h(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),h(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),h(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),h(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var be=0,ke=null,De=null,Fe={};function yt(e){for(var t=e;;){if(!Fe[e])return e;e=t+Math.random()}}function nt(e){be++,i.monitorRunDependencies?.(be),e?(h(!Fe[e]),Fe[e]=1,ke===null&&typeof setInterval<"u"&&(ke=setInterval(()=>{if(le){clearInterval(ke),ke=null;return}var t=!1;for(var r in Fe)t||(t=!0,U("still waiting on run dependencies:")),U(`dependency: ${r}`);t&&U("(end of list)")},1e4))):U("warning: run dependency added without ID")}function ze(e){if(be--,i.monitorRunDependencies?.(be),e?(h(Fe[e]),delete Fe[e]):U("warning: run dependency removed without ID"),be==0&&(ke!==null&&(clearInterval(ke),ke=null),De)){var t=De;De=null,t()}}function H(e){i.onAbort?.(e),e="Aborted("+e+")",U(e),le=!0,$e&&Ht();var t=new WebAssembly.RuntimeError(e);throw _(t),t}var vr="data:application/octet-stream;base64,",_t=e=>e.startsWith(vr),ot=e=>e.startsWith("file://");function D(e,t){return(...r)=>{h($e,`native function \`${e}\` called before runtime initialization`);var o=X[e];return h(o,`exported native function \`${e}\` not found`),h(r.length<=t,`native function \`${e}\` called with ${r.length} args but expects ${t}`),o(...r)}}var me;i.locateFile?(me="talvos-wasm.wasm",_t(me)||(me=J(me))):me=new URL("/learn-gpgpu/_astro/talvos-wasm.Bc1_K4Ju.wasm",import.meta.url).href;function St(e){if(e==me&&Se)return new Uint8Array(Se);if(_e)return _e(e);throw"both async and sync fetching of the wasm failed"}function gr(e){return!Se&&(p||y)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(t=>{if(!t.ok)throw`failed to load wasm binary file at '${e}'`;return t.arrayBuffer()}).catch(()=>St(e)):Promise.resolve().then(()=>St(e))}function bt(e,t,r){return gr(e).then(o=>WebAssembly.instantiate(o,t)).then(r,o=>{U(`failed to asynchronously prepare wasm: ${o}`),ot(me)&&U(`warning: Loading from a file URI (${me}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`),H(o)})}function Er(e,t,r,o){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!_t(t)&&!N&&typeof fetch=="function"?fetch(t,{credentials:"same-origin"}).then(a=>{var s=WebAssembly.instantiateStreaming(a,r);return s.then(o,function(c){return U(`wasm streaming compile failed: ${c}`),U("falling back to ArrayBuffer instantiation"),bt(t,r,o)})}):bt(t,r,o)}function wr(){return{env:Bt,wasi_snapshot_preview1:Bt}}function yr(){var e=wr();function t(a,s){return X=a.exports,i.wasmExports=X,ue=X.memory,i.wasmMemory=ue,h(ue,"memory not found in wasm exports"),lr(),hr(X.__wasm_call_ctors),ze("wasm-instantiate"),X}nt("wasm-instantiate");var r=i;function o(a){h(i===r,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),r=null,t(a.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(a){U(`Module.instantiateWasm callback failed with error: ${a}`),_(a)}return Er(Se,me,e,o).catch(_),{}}function he(e,t,r=!0){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get(){let o=r?" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)":"";H(`\`Module.${e}\` has been replaced by \`${t}\``+o)}})}function _r(e){Object.getOwnPropertyDescriptor(i,e)&&H(`\`Module.${e}\` was supplied but \`${e}\` not included in INCOMING_MODULE_JS_API`)}function kt(e){return e==="FS_createPath"||e==="FS_createDataFile"||e==="FS_createPreloadedFile"||e==="FS_unlink"||e==="addRunDependency"||e==="FS_createLazyFile"||e==="FS_createDevice"||e==="removeRunDependency"}function At(e,t){typeof globalThis<"u"&&Object.defineProperty(globalThis,e,{configurable:!0,get(){we(`\`${e}\` is not longer defined by emscripten. ${t}`)}})}At("buffer","Please use HEAP8.buffer or wasmMemory.buffer"),At("asm","Please use wasmExports instead");function Sr(e){typeof globalThis<"u"&&!Object.getOwnPropertyDescriptor(globalThis,e)&&Object.defineProperty(globalThis,e,{configurable:!0,get(){var t=`\`${e}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`,r=e;r.startsWith("_")||(r="$"+e),t+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${r}')`,kt(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),we(t)}}),Tt(e)}function Tt(e){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get(){var t=`'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;kt(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),H(t)}})}function br(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var at=e=>{for(;e.length>0;)e.shift()(i)},Ft=()=>X.__cpp_exception,Nt=e=>{var t=e.getArg(Ft(),0);return gn(t)},kr=e=>{var t=Nt(e);vn(t)},it=()=>jt(),st=e=>Yt(e),Pe=e=>Gt(e),Ot=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Ae=(e,t,r)=>{for(var o=t+r,a=t;e[a]&&!(a>=o);)++a;if(a-t>16&&e.buffer&&Ot)return Ot.decode(e.subarray(t,a));for(var s="";t>10,56320|F&1023)}}return s},pe=(e,t)=>(h(typeof e=="number",`UTF8ToString expects a number (got ${typeof e})`),e?Ae(G,e,t):""),Ar=e=>{var t=it(),r=Pe(4),o=Pe(4);En(e,r,o);var a=B[r>>2],s=B[o>>2],c=pe(a);zt(a);var u;return s&&(u=pe(s),zt(s)),st(t),[c,u]},lt=e=>{var t=Nt(e);return Ar(t)};i.getExceptionMessage=lt;var Tr=i.noExitRuntime||!0,Re=e=>(h(typeof e=="number"),e>>>=0,"0x"+e.toString(16).padStart(8,"0")),we=e=>{we.shown||={},we.shown[e]||(we.shown[e]=1,N&&(e="warning: "+e),U(e))},Fr=(e,t,r,o)=>{H(`Assertion failed: ${pe(e)}, at: `+[t?pe(t):"unknown filename",r,o?pe(o):"unknown function"])};function He(){h(j.varargs!=null);var e=C[+j.varargs>>2];return j.varargs+=4,e}var Ne=He,P={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return t.exec(e).slice(1)},normalizeArray:(e,t)=>{for(var r=0,o=e.length-1;o>=0;o--){var a=e[o];a==="."?e.splice(o,1):a===".."?(e.splice(o,1),r++):r&&(e.splice(o,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=P.isAbs(e),r=e.substr(-1)==="/";return e=P.normalizeArray(e.split("/").filter(o=>!!o),!t).join("/"),!e&&!t&&(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=P.splitPath(e),r=t[0],o=t[1];return!r&&!o?".":(o&&(o=o.substr(0,o.length-1)),r+o)},basename:e=>{if(e==="/")return"/";e=P.normalize(e),e=e.replace(/\/$/,"");var t=e.lastIndexOf("/");return t===-1?e:e.substr(t+1)},join:(...e)=>P.normalize(e.join("/")),join2:(e,t)=>P.normalize(e+"/"+t)},Nr=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return o=>crypto.getRandomValues(o);if(N)try{var e=z("crypto"),t=e.randomFillSync;if(t)return o=>e.randomFillSync(o);var r=e.randomBytes;return o=>(o.set(r(o.byteLength)),o)}catch{}H("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")},Lt=e=>(Lt=Nr())(e),ve={resolve:(...e)=>{for(var t="",r=!1,o=e.length-1;o>=-1&&!r;o--){var a=o>=0?e[o]:n.cwd();if(typeof a!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!a)return"";t=a+"/"+t,r=P.isAbs(a)}return t=P.normalizeArray(t.split("/").filter(s=>!!s),!r).join("/"),(r?"/":"")+t||"."},relative:(e,t)=>{e=ve.resolve(e).substr(1),t=ve.resolve(t).substr(1);function r(F){for(var O=0;O=0&&F[M]==="";M--);return O>M?[]:F.slice(O,M-O+1)}for(var o=r(e.split("/")),a=r(t.split("/")),s=Math.min(o.length,a.length),c=s,u=0;u{for(var t=0,r=0;r=55296&&o<=57343?(t+=4,++r):t+=3}return t},qe=(e,t,r,o)=>{if(h(typeof e=="string",`stringToUTF8Array expects a string (got ${typeof e})`),!(o>0))return 0;for(var a=r,s=r+o-1,c=0;c=55296&&u<=57343){var v=e.charCodeAt(++c);u=65536+((u&1023)<<10)|v&1023}if(u<=127){if(r>=s)break;t[r++]=u}else if(u<=2047){if(r+1>=s)break;t[r++]=192|u>>6,t[r++]=128|u&63}else if(u<=65535){if(r+2>=s)break;t[r++]=224|u>>12,t[r++]=128|u>>6&63,t[r++]=128|u&63}else{if(r+3>=s)break;u>1114111&&we("Invalid Unicode code point "+Re(u)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[r++]=240|u>>18,t[r++]=128|u>>12&63,t[r++]=128|u>>6&63,t[r++]=128|u&63}}return t[r]=0,r-a};function Ye(e,t,r){var o=ut(e)+1,a=new Array(o),s=qe(e,a,0,a.length);return t&&(a.length=s),a}var Or=()=>{if(!ct.length){var e=null;if(N){var t=256,r=Buffer.alloc(t),o=0,a=process.stdin.fd;try{o=Ce.readSync(a,r)}catch(s){if(s.toString().includes("EOF"))o=0;else throw s}o>0?e=r.slice(0,o).toString("utf-8"):e=null}else typeof window<"u"&&typeof window.prompt=="function"?(e=window.prompt("Input: "),e!==null&&(e+=` +`)):typeof readline=="function"&&(e=readline(),e!==null&&(e+=` +`));if(!e)return null;ct=Ye(e,!0)}return ct.shift()},ye={ttys:[],init(){},shutdown(){},register(e,t){ye.ttys[e]={input:[],output:[],ops:t},n.registerDevice(e,ye.stream_ops)},stream_ops:{open(e){var t=ye.ttys[e.node.rdev];if(!t)throw new n.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,o,a){if(!e.tty||!e.tty.ops.get_char)throw new n.ErrnoError(60);for(var s=0,c=0;c0&&(Ee(Ae(e.output,0)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,t,r){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(U(Ae(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(U(Ae(e.output,0)),e.output=[])}}},Mt=e=>{H("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported")},T={ops_table:null,mount(e){return T.createNode(null,"/",16895,0)},createNode(e,t,r,o){if(n.isBlkdev(r)||n.isFIFO(r))throw new n.ErrnoError(63);T.ops_table||={dir:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr,lookup:T.node_ops.lookup,mknod:T.node_ops.mknod,rename:T.node_ops.rename,unlink:T.node_ops.unlink,rmdir:T.node_ops.rmdir,readdir:T.node_ops.readdir,symlink:T.node_ops.symlink},stream:{llseek:T.stream_ops.llseek}},file:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr},stream:{llseek:T.stream_ops.llseek,read:T.stream_ops.read,write:T.stream_ops.write,allocate:T.stream_ops.allocate,mmap:T.stream_ops.mmap,msync:T.stream_ops.msync}},link:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr,readlink:T.node_ops.readlink},stream:{}},chrdev:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr},stream:n.chrdev_stream_ops}};var a=n.createNode(e,t,r,o);return n.isDir(a.mode)?(a.node_ops=T.ops_table.dir.node,a.stream_ops=T.ops_table.dir.stream,a.contents={}):n.isFile(a.mode)?(a.node_ops=T.ops_table.file.node,a.stream_ops=T.ops_table.file.stream,a.usedBytes=0,a.contents=null):n.isLink(a.mode)?(a.node_ops=T.ops_table.link.node,a.stream_ops=T.ops_table.link.stream):n.isChrdev(a.mode)&&(a.node_ops=T.ops_table.chrdev.node,a.stream_ops=T.ops_table.chrdev.stream),a.timestamp=Date.now(),e&&(e.contents[t]=a,e.timestamp=a.timestamp),a},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){var o=1024*1024;t=Math.max(t,r*(r>>0),r!=0&&(t=Math.max(t,256));var a=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(a.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(t==0)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=n.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,n.isDir(e.mode)?t.size=4096:n.isFile(e.mode)?t.size=e.usedBytes:n.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){t.mode!==void 0&&(e.mode=t.mode),t.timestamp!==void 0&&(e.timestamp=t.timestamp),t.size!==void 0&&T.resizeFileStorage(e,t.size)},lookup(e,t){throw n.genericErrors[44]},mknod(e,t,r,o){return T.createNode(e,t,r,o)},rename(e,t,r){if(n.isDir(e.mode)){var o;try{o=n.lookupNode(t,r)}catch{}if(o)for(var a in o.contents)throw new n.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=n.lookupNode(e,t);for(var o in r.contents)throw new n.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r of Object.keys(e.contents))t.push(r);return t},symlink(e,t,r){var o=T.createNode(e,t,41471,0);return o.link=r,o},readlink(e){if(!n.isLink(e.mode))throw new n.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,o,a){var s=e.node.contents;if(a>=e.node.usedBytes)return 0;var c=Math.min(e.node.usedBytes-a,o);if(h(c>=0),c>8&&s.subarray)t.set(s.subarray(a,a+c),r);else for(var u=0;u0||r+t{var a=yt(`al ${e}`);K(e,s=>{h(s,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(s)),a&&ze(a)},s=>{if(r)r();else throw`Loading data file "${e}" failed.`}),a&&nt(a)},Mr=(e,t,r,o,a,s)=>{n.createDataFile(e,t,r,o,a,s)},Cr=i.preloadPlugins||[],Ir=(e,t,r,o)=>{typeof Browser<"u"&&Browser.init();var a=!1;return Cr.forEach(s=>{a||s.canHandle(t)&&(s.handle(e,t,r,o),a=!0)}),a},Dr=(e,t,r,o,a,s,c,u,v,F)=>{var O=t?ve.resolve(P.join2(e,t)):e,M=yt(`cp ${O}`);function k(S){function b($){F?.(),u||Mr(e,t,$,o,a,v),s?.(),ze(M)}Ir(S,O,b,()=>{c?.(),ze(M)})||b(S)}nt(M),typeof r=="string"?Lr(r,k,c):k(r)},Pr=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},r=t[e];if(typeof r>"u")throw new Error(`Unknown file open mode: ${e}`);return r},dt=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Rr={0:"Success",1:"Arg list too long",2:"Permission denied",3:"Address already in use",4:"Address not available",5:"Address family not supported by protocol family",6:"No more processes",7:"Socket already connected",8:"Bad file number",9:"Trying to read unreadable message",10:"Mount device busy",11:"Operation canceled",12:"No children",13:"Connection aborted",14:"Connection refused",15:"Connection reset by peer",16:"File locking deadlock error",17:"Destination address required",18:"Math arg out of domain of func",19:"Quota exceeded",20:"File exists",21:"Bad address",22:"File too large",23:"Host is unreachable",24:"Identifier removed",25:"Illegal byte sequence",26:"Connection already in progress",27:"Interrupted system call",28:"Invalid argument",29:"I/O error",30:"Socket is already connected",31:"Is a directory",32:"Too many symbolic links",33:"Too many open files",34:"Too many links",35:"Message too long",36:"Multihop attempted",37:"File or path name too long",38:"Network interface is not configured",39:"Connection reset by network",40:"Network is unreachable",41:"Too many open files in system",42:"No buffer space available",43:"No such device",44:"No such file or directory",45:"Exec format error",46:"No record locks available",47:"The link has been severed",48:"Not enough core",49:"No message of desired type",50:"Protocol not available",51:"No space left on device",52:"Function not implemented",53:"Socket is not connected",54:"Not a directory",55:"Directory not empty",56:"State not recoverable",57:"Socket operation on non-socket",59:"Not a typewriter",60:"No such device or address",61:"Value too large for defined data type",62:"Previous owner died",63:"Not super-user",64:"Broken pipe",65:"Protocol error",66:"Unknown protocol",67:"Protocol wrong type for socket",68:"Math result not representable",69:"Read only file system",70:"Illegal seek",71:"No such process",72:"Stale file handle",73:"Connection timed out",74:"Text file busy",75:"Cross-device link",100:"Device not a stream",101:"Bad font file fmt",102:"Invalid slot",103:"Invalid request code",104:"No anode",105:"Block device required",106:"Channel number out of range",107:"Level 3 halted",108:"Level 3 reset",109:"Link number out of range",110:"Protocol driver not attached",111:"No CSI structure available",112:"Level 2 halted",113:"Invalid exchange",114:"Invalid request descriptor",115:"Exchange full",116:"No data (for no delay io)",117:"Timer expired",118:"Out of streams resources",119:"Machine is not on the network",120:"Package not installed",121:"The object is remote",122:"Advertise error",123:"Srmount error",124:"Communication error on send",125:"Cross mount point (not really error)",126:"Given log. name not unique",127:"f.d. invalid for this operation",128:"Remote address changed",129:"Can access a needed shared lib",130:"Accessing a corrupted shared lib",131:".lib section in a.out corrupted",132:"Attempting to link in too many libs",133:"Attempting to exec a shared library",135:"Streams pipe error",136:"Too many users",137:"Socket type not supported",138:"Not supported",139:"Protocol family not supported",140:"Can't send after socket shutdown",141:"Too many references",142:"Host is down",148:"No medium (in tape drive)",156:"Level 2 not synchronized"},Ct={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},n={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class extends Error{constructor(e){super(Rr[e]),this.name="ErrnoError",this.errno=e;for(var t in Ct)if(Ct[t]===e){this.code=t;break}}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,r,o){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=n.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=o,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return n.isDir(this.mode)}get isDevice(){return n.isChrdev(this.mode)}},lookupPath(e,t={}){if(e=ve.resolve(e),!e)return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};if(t=Object.assign(r,t),t.recurse_count>8)throw new n.ErrnoError(32);for(var o=e.split("/").filter(M=>!!M),a=n.root,s="/",c=0;c40)throw new n.ErrnoError(32)}}return{path:s,node:a}},getPath(e){for(var t;;){if(n.isRoot(e)){var r=e.mount.mountpoint;return t?r[r.length-1]!=="/"?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,o=0;o>>0)%n.nameTable.length},hashAddNode(e){var t=n.hashName(e.parent.id,e.name);e.name_next=n.nameTable[t],n.nameTable[t]=e},hashRemoveNode(e){var t=n.hashName(e.parent.id,e.name);if(n.nameTable[t]===e)n.nameTable[t]=e.name_next;else for(var r=n.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=n.mayLookup(e);if(r)throw new n.ErrnoError(r);for(var o=n.hashName(e.id,t),a=n.nameTable[o];a;a=a.name_next){var s=a.name;if(a.parent.id===e.id&&s===t)return a}return n.lookup(e,t)},createNode(e,t,r,o){h(typeof e=="object");var a=new n.FSNode(e,t,r,o);return n.hashAddNode(a),a},destroyNode(e){n.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var t=["r","w","rw"][e&3];return e&512&&(t+="w"),t},nodePermissions(e,t){return n.ignorePermissions?0:t.includes("r")&&!(e.mode&292)||t.includes("w")&&!(e.mode&146)||t.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!n.isDir(e.mode))return 54;var t=n.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{var r=n.lookupNode(e,t);return 20}catch{}return n.nodePermissions(e,"wx")},mayDelete(e,t,r){var o;try{o=n.lookupNode(e,t)}catch(s){return s.errno}var a=n.nodePermissions(e,"wx");if(a)return a;if(r){if(!n.isDir(o.mode))return 54;if(n.isRoot(o)||n.getPath(o)===n.cwd())return 10}else if(n.isDir(o.mode))return 31;return 0},mayOpen(e,t){return e?n.isLink(e.mode)?32:n.isDir(e.mode)&&(n.flagsToPermissionString(t)!=="r"||t&512)?31:n.nodePermissions(e,n.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=n.MAX_OPEN_FDS;e++)if(!n.streams[e])return e;throw new n.ErrnoError(33)},getStreamChecked(e){var t=n.getStream(e);if(!t)throw new n.ErrnoError(8);return t},getStream:e=>n.streams[e],createStream(e,t=-1){return e=Object.assign(new n.FSStream,e),t==-1&&(t=n.nextfd()),e.fd=t,n.streams[t]=e,e},closeStream(e){n.streams[e]=null},dupStream(e,t=-1){var r=n.createStream(e,t);return r.stream_ops?.dup?.(r),r},chrdev_stream_ops:{open(e){var t=n.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new n.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,t)=>e<<8|t,registerDevice(e,t){n.devices[e]={stream_ops:t}},getDevice:e=>n.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var o=r.pop();t.push(o),r.push(...o.mounts)}return t},syncfs(e,t){typeof e=="function"&&(t=e,e=!1),n.syncFSRequests++,n.syncFSRequests>1&&U(`warning: ${n.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=n.getMounts(n.root.mount),o=0;function a(c){return h(n.syncFSRequests>0),n.syncFSRequests--,t(c)}function s(c){if(c)return s.errored?void 0:(s.errored=!0,a(c));++o>=r.length&&a(null)}r.forEach(c=>{if(!c.type.syncfs)return s(null);c.type.syncfs(c,e,s)})},mount(e,t,r){if(typeof e=="string")throw e;var o=r==="/",a=!r,s;if(o&&n.root)throw new n.ErrnoError(10);if(!o&&!a){var c=n.lookupPath(r,{follow_mount:!1});if(r=c.path,s=c.node,n.isMountpoint(s))throw new n.ErrnoError(10);if(!n.isDir(s.mode))throw new n.ErrnoError(54)}var u={type:e,opts:t,mountpoint:r,mounts:[]},v=e.mount(u);return v.mount=u,u.root=v,o?n.root=v:s&&(s.mounted=u,s.mount&&s.mount.mounts.push(u)),v},unmount(e){var t=n.lookupPath(e,{follow_mount:!1});if(!n.isMountpoint(t.node))throw new n.ErrnoError(28);var r=t.node,o=r.mounted,a=n.getMounts(o);Object.keys(n.nameTable).forEach(c=>{for(var u=n.nameTable[c];u;){var v=u.name_next;a.includes(u.mount)&&n.destroyNode(u),u=v}}),r.mounted=null;var s=r.mount.mounts.indexOf(o);h(s!==-1),r.mount.mounts.splice(s,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,r){var o=n.lookupPath(e,{parent:!0}),a=o.node,s=P.basename(e);if(!s||s==="."||s==="..")throw new n.ErrnoError(28);var c=n.mayCreate(a,s);if(c)throw new n.ErrnoError(c);if(!a.node_ops.mknod)throw new n.ErrnoError(63);return a.node_ops.mknod(a,s,t,r)},create(e,t){return t=t!==void 0?t:438,t&=4095,t|=32768,n.mknod(e,t,0)},mkdir(e,t){return t=t!==void 0?t:511,t&=1023,t|=16384,n.mknod(e,t,0)},mkdirTree(e,t){for(var r=e.split("/"),o="",a=0;a"u"&&(r=t,t=438),t|=8192,n.mknod(e,t,r)},symlink(e,t){if(!ve.resolve(e))throw new n.ErrnoError(44);var r=n.lookupPath(t,{parent:!0}),o=r.node;if(!o)throw new n.ErrnoError(44);var a=P.basename(t),s=n.mayCreate(o,a);if(s)throw new n.ErrnoError(s);if(!o.node_ops.symlink)throw new n.ErrnoError(63);return o.node_ops.symlink(o,a,e)},rename(e,t){var r=P.dirname(e),o=P.dirname(t),a=P.basename(e),s=P.basename(t),c,u,v;if(c=n.lookupPath(e,{parent:!0}),u=c.node,c=n.lookupPath(t,{parent:!0}),v=c.node,!u||!v)throw new n.ErrnoError(44);if(u.mount!==v.mount)throw new n.ErrnoError(75);var F=n.lookupNode(u,a),O=ve.relative(e,o);if(O.charAt(0)!==".")throw new n.ErrnoError(28);if(O=ve.relative(t,r),O.charAt(0)!==".")throw new n.ErrnoError(55);var M;try{M=n.lookupNode(v,s)}catch{}if(F!==M){var k=n.isDir(F.mode),S=n.mayDelete(u,a,k);if(S)throw new n.ErrnoError(S);if(S=M?n.mayDelete(v,s,k):n.mayCreate(v,s),S)throw new n.ErrnoError(S);if(!u.node_ops.rename)throw new n.ErrnoError(63);if(n.isMountpoint(F)||M&&n.isMountpoint(M))throw new n.ErrnoError(10);if(v!==u&&(S=n.nodePermissions(u,"w"),S))throw new n.ErrnoError(S);n.hashRemoveNode(F);try{u.node_ops.rename(F,v,s)}catch(b){throw b}finally{n.hashAddNode(F)}}},rmdir(e){var t=n.lookupPath(e,{parent:!0}),r=t.node,o=P.basename(e),a=n.lookupNode(r,o),s=n.mayDelete(r,o,!0);if(s)throw new n.ErrnoError(s);if(!r.node_ops.rmdir)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);r.node_ops.rmdir(r,o),n.destroyNode(a)},readdir(e){var t=n.lookupPath(e,{follow:!0}),r=t.node;if(!r.node_ops.readdir)throw new n.ErrnoError(54);return r.node_ops.readdir(r)},unlink(e){var t=n.lookupPath(e,{parent:!0}),r=t.node;if(!r)throw new n.ErrnoError(44);var o=P.basename(e),a=n.lookupNode(r,o),s=n.mayDelete(r,o,!1);if(s)throw new n.ErrnoError(s);if(!r.node_ops.unlink)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);r.node_ops.unlink(r,o),n.destroyNode(a)},readlink(e){var t=n.lookupPath(e),r=t.node;if(!r)throw new n.ErrnoError(44);if(!r.node_ops.readlink)throw new n.ErrnoError(28);return ve.resolve(n.getPath(r.parent),r.node_ops.readlink(r))},stat(e,t){var r=n.lookupPath(e,{follow:!t}),o=r.node;if(!o)throw new n.ErrnoError(44);if(!o.node_ops.getattr)throw new n.ErrnoError(63);return o.node_ops.getattr(o)},lstat(e){return n.stat(e,!0)},chmod(e,t,r){var o;if(typeof e=="string"){var a=n.lookupPath(e,{follow:!r});o=a.node}else o=e;if(!o.node_ops.setattr)throw new n.ErrnoError(63);o.node_ops.setattr(o,{mode:t&4095|o.mode&-4096,timestamp:Date.now()})},lchmod(e,t){n.chmod(e,t,!0)},fchmod(e,t){var r=n.getStreamChecked(e);n.chmod(r.node,t)},chown(e,t,r,o){var a;if(typeof e=="string"){var s=n.lookupPath(e,{follow:!o});a=s.node}else a=e;if(!a.node_ops.setattr)throw new n.ErrnoError(63);a.node_ops.setattr(a,{timestamp:Date.now()})},lchown(e,t,r){n.chown(e,t,r,!0)},fchown(e,t,r){var o=n.getStreamChecked(e);n.chown(o.node,t,r)},truncate(e,t){if(t<0)throw new n.ErrnoError(28);var r;if(typeof e=="string"){var o=n.lookupPath(e,{follow:!0});r=o.node}else r=e;if(!r.node_ops.setattr)throw new n.ErrnoError(63);if(n.isDir(r.mode))throw new n.ErrnoError(31);if(!n.isFile(r.mode))throw new n.ErrnoError(28);var a=n.nodePermissions(r,"w");if(a)throw new n.ErrnoError(a);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=n.getStreamChecked(e);if(!(r.flags&2097155))throw new n.ErrnoError(28);n.truncate(r.node,t)},utime(e,t,r){var o=n.lookupPath(e,{follow:!0}),a=o.node;a.node_ops.setattr(a,{timestamp:Math.max(t,r)})},open(e,t,r){if(e==="")throw new n.ErrnoError(44);t=typeof t=="string"?Pr(t):t,r=typeof r>"u"?438:r,t&64?r=r&4095|32768:r=0;var o;if(typeof e=="object")o=e;else{e=P.normalize(e);try{var a=n.lookupPath(e,{follow:!(t&131072)});o=a.node}catch{}}var s=!1;if(t&64)if(o){if(t&128)throw new n.ErrnoError(20)}else o=n.mknod(e,r,0),s=!0;if(!o)throw new n.ErrnoError(44);if(n.isChrdev(o.mode)&&(t&=-513),t&65536&&!n.isDir(o.mode))throw new n.ErrnoError(54);if(!s){var c=n.mayOpen(o,t);if(c)throw new n.ErrnoError(c)}t&512&&!s&&n.truncate(o,0),t&=-131713;var u=n.createStream({node:o,path:n.getPath(o),flags:t,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),i.logReadFiles&&!(t&1)&&(n.readFiles||(n.readFiles={}),e in n.readFiles||(n.readFiles[e]=1)),u},close(e){if(n.isClosed(e))throw new n.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(t){throw t}finally{n.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,t,r){if(n.isClosed(e))throw new n.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new n.ErrnoError(70);if(r!=0&&r!=1&&r!=2)throw new n.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,o,a){if(h(r>=0),o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(e))throw new n.ErrnoError(8);if((e.flags&2097155)===1)throw new n.ErrnoError(8);if(n.isDir(e.node.mode))throw new n.ErrnoError(31);if(!e.stream_ops.read)throw new n.ErrnoError(28);var s=typeof a<"u";if(!s)a=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var c=e.stream_ops.read(e,t,r,o,a);return s||(e.position+=c),c},write(e,t,r,o,a,s){if(h(r>=0),o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(e))throw new n.ErrnoError(8);if(!(e.flags&2097155))throw new n.ErrnoError(8);if(n.isDir(e.node.mode))throw new n.ErrnoError(31);if(!e.stream_ops.write)throw new n.ErrnoError(28);e.seekable&&e.flags&1024&&n.llseek(e,0,2);var c=typeof a<"u";if(!c)a=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var u=e.stream_ops.write(e,t,r,o,a,s);return c||(e.position+=u),u},allocate(e,t,r){if(n.isClosed(e))throw new n.ErrnoError(8);if(t<0||r<=0)throw new n.ErrnoError(28);if(!(e.flags&2097155))throw new n.ErrnoError(8);if(!n.isFile(e.node.mode)&&!n.isDir(e.node.mode))throw new n.ErrnoError(43);if(!e.stream_ops.allocate)throw new n.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,o,a){if(o&2&&!(a&2)&&(e.flags&2097155)!==2)throw new n.ErrnoError(2);if((e.flags&2097155)===1)throw new n.ErrnoError(2);if(!e.stream_ops.mmap)throw new n.ErrnoError(43);return e.stream_ops.mmap(e,t,r,o,a)},msync(e,t,r,o,a){return h(r>=0),e.stream_ops.msync?e.stream_ops.msync(e,t,r,o,a):0},ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new n.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary",t.encoding!=="utf8"&&t.encoding!=="binary")throw new Error(`Invalid encoding type "${t.encoding}"`);var r,o=n.open(e,t.flags),a=n.stat(e),s=a.size,c=new Uint8Array(s);return n.read(o,c,0,s,0),t.encoding==="utf8"?r=Ae(c,0):t.encoding==="binary"&&(r=c),n.close(o),r},writeFile(e,t,r={}){r.flags=r.flags||577;var o=n.open(e,r.flags,r.mode);if(typeof t=="string"){var a=new Uint8Array(ut(t)+1),s=qe(t,a,0,a.length);n.write(o,a,0,s,void 0,r.canOwn)}else if(ArrayBuffer.isView(t))n.write(o,t,0,t.byteLength,void 0,r.canOwn);else throw new Error("Unsupported data type");n.close(o)},cwd:()=>n.currentPath,chdir(e){var t=n.lookupPath(e,{follow:!0});if(t.node===null)throw new n.ErrnoError(44);if(!n.isDir(t.node.mode))throw new n.ErrnoError(54);var r=n.nodePermissions(t.node,"x");if(r)throw new n.ErrnoError(r);n.currentPath=t.path},createDefaultDirectories(){n.mkdir("/tmp"),n.mkdir("/home"),n.mkdir("/home/web_user")},createDefaultDevices(){n.mkdir("/dev"),n.registerDevice(n.makedev(1,3),{read:()=>0,write:(o,a,s,c,u)=>c}),n.mkdev("/dev/null",n.makedev(1,3)),ye.register(n.makedev(5,0),ye.default_tty_ops),ye.register(n.makedev(6,0),ye.default_tty1_ops),n.mkdev("/dev/tty",n.makedev(5,0)),n.mkdev("/dev/tty1",n.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(t===0&&(t=Lt(e).byteLength),e[--t]);n.createDevice("/dev","random",r),n.createDevice("/dev","urandom",r),n.mkdir("/dev/shm"),n.mkdir("/dev/shm/tmp")},createSpecialDirectories(){n.mkdir("/proc");var e=n.mkdir("/proc/self");n.mkdir("/proc/self/fd"),n.mount({mount(){var t=n.createNode(e,"fd",16895,73);return t.node_ops={lookup(r,o){var a=+o,s=n.getStreamChecked(a),c={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>s.path}};return c.parent=c,c}},t}},{},"/proc/self/fd")},createStandardStreams(){i.stdin?n.createDevice("/dev","stdin",i.stdin):n.symlink("/dev/tty","/dev/stdin"),i.stdout?n.createDevice("/dev","stdout",null,i.stdout):n.symlink("/dev/tty","/dev/stdout"),i.stderr?n.createDevice("/dev","stderr",null,i.stderr):n.symlink("/dev/tty1","/dev/stderr");var e=n.open("/dev/stdin",0),t=n.open("/dev/stdout",1),r=n.open("/dev/stderr",1);h(e.fd===0,`invalid handle for stdin (${e.fd})`),h(t.fd===1,`invalid handle for stdout (${t.fd})`),h(r.fd===2,`invalid handle for stderr (${r.fd})`)},staticInit(){[44].forEach(e=>{n.genericErrors[e]=new n.ErrnoError(e),n.genericErrors[e].stack=""}),n.nameTable=new Array(4096),n.mount(T,{},"/"),n.createDefaultDirectories(),n.createDefaultDevices(),n.createSpecialDirectories(),n.filesystems={MEMFS:T}},init(e,t,r){h(!n.init.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),n.init.initialized=!0,i.stdin=e||i.stdin,i.stdout=t||i.stdout,i.stderr=r||i.stderr,n.createStandardStreams()},quit(){n.init.initialized=!1,$t(0);for(var e=0;ethis.length-1||S<0)){var b=S%this.chunkSize,$=S/this.chunkSize|0;return this.getter($)[b]}}setDataGetter(S){this.getter=S}cacheLength(){var S=new XMLHttpRequest;if(S.open("HEAD",r,!1),S.send(null),!(S.status>=200&&S.status<300||S.status===304))throw new Error("Couldn't load "+r+". Status: "+S.status);var b=Number(S.getResponseHeader("Content-length")),$,ee=($=S.getResponseHeader("Accept-Ranges"))&&$==="bytes",Z=($=S.getResponseHeader("Content-Encoding"))&&$==="gzip",m=1024*1024;ee||(m=b);var E=(R,ae)=>{if(R>ae)throw new Error("invalid range ("+R+", "+ae+") or no bytes requested!");if(ae>b-1)throw new Error("only "+b+" bytes available! programmer error!");var q=new XMLHttpRequest;if(q.open("GET",r,!1),b!==m&&q.setRequestHeader("Range","bytes="+R+"-"+ae),q.responseType="arraybuffer",q.overrideMimeType&&q.overrideMimeType("text/plain; charset=x-user-defined"),q.send(null),!(q.status>=200&&q.status<300||q.status===304))throw new Error("Couldn't load "+r+". Status: "+q.status);return q.response!==void 0?new Uint8Array(q.response||[]):Ye(q.responseText||"",!0)},Y=this;Y.setDataGetter(R=>{var ae=R*m,q=(R+1)*m-1;if(q=Math.min(q,b-1),typeof Y.chunks[R]>"u"&&(Y.chunks[R]=E(ae,q)),typeof Y.chunks[R]>"u")throw new Error("doXHR failed!");return Y.chunks[R]}),(Z||!b)&&(m=b=1,b=this.getter(0).length,m=b,Ee("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=b,this._chunkSize=m,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!y)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var c=new s,u={isDevice:!1,contents:c}}else var u={isDevice:!1,url:r};var v=n.createFile(e,t,u,o,a);u.contents?v.contents=u.contents:u.url&&(v.contents=null,v.url=u.url),Object.defineProperties(v,{usedBytes:{get:function(){return this.contents.length}}});var F={},O=Object.keys(v.stream_ops);O.forEach(k=>{var S=v.stream_ops[k];F[k]=(...b)=>(n.forceLoadFile(v),S(...b))});function M(k,S,b,$,ee){var Z=k.node.contents;if(ee>=Z.length)return 0;var m=Math.min(Z.length-ee,$);if(h(m>=0),Z.slice)for(var E=0;E(n.forceLoadFile(v),M(k,S,b,$,ee)),F.mmap=(k,S,b,$,ee)=>{n.forceLoadFile(v);var Z=Mt();if(!Z)throw new n.ErrnoError(48);return M(k,L,Z,S,b),{ptr:Z,allocated:!0}},v.stream_ops=F,v},absolutePath(){H("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder(){H("FS.createFolder has been removed; use FS.mkdir instead")},createLink(){H("FS.createLink has been removed; use FS.symlink instead")},joinPath(){H("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc(){H("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath(){H("FS.standardizePath has been removed; use PATH.normalize instead")}},j={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(P.isAbs(t))return t;var o;if(e===-100)o=n.cwd();else{var a=j.getStreamFromFD(e);o=a.path}if(t.length==0){if(!r)throw new n.ErrnoError(44);return o}return P.join2(o,t)},doStat(e,t,r){var o=e(t);C[r>>2]=o.dev,C[r+4>>2]=o.mode,B[r+8>>2]=o.nlink,C[r+12>>2]=o.uid,C[r+16>>2]=o.gid,C[r+20>>2]=o.rdev,fe[r+24>>3]=BigInt(o.size),C[r+32>>2]=4096,C[r+36>>2]=o.blocks;var a=o.atime.getTime(),s=o.mtime.getTime(),c=o.ctime.getTime();return fe[r+40>>3]=BigInt(Math.floor(a/1e3)),B[r+48>>2]=a%1e3*1e3,fe[r+56>>3]=BigInt(Math.floor(s/1e3)),B[r+64>>2]=s%1e3*1e3,fe[r+72>>3]=BigInt(Math.floor(c/1e3)),B[r+80>>2]=c%1e3*1e3,fe[r+88>>3]=BigInt(o.ino),0},doMsync(e,t,r,o,a){if(!n.isFile(t.node.mode))throw new n.ErrnoError(43);if(o&2)return 0;var s=G.slice(e,e+r);n.msync(t,s,a,r,o)},getStreamFromFD(e){var t=n.getStreamChecked(e);return t},varargs:void 0,getStr(e){var t=pe(e);return t}};function xr(e,t,r){j.varargs=r;try{var o=j.getStreamFromFD(e);switch(t){case 0:{var a=He();if(a<0)return-28;for(;n.streams[a];)a++;var s;return s=n.dupStream(o,a),s.fd}case 1:case 2:return 0;case 3:return o.flags;case 4:{var a=He();return o.flags|=a,0}case 12:{var a=Ne(),c=0;return de[a+c>>1]=2,0}case 13:case 14:return 0}return-28}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Ur(e,t,r){j.varargs=r;try{var o=j.getStreamFromFD(e);switch(t){case 21509:return o.tty?0:-59;case 21505:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var a=o.tty.ops.ioctl_tcgets(o),s=Ne();C[s>>2]=a.c_iflag||0,C[s+4>>2]=a.c_oflag||0,C[s+8>>2]=a.c_cflag||0,C[s+12>>2]=a.c_lflag||0;for(var c=0;c<32;c++)L[s+c+17]=a.c_cc[c]||0;return 0}return 0}case 21510:case 21511:case 21512:return o.tty?0:-59;case 21506:case 21507:case 21508:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){for(var s=Ne(),u=C[s>>2],v=C[s+4>>2],F=C[s+8>>2],O=C[s+12>>2],M=[],c=0;c<32;c++)M.push(L[s+c+17]);return o.tty.ops.ioctl_tcsets(o.tty,t,{c_iflag:u,c_oflag:v,c_cflag:F,c_lflag:O,c_cc:M})}return 0}case 21519:{if(!o.tty)return-59;var s=Ne();return C[s>>2]=0,0}case 21520:return o.tty?-28:-59;case 21531:{var s=Ne();return n.ioctl(o,t,s)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var k=o.tty.ops.ioctl_tiocgwinsz(o.tty),s=Ne();de[s>>1]=k[0],de[s+2>>1]=k[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(S){if(typeof n>"u"||S.name!=="ErrnoError")throw S;return-S.errno}}function Br(e,t,r,o){j.varargs=o;try{t=j.getStr(t),t=j.calculateAt(e,t);var a=o?He():0;return n.open(t,r,a).fd}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}var $r=e=>{var t=new WebAssembly.Exception(Ft(),[e],{traceStack:!0});throw t.message=lt(t),t},zr=()=>{H("native code called abort()")},Hr=e=>{H(`Cannot enlarge memory arrays to size ${e} bytes (OOM). Either (1) compile with -sINITIAL_MEMORY=X with X higher than the current value ${L.length}, (2) compile with -sALLOW_MEMORY_GROWTH which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -sABORTING_MALLOC=0`)},qr=e=>{G.length,e>>>=0,Hr(e)},ft={},Yr=()=>ne||"./this.program",xe=()=>{if(!xe.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Yr()};for(var r in ft)ft[r]===void 0?delete t[r]:t[r]=ft[r];var o=[];for(var r in t)o.push(`${r}=${t[r]}`);xe.strings=o}return xe.strings},Gr=(e,t)=>{for(var r=0;r{var r=0;return xe().forEach((o,a)=>{var s=t+r;B[e+a*4>>2]=s,Gr(o,s),r+=o.length+1}),0},Wr=(e,t)=>{var r=xe();B[e>>2]=r.length;var o=0;return r.forEach(a=>o+=a.length+1),B[t>>2]=o,0},It=0,Dt=()=>Tr||It>0,Zr=e=>{Dt()||(i.onExit?.(e),le=!0),oe(e,new br(e))},Vr=(e,t)=>{if(Sn(),Dt()&&!t){var r=`program exited (with status: ${e}), but keepRuntimeAlive() is set (counter=${It}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;_(r),U(r)}Zr(e)},Xr=Vr;function Kr(e){try{var t=j.getStreamFromFD(e);return n.close(t),0}catch(r){if(typeof n>"u"||r.name!=="ErrnoError")throw r;return r.errno}}function Jr(e,t){try{var r=0,o=0,a=0,s=j.getStreamFromFD(e),c=s.tty?2:n.isDir(s.mode)?3:n.isLink(s.mode)?7:4;return L[t]=c,de[t+2>>1]=a,fe[t+8>>3]=BigInt(r),fe[t+16>>3]=BigInt(o),0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var Qr=(e,t,r,o)=>{for(var a=0,s=0;s>2],u=B[t+4>>2];t+=8;var v=n.read(e,L,c,u,o);if(v<0)return-1;if(a+=v,v>2]=s,0}catch(c){if(typeof n>"u"||c.name!=="ErrnoError")throw c;return c.errno}}var tn=9007199254740992,rn=-9007199254740992,nn=e=>etn?NaN:Number(e);function on(e,t,r,o){t=nn(t);try{if(isNaN(t))return 61;var a=j.getStreamFromFD(e);return n.llseek(a,t,r),fe[o>>3]=BigInt(a.position),a.getdents&&t===0&&r===0&&(a.getdents=null),0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var an=(e,t,r,o)=>{for(var a=0,s=0;s>2],u=B[t+4>>2];t+=8;var v=n.write(e,L,c,u,o);if(v<0)return-1;a+=v}return a};function sn(e,t,r,o){try{var a=j.getStreamFromFD(e),s=an(a,t,r);return B[o>>2]=s,0}catch(c){if(typeof n>"u"||c.name!=="ErrnoError")throw c;return c.errno}}var Ge=e=>e%4===0&&(e%100!==0||e%400===0),ln=(e,t)=>{for(var r=0,o=0;o<=t;r+=e[o++]);return r},Pt=[31,29,31,30,31,30,31,31,30,31,30,31],Rt=[31,28,31,30,31,30,31,31,30,31,30,31],cn=(e,t)=>{for(var r=new Date(e.getTime());t>0;){var o=Ge(r.getFullYear()),a=r.getMonth(),s=(o?Pt:Rt)[a];if(t>s-r.getDate())t-=s-r.getDate()+1,r.setDate(1),a<11?r.setMonth(a+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1));else return r.setDate(r.getDate()+t),r}return r},mt=(e,t)=>{h(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),L.set(e,t)},un=(e,t,r,o)=>{var a=B[o+40>>2],s={tm_sec:C[o>>2],tm_min:C[o+4>>2],tm_hour:C[o+8>>2],tm_mday:C[o+12>>2],tm_mon:C[o+16>>2],tm_year:C[o+20>>2],tm_wday:C[o+24>>2],tm_yday:C[o+28>>2],tm_isdst:C[o+32>>2],tm_gmtoff:C[o+36>>2],tm_zone:a?pe(a):""},c=pe(r),u={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var v in u)c=c.replace(new RegExp(v,"g"),u[v]);var F=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],O=["January","February","March","April","May","June","July","August","September","October","November","December"];function M(m,E,Y){for(var R=typeof m=="number"?m.toString():m||"";R.length0?1:0}var R;return(R=Y(m.getFullYear()-E.getFullYear()))===0&&(R=Y(m.getMonth()-E.getMonth()))===0&&(R=Y(m.getDate()-E.getDate())),R}function b(m){switch(m.getDay()){case 0:return new Date(m.getFullYear()-1,11,29);case 1:return m;case 2:return new Date(m.getFullYear(),0,3);case 3:return new Date(m.getFullYear(),0,2);case 4:return new Date(m.getFullYear(),0,1);case 5:return new Date(m.getFullYear()-1,11,31);case 6:return new Date(m.getFullYear()-1,11,30)}}function $(m){var E=cn(new Date(m.tm_year+1900,0,1),m.tm_yday),Y=new Date(E.getFullYear(),0,4),R=new Date(E.getFullYear()+1,0,4),ae=b(Y),q=b(R);return S(ae,E)<=0?S(q,E)<=0?E.getFullYear()+1:E.getFullYear():E.getFullYear()-1}var ee={"%a":m=>F[m.tm_wday].substring(0,3),"%A":m=>F[m.tm_wday],"%b":m=>O[m.tm_mon].substring(0,3),"%B":m=>O[m.tm_mon],"%C":m=>{var E=m.tm_year+1900;return k(E/100|0,2)},"%d":m=>k(m.tm_mday,2),"%e":m=>M(m.tm_mday,2," "),"%g":m=>$(m).toString().substring(2),"%G":$,"%H":m=>k(m.tm_hour,2),"%I":m=>{var E=m.tm_hour;return E==0?E=12:E>12&&(E-=12),k(E,2)},"%j":m=>k(m.tm_mday+ln(Ge(m.tm_year+1900)?Pt:Rt,m.tm_mon-1),3),"%m":m=>k(m.tm_mon+1,2),"%M":m=>k(m.tm_min,2),"%n":()=>` +`,"%p":m=>m.tm_hour>=0&&m.tm_hour<12?"AM":"PM","%S":m=>k(m.tm_sec,2),"%t":()=>" ","%u":m=>m.tm_wday||7,"%U":m=>{var E=m.tm_yday+7-m.tm_wday;return k(Math.floor(E/7),2)},"%V":m=>{var E=Math.floor((m.tm_yday+7-(m.tm_wday+6)%7)/7);if((m.tm_wday+371-m.tm_yday-2)%7<=2&&E++,E){if(E==53){var R=(m.tm_wday+371-m.tm_yday)%7;R!=4&&(R!=3||!Ge(m.tm_year))&&(E=1)}}else{E=52;var Y=(m.tm_wday+7-m.tm_yday-1)%7;(Y==4||Y==5&&Ge(m.tm_year%400-1))&&E++}return k(E,2)},"%w":m=>m.tm_wday,"%W":m=>{var E=m.tm_yday+7-(m.tm_wday+6)%7;return k(Math.floor(E/7),2)},"%y":m=>(m.tm_year+1900).toString().substring(2),"%Y":m=>m.tm_year+1900,"%z":m=>{var E=m.tm_gmtoff,Y=E>=0;return E=Math.abs(E)/60,E=E/60*100+E%60,(Y?"+":"-")+("0000"+E).slice(-4)},"%Z":m=>m.tm_zone,"%%":()=>"%"};c=c.replace(/%%/g,"\0\0");for(var v in ee)c.includes(v)&&(c=c.replace(new RegExp(v,"g"),ee[v](s)));c=c.replace(/\0\0/g,"%");var Z=Ye(c,!1);return Z.length>t?0:(mt(Z,e),Z.length-1)},dn=(e,t,r,o,a)=>un(e,t,r,o),fn=e=>{var t=i["_"+e];return h(t,"Cannot call unknown function "+e+", make sure it is exported"),t},mn=(e,t,r)=>(h(typeof r=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),qe(e,G,t,r)),xt=e=>{var t=ut(e)+1,r=Pe(t);return mn(e,r,t),r},Ut=(e,t,r,o,a)=>{var s={string:b=>{var $=0;return b!=null&&b!==0&&($=xt(b)),$},array:b=>{var $=Pe(b.length);return mt(b,$),$}};function c(b){return t==="string"?pe(b):t==="boolean"?!!b:b}var u=fn(e),v=[],F=0;if(h(t!=="array",'Return type should not be "array".'),o)for(var O=0;O(...a)=>Ut(e,t,r,a);n.createPreloadedFile=Dr,n.staticInit();function pn(){_r("fetchSettings")}var Bt={__assert_fail:Fr,__syscall_fcntl64:xr,__syscall_ioctl:Ur,__syscall_openat:Br,__throw_exception_with_stack_trace:$r,abort:zr,emscripten_resize_heap:qr,environ_get:jr,environ_sizes_get:Wr,exit:Xr,fd_close:Kr,fd_fdstat_get:Jr,fd_read:en,fd_seek:on,fd_write:sn,strftime_l:dn},X=yr();i._assertion=D("assertion",0),i._Session__create__=D("Session__create__",2),i._Session__destroy__=D("Session__destroy__",1),i._Session__params_ref=D("Session__params_ref",1),i._Session__module_ref=D("Session__module_ref",1),i._Session__device_ref=D("Session__device_ref",1),i._Session_run=D("Session_run",1),i._Session_dumpBuffers=D("Session_dumpBuffers",1),i._Session_start=D("Session_start",2),i._Session_printContext=D("Session_printContext",1),i._Session_step=D("Session_step",3),i._Session_continue=D("Session_continue",2),i._Session_print=D("Session_print",3),i._Session_switch=D("Session_switch",3),i._validate_wasm=D("validate_wasm",1),i._test_entry=D("test_entry",3),i._test_entry_no_tcf=D("test_entry_no_tcf",1),i._run_wasm=D("run_wasm",2),i._debug_wasm=D("debug_wasm",2),i._Session_fetch_shrubbery=D("Session_fetch_shrubbery",2),i._exception=D("exception",0);var $t=D("fflush",1),zt=i._free=D("free",1);i._malloc=D("malloc",1);var Ht=()=>(Ht=X.__trap)(),qt=()=>(qt=X.emscripten_stack_init)(),ht=()=>(ht=X.emscripten_stack_get_end)(),Yt=e=>(Yt=X._emscripten_stack_restore)(e),Gt=e=>(Gt=X._emscripten_stack_alloc)(e),jt=()=>(jt=X.emscripten_stack_get_current)(),vn=D("__cxa_decrement_exception_refcount",1),gn=D("__thrown_object_from_unwind_exception",1),En=D("__get_exception_message",3);i.wasmMemory=ue,i.wasmExports=X,i.stackSave=it,i.stackRestore=st,i.stackAlloc=Pe,i.ccall=Ut,i.cwrap=hn,i.UTF8ArrayToString=Ae,i.stringToUTF8Array=qe,i.stringToUTF8OnStack=xt,i.writeArrayToMemory=mt,i.decrementExceptionRefcount=kr,i.getExceptionMessage=lt;var wn=["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertI32PairToI53Checked","convertU32PairToI53","getTempRet0","setTempRet0","growMemory","ydayFromDate","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","emscriptenLog","readEmAsmArgs","jstoi_q","listenOnce","autoResumeAudioContext","getDynCaller","dynCall","handleException","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","asmjsMangle","HandleAllocator","getNativeTypeSize","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","uleb128Encode","sigToWasmTypes","generateFuncType","convertJsFunctionToWasm","getEmptyTableSlot","updateTableMap","getFunctionAddress","addFunction","removeFunction","reallyNegative","unSign","strLen","reSign","formatString","intArrayToString","AsciiToString","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","stringToNewUTF8","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","checkWasiClock","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","createDyncallWrapper","safeSetTimeout","setImmediateWrapped","clearImmediateWrapped","polyfillSetImmediate","getPromise","makePromise","idsToPromises","makePromiseCallback","Browser_asyncPrepareDataCounter","setMainLoop","getSocketFromFD","getSocketAddress","FS_unlink","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","setErrNo","demangle","stackTrace"];wn.forEach(Sr);var yn=["run","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","FS_createFolder","FS_createPath","FS_createLazyFile","FS_createLink","FS_createDevice","FS_readFile","out","err","callMain","abort","writeStackCookie","checkStackCookie","MAX_INT53","MIN_INT53","bigintToI53Checked","ptrToString","zeroMemory","exitJS","getHeapMax","abortOnCannotGrowMemory","ENV","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","isLeapYear","arraySum","addDays","ERRNO_CODES","ERRNO_MESSAGES","DNS","Protocols","Sockets","initRandomFill","randomFill","timers","warnOnce","readEmAsmArgsArray","jstoi_s","getExecutableName","keepRuntimeAlive","asyncLoad","alignMemory","mmapAlloc","wasmTable","noExitRuntime","getCFunc","freeTableIndexes","functionsInTableMap","setValue","getValue","PATH","PATH_FS","UTF8Decoder","UTF8ToString","stringToUTF8","lengthBytesUTF8","intArrayFromString","stringToAscii","UTF16Decoder","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","doReadv","doWritev","promiseMap","getExceptionMessageCommon","getCppExceptionTag","getCppExceptionThrownObjectFromWebAssemblyException","incrementExceptionRefcount","Browser","getPreloadedImageData__data","wget","SYSCALLS","preloadPlugins","FS_createPreloadedFile","FS_modeStringToFlags","FS_getMode","FS_stdin_getChar_buffer","FS_stdin_getChar","FS","FS_createDataFile","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","allocateUTF8","allocateUTF8OnStack"];yn.forEach(Tt);var je;De=function e(){je||Wt(),je||(De=e)};function _n(){qt(),cr()}function Wt(){if(be>0||(_n(),ur(),be>0))return;function e(){je||(je=!0,i.calledRun=!0,!le&&(dr(),g(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),h(!i._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),fr()))}i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("")},1),e()},1)):e(),rt()}function Sn(){var e=Ee,t=U,r=!1;Ee=U=o=>{r=!0};try{$t(0),["stdout","stderr"].forEach(function(o){var a=n.analyzePath("/dev/"+o);if(a){var s=a.object,c=s.rdev,u=ye.ttys[c];u?.output?.length&&(r=!0)}})}catch{}Ee=e,U=t,r&&we("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.")}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();Wt(),f=w;for(const e of Object.keys(i))e in l||Object.defineProperty(l,e,{configurable:!0,get(){H(`Access to module property ('${e}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return f}})();class Yn extends HTMLElement{constructor(){super(),this._p=new Promise((l,f)=>{this._resolve=l})}get connected(){return this._p}connectedCallback(){this.attachShadow({mode:"open",...this.attributes}).append(...this.childNodes),this._resolve()}_p;_resolve}customElements.define("shadow-root",Yn);const x=document.getElementById("talvos"),ie=x.querySelector("output.stdio")||{},te=x.querySelector("output.error")||{};var Gn={print:function(d){ie.value+=d+` +`},printErr:function(d){ie.value+=d+` +`}};window.addEventListener("error",d=>{te.value=""+d.message});window.addEventListener("unhandledrejection",function(d){te.value=""+d.reason});const Ue=new Promise(async(d,l)=>{const f=document.querySelectorAll("#talvos shadow-root");await Promise.all([...f].map(i=>i.connected));for(const i of f){const g=i.shadowRoot.querySelector("svg.vis0");if(g){d(g);return}}l("el not found")}),[pt,jn]=(()=>{function*d(...p){const y=p.map(A=>A[Symbol.iterator]());let N=y.map(A=>A.next());for(;N.every(({done:A})=>!A);)yield N.map(({value:A})=>A),N=y.map(A=>A.next())}const l=async()=>{(await Ue).querySelectorAll(".lane").forEach(p=>{p.classList.remove("disabled","selected"),p.dataset.state="inactive",delete p.dataset.logCoords})};document.querySelector("#talvos button.stop").addEventListener("click",l),document.querySelector("#talvos button.continue").addEventListener("click",()=>setTimeout(l,0)),document.querySelector("#talvos button.run").addEventListener("click",l);function _(p){switch(p){case ce.Active:return"active";case ce.Inactive:return"inactive";case ce.AtBarrier:return"at-barrier";case ce.AtBreakpoint:return"at-breakpoint";case ce.AtAssert:return"at-assert";case ce.AtException:return"at-exception";case ce.NotLaunched:return"not-launched";case ce.Exited:return"exited";case ce.UNKNOWN:return"unkown"}}async function w(p){console.assert(""+p.Cores==(await Ue).dataset.cores),console.assert(""+p.Lanes==(await Ue).dataset.lanes);for(const[y,N,A]of d(function*(){let z=0;for(;;)yield z++}(),(await Ue).querySelectorAll("g > .lane"),p.LaneStates))console.assert(`{ ${A.PhyCoord.Core}, ${A.PhyCoord.Lane} }`==N.dataset.phyCoords),N.dataset.state=_(A.State),N.dataset.logCoords=`{ 0, (${A.LogCoord.X},${A.LogCoord.Y},${A.LogCoord.Z}) }`,N.classList.toggle("selected",p.SteppedLanes.has(y))}return[async p=>{let y=[];for(const N of[w])try{N(p)}catch(A){y.push(A)}if(y.length>0)throw y},l]})(),ar=document.querySelector("#talvos section.buffers");var vt={};function ir(d,l){ar.innerHTML="";const f=d.GlobalMemory,i=d.PipelineExecutor.Objects;for(const w of l.Buffers){const p=document.createElement("figure"),y=document.createElement("figcaption");y.innerText=`Buffer '${w.Name.deref()?.asString()??""}' (${w.Size} bytes):'`,p.appendChild(y);const N=document.createElement("ol"),A=i.get(w.Id).Data.data.getBigUint64(0,Le),z=f.deref(A,64),W=4,ne=I=>z.data.getUint32(I,Le),oe=vt["0x"+A.toString(16)]??[];for(var g=[],_=0;_<=15;_++){const I=document.createElement("li");I.innerText=g[_]=""+ne(_*W),_ in oe&&oe[_]!=g[_]&&(I.dataset.prev=oe[_]),N.appendChild(I)}vt["0x"+A.toString(16)]=g,p.appendChild(N),ar.appendChild(p)}}const Oe=document.querySelector("#talvos .controls select");Oe.addEventListener("input",()=>{switch(Oe.value){case"v0":case"v1":document.querySelectorAll(`#talvos > .vis.${Oe.value}`).forEach(l=>{l.classList.remove("hidden")}),document.querySelectorAll(`#talvos > .vis:not(.${Oe.value})`).forEach(l=>{l.classList.add("hidden")});const d=Oe.value=="v1";document.querySelector("#talvos").classList.toggle("vis-wip",d);break;default:throw new Error(`unknown vis: ${Oe.value}`)}});const[Wn,Zn,Vn,Xn,{Session:et}]=function(d){return[d.then(l=>l.cwrap("validate_wasm","boolean",["string"])),d.then(l=>l.cwrap("exception",void 0,[])),d.then(l=>l.cwrap("assertion",void 0,[])),d.then(l=>l.getExceptionMessage),(()=>{var l=d.then(({wasmExports:{Session__create__:f,Session__destroy__:i,Session__params_ref:g,Session__module_ref:_,Session__device_ref:w,Session_run:p,Session_dumpBuffers:y,Session_start:N,Session_step:A,Session_switch:z,Session_print:W,Session_continue:ne,Session_printContext:oe,Session_fetch_shrubbery:I},stackAlloc:J,stackSave:Q,stackRestore:K,stringToUTF8OnStack:_e,HEAP32:Be,wasmMemory:se,_malloc:Ce,_free:Ie})=>{function Ee(le){const h=Ce(le),L=se.buffer,G=new re(L,h,le);return[G,()=>Ie(G.addr)]}function U(le){const h=le.map(_e),L=J(h.length);return h.forEach((G,de)=>{Be[L+de*4>>2]=G}),[h.length,L]}const Se=4096;class ue{ptr;arena;lastOp;laneMask;params;module;device;static bind(h){try{var L=Object.create(this.prototype);L.ptr=h,L.arena=new On(...Ee(Se)),L.lastOp=new V(L.arena.alloc(V.SIZE)),L.laneMask=new Ve(void 0,{data:L.arena.alloc(8).data}),L.params=new Qt(new re(se.buffer,g(h),Qt.SIZE)),L.module=new tr(new re(se.buffer,_(h),tr.SIZE)),L.device=new or(new re(se.buffer,w(h),or.SIZE))}catch(G){throw i(h),L?.arena&&Me(L.arena),G}return L}constructor(h){const L=Q(),[G,de]=[h,"EXEC"].map(_e),C=f(G,de);return K(L),ue.bind(C)}run(){p(this.ptr)}dumpBuffers(){y(this.ptr)}start(){vt={},N(this.ptr,this.lastOp.ptr.asRef()),pt(this.lastOp),ir(this.device,this.module)}async step(){this.laneMask.clear(),(await Ue).querySelectorAll(".lane").forEach((L,G)=>{L.classList.contains("selected")&&this.laneMask.add(G)});var h=A(this.ptr,this.laneMask.asRef(),this.lastOp.asRef());return pt(this.lastOp),ir(this.device,this.module),h>0&&jn(),h}switch(h){const L=Q();z(this.ptr,...U(["switch",...h])),K(L)}print(h){const L=Q();W(this.ptr,...U(["print",...h])),K(L)}continue(){ne(this.ptr,this.lastOp.ptr.asRef()),pt(this.lastOp)}printContext(){oe(this.ptr)}fetchShrubbery(){var h=this.arena.alloc(8);return I(this.ptr,h.asRef()),new Ve(void 0,{data:h.data})}__destroy__(){console.log("Session.destroy..."),i(this.ptr),this.ptr=0,Me(this.arena)}}return{Session:ue}});return{Session:l.then(f=>f.Session)}})()]}(qn(Gn));function Me(d){d.__destroy__()}function tt(d,l){return ie.value="",te.value="",x.querySelector("output.timing").value="...",x.querySelectorAll("button.exec").forEach(f=>f.disabled=!0),l=l??window.performance.mark("talvos"),(async()=>d())().catch(async f=>{var i;if(f instanceof WebAssembly.Exception){var g;[g,i]=(await Xn)(f),i=i||`of type ${g}`,console.error(f.stack)}else console.error(`in ${l.name}:`,f),i=""+f;te.value=i}).finally(()=>{const f=window.performance.measure(l.name,l.name);x.querySelector("output.timing").value=`done in ${f.duration}ms`,x.querySelectorAll("button.exec").forEach(i=>i.removeAttribute("disabled"))})}x.querySelector("button.validate").onclick=async function(){const d=x.querySelector(".module").value,l=window.performance.mark("validate_wasm",{detail:{text:d}}),f=await tt(async()=>(await Wn)(d),l);x.querySelector("output.stdio").value+=f?"ok!":"not ok :("};x.querySelector("button.assertion").onclick=async()=>tt(await Vn);x.querySelector("button.exception").onclick=async()=>tt(await Zn);x.querySelector("button.shrubbery").onclick=async()=>{const d=(await et).bind(828927560446);try{const l=d.fetchShrubbery();console.log(l)}finally{Me(d.arena)}};x.querySelector("button.run").onclick=async function(){const d=x.querySelector(".module").value,l=window.performance.mark("run_wasm",{detail:{text:d}});tt(async()=>{const f=new(await et)(d),i=x.querySelector('select[name="entry"]');f.params.EntryName=i.selectedOptions.item(0)?.value??"main";try{f.run(),f.dumpBuffers()}finally{Me(f)}},l)};x.querySelector("button.debug").onclick=async function(){ie.value="",te.value="",x.querySelector("output.timing").value="...",x.querySelectorAll("button.exec").forEach(w=>w.disabled=!0);const d=x.querySelector(".module").value,l=window.performance.mark("debug",{detail:{text:d}}),f=new(await et)(d);f.params.EntryName=sr.selectedOptions.item(0)?.value??"main";const i=x.querySelector(".debugger");function g(){i.hidden=!0,i.querySelectorAll("button").forEach(p=>p.onclick=null),x.querySelectorAll("button.exec").forEach(p=>p.removeAttribute("disabled")),Me(f);const w=window.performance.measure(l.name,l.name);x.querySelector("output.timing").value=`done in ${w.duration}ms`}try{f.start(),f.printContext()}catch(w){throw g(),w}const _=1;i.querySelector("button.step").onclick=async function(){ie.value="",te.value="";try{await f.step()==_&&g(),f.printContext()}catch(w){throw g(),w}},i.querySelector("button.switch").onclick=function(){const w=prompt("Usage: switch: X [Y [Z]]","X [Y [Z]]");if(w==null)return;const p=w.split(/\s+/);f.switch(p)},i.querySelector("button.print").onclick=function(){const w=prompt("Usage: print: %","%15");if(w==null)return;const p=w.split(/\s+/);f.print(p)},i.querySelector("button.stop").onclick=g,i.querySelector("button.continue").onclick=function(){ie.value="",te.value="";try{f.continue()}finally{g()}},i.hidden=!1};const sr=x.querySelector('select[name="entry"]');setTimeout(async function(){const l=ie.value,f=te.value;ie.value="",te.value="";const i=x.querySelector(".module").value,g=new(await et)(i);try{console.log([...g.module.EntryPoints].map(_=>_.Name.asString())),sr.innerHTML=[...g.module.EntryPoints].map(_=>``).join("")}finally{Me(g)}ie.value&&console.log(ie.value),ie.value=l,te.value&&console.error(te.value),te.value=f},0); diff --git a/dist/_astro/hoisted.C6z89VfC.js b/dist/_astro/hoisted.C6z89VfC.js deleted file mode 100644 index 8aeb142..0000000 --- a/dist/_astro/hoisted.C6z89VfC.js +++ /dev/null @@ -1,6 +0,0 @@ -import{_ as bn}from"./preload-helper.Cd0R8zjt.js";const Je=document.querySelector("#talvos svg.vis0"),We=Je.querySelector("tspan.physical"),Zt=Je.querySelector("tspan.logical"),kn=Je.querySelectorAll(".lane");for(const d of kn)d.addEventListener("mouseenter",function(){We.textContent=this.dataset.phyCoords,Zt.textContent=this.dataset.logCoords??"N/A"}),d.addEventListener("mouseleave",function(){We.textContent="N/A",Zt.textContent="N/A"}),d.addEventListener("click",function(){this.classList.contains(".disabled")||this.classList.toggle("selected")});const An=Je.querySelectorAll(".ctrl");for(const[d,l]of An.entries())l.addEventListener("mouseenter",function(){We.textContent=`{ ${d}, [${d*8}-${d*8+7}] }`}),l.addEventListener("mouseleave",function(){We.textContent="N/A"}),l.addEventListener("click",function(){if(!!!this.parentNode.querySelector('.lane[data-state="active"], .lane[data-state="inactive"]'))return;const i=!this.parentNode.querySelector(".lane.selected");this.parentNode.querySelectorAll(".lane").forEach(g=>{g.classList.toggle("selected",i)})});(async()=>{const d=[{label:"%2",kind:"alu",values:function*(){let _=281474976710656;for(;;){const N=_;_+=4,yield`0x${N.toString(16)}`}}},{label:"%3",kind:"mem",values:function*(){let _=0;for(;;)yield`${_++}`}},{label:"%4",kind:"alu",values:function*(){let _=562949953421312;for(;;){const N=_;_+=4,yield`0x${N.toString(16)}`}}},{label:"st",kind:"mem",values:function*(){for(;;)yield"✔"}}];var l;function f(){l={cur:1,last:["completed"],gen:(()=>{const _=d[1].values();return _.next(),_})()}}f(),document.querySelector("#talvos .controls button.reset").addEventListener("click",function(){f(),p()}),document.querySelector("#talvos .controls button.vis.step0").addEventListener("click",function(){if(l.cur>=d.length)return;switch(d[l.cur]?.kind){case"alu":l.last=[...l.last,...[...w.querySelectorAll(`:nth-child(${l.cur+1} of :has(g.results)) g.results .dispatched:not(.completed)`)].map(N=>"completed")];break;case"mem":l.last=[...l.last,"completed"];break;default:throw new Error(`unknown op kind: ${d[l.cur]?.kind}`)}const _=parseInt(w.dataset.lanes||"");l.last.length>=_&&(l={cur:l.cur+1,last:[]}),p()}),document.querySelector("#talvos .controls button.vis.step1").addEventListener("click",function(){l={cur:l.cur+1,last:[]},p()});const w=await new Promise(async(_,N)=>{await customElements.whenDefined("shadow-root");const A=document.querySelectorAll("#talvos shadow-root");for(const z of A){const W=z.shadowRoot.querySelector("svg.vis1");if(W){_(W);return}}N("el not found")});function p(){w.replaceChildren(...w.querySelectorAll("style,defs"),(_=>(_.setAttribute("href","#step"),_.setAttribute("width","60px"),_.setAttribute("height","240px"),_.setAttribute("x",`${(l.cur||1)*60}`),_))(document.createElementNS("http://www.w3.org/2000/svg","use")),...d.map((_,N)=>{const A=document.createElementNS("http://www.w3.org/2000/svg","svg");A.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),A.setAttribute("viewBox","0 0 60 240"),A.setAttribute("width","60px"),A.setAttribute("height","240px"),A.setAttribute("x",`${N*60}`);const z=A.appendChild(document.createElementNS("http://www.w3.org/2000/svg","circle"));z.setAttribute("cx","30"),z.setAttribute("cy","55"),z.setAttribute("r","12");const W=A.appendChild(document.createElementNS("http://www.w3.org/2000/svg","text"));W.setAttribute("x","30"),W.setAttribute("y","55"),W.setAttribute("dominant-baseline","middle"),W.setAttribute("text-anchor","middle"),W.append(_.label);const ne=A.appendChild(document.createElementNS("http://www.w3.org/2000/svg","g"));ne.classList.add("results");for(var X=0;X{if(d.length>16){const{written:N}=Tn.encodeInto(d,l.subarray(f,i));return N}for(var g=f,y=f+i-1,w=0;w=55296&&p<=57343){var _=d.charCodeAt(++w);p=65536+((p&1023)<<10)|_&1023}if(p<=127){if(f>=y)break;l[f++]=p}else if(p<=2047){if(f+1>=y)break;l[f++]=192|p>>6,l[f++]=128|p&63}else if(p<=65535){if(f+2>=y)break;l[f++]=224|p>>12,l[f++]=128|p>>6&63,l[f++]=128|p&63}else{if(f+3>=y)break;if(p>1114111)throw new Error("Invalid Unicode code point");l[f++]=240|p>>18,l[f++]=128|p>>12&63,l[f++]=128|p>>6&63,l[f++]=128|p&63}}return l[f]=0,f-g},Vt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Nn=(d,l,f,i)=>{const g=l+f,y=(()=>{let z=l;for(;d[z]&&!(z>=g);)++z;return z})();if(y-l>16&&d.buffer&&Vt)return Vt.decode(d.subarray(l,y));for(var w="";l>10,56320|A&1023)}}return w};class On{next;dtor;constructor(l,f){this.next=l,this.dtor=f??(()=>{})}alloc(l){if(l>this.size)throw new Error(`OOM: Arena out of memory: requested ${l} bytes but only ${this.size} bytes remain`);const[f,i]=this.next.reslice(l);return this.next=i,f}free(l){}get size(){return this.next.byteLength}__destroy__(){this.dtor()}}const Oe=!0;function Ln(d){class l{static get SIZE(){return ee.SIZE}constructor(i){return new d(i.deref(0,d.SIZE,Oe))}}return l}const Mn=6,In=await WebAssembly.instantiateStreaming(fetch("data:application/wasm;base64,AGFzbQEAAAABBgFgAX4BfwMCAQAHDgEKaTY0LnBvcGNudAAACggBBgAgAHunCwAKBG5hbWUCAwEAAA=="),{}),Dn=In.instance,Cn=Dn.exports["i64.popcnt"];class Ze{words;growable;constructor(l,{data:f}={}){this.words=new BigUint64Array(f.buffer,f.byteOffset,f.byteLength>>3),this.growable=!1;for(const i of l??[])this.add(i)}asRef(){return this.words.byteOffset}#e(l){const f=this.words;if(f.length<<6>l)return;if(!this.growable)throw new Error("TODO message");const i=l+64>>>Mn,g=Math.max(i<<3,f.byteLength<<4);var y=new BigUint64Array(new ArrayBuffer(g));y.set(this.words),this.words=y}add(l){this.#e(l);const f=l>>>6,i=1n<>>6,i=1n<({size:l.size*d})}function Rn(...d){return{size:d.reduce((l,f)=>l+f.size,0)}}class Ve{constructor(l){if(this.ptr=l,l.byteLength!=Ve.SIZE)throw new Error(`bad size! got ${l.byteLength} wanted ${Ve.SIZE}`)}static get SIZE(){return 12}get X(){return this.ptr.data.getUint32(0,je)}get Y(){return this.ptr.data.getUint32(4,je)}get Z(){return this.ptr.data.getUint32(8,je)}}class Xe{constructor(l){if(this.ptr=l,l.byteLength!=Xe.SIZE)throw new Error(`bad size! got ${l.byteLength} wanted ${Xe.SIZE}`)}static get SIZE(){return 2}get Core(){return this.ptr.data.getUint8(0)}get Lane(){return this.ptr.data.getUint8(1)}}var ie=(d=>(d[d.Active=0]="Active",d[d.Inactive=1]="Inactive",d[d.AtBarrier=2]="AtBarrier",d[d.AtBreakpoint=3]="AtBreakpoint",d[d.AtAssert=4]="AtAssert",d[d.AtException=5]="AtException",d[d.NotLaunched=6]="NotLaunched",d[d.Exited=7]="Exited",d[d.UNKNOWN=8]="UNKNOWN",d))(ie||{});class V{constructor(l){if(this.ptr=l,l.byteLength!=V.SIZE)throw new Error(`bad size! got ${l.byteLength} wanted ${V.SIZE}`)}static get SIZE(){return 1304}static get OFFSETS(){return{cores:0,lanes:1,result:2,steppedCores:8,steppedLanes:16,laneStates:24}}static get TYPES(){return{cores:Xt,lanes:Xt,steppedCores:Kt,steppedLanes:Kt,laneStates:Pn(Jt)(Rn())}}asRef(){return this.ptr.asRef()}get Cores(){return V.TYPES.cores.get(this.ptr,V.OFFSETS.cores)}get Lanes(){return V.TYPES.lanes.get(this.ptr,V.OFFSETS.lanes)}get SteppedCores(){return new Ze(void 0,{data:this.ptr.slice(V.OFFSETS.steppedCores,V.OFFSETS.steppedCores+V.TYPES.steppedCores.size).data})}get SteppedLanes(){return new Ze(void 0,{data:this.ptr.slice(V.OFFSETS.steppedLanes,V.OFFSETS.steppedLanes+V.TYPES.steppedLanes.size).data})}get LaneStates(){var l=Math.min(this.Cores*this.Lanes,Jt);const f=this.ptr.slice(24),i={get(g){const y=f.slice(20*g,20*g+20);return{get PhyCoord(){return new Xe(y.slice(0,2))},get LogCoord(){return new Ve(y.slice(4,16))},get State(){return y.data.getInt32(16,je)}}},[Symbol.iterator]:()=>{var g=0;return{next(){return g>=l?{done:!0,value:void 0}:{done:!1,value:i.get(g++)}}}}};return i}}const Jt=64;var xn=new TextDecoder("utf8");class Ke{constructor(l){this.ptr=l}static get SIZE(){return 12}get __is_long(){return!!(this.ptr.data.getUint8(11)&128)}get data(){return this.__is_long?this.ptr.deref(0,this.length,Oe):this.ptr.slice(0,this.length)}get length(){return this.__is_long?this.ptr.data.getUint32(4,Oe):this.ptr.data.getUint8(11)&127}get capacity(){return this.__is_long?this.ptr.data.getUint32(8,Oe)^2147483648:10}asString(){return xn.decode(this.data.as(Uint8Array))}get[Symbol.toStringTag](){return`std::string(${this.asString})`}}function pe(d){return class{constructor(l){this.ptr=l}static get T(){return d}static get SIZE(){return pe.SIZE}get(l){const[f,i]=[this.ptr.deref(0*ee.SIZE,void 0,!0),this.ptr.deref(1*ee.SIZE,void 0,!0)],g=d.SIZE,y=(i.addr-f.addr)/g;if(l<0||l>y)throw new Error(`out of bounds access: for index ${l} with elements [0..${y})`);const w=l*g;return new d(f.slice(w,w+g))}[Symbol.iterator](){const[l,f]=[this.ptr.deref(0*ee.SIZE,void 0,!0),this.ptr.deref(1*ee.SIZE,0,!0)],i=d.SIZE;var g=l;return{next(){if(g.addr>=f.addr)return{done:!0,value:void 0};const y={done:!1,value:new d(g.slice(0,i))};return g=g.slice(i),y}}}}}pe.SIZE=12;function Un(d){return class{constructor(l){this.ptr=l}static get T(){return d}static get SIZE(){return console.assert(d==Ke),4+d.SIZE}get __engaged_(){return!!(this.ptr.data.getUint8(d.SIZE)&1)}deref(){if(this.__engaged_)return new d(this.ptr.slice(0,d.SIZE))}}}const Ae=!0;class Qt{constructor(l){this.ptr=l}static get SIZE(){return 64}get EntryName(){return Nn(this.ptr.slice(0,64).as(Uint8Array),0,64)}set EntryName(l){if(Fn(l,this.ptr.slice(0,64).as(Uint8Array),0,64)>48n,w=Number(l&BigInt.asUintN(64,2n**64n-1n>>i)),p=this.Allocs.get(Number(y));return console.assert(w+f<=p.NumBytes),p.Data.slice(w,f)}get Allocs(){return new(pe(zn))(this.ptr.slice(2432,2432+pe.SIZE))}}class Hn{constructor(l){this.ptr=l}static get SIZE(){return 20}get Data(){return this.ptr.deref(4,void 0,Ae)}}class nr{constructor(l){this.ptr=l}static get SIZE(){return 272}get Objects(){return new(pe(Hn))(this.ptr.slice(32,32+pe.SIZE))}}class or{constructor(l){this.ptr=l}static get SIZE(){return 112}get GlobalMemory(){return new rr(this.ptr.deref(16,rr.SIZE,Ae))}get PipelineExecutor(){return new nr(this.ptr.deref(32,nr.SIZE,Ae))}}var qn=(()=>{var d=import.meta.url;return async function(l={}){var f,i=Object.assign({},l),g,y,w=new Promise((e,t)=>{g=e,y=t});["_malloc","_free","getExceptionMessage","$incrementExceptionRefcount","$decrementExceptionRefcount","_memory","_assertion","_Session__create__","_Session__destroy__","_Session__params_ref","_Session__module_ref","_Session__device_ref","_Session_run","_Session_dumpBuffers","_Session_start","_Session_printContext","_Session_step","_Session_continue","_Session_print","_Session_switch","_validate_wasm","_test_entry","_test_entry_no_tcf","_run_wasm","_debug_wasm","_Session_fetch_shrubbery","_exception","___indirect_function_table","onRuntimeInitialized"].forEach(e=>{Object.getOwnPropertyDescriptor(w,e)||Object.defineProperty(w,e,{get:()=>H("You are getting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"),set:()=>H("You are setting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")})});var p=typeof window=="object",_=typeof importScripts=="function",N=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",A=!p&&!N&&!_;if(i.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");if(N){const{createRequire:e}=await bn(()=>import("./__vite-browser-external.BIHI7g3E.js"),[]);var z=e(import.meta.url)}var W=Object.assign({},i),ne="./this.program",X=(e,t)=>{throw t},D="";function tt(e){return i.locateFile?i.locateFile(e,D):D+e}var se,we,ye;if(N){if(typeof process>"u"||!process.release||process.release.name!=="node")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");var Ue=process.versions.node,oe=Ue.split(".").slice(0,3);if(oe=oe[0]*1e4+oe[1]*100+oe[2].split("-")[0]*1,oe<16e4)throw new Error("This emscripten-generated code requires node v16.0.0 (detected v"+Ue+")");var Me=z("fs"),Ie=z("path");_?D=Ie.dirname(D)+"/":D=z("url").fileURLToPath(new URL("./",import.meta.url)),se=(e,t)=>(e=ot(e)?new URL(e):Ie.normalize(e),Me.readFileSync(e,t?void 0:"utf8")),ye=e=>{var t=se(e,!0);return t.buffer||(t=new Uint8Array(t)),h(t.buffer),t},we=(e,t,r,o=!0)=>{e=ot(e)?new URL(e):Ie.normalize(e),Me.readFile(e,o?void 0:"utf8",(a,s)=>{a?r(a):t(o?s.buffer:s)})},!i.thisProgram&&process.argv.length>1&&(ne=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),X=(e,t)=>{throw process.exitCode=e,t}}else if(A){if(typeof process=="object"&&typeof z=="function"||typeof window=="object"||typeof importScripts=="function")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)")}else if(p||_){if(_?D=self.location.href:typeof document<"u"&&document.currentScript&&(D=document.currentScript.src),d&&(D=d),D.startsWith("blob:")?D="":D=D.substr(0,D.replace(/[?#].*/,"").lastIndexOf("/")+1),!(typeof window=="object"||typeof importScripts=="function"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");se=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},_&&(ye=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),we=(e,t,r)=>{var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="arraybuffer",o.onload=()=>{if(o.status==200||o.status==0&&o.response){t(o.response);return}r()},o.onerror=r,o.send(null)}}else throw new Error("environment detection error");var ve=i.print||console.log.bind(console),U=i.printErr||console.error.bind(console);Object.assign(i,W),W=null,pn(),i.arguments&&i.arguments,fe("arguments","arguments_"),i.thisProgram&&(ne=i.thisProgram),fe("thisProgram","thisProgram"),i.quit&&(X=i.quit),fe("quit","quit_"),h(typeof i.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),h(typeof i.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),h(typeof i.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),h(typeof i.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),h(typeof i.read>"u","Module.read option was removed (modify read_ in JS)"),h(typeof i.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),h(typeof i.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),h(typeof i.setWindowTitle>"u","Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),h(typeof i.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),fe("asm","wasmExports"),fe("read","read_"),fe("readAsync","readAsync"),fe("readBinary","readBinary"),fe("setWindowTitle","setWindowTitle"),h(!_,"worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable."),h(!A,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");var _e;i.wasmBinary&&(_e=i.wasmBinary),fe("wasmBinary","wasmBinary"),typeof WebAssembly!="object"&&U("no native wasm support detected");var le,ae=!1;function h(e,t){e||H("Assertion failed"+(t?": "+t:""))}var L,G,ce,I,B,ue;function lr(){var e=le.buffer;i.HEAP8=L=new Int8Array(e),i.HEAP16=ce=new Int16Array(e),i.HEAPU8=G=new Uint8Array(e),i.HEAPU16=new Uint16Array(e),i.HEAP32=I=new Int32Array(e),i.HEAPU32=B=new Uint32Array(e),i.HEAPF32=new Float32Array(e),i.HEAPF64=new Float64Array(e),i.HEAP64=ue=new BigInt64Array(e),i.HEAPU64=new BigUint64Array(e)}h(!i.STACK_SIZE,"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"),h(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,"JS engine does not provide full typed array support"),h(!i.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),h(!i.INITIAL_MEMORY,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");function cr(){var e=ht();h((e&3)==0),e==0&&(e+=4),B[e>>2]=34821223,B[e+4>>2]=2310721022,B[0]=1668509029}function rt(){if(!ae){var e=ht();e==0&&(e+=4);var t=B[e>>2],r=B[e+4>>2];(t!=34821223||r!=2310721022)&&H(`Stack overflow! Stack cookie has been overwritten at ${Pe(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${Pe(r)} ${Pe(t)}`),B[0]!=1668509029&&H("Runtime error: The application has corrupted its heap memory area (address zero)!")}}(function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,t[0]!==115||t[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})();var gt=[],Et=[],wt=[],Be=!1;function ur(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)mr(i.preRun.shift());at(gt)}function dr(){h(!Be),Be=!0,rt(),!i.noFSInit&&!n.init.initialized&&n.init(),n.ignorePermissions=!1,at(Et)}function fr(){if(rt(),i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)pr(i.postRun.shift());at(wt)}function mr(e){gt.unshift(e)}function hr(e){Et.unshift(e)}function pr(e){wt.unshift(e)}h(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),h(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),h(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),h(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var Se=0,be=null,De=null,Te={};function yt(e){for(var t=e;;){if(!Te[e])return e;e=t+Math.random()}}function nt(e){Se++,i.monitorRunDependencies?.(Se),e?(h(!Te[e]),Te[e]=1,be===null&&typeof setInterval<"u"&&(be=setInterval(()=>{if(ae){clearInterval(be),be=null;return}var t=!1;for(var r in Te)t||(t=!0,U("still waiting on run dependencies:")),U(`dependency: ${r}`);t&&U("(end of list)")},1e4))):U("warning: run dependency added without ID")}function $e(e){if(Se--,i.monitorRunDependencies?.(Se),e?(h(Te[e]),delete Te[e]):U("warning: run dependency removed without ID"),Se==0&&(be!==null&&(clearInterval(be),be=null),De)){var t=De;De=null,t()}}function H(e){i.onAbort?.(e),e="Aborted("+e+")",U(e),ae=!0,Be&&Ht();var t=new WebAssembly.RuntimeError(e);throw y(t),t}var vr="data:application/octet-stream;base64,",_t=e=>e.startsWith(vr),ot=e=>e.startsWith("file://");function C(e,t){return(...r)=>{h(Be,`native function \`${e}\` called before runtime initialization`);var o=K[e];return h(o,`exported native function \`${e}\` not found`),h(r.length<=t,`native function \`${e}\` called with ${r.length} args but expects ${t}`),o(...r)}}var de;i.locateFile?(de="talvos-wasm.wasm",_t(de)||(de=tt(de))):de=new URL("/learn-gpgpu/_astro/talvos-wasm.Bc1_K4Ju.wasm",import.meta.url).href;function St(e){if(e==de&&_e)return new Uint8Array(_e);if(ye)return ye(e);throw"both async and sync fetching of the wasm failed"}function gr(e){return!_e&&(p||_)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(t=>{if(!t.ok)throw`failed to load wasm binary file at '${e}'`;return t.arrayBuffer()}).catch(()=>St(e)):Promise.resolve().then(()=>St(e))}function bt(e,t,r){return gr(e).then(o=>WebAssembly.instantiate(o,t)).then(r,o=>{U(`failed to asynchronously prepare wasm: ${o}`),ot(de)&&U(`warning: Loading from a file URI (${de}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`),H(o)})}function Er(e,t,r,o){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!_t(t)&&!N&&typeof fetch=="function"?fetch(t,{credentials:"same-origin"}).then(a=>{var s=WebAssembly.instantiateStreaming(a,r);return s.then(o,function(c){return U(`wasm streaming compile failed: ${c}`),U("falling back to ArrayBuffer instantiation"),bt(t,r,o)})}):bt(t,r,o)}function wr(){return{env:Bt,wasi_snapshot_preview1:Bt}}function yr(){var e=wr();function t(a,s){return K=a.exports,i.wasmExports=K,le=K.memory,i.wasmMemory=le,h(le,"memory not found in wasm exports"),lr(),hr(K.__wasm_call_ctors),$e("wasm-instantiate"),K}nt("wasm-instantiate");var r=i;function o(a){h(i===r,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),r=null,t(a.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(a){U(`Module.instantiateWasm callback failed with error: ${a}`),y(a)}return Er(_e,de,e,o).catch(y),{}}function fe(e,t,r=!0){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get(){let o=r?" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)":"";H(`\`Module.${e}\` has been replaced by \`${t}\``+o)}})}function _r(e){Object.getOwnPropertyDescriptor(i,e)&&H(`\`Module.${e}\` was supplied but \`${e}\` not included in INCOMING_MODULE_JS_API`)}function kt(e){return e==="FS_createPath"||e==="FS_createDataFile"||e==="FS_createPreloadedFile"||e==="FS_unlink"||e==="addRunDependency"||e==="FS_createLazyFile"||e==="FS_createDevice"||e==="removeRunDependency"}function At(e,t){typeof globalThis<"u"&&Object.defineProperty(globalThis,e,{configurable:!0,get(){ge(`\`${e}\` is not longer defined by emscripten. ${t}`)}})}At("buffer","Please use HEAP8.buffer or wasmMemory.buffer"),At("asm","Please use wasmExports instead");function Sr(e){typeof globalThis<"u"&&!Object.getOwnPropertyDescriptor(globalThis,e)&&Object.defineProperty(globalThis,e,{configurable:!0,get(){var t=`\`${e}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`,r=e;r.startsWith("_")||(r="$"+e),t+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${r}')`,kt(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),ge(t)}}),Tt(e)}function Tt(e){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get(){var t=`'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;kt(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),H(t)}})}function br(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var at=e=>{for(;e.length>0;)e.shift()(i)},Ft=()=>K.__cpp_exception,Nt=e=>{var t=e.getArg(Ft(),0);return gn(t)},kr=e=>{var t=Nt(e);vn(t)},it=()=>jt(),st=e=>Yt(e),Ce=e=>Gt(e),Ot=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,ke=(e,t,r)=>{for(var o=t+r,a=t;e[a]&&!(a>=o);)++a;if(a-t>16&&e.buffer&&Ot)return Ot.decode(e.subarray(t,a));for(var s="";t>10,56320|F&1023)}}return s},me=(e,t)=>(h(typeof e=="number",`UTF8ToString expects a number (got ${typeof e})`),e?ke(G,e,t):""),Ar=e=>{var t=it(),r=Ce(4),o=Ce(4);En(e,r,o);var a=B[r>>2],s=B[o>>2],c=me(a);zt(a);var u;return s&&(u=me(s),zt(s)),st(t),[c,u]},lt=e=>{var t=Nt(e);return Ar(t)};i.getExceptionMessage=lt;var Tr=i.noExitRuntime||!0,Pe=e=>(h(typeof e=="number"),e>>>=0,"0x"+e.toString(16).padStart(8,"0")),ge=e=>{ge.shown||={},ge.shown[e]||(ge.shown[e]=1,N&&(e="warning: "+e),U(e))},Fr=(e,t,r,o)=>{H(`Assertion failed: ${me(e)}, at: `+[t?me(t):"unknown filename",r,o?me(o):"unknown function"])};function ze(){h(j.varargs!=null);var e=I[+j.varargs>>2];return j.varargs+=4,e}var Fe=ze,P={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return t.exec(e).slice(1)},normalizeArray:(e,t)=>{for(var r=0,o=e.length-1;o>=0;o--){var a=e[o];a==="."?e.splice(o,1):a===".."?(e.splice(o,1),r++):r&&(e.splice(o,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=P.isAbs(e),r=e.substr(-1)==="/";return e=P.normalizeArray(e.split("/").filter(o=>!!o),!t).join("/"),!e&&!t&&(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=P.splitPath(e),r=t[0],o=t[1];return!r&&!o?".":(o&&(o=o.substr(0,o.length-1)),r+o)},basename:e=>{if(e==="/")return"/";e=P.normalize(e),e=e.replace(/\/$/,"");var t=e.lastIndexOf("/");return t===-1?e:e.substr(t+1)},join:(...e)=>P.normalize(e.join("/")),join2:(e,t)=>P.normalize(e+"/"+t)},Nr=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return o=>crypto.getRandomValues(o);if(N)try{var e=z("crypto"),t=e.randomFillSync;if(t)return o=>e.randomFillSync(o);var r=e.randomBytes;return o=>(o.set(r(o.byteLength)),o)}catch{}H("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")},Lt=e=>(Lt=Nr())(e),he={resolve:(...e)=>{for(var t="",r=!1,o=e.length-1;o>=-1&&!r;o--){var a=o>=0?e[o]:n.cwd();if(typeof a!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!a)return"";t=a+"/"+t,r=P.isAbs(a)}return t=P.normalizeArray(t.split("/").filter(s=>!!s),!r).join("/"),(r?"/":"")+t||"."},relative:(e,t)=>{e=he.resolve(e).substr(1),t=he.resolve(t).substr(1);function r(F){for(var O=0;O=0&&F[M]==="";M--);return O>M?[]:F.slice(O,M-O+1)}for(var o=r(e.split("/")),a=r(t.split("/")),s=Math.min(o.length,a.length),c=s,u=0;u{for(var t=0,r=0;r=55296&&o<=57343?(t+=4,++r):t+=3}return t},He=(e,t,r,o)=>{if(h(typeof e=="string",`stringToUTF8Array expects a string (got ${typeof e})`),!(o>0))return 0;for(var a=r,s=r+o-1,c=0;c=55296&&u<=57343){var v=e.charCodeAt(++c);u=65536+((u&1023)<<10)|v&1023}if(u<=127){if(r>=s)break;t[r++]=u}else if(u<=2047){if(r+1>=s)break;t[r++]=192|u>>6,t[r++]=128|u&63}else if(u<=65535){if(r+2>=s)break;t[r++]=224|u>>12,t[r++]=128|u>>6&63,t[r++]=128|u&63}else{if(r+3>=s)break;u>1114111&&ge("Invalid Unicode code point "+Pe(u)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[r++]=240|u>>18,t[r++]=128|u>>12&63,t[r++]=128|u>>6&63,t[r++]=128|u&63}}return t[r]=0,r-a};function qe(e,t,r){var o=ut(e)+1,a=new Array(o),s=He(e,a,0,a.length);return t&&(a.length=s),a}var Or=()=>{if(!ct.length){var e=null;if(N){var t=256,r=Buffer.alloc(t),o=0,a=process.stdin.fd;try{o=Me.readSync(a,r)}catch(s){if(s.toString().includes("EOF"))o=0;else throw s}o>0?e=r.slice(0,o).toString("utf-8"):e=null}else typeof window<"u"&&typeof window.prompt=="function"?(e=window.prompt("Input: "),e!==null&&(e+=` -`)):typeof readline=="function"&&(e=readline(),e!==null&&(e+=` -`));if(!e)return null;ct=qe(e,!0)}return ct.shift()},Ee={ttys:[],init(){},shutdown(){},register(e,t){Ee.ttys[e]={input:[],output:[],ops:t},n.registerDevice(e,Ee.stream_ops)},stream_ops:{open(e){var t=Ee.ttys[e.node.rdev];if(!t)throw new n.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,o,a){if(!e.tty||!e.tty.ops.get_char)throw new n.ErrnoError(60);for(var s=0,c=0;c0&&(ve(ke(e.output,0)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,t,r){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(U(ke(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(U(ke(e.output,0)),e.output=[])}}},Mt=e=>{H("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported")},T={ops_table:null,mount(e){return T.createNode(null,"/",16895,0)},createNode(e,t,r,o){if(n.isBlkdev(r)||n.isFIFO(r))throw new n.ErrnoError(63);T.ops_table||={dir:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr,lookup:T.node_ops.lookup,mknod:T.node_ops.mknod,rename:T.node_ops.rename,unlink:T.node_ops.unlink,rmdir:T.node_ops.rmdir,readdir:T.node_ops.readdir,symlink:T.node_ops.symlink},stream:{llseek:T.stream_ops.llseek}},file:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr},stream:{llseek:T.stream_ops.llseek,read:T.stream_ops.read,write:T.stream_ops.write,allocate:T.stream_ops.allocate,mmap:T.stream_ops.mmap,msync:T.stream_ops.msync}},link:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr,readlink:T.node_ops.readlink},stream:{}},chrdev:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr},stream:n.chrdev_stream_ops}};var a=n.createNode(e,t,r,o);return n.isDir(a.mode)?(a.node_ops=T.ops_table.dir.node,a.stream_ops=T.ops_table.dir.stream,a.contents={}):n.isFile(a.mode)?(a.node_ops=T.ops_table.file.node,a.stream_ops=T.ops_table.file.stream,a.usedBytes=0,a.contents=null):n.isLink(a.mode)?(a.node_ops=T.ops_table.link.node,a.stream_ops=T.ops_table.link.stream):n.isChrdev(a.mode)&&(a.node_ops=T.ops_table.chrdev.node,a.stream_ops=T.ops_table.chrdev.stream),a.timestamp=Date.now(),e&&(e.contents[t]=a,e.timestamp=a.timestamp),a},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){var o=1024*1024;t=Math.max(t,r*(r>>0),r!=0&&(t=Math.max(t,256));var a=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(a.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(t==0)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=n.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,n.isDir(e.mode)?t.size=4096:n.isFile(e.mode)?t.size=e.usedBytes:n.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){t.mode!==void 0&&(e.mode=t.mode),t.timestamp!==void 0&&(e.timestamp=t.timestamp),t.size!==void 0&&T.resizeFileStorage(e,t.size)},lookup(e,t){throw n.genericErrors[44]},mknod(e,t,r,o){return T.createNode(e,t,r,o)},rename(e,t,r){if(n.isDir(e.mode)){var o;try{o=n.lookupNode(t,r)}catch{}if(o)for(var a in o.contents)throw new n.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=n.lookupNode(e,t);for(var o in r.contents)throw new n.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r of Object.keys(e.contents))t.push(r);return t},symlink(e,t,r){var o=T.createNode(e,t,41471,0);return o.link=r,o},readlink(e){if(!n.isLink(e.mode))throw new n.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,o,a){var s=e.node.contents;if(a>=e.node.usedBytes)return 0;var c=Math.min(e.node.usedBytes-a,o);if(h(c>=0),c>8&&s.subarray)t.set(s.subarray(a,a+c),r);else for(var u=0;u0||r+t{var a=yt(`al ${e}`);we(e,s=>{h(s,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(s)),a&&$e(a)},s=>{if(r)r();else throw`Loading data file "${e}" failed.`}),a&&nt(a)},Mr=(e,t,r,o,a,s)=>{n.createDataFile(e,t,r,o,a,s)},Ir=i.preloadPlugins||[],Dr=(e,t,r,o)=>{typeof Browser<"u"&&Browser.init();var a=!1;return Ir.forEach(s=>{a||s.canHandle(t)&&(s.handle(e,t,r,o),a=!0)}),a},Cr=(e,t,r,o,a,s,c,u,v,F)=>{var O=t?he.resolve(P.join2(e,t)):e,M=yt(`cp ${O}`);function k(S){function b($){F?.(),u||Mr(e,t,$,o,a,v),s?.(),$e(M)}Dr(S,O,b,()=>{c?.(),$e(M)})||b(S)}nt(M),typeof r=="string"?Lr(r,k,c):k(r)},Pr=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},r=t[e];if(typeof r>"u")throw new Error(`Unknown file open mode: ${e}`);return r},dt=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Rr={0:"Success",1:"Arg list too long",2:"Permission denied",3:"Address already in use",4:"Address not available",5:"Address family not supported by protocol family",6:"No more processes",7:"Socket already connected",8:"Bad file number",9:"Trying to read unreadable message",10:"Mount device busy",11:"Operation canceled",12:"No children",13:"Connection aborted",14:"Connection refused",15:"Connection reset by peer",16:"File locking deadlock error",17:"Destination address required",18:"Math arg out of domain of func",19:"Quota exceeded",20:"File exists",21:"Bad address",22:"File too large",23:"Host is unreachable",24:"Identifier removed",25:"Illegal byte sequence",26:"Connection already in progress",27:"Interrupted system call",28:"Invalid argument",29:"I/O error",30:"Socket is already connected",31:"Is a directory",32:"Too many symbolic links",33:"Too many open files",34:"Too many links",35:"Message too long",36:"Multihop attempted",37:"File or path name too long",38:"Network interface is not configured",39:"Connection reset by network",40:"Network is unreachable",41:"Too many open files in system",42:"No buffer space available",43:"No such device",44:"No such file or directory",45:"Exec format error",46:"No record locks available",47:"The link has been severed",48:"Not enough core",49:"No message of desired type",50:"Protocol not available",51:"No space left on device",52:"Function not implemented",53:"Socket is not connected",54:"Not a directory",55:"Directory not empty",56:"State not recoverable",57:"Socket operation on non-socket",59:"Not a typewriter",60:"No such device or address",61:"Value too large for defined data type",62:"Previous owner died",63:"Not super-user",64:"Broken pipe",65:"Protocol error",66:"Unknown protocol",67:"Protocol wrong type for socket",68:"Math result not representable",69:"Read only file system",70:"Illegal seek",71:"No such process",72:"Stale file handle",73:"Connection timed out",74:"Text file busy",75:"Cross-device link",100:"Device not a stream",101:"Bad font file fmt",102:"Invalid slot",103:"Invalid request code",104:"No anode",105:"Block device required",106:"Channel number out of range",107:"Level 3 halted",108:"Level 3 reset",109:"Link number out of range",110:"Protocol driver not attached",111:"No CSI structure available",112:"Level 2 halted",113:"Invalid exchange",114:"Invalid request descriptor",115:"Exchange full",116:"No data (for no delay io)",117:"Timer expired",118:"Out of streams resources",119:"Machine is not on the network",120:"Package not installed",121:"The object is remote",122:"Advertise error",123:"Srmount error",124:"Communication error on send",125:"Cross mount point (not really error)",126:"Given log. name not unique",127:"f.d. invalid for this operation",128:"Remote address changed",129:"Can access a needed shared lib",130:"Accessing a corrupted shared lib",131:".lib section in a.out corrupted",132:"Attempting to link in too many libs",133:"Attempting to exec a shared library",135:"Streams pipe error",136:"Too many users",137:"Socket type not supported",138:"Not supported",139:"Protocol family not supported",140:"Can't send after socket shutdown",141:"Too many references",142:"Host is down",148:"No medium (in tape drive)",156:"Level 2 not synchronized"},It={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},n={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class extends Error{constructor(e){super(Rr[e]),this.name="ErrnoError",this.errno=e;for(var t in It)if(It[t]===e){this.code=t;break}}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,r,o){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=n.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=o,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return n.isDir(this.mode)}get isDevice(){return n.isChrdev(this.mode)}},lookupPath(e,t={}){if(e=he.resolve(e),!e)return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};if(t=Object.assign(r,t),t.recurse_count>8)throw new n.ErrnoError(32);for(var o=e.split("/").filter(M=>!!M),a=n.root,s="/",c=0;c40)throw new n.ErrnoError(32)}}return{path:s,node:a}},getPath(e){for(var t;;){if(n.isRoot(e)){var r=e.mount.mountpoint;return t?r[r.length-1]!=="/"?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,o=0;o>>0)%n.nameTable.length},hashAddNode(e){var t=n.hashName(e.parent.id,e.name);e.name_next=n.nameTable[t],n.nameTable[t]=e},hashRemoveNode(e){var t=n.hashName(e.parent.id,e.name);if(n.nameTable[t]===e)n.nameTable[t]=e.name_next;else for(var r=n.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=n.mayLookup(e);if(r)throw new n.ErrnoError(r);for(var o=n.hashName(e.id,t),a=n.nameTable[o];a;a=a.name_next){var s=a.name;if(a.parent.id===e.id&&s===t)return a}return n.lookup(e,t)},createNode(e,t,r,o){h(typeof e=="object");var a=new n.FSNode(e,t,r,o);return n.hashAddNode(a),a},destroyNode(e){n.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var t=["r","w","rw"][e&3];return e&512&&(t+="w"),t},nodePermissions(e,t){return n.ignorePermissions?0:t.includes("r")&&!(e.mode&292)||t.includes("w")&&!(e.mode&146)||t.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!n.isDir(e.mode))return 54;var t=n.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{var r=n.lookupNode(e,t);return 20}catch{}return n.nodePermissions(e,"wx")},mayDelete(e,t,r){var o;try{o=n.lookupNode(e,t)}catch(s){return s.errno}var a=n.nodePermissions(e,"wx");if(a)return a;if(r){if(!n.isDir(o.mode))return 54;if(n.isRoot(o)||n.getPath(o)===n.cwd())return 10}else if(n.isDir(o.mode))return 31;return 0},mayOpen(e,t){return e?n.isLink(e.mode)?32:n.isDir(e.mode)&&(n.flagsToPermissionString(t)!=="r"||t&512)?31:n.nodePermissions(e,n.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=n.MAX_OPEN_FDS;e++)if(!n.streams[e])return e;throw new n.ErrnoError(33)},getStreamChecked(e){var t=n.getStream(e);if(!t)throw new n.ErrnoError(8);return t},getStream:e=>n.streams[e],createStream(e,t=-1){return e=Object.assign(new n.FSStream,e),t==-1&&(t=n.nextfd()),e.fd=t,n.streams[t]=e,e},closeStream(e){n.streams[e]=null},dupStream(e,t=-1){var r=n.createStream(e,t);return r.stream_ops?.dup?.(r),r},chrdev_stream_ops:{open(e){var t=n.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new n.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,t)=>e<<8|t,registerDevice(e,t){n.devices[e]={stream_ops:t}},getDevice:e=>n.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var o=r.pop();t.push(o),r.push(...o.mounts)}return t},syncfs(e,t){typeof e=="function"&&(t=e,e=!1),n.syncFSRequests++,n.syncFSRequests>1&&U(`warning: ${n.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=n.getMounts(n.root.mount),o=0;function a(c){return h(n.syncFSRequests>0),n.syncFSRequests--,t(c)}function s(c){if(c)return s.errored?void 0:(s.errored=!0,a(c));++o>=r.length&&a(null)}r.forEach(c=>{if(!c.type.syncfs)return s(null);c.type.syncfs(c,e,s)})},mount(e,t,r){if(typeof e=="string")throw e;var o=r==="/",a=!r,s;if(o&&n.root)throw new n.ErrnoError(10);if(!o&&!a){var c=n.lookupPath(r,{follow_mount:!1});if(r=c.path,s=c.node,n.isMountpoint(s))throw new n.ErrnoError(10);if(!n.isDir(s.mode))throw new n.ErrnoError(54)}var u={type:e,opts:t,mountpoint:r,mounts:[]},v=e.mount(u);return v.mount=u,u.root=v,o?n.root=v:s&&(s.mounted=u,s.mount&&s.mount.mounts.push(u)),v},unmount(e){var t=n.lookupPath(e,{follow_mount:!1});if(!n.isMountpoint(t.node))throw new n.ErrnoError(28);var r=t.node,o=r.mounted,a=n.getMounts(o);Object.keys(n.nameTable).forEach(c=>{for(var u=n.nameTable[c];u;){var v=u.name_next;a.includes(u.mount)&&n.destroyNode(u),u=v}}),r.mounted=null;var s=r.mount.mounts.indexOf(o);h(s!==-1),r.mount.mounts.splice(s,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,r){var o=n.lookupPath(e,{parent:!0}),a=o.node,s=P.basename(e);if(!s||s==="."||s==="..")throw new n.ErrnoError(28);var c=n.mayCreate(a,s);if(c)throw new n.ErrnoError(c);if(!a.node_ops.mknod)throw new n.ErrnoError(63);return a.node_ops.mknod(a,s,t,r)},create(e,t){return t=t!==void 0?t:438,t&=4095,t|=32768,n.mknod(e,t,0)},mkdir(e,t){return t=t!==void 0?t:511,t&=1023,t|=16384,n.mknod(e,t,0)},mkdirTree(e,t){for(var r=e.split("/"),o="",a=0;a"u"&&(r=t,t=438),t|=8192,n.mknod(e,t,r)},symlink(e,t){if(!he.resolve(e))throw new n.ErrnoError(44);var r=n.lookupPath(t,{parent:!0}),o=r.node;if(!o)throw new n.ErrnoError(44);var a=P.basename(t),s=n.mayCreate(o,a);if(s)throw new n.ErrnoError(s);if(!o.node_ops.symlink)throw new n.ErrnoError(63);return o.node_ops.symlink(o,a,e)},rename(e,t){var r=P.dirname(e),o=P.dirname(t),a=P.basename(e),s=P.basename(t),c,u,v;if(c=n.lookupPath(e,{parent:!0}),u=c.node,c=n.lookupPath(t,{parent:!0}),v=c.node,!u||!v)throw new n.ErrnoError(44);if(u.mount!==v.mount)throw new n.ErrnoError(75);var F=n.lookupNode(u,a),O=he.relative(e,o);if(O.charAt(0)!==".")throw new n.ErrnoError(28);if(O=he.relative(t,r),O.charAt(0)!==".")throw new n.ErrnoError(55);var M;try{M=n.lookupNode(v,s)}catch{}if(F!==M){var k=n.isDir(F.mode),S=n.mayDelete(u,a,k);if(S)throw new n.ErrnoError(S);if(S=M?n.mayDelete(v,s,k):n.mayCreate(v,s),S)throw new n.ErrnoError(S);if(!u.node_ops.rename)throw new n.ErrnoError(63);if(n.isMountpoint(F)||M&&n.isMountpoint(M))throw new n.ErrnoError(10);if(v!==u&&(S=n.nodePermissions(u,"w"),S))throw new n.ErrnoError(S);n.hashRemoveNode(F);try{u.node_ops.rename(F,v,s)}catch(b){throw b}finally{n.hashAddNode(F)}}},rmdir(e){var t=n.lookupPath(e,{parent:!0}),r=t.node,o=P.basename(e),a=n.lookupNode(r,o),s=n.mayDelete(r,o,!0);if(s)throw new n.ErrnoError(s);if(!r.node_ops.rmdir)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);r.node_ops.rmdir(r,o),n.destroyNode(a)},readdir(e){var t=n.lookupPath(e,{follow:!0}),r=t.node;if(!r.node_ops.readdir)throw new n.ErrnoError(54);return r.node_ops.readdir(r)},unlink(e){var t=n.lookupPath(e,{parent:!0}),r=t.node;if(!r)throw new n.ErrnoError(44);var o=P.basename(e),a=n.lookupNode(r,o),s=n.mayDelete(r,o,!1);if(s)throw new n.ErrnoError(s);if(!r.node_ops.unlink)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);r.node_ops.unlink(r,o),n.destroyNode(a)},readlink(e){var t=n.lookupPath(e),r=t.node;if(!r)throw new n.ErrnoError(44);if(!r.node_ops.readlink)throw new n.ErrnoError(28);return he.resolve(n.getPath(r.parent),r.node_ops.readlink(r))},stat(e,t){var r=n.lookupPath(e,{follow:!t}),o=r.node;if(!o)throw new n.ErrnoError(44);if(!o.node_ops.getattr)throw new n.ErrnoError(63);return o.node_ops.getattr(o)},lstat(e){return n.stat(e,!0)},chmod(e,t,r){var o;if(typeof e=="string"){var a=n.lookupPath(e,{follow:!r});o=a.node}else o=e;if(!o.node_ops.setattr)throw new n.ErrnoError(63);o.node_ops.setattr(o,{mode:t&4095|o.mode&-4096,timestamp:Date.now()})},lchmod(e,t){n.chmod(e,t,!0)},fchmod(e,t){var r=n.getStreamChecked(e);n.chmod(r.node,t)},chown(e,t,r,o){var a;if(typeof e=="string"){var s=n.lookupPath(e,{follow:!o});a=s.node}else a=e;if(!a.node_ops.setattr)throw new n.ErrnoError(63);a.node_ops.setattr(a,{timestamp:Date.now()})},lchown(e,t,r){n.chown(e,t,r,!0)},fchown(e,t,r){var o=n.getStreamChecked(e);n.chown(o.node,t,r)},truncate(e,t){if(t<0)throw new n.ErrnoError(28);var r;if(typeof e=="string"){var o=n.lookupPath(e,{follow:!0});r=o.node}else r=e;if(!r.node_ops.setattr)throw new n.ErrnoError(63);if(n.isDir(r.mode))throw new n.ErrnoError(31);if(!n.isFile(r.mode))throw new n.ErrnoError(28);var a=n.nodePermissions(r,"w");if(a)throw new n.ErrnoError(a);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=n.getStreamChecked(e);if(!(r.flags&2097155))throw new n.ErrnoError(28);n.truncate(r.node,t)},utime(e,t,r){var o=n.lookupPath(e,{follow:!0}),a=o.node;a.node_ops.setattr(a,{timestamp:Math.max(t,r)})},open(e,t,r){if(e==="")throw new n.ErrnoError(44);t=typeof t=="string"?Pr(t):t,r=typeof r>"u"?438:r,t&64?r=r&4095|32768:r=0;var o;if(typeof e=="object")o=e;else{e=P.normalize(e);try{var a=n.lookupPath(e,{follow:!(t&131072)});o=a.node}catch{}}var s=!1;if(t&64)if(o){if(t&128)throw new n.ErrnoError(20)}else o=n.mknod(e,r,0),s=!0;if(!o)throw new n.ErrnoError(44);if(n.isChrdev(o.mode)&&(t&=-513),t&65536&&!n.isDir(o.mode))throw new n.ErrnoError(54);if(!s){var c=n.mayOpen(o,t);if(c)throw new n.ErrnoError(c)}t&512&&!s&&n.truncate(o,0),t&=-131713;var u=n.createStream({node:o,path:n.getPath(o),flags:t,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),i.logReadFiles&&!(t&1)&&(n.readFiles||(n.readFiles={}),e in n.readFiles||(n.readFiles[e]=1)),u},close(e){if(n.isClosed(e))throw new n.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(t){throw t}finally{n.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,t,r){if(n.isClosed(e))throw new n.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new n.ErrnoError(70);if(r!=0&&r!=1&&r!=2)throw new n.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,o,a){if(h(r>=0),o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(e))throw new n.ErrnoError(8);if((e.flags&2097155)===1)throw new n.ErrnoError(8);if(n.isDir(e.node.mode))throw new n.ErrnoError(31);if(!e.stream_ops.read)throw new n.ErrnoError(28);var s=typeof a<"u";if(!s)a=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var c=e.stream_ops.read(e,t,r,o,a);return s||(e.position+=c),c},write(e,t,r,o,a,s){if(h(r>=0),o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(e))throw new n.ErrnoError(8);if(!(e.flags&2097155))throw new n.ErrnoError(8);if(n.isDir(e.node.mode))throw new n.ErrnoError(31);if(!e.stream_ops.write)throw new n.ErrnoError(28);e.seekable&&e.flags&1024&&n.llseek(e,0,2);var c=typeof a<"u";if(!c)a=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var u=e.stream_ops.write(e,t,r,o,a,s);return c||(e.position+=u),u},allocate(e,t,r){if(n.isClosed(e))throw new n.ErrnoError(8);if(t<0||r<=0)throw new n.ErrnoError(28);if(!(e.flags&2097155))throw new n.ErrnoError(8);if(!n.isFile(e.node.mode)&&!n.isDir(e.node.mode))throw new n.ErrnoError(43);if(!e.stream_ops.allocate)throw new n.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,o,a){if(o&2&&!(a&2)&&(e.flags&2097155)!==2)throw new n.ErrnoError(2);if((e.flags&2097155)===1)throw new n.ErrnoError(2);if(!e.stream_ops.mmap)throw new n.ErrnoError(43);return e.stream_ops.mmap(e,t,r,o,a)},msync(e,t,r,o,a){return h(r>=0),e.stream_ops.msync?e.stream_ops.msync(e,t,r,o,a):0},ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new n.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary",t.encoding!=="utf8"&&t.encoding!=="binary")throw new Error(`Invalid encoding type "${t.encoding}"`);var r,o=n.open(e,t.flags),a=n.stat(e),s=a.size,c=new Uint8Array(s);return n.read(o,c,0,s,0),t.encoding==="utf8"?r=ke(c,0):t.encoding==="binary"&&(r=c),n.close(o),r},writeFile(e,t,r={}){r.flags=r.flags||577;var o=n.open(e,r.flags,r.mode);if(typeof t=="string"){var a=new Uint8Array(ut(t)+1),s=He(t,a,0,a.length);n.write(o,a,0,s,void 0,r.canOwn)}else if(ArrayBuffer.isView(t))n.write(o,t,0,t.byteLength,void 0,r.canOwn);else throw new Error("Unsupported data type");n.close(o)},cwd:()=>n.currentPath,chdir(e){var t=n.lookupPath(e,{follow:!0});if(t.node===null)throw new n.ErrnoError(44);if(!n.isDir(t.node.mode))throw new n.ErrnoError(54);var r=n.nodePermissions(t.node,"x");if(r)throw new n.ErrnoError(r);n.currentPath=t.path},createDefaultDirectories(){n.mkdir("/tmp"),n.mkdir("/home"),n.mkdir("/home/web_user")},createDefaultDevices(){n.mkdir("/dev"),n.registerDevice(n.makedev(1,3),{read:()=>0,write:(o,a,s,c,u)=>c}),n.mkdev("/dev/null",n.makedev(1,3)),Ee.register(n.makedev(5,0),Ee.default_tty_ops),Ee.register(n.makedev(6,0),Ee.default_tty1_ops),n.mkdev("/dev/tty",n.makedev(5,0)),n.mkdev("/dev/tty1",n.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(t===0&&(t=Lt(e).byteLength),e[--t]);n.createDevice("/dev","random",r),n.createDevice("/dev","urandom",r),n.mkdir("/dev/shm"),n.mkdir("/dev/shm/tmp")},createSpecialDirectories(){n.mkdir("/proc");var e=n.mkdir("/proc/self");n.mkdir("/proc/self/fd"),n.mount({mount(){var t=n.createNode(e,"fd",16895,73);return t.node_ops={lookup(r,o){var a=+o,s=n.getStreamChecked(a),c={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>s.path}};return c.parent=c,c}},t}},{},"/proc/self/fd")},createStandardStreams(){i.stdin?n.createDevice("/dev","stdin",i.stdin):n.symlink("/dev/tty","/dev/stdin"),i.stdout?n.createDevice("/dev","stdout",null,i.stdout):n.symlink("/dev/tty","/dev/stdout"),i.stderr?n.createDevice("/dev","stderr",null,i.stderr):n.symlink("/dev/tty1","/dev/stderr");var e=n.open("/dev/stdin",0),t=n.open("/dev/stdout",1),r=n.open("/dev/stderr",1);h(e.fd===0,`invalid handle for stdin (${e.fd})`),h(t.fd===1,`invalid handle for stdout (${t.fd})`),h(r.fd===2,`invalid handle for stderr (${r.fd})`)},staticInit(){[44].forEach(e=>{n.genericErrors[e]=new n.ErrnoError(e),n.genericErrors[e].stack=""}),n.nameTable=new Array(4096),n.mount(T,{},"/"),n.createDefaultDirectories(),n.createDefaultDevices(),n.createSpecialDirectories(),n.filesystems={MEMFS:T}},init(e,t,r){h(!n.init.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),n.init.initialized=!0,i.stdin=e||i.stdin,i.stdout=t||i.stdout,i.stderr=r||i.stderr,n.createStandardStreams()},quit(){n.init.initialized=!1,$t(0);for(var e=0;ethis.length-1||S<0)){var b=S%this.chunkSize,$=S/this.chunkSize|0;return this.getter($)[b]}}setDataGetter(S){this.getter=S}cacheLength(){var S=new XMLHttpRequest;if(S.open("HEAD",r,!1),S.send(null),!(S.status>=200&&S.status<300||S.status===304))throw new Error("Couldn't load "+r+". Status: "+S.status);var b=Number(S.getResponseHeader("Content-length")),$,J=($=S.getResponseHeader("Accept-Ranges"))&&$==="bytes",Z=($=S.getResponseHeader("Content-Encoding"))&&$==="gzip",m=1024*1024;J||(m=b);var E=(R,te)=>{if(R>te)throw new Error("invalid range ("+R+", "+te+") or no bytes requested!");if(te>b-1)throw new Error("only "+b+" bytes available! programmer error!");var q=new XMLHttpRequest;if(q.open("GET",r,!1),b!==m&&q.setRequestHeader("Range","bytes="+R+"-"+te),q.responseType="arraybuffer",q.overrideMimeType&&q.overrideMimeType("text/plain; charset=x-user-defined"),q.send(null),!(q.status>=200&&q.status<300||q.status===304))throw new Error("Couldn't load "+r+". Status: "+q.status);return q.response!==void 0?new Uint8Array(q.response||[]):qe(q.responseText||"",!0)},Y=this;Y.setDataGetter(R=>{var te=R*m,q=(R+1)*m-1;if(q=Math.min(q,b-1),typeof Y.chunks[R]>"u"&&(Y.chunks[R]=E(te,q)),typeof Y.chunks[R]>"u")throw new Error("doXHR failed!");return Y.chunks[R]}),(Z||!b)&&(m=b=1,b=this.getter(0).length,m=b,ve("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=b,this._chunkSize=m,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!_)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var c=new s,u={isDevice:!1,contents:c}}else var u={isDevice:!1,url:r};var v=n.createFile(e,t,u,o,a);u.contents?v.contents=u.contents:u.url&&(v.contents=null,v.url=u.url),Object.defineProperties(v,{usedBytes:{get:function(){return this.contents.length}}});var F={},O=Object.keys(v.stream_ops);O.forEach(k=>{var S=v.stream_ops[k];F[k]=(...b)=>(n.forceLoadFile(v),S(...b))});function M(k,S,b,$,J){var Z=k.node.contents;if(J>=Z.length)return 0;var m=Math.min(Z.length-J,$);if(h(m>=0),Z.slice)for(var E=0;E(n.forceLoadFile(v),M(k,S,b,$,J)),F.mmap=(k,S,b,$,J)=>{n.forceLoadFile(v);var Z=Mt();if(!Z)throw new n.ErrnoError(48);return M(k,L,Z,S,b),{ptr:Z,allocated:!0}},v.stream_ops=F,v},absolutePath(){H("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder(){H("FS.createFolder has been removed; use FS.mkdir instead")},createLink(){H("FS.createLink has been removed; use FS.symlink instead")},joinPath(){H("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc(){H("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath(){H("FS.standardizePath has been removed; use PATH.normalize instead")}},j={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(P.isAbs(t))return t;var o;if(e===-100)o=n.cwd();else{var a=j.getStreamFromFD(e);o=a.path}if(t.length==0){if(!r)throw new n.ErrnoError(44);return o}return P.join2(o,t)},doStat(e,t,r){var o=e(t);I[r>>2]=o.dev,I[r+4>>2]=o.mode,B[r+8>>2]=o.nlink,I[r+12>>2]=o.uid,I[r+16>>2]=o.gid,I[r+20>>2]=o.rdev,ue[r+24>>3]=BigInt(o.size),I[r+32>>2]=4096,I[r+36>>2]=o.blocks;var a=o.atime.getTime(),s=o.mtime.getTime(),c=o.ctime.getTime();return ue[r+40>>3]=BigInt(Math.floor(a/1e3)),B[r+48>>2]=a%1e3*1e3,ue[r+56>>3]=BigInt(Math.floor(s/1e3)),B[r+64>>2]=s%1e3*1e3,ue[r+72>>3]=BigInt(Math.floor(c/1e3)),B[r+80>>2]=c%1e3*1e3,ue[r+88>>3]=BigInt(o.ino),0},doMsync(e,t,r,o,a){if(!n.isFile(t.node.mode))throw new n.ErrnoError(43);if(o&2)return 0;var s=G.slice(e,e+r);n.msync(t,s,a,r,o)},getStreamFromFD(e){var t=n.getStreamChecked(e);return t},varargs:void 0,getStr(e){var t=me(e);return t}};function xr(e,t,r){j.varargs=r;try{var o=j.getStreamFromFD(e);switch(t){case 0:{var a=ze();if(a<0)return-28;for(;n.streams[a];)a++;var s;return s=n.dupStream(o,a),s.fd}case 1:case 2:return 0;case 3:return o.flags;case 4:{var a=ze();return o.flags|=a,0}case 12:{var a=Fe(),c=0;return ce[a+c>>1]=2,0}case 13:case 14:return 0}return-28}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Ur(e,t,r){j.varargs=r;try{var o=j.getStreamFromFD(e);switch(t){case 21509:return o.tty?0:-59;case 21505:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var a=o.tty.ops.ioctl_tcgets(o),s=Fe();I[s>>2]=a.c_iflag||0,I[s+4>>2]=a.c_oflag||0,I[s+8>>2]=a.c_cflag||0,I[s+12>>2]=a.c_lflag||0;for(var c=0;c<32;c++)L[s+c+17]=a.c_cc[c]||0;return 0}return 0}case 21510:case 21511:case 21512:return o.tty?0:-59;case 21506:case 21507:case 21508:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){for(var s=Fe(),u=I[s>>2],v=I[s+4>>2],F=I[s+8>>2],O=I[s+12>>2],M=[],c=0;c<32;c++)M.push(L[s+c+17]);return o.tty.ops.ioctl_tcsets(o.tty,t,{c_iflag:u,c_oflag:v,c_cflag:F,c_lflag:O,c_cc:M})}return 0}case 21519:{if(!o.tty)return-59;var s=Fe();return I[s>>2]=0,0}case 21520:return o.tty?-28:-59;case 21531:{var s=Fe();return n.ioctl(o,t,s)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var k=o.tty.ops.ioctl_tiocgwinsz(o.tty),s=Fe();ce[s>>1]=k[0],ce[s+2>>1]=k[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(S){if(typeof n>"u"||S.name!=="ErrnoError")throw S;return-S.errno}}function Br(e,t,r,o){j.varargs=o;try{t=j.getStr(t),t=j.calculateAt(e,t);var a=o?ze():0;return n.open(t,r,a).fd}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}var $r=e=>{var t=new WebAssembly.Exception(Ft(),[e],{traceStack:!0});throw t.message=lt(t),t},zr=()=>{H("native code called abort()")},Hr=e=>{H(`Cannot enlarge memory arrays to size ${e} bytes (OOM). Either (1) compile with -sINITIAL_MEMORY=X with X higher than the current value ${L.length}, (2) compile with -sALLOW_MEMORY_GROWTH which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -sABORTING_MALLOC=0`)},qr=e=>{G.length,e>>>=0,Hr(e)},ft={},Yr=()=>ne||"./this.program",Re=()=>{if(!Re.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Yr()};for(var r in ft)ft[r]===void 0?delete t[r]:t[r]=ft[r];var o=[];for(var r in t)o.push(`${r}=${t[r]}`);Re.strings=o}return Re.strings},Gr=(e,t)=>{for(var r=0;r{var r=0;return Re().forEach((o,a)=>{var s=t+r;B[e+a*4>>2]=s,Gr(o,s),r+=o.length+1}),0},Wr=(e,t)=>{var r=Re();B[e>>2]=r.length;var o=0;return r.forEach(a=>o+=a.length+1),B[t>>2]=o,0},Dt=0,Ct=()=>Tr||Dt>0,Zr=e=>{Ct()||(i.onExit?.(e),ae=!0),X(e,new br(e))},Vr=(e,t)=>{if(Sn(),Ct()&&!t){var r=`program exited (with status: ${e}), but keepRuntimeAlive() is set (counter=${Dt}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;y(r),U(r)}Zr(e)},Xr=Vr;function Kr(e){try{var t=j.getStreamFromFD(e);return n.close(t),0}catch(r){if(typeof n>"u"||r.name!=="ErrnoError")throw r;return r.errno}}function Jr(e,t){try{var r=0,o=0,a=0,s=j.getStreamFromFD(e),c=s.tty?2:n.isDir(s.mode)?3:n.isLink(s.mode)?7:4;return L[t]=c,ce[t+2>>1]=a,ue[t+8>>3]=BigInt(r),ue[t+16>>3]=BigInt(o),0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var Qr=(e,t,r,o)=>{for(var a=0,s=0;s>2],u=B[t+4>>2];t+=8;var v=n.read(e,L,c,u,o);if(v<0)return-1;if(a+=v,v>2]=s,0}catch(c){if(typeof n>"u"||c.name!=="ErrnoError")throw c;return c.errno}}var tn=9007199254740992,rn=-9007199254740992,nn=e=>etn?NaN:Number(e);function on(e,t,r,o){t=nn(t);try{if(isNaN(t))return 61;var a=j.getStreamFromFD(e);return n.llseek(a,t,r),ue[o>>3]=BigInt(a.position),a.getdents&&t===0&&r===0&&(a.getdents=null),0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var an=(e,t,r,o)=>{for(var a=0,s=0;s>2],u=B[t+4>>2];t+=8;var v=n.write(e,L,c,u,o);if(v<0)return-1;a+=v}return a};function sn(e,t,r,o){try{var a=j.getStreamFromFD(e),s=an(a,t,r);return B[o>>2]=s,0}catch(c){if(typeof n>"u"||c.name!=="ErrnoError")throw c;return c.errno}}var Ye=e=>e%4===0&&(e%100!==0||e%400===0),ln=(e,t)=>{for(var r=0,o=0;o<=t;r+=e[o++]);return r},Pt=[31,29,31,30,31,30,31,31,30,31,30,31],Rt=[31,28,31,30,31,30,31,31,30,31,30,31],cn=(e,t)=>{for(var r=new Date(e.getTime());t>0;){var o=Ye(r.getFullYear()),a=r.getMonth(),s=(o?Pt:Rt)[a];if(t>s-r.getDate())t-=s-r.getDate()+1,r.setDate(1),a<11?r.setMonth(a+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1));else return r.setDate(r.getDate()+t),r}return r},mt=(e,t)=>{h(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),L.set(e,t)},un=(e,t,r,o)=>{var a=B[o+40>>2],s={tm_sec:I[o>>2],tm_min:I[o+4>>2],tm_hour:I[o+8>>2],tm_mday:I[o+12>>2],tm_mon:I[o+16>>2],tm_year:I[o+20>>2],tm_wday:I[o+24>>2],tm_yday:I[o+28>>2],tm_isdst:I[o+32>>2],tm_gmtoff:I[o+36>>2],tm_zone:a?me(a):""},c=me(r),u={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var v in u)c=c.replace(new RegExp(v,"g"),u[v]);var F=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],O=["January","February","March","April","May","June","July","August","September","October","November","December"];function M(m,E,Y){for(var R=typeof m=="number"?m.toString():m||"";R.length0?1:0}var R;return(R=Y(m.getFullYear()-E.getFullYear()))===0&&(R=Y(m.getMonth()-E.getMonth()))===0&&(R=Y(m.getDate()-E.getDate())),R}function b(m){switch(m.getDay()){case 0:return new Date(m.getFullYear()-1,11,29);case 1:return m;case 2:return new Date(m.getFullYear(),0,3);case 3:return new Date(m.getFullYear(),0,2);case 4:return new Date(m.getFullYear(),0,1);case 5:return new Date(m.getFullYear()-1,11,31);case 6:return new Date(m.getFullYear()-1,11,30)}}function $(m){var E=cn(new Date(m.tm_year+1900,0,1),m.tm_yday),Y=new Date(E.getFullYear(),0,4),R=new Date(E.getFullYear()+1,0,4),te=b(Y),q=b(R);return S(te,E)<=0?S(q,E)<=0?E.getFullYear()+1:E.getFullYear():E.getFullYear()-1}var J={"%a":m=>F[m.tm_wday].substring(0,3),"%A":m=>F[m.tm_wday],"%b":m=>O[m.tm_mon].substring(0,3),"%B":m=>O[m.tm_mon],"%C":m=>{var E=m.tm_year+1900;return k(E/100|0,2)},"%d":m=>k(m.tm_mday,2),"%e":m=>M(m.tm_mday,2," "),"%g":m=>$(m).toString().substring(2),"%G":$,"%H":m=>k(m.tm_hour,2),"%I":m=>{var E=m.tm_hour;return E==0?E=12:E>12&&(E-=12),k(E,2)},"%j":m=>k(m.tm_mday+ln(Ye(m.tm_year+1900)?Pt:Rt,m.tm_mon-1),3),"%m":m=>k(m.tm_mon+1,2),"%M":m=>k(m.tm_min,2),"%n":()=>` -`,"%p":m=>m.tm_hour>=0&&m.tm_hour<12?"AM":"PM","%S":m=>k(m.tm_sec,2),"%t":()=>" ","%u":m=>m.tm_wday||7,"%U":m=>{var E=m.tm_yday+7-m.tm_wday;return k(Math.floor(E/7),2)},"%V":m=>{var E=Math.floor((m.tm_yday+7-(m.tm_wday+6)%7)/7);if((m.tm_wday+371-m.tm_yday-2)%7<=2&&E++,E){if(E==53){var R=(m.tm_wday+371-m.tm_yday)%7;R!=4&&(R!=3||!Ye(m.tm_year))&&(E=1)}}else{E=52;var Y=(m.tm_wday+7-m.tm_yday-1)%7;(Y==4||Y==5&&Ye(m.tm_year%400-1))&&E++}return k(E,2)},"%w":m=>m.tm_wday,"%W":m=>{var E=m.tm_yday+7-(m.tm_wday+6)%7;return k(Math.floor(E/7),2)},"%y":m=>(m.tm_year+1900).toString().substring(2),"%Y":m=>m.tm_year+1900,"%z":m=>{var E=m.tm_gmtoff,Y=E>=0;return E=Math.abs(E)/60,E=E/60*100+E%60,(Y?"+":"-")+("0000"+E).slice(-4)},"%Z":m=>m.tm_zone,"%%":()=>"%"};c=c.replace(/%%/g,"\0\0");for(var v in J)c.includes(v)&&(c=c.replace(new RegExp(v,"g"),J[v](s)));c=c.replace(/\0\0/g,"%");var Z=qe(c,!1);return Z.length>t?0:(mt(Z,e),Z.length-1)},dn=(e,t,r,o,a)=>un(e,t,r,o),fn=e=>{var t=i["_"+e];return h(t,"Cannot call unknown function "+e+", make sure it is exported"),t},mn=(e,t,r)=>(h(typeof r=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),He(e,G,t,r)),xt=e=>{var t=ut(e)+1,r=Ce(t);return mn(e,r,t),r},Ut=(e,t,r,o,a)=>{var s={string:b=>{var $=0;return b!=null&&b!==0&&($=xt(b)),$},array:b=>{var $=Ce(b.length);return mt(b,$),$}};function c(b){return t==="string"?me(b):t==="boolean"?!!b:b}var u=fn(e),v=[],F=0;if(h(t!=="array",'Return type should not be "array".'),o)for(var O=0;O(...a)=>Ut(e,t,r,a);n.createPreloadedFile=Cr,n.staticInit();function pn(){_r("fetchSettings")}var Bt={__assert_fail:Fr,__syscall_fcntl64:xr,__syscall_ioctl:Ur,__syscall_openat:Br,__throw_exception_with_stack_trace:$r,abort:zr,emscripten_resize_heap:qr,environ_get:jr,environ_sizes_get:Wr,exit:Xr,fd_close:Kr,fd_fdstat_get:Jr,fd_read:en,fd_seek:on,fd_write:sn,strftime_l:dn},K=yr();i._assertion=C("assertion",0),i._Session__create__=C("Session__create__",2),i._Session__destroy__=C("Session__destroy__",1),i._Session__params_ref=C("Session__params_ref",1),i._Session__module_ref=C("Session__module_ref",1),i._Session__device_ref=C("Session__device_ref",1),i._Session_run=C("Session_run",1),i._Session_dumpBuffers=C("Session_dumpBuffers",1),i._Session_start=C("Session_start",2),i._Session_printContext=C("Session_printContext",1),i._Session_step=C("Session_step",3),i._Session_continue=C("Session_continue",2),i._Session_print=C("Session_print",3),i._Session_switch=C("Session_switch",3),i._validate_wasm=C("validate_wasm",1),i._test_entry=C("test_entry",3),i._test_entry_no_tcf=C("test_entry_no_tcf",1),i._run_wasm=C("run_wasm",2),i._debug_wasm=C("debug_wasm",2),i._Session_fetch_shrubbery=C("Session_fetch_shrubbery",2),i._exception=C("exception",0);var $t=C("fflush",1),zt=i._free=C("free",1);i._malloc=C("malloc",1);var Ht=()=>(Ht=K.__trap)(),qt=()=>(qt=K.emscripten_stack_init)(),ht=()=>(ht=K.emscripten_stack_get_end)(),Yt=e=>(Yt=K._emscripten_stack_restore)(e),Gt=e=>(Gt=K._emscripten_stack_alloc)(e),jt=()=>(jt=K.emscripten_stack_get_current)(),vn=C("__cxa_decrement_exception_refcount",1),gn=C("__thrown_object_from_unwind_exception",1),En=C("__get_exception_message",3);i.wasmMemory=le,i.wasmExports=K,i.stackSave=it,i.stackRestore=st,i.stackAlloc=Ce,i.ccall=Ut,i.cwrap=hn,i.UTF8ArrayToString=ke,i.stringToUTF8Array=He,i.stringToUTF8OnStack=xt,i.writeArrayToMemory=mt,i.decrementExceptionRefcount=kr,i.getExceptionMessage=lt;var wn=["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertI32PairToI53Checked","convertU32PairToI53","getTempRet0","setTempRet0","growMemory","ydayFromDate","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","emscriptenLog","readEmAsmArgs","jstoi_q","listenOnce","autoResumeAudioContext","getDynCaller","dynCall","handleException","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","asmjsMangle","HandleAllocator","getNativeTypeSize","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","uleb128Encode","sigToWasmTypes","generateFuncType","convertJsFunctionToWasm","getEmptyTableSlot","updateTableMap","getFunctionAddress","addFunction","removeFunction","reallyNegative","unSign","strLen","reSign","formatString","intArrayToString","AsciiToString","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","stringToNewUTF8","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","checkWasiClock","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","createDyncallWrapper","safeSetTimeout","setImmediateWrapped","clearImmediateWrapped","polyfillSetImmediate","getPromise","makePromise","idsToPromises","makePromiseCallback","Browser_asyncPrepareDataCounter","setMainLoop","getSocketFromFD","getSocketAddress","FS_unlink","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","setErrNo","demangle","stackTrace"];wn.forEach(Sr);var yn=["run","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","FS_createFolder","FS_createPath","FS_createLazyFile","FS_createLink","FS_createDevice","FS_readFile","out","err","callMain","abort","writeStackCookie","checkStackCookie","MAX_INT53","MIN_INT53","bigintToI53Checked","ptrToString","zeroMemory","exitJS","getHeapMax","abortOnCannotGrowMemory","ENV","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","isLeapYear","arraySum","addDays","ERRNO_CODES","ERRNO_MESSAGES","DNS","Protocols","Sockets","initRandomFill","randomFill","timers","warnOnce","readEmAsmArgsArray","jstoi_s","getExecutableName","keepRuntimeAlive","asyncLoad","alignMemory","mmapAlloc","wasmTable","noExitRuntime","getCFunc","freeTableIndexes","functionsInTableMap","setValue","getValue","PATH","PATH_FS","UTF8Decoder","UTF8ToString","stringToUTF8","lengthBytesUTF8","intArrayFromString","stringToAscii","UTF16Decoder","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","doReadv","doWritev","promiseMap","getExceptionMessageCommon","getCppExceptionTag","getCppExceptionThrownObjectFromWebAssemblyException","incrementExceptionRefcount","Browser","getPreloadedImageData__data","wget","SYSCALLS","preloadPlugins","FS_createPreloadedFile","FS_modeStringToFlags","FS_getMode","FS_stdin_getChar_buffer","FS_stdin_getChar","FS","FS_createDataFile","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","allocateUTF8","allocateUTF8OnStack"];yn.forEach(Tt);var Ge;De=function e(){Ge||Wt(),Ge||(De=e)};function _n(){qt(),cr()}function Wt(){if(Se>0||(_n(),ur(),Se>0))return;function e(){Ge||(Ge=!0,i.calledRun=!0,!ae&&(dr(),g(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),h(!i._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),fr()))}i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("")},1),e()},1)):e(),rt()}function Sn(){var e=ve,t=U,r=!1;ve=U=o=>{r=!0};try{$t(0),["stdout","stderr"].forEach(function(o){var a=n.analyzePath("/dev/"+o);if(a){var s=a.object,c=s.rdev,u=Ee.ttys[c];u?.output?.length&&(r=!0)}})}catch{}ve=e,U=t,r&&ge("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.")}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();Wt(),f=w;for(const e of Object.keys(i))e in l||Object.defineProperty(l,e,{configurable:!0,get(){H(`Access to module property ('${e}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return f}})();class Yn extends HTMLElement{constructor(){super(),this._p=new Promise((l,f)=>{this._resolve=l})}get connected(){return this._p}connectedCallback(){this.attachShadow({mode:"open",...this.attributes}).append(...this.childNodes),this._resolve()}_p;_resolve}customElements.define("shadow-root",Yn);const x=document.getElementById("talvos"),re=x.querySelector("output.stdio")||{},Q=x.querySelector("output.error")||{};var Gn={print:function(d){re.value+=d+` -`},printErr:function(d){re.value+=d+` -`}};window.addEventListener("error",d=>{Q.value=""+d.message});window.addEventListener("unhandledrejection",function(d){Q.value=""+d.reason});const xe=new Promise(async(d,l)=>{const f=document.querySelectorAll("#talvos shadow-root");await Promise.all([...f].map(i=>i.connected));for(const i of f){const g=i.shadowRoot.querySelector("svg.vis0");if(g){d(g);return}}l("el not found")}),[pt,jn]=(()=>{function*d(...p){const _=p.map(A=>A[Symbol.iterator]());let N=_.map(A=>A.next());for(;N.every(({done:A})=>!A);)yield N.map(({value:A})=>A),N=_.map(A=>A.next())}const l=async()=>{(await xe).querySelectorAll(".lane").forEach(p=>{p.classList.remove("disabled","selected"),p.dataset.state="inactive",delete p.dataset.logCoords})};document.querySelector("#talvos button.stop").addEventListener("click",l),document.querySelector("#talvos button.continue").addEventListener("click",()=>setTimeout(l,0)),document.querySelector("#talvos button.run").addEventListener("click",l);function y(p){switch(p){case ie.Active:return"active";case ie.Inactive:return"inactive";case ie.AtBarrier:return"at-barrier";case ie.AtBreakpoint:return"at-breakpoint";case ie.AtAssert:return"at-assert";case ie.AtException:return"at-exception";case ie.NotLaunched:return"not-launched";case ie.Exited:return"exited";case ie.UNKNOWN:return"unkown"}}async function w(p){console.assert(""+p.Cores==(await xe).dataset.cores),console.assert(""+p.Lanes==(await xe).dataset.lanes);for(const[_,N,A]of d(function*(){let z=0;for(;;)yield z++}(),(await xe).querySelectorAll("g > .lane"),p.LaneStates))console.assert(`{ ${A.PhyCoord.Core}, ${A.PhyCoord.Lane} }`==N.dataset.phyCoords),N.dataset.state=y(A.State),N.dataset.logCoords=`{ 0, (${A.LogCoord.X},${A.LogCoord.Y},${A.LogCoord.Z}) }`,N.classList.toggle("selected",p.SteppedLanes.has(_))}return[async p=>{let _=[];for(const N of[w])try{N(p)}catch(A){_.push(A)}if(_.length>0)throw _},l]})(),ar=document.querySelector("#talvos section.buffers");var vt={};function ir(d,l){ar.innerHTML="";const f=d.GlobalMemory,i=d.PipelineExecutor.Objects;for(const w of l.Buffers){const p=document.createElement("figure"),_=document.createElement("figcaption");_.innerText=`Buffer '${w.Name.deref()?.asString()??""}' (${w.Size} bytes):'`,p.appendChild(_);const N=document.createElement("ol"),A=i.get(w.Id).Data.data.getBigUint64(0,Oe),z=f.deref(A,64),W=4,ne=D=>z.data.getUint32(D,Oe),X=vt["0x"+A.toString(16)]??[];for(var g=[],y=0;y<=15;y++){const D=document.createElement("li");D.innerText=g[y]=""+ne(y*W),y in X&&X[y]!=g[y]&&(D.dataset.prev=X[y]),N.appendChild(D)}vt["0x"+A.toString(16)]=g,p.appendChild(N),ar.appendChild(p)}}const Ne=document.querySelector("#talvos .controls select");Ne.addEventListener("input",()=>{switch(Ne.value){case"v0":case"v1":document.querySelectorAll(`#talvos > .vis.${Ne.value}`).forEach(l=>{l.classList.remove("hidden")}),document.querySelectorAll(`#talvos > .vis:not(.${Ne.value})`).forEach(l=>{l.classList.add("hidden")});const d=Ne.value=="v1";document.querySelector("#talvos").classList.toggle("vis-wip",d);break;default:throw new Error(`unknown vis: ${Ne.value}`)}});const[Wn,Zn,Vn,Xn,{Session:Qe}]=function(d){return[d.then(l=>l.cwrap("validate_wasm","boolean",["string"])),d.then(l=>l.cwrap("exception",void 0,[])),d.then(l=>l.cwrap("assertion",void 0,[])),d.then(l=>l.getExceptionMessage),(()=>{var l=d.then(({wasmExports:{Session__create__:f,Session__destroy__:i,Session__params_ref:g,Session__module_ref:y,Session__device_ref:w,Session_run:p,Session_dumpBuffers:_,Session_start:N,Session_step:A,Session_switch:z,Session_print:W,Session_continue:ne,Session_printContext:X,Session_fetch_shrubbery:D},stackAlloc:tt,stackSave:se,stackRestore:we,stringToUTF8OnStack:ye,HEAP32:Ue,wasmMemory:oe,_malloc:Me,_free:Ie})=>{function ve(ae){const h=Me(ae),L=oe.buffer,G=new ee(L,h,ae);return[G,()=>Ie(G.addr)]}function U(ae){const h=ae.map(ye),L=tt(h.length);return h.forEach((G,ce)=>{Ue[L+ce*4>>2]=G}),[h.length,L]}const _e=4096;class le{ptr;arena;lastOp;laneMask;params;module;device;static bind(h){try{var L=Object.create(this.prototype);L.ptr=h,L.arena=new On(...ve(_e)),L.lastOp=new V(L.arena.alloc(V.SIZE)),L.laneMask=new Ze(void 0,{data:L.arena.alloc(8).data}),L.params=new Qt(new ee(oe.buffer,g(h),Qt.SIZE)),L.module=new tr(new ee(oe.buffer,y(h),tr.SIZE)),L.device=new or(new ee(oe.buffer,w(h),or.SIZE))}catch(G){throw i(h),L?.arena&&Le(L.arena),G}return L}constructor(h){const L=se(),[G,ce]=[h,"EXEC"].map(ye),I=f(G,ce);return we(L),le.bind(I)}run(){p(this.ptr)}dumpBuffers(){_(this.ptr)}start(){vt={},N(this.ptr,this.lastOp.ptr.asRef()),pt(this.lastOp),ir(this.device,this.module)}async step(){this.laneMask.clear(),(await xe).querySelectorAll(".lane").forEach((L,G)=>{L.classList.contains("selected")&&this.laneMask.add(G)});var h=A(this.ptr,this.laneMask.asRef(),this.lastOp.asRef());return pt(this.lastOp),ir(this.device,this.module),h>0&&jn(),h}switch(h){const L=se();z(this.ptr,...U(["switch",...h])),we(L)}print(h){const L=se();W(this.ptr,...U(["print",...h])),we(L)}continue(){ne(this.ptr,this.lastOp.ptr.asRef()),pt(this.lastOp)}printContext(){X(this.ptr)}fetchShrubbery(){var h=this.arena.alloc(8);return D(this.ptr,h.asRef()),new Ze(void 0,{data:h.data})}__destroy__(){console.log("Session.destroy..."),i(this.ptr),this.ptr=0,Le(this.arena)}}return{Session:le}});return{Session:l.then(f=>f.Session)}})()]}(qn(Gn));function Le(d){d.__destroy__()}function et(d,l){return re.value="",Q.value="",x.querySelector("output.timing").value="...",x.querySelectorAll("button.exec").forEach(f=>f.disabled=!0),l=l??window.performance.mark("talvos"),(async()=>d())().catch(async f=>{var i;if(f instanceof WebAssembly.Exception){var g;[g,i]=(await Xn)(f),i=i||`of type ${g}`,console.error(f.stack)}else console.error(`in ${l.name}:`,f),i=""+f;Q.value=i}).finally(()=>{const f=window.performance.measure(l.name,l.name);x.querySelector("output.timing").value=`done in ${f.duration}ms`,x.querySelectorAll("button.exec").forEach(i=>i.removeAttribute("disabled"))})}x.querySelector("button.validate").onclick=async function(){const d=x.querySelector(".module").value,l=window.performance.mark("validate_wasm",{detail:{text:d}}),f=await et(async()=>(await Wn)(d),l);x.querySelector("output.stdio").value+=f?"ok!":"not ok :("};x.querySelector("button.assertion").onclick=async()=>et(await Vn);x.querySelector("button.exception").onclick=async()=>et(await Zn);x.querySelector("button.shrubbery").onclick=async()=>{const d=(await Qe).bind(828927560446);try{const l=d.fetchShrubbery();console.log(l)}finally{Le(d.arena)}};x.querySelector("button.run").onclick=async function(){const d=x.querySelector(".module").value,l=window.performance.mark("run_wasm",{detail:{text:d}});et(async()=>{const f=new(await Qe)(d),i=x.querySelector('select[name="entry"]');f.params.EntryName=i.selectedOptions.item(0)?.value??"main";try{f.run(),f.dumpBuffers()}finally{Le(f)}},l)};x.querySelector("button.debug").onclick=async function(){re.value="",Q.value="",x.querySelector("output.timing").value="...",x.querySelectorAll("button.exec").forEach(w=>w.disabled=!0);const d=x.querySelector(".module").value,l=window.performance.mark("debug",{detail:{text:d}}),f=new(await Qe)(d);f.params.EntryName=sr.selectedOptions.item(0)?.value??"main";const i=x.querySelector(".debugger");function g(){i.hidden=!0,i.querySelectorAll("button").forEach(p=>p.onclick=null),x.querySelectorAll("button.exec").forEach(p=>p.removeAttribute("disabled")),Le(f);const w=window.performance.measure(l.name,l.name);x.querySelector("output.timing").value=`done in ${w.duration}ms`}try{f.start(),f.printContext()}catch(w){throw g(),w}const y=1;i.querySelector("button.step").onclick=async function(){re.value="",Q.value="";try{await f.step()==y&&g(),f.printContext()}catch(w){throw g(),w}},i.querySelector("button.switch").onclick=function(){const w=prompt("Usage: switch: X [Y [Z]]","X [Y [Z]]");if(w==null)return;const p=w.split(/\s+/);f.switch(p)},i.querySelector("button.print").onclick=function(){const w=prompt("Usage: print: %","%15");if(w==null)return;const p=w.split(/\s+/);f.print(p)},i.querySelector("button.stop").onclick=g,i.querySelector("button.continue").onclick=function(){re.value="",Q.value="";try{f.continue()}finally{g()}},i.hidden=!1};const sr=x.querySelector('select[name="entry"]');setTimeout(async function(){const l=re.value,f=Q.value;re.value="",Q.value="";const i=x.querySelector(".module").value,g=new(await Qe)(i);try{console.log([...g.module.EntryPoints].map(y=>y.Name.asString())),sr.innerHTML=[...g.module.EntryPoints].map(y=>``).join("")}finally{Le(g)}re.value&&console.log(re.value),re.value=l,Q.value&&console.error(Q.value),Q.value=f},0); diff --git a/dist/_astro/hoisted.D8fGXrWt.js b/dist/_astro/hoisted.DxkYFGKt.js similarity index 50% rename from dist/_astro/hoisted.D8fGXrWt.js rename to dist/_astro/hoisted.DxkYFGKt.js index e932d3d..7d6e062 100644 --- a/dist/_astro/hoisted.D8fGXrWt.js +++ b/dist/_astro/hoisted.DxkYFGKt.js @@ -1,2 +1,2 @@ const __vite__fileDeps=["_astro/ui-core.CRsU5wLh.js","_astro/preload-helper.Cd0R8zjt.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); -import{_ as b}from"./preload-helper.Cd0R8zjt.js";class L extends HTMLElement{constructor(){super();const e=this.querySelector("select");e&&e.addEventListener("change",o=>{o.currentTarget instanceof HTMLSelectElement&&(window.location.pathname=o.currentTarget.value)})}}customElements.define("starlight-lang-select",L);class T extends HTMLElement{constructor(){super();const e=this.querySelector("button[data-open-modal]"),o=this.querySelector("button[data-close-modal]"),r=this.querySelector("dialog"),d=this.querySelector(".dialog-frame"),a=t=>{("href"in(t.target||{})||document.body.contains(t.target)&&!d.contains(t.target))&&h()},i=t=>{r.showModal(),document.body.toggleAttribute("data-search-modal-open",!0),this.querySelector("input")?.focus(),t?.stopPropagation(),window.addEventListener("click",a)},h=()=>r.close();e.addEventListener("click",i),e.disabled=!1,o.addEventListener("click",h),r.addEventListener("close",()=>{document.body.toggleAttribute("data-search-modal-open",!1),window.removeEventListener("click",a)}),window.addEventListener("keydown",t=>{const l=document.activeElement instanceof HTMLElement&&(["input","select","textarea"].includes(document.activeElement.tagName.toLowerCase())||document.activeElement.isContentEditable);(t.metaKey===!0||t.ctrlKey===!0)&&t.key==="k"?(r.open?h():i(),t.preventDefault()):t.key==="/"&&!r.open&&!l&&(i(),t.preventDefault())});let g={};try{g=JSON.parse(this.dataset.translations||"{}")}catch{}const c=this.dataset.stripTrailingSlash!==void 0?t=>t.replace(/(.)\/(#.*)?$/,"$1$2"):t=>t;window.addEventListener("DOMContentLoaded",()=>{(window.requestIdleCallback||(l=>setTimeout(l,1)))(async()=>{const{PagefindUI:l}=await b(()=>import("./ui-core.CRsU5wLh.js"),__vite__mapDeps([0,1]));new l({element:"#starlight__search",baseUrl:"/learn-gpgpu",bundlePath:"/learn-gpgpu".replace(/\/$/,"")+"/pagefind/",showImages:!1,translations:g,showSubResults:!0,processResult:u=>{u.url=c(u.url),u.sub_results=u.sub_results.map(m=>(m.url=c(m.url),m))}})})})}}customElements.define("site-search",T);const E="starlight-theme",S=s=>s==="auto"||s==="dark"||s==="light"?s:"auto",y=()=>S(typeof localStorage<"u"&&localStorage.getItem(E));function w(s){typeof localStorage<"u"&&localStorage.setItem(E,s==="light"||s==="dark"?s:"")}const k=()=>matchMedia("(prefers-color-scheme: light)").matches?"light":"dark";function f(s){StarlightThemeProvider.updatePickers(s),document.documentElement.dataset.theme=s==="auto"?k():s,w(s)}matchMedia("(prefers-color-scheme: light)").addEventListener("change",()=>{y()==="auto"&&f("auto")});class x extends HTMLElement{constructor(){super(),f(y()),this.querySelector("select")?.addEventListener("change",e=>{e.currentTarget instanceof HTMLSelectElement&&f(S(e.currentTarget.value))})}}customElements.define("starlight-theme-select",x);const H="_top";class v extends HTMLElement{constructor(){super(),this._current=this.querySelector('a[aria-current="true"]'),this.minH=parseInt(this.dataset.minH||"2",10),this.maxH=parseInt(this.dataset.maxH||"3",10);const e=[...this.querySelectorAll("a")],o=n=>{if(n instanceof HTMLHeadingElement){if(n.id===H)return!0;const c=n.tagName[1];if(c){const t=parseInt(c,10);if(t>=this.minH&&t<=this.maxH)return!0}}return!1},r=n=>{if(!n)return null;const c=n;for(;n;){if(o(n))return n;for(n=n.previousElementSibling;n?.lastElementChild;)n=n.lastElementChild;const t=r(n);if(t)return t}return r(c.parentElement)},d=n=>{for(const{isIntersecting:c,target:t}of n){if(!c)continue;const l=r(t);if(!l)continue;const u=e.find(m=>m.hash==="#"+encodeURIComponent(l.id));if(u){this.current=u;break}}},a=document.querySelectorAll("main [id], main [id] ~ *, main .content > *");let i;const h=()=>{i&&i.disconnect(),i=new IntersectionObserver(d,{rootMargin:this.getRootMargin()}),a.forEach(n=>i.observe(n))};h();const g=window.requestIdleCallback||(n=>setTimeout(n,1));let p;window.addEventListener("resize",()=>{i&&i.disconnect(),clearTimeout(p),p=setTimeout(()=>g(h),200)})}set current(e){e!==this._current&&(this._current&&this._current.removeAttribute("aria-current"),e.setAttribute("aria-current","true"),this._current=e)}getRootMargin(){const e=document.querySelector("header")?.getBoundingClientRect().height||0,o=this.querySelector("summary")?.getBoundingClientRect().height||0,r=e+o+32,d=r+53,a=document.documentElement.clientHeight;return`-${r}px 0% ${d-a}px`}}customElements.define("starlight-toc",v);class M extends v{set current(e){super.current=e;const o=this.querySelector(".display-current");o&&(o.textContent=e.textContent)}constructor(){super();const e=this.querySelector("details");if(!e)return;const o=()=>{e.open=!1};e.querySelectorAll("a").forEach(r=>{r.addEventListener("click",o)}),window.addEventListener("click",r=>{e.contains(r.target)||o()}),window.addEventListener("keydown",r=>{if(r.key==="Escape"&&e.open){const d=e.contains(document.activeElement);if(o(),d){const a=e.querySelector("summary");a&&a.focus()}}})}}customElements.define("mobile-starlight-toc",M);class q extends HTMLElement{constructor(){super(),this.btn=this.querySelector("button"),this.btn.addEventListener("click",()=>this.toggleExpanded());const e=this.closest("nav");e&&e.addEventListener("keyup",o=>this.closeOnEscape(o))}setExpanded(e){this.setAttribute("aria-expanded",String(e)),document.body.toggleAttribute("data-mobile-menu-expanded",e)}toggleExpanded(){this.setExpanded(this.getAttribute("aria-expanded")!=="true")}closeOnEscape(e){e.code==="Escape"&&(this.setExpanded(!1),this.btn.focus())}}customElements.define("starlight-menu-button",q); +import{_ as b}from"./preload-helper.Cd0R8zjt.js";class L extends HTMLElement{constructor(){super();const e=this.querySelector("select");e&&e.addEventListener("change",o=>{o.currentTarget instanceof HTMLSelectElement&&(window.location.pathname=o.currentTarget.value)})}}customElements.define("starlight-lang-select",L);class T extends HTMLElement{constructor(){super();const e=this.querySelector("button[data-open-modal]"),o=this.querySelector("button[data-close-modal]"),r=this.querySelector("dialog"),d=this.querySelector(".dialog-frame"),a=t=>{("href"in(t.target||{})||document.body.contains(t.target)&&!d.contains(t.target))&&h()},i=t=>{r.showModal(),document.body.toggleAttribute("data-search-modal-open",!0),this.querySelector("input")?.focus(),t?.stopPropagation(),window.addEventListener("click",a)},h=()=>r.close();e.addEventListener("click",i),e.disabled=!1,o.addEventListener("click",h),r.addEventListener("close",()=>{document.body.toggleAttribute("data-search-modal-open",!1),window.removeEventListener("click",a)}),window.addEventListener("keydown",t=>{const l=document.activeElement instanceof HTMLElement&&(["input","select","textarea"].includes(document.activeElement.tagName.toLowerCase())||document.activeElement.isContentEditable);(t.metaKey===!0||t.ctrlKey===!0)&&t.key==="k"?(r.open?h():i(),t.preventDefault()):t.key==="/"&&!r.open&&!l&&(i(),t.preventDefault())});let g={};try{g=JSON.parse(this.dataset.translations||"{}")}catch{}const c=this.dataset.stripTrailingSlash!==void 0?t=>t.replace(/(.)\/(#.*)?$/,"$1$2"):t=>t;window.addEventListener("DOMContentLoaded",()=>{(window.requestIdleCallback||(l=>setTimeout(l,1)))(async()=>{const{PagefindUI:l}=await b(()=>import("./ui-core.CRsU5wLh.js"),__vite__mapDeps([0,1]));new l({element:"#starlight__search",baseUrl:"/learn-gpgpu",bundlePath:"/learn-gpgpu".replace(/\/$/,"")+"/pagefind/",showImages:!1,translations:g,showSubResults:!0,processResult:u=>{u.url=c(u.url),u.sub_results=u.sub_results.map(m=>(m.url=c(m.url),m))}})})})}}customElements.define("site-search",T);const E="starlight-theme",S=s=>s==="auto"||s==="dark"||s==="light"?s:"auto",y=()=>S(typeof localStorage<"u"&&localStorage.getItem(E));function w(s){typeof localStorage<"u"&&localStorage.setItem(E,s==="light"||s==="dark"?s:"")}const k=()=>matchMedia("(prefers-color-scheme: light)").matches?"light":"dark";function f(s){StarlightThemeProvider.updatePickers(s),document.documentElement.dataset.theme=s==="auto"?k():s,w(s)}matchMedia("(prefers-color-scheme: light)").addEventListener("change",()=>{y()==="auto"&&f("auto")});class x extends HTMLElement{constructor(){super(),f(y()),this.querySelector("select")?.addEventListener("change",e=>{e.currentTarget instanceof HTMLSelectElement&&f(S(e.currentTarget.value))})}}customElements.define("starlight-theme-select",x);class H extends HTMLElement{constructor(){super(),this.btn=this.querySelector("button"),this.btn.addEventListener("click",()=>this.toggleExpanded());const e=this.closest("nav");e&&e.addEventListener("keyup",o=>this.closeOnEscape(o))}setExpanded(e){this.setAttribute("aria-expanded",String(e)),document.body.toggleAttribute("data-mobile-menu-expanded",e)}toggleExpanded(){this.setExpanded(this.getAttribute("aria-expanded")!=="true")}closeOnEscape(e){e.code==="Escape"&&(this.setExpanded(!1),this.btn.focus())}}customElements.define("starlight-menu-button",H);const M="_top";class v extends HTMLElement{constructor(){super(),this._current=this.querySelector('a[aria-current="true"]'),this.minH=parseInt(this.dataset.minH||"2",10),this.maxH=parseInt(this.dataset.maxH||"3",10);const e=[...this.querySelectorAll("a")],o=n=>{if(n instanceof HTMLHeadingElement){if(n.id===M)return!0;const c=n.tagName[1];if(c){const t=parseInt(c,10);if(t>=this.minH&&t<=this.maxH)return!0}}return!1},r=n=>{if(!n)return null;const c=n;for(;n;){if(o(n))return n;for(n=n.previousElementSibling;n?.lastElementChild;)n=n.lastElementChild;const t=r(n);if(t)return t}return r(c.parentElement)},d=n=>{for(const{isIntersecting:c,target:t}of n){if(!c)continue;const l=r(t);if(!l)continue;const u=e.find(m=>m.hash==="#"+encodeURIComponent(l.id));if(u){this.current=u;break}}},a=document.querySelectorAll("main [id], main [id] ~ *, main .content > *");let i;const h=()=>{i&&i.disconnect(),i=new IntersectionObserver(d,{rootMargin:this.getRootMargin()}),a.forEach(n=>i.observe(n))};h();const g=window.requestIdleCallback||(n=>setTimeout(n,1));let p;window.addEventListener("resize",()=>{i&&i.disconnect(),clearTimeout(p),p=setTimeout(()=>g(h),200)})}set current(e){e!==this._current&&(this._current&&this._current.removeAttribute("aria-current"),e.setAttribute("aria-current","true"),this._current=e)}getRootMargin(){const e=document.querySelector("header")?.getBoundingClientRect().height||0,o=this.querySelector("summary")?.getBoundingClientRect().height||0,r=e+o+32,d=r+53,a=document.documentElement.clientHeight;return`-${r}px 0% ${d-a}px`}}customElements.define("starlight-toc",v);class q extends v{set current(e){super.current=e;const o=this.querySelector(".display-current");o&&(o.textContent=e.textContent)}constructor(){super();const e=this.querySelector("details");if(!e)return;const o=()=>{e.open=!1};e.querySelectorAll("a").forEach(r=>{r.addEventListener("click",o)}),window.addEventListener("click",r=>{e.contains(r.target)||o()}),window.addEventListener("keydown",r=>{if(r.key==="Escape"&&e.open){const d=e.contains(document.activeElement);if(o(),d){const a=e.querySelector("summary");a&&a.focus()}}})}}customElements.define("mobile-starlight-toc",q); diff --git a/dist/docs/glossary/index.html b/dist/docs/glossary/index.html index 19eee76..ed43e11 100644 --- a/dist/docs/glossary/index.html +++ b/dist/docs/glossary/index.html @@ -24,7 +24,7 @@ }, }; })(); - + Skip to content