diff --git a/_data/proxylist.yml b/_data/proxylist.yml
index 4cb705e..35ef0c9 100644
--- a/_data/proxylist.yml
+++ b/_data/proxylist.yml
@@ -17,7 +17,6 @@ mirrors:
- https://mayx.vercel.app/
- https://mayx.netlify.app/
- https://mayx.gitnet.page/
-- https://mayx.stormkit.dev/
- https://mayx.grebedoc.dev/
- https://mayx.codeberg.page/
- https://mayx.tildepages.org/
diff --git a/_layouts/default.html b/_layouts/default.html
index 616f962..13c7b59 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -98,7 +98,8 @@ layout: xslt_container
Download TAR Ball
View On GitHub
{% else %}
- Download 7-Zip File
+ Download 7-Zip File
+ Manage Offline Mode
{% endif %}
diff --git a/_tools/envs_post-receive b/_tools/envs_post-receive
index fa0f7c6..1df73b4 100644
--- a/_tools/envs_post-receive
+++ b/_tools/envs_post-receive
@@ -7,7 +7,8 @@ mkdir Mabbs
curl -L -o Mabbs/README.md https://github.com/Mabbs/Mabbs/raw/main/README.md
bundle exec jekyll build -d ../public_html
python3 _tools/blogquine.py --src-dir blog --quine-dir blog ../public_html/ MayxBlog.7z
-mv MayxBlog.7z ../public_html/
+7z a -mx9 -bd -bb0 MayxBlog-new.7z MayxBlog.7z
+mv MayxBlog-new.7z ../public_html/MayxBlog.7z
cd ../public_html/
unset GIT_DIR
git init
@@ -18,6 +19,6 @@ git branch pages
git remote add codeberg ssh://git@codeberg.org/mayx/pages.git
git remote add bitbucket ssh://git@bitbucket.org/unmayx/unmayx.bitbucket.io.git
git push -f codeberg main
-git push -f codeberg pages
+git push -f codeberg pages
git push -f bitbucket main
/home/mayx/blog-env/node_modules/surge/bin/surge /home/mayx/public_html/ mayx.surge.sh
\ No newline at end of file
diff --git a/_tools/serv00_post-receive b/_tools/serv00_post-receive
index f0192dc..4ad6077 100644
--- a/_tools/serv00_post-receive
+++ b/_tools/serv00_post-receive
@@ -7,13 +7,15 @@ mkdir Mabbs
curl -L -o Mabbs/README.md https://github.com/Mabbs/Mabbs/raw/main/README.md
bundle exec jekyll build -d ../domains/mayx.serv00.net/public_html/
python3 _tools/blogquine.py --src-dir blog --quine-dir blog ../domains/mayx.serv00.net/public_html/ MayxBlog.7z
-mv MayxBlog.7z ../domains/mayx.serv00.net/public_html/
+7zz a -mx9 -bd -bb0 MayxBlog-new.7z MayxBlog.7z
+mv MayxBlog-new.7z ../domains/mayx.serv00.net/public_html/MayxBlog.7z
rsync -avz --delete ../domains/mayx.serv00.net/public_html/ mayx@web.sourceforge.net:/home/project-web/mayx/htdocs/
cd ../domains/mayx.serv00.net/public_html/
unset GIT_DIR
git init
git lfs install
git lfs track "*.png"
+git lfs track "*.webp"
git lfs track "*.moc"
git lfs track "*.tgz"
git lfs track "*.jpg"
diff --git a/assets/js/offline-page.js b/assets/js/offline-page.js
new file mode 100644
index 0000000..8b0bdb1
--- /dev/null
+++ b/assets/js/offline-page.js
@@ -0,0 +1,119 @@
+/*
+ * Mayx的博客 · /offline.html 控制页控制器(classic script,PJAX 兼容)
+ *
+ * 本体是 IIFE,不含模块语法:PJAX 换页时 jQuery 会重新执行本文件,
+ * 每次执行都重新查询元素、重新绑定事件,天然幂等。真正的解包逻辑在
+ * ES module /assets/js/offline-unpack.js 中,通过动态 import() 加载
+ * (浏览器模块缓存保证 PJAX 反复进入本页也不会重复加载)。
+ * 注意:本文件经 Liquid 原样输出,不能使用模板语法字符。
+ */
+
+(function () {
+ var MODULE_URL = '/assets/js/offline-unpack.js';
+ // 压缩包大致量级(当前约 27MB),仅用于进度条比例,不影响正确性
+ var EXPECTED_BYTES = 27 * 1024 * 1024;
+ var busy = false;
+
+ function el(id) { return document.getElementById(id); }
+ function fmtMB(bytes) { return (bytes / 1048576).toFixed(1) + ' MB'; }
+
+ function setMessage(text) {
+ el('offline-message').textContent = text || '';
+ }
+
+ function showProgress(show) {
+ el('offline-progress-box').hidden = !show;
+ }
+
+ function render(meta) {
+ var online = !meta;
+ el('offline-state').textContent = online
+ ? '在线模式(离线未启用)'
+ : '离线模式(优先从本地缓存加载)';
+ el('offline-version').textContent = online ? '-' : fmtMB(meta.payloadSize) + '(压缩包大小即版本号)';
+ el('offline-files').textContent = online ? '-' : meta.files + ' 个文件 / ' + fmtMB(meta.bytes);
+ el('offline-time').textContent = online ? '-' : new Date(meta.unpackedAt).toLocaleString();
+ el('offline-persist').textContent = online ? '-' : (meta.persisted ? '已授权(缓存不会被自动回收)' : '未授权(浏览器空间紧张时可能回收缓存)');
+ el('offline-enable').disabled = busy || !online;
+ el('offline-disable').disabled = busy || online;
+ }
+
+ function onProgress(info) {
+ if (info.done) return;
+ el('offline-progress').value = Math.min(100, (info.bytes / EXPECTED_BYTES) * 100);
+ el('offline-progress-text').textContent =
+ '已解包 ' + info.files + ' 个文件(' + fmtMB(info.bytes) + ')…';
+ }
+
+ function withModule(fn) {
+ return import(MODULE_URL).then(fn);
+ }
+
+ function refresh() {
+ if (!('serviceWorker' in navigator) || !('caches' in window)) {
+ el('offline-state').textContent = '当前浏览器不支持离线模式(需要 Service Worker)';
+ el('offline-enable').disabled = true;
+ el('offline-disable').disabled = true;
+ return;
+ }
+ withModule(function (mod) { return mod.ensureFresh(); }).then(function (fresh) {
+ render(fresh.ready ? fresh.meta : null);
+ if (fresh.stale) {
+ setMessage('检测到站点压缩包已更新,离线缓存已自动失效,当前处于在线模式。可重新启用离线模式。');
+ }
+ }).catch(function (e) {
+ setMessage('状态检测失败:' + (e && e.message ? e.message : e));
+ });
+ }
+
+ function onEnable() {
+ busy = true;
+ render(null);
+ showProgress(true);
+ setMessage('正在下载并解包站点压缩包,请保持网络连接…');
+ withModule(function (mod) { return mod.activateOffline({ onProgress: onProgress }); })
+ .then(function (meta) {
+ el('offline-progress').value = 100;
+ el('offline-progress-text').textContent = '解包完成';
+ setMessage('离线模式已启用。之后访问本博客将优先使用本地缓存,断网也能阅读。');
+ busy = false;
+ showProgress(false);
+ render(meta); // 立即展示离线状态,不必等后台刷新
+ })
+ .catch(function (e) {
+ setMessage('启用失败:' + (e && e.message ? e.message : e));
+ busy = false;
+ showProgress(false);
+ refresh();
+ });
+ }
+
+ function onDisable() {
+ busy = true;
+ setMessage('');
+ withModule(function (mod) { return mod.deactivateOffline(); })
+ .then(function () {
+ setMessage('已切回在线模式,之后页面将通过网络加载。');
+ busy = false;
+ render(null);
+ if (navigator.onLine) {
+ setTimeout(function () { location.reload(); }, 800);
+ }
+ })
+ .catch(function (e) {
+ setMessage('操作失败:' + (e && e.message ? e.message : e));
+ busy = false;
+ refresh();
+ });
+ }
+
+ function bind() {
+ var enable = el('offline-enable');
+ if (!enable) return; // 不在控制页(PJAX 容错)
+ enable.addEventListener('click', onEnable);
+ el('offline-disable').addEventListener('click', onDisable);
+ refresh();
+ }
+
+ bind();
+})();
diff --git a/assets/js/offline-unpack.js b/assets/js/offline-unpack.js
new file mode 100644
index 0000000..07893bd
--- /dev/null
+++ b/assets/js/offline-unpack.js
@@ -0,0 +1,269 @@
+/*
+ * Mayx的博客 · 离线模式核心逻辑(/offline.html 控制页使用,ES module)
+ *
+ * - activateOffline():注册 SW,下载站点压缩包 /MayxBlog.7z,经 libarchive(WASM)
+ * 流式解包,把每个文件按站点路径写入 Cache Storage,最后写入就绪标记
+ * (清单 + payloadSize 版本号),自此进入离线模式。
+ * - ensureFresh():HEAD 探测线上压缩包大小,与标记中的 payloadSize 不一致
+ * 说明站点已更新 → 清空缓存,回退在线模式。
+ * - deactivateOffline():清空缓存,手动切回在线模式。
+ * - readStatus():读取当前离线状态,供控制页展示。
+ *
+ */
+
+const ARCHIVE_URL = '/MayxBlog.7z';
+const ARCHIVE_ROOT = 'blog/';
+const CACHE_NAME = 'mayxblog-offline-v1';
+const READY_KEY = '/__offline_manifest__';
+const WORKER_URL = '/vendor/libarchive/worker-bundle.js';
+
+const MIME = {
+ html: 'text/html; charset=utf-8',
+ htm: 'text/html; charset=utf-8',
+ css: 'text/css; charset=utf-8',
+ js: 'application/javascript; charset=utf-8',
+ mjs: 'application/javascript; charset=utf-8',
+ json: 'application/json; charset=utf-8',
+ xml: 'application/xml; charset=utf-8',
+ xsl: 'text/xsl; charset=utf-8',
+ opml: 'text/x-opml; charset=utf-8',
+ txt: 'text/plain; charset=utf-8',
+ md: 'text/markdown; charset=utf-8',
+ csv: 'text/csv; charset=utf-8',
+ svg: 'image/svg+xml',
+ png: 'image/png',
+ jpg: 'image/jpeg',
+ jpeg: 'image/jpeg',
+ gif: 'image/gif',
+ webp: 'image/webp',
+ avif: 'image/avif',
+ ico: 'image/x-icon',
+ bmp: 'image/bmp',
+ woff: 'font/woff',
+ woff2: 'font/woff2',
+ ttf: 'font/ttf',
+ otf: 'font/otf',
+ eot: 'application/vnd.ms-fontobject',
+ mp3: 'audio/mpeg',
+ mp4: 'video/mp4',
+ webm: 'video/webm',
+ '7z': 'application/x-7z-compressed',
+ zip: 'application/zip',
+ wasm: 'application/wasm',
+ mtn: 'application/octet-stream',
+ moc: 'application/octet-stream',
+ pdf: 'application/pdf',
+};
+
+function mimeFor(pathname) {
+ const dot = pathname.lastIndexOf('.');
+ const ext = dot === -1 ? '' : pathname.slice(dot + 1).toLowerCase();
+ return MIME[ext] || 'application/octet-stream';
+}
+
+function sitePathFor(entryPath) {
+ const normalized = entryPath.replace(/\\/g, '/');
+ if (!normalized.startsWith(ARCHIVE_ROOT)) return null;
+ const relative = normalized.slice(ARCHIVE_ROOT.length);
+ if (!relative) return null;
+
+ const segments = [];
+ for (const segment of relative.split('/')) {
+ if (!segment || segment === '.') continue;
+ if (segment === '..') return null;
+ segments.push(segment);
+ }
+ if (!segments.length) return null;
+ return '/' + segments.join('/');
+}
+
+/*
+ * 在独立 worker 中打开一层压缩包并流式吐出条目;
+ * 返回其中根级嵌套压缩包(下一层包装)的原始字节。
+ */
+function extractLayer(file, onEntry) {
+ return new Promise((resolve, reject) => {
+ const worker = new Worker(WORKER_URL);
+ const nested = [];
+ let settled = false;
+
+ const finish = (error) => {
+ if (settled) return;
+ settled = true;
+ worker.terminate();
+ if (error) reject(error);
+ else resolve(nested);
+ };
+
+ worker.addEventListener('error', (event) => {
+ finish(new Error(event.message || 'libarchive worker failed'));
+ });
+
+ worker.addEventListener('message', ({ data }) => {
+ if (data.type === 'ERROR') {
+ finish(new Error(data.error && data.error.message ? data.error.message : 'libarchive failed'));
+ return;
+ }
+ if (data.type === 'READY') {
+ worker.postMessage({ type: 'OPEN', file });
+ return;
+ }
+ if (data.type === 'OPENED') {
+ worker.postMessage({ type: 'EXTRACT_FILES' });
+ return;
+ }
+ if (data.type === 'END') {
+ finish(null);
+ return;
+ }
+ if (data.type !== 'ENTRY') return;
+
+ const entry = data.entry;
+ if (entry.type !== 'FILE' || !entry.fileData) return;
+
+ // 根级压缩包是下一层包装,不是站点内容
+ if (entry.path.replace(/\\/g, '/') === 'MayxBlog.7z') {
+ nested.push(entry.fileData);
+ return;
+ }
+ onEntry(entry);
+ });
+ });
+}
+
+/* 几十 MB 的缓存是浏览器常见的回收对象,而重新解包代价高,尽量申请持久存储。 */
+async function requestPersistence() {
+ if (!navigator.storage || !navigator.storage.persist) return false;
+ try {
+ if (await navigator.storage.persisted()) return true;
+ return await navigator.storage.persist();
+ } catch {
+ return false;
+ }
+}
+
+/* 读取就绪标记(= 离线模式状态);损坏或缺清单的标记视为不存在。 */
+export async function readStatus() {
+ const cache = await caches.open(CACHE_NAME);
+ const hit = await cache.match(READY_KEY);
+ if (!hit) return null;
+ const meta = await hit.json().catch(() => null);
+ if (!meta || !Array.isArray(meta.keys) || !meta.keys.length) return null;
+ return meta;
+}
+
+/*
+ * 线上压缩包的大小即版本号。HEAD 不被 SW 拦截,拿到的一定是线上真实值;
+ * 网络失败返回 null,调用方选择信任现有缓存而不是误伤。
+ */
+async function payloadSize() {
+ try {
+ const response = await fetch(ARCHIVE_URL, { method: 'HEAD', cache: 'no-store' });
+ if (!response.ok) return null;
+ const size = Number(response.headers.get('content-length'));
+ return Number.isFinite(size) && size > 0 ? size : null;
+ } catch {
+ return null;
+ }
+}
+
+/*
+ * 控制页打开时调用:未启用 → {ready:false};已启用且版本一致 → {ready:true, meta};
+ * 版本不一致 → 清空缓存并返回 {ready:false, stale:true}(已回退在线模式)。
+ */
+export async function ensureFresh() {
+ const cache = await caches.open(CACHE_NAME);
+ const size = await payloadSize();
+ const meta = await readStatus();
+
+ if (!meta) return { ready: false, size, stale: false };
+ if (size && meta.payloadSize !== size) {
+ await caches.delete(CACHE_NAME);
+ return { ready: false, size, stale: true };
+ }
+ return { ready: true, size, stale: false, meta };
+}
+
+/*
+ * 启用离线模式:注册 SW → 清空旧缓存(同时清掉上次中断的残留,保证随后
+ * 的压缩包下载不会被旧缓存喂旧的 quine 副本)→ 下载并逐层解包 → 写标记。
+ */
+export async function activateOffline({ onProgress } = {}) {
+ if (!('serviceWorker' in navigator)) {
+ throw new Error('当前浏览器不支持 Service Worker,无法启用离线模式。');
+ }
+ await navigator.serviceWorker.register('/sw.js', { scope: '/' });
+ await navigator.serviceWorker.ready;
+ await caches.delete(CACHE_NAME);
+
+ const persisted = await requestPersistence();
+
+ // 写操作串行链,保证按到达顺序落盘且不产生无界并发
+ const cache = await caches.open(CACHE_NAME);
+ let writes = Promise.resolve();
+ const keys = new Set();
+ let files = 0;
+ let bytes = 0;
+ let skipped = 0;
+
+ const response = await fetch(ARCHIVE_URL, { cache: 'no-store' });
+ if (!response.ok) throw new Error(`无法下载站点压缩包:HTTP ${response.status}`);
+ const outer = await response.arrayBuffer();
+ const downloadedBytes = outer.byteLength;
+
+ let layer = [outer];
+ while (layer.length) {
+ const bytesThisLayer = layer.shift();
+ const file = new File([bytesThisLayer], 'MayxBlog.7z');
+
+ layer = await extractLayer(file, (entry) => {
+ const key = sitePathFor(entry.path);
+ if (!key) {
+ skipped += 1;
+ return;
+ }
+ const body = entry.fileData;
+ files += 1;
+ bytes += body.byteLength;
+
+ writes = writes.then(async () => {
+ await cache.put(key, new Response(body, {
+ status: 200,
+ headers: { 'Content-Type': mimeFor(key) },
+ }));
+ keys.add(key);
+ });
+
+ if (onProgress) onProgress({ done: false, files, bytes, skipped });
+ });
+ }
+
+ await writes;
+
+ const meta = {
+ files,
+ bytes,
+ skipped,
+ persisted,
+ payloadSize: downloadedBytes,
+ failed: files - keys.size,
+ keys: [...keys],
+ unpackedAt: new Date().toISOString(),
+ };
+ await cache.put(
+ READY_KEY,
+ new Response(JSON.stringify(meta), {
+ headers: { 'Content-Type': 'application/json; charset=utf-8' },
+ })
+ );
+
+ if (onProgress) onProgress({ done: true, cached: false, ...meta });
+ return meta;
+}
+
+/* 切回在线模式:删掉缓存(含标记),SW 随即恢复纯转发。返回之前是否处于离线模式。 */
+export async function deactivateOffline() {
+ const had = await readStatus();
+ await caches.delete(CACHE_NAME);
+ return Boolean(had);
+}
diff --git a/offline.md b/offline.md
new file mode 100644
index 0000000..f571a9f
--- /dev/null
+++ b/offline.md
@@ -0,0 +1,37 @@
+---
+layout: default
+title: 离线模式
+---
+
+# 离线模式
+
+本页用于管理本博客的离线阅读功能:
+
+- **启用离线模式**:浏览器会下载整站压缩包(`MayxBlog.7z`)并解包到本地缓存,之后即使没有网络也能正常浏览博客;
+- **自动回退**:当站点压缩包更新(博客重新部署)时,离线缓存会自动失效并回退到在线模式,下次重新启用即可获取最新内容;
+- **手动切换**:离线模式下可以随时在本页切回在线模式,切回后页面将重新通过网络加载。
+
+
+
+ | 当前状态 | 检测中… |
+ | 缓存版本 | - |
+ | 文件统计 | - |
+ | 解包时间 | - |
+ | 持久存储 | - |
+
+
+
+
+
+
+ 准备中…
+
+
+
+
+
+
+
+
+
+
diff --git a/sw.js b/sw.js
new file mode 100644
index 0000000..106a0f1
--- /dev/null
+++ b/sw.js
@@ -0,0 +1,140 @@
+/*
+ * Mayx的博客 · 离线模式 Service Worker
+ *
+ * 两种模式(由 Cache Storage 中是否存在就绪标记决定):
+ * - 在线模式(默认,无标记):所有请求原样转发网络,SW 形同虚设。
+ * - 离线模式(/offline.html 启用后写入标记):同源 GET 请求缓存优先,
+ * 缓存未命中且清单里没有的路径才回源网络,实现断网阅读。
+ *
+ * 版本控制:压缩包 /MayxBlog.7z 的 content-length 即版本号(每次重新部署
+ * 都会变化)。SW 激活时、以及导航请求按 RECHECK_INTERVAL 节流复核;
+ * 一旦发现线上压缩包与已缓存版本不一致,立即清空缓存 → 自动回退在线模式。
+ * 网络不可用时复核失败,保留缓存(离线阅读本来就是离线模式的目的)。
+ */
+
+const CACHE_NAME = 'mayxblog-offline-v1';
+const READY_KEY = '/__offline_manifest__';
+const ARCHIVE_URL = '/MayxBlog.7z';
+const RECHECK_INTERVAL = 5 * 60 * 1000;
+
+let lastRecheck = 0;
+
+self.addEventListener('install', () => {
+ self.skipWaiting();
+});
+
+self.addEventListener('activate', (event) => {
+ event.waitUntil(
+ caches.keys()
+ .then((keys) =>
+ Promise.all(keys.filter((k) => k !== CACHE_NAME).map((k) => caches.delete(k)))
+ )
+ .then(verifyPayloadVersion)
+ .then(() => self.clients.claim())
+ );
+});
+
+/*
+ * HEAD 请求不被下面的 fetch 处理器拦截,这里读到的一定是线上真实压缩包,
+ * 而不是缓存里的 quine 副本。网络失败返回 null,调用方选择信任现有缓存。
+ */
+async function payloadSize() {
+ try {
+ const response = await fetch(ARCHIVE_URL, { method: 'HEAD', cache: 'no-store' });
+ if (!response.ok) return null;
+ const size = Number(response.headers.get('content-length'));
+ return Number.isFinite(size) && size > 0 ? size : null;
+ } catch {
+ return null;
+ }
+}
+
+/*
+ * 就绪标记同时是清单:记录了解包写入的所有路径。没有它就无法区分
+ * “站点本来就没有这个页面”和“缓存条目被浏览器回收了”。
+ */
+async function readManifest(cache) {
+ const hit = await cache.match(READY_KEY);
+ if (!hit) return null;
+ const meta = await hit.json().catch(() => null);
+ if (!meta || !Array.isArray(meta.keys) || !meta.keys.length) return null;
+ return meta;
+}
+
+/* 压缩包更新 → 清空缓存(即回退在线模式);返回是否发生了失效。 */
+async function verifyPayloadVersion() {
+ const cache = await caches.open(CACHE_NAME);
+ const meta = await readManifest(cache);
+ if (!meta) return false;
+ const size = await payloadSize();
+ if (size && meta.payloadSize !== size) {
+ await caches.delete(CACHE_NAME);
+ return true;
+ }
+ return false;
+}
+
+/* 服务器对目录索引的处理与 Jekyll 产物一致,这里补齐候选路径。 */
+function candidatesFor(pathname) {
+ const keys = [pathname];
+ if (pathname.endsWith('/')) {
+ keys.push(pathname + 'index.html');
+ } else {
+ keys.push(pathname + '/index.html');
+ keys.push(pathname + '.html');
+ }
+ return keys;
+}
+
+self.addEventListener('fetch', (event) => {
+ const request = event.request;
+ if (request.method !== 'GET') return; // HEAD 等直通网络(版本探测依赖这一点)
+
+ const url = new URL(request.url);
+ if (url.origin !== self.location.origin) return; // 跨域请求不干预
+
+ // 显式 no-store 的请求(重新下载压缩包等)绕过缓存,避免吃到旧的 quine 副本
+ if (request.cache === 'no-store') return;
+
+ event.respondWith(respond(request, url, event));
+});
+
+async function respond(request, url, event) {
+ const cache = await caches.open(CACHE_NAME);
+
+ // 导航请求顺带做节流版本复核;失效发生在后台,本次响应不受影响,
+ // 下一次请求自然落入在线模式。
+ if (request.mode === 'navigate' && Date.now() - lastRecheck > RECHECK_INTERVAL) {
+ lastRecheck = Date.now();
+ event.waitUntil(verifyPayloadVersion());
+ }
+
+ const candidates = candidatesFor(url.pathname);
+ for (const key of candidates) {
+ const hit = await cache.match(key);
+ if (hit) return hit;
+ }
+
+ const meta = await readManifest(cache);
+ if (!meta) return fetch(request); // 在线模式:纯转发
+
+ // 清单承诺过这个路径但缓存里没有 → 条目被浏览器回收,缓存已不可信,
+ // 整体作废并回退在线模式。
+ if (candidates.some((key) => meta.keys.includes(key))) {
+ await caches.delete(CACHE_NAME);
+ return fetch(request);
+ }
+
+ // 清单之外的路径回源网络;断网时的导航请求用站点 404 页兜底。
+ try {
+ return await fetch(request);
+ } catch (error) {
+ if (request.mode === 'navigate') {
+ const notFound = await cache.match('/404.html');
+ if (notFound) {
+ return new Response(notFound.body, { status: 404, headers: notFound.headers });
+ }
+ }
+ throw error;
+ }
+}
diff --git a/vendor/libarchive/LICENSE b/vendor/libarchive/LICENSE
new file mode 100644
index 0000000..d7e8a1d
--- /dev/null
+++ b/vendor/libarchive/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 ნიკა
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/libarchive/wasm-gen/libarchive.js b/vendor/libarchive/wasm-gen/libarchive.js
new file mode 100644
index 0000000..6adea82
--- /dev/null
+++ b/vendor/libarchive/wasm-gen/libarchive.js
@@ -0,0 +1,15 @@
+
+var libarchive = (function() {
+ var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
+ return (
+function(libarchive) {
+ libarchive = libarchive || {};
+
+var Module=typeof libarchive!=="undefined"?libarchive:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}else{return scriptDirectory+path}}if(ENVIRONMENT_IS_NODE){scriptDirectory=__dirname+"/";var nodeFS;var nodePath;Module["read"]=function shell_read(filename,binary){var ret;if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);ret=nodeFS["readFileSync"](filename);return binary?ret:ret.toString()};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}Module["arguments"]=process["argv"].slice(2);process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",abort);Module["quit"]=function(status){process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){Module["read"]=function shell_read(f){return read(f)}}Module["readBinary"]=function readBinary(f){var data;if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof quit==="function"){Module["quit"]=function(status){quit(status)}}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf("/")+1)}else{scriptDirectory=""}Module["read"]=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){Module["readBinary"]=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)};Module["setWindowTitle"]=function(title){document.title=title}}else{}var out=Module["print"]||(typeof console!=="undefined"?console.log.bind(console):typeof print!=="undefined"?print:null);var err=Module["printErr"]||(typeof printErr!=="undefined"?printErr:typeof console!=="undefined"&&console.warn.bind(console)||out);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;function dynamicAlloc(size){var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;if(end<=_emscripten_get_heap_size()){HEAP32[DYNAMICTOP_PTR>>2]=end}else{var success=_emscripten_resize_heap(end);if(!success)return 0}return ret}function getNativeTypeSize(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return 4}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0,"getNativeTypeSize invalid bits "+bits+", type "+type);return bits/8}else{return 0}}}}var asm2wasmImports={"f64-rem":function(x,y){return x%y},"debugger":function(){debugger}};var functionPointers=new Array(0);var tempRet0=0;var setTempRet0=function(value){tempRet0=value};if(typeof WebAssembly!=="object"){err("no native wasm support detected")}var wasmMemory;var wasmTable;var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];assert(func,"Cannot call unknown function "+ident+", make sure it is exported");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},"array":function(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>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}var ALLOC_NORMAL=0;var ALLOC_NONE=3;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[_malloc,stackAlloc,dynamicAlloc][allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var stop;ptr=ret;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i=endIdx))++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var str="";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function demangle(func){return func}function demangleAll(text){var regex=/__Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function stackTrace(){var js=jsStackTrace();if(Module["extraStackTrace"])js+="\n"+Module["extraStackTrace"]();return demangleAll(js)}var WASM_PAGE_SIZE=65536;function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var DYNAMIC_BASE=5520464,DYNAMICTOP_PTR=277552;var TOTAL_STACK=5242880;var INITIAL_TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(INITIAL_TOTAL_MEMORY>2]=DYNAMIC_BASE;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=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 ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();TTY.init();PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}function preMain(){FS.ignorePermissions=false;callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){runtimeExited=true}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 addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var Math_abs=Math.abs;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_min=Math.min;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return String.prototype.startsWith?filename.startsWith(dataURIPrefix):filename.indexOf(dataURIPrefix)===0}var wasmBinaryFile="libarchive.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(){try{if(Module["wasmBinary"]){return new Uint8Array(Module["wasmBinary"])}if(Module["readBinary"]){return Module["readBinary"](wasmBinaryFile)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!Module["wasmBinary"]&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&typeof fetch==="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary()})}return new Promise(function(resolve,reject){resolve(getBinary())})}function createWasm(env){var info={"env":env,"global":{"NaN":NaN,Infinity:Infinity},"global.Math":Math,"asm2wasm":asm2wasmImports};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}function receiveInstantiatedSource(output){receiveInstance(output["instance"])}function instantiateArrayBuffer(receiver){getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}if(!Module["wasmBinary"]&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&typeof fetch==="function"){WebAssembly.instantiateStreaming(fetch(wasmBinaryFile,{credentials:"same-origin"}),info).then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");instantiateArrayBuffer(receiveInstantiatedSource)})}else{instantiateArrayBuffer(receiveInstantiatedSource)}return{}}Module["asm"]=function(global,env,providedBuffer){env["memory"]=wasmMemory;env["table"]=wasmTable=new WebAssembly.Table({"initial":507,"maximum":507,"element":"anyfunc"});env["__memory_base"]=1024;env["__table_base"]=0;var exports=createWasm(env);return exports};__ATINIT__.push({func:function(){___emscripten_environ_constructor()}});var ENV={};function ___buildEnvironment(environ){var MAX_ENV_VALUES=64;var TOTAL_ENV_SIZE=1024;var poolPtr;var envPtr;if(!___buildEnvironment.called){___buildEnvironment.called=true;ENV["USER"]=ENV["LOGNAME"]="web_user";ENV["PATH"]="/";ENV["PWD"]="/";ENV["HOME"]="/home/web_user";ENV["LANG"]="C.UTF-8";ENV["_"]=Module["thisProgram"];poolPtr=getMemory(TOTAL_ENV_SIZE);envPtr=getMemory(MAX_ENV_VALUES*4);HEAP32[envPtr>>2]=poolPtr;HEAP32[environ>>2]=envPtr}else{envPtr=HEAP32[environ>>2];poolPtr=HEAP32[envPtr>>2]}var strings=[];var totalSize=0;for(var key in ENV){if(typeof ENV[key]==="string"){var line=key+"="+ENV[key];strings.push(line);totalSize+=line.length}}if(totalSize>TOTAL_ENV_SIZE){throw new Error("Environment size exceeded TOTAL_ENV_SIZE!")}var ptrSize=4;for(var i=0;i>2]=poolPtr;poolPtr+=line.length+1}HEAP32[envPtr+strings.length*ptrSize>>2]=0}var PATH={splitPath:function(filename){var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:function(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:function(path){var isAbsolute=path.charAt(0)==="/",trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:function(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:function(path){if(path==="/")return"/";var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},extname:function(path){return PATH.splitPath(path)[3]},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join("/"))},join2:function(l,r){return PATH.normalize(l+"/"+r)}};function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[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.charAt(0)==="/"}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:function(from,to){from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=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;i0){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}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(1)}if(!MEMFS.ops_table){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}return node},getFileDataAsRegularArray:function(node){if(node.contents&&node.contents.subarray){var arr=[];for(var i=0;i=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);return},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0;return}if(!node.contents||node.contents.subarray){var oldContents=node.contents;node.contents=new Uint8Array(new ArrayBuffer(newSize));if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize;return}if(!node.contents)node.contents=[];if(node.contents.length>newSize)node.contents.length=newSize;else while(node.contents.length=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;i0||position+lengthe2.timestamp){create.push(key);total++}});var remove=[];Object.keys(dst.entries).forEach(function(key){var e=dst.entries[key];var e2=src.entries[key];if(!e2){remove.push(key);total++}});if(!total){return callback(null)}var errored=false;var completed=0;var db=src.type==="remote"?src.db:dst.db;var transaction=db.transaction([IDBFS.DB_STORE_NAME],"readwrite");var store=transaction.objectStore(IDBFS.DB_STORE_NAME);function done(err){if(err){if(!done.errored){done.errored=true;return callback(err)}return}if(++completed>=total){return callback(null)}}transaction.onerror=function(e){done(this.error);e.preventDefault()};create.sort().forEach(function(path){if(dst.type==="local"){IDBFS.loadRemoteEntry(store,path,function(err,entry){if(err)return done(err);IDBFS.storeLocalEntry(path,entry,done)})}else{IDBFS.loadLocalEntry(path,function(err,entry){if(err)return done(err);IDBFS.storeRemoteEntry(store,path,entry,done)})}});remove.sort().reverse().forEach(function(path){if(dst.type==="local"){IDBFS.removeLocalEntry(path,done)}else{IDBFS.removeRemoteEntry(store,path,done)}})}};var NODEFS={isWindows:false,staticInit:function(){NODEFS.isWindows=!!process.platform.match(/^win/);var flags=process["binding"]("constants");if(flags["fs"]){flags=flags["fs"]}NODEFS.flagsForNodeMap={1024:flags["O_APPEND"],64:flags["O_CREAT"],128:flags["O_EXCL"],0:flags["O_RDONLY"],2:flags["O_RDWR"],4096:flags["O_SYNC"],512:flags["O_TRUNC"],1:flags["O_WRONLY"]}},bufferFrom:function(arrayBuffer){return Buffer.alloc?Buffer.from(arrayBuffer):new Buffer(arrayBuffer)},mount:function(mount){assert(ENVIRONMENT_IS_NODE);return NODEFS.createNode(null,"/",NODEFS.getMode(mount.opts.root),0)},createNode:function(parent,name,mode,dev){if(!FS.isDir(mode)&&!FS.isFile(mode)&&!FS.isLink(mode)){throw new FS.ErrnoError(22)}var node=FS.createNode(parent,name,mode);node.node_ops=NODEFS.node_ops;node.stream_ops=NODEFS.stream_ops;return node},getMode:function(path){var stat;try{stat=fs.lstatSync(path);if(NODEFS.isWindows){stat.mode=stat.mode|(stat.mode&292)>>2}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}return stat.mode},realPath:function(node){var parts=[];while(node.parent!==node){parts.push(node.name);node=node.parent}parts.push(node.mount.opts.root);parts.reverse();return PATH.join.apply(null,parts)},flagsForNode:function(flags){flags&=~2097152;flags&=~2048;flags&=~32768;flags&=~524288;var newFlags=0;for(var k in NODEFS.flagsForNodeMap){if(flags&k){newFlags|=NODEFS.flagsForNodeMap[k];flags^=k}}if(!flags){return newFlags}else{throw new FS.ErrnoError(22)}},node_ops:{getattr:function(node){var path=NODEFS.realPath(node);var stat;try{stat=fs.lstatSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}if(NODEFS.isWindows&&!stat.blksize){stat.blksize=4096}if(NODEFS.isWindows&&!stat.blocks){stat.blocks=(stat.size+stat.blksize-1)/stat.blksize|0}return{dev:stat.dev,ino:stat.ino,mode:stat.mode,nlink:stat.nlink,uid:stat.uid,gid:stat.gid,rdev:stat.rdev,size:stat.size,atime:stat.atime,mtime:stat.mtime,ctime:stat.ctime,blksize:stat.blksize,blocks:stat.blocks}},setattr:function(node,attr){var path=NODEFS.realPath(node);try{if(attr.mode!==undefined){fs.chmodSync(path,attr.mode);node.mode=attr.mode}if(attr.timestamp!==undefined){var date=new Date(attr.timestamp);fs.utimesSync(path,date,date)}if(attr.size!==undefined){fs.truncateSync(path,attr.size)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},lookup:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);var mode=NODEFS.getMode(path);return NODEFS.createNode(parent,name,mode)},mknod:function(parent,name,mode,dev){var node=NODEFS.createNode(parent,name,mode,dev);var path=NODEFS.realPath(node);try{if(FS.isDir(node.mode)){fs.mkdirSync(path,node.mode)}else{fs.writeFileSync(path,"",{mode:node.mode})}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}return node},rename:function(oldNode,newDir,newName){var oldPath=NODEFS.realPath(oldNode);var newPath=PATH.join2(NODEFS.realPath(newDir),newName);try{fs.renameSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},unlink:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.unlinkSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},rmdir:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.rmdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},readdir:function(node){var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},symlink:function(parent,newName,oldPath){var newPath=PATH.join2(NODEFS.realPath(parent),newName);try{fs.symlinkSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},readlink:function(node){var path=NODEFS.realPath(node);try{path=fs.readlinkSync(path);path=NODEJS_PATH.relative(NODEJS_PATH.resolve(node.mount.opts.root),path);return path}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}}},stream_ops:{open:function(stream){var path=NODEFS.realPath(stream.node);try{if(FS.isFile(stream.node.mode)){stream.nfd=fs.openSync(path,NODEFS.flagsForNode(stream.flags))}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},close:function(stream){try{if(FS.isFile(stream.node.mode)&&stream.nfd){fs.closeSync(stream.nfd)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},read:function(stream,buffer,offset,length,position){if(length===0)return 0;try{return fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(-e.errno)}},write:function(stream,buffer,offset,length,position){try{return fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(-e.errno)}},llseek:function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){try{var stat=fs.fstatSync(stream.nfd);position+=stat.size}catch(e){throw new FS.ErrnoError(-e.errno)}}}if(position<0){throw new FS.ErrnoError(22)}return position}}};var WORKERFS={DIR_MODE:16895,FILE_MODE:33279,reader:null,mount:function(mount){assert(ENVIRONMENT_IS_WORKER);if(!WORKERFS.reader)WORKERFS.reader=new FileReaderSync;var root=WORKERFS.createNode(null,"/",WORKERFS.DIR_MODE,0);var createdParents={};function ensureParent(path){var parts=path.split("/");var parent=root;for(var i=0;i=stream.node.size)return 0;var chunk=stream.node.contents.slice(position,position+length);var ab=WORKERFS.reader.readAsArrayBuffer(chunk);buffer.set(new Uint8Array(ab),offset);return chunk.size},write:function(stream,buffer,offset,length,position){throw new FS.ErrnoError(5)},llseek:function(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.size}}if(position<0){throw new FS.ErrnoError(22)}return position}}};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof FS.ErrnoError))throw e+" : "+stackTrace();return ___setErrNo(e.errno)},lookupPath:function(path,opts){path=PATH_FS.resolve(FS.cwd(),path);opts=opts||{};if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};for(var key in defaults){if(opts[key]===undefined){opts[key]=defaults[key]}}if(opts.recurse_count>8){throw new FS.ErrnoError(40)}var parts=PATH.normalizeArray(path.split("/").filter(function(p){return!!p}),false);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(40)}}}}return{path:current_path,node:current}},getPath:function(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:function(parentid,name){var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:function(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:function(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:function(parent,name){var err=FS.mayLookup(parent);if(err){throw new FS.ErrnoError(err,parent)}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:function(parent,name,mode,rdev){if(!FS.FSNode){FS.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};FS.FSNode.prototype={};var readMode=292|73;var writeMode=146;Object.defineProperties(FS.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)}}})}var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:function(node){FS.hashRemoveNode(node)},isRoot:function(node){return node===node.parent},isMountpoint:function(node){return!!node.mounted},isFile:function(mode){return(mode&61440)===32768},isDir:function(mode){return(mode&61440)===16384},isLink:function(mode){return(mode&61440)===40960},isChrdev:function(mode){return(mode&61440)===8192},isBlkdev:function(mode){return(mode&61440)===24576},isFIFO:function(mode){return(mode&61440)===4096},isSocket:function(mode){return(mode&49152)===49152},flagModes:{"r":0,"rs":1052672,"r+":2,"w":577,"wx":705,"xw":705,"w+":578,"wx+":706,"xw+":706,"a":1089,"ax":1217,"xa":1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(str){var flags=FS.flagModes[str];if(typeof flags==="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},flagsToPermissionString:function(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions:function(node,perms){if(FS.ignorePermissions){return 0}if(perms.indexOf("r")!==-1&&!(node.mode&292)){return 13}else if(perms.indexOf("w")!==-1&&!(node.mode&146)){return 13}else if(perms.indexOf("x")!==-1&&!(node.mode&73)){return 13}return 0},mayLookup:function(dir){var err=FS.nodePermissions(dir,"x");if(err)return err;if(!dir.node_ops.lookup)return 13;return 0},mayCreate:function(dir,name){try{var node=FS.lookupNode(dir,name);return 17}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:function(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var err=FS.nodePermissions(dir,"wx");if(err){return err}if(isdir){if(!FS.isDir(node.mode)){return 20}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 16}}else{if(FS.isDir(node.mode)){return 21}}return 0},mayOpen:function(node,flags){if(!node){return 2}if(FS.isLink(node.mode)){return 40}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 21}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:function(fd_start,fd_end){fd_start=fd_start||0;fd_end=fd_end||FS.MAX_OPEN_FDS;for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(24)},getStream:function(fd){return FS.streams[fd]},createStream:function(stream,fd_start,fd_end){if(!FS.FSStream){FS.FSStream=function(){};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}}})}var newStream=new FS.FSStream;for(var p in stream){newStream[p]=stream[p]}stream=newStream;var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:function(fd){FS.streams[fd]=null},chrdev_stream_ops:{open:function(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:function(){throw new FS.ErrnoError(29)}},major:function(dev){return dev>>8},minor:function(dev){return dev&255},makedev:function(ma,mi){return ma<<8|mi},registerDevice:function(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:function(dev){return FS.devices[dev]},getMounts:function(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:function(populate,callback){if(typeof populate==="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){console.log("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(err){FS.syncFSRequests--;return callback(err)}function done(err){if(err){if(!done.errored){done.errored=true;return doCallback(err)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(function(mount){if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:function(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(16)}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(16)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(20)}}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:function(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(22)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.indexOf(current.mount)!==-1){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup:function(parent,name){return parent.node_ops.lookup(parent,name)},mknod:function(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(22)}var err=FS.mayCreate(parent,name);if(err){throw new FS.ErrnoError(err)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(1)}return parent.node_ops.mknod(parent,name,mode,dev)},create:function(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:function(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:function(path,mode){var dirs=path.split("/");var d="";for(var i=0;i"})},staticInit:function(){FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS,"IDBFS":IDBFS,"NODEFS":NODEFS,"WORKERFS":WORKERFS}},init:function(input,output,error){FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:function(){FS.init.initialized=false;var fflush=Module["_fflush"];if(fflush)fflush(0);for(var i=0;ithis.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=function(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);if(typeof Uint8Array!="undefined")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||[])}else{return intArrayFromString(xhr.responseText||"",true)}};var lazyArray=this;lazyArray.setDataGetter(function(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;console.log("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(function(key){var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}return fn.apply(null,arguments)}});stream_ops.read=function stream_ops_read(stream,buffer,offset,length,position){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}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>2]=stat.dev;HEAP32[buf+4>>2]=0;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAP32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;HEAP32[buf+32>>2]=0;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;HEAP32[buf+56>>2]=stat.atime.getTime()/1e3|0;HEAP32[buf+60>>2]=0;HEAP32[buf+64>>2]=stat.mtime.getTime()/1e3|0;HEAP32[buf+68>>2]=0;HEAP32[buf+72>>2]=stat.ctime.getTime()/1e3|0;HEAP32[buf+76>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+80>>2]=tempI64[0],HEAP32[buf+84>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags){var buffer=new Uint8Array(HEAPU8.subarray(addr,addr+len));FS.msync(stream,buffer,0,len,flags)},doMkdir:function(path,mode){path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0},doMknod:function(path,mode,dev){switch(mode&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-22}FS.mknod(path,mode,dev);return 0},doReadlink:function(path,buf,bufsize){if(bufsize<=0)return-22;var ret=FS.readlink(path);var len=Math.min(bufsize,lengthBytesUTF8(ret));var endChar=HEAP8[buf+len];stringToUTF8(ret,buf,bufsize+1);HEAP8[buf+len]=endChar;return len},doAccess:function(path,amode){if(amode&~7){return-22}var node;var lookup=FS.lookupPath(path,{follow:true});node=lookup.node;var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-13}return 0},doDup:function(path,flags,suggestFD){var suggest=FS.getStream(suggestFD);if(suggest)FS.close(suggest);return FS.open(path,flags,0,suggestFD,suggestFD).fd},doReadv:function(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2];var len=HEAP32[iov+(i*8+4)>>2];var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret},varargs:0,get:function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(){var ret=UTF8ToString(SYSCALLS.get());return ret},getStreamFromFD:function(){var stream=FS.getStream(SYSCALLS.get());if(!stream)throw new FS.ErrnoError(9);return stream},get64:function(){var low=SYSCALLS.get(),high=SYSCALLS.get();return low},getZero:function(){SYSCALLS.get()}};function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();if(!(offset_high==-1&&offset_low<0)&&!(offset_high==0&&offset_low>=0)){return-75}var offset=offset_low;FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[result>>2]=tempI64[0],HEAP32[result+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doWritev(stream,iov,iovcnt)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall168(which,varargs){SYSCALLS.varargs=varargs;try{var fds=SYSCALLS.get(),nfds=SYSCALLS.get(),timeout=SYSCALLS.get();var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall195(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall196(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall197(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall221(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),cmd=SYSCALLS.get();switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-22}var newStream;newStream=FS.open(stream.path,stream.flags,0,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.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0;case 16:case 8:return-22;case 9:___setErrNo(22);return-1;default:{return-22}}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall3(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get(),count=SYSCALLS.get();return FS.read(stream,HEAP8,buf,count)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall4(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get(),count=SYSCALLS.get();return FS.write(stream,HEAP8,buf,count)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall41(which,varargs){SYSCALLS.varargs=varargs;try{var old=SYSCALLS.getStreamFromFD();return FS.open(old.path,old.flags,0).fd}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[]};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:FS.modeStringToFlags("r"),seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:FS.modeStringToFlags("w"),seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}else{if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}}return 0},ioctl:function(stream,request,varargs){return ERRNO_CODES.EINVAL},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.buckets=null}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall42(which,varargs){SYSCALLS.varargs=varargs;try{var fdPtr=SYSCALLS.get();if(fdPtr==0){throw new FS.ErrnoError(14)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall5(which,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(),flags=SYSCALLS.get(),mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function _abort(){Module["abort"]()}function _emscripten_get_heap_size(){return HEAP8.length}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function emscripten_realloc_buffer(size){var PAGE_MULTIPLE=65536;size=alignUp(size,PAGE_MULTIPLE);var oldSize=buffer.byteLength;try{var result=wasmMemory.grow((size-oldSize)/65536);if(result!==(-1|0)){buffer=wasmMemory.buffer;return true}else{return false}}catch(e){return false}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT){return false}var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize>2]=(new Date).getTimezoneOffset()*60;var winter=new Date(2e3,0,1);var summer=new Date(2e3,6,1);HEAP32[__get_daylight()>>2]=Number(winter.getTimezoneOffset()!=summer.getTimezoneOffset());function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocate(intArrayFromString(winterName),"i8",ALLOC_NORMAL);var summerNamePtr=allocate(intArrayFromString(summerName),"i8",ALLOC_NORMAL);if(summer.getTimezoneOffset()>2]=winterNamePtr;HEAP32[__get_tzname()+4>>2]=summerNamePtr}else{HEAP32[__get_tzname()>>2]=summerNamePtr;HEAP32[__get_tzname()+4>>2]=winterNamePtr}}function _localtime_r(time,tmPtr){_tzset();var date=new Date(HEAP32[time>>2]*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var start=new Date(date.getFullYear(),0,1);var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var summerOffset=new Date(2e3,6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst;var zonePtr=HEAP32[__get_tzname()+(dst?4:0)>>2];HEAP32[tmPtr+40>>2]=zonePtr;return tmPtr}function _localtime(time){return _localtime_r(time,___tm_current)}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest)}function _mktime(tmPtr){_tzset();var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(2e3,6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;return date.getTime()/1e3|0}function _posix_spawn_file_actions_addclose(){err("missing function: posix_spawn_file_actions_addclose");abort(-1)}function _posix_spawn_file_actions_adddup2(){err("missing function: posix_spawn_file_actions_adddup2");abort(-1)}function _posix_spawn_file_actions_destroy(){err("missing function: posix_spawn_file_actions_destroy");abort(-1)}function _posix_spawn_file_actions_init(){err("missing function: posix_spawn_file_actions_init");abort(-1)}function _fork(){___setErrNo(11);return-1}function _posix_spawnp(){return _fork.apply(null,arguments)}function _timegm(tmPtr){_tzset();var time=Date.UTC(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var date=new Date(time);HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;return date.getTime()/1e3|0}function _wait(stat_loc){___setErrNo(10);return-1}function _waitpid(){return _wait.apply(null,arguments)}FS.staticInit();if(ENVIRONMENT_IS_NODE){var fs=require("fs");var NODEJS_PATH=require("path");NODEFS.staticInit()}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 asmGlobalArg={};var asmLibraryArg={"b":abort,"q":setTempRet0,"G":___buildEnvironment,"l":___setErrNo,"s":___syscall140,"i":___syscall146,"p":___syscall168,"o":___syscall195,"n":___syscall196,"m":___syscall197,"c":___syscall221,"F":___syscall3,"E":___syscall4,"D":___syscall41,"C":___syscall42,"B":___syscall5,"h":___syscall6,"g":_abort,"A":_emscripten_get_heap_size,"z":_emscripten_memcpy_big,"y":_emscripten_resize_heap,"f":_exit,"x":_localtime,"d":_mktime,"e":_posix_spawn_file_actions_addclose,"k":_posix_spawn_file_actions_adddup2,"j":_posix_spawn_file_actions_destroy,"w":_posix_spawn_file_actions_init,"v":_posix_spawnp,"u":_timegm,"t":_waitpid,"r":abortOnCannotGrowMemory,"a":DYNAMICTOP_PTR};var asm=Module["asm"](asmGlobalArg,asmLibraryArg,buffer);Module["asm"]=asm;var ___emscripten_environ_constructor=Module["___emscripten_environ_constructor"]=function(){return Module["asm"]["H"].apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return Module["asm"]["I"].apply(null,arguments)};var __get_daylight=Module["__get_daylight"]=function(){return Module["asm"]["J"].apply(null,arguments)};var __get_timezone=Module["__get_timezone"]=function(){return Module["asm"]["K"].apply(null,arguments)};var __get_tzname=Module["__get_tzname"]=function(){return Module["asm"]["L"].apply(null,arguments)};var _archive_close=Module["_archive_close"]=function(){return Module["asm"]["M"].apply(null,arguments)};var _archive_entry_filetype=Module["_archive_entry_filetype"]=function(){return Module["asm"]["N"].apply(null,arguments)};var _archive_entry_is_encrypted=Module["_archive_entry_is_encrypted"]=function(){return Module["asm"]["O"].apply(null,arguments)};var _archive_entry_pathname=Module["_archive_entry_pathname"]=function(){return Module["asm"]["P"].apply(null,arguments)};var _archive_entry_pathname_utf8=Module["_archive_entry_pathname_utf8"]=function(){return Module["asm"]["Q"].apply(null,arguments)};var _archive_entry_size=Module["_archive_entry_size"]=function(){return Module["asm"]["R"].apply(null,arguments)};var _archive_error_string=Module["_archive_error_string"]=function(){return Module["asm"]["S"].apply(null,arguments)};var _archive_open=Module["_archive_open"]=function(){return Module["asm"]["T"].apply(null,arguments)};var _archive_read_add_passphrase=Module["_archive_read_add_passphrase"]=function(){return Module["asm"]["U"].apply(null,arguments)};var _archive_read_data_skip=Module["_archive_read_data_skip"]=function(){return Module["asm"]["V"].apply(null,arguments)};var _archive_read_has_encrypted_entries=Module["_archive_read_has_encrypted_entries"]=function(){return Module["asm"]["W"].apply(null,arguments)};var _free=Module["_free"]=function(){return Module["asm"]["X"].apply(null,arguments)};var _get_filedata=Module["_get_filedata"]=function(){return Module["asm"]["Y"].apply(null,arguments)};var _get_next_entry=Module["_get_next_entry"]=function(){return Module["asm"]["Z"].apply(null,arguments)};var _get_version=Module["_get_version"]=function(){return Module["asm"]["_"].apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return Module["asm"]["$"].apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return Module["asm"]["ca"].apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return Module["asm"]["da"].apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return Module["asm"]["ea"].apply(null,arguments)};var dynCall_v=Module["dynCall_v"]=function(){return Module["asm"]["aa"].apply(null,arguments)};var dynCall_vi=Module["dynCall_vi"]=function(){return Module["asm"]["ba"].apply(null,arguments)};Module["asm"]=asm;Module["intArrayFromString"]=intArrayFromString;Module["cwrap"]=cwrap;Module["allocate"]=allocate;Module["then"]=function(func){if(Module["calledRun"]){func(Module)}else{var old=Module["onRuntimeInitialized"];Module["onRuntimeInitialized"]=function(){if(old)old();func(Module)}}return Module};function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};function run(args){args=args||Module["arguments"];if(runDependencies>0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]&&status===0){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;exitRuntime();if(Module["onExit"])Module["onExit"](status)}Module["quit"](status,new ExitStatus(status))}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}if(what!==undefined){out(what);err(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info."}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}Module["noExitRuntime"]=true;run();
+
+
+ return libarchive
+}
+);
+})();
+export default libarchive;
\ No newline at end of file
diff --git a/vendor/libarchive/wasm-gen/libarchive.wasm b/vendor/libarchive/wasm-gen/libarchive.wasm
new file mode 100644
index 0000000..aa189c5
Binary files /dev/null and b/vendor/libarchive/wasm-gen/libarchive.wasm differ
diff --git a/vendor/libarchive/worker-bundle.js b/vendor/libarchive/worker-bundle.js
new file mode 100644
index 0000000..3b305aa
--- /dev/null
+++ b/vendor/libarchive/worker-bundle.js
@@ -0,0 +1 @@
+!function(){"use strict";const e={32768:"FILE",16384:"DIR",40960:"SYMBOLIC_LINK",49152:"SOCKET",8192:"CHARACTER_DEVICE",24576:"BLOCK_DEVICE",4096:"NAMED_PIPE"};class r{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._file=null,this._passphrase=null}open(e){null!==this._file&&(console.warn("Closing previous file"),this.close());const{promise:r,resolve:t,reject:n}=this._promiseHandles();this._file=e;const o=new FileReader;return o.onload=(()=>this._loadFile(o.result,t,n)),o.readAsArrayBuffer(e),r}close(){this._runCode.closeArchive(this._archive),this._wasmModule._free(this._filePtr),this._file=null,this._filePtr=null,this._archive=null}hasEncryptedData(){this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase),this._runCode.getNextEntry(this._archive);const e=this._runCode.hasEncryptedEntries(this._archive);return 0!==e&&(e>0||null)}setPassphrase(e){this._passphrase=e}*entries(r=!1,t=null){let n;for(this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase);0!==(n=this._runCode.getNextEntry(this._archive));){const o={size:this._runCode.getEntrySize(n),path:this._runCode.getEntryName(n),type:e[this._runCode.getEntryType(n)],ref:n};if("FILE"===o.type){let e=o.path.split("/");o.fileName=e[e.length-1]}if(r&&t!==o.path)this._runCode.skipEntry(this._archive);else{const e=this._runCode.getFileData(this._archive,o.size);if(e<0)throw new Error(this._runCode.getError(this._archive));o.fileData=this._wasmModule.HEAP8.slice(e,e+o.size),this._wasmModule._free(e)}yield o}}_loadFile(e,r,t){try{const n=new Uint8Array(e);this._fileLength=n.length,this._filePtr=this._runCode.malloc(this._fileLength),this._wasmModule.HEAP8.set(n,this._filePtr),r()}catch(e){t(e)}}_promiseHandles(){let e=null,r=null;return{promise:new Promise((t,n)=>{e=t,r=n}),resolve:e,reject:r}}}var t,n=(t="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e){var r,n=void 0!==(e=e||{})?e:{},o={};for(r in n)n.hasOwnProperty(r)&&(o[r]=n[r]);n.arguments=[],n.thisProgram="./this.program",n.quit=function(e,r){throw r},n.preRun=[],n.postRun=[];var i,a,s=!1,u=!1;s="object"==typeof window,u="function"==typeof importScripts,i="object"==typeof process&&"function"==typeof require&&!s&&!u,a=!s&&!i&&!u;var c,f,l="";i?(l=__dirname+"/",n.read=function(e,r){var t;return c||(c=require("fs")),f||(f=require("path")),e=f.normalize(e),t=c.readFileSync(e),r?t:t.toString()},n.readBinary=function(e){var r=n.read(e,!0);return r.buffer||(r=new Uint8Array(r)),E(r.buffer),r},process.argv.length>1&&(n.thisProgram=process.argv[1].replace(/\\/g,"/")),n.arguments=process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof qe))throw e}),process.on("unhandledRejection",Ze),n.quit=function(e){process.exit(e)},n.inspect=function(){return"[Emscripten Module object]"}):a?("undefined"!=typeof read&&(n.read=function(e){return read(e)}),n.readBinary=function(e){var r;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(E("object"==typeof(r=read(e,"binary"))),r)},"undefined"!=typeof scriptArgs?n.arguments=scriptArgs:void 0!==arguments&&(n.arguments=arguments),"function"==typeof quit&&(n.quit=function(e){quit(e)})):(s||u)&&(u?l=self.location.href:document.currentScript&&(l=document.currentScript.src),t&&(l=t),l=0!==l.indexOf("blob:")?l.substr(0,l.lastIndexOf("/")+1):"",n.read=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},u&&(n.readBinary=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),n.readAsync=function(e,r,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?r(n.response):t()},n.onerror=t,n.send(null)},n.setWindowTitle=function(e){document.title=e});var d=n.print||("undefined"!=typeof console?console.log.bind(console):"undefined"!=typeof print?print:null),p=n.printErr||("undefined"!=typeof printErr?printErr:"undefined"!=typeof console&&console.warn.bind(console)||d);for(r in o)o.hasOwnProperty(r)&&(n[r]=o[r]);function m(e){var r=M[q>>2],t=r+e+15&-16;if(t<=Ae())M[q>>2]=t;else if(!Re(t))return 0;return r}function h(e){switch(e){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:if("*"===e[e.length-1])return 4;if("i"===e[0]){var r=parseInt(e.substr(1));return E(r%8==0,"getNativeTypeSize invalid bits "+r+", type "+e),r/8}return 0}}o=void 0;var v,w={"f64-rem":function(e,r){return e%r},debugger:function(){}};"object"!=typeof WebAssembly&&p("no native wasm support detected");var y=!1;function E(e,r){e||Ze("Assertion failed: "+r)}function g(e){var r=n["_"+e];return E(r,"Cannot call unknown function "+e+", make sure it is exported"),r}function _(e,r,t,n,o){var i={string:function(e){var r=0;if(null!=e&&0!==e){var t=1+(e.length<<2);C(e,r=je(t),t)}return r},array:function(e){var r,t,n=je(e.length);return r=e,t=n,R.set(r,t),n}},a=g(e),s=[],u=0;if(n)for(var c=0;c>0]=r;break;case"i16":P[e>>1]=r;break;case"i32":M[e>>2]=r;break;case"i64":tempI64=[r>>>0,(tempDouble=r,+J(tempDouble)>=1?tempDouble>0?(0|re(+ee(tempDouble/4294967296),4294967295))>>>0:~~+Q((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],M[e>>2]=tempI64[0],M[e+4>>2]=tempI64[1];break;case"float":B[e>>2]=r;break;case"double":N[e>>3]=r;break;default:Ze("invalid type for setValue: "+t)}}var k=0,D=3;function S(e,r,t,n){var o,i;"number"==typeof e?(o=!0,i=e):(o=!1,i=e.length);var a,s="string"==typeof r?r:null;if(a=t==D?n:[Ue,je,m][t](Math.max(i,s?1:r.length)),o){var u;for(n=a,E(0==(3&a)),u=a+(-4&i);n>2]=0;for(u=a+i;n>0]=0;return a}if("i8"===s)return e.subarray||e.slice?T.set(e,a):T.set(new Uint8Array(e),a),a;for(var c,f,l,d=0;d=n);)++o;if(o-r>16&&e.subarray&&O)return O.decode(e.subarray(r,o));for(var i="";r>10,56320|1023&c)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i}function I(e,r){return e?x(T,e,r):""}function z(e,r,t,n){if(!(n>0))return 0;for(var o=t,i=t+n-1,a=0;a=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(t>=i)break;r[t++]=s}else if(s<=2047){if(t+1>=i)break;r[t++]=192|s>>6,r[t++]=128|63&s}else if(s<=65535){if(t+2>=i)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(t+3>=i)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o}function C(e,r,t){return z(e,T,r,t)}function L(e){for(var r=0,t=0;t=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++t)),n<=127?++r:r+=n<=2047?2:n<=65535?3:4}return r}function U(e,r,t){for(var n=0;n>0]=e.charCodeAt(n);t||(R[r>>0]=0)}function j(){var e=function(){var e=new Error;if(!e.stack){try{throw new Error(0)}catch(r){e=r}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}();return n.extraStackTrace&&(e+="\n"+n.extraStackTrace()),e.replace(/__Z[\w\d_]+/g,function(e){var r=e;return e===r?e:r+" ["+e+"]"})}function H(e,r){return e%r>0&&(e+=r-e%r),e}function W(){n.HEAP8=R=new Int8Array(A),n.HEAP16=P=new Int16Array(A),n.HEAP32=M=new Int32Array(A),n.HEAPU8=T=new Uint8Array(A),n.HEAPU16=new Uint16Array(A),n.HEAPU32=new Uint32Array(A),n.HEAPF32=B=new Float32Array(A),n.HEAPF64=N=new Float64Array(A)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var q=277552,K=n.TOTAL_MEMORY||16777216;function Z(e){for(;e.length>0;){var r=e.shift();if("function"!=typeof r){var t=r.func;"number"==typeof t?void 0===r.arg?n.dynCall_v(t):n.dynCall_vi(t,r.arg):t(void 0===r.arg?null:r.arg)}else r()}}K<5242880&&p("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+K+"! (TOTAL_STACK=5242880)"),n.buffer?A=n.buffer:"object"==typeof WebAssembly&&"function"==typeof WebAssembly.Memory?(v=new WebAssembly.Memory({initial:K/65536}),A=v.buffer):A=new ArrayBuffer(K),W(),M[q>>2]=5520464;var V=[],X=[],Y=[],G=[],$=!1,J=Math.abs,Q=Math.ceil,ee=Math.floor,re=Math.min,te=0,ne=null,oe=null;function ie(e){te++,n.monitorRunDependencies&&n.monitorRunDependencies(te)}function ae(e){if(te--,n.monitorRunDependencies&&n.monitorRunDependencies(te),0==te&&(null!==ne&&(clearInterval(ne),ne=null),oe)){var r=oe;oe=null,r()}}n.preloadedImages={},n.preloadedAudios={};var se="data:application/octet-stream;base64,";function ue(e){return String.prototype.startsWith?e.startsWith(se):0===e.indexOf(se)}var ce,fe="libarchive.wasm";function le(){try{if(n.wasmBinary)return new Uint8Array(n.wasmBinary);if(n.readBinary)return n.readBinary(fe);throw"both async and sync fetching of the wasm failed"}catch(e){Ze(e)}}function de(e){var r={env:e,global:{NaN:NaN,Infinity:1/0},"global.Math":Math,asm2wasm:w};function t(e,r){var t=e.exports;n.asm=t,ae()}if(ie(),n.instantiateWasm)try{return n.instantiateWasm(r,t)}catch(e){return p("Module.instantiateWasm callback failed with error: "+e),!1}function o(e){t(e.instance)}function i(e){(n.wasmBinary||!s&&!u||"function"!=typeof fetch?new Promise(function(e,r){e(le())}):fetch(fe,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+fe+"'";return e.arrayBuffer()}).catch(function(){return le()})).then(function(e){return WebAssembly.instantiate(e,r)}).then(e,function(e){p("failed to asynchronously prepare wasm: "+e),Ze(e)})}return n.wasmBinary||"function"!=typeof WebAssembly.instantiateStreaming||ue(fe)||"function"!=typeof fetch?i(o):WebAssembly.instantiateStreaming(fetch(fe,{credentials:"same-origin"}),r).then(o,function(e){p("wasm streaming compile failed: "+e),p("falling back to ArrayBuffer instantiation"),i(o)}),{}}ue(fe)||(ce=fe,fe=n.locateFile?n.locateFile(ce,l):l+ce),n.asm=function(e,r,t){return r.memory=v,r.table=new WebAssembly.Table({initial:507,maximum:507,element:"anyfunc"}),r.__memory_base=1024,r.__table_base=0,de(r)},X.push({func:function(){Ie()}});var pe={},me={splitPath:function(e){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,r){for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:function(e){var r="/"===e.charAt(0),t="/"===e.substr(-1);return(e=me.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:function(e){var r=me.splitPath(e),t=r[0],n=r[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:function(e){if("/"===e)return"/";var r=e.lastIndexOf("/");return-1===r?e:e.substr(r+1)},extname:function(e){return me.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return me.normalize(e.join("/"))},join2:function(e,r){return me.normalize(e+"/"+r)}};function he(e){return n.___errno_location&&(M[n.___errno_location()>>2]=e),e}var ve={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:be.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r="/"===n.charAt(0)}return(r?"/":"")+(e=me.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||"."},relative:function(e,r){function t(e){for(var r=0;r=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=ve.resolve(e).substr(1),r=ve.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.split("/")),i=Math.min(n.length,o.length),a=i,s=0;s0?t.slice(0,n).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(r=window.prompt("Input: "))&&(r+="\n"):"function"==typeof readline&&null!==(r=readline())&&(r+="\n");if(!r)return null;e.input=Ne(r,!0)}return e.input.shift()},put_char:function(e,r){null===r||10===r?(d(x(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},flush:function(e){e.output&&e.output.length>0&&(d(x(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,r){null===r||10===r?(p(x(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},flush:function(e){e.output&&e.output.length>0&&(p(x(e.output,0)),e.output=[])}}},ye={ops_table:null,mount:function(e){return ye.createNode(null,"/",16895,0)},createNode:function(e,r,t,n){if(be.isBlkdev(t)||be.isFIFO(t))throw new be.ErrnoError(1);ye.ops_table||(ye.ops_table={dir:{node:{getattr:ye.node_ops.getattr,setattr:ye.node_ops.setattr,lookup:ye.node_ops.lookup,mknod:ye.node_ops.mknod,rename:ye.node_ops.rename,unlink:ye.node_ops.unlink,rmdir:ye.node_ops.rmdir,readdir:ye.node_ops.readdir,symlink:ye.node_ops.symlink},stream:{llseek:ye.stream_ops.llseek}},file:{node:{getattr:ye.node_ops.getattr,setattr:ye.node_ops.setattr},stream:{llseek:ye.stream_ops.llseek,read:ye.stream_ops.read,write:ye.stream_ops.write,allocate:ye.stream_ops.allocate,mmap:ye.stream_ops.mmap,msync:ye.stream_ops.msync}},link:{node:{getattr:ye.node_ops.getattr,setattr:ye.node_ops.setattr,readlink:ye.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ye.node_ops.getattr,setattr:ye.node_ops.setattr},stream:be.chrdev_stream_ops}});var o=be.createNode(e,r,t,n);return be.isDir(o.mode)?(o.node_ops=ye.ops_table.dir.node,o.stream_ops=ye.ops_table.dir.stream,o.contents={}):be.isFile(o.mode)?(o.node_ops=ye.ops_table.file.node,o.stream_ops=ye.ops_table.file.stream,o.usedBytes=0,o.contents=null):be.isLink(o.mode)?(o.node_ops=ye.ops_table.link.node,o.stream_ops=ye.ops_table.link.stream):be.isChrdev(o.mode)&&(o.node_ops=ye.ops_table.chrdev.node,o.stream_ops=ye.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o),o},getFileDataAsRegularArray:function(e){if(e.contents&&e.contents.subarray){for(var r=[],t=0;t=r)){r=Math.max(r,t*(t<1048576?2:1.125)|0),0!=t&&(r=Math.max(r,256));var n=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,r){if(e.usedBytes!=r){if(0==r)return e.contents=null,void(e.usedBytes=0);if(!e.contents||e.contents.subarray){var t=e.contents;return e.contents=new Uint8Array(new ArrayBuffer(r)),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),void(e.usedBytes=r)}if(e.contents||(e.contents=[]),e.contents.length>r)e.contents.length=r;else for(;e.contents.length=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-o,n);if(a>8&&i.subarray)r.set(i.subarray(o,o+a),t);else for(var s=0;s0||o+na.timestamp)&&(o.push(t),n++)});var i=[];if(Object.keys(r.entries).forEach(function(t){r.entries[t],e.entries[t]||(i.push(t),n++)}),!n)return t(null);var a=0,s=("remote"===e.type?e.db:r.db).transaction([Ee.DB_STORE_NAME],"readwrite"),u=s.objectStore(Ee.DB_STORE_NAME);function c(e){return e?c.errored?void 0:(c.errored=!0,t(e)):++a>=n?t(null):void 0}s.onerror=function(e){c(this.error),e.preventDefault()},o.sort().forEach(function(e){"local"===r.type?Ee.loadRemoteEntry(u,e,function(r,t){if(r)return c(r);Ee.storeLocalEntry(e,t,c)}):Ee.loadLocalEntry(e,function(r,t){if(r)return c(r);Ee.storeRemoteEntry(u,e,t,c)})}),i.sort().reverse().forEach(function(e){"local"===r.type?Ee.removeLocalEntry(e,c):Ee.removeRemoteEntry(u,e,c)})}},ge={isWindows:!1,staticInit:function(){ge.isWindows=!!process.platform.match(/^win/);var e=process.binding("constants");e.fs&&(e=e.fs),ge.flagsForNodeMap={1024:e.O_APPEND,64:e.O_CREAT,128:e.O_EXCL,0:e.O_RDONLY,2:e.O_RDWR,4096:e.O_SYNC,512:e.O_TRUNC,1:e.O_WRONLY}},bufferFrom:function(e){return Buffer.alloc?Buffer.from(e):new Buffer(e)},mount:function(e){return E(i),ge.createNode(null,"/",ge.getMode(e.opts.root),0)},createNode:function(e,r,t,n){if(!be.isDir(t)&&!be.isFile(t)&&!be.isLink(t))throw new be.ErrnoError(22);var o=be.createNode(e,r,t);return o.node_ops=ge.node_ops,o.stream_ops=ge.stream_ops,o},getMode:function(e){var r;try{r=Me.lstatSync(e),ge.isWindows&&(r.mode=r.mode|(292&r.mode)>>2)}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}return r.mode},realPath:function(e){for(var r=[];e.parent!==e;)r.push(e.name),e=e.parent;return r.push(e.mount.opts.root),r.reverse(),me.join.apply(null,r)},flagsForNode:function(e){e&=-2097153,e&=-2049,e&=-32769,e&=-524289;var r=0;for(var t in ge.flagsForNodeMap)e&t&&(r|=ge.flagsForNodeMap[t],e^=t);if(e)throw new be.ErrnoError(22);return r},node_ops:{getattr:function(e){var r,t=ge.realPath(e);try{r=Me.lstatSync(t)}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}return ge.isWindows&&!r.blksize&&(r.blksize=4096),ge.isWindows&&!r.blocks&&(r.blocks=(r.size+r.blksize-1)/r.blksize|0),{dev:r.dev,ino:r.ino,mode:r.mode,nlink:r.nlink,uid:r.uid,gid:r.gid,rdev:r.rdev,size:r.size,atime:r.atime,mtime:r.mtime,ctime:r.ctime,blksize:r.blksize,blocks:r.blocks}},setattr:function(e,r){var t=ge.realPath(e);try{if(void 0!==r.mode&&(Me.chmodSync(t,r.mode),e.mode=r.mode),void 0!==r.timestamp){var n=new Date(r.timestamp);Me.utimesSync(t,n,n)}void 0!==r.size&&Me.truncateSync(t,r.size)}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}},lookup:function(e,r){var t=me.join2(ge.realPath(e),r),n=ge.getMode(t);return ge.createNode(e,r,n)},mknod:function(e,r,t,n){var o=ge.createNode(e,r,t,n),i=ge.realPath(o);try{be.isDir(o.mode)?Me.mkdirSync(i,o.mode):Me.writeFileSync(i,"",{mode:o.mode})}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}return o},rename:function(e,r,t){var n=ge.realPath(e),o=me.join2(ge.realPath(r),t);try{Me.renameSync(n,o)}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}},unlink:function(e,r){var t=me.join2(ge.realPath(e),r);try{Me.unlinkSync(t)}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}},rmdir:function(e,r){var t=me.join2(ge.realPath(e),r);try{Me.rmdirSync(t)}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}},readdir:function(e){var r=ge.realPath(e);try{return Me.readdirSync(r)}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}},symlink:function(e,r,t){var n=me.join2(ge.realPath(e),r);try{Me.symlinkSync(t,n)}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}},readlink:function(e){var r=ge.realPath(e);try{return r=Me.readlinkSync(r),r=Be.relative(Be.resolve(e.mount.opts.root),r)}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}}},stream_ops:{open:function(e){var r=ge.realPath(e.node);try{be.isFile(e.node.mode)&&(e.nfd=Me.openSync(r,ge.flagsForNode(e.flags)))}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}},close:function(e){try{be.isFile(e.node.mode)&&e.nfd&&Me.closeSync(e.nfd)}catch(e){if(!e.code)throw e;throw new be.ErrnoError(-e.errno)}},read:function(e,r,t,n,o){if(0===n)return 0;try{return Me.readSync(e.nfd,ge.bufferFrom(r.buffer),t,n,o)}catch(e){throw new be.ErrnoError(-e.errno)}},write:function(e,r,t,n,o){try{return Me.writeSync(e.nfd,ge.bufferFrom(r.buffer),t,n,o)}catch(e){throw new be.ErrnoError(-e.errno)}},llseek:function(e,r,t){var n=r;if(1===t)n+=e.position;else if(2===t&&be.isFile(e.node.mode))try{n+=Me.fstatSync(e.nfd).size}catch(e){throw new be.ErrnoError(-e.errno)}if(n<0)throw new be.ErrnoError(22);return n}}},_e={DIR_MODE:16895,FILE_MODE:33279,reader:null,mount:function(e){E(u),_e.reader||(_e.reader=new FileReaderSync);var r=_e.createNode(null,"/",_e.DIR_MODE,0),t={};function n(e){for(var n=e.split("/"),o=r,i=0;i=e.node.size)return 0;var i=e.node.contents.slice(o,o+n),a=_e.reader.readAsArrayBuffer(i);return r.set(new Uint8Array(a),t),i.size},write:function(e,r,t,n,o){throw new be.ErrnoError(5)},llseek:function(e,r,t){var n=r;if(1===t?n+=e.position:2===t&&be.isFile(e.node.mode)&&(n+=e.node.size),n<0)throw new be.ErrnoError(22);return n}}},be={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof be.ErrnoError))throw e+" : "+j();return he(e.errno)},lookupPath:function(e,r){if(r=r||{},!(e=ve.resolve(be.cwd(),e)))return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};for(var n in t)void 0===r[n]&&(r[n]=t[n]);if(r.recurse_count>8)throw new be.ErrnoError(40);for(var o=me.normalizeArray(e.split("/").filter(function(e){return!!e}),!1),i=be.root,a="/",s=0;s40)throw new be.ErrnoError(40)}}return{path:a,node:i}},getPath:function(e){for(var r;;){if(be.isRoot(e)){var t=e.mount.mountpoint;return r?"/"!==t[t.length-1]?t+"/"+r:t+r:t}r=r?e.name+"/"+r:e.name,e=e.parent}},hashName:function(e,r){for(var t=0,n=0;n>>0)%be.nameTable.length},hashAddNode:function(e){var r=be.hashName(e.parent.id,e.name);e.name_next=be.nameTable[r],be.nameTable[r]=e},hashRemoveNode:function(e){var r=be.hashName(e.parent.id,e.name);if(be.nameTable[r]===e)be.nameTable[r]=e.name_next;else for(var t=be.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:function(e,r){var t=be.mayLookup(e);if(t)throw new be.ErrnoError(t,e);for(var n=be.hashName(e.id,r),o=be.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===r)return o}return be.lookup(e,r)},createNode:function(e,r,t,n){be.FSNode||(be.FSNode=function(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=be.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n},be.FSNode.prototype={},Object.defineProperties(be.FSNode.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return be.isDir(this.mode)}},isDevice:{get:function(){return be.isChrdev(this.mode)}}}));var o=new be.FSNode(e,r,t,n);return be.hashAddNode(o),o},destroyNode:function(e){be.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return 49152==(49152&e)},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(e){var r=be.flagModes[e];if(void 0===r)throw new Error("Unknown file open mode: "+e);return r},flagsToPermissionString:function(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:function(e,r){return be.ignorePermissions?0:(-1===r.indexOf("r")||292&e.mode)&&(-1===r.indexOf("w")||146&e.mode)&&(-1===r.indexOf("x")||73&e.mode)?0:13},mayLookup:function(e){var r=be.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:13)},mayCreate:function(e,r){try{return be.lookupNode(e,r),17}catch(e){}return be.nodePermissions(e,"wx")},mayDelete:function(e,r,t){var n;try{n=be.lookupNode(e,r)}catch(e){return e.errno}var o=be.nodePermissions(e,"wx");if(o)return o;if(t){if(!be.isDir(n.mode))return 20;if(be.isRoot(n)||be.getPath(n)===be.cwd())return 16}else if(be.isDir(n.mode))return 21;return 0},mayOpen:function(e,r){return e?be.isLink(e.mode)?40:be.isDir(e.mode)&&("r"!==be.flagsToPermissionString(r)||512&r)?21:be.nodePermissions(e,be.flagsToPermissionString(r)):2},MAX_OPEN_FDS:4096,nextfd:function(e,r){e=e||0,r=r||be.MAX_OPEN_FDS;for(var t=e;t<=r;t++)if(!be.streams[t])return t;throw new be.ErrnoError(24)},getStream:function(e){return be.streams[e]},createStream:function(e,r,t){be.FSStream||(be.FSStream=function(){},be.FSStream.prototype={},Object.defineProperties(be.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}}));var n=new be.FSStream;for(var o in e)n[o]=e[o];e=n;var i=be.nextfd(r,t);return e.fd=i,be.streams[i]=e,e},closeStream:function(e){be.streams[e]=null},chrdev_stream_ops:{open:function(e){var r=be.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new be.ErrnoError(29)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,r){return e<<8|r},registerDevice:function(e,r){be.devices[e]={stream_ops:r}},getDevice:function(e){return be.devices[e]},getMounts:function(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:function(e,r){"function"==typeof e&&(r=e,e=!1),be.syncFSRequests++,be.syncFSRequests>1&&console.log("warning: "+be.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var t=be.getMounts(be.root.mount),n=0;function o(e){return be.syncFSRequests--,r(e)}function i(e){if(e)return i.errored?void 0:(i.errored=!0,o(e));++n>=t.length&&o(null)}t.forEach(function(r){if(!r.type.syncfs)return i(null);r.type.syncfs(r,e,i)})},mount:function(e,r,t){var n,o="/"===t,i=!t;if(o&&be.root)throw new be.ErrnoError(16);if(!o&&!i){var a=be.lookupPath(t,{follow_mount:!1});if(t=a.path,n=a.node,be.isMountpoint(n))throw new be.ErrnoError(16);if(!be.isDir(n.mode))throw new be.ErrnoError(20)}var s={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?be.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount:function(e){var r=be.lookupPath(e,{follow_mount:!1});if(!be.isMountpoint(r.node))throw new be.ErrnoError(22);var t=r.node,n=t.mounted,o=be.getMounts(n);Object.keys(be.nameTable).forEach(function(e){for(var r=be.nameTable[e];r;){var t=r.name_next;-1!==o.indexOf(r.mount)&&be.destroyNode(r),r=t}}),t.mounted=null;var i=t.mount.mounts.indexOf(n);t.mount.mounts.splice(i,1)},lookup:function(e,r){return e.node_ops.lookup(e,r)},mknod:function(e,r,t){var n=be.lookupPath(e,{parent:!0}).node,o=me.basename(e);if(!o||"."===o||".."===o)throw new be.ErrnoError(22);var i=be.mayCreate(n,o);if(i)throw new be.ErrnoError(i);if(!n.node_ops.mknod)throw new be.ErrnoError(1);return n.node_ops.mknod(n,o,r,t)},create:function(e,r){return r=void 0!==r?r:438,r&=4095,r|=32768,be.mknod(e,r,0)},mkdir:function(e,r){return r=void 0!==r?r:511,r&=1023,r|=16384,be.mknod(e,r,0)},mkdirTree:function(e,r){for(var t=e.split("/"),n="",o=0;o"}))},staticInit:function(){be.ensureErrnoError(),be.nameTable=new Array(4096),be.mount(ye,{},"/"),be.createDefaultDirectories(),be.createDefaultDevices(),be.createSpecialDirectories(),be.filesystems={MEMFS:ye,IDBFS:Ee,NODEFS:ge,WORKERFS:_e}},init:function(e,r,t){be.init.initialized=!0,be.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=r||n.stdout,n.stderr=t||n.stderr,be.createStandardStreams()},quit:function(){be.init.initialized=!1;var e=n._fflush;e&&e(0);for(var r=0;rthis.length-1||e<0)){var r=e%this.chunkSize,t=e/this.chunkSize|0;return this.getter(t)[r]}},i.prototype.setDataGetter=function(e){this.getter=e},i.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",t,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+t+". Status: "+e.status);var r,n=Number(e.getResponseHeader("Content-length")),o=(r=e.getResponseHeader("Accept-Ranges"))&&"bytes"===r,i=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,a=1048576;o||(a=n);var s=this;s.setDataGetter(function(e){var r=e*a,o=(e+1)*a-1;if(o=Math.min(o,n-1),void 0===s.chunks[e]&&(s.chunks[e]=function(e,r){if(e>r)throw new Error("invalid range ("+e+", "+r+") or no bytes requested!");if(r>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",t,!1),n!==a&&o.setRequestHeader("Range","bytes="+e+"-"+r),"undefined"!=typeof Uint8Array&&(o.responseType="arraybuffer"),o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+t+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):Ne(o.responseText||"",!0)}(r,o)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]}),!i&&n||(a=n=1,n=this.getter(0).length,a=n,console.log("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new i;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:a}}else s={isDevice:!1,url:t};var c=be.createFile(e,r,s,n,o);s.contents?c.contents=s.contents:s.url&&(c.contents=null,c.url=s.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var f={};return Object.keys(c.stream_ops).forEach(function(e){var r=c.stream_ops[e];f[e]=function(){if(!be.forceLoadFile(c))throw new be.ErrnoError(5);return r.apply(null,arguments)}}),f.read=function(e,r,t,n,o){if(!be.forceLoadFile(c))throw new be.ErrnoError(5);var i=e.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,n);if(i.slice)for(var s=0;s>2]=n.dev,M[t+4>>2]=0,M[t+8>>2]=n.ino,M[t+12>>2]=n.mode,M[t+16>>2]=n.nlink,M[t+20>>2]=n.uid,M[t+24>>2]=n.gid,M[t+28>>2]=n.rdev,M[t+32>>2]=0,tempI64=[n.size>>>0,(tempDouble=n.size,+J(tempDouble)>=1?tempDouble>0?(0|re(+ee(tempDouble/4294967296),4294967295))>>>0:~~+Q((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],M[t+40>>2]=tempI64[0],M[t+44>>2]=tempI64[1],M[t+48>>2]=4096,M[t+52>>2]=n.blocks,M[t+56>>2]=n.atime.getTime()/1e3|0,M[t+60>>2]=0,M[t+64>>2]=n.mtime.getTime()/1e3|0,M[t+68>>2]=0,M[t+72>>2]=n.ctime.getTime()/1e3|0,M[t+76>>2]=0,tempI64=[n.ino>>>0,(tempDouble=n.ino,+J(tempDouble)>=1?tempDouble>0?(0|re(+ee(tempDouble/4294967296),4294967295))>>>0:~~+Q((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],M[t+80>>2]=tempI64[0],M[t+84>>2]=tempI64[1],0},doMsync:function(e,r,t,n){var o=new Uint8Array(T.subarray(e,e+t));be.msync(r,o,0,t,n)},doMkdir:function(e,r){return"/"===(e=me.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),be.mkdir(e,r,0),0},doMknod:function(e,r,t){switch(61440&r){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-22}return be.mknod(e,r,t),0},doReadlink:function(e,r,t){if(t<=0)return-22;var n=be.readlink(e),o=Math.min(t,L(n)),i=R[r+o];return C(n,r,t+1),R[r+o]=i,o},doAccess:function(e,r){if(-8&r)return-22;var t;t=be.lookupPath(e,{follow:!0}).node;var n="";return 4&r&&(n+="r"),2&r&&(n+="w"),1&r&&(n+="x"),n&&be.nodePermissions(t,n)?-13:0},doDup:function(e,r,t){var n=be.getStream(t);return n&&be.close(n),be.open(e,r,0,t,t).fd},doReadv:function(e,r,t,n){for(var o=0,i=0;i>2],s=M[r+(8*i+4)>>2],u=be.read(e,R,a,s,n);if(u<0)return-1;if(o+=u,u>2],s=M[r+(8*i+4)>>2],u=be.write(e,R,a,s,n);if(u<0)return-1;o+=u}return o},varargs:0,get:function(e){return ke.varargs+=4,M[ke.varargs-4>>2]},getStr:function(){return I(ke.get())},getStreamFromFD:function(){var e=be.getStream(ke.get());if(!e)throw new be.ErrnoError(9);return e},get64:function(){var e=ke.get();return ke.get(),e},getZero:function(){ke.get()}},De=11,Se=22,Fe={BUCKET_BUFFER_SIZE:8192,mount:function(e){return be.createNode(null,"/",16895,0)},createPipe:function(){var e={buckets:[]};e.buckets.push({buffer:new Uint8Array(Fe.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var r=Fe.nextname(),t=Fe.nextname(),n=be.createNode(Fe.root,r,4096,0),o=be.createNode(Fe.root,t,4096,0);n.pipe=e,o.pipe=e;var i=be.createStream({path:r,node:n,flags:be.modeStringToFlags("r"),seekable:!1,stream_ops:Fe.stream_ops});n.stream=i;var a=be.createStream({path:t,node:o,flags:be.modeStringToFlags("w"),seekable:!1,stream_ops:Fe.stream_ops});return o.stream=a,{readable_fd:i.fd,writable_fd:a.fd}},stream_ops:{poll:function(e){var r=e.node.pipe;if(1==(2097155&e.flags))return 260;if(r.buckets.length>0)for(var t=0;t0)return 65}return 0},ioctl:function(e,r,t){return Se},read:function(e,r,t,n,o){for(var i=e.node.pipe,a=0,s=0;s=s)return u.buffer.set(a,u.offset),u.offset+=s,s;c>0&&(u.buffer.set(a.subarray(0,c),u.offset),u.offset+=c,a=a.subarray(c,a.byteLength));for(var f=a.byteLength/Fe.BUCKET_BUFFER_SIZE|0,l=a.byteLength%Fe.BUCKET_BUFFER_SIZE,d=0;d0&&(p={buffer:new Uint8Array(Fe.BUCKET_BUFFER_SIZE),offset:a.byteLength,roffset:0},i.buckets.push(p),p.buffer.set(a)),s},close:function(e){e.node.pipe.buckets=null}},nextname:function(){return Fe.nextname.current||(Fe.nextname.current=0),"pipe["+Fe.nextname.current+++"]"}};function Ae(){return R.length}function Re(e){var r=Ae();if(e>2147418112)return!1;for(var t=Math.max(r,16777216);t>2]=60*(new Date).getTimezoneOffset();var e=new Date(2e3,0,1),r=new Date(2e3,6,1);M[ze()>>2]=Number(e.getTimezoneOffset()!=r.getTimezoneOffset());var t=a(e),n=a(r),o=S(Ne(t),"i8",k),i=S(Ne(n),"i8",k);r.getTimezoneOffset()>2]=o,M[Le()+4>>2]=i):(M[Le()>>2]=i,M[Le()+4>>2]=o)}function a(e){var r=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return r?r[1]:"GMT"}}if(C("GMT",277456,4),be.staticInit(),i){var Me=require("fs"),Be=require("path");ge.staticInit()}function Ne(e,r,t){var n=t>0?t:L(e)+1,o=new Array(n),i=z(e,o,0,o.length);return r&&(o.length=i),o}var Oe={b:Ze,q:function(e){},G:function e(r){var t,o;e.called?(o=M[r>>2],t=M[o>>2]):(e.called=!0,pe.USER=pe.LOGNAME="web_user",pe.PATH="/",pe.PWD="/",pe.HOME="/home/web_user",pe.LANG="C.UTF-8",pe._=n.thisProgram,t=F(1024),o=F(256),M[o>>2]=t,M[r>>2]=o);var i=[],a=0;for(var s in pe)if("string"==typeof pe[s]){var u=s+"="+pe[s];i.push(u),a+=u.length}if(a>1024)throw new Error("Environment size exceeded TOTAL_ENV_SIZE!");for(var c=0;c>2]=t,t+=u.length+1;M[o+4*i.length>>2]=0},l:he,s:function(e,r){ke.varargs=r;try{var t=ke.getStreamFromFD(),n=ke.get(),o=ke.get(),i=ke.get(),a=ke.get();if(!(-1==n&&o<0||0==n&&o>=0))return-75;var s=o;return be.llseek(t,s,a),tempI64=[t.position>>>0,(tempDouble=t.position,+J(tempDouble)>=1?tempDouble>0?(0|re(+ee(tempDouble/4294967296),4294967295))>>>0:~~+Q((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],M[i>>2]=tempI64[0],M[i+4>>2]=tempI64[1],t.getdents&&0===s&&0===a&&(t.getdents=null),0}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},i:function(e,r){ke.varargs=r;try{var t=ke.getStreamFromFD(),n=ke.get(),o=ke.get();return ke.doWritev(t,n,o)}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},p:function(e,r){ke.varargs=r;try{for(var t=ke.get(),n=ke.get(),o=(ke.get(),0),i=0;i>2],u=P[a+4>>1],c=32,f=be.getStream(s);f&&(c=ke.DEFAULT_POLLMASK,f.stream_ops.poll&&(c=f.stream_ops.poll(f))),(c&=24|u)&&o++,P[a+6>>1]=c}return o}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},o:function(e,r){ke.varargs=r;try{var t=ke.getStr(),n=ke.get();return ke.doStat(be.stat,t,n)}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},n:function(e,r){ke.varargs=r;try{var t=ke.getStr(),n=ke.get();return ke.doStat(be.lstat,t,n)}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},m:function(e,r){ke.varargs=r;try{var t=ke.getStreamFromFD(),n=ke.get();return ke.doStat(be.stat,t.path,n)}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},c:function(e,r){ke.varargs=r;try{var t=ke.getStreamFromFD();switch(ke.get()){case 0:return(n=ke.get())<0?-22:be.open(t.path,t.flags,0,n).fd;case 1:case 2:return 0;case 3:return t.flags;case 4:var n=ke.get();return t.flags|=n,0;case 12:return n=ke.get(),P[n+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-22;case 9:return he(22),-1;default:return-22}}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},F:function(e,r){ke.varargs=r;try{var t=ke.getStreamFromFD(),n=ke.get(),o=ke.get();return be.read(t,R,n,o)}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},E:function(e,r){ke.varargs=r;try{var t=ke.getStreamFromFD(),n=ke.get(),o=ke.get();return be.write(t,R,n,o)}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},D:function(e,r){ke.varargs=r;try{var t=ke.getStreamFromFD();return be.open(t.path,t.flags,0).fd}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},C:function(e,r){ke.varargs=r;try{var t=ke.get();if(0==t)throw new be.ErrnoError(14);var n=Fe.createPipe();return M[t>>2]=n.readable_fd,M[t+4>>2]=n.writable_fd,0}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},B:function(e,r){ke.varargs=r;try{var t=ke.getStr(),n=ke.get(),o=ke.get();return be.open(t,n,o).fd}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},h:function(e,r){ke.varargs=r;try{var t=ke.getStreamFromFD();return be.close(t),0}catch(e){return void 0!==be&&e instanceof be.ErrnoError||Ze(e),-e.errno}},g:function(){n.abort()},A:Ae,z:function(e,r,t){T.set(T.subarray(r,r+t),e)},y:Re,f:function(e){!function(e,r){r&&n.noExitRuntime&&0===e||(n.noExitRuntime||(y=!0,n.onExit&&n.onExit(e)),n.quit(e,new qe(e)))}(e)},x:function(e){return function(e,r){Pe();var t=new Date(1e3*M[e>>2]);M[r>>2]=t.getSeconds(),M[r+4>>2]=t.getMinutes(),M[r+8>>2]=t.getHours(),M[r+12>>2]=t.getDate(),M[r+16>>2]=t.getMonth(),M[r+20>>2]=t.getFullYear()-1900,M[r+24>>2]=t.getDay();var n=new Date(t.getFullYear(),0,1),o=(t.getTime()-n.getTime())/864e5|0;M[r+28>>2]=o,M[r+36>>2]=-60*t.getTimezoneOffset();var i=new Date(2e3,6,1).getTimezoneOffset(),a=n.getTimezoneOffset(),s=0|(i!=a&&t.getTimezoneOffset()==Math.min(a,i));M[r+32>>2]=s;var u=M[Le()+(s?4:0)>>2];return M[r+40>>2]=u,r}(e,Te)},d:function(e){Pe();var r=new Date(M[e+20>>2]+1900,M[e+16>>2],M[e+12>>2],M[e+8>>2],M[e+4>>2],M[e>>2],0),t=M[e+32>>2],n=r.getTimezoneOffset(),o=new Date(r.getFullYear(),0,1),i=new Date(2e3,6,1).getTimezoneOffset(),a=o.getTimezoneOffset(),s=Math.min(a,i);if(t<0)M[e+32>>2]=Number(i!=a&&s==n);else if(t>0!=(s==n)){var u=Math.max(a,i),c=t>0?s:u;r.setTime(r.getTime()+6e4*(c-n))}M[e+24>>2]=r.getDay();var f=(r.getTime()-o.getTime())/864e5|0;return M[e+28>>2]=f,r.getTime()/1e3|0},e:function(){p("missing function: posix_spawn_file_actions_addclose"),Ze(-1)},k:function(){p("missing function: posix_spawn_file_actions_adddup2"),Ze(-1)},j:function(){p("missing function: posix_spawn_file_actions_destroy"),Ze(-1)},w:function(){p("missing function: posix_spawn_file_actions_init"),Ze(-1)},v:function(){return function(){return he(11),-1}.apply(null,arguments)},u:function(e){Pe();var r=Date.UTC(M[e+20>>2]+1900,M[e+16>>2],M[e+12>>2],M[e+8>>2],M[e+4>>2],M[e>>2],0),t=new Date(r);M[e+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),o=(t.getTime()-n)/864e5|0;return M[e+28>>2]=o,t.getTime()/1e3|0},t:function(){return function(e){return he(10),-1}.apply(null,arguments)},r:function(e){Ze("OOM")},a:q},xe=n.asm({},Oe,A);n.asm=xe;var Ie=n.___emscripten_environ_constructor=function(){return n.asm.H.apply(null,arguments)},ze=(n.___errno_location=function(){return n.asm.I.apply(null,arguments)},n.__get_daylight=function(){return n.asm.J.apply(null,arguments)}),Ce=n.__get_timezone=function(){return n.asm.K.apply(null,arguments)},Le=n.__get_tzname=function(){return n.asm.L.apply(null,arguments)},Ue=(n._archive_close=function(){return n.asm.M.apply(null,arguments)},n._archive_entry_filetype=function(){return n.asm.N.apply(null,arguments)},n._archive_entry_is_encrypted=function(){return n.asm.O.apply(null,arguments)},n._archive_entry_pathname=function(){return n.asm.P.apply(null,arguments)},n._archive_entry_pathname_utf8=function(){return n.asm.Q.apply(null,arguments)},n._archive_entry_size=function(){return n.asm.R.apply(null,arguments)},n._archive_error_string=function(){return n.asm.S.apply(null,arguments)},n._archive_open=function(){return n.asm.T.apply(null,arguments)},n._archive_read_add_passphrase=function(){return n.asm.U.apply(null,arguments)},n._archive_read_data_skip=function(){return n.asm.V.apply(null,arguments)},n._archive_read_has_encrypted_entries=function(){return n.asm.W.apply(null,arguments)},n._free=function(){return n.asm.X.apply(null,arguments)},n._get_filedata=function(){return n.asm.Y.apply(null,arguments)},n._get_next_entry=function(){return n.asm.Z.apply(null,arguments)},n._get_version=function(){return n.asm._.apply(null,arguments)},n._malloc=function(){return n.asm.$.apply(null,arguments)}),je=n.stackAlloc=function(){return n.asm.ca.apply(null,arguments)},He=n.stackRestore=function(){return n.asm.da.apply(null,arguments)},We=n.stackSave=function(){return n.asm.ea.apply(null,arguments)};function qe(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Ke(e){function r(){n.calledRun||(n.calledRun=!0,y||($||($=!0,n.noFSInit||be.init.initialized||be.init(),Fe.root=be.mount(Fe,{},null),Z(X)),be.ignorePermissions=!1,Z(Y),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),G.unshift(e);var e;Z(G)}()))}e=e||n.arguments,te>0||(function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)e=n.preRun.shift(),V.unshift(e);var e;Z(V)}(),te>0||n.calledRun||(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),r()},1)):r()))}function Ze(e){throw n.onAbort&&n.onAbort(e),void 0!==e?(d(e),p(e),e=JSON.stringify(e)):e="",y=!0,"abort("+e+"). Build with -s ASSERTIONS=1 for more info."}if(n.dynCall_v=function(){return n.asm.aa.apply(null,arguments)},n.dynCall_vi=function(){return n.asm.ba.apply(null,arguments)},n.asm=xe,n.intArrayFromString=Ne,n.cwrap=function(e,r,t,n){var o=(t=t||[]).every(function(e){return"number"===e});return"string"!==r&&o&&!n?g(e):function(){return _(e,r,t,arguments)}},n.allocate=S,n.then=function(e){if(n.calledRun)e(n);else{var r=n.onRuntimeInitialized;n.onRuntimeInitialized=function(){r&&r(),e(n)}}return n},qe.prototype=new Error,qe.prototype.constructor=qe,oe=function e(){n.calledRun||Ke(),n.calledRun||(oe=e)},n.run=Ke,n.abort=Ze,n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return n.noExitRuntime=!0,Ke(),e});class o{constructor(){this.preRun=[],this.postRun=[],this.totalDependencies=0}print(...e){console.log(e)}printErr(...e){console.error(e)}initFunctions(){this.runCode={getVersion:this.cwrap("get_version","string",[]),openArchive:this.cwrap("archive_open","number",["number","number","string"]),getNextEntry:this.cwrap("get_next_entry","number",["number"]),getFileData:this.cwrap("get_filedata","number",["number","number"]),skipEntry:this.cwrap("archive_read_data_skip","number",["number"]),closeArchive:this.cwrap("archive_close",null,["number"]),getEntrySize:this.cwrap("archive_entry_size","number",["number"]),getEntryName:this.cwrap("archive_entry_pathname","string",["number"]),getEntryType:this.cwrap("archive_entry_filetype","number",["number"]),getError:this.cwrap("archive_error_string","string",["number"]),entryIsEncrypted:this.cwrap("archive_entry_is_encrypted","number",["number"]),hasEncryptedEntries:this.cwrap("archive_read_has_encrypted_entries","number",["number"]),addPassphrase:this.cwrap("archive_read_add_passphrase","number",["number","string"]),string:e=>this.allocate(this.intArrayFromString(e),"i8",0),malloc:this.cwrap("malloc","number",["number"]),free:this.cwrap("free",null,["number"])}}monitorRunDependencies(){}locateFile(e){return`wasm-gen/${e}`}}let i=null,a=!1;var s;s=(e=>{i=new r(e),a=!1,self.postMessage({type:"READY"})}),n(new o).then(e=>{e.initFunctions(),s(e)}),self.onmessage=(async({data:e})=>{if(a)return void self.postMessage({type:"BUSY"});let r=!1;a=!0;try{switch(e.type){case"HELLO":break;case"OPEN":await i.open(e.file),self.postMessage({type:"OPENED"});break;case"LIST_FILES":r=!0;case"EXTRACT_FILES":for(const e of i.entries(r))self.postMessage({type:"ENTRY",entry:e});self.postMessage({type:"END"});break;case"EXTRACT_SINGLE_FILE":for(const r of i.entries(!0,e.target))r.fileData&&self.postMessage({type:"FILE",entry:r});break;case"CHECK_ENCRYPTION":self.postMessage({type:"ENCRYPTION_STATUS",status:i.hasEncryptedData()});break;case"SET_PASSPHRASE":i.setPassphrase(e.passphrase),self.postMessage({type:"PASSPHRASE_STATUS",status:!0});break;default:throw new Error("Invalid Command")}}catch(e){self.postMessage({type:"ERROR",error:{message:e.message,name:e.name,stack:e.stack}})}finally{a=!1}})}();