@php-wasm/node 0.1.32 → 0.1.37
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/index.cjs +1 -1
- package/index.d.ts +2 -1
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
`));if(!i)return null;r.input=Je(i,!0)}return r.input.shift()},put_char:function(r,i){i===null||i===10?(Qe(We(r.output,0)),r.output=[]):i!=0&&r.output.push(i)},fsync:function(r){r.output&&r.output.length>0&&(Qe(We(r.output,0)),r.output=[])}},default_tty1_ops:{put_char:function(r,i){i===null||i===10?(le(We(r.output,0)),r.output=[]):i!=0&&r.output.push(i)},fsync:function(r){r.output&&r.output.length>0&&(le(We(r.output,0)),r.output=[])}}};function Rr(r,i){return _e.fill(0,r,r+i),r}function to(r,i){return Math.ceil(r/i)*i}function Mr(r){r=to(r,65536);var i=Ln(65536,r);return i?Rr(i,r):0}var L={ops_table:null,mount:function(r){return L.createNode(null,"/",16895,0)},createNode:function(r,i,t,a){if(e.isBlkdev(t)||e.isFIFO(t))throw new e.ErrnoError(63);L.ops_table||(L.ops_table={dir:{node:{getattr:L.node_ops.getattr,setattr:L.node_ops.setattr,lookup:L.node_ops.lookup,mknod:L.node_ops.mknod,rename:L.node_ops.rename,unlink:L.node_ops.unlink,rmdir:L.node_ops.rmdir,readdir:L.node_ops.readdir,symlink:L.node_ops.symlink},stream:{llseek:L.stream_ops.llseek}},file:{node:{getattr:L.node_ops.getattr,setattr:L.node_ops.setattr},stream:{llseek:L.stream_ops.llseek,read:L.stream_ops.read,write:L.stream_ops.write,allocate:L.stream_ops.allocate,mmap:L.stream_ops.mmap,msync:L.stream_ops.msync}},link:{node:{getattr:L.node_ops.getattr,setattr:L.node_ops.setattr,readlink:L.node_ops.readlink},stream:{}},chrdev:{node:{getattr:L.node_ops.getattr,setattr:L.node_ops.setattr},stream:e.chrdev_stream_ops}});var n=e.createNode(r,i,t,a);return e.isDir(n.mode)?(n.node_ops=L.ops_table.dir.node,n.stream_ops=L.ops_table.dir.stream,n.contents={}):e.isFile(n.mode)?(n.node_ops=L.ops_table.file.node,n.stream_ops=L.ops_table.file.stream,n.usedBytes=0,n.contents=null):e.isLink(n.mode)?(n.node_ops=L.ops_table.link.node,n.stream_ops=L.ops_table.link.stream):e.isChrdev(n.mode)&&(n.node_ops=L.ops_table.chrdev.node,n.stream_ops=L.ops_table.chrdev.stream),n.timestamp=Date.now(),r&&(r.contents[i]=n,r.timestamp=n.timestamp),n},getFileDataAsTypedArray:function(r){return r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0)},expandFileStorage:function(r,i){var t=r.contents?r.contents.length:0;if(!(t>=i)){var a=1024*1024;i=Math.max(i,t*(t<a?2:1.125)>>>0),t!=0&&(i=Math.max(i,256));var n=r.contents;r.contents=new Uint8Array(i),r.usedBytes>0&&r.contents.set(n.subarray(0,r.usedBytes),0)}},resizeFileStorage:function(r,i){if(r.usedBytes!=i)if(i==0)r.contents=null,r.usedBytes=0;else{var t=r.contents;r.contents=new Uint8Array(i),t&&r.contents.set(t.subarray(0,Math.min(i,r.usedBytes))),r.usedBytes=i}},node_ops:{getattr:function(r){var i={};return i.dev=e.isChrdev(r.mode)?r.id:1,i.ino=r.id,i.mode=r.mode,i.nlink=1,i.uid=0,i.gid=0,i.rdev=r.rdev,e.isDir(r.mode)?i.size=4096:e.isFile(r.mode)?i.size=r.usedBytes:e.isLink(r.mode)?i.size=r.link.length:i.size=0,i.atime=new Date(r.timestamp),i.mtime=new Date(r.timestamp),i.ctime=new Date(r.timestamp),i.blksize=4096,i.blocks=Math.ceil(i.size/i.blksize),i},setattr:function(r,i){i.mode!==void 0&&(r.mode=i.mode),i.timestamp!==void 0&&(r.timestamp=i.timestamp),i.size!==void 0&&L.resizeFileStorage(r,i.size)},lookup:function(r,i){throw e.genericErrors[44]},mknod:function(r,i,t,a){return L.createNode(r,i,t,a)},rename:function(r,i,t){if(e.isDir(r.mode)){var a;try{a=e.lookupNode(i,t)}catch{}if(a)for(var n in a.contents)throw new e.ErrnoError(55)}delete r.parent.contents[r.name],r.parent.timestamp=Date.now(),r.name=t,i.contents[t]=r,i.timestamp=r.parent.timestamp,r.parent=i},unlink:function(r,i){delete r.contents[i],r.timestamp=Date.now()},rmdir:function(r,i){var t=e.lookupNode(r,i);for(var a in t.contents)throw new e.ErrnoError(55);delete r.contents[i],r.timestamp=Date.now()},readdir:function(r){var i=[".",".."];for(var t in r.contents)r.contents.hasOwnProperty(t)&&i.push(t);return i},symlink:function(r,i,t){var a=L.createNode(r,i,41471,0);return a.link=t,a},readlink:function(r){if(!e.isLink(r.mode))throw new e.ErrnoError(28);return r.link}},stream_ops:{read:function(r,i,t,a,n){var f=r.node.contents;if(n>=r.node.usedBytes)return 0;var m=Math.min(r.node.usedBytes-n,a);if(m>8&&f.subarray)i.set(f.subarray(n,n+m),t);else for(var u=0;u<m;u++)i[t+u]=f[n+u];return m},write:function(r,i,t,a,n,f){if(i.buffer===$.buffer&&(f=!1),!a)return 0;var m=r.node;if(m.timestamp=Date.now(),i.subarray&&(!m.contents||m.contents.subarray)){if(f)return m.contents=i.subarray(t,t+a),m.usedBytes=a,a;if(m.usedBytes===0&&n===0)return m.contents=i.slice(t,t+a),m.usedBytes=a,a;if(n+a<=m.usedBytes)return m.contents.set(i.subarray(t,t+a),n),a}if(L.expandFileStorage(m,n+a),m.contents.subarray&&i.subarray)m.contents.set(i.subarray(t,t+a),n);else for(var u=0;u<a;u++)m.contents[n+u]=i[t+u];return m.usedBytes=Math.max(m.usedBytes,n+a),a},llseek:function(r,i,t){var a=i;if(t===1?a+=r.position:t===2&&e.isFile(r.node.mode)&&(a+=r.node.usedBytes),a<0)throw new e.ErrnoError(28);return a},allocate:function(r,i,t){L.expandFileStorage(r.node,i+t),r.node.usedBytes=Math.max(r.node.usedBytes,i+t)},mmap:function(r,i,t,a,n){if(!e.isFile(r.node.mode))throw new e.ErrnoError(43);var f,m,u=r.node.contents;if(!(n&2)&&u.buffer===Ar)m=!1,f=u.byteOffset;else{if((t>0||t+i<u.length)&&(u.subarray?u=u.subarray(t,t+i):u=Array.prototype.slice.call(u,t,t+i)),m=!0,f=Mr(i),!f)throw new e.ErrnoError(48);$.set(u,f)}return{ptr:f,allocated:m}},msync:function(r,i,t,a,n){return L.stream_ops.write(r,i,0,a,t,!1),0}}};function no(r,i,t,a){var n=a?"":"al "+r;nr(r,f=>{Ne(f,'Loading data file "'+r+'" failed (no arrayBuffer).'),i(new Uint8Array(f)),n&&Ze(n)},f=>{if(t)t();else throw'Loading data file "'+r+'" failed.'}),n&&mr(n)}var wt={},M={isWindows:!1,staticInit:()=>{M.isWindows=!!process.platform.match(/^win/);var r=process.binding("constants");r.fs&&(r=r.fs),M.flagsForNodeMap={1024:r.O_APPEND,64:r.O_CREAT,128:r.O_EXCL,256:r.O_NOCTTY,0:r.O_RDONLY,2:r.O_RDWR,4096:r.O_SYNC,512:r.O_TRUNC,1:r.O_WRONLY,131072:r.O_NOFOLLOW}},convertNodeCode:r=>{var i=r.code;return wt[i]},mount:r=>M.createNode(null,"/",M.getMode(r.opts.root),0),createNode:(r,i,t,a)=>{if(!e.isDir(t)&&!e.isFile(t)&&!e.isLink(t))throw new e.ErrnoError(28);var n=e.createNode(r,i,t);return n.node_ops=M.node_ops,n.stream_ops=M.stream_ops,n},getMode:r=>{var i;try{i=V.lstatSync(r),M.isWindows&&(i.mode=i.mode|(i.mode&292)>>2)}catch(t){throw t.code?new e.ErrnoError(M.convertNodeCode(t)):t}return i.mode},realPath:r=>{for(var i=[];r.parent!==r;)i.push(r.name),r=r.parent;return i.push(r.mount.opts.root),i.reverse(),U.join.apply(null,i)},flagsForNode:r=>{r&=-2097153,r&=-2049,r&=-32769,r&=-524289,r&=-65537;var i=0;for(var t in M.flagsForNodeMap)r&t&&(i|=M.flagsForNodeMap[t],r^=t);if(r)throw new e.ErrnoError(28);return i},node_ops:{getattr:r=>{var i=M.realPath(r),t;try{t=V.lstatSync(i)}catch(a){throw a.code?new e.ErrnoError(M.convertNodeCode(a)):a}return M.isWindows&&!t.blksize&&(t.blksize=4096),M.isWindows&&!t.blocks&&(t.blocks=(t.size+t.blksize-1)/t.blksize|0),{dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,size:t.size,atime:t.atime,mtime:t.mtime,ctime:t.ctime,blksize:t.blksize,blocks:t.blocks}},setattr:(r,i)=>{var t=M.realPath(r);try{if(i.mode!==void 0&&(V.chmodSync(t,i.mode),r.mode=i.mode),i.timestamp!==void 0){var a=new Date(i.timestamp);V.utimesSync(t,a,a)}i.size!==void 0&&V.truncateSync(t,i.size)}catch(n){throw n.code?new e.ErrnoError(M.convertNodeCode(n)):n}},lookup:(r,i)=>{var t=U.join2(M.realPath(r),i),a=M.getMode(t);return M.createNode(r,i,a)},mknod:(r,i,t,a)=>{var n=M.createNode(r,i,t,a),f=M.realPath(n);try{e.isDir(n.mode)?V.mkdirSync(f,n.mode):V.writeFileSync(f,"",{mode:n.mode})}catch(m){throw m.code?new e.ErrnoError(M.convertNodeCode(m)):m}return n},rename:(r,i,t)=>{var a=M.realPath(r),n=U.join2(M.realPath(i),t);try{V.renameSync(a,n)}catch(f){throw f.code?new e.ErrnoError(M.convertNodeCode(f)):f}r.name=t},unlink:(r,i)=>{var t=U.join2(M.realPath(r),i);try{V.unlinkSync(t)}catch(a){throw a.code?new e.ErrnoError(M.convertNodeCode(a)):a}},rmdir:(r,i)=>{var t=U.join2(M.realPath(r),i);try{V.rmdirSync(t)}catch(a){throw a.code?new e.ErrnoError(M.convertNodeCode(a)):a}},readdir:r=>{var i=M.realPath(r);try{return V.readdirSync(i)}catch(t){throw t.code?new e.ErrnoError(M.convertNodeCode(t)):t}},symlink:(r,i,t)=>{var a=U.join2(M.realPath(r),i);try{V.symlinkSync(t,a)}catch(n){throw n.code?new e.ErrnoError(M.convertNodeCode(n)):n}},readlink:r=>{var i=M.realPath(r);try{return i=V.readlinkSync(i),i=Le.relative(Le.resolve(r.mount.opts.root),i),i}catch(t){throw t.code?t.code==="UNKNOWN"?new e.ErrnoError(28):new e.ErrnoError(M.convertNodeCode(t)):t}}},stream_ops:{open:r=>{var i=M.realPath(r.node);try{e.isFile(r.node.mode)&&(r.nfd=V.openSync(i,M.flagsForNode(r.flags)))}catch(t){throw t.code?new e.ErrnoError(M.convertNodeCode(t)):t}},close:r=>{try{e.isFile(r.node.mode)&&r.nfd&&V.closeSync(r.nfd)}catch(i){throw i.code?new e.ErrnoError(M.convertNodeCode(i)):i}},read:(r,i,t,a,n)=>{if(a===0)return 0;try{return V.readSync(r.nfd,Buffer.from(i.buffer),t,a,n)}catch(f){throw new e.ErrnoError(M.convertNodeCode(f))}},write:(r,i,t,a,n)=>{try{return V.writeSync(r.nfd,Buffer.from(i.buffer),t,a,n)}catch(f){throw new e.ErrnoError(M.convertNodeCode(f))}},llseek:(r,i,t)=>{var a=i;if(t===1)a+=r.position;else if(t===2&&e.isFile(r.node.mode))try{var n=V.fstatSync(r.nfd);a+=n.size}catch(f){throw new e.ErrnoError(M.convertNodeCode(f))}if(a<0)throw new e.ErrnoError(28);return a},mmap:(r,i,t,a,n)=>{if(!e.isFile(r.node.mode))throw new e.ErrnoError(43);var f=Mr(i);return M.stream_ops.read(r,$,f,i,t),{ptr:f,allocated:!0}},msync:(r,i,t,a,n)=>(M.stream_ops.write(r,i,0,a,t,!1),0)}},e={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(r,i={})=>{if(r=ge.resolve(e.cwd(),r),!r)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(i=Object.assign(t,i),i.recurse_count>8)throw new e.ErrnoError(32);for(var a=U.normalizeArray(r.split("/").filter(v=>!!v),!1),n=e.root,f="/",m=0;m<a.length;m++){var u=m===a.length-1;if(u&&i.parent)break;if(n=e.lookupNode(n,a[m]),f=U.join2(f,a[m]),e.isMountpoint(n)&&(!u||u&&i.follow_mount)&&(n=n.mounted.root),!u||i.follow)for(var o=0;e.isLink(n.mode);){var c=e.readlink(f);f=ge.resolve(U.dirname(f),c);var _=e.lookupPath(f,{recurse_count:i.recurse_count+1});if(n=_.node,o++>40)throw new e.ErrnoError(32)}}return{path:f,node:n}},getPath:r=>{for(var i;;){if(e.isRoot(r)){var t=r.mount.mountpoint;return i?t[t.length-1]!=="/"?t+"/"+i:t+i:t}i=i?r.name+"/"+i:r.name,r=r.parent}},hashName:(r,i)=>{for(var t=0,a=0;a<i.length;a++)t=(t<<5)-t+i.charCodeAt(a)|0;return(r+t>>>0)%e.nameTable.length},hashAddNode:r=>{var i=e.hashName(r.parent.id,r.name);r.name_next=e.nameTable[i],e.nameTable[i]=r},hashRemoveNode:r=>{var i=e.hashName(r.parent.id,r.name);if(e.nameTable[i]===r)e.nameTable[i]=r.name_next;else for(var t=e.nameTable[i];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode:(r,i)=>{var t=e.mayLookup(r);if(t)throw new e.ErrnoError(t,r);for(var a=e.hashName(r.id,i),n=e.nameTable[a];n;n=n.name_next){var f=n.name;if(n.parent.id===r.id&&f===i)return n}return e.lookup(r,i)},createNode:(r,i,t,a)=>{var n=new e.FSNode(r,i,t,a);return e.hashAddNode(n),n},destroyNode:r=>{e.hashRemoveNode(r)},isRoot:r=>r===r.parent,isMountpoint:r=>!!r.mounted,isFile:r=>(r&61440)===32768,isDir:r=>(r&61440)===16384,isLink:r=>(r&61440)===40960,isChrdev:r=>(r&61440)===8192,isBlkdev:r=>(r&61440)===24576,isFIFO:r=>(r&61440)===4096,isSocket:r=>(r&49152)===49152,flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:r=>{var i=e.flagModes[r];if(typeof i>"u")throw new Error("Unknown file open mode: "+r);return i},flagsToPermissionString:r=>{var i=["r","w","rw"][r&3];return r&512&&(i+="w"),i},nodePermissions:(r,i)=>e.ignorePermissions?0:i.includes("r")&&!(r.mode&292)||i.includes("w")&&!(r.mode&146)||i.includes("x")&&!(r.mode&73)?2:0,mayLookup:r=>{var i=e.nodePermissions(r,"x");return i||(r.node_ops.lookup?0:2)},mayCreate:(r,i)=>{try{var t=e.lookupNode(r,i);return 20}catch{}return e.nodePermissions(r,"wx")},mayDelete:(r,i,t)=>{var a;try{a=e.lookupNode(r,i)}catch(f){return f.errno}var n=e.nodePermissions(r,"wx");if(n)return n;if(t){if(!e.isDir(a.mode))return 54;if(e.isRoot(a)||e.getPath(a)===e.cwd())return 10}else if(e.isDir(a.mode))return 31;return 0},mayOpen:(r,i)=>r?e.isLink(r.mode)?32:e.isDir(r.mode)&&(e.flagsToPermissionString(i)!=="r"||i&512)?31:e.nodePermissions(r,e.flagsToPermissionString(i)):44,MAX_OPEN_FDS:4096,nextfd:(r=0,i=e.MAX_OPEN_FDS)=>{for(var t=r;t<=i;t++)if(!e.streams[t])return t;throw new e.ErrnoError(33)},getStream:r=>e.streams[r],createStream:(r,i,t)=>{e.FSStream||(e.FSStream=function(){this.shared={}},e.FSStream.prototype={},Object.defineProperties(e.FSStream.prototype,{object:{get:function(){return this.node},set:function(n){this.node=n}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(n){this.shared.flags=n}},position:{get:function(){return this.shared.position},set:function(n){this.shared.position=n}}})),r=Object.assign(new e.FSStream,r);var a=e.nextfd(i,t);return r.fd=a,e.streams[a]=r,r},closeStream:r=>{e.streams[r]=null},chrdev_stream_ops:{open:r=>{var i=e.getDevice(r.node.rdev);r.stream_ops=i.stream_ops,r.stream_ops.open&&r.stream_ops.open(r)},llseek:()=>{throw new e.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,i)=>r<<8|i,registerDevice:(r,i)=>{e.devices[r]={stream_ops:i}},getDevice:r=>e.devices[r],getMounts:r=>{for(var i=[],t=[r];t.length;){var a=t.pop();i.push(a),t.push.apply(t,a.mounts)}return i},syncfs:(r,i)=>{typeof r=="function"&&(i=r,r=!1),e.syncFSRequests++,e.syncFSRequests>1&&le("warning: "+e.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var t=e.getMounts(e.root.mount),a=0;function n(m){return e.syncFSRequests--,i(m)}function f(m){if(m)return f.errored?void 0:(f.errored=!0,n(m));++a>=t.length&&n(null)}t.forEach(m=>{if(!m.type.syncfs)return f(null);m.type.syncfs(m,r,f)})},mount:(r,i,t)=>{var a=t==="/",n=!t,f;if(a&&e.root)throw new e.ErrnoError(10);if(!a&&!n){var m=e.lookupPath(t,{follow_mount:!1});if(t=m.path,f=m.node,e.isMountpoint(f))throw new e.ErrnoError(10);if(!e.isDir(f.mode))throw new e.ErrnoError(54)}var u={type:r,opts:i,mountpoint:t,mounts:[]},o=r.mount(u);return o.mount=u,u.root=o,a?e.root=o:f&&(f.mounted=u,f.mount&&f.mount.mounts.push(u)),o},unmount:r=>{var i=e.lookupPath(r,{follow_mount:!1});if(!e.isMountpoint(i.node))throw new e.ErrnoError(28);var t=i.node,a=t.mounted,n=e.getMounts(a);Object.keys(e.nameTable).forEach(m=>{for(var u=e.nameTable[m];u;){var o=u.name_next;n.includes(u.mount)&&e.destroyNode(u),u=o}}),t.mounted=null;var f=t.mount.mounts.indexOf(a);t.mount.mounts.splice(f,1)},lookup:(r,i)=>r.node_ops.lookup(r,i),mknod:(r,i,t)=>{var a=e.lookupPath(r,{parent:!0}),n=a.node,f=U.basename(r);if(!f||f==="."||f==="..")throw new e.ErrnoError(28);var m=e.mayCreate(n,f);if(m)throw new e.ErrnoError(m);if(!n.node_ops.mknod)throw new e.ErrnoError(63);return n.node_ops.mknod(n,f,i,t)},create:(r,i)=>(i=i!==void 0?i:438,i&=4095,i|=32768,e.mknod(r,i,0)),mkdir:(r,i)=>(i=i!==void 0?i:511,i&=1023,i|=16384,e.mknod(r,i,0)),mkdirTree:(r,i)=>{for(var t=r.split("/"),a="",n=0;n<t.length;++n)if(t[n]){a+="/"+t[n];try{e.mkdir(a,i)}catch(f){if(f.errno!=20)throw f}}},mkdev:(r,i,t)=>(typeof t>"u"&&(t=i,i=438),i|=8192,e.mknod(r,i,t)),symlink:(r,i)=>{if(!ge.resolve(r))throw new e.ErrnoError(44);var t=e.lookupPath(i,{parent:!0}),a=t.node;if(!a)throw new e.ErrnoError(44);var n=U.basename(i),f=e.mayCreate(a,n);if(f)throw new e.ErrnoError(f);if(!a.node_ops.symlink)throw new e.ErrnoError(63);return a.node_ops.symlink(a,n,r)},rename:(r,i)=>{var t=U.dirname(r),a=U.dirname(i),n=U.basename(r),f=U.basename(i),m,u,o;if(m=e.lookupPath(r,{parent:!0}),u=m.node,m=e.lookupPath(i,{parent:!0}),o=m.node,!u||!o)throw new e.ErrnoError(44);if(u.mount!==o.mount)throw new e.ErrnoError(75);var c=e.lookupNode(u,n),_=ge.relative(r,a);if(_.charAt(0)!==".")throw new e.ErrnoError(28);if(_=ge.relative(i,t),_.charAt(0)!==".")throw new e.ErrnoError(55);var v;try{v=e.lookupNode(o,f)}catch{}if(c!==v){var p=e.isDir(c.mode),y=e.mayDelete(u,n,p);if(y)throw new e.ErrnoError(y);if(y=v?e.mayDelete(o,f,p):e.mayCreate(o,f),y)throw new e.ErrnoError(y);if(!u.node_ops.rename)throw new e.ErrnoError(63);if(e.isMountpoint(c)||v&&e.isMountpoint(v))throw new e.ErrnoError(10);if(o!==u&&(y=e.nodePermissions(u,"w"),y))throw new e.ErrnoError(y);e.hashRemoveNode(c);try{u.node_ops.rename(c,o,f)}catch(E){throw E}finally{e.hashAddNode(c)}}},rmdir:r=>{var i=e.lookupPath(r,{parent:!0}),t=i.node,a=U.basename(r),n=e.lookupNode(t,a),f=e.mayDelete(t,a,!0);if(f)throw new e.ErrnoError(f);if(!t.node_ops.rmdir)throw new e.ErrnoError(63);if(e.isMountpoint(n))throw new e.ErrnoError(10);t.node_ops.rmdir(t,a),e.destroyNode(n)},readdir:r=>{var i=e.lookupPath(r,{follow:!0}),t=i.node;if(!t.node_ops.readdir)throw new e.ErrnoError(54);return t.node_ops.readdir(t)},unlink:r=>{var i=e.lookupPath(r,{parent:!0}),t=i.node;if(!t)throw new e.ErrnoError(44);var a=U.basename(r),n=e.lookupNode(t,a),f=e.mayDelete(t,a,!1);if(f)throw new e.ErrnoError(f);if(!t.node_ops.unlink)throw new e.ErrnoError(63);if(e.isMountpoint(n))throw new e.ErrnoError(10);t.node_ops.unlink(t,a),e.destroyNode(n)},readlink:r=>{var i=e.lookupPath(r),t=i.node;if(!t)throw new e.ErrnoError(44);if(!t.node_ops.readlink)throw new e.ErrnoError(28);return ge.resolve(e.getPath(t.parent),t.node_ops.readlink(t))},stat:(r,i)=>{var t=e.lookupPath(r,{follow:!i}),a=t.node;if(!a)throw new e.ErrnoError(44);if(!a.node_ops.getattr)throw new e.ErrnoError(63);return a.node_ops.getattr(a)},lstat:r=>e.stat(r,!0),chmod:(r,i,t)=>{var a;if(typeof r=="string"){var n=e.lookupPath(r,{follow:!t});a=n.node}else a=r;if(!a.node_ops.setattr)throw new e.ErrnoError(63);a.node_ops.setattr(a,{mode:i&4095|a.mode&-4096,timestamp:Date.now()})},lchmod:(r,i)=>{e.chmod(r,i,!0)},fchmod:(r,i)=>{var t=e.getStream(r);if(!t)throw new e.ErrnoError(8);e.chmod(t.node,i)},chown:(r,i,t,a)=>{var n;if(typeof r=="string"){var f=e.lookupPath(r,{follow:!a});n=f.node}else n=r;if(!n.node_ops.setattr)throw new e.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown:(r,i,t)=>{e.chown(r,i,t,!0)},fchown:(r,i,t)=>{var a=e.getStream(r);if(!a)throw new e.ErrnoError(8);e.chown(a.node,i,t)},truncate:(r,i)=>{if(i<0)throw new e.ErrnoError(28);var t;if(typeof r=="string"){var a=e.lookupPath(r,{follow:!0});t=a.node}else t=r;if(!t.node_ops.setattr)throw new e.ErrnoError(63);if(e.isDir(t.mode))throw new e.ErrnoError(31);if(!e.isFile(t.mode))throw new e.ErrnoError(28);var n=e.nodePermissions(t,"w");if(n)throw new e.ErrnoError(n);t.node_ops.setattr(t,{size:i,timestamp:Date.now()})},ftruncate:(r,i)=>{var t=e.getStream(r);if(!t)throw new e.ErrnoError(8);if(!(t.flags&2097155))throw new e.ErrnoError(28);e.truncate(t.node,i)},utime:(r,i,t)=>{var a=e.lookupPath(r,{follow:!0}),n=a.node;n.node_ops.setattr(n,{timestamp:Math.max(i,t)})},open:(r,i,t)=>{if(r==="")throw new e.ErrnoError(44);i=typeof i=="string"?e.modeStringToFlags(i):i,t=typeof t>"u"?438:t,i&64?t=t&4095|32768:t=0;var a;if(typeof r=="object")a=r;else{r=U.normalize(r);try{var n=e.lookupPath(r,{follow:!(i&131072)});a=n.node}catch{}}var f=!1;if(i&64)if(a){if(i&128)throw new e.ErrnoError(20)}else a=e.mknod(r,t,0),f=!0;if(!a)throw new e.ErrnoError(44);if(e.isChrdev(a.mode)&&(i&=-513),i&65536&&!e.isDir(a.mode))throw new e.ErrnoError(54);if(!f){var m=e.mayOpen(a,i);if(m)throw new e.ErrnoError(m)}i&512&&!f&&e.truncate(a,0),i&=-131713;var u=e.createStream({node:a,path:e.getPath(a),flags:i,seekable:!0,position:0,stream_ops:a.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),l.logReadFiles&&!(i&1)&&(e.readFiles||(e.readFiles={}),r in e.readFiles||(e.readFiles[r]=1)),u},close:r=>{if(e.isClosed(r))throw new e.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(i){throw i}finally{e.closeStream(r.fd)}r.fd=null},isClosed:r=>r.fd===null,llseek:(r,i,t)=>{if(e.isClosed(r))throw new e.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new e.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new e.ErrnoError(28);return r.position=r.stream_ops.llseek(r,i,t),r.ungotten=[],r.position},read:(r,i,t,a,n)=>{if(a<0||n<0)throw new e.ErrnoError(28);if(e.isClosed(r))throw new e.ErrnoError(8);if((r.flags&2097155)===1)throw new e.ErrnoError(8);if(e.isDir(r.node.mode))throw new e.ErrnoError(31);if(!r.stream_ops.read)throw new e.ErrnoError(28);var f=typeof n<"u";if(!f)n=r.position;else if(!r.seekable)throw new e.ErrnoError(70);var m=r.stream_ops.read(r,i,t,a,n);return f||(r.position+=m),m},write:(r,i,t,a,n,f)=>{if(a<0||n<0)throw new e.ErrnoError(28);if(e.isClosed(r))throw new e.ErrnoError(8);if(!(r.flags&2097155))throw new e.ErrnoError(8);if(e.isDir(r.node.mode))throw new e.ErrnoError(31);if(!r.stream_ops.write)throw new e.ErrnoError(28);r.seekable&&r.flags&1024&&e.llseek(r,0,2);var m=typeof n<"u";if(!m)n=r.position;else if(!r.seekable)throw new e.ErrnoError(70);var u=r.stream_ops.write(r,i,t,a,n,f);return m||(r.position+=u),u},allocate:(r,i,t)=>{if(e.isClosed(r))throw new e.ErrnoError(8);if(i<0||t<=0)throw new e.ErrnoError(28);if(!(r.flags&2097155))throw new e.ErrnoError(8);if(!e.isFile(r.node.mode)&&!e.isDir(r.node.mode))throw new e.ErrnoError(43);if(!r.stream_ops.allocate)throw new e.ErrnoError(138);r.stream_ops.allocate(r,i,t)},mmap:(r,i,t,a,n)=>{if(a&2&&!(n&2)&&(r.flags&2097155)!==2)throw new e.ErrnoError(2);if((r.flags&2097155)===1)throw new e.ErrnoError(2);if(!r.stream_ops.mmap)throw new e.ErrnoError(43);return r.stream_ops.mmap(r,i,t,a,n)},msync:(r,i,t,a,n)=>r.stream_ops.msync?r.stream_ops.msync(r,i,t,a,n):0,munmap:r=>0,ioctl:(r,i,t)=>{if(!r.stream_ops.ioctl)throw new e.ErrnoError(59);return r.stream_ops.ioctl(r,i,t)},readFile:(r,i={})=>{if(i.flags=i.flags||0,i.encoding=i.encoding||"binary",i.encoding!=="utf8"&&i.encoding!=="binary")throw new Error('Invalid encoding type "'+i.encoding+'"');var t,a=e.open(r,i.flags),n=e.stat(r),f=n.size,m=new Uint8Array(f);return e.read(a,m,0,f,0),i.encoding==="utf8"?t=We(m,0):i.encoding==="binary"&&(t=m),e.close(a),t},writeFile:(r,i,t={})=>{t.flags=t.flags||577;var a=e.open(r,t.flags,t.mode);if(typeof i=="string"){var n=new Uint8Array(Pe(i)+1),f=Xe(i,n,0,n.length);e.write(a,n,0,f,void 0,t.canOwn)}else if(ArrayBuffer.isView(i))e.write(a,i,0,i.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");e.close(a)},cwd:()=>e.currentPath,chdir:r=>{var i=e.lookupPath(r,{follow:!0});if(i.node===null)throw new e.ErrnoError(44);if(!e.isDir(i.node.mode))throw new e.ErrnoError(54);var t=e.nodePermissions(i.node,"x");if(t)throw new e.ErrnoError(t);e.currentPath=i.path},createDefaultDirectories:()=>{e.mkdir("/tmp"),e.mkdir("/home"),e.mkdir("/home/web_user")},createDefaultDevices:()=>{e.mkdir("/dev"),e.registerDevice(e.makedev(1,3),{read:()=>0,write:(i,t,a,n,f)=>n}),e.mkdev("/dev/null",e.makedev(1,3)),Se.register(e.makedev(5,0),Se.default_tty_ops),Se.register(e.makedev(6,0),Se.default_tty1_ops),e.mkdev("/dev/tty",e.makedev(5,0)),e.mkdev("/dev/tty1",e.makedev(6,0));var r=ro();e.createDevice("/dev","random",r),e.createDevice("/dev","urandom",r),e.mkdir("/dev/shm"),e.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{e.mkdir("/proc");var r=e.mkdir("/proc/self");e.mkdir("/proc/self/fd"),e.mount({mount:()=>{var i=e.createNode(r,"fd",16895,73);return i.node_ops={lookup:(t,a)=>{var n=+a,f=e.getStream(n);if(!f)throw new e.ErrnoError(8);var m={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>f.path}};return m.parent=m,m}},i}},{},"/proc/self/fd")},createStandardStreams:()=>{l.stdin?e.createDevice("/dev","stdin",l.stdin):e.symlink("/dev/tty","/dev/stdin"),l.stdout?e.createDevice("/dev","stdout",null,l.stdout):e.symlink("/dev/tty","/dev/stdout"),l.stderr?e.createDevice("/dev","stderr",null,l.stderr):e.symlink("/dev/tty1","/dev/stderr");var r=e.open("/dev/stdin",0),i=e.open("/dev/stdout",1),t=e.open("/dev/stderr",1)},ensureErrnoError:()=>{e.ErrnoError||(e.ErrnoError=function(i,t){this.node=t,this.setErrno=function(a){this.errno=a},this.setErrno(i),this.message="FS error"},e.ErrnoError.prototype=new Error,e.ErrnoError.prototype.constructor=e.ErrnoError,[44].forEach(r=>{e.genericErrors[r]=new e.ErrnoError(r),e.genericErrors[r].stack="<generic error, no stack>"}))},staticInit:()=>{e.ensureErrnoError(),e.nameTable=new Array(4096),e.mount(L,{},"/"),e.createDefaultDirectories(),e.createDefaultDevices(),e.createSpecialDirectories(),e.filesystems={MEMFS:L,NODEFS:M}},init:(r,i,t)=>{e.init.initialized=!0,e.ensureErrnoError(),l.stdin=r||l.stdin,l.stdout=i||l.stdout,l.stderr=t||l.stderr,e.createStandardStreams()},quit:()=>{e.init.initialized=!1,Vt(0);for(var r=0;r<e.streams.length;r++){var i=e.streams[r];i&&e.close(i)}},getMode:(r,i)=>{var t=0;return r&&(t|=365),i&&(t|=146),t},findObject:(r,i)=>{var t=e.analyzePath(r,i);return t.exists?t.object:null},analyzePath:(r,i)=>{try{var t=e.lookupPath(r,{follow:!i});r=t.path}catch{}var a={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=e.lookupPath(r,{parent:!0});a.parentExists=!0,a.parentPath=t.path,a.parentObject=t.node,a.name=U.basename(r),t=e.lookupPath(r,{follow:!i}),a.exists=!0,a.path=t.path,a.object=t.node,a.name=t.node.name,a.isRoot=t.path==="/"}catch(n){a.error=n.errno}return a},createPath:(r,i,t,a)=>{r=typeof r=="string"?r:e.getPath(r);for(var n=i.split("/").reverse();n.length;){var f=n.pop();if(f){var m=U.join2(r,f);try{e.mkdir(m)}catch{}r=m}}return m},createFile:(r,i,t,a,n)=>{var f=U.join2(typeof r=="string"?r:e.getPath(r),i),m=e.getMode(a,n);return e.create(f,m)},createDataFile:(r,i,t,a,n,f)=>{var m=i;r&&(r=typeof r=="string"?r:e.getPath(r),m=i?U.join2(r,i):r);var u=e.getMode(a,n),o=e.create(m,u);if(t){if(typeof t=="string"){for(var c=new Array(t.length),_=0,v=t.length;_<v;++_)c[_]=t.charCodeAt(_);t=c}e.chmod(o,u|146);var p=e.open(o,577);e.write(p,t,0,t.length,0,f),e.close(p),e.chmod(o,u)}return o},createDevice:(r,i,t,a)=>{var n=U.join2(typeof r=="string"?r:e.getPath(r),i),f=e.getMode(!!t,!!a);e.createDevice.major||(e.createDevice.major=64);var m=e.makedev(e.createDevice.major++,0);return e.registerDevice(m,{open:u=>{u.seekable=!1},close:u=>{a&&a.buffer&&a.buffer.length&&a(10)},read:(u,o,c,_,v)=>{for(var p=0,y=0;y<_;y++){var E;try{E=t()}catch{throw new e.ErrnoError(29)}if(E===void 0&&p===0)throw new e.ErrnoError(6);if(E==null)break;p++,o[c+y]=E}return p&&(u.node.timestamp=Date.now()),p},write:(u,o,c,_,v)=>{for(var p=0;p<_;p++)try{a(o[c+p])}catch{throw new e.ErrnoError(29)}return _&&(u.node.timestamp=Date.now()),p}}),e.mkdev(n,f,m)},forceLoadFile:r=>{if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("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.");if(Ye)try{r.contents=Je(Ye(r.url),!0),r.usedBytes=r.contents.length}catch{throw new e.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile:(r,i,t,a,n)=>{function f(){this.lengthKnown=!1,this.chunks=[]}if(f.prototype.get=function(y){if(!(y>this.length-1||y<0)){var E=y%this.chunkSize,S=y/this.chunkSize|0;return this.getter(S)[E]}},f.prototype.setDataGetter=function(y){this.getter=y},f.prototype.cacheLength=function(){var y=new XMLHttpRequest;if(y.open("HEAD",t,!1),y.send(null),!(y.status>=200&&y.status<300||y.status===304))throw new Error("Couldn't load "+t+". Status: "+y.status);var E=Number(y.getResponseHeader("Content-length")),S,b=(S=y.getResponseHeader("Accept-Ranges"))&&S==="bytes",k=(S=y.getResponseHeader("Content-Encoding"))&&S==="gzip",D=1024*1024;b||(D=E);var T=(C,I)=>{if(C>I)throw new Error("invalid range ("+C+", "+I+") or no bytes requested!");if(I>E-1)throw new Error("only "+E+" bytes available! programmer error!");var W=new XMLHttpRequest;if(W.open("GET",t,!1),E!==D&&W.setRequestHeader("Range","bytes="+C+"-"+I),W.responseType="arraybuffer",W.overrideMimeType&&W.overrideMimeType("text/plain; charset=x-user-defined"),W.send(null),!(W.status>=200&&W.status<300||W.status===304))throw new Error("Couldn't load "+t+". Status: "+W.status);return W.response!==void 0?new Uint8Array(W.response||[]):Je(W.responseText||"",!0)},F=this;F.setDataGetter(C=>{var I=C*D,W=(C+1)*D-1;if(W=Math.min(W,E-1),typeof F.chunks[C]>"u"&&(F.chunks[C]=T(I,W)),typeof F.chunks[C]>"u")throw new Error("doXHR failed!");return F.chunks[C]}),(k||!E)&&(D=E=1,E=this.getter(0).length,D=E,Qe("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=E,this._chunkSize=D,this.lengthKnown=!0},typeof XMLHttpRequest<"u"){if(!fe)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var m=new f;Object.defineProperties(m,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var u={isDevice:!1,contents:m}}else var u={isDevice:!1,url:t};var o=e.createFile(r,i,u,a,n);u.contents?o.contents=u.contents:u.url&&(o.contents=null,o.url=u.url),Object.defineProperties(o,{usedBytes:{get:function(){return this.contents.length}}});var c={},_=Object.keys(o.stream_ops);_.forEach(p=>{var y=o.stream_ops[p];c[p]=function(){return e.forceLoadFile(o),y.apply(null,arguments)}});function v(p,y,E,S,b){var k=p.node.contents;if(b>=k.length)return 0;var D=Math.min(k.length-b,S);if(k.slice)for(var T=0;T<D;T++)y[E+T]=k[b+T];else for(var T=0;T<D;T++)y[E+T]=k.get(b+T);return D}return c.read=(p,y,E,S,b)=>(e.forceLoadFile(o),v(p,y,E,S,b)),c.mmap=(p,y,E,S,b)=>{e.forceLoadFile(o);var k=Mr(y);if(!k)throw new e.ErrnoError(48);return v(p,$,k,y,E),{ptr:k,allocated:!0}},o.stream_ops=c,o},createPreloadedFile:(r,i,t,a,n,f,m,u,o,c)=>{var _=i?ge.resolve(U.join2(r,i)):r,v="cp "+_;function p(y){function E(S){c&&c(),u||e.createDataFile(r,i,S,a,n,o),f&&f(),Ze(v)}Browser.handledByPreloadPlugin(y,_,E,()=>{m&&m(),Ze(v)})||E(y)}mr(v),typeof t=="string"?no(t,y=>p(y),m):p(t)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(r,i,t)=>{i=i||(()=>{}),t=t||(()=>{});var a=e.indexedDB();try{var n=a.open(e.DB_NAME(),e.DB_VERSION)}catch(f){return t(f)}n.onupgradeneeded=()=>{Qe("creating db");var f=n.result;f.createObjectStore(e.DB_STORE_NAME)},n.onsuccess=()=>{var f=n.result,m=f.transaction([e.DB_STORE_NAME],"readwrite"),u=m.objectStore(e.DB_STORE_NAME),o=0,c=0,_=r.length;function v(){c==0?i():t()}r.forEach(p=>{var y=u.put(e.analyzePath(p).object.contents,p);y.onsuccess=()=>{o++,o+c==_&&v()},y.onerror=()=>{c++,o+c==_&&v()}}),m.onerror=t},n.onerror=t},loadFilesFromDB:(r,i,t)=>{i=i||(()=>{}),t=t||(()=>{});var a=e.indexedDB();try{var n=a.open(e.DB_NAME(),e.DB_VERSION)}catch(f){return t(f)}n.onupgradeneeded=t,n.onsuccess=()=>{var f=n.result;try{var m=f.transaction([e.DB_STORE_NAME],"readonly")}catch(p){t(p);return}var u=m.objectStore(e.DB_STORE_NAME),o=0,c=0,_=r.length;function v(){c==0?i():t()}r.forEach(p=>{var y=u.get(p);y.onsuccess=()=>{e.analyzePath(p).exists&&e.unlink(p),e.createDataFile(U.dirname(p),U.basename(p),y.result,!0,!0,!0),o++,o+c==_&&v()},y.onerror=()=>{c++,o+c==_&&v()}}),m.onerror=t},n.onerror=t}},N={DEFAULT_POLLMASK:5,calculateAt:function(r,i,t){if(U.isAbs(i))return i;var a;if(r===-100)a=e.cwd();else{var n=N.getStreamFromFD(r);a=n.path}if(i.length==0){if(!t)throw new e.ErrnoError(44);return a}return U.join2(a,i)},doStat:function(r,i,t){try{var a=r(i)}catch(n){if(n&&n.node&&U.normalize(i)!==U.normalize(e.getPath(n.node)))return-54;throw n}return h[t>>2]=a.dev,h[t+8>>2]=a.ino,h[t+12>>2]=a.mode,z[t+16>>2]=a.nlink,h[t+20>>2]=a.uid,h[t+24>>2]=a.gid,h[t+28>>2]=a.rdev,q=[a.size>>>0,(P=a.size,+Math.abs(P)>=1?P>0?(Math.min(+Math.floor(P/4294967296),4294967295)|0)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],h[t+40>>2]=q[0],h[t+44>>2]=q[1],h[t+48>>2]=4096,h[t+52>>2]=a.blocks,q=[Math.floor(a.atime.getTime()/1e3)>>>0,(P=Math.floor(a.atime.getTime()/1e3),+Math.abs(P)>=1?P>0?(Math.min(+Math.floor(P/4294967296),4294967295)|0)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],h[t+56>>2]=q[0],h[t+60>>2]=q[1],z[t+64>>2]=0,q=[Math.floor(a.mtime.getTime()/1e3)>>>0,(P=Math.floor(a.mtime.getTime()/1e3),+Math.abs(P)>=1?P>0?(Math.min(+Math.floor(P/4294967296),4294967295)|0)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],h[t+72>>2]=q[0],h[t+76>>2]=q[1],z[t+80>>2]=0,q=[Math.floor(a.ctime.getTime()/1e3)>>>0,(P=Math.floor(a.ctime.getTime()/1e3),+Math.abs(P)>=1?P>0?(Math.min(+Math.floor(P/4294967296),4294967295)|0)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],h[t+88>>2]=q[0],h[t+92>>2]=q[1],z[t+96>>2]=0,q=[a.ino>>>0,(P=a.ino,+Math.abs(P)>=1?P>0?(Math.min(+Math.floor(P/4294967296),4294967295)|0)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],h[t+104>>2]=q[0],h[t+108>>2]=q[1],0},doMsync:function(r,i,t,a,n){if(!e.isFile(i.node.mode))throw new e.ErrnoError(43);if(a&2)return 0;var f=_e.slice(r,r+t);e.msync(i,f,n,t,a)},varargs:void 0,get:function(){N.varargs+=4;var r=h[N.varargs-4>>2];return r},getStr:function(r){var i=ne(r);return i},getStreamFromFD:function(r){var i=e.getStream(r);if(!i)throw new e.ErrnoError(8);return i}};function oo(r,i,t,a,n){try{for(var f=0,m=i?h[i>>2]:0,u=i?h[i+4>>2]:0,o=t?h[t>>2]:0,c=t?h[t+4>>2]:0,_=a?h[a>>2]:0,v=a?h[a+4>>2]:0,p=0,y=0,E=0,S=0,b=0,k=0,D=(i?h[i>>2]:0)|(t?h[t>>2]:0)|(a?h[a>>2]:0),T=(i?h[i+4>>2]:0)|(t?h[t+4>>2]:0)|(a?h[a+4>>2]:0),F=function(B,H,G,te){return B<32?H&te:G&te},C=0;C<r;C++){var I=1<<C%32;if(F(C,D,T,I)){var W=N.getStreamFromFD(C),K=N.DEFAULT_POLLMASK;W.stream_ops?.poll&&(K=W.stream_ops.poll(W)),K&1&&F(C,m,u,I)&&(C<32?p=p|I:y=y|I,f++),K&4&&F(C,o,c,I)&&(C<32?E=E|I:S=S|I,f++),K&2&&F(C,_,v,I)&&(C<32?b=b|I:k=k|I,f++)}}return i&&(h[i>>2]=p,h[i+4>>2]=y),t&&(h[t>>2]=E,h[t+4>>2]=S),a&&(h[a>>2]=b,h[a+4>>2]=k),f}catch(B){if(typeof e>"u"||!(B instanceof e.ErrnoError))throw B;return-B.errno}}var Y={mount:function(r){return l.websocket=l.websocket&&typeof l.websocket=="object"?l.websocket:{},l.websocket._callbacks={},l.websocket.on=function(i,t){return typeof t=="function"&&(this._callbacks[i]=t),this},l.websocket.emit=function(i,t){typeof this._callbacks[i]=="function"&&this._callbacks[i].call(this,t)},e.createNode(null,"/",16895,0)},createSocket:function(r,i,t){i&=-526337;var a=i==1;if(a&&t&&t!=6)throw new e.ErrnoError(66);var n={family:r,type:i,protocol:t,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:Y.websocket_sock_ops},f=Y.nextname(),m=e.createNode(Y.root,f,49152,0);m.sock=n;var u=e.createStream({path:f,node:m,flags:2,seekable:!1,stream_ops:Y.stream_ops});return n.stream=u,n},getSocket:function(r){var i=e.getStream(r);return!i||!e.isSocket(i.node.mode)?null:i.node.sock},stream_ops:{poll:function(r){var i=r.node.sock;return i.sock_ops.poll(i)},ioctl:function(r,i,t){var a=r.node.sock;return a.sock_ops.ioctl(a,i,t)},read:function(r,i,t,a,n){var f=r.node.sock,m=f.sock_ops.recvmsg(f,a);return m?(i.set(m.buffer,t),m.buffer.length):0},write:function(r,i,t,a,n){var f=r.node.sock;return f.sock_ops.sendmsg(f,i,t,a)},close:function(r){var i=r.node.sock;i.sock_ops.close(i)}},nextname:function(){return Y.nextname.current||(Y.nextname.current=0),"socket["+Y.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(r,i,t){var a;if(typeof i=="object"&&(a=i,i=null,t=null),a)if(a._socket)i=a._socket.remoteAddress,t=a._socket.remotePort;else{var n=/ws[s]?:\/\/([^:]+):(\d+)/.exec(a.url);if(!n)throw new Error("WebSocket URL must be in the format ws(s)://address:port");i=n[1],t=parseInt(n[2],10)}else try{var f=l.websocket&&typeof l.websocket=="object",m="ws:#".replace("#","//");if(f&&(typeof l.websocket.url=="function"?m=l.websocket.url(...arguments):typeof l.websocket.url=="string"&&(m=l.websocket.url)),m==="ws://"||m==="wss://"){var u=i.split("/");m=m+u[0]+":"+t+"/"+u.slice(1).join("/")}var o="binary";f&&typeof l.websocket.subprotocol=="string"&&(o=l.websocket.subprotocol);var c=void 0;o!=="null"&&(o=o.replace(/^ +| +$/g,"").split(/ *, */),c=o),f&&l.websocket.subprotocol===null&&(o="null",c=void 0);var _;Z?_=Cn():_=WebSocket,l.websocket.decorator&&(_=l.websocket.decorator(_)),a=new _(m,c),a.binaryType="arraybuffer"}catch{throw new e.ErrnoError(23)}var v={addr:i,port:t,socket:a,dgram_send_queue:[]};return Y.websocket_sock_ops.addPeer(r,v),Y.websocket_sock_ops.handlePeerEvents(r,v),r.type===2&&typeof r.sport<"u"&&v.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(r.sport&65280)>>8,r.sport&255])),v},getPeer:function(r,i,t){return r.peers[i+":"+t]},addPeer:function(r,i){r.peers[i.addr+":"+i.port]=i},removePeer:function(r,i){delete r.peers[i.addr+":"+i.port]},handlePeerEvents:function(r,i){var t=!0,a=function(){l.websocket.emit("open",r.stream.fd);try{for(var f=i.dgram_send_queue.shift();f;)i.socket.send(f),f=i.dgram_send_queue.shift()}catch{i.socket.close()}};function n(f){if(typeof f=="string"){var m=new TextEncoder;f=m.encode(f)}else{if(Ne(f.byteLength!==void 0),f.byteLength==0)return;f=new Uint8Array(f)}var u=t;if(t=!1,u&&f.length===10&&f[0]===255&&f[1]===255&&f[2]===255&&f[3]===255&&f[4]==="p".charCodeAt(0)&&f[5]==="o".charCodeAt(0)&&f[6]==="r".charCodeAt(0)&&f[7]==="t".charCodeAt(0)){var o=f[8]<<8|f[9];Y.websocket_sock_ops.removePeer(r,i),i.port=o,Y.websocket_sock_ops.addPeer(r,i);return}r.recv_queue.push({addr:i.addr,port:i.port,data:f}),l.websocket.emit("message",r.stream.fd)}Z?(i.socket.on("open",a),i.socket.on("message",function(f,m){m&&n(new Uint8Array(f).buffer)}),i.socket.on("close",function(){l.websocket.emit("close",r.stream.fd)}),i.socket.on("error",function(f){r.error=14,l.websocket.emit("error",[r.stream.fd,r.error,"ECONNREFUSED: Connection refused"])})):(i.socket.onopen=a,i.socket.onclose=function(){l.websocket.emit("close",r.stream.fd)},i.socket.onmessage=function(m){n(m.data)},i.socket.onerror=function(f){r.error=14,l.websocket.emit("error",[r.stream.fd,r.error,"ECONNREFUSED: Connection refused"])})},poll:function(r){if(r.type===1&&r.server)return r.pending.length?65:0;var i=0,t=r.type===1?Y.websocket_sock_ops.getPeer(r,r.daddr,r.dport):null;return(r.recv_queue.length||!t||t&&t.socket.readyState===t.socket.CLOSING||t&&t.socket.readyState===t.socket.CLOSED)&&(i|=65),(!t||t&&t.socket.readyState===t.socket.OPEN)&&(i|=4),(t&&t.socket.readyState===t.socket.CLOSING||t&&t.socket.readyState===t.socket.CLOSED)&&(i|=16),i},ioctl:function(r,i,t){switch(i){case 21531:var a=0;return r.recv_queue.length&&(a=r.recv_queue[0].data.length),h[t>>2]=a,0;default:return 28}},close:function(r){if(r.server){try{r.server.close()}catch{}r.server=null}for(var i=Object.keys(r.peers),t=0;t<i.length;t++){var a=r.peers[i[t]];try{a.socket.close()}catch{}Y.websocket_sock_ops.removePeer(r,a)}return 0},bind:function(r,i,t){if(typeof r.saddr<"u"||typeof r.sport<"u")throw new e.ErrnoError(28);if(r.saddr=i,r.sport=t,r.type===2){r.server&&(r.server.close(),r.server=null);try{r.sock_ops.listen(r,0)}catch(a){if(!(a instanceof e.ErrnoError)||a.errno!==138)throw a}}},connect:function(r,i,t){if(r.server)throw new e.ErrnoError(138);if(typeof r.daddr<"u"&&typeof r.dport<"u"){var a=Y.websocket_sock_ops.getPeer(r,r.daddr,r.dport);if(a)throw a.socket.readyState===a.socket.CONNECTING?new e.ErrnoError(7):new e.ErrnoError(30)}var n=Y.websocket_sock_ops.createPeer(r,i,t);throw r.daddr=n.addr,r.dport=n.port,new e.ErrnoError(26)},listen:function(r,i){if(!Z)throw new e.ErrnoError(138);if(r.server)throw new e.ErrnoError(28);var t=Cn().Server,a=r.saddr;l.websocket.serverDecorator&&(t=l.websocket.serverDecorator(t)),r.server=new t({host:a,port:r.sport}),l.websocket.emit("listen",r.stream.fd),r.server.on("connection",function(n){if(r.type===1){var f=Y.createSocket(r.family,r.type,r.protocol),m=Y.websocket_sock_ops.createPeer(f,n);f.daddr=m.addr,f.dport=m.port,r.pending.push(f),l.websocket.emit("connection",f.stream.fd)}else Y.websocket_sock_ops.createPeer(r,n),l.websocket.emit("connection",r.stream.fd)}),r.server.on("close",function(){l.websocket.emit("close",r.stream.fd),r.server=null}),r.server.on("error",function(n){r.error=23,l.websocket.emit("error",[r.stream.fd,r.error,"EHOSTUNREACH: Host is unreachable"])})},accept:function(r){if(!r.server||!r.pending.length)throw new e.ErrnoError(28);var i=r.pending.shift();return i.stream.flags=r.stream.flags,i},getname:function(r,i){var t,a;if(i){if(r.daddr===void 0||r.dport===void 0)throw new e.ErrnoError(53);t=r.daddr,a=r.dport}else t=r.saddr||0,a=r.sport||0;return{addr:t,port:a}},sendmsg:function(r,i,t,a,n,f){if(r.type===2){if((n===void 0||f===void 0)&&(n=r.daddr,f=r.dport),n===void 0||f===void 0)throw new e.ErrnoError(17)}else n=r.daddr,f=r.dport;var m=Y.websocket_sock_ops.getPeer(r,n,f);if(r.type===1){if(!m||m.socket.readyState===m.socket.CLOSING||m.socket.readyState===m.socket.CLOSED)throw new e.ErrnoError(53);if(m.socket.readyState===m.socket.CONNECTING)throw new e.ErrnoError(6)}ArrayBuffer.isView(i)&&(t+=i.byteOffset,i=i.buffer);var u;if(u=i.slice(t,t+a),r.type===2&&(!m||m.socket.readyState!==m.socket.OPEN))return(!m||m.socket.readyState===m.socket.CLOSING||m.socket.readyState===m.socket.CLOSED)&&(m=Y.websocket_sock_ops.createPeer(r,n,f)),m.dgram_send_queue.push(u),a;try{return m.socket.send(u),a}catch{throw new e.ErrnoError(28)}},recvmsg:function(r,i,t){if(r.type===1&&r.server)throw new e.ErrnoError(53);var a=r.recv_queue.shift();if(!a){if(r.type===1){var n=Y.websocket_sock_ops.getPeer(r,r.daddr,r.dport);if(!n)throw new e.ErrnoError(53);if(n.socket.readyState===n.socket.CLOSING||n.socket.readyState===n.socket.CLOSED)return null;throw new e.ErrnoError(6)}throw new e.ErrnoError(6)}var f=a.data.byteLength||a.data.length,m=a.data.byteOffset||0,u=a.data.buffer||a.data,o=Math.min(i,f),c={buffer:new Uint8Array(u,m,o),addr:a.addr,port:a.port};if(t&2&&(o=0),r.type===1&&o<f){var _=f-o;a.data=new Uint8Array(u,m+o,_),r.recv_queue.unshift(a)}return c}}};function ve(r){var i=Y.getSocket(r);if(!i)throw new e.ErrnoError(8);return i}function Gt(r){return h[Nn()>>2]=r,r}function lr(r){for(var i=r.split("."),t=0;t<4;t++){var a=Number(i[t]);if(isNaN(a))return null;i[t]=a}return(i[0]|i[1]<<8|i[2]<<16|i[3]<<24)>>>0}function Q(r){return parseInt(r)}function zr(r){var i,t,a,n,f=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,m=[];if(!f.test(r))return null;if(r==="::")return[0,0,0,0,0,0,0,0];for(r.startsWith("::")?r=r.replace("::","Z:"):r=r.replace("::",":Z:"),r.indexOf(".")>0?(r=r.replace(new RegExp("[.]","g"),":"),i=r.split(":"),i[i.length-4]=Q(i[i.length-4])+Q(i[i.length-3])*256,i[i.length-3]=Q(i[i.length-2])+Q(i[i.length-1])*256,i=i.slice(0,i.length-2)):i=r.split(":"),a=0,n=0,t=0;t<i.length;t++)if(typeof i[t]=="string")if(i[t]==="Z"){for(n=0;n<8-i.length+1;n++)m[t+n]=0;a=n-1}else m[t+a]=er(parseInt(i[t],16));else m[t+a]=i[t];return[m[1]<<16|m[0],m[3]<<16|m[2],m[5]<<16|m[4],m[7]<<16|m[6]]}function rr(r,i,t,a,n){switch(i){case 2:t=lr(t),Rr(r,16),n&&(h[n>>2]=16),Ee[r>>1]=i,h[r+4>>2]=t,Ee[r+2>>1]=er(a);break;case 10:t=zr(t),Rr(r,28),n&&(h[n>>2]=28),h[r>>2]=i,h[r+8>>2]=t[0],h[r+12>>2]=t[1],h[r+16>>2]=t[2],h[r+20>>2]=t[3],Ee[r+2>>1]=er(a);break;default:return 5}return 0}var re={address_map:{id:1,addrs:{},names:{}},lookup_name:function(r){var i=lr(r);if(i!==null||(i=zr(r),i!==null))return r;var t;if(re.address_map.addrs[r])t=re.address_map.addrs[r];else{var a=re.address_map.id++;Ne(a<65535,"exceeded max address mappings of 65535"),t="172.29."+(a&255)+"."+(a&65280),re.address_map.names[t]=r,re.address_map.addrs[r]=t}return t},lookup_addr:function(r){return re.address_map.names[r]?re.address_map.names[r]:null}};function io(r,i,t,a){try{var n=ve(r),f=n.sock_ops.accept(n);if(i)var m=rr(i,f.family,re.lookup_name(f.daddr),f.dport,t);return f.stream.fd}catch(u){if(typeof e>"u"||!(u instanceof e.ErrnoError))throw u;return-u.errno}}function Nr(r){return(r&255)+"."+(r>>8&255)+"."+(r>>16&255)+"."+(r>>24&255)}function rn(r){var i="",t=0,a=0,n=0,f=0,m=0,u=0,o=[r[0]&65535,r[0]>>16,r[1]&65535,r[1]>>16,r[2]&65535,r[2]>>16,r[3]&65535,r[3]>>16],c=!0,_="";for(u=0;u<5;u++)if(o[u]!==0){c=!1;break}if(c){if(_=Nr(o[6]|o[7]<<16),o[5]===-1)return i="::ffff:",i+=_,i;if(o[5]===0)return i="::",_==="0.0.0.0"&&(_=""),_==="0.0.0.1"&&(_="1"),i+=_,i}for(t=0;t<8;t++)o[t]===0&&(t-n>1&&(m=0),n=t,m++),m>a&&(a=m,f=t-a+1);for(t=0;t<8;t++){if(a>1&&o[t]===0&&t>=f&&t<f+a){t===f&&(i+=":",f===0&&(i+=":"));continue}i+=Number(en(o[t]&65535)).toString(16),i+=t<7?":":""}return i}function Et(r,i){var t=Ee[r>>1],a=en(ut[r+2>>1]),n;switch(t){case 2:if(i!==16)return{errno:28};n=h[r+4>>2],n=Nr(n);break;case 10:if(i!==28)return{errno:28};n=[h[r+8>>2],h[r+12>>2],h[r+16>>2],h[r+20>>2]],n=rn(n);break;default:return{errno:5}}return{family:t,addr:n,port:a}}function Lr(r,i,t){if(t&&r===0)return null;var a=Et(r,i);if(a.errno)throw new e.ErrnoError(a.errno);return a.addr=re.lookup_addr(a.addr)||a.addr,a}function ao(r,i,t){try{var a=ve(r),n=Lr(i,t);return a.sock_ops.bind(a,n.addr,n.port),0}catch(f){if(typeof e>"u"||!(f instanceof e.ErrnoError))throw f;return-f.errno}}function so(r){try{return r=N.getStr(r),e.chdir(r),0}catch(i){if(typeof e>"u"||!(i instanceof e.ErrnoError))throw i;return-i.errno}}function uo(r,i){try{return r=N.getStr(r),e.chmod(r,i),0}catch(t){if(typeof e>"u"||!(t instanceof e.ErrnoError))throw t;return-t.errno}}function fo(r,i,t){try{var a=ve(r),n=Lr(i,t);return a.sock_ops.connect(a,n.addr,n.port),0}catch(f){if(typeof e>"u"||!(f instanceof e.ErrnoError))throw f;return-f.errno}}function co(r){try{var i=N.getStreamFromFD(r);return e.createStream(i,0).fd}catch(t){if(typeof e>"u"||!(t instanceof e.ErrnoError))throw t;return-t.errno}}function lo(r,i,t){try{var a=N.getStreamFromFD(r);if(a.fd===i)return-28;var n=e.getStream(i);return n&&e.close(n),e.createStream(a,i,i+1).fd}catch(f){if(typeof e>"u"||!(f instanceof e.ErrnoError))throw f;return-f.errno}}function _o(r,i,t,a){try{if(i=N.getStr(i),i=N.calculateAt(r,i),t&-8)return-28;var n=e.lookupPath(i,{follow:!0}),f=n.node;if(!f)return-44;var m="";return t&4&&(m+="r"),t&2&&(m+="w"),t&1&&(m+="x"),m&&e.nodePermissions(f,m)?-2:0}catch(u){if(typeof e>"u"||!(u instanceof e.ErrnoError))throw u;return-u.errno}}function $r(r,i){try{return e.fchmod(r,i),0}catch(t){if(typeof e>"u"||!(t instanceof e.ErrnoError))throw t;return-t.errno}}function mo(r,i,t){try{return e.fchown(r,i,t),0}catch(a){if(typeof e>"u"||!(a instanceof e.ErrnoError))throw a;return-a.errno}}function vo(r,i,t,a,n){try{i=N.getStr(i);var f=n&256;return n=n&-257,i=N.calculateAt(r,i),(f?e.lchown:e.chown)(i,t,a),0}catch(m){if(typeof e>"u"||!(m instanceof e.ErrnoError))throw m;return-m.errno}}function po(r,i,t){N.varargs=t;try{var a=N.getStreamFromFD(r);switch(i){case 0:{var n=N.get();if(n<0)return-28;var f;return f=e.createStream(a,n),f.fd}case 1:case 2:return 0;case 3:return a.flags;case 4:{var n=N.get();return a.flags|=n,0}case 5:{var n=N.get(),m=0;return Ee[n+m>>1]=2,0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:return Gt(28),-1;default:return-28}}catch(u){if(typeof e>"u"||!(u instanceof e.ErrnoError))throw u;return-u.errno}}function ho(r,i){try{var t=N.getStreamFromFD(r);return N.doStat(e.stat,t.path,i)}catch(a){if(typeof e>"u"||!(a instanceof e.ErrnoError))throw a;return-a.errno}}function tn(r,i){return i+2097152>>>0<4194305-!!r?(r>>>0)+i*4294967296:NaN}function yo(r,i,t){try{var a=tn(i,t);return isNaN(a)?-61:(e.ftruncate(r,a),0)}catch(n){if(typeof e>"u"||!(n instanceof e.ErrnoError))throw n;return-n.errno}}function wo(r,i){try{if(i===0)return-28;var t=e.cwd(),a=Pe(t)+1;return i<a?-68:(Ce(t,r,i),a)}catch(n){if(typeof e>"u"||!(n instanceof e.ErrnoError))throw n;return-n.errno}}function Eo(r,i,t){try{var a=N.getStreamFromFD(r);a.getdents||(a.getdents=e.readdir(a.path));for(var n=280,f=0,m=e.llseek(a,0,1),u=Math.floor(m/n);u<a.getdents.length&&f+n<=t;){var o,c,_=a.getdents[u];if(_===".")o=a.node.id,c=4;else if(_===".."){var v=e.lookupPath(a.path,{parent:!0});o=v.node.id,c=4}else{var p=e.lookupNode(a.node,_);o=p.id,c=e.isChrdev(p.mode)?2:e.isDir(p.mode)?4:e.isLink(p.mode)?10:8}q=[o>>>0,(P=o,+Math.abs(P)>=1?P>0?(Math.min(+Math.floor(P/4294967296),4294967295)|0)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],h[i+f>>2]=q[0],h[i+f+4>>2]=q[1],q=[(u+1)*n>>>0,(P=(u+1)*n,+Math.abs(P)>=1?P>0?(Math.min(+Math.floor(P/4294967296),4294967295)|0)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],h[i+f+8>>2]=q[0],h[i+f+12>>2]=q[1],Ee[i+f+16>>1]=280,$[i+f+18>>0]=c,Ce(_,i+f+19,256),f+=n,u+=1}return e.llseek(a,u*n,0),f}catch(y){if(typeof e>"u"||!(y instanceof e.ErrnoError))throw y;return-y.errno}}function go(r,i,t){try{var a=ve(r);if(!a.daddr)return-53;var n=rr(i,a.family,re.lookup_name(a.daddr),a.dport,t);return 0}catch(f){if(typeof e>"u"||!(f instanceof e.ErrnoError))throw f;return-f.errno}}function So(r,i,t){try{le("__syscall_getsockname "+r);var a=ve(r),n=rr(i,a.family,re.lookup_name(a.saddr||"0.0.0.0"),a.sport,t);return 0}catch(f){if(typeof e>"u"||!(f instanceof e.ErrnoError))throw f;return-f.errno}}function bo(r,i,t,a,n){try{var f=ve(r);return i===1&&t===4?(h[a>>2]=f.error,h[n>>2]=4,f.error=null,0):-50}catch(m){if(typeof e>"u"||!(m instanceof e.ErrnoError))throw m;return-m.errno}}function ko(r,i,t){N.varargs=t;try{var a=N.getStreamFromFD(r);switch(i){case 21509:case 21505:return a.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return a.tty?0:-59;case 21519:{if(!a.tty)return-59;var n=N.get();return h[n>>2]=0,0}case 21520:return a.tty?-28:-59;case 21531:{var n=N.get();return e.ioctl(a,i,n)}case 21523:return a.tty?0:-59;case 21524:return a.tty?0:-59;default:return-28}}catch(f){if(typeof e>"u"||!(f instanceof e.ErrnoError))throw f;return-f.errno}}function Do(r,i){try{var t=ve(r);return t.sock_ops.listen(t,i),0}catch(a){if(typeof e>"u"||!(a instanceof e.ErrnoError))throw a;return-a.errno}}function Oo(r,i){try{return r=N.getStr(r),N.doStat(e.lstat,r,i)}catch(t){if(typeof e>"u"||!(t instanceof e.ErrnoError))throw t;return-t.errno}}function No(r,i,t){try{return i=N.getStr(i),i=N.calculateAt(r,i),i=U.normalize(i),i[i.length-1]==="/"&&(i=i.substr(0,i.length-1)),e.mkdir(i,t,0),0}catch(a){if(typeof e>"u"||!(a instanceof e.ErrnoError))throw a;return-a.errno}}function To(r,i,t,a){try{i=N.getStr(i);var n=a&256,f=a&4096;return a=a&-4353,i=N.calculateAt(r,i,f),N.doStat(n?e.lstat:e.stat,i,t)}catch(m){if(typeof e>"u"||!(m instanceof e.ErrnoError))throw m;return-m.errno}}function Fo(r,i,t,a){N.varargs=a;try{i=N.getStr(i),i=N.calculateAt(r,i);var n=a?N.get():0;return e.open(i,t,n).fd}catch(f){if(typeof e>"u"||!(f instanceof e.ErrnoError))throw f;return-f.errno}}var se={BUCKET_BUFFER_SIZE:8192,mount:function(r){return e.createNode(null,"/",16895,0)},createPipe:function(){var r={buckets:[],refcnt:2};r.buckets.push({buffer:new Uint8Array(se.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var i=se.nextname(),t=se.nextname(),a=e.createNode(se.root,i,4096,0),n=e.createNode(se.root,t,4096,0);a.pipe=r,n.pipe=r;var f=e.createStream({path:i,node:a,flags:0,seekable:!1,stream_ops:se.stream_ops});a.stream=f;var m=e.createStream({path:t,node:n,flags:1,seekable:!1,stream_ops:se.stream_ops});return n.stream=m,{readable_fd:f.fd,writable_fd:m.fd}},stream_ops:{poll:function(r){var i=r.node.pipe;if((r.flags&2097155)===1)return 260;if(i.buckets.length>0)for(var t=0;t<i.buckets.length;t++){var a=i.buckets[t];if(a.offset-a.roffset>0)return 65}return 0},ioctl:function(r,i,t){return 28},fsync:function(r){return 28},read:function(r,i,t,a,n){for(var f=r.node.pipe,m=0,u=0;u<f.buckets.length;u++){var o=f.buckets[u];m+=o.offset-o.roffset}Ne(i instanceof ArrayBuffer||ArrayBuffer.isView(i));var c=i.subarray(t,t+a);if(a<=0)return 0;if(m==0)throw new e.ErrnoError(6);for(var _=Math.min(m,a),v=_,p=0,u=0;u<f.buckets.length;u++){var y=f.buckets[u],E=y.offset-y.roffset;if(_<=E){var S=y.buffer.subarray(y.roffset,y.offset);_<E?(S=S.subarray(0,_),y.roffset+=_):p++,c.set(S);break}else{var S=y.buffer.subarray(y.roffset,y.offset);c.set(S),c=c.subarray(S.byteLength),_-=S.byteLength,p++}}return p&&p==f.buckets.length&&(p--,f.buckets[p].offset=0,f.buckets[p].roffset=0),f.buckets.splice(0,p),v},write:function(r,i,t,a,n){var f=r.node.pipe;Ne(i instanceof ArrayBuffer||ArrayBuffer.isView(i));var m=i.subarray(t,t+a),u=m.byteLength;if(u<=0)return 0;var o=null;f.buckets.length==0?(o={buffer:new Uint8Array(se.BUCKET_BUFFER_SIZE),offset:0,roffset:0},f.buckets.push(o)):o=f.buckets[f.buckets.length-1],Ne(o.offset<=se.BUCKET_BUFFER_SIZE);var c=se.BUCKET_BUFFER_SIZE-o.offset;if(c>=u)return o.buffer.set(m,o.offset),o.offset+=u,u;c>0&&(o.buffer.set(m.subarray(0,c),o.offset),o.offset+=c,m=m.subarray(c,m.byteLength));for(var _=m.byteLength/se.BUCKET_BUFFER_SIZE|0,v=m.byteLength%se.BUCKET_BUFFER_SIZE,p=0;p<_;p++){var y={buffer:new Uint8Array(se.BUCKET_BUFFER_SIZE),offset:se.BUCKET_BUFFER_SIZE,roffset:0};f.buckets.push(y),y.buffer.set(m.subarray(0,se.BUCKET_BUFFER_SIZE)),m=m.subarray(se.BUCKET_BUFFER_SIZE,m.byteLength)}if(v>0){var y={buffer:new Uint8Array(se.BUCKET_BUFFER_SIZE),offset:m.byteLength,roffset:0};f.buckets.push(y),y.buffer.set(m)}return u},close:function(r){var i=r.node.pipe;i.refcnt--,i.refcnt===0&&(i.buckets=null)}},nextname:function(){return se.nextname.current||(se.nextname.current=0),"pipe["+se.nextname.current+++"]"}};function Ao(r){try{if(r==0)throw new e.ErrnoError(21);var i=se.createPipe();return h[r>>2]=i.readable_fd,h[r+4>>2]=i.writable_fd,0}catch(t){if(typeof e>"u"||!(t instanceof e.ErrnoError))throw t;return-t.errno}}function pe(r,i,t){try{for(var a=0,n=0;n<i;n++){var f=r+8*n,m=h[f>>2],u=Ee[f+4>>1],o=32,c=e.getStream(m);c&&(o=N.DEFAULT_POLLMASK,c.stream_ops?.poll&&(o=c.stream_ops.poll(c))),o&=u|8|16,o&&a++,Ee[f+6>>1]=o}return a}catch(_){if(typeof e>"u"||!(_ instanceof e.ErrnoError))throw _;return-_.errno}}function Co(r,i,t,a){try{if(i=N.getStr(i),i=N.calculateAt(r,i),a<=0)return-28;var n=e.readlink(i),f=Math.min(a,Pe(n)),m=$[t+f];return Ce(n,t,a+1),$[t+f]=m,f}catch(u){if(typeof e>"u"||!(u instanceof e.ErrnoError))throw u;return-u.errno}}function Po(r,i,t,a,n,f){try{var m=ve(r),u=m.sock_ops.recvmsg(m,t,typeof a<"u"?a:0);if(!u)return 0;if(n)var o=rr(n,m.family,re.lookup_name(u.addr),u.port,f);return _e.set(u.buffer,i),u.buffer.byteLength}catch(c){if(typeof e>"u"||!(c instanceof e.ErrnoError))throw c;return-c.errno}}function Ro(r,i,t,a){try{return i=N.getStr(i),a=N.getStr(a),i=N.calculateAt(r,i),a=N.calculateAt(t,a),e.rename(i,a),0}catch(n){if(typeof e>"u"||!(n instanceof e.ErrnoError))throw n;return-n.errno}}function Mo(r){try{return r=N.getStr(r),e.rmdir(r),0}catch(i){if(typeof e>"u"||!(i instanceof e.ErrnoError))throw i;return-i.errno}}function Lo(r,i,t,a,n,f){try{var m=ve(r),u=Lr(n,f,!0);return u?m.sock_ops.sendmsg(m,$,i,t,u.addr,u.port):e.write(m.stream,$,i,t)}catch(o){if(typeof e>"u"||!(o instanceof e.ErrnoError))throw o;return-o.errno}}function Io(r,i,t){try{var a=Y.createSocket(r,i,t);return a.stream.fd}catch(n){if(typeof e>"u"||!(n instanceof e.ErrnoError))throw n;return-n.errno}}function Uo(r,i){try{return r=N.getStr(r),N.doStat(e.stat,r,i)}catch(t){if(typeof e>"u"||!(t instanceof e.ErrnoError))throw t;return-t.errno}}function Bo(r,i,t){try{return r=N.getStr(r),h[t+4>>2]=4096,h[t+40>>2]=4096,h[t+8>>2]=1e6,h[t+12>>2]=5e5,h[t+16>>2]=5e5,h[t+20>>2]=e.nextInode,h[t+24>>2]=1e6,h[t+28>>2]=42,h[t+44>>2]=2,h[t+36>>2]=255,0}catch(a){if(typeof e>"u"||!(a instanceof e.ErrnoError))throw a;return-a.errno}}function xo(r,i){try{return r=N.getStr(r),i=N.getStr(i),e.symlink(r,i),0}catch(t){if(typeof e>"u"||!(t instanceof e.ErrnoError))throw t;return-t.errno}}function Ho(r,i,t){try{return i=N.getStr(i),i=N.calculateAt(r,i),t===0?e.unlink(i):t===512?e.rmdir(i):ue("Invalid flags passed to unlinkat"),0}catch(a){if(typeof e>"u"||!(a instanceof e.ErrnoError))throw a;return-a.errno}}function xr(r){return z[r>>2]+h[r+4>>2]*4294967296}function zo(r,i,t,a){try{if(i=N.getStr(i),i=N.calculateAt(r,i,!0),t){var m=xr(t),u=h[t+8>>2];n=m*1e3+u/(1e3*1e3),t+=16,m=xr(t),u=h[t+8>>2],f=m*1e3+u/(1e3*1e3)}else var n=Date.now(),f=n;return e.utime(i,n,f),0}catch(o){if(typeof e>"u"||!(o instanceof e.ErrnoError))throw o;return-o.errno}}function Zr(r){}var nn="To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking";function Wo(r,i){ue(nn)}function mn(r,i){ue(nn)}var jo=!0;function Yo(){return jo}function qo(){throw 1/0}function Vo(r,i){var t=new Date(xr(r)*1e3);h[i>>2]=t.getUTCSeconds(),h[i+4>>2]=t.getUTCMinutes(),h[i+8>>2]=t.getUTCHours(),h[i+12>>2]=t.getUTCDate(),h[i+16>>2]=t.getUTCMonth(),h[i+20>>2]=t.getUTCFullYear()-1900,h[i+24>>2]=t.getUTCDay();var a=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),n=(t.getTime()-a)/(1e3*60*60*24)|0;h[i+28>>2]=n}function Ko(r,i){var t=new Date(xr(r)*1e3);h[i>>2]=t.getSeconds(),h[i+4>>2]=t.getMinutes(),h[i+8>>2]=t.getHours(),h[i+12>>2]=t.getDate(),h[i+16>>2]=t.getMonth(),h[i+20>>2]=t.getFullYear()-1900,h[i+24>>2]=t.getDay();var a=new Date(t.getFullYear(),0,1),n=(t.getTime()-a.getTime())/(1e3*60*60*24)|0;h[i+28>>2]=n,h[i+36>>2]=-(t.getTimezoneOffset()*60);var f=new Date(t.getFullYear(),6,1).getTimezoneOffset(),m=a.getTimezoneOffset(),u=(f!=m&&t.getTimezoneOffset()==Math.min(m,f))|0;h[i+32>>2]=u}function Go(r){var i=new Date(h[r+20>>2]+1900,h[r+16>>2],h[r+12>>2],h[r+8>>2],h[r+4>>2],h[r>>2],0),t=h[r+32>>2],a=i.getTimezoneOffset(),n=new Date(i.getFullYear(),0,1),f=new Date(i.getFullYear(),6,1).getTimezoneOffset(),m=n.getTimezoneOffset(),u=Math.min(m,f);if(t<0)h[r+32>>2]=+(f!=m&&u==a);else if(t>0!=(u==a)){var o=Math.max(m,f),c=t>0?u:o;i.setTime(i.getTime()+(c-a)*6e4)}h[r+24>>2]=i.getDay();var _=(i.getTime()-n.getTime())/(1e3*60*60*24)|0;return h[r+28>>2]=_,h[r>>2]=i.getSeconds(),h[r+4>>2]=i.getMinutes(),h[r+8>>2]=i.getHours(),h[r+12>>2]=i.getDate(),h[r+16>>2]=i.getMonth(),h[r+20>>2]=i.getYear(),i.getTime()/1e3|0}function Xo(r,i,t,a,n,f){try{var m=N.getStreamFromFD(a),u=e.mmap(m,r,n,i,t),o=u.ptr;return h[f>>2]=u.allocated,o}catch(c){if(typeof e>"u"||!(c instanceof e.ErrnoError))throw c;return-c.errno}}function $o(r,i,t,a,n,f){try{var m=N.getStreamFromFD(n);t&2&&N.doMsync(r,m,i,a,f),e.munmap(m)}catch(u){if(typeof e>"u"||!(u instanceof e.ErrnoError))throw u;return-u.errno}}function on(r){var i=Pe(r)+1,t=kt(i);return t&&Xe(r,$,t,i),t}function Zo(r,i,t){var a=new Date().getFullYear(),n=new Date(a,0,1),f=new Date(a,6,1),m=n.getTimezoneOffset(),u=f.getTimezoneOffset(),o=Math.max(m,u);h[r>>2]=o*60,h[i>>2]=+(m!=u);function c(E){var S=E.toTimeString().match(/\(([A-Za-z ]+)\)$/);return S?S[1]:"GMT"}var _=c(n),v=c(f),p=on(_),y=on(v);u<m?(z[t>>2]=p,z[t+4>>2]=y):(z[t>>2]=y,z[t+4>>2]=p)}function Wr(r,i,t){Wr.called||(Wr.called=!0,Zo(r,i,t))}function Jo(){ue("")}function Ut(){return Date.now()}function an(){return 2147483648}function Qo(){return an()}var jr;Z?jr=()=>{var r=process.hrtime();return r[0]*1e3+r[1]/1e6}:jr=()=>performance.now();function ei(r,i,t){_e.copyWithin(r,i,i+t)}function Bt(r){try{return or.grow(r-Ar.byteLength+65535>>>16),ct(or.buffer),1}catch{}}function ri(r){var i=_e.length;r=r>>>0;var t=an();if(r>t)return!1;let a=(o,c)=>o+(c-o%c)%c;for(var n=1;n<=4;n*=2){var f=i*(1+.2/n);f=Math.min(f,r+100663296);var m=Math.min(t,a(Math.max(r,f),65536)),u=Bt(m);if(u)return!0}return!1}function En(r){Ge=r,_r()||(l.onExit&&l.onExit(r),Fe=!0),ee(r,new vr(r))}function ti(r,i){Ge=r,_r()||qn(),En(r)}var gt=ti;function ni(){if(!_r())try{gt(Ge)}catch(r){ht(r)}}function St(r){if(!(mt||Fe))try{r(),ni()}catch(i){ht(i)}}function rt(){Cr+=1}function Yr(){Cr-=1}function xt(r,i){return rt(),setTimeout(function(){Yr(),St(r)},i)}function Ht(r){return be.handleSleep(i=>xt(i,r))}var tt=O.ENV||{};function oi(){return J||"./this.program"}function dr(){if(!dr.strings){var r=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",i={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:r,_:oi()};for(var t in tt)tt[t]===void 0?delete i[t]:i[t]=tt[t];var a=[];for(var t in i)a.push(t+"="+i[t]);dr.strings=a}return dr.strings}function nt(r,i,t){for(var a=0;a<r.length;++a)$[i++>>0]=r.charCodeAt(a);t||($[i>>0]=0)}function Ur(r,i){var t=0;return dr().forEach(function(a,n){var f=i+t;z[r+n*4>>2]=f,nt(a,f),t+=a.length+1}),0}function zt(r,i){var t=dr();z[r>>2]=t.length;var a=0;return t.forEach(function(n){a+=n.length+1}),z[i>>2]=a,0}function ii(r){try{var i=N.getStreamFromFD(r);return e.close(i),0}catch(t){if(typeof e>"u"||!(t instanceof e.ErrnoError))throw t;return t.errno}}function ai(r,i){try{var t=N.getStreamFromFD(r),a=t.tty?2:e.isDir(t.mode)?3:e.isLink(t.mode)?7:4;return $[i>>0]=a,0}catch(n){if(typeof e>"u"||!(n instanceof e.ErrnoError))throw n;return n.errno}}function si(r,i,t,a){for(var n=0,f=0;f<t;f++){var m=z[i>>2],u=z[i+4>>2];i+=8;var o=e.read(r,$,m,u,a);if(o<0)return-1;if(n+=o,o<u)break}return n}function ui(r,i,t,a){try{var n=N.getStreamFromFD(r),f=si(n,i,t);return z[a>>2]=f,0}catch(m){if(typeof e>"u"||!(m instanceof e.ErrnoError))throw m;return m.errno}}function fi(r,i,t,a,n){try{var f=tn(i,t);if(isNaN(f))return 61;var m=N.getStreamFromFD(r);return e.llseek(m,f,a),q=[m.position>>>0,(P=m.position,+Math.abs(P)>=1?P>0?(Math.min(+Math.floor(P/4294967296),4294967295)|0)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],h[n>>2]=q[0],h[n+4>>2]=q[1],m.getdents&&f===0&&a===0&&(m.getdents=null),0}catch(u){if(typeof e>"u"||!(u instanceof e.ErrnoError))throw u;return u.errno}}function ci(r){try{var i=N.getStreamFromFD(r);return be.handleSleep(function(t){var a=i.node.mount;if(!a.type.syncfs){t(0);return}a.type.syncfs(a,!1,function(n){if(n){t(function(){return 29});return}t(0)})})}catch(t){if(typeof e>"u"||!(t instanceof e.ErrnoError))throw t;return t.errno}}function li(r,i,t,a){for(var n=0,f=0;f<t;f++){var m=z[i>>2],u=z[i+4>>2];i+=8;var o=e.write(r,$,m,u,a);if(o<0)return-1;n+=o}return n}function di(r,i,t,a){try{var n=N.getStreamFromFD(r),f=li(n,i,t);return z[a>>2]=f,0}catch(m){if(typeof e>"u"||!(m instanceof e.ErrnoError))throw m;return m.errno}}function vn(r){var i=kt(20),t=kt(r.length+1);Ce(r,t,r.length+1),z[i>>2]=t;var a=kt(4);z[a>>2]=0,z[i+4>>2]=a;var n=2;h[i+8>>2]=n,h[i+12>>2]=4;var f=kt(12);return z[f>>2]=f+8,z[f+4>>2]=0,h[f+8>>2]=lr(re.lookup_name(r)),z[i+16>>2]=f,i}function Pn(r,i,t){if(t!==2)return Gt(5),null;r=h[r>>2];var a=Nr(r),n=re.lookup_addr(a);return n&&(a=n),vn(a)}function On(r){return vn(ne(r))}function _i(r,i){for(var t=Math.min(i,3),a=8,n=0;n<t;n++)ft[r+n*a>>3]=.1;return t}function mi(r,i,t,a,n,f,m){var u=Et(r,i);if(u.errno)return-6;var o=u.port,c=u.addr,_=!1;if(t&&a){var v;if(m&1||!(v=re.lookup_addr(c))){if(m&8)return-2}else c=v;var p=Ce(c,t,a);p+1>=a&&(_=!0)}if(n&&f){o=""+o;var p=Ce(o,n,f);p+1>=f&&(_=!0)}return _?-12:0}var gn={list:[],map:{}};function Qr(r){function i(f,m,u){var o=kt(f.length+1);nt(f,o);for(var c=0,_=u.length,v=kt((_+1)*4),p=0;p<_;p++,c+=4){var y=u[p],E=kt(y.length+1);nt(y,E),z[v+c>>2]=E}z[v+c>>2]=0;var S=kt(12);return z[S>>2]=o,z[S+4>>2]=v,h[S+8>>2]=m,S}var t=gn.list,a=gn.map;if(t.length===0){var n=i("tcp",6,["TCP"]);t.push(n),a.tcp=a[6]=n,n=i("udp",17,["UDP"]),t.push(n),a.udp=a[17]=n}Qr.index=0}function bt(r){r=ne(r),Qr(!0);var i=gn.map[r];return i}function Wt(r){Qr(!0);var i=gn.map[r];return i}function jt(r){var i=Pe(r)+1,t=Oe(i);return Xe(r,$,t,i),t}var br={getAllWebSockets:function(r){let i=new Set;r.server&&r.server.clients.forEach(t=>{i.add(t)});for(let t of br.getAllPeers(r))i.add(t.socket);return Array.from(i)},getAllPeers:function(r){let i=new Set;if(r.server&&r.pending.filter(t=>t.peers).forEach(t=>{for(let a of Object.values(t.peers))i.add(a)}),r.peers)for(let t of Object.values(r.peers))i.add(t);return Array.from(i)},awaitData:function(r){return br.awaitWsEvent(r,"message")},awaitConnection:function(r){return r.OPEN===r.readyState?[Promise.resolve(),br.noop]:br.awaitWsEvent(r,"open")},awaitClose:function(r){return[r.CLOSING,r.CLOSED].includes(r.readyState)?[Promise.resolve(),br.noop]:br.awaitWsEvent(r,"close")},awaitError:function(r){return[r.CLOSING,r.CLOSED].includes(r.readyState)?[Promise.resolve(),br.noop]:br.awaitWsEvent(r,"error")},awaitWsEvent:function(r,i){let t,a=()=>{t()};return[new Promise(function(m){t=m,r.once(i,a)}),()=>{r.removeListener(i,a),setTimeout(t)}]},noop:function(){},shutdownSocket:function(r,i){let t=ve(r),a=Object.values(t.peers)[0];if(!a)return-1;try{return a.socket.close(),Y.websocket_sock_ops.removePeer(t,a),0}catch(n){return console.log("Socket shutdown error",n),-1}}};function je(r,i,t){if(!r)return 1;let a=ne(r);if(!a.length)return 0;let n=ne(i);if(!n.length)return 0;if(l.popen_to_file){let{path:f,exitCode:m}=l.popen_to_file(a,n);return _e[t]=m,jt(f)}if(Z){let f=require("os").tmpdir(),m="php-process-stream",u=f+"/"+m,o=require("child_process"),c;if(n==="r")c=o.spawnSync(a,[],{shell:!0,stdio:["inherit","pipe","inherit"]}),_e[t]=c.status,require("fs").writeFileSync(u,c.stdout,{encoding:"utf8",flag:"w+"});else return n==="w"?(console.error("popen mode w not implemented yet"),_W_EXITCODE(0,2)):(console.error("invalid mode "+n+" (should be r or w)"),_W_EXITCODE(0,2));return jt(u)}throw new Error("popen() is unsupported in the browser. Implement popen_to_file in your Module or disable shell_exec() and similar functions via php.ini.")}function Tr(r){return r%4===0&&(r%100!==0||r%400===0)}function Ue(r,i){for(var t=0,a=0;a<=i;t+=r[a++]);return t}var ir=[31,29,31,30,31,30,31,31,30,31,30,31],qe=[31,28,31,30,31,30,31,31,30,31,30,31];function Er(r,i){for(var t=new Date(r.getTime());i>0;){var a=Tr(t.getFullYear()),n=t.getMonth(),f=(a?ir:qe)[n];if(i>f-t.getDate())i-=f-t.getDate()+1,t.setDate(1),n<11?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+i),t}return t}function fr(r,i,t,a){var n=h[a+40>>2],f={tm_sec:h[a>>2],tm_min:h[a+4>>2],tm_hour:h[a+8>>2],tm_mday:h[a+12>>2],tm_mon:h[a+16>>2],tm_year:h[a+20>>2],tm_wday:h[a+24>>2],tm_yday:h[a+28>>2],tm_isdst:h[a+32>>2],tm_gmtoff:h[a+36>>2],tm_zone:n?ne(n):""},m=ne(t),u={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var o in u)m=m.replace(new RegExp(o,"g"),u[o]);var c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],_=["January","February","March","April","May","June","July","August","September","October","November","December"];function v(D,T,F){for(var C=typeof D=="number"?D.toString():D||"";C.length<T;)C=F[0]+C;return C}function p(D,T){return v(D,T,"0")}function y(D,T){function F(I){return I<0?-1:I>0?1:0}var C;return(C=F(D.getFullYear()-T.getFullYear()))===0&&(C=F(D.getMonth()-T.getMonth()))===0&&(C=F(D.getDate()-T.getDate())),C}function E(D){switch(D.getDay()){case 0:return new Date(D.getFullYear()-1,11,29);case 1:return D;case 2:return new Date(D.getFullYear(),0,3);case 3:return new Date(D.getFullYear(),0,2);case 4:return new Date(D.getFullYear(),0,1);case 5:return new Date(D.getFullYear()-1,11,31);case 6:return new Date(D.getFullYear()-1,11,30)}}function S(D){var T=Er(new Date(D.tm_year+1900,0,1),D.tm_yday),F=new Date(T.getFullYear(),0,4),C=new Date(T.getFullYear()+1,0,4),I=E(F),W=E(C);return y(I,T)<=0?y(W,T)<=0?T.getFullYear()+1:T.getFullYear():T.getFullYear()-1}var b={"%a":function(D){return c[D.tm_wday].substring(0,3)},"%A":function(D){return c[D.tm_wday]},"%b":function(D){return _[D.tm_mon].substring(0,3)},"%B":function(D){return _[D.tm_mon]},"%C":function(D){var T=D.tm_year+1900;return p(T/100|0,2)},"%d":function(D){return p(D.tm_mday,2)},"%e":function(D){return v(D.tm_mday,2," ")},"%g":function(D){return S(D).toString().substring(2)},"%G":function(D){return S(D)},"%H":function(D){return p(D.tm_hour,2)},"%I":function(D){var T=D.tm_hour;return T==0?T=12:T>12&&(T-=12),p(T,2)},"%j":function(D){return p(D.tm_mday+Ue(Tr(D.tm_year+1900)?ir:qe,D.tm_mon-1),3)},"%m":function(D){return p(D.tm_mon+1,2)},"%M":function(D){return p(D.tm_min,2)},"%n":function(){return`
|
|
34
34
|
`},"%p":function(D){return D.tm_hour>=0&&D.tm_hour<12?"AM":"PM"},"%S":function(D){return p(D.tm_sec,2)},"%t":function(){return" "},"%u":function(D){return D.tm_wday||7},"%U":function(D){var T=D.tm_yday+7-D.tm_wday;return p(Math.floor(T/7),2)},"%V":function(D){var T=Math.floor((D.tm_yday+7-(D.tm_wday+6)%7)/7);if((D.tm_wday+371-D.tm_yday-2)%7<=2&&T++,T){if(T==53){var C=(D.tm_wday+371-D.tm_yday)%7;C!=4&&(C!=3||!Tr(D.tm_year))&&(T=1)}}else{T=52;var F=(D.tm_wday+7-D.tm_yday-1)%7;(F==4||F==5&&Tr(D.tm_year%400-1))&&T++}return p(T,2)},"%w":function(D){return D.tm_wday},"%W":function(D){var T=D.tm_yday+7-(D.tm_wday+6)%7;return p(Math.floor(T/7),2)},"%y":function(D){return(D.tm_year+1900).toString().substring(2)},"%Y":function(D){return D.tm_year+1900},"%z":function(D){var T=D.tm_gmtoff,F=T>=0;return T=Math.abs(T)/60,T=T/60*100+T%60,(F?"+":"-")+("0000"+T).slice(-4)},"%Z":function(D){return D.tm_zone},"%%":function(){return"%"}};m=m.replace(/%%/g,"\0\0");for(var o in b)m.includes(o)&&(m=m.replace(new RegExp(o,"g"),b[o](f)));m=m.replace(/\0\0/g,"%");var k=Je(m,!1);return k.length>i?0:(yt(k,r),k.length-1)}function Fr(r,i,t){for(var a=ne(i),n="\\!@#$^&*()+=-[]/{}|:<>?,.",f=0,m=n.length;f<m;++f)a=a.replace(new RegExp("\\"+n[f],"g"),"\\"+n[f]);var u={"%A":"%a","%B":"%b","%c":"%a %b %d %H:%M:%S %Y","%D":"%m\\/%d\\/%y","%e":"%d","%F":"%Y-%m-%d","%h":"%b","%R":"%H\\:%M","%r":"%I\\:%M\\:%S\\s%p","%T":"%H\\:%M\\:%S","%x":"%m\\/%d\\/(?:%y|%Y)","%X":"%H\\:%M\\:%S"};for(var o in u)a=a.replace(o,u[o]);var c={"%a":"(?:Sun(?:day)?)|(?:Mon(?:day)?)|(?:Tue(?:sday)?)|(?:Wed(?:nesday)?)|(?:Thu(?:rsday)?)|(?:Fri(?:day)?)|(?:Sat(?:urday)?)","%b":"(?:Jan(?:uary)?)|(?:Feb(?:ruary)?)|(?:Mar(?:ch)?)|(?:Apr(?:il)?)|May|(?:Jun(?:e)?)|(?:Jul(?:y)?)|(?:Aug(?:ust)?)|(?:Sep(?:tember)?)|(?:Oct(?:ober)?)|(?:Nov(?:ember)?)|(?:Dec(?:ember)?)","%C":"\\d\\d","%d":"0[1-9]|[1-9](?!\\d)|1\\d|2\\d|30|31","%H":"\\d(?!\\d)|[0,1]\\d|20|21|22|23","%I":"\\d(?!\\d)|0\\d|10|11|12","%j":"00[1-9]|0?[1-9](?!\\d)|0?[1-9]\\d(?!\\d)|[1,2]\\d\\d|3[0-6]\\d","%m":"0[1-9]|[1-9](?!\\d)|10|11|12","%M":"0\\d|\\d(?!\\d)|[1-5]\\d","%n":"\\s","%p":"AM|am|PM|pm|A\\.M\\.|a\\.m\\.|P\\.M\\.|p\\.m\\.","%S":"0\\d|\\d(?!\\d)|[1-5]\\d|60","%U":"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53","%W":"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53","%w":"[0-6]","%y":"\\d\\d","%Y":"\\d\\d\\d\\d","%%":"%","%t":"\\s"},_={JAN:0,FEB:1,MAR:2,APR:3,MAY:4,JUN:5,JUL:6,AUG:7,SEP:8,OCT:9,NOV:10,DEC:11},v={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},p={MON:0,TUE:1,WED:2,THU:3,FRI:4,SAT:5,SUN:6};for(var y in c)a=a.replace(y,"("+y+c[y]+")");for(var E=[],f=a.indexOf("%");f>=0;f=a.indexOf("%"))E.push(a[f+1]),a=a.replace(new RegExp("\\%"+a[f+1],"g"),"");var S=new RegExp("^"+a,"i").exec(ne(r));function b(){function ze(Ve,Dr,yr){return typeof Ve!="number"||isNaN(Ve)?Dr:Ve>=Dr?Ve<=yr?Ve:yr:Dr}return{year:ze(h[t+20>>2]+1900,1970,9999),month:ze(h[t+16>>2],0,11),day:ze(h[t+12>>2],1,31),hour:ze(h[t+8>>2],0,23),min:ze(h[t+4>>2],0,59),sec:ze(h[t>>2],0,59)}}if(S){var k=b(),D,T=ze=>{var Ve=E.indexOf(ze);if(Ve>=0)return S[Ve+1]};if((D=T("S"))&&(k.sec=Q(D)),(D=T("M"))&&(k.min=Q(D)),D=T("H"))k.hour=Q(D);else if(D=T("I")){var F=Q(D);(D=T("p"))&&(F+=D.toUpperCase()[0]==="P"?12:0),k.hour=F}if(D=T("Y"))k.year=Q(D);else if(D=T("y")){var C=Q(D);(D=T("C"))?C+=Q(D)*100:C+=C<69?2e3:1900,k.year=C}if((D=T("m"))?k.month=Q(D)-1:(D=T("b"))&&(k.month=_[D.substring(0,3).toUpperCase()]||0),D=T("d"))k.day=Q(D);else if(D=T("j"))for(var I=Q(D),W=Tr(k.year),K=0;K<12;++K){var B=Ue(W?ir:qe,K-1);I<=B+(W?ir:qe)[K]&&(k.day=I-B)}else if(D=T("a")){var H=D.substring(0,3).toUpperCase();if(D=T("U")){var G=v[H],te=Q(D),oe=new Date(k.year,0,1),de;oe.getDay()===0?de=Er(oe,G+7*(te-1)):de=Er(oe,7-oe.getDay()+G+7*(te-1)),k.day=de.getDate(),k.month=de.getMonth()}else if(D=T("W")){var G=p[H],te=Q(D),oe=new Date(k.year,0,1),de;oe.getDay()===1?de=Er(oe,G+7*(te-1)):de=Er(oe,7-oe.getDay()+1+G+7*(te-1)),k.day=de.getDate(),k.month=de.getMonth()}}var he=new Date(k.year,k.month,k.day,k.hour,k.min,k.sec,0);return h[t>>2]=he.getSeconds(),h[t+4>>2]=he.getMinutes(),h[t+8>>2]=he.getHours(),h[t+12>>2]=he.getDate(),h[t+16>>2]=he.getMonth(),h[t+20>>2]=he.getFullYear()-1900,h[t+24>>2]=he.getDay(),h[t+28>>2]=Ue(Tr(he.getFullYear())?ir:qe,he.getMonth()-1)+he.getDate()-1,h[t+32>>2]=0,r+Je(S[0]).length-1}return 0}function qr(r){return br.shutdownSocket(r,2)}function Yt(r,i,t){if(typeof be>"u")return 0;let a=1,n=2,f=4,m=8,u=16,o=32;return be.handleSleep(c=>{let _=ve(r);if(!_){c(0);return}let v=[],p=new Set;if(i&a||i&n){if(_.server){for(let D of _.pending)if((D.recv_queue||[]).length>0){c(1);return}}else if((_.recv_queue||[]).length>0){c(1);return}}let y=br.getAllWebSockets(_);if(!y.length){c(0);return}for(let D of y)(i&a||i&n)&&(v.push(br.awaitData(D)),p.add("POLLIN")),i&f&&(v.push(br.awaitConnection(D)),p.add("POLLOUT")),i&u&&(v.push(br.awaitClose(D)),p.add("POLLHUP")),(i&m||i&o)&&(v.push(br.awaitError(D)),p.add("POLLERR"));if(v.length===0){console.warn("Unsupported poll event "+i+", defaulting to setTimeout()."),setTimeout(function(){c(0)},t);return}let E=v.map(([D])=>D),S=()=>v.forEach(([,D])=>D()),b=!1;Promise.race(E).then(function(D){b||(b=!0,c(1),clearTimeout(k),S())});let k=setTimeout(function(){b||(b=!0,c(0),S())},t)})}function qt(r,i,t,a,n){let f=_e[a];if(!(i===1&&t===9||i===6&&t===1))return console.warn(`Unsupported socket option: ${i}, ${t}, ${f}`),-1;let v=br.getAllWebSockets(r)[0];return v?(v.setSocketOpt(i,t,a),0):-1}function Xt(r){try{return r()}catch(i){ue(i)}}var be={State:{Normal:0,Unwinding:1,Rewinding:2,Disabled:3},state:0,StackSize:4096,currData:null,handleSleepReturnValue:0,exportCallStack:[],callStackNameToId:{},callStackIdToName:{},callStackId:0,asyncPromiseHandlers:null,sleepCallbacks:[],getCallStackId:function(r){var i=be.callStackNameToId[r];return i===void 0&&(i=be.callStackId++,be.callStackNameToId[r]=i,be.callStackIdToName[i]=r),i},instrumentWasmImports:function(r){var i=["env._dlopen_js","env.invoke_i","env.invoke_ii","env.invoke_iii","env.invoke_iiii","env.invoke_iiiii","env.invoke_iiiiii","env.invoke_iiiiiii","env.invoke_iiiiiiii","env.invoke_iiiiiiiiii","env.invoke_v","env.invoke_vi","env.invoke_vii","env.invoke_viidii","env.invoke_viii","env.invoke_viiii","env.invoke_viiiii","env.invoke_viiiiii","env.invoke_viiiiiii","env.invoke_viiiiiiiii","env.wasm_poll_socket","env.wasm_shutdown","env.emscripten_sleep","env.emscripten_wget","env.emscripten_wget_data","env.emscripten_idb_load","env.emscripten_idb_store","env.emscripten_idb_delete","env.emscripten_idb_exists","env.emscripten_idb_load_blob","env.emscripten_idb_store_blob","env.SDL_Delay","env.emscripten_scan_registers","env.emscripten_lazy_load_code","env.emscripten_fiber_swap","wasi_snapshot_preview1.fd_sync","env.__wasi_fd_sync","env._emval_await","env._dlopen_js","env.__asyncjs__*"].map(a=>a.split(".")[1]);for(var t in r)(function(a){var n=r[a],f=n.sig;if(typeof n=="function")var m=i.indexOf(a)>=0||a.startsWith("__asyncjs__")})(t)},instrumentWasmExports:function(r){var i={};for(var t in r)(function(a){var n=r[a];typeof n=="function"?i[a]=function(){be.exportCallStack.push(a);try{return n.apply(null,arguments)}finally{if(!Fe){var f=be.exportCallStack.pop();Ne(f===a),be.maybeStopUnwind()}}}:i[a]=n})(t);return i},maybeStopUnwind:function(){be.currData&&be.state===be.State.Unwinding&&be.exportCallStack.length===0&&(be.state=be.State.Normal,rt(),Xt(Lt),typeof Fibers<"u"&&Fibers.trampoline())},whenDone:function(){return new Promise((r,i)=>{be.asyncPromiseHandlers={resolve:r,reject:i}})},allocateData:function(){var r=kt(12+be.StackSize);return be.setDataHeader(r,r+12,be.StackSize),be.setDataRewindFunc(r),r},setDataHeader:function(r,i,t){h[r>>2]=i,h[r+4>>2]=i+t},setDataRewindFunc:function(r){var i=be.exportCallStack[0],t=be.getCallStackId(i);h[r+8>>2]=t},getDataRewindFunc:function(r){var i=h[r+8>>2],t=be.callStackIdToName[i],a=l.asm[t];return a},doRewind:function(r){var i=be.getDataRewindFunc(r);return Yr(),i()},handleSleep:function(r){if(!Fe){if(be.state===be.State.Normal){var i=!1,t=!1;r(a=>{if(!Fe&&(be.handleSleepReturnValue=a||0,i=!0,!!t)){be.state=be.State.Rewinding,Xt(()=>It(be.currData)),typeof Browser<"u"&&Browser.mainLoop.func&&Browser.mainLoop.resume();var n,f=!1;try{n=be.doRewind(be.currData)}catch(o){n=o,f=!0}var m=!1;if(!be.currData){var u=be.asyncPromiseHandlers;u&&(be.asyncPromiseHandlers=null,(f?u.reject:u.resolve)(n),m=!0)}if(f&&!m)throw n}}),t=!0,i||(be.state=be.State.Unwinding,be.currData=be.allocateData(),typeof Browser<"u"&&Browser.mainLoop.func&&Browser.mainLoop.pause(),Xt(()=>Mt(be.currData)))}else be.state===be.State.Rewinding?(be.state=be.State.Normal,Xt(Kt),Vr(be.currData),be.currData=null,be.sleepCallbacks.forEach(a=>St(a))):ue("invalid state: "+be.state);return be.handleSleepReturnValue}},handleAsync:function(r){return be.handleSleep(i=>{r().then(i)})}};function X(r){var i=l["_"+r];return i}function Ae(r,i,t,a,n){var f={string:b=>{var k=0;if(b!=null&&b!==0){var D=(b.length<<2)+1;k=Oe(D),Ce(b,k,D)}return k},array:b=>{var k=Oe(b.length);return yt(b,k),k}};function m(b){return i==="string"?ne(b):i==="boolean"?!!b:b}var u=X(r),o=[],c=0;if(a)for(var _=0;_<a.length;_++){var v=f[t[_]];v?(c===0&&(c=gr()),o[_]=v(a[_])):o[_]=a[_]}var p=be.currData,y=u.apply(null,o);function E(b){return Yr(),c!==0&&we(c),m(b)}rt();var S=n&&n.async;return be.currData!=p?be.whenDone().then(E):(y=E(y),S?Promise.resolve(y):y)}var $t=function(r,i,t,a){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=e.nextInode++,this.name=i,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=a},ie=365,Xr=146;Object.defineProperties($t.prototype,{read:{get:function(){return(this.mode&ie)===ie},set:function(r){r?this.mode|=ie:this.mode&=~ie}},write:{get:function(){return(this.mode&Xr)===Xr},set:function(r){r?this.mode|=Xr:this.mode&=~Xr}},isFolder:{get:function(){return e.isDir(this.mode)}},isDevice:{get:function(){return e.isChrdev(this.mode)}}}),e.FSNode=$t,e.staticInit(),l.FS_createPath=e.createPath,l.FS_createDataFile=e.createDataFile,l.FS_createPreloadedFile=e.createPreloadedFile,l.FS_unlink=e.unlink,l.FS_createLazyFile=e.createLazyFile,l.FS_createDevice=e.createDevice,Z&&(wr(),M.staticInit()),wt={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135};var Hr={l:Qn,Ta:eo,Sa:oo,Ra:io,Qa:ao,Pa:so,M:uo,Oa:fo,Na:co,Ma:lo,La:_o,Ka:$r,Ja:mo,L:vo,p:po,Ia:ho,R:yo,Ha:wo,Ga:Eo,Fa:go,Ea:So,Da:bo,K:ko,Ca:Do,Ba:Oo,Aa:No,za:To,C:Fo,ya:Ao,xa:pe,wa:Co,va:Po,ua:Ro,J:Mo,ta:Lo,I:Io,sa:Uo,ra:Bo,qa:xo,H:Ho,pa:zo,la:Zr,ka:Wo,ja:mn,ia:Yo,ha:qo,ga:Vo,fa:Ko,ea:Go,da:Xo,ca:$o,ba:Wr,n:Jo,A:Ut,aa:Qo,E:jr,$:ei,_:ri,Z:Ht,oa:Ur,na:zt,d:gt,u:ii,G:ai,F:ui,Q:fi,ma:ci,B:di,D:Pn,z:On,Y:_i,X:mi,W:bt,V:Wt,j:An,c:yn,b:Fn,g:Oi,h:In,t:Pi,U:Un,m:ln,T:Ti,y:Ci,P:g,O:w,f:Tn,a:dn,e:hn,i:kn,s:Ni,o:Ai,k:Fi,x:Dn,S:je,r:fr,N:Fr,q:qr,w:Yt,v:qt},ke=Jn(),Te=l.___wasm_call_ctors=function(){return(Te=l.___wasm_call_ctors=l.asm.Va).apply(null,arguments)},sn=l._wasm_popen=function(){return(sn=l._wasm_popen=l.asm.Wa).apply(null,arguments)},Nn=l.___errno_location=function(){return(Nn=l.___errno_location=l.asm.Xa).apply(null,arguments)},un=l._wasm_pclose=function(){return(un=l._wasm_pclose=l.asm.Ya).apply(null,arguments)},Zt=l._php_pollfd_for=function(){return(Zt=l._php_pollfd_for=l.asm.Za).apply(null,arguments)},Sn=l._wasm_select=function(){return(Sn=l._wasm_select=l.asm._a).apply(null,arguments)},Rn=l._wasm_add_cli_arg=function(){return(Rn=l._wasm_add_cli_arg=l.asm.$a).apply(null,arguments)},kt=l._malloc=function(){return(kt=l._malloc=l.asm.ab).apply(null,arguments)},sr=l._run_cli=function(){return(sr=l._run_cli=l.asm.bb).apply(null,arguments)},Vr=l._free=function(){return(Vr=l._free=l.asm.cb).apply(null,arguments)},en=l._ntohs=function(){return(en=l._ntohs=l.asm.eb).apply(null,arguments)},er=l._htons=function(){return(er=l._htons=l.asm.fb).apply(null,arguments)},Vt=l._fflush=function(){return(Vt=l._fflush=l.asm.gb).apply(null,arguments)},Jr=l._wasm_set_phpini_path=function(){return(Jr=l._wasm_set_phpini_path=l.asm.hb).apply(null,arguments)},kr=l._wasm_set_phpini_entries=function(){return(kr=l._wasm_set_phpini_entries=l.asm.ib).apply(null,arguments)},Br=l._wasm_add_SERVER_entry=function(){return(Br=l._wasm_add_SERVER_entry=l.asm.jb).apply(null,arguments)},ot=l._wasm_add_uploaded_file=function(){return(ot=l._wasm_add_uploaded_file=l.asm.kb).apply(null,arguments)},Jt=l._wasm_set_query_string=function(){return(Jt=l._wasm_set_query_string=l.asm.lb).apply(null,arguments)},Dt=l._wasm_set_path_translated=function(){return(Dt=l._wasm_set_path_translated=l.asm.mb).apply(null,arguments)},pn=l._wasm_set_skip_shebang=function(){return(pn=l._wasm_set_skip_shebang=l.asm.nb).apply(null,arguments)},fn=l._wasm_set_request_uri=function(){return(fn=l._wasm_set_request_uri=l.asm.ob).apply(null,arguments)},cn=l._wasm_set_request_method=function(){return(cn=l._wasm_set_request_method=l.asm.pb).apply(null,arguments)},bn=l._wasm_set_request_host=function(){return(bn=l._wasm_set_request_host=l.asm.qb).apply(null,arguments)},vi=l._wasm_set_content_type=function(){return(vi=l._wasm_set_content_type=l.asm.rb).apply(null,arguments)},pi=l._wasm_set_request_body=function(){return(pi=l._wasm_set_request_body=l.asm.sb).apply(null,arguments)},hi=l._wasm_set_content_length=function(){return(hi=l._wasm_set_content_length=l.asm.tb).apply(null,arguments)},yi=l._wasm_set_cookies=function(){return(yi=l._wasm_set_cookies=l.asm.ub).apply(null,arguments)},wi=l._wasm_set_php_code=function(){return(wi=l._wasm_set_php_code=l.asm.vb).apply(null,arguments)},Ei=l._wasm_set_request_port=function(){return(Ei=l._wasm_set_request_port=l.asm.wb).apply(null,arguments)},gi=l._phpwasm_init_uploaded_files_hash=function(){return(gi=l._phpwasm_init_uploaded_files_hash=l.asm.xb).apply(null,arguments)},Si=l._phpwasm_register_uploaded_file=function(){return(Si=l._phpwasm_register_uploaded_file=l.asm.yb).apply(null,arguments)},bi=l._phpwasm_destroy_uploaded_files_hash=function(){return(bi=l._phpwasm_destroy_uploaded_files_hash=l.asm.zb).apply(null,arguments)},ki=l._wasm_sapi_handle_request=function(){return(ki=l._wasm_sapi_handle_request=l.asm.Ab).apply(null,arguments)},Di=l._php_wasm_init=function(){return(Di=l._php_wasm_init=l.asm.Bb).apply(null,arguments)},Mn=l.___funcs_on_exit=function(){return(Mn=l.___funcs_on_exit=l.asm.Cb).apply(null,arguments)},Ln=l._emscripten_builtin_memalign=function(){return(Ln=l._emscripten_builtin_memalign=l.asm.Db).apply(null,arguments)},Sr=l._setThrew=function(){return(Sr=l._setThrew=l.asm.Eb).apply(null,arguments)},gr=l.stackSave=function(){return(gr=l.stackSave=l.asm.Fb).apply(null,arguments)},we=l.stackRestore=function(){return(we=l.stackRestore=l.asm.Gb).apply(null,arguments)},Oe=l.stackAlloc=function(){return(Oe=l.stackAlloc=l.asm.Hb).apply(null,arguments)},ye=l.dynCall_viii=function(){return(ye=l.dynCall_viii=l.asm.Ib).apply(null,arguments)},tr=l.dynCall_vi=function(){return(tr=l.dynCall_vi=l.asm.Jb).apply(null,arguments)},De=l.dynCall_ii=function(){return(De=l.dynCall_ii=l.asm.Kb).apply(null,arguments)},xe=l.dynCall_iii=function(){return(xe=l.dynCall_iii=l.asm.Lb).apply(null,arguments)},Ie=l.dynCall_iiii=function(){return(Ie=l.dynCall_iiii=l.asm.Mb).apply(null,arguments)},ar=l.dynCall_v=function(){return(ar=l.dynCall_v=l.asm.Nb).apply(null,arguments)},Be=l.dynCall_iiiii=function(){return(Be=l.dynCall_iiiii=l.asm.Ob).apply(null,arguments)},He=l.dynCall_iiiiii=function(){return(He=l.dynCall_iiiiii=l.asm.Pb).apply(null,arguments)},ur=l.dynCall_vii=function(){return(ur=l.dynCall_vii=l.asm.Qb).apply(null,arguments)},et=l.dynCall_viiii=function(){return(et=l.dynCall_viiii=l.asm.Rb).apply(null,arguments)},it=l.dynCall_iiiiiii=function(){return(it=l.dynCall_iiiiiii=l.asm.Sb).apply(null,arguments)},at=l.dynCall_i=function(){return(at=l.dynCall_i=l.asm.Tb).apply(null,arguments)},Ot=l.dynCall_viiiii=function(){return(Ot=l.dynCall_viiiii=l.asm.Ub).apply(null,arguments)},Nt=l.dynCall_iiiiiiii=function(){return(Nt=l.dynCall_iiiiiiii=l.asm.Vb).apply(null,arguments)},Tt=l.dynCall_iiiiiiiii=function(){return(Tt=l.dynCall_iiiiiiiii=l.asm.Wb).apply(null,arguments)},Ft=l.dynCall_iiiiiiiiii=function(){return(Ft=l.dynCall_iiiiiiiiii=l.asm.Xb).apply(null,arguments)},At=l.dynCall_viiiiiiiii=function(){return(At=l.dynCall_viiiiiiiii=l.asm.Yb).apply(null,arguments)},Ct=l.dynCall_viiiiii=function(){return(Ct=l.dynCall_viiiiii=l.asm.Zb).apply(null,arguments)},Pt=l.dynCall_iiji=function(){return(Pt=l.dynCall_iiji=l.asm._b).apply(null,arguments)},Rt=l.dynCall_iijiji=function(){return(Rt=l.dynCall_iijiji=l.asm.$b).apply(null,arguments)},Mt=l._asyncify_start_unwind=function(){return(Mt=l._asyncify_start_unwind=l.asm.ac).apply(null,arguments)},Lt=l._asyncify_stop_unwind=function(){return(Lt=l._asyncify_stop_unwind=l.asm.bc).apply(null,arguments)},It=l._asyncify_start_rewind=function(){return(It=l._asyncify_start_rewind=l.asm.cc).apply(null,arguments)},Kt=l._asyncify_stop_rewind=function(){return(Kt=l._asyncify_stop_rewind=l.asm.dc).apply(null,arguments)};function ln(r,i,t,a,n,f,m,u){var o=gr();try{return Nt(r,i,t,a,n,f,m,u)}catch(c){if(we(o),c!==c+0)throw c;Sr(1,0)}}function dn(r,i){var t=gr();try{tr(r,i)}catch(a){if(we(t),a!==a+0)throw a;Sr(1,0)}}function hn(r,i,t){var a=gr();try{ur(r,i,t)}catch(n){if(we(a),n!==n+0)throw n;Sr(1,0)}}function yn(r,i){var t=gr();try{return De(r,i)}catch(a){if(we(t),a!==a+0)throw a;Sr(1,0)}}function kn(r,i,t,a){var n=gr();try{ye(r,i,t,a)}catch(f){if(we(n),f!==f+0)throw f;Sr(1,0)}}function Tn(r){var i=gr();try{ar(r)}catch(t){if(we(i),t!==t+0)throw t;Sr(1,0)}}function Fn(r,i,t){var a=gr();try{return xe(r,i,t)}catch(n){if(we(a),n!==n+0)throw n;Sr(1,0)}}function An(r){var i=gr();try{return at(r)}catch(t){if(we(i),t!==t+0)throw t;Sr(1,0)}}function In(r,i,t,a,n){var f=gr();try{return Be(r,i,t,a,n)}catch(m){if(we(f),m!==m+0)throw m;Sr(1,0)}}function Oi(r,i,t,a){var n=gr();try{return Ie(r,i,t,a)}catch(f){if(we(n),f!==f+0)throw f;Sr(1,0)}}function Ni(r,i,t,a,n){var f=gr();try{et(r,i,t,a,n)}catch(m){if(we(f),m!==m+0)throw m;Sr(1,0)}}function Ti(r,i,t,a,n,f,m,u,o){var c=gr();try{return Tt(r,i,t,a,n,f,m,u,o)}catch(_){if(we(c),_!==_+0)throw _;Sr(1,0)}}function Fi(r,i,t,a,n,f,m){var u=gr();try{Ct(r,i,t,a,n,f,m)}catch(o){if(we(u),o!==o+0)throw o;Sr(1,0)}}function Ai(r,i,t,a,n,f){var m=gr();try{Ot(r,i,t,a,n,f)}catch(u){if(we(m),u!==u+0)throw u;Sr(1,0)}}function Ci(r,i,t,a,n,f,m,u,o,c){var _=gr();try{return Ft(r,i,t,a,n,f,m,u,o,c)}catch(v){if(we(_),v!==v+0)throw v;Sr(1,0)}}function Pi(r,i,t,a,n,f){var m=gr();try{return He(r,i,t,a,n,f)}catch(u){if(we(m),u!==u+0)throw u;Sr(1,0)}}function Dn(r,i,t,a,n,f,m,u,o,c){var _=gr();try{At(r,i,t,a,n,f,m,u,o,c)}catch(v){if(we(_),v!==v+0)throw v;Sr(1,0)}}function Un(r,i,t,a,n,f,m){var u=gr();try{return it(r,i,t,a,n,f,m)}catch(o){if(we(u),o!==o+0)throw o;Sr(1,0)}}function w(r,i,t,a,n,f,m,u){var o=gr();try{return Rt(r,i,t,a,n,f,m,u)}catch(c){if(we(o),c!==c+0)throw c;Sr(1,0)}}function g(r,i,t,a,n){var f=gr();try{return Pt(r,i,t,a,n)}catch(m){if(we(f),m!==m+0)throw m;Sr(1,0)}}l.UTF8ToString=ne,l.lengthBytesUTF8=Pe,l.addRunDependency=mr,l.removeRunDependency=Ze,l.FS_createPath=e.createPath,l.FS_createDataFile=e.createDataFile,l.FS_createPreloadedFile=e.createPreloadedFile,l.FS_createLazyFile=e.createLazyFile,l.FS_createDevice=e.createDevice,l.FS_unlink=e.unlink,l.ccall=Ae,l.FS=e;var s;$e=function r(){s||d(),s||($e=r)};function d(r){if(r=r||j,Re>0||(jn(),Re>0))return;function i(){s||(s=!0,l.calledRun=!0,!Fe&&(Yn(),l.onRuntimeInitialized&&l.onRuntimeInitialized(),Vn()))}l.setStatus?(l.setStatus("Running..."),setTimeout(function(){setTimeout(function(){l.setStatus("")},1),i()},1)):i()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();return d(),O}var Qc,rf,nf=Gi(()=>{"use strict";Qc=10146532,rf=__dirname+"/php_5_6.wasm"});var ll={};ji(ll,{NodePHP:()=>Ka,getPHPLoaderModule:()=>Es,withNetworking:()=>Ss});module.exports=gf(ll);var qi=class{headers;bytes;errors;exitCode;httpStatusCode;constructor(O,A,l,x="",j=0){this.httpStatusCode=O,this.headers=A,this.bytes=l,this.exitCode=j,this.errors=x}static fromRawData(O){return new qi(O.httpStatusCode,O.headers,O.bytes,O.errors,O.exitCode)}toRawData(){return{headers:this.headers,bytes:this.bytes,errors:this.errors,exitCode:this.exitCode,httpStatusCode:this.httpStatusCode}}get json(){return JSON.parse(this.text)}get text(){return new TextDecoder().decode(this.bytes)}};var Os=["8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0","5.6"],$a=Os[0];var Oa=class{#e;#r;requestHandler;constructor(O,A={}){this.requestHandler=O,this.#e={},this.#r={handleRedirects:!1,maxRedirects:4,...A}}async request(O,A=0){let l=await this.requestHandler.request({...O,headers:{...O.headers,cookie:this.#n()}});if(l.headers["set-cookie"]&&this.#o(l.headers["set-cookie"]),this.#r.handleRedirects&&l.headers.location&&A<this.#r.maxRedirects){let x=new URL(l.headers.location[0],this.requestHandler.absoluteUrl);return this.request({url:x.toString(),method:"GET",headers:{}},A+1)}return l}pathToInternalUrl(O){return this.requestHandler.pathToInternalUrl(O)}internalUrlToPath(O){return this.requestHandler.internalUrlToPath(O)}get absoluteUrl(){return this.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.documentRoot}#o(O){for(let A of O)try{if(!A.includes("="))continue;let l=A.indexOf("="),x=A.substring(0,l),j=A.substring(l+1).split(";")[0];this.#e[x]=j}catch(l){console.error(l)}}#n(){let O=[];for(let A in this.#e)O.push(`${A}=${this.#e[A]}`);return O.join("; ")}},Ns=Oa;var fa=class{_running=0;concurrency;queue;constructor({concurrency:O}){this.concurrency=O,this.queue=[]}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency)await new Promise(O=>this.queue.push(O));else return this._running++,()=>{this._running--,this.queue.length>0&&this.queue.shift()()}}async run(O){let A=await this.acquire();try{return await O()}finally{A()}}};var hl=Symbol("literal");var Za="http://example.com";function Na(R){return R.toString().substring(R.origin.length)}function Ta(R,O){return!O||!R.startsWith(O)?R:R.substring(O.length)}function Ja(R,O){return!O||R.startsWith(O)?R:O+R}var Fa=class{#e;#r;#o;#n;#i;#t;#a;#s;php;#u;constructor(O,A={}){this.#s=new fa({concurrency:1});let{documentRoot:l="/www/",absoluteUrl:x=typeof location=="object"?location?.href:"",isStaticFilePath:j=()=>!1}=A;this.php=O,this.#e=l,this.#u=j;let J=new URL(x);this.#o=J.hostname,this.#n=J.port?Number(J.port):J.protocol==="https:"?443:80,this.#r=(J.protocol||"").replace(":","");let ee=this.#n!==443&&this.#n!==80;this.#i=[this.#o,ee?`:${this.#n}`:""].join(""),this.#t=J.pathname.replace(/\/+$/,""),this.#a=[`${this.#r}://`,this.#i,this.#t].join("")}pathToInternalUrl(O){return`${this.absoluteUrl}${O}`}internalUrlToPath(O){let A=new URL(O);return A.pathname.startsWith(this.#t)&&(A.pathname=A.pathname.slice(this.#t.length)),Na(A)}get isRequestRunning(){return this.#s.running>0}get absoluteUrl(){return this.#a}get documentRoot(){return this.#e}async request(O){let A=O.url.startsWith("http://")||O.url.startsWith("https://"),l=new URL(O.url,A?void 0:Za),x=Ta(l.pathname,this.#t);return this.#u(x)?this.#f(x):await this.#c(O,l)}#f(O){let A=`${this.#e}${O}`;if(!this.php.fileExists(A))return new qi(404,{},new TextEncoder().encode("404 File not found"));let l=this.php.readFileAsBuffer(A);return new qi(200,{"content-length":[`${l.byteLength}`],"content-type":[bf(A)],"accept-ranges":["bytes"],"cache-control":["public, max-age=0"]},l)}async#c(O,A){let l=await this.#s.acquire();try{this.php.addServerGlobalEntry("DOCUMENT_ROOT",this.#e),this.php.addServerGlobalEntry("HTTPS",this.#a.startsWith("https://")?"on":"");let x="GET",j={host:this.#i,...Qa(O.headers||{})},J=[];if(O.files&&Object.keys(O.files).length){x="POST";for(let ce in O.files){let fe=O.files[ce];J.push({key:ce,name:fe.name,type:fe.type,data:new Uint8Array(await fe.arrayBuffer())})}j["content-type"]?.startsWith("multipart/form-data")&&(O.formData=Sf(O.body||""),j["content-type"]="application/x-www-form-urlencoded",delete O.body)}let ee;return O.formData!==void 0?(x="POST",j["content-type"]=j["content-type"]||"application/x-www-form-urlencoded",ee=new URLSearchParams(O.formData).toString()):ee=O.body,await this.php.run({relativeUri:Ja(Na(A),this.#t),protocol:this.#r,method:O.method||x,body:ee,fileInfos:J,scriptPath:this.#l(A.pathname),headers:j})}finally{l()}}#l(O){let A=Ta(O,this.#t);A.includes(".php")?A=A.split(".php")[0]+".php":(A.endsWith("/")||(A+="/"),A.endsWith("index.php")||(A+="index.php"));let l=`${this.#e}${A}`;return this.php.fileExists(l)?l:`${this.#e}/index.php`}};function Sf(R){let O={},A=R.match(/--(.*)\r\n/);if(!A)return O;let l=A[1],x=R.split(`--${l}`);return x.shift(),x.pop(),x.forEach(j=>{let J=j.indexOf(`\r
|
|
35
35
|
\r
|
|
36
|
-
`),ee=j.substring(0,J).trim(),ce=j.substring(J+4).trim(),fe=ee.match(/name="([^"]+)"/);if(fe){let Z=fe[1];O[Z]=ce}}),O}function bf(R){switch(R.split(".").pop()){case"css":return"text/css";case"js":return"application/javascript";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"svg":return"image/svg+xml";case"woff":return"font/woff";case"woff2":return"font/woff2";case"ttf":return"font/ttf";case"otf":return"font/otf";case"eot":return"font/eot";case"ico":return"image/x-icon";case"html":return"text/html";case"json":return"application/json";case"xml":return"application/xml";case"txt":case"md":return"text/plain";default:return"application-octet-stream"}}var Ts=Fa;var Fs={0:"No error occurred. System call completed successfully.",1:"Argument list too long.",2:"Permission denied.",3:"Address in use.",4:"Address not available.",5:"Address family not supported.",6:"Resource unavailable, or operation would block.",7:"Connection already in progress.",8:"Bad file descriptor.",9:"Bad message.",10:"Device or resource busy.",11:"Operation canceled.",12:"No child processes.",13:"Connection aborted.",14:"Connection refused.",15:"Connection reset.",16:"Resource deadlock would occur.",17:"Destination address required.",18:"Mathematics argument out of domain of function.",19:"Reserved.",20:"File exists.",21:"Bad address.",22:"File too large.",23:"Host is unreachable.",24:"Identifier removed.",25:"Illegal byte sequence.",26:"Operation in progress.",27:"Interrupted function.",28:"Invalid argument.",29:"I/O error.",30:"Socket is connected.",31:"There is a directory under that path.",32:"Too many levels of symbolic links.",33:"File descriptor value too large.",34:"Too many links.",35:"Message too large.",36:"Reserved.",37:"Filename too long.",38:"Network is down.",39:"Connection aborted by network.",40:"Network unreachable.",41:"Too many files open in system.",42:"No buffer space available.",43:"No such device.",44:"There is no such file or directory OR the parent directory does not exist.",45:"Executable file format error.",46:"No locks available.",47:"Reserved.",48:"Not enough space.",49:"No message of the desired type.",50:"Protocol not available.",51:"No space left on device.",52:"Function not supported.",53:"The socket is not connected.",54:"Not a directory or a symbolic link to a directory.",55:"Directory not empty.",56:"State not recoverable.",57:"Not a socket.",58:"Not supported, or operation not supported on socket.",59:"Inappropriate I/O control operation.",60:"No such device or address.",61:"Value too large to be stored in data type.",62:"Previous owner died.",63:"Operation not permitted.",64:"Broken pipe.",65:"Protocol error.",66:"Protocol not supported.",67:"Protocol wrong type for socket.",68:"Result too large.",69:"Read-only file system.",70:"Invalid seek.",71:"No such process.",72:"Reserved.",73:"Connection timed out.",74:"Text file busy.",75:"Cross-device link.",76:"Extension: Capabilities insufficient."};function Ui(R=""){return function(A,l,x){let j=x.value;x.value=function(...J){try{return j.apply(this,J)}catch(ee){let ce=typeof ee=="object"?ee?.errno:null;if(ce in Fs){let fe=Fs[ce],Z=typeof J[0]=="string"?J[0]:null,ae=Z!==null?R.replaceAll("{path}",Z):R;throw new Error(`${ae}: ${fe}`,{cause:ee})}throw ee}}}}var Df={};async function rs(R,O={},A=[]){let l,x,j=new Promise(ce=>{x=ce}),J=new Promise(ce=>{l=ce}),ee=R.init(kf,{onAbort(ce){console.error("WASM aborted: "),console.error(ce)},ENV:{},locateFile:ce=>ce,...O,noInitialRun:!0,onRuntimeInitialized(){O.onRuntimeInitialized&&O.onRuntimeInitialized(),l()},monitorRunDependencies(ce){ce===0&&(delete ee.monitorRunDependencies,x())}});for(let{default:ce}of A)ce(ee);return A.length||x(),await j,await J,es.push(ee),es.length-1}var es=[];function As(R){return es[R]}var kf=function(){return typeof window<"u"&&!Df.env.TEST?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();var Li="string",ca="number",Or=Symbol("__private__dont__use"),Mi=class{[Or];#e=[];#r=!1;requestHandler;constructor(O,A){O!==void 0&&this.initializeRuntime(O),A&&(this.requestHandler=new Ns(new Ts(this,A)))}get absoluteUrl(){return this.requestHandler.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.requestHandler.
|
|
36
|
+
`),ee=j.substring(0,J).trim(),ce=j.substring(J+4).trim(),fe=ee.match(/name="([^"]+)"/);if(fe){let Z=fe[1];O[Z]=ce}}),O}function bf(R){switch(R.split(".").pop()){case"css":return"text/css";case"js":return"application/javascript";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"svg":return"image/svg+xml";case"woff":return"font/woff";case"woff2":return"font/woff2";case"ttf":return"font/ttf";case"otf":return"font/otf";case"eot":return"font/eot";case"ico":return"image/x-icon";case"html":return"text/html";case"json":return"application/json";case"xml":return"application/xml";case"txt":case"md":return"text/plain";default:return"application-octet-stream"}}var Ts=Fa;var Fs={0:"No error occurred. System call completed successfully.",1:"Argument list too long.",2:"Permission denied.",3:"Address in use.",4:"Address not available.",5:"Address family not supported.",6:"Resource unavailable, or operation would block.",7:"Connection already in progress.",8:"Bad file descriptor.",9:"Bad message.",10:"Device or resource busy.",11:"Operation canceled.",12:"No child processes.",13:"Connection aborted.",14:"Connection refused.",15:"Connection reset.",16:"Resource deadlock would occur.",17:"Destination address required.",18:"Mathematics argument out of domain of function.",19:"Reserved.",20:"File exists.",21:"Bad address.",22:"File too large.",23:"Host is unreachable.",24:"Identifier removed.",25:"Illegal byte sequence.",26:"Operation in progress.",27:"Interrupted function.",28:"Invalid argument.",29:"I/O error.",30:"Socket is connected.",31:"There is a directory under that path.",32:"Too many levels of symbolic links.",33:"File descriptor value too large.",34:"Too many links.",35:"Message too large.",36:"Reserved.",37:"Filename too long.",38:"Network is down.",39:"Connection aborted by network.",40:"Network unreachable.",41:"Too many files open in system.",42:"No buffer space available.",43:"No such device.",44:"There is no such file or directory OR the parent directory does not exist.",45:"Executable file format error.",46:"No locks available.",47:"Reserved.",48:"Not enough space.",49:"No message of the desired type.",50:"Protocol not available.",51:"No space left on device.",52:"Function not supported.",53:"The socket is not connected.",54:"Not a directory or a symbolic link to a directory.",55:"Directory not empty.",56:"State not recoverable.",57:"Not a socket.",58:"Not supported, or operation not supported on socket.",59:"Inappropriate I/O control operation.",60:"No such device or address.",61:"Value too large to be stored in data type.",62:"Previous owner died.",63:"Operation not permitted.",64:"Broken pipe.",65:"Protocol error.",66:"Protocol not supported.",67:"Protocol wrong type for socket.",68:"Result too large.",69:"Read-only file system.",70:"Invalid seek.",71:"No such process.",72:"Reserved.",73:"Connection timed out.",74:"Text file busy.",75:"Cross-device link.",76:"Extension: Capabilities insufficient."};function Ui(R=""){return function(A,l,x){let j=x.value;x.value=function(...J){try{return j.apply(this,J)}catch(ee){let ce=typeof ee=="object"?ee?.errno:null;if(ce in Fs){let fe=Fs[ce],Z=typeof J[0]=="string"?J[0]:null,ae=Z!==null?R.replaceAll("{path}",Z):R;throw new Error(`${ae}: ${fe}`,{cause:ee})}throw ee}}}}var Df={};async function rs(R,O={},A=[]){let l,x,j=new Promise(ce=>{x=ce}),J=new Promise(ce=>{l=ce}),ee=R.init(kf,{onAbort(ce){console.error("WASM aborted: "),console.error(ce)},ENV:{},locateFile:ce=>ce,...O,noInitialRun:!0,onRuntimeInitialized(){O.onRuntimeInitialized&&O.onRuntimeInitialized(),l()},monitorRunDependencies(ce){ce===0&&(delete ee.monitorRunDependencies,x())}});for(let{default:ce}of A)ce(ee);return A.length||x(),await j,await J,es.push(ee),es.length-1}var es=[];function As(R){return es[R]}var kf=function(){return typeof window<"u"&&!Df.env.TEST?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();var Li="string",ca="number",Or=Symbol("__private__dont__use"),Mi=class{[Or];#e=[];#r=!1;requestHandler;constructor(O,A){O!==void 0&&this.initializeRuntime(O),A&&(this.requestHandler=new Ns(new Ts(this,A)))}get absoluteUrl(){return this.requestHandler.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.requestHandler.documentRoot}pathToInternalUrl(O){return this.requestHandler.requestHandler.pathToInternalUrl(O)}internalUrlToPath(O){return this.requestHandler.requestHandler.internalUrlToPath(O)}initializeRuntime(O){if(this[Or])throw new Error("PHP runtime already initialized.");let A=As(O);if(!A)throw new Error("Invalid PHP runtime id.");this[Or]=A}setPhpIniPath(O){if(this.#r)throw new Error("Cannot set PHP ini path after calling run().");this[Or].ccall("wasm_set_phpini_path",null,["string"],[O])}setPhpIniEntry(O,A){if(this.#r)throw new Error("Cannot set PHP ini entries after calling run().");this.#e.push([O,A])}chdir(O){this[Or].FS.chdir(O)}async request(O,A){if(!this.requestHandler)throw new Error("No request handler available.");return this.requestHandler.request(O,A)}async run(O){this.#r||(this.#o(),this.#r=!0),this.#f(O.scriptPath||""),this.#i(O.relativeUri||""),this.#a(O.method||"GET");let{host:A,...l}={host:"example.com:443",...Qa(O.headers||{})};if(this.#t(A,O.protocol||"http"),this.#s(l),O.body&&this.#u(O.body),O.fileInfos)for(let x of O.fileInfos)this.#c(x);return O.code&&this.#l(" ?>"+O.code),await this.#d()}#o(){if(this.#e.length>0){let O=this.#e.map(([A,l])=>`${A}=${l}`).join(`
|
|
37
37
|
`)+`
|
|
38
38
|
|
|
39
39
|
`;this[Or].ccall("wasm_set_phpini_entries",null,[Li],[O])}this[Or].ccall("php_wasm_init",null,[],[])}#n(){let O="/tmp/headers.json";if(!this.fileExists(O))throw new Error("SAPI Error: Could not find response headers file.");let A=JSON.parse(this.readFileAsText(O)),l={};for(let x of A.headers){if(!x.includes(": "))continue;let j=x.indexOf(": "),J=x.substring(0,j).toLowerCase(),ee=x.substring(j+2);J in l||(l[J]=[]),l[J].push(ee)}return{headers:l,httpStatusCode:A.status}}#i(O){if(this[Or].ccall("wasm_set_request_uri",null,[Li],[O]),O.includes("?")){let A=O.substring(O.indexOf("?")+1);this[Or].ccall("wasm_set_query_string",null,[Li],[A])}}#t(O,A){this[Or].ccall("wasm_set_request_host",null,[Li],[O]);let l;try{l=parseInt(new URL(O).port,10)}catch{}(!l||isNaN(l)||l===80)&&(l=A==="https"?443:80),this[Or].ccall("wasm_set_request_port",null,[ca],[l]),(A==="https"||!A&&l===443)&&this.addServerGlobalEntry("HTTPS","on")}#a(O){this[Or].ccall("wasm_set_request_method",null,[Li],[O])}#s(O){O.cookie&&this[Or].ccall("wasm_set_cookies",null,[Li],[O.cookie]),O["content-type"]&&this[Or].ccall("wasm_set_content_type",null,[Li],[O["content-type"]]),O["content-length"]&&this[Or].ccall("wasm_set_content_length",null,[ca],[parseInt(O["content-length"],10)]);for(let A in O)this.addServerGlobalEntry(`HTTP_${A.toUpperCase().replace(/-/g,"_")}`,O[A])}#u(O){this[Or].ccall("wasm_set_request_body",null,[Li],[O]),this[Or].ccall("wasm_set_content_length",null,[ca],[O.length])}#f(O){this[Or].ccall("wasm_set_path_translated",null,[Li],[O])}addServerGlobalEntry(O,A){this[Or].ccall("wasm_add_SERVER_entry",null,[Li,Li],[O,A])}#c(O){let{key:A,name:l,type:x,data:j}=O,J=`/tmp/${Math.random().toFixed(20)}`;this.writeFile(J,j);let ee=0;this[Or].ccall("wasm_add_uploaded_file",null,[Li,Li,Li,Li,ca,ca],[A,l,x,J,ee,j.byteLength])}#l(O){this[Or].ccall("wasm_set_php_code",null,[Li],[O])}async#d(){let O=await await this[Or].ccall("wasm_sapi_handle_request",ca,[],[]),{headers:A,httpStatusCode:l}=this.#n();return new qi(l,A,this.readFileAsBuffer("/tmp/stdout"),this.readFileAsText("/tmp/stderr"),O)}mkdir(O){this[Or].FS.mkdirTree(O)}mkdirTree(O){this.mkdir(O)}readFileAsText(O){return new TextDecoder().decode(this.readFileAsBuffer(O))}readFileAsBuffer(O){return this[Or].FS.readFile(O)}writeFile(O,A){this[Or].FS.writeFile(O,A)}unlink(O){this[Or].FS.unlink(O)}mv(O,A){this[Or].FS.mv(O,A)}rmdir(O,A={recursive:!0}){A?.recursive&&this.listFiles(O).forEach(l=>{let x=`${O}/${l}`;this.isDir(x)?this.rmdir(x,A):this.unlink(x)}),this[Or].FS.rmdir(O)}listFiles(O){if(!this.fileExists(O))return[];try{return this[Or].FS.readdir(O).filter(A=>A!=="."&&A!=="..")}catch(A){return console.error(A,{path:O}),[]}}isDir(O){return this.fileExists(O)?this[Or].FS.isDir(this[Or].FS.lookupPath(O).node.mode):!1}fileExists(O){try{return this[Or].FS.lookupPath(O),!0}catch{return!1}}};xi([Ui('Could not create directory "{path}"')],Mi.prototype,"mkdir",1),xi([Ui('Could not create directory "{path}"')],Mi.prototype,"mkdirTree",1),xi([Ui('Could not read "{path}"')],Mi.prototype,"readFileAsText",1),xi([Ui('Could not read "{path}"')],Mi.prototype,"readFileAsBuffer",1),xi([Ui('Could not write to "{path}"')],Mi.prototype,"writeFile",1),xi([Ui('Could not unlink "{path}"')],Mi.prototype,"unlink",1),xi([Ui('Could not move "{path}"')],Mi.prototype,"mv",1),xi([Ui('Could not remove directory "{path}"')],Mi.prototype,"rmdir",1),xi([Ui('Could not list files in "{path}"')],Mi.prototype,"listFiles",1),xi([Ui('Could not stat "{path}"')],Mi.prototype,"isDir",1),xi([Ui('Could not stat "{path}"')],Mi.prototype,"fileExists",1);function Qa(R){let O={};for(let A in R)O[A.toLowerCase()]=R[A];return O}async function Es(R=$a){switch(R){case"8.2":return await Promise.resolve().then(()=>(Ru(),Pu));case"8.1":return await Promise.resolve().then(()=>(Iu(),Lu));case"8.0":return await Promise.resolve().then(()=>(xu(),Bu));case"7.4":return await Promise.resolve().then(()=>(Wu(),zu));case"7.3":return await Promise.resolve().then(()=>(qu(),Yu));case"7.2":return await Promise.resolve().then(()=>(Gu(),Ku));case"7.1":return await Promise.resolve().then(()=>(Zu(),$u));case"7.0":return await Promise.resolve().then(()=>(ef(),Qu));case"5.6":return await Promise.resolve().then(()=>(nf(),tf))}throw new Error(`Unsupported PHP version ${R}`)}var sf=Yi(require("dns")),uf=Yi(require("util")),Va=Yi(require("net")),ff=Yi(require("http"));var rl=Yi(hs(),1),tl=Yi(Ia(),1),nl=Yi(Ua(),1),Ya=Yi(Wa(),1),gs=Yi(ws(),1);var of=Yi(require("net"));function qa(...R){process.env.DEV&&!process.env.TEST&&console.log(...R)}async function af(R){let O=[];for(let x=0;x<R;x++)O.push(ol());let A=await Promise.all(O),l=[];for(let x of A){let j=x.address();l.push(j.port),x.close()}return l}function ol(){return new Promise(R=>{let O=of.createServer();O.listen(0,()=>{R(O)})})}function cf(...R){qa("[WS Server]",...R)}var il=uf.promisify(sf.lookup);function al(R,O){if(typeof R=="string")R=String.fromCharCode(O)+R;else if(R instanceof ArrayBuffer||"byteLength"in R){let A=new Uint8Array(R.byteLength+1);A[0]=O,A.set(new Uint8Array(R),1),R=A.buffer}else throw console.log({chunk:R}),new Error("Unsupported chunk type: "+typeof R);return R}var lf=1,df=2;function _f(R){return class extends R{send(A,l){return this.sendCommand(lf,A,l)}setSocketOpt(A,l,x){return this.sendCommand(df,new Uint8Array([A,l,x]).buffer,()=>{})}sendCommand(A,l,x){return R.prototype.send.call(this,al(l,A),x)}}}function mf(R,O="127.0.0.1"){cf(`Binding the WebSockets server to ${O}:${R}...`);let A=ff.createServer((l,x)=>{x.writeHead(403,{"Content-Type":"text/plain"}),x.write(`403 Permission Denied
|
package/index.d.ts
CHANGED
|
@@ -146,7 +146,8 @@ export interface RequestHandler {
|
|
|
146
146
|
*/
|
|
147
147
|
absoluteUrl: string;
|
|
148
148
|
/**
|
|
149
|
-
* The
|
|
149
|
+
* The directory in the PHP filesystem where the server will look
|
|
150
|
+
* for the files to serve. Default: `/var/www`.
|
|
150
151
|
*/
|
|
151
152
|
documentRoot: string;
|
|
152
153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/node",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
4
4
|
"description": "PHP.wasm for Node.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"license": "(GPL-2.0-or-later OR MPL-2.0)",
|
|
29
29
|
"main": "index.cjs",
|
|
30
30
|
"types": "index.d.ts",
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "278ae7717090b6ee837b43c7d60df94dcdcaec3f",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"comlink": "4.4.1",
|
|
34
34
|
"express": "4.18.2",
|
|
35
35
|
"ws": "8.13.0",
|
|
36
|
-
"@php-wasm/universal": "0.1.
|
|
36
|
+
"@php-wasm/universal": "0.1.37"
|
|
37
37
|
}
|
|
38
38
|
}
|