@skydesign/tf 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +149 -146
- package/dist/{render-Dzu8gXVX.mjs → render-SK2uaqmj.mjs} +714 -709
- package/dist/{render-wQ_Mruy4.js → render-aoKrPS96.js} +3 -3
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var gn=Object.defineProperty;var Fn=(c,l,f)=>l in c?gn(c,l,{enumerable:!0,configurable:!0,writable:!0,value:f}):c[l]=f;var he=(c,l,f)=>Fn(c,typeof l!="symbol"?l+"":l,f);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const En=require("linkedom"),We=require("./render-wQ_Mruy4.js");var Mn=ArrayBuffer,q=Uint8Array,cr=Uint16Array,Cn=Int16Array,lr=Int32Array,Dr=function(c,l,f){if(q.prototype.slice)return q.prototype.slice.call(c,l,f);(l==null||l<0)&&(l=0),(f==null||f>c.length)&&(f=c.length);var d=new q(f-l);return d.set(c.subarray(l,f)),d},Te=function(c,l,f,d){if(q.prototype.fill)return q.prototype.fill.call(c,l,f,d);for((f==null||f<0)&&(f=0),(d==null||d>c.length)&&(d=c.length);f<d;++f)c[f]=l;return c},Rn=function(c,l,f,d){if(q.prototype.copyWithin)return q.prototype.copyWithin.call(c,l,f,d);for((f==null||f<0)&&(f=0),(d==null||d>c.length)&&(d=c.length);f<d;)c[l++]=c[f++]},Ln=["invalid zstd data","window size too large (>2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],Z=function(c,l,f){var d=new Error(l||Ln[c]);if(d.code=c,Error.captureStackTrace&&Error.captureStackTrace(d,Z),!f)throw d;return d},dt=function(c,l,f){for(var d=0,v=0;d<f;++d)v|=c[l++]<<(d<<3);return v},Dn=function(c,l){return(c[l]|c[l+1]<<8|c[l+2]<<16|c[l+3]<<24)>>>0},bn=function(c,l){var f=c[0]|c[1]<<8|c[2]<<16;if(f==3126568&&c[3]==253){var d=c[4],v=d>>5&1,w=d>>2&1,E=d&3,R=d>>6;d&8&&Z(0);var L=6-v,X=E==3?4:E,K=dt(c,L,X);L+=X;var z=R?1<<R:v,V=dt(c,L,z)+(R==1&&256),H=V;if(!v){var J=1<<10+(c[5]>>3);H=J+(J>>3)*(c[5]&7)}H>2145386496&&Z(1);var D=new q((l==1?V||H:l?0:H)+12);return D[0]=1,D[4]=4,D[8]=8,{b:L+z,y:0,l:0,d:K,w:l&&l!=1?l:D.subarray(12),e:H,o:new lr(D.buffer,0,3),u:V,c:w,m:Math.min(131072,H)}}else if((f>>4|c[3]<<20)==25481893)return Dn(c,4)+8;Z(0)},be=function(c){for(var l=0;1<<l<=c;++l);return l-1},qe=function(c,l,f){var d=(l<<3)+4,v=(c[l]&15)+5;v>f&&Z(3);for(var w=1<<v,E=w,R=-1,L=-1,X=-1,K=w,z=new Mn(512+(w<<2)),V=new Cn(z,0,256),H=new cr(z,0,256),J=new cr(z,512,w),D=512+(w<<1),I=new q(z,D,w),ee=new q(z,D+w);R<255&&E>0;){var W=be(E+1),g=d>>3,b=(1<<W+1)-1,T=(c[g]|c[g+1]<<8|c[g+2]<<16)>>(d&7)&b,U=(1<<W)-1,re=b-E-1,ne=T&U;if(ne<re?(d+=W,T=ne):(d+=W+1,T>U&&(T-=re)),V[++R]=--T,T==-1?(E+=T,I[--K]=R):E-=T,!T)do{var ce=d>>3;L=(c[ce]|c[ce+1]<<8)>>(d&7)&3,d+=2,R+=L}while(L==3)}(R>255||E)&&Z(0);for(var O=0,ae=(w>>1)+(w>>3)+3,le=w-1,ie=0;ie<=R;++ie){var S=V[ie];if(S<1){H[ie]=-S;continue}for(X=0;X<S;++X){I[O]=ie;do O=O+ae≤while(O>=K)}}for(O&&Z(0),X=0;X<w;++X){var P=H[I[X]]++,oe=ee[X]=v-be(P);J[X]=(P<<oe)-w}return[d+7>>3,{b:v,s:I,n:ee,t:J}]},Yn=function(c,l){var f=0,d=-1,v=new q(292),w=c[l],E=v.subarray(0,256),R=v.subarray(256,268),L=new cr(v.buffer,268);if(w<128){var X=qe(c,l+1,6),K=X[0],z=X[1];l+=w;var V=K<<3,H=c[l];H||Z(0);for(var J=0,D=0,I=z.b,ee=I,W=(++l<<3)-8+be(H);W-=I,!(W<V);){var g=W>>3;if(J+=(c[g]|c[g+1]<<8)>>(W&7)&(1<<I)-1,E[++d]=z.s[J],W-=ee,W<V)break;g=W>>3,D+=(c[g]|c[g+1]<<8)>>(W&7)&(1<<ee)-1,E[++d]=z.s[D],I=z.n[J],J=z.t[J],ee=z.n[D],D=z.t[D]}++d>255&&Z(0)}else{for(d=w-127;f<d;f+=2){var b=c[++l];E[f]=b>>4,E[f+1]=b&15}++l}var T=0;for(f=0;f<d;++f){var U=E[f];U>11&&Z(0),T+=U&&1<<U-1}var re=be(T)+1,ne=1<<re,ce=ne-T;for(ce&ce-1&&Z(0),E[d++]=be(ce)+1,f=0;f<d;++f){var U=E[f];++R[E[f]=U&&re+1-U]}var O=new q(ne<<1),ae=O.subarray(0,ne),le=O.subarray(ne);for(L[re]=0,f=re;f>0;--f){var ie=L[f];Te(le,f,ie,L[f-1]=ie+R[f]*(1<<re-f))}for(L[0]!=ne&&Z(0),f=0;f<d;++f){var S=E[f];if(S){var P=L[S];Te(ae,f,P,L[S]=P+(1<<re-S))}}return[l,{n:le,b:re,s:ae}]},Un=qe(new q([81,16,99,140,49,198,24,99,12,33,196,24,99,102,102,134,70,146,4]),0,6)[1],Bn=qe(new q([33,20,196,24,99,140,33,132,16,66,8,33,132,16,66,8,33,68,68,68,68,68,68,68,68,36,9]),0,6)[1],jn=qe(new q([32,132,16,66,102,70,68,68,68,68,36,73,2]),0,5)[1],vt=function(c,l){for(var f=c.length,d=new lr(f),v=0;v<f;++v)d[v]=l,l+=1<<c[v];return d},Yr=new q(new lr([0,0,0,0,16843009,50528770,134678020,202050057,269422093]).buffer,0,36),Pn=vt(Yr,0),Ur=new q(new lr([0,0,0,0,0,0,0,0,16843009,50528770,117769220,185207048,252579084,16]).buffer,0,53),xn=vt(Ur,3),Ke=function(c,l,f){var d=c.length,v=l.length,w=c[d-1],E=(1<<f.b)-1,R=-f.b;w||Z(0);for(var L=0,X=f.b,K=(d<<3)-8+be(w)-X,z=-1;K>R&&z<v;){var V=K>>3,H=(c[V]|c[V+1]<<8|c[V+2]<<16)>>(K&7);L=(L<<X|H)&E,l[++z]=f.s[L],K-=X=f.n[L]}(K!=R||z+1!=v)&&Z(0)},Xn=function(c,l,f){var d=6,v=l.length,w=v+3>>2,E=w<<1,R=w+E;Ke(c.subarray(d,d+=c[0]|c[1]<<8),l.subarray(0,w),f),Ke(c.subarray(d,d+=c[2]|c[3]<<8),l.subarray(w,E),f),Ke(c.subarray(d,d+=c[4]|c[5]<<8),l.subarray(E,R),f),Ke(c.subarray(d),l.subarray(R),f)},In=function(c,l,f){var d,v=l.b,w=c[v],E=w>>1&3;l.l=w&1;var R=w>>3|c[v+1]<<5|c[v+2]<<13,L=(v+=3)+R;if(E==1)return v>=c.length?void 0:(l.b=v+1,f?(Te(f,c[v],l.y,l.y+=R),f):Te(new q(R),c[v]));if(!(L>c.length)){if(E==0)return l.b=L,f?(f.set(c.subarray(v,L),l.y),l.y+=R,f):Dr(c,v,L);if(E==2){var X=c[v],K=X&3,z=X>>2&3,V=X>>4,H=0,J=0;K<2?z&1?V|=c[++v]<<4|(z&2&&c[++v]<<12):V=X>>3:(J=z,z<2?(V|=(c[++v]&63)<<4,H=c[v]>>6|c[++v]<<2):z==2?(V|=c[++v]<<4|(c[++v]&3)<<12,H=c[v]>>2|c[++v]<<6):(V|=c[++v]<<4|(c[++v]&63)<<12,H=c[v]>>6|c[++v]<<2|c[++v]<<10)),++v;var D=f?f.subarray(l.y,l.y+l.m):new q(l.m),I=D.length-V;if(K==0)D.set(c.subarray(v,v+=V),I);else if(K==1)Te(D,c[v++],I);else{var ee=l.h;if(K==2){var W=Yn(c,v);H+=v-(v=W[0]),l.h=ee=W[1]}else ee||Z(0);(J?Xn:Ke)(c.subarray(v,v+=H),D.subarray(I),ee)}var g=c[v++];if(g){g==255?g=(c[v++]|c[v++]<<8)+32512:g>127&&(g=g-128<<8|c[v++]);var b=c[v++];b&3&&Z(0);for(var T=[Bn,jn,Un],U=2;U>-1;--U){var re=b>>(U<<1)+2&3;if(re==1){var ne=new q([0,0,c[v++]]);T[U]={s:ne.subarray(2,3),n:ne.subarray(0,1),t:new cr(ne.buffer,0,1),b:0}}else re==2?(d=qe(c,v,9-(U&1)),v=d[0],T[U]=d[1]):re==3&&(l.t||Z(0),T[U]=l.t[U])}var ce=l.t=T,O=ce[0],ae=ce[1],le=ce[2],ie=c[L-1];ie||Z(0);var S=(L<<3)-8+be(ie)-le.b,P=S>>3,oe=0,Ye=(c[P]|c[P+1]<<8)>>(S&7)&(1<<le.b)-1;P=(S-=ae.b)>>3;var Ue=(c[P]|c[P+1]<<8)>>(S&7)&(1<<ae.b)-1;P=(S-=O.b)>>3;var m=(c[P]|c[P+1]<<8)>>(S&7)&(1<<O.b)-1;for(++g;--g;){var B=le.s[Ye],Ge=le.n[Ye],Be=O.s[m],ze=O.n[m],ye=ae.s[Ue],se=ae.n[Ue];P=(S-=ye)>>3;var Qe=1<<ye,x=Qe+((c[P]|c[P+1]<<8|c[P+2]<<16|c[P+3]<<24)>>>(S&7)&Qe-1);P=(S-=Ur[Be])>>3;var Re=xn[Be]+((c[P]|c[P+1]<<8|c[P+2]<<16)>>(S&7)&(1<<Ur[Be])-1);P=(S-=Yr[B])>>3;var Le=Pn[B]+((c[P]|c[P+1]<<8|c[P+2]<<16)>>(S&7)&(1<<Yr[B])-1);if(P=(S-=Ge)>>3,Ye=le.t[Ye]+((c[P]|c[P+1]<<8)>>(S&7)&(1<<Ge)-1),P=(S-=ze)>>3,m=O.t[m]+((c[P]|c[P+1]<<8)>>(S&7)&(1<<ze)-1),P=(S-=se)>>3,Ue=ae.t[Ue]+((c[P]|c[P+1]<<8)>>(S&7)&(1<<se)-1),x>3)l.o[2]=l.o[1],l.o[1]=l.o[0],l.o[0]=x-=3;else{var de=x-(Le!=0);de?(x=de==3?l.o[0]-1:l.o[de],de>1&&(l.o[2]=l.o[1]),l.o[1]=l.o[0],l.o[0]=x):x=l.o[0]}for(var U=0;U<Le;++U)D[oe+U]=D[I+U];oe+=Le,I+=Le;var me=oe-x;if(me<0){var ve=-me,Ze=l.e+me;ve>Re&&(ve=Re);for(var U=0;U<ve;++U)D[oe+U]=l.w[Ze+U];oe+=ve,Re-=ve,me=0}for(var U=0;U<Re;++U)D[oe+U]=D[me+U];oe+=Re}if(oe!=I)for(;I<D.length;)D[oe++]=D[I++];else oe=D.length;f?l.y+=oe:D=Dr(D,0,oe)}else if(f){if(l.y+=V,I)for(var U=0;U<V;++U)D[U]=D[I+U]}else I&&(D=Dr(D,I));return l.b=L,D}Z(2)}},$n=function(c,l){if(c.length==1)return c[0];for(var f=new q(l),d=0,v=0;d<c.length;++d){var w=c[d];f.set(w,v),v+=w.length}return f};function Gn(c,l){for(var f=[],d=+!l,v=0,w=0;c.length;){var E=bn(c,d||l);if(typeof E=="object"){for(d?(l=null,E.w.length==E.u&&(f.push(l=E.w),w+=E.u)):(f.push(l),E.e=0);!E.l;){var R=In(c,E,l);R||Z(5),l?E.e=E.y:(f.push(R),w+=R.length,Rn(E.w,0,R.length),E.w.set(R,E.w.length-R.length))}v=E.b+E.c*4}else v=E;c=c.subarray(v)}return $n(f,w)}async function zn(c={}){var l,f=c,d="./this.program",v=(e,r)=>{throw r},w,E,R=console.log.bind(console),L=console.error.bind(console),X,K=!1,z,V=e=>e.startsWith("file://"),H,J,D,I,ee,W,g,b,T,U,re=!1;function ne(){var e=sr.buffer;D=new Int8Array(e),ee=new Int16Array(e),f.HEAPU8=I=new Uint8Array(e),W=new Uint16Array(e),g=new Int32Array(e),b=new Uint32Array(e),T=new Float32Array(e),U=new Float64Array(e)}function ce(){re=!0,!f.noFSInit&&!n.initialized&&n.init(),ke.S(),n.ignorePermissions=!1}function O(e){e="Aborted("+e+")",L(e),K=!0,e+=". Build with -sASSERTIONS for more info.",re&&rt();var r=new WebAssembly.RuntimeError(e);throw J==null||J(r),r}var ae;let le=()=>"";function ie(e){if(e==ae&&X)return new Uint8Array(X);throw"both async and sync fetching of the wasm failed"}async function S(e){if(!X)try{var r=await w(e);return new Uint8Array(r)}catch{}return ie(e)}async function P(e,r){try{var t=await S(e),o=await WebAssembly.instantiate(t,r);return o}catch(a){L(`failed to asynchronously prepare wasm: ${a}`),O(a)}}async function oe(e,r,t){if(!e&&!V(r))try{var o=fetch(r,{credentials:"same-origin"}),a=await WebAssembly.instantiateStreaming(o,t);return a}catch(i){L(`wasm streaming compile failed: ${i}`),L("falling back to ArrayBuffer instantiation")}return P(r,t)}function Ye(){var e={a:wn};return e}async function Ue(){function e(i,s){return ke=i.exports,mn(ke),ne(),ke}function r(i){return e(i.instance)}var t=Ye();ae??(ae=le());var o=await oe(X,ae,t),a=r(o);return a}var m,B;class Ge{constructor(r){he(this,"name","ExitStatus");this.message=`Program terminated with exit(${r})`,this.status=r}}var Be=globalThis.TextDecoder&&new TextDecoder,ze=(e,r,t,o)=>{var a=r+t;if(o)return a;for(;e[r]&&!(r>=a);)++r;return r},ye=(e,r=0,t,o)=>{var a=ze(e,r,t,o);if(a-r>16&&e.buffer&&Be)return Be.decode(e.subarray(r,a));for(var i="";r<a;){var s=e[r++];if(!(s&128)){i+=String.fromCharCode(s);continue}var u=e[r++]&63;if((s&224)==192){i+=String.fromCharCode((s&31)<<6|u);continue}var h=e[r++]&63;if((s&240)==224?s=(s&15)<<12|u<<6|h:s=(s&7)<<18|u<<12|h<<6|e[r++]&63,s<65536)i+=String.fromCharCode(s);else{var p=s-65536;i+=String.fromCharCode(55296|p>>10,56320|p&1023)}}return i},se=(e,r,t)=>e?ye(I,e,r,t):"",Qe=(e,r,t,o)=>O(`Assertion failed: ${se(e)}, at: `+[r?se(r):"unknown filename",t,o?se(o):"unknown function"]),x={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,o=e.length-1;o>=0;o--){var a=e[o];a==="."?e.splice(o,1):a===".."?(e.splice(o,1),t++):t&&(e.splice(o,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=x.isAbs(e),t=e.slice(-1)==="/";return e=x.normalizeArray(e.split("/").filter(o=>!!o),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=x.splitPath(e),t=r[0],o=r[1];return!t&&!o?".":(o&&(o=o.slice(0,-1)),t+o)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>x.normalize(e.join("/")),join2:(e,r)=>x.normalize(e+"/"+r)},Re=()=>e=>crypto.getRandomValues(e),Le=e=>{(Le=Re())(e)},de={resolve:(...e)=>{for(var r="",t=!1,o=e.length-1;o>=-1&&!t;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"";r=a+"/"+r,t=x.isAbs(a)}return r=x.normalizeArray(r.split("/").filter(i=>!!i),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=de.resolve(e).slice(1),r=de.resolve(r).slice(1);function t(p){for(var F=0;F<p.length&&p[F]==="";F++);for(var C=p.length-1;C>=0&&p[C]==="";C--);return F>C?[]:p.slice(F,C-F+1)}for(var o=t(e.split("/")),a=t(r.split("/")),i=Math.min(o.length,a.length),s=i,u=0;u<i;u++)if(o[u]!==a[u]){s=u;break}for(var h=[],u=s;u<o.length;u++)h.push("..");return h=h.concat(a.slice(s)),h.join("/")}},me=[],ve=e=>{for(var r=0,t=0;t<e.length;++t){var o=e.charCodeAt(t);o<=127?r++:o<=2047?r+=2:o>=55296&&o<=57343?(r+=4,++t):r+=3}return r},Ze=(e,r,t,o)=>{if(!(o>0))return 0;for(var a=t,i=t+o-1,s=0;s<e.length;++s){var u=e.codePointAt(s);if(u<=127){if(t>=i)break;r[t++]=u}else if(u<=2047){if(t+1>=i)break;r[t++]=192|u>>6,r[t++]=128|u&63}else if(u<=65535){if(t+2>=i)break;r[t++]=224|u>>12,r[t++]=128|u>>6&63,r[t++]=128|u&63}else{if(t+3>=i)break;r[t++]=240|u>>18,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|u&63,s++}}return r[t]=0,t-a},fr=(e,r,t)=>{var o=ve(e)+1,a=new Array(o),i=Ze(e,a,0,a.length);return a.length=i,a},mt=()=>{if(!me.length){var e=null;if(!e)return null;me=fr(e)}return me.shift()},De={ttys:[],init(){},shutdown(){},register(e,r){De.ttys[e]={input:[],output:[],ops:r},n.registerDevice(e,De.stream_ops)},stream_ops:{open(e){var r=De.ttys[e.node.rdev];if(!r)throw new n.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,o,a){if(!e.tty||!e.tty.ops.get_char)throw new n.ErrnoError(60);for(var i=0,s=0;s<o;s++){var u;try{u=e.tty.ops.get_char(e.tty)}catch{throw new n.ErrnoError(29)}if(u===void 0&&i===0)throw new n.ErrnoError(6);if(u==null)break;i++,r[t+s]=u}return i&&(e.node.atime=Date.now()),i},write(e,r,t,o,a){if(!e.tty||!e.tty.ops.put_char)throw new n.ErrnoError(60);try{for(var i=0;i<o;i++)e.tty.ops.put_char(e.tty,r[t+i])}catch{throw new n.ErrnoError(29)}return o&&(e.node.mtime=e.node.ctime=Date.now()),i}},default_tty_ops:{get_char(e){return mt()},put_char(e,r){r===null||r===10?(R(ye(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){var r;((r=e.output)==null?void 0:r.length)>0&&(R(ye(e.output)),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,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(L(ye(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){var r;((r=e.output)==null?void 0:r.length)>0&&(L(ye(e.output)),e.output=[])}}},wt=(e,r)=>I.fill(0,e,e+r),jr=(e,r)=>Math.ceil(e/r)*r,Pr=e=>{e=jr(e,65536);var r=Ar(65536,e);return r&&wt(r,e),r},Y={ops_table:null,mount(e){return Y.createNode(null,"/",16895,0)},createNode(e,r,t,o){if(n.isBlkdev(t)||n.isFIFO(t))throw new n.ErrnoError(63);Y.ops_table||(Y.ops_table={dir:{node:{getattr:Y.node_ops.getattr,setattr:Y.node_ops.setattr,lookup:Y.node_ops.lookup,mknod:Y.node_ops.mknod,rename:Y.node_ops.rename,unlink:Y.node_ops.unlink,rmdir:Y.node_ops.rmdir,readdir:Y.node_ops.readdir,symlink:Y.node_ops.symlink},stream:{llseek:Y.stream_ops.llseek}},file:{node:{getattr:Y.node_ops.getattr,setattr:Y.node_ops.setattr},stream:{llseek:Y.stream_ops.llseek,read:Y.stream_ops.read,write:Y.stream_ops.write,mmap:Y.stream_ops.mmap,msync:Y.stream_ops.msync}},link:{node:{getattr:Y.node_ops.getattr,setattr:Y.node_ops.setattr,readlink:Y.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Y.node_ops.getattr,setattr:Y.node_ops.setattr},stream:n.chrdev_stream_ops}});var a=n.createNode(e,r,t,o);return n.isDir(a.mode)?(a.node_ops=Y.ops_table.dir.node,a.stream_ops=Y.ops_table.dir.stream,a.contents={}):n.isFile(a.mode)?(a.node_ops=Y.ops_table.file.node,a.stream_ops=Y.ops_table.file.stream,a.usedBytes=0,a.contents=null):n.isLink(a.mode)?(a.node_ops=Y.ops_table.link.node,a.stream_ops=Y.ops_table.link.stream):n.isChrdev(a.mode)&&(a.node_ops=Y.ops_table.chrdev.node,a.stream_ops=Y.ops_table.chrdev.stream),a.atime=a.mtime=a.ctime=Date.now(),e&&(e.contents[r]=a,e.atime=e.mtime=e.ctime=a.atime),a},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var o=1048576;r=Math.max(r,t*(t<o?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var a=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(a.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=n.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,n.isDir(e.mode)?r.size=4096:n.isFile(e.mode)?r.size=e.usedBytes:n.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(let t of["mode","atime","mtime","ctime"])r[t]!=null&&(e[t]=r[t]);r.size!==void 0&&Y.resizeFileStorage(e,r.size)},lookup(e,r){throw Y.doesNotExistError||(Y.doesNotExistError=new n.ErrnoError(44),Y.doesNotExistError.stack="<generic error, no stack>"),Y.doesNotExistError},mknod(e,r,t,o){return Y.createNode(e,r,t,o)},rename(e,r,t){var o;try{o=n.lookupNode(r,t)}catch{}if(o){if(n.isDir(e.mode))for(var a in o.contents)throw new n.ErrnoError(55);n.hashRemoveNode(o)}delete e.parent.contents[e.name],r.contents[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=n.lookupNode(e,r);for(var o in t.contents)throw new n.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,t){var o=Y.createNode(e,r,41471,0);return o.link=t,o},readlink(e){if(!n.isLink(e.mode))throw new n.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,o,a){var i=e.node.contents;if(a>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-a,o);if(s>8&&i.subarray)r.set(i.subarray(a,a+s),t);else for(var u=0;u<s;u++)r[t+u]=i[a+u];return s},write(e,r,t,o,a,i){if(r.buffer===D.buffer&&(i=!1),!o)return 0;var s=e.node;if(s.mtime=s.ctime=Date.now(),r.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=r.subarray(t,t+o),s.usedBytes=o,o;if(s.usedBytes===0&&a===0)return s.contents=r.slice(t,t+o),s.usedBytes=o,o;if(a+o<=s.usedBytes)return s.contents.set(r.subarray(t,t+o),a),o}if(Y.expandFileStorage(s,a+o),s.contents.subarray&&r.subarray)s.contents.set(r.subarray(t,t+o),a);else for(var u=0;u<o;u++)s.contents[a+u]=r[t+u];return s.usedBytes=Math.max(s.usedBytes,a+o),o},llseek(e,r,t){var o=r;if(t===1?o+=e.position:t===2&&n.isFile(e.node.mode)&&(o+=e.node.usedBytes),o<0)throw new n.ErrnoError(28);return o},mmap(e,r,t,o,a){if(!n.isFile(e.node.mode))throw new n.ErrnoError(43);var i,s,u=e.node.contents;if(!(a&2)&&u&&u.buffer===D.buffer)s=!1,i=u.byteOffset;else{if(s=!0,i=Pr(r),!i)throw new n.ErrnoError(48);u&&((t>0||t+r<u.length)&&(u.subarray?u=u.subarray(t,t+r):u=Array.prototype.slice.call(u,t,t+r)),D.set(u,i))}return{ptr:i,allocated:s}},msync(e,r,t,o,a){return Y.stream_ops.write(e,r,0,o,t,!1),0}}},gt=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},hr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},Ft=async e=>{var r=await w(e);return new Uint8Array(r)},Et=(...e)=>n.createDataFile(...e),Se=0,Ne=null,Mt=e=>{if(Se--,Se==0&&Ne){var r=Ne;Ne=null,r()}},Ct=e=>{Se++},Rt=[],Lt=async(e,r)=>{typeof Browser<"u"&&Browser.init();for(var t of Rt)if(t.canHandle(r))return t.handle(e,r);return e},xr=async(e,r,t,o,a,i,s,u)=>{var h=r?de.resolve(x.join2(e,r)):e;Ct();try{var p=t;typeof t=="string"&&(p=await Ft(t)),p=await Lt(p,h),u==null||u(),i||Et(e,r,p,o,a,s)}finally{Mt()}},Dt=(e,r,t,o,a,i,s,u,h,p)=>{xr(e,r,t,o,a,u,h,p).then(i).catch(s)},n={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,ErrnoError:class{constructor(e){he(this,"name","ErrnoError");this.errno=e}},FSStream:class{constructor(){he(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,r,t,o){he(this,"node_ops",{});he(this,"stream_ops",{});he(this,"readMode",365);he(this,"writeMode",146);he(this,"mounted",null);e||(e=this),this.parent=e,this.mount=e.mount,this.id=n.nextInode++,this.name=r,this.mode=t,this.rdev=o,this.atime=this.mtime=this.ctime=Date.now()}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,r={}){if(!e)throw new n.ErrnoError(44);r.follow_mount??(r.follow_mount=!0),x.isAbs(e)||(e=n.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var o=e.split("/").filter(p=>!!p),a=n.root,i="/",s=0;s<o.length;s++){var u=s===o.length-1;if(u&&r.parent)break;if(o[s]!=="."){if(o[s]===".."){if(i=x.dirname(i),n.isRoot(a)){e=i+"/"+o.slice(s+1).join("/"),t--;continue e}else a=a.parent;continue}i=x.join2(i,o[s]);try{a=n.lookupNode(a,o[s])}catch(p){if((p==null?void 0:p.errno)===44&&u&&r.noent_okay)return{path:i};throw p}if(n.isMountpoint(a)&&(!u||r.follow_mount)&&(a=a.mounted.root),n.isLink(a.mode)&&(!u||r.follow)){if(!a.node_ops.readlink)throw new n.ErrnoError(52);var h=a.node_ops.readlink(a);x.isAbs(h)||(h=x.dirname(i)+"/"+h),e=h+"/"+o.slice(s+1).join("/");continue e}}}return{path:i,node:a}}throw new n.ErrnoError(32)},getPath(e){for(var r;;){if(n.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,o=0;o<r.length;o++)t=(t<<5)-t+r.charCodeAt(o)|0;return(e+t>>>0)%n.nameTable.length},hashAddNode(e){var r=n.hashName(e.parent.id,e.name);e.name_next=n.nameTable[r],n.nameTable[r]=e},hashRemoveNode(e){var r=n.hashName(e.parent.id,e.name);if(n.nameTable[r]===e)n.nameTable[r]=e.name_next;else for(var t=n.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=n.mayLookup(e);if(t)throw new n.ErrnoError(t);for(var o=n.hashName(e.id,r),a=n.nameTable[o];a;a=a.name_next){var i=a.name;if(a.parent.id===e.id&&i===r)return a}return n.lookup(e,r)},createNode(e,r,t,o){var a=new n.FSNode(e,r,t,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 r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return n.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!n.isDir(e.mode))return 54;var r=n.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!n.isDir(e.mode))return 54;try{var t=n.lookupNode(e,r);return 20}catch{}return n.nodePermissions(e,"wx")},mayDelete(e,r,t){var o;try{o=n.lookupNode(e,r)}catch(i){return i.errno}var a=n.nodePermissions(e,"wx");if(a)return a;if(t){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,r){return e?n.isLink(e.mode)?32:n.isDir(e.mode)&&(n.flagsToPermissionString(r)!=="r"||r&576)?31:n.nodePermissions(e,n.flagsToPermissionString(r)):44},checkOpExists(e,r){if(!e)throw new n.ErrnoError(r);return e},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 r=n.getStream(e);if(!r)throw new n.ErrnoError(8);return r},getStream:e=>n.streams[e],createStream(e,r=-1){return e=Object.assign(new n.FSStream,e),r==-1&&(r=n.nextfd()),e.fd=r,n.streams[r]=e,e},closeStream(e){n.streams[e]=null},dupStream(e,r=-1){var o,a;var t=n.createStream(e,r);return(a=(o=t.stream_ops)==null?void 0:o.dup)==null||a.call(o,t),t},doSetAttr(e,r,t){var o=e==null?void 0:e.stream_ops.setattr,a=o?e:r;o??(o=r.node_ops.setattr),n.checkOpExists(o,63),o(a,t)},chrdev_stream_ops:{open(e){var t,o;var r=n.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,(o=(t=e.stream_ops).open)==null||o.call(t,e)},llseek(){throw new n.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){n.devices[e]={stream_ops:r}},getDevice:e=>n.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var o=t.pop();r.push(o),t.push(...o.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),n.syncFSRequests++,n.syncFSRequests>1&&L(`warning: ${n.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=n.getMounts(n.root.mount),o=0;function a(u){return n.syncFSRequests--,r(u)}function i(u){if(u)return i.errored?void 0:(i.errored=!0,a(u));++o>=t.length&&a(null)}for(var s of t)s.type.syncfs?s.type.syncfs(s,e,i):i(null)},mount(e,r,t){var o=t==="/",a=!t,i;if(o&&n.root)throw new n.ErrnoError(10);if(!o&&!a){var s=n.lookupPath(t,{follow_mount:!1});if(t=s.path,i=s.node,n.isMountpoint(i))throw new n.ErrnoError(10);if(!n.isDir(i.mode))throw new n.ErrnoError(54)}var u={type:e,opts:r,mountpoint:t,mounts:[]},h=e.mount(u);return h.mount=u,u.root=h,o?n.root=h:i&&(i.mounted=u,i.mount&&i.mount.mounts.push(u)),h},unmount(e){var r=n.lookupPath(e,{follow_mount:!1});if(!n.isMountpoint(r.node))throw new n.ErrnoError(28);var t=r.node,o=t.mounted,a=n.getMounts(o);for(var[i,s]of Object.entries(n.nameTable))for(;s;){var u=s.name_next;a.includes(s.mount)&&n.destroyNode(s),s=u}t.mounted=null;var h=t.mount.mounts.indexOf(o);t.mount.mounts.splice(h,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var o=n.lookupPath(e,{parent:!0}),a=o.node,i=x.basename(e);if(!i)throw new n.ErrnoError(28);if(i==="."||i==="..")throw new n.ErrnoError(20);var s=n.mayCreate(a,i);if(s)throw new n.ErrnoError(s);if(!a.node_ops.mknod)throw new n.ErrnoError(63);return a.node_ops.mknod(a,i,r,t)},statfs(e){return n.statfsNode(n.lookupPath(e,{follow:!0}).node)},statfsStream(e){return n.statfsNode(e.node)},statfsNode(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:n.nextInode,ffree:n.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(r,e.node_ops.statfs(e.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,n.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,n.mknod(e,r,0)},mkdirTree(e,r){var t=e.split("/"),o="";for(var a of t)if(a){(o||x.isAbs(e))&&(o+="/"),o+=a;try{n.mkdir(o,r)}catch(i){if(i.errno!=20)throw i}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,n.mknod(e,r,t)},symlink(e,r){if(!de.resolve(e))throw new n.ErrnoError(44);var t=n.lookupPath(r,{parent:!0}),o=t.node;if(!o)throw new n.ErrnoError(44);var a=x.basename(r),i=n.mayCreate(o,a);if(i)throw new n.ErrnoError(i);if(!o.node_ops.symlink)throw new n.ErrnoError(63);return o.node_ops.symlink(o,a,e)},rename(e,r){var t=x.dirname(e),o=x.dirname(r),a=x.basename(e),i=x.basename(r),s,u,h;if(s=n.lookupPath(e,{parent:!0}),u=s.node,s=n.lookupPath(r,{parent:!0}),h=s.node,!u||!h)throw new n.ErrnoError(44);if(u.mount!==h.mount)throw new n.ErrnoError(75);var p=n.lookupNode(u,a),F=de.relative(e,o);if(F.charAt(0)!==".")throw new n.ErrnoError(28);if(F=de.relative(r,t),F.charAt(0)!==".")throw new n.ErrnoError(55);var C;try{C=n.lookupNode(h,i)}catch{}if(p!==C){var M=n.isDir(p.mode),y=n.mayDelete(u,a,M);if(y)throw new n.ErrnoError(y);if(y=C?n.mayDelete(h,i,M):n.mayCreate(h,i),y)throw new n.ErrnoError(y);if(!u.node_ops.rename)throw new n.ErrnoError(63);if(n.isMountpoint(p)||C&&n.isMountpoint(C))throw new n.ErrnoError(10);if(h!==u&&(y=n.nodePermissions(u,"w"),y))throw new n.ErrnoError(y);n.hashRemoveNode(p);try{u.node_ops.rename(p,h,i),p.parent=h}catch(j){throw j}finally{n.hashAddNode(p)}}},rmdir(e){var r=n.lookupPath(e,{parent:!0}),t=r.node,o=x.basename(e),a=n.lookupNode(t,o),i=n.mayDelete(t,o,!0);if(i)throw new n.ErrnoError(i);if(!t.node_ops.rmdir)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);t.node_ops.rmdir(t,o),n.destroyNode(a)},readdir(e){var r=n.lookupPath(e,{follow:!0}),t=r.node,o=n.checkOpExists(t.node_ops.readdir,54);return o(t)},unlink(e){var r=n.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new n.ErrnoError(44);var o=x.basename(e),a=n.lookupNode(t,o),i=n.mayDelete(t,o,!1);if(i)throw new n.ErrnoError(i);if(!t.node_ops.unlink)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);t.node_ops.unlink(t,o),n.destroyNode(a)},readlink(e){var r=n.lookupPath(e),t=r.node;if(!t)throw new n.ErrnoError(44);if(!t.node_ops.readlink)throw new n.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,r){var t=n.lookupPath(e,{follow:!r}),o=t.node,a=n.checkOpExists(o.node_ops.getattr,63);return a(o)},fstat(e){var r=n.getStreamChecked(e),t=r.node,o=r.stream_ops.getattr,a=o?r:t;return o??(o=t.node_ops.getattr),n.checkOpExists(o,63),o(a)},lstat(e){return n.stat(e,!0)},doChmod(e,r,t,o){n.doSetAttr(e,r,{mode:t&4095|r.mode&-4096,ctime:Date.now(),dontFollow:o})},chmod(e,r,t){var o;if(typeof e=="string"){var a=n.lookupPath(e,{follow:!t});o=a.node}else o=e;n.doChmod(null,o,r,t)},lchmod(e,r){n.chmod(e,r,!0)},fchmod(e,r){var t=n.getStreamChecked(e);n.doChmod(t,t.node,r,!1)},doChown(e,r,t){n.doSetAttr(e,r,{timestamp:Date.now(),dontFollow:t})},chown(e,r,t,o){var a;if(typeof e=="string"){var i=n.lookupPath(e,{follow:!o});a=i.node}else a=e;n.doChown(null,a,o)},lchown(e,r,t){n.chown(e,r,t,!0)},fchown(e,r,t){var o=n.getStreamChecked(e);n.doChown(o,o.node,!1)},doTruncate(e,r,t){if(n.isDir(r.mode))throw new n.ErrnoError(31);if(!n.isFile(r.mode))throw new n.ErrnoError(28);var o=n.nodePermissions(r,"w");if(o)throw new n.ErrnoError(o);n.doSetAttr(e,r,{size:t,timestamp:Date.now()})},truncate(e,r){if(r<0)throw new n.ErrnoError(28);var t;if(typeof e=="string"){var o=n.lookupPath(e,{follow:!0});t=o.node}else t=e;n.doTruncate(null,t,r)},ftruncate(e,r){var t=n.getStreamChecked(e);if(r<0||(t.flags&2097155)===0)throw new n.ErrnoError(28);n.doTruncate(t,t.node,r)},utime(e,r,t){var o=n.lookupPath(e,{follow:!0}),a=o.node,i=n.checkOpExists(a.node_ops.setattr,63);i(a,{atime:r,mtime:t})},open(e,r,t=438){if(e==="")throw new n.ErrnoError(44);r=typeof r=="string"?gt(r):r,r&64?t=t&4095|32768:t=0;var o,a;if(typeof e=="object")o=e;else{a=e.endsWith("/");var i=n.lookupPath(e,{follow:!(r&131072),noent_okay:!0});o=i.node,e=i.path}var s=!1;if(r&64)if(o){if(r&128)throw new n.ErrnoError(20)}else{if(a)throw new n.ErrnoError(31);o=n.mknod(e,t|511,0),s=!0}if(!o)throw new n.ErrnoError(44);if(n.isChrdev(o.mode)&&(r&=-513),r&65536&&!n.isDir(o.mode))throw new n.ErrnoError(54);if(!s){var u=n.mayOpen(o,r);if(u)throw new n.ErrnoError(u)}r&512&&!s&&n.truncate(o,0),r&=-131713;var h=n.createStream({node:o,path:n.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return h.stream_ops.open&&h.stream_ops.open(h),s&&n.chmod(o,t&511),h},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(r){throw r}finally{n.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(n.isClosed(e))throw new n.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new n.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new n.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,o,a){if(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 i=typeof a<"u";if(!i)a=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var s=e.stream_ops.read(e,r,t,o,a);return i||(e.position+=s),s},write(e,r,t,o,a,i){if(o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(e))throw new n.ErrnoError(8);if((e.flags&2097155)===0)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 s=typeof a<"u";if(!s)a=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var u=e.stream_ops.write(e,r,t,o,a,i);return s||(e.position+=u),u},mmap(e,r,t,o,a){if((o&2)!==0&&(a&2)===0&&(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);if(!r)throw new n.ErrnoError(28);return e.stream_ops.mmap(e,r,t,o,a)},msync(e,r,t,o,a){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,o,a):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new n.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary"&&O(`Invalid encoding type "${r.encoding}"`);var t=n.open(e,r.flags),o=n.stat(e),a=o.size,i=new Uint8Array(a);return n.read(t,i,0,a,0),r.encoding==="utf8"&&(i=ye(i)),n.close(t),i},writeFile(e,r,t={}){t.flags=t.flags||577;var o=n.open(e,t.flags,t.mode);typeof r=="string"&&(r=new Uint8Array(fr(r))),ArrayBuffer.isView(r)?n.write(o,r,0,r.byteLength,void 0,t.canOwn):O("Unsupported data type"),n.close(o)},cwd:()=>n.currentPath,chdir(e){var r=n.lookupPath(e,{follow:!0});if(r.node===null)throw new n.ErrnoError(44);if(!n.isDir(r.node.mode))throw new n.ErrnoError(54);var t=n.nodePermissions(r.node,"x");if(t)throw new n.ErrnoError(t);n.currentPath=r.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,i,s,u)=>s,llseek:()=>0}),n.mkdev("/dev/null",n.makedev(1,3)),De.register(n.makedev(5,0),De.default_tty_ops),De.register(n.makedev(6,0),De.default_tty1_ops),n.mkdev("/dev/tty",n.makedev(5,0)),n.mkdev("/dev/tty1",n.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(Le(e),r=e.byteLength),e[--r]);n.createDevice("/dev","random",t),n.createDevice("/dev","urandom",t),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 r=n.createNode(e,"fd",16895,73);return r.stream_ops={llseek:Y.stream_ops.llseek},r.node_ops={lookup(t,o){var a=+o,i=n.getStreamChecked(a),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path},id:a+1};return s.parent=s,s},readdir(){return Array.from(n.streams.entries()).filter(([t,o])=>o).map(([t,o])=>t.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?n.createDevice("/dev","stdin",e):n.symlink("/dev/tty","/dev/stdin"),r?n.createDevice("/dev","stdout",null,r):n.symlink("/dev/tty","/dev/stdout"),t?n.createDevice("/dev","stderr",null,t):n.symlink("/dev/tty1","/dev/stderr"),n.open("/dev/stdin",0),n.open("/dev/stdout",1),n.open("/dev/stderr",1)},staticInit(){n.nameTable=new Array(4096),n.mount(Y,{},"/"),n.createDefaultDirectories(),n.createDefaultDevices(),n.createSpecialDirectories(),n.filesystems={MEMFS:Y}},init(e,r,t){n.initialized=!0,n.createStandardStreams(e,r,t)},quit(){n.initialized=!1;for(var e of n.streams)e&&n.close(e)},findObject(e,r){var t=n.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=n.lookupPath(e,{follow:!r});e=t.path}catch{}var o={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=n.lookupPath(e,{parent:!0});o.parentExists=!0,o.parentPath=t.path,o.parentObject=t.node,o.name=x.basename(e),t=n.lookupPath(e,{follow:!r}),o.exists=!0,o.path=t.path,o.object=t.node,o.name=t.node.name,o.isRoot=t.path==="/"}catch(a){o.error=a.errno}return o},createPath(e,r,t,o){e=typeof e=="string"?e:n.getPath(e);for(var a=r.split("/").reverse();a.length;){var i=a.pop();if(i){var s=x.join2(e,i);try{n.mkdir(s)}catch(u){if(u.errno!=20)throw u}e=s}}return s},createFile(e,r,t,o,a){var i=x.join2(typeof e=="string"?e:n.getPath(e),r),s=hr(o,a);return n.create(i,s)},createDataFile(e,r,t,o,a,i){var s=r;e&&(e=typeof e=="string"?e:n.getPath(e),s=r?x.join2(e,r):e);var u=hr(o,a),h=n.create(s,u);if(t){if(typeof t=="string"){for(var p=new Array(t.length),F=0,C=t.length;F<C;++F)p[F]=t.charCodeAt(F);t=p}n.chmod(h,u|146);var M=n.open(h,577);n.write(M,t,0,t.length,0,i),n.close(M),n.chmod(h,u)}},createDevice(e,r,t,o){var u;var a=x.join2(typeof e=="string"?e:n.getPath(e),r),i=hr(!!t,!!o);(u=n.createDevice).major??(u.major=64);var s=n.makedev(n.createDevice.major++,0);return n.registerDevice(s,{open(h){h.seekable=!1},close(h){var p;(p=o==null?void 0:o.buffer)!=null&&p.length&&o(10)},read(h,p,F,C,M){for(var y=0,j=0;j<C;j++){var G;try{G=t()}catch{throw new n.ErrnoError(29)}if(G===void 0&&y===0)throw new n.ErrnoError(6);if(G==null)break;y++,p[F+j]=G}return y&&(h.node.atime=Date.now()),y},write(h,p,F,C,M){for(var y=0;y<C;y++)try{o(p[F+y])}catch{throw new n.ErrnoError(29)}return C&&(h.node.mtime=h.node.ctime=Date.now()),y}}),n.mkdev(a,i,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)O("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{e.contents=E(e.url)}catch{throw new n.ErrnoError(29)}},createLazyFile(e,r,t,o,a){class i{constructor(){he(this,"lengthKnown",!1);he(this,"chunks",[])}get(M){if(!(M>this.length-1||M<0)){var y=M%this.chunkSize,j=M/this.chunkSize|0;return this.getter(j)[y]}}setDataGetter(M){this.getter=M}cacheLength(){var M=new XMLHttpRequest;M.open("HEAD",t,!1),M.send(null),M.status>=200&&M.status<300||M.status===304||O("Couldn't load "+t+". Status: "+M.status);var y=Number(M.getResponseHeader("Content-length")),j,G=(j=M.getResponseHeader("Accept-Ranges"))&&j==="bytes",_=(j=M.getResponseHeader("Content-Encoding"))&&j==="gzip",N=1024*1024;G||(N=y);var te=(fe,Ee)=>{fe>Ee&&O("invalid range ("+fe+", "+Ee+") or no bytes requested!"),Ee>y-1&&O("only "+y+" bytes available! programmer error!");var Q=new XMLHttpRequest;return Q.open("GET",t,!1),y!==N&&Q.setRequestHeader("Range","bytes="+fe+"-"+Ee),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||O("Couldn't load "+t+". Status: "+Q.status),Q.response!==void 0?new Uint8Array(Q.response||[]):fr(Q.responseText||"")},A=this;A.setDataGetter(fe=>{var Ee=fe*N,Q=(fe+1)*N-1;return Q=Math.min(Q,y-1),typeof A.chunks[fe]>"u"&&(A.chunks[fe]=te(Ee,Q)),typeof A.chunks[fe]>"u"&&O("doXHR failed!"),A.chunks[fe]}),(_||!y)&&(N=y=1,y=this.getter(0).length,N=y,R("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=y,this._chunkSize=N,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){O("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var s=new i,u={isDevice:!1,contents:s}}else var u={isDevice:!1,url:t};var h=n.createFile(e,r,u,o,a);u.contents?h.contents=u.contents:u.url&&(h.contents=null,h.url=u.url),Object.defineProperties(h,{usedBytes:{get:function(){return this.contents.length}}});var p={};for(let[C,M]of Object.entries(h.stream_ops))p[C]=(...y)=>(n.forceLoadFile(h),M(...y));function F(C,M,y,j,G){var _=C.node.contents;if(G>=_.length)return 0;var N=Math.min(_.length-G,j);if(_.slice)for(var te=0;te<N;te++)M[y+te]=_[G+te];else for(var te=0;te<N;te++)M[y+te]=_.get(G+te);return N}return p.read=(C,M,y,j,G)=>(n.forceLoadFile(h),F(C,M,y,j,G)),p.mmap=(C,M,y,j,G)=>{n.forceLoadFile(h);var _=Pr(M);if(!_)throw new n.ErrnoError(48);return F(C,D,_,M,y),{ptr:_,allocated:!0}},h.stream_ops=p,h}},k={calculateAt(e,r,t){if(x.isAbs(r))return r;var o;if(e===-100)o=n.cwd();else{var a=k.getStreamFromFD(e);o=a.path}if(r.length==0){if(!t)throw new n.ErrnoError(44);return o}return o+"/"+r},writeStat(e,r){b[e>>2]=r.dev,b[e+4>>2]=r.mode,b[e+8>>2]=r.nlink,b[e+12>>2]=r.uid,b[e+16>>2]=r.gid,b[e+20>>2]=r.rdev,B=[r.size>>>0,(m=r.size,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+24>>2]=B[0],g[e+28>>2]=B[1],g[e+32>>2]=4096,g[e+36>>2]=r.blocks;var t=r.atime.getTime(),o=r.mtime.getTime(),a=r.ctime.getTime();return B=[Math.floor(t/1e3)>>>0,(m=Math.floor(t/1e3),+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+40>>2]=B[0],g[e+44>>2]=B[1],b[e+48>>2]=t%1e3*1e3*1e3,B=[Math.floor(o/1e3)>>>0,(m=Math.floor(o/1e3),+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+56>>2]=B[0],g[e+60>>2]=B[1],b[e+64>>2]=o%1e3*1e3*1e3,B=[Math.floor(a/1e3)>>>0,(m=Math.floor(a/1e3),+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+72>>2]=B[0],g[e+76>>2]=B[1],b[e+80>>2]=a%1e3*1e3*1e3,B=[r.ino>>>0,(m=r.ino,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+88>>2]=B[0],g[e+92>>2]=B[1],0},writeStatFs(e,r){b[e+4>>2]=r.bsize,b[e+60>>2]=r.bsize,B=[r.blocks>>>0,(m=r.blocks,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+8>>2]=B[0],g[e+12>>2]=B[1],B=[r.bfree>>>0,(m=r.bfree,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+16>>2]=B[0],g[e+20>>2]=B[1],B=[r.bavail>>>0,(m=r.bavail,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+24>>2]=B[0],g[e+28>>2]=B[1],B=[r.files>>>0,(m=r.files,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+32>>2]=B[0],g[e+36>>2]=B[1],B=[r.ffree>>>0,(m=r.ffree,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+40>>2]=B[0],g[e+44>>2]=B[1],b[e+48>>2]=r.fsid,b[e+64>>2]=r.flags,b[e+56>>2]=r.namelen},doMsync(e,r,t,o,a){if(!n.isFile(r.node.mode))throw new n.ErrnoError(43);if(o&2)return 0;var i=I.slice(e,e+t);n.msync(r,i,a,t,o)},getStreamFromFD(e){var r=n.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=se(e);return r}};function bt(e,r,t,o){try{if(r=k.getStr(r),r=k.calculateAt(e,r),t&-8)return-28;var a=n.lookupPath(r,{follow:!0}),i=a.node;if(!i)return-44;var s="";return t&4&&(s+="r"),t&2&&(s+="w"),t&1&&(s+="x"),s&&n.nodePermissions(i,s)?-2:0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}var Je=()=>{var e=g[+k.varargs>>2];return k.varargs+=4,e},je=Je;function Yt(e,r,t){k.varargs=t;try{var o=k.getStreamFromFD(e);switch(r){case 0:{var a=Je();if(a<0)return-28;for(;n.streams[a];)a++;var i;return i=n.dupStream(o,a),i.fd}case 1:case 2:return 0;case 3:return o.flags;case 4:{var a=Je();return o.flags|=a,0}case 12:{var a=je(),s=0;return ee[a+s>>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 Ut(e,r){try{return k.writeStat(r,n.fstat(e))}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function Bt(e,r,t){k.varargs=t;try{var o=k.getStreamFromFD(e);switch(r){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),i=je();g[i>>2]=a.c_iflag||0,g[i+4>>2]=a.c_oflag||0,g[i+8>>2]=a.c_cflag||0,g[i+12>>2]=a.c_lflag||0;for(var s=0;s<32;s++)D[i+s+17]=a.c_cc[s]||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 i=je(),u=g[i>>2],h=g[i+4>>2],p=g[i+8>>2],F=g[i+12>>2],C=[],s=0;s<32;s++)C.push(D[i+s+17]);return o.tty.ops.ioctl_tcsets(o.tty,r,{c_iflag:u,c_oflag:h,c_cflag:p,c_lflag:F,c_cc:C})}return 0}case 21519:{if(!o.tty)return-59;var i=je();return g[i>>2]=0,0}case 21520:return o.tty?-28:-59;case 21537:case 21531:{var i=je();return n.ioctl(o,r,i)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var M=o.tty.ops.ioctl_tiocgwinsz(o.tty),i=je();ee[i>>1]=M[0],ee[i+2>>1]=M[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(y){if(typeof n>"u"||y.name!=="ErrnoError")throw y;return-y.errno}}function jt(e,r,t,o){k.varargs=o;try{r=k.getStr(r),r=k.calculateAt(e,r);var a=o?Je():0;return n.open(r,t,a).fd}catch(i){if(typeof n>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}var Me=(e,r,t)=>Ze(e,I,r,t);function Pt(e,r,t,o){try{if(r=k.getStr(r),r=k.calculateAt(e,r),o<=0)return-28;var a=n.readlink(r),i=Math.min(o,ve(a)),s=D[t+i];return Me(a,t,o+1),D[t+i]=s,i}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function xt(e){try{return e=k.getStr(e),n.rmdir(e),0}catch(r){if(typeof n>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function Xt(e,r,t){try{if(r=k.getStr(r),r=k.calculateAt(e,r),!t)n.unlink(r);else if(t===512)n.rmdir(r);else return-28;return 0}catch(o){if(typeof n>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var Xr=()=>ct,dr=e=>{var r=e.getArg(Xr(),0);return st(r)},It=()=>nt(),$t=e=>tt(e),Ir=e=>ot(e),Gt=e=>{var r=It(),t=Ir(4),o=Ir(4);ut(e,t,o);var a=b[t>>2],i=b[o>>2],s=se(a);pe(a);var u;return i&&(u=se(i),pe(i)),$t(r),[s,u]},$r=e=>{var r=dr(e);return Gt(r)},zt=e=>{var r=new WebAssembly.Exception(Xr(),[e],{traceStack:!0});throw r.message=$r(r),r},St=()=>O(""),Nt=(e,r,t,o,a)=>{},ue=e=>{for(var r="";;){var t=I[e++];if(!t)return r;r+=String.fromCharCode(t)}},Pe={},xe={},Ae={},Oe=class extends Error{constructor(e){super(e),this.name="BindingError"}},$=e=>{throw new Oe(e)};function Ot(e,r,t={}){var o=r.name;if(e||$(`type "${o}" must have a positive integer typeid pointer`),xe.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;$(`Cannot register type '${o}' twice`)}if(xe[e]=r,delete Ae[e],Pe.hasOwnProperty(e)){var a=Pe[e];delete Pe[e],a.forEach(i=>i())}}function we(e,r,t={}){return Ot(e,r,t)}var _t=(e,r,t,o)=>{r=ue(r),we(e,{name:r,fromWireType:function(a){return!!a},toWireType:function(a,i){return i?t:o},readValueFromPointer:function(a){return this.fromWireType(I[a])},destructorFunction:null})},Vt=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),vr=e=>{function r(t){return t.$$.ptrType.registeredClass.name}$(r(e)+" instance already deleted")},pr=!1,Gr=e=>{},Ht=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},zr=e=>{e.count.value-=1;var r=e.count.value===0;r&&Ht(e)},_e=e=>globalThis.FinalizationRegistry?(pr=new FinalizationRegistry(r=>{zr(r.$$)}),_e=r=>{var t=r.$$,o=!!t.smartPtr;if(o){var a={$$:t};pr.register(r,a,r)}return r},Gr=r=>pr.unregister(r),_e(e)):(_e=r=>r,e),kt=()=>{let e=er.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof er)||!(t instanceof er))return!1;var o=this.$$.ptrType.registeredClass,a=this.$$.ptr;t.$$=t.$$;for(var i=t.$$.ptrType.registeredClass,s=t.$$.ptr;o.baseClass;)a=o.upcast(a),o=o.baseClass;for(;i.baseClass;)s=i.upcast(s),i=i.baseClass;return o===i&&a===s},clone(){if(this.$$.ptr||vr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=_e(Object.create(Object.getPrototypeOf(this),{$$:{value:Vt(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||vr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$("Object already scheduled for deletion"),Gr(this),zr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||vr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;r&&(e[r]=e.delete)};function er(){}var Sr=(e,r)=>Object.defineProperty(r,"name",{value:e}),Nr={},yr=(e,r,t)=>{if(e[r].overloadTable===void 0){var o=e[r];e[r]=function(...a){return e[r].overloadTable.hasOwnProperty(a.length)||$(`Function '${t}' called with an invalid number of arguments (${a.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[a.length].apply(this,a)},e[r].overloadTable=[],e[r].overloadTable[o.argCount]=o}},Wt=(e,r,t)=>{f.hasOwnProperty(e)?($(`Cannot register public name '${e}' twice`),yr(f,e,e),f[e].overloadTable.hasOwnProperty(t)&&$(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),f[e].overloadTable[t]=r):(f[e]=r,f[e].argCount=t)},Kt=48,Tt=57,qt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Kt&&r<=Tt?`_${e}`:e};function Qt(e,r,t,o,a,i,s,u){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=o,this.baseClass=a,this.getActualType=i,this.upcast=s,this.downcast=u,this.pureVirtualFunctions=[]}var rr=(e,r,t)=>{for(;r!==t;)r.upcast||$(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e},mr=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e};function Zt(e,r){if(r===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;r.$$||$(`Cannot pass "${mr(r)}" as a ${this.name}`),r.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,o=rr(r.$$.ptr,t,this.registeredClass);return o}function Jt(e,r){var t;if(r===null)return this.isReference&&$(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&$(`Cannot pass "${mr(r)}" as a ${this.name}`),r.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&$(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var o=r.$$.ptrType.registeredClass;if(t=rr(r.$$.ptr,o,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&$("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:$(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var a=r.clone();t=this.rawShare(t,Fr.toHandle(()=>a.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:$("Unsupported sharing policy")}return t}function At(e,r){if(r===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;r.$$||$(`Cannot pass "${mr(r)}" as a ${this.name}`),r.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&$(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,o=rr(r.$$.ptr,t,this.registeredClass);return o}function tr(e){return this.fromWireType(b[e>>2])}var Or=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var o=Or(e,r,t.baseClass);return o===null?null:t.downcast(o)},eo={},ro=(e,r)=>{for(r===void 0&&$("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},to=(e,r)=>(r=ro(e,r),eo[r]),oo=class extends Error{constructor(e){super(e),this.name="InternalError"}},or=e=>{throw new oo(e)},nr=(e,r)=>{(!r.ptrType||!r.ptr)&&or("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,o=!!r.smartPtr;return t!==o&&or("Both smartPtrType and smartPtr must be specified"),r.count={value:1},_e(Object.create(e,{$$:{value:r,writable:!0}}))};function no(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=to(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var o=t.clone();return this.destructor(e),o}function a(){return this.isSmartPointer?nr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):nr(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i=this.registeredClass.getActualType(r),s=Nr[i];if(!s)return a.call(this);var u;this.isConst?u=s.constPointerType:u=s.pointerType;var h=Or(r,this.registeredClass,u.registeredClass);return h===null?a.call(this):this.isSmartPointer?nr(u.registeredClass.instancePrototype,{ptrType:u,ptr:h,smartPtrType:this,smartPtr:e}):nr(u.registeredClass.instancePrototype,{ptrType:u,ptr:h})}var ao=()=>{Object.assign(ar.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},readValueFromPointer:tr,fromWireType:no})};function ar(e,r,t,o,a,i,s,u,h,p,F){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=o,this.isSmartPointer=a,this.pointeeType=i,this.sharingPolicy=s,this.rawGetPointee=u,this.rawConstructor=h,this.rawShare=p,this.rawDestructor=F,!a&&r.baseClass===void 0?o?(this.toWireType=Zt,this.destructorFunction=null):(this.toWireType=At,this.destructorFunction=null):this.toWireType=Jt}var io=(e,r,t)=>{f.hasOwnProperty(e)||or("Replacing nonexistent public symbol"),f[e].overloadTable!==void 0&&t!==void 0?f[e].overloadTable[t]=r:(f[e]=r,f[e].argCount=t)},Ce={},so=(e,r,t)=>{e=e.replace(/p/g,"i");var o=Ce[e];return o(r,...t)},_r=e=>lt.get(e),uo=(e,r,t=[],o=!1)=>{if(e.includes("j"))return so(e,r,t);var a=_r(r),i=a(...t);return i},co=(e,r,t=!1)=>(...o)=>uo(e,r,o,t),ge=(e,r,t=!1)=>{e=ue(e);function o(){if(e.includes("j"))return co(e,r);var i=_r(r);return i}var a=o();return typeof a!="function"&&$(`unknown function pointer with signature ${e}: ${r}`),a};class lo extends Error{}var fo=e=>{var r=Jr(e),t=ue(r);return pe(r),t},Xe=(e,r)=>{var t=[],o={};function a(i){if(!o[i]&&!xe[i]){if(Ae[i]){Ae[i].forEach(a);return}t.push(i),o[i]=!0}}throw r.forEach(a),new lo(`${e}: `+t.map(fo).join([", "]))},Fe=(e,r,t)=>{e.forEach(u=>Ae[u]=r);function o(u){var h=t(u);h.length!==e.length&&or("Mismatched type converter count");for(var p=0;p<e.length;++p)we(e[p],h[p])}var a=new Array(r.length),i=[],s=0;for(let[u,h]of r.entries())xe.hasOwnProperty(h)?a[u]=xe[h]:(i.push(h),Pe.hasOwnProperty(h)||(Pe[h]=[]),Pe[h].push(()=>{a[u]=xe[h],++s,s===i.length&&o(a)}));i.length===0&&o(a)},ho=(e,r,t,o,a,i,s,u,h,p,F,C,M)=>{F=ue(F),i=ge(a,i),u&&(u=ge(s,u)),p&&(p=ge(h,p)),M=ge(C,M);var y=qt(F);Wt(y,function(){Xe(`Cannot construct ${F} due to unbound types`,[o])}),Fe([e,r,t],o?[o]:[],j=>{var ft;j=j[0];var G,_;o?(G=j.registeredClass,_=G.instancePrototype):_=er.prototype;var N=Sr(F,function(...Lr){if(Object.getPrototypeOf(this)!==te)throw new Oe(`Use 'new' to construct ${F}`);if(A.constructor_body===void 0)throw new Oe(`${F} has no accessible constructor`);var ht=A.constructor_body[Lr.length];if(ht===void 0)throw new Oe(`Tried to invoke ctor of ${F} with invalid number of parameters (${Lr.length}) - expected (${Object.keys(A.constructor_body).toString()}) parameters instead!`);return ht.apply(this,Lr)}),te=Object.create(_,{constructor:{value:N}});N.prototype=te;var A=new Qt(F,N,te,M,G,i,u,p);A.baseClass&&((ft=A.baseClass).__derivedClasses??(ft.__derivedClasses=[]),A.baseClass.__derivedClasses.push(A));var fe=new ar(F,A,!0,!1,!1),Ee=new ar(F+"*",A,!1,!1,!1),Q=new ar(F+" const*",A,!1,!0,!1);return Nr[e]={pointerType:Ee,constPointerType:Q},io(y,N),[fe,Ee,Q]})},Vr=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function Hr(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function vo(e,r,t,o){var a=Hr(e),i=e.length-2,s=[],u=["fn"];r&&u.push("thisWired");for(var h=0;h<i;++h)s.push(`arg${h}`),u.push(`arg${h}Wired`);s=s.join(","),u=u.join(",");var p=`return function (${s}) {
|
|
1
|
+
"use strict";var gn=Object.defineProperty;var Fn=(c,l,f)=>l in c?gn(c,l,{enumerable:!0,configurable:!0,writable:!0,value:f}):c[l]=f;var he=(c,l,f)=>Fn(c,typeof l!="symbol"?l+"":l,f);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const En=require("linkedom"),We=require("./render-aoKrPS96.js");var Mn=ArrayBuffer,q=Uint8Array,cr=Uint16Array,Cn=Int16Array,lr=Int32Array,Dr=function(c,l,f){if(q.prototype.slice)return q.prototype.slice.call(c,l,f);(l==null||l<0)&&(l=0),(f==null||f>c.length)&&(f=c.length);var d=new q(f-l);return d.set(c.subarray(l,f)),d},Te=function(c,l,f,d){if(q.prototype.fill)return q.prototype.fill.call(c,l,f,d);for((f==null||f<0)&&(f=0),(d==null||d>c.length)&&(d=c.length);f<d;++f)c[f]=l;return c},Rn=function(c,l,f,d){if(q.prototype.copyWithin)return q.prototype.copyWithin.call(c,l,f,d);for((f==null||f<0)&&(f=0),(d==null||d>c.length)&&(d=c.length);f<d;)c[l++]=c[f++]},Ln=["invalid zstd data","window size too large (>2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],Z=function(c,l,f){var d=new Error(l||Ln[c]);if(d.code=c,Error.captureStackTrace&&Error.captureStackTrace(d,Z),!f)throw d;return d},dt=function(c,l,f){for(var d=0,v=0;d<f;++d)v|=c[l++]<<(d<<3);return v},Dn=function(c,l){return(c[l]|c[l+1]<<8|c[l+2]<<16|c[l+3]<<24)>>>0},bn=function(c,l){var f=c[0]|c[1]<<8|c[2]<<16;if(f==3126568&&c[3]==253){var d=c[4],v=d>>5&1,w=d>>2&1,E=d&3,R=d>>6;d&8&&Z(0);var L=6-v,X=E==3?4:E,K=dt(c,L,X);L+=X;var z=R?1<<R:v,V=dt(c,L,z)+(R==1&&256),H=V;if(!v){var J=1<<10+(c[5]>>3);H=J+(J>>3)*(c[5]&7)}H>2145386496&&Z(1);var D=new q((l==1?V||H:l?0:H)+12);return D[0]=1,D[4]=4,D[8]=8,{b:L+z,y:0,l:0,d:K,w:l&&l!=1?l:D.subarray(12),e:H,o:new lr(D.buffer,0,3),u:V,c:w,m:Math.min(131072,H)}}else if((f>>4|c[3]<<20)==25481893)return Dn(c,4)+8;Z(0)},be=function(c){for(var l=0;1<<l<=c;++l);return l-1},qe=function(c,l,f){var d=(l<<3)+4,v=(c[l]&15)+5;v>f&&Z(3);for(var w=1<<v,E=w,R=-1,L=-1,X=-1,K=w,z=new Mn(512+(w<<2)),V=new Cn(z,0,256),H=new cr(z,0,256),J=new cr(z,512,w),D=512+(w<<1),I=new q(z,D,w),ee=new q(z,D+w);R<255&&E>0;){var W=be(E+1),g=d>>3,b=(1<<W+1)-1,T=(c[g]|c[g+1]<<8|c[g+2]<<16)>>(d&7)&b,U=(1<<W)-1,re=b-E-1,ne=T&U;if(ne<re?(d+=W,T=ne):(d+=W+1,T>U&&(T-=re)),V[++R]=--T,T==-1?(E+=T,I[--K]=R):E-=T,!T)do{var ce=d>>3;L=(c[ce]|c[ce+1]<<8)>>(d&7)&3,d+=2,R+=L}while(L==3)}(R>255||E)&&Z(0);for(var O=0,ae=(w>>1)+(w>>3)+3,le=w-1,ie=0;ie<=R;++ie){var S=V[ie];if(S<1){H[ie]=-S;continue}for(X=0;X<S;++X){I[O]=ie;do O=O+ae≤while(O>=K)}}for(O&&Z(0),X=0;X<w;++X){var P=H[I[X]]++,oe=ee[X]=v-be(P);J[X]=(P<<oe)-w}return[d+7>>3,{b:v,s:I,n:ee,t:J}]},Yn=function(c,l){var f=0,d=-1,v=new q(292),w=c[l],E=v.subarray(0,256),R=v.subarray(256,268),L=new cr(v.buffer,268);if(w<128){var X=qe(c,l+1,6),K=X[0],z=X[1];l+=w;var V=K<<3,H=c[l];H||Z(0);for(var J=0,D=0,I=z.b,ee=I,W=(++l<<3)-8+be(H);W-=I,!(W<V);){var g=W>>3;if(J+=(c[g]|c[g+1]<<8)>>(W&7)&(1<<I)-1,E[++d]=z.s[J],W-=ee,W<V)break;g=W>>3,D+=(c[g]|c[g+1]<<8)>>(W&7)&(1<<ee)-1,E[++d]=z.s[D],I=z.n[J],J=z.t[J],ee=z.n[D],D=z.t[D]}++d>255&&Z(0)}else{for(d=w-127;f<d;f+=2){var b=c[++l];E[f]=b>>4,E[f+1]=b&15}++l}var T=0;for(f=0;f<d;++f){var U=E[f];U>11&&Z(0),T+=U&&1<<U-1}var re=be(T)+1,ne=1<<re,ce=ne-T;for(ce&ce-1&&Z(0),E[d++]=be(ce)+1,f=0;f<d;++f){var U=E[f];++R[E[f]=U&&re+1-U]}var O=new q(ne<<1),ae=O.subarray(0,ne),le=O.subarray(ne);for(L[re]=0,f=re;f>0;--f){var ie=L[f];Te(le,f,ie,L[f-1]=ie+R[f]*(1<<re-f))}for(L[0]!=ne&&Z(0),f=0;f<d;++f){var S=E[f];if(S){var P=L[S];Te(ae,f,P,L[S]=P+(1<<re-S))}}return[l,{n:le,b:re,s:ae}]},Un=qe(new q([81,16,99,140,49,198,24,99,12,33,196,24,99,102,102,134,70,146,4]),0,6)[1],Bn=qe(new q([33,20,196,24,99,140,33,132,16,66,8,33,132,16,66,8,33,68,68,68,68,68,68,68,68,36,9]),0,6)[1],jn=qe(new q([32,132,16,66,102,70,68,68,68,68,36,73,2]),0,5)[1],vt=function(c,l){for(var f=c.length,d=new lr(f),v=0;v<f;++v)d[v]=l,l+=1<<c[v];return d},Yr=new q(new lr([0,0,0,0,16843009,50528770,134678020,202050057,269422093]).buffer,0,36),Pn=vt(Yr,0),Ur=new q(new lr([0,0,0,0,0,0,0,0,16843009,50528770,117769220,185207048,252579084,16]).buffer,0,53),xn=vt(Ur,3),Ke=function(c,l,f){var d=c.length,v=l.length,w=c[d-1],E=(1<<f.b)-1,R=-f.b;w||Z(0);for(var L=0,X=f.b,K=(d<<3)-8+be(w)-X,z=-1;K>R&&z<v;){var V=K>>3,H=(c[V]|c[V+1]<<8|c[V+2]<<16)>>(K&7);L=(L<<X|H)&E,l[++z]=f.s[L],K-=X=f.n[L]}(K!=R||z+1!=v)&&Z(0)},Xn=function(c,l,f){var d=6,v=l.length,w=v+3>>2,E=w<<1,R=w+E;Ke(c.subarray(d,d+=c[0]|c[1]<<8),l.subarray(0,w),f),Ke(c.subarray(d,d+=c[2]|c[3]<<8),l.subarray(w,E),f),Ke(c.subarray(d,d+=c[4]|c[5]<<8),l.subarray(E,R),f),Ke(c.subarray(d),l.subarray(R),f)},In=function(c,l,f){var d,v=l.b,w=c[v],E=w>>1&3;l.l=w&1;var R=w>>3|c[v+1]<<5|c[v+2]<<13,L=(v+=3)+R;if(E==1)return v>=c.length?void 0:(l.b=v+1,f?(Te(f,c[v],l.y,l.y+=R),f):Te(new q(R),c[v]));if(!(L>c.length)){if(E==0)return l.b=L,f?(f.set(c.subarray(v,L),l.y),l.y+=R,f):Dr(c,v,L);if(E==2){var X=c[v],K=X&3,z=X>>2&3,V=X>>4,H=0,J=0;K<2?z&1?V|=c[++v]<<4|(z&2&&c[++v]<<12):V=X>>3:(J=z,z<2?(V|=(c[++v]&63)<<4,H=c[v]>>6|c[++v]<<2):z==2?(V|=c[++v]<<4|(c[++v]&3)<<12,H=c[v]>>2|c[++v]<<6):(V|=c[++v]<<4|(c[++v]&63)<<12,H=c[v]>>6|c[++v]<<2|c[++v]<<10)),++v;var D=f?f.subarray(l.y,l.y+l.m):new q(l.m),I=D.length-V;if(K==0)D.set(c.subarray(v,v+=V),I);else if(K==1)Te(D,c[v++],I);else{var ee=l.h;if(K==2){var W=Yn(c,v);H+=v-(v=W[0]),l.h=ee=W[1]}else ee||Z(0);(J?Xn:Ke)(c.subarray(v,v+=H),D.subarray(I),ee)}var g=c[v++];if(g){g==255?g=(c[v++]|c[v++]<<8)+32512:g>127&&(g=g-128<<8|c[v++]);var b=c[v++];b&3&&Z(0);for(var T=[Bn,jn,Un],U=2;U>-1;--U){var re=b>>(U<<1)+2&3;if(re==1){var ne=new q([0,0,c[v++]]);T[U]={s:ne.subarray(2,3),n:ne.subarray(0,1),t:new cr(ne.buffer,0,1),b:0}}else re==2?(d=qe(c,v,9-(U&1)),v=d[0],T[U]=d[1]):re==3&&(l.t||Z(0),T[U]=l.t[U])}var ce=l.t=T,O=ce[0],ae=ce[1],le=ce[2],ie=c[L-1];ie||Z(0);var S=(L<<3)-8+be(ie)-le.b,P=S>>3,oe=0,Ye=(c[P]|c[P+1]<<8)>>(S&7)&(1<<le.b)-1;P=(S-=ae.b)>>3;var Ue=(c[P]|c[P+1]<<8)>>(S&7)&(1<<ae.b)-1;P=(S-=O.b)>>3;var m=(c[P]|c[P+1]<<8)>>(S&7)&(1<<O.b)-1;for(++g;--g;){var B=le.s[Ye],Ge=le.n[Ye],Be=O.s[m],ze=O.n[m],ye=ae.s[Ue],se=ae.n[Ue];P=(S-=ye)>>3;var Qe=1<<ye,x=Qe+((c[P]|c[P+1]<<8|c[P+2]<<16|c[P+3]<<24)>>>(S&7)&Qe-1);P=(S-=Ur[Be])>>3;var Re=xn[Be]+((c[P]|c[P+1]<<8|c[P+2]<<16)>>(S&7)&(1<<Ur[Be])-1);P=(S-=Yr[B])>>3;var Le=Pn[B]+((c[P]|c[P+1]<<8|c[P+2]<<16)>>(S&7)&(1<<Yr[B])-1);if(P=(S-=Ge)>>3,Ye=le.t[Ye]+((c[P]|c[P+1]<<8)>>(S&7)&(1<<Ge)-1),P=(S-=ze)>>3,m=O.t[m]+((c[P]|c[P+1]<<8)>>(S&7)&(1<<ze)-1),P=(S-=se)>>3,Ue=ae.t[Ue]+((c[P]|c[P+1]<<8)>>(S&7)&(1<<se)-1),x>3)l.o[2]=l.o[1],l.o[1]=l.o[0],l.o[0]=x-=3;else{var de=x-(Le!=0);de?(x=de==3?l.o[0]-1:l.o[de],de>1&&(l.o[2]=l.o[1]),l.o[1]=l.o[0],l.o[0]=x):x=l.o[0]}for(var U=0;U<Le;++U)D[oe+U]=D[I+U];oe+=Le,I+=Le;var me=oe-x;if(me<0){var ve=-me,Ze=l.e+me;ve>Re&&(ve=Re);for(var U=0;U<ve;++U)D[oe+U]=l.w[Ze+U];oe+=ve,Re-=ve,me=0}for(var U=0;U<Re;++U)D[oe+U]=D[me+U];oe+=Re}if(oe!=I)for(;I<D.length;)D[oe++]=D[I++];else oe=D.length;f?l.y+=oe:D=Dr(D,0,oe)}else if(f){if(l.y+=V,I)for(var U=0;U<V;++U)D[U]=D[I+U]}else I&&(D=Dr(D,I));return l.b=L,D}Z(2)}},$n=function(c,l){if(c.length==1)return c[0];for(var f=new q(l),d=0,v=0;d<c.length;++d){var w=c[d];f.set(w,v),v+=w.length}return f};function Gn(c,l){for(var f=[],d=+!l,v=0,w=0;c.length;){var E=bn(c,d||l);if(typeof E=="object"){for(d?(l=null,E.w.length==E.u&&(f.push(l=E.w),w+=E.u)):(f.push(l),E.e=0);!E.l;){var R=In(c,E,l);R||Z(5),l?E.e=E.y:(f.push(R),w+=R.length,Rn(E.w,0,R.length),E.w.set(R,E.w.length-R.length))}v=E.b+E.c*4}else v=E;c=c.subarray(v)}return $n(f,w)}async function zn(c={}){var l,f=c,d="./this.program",v=(e,r)=>{throw r},w,E,R=console.log.bind(console),L=console.error.bind(console),X,K=!1,z,V=e=>e.startsWith("file://"),H,J,D,I,ee,W,g,b,T,U,re=!1;function ne(){var e=sr.buffer;D=new Int8Array(e),ee=new Int16Array(e),f.HEAPU8=I=new Uint8Array(e),W=new Uint16Array(e),g=new Int32Array(e),b=new Uint32Array(e),T=new Float32Array(e),U=new Float64Array(e)}function ce(){re=!0,!f.noFSInit&&!n.initialized&&n.init(),ke.S(),n.ignorePermissions=!1}function O(e){e="Aborted("+e+")",L(e),K=!0,e+=". Build with -sASSERTIONS for more info.",re&&rt();var r=new WebAssembly.RuntimeError(e);throw J==null||J(r),r}var ae;let le=()=>"";function ie(e){if(e==ae&&X)return new Uint8Array(X);throw"both async and sync fetching of the wasm failed"}async function S(e){if(!X)try{var r=await w(e);return new Uint8Array(r)}catch{}return ie(e)}async function P(e,r){try{var t=await S(e),o=await WebAssembly.instantiate(t,r);return o}catch(a){L(`failed to asynchronously prepare wasm: ${a}`),O(a)}}async function oe(e,r,t){if(!e&&!V(r))try{var o=fetch(r,{credentials:"same-origin"}),a=await WebAssembly.instantiateStreaming(o,t);return a}catch(i){L(`wasm streaming compile failed: ${i}`),L("falling back to ArrayBuffer instantiation")}return P(r,t)}function Ye(){var e={a:wn};return e}async function Ue(){function e(i,s){return ke=i.exports,mn(ke),ne(),ke}function r(i){return e(i.instance)}var t=Ye();ae??(ae=le());var o=await oe(X,ae,t),a=r(o);return a}var m,B;class Ge{constructor(r){he(this,"name","ExitStatus");this.message=`Program terminated with exit(${r})`,this.status=r}}var Be=globalThis.TextDecoder&&new TextDecoder,ze=(e,r,t,o)=>{var a=r+t;if(o)return a;for(;e[r]&&!(r>=a);)++r;return r},ye=(e,r=0,t,o)=>{var a=ze(e,r,t,o);if(a-r>16&&e.buffer&&Be)return Be.decode(e.subarray(r,a));for(var i="";r<a;){var s=e[r++];if(!(s&128)){i+=String.fromCharCode(s);continue}var u=e[r++]&63;if((s&224)==192){i+=String.fromCharCode((s&31)<<6|u);continue}var h=e[r++]&63;if((s&240)==224?s=(s&15)<<12|u<<6|h:s=(s&7)<<18|u<<12|h<<6|e[r++]&63,s<65536)i+=String.fromCharCode(s);else{var p=s-65536;i+=String.fromCharCode(55296|p>>10,56320|p&1023)}}return i},se=(e,r,t)=>e?ye(I,e,r,t):"",Qe=(e,r,t,o)=>O(`Assertion failed: ${se(e)}, at: `+[r?se(r):"unknown filename",t,o?se(o):"unknown function"]),x={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,o=e.length-1;o>=0;o--){var a=e[o];a==="."?e.splice(o,1):a===".."?(e.splice(o,1),t++):t&&(e.splice(o,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=x.isAbs(e),t=e.slice(-1)==="/";return e=x.normalizeArray(e.split("/").filter(o=>!!o),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=x.splitPath(e),t=r[0],o=r[1];return!t&&!o?".":(o&&(o=o.slice(0,-1)),t+o)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>x.normalize(e.join("/")),join2:(e,r)=>x.normalize(e+"/"+r)},Re=()=>e=>crypto.getRandomValues(e),Le=e=>{(Le=Re())(e)},de={resolve:(...e)=>{for(var r="",t=!1,o=e.length-1;o>=-1&&!t;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"";r=a+"/"+r,t=x.isAbs(a)}return r=x.normalizeArray(r.split("/").filter(i=>!!i),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=de.resolve(e).slice(1),r=de.resolve(r).slice(1);function t(p){for(var F=0;F<p.length&&p[F]==="";F++);for(var C=p.length-1;C>=0&&p[C]==="";C--);return F>C?[]:p.slice(F,C-F+1)}for(var o=t(e.split("/")),a=t(r.split("/")),i=Math.min(o.length,a.length),s=i,u=0;u<i;u++)if(o[u]!==a[u]){s=u;break}for(var h=[],u=s;u<o.length;u++)h.push("..");return h=h.concat(a.slice(s)),h.join("/")}},me=[],ve=e=>{for(var r=0,t=0;t<e.length;++t){var o=e.charCodeAt(t);o<=127?r++:o<=2047?r+=2:o>=55296&&o<=57343?(r+=4,++t):r+=3}return r},Ze=(e,r,t,o)=>{if(!(o>0))return 0;for(var a=t,i=t+o-1,s=0;s<e.length;++s){var u=e.codePointAt(s);if(u<=127){if(t>=i)break;r[t++]=u}else if(u<=2047){if(t+1>=i)break;r[t++]=192|u>>6,r[t++]=128|u&63}else if(u<=65535){if(t+2>=i)break;r[t++]=224|u>>12,r[t++]=128|u>>6&63,r[t++]=128|u&63}else{if(t+3>=i)break;r[t++]=240|u>>18,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|u&63,s++}}return r[t]=0,t-a},fr=(e,r,t)=>{var o=ve(e)+1,a=new Array(o),i=Ze(e,a,0,a.length);return a.length=i,a},mt=()=>{if(!me.length){var e=null;if(!e)return null;me=fr(e)}return me.shift()},De={ttys:[],init(){},shutdown(){},register(e,r){De.ttys[e]={input:[],output:[],ops:r},n.registerDevice(e,De.stream_ops)},stream_ops:{open(e){var r=De.ttys[e.node.rdev];if(!r)throw new n.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,o,a){if(!e.tty||!e.tty.ops.get_char)throw new n.ErrnoError(60);for(var i=0,s=0;s<o;s++){var u;try{u=e.tty.ops.get_char(e.tty)}catch{throw new n.ErrnoError(29)}if(u===void 0&&i===0)throw new n.ErrnoError(6);if(u==null)break;i++,r[t+s]=u}return i&&(e.node.atime=Date.now()),i},write(e,r,t,o,a){if(!e.tty||!e.tty.ops.put_char)throw new n.ErrnoError(60);try{for(var i=0;i<o;i++)e.tty.ops.put_char(e.tty,r[t+i])}catch{throw new n.ErrnoError(29)}return o&&(e.node.mtime=e.node.ctime=Date.now()),i}},default_tty_ops:{get_char(e){return mt()},put_char(e,r){r===null||r===10?(R(ye(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){var r;((r=e.output)==null?void 0:r.length)>0&&(R(ye(e.output)),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,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(L(ye(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){var r;((r=e.output)==null?void 0:r.length)>0&&(L(ye(e.output)),e.output=[])}}},wt=(e,r)=>I.fill(0,e,e+r),jr=(e,r)=>Math.ceil(e/r)*r,Pr=e=>{e=jr(e,65536);var r=Ar(65536,e);return r&&wt(r,e),r},Y={ops_table:null,mount(e){return Y.createNode(null,"/",16895,0)},createNode(e,r,t,o){if(n.isBlkdev(t)||n.isFIFO(t))throw new n.ErrnoError(63);Y.ops_table||(Y.ops_table={dir:{node:{getattr:Y.node_ops.getattr,setattr:Y.node_ops.setattr,lookup:Y.node_ops.lookup,mknod:Y.node_ops.mknod,rename:Y.node_ops.rename,unlink:Y.node_ops.unlink,rmdir:Y.node_ops.rmdir,readdir:Y.node_ops.readdir,symlink:Y.node_ops.symlink},stream:{llseek:Y.stream_ops.llseek}},file:{node:{getattr:Y.node_ops.getattr,setattr:Y.node_ops.setattr},stream:{llseek:Y.stream_ops.llseek,read:Y.stream_ops.read,write:Y.stream_ops.write,mmap:Y.stream_ops.mmap,msync:Y.stream_ops.msync}},link:{node:{getattr:Y.node_ops.getattr,setattr:Y.node_ops.setattr,readlink:Y.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Y.node_ops.getattr,setattr:Y.node_ops.setattr},stream:n.chrdev_stream_ops}});var a=n.createNode(e,r,t,o);return n.isDir(a.mode)?(a.node_ops=Y.ops_table.dir.node,a.stream_ops=Y.ops_table.dir.stream,a.contents={}):n.isFile(a.mode)?(a.node_ops=Y.ops_table.file.node,a.stream_ops=Y.ops_table.file.stream,a.usedBytes=0,a.contents=null):n.isLink(a.mode)?(a.node_ops=Y.ops_table.link.node,a.stream_ops=Y.ops_table.link.stream):n.isChrdev(a.mode)&&(a.node_ops=Y.ops_table.chrdev.node,a.stream_ops=Y.ops_table.chrdev.stream),a.atime=a.mtime=a.ctime=Date.now(),e&&(e.contents[r]=a,e.atime=e.mtime=e.ctime=a.atime),a},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var o=1048576;r=Math.max(r,t*(t<o?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var a=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(a.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=n.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,n.isDir(e.mode)?r.size=4096:n.isFile(e.mode)?r.size=e.usedBytes:n.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(let t of["mode","atime","mtime","ctime"])r[t]!=null&&(e[t]=r[t]);r.size!==void 0&&Y.resizeFileStorage(e,r.size)},lookup(e,r){throw Y.doesNotExistError||(Y.doesNotExistError=new n.ErrnoError(44),Y.doesNotExistError.stack="<generic error, no stack>"),Y.doesNotExistError},mknod(e,r,t,o){return Y.createNode(e,r,t,o)},rename(e,r,t){var o;try{o=n.lookupNode(r,t)}catch{}if(o){if(n.isDir(e.mode))for(var a in o.contents)throw new n.ErrnoError(55);n.hashRemoveNode(o)}delete e.parent.contents[e.name],r.contents[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=n.lookupNode(e,r);for(var o in t.contents)throw new n.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,t){var o=Y.createNode(e,r,41471,0);return o.link=t,o},readlink(e){if(!n.isLink(e.mode))throw new n.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,o,a){var i=e.node.contents;if(a>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-a,o);if(s>8&&i.subarray)r.set(i.subarray(a,a+s),t);else for(var u=0;u<s;u++)r[t+u]=i[a+u];return s},write(e,r,t,o,a,i){if(r.buffer===D.buffer&&(i=!1),!o)return 0;var s=e.node;if(s.mtime=s.ctime=Date.now(),r.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=r.subarray(t,t+o),s.usedBytes=o,o;if(s.usedBytes===0&&a===0)return s.contents=r.slice(t,t+o),s.usedBytes=o,o;if(a+o<=s.usedBytes)return s.contents.set(r.subarray(t,t+o),a),o}if(Y.expandFileStorage(s,a+o),s.contents.subarray&&r.subarray)s.contents.set(r.subarray(t,t+o),a);else for(var u=0;u<o;u++)s.contents[a+u]=r[t+u];return s.usedBytes=Math.max(s.usedBytes,a+o),o},llseek(e,r,t){var o=r;if(t===1?o+=e.position:t===2&&n.isFile(e.node.mode)&&(o+=e.node.usedBytes),o<0)throw new n.ErrnoError(28);return o},mmap(e,r,t,o,a){if(!n.isFile(e.node.mode))throw new n.ErrnoError(43);var i,s,u=e.node.contents;if(!(a&2)&&u&&u.buffer===D.buffer)s=!1,i=u.byteOffset;else{if(s=!0,i=Pr(r),!i)throw new n.ErrnoError(48);u&&((t>0||t+r<u.length)&&(u.subarray?u=u.subarray(t,t+r):u=Array.prototype.slice.call(u,t,t+r)),D.set(u,i))}return{ptr:i,allocated:s}},msync(e,r,t,o,a){return Y.stream_ops.write(e,r,0,o,t,!1),0}}},gt=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},hr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},Ft=async e=>{var r=await w(e);return new Uint8Array(r)},Et=(...e)=>n.createDataFile(...e),Se=0,Ne=null,Mt=e=>{if(Se--,Se==0&&Ne){var r=Ne;Ne=null,r()}},Ct=e=>{Se++},Rt=[],Lt=async(e,r)=>{typeof Browser<"u"&&Browser.init();for(var t of Rt)if(t.canHandle(r))return t.handle(e,r);return e},xr=async(e,r,t,o,a,i,s,u)=>{var h=r?de.resolve(x.join2(e,r)):e;Ct();try{var p=t;typeof t=="string"&&(p=await Ft(t)),p=await Lt(p,h),u==null||u(),i||Et(e,r,p,o,a,s)}finally{Mt()}},Dt=(e,r,t,o,a,i,s,u,h,p)=>{xr(e,r,t,o,a,u,h,p).then(i).catch(s)},n={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,ErrnoError:class{constructor(e){he(this,"name","ErrnoError");this.errno=e}},FSStream:class{constructor(){he(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,r,t,o){he(this,"node_ops",{});he(this,"stream_ops",{});he(this,"readMode",365);he(this,"writeMode",146);he(this,"mounted",null);e||(e=this),this.parent=e,this.mount=e.mount,this.id=n.nextInode++,this.name=r,this.mode=t,this.rdev=o,this.atime=this.mtime=this.ctime=Date.now()}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,r={}){if(!e)throw new n.ErrnoError(44);r.follow_mount??(r.follow_mount=!0),x.isAbs(e)||(e=n.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var o=e.split("/").filter(p=>!!p),a=n.root,i="/",s=0;s<o.length;s++){var u=s===o.length-1;if(u&&r.parent)break;if(o[s]!=="."){if(o[s]===".."){if(i=x.dirname(i),n.isRoot(a)){e=i+"/"+o.slice(s+1).join("/"),t--;continue e}else a=a.parent;continue}i=x.join2(i,o[s]);try{a=n.lookupNode(a,o[s])}catch(p){if((p==null?void 0:p.errno)===44&&u&&r.noent_okay)return{path:i};throw p}if(n.isMountpoint(a)&&(!u||r.follow_mount)&&(a=a.mounted.root),n.isLink(a.mode)&&(!u||r.follow)){if(!a.node_ops.readlink)throw new n.ErrnoError(52);var h=a.node_ops.readlink(a);x.isAbs(h)||(h=x.dirname(i)+"/"+h),e=h+"/"+o.slice(s+1).join("/");continue e}}}return{path:i,node:a}}throw new n.ErrnoError(32)},getPath(e){for(var r;;){if(n.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,o=0;o<r.length;o++)t=(t<<5)-t+r.charCodeAt(o)|0;return(e+t>>>0)%n.nameTable.length},hashAddNode(e){var r=n.hashName(e.parent.id,e.name);e.name_next=n.nameTable[r],n.nameTable[r]=e},hashRemoveNode(e){var r=n.hashName(e.parent.id,e.name);if(n.nameTable[r]===e)n.nameTable[r]=e.name_next;else for(var t=n.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=n.mayLookup(e);if(t)throw new n.ErrnoError(t);for(var o=n.hashName(e.id,r),a=n.nameTable[o];a;a=a.name_next){var i=a.name;if(a.parent.id===e.id&&i===r)return a}return n.lookup(e,r)},createNode(e,r,t,o){var a=new n.FSNode(e,r,t,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 r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return n.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!n.isDir(e.mode))return 54;var r=n.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!n.isDir(e.mode))return 54;try{var t=n.lookupNode(e,r);return 20}catch{}return n.nodePermissions(e,"wx")},mayDelete(e,r,t){var o;try{o=n.lookupNode(e,r)}catch(i){return i.errno}var a=n.nodePermissions(e,"wx");if(a)return a;if(t){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,r){return e?n.isLink(e.mode)?32:n.isDir(e.mode)&&(n.flagsToPermissionString(r)!=="r"||r&576)?31:n.nodePermissions(e,n.flagsToPermissionString(r)):44},checkOpExists(e,r){if(!e)throw new n.ErrnoError(r);return e},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 r=n.getStream(e);if(!r)throw new n.ErrnoError(8);return r},getStream:e=>n.streams[e],createStream(e,r=-1){return e=Object.assign(new n.FSStream,e),r==-1&&(r=n.nextfd()),e.fd=r,n.streams[r]=e,e},closeStream(e){n.streams[e]=null},dupStream(e,r=-1){var o,a;var t=n.createStream(e,r);return(a=(o=t.stream_ops)==null?void 0:o.dup)==null||a.call(o,t),t},doSetAttr(e,r,t){var o=e==null?void 0:e.stream_ops.setattr,a=o?e:r;o??(o=r.node_ops.setattr),n.checkOpExists(o,63),o(a,t)},chrdev_stream_ops:{open(e){var t,o;var r=n.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,(o=(t=e.stream_ops).open)==null||o.call(t,e)},llseek(){throw new n.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){n.devices[e]={stream_ops:r}},getDevice:e=>n.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var o=t.pop();r.push(o),t.push(...o.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),n.syncFSRequests++,n.syncFSRequests>1&&L(`warning: ${n.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=n.getMounts(n.root.mount),o=0;function a(u){return n.syncFSRequests--,r(u)}function i(u){if(u)return i.errored?void 0:(i.errored=!0,a(u));++o>=t.length&&a(null)}for(var s of t)s.type.syncfs?s.type.syncfs(s,e,i):i(null)},mount(e,r,t){var o=t==="/",a=!t,i;if(o&&n.root)throw new n.ErrnoError(10);if(!o&&!a){var s=n.lookupPath(t,{follow_mount:!1});if(t=s.path,i=s.node,n.isMountpoint(i))throw new n.ErrnoError(10);if(!n.isDir(i.mode))throw new n.ErrnoError(54)}var u={type:e,opts:r,mountpoint:t,mounts:[]},h=e.mount(u);return h.mount=u,u.root=h,o?n.root=h:i&&(i.mounted=u,i.mount&&i.mount.mounts.push(u)),h},unmount(e){var r=n.lookupPath(e,{follow_mount:!1});if(!n.isMountpoint(r.node))throw new n.ErrnoError(28);var t=r.node,o=t.mounted,a=n.getMounts(o);for(var[i,s]of Object.entries(n.nameTable))for(;s;){var u=s.name_next;a.includes(s.mount)&&n.destroyNode(s),s=u}t.mounted=null;var h=t.mount.mounts.indexOf(o);t.mount.mounts.splice(h,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var o=n.lookupPath(e,{parent:!0}),a=o.node,i=x.basename(e);if(!i)throw new n.ErrnoError(28);if(i==="."||i==="..")throw new n.ErrnoError(20);var s=n.mayCreate(a,i);if(s)throw new n.ErrnoError(s);if(!a.node_ops.mknod)throw new n.ErrnoError(63);return a.node_ops.mknod(a,i,r,t)},statfs(e){return n.statfsNode(n.lookupPath(e,{follow:!0}).node)},statfsStream(e){return n.statfsNode(e.node)},statfsNode(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:n.nextInode,ffree:n.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(r,e.node_ops.statfs(e.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,n.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,n.mknod(e,r,0)},mkdirTree(e,r){var t=e.split("/"),o="";for(var a of t)if(a){(o||x.isAbs(e))&&(o+="/"),o+=a;try{n.mkdir(o,r)}catch(i){if(i.errno!=20)throw i}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,n.mknod(e,r,t)},symlink(e,r){if(!de.resolve(e))throw new n.ErrnoError(44);var t=n.lookupPath(r,{parent:!0}),o=t.node;if(!o)throw new n.ErrnoError(44);var a=x.basename(r),i=n.mayCreate(o,a);if(i)throw new n.ErrnoError(i);if(!o.node_ops.symlink)throw new n.ErrnoError(63);return o.node_ops.symlink(o,a,e)},rename(e,r){var t=x.dirname(e),o=x.dirname(r),a=x.basename(e),i=x.basename(r),s,u,h;if(s=n.lookupPath(e,{parent:!0}),u=s.node,s=n.lookupPath(r,{parent:!0}),h=s.node,!u||!h)throw new n.ErrnoError(44);if(u.mount!==h.mount)throw new n.ErrnoError(75);var p=n.lookupNode(u,a),F=de.relative(e,o);if(F.charAt(0)!==".")throw new n.ErrnoError(28);if(F=de.relative(r,t),F.charAt(0)!==".")throw new n.ErrnoError(55);var C;try{C=n.lookupNode(h,i)}catch{}if(p!==C){var M=n.isDir(p.mode),y=n.mayDelete(u,a,M);if(y)throw new n.ErrnoError(y);if(y=C?n.mayDelete(h,i,M):n.mayCreate(h,i),y)throw new n.ErrnoError(y);if(!u.node_ops.rename)throw new n.ErrnoError(63);if(n.isMountpoint(p)||C&&n.isMountpoint(C))throw new n.ErrnoError(10);if(h!==u&&(y=n.nodePermissions(u,"w"),y))throw new n.ErrnoError(y);n.hashRemoveNode(p);try{u.node_ops.rename(p,h,i),p.parent=h}catch(j){throw j}finally{n.hashAddNode(p)}}},rmdir(e){var r=n.lookupPath(e,{parent:!0}),t=r.node,o=x.basename(e),a=n.lookupNode(t,o),i=n.mayDelete(t,o,!0);if(i)throw new n.ErrnoError(i);if(!t.node_ops.rmdir)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);t.node_ops.rmdir(t,o),n.destroyNode(a)},readdir(e){var r=n.lookupPath(e,{follow:!0}),t=r.node,o=n.checkOpExists(t.node_ops.readdir,54);return o(t)},unlink(e){var r=n.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new n.ErrnoError(44);var o=x.basename(e),a=n.lookupNode(t,o),i=n.mayDelete(t,o,!1);if(i)throw new n.ErrnoError(i);if(!t.node_ops.unlink)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);t.node_ops.unlink(t,o),n.destroyNode(a)},readlink(e){var r=n.lookupPath(e),t=r.node;if(!t)throw new n.ErrnoError(44);if(!t.node_ops.readlink)throw new n.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,r){var t=n.lookupPath(e,{follow:!r}),o=t.node,a=n.checkOpExists(o.node_ops.getattr,63);return a(o)},fstat(e){var r=n.getStreamChecked(e),t=r.node,o=r.stream_ops.getattr,a=o?r:t;return o??(o=t.node_ops.getattr),n.checkOpExists(o,63),o(a)},lstat(e){return n.stat(e,!0)},doChmod(e,r,t,o){n.doSetAttr(e,r,{mode:t&4095|r.mode&-4096,ctime:Date.now(),dontFollow:o})},chmod(e,r,t){var o;if(typeof e=="string"){var a=n.lookupPath(e,{follow:!t});o=a.node}else o=e;n.doChmod(null,o,r,t)},lchmod(e,r){n.chmod(e,r,!0)},fchmod(e,r){var t=n.getStreamChecked(e);n.doChmod(t,t.node,r,!1)},doChown(e,r,t){n.doSetAttr(e,r,{timestamp:Date.now(),dontFollow:t})},chown(e,r,t,o){var a;if(typeof e=="string"){var i=n.lookupPath(e,{follow:!o});a=i.node}else a=e;n.doChown(null,a,o)},lchown(e,r,t){n.chown(e,r,t,!0)},fchown(e,r,t){var o=n.getStreamChecked(e);n.doChown(o,o.node,!1)},doTruncate(e,r,t){if(n.isDir(r.mode))throw new n.ErrnoError(31);if(!n.isFile(r.mode))throw new n.ErrnoError(28);var o=n.nodePermissions(r,"w");if(o)throw new n.ErrnoError(o);n.doSetAttr(e,r,{size:t,timestamp:Date.now()})},truncate(e,r){if(r<0)throw new n.ErrnoError(28);var t;if(typeof e=="string"){var o=n.lookupPath(e,{follow:!0});t=o.node}else t=e;n.doTruncate(null,t,r)},ftruncate(e,r){var t=n.getStreamChecked(e);if(r<0||(t.flags&2097155)===0)throw new n.ErrnoError(28);n.doTruncate(t,t.node,r)},utime(e,r,t){var o=n.lookupPath(e,{follow:!0}),a=o.node,i=n.checkOpExists(a.node_ops.setattr,63);i(a,{atime:r,mtime:t})},open(e,r,t=438){if(e==="")throw new n.ErrnoError(44);r=typeof r=="string"?gt(r):r,r&64?t=t&4095|32768:t=0;var o,a;if(typeof e=="object")o=e;else{a=e.endsWith("/");var i=n.lookupPath(e,{follow:!(r&131072),noent_okay:!0});o=i.node,e=i.path}var s=!1;if(r&64)if(o){if(r&128)throw new n.ErrnoError(20)}else{if(a)throw new n.ErrnoError(31);o=n.mknod(e,t|511,0),s=!0}if(!o)throw new n.ErrnoError(44);if(n.isChrdev(o.mode)&&(r&=-513),r&65536&&!n.isDir(o.mode))throw new n.ErrnoError(54);if(!s){var u=n.mayOpen(o,r);if(u)throw new n.ErrnoError(u)}r&512&&!s&&n.truncate(o,0),r&=-131713;var h=n.createStream({node:o,path:n.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return h.stream_ops.open&&h.stream_ops.open(h),s&&n.chmod(o,t&511),h},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(r){throw r}finally{n.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(n.isClosed(e))throw new n.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new n.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new n.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,o,a){if(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 i=typeof a<"u";if(!i)a=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var s=e.stream_ops.read(e,r,t,o,a);return i||(e.position+=s),s},write(e,r,t,o,a,i){if(o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(e))throw new n.ErrnoError(8);if((e.flags&2097155)===0)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 s=typeof a<"u";if(!s)a=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var u=e.stream_ops.write(e,r,t,o,a,i);return s||(e.position+=u),u},mmap(e,r,t,o,a){if((o&2)!==0&&(a&2)===0&&(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);if(!r)throw new n.ErrnoError(28);return e.stream_ops.mmap(e,r,t,o,a)},msync(e,r,t,o,a){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,o,a):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new n.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary"&&O(`Invalid encoding type "${r.encoding}"`);var t=n.open(e,r.flags),o=n.stat(e),a=o.size,i=new Uint8Array(a);return n.read(t,i,0,a,0),r.encoding==="utf8"&&(i=ye(i)),n.close(t),i},writeFile(e,r,t={}){t.flags=t.flags||577;var o=n.open(e,t.flags,t.mode);typeof r=="string"&&(r=new Uint8Array(fr(r))),ArrayBuffer.isView(r)?n.write(o,r,0,r.byteLength,void 0,t.canOwn):O("Unsupported data type"),n.close(o)},cwd:()=>n.currentPath,chdir(e){var r=n.lookupPath(e,{follow:!0});if(r.node===null)throw new n.ErrnoError(44);if(!n.isDir(r.node.mode))throw new n.ErrnoError(54);var t=n.nodePermissions(r.node,"x");if(t)throw new n.ErrnoError(t);n.currentPath=r.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,i,s,u)=>s,llseek:()=>0}),n.mkdev("/dev/null",n.makedev(1,3)),De.register(n.makedev(5,0),De.default_tty_ops),De.register(n.makedev(6,0),De.default_tty1_ops),n.mkdev("/dev/tty",n.makedev(5,0)),n.mkdev("/dev/tty1",n.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(Le(e),r=e.byteLength),e[--r]);n.createDevice("/dev","random",t),n.createDevice("/dev","urandom",t),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 r=n.createNode(e,"fd",16895,73);return r.stream_ops={llseek:Y.stream_ops.llseek},r.node_ops={lookup(t,o){var a=+o,i=n.getStreamChecked(a),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path},id:a+1};return s.parent=s,s},readdir(){return Array.from(n.streams.entries()).filter(([t,o])=>o).map(([t,o])=>t.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?n.createDevice("/dev","stdin",e):n.symlink("/dev/tty","/dev/stdin"),r?n.createDevice("/dev","stdout",null,r):n.symlink("/dev/tty","/dev/stdout"),t?n.createDevice("/dev","stderr",null,t):n.symlink("/dev/tty1","/dev/stderr"),n.open("/dev/stdin",0),n.open("/dev/stdout",1),n.open("/dev/stderr",1)},staticInit(){n.nameTable=new Array(4096),n.mount(Y,{},"/"),n.createDefaultDirectories(),n.createDefaultDevices(),n.createSpecialDirectories(),n.filesystems={MEMFS:Y}},init(e,r,t){n.initialized=!0,n.createStandardStreams(e,r,t)},quit(){n.initialized=!1;for(var e of n.streams)e&&n.close(e)},findObject(e,r){var t=n.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=n.lookupPath(e,{follow:!r});e=t.path}catch{}var o={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=n.lookupPath(e,{parent:!0});o.parentExists=!0,o.parentPath=t.path,o.parentObject=t.node,o.name=x.basename(e),t=n.lookupPath(e,{follow:!r}),o.exists=!0,o.path=t.path,o.object=t.node,o.name=t.node.name,o.isRoot=t.path==="/"}catch(a){o.error=a.errno}return o},createPath(e,r,t,o){e=typeof e=="string"?e:n.getPath(e);for(var a=r.split("/").reverse();a.length;){var i=a.pop();if(i){var s=x.join2(e,i);try{n.mkdir(s)}catch(u){if(u.errno!=20)throw u}e=s}}return s},createFile(e,r,t,o,a){var i=x.join2(typeof e=="string"?e:n.getPath(e),r),s=hr(o,a);return n.create(i,s)},createDataFile(e,r,t,o,a,i){var s=r;e&&(e=typeof e=="string"?e:n.getPath(e),s=r?x.join2(e,r):e);var u=hr(o,a),h=n.create(s,u);if(t){if(typeof t=="string"){for(var p=new Array(t.length),F=0,C=t.length;F<C;++F)p[F]=t.charCodeAt(F);t=p}n.chmod(h,u|146);var M=n.open(h,577);n.write(M,t,0,t.length,0,i),n.close(M),n.chmod(h,u)}},createDevice(e,r,t,o){var u;var a=x.join2(typeof e=="string"?e:n.getPath(e),r),i=hr(!!t,!!o);(u=n.createDevice).major??(u.major=64);var s=n.makedev(n.createDevice.major++,0);return n.registerDevice(s,{open(h){h.seekable=!1},close(h){var p;(p=o==null?void 0:o.buffer)!=null&&p.length&&o(10)},read(h,p,F,C,M){for(var y=0,j=0;j<C;j++){var G;try{G=t()}catch{throw new n.ErrnoError(29)}if(G===void 0&&y===0)throw new n.ErrnoError(6);if(G==null)break;y++,p[F+j]=G}return y&&(h.node.atime=Date.now()),y},write(h,p,F,C,M){for(var y=0;y<C;y++)try{o(p[F+y])}catch{throw new n.ErrnoError(29)}return C&&(h.node.mtime=h.node.ctime=Date.now()),y}}),n.mkdev(a,i,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)O("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{e.contents=E(e.url)}catch{throw new n.ErrnoError(29)}},createLazyFile(e,r,t,o,a){class i{constructor(){he(this,"lengthKnown",!1);he(this,"chunks",[])}get(M){if(!(M>this.length-1||M<0)){var y=M%this.chunkSize,j=M/this.chunkSize|0;return this.getter(j)[y]}}setDataGetter(M){this.getter=M}cacheLength(){var M=new XMLHttpRequest;M.open("HEAD",t,!1),M.send(null),M.status>=200&&M.status<300||M.status===304||O("Couldn't load "+t+". Status: "+M.status);var y=Number(M.getResponseHeader("Content-length")),j,G=(j=M.getResponseHeader("Accept-Ranges"))&&j==="bytes",_=(j=M.getResponseHeader("Content-Encoding"))&&j==="gzip",N=1024*1024;G||(N=y);var te=(fe,Ee)=>{fe>Ee&&O("invalid range ("+fe+", "+Ee+") or no bytes requested!"),Ee>y-1&&O("only "+y+" bytes available! programmer error!");var Q=new XMLHttpRequest;return Q.open("GET",t,!1),y!==N&&Q.setRequestHeader("Range","bytes="+fe+"-"+Ee),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||O("Couldn't load "+t+". Status: "+Q.status),Q.response!==void 0?new Uint8Array(Q.response||[]):fr(Q.responseText||"")},A=this;A.setDataGetter(fe=>{var Ee=fe*N,Q=(fe+1)*N-1;return Q=Math.min(Q,y-1),typeof A.chunks[fe]>"u"&&(A.chunks[fe]=te(Ee,Q)),typeof A.chunks[fe]>"u"&&O("doXHR failed!"),A.chunks[fe]}),(_||!y)&&(N=y=1,y=this.getter(0).length,N=y,R("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=y,this._chunkSize=N,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){O("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var s=new i,u={isDevice:!1,contents:s}}else var u={isDevice:!1,url:t};var h=n.createFile(e,r,u,o,a);u.contents?h.contents=u.contents:u.url&&(h.contents=null,h.url=u.url),Object.defineProperties(h,{usedBytes:{get:function(){return this.contents.length}}});var p={};for(let[C,M]of Object.entries(h.stream_ops))p[C]=(...y)=>(n.forceLoadFile(h),M(...y));function F(C,M,y,j,G){var _=C.node.contents;if(G>=_.length)return 0;var N=Math.min(_.length-G,j);if(_.slice)for(var te=0;te<N;te++)M[y+te]=_[G+te];else for(var te=0;te<N;te++)M[y+te]=_.get(G+te);return N}return p.read=(C,M,y,j,G)=>(n.forceLoadFile(h),F(C,M,y,j,G)),p.mmap=(C,M,y,j,G)=>{n.forceLoadFile(h);var _=Pr(M);if(!_)throw new n.ErrnoError(48);return F(C,D,_,M,y),{ptr:_,allocated:!0}},h.stream_ops=p,h}},k={calculateAt(e,r,t){if(x.isAbs(r))return r;var o;if(e===-100)o=n.cwd();else{var a=k.getStreamFromFD(e);o=a.path}if(r.length==0){if(!t)throw new n.ErrnoError(44);return o}return o+"/"+r},writeStat(e,r){b[e>>2]=r.dev,b[e+4>>2]=r.mode,b[e+8>>2]=r.nlink,b[e+12>>2]=r.uid,b[e+16>>2]=r.gid,b[e+20>>2]=r.rdev,B=[r.size>>>0,(m=r.size,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+24>>2]=B[0],g[e+28>>2]=B[1],g[e+32>>2]=4096,g[e+36>>2]=r.blocks;var t=r.atime.getTime(),o=r.mtime.getTime(),a=r.ctime.getTime();return B=[Math.floor(t/1e3)>>>0,(m=Math.floor(t/1e3),+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+40>>2]=B[0],g[e+44>>2]=B[1],b[e+48>>2]=t%1e3*1e3*1e3,B=[Math.floor(o/1e3)>>>0,(m=Math.floor(o/1e3),+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+56>>2]=B[0],g[e+60>>2]=B[1],b[e+64>>2]=o%1e3*1e3*1e3,B=[Math.floor(a/1e3)>>>0,(m=Math.floor(a/1e3),+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+72>>2]=B[0],g[e+76>>2]=B[1],b[e+80>>2]=a%1e3*1e3*1e3,B=[r.ino>>>0,(m=r.ino,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+88>>2]=B[0],g[e+92>>2]=B[1],0},writeStatFs(e,r){b[e+4>>2]=r.bsize,b[e+60>>2]=r.bsize,B=[r.blocks>>>0,(m=r.blocks,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+8>>2]=B[0],g[e+12>>2]=B[1],B=[r.bfree>>>0,(m=r.bfree,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+16>>2]=B[0],g[e+20>>2]=B[1],B=[r.bavail>>>0,(m=r.bavail,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+24>>2]=B[0],g[e+28>>2]=B[1],B=[r.files>>>0,(m=r.files,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+32>>2]=B[0],g[e+36>>2]=B[1],B=[r.ffree>>>0,(m=r.ffree,+Math.abs(m)>=1?m>0?+Math.floor(m/4294967296)>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],g[e+40>>2]=B[0],g[e+44>>2]=B[1],b[e+48>>2]=r.fsid,b[e+64>>2]=r.flags,b[e+56>>2]=r.namelen},doMsync(e,r,t,o,a){if(!n.isFile(r.node.mode))throw new n.ErrnoError(43);if(o&2)return 0;var i=I.slice(e,e+t);n.msync(r,i,a,t,o)},getStreamFromFD(e){var r=n.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=se(e);return r}};function bt(e,r,t,o){try{if(r=k.getStr(r),r=k.calculateAt(e,r),t&-8)return-28;var a=n.lookupPath(r,{follow:!0}),i=a.node;if(!i)return-44;var s="";return t&4&&(s+="r"),t&2&&(s+="w"),t&1&&(s+="x"),s&&n.nodePermissions(i,s)?-2:0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}var Je=()=>{var e=g[+k.varargs>>2];return k.varargs+=4,e},je=Je;function Yt(e,r,t){k.varargs=t;try{var o=k.getStreamFromFD(e);switch(r){case 0:{var a=Je();if(a<0)return-28;for(;n.streams[a];)a++;var i;return i=n.dupStream(o,a),i.fd}case 1:case 2:return 0;case 3:return o.flags;case 4:{var a=Je();return o.flags|=a,0}case 12:{var a=je(),s=0;return ee[a+s>>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 Ut(e,r){try{return k.writeStat(r,n.fstat(e))}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function Bt(e,r,t){k.varargs=t;try{var o=k.getStreamFromFD(e);switch(r){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),i=je();g[i>>2]=a.c_iflag||0,g[i+4>>2]=a.c_oflag||0,g[i+8>>2]=a.c_cflag||0,g[i+12>>2]=a.c_lflag||0;for(var s=0;s<32;s++)D[i+s+17]=a.c_cc[s]||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 i=je(),u=g[i>>2],h=g[i+4>>2],p=g[i+8>>2],F=g[i+12>>2],C=[],s=0;s<32;s++)C.push(D[i+s+17]);return o.tty.ops.ioctl_tcsets(o.tty,r,{c_iflag:u,c_oflag:h,c_cflag:p,c_lflag:F,c_cc:C})}return 0}case 21519:{if(!o.tty)return-59;var i=je();return g[i>>2]=0,0}case 21520:return o.tty?-28:-59;case 21537:case 21531:{var i=je();return n.ioctl(o,r,i)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var M=o.tty.ops.ioctl_tiocgwinsz(o.tty),i=je();ee[i>>1]=M[0],ee[i+2>>1]=M[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(y){if(typeof n>"u"||y.name!=="ErrnoError")throw y;return-y.errno}}function jt(e,r,t,o){k.varargs=o;try{r=k.getStr(r),r=k.calculateAt(e,r);var a=o?Je():0;return n.open(r,t,a).fd}catch(i){if(typeof n>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}var Me=(e,r,t)=>Ze(e,I,r,t);function Pt(e,r,t,o){try{if(r=k.getStr(r),r=k.calculateAt(e,r),o<=0)return-28;var a=n.readlink(r),i=Math.min(o,ve(a)),s=D[t+i];return Me(a,t,o+1),D[t+i]=s,i}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function xt(e){try{return e=k.getStr(e),n.rmdir(e),0}catch(r){if(typeof n>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function Xt(e,r,t){try{if(r=k.getStr(r),r=k.calculateAt(e,r),!t)n.unlink(r);else if(t===512)n.rmdir(r);else return-28;return 0}catch(o){if(typeof n>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var Xr=()=>ct,dr=e=>{var r=e.getArg(Xr(),0);return st(r)},It=()=>nt(),$t=e=>tt(e),Ir=e=>ot(e),Gt=e=>{var r=It(),t=Ir(4),o=Ir(4);ut(e,t,o);var a=b[t>>2],i=b[o>>2],s=se(a);pe(a);var u;return i&&(u=se(i),pe(i)),$t(r),[s,u]},$r=e=>{var r=dr(e);return Gt(r)},zt=e=>{var r=new WebAssembly.Exception(Xr(),[e],{traceStack:!0});throw r.message=$r(r),r},St=()=>O(""),Nt=(e,r,t,o,a)=>{},ue=e=>{for(var r="";;){var t=I[e++];if(!t)return r;r+=String.fromCharCode(t)}},Pe={},xe={},Ae={},Oe=class extends Error{constructor(e){super(e),this.name="BindingError"}},$=e=>{throw new Oe(e)};function Ot(e,r,t={}){var o=r.name;if(e||$(`type "${o}" must have a positive integer typeid pointer`),xe.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;$(`Cannot register type '${o}' twice`)}if(xe[e]=r,delete Ae[e],Pe.hasOwnProperty(e)){var a=Pe[e];delete Pe[e],a.forEach(i=>i())}}function we(e,r,t={}){return Ot(e,r,t)}var _t=(e,r,t,o)=>{r=ue(r),we(e,{name:r,fromWireType:function(a){return!!a},toWireType:function(a,i){return i?t:o},readValueFromPointer:function(a){return this.fromWireType(I[a])},destructorFunction:null})},Vt=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),vr=e=>{function r(t){return t.$$.ptrType.registeredClass.name}$(r(e)+" instance already deleted")},pr=!1,Gr=e=>{},Ht=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},zr=e=>{e.count.value-=1;var r=e.count.value===0;r&&Ht(e)},_e=e=>globalThis.FinalizationRegistry?(pr=new FinalizationRegistry(r=>{zr(r.$$)}),_e=r=>{var t=r.$$,o=!!t.smartPtr;if(o){var a={$$:t};pr.register(r,a,r)}return r},Gr=r=>pr.unregister(r),_e(e)):(_e=r=>r,e),kt=()=>{let e=er.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof er)||!(t instanceof er))return!1;var o=this.$$.ptrType.registeredClass,a=this.$$.ptr;t.$$=t.$$;for(var i=t.$$.ptrType.registeredClass,s=t.$$.ptr;o.baseClass;)a=o.upcast(a),o=o.baseClass;for(;i.baseClass;)s=i.upcast(s),i=i.baseClass;return o===i&&a===s},clone(){if(this.$$.ptr||vr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=_e(Object.create(Object.getPrototypeOf(this),{$$:{value:Vt(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||vr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$("Object already scheduled for deletion"),Gr(this),zr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||vr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;r&&(e[r]=e.delete)};function er(){}var Sr=(e,r)=>Object.defineProperty(r,"name",{value:e}),Nr={},yr=(e,r,t)=>{if(e[r].overloadTable===void 0){var o=e[r];e[r]=function(...a){return e[r].overloadTable.hasOwnProperty(a.length)||$(`Function '${t}' called with an invalid number of arguments (${a.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[a.length].apply(this,a)},e[r].overloadTable=[],e[r].overloadTable[o.argCount]=o}},Wt=(e,r,t)=>{f.hasOwnProperty(e)?($(`Cannot register public name '${e}' twice`),yr(f,e,e),f[e].overloadTable.hasOwnProperty(t)&&$(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),f[e].overloadTable[t]=r):(f[e]=r,f[e].argCount=t)},Kt=48,Tt=57,qt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Kt&&r<=Tt?`_${e}`:e};function Qt(e,r,t,o,a,i,s,u){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=o,this.baseClass=a,this.getActualType=i,this.upcast=s,this.downcast=u,this.pureVirtualFunctions=[]}var rr=(e,r,t)=>{for(;r!==t;)r.upcast||$(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e},mr=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e};function Zt(e,r){if(r===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;r.$$||$(`Cannot pass "${mr(r)}" as a ${this.name}`),r.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,o=rr(r.$$.ptr,t,this.registeredClass);return o}function Jt(e,r){var t;if(r===null)return this.isReference&&$(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&$(`Cannot pass "${mr(r)}" as a ${this.name}`),r.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&$(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var o=r.$$.ptrType.registeredClass;if(t=rr(r.$$.ptr,o,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&$("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:$(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var a=r.clone();t=this.rawShare(t,Fr.toHandle(()=>a.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:$("Unsupported sharing policy")}return t}function At(e,r){if(r===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;r.$$||$(`Cannot pass "${mr(r)}" as a ${this.name}`),r.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&$(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,o=rr(r.$$.ptr,t,this.registeredClass);return o}function tr(e){return this.fromWireType(b[e>>2])}var Or=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var o=Or(e,r,t.baseClass);return o===null?null:t.downcast(o)},eo={},ro=(e,r)=>{for(r===void 0&&$("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},to=(e,r)=>(r=ro(e,r),eo[r]),oo=class extends Error{constructor(e){super(e),this.name="InternalError"}},or=e=>{throw new oo(e)},nr=(e,r)=>{(!r.ptrType||!r.ptr)&&or("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,o=!!r.smartPtr;return t!==o&&or("Both smartPtrType and smartPtr must be specified"),r.count={value:1},_e(Object.create(e,{$$:{value:r,writable:!0}}))};function no(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=to(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var o=t.clone();return this.destructor(e),o}function a(){return this.isSmartPointer?nr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):nr(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i=this.registeredClass.getActualType(r),s=Nr[i];if(!s)return a.call(this);var u;this.isConst?u=s.constPointerType:u=s.pointerType;var h=Or(r,this.registeredClass,u.registeredClass);return h===null?a.call(this):this.isSmartPointer?nr(u.registeredClass.instancePrototype,{ptrType:u,ptr:h,smartPtrType:this,smartPtr:e}):nr(u.registeredClass.instancePrototype,{ptrType:u,ptr:h})}var ao=()=>{Object.assign(ar.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},readValueFromPointer:tr,fromWireType:no})};function ar(e,r,t,o,a,i,s,u,h,p,F){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=o,this.isSmartPointer=a,this.pointeeType=i,this.sharingPolicy=s,this.rawGetPointee=u,this.rawConstructor=h,this.rawShare=p,this.rawDestructor=F,!a&&r.baseClass===void 0?o?(this.toWireType=Zt,this.destructorFunction=null):(this.toWireType=At,this.destructorFunction=null):this.toWireType=Jt}var io=(e,r,t)=>{f.hasOwnProperty(e)||or("Replacing nonexistent public symbol"),f[e].overloadTable!==void 0&&t!==void 0?f[e].overloadTable[t]=r:(f[e]=r,f[e].argCount=t)},Ce={},so=(e,r,t)=>{e=e.replace(/p/g,"i");var o=Ce[e];return o(r,...t)},_r=e=>lt.get(e),uo=(e,r,t=[],o=!1)=>{if(e.includes("j"))return so(e,r,t);var a=_r(r),i=a(...t);return i},co=(e,r,t=!1)=>(...o)=>uo(e,r,o,t),ge=(e,r,t=!1)=>{e=ue(e);function o(){if(e.includes("j"))return co(e,r);var i=_r(r);return i}var a=o();return typeof a!="function"&&$(`unknown function pointer with signature ${e}: ${r}`),a};class lo extends Error{}var fo=e=>{var r=Jr(e),t=ue(r);return pe(r),t},Xe=(e,r)=>{var t=[],o={};function a(i){if(!o[i]&&!xe[i]){if(Ae[i]){Ae[i].forEach(a);return}t.push(i),o[i]=!0}}throw r.forEach(a),new lo(`${e}: `+t.map(fo).join([", "]))},Fe=(e,r,t)=>{e.forEach(u=>Ae[u]=r);function o(u){var h=t(u);h.length!==e.length&&or("Mismatched type converter count");for(var p=0;p<e.length;++p)we(e[p],h[p])}var a=new Array(r.length),i=[],s=0;for(let[u,h]of r.entries())xe.hasOwnProperty(h)?a[u]=xe[h]:(i.push(h),Pe.hasOwnProperty(h)||(Pe[h]=[]),Pe[h].push(()=>{a[u]=xe[h],++s,s===i.length&&o(a)}));i.length===0&&o(a)},ho=(e,r,t,o,a,i,s,u,h,p,F,C,M)=>{F=ue(F),i=ge(a,i),u&&(u=ge(s,u)),p&&(p=ge(h,p)),M=ge(C,M);var y=qt(F);Wt(y,function(){Xe(`Cannot construct ${F} due to unbound types`,[o])}),Fe([e,r,t],o?[o]:[],j=>{var ft;j=j[0];var G,_;o?(G=j.registeredClass,_=G.instancePrototype):_=er.prototype;var N=Sr(F,function(...Lr){if(Object.getPrototypeOf(this)!==te)throw new Oe(`Use 'new' to construct ${F}`);if(A.constructor_body===void 0)throw new Oe(`${F} has no accessible constructor`);var ht=A.constructor_body[Lr.length];if(ht===void 0)throw new Oe(`Tried to invoke ctor of ${F} with invalid number of parameters (${Lr.length}) - expected (${Object.keys(A.constructor_body).toString()}) parameters instead!`);return ht.apply(this,Lr)}),te=Object.create(_,{constructor:{value:N}});N.prototype=te;var A=new Qt(F,N,te,M,G,i,u,p);A.baseClass&&((ft=A.baseClass).__derivedClasses??(ft.__derivedClasses=[]),A.baseClass.__derivedClasses.push(A));var fe=new ar(F,A,!0,!1,!1),Ee=new ar(F+"*",A,!1,!1,!1),Q=new ar(F+" const*",A,!1,!0,!1);return Nr[e]={pointerType:Ee,constPointerType:Q},io(y,N),[fe,Ee,Q]})},Vr=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function Hr(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function vo(e,r,t,o){var a=Hr(e),i=e.length-2,s=[],u=["fn"];r&&u.push("thisWired");for(var h=0;h<i;++h)s.push(`arg${h}`),u.push(`arg${h}Wired`);s=s.join(","),u=u.join(",");var p=`return function (${s}) {
|
|
2
2
|
`;a&&(p+=`var destructors = [];
|
|
3
3
|
`);var F=a?"destructors":"null",C=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];r&&(p+=`var thisWired = toClassParamWire(${F}, this);
|
|
4
4
|
`);for(var h=0;h<i;++h){var M=`toArg${h}Wire`;p+=`var arg${h}Wired = ${M}(${F}, arg${h});
|
package/dist/server.mjs
CHANGED
|
@@ -2,7 +2,7 @@ var yn = Object.defineProperty;
|
|
|
2
2
|
var mn = (c, l, f) => l in c ? yn(c, l, { enumerable: !0, configurable: !0, writable: !0, value: f }) : c[l] = f;
|
|
3
3
|
var he = (c, l, f) => mn(c, typeof l != "symbol" ? l + "" : l, f);
|
|
4
4
|
import { parseHTML as wn } from "linkedom";
|
|
5
|
-
import { b as gn, d as Fn, e as En, D as Mn, h as Cn } from "./render-
|
|
5
|
+
import { b as gn, d as Fn, e as En, D as Mn, h as Cn } from "./render-SK2uaqmj.mjs";
|
|
6
6
|
var Rn = ArrayBuffer, q = Uint8Array, ur = Uint16Array, Ln = Int16Array, cr = Int32Array, Lr = function(c, l, f) {
|
|
7
7
|
if (q.prototype.slice) return q.prototype.slice.call(c, l, f);
|
|
8
8
|
(l == null || l < 0) && (l = 0), (f == null || f > c.length) && (f = c.length);
|