@omrips/viewstl 0.0.0-stage → 2.0.0-rc.2

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.
Files changed (35) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +176 -2
  3. package/THIRD-PARTY-NOTICES.txt +1129 -0
  4. package/build/v2/README.md +11 -0
  5. package/build/v2/THIRD-PARTY-NOTICES.txt +1129 -0
  6. package/build/v2/cad/occt-import-js.js +8 -0
  7. package/build/v2/cad/occt-import-js.source.txt +57 -0
  8. package/build/v2/cad/occt-import-js.wasm +0 -0
  9. package/build/v2/cad/prepare-cad.source.txt +112 -0
  10. package/build/v2/chunks/archive-VGS4J4Z7.js +1 -0
  11. package/build/v2/chunks/cad-VY42CMP4.js +1 -0
  12. package/build/v2/chunks/chunk-JH3H3JWA.js +1 -0
  13. package/build/v2/chunks/chunk-JS56KC3I.js +1 -0
  14. package/build/v2/chunks/chunk-R3HNTB5A.js +38 -0
  15. package/build/v2/chunks/chunk-U33KANV7.js +1 -0
  16. package/build/v2/chunks/chunk-ZMK3UZZE.js +1 -0
  17. package/build/v2/chunks/chunk-ZSV4PTIA.js +1 -0
  18. package/build/v2/chunks/export-7OP4ZGGJ.js +29 -0
  19. package/build/v2/chunks/export-cad-QPBT756V.js +13 -0
  20. package/build/v2/chunks/export-zip-EDCWH5PX.js +1 -0
  21. package/build/v2/chunks/print-check-2PU7CSL3.js +1 -0
  22. package/build/v2/chunks/scene-export-KQBS7VRJ.js +1 -0
  23. package/build/v2/chunks/scene-reader-APUJOPUR.js +1 -0
  24. package/build/v2/stl_viewer.min.js +51 -0
  25. package/build/v2/viewstl.cjs +5445 -0
  26. package/build/v2/viewstl.d.cts +446 -0
  27. package/build/v2/viewstl.d.ts +446 -0
  28. package/build/v2/viewstl.js +5426 -0
  29. package/build/v2/viewstl.min.js +51 -0
  30. package/build/v2/viewstl.worker.js +1 -0
  31. package/docs/v2-compatibility.md +204 -0
  32. package/docs/v2-usage.md +739 -0
  33. package/docs/v2-verification.md +437 -0
  34. package/legacy/README.md +43 -0
  35. package/package.json +73 -4
