diff --git a/.gitignore b/.gitignore
index 555e30c..52159d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,11 @@
-*.lib.*
+units.lib.wasm
+units.lib.data
+units.lib.js
 cmake-build-*
 .idea
+node_modules
+bundle-webview-js.h
+webview-frontend
+*.o
+bundle-*.js
+bundle.js
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..e574da5
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "webview"]
+	path = webview
+	url = git@github.com:webview/webview.git
+[submodule "json"]
+	path = json
+	url = git@github.com:nlohmann/json.git
diff --git a/Makefile b/Makefile
index 421f9b4..7fcb8d4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,35 @@
 CFLAGS = -Os -DSUPPORT_UTF8 -sASYNCIFY -sEXPORTED_RUNTIME_METHODS=ccall,cwrap,stringToNewUTF8 \
 	-sEXPORTED_FUNCTIONS=_test_int,_do_a_conversion -sMODULARIZE -s 'EXPORT_NAME="createMyModule"' \
-	--pre-js=module-pre.js
+	--no-entry
 
-units.wasm: *.c *.h
+ESFLAGS = --bundle --minify --loader:.js=jsx
+
+WEBCFLAGS = -Os -framework WebKit -std=c++11 
+
+webview-frontend: webview-frontend.cpp units.o getopt.o getopt1.o parse.tab.o strfunc.o
+	g++ $^ -o webview-frontend $(WEBCFLAGS) -I json/include
+
+webview-frontend.cpp: bundle-webview-js.h
+
+units.wasm: units.c
 	emcc -o units.lib.js *.c $(CFLAGS) --preload-file definitions.units --preload-file elements.units --preload-file currency.units --preload-file cpi.units
 
-units-host:
+units-host: units.c
 	gcc *.c -o units-host -g
 
-.PHONY: units.wasm units-host
+%.o: %.c
+	gcc -c $^ -Os -o $@
+
+bundle.js: frontend.js units.wasm
+	yarn esbuild frontend.js $(ESFLAGS) --outfile=bundle.js
+
+bundle-webview-js.h: bundle-webview.js
+	xxd -i $^ > $@
+
+bundle-webview.js: webview-frontend.js frontend-impl.js
+	yarn esbuild webview-frontend.js $(ESFLAGS) --outfile=bundle-webview.js
+
+watch:
+	yarn esbuild frontend.js $(ESFLAGS) --watch --outfile=bundle.js
+
+.PHONY: watch
diff --git a/frontend-impl.js b/frontend-impl.js
new file mode 100644
index 0000000..2ae5726
--- /dev/null
+++ b/frontend-impl.js
@@ -0,0 +1,48 @@
+const React = require("preact");
+const {useState} = require('preact/hooks');
+
+export const UnitsApp = () => {
+  const [hist, setHist] = useState([]);
+  const [query, setQuery] = useState("");
+  const [to, setTo] = useState("");
+
+  function doConversion(e) {
+    e.preventDefault();
+    console.log("conversion");
+    setQuery('');
+    setTo('');
+    
+    convert(query, to).then(res => {
+      setHist([...hist, query + " -> " + to + " " + res]);
+    })
+  }
+
+  return (
+    <div>
+      <form class="query-row" onSubmit={doConversion}>
+        <input
+          type="text"
+          id="query"
+          value={query}
+          placeholder="From"
+          onChange={(val) => setQuery(val.target.value)}
+        ></input>
+        <input
+          type="text"
+          id="to"
+          value={to}
+          placeholder="To"
+          onChange={(val) => setTo(val.target.value)}
+        ></input>
+          
+        <input type="submit"></input>
+      </form>
+
+      <ul>
+        {hist.map((entry) => (
+          <li>{entry}</li>
+        ))}
+      </ul>
+    </div>
+  );
+};
diff --git a/frontend.js b/frontend.js
new file mode 100644
index 0000000..7b76e3e
--- /dev/null
+++ b/frontend.js
@@ -0,0 +1,6 @@
+require("./units-impl-wasm.js");
+
+const {UnitsApp} = require("./frontend-impl.js");
+const React = require("preact");
+
+React.render(<UnitsApp />, document.getElementById("app"));
diff --git a/index-webview.html b/index-webview.html
new file mode 100644
index 0000000..0c17663
--- /dev/null
+++ b/index-webview.html
@@ -0,0 +1,5 @@
+<div id=app>
+        
+</div>
+
+<script src=bundle-webview.js></script>
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..fb19254
--- /dev/null
+++ b/index.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<title>Units</title>
+<body>
+<div id="app">
+</div>
+<script src="bundle.js"></script>
+</body>
+</html>
diff --git a/json b/json
new file mode 160000
index 0000000..0457de2
--- /dev/null
+++ b/json
@@ -0,0 +1 @@
+Subproject commit 0457de21cffb298c22b629e538036bfeb96130b7
diff --git a/module-pre.js b/module-pre.js
deleted file mode 100644
index bb23b71..0000000
--- a/module-pre.js
+++ /dev/null
@@ -1,5 +0,0 @@
-globalThis.printBuffer = '';
-
-Module['print'] = function (out) {
-    globalThis.printBuffer += out + "\n";
-};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..7598ea9
--- /dev/null
+++ b/package.json
@@ -0,0 +1,26 @@
+{
+  "name": "units-wasm",
+  "version": "1.0.0",
+  "main": "index.js",
+  "repository": "git@github.com:swissChili/units-wasm.git",
+  "author": "swissChili <swisschili@fastmail.com>",
+  "license": "GPL-3.0",
+  "private": true,
+  "dependencies": {
+    "preact": "^10.19.6",
+    "preact-dom": "^1.0.1",
+    "react": "^18.2.0",
+    "react-dom": "^18.2.0"
+  },
+  "devDependencies": {
+    "buffer": "^5.5.0||^6.0.0",
+    "crypto-browserify": "^3.12.0",
+    "esbuild": "^0.20.1",
+    "events": "^3.1.0",
+    "path-browserify": "^1.0.0",
+    "process": "^0.11.10",
+    "stream-browserify": "^3.0.0",
+    "string_decoder": "^1.3.0",
+    "vm-browserify": "^1.1.2"
+  }
+}
diff --git a/units-impl-wasm.js b/units-impl-wasm.js
new file mode 100644
index 0000000..b8f6191
--- /dev/null
+++ b/units-impl-wasm.js
@@ -0,0 +1,18 @@
+const units = require("./units.js");
+
+units().then((Module) => {
+  let _do_a_conversion = Module.cwrap("do_a_conversion", "number", [
+    "number",
+    "number",
+  ]);
+
+  async function convert(from, to = "") {
+    let from_c = Module.stringToNewUTF8(from);
+    let to_c = Module.stringToNewUTF8(to);
+    let lenBefore = globalThis.printBuffer.length;
+    _do_a_conversion(from_c, to === "" ? 0 : to_c);
+    return globalThis.printBuffer.slice(lenBefore).trim();
+  }
+
+  window.convert = convert;
+});
\ No newline at end of file
diff --git a/units.c b/units.c
index 124b622..54be48b 100644
--- a/units.c
+++ b/units.c
@@ -28,8 +28,6 @@
 You may redistribute copies of GNU Units\n\
 under the terms of the GNU General Public License."
 
-#define _XOPEN_SOURCE 600
-
 #if defined (_WIN32) && defined (_MSC_VER)
 # include <windows.h>
 # include <winbase.h>
@@ -42,6 +40,7 @@
 #include <ctype.h>
 #include <float.h>
 
+#include <string.h>
 #include <stdio.h>
 #include <signal.h>
 #include <stdarg.h>
@@ -419,6 +418,9 @@
 }  
 
 
+char log_buffer[4096] = {0};
+char *log_buffer_ptr = log_buffer;
+
 
 void
 logprintf(const char *format, ...)
@@ -428,6 +430,11 @@
   va_start(args, format);
   vprintf(format, args);
   va_end(args);
