diff --git a/.npmignore b/.npmignore index 105164e..262e8a5 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1,3 @@ test -lib \ No newline at end of file +lib +examples \ No newline at end of file diff --git a/README.md b/README.md index 656496b..704a94c 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,6 @@ npm version - - build status - license diff --git a/dist/libarchive.js b/dist/libarchive.js index 24adb8e..91118c8 100644 --- a/dist/libarchive.js +++ b/dist/libarchive.js @@ -3,4 +3,4 @@ * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */ -const e=Symbol("Comlink.proxy"),t=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),r=Symbol("Comlink.finalizer"),i=Symbol("Comlink.thrown"),s=e=>"object"==typeof e&&null!==e||"function"==typeof e,a=new Map([["proxy",{canHandle:t=>s(t)&&t[e],serialize(e){const{port1:t,port2:n}=new MessageChannel;return o(e,t),[n,[n]]},deserialize:e=>(e.start(),l(e))}],["throw",{canHandle:e=>s(e)&&i in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function o(e,t=globalThis,n=["*"]){t.addEventListener("message",(function s(a){if(!a||!a.data)return;if(!function(e,t){for(const n of e){if(t===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin '${a.origin}' for comlink proxy`);const{id:l,type:u,path:p}=Object.assign({path:[]},a.data),h=(a.data.argumentList||[]).map(E);let f;try{const t=p.slice(0,-1).reduce(((e,t)=>e[t]),e),n=p.reduce(((e,t)=>e[t]),e);switch(u){case"GET":f=n;break;case"SET":t[p.slice(-1)[0]]=E(a.data.value),f=!0;break;case"APPLY":f=n.apply(t,h);break;case"CONSTRUCT":f=w(new n(...h));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;o(e,n),f=function(e,t){return g.set(e,t),e}(t,[t])}break;case"RELEASE":f=void 0;break;default:return}}catch(e){f={value:e,[i]:0}}Promise.resolve(f).catch((e=>({value:e,[i]:0}))).then((n=>{const[i,a]=y(n);t.postMessage(Object.assign(Object.assign({},i),{id:l}),a),"RELEASE"===u&&(t.removeEventListener("message",s),c(t),r in e&&"function"==typeof e[r]&&e[r]())})).catch((e=>{const[n,r]=y({value:new TypeError("Unserializable return value"),[i]:0});t.postMessage(Object.assign(Object.assign({},n),{id:l}),r)}))})),t.start&&t.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function l(e,t){return d(e,[],t)}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function p(e){return v(e,{type:"RELEASE"}).then((()=>{c(e)}))}const h=new WeakMap,f="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(h.get(e)||0)-1;h.set(e,t),0===t&&p(e)}));function d(e,r=[],i=function(){}){let s=!1;const a=new Proxy(i,{get(t,i){if(u(s),i===n)return()=>{!function(e){f&&f.unregister(e)}(a),p(e),s=!0};if("then"===i){if(0===r.length)return{then:()=>a};const t=v(e,{type:"GET",path:r.map((e=>e.toString()))}).then(E);return t.then.bind(t)}return d(e,[...r,i])},set(t,n,i){u(s);const[a,o]=y(i);return v(e,{type:"SET",path:[...r,n].map((e=>e.toString())),value:a},o).then(E)},apply(n,i,a){u(s);const o=r[r.length-1];if(o===t)return v(e,{type:"ENDPOINT"}).then(E);if("bind"===o)return d(e,r.slice(0,-1));const[c,l]=m(a);return v(e,{type:"APPLY",path:r.map((e=>e.toString())),argumentList:c},l).then(E)},construct(t,n){u(s);const[i,a]=m(n);return v(e,{type:"CONSTRUCT",path:r.map((e=>e.toString())),argumentList:i},a).then(E)}});return function(e,t){const n=(h.get(t)||0)+1;h.set(t,n),f&&f.register(e,t,e)}(a,e),a}function m(e){const t=e.map(y);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const g=new WeakMap;function w(t){return Object.assign(t,{[e]:!0})}function y(e){for(const[t,n]of a)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},g.get(e)||[]]}function E(e){switch(e.type){case"HANDLER":return a.get(e.name).deserialize(e.value);case"RAW":return e.value}}function v(e,t,n){return new Promise((r=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===i&&(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)}))}class b{constructor(e,t,n,r,i){this._name=e,this._size=t,this._path=n,this._lastModified=r,this._archiveRef=i}get name(){return this._name}get size(){return this._size}get lastModified(){return this._lastModified}extract(){return this._archiveRef.extractSingleFile(this._path)}}function R(e){if(e instanceof File||e instanceof b||null===e)return e;const t={};for(const n of Object.keys(e))t[n]=R(e[n]);return t}function S(e,t=""){const n=[];for(const r of Object.keys(e))e[r]instanceof File||e[r]instanceof b||null===e[r]?n.push({file:e[r]||r,path:t}):n.push(...S(e[r],`${t}${r}/`));return n}function A(e,t){const n=t.split("/");""===n[n.length-1]&&n.pop();let r=e,i=null;for(const e of n)r[e]=r[e]||{},i=r,r=r[e];return[i,n[n.length-1]]}class _{constructor(e,t,n){this._content={},this._processed=0,this.file=e,this.client=t,this.worker=n}open(){return this._content={},this._processed=0,new Promise(((e,t)=>{this.client.open(this.file,w((()=>{e(this)})))}))}async close(){var e;null===(e=this.worker)||void 0===e||e.terminate(),this.worker=null,this.client=null,this.file=null}async hasEncryptedData(){return await this.client.hasEncryptedData()}async usePassword(e){await this.client.usePassword(e)}async setLocale(e){await this.client.setLocale(e)}async getFilesObject(){if(this._processed>0)return Promise.resolve().then((()=>this._content));return(await this.client.listFiles()).forEach((e=>{const[t,n]=A(this._content,e.path);"FILE"===e.type&&(t[n]=new b(e.fileName,e.size,e.path,e.lastModified,this))})),this._processed=1,R(this._content)}getFilesArray(){return this.getFilesObject().then((e=>S(e)))}async extractSingleFile(e){if(null===this.worker)throw new Error("Archive already closed");const t=await this.client.extractSingleFile(e);return new File([t.fileData],t.fileName,{type:"application/octet-stream",lastModified:t.lastModified/1e6})}async extractFiles(e=void 0){var t;if(this._processed>1)return Promise.resolve().then((()=>this._content));return(await this.client.extractFiles()).forEach((t=>{const[n,r]=A(this._content,t.path);"FILE"===t.type&&(n[r]=new File([t.fileData],t.fileName,{type:"application/octet-stream"}),void 0!==e&&setTimeout(e.bind(null,{file:n[r],path:t.path})))})),this._processed=2,null===(t=this.worker)||void 0===t||t.terminate(),R(this._content)}}var P,k;!function(e){e.SEVEN_ZIP="7zip",e.AR="ar",e.ARBSD="arbsd",e.ARGNU="argnu",e.ARSVR4="arsvr4",e.BIN="bin",e.BSDTAR="bsdtar",e.CD9660="cd9660",e.CPIO="cpio",e.GNUTAR="gnutar",e.ISO="iso",e.ISO9660="iso9660",e.MTREE="mtree",e.MTREE_CLASSIC="mtree-classic",e.NEWC="newc",e.ODC="odc",e.OLDTAR="oldtar",e.PAX="pax",e.PAXR="paxr",e.POSIX="posix",e.PWB="pwb",e.RAW="raw",e.RPAX="rpax",e.SHAR="shar",e.SHARDUMP="shardump",e.USTAR="ustar",e.V7TAR="v7tar",e.V7="v7",e.WARC="warc",e.XAR="xar",e.ZIP="zip"}(P||(P={})),function(e){e.B64ENCODE="b64encode",e.BZIP2="bzip2",e.COMPRESS="compress",e.GRZIP="grzip",e.GZIP="gzip",e.LRZIP="lrzip",e.LZ4="lz4",e.LZIP="lzip",e.LZMA="lzma",e.LZOP="lzop",e.UUENCODE="uuencode",e.XZ="xz",e.ZSTD="zstd",e.NONE="none"}(k||(k={}));class O{static init(e=null){return O._options=e||{},O._options}static async open(e){const t=O.getWorker(O._options),n=await O.getClient(t,O._options),r=new _(e,n,t);return await r.open()}static async write({files:e,outputFileName:t,compression:n,format:r,passphrase:i=null}){const s=O.getWorker(O._options),a=await O.getClient(s,O._options),o=await a.writeArchive(e,n,r,i);return s.terminate(),new File([o],t,{type:"application/octet-stream"})}static getWorker(e){return e.getWorker?e.getWorker():new Worker(e.workerUrl||new URL("./worker-bundle.js",import.meta.url),{type:"module"})}static async getClient(e,t){var n;const r=(null===(n=t.createClient)||void 0===n?void 0:n.call(t,e))||l(e);let{promise:i,resolve:s}=Promise.withResolvers();const a=await new r(w((()=>{s()})));return await i,a}}O._options={};export{O as Archive,k as ArchiveCompression,P as ArchiveFormat}; +const e=Symbol("Comlink.proxy"),t=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),r=Symbol("Comlink.finalizer"),i=Symbol("Comlink.thrown"),s=e=>"object"==typeof e&&null!==e||"function"==typeof e,a=new Map([["proxy",{canHandle:t=>s(t)&&t[e],serialize(e){const{port1:t,port2:n}=new MessageChannel;return o(e,t),[n,[n]]},deserialize:e=>(e.start(),l(e))}],["throw",{canHandle:e=>s(e)&&i in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function o(e,t=globalThis,n=["*"]){t.addEventListener("message",(function s(a){if(!a||!a.data)return;if(!function(e,t){for(const n of e){if(t===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin '${a.origin}' for comlink proxy`);const{id:l,type:u,path:p}=Object.assign({path:[]},a.data),h=(a.data.argumentList||[]).map(v);let f;try{const t=p.slice(0,-1).reduce(((e,t)=>e[t]),e),n=p.reduce(((e,t)=>e[t]),e);switch(u){case"GET":f=n;break;case"SET":t[p.slice(-1)[0]]=v(a.data.value),f=!0;break;case"APPLY":f=n.apply(t,h);break;case"CONSTRUCT":f=w(new n(...h));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;o(e,n),f=function(e,t){return g.set(e,t),e}(t,[t])}break;case"RELEASE":f=void 0;break;default:return}}catch(e){f={value:e,[i]:0}}Promise.resolve(f).catch((e=>({value:e,[i]:0}))).then((n=>{const[i,a]=y(n);t.postMessage(Object.assign(Object.assign({},i),{id:l}),a),"RELEASE"===u&&(t.removeEventListener("message",s),c(t),r in e&&"function"==typeof e[r]&&e[r]())})).catch((e=>{const[n,r]=y({value:new TypeError("Unserializable return value"),[i]:0});t.postMessage(Object.assign(Object.assign({},n),{id:l}),r)}))})),t.start&&t.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function l(e,t){return d(e,[],t)}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function p(e){return E(e,{type:"RELEASE"}).then((()=>{c(e)}))}const h=new WeakMap,f="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(h.get(e)||0)-1;h.set(e,t),0===t&&p(e)}));function d(e,r=[],i=function(){}){let s=!1;const a=new Proxy(i,{get(t,i){if(u(s),i===n)return()=>{!function(e){f&&f.unregister(e)}(a),p(e),s=!0};if("then"===i){if(0===r.length)return{then:()=>a};const t=E(e,{type:"GET",path:r.map((e=>e.toString()))}).then(v);return t.then.bind(t)}return d(e,[...r,i])},set(t,n,i){u(s);const[a,o]=y(i);return E(e,{type:"SET",path:[...r,n].map((e=>e.toString())),value:a},o).then(v)},apply(n,i,a){u(s);const o=r[r.length-1];if(o===t)return E(e,{type:"ENDPOINT"}).then(v);if("bind"===o)return d(e,r.slice(0,-1));const[c,l]=m(a);return E(e,{type:"APPLY",path:r.map((e=>e.toString())),argumentList:c},l).then(v)},construct(t,n){u(s);const[i,a]=m(n);return E(e,{type:"CONSTRUCT",path:r.map((e=>e.toString())),argumentList:i},a).then(v)}});return function(e,t){const n=(h.get(t)||0)+1;h.set(t,n),f&&f.register(e,t,e)}(a,e),a}function m(e){const t=e.map(y);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const g=new WeakMap;function w(t){return Object.assign(t,{[e]:!0})}function y(e){for(const[t,n]of a)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},g.get(e)||[]]}function v(e){switch(e.type){case"HANDLER":return a.get(e.name).deserialize(e.value);case"RAW":return e.value}}function E(e,t,n){return new Promise((r=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===i&&(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)}))}class R{constructor(e,t,n,r,i){this._name=e,this._size=t,this._path=n,this._lastModified=r,this._archiveRef=i}get name(){return this._name}get size(){return this._size}get lastModified(){return this._lastModified}extract(){return this._archiveRef.extractSingleFile(this._path)}}function b(e){if(e instanceof File||e instanceof R||null===e)return e;const t={};for(const n of Object.keys(e))t[n]=b(e[n]);return t}function P(e,t=""){const n=[];for(const r of Object.keys(e))e[r]instanceof File||e[r]instanceof R||null===e[r]?n.push({file:e[r]||r,path:t}):n.push(...P(e[r],`${t}${r}/`));return n}function S(e,t){const n=t.split("/");""===n[n.length-1]&&n.pop();let r=e,i=null;for(const e of n)r[e]=r[e]||{},i=r,r=r[e];return[i,n[n.length-1]]}class A{constructor(e,t,n){this._content={},this._processed=0,this.file=e,this.client=t,this.worker=n}open(){return this._content={},this._processed=0,new Promise(((e,t)=>{this.client.open(this.file,w((()=>{e(this)})))}))}async close(){var e;null===(e=this.worker)||void 0===e||e.terminate(),this.worker=null,this.client=null,this.file=null}async hasEncryptedData(){return await this.client.hasEncryptedData()}async usePassword(e){await this.client.usePassword(e)}async setLocale(e){await this.client.setLocale(e)}async getFilesObject(){if(this._processed>0)return Promise.resolve().then((()=>this._content));return(await this.client.listFiles()).forEach((e=>{const[t,n]=S(this._content,e.path);"FILE"===e.type&&(t[n]=new R(e.fileName,e.size,e.path,e.lastModified,this))})),this._processed=1,b(this._content)}getFilesArray(){return this.getFilesObject().then((e=>P(e)))}async extractSingleFile(e){if(null===this.worker)throw new Error("Archive already closed");const t=await this.client.extractSingleFile(e);return new File([t.fileData],t.fileName,{type:"application/octet-stream",lastModified:t.lastModified/1e6})}async extractFiles(e=void 0){var t;if(this._processed>1)return Promise.resolve().then((()=>this._content));return(await this.client.extractFiles()).forEach((t=>{const[n,r]=S(this._content,t.path);"FILE"===t.type&&(n[r]=new File([t.fileData],t.fileName,{type:"application/octet-stream"}),void 0!==e&&setTimeout(e.bind(null,{file:n[r],path:t.path})))})),this._processed=2,null===(t=this.worker)||void 0===t||t.terminate(),b(this._content)}}var _,k;!function(e){e.SEVEN_ZIP="7zip",e.AR="ar",e.ARBSD="arbsd",e.ARGNU="argnu",e.ARSVR4="arsvr4",e.BIN="bin",e.BSDTAR="bsdtar",e.CD9660="cd9660",e.CPIO="cpio",e.GNUTAR="gnutar",e.ISO="iso",e.ISO9660="iso9660",e.MTREE="mtree",e.MTREE_CLASSIC="mtree-classic",e.NEWC="newc",e.ODC="odc",e.OLDTAR="oldtar",e.PAX="pax",e.PAXR="paxr",e.POSIX="posix",e.PWB="pwb",e.RAW="raw",e.RPAX="rpax",e.SHAR="shar",e.SHARDUMP="shardump",e.USTAR="ustar",e.V7TAR="v7tar",e.V7="v7",e.WARC="warc",e.XAR="xar",e.ZIP="zip"}(_||(_={})),function(e){e.B64ENCODE="b64encode",e.BZIP2="bzip2",e.COMPRESS="compress",e.GRZIP="grzip",e.GZIP="gzip",e.LRZIP="lrzip",e.LZ4="lz4",e.LZIP="lzip",e.LZMA="lzma",e.LZOP="lzop",e.UUENCODE="uuencode",e.XZ="xz",e.ZSTD="zstd",e.NONE="none"}(k||(k={}));class O{static init(e=null){return O._options=e||{},O._options}static async open(e){const t=O.getWorker(O._options),n=await O.getClient(t,O._options),r=new A(e,n,t);return await r.open()}static async write({files:e,outputFileName:t,compression:n,format:r,passphrase:i=null}){const s=O.getWorker(O._options),a=await O.getClient(s,O._options),o=await a.writeArchive(e,n,r,i);return s.terminate(),new File([o],t,{type:"application/octet-stream"})}static getWorker(e){return e.getWorker?e.getWorker():new Worker(e.workerUrl||new URL("./worker-bundle.js",import.meta.url),{type:"module"})}static async getClient(e,t){var n;const r=(null===(n=t.createClient)||void 0===n?void 0:n.call(t,e))||l(e);let{promise:i,resolve:s}=Promise.withResolvers();const a=await new r(w((()=>{s()})));return await i,a}}O._options={},Promise.withResolvers||(Promise.withResolvers=function(){var e,t,n=new this((function(n,r){e=n,t=r}));return{resolve:e,reject:t,promise:n}});export{O as Archive,k as ArchiveCompression,_ as ArchiveFormat}; diff --git a/examples/esbuild/build.mjs b/examples/esbuild/build.mjs new file mode 100644 index 0000000..bda8be3 --- /dev/null +++ b/examples/esbuild/build.mjs @@ -0,0 +1,20 @@ +import { build } from "esbuild"; +import { copy } from "esbuild-plugin-copy"; + +build({ + entryPoints: ["index.js"], + bundle: true, + outfile: "./dist/index.js", + external: ["./worker-bundle.js"], + format: "esm", + plugins: [ + copy({ + resolveFrom: "cwd", + assets: { + from: ["node_modules/libarchive.js/dist/*"], + to: ["./dist/"], + }, + watch: true, + }), + ], +}); diff --git a/examples/esbuild/dist/index.js b/examples/esbuild/dist/index.js new file mode 100644 index 0000000..6eba2a2 --- /dev/null +++ b/examples/esbuild/dist/index.js @@ -0,0 +1,317 @@ +// node_modules/libarchive.js/dist/libarchive.js +var e = Symbol("Comlink.proxy"); +var t = Symbol("Comlink.endpoint"); +var n = Symbol("Comlink.releaseProxy"); +var r = Symbol("Comlink.finalizer"); +var i = Symbol("Comlink.thrown"); +var s = (e2) => "object" == typeof e2 && null !== e2 || "function" == typeof e2; +var a = /* @__PURE__ */ new Map([["proxy", { canHandle: (t2) => s(t2) && t2[e], serialize(e2) { + const { port1: t2, port2: n2 } = new MessageChannel(); + return o(e2, t2), [n2, [n2]]; +}, deserialize: (e2) => (e2.start(), l(e2)) }], ["throw", { canHandle: (e2) => s(e2) && i in e2, serialize({ value: e2 }) { + let t2; + return t2 = e2 instanceof Error ? { isError: true, value: { message: e2.message, name: e2.name, stack: e2.stack } } : { isError: false, value: e2 }, [t2, []]; +}, deserialize(e2) { + if (e2.isError) + throw Object.assign(new Error(e2.value.message), e2.value); + throw e2.value; +} }]]); +function o(e2, t2 = globalThis, n2 = ["*"]) { + t2.addEventListener("message", function s2(a2) { + if (!a2 || !a2.data) + return; + if (!function(e3, t3) { + for (const n3 of e3) { + if (t3 === n3 || "*" === n3) + return true; + if (n3 instanceof RegExp && n3.test(t3)) + return true; + } + return false; + }(n2, a2.origin)) + return void console.warn(`Invalid origin '${a2.origin}' for comlink proxy`); + const { id: l2, type: u2, path: p2 } = Object.assign({ path: [] }, a2.data), h2 = (a2.data.argumentList || []).map(E); + let f2; + try { + const t3 = p2.slice(0, -1).reduce((e3, t4) => e3[t4], e2), n3 = p2.reduce((e3, t4) => e3[t4], e2); + switch (u2) { + case "GET": + f2 = n3; + break; + case "SET": + t3[p2.slice(-1)[0]] = E(a2.data.value), f2 = true; + break; + case "APPLY": + f2 = n3.apply(t3, h2); + break; + case "CONSTRUCT": + f2 = w(new n3(...h2)); + break; + case "ENDPOINT": + { + const { port1: t4, port2: n4 } = new MessageChannel(); + o(e2, n4), f2 = function(e3, t5) { + return g.set(e3, t5), e3; + }(t4, [t4]); + } + break; + case "RELEASE": + f2 = void 0; + break; + default: + return; + } + } catch (e3) { + f2 = { value: e3, [i]: 0 }; + } + Promise.resolve(f2).catch((e3) => ({ value: e3, [i]: 0 })).then((n3) => { + const [i2, a3] = y(n3); + t2.postMessage(Object.assign(Object.assign({}, i2), { id: l2 }), a3), "RELEASE" === u2 && (t2.removeEventListener("message", s2), c(t2), r in e2 && "function" == typeof e2[r] && e2[r]()); + }).catch((e3) => { + const [n3, r2] = y({ value: new TypeError("Unserializable return value"), [i]: 0 }); + t2.postMessage(Object.assign(Object.assign({}, n3), { id: l2 }), r2); + }); + }), t2.start && t2.start(); +} +function c(e2) { + (function(e3) { + return "MessagePort" === e3.constructor.name; + })(e2) && e2.close(); +} +function l(e2, t2) { + return d(e2, [], t2); +} +function u(e2) { + if (e2) + throw new Error("Proxy has been released and is not useable"); +} +function p(e2) { + return v(e2, { type: "RELEASE" }).then(() => { + c(e2); + }); +} +var h = /* @__PURE__ */ new WeakMap(); +var f = "FinalizationRegistry" in globalThis && new FinalizationRegistry((e2) => { + const t2 = (h.get(e2) || 0) - 1; + h.set(e2, t2), 0 === t2 && p(e2); +}); +function d(e2, r2 = [], i2 = function() { +}) { + let s2 = false; + const a2 = new Proxy(i2, { get(t2, i3) { + if (u(s2), i3 === n) + return () => { + !function(e3) { + f && f.unregister(e3); + }(a2), p(e2), s2 = true; + }; + if ("then" === i3) { + if (0 === r2.length) + return { then: () => a2 }; + const t3 = v(e2, { type: "GET", path: r2.map((e3) => e3.toString()) }).then(E); + return t3.then.bind(t3); + } + return d(e2, [...r2, i3]); + }, set(t2, n2, i3) { + u(s2); + const [a3, o2] = y(i3); + return v(e2, { type: "SET", path: [...r2, n2].map((e3) => e3.toString()), value: a3 }, o2).then(E); + }, apply(n2, i3, a3) { + u(s2); + const o2 = r2[r2.length - 1]; + if (o2 === t) + return v(e2, { type: "ENDPOINT" }).then(E); + if ("bind" === o2) + return d(e2, r2.slice(0, -1)); + const [c2, l2] = m(a3); + return v(e2, { type: "APPLY", path: r2.map((e3) => e3.toString()), argumentList: c2 }, l2).then(E); + }, construct(t2, n2) { + u(s2); + const [i3, a3] = m(n2); + return v(e2, { type: "CONSTRUCT", path: r2.map((e3) => e3.toString()), argumentList: i3 }, a3).then(E); + } }); + return function(e3, t2) { + const n2 = (h.get(t2) || 0) + 1; + h.set(t2, n2), f && f.register(e3, t2, e3); + }(a2, e2), a2; +} +function m(e2) { + const t2 = e2.map(y); + return [t2.map((e3) => e3[0]), (n2 = t2.map((e3) => e3[1]), Array.prototype.concat.apply([], n2))]; + var n2; +} +var g = /* @__PURE__ */ new WeakMap(); +function w(t2) { + return Object.assign(t2, { [e]: true }); +} +function y(e2) { + for (const [t2, n2] of a) + if (n2.canHandle(e2)) { + const [r2, i2] = n2.serialize(e2); + return [{ type: "HANDLER", name: t2, value: r2 }, i2]; + } + return [{ type: "RAW", value: e2 }, g.get(e2) || []]; +} +function E(e2) { + switch (e2.type) { + case "HANDLER": + return a.get(e2.name).deserialize(e2.value); + case "RAW": + return e2.value; + } +} +function v(e2, t2, n2) { + return new Promise((r2) => { + const i2 = new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-"); + e2.addEventListener("message", function t3(n3) { + n3.data && n3.data.id && n3.data.id === i2 && (e2.removeEventListener("message", t3), r2(n3.data)); + }), e2.start && e2.start(), e2.postMessage(Object.assign({ id: i2 }, t2), n2); + }); +} +var b = class { + constructor(e2, t2, n2, r2, i2) { + this._name = e2, this._size = t2, this._path = n2, this._lastModified = r2, this._archiveRef = i2; + } + get name() { + return this._name; + } + get size() { + return this._size; + } + get lastModified() { + return this._lastModified; + } + extract() { + return this._archiveRef.extractSingleFile(this._path); + } +}; +function R(e2) { + if (e2 instanceof File || e2 instanceof b || null === e2) + return e2; + const t2 = {}; + for (const n2 of Object.keys(e2)) + t2[n2] = R(e2[n2]); + return t2; +} +function S(e2, t2 = "") { + const n2 = []; + for (const r2 of Object.keys(e2)) + e2[r2] instanceof File || e2[r2] instanceof b || null === e2[r2] ? n2.push({ file: e2[r2] || r2, path: t2 }) : n2.push(...S(e2[r2], `${t2}${r2}/`)); + return n2; +} +function A(e2, t2) { + const n2 = t2.split("/"); + "" === n2[n2.length - 1] && n2.pop(); + let r2 = e2, i2 = null; + for (const e3 of n2) + r2[e3] = r2[e3] || {}, i2 = r2, r2 = r2[e3]; + return [i2, n2[n2.length - 1]]; +} +var _ = class { + constructor(e2, t2, n2) { + this._content = {}, this._processed = 0, this.file = e2, this.client = t2, this.worker = n2; + } + open() { + return this._content = {}, this._processed = 0, new Promise((e2, t2) => { + this.client.open(this.file, w(() => { + e2(this); + })); + }); + } + async close() { + var e2; + null === (e2 = this.worker) || void 0 === e2 || e2.terminate(), this.worker = null, this.client = null, this.file = null; + } + async hasEncryptedData() { + return await this.client.hasEncryptedData(); + } + async usePassword(e2) { + await this.client.usePassword(e2); + } + async setLocale(e2) { + await this.client.setLocale(e2); + } + async getFilesObject() { + if (this._processed > 0) + return Promise.resolve().then(() => this._content); + return (await this.client.listFiles()).forEach((e2) => { + const [t2, n2] = A(this._content, e2.path); + "FILE" === e2.type && (t2[n2] = new b(e2.fileName, e2.size, e2.path, e2.lastModified, this)); + }), this._processed = 1, R(this._content); + } + getFilesArray() { + return this.getFilesObject().then((e2) => S(e2)); + } + async extractSingleFile(e2) { + if (null === this.worker) + throw new Error("Archive already closed"); + const t2 = await this.client.extractSingleFile(e2); + return new File([t2.fileData], t2.fileName, { type: "application/octet-stream", lastModified: t2.lastModified / 1e6 }); + } + async extractFiles(e2 = void 0) { + var t2; + if (this._processed > 1) + return Promise.resolve().then(() => this._content); + return (await this.client.extractFiles()).forEach((t3) => { + const [n2, r2] = A(this._content, t3.path); + "FILE" === t3.type && (n2[r2] = new File([t3.fileData], t3.fileName, { type: "application/octet-stream" }), void 0 !== e2 && setTimeout(e2.bind(null, { file: n2[r2], path: t3.path }))); + }), this._processed = 2, null === (t2 = this.worker) || void 0 === t2 || t2.terminate(), R(this._content); + } +}; +var P; +var k; +!function(e2) { + e2.SEVEN_ZIP = "7zip", e2.AR = "ar", e2.ARBSD = "arbsd", e2.ARGNU = "argnu", e2.ARSVR4 = "arsvr4", e2.BIN = "bin", e2.BSDTAR = "bsdtar", e2.CD9660 = "cd9660", e2.CPIO = "cpio", e2.GNUTAR = "gnutar", e2.ISO = "iso", e2.ISO9660 = "iso9660", e2.MTREE = "mtree", e2.MTREE_CLASSIC = "mtree-classic", e2.NEWC = "newc", e2.ODC = "odc", e2.OLDTAR = "oldtar", e2.PAX = "pax", e2.PAXR = "paxr", e2.POSIX = "posix", e2.PWB = "pwb", e2.RAW = "raw", e2.RPAX = "rpax", e2.SHAR = "shar", e2.SHARDUMP = "shardump", e2.USTAR = "ustar", e2.V7TAR = "v7tar", e2.V7 = "v7", e2.WARC = "warc", e2.XAR = "xar", e2.ZIP = "zip"; +}(P || (P = {})), function(e2) { + e2.B64ENCODE = "b64encode", e2.BZIP2 = "bzip2", e2.COMPRESS = "compress", e2.GRZIP = "grzip", e2.GZIP = "gzip", e2.LRZIP = "lrzip", e2.LZ4 = "lz4", e2.LZIP = "lzip", e2.LZMA = "lzma", e2.LZOP = "lzop", e2.UUENCODE = "uuencode", e2.XZ = "xz", e2.ZSTD = "zstd", e2.NONE = "none"; +}(k || (k = {})); +var O = class _O { + static init(e2 = null) { + return _O._options = e2 || {}, _O._options; + } + static async open(e2) { + const t2 = _O.getWorker(_O._options), n2 = await _O.getClient(t2, _O._options), r2 = new _(e2, n2, t2); + return await r2.open(); + } + static async write({ files: e2, outputFileName: t2, compression: n2, format: r2, passphrase: i2 = null }) { + const s2 = _O.getWorker(_O._options), a2 = await _O.getClient(s2, _O._options), o2 = await a2.writeArchive(e2, n2, r2, i2); + return s2.terminate(), new File([o2], t2, { type: "application/octet-stream" }); + } + static getWorker(e2) { + return e2.getWorker ? e2.getWorker() : new Worker(e2.workerUrl || new URL("./worker-bundle.js", import.meta.url), { type: "module" }); + } + static async getClient(e2, t2) { + var n2; + const r2 = (null === (n2 = t2.createClient) || void 0 === n2 ? void 0 : n2.call(t2, e2)) || l(e2); + let { promise: i2, resolve: s2 } = Promise.withResolvers(); + const a2 = await new r2(w(() => { + s2(); + })); + return await i2, a2; + } +}; +O._options = {}; + +// index.js +window.Archive = O; +document.getElementById("file").addEventListener("change", async (e2) => { + let obj = null; + try { + const file = e2.currentTarget.files[0]; + const archive = await O.open(file); + console.log(await archive.getFilesObject()); + obj = await archive.extractFiles(); + console.log(await archive.getFilesObject()); + } catch (err) { + console.error(err); + } +}); +/*! Bundled license information: + +libarchive.js/dist/libarchive.js: + (** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + *) +*/ diff --git a/examples/esbuild/dist/libarchive-node.mjs b/examples/esbuild/dist/libarchive-node.mjs new file mode 100644 index 0000000..e6d24c6 --- /dev/null +++ b/examples/esbuild/dist/libarchive-node.mjs @@ -0,0 +1,12 @@ +import{Worker as e}from"worker_threads";import{URL as t}from"url"; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const n=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),s=Symbol("Comlink.releaseProxy"),i=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),o=e=>"object"==typeof e&&null!==e||"function"==typeof e,c=new Map([["proxy",{canHandle:e=>o(e)&&e[n],serialize(e){const{port1:t,port2:n}=new MessageChannel;return l(e,t),[n,[n]]},deserialize:e=>(e.start(),p(e))}],["throw",{canHandle:e=>o(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function l(e,t=globalThis,n=["*"]){t.addEventListener("message",(function r(s){if(!s||!s.data)return;if(!function(e,t){for(const n of e){if(t===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}return!1}(n,s.origin))return void console.warn(`Invalid origin '${s.origin}' for comlink proxy`);const{id:o,type:c,path:p}=Object.assign({path:[]},s.data),h=(s.data.argumentList||[]).map(b);let f;try{const t=p.slice(0,-1).reduce(((e,t)=>e[t]),e),n=p.reduce(((e,t)=>e[t]),e);switch(c){case"GET":f=n;break;case"SET":t[p.slice(-1)[0]]=b(s.data.value),f=!0;break;case"APPLY":f=n.apply(t,h);break;case"CONSTRUCT":f=y(new n(...h));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;l(e,n),f=function(e,t){return v.set(e,t),e}(t,[t])}break;case"RELEASE":f=void 0;break;default:return}}catch(e){f={value:e,[a]:0}}Promise.resolve(f).catch((e=>({value:e,[a]:0}))).then((n=>{const[s,a]=E(n);t.postMessage(Object.assign(Object.assign({},s),{id:o}),a),"RELEASE"===c&&(t.removeEventListener("message",r),u(t),i in e&&"function"==typeof e[i]&&e[i]())})).catch((e=>{const[n,r]=E({value:new TypeError("Unserializable return value"),[a]:0});t.postMessage(Object.assign(Object.assign({},n),{id:o}),r)}))})),t.start&&t.start()}function u(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function p(e,t){return g(e,[],t)}function h(e){if(e)throw new Error("Proxy has been released and is not useable")}function f(e){return R(e,{type:"RELEASE"}).then((()=>{u(e)}))}const d=new WeakMap,m="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(d.get(e)||0)-1;d.set(e,t),0===t&&f(e)}));function g(e,t=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(n,r){if(h(i),r===s)return()=>{!function(e){m&&m.unregister(e)}(a),f(e),i=!0};if("then"===r){if(0===t.length)return{then:()=>a};const n=R(e,{type:"GET",path:t.map((e=>e.toString()))}).then(b);return n.then.bind(n)}return g(e,[...t,r])},set(n,r,s){h(i);const[a,o]=E(s);return R(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:a},o).then(b)},apply(n,s,a){h(i);const o=t[t.length-1];if(o===r)return R(e,{type:"ENDPOINT"}).then(b);if("bind"===o)return g(e,t.slice(0,-1));const[c,l]=w(a);return R(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:c},l).then(b)},construct(n,r){h(i);const[s,a]=w(r);return R(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:s},a).then(b)}});return function(e,t){const n=(d.get(t)||0)+1;d.set(t,n),m&&m.register(e,t,e)}(a,e),a}function w(e){const t=e.map(E);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const v=new WeakMap;function y(e){return Object.assign(e,{[n]:!0})}function E(e){for(const[t,n]of c)if(n.canHandle(e)){const[r,s]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},s]}return[{type:"RAW",value:e},v.get(e)||[]]}function b(e){switch(e.type){case"HANDLER":return c.get(e.name).deserialize(e.value);case"RAW":return e.value}}function R(e,t,n){return new Promise((r=>{const s=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===s&&(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),n)}))}class k{constructor(e,t,n,r,s){this._name=e,this._size=t,this._path=n,this._lastModified=r,this._archiveRef=s}get name(){return this._name}get size(){return this._size}get lastModified(){return this._lastModified}extract(){return this._archiveRef.extractSingleFile(this._path)}}function P(e){if(e instanceof File||e instanceof k||null===e)return e;const t={};for(const n of Object.keys(e))t[n]=P(e[n]);return t}function S(e,t=""){const n=[];for(const r of Object.keys(e))e[r]instanceof File||e[r]instanceof k||null===e[r]?n.push({file:e[r]||r,path:t}):n.push(...S(e[r],`${t}${r}/`));return n}function _(e,t){const n=t.split("/");""===n[n.length-1]&&n.pop();let r=e,s=null;for(const e of n)r[e]=r[e]||{},s=r,r=r[e];return[s,n[n.length-1]]}class A{constructor(e,t,n){this._content={},this._processed=0,this.file=e,this.client=t,this.worker=n}open(){return this._content={},this._processed=0,new Promise(((e,t)=>{this.client.open(this.file,y((()=>{e(this)})))}))}async close(){var e;null===(e=this.worker)||void 0===e||e.terminate(),this.worker=null,this.client=null,this.file=null}async hasEncryptedData(){return await this.client.hasEncryptedData()}async usePassword(e){await this.client.usePassword(e)}async setLocale(e){await this.client.setLocale(e)}async getFilesObject(){if(this._processed>0)return Promise.resolve().then((()=>this._content));return(await this.client.listFiles()).forEach((e=>{const[t,n]=_(this._content,e.path);"FILE"===e.type&&(t[n]=new k(e.fileName,e.size,e.path,e.lastModified,this))})),this._processed=1,P(this._content)}getFilesArray(){return this.getFilesObject().then((e=>S(e)))}async extractSingleFile(e){if(null===this.worker)throw new Error("Archive already closed");const t=await this.client.extractSingleFile(e);return new File([t.fileData],t.fileName,{type:"application/octet-stream",lastModified:t.lastModified/1e6})}async extractFiles(e=void 0){var t;if(this._processed>1)return Promise.resolve().then((()=>this._content));return(await this.client.extractFiles()).forEach((t=>{const[n,r]=_(this._content,t.path);"FILE"===t.type&&(n[r]=new File([t.fileData],t.fileName,{type:"application/octet-stream"}),void 0!==e&&setTimeout(e.bind(null,{file:n[r],path:t.path})))})),this._processed=2,null===(t=this.worker)||void 0===t||t.terminate(),P(this._content)}}var L,O;!function(e){e.SEVEN_ZIP="7zip",e.AR="ar",e.ARBSD="arbsd",e.ARGNU="argnu",e.ARSVR4="arsvr4",e.BIN="bin",e.BSDTAR="bsdtar",e.CD9660="cd9660",e.CPIO="cpio",e.GNUTAR="gnutar",e.ISO="iso",e.ISO9660="iso9660",e.MTREE="mtree",e.MTREE_CLASSIC="mtree-classic",e.NEWC="newc",e.ODC="odc",e.OLDTAR="oldtar",e.PAX="pax",e.PAXR="paxr",e.POSIX="posix",e.PWB="pwb",e.RAW="raw",e.RPAX="rpax",e.SHAR="shar",e.SHARDUMP="shardump",e.USTAR="ustar",e.V7TAR="v7tar",e.V7="v7",e.WARC="warc",e.XAR="xar",e.ZIP="zip"}(L||(L={})),function(e){e.B64ENCODE="b64encode",e.BZIP2="bzip2",e.COMPRESS="compress",e.GRZIP="grzip",e.GZIP="gzip",e.LRZIP="lrzip",e.LZ4="lz4",e.LZIP="lzip",e.LZMA="lzma",e.LZOP="lzop",e.UUENCODE="uuencode",e.XZ="xz",e.ZSTD="zstd",e.NONE="none"}(O||(O={}));class z{static init(e=null){return z._options=e||{},z._options}static async open(e){const t=z.getWorker(z._options),n=await z.getClient(t,z._options),r=new A(e,n,t);return await r.open()}static async write({files:e,outputFileName:t,compression:n,format:r,passphrase:s=null}){const i=z.getWorker(z._options),a=await z.getClient(i,z._options),o=await a.writeArchive(e,n,r,s);return i.terminate(),new File([o],t,{type:"application/octet-stream"})}static getWorker(e){return e.getWorker?e.getWorker():new Worker(e.workerUrl||new URL("./worker-bundle.js",import.meta.url),{type:"module"})}static async getClient(e,t){var n;const r=(null===(n=t.createClient)||void 0===n?void 0:n.call(t,e))||p(e);let{promise:s,resolve:i}=Promise.withResolvers();const a=await new r(y((()=>{i()})));return await s,a}}z._options={},Promise.withResolvers||(Promise.withResolvers=function(){var e,t,n=new this((function(n,r){e=n,t=r}));return{resolve:e,reject:t,promise:n}});const C=new t(".",import.meta.url).pathname;z.init({getWorker:()=>new e(`${C}/worker-bundle-node.mjs`),createClient:e=>p( +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +function(e){const t=new WeakMap;return{postMessage:e.postMessage.bind(e),addEventListener:(n,r)=>{const s=e=>{"handleEvent"in r?r.handleEvent({data:e}):r({data:e})};e.on("message",s),t.set(r,s)},removeEventListener:(n,r)=>{const s=t.get(r);s&&(e.off("message",s),t.delete(r))},start:e.start&&e.start.bind(e)}}(e))});export{z as Archive,O as ArchiveCompression,L as ArchiveFormat}; diff --git a/examples/esbuild/dist/libarchive.js b/examples/esbuild/dist/libarchive.js new file mode 100644 index 0000000..24adb8e --- /dev/null +++ b/examples/esbuild/dist/libarchive.js @@ -0,0 +1,6 @@ +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +const e=Symbol("Comlink.proxy"),t=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),r=Symbol("Comlink.finalizer"),i=Symbol("Comlink.thrown"),s=e=>"object"==typeof e&&null!==e||"function"==typeof e,a=new Map([["proxy",{canHandle:t=>s(t)&&t[e],serialize(e){const{port1:t,port2:n}=new MessageChannel;return o(e,t),[n,[n]]},deserialize:e=>(e.start(),l(e))}],["throw",{canHandle:e=>s(e)&&i in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function o(e,t=globalThis,n=["*"]){t.addEventListener("message",(function s(a){if(!a||!a.data)return;if(!function(e,t){for(const n of e){if(t===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin '${a.origin}' for comlink proxy`);const{id:l,type:u,path:p}=Object.assign({path:[]},a.data),h=(a.data.argumentList||[]).map(E);let f;try{const t=p.slice(0,-1).reduce(((e,t)=>e[t]),e),n=p.reduce(((e,t)=>e[t]),e);switch(u){case"GET":f=n;break;case"SET":t[p.slice(-1)[0]]=E(a.data.value),f=!0;break;case"APPLY":f=n.apply(t,h);break;case"CONSTRUCT":f=w(new n(...h));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;o(e,n),f=function(e,t){return g.set(e,t),e}(t,[t])}break;case"RELEASE":f=void 0;break;default:return}}catch(e){f={value:e,[i]:0}}Promise.resolve(f).catch((e=>({value:e,[i]:0}))).then((n=>{const[i,a]=y(n);t.postMessage(Object.assign(Object.assign({},i),{id:l}),a),"RELEASE"===u&&(t.removeEventListener("message",s),c(t),r in e&&"function"==typeof e[r]&&e[r]())})).catch((e=>{const[n,r]=y({value:new TypeError("Unserializable return value"),[i]:0});t.postMessage(Object.assign(Object.assign({},n),{id:l}),r)}))})),t.start&&t.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function l(e,t){return d(e,[],t)}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function p(e){return v(e,{type:"RELEASE"}).then((()=>{c(e)}))}const h=new WeakMap,f="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(h.get(e)||0)-1;h.set(e,t),0===t&&p(e)}));function d(e,r=[],i=function(){}){let s=!1;const a=new Proxy(i,{get(t,i){if(u(s),i===n)return()=>{!function(e){f&&f.unregister(e)}(a),p(e),s=!0};if("then"===i){if(0===r.length)return{then:()=>a};const t=v(e,{type:"GET",path:r.map((e=>e.toString()))}).then(E);return t.then.bind(t)}return d(e,[...r,i])},set(t,n,i){u(s);const[a,o]=y(i);return v(e,{type:"SET",path:[...r,n].map((e=>e.toString())),value:a},o).then(E)},apply(n,i,a){u(s);const o=r[r.length-1];if(o===t)return v(e,{type:"ENDPOINT"}).then(E);if("bind"===o)return d(e,r.slice(0,-1));const[c,l]=m(a);return v(e,{type:"APPLY",path:r.map((e=>e.toString())),argumentList:c},l).then(E)},construct(t,n){u(s);const[i,a]=m(n);return v(e,{type:"CONSTRUCT",path:r.map((e=>e.toString())),argumentList:i},a).then(E)}});return function(e,t){const n=(h.get(t)||0)+1;h.set(t,n),f&&f.register(e,t,e)}(a,e),a}function m(e){const t=e.map(y);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const g=new WeakMap;function w(t){return Object.assign(t,{[e]:!0})}function y(e){for(const[t,n]of a)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},g.get(e)||[]]}function E(e){switch(e.type){case"HANDLER":return a.get(e.name).deserialize(e.value);case"RAW":return e.value}}function v(e,t,n){return new Promise((r=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===i&&(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)}))}class b{constructor(e,t,n,r,i){this._name=e,this._size=t,this._path=n,this._lastModified=r,this._archiveRef=i}get name(){return this._name}get size(){return this._size}get lastModified(){return this._lastModified}extract(){return this._archiveRef.extractSingleFile(this._path)}}function R(e){if(e instanceof File||e instanceof b||null===e)return e;const t={};for(const n of Object.keys(e))t[n]=R(e[n]);return t}function S(e,t=""){const n=[];for(const r of Object.keys(e))e[r]instanceof File||e[r]instanceof b||null===e[r]?n.push({file:e[r]||r,path:t}):n.push(...S(e[r],`${t}${r}/`));return n}function A(e,t){const n=t.split("/");""===n[n.length-1]&&n.pop();let r=e,i=null;for(const e of n)r[e]=r[e]||{},i=r,r=r[e];return[i,n[n.length-1]]}class _{constructor(e,t,n){this._content={},this._processed=0,this.file=e,this.client=t,this.worker=n}open(){return this._content={},this._processed=0,new Promise(((e,t)=>{this.client.open(this.file,w((()=>{e(this)})))}))}async close(){var e;null===(e=this.worker)||void 0===e||e.terminate(),this.worker=null,this.client=null,this.file=null}async hasEncryptedData(){return await this.client.hasEncryptedData()}async usePassword(e){await this.client.usePassword(e)}async setLocale(e){await this.client.setLocale(e)}async getFilesObject(){if(this._processed>0)return Promise.resolve().then((()=>this._content));return(await this.client.listFiles()).forEach((e=>{const[t,n]=A(this._content,e.path);"FILE"===e.type&&(t[n]=new b(e.fileName,e.size,e.path,e.lastModified,this))})),this._processed=1,R(this._content)}getFilesArray(){return this.getFilesObject().then((e=>S(e)))}async extractSingleFile(e){if(null===this.worker)throw new Error("Archive already closed");const t=await this.client.extractSingleFile(e);return new File([t.fileData],t.fileName,{type:"application/octet-stream",lastModified:t.lastModified/1e6})}async extractFiles(e=void 0){var t;if(this._processed>1)return Promise.resolve().then((()=>this._content));return(await this.client.extractFiles()).forEach((t=>{const[n,r]=A(this._content,t.path);"FILE"===t.type&&(n[r]=new File([t.fileData],t.fileName,{type:"application/octet-stream"}),void 0!==e&&setTimeout(e.bind(null,{file:n[r],path:t.path})))})),this._processed=2,null===(t=this.worker)||void 0===t||t.terminate(),R(this._content)}}var P,k;!function(e){e.SEVEN_ZIP="7zip",e.AR="ar",e.ARBSD="arbsd",e.ARGNU="argnu",e.ARSVR4="arsvr4",e.BIN="bin",e.BSDTAR="bsdtar",e.CD9660="cd9660",e.CPIO="cpio",e.GNUTAR="gnutar",e.ISO="iso",e.ISO9660="iso9660",e.MTREE="mtree",e.MTREE_CLASSIC="mtree-classic",e.NEWC="newc",e.ODC="odc",e.OLDTAR="oldtar",e.PAX="pax",e.PAXR="paxr",e.POSIX="posix",e.PWB="pwb",e.RAW="raw",e.RPAX="rpax",e.SHAR="shar",e.SHARDUMP="shardump",e.USTAR="ustar",e.V7TAR="v7tar",e.V7="v7",e.WARC="warc",e.XAR="xar",e.ZIP="zip"}(P||(P={})),function(e){e.B64ENCODE="b64encode",e.BZIP2="bzip2",e.COMPRESS="compress",e.GRZIP="grzip",e.GZIP="gzip",e.LRZIP="lrzip",e.LZ4="lz4",e.LZIP="lzip",e.LZMA="lzma",e.LZOP="lzop",e.UUENCODE="uuencode",e.XZ="xz",e.ZSTD="zstd",e.NONE="none"}(k||(k={}));class O{static init(e=null){return O._options=e||{},O._options}static async open(e){const t=O.getWorker(O._options),n=await O.getClient(t,O._options),r=new _(e,n,t);return await r.open()}static async write({files:e,outputFileName:t,compression:n,format:r,passphrase:i=null}){const s=O.getWorker(O._options),a=await O.getClient(s,O._options),o=await a.writeArchive(e,n,r,i);return s.terminate(),new File([o],t,{type:"application/octet-stream"})}static getWorker(e){return e.getWorker?e.getWorker():new Worker(e.workerUrl||new URL("./worker-bundle.js",import.meta.url),{type:"module"})}static async getClient(e,t){var n;const r=(null===(n=t.createClient)||void 0===n?void 0:n.call(t,e))||l(e);let{promise:i,resolve:s}=Promise.withResolvers();const a=await new r(w((()=>{s()})));return await i,a}}O._options={};export{O as Archive,k as ArchiveCompression,P as ArchiveFormat}; diff --git a/examples/esbuild/dist/libarchive.wasm b/examples/esbuild/dist/libarchive.wasm new file mode 100644 index 0000000..9b9e93b Binary files /dev/null and b/examples/esbuild/dist/libarchive.wasm differ diff --git a/examples/esbuild/dist/worker-bundle-node.mjs b/examples/esbuild/dist/worker-bundle-node.mjs new file mode 100644 index 0000000..6c25967 --- /dev/null +++ b/examples/esbuild/dist/worker-bundle-node.mjs @@ -0,0 +1,12 @@ +import{parentPort as e}from"worker_threads"; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const r=Symbol("Comlink.proxy"),t=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),o=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),s=e=>"object"==typeof e&&null!==e||"function"==typeof e,i=new Map([["proxy",{canHandle:e=>s(e)&&e[r],serialize(e){const{port1:r,port2:t}=new MessageChannel;return u(e,r),[t,[t]]},deserialize(e){return e.start(),m(e,[],r);var r}}],["throw",{canHandle:e=>s(e)&&a in e,serialize({value:e}){let r;return r=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[r,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function u(e,t=globalThis,n=["*"]){t.addEventListener("message",(function s(i){if(!i||!i.data)return;if(!function(e,r){for(const t of e){if(r===t||"*"===t)return!0;if(t instanceof RegExp&&t.test(r))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:c,type:d,path:h}=Object.assign({path:[]},i.data),f=(i.data.argumentList||[]).map(g);let m;try{const t=h.slice(0,-1).reduce(((e,r)=>e[r]),e),n=h.reduce(((e,r)=>e[r]),e);switch(d){case"GET":m=n;break;case"SET":t[h.slice(-1)[0]]=g(i.data.value),m=!0;break;case"APPLY":m=n.apply(t,f);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[r]:!0})}(new n(...f));break;case"ENDPOINT":{const{port1:r,port2:t}=new MessageChannel;u(e,t),m=function(e,r){return v.set(e,r),e}(r,[r])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch((e=>({value:e,[a]:0}))).then((r=>{const[n,a]=w(r);t.postMessage(Object.assign(Object.assign({},n),{id:c}),a),"RELEASE"===d&&(t.removeEventListener("message",s),l(t),o in e&&"function"==typeof e[o]&&e[o]())})).catch((e=>{const[r,n]=w({value:new TypeError("Unserializable return value"),[a]:0});t.postMessage(Object.assign(Object.assign({},r),{id:c}),n)}))})),t.start&&t.start()}function l(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function c(e){if(e)throw new Error("Proxy has been released and is not useable")}function d(e){return _(e,{type:"RELEASE"}).then((()=>{l(e)}))}const h=new WeakMap,f="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const r=(h.get(e)||0)-1;h.set(e,r),0===r&&d(e)}));function m(e,r=[],o=function(){}){let a=!1;const s=new Proxy(o,{get(t,o){if(c(a),o===n)return()=>{!function(e){f&&f.unregister(e)}(s),d(e),a=!0};if("then"===o){if(0===r.length)return{then:()=>s};const t=_(e,{type:"GET",path:r.map((e=>e.toString()))}).then(g);return t.then.bind(t)}return m(e,[...r,o])},set(t,n,o){c(a);const[s,i]=w(o);return _(e,{type:"SET",path:[...r,n].map((e=>e.toString())),value:s},i).then(g)},apply(n,o,s){c(a);const i=r[r.length-1];if(i===t)return _(e,{type:"ENDPOINT"}).then(g);if("bind"===i)return m(e,r.slice(0,-1));const[u,l]=p(s);return _(e,{type:"APPLY",path:r.map((e=>e.toString())),argumentList:u},l).then(g)},construct(t,n){c(a);const[o,s]=p(n);return _(e,{type:"CONSTRUCT",path:r.map((e=>e.toString())),argumentList:o},s).then(g)}});return function(e,r){const t=(h.get(r)||0)+1;h.set(r,t),f&&f.register(e,r,e)}(s,e),s}function p(e){const r=e.map(w);return[r.map((e=>e[0])),(t=r.map((e=>e[1])),Array.prototype.concat.apply([],t))];var t}const v=new WeakMap;function w(e){for(const[r,t]of i)if(t.canHandle(e)){const[n,o]=t.serialize(e);return[{type:"HANDLER",name:r,value:n},o]}return[{type:"RAW",value:e},v.get(e)||[]]}function g(e){switch(e.type){case"HANDLER":return i.get(e.name).deserialize(e.value);case"RAW":return e.value}}function _(e,r,t){return new Promise((n=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function r(t){t.data&&t.data.id&&t.data.id===o&&(e.removeEventListener("message",r),n(t.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},r),t)}))}const y={32768:"FILE",16384:"DIR",40960:"SYMBOLIC_LINK",49152:"SOCKET",8192:"CHARACTER_DEVICE",24576:"BLOCK_DEVICE",4096:"NAMED_PIPE"};class E{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._file=null,this._passphrase=null,this._locale="en_US.UTF-8"}async open(e){null!==this._file&&(console.warn("Closing previous file"),this.close());const r=await this._loadFile(e);this._fileLength=r.length,this._filePtr=r.ptr}close(){this._runCode.closeArchive(this._archive),this._wasmModule._free(this._filePtr),this._file=null,this._filePtr=null,this._archive=null}hasEncryptedData(){this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale),this._runCode.getNextEntry(this._archive);const e=this._runCode.hasEncryptedEntries(this._archive);return 0!==e&&(e>0||null)}setPassphrase(e){this._passphrase=e}setLocale(e){this._locale=e}*entries(e=!1,r=null){let t;for(this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale);t=this._runCode.getNextEntry(this._archive),0!==t;){const n={size:this._runCode.getEntrySize(t),path:this._runCode.getEntryName(t),type:y[this._runCode.getEntryType(t)],lastModified:this._runCode.getEntryLastModified(t),ref:t};if("FILE"===n.type){let e=n.path.split("/");n.fileName=e[e.length-1]}if(e&&r!==n.path)this._runCode.skipEntry(this._archive);else{const e=this._runCode.getFileData(this._archive,n.size);if(e<0)throw new Error(this._runCode.getError(this._archive));n.fileData=this._wasmModule.HEAPU8.slice(e,e+n.size),this._wasmModule._free(e)}yield n}}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}}class b{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._passphrase=null,this._locale="en_US.UTF-8"}async write(e,r,t,n=null){let o=e.reduce(((e,{file:r})=>e+r.size),0)+512;const a=this._runCode.malloc(o),s=this._runCode.malloc(this._runCode.sizeOfSizeT()),i=this._runCode.startArchiveWrite(r,t,a,o,s,n);for(const{file:r,pathname:t}of e){const e=await this._loadFile(r);this._runCode.writeArchiveFile(i,t||r.name,e.length,e.ptr),this._runCode.free(e.ptr)}const u=this._runCode.closeArchiveWrite(i),l=this._runCode.freeArchiveWrite(i);if(0!==u||0!==l)throw new Error(this._runCode.getError(i));const c=this.readNumberFromPointer(s);return this._wasmModule.HEAPU8.slice(a,a+c)}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}readNumberFromPointer(e){const r=this._runCode.sizeOfSizeT(),t=this._wasmModule.HEAPU8.slice(e,e+r);let n=null;if(4==r)n=new Uint32Array(t)[0];else{if(8!=r)throw Error("Unexpected size of size_t: "+r);n=new BigUint64Array(t)[0]}return n}}var k,S=(k=import.meta.url,async function(e={}){var r,t,n=e;n.ready=new Promise(((e,n)=>{r=e,t=n}));var o,a,s,i=Object.assign({},n),u="./this.program",l=(e,r)=>{throw r},c="object"==typeof window,d="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";if(h){const{createRequire:e}=await import("module");var m=e(import.meta.url),p=m("fs"),v=m("path");f=d?v.dirname(f)+"/":m("url").fileURLToPath(new URL("./",import.meta.url)),o=(e,r)=>(e=Y(e)?new URL(e):v.normalize(e),p.readFileSync(e,r?void 0:"utf8")),s=e=>{var r=o(e,!0);return r.buffer||(r=new Uint8Array(r)),r},a=(e,r,t,n=!0)=>{e=Y(e)?new URL(e):v.normalize(e),p.readFile(e,n?void 0:"utf8",((e,o)=>{e?t(e):r(n?o.buffer:o)}))},!n.thisProgram&&process.argv.length>1&&(u=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),l=(e,r)=>{throw process.exitCode=e,r},n.inspect=()=>"[Emscripten Module object]"}else(c||d)&&(d?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),k&&(f=k),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},d&&(s=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),a=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?r(n.response):t()},n.onerror=t,n.send(null)});var w,g,_=n.print||console.log.bind(console),y=n.printErr||console.error.bind(console);Object.assign(n,i),i=null,n.arguments&&n.arguments,n.thisProgram&&(u=n.thisProgram),n.quit&&(l=n.quit),n.wasmBinary&&(w=n.wasmBinary),"object"!=typeof WebAssembly&&O("no native wasm support detected");var E,b,S,F,D,M=!1;function A(e,r){e||O(r)}function C(){var e=g.buffer;n.HEAP8=E=new Int8Array(e),n.HEAP16=S=new Int16Array(e),n.HEAPU8=b=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAP32=F=new Int32Array(e),n.HEAPU32=D=new Uint32Array(e),n.HEAPF32=new Float32Array(e),n.HEAPF64=new Float64Array(e)}var P=[],T=[],R=[],U=0,z=null;function L(e){U++,n.monitorRunDependencies?.(U)}function x(e){if(U--,n.monitorRunDependencies?.(U),0==U&&z){var r=z;z=null,r()}}function O(e){n.onAbort?.(e),y(e="Aborted("+e+")"),M=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw t(r),r}var N,B,j,I,H=e=>e.startsWith("data:application/octet-stream;base64,"),Y=e=>e.startsWith("file://");function W(e){if(e==N&&w)return new Uint8Array(w);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}function K(e,r,t){return function(e){if(!w&&(c||d)){if("function"==typeof fetch&&!Y(e))return fetch(e,{credentials:"same-origin"}).then((r=>{if(!r.ok)throw"failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()})).catch((()=>W(e)));if(a)return new Promise(((r,t)=>{a(e,(e=>r(new Uint8Array(e))),t)}))}return Promise.resolve().then((()=>W(e)))}(e).then((e=>WebAssembly.instantiate(e,r))).then((e=>e)).then(t,(e=>{y(`failed to asynchronously prepare wasm: ${e}`),O(e)}))}function $(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}n.locateFile?H(N="libarchive.wasm")||(B=N,N=n.locateFile?n.locateFile(B,f):f+B):N=new URL("libarchive.wasm",import.meta.url).href;var q=e=>{for(;e.length>0;)e.shift()(n)},X=n.noExitRuntime||!0,Z={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=Z.isAbs(e),t="/"===e.substr(-1);return(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=Z.splitPath(e),t=r[0],n=r[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:e=>{if("/"===e)return"/";var r=(e=(e=Z.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===r?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments);return Z.normalize(e.join("/"))},join2:(e,r)=>Z.normalize(e+"/"+r)},G=e=>(G=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return r=>e.randomFillSync(r);var r=e.randomBytes;return e=>(e.set(r(e.byteLength)),e)}catch(e){}O("initRandomDevice")})())(e),V={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:le.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=Z.isAbs(n)}return(r?"/":"")+(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,r)=>{function t(e){for(var r=0;r=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=V.resolve(e).substr(1),r=V.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.split("/")),a=Math.min(n.length,o.length),s=a,i=0;i{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&J)return J.decode(e.subarray(r,o));for(var a="";r>10,56320|1023&l)}}else a+=String.fromCharCode((31&s)<<6|i)}else a+=String.fromCharCode(s)}return a},ee=[],re=e=>{for(var r=0,t=0;t=55296&&n<=57343?(r+=4,++t):r+=3}return r},te=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,s=0;s=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++s)),i<=127){if(t>=a)break;r[t++]=i}else if(i<=2047){if(t+1>=a)break;r[t++]=192|i>>6,r[t++]=128|63&i}else if(i<=65535){if(t+2>=a)break;r[t++]=224|i>>12,r[t++]=128|i>>6&63,r[t++]=128|63&i}else{if(t+3>=a)break;r[t++]=240|i>>18,r[t++]=128|i>>12&63,r[t++]=128|i>>6&63,r[t++]=128|63&i}}return r[t]=0,t-o};function ne(e,r,t){var n=t>0?t:re(e)+1,o=new Array(n),a=te(e,o,0,o.length);return r&&(o.length=a),o}var oe={ttys:[],init(){},shutdown(){},register(e,r){oe.ttys[e]={input:[],output:[],ops:r},le.registerDevice(e,oe.stream_ops)},stream_ops:{open(e){var r=oe.ttys[e.node.rdev];if(!r)throw new le.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new le.ErrnoError(60);for(var a=0,s=0;s(()=>{if(!ee.length){var e=null;if(h){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=p.readSync(n,r)}catch(e){if(!e.toString().includes("EOF"))throw e;t=0}e=t>0?r.slice(0,t).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;ee=ne(e,!0)}return ee.shift()})(),put_char(e,r){null===r||10===r?(_(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(_(Q(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,r,t)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,r){null===r||10===r?(y(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(y(Q(e.output,0)),e.output=[])}}},ae=e=>{O()},se={ops_table:null,mount:e=>se.createNode(null,"/",16895,0),createNode(e,r,t,n){if(le.isBlkdev(t)||le.isFIFO(t))throw new le.ErrnoError(63);se.ops_table||={dir:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,lookup:se.node_ops.lookup,mknod:se.node_ops.mknod,rename:se.node_ops.rename,unlink:se.node_ops.unlink,rmdir:se.node_ops.rmdir,readdir:se.node_ops.readdir,symlink:se.node_ops.symlink},stream:{llseek:se.stream_ops.llseek}},file:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:{llseek:se.stream_ops.llseek,read:se.stream_ops.read,write:se.stream_ops.write,allocate:se.stream_ops.allocate,mmap:se.stream_ops.mmap,msync:se.stream_ops.msync}},link:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,readlink:se.node_ops.readlink},stream:{}},chrdev:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:le.chrdev_stream_ops}};var o=le.createNode(e,r,t,n);return le.isDir(o.mode)?(o.node_ops=se.ops_table.dir.node,o.stream_ops=se.ops_table.dir.stream,o.contents={}):le.isFile(o.mode)?(o.node_ops=se.ops_table.file.node,o.stream_ops=se.ops_table.file.stream,o.usedBytes=0,o.contents=null):le.isLink(o.mode)?(o.node_ops=se.ops_table.link.node,o.stream_ops=se.ops_table.link.stream):le.isChrdev(o.mode)&&(o.node_ops=se.ops_table.chrdev.node,o.stream_ops=se.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){r=Math.max(r,t*(t<1048576?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var n=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(0==r)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=le.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,le.isDir(e.mode)?r.size=4096:le.isFile(e.mode)?r.size=e.usedBytes:le.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp),void 0!==r.size&&se.resizeFileStorage(e,r.size)},lookup(e,r){throw le.genericErrors[44]},mknod:(e,r,t,n)=>se.createNode(e,r,t,n),rename(e,r,t){if(le.isDir(e.mode)){var n;try{n=le.lookupNode(r,t)}catch(e){}if(n)for(var o in n.contents)throw new le.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp,e.parent=r},unlink(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=le.lookupNode(e,r);for(var n in t.contents)throw new le.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=se.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!le.isLink(e.mode))throw new le.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-o,n);if(s>8&&a.subarray)r.set(a.subarray(o,o+s),t);else for(var i=0;i0||t+r(se.stream_ops.write(e,r,0,n,t,!1),0)}},ie=n.preloadPlugins||[],ue=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},le={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e,r={}){if(!(e=V.resolve(e)))return{path:"",node:null};if((r=Object.assign({follow_mount:!0,recurse_count:0},r)).recurse_count>8)throw new le.ErrnoError(32);for(var t=e.split("/").filter((e=>!!e)),n=le.root,o="/",a=0;a40)throw new le.ErrnoError(32)}}return{path:o,node:n}},getPath(e){for(var r;;){if(le.isRoot(e)){var t=e.mount.mountpoint;return r?"/"!==t[t.length-1]?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n>>0)%le.nameTable.length},hashAddNode(e){var r=le.hashName(e.parent.id,e.name);e.name_next=le.nameTable[r],le.nameTable[r]=e},hashRemoveNode(e){var r=le.hashName(e.parent.id,e.name);if(le.nameTable[r]===e)le.nameTable[r]=e.name_next;else for(var t=le.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=le.mayLookup(e);if(t)throw new le.ErrnoError(t,e);for(var n=le.hashName(e.id,r),o=le.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===r)return o}return le.lookup(e,r)},createNode(e,r,t,n){var o=new le.FSNode(e,r,t,n);return le.hashAddNode(o),o},destroyNode(e){le.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>le.ignorePermissions||(!r.includes("r")||292&e.mode)&&(!r.includes("w")||146&e.mode)&&(!r.includes("x")||73&e.mode)?0:2,mayLookup(e){var r=le.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{return le.lookupNode(e,r),20}catch(e){}return le.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=le.lookupNode(e,r)}catch(e){return e.errno}var o=le.nodePermissions(e,"wx");if(o)return o;if(t){if(!le.isDir(n.mode))return 54;if(le.isRoot(n)||le.getPath(n)===le.cwd())return 10}else if(le.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?le.isLink(e.mode)?32:le.isDir(e.mode)&&("r"!==le.flagsToPermissionString(r)||512&r)?31:le.nodePermissions(e,le.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=le.MAX_OPEN_FDS;e++)if(!le.streams[e])return e;throw new le.ErrnoError(33)},getStreamChecked(e){var r=le.getStream(e);if(!r)throw new le.ErrnoError(8);return r},getStream:e=>le.streams[e],createStream:(e,r=-1)=>(le.FSStream||(le.FSStream=function(){this.shared={}},le.FSStream.prototype={},Object.defineProperties(le.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new le.FSStream,e),-1==r&&(r=le.nextfd()),e.fd=r,le.streams[r]=e,e),closeStream(e){le.streams[e]=null},chrdev_stream_ops:{open(e){var r=le.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new le.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice(e,r){le.devices[e]={stream_ops:r}},getDevice:e=>le.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs(e,r){"function"==typeof e&&(r=e,e=!1),le.syncFSRequests++,le.syncFSRequests>1&&y(`warning: ${le.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=le.getMounts(le.root.mount),n=0;function o(e){return le.syncFSRequests--,r(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,o(e));++n>=t.length&&o(null)}t.forEach((r=>{if(!r.type.syncfs)return a(null);r.type.syncfs(r,e,a)}))},mount(e,r,t){var n,o="/"===t,a=!t;if(o&&le.root)throw new le.ErrnoError(10);if(!o&&!a){var s=le.lookupPath(t,{follow_mount:!1});if(t=s.path,n=s.node,le.isMountpoint(n))throw new le.ErrnoError(10);if(!le.isDir(n.mode))throw new le.ErrnoError(54)}var i={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(i);return u.mount=i,i.root=u,o?le.root=u:n&&(n.mounted=i,n.mount&&n.mount.mounts.push(i)),u},unmount(e){var r=le.lookupPath(e,{follow_mount:!1});if(!le.isMountpoint(r.node))throw new le.ErrnoError(28);var t=r.node,n=t.mounted,o=le.getMounts(n);Object.keys(le.nameTable).forEach((e=>{for(var r=le.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&le.destroyNode(r),r=t}})),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod(e,r,t){var n=le.lookupPath(e,{parent:!0}).node,o=Z.basename(e);if(!o||"."===o||".."===o)throw new le.ErrnoError(28);var a=le.mayCreate(n,o);if(a)throw new le.ErrnoError(a);if(!n.node_ops.mknod)throw new le.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:(e,r)=>(r=void 0!==r?r:438,r&=4095,r|=32768,le.mknod(e,r,0)),mkdir:(e,r)=>(r=void 0!==r?r:511,r&=1023,r|=16384,le.mknod(e,r,0)),mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o(void 0===t&&(t=r,r=438),r|=8192,le.mknod(e,r,t)),symlink(e,r){if(!V.resolve(e))throw new le.ErrnoError(44);var t=le.lookupPath(r,{parent:!0}).node;if(!t)throw new le.ErrnoError(44);var n=Z.basename(r),o=le.mayCreate(t,n);if(o)throw new le.ErrnoError(o);if(!t.node_ops.symlink)throw new le.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename(e,r){var t,n,o=Z.dirname(e),a=Z.dirname(r),s=Z.basename(e),i=Z.basename(r);if(t=le.lookupPath(e,{parent:!0}).node,n=le.lookupPath(r,{parent:!0}).node,!t||!n)throw new le.ErrnoError(44);if(t.mount!==n.mount)throw new le.ErrnoError(75);var u,l=le.lookupNode(t,s),c=V.relative(e,a);if("."!==c.charAt(0))throw new le.ErrnoError(28);if("."!==(c=V.relative(r,o)).charAt(0))throw new le.ErrnoError(55);try{u=le.lookupNode(n,i)}catch(e){}if(l!==u){var d=le.isDir(l.mode),h=le.mayDelete(t,s,d);if(h)throw new le.ErrnoError(h);if(h=u?le.mayDelete(n,i,d):le.mayCreate(n,i))throw new le.ErrnoError(h);if(!t.node_ops.rename)throw new le.ErrnoError(63);if(le.isMountpoint(l)||u&&le.isMountpoint(u))throw new le.ErrnoError(10);if(n!==t&&(h=le.nodePermissions(t,"w")))throw new le.ErrnoError(h);le.hashRemoveNode(l);try{t.node_ops.rename(l,n,i)}catch(e){throw e}finally{le.hashAddNode(l)}}},rmdir(e){var r=le.lookupPath(e,{parent:!0}).node,t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!0);if(o)throw new le.ErrnoError(o);if(!r.node_ops.rmdir)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.rmdir(r,t),le.destroyNode(n)},readdir(e){var r=le.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new le.ErrnoError(54);return r.node_ops.readdir(r)},unlink(e){var r=le.lookupPath(e,{parent:!0}).node;if(!r)throw new le.ErrnoError(44);var t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!1);if(o)throw new le.ErrnoError(o);if(!r.node_ops.unlink)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.unlink(r,t),le.destroyNode(n)},readlink(e){var r=le.lookupPath(e).node;if(!r)throw new le.ErrnoError(44);if(!r.node_ops.readlink)throw new le.ErrnoError(28);return V.resolve(le.getPath(r.parent),r.node_ops.readlink(r))},stat(e,r){var t=le.lookupPath(e,{follow:!r}).node;if(!t)throw new le.ErrnoError(44);if(!t.node_ops.getattr)throw new le.ErrnoError(63);return t.node_ops.getattr(t)},lstat:e=>le.stat(e,!0),chmod(e,r,t){var n;if(!(n="string"==typeof e?le.lookupPath(e,{follow:!t}).node:e).node_ops.setattr)throw new le.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod(e,r){le.chmod(e,r,!0)},fchmod(e,r){var t=le.getStreamChecked(e);le.chmod(t.node,r)},chown(e,r,t,n){var o;if(!(o="string"==typeof e?le.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new le.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){le.chown(e,r,t,!0)},fchown(e,r,t){var n=le.getStreamChecked(e);le.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new le.ErrnoError(28);var t;if(!(t="string"==typeof e?le.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new le.ErrnoError(63);if(le.isDir(t.mode))throw new le.ErrnoError(31);if(!le.isFile(t.mode))throw new le.ErrnoError(28);var n=le.nodePermissions(t,"w");if(n)throw new le.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=le.getStreamChecked(e);if(0==(2097155&t.flags))throw new le.ErrnoError(28);le.truncate(t.node,r)},utime(e,r,t){var n=le.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open(e,r,t){if(""===e)throw new le.ErrnoError(44);var o;if(t=void 0===t?438:t,t=64&(r="string"==typeof r?(e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===r)throw new Error(`Unknown file open mode: ${e}`);return r})(r):r)?4095&t|32768:0,"object"==typeof e)o=e;else{e=Z.normalize(e);try{o=le.lookupPath(e,{follow:!(131072&r)}).node}catch(e){}}var a=!1;if(64&r)if(o){if(128&r)throw new le.ErrnoError(20)}else o=le.mknod(e,t,0),a=!0;if(!o)throw new le.ErrnoError(44);if(le.isChrdev(o.mode)&&(r&=-513),65536&r&&!le.isDir(o.mode))throw new le.ErrnoError(54);if(!a){var s=le.mayOpen(o,r);if(s)throw new le.ErrnoError(s)}512&r&&!a&&le.truncate(o,0),r&=-131713;var i=le.createStream({node:o,path:le.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return i.stream_ops.open&&i.stream_ops.open(i),!n.logReadFiles||1&r||(le.readFiles||(le.readFiles={}),e in le.readFiles||(le.readFiles[e]=1)),i},close(e){if(le.isClosed(e))throw new le.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{le.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new le.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new le.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(1==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.read)throw new le.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var s=e.stream_ops.read(e,r,t,n,o);return a||(e.position+=s),s},write(e,r,t,n,o,a){if(n<0||o<0)throw new le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.write)throw new le.ErrnoError(28);e.seekable&&1024&e.flags&&le.llseek(e,0,2);var s=void 0!==o;if(s){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var i=e.stream_ops.write(e,r,t,n,o,a);return s||(e.position+=i),i},allocate(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(r<0||t<=0)throw new le.ErrnoError(28);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(!le.isFile(e.node.mode)&&!le.isDir(e.node.mode))throw new le.ErrnoError(43);if(!e.stream_ops.allocate)throw new le.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if(0!=(2&n)&&0==(2&o)&&2!=(2097155&e.flags))throw new le.ErrnoError(2);if(1==(2097155&e.flags))throw new le.ErrnoError(2);if(!e.stream_ops.mmap)throw new le.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync:(e,r,t,n,o)=>e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0,munmap:e=>0,ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new le.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=le.open(e,r.flags),o=le.stat(e).size,a=new Uint8Array(o);return le.read(n,a,0,o,0),"utf8"===r.encoding?t=Q(a,0):"binary"===r.encoding&&(t=a),le.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=le.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(re(r)+1),a=te(r,o,0,o.length);le.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");le.write(n,r,0,r.byteLength,void 0,t.canOwn)}le.close(n)},cwd:()=>le.currentPath,chdir(e){var r=le.lookupPath(e,{follow:!0});if(null===r.node)throw new le.ErrnoError(44);if(!le.isDir(r.node.mode))throw new le.ErrnoError(54);var t=le.nodePermissions(r.node,"x");if(t)throw new le.ErrnoError(t);le.currentPath=r.path},createDefaultDirectories(){le.mkdir("/tmp"),le.mkdir("/home"),le.mkdir("/home/web_user")},createDefaultDevices(){le.mkdir("/dev"),le.registerDevice(le.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n}),le.mkdev("/dev/null",le.makedev(1,3)),oe.register(le.makedev(5,0),oe.default_tty_ops),oe.register(le.makedev(6,0),oe.default_tty1_ops),le.mkdev("/dev/tty",le.makedev(5,0)),le.mkdev("/dev/tty1",le.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(0===r&&(r=G(e).byteLength),e[--r]);le.createDevice("/dev","random",t),le.createDevice("/dev","urandom",t),le.mkdir("/dev/shm"),le.mkdir("/dev/shm/tmp")},createSpecialDirectories(){le.mkdir("/proc");var e=le.mkdir("/proc/self");le.mkdir("/proc/self/fd"),le.mount({mount(){var r=le.createNode(e,"fd",16895,73);return r.node_ops={lookup(e,r){var t=+r,n=le.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},r}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?le.createDevice("/dev","stdin",n.stdin):le.symlink("/dev/tty","/dev/stdin"),n.stdout?le.createDevice("/dev","stdout",null,n.stdout):le.symlink("/dev/tty","/dev/stdout"),n.stderr?le.createDevice("/dev","stderr",null,n.stderr):le.symlink("/dev/tty1","/dev/stderr"),le.open("/dev/stdin",0),le.open("/dev/stdout",1),le.open("/dev/stderr",1)},ensureErrnoError(){le.ErrnoError||(le.ErrnoError=function(e,r){this.name="ErrnoError",this.node=r,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},le.ErrnoError.prototype=new Error,le.ErrnoError.prototype.constructor=le.ErrnoError,[44].forEach((e=>{le.genericErrors[e]=new le.ErrnoError(e),le.genericErrors[e].stack=""})))},staticInit(){le.ensureErrnoError(),le.nameTable=new Array(4096),le.mount(se,{},"/"),le.createDefaultDirectories(),le.createDefaultDevices(),le.createSpecialDirectories(),le.filesystems={MEMFS:se}},init(e,r,t){le.init.initialized=!0,le.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=r||n.stdout,n.stderr=t||n.stderr,le.createStandardStreams()},quit(){le.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var r=e%this.chunkSize,t=e/this.chunkSize|0;return this.getter(t)[r]}},a.prototype.setDataGetter=function(e){this.getter=e},a.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",t,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+t+". Status: "+e.status);var r,n=Number(e.getResponseHeader("Content-length")),o=(r=e.getResponseHeader("Accept-Ranges"))&&"bytes"===r,a=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,s=1048576;o||(s=n);var i=this;i.setDataGetter((e=>{var r=e*s,o=(e+1)*s-1;if(o=Math.min(o,n-1),void 0===i.chunks[e]&&(i.chunks[e]=((e,r)=>{if(e>r)throw new Error("invalid range ("+e+", "+r+") or no bytes requested!");if(r>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",t,!1),n!==s&&o.setRequestHeader("Range","bytes="+e+"-"+r),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+t+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):ne(o.responseText||"",!0)})(r,o)),void 0===i.chunks[e])throw new Error("doXHR failed!");return i.chunks[e]})),!a&&n||(s=n=1,n=this.getter(0).length,s=n,_("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=s,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!d)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new a;Object.defineProperties(s,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var i={isDevice:!1,contents:s}}else i={isDevice:!1,url:t};var u=le.createFile(e,r,i,n,o);i.contents?u.contents=i.contents:i.url&&(u.contents=null,u.url=i.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,r,t,n,o){var a=e.node.contents;if(o>=a.length)return 0;var s=Math.min(a.length-o,n);if(a.slice)for(var i=0;i{var r=u.stream_ops[e];l[e]=function(){return le.forceLoadFile(u),r.apply(null,arguments)}})),l.read=(e,r,t,n,o)=>(le.forceLoadFile(u),c(e,r,t,n,o)),l.mmap=(e,r,t,n,o)=>{le.forceLoadFile(u);var a=ae();if(!a)throw new le.ErrnoError(48);return c(e,E,a,r,t),{ptr:a,allocated:!0}},u.stream_ops=l,u}},ce=(e,r)=>e?Q(b,e,r):"",de={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(Z.isAbs(r))return r;var n;if(n=-100===e?le.cwd():de.getStreamFromFD(e).path,0==r.length){if(!t)throw new le.ErrnoError(44);return n}return Z.join2(n,r)},doStat(e,r,t){try{var n=e(r)}catch(e){if(e&&e.node&&Z.normalize(r)!==Z.normalize(le.getPath(e.node)))return-54;throw e}F[t>>2]=n.dev,F[t+4>>2]=n.mode,D[t+8>>2]=n.nlink,F[t+12>>2]=n.uid,F[t+16>>2]=n.gid,F[t+20>>2]=n.rdev,I=[n.size>>>0,(j=n.size,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+24>>2]=I[0],F[t+28>>2]=I[1],F[t+32>>2]=4096,F[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),s=n.ctime.getTime();return I=[Math.floor(o/1e3)>>>0,(j=Math.floor(o/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+40>>2]=I[0],F[t+44>>2]=I[1],D[t+48>>2]=o%1e3*1e3,I=[Math.floor(a/1e3)>>>0,(j=Math.floor(a/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+56>>2]=I[0],F[t+60>>2]=I[1],D[t+64>>2]=a%1e3*1e3,I=[Math.floor(s/1e3)>>>0,(j=Math.floor(s/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+72>>2]=I[0],F[t+76>>2]=I[1],D[t+80>>2]=s%1e3*1e3,I=[n.ino>>>0,(j=n.ino,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+88>>2]=I[0],F[t+92>>2]=I[1],0},doMsync(e,r,t,n,o){if(!le.isFile(r.node.mode))throw new le.ErrnoError(43);if(2&n)return 0;var a=b.slice(e,e+t);le.msync(r,a,o,t,n)},varargs:void 0,get(){var e=F[+de.varargs>>2];return de.varargs+=4,e},getp:()=>de.get(),getStr:e=>ce(e),getStreamFromFD:e=>le.getStreamChecked(e)},he=e=>(F[Oe()>>2]=e,e),fe={BUCKET_BUFFER_SIZE:8192,mount:e=>le.createNode(null,"/",16895,0),createPipe(){var e={buckets:[],refcnt:2};e.buckets.push({buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var r=fe.nextname(),t=fe.nextname(),n=le.createNode(fe.root,r,4096,0),o=le.createNode(fe.root,t,4096,0);n.pipe=e,o.pipe=e;var a=le.createStream({path:r,node:n,flags:0,seekable:!1,stream_ops:fe.stream_ops});n.stream=a;var s=le.createStream({path:t,node:o,flags:1,seekable:!1,stream_ops:fe.stream_ops});return o.stream=s,{readable_fd:a.fd,writable_fd:s.fd}},stream_ops:{poll(e){var r=e.node.pipe;if(1==(2097155&e.flags))return 260;if(r.buckets.length>0)for(var t=0;t0)return 65}return 0},ioctl:(e,r,t)=>28,fsync:e=>28,read(e,r,t,n,o){for(var a=e.node.pipe,s=0,i=0;i=i)return u.buffer.set(s,u.offset),u.offset+=i,i;l>0&&(u.buffer.set(s.subarray(0,l),u.offset),u.offset+=l,s=s.subarray(l,s.byteLength));for(var c=s.byteLength/fe.BUCKET_BUFFER_SIZE|0,d=s.byteLength%fe.BUCKET_BUFFER_SIZE,h=0;h0&&(f={buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:s.byteLength,roffset:0},a.buckets.push(f),f.buffer.set(s)),i},close(e){var r=e.node.pipe;r.refcnt--,0===r.refcnt&&(r.buckets=null)}},nextname:()=>(fe.nextname.current||(fe.nextname.current=0),"pipe["+fe.nextname.current+++"]")},me=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*r:NaN,pe=e=>e%4==0&&(e%100!=0||e%400==0),ve=[0,31,60,91,121,152,182,213,244,274,305,335],we=[0,31,59,90,120,151,181,212,243,273,304,334],ge=e=>(pe(e.getFullYear())?ve:we)[e.getMonth()]+e.getDate()-1,_e=(e,r,t)=>te(e,b,r,t),ye=e=>{var r=re(e)+1,t=xe(r);return t&&_e(e,t,r),t},Ee=e=>{var r=(e-g.buffer.byteLength+65535)/65536;try{return g.grow(r),C(),1}catch(e){}},be={},ke=()=>{if(!ke.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var r in be)void 0===be[r]?delete e[r]:e[r]=be[r];var t=[];for(var r in e)t.push(`${r}=${e[r]}`);ke.strings=t}return ke.strings},Se=e=>{X||(n.onExit?.(e),M=!0),l(e,new $(e))},Fe=(e,r)=>{Se(e)},De=[31,29,31,30,31,30,31,31,30,31,30,31],Me=[31,28,31,30,31,30,31,31,30,31,30,31],Ae=(e,r)=>{E.set(e,r)},Ce=e=>n["_"+e],Pe=(e,r,t,n,o)=>{var a={string:e=>{var r=0;return null!=e&&0!==e&&(r=(e=>{var r=re(e)+1,t=He(r);return _e(e,t,r),t})(e)),r},array:e=>{var r=He(e.length);return Ae(e,r),r}},s=Ce(e),i=[],u=0;if(n)for(var l=0;l{var d=r?V.resolve(Z.join2(e,r)):e;function h(t){function a(t){c?.(),u||((e,r,t,n,o,a)=>{le.createDataFile(e,r,t,n,o,a)})(e,r,t,n,o,l),s?.(),x()}((e,r,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return ie.forEach((a=>{o||a.canHandle(r)&&(a.handle(e,r,t,n),o=!0)})),o})(t,d,a,(()=>{i?.(),x()}))||a(t)}L(),"string"==typeof t?((e,r,t,n)=>{var o=n?"":`al ${e}`;a(e,(t=>{A(t,`Loading data file "${e}" failed (no arrayBuffer).`),r(new Uint8Array(t)),o&&x()}),(r=>{if(!t)throw`Loading data file "${e}" failed.`;t()})),o&&L()})(t,(e=>h(e)),i):h(t)},le.staticInit();var ze={i:function(e){try{var r=de.getStreamFromFD(e);return le.createStream(r).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},a:function(e,r,t){de.varargs=t;try{var n=de.getStreamFromFD(e);switch(r){case 0:if((o=de.get())<0)return-28;for(;le.streams[o];)o++;return le.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=de.get();return n.flags|=o,0;case 5:return o=de.getp(),S[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return he(28),-1}}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},x:function(e,r){try{var t=de.getStreamFromFD(e);return de.doStat(le.stat,t.path,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},u:function(e,r){try{return e=de.getStr(e),de.doStat(le.lstat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},v:function(e,r,t,n){try{r=de.getStr(r);var o=256&n,a=4096&n;return n&=-6401,r=de.calculateAt(e,r,a),de.doStat(o?le.lstat:le.stat,r,t)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},y:function(e,r,t,n){de.varargs=n;try{r=de.getStr(r),r=de.calculateAt(e,r);var o=n?de.get():0;return le.open(r,t,o).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},t:function(e){try{if(0==e)throw new le.ErrnoError(21);var r=fe.createPipe();return F[e>>2]=r.readable_fd,F[e+4>>2]=r.writable_fd,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},s:function(e,r,t){try{for(var n=0,o=0;o>2],i=S[a+4>>1],u=32,l=le.getStream(s);l&&(u=de.DEFAULT_POLLMASK,l.stream_ops.poll&&(u=l.stream_ops.poll(l,-1))),(u&=24|i)&&n++,S[a+6>>1]=u}return n}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},w:function(e,r){try{return e=de.getStr(e),de.doStat(le.stat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},q:function(e,r,t){try{return r=de.getStr(r),r=de.calculateAt(e,r),0===t?le.unlink(r):512===t?le.rmdir(r):O("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},B:()=>1,k:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getUTCSeconds(),F[t+4>>2]=o.getUTCMinutes(),F[t+8>>2]=o.getUTCHours(),F[t+12>>2]=o.getUTCDate(),F[t+16>>2]=o.getUTCMonth(),F[t+20>>2]=o.getUTCFullYear()-1900,F[t+24>>2]=o.getUTCDay();var a=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),s=(o.getTime()-a)/864e5|0;F[t+28>>2]=s},l:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getSeconds(),F[t+4>>2]=o.getMinutes(),F[t+8>>2]=o.getHours(),F[t+12>>2]=o.getDate(),F[t+16>>2]=o.getMonth(),F[t+20>>2]=o.getFullYear()-1900,F[t+24>>2]=o.getDay();var a=0|ge(o);F[t+28>>2]=a,F[t+36>>2]=-60*o.getTimezoneOffset();var s=new Date(o.getFullYear(),0,1),i=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=s.getTimezoneOffset(),l=0|(i!=u&&o.getTimezoneOffset()==Math.min(u,i));F[t+32>>2]=l},m:function(e){var r=(()=>{var r=new Date(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=F[e+32>>2],n=r.getTimezoneOffset(),o=new Date(r.getFullYear(),0,1),a=new Date(r.getFullYear(),6,1).getTimezoneOffset(),s=o.getTimezoneOffset(),i=Math.min(s,a);if(t<0)F[e+32>>2]=Number(a!=s&&i==n);else if(t>0!=(i==n)){var u=Math.max(s,a),l=t>0?i:u;r.setTime(r.getTime()+6e4*(l-n))}F[e+24>>2]=r.getDay();var c=0|ge(r);F[e+28>>2]=c,F[e>>2]=r.getSeconds(),F[e+4>>2]=r.getMinutes(),F[e+8>>2]=r.getHours(),F[e+12>>2]=r.getDate(),F[e+16>>2]=r.getMonth(),F[e+20>>2]=r.getYear();var d=r.getTime();return isNaN(d)?(he(61),-1):d/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},n:function(e){var r=(()=>{var r=Date.UTC(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=new Date(r);F[e+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),o=(t.getTime()-n)/864e5|0;return F[e+28>>2]=o,t.getTime()/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},r:(e,r,t)=>{var n=(new Date).getFullYear(),o=new Date(n,0,1),a=new Date(n,6,1),s=o.getTimezoneOffset(),i=a.getTimezoneOffset(),u=Math.max(s,i);function l(e){var r=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return r?r[1]:"GMT"}D[e>>2]=60*u,F[r>>2]=Number(s!=i);var c=l(o),d=l(a),h=ye(c),f=ye(d);i>2]=h,D[t+4>>2]=f):(D[t>>2]=f,D[t+4>>2]=h)},b:()=>{O("")},c:()=>Date.now(),h:(e,r,t)=>b.copyWithin(e,r,r+t),p:e=>{var r=b.length,t=2147483648;if((e>>>=0)>t)return!1;for(var n,o,a=1;a<=4;a*=2){var s=r*(1+.2/a);s=Math.min(s,e+100663296);var i=Math.min(t,(n=Math.max(e,s))+((o=65536)-n%o)%o);if(Ee(i))return!0}return!1},z:(e,r)=>{var t=0;return ke().forEach(((n,o)=>{var a=r+t;D[e+4*o>>2]=a,((e,r)=>{for(var t=0;t>0]=e.charCodeAt(t);E[r>>0]=0})(n,a),t+=n.length+1})),0},A:(e,r)=>{var t=ke();D[e>>2]=t.length;var n=0;return t.forEach((e=>n+=e.length+1)),D[r>>2]=n,0},g:Fe,e:function(e){try{var r=de.getStreamFromFD(e);return le.close(r),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},j:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],i=D[r+4>>2];r+=8;var u=le.read(e,E,s,i,n);if(u<0)return-1;if(o+=u,u>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},o:function(e,r,t,n,o){var a=me(r,t);try{if(isNaN(a))return 61;var s=de.getStreamFromFD(e);return le.llseek(s,a,n),I=[s.position>>>0,(j=s.position,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[o>>2]=I[0],F[o+4>>2]=I[1],s.getdents&&0===a&&0===n&&(s.getdents=null),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},d:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],i=D[r+4>>2];r+=8;var u=le.write(e,E,s,i,n);if(u<0)return-1;o+=u,void 0!==n&&(n+=u)}return o})(de.getStreamFromFD(e),r,t);return D[n>>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},f:(e,r,t,n)=>{var o=D[n+40>>2],a={tm_sec:F[n>>2],tm_min:F[n+4>>2],tm_hour:F[n+8>>2],tm_mday:F[n+12>>2],tm_mon:F[n+16>>2],tm_year:F[n+20>>2],tm_wday:F[n+24>>2],tm_yday:F[n+28>>2],tm_isdst:F[n+32>>2],tm_gmtoff:F[n+36>>2],tm_zone:o?ce(o):""},s=ce(t),i={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in i)s=s.replace(new RegExp(u,"g"),i[u]);var l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,r,t){for(var n="number"==typeof e?e.toString():e||"";n.length0?1:0}var n;return 0===(n=t(e.getFullYear()-r.getFullYear()))&&0===(n=t(e.getMonth()-r.getMonth()))&&(n=t(e.getDate()-r.getDate())),n}function m(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function p(e){var r=((e,r)=>{for(var t=new Date(e.getTime());r>0;){var n=pe(t.getFullYear()),o=t.getMonth(),a=(n?De:Me)[o];if(!(r>a-t.getDate()))return t.setDate(t.getDate()+r),t;r-=a-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return t})(new Date(e.tm_year+1900,0,1),e.tm_yday),t=new Date(r.getFullYear(),0,4),n=new Date(r.getFullYear()+1,0,4),o=m(t),a=m(n);return f(o,r)<=0?f(a,r)<=0?r.getFullYear()+1:r.getFullYear():r.getFullYear()-1}var v={"%a":e=>l[e.tm_wday].substring(0,3),"%A":e=>l[e.tm_wday],"%b":e=>c[e.tm_mon].substring(0,3),"%B":e=>c[e.tm_mon],"%C":e=>h((e.tm_year+1900)/100|0,2),"%d":e=>h(e.tm_mday,2),"%e":e=>d(e.tm_mday,2," "),"%g":e=>p(e).toString().substring(2),"%G":e=>p(e),"%H":e=>h(e.tm_hour,2),"%I":e=>{var r=e.tm_hour;return 0==r?r=12:r>12&&(r-=12),h(r,2)},"%j":e=>h(e.tm_mday+((e,r)=>{for(var t=0,n=0;n<=r;t+=e[n++]);return t})(pe(e.tm_year+1900)?De:Me,e.tm_mon-1),3),"%m":e=>h(e.tm_mon+1,2),"%M":e=>h(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>h(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var r=e.tm_yday+7-e.tm_wday;return h(Math.floor(r/7),2)},"%V":e=>{var r=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&r++,r){if(53==r){var t=(e.tm_wday+371-e.tm_yday)%7;4==t||3==t&&pe(e.tm_year)||(r=1)}}else{r=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&pe(e.tm_year%400-1))&&r++}return h(r,2)},"%w":e=>e.tm_wday,"%W":e=>{var r=e.tm_yday+7-(e.tm_wday+6)%7;return h(Math.floor(r/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var r=e.tm_gmtoff,t=r>=0;return r=(r=Math.abs(r)/60)/60*100+r%60,(t?"+":"-")+String("0000"+r).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var u in s=s.replace(/%%/g,"\0\0"),v)s.includes(u)&&(s=s.replace(new RegExp(u,"g"),v[u](a)));var w=ne(s=s.replace(/\0\0/g,"%"),!1);return w.length>r?0:(Ae(w,e),w.length-1)}},Le=function(){var e,r,o,a,s={a:ze};function i(e,r){var t;return Le=e.exports,g=Le.C,C(),t=Le.D,T.unshift(t),x(),Le}if(L(),n.instantiateWasm)try{return n.instantiateWasm(s,i)}catch(e){y(`Module.instantiateWasm callback failed with error: ${e}`),t(e)}return(e=w,r=N,o=s,a=function(e){i(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||H(r)||Y(r)||h||"function"!=typeof fetch?K(r,o,a):fetch(r,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,o).then(a,(function(e){return y(`wasm streaming compile failed: ${e}`),y("falling back to ArrayBuffer instantiation"),K(r,o,a)}))))).catch(t),{}}();n._get_version=()=>(n._get_version=Le.E)(),n._archive_open=(e,r,t,o)=>(n._archive_open=Le.F)(e,r,t,o),n._archive_read_add_passphrase=(e,r)=>(n._archive_read_add_passphrase=Le.G)(e,r),n._archive_error_string=e=>(n._archive_error_string=Le.H)(e),n._get_next_entry=e=>(n._get_next_entry=Le.I)(e),n._get_filedata=(e,r)=>(n._get_filedata=Le.J)(e,r);var xe=n._malloc=e=>(xe=n._malloc=Le.K)(e);n._archive_close=e=>(n._archive_close=Le.L)(e),n._start_archive_write=(e,r,t,o,a,s)=>(n._start_archive_write=Le.M)(e,r,t,o,a,s),n._write_archive_file=(e,r,t,o)=>(n._write_archive_file=Le.N)(e,r,t,o),n._size_of_size_t=()=>(n._size_of_size_t=Le.O)(),n._free=e=>(n._free=Le.P)(e);var Oe=()=>(Oe=Le.Q)();n._archive_entry_birthtime_nsec=e=>(n._archive_entry_birthtime_nsec=Le.R)(e),n._archive_entry_filetype=e=>(n._archive_entry_filetype=Le.S)(e),n._archive_entry_mtime_nsec=e=>(n._archive_entry_mtime_nsec=Le.T)(e),n._archive_entry_pathname=e=>(n._archive_entry_pathname=Le.U)(e),n._archive_entry_pathname_utf8=e=>(n._archive_entry_pathname_utf8=Le.V)(e),n._archive_entry_size=e=>(n._archive_entry_size=Le.W)(e),n._archive_entry_is_encrypted=e=>(n._archive_entry_is_encrypted=Le.X)(e),n._archive_read_has_encrypted_entries=e=>(n._archive_read_has_encrypted_entries=Le.Y)(e),n._archive_read_data_skip=e=>(n._archive_read_data_skip=Le.Z)(e),n._archive_write_close=e=>(n._archive_write_close=Le.$)(e),n._archive_write_free=e=>(n._archive_write_free=Le.aa)(e);var Ne,Be=e=>(Be=Le.ba)(e),je=()=>(je=Le.ca)(),Ie=e=>(Ie=Le.da)(e),He=e=>(He=Le.ea)(e);function Ye(){function e(){Ne||(Ne=!0,n.calledRun=!0,M||(n.noFSInit||le.init.initialized||le.init(),le.ignorePermissions=!1,fe.root=le.mount(fe,{},null),q(T),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),R.unshift(e);var e;q(R)}()))}U>0||(function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)e=n.preRun.shift(),P.unshift(e);var e;q(P)}(),U>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.cwrap=(e,r,t,n)=>{var o=!t||t.every((e=>"number"===e||"boolean"===e));return"string"!==r&&o&&!n?Ce(e):function(){return Pe(e,r,t,arguments)}},n.UTF8ToString=ce,n.intArrayFromString=ne,n.allocate=(e,r)=>{var t;return t=1==r?He(e.length):xe(e.length),e.subarray||e.slice||(e=new Uint8Array(e)),b.set(e,t),t},z=function e(){Ne||Ye(),Ne||(z=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return Ye(),e.ready});class F{constructor(){this.preRun=[],this.postRun=[],this.totalDependencies=0}print(...e){console.log(e)}printErr(...e){console.error(e)}initFunctions(){this.runCode={getVersion:this.cwrap("get_version","string",[]),openArchive:this.cwrap("archive_open","number",["number","number","string","string"]),getNextEntry:this.cwrap("get_next_entry","number",["number"]),getFileData:this.cwrap("get_filedata","number",["number","number"]),skipEntry:this.cwrap("archive_read_data_skip","number",["number"]),closeArchive:this.cwrap("archive_close",null,["number"]),getEntrySize:this.cwrap("archive_entry_size","number",["number"]),getEntryName:this.cwrap("archive_entry_pathname","string",["number"]),getEntryType:this.cwrap("archive_entry_filetype","number",["number"]),getEntryLastModified:this.cwrap("archive_entry_mtime_nsec","number",["number"]),getError:this.cwrap("archive_error_string","string",["number"]),startArchiveWrite:this.cwrap("start_archive_write","number",["string","string","number","number","number","string"]),writeArchiveFile:this.cwrap("write_archive_file",null,["number","string","number","number"]),closeArchiveWrite:this.cwrap("archive_write_close","number",["number"]),freeArchiveWrite:this.cwrap("archive_write_free","number",["number"]),entryIsEncrypted:this.cwrap("archive_entry_is_encrypted","number",["number"]),hasEncryptedEntries:this.cwrap("archive_read_has_encrypted_entries","number",["number"]),addPassphrase:this.cwrap("archive_read_add_passphrase","number",["number","string"]),string:e=>this.allocate(this.intArrayFromString(e),"i8",0),malloc:this.cwrap("malloc","number",["number"]),free:this.cwrap("free",null,["number"]),sizeOfSizeT:this.cwrap("size_of_size_t","number",[])}}monitorRunDependencies(){}}let D=null,M=null,A=!1;class C{constructor(e){C.readyCallback=e,A&&setTimeout((()=>e()),0)}open(e,r){D.open(e).then((()=>r()))}listFiles(){let e=[];for(const r of D.entries(!0))e.push(r);return e}extractFiles(){let e=[];for(const r of D.entries(!1))e.push(r);return e}extractSingleFile(e){for(const r of D.entries(!0,e))if(r.fileData)return r}hasEncryptedData(){return D.hasEncryptedData()}usePassword(e){D.setPassphrase(e)}setLocale(e){D.setLocale(e)}writeArchive(e,r,t,n){return M.write(e,r,t,n)}close(){D.close()}}var P;P=e=>{D=new E(e),M=new b(e),C?.readyCallback?.(),A=!0},S(new F).then((e=>{e.initFunctions(),P(e)})),u(C, +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +function(e){const r=new WeakMap;return{postMessage:e.postMessage.bind(e),addEventListener:(t,n)=>{const o=e=>{"handleEvent"in n?n.handleEvent({data:e}):n({data:e})};e.on("message",o),r.set(n,o)},removeEventListener:(t,n)=>{const o=r.get(n);o&&(e.off("message",o),r.delete(n))},start:e.start&&e.start.bind(e)}}(e)); diff --git a/examples/esbuild/dist/worker-bundle.js b/examples/esbuild/dist/worker-bundle.js new file mode 100644 index 0000000..dd74325 --- /dev/null +++ b/examples/esbuild/dist/worker-bundle.js @@ -0,0 +1,6 @@ +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +const e=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),t=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),o=Symbol("Comlink.thrown"),a=e=>"object"==typeof e&&null!==e||"function"==typeof e,i=new Map([["proxy",{canHandle:r=>a(r)&&r[e],serialize(e){const{port1:r,port2:t}=new MessageChannel;return s(e,r),[t,[t]]},deserialize(e){return e.start(),f(e,[],r);var r}}],["throw",{canHandle:e=>a(e)&&o in e,serialize({value:e}){let r;return r=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[r,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function s(r,t=globalThis,a=["*"]){t.addEventListener("message",(function i(l){if(!l||!l.data)return;if(!function(e,r){for(const t of e){if(r===t||"*"===t)return!0;if(t instanceof RegExp&&t.test(r))return!0}return!1}(a,l.origin))return void console.warn(`Invalid origin '${l.origin}' for comlink proxy`);const{id:c,type:d,path:h}=Object.assign({path:[]},l.data),f=(l.data.argumentList||[]).map(w);let m;try{const t=h.slice(0,-1).reduce(((e,r)=>e[r]),r),n=h.reduce(((e,r)=>e[r]),r);switch(d){case"GET":m=n;break;case"SET":t[h.slice(-1)[0]]=w(l.data.value),m=!0;break;case"APPLY":m=n.apply(t,f);break;case"CONSTRUCT":m=function(r){return Object.assign(r,{[e]:!0})}(new n(...f));break;case"ENDPOINT":{const{port1:e,port2:t}=new MessageChannel;s(r,t),m=function(e,r){return p.set(e,r),e}(e,[e])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[o]:0}}Promise.resolve(m).catch((e=>({value:e,[o]:0}))).then((e=>{const[o,a]=v(e);t.postMessage(Object.assign(Object.assign({},o),{id:c}),a),"RELEASE"===d&&(t.removeEventListener("message",i),u(t),n in r&&"function"==typeof r[n]&&r[n]())})).catch((e=>{const[r,n]=v({value:new TypeError("Unserializable return value"),[o]:0});t.postMessage(Object.assign(Object.assign({},r),{id:c}),n)}))})),t.start&&t.start()}function u(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function l(e){if(e)throw new Error("Proxy has been released and is not useable")}function c(e){return g(e,{type:"RELEASE"}).then((()=>{u(e)}))}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const r=(d.get(e)||0)-1;d.set(e,r),0===r&&c(e)}));function f(e,n=[],o=function(){}){let a=!1;const i=new Proxy(o,{get(r,o){if(l(a),o===t)return()=>{!function(e){h&&h.unregister(e)}(i),c(e),a=!0};if("then"===o){if(0===n.length)return{then:()=>i};const r=g(e,{type:"GET",path:n.map((e=>e.toString()))}).then(w);return r.then.bind(r)}return f(e,[...n,o])},set(r,t,o){l(a);const[i,s]=v(o);return g(e,{type:"SET",path:[...n,t].map((e=>e.toString())),value:i},s).then(w)},apply(t,o,i){l(a);const s=n[n.length-1];if(s===r)return g(e,{type:"ENDPOINT"}).then(w);if("bind"===s)return f(e,n.slice(0,-1));const[u,c]=m(i);return g(e,{type:"APPLY",path:n.map((e=>e.toString())),argumentList:u},c).then(w)},construct(r,t){l(a);const[o,i]=m(t);return g(e,{type:"CONSTRUCT",path:n.map((e=>e.toString())),argumentList:o},i).then(w)}});return function(e,r){const t=(d.get(r)||0)+1;d.set(r,t),h&&h.register(e,r,e)}(i,e),i}function m(e){const r=e.map(v);return[r.map((e=>e[0])),(t=r.map((e=>e[1])),Array.prototype.concat.apply([],t))];var t}const p=new WeakMap;function v(e){for(const[r,t]of i)if(t.canHandle(e)){const[n,o]=t.serialize(e);return[{type:"HANDLER",name:r,value:n},o]}return[{type:"RAW",value:e},p.get(e)||[]]}function w(e){switch(e.type){case"HANDLER":return i.get(e.name).deserialize(e.value);case"RAW":return e.value}}function g(e,r,t){return new Promise((n=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function r(t){t.data&&t.data.id&&t.data.id===o&&(e.removeEventListener("message",r),n(t.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},r),t)}))}const _={32768:"FILE",16384:"DIR",40960:"SYMBOLIC_LINK",49152:"SOCKET",8192:"CHARACTER_DEVICE",24576:"BLOCK_DEVICE",4096:"NAMED_PIPE"};class y{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._file=null,this._passphrase=null,this._locale="en_US.UTF-8"}async open(e){null!==this._file&&(console.warn("Closing previous file"),this.close());const r=await this._loadFile(e);this._fileLength=r.length,this._filePtr=r.ptr}close(){this._runCode.closeArchive(this._archive),this._wasmModule._free(this._filePtr),this._file=null,this._filePtr=null,this._archive=null}hasEncryptedData(){this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale),this._runCode.getNextEntry(this._archive);const e=this._runCode.hasEncryptedEntries(this._archive);return 0!==e&&(e>0||null)}setPassphrase(e){this._passphrase=e}setLocale(e){this._locale=e}*entries(e=!1,r=null){let t;for(this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale);t=this._runCode.getNextEntry(this._archive),0!==t;){const n={size:this._runCode.getEntrySize(t),path:this._runCode.getEntryName(t),type:_[this._runCode.getEntryType(t)],lastModified:this._runCode.getEntryLastModified(t),ref:t};if("FILE"===n.type){let e=n.path.split("/");n.fileName=e[e.length-1]}if(e&&r!==n.path)this._runCode.skipEntry(this._archive);else{const e=this._runCode.getFileData(this._archive,n.size);if(e<0)throw new Error(this._runCode.getError(this._archive));n.fileData=this._wasmModule.HEAPU8.slice(e,e+n.size),this._wasmModule._free(e)}yield n}}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}}class E{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._passphrase=null,this._locale="en_US.UTF-8"}async write(e,r,t,n=null){let o=e.reduce(((e,{file:r})=>e+r.size),0)+512;const a=this._runCode.malloc(o),i=this._runCode.malloc(this._runCode.sizeOfSizeT()),s=this._runCode.startArchiveWrite(r,t,a,o,i,n);for(const{file:r,pathname:t}of e){const e=await this._loadFile(r);this._runCode.writeArchiveFile(s,t||r.name,e.length,e.ptr),this._runCode.free(e.ptr)}const u=this._runCode.closeArchiveWrite(s),l=this._runCode.freeArchiveWrite(s);if(0!==u||0!==l)throw new Error(this._runCode.getError(s));const c=this.readNumberFromPointer(i);return this._wasmModule.HEAPU8.slice(a,a+c)}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}readNumberFromPointer(e){const r=this._runCode.sizeOfSizeT(),t=this._wasmModule.HEAPU8.slice(e,e+r);let n=null;if(4==r)n=new Uint32Array(t)[0];else{if(8!=r)throw Error("Unexpected size of size_t: "+r);n=new BigUint64Array(t)[0]}return n}}var b,k=(b=import.meta.url,async function(e={}){var r,t,n=e;n.ready=new Promise(((e,n)=>{r=e,t=n}));var o,a,i,s=Object.assign({},n),u="./this.program",l=(e,r)=>{throw r},c="object"==typeof window,d="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";if(h){const{createRequire:e}=await import("module");var m=e(import.meta.url),p=m("fs"),v=m("path");f=d?v.dirname(f)+"/":m("url").fileURLToPath(new URL("./",import.meta.url)),o=(e,r)=>(e=Y(e)?new URL(e):v.normalize(e),p.readFileSync(e,r?void 0:"utf8")),i=e=>{var r=o(e,!0);return r.buffer||(r=new Uint8Array(r)),r},a=(e,r,t,n=!0)=>{e=Y(e)?new URL(e):v.normalize(e),p.readFile(e,n?void 0:"utf8",((e,o)=>{e?t(e):r(n?o.buffer:o)}))},!n.thisProgram&&process.argv.length>1&&(u=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),l=(e,r)=>{throw process.exitCode=e,r},n.inspect=()=>"[Emscripten Module object]"}else(c||d)&&(d?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),b&&(f=b),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},d&&(i=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),a=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?r(n.response):t()},n.onerror=t,n.send(null)});var w,g,_=n.print||console.log.bind(console),y=n.printErr||console.error.bind(console);Object.assign(n,s),s=null,n.arguments&&n.arguments,n.thisProgram&&(u=n.thisProgram),n.quit&&(l=n.quit),n.wasmBinary&&(w=n.wasmBinary),"object"!=typeof WebAssembly&&O("no native wasm support detected");var E,k,S,F,D,M=!1;function A(e,r){e||O(r)}function C(){var e=g.buffer;n.HEAP8=E=new Int8Array(e),n.HEAP16=S=new Int16Array(e),n.HEAPU8=k=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAP32=F=new Int32Array(e),n.HEAPU32=D=new Uint32Array(e),n.HEAPF32=new Float32Array(e),n.HEAPF64=new Float64Array(e)}var P=[],T=[],R=[],U=0,z=null;function L(e){U++,n.monitorRunDependencies?.(U)}function x(e){if(U--,n.monitorRunDependencies?.(U),0==U&&z){var r=z;z=null,r()}}function O(e){n.onAbort?.(e),y(e="Aborted("+e+")"),M=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw t(r),r}var N,B,j,I,H=e=>e.startsWith("data:application/octet-stream;base64,"),Y=e=>e.startsWith("file://");function W(e){if(e==N&&w)return new Uint8Array(w);if(i)return i(e);throw"both async and sync fetching of the wasm failed"}function K(e,r,t){return function(e){if(!w&&(c||d)){if("function"==typeof fetch&&!Y(e))return fetch(e,{credentials:"same-origin"}).then((r=>{if(!r.ok)throw"failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()})).catch((()=>W(e)));if(a)return new Promise(((r,t)=>{a(e,(e=>r(new Uint8Array(e))),t)}))}return Promise.resolve().then((()=>W(e)))}(e).then((e=>WebAssembly.instantiate(e,r))).then((e=>e)).then(t,(e=>{y(`failed to asynchronously prepare wasm: ${e}`),O(e)}))}function $(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}n.locateFile?H(N="libarchive.wasm")||(B=N,N=n.locateFile?n.locateFile(B,f):f+B):N=new URL("libarchive.wasm",import.meta.url).href;var q=e=>{for(;e.length>0;)e.shift()(n)},X=n.noExitRuntime||!0,Z={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=Z.isAbs(e),t="/"===e.substr(-1);return(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=Z.splitPath(e),t=r[0],n=r[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:e=>{if("/"===e)return"/";var r=(e=(e=Z.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===r?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments);return Z.normalize(e.join("/"))},join2:(e,r)=>Z.normalize(e+"/"+r)},G=e=>(G=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return r=>e.randomFillSync(r);var r=e.randomBytes;return e=>(e.set(r(e.byteLength)),e)}catch(e){}O("initRandomDevice")})())(e),V={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:le.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=Z.isAbs(n)}return(r?"/":"")+(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,r)=>{function t(e){for(var r=0;r=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=V.resolve(e).substr(1),r=V.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.split("/")),a=Math.min(n.length,o.length),i=a,s=0;s{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&J)return J.decode(e.subarray(r,o));for(var a="";r>10,56320|1023&l)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},ee=[],re=e=>{for(var r=0,t=0;t=55296&&n<=57343?(r+=4,++t):r+=3}return r},te=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,i=0;i=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),s<=127){if(t>=a)break;r[t++]=s}else if(s<=2047){if(t+1>=a)break;r[t++]=192|s>>6,r[t++]=128|63&s}else if(s<=65535){if(t+2>=a)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(t+3>=a)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o};function ne(e,r,t){var n=t>0?t:re(e)+1,o=new Array(n),a=te(e,o,0,o.length);return r&&(o.length=a),o}var oe={ttys:[],init(){},shutdown(){},register(e,r){oe.ttys[e]={input:[],output:[],ops:r},le.registerDevice(e,oe.stream_ops)},stream_ops:{open(e){var r=oe.ttys[e.node.rdev];if(!r)throw new le.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new le.ErrnoError(60);for(var a=0,i=0;i(()=>{if(!ee.length){var e=null;if(h){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=p.readSync(n,r)}catch(e){if(!e.toString().includes("EOF"))throw e;t=0}e=t>0?r.slice(0,t).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;ee=ne(e,!0)}return ee.shift()})(),put_char(e,r){null===r||10===r?(_(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(_(Q(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,r,t)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,r){null===r||10===r?(y(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(y(Q(e.output,0)),e.output=[])}}},ae=e=>{O()},ie={ops_table:null,mount:e=>ie.createNode(null,"/",16895,0),createNode(e,r,t,n){if(le.isBlkdev(t)||le.isFIFO(t))throw new le.ErrnoError(63);ie.ops_table||={dir:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr,lookup:ie.node_ops.lookup,mknod:ie.node_ops.mknod,rename:ie.node_ops.rename,unlink:ie.node_ops.unlink,rmdir:ie.node_ops.rmdir,readdir:ie.node_ops.readdir,symlink:ie.node_ops.symlink},stream:{llseek:ie.stream_ops.llseek}},file:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr},stream:{llseek:ie.stream_ops.llseek,read:ie.stream_ops.read,write:ie.stream_ops.write,allocate:ie.stream_ops.allocate,mmap:ie.stream_ops.mmap,msync:ie.stream_ops.msync}},link:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr,readlink:ie.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr},stream:le.chrdev_stream_ops}};var o=le.createNode(e,r,t,n);return le.isDir(o.mode)?(o.node_ops=ie.ops_table.dir.node,o.stream_ops=ie.ops_table.dir.stream,o.contents={}):le.isFile(o.mode)?(o.node_ops=ie.ops_table.file.node,o.stream_ops=ie.ops_table.file.stream,o.usedBytes=0,o.contents=null):le.isLink(o.mode)?(o.node_ops=ie.ops_table.link.node,o.stream_ops=ie.ops_table.link.stream):le.isChrdev(o.mode)&&(o.node_ops=ie.ops_table.chrdev.node,o.stream_ops=ie.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){r=Math.max(r,t*(t<1048576?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var n=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(0==r)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=le.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,le.isDir(e.mode)?r.size=4096:le.isFile(e.mode)?r.size=e.usedBytes:le.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp),void 0!==r.size&&ie.resizeFileStorage(e,r.size)},lookup(e,r){throw le.genericErrors[44]},mknod:(e,r,t,n)=>ie.createNode(e,r,t,n),rename(e,r,t){if(le.isDir(e.mode)){var n;try{n=le.lookupNode(r,t)}catch(e){}if(n)for(var o in n.contents)throw new le.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp,e.parent=r},unlink(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=le.lookupNode(e,r);for(var n in t.contents)throw new le.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=ie.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!le.isLink(e.mode))throw new le.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var i=Math.min(e.node.usedBytes-o,n);if(i>8&&a.subarray)r.set(a.subarray(o,o+i),t);else for(var s=0;s0||t+r(ie.stream_ops.write(e,r,0,n,t,!1),0)}},se=n.preloadPlugins||[],ue=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},le={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e,r={}){if(!(e=V.resolve(e)))return{path:"",node:null};if((r=Object.assign({follow_mount:!0,recurse_count:0},r)).recurse_count>8)throw new le.ErrnoError(32);for(var t=e.split("/").filter((e=>!!e)),n=le.root,o="/",a=0;a40)throw new le.ErrnoError(32)}}return{path:o,node:n}},getPath(e){for(var r;;){if(le.isRoot(e)){var t=e.mount.mountpoint;return r?"/"!==t[t.length-1]?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n>>0)%le.nameTable.length},hashAddNode(e){var r=le.hashName(e.parent.id,e.name);e.name_next=le.nameTable[r],le.nameTable[r]=e},hashRemoveNode(e){var r=le.hashName(e.parent.id,e.name);if(le.nameTable[r]===e)le.nameTable[r]=e.name_next;else for(var t=le.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=le.mayLookup(e);if(t)throw new le.ErrnoError(t,e);for(var n=le.hashName(e.id,r),o=le.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===r)return o}return le.lookup(e,r)},createNode(e,r,t,n){var o=new le.FSNode(e,r,t,n);return le.hashAddNode(o),o},destroyNode(e){le.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>le.ignorePermissions||(!r.includes("r")||292&e.mode)&&(!r.includes("w")||146&e.mode)&&(!r.includes("x")||73&e.mode)?0:2,mayLookup(e){var r=le.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{return le.lookupNode(e,r),20}catch(e){}return le.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=le.lookupNode(e,r)}catch(e){return e.errno}var o=le.nodePermissions(e,"wx");if(o)return o;if(t){if(!le.isDir(n.mode))return 54;if(le.isRoot(n)||le.getPath(n)===le.cwd())return 10}else if(le.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?le.isLink(e.mode)?32:le.isDir(e.mode)&&("r"!==le.flagsToPermissionString(r)||512&r)?31:le.nodePermissions(e,le.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=le.MAX_OPEN_FDS;e++)if(!le.streams[e])return e;throw new le.ErrnoError(33)},getStreamChecked(e){var r=le.getStream(e);if(!r)throw new le.ErrnoError(8);return r},getStream:e=>le.streams[e],createStream:(e,r=-1)=>(le.FSStream||(le.FSStream=function(){this.shared={}},le.FSStream.prototype={},Object.defineProperties(le.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new le.FSStream,e),-1==r&&(r=le.nextfd()),e.fd=r,le.streams[r]=e,e),closeStream(e){le.streams[e]=null},chrdev_stream_ops:{open(e){var r=le.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new le.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice(e,r){le.devices[e]={stream_ops:r}},getDevice:e=>le.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs(e,r){"function"==typeof e&&(r=e,e=!1),le.syncFSRequests++,le.syncFSRequests>1&&y(`warning: ${le.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=le.getMounts(le.root.mount),n=0;function o(e){return le.syncFSRequests--,r(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,o(e));++n>=t.length&&o(null)}t.forEach((r=>{if(!r.type.syncfs)return a(null);r.type.syncfs(r,e,a)}))},mount(e,r,t){var n,o="/"===t,a=!t;if(o&&le.root)throw new le.ErrnoError(10);if(!o&&!a){var i=le.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,le.isMountpoint(n))throw new le.ErrnoError(10);if(!le.isDir(n.mode))throw new le.ErrnoError(54)}var s={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?le.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(e){var r=le.lookupPath(e,{follow_mount:!1});if(!le.isMountpoint(r.node))throw new le.ErrnoError(28);var t=r.node,n=t.mounted,o=le.getMounts(n);Object.keys(le.nameTable).forEach((e=>{for(var r=le.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&le.destroyNode(r),r=t}})),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod(e,r,t){var n=le.lookupPath(e,{parent:!0}).node,o=Z.basename(e);if(!o||"."===o||".."===o)throw new le.ErrnoError(28);var a=le.mayCreate(n,o);if(a)throw new le.ErrnoError(a);if(!n.node_ops.mknod)throw new le.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:(e,r)=>(r=void 0!==r?r:438,r&=4095,r|=32768,le.mknod(e,r,0)),mkdir:(e,r)=>(r=void 0!==r?r:511,r&=1023,r|=16384,le.mknod(e,r,0)),mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o(void 0===t&&(t=r,r=438),r|=8192,le.mknod(e,r,t)),symlink(e,r){if(!V.resolve(e))throw new le.ErrnoError(44);var t=le.lookupPath(r,{parent:!0}).node;if(!t)throw new le.ErrnoError(44);var n=Z.basename(r),o=le.mayCreate(t,n);if(o)throw new le.ErrnoError(o);if(!t.node_ops.symlink)throw new le.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename(e,r){var t,n,o=Z.dirname(e),a=Z.dirname(r),i=Z.basename(e),s=Z.basename(r);if(t=le.lookupPath(e,{parent:!0}).node,n=le.lookupPath(r,{parent:!0}).node,!t||!n)throw new le.ErrnoError(44);if(t.mount!==n.mount)throw new le.ErrnoError(75);var u,l=le.lookupNode(t,i),c=V.relative(e,a);if("."!==c.charAt(0))throw new le.ErrnoError(28);if("."!==(c=V.relative(r,o)).charAt(0))throw new le.ErrnoError(55);try{u=le.lookupNode(n,s)}catch(e){}if(l!==u){var d=le.isDir(l.mode),h=le.mayDelete(t,i,d);if(h)throw new le.ErrnoError(h);if(h=u?le.mayDelete(n,s,d):le.mayCreate(n,s))throw new le.ErrnoError(h);if(!t.node_ops.rename)throw new le.ErrnoError(63);if(le.isMountpoint(l)||u&&le.isMountpoint(u))throw new le.ErrnoError(10);if(n!==t&&(h=le.nodePermissions(t,"w")))throw new le.ErrnoError(h);le.hashRemoveNode(l);try{t.node_ops.rename(l,n,s)}catch(e){throw e}finally{le.hashAddNode(l)}}},rmdir(e){var r=le.lookupPath(e,{parent:!0}).node,t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!0);if(o)throw new le.ErrnoError(o);if(!r.node_ops.rmdir)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.rmdir(r,t),le.destroyNode(n)},readdir(e){var r=le.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new le.ErrnoError(54);return r.node_ops.readdir(r)},unlink(e){var r=le.lookupPath(e,{parent:!0}).node;if(!r)throw new le.ErrnoError(44);var t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!1);if(o)throw new le.ErrnoError(o);if(!r.node_ops.unlink)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.unlink(r,t),le.destroyNode(n)},readlink(e){var r=le.lookupPath(e).node;if(!r)throw new le.ErrnoError(44);if(!r.node_ops.readlink)throw new le.ErrnoError(28);return V.resolve(le.getPath(r.parent),r.node_ops.readlink(r))},stat(e,r){var t=le.lookupPath(e,{follow:!r}).node;if(!t)throw new le.ErrnoError(44);if(!t.node_ops.getattr)throw new le.ErrnoError(63);return t.node_ops.getattr(t)},lstat:e=>le.stat(e,!0),chmod(e,r,t){var n;if(!(n="string"==typeof e?le.lookupPath(e,{follow:!t}).node:e).node_ops.setattr)throw new le.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod(e,r){le.chmod(e,r,!0)},fchmod(e,r){var t=le.getStreamChecked(e);le.chmod(t.node,r)},chown(e,r,t,n){var o;if(!(o="string"==typeof e?le.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new le.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){le.chown(e,r,t,!0)},fchown(e,r,t){var n=le.getStreamChecked(e);le.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new le.ErrnoError(28);var t;if(!(t="string"==typeof e?le.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new le.ErrnoError(63);if(le.isDir(t.mode))throw new le.ErrnoError(31);if(!le.isFile(t.mode))throw new le.ErrnoError(28);var n=le.nodePermissions(t,"w");if(n)throw new le.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=le.getStreamChecked(e);if(0==(2097155&t.flags))throw new le.ErrnoError(28);le.truncate(t.node,r)},utime(e,r,t){var n=le.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open(e,r,t){if(""===e)throw new le.ErrnoError(44);var o;if(t=void 0===t?438:t,t=64&(r="string"==typeof r?(e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===r)throw new Error(`Unknown file open mode: ${e}`);return r})(r):r)?4095&t|32768:0,"object"==typeof e)o=e;else{e=Z.normalize(e);try{o=le.lookupPath(e,{follow:!(131072&r)}).node}catch(e){}}var a=!1;if(64&r)if(o){if(128&r)throw new le.ErrnoError(20)}else o=le.mknod(e,t,0),a=!0;if(!o)throw new le.ErrnoError(44);if(le.isChrdev(o.mode)&&(r&=-513),65536&r&&!le.isDir(o.mode))throw new le.ErrnoError(54);if(!a){var i=le.mayOpen(o,r);if(i)throw new le.ErrnoError(i)}512&r&&!a&&le.truncate(o,0),r&=-131713;var s=le.createStream({node:o,path:le.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!n.logReadFiles||1&r||(le.readFiles||(le.readFiles={}),e in le.readFiles||(le.readFiles[e]=1)),s},close(e){if(le.isClosed(e))throw new le.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{le.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new le.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new le.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(1==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.read)throw new le.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var i=e.stream_ops.read(e,r,t,n,o);return a||(e.position+=i),i},write(e,r,t,n,o,a){if(n<0||o<0)throw new le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.write)throw new le.ErrnoError(28);e.seekable&&1024&e.flags&&le.llseek(e,0,2);var i=void 0!==o;if(i){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var s=e.stream_ops.write(e,r,t,n,o,a);return i||(e.position+=s),s},allocate(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(r<0||t<=0)throw new le.ErrnoError(28);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(!le.isFile(e.node.mode)&&!le.isDir(e.node.mode))throw new le.ErrnoError(43);if(!e.stream_ops.allocate)throw new le.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if(0!=(2&n)&&0==(2&o)&&2!=(2097155&e.flags))throw new le.ErrnoError(2);if(1==(2097155&e.flags))throw new le.ErrnoError(2);if(!e.stream_ops.mmap)throw new le.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync:(e,r,t,n,o)=>e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0,munmap:e=>0,ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new le.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=le.open(e,r.flags),o=le.stat(e).size,a=new Uint8Array(o);return le.read(n,a,0,o,0),"utf8"===r.encoding?t=Q(a,0):"binary"===r.encoding&&(t=a),le.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=le.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(re(r)+1),a=te(r,o,0,o.length);le.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");le.write(n,r,0,r.byteLength,void 0,t.canOwn)}le.close(n)},cwd:()=>le.currentPath,chdir(e){var r=le.lookupPath(e,{follow:!0});if(null===r.node)throw new le.ErrnoError(44);if(!le.isDir(r.node.mode))throw new le.ErrnoError(54);var t=le.nodePermissions(r.node,"x");if(t)throw new le.ErrnoError(t);le.currentPath=r.path},createDefaultDirectories(){le.mkdir("/tmp"),le.mkdir("/home"),le.mkdir("/home/web_user")},createDefaultDevices(){le.mkdir("/dev"),le.registerDevice(le.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n}),le.mkdev("/dev/null",le.makedev(1,3)),oe.register(le.makedev(5,0),oe.default_tty_ops),oe.register(le.makedev(6,0),oe.default_tty1_ops),le.mkdev("/dev/tty",le.makedev(5,0)),le.mkdev("/dev/tty1",le.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(0===r&&(r=G(e).byteLength),e[--r]);le.createDevice("/dev","random",t),le.createDevice("/dev","urandom",t),le.mkdir("/dev/shm"),le.mkdir("/dev/shm/tmp")},createSpecialDirectories(){le.mkdir("/proc");var e=le.mkdir("/proc/self");le.mkdir("/proc/self/fd"),le.mount({mount(){var r=le.createNode(e,"fd",16895,73);return r.node_ops={lookup(e,r){var t=+r,n=le.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},r}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?le.createDevice("/dev","stdin",n.stdin):le.symlink("/dev/tty","/dev/stdin"),n.stdout?le.createDevice("/dev","stdout",null,n.stdout):le.symlink("/dev/tty","/dev/stdout"),n.stderr?le.createDevice("/dev","stderr",null,n.stderr):le.symlink("/dev/tty1","/dev/stderr"),le.open("/dev/stdin",0),le.open("/dev/stdout",1),le.open("/dev/stderr",1)},ensureErrnoError(){le.ErrnoError||(le.ErrnoError=function(e,r){this.name="ErrnoError",this.node=r,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},le.ErrnoError.prototype=new Error,le.ErrnoError.prototype.constructor=le.ErrnoError,[44].forEach((e=>{le.genericErrors[e]=new le.ErrnoError(e),le.genericErrors[e].stack=""})))},staticInit(){le.ensureErrnoError(),le.nameTable=new Array(4096),le.mount(ie,{},"/"),le.createDefaultDirectories(),le.createDefaultDevices(),le.createSpecialDirectories(),le.filesystems={MEMFS:ie}},init(e,r,t){le.init.initialized=!0,le.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=r||n.stdout,n.stderr=t||n.stderr,le.createStandardStreams()},quit(){le.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var r=e%this.chunkSize,t=e/this.chunkSize|0;return this.getter(t)[r]}},a.prototype.setDataGetter=function(e){this.getter=e},a.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",t,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+t+". Status: "+e.status);var r,n=Number(e.getResponseHeader("Content-length")),o=(r=e.getResponseHeader("Accept-Ranges"))&&"bytes"===r,a=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,i=1048576;o||(i=n);var s=this;s.setDataGetter((e=>{var r=e*i,o=(e+1)*i-1;if(o=Math.min(o,n-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,r)=>{if(e>r)throw new Error("invalid range ("+e+", "+r+") or no bytes requested!");if(r>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",t,!1),n!==i&&o.setRequestHeader("Range","bytes="+e+"-"+r),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+t+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):ne(o.responseText||"",!0)})(r,o)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!a&&n||(i=n=1,n=this.getter(0).length,i=n,_("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!d)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i=new a;Object.defineProperties(i,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:i}}else s={isDevice:!1,url:t};var u=le.createFile(e,r,s,n,o);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,r,t,n,o){var a=e.node.contents;if(o>=a.length)return 0;var i=Math.min(a.length-o,n);if(a.slice)for(var s=0;s{var r=u.stream_ops[e];l[e]=function(){return le.forceLoadFile(u),r.apply(null,arguments)}})),l.read=(e,r,t,n,o)=>(le.forceLoadFile(u),c(e,r,t,n,o)),l.mmap=(e,r,t,n,o)=>{le.forceLoadFile(u);var a=ae();if(!a)throw new le.ErrnoError(48);return c(e,E,a,r,t),{ptr:a,allocated:!0}},u.stream_ops=l,u}},ce=(e,r)=>e?Q(k,e,r):"",de={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(Z.isAbs(r))return r;var n;if(n=-100===e?le.cwd():de.getStreamFromFD(e).path,0==r.length){if(!t)throw new le.ErrnoError(44);return n}return Z.join2(n,r)},doStat(e,r,t){try{var n=e(r)}catch(e){if(e&&e.node&&Z.normalize(r)!==Z.normalize(le.getPath(e.node)))return-54;throw e}F[t>>2]=n.dev,F[t+4>>2]=n.mode,D[t+8>>2]=n.nlink,F[t+12>>2]=n.uid,F[t+16>>2]=n.gid,F[t+20>>2]=n.rdev,I=[n.size>>>0,(j=n.size,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+24>>2]=I[0],F[t+28>>2]=I[1],F[t+32>>2]=4096,F[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),i=n.ctime.getTime();return I=[Math.floor(o/1e3)>>>0,(j=Math.floor(o/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+40>>2]=I[0],F[t+44>>2]=I[1],D[t+48>>2]=o%1e3*1e3,I=[Math.floor(a/1e3)>>>0,(j=Math.floor(a/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+56>>2]=I[0],F[t+60>>2]=I[1],D[t+64>>2]=a%1e3*1e3,I=[Math.floor(i/1e3)>>>0,(j=Math.floor(i/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+72>>2]=I[0],F[t+76>>2]=I[1],D[t+80>>2]=i%1e3*1e3,I=[n.ino>>>0,(j=n.ino,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+88>>2]=I[0],F[t+92>>2]=I[1],0},doMsync(e,r,t,n,o){if(!le.isFile(r.node.mode))throw new le.ErrnoError(43);if(2&n)return 0;var a=k.slice(e,e+t);le.msync(r,a,o,t,n)},varargs:void 0,get(){var e=F[+de.varargs>>2];return de.varargs+=4,e},getp:()=>de.get(),getStr:e=>ce(e),getStreamFromFD:e=>le.getStreamChecked(e)},he=e=>(F[Oe()>>2]=e,e),fe={BUCKET_BUFFER_SIZE:8192,mount:e=>le.createNode(null,"/",16895,0),createPipe(){var e={buckets:[],refcnt:2};e.buckets.push({buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var r=fe.nextname(),t=fe.nextname(),n=le.createNode(fe.root,r,4096,0),o=le.createNode(fe.root,t,4096,0);n.pipe=e,o.pipe=e;var a=le.createStream({path:r,node:n,flags:0,seekable:!1,stream_ops:fe.stream_ops});n.stream=a;var i=le.createStream({path:t,node:o,flags:1,seekable:!1,stream_ops:fe.stream_ops});return o.stream=i,{readable_fd:a.fd,writable_fd:i.fd}},stream_ops:{poll(e){var r=e.node.pipe;if(1==(2097155&e.flags))return 260;if(r.buckets.length>0)for(var t=0;t0)return 65}return 0},ioctl:(e,r,t)=>28,fsync:e=>28,read(e,r,t,n,o){for(var a=e.node.pipe,i=0,s=0;s=s)return u.buffer.set(i,u.offset),u.offset+=s,s;l>0&&(u.buffer.set(i.subarray(0,l),u.offset),u.offset+=l,i=i.subarray(l,i.byteLength));for(var c=i.byteLength/fe.BUCKET_BUFFER_SIZE|0,d=i.byteLength%fe.BUCKET_BUFFER_SIZE,h=0;h0&&(f={buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:i.byteLength,roffset:0},a.buckets.push(f),f.buffer.set(i)),s},close(e){var r=e.node.pipe;r.refcnt--,0===r.refcnt&&(r.buckets=null)}},nextname:()=>(fe.nextname.current||(fe.nextname.current=0),"pipe["+fe.nextname.current+++"]")},me=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*r:NaN,pe=e=>e%4==0&&(e%100!=0||e%400==0),ve=[0,31,60,91,121,152,182,213,244,274,305,335],we=[0,31,59,90,120,151,181,212,243,273,304,334],ge=e=>(pe(e.getFullYear())?ve:we)[e.getMonth()]+e.getDate()-1,_e=(e,r,t)=>te(e,k,r,t),ye=e=>{var r=re(e)+1,t=xe(r);return t&&_e(e,t,r),t},Ee=e=>{var r=(e-g.buffer.byteLength+65535)/65536;try{return g.grow(r),C(),1}catch(e){}},be={},ke=()=>{if(!ke.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var r in be)void 0===be[r]?delete e[r]:e[r]=be[r];var t=[];for(var r in e)t.push(`${r}=${e[r]}`);ke.strings=t}return ke.strings},Se=e=>{X||(n.onExit?.(e),M=!0),l(e,new $(e))},Fe=(e,r)=>{Se(e)},De=[31,29,31,30,31,30,31,31,30,31,30,31],Me=[31,28,31,30,31,30,31,31,30,31,30,31],Ae=(e,r)=>{E.set(e,r)},Ce=e=>n["_"+e],Pe=(e,r,t,n,o)=>{var a={string:e=>{var r=0;return null!=e&&0!==e&&(r=(e=>{var r=re(e)+1,t=He(r);return _e(e,t,r),t})(e)),r},array:e=>{var r=He(e.length);return Ae(e,r),r}},i=Ce(e),s=[],u=0;if(n)for(var l=0;l{var d=r?V.resolve(Z.join2(e,r)):e;function h(t){function a(t){c?.(),u||((e,r,t,n,o,a)=>{le.createDataFile(e,r,t,n,o,a)})(e,r,t,n,o,l),i?.(),x()}((e,r,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return se.forEach((a=>{o||a.canHandle(r)&&(a.handle(e,r,t,n),o=!0)})),o})(t,d,a,(()=>{s?.(),x()}))||a(t)}L(),"string"==typeof t?((e,r,t,n)=>{var o=n?"":`al ${e}`;a(e,(t=>{A(t,`Loading data file "${e}" failed (no arrayBuffer).`),r(new Uint8Array(t)),o&&x()}),(r=>{if(!t)throw`Loading data file "${e}" failed.`;t()})),o&&L()})(t,(e=>h(e)),s):h(t)},le.staticInit();var ze={i:function(e){try{var r=de.getStreamFromFD(e);return le.createStream(r).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},a:function(e,r,t){de.varargs=t;try{var n=de.getStreamFromFD(e);switch(r){case 0:if((o=de.get())<0)return-28;for(;le.streams[o];)o++;return le.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=de.get();return n.flags|=o,0;case 5:return o=de.getp(),S[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return he(28),-1}}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},x:function(e,r){try{var t=de.getStreamFromFD(e);return de.doStat(le.stat,t.path,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},u:function(e,r){try{return e=de.getStr(e),de.doStat(le.lstat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},v:function(e,r,t,n){try{r=de.getStr(r);var o=256&n,a=4096&n;return n&=-6401,r=de.calculateAt(e,r,a),de.doStat(o?le.lstat:le.stat,r,t)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},y:function(e,r,t,n){de.varargs=n;try{r=de.getStr(r),r=de.calculateAt(e,r);var o=n?de.get():0;return le.open(r,t,o).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},t:function(e){try{if(0==e)throw new le.ErrnoError(21);var r=fe.createPipe();return F[e>>2]=r.readable_fd,F[e+4>>2]=r.writable_fd,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},s:function(e,r,t){try{for(var n=0,o=0;o>2],s=S[a+4>>1],u=32,l=le.getStream(i);l&&(u=de.DEFAULT_POLLMASK,l.stream_ops.poll&&(u=l.stream_ops.poll(l,-1))),(u&=24|s)&&n++,S[a+6>>1]=u}return n}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},w:function(e,r){try{return e=de.getStr(e),de.doStat(le.stat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},q:function(e,r,t){try{return r=de.getStr(r),r=de.calculateAt(e,r),0===t?le.unlink(r):512===t?le.rmdir(r):O("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},B:()=>1,k:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getUTCSeconds(),F[t+4>>2]=o.getUTCMinutes(),F[t+8>>2]=o.getUTCHours(),F[t+12>>2]=o.getUTCDate(),F[t+16>>2]=o.getUTCMonth(),F[t+20>>2]=o.getUTCFullYear()-1900,F[t+24>>2]=o.getUTCDay();var a=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),i=(o.getTime()-a)/864e5|0;F[t+28>>2]=i},l:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getSeconds(),F[t+4>>2]=o.getMinutes(),F[t+8>>2]=o.getHours(),F[t+12>>2]=o.getDate(),F[t+16>>2]=o.getMonth(),F[t+20>>2]=o.getFullYear()-1900,F[t+24>>2]=o.getDay();var a=0|ge(o);F[t+28>>2]=a,F[t+36>>2]=-60*o.getTimezoneOffset();var i=new Date(o.getFullYear(),0,1),s=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),l=0|(s!=u&&o.getTimezoneOffset()==Math.min(u,s));F[t+32>>2]=l},m:function(e){var r=(()=>{var r=new Date(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=F[e+32>>2],n=r.getTimezoneOffset(),o=new Date(r.getFullYear(),0,1),a=new Date(r.getFullYear(),6,1).getTimezoneOffset(),i=o.getTimezoneOffset(),s=Math.min(i,a);if(t<0)F[e+32>>2]=Number(a!=i&&s==n);else if(t>0!=(s==n)){var u=Math.max(i,a),l=t>0?s:u;r.setTime(r.getTime()+6e4*(l-n))}F[e+24>>2]=r.getDay();var c=0|ge(r);F[e+28>>2]=c,F[e>>2]=r.getSeconds(),F[e+4>>2]=r.getMinutes(),F[e+8>>2]=r.getHours(),F[e+12>>2]=r.getDate(),F[e+16>>2]=r.getMonth(),F[e+20>>2]=r.getYear();var d=r.getTime();return isNaN(d)?(he(61),-1):d/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},n:function(e){var r=(()=>{var r=Date.UTC(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=new Date(r);F[e+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),o=(t.getTime()-n)/864e5|0;return F[e+28>>2]=o,t.getTime()/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},r:(e,r,t)=>{var n=(new Date).getFullYear(),o=new Date(n,0,1),a=new Date(n,6,1),i=o.getTimezoneOffset(),s=a.getTimezoneOffset(),u=Math.max(i,s);function l(e){var r=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return r?r[1]:"GMT"}D[e>>2]=60*u,F[r>>2]=Number(i!=s);var c=l(o),d=l(a),h=ye(c),f=ye(d);s>2]=h,D[t+4>>2]=f):(D[t>>2]=f,D[t+4>>2]=h)},b:()=>{O("")},c:()=>Date.now(),h:(e,r,t)=>k.copyWithin(e,r,r+t),p:e=>{var r=k.length,t=2147483648;if((e>>>=0)>t)return!1;for(var n,o,a=1;a<=4;a*=2){var i=r*(1+.2/a);i=Math.min(i,e+100663296);var s=Math.min(t,(n=Math.max(e,i))+((o=65536)-n%o)%o);if(Ee(s))return!0}return!1},z:(e,r)=>{var t=0;return ke().forEach(((n,o)=>{var a=r+t;D[e+4*o>>2]=a,((e,r)=>{for(var t=0;t>0]=e.charCodeAt(t);E[r>>0]=0})(n,a),t+=n.length+1})),0},A:(e,r)=>{var t=ke();D[e>>2]=t.length;var n=0;return t.forEach((e=>n+=e.length+1)),D[r>>2]=n,0},g:Fe,e:function(e){try{var r=de.getStreamFromFD(e);return le.close(r),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},j:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],s=D[r+4>>2];r+=8;var u=le.read(e,E,i,s,n);if(u<0)return-1;if(o+=u,u>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},o:function(e,r,t,n,o){var a=me(r,t);try{if(isNaN(a))return 61;var i=de.getStreamFromFD(e);return le.llseek(i,a,n),I=[i.position>>>0,(j=i.position,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[o>>2]=I[0],F[o+4>>2]=I[1],i.getdents&&0===a&&0===n&&(i.getdents=null),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},d:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],s=D[r+4>>2];r+=8;var u=le.write(e,E,i,s,n);if(u<0)return-1;o+=u,void 0!==n&&(n+=u)}return o})(de.getStreamFromFD(e),r,t);return D[n>>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},f:(e,r,t,n)=>{var o=D[n+40>>2],a={tm_sec:F[n>>2],tm_min:F[n+4>>2],tm_hour:F[n+8>>2],tm_mday:F[n+12>>2],tm_mon:F[n+16>>2],tm_year:F[n+20>>2],tm_wday:F[n+24>>2],tm_yday:F[n+28>>2],tm_isdst:F[n+32>>2],tm_gmtoff:F[n+36>>2],tm_zone:o?ce(o):""},i=ce(t),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in s)i=i.replace(new RegExp(u,"g"),s[u]);var l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,r,t){for(var n="number"==typeof e?e.toString():e||"";n.length0?1:0}var n;return 0===(n=t(e.getFullYear()-r.getFullYear()))&&0===(n=t(e.getMonth()-r.getMonth()))&&(n=t(e.getDate()-r.getDate())),n}function m(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function p(e){var r=((e,r)=>{for(var t=new Date(e.getTime());r>0;){var n=pe(t.getFullYear()),o=t.getMonth(),a=(n?De:Me)[o];if(!(r>a-t.getDate()))return t.setDate(t.getDate()+r),t;r-=a-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return t})(new Date(e.tm_year+1900,0,1),e.tm_yday),t=new Date(r.getFullYear(),0,4),n=new Date(r.getFullYear()+1,0,4),o=m(t),a=m(n);return f(o,r)<=0?f(a,r)<=0?r.getFullYear()+1:r.getFullYear():r.getFullYear()-1}var v={"%a":e=>l[e.tm_wday].substring(0,3),"%A":e=>l[e.tm_wday],"%b":e=>c[e.tm_mon].substring(0,3),"%B":e=>c[e.tm_mon],"%C":e=>h((e.tm_year+1900)/100|0,2),"%d":e=>h(e.tm_mday,2),"%e":e=>d(e.tm_mday,2," "),"%g":e=>p(e).toString().substring(2),"%G":e=>p(e),"%H":e=>h(e.tm_hour,2),"%I":e=>{var r=e.tm_hour;return 0==r?r=12:r>12&&(r-=12),h(r,2)},"%j":e=>h(e.tm_mday+((e,r)=>{for(var t=0,n=0;n<=r;t+=e[n++]);return t})(pe(e.tm_year+1900)?De:Me,e.tm_mon-1),3),"%m":e=>h(e.tm_mon+1,2),"%M":e=>h(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>h(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var r=e.tm_yday+7-e.tm_wday;return h(Math.floor(r/7),2)},"%V":e=>{var r=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&r++,r){if(53==r){var t=(e.tm_wday+371-e.tm_yday)%7;4==t||3==t&&pe(e.tm_year)||(r=1)}}else{r=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&pe(e.tm_year%400-1))&&r++}return h(r,2)},"%w":e=>e.tm_wday,"%W":e=>{var r=e.tm_yday+7-(e.tm_wday+6)%7;return h(Math.floor(r/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var r=e.tm_gmtoff,t=r>=0;return r=(r=Math.abs(r)/60)/60*100+r%60,(t?"+":"-")+String("0000"+r).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var u in i=i.replace(/%%/g,"\0\0"),v)i.includes(u)&&(i=i.replace(new RegExp(u,"g"),v[u](a)));var w=ne(i=i.replace(/\0\0/g,"%"),!1);return w.length>r?0:(Ae(w,e),w.length-1)}},Le=function(){var e,r,o,a,i={a:ze};function s(e,r){var t;return Le=e.exports,g=Le.C,C(),t=Le.D,T.unshift(t),x(),Le}if(L(),n.instantiateWasm)try{return n.instantiateWasm(i,s)}catch(e){y(`Module.instantiateWasm callback failed with error: ${e}`),t(e)}return(e=w,r=N,o=i,a=function(e){s(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||H(r)||Y(r)||h||"function"!=typeof fetch?K(r,o,a):fetch(r,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,o).then(a,(function(e){return y(`wasm streaming compile failed: ${e}`),y("falling back to ArrayBuffer instantiation"),K(r,o,a)}))))).catch(t),{}}();n._get_version=()=>(n._get_version=Le.E)(),n._archive_open=(e,r,t,o)=>(n._archive_open=Le.F)(e,r,t,o),n._archive_read_add_passphrase=(e,r)=>(n._archive_read_add_passphrase=Le.G)(e,r),n._archive_error_string=e=>(n._archive_error_string=Le.H)(e),n._get_next_entry=e=>(n._get_next_entry=Le.I)(e),n._get_filedata=(e,r)=>(n._get_filedata=Le.J)(e,r);var xe=n._malloc=e=>(xe=n._malloc=Le.K)(e);n._archive_close=e=>(n._archive_close=Le.L)(e),n._start_archive_write=(e,r,t,o,a,i)=>(n._start_archive_write=Le.M)(e,r,t,o,a,i),n._write_archive_file=(e,r,t,o)=>(n._write_archive_file=Le.N)(e,r,t,o),n._size_of_size_t=()=>(n._size_of_size_t=Le.O)(),n._free=e=>(n._free=Le.P)(e);var Oe=()=>(Oe=Le.Q)();n._archive_entry_birthtime_nsec=e=>(n._archive_entry_birthtime_nsec=Le.R)(e),n._archive_entry_filetype=e=>(n._archive_entry_filetype=Le.S)(e),n._archive_entry_mtime_nsec=e=>(n._archive_entry_mtime_nsec=Le.T)(e),n._archive_entry_pathname=e=>(n._archive_entry_pathname=Le.U)(e),n._archive_entry_pathname_utf8=e=>(n._archive_entry_pathname_utf8=Le.V)(e),n._archive_entry_size=e=>(n._archive_entry_size=Le.W)(e),n._archive_entry_is_encrypted=e=>(n._archive_entry_is_encrypted=Le.X)(e),n._archive_read_has_encrypted_entries=e=>(n._archive_read_has_encrypted_entries=Le.Y)(e),n._archive_read_data_skip=e=>(n._archive_read_data_skip=Le.Z)(e),n._archive_write_close=e=>(n._archive_write_close=Le.$)(e),n._archive_write_free=e=>(n._archive_write_free=Le.aa)(e);var Ne,Be=e=>(Be=Le.ba)(e),je=()=>(je=Le.ca)(),Ie=e=>(Ie=Le.da)(e),He=e=>(He=Le.ea)(e);function Ye(){function e(){Ne||(Ne=!0,n.calledRun=!0,M||(n.noFSInit||le.init.initialized||le.init(),le.ignorePermissions=!1,fe.root=le.mount(fe,{},null),q(T),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),R.unshift(e);var e;q(R)}()))}U>0||(function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)e=n.preRun.shift(),P.unshift(e);var e;q(P)}(),U>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.cwrap=(e,r,t,n)=>{var o=!t||t.every((e=>"number"===e||"boolean"===e));return"string"!==r&&o&&!n?Ce(e):function(){return Pe(e,r,t,arguments)}},n.UTF8ToString=ce,n.intArrayFromString=ne,n.allocate=(e,r)=>{var t;return t=1==r?He(e.length):xe(e.length),e.subarray||e.slice||(e=new Uint8Array(e)),k.set(e,t),t},z=function e(){Ne||Ye(),Ne||(z=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return Ye(),e.ready});class S{constructor(){this.preRun=[],this.postRun=[],this.totalDependencies=0}print(...e){console.log(e)}printErr(...e){console.error(e)}initFunctions(){this.runCode={getVersion:this.cwrap("get_version","string",[]),openArchive:this.cwrap("archive_open","number",["number","number","string","string"]),getNextEntry:this.cwrap("get_next_entry","number",["number"]),getFileData:this.cwrap("get_filedata","number",["number","number"]),skipEntry:this.cwrap("archive_read_data_skip","number",["number"]),closeArchive:this.cwrap("archive_close",null,["number"]),getEntrySize:this.cwrap("archive_entry_size","number",["number"]),getEntryName:this.cwrap("archive_entry_pathname","string",["number"]),getEntryType:this.cwrap("archive_entry_filetype","number",["number"]),getEntryLastModified:this.cwrap("archive_entry_mtime_nsec","number",["number"]),getError:this.cwrap("archive_error_string","string",["number"]),startArchiveWrite:this.cwrap("start_archive_write","number",["string","string","number","number","number","string"]),writeArchiveFile:this.cwrap("write_archive_file",null,["number","string","number","number"]),closeArchiveWrite:this.cwrap("archive_write_close","number",["number"]),freeArchiveWrite:this.cwrap("archive_write_free","number",["number"]),entryIsEncrypted:this.cwrap("archive_entry_is_encrypted","number",["number"]),hasEncryptedEntries:this.cwrap("archive_read_has_encrypted_entries","number",["number"]),addPassphrase:this.cwrap("archive_read_add_passphrase","number",["number","string"]),string:e=>this.allocate(this.intArrayFromString(e),"i8",0),malloc:this.cwrap("malloc","number",["number"]),free:this.cwrap("free",null,["number"]),sizeOfSizeT:this.cwrap("size_of_size_t","number",[])}}monitorRunDependencies(){}}let F=null,D=null,M=!1;class A{constructor(e){A.readyCallback=e,M&&setTimeout((()=>e()),0)}open(e,r){F.open(e).then((()=>r()))}listFiles(){let e=[];for(const r of F.entries(!0))e.push(r);return e}extractFiles(){let e=[];for(const r of F.entries(!1))e.push(r);return e}extractSingleFile(e){for(const r of F.entries(!0,e))if(r.fileData)return r}hasEncryptedData(){return F.hasEncryptedData()}usePassword(e){F.setPassphrase(e)}setLocale(e){F.setLocale(e)}writeArchive(e,r,t,n){return D.write(e,r,t,n)}close(){F.close()}}var C;C=e=>{F=new y(e),D=new E(e),A?.readyCallback?.(),M=!0},k(new S).then((e=>{e.initFunctions(),C(e)})),s(A); diff --git a/examples/esbuild/index.html b/examples/esbuild/index.html new file mode 100644 index 0000000..637272b --- /dev/null +++ b/examples/esbuild/index.html @@ -0,0 +1,10 @@ + + + + libarchive example + + + + + + diff --git a/examples/esbuild/index.js b/examples/esbuild/index.js new file mode 100644 index 0000000..62a77e7 --- /dev/null +++ b/examples/esbuild/index.js @@ -0,0 +1,16 @@ +import { Archive } from "libarchive.js/dist/libarchive.js"; + +window.Archive = Archive; + +document.getElementById("file").addEventListener("change", async (e) => { + let obj = null; + try { + const file = e.currentTarget.files[0]; + const archive = await Archive.open(file); + console.log(await archive.getFilesObject()); + obj = await archive.extractFiles(); + console.log(await archive.getFilesObject()); + } catch (err) { + console.error(err); + } +}); diff --git a/examples/esbuild/package-lock.json b/examples/esbuild/package-lock.json new file mode 100644 index 0000000..d9abca5 --- /dev/null +++ b/examples/esbuild/package-lock.json @@ -0,0 +1,886 @@ +{ + "name": "esbuild", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "esbuild", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "esbuild": "^0.19.12", + "esbuild-plugin-copy": "^2.1.1", + "libarchive.js": "^2.0.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", + "integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", + "integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", + "integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", + "integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", + "integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", + "integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", + "integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", + "integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", + "integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", + "integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", + "integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", + "integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", + "integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", + "integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", + "integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", + "integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", + "integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", + "integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", + "integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", + "integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", + "integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", + "integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", + "integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/comlink": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/comlink/-/comlink-4.4.1.tgz", + "integrity": "sha512-+1dlx0aY5Jo1vHy/tSsIGpSkN4tS9rZSW8FIhG0JH/crs9wwweswIo/POr451r7bZww3hFbPAKnTpimzL/mm4Q==" + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/esbuild": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", + "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.19.12", + "@esbuild/android-arm": "0.19.12", + "@esbuild/android-arm64": "0.19.12", + "@esbuild/android-x64": "0.19.12", + "@esbuild/darwin-arm64": "0.19.12", + "@esbuild/darwin-x64": "0.19.12", + "@esbuild/freebsd-arm64": "0.19.12", + "@esbuild/freebsd-x64": "0.19.12", + "@esbuild/linux-arm": "0.19.12", + "@esbuild/linux-arm64": "0.19.12", + "@esbuild/linux-ia32": "0.19.12", + "@esbuild/linux-loong64": "0.19.12", + "@esbuild/linux-mips64el": "0.19.12", + "@esbuild/linux-ppc64": "0.19.12", + "@esbuild/linux-riscv64": "0.19.12", + "@esbuild/linux-s390x": "0.19.12", + "@esbuild/linux-x64": "0.19.12", + "@esbuild/netbsd-x64": "0.19.12", + "@esbuild/openbsd-x64": "0.19.12", + "@esbuild/sunos-x64": "0.19.12", + "@esbuild/win32-arm64": "0.19.12", + "@esbuild/win32-ia32": "0.19.12", + "@esbuild/win32-x64": "0.19.12" + } + }, + "node_modules/esbuild-plugin-copy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/esbuild-plugin-copy/-/esbuild-plugin-copy-2.1.1.tgz", + "integrity": "sha512-Bk66jpevTcV8KMFzZI1P7MZKZ+uDcrZm2G2egZ2jNIvVnivDpodZI+/KnpL3Jnap0PBdIHU7HwFGB8r+vV5CVw==", + "dependencies": { + "chalk": "^4.1.2", + "chokidar": "^3.5.3", + "fs-extra": "^10.0.1", + "globby": "^11.0.3" + }, + "peerDependencies": { + "esbuild": ">= 0.14.0" + } + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fastq": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", + "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ignore": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/libarchive.js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/libarchive.js/-/libarchive.js-2.0.0.tgz", + "integrity": "sha512-agiHQQ8TRBqzdn0e73eFBAh/eCOGReNxzSVHjFYudH1DLahDjmD951iPQ34qxwTmSYLdZGp9KnCUAgSSQfP5tw==", + "dependencies": { + "comlink": "^4.4.1" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "engines": { + "node": ">= 10.0.0" + } + } + } +} diff --git a/examples/esbuild/package.json b/examples/esbuild/package.json new file mode 100644 index 0000000..66a70e6 --- /dev/null +++ b/examples/esbuild/package.json @@ -0,0 +1,18 @@ +{ + "name": "esbuild", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "build": "node build.mjs", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "esbuild": "^0.19.12", + "esbuild-plugin-copy": "^2.1.1", + "libarchive.js": "^2.0.0" + } +} diff --git a/examples/webpack/dist/17743d7689365518c17b.js b/examples/webpack/dist/17743d7689365518c17b.js new file mode 100644 index 0000000..b789823 --- /dev/null +++ b/examples/webpack/dist/17743d7689365518c17b.js @@ -0,0 +1,2 @@ +/*! For license information please see 17743d7689365518c17b.js.LICENSE.txt */ +const e=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),t=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),o=Symbol("Comlink.thrown"),a=e=>"object"==typeof e&&null!==e||"function"==typeof e,i=new Map([["proxy",{canHandle:r=>a(r)&&r[e],serialize(e){const{port1:r,port2:t}=new MessageChannel;return s(e,r),[t,[t]]},deserialize:e=>(e.start(),f(e,[],void 0))}],["throw",{canHandle:e=>a(e)&&o in e,serialize({value:e}){let r;return r=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[r,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function s(r,t=globalThis,a=["*"]){t.addEventListener("message",(function i(l){if(!l||!l.data)return;if(!function(e,r){for(const t of e){if(r===t||"*"===t)return!0;if(t instanceof RegExp&&t.test(r))return!0}return!1}(a,l.origin))return void console.warn(`Invalid origin '${l.origin}' for comlink proxy`);const{id:c,type:d,path:h}=Object.assign({path:[]},l.data),f=(l.data.argumentList||[]).map(w);let m;try{const t=h.slice(0,-1).reduce(((e,r)=>e[r]),r),n=h.reduce(((e,r)=>e[r]),r);switch(d){case"GET":m=n;break;case"SET":t[h.slice(-1)[0]]=w(l.data.value),m=!0;break;case"APPLY":m=n.apply(t,f);break;case"CONSTRUCT":m=function(r){return Object.assign(r,{[e]:!0})}(new n(...f));break;case"ENDPOINT":{const{port1:e,port2:t}=new MessageChannel;s(r,t),m=function(e,r){return p.set(e,r),e}(e,[e])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[o]:0}}Promise.resolve(m).catch((e=>({value:e,[o]:0}))).then((e=>{const[o,a]=v(e);t.postMessage(Object.assign(Object.assign({},o),{id:c}),a),"RELEASE"===d&&(t.removeEventListener("message",i),u(t),n in r&&"function"==typeof r[n]&&r[n]())})).catch((e=>{const[r,n]=v({value:new TypeError("Unserializable return value"),[o]:0});t.postMessage(Object.assign(Object.assign({},r),{id:c}),n)}))})),t.start&&t.start()}function u(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function l(e){if(e)throw new Error("Proxy has been released and is not useable")}function c(e){return g(e,{type:"RELEASE"}).then((()=>{u(e)}))}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const r=(d.get(e)||0)-1;d.set(e,r),0===r&&c(e)}));function f(e,n=[],o=function(){}){let a=!1;const i=new Proxy(o,{get(r,o){if(l(a),o===t)return()=>{!function(e){h&&h.unregister(e)}(i),c(e),a=!0};if("then"===o){if(0===n.length)return{then:()=>i};const r=g(e,{type:"GET",path:n.map((e=>e.toString()))}).then(w);return r.then.bind(r)}return f(e,[...n,o])},set(r,t,o){l(a);const[i,s]=v(o);return g(e,{type:"SET",path:[...n,t].map((e=>e.toString())),value:i},s).then(w)},apply(t,o,i){l(a);const s=n[n.length-1];if(s===r)return g(e,{type:"ENDPOINT"}).then(w);if("bind"===s)return f(e,n.slice(0,-1));const[u,c]=m(i);return g(e,{type:"APPLY",path:n.map((e=>e.toString())),argumentList:u},c).then(w)},construct(r,t){l(a);const[o,i]=m(t);return g(e,{type:"CONSTRUCT",path:n.map((e=>e.toString())),argumentList:o},i).then(w)}});return function(e,r){const t=(d.get(r)||0)+1;d.set(r,t),h&&h.register(e,r,e)}(i,e),i}function m(e){const r=e.map(v);return[r.map((e=>e[0])),(t=r.map((e=>e[1])),Array.prototype.concat.apply([],t))];var t}const p=new WeakMap;function v(e){for(const[r,t]of i)if(t.canHandle(e)){const[n,o]=t.serialize(e);return[{type:"HANDLER",name:r,value:n},o]}return[{type:"RAW",value:e},p.get(e)||[]]}function w(e){switch(e.type){case"HANDLER":return i.get(e.name).deserialize(e.value);case"RAW":return e.value}}function g(e,r,t){return new Promise((n=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function r(t){t.data&&t.data.id&&t.data.id===o&&(e.removeEventListener("message",r),n(t.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},r),t)}))}const _={32768:"FILE",16384:"DIR",40960:"SYMBOLIC_LINK",49152:"SOCKET",8192:"CHARACTER_DEVICE",24576:"BLOCK_DEVICE",4096:"NAMED_PIPE"};class y{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._file=null,this._passphrase=null,this._locale="en_US.UTF-8"}async open(e){null!==this._file&&(console.warn("Closing previous file"),this.close());const r=await this._loadFile(e);this._fileLength=r.length,this._filePtr=r.ptr}close(){this._runCode.closeArchive(this._archive),this._wasmModule._free(this._filePtr),this._file=null,this._filePtr=null,this._archive=null}hasEncryptedData(){this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale),this._runCode.getNextEntry(this._archive);const e=this._runCode.hasEncryptedEntries(this._archive);return 0!==e&&(e>0||null)}setPassphrase(e){this._passphrase=e}setLocale(e){this._locale=e}*entries(e=!1,r=null){let t;for(this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale);t=this._runCode.getNextEntry(this._archive),0!==t;){const n={size:this._runCode.getEntrySize(t),path:this._runCode.getEntryName(t),type:_[this._runCode.getEntryType(t)],lastModified:this._runCode.getEntryLastModified(t),ref:t};if("FILE"===n.type){let e=n.path.split("/");n.fileName=e[e.length-1]}if(e&&r!==n.path)this._runCode.skipEntry(this._archive);else{const e=this._runCode.getFileData(this._archive,n.size);if(e<0)throw new Error(this._runCode.getError(this._archive));n.fileData=this._wasmModule.HEAPU8.slice(e,e+n.size),this._wasmModule._free(e)}yield n}}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}}class E{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._passphrase=null,this._locale="en_US.UTF-8"}async write(e,r,t,n=null){let o=e.reduce(((e,{file:r})=>e+r.size),0)+512;const a=this._runCode.malloc(o),i=this._runCode.malloc(this._runCode.sizeOfSizeT()),s=this._runCode.startArchiveWrite(r,t,a,o,i,n);for(const{file:r,pathname:t}of e){const e=await this._loadFile(r);this._runCode.writeArchiveFile(s,t||r.name,e.length,e.ptr),this._runCode.free(e.ptr)}const u=this._runCode.closeArchiveWrite(s),l=this._runCode.freeArchiveWrite(s);if(0!==u||0!==l)throw new Error(this._runCode.getError(s));const c=this.readNumberFromPointer(i);return this._wasmModule.HEAPU8.slice(a,a+c)}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}readNumberFromPointer(e){const r=this._runCode.sizeOfSizeT(),t=this._wasmModule.HEAPU8.slice(e,e+r);let n=null;if(4==r)n=new Uint32Array(t)[0];else{if(8!=r)throw Error("Unexpected size of size_t: "+r);n=new BigUint64Array(t)[0]}return n}}var b,k=(b=import.meta.url,async function(e={}){var r,t,n=e;n.ready=new Promise(((e,n)=>{r=e,t=n}));var o,a,i,s=Object.assign({},n),u="./this.program",l=(e,r)=>{throw r},c="object"==typeof window,d="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";if(h){const{createRequire:e}=await import("module");var m=e(import.meta.url),p=m("fs"),v=m("path");f=d?v.dirname(f)+"/":m("url").fileURLToPath(new URL("./",import.meta.url)),o=(e,r)=>(e=Y(e)?new URL(e):v.normalize(e),p.readFileSync(e,r?void 0:"utf8")),i=e=>{var r=o(e,!0);return r.buffer||(r=new Uint8Array(r)),r},a=(e,r,t,n=!0)=>{e=Y(e)?new URL(e):v.normalize(e),p.readFile(e,n?void 0:"utf8",((e,o)=>{e?t(e):r(n?o.buffer:o)}))},!n.thisProgram&&process.argv.length>1&&(u=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),l=(e,r)=>{throw process.exitCode=e,r},n.inspect=()=>"[Emscripten Module object]"}else(c||d)&&(d?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),b&&(f=b),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},d&&(i=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),a=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?r(n.response):t()},n.onerror=t,n.send(null)});var w,g,_=n.print||console.log.bind(console),y=n.printErr||console.error.bind(console);Object.assign(n,s),s=null,n.arguments&&n.arguments,n.thisProgram&&(u=n.thisProgram),n.quit&&(l=n.quit),n.wasmBinary&&(w=n.wasmBinary),"object"!=typeof WebAssembly&&O("no native wasm support detected");var E,k,F,S,D,M=!1;function A(e,r){e||O(r)}function C(){var e=g.buffer;n.HEAP8=E=new Int8Array(e),n.HEAP16=F=new Int16Array(e),n.HEAPU8=k=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAP32=S=new Int32Array(e),n.HEAPU32=D=new Uint32Array(e),n.HEAPF32=new Float32Array(e),n.HEAPF64=new Float64Array(e)}var P=[],T=[],R=[],U=0,z=null;function L(e){U++,n.monitorRunDependencies?.(U)}function x(e){if(U--,n.monitorRunDependencies?.(U),0==U&&z){var r=z;z=null,r()}}function O(e){n.onAbort?.(e),y(e="Aborted("+e+")"),M=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw t(r),r}var N,B,j,I,H=e=>e.startsWith("data:application/octet-stream;base64,"),Y=e=>e.startsWith("file://");function W(e){if(e==N&&w)return new Uint8Array(w);if(i)return i(e);throw"both async and sync fetching of the wasm failed"}function K(e,r,t){return function(e){if(!w&&(c||d)){if("function"==typeof fetch&&!Y(e))return fetch(e,{credentials:"same-origin"}).then((r=>{if(!r.ok)throw"failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()})).catch((()=>W(e)));if(a)return new Promise(((r,t)=>{a(e,(e=>r(new Uint8Array(e))),t)}))}return Promise.resolve().then((()=>W(e)))}(e).then((e=>WebAssembly.instantiate(e,r))).then((e=>e)).then(t,(e=>{y(`failed to asynchronously prepare wasm: ${e}`),O(e)}))}function $(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}n.locateFile?H(N="libarchive.wasm")||(B=N,N=n.locateFile?n.locateFile(B,f):f+B):N=new URL("libarchive.wasm",import.meta.url).href;var q=e=>{for(;e.length>0;)e.shift()(n)},X=n.noExitRuntime||!0,Z={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=Z.isAbs(e),t="/"===e.substr(-1);return(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=Z.splitPath(e),t=r[0],n=r[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:e=>{if("/"===e)return"/";var r=(e=(e=Z.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===r?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments);return Z.normalize(e.join("/"))},join2:(e,r)=>Z.normalize(e+"/"+r)},G=e=>(G=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return r=>e.randomFillSync(r);var r=e.randomBytes;return e=>(e.set(r(e.byteLength)),e)}catch(e){}O("initRandomDevice")})())(e),V={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:le.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=Z.isAbs(n)}return(r?"/":"")+(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,r)=>{function t(e){for(var r=0;r=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=V.resolve(e).substr(1),r=V.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.split("/")),a=Math.min(n.length,o.length),i=a,s=0;s{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&J)return J.decode(e.subarray(r,o));for(var a="";r>10,56320|1023&l)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},ee=[],re=e=>{for(var r=0,t=0;t=55296&&n<=57343?(r+=4,++t):r+=3}return r},te=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,i=0;i=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),s<=127){if(t>=a)break;r[t++]=s}else if(s<=2047){if(t+1>=a)break;r[t++]=192|s>>6,r[t++]=128|63&s}else if(s<=65535){if(t+2>=a)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(t+3>=a)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o};function ne(e,r,t){var n=t>0?t:re(e)+1,o=new Array(n),a=te(e,o,0,o.length);return r&&(o.length=a),o}var oe={ttys:[],init(){},shutdown(){},register(e,r){oe.ttys[e]={input:[],output:[],ops:r},le.registerDevice(e,oe.stream_ops)},stream_ops:{open(e){var r=oe.ttys[e.node.rdev];if(!r)throw new le.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new le.ErrnoError(60);for(var a=0,i=0;i(()=>{if(!ee.length){var e=null;if(h){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=p.readSync(n,r)}catch(e){if(!e.toString().includes("EOF"))throw e;t=0}e=t>0?r.slice(0,t).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;ee=ne(e,!0)}return ee.shift()})(),put_char(e,r){null===r||10===r?(_(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(_(Q(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,r,t)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,r){null===r||10===r?(y(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(y(Q(e.output,0)),e.output=[])}}},ae=e=>{O()},ie={ops_table:null,mount:e=>ie.createNode(null,"/",16895,0),createNode(e,r,t,n){if(le.isBlkdev(t)||le.isFIFO(t))throw new le.ErrnoError(63);ie.ops_table||={dir:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr,lookup:ie.node_ops.lookup,mknod:ie.node_ops.mknod,rename:ie.node_ops.rename,unlink:ie.node_ops.unlink,rmdir:ie.node_ops.rmdir,readdir:ie.node_ops.readdir,symlink:ie.node_ops.symlink},stream:{llseek:ie.stream_ops.llseek}},file:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr},stream:{llseek:ie.stream_ops.llseek,read:ie.stream_ops.read,write:ie.stream_ops.write,allocate:ie.stream_ops.allocate,mmap:ie.stream_ops.mmap,msync:ie.stream_ops.msync}},link:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr,readlink:ie.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr},stream:le.chrdev_stream_ops}};var o=le.createNode(e,r,t,n);return le.isDir(o.mode)?(o.node_ops=ie.ops_table.dir.node,o.stream_ops=ie.ops_table.dir.stream,o.contents={}):le.isFile(o.mode)?(o.node_ops=ie.ops_table.file.node,o.stream_ops=ie.ops_table.file.stream,o.usedBytes=0,o.contents=null):le.isLink(o.mode)?(o.node_ops=ie.ops_table.link.node,o.stream_ops=ie.ops_table.link.stream):le.isChrdev(o.mode)&&(o.node_ops=ie.ops_table.chrdev.node,o.stream_ops=ie.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){r=Math.max(r,t*(t<1048576?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var n=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(0==r)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=le.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,le.isDir(e.mode)?r.size=4096:le.isFile(e.mode)?r.size=e.usedBytes:le.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp),void 0!==r.size&&ie.resizeFileStorage(e,r.size)},lookup(e,r){throw le.genericErrors[44]},mknod:(e,r,t,n)=>ie.createNode(e,r,t,n),rename(e,r,t){if(le.isDir(e.mode)){var n;try{n=le.lookupNode(r,t)}catch(e){}if(n)for(var o in n.contents)throw new le.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp,e.parent=r},unlink(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=le.lookupNode(e,r);for(var n in t.contents)throw new le.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=ie.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!le.isLink(e.mode))throw new le.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var i=Math.min(e.node.usedBytes-o,n);if(i>8&&a.subarray)r.set(a.subarray(o,o+i),t);else for(var s=0;s0||t+r(ie.stream_ops.write(e,r,0,n,t,!1),0)}},se=n.preloadPlugins||[],ue=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},le={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e,r={}){if(!(e=V.resolve(e)))return{path:"",node:null};if((r=Object.assign({follow_mount:!0,recurse_count:0},r)).recurse_count>8)throw new le.ErrnoError(32);for(var t=e.split("/").filter((e=>!!e)),n=le.root,o="/",a=0;a40)throw new le.ErrnoError(32)}}return{path:o,node:n}},getPath(e){for(var r;;){if(le.isRoot(e)){var t=e.mount.mountpoint;return r?"/"!==t[t.length-1]?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n>>0)%le.nameTable.length},hashAddNode(e){var r=le.hashName(e.parent.id,e.name);e.name_next=le.nameTable[r],le.nameTable[r]=e},hashRemoveNode(e){var r=le.hashName(e.parent.id,e.name);if(le.nameTable[r]===e)le.nameTable[r]=e.name_next;else for(var t=le.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=le.mayLookup(e);if(t)throw new le.ErrnoError(t,e);for(var n=le.hashName(e.id,r),o=le.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===r)return o}return le.lookup(e,r)},createNode(e,r,t,n){var o=new le.FSNode(e,r,t,n);return le.hashAddNode(o),o},destroyNode(e){le.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>le.ignorePermissions||(!r.includes("r")||292&e.mode)&&(!r.includes("w")||146&e.mode)&&(!r.includes("x")||73&e.mode)?0:2,mayLookup:e=>le.nodePermissions(e,"x")||(e.node_ops.lookup?0:2),mayCreate(e,r){try{return le.lookupNode(e,r),20}catch(e){}return le.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=le.lookupNode(e,r)}catch(e){return e.errno}var o=le.nodePermissions(e,"wx");if(o)return o;if(t){if(!le.isDir(n.mode))return 54;if(le.isRoot(n)||le.getPath(n)===le.cwd())return 10}else if(le.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?le.isLink(e.mode)?32:le.isDir(e.mode)&&("r"!==le.flagsToPermissionString(r)||512&r)?31:le.nodePermissions(e,le.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=le.MAX_OPEN_FDS;e++)if(!le.streams[e])return e;throw new le.ErrnoError(33)},getStreamChecked(e){var r=le.getStream(e);if(!r)throw new le.ErrnoError(8);return r},getStream:e=>le.streams[e],createStream:(e,r=-1)=>(le.FSStream||(le.FSStream=function(){this.shared={}},le.FSStream.prototype={},Object.defineProperties(le.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new le.FSStream,e),-1==r&&(r=le.nextfd()),e.fd=r,le.streams[r]=e,e),closeStream(e){le.streams[e]=null},chrdev_stream_ops:{open(e){var r=le.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new le.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice(e,r){le.devices[e]={stream_ops:r}},getDevice:e=>le.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs(e,r){"function"==typeof e&&(r=e,e=!1),le.syncFSRequests++,le.syncFSRequests>1&&y(`warning: ${le.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=le.getMounts(le.root.mount),n=0;function o(e){return le.syncFSRequests--,r(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,o(e));++n>=t.length&&o(null)}t.forEach((r=>{if(!r.type.syncfs)return a(null);r.type.syncfs(r,e,a)}))},mount(e,r,t){var n,o="/"===t,a=!t;if(o&&le.root)throw new le.ErrnoError(10);if(!o&&!a){var i=le.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,le.isMountpoint(n))throw new le.ErrnoError(10);if(!le.isDir(n.mode))throw new le.ErrnoError(54)}var s={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?le.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(e){var r=le.lookupPath(e,{follow_mount:!1});if(!le.isMountpoint(r.node))throw new le.ErrnoError(28);var t=r.node,n=t.mounted,o=le.getMounts(n);Object.keys(le.nameTable).forEach((e=>{for(var r=le.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&le.destroyNode(r),r=t}})),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod(e,r,t){var n=le.lookupPath(e,{parent:!0}).node,o=Z.basename(e);if(!o||"."===o||".."===o)throw new le.ErrnoError(28);var a=le.mayCreate(n,o);if(a)throw new le.ErrnoError(a);if(!n.node_ops.mknod)throw new le.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:(e,r)=>(r=void 0!==r?r:438,r&=4095,r|=32768,le.mknod(e,r,0)),mkdir:(e,r)=>(r=void 0!==r?r:511,r&=1023,r|=16384,le.mknod(e,r,0)),mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o(void 0===t&&(t=r,r=438),r|=8192,le.mknod(e,r,t)),symlink(e,r){if(!V.resolve(e))throw new le.ErrnoError(44);var t=le.lookupPath(r,{parent:!0}).node;if(!t)throw new le.ErrnoError(44);var n=Z.basename(r),o=le.mayCreate(t,n);if(o)throw new le.ErrnoError(o);if(!t.node_ops.symlink)throw new le.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename(e,r){var t,n,o=Z.dirname(e),a=Z.dirname(r),i=Z.basename(e),s=Z.basename(r);if(t=le.lookupPath(e,{parent:!0}).node,n=le.lookupPath(r,{parent:!0}).node,!t||!n)throw new le.ErrnoError(44);if(t.mount!==n.mount)throw new le.ErrnoError(75);var u,l=le.lookupNode(t,i),c=V.relative(e,a);if("."!==c.charAt(0))throw new le.ErrnoError(28);if("."!==(c=V.relative(r,o)).charAt(0))throw new le.ErrnoError(55);try{u=le.lookupNode(n,s)}catch(e){}if(l!==u){var d=le.isDir(l.mode),h=le.mayDelete(t,i,d);if(h)throw new le.ErrnoError(h);if(h=u?le.mayDelete(n,s,d):le.mayCreate(n,s))throw new le.ErrnoError(h);if(!t.node_ops.rename)throw new le.ErrnoError(63);if(le.isMountpoint(l)||u&&le.isMountpoint(u))throw new le.ErrnoError(10);if(n!==t&&(h=le.nodePermissions(t,"w")))throw new le.ErrnoError(h);le.hashRemoveNode(l);try{t.node_ops.rename(l,n,s)}catch(e){throw e}finally{le.hashAddNode(l)}}},rmdir(e){var r=le.lookupPath(e,{parent:!0}).node,t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!0);if(o)throw new le.ErrnoError(o);if(!r.node_ops.rmdir)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.rmdir(r,t),le.destroyNode(n)},readdir(e){var r=le.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new le.ErrnoError(54);return r.node_ops.readdir(r)},unlink(e){var r=le.lookupPath(e,{parent:!0}).node;if(!r)throw new le.ErrnoError(44);var t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!1);if(o)throw new le.ErrnoError(o);if(!r.node_ops.unlink)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.unlink(r,t),le.destroyNode(n)},readlink(e){var r=le.lookupPath(e).node;if(!r)throw new le.ErrnoError(44);if(!r.node_ops.readlink)throw new le.ErrnoError(28);return V.resolve(le.getPath(r.parent),r.node_ops.readlink(r))},stat(e,r){var t=le.lookupPath(e,{follow:!r}).node;if(!t)throw new le.ErrnoError(44);if(!t.node_ops.getattr)throw new le.ErrnoError(63);return t.node_ops.getattr(t)},lstat:e=>le.stat(e,!0),chmod(e,r,t){var n;if(!(n="string"==typeof e?le.lookupPath(e,{follow:!t}).node:e).node_ops.setattr)throw new le.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod(e,r){le.chmod(e,r,!0)},fchmod(e,r){var t=le.getStreamChecked(e);le.chmod(t.node,r)},chown(e,r,t,n){var o;if(!(o="string"==typeof e?le.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new le.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){le.chown(e,r,t,!0)},fchown(e,r,t){var n=le.getStreamChecked(e);le.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new le.ErrnoError(28);var t;if(!(t="string"==typeof e?le.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new le.ErrnoError(63);if(le.isDir(t.mode))throw new le.ErrnoError(31);if(!le.isFile(t.mode))throw new le.ErrnoError(28);var n=le.nodePermissions(t,"w");if(n)throw new le.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=le.getStreamChecked(e);if(0==(2097155&t.flags))throw new le.ErrnoError(28);le.truncate(t.node,r)},utime(e,r,t){var n=le.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open(e,r,t){if(""===e)throw new le.ErrnoError(44);var o;if(t=void 0===t?438:t,t=64&(r="string"==typeof r?(e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===r)throw new Error(`Unknown file open mode: ${e}`);return r})(r):r)?4095&t|32768:0,"object"==typeof e)o=e;else{e=Z.normalize(e);try{o=le.lookupPath(e,{follow:!(131072&r)}).node}catch(e){}}var a=!1;if(64&r)if(o){if(128&r)throw new le.ErrnoError(20)}else o=le.mknod(e,t,0),a=!0;if(!o)throw new le.ErrnoError(44);if(le.isChrdev(o.mode)&&(r&=-513),65536&r&&!le.isDir(o.mode))throw new le.ErrnoError(54);if(!a){var i=le.mayOpen(o,r);if(i)throw new le.ErrnoError(i)}512&r&&!a&&le.truncate(o,0),r&=-131713;var s=le.createStream({node:o,path:le.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!n.logReadFiles||1&r||(le.readFiles||(le.readFiles={}),e in le.readFiles||(le.readFiles[e]=1)),s},close(e){if(le.isClosed(e))throw new le.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{le.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new le.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new le.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(1==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.read)throw new le.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var i=e.stream_ops.read(e,r,t,n,o);return a||(e.position+=i),i},write(e,r,t,n,o,a){if(n<0||o<0)throw new le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.write)throw new le.ErrnoError(28);e.seekable&&1024&e.flags&&le.llseek(e,0,2);var i=void 0!==o;if(i){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var s=e.stream_ops.write(e,r,t,n,o,a);return i||(e.position+=s),s},allocate(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(r<0||t<=0)throw new le.ErrnoError(28);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(!le.isFile(e.node.mode)&&!le.isDir(e.node.mode))throw new le.ErrnoError(43);if(!e.stream_ops.allocate)throw new le.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if(0!=(2&n)&&0==(2&o)&&2!=(2097155&e.flags))throw new le.ErrnoError(2);if(1==(2097155&e.flags))throw new le.ErrnoError(2);if(!e.stream_ops.mmap)throw new le.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync:(e,r,t,n,o)=>e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0,munmap:e=>0,ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new le.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=le.open(e,r.flags),o=le.stat(e).size,a=new Uint8Array(o);return le.read(n,a,0,o,0),"utf8"===r.encoding?t=Q(a,0):"binary"===r.encoding&&(t=a),le.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=le.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(re(r)+1),a=te(r,o,0,o.length);le.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");le.write(n,r,0,r.byteLength,void 0,t.canOwn)}le.close(n)},cwd:()=>le.currentPath,chdir(e){var r=le.lookupPath(e,{follow:!0});if(null===r.node)throw new le.ErrnoError(44);if(!le.isDir(r.node.mode))throw new le.ErrnoError(54);var t=le.nodePermissions(r.node,"x");if(t)throw new le.ErrnoError(t);le.currentPath=r.path},createDefaultDirectories(){le.mkdir("/tmp"),le.mkdir("/home"),le.mkdir("/home/web_user")},createDefaultDevices(){le.mkdir("/dev"),le.registerDevice(le.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n}),le.mkdev("/dev/null",le.makedev(1,3)),oe.register(le.makedev(5,0),oe.default_tty_ops),oe.register(le.makedev(6,0),oe.default_tty1_ops),le.mkdev("/dev/tty",le.makedev(5,0)),le.mkdev("/dev/tty1",le.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(0===r&&(r=G(e).byteLength),e[--r]);le.createDevice("/dev","random",t),le.createDevice("/dev","urandom",t),le.mkdir("/dev/shm"),le.mkdir("/dev/shm/tmp")},createSpecialDirectories(){le.mkdir("/proc");var e=le.mkdir("/proc/self");le.mkdir("/proc/self/fd"),le.mount({mount(){var r=le.createNode(e,"fd",16895,73);return r.node_ops={lookup(e,r){var t=+r,n=le.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},r}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?le.createDevice("/dev","stdin",n.stdin):le.symlink("/dev/tty","/dev/stdin"),n.stdout?le.createDevice("/dev","stdout",null,n.stdout):le.symlink("/dev/tty","/dev/stdout"),n.stderr?le.createDevice("/dev","stderr",null,n.stderr):le.symlink("/dev/tty1","/dev/stderr"),le.open("/dev/stdin",0),le.open("/dev/stdout",1),le.open("/dev/stderr",1)},ensureErrnoError(){le.ErrnoError||(le.ErrnoError=function(e,r){this.name="ErrnoError",this.node=r,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},le.ErrnoError.prototype=new Error,le.ErrnoError.prototype.constructor=le.ErrnoError,[44].forEach((e=>{le.genericErrors[e]=new le.ErrnoError(e),le.genericErrors[e].stack=""})))},staticInit(){le.ensureErrnoError(),le.nameTable=new Array(4096),le.mount(ie,{},"/"),le.createDefaultDirectories(),le.createDefaultDevices(),le.createSpecialDirectories(),le.filesystems={MEMFS:ie}},init(e,r,t){le.init.initialized=!0,le.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=r||n.stdout,n.stderr=t||n.stderr,le.createStandardStreams()},quit(){le.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var r=e%this.chunkSize,t=e/this.chunkSize|0;return this.getter(t)[r]}},a.prototype.setDataGetter=function(e){this.getter=e},a.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",t,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+t+". Status: "+e.status);var r,n=Number(e.getResponseHeader("Content-length")),o=(r=e.getResponseHeader("Accept-Ranges"))&&"bytes"===r,a=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,i=1048576;o||(i=n);var s=this;s.setDataGetter((e=>{var r=e*i,o=(e+1)*i-1;if(o=Math.min(o,n-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,r)=>{if(e>r)throw new Error("invalid range ("+e+", "+r+") or no bytes requested!");if(r>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",t,!1),n!==i&&o.setRequestHeader("Range","bytes="+e+"-"+r),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+t+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):ne(o.responseText||"",!0)})(r,o)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!a&&n||(i=n=1,n=this.getter(0).length,i=n,_("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!d)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i=new a;Object.defineProperties(i,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:i}}else s={isDevice:!1,url:t};var u=le.createFile(e,r,s,n,o);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,r,t,n,o){var a=e.node.contents;if(o>=a.length)return 0;var i=Math.min(a.length-o,n);if(a.slice)for(var s=0;s{var r=u.stream_ops[e];l[e]=function(){return le.forceLoadFile(u),r.apply(null,arguments)}})),l.read=(e,r,t,n,o)=>(le.forceLoadFile(u),c(e,r,t,n,o)),l.mmap=(e,r,t,n,o)=>{le.forceLoadFile(u);var a=ae();if(!a)throw new le.ErrnoError(48);return c(e,E,a,r,t),{ptr:a,allocated:!0}},u.stream_ops=l,u}},ce=(e,r)=>e?Q(k,e,r):"",de={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(Z.isAbs(r))return r;var n;if(n=-100===e?le.cwd():de.getStreamFromFD(e).path,0==r.length){if(!t)throw new le.ErrnoError(44);return n}return Z.join2(n,r)},doStat(e,r,t){try{var n=e(r)}catch(e){if(e&&e.node&&Z.normalize(r)!==Z.normalize(le.getPath(e.node)))return-54;throw e}S[t>>2]=n.dev,S[t+4>>2]=n.mode,D[t+8>>2]=n.nlink,S[t+12>>2]=n.uid,S[t+16>>2]=n.gid,S[t+20>>2]=n.rdev,I=[n.size>>>0,(j=n.size,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],S[t+24>>2]=I[0],S[t+28>>2]=I[1],S[t+32>>2]=4096,S[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),i=n.ctime.getTime();return I=[Math.floor(o/1e3)>>>0,(j=Math.floor(o/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],S[t+40>>2]=I[0],S[t+44>>2]=I[1],D[t+48>>2]=o%1e3*1e3,I=[Math.floor(a/1e3)>>>0,(j=Math.floor(a/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],S[t+56>>2]=I[0],S[t+60>>2]=I[1],D[t+64>>2]=a%1e3*1e3,I=[Math.floor(i/1e3)>>>0,(j=Math.floor(i/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],S[t+72>>2]=I[0],S[t+76>>2]=I[1],D[t+80>>2]=i%1e3*1e3,I=[n.ino>>>0,(j=n.ino,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],S[t+88>>2]=I[0],S[t+92>>2]=I[1],0},doMsync(e,r,t,n,o){if(!le.isFile(r.node.mode))throw new le.ErrnoError(43);if(2&n)return 0;var a=k.slice(e,e+t);le.msync(r,a,o,t,n)},varargs:void 0,get(){var e=S[+de.varargs>>2];return de.varargs+=4,e},getp:()=>de.get(),getStr:e=>ce(e),getStreamFromFD:e=>le.getStreamChecked(e)},he=e=>(S[Re()>>2]=e,e),fe={BUCKET_BUFFER_SIZE:8192,mount:e=>le.createNode(null,"/",16895,0),createPipe(){var e={buckets:[],refcnt:2};e.buckets.push({buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var r=fe.nextname(),t=fe.nextname(),n=le.createNode(fe.root,r,4096,0),o=le.createNode(fe.root,t,4096,0);n.pipe=e,o.pipe=e;var a=le.createStream({path:r,node:n,flags:0,seekable:!1,stream_ops:fe.stream_ops});n.stream=a;var i=le.createStream({path:t,node:o,flags:1,seekable:!1,stream_ops:fe.stream_ops});return o.stream=i,{readable_fd:a.fd,writable_fd:i.fd}},stream_ops:{poll(e){var r=e.node.pipe;if(1==(2097155&e.flags))return 260;if(r.buckets.length>0)for(var t=0;t0)return 65}return 0},ioctl:(e,r,t)=>28,fsync:e=>28,read(e,r,t,n,o){for(var a=e.node.pipe,i=0,s=0;s=s)return u.buffer.set(i,u.offset),u.offset+=s,s;l>0&&(u.buffer.set(i.subarray(0,l),u.offset),u.offset+=l,i=i.subarray(l,i.byteLength));for(var c=i.byteLength/fe.BUCKET_BUFFER_SIZE|0,d=i.byteLength%fe.BUCKET_BUFFER_SIZE,h=0;h0&&(f={buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:i.byteLength,roffset:0},a.buckets.push(f),f.buffer.set(i)),s},close(e){var r=e.node.pipe;r.refcnt--,0===r.refcnt&&(r.buckets=null)}},nextname:()=>(fe.nextname.current||(fe.nextname.current=0),"pipe["+fe.nextname.current+++"]")},me=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*r:NaN,pe=e=>e%4==0&&(e%100!=0||e%400==0),ve=[0,31,60,91,121,152,182,213,244,274,305,335],we=[0,31,59,90,120,151,181,212,243,273,304,334],ge=e=>(pe(e.getFullYear())?ve:we)[e.getMonth()]+e.getDate()-1,_e=(e,r,t)=>te(e,k,r,t),ye=e=>{var r=re(e)+1,t=Te(r);return t&&_e(e,t,r),t},Ee=e=>{var r=(e-g.buffer.byteLength+65535)/65536;try{return g.grow(r),C(),1}catch(e){}},be={},ke=()=>{if(!ke.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var r in be)void 0===be[r]?delete e[r]:e[r]=be[r];var t=[];for(var r in e)t.push(`${r}=${e[r]}`);ke.strings=t}return ke.strings},Fe=[31,29,31,30,31,30,31,31,30,31,30,31],Se=[31,28,31,30,31,30,31,31,30,31,30,31],De=(e,r)=>{E.set(e,r)},Me=e=>n["_"+e],Ae=function(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=le.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n};Object.defineProperties(Ae.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return le.isDir(this.mode)}},isDevice:{get:function(){return le.isChrdev(this.mode)}}}),le.FSNode=Ae,le.createPreloadedFile=(e,r,t,n,o,i,s,u,l,c)=>{var d=r?V.resolve(Z.join2(e,r)):e;function h(t){function a(t){c?.(),u||((e,r,t,n,o,a)=>{le.createDataFile(e,r,t,n,o,a)})(e,r,t,n,o,l),i?.(),x()}((e,r,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return se.forEach((a=>{o||a.canHandle(r)&&(a.handle(e,r,t,n),o=!0)})),o})(t,d,a,(()=>{s?.(),x()}))||a(t)}L(),"string"==typeof t?((e,r,t,n)=>{var o=`al ${e}`;a(e,(r=>{A(r,`Loading data file "${e}" failed (no arrayBuffer).`),(e=>{h(e)})(new Uint8Array(r)),o&&x()}),(r=>{if(!t)throw`Loading data file "${e}" failed.`;t()})),o&&L()})(t,0,s):h(t)},le.staticInit();var Ce={i:function(e){try{var r=de.getStreamFromFD(e);return le.createStream(r).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},a:function(e,r,t){de.varargs=t;try{var n=de.getStreamFromFD(e);switch(r){case 0:if((o=de.get())<0)return-28;for(;le.streams[o];)o++;return le.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=de.get();return n.flags|=o,0;case 5:return o=de.getp(),F[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return he(28),-1}}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},x:function(e,r){try{var t=de.getStreamFromFD(e);return de.doStat(le.stat,t.path,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},u:function(e,r){try{return e=de.getStr(e),de.doStat(le.lstat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},v:function(e,r,t,n){try{r=de.getStr(r);var o=256&n,a=4096&n;return n&=-6401,r=de.calculateAt(e,r,a),de.doStat(o?le.lstat:le.stat,r,t)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},y:function(e,r,t,n){de.varargs=n;try{r=de.getStr(r),r=de.calculateAt(e,r);var o=n?de.get():0;return le.open(r,t,o).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},t:function(e){try{if(0==e)throw new le.ErrnoError(21);var r=fe.createPipe();return S[e>>2]=r.readable_fd,S[e+4>>2]=r.writable_fd,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},s:function(e,r,t){try{for(var n=0,o=0;o>2],s=F[a+4>>1],u=32,l=le.getStream(i);l&&(u=de.DEFAULT_POLLMASK,l.stream_ops.poll&&(u=l.stream_ops.poll(l,-1))),(u&=24|s)&&n++,F[a+6>>1]=u}return n}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},w:function(e,r){try{return e=de.getStr(e),de.doStat(le.stat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},q:function(e,r,t){try{return r=de.getStr(r),r=de.calculateAt(e,r),0===t?le.unlink(r):512===t?le.rmdir(r):O("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},B:()=>1,k:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);S[t>>2]=o.getUTCSeconds(),S[t+4>>2]=o.getUTCMinutes(),S[t+8>>2]=o.getUTCHours(),S[t+12>>2]=o.getUTCDate(),S[t+16>>2]=o.getUTCMonth(),S[t+20>>2]=o.getUTCFullYear()-1900,S[t+24>>2]=o.getUTCDay();var a=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),i=(o.getTime()-a)/864e5|0;S[t+28>>2]=i},l:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);S[t>>2]=o.getSeconds(),S[t+4>>2]=o.getMinutes(),S[t+8>>2]=o.getHours(),S[t+12>>2]=o.getDate(),S[t+16>>2]=o.getMonth(),S[t+20>>2]=o.getFullYear()-1900,S[t+24>>2]=o.getDay();var a=0|ge(o);S[t+28>>2]=a,S[t+36>>2]=-60*o.getTimezoneOffset();var i=new Date(o.getFullYear(),0,1),s=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),l=0|(s!=u&&o.getTimezoneOffset()==Math.min(u,s));S[t+32>>2]=l},m:function(e){var r=(()=>{var r=new Date(S[e+20>>2]+1900,S[e+16>>2],S[e+12>>2],S[e+8>>2],S[e+4>>2],S[e>>2],0),t=S[e+32>>2],n=r.getTimezoneOffset(),o=new Date(r.getFullYear(),0,1),a=new Date(r.getFullYear(),6,1).getTimezoneOffset(),i=o.getTimezoneOffset(),s=Math.min(i,a);if(t<0)S[e+32>>2]=Number(a!=i&&s==n);else if(t>0!=(s==n)){var u=Math.max(i,a),l=t>0?s:u;r.setTime(r.getTime()+6e4*(l-n))}S[e+24>>2]=r.getDay();var c=0|ge(r);S[e+28>>2]=c,S[e>>2]=r.getSeconds(),S[e+4>>2]=r.getMinutes(),S[e+8>>2]=r.getHours(),S[e+12>>2]=r.getDate(),S[e+16>>2]=r.getMonth(),S[e+20>>2]=r.getYear();var d=r.getTime();return isNaN(d)?(he(61),-1):d/1e3})();return ze((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},n:function(e){var r=(()=>{var r=Date.UTC(S[e+20>>2]+1900,S[e+16>>2],S[e+12>>2],S[e+8>>2],S[e+4>>2],S[e>>2],0),t=new Date(r);S[e+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),o=(t.getTime()-n)/864e5|0;return S[e+28>>2]=o,t.getTime()/1e3})();return ze((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},r:(e,r,t)=>{var n=(new Date).getFullYear(),o=new Date(n,0,1),a=new Date(n,6,1),i=o.getTimezoneOffset(),s=a.getTimezoneOffset(),u=Math.max(i,s);function l(e){var r=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return r?r[1]:"GMT"}D[e>>2]=60*u,S[r>>2]=Number(i!=s);var c=l(o),d=l(a),h=ye(c),f=ye(d);s>2]=h,D[t+4>>2]=f):(D[t>>2]=f,D[t+4>>2]=h)},b:()=>{O("")},c:()=>Date.now(),h:(e,r,t)=>k.copyWithin(e,r,r+t),p:e=>{var r=k.length,t=2147483648;if((e>>>=0)>t)return!1;for(var n,o=1;o<=4;o*=2){var a=r*(1+.2/o);a=Math.min(a,e+100663296);var i=Math.min(t,(n=Math.max(e,a))+(65536-n%65536)%65536);if(Ee(i))return!0}return!1},z:(e,r)=>{var t=0;return ke().forEach(((n,o)=>{var a=r+t;D[e+4*o>>2]=a,((e,r)=>{for(var t=0;t>0]=e.charCodeAt(t);E[r>>0]=0})(n,a),t+=n.length+1})),0},A:(e,r)=>{var t=ke();D[e>>2]=t.length;var n=0;return t.forEach((e=>n+=e.length+1)),D[r>>2]=n,0},g:(e,r)=>{(e=>{X||(n.onExit?.(e),M=!0),l(e,new $(e))})(e)},e:function(e){try{var r=de.getStreamFromFD(e);return le.close(r),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},j:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],s=D[r+4>>2];r+=8;var u=le.read(e,E,i,s,n);if(u<0)return-1;if(o+=u,u>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},o:function(e,r,t,n,o){var a=me(r,t);try{if(isNaN(a))return 61;var i=de.getStreamFromFD(e);return le.llseek(i,a,n),I=[i.position>>>0,(j=i.position,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],S[o>>2]=I[0],S[o+4>>2]=I[1],i.getdents&&0===a&&0===n&&(i.getdents=null),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},d:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],s=D[r+4>>2];r+=8;var u=le.write(e,E,i,s,n);if(u<0)return-1;o+=u,void 0!==n&&(n+=u)}return o})(de.getStreamFromFD(e),r,t);return D[n>>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},f:(e,r,t,n)=>{var o=D[n+40>>2],a={tm_sec:S[n>>2],tm_min:S[n+4>>2],tm_hour:S[n+8>>2],tm_mday:S[n+12>>2],tm_mon:S[n+16>>2],tm_year:S[n+20>>2],tm_wday:S[n+24>>2],tm_yday:S[n+28>>2],tm_isdst:S[n+32>>2],tm_gmtoff:S[n+36>>2],tm_zone:o?ce(o):""},i=ce(t),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in s)i=i.replace(new RegExp(u,"g"),s[u]);var l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,r,t){for(var n="number"==typeof e?e.toString():e||"";n.length0?1:0}var n;return 0===(n=t(e.getFullYear()-r.getFullYear()))&&0===(n=t(e.getMonth()-r.getMonth()))&&(n=t(e.getDate()-r.getDate())),n}function m(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function p(e){var r=((e,r)=>{for(var t=new Date(e.getTime());r>0;){var n=pe(t.getFullYear()),o=t.getMonth(),a=(n?Fe:Se)[o];if(!(r>a-t.getDate()))return t.setDate(t.getDate()+r),t;r-=a-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return t})(new Date(e.tm_year+1900,0,1),e.tm_yday),t=new Date(r.getFullYear(),0,4),n=new Date(r.getFullYear()+1,0,4),o=m(t),a=m(n);return f(o,r)<=0?f(a,r)<=0?r.getFullYear()+1:r.getFullYear():r.getFullYear()-1}var v={"%a":e=>l[e.tm_wday].substring(0,3),"%A":e=>l[e.tm_wday],"%b":e=>c[e.tm_mon].substring(0,3),"%B":e=>c[e.tm_mon],"%C":e=>h((e.tm_year+1900)/100|0,2),"%d":e=>h(e.tm_mday,2),"%e":e=>d(e.tm_mday,2," "),"%g":e=>p(e).toString().substring(2),"%G":e=>p(e),"%H":e=>h(e.tm_hour,2),"%I":e=>{var r=e.tm_hour;return 0==r?r=12:r>12&&(r-=12),h(r,2)},"%j":e=>h(e.tm_mday+((e,r)=>{for(var t=0,n=0;n<=r;t+=e[n++]);return t})(pe(e.tm_year+1900)?Fe:Se,e.tm_mon-1),3),"%m":e=>h(e.tm_mon+1,2),"%M":e=>h(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>h(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var r=e.tm_yday+7-e.tm_wday;return h(Math.floor(r/7),2)},"%V":e=>{var r=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&r++,r){if(53==r){var t=(e.tm_wday+371-e.tm_yday)%7;4==t||3==t&&pe(e.tm_year)||(r=1)}}else{r=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&pe(e.tm_year%400-1))&&r++}return h(r,2)},"%w":e=>e.tm_wday,"%W":e=>{var r=e.tm_yday+7-(e.tm_wday+6)%7;return h(Math.floor(r/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var r=e.tm_gmtoff,t=r>=0;return r=(r=Math.abs(r)/60)/60*100+r%60,(t?"+":"-")+String("0000"+r).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var u in i=i.replace(/%%/g,"\0\0"),v)i.includes(u)&&(i=i.replace(new RegExp(u,"g"),v[u](a)));var w=ne(i=i.replace(/\0\0/g,"%"),!1);return w.length>r?0:(De(w,e),w.length-1)}},Pe=function(){var e,r,o,a,i={a:Ce};function s(e,r){var t;return Pe=e.exports,g=Pe.C,C(),t=Pe.D,T.unshift(t),x(),Pe}if(L(),n.instantiateWasm)try{return n.instantiateWasm(i,s)}catch(e){y(`Module.instantiateWasm callback failed with error: ${e}`),t(e)}return(e=w,r=N,o=i,a=function(e){s(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||H(r)||Y(r)||h||"function"!=typeof fetch?K(r,o,a):fetch(r,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,o).then(a,(function(e){return y(`wasm streaming compile failed: ${e}`),y("falling back to ArrayBuffer instantiation"),K(r,o,a)}))))).catch(t),{}}();n._get_version=()=>(n._get_version=Pe.E)(),n._archive_open=(e,r,t,o)=>(n._archive_open=Pe.F)(e,r,t,o),n._archive_read_add_passphrase=(e,r)=>(n._archive_read_add_passphrase=Pe.G)(e,r),n._archive_error_string=e=>(n._archive_error_string=Pe.H)(e),n._get_next_entry=e=>(n._get_next_entry=Pe.I)(e),n._get_filedata=(e,r)=>(n._get_filedata=Pe.J)(e,r);var Te=n._malloc=e=>(Te=n._malloc=Pe.K)(e);n._archive_close=e=>(n._archive_close=Pe.L)(e),n._start_archive_write=(e,r,t,o,a,i)=>(n._start_archive_write=Pe.M)(e,r,t,o,a,i),n._write_archive_file=(e,r,t,o)=>(n._write_archive_file=Pe.N)(e,r,t,o),n._size_of_size_t=()=>(n._size_of_size_t=Pe.O)(),n._free=e=>(n._free=Pe.P)(e);var Re=()=>(Re=Pe.Q)();n._archive_entry_birthtime_nsec=e=>(n._archive_entry_birthtime_nsec=Pe.R)(e),n._archive_entry_filetype=e=>(n._archive_entry_filetype=Pe.S)(e),n._archive_entry_mtime_nsec=e=>(n._archive_entry_mtime_nsec=Pe.T)(e),n._archive_entry_pathname=e=>(n._archive_entry_pathname=Pe.U)(e),n._archive_entry_pathname_utf8=e=>(n._archive_entry_pathname_utf8=Pe.V)(e),n._archive_entry_size=e=>(n._archive_entry_size=Pe.W)(e),n._archive_entry_is_encrypted=e=>(n._archive_entry_is_encrypted=Pe.X)(e),n._archive_read_has_encrypted_entries=e=>(n._archive_read_has_encrypted_entries=Pe.Y)(e),n._archive_read_data_skip=e=>(n._archive_read_data_skip=Pe.Z)(e),n._archive_write_close=e=>(n._archive_write_close=Pe.$)(e),n._archive_write_free=e=>(n._archive_write_free=Pe.aa)(e);var Ue,ze=e=>(ze=Pe.ba)(e),Le=()=>(Le=Pe.ca)(),xe=e=>(xe=Pe.da)(e),Oe=e=>(Oe=Pe.ea)(e);function Ne(){function e(){Ue||(Ue=!0,n.calledRun=!0,M||(n.noFSInit||le.init.initialized||le.init(),le.ignorePermissions=!1,fe.root=le.mount(fe,{},null),q(T),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),R.unshift(e);var e;q(R)}()))}U>0||(function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)e=n.preRun.shift(),P.unshift(e);var e;q(P)}(),U>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.cwrap=(e,r,t,n)=>{var o=!t||t.every((e=>"number"===e||"boolean"===e));return"string"!==r&&o&&!n?Me(e):function(){return((e,r,t,n,o)=>{var a={string:e=>{var r=0;return null!=e&&0!==e&&(r=(e=>{var r=re(e)+1,t=Oe(r);return _e(e,t,r),t})(e)),r},array:e=>{var r=Oe(e.length);return De(e,r),r}},i=Me(e),s=[],u=0;if(n)for(var l=0;l{var t;return t=1==r?Oe(e.length):Te(e.length),e.subarray||e.slice||(e=new Uint8Array(e)),k.set(e,t),t},z=function e(){Ue||Ne(),Ue||(z=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return Ne(),e.ready});class S{constructor(){this.preRun=[],this.postRun=[],this.totalDependencies=0}print(...e){console.log(e)}printErr(...e){console.error(e)}initFunctions(){this.runCode={getVersion:this.cwrap("get_version","string",[]),openArchive:this.cwrap("archive_open","number",["number","number","string","string"]),getNextEntry:this.cwrap("get_next_entry","number",["number"]),getFileData:this.cwrap("get_filedata","number",["number","number"]),skipEntry:this.cwrap("archive_read_data_skip","number",["number"]),closeArchive:this.cwrap("archive_close",null,["number"]),getEntrySize:this.cwrap("archive_entry_size","number",["number"]),getEntryName:this.cwrap("archive_entry_pathname","string",["number"]),getEntryType:this.cwrap("archive_entry_filetype","number",["number"]),getEntryLastModified:this.cwrap("archive_entry_mtime_nsec","number",["number"]),getError:this.cwrap("archive_error_string","string",["number"]),startArchiveWrite:this.cwrap("start_archive_write","number",["string","string","number","number","number","string"]),writeArchiveFile:this.cwrap("write_archive_file",null,["number","string","number","number"]),closeArchiveWrite:this.cwrap("archive_write_close","number",["number"]),freeArchiveWrite:this.cwrap("archive_write_free","number",["number"]),entryIsEncrypted:this.cwrap("archive_entry_is_encrypted","number",["number"]),hasEncryptedEntries:this.cwrap("archive_read_has_encrypted_entries","number",["number"]),addPassphrase:this.cwrap("archive_read_add_passphrase","number",["number","string"]),string:e=>this.allocate(this.intArrayFromString(e),"i8",0),malloc:this.cwrap("malloc","number",["number"]),free:this.cwrap("free",null,["number"]),sizeOfSizeT:this.cwrap("size_of_size_t","number",[])}}monitorRunDependencies(){}}let F=null,D=null,M=!1;class A{constructor(e){A.readyCallback=e,M&&setTimeout((()=>e()),0)}open(e,r){F.open(e).then((()=>r()))}listFiles(){let e=[];for(const r of F.entries(!0))e.push(r);return e}extractFiles(){let e=[];for(const r of F.entries(!1))e.push(r);return e}extractSingleFile(e){for(const r of F.entries(!0,e))if(r.fileData)return r}hasEncryptedData(){return F.hasEncryptedData()}usePassword(e){F.setPassphrase(e)}setLocale(e){F.setLocale(e)}writeArchive(e,r,t,n){return D.write(e,r,t,n)}close(){F.close()}}var C;C=e=>{F=new y(e),D=new E(e),A?.readyCallback?.(),M=!0},k(new S).then((e=>{e.initFunctions(),C(e)})),s(A); \ No newline at end of file diff --git a/examples/webpack/dist/17743d7689365518c17b.js.LICENSE.txt b/examples/webpack/dist/17743d7689365518c17b.js.LICENSE.txt new file mode 100644 index 0000000..479a8e5 --- /dev/null +++ b/examples/webpack/dist/17743d7689365518c17b.js.LICENSE.txt @@ -0,0 +1,5 @@ +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ diff --git a/examples/webpack/dist/index.js b/examples/webpack/dist/index.js new file mode 100644 index 0000000..6064367 --- /dev/null +++ b/examples/webpack/dist/index.js @@ -0,0 +1,2 @@ +/*! For license information please see index.js.LICENSE.txt */ +(()=>{"use strict";var e={350:(e,t,n)=>{e.exports=n.p+"17743d7689365518c17b.js"}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}n.m=e,n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&!e;)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),n.b=document.baseURI||self.location.href,(()=>{const e=Symbol("Comlink.proxy"),t=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),i=Symbol("Comlink.finalizer"),s=Symbol("Comlink.thrown"),a=e=>"object"==typeof e&&null!==e||"function"==typeof e,o=new Map([["proxy",{canHandle:t=>a(t)&&t[e],serialize(e){const{port1:t,port2:n}=new MessageChannel;return c(e,t),[n,[n]]},deserialize:e=>(e.start(),u(e))}],["throw",{canHandle:e=>a(e)&&s in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function c(e,t=globalThis,n=["*"]){t.addEventListener("message",(function r(a){if(!a||!a.data)return;if(!function(e,t){for(const n of e){if(t===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin '${a.origin}' for comlink proxy`);const{id:o,type:u,path:p}=Object.assign({path:[]},a.data),h=(a.data.argumentList||[]).map(E);let f;try{const t=p.slice(0,-1).reduce(((e,t)=>e[t]),e),n=p.reduce(((e,t)=>e[t]),e);switch(u){case"GET":f=n;break;case"SET":t[p.slice(-1)[0]]=E(a.data.value),f=!0;break;case"APPLY":f=n.apply(t,h);break;case"CONSTRUCT":f=y(new n(...h));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;c(e,n),f=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":f=void 0;break;default:return}}catch(e){f={value:e,[s]:0}}Promise.resolve(f).catch((e=>({value:e,[s]:0}))).then((n=>{const[s,a]=v(n);t.postMessage(Object.assign(Object.assign({},s),{id:o}),a),"RELEASE"===u&&(t.removeEventListener("message",r),l(t),i in e&&"function"==typeof e[i]&&e[i]())})).catch((e=>{const[n,r]=v({value:new TypeError("Unserializable return value"),[s]:0});t.postMessage(Object.assign(Object.assign({},n),{id:o}),r)}))})),t.start&&t.start()}function l(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e,t){return g(e,[],t)}function p(e){if(e)throw new Error("Proxy has been released and is not useable")}function h(e){return b(e,{type:"RELEASE"}).then((()=>{l(e)}))}const f=new WeakMap,d="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(f.get(e)||0)-1;f.set(e,t),0===t&&h(e)}));function g(e,n=[],i=function(){}){let s=!1;const a=new Proxy(i,{get(t,i){if(p(s),i===r)return()=>{!function(e){d&&d.unregister(e)}(a),h(e),s=!0};if("then"===i){if(0===n.length)return{then:()=>a};const t=b(e,{type:"GET",path:n.map((e=>e.toString()))}).then(E);return t.then.bind(t)}return g(e,[...n,i])},set(t,r,i){p(s);const[a,o]=v(i);return b(e,{type:"SET",path:[...n,r].map((e=>e.toString())),value:a},o).then(E)},apply(r,i,a){p(s);const o=n[n.length-1];if(o===t)return b(e,{type:"ENDPOINT"}).then(E);if("bind"===o)return g(e,n.slice(0,-1));const[c,l]=m(a);return b(e,{type:"APPLY",path:n.map((e=>e.toString())),argumentList:c},l).then(E)},construct(t,r){p(s);const[i,a]=m(r);return b(e,{type:"CONSTRUCT",path:n.map((e=>e.toString())),argumentList:i},a).then(E)}});return function(e,t){const n=(f.get(t)||0)+1;f.set(t,n),d&&d.register(e,t,e)}(a,e),a}function m(e){const t=e.map(v);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const w=new WeakMap;function y(t){return Object.assign(t,{[e]:!0})}function v(e){for(const[t,n]of o)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},w.get(e)||[]]}function E(e){switch(e.type){case"HANDLER":return o.get(e.name).deserialize(e.value);case"RAW":return e.value}}function b(e,t,n){return new Promise((r=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===i&&(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)}))}class R{constructor(e,t,n,r,i){this._name=e,this._size=t,this._path=n,this._lastModified=r,this._archiveRef=i}get name(){return this._name}get size(){return this._size}get lastModified(){return this._lastModified}extract(){return this._archiveRef.extractSingleFile(this._path)}}function S(e){if(e instanceof File||e instanceof R||null===e)return e;const t={};for(const n of Object.keys(e))t[n]=S(e[n]);return t}function A(e,t=""){const n=[];for(const r of Object.keys(e))e[r]instanceof File||e[r]instanceof R||null===e[r]?n.push({file:e[r]||r,path:t}):n.push(...A(e[r],`${t}${r}/`));return n}function P(e,t){const n=t.split("/");""===n[n.length-1]&&n.pop();let r=e,i=null;for(const e of n)r[e]=r[e]||{},i=r,r=r[e];return[i,n[n.length-1]]}class _{constructor(e,t,n){this._content={},this._processed=0,this.file=e,this.client=t,this.worker=n}open(){return this._content={},this._processed=0,new Promise(((e,t)=>{this.client.open(this.file,y((()=>{e(this)})))}))}async close(){var e;null===(e=this.worker)||void 0===e||e.terminate(),this.worker=null,this.client=null,this.file=null}async hasEncryptedData(){return await this.client.hasEncryptedData()}async usePassword(e){await this.client.usePassword(e)}async setLocale(e){await this.client.setLocale(e)}async getFilesObject(){return this._processed>0?Promise.resolve().then((()=>this._content)):((await this.client.listFiles()).forEach((e=>{const[t,n]=P(this._content,e.path);"FILE"===e.type&&(t[n]=new R(e.fileName,e.size,e.path,e.lastModified,this))})),this._processed=1,S(this._content))}getFilesArray(){return this.getFilesObject().then((e=>A(e)))}async extractSingleFile(e){if(null===this.worker)throw new Error("Archive already closed");const t=await this.client.extractSingleFile(e);return new File([t.fileData],t.fileName,{type:"application/octet-stream",lastModified:t.lastModified/1e6})}async extractFiles(e=void 0){var t;return this._processed>1?Promise.resolve().then((()=>this._content)):((await this.client.extractFiles()).forEach((t=>{const[n,r]=P(this._content,t.path);"FILE"===t.type&&(n[r]=new File([t.fileData],t.fileName,{type:"application/octet-stream"}),void 0!==e&&setTimeout(e.bind(null,{file:n[r],path:t.path})))})),this._processed=2,null===(t=this.worker)||void 0===t||t.terminate(),S(this._content))}}var O,k;!function(e){e.SEVEN_ZIP="7zip",e.AR="ar",e.ARBSD="arbsd",e.ARGNU="argnu",e.ARSVR4="arsvr4",e.BIN="bin",e.BSDTAR="bsdtar",e.CD9660="cd9660",e.CPIO="cpio",e.GNUTAR="gnutar",e.ISO="iso",e.ISO9660="iso9660",e.MTREE="mtree",e.MTREE_CLASSIC="mtree-classic",e.NEWC="newc",e.ODC="odc",e.OLDTAR="oldtar",e.PAX="pax",e.PAXR="paxr",e.POSIX="posix",e.PWB="pwb",e.RAW="raw",e.RPAX="rpax",e.SHAR="shar",e.SHARDUMP="shardump",e.USTAR="ustar",e.V7TAR="v7tar",e.V7="v7",e.WARC="warc",e.XAR="xar",e.ZIP="zip"}(O||(O={})),function(e){e.B64ENCODE="b64encode",e.BZIP2="bzip2",e.COMPRESS="compress",e.GRZIP="grzip",e.GZIP="gzip",e.LRZIP="lrzip",e.LZ4="lz4",e.LZIP="lzip",e.LZMA="lzma",e.LZOP="lzop",e.UUENCODE="uuencode",e.XZ="xz",e.ZSTD="zstd",e.NONE="none"}(k||(k={}));class L{static init(e=null){return L._options=e||{},L._options}static async open(e){const t=L.getWorker(L._options),n=await L.getClient(t,L._options),r=new _(e,n,t);return await r.open()}static async write({files:e,outputFileName:t,compression:n,format:r,passphrase:i=null}){const s=L.getWorker(L._options),a=await L.getClient(s,L._options),o=await a.writeArchive(e,n,r,i);return s.terminate(),new File([o],t,{type:"application/octet-stream"})}static getWorker(e){return e.getWorker?e.getWorker():new Worker(e.workerUrl||new URL(n(350),n.b),{type:"module"})}static async getClient(e,t){var n;const r=(null===(n=t.createClient)||void 0===n?void 0:n.call(t,e))||u(e);let{promise:i,resolve:s}=Promise.withResolvers();const a=await new r(y((()=>{s()})));return await i,a}}L._options={},window.Archive=L,document.getElementById("file").addEventListener("change",(async e=>{let t=null;try{const n=e.currentTarget.files[0],r=await L.open(n);console.log(await r.getFilesObject()),t=await r.extractFiles(),console.log(await r.getFilesObject())}catch(e){console.error(e)}}))})()})(); \ No newline at end of file diff --git a/examples/webpack/dist/index.js.LICENSE.txt b/examples/webpack/dist/index.js.LICENSE.txt new file mode 100644 index 0000000..479a8e5 --- /dev/null +++ b/examples/webpack/dist/index.js.LICENSE.txt @@ -0,0 +1,5 @@ +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ diff --git a/examples/webpack/dist/libarchive.wasm b/examples/webpack/dist/libarchive.wasm new file mode 100644 index 0000000..9b9e93b Binary files /dev/null and b/examples/webpack/dist/libarchive.wasm differ diff --git a/examples/webpack/index.html b/examples/webpack/index.html new file mode 100644 index 0000000..637272b --- /dev/null +++ b/examples/webpack/index.html @@ -0,0 +1,10 @@ + + + + libarchive example + + + + + + diff --git a/examples/webpack/index.js b/examples/webpack/index.js new file mode 100644 index 0000000..62a77e7 --- /dev/null +++ b/examples/webpack/index.js @@ -0,0 +1,16 @@ +import { Archive } from "libarchive.js/dist/libarchive.js"; + +window.Archive = Archive; + +document.getElementById("file").addEventListener("change", async (e) => { + let obj = null; + try { + const file = e.currentTarget.files[0]; + const archive = await Archive.open(file); + console.log(await archive.getFilesObject()); + obj = await archive.extractFiles(); + console.log(await archive.getFilesObject()); + } catch (err) { + console.error(err); + } +}); diff --git a/examples/webpack/package-lock.json b/examples/webpack/package-lock.json new file mode 100644 index 0000000..83017f2 --- /dev/null +++ b/examples/webpack/package-lock.json @@ -0,0 +1,1670 @@ +{ + "name": "webpack", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "webpack", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "copy-webpack-plugin": "^12.0.2", + "libarchive.js": "^2.0.0", + "webpack": "^5.89.0", + "webpack-cli": "^5.1.4" + } + }, + "node_modules/@discoveryjs/json-ext": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", + "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", + "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", + "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@sindresorhus/merge-streams": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-1.0.0.tgz", + "integrity": "sha512-rUV5WyJrJLoloD4NDN1V1+LDMDWOa4OTsT4yYJwQNpTU6FWxkxHpL7eu4w+DmiH8x/EAM1otkPE1+LaspIbplw==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@types/eslint": { + "version": "8.56.2", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz", + "integrity": "sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw==", + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint-scope": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" + }, + "node_modules/@types/node": { + "version": "20.11.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.5.tgz", + "integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", + "integrity": "sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q==", + "dependencies": { + "@webassemblyjs/helper-numbers": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", + "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==" + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", + "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==" + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.6.tgz", + "integrity": "sha512-z3nFzdcp1mb8nEOFFk8DrYLpHvhKC3grJD2ardfKOzmbmJvEf/tPIqCY+sNcwZIY8ZD7IkB2l7/pqhUhqm7hLA==" + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", + "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.11.6", + "@webassemblyjs/helper-api-error": "1.11.6", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", + "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==" + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.6.tgz", + "integrity": "sha512-LPpZbSOwTpEC2cgn4hTydySy1Ke+XEu+ETXuoyvuyezHO3Kjdu90KK95Sh9xTbmjrCsUwvWwCOQQNta37VrS9g==", + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/helper-buffer": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/wasm-gen": "1.11.6" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", + "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", + "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", + "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==" + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.6.tgz", + "integrity": "sha512-Ybn2I6fnfIGuCR+Faaz7YcvtBKxvoLV3Lebn1tM4o/IAJzmi9AWYIPWpyBfU8cC+JxAO57bk4+zdsTjJR+VTOw==", + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/helper-buffer": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/helper-wasm-section": "1.11.6", + "@webassemblyjs/wasm-gen": "1.11.6", + "@webassemblyjs/wasm-opt": "1.11.6", + "@webassemblyjs/wasm-parser": "1.11.6", + "@webassemblyjs/wast-printer": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.6.tgz", + "integrity": "sha512-3XOqkZP/y6B4F0PBAXvI1/bky7GryoogUtfwExeP/v7Nzwo1QLcq5oQmpKlftZLbT+ERUOAZVQjuNVak6UXjPA==", + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/ieee754": "1.11.6", + "@webassemblyjs/leb128": "1.11.6", + "@webassemblyjs/utf8": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.6.tgz", + "integrity": "sha512-cOrKuLRE7PCe6AsOVl7WasYf3wbSo4CeOk6PkrjS7g57MFfVUF9u6ysQBBODX0LdgSvQqRiGz3CXvIDKcPNy4g==", + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/helper-buffer": "1.11.6", + "@webassemblyjs/wasm-gen": "1.11.6", + "@webassemblyjs/wasm-parser": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.6.tgz", + "integrity": "sha512-6ZwPeGzMJM3Dqp3hCsLgESxBGtT/OeCvCZ4TA1JUPYgmhAx38tTPR9JaKy0S5H3evQpO/h2uWs2j6Yc/fjkpTQ==", + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/helper-api-error": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/ieee754": "1.11.6", + "@webassemblyjs/leb128": "1.11.6", + "@webassemblyjs/utf8": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.6.tgz", + "integrity": "sha512-JM7AhRcE+yW2GWYaKeHL5vt4xqee5N2WcezptmgyhNS+ScggqcT1OtXykhAb13Sn5Yas0j2uv9tHgrjwvzAP4A==", + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/configtest": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.1.1.tgz", + "integrity": "sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw==", + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + } + }, + "node_modules/@webpack-cli/info": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.2.tgz", + "integrity": "sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A==", + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.5.tgz", + "integrity": "sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==", + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==" + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" + }, + "node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-import-assertions": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", + "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", + "peerDependencies": { + "acorn": "^8" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "peerDependencies": { + "ajv": "^6.9.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", + "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001565", + "electron-to-chromium": "^1.4.601", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001579", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001579.tgz", + "integrity": "sha512-u5AUVkixruKHJjw/pj9wISlcMpgFWzSrczLZbrqBSxukQixmg0SJ5sZTpvaFvxU0HoQKd4yoyAogyrAz9pzJnA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/chrome-trace-event": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", + "engines": { + "node": ">=6.0" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==" + }, + "node_modules/comlink": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/comlink/-/comlink-4.4.1.tgz", + "integrity": "sha512-+1dlx0aY5Jo1vHy/tSsIGpSkN4tS9rZSW8FIhG0JH/crs9wwweswIo/POr451r7bZww3hFbPAKnTpimzL/mm4Q==" + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "node_modules/copy-webpack-plugin": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-12.0.2.tgz", + "integrity": "sha512-SNwdBeHyII+rWvee/bTnAYyO8vfVdcSTud4EIb6jcZ8inLeWucJE0DnxXQBjlQ5zlteuuvooGQy3LIyGxhvlOA==", + "dependencies": { + "fast-glob": "^3.3.2", + "glob-parent": "^6.0.1", + "globby": "^14.0.0", + "normalize-path": "^3.0.0", + "schema-utils": "^4.2.0", + "serialize-javascript": "^6.0.2" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/copy-webpack-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/copy-webpack-plugin/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.642", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.642.tgz", + "integrity": "sha512-M4+u22ZJGpk4RY7tne6W+APkZhnnhmAH48FNl8iEFK2lEgob+U5rUQsIqQhvAwCXYpfd3H20pHK/ENsCvwTbsA==" + }, + "node_modules/enhanced-resolve": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", + "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/envinfo": { + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.11.0.tgz", + "integrity": "sha512-G9/6xF1FPbIw0TtalAMaVPpiq2aDEuKLXM314jPVAO9r2fo2a4BLqMNkmRS7O/xPPZ+COAhGIz3ETvHEV3eUcg==", + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/es-module-lexer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.4.1.tgz", + "integrity": "sha512-cXLGjP0c4T3flZJKQSuziYoq7MlT+rnvfZjfp7h+I7K9BNX54kP9nyWvdbwjQ4u1iWbOL4u96fgeZLToQlZC7w==" + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fastq": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", + "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "bin": { + "flat": "cli.js" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + }, + "node_modules/globby": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.0.tgz", + "integrity": "sha512-/1WM/LNHRAOH9lZta77uGbq0dAEQM+XjNesWwhlERDVenqothRbnzTrL3/LrIoEPPjeUHC3vrS6TwoyxeHs7MQ==", + "dependencies": { + "@sindresorhus/merge-streams": "^1.0.0", + "fast-glob": "^3.3.2", + "ignore": "^5.2.4", + "path-type": "^5.0.0", + "slash": "^5.1.0", + "unicorn-magic": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ignore": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/interpret": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/libarchive.js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/libarchive.js/-/libarchive.js-2.0.0.tgz", + "integrity": "sha512-agiHQQ8TRBqzdn0e73eFBAh/eCOGReNxzSVHjFYudH1DLahDjmD951iPQ34qxwTmSYLdZGp9KnCUAgSSQfP5tw==", + "dependencies": { + "comlink": "^4.4.1" + } + }, + "node_modules/loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "engines": { + "node": ">=6.11.5" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, + "node_modules/node-releases": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/path-type": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", + "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/rechoir": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "dependencies": { + "resolve": "^1.20.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/terser": { + "version": "5.27.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.0.tgz", + "integrity": "sha512-bi1HRwVRskAjheeYl291n3JC4GgO/Ty4z1nVs5AAsmonJulGxpSektecnNedrwK9C7vpvVtcX3cw00VSLt7U2A==", + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", + "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.20", + "jest-worker": "^27.4.5", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.1", + "terser": "^5.26.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, + "node_modules/unicorn-magic": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", + "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack": { + "version": "5.89.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.89.0.tgz", + "integrity": "sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==", + "dependencies": { + "@types/eslint-scope": "^3.7.3", + "@types/estree": "^1.0.0", + "@webassemblyjs/ast": "^1.11.5", + "@webassemblyjs/wasm-edit": "^1.11.5", + "@webassemblyjs/wasm-parser": "^1.11.5", + "acorn": "^8.7.1", + "acorn-import-assertions": "^1.9.0", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.15.0", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.9", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.2.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.3.7", + "watchpack": "^2.4.0", + "webpack-sources": "^3.2.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.1.4.tgz", + "integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==", + "dependencies": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^2.1.1", + "@webpack-cli/info": "^2.0.2", + "@webpack-cli/serve": "^2.0.5", + "colorette": "^2.0.14", + "commander": "^10.0.1", + "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generators": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-cli/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "engines": { + "node": ">=14" + } + }, + "node_modules/webpack-merge": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", + "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==" + } + } +} diff --git a/examples/webpack/package.json b/examples/webpack/package.json new file mode 100644 index 0000000..97ec702 --- /dev/null +++ b/examples/webpack/package.json @@ -0,0 +1,19 @@ +{ + "name": "webpack", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "build": "webpack", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "copy-webpack-plugin": "^12.0.2", + "libarchive.js": "^2.0.0", + "webpack": "^5.89.0", + "webpack-cli": "^5.1.4" + } +} diff --git a/examples/webpack/webpack.config.js b/examples/webpack/webpack.config.js new file mode 100644 index 0000000..0232a92 --- /dev/null +++ b/examples/webpack/webpack.config.js @@ -0,0 +1,20 @@ +const path = require("path"); +const CopyPlugin = require("copy-webpack-plugin"); + +module.exports = { + entry: "./index.js", + output: { + filename: "index.js", + path: path.resolve(__dirname, "dist"), + }, + plugins: [ + new CopyPlugin({ + patterns: [ + { + from: "node_modules/libarchive.js/dist/libarchive.wasm", + to: "libarchive.wasm", + }, + ], + }), + ], +}; diff --git a/src/libarchive-node.ts b/src/libarchive-node.ts index 3a8d30e..5b5e092 100644 --- a/src/libarchive-node.ts +++ b/src/libarchive-node.ts @@ -5,18 +5,6 @@ import nodeEndpoint from "comlink/dist/esm/node-adapter"; import { Archive } from "./libarchive"; export * from "./libarchive"; -// Polyfill for Promise.withResolvers on nodejs -(Promise as any).withResolvers || - ((Promise as any).withResolvers = function withResolvers() { - var a, - b, - c = new this(function (resolve: Function, reject: Function) { - a = resolve; - b = reject; - }); - return { resolve: a, reject: b, promise: c }; - }); - const __dirname = new URL(".", import.meta.url).pathname; Archive.init({ diff --git a/src/libarchive.ts b/src/libarchive.ts index 204e58d..f7fed92 100644 --- a/src/libarchive.ts +++ b/src/libarchive.ts @@ -97,3 +97,15 @@ export class Archive { return client; } } + +// Polyfill for Promise.withResolvers +(Promise as any).withResolvers || + ((Promise as any).withResolvers = function withResolvers() { + var a, + b, + c = new this(function (resolve: Function, reject: Function) { + a = resolve; + b = reject; + }); + return { resolve: a, reject: b, promise: c }; + }); diff --git a/src/webworker/archive-writer.js b/src/webworker/archive-writer.js index 83bed2a..dda64c8 100644 --- a/src/webworker/archive-writer.js +++ b/src/webworker/archive-writer.js @@ -12,7 +12,8 @@ export class ArchiveWriter { async write(files, compression, format, passphrase = null) { // In some cases archive size might be bigger than the sum of all files due to header size - let totalSize = files.reduce((acc, { file }) => acc + file.size + 128, 0) + 128; + let totalSize = + files.reduce((acc, { file }) => acc + file.size + 128, 0) + 128; const bufferPtr = this._runCode.malloc(totalSize); const outputSizePtr = this._runCode.malloc(this._runCode.sizeOfSizeT()); diff --git a/test/formats/7z.test.mjs b/test/formats/7z.test.mjs index ec48cc4..414257c 100644 --- a/test/formats/7z.test.mjs +++ b/test/formats/7z.test.mjs @@ -1,6 +1,12 @@ /* eslint-disable no-undef */ import { checksum } from "../checksum.js"; -import { navigate, inputFile, response, setup, cleanup } from "../testutils.mjs"; +import { + navigate, + inputFile, + response, + setup, + cleanup, +} from "../testutils.mjs"; let browser, page; diff --git a/test/formats/rar.test.mjs b/test/formats/rar.test.mjs index 69d56f2..f86d6d2 100644 --- a/test/formats/rar.test.mjs +++ b/test/formats/rar.test.mjs @@ -1,6 +1,12 @@ /* eslint-disable no-undef */ import { checksum } from "../checksum.js"; -import { navigate, inputFile, response, setup, cleanup } from "../testutils.mjs"; +import { + navigate, + inputFile, + response, + setup, + cleanup, +} from "../testutils.mjs"; let browser, page; diff --git a/test/formats/tar.test.mjs b/test/formats/tar.test.mjs index b39556c..642585f 100644 --- a/test/formats/tar.test.mjs +++ b/test/formats/tar.test.mjs @@ -1,6 +1,12 @@ /* eslint-disable no-undef */ import { checksum } from "../checksum.js"; -import { navigate, inputFile, response, setup, cleanup } from "../testutils.mjs"; +import { + navigate, + inputFile, + response, + setup, + cleanup, +} from "../testutils.mjs"; let browser, page; diff --git a/test/formats/zip.test.mjs b/test/formats/zip.test.mjs index 00db8a0..6b4ddbf 100644 --- a/test/formats/zip.test.mjs +++ b/test/formats/zip.test.mjs @@ -1,6 +1,12 @@ /* eslint-disable no-undef */ import { checksum } from "../checksum.js"; -import { navigate, inputFile, response, setup, cleanup } from "../testutils.mjs"; +import { + navigate, + inputFile, + response, + setup, + cleanup, +} from "../testutils.mjs"; let browser, page; diff --git a/test/testutils.mjs b/test/testutils.mjs index 230c08a..757690f 100644 --- a/test/testutils.mjs +++ b/test/testutils.mjs @@ -55,4 +55,4 @@ export const inputFile = async function (file, page) { export const response = async function (page) { await page.waitForSelector("#done"); return await page.evaluate(`window.obj`); -}; \ No newline at end of file +};