@@ -0,0 +1,8 @@
1
+ var Vr=(R=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(R,{get:(I,Z)=>(typeof require<"u"?require:I)[Z]}):R)(function(R){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+R+'" is not supported')});var uo=(R,I)=>()=>{try{return I||R((I={exports:{}}).exports,I),I.exports}catch(Z){throw I=0,Z}};var fo=uo((xe,qr)=>{var Ue=(()=>{var R=typeof document<"u"?document.currentScript?.src:void 0;return typeof __filename<"u"&&(R=R||__filename),(function(I={}){var Z,d=I,Xr,ur,Ne=new Promise((r,e)=>{Xr=r,ur=e}),$e=typeof window=="object",fr=typeof importScripts=="function",J=!1,Gr=Object.assign({},d),Yr=[],Fr="./this.program",Kr=(r,e)=>{throw e},j="";function Ie(r){return d.locateFile?d.locateFile(r,j):j+r}var dr,or;if(J){var Sr=Vr("fs"),Zr=Vr("path");j=__dirname+"/",or=r=>{r=pr(r)?new URL(r):Zr.normalize(r);var e=Sr.readFileSync(r);return e},dr=(r,e=!0)=>(r=pr(r)?new URL(r):Zr.normalize(r),new Promise((t,n)=>{Sr.readFile(r,e?void 0:"utf8",(a,i)=>{a?n(a):t(e?i.buffer:i)})})),!d.thisProgram&&(void 0).argv.length>1&&(Fr=(void 0).argv[1].replace(/\\/g,"/")),Yr=(void 0).argv.slice(2),Kr=(r,e)=>{throw(void 0).exitCode=r,e}}else($e||fr)&&(fr?j=self.location.href:typeof document<"u"&&document.currentScript&&(j=document.currentScript.src),R&&(j=R),j.startsWith("blob:")?j="":j=j.substr(0,j.replace(/[?#].*/,"").lastIndexOf("/")+1),fr&&(or=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),dr=r=>pr(r)?new Promise((e,t)=>{var n=new XMLHttpRequest;n.open("GET",r,!0),n.responseType="arraybuffer",n.onload=()=>{if(n.status==200||n.status==0&&n.response){e(n.response);return}t(n.status)},n.onerror=t,n.send(null)}):fetch(r,{credentials:"same-origin"}).then(e=>e.ok?e.arrayBuffer():Promise.reject(new Error(e.status+" : "+e.url))));var Ar=d.print||console.log.bind(console),z=d.printErr||console.error.bind(console);Object.assign(d,Gr),Gr=null,d.arguments&&(Yr=d.arguments),d.thisProgram&&(Fr=d.thisProgram);var cr=d.wasmBinary,vr,Tr=!1,Jr;function ze(r,e){r||ir(e)}var M,C,V,hr,_,k,Qr,re;function ee(){var r=vr.buffer;d.HEAP8=M=new Int8Array(r),d.HEAP16=V=new Int16Array(r),d.HEAPU8=C=new Uint8Array(r),d.HEAPU16=hr=new Uint16Array(r),d.HEAP32=_=new Int32Array(r),d.HEAPU32=k=new Uint32Array(r),d.HEAPF32=Qr=new Float32Array(r),d.HEAPF64=re=new Float64Array(r)}var te=[],ne=[],oe=[],ae=!1;function Le(){var r=d.preRun;r&&(typeof r=="function"&&(r=[r]),r.forEach(We)),Mr(te)}function Be(){ae=!0,!d.noFSInit&&!o.initialized&&o.init(),o.ignorePermissions=!1,q.init(),Mr(ne)}function He(){var r=d.postRun;r&&(typeof r=="function"&&(r=[r]),r.forEach(qe)),Mr(oe)}function We(r){te.unshift(r)}function Ve(r){ne.unshift(r)}function qe(r){oe.unshift(r)}var G=0,Dr=null,ar=null;function co(r){return r}function Pr(r){G++,d.monitorRunDependencies?.(G)}function mr(r){if(G--,d.monitorRunDependencies?.(G),G==0&&(Dr!==null&&(clearInterval(Dr),Dr=null),ar)){var e=ar;ar=null,e()}}function ir(r){d.onAbort?.(r),r="Aborted("+r+")",z(r),Tr=!0,r+=". Build with -sASSERTIONS for more info.",ae&&Re();var e=new WebAssembly.RuntimeError(r);throw ur(e),e}var Xe="data:application/octet-stream;base64,",ie=r=>r.startsWith(Xe),pr=r=>r.startsWith("file://");function Ge(){var r="occt-import-js.wasm";return ie(r)?r:Ie(r)}var Cr;function se(r){if(r==Cr&&cr)return new Uint8Array(cr);if(or)return or(r);throw"both async and sync fetching of the wasm failed"}function Ye(r){return cr?Promise.resolve().then(()=>se(r)):dr(r).then(e=>new Uint8Array(e),()=>se(r))}function le(r,e,t){return Ye(r).then(n=>WebAssembly.instantiate(n,e)).then(t,n=>{z(`failed to asynchronously prepare wasm: ${n}`),ir(n)})}function Ke(r,e,t,n){return!r&&typeof WebAssembly.instantiateStreaming=="function"&&!ie(e)&&!pr(e)&&!J&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(a=>{var i=WebAssembly.instantiateStreaming(a,t);return i.then(n,function(s){return z(`wasm streaming compile failed: ${s}`),z("falling back to ArrayBuffer instantiation"),le(e,t,n)})}):le(e,t,n)}function Ze(){return{a:eo}}function Je(){var r=Ze();function e(n,a){return D=n.exports,vr=D._,ee(),ge=D.ba,Ve(D.$),mr("wasm-instantiate"),D}Pr("wasm-instantiate");function t(n){e(n.instance)}if(d.instantiateWasm)try{return d.instantiateWasm(r,e)}catch(n){z(`Module.instantiateWasm callback failed with error: ${n}`),ur(n)}return Cr??=Ge(),Ke(cr,Cr,r,t).catch(ur),{}}var y,A;function Qe(r){this.name="ExitStatus",this.message=`Program terminated with exit(${r})`,this.status=r}var Mr=r=>{r.forEach(e=>e(d))},rt=d.noExitRuntime||!0,b={isAbs:r=>r.charAt(0)==="/",splitPath:r=>{var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return e.exec(r).slice(1)},normalizeArray:(r,e)=>{for(var t=0,n=r.length-1;n>=0;n--){var a=r[n];a==="."?r.splice(n,1):a===".."?(r.splice(n,1),t++):t&&(r.splice(n,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=b.isAbs(r),t=r.substr(-1)==="/";return r=b.normalizeArray(r.split("/").filter(n=>!!n),!e).join("/"),!r&&!e&&(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=b.splitPath(r),t=e[0],n=e[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:r=>{if(r==="/")return"/";r=b.normalize(r),r=r.replace(/\/$/,"");var e=r.lastIndexOf("/");return e===-1?r:r.substr(e+1)},join:(...r)=>b.normalize(r.join("/")),join2:(r,e)=>b.normalize(r+"/"+e)},et=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return n=>crypto.getRandomValues(n);if(J)try{var r=Vr("crypto"),e=r.randomFillSync;if(e)return n=>r.randomFillSync(n);var t=r.randomBytes;return n=>(n.set(t(n.byteLength)),n)}catch{}ir("initRandomDevice")},ue=r=>(ue=et())(r),L={resolve:(...r)=>{for(var e="",t=!1,n=r.length-1;n>=-1&&!t;n--){var a=n>=0?r[n]:o.cwd();if(typeof a!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!a)return"";e=a+"/"+e,t=b.isAbs(a)}return e=b.normalizeArray(e.split("/").filter(i=>!!i),!t).join("/"),(t?"/":"")+e||"."},relative:(r,e)=>{r=L.resolve(r).substr(1),e=L.resolve(e).substr(1);function t(f){for(var c=0;c<f.length&&f[c]==="";c++);for(var h=f.length-1;h>=0&&f[h]==="";h--);return c>h?[]:f.slice(c,h-c+1)}for(var n=t(r.split("/")),a=t(e.split("/")),i=Math.min(n.length,a.length),s=i,l=0;l<i;l++)if(n[l]!==a[l]){s=l;break}for(var u=[],l=s;l<n.length;l++)u.push("..");return u=u.concat(a.slice(s)),u.join("/")}},fe=typeof TextDecoder<"u"?new TextDecoder:void 0,Q=(r,e=0,t=NaN)=>{for(var n=e+t,a=e;r[a]&&!(a>=n);)++a;if(a-e>16&&r.buffer&&fe)return fe.decode(r.subarray(e,a));for(var i="";e<a;){var s=r[e++];if(!(s&128)){i+=String.fromCharCode(s);continue}var l=r[e++]&63;if((s&224)==192){i+=String.fromCharCode((s&31)<<6|l);continue}var u=r[e++]&63;if((s&240)==224?s=(s&15)<<12|l<<6|u:s=(s&7)<<18|l<<12|u<<6|r[e++]&63,s<65536)i+=String.fromCharCode(s);else{var f=s-65536;i+=String.fromCharCode(55296|f>>10,56320|f&1023)}}return i},Rr=[],_r=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++t):e+=3}return e},jr=(r,e,t,n)=>{if(!(n>0))return 0;for(var a=t,i=t+n-1,s=0;s<r.length;++s){var l=r.charCodeAt(s);if(l>=55296&&l<=57343){var u=r.charCodeAt(++s);l=65536+((l&1023)<<10)|u&1023}if(l<=127){if(t>=i)break;e[t++]=l}else if(l<=2047){if(t+1>=i)break;e[t++]=192|l>>6,e[t++]=128|l&63}else if(l<=65535){if(t+2>=i)break;e[t++]=224|l>>12,e[t++]=128|l>>6&63,e[t++]=128|l&63}else{if(t+3>=i)break;e[t++]=240|l>>18,e[t++]=128|l>>12&63,e[t++]=128|l>>6&63,e[t++]=128|l&63}}return e[t]=0,t-a};function de(r,e,t){var n=t>0?t:_r(r)+1,a=new Array(n),i=jr(r,a,0,a.length);return e&&(a.length=i),a}var tt=()=>{if(!Rr.length){var r=null;if(J){var e=256,t=Buffer.alloc(e),n=0,a=(void 0).stdin.fd;try{n=Sr.readSync(a,t,0,e)}catch(i){if(i.toString().includes("EOF"))n=0;else throw i}n>0&&(r=t.slice(0,n).toString("utf-8"))}else typeof window<"u"&&typeof window.prompt=="function"&&(r=window.prompt("Input: "),r!==null&&(r+=`
2
+ `));if(!r)return null;Rr=de(r,!0)}return Rr.shift()},q={ttys:[],init(){},shutdown(){},register(r,e){q.ttys[r]={input:[],output:[],ops:e},o.registerDevice(r,q.stream_ops)},stream_ops:{open(r){var e=q.ttys[r.node.rdev];if(!e)throw new o.ErrnoError(43);r.tty=e,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,e,t,n,a){if(!r.tty||!r.tty.ops.get_char)throw new o.ErrnoError(60);for(var i=0,s=0;s<n;s++){var l;try{l=r.tty.ops.get_char(r.tty)}catch{throw new o.ErrnoError(29)}if(l===void 0&&i===0)throw new o.ErrnoError(6);if(l==null)break;i++,e[t+s]=l}return i&&(r.node.timestamp=Date.now()),i},write(r,e,t,n,a){if(!r.tty||!r.tty.ops.put_char)throw new o.ErrnoError(60);try{for(var i=0;i<n;i++)r.tty.ops.put_char(r.tty,e[t+i])}catch{throw new o.ErrnoError(29)}return n&&(r.node.timestamp=Date.now()),i}},default_tty_ops:{get_char(r){return tt()},put_char(r,e){e===null||e===10?(Ar(Q(r.output)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(Ar(Q(r.output)),r.output=[])},ioctl_tcgets(r){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(r,e,t){return 0},ioctl_tiocgwinsz(r){return[24,80]}},default_tty1_ops:{put_char(r,e){e===null||e===10?(z(Q(r.output)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(z(Q(r.output)),r.output=[])}}},nt=(r,e)=>{C.fill(0,r,r+e)},ce=(r,e)=>Math.ceil(r/e)*e,ve=r=>{r=ce(r,65536);var e=Me(65536,r);return e&&nt(e,r),e},w={ops_table:null,mount(r){return w.createNode(null,"/",16895,0)},createNode(r,e,t,n){if(o.isBlkdev(t)||o.isFIFO(t))throw new o.ErrnoError(63);w.ops_table||={dir:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr,lookup:w.node_ops.lookup,mknod:w.node_ops.mknod,rename:w.node_ops.rename,unlink:w.node_ops.unlink,rmdir:w.node_ops.rmdir,readdir:w.node_ops.readdir,symlink:w.node_ops.symlink},stream:{llseek:w.stream_ops.llseek}},file:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr},stream:{llseek:w.stream_ops.llseek,read:w.stream_ops.read,write:w.stream_ops.write,allocate:w.stream_ops.allocate,mmap:w.stream_ops.mmap,msync:w.stream_ops.msync}},link:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr,readlink:w.node_ops.readlink},stream:{}},chrdev:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr},stream:o.chrdev_stream_ops}};var a=o.createNode(r,e,t,n);return o.isDir(a.mode)?(a.node_ops=w.ops_table.dir.node,a.stream_ops=w.ops_table.dir.stream,a.contents={}):o.isFile(a.mode)?(a.node_ops=w.ops_table.file.node,a.stream_ops=w.ops_table.file.stream,a.usedBytes=0,a.contents=null):o.isLink(a.mode)?(a.node_ops=w.ops_table.link.node,a.stream_ops=w.ops_table.link.stream):o.isChrdev(a.mode)&&(a.node_ops=w.ops_table.chrdev.node,a.stream_ops=w.ops_table.chrdev.stream),a.timestamp=Date.now(),r&&(r.contents[e]=a,r.timestamp=a.timestamp),a},getFileDataAsTypedArray(r){return r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0)},expandFileStorage(r,e){var t=r.contents?r.contents.length:0;if(!(t>=e)){var n=1024*1024;e=Math.max(e,t*(t<n?2:1.125)>>>0),t!=0&&(e=Math.max(e,256));var a=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(a.subarray(0,r.usedBytes),0)}},resizeFileStorage(r,e){if(r.usedBytes!=e)if(e==0)r.contents=null,r.usedBytes=0;else{var t=r.contents;r.contents=new Uint8Array(e),t&&r.contents.set(t.subarray(0,Math.min(e,r.usedBytes))),r.usedBytes=e}},node_ops:{getattr(r){var e={};return e.dev=o.isChrdev(r.mode)?r.id:1,e.ino=r.id,e.mode=r.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=r.rdev,o.isDir(r.mode)?e.size=4096:o.isFile(r.mode)?e.size=r.usedBytes:o.isLink(r.mode)?e.size=r.link.length:e.size=0,e.atime=new Date(r.timestamp),e.mtime=new Date(r.timestamp),e.ctime=new Date(r.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(r,e){e.mode!==void 0&&(r.mode=e.mode),e.timestamp!==void 0&&(r.timestamp=e.timestamp),e.size!==void 0&&w.resizeFileStorage(r,e.size)},lookup(r,e){throw o.genericErrors[44]},mknod(r,e,t,n){return w.createNode(r,e,t,n)},rename(r,e,t){if(o.isDir(r.mode)){var n;try{n=o.lookupNode(e,t)}catch{}if(n)for(var a in n.contents)throw new o.ErrnoError(55)}delete r.parent.contents[r.name],r.parent.timestamp=Date.now(),r.name=t,e.contents[t]=r,e.timestamp=r.parent.timestamp},unlink(r,e){delete r.contents[e],r.timestamp=Date.now()},rmdir(r,e){var t=o.lookupNode(r,e);for(var n in t.contents)throw new o.ErrnoError(55);delete r.contents[e],r.timestamp=Date.now()},readdir(r){var e=[".",".."];for(var t of Object.keys(r.contents))e.push(t);return e},symlink(r,e,t){var n=w.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!o.isLink(r.mode))throw new o.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,n,a){var i=r.node.contents;if(a>=r.node.usedBytes)return 0;var s=Math.min(r.node.usedBytes-a,n);if(s>8&&i.subarray)e.set(i.subarray(a,a+s),t);else for(var l=0;l<s;l++)e[t+l]=i[a+l];return s},write(r,e,t,n,a,i){if(e.buffer===M.buffer&&(i=!1),!n)return 0;var s=r.node;if(s.timestamp=Date.now(),e.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=e.subarray(t,t+n),s.usedBytes=n,n;if(s.usedBytes===0&&a===0)return s.contents=e.slice(t,t+n),s.usedBytes=n,n;if(a+n<=s.usedBytes)return s.contents.set(e.subarray(t,t+n),a),n}if(w.expandFileStorage(s,a+n),s.contents.subarray&&e.subarray)s.contents.set(e.subarray(t,t+n),a);else for(var l=0;l<n;l++)s.contents[a+l]=e[t+l];return s.usedBytes=Math.max(s.usedBytes,a+n),n},llseek(r,e,t){var n=e;if(t===1?n+=r.position:t===2&&o.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new o.ErrnoError(28);return n},allocate(r,e,t){w.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,n,a){if(!o.isFile(r.node.mode))throw new o.ErrnoError(43);var i,s,l=r.node.contents;if(!(a&2)&&l&&l.buffer===M.buffer)s=!1,i=l.byteOffset;else{if(s=!0,i=ve(e),!i)throw new o.ErrnoError(48);l&&((t>0||t+e<l.length)&&(l.subarray?l=l.subarray(t,t+e):l=Array.prototype.slice.call(l,t,t+e)),M.set(l,i))}return{ptr:i,allocated:s}},msync(r,e,t,n,a){return w.stream_ops.write(r,e,0,n,t,!1),0}}},ot=(r,e,t,n)=>{var a=n?"":`al ${r}`;dr(r).then(i=>{e(new Uint8Array(i)),a&&mr(a)},i=>{if(t)t();else throw`Loading data file "${r}" failed.`}),a&&Pr(a)},at=(r,e,t,n,a,i)=>{o.createDataFile(r,e,t,n,a,i)},it=d.preloadPlugins||[],st=(r,e,t,n)=>{typeof Browser<"u"&&Browser.init();var a=!1;return it.forEach(i=>{a||i.canHandle(e)&&(i.handle(r,e,t,n),a=!0)}),a},lt=(r,e,t,n,a,i,s,l,u,f)=>{var c=e?L.resolve(b.join2(r,e)):r,h=`cp ${c}`;function p(v){function m(g){f?.(),l||at(r,e,g,n,a,u),i?.(),mr(h)}st(v,c,m,()=>{s?.(),mr(h)})||m(v)}Pr(h),typeof t=="string"?ot(t,p,s):p(t)},ut=r=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=e[r];if(typeof t>"u")throw new Error(`Unknown file open mode: ${r}`);return t},Or=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},o={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(r){this.name="ErrnoError",this.errno=r}},genericErrors:{},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(r){this.node=r}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{constructor(r,e,t,n){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=o.nextInode++,this.name=e,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(r){r?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(r){r?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return o.isDir(this.mode)}get isDevice(){return o.isChrdev(this.mode)}},lookupPath(r,e={}){if(r=L.resolve(r),!r)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(e=Object.assign(t,e),e.recurse_count>8)throw new o.ErrnoError(32);for(var n=r.split("/").filter(h=>!!h),a=o.root,i="/",s=0;s<n.length;s++){var l=s===n.length-1;if(l&&e.parent)break;if(a=o.lookupNode(a,n[s]),i=b.join2(i,n[s]),o.isMountpoint(a)&&(!l||l&&e.follow_mount)&&(a=a.mounted.root),!l||e.follow)for(var u=0;o.isLink(a.mode);){var f=o.readlink(i);i=L.resolve(b.dirname(i),f);var c=o.lookupPath(i,{recurse_count:e.recurse_count+1});if(a=c.node,u++>40)throw new o.ErrnoError(32)}}return{path:i,node:a}},getPath(r){for(var e;;){if(o.isRoot(r)){var t=r.mount.mountpoint;return e?t[t.length-1]!=="/"?`${t}/${e}`:t+e:t}e=e?`${r.name}/${e}`:r.name,r=r.parent}},hashName(r,e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return(r+t>>>0)%o.nameTable.length},hashAddNode(r){var e=o.hashName(r.parent.id,r.name);r.name_next=o.nameTable[e],o.nameTable[e]=r},hashRemoveNode(r){var e=o.hashName(r.parent.id,r.name);if(o.nameTable[e]===r)o.nameTable[e]=r.name_next;else for(var t=o.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=o.mayLookup(r);if(t)throw new o.ErrnoError(t);for(var n=o.hashName(r.id,e),a=o.nameTable[n];a;a=a.name_next){var i=a.name;if(a.parent.id===r.id&&i===e)return a}return o.lookup(r,e)},createNode(r,e,t,n){var a=new o.FSNode(r,e,t,n);return o.hashAddNode(a),a},destroyNode(r){o.hashRemoveNode(r)},isRoot(r){return r===r.parent},isMountpoint(r){return!!r.mounted},isFile(r){return(r&61440)===32768},isDir(r){return(r&61440)===16384},isLink(r){return(r&61440)===40960},isChrdev(r){return(r&61440)===8192},isBlkdev(r){return(r&61440)===24576},isFIFO(r){return(r&61440)===4096},isSocket(r){return(r&49152)===49152},flagsToPermissionString(r){var e=["r","w","rw"][r&3];return r&512&&(e+="w"),e},nodePermissions(r,e){return o.ignorePermissions?0:e.includes("r")&&!(r.mode&292)||e.includes("w")&&!(r.mode&146)||e.includes("x")&&!(r.mode&73)?2:0},mayLookup(r){if(!o.isDir(r.mode))return 54;var e=o.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){try{var t=o.lookupNode(r,e);return 20}catch{}return o.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=o.lookupNode(r,e)}catch(i){return i.errno}var a=o.nodePermissions(r,"wx");if(a)return a;if(t){if(!o.isDir(n.mode))return 54;if(o.isRoot(n)||o.getPath(n)===o.cwd())return 10}else if(o.isDir(n.mode))return 31;return 0},mayOpen(r,e){return r?o.isLink(r.mode)?32:o.isDir(r.mode)&&(o.flagsToPermissionString(e)!=="r"||e&512)?31:o.nodePermissions(r,o.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=o.MAX_OPEN_FDS;r++)if(!o.streams[r])return r;throw new o.ErrnoError(33)},getStreamChecked(r){var e=o.getStream(r);if(!e)throw new o.ErrnoError(8);return e},getStream:r=>o.streams[r],createStream(r,e=-1){return r=Object.assign(new o.FSStream,r),e==-1&&(e=o.nextfd()),r.fd=e,o.streams[e]=r,r},closeStream(r){o.streams[r]=null},dupStream(r,e=-1){var t=o.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=o.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new o.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,e)=>r<<8|e,registerDevice(r,e){o.devices[r]={stream_ops:e}},getDevice:r=>o.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var n=t.pop();e.push(n),t.push(...n.mounts)}return e},syncfs(r,e){typeof r=="function"&&(e=r,r=!1),o.syncFSRequests++,o.syncFSRequests>1&&z(`warning: ${o.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=o.getMounts(o.root.mount),n=0;function a(s){return o.syncFSRequests--,e(s)}function i(s){if(s)return i.errored?void 0:(i.errored=!0,a(s));++n>=t.length&&a(null)}t.forEach(s=>{if(!s.type.syncfs)return i(null);s.type.syncfs(s,r,i)})},mount(r,e,t){var n=t==="/",a=!t,i;if(n&&o.root)throw new o.ErrnoError(10);if(!n&&!a){var s=o.lookupPath(t,{follow_mount:!1});if(t=s.path,i=s.node,o.isMountpoint(i))throw new o.ErrnoError(10);if(!o.isDir(i.mode))throw new o.ErrnoError(54)}var l={type:r,opts:e,mountpoint:t,mounts:[]},u=r.mount(l);return u.mount=l,l.root=u,n?o.root=u:i&&(i.mounted=l,i.mount&&i.mount.mounts.push(l)),u},unmount(r){var e=o.lookupPath(r,{follow_mount:!1});if(!o.isMountpoint(e.node))throw new o.ErrnoError(28);var t=e.node,n=t.mounted,a=o.getMounts(n);Object.keys(o.nameTable).forEach(s=>{for(var l=o.nameTable[s];l;){var u=l.name_next;a.includes(l.mount)&&o.destroyNode(l),l=u}}),t.mounted=null;var i=t.mount.mounts.indexOf(n);t.mount.mounts.splice(i,1)},lookup(r,e){return r.node_ops.lookup(r,e)},mknod(r,e,t){var n=o.lookupPath(r,{parent:!0}),a=n.node,i=b.basename(r);if(!i||i==="."||i==="..")throw new o.ErrnoError(28);var s=o.mayCreate(a,i);if(s)throw new o.ErrnoError(s);if(!a.node_ops.mknod)throw new o.ErrnoError(63);return a.node_ops.mknod(a,i,e,t)},create(r,e){return e=e!==void 0?e:438,e&=4095,e|=32768,o.mknod(r,e,0)},mkdir(r,e){return e=e!==void 0?e:511,e&=1023,e|=16384,o.mknod(r,e,0)},mkdirTree(r,e){for(var t=r.split("/"),n="",a=0;a<t.length;++a)if(t[a]){n+="/"+t[a];try{o.mkdir(n,e)}catch(i){if(i.errno!=20)throw i}}},mkdev(r,e,t){return typeof t>"u"&&(t=e,e=438),e|=8192,o.mknod(r,e,t)},symlink(r,e){if(!L.resolve(r))throw new o.ErrnoError(44);var t=o.lookupPath(e,{parent:!0}),n=t.node;if(!n)throw new o.ErrnoError(44);var a=b.basename(e),i=o.mayCreate(n,a);if(i)throw new o.ErrnoError(i);if(!n.node_ops.symlink)throw new o.ErrnoError(63);return n.node_ops.symlink(n,a,r)},rename(r,e){var t=b.dirname(r),n=b.dirname(e),a=b.basename(r),i=b.basename(e),s,l,u;if(s=o.lookupPath(r,{parent:!0}),l=s.node,s=o.lookupPath(e,{parent:!0}),u=s.node,!l||!u)throw new o.ErrnoError(44);if(l.mount!==u.mount)throw new o.ErrnoError(75);var f=o.lookupNode(l,a),c=L.relative(r,n);if(c.charAt(0)!==".")throw new o.ErrnoError(28);if(c=L.relative(e,t),c.charAt(0)!==".")throw new o.ErrnoError(55);var h;try{h=o.lookupNode(u,i)}catch{}if(f!==h){var p=o.isDir(f.mode),v=o.mayDelete(l,a,p);if(v)throw new o.ErrnoError(v);if(v=h?o.mayDelete(u,i,p):o.mayCreate(u,i),v)throw new o.ErrnoError(v);if(!l.node_ops.rename)throw new o.ErrnoError(63);if(o.isMountpoint(f)||h&&o.isMountpoint(h))throw new o.ErrnoError(10);if(u!==l&&(v=o.nodePermissions(l,"w"),v))throw new o.ErrnoError(v);o.hashRemoveNode(f);try{l.node_ops.rename(f,u,i),f.parent=u}catch(m){throw m}finally{o.hashAddNode(f)}}},rmdir(r){var e=o.lookupPath(r,{parent:!0}),t=e.node,n=b.basename(r),a=o.lookupNode(t,n),i=o.mayDelete(t,n,!0);if(i)throw new o.ErrnoError(i);if(!t.node_ops.rmdir)throw new o.ErrnoError(63);if(o.isMountpoint(a))throw new o.ErrnoError(10);t.node_ops.rmdir(t,n),o.destroyNode(a)},readdir(r){var e=o.lookupPath(r,{follow:!0}),t=e.node;if(!t.node_ops.readdir)throw new o.ErrnoError(54);return t.node_ops.readdir(t)},unlink(r){var e=o.lookupPath(r,{parent:!0}),t=e.node;if(!t)throw new o.ErrnoError(44);var n=b.basename(r),a=o.lookupNode(t,n),i=o.mayDelete(t,n,!1);if(i)throw new o.ErrnoError(i);if(!t.node_ops.unlink)throw new o.ErrnoError(63);if(o.isMountpoint(a))throw new o.ErrnoError(10);t.node_ops.unlink(t,n),o.destroyNode(a)},readlink(r){var e=o.lookupPath(r),t=e.node;if(!t)throw new o.ErrnoError(44);if(!t.node_ops.readlink)throw new o.ErrnoError(28);return L.resolve(o.getPath(t.parent),t.node_ops.readlink(t))},stat(r,e){var t=o.lookupPath(r,{follow:!e}),n=t.node;if(!n)throw new o.ErrnoError(44);if(!n.node_ops.getattr)throw new o.ErrnoError(63);return n.node_ops.getattr(n)},lstat(r){return o.stat(r,!0)},chmod(r,e,t){var n;if(typeof r=="string"){var a=o.lookupPath(r,{follow:!t});n=a.node}else n=r;if(!n.node_ops.setattr)throw new o.ErrnoError(63);n.node_ops.setattr(n,{mode:e&4095|n.mode&-4096,timestamp:Date.now()})},lchmod(r,e){o.chmod(r,e,!0)},fchmod(r,e){var t=o.getStreamChecked(r);o.chmod(t.node,e)},chown(r,e,t,n){var a;if(typeof r=="string"){var i=o.lookupPath(r,{follow:!n});a=i.node}else a=r;if(!a.node_ops.setattr)throw new o.ErrnoError(63);a.node_ops.setattr(a,{timestamp:Date.now()})},lchown(r,e,t){o.chown(r,e,t,!0)},fchown(r,e,t){var n=o.getStreamChecked(r);o.chown(n.node,e,t)},truncate(r,e){if(e<0)throw new o.ErrnoError(28);var t;if(typeof r=="string"){var n=o.lookupPath(r,{follow:!0});t=n.node}else t=r;if(!t.node_ops.setattr)throw new o.ErrnoError(63);if(o.isDir(t.mode))throw new o.ErrnoError(31);if(!o.isFile(t.mode))throw new o.ErrnoError(28);var a=o.nodePermissions(t,"w");if(a)throw new o.ErrnoError(a);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=o.getStreamChecked(r);if((t.flags&2097155)===0)throw new o.ErrnoError(28);o.truncate(t.node,e)},utime(r,e,t){var n=o.lookupPath(r,{follow:!0}),a=n.node;a.node_ops.setattr(a,{timestamp:Math.max(e,t)})},open(r,e,t){if(r==="")throw new o.ErrnoError(44);e=typeof e=="string"?ut(e):e,e&64?(t=typeof t>"u"?438:t,t=t&4095|32768):t=0;var n;if(typeof r=="object")n=r;else{r=b.normalize(r);try{var a=o.lookupPath(r,{follow:!(e&131072)});n=a.node}catch{}}var i=!1;if(e&64)if(n){if(e&128)throw new o.ErrnoError(20)}else n=o.mknod(r,t,0),i=!0;if(!n)throw new o.ErrnoError(44);if(o.isChrdev(n.mode)&&(e&=-513),e&65536&&!o.isDir(n.mode))throw new o.ErrnoError(54);if(!i){var s=o.mayOpen(n,e);if(s)throw new o.ErrnoError(s)}e&512&&!i&&o.truncate(n,0),e&=-131713;var l=o.createStream({node:n,path:o.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),d.logReadFiles&&!(e&1)&&(r in o.readFiles||(o.readFiles[r]=1)),l},close(r){if(o.isClosed(r))throw new o.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{o.closeStream(r.fd)}r.fd=null},isClosed(r){return r.fd===null},llseek(r,e,t){if(o.isClosed(r))throw new o.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new o.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new o.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,n,a){if(n<0||a<0)throw new o.ErrnoError(28);if(o.isClosed(r))throw new o.ErrnoError(8);if((r.flags&2097155)===1)throw new o.ErrnoError(8);if(o.isDir(r.node.mode))throw new o.ErrnoError(31);if(!r.stream_ops.read)throw new o.ErrnoError(28);var i=typeof a<"u";if(!i)a=r.position;else if(!r.seekable)throw new o.ErrnoError(70);var s=r.stream_ops.read(r,e,t,n,a);return i||(r.position+=s),s},write(r,e,t,n,a,i){if(n<0||a<0)throw new o.ErrnoError(28);if(o.isClosed(r))throw new o.ErrnoError(8);if((r.flags&2097155)===0)throw new o.ErrnoError(8);if(o.isDir(r.node.mode))throw new o.ErrnoError(31);if(!r.stream_ops.write)throw new o.ErrnoError(28);r.seekable&&r.flags&1024&&o.llseek(r,0,2);var s=typeof a<"u";if(!s)a=r.position;else if(!r.seekable)throw new o.ErrnoError(70);var l=r.stream_ops.write(r,e,t,n,a,i);return s||(r.position+=l),l},allocate(r,e,t){if(o.isClosed(r))throw new o.ErrnoError(8);if(e<0||t<=0)throw new o.ErrnoError(28);if((r.flags&2097155)===0)throw new o.ErrnoError(8);if(!o.isFile(r.node.mode)&&!o.isDir(r.node.mode))throw new o.ErrnoError(43);if(!r.stream_ops.allocate)throw new o.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,n,a){if((n&2)!==0&&(a&2)===0&&(r.flags&2097155)!==2)throw new o.ErrnoError(2);if((r.flags&2097155)===1)throw new o.ErrnoError(2);if(!r.stream_ops.mmap)throw new o.ErrnoError(43);if(!e)throw new o.ErrnoError(28);return r.stream_ops.mmap(r,e,t,n,a)},msync(r,e,t,n,a){return r.stream_ops.msync?r.stream_ops.msync(r,e,t,n,a):0},ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new o.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary",e.encoding!=="utf8"&&e.encoding!=="binary")throw new Error(`Invalid encoding type "${e.encoding}"`);var t,n=o.open(r,e.flags),a=o.stat(r),i=a.size,s=new Uint8Array(i);return o.read(n,s,0,i,0),e.encoding==="utf8"?t=Q(s):e.encoding==="binary"&&(t=s),o.close(n),t},writeFile(r,e,t={}){t.flags=t.flags||577;var n=o.open(r,t.flags,t.mode);if(typeof e=="string"){var a=new Uint8Array(_r(e)+1),i=jr(e,a,0,a.length);o.write(n,a,0,i,void 0,t.canOwn)}else if(ArrayBuffer.isView(e))o.write(n,e,0,e.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");o.close(n)},cwd:()=>o.currentPath,chdir(r){var e=o.lookupPath(r,{follow:!0});if(e.node===null)throw new o.ErrnoError(44);if(!o.isDir(e.node.mode))throw new o.ErrnoError(54);var t=o.nodePermissions(e.node,"x");if(t)throw new o.ErrnoError(t);o.currentPath=e.path},createDefaultDirectories(){o.mkdir("/tmp"),o.mkdir("/home"),o.mkdir("/home/web_user")},createDefaultDevices(){o.mkdir("/dev"),o.registerDevice(o.makedev(1,3),{read:()=>0,write:(n,a,i,s,l)=>s}),o.mkdev("/dev/null",o.makedev(1,3)),q.register(o.makedev(5,0),q.default_tty_ops),q.register(o.makedev(6,0),q.default_tty1_ops),o.mkdev("/dev/tty",o.makedev(5,0)),o.mkdev("/dev/tty1",o.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(e===0&&(e=ue(r).byteLength),r[--e]);o.createDevice("/dev","random",t),o.createDevice("/dev","urandom",t),o.mkdir("/dev/shm"),o.mkdir("/dev/shm/tmp")},createSpecialDirectories(){o.mkdir("/proc");var r=o.mkdir("/proc/self");o.mkdir("/proc/self/fd"),o.mount({mount(){var e=o.createNode(r,"fd",16895,73);return e.node_ops={lookup(t,n){var a=+n,i=o.getStreamChecked(a),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},e}},{},"/proc/self/fd")},createStandardStreams(r,e,t){r?o.createDevice("/dev","stdin",r):o.symlink("/dev/tty","/dev/stdin"),e?o.createDevice("/dev","stdout",null,e):o.symlink("/dev/tty","/dev/stdout"),t?o.createDevice("/dev","stderr",null,t):o.symlink("/dev/tty1","/dev/stderr");var n=o.open("/dev/stdin",0),a=o.open("/dev/stdout",1),i=o.open("/dev/stderr",1)},staticInit(){[44].forEach(r=>{o.genericErrors[r]=new o.ErrnoError(r),o.genericErrors[r].stack="<generic error, no stack>"}),o.nameTable=new Array(4096),o.mount(w,{},"/"),o.createDefaultDirectories(),o.createDefaultDevices(),o.createSpecialDirectories(),o.filesystems={MEMFS:w}},init(r,e,t){o.initialized=!0,r??=d.stdin,e??=d.stdout,t??=d.stderr,o.createStandardStreams(r,e,t)},quit(){o.initialized=!1;for(var r=0;r<o.streams.length;r++){var e=o.streams[r];e&&o.close(e)}},findObject(r,e){var t=o.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{var t=o.lookupPath(r,{follow:!e});r=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=o.lookupPath(r,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=b.basename(r),t=o.lookupPath(r,{follow:!e}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(a){n.error=a.errno}return n},createPath(r,e,t,n){r=typeof r=="string"?r:o.getPath(r);for(var a=e.split("/").reverse();a.length;){var i=a.pop();if(i){var s=b.join2(r,i);try{o.mkdir(s)}catch{}r=s}}return s},createFile(r,e,t,n,a){var i=b.join2(typeof r=="string"?r:o.getPath(r),e),s=Or(n,a);return o.create(i,s)},createDataFile(r,e,t,n,a,i){var s=e;r&&(r=typeof r=="string"?r:o.getPath(r),s=e?b.join2(r,e):r);var l=Or(n,a),u=o.create(s,l);if(t){if(typeof t=="string"){for(var f=new Array(t.length),c=0,h=t.length;c<h;++c)f[c]=t.charCodeAt(c);t=f}o.chmod(u,l|146);var p=o.open(u,577);o.write(p,t,0,t.length,0,i),o.close(p),o.chmod(u,l)}},createDevice(r,e,t,n){var a=b.join2(typeof r=="string"?r:o.getPath(r),e),i=Or(!!t,!!n);o.createDevice.major??=64;var s=o.makedev(o.createDevice.major++,0);return o.registerDevice(s,{open(l){l.seekable=!1},close(l){n?.buffer?.length&&n(10)},read(l,u,f,c,h){for(var p=0,v=0;v<c;v++){var m;try{m=t()}catch{throw new o.ErrnoError(29)}if(m===void 0&&p===0)throw new o.ErrnoError(6);if(m==null)break;p++,u[f+v]=m}return p&&(l.node.timestamp=Date.now()),p},write(l,u,f,c,h){for(var p=0;p<c;p++)try{n(u[f+p])}catch{throw new o.ErrnoError(29)}return c&&(l.node.timestamp=Date.now()),p}}),o.mkdev(a,i,s)},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.");try{r.contents=or(r.url),r.usedBytes=r.contents.length}catch{throw new o.ErrnoError(29)}},createLazyFile(r,e,t,n,a){class i{constructor(){this.lengthKnown=!1,this.chunks=[]}get(v){if(!(v>this.length-1||v<0)){var m=v%this.chunkSize,g=v/this.chunkSize|0;return this.getter(g)[m]}}setDataGetter(v){this.getter=v}cacheLength(){var v=new XMLHttpRequest;if(v.open("HEAD",t,!1),v.send(null),!(v.status>=200&&v.status<300||v.status===304))throw new Error("Couldn't load "+t+". Status: "+v.status);var m=Number(v.getResponseHeader("Content-length")),g,S=(g=v.getResponseHeader("Accept-Ranges"))&&g==="bytes",F=(g=v.getResponseHeader("Content-Encoding"))&&g==="gzip",x=1024*1024;S||(x=m);var N=($,nr)=>{if($>nr)throw new Error("invalid range ("+$+", "+nr+") or no bytes requested!");if(nr>m-1)throw new Error("only "+m+" bytes available! programmer error!");var P=new XMLHttpRequest;if(P.open("GET",t,!1),m!==x&&P.setRequestHeader("Range","bytes="+$+"-"+nr),P.responseType="arraybuffer",P.overrideMimeType&&P.overrideMimeType("text/plain; charset=x-user-defined"),P.send(null),!(P.status>=200&&P.status<300||P.status===304))throw new Error("Couldn't load "+t+". Status: "+P.status);return P.response!==void 0?new Uint8Array(P.response||[]):de(P.responseText||"",!0)},lr=this;lr.setDataGetter($=>{var nr=$*x,P=($+1)*x-1;if(P=Math.min(P,m-1),typeof lr.chunks[$]>"u"&&(lr.chunks[$]=N(nr,P)),typeof lr.chunks[$]>"u")throw new Error("doXHR failed!");return lr.chunks[$]}),(F||!m)&&(x=m=1,m=this.getter(0).length,x=m,Ar("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=m,this._chunkSize=x,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!fr)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new i,l={isDevice:!1,contents:s}}else var l={isDevice:!1,url:t};var u=o.createFile(r,e,l,n,a);l.contents?u.contents=l.contents:l.url&&(u.contents=null,u.url=l.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var f={},c=Object.keys(u.stream_ops);c.forEach(p=>{var v=u.stream_ops[p];f[p]=(...m)=>(o.forceLoadFile(u),v(...m))});function h(p,v,m,g,S){var F=p.node.contents;if(S>=F.length)return 0;var x=Math.min(F.length-S,g);if(F.slice)for(var N=0;N<x;N++)v[m+N]=F[S+N];else for(var N=0;N<x;N++)v[m+N]=F.get(S+N);return x}return f.read=(p,v,m,g,S)=>(o.forceLoadFile(u),h(p,v,m,g,S)),f.mmap=(p,v,m,g,S)=>{o.forceLoadFile(u);var F=ve(v);if(!F)throw new o.ErrnoError(48);return h(p,M,F,v,m),{ptr:F,allocated:!0}},u.stream_ops=f,u}},Ur=(r,e)=>r?Q(C,r,e):"",E={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(b.isAbs(e))return e;var n;if(r===-100)n=o.cwd();else{var a=E.getStreamFromFD(r);n=a.path}if(e.length==0){if(!t)throw new o.ErrnoError(44);return n}return b.join2(n,e)},doStat(r,e,t){var n=r(e);_[t>>2]=n.dev,_[t+4>>2]=n.mode,k[t+8>>2]=n.nlink,_[t+12>>2]=n.uid,_[t+16>>2]=n.gid,_[t+20>>2]=n.rdev,A=[n.size>>>0,(y=n.size,+Math.abs(y)>=1?y>0?+Math.floor(y/4294967296)>>>0:~~+Math.ceil((y-+(~~y>>>0))/4294967296)>>>0:0)],_[t+24>>2]=A[0],_[t+28>>2]=A[1],_[t+32>>2]=4096,_[t+36>>2]=n.blocks;var a=n.atime.getTime(),i=n.mtime.getTime(),s=n.ctime.getTime();return A=[Math.floor(a/1e3)>>>0,(y=Math.floor(a/1e3),+Math.abs(y)>=1?y>0?+Math.floor(y/4294967296)>>>0:~~+Math.ceil((y-+(~~y>>>0))/4294967296)>>>0:0)],_[t+40>>2]=A[0],_[t+44>>2]=A[1],k[t+48>>2]=a%1e3*1e3*1e3,A=[Math.floor(i/1e3)>>>0,(y=Math.floor(i/1e3),+Math.abs(y)>=1?y>0?+Math.floor(y/4294967296)>>>0:~~+Math.ceil((y-+(~~y>>>0))/4294967296)>>>0:0)],_[t+56>>2]=A[0],_[t+60>>2]=A[1],k[t+64>>2]=i%1e3*1e3*1e3,A=[Math.floor(s/1e3)>>>0,(y=Math.floor(s/1e3),+Math.abs(y)>=1?y>0?+Math.floor(y/4294967296)>>>0:~~+Math.ceil((y-+(~~y>>>0))/4294967296)>>>0:0)],_[t+72>>2]=A[0],_[t+76>>2]=A[1],k[t+80>>2]=s%1e3*1e3*1e3,A=[n.ino>>>0,(y=n.ino,+Math.abs(y)>=1?y>0?+Math.floor(y/4294967296)>>>0:~~+Math.ceil((y-+(~~y>>>0))/4294967296)>>>0:0)],_[t+88>>2]=A[0],_[t+92>>2]=A[1],0},doMsync(r,e,t,n,a){if(!o.isFile(e.node.mode))throw new o.ErrnoError(43);if(n&2)return 0;var i=C.slice(r,r+t);o.msync(e,i,a,t,n)},getStreamFromFD(r){var e=o.getStreamChecked(r);return e},varargs:void 0,getStr(r){var e=Ur(r);return e}};function ft(r,e){try{return r=E.getStr(r),o.chmod(r,e),0}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function dt(r,e,t,n){try{if(e=E.getStr(e),e=E.calculateAt(r,e),t&-8)return-28;var a=o.lookupPath(e,{follow:!0}),i=a.node;if(!i)return-44;var s="";return t&4&&(s+="r"),t&2&&(s+="w"),t&1&&(s+="x"),s&&o.nodePermissions(i,s)?-2:0}catch(l){if(typeof o>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}function wr(){var r=_[+E.varargs>>2];return E.varargs+=4,r}var rr=wr;function ct(r,e,t){E.varargs=t;try{var n=E.getStreamFromFD(r);switch(e){case 0:{var a=wr();if(a<0)return-28;for(;o.streams[a];)a++;var i;return i=o.dupStream(n,a),i.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var a=wr();return n.flags|=a,0}case 12:{var a=rr(),s=0;return V[a+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(l){if(typeof o>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}function vt(r,e){try{var t=E.getStreamFromFD(r);return E.doStat(o.stat,t.path,e)}catch(n){if(typeof o>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function ht(r,e,t){E.varargs=t;try{var n=E.getStreamFromFD(r);switch(e){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var a=n.tty.ops.ioctl_tcgets(n),i=rr();_[i>>2]=a.c_iflag||0,_[i+4>>2]=a.c_oflag||0,_[i+8>>2]=a.c_cflag||0,_[i+12>>2]=a.c_lflag||0;for(var s=0;s<32;s++)M[i+s+17]=a.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var i=rr(),l=_[i>>2],u=_[i+4>>2],f=_[i+8>>2],c=_[i+12>>2],h=[],s=0;s<32;s++)h.push(M[i+s+17]);return n.tty.ops.ioctl_tcsets(n.tty,e,{c_iflag:l,c_oflag:u,c_cflag:f,c_lflag:c,c_cc:h})}return 0}case 21519:{if(!n.tty)return-59;var i=rr();return _[i>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var i=rr();return o.ioctl(n,e,i)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var p=n.tty.ops.ioctl_tiocgwinsz(n.tty),i=rr();V[i>>1]=p[0],V[i+2>>1]=p[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(v){if(typeof o>"u"||v.name!=="ErrnoError")throw v;return-v.errno}}function mt(r,e){try{return r=E.getStr(r),E.doStat(o.lstat,r,e)}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function pt(r,e,t,n){try{e=E.getStr(e);var a=n&256,i=n&4096;return n=n&-6401,e=E.calculateAt(r,e,i),E.doStat(a?o.lstat:o.stat,e,t)}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function _t(r,e,t,n){E.varargs=n;try{e=E.getStr(e),e=E.calculateAt(r,e);var a=n?wr():0;return o.open(e,t,a).fd}catch(i){if(typeof o>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function wt(r){try{return r=E.getStr(r),o.rmdir(r),0}catch(e){if(typeof o>"u"||e.name!=="ErrnoError")throw e;return-e.errno}}function yt(r,e){try{return r=E.getStr(r),E.doStat(o.stat,r,e)}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function gt(r,e,t){try{return e=E.getStr(e),e=E.calculateAt(r,e),t===0?o.unlink(e):t===512?o.rmdir(e):ir("Invalid flags passed to unlinkat"),0}catch(n){if(typeof o>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var Et=()=>{ir("")},kt=(r,e,t,n,a)=>{},bt=()=>{for(var r=new Array(256),e=0;e<256;++e)r[e]=String.fromCharCode(e);he=r},he,O=r=>{for(var e="",t=r;C[t];)e+=he[C[t++]];return e},er={},Y={},yr={},me,U=r=>{throw new me(r)},pe,_e=r=>{throw new pe(r)},Ft=(r,e,t)=>{r.forEach(l=>yr[l]=e);function n(l){var u=t(l);u.length!==r.length&&_e("Mismatched type converter count");for(var f=0;f<r.length;++f)B(r[f],u[f])}var a=new Array(e.length),i=[],s=0;e.forEach((l,u)=>{Y.hasOwnProperty(l)?a[u]=Y[l]:(i.push(l),er.hasOwnProperty(l)||(er[l]=[]),er[l].push(()=>{a[u]=Y[l],++s,s===i.length&&n(a)}))}),i.length===0&&n(a)};function St(r,e,t={}){var n=e.name;if(r||U(`type "${n}" must have a positive integer typeid pointer`),Y.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;U(`Cannot register type '${n}' twice`)}if(Y[r]=e,delete yr[r],er.hasOwnProperty(r)){var a=er[r];delete er[r],a.forEach(i=>i())}}function B(r,e,t={}){return St(r,e,t)}var K=8,At=(r,e,t,n)=>{e=O(e),B(r,{name:e,fromWireType:function(a){return!!a},toWireType:function(a,i){return i?t:n},argPackAdvance:K,readValueFromPointer:function(a){return this.fromWireType(C[a])},destructorFunction:null})},xr=[],H=[],Nr=r=>{r>9&&--H[r+1]===0&&(H[r]=void 0,xr.push(r))},Tt=()=>H.length/2-5-xr.length,Dt=()=>{H.push(0,1,void 0,1,null,1,!0,1,!1,1),d.count_emval_handles=Tt},T={toValue:r=>(r||U("Cannot use deleted val. handle = "+r),H[r]),toHandle:r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let e=xr.pop()||H.length;return H[e]=r,H[e+1]=1,e}}}};function $r(r){return this.fromWireType(k[r>>2])}var Pt={name:"emscripten::val",fromWireType:r=>{var e=T.toValue(r);return Nr(r),e},toWireType:(r,e)=>T.toHandle(e),argPackAdvance:K,readValueFromPointer:$r,destructorFunction:null},Ct=r=>B(r,Pt),Mt=(r,e)=>{switch(e){case 4:return function(t){return this.fromWireType(Qr[t>>2])};case 8:return function(t){return this.fromWireType(re[t>>3])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},Rt=(r,e,t)=>{e=O(e),B(r,{name:e,fromWireType:n=>n,toWireType:(n,a)=>a,argPackAdvance:K,readValueFromPointer:Mt(e,t),destructorFunction:null})},we=(r,e)=>Object.defineProperty(e,"name",{value:r}),ye=r=>{for(;r.length;){var e=r.pop(),t=r.pop();t(e)}};function jt(r){for(var e=1;e<r.length;++e)if(r[e]!==null&&r[e].destructorFunction===void 0)return!0;return!1}function Ot(r,e,t,n,a,i){if(i||e.length<2)throw new Error("Unsupported CAD binding");let s=e[1]!==null&&t!==null,l=jt(e);return we(r,function(...u){let f=l?[]:null,c=[],h=[a],p;function v(m,g){let S=m.toWireType(f,g);return!l&&m.destructorFunction&&c.push([m.destructorFunction,S]),S}try{s&&h.push(v(e[1],this));for(let m=2;m<e.length;m++)h.push(v(e[m],u[m-2]));p=n(...h)}finally{if(f)ye(f);else for(let[m,g]of c)m(g)}if(!e[0].isVoid)return e[0].fromWireType(p)})}var Ut=(r,e,t)=>{if(r[e].overloadTable===void 0){var n=r[e];r[e]=function(...a){return r[e].overloadTable.hasOwnProperty(a.length)||U(`Function '${t}' called with an invalid number of arguments (${a.length}) - expects one of (${r[e].overloadTable})!`),r[e].overloadTable[a.length].apply(this,a)},r[e].overloadTable=[],r[e].overloadTable[n.argCount]=n}},xt=(r,e,t)=>{d.hasOwnProperty(r)?((t===void 0||d[r].overloadTable!==void 0&&d[r].overloadTable[t]!==void 0)&&U(`Cannot register public name '${r}' twice`),Ut(d,r,r),d.hasOwnProperty(t)&&U(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),d[r].overloadTable[t]=e):(d[r]=e,t!==void 0&&(d[r].numArguments=t))},Nt=(r,e)=>{for(var t=[],n=0;n<r;n++)t.push(k[e+n*4>>2]);return t},$t=(r,e,t)=>{d.hasOwnProperty(r)||_e("Replacing nonexistent public symbol"),d[r].overloadTable!==void 0&&t!==void 0?d[r].overloadTable[t]=e:(d[r]=e,d[r].argCount=t)},It=(r,e,t)=>{r=r.replace(/p/g,"i");var n=d["dynCall_"+r];return n(e,...t)},gr=[],ge,Ee=r=>{var e=gr[r];return e||(r>=gr.length&&(gr.length=r+1),gr[r]=e=ge.get(r)),e},zt=(r,e,t=[])=>{if(r.includes("j"))return It(r,e,t);var n=Ee(e)(...t);return n},Lt=(r,e)=>(...t)=>zt(r,e,t),Bt=(r,e)=>{r=O(r);function t(){return r.includes("j")?Lt(r,e):Ee(e)}var n=t();return typeof n!="function"&&U(`unknown function pointer with signature ${r}: ${e}`),n},Ht=(r,e)=>{var t=we(e,function(n){this.name=e,this.message=n;var a=new Error(n).stack;a!==void 0&&(this.stack=this.toString()+`
3
+ `+a.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},ke,be=r=>{var e=Pe(r),t=O(e);return W(e),t},Wt=(r,e)=>{var t=[],n={};function a(i){if(!n[i]&&!Y[i]){if(yr[i]){yr[i].forEach(a);return}t.push(i),n[i]=!0}}throw e.forEach(a),new ke(`${r}: `+t.map(be).join([", "]))},Vt=r=>{r=r.trim();let e=r.indexOf("(");return e!==-1?r.substr(0,e):r},qt=(r,e,t,n,a,i,s,l)=>{var u=Nt(e,t);r=O(r),r=Vt(r),a=Bt(n,a),xt(r,function(){Wt(`Cannot call ${r} due to unbound types`,u)},e-1),Ft([],u,f=>{var c=[f[0],null].concat(f.slice(1));return $t(r,Ot(r,c,null,a,i,s),e-1),[]})},Xt=(r,e,t)=>{switch(e){case 1:return t?n=>M[n]:n=>C[n];case 2:return t?n=>V[n>>1]:n=>hr[n>>1];case 4:return t?n=>_[n>>2]:n=>k[n>>2];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},Gt=(r,e,t,n,a)=>{e=O(e),a===-1&&(a=4294967295);var i=c=>c;if(n===0){var s=32-8*t;i=c=>c<<s>>>s}var l=e.includes("unsigned"),u=(c,h)=>{},f;l?f=function(c,h){return u(h,this.name),h>>>0}:f=function(c,h){return u(h,this.name),h},B(r,{name:e,fromWireType:i,toWireType:f,argPackAdvance:K,readValueFromPointer:Xt(e,t,n!==0),destructorFunction:null})},Yt=(r,e,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],a=n[e];function i(s){var l=k[s>>2],u=k[s+4>>2];return new a(M.buffer,u,l)}t=O(t),B(r,{name:t,fromWireType:i,argPackAdvance:K,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},tr=(r,e,t)=>jr(r,C,e,t),Kt=(r,e)=>{e=O(e);var t=e==="std::string";B(r,{name:e,fromWireType(n){var a=k[n>>2],i=n+4,s;if(t)for(var l=i,u=0;u<=a;++u){var f=i+u;if(u==a||C[f]==0){var c=f-l,h=Ur(l,c);s===void 0?s=h:(s+="\0",s+=h),l=f+1}}else{for(var p=new Array(a),u=0;u<a;++u)p[u]=String.fromCharCode(C[i+u]);s=p.join("")}return W(n),s},toWireType(n,a){a instanceof ArrayBuffer&&(a=new Uint8Array(a));var i,s=typeof a=="string";s||a instanceof Uint8Array||a instanceof Uint8ClampedArray||a instanceof Int8Array||U("Cannot pass non-string to std::string"),t&&s?i=_r(a):i=a.length;var l=Wr(4+i+1),u=l+4;if(k[l>>2]=i,t&&s)tr(a,u,i+1);else if(s)for(var f=0;f<i;++f){var c=a.charCodeAt(f);c>255&&(W(u),U("String has UTF-16 code units that do not fit in 8 bits")),C[u+f]=c}else for(var f=0;f<i;++f)C[u+f]=a[f];return n!==null&&n.push(W,l),l},argPackAdvance:K,readValueFromPointer:$r,destructorFunction(n){W(n)}})},Fe=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,Zt=(r,e)=>{for(var t=r,n=t>>1,a=n+e/2;!(n>=a)&&hr[n];)++n;if(t=n<<1,t-r>32&&Fe)return Fe.decode(C.subarray(r,t));for(var i="",s=0;!(s>=e/2);++s){var l=V[r+s*2>>1];if(l==0)break;i+=String.fromCharCode(l)}return i},Jt=(r,e,t)=>{if(t??=2147483647,t<2)return 0;t-=2;for(var n=e,a=t<r.length*2?t/2:r.length,i=0;i<a;++i){var s=r.charCodeAt(i);V[e>>1]=s,e+=2}return V[e>>1]=0,e-n},Qt=r=>r.length*2,rn=(r,e)=>{for(var t=0,n="";!(t>=e/4);){var a=_[r+t*4>>2];if(a==0)break;if(++t,a>=65536){var i=a-65536;n+=String.fromCharCode(55296|i>>10,56320|i&1023)}else n+=String.fromCharCode(a)}return n},en=(r,e,t)=>{if(t??=2147483647,t<4)return 0;for(var n=e,a=n+t-4,i=0;i<r.length;++i){var s=r.charCodeAt(i);if(s>=55296&&s<=57343){var l=r.charCodeAt(++i);s=65536+((s&1023)<<10)|l&1023}if(_[e>>2]=s,e+=4,e+4>a)break}return _[e>>2]=0,e-n},tn=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n>=55296&&n<=57343&&++t,e+=4}return e},nn=(r,e,t)=>{t=O(t);var n,a,i,s;e===2?(n=Zt,a=Jt,s=Qt,i=l=>hr[l>>1]):e===4&&(n=rn,a=en,s=tn,i=l=>k[l>>2]),B(r,{name:t,fromWireType:l=>{for(var u=k[l>>2],f,c=l+4,h=0;h<=u;++h){var p=l+4+h*e;if(h==u||i(p)==0){var v=p-c,m=n(c,v);f===void 0?f=m:(f+="\0",f+=m),c=p+e}}return W(l),f},toWireType:(l,u)=>{typeof u!="string"&&U(`Cannot pass non-string to C++ string type ${t}`);var f=s(u),c=Wr(4+f+e);return k[c>>2]=f/e,a(u,c+4,f+e),l!==null&&l.push(W,c),c},argPackAdvance:K,readValueFromPointer:$r,destructorFunction(l){W(l)}})},on=(r,e)=>{e=O(e),B(r,{isVoid:!0,name:e,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}})},an=1,sn=()=>an,Se=r=>{for(var e=r.split("."),t=0;t<4;t++){var n=Number(e[t]);if(isNaN(n))return null;e[t]=n}return(e[0]|e[1]<<8|e[2]<<16|e[3]<<24)>>>0},Er=r=>parseInt(r),ln=r=>{var e,t,n,a,i=/^((?=.*::)(?!.*::.+::)(::)?([\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,s=[];if(!i.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"),":"),e=r.split(":"),e[e.length-4]=Er(e[e.length-4])+Er(e[e.length-3])*256,e[e.length-3]=Er(e[e.length-2])+Er(e[e.length-1])*256,e=e.slice(0,e.length-2)):e=r.split(":"),n=0,a=0,t=0;t<e.length;t++)if(typeof e[t]=="string")if(e[t]==="Z"){for(a=0;a<8-e.length+1;a++)s[t+a]=0;n=a-1}else s[t+n]=Ce(parseInt(e[t],16));else s[t+n]=e[t];return[s[1]<<16|s[0],s[3]<<16|s[2],s[5]<<16|s[4],s[7]<<16|s[6]]},X={address_map:{id:1,addrs:{},names:{}},lookup_name(r){var e=Se(r);if(e!==null||(e=ln(r),e!==null))return r;var t;if(X.address_map.addrs[r])t=X.address_map.addrs[r];else{var n=X.address_map.id++;ze(n<65535,"exceeded max address mappings of 65535"),t="172.29."+(n&255)+"."+(n&65280),X.address_map.names[t]=r,X.address_map.addrs[r]=t}return t},lookup_addr(r){return X.address_map.names[r]?X.address_map.names[r]:null}},un=r=>{var e=Ur(r);return Se(X.lookup_name(e))},fn=(r,e,t)=>C.copyWithin(r,e,e+t),Ir=(r,e)=>{var t=Y[r];return t===void 0&&U(`${e} has unknown type ${be(r)}`),t},Ae=(r,e,t)=>{var n=[],a=r.toWireType(n,t);return n.length&&(k[e>>2]=T.toHandle(n)),a},dn=(r,e,t)=>(r=T.toValue(r),e=Ir(e,"emval::as"),Ae(e,t,r)),cn={},zr=r=>{var e=cn[r];return e===void 0?O(r):e},Lr=[],vn=(r,e,t,n,a)=>(r=Lr[r],e=T.toValue(e),t=zr(t),r(e,e[t],n,a)),Te=()=>typeof globalThis=="object"?globalThis:(function(){return Function})()("return this")(),hn=r=>r===0?T.toHandle(Te()):(r=zr(r),T.toHandle(Te()[r])),mn=r=>{var e=Lr.length;return Lr.push(r),e},pn=(r,e)=>{for(var t=new Array(r),n=0;n<r;++n)t[n]=Ir(k[e+n*4>>2],"parameter "+n);return t},vo=Reflect.construct,_n=(r,e,t)=>{let n=pn(r,e),a=n.shift();if(t!==0&&t!==1)throw new Error("Unsupported CAD method binding");return mn(function(i,s,l,u){let f=[];for(let h of n)f.push(h.readValueFromPointer(u)),u+=h.argPackAdvance;let c=t===1?Reflect.construct(s,f):s.apply(i,f);if(!a.isVoid)return Ae(a,l,c)})},wn=(r,e)=>(r=T.toValue(r),e=T.toValue(e),T.toHandle(r[e])),yn=r=>{r>9&&(H[r+1]+=1)},gn=()=>T.toHandle([]),En=r=>T.toHandle(zr(r)),kn=()=>T.toHandle({}),bn=r=>{var e=T.toValue(r);ye(e),Nr(r)},Fn=(r,e,t)=>{r=T.toValue(r),e=T.toValue(e),t=T.toValue(t),r[e]=t},Sn=(r,e)=>{r=Ir(r,"_emval_take_value");var t=r.readValueFromPointer(e);return T.toHandle(t)},An=r=>r%4===0&&(r%100!==0||r%400===0),Tn=[0,31,60,91,121,152,182,213,244,274,305,335],Dn=[0,31,59,90,120,151,181,212,243,273,304,334],Pn=r=>{var e=An(r.getFullYear()),t=e?Tn:Dn,n=t[r.getMonth()]+r.getDate()-1;return n},Br=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+e*4294967296:NaN;function Cn(r,e,t){var n=Br(r,e),a=new Date(n*1e3);_[t>>2]=a.getSeconds(),_[t+4>>2]=a.getMinutes(),_[t+8>>2]=a.getHours(),_[t+12>>2]=a.getDate(),_[t+16>>2]=a.getMonth(),_[t+20>>2]=a.getFullYear()-1900,_[t+24>>2]=a.getDay();var i=Pn(a)|0;_[t+28>>2]=i,_[t+36>>2]=-(a.getTimezoneOffset()*60);var s=new Date(a.getFullYear(),0,1),l=new Date(a.getFullYear(),6,1).getTimezoneOffset(),u=s.getTimezoneOffset(),f=(l!=u&&a.getTimezoneOffset()==Math.min(u,l))|0;_[t+32>>2]=f}function Mn(r,e,t,n,a,i,s){var l=Br(i,s);try{var u=E.getStreamFromFD(a);t&2&&E.doMsync(r,u,e,n,l)}catch(f){if(typeof o>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}var Rn=(r,e,t,n)=>{var a=new Date().getFullYear(),i=new Date(a,0,1),s=new Date(a,6,1),l=i.getTimezoneOffset(),u=s.getTimezoneOffset(),f=Math.max(l,u);k[r>>2]=f*60,_[e>>2]=+(l!=u);var c=v=>{var m=v>=0?"-":"+",g=Math.abs(v),S=String(Math.floor(g/60)).padStart(2,"0"),F=String(g%60).padStart(2,"0");return`UTC${m}${S}${F}`},h=c(l),p=c(u);u<l?(tr(h,t,17),tr(p,n,17)):(tr(h,n,17),tr(p,t,17))},jn=()=>Date.now();function On(){return new Error().stack.toString()}var kr=r=>{kr.shown||={},kr.shown[r]||(kr.shown[r]=1,J&&(r="warning: "+r),z(r))};function Un(r){var e=On(),t=e.lastIndexOf("_emscripten_log"),n=e.lastIndexOf("_emscripten_get_callstack"),a=e.indexOf(`
4
+ `,Math.max(t,n))+1;e=e.slice(a),r&8&&typeof emscripten_source_map>"u"&&(kr('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.'),r^=8,r|=16);var i=e.split(`
5
+ `);e="";var s=new RegExp("\\s*(.*?)@(.*?):([0-9]+):([0-9]+)"),l=new RegExp("\\s*(.*?)@(.*):(.*)(:(.*))?"),u=new RegExp("\\s*at (.*?) \\((.*):(.*):(.*)\\)");for(var f in i){var c=i[f],h="",p="",v=0,m=0,g=u.exec(c);if(g&&g.length==5)h=g[1],p=g[2],v=g[3],m=g[4];else if(g=s.exec(c)||l.exec(c),g&&g.length>=4)h=g[1],p=g[2],v=g[3],m=g[4]|0;else{e+=c+`
6
+ `;continue}var S=!1;if(r&8){var F=emscripten_source_map.originalPositionFor({line:v,column:m});S=F?.source,S&&(r&64&&(F.source=F.source.substring(F.source.replace(/\\/g,"/").lastIndexOf("/")+1)),e+=` at ${h} (${F.source}:${F.line}:${F.column})
7
+ `)}(r&16||!S)&&(r&64&&(p=p.substring(p.replace(/\\/g,"/").lastIndexOf("/")+1)),e+=(S?` = ${h}`:` at ${h}`)+` (${p}:${v}:${m})
8
+ `)}return e=e.replace(/\s+$/,""),e}function xn(r,e,t){var n=Un(r);if(!e||t<=0)return _r(n)+1;var a=tr(n,e,t);return a+1}var De=()=>Math.min(2147483648,d.viewstlMaxHeapBytes||2147483648),Nn=()=>De(),$n=r=>{var e=vr.buffer,t=(r-e.byteLength+65535)/65536|0;try{return vr.grow(t),ee(),1}catch{}},In=r=>{var e=C.length;r>>>=0;var t=De();if(r>t)return!1;for(var n=1;n<=4;n*=2){var a=e*(1+.2/n);a=Math.min(a,r+100663296);var i=Math.min(t,ce(Math.max(r,a),65536)),s=$n(i);if(s)return!0}return!1},Hr={},zn=()=>Fr||"./this.program",sr=()=>{if(!sr.strings){var r=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:r,_:zn()};for(var t in Hr)Hr[t]===void 0?delete e[t]:e[t]=Hr[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);sr.strings=n}return sr.strings},Ln=(r,e)=>{for(var t=0;t<r.length;++t)M[e++]=r.charCodeAt(t);M[e]=0},Bn=(r,e)=>{var t=0;return sr().forEach((n,a)=>{var i=e+t;k[r+a*4>>2]=i,Ln(n,i),t+=n.length+1}),0},Hn=(r,e)=>{var t=sr();k[r>>2]=t.length;var n=0;return t.forEach(a=>n+=a.length+1),k[e>>2]=n,0},Wn=0,Vn=()=>rt||Wn>0,qn=r=>{Jr=r,Vn()||(d.onExit?.(r),Tr=!0),Kr(r,new Qe(r))},Xn=(r,e)=>{Jr=r,qn(r)},Gn=Xn;function Yn(r){try{var e=E.getStreamFromFD(r);return o.close(e),0}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var Kn=(r,e,t,n)=>{for(var a=0,i=0;i<t;i++){var s=k[e>>2],l=k[e+4>>2];e+=8;var u=o.read(r,M,s,l,n);if(u<0)return-1;if(a+=u,u<l)break;typeof n<"u"&&(n+=u)}return a};function Zn(r,e,t,n){try{var a=E.getStreamFromFD(r),i=Kn(a,e,t);return k[n>>2]=i,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function Jn(r,e,t,n,a){var i=Br(e,t);try{if(isNaN(i))return 61;var s=E.getStreamFromFD(r);return o.llseek(s,i,n),A=[s.position>>>0,(y=s.position,+Math.abs(y)>=1?y>0?+Math.floor(y/4294967296)>>>0:~~+Math.ceil((y-+(~~y>>>0))/4294967296)>>>0:0)],_[a>>2]=A[0],_[a+4>>2]=A[1],s.getdents&&i===0&&n===0&&(s.getdents=null),0}catch(l){if(typeof o>"u"||l.name!=="ErrnoError")throw l;return l.errno}}var Qn=(r,e,t,n)=>{for(var a=0,i=0;i<t;i++){var s=k[e>>2],l=k[e+4>>2];e+=8;var u=o.write(r,M,s,l,n);if(u<0)return-1;if(a+=u,u<l)break;typeof n<"u"&&(n+=u)}return a};function ro(r,e,t,n){try{var a=E.getStreamFromFD(r),i=Qn(a,e,t);return k[n>>2]=i,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}}o.createPreloadedFile=lt,o.staticInit(),bt(),me=d.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},pe=d.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},Dt(),ke=d.UnboundTypeError=Ht(Error,"UnboundTypeError");var eo={M:ft,N:dt,h:ct,I:vt,Q:ht,F:mt,G:pt,j:_t,B:wt,H:yt,C:gt,A:Et,w:kt,V:At,U:Ct,n:Rt,f:qt,b:Gt,a:Yt,m:Kt,i:nn,W:on,J:sn,x:un,L:fn,e:dn,q:vn,T:Nr,u:hn,p:_n,k:wn,Y:yn,X:gn,r:En,Z:kn,o:bn,c:Fn,d:Sn,t:Cn,s:Mn,O:Rn,K:jn,R:xn,z:Nn,y:In,D:Bn,E:Hn,S:Gn,g:Yn,P:Zn,v:Jn,l:ro},D=Je(),to=()=>(to=D.$)(),Pe=r=>(Pe=D.aa)(r),Wr=r=>(Wr=D.ca)(r),W=r=>(W=D.da)(r),Ce=r=>(Ce=D.ea)(r),Me=(r,e)=>(Me=D.fa)(r,e),Re=()=>(Re=D.ga)(),no=d.dynCall_viijii=(r,e,t,n,a,i,s)=>(no=d.dynCall_viijii=D.ha)(r,e,t,n,a,i,s),oo=d.dynCall_viiiiji=(r,e,t,n,a,i,s,l)=>(oo=d.dynCall_viiiiji=D.ia)(r,e,t,n,a,i,s,l),ao=d.dynCall_jiji=(r,e,t,n,a)=>(ao=d.dynCall_jiji=D.ja)(r,e,t,n,a),io=d.dynCall_iiiiij=(r,e,t,n,a,i,s)=>(io=d.dynCall_iiiiij=D.ka)(r,e,t,n,a,i,s),so=d.dynCall_iiiiijj=(r,e,t,n,a,i,s,l,u)=>(so=d.dynCall_iiiiijj=D.la)(r,e,t,n,a,i,s,l,u),lo=d.dynCall_iiiiiijj=(r,e,t,n,a,i,s,l,u,f)=>(lo=d.dynCall_iiiiiijj=D.ma)(r,e,t,n,a,i,s,l,u,f),br,je;ar=function r(){br||Oe(),br||(ar=r)};function Oe(){if(G>0||!je&&(je=1,Le(),G>0))return;function r(){br||(br=1,d.calledRun=1,!Tr&&(Be(),Xr(d),d.onRuntimeInitialized?.(),He()))}d.setStatus?(d.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>d.setStatus(""),1),r()},1)):r()}if(d.preInit)for(typeof d.preInit=="function"&&(d.preInit=[d.preInit]);d.preInit.length>0;)d.preInit.pop()();return Oe(),Z=Ne,Z})})();typeof xe=="object"&&typeof qr=="object"?qr.exports=Ue:typeof define=="function"&&define.amd&&define([],()=>Ue)});export default fo();
@@ -0,0 +1,57 @@
1
+
2
+ var occtimportjs = (() => {
3
+ var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
4
+ if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename;
5
+ return (
6
+ function(moduleArg = {}) {
7
+ var moduleRtn;
8
+
9
+ var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;var readyPromise=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(ENVIRONMENT_IS_NODE){}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);var ret=fs.readFileSync(filename);return ret};readAsync=(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return new Promise((resolve,reject)=>{fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)reject(err);else resolve(binary?data.buffer:data)})})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptName){scriptDirectory=_scriptName}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}return fetch(url,{credentials:"same-origin"}).then(response=>{if(response.ok){return response.arrayBuffer()}return Promise.reject(new Error(response.status+" : "+response.url))})}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];var wasmBinary=Module["wasmBinary"];var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){var preRuns=Module["preRun"];if(preRuns){if(typeof preRuns=="function")preRuns=[preRuns];preRuns.forEach(addOnPreRun)}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function postRun(){var postRuns=Module["postRun"];if(postRuns){if(typeof postRuns=="function")postRuns=[postRuns];postRuns.forEach(addOnPostRun)}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";if(runtimeInitialized){___trap()}var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");function findWasmBinary(){var f="occt-import-js.wasm";if(!isDataURI(f)){return locateFile(f)}return f}var wasmBinaryFile;function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(binaryFile){if(!wasmBinary){return readAsync(binaryFile).then(response=>new Uint8Array(response),()=>getBinarySync(binaryFile))}return Promise.resolve().then(()=>getBinarySync(binaryFile))}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(binary=>WebAssembly.instantiate(binary,imports)).then(receiver,reason=>{err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}return instantiateArrayBuffer(binaryFile,imports,callback)}function getWasmImports(){return{a:wasmImports}}function createWasm(){var info=getWasmImports();function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["_"];updateMemoryViews();wasmTable=wasmExports["ba"];addOnInit(wasmExports["$"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);readyPromiseReject(e)}}wasmBinaryFile??=findWasmBinary();instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult).catch(readyPromiseReject);return{}}var tempDouble;var tempI64;function ExitStatus(status){this.name="ExitStatus";this.message=`Program terminated with exit(${status})`;this.status=status}var callRuntimeCallbacks=callbacks=>{callbacks.forEach(f=>f(Module))};var noExitRuntime=Module["noExitRuntime"]||true;var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:(...paths)=>PATH.normalize(paths.join("/")),join2:(l,r)=>PATH.normalize(l+"/"+r)};var initRandomFill=()=>{if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){return view=>crypto.getRandomValues(view)}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");var randomFillSync=crypto_module["randomFillSync"];if(randomFillSync){return view=>crypto_module["randomFillSync"](view)}var randomBytes=crypto_module["randomBytes"];return view=>(view.set(randomBytes(view.byteLength)),view)}catch(e){}}abort("initRandomDevice")};var randomFill=view=>(randomFill=initRandomFill())(view);var PATH_FS={resolve:(...args)=>{var resolvedPath="",resolvedAbsolute=false;for(var i=args.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?args[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")}};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder:undefined;var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead=NaN)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var FS_stdin_getChar_buffer=[];var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf,0,BUFSIZE)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else{}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.timestamp=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60)}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i])}}catch(e){throw new FS.ErrnoError(29)}if(length){stream.node.timestamp=Date.now()}return i}},default_tty_ops:{get_char(tty){return FS_stdin_getChar()},put_char(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output));tty.output=[]}},ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output));tty.output=[]}}}};var zeroMemory=(address,size)=>{HEAPU8.fill(0,address,address+size)};var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var mmapAlloc=size=>{size=alignMemory(size,65536);var ptr=_emscripten_builtin_memalign(65536,size);if(ptr)zeroMemory(ptr,size);return ptr};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}MEMFS.ops_table||={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}};var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){throw FS.genericErrors[44]},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp},unlink(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir(node){var entries=[".",".."];for(var key of Object.keys(node.contents)){entries.push(key)}return entries},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i<size;i++)buffer[offset+i]=contents[position+i]}return size},write(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===HEAP8.buffer){canOwn=false}if(!length)return 0;var node=stream.node;node.timestamp=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length}}MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position)}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i]}}node.usedBytes=Math.max(node.usedBytes,position+length);return length},llseek(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes}}if(position<0){throw new FS.ErrnoError(28)}return position},allocate(stream,offset,length){MEMFS.expandFileStorage(stream.node,offset+length);stream.node.usedBytes=Math.max(stream.node.usedBytes,offset+length)},mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset}else{allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}if(contents){if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length)}else{contents=Array.prototype.slice.call(contents,position,position+length)}}HEAP8.set(contents,ptr)}}return{ptr,allocated}},msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};var asyncLoad=(url,onload,onerror,noRunDep)=>{var dep=!noRunDep?getUniqueRunDependency(`al ${url}`):"";readAsync(url).then(arrayBuffer=>{onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},err=>{if(onerror){onerror()}else{throw`Loading data file "${url}" failed.`}});if(dep)addRunDependency(dep)};var FS_createDataFile=(parent,name,fileData,canRead,canWrite,canOwn)=>{FS.createDataFile(parent,name,fileData,canRead,canWrite,canOwn)};var preloadPlugins=Module["preloadPlugins"]||[];var FS_handledByPreloadPlugin=(byteArray,fullname,finish,onerror)=>{if(typeof Browser!="undefined")Browser.init();var handled=false;preloadPlugins.forEach(plugin=>{if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true}});return handled};var FS_createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);function processData(byteArray){function finish(byteArray){preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}onload?.();removeRunDependency(dep)}if(FS_handledByPreloadPlugin(byteArray,fullname,finish,()=>{onerror?.();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,processData,onerror)}else{processData(url)}};var FS_modeStringToFlags=str=>{var flagModes={r:0,"r+":2,w:512|64|1,"w+":512|64|2,a:1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error(`Unknown file open mode: ${str}`)}return flags};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:class{constructor(errno){this.name="ErrnoError";this.errno=errno}},genericErrors:{},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(val){this.node=val}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(val){this.shared.flags=val}get position(){return this.shared.position}set position(val){this.shared.position=val}},FSNode:class{constructor(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev;this.readMode=292|73;this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(val){val?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return FS.isDir(this.mode)}get isDevice(){return FS.isChrdev(this.mode)}},lookupPath(path,opts={}){path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break}current=FS.lookupNode(current,parts[i]);current_path=PATH.join2(current_path,parts[i]);if(FS.isMountpoint(current)){if(!islast||islast&&opts.follow_mount){current=current.mounted.root}}if(!islast||opts.follow){var count=0;while(FS.isLink(current.mode)){var link=FS.readlink(current_path);current_path=PATH_FS.resolve(PATH.dirname(current_path),link);var lookup=FS.lookupPath(current_path,{recurse_count:opts.recurse_count+1});current=lookup.node;if(count++>40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?`${mount}/${path}`:mount+path}path=path?`${node.name}/${path}`:node.name;node=node.parent}},hashName(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0}return(parentid+hash>>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return(mode&61440)===32768},isDir(mode){return(mode&61440)===16384},isLink(mode){return(mode&61440)===40960},isChrdev(mode){return(mode&61440)===8192},isBlkdev(mode){return(mode&61440)===24576},isFIFO(mode){return(mode&61440)===4096},isSocket(mode){return(mode&49152)===49152},flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions(node,perms){if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup(dir){if(!FS.isDir(dir.mode))return 54;var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate(dir,name){try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen(node,flags){if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}return stream},getStream:fd=>FS.streams[fd],createStream(stream,fd=-1){stream=Object.assign(new FS.FSStream,stream);if(fd==-1){fd=FS.nextfd()}stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream(fd){FS.streams[fd]=null},dupStream(origStream,fd=-1){var stream=FS.createStream(origStream,fd);stream.stream_ops?.dup?.(stream);return stream},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push(...m.mounts)}return mounts},syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type,opts,mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var i=0;i<dirs.length;++i){if(!dirs[i])continue;d+="/"+dirs[i];try{FS.mkdir(d,mode)}catch(e){if(e.errno!=20)throw e}}},mkdev(path,mode,dev){if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat(path){return FS.stat(path,true)},chmod(path,mode,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod(path,mode){FS.chmod(path,mode,true)},fchmod(fd,mode){var stream=FS.getStreamChecked(fd);FS.chmod(stream.node,mode)},chown(path,uid,gid,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown(path,uid,gid){FS.chown(path,uid,gid,true)},fchown(fd,uid,gid){var stream=FS.getStreamChecked(fd);FS.chown(stream.node,uid,gid)},truncate(path,len){if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate(fd,len){var stream=FS.getStreamChecked(fd);if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime(path,atime,mtime){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open(path,flags,mode){if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS_modeStringToFlags(flags):flags;if(flags&64){mode=typeof mode=="undefined"?438:mode;mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node,path:FS.getPath(node),flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed(stream){return stream.fd===null},llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read(stream,buffer,offset,length,position){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write(stream,buffer,offset,length,position,canOwn){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate(stream,offset,length){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}if(!length){throw new FS.ErrnoError(28)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync(stream,buffer,offset,length,mmapFlags){if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile(path,opts={}){opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error(`Invalid encoding type "${opts.encoding}"`)}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile(path,data,opts={}){opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomLeft=randomFill(randomBuffer).byteLength}return randomBuffer[--randomLeft]};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input)}else{FS.symlink("/dev/tty","/dev/stdin")}if(output){FS.createDevice("/dev","stdout",null,output)}else{FS.symlink("/dev/tty","/dev/stdout")}if(error){FS.createDevice("/dev","stderr",null,error)}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},staticInit(){[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack="<generic error, no stack>"});FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS}},init(input,output,error){FS.initialized=true;input??=Module["stdin"];output??=Module["stdout"];error??=Module["stderr"];FS.createStandardStreams(input,output,error)},quit(){FS.initialized=false;for(var i=0;i<FS.streams.length;i++){var stream=FS.streams[i];if(!stream){continue}FS.close(stream)}},findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath(parent,path,canRead,canWrite){parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS_getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i<len;++i)arr[i]=data.charCodeAt(i);data=arr}FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode)}},createDevice(parent,name,input,output){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(!!input,!!output);FS.createDevice.major??=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open(stream){stream.seekable=false},close(stream){if(output?.buffer?.length){output(10)}},read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input()}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.timestamp=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}}if(length){stream.node.timestamp=Date.now()}return i}});return FS.mkdev(path,mode,dev)},forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){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.")}else{try{obj.contents=readBinary(obj.url);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}},createLazyFile(parent,name,url,canRead,canWrite){class LazyUint8Array{constructor(){this.lengthKnown=false;this.chunks=[]}get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]}setDataGetter(getter){this.getter=getter}cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true}get length(){if(!this.lengthKnown){this.cacheLength()}return this._length}get chunkSize(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=(...args)=>{FS.forceLoadFile(node);return fn(...args)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size}stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr,allocated:true}};node.stream_ops=stream_ops;return node}};var UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat(func,path,buf){var stat=func(path);HEAP32[buf>>2]=stat.dev;HEAP32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAP32[buf+12>>2]=stat.uid;HEAP32[buf+16>>2]=stat.gid;HEAP32[buf+20>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+24>>2]=tempI64[0],HEAP32[buf+28>>2]=tempI64[1];HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();tempI64=[Math.floor(atime/1e3)>>>0,(tempDouble=Math.floor(atime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;tempI64=[Math.floor(mtime/1e3)>>>0,(tempDouble=Math.floor(mtime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;tempI64=[Math.floor(ctime/1e3)>>>0,(tempDouble=Math.floor(ctime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];return 0},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream},varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret}};function ___syscall_chmod(path,mode){try{path=SYSCALLS.getStr(path);FS.chmod(path,mode);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_faccessat(dirfd,path,amode,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(amode&~7){return-28}var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node){return-44}var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-2}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function syscallGetVarargI(){var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret}var syscallGetVarargP=syscallGetVarargI;function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28}while(FS.streams[arg]){arg++}var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();stream.flags|=arg;return 0}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0}return-28}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();HEAP32[argp>>2]=termios.c_iflag||0;HEAP32[argp+4>>2]=termios.c_oflag||0;HEAP32[argp+8>>2]=termios.c_cflag||0;HEAP32[argp+12>>2]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17]=termios.c_cc[i]||0}return 0}return 0}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();var c_iflag=HEAP32[argp>>2];var c_oflag=HEAP32[argp+4>>2];var c_cflag=HEAP32[argp+8>>2];var c_lflag=HEAP32[argp+12>>2];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17])}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag,c_oflag,c_cflag,c_lflag,c_cc})}return 0}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1]}return 0}case 21524:{if(!stream.tty)return-59;return 0}case 21515:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_rmdir(path){try{path=SYSCALLS.getStr(path);FS.rmdir(path);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_unlinkat(dirfd,path,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(flags===0){FS.unlink(path)}else if(flags===512){FS.rmdir(path)}else{abort("Invalid flags passed to unlinkat")}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var __abort_js=()=>{abort("")};var __embind_register_bigint=(primitiveType,name,size,minRange,maxRange)=>{};var embind_init_charCodes=()=>{var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes};var embind_charCodes;var readLatin1String=ptr=>{var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret};var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var BindingError;var throwBindingError=message=>{throw new BindingError(message)};var InternalError;var throwInternalError=message=>{throw new InternalError(message)};var whenDependentTypesAreResolved=(myTypes,dependentTypes,getTypeConverters)=>{myTypes.forEach(type=>typeDependencies[type]=dependentTypes);function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i])}}var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;dependentTypes.forEach((dt,i)=>{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}};function sharedRegisterType(rawType,registeredInstance,options={}){var name=registeredInstance.name;if(!rawType){throwBindingError(`type "${name}" must have a positive integer typeid pointer`)}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError(`Cannot register type '${name}' twice`)}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function registerType(rawType,registeredInstance,options={}){return sharedRegisterType(rawType,registeredInstance,options)}var GenericWireTypeSize=8;var __embind_register_bool=(rawType,name,trueValue,falseValue)=>{name=readLatin1String(name);registerType(rawType,{name,fromWireType:function(wt){return!!wt},toWireType:function(destructors,o){return o?trueValue:falseValue},argPackAdvance:GenericWireTypeSize,readValueFromPointer:function(pointer){return this["fromWireType"](HEAPU8[pointer])},destructorFunction:null})};var emval_freelist=[];var emval_handles=[];var __emval_decref=handle=>{if(handle>9&&0===--emval_handles[handle+1]){emval_handles[handle]=undefined;emval_freelist.push(handle)}};var count_emval_handles=()=>emval_handles.length/2-5-emval_freelist.length;var init_emval=()=>{emval_handles.push(0,1,undefined,1,null,1,true,1,false,1);Module["count_emval_handles"]=count_emval_handles};var Emval={toValue:handle=>{if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle)}return emval_handles[handle]},toHandle:value=>{switch(value){case undefined:return 2;case null:return 4;case true:return 6;case false:return 8;default:{const handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle}}}};function readPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}var EmValType={name:"emscripten::val",fromWireType:handle=>{var rv=Emval.toValue(handle);__emval_decref(handle);return rv},toWireType:(destructors,value)=>Emval.toHandle(value),argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:null};var __embind_register_emval=rawType=>registerType(rawType,EmValType);var floatReadValueFromPointer=(name,width)=>{switch(width){case 4:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 8:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError(`invalid float width (${width}): ${name}`)}};var __embind_register_float=(rawType,name,size)=>{name=readLatin1String(name);registerType(rawType,{name,fromWireType:value=>value,toWireType:(destructors,value)=>value,argPackAdvance:GenericWireTypeSize,readValueFromPointer:floatReadValueFromPointer(name,size),destructorFunction:null})};var createNamedFunction=(name,body)=>Object.defineProperty(body,"name",{value:name});var runDestructors=destructors=>{while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}};function usesDestructorStack(argTypes){for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===undefined){return true}}return false}
10
+ function craftInvokerFunction(humanName, argTypes, classType, invoker, target, isAsync) {
11
+ if (isAsync || argTypes.length < 2) throw new Error('Unsupported CAD binding');
12
+ const isMethod = argTypes[1] !== null && classType !== null;
13
+ const usesStack = usesDestructorStack(argTypes);
14
+ return createNamedFunction(humanName, function (...args) {
15
+ const stack = usesStack ? [] : null, cleanup = [], wired = [target];
16
+ let result;
17
+ function convert(type, value) {
18
+ const converted = type.toWireType(stack, value);
19
+ if (!usesStack && type.destructorFunction) cleanup.push([type.destructorFunction, converted]);
20
+ return converted;
21
+ }
22
+ try {
23
+ if (isMethod) wired.push(convert(argTypes[1], this));
24
+ for (let i = 2; i < argTypes.length; i++) wired.push(convert(argTypes[i], args[i - 2]));
25
+ result = invoker(...wired);
26
+ } finally {
27
+ if (stack) runDestructors(stack);
28
+ else for (const [destroy, value] of cleanup) destroy(value);
29
+ }
30
+ if (!argTypes[0].isVoid) return argTypes[0].fromWireType(result);
31
+ });
32
+ }
33
+ var ensureOverloadTable=(proto,methodName,humanName)=>{if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(...args){if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${args.length}) - expects one of (${proto[methodName].overloadTable})!`)}return proto[methodName].overloadTable[args.length].apply(this,args)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}};var exposePublicSymbol=(name,value,numArguments)=>{if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError(`Cannot register public name '${name}' twice`)}ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments)){throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`)}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;if(undefined!==numArguments){Module[name].numArguments=numArguments}}};var heap32VectorToArray=(count,firstElement)=>{var array=[];for(var i=0;i<count;i++){array.push(HEAPU32[firstElement+i*4>>2])}return array};var replacePublicSymbol=(name,value,numArguments)=>{if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistent public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var dynCallLegacy=(sig,ptr,args)=>{sig=sig.replace(/p/g,"i");var f=Module["dynCall_"+sig];return f(ptr,...args)};var wasmTableMirror=[];var wasmTable;var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var dynCall=(sig,ptr,args=[])=>{if(sig.includes("j")){return dynCallLegacy(sig,ptr,args)}var rtn=getWasmTableEntry(ptr)(...args);return rtn};var getDynCaller=(sig,ptr)=>(...args)=>dynCall(sig,ptr,args);var embind__requireFunction=(signature,rawFunction)=>{signature=readLatin1String(signature);function makeDynCaller(){if(signature.includes("j")){return getDynCaller(signature,rawFunction)}return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`)}return fp};var extendError=(baseErrorType,errorName)=>{var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return`${this.name}: ${this.message}`}};return errorClass};var UnboundTypeError;var getTypeName=type=>{var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv};var throwUnboundTypeError=(message,types)=>{var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(`${message}: `+unboundTypes.map(getTypeName).join([", "]))};var getFunctionName=signature=>{signature=signature.trim();const argsIndex=signature.indexOf("(");if(argsIndex!==-1){return signature.substr(0,argsIndex)}else{return signature}};var __embind_register_function=(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync,isNonnullReturn)=>{var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);name=getFunctionName(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError(`Cannot call ${name} due to unbound types`,argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,argTypes=>{var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[]})};var integerReadValueFromPointer=(name,width,signed)=>{switch(width){case 1:return signed?pointer=>HEAP8[pointer]:pointer=>HEAPU8[pointer];case 2:return signed?pointer=>HEAP16[pointer>>1]:pointer=>HEAPU16[pointer>>1];case 4:return signed?pointer=>HEAP32[pointer>>2]:pointer=>HEAPU32[pointer>>2];default:throw new TypeError(`invalid integer width (${width}): ${name}`)}};var __embind_register_integer=(primitiveType,name,size,minRange,maxRange)=>{name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var fromWireType=value=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=value=>value<<bitshift>>>bitshift}var isUnsignedType=name.includes("unsigned");var checkAssertions=(value,toTypeName)=>{};var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value}}registerType(primitiveType,{name,fromWireType,toWireType,argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null})};var __embind_register_memory_view=(rawType,dataTypeIndex,name)=>{var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name,fromWireType:decodeMemoryView,argPackAdvance:GenericWireTypeSize,readValueFromPointer:decodeMemoryView},{ignoreDuplicateRegistrations:true})};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var __embind_register_std_string=(rawType,name)=>{name=readLatin1String(name);var stdStringIsUTF8=name==="std::string";registerType(rawType,{name,fromWireType(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;i<length;++i){a[i]=String.fromCharCode(HEAPU8[payload+i])}str=a.join("")}_free(value);return str},toWireType(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value)}var length;var valueIsOfTypeString=typeof value=="string";if(!(valueIsOfTypeString||value instanceof Uint8Array||value instanceof Uint8ClampedArray||value instanceof Int8Array)){throwBindingError("Cannot pass non-string to std::string")}if(stdStringIsUTF8&&valueIsOfTypeString){length=lengthBytesUTF8(value)}else{length=value.length}var base=_malloc(4+length+1);var ptr=base+4;HEAPU32[base>>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr,length+1)}else{if(valueIsOfTypeString){for(var i=0;i<length;++i){var charCode=value.charCodeAt(i);if(charCode>255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+i]=charCode}}else{for(var i=0;i<length;++i){HEAPU8[ptr+i]=value[i]}}}if(destructors!==null){destructors.push(_free,base)}return base},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):undefined;var UTF16ToString=(ptr,maxBytesToRead)=>{var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str};var stringToUTF16=(str,outPtr,maxBytesToWrite)=>{maxBytesToWrite??=2147483647;if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite<str.length*2?maxBytesToWrite/2:str.length;for(var i=0;i<numCharsToWrite;++i){var codeUnit=str.charCodeAt(i);HEAP16[outPtr>>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr};var lengthBytesUTF16=str=>str.length*2;var UTF32ToString=(ptr,maxBytesToRead)=>{var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str};var stringToUTF32=(str,outPtr,maxBytesToWrite)=>{maxBytesToWrite??=2147483647;if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr};var lengthBytesUTF32=str=>{var len=0;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343)++i;len+=4}return len};var __embind_register_std_wstring=(rawType,charSize,name)=>{name=readLatin1String(name);var decodeString,encodeString,readCharAt,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;readCharAt=pointer=>HEAPU16[pointer>>1]}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;readCharAt=pointer=>HEAPU32[pointer>>2]}registerType(rawType,{name,fromWireType:value=>{var length=HEAPU32[value>>2];var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||readCharAt(currentBytePtr)==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},toWireType:(destructors,value)=>{if(!(typeof value=="string")){throwBindingError(`Cannot pass non-string to C++ string type ${name}`)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var __embind_register_void=(rawType,name)=>{name=readLatin1String(name);registerType(rawType,{isVoid:true,name,argPackAdvance:0,fromWireType:()=>undefined,toWireType:(destructors,o)=>undefined})};var nowIsMonotonic=1;var __emscripten_get_now_is_monotonic=()=>nowIsMonotonic;var inetPton4=str=>{var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0};var jstoi_q=str=>parseInt(str);var inetPton6=str=>{var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\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;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w<words.length;w++){if(typeof words[w]=="string"){if(words[w]==="Z"){for(z=0;z<8-words.length+1;z++){parts[w+z]=0}offset=z-1}else{parts[w+offset]=_htons(parseInt(words[w],16))}}else{parts[w+offset]=words[w]}}return[parts[1]<<16|parts[0],parts[3]<<16|parts[2],parts[5]<<16|parts[4],parts[7]<<16|parts[6]]};var DNS={address_map:{id:1,addrs:{},names:{}},lookup_name(name){var res=inetPton4(name);if(res!==null){return name}res=inetPton6(name);if(res!==null){return name}var addr;if(DNS.address_map.addrs[name]){addr=DNS.address_map.addrs[name]}else{var id=DNS.address_map.id++;assert(id<65535,"exceeded max address mappings of 65535");addr="172.29."+(id&255)+"."+(id&65280);DNS.address_map.names[addr]=name;DNS.address_map.addrs[name]=addr}return addr},lookup_addr(addr){if(DNS.address_map.names[addr]){return DNS.address_map.names[addr]}return null}};var __emscripten_lookup_name=name=>{var nameString=UTF8ToString(name);return inetPton4(DNS.lookup_name(nameString))};var __emscripten_memcpy_js=(dest,src,num)=>HEAPU8.copyWithin(dest,src,src+num);var requireRegisteredType=(rawType,humanName)=>{var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(`${humanName} has unknown type ${getTypeName(rawType)}`)}return impl};var emval_returnValue=(returnType,destructorsRef,handle)=>{var destructors=[];var result=returnType["toWireType"](destructors,handle);if(destructors.length){HEAPU32[destructorsRef>>2]=Emval.toHandle(destructors)}return result};var __emval_as=(handle,returnType,destructorsRef)=>{handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");return emval_returnValue(returnType,destructorsRef,handle)};var emval_symbols={};var getStringOrSymbol=address=>{var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}return symbol};var emval_methodCallers=[];var __emval_call_method=(caller,objHandle,methodName,destructorsRef,args)=>{caller=emval_methodCallers[caller];objHandle=Emval.toValue(objHandle);methodName=getStringOrSymbol(methodName);return caller(objHandle,objHandle[methodName],destructorsRef,args)};var emval_get_global=()=>{if(typeof globalThis=="object"){return globalThis}return function(){return Function}()("return this")()};var __emval_get_global=name=>{if(name===0){return Emval.toHandle(emval_get_global())}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name])}};var emval_addMethodCaller=caller=>{var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id};var emval_lookupTypes=(argCount,argTypes)=>{var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAPU32[argTypes+i*4>>2],"parameter "+i)}return a};var reflectConstruct=Reflect.construct;
34
+ var __emval_get_method_caller = (argCount, argTypes, kind) => {
35
+ const types = emval_lookupTypes(argCount, argTypes), retType = types.shift();
36
+ if (kind !== 0 && kind !== 1) throw new Error('Unsupported CAD method binding');
37
+ return emval_addMethodCaller(function (obj, func, destructorsRef, pointer) {
38
+ const args = [];
39
+ for (const type of types) {
40
+ args.push(type.readValueFromPointer(pointer));
41
+ pointer += type.argPackAdvance;
42
+ }
43
+ const result = kind === 1 ? Reflect.construct(func, args) : func.apply(obj, args);
44
+ if (!retType.isVoid) return emval_returnValue(retType, destructorsRef, result);
45
+ });
46
+ };
47
+ var __emval_get_property=(handle,key)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);return Emval.toHandle(handle[key])};var __emval_incref=handle=>{if(handle>9){emval_handles[handle+1]+=1}};var __emval_new_array=()=>Emval.toHandle([]);var __emval_new_cstring=v=>Emval.toHandle(getStringOrSymbol(v));var __emval_new_object=()=>Emval.toHandle({});var __emval_run_destructors=handle=>{var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)};var __emval_set_property=(handle,key,value)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);value=Emval.toValue(value);handle[key]=value};var __emval_take_value=(type,arg)=>{type=requireRegisteredType(type,"_emval_take_value");var v=type["readValueFromPointer"](arg);return Emval.toHandle(v)};var isLeapYear=year=>year%4===0&&(year%100!==0||year%400===0);var MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];var ydayFromDate=date=>{var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday};var convertI32PairToI53Checked=(lo,hi)=>hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN;function __localtime_js(time_low,time_high,tmPtr){var time=convertI32PairToI53Checked(time_low,time_high);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}function __munmap_js(addr,len,prot,flags,fd,offset_low,offset_high){var offset=convertI32PairToI53Checked(offset_low,offset_high);try{var stream=SYSCALLS.getStreamFromFD(fd);if(prot&2){SYSCALLS.doMsync(addr,stream,len,flags,offset)}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var __tzset_js=(timezone,daylight,std_name,dst_name)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}};var _emscripten_date_now=()=>Date.now();function jsStackTrace(){return(new Error).stack.toString()}var warnOnce=text=>{warnOnce.shown||={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text="warning: "+text;err(text)}};function getCallstack(flags){var callstack=jsStackTrace();var iThisFunc=callstack.lastIndexOf("_emscripten_log");var iThisFunc2=callstack.lastIndexOf("_emscripten_get_callstack");var iNextLine=callstack.indexOf("\n",Math.max(iThisFunc,iThisFunc2))+1;callstack=callstack.slice(iNextLine);if(flags&8&&typeof emscripten_source_map=="undefined"){warnOnce('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.');flags^=8;flags|=16}var lines=callstack.split("\n");callstack="";var newFirefoxRe=new RegExp("\\s*(.*?)@(.*?):([0-9]+):([0-9]+)");var firefoxRe=new RegExp("\\s*(.*?)@(.*):(.*)(:(.*))?");var chromeRe=new RegExp("\\s*at (.*?) \\((.*):(.*):(.*)\\)");for(var l in lines){var line=lines[l];var symbolName="";var file="";var lineno=0;var column=0;var parts=chromeRe.exec(line);if(parts&&parts.length==5){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]}else{parts=newFirefoxRe.exec(line)||firefoxRe.exec(line);if(parts&&parts.length>=4){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]|0}else{callstack+=line+"\n";continue}}var haveSourceMap=false;if(flags&8){var orig=emscripten_source_map.originalPositionFor({line:lineno,column});haveSourceMap=orig?.source;if(haveSourceMap){if(flags&64){orig.source=orig.source.substring(orig.source.replace(/\\/g,"/").lastIndexOf("/")+1)}callstack+=` at ${symbolName} (${orig.source}:${orig.line}:${orig.column})\n`}}if(flags&16||!haveSourceMap){if(flags&64){file=file.substring(file.replace(/\\/g,"/").lastIndexOf("/")+1)}callstack+=(haveSourceMap?` = ${symbolName}`:` at ${symbolName}`)+` (${file}:${lineno}:${column})\n`}}callstack=callstack.replace(/\s+$/,"");return callstack}function _emscripten_get_callstack(flags,str,maxbytes){var callstack=getCallstack(flags);if(!str||maxbytes<=0){return lengthBytesUTF8(callstack)+1}var bytesWrittenExcludingNull=stringToUTF8(callstack,str,maxbytes);return bytesWrittenExcludingNull+1}var getHeapMax=()=>Math.min(2147483648,Module["viewstlMaxHeapBytes"]||2147483648);var _emscripten_get_heap_max=()=>getHeapMax();var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var stringToAscii=(str,buffer)=>{for(var i=0;i<str.length;++i){HEAP8[buffer++]=str.charCodeAt(i)}HEAP8[buffer]=0};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;getEnvStrings().forEach((string,i)=>{var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;stringToAscii(string,ptr);bufSize+=string.length+1});return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(string=>bufSize+=string.length+1);HEAPU32[penviron_buf_size>>2]=bufSize;return 0};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doReadv=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len)break;if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){var offset=convertI32PairToI53Checked(offset_low,offset_high);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doWritev=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len){break}if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();embind_init_charCodes();BindingError=Module["BindingError"]=class BindingError extends Error{constructor(message){super(message);this.name="BindingError"}};InternalError=Module["InternalError"]=class InternalError extends Error{constructor(message){super(message);this.name="InternalError"}};init_emval();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");var wasmImports={M:___syscall_chmod,N:___syscall_faccessat,h:___syscall_fcntl64,I:___syscall_fstat64,Q:___syscall_ioctl,F:___syscall_lstat64,G:___syscall_newfstatat,j:___syscall_openat,B:___syscall_rmdir,H:___syscall_stat64,C:___syscall_unlinkat,A:__abort_js,w:__embind_register_bigint,V:__embind_register_bool,U:__embind_register_emval,n:__embind_register_float,f:__embind_register_function,b:__embind_register_integer,a:__embind_register_memory_view,m:__embind_register_std_string,i:__embind_register_std_wstring,W:__embind_register_void,J:__emscripten_get_now_is_monotonic,x:__emscripten_lookup_name,L:__emscripten_memcpy_js,e:__emval_as,q:__emval_call_method,T:__emval_decref,u:__emval_get_global,p:__emval_get_method_caller,k:__emval_get_property,Y:__emval_incref,X:__emval_new_array,r:__emval_new_cstring,Z:__emval_new_object,o:__emval_run_destructors,c:__emval_set_property,d:__emval_take_value,t:__localtime_js,s:__munmap_js,O:__tzset_js,K:_emscripten_date_now,R:_emscripten_get_callstack,z:_emscripten_get_heap_max,y:_emscripten_resize_heap,D:_environ_get,E:_environ_sizes_get,S:_exit,g:_fd_close,P:_fd_read,v:_fd_seek,l:_fd_write};var wasmExports=createWasm();var ___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports["$"])();var ___getTypeName=a0=>(___getTypeName=wasmExports["aa"])(a0);var _malloc=a0=>(_malloc=wasmExports["ca"])(a0);var _free=a0=>(_free=wasmExports["da"])(a0);var _htons=a0=>(_htons=wasmExports["ea"])(a0);var _emscripten_builtin_memalign=(a0,a1)=>(_emscripten_builtin_memalign=wasmExports["fa"])(a0,a1);var ___trap=()=>(___trap=wasmExports["ga"])();var dynCall_viijii=Module["dynCall_viijii"]=(a0,a1,a2,a3,a4,a5,a6)=>(dynCall_viijii=Module["dynCall_viijii"]=wasmExports["ha"])(a0,a1,a2,a3,a4,a5,a6);var dynCall_viiiiji=Module["dynCall_viiiiji"]=(a0,a1,a2,a3,a4,a5,a6,a7)=>(dynCall_viiiiji=Module["dynCall_viiiiji"]=wasmExports["ia"])(a0,a1,a2,a3,a4,a5,a6,a7);var dynCall_jiji=Module["dynCall_jiji"]=(a0,a1,a2,a3,a4)=>(dynCall_jiji=Module["dynCall_jiji"]=wasmExports["ja"])(a0,a1,a2,a3,a4);var dynCall_iiiiij=Module["dynCall_iiiiij"]=(a0,a1,a2,a3,a4,a5,a6)=>(dynCall_iiiiij=Module["dynCall_iiiiij"]=wasmExports["ka"])(a0,a1,a2,a3,a4,a5,a6);var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=(a0,a1,a2,a3,a4,a5,a6,a7,a8)=>(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=wasmExports["la"])(a0,a1,a2,a3,a4,a5,a6,a7,a8);var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9)=>(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=wasmExports["ma"])(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9);var calledRun;var calledPrerun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(){if(runDependencies>0){return}if(!calledPrerun){calledPrerun=1;preRun();if(runDependencies>0){return}}function doRun(){if(calledRun)return;calledRun=1;Module["calledRun"]=1;if(ABORT)return;initRuntime();readyPromiseResolve(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();moduleRtn=readyPromise;
48
+
49
+
50
+ return moduleRtn;
51
+ }
52
+ );
53
+ })();
54
+ if (typeof exports === 'object' && typeof module === 'object')
55
+ module.exports = occtimportjs;
56
+ else if (typeof define === 'function' && define['amd'])
57
+ define([], () => occtimportjs);
Binary file
@@ -0,0 +1,112 @@
1
+ // Adapt the pinned Emscripten glue without rebuilding or modifying its WASM.
2
+ // Keep these source changes available alongside the LGPL CAD assets.
3
+ import { readFile, writeFile, mkdir, copyFile } from "node:fs/promises";
4
+ import { build } from "esbuild";
5
+
6
+ export function adaptCADGlue(source) {
7
+ function replace(from, to) {
8
+ if (source.split(from).length !== 2)
9
+ throw new Error("Unexpected occt-import-js glue; review CAD adapter");
10
+ source = source.replace(from, to);
11
+ }
12
+ function replaceSection(start, end, replacement) {
13
+ const a = source.indexOf(start),
14
+ b = source.indexOf(end, a);
15
+ if (a < 0 || b <= a) throw new Error("Missing Emscripten binding section");
16
+ replace(source.slice(a, b), replacement);
17
+ }
18
+ // The upstream package generates two binding functions with Function().
19
+ // Equivalent closures allow script-src 'self' 'wasm-unsafe-eval', without
20
+ // enabling JavaScript eval. This build exports synchronous functions only.
21
+ replaceSection(
22
+ "function newFunc(",
23
+ "var ensureOverloadTable=",
24
+ `
25
+ function craftInvokerFunction(humanName, argTypes, classType, invoker, target, isAsync) {
26
+ if (isAsync || argTypes.length < 2) throw new Error('Unsupported CAD binding');
27
+ const isMethod = argTypes[1] !== null && classType !== null;
28
+ const usesStack = usesDestructorStack(argTypes);
29
+ return createNamedFunction(humanName, function (...args) {
30
+ const stack = usesStack ? [] : null, cleanup = [], wired = [target];
31
+ let result;
32
+ function convert(type, value) {
33
+ const converted = type.toWireType(stack, value);
34
+ if (!usesStack && type.destructorFunction) cleanup.push([type.destructorFunction, converted]);
35
+ return converted;
36
+ }
37
+ try {
38
+ if (isMethod) wired.push(convert(argTypes[1], this));
39
+ for (let i = 2; i < argTypes.length; i++) wired.push(convert(argTypes[i], args[i - 2]));
40
+ result = invoker(...wired);
41
+ } finally {
42
+ if (stack) runDestructors(stack);
43
+ else for (const [destroy, value] of cleanup) destroy(value);
44
+ }
45
+ if (!argTypes[0].isVoid) return argTypes[0].fromWireType(result);
46
+ });
47
+ }
48
+ `,
49
+ );
50
+ replaceSection(
51
+ "var __emval_get_method_caller=",
52
+ "var __emval_get_property=",
53
+ `
54
+ var __emval_get_method_caller = (argCount, argTypes, kind) => {
55
+ const types = emval_lookupTypes(argCount, argTypes), retType = types.shift();
56
+ if (kind !== 0 && kind !== 1) throw new Error('Unsupported CAD method binding');
57
+ return emval_addMethodCaller(function (obj, func, destructorsRef, pointer) {
58
+ const args = [];
59
+ for (const type of types) {
60
+ args.push(type.readValueFromPointer(pointer));
61
+ pointer += type.argPackAdvance;
62
+ }
63
+ const result = kind === 1 ? Reflect.construct(func, args) : func.apply(obj, args);
64
+ if (!retType.isVoid) return emval_returnValue(retType, destructorsRef, result);
65
+ });
66
+ };
67
+ `,
68
+ );
69
+ replace(
70
+ "var getHeapMax=()=>2147483648;",
71
+ 'var getHeapMax=()=>Math.min(2147483648,Module["viewstlMaxHeapBytes"]||2147483648);',
72
+ );
73
+ if (source.includes("newFunc(Function"))
74
+ throw new Error("CAD glue still requires eval");
75
+ return source;
76
+ }
77
+
78
+ export async function buildCAD(out) {
79
+ const pkg = "node_modules/occt-import-js";
80
+ const metadata = JSON.parse(await readFile(`${pkg}/package.json`, "utf8"));
81
+ if (metadata.version !== "0.0.23")
82
+ throw new Error("Review CAD glue for updated dependency");
83
+ await mkdir(`${out}/cad`, { recursive: true });
84
+ const source = adaptCADGlue(
85
+ await readFile(`${pkg}/dist/occt-import-js.js`, "utf8"),
86
+ );
87
+ await build({
88
+ stdin: {
89
+ contents: source,
90
+ sourcefile: "occt-import-js.cjs",
91
+ resolveDir: process.cwd(),
92
+ },
93
+ bundle: true,
94
+ format: "esm",
95
+ platform: "browser",
96
+ target: "es2022",
97
+ minify: true,
98
+ define: { process: "undefined" },
99
+ external: ["fs", "path", "crypto"],
100
+ outfile: `${out}/cad/occt-import-js.js`,
101
+ });
102
+ await copyFile(
103
+ `${pkg}/dist/occt-import-js.wasm`,
104
+ `${out}/cad/occt-import-js.wasm`,
105
+ );
106
+ // Ship the glue source and exact adaptation recipe for inspection/replacement.
107
+ await writeFile(`${out}/cad/occt-import-js.source.txt`, source);
108
+ await copyFile(
109
+ "scripts/prepare-cad.mjs",
110
+ `${out}/cad/prepare-cad.source.txt`,
111
+ );
112
+ }
@@ -0,0 +1 @@
1
+ import{a,b,c,d}from"./chunk-R3HNTB5A.js";import"./chunk-ZSV4PTIA.js";import"./chunk-JH3H3JWA.js";import"./chunk-JS56KC3I.js";import"./chunk-U33KANV7.js";export{d as parse3MF,a as safePath,b as unzipChecked,c as zipScene};
@@ -0,0 +1 @@
1
+ import{a as A,c as E}from"./chunk-JH3H3JWA.js";import{a as w}from"./chunk-JS56KC3I.js";import"./chunk-U33KANV7.js";var u=128*1024**2;function D(t){return u+t*40}async function x(t){let{default:s}=await import(new URL("../cad/occt-import-js.js",import.meta.url).href);return s({...t,locateFile:()=>new URL("../cad/occt-import-js.wasm",import.meta.url).href})}function C(t,s=A,c=0){if(!t?.success||!Array.isArray(t.meshes)||!t.meshes.length)throw new Error("No supported surfaces were found in this CAD file. Export a self-contained STEP or IGES solid/surface model.");let n=0,m=0,f=!1;for(let r of t.meshes){let a=r.attributes?.position?.array,o=r.index?.array;if(!a?.length||a.length%3||!o||o.length%3)throw new Error("Invalid CAD mesh");if(n+=o.length/3,!Number.isSafeInteger(n)||n>s.max_triangles)throw new Error("Triangle limit exceeded");m+=(a.length+o.length+(r.attributes.normal?.array?.length||0))*16,f||=!!r.color||!!r.brep_faces?.some(e=>e.color)}if(!n)throw new Error("This CAD file contains no viewable surfaces.");w(s,c+m+n*224,"CAD model");let h=new Float32Array(n*9),l=f?new Float32Array(h.length):null,d=[144/255,144/255,144/255],i=0;function y(r,a,o){if(!r||r.length!==3||r.some(e=>!Number.isFinite(e)||e<0||e>1))throw new Error("Invalid CAD color");for(let e=a;e<o;e+=3)l.set(r,e)}for(let r of t.meshes){let a=r.attributes.position.array,o=r.index.array;for(let e=0;e<o.length;e++){let g=o[e];if(!Number.isSafeInteger(g)||g<0||g*3+2>=a.length)throw new Error("Invalid CAD triangle index");for(let p=0;p<3;p++)h[i+e*3+p]=a[g*3+p]}if(l){y(r.color||d,i,i+o.length*3);for(let e of r.brep_faces||[])if(e.color){if(!Number.isSafeInteger(e.first)||!Number.isSafeInteger(e.last)||e.first<0||e.last<e.first||e.last>=o.length/3)throw new Error("Invalid CAD face range");y(e.color,i+e.first*9,i+(e.last+1)*9)}}i+=o.length*3}return E(h,l,s)}async function L(t,s,c=A,n=()=>{},m=x){let f=/\.(step|stp|iges|igs)(?:[?#]|$)/i.exec(s)?.[1].toLowerCase();if(!f)throw new Error("Unsupported CAD format");if(!(t instanceof ArrayBuffer)||!t.byteLength||t.byteLength>c.max_file_bytes)throw new Error("Invalid or oversized CAD file");w(c,D(t.byteLength),"CAD file");let h=Math.floor(Math.min(512*1024**2,((c.max_memory_bytes??Number.MAX_SAFE_INTEGER)-u-t.byteLength*3)/2)/65536)*65536;if(h<32*1024**2)throw new Error("CAD import exceeds the device safety budget.");n("loading-cad");let l;try{l=await m({viewstlMaxHeapBytes:h,print(){},printErr(){}})}catch{throw new Error("The CAD reader could not start. Check the connection and that WebAssembly is allowed, then try again.")}n("parsing-cad");let d=/^(step|stp)$/.test(f)?"step":"iges",i;try{i=l[d==="step"?"ReadStepFile":"ReadIgesFile"](new Uint8Array(t),{linearUnit:"millimeter",linearDeflectionType:"bounding_box_ratio",linearDeflection:.001,angularDeflection:.5})}catch{throw new Error("This CAD file could not be processed within the reader limits. Try a smaller or simplified STEP/IGES export.")}return{...C(i,c,u+t.byteLength*3+l.HEAPU8.byteLength),format:d,units:"mm"}}export{u as CAD_OVERHEAD,C as cadGeometry,D as cadMemory,L as parseCAD};
@@ -0,0 +1 @@
1
+ import{a as k}from"./chunk-JS56KC3I.js";var z=Object.freeze({max_file_bytes:256*1024*1024,max_triangles:5e6,max_uncompressed_bytes:256*1024*1024,max_archive_entries:1024,max_memory_bytes:Number.MAX_SAFE_INTEGER});function O(e){if(typeof e!="string"||!/^#[\da-f]{6}$/i.test(e))throw new Error("Color must be #RRGGBB");return[1,3,5].map(i=>parseInt(e.slice(i,i+2),16)/255)}function U(e,i=null,I=z){if(!(e instanceof Float32Array)||!e.length||e.length%9)throw new Error("Geometry must contain complete triangles");if(e.length/9>I.max_triangles)throw new Error("Triangle limit exceeded");if(k(I,67108864+e.length/9*224),i&&(!(i instanceof Float32Array)||i.length!==e.length))throw new Error("Invalid vertex colors");let u={min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]};for(let r=0;r<e.length;r++){let f=e[r],t=r%3;if(!Number.isFinite(f))throw new Error("Non-finite vertex coordinate");if(u.min[t]=Math.min(u.min[t],f),u.max[t]=Math.max(u.max[t],f),i&&(!Number.isFinite(i[r])||i[r]<0||i[r]>1))throw new Error("Invalid vertex color")}let y=new Float32Array(e.length),b=new Float32Array(Math.ceil(e.length/9/64)*6),h=0,s=0,l=0;for(let r=0;r<e.length;r+=9){let f=e[r+3]-e[r],t=e[r+4]-e[r+1],c=e[r+5]-e[r+2],n=e[r+6]-e[r],o=e[r+7]-e[r+1],x=e[r+8]-e[r+2],w=t*x-c*o,M=c*n-f*x,g=f*o-t*n,E=Math.hypot(w,M,g);h+=E/2,s+=(e[r]*w+e[r+1]*M+e[r+2]*g)/6,E||l++;for(let a=0;a<9;a+=3)y[r+a]=w/(E||1),y[r+a+1]=M/(E||1),y[r+a+2]=g/(E||1);let m=Math.floor(r/9/64)*6;r/9%64===0&&b.set([1/0,1/0,1/0,-1/0,-1/0,-1/0],m);for(let a=0;a<9;a++){let d=a%3;b[m+d]=Math.min(b[m+d],e[r+a]),b[m+3+d]=Math.max(b[m+3+d],e[r+a])}}if(!Number.isFinite(h)||!Number.isFinite(s))throw new Error("Geometry magnitude exceeds numeric limits");return{positions:e,normals:y,colors:i,blocks:b,bounds:u,triangles:e.length/9,area:h,volume:Math.abs(s),degenerateTriangles:l}}function j(e,{smooth:i=!1,edges:I=!1,wire:u=!1,edgeAngle:y=1}={}){let b=new Map,h=new Uint32Array(e.length/3),s=[],l=[];for(let t=0;t<e.length;t+=3){let c=`${e[t]},${e[t+1]},${e[t+2]}`,n=b.get(c);n===void 0&&(n=s.length,b.set(c,n),s.push([e[t],e[t+1],e[t+2]]),l.push([0,0,0])),h[t/3]=n}let r=new Map;for(let t=0;t<e.length;t+=9){let c=e[t+3]-e[t],n=e[t+4]-e[t+1],o=e[t+5]-e[t+2],x=e[t+6]-e[t],w=e[t+7]-e[t+1],M=e[t+8]-e[t+2],g=[n*M-o*w,o*x-c*M,c*w-n*x],E=Math.hypot(...g)||1;for(let m=0;m<3;m++)if(i)for(let a=0;a<3;a++)l[h[t/3+m]][a]+=g[a];if(I||u)for(let m=0;m<3;m++){let a=h[t/3+m],d=h[t/3+(m+1)%3],A=a<d?`${a}:${d}`:`${d}:${a}`,F=g.map(v=>v/E),_=r.get(A);_?(_.count++,_.n.reduce((v,N,T)=>v+N*F[T],0)<Math.cos(y*Math.PI/180)&&(_.sharp=!0)):r.set(A,{a,b:d,n:F,count:1,sharp:!1})}}let f={};if(i){f.smoothNormals=new Float32Array(e.length);for(let t=0;t<h.length;t++){let c=l[h[t]],n=Math.hypot(...c)||1;f.smoothNormals.set(c.map(o=>o/n),t*3)}}for(let[t,c,n]of[[I,"edges",o=>o.count!==2||o.sharp],[u,"wire",()=>!0]])if(t){let o=[...r.values()].filter(n),x=new Float32Array(o.length*6);o.forEach((w,M)=>{x.set(s[w.a],M*6),x.set(s[w.b],M*6+3)}),f[c]=x,c==="edges"&&(f.edgeAngle=y)}return f}function D(e,i=[1,1,1],I=[0,0,0]){let u=new ArrayBuffer(84+e.triangles*50),y=new DataView(u),b=e.positions;new Uint8Array(u).set(new TextEncoder().encode("Binary STL by ViewSTL 2")),y.setUint32(80,e.triangles,!0);for(let h=0;h<e.triangles;h++){let s=84+h*50,l=Array.from({length:9},(n,o)=>(b[h*9+o]-I[o%3])*i[o%3]),r=[l[3]-l[0],l[4]-l[1],l[5]-l[2]],f=[l[6]-l[0],l[7]-l[1],l[8]-l[2]],t=[r[1]*f[2]-r[2]*f[1],r[2]*f[0]-r[0]*f[2],r[0]*f[1]-r[1]*f[0]],c=Math.hypot(...t)||1;for(let n=0;n<3;n++)y.setFloat32(s+n*4,t[n]/c,!0);for(let n=0;n<9;n++)y.setFloat32(s+12+n*4,l[n],!0);if(e.colors){let n=[0,1,2].map(o=>Math.round(e.colors[h*9+o]*31));y.setUint16(s+48,32768|n[0]<<10|n[1]<<5|n[2],!0)}}return u}export{z as a,O as b,U as c,j as d,D as e};
@@ -0,0 +1 @@
1
+ function o(r,e,t="model"){if(e>(r.max_memory_bytes??Number.MAX_SAFE_INTEGER))throw new Error(`Estimated memory for this ${t} exceeds the device safety budget. Use a smaller model or a device with more memory.`)}function m(r,e){return 67108864+r*(224+(e.smooth?1536:0)+(e.edges||e.wire?2048:0))}export{o as a,m as b};