+  
+  va_start(args, format);
+  log_buffer_ptr += vsnprintf(log_buffer_ptr, log_buffer + 4096 - log_buffer_ptr, format, args);
+  va_end(args);
+  
   if (logfile) {
     va_start(args, format);
     vfprintf(logfile, format, args);
@@ -439,6 +446,7 @@
 logputchar(char c)
 {
   putchar(c);
+  *(log_buffer_ptr++) = c;
   if (logfile) fputc(c, logfile);
 }
 
@@ -446,6 +454,7 @@
 logputs(const char *s)
 {
   fputs(s, stdout);
+  log_buffer_ptr += strlcpy(log_buffer_ptr, s, log_buffer + 4096 - log_buffer_ptr);
   if (logfile) fputs(s, logfile);
 }
     
diff --git a/units.js b/units.js
new file mode 100644
index 0000000..513ccd4
--- /dev/null
+++ b/units.js
@@ -0,0 +1,3526 @@
+var createMyModule = (() => {
+    var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
+    if (typeof __filename !== 'undefined') _scriptDir ||= __filename;
+    return (
+        function(moduleArg = {}) {
+            function require(name) {}
+            
+            var Module = moduleArg;
+            var readyPromiseResolve, readyPromiseReject;
+            Module["ready"] = new Promise((resolve, reject) => {
+                readyPromiseResolve = resolve;
+                readyPromiseReject = reject
+            });
+            if (!Module.expectedDataFileDownloads) {
+                Module.expectedDataFileDownloads = 0
+            }
+            Module.expectedDataFileDownloads++;
+            (function() {
+                if (Module["ENVIRONMENT_IS_PTHREAD"] || Module["$ww"]) return;
+                var loadPackage = function(metadata) {
+                    var PACKAGE_PATH = "";
+                    if (typeof window === "object") {
+                        PACKAGE_PATH = window["encodeURIComponent"](window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf("/")) + "/")
+                    } else if (typeof process === "undefined" && typeof location !== "undefined") {
+                        PACKAGE_PATH = encodeURIComponent(location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf("/")) + "/")
+                    }
+                    var PACKAGE_NAME = "units.lib.data";
+                    var REMOTE_PACKAGE_BASE = "units.lib.data";
+                    if (typeof Module["locateFilePackage"] === "function" && !Module["locateFile"]) {
+                        Module["locateFile"] = Module["locateFilePackage"];
+                        err("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)")
+                    }
+                    var REMOTE_PACKAGE_NAME = Module["locateFile"] ? Module["locateFile"](REMOTE_PACKAGE_BASE, "") : REMOTE_PACKAGE_BASE;
+                    var REMOTE_PACKAGE_SIZE = metadata["remote_package_size"];
+
+                    function fetchRemotePackage(packageName, packageSize, callback, errback) {
+                        if (typeof process === "object" && typeof process.versions === "object" && typeof process.versions.node === "string") {
+                            require("fs").readFile(packageName, function(err, contents) {
+                                if (err) {
+                                    errback(err)
+                                } else {
+                                    callback(contents.buffer)
+                                }
+                            });
+                            return
+                        }
+                        var xhr = new XMLHttpRequest;
+                        xhr.open("GET", packageName, true);
+                        xhr.responseType = "arraybuffer";
+                        xhr.onprogress = function(event) {
+                            var url = packageName;
+                            var size = packageSize;
+                            if (event.total) size = event.total;
+                            if (event.loaded) {
+                                if (!xhr.addedTotal) {
+                                    xhr.addedTotal = true;
+                                    if (!Module.dataFileDownloads) Module.dataFileDownloads = {};
+                                    Module.dataFileDownloads[url] = {
+                                        loaded: event.loaded,
+                                        total: size
+                                    }
+                                } else {
+                                    Module.dataFileDownloads[url].loaded = event.loaded
+                                }
+                                var total = 0;
+                                var loaded = 0;
+                                var num = 0;
+                                for (var download in Module.dataFileDownloads) {
+                                    var data = Module.dataFileDownloads[download];
+                                    total += data.total;
+                                    loaded += data.loaded;
+                                    num++
+                                }
+                                total = Math.ceil(total * Module.expectedDataFileDownloads / num);
+                                if (Module["setStatus"]) Module["setStatus"](`Downloading data... (${loaded}/${total})`)
+                            } else if (!Module.dataFileDownloads) {
+                                if (Module["setStatus"]) Module["setStatus"]("Downloading data...")
+                            }
+                        };
+                        xhr.onerror = function(event) {
+                            throw new Error("NetworkError for: " + packageName)
+                        };
+                        xhr.onload = function(event) {
+                            if (xhr.status == 200 || xhr.status == 304 || xhr.status == 206 || xhr.status == 0 && xhr.response) {
+                                var packageData = xhr.response;
+                                callback(packageData)
+                            } else {
+                                throw new Error(xhr.statusText + " : " + xhr.responseURL)
+                            }
+                        };
+                        xhr.send(null)
+                    }
+
+                    function handleError(error) {
+                        console.error("package error:", error)
+                    }
+                    var fetchedCallback = null;
+                    var fetched = Module["getPreloadedPackage"] ? Module["getPreloadedPackage"](REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE) : null;
+                    if (!fetched) fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE, function(data) {
+                        if (fetchedCallback) {
+                            fetchedCallback(data);
+                            fetchedCallback = null
+                        } else {
+                            fetched = data
+                        }
+                    }, handleError);
+
+                    function runWithFS() {
+                        function assert(check, msg) {
+                            if (!check) throw msg + (new Error).stack
+                        }
+
+                        function DataRequest(start, end, audio) {
+                            this.start = start;
+                            this.end = end;
+                            this.audio = audio
+                        }
+                        DataRequest.prototype = {
+                            requests: {},
+                            open: function(mode, name) {
+                                this.name = name;
+                                this.requests[name] = this;
+                                Module["addRunDependency"](`fp ${this.name}`)
+                            },
+                            send: function() {},
+                            onload: function() {
+                                var byteArray = this.byteArray.subarray(this.start, this.end);
+                                this.finish(byteArray)
+                            },
+                            finish: function(byteArray) {
+                                var that = this;
+                                Module["FS_createDataFile"](this.name, null, byteArray, true, true, true);
+                                Module["removeRunDependency"](`fp ${that.name}`);
+                                this.requests[this.name] = null
+                            }
+                        };
+                        var files = metadata["files"];
+                        for (var i = 0; i < files.length; ++i) {
+                            new DataRequest(files[i]["start"], files[i]["end"], files[i]["audio"] || 0).open("GET", files[i]["filename"])
+                        }
+
+                        function processPackageData(arrayBuffer) {
+                            assert(arrayBuffer, "Loading data file failed.");
+                            assert(arrayBuffer.constructor.name === ArrayBuffer.name, "bad input to processPackageData");
+                            var byteArray = new Uint8Array(arrayBuffer);
+                            DataRequest.prototype.byteArray = byteArray;
+                            var files = metadata["files"];
+                            for (var i = 0; i < files.length; ++i) {
+                                DataRequest.prototype.requests[files[i].filename].onload()
+                            }
+                            Module["removeRunDependency"]("datafile_units.lib.data")
+                        }
+                        Module["addRunDependency"]("datafile_units.lib.data");
+                        if (!Module.preloadResults) Module.preloadResults = {};
+                        Module.preloadResults[PACKAGE_NAME] = {
+                            fromCache: false
+                        };
+                        if (fetched) {
+                            processPackageData(fetched);
+                            fetched = null
+                        } else {
+                            fetchedCallback = processPackageData
+                        }
+                    }
+                    if (Module["calledRun"]) {
+                        runWithFS()
+                    } else {
+                        if (!Module["preRun"]) Module["preRun"] = [];
+                        Module["preRun"].push(runWithFS)
+                    }
+                };
+                loadPackage({
+                    "files": [{
+                        "filename": "/cpi.units",
+                        "start": 0,
+                        "end": 44458
+                    }, {
+                        "filename": "/currency.units",
+                        "start": 44458,
+                        "end": 59060
+                    }, {
+                        "filename": "/definitions.units",
+                        "start": 59060,
+                        "end": 419653
+                    }, {
+                        "filename": "/elements.units",
+                        "start": 419653,
+                        "end": 571034
+                    }],
+                    "remote_package_size": 571034
+                })
+            })();
+            globalThis.printBuffer = "";
+            Module["print"] = function(out) {
+                globalThis.printBuffer += out + "\n"
+            };
+            var moduleOverrides = Object.assign({}, Module);
+            var arguments_ = [];
+            var thisProgram = "./this.program";
+            var quit_ = (status, toThrow) => {
+                throw toThrow
+            };
+            var ENVIRONMENT_IS_WEB = typeof window == "object";
+            var ENVIRONMENT_IS_WORKER = typeof importScripts == "function";
+            var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string";
+            var scriptDirectory = "";
+
+            function locateFile(path) {
+                if (Module["locateFile"]) {
+                    return Module["locateFile"](path, scriptDirectory)
+                }
+                return scriptDirectory + path
+            }
+            var read_, readAsync, readBinary;
+            if (ENVIRONMENT_IS_NODE) {
+                var fs = require("fs");
+                var nodePath = require("path");
+                if (ENVIRONMENT_IS_WORKER) {
+                    scriptDirectory = nodePath.dirname(scriptDirectory) + "/"
+                } else {
+                    scriptDirectory = __dirname + "/"
+                }
+                read_ = (filename, binary) => {
+                    filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
+                    return fs.readFileSync(filename, binary ? undefined : "utf8")
+                };
+                readBinary = filename => {
+                    var ret = read_(filename, true);
+                    if (!ret.buffer) {
+                        ret = new Uint8Array(ret)
+                    }
+                    return ret
+                };
+                readAsync = (filename, onload, onerror, binary = true) => {
+                    filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
+                    fs.readFile(filename, binary ? undefined : "utf8", (err, data) => {
+                        if (err) onerror(err);
+                        else onload(binary ? data.buffer : data)
+                    })
+                };
+                if (!Module["thisProgram"] && process.argv.length > 1) {
+                    thisProgram = process.argv[1].replace(/\\/g, "/")
+                }
+                arguments_ = process.argv.slice(2);
+                quit_ = (status, toThrow) => {
+                    process.exitCode = status;
+                    throw toThrow
+                }
+            } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
+                if (ENVIRONMENT_IS_WORKER) {
+                    scriptDirectory = self.location.href
+                } else if (typeof document != "undefined" && document.currentScript) {
+                    scriptDirectory = document.currentScript.src
+                }
+                if (_scriptDir) {
+                    scriptDirectory = _scriptDir
+                }
+                if (scriptDirectory.startsWith("blob:")) {
+                    scriptDirectory = ""
+                } else {
+                    scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1)
+                } {
+                    read_ = url => {
+                        var xhr = new XMLHttpRequest;
+                        xhr.open("GET", url, false);
+                        xhr.send(null);
+                        return xhr.responseText
+                    };
+                    if (ENVIRONMENT_IS_WORKER) {
+                        readBinary = url => {
+                            var xhr = new XMLHttpRequest;
+                            xhr.open("GET", url, false);
+                            xhr.responseType = "arraybuffer";
+                            xhr.send(null);
+                            return new Uint8Array(xhr.response)
+                        }
+                    }
+                    readAsync = (url, onload, onerror) => {
+                        var xhr = new XMLHttpRequest;
+                        xhr.open("GET", url, true);
+                        xhr.responseType = "arraybuffer";
+                        xhr.onload = () => {
+                            if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
+                                onload(xhr.response);
+                                return
+                            }
+                            onerror()
+                        };
+                        xhr.onerror = onerror;
+                        xhr.send(null)
+                    }
+                }
+            } else {}
+            var out = Module["print"] || console.log.bind(console);
+            var err = Module["printErr"] || console.error.bind(console);
+            Object.assign(Module, moduleOverrides);
+            moduleOverrides = null;
+            if (Module["arguments"]) arguments_ = Module["arguments"];
+            if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
+            if (Module["quit"]) quit_ = Module["quit"];
+            var wasmBinary;
+            if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
+            if (typeof WebAssembly != "object") {
+                abort("no native wasm support detected")
+            }
+            var wasmMemory;
+            var ABORT = false;
+            var EXITSTATUS;
+            var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
+
+            function updateMemoryViews() {
+                var b = wasmMemory.buffer;
+                Module["HEAP8"] = HEAP8 = new Int8Array(b);
+                Module["HEAP16"] = HEAP16 = new Int16Array(b);
+                Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
+                Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
+                Module["HEAP32"] = HEAP32 = new Int32Array(b);
+                Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
+                Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
+                Module["HEAPF64"] = HEAPF64 = new Float64Array(b)
+            }
+            var __ATPRERUN__ = [];
+            var __ATINIT__ = [];
+            var __ATPOSTRUN__ = [];
+            var runtimeInitialized = false;
+
+            function preRun() {
+                if (Module["preRun"]) {
+                    if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
+                    while (Module["preRun"].length) {
+                        addOnPreRun(Module["preRun"].shift())
+                    }
+                }
+                callRuntimeCallbacks(__ATPRERUN__)
+            }
+
+            function initRuntime() {
+                runtimeInitialized = true;
+                if (!Module["noFSInit"] && !FS.init.initialized) FS.init();
+                FS.ignorePermissions = false;
+                TTY.init();
+                callRuntimeCallbacks(__ATINIT__)
+            }
+
+            function postRun() {
+                if (Module["postRun"]) {
+                    if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
+                    while (Module["postRun"].length) {
+                        addOnPostRun(Module["postRun"].shift())
+                    }
+                }
+                callRuntimeCallbacks(__ATPOSTRUN__)
+            }
+
+            function addOnPreRun(cb) {
+                __ATPRERUN__.unshift(cb)
+            }
+
+            function addOnInit(cb) {
+                __ATINIT__.unshift(cb)
+            }
+
+            function addOnPostRun(cb) {
+                __ATPOSTRUN__.unshift(cb)
+            }
+            var runDependencies = 0;
+            var runDependencyWatcher = null;
+            var dependenciesFulfilled = null;
+
+            function getUniqueRunDependency(id) {
+                return id
+            }
+
+            function addRunDependency(id) {
+                runDependencies++;
+                Module["monitorRunDependencies"]?.(runDependencies)
+            }
+
+            function removeRunDependency(id) {
+                runDependencies--;
+                Module["monitorRunDependencies"]?.(runDependencies);
+                if (runDependencies == 0) {
+                    if (runDependencyWatcher !== null) {
+                        clearInterval(runDependencyWatcher);
+                        runDependencyWatcher = null
+                    }
+                    if (dependenciesFulfilled) {
+                        var callback = dependenciesFulfilled;
+                        dependenciesFulfilled = null;
+                        callback()
+                    }
+                }
+            }
+
+            function abort(what) {
+                Module["onAbort"]?.(what);
+                what = "Aborted(" + what + ")";
+                err(what);
+                ABORT = true;
+                EXITSTATUS = 1;
+                what += ". Build with -sASSERTIONS for more info.";
+                var e = new WebAssembly.RuntimeError(what);
+                readyPromiseReject(e);
+                throw e
+            }
+            var dataURIPrefix = "data:application/octet-stream;base64,";
+            var isDataURI = filename => filename.startsWith(dataURIPrefix);
+            var isFileURI = filename => filename.startsWith("file://");
+            var wasmBinaryFile;
+            wasmBinaryFile = "units.lib.wasm";
+            if (!isDataURI(wasmBinaryFile)) {
+                wasmBinaryFile = locateFile(wasmBinaryFile)
+            }
+
+            function getBinarySync(file) {
+                if (file == wasmBinaryFile && wasmBinary) {
+                    return new Uint8Array(wasmBinary)
+                }
+                if (readBinary) {
+                    return readBinary(file)
+                }
+                throw "both async and sync fetching of the wasm failed"
+            }
+
+            function getBinaryPromise(binaryFile) {
+                if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
+                    if (typeof fetch == "function" && !isFileURI(binaryFile)) {
+                        return fetch(binaryFile, {
+                            credentials: "same-origin"
+                        }).then(response => {
+                            if (!response["ok"]) {
+                                throw `failed to load wasm binary file at '${binaryFile}'`
+                            }
+                            return response["arrayBuffer"]()
+                        }).catch(() => getBinarySync(binaryFile))
+                    } else if (readAsync) {
+                        return new Promise((resolve, reject) => {
+                            readAsync(binaryFile, response => resolve(new Uint8Array(response)), reject)
+                        })
+                    }
+                }
+                return Promise.resolve().then(() => getBinarySync(binaryFile))
+            }
+
+            function instantiateArrayBuffer(binaryFile, imports, receiver) {
+                return getBinaryPromise(binaryFile).then(binary => WebAssembly.instantiate(binary, imports)).then(receiver, reason => {
+                    err(`failed to asynchronously prepare wasm: ${reason}`);
+                    abort(reason)
+                })
+            }
+
+            function instantiateAsync(binary, binaryFile, imports, callback) {
+                if (!binary && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(binaryFile) && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE && typeof fetch == "function") {
+                    return fetch(binaryFile, {
+                        credentials: "same-origin"
+                    }).then(response => {
+                        var result = WebAssembly.instantiateStreaming(response, imports);
+                        return result.then(callback, function(reason) {
+                            err(`wasm streaming compile failed: ${reason}`);
+                            err("falling back to ArrayBuffer instantiation");
+                            return instantiateArrayBuffer(binaryFile, imports, callback)
+                        })
+                    })
+                }
+                return instantiateArrayBuffer(binaryFile, imports, callback)
+            }
+
+            function createWasm() {
+                var info = {
+                    "a": wasmImports
+                };
+
+                function receiveInstance(instance, module) {
+                    wasmExports = instance.exports;
+                    wasmExports = Asyncify.instrumentWasmExports(wasmExports);
+                    wasmMemory = wasmExports["o"];
+                    updateMemoryViews();
+                    addOnInit(wasmExports["p"]);
+                    removeRunDependency("wasm-instantiate");
+                    return wasmExports
+                }
+                addRunDependency("wasm-instantiate");
+
+                function receiveInstantiationResult(result) {
+                    receiveInstance(result["instance"])
+                }
+                if (Module["instantiateWasm"]) {
+                    try {
+                        return Module["instantiateWasm"](info, receiveInstance)
+                    } catch (e) {
+                        err(`Module.instantiateWasm callback failed with error: ${e}`);
+                        readyPromiseReject(e)
+                    }
+                }
+                instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult).catch(readyPromiseReject);
+                return {}
+            }
+            var tempDouble;
+            var tempI64;
+
+            function ExitStatus(status) {
+                this.name = "ExitStatus";
+                this.message = `Program terminated with exit(${status})`;
+                this.status = status
+            }
+            var callRuntimeCallbacks = callbacks => {
+                while (callbacks.length > 0) {
+                    callbacks.shift()(Module)
+                }
+            };
+            var noExitRuntime = Module["noExitRuntime"] || true;
+            var PATH = {
+                isAbs: path => path.charAt(0) === "/",
+                splitPath: filename => {
+                    var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
+                    return splitPathRe.exec(filename).slice(1)
+                },
+                normalizeArray: (parts, allowAboveRoot) => {
+                    var up = 0;
+                    for (var i = parts.length - 1; i >= 0; i--) {
+                        var last = parts[i];
+                        if (last === ".") {
+                            parts.splice(i, 1)
+                        } else if (last === "..") {
+                            parts.splice(i, 1);
+                            up++
+                        } else if (up) {
+                            parts.splice(i, 1);
+                            up--
+                        }
+                    }
+                    if (allowAboveRoot) {
+                        for (; up; up--) {
+                            parts.unshift("..")
+                        }
+                    }
+                    return parts
+                },
+                normalize: path => {
+                    var isAbsolute = PATH.isAbs(path),
+                        trailingSlash = path.substr(-1) === "/";
+                    path = PATH.normalizeArray(path.split("/").filter(p => !!p), !isAbsolute).join("/");
+                    if (!path && !isAbsolute) {
+                        path = "."
+                    }
+                    if (path && trailingSlash) {
+                        path += "/"
+                    }
+                    return (isAbsolute ? "/" : "") + path
+                },
+                dirname: path => {
+                    var result = PATH.splitPath(path),
+                        root = result[0],
+                        dir = result[1];
+                    if (!root && !dir) {
+                        return "."
+                    }
+                    if (dir) {
+                        dir = dir.substr(0, dir.length - 1)
+                    }
+                    return root + dir
+                },
+                basename: path => {
+                    if (path === "/") return "/";
+                    path = PATH.normalize(path);
+                    path = path.replace(/\/$/, "");
+                    var lastSlash = path.lastIndexOf("/");
+                    if (lastSlash === -1) return path;
+                    return path.substr(lastSlash + 1)
+                },
+                join: (...paths) => PATH.normalize(paths.join("/")),
+                join2: (l, r) => PATH.normalize(l + "/" + r)
+            };
+            var initRandomFill = () => {
+                if (typeof crypto == "object" && typeof crypto["getRandomValues"] == "function") {
+                    return view => crypto.getRandomValues(view)
+                } else if (ENVIRONMENT_IS_NODE) {
+                    try {
+                        var crypto_module = require("crypto");
+                        var randomFillSync = crypto_module["randomFillSync"];
+                        if (randomFillSync) {
+                            return view => crypto_module["randomFillSync"](view)
+                        }
+                        var randomBytes = crypto_module["randomBytes"];
+                        return view => (view.set(randomBytes(view.byteLength)), view)
+                    } catch (e) {}
+                }
+                abort("initRandomDevice")
+            };
+            var randomFill = view => (randomFill = initRandomFill())(view);
+            var PATH_FS = {
+                resolve: (...args) => {
+                    var resolvedPath = "",
+                        resolvedAbsolute = false;
+                    for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
+                        var path = i >= 0 ? args[i] : FS.cwd();
+                        if (typeof path != "string") {
+                            throw new TypeError("Arguments to path.resolve must be strings")
+                        } else if (!path) {
+                            return ""
+                        }
+                        resolvedPath = path + "/" + resolvedPath;
+                        resolvedAbsolute = PATH.isAbs(path)
+                    }
+                    resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(p => !!p), !resolvedAbsolute).join("/");
+                    return (resolvedAbsolute ? "/" : "") + resolvedPath || "."
+                },
+                relative: (from, to) => {
+                    from = PATH_FS.resolve(from).substr(1);
+                    to = PATH_FS.resolve(to).substr(1);
+
+                    function trim(arr) {
+                        var start = 0;
+                        for (; start < arr.length; start++) {
+                            if (arr[start] !== "") break
+                        }
+                        var end = arr.length - 1;
+                        for (; end >= 0; end--) {
+                            if (arr[end] !== "") break
+                        }
+                        if (start > end) return [];
+                        return arr.slice(start, end - start + 1)
+                    }
+                    var fromParts = trim(from.split("/"));
+                    var toParts = trim(to.split("/"));
+                    var length = Math.min(fromParts.length, toParts.length);
+                    var samePartsLength = length;
+                    for (var i = 0; i < length; i++) {
+                        if (fromParts[i] !== toParts[i]) {
+                            samePartsLength = i;
+                            break
+                        }
+                    }
+                    var outputParts = [];
+                    for (var i = samePartsLength; i < fromParts.length; i++) {
+                        outputParts.push("..")
+                    }
+                    outputParts = outputParts.concat(toParts.slice(samePartsLength));
+                    return outputParts.join("/")
+                }
+            };
+            var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined;
+            var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => {
+                var endIdx = idx + maxBytesToRead;
+                var endPtr = idx;
+                while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
+                if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
+                    return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr))
+                }
+                var str = "";
+                while (idx < endPtr) {
+                    var u0 = heapOrArray[idx++];
+                    if (!(u0 & 128)) {
+                        str += String.fromCharCode(u0);
+                        continue
+                    }
+                    var u1 = heapOrArray[idx++] & 63;
+                    if ((u0 & 224) == 192) {
+                        str += String.fromCharCode((u0 & 31) << 6 | u1);
+                        continue
+                    }
+                    var u2 = heapOrArray[idx++] & 63;
+                    if ((u0 & 240) == 224) {
+                        u0 = (u0 & 15) << 12 | u1 << 6 | u2
+                    } else {
+                        u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63
+                    }
+                    if (u0 < 65536) {
+                        str += String.fromCharCode(u0)
+                    } else {
+                        var ch = u0 - 65536;
+                        str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023)
+                    }
+                }
+                return str
+            };
+            var FS_stdin_getChar_buffer = [];
+            var lengthBytesUTF8 = str => {
+                var len = 0;
+                for (var i = 0; i < str.length; ++i) {
+                    var c = str.charCodeAt(i);
+                    if (c <= 127) {
+                        len++
+                    } else if (c <= 2047) {
+                        len += 2
+                    } else if (c >= 55296 && c <= 57343) {
+                        len += 4;
+                        ++i
+                    } else {
+                        len += 3
+                    }
+                }
+                return len
+            };
+            var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
+                if (!(maxBytesToWrite > 0)) return 0;
+                var startIdx = outIdx;
+                var endIdx = outIdx + maxBytesToWrite - 1;
+                for (var i = 0; i < str.length; ++i) {
+                    var u = str.charCodeAt(i);
+                    if (u >= 55296 && u <= 57343) {
+                        var u1 = str.charCodeAt(++i);
+                        u = 65536 + ((u & 1023) << 10) | u1 & 1023
+                    }
+                    if (u <= 127) {
+                        if (outIdx >= endIdx) break;
+                        heap[outIdx++] = u
+                    } else if (u <= 2047) {
+                        if (outIdx + 1 >= endIdx) break;
+                        heap[outIdx++] = 192 | u >> 6;
+                        heap[outIdx++] = 128 | u & 63
+                    } else if (u <= 65535) {
+                        if (outIdx + 2 >= endIdx) break;
+                        heap[outIdx++] = 224 | u >> 12;
+                        heap[outIdx++] = 128 | u >> 6 & 63;
+                        heap[outIdx++] = 128 | u & 63
+                    } else {
+                        if (outIdx + 3 >= endIdx) break;
+                        heap[outIdx++] = 240 | u >> 18;
+                        heap[outIdx++] = 128 | u >> 12 & 63;
+                        heap[outIdx++] = 128 | u >> 6 & 63;
+                        heap[outIdx++] = 128 | u & 63
+                    }
+                }
+                heap[outIdx] = 0;
+                return outIdx - startIdx
+            };
+
+            function intArrayFromString(stringy, dontAddNull, length) {
+                var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
+                var u8array = new Array(len);
+                var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
+                if (dontAddNull) u8array.length = numBytesWritten;
+                return u8array
+            }
+            var FS_stdin_getChar = () => {
+                if (!FS_stdin_getChar_buffer.length) {
+                    var result = null;
+                    if (ENVIRONMENT_IS_NODE) {
+                        var BUFSIZE = 256;
+                        var buf = Buffer.alloc(BUFSIZE);
+                        var bytesRead = 0;
+                        var fd = process.stdin.fd;
+                        try {
+                            bytesRead = fs.readSync(fd, buf)
+                        } catch (e) {
+                            if (e.toString().includes("EOF")) bytesRead = 0;
+                            else throw e
+                        }
+                        if (bytesRead > 0) {
+                            result = buf.slice(0, bytesRead).toString("utf-8")
+                        } else {
+                            result = null
+                        }
+                    } else if (typeof window != "undefined" && typeof window.prompt == "function") {
+                        result = window.prompt("Input: ");
+                        if (result !== null) {
+                            result += "\n"
+                        }
+                    } else if (typeof readline == "function") {
+                        result = readline();
+                        if (result !== null) {
+                            result += "\n"
+                        }
+                    }
+                    if (!result) {
+                        return null
+                    }
+                    FS_stdin_getChar_buffer = intArrayFromString(result, true)
+                }
+                return FS_stdin_getChar_buffer.shift()
+            };
+            var TTY = {
+                ttys: [],
+                init() {},
+                shutdown() {},
+                register(dev, ops) {
+                    TTY.ttys[dev] = {
+                        input: [],
+                        output: [],
+                        ops: ops
+                    };
+                    FS.registerDevice(dev, TTY.stream_ops)
+                },
+                stream_ops: {
+                    open(stream) {
+                        var tty = TTY.ttys[stream.node.rdev];
+                        if (!tty) {
+                            throw new FS.ErrnoError(43)
+                        }
+                        stream.tty = tty;
+                        stream.seekable = false
+                    },
+                    close(stream) {
+                        stream.tty.ops.fsync(stream.tty)
+                    },
+                    fsync(stream) {
+                        stream.tty.ops.fsync(stream.tty)
+                    },
+                    read(stream, buffer, offset, length, pos) {
+                        if (!stream.tty || !stream.tty.ops.get_char) {
+                            throw new FS.ErrnoError(60)
+                        }
+                        var bytesRead = 0;
+                        for (var i = 0; i < length; i++) {
+                            var result;
+                            try {
+                                result = stream.tty.ops.get_char(stream.tty)
+                            } catch (e) {
+                                throw new FS.ErrnoError(29)
+                            }
+                            if (result === undefined && bytesRead === 0) {
+                                throw new FS.ErrnoError(6)
+                            }
+                            if (result === null || result === undefined) break;
+                            bytesRead++;
+                            buffer[offset + i] = result
+                        }
+                        if (bytesRead) {
+                            stream.node.timestamp = Date.now()
+                        }
+                        return bytesRead
+                    },
+                    write(stream, buffer, offset, length, pos) {
+                        if (!stream.tty || !stream.tty.ops.put_char) {
+                            throw new FS.ErrnoError(60)
+                        }
+                        try {
+                            for (var i = 0; i < length; i++) {
+                                stream.tty.ops.put_char(stream.tty, buffer[offset + i])
+                            }
+                        } catch (e) {
+                            throw new FS.ErrnoError(29)
+                        }
+                        if (length) {
+                            stream.node.timestamp = Date.now()
+                        }
+                        return i
+                    }
+                },
+                default_tty_ops: {
+                    get_char(tty) {
+                        return FS_stdin_getChar()
+                    },
+                    put_char(tty, val) {
+                        if (val === null || val === 10) {
+                            out(UTF8ArrayToString(tty.output, 0));
+                            tty.output = []
+                        } else {
+                            if (val != 0) tty.output.push(val)
+                        }
+                    },
+                    fsync(tty) {
+                        if (tty.output && tty.output.length > 0) {
+                            out(UTF8ArrayToString(tty.output, 0));
+                            tty.output = []
+                        }
+                    },
+                    ioctl_tcgets(tty) {
+                        return {
+                            c_iflag: 25856,
+                            c_oflag: 5,
+                            c_cflag: 191,
+                            c_lflag: 35387,
+                            c_cc: [3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+                        }
+                    },
+                    ioctl_tcsets(tty, optional_actions, data) {
+                        return 0
+                    },
+                    ioctl_tiocgwinsz(tty) {
+                        return [24, 80]
+                    }
+                },
+                default_tty1_ops: {
+                    put_char(tty, val) {
+                        if (val === null || val === 10) {
+                            err(UTF8ArrayToString(tty.output, 0));
+                            tty.output = []
+                        } else {
+                            if (val != 0) tty.output.push(val)
+                        }
+                    },
+                    fsync(tty) {
+                        if (tty.output && tty.output.length > 0) {
+                            err(UTF8ArrayToString(tty.output, 0));
+                            tty.output = []
+                        }
+                    }
+                }
+            };
+            var mmapAlloc = size => {
+                abort()
+            };
+            var MEMFS = {
+                ops_table: null,
+                mount(mount) {
+                    return MEMFS.createNode(null, "/", 16384 | 511, 0)
+                },
+                createNode(parent, name, mode, dev) {
+                    if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
+                        throw new FS.ErrnoError(63)
+                    }
+                    MEMFS.ops_table ||= {
+                        dir: {
+                            node: {
+                                getattr: MEMFS.node_ops.getattr,
+                                setattr: MEMFS.node_ops.setattr,
+                                lookup: MEMFS.node_ops.lookup,
+                                mknod: MEMFS.node_ops.mknod,
+                                rename: MEMFS.node_ops.rename,
+                                unlink: MEMFS.node_ops.unlink,
+                                rmdir: MEMFS.node_ops.rmdir,
+                                readdir: MEMFS.node_ops.readdir,
+                                symlink: MEMFS.node_ops.symlink
+                            },
+                            stream: {
+                                llseek: MEMFS.stream_ops.llseek
+                            }
+                        },
+                        file: {
+                            node: {
+                                getattr: MEMFS.node_ops.getattr,
+                                setattr: MEMFS.node_ops.setattr
+                            },
+                            stream: {
+                                llseek: MEMFS.stream_ops.llseek,
+                                read: MEMFS.stream_ops.read,
+                                write: MEMFS.stream_ops.write,
+                                allocate: MEMFS.stream_ops.allocate,
+                                mmap: MEMFS.stream_ops.mmap,
+                                msync: MEMFS.stream_ops.msync
+                            }
+                        },
+                        link: {
+                            node: {
+                                getattr: MEMFS.node_ops.getattr,
+                                setattr: MEMFS.node_ops.setattr,
+                                readlink: MEMFS.node_ops.readlink
+                            },
+                            stream: {}
+                        },
+                        chrdev: {
+                            node: {
+                                getattr: MEMFS.node_ops.getattr,
+                                setattr: MEMFS.node_ops.setattr
+                            },
+                            stream: FS.chrdev_stream_ops
+                        }
+                    };
+                    var node = FS.createNode(parent, name, mode, dev);
+                    if (FS.isDir(node.mode)) {
+                        node.node_ops = MEMFS.ops_table.dir.node;
+                        node.stream_ops = MEMFS.ops_table.dir.stream;
+                        node.contents = {}
+                    } else if (FS.isFile(node.mode)) {
+                        node.node_ops = MEMFS.ops_table.file.node;
+                        node.stream_ops = MEMFS.ops_table.file.stream;
+                        node.usedBytes = 0;
+                        node.contents = null
+                    } else if (FS.isLink(node.mode)) {
+                        node.node_ops = MEMFS.ops_table.link.node;
+                        node.stream_ops = MEMFS.ops_table.link.stream
+                    } else if (FS.isChrdev(node.mode)) {
+                        node.node_ops = MEMFS.ops_table.chrdev.node;
+                        node.stream_ops = MEMFS.ops_table.chrdev.stream
+                    }
+                    node.timestamp = Date.now();
+                    if (parent) {
+                        parent.contents[name] = node;
+                        parent.timestamp = node.timestamp
+                    }
+                    return node
+                },
+                getFileDataAsTypedArray(node) {
+                    if (!node.contents) return new Uint8Array(0);
+                    if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes);
+                    return new Uint8Array(node.contents)
+                },
+                expandFileStorage(node, newCapacity) {
+                    var prevCapacity = node.contents ? node.contents.length : 0;
+                    if (prevCapacity >= newCapacity) return;
+                    var CAPACITY_DOUBLING_MAX = 1024 * 1024;
+                    newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0);
+                    if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256);
+                    var oldContents = node.contents;
+                    node.contents = new Uint8Array(newCapacity);
+                    if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0)
+                },
+                resizeFileStorage(node, newSize) {
+                    if (node.usedBytes == newSize) return;
+                    if (newSize == 0) {
+                        node.contents = null;
+                        node.usedBytes = 0
+                    } else {
+                        var oldContents = node.contents;
+                        node.contents = new Uint8Array(newSize);
+                        if (oldContents) {
+                            node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes)))
+                        }
+                        node.usedBytes = newSize
+                    }
+                },
+                node_ops: {
+                    getattr(node) {
+                        var attr = {};
+                        attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
+                        attr.ino = node.id;
+                        attr.mode = node.mode;
+                        attr.nlink = 1;
+                        attr.uid = 0;
+                        attr.gid = 0;
+                        attr.rdev = node.rdev;
+                        if (FS.isDir(node.mode)) {
+                            attr.size = 4096
+                        } else if (FS.isFile(node.mode)) {
+                            attr.size = node.usedBytes
+                        } else if (FS.isLink(node.mode)) {
+                            attr.size = node.link.length
+                        } else {
+                            attr.size = 0
+                        }
+                        attr.atime = new Date(node.timestamp);
+                        attr.mtime = new Date(node.timestamp);
+                        attr.ctime = new Date(node.timestamp);
+                        attr.blksize = 4096;
+                        attr.blocks = Math.ceil(attr.size / attr.blksize);
+                        return attr
+                    },
+                    setattr(node, attr) {
+                        if (attr.mode !== undefined) {
+                            node.mode = attr.mode
+                        }
+                        if (attr.timestamp !== undefined) {
+                            node.timestamp = attr.timestamp
+                        }
+                        if (attr.size !== undefined) {
+                            MEMFS.resizeFileStorage(node, attr.size)
+                        }
+                    },
+                    lookup(parent, name) {
+                        throw FS.genericErrors[44]
+                    },
+                    mknod(parent, name, mode, dev) {
+                        return MEMFS.createNode(parent, name, mode, dev)
+                    },
+                    rename(old_node, new_dir, new_name) {
+                        if (FS.isDir(old_node.mode)) {
+                            var new_node;
+                            try {
+                                new_node = FS.lookupNode(new_dir, new_name)
+                            } catch (e) {}
+                            if (new_node) {
+                                for (var i in new_node.contents) {
+                                    throw new FS.ErrnoError(55)
+                                }
+                            }
+                        }
+                        delete old_node.parent.contents[old_node.name];
+                        old_node.parent.timestamp = Date.now();
+                        old_node.name = new_name;
+                        new_dir.contents[new_name] = old_node;
+                        new_dir.timestamp = old_node.parent.timestamp;
+                        old_node.parent = new_dir
+                    },
+                    unlink(parent, name) {
+                        delete parent.contents[name];
+                        parent.timestamp = Date.now()
+                    },
+                    rmdir(parent, name) {
+                        var node = FS.lookupNode(parent, name);
+                        for (var i in node.contents) {
+                            throw new FS.ErrnoError(55)
+                        }
+                        delete parent.contents[name];
+                        parent.timestamp = Date.now()
+                    },
+                    readdir(node) {
+                        var entries = [".", ".."];
+                        for (var key of Object.keys(node.contents)) {
+                            entries.push(key)
+                        }
+                        return entries
+                    },
+                    symlink(parent, newname, oldpath) {
+                        var node = MEMFS.createNode(parent, newname, 511 | 40960, 0);
+                        node.link = oldpath;
+                        return node
+                    },
+                    readlink(node) {
+                        if (!FS.isLink(node.mode)) {
+                            throw new FS.ErrnoError(28)
+                        }
+                        return node.link
+                    }
+                },
+                stream_ops: {
+                    read(stream, buffer, offset, length, position) {
+                        var contents = stream.node.contents;
+                        if (position >= stream.node.usedBytes) return 0;
+                        var size = Math.min(stream.node.usedBytes - position, length);
+                        if (size > 8 && contents.subarray) {
+                            buffer.set(contents.subarray(position, position + size), offset)
+                        } else {
+                            for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]
+                        }
+                        return size
+                    },
+                    write(stream, buffer, offset, length, position, canOwn) {
+                        if (!length) return 0;
+                        var node = stream.node;
+                        node.timestamp = Date.now();
+                        if (buffer.subarray && (!node.contents || node.contents.subarray)) {
+                            if (canOwn) {
+                                node.contents = buffer.subarray(offset, offset + length);
+                                node.usedBytes = length;
+                                return length
+                            } else if (node.usedBytes === 0 && position === 0) {
+                                node.contents = buffer.slice(offset, offset + length);
+                                node.usedBytes = length;
+                                return length
+                            } else if (position + length <= node.usedBytes) {
+                                node.contents.set(buffer.subarray(offset, offset + length), position);
+                                return length
+                            }
+                        }
+                        MEMFS.expandFileStorage(node, position + length);
+                        if (node.contents.subarray && buffer.subarray) {
+                            node.contents.set(buffer.subarray(offset, offset + length), position)
+                        } else {
+                            for (var i = 0; i < length; i++) {
+                                node.contents[position + i] = buffer[offset + i]
+                            }
+                        }
+                        node.usedBytes = Math.max(node.usedBytes, position + length);
+                        return length
+                    },
+                    llseek(stream, offset, whence) {
+                        var position = offset;
+                        if (whence === 1) {
+                            position += stream.position
+                        } else if (whence === 2) {
+                            if (FS.isFile(stream.node.mode)) {
+                                position += stream.node.usedBytes
+                            }
+                        }
+                        if (position < 0) {
+                            throw new FS.ErrnoError(28)
+                        }
+                        return position
+                    },
+                    allocate(stream, offset, length) {
+                        MEMFS.expandFileStorage(stream.node, offset + length);
+                        stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length)
+                    },
+                    mmap(stream, length, position, prot, flags) {
+                        if (!FS.isFile(stream.node.mode)) {
+                            throw new FS.ErrnoError(43)
+                        }
+                        var ptr;
+                        var allocated;
+                        var contents = stream.node.contents;
+                        if (!(flags & 2) && contents.buffer === HEAP8.buffer) {
+                            allocated = false;
+                            ptr = contents.byteOffset
+                        } else {
+                            if (position > 0 || position + length < contents.length) {
+                                if (contents.subarray) {
+                                    contents = contents.subarray(position, position + length)
+                                } else {
+                                    contents = Array.prototype.slice.call(contents, position, position + length)
+                                }
+                            }
+                            allocated = true;
+                            ptr = mmapAlloc(length);
+                            if (!ptr) {
+                                throw new FS.ErrnoError(48)
+                            }
+                            HEAP8.set(contents, ptr)
+                        }
+                        return {
+                            ptr: ptr,
+                            allocated: allocated
+                        }
+                    },
+                    msync(stream, buffer, offset, length, mmapFlags) {
+                        MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false);
+                        return 0
+                    }
+                }
+            };
+            var asyncLoad = (url, onload, onerror, noRunDep) => {
+                var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : "";
+                readAsync(url, arrayBuffer => {
+                    onload(new Uint8Array(arrayBuffer));
+                    if (dep) removeRunDependency(dep)
+                }, event => {
+                    if (onerror) {
+                        onerror()
+                    } else {
+                        throw `Loading data file "${url}" failed.`
+                    }
+                });
+                if (dep) addRunDependency(dep)
+            };
+            var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => {
+                FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn)
+            };
+            var preloadPlugins = Module["preloadPlugins"] || [];
+            var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => {
+                if (typeof Browser != "undefined") Browser.init();
+                var handled = false;
+                preloadPlugins.forEach(plugin => {
+                    if (handled) return;
+                    if (plugin["canHandle"](fullname)) {
+                        plugin["handle"](byteArray, fullname, finish, onerror);
+                        handled = true
+                    }
+                });
+                return handled
+            };
+            var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => {
+                var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent;
+                var dep = getUniqueRunDependency(`cp ${fullname}`);
+
+                function processData(byteArray) {
+                    function finish(byteArray) {
+                        preFinish?.();
+                        if (!dontCreateFile) {
+                            FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn)
+                        }
+                        onload?.();
+                        removeRunDependency(dep)
+                    }
+                    if (FS_handledByPreloadPlugin(byteArray, fullname, finish, () => {
+                            onerror?.();
+                            removeRunDependency(dep)
+                        })) {
+                        return
+                    }
+                    finish(byteArray)
+                }
+                addRunDependency(dep);
+                if (typeof url == "string") {
+                    asyncLoad(url, processData, onerror)
+                } else {
+                    processData(url)
+                }
+            };
+            var FS_modeStringToFlags = str => {
+                var flagModes = {
+                    "r": 0,
+                    "r+": 2,
+                    "w": 512 | 64 | 1,
+                    "w+": 512 | 64 | 2,
+                    "a": 1024 | 64 | 1,
+                    "a+": 1024 | 64 | 2
+                };
+                var flags = flagModes[str];
+                if (typeof flags == "undefined") {
+                    throw new Error(`Unknown file open mode: ${str}`)
+                }
+                return flags
+            };
+            var FS_getMode = (canRead, canWrite) => {
+                var mode = 0;
+                if (canRead) mode |= 292 | 73;
+                if (canWrite) mode |= 146;
+                return mode
+            };
+            var FS = {
+                root: null,
+                mounts: [],
+                devices: {},
+                streams: [],
+                nextInode: 1,
+                nameTable: null,
+                currentPath: "/",
+                initialized: false,
+                ignorePermissions: true,
+                ErrnoError: class {
+                    constructor(errno) {
+                        this.name = "ErrnoError";
+                        this.errno = errno
+                    }
+                },
+                genericErrors: {},
+                filesystems: null,
+                syncFSRequests: 0,
+                lookupPath(path, opts = {}) {
+                    path = PATH_FS.resolve(path);
+                    if (!path) return {
+                        path: "",
+                        node: null
+                    };
+                    var defaults = {
+                        follow_mount: true,
+                        recurse_count: 0
+                    };
+                    opts = Object.assign(defaults, opts);
+                    if (opts.recurse_count > 8) {
+                        throw new FS.ErrnoError(32)
+                    }
+                    var parts = path.split("/").filter(p => !!p);
+                    var current = FS.root;
+                    var current_path = "/";
+                    for (var i = 0; i < parts.length; i++) {
+                        var islast = i === parts.length - 1;
+                        if (islast && opts.parent) {
+                            break
+                        }
+                        current = FS.lookupNode(current, parts[i]);
+                        current_path = PATH.join2(current_path, parts[i]);
+                        if (FS.isMountpoint(current)) {
+                            if (!islast || islast && opts.follow_mount) {
+                                current = current.mounted.root
+                            }
+                        }
+                        if (!islast || opts.follow) {
+                            var count = 0;
+                            while (FS.isLink(current.mode)) {
+                                var link = FS.readlink(current_path);
+                                current_path = PATH_FS.resolve(PATH.dirname(current_path), link);
+                                var lookup = FS.lookupPath(current_path, {
+                                    recurse_count: opts.recurse_count + 1
+                                });
+                                current = lookup.node;
+                                if (count++ > 40) {
+                                    throw new FS.ErrnoError(32)
+                                }
+                            }
+                        }
+                    }
+                    return {
+                        path: current_path,
+                        node: current
+                    }
+                },
+                getPath(node) {
+                    var path;
+                    while (true) {
+                        if (FS.isRoot(node)) {
+                            var mount = node.mount.mountpoint;
+                            if (!path) return mount;
+                            return mount[mount.length - 1] !== "/" ? `${mount}/${path}` : mount + path
+                        }
+                        path = path ? `${node.name}/${path}` : node.name;
+                        node = node.parent
+                    }
+                },
+                hashName(parentid, name) {
+                    var hash = 0;
+                    for (var i = 0; i < name.length; i++) {
+                        hash = (hash << 5) - hash + name.charCodeAt(i) | 0
+                    }
+                    return (parentid + hash >>> 0) % FS.nameTable.length
+                },
+                hashAddNode(node) {
+                    var hash = FS.hashName(node.parent.id, node.name);
+                    node.name_next = FS.nameTable[hash];
+                    FS.nameTable[hash] = node
+                },
+                hashRemoveNode(node) {
+                    var hash = FS.hashName(node.parent.id, node.name);
+                    if (FS.nameTable[hash] === node) {
+                        FS.nameTable[hash] = node.name_next
+                    } else {
+                        var current = FS.nameTable[hash];
+                        while (current) {
+                            if (current.name_next === node) {
+                                current.name_next = node.name_next;
+                                break
+                            }
+                            current = current.name_next
+                        }
+                    }
+                },
+                lookupNode(parent, name) {
+                    var errCode = FS.mayLookup(parent);
+                    if (errCode) {
+                        throw new FS.ErrnoError(errCode)
+                    }
+                    var hash = FS.hashName(parent.id, name);
+                    for (var node = FS.nameTable[hash]; node; node = node.name_next) {
+                        var nodeName = node.name;
+                        if (node.parent.id === parent.id && nodeName === name) {
+                            return node
+                        }
+                    }
+                    return FS.lookup(parent, name)
+                },
+                createNode(parent, name, mode, rdev) {
+                    var node = new FS.FSNode(parent, name, mode, rdev);
+                    FS.hashAddNode(node);
+                    return node
+                },
+                destroyNode(node) {
+                    FS.hashRemoveNode(node)
+                },
+                isRoot(node) {
+                    return node === node.parent
+                },
+                isMountpoint(node) {
+                    return !!node.mounted
+                },
+                isFile(mode) {
+                    return (mode & 61440) === 32768
+                },
+                isDir(mode) {
+                    return (mode & 61440) === 16384
+                },
+                isLink(mode) {
+                    return (mode & 61440) === 40960
+                },
+                isChrdev(mode) {
+                    return (mode & 61440) === 8192
+                },
+                isBlkdev(mode) {
+                    return (mode & 61440) === 24576
+                },
+                isFIFO(mode) {
+                    return (mode & 61440) === 4096
+                },
+                isSocket(mode) {
+                    return (mode & 49152) === 49152
+                },
+                flagsToPermissionString(flag) {
+                    var perms = ["r", "w", "rw"][flag & 3];
+                    if (flag & 512) {
+                        perms += "w"
+                    }
+                    return perms
+                },
+                nodePermissions(node, perms) {
+                    if (FS.ignorePermissions) {
+                        return 0
+                    }
+                    if (perms.includes("r") && !(node.mode & 292)) {
+                        return 2
+                    } else if (perms.includes("w") && !(node.mode & 146)) {
+                        return 2
+                    } else if (perms.includes("x") && !(node.mode & 73)) {
+                        return 2
+                    }
+                    return 0
+                },
+                mayLookup(dir) {
+                    if (!FS.isDir(dir.mode)) return 54;
+                    var errCode = FS.nodePermissions(dir, "x");
+                    if (errCode) return errCode;
+                    if (!dir.node_ops.lookup) return 2;
+                    return 0
+                },
+                mayCreate(dir, name) {
+                    try {
+                        var node = FS.lookupNode(dir, name);
+                        return 20
+                    } catch (e) {}
+                    return FS.nodePermissions(dir, "wx")
+                },
+                mayDelete(dir, name, isdir) {
+                    var node;
+                    try {
+                        node = FS.lookupNode(dir, name)
+                    } catch (e) {
+                        return e.errno
+                    }
+                    var errCode = FS.nodePermissions(dir, "wx");
+                    if (errCode) {
+                        return errCode
+                    }
+                    if (isdir) {
+                        if (!FS.isDir(node.mode)) {
+                            return 54
+                        }
+                        if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
+                            return 10
+                        }
+                    } else {
+                        if (FS.isDir(node.mode)) {
+                            return 31
+                        }
+                    }
+                    return 0
+                },
+                mayOpen(node, flags) {
+                    if (!node) {
+                        return 44
+                    }
+                    if (FS.isLink(node.mode)) {
+                        return 32
+                    } else if (FS.isDir(node.mode)) {
+                        if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) {
+                            return 31
+                        }
+                    }
+                    return FS.nodePermissions(node, FS.flagsToPermissionString(flags))
+                },
+                MAX_OPEN_FDS: 4096,
+                nextfd() {
+                    for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) {
+                        if (!FS.streams[fd]) {
+                            return fd
+                        }
+                    }
+                    throw new FS.ErrnoError(33)
+                },
+                getStreamChecked(fd) {
+                    var stream = FS.getStream(fd);
+                    if (!stream) {
+                        throw new FS.ErrnoError(8)
+                    }
+                    return stream
+                },
+                getStream: fd => FS.streams[fd],
+                createStream(stream, fd = -1) {
+                    if (!FS.FSStream) {
+                        FS.FSStream = function() {
+                            this.shared = {}
+                        };
+                        FS.FSStream.prototype = {};
+                        Object.defineProperties(FS.FSStream.prototype, {
+                            object: {
+                                get() {
+                                    return this.node
+                                },
+                                set(val) {
+                                    this.node = val
+                                }
+                            },
+                            isRead: {
+                                get() {
+                                    return (this.flags & 2097155) !== 1
+                                }
+                            },
+                            isWrite: {
+                                get() {
+                                    return (this.flags & 2097155) !== 0
+                                }
+                            },
+                            isAppend: {
+                                get() {
+                                    return this.flags & 1024
+                                }
+                            },
+                            flags: {
+                                get() {
+                                    return this.shared.flags
+                                },
+                                set(val) {
+                                    this.shared.flags = val
+                                }
+                            },
+                            position: {
+                                get() {
+                                    return this.shared.position
+                                },
+                                set(val) {
+                                    this.shared.position = val
+                                }
+                            }
+                        })
+                    }
+                    stream = Object.assign(new FS.FSStream, stream);
+                    if (fd == -1) {
+                        fd = FS.nextfd()
+                    }
+                    stream.fd = fd;
+                    FS.streams[fd] = stream;
+                    return stream
+                },
+                closeStream(fd) {
+                    FS.streams[fd] = null
+                },
+                chrdev_stream_ops: {
+                    open(stream) {
+                        var device = FS.getDevice(stream.node.rdev);
+                        stream.stream_ops = device.stream_ops;
+                        stream.stream_ops.open?.(stream)
+                    },
+                    llseek() {
+                        throw new FS.ErrnoError(70)
+                    }
+                },
+                major: dev => dev >> 8,
+                minor: dev => dev & 255,
+                makedev: (ma, mi) => ma << 8 | mi,
+                registerDevice(dev, ops) {
+                    FS.devices[dev] = {
+                        stream_ops: ops
+                    }
+                },
+                getDevice: dev => FS.devices[dev],
+                getMounts(mount) {
+                    var mounts = [];
+                    var check = [mount];
+                    while (check.length) {
+                        var m = check.pop();
+                        mounts.push(m);
+                        check.push(...m.mounts)
+                    }
+                    return mounts
+                },
+                syncfs(populate, callback) {
+                    if (typeof populate == "function") {
+                        callback = populate;
+                        populate = false
+                    }
+                    FS.syncFSRequests++;
+                    if (FS.syncFSRequests > 1) {
+                        err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)
+                    }
+                    var mounts = FS.getMounts(FS.root.mount);
+                    var completed = 0;
+
+                    function doCallback(errCode) {
+                        FS.syncFSRequests--;
+                        return callback(errCode)
+                    }
+
+                    function done(errCode) {
+                        if (errCode) {
+                            if (!done.errored) {
+                                done.errored = true;
+                                return doCallback(errCode)
+                            }
+                            return
+                        }
+                        if (++completed >= mounts.length) {
+                            doCallback(null)
+                        }
+                    }
+                    mounts.forEach(mount => {
+                        if (!mount.type.syncfs) {
+                            return done(null)
+                        }
+                        mount.type.syncfs(mount, populate, done)
+                    })
+                },
+                mount(type, opts, mountpoint) {
+                    var root = mountpoint === "/";
+                    var pseudo = !mountpoint;
+                    var node;
+                    if (root && FS.root) {
+                        throw new FS.ErrnoError(10)
+                    } else if (!root && !pseudo) {
+                        var lookup = FS.lookupPath(mountpoint, {
+                            follow_mount: false
+                        });
+                        mountpoint = lookup.path;
+                        node = lookup.node;
+                        if (FS.isMountpoint(node)) {
+                            throw new FS.ErrnoError(10)
+                        }
+                        if (!FS.isDir(node.mode)) {
+                            throw new FS.ErrnoError(54)
+                        }
+                    }
+                    var mount = {
+                        type: type,
+                        opts: opts,
+                        mountpoint: mountpoint,
+                        mounts: []
+                    };
+                    var mountRoot = type.mount(mount);
+                    mountRoot.mount = mount;
+                    mount.root = mountRoot;
+                    if (root) {
+                        FS.root = mountRoot
+                    } else if (node) {
+                        node.mounted = mount;
+                        if (node.mount) {
+                            node.mount.mounts.push(mount)
+                        }
+                    }
+                    return mountRoot
+                },
+                unmount(mountpoint) {
+                    var lookup = FS.lookupPath(mountpoint, {
+                        follow_mount: false
+                    });
+                    if (!FS.isMountpoint(lookup.node)) {
+                        throw new FS.ErrnoError(28)
+                    }
+                    var node = lookup.node;
+                    var mount = node.mounted;
+                    var mounts = FS.getMounts(mount);
+                    Object.keys(FS.nameTable).forEach(hash => {
+                        var current = FS.nameTable[hash];
+                        while (current) {
+                            var next = current.name_next;
+                            if (mounts.includes(current.mount)) {
+                                FS.destroyNode(current)
+                            }
+                            current = next
+                        }
+                    });
+                    node.mounted = null;
+                    var idx = node.mount.mounts.indexOf(mount);
+                    node.mount.mounts.splice(idx, 1)
+                },
+                lookup(parent, name) {
+                    return parent.node_ops.lookup(parent, name)
+                },
+                mknod(path, mode, dev) {
+                    var lookup = FS.lookupPath(path, {
+                        parent: true
+                    });
+                    var parent = lookup.node;
+                    var name = PATH.basename(path);
+                    if (!name || name === "." || name === "..") {
+                        throw new FS.ErrnoError(28)
+                    }
+                    var errCode = FS.mayCreate(parent, name);
+                    if (errCode) {
+                        throw new FS.ErrnoError(errCode)
+                    }
+                    if (!parent.node_ops.mknod) {
+                        throw new FS.ErrnoError(63)
+                    }
+                    return parent.node_ops.mknod(parent, name, mode, dev)
+                },
+                create(path, mode) {
+                    mode = mode !== undefined ? mode : 438;
+                    mode &= 4095;
+                    mode |= 32768;
+                    return FS.mknod(path, mode, 0)
+                },
+                mkdir(path, mode) {
+                    mode = mode !== undefined ? mode : 511;
+                    mode &= 511 | 512;
+                    mode |= 16384;
+                    return FS.mknod(path, mode, 0)
+                },
+                mkdirTree(path, mode) {
+                    var dirs = path.split("/");
+                    var d = "";
+                    for (var i = 0; i < dirs.length; ++i) {
+                        if (!dirs[i]) continue;
+                        d += "/" + dirs[i];
+                        try {
+                            FS.mkdir(d, mode)
+                        } catch (e) {
+                            if (e.errno != 20) throw e
+                        }
+                    }
+                },
+                mkdev(path, mode, dev) {
+                    if (typeof dev == "undefined") {
+                        dev = mode;
+                        mode = 438
+                    }
+                    mode |= 8192;
+                    return FS.mknod(path, mode, dev)
+                },
+                symlink(oldpath, newpath) {
+                    if (!PATH_FS.resolve(oldpath)) {
+                        throw new FS.ErrnoError(44)
+                    }
+                    var lookup = FS.lookupPath(newpath, {
+                        parent: true
+                    });
+                    var parent = lookup.node;
+                    if (!parent) {
+                        throw new FS.ErrnoError(44)
+                    }
+                    var newname = PATH.basename(newpath);
+                    var errCode = FS.mayCreate(parent, newname);
+                    if (errCode) {
+                        throw new FS.ErrnoError(errCode)
+                    }
+                    if (!parent.node_ops.symlink) {
+                        throw new FS.ErrnoError(63)
+                    }
+                    return parent.node_ops.symlink(parent, newname, oldpath)
+                },
+                rename(old_path, new_path) {
+                    var old_dirname = PATH.dirname(old_path);
+                    var new_dirname = PATH.dirname(new_path);
+                    var old_name = PATH.basename(old_path);
+                    var new_name = PATH.basename(new_path);
+                    var lookup, old_dir, new_dir;
+                    lookup = FS.lookupPath(old_path, {
+                        parent: true
+                    });
+                    old_dir = lookup.node;
+                    lookup = FS.lookupPath(new_path, {
+                        parent: true
+                    });
+                    new_dir = lookup.node;
+                    if (!old_dir || !new_dir) throw new FS.ErrnoError(44);
+                    if (old_dir.mount !== new_dir.mount) {
+                        throw new FS.ErrnoError(75)
+                    }
+                    var old_node = FS.lookupNode(old_dir, old_name);
+                    var relative = PATH_FS.relative(old_path, new_dirname);
+                    if (relative.charAt(0) !== ".") {
+                        throw new FS.ErrnoError(28)
+                    }
+                    relative = PATH_FS.relative(new_path, old_dirname);
+                    if (relative.charAt(0) !== ".") {
+                        throw new FS.ErrnoError(55)
+                    }
+                    var new_node;
+                    try {
+                        new_node = FS.lookupNode(new_dir, new_name)
+                    } catch (e) {}
+                    if (old_node === new_node) {
+                        return
+                    }
+                    var isdir = FS.isDir(old_node.mode);
+                    var errCode = FS.mayDelete(old_dir, old_name, isdir);
+                    if (errCode) {
+                        throw new FS.ErrnoError(errCode)
+                    }
+                    errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name);
+                    if (errCode) {
+                        throw new FS.ErrnoError(errCode)
+                    }
+                    if (!old_dir.node_ops.rename) {
+                        throw new FS.ErrnoError(63)
+                    }
+                    if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) {
+                        throw new FS.ErrnoError(10)
+                    }
+                    if (new_dir !== old_dir) {
+                        errCode = FS.nodePermissions(old_dir, "w");
+                        if (errCode) {
+                            throw new FS.ErrnoError(errCode)
+                        }
+                    }
+                    FS.hashRemoveNode(old_node);
+                    try {
+                        old_dir.node_ops.rename(old_node, new_dir, new_name)
+                    } catch (e) {
+                        throw e
+                    } finally {
+                        FS.hashAddNode(old_node)
+                    }
+                },
+                rmdir(path) {
+                    var lookup = FS.lookupPath(path, {
+                        parent: true
+                    });
+                    var parent = lookup.node;
+                    var name = PATH.basename(path);
+                    var node = FS.lookupNode(parent, name);
+                    var errCode = FS.mayDelete(parent, name, true);
+                    if (errCode) {
+                        throw new FS.ErrnoError(errCode)
+                    }
+                    if (!parent.node_ops.rmdir) {
+                        throw new FS.ErrnoError(63)
+                    }
+                    if (FS.isMountpoint(node)) {
+                        throw new FS.ErrnoError(10)
+                    }
+                    parent.node_ops.rmdir(parent, name);
+                    FS.destroyNode(node)
+                },
+                readdir(path) {
+                    var lookup = FS.lookupPath(path, {
+                        follow: true
+                    });
+                    var node = lookup.node;
+                    if (!node.node_ops.readdir) {
+                        throw new FS.ErrnoError(54)
+                    }
+                    return node.node_ops.readdir(node)
+                },
+                unlink(path) {
+                    var lookup = FS.lookupPath(path, {
+                        parent: true
+                    });
+                    var parent = lookup.node;
+                    if (!parent) {
+                        throw new FS.ErrnoError(44)
+                    }
+                    var name = PATH.basename(path);
+                    var node = FS.lookupNode(parent, name);
+                    var errCode = FS.mayDelete(parent, name, false);
+                    if (errCode) {
+                        throw new FS.ErrnoError(errCode)
+                    }
+                    if (!parent.node_ops.unlink) {
+                        throw new FS.ErrnoError(63)
+                    }
+                    if (FS.isMountpoint(node)) {
+                        throw new FS.ErrnoError(10)
+                    }
+                    parent.node_ops.unlink(parent, name);
+                    FS.destroyNode(node)
+                },
+                readlink(path) {
+                    var lookup = FS.lookupPath(path);
+                    var link = lookup.node;
+                    if (!link) {
+                        throw new FS.ErrnoError(44)
+                    }
+                    if (!link.node_ops.readlink) {
+                        throw new FS.ErrnoError(28)
+                    }
+                    return PATH_FS.resolve(FS.getPath(link.parent), link.node_ops.readlink(link))
+                },
+                stat(path, dontFollow) {
+                    var lookup = FS.lookupPath(path, {
+                        follow: !dontFollow
+                    });
+                    var node = lookup.node;
+                    if (!node) {
+                        throw new FS.ErrnoError(44)
+                    }
+                    if (!node.node_ops.getattr) {
+                        throw new FS.ErrnoError(63)
+                    }
+                    return node.node_ops.getattr(node)
+                },
+                lstat(path) {
+                    return FS.stat(path, true)
+                },
+                chmod(path, mode, dontFollow) {
+                    var node;
+                    if (typeof path == "string") {
+                        var lookup = FS.lookupPath(path, {
+                            follow: !dontFollow
+                        });
+                        node = lookup.node
+                    } else {
+                        node = path
+                    }
+                    if (!node.node_ops.setattr) {
+                        throw new FS.ErrnoError(63)
+                    }
+                    node.node_ops.setattr(node, {
+                        mode: mode & 4095 | node.mode & ~4095,
+                        timestamp: Date.now()
+                    })
+                },
+                lchmod(path, mode) {
+                    FS.chmod(path, mode, true)
+                },
+                fchmod(fd, mode) {
+                    var stream = FS.getStreamChecked(fd);
+                    FS.chmod(stream.node, mode)
+                },
+                chown(path, uid, gid, dontFollow) {
+                    var node;
+                    if (typeof path == "string") {
+                        var lookup = FS.lookupPath(path, {
+                            follow: !dontFollow
+                        });
+                        node = lookup.node
+                    } else {
+                        node = path
+                    }
+                    if (!node.node_ops.setattr) {
+                        throw new FS.ErrnoError(63)
+                    }
+                    node.node_ops.setattr(node, {
+                        timestamp: Date.now()
+                    })
+                },
+                lchown(path, uid, gid) {
+                    FS.chown(path, uid, gid, true)
+                },
+                fchown(fd, uid, gid) {
+                    var stream = FS.getStreamChecked(fd);
+                    FS.chown(stream.node, uid, gid)
+                },
+                truncate(path, len) {
+                    if (len < 0) {
+                        throw new FS.ErrnoError(28)
+                    }
+                    var node;
+                    if (typeof path == "string") {
+                        var lookup = FS.lookupPath(path, {
+                            follow: true
+                        });
+                        node = lookup.node
+                    } else {
+                        node = path
+                    }
+                    if (!node.node_ops.setattr) {
+                        throw new FS.ErrnoError(63)
+                    }
+                    if (FS.isDir(node.mode)) {
+                        throw new FS.ErrnoError(31)
+                    }
+                    if (!FS.isFile(node.mode)) {
+                        throw new FS.ErrnoError(28)
+                    }
+                    var errCode = FS.nodePermissions(node, "w");
+                    if (errCode) {
+                        throw new FS.ErrnoError(errCode)
+                    }
+                    node.node_ops.setattr(node, {
+                        size: len,
+                        timestamp: Date.now()
+                    })
+                },
+                ftruncate(fd, len) {
+                    var stream = FS.getStreamChecked(fd);
+                    if ((stream.flags & 2097155) === 0) {
+                        throw new FS.ErrnoError(28)
+                    }
+                    FS.truncate(stream.node, len)
+                },
+                utime(path, atime, mtime) {
+                    var lookup = FS.lookupPath(path, {
+                        follow: true
+                    });
+                    var node = lookup.node;
+                    node.node_ops.setattr(node, {
+                        timestamp: Math.max(atime, mtime)
+                    })
+                },
+                open(path, flags, mode) {
+                    if (path === "") {
+                        throw new FS.ErrnoError(44)
+                    }
+                    flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags;
+                    mode = typeof mode == "undefined" ? 438 : mode;
+                    if (flags & 64) {
+                        mode = mode & 4095 | 32768
+                    } else {
+                        mode = 0
+                    }
+                    var node;
+                    if (typeof path == "object") {
+                        node = path
+                    } else {
+                        path = PATH.normalize(path);
+                        try {
+                            var lookup = FS.lookupPath(path, {
+                                follow: !(flags & 131072)
+                            });
+                            node = lookup.node
+                        } catch (e) {}
+                    }
+                    var created = false;
+                    if (flags & 64) {
+                        if (node) {
+                            if (flags & 128) {
+                                throw new FS.ErrnoError(20)
+                            }
+                        } else {
+                            node = FS.mknod(path, mode, 0);
+                            created = true
+                        }
+                    }
+                    if (!node) {
+                        throw new FS.ErrnoError(44)
+                    }
+                    if (FS.isChrdev(node.mode)) {
+                        flags &= ~512
+                    }
+                    if (flags & 65536 && !FS.isDir(node.mode)) {
+                        throw new FS.ErrnoError(54)
+                    }
+                    if (!created) {
+                        var errCode = FS.mayOpen(node, flags);
+                        if (errCode) {
+                            throw new FS.ErrnoError(errCode)
+                        }
+                    }
+                    if (flags & 512 && !created) {
+                        FS.truncate(node, 0)
+                    }
+                    flags &= ~(128 | 512 | 131072);
+                    var stream = FS.createStream({
+                        node: node,
+                        path: FS.getPath(node),
+                        flags: flags,
+                        seekable: true,
+                        position: 0,
+                        stream_ops: node.stream_ops,
+                        ungotten: [],
+                        error: false
+                    });
+                    if (stream.stream_ops.open) {
+                        stream.stream_ops.open(stream)
+                    }
+                    if (Module["logReadFiles"] && !(flags & 1)) {
+                        if (!FS.readFiles) FS.readFiles = {};
+                        if (!(path in FS.readFiles)) {
+                            FS.readFiles[path] = 1
+                        }
+                    }
+                    return stream
+                },
+                close(stream) {
+                    if (FS.isClosed(stream)) {
+                        throw new FS.ErrnoError(8)
+                    }
+                    if (stream.getdents) stream.getdents = null;
+                    try {
+                        if (stream.stream_ops.close) {
+                            stream.stream_ops.close(stream)
+                        }
+                    } catch (e) {
+                        throw e
+                    } finally {
+                        FS.closeStream(stream.fd)
+                    }
+                    stream.fd = null
+                },
+                isClosed(stream) {
+                    return stream.fd === null
+                },
+                llseek(stream, offset, whence) {
+                    if (FS.isClosed(stream)) {
+                        throw new FS.ErrnoError(8)
+                    }
+                    if (!stream.seekable || !stream.stream_ops.llseek) {
+                        throw new FS.ErrnoError(70)
+                    }
+                    if (whence != 0 && whence != 1 && whence != 2) {
+                        throw new FS.ErrnoError(28)
+                    }
+                    stream.position = stream.stream_ops.llseek(stream, offset, whence);
+                    stream.ungotten = [];
+                    return stream.position
+                },
+                read(stream, buffer, offset, length, position) {
+                    if (length < 0 || position < 0) {
+                        throw new FS.ErrnoError(28)
+                    }
+                    if (FS.isClosed(stream)) {
+                        throw new FS.ErrnoError(8)
+                    }
+                    if ((stream.flags & 2097155) === 1) {
+                        throw new FS.ErrnoError(8)
+                    }
+                    if (FS.isDir(stream.node.mode)) {
+                        throw new FS.ErrnoError(31)
+                    }
+                    if (!stream.stream_ops.read) {
+                        throw new FS.ErrnoError(28)
+                    }
+                    var seeking = typeof position != "undefined";
+                    if (!seeking) {
+                        position = stream.position
+                    } else if (!stream.seekable) {
+                        throw new FS.ErrnoError(70)
+                    }
+                    var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
+                    if (!seeking) stream.position += bytesRead;
+                    return bytesRead
+                },
+                write(stream, buffer, offset, length, position, canOwn) {
+                    if (length < 0 || position < 0) {
+                        throw new FS.ErrnoError(28)
+                    }
+                    if (FS.isClosed(stream)) {
+                        throw new FS.ErrnoError(8)
+                    }
+                    if ((stream.flags & 2097155) === 0) {
+                        throw new FS.ErrnoError(8)
+                    }
+                    if (FS.isDir(stream.node.mode)) {
+                        throw new FS.ErrnoError(31)
+                    }
+                    if (!stream.stream_ops.write) {
+                        throw new FS.ErrnoError(28)
+                    }
+                    if (stream.seekable && stream.flags & 1024) {
+                        FS.llseek(stream, 0, 2)
+                    }
+                    var seeking = typeof position != "undefined";
+                    if (!seeking) {
+                        position = stream.position
+                    } else if (!stream.seekable) {
+                        throw new FS.ErrnoError(70)
+                    }
+                    var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
+                    if (!seeking) stream.position += bytesWritten;
+                    return bytesWritten
+                },
+                allocate(stream, offset, length) {
+                    if (FS.isClosed(stream)) {
+                        throw new FS.ErrnoError(8)
+                    }
+                    if (offset < 0 || length <= 0) {
+                        throw new FS.ErrnoError(28)
+                    }
+                    if ((stream.flags & 2097155) === 0) {
+                        throw new FS.ErrnoError(8)
+                    }
+                    if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) {
+                        throw new FS.ErrnoError(43)
+                    }
+                    if (!stream.stream_ops.allocate) {
+                        throw new FS.ErrnoError(138)
+                    }
+                    stream.stream_ops.allocate(stream, offset, length)
+                },
+                mmap(stream, length, position, prot, flags) {
+                    if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) {
+                        throw new FS.ErrnoError(2)
+                    }
+                    if ((stream.flags & 2097155) === 1) {
+                        throw new FS.ErrnoError(2)
+                    }
+                    if (!stream.stream_ops.mmap) {
+                        throw new FS.ErrnoError(43)
+                    }
+                    return stream.stream_ops.mmap(stream, length, position, prot, flags)
+                },
+                msync(stream, buffer, offset, length, mmapFlags) {
+                    if (!stream.stream_ops.msync) {
+                        return 0
+                    }
+                    return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags)
+                },
+                munmap: stream => 0,
+                ioctl(stream, cmd, arg) {
+                    if (!stream.stream_ops.ioctl) {
+                        throw new FS.ErrnoError(59)
+                    }
+                    return stream.stream_ops.ioctl(stream, cmd, arg)
+                },
+                readFile(path, opts = {}) {
+                    opts.flags = opts.flags || 0;
+                    opts.encoding = opts.encoding || "binary";
+                    if (opts.encoding !== "utf8" && opts.encoding !== "binary") {
+                        throw new Error(`Invalid encoding type "${opts.encoding}"`)
+                    }
+                    var ret;
+                    var stream = FS.open(path, opts.flags);
+                    var stat = FS.stat(path);
+                    var length = stat.size;
+                    var buf = new Uint8Array(length);
+                    FS.read(stream, buf, 0, length, 0);
+                    if (opts.encoding === "utf8") {
+                        ret = UTF8ArrayToString(buf, 0)
+                    } else if (opts.encoding === "binary") {
+                        ret = buf
+                    }
+                    FS.close(stream);
+                    return ret
+                },
+                writeFile(path, data, opts = {}) {
+                    opts.flags = opts.flags || 577;
+                    var stream = FS.open(path, opts.flags, opts.mode);
+                    if (typeof data == "string") {
+                        var buf = new Uint8Array(lengthBytesUTF8(data) + 1);
+                        var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length);
+                        FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn)
+                    } else if (ArrayBuffer.isView(data)) {
+                        FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn)
+                    } else {
+                        throw new Error("Unsupported data type")
+                    }
+                    FS.close(stream)
+                },
+                cwd: () => FS.currentPath,
+                chdir(path) {
+                    var lookup = FS.lookupPath(path, {
+                        follow: true
+                    });
+                    if (lookup.node === null) {
+                        throw new FS.ErrnoError(44)
+                    }
+                    if (!FS.isDir(lookup.node.mode)) {
+                        throw new FS.ErrnoError(54)
+                    }
+                    var errCode = FS.nodePermissions(lookup.node, "x");
+                    if (errCode) {
+                        throw new FS.ErrnoError(errCode)
+                    }
+                    FS.currentPath = lookup.path
+                },
+                createDefaultDirectories() {
+                    FS.mkdir("/tmp");
+                    FS.mkdir("/home");
+                    FS.mkdir("/home/web_user")
+                },
+                createDefaultDevices() {
+                    FS.mkdir("/dev");
+                    FS.registerDevice(FS.makedev(1, 3), {
+                        read: () => 0,
+                        write: (stream, buffer, offset, length, pos) => length
+                    });
+                    FS.mkdev("/dev/null", FS.makedev(1, 3));
+                    TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
+                    TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
+                    FS.mkdev("/dev/tty", FS.makedev(5, 0));
+                    FS.mkdev("/dev/tty1", FS.makedev(6, 0));
+                    var randomBuffer = new Uint8Array(1024),
+                        randomLeft = 0;
+                    var randomByte = () => {
+                        if (randomLeft === 0) {
+                            randomLeft = randomFill(randomBuffer).byteLength
+                        }
+                        return randomBuffer[--randomLeft]
+                    };
+                    FS.createDevice("/dev", "random", randomByte);
+                    FS.createDevice("/dev", "urandom", randomByte);
+                    FS.mkdir("/dev/shm");
+                    FS.mkdir("/dev/shm/tmp")
+                },
+                createSpecialDirectories() {
+                    FS.mkdir("/proc");
+                    var proc_self = FS.mkdir("/proc/self");
+                    FS.mkdir("/proc/self/fd");
+                    FS.mount({
+                        mount() {
+                            var node = FS.createNode(proc_self, "fd", 16384 | 511, 73);
+                            node.node_ops = {
+                                lookup(parent, name) {
+                                    var fd = +name;
+                                    var stream = FS.getStreamChecked(fd);
+                                    var ret = {
+                                        parent: null,
+                                        mount: {
+                                            mountpoint: "fake"
+                                        },
+                                        node_ops: {
+                                            readlink: () => stream.path
+                                        }
+                                    };
+                                    ret.parent = ret;
+                                    return ret
+                                }
+                            };
+                            return node
+                        }
+                    }, {}, "/proc/self/fd")
+                },
+                createStandardStreams() {
+                    if (Module["stdin"]) {
+                        FS.createDevice("/dev", "stdin", Module["stdin"])
+                    } else {
+                        FS.symlink("/dev/tty", "/dev/stdin")
+                    }
+                    if (Module["stdout"]) {
+                        FS.createDevice("/dev", "stdout", null, Module["stdout"])
+                    } else {
+                        FS.symlink("/dev/tty", "/dev/stdout")
+                    }
+                    if (Module["stderr"]) {
+                        FS.createDevice("/dev", "stderr", null, Module["stderr"])
+                    } else {
+                        FS.symlink("/dev/tty1", "/dev/stderr")
+                    }
+                    var stdin = FS.open("/dev/stdin", 0);
+                    var stdout = FS.open("/dev/stdout", 1);
+                    var stderr = FS.open("/dev/stderr", 1)
+                },
+                staticInit() {
+                    [44].forEach(code => {
+                        FS.genericErrors[code] = new FS.ErrnoError(code);
+                        FS.genericErrors[code].stack = "<generic error, no stack>"
+                    });
+                    FS.nameTable = new Array(4096);
+                    FS.mount(MEMFS, {}, "/");
+                    FS.createDefaultDirectories();
+                    FS.createDefaultDevices();
+                    FS.createSpecialDirectories();
+                    FS.filesystems = {
+                        "MEMFS": MEMFS
+                    }
+                },
+                init(input, output, error) {
+                    FS.init.initialized = true;
+                    Module["stdin"] = input || Module["stdin"];
+                    Module["stdout"] = output || Module["stdout"];
+                    Module["stderr"] = error || Module["stderr"];
+                    FS.createStandardStreams()
+                },
+                quit() {
+                    FS.init.initialized = false;
+                    for (var i = 0; i < FS.streams.length; i++) {
+                        var stream = FS.streams[i];
+                        if (!stream) {
+                            continue
+                        }
+                        FS.close(stream)
+                    }
+                },
+                findObject(path, dontResolveLastLink) {
+                    var ret = FS.analyzePath(path, dontResolveLastLink);
+                    if (!ret.exists) {
+                        return null
+                    }
+                    return ret.object
+                },
+                analyzePath(path, dontResolveLastLink) {
+                    try {
+                        var lookup = FS.lookupPath(path, {
+                            follow: !dontResolveLastLink
+                        });
+                        path = lookup.path
+                    } catch (e) {}
+                    var ret = {
+                        isRoot: false,
+                        exists: false,
+                        error: 0,
+                        name: null,
+                        path: null,
+                        object: null,
+                        parentExists: false,
+                        parentPath: null,
+                        parentObject: null
+                    };
+                    try {
+                        var lookup = FS.lookupPath(path, {
+                            parent: true
+                        });
+                        ret.parentExists = true;
+                        ret.parentPath = lookup.path;
+                        ret.parentObject = lookup.node;
+                        ret.name = PATH.basename(path);
+                        lookup = FS.lookupPath(path, {
+                            follow: !dontResolveLastLink
+                        });
+                        ret.exists = true;
+                        ret.path = lookup.path;
+                        ret.object = lookup.node;
+                        ret.name = lookup.node.name;
+                        ret.isRoot = lookup.path === "/"
+                    } catch (e) {
+                        ret.error = e.errno
+                    }
+                    return ret
+                },
+                createPath(parent, path, canRead, canWrite) {
+                    parent = typeof parent == "string" ? parent : FS.getPath(parent);
+                    var parts = path.split("/").reverse();
+                    while (parts.length) {
+                        var part = parts.pop();
+                        if (!part) continue;
+                        var current = PATH.join2(parent, part);
+                        try {
+                            FS.mkdir(current)
+                        } catch (e) {}
+                        parent = current
+                    }
+                    return current
+                },
+                createFile(parent, name, properties, canRead, canWrite) {
+                    var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
+                    var mode = FS_getMode(canRead, canWrite);
+                    return FS.create(path, mode)
+                },
+                createDataFile(parent, name, data, canRead, canWrite, canOwn) {
+                    var path = name;
+                    if (parent) {
+                        parent = typeof parent == "string" ? parent : FS.getPath(parent);
+                        path = name ? PATH.join2(parent, name) : parent
+                    }
+                    var mode = FS_getMode(canRead, canWrite);
+                    var node = FS.create(path, mode);
+                    if (data) {
+                        if (typeof data == "string") {
+                            var arr = new Array(data.length);
+                            for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i);
+                            data = arr
+                        }
+                        FS.chmod(node, mode | 146);
+                        var stream = FS.open(node, 577);
+                        FS.write(stream, data, 0, data.length, 0, canOwn);
+                        FS.close(stream);
+                        FS.chmod(node, mode)
+                    }
+                },
+                createDevice(parent, name, input, output) {
+                    var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
+                    var mode = FS_getMode(!!input, !!output);
+                    if (!FS.createDevice.major) FS.createDevice.major = 64;
+                    var dev = FS.makedev(FS.createDevice.major++, 0);
+                    FS.registerDevice(dev, {
+                        open(stream) {
+                            stream.seekable = false
+                        },
+                        close(stream) {
+                            if (output?.buffer?.length) {
+                                output(10)
+                            }
+                        },
+                        read(stream, buffer, offset, length, pos) {
+                            var bytesRead = 0;
+                            for (var i = 0; i < length; i++) {
+                                var result;
+                                try {
+                                    result = input()
+                                } catch (e) {
+                                    throw new FS.ErrnoError(29)
+                                }
+                                if (result === undefined && bytesRead === 0) {
+                                    throw new FS.ErrnoError(6)
+                                }
+                                if (result === null || result === undefined) break;
+                                bytesRead++;
+                                buffer[offset + i] = result
+                            }
+                            if (bytesRead) {
+                                stream.node.timestamp = Date.now()
+                            }
+                            return bytesRead
+                        },
+                        write(stream, buffer, offset, length, pos) {
+                            for (var i = 0; i < length; i++) {
+                                try {
+                                    output(buffer[offset + i])
+                                } catch (e) {
+                                    throw new FS.ErrnoError(29)
+                                }
+                            }
+                            if (length) {
+                                stream.node.timestamp = Date.now()
+                            }
+                            return i
+                        }
+                    });
+                    return FS.mkdev(path, mode, dev)
+                },
+                forceLoadFile(obj) {
+                    if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
+                    if (typeof XMLHttpRequest != "undefined") {
+                        throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")
+                    } else if (read_) {
+                        try {
+                            obj.contents = intArrayFromString(read_(obj.url), true);
+                            obj.usedBytes = obj.contents.length
+                        } catch (e) {
+                            throw new FS.ErrnoError(29)
+                        }
+                    } else {
+                        throw new Error("Cannot load without read() or XMLHttpRequest.")
+                    }
+                },
+                createLazyFile(parent, name, url, canRead, canWrite) {
+                    function LazyUint8Array() {
+                        this.lengthKnown = false;
+                        this.chunks = []
+                    }
+                    LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) {
+                        if (idx > this.length - 1 || idx < 0) {
+                            return undefined
+                        }
+                        var chunkOffset = idx % this.chunkSize;
+                        var chunkNum = idx / this.chunkSize | 0;
+                        return this.getter(chunkNum)[chunkOffset]
+                    };
+                    LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) {
+                        this.getter = getter
+                    };
+                    LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() {
+                        var xhr = new XMLHttpRequest;
+                        xhr.open("HEAD", url, false);
+                        xhr.send(null);
+                        if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
+                        var datalength = Number(xhr.getResponseHeader("Content-length"));
+                        var header;
+                        var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
+                        var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
+                        var chunkSize = 1024 * 1024;
+                        if (!hasByteServing) chunkSize = datalength;
+                        var doXHR = (from, to) => {
+                            if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
+                            if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!");
+                            var xhr = new XMLHttpRequest;
+                            xhr.open("GET", url, false);
+                            if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to);
+                            xhr.responseType = "arraybuffer";
+                            if (xhr.overrideMimeType) {
+                                xhr.overrideMimeType("text/plain; charset=x-user-defined")
+                            }
+                            xhr.send(null);
+                            if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
+                            if (xhr.response !== undefined) {
+                                return new Uint8Array(xhr.response || [])
+                            }
+                            return intArrayFromString(xhr.responseText || "", true)
+                        };
+                        var lazyArray = this;
+                        lazyArray.setDataGetter(chunkNum => {
+                            var start = chunkNum * chunkSize;
+                            var end = (chunkNum + 1) * chunkSize - 1;
+                            end = Math.min(end, datalength - 1);
+                            if (typeof lazyArray.chunks[chunkNum] == "undefined") {
+                                lazyArray.chunks[chunkNum] = doXHR(start, end)
+                            }
+                            if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!");
+                            return lazyArray.chunks[chunkNum]
+                        });
+                        if (usesGzip || !datalength) {
+                            chunkSize = datalength = 1;
+                            datalength = this.getter(0).length;
+                            chunkSize = datalength;
+                            out("LazyFiles on gzip forces download of the whole file when length is accessed")
+                        }
+                        this._length = datalength;
+                        this._chunkSize = chunkSize;
+                        this.lengthKnown = true
+                    };
+                    if (typeof XMLHttpRequest != "undefined") {
+                        if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
+                        var lazyArray = new LazyUint8Array;
+                        Object.defineProperties(lazyArray, {
+                            length: {
+                                get: function() {
+                                    if (!this.lengthKnown) {
+                                        this.cacheLength()
+                                    }
+                                    return this._length
+                                }
+                            },
+                            chunkSize: {
+                                get: function() {
+                                    if (!this.lengthKnown) {
+                                        this.cacheLength()
+                                    }
+                                    return this._chunkSize
+                                }
+                            }
+                        });
+                        var properties = {
+                            isDevice: false,
+                            contents: lazyArray
+                        }
+                    } else {
+                        var properties = {
+                            isDevice: false,
+                            url: url
+                        }
+                    }
+                    var node = FS.createFile(parent, name, properties, canRead, canWrite);
+                    if (properties.contents) {
+                        node.contents = properties.contents
+                    } else if (properties.url) {
+                        node.contents = null;
+                        node.url = properties.url
+                    }
+                    Object.defineProperties(node, {
+                        usedBytes: {
+                            get: function() {
+                                return this.contents.length
+                            }
+                        }
+                    });
+                    var stream_ops = {};
+                    var keys = Object.keys(node.stream_ops);
+                    keys.forEach(key => {
+                        var fn = node.stream_ops[key];
+                        stream_ops[key] = (...args) => {
+                            FS.forceLoadFile(node);
+                            return fn(...args)
+                        }
+                    });
+
+                    function writeChunks(stream, buffer, offset, length, position) {
+                        var contents = stream.node.contents;
+                        if (position >= contents.length) return 0;
+                        var size = Math.min(contents.length - position, length);
+                        if (contents.slice) {
+                            for (var i = 0; i < size; i++) {
+                                buffer[offset + i] = contents[position + i]
+                            }
+                        } else {
+                            for (var i = 0; i < size; i++) {
+                                buffer[offset + i] = contents.get(position + i)
+                            }
+                        }
+                        return size
+                    }
+                    stream_ops.read = (stream, buffer, offset, length, position) => {
+                        FS.forceLoadFile(node);
+                        return writeChunks(stream, buffer, offset, length, position)
+                    };
+                    stream_ops.mmap = (stream, length, position, prot, flags) => {
+                        FS.forceLoadFile(node);
+                        var ptr = mmapAlloc(length);
+                        if (!ptr) {
+                            throw new FS.ErrnoError(48)
+                        }
+                        writeChunks(stream, HEAP8, ptr, length, position);
+                        return {
+                            ptr: ptr,
+                            allocated: true
+                        }
+                    };
+                    node.stream_ops = stream_ops;
+                    return node
+                }
+            };
+            var UTF8ToString = (ptr, maxBytesToRead) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
+            var SYSCALLS = {
+                DEFAULT_POLLMASK: 5,
+                calculateAt(dirfd, path, allowEmpty) {
+                    if (PATH.isAbs(path)) {
+                        return path
+                    }
+                    var dir;
+                    if (dirfd === -100) {
+                        dir = FS.cwd()
+                    } else {
+                        var dirstream = SYSCALLS.getStreamFromFD(dirfd);
+                        dir = dirstream.path
+                    }
+                    if (path.length == 0) {
+                        if (!allowEmpty) {
+                            throw new FS.ErrnoError(44)
+                        }
+                        return dir
+                    }
+                    return PATH.join2(dir, path)
+                },
+                doStat(func, path, buf) {
+                    var stat = func(path);
+                    HEAP32[buf >> 2] = stat.dev;
+                    HEAP32[buf + 4 >> 2] = stat.mode;
+                    HEAPU32[buf + 8 >> 2] = stat.nlink;
+                    HEAP32[buf + 12 >> 2] = stat.uid;
+                    HEAP32[buf + 16 >> 2] = stat.gid;
+                    HEAP32[buf + 20 >> 2] = stat.rdev;
+                    tempI64 = [stat.size >>> 0, (tempDouble = stat.size, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 24 >> 2] = tempI64[0], HEAP32[buf + 28 >> 2] = tempI64[1];
+                    HEAP32[buf + 32 >> 2] = 4096;
+                    HEAP32[buf + 36 >> 2] = stat.blocks;
+                    var atime = stat.atime.getTime();
+                    var mtime = stat.mtime.getTime();
+                    var ctime = stat.ctime.getTime();
+                    tempI64 = [Math.floor(atime / 1e3) >>> 0, (tempDouble = Math.floor(atime / 1e3), +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 40 >> 2] = tempI64[0], HEAP32[buf + 44 >> 2] = tempI64[1];
+                    HEAPU32[buf + 48 >> 2] = atime % 1e3 * 1e3;
+                    tempI64 = [Math.floor(mtime / 1e3) >>> 0, (tempDouble = Math.floor(mtime / 1e3), +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 56 >> 2] = tempI64[0], HEAP32[buf + 60 >> 2] = tempI64[1];
+                    HEAPU32[buf + 64 >> 2] = mtime % 1e3 * 1e3;
+                    tempI64 = [Math.floor(ctime / 1e3) >>> 0, (tempDouble = Math.floor(ctime / 1e3), +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 72 >> 2] = tempI64[0], HEAP32[buf + 76 >> 2] = tempI64[1];
+                    HEAPU32[buf + 80 >> 2] = ctime % 1e3 * 1e3;
+                    tempI64 = [stat.ino >>> 0, (tempDouble = stat.ino, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 88 >> 2] = tempI64[0], HEAP32[buf + 92 >> 2] = tempI64[1];
+                    return 0
+                },
+                doMsync(addr, stream, len, flags, offset) {
+                    if (!FS.isFile(stream.node.mode)) {
+                        throw new FS.ErrnoError(43)
+                    }
+                    if (flags & 2) {
+                        return 0
+                    }
+                    var buffer = HEAPU8.slice(addr, addr + len);
+                    FS.msync(stream, buffer, offset, len, flags)
+                },
+                varargs: undefined,
+                get() {
+                    var ret = HEAP32[+SYSCALLS.varargs >> 2];
+                    SYSCALLS.varargs += 4;
+                    return ret
+                },
+                getp() {
+                    return SYSCALLS.get()
+                },
+                getStr(ptr) {
+                    var ret = UTF8ToString(ptr);
+                    return ret
+                },
+                getStreamFromFD(fd) {
+                    var stream = FS.getStreamChecked(fd);
+                    return stream
+                }
+            };
+
+            function ___syscall_fcntl64(fd, cmd, varargs) {
+                SYSCALLS.varargs = varargs;
+                try {
+                    var stream = SYSCALLS.getStreamFromFD(fd);
+                    switch (cmd) {
+                        case 0: {
+                            var arg = SYSCALLS.get();
+                            if (arg < 0) {
+                                return -28
+                            }
+                            while (FS.streams[arg]) {
+                                arg++
+                            }
+                            var newStream;
+                            newStream = FS.createStream(stream, arg);
+                            return newStream.fd
+                        }
+                        case 1:
+                        case 2:
+                            return 0;
+                        case 3:
+                            return stream.flags;
+                        case 4: {
+                            var arg = SYSCALLS.get();
+                            stream.flags |= arg;
+                            return 0
+                        }
+                        case 12: {
+                            var arg = SYSCALLS.getp();
+                            var offset = 0;
+                            HEAP16[arg + offset >> 1] = 2;
+                            return 0
+                        }
+                        case 13:
+                        case 14:
+                            return 0
+                    }
+                    return -28
+                } catch (e) {
+                    if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
+                    return -e.errno
+                }
+            }
+
+            function ___syscall_ioctl(fd, op, varargs) {
+                SYSCALLS.varargs = varargs;
+                try {
+                    var stream = SYSCALLS.getStreamFromFD(fd);
+                    switch (op) {
+                        case 21509: {
+                            if (!stream.tty) return -59;
+                            return 0
+                        }
+                        case 21505: {
+                            if (!stream.tty) return -59;
+                            if (stream.tty.ops.ioctl_tcgets) {
+                                var termios = stream.tty.ops.ioctl_tcgets(stream);
+                                var argp = SYSCALLS.getp();
+                                HEAP32[argp >> 2] = termios.c_iflag || 0;
+                                HEAP32[argp + 4 >> 2] = termios.c_oflag || 0;
+                                HEAP32[argp + 8 >> 2] = termios.c_cflag || 0;
+                                HEAP32[argp + 12 >> 2] = termios.c_lflag || 0;
+                                for (var i = 0; i < 32; i++) {
+                                    HEAP8[argp + i + 17] = termios.c_cc[i] || 0
+                                }
+                                return 0
+                            }
+                            return 0
+                        }
+                        case 21510:
+                        case 21511:
+                        case 21512: {
+                            if (!stream.tty) return -59;
+                            return 0
+                        }
+                        case 21506:
+                        case 21507:
+                        case 21508: {
+                            if (!stream.tty) return -59;
+                            if (stream.tty.ops.ioctl_tcsets) {
+                                var argp = SYSCALLS.getp();
+                                var c_iflag = HEAP32[argp >> 2];
+                                var c_oflag = HEAP32[argp + 4 >> 2];
+                                var c_cflag = HEAP32[argp + 8 >> 2];
+                                var c_lflag = HEAP32[argp + 12 >> 2];
+                                var c_cc = [];
+                                for (var i = 0; i < 32; i++) {
+                                    c_cc.push(HEAP8[argp + i + 17])
+                                }
+                                return stream.tty.ops.ioctl_tcsets(stream.tty, op, {
+                                    c_iflag: c_iflag,
+                                    c_oflag: c_oflag,
+                                    c_cflag: c_cflag,
+                                    c_lflag: c_lflag,
+                                    c_cc: c_cc
+                                })
+                            }
+                            return 0
+                        }
+                        case 21519: {
+                            if (!stream.tty) return -59;
+                            var argp = SYSCALLS.getp();
+                            HEAP32[argp >> 2] = 0;
+                            return 0
+                        }
+                        case 21520: {
+                            if (!stream.tty) return -59;
+                            return -28
+                        }
+                        case 21531: {
+                            var argp = SYSCALLS.getp();
+                            return FS.ioctl(stream, op, argp)
+                        }
+                        case 21523: {
+                            if (!stream.tty) return -59;
+                            if (stream.tty.ops.ioctl_tiocgwinsz) {
+                                var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty);
+                                var argp = SYSCALLS.getp();
+                                HEAP16[argp >> 1] = winsize[0];
+                                HEAP16[argp + 2 >> 1] = winsize[1]
+                            }
+                            return 0
+                        }
+                        case 21524: {
+                            if (!stream.tty) return -59;
+                            return 0
+                        }
+                        case 21515: {
+                            if (!stream.tty) return -59;
+                            return 0
+                        }
+                        default:
+                            return -28
+                    }
+                } catch (e) {
+                    if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
+                    return -e.errno
+                }
+            }
+
+            function ___syscall_openat(dirfd, path, flags, varargs) {
+                SYSCALLS.varargs = varargs;
+                try {
+                    path = SYSCALLS.getStr(path);
+                    path = SYSCALLS.calculateAt(dirfd, path);
+                    var mode = varargs ? SYSCALLS.get() : 0;
+                    return FS.open(path, flags, mode).fd
+                } catch (e) {
+                    if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
+                    return -e.errno
+                }
+            }
+
+            function ___syscall_stat64(path, buf) {
+                try {
+                    path = SYSCALLS.getStr(path);
+                    return SYSCALLS.doStat(FS.stat, path, buf)
+                } catch (e) {
+                    if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
+                    return -e.errno
+                }
+            }
+            var _emscripten_memcpy_js = (dest, src, num) => HEAPU8.copyWithin(dest, src, src + num);
+            var abortOnCannotGrowMemory = requestedSize => {
+                abort("OOM")
+            };
+            var _emscripten_resize_heap = requestedSize => {
+                var oldSize = HEAPU8.length;
+                requestedSize >>>= 0;
+                abortOnCannotGrowMemory(requestedSize)
+            };
+            var ENV = {};
+            var getExecutableName = () => thisProgram || "./this.program";
+            var getEnvStrings = () => {
+                if (!getEnvStrings.strings) {
+                    var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8";
+                    var env = {
+                        "USER": "web_user",
+                        "LOGNAME": "web_user",
+                        "PATH": "/",
+                        "PWD": "/",
+                        "HOME": "/home/web_user",
+                        "LANG": lang,
+                        "_": getExecutableName()
+                    };
+                    for (var x in ENV) {
+                        if (ENV[x] === undefined) delete env[x];
+                        else env[x] = ENV[x]
+                    }
+                    var strings = [];
+                    for (var x in env) {
+                        strings.push(`${x}=${env[x]}`)
+                    }
+                    getEnvStrings.strings = strings
+                }
+                return getEnvStrings.strings
+            };
+            var stringToAscii = (str, buffer) => {
+                for (var i = 0; i < str.length; ++i) {
+                    HEAP8[buffer++] = str.charCodeAt(i)
+                }
+                HEAP8[buffer] = 0
+            };
+            var _environ_get = (__environ, environ_buf) => {
+                var bufSize = 0;
+                getEnvStrings().forEach((string, i) => {
+                    var ptr = environ_buf + bufSize;
+                    HEAPU32[__environ + i * 4 >> 2] = ptr;
+                    stringToAscii(string, ptr);
+                    bufSize += string.length + 1
+                });
+                return 0
+            };
+            var _environ_sizes_get = (penviron_count, penviron_buf_size) => {
+                var strings = getEnvStrings();
+                HEAPU32[penviron_count >> 2] = strings.length;
+                var bufSize = 0;
+                strings.forEach(string => bufSize += string.length + 1);
+                HEAPU32[penviron_buf_size >> 2] = bufSize;
+                return 0
+            };
+            var runtimeKeepaliveCounter = 0;
+            var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
+            var _proc_exit = code => {
+                EXITSTATUS = code;
+                if (!keepRuntimeAlive()) {
+                    Module["onExit"]?.(code);
+                    ABORT = true
+                }
+                quit_(code, new ExitStatus(code))
+            };
+            var exitJS = (status, implicit) => {
+                EXITSTATUS = status;
+                _proc_exit(status)
+            };
+            var _exit = exitJS;
+
+            function _fd_close(fd) {
+                try {
+                    var stream = SYSCALLS.getStreamFromFD(fd);
+                    FS.close(stream);
+                    return 0
+                } catch (e) {
+                    if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
+                    return e.errno
+                }
+            }
+
+            function _fd_fdstat_get(fd, pbuf) {
+                try {
+                    var rightsBase = 0;
+                    var rightsInheriting = 0;
+                    var flags = 0;
+                    {
+                        var stream = SYSCALLS.getStreamFromFD(fd);
+                        var type = stream.tty ? 2 : FS.isDir(stream.mode) ? 3 : FS.isLink(stream.mode) ? 7 : 4
+                    }
+                    HEAP8[pbuf] = type;
+                    HEAP16[pbuf + 2 >> 1] = flags;
+                    tempI64 = [rightsBase >>> 0, (tempDouble = rightsBase, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[pbuf + 8 >> 2] = tempI64[0], HEAP32[pbuf + 12 >> 2] = tempI64[1];
+                    tempI64 = [rightsInheriting >>> 0, (tempDouble = rightsInheriting, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[pbuf + 16 >> 2] = tempI64[0], HEAP32[pbuf + 20 >> 2] = tempI64[1];
+                    return 0
+                } catch (e) {
+                    if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
+                    return e.errno
+                }
+            }
+            var doReadv = (stream, iov, iovcnt, offset) => {
+                var ret = 0;
+                for (var i = 0; i < iovcnt; i++) {
+                    var ptr = HEAPU32[iov >> 2];
+                    var len = HEAPU32[iov + 4 >> 2];
+                    iov += 8;
+                    var curr = FS.read(stream, HEAP8, ptr, len, offset);
+                    if (curr < 0) return -1;
+                    ret += curr;
+                    if (curr < len) break;
+                    if (typeof offset !== "undefined") {
+                        offset += curr
+                    }
+                }
+                return ret
+            };
+
+            function _fd_read(fd, iov, iovcnt, pnum) {
+                try {
+                    var stream = SYSCALLS.getStreamFromFD(fd);
+                    var num = doReadv(stream, iov, iovcnt);
+                    HEAPU32[pnum >> 2] = num;
+                    return 0
+                } catch (e) {
+                    if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
+                    return e.errno
+                }
+            }
+            var convertI32PairToI53Checked = (lo, hi) => hi + 2097152 >>> 0 < 4194305 - !!lo ? (lo >>> 0) + hi * 4294967296 : NaN;
+
+            function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
+                var offset = convertI32PairToI53Checked(offset_low, offset_high);
+                try {
+                    if (isNaN(offset)) return 61;
+                    var stream = SYSCALLS.getStreamFromFD(fd);
+                    FS.llseek(stream, offset, whence);
+                    tempI64 = [stream.position >>> 0, (tempDouble = stream.position, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[newOffset >> 2] = tempI64[0], HEAP32[newOffset + 4 >> 2] = tempI64[1];
+                    if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null;
+                    return 0
+                } catch (e) {
+                    if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
+                    return e.errno
+                }
+            }
+            var doWritev = (stream, iov, iovcnt, offset) => {
+                var ret = 0;
+                for (var i = 0; i < iovcnt; i++) {
+                    var ptr = HEAPU32[iov >> 2];
+                    var len = HEAPU32[iov + 4 >> 2];
+                    iov += 8;
+                    var curr = FS.write(stream, HEAP8, ptr, len, offset);
+                    if (curr < 0) return -1;
+                    ret += curr;
+                    if (typeof offset !== "undefined") {
+                        offset += curr
+                    }
+                }
+                return ret
+            };
+
+            function _fd_write(fd, iov, iovcnt, pnum) {
+                try {
+                    var stream = SYSCALLS.getStreamFromFD(fd);
+                    var num = doWritev(stream, iov, iovcnt);
+                    HEAPU32[pnum >> 2] = num;
+                    return 0
+                } catch (e) {
+                    if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
+                    return e.errno
+                }
+            }
+            var runAndAbortIfError = func => {
+                try {
+                    return func()
+                } catch (e) {
+                    abort(e)
+                }
+            };
+            var handleException = e => {
+                if (e instanceof ExitStatus || e == "unwind") {
+                    return EXITSTATUS
+                }
+                quit_(1, e)
+            };
+            var maybeExit = () => {
+                if (!keepRuntimeAlive()) {
+                    try {
+                        _exit(EXITSTATUS)
+                    } catch (e) {
+                        handleException(e)
+                    }
+                }
+            };
+            var callUserCallback = func => {
+                if (ABORT) {
+                    return
+                }
+                try {
+                    func();
+                    maybeExit()
+                } catch (e) {
+                    handleException(e)
+                }
+            };
+            var runtimeKeepalivePush = () => {
+                runtimeKeepaliveCounter += 1
+            };
+            var runtimeKeepalivePop = () => {
+                runtimeKeepaliveCounter -= 1
+            };
+            var Asyncify = {
+                instrumentWasmImports(imports) {
+                    var importPattern = /^(invoke_.*|__asyncjs__.*)$/;
+                    for (let [x, original] of Object.entries(imports)) {
+                        let sig = original.sig;
+                        if (typeof original == "function") {
+                            let isAsyncifyImport = original.isAsync || importPattern.test(x)
+                        }
+                    }
+                },
+                instrumentWasmExports(exports) {
+                    var ret = {};
+                    for (let [x, original] of Object.entries(exports)) {
+                        if (typeof original == "function") {
+                            ret[x] = (...args) => {
+                                Asyncify.exportCallStack.push(x);
+                                try {
+                                    return original(...args)
+                                } finally {
+                                    if (!ABORT) {
+                                        var y = Asyncify.exportCallStack.pop();
+                                        Asyncify.maybeStopUnwind()
+                                    }
+                                }
+                            }
+                        } else {
+                            ret[x] = original
+                        }
+                    }
+                    return ret
+                },
+                State: {
+                    Normal: 0,
+                    Unwinding: 1,
+                    Rewinding: 2,
+                    Disabled: 3
+                },
+                state: 0,
+                StackSize: 4096,
+                currData: null,
+                handleSleepReturnValue: 0,
+                exportCallStack: [],
+                callStackNameToId: {},
+                callStackIdToName: {},
+                callStackId: 0,
+                asyncPromiseHandlers: null,
+                sleepCallbacks: [],
+                getCallStackId(funcName) {
+                    var id = Asyncify.callStackNameToId[funcName];
+                    if (id === undefined) {
+                        id = Asyncify.callStackId++;
+                        Asyncify.callStackNameToId[funcName] = id;
+                        Asyncify.callStackIdToName[id] = funcName
+                    }
+                    return id
+                },
+                maybeStopUnwind() {
+                    if (Asyncify.currData && Asyncify.state === Asyncify.State.Unwinding && Asyncify.exportCallStack.length === 0) {
+                        Asyncify.state = Asyncify.State.Normal;
+                        runAndAbortIfError(_asyncify_stop_unwind);
+                        if (typeof Fibers != "undefined") {
+                            Fibers.trampoline()
+                        }
+                    }
+                },
+                whenDone() {
+                    return new Promise((resolve, reject) => {
+                        Asyncify.asyncPromiseHandlers = {
+                            resolve: resolve,
+                            reject: reject
+                        }
+                    })
+                },
+                allocateData() {
+                    var ptr = _malloc(12 + Asyncify.StackSize);
+                    Asyncify.setDataHeader(ptr, ptr + 12, Asyncify.StackSize);
+                    Asyncify.setDataRewindFunc(ptr);
+                    return ptr
+                },
+                setDataHeader(ptr, stack, stackSize) {
+                    HEAPU32[ptr >> 2] = stack;
+                    HEAPU32[ptr + 4 >> 2] = stack + stackSize
+                },
+                setDataRewindFunc(ptr) {
+                    var bottomOfCallStack = Asyncify.exportCallStack[0];
+                    var rewindId = Asyncify.getCallStackId(bottomOfCallStack);
+                    HEAP32[ptr + 8 >> 2] = rewindId
+                },
+                getDataRewindFunc(ptr) {
+                    var id = HEAP32[ptr + 8 >> 2];
+                    var name = Asyncify.callStackIdToName[id];
+                    var func = wasmExports[name];
+                    return func
+                },
+                doRewind(ptr) {
+                    var start = Asyncify.getDataRewindFunc(ptr);
+                    return start()
+                },
+                handleSleep(startAsync) {
+                    if (ABORT) return;
+                    if (Asyncify.state === Asyncify.State.Normal) {
+                        var reachedCallback = false;
+                        var reachedAfterCallback = false;
+                        startAsync((handleSleepReturnValue = 0) => {
+                            if (ABORT) return;
+                            Asyncify.handleSleepReturnValue = handleSleepReturnValue;
+                            reachedCallback = true;
+                            if (!reachedAfterCallback) {
+                                return
+                            }
+                            Asyncify.state = Asyncify.State.Rewinding;
+                            runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData));
+                            if (typeof Browser != "undefined" && Browser.mainLoop.func) {
+                                Browser.mainLoop.resume()
+                            }
+                            var asyncWasmReturnValue, isError = false;
+                            try {
+                                asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData)
+                            } catch (err) {
+                                asyncWasmReturnValue = err;
+                                isError = true
+                            }
+                            var handled = false;
+                            if (!Asyncify.currData) {
+                                var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers;
+                                if (asyncPromiseHandlers) {
+                                    Asyncify.asyncPromiseHandlers = null;
+                                    (isError ? asyncPromiseHandlers.reject : asyncPromiseHandlers.resolve)(asyncWasmReturnValue);
+                                    handled = true
+                                }
+                            }
+                            if (isError && !handled) {
+                                throw asyncWasmReturnValue
+                            }
+                        });
+                        reachedAfterCallback = true;
+                        if (!reachedCallback) {
+                            Asyncify.state = Asyncify.State.Unwinding;
+                            Asyncify.currData = Asyncify.allocateData();
+                            if (typeof Browser != "undefined" && Browser.mainLoop.func) {
+                                Browser.mainLoop.pause()
+                            }
+                            runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData))
+                        }
+                    } else if (Asyncify.state === Asyncify.State.Rewinding) {
+                        Asyncify.state = Asyncify.State.Normal;
+                        runAndAbortIfError(_asyncify_stop_rewind);
+                        _free(Asyncify.currData);
+                        Asyncify.currData = null;
+                        Asyncify.sleepCallbacks.forEach(callUserCallback)
+                    } else {
+                        abort(`invalid state: ${Asyncify.state}`)
+                    }
+                    return Asyncify.handleSleepReturnValue
+                },
+                handleAsync(startAsync) {
+                    return Asyncify.handleSleep(wakeUp => {
+                        startAsync().then(wakeUp)
+                    })
+                }
+            };
+            var getCFunc = ident => {
+                var func = Module["_" + ident];
+                return func
+            };
+            var writeArrayToMemory = (array, buffer) => {
+                HEAP8.set(array, buffer)
+            };
+            var stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
+            var stringToUTF8OnStack = str => {
+                var size = lengthBytesUTF8(str) + 1;
+                var ret = stackAlloc(size);
+                stringToUTF8(str, ret, size);
+                return ret
+            };
+            var ccall = (ident, returnType, argTypes, args, opts) => {
+                var toC = {
+                    "string": str => {
+                        var ret = 0;
+                        if (str !== null && str !== undefined && str !== 0) {
+                            ret = stringToUTF8OnStack(str)
+                        }
+                        return ret
+                    },
+                    "array": arr => {
+                        var ret = stackAlloc(arr.length);
+                        writeArrayToMemory(arr, ret);
+                        return ret
+                    }
+                };
+
+                function convertReturnValue(ret) {
+                    if (returnType === "string") {
+                        return UTF8ToString(ret)
+                    }
+                    if (returnType === "boolean") return Boolean(ret);
+                    return ret
+                }
+                var func = getCFunc(ident);
+                var cArgs = [];
+                var stack = 0;
+                if (args) {
+                    for (var i = 0; i < args.length; i++) {
+                        var converter = toC[argTypes[i]];
+                        if (converter) {
+                            if (stack === 0) stack = stackSave();
+                            cArgs[i] = converter(args[i])
+                        } else {
+                            cArgs[i] = args[i]
+                        }
+                    }
+                }
+                var previousAsync = Asyncify.currData;
+                var ret = func(...cArgs);
+
+                function onDone(ret) {
+                    runtimeKeepalivePop();
+                    if (stack !== 0) stackRestore(stack);
+                    return convertReturnValue(ret)
+                }
+                var asyncMode = opts?.async;
+                runtimeKeepalivePush();
+                if (Asyncify.currData != previousAsync) {
+                    return Asyncify.whenDone().then(onDone)
+                }
+                ret = onDone(ret);
+                if (asyncMode) return Promise.resolve(ret);
+                return ret
+            };
+            var cwrap = (ident, returnType, argTypes, opts) => {
+                var numericArgs = !argTypes || argTypes.every(type => type === "number" || type === "boolean");
+                var numericRet = returnType !== "string";
+                if (numericRet && numericArgs && !opts) {
+                    return getCFunc(ident)
+                }
+                return (...args) => ccall(ident, returnType, argTypes, args, opts)
+            };
+            var stringToNewUTF8 = str => {
+                var size = lengthBytesUTF8(str) + 1;
+                var ret = _malloc(size);
+                if (ret) stringToUTF8(str, ret, size);
+                return ret
+            };
+            var FSNode = function(parent, name, mode, rdev) {
+                if (!parent) {
+                    parent = this
+                }
+                this.parent = parent;
+                this.mount = parent.mount;
+                this.mounted = null;
+                this.id = FS.nextInode++;
+                this.name = name;
+                this.mode = mode;
+                this.node_ops = {};
+                this.stream_ops = {};
+                this.rdev = rdev
+            };
+            var readMode = 292 | 73;
+            var writeMode = 146;
+            Object.defineProperties(FSNode.prototype, {
+                read: {
+                    get: function() {
+                        return (this.mode & readMode) === readMode
+                    },
+                    set: function(val) {
+                        val ? this.mode |= readMode : this.mode &= ~readMode
+                    }
+                },
+                write: {
+                    get: function() {
+                        return (this.mode & writeMode) === writeMode
+                    },
+                    set: function(val) {
+                        val ? this.mode |= writeMode : this.mode &= ~writeMode
+                    }
+                },
+                isFolder: {
+                    get: function() {
+                        return FS.isDir(this.mode)
+                    }
+                },
+                isDevice: {
+                    get: function() {
+                        return FS.isChrdev(this.mode)
+                    }
+                }
+            });
+            FS.FSNode = FSNode;
+            FS.createPreloadedFile = FS_createPreloadedFile;
+            FS.staticInit();
+            Module["FS_createPath"] = FS.createPath;
+            Module["FS_createDataFile"] = FS.createDataFile;
+            Module["FS_createPreloadedFile"] = FS.createPreloadedFile;
+            Module["FS_unlink"] = FS.unlink;
+            Module["FS_createLazyFile"] = FS.createLazyFile;
+            Module["FS_createDevice"] = FS.createDevice;
+            var wasmImports = {
+                d: ___syscall_fcntl64,
+                h: ___syscall_ioctl,
+                i: ___syscall_openat,
+                l: ___syscall_stat64,
+                n: _emscripten_memcpy_js,
+                k: _emscripten_resize_heap,
+                e: _environ_get,
+                f: _environ_sizes_get,
+                a: _exit,
+                b: _fd_close,
+                m: _fd_fdstat_get,
+                g: _fd_read,
+                j: _fd_seek,
+                c: _fd_write
+            };
+            var wasmExports = createWasm();
+            var ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports["p"])();
+            var _free = a0 => (_free = wasmExports["q"])(a0);
+            var _malloc = a0 => (_malloc = wasmExports["r"])(a0);
+            var _test_int = Module["_test_int"] = (a0, a1) => (_test_int = Module["_test_int"] = wasmExports["t"])(a0, a1);
+            var _do_a_conversion = Module["_do_a_conversion"] = (a0, a1) => (_do_a_conversion = Module["_do_a_conversion"] = wasmExports["u"])(a0, a1);
+            var stackSave = () => (stackSave = wasmExports["v"])();
+            var stackRestore = a0 => (stackRestore = wasmExports["w"])(a0);
+            var stackAlloc = a0 => (stackAlloc = wasmExports["x"])(a0);
+            var _asyncify_start_unwind = a0 => (_asyncify_start_unwind = wasmExports["y"])(a0);
+            var _asyncify_stop_unwind = () => (_asyncify_stop_unwind = wasmExports["z"])();
+            var _asyncify_start_rewind = a0 => (_asyncify_start_rewind = wasmExports["A"])(a0);
+            var _asyncify_stop_rewind = () => (_asyncify_stop_rewind = wasmExports["B"])();
+            Module["addRunDependency"] = addRunDependency;
+            Module["removeRunDependency"] = removeRunDependency;
+            Module["FS_createPath"] = FS.createPath;
+            Module["FS_createLazyFile"] = FS.createLazyFile;
+            Module["FS_createDevice"] = FS.createDevice;
+            Module["ccall"] = ccall;
+            Module["cwrap"] = cwrap;
+            Module["stringToNewUTF8"] = stringToNewUTF8;
+            Module["FS_createPreloadedFile"] = FS.createPreloadedFile;
+            Module["FS_createDataFile"] = FS.createDataFile;
+            Module["FS_unlink"] = FS.unlink;
+            var calledRun;
+            dependenciesFulfilled = function runCaller() {
+                if (!calledRun) run();
+                if (!calledRun) dependenciesFulfilled = runCaller
+            };
+
+            function run() {
+                if (runDependencies > 0) {
+                    return
+                }
+                preRun();
+                if (runDependencies > 0) {
+                    return
+                }
+
+                function doRun() {
+                    if (calledRun) return;
+                    calledRun = true;
+                    Module["calledRun"] = true;
+                    if (ABORT) return;
+                    initRuntime();
+                    readyPromiseResolve(Module);
+                    if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
+                    postRun()
+                }
+                if (Module["setStatus"]) {
+                    Module["setStatus"]("Running...");
+                    setTimeout(function() {
+                        setTimeout(function() {
+                            Module["setStatus"]("")
+                        }, 1);
+                        doRun()
+                    }, 1)
+                } else {
+                    doRun()
+                }
+            }
+            if (Module["preInit"]) {
+                if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
+                while (Module["preInit"].length > 0) {
+                    Module["preInit"].pop()()
+                }
+            }
+            run();
+            return moduleArg.ready
+        }
+    );
+})();
+if (typeof exports === 'object' && typeof module === 'object')
+    module.exports = createMyModule;
+else if (typeof define === 'function' && define['amd'])
+    define([], () => createMyModule);
\ No newline at end of file
diff --git a/webview b/webview
new file mode 160000
index 0000000..adbb85d
--- /dev/null
+++ b/webview
@@ -0,0 +1 @@
+Subproject commit adbb85d0f54537b8034ece0bab67c7d1438e3cda
diff --git a/webview-frontend.cpp b/webview-frontend.cpp
new file mode 100644
index 0000000..c9c008a
--- /dev/null
+++ b/webview-frontend.cpp
@@ -0,0 +1,63 @@
+#include <iostream>
+#include <stdio.h>
+#include "webview/webview.h"
+#include "nlohmann/json.hpp"
+#include "bundle-webview-js.h"
+
+using json = nlohmann::json;
+
+extern "C" {
+    extern void do_a_conversion(char *, char *);
+}
+
+extern char log_buffer[4096];
+extern char *log_buffer_ptr;
+
+
+std::string convert(std::string arg) {
+	std::cout << "Params: " << arg << std::endl;
+    json j = json::parse(arg);
+    
+    auto from = j[0].template get<std::string>(),
+        to = j[1].template get<std::string>();
+        
+    std::cout << from << ' ' << to << std::endl;
+    
+    do_a_conversion((char *)from.data(), (char *)to.data());
+    std::string res = json(std::string(log_buffer, log_buffer_ptr - log_buffer)).dump();
+    log_buffer_ptr = log_buffer;
+    std::cout << res << std::endl;
+    return res;
+}
+
+std::string get_html() {
+    return std::string("<div id=app></div><script>") + std::string((const char *)bundle_webview_js, bundle_webview_js_len) + std::string("</script>");
+}
+
+#ifdef WIN32
+int WINAPI WinMain(HINSTANCE hInt, HINSTANCE hPrevInst, LPSTR lpCmdLine,
+                   int nCmdShow) {
+#else
+int main() {
+#endif
+    // cookie_io_functions_t iofns = {NULL};
+    // iofns.cookie_write_function_t = writer;
+    //
+    // stdout = fopencookie(NULL, "r", iofns);
+    
+    try {
+        webview::webview w(false, nullptr);
+        w.set_title("Units");
+        w.set_size(480, 320, WEBVIEW_HINT_NONE);
+        w.bind("convert", convert);
+        w.set_html(get_html());
+        // w.navigate("http://localhost:8000/index-webview.html");
+        w.run();
+    } catch (const webview::exception &e) {
+        std::cerr << e.what() << std::endl;
+        return 1;
+    }
+
+    
+	return 0;
+}
diff --git a/webview-frontend.js b/webview-frontend.js
new file mode 100644
index 0000000..9a53b21
--- /dev/null
+++ b/webview-frontend.js
@@ -0,0 +1,4 @@
+const {UnitsApp} = require("./frontend-impl.js");
+const React = require("preact");
+
+React.render(<UnitsApp />, document.getElementById("app"));
diff --git a/yarn.lock b/yarn.lock
new file mode 100644
index 0000000..ac175a8
--- /dev/null
+++ b/yarn.lock
@@ -0,0 +1,620 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
+"@esbuild/aix-ppc64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.20.1.tgz#eafa8775019b3650a77e8310ba4dbd17ca7af6d5"
+  integrity sha512-m55cpeupQ2DbuRGQMMZDzbv9J9PgVelPjlcmM5kxHnrBdBx6REaEd7LamYV7Dm8N7rCyR/XwU6rVP8ploKtIkA==
+
+"@esbuild/android-arm64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.20.1.tgz#68791afa389550736f682c15b963a4f37ec2f5f6"
+  integrity sha512-hCnXNF0HM6AjowP+Zou0ZJMWWa1VkD77BXe959zERgGJBBxB+sV+J9f/rcjeg2c5bsukD/n17RKWXGFCO5dD5A==
+
+"@esbuild/android-arm@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.20.1.tgz#38c91d8ee8d5196f7fbbdf4f0061415dde3a473a"
+  integrity sha512-4j0+G27/2ZXGWR5okcJi7pQYhmkVgb4D7UKwxcqrjhvp5TKWx3cUjgB1CGj1mfdmJBQ9VnUGgUhign+FPF2Zgw==
+
+"@esbuild/android-x64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.20.1.tgz#93f6190ce997b313669c20edbf3645fc6c8d8f22"
+  integrity sha512-MSfZMBoAsnhpS+2yMFYIQUPs8Z19ajwfuaSZx+tSl09xrHZCjbeXXMsUF/0oq7ojxYEpsSo4c0SfjxOYXRbpaA==
+
+"@esbuild/darwin-arm64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.20.1.tgz#0d391f2e81fda833fe609182cc2fbb65e03a3c46"
+  integrity sha512-Ylk6rzgMD8klUklGPzS414UQLa5NPXZD5tf8JmQU8GQrj6BrFA/Ic9tb2zRe1kOZyCbGl+e8VMbDRazCEBqPvA==
+
+"@esbuild/darwin-x64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.20.1.tgz#92504077424584684862f483a2242cfde4055ba2"
+  integrity sha512-pFIfj7U2w5sMp52wTY1XVOdoxw+GDwy9FsK3OFz4BpMAjvZVs0dT1VXs8aQm22nhwoIWUmIRaE+4xow8xfIDZA==
+
+"@esbuild/freebsd-arm64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.1.tgz#a1646fa6ba87029c67ac8a102bb34384b9290774"
+  integrity sha512-UyW1WZvHDuM4xDz0jWun4qtQFauNdXjXOtIy7SYdf7pbxSWWVlqhnR/T2TpX6LX5NI62spt0a3ldIIEkPM6RHw==
+
+"@esbuild/freebsd-x64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.20.1.tgz#41c9243ab2b3254ea7fb512f71ffdb341562e951"
+  integrity sha512-itPwCw5C+Jh/c624vcDd9kRCCZVpzpQn8dtwoYIt2TJF3S9xJLiRohnnNrKwREvcZYx0n8sCSbvGH349XkcQeg==
+
+"@esbuild/linux-arm64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.20.1.tgz#f3c1e1269fbc9eedd9591a5bdd32bf707a883156"
+  integrity sha512-cX8WdlF6Cnvw/DO9/X7XLH2J6CkBnz7Twjpk56cshk9sjYVcuh4sXQBy5bmTwzBjNVZze2yaV1vtcJS04LbN8w==
+
+"@esbuild/linux-arm@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.20.1.tgz#4503ca7001a8ee99589c072801ce9d7540717a21"
+  integrity sha512-LojC28v3+IhIbfQ+Vu4Ut5n3wKcgTu6POKIHN9Wpt0HnfgUGlBuyDDQR4jWZUZFyYLiz4RBBBmfU6sNfn6RhLw==
+
+"@esbuild/linux-ia32@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.20.1.tgz#98c474e3e0cbb5bcbdd8561a6e65d18f5767ce48"
+  integrity sha512-4H/sQCy1mnnGkUt/xszaLlYJVTz3W9ep52xEefGtd6yXDQbz/5fZE5dFLUgsPdbUOQANcVUa5iO6g3nyy5BJiw==
+
+"@esbuild/linux-loong64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.20.1.tgz#a8097d28d14b9165c725fe58fc438f80decd2f33"
+  integrity sha512-c0jgtB+sRHCciVXlyjDcWb2FUuzlGVRwGXgI+3WqKOIuoo8AmZAddzeOHeYLtD+dmtHw3B4Xo9wAUdjlfW5yYA==
+
+"@esbuild/linux-mips64el@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.20.1.tgz#c44f6f0d7d017c41ad3bb15bfdb69b690656b5ea"
+  integrity sha512-TgFyCfIxSujyuqdZKDZ3yTwWiGv+KnlOeXXitCQ+trDODJ+ZtGOzLkSWngynP0HZnTsDyBbPy7GWVXWaEl6lhA==
+
+"@esbuild/linux-ppc64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.20.1.tgz#0765a55389a99237b3c84227948c6e47eba96f0d"
+  integrity sha512-b+yuD1IUeL+Y93PmFZDZFIElwbmFfIKLKlYI8M6tRyzE6u7oEP7onGk0vZRh8wfVGC2dZoy0EqX1V8qok4qHaw==
+
+"@esbuild/linux-riscv64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.20.1.tgz#e4153b032288e3095ddf4c8be07893781b309a7e"
+  integrity sha512-wpDlpE0oRKZwX+GfomcALcouqjjV8MIX8DyTrxfyCfXxoKQSDm45CZr9fanJ4F6ckD4yDEPT98SrjvLwIqUCgg==
+
+"@esbuild/linux-s390x@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.20.1.tgz#b9ab8af6e4b73b26d63c1c426d7669a5d53eb5a7"
+  integrity sha512-5BepC2Au80EohQ2dBpyTquqGCES7++p7G+7lXe1bAIvMdXm4YYcEfZtQrP4gaoZ96Wv1Ute61CEHFU7h4FMueQ==
+
+"@esbuild/linux-x64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.20.1.tgz#0b25da17ac38c3e11cdd06ca3691d4d6bef2755f"
+  integrity sha512-5gRPk7pKuaIB+tmH+yKd2aQTRpqlf1E4f/mC+tawIm/CGJemZcHZpp2ic8oD83nKgUPMEd0fNanrnFljiruuyA==
+
+"@esbuild/netbsd-x64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.20.1.tgz#3148e48406cd0d4f7ba1e0bf3f4d77d548c98407"
+  integrity sha512-4fL68JdrLV2nVW2AaWZBv3XEm3Ae3NZn/7qy2KGAt3dexAgSVT+Hc97JKSZnqezgMlv9x6KV0ZkZY7UO5cNLCg==
+
+"@esbuild/openbsd-x64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.20.1.tgz#7b73e852986a9750192626d377ac96ac2b749b76"
+  integrity sha512-GhRuXlvRE+twf2ES+8REbeCb/zeikNqwD3+6S5y5/x+DYbAQUNl0HNBs4RQJqrechS4v4MruEr8ZtAin/hK5iw==
+
+"@esbuild/sunos-x64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.20.1.tgz#402a441cdac2eee98d8be378c7bc23e00c1861c5"
+  integrity sha512-ZnWEyCM0G1Ex6JtsygvC3KUUrlDXqOihw8RicRuQAzw+c4f1D66YlPNNV3rkjVW90zXVsHwZYWbJh3v+oQFM9Q==
+
+"@esbuild/win32-arm64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.20.1.tgz#36c4e311085806a6a0c5fc54d1ac4d7b27e94d7b"
+  integrity sha512-QZ6gXue0vVQY2Oon9WyLFCdSuYbXSoxaZrPuJ4c20j6ICedfsDilNPYfHLlMH7vGfU5DQR0czHLmJvH4Nzis/A==
+
+"@esbuild/win32-ia32@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.20.1.tgz#0cf933be3fb9dc58b45d149559fe03e9e22b54fe"
+  integrity sha512-HzcJa1NcSWTAU0MJIxOho8JftNp9YALui3o+Ny7hCh0v5f90nprly1U3Sj1Ldj/CvKKdvvFsCRvDkpsEMp4DNw==
+
+"@esbuild/win32-x64@0.20.1":
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.20.1.tgz#77583b6ea54cee7c1410ebbd54051b6a3fcbd8ba"
+  integrity sha512-0MBh53o6XtI6ctDnRMeQ+xoCN8kD2qI1rY1KgF/xdWQwoFeKou7puvDfV8/Wv4Ctx2rRpET/gGdz3YlNtNACSA==
+
+asn1.js@^4.10.1:
+  version "4.10.1"
+  resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0"
+  integrity sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==
+  dependencies:
+    bn.js "^4.0.0"
+    inherits "^2.0.1"
+    minimalistic-assert "^1.0.0"
+
+base64-js@^1.3.1:
+  version "1.5.1"
+  resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
+  integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
+
+bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9:
+  version "4.12.0"
+  resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88"
+  integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==
+
+bn.js@^5.0.0, bn.js@^5.2.1:
+  version "5.2.1"
+  resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70"
+  integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==
+
+brorand@^1.0.1, brorand@^1.1.0:
+  version "1.1.0"
+  resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
+  integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==
+
+browserify-aes@^1.0.4, browserify-aes@^1.2.0:
+  version "1.2.0"
+  resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48"
+  integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==
+  dependencies:
+    buffer-xor "^1.0.3"
+    cipher-base "^1.0.0"
+    create-hash "^1.1.0"
+    evp_bytestokey "^1.0.3"
+    inherits "^2.0.1"
+    safe-buffer "^5.0.1"
+
+browserify-cipher@^1.0.0:
+  version "1.0.1"
+  resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0"
+  integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==
+  dependencies:
+    browserify-aes "^1.0.4"
+    browserify-des "^1.0.0"
+    evp_bytestokey "^1.0.0"
+
+browserify-des@^1.0.0:
+  version "1.0.2"
+  resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c"
+  integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==
+  dependencies:
+    cipher-base "^1.0.1"
+    des.js "^1.0.0"
+    inherits "^2.0.1"
+    safe-buffer "^5.1.2"
+
+browserify-rsa@^4.0.0, browserify-rsa@^4.1.0:
+  version "4.1.0"
+  resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.1.0.tgz#b2fd06b5b75ae297f7ce2dc651f918f5be158c8d"
+  integrity sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==
+  dependencies:
+    bn.js "^5.0.0"
+    randombytes "^2.0.1"
+
+browserify-sign@^4.0.0:
+  version "4.2.3"
+  resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.3.tgz#7afe4c01ec7ee59a89a558a4b75bd85ae62d4208"
+  integrity sha512-JWCZW6SKhfhjJxO8Tyiiy+XYB7cqd2S5/+WeYHsKdNKFlCBhKbblba1A/HN/90YwtxKc8tCErjffZl++UNmGiw==
+  dependencies:
+    bn.js "^5.2.1"
+    browserify-rsa "^4.1.0"
+    create-hash "^1.2.0"
+    create-hmac "^1.1.7"
+    elliptic "^6.5.5"
+    hash-base "~3.0"
+    inherits "^2.0.4"
+    parse-asn1 "^5.1.7"
+    readable-stream "^2.3.8"
+    safe-buffer "^5.2.1"
+
+buffer-xor@^1.0.3:
+  version "1.0.3"
+  resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9"
+  integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==
+
+buffer@^5.5.0||^6.0.0:
+  version "6.0.3"
+  resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6"
+  integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
+  dependencies:
+    base64-js "^1.3.1"
+    ieee754 "^1.2.1"
+
+cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3:
+  version "1.0.4"
+  resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de"
+  integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==
+  dependencies:
+    inherits "^2.0.1"
+    safe-buffer "^5.0.1"
+
+core-util-is@~1.0.0:
+  version "1.0.3"
+  resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
+  integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==
+
+create-ecdh@^4.0.0:
+  version "4.0.4"
+  resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e"
+  integrity sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==
+  dependencies:
+    bn.js "^4.1.0"
+    elliptic "^6.5.3"
+
+create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0:
+  version "1.2.0"
+  resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196"
+  integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==
+  dependencies:
+    cipher-base "^1.0.1"
+    inherits "^2.0.1"
+    md5.js "^1.3.4"
+    ripemd160 "^2.0.1"
+    sha.js "^2.4.0"
+
+create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7:
+  version "1.1.7"
+  resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff"
+  integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==
+  dependencies:
+    cipher-base "^1.0.3"
+    create-hash "^1.1.0"
+    inherits "^2.0.1"
+    ripemd160 "^2.0.0"
+    safe-buffer "^5.0.1"
+    sha.js "^2.4.8"
+
+crypto-browserify@^3.12.0:
+  version "3.12.0"
+  resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec"
+  integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==
+  dependencies:
+    browserify-cipher "^1.0.0"
+    browserify-sign "^4.0.0"
+    create-ecdh "^4.0.0"
+    create-hash "^1.1.0"
+    create-hmac "^1.1.0"
+    diffie-hellman "^5.0.0"
+    inherits "^2.0.1"
+    pbkdf2 "^3.0.3"
+    public-encrypt "^4.0.0"
+    randombytes "^2.0.0"
+    randomfill "^1.0.3"
+
+des.js@^1.0.0:
+  version "1.1.0"
+  resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.1.0.tgz#1d37f5766f3bbff4ee9638e871a8768c173b81da"
+  integrity sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==
+  dependencies:
+    inherits "^2.0.1"
+    minimalistic-assert "^1.0.0"
+
+diffie-hellman@^5.0.0:
+  version "5.0.3"
+  resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875"
+  integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==
+  dependencies:
+    bn.js "^4.1.0"
+    miller-rabin "^4.0.0"
+    randombytes "^2.0.0"
+
+elliptic@^6.5.3, elliptic@^6.5.5:
+  version "6.5.5"
+  resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.5.tgz#c715e09f78b6923977610d4c2346d6ce22e6dded"
+  integrity sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw==
+  dependencies:
+    bn.js "^4.11.9"
+    brorand "^1.1.0"
+    hash.js "^1.0.0"
+    hmac-drbg "^1.0.1"
+    inherits "^2.0.4"
+    minimalistic-assert "^1.0.1"
+    minimalistic-crypto-utils "^1.0.1"
+
+esbuild@^0.20.1:
+  version "0.20.1"
+  resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.20.1.tgz#1e4cbb380ad1959db7609cb9573ee77257724a3e"
+  integrity sha512-OJwEgrpWm/PCMsLVWXKqvcjme3bHNpOgN7Tb6cQnR5n0TPbQx1/Xrn7rqM+wn17bYeT6MGB5sn1Bh5YiGi70nA==
+  optionalDependencies:
+    "@esbuild/aix-ppc64" "0.20.1"
+    "@esbuild/android-arm" "0.20.1"
+    "@esbuild/android-arm64" "0.20.1"
+    "@esbuild/android-x64" "0.20.1"
+    "@esbuild/darwin-arm64" "0.20.1"
+    "@esbuild/darwin-x64" "0.20.1"
+    "@esbuild/freebsd-arm64" "0.20.1"
+    "@esbuild/freebsd-x64" "0.20.1"
+    "@esbuild/linux-arm" "0.20.1"
+    "@esbuild/linux-arm64" "0.20.1"
+    "@esbuild/linux-ia32" "0.20.1"
+    "@esbuild/linux-loong64" "0.20.1"
+    "@esbuild/linux-mips64el" "0.20.1"
+    "@esbuild/linux-ppc64" "0.20.1"
+    "@esbuild/linux-riscv64" "0.20.1"
+    "@esbuild/linux-s390x" "0.20.1"
+    "@esbuild/linux-x64" "0.20.1"
+    "@esbuild/netbsd-x64" "0.20.1"
+    "@esbuild/openbsd-x64" "0.20.1"
+    "@esbuild/sunos-x64" "0.20.1"
+    "@esbuild/win32-arm64" "0.20.1"
+    "@esbuild/win32-ia32" "0.20.1"
+    "@esbuild/win32-x64" "0.20.1"
+
+events@^3.1.0:
+  version "3.3.0"
+  resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400"
+  integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==
+
+evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
+  version "1.0.3"
+  resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02"
+  integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==
+  dependencies:
+    md5.js "^1.3.4"
+    safe-buffer "^5.1.1"
+
+hash-base@^3.0.0:
+  version "3.1.0"
+  resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33"
+  integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==
+  dependencies:
+    inherits "^2.0.4"
+    readable-stream "^3.6.0"
+    safe-buffer "^5.2.0"
+
+hash-base@~3.0:
+  version "3.0.4"
+  resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918"
+  integrity sha512-EeeoJKjTyt868liAlVmcv2ZsUfGHlE3Q+BICOXcZiwN3osr5Q/zFGYmTJpoIzuaSTAwndFy+GqhEwlU4L3j4Ow==
+  dependencies:
+    inherits "^2.0.1"
+    safe-buffer "^5.0.1"
+
+hash.js@^1.0.0, hash.js@^1.0.3:
+  version "1.1.7"
+  resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42"
+  integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==
+  dependencies:
+    inherits "^2.0.3"
+    minimalistic-assert "^1.0.1"
+
+hmac-drbg@^1.0.1:
+  version "1.0.1"
+  resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
+  integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==
+  dependencies:
+    hash.js "^1.0.3"
+    minimalistic-assert "^1.0.0"
+    minimalistic-crypto-utils "^1.0.1"
+
+ieee754@^1.2.1:
+  version "1.2.1"
+  resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
+  integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
+
+inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3, inherits@~2.0.4:
+  version "2.0.4"
+  resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
+  integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
+
+isarray@~1.0.0:
+  version "1.0.0"
+  resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
+  integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==
+
+"js-tokens@^3.0.0 || ^4.0.0":
+  version "4.0.0"
+  resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
+  integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
+
+loose-envify@^1.1.0:
+  version "1.4.0"
+  resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
+  integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
+  dependencies:
+    js-tokens "^3.0.0 || ^4.0.0"
+
+md5.js@^1.3.4:
+  version "1.3.5"
+  resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f"
+  integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==
+  dependencies:
+    hash-base "^3.0.0"
+    inherits "^2.0.1"
+    safe-buffer "^5.1.2"
+
+miller-rabin@^4.0.0:
+  version "4.0.1"
+  resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d"
+  integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==
+  dependencies:
+    bn.js "^4.0.0"
+    brorand "^1.0.1"
+
+minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
+  version "1.0.1"
+  resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
+  integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==
+
+minimalistic-crypto-utils@^1.0.1:
+  version "1.0.1"
+  resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
+  integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==
+
+parse-asn1@^5.0.0, parse-asn1@^5.1.7:
+  version "5.1.7"
+  resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.7.tgz#73cdaaa822125f9647165625eb45f8a051d2df06"
+  integrity sha512-CTM5kuWR3sx9IFamcl5ErfPl6ea/N8IYwiJ+vpeB2g+1iknv7zBl5uPwbMbRVznRVbrNY6lGuDoE5b30grmbqg==
+  dependencies:
+    asn1.js "^4.10.1"
+    browserify-aes "^1.2.0"
+    evp_bytestokey "^1.0.3"
+    hash-base "~3.0"
+    pbkdf2 "^3.1.2"
+    safe-buffer "^5.2.1"
+
+path-browserify@^1.0.0:
+  version "1.0.1"
+  resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd"
+  integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==
+
+pbkdf2@^3.0.3, pbkdf2@^3.1.2:
+  version "3.1.2"
+  resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075"
+  integrity sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==
+  dependencies:
+    create-hash "^1.1.2"
+    create-hmac "^1.1.4"
+    ripemd160 "^2.0.1"
+    safe-buffer "^5.0.1"
+    sha.js "^2.4.8"
+
+preact-dom@^1.0.1:
+  version "1.0.1"
+  resolved "https://registry.yarnpkg.com/preact-dom/-/preact-dom-1.0.1.tgz#29ca381ef38badf9fe275fe6211629e8f8867f00"
+  integrity sha512-gMWUeZv13FNwYAb3jdWtt8cA9LxDQNeJ3oxdnphqpFpUev+9rJ16cWW/1KlnpIBiA4V0zsAaM0JdGxjYBFU+Sg==
+  dependencies:
+    preact "^3.4.0"
+
+preact@^10.19.6:
+  version "10.19.6"
+  resolved "https://registry.yarnpkg.com/preact/-/preact-10.19.6.tgz#66007b67aad4d11899f583df1b0116d94a89b8f5"
+  integrity sha512-gympg+T2Z1fG1unB8NH29yHJwnEaCH37Z32diPDku316OTnRPeMbiRV9kTrfZpocXjdfnWuFUl/Mj4BHaf6gnw==
+
+preact@^3.4.0:
+  version "3.4.0"
+  resolved "https://registry.yarnpkg.com/preact/-/preact-3.4.0.tgz#a52840f9a20d1555b3be7399883ae4b427fd9d2b"
+  integrity sha512-pXINP+zsoFz4YuDQyK8MmTjo/vaU526+usI2VyhsTK5ElJ+8ApLhgFJGNkDfdQV3tp3YAcnG7OpViUl+dZhruA==
+
+process-nextick-args@~2.0.0:
+  version "2.0.1"
+  resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
+  integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
+
+process@^0.11.10:
+  version "0.11.10"
+  resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
+  integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==
+
+public-encrypt@^4.0.0:
+  version "4.0.3"
+  resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0"
+  integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==
+  dependencies:
+    bn.js "^4.1.0"
+    browserify-rsa "^4.0.0"
+    create-hash "^1.1.0"
+    parse-asn1 "^5.0.0"
+    randombytes "^2.0.1"
+    safe-buffer "^5.1.2"
+
+randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5:
+  version "2.1.0"
+  resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
+  integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==
+  dependencies:
+    safe-buffer "^5.1.0"
+
+randomfill@^1.0.3:
+  version "1.0.4"
+  resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458"
+  integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==
+  dependencies:
+    randombytes "^2.0.5"
+    safe-buffer "^5.1.0"
+
+react-dom@^18.2.0:
+  version "18.2.0"
+  resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d"
+  integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==
+  dependencies:
+    loose-envify "^1.1.0"
+    scheduler "^0.23.0"
+
+react@^18.2.0:
+  version "18.2.0"
+  resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"
+  integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==
+  dependencies:
+    loose-envify "^1.1.0"
+
+readable-stream@^2.3.8:
+  version "2.3.8"
+  resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b"
+  integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==
+  dependencies:
+    core-util-is "~1.0.0"
+    inherits "~2.0.3"
+    isarray "~1.0.0"
+    process-nextick-args "~2.0.0"
+    safe-buffer "~5.1.1"
+    string_decoder "~1.1.1"
+    util-deprecate "~1.0.1"
+
+readable-stream@^3.5.0, readable-stream@^3.6.0:
+  version "3.6.2"
+  resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967"
+  integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==
+  dependencies:
+    inherits "^2.0.3"
+    string_decoder "^1.1.1"
+    util-deprecate "^1.0.1"
+
+ripemd160@^2.0.0, ripemd160@^2.0.1:
+  version "2.0.2"
+  resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c"
+  integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==
+  dependencies:
+    hash-base "^3.0.0"
+    inherits "^2.0.1"
+
+safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0:
+  version "5.2.1"
+  resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
+  integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
+
+safe-buffer@~5.1.0, safe-buffer@~5.1.1:
+  version "5.1.2"
+  resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
+  integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
+
+scheduler@^0.23.0:
+  version "0.23.0"
+  resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe"
+  integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==
+  dependencies:
+    loose-envify "^1.1.0"
+
+sha.js@^2.4.0, sha.js@^2.4.8:
+  version "2.4.11"
+  resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7"
+  integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==
+  dependencies:
+    inherits "^2.0.1"
+    safe-buffer "^5.0.1"
+
+stream-browserify@^3.0.0:
+  version "3.0.0"
+  resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-3.0.0.tgz#22b0a2850cdf6503e73085da1fc7b7d0c2122f2f"
+  integrity sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==
+  dependencies:
+    inherits "~2.0.4"
+    readable-stream "^3.5.0"
+
+string_decoder@^1.1.1, string_decoder@^1.3.0:
+  version "1.3.0"
+  resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
+  integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==
+  dependencies:
+    safe-buffer "~5.2.0"
+
+string_decoder@~1.1.1:
+  version "1.1.1"
+  resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
+  integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
+  dependencies:
+    safe-buffer "~5.1.0"
+
+util-deprecate@^1.0.1, util-deprecate@~1.0.1:
+  version "1.0.2"
+  resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
+  integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
+
+vm-browserify@^1.1.2:
+  version "1.1.2"
+  resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
+  integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
