diff --git a/packages/berry-fslib/sources/FakeFS.ts b/packages/berry-fslib/sources/FakeFS.ts index b7a0bed1ffcc..a6f617254c64 100644 --- a/packages/berry-fslib/sources/FakeFS.ts +++ b/packages/berry-fslib/sources/FakeFS.ts @@ -50,6 +50,14 @@ export abstract class FakeFS

{ abstract openPromise(p: P, flags: string, mode?: number): Promise; abstract openSync(p: P, flags: string, mode?: number): number; + abstract readPromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number | null): Promise; + abstract readSync(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number | null): number; + + abstract writePromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): Promise; + abstract writePromise(fd: number, buffer: string, position?: number): Promise; + abstract writeSync(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): number; + abstract writeSync(fd: number, buffer: string, position?: number): number; + abstract closePromise(fd: number): void; abstract closeSync(fd: number): void; diff --git a/packages/berry-fslib/sources/NodeFS.ts b/packages/berry-fslib/sources/NodeFS.ts index e5c2d956061a..bb2113b09312 100644 --- a/packages/berry-fslib/sources/NodeFS.ts +++ b/packages/berry-fslib/sources/NodeFS.ts @@ -29,6 +29,44 @@ export class NodeFS extends BasePortableFakeFS { return this.realFs.openSync(NodeFS.fromPortablePath(p), flags, mode); } + async readPromise(fd: number, buffer: Buffer, offset: number = 0, length: number = 0, position: number | null = -1) { + return await new Promise((resolve, reject) => { + this.realFs.read(fd, buffer, offset, length, position, (error, bytesRead) => { + if (error) { + reject(error); + } else { + resolve(bytesRead); + } + }); + }); + } + + readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number) { + return this.realFs.readSync(fd, buffer, offset, length, position); + } + + writePromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): Promise; + writePromise(fd: number, buffer: string, position?: number): Promise; + async writePromise(fd: number, buffer: Buffer | string, offset?: number, length?: number, position?: number): Promise { + return await new Promise((resolve, reject) => { + if (typeof buffer === `string`) { + return this.realFs.write(fd, buffer, offset, this.makeCallback(resolve, reject)); + } else { + return this.realFs.write(fd, buffer, offset, length, position, this.makeCallback(resolve, reject)); + } + }); + } + + writeSync(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): number; + writeSync(fd: number, buffer: string, position?: number): number; + writeSync(fd: number, buffer: Buffer | string, offset?: number, length?: number, position?: number) { + if (typeof buffer === `string`) { + return this.realFs.writeSync(fd, buffer, offset); + } else { + return this.realFs.writeSync(fd, buffer, offset, length, position); + } + } + async closePromise(fd: number) { await new Promise((resolve, reject) => { this.realFs.close(fd, this.makeCallback(resolve, reject)); diff --git a/packages/berry-fslib/sources/ProxiedFS.ts b/packages/berry-fslib/sources/ProxiedFS.ts index 8dfb0d923d5f..89fc23fec11e 100644 --- a/packages/berry-fslib/sources/ProxiedFS.ts +++ b/packages/berry-fslib/sources/ProxiedFS.ts @@ -31,6 +31,34 @@ export abstract class ProxiedFS

extends FakeFS< return this.baseFs.openSync(this.mapToBase(p), flags, mode); } + async readPromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number | null) { + return await this.baseFs.readPromise(fd, buffer, offset, length, position); + } + + readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number) { + return this.baseFs.readSync(fd, buffer, offset, length, position); + } + + writePromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): Promise; + writePromise(fd: number, buffer: string, position?: number): Promise; + async writePromise(fd: number, buffer: Buffer | string, offset?: number, length?: number, position?: number): Promise { + if (typeof buffer === `string`) { + return await this.baseFs.writePromise(fd, buffer, offset); + } else { + return await this.baseFs.writePromise(fd, buffer, offset, length, position); + } + } + + writeSync(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): number; + writeSync(fd: number, buffer: string, position?: number): number; + writeSync(fd: number, buffer: Buffer | string, offset?: number, length?: number, position?: number) { + if (typeof buffer === `string`) { + return this.baseFs.writeSync(fd, buffer, offset); + } else { + return this.baseFs.writeSync(fd, buffer, offset, length, position); + } + } + closePromise(fd: number) { return this.baseFs.closePromise(fd); } diff --git a/packages/berry-fslib/sources/ZipFS.ts b/packages/berry-fslib/sources/ZipFS.ts index 61dd3f354752..52a52977496c 100644 --- a/packages/berry-fslib/sources/ZipFS.ts +++ b/packages/berry-fslib/sources/ZipFS.ts @@ -114,6 +114,9 @@ export class ZipFS extends BasePortableFakeFS { private readonly listings: Map> = new Map(); private readonly entries: Map = new Map(); + private readonly fds: Map = new Map(); + private nextFd: number = 0; + private ready = false; constructor(p: PortablePath, opts: ZipPathOptions); @@ -248,20 +251,71 @@ export class ZipFS extends BasePortableFakeFS { this.ready = false; } - async openPromise(p: string, flags: string, mode?: number) { + async openPromise(p: PortablePath, flags: string, mode?: number) { return this.openSync(p, flags, mode); } - openSync(p: string, flags: string, mode?: number): never { + openSync(p: PortablePath, flags: string, mode?: number) { + const fd = this.nextFd++; + this.fds.set(fd, {cursor: 0, p}); + return fd; + } + + async readPromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number | null) { + return this.readSync(fd, buffer, offset, length, position); + } + + readSync(fd: number, buffer: Buffer, offset: number = 0, length: number = 0, position: number | null = -1) { + const entry = this.fds.get(fd); + if (typeof entry === `undefined`) + throw Object.assign(new Error(`EBADF: bad file descriptor, read`), {code: `EBADF`}); + + let realPosition; + if (position === -1 || position === null) + realPosition = entry.cursor; + else + realPosition = position; + + const source = this.readFileSync(entry.p); + source.copy(buffer, offset, realPosition, realPosition + length); + + const bytesRead = Math.max(0, Math.min(source.length - realPosition, length)); + if (position === -1) + entry.cursor += bytesRead; + + return bytesRead; + } + + writePromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): Promise; + writePromise(fd: number, buffer: string, position?: number): Promise; + async writePromise(fd: number, buffer: Buffer | string, offset?: number, length?: number, position?: number): Promise { + if (typeof buffer === `string`) { + return this.writeSync(fd, buffer, position); + } else { + return this.writeSync(fd, buffer, offset, length, position); + } + } + + writeSync(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): number; + writeSync(fd: number, buffer: string, position?: number): number; + writeSync(fd: number, buffer: Buffer | string, offset?: number, length?: number, position?: number): never { + const entry = this.fds.get(fd); + if (typeof entry === `undefined`) + throw Object.assign(new Error(`EBADF: bad file descriptor, read`), {code: `EBADF`}); + throw new Error(`Unimplemented`); } async closePromise(fd: number) { - this.closeSync(fd); + return this.closeSync(fd); } - closeSync(fd: number): never { - throw new Error(`Unimplemented`); + closeSync(fd: number) { + const entry = this.fds.get(fd); + if (typeof entry === `undefined`) + throw Object.assign(new Error(`EBADF: bad file descriptor, read`), {code: `EBADF`}); + + this.fds.delete(fd); } createReadStream(p: PortablePath | null, {encoding}: CreateReadStreamOptions = {}): ReadStream { diff --git a/packages/berry-fslib/sources/ZipOpenFS.ts b/packages/berry-fslib/sources/ZipOpenFS.ts index d682a98cac9c..eb8eaf3dec30 100644 --- a/packages/berry-fslib/sources/ZipOpenFS.ts +++ b/packages/berry-fslib/sources/ZipOpenFS.ts @@ -7,6 +7,8 @@ import {NodeFS} f import {ZipFS} from './ZipFS'; import {FSPath, PortablePath} from './path'; +const ZIP_FD = 0x80000000; + export type ZipOpenFSOptions = { baseFs?: FakeFS, filter?: RegExp | null, @@ -36,6 +38,9 @@ export class ZipOpenFS extends BasePortableFakeFS { private readonly zipInstances: Map | null; + private readonly fdMap: Map = new Map(); + private nextFd = 3; + private readonly filter?: RegExp | null; private isZip: Set = new Set(); @@ -76,28 +81,126 @@ export class ZipOpenFS extends BasePortableFakeFS { } } + private remapFd(zipFs: ZipFS, fd: number) { + const remappedFd = this.nextFd++ | ZIP_FD; + this.fdMap.set(remappedFd, [zipFs, fd]); + return remappedFd; + } + async openPromise(p: PortablePath, flags: string, mode?: number) { return await this.makeCallPromise(p, async () => { return await this.baseFs.openPromise(p, flags, mode); - }, async () => { - throw new Error(`Unsupported action (we wouldn't be able to disambiguate the close)`); + }, async (zipFs, {subPath}) => { + return this.remapFd(zipFs, await zipFs.openPromise(subPath, flags, mode)); }); } openSync(p: PortablePath, flags: string, mode?: number) { return this.makeCallSync(p, () => { return this.baseFs.openSync(p, flags, mode); - }, () => { - throw new Error(`Unsupported action (we wouldn't be able to disambiguate the close)`); + }, (zipFs, {subPath}) => { + return this.remapFd(zipFs, zipFs.openSync(subPath, flags, mode)); }); } + async readPromise(fd: number, buffer: Buffer, offset: number, length: number, position: number) { + if ((fd & ZIP_FD) === 0) + return await this.baseFs.readPromise(fd, buffer, offset, length, position); + + const entry = this.fdMap.get(fd); + if (typeof entry === `undefined`) + throw Object.assign(new Error(`EBADF: bad file descriptor, read`), {code: `EBADF`}); + + const [zipFs, realFd] = entry; + return await zipFs.readPromise(realFd, buffer, offset, length, position); + } + + readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number) { + if ((fd & ZIP_FD) === 0) + return this.baseFs.readSync(fd, buffer, offset, length, position); + + const entry = this.fdMap.get(fd); + if (typeof entry === `undefined`) + throw Object.assign(new Error(`EBADF: bad file descriptor, read`), {code: `EBADF`}); + + const [zipFs, realFd] = entry; + return zipFs.readSync(realFd, buffer, offset, length, position); + } + + writePromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): Promise; + writePromise(fd: number, buffer: string, position?: number): Promise; + async writePromise(fd: number, buffer: Buffer | string, offset?: number, length?: number, position?: number): Promise { + if ((fd & ZIP_FD) === 0) { + if (typeof buffer === `string`) { + return await this.baseFs.writePromise(fd, buffer, offset); + } else { + return await this.baseFs.writePromise(fd, buffer, offset, length, position); + } + } + + const entry = this.fdMap.get(fd); + if (typeof entry === `undefined`) + throw Object.assign(new Error(`EBADF: bad file descriptor, write`), {code: `EBADF`}); + + const [zipFs, realFd] = entry; + + if (typeof buffer === `string`) { + return await zipFs.writePromise(realFd, buffer, offset); + } else { + return await zipFs.writePromise(realFd, buffer, offset, length, position); + } + } + + writeSync(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): number; + writeSync(fd: number, buffer: string, position?: number): number; + writeSync(fd: number, buffer: Buffer | string, offset?: number, length?: number, position?: number): number { + if ((fd & ZIP_FD) === 0) { + if (typeof buffer === `string`) { + return this.baseFs.writeSync(fd, buffer, offset); + } else { + return this.baseFs.writeSync(fd, buffer, offset, length, position); + } + } + + const entry = this.fdMap.get(fd); + if (typeof entry === `undefined`) + throw Object.assign(new Error(`EBADF: bad file descriptor, write`), {code: `EBADF`}); + + const [zipFs, realFd] = entry; + + if (typeof buffer === `string`) { + return zipFs.writeSync(realFd, buffer, offset); + } else { + return zipFs.writeSync(realFd, buffer, offset, length, position); + } + } + async closePromise(fd: number) { - return await this.baseFs.closePromise(fd); + if ((fd & ZIP_FD) === 0) + return await this.baseFs.closePromise(fd); + + const entry = this.fdMap.get(fd); + if (typeof entry === `undefined`) + throw Object.assign(new Error(`EBADF: bad file descriptor, close`), {code: `EBADF`}); + + this.fdMap.delete(fd); + + const [zipFs, realFd] = entry; + return await zipFs.closePromise(realFd); } closeSync(fd: number) { - return this.baseFs.closeSync(fd); + if ((fd & ZIP_FD) === 0) + return this.baseFs.closeSync(fd); + + const entry = this.fdMap.get(fd); + if (typeof entry === `undefined`) + throw Object.assign(new Error(`EBADF: bad file descriptor, close`), {code: `EBADF`}); + + this.fdMap.delete(fd); + + const [zipFs, realFd] = entry; + return zipFs.closeSync(realFd); } createReadStream(p: PortablePath | null, opts?: CreateReadStreamOptions) { diff --git a/packages/berry-fslib/sources/index.ts b/packages/berry-fslib/sources/index.ts index 47b39a5d2019..98b501eac096 100644 --- a/packages/berry-fslib/sources/index.ts +++ b/packages/berry-fslib/sources/index.ts @@ -34,9 +34,11 @@ export function patchFs(patchedFs: typeof fs, fakeFs: FakeFS): void `appendFileSync`, `createReadStream`, `chmodSync`, + `closeSync`, `copyFileSync`, `lstatSync`, `openSync`, + `readSync`, `readlinkSync`, `readFileSync`, `readdirSync`, @@ -49,12 +51,14 @@ export function patchFs(patchedFs: typeof fs, fakeFs: FakeFS): void `utimesSync`, `watch`, `writeFileSync`, + `writeSync`, ]); const ASYNC_IMPLEMENTATIONS = new Set([ `accessPromise`, `appendFilePromise`, `chmodPromise`, + `closePromise`, `copyFilePromise`, `lstatPromise`, `openPromise`, @@ -69,6 +73,7 @@ export function patchFs(patchedFs: typeof fs, fakeFs: FakeFS): void `unlinkPromise`, `utimesPromise`, `writeFilePromise`, + `writeSync`, ]); (patchedFs as any).existsSync = (p: string) => { @@ -79,15 +84,29 @@ export function patchFs(patchedFs: typeof fs, fakeFs: FakeFS): void } }; - (patchedFs as any).exists = (p: string, callback?: (result: boolean) => any) => { - fakeFs.existsPromise(p).then(result => { - if (callback) { - callback(result); - } - }, () => { - if (callback) { + (patchedFs as any).exists = (p: string, ...args: any[]) => { + const hasCallback = typeof args[args.length - 1] === `function`; + const callback = hasCallback ? args.pop() : () => {}; + + process.nextTick(() => { + fakeFs.existsPromise(p).then(exists => { + callback(exists); + }, () => { callback(false); - } + }); + }); + }; + + (patchedFs as any).read = (p: number, buffer: Buffer, ...args: any[]) => { + const hasCallback = typeof args[args.length - 1] === `function`; + const callback = hasCallback ? args.pop() : () => {}; + + process.nextTick(() => { + fakeFs.readPromise(p, buffer, ...args).then(bytesRead => { + callback(undefined, bytesRead, buffer); + }, error => { + callback(error); + }); }); }; @@ -99,10 +118,12 @@ export function patchFs(patchedFs: typeof fs, fakeFs: FakeFS): void const hasCallback = typeof args[args.length - 1] === `function`; const callback = hasCallback ? args.pop() : () => {}; - fakeImpl(...args).then((result: any) => { - callback(undefined, result); - }, (error: Error) => { - callback(error); + process.nextTick(() => { + fakeImpl(...args).then((result: any) => { + callback(undefined, result); + }, (error: Error) => { + callback(error); + }); }); }; } diff --git a/packages/berry-pnp/lib/hook.js b/packages/berry-pnp/lib/hook.js index 1c9d54aae18c..eda0380ee5c6 100644 --- a/packages/berry-pnp/lib/hook.js +++ b/packages/berry-pnp/lib/hook.js @@ -1 +1 @@ -module.exports = "module.exports =\n/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 11);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst path_1 = __importDefault(__webpack_require__(4));\nexports.PortablePath = {\n root: `/`,\n dot: `.`,\n};\nexports.npath = path_1.default;\nexports.ppath = path_1.default.posix;\nconst WINDOWS_PATH_REGEXP = /^[a-zA-Z]:.*$/;\nconst PORTABLE_PATH_REGEXP = /^\\/[a-zA-Z]:.*$/;\n// Path should look like \"/N:/berry/scripts/plugin-pack.js\"\n// And transform to \"N:\\berry\\scripts\\plugin-pack.js\"\nfunction fromPortablePath(p) {\n if (process.platform !== 'win32')\n return p;\n return p.match(PORTABLE_PATH_REGEXP) ? p.substring(1).replace(/\\//g, `\\\\`) : p;\n}\nexports.fromPortablePath = fromPortablePath;\n// Path should look like \"N:/berry/scripts/plugin-pack.js\"\n// And transform to \"/N:/berry/scripts/plugin-pack.js\"\nfunction toPortablePath(p) {\n if (process.platform !== 'win32')\n return p;\n return (p.match(WINDOWS_PATH_REGEXP) ? `/${p}` : p).replace(/\\\\/g, `/`);\n}\nexports.toPortablePath = toPortablePath;\nfunction convertPath(targetPathUtils, sourcePath) {\n return (targetPathUtils === exports.npath ? fromPortablePath(sourcePath) : toPortablePath(sourcePath));\n}\nexports.convertPath = convertPath;\nfunction toFilename(filename) {\n if (exports.npath.parse(filename).dir !== '' || exports.ppath.parse(filename).dir !== '')\n throw new Error(`Invalid filename: \"${filename}\"`);\n return filename;\n}\nexports.toFilename = toFilename;\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fs_1 = __importDefault(__webpack_require__(2));\nconst FakeFS_1 = __webpack_require__(6);\nconst path_1 = __webpack_require__(0);\nconst path_2 = __webpack_require__(0);\nclass NodeFS extends FakeFS_1.BasePortableFakeFS {\n constructor(realFs = fs_1.default) {\n super();\n this.realFs = realFs;\n }\n getRealPath() {\n return path_1.PortablePath.root;\n }\n async openPromise(p, flags, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.open(NodeFS.fromPortablePath(p), flags, mode, this.makeCallback(resolve, reject));\n });\n }\n openSync(p, flags, mode) {\n return this.realFs.openSync(NodeFS.fromPortablePath(p), flags, mode);\n }\n async closePromise(fd) {\n await new Promise((resolve, reject) => {\n this.realFs.close(fd, this.makeCallback(resolve, reject));\n });\n }\n closeSync(fd) {\n this.realFs.closeSync(fd);\n }\n createReadStream(p, opts) {\n const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p);\n return this.realFs.createReadStream(realPath, opts);\n }\n createWriteStream(p, opts) {\n const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p);\n return this.realFs.createWriteStream(realPath, opts);\n }\n async realpathPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.realpath(NodeFS.fromPortablePath(p), {}, this.makeCallback(resolve, reject));\n }).then(path => {\n return NodeFS.toPortablePath(path);\n });\n }\n realpathSync(p) {\n return NodeFS.toPortablePath(this.realFs.realpathSync(NodeFS.fromPortablePath(p), {}));\n }\n async existsPromise(p) {\n return await new Promise(resolve => {\n this.realFs.exists(NodeFS.fromPortablePath(p), resolve);\n });\n }\n accessSync(p, mode) {\n return this.realFs.accessSync(NodeFS.fromPortablePath(p), mode);\n }\n async accessPromise(p, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.access(NodeFS.fromPortablePath(p), mode, this.makeCallback(resolve, reject));\n });\n }\n existsSync(p) {\n return this.realFs.existsSync(NodeFS.fromPortablePath(p));\n }\n async statPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.stat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n statSync(p) {\n return this.realFs.statSync(NodeFS.fromPortablePath(p));\n }\n async lstatPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.lstat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n lstatSync(p) {\n return this.realFs.lstatSync(NodeFS.fromPortablePath(p));\n }\n async chmodPromise(p, mask) {\n return await new Promise((resolve, reject) => {\n this.realFs.chmod(NodeFS.fromPortablePath(p), mask, this.makeCallback(resolve, reject));\n });\n }\n chmodSync(p, mask) {\n return this.realFs.chmodSync(NodeFS.fromPortablePath(p), mask);\n }\n async renamePromise(oldP, newP) {\n return await new Promise((resolve, reject) => {\n this.realFs.rename(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP), this.makeCallback(resolve, reject));\n });\n }\n renameSync(oldP, newP) {\n return this.realFs.renameSync(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP));\n }\n async copyFilePromise(sourceP, destP, flags = 0) {\n return await new Promise((resolve, reject) => {\n this.realFs.copyFile(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags, this.makeCallback(resolve, reject));\n });\n }\n copyFileSync(sourceP, destP, flags = 0) {\n return this.realFs.copyFileSync(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags);\n }\n async writeFilePromise(p, content, opts) {\n return await new Promise((resolve, reject) => {\n if (opts) {\n this.realFs.writeFile(NodeFS.fromPortablePath(p), content, opts, this.makeCallback(resolve, reject));\n }\n else {\n this.realFs.writeFile(NodeFS.fromPortablePath(p), content, this.makeCallback(resolve, reject));\n }\n });\n }\n writeFileSync(p, content, opts) {\n if (opts) {\n this.realFs.writeFileSync(NodeFS.fromPortablePath(p), content, opts);\n }\n else {\n this.realFs.writeFileSync(NodeFS.fromPortablePath(p), content);\n }\n }\n async unlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.unlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n unlinkSync(p) {\n return this.realFs.unlinkSync(NodeFS.fromPortablePath(p));\n }\n async utimesPromise(p, atime, mtime) {\n return await new Promise((resolve, reject) => {\n this.realFs.utimes(NodeFS.fromPortablePath(p), atime, mtime, this.makeCallback(resolve, reject));\n });\n }\n utimesSync(p, atime, mtime) {\n this.realFs.utimesSync(NodeFS.fromPortablePath(p), atime, mtime);\n }\n async mkdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.mkdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n mkdirSync(p) {\n return this.realFs.mkdirSync(NodeFS.fromPortablePath(p));\n }\n async rmdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.rmdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n rmdirSync(p) {\n return this.realFs.rmdirSync(NodeFS.fromPortablePath(p));\n }\n async symlinkPromise(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return await new Promise((resolve, reject) => {\n this.realFs.symlink(NodeFS.fromPortablePath(target.replace(/\\/+$/, ``)), NodeFS.fromPortablePath(p), type, this.makeCallback(resolve, reject));\n });\n }\n symlinkSync(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return this.realFs.symlinkSync(NodeFS.fromPortablePath(target.replace(/\\/+$/, ``)), NodeFS.fromPortablePath(p), type);\n }\n async readFilePromise(p, encoding) {\n return await new Promise((resolve, reject) => {\n this.realFs.readFile(NodeFS.fromPortablePath(p), encoding, this.makeCallback(resolve, reject));\n });\n }\n readFileSync(p, encoding) {\n return this.realFs.readFileSync(NodeFS.fromPortablePath(p), encoding);\n }\n async readdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n readdirSync(p) {\n return this.realFs.readdirSync(NodeFS.fromPortablePath(p));\n }\n async readlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n }).then(path => {\n return NodeFS.toPortablePath(path);\n });\n }\n readlinkSync(p) {\n return NodeFS.toPortablePath(this.realFs.readlinkSync(NodeFS.fromPortablePath(p)));\n }\n watch(p, a, b) {\n return this.realFs.watch(NodeFS.fromPortablePath(p), \n // @ts-ignore\n a, b);\n }\n makeCallback(resolve, reject) {\n return (err, result) => {\n if (err) {\n reject(err);\n }\n else {\n resolve(result);\n }\n };\n }\n static fromPortablePath(p) {\n return path_2.fromPortablePath(p);\n }\n static toPortablePath(p) {\n return path_2.toPortablePath(p);\n }\n}\nexports.NodeFS = NodeFS;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"fs\");\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst FakeFS_1 = __webpack_require__(6);\nclass ProxiedFS extends FakeFS_1.FakeFS {\n resolve(path) {\n return this.mapFromBase(this.baseFs.resolve(this.mapToBase(path)));\n }\n getRealPath() {\n return this.mapFromBase(this.baseFs.getRealPath());\n }\n openPromise(p, flags, mode) {\n return this.baseFs.openPromise(this.mapToBase(p), flags, mode);\n }\n openSync(p, flags, mode) {\n return this.baseFs.openSync(this.mapToBase(p), flags, mode);\n }\n closePromise(fd) {\n return this.baseFs.closePromise(fd);\n }\n closeSync(fd) {\n this.baseFs.closeSync(fd);\n }\n createReadStream(p, opts) {\n return this.baseFs.createReadStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n createWriteStream(p, opts) {\n return this.baseFs.createWriteStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n async realpathPromise(p) {\n return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(p)));\n }\n realpathSync(p) {\n return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(p)));\n }\n existsPromise(p) {\n return this.baseFs.existsPromise(this.mapToBase(p));\n }\n existsSync(p) {\n return this.baseFs.existsSync(this.mapToBase(p));\n }\n accessSync(p, mode) {\n return this.baseFs.accessSync(this.mapToBase(p), mode);\n }\n accessPromise(p, mode) {\n return this.baseFs.accessPromise(this.mapToBase(p), mode);\n }\n statPromise(p) {\n return this.baseFs.statPromise(this.mapToBase(p));\n }\n statSync(p) {\n return this.baseFs.statSync(this.mapToBase(p));\n }\n lstatPromise(p) {\n return this.baseFs.lstatPromise(this.mapToBase(p));\n }\n lstatSync(p) {\n return this.baseFs.lstatSync(this.mapToBase(p));\n }\n chmodPromise(p, mask) {\n return this.baseFs.chmodPromise(this.mapToBase(p), mask);\n }\n chmodSync(p, mask) {\n return this.baseFs.chmodSync(this.mapToBase(p), mask);\n }\n renamePromise(oldP, newP) {\n return this.baseFs.renamePromise(this.mapToBase(oldP), this.mapToBase(newP));\n }\n renameSync(oldP, newP) {\n return this.baseFs.renameSync(this.mapToBase(oldP), this.mapToBase(newP));\n }\n copyFilePromise(sourceP, destP, flags = 0) {\n return this.baseFs.copyFilePromise(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n copyFileSync(sourceP, destP, flags = 0) {\n return this.baseFs.copyFileSync(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n writeFilePromise(p, content, opts) {\n return this.baseFs.writeFilePromise(this.mapToBase(p), content, opts);\n }\n writeFileSync(p, content, opts) {\n return this.baseFs.writeFileSync(this.mapToBase(p), content, opts);\n }\n unlinkPromise(p) {\n return this.baseFs.unlinkPromise(this.mapToBase(p));\n }\n unlinkSync(p) {\n return this.baseFs.unlinkSync(this.mapToBase(p));\n }\n utimesPromise(p, atime, mtime) {\n return this.baseFs.utimesPromise(this.mapToBase(p), atime, mtime);\n }\n utimesSync(p, atime, mtime) {\n return this.baseFs.utimesSync(this.mapToBase(p), atime, mtime);\n }\n mkdirPromise(p) {\n return this.baseFs.mkdirPromise(this.mapToBase(p));\n }\n mkdirSync(p) {\n return this.baseFs.mkdirSync(this.mapToBase(p));\n }\n rmdirPromise(p) {\n return this.baseFs.rmdirPromise(this.mapToBase(p));\n }\n rmdirSync(p) {\n return this.baseFs.rmdirSync(this.mapToBase(p));\n }\n symlinkPromise(target, p) {\n return this.baseFs.symlinkPromise(this.mapToBase(target), this.mapToBase(p));\n }\n symlinkSync(target, p) {\n return this.baseFs.symlinkSync(this.mapToBase(target), this.mapToBase(p));\n }\n readFilePromise(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFilePromise(this.mapToBase(p), encoding);\n }\n else {\n return this.baseFs.readFilePromise(this.mapToBase(p), encoding);\n }\n }\n readFileSync(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFileSync(this.mapToBase(p), encoding);\n }\n else {\n return this.baseFs.readFileSync(this.mapToBase(p), encoding);\n }\n }\n readdirPromise(p) {\n return this.baseFs.readdirPromise(this.mapToBase(p));\n }\n readdirSync(p) {\n return this.baseFs.readdirSync(this.mapToBase(p));\n }\n async readlinkPromise(p) {\n return this.mapFromBase(await this.baseFs.readlinkPromise(this.mapToBase(p)));\n }\n readlinkSync(p) {\n return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(p)));\n }\n watch(p, a, b) {\n return this.baseFs.watch(this.mapToBase(p), \n // @ts-ignore\n a, b);\n }\n}\nexports.ProxiedFS = ProxiedFS;\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"path\");\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst tmp_1 = __importDefault(__webpack_require__(12));\nconst NodeFS_1 = __webpack_require__(1);\nvar path_1 = __webpack_require__(0);\nexports.PortablePath = path_1.PortablePath;\nvar path_2 = __webpack_require__(0);\nexports.npath = path_2.npath;\nexports.ppath = path_2.ppath;\nexports.toFilename = path_2.toFilename;\nvar AliasFS_1 = __webpack_require__(14);\nexports.AliasFS = AliasFS_1.AliasFS;\nvar FakeFS_1 = __webpack_require__(6);\nexports.FakeFS = FakeFS_1.FakeFS;\nvar CwdFS_1 = __webpack_require__(15);\nexports.CwdFS = CwdFS_1.CwdFS;\nvar JailFS_1 = __webpack_require__(16);\nexports.JailFS = JailFS_1.JailFS;\nvar LazyFS_1 = __webpack_require__(17);\nexports.LazyFS = LazyFS_1.LazyFS;\nvar NodeFS_2 = __webpack_require__(1);\nexports.NodeFS = NodeFS_2.NodeFS;\nvar PosixFS_1 = __webpack_require__(18);\nexports.PosixFS = PosixFS_1.PosixFS;\nvar ProxiedFS_1 = __webpack_require__(3);\nexports.ProxiedFS = ProxiedFS_1.ProxiedFS;\nvar VirtualFS_1 = __webpack_require__(19);\nexports.VirtualFS = VirtualFS_1.VirtualFS;\nvar ZipFS_1 = __webpack_require__(9);\nexports.ZipFS = ZipFS_1.ZipFS;\nvar ZipOpenFS_1 = __webpack_require__(24);\nexports.ZipOpenFS = ZipOpenFS_1.ZipOpenFS;\nfunction patchFs(patchedFs, fakeFs) {\n const SYNC_IMPLEMENTATIONS = new Set([\n `accessSync`,\n `createReadStream`,\n `chmodSync`,\n `copyFileSync`,\n `lstatSync`,\n `openSync`,\n `readlinkSync`,\n `readFileSync`,\n `readdirSync`,\n `readlinkSync`,\n `realpathSync`,\n `rmdirSync`,\n `statSync`,\n `symlinkSync`,\n `unlinkSync`,\n `utimesSync`,\n `watch`,\n `writeFileSync`,\n ]);\n const ASYNC_IMPLEMENTATIONS = new Set([\n `accessPromise`,\n `chmodPromise`,\n `copyFilePromise`,\n `lstatPromise`,\n `openPromise`,\n `readdirPromise`,\n `realpathPromise`,\n `readFilePromise`,\n `readdirPromise`,\n `readlinkPromise`,\n `rmdirPromise`,\n `statPromise`,\n `symlinkPromise`,\n `unlinkPromise`,\n `utimesPromise`,\n `writeFilePromise`,\n ]);\n patchedFs.existsSync = (p) => {\n try {\n return fakeFs.existsSync(p);\n }\n catch (error) {\n return false;\n }\n };\n patchedFs.exists = (p, callback) => {\n fakeFs.existsPromise(p).then(result => {\n if (callback) {\n callback(result);\n }\n }, () => {\n if (callback) {\n callback(false);\n }\n });\n };\n for (const fnName of ASYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName.replace(/Promise$/, ``);\n patchedFs[origName] = (...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => { };\n fakeImpl(...args).then((result) => {\n callback(undefined, result);\n }, (error) => {\n callback(error);\n });\n };\n }\n for (const fnName of SYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName;\n patchedFs[origName] = fakeImpl;\n }\n patchedFs.realpathSync.native = patchedFs.realpathSync;\n patchedFs.realpath.native = patchedFs.realpath;\n}\nexports.patchFs = patchFs;\nfunction extendFs(realFs, fakeFs) {\n const patchedFs = Object.create(realFs);\n patchFs(patchedFs, fakeFs);\n return patchedFs;\n}\nexports.extendFs = extendFs;\nexports.xfs = Object.assign(new NodeFS_1.NodeFS(), {\n mktempSync(cb) {\n const { name, removeCallback } = tmp_1.default.dirSync({ unsafeCleanup: true });\n if (typeof cb === `undefined`) {\n return NodeFS_1.NodeFS.toPortablePath(name);\n }\n else {\n try {\n return cb(NodeFS_1.NodeFS.toPortablePath(name));\n }\n finally {\n removeCallback();\n }\n }\n },\n mktempPromise(cb) {\n if (typeof cb === `undefined`) {\n return new Promise((resolve, reject) => {\n tmp_1.default.dir({ unsafeCleanup: true }, (err, path) => {\n if (err) {\n reject(err);\n }\n else {\n resolve(NodeFS_1.NodeFS.toPortablePath(path));\n }\n });\n });\n }\n else {\n return new Promise((resolve, reject) => {\n tmp_1.default.dir({ unsafeCleanup: true }, (err, path, cleanup) => {\n if (err) {\n reject(err);\n }\n else {\n Promise.resolve(NodeFS_1.NodeFS.toPortablePath(path)).then(cb).then(result => {\n cleanup();\n resolve(result);\n }, error => {\n cleanup();\n reject(error);\n });\n }\n });\n });\n }\n },\n});\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst path_1 = __webpack_require__(0);\nconst path_2 = __webpack_require__(0);\nclass FakeFS {\n constructor(pathUtils) {\n this.pathUtils = pathUtils;\n }\n async removePromise(p) {\n let stat;\n try {\n stat = await this.lstatPromise(p);\n }\n catch (error) {\n if (error.code === `ENOENT`) {\n return;\n }\n else {\n throw error;\n }\n }\n if (stat.isDirectory()) {\n for (const entry of await this.readdirPromise(p))\n await this.removePromise(this.pathUtils.resolve(p, entry));\n // 5 gives 1s worth of retries at worst\n for (let t = 0; t < 5; ++t) {\n try {\n await this.rmdirPromise(p);\n break;\n }\n catch (error) {\n if (error.code === `EBUSY` || error.code === `ENOTEMPTY`) {\n await new Promise(resolve => setTimeout(resolve, t * 100));\n continue;\n }\n else {\n throw error;\n }\n }\n }\n }\n else {\n await this.unlinkPromise(p);\n }\n }\n removeSync(p) {\n let stat;\n try {\n stat = this.lstatSync(p);\n }\n catch (error) {\n if (error.code === `ENOENT`) {\n return;\n }\n else {\n throw error;\n }\n }\n if (stat.isDirectory()) {\n for (const entry of this.readdirSync(p))\n this.removeSync(this.pathUtils.resolve(p, entry));\n this.rmdirSync(p);\n }\n else {\n this.unlinkSync(p);\n }\n }\n async mkdirpPromise(p, { chmod, utimes } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p))\n return;\n const parts = p.split(this.pathUtils.sep);\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n if (!this.existsSync(subPath)) {\n try {\n await this.mkdirPromise(subPath);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n }\n else {\n throw error;\n }\n }\n if (chmod != null)\n await this.chmodPromise(subPath, chmod);\n if (utimes != null) {\n await this.utimesPromise(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n mkdirpSync(p, { chmod, utimes } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p))\n return;\n const parts = p.split(this.pathUtils.sep);\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n if (!this.existsSync(subPath)) {\n try {\n this.mkdirSync(subPath);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n }\n else {\n throw error;\n }\n }\n if (chmod != null)\n this.chmodSync(subPath, chmod);\n if (utimes != null) {\n this.utimesSync(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n async copyPromise(destination, source, { baseFs = this, overwrite = true } = {}) {\n const stat = await baseFs.lstatPromise(source);\n const exists = await this.existsSync(destination);\n if (stat.isDirectory()) {\n await this.mkdirpPromise(destination);\n const directoryListing = await baseFs.readdirPromise(source);\n await Promise.all(directoryListing.map(entry => {\n return this.copyPromise(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite });\n }));\n }\n else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists)\n await this.removePromise(destination);\n const content = await baseFs.readFilePromise(source);\n await this.writeFilePromise(destination, content);\n }\n }\n else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists)\n await this.removePromise(destination);\n const target = await baseFs.readlinkPromise(source);\n await this.symlinkPromise(path_2.convertPath(this.pathUtils, target), destination);\n }\n }\n else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n const mode = stat.mode & 0o777;\n await this.chmodPromise(destination, mode);\n }\n copySync(destination, source, { baseFs = this, overwrite = true } = {}) {\n const stat = baseFs.lstatSync(source);\n const exists = this.existsSync(destination);\n if (stat.isDirectory()) {\n this.mkdirpSync(destination);\n const directoryListing = baseFs.readdirSync(source);\n for (const entry of directoryListing) {\n this.copySync(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite });\n }\n }\n else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists)\n this.removeSync(destination);\n const content = baseFs.readFileSync(source);\n this.writeFileSync(destination, content);\n }\n }\n else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists)\n this.removeSync(destination);\n const target = baseFs.readlinkSync(source);\n this.symlinkSync(path_2.convertPath(this.pathUtils, target), destination);\n }\n }\n else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n const mode = stat.mode & 0o777;\n this.chmodSync(destination, mode);\n }\n async changeFilePromise(p, content) {\n try {\n const current = await this.readFilePromise(p, `utf8`);\n if (current === content) {\n return;\n }\n }\n catch (error) {\n // ignore errors, no big deal\n }\n await this.writeFilePromise(p, content);\n }\n changeFileSync(p, content) {\n try {\n const current = this.readFileSync(p, `utf8`);\n if (current === content) {\n return;\n }\n }\n catch (error) {\n // ignore errors, no big deal\n }\n this.writeFileSync(p, content);\n }\n async movePromise(fromP, toP) {\n try {\n await this.renamePromise(fromP, toP);\n }\n catch (error) {\n if (error.code === `EXDEV`) {\n await this.copyPromise(toP, fromP);\n await this.removePromise(fromP);\n }\n else {\n throw error;\n }\n }\n }\n moveSync(fromP, toP) {\n try {\n this.renameSync(fromP, toP);\n }\n catch (error) {\n if (error.code === `EXDEV`) {\n this.copySync(toP, fromP);\n this.removeSync(fromP);\n }\n else {\n throw error;\n }\n }\n }\n async lockPromise(affectedPath, callback) {\n const lockPath = `${affectedPath}.lock`;\n const interval = 1000 / 60;\n const timeout = Date.now() + 60 * 1000;\n let fd = null;\n while (fd === null) {\n try {\n fd = await this.openPromise(lockPath, `wx`);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n if (Date.now() < timeout) {\n await new Promise(resolve => setTimeout(resolve, interval));\n }\n else {\n throw new Error(`Couldn't acquire a lock in a reasonable time (via ${lockPath})`);\n }\n }\n else {\n throw error;\n }\n }\n }\n try {\n return await callback();\n }\n finally {\n await this.closePromise(fd);\n await this.unlinkPromise(lockPath);\n }\n }\n}\nexports.FakeFS = FakeFS;\n;\nclass BasePortableFakeFS extends FakeFS {\n constructor() {\n super(path_2.ppath);\n }\n resolve(p) {\n return this.pathUtils.resolve(path_1.PortablePath.root, p);\n }\n}\nexports.BasePortableFakeFS = BasePortableFakeFS;\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"module\");\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"crypto\");\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst libzip_1 = __importDefault(__webpack_require__(20));\nconst fs_1 = __webpack_require__(2);\nconst stream_1 = __webpack_require__(22);\nconst util_1 = __webpack_require__(23);\nconst FakeFS_1 = __webpack_require__(6);\nconst NodeFS_1 = __webpack_require__(1);\nconst path_1 = __webpack_require__(0);\nconst S_IFMT = 0o170000;\nconst S_IFDIR = 0o040000;\nconst S_IFREG = 0o100000;\nconst S_IFLNK = 0o120000;\nclass StatEntry {\n constructor() {\n this.dev = 0;\n this.ino = 0;\n this.mode = 0;\n this.nlink = 1;\n this.rdev = 0;\n this.blocks = 1;\n }\n isBlockDevice() {\n return false;\n }\n isCharacterDevice() {\n return false;\n }\n isDirectory() {\n return (this.mode & S_IFMT) === S_IFDIR;\n }\n isFIFO() {\n return false;\n }\n isFile() {\n return (this.mode & S_IFMT) === S_IFREG;\n }\n isSocket() {\n return false;\n }\n isSymbolicLink() {\n return (this.mode & S_IFMT) === S_IFLNK;\n }\n}\nfunction makeDefaultStats() {\n return Object.assign(new StatEntry(), {\n uid: 0,\n gid: 0,\n size: 0,\n blksize: 0,\n atimeMs: 0,\n mtimeMs: 0,\n ctimeMs: 0,\n birthtimeMs: 0,\n atime: new Date(0),\n mtime: new Date(0),\n ctime: new Date(0),\n birthtime: new Date(0),\n mode: S_IFREG | 0o644,\n });\n}\nfunction toUnixTimestamp(time) {\n if (typeof time === 'string' && String(+time) === time)\n return +time;\n // @ts-ignore\n if (Number.isFinite(time)) {\n if (time < 0) {\n return Date.now() / 1000;\n }\n else {\n return time;\n }\n }\n // convert to 123.456 UNIX timestamp\n if (util_1.isDate(time))\n return time.getTime() / 1000;\n throw new Error(`Invalid time`);\n}\nclass ZipFS extends FakeFS_1.BasePortableFakeFS {\n constructor(source, opts) {\n super();\n this.listings = new Map();\n this.entries = new Map();\n this.ready = false;\n const pathOptions = opts;\n if (typeof source === `string`) {\n const { baseFs = new NodeFS_1.NodeFS() } = pathOptions;\n this.baseFs = baseFs;\n this.path = source;\n }\n else {\n this.path = null;\n this.baseFs = null;\n }\n if (opts.stats) {\n this.stats = opts.stats;\n }\n else {\n if (typeof source === `string`) {\n try {\n this.stats = this.baseFs.statSync(source);\n }\n catch (error) {\n if (error.code === `ENOENT` && pathOptions.create) {\n this.stats = makeDefaultStats();\n }\n else {\n throw error;\n }\n }\n }\n else {\n this.stats = makeDefaultStats();\n }\n }\n const errPtr = libzip_1.default.malloc(4);\n try {\n let flags = 0;\n if (typeof source === `string` && pathOptions.create)\n flags |= libzip_1.default.ZIP_CREATE | libzip_1.default.ZIP_TRUNCATE;\n if (opts.readOnly)\n flags |= libzip_1.default.ZIP_RDONLY;\n if (typeof source === `string`) {\n this.zip = libzip_1.default.open(NodeFS_1.NodeFS.fromPortablePath(source), flags, errPtr);\n }\n else {\n const lzSource = this.allocateUnattachedSource(source);\n try {\n this.zip = libzip_1.default.openFromSource(lzSource, flags, errPtr);\n }\n catch (error) {\n libzip_1.default.source.free(lzSource);\n throw error;\n }\n }\n if (this.zip === 0) {\n const error = libzip_1.default.struct.errorS();\n libzip_1.default.error.initWithCode(error, libzip_1.default.getValue(errPtr, `i32`));\n throw new Error(libzip_1.default.error.strerror(error));\n }\n }\n finally {\n libzip_1.default.free(errPtr);\n }\n this.listings.set(path_1.PortablePath.root, new Set());\n const entryCount = libzip_1.default.getNumEntries(this.zip, 0);\n for (let t = 0; t < entryCount; ++t) {\n const raw = libzip_1.default.getName(this.zip, t, 0);\n if (path_1.ppath.isAbsolute(raw))\n continue;\n const p = path_1.ppath.resolve(path_1.PortablePath.root, raw);\n this.registerEntry(p, t);\n // If the raw path is a directory, register it\n // to prevent empty folder being skipped\n if (raw.endsWith('/')) {\n this.registerListing(p);\n }\n }\n this.ready = true;\n }\n getAllFiles() {\n return Array.from(this.entries.keys());\n }\n getRealPath() {\n if (!this.path)\n throw new Error(`ZipFS don't have real paths when loaded from a buffer`);\n return this.path;\n }\n saveAndClose() {\n if (!this.path || !this.baseFs)\n throw new Error(`ZipFS cannot be saved and must be discarded when loaded from a buffer`);\n if (!this.ready)\n throw Object.assign(new Error(`EBUSY: archive closed, close`), { code: `EBUSY` });\n const previousMod = this.baseFs.existsSync(this.path)\n ? this.baseFs.statSync(this.path).mode & 0o777\n : null;\n const rc = libzip_1.default.close(this.zip);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n // Libzip overrides the chmod when writing the archive, which is a weird\n // behavior I don't totally understand (plus the umask seems bogus in some\n // weird cases - maybe related to emscripten?)\n //\n // See also https://github.com/nih-at/libzip/issues/77\n if (previousMod !== null && previousMod !== (this.baseFs.statSync(this.path).mode & 0o777))\n this.baseFs.chmodSync(this.path, previousMod);\n this.ready = false;\n }\n discardAndClose() {\n libzip_1.default.discard(this.zip);\n this.ready = false;\n }\n async openPromise(p, flags, mode) {\n return this.openSync(p, flags, mode);\n }\n openSync(p, flags, mode) {\n throw new Error(`Unimplemented`);\n }\n async closePromise(fd) {\n this.closeSync(fd);\n }\n closeSync(fd) {\n throw new Error(`Unimplemented`);\n }\n createReadStream(p, { encoding } = {}) {\n if (p === null)\n throw new Error(`Unimplemented`);\n const stream = Object.assign(new stream_1.PassThrough(), {\n bytesRead: 0,\n path: p,\n close: () => {\n clearImmediate(immediate);\n },\n });\n const immediate = setImmediate(() => {\n try {\n const data = this.readFileSync(p, encoding);\n stream.bytesRead = data.length;\n stream.write(data);\n stream.end();\n }\n catch (error) {\n stream.emit(`error`, error);\n stream.end();\n }\n });\n return stream;\n }\n createWriteStream(p, { encoding } = {}) {\n if (p === null)\n throw new Error(`Unimplemented`);\n const stream = Object.assign(new stream_1.PassThrough(), {\n bytesWritten: 0,\n path: p,\n close: () => {\n stream.end();\n },\n });\n const chunks = [];\n stream.on(`data`, chunk => {\n const chunkBuffer = Buffer.from(chunk);\n stream.bytesWritten += chunkBuffer.length;\n chunks.push(chunkBuffer);\n });\n stream.on(`end`, () => {\n this.writeFileSync(p, Buffer.concat(chunks), encoding);\n });\n return stream;\n }\n async realpathPromise(p) {\n return this.realpathSync(p);\n }\n realpathSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, lstat '${p}'`), { code: `ENOENT` });\n return resolvedP;\n }\n async existsPromise(p) {\n return this.existsSync(p);\n }\n existsSync(p) {\n let resolvedP;\n try {\n resolvedP = this.resolveFilename(`stat '${p}'`, p);\n }\n catch (error) {\n return false;\n }\n return this.entries.has(resolvedP) || this.listings.has(resolvedP);\n }\n async accessPromise(p, mode) {\n return this.accessSync(p, mode);\n }\n accessSync(p, mode) {\n const resolvedP = this.resolveFilename(`access '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) {\n throw Object.assign(new Error(`ENOENT: no such file or directory, access '${p}'`), { code: `ENOENT` });\n }\n }\n async statPromise(p) {\n return this.statSync(p);\n }\n statSync(p) {\n const resolvedP = this.resolveFilename(`stat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, stat '${p}'`), { code: `ENOENT` });\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, stat '${p}'`), { code: `ENOTDIR` });\n return this.statImpl(`stat '${p}'`, resolvedP);\n }\n async lstatPromise(p) {\n return this.lstatSync(p);\n }\n lstatSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, lstat '${p}'`), { code: `ENOENT` });\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, lstat '${p}'`), { code: `ENOTDIR` });\n return this.statImpl(`lstat '${p}'`, resolvedP);\n }\n statImpl(reason, p) {\n if (this.listings.has(p)) {\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = 0;\n const blksize = 512;\n const blocks = 0;\n const atimeMs = this.stats.mtimeMs;\n const birthtimeMs = this.stats.mtimeMs;\n const ctimeMs = this.stats.mtimeMs;\n const mtimeMs = this.stats.mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = S_IFDIR | 0o755;\n return Object.assign(new StatEntry(), { uid, gid, size, blksize, blocks, atime, birthtime, ctime, mtime, atimeMs, birthtimeMs, ctimeMs, mtimeMs, mode });\n }\n const entry = this.entries.get(p);\n if (entry !== undefined) {\n const stat = libzip_1.default.struct.statS();\n const rc = libzip_1.default.statIndex(this.zip, entry, 0, 0, stat);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = (libzip_1.default.struct.statSize(stat) >>> 0);\n const blksize = 512;\n const blocks = Math.ceil(size / blksize);\n const mtimeMs = (libzip_1.default.struct.statMtime(stat) >>> 0) * 1000;\n const atimeMs = mtimeMs;\n const birthtimeMs = mtimeMs;\n const ctimeMs = mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = this.getUnixMode(entry, S_IFREG | 0o644);\n return Object.assign(new StatEntry(), { uid, gid, size, blksize, blocks, atime, birthtime, ctime, mtime, atimeMs, birthtimeMs, ctimeMs, mtimeMs, mode });\n }\n throw new Error(`Unreachable`);\n }\n getUnixMode(index, defaultMode) {\n const rc = libzip_1.default.file.getExternalAttributes(this.zip, index, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n return defaultMode;\n return libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n }\n registerListing(p) {\n let listing = this.listings.get(p);\n if (listing)\n return listing;\n const parentListing = this.registerListing(path_1.ppath.dirname(p));\n listing = new Set();\n parentListing.add(path_1.ppath.basename(p));\n this.listings.set(p, listing);\n return listing;\n }\n registerEntry(p, index) {\n const parentListing = this.registerListing(path_1.ppath.dirname(p));\n parentListing.add(path_1.ppath.basename(p));\n this.entries.set(p, index);\n }\n resolveFilename(reason, p, resolveLastComponent = true) {\n if (!this.ready)\n throw Object.assign(new Error(`EBUSY: archive closed, ${reason}`), { code: `EBUSY` });\n let resolvedP = path_1.ppath.resolve(path_1.PortablePath.root, p);\n if (resolvedP === `/`)\n return path_1.PortablePath.root;\n while (true) {\n const parentP = this.resolveFilename(reason, path_1.ppath.dirname(resolvedP), true);\n const isDir = this.listings.has(parentP);\n const doesExist = this.entries.has(parentP);\n if (!isDir && !doesExist)\n throw Object.assign(new Error(`ENOENT: no such file or directory, ${reason}`), { code: `ENOENT` });\n if (!isDir)\n throw Object.assign(new Error(`ENOTDIR: not a directory, ${reason}`), { code: `ENOTDIR` });\n resolvedP = path_1.ppath.resolve(parentP, path_1.ppath.basename(resolvedP));\n if (!resolveLastComponent)\n break;\n const index = libzip_1.default.name.locate(this.zip, resolvedP);\n if (index === -1)\n break;\n if (this.isSymbolicLink(index)) {\n const target = this.getFileSource(index).toString();\n resolvedP = path_1.ppath.resolve(path_1.ppath.dirname(resolvedP), target);\n }\n else {\n break;\n }\n }\n return resolvedP;\n }\n allocateBuffer(content) {\n if (!Buffer.isBuffer(content))\n content = Buffer.from(content);\n const buffer = libzip_1.default.malloc(content.byteLength);\n if (!buffer)\n throw new Error(`Couldn't allocate enough memory`);\n // Copy the file into the Emscripten heap\n const heap = new Uint8Array(libzip_1.default.HEAPU8.buffer, buffer, content.byteLength);\n heap.set(content);\n return { buffer, byteLength: content.byteLength };\n }\n allocateUnattachedSource(content) {\n const error = libzip_1.default.struct.errorS();\n const { buffer, byteLength } = this.allocateBuffer(content);\n const source = libzip_1.default.source.fromUnattachedBuffer(buffer, byteLength, 0, true, error);\n if (source === 0) {\n libzip_1.default.free(error);\n throw new Error(libzip_1.default.error.strerror(error));\n }\n return source;\n }\n allocateSource(content) {\n const { buffer, byteLength } = this.allocateBuffer(content);\n const source = libzip_1.default.source.fromBuffer(this.zip, buffer, byteLength, 0, true);\n if (source === 0) {\n libzip_1.default.free(buffer);\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n return source;\n }\n setFileSource(p, content) {\n const target = path_1.ppath.relative(path_1.PortablePath.root, p);\n const lzSource = this.allocateSource(content);\n try {\n return libzip_1.default.file.add(this.zip, target, lzSource, libzip_1.default.ZIP_FL_OVERWRITE);\n }\n catch (error) {\n libzip_1.default.source.free(lzSource);\n throw error;\n }\n }\n isSymbolicLink(index) {\n const attrs = libzip_1.default.file.getExternalAttributes(this.zip, index, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (attrs === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n return false;\n const attributes = libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n return (attributes & S_IFMT) === S_IFLNK;\n }\n getFileSource(index) {\n const stat = libzip_1.default.struct.statS();\n const rc = libzip_1.default.statIndex(this.zip, index, 0, 0, stat);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const size = libzip_1.default.struct.statSize(stat);\n const buffer = libzip_1.default.malloc(size);\n try {\n const file = libzip_1.default.fopenIndex(this.zip, index, 0, 0);\n if (file === 0)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n try {\n const rc = libzip_1.default.fread(file, buffer, size, 0);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.file.getError(file)));\n else if (rc < size)\n throw new Error(`Incomplete read`);\n else if (rc > size)\n throw new Error(`Overread`);\n const memory = libzip_1.default.HEAPU8.subarray(buffer, buffer + size);\n const data = Buffer.from(memory);\n return data;\n }\n finally {\n libzip_1.default.fclose(file);\n }\n }\n finally {\n libzip_1.default.free(buffer);\n }\n }\n async chmodPromise(p, mask) {\n return this.chmodSync(p, mask);\n }\n chmodSync(p, mask) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false);\n // We silently ignore chmod requests for directories\n if (this.listings.has(resolvedP))\n return;\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const oldMod = this.getUnixMode(entry, S_IFREG | 0o000);\n const newMod = oldMod & (~0o777) | mask;\n const rc = libzip_1.default.file.setExternalAttributes(this.zip, entry, 0, 0, libzip_1.default.ZIP_OPSYS_UNIX, newMod << 16);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async renamePromise(oldP, newP) {\n return this.renameSync(oldP, newP);\n }\n renameSync(oldP, newP) {\n throw new Error(`Unimplemented`);\n }\n async copyFilePromise(sourceP, destP, flags) {\n return this.copyFileSync(sourceP, destP, flags);\n }\n copyFileSync(sourceP, destP, flags = 0) {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`ENOSYS: unsupported clone operation, copyfile '${sourceP}' -> ${destP}'`), { code: `ENOSYS` });\n const resolvedSourceP = this.resolveFilename(`copyfile '${sourceP} -> ${destP}'`, sourceP);\n const indexSource = this.entries.get(resolvedSourceP);\n if (typeof indexSource === `undefined`)\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n const resolvedDestP = this.resolveFilename(`copyfile '${sourceP}' -> ${destP}'`, destP);\n const indexDest = this.entries.get(resolvedDestP);\n if ((flags & (fs_1.constants.COPYFILE_EXCL | fs_1.constants.COPYFILE_FICLONE_FORCE)) !== 0 && typeof indexDest !== `undefined`)\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n const source = this.getFileSource(indexSource);\n const newIndex = this.setFileSource(resolvedDestP, source);\n if (newIndex !== indexDest) {\n this.registerEntry(resolvedDestP, newIndex);\n }\n }\n async writeFilePromise(p, content, opts) {\n return this.writeFileSync(p, content, opts);\n }\n writeFileSync(p, content, opts) {\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, open '${p}'`), { code: `EISDIR` });\n const index = this.entries.get(resolvedP);\n if (index !== undefined && typeof opts === `object` && opts.flag && opts.flag.includes(`a`))\n content = Buffer.concat([this.getFileSource(index), Buffer.from(content)]);\n let encoding = null;\n if (typeof opts === `string`)\n encoding = opts;\n else if (typeof opts === `object` && opts.encoding)\n encoding = opts.encoding;\n if (encoding !== null)\n content = content.toString(encoding);\n const newIndex = this.setFileSource(resolvedP, content);\n if (newIndex !== index) {\n this.registerEntry(resolvedP, newIndex);\n }\n }\n async unlinkPromise(p) {\n return this.unlinkSync(p);\n }\n unlinkSync(p) {\n throw new Error(`Unimplemented`);\n }\n async utimesPromise(p, atime, mtime) {\n return this.utimesSync(p, atime, mtime);\n }\n utimesSync(p, atime, mtime) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p);\n return this.utimesImpl(resolvedP, mtime);\n }\n async lutimesPromise(p, atime, mtime) {\n return this.lutimesSync(p, atime, mtime);\n }\n lutimesSync(p, atime, mtime) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false);\n return this.utimesImpl(resolvedP, mtime);\n }\n utimesImpl(resolvedP, mtime) {\n if (this.listings.has(resolvedP))\n if (!this.entries.has(resolvedP))\n this.hydrateDirectory(resolvedP);\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const rc = libzip_1.default.file.setMtime(this.zip, entry, 0, toUnixTimestamp(mtime), 0);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async mkdirPromise(p) {\n return this.mkdirSync(p);\n }\n mkdirSync(p) {\n const resolvedP = this.resolveFilename(`mkdir '${p}'`, p);\n if (this.entries.has(resolvedP) || this.listings.has(resolvedP))\n throw Object.assign(new Error(`EEXIST: file already exists, mkdir '${p}'`), { code: `EEXIST` });\n this.hydrateDirectory(resolvedP);\n }\n async rmdirPromise(p) {\n return this.rmdirSync(p);\n }\n rmdirSync(p) {\n throw new Error(`Unimplemented`);\n }\n hydrateDirectory(resolvedP) {\n const index = libzip_1.default.dir.add(this.zip, path_1.ppath.relative(path_1.PortablePath.root, resolvedP));\n if (index === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n this.registerListing(resolvedP);\n this.registerEntry(resolvedP, index);\n return index;\n }\n async symlinkPromise(target, p) {\n return this.symlinkSync(target, p);\n }\n symlinkSync(target, p) {\n const resolvedP = this.resolveFilename(`symlink '${target}' -> '${p}'`, p);\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, symlink '${target}' -> '${p}'`), { code: `EISDIR` });\n if (this.entries.has(resolvedP))\n throw Object.assign(new Error(`EEXIST: file already exists, symlink '${target}' -> '${p}'`), { code: `EEXIST` });\n const index = this.setFileSource(resolvedP, target);\n this.registerEntry(resolvedP, index);\n const rc = libzip_1.default.file.setExternalAttributes(this.zip, index, 0, 0, libzip_1.default.ZIP_OPSYS_UNIX, (0o120000 | 0o777) << 16);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async readFilePromise(p, encoding) {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.readFileSync(p, encoding);\n default:\n return this.readFileSync(p, encoding);\n }\n }\n readFileSync(p, encoding) {\n // This is messed up regarding the TS signatures\n if (typeof encoding === `object`)\n // @ts-ignore\n encoding = encoding ? encoding.encoding : undefined;\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, open '${p}'`), { code: `ENOENT` });\n // Ensures that the last component is a directory, if the user said so (even if it is we'll throw right after with EISDIR anyway)\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, open '${p}'`), { code: `ENOTDIR` });\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, read`), { code: `EISDIR` });\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const data = this.getFileSource(entry);\n return encoding ? data.toString(encoding) : data;\n }\n async readdirPromise(p) {\n return this.readdirSync(p);\n }\n readdirSync(p) {\n const resolvedP = this.resolveFilename(`scandir '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, scandir '${p}'`), { code: `ENOENT` });\n const directoryListing = this.listings.get(resolvedP);\n if (!directoryListing)\n throw Object.assign(new Error(`ENOTDIR: not a directory, scandir '${p}'`), { code: `ENOTDIR` });\n return Array.from(directoryListing);\n }\n async readlinkPromise(p) {\n return this.readlinkSync(p);\n }\n readlinkSync(p) {\n const resolvedP = this.resolveFilename(`readlink '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, readlink '${p}'`), { code: `ENOENT` });\n // Ensure that the last component is a directory (if it is we'll throw right after with EISDIR anyway)\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, open '${p}'`), { code: `ENOTDIR` });\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const rc = libzip_1.default.file.getExternalAttributes(this.zip, entry, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n const attributes = libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n if ((attributes & 0o170000) !== 0o120000)\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n return this.getFileSource(entry).toString();\n }\n watch(p, a, b) {\n let persistent;\n switch (typeof a) {\n case `function`:\n case `string`:\n case `undefined`:\n {\n persistent = true;\n }\n break;\n default:\n {\n // @ts-ignore\n ({ persistent = true } = a);\n }\n break;\n }\n if (!persistent)\n return { on: () => { }, close: () => { } };\n const interval = setInterval(() => { }, 24 * 60 * 60 * 1000);\n return { on: () => { }, close: () => { clearInterval(interval); } };\n }\n}\nexports.ZipFS = ZipFS;\n;\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ErrorCode;\n(function (ErrorCode) {\n ErrorCode[\"API_ERROR\"] = \"API_ERROR\";\n ErrorCode[\"BLACKLISTED\"] = \"BLACKLISTED\";\n ErrorCode[\"BUILTIN_NODE_RESOLUTION_FAILED\"] = \"BUILTIN_NODE_RESOLUTION_FAILED\";\n ErrorCode[\"MISSING_DEPENDENCY\"] = \"MISSING_DEPENDENCY\";\n ErrorCode[\"MISSING_PEER_DEPENDENCY\"] = \"MISSING_PEER_DEPENDENCY\";\n ErrorCode[\"QUALIFIED_PATH_RESOLUTION_FAILED\"] = \"QUALIFIED_PATH_RESOLUTION_FAILED\";\n ErrorCode[\"INTERNAL\"] = \"INTERNAL\";\n ErrorCode[\"UNDECLARED_DEPENDENCY\"] = \"UNDECLARED_DEPENDENCY\";\n ErrorCode[\"UNSUPPORTED\"] = \"UNSUPPORTED\";\n})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));\n;\n// Some errors are exposed as MODULE_NOT_FOUND for compatibility with packages\n// that expect this umbrella error when the resolution fails\nconst MODULE_NOT_FOUND_ERRORS = new Set([\n ErrorCode.BLACKLISTED,\n ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED,\n ErrorCode.MISSING_DEPENDENCY,\n ErrorCode.MISSING_PEER_DEPENDENCY,\n ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED,\n ErrorCode.UNDECLARED_DEPENDENCY,\n]);\n/**\n * Simple helper function that assign an error code to an error, so that it can more easily be caught and used\n * by third-parties.\n */\nfunction makeError(pnpCode, message, data = {}) {\n const code = MODULE_NOT_FOUND_ERRORS.has(pnpCode)\n ? `MODULE_NOT_FOUND`\n : pnpCode;\n return Object.assign(new Error(message), {\n code, pnpCode, data,\n });\n}\nexports.makeError = makeError;\n/**\n * Returns the module that should be used to resolve require calls. It's usually the direct parent, except if we're\n * inside an eval expression.\n */\nfunction getIssuerModule(parent) {\n let issuer = parent;\n while (issuer && (issuer.id === '[eval]' || issuer.id === '' || !issuer.filename))\n issuer = issuer.parent;\n return issuer;\n}\nexports.getIssuerModule = getIssuerModule;\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nconst fs_1 = __importDefault(__webpack_require__(2));\nconst module_1 = __importDefault(__webpack_require__(7));\nconst path_1 = __importDefault(__webpack_require__(4));\nconst string_decoder_1 = __importDefault(__webpack_require__(25));\nconst applyPatch_1 = __webpack_require__(26);\nconst hydrateRuntimeState_1 = __webpack_require__(27);\nconst makeApi_1 = __webpack_require__(28);\n// We must copy the fs into a local, because otherwise\n// 1. we would make the NodeFS instance use the function that we patched (infinite loop)\n// 2. Object.create(fs) isn't enough, since it won't prevent the proto from being modified\nconst localFs = Object.assign({}, fs_1.default);\nconst nodeFs = new fslib_1.NodeFS(localFs);\nconst runtimeState = $$SETUP_STATE(hydrateRuntimeState_1.hydrateRuntimeState);\nlet underlyingFs = new fslib_1.ZipOpenFS({ baseFs: nodeFs });\nfor (const virtualRoot of runtimeState.virtualRoots)\n underlyingFs = new fslib_1.VirtualFS(virtualRoot, { baseFs: underlyingFs });\nmodule.exports = makeApi_1.makeApi(runtimeState, {\n compatibilityMode: true,\n fakeFs: underlyingFs,\n pnpapiResolution: path_1.default.resolve(__dirname, __filename),\n});\nmodule.exports.setup = () => {\n applyPatch_1.applyPatch(module.exports, {\n compatibilityMode: true,\n fakeFs: underlyingFs,\n });\n};\nif (__non_webpack_module__.parent && __non_webpack_module__.parent.id === 'internal/preload') {\n module.exports.setup();\n if (__non_webpack_module__.filename) {\n // We delete it from the cache in order to support the case where the CLI resolver is invoked from \"yarn run\"\n // It's annoying because it might cause some issues when the file is multiple times in NODE_OPTIONS, but it shouldn't happen anyway.\n // @ts-ignore\n delete module_1.default._cache[__non_webpack_module__.filename];\n }\n}\n// @ts-ignore\nif (process.mainModule === __non_webpack_module__) {\n const reportError = (code, message, data) => {\n process.stdout.write(`${JSON.stringify([{ code, message, data }, null])}\\n`);\n };\n const reportSuccess = (resolution) => {\n process.stdout.write(`${JSON.stringify([null, resolution])}\\n`);\n };\n const processResolution = (request, issuer) => {\n try {\n reportSuccess(module.exports.resolveRequest(request, issuer));\n }\n catch (error) {\n reportError(error.code, error.message, error.data);\n }\n };\n const processRequest = (data) => {\n try {\n const [request, issuer] = JSON.parse(data);\n processResolution(request, issuer);\n }\n catch (error) {\n reportError(`INVALID_JSON`, error.message, error.data);\n }\n };\n if (process.argv.length > 2) {\n if (process.argv.length !== 4) {\n process.stderr.write(`Usage: ${process.argv[0]} ${process.argv[1]} \\n`);\n process.exitCode = 64; /* EX_USAGE */\n }\n else {\n processResolution(process.argv[2], process.argv[3]);\n }\n }\n else {\n let buffer = '';\n const decoder = new string_decoder_1.default.StringDecoder();\n process.stdin.on('data', chunk => {\n buffer += decoder.write(chunk);\n do {\n const index = buffer.indexOf('\\n');\n if (index === -1)\n break;\n const line = buffer.slice(0, index);\n buffer = buffer.slice(index + 1);\n processRequest(line);\n } while (true);\n });\n }\n}\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/*!\n * Tmp\n *\n * Copyright (c) 2011-2017 KARASZI Istvan \n *\n * MIT Licensed\n */\n\n/*\n * Module dependencies.\n */\nconst fs = __webpack_require__(2);\nconst path = __webpack_require__(4);\nconst crypto = __webpack_require__(8);\nconst osTmpDir = __webpack_require__(13);\nconst _c = process.binding('constants');\n\n/*\n * The working inner variables.\n */\nconst\n /**\n * The temporary directory.\n * @type {string}\n */\n tmpDir = osTmpDir(),\n\n // the random characters to choose from\n RANDOM_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',\n\n TEMPLATE_PATTERN = /XXXXXX/,\n\n DEFAULT_TRIES = 3,\n\n CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR),\n\n EBADF = _c.EBADF || _c.os.errno.EBADF,\n ENOENT = _c.ENOENT || _c.os.errno.ENOENT,\n\n DIR_MODE = 448 /* 0o700 */,\n FILE_MODE = 384 /* 0o600 */,\n\n // this will hold the objects need to be removed on exit\n _removeObjects = [];\n\nvar\n _gracefulCleanup = false,\n _uncaughtException = false;\n\n/**\n * Random name generator based on crypto.\n * Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript\n *\n * @param {number} howMany\n * @returns {string} the generated random name\n * @private\n */\nfunction _randomChars(howMany) {\n var\n value = [],\n rnd = null;\n\n // make sure that we do not fail because we ran out of entropy\n try {\n rnd = crypto.randomBytes(howMany);\n } catch (e) {\n rnd = crypto.pseudoRandomBytes(howMany);\n }\n\n for (var i = 0; i < howMany; i++) {\n value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);\n }\n\n return value.join('');\n}\n\n/**\n * Checks whether the `obj` parameter is defined or not.\n *\n * @param {Object} obj\n * @returns {boolean} true if the object is undefined\n * @private\n */\nfunction _isUndefined(obj) {\n return typeof obj === 'undefined';\n}\n\n/**\n * Parses the function arguments.\n *\n * This function helps to have optional arguments.\n *\n * @param {(Options|Function)} options\n * @param {Function} callback\n * @returns {Array} parsed arguments\n * @private\n */\nfunction _parseArguments(options, callback) {\n if (typeof options == 'function') {\n return [callback || {}, options];\n }\n\n if (_isUndefined(options)) {\n return [{}, callback];\n }\n\n return [options, callback];\n}\n\n/**\n * Generates a new temporary name.\n *\n * @param {Object} opts\n * @returns {string} the new random name according to opts\n * @private\n */\nfunction _generateTmpName(opts) {\n if (opts.name) {\n return path.join(opts.dir || tmpDir, opts.name);\n }\n\n // mkstemps like template\n if (opts.template) {\n return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6));\n }\n\n // prefix and postfix\n const name = [\n opts.prefix || 'tmp-',\n process.pid,\n _randomChars(12),\n opts.postfix || ''\n ].join('');\n\n return path.join(opts.dir || tmpDir, name);\n}\n\n/**\n * Gets a temporary file name.\n *\n * @param {(Options|tmpNameCallback)} options options or callback\n * @param {?tmpNameCallback} callback the callback function\n */\nfunction tmpName(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1],\n tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;\n\n if (isNaN(tries) || tries < 0)\n return cb(new Error('Invalid tries'));\n\n if (opts.template && !opts.template.match(TEMPLATE_PATTERN))\n return cb(new Error('Invalid template provided'));\n\n (function _getUniqueName() {\n const name = _generateTmpName(opts);\n\n // check whether the path exists then retry if needed\n fs.stat(name, function (err) {\n if (!err) {\n if (tries-- > 0) return _getUniqueName();\n\n return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));\n }\n\n cb(null, name);\n });\n }());\n}\n\n/**\n * Synchronous version of tmpName.\n *\n * @param {Object} options\n * @returns {string} the generated random name\n * @throws {Error} if the options are invalid or could not generate a filename\n */\nfunction tmpNameSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0],\n tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;\n\n if (isNaN(tries) || tries < 0)\n throw new Error('Invalid tries');\n\n if (opts.template && !opts.template.match(TEMPLATE_PATTERN))\n throw new Error('Invalid template provided');\n\n do {\n const name = _generateTmpName(opts);\n try {\n fs.statSync(name);\n } catch (e) {\n return name;\n }\n } while (tries-- > 0);\n\n throw new Error('Could not get a unique tmp filename, max tries reached');\n}\n\n/**\n * Creates and opens a temporary file.\n *\n * @param {(Options|fileCallback)} options the config options or the callback function\n * @param {?fileCallback} callback\n */\nfunction file(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1];\n\n opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix;\n\n // gets a temporary filename\n tmpName(opts, function _tmpNameCreated(err, name) {\n if (err) return cb(err);\n\n // create and open the file\n fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) {\n if (err) return cb(err);\n\n if (opts.discardDescriptor) {\n return fs.close(fd, function _discardCallback(err) {\n if (err) {\n // Low probability, and the file exists, so this could be\n // ignored. If it isn't we certainly need to unlink the\n // file, and if that fails too its error is more\n // important.\n try {\n fs.unlinkSync(name);\n } catch (e) {\n if (!isENOENT(e)) {\n err = e;\n }\n }\n return cb(err);\n }\n cb(null, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts));\n });\n }\n if (opts.detachDescriptor) {\n return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts));\n }\n cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts));\n });\n });\n}\n\n/**\n * Synchronous version of file.\n *\n * @param {Options} options\n * @returns {FileSyncObject} object consists of name, fd and removeCallback\n * @throws {Error} if cannot create a file\n */\nfunction fileSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0];\n\n opts.postfix = opts.postfix || '.tmp';\n\n const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;\n const name = tmpNameSync(opts);\n var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);\n if (opts.discardDescriptor) {\n fs.closeSync(fd); \n fd = undefined;\n }\n\n return {\n name: name,\n fd: fd,\n removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts)\n };\n}\n\n/**\n * Removes files and folders in a directory recursively.\n *\n * @param {string} root\n * @private\n */\nfunction _rmdirRecursiveSync(root) {\n const dirs = [root];\n\n do {\n var\n dir = dirs.pop(),\n deferred = false,\n files = fs.readdirSync(dir);\n\n for (var i = 0, length = files.length; i < length; i++) {\n var\n file = path.join(dir, files[i]),\n stat = fs.lstatSync(file); // lstat so we don't recurse into symlinked directories\n\n if (stat.isDirectory()) {\n if (!deferred) {\n deferred = true;\n dirs.push(dir);\n }\n dirs.push(file);\n } else {\n fs.unlinkSync(file);\n }\n }\n\n if (!deferred) {\n fs.rmdirSync(dir);\n }\n } while (dirs.length !== 0);\n}\n\n/**\n * Creates a temporary directory.\n *\n * @param {(Options|dirCallback)} options the options or the callback function\n * @param {?dirCallback} callback\n */\nfunction dir(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1];\n\n // gets a temporary filename\n tmpName(opts, function _tmpNameCreated(err, name) {\n if (err) return cb(err);\n\n // create the directory\n fs.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err) {\n if (err) return cb(err);\n\n cb(null, name, _prepareTmpDirRemoveCallback(name, opts));\n });\n });\n}\n\n/**\n * Synchronous version of dir.\n *\n * @param {Options} options\n * @returns {DirSyncObject} object consists of name and removeCallback\n * @throws {Error} if it cannot create a directory\n */\nfunction dirSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0];\n\n const name = tmpNameSync(opts);\n fs.mkdirSync(name, opts.mode || DIR_MODE);\n\n return {\n name: name,\n removeCallback: _prepareTmpDirRemoveCallback(name, opts)\n };\n}\n\n/**\n * Prepares the callback for removal of the temporary file.\n *\n * @param {string} name the path of the file\n * @param {number} fd file descriptor\n * @param {Object} opts\n * @returns {fileCallback}\n * @private\n */\nfunction _prepareTmpFileRemoveCallback(name, fd, opts) {\n const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) {\n try {\n if (0 <= fdPath[0]) {\n fs.closeSync(fdPath[0]);\n }\n }\n catch (e) {\n // under some node/windows related circumstances, a temporary file\n // may have not be created as expected or the file was already closed\n // by the user, in which case we will simply ignore the error\n if (!isEBADF(e) && !isENOENT(e)) {\n // reraise any unanticipated error\n throw e;\n }\n }\n try {\n fs.unlinkSync(fdPath[1]);\n }\n catch (e) {\n if (!isENOENT(e)) {\n // reraise any unanticipated error\n throw e;\n }\n }\n }, [fd, name]);\n\n if (!opts.keep) {\n _removeObjects.unshift(removeCallback);\n }\n\n return removeCallback;\n}\n\n/**\n * Prepares the callback for removal of the temporary directory.\n *\n * @param {string} name\n * @param {Object} opts\n * @returns {Function} the callback\n * @private\n */\nfunction _prepareTmpDirRemoveCallback(name, opts) {\n const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs.rmdirSync.bind(fs);\n const removeCallback = _prepareRemoveCallback(removeFunction, name);\n\n if (!opts.keep) {\n _removeObjects.unshift(removeCallback);\n }\n\n return removeCallback;\n}\n\n/**\n * Creates a guarded function wrapping the removeFunction call.\n *\n * @param {Function} removeFunction\n * @param {Object} arg\n * @returns {Function}\n * @private\n */\nfunction _prepareRemoveCallback(removeFunction, arg) {\n var called = false;\n\n return function _cleanupCallback(next) {\n if (!called) {\n const index = _removeObjects.indexOf(_cleanupCallback);\n if (index >= 0) {\n _removeObjects.splice(index, 1);\n }\n\n called = true;\n removeFunction(arg);\n }\n\n if (next) next(null);\n };\n}\n\n/**\n * The garbage collector.\n *\n * @private\n */\nfunction _garbageCollector() {\n if (_uncaughtException && !_gracefulCleanup) {\n return;\n }\n\n // the function being called removes itself from _removeObjects,\n // loop until _removeObjects is empty\n while (_removeObjects.length) {\n try {\n _removeObjects[0].call(null);\n } catch (e) {\n // already removed?\n }\n }\n}\n\n/**\n * Helper for testing against EBADF to compensate changes made to Node 7.x under Windows.\n */\nfunction isEBADF(error) {\n return isExpectedError(error, -EBADF, 'EBADF');\n}\n\n/**\n * Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows.\n */\nfunction isENOENT(error) {\n return isExpectedError(error, -ENOENT, 'ENOENT');\n}\n\n/**\n * Helper to determine whether the expected error code matches the actual code and errno,\n * which will differ between the supported node versions.\n *\n * - Node >= 7.0:\n * error.code {String}\n * error.errno {String|Number} any numerical value will be negated\n *\n * - Node >= 6.0 < 7.0:\n * error.code {String}\n * error.errno {Number} negated\n *\n * - Node >= 4.0 < 6.0: introduces SystemError\n * error.code {String}\n * error.errno {Number} negated\n *\n * - Node >= 0.10 < 4.0:\n * error.code {Number} negated\n * error.errno n/a\n */\nfunction isExpectedError(error, code, errno) {\n return error.code == code || error.code == errno;\n}\n\n/**\n * Sets the graceful cleanup.\n *\n * Also removes the created files and directories when an uncaught exception occurs.\n */\nfunction setGracefulCleanup() {\n _gracefulCleanup = true;\n}\n\nconst version = process.versions.node.split('.').map(function (value) {\n return parseInt(value, 10);\n});\n\nif (version[0] === 0 && (version[1] < 9 || version[1] === 9 && version[2] < 5)) {\n process.addListener('uncaughtException', function _uncaughtExceptionThrown(err) {\n _uncaughtException = true;\n _garbageCollector();\n\n throw err;\n });\n}\n\nprocess.addListener('exit', function _exit(code) {\n if (code) _uncaughtException = true;\n _garbageCollector();\n});\n\n/**\n * Configuration options.\n *\n * @typedef {Object} Options\n * @property {?number} tries the number of tries before give up the name generation\n * @property {?string} template the \"mkstemp\" like filename template\n * @property {?string} name fix name\n * @property {?string} dir the tmp directory to use\n * @property {?string} prefix prefix for the generated name\n * @property {?string} postfix postfix for the generated name\n */\n\n/**\n * @typedef {Object} FileSyncObject\n * @property {string} name the name of the file\n * @property {string} fd the file descriptor\n * @property {fileCallback} removeCallback the callback function to remove the file\n */\n\n/**\n * @typedef {Object} DirSyncObject\n * @property {string} name the name of the directory\n * @property {fileCallback} removeCallback the callback function to remove the directory\n */\n\n/**\n * @callback tmpNameCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n */\n\n/**\n * @callback fileCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n * @param {number} fd the file descriptor\n * @param {cleanupCallback} fn the cleanup callback function\n */\n\n/**\n * @callback dirCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n * @param {cleanupCallback} fn the cleanup callback function\n */\n\n/**\n * Removes the temporary created file or directory.\n *\n * @callback cleanupCallback\n * @param {simpleCallback} [next] function to call after entry was removed\n */\n\n/**\n * Callback function for function composition.\n * @see {@link https://github.com/raszi/node-tmp/issues/57|raszi/node-tmp#57}\n *\n * @callback simpleCallback\n */\n\n// exporting all the needed methods\nmodule.exports.tmpdir = tmpDir;\n\nmodule.exports.dir = dir;\nmodule.exports.dirSync = dirSync;\n\nmodule.exports.file = file;\nmodule.exports.fileSync = fileSync;\n\nmodule.exports.tmpName = tmpName;\nmodule.exports.tmpNameSync = tmpNameSync;\n\nmodule.exports.setGracefulCleanup = setGracefulCleanup;\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar isWindows = process.platform === 'win32';\nvar trailingSlashRe = isWindows ? /[^:]\\\\$/ : /.\\/$/;\n\n// https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43\nmodule.exports = function () {\n\tvar path;\n\n\tif (isWindows) {\n\t\tpath = process.env.TEMP ||\n\t\t\tprocess.env.TMP ||\n\t\t\t(process.env.SystemRoot || process.env.windir) + '\\\\temp';\n\t} else {\n\t\tpath = process.env.TMPDIR ||\n\t\t\tprocess.env.TMP ||\n\t\t\tprocess.env.TEMP ||\n\t\t\t'/tmp';\n\t}\n\n\tif (trailingSlashRe.test(path)) {\n\t\tpath = path.slice(0, -1);\n\t}\n\n\treturn path;\n};\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst ProxiedFS_1 = __webpack_require__(3);\nclass AliasFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs, pathUtils }) {\n super(pathUtils);\n this.target = target;\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.target;\n }\n getBaseFs() {\n return this.baseFs;\n }\n mapFromBase(p) {\n return p;\n }\n mapToBase(p) {\n return p;\n }\n}\nexports.AliasFS = AliasFS;\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\nclass CwdFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.target = target;\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.target);\n }\n mapFromBase(path) {\n return this.pathUtils.relative(this.getRealPath(), path);\n }\n mapToBase(path) {\n return this.pathUtils.resolve(this.getRealPath(), path);\n }\n}\nexports.CwdFS = CwdFS;\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\nconst JAIL_ROOT = path_1.PortablePath.root;\nclass JailFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.target = this.pathUtils.resolve(path_1.PortablePath.root, target);\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.pathUtils.relative(path_1.PortablePath.root, this.target));\n }\n getTarget() {\n return this.target;\n }\n getBaseFs() {\n return this.baseFs;\n }\n mapToBase(p) {\n const normalized = this.pathUtils.normalize(p);\n if (this.pathUtils.isAbsolute(p))\n return this.pathUtils.resolve(this.target, this.pathUtils.relative(JAIL_ROOT, p));\n if (normalized.match(/^\\.\\.\\//))\n throw new Error(`Resolving this path (${p}) would escape the jail`);\n return this.pathUtils.resolve(this.target, p);\n }\n mapFromBase(p) {\n return this.pathUtils.resolve(JAIL_ROOT, this.pathUtils.relative(this.target, p));\n }\n}\nexports.JailFS = JailFS;\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst ProxiedFS_1 = __webpack_require__(3);\nclass LazyFS extends ProxiedFS_1.ProxiedFS {\n constructor(factory, pathUtils) {\n super(pathUtils);\n this.instance = null;\n this.factory = factory;\n }\n get baseFs() {\n if (!this.instance)\n this.instance = this.factory();\n return this.instance;\n }\n mapFromBase(p) {\n return p;\n }\n mapToBase(p) {\n return p;\n }\n}\nexports.LazyFS = LazyFS;\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\nclass PosixFS extends ProxiedFS_1.ProxiedFS {\n constructor(baseFs) {\n super(path_1.npath);\n this.baseFs = baseFs;\n }\n mapFromBase(path) {\n return NodeFS_1.NodeFS.fromPortablePath(path);\n }\n mapToBase(path) {\n return NodeFS_1.NodeFS.toPortablePath(path);\n }\n}\nexports.PosixFS = PosixFS;\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\n// https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js\nconst escapeRegexp = (s) => s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\nclass VirtualFS extends ProxiedFS_1.ProxiedFS {\n static makeVirtualPath(base, component, to) {\n // Obtains the relative distance between the virtual path and its actual target\n const target = path_1.ppath.relative(path_1.ppath.dirname(base), to);\n const segments = target.split(`/`);\n // Counts how many levels we need to go back to start applying the rest of the path\n let depth = 0;\n while (depth < segments.length && segments[depth] === `..`)\n depth += 1;\n const finalSegments = segments.slice(depth);\n const fullVirtualPath = path_1.ppath.join(base, component, String(depth), ...finalSegments);\n return fullVirtualPath;\n }\n constructor(virtual, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.baseFs = baseFs;\n this.target = path_1.ppath.dirname(virtual);\n this.virtual = virtual;\n this.mapToBaseRegExp = new RegExp(`^(${escapeRegexp(this.virtual)})((?:/([^\\/]+)(?:/([^/]+))?)?((?:/.*)?))$`);\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.target);\n }\n realpathSync(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return this.baseFs.realpathSync(p);\n if (!match[5])\n return p;\n const realpath = this.baseFs.realpathSync(this.mapToBase(p));\n return VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n async realpathPromise(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return await this.baseFs.realpathPromise(p);\n if (!match[5])\n return p;\n const realpath = await this.baseFs.realpathPromise(this.mapToBase(p));\n return VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n mapToBase(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return p;\n if (match[3])\n return this.mapToBase(path_1.ppath.join(this.target, `../`.repeat(Number(match[4])), match[5]));\n return this.target;\n }\n mapFromBase(p) {\n return p;\n }\n}\nexports.VirtualFS = VirtualFS;\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst libzip_1 = __importDefault(__webpack_require__(21));\nconst number64 = [\n `number`,\n `number`,\n];\n// eslint-disable-next-line arca/no-default-export\nexports.default = {\n // Those are getters because they can change after memory growth\n get HEAP8() { return libzip_1.default.HEAP8; },\n get HEAPU8() { return libzip_1.default.HEAPU8; },\n ZIP_CHECKCONS: 4,\n ZIP_CREATE: 1,\n ZIP_EXCL: 2,\n ZIP_TRUNCATE: 8,\n ZIP_RDONLY: 16,\n ZIP_FL_OVERWRITE: 8192,\n ZIP_OPSYS_DOS: 0x00,\n ZIP_OPSYS_AMIGA: 0x01,\n ZIP_OPSYS_OPENVMS: 0x02,\n ZIP_OPSYS_UNIX: 0x03,\n ZIP_OPSYS_VM_CMS: 0x04,\n ZIP_OPSYS_ATARI_ST: 0x05,\n ZIP_OPSYS_OS_2: 0x06,\n ZIP_OPSYS_MACINTOSH: 0x07,\n ZIP_OPSYS_Z_SYSTEM: 0x08,\n ZIP_OPSYS_CPM: 0x09,\n ZIP_OPSYS_WINDOWS_NTFS: 0x0a,\n ZIP_OPSYS_MVS: 0x0b,\n ZIP_OPSYS_VSE: 0x0c,\n ZIP_OPSYS_ACORN_RISC: 0x0d,\n ZIP_OPSYS_VFAT: 0x0e,\n ZIP_OPSYS_ALTERNATE_MVS: 0x0f,\n ZIP_OPSYS_BEOS: 0x10,\n ZIP_OPSYS_TANDEM: 0x11,\n ZIP_OPSYS_OS_400: 0x12,\n ZIP_OPSYS_OS_X: 0x13,\n uint08S: libzip_1.default._malloc(1),\n uint16S: libzip_1.default._malloc(2),\n uint32S: libzip_1.default._malloc(4),\n uint64S: libzip_1.default._malloc(8),\n malloc: libzip_1.default._malloc,\n free: libzip_1.default._free,\n getValue: libzip_1.default.getValue,\n open: libzip_1.default.cwrap(`zip_open`, `number`, [`string`, `number`, `number`]),\n openFromSource: libzip_1.default.cwrap(`zip_open_from_source`, `number`, [`number`, `number`, `number`]),\n close: libzip_1.default.cwrap(`zip_close`, `number`, [`number`]),\n discard: libzip_1.default.cwrap(`zip_discard`, `void`, [`number`]),\n getError: libzip_1.default.cwrap(`zip_get_error`, `number`, [`number`]),\n getName: libzip_1.default.cwrap(`zip_get_name`, `string`, [`number`, `number`, `number`]),\n getNumEntries: libzip_1.default.cwrap(`zip_get_num_entries`, `number`, [`number`, `number`]),\n stat: libzip_1.default.cwrap(`zip_stat`, `number`, [`number`, `string`, `number`, `number`]),\n statIndex: libzip_1.default.cwrap(`zip_stat_index`, `number`, [`number`, ...number64, `number`, `number`]),\n fopen: libzip_1.default.cwrap(`zip_fopen`, `number`, [`number`, `string`, `number`]),\n fopenIndex: libzip_1.default.cwrap(`zip_fopen_index`, `number`, [`number`, ...number64, `number`]),\n fread: libzip_1.default.cwrap(`zip_fread`, `number`, [`number`, `number`, `number`, `number`]),\n fclose: libzip_1.default.cwrap(`zip_fclose`, `number`, [`number`]),\n dir: {\n add: libzip_1.default.cwrap(`zip_dir_add`, `number`, [`number`, `string`]),\n },\n file: {\n add: libzip_1.default.cwrap(`zip_file_add`, `number`, [`number`, `string`, `number`, `number`]),\n getError: libzip_1.default.cwrap(`zip_file_get_error`, `number`, [`number`]),\n getExternalAttributes: libzip_1.default.cwrap(`zip_file_get_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setExternalAttributes: libzip_1.default.cwrap(`zip_file_set_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setMtime: libzip_1.default.cwrap(`zip_file_set_mtime`, `number`, [`number`, ...number64, `number`, `number`]),\n },\n error: {\n initWithCode: libzip_1.default.cwrap(`zip_error_init_with_code`, `void`, [`number`, `number`]),\n strerror: libzip_1.default.cwrap(`zip_error_strerror`, `string`, [`number`]),\n },\n name: {\n locate: libzip_1.default.cwrap(`zip_name_locate`, `number`, [`number`, `string`, `number`]),\n },\n source: {\n fromUnattachedBuffer: libzip_1.default.cwrap(`zip_source_buffer_create`, `number`, [`number`, `number`, `number`, `number`]),\n fromBuffer: libzip_1.default.cwrap(`zip_source_buffer`, `number`, [`number`, `number`, ...number64, `number`]),\n free: libzip_1.default.cwrap(`zip_source_free`, `void`, [`number`]),\n },\n struct: {\n stat: libzip_1.default.cwrap(`zipstruct_stat`, `number`, []),\n statS: libzip_1.default.cwrap(`zipstruct_statS`, `number`, []),\n statName: libzip_1.default.cwrap(`zipstruct_stat_name`, `string`, [`number`]),\n statIndex: libzip_1.default.cwrap(`zipstruct_stat_index`, `number`, [`number`]),\n statSize: libzip_1.default.cwrap(`zipstruct_stat_size`, `number`, [`number`]),\n statMtime: libzip_1.default.cwrap(`zipstruct_stat_mtime`, `number`, [`number`]),\n error: libzip_1.default.cwrap(`zipstruct_error`, `number`, []),\n errorS: libzip_1.default.cwrap(`zipstruct_errorS`, `number`, []),\n },\n};\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar frozenFs = Object.assign({}, __webpack_require__(2));\nvar Module=typeof Module!==\"undefined\"?Module:{};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_WORKER=false;var ENVIRONMENT_IS_NODE=true;if(Module[\"ENVIRONMENT\"]){throw new Error(\"Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)\")}var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}else{return scriptDirectory+path}}if(ENVIRONMENT_IS_NODE){if(!(typeof process===\"object\"&&\"function\"===\"function\"))throw new Error(\"not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)\");scriptDirectory=__dirname+\"/\";var nodeFS;var nodePath;Module[\"read\"]=function shell_read(filename,binary){var ret;ret=tryParseAsDataURI(filename);if(!ret){if(!nodeFS)nodeFS=frozenFs;if(!nodePath)nodePath=__webpack_require__(4);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);if(true){module[\"exports\"]=Module}(function(){})(\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});(function(){})(\"unhandledRejection\",abort);Module[\"quit\"]=function(status){process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else{throw new Error(\"environment detection error\")}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;assert(typeof Module[\"memoryInitializerPrefixURL\"]===\"undefined\",\"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"pthreadMainPrefixURL\"]===\"undefined\",\"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"cdInitializerPrefixURL\"]===\"undefined\",\"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"filePackagePrefixURL\"]===\"undefined\",\"Module.filePackagePrefixURL option was removed, use Module.locateFile instead\");stackSave=stackRestore=stackAlloc=function(){abort(\"cannot use the stack before compiled code is ready to run, and has provided stack access\")};function dynamicAlloc(size){assert(DYNAMICTOP_PTR);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}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}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\"){abort(\"No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.\")}function getValue(ptr,type,noSafe){type=type||\"i8\";if(type.charAt(type.length-1)===\"*\")type=\"i32\";if(noSafe){switch(type){case\"i1\":return HEAP8[ptr>>0];case\"i8\":return HEAP8[ptr>>0];case\"i16\":return HEAP16[ptr>>1];case\"i32\":return HEAP32[ptr>>2];case\"i64\":return HEAP32[ptr>>2];case\"float\":return HEAPF32[ptr>>2];case\"double\":return HEAPF64[ptr>>3];default:abort(\"invalid type for getValue: \"+type)}}else{switch(type){case\"i1\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i8\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i16\":return SAFE_HEAP_LOAD(ptr|0,2,0)|0;case\"i32\":return SAFE_HEAP_LOAD(ptr|0,4,0)|0;case\"i64\":return SAFE_HEAP_LOAD(ptr|0,8,0)|0;case\"float\":return Math_fround(SAFE_HEAP_LOAD_D(ptr|0,4,0));case\"double\":return+SAFE_HEAP_LOAD_D(ptr|0,8,0);default:abort(\"invalid type for getValue: \"+type)}}return null}function getSafeHeapType(bytes,isFloat){switch(bytes){case 1:return\"i8\";case 2:return\"i16\";case 4:return isFloat?\"float\":\"i32\";case 8:return\"double\";default:assert(0)}}function SAFE_HEAP_STORE(dest,value,bytes,isFloat){if(dest<=0)abort(\"segmentation fault storing \"+bytes+\" bytes to address \"+dest);if(dest%bytes!==0)abort(\"alignment error storing to address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when storing \"+bytes+\" bytes to address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);setValue(dest,value,getSafeHeapType(bytes,isFloat),1)}function SAFE_HEAP_STORE_D(dest,value,bytes){SAFE_HEAP_STORE(dest,value,bytes,true)}function SAFE_HEAP_LOAD(dest,bytes,unsigned,isFloat){if(dest<=0)abort(\"segmentation fault loading \"+bytes+\" bytes from address \"+dest);if(dest%bytes!==0)abort(\"alignment error loading from address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when loading \"+bytes+\" bytes from address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);var type=getSafeHeapType(bytes,isFloat);var ret=getValue(dest,type,1);if(unsigned)ret=unSign(ret,parseInt(type.substr(1)),1);return ret}function SAFE_HEAP_LOAD_D(dest,bytes,unsigned){return SAFE_HEAP_LOAD(dest,bytes,unsigned,true)}function segfault(){abort(\"segmentation fault\")}function alignfault(){abort(\"alignment fault\")}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;assert(returnType!==\"array\",'Return type should not be \"array\".');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)}}else{switch(type){case\"i1\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i8\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i16\":SAFE_HEAP_STORE(ptr|0,value|0,2);break;case\"i32\":SAFE_HEAP_STORE(ptr|0,value|0,4);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)],SAFE_HEAP_STORE(ptr|0,tempI64[0]|0,4),SAFE_HEAP_STORE(ptr+4|0,tempI64[1]|0,4);break;case\"float\":SAFE_HEAP_STORE_D(ptr|0,Math_fround(value),4);break;case\"double\":SAFE_HEAP_STORE_D(ptr|0,+value,8);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;if(u>=2097152)warnOnce(\"Invalid Unicode code point 0x\"+u.toString(16)+\" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF).\");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){assert(typeof maxBytesToWrite==\"number\",\"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");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){assert(array.length>=0,\"writeArrayToMemory array must have a length (should be an array or typed array)\");HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i0){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 STACK_BASE=22720,STACK_MAX=5265600,DYNAMIC_BASE=5265600,DYNAMICTOP_PTR=22464;assert(STACK_BASE%16===0,\"stack must start aligned\");assert(DYNAMIC_BASE%16===0,\"heap must start aligned\");var TOTAL_STACK=5242880;if(Module[\"TOTAL_STACK\"])assert(TOTAL_STACK===Module[\"TOTAL_STACK\"],\"the stack size can no longer be determined at runtime\");var INITIAL_TOTAL_MEMORY=Module[\"TOTAL_MEMORY\"]||16777216;if(INITIAL_TOTAL_MEMORY>2]=DYNAMIC_BASE;function writeStackCookie(){assert((STACK_MAX&3)==0);HEAPU32[(STACK_MAX>>2)-1]=34821223;HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(HEAPU32[(STACK_MAX>>2)-1]!=34821223||HEAPU32[(STACK_MAX>>2)-2]!=2310721022){abort(\"Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x\"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+\" \"+HEAPU32[(STACK_MAX>>2)-1].toString(16))}if(HEAP32[0]!==1668509029)throw\"Runtime error: The application has corrupted its heap memory area (address zero)!\"}function abortStackOverflow(allocSize){abort(\"Stack overflow! Attempted to allocate \"+allocSize+\" bytes on the stack, but stack has only \"+(STACK_MAX-stackSave()+allocSize)+\" bytes available!\")}HEAP32[0]=1668509029;HEAP16[1]=25459;if(HEAPU8[2]!==115||HEAPU8[3]!==99)throw\"Runtime error: expected the system to be little-endian!\";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(){checkStackCookie();if(runtimeInitialized)return;runtimeInitialized=true;if(!Module[\"noFSInit\"]&&!FS.init.initialized)FS.init();TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){checkStackCookie();FS.ignorePermissions=false;callRuntimeCallbacks(__ATMAIN__)}function postRun(){checkStackCookie();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)}function unSign(value,bits,ignore){if(value>=0){return value}return bits<=32?2*Math.abs(1<=0){err(\"Memory size incompatibility issues may be due to changing TOTAL_MEMORY at runtime to something too large. Use ALLOW_MEMORY_GROWTH to allow any size memory (and also make sure not to set TOTAL_MEMORY at runtime to something smaller than it was at compile time).\")}return false}receiveInstance(instance,module);return Module[\"asm\"]}Module[\"asm\"]=function(global,env,providedBuffer){env[\"memory\"]=wasmMemory;env[\"table\"]=wasmTable=new WebAssembly.Table({\"initial\":55,\"maximum\":55,\"element\":\"anyfunc\"});env[\"__memory_base\"]=1024;env[\"__table_base\"]=0;var exports=createWasm(env);assert(exports,\"binaryen setup failed (no wasm support?)\");return exports};__ATINIT__.push({func:function(){___emscripten_environ_constructor()}});var tempDoublePtr=22704;assert(tempDoublePtr%8==0);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);SAFE_HEAP_STORE(envPtr|0,poolPtr|0,4);SAFE_HEAP_STORE(environ|0,envPtr|0,4)}else{envPtr=SAFE_HEAP_LOAD(environ|0,4,0)|0;poolPtr=SAFE_HEAP_LOAD(envPtr|0,4,0)|0}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=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)},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.resolve(from).substr(1);to=PATH.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(ERRNO_CODES.EPERM)}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);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length>2}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}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(ERRNO_CODES.EINVAL)}},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(ERRNO_CODES[e.code])}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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},readdir:function(node){var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}}}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}return position}}};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 NODERAWFS={lookupPath:function(path){return{path:path,node:{mode:NODEFS.getMode(path)}}},createStandardStreams:function(){FS.streams[0]={fd:0,nfd:0,position:0,path:\"\",flags:0,tty:true,seekable:false};for(var i=1;i<3;i++){FS.streams[i]={fd:i,nfd:i,position:0,path:\"\",flags:577,tty:true,seekable:false}}},cwd:function(){return process.cwd()},chdir:function(){process.chdir.apply(void 0,arguments)},mknod:function(path,mode){if(FS.isDir(path)){fs.mkdirSync(path,mode)}else{fs.writeFileSync(path,\"\",{mode:mode})}},mkdir:function(){fs.mkdirSync.apply(void 0,arguments)},symlink:function(){fs.symlinkSync.apply(void 0,arguments)},rename:function(){fs.renameSync.apply(void 0,arguments)},rmdir:function(){fs.rmdirSync.apply(void 0,arguments)},readdir:function(){fs.readdirSync.apply(void 0,arguments)},unlink:function(){fs.unlinkSync.apply(void 0,arguments)},readlink:function(){return fs.readlinkSync.apply(void 0,arguments)},stat:function(){return fs.statSync.apply(void 0,arguments)},lstat:function(){return fs.lstatSync.apply(void 0,arguments)},chmod:function(){fs.chmodSync.apply(void 0,arguments)},fchmod:function(){fs.fchmodSync.apply(void 0,arguments)},chown:function(){fs.chownSync.apply(void 0,arguments)},fchown:function(){fs.fchownSync.apply(void 0,arguments)},truncate:function(){fs.truncateSync.apply(void 0,arguments)},ftruncate:function(){fs.ftruncateSync.apply(void 0,arguments)},utime:function(){fs.utimesSync.apply(void 0,arguments)},open:function(path,flags,mode,suggestFD){if(typeof flags===\"string\"){flags=VFS.modeStringToFlags(flags)}var nfd=fs.openSync(path,NODEFS.flagsForNode(flags),mode);var fd=suggestFD!=null?suggestFD:FS.nextfd(nfd);var stream={fd:fd,nfd:nfd,position:0,path:path,flags:flags,seekable:true};FS.streams[fd]=stream;return stream},close:function(stream){if(!stream.stream_ops){fs.closeSync(stream.nfd)}FS.closeStream(stream.fd)},llseek:function(stream,offset,whence){if(stream.stream_ops){return VFS.llseek(stream,offset,whence)}var position=offset;if(whence===1){position+=stream.position}else if(whence===2){position+=fs.fstatSync(stream.nfd).size}else if(whence!==0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}stream.position=position;return position},read:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.read(stream,buffer,offset,length,position)}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesRead=fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.write(stream,buffer,offset,length,position)}if(stream.flags&+\"1024\"){FS.llseek(stream,0,+\"2\")}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesWritten=fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:function(){throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP)},mmap:function(){throw new FS.ErrnoError(ERRNO_CODES.ENODEV)},msync:function(){return 0},munmap:function(){return 0},ioctl:function(){throw new FS.ErrnoError(ERRNO_CODES.ENOTTY)}};var ERRNO_MESSAGES={0:\"Success\",1:\"Not super-user\",2:\"No such file or directory\",3:\"No such process\",4:\"Interrupted system call\",5:\"I/O error\",6:\"No such device or address\",7:\"Arg list too long\",8:\"Exec format error\",9:\"Bad file number\",10:\"No children\",11:\"No more processes\",12:\"Not enough core\",13:\"Permission denied\",14:\"Bad address\",15:\"Block device required\",16:\"Mount device busy\",17:\"File exists\",18:\"Cross-device link\",19:\"No such device\",20:\"Not a directory\",21:\"Is a directory\",22:\"Invalid argument\",23:\"Too many open files in system\",24:\"Too many open files\",25:\"Not a typewriter\",26:\"Text file busy\",27:\"File too large\",28:\"No space left on device\",29:\"Illegal seek\",30:\"Read only file system\",31:\"Too many links\",32:\"Broken pipe\",33:\"Math arg out of domain of func\",34:\"Math result not representable\",35:\"File locking deadlock error\",36:\"File or path name too long\",37:\"No record locks available\",38:\"Function not implemented\",39:\"Directory not empty\",40:\"Too many symbolic links\",42:\"No message of desired type\",43:\"Identifier removed\",44:\"Channel number out of range\",45:\"Level 2 not synchronized\",46:\"Level 3 halted\",47:\"Level 3 reset\",48:\"Link number out of range\",49:\"Protocol driver not attached\",50:\"No CSI structure available\",51:\"Level 2 halted\",52:\"Invalid exchange\",53:\"Invalid request descriptor\",54:\"Exchange full\",55:\"No anode\",56:\"Invalid request code\",57:\"Invalid slot\",59:\"Bad font file fmt\",60:\"Device not a stream\",61:\"No data (for no delay io)\",62:\"Timer expired\",63:\"Out of streams resources\",64:\"Machine is not on the network\",65:\"Package not installed\",66:\"The object is remote\",67:\"The link has been severed\",68:\"Advertise error\",69:\"Srmount error\",70:\"Communication error on send\",71:\"Protocol error\",72:\"Multihop attempted\",73:\"Cross mount point (not really error)\",74:\"Trying to read unreadable message\",75:\"Value too large for defined data type\",76:\"Given log. name not unique\",77:\"f.d. invalid for this operation\",78:\"Remote address changed\",79:\"Can access a needed shared lib\",80:\"Accessing a corrupted shared lib\",81:\".lib section in a.out corrupted\",82:\"Attempting to link in too many libs\",83:\"Attempting to exec a shared library\",84:\"Illegal byte sequence\",86:\"Streams pipe error\",87:\"Too many users\",88:\"Socket operation on non-socket\",89:\"Destination address required\",90:\"Message too long\",91:\"Protocol wrong type for socket\",92:\"Protocol not available\",93:\"Unknown protocol\",94:\"Socket type not supported\",95:\"Not supported\",96:\"Protocol family not supported\",97:\"Address family not supported by protocol family\",98:\"Address already in use\",99:\"Address not available\",100:\"Network interface is not configured\",101:\"Network is unreachable\",102:\"Connection reset by network\",103:\"Connection aborted\",104:\"Connection reset by peer\",105:\"No buffer space available\",106:\"Socket is already connected\",107:\"Socket is not connected\",108:\"Can't send after socket shutdown\",109:\"Too many references\",110:\"Connection timed out\",111:\"Connection refused\",112:\"Host is down\",113:\"Host is unreachable\",114:\"Socket already connected\",115:\"Connection already in progress\",116:\"Stale file handle\",122:\"Quota exceeded\",123:\"No medium (in tape drive)\",125:\"Operation canceled\",130:\"Previous owner died\",131:\"State not recoverable\"};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.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){assert(FS.syncFSRequests>0);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);assert(idx!==-1);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,\"NODEFS\":NODEFS}},init:function(input,output,error){assert(!FS.init.initialized,\"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)\");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);assert(size>=0);if(contents.slice){for(var i=0;i=0)assert(high===0);else assert(high===-1);return low},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall10(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.unlink(path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}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();var offset=offset_low;FS.llseek(stream,offset,whence);SAFE_HEAP_STORE(result|0,stream.position|0,4);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 ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}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 ___syscall15(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),mode=SYSCALLS.get();FS.chmod(path,mode);return 0}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 ___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-ERRNO_CODES.EINVAL}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;SAFE_HEAP_STORE(arg+offset|0,2|0,2);return 0}case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:___setErrNo(ERRNO_CODES.EINVAL);return-1;default:{return-ERRNO_CODES.EINVAL}}}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall38(which,varargs){SYSCALLS.varargs=varargs;try{var old_path=SYSCALLS.getStr(),new_path=SYSCALLS.getStr();FS.rename(old_path,new_path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall40(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.rmdir(path);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 ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),op=SYSCALLS.get();switch(op){case 21509:case 21505:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21519:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;var argp=SYSCALLS.get();SAFE_HEAP_STORE(argp|0,0|0,4);return 0}case 21520:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return-ERRNO_CODES.EINVAL}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21524:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}default:abort(\"bad ioctl syscall \"+op)}}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 ___syscall60(which,varargs){SYSCALLS.varargs=varargs;try{var mask=SYSCALLS.get();var old=SYSCALLS.umask;SYSCALLS.umask=mask;return old}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___unlock(){}function _emscripten_get_heap_size(){return HEAP8.length}function abortOnCannotGrowMemory(requestedSize){abort(\"Cannot enlarge memory arrays to size \"+requestedSize+\" bytes (OOM). Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value \"+HEAP8.length+\", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 \")}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)){return buffer=wasmMemory.buffer}else{return null}}catch(e){console.error(\"emscripten_realloc_buffer: Attempted to grow from \"+oldSize+\" bytes to \"+size+\" bytes, but got error: \"+e);return null}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();assert(requestedSize>oldSize);var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT){err(\"Cannot enlarge memory, asked to go up to \"+requestedSize+\" bytes, but the limit is \"+LIMIT+\" bytes!\");return false}var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}SAFE_HEAP_STORE(tmPtr+24|0,date.getDay()|0,4);var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;SAFE_HEAP_STORE(tmPtr+28|0,yday|0,4);return date.getTime()/1e3|0}function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){SAFE_HEAP_STORE(ptr|0,ret|0,4)}return ret}if(ENVIRONMENT_IS_NODE){_emscripten_get_now=function _emscripten_get_now_actual(){var t=process[\"hrtime\"]();return t[0]*1e3+t[1]/1e6}}else if(typeof dateNow!==\"undefined\"){_emscripten_get_now=dateNow}else if(typeof performance===\"object\"&&performance&&typeof performance[\"now\"]===\"function\"){_emscripten_get_now=function(){return performance[\"now\"]()}}else{_emscripten_get_now=Date.now}FS.staticInit();if(ENVIRONMENT_IS_NODE){var fs=frozenFs;var NODEJS_PATH=__webpack_require__(4);NODEFS.staticInit()}if(ENVIRONMENT_IS_NODE){var _wrapNodeError=function(func){return function(){try{return func.apply(this,arguments)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}};var VFS=Object.assign({},FS);for(var _key in NODERAWFS)FS[_key]=_wrapNodeError(NODERAWFS[_key])}else{throw new Error(\"NODERAWFS is currently only supported on Node.js environment.\")}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 decodeBase64=typeof atob===\"function\"?atob:function(input){var keyStr=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";var output=\"\";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\\+\\/\\=]/g,\"\");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i0){return}writeStackCookie();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\"]();assert(!Module[\"_main\"],'compiled without a main, but one is present. if you added it from JS, use Module[\"onRuntimeInitialized\"]');postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}checkStackCookie()}Module[\"run\"]=run;var abortDecorators=[];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;var extra=\"\";var output=\"abort(\"+what+\") at \"+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach(function(decorator){output=decorator(output,what)})}throw output}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();\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"stream\");\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"util\");\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fs_1 = __webpack_require__(2);\nconst FakeFS_1 = __webpack_require__(6);\nconst NodeFS_1 = __webpack_require__(1);\nconst ZipFS_1 = __webpack_require__(9);\nconst path_1 = __webpack_require__(0);\nclass ZipOpenFS extends FakeFS_1.BasePortableFakeFS {\n constructor({ baseFs = new NodeFS_1.NodeFS(), filter = null, useCache = true } = {}) {\n super();\n this.isZip = new Set();\n this.notZip = new Set();\n this.baseFs = baseFs;\n this.zipInstances = useCache ? new Map() : null;\n this.filter = filter;\n this.isZip = new Set();\n this.notZip = new Set();\n }\n static open(fn) {\n const zipOpenFs = new ZipOpenFS();\n try {\n return fn(zipOpenFs);\n }\n finally {\n zipOpenFs.saveAndClose();\n }\n }\n static async openPromise(fn) {\n const zipOpenFs = new ZipOpenFS();\n try {\n return await fn(zipOpenFs);\n }\n finally {\n zipOpenFs.saveAndClose();\n }\n }\n getRealPath() {\n return this.baseFs.getRealPath();\n }\n saveAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.saveAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n discardAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.discardAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n async openPromise(p, flags, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.openPromise(p, flags, mode);\n }, async (zipFs, { archivePath, subPath }) => {\n throw new Error(`Unsupported action (we wouldn't be able to disambiguate the close)`);\n });\n }\n openSync(p, flags, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.openSync(p, flags, mode);\n }, (zipFs, { archivePath, subPath }) => {\n throw new Error(`Unsupported action (we wouldn't be able to disambiguate the close)`);\n });\n }\n async closePromise(fd) {\n return await this.baseFs.closePromise(fd);\n }\n closeSync(fd) {\n return this.baseFs.closeSync(fd);\n }\n createReadStream(p, opts) {\n if (p === null)\n return this.baseFs.createReadStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createReadStream(p, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.createReadStream(subPath, opts);\n });\n }\n createWriteStream(p, opts) {\n if (p === null)\n return this.baseFs.createWriteStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createWriteStream(p, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.createWriteStream(subPath, opts);\n });\n }\n async realpathPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.realpathPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return this.pathUtils.resolve(await this.baseFs.realpathPromise(archivePath), this.pathUtils.relative(path_1.PortablePath.root, await zipFs.realpathPromise(subPath)));\n });\n }\n realpathSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.realpathSync(p);\n }, (zipFs, { archivePath, subPath }) => {\n return this.pathUtils.resolve(this.baseFs.realpathSync(archivePath), this.pathUtils.relative(path_1.PortablePath.root, zipFs.realpathSync(subPath)));\n });\n }\n async existsPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.existsPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.existsPromise(subPath);\n });\n }\n existsSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.existsSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.existsSync(subPath);\n });\n }\n async accessPromise(p, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.accessPromise(p, mode);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.accessPromise(subPath, mode);\n });\n }\n accessSync(p, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.accessSync(p, mode);\n }, (zipFs, { subPath }) => {\n return zipFs.accessSync(subPath, mode);\n });\n }\n async statPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.statPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.statPromise(subPath);\n });\n }\n statSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.statSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.statSync(subPath);\n });\n }\n async lstatPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.lstatPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.lstatPromise(subPath);\n });\n }\n lstatSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.lstatSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.lstatSync(subPath);\n });\n }\n async chmodPromise(p, mask) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.chmodPromise(p, mask);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.chmodPromise(subPath, mask);\n });\n }\n chmodSync(p, mask) {\n return this.makeCallSync(p, () => {\n return this.baseFs.chmodSync(p, mask);\n }, (zipFs, { subPath }) => {\n return zipFs.chmodSync(subPath, mask);\n });\n }\n async renamePromise(oldP, newP) {\n return await this.makeCallPromise(oldP, async () => {\n return await this.makeCallPromise(newP, async () => {\n return await this.baseFs.renamePromise(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n });\n }, async (zipFsO, { archivePath: archivePathO, subPath: subPathO }) => {\n return await this.makeCallPromise(newP, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }, async (zipFsN, { archivePath: archivePathN, subPath: subPathN }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }\n else {\n return await zipFsO.renamePromise(subPathO, subPathN);\n }\n });\n });\n }\n renameSync(oldP, newP) {\n return this.makeCallSync(oldP, () => {\n return this.makeCallSync(newP, () => {\n return this.baseFs.renameSync(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n });\n }, (zipFsO, { archivePath: archivePathO, subPath: subPathO }) => {\n return this.makeCallSync(newP, () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }, (zipFsN, { archivePath: archivePathN, subPath: subPathN }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }\n else {\n return zipFsO.renameSync(subPathO, subPathN);\n }\n });\n });\n }\n async copyFilePromise(sourceP, destP, flags = 0) {\n const fallback = async (sourceFs, sourceP, destFs, destP) => {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), { code: `EXDEV` });\n if ((flags & fs_1.constants.COPYFILE_EXCL) && await this.existsPromise(sourceP))\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n let content;\n try {\n content = await sourceFs.readFilePromise(sourceP);\n }\n catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n }\n await destFs.writeFilePromise(destP, content);\n };\n return await this.makeCallPromise(sourceP, async () => {\n return await this.makeCallPromise(destP, async () => {\n return await this.baseFs.copyFilePromise(sourceP, destP, flags);\n }, async (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n return await fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, async (zipFsS, { archivePath: archivePathS, subPath: subPathS }) => {\n return await this.makeCallPromise(destP, async () => {\n return await fallback(zipFsS, subPathS, this.baseFs, destP);\n }, async (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n if (zipFsS !== zipFsD) {\n return await fallback(zipFsS, subPathS, zipFsD, subPathD);\n }\n else {\n return await zipFsS.copyFilePromise(subPathS, subPathD, flags);\n }\n });\n });\n }\n copyFileSync(sourceP, destP, flags = 0) {\n const fallback = (sourceFs, sourceP, destFs, destP) => {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), { code: `EXDEV` });\n if ((flags & fs_1.constants.COPYFILE_EXCL) && this.existsSync(sourceP))\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n let content;\n try {\n content = sourceFs.readFileSync(sourceP);\n }\n catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n }\n destFs.writeFileSync(destP, content);\n };\n return this.makeCallSync(sourceP, () => {\n return this.makeCallSync(destP, () => {\n return this.baseFs.copyFileSync(sourceP, destP, flags);\n }, (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n return fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, (zipFsS, { archivePath: archivePathS, subPath: subPathS }) => {\n return this.makeCallSync(destP, () => {\n return fallback(zipFsS, subPathS, this.baseFs, destP);\n }, (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n if (zipFsS !== zipFsD) {\n return fallback(zipFsS, subPathS, zipFsD, subPathD);\n }\n else {\n return zipFsS.copyFileSync(subPathS, subPathD, flags);\n }\n });\n });\n }\n async writeFilePromise(p, content, opts) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.writeFilePromise(p, content, opts);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.writeFilePromise(subPath, content, opts);\n });\n }\n writeFileSync(p, content, opts) {\n return this.makeCallSync(p, () => {\n return this.baseFs.writeFileSync(p, content, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.writeFileSync(subPath, content, opts);\n });\n }\n async unlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.unlinkPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.unlinkPromise(subPath);\n });\n }\n unlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.unlinkSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.unlinkSync(subPath);\n });\n }\n async utimesPromise(p, atime, mtime) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.utimesPromise(p, atime, mtime);\n }, async (zipFs, { subPath }) => {\n return await zipFs.utimesPromise(subPath, atime, mtime);\n });\n }\n utimesSync(p, atime, mtime) {\n return this.makeCallSync(p, () => {\n return this.baseFs.utimesSync(p, atime, mtime);\n }, (zipFs, { subPath }) => {\n return zipFs.utimesSync(subPath, atime, mtime);\n });\n }\n async mkdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.mkdirPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.mkdirPromise(subPath);\n });\n }\n mkdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.mkdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.mkdirSync(subPath);\n });\n }\n async rmdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.rmdirPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.rmdirPromise(subPath);\n });\n }\n rmdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.rmdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.rmdirSync(subPath);\n });\n }\n async symlinkPromise(target, p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.symlinkPromise(target, p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.symlinkPromise(target, subPath);\n });\n }\n symlinkSync(target, p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.symlinkSync(target, p);\n }, (zipFs, { subPath }) => {\n return zipFs.symlinkSync(target, subPath);\n });\n }\n async readFilePromise(p, encoding) {\n return this.makeCallPromise(p, async () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return await this.baseFs.readFilePromise(p, encoding);\n default:\n return await this.baseFs.readFilePromise(p, encoding);\n }\n }, async (zipFs, { subPath }) => {\n return await zipFs.readFilePromise(subPath, encoding);\n });\n }\n readFileSync(p, encoding) {\n return this.makeCallSync(p, () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.baseFs.readFileSync(p, encoding);\n default:\n return this.baseFs.readFileSync(p, encoding);\n }\n }, (zipFs, { subPath }) => {\n return zipFs.readFileSync(subPath, encoding);\n });\n }\n async readdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readdirPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.readdirPromise(subPath);\n }, {\n requireSubpath: false,\n });\n }\n readdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.readdirSync(subPath);\n }, {\n requireSubpath: false,\n });\n }\n async readlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readlinkPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.readlinkPromise(subPath);\n });\n }\n readlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readlinkSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.readlinkSync(subPath);\n });\n }\n watch(p, a, b) {\n return this.makeCallSync(p, () => {\n return this.baseFs.watch(p, \n // @ts-ignore\n a, b);\n }, (zipFs, { subPath }) => {\n return zipFs.watch(subPath, \n // @ts-ignore\n a, b);\n });\n }\n async makeCallPromise(p, discard, accept, { requireSubpath = true } = {}) {\n p = this.pathUtils.normalize(this.pathUtils.resolve(path_1.PortablePath.root, p));\n const zipInfo = this.findZip(p);\n if (!zipInfo)\n return await discard();\n if (requireSubpath && zipInfo.subPath === `/`)\n return await discard();\n return await this.getZipPromise(zipInfo.archivePath, async (zipFs) => await accept(zipFs, zipInfo));\n }\n makeCallSync(p, discard, accept, { requireSubpath = true } = {}) {\n p = this.pathUtils.normalize(this.pathUtils.resolve(path_1.PortablePath.root, p));\n const zipInfo = this.findZip(p);\n if (!zipInfo)\n return discard();\n if (requireSubpath && zipInfo.subPath === `/`)\n return discard();\n return this.getZipSync(zipInfo.archivePath, zipFs => accept(zipFs, zipInfo));\n }\n findZip(p) {\n if (this.filter && !this.filter.test(p))\n return null;\n const parts = p.split(/\\//g);\n for (let t = 2; t <= parts.length; ++t) {\n const archivePath = parts.slice(0, t).join(`/`);\n if (this.notZip.has(archivePath))\n continue;\n if (this.isZip.has(archivePath))\n return { archivePath, subPath: this.pathUtils.resolve(path_1.PortablePath.root, parts.slice(t).join(`/`)) };\n let realArchivePath = archivePath;\n let stat;\n while (true) {\n try {\n stat = this.baseFs.lstatSync(realArchivePath);\n }\n catch (error) {\n return null;\n }\n if (stat.isSymbolicLink()) {\n realArchivePath = this.pathUtils.resolve(this.pathUtils.dirname(realArchivePath), this.baseFs.readlinkSync(realArchivePath));\n }\n else {\n break;\n }\n }\n const isZip = stat.isFile() && this.pathUtils.extname(realArchivePath) === `.zip`;\n if (isZip) {\n this.isZip.add(archivePath);\n return { archivePath, subPath: this.pathUtils.resolve(path_1.PortablePath.root, parts.slice(t).join(`/`)) };\n }\n else {\n this.notZip.add(archivePath);\n if (stat.isFile()) {\n return null;\n }\n }\n }\n return null;\n }\n async getZipPromise(p, accept) {\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs)\n this.zipInstances.set(p, zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs, stats: await this.baseFs.statPromise(p) }));\n return await accept(zipFs);\n }\n else {\n const zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs, stats: await this.baseFs.statPromise(p) });\n try {\n return await accept(zipFs);\n }\n finally {\n zipFs.saveAndClose();\n }\n }\n }\n getZipSync(p, accept) {\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs)\n this.zipInstances.set(p, zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs }));\n return accept(zipFs);\n }\n else {\n const zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs });\n try {\n return accept(zipFs);\n }\n finally {\n zipFs.saveAndClose();\n }\n }\n }\n}\nexports.ZipOpenFS = ZipOpenFS;\n\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"string_decoder\");\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nconst fs_1 = __importDefault(__webpack_require__(2));\nconst module_1 = __importDefault(__webpack_require__(7));\nconst path_1 = __importDefault(__webpack_require__(4));\nconst internalTools_1 = __webpack_require__(10);\nfunction applyPatch(pnpapi, opts) {\n // @ts-ignore\n const builtinModules = new Set(module_1.default.builtinModules || Object.keys(process.binding('natives')));\n // The callback function gets called to wrap the return value of the module names matching the regexp\n const patchedModules = [];\n if (opts.compatibilityMode) {\n // Modern versions of `resolve` support a specific entry point that custom resolvers can use\n // to inject a specific resolution logic without having to patch the whole package.\n //\n // Cf: https://github.com/browserify/resolve/pull/174\n patchedModules.push([\n /^\\.\\/normalize-options\\.js$/,\n (issuer, normalizeOptions) => {\n if (!issuer || issuer.name !== 'resolve')\n return normalizeOptions;\n return (request, opts) => {\n opts = opts || {};\n if (opts.forceNodeResolution)\n return opts;\n opts.preserveSymlinks = true;\n opts.paths = function (request, basedir, getNodeModulesDir, opts) {\n // Extract the name of the package being requested (1=full name, 2=scope name, 3=local name)\n const parts = request.match(/^((?:(@[^\\/]+)\\/)?([^\\/]+))/);\n if (!parts)\n throw new Error(`Assertion failed: Expected the \"resolve\" package to call the \"paths\" callback with package names only (got \"${request}\")`);\n // make sure that basedir ends with a slash\n if (basedir.charAt(basedir.length - 1) !== '/')\n basedir = path_1.default.join(basedir, '/');\n // TODO Handle portable paths\n // This is guaranteed to return the path to the \"package.json\" file from the given package\n const manifestPath = pnpapi.resolveToUnqualified(`${parts[1]}/package.json`, basedir, {\n considerBuiltins: false,\n });\n if (manifestPath === null)\n throw new Error(`Assertion failed: The resolution thinks that \"${parts[1]}\" is a Node builtin`);\n // The first dirname strips the package.json, the second strips the local named folder\n let nodeModules = path_1.default.dirname(path_1.default.dirname(manifestPath));\n // Strips the scope named folder if needed\n if (parts[2])\n nodeModules = path_1.default.dirname(nodeModules);\n return [nodeModules];\n };\n return opts;\n };\n },\n ]);\n }\n /**\n * Used to disable the resolution hooks (for when we want to fallback to the previous resolution - we then need\n * a way to \"reset\" the environment temporarily)\n */\n let enableNativeHooks = true;\n // @ts-ignore\n process.versions.pnp = String(pnpapi.VERSIONS.std);\n // A small note: we don't replace the cache here (and instead use the native one). This is an effort to not\n // break code similar to \"delete require.cache[require.resolve(FOO)]\", where FOO is a package located outside\n // of the Yarn dependency tree. In this case, we defer the load to the native loader. If we were to replace the\n // cache by our own, the native loader would populate its own cache, which wouldn't be exposed anymore, so the\n // delete call would be broken.\n const originalModuleLoad = module_1.default._load;\n module_1.default._load = function (request, parent, isMain) {\n if (!enableNativeHooks)\n return originalModuleLoad.call(module_1.default, request, parent, isMain);\n // Builtins are managed by the regular Node loader\n if (builtinModules.has(request)) {\n try {\n enableNativeHooks = false;\n return originalModuleLoad.call(module_1.default, request, parent, isMain);\n }\n finally {\n enableNativeHooks = true;\n }\n }\n // The 'pnpapi' name is reserved to return the PnP api currently in use by the program\n if (request === `pnpapi`)\n return pnpapi;\n // Request `Module._resolveFilename` (ie. `resolveRequest`) to tell us which file we should load\n const modulePath = module_1.default._resolveFilename(request, parent, isMain);\n // Check if the module has already been created for the given file\n const cacheEntry = module_1.default._cache[modulePath];\n if (cacheEntry)\n return cacheEntry.exports;\n // Create a new module and store it into the cache\n // @ts-ignore\n const module = new module_1.default(modulePath, parent);\n module_1.default._cache[modulePath] = module;\n // The main module is exposed as global variable\n if (isMain) {\n // @ts-ignore\n process.mainModule = module;\n module.id = '.';\n }\n // Try to load the module, and remove it from the cache if it fails\n let hasThrown = true;\n try {\n module.load(modulePath);\n hasThrown = false;\n }\n finally {\n if (hasThrown) {\n delete module_1.default._cache[modulePath];\n }\n }\n // Some modules might have to be patched for compatibility purposes\n for (const [filter, patchFn] of patchedModules) {\n if (filter.test(request)) {\n const issuer = parent && parent.filename ? pnpapi.findPackageLocator(parent.filename) : null;\n module.exports = patchFn(issuer, module.exports);\n }\n }\n return module.exports;\n };\n const originalModuleResolveFilename = module_1.default._resolveFilename;\n module_1.default._resolveFilename = function (request, parent, isMain, options) {\n if (request === `pnpapi`)\n return request;\n if (!enableNativeHooks)\n return originalModuleResolveFilename.call(module_1.default, request, parent, isMain, options);\n if (options && options.plugnplay === false) {\n try {\n enableNativeHooks = false;\n return originalModuleResolveFilename.call(module_1.default, request, parent, isMain, options);\n }\n finally {\n enableNativeHooks = true;\n }\n }\n let issuers;\n if (options) {\n const optionNames = new Set(Object.keys(options));\n optionNames.delete(`paths`);\n optionNames.delete(`plugnplay`);\n if (optionNames.size > 0) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNSUPPORTED, `Some options passed to require() aren't supported by PnP yet (${Array.from(optionNames).join(', ')})`);\n }\n if (options.paths) {\n issuers = options.paths.map((entry) => {\n return `${path_1.default.normalize(entry)}/`;\n });\n }\n }\n if (!issuers) {\n const issuerModule = internalTools_1.getIssuerModule(parent);\n const issuer = issuerModule ? issuerModule.filename : `${fslib_1.NodeFS.toPortablePath(process.cwd())}/`;\n issuers = [issuer];\n }\n // When Node is called, it tries to require the main script but can't\n // because PnP already patched 'Module'\n // We test it for an absolute Windows path and convert it to a portable path.\n // We should probably always call toPortablePath and check for this directly\n if (/^[A-Z]:.*/.test(request))\n request = fslib_1.NodeFS.toPortablePath(request);\n let firstError;\n for (const issuer of issuers) {\n let resolution;\n try {\n resolution = pnpapi.resolveRequest(request, issuer);\n }\n catch (error) {\n firstError = firstError || error;\n continue;\n }\n return resolution !== null ? resolution : request;\n }\n throw firstError;\n };\n const originalFindPath = module_1.default._findPath;\n module_1.default._findPath = function (request, paths, isMain) {\n if (request === `pnpapi`)\n return false;\n if (!enableNativeHooks)\n return originalFindPath.call(module_1.default, request, paths, isMain);\n for (const path of paths) {\n let resolution;\n try {\n // TODO Convert path to portable path?\n resolution = pnpapi.resolveRequest(request, path);\n }\n catch (error) {\n continue;\n }\n if (resolution) {\n return resolution;\n }\n }\n return false;\n };\n fslib_1.patchFs(fs_1.default, new fslib_1.PosixFS(opts.fakeFs));\n}\nexports.applyPatch = applyPatch;\n;\n\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nfunction hydrateRuntimeState(data, { basePath }) {\n const portablePath = fslib_1.NodeFS.toPortablePath(basePath);\n const ignorePattern = data.ignorePatternData !== null\n ? new RegExp(data.ignorePatternData)\n : null;\n const packageRegistry = new Map(data.packageRegistryData.map(([packageName, packageStoreData]) => {\n return [packageName, new Map(packageStoreData.map(([packageReference, packageInformationData]) => {\n return [packageReference, {\n packageLocation: fslib_1.ppath.resolve(portablePath, packageInformationData.packageLocation),\n packageDependencies: new Map(packageInformationData.packageDependencies),\n }];\n }))];\n }));\n const packageLocatorsByLocations = new Map();\n for (const [packageName, storeData] of data.packageRegistryData) {\n for (const [packageReference, packageInformationData] of storeData) {\n if ((packageName === null) !== (packageReference === null))\n throw new Error(`Assertion failed: The name and reference should be null, or neither should`);\n // @ts-ignore: TypeScript isn't smart enough to understand the type assertion\n const packageLocator = { name: packageName, reference: packageReference };\n packageLocatorsByLocations.set(packageInformationData.packageLocation, packageLocator);\n }\n }\n for (const location of data.locationBlacklistData)\n packageLocatorsByLocations.set(location, null);\n const fallbackExclusionList = new Map(data.fallbackExclusionList.map(([packageName, packageReferences]) => {\n return [packageName, new Set(packageReferences)];\n }));\n const virtualRoots = data.virtualRoots.map(virtualRoot => {\n return fslib_1.ppath.resolve(portablePath, virtualRoot);\n });\n const enableTopLevelFallback = data.enableTopLevelFallback;\n const packageLocationLengths = data.locationLengthData;\n return {\n basePath: portablePath,\n enableTopLevelFallback,\n fallbackExclusionList,\n ignorePattern,\n packageLocationLengths,\n packageLocatorsByLocations,\n packageRegistry,\n virtualRoots,\n };\n}\nexports.hydrateRuntimeState = hydrateRuntimeState;\n\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/// \nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nconst fslib_2 = __webpack_require__(5);\nconst module_1 = __importDefault(__webpack_require__(7));\nconst internalTools_1 = __webpack_require__(10);\nfunction makeApi(runtimeState, opts) {\n // @ts-ignore\n const builtinModules = new Set(module_1.default.builtinModules || Object.keys(process.binding('natives')));\n // Splits a require request into its components, or return null if the request is a file path\n const pathRegExp = /^(?![a-zA-Z]:[\\\\\\/]|\\\\\\\\|\\.{0,2}(?:\\/|$))((?:@[^\\/]+\\/)?[^\\/]+)\\/?(.*|)$/;\n // Matches if the path starts with a valid path qualifier (./, ../, /)\n // eslint-disable-next-line no-unused-vars\n const isStrictRegExp = /^\\.{0,2}\\//;\n // Matches if the path must point to a directory (ie ends with /)\n const isDirRegExp = /\\/$/;\n // We only instantiate one of those so that we can use strict-equal comparisons\n const topLevelLocator = { name: null, reference: null };\n // Used for compatibility purposes - cf setupCompatibilityLayer\n const fallbackLocators = [];\n if (runtimeState.enableTopLevelFallback === true)\n fallbackLocators.push(topLevelLocator);\n if (opts.compatibilityMode) {\n // ESLint currently doesn't have any portable way for shared configs to\n // specify their own plugins that should be used (cf issue #10125). This\n // will likely get fixed at some point but it'll take time, so in the\n // meantime we'll just add additional fallback entries for common shared\n // configs.\n // Similarly, Gatsby generates files within the `public` folder located\n // within the project, but doesn't pre-resolve the `require` calls to use\n // its own dependencies. Meaning that when PnP see a file from the `public`\n // folder making a require, it thinks that your project forgot to list one\n // of your dependencies.\n for (const name of [`react-scripts`, `gatsby`]) {\n const packageStore = runtimeState.packageRegistry.get(name);\n if (packageStore) {\n for (const reference of packageStore.keys()) {\n if (reference === null) {\n throw new Error(`Assertion failed: This reference shouldn't be null`);\n }\n else {\n fallbackLocators.push({ name, reference });\n }\n }\n }\n }\n }\n /**\n * The setup code will be injected here. The tables listed below are guaranteed to be filled after the call to\n * the $$DYNAMICALLY_GENERATED_CODE function.\n */\n const { ignorePattern, packageRegistry, packageLocatorsByLocations, packageLocationLengths, } = runtimeState;\n /**\n * Allows to print useful logs just be setting a value in the environment\n */\n function makeLogEntry(name, args) {\n return {\n fn: name,\n args: args,\n error: null,\n result: null,\n };\n }\n function maybeLog(name, fn) {\n if (opts.allowDebug === false)\n return fn;\n const level = Number(process.env.PNP_DEBUG_LEVEL);\n if (Number.isFinite(level)) {\n if (level >= 2) {\n return (...args) => {\n const logEntry = makeLogEntry(name, args);\n try {\n return logEntry.result = fn(...args);\n }\n catch (error) {\n throw logEntry.error = error;\n }\n finally {\n console.error(logEntry);\n }\n };\n }\n else if (level >= 1) {\n return (...args) => {\n try {\n return fn(...args);\n }\n catch (error) {\n const logEntry = makeLogEntry(name, args);\n logEntry.error = error;\n console.error(logEntry);\n throw error;\n }\n };\n }\n }\n return fn;\n }\n /**\n * Returns information about a package in a safe way (will throw if they cannot be retrieved)\n */\n function getPackageInformationSafe(packageLocator) {\n const packageInformation = getPackageInformation(packageLocator);\n if (!packageInformation) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.INTERNAL, `Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)`);\n }\n return packageInformation;\n }\n /**\n * Implements the node resolution for folder access and extension selection\n */\n function applyNodeExtensionResolution(unqualifiedPath, candidates, { extensions }) {\n // We use this \"infinite while\" so that we can restart the process as long as we hit package folders\n while (true) {\n let stat;\n try {\n candidates.push(unqualifiedPath);\n stat = opts.fakeFs.statSync(unqualifiedPath);\n }\n catch (error) { }\n // If the file exists and is a file, we can stop right there\n if (stat && !stat.isDirectory()) {\n // If the very last component of the resolved path is a symlink to a file, we then resolve it to a file. We only\n // do this first the last component, and not the rest of the path! This allows us to support the case of bin\n // symlinks, where a symlink in \"/xyz/pkg-name/.bin/bin-name\" will point somewhere else (like \"/xyz/pkg-name/index.js\").\n // In such a case, we want relative requires to be resolved relative to \"/xyz/pkg-name/\" rather than \"/xyz/pkg-name/.bin/\".\n //\n // Also note that the reason we must use readlink on the last component (instead of realpath on the whole path)\n // is that we must preserve the other symlinks, in particular those used by pnp to deambiguate packages using\n // peer dependencies. For example, \"/xyz/.pnp/local/pnp-01234569/.bin/bin-name\" should see its relative requires\n // be resolved relative to \"/xyz/.pnp/local/pnp-0123456789/\" rather than \"/xyz/pkg-with-peers/\", because otherwise\n // we would lose the information that would tell us what are the dependencies of pkg-with-peers relative to its\n // ancestors.\n if (opts.fakeFs.lstatSync(unqualifiedPath).isSymbolicLink())\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(fslib_2.ppath.dirname(unqualifiedPath), opts.fakeFs.readlinkSync(unqualifiedPath)));\n return unqualifiedPath;\n }\n // If the file is a directory, we must check if it contains a package.json with a \"main\" entry\n if (stat && stat.isDirectory()) {\n let pkgJson;\n try {\n pkgJson = JSON.parse(opts.fakeFs.readFileSync(fslib_2.ppath.join(unqualifiedPath, fslib_2.toFilename(`package.json`)), `utf8`));\n }\n catch (error) { }\n let nextUnqualifiedPath;\n if (pkgJson && pkgJson.main)\n nextUnqualifiedPath = fslib_2.ppath.resolve(unqualifiedPath, pkgJson.main);\n // If the \"main\" field changed the path, we start again from this new location\n if (nextUnqualifiedPath && nextUnqualifiedPath !== unqualifiedPath) {\n const resolution = applyNodeExtensionResolution(nextUnqualifiedPath, candidates, { extensions });\n if (resolution !== null) {\n return resolution;\n }\n }\n }\n // Otherwise we check if we find a file that match one of the supported extensions\n const qualifiedPath = extensions\n .map(extension => {\n return `${unqualifiedPath}${extension}`;\n })\n .find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n if (qualifiedPath)\n return qualifiedPath;\n // Otherwise, we check if the path is a folder - in such a case, we try to use its index\n if (stat && stat.isDirectory()) {\n const indexPath = extensions\n .map(extension => {\n return fslib_2.ppath.format({ dir: unqualifiedPath, name: fslib_2.toFilename(`index`), ext: extension });\n })\n .find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n if (indexPath) {\n return indexPath;\n }\n }\n // Otherwise there's nothing else we can do :(\n return null;\n }\n }\n /**\n * This function creates fake modules that can be used with the _resolveFilename function.\n * Ideally it would be nice to be able to avoid this, since it causes useless allocations\n * and cannot be cached efficiently (we recompute the nodeModulePaths every time).\n *\n * Fortunately, this should only affect the fallback, and there hopefully shouldn't have a\n * lot of them.\n */\n function makeFakeModule(path) {\n // @ts-ignore\n const fakeModule = new module_1.default(path, null);\n fakeModule.filename = path;\n fakeModule.paths = module_1.default._nodeModulePaths(path);\n return fakeModule;\n }\n /**\n * Normalize path to posix format.\n */\n function normalizePath(p) {\n return fslib_1.NodeFS.toPortablePath(p);\n }\n /**\n * Forward the resolution to the next resolver (usually the native one)\n */\n function callNativeResolution(request, issuer) {\n if (issuer.endsWith(`/`))\n issuer = fslib_2.ppath.join(issuer, fslib_2.toFilename(`internal.js`));\n // Since we would need to create a fake module anyway (to call _resolveLookupPath that\n // would give us the paths to give to _resolveFilename), we can as well not use\n // the {paths} option at all, since it internally makes _resolveFilename create another\n // fake module anyway.\n return module_1.default._resolveFilename(request, makeFakeModule(fslib_1.NodeFS.fromPortablePath(issuer)), false, { plugnplay: false });\n }\n /**\n * This key indicates which version of the standard is implemented by this resolver. The `std` key is the\n * Plug'n'Play standard, and any other key are third-party extensions. Third-party extensions are not allowed\n * to override the standard, and can only offer new methods.\n *\n * If an new version of the Plug'n'Play standard is released and some extensions conflict with newly added\n * functions, they'll just have to fix the conflicts and bump their own version number.\n */\n const VERSIONS = { std: 2 };\n /**\n * We export a special symbol for easy access to the top level locator.\n */\n const topLevel = topLevelLocator;\n /**\n * Gets the package information for a given locator. Returns null if they cannot be retrieved.\n */\n function getPackageInformation({ name, reference }) {\n const packageInformationStore = packageRegistry.get(name);\n if (!packageInformationStore)\n return null;\n const packageInformation = packageInformationStore.get(reference);\n if (!packageInformation)\n return null;\n return packageInformation;\n }\n /**\n * Finds the package locator that owns the specified path. If none is found, returns null instead.\n */\n function findPackageLocator(location) {\n let relativeLocation = normalizePath(fslib_2.ppath.relative(runtimeState.basePath, location));\n if (!relativeLocation.match(isStrictRegExp))\n relativeLocation = `./${relativeLocation}`;\n if (location.match(isDirRegExp) && !relativeLocation.endsWith(`/`))\n relativeLocation = `${relativeLocation}/`;\n let from = 0;\n // If someone wants to use a binary search to go from O(n) to O(log n), be my guest\n while (from < packageLocationLengths.length && packageLocationLengths[from] > relativeLocation.length)\n from += 1;\n for (let t = from; t < packageLocationLengths.length; ++t) {\n const locator = packageLocatorsByLocations.get(relativeLocation.substr(0, packageLocationLengths[t]));\n if (typeof locator === `undefined`)\n continue;\n // Ensures that the returned locator isn't a blacklisted one.\n //\n // Blacklisted packages are packages that cannot be used because their dependencies cannot be deduced. This only\n // happens with peer dependencies, which effectively have different sets of dependencies depending on their\n // parents.\n //\n // In order to deambiguate those different sets of dependencies, the Yarn implementation of PnP will generate a\n // symlink for each combination of // it will find, and will\n // blacklist the target of those symlinks. By doing this, we ensure that files loaded through a specific path\n // will always have the same set of dependencies, provided the symlinks are correctly preserved.\n //\n // Unfortunately, some tools do not preserve them, and when it happens PnP isn't able anymore to deduce the set of\n // dependencies based on the path of the file that makes the require calls. But since we've blacklisted those\n // paths, we're able to print a more helpful error message that points out that a third-party package is doing\n // something incompatible!\n if (locator === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BLACKLISTED, `A forbidden path has been used in the package resolution process - this is usually caused by one of your tools calling 'fs.realpath' on the return value of 'require.resolve'. Since we need to use symlinks to simultaneously provide valid filesystem paths and disambiguate peer dependencies, they must be passed untransformed to 'require'.\\n\\nForbidden path: ${location}`, { location });\n }\n return locator;\n }\n return null;\n }\n /**\n * Transforms a request (what's typically passed as argument to the require function) into an unqualified path.\n * This path is called \"unqualified\" because it only changes the package name to the package location on the disk,\n * which means that the end result still cannot be directly accessed (for example, it doesn't try to resolve the\n * file extension, or to resolve directories to their \"index.js\" content). Use the \"resolveUnqualified\" function\n * to convert them to fully-qualified paths, or just use \"resolveRequest\" that do both operations in one go.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n function resolveToUnqualified(request, issuer, { considerBuiltins = true } = {}) {\n // The 'pnpapi' request is reserved and will always return the path to the PnP file, from everywhere\n if (request === `pnpapi`)\n return fslib_1.NodeFS.toPortablePath(opts.pnpapiResolution);\n // Bailout if the request is a native module\n if (considerBuiltins && builtinModules.has(request))\n return null;\n // We allow disabling the pnp resolution for some subpaths. This is because some projects, often legacy,\n // contain multiple levels of dependencies (ie. a yarn.lock inside a subfolder of a yarn.lock). This is\n // typically solved using workspaces, but not all of them have been converted already.\n if (ignorePattern && issuer && ignorePattern.test(normalizePath(issuer))) {\n const result = callNativeResolution(request, issuer);\n if (result === false) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer was explicitely ignored by the regexp)\\n\\nRequire request: \"${request}\"\\nRequired by: ${issuer}\\n`, { request, issuer });\n }\n return fslib_1.NodeFS.toPortablePath(result);\n }\n let unqualifiedPath;\n // If the request is a relative or absolute path, we just return it normalized\n const dependencyNameMatch = request.match(pathRegExp);\n if (!dependencyNameMatch) {\n if (fslib_2.ppath.isAbsolute(request)) {\n unqualifiedPath = fslib_2.ppath.normalize(request);\n }\n else {\n if (!issuer) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, { request, issuer });\n }\n if (issuer.match(isDirRegExp)) {\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(issuer, request));\n }\n else {\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(fslib_2.ppath.dirname(issuer), request));\n }\n }\n // No need to use the return value; we just want to check the blacklist status\n findPackageLocator(unqualifiedPath);\n }\n // Things are more hairy if it's a package require - we then need to figure out which package is needed, and in\n // particular the exact version for the given location on the dependency tree\n else {\n if (!issuer) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, { request, issuer });\n }\n const [, dependencyName, subPath] = dependencyNameMatch;\n const issuerLocator = findPackageLocator(issuer);\n // If the issuer file doesn't seem to be owned by a package managed through pnp, then we resort to using the next\n // resolution algorithm in the chain, usually the native Node resolution one\n if (!issuerLocator) {\n const result = callNativeResolution(request, issuer);\n if (result === false) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree)\\n\\nRequire path: \"${request}\"\\nRequired by: ${issuer}\\n`, { request, issuer });\n }\n return fslib_1.NodeFS.toPortablePath(result);\n }\n const issuerInformation = getPackageInformationSafe(issuerLocator);\n // We obtain the dependency reference in regard to the package that request it\n let dependencyReference = issuerInformation.packageDependencies.get(dependencyName);\n // If we can't find it, we check if we can potentially load it from the packages that have been defined as potential fallbacks.\n // It's a bit of a hack, but it improves compatibility with the existing Node ecosystem. Hopefully we should eventually be able\n // to kill this logic and become stricter once pnp gets enough traction and the affected packages fix themselves.\n if (issuerLocator.name !== null) {\n // To allow programs to become gradually stricter, starting from the v2 we enforce that workspaces cannot depend on fallbacks.\n // This works by having a list containing all their locators, and checking when a fallback is required whether it's one of them.\n const exclusionEntry = runtimeState.fallbackExclusionList.get(issuerLocator.name);\n const canUseFallbacks = !exclusionEntry || !exclusionEntry.has(issuerLocator.reference);\n if (canUseFallbacks) {\n for (let t = 0, T = fallbackLocators.length; dependencyReference === undefined && t < T; ++t) {\n const fallbackInformation = getPackageInformationSafe(fallbackLocators[t]);\n const fallbackReference = fallbackInformation.packageDependencies.get(dependencyName);\n if (fallbackReference !== null) {\n dependencyReference = fallbackReference;\n }\n }\n }\n }\n // If we can't find the path, and if the package making the request is the top-level, we can offer nicer error messages\n if (dependencyReference === null) {\n if (issuerLocator.name === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_PEER_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a peer dependency; this isn't allowed as the peer dependency cannot be provided by any parent package\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, { request, issuer, dependencyName });\n }\n else {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_PEER_DEPENDENCY, `A package is trying to access a peer dependency that should be provided by its direct ancestor but isn't\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, issuerLocator: Object.assign({}, issuerLocator), dependencyName });\n }\n }\n else if (dependencyReference === undefined) {\n if (issuerLocator.name === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNDECLARED_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a package that is not declared in your dependencies\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, { request, issuer, dependencyName });\n }\n else {\n const candidates = Array.from(issuerInformation.packageDependencies.keys());\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNDECLARED_DEPENDENCY, `A package is trying to access another package without the second one being listed as a dependency of the first one\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, issuerLocator: Object.assign({}, issuerLocator), dependencyName, candidates });\n }\n }\n // We need to check that the package exists on the filesystem, because it might not have been installed\n const dependencyLocator = Array.isArray(dependencyReference)\n ? { name: dependencyReference[0], reference: dependencyReference[1] }\n : { name: dependencyName, reference: dependencyReference };\n const dependencyInformation = getPackageInformationSafe(dependencyLocator);\n if (!dependencyInformation.packageLocation) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_DEPENDENCY, `A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod.\\n\\nRequired package: ${dependencyLocator.name}@${dependencyLocator.reference} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, dependencyLocator: Object.assign({}, dependencyLocator) });\n }\n // Now that we know which package we should resolve to, we only have to find out the file location\n const dependencyLocation = fslib_2.ppath.resolve(runtimeState.basePath, dependencyInformation.packageLocation);\n if (subPath) {\n unqualifiedPath = fslib_2.ppath.resolve(dependencyLocation, subPath);\n }\n else {\n unqualifiedPath = dependencyLocation;\n }\n }\n return fslib_2.ppath.normalize(unqualifiedPath);\n }\n ;\n /**\n * Transforms an unqualified path into a qualified path by using the Node resolution algorithm (which automatically\n * appends \".js\" / \".json\", and transforms directory accesses into \"index.js\").\n */\n function resolveUnqualified(unqualifiedPath, { extensions = Object.keys(module_1.default._extensions) } = {}) {\n const candidates = [];\n const qualifiedPath = applyNodeExtensionResolution(unqualifiedPath, candidates, { extensions });\n if (qualifiedPath) {\n return fslib_2.ppath.normalize(qualifiedPath);\n }\n else {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED, `Couldn't find a suitable Node resolution for the specified unqualified path\\n\\nSource path: ${unqualifiedPath}\\n${candidates.map(candidate => `Rejected resolution: ${candidate}\\n`).join(``)}`, { unqualifiedPath });\n }\n }\n ;\n /**\n * Transforms a request into a fully qualified path.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n function resolveRequest(request, issuer, { considerBuiltins, extensions } = {}) {\n let unqualifiedPath = resolveToUnqualified(request, issuer, { considerBuiltins });\n if (unqualifiedPath === null)\n return null;\n try {\n return resolveUnqualified(unqualifiedPath, { extensions });\n }\n catch (resolutionError) {\n if (resolutionError.pnpCode === 'QUALIFIED_PATH_RESOLUTION_FAILED')\n Object.assign(resolutionError.data, { request, issuer });\n throw resolutionError;\n }\n }\n ;\n return {\n VERSIONS,\n topLevel,\n getPackageInformation: (locator) => {\n const info = getPackageInformation(locator);\n if (info === null)\n return null;\n const packageLocation = fslib_1.NodeFS.fromPortablePath(info.packageLocation);\n const nativeInfo = Object.assign({}, info, { packageLocation });\n return nativeInfo;\n },\n findPackageLocator: (path) => {\n return findPackageLocator(fslib_1.NodeFS.toPortablePath(path));\n },\n resolveToUnqualified: maybeLog(`resolveToUnqualified`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? fslib_1.NodeFS.toPortablePath(issuer) : null;\n const resolution = resolveToUnqualified(fslib_1.NodeFS.toPortablePath(request), portableIssuer, opts);\n if (resolution === null)\n return null;\n return fslib_1.NodeFS.fromPortablePath(resolution);\n }),\n resolveUnqualified: maybeLog(`resolveUnqualified`, (unqualifiedPath, opts) => {\n return fslib_1.NodeFS.fromPortablePath(resolveUnqualified(fslib_1.NodeFS.toPortablePath(unqualifiedPath), opts));\n }),\n resolveRequest: maybeLog(`resolveRequest`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? fslib_1.NodeFS.toPortablePath(issuer) : null;\n const resolution = resolveRequest(fslib_1.NodeFS.toPortablePath(request), portableIssuer, opts);\n if (resolution === null)\n return null;\n return fslib_1.NodeFS.fromPortablePath(resolution);\n }),\n };\n}\nexports.makeApi = makeApi;\n\n\n/***/ })\n/******/ ]);"; +module.exports = "module.exports =\n/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 11);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst path_1 = __importDefault(__webpack_require__(4));\nexports.PortablePath = {\n root: `/`,\n dot: `.`,\n};\nexports.npath = path_1.default;\nexports.ppath = path_1.default.posix;\nconst WINDOWS_PATH_REGEXP = /^[a-zA-Z]:.*$/;\nconst PORTABLE_PATH_REGEXP = /^\\/[a-zA-Z]:.*$/;\n// Path should look like \"/N:/berry/scripts/plugin-pack.js\"\n// And transform to \"N:\\berry\\scripts\\plugin-pack.js\"\nfunction fromPortablePath(p) {\n if (process.platform !== 'win32')\n return p;\n return p.match(PORTABLE_PATH_REGEXP) ? p.substring(1).replace(/\\//g, `\\\\`) : p;\n}\nexports.fromPortablePath = fromPortablePath;\n// Path should look like \"N:/berry/scripts/plugin-pack.js\"\n// And transform to \"/N:/berry/scripts/plugin-pack.js\"\nfunction toPortablePath(p) {\n if (process.platform !== 'win32')\n return p;\n return (p.match(WINDOWS_PATH_REGEXP) ? `/${p}` : p).replace(/\\\\/g, `/`);\n}\nexports.toPortablePath = toPortablePath;\nfunction convertPath(targetPathUtils, sourcePath) {\n return (targetPathUtils === exports.npath ? fromPortablePath(sourcePath) : toPortablePath(sourcePath));\n}\nexports.convertPath = convertPath;\nfunction toFilename(filename) {\n if (exports.npath.parse(filename).dir !== '' || exports.ppath.parse(filename).dir !== '')\n throw new Error(`Invalid filename: \"${filename}\"`);\n return filename;\n}\nexports.toFilename = toFilename;\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fs_1 = __importDefault(__webpack_require__(2));\nconst FakeFS_1 = __webpack_require__(6);\nconst path_1 = __webpack_require__(0);\nconst path_2 = __webpack_require__(0);\nclass NodeFS extends FakeFS_1.BasePortableFakeFS {\n constructor(realFs = fs_1.default) {\n super();\n this.realFs = realFs;\n }\n getRealPath() {\n return path_1.PortablePath.root;\n }\n async openPromise(p, flags, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.open(NodeFS.fromPortablePath(p), flags, mode, this.makeCallback(resolve, reject));\n });\n }\n openSync(p, flags, mode) {\n return this.realFs.openSync(NodeFS.fromPortablePath(p), flags, mode);\n }\n async readPromise(fd, buffer, offset = 0, length = 0, position = -1) {\n return await new Promise((resolve, reject) => {\n this.realFs.read(fd, buffer, offset, length, position, (error, bytesRead) => {\n if (error) {\n reject(error);\n }\n else {\n resolve(bytesRead);\n }\n });\n });\n }\n readSync(fd, buffer, offset, length, position) {\n return this.realFs.readSync(fd, buffer, offset, length, position);\n }\n async writePromise(fd, buffer, offset, length, position) {\n return await new Promise((resolve, reject) => {\n if (typeof buffer === `string`) {\n return this.realFs.write(fd, buffer, offset, this.makeCallback(resolve, reject));\n }\n else {\n return this.realFs.write(fd, buffer, offset, length, position, this.makeCallback(resolve, reject));\n }\n });\n }\n writeSync(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return this.realFs.writeSync(fd, buffer, offset);\n }\n else {\n return this.realFs.writeSync(fd, buffer, offset, length, position);\n }\n }\n async closePromise(fd) {\n await new Promise((resolve, reject) => {\n this.realFs.close(fd, this.makeCallback(resolve, reject));\n });\n }\n closeSync(fd) {\n this.realFs.closeSync(fd);\n }\n createReadStream(p, opts) {\n const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p);\n return this.realFs.createReadStream(realPath, opts);\n }\n createWriteStream(p, opts) {\n const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p);\n return this.realFs.createWriteStream(realPath, opts);\n }\n async realpathPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.realpath(NodeFS.fromPortablePath(p), {}, this.makeCallback(resolve, reject));\n }).then(path => {\n return NodeFS.toPortablePath(path);\n });\n }\n realpathSync(p) {\n return NodeFS.toPortablePath(this.realFs.realpathSync(NodeFS.fromPortablePath(p), {}));\n }\n async existsPromise(p) {\n return await new Promise(resolve => {\n this.realFs.exists(NodeFS.fromPortablePath(p), resolve);\n });\n }\n accessSync(p, mode) {\n return this.realFs.accessSync(NodeFS.fromPortablePath(p), mode);\n }\n async accessPromise(p, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.access(NodeFS.fromPortablePath(p), mode, this.makeCallback(resolve, reject));\n });\n }\n existsSync(p) {\n return this.realFs.existsSync(NodeFS.fromPortablePath(p));\n }\n async statPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.stat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n statSync(p) {\n return this.realFs.statSync(NodeFS.fromPortablePath(p));\n }\n async lstatPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.lstat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n lstatSync(p) {\n return this.realFs.lstatSync(NodeFS.fromPortablePath(p));\n }\n async chmodPromise(p, mask) {\n return await new Promise((resolve, reject) => {\n this.realFs.chmod(NodeFS.fromPortablePath(p), mask, this.makeCallback(resolve, reject));\n });\n }\n chmodSync(p, mask) {\n return this.realFs.chmodSync(NodeFS.fromPortablePath(p), mask);\n }\n async renamePromise(oldP, newP) {\n return await new Promise((resolve, reject) => {\n this.realFs.rename(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP), this.makeCallback(resolve, reject));\n });\n }\n renameSync(oldP, newP) {\n return this.realFs.renameSync(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP));\n }\n async copyFilePromise(sourceP, destP, flags = 0) {\n return await new Promise((resolve, reject) => {\n this.realFs.copyFile(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags, this.makeCallback(resolve, reject));\n });\n }\n copyFileSync(sourceP, destP, flags = 0) {\n return this.realFs.copyFileSync(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags);\n }\n async appendFilePromise(p, content, opts) {\n return await new Promise((resolve, reject) => {\n const fsNativePath = typeof p === `string` ? NodeFS.fromPortablePath(p) : p;\n if (opts) {\n this.realFs.appendFile(fsNativePath, content, opts, this.makeCallback(resolve, reject));\n }\n else {\n this.realFs.appendFile(fsNativePath, content, this.makeCallback(resolve, reject));\n }\n });\n }\n appendFileSync(p, content, opts) {\n const fsNativePath = typeof p === `string` ? NodeFS.fromPortablePath(p) : p;\n if (opts) {\n this.realFs.appendFileSync(fsNativePath, content, opts);\n }\n else {\n this.realFs.appendFileSync(fsNativePath, content);\n }\n }\n async writeFilePromise(p, content, opts) {\n return await new Promise((resolve, reject) => {\n const fsNativePath = typeof p === `string` ? NodeFS.fromPortablePath(p) : p;\n if (opts) {\n this.realFs.writeFile(fsNativePath, content, opts, this.makeCallback(resolve, reject));\n }\n else {\n this.realFs.writeFile(fsNativePath, content, this.makeCallback(resolve, reject));\n }\n });\n }\n writeFileSync(p, content, opts) {\n const fsNativePath = typeof p === `string` ? NodeFS.fromPortablePath(p) : p;\n if (opts) {\n this.realFs.writeFileSync(fsNativePath, content, opts);\n }\n else {\n this.realFs.writeFileSync(fsNativePath, content);\n }\n }\n async unlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.unlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n unlinkSync(p) {\n return this.realFs.unlinkSync(NodeFS.fromPortablePath(p));\n }\n async utimesPromise(p, atime, mtime) {\n return await new Promise((resolve, reject) => {\n this.realFs.utimes(NodeFS.fromPortablePath(p), atime, mtime, this.makeCallback(resolve, reject));\n });\n }\n utimesSync(p, atime, mtime) {\n this.realFs.utimesSync(NodeFS.fromPortablePath(p), atime, mtime);\n }\n async mkdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.mkdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n mkdirSync(p) {\n return this.realFs.mkdirSync(NodeFS.fromPortablePath(p));\n }\n async rmdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.rmdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n rmdirSync(p) {\n return this.realFs.rmdirSync(NodeFS.fromPortablePath(p));\n }\n async symlinkPromise(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return await new Promise((resolve, reject) => {\n this.realFs.symlink(NodeFS.fromPortablePath(target.replace(/\\/+$/, ``)), NodeFS.fromPortablePath(p), type, this.makeCallback(resolve, reject));\n });\n }\n symlinkSync(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return this.realFs.symlinkSync(NodeFS.fromPortablePath(target.replace(/\\/+$/, ``)), NodeFS.fromPortablePath(p), type);\n }\n async readFilePromise(p, encoding) {\n return await new Promise((resolve, reject) => {\n const fsNativePath = typeof p === `string` ? NodeFS.fromPortablePath(p) : p;\n this.realFs.readFile(fsNativePath, encoding, this.makeCallback(resolve, reject));\n });\n }\n readFileSync(p, encoding) {\n const fsNativePath = typeof p === `string` ? NodeFS.fromPortablePath(p) : p;\n return this.realFs.readFileSync(fsNativePath, encoding);\n }\n async readdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n readdirSync(p) {\n return this.realFs.readdirSync(NodeFS.fromPortablePath(p));\n }\n async readlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n }).then(path => {\n return NodeFS.toPortablePath(path);\n });\n }\n readlinkSync(p) {\n return NodeFS.toPortablePath(this.realFs.readlinkSync(NodeFS.fromPortablePath(p)));\n }\n watch(p, a, b) {\n return this.realFs.watch(NodeFS.fromPortablePath(p), \n // @ts-ignore\n a, b);\n }\n makeCallback(resolve, reject) {\n return (err, result) => {\n if (err) {\n reject(err);\n }\n else {\n resolve(result);\n }\n };\n }\n static fromPortablePath(p) {\n return path_2.fromPortablePath(p);\n }\n static toPortablePath(p) {\n return path_2.toPortablePath(p);\n }\n}\nexports.NodeFS = NodeFS;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"fs\");\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst FakeFS_1 = __webpack_require__(6);\nclass ProxiedFS extends FakeFS_1.FakeFS {\n resolve(path) {\n return this.mapFromBase(this.baseFs.resolve(this.mapToBase(path)));\n }\n getRealPath() {\n return this.mapFromBase(this.baseFs.getRealPath());\n }\n openPromise(p, flags, mode) {\n return this.baseFs.openPromise(this.mapToBase(p), flags, mode);\n }\n openSync(p, flags, mode) {\n return this.baseFs.openSync(this.mapToBase(p), flags, mode);\n }\n async readPromise(fd, buffer, offset, length, position) {\n return await this.baseFs.readPromise(fd, buffer, offset, length, position);\n }\n readSync(fd, buffer, offset, length, position) {\n return this.baseFs.readSync(fd, buffer, offset, length, position);\n }\n async writePromise(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return await this.baseFs.writePromise(fd, buffer, offset);\n }\n else {\n return await this.baseFs.writePromise(fd, buffer, offset, length, position);\n }\n }\n writeSync(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return this.baseFs.writeSync(fd, buffer, offset);\n }\n else {\n return this.baseFs.writeSync(fd, buffer, offset, length, position);\n }\n }\n closePromise(fd) {\n return this.baseFs.closePromise(fd);\n }\n closeSync(fd) {\n this.baseFs.closeSync(fd);\n }\n createReadStream(p, opts) {\n return this.baseFs.createReadStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n createWriteStream(p, opts) {\n return this.baseFs.createWriteStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n async realpathPromise(p) {\n return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(p)));\n }\n realpathSync(p) {\n return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(p)));\n }\n existsPromise(p) {\n return this.baseFs.existsPromise(this.mapToBase(p));\n }\n existsSync(p) {\n return this.baseFs.existsSync(this.mapToBase(p));\n }\n accessSync(p, mode) {\n return this.baseFs.accessSync(this.mapToBase(p), mode);\n }\n accessPromise(p, mode) {\n return this.baseFs.accessPromise(this.mapToBase(p), mode);\n }\n statPromise(p) {\n return this.baseFs.statPromise(this.mapToBase(p));\n }\n statSync(p) {\n return this.baseFs.statSync(this.mapToBase(p));\n }\n lstatPromise(p) {\n return this.baseFs.lstatPromise(this.mapToBase(p));\n }\n lstatSync(p) {\n return this.baseFs.lstatSync(this.mapToBase(p));\n }\n chmodPromise(p, mask) {\n return this.baseFs.chmodPromise(this.mapToBase(p), mask);\n }\n chmodSync(p, mask) {\n return this.baseFs.chmodSync(this.mapToBase(p), mask);\n }\n renamePromise(oldP, newP) {\n return this.baseFs.renamePromise(this.mapToBase(oldP), this.mapToBase(newP));\n }\n renameSync(oldP, newP) {\n return this.baseFs.renameSync(this.mapToBase(oldP), this.mapToBase(newP));\n }\n copyFilePromise(sourceP, destP, flags = 0) {\n return this.baseFs.copyFilePromise(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n copyFileSync(sourceP, destP, flags = 0) {\n return this.baseFs.copyFileSync(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n appendFilePromise(p, content, opts) {\n return this.baseFs.appendFilePromise(this.fsMapToBase(p), content, opts);\n }\n appendFileSync(p, content, opts) {\n return this.baseFs.appendFileSync(this.fsMapToBase(p), content, opts);\n }\n writeFilePromise(p, content, opts) {\n return this.baseFs.writeFilePromise(this.fsMapToBase(p), content, opts);\n }\n writeFileSync(p, content, opts) {\n return this.baseFs.writeFileSync(this.fsMapToBase(p), content, opts);\n }\n unlinkPromise(p) {\n return this.baseFs.unlinkPromise(this.mapToBase(p));\n }\n unlinkSync(p) {\n return this.baseFs.unlinkSync(this.mapToBase(p));\n }\n utimesPromise(p, atime, mtime) {\n return this.baseFs.utimesPromise(this.mapToBase(p), atime, mtime);\n }\n utimesSync(p, atime, mtime) {\n return this.baseFs.utimesSync(this.mapToBase(p), atime, mtime);\n }\n mkdirPromise(p) {\n return this.baseFs.mkdirPromise(this.mapToBase(p));\n }\n mkdirSync(p) {\n return this.baseFs.mkdirSync(this.mapToBase(p));\n }\n rmdirPromise(p) {\n return this.baseFs.rmdirPromise(this.mapToBase(p));\n }\n rmdirSync(p) {\n return this.baseFs.rmdirSync(this.mapToBase(p));\n }\n symlinkPromise(target, p) {\n return this.baseFs.symlinkPromise(this.mapToBase(target), this.mapToBase(p));\n }\n symlinkSync(target, p) {\n return this.baseFs.symlinkSync(this.mapToBase(target), this.mapToBase(p));\n }\n readFilePromise(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFilePromise(this.fsMapToBase(p), encoding);\n }\n else {\n return this.baseFs.readFilePromise(this.fsMapToBase(p), encoding);\n }\n }\n readFileSync(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFileSync(this.fsMapToBase(p), encoding);\n }\n else {\n return this.baseFs.readFileSync(this.fsMapToBase(p), encoding);\n }\n }\n readdirPromise(p) {\n return this.baseFs.readdirPromise(this.mapToBase(p));\n }\n readdirSync(p) {\n return this.baseFs.readdirSync(this.mapToBase(p));\n }\n async readlinkPromise(p) {\n return this.mapFromBase(await this.baseFs.readlinkPromise(this.mapToBase(p)));\n }\n readlinkSync(p) {\n return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(p)));\n }\n watch(p, a, b) {\n return this.baseFs.watch(this.mapToBase(p), \n // @ts-ignore\n a, b);\n }\n fsMapToBase(p) {\n if (typeof p === `number`) {\n return p;\n }\n else {\n return this.mapToBase(p);\n }\n }\n}\nexports.ProxiedFS = ProxiedFS;\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"path\");\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst tmp_1 = __importDefault(__webpack_require__(12));\nconst NodeFS_1 = __webpack_require__(1);\nvar path_1 = __webpack_require__(0);\nexports.PortablePath = path_1.PortablePath;\nvar path_2 = __webpack_require__(0);\nexports.npath = path_2.npath;\nexports.ppath = path_2.ppath;\nexports.toFilename = path_2.toFilename;\nexports.fromPortablePath = path_2.fromPortablePath;\nexports.toPortablePath = path_2.toPortablePath;\nvar AliasFS_1 = __webpack_require__(14);\nexports.AliasFS = AliasFS_1.AliasFS;\nvar FakeFS_1 = __webpack_require__(6);\nexports.FakeFS = FakeFS_1.FakeFS;\nvar CwdFS_1 = __webpack_require__(15);\nexports.CwdFS = CwdFS_1.CwdFS;\nvar JailFS_1 = __webpack_require__(16);\nexports.JailFS = JailFS_1.JailFS;\nvar LazyFS_1 = __webpack_require__(17);\nexports.LazyFS = LazyFS_1.LazyFS;\nvar NodeFS_2 = __webpack_require__(1);\nexports.NodeFS = NodeFS_2.NodeFS;\nvar PosixFS_1 = __webpack_require__(18);\nexports.PosixFS = PosixFS_1.PosixFS;\nvar ProxiedFS_1 = __webpack_require__(3);\nexports.ProxiedFS = ProxiedFS_1.ProxiedFS;\nvar VirtualFS_1 = __webpack_require__(19);\nexports.VirtualFS = VirtualFS_1.VirtualFS;\nvar ZipFS_1 = __webpack_require__(9);\nexports.ZipFS = ZipFS_1.ZipFS;\nvar ZipOpenFS_1 = __webpack_require__(24);\nexports.ZipOpenFS = ZipOpenFS_1.ZipOpenFS;\nfunction patchFs(patchedFs, fakeFs) {\n const SYNC_IMPLEMENTATIONS = new Set([\n `accessSync`,\n `appendFileSync`,\n `createReadStream`,\n `chmodSync`,\n `closeSync`,\n `copyFileSync`,\n `lstatSync`,\n `openSync`,\n `readSync`,\n `readlinkSync`,\n `readFileSync`,\n `readdirSync`,\n `readlinkSync`,\n `realpathSync`,\n `rmdirSync`,\n `statSync`,\n `symlinkSync`,\n `unlinkSync`,\n `utimesSync`,\n `watch`,\n `writeFileSync`,\n `writeSync`,\n ]);\n const ASYNC_IMPLEMENTATIONS = new Set([\n `accessPromise`,\n `appendFilePromise`,\n `chmodPromise`,\n `closePromise`,\n `copyFilePromise`,\n `lstatPromise`,\n `openPromise`,\n `readdirPromise`,\n `realpathPromise`,\n `readFilePromise`,\n `readdirPromise`,\n `readlinkPromise`,\n `rmdirPromise`,\n `statPromise`,\n `symlinkPromise`,\n `unlinkPromise`,\n `utimesPromise`,\n `writeFilePromise`,\n `writeSync`,\n ]);\n patchedFs.existsSync = (p) => {\n try {\n return fakeFs.existsSync(p);\n }\n catch (error) {\n return false;\n }\n };\n patchedFs.exists = (p, ...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => { };\n process.nextTick(() => {\n fakeFs.existsPromise(p).then(exists => {\n callback(exists);\n }, () => {\n callback(false);\n });\n });\n };\n patchedFs.read = (p, buffer, ...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => { };\n process.nextTick(() => {\n fakeFs.readPromise(p, buffer, ...args).then(bytesRead => {\n callback(undefined, bytesRead, buffer);\n }, error => {\n callback(error);\n });\n });\n };\n for (const fnName of ASYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName.replace(/Promise$/, ``);\n patchedFs[origName] = (...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => { };\n process.nextTick(() => {\n fakeImpl(...args).then((result) => {\n callback(undefined, result);\n }, (error) => {\n callback(error);\n });\n });\n };\n }\n for (const fnName of SYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName;\n patchedFs[origName] = fakeImpl;\n }\n patchedFs.realpathSync.native = patchedFs.realpathSync;\n patchedFs.realpath.native = patchedFs.realpath;\n}\nexports.patchFs = patchFs;\nfunction extendFs(realFs, fakeFs) {\n const patchedFs = Object.create(realFs);\n patchFs(patchedFs, fakeFs);\n return patchedFs;\n}\nexports.extendFs = extendFs;\nexports.xfs = Object.assign(new NodeFS_1.NodeFS(), {\n mktempSync(cb) {\n const { name, removeCallback } = tmp_1.default.dirSync({ unsafeCleanup: true });\n if (typeof cb === `undefined`) {\n return NodeFS_1.NodeFS.toPortablePath(name);\n }\n else {\n try {\n return cb(NodeFS_1.NodeFS.toPortablePath(name));\n }\n finally {\n removeCallback();\n }\n }\n },\n mktempPromise(cb) {\n if (typeof cb === `undefined`) {\n return new Promise((resolve, reject) => {\n tmp_1.default.dir({ unsafeCleanup: true }, (err, path) => {\n if (err) {\n reject(err);\n }\n else {\n resolve(NodeFS_1.NodeFS.toPortablePath(path));\n }\n });\n });\n }\n else {\n return new Promise((resolve, reject) => {\n tmp_1.default.dir({ unsafeCleanup: true }, (err, path, cleanup) => {\n if (err) {\n reject(err);\n }\n else {\n Promise.resolve(NodeFS_1.NodeFS.toPortablePath(path)).then(cb).then(result => {\n cleanup();\n resolve(result);\n }, error => {\n cleanup();\n reject(error);\n });\n }\n });\n });\n }\n },\n});\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst path_1 = __webpack_require__(0);\nconst path_2 = __webpack_require__(0);\nclass FakeFS {\n constructor(pathUtils) {\n this.pathUtils = pathUtils;\n }\n async removePromise(p) {\n let stat;\n try {\n stat = await this.lstatPromise(p);\n }\n catch (error) {\n if (error.code === `ENOENT`) {\n return;\n }\n else {\n throw error;\n }\n }\n if (stat.isDirectory()) {\n for (const entry of await this.readdirPromise(p))\n await this.removePromise(this.pathUtils.resolve(p, entry));\n // 5 gives 1s worth of retries at worst\n for (let t = 0; t < 5; ++t) {\n try {\n await this.rmdirPromise(p);\n break;\n }\n catch (error) {\n if (error.code === `EBUSY` || error.code === `ENOTEMPTY`) {\n await new Promise(resolve => setTimeout(resolve, t * 100));\n continue;\n }\n else {\n throw error;\n }\n }\n }\n }\n else {\n await this.unlinkPromise(p);\n }\n }\n removeSync(p) {\n let stat;\n try {\n stat = this.lstatSync(p);\n }\n catch (error) {\n if (error.code === `ENOENT`) {\n return;\n }\n else {\n throw error;\n }\n }\n if (stat.isDirectory()) {\n for (const entry of this.readdirSync(p))\n this.removeSync(this.pathUtils.resolve(p, entry));\n this.rmdirSync(p);\n }\n else {\n this.unlinkSync(p);\n }\n }\n async mkdirpPromise(p, { chmod, utimes } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p))\n return;\n const parts = p.split(this.pathUtils.sep);\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n if (!this.existsSync(subPath)) {\n try {\n await this.mkdirPromise(subPath);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n }\n else {\n throw error;\n }\n }\n if (chmod != null)\n await this.chmodPromise(subPath, chmod);\n if (utimes != null) {\n await this.utimesPromise(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n mkdirpSync(p, { chmod, utimes } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p))\n return;\n const parts = p.split(this.pathUtils.sep);\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n if (!this.existsSync(subPath)) {\n try {\n this.mkdirSync(subPath);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n }\n else {\n throw error;\n }\n }\n if (chmod != null)\n this.chmodSync(subPath, chmod);\n if (utimes != null) {\n this.utimesSync(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n async copyPromise(destination, source, { baseFs = this, overwrite = true } = {}) {\n const stat = await baseFs.lstatPromise(source);\n const exists = await this.existsSync(destination);\n if (stat.isDirectory()) {\n await this.mkdirpPromise(destination);\n const directoryListing = await baseFs.readdirPromise(source);\n await Promise.all(directoryListing.map(entry => {\n return this.copyPromise(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite });\n }));\n }\n else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists)\n await this.removePromise(destination);\n const content = await baseFs.readFilePromise(source);\n await this.writeFilePromise(destination, content);\n }\n }\n else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists)\n await this.removePromise(destination);\n const target = await baseFs.readlinkPromise(source);\n await this.symlinkPromise(path_2.convertPath(this.pathUtils, target), destination);\n }\n }\n else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n const mode = stat.mode & 0o777;\n await this.chmodPromise(destination, mode);\n }\n copySync(destination, source, { baseFs = this, overwrite = true } = {}) {\n const stat = baseFs.lstatSync(source);\n const exists = this.existsSync(destination);\n if (stat.isDirectory()) {\n this.mkdirpSync(destination);\n const directoryListing = baseFs.readdirSync(source);\n for (const entry of directoryListing) {\n this.copySync(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite });\n }\n }\n else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists)\n this.removeSync(destination);\n const content = baseFs.readFileSync(source);\n this.writeFileSync(destination, content);\n }\n }\n else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists)\n this.removeSync(destination);\n const target = baseFs.readlinkSync(source);\n this.symlinkSync(path_2.convertPath(this.pathUtils, target), destination);\n }\n }\n else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n const mode = stat.mode & 0o777;\n this.chmodSync(destination, mode);\n }\n async changeFilePromise(p, content) {\n try {\n const current = await this.readFilePromise(p, `utf8`);\n if (current === content) {\n return;\n }\n }\n catch (error) {\n // ignore errors, no big deal\n }\n await this.writeFilePromise(p, content);\n }\n changeFileSync(p, content) {\n try {\n const current = this.readFileSync(p, `utf8`);\n if (current === content) {\n return;\n }\n }\n catch (error) {\n // ignore errors, no big deal\n }\n this.writeFileSync(p, content);\n }\n async movePromise(fromP, toP) {\n try {\n await this.renamePromise(fromP, toP);\n }\n catch (error) {\n if (error.code === `EXDEV`) {\n await this.copyPromise(toP, fromP);\n await this.removePromise(fromP);\n }\n else {\n throw error;\n }\n }\n }\n moveSync(fromP, toP) {\n try {\n this.renameSync(fromP, toP);\n }\n catch (error) {\n if (error.code === `EXDEV`) {\n this.copySync(toP, fromP);\n this.removeSync(fromP);\n }\n else {\n throw error;\n }\n }\n }\n async lockPromise(affectedPath, callback) {\n const lockPath = `${affectedPath}.lock`;\n const interval = 1000 / 60;\n const timeout = Date.now() + 60 * 1000;\n let fd = null;\n while (fd === null) {\n try {\n fd = await this.openPromise(lockPath, `wx`);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n if (Date.now() < timeout) {\n await new Promise(resolve => setTimeout(resolve, interval));\n }\n else {\n throw new Error(`Couldn't acquire a lock in a reasonable time (via ${lockPath})`);\n }\n }\n else {\n throw error;\n }\n }\n }\n try {\n return await callback();\n }\n finally {\n await this.closePromise(fd);\n await this.unlinkPromise(lockPath);\n }\n }\n}\nexports.FakeFS = FakeFS;\n;\nclass BasePortableFakeFS extends FakeFS {\n constructor() {\n super(path_2.ppath);\n }\n resolve(p) {\n return this.pathUtils.resolve(path_1.PortablePath.root, p);\n }\n}\nexports.BasePortableFakeFS = BasePortableFakeFS;\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"module\");\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"crypto\");\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst libzip_1 = __importDefault(__webpack_require__(20));\nconst fs_1 = __webpack_require__(2);\nconst stream_1 = __webpack_require__(22);\nconst util_1 = __webpack_require__(23);\nconst FakeFS_1 = __webpack_require__(6);\nconst NodeFS_1 = __webpack_require__(1);\nconst path_1 = __webpack_require__(0);\nconst S_IFMT = 0o170000;\nconst S_IFDIR = 0o040000;\nconst S_IFREG = 0o100000;\nconst S_IFLNK = 0o120000;\nclass StatEntry {\n constructor() {\n this.dev = 0;\n this.ino = 0;\n this.mode = 0;\n this.nlink = 1;\n this.rdev = 0;\n this.blocks = 1;\n }\n isBlockDevice() {\n return false;\n }\n isCharacterDevice() {\n return false;\n }\n isDirectory() {\n return (this.mode & S_IFMT) === S_IFDIR;\n }\n isFIFO() {\n return false;\n }\n isFile() {\n return (this.mode & S_IFMT) === S_IFREG;\n }\n isSocket() {\n return false;\n }\n isSymbolicLink() {\n return (this.mode & S_IFMT) === S_IFLNK;\n }\n}\nfunction makeDefaultStats() {\n return Object.assign(new StatEntry(), {\n uid: 0,\n gid: 0,\n size: 0,\n blksize: 0,\n atimeMs: 0,\n mtimeMs: 0,\n ctimeMs: 0,\n birthtimeMs: 0,\n atime: new Date(0),\n mtime: new Date(0),\n ctime: new Date(0),\n birthtime: new Date(0),\n mode: S_IFREG | 0o644,\n });\n}\nfunction toUnixTimestamp(time) {\n if (typeof time === 'string' && String(+time) === time)\n return +time;\n // @ts-ignore\n if (Number.isFinite(time)) {\n if (time < 0) {\n return Date.now() / 1000;\n }\n else {\n return time;\n }\n }\n // convert to 123.456 UNIX timestamp\n if (util_1.isDate(time))\n return time.getTime() / 1000;\n throw new Error(`Invalid time`);\n}\nclass ZipFS extends FakeFS_1.BasePortableFakeFS {\n constructor(source, opts) {\n super();\n this.listings = new Map();\n this.entries = new Map();\n this.fds = new Map();\n this.nextFd = 0;\n this.ready = false;\n const pathOptions = opts;\n if (typeof source === `string`) {\n const { baseFs = new NodeFS_1.NodeFS() } = pathOptions;\n this.baseFs = baseFs;\n this.path = source;\n }\n else {\n this.path = null;\n this.baseFs = null;\n }\n if (opts.stats) {\n this.stats = opts.stats;\n }\n else {\n if (typeof source === `string`) {\n try {\n this.stats = this.baseFs.statSync(source);\n }\n catch (error) {\n if (error.code === `ENOENT` && pathOptions.create) {\n this.stats = makeDefaultStats();\n }\n else {\n throw error;\n }\n }\n }\n else {\n this.stats = makeDefaultStats();\n }\n }\n const errPtr = libzip_1.default.malloc(4);\n try {\n let flags = 0;\n if (typeof source === `string` && pathOptions.create)\n flags |= libzip_1.default.ZIP_CREATE | libzip_1.default.ZIP_TRUNCATE;\n if (opts.readOnly)\n flags |= libzip_1.default.ZIP_RDONLY;\n if (typeof source === `string`) {\n this.zip = libzip_1.default.open(NodeFS_1.NodeFS.fromPortablePath(source), flags, errPtr);\n }\n else {\n const lzSource = this.allocateUnattachedSource(source);\n try {\n this.zip = libzip_1.default.openFromSource(lzSource, flags, errPtr);\n }\n catch (error) {\n libzip_1.default.source.free(lzSource);\n throw error;\n }\n }\n if (this.zip === 0) {\n const error = libzip_1.default.struct.errorS();\n libzip_1.default.error.initWithCode(error, libzip_1.default.getValue(errPtr, `i32`));\n throw new Error(libzip_1.default.error.strerror(error));\n }\n }\n finally {\n libzip_1.default.free(errPtr);\n }\n this.listings.set(path_1.PortablePath.root, new Set());\n const entryCount = libzip_1.default.getNumEntries(this.zip, 0);\n for (let t = 0; t < entryCount; ++t) {\n const raw = libzip_1.default.getName(this.zip, t, 0);\n if (path_1.ppath.isAbsolute(raw))\n continue;\n const p = path_1.ppath.resolve(path_1.PortablePath.root, raw);\n this.registerEntry(p, t);\n // If the raw path is a directory, register it\n // to prevent empty folder being skipped\n if (raw.endsWith('/')) {\n this.registerListing(p);\n }\n }\n this.ready = true;\n }\n getAllFiles() {\n return Array.from(this.entries.keys());\n }\n getRealPath() {\n if (!this.path)\n throw new Error(`ZipFS don't have real paths when loaded from a buffer`);\n return this.path;\n }\n saveAndClose() {\n if (!this.path || !this.baseFs)\n throw new Error(`ZipFS cannot be saved and must be discarded when loaded from a buffer`);\n if (!this.ready)\n throw Object.assign(new Error(`EBUSY: archive closed, close`), { code: `EBUSY` });\n const previousMod = this.baseFs.existsSync(this.path)\n ? this.baseFs.statSync(this.path).mode & 0o777\n : null;\n const rc = libzip_1.default.close(this.zip);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n // Libzip overrides the chmod when writing the archive, which is a weird\n // behavior I don't totally understand (plus the umask seems bogus in some\n // weird cases - maybe related to emscripten?)\n //\n // See also https://github.com/nih-at/libzip/issues/77\n if (previousMod !== null && previousMod !== (this.baseFs.statSync(this.path).mode & 0o777))\n this.baseFs.chmodSync(this.path, previousMod);\n this.ready = false;\n }\n discardAndClose() {\n libzip_1.default.discard(this.zip);\n this.ready = false;\n }\n async openPromise(p, flags, mode) {\n return this.openSync(p, flags, mode);\n }\n openSync(p, flags, mode) {\n const fd = this.nextFd++;\n this.fds.set(fd, { cursor: 0, p });\n return fd;\n }\n async readPromise(fd, buffer, offset, length, position) {\n return this.readSync(fd, buffer, offset, length, position);\n }\n readSync(fd, buffer, offset = 0, length = 0, position = -1) {\n const entry = this.fds.get(fd);\n if (typeof entry === `undefined`)\n throw Object.assign(new Error(`EBADF: bad file descriptor, read`), { code: `EBADF` });\n let realPosition;\n if (position === -1 || position === null)\n realPosition = entry.cursor;\n else\n realPosition = position;\n const source = this.readFileSync(entry.p);\n source.copy(buffer, offset, realPosition, realPosition + length);\n const bytesRead = Math.max(0, Math.min(source.length - realPosition, length));\n if (position === -1)\n entry.cursor += bytesRead;\n return bytesRead;\n }\n async writePromise(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return this.writeSync(fd, buffer, position);\n }\n else {\n return this.writeSync(fd, buffer, offset, length, position);\n }\n }\n writeSync(fd, buffer, offset, length, position) {\n const entry = this.fds.get(fd);\n if (typeof entry === `undefined`)\n throw Object.assign(new Error(`EBADF: bad file descriptor, read`), { code: `EBADF` });\n throw new Error(`Unimplemented`);\n }\n async closePromise(fd) {\n return this.closeSync(fd);\n }\n closeSync(fd) {\n const entry = this.fds.get(fd);\n if (typeof entry === `undefined`)\n throw Object.assign(new Error(`EBADF: bad file descriptor, read`), { code: `EBADF` });\n this.fds.delete(fd);\n }\n createReadStream(p, { encoding } = {}) {\n if (p === null)\n throw new Error(`Unimplemented`);\n const stream = Object.assign(new stream_1.PassThrough(), {\n bytesRead: 0,\n path: p,\n close: () => {\n clearImmediate(immediate);\n },\n });\n const immediate = setImmediate(() => {\n try {\n const data = this.readFileSync(p, encoding);\n stream.bytesRead = data.length;\n stream.write(data);\n stream.end();\n }\n catch (error) {\n stream.emit(`error`, error);\n stream.end();\n }\n });\n return stream;\n }\n createWriteStream(p, { encoding } = {}) {\n if (p === null)\n throw new Error(`Unimplemented`);\n const stream = Object.assign(new stream_1.PassThrough(), {\n bytesWritten: 0,\n path: p,\n close: () => {\n stream.end();\n },\n });\n const chunks = [];\n stream.on(`data`, chunk => {\n const chunkBuffer = Buffer.from(chunk);\n stream.bytesWritten += chunkBuffer.length;\n chunks.push(chunkBuffer);\n });\n stream.on(`end`, () => {\n this.writeFileSync(p, Buffer.concat(chunks), encoding);\n });\n return stream;\n }\n async realpathPromise(p) {\n return this.realpathSync(p);\n }\n realpathSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, lstat '${p}'`), { code: `ENOENT` });\n return resolvedP;\n }\n async existsPromise(p) {\n return this.existsSync(p);\n }\n existsSync(p) {\n let resolvedP;\n try {\n resolvedP = this.resolveFilename(`stat '${p}'`, p);\n }\n catch (error) {\n return false;\n }\n return this.entries.has(resolvedP) || this.listings.has(resolvedP);\n }\n async accessPromise(p, mode) {\n return this.accessSync(p, mode);\n }\n accessSync(p, mode) {\n const resolvedP = this.resolveFilename(`access '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) {\n throw Object.assign(new Error(`ENOENT: no such file or directory, access '${p}'`), { code: `ENOENT` });\n }\n }\n async statPromise(p) {\n return this.statSync(p);\n }\n statSync(p) {\n const resolvedP = this.resolveFilename(`stat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, stat '${p}'`), { code: `ENOENT` });\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, stat '${p}'`), { code: `ENOTDIR` });\n return this.statImpl(`stat '${p}'`, resolvedP);\n }\n async lstatPromise(p) {\n return this.lstatSync(p);\n }\n lstatSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, lstat '${p}'`), { code: `ENOENT` });\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, lstat '${p}'`), { code: `ENOTDIR` });\n return this.statImpl(`lstat '${p}'`, resolvedP);\n }\n statImpl(reason, p) {\n if (this.listings.has(p)) {\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = 0;\n const blksize = 512;\n const blocks = 0;\n const atimeMs = this.stats.mtimeMs;\n const birthtimeMs = this.stats.mtimeMs;\n const ctimeMs = this.stats.mtimeMs;\n const mtimeMs = this.stats.mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = S_IFDIR | 0o755;\n return Object.assign(new StatEntry(), { uid, gid, size, blksize, blocks, atime, birthtime, ctime, mtime, atimeMs, birthtimeMs, ctimeMs, mtimeMs, mode });\n }\n const entry = this.entries.get(p);\n if (entry !== undefined) {\n const stat = libzip_1.default.struct.statS();\n const rc = libzip_1.default.statIndex(this.zip, entry, 0, 0, stat);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = (libzip_1.default.struct.statSize(stat) >>> 0);\n const blksize = 512;\n const blocks = Math.ceil(size / blksize);\n const mtimeMs = (libzip_1.default.struct.statMtime(stat) >>> 0) * 1000;\n const atimeMs = mtimeMs;\n const birthtimeMs = mtimeMs;\n const ctimeMs = mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = this.getUnixMode(entry, S_IFREG | 0o644);\n return Object.assign(new StatEntry(), { uid, gid, size, blksize, blocks, atime, birthtime, ctime, mtime, atimeMs, birthtimeMs, ctimeMs, mtimeMs, mode });\n }\n throw new Error(`Unreachable`);\n }\n getUnixMode(index, defaultMode) {\n const rc = libzip_1.default.file.getExternalAttributes(this.zip, index, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n return defaultMode;\n return libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n }\n registerListing(p) {\n let listing = this.listings.get(p);\n if (listing)\n return listing;\n const parentListing = this.registerListing(path_1.ppath.dirname(p));\n listing = new Set();\n parentListing.add(path_1.ppath.basename(p));\n this.listings.set(p, listing);\n return listing;\n }\n registerEntry(p, index) {\n const parentListing = this.registerListing(path_1.ppath.dirname(p));\n parentListing.add(path_1.ppath.basename(p));\n this.entries.set(p, index);\n }\n resolveFilename(reason, p, resolveLastComponent = true) {\n if (!this.ready)\n throw Object.assign(new Error(`EBUSY: archive closed, ${reason}`), { code: `EBUSY` });\n let resolvedP = path_1.ppath.resolve(path_1.PortablePath.root, p);\n if (resolvedP === `/`)\n return path_1.PortablePath.root;\n while (true) {\n const parentP = this.resolveFilename(reason, path_1.ppath.dirname(resolvedP), true);\n const isDir = this.listings.has(parentP);\n const doesExist = this.entries.has(parentP);\n if (!isDir && !doesExist)\n throw Object.assign(new Error(`ENOENT: no such file or directory, ${reason}`), { code: `ENOENT` });\n if (!isDir)\n throw Object.assign(new Error(`ENOTDIR: not a directory, ${reason}`), { code: `ENOTDIR` });\n resolvedP = path_1.ppath.resolve(parentP, path_1.ppath.basename(resolvedP));\n if (!resolveLastComponent)\n break;\n const index = libzip_1.default.name.locate(this.zip, resolvedP);\n if (index === -1)\n break;\n if (this.isSymbolicLink(index)) {\n const target = this.getFileSource(index).toString();\n resolvedP = path_1.ppath.resolve(path_1.ppath.dirname(resolvedP), target);\n }\n else {\n break;\n }\n }\n return resolvedP;\n }\n allocateBuffer(content) {\n if (!Buffer.isBuffer(content))\n content = Buffer.from(content);\n const buffer = libzip_1.default.malloc(content.byteLength);\n if (!buffer)\n throw new Error(`Couldn't allocate enough memory`);\n // Copy the file into the Emscripten heap\n const heap = new Uint8Array(libzip_1.default.HEAPU8.buffer, buffer, content.byteLength);\n heap.set(content);\n return { buffer, byteLength: content.byteLength };\n }\n allocateUnattachedSource(content) {\n const error = libzip_1.default.struct.errorS();\n const { buffer, byteLength } = this.allocateBuffer(content);\n const source = libzip_1.default.source.fromUnattachedBuffer(buffer, byteLength, 0, true, error);\n if (source === 0) {\n libzip_1.default.free(error);\n throw new Error(libzip_1.default.error.strerror(error));\n }\n return source;\n }\n allocateSource(content) {\n const { buffer, byteLength } = this.allocateBuffer(content);\n const source = libzip_1.default.source.fromBuffer(this.zip, buffer, byteLength, 0, true);\n if (source === 0) {\n libzip_1.default.free(buffer);\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n return source;\n }\n setFileSource(p, content) {\n const target = path_1.ppath.relative(path_1.PortablePath.root, p);\n const lzSource = this.allocateSource(content);\n try {\n return libzip_1.default.file.add(this.zip, target, lzSource, libzip_1.default.ZIP_FL_OVERWRITE);\n }\n catch (error) {\n libzip_1.default.source.free(lzSource);\n throw error;\n }\n }\n isSymbolicLink(index) {\n const attrs = libzip_1.default.file.getExternalAttributes(this.zip, index, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (attrs === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n return false;\n const attributes = libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n return (attributes & S_IFMT) === S_IFLNK;\n }\n getFileSource(index) {\n const stat = libzip_1.default.struct.statS();\n const rc = libzip_1.default.statIndex(this.zip, index, 0, 0, stat);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const size = libzip_1.default.struct.statSize(stat);\n const buffer = libzip_1.default.malloc(size);\n try {\n const file = libzip_1.default.fopenIndex(this.zip, index, 0, 0);\n if (file === 0)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n try {\n const rc = libzip_1.default.fread(file, buffer, size, 0);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.file.getError(file)));\n else if (rc < size)\n throw new Error(`Incomplete read`);\n else if (rc > size)\n throw new Error(`Overread`);\n const memory = libzip_1.default.HEAPU8.subarray(buffer, buffer + size);\n const data = Buffer.from(memory);\n return data;\n }\n finally {\n libzip_1.default.fclose(file);\n }\n }\n finally {\n libzip_1.default.free(buffer);\n }\n }\n async chmodPromise(p, mask) {\n return this.chmodSync(p, mask);\n }\n chmodSync(p, mask) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false);\n // We silently ignore chmod requests for directories\n if (this.listings.has(resolvedP))\n return;\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const oldMod = this.getUnixMode(entry, S_IFREG | 0o000);\n const newMod = oldMod & (~0o777) | mask;\n const rc = libzip_1.default.file.setExternalAttributes(this.zip, entry, 0, 0, libzip_1.default.ZIP_OPSYS_UNIX, newMod << 16);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async renamePromise(oldP, newP) {\n return this.renameSync(oldP, newP);\n }\n renameSync(oldP, newP) {\n throw new Error(`Unimplemented`);\n }\n async copyFilePromise(sourceP, destP, flags) {\n return this.copyFileSync(sourceP, destP, flags);\n }\n copyFileSync(sourceP, destP, flags = 0) {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`ENOSYS: unsupported clone operation, copyfile '${sourceP}' -> ${destP}'`), { code: `ENOSYS` });\n const resolvedSourceP = this.resolveFilename(`copyfile '${sourceP} -> ${destP}'`, sourceP);\n const indexSource = this.entries.get(resolvedSourceP);\n if (typeof indexSource === `undefined`)\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n const resolvedDestP = this.resolveFilename(`copyfile '${sourceP}' -> ${destP}'`, destP);\n const indexDest = this.entries.get(resolvedDestP);\n if ((flags & (fs_1.constants.COPYFILE_EXCL | fs_1.constants.COPYFILE_FICLONE_FORCE)) !== 0 && typeof indexDest !== `undefined`)\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n const source = this.getFileSource(indexSource);\n const newIndex = this.setFileSource(resolvedDestP, source);\n if (newIndex !== indexDest) {\n this.registerEntry(resolvedDestP, newIndex);\n }\n }\n async appendFilePromise(p, content, opts) {\n return this.appendFileSync(p, content, opts);\n }\n appendFileSync(p, content, opts = {}) {\n if (typeof opts === `undefined`)\n opts = { flag: `a` };\n else if (typeof opts === `string`)\n opts = { flag: `a`, encoding: opts };\n else if (typeof opts.flag === `undefined`)\n opts = Object.assign({ flag: `a` }, opts);\n return this.writeFileSync(p, content, opts);\n }\n async writeFilePromise(p, content, opts) {\n return this.writeFileSync(p, content, opts);\n }\n writeFileSync(p, content, opts) {\n if (typeof p !== `string`)\n throw Object.assign(new Error(`EBADF: bad file descriptor, read`), { code: `EBADF` });\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, open '${p}'`), { code: `EISDIR` });\n const index = this.entries.get(resolvedP);\n if (index !== undefined && typeof opts === `object` && opts.flag && opts.flag.includes(`a`))\n content = Buffer.concat([this.getFileSource(index), Buffer.from(content)]);\n let encoding = null;\n if (typeof opts === `string`)\n encoding = opts;\n else if (typeof opts === `object` && opts.encoding)\n encoding = opts.encoding;\n if (encoding !== null)\n content = content.toString(encoding);\n const newIndex = this.setFileSource(resolvedP, content);\n if (newIndex !== index) {\n this.registerEntry(resolvedP, newIndex);\n }\n }\n async unlinkPromise(p) {\n return this.unlinkSync(p);\n }\n unlinkSync(p) {\n throw new Error(`Unimplemented`);\n }\n async utimesPromise(p, atime, mtime) {\n return this.utimesSync(p, atime, mtime);\n }\n utimesSync(p, atime, mtime) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p);\n return this.utimesImpl(resolvedP, mtime);\n }\n async lutimesPromise(p, atime, mtime) {\n return this.lutimesSync(p, atime, mtime);\n }\n lutimesSync(p, atime, mtime) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false);\n return this.utimesImpl(resolvedP, mtime);\n }\n utimesImpl(resolvedP, mtime) {\n if (this.listings.has(resolvedP))\n if (!this.entries.has(resolvedP))\n this.hydrateDirectory(resolvedP);\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const rc = libzip_1.default.file.setMtime(this.zip, entry, 0, toUnixTimestamp(mtime), 0);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async mkdirPromise(p) {\n return this.mkdirSync(p);\n }\n mkdirSync(p) {\n const resolvedP = this.resolveFilename(`mkdir '${p}'`, p);\n if (this.entries.has(resolvedP) || this.listings.has(resolvedP))\n throw Object.assign(new Error(`EEXIST: file already exists, mkdir '${p}'`), { code: `EEXIST` });\n this.hydrateDirectory(resolvedP);\n }\n async rmdirPromise(p) {\n return this.rmdirSync(p);\n }\n rmdirSync(p) {\n throw new Error(`Unimplemented`);\n }\n hydrateDirectory(resolvedP) {\n const index = libzip_1.default.dir.add(this.zip, path_1.ppath.relative(path_1.PortablePath.root, resolvedP));\n if (index === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n this.registerListing(resolvedP);\n this.registerEntry(resolvedP, index);\n return index;\n }\n async symlinkPromise(target, p) {\n return this.symlinkSync(target, p);\n }\n symlinkSync(target, p) {\n const resolvedP = this.resolveFilename(`symlink '${target}' -> '${p}'`, p);\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, symlink '${target}' -> '${p}'`), { code: `EISDIR` });\n if (this.entries.has(resolvedP))\n throw Object.assign(new Error(`EEXIST: file already exists, symlink '${target}' -> '${p}'`), { code: `EEXIST` });\n const index = this.setFileSource(resolvedP, target);\n this.registerEntry(resolvedP, index);\n const rc = libzip_1.default.file.setExternalAttributes(this.zip, index, 0, 0, libzip_1.default.ZIP_OPSYS_UNIX, (0o120000 | 0o777) << 16);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async readFilePromise(p, encoding) {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.readFileSync(p, encoding);\n default:\n return this.readFileSync(p, encoding);\n }\n }\n readFileSync(p, encoding) {\n if (typeof p !== `string`)\n throw Object.assign(new Error(`EBADF: bad file descriptor, read`), { code: `EBADF` });\n // This is messed up regarding the TS signatures\n if (typeof encoding === `object`)\n // @ts-ignore\n encoding = encoding ? encoding.encoding : undefined;\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, open '${p}'`), { code: `ENOENT` });\n // Ensures that the last component is a directory, if the user said so (even if it is we'll throw right after with EISDIR anyway)\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, open '${p}'`), { code: `ENOTDIR` });\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, read`), { code: `EISDIR` });\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const data = this.getFileSource(entry);\n return encoding ? data.toString(encoding) : data;\n }\n async readdirPromise(p) {\n return this.readdirSync(p);\n }\n readdirSync(p) {\n const resolvedP = this.resolveFilename(`scandir '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, scandir '${p}'`), { code: `ENOENT` });\n const directoryListing = this.listings.get(resolvedP);\n if (!directoryListing)\n throw Object.assign(new Error(`ENOTDIR: not a directory, scandir '${p}'`), { code: `ENOTDIR` });\n return Array.from(directoryListing);\n }\n async readlinkPromise(p) {\n return this.readlinkSync(p);\n }\n readlinkSync(p) {\n const resolvedP = this.resolveFilename(`readlink '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, readlink '${p}'`), { code: `ENOENT` });\n // Ensure that the last component is a directory (if it is we'll throw right after with EISDIR anyway)\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, open '${p}'`), { code: `ENOTDIR` });\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const rc = libzip_1.default.file.getExternalAttributes(this.zip, entry, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n const attributes = libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n if ((attributes & 0o170000) !== 0o120000)\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n return this.getFileSource(entry).toString();\n }\n watch(p, a, b) {\n let persistent;\n switch (typeof a) {\n case `function`:\n case `string`:\n case `undefined`:\n {\n persistent = true;\n }\n break;\n default:\n {\n // @ts-ignore\n ({ persistent = true } = a);\n }\n break;\n }\n if (!persistent)\n return { on: () => { }, close: () => { } };\n const interval = setInterval(() => { }, 24 * 60 * 60 * 1000);\n return { on: () => { }, close: () => { clearInterval(interval); } };\n }\n}\nexports.ZipFS = ZipFS;\n;\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ErrorCode;\n(function (ErrorCode) {\n ErrorCode[\"API_ERROR\"] = \"API_ERROR\";\n ErrorCode[\"BLACKLISTED\"] = \"BLACKLISTED\";\n ErrorCode[\"BUILTIN_NODE_RESOLUTION_FAILED\"] = \"BUILTIN_NODE_RESOLUTION_FAILED\";\n ErrorCode[\"MISSING_DEPENDENCY\"] = \"MISSING_DEPENDENCY\";\n ErrorCode[\"MISSING_PEER_DEPENDENCY\"] = \"MISSING_PEER_DEPENDENCY\";\n ErrorCode[\"QUALIFIED_PATH_RESOLUTION_FAILED\"] = \"QUALIFIED_PATH_RESOLUTION_FAILED\";\n ErrorCode[\"INTERNAL\"] = \"INTERNAL\";\n ErrorCode[\"UNDECLARED_DEPENDENCY\"] = \"UNDECLARED_DEPENDENCY\";\n ErrorCode[\"UNSUPPORTED\"] = \"UNSUPPORTED\";\n})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));\n;\n// Some errors are exposed as MODULE_NOT_FOUND for compatibility with packages\n// that expect this umbrella error when the resolution fails\nconst MODULE_NOT_FOUND_ERRORS = new Set([\n ErrorCode.BLACKLISTED,\n ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED,\n ErrorCode.MISSING_DEPENDENCY,\n ErrorCode.MISSING_PEER_DEPENDENCY,\n ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED,\n ErrorCode.UNDECLARED_DEPENDENCY,\n]);\n/**\n * Simple helper function that assign an error code to an error, so that it can more easily be caught and used\n * by third-parties.\n */\nfunction makeError(pnpCode, message, data = {}) {\n const code = MODULE_NOT_FOUND_ERRORS.has(pnpCode)\n ? `MODULE_NOT_FOUND`\n : pnpCode;\n return Object.assign(new Error(message), {\n code, pnpCode, data,\n });\n}\nexports.makeError = makeError;\n/**\n * Returns the module that should be used to resolve require calls. It's usually the direct parent, except if we're\n * inside an eval expression.\n */\nfunction getIssuerModule(parent) {\n let issuer = parent;\n while (issuer && (issuer.id === '[eval]' || issuer.id === '' || !issuer.filename))\n issuer = issuer.parent;\n return issuer;\n}\nexports.getIssuerModule = getIssuerModule;\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nconst fs_1 = __importDefault(__webpack_require__(2));\nconst module_1 = __importDefault(__webpack_require__(7));\nconst path_1 = __importDefault(__webpack_require__(4));\nconst string_decoder_1 = __importDefault(__webpack_require__(25));\nconst applyPatch_1 = __webpack_require__(26);\nconst hydrateRuntimeState_1 = __webpack_require__(27);\nconst makeApi_1 = __webpack_require__(28);\n// We must copy the fs into a local, because otherwise\n// 1. we would make the NodeFS instance use the function that we patched (infinite loop)\n// 2. Object.create(fs) isn't enough, since it won't prevent the proto from being modified\nconst localFs = Object.assign({}, fs_1.default);\nconst nodeFs = new fslib_1.NodeFS(localFs);\nconst runtimeState = $$SETUP_STATE(hydrateRuntimeState_1.hydrateRuntimeState);\nlet underlyingFs = new fslib_1.ZipOpenFS({ baseFs: nodeFs });\nfor (const virtualRoot of runtimeState.virtualRoots)\n underlyingFs = new fslib_1.VirtualFS(virtualRoot, { baseFs: underlyingFs });\nmodule.exports = makeApi_1.makeApi(runtimeState, {\n compatibilityMode: true,\n fakeFs: underlyingFs,\n pnpapiResolution: path_1.default.resolve(__dirname, __filename),\n});\nmodule.exports.setup = () => {\n applyPatch_1.applyPatch(module.exports, {\n compatibilityMode: true,\n fakeFs: underlyingFs,\n });\n};\nif (__non_webpack_module__.parent && __non_webpack_module__.parent.id === 'internal/preload') {\n module.exports.setup();\n if (__non_webpack_module__.filename) {\n // We delete it from the cache in order to support the case where the CLI resolver is invoked from \"yarn run\"\n // It's annoying because it might cause some issues when the file is multiple times in NODE_OPTIONS, but it shouldn't happen anyway.\n // @ts-ignore\n delete module_1.default._cache[__non_webpack_module__.filename];\n }\n}\n// @ts-ignore\nif (process.mainModule === __non_webpack_module__) {\n const reportError = (code, message, data) => {\n process.stdout.write(`${JSON.stringify([{ code, message, data }, null])}\\n`);\n };\n const reportSuccess = (resolution) => {\n process.stdout.write(`${JSON.stringify([null, resolution])}\\n`);\n };\n const processResolution = (request, issuer) => {\n try {\n reportSuccess(module.exports.resolveRequest(request, issuer));\n }\n catch (error) {\n reportError(error.code, error.message, error.data);\n }\n };\n const processRequest = (data) => {\n try {\n const [request, issuer] = JSON.parse(data);\n processResolution(request, issuer);\n }\n catch (error) {\n reportError(`INVALID_JSON`, error.message, error.data);\n }\n };\n if (process.argv.length > 2) {\n if (process.argv.length !== 4) {\n process.stderr.write(`Usage: ${process.argv[0]} ${process.argv[1]} \\n`);\n process.exitCode = 64; /* EX_USAGE */\n }\n else {\n processResolution(process.argv[2], process.argv[3]);\n }\n }\n else {\n let buffer = '';\n const decoder = new string_decoder_1.default.StringDecoder();\n process.stdin.on('data', chunk => {\n buffer += decoder.write(chunk);\n do {\n const index = buffer.indexOf('\\n');\n if (index === -1)\n break;\n const line = buffer.slice(0, index);\n buffer = buffer.slice(index + 1);\n processRequest(line);\n } while (true);\n });\n }\n}\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/*!\n * Tmp\n *\n * Copyright (c) 2011-2017 KARASZI Istvan \n *\n * MIT Licensed\n */\n\n/*\n * Module dependencies.\n */\nconst fs = __webpack_require__(2);\nconst path = __webpack_require__(4);\nconst crypto = __webpack_require__(8);\nconst osTmpDir = __webpack_require__(13);\nconst _c = process.binding('constants');\n\n/*\n * The working inner variables.\n */\nconst\n /**\n * The temporary directory.\n * @type {string}\n */\n tmpDir = osTmpDir(),\n\n // the random characters to choose from\n RANDOM_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',\n\n TEMPLATE_PATTERN = /XXXXXX/,\n\n DEFAULT_TRIES = 3,\n\n CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR),\n\n EBADF = _c.EBADF || _c.os.errno.EBADF,\n ENOENT = _c.ENOENT || _c.os.errno.ENOENT,\n\n DIR_MODE = 448 /* 0o700 */,\n FILE_MODE = 384 /* 0o600 */,\n\n // this will hold the objects need to be removed on exit\n _removeObjects = [];\n\nvar\n _gracefulCleanup = false,\n _uncaughtException = false;\n\n/**\n * Random name generator based on crypto.\n * Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript\n *\n * @param {number} howMany\n * @returns {string} the generated random name\n * @private\n */\nfunction _randomChars(howMany) {\n var\n value = [],\n rnd = null;\n\n // make sure that we do not fail because we ran out of entropy\n try {\n rnd = crypto.randomBytes(howMany);\n } catch (e) {\n rnd = crypto.pseudoRandomBytes(howMany);\n }\n\n for (var i = 0; i < howMany; i++) {\n value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);\n }\n\n return value.join('');\n}\n\n/**\n * Checks whether the `obj` parameter is defined or not.\n *\n * @param {Object} obj\n * @returns {boolean} true if the object is undefined\n * @private\n */\nfunction _isUndefined(obj) {\n return typeof obj === 'undefined';\n}\n\n/**\n * Parses the function arguments.\n *\n * This function helps to have optional arguments.\n *\n * @param {(Options|Function)} options\n * @param {Function} callback\n * @returns {Array} parsed arguments\n * @private\n */\nfunction _parseArguments(options, callback) {\n if (typeof options == 'function') {\n return [callback || {}, options];\n }\n\n if (_isUndefined(options)) {\n return [{}, callback];\n }\n\n return [options, callback];\n}\n\n/**\n * Generates a new temporary name.\n *\n * @param {Object} opts\n * @returns {string} the new random name according to opts\n * @private\n */\nfunction _generateTmpName(opts) {\n if (opts.name) {\n return path.join(opts.dir || tmpDir, opts.name);\n }\n\n // mkstemps like template\n if (opts.template) {\n return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6));\n }\n\n // prefix and postfix\n const name = [\n opts.prefix || 'tmp-',\n process.pid,\n _randomChars(12),\n opts.postfix || ''\n ].join('');\n\n return path.join(opts.dir || tmpDir, name);\n}\n\n/**\n * Gets a temporary file name.\n *\n * @param {(Options|tmpNameCallback)} options options or callback\n * @param {?tmpNameCallback} callback the callback function\n */\nfunction tmpName(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1],\n tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;\n\n if (isNaN(tries) || tries < 0)\n return cb(new Error('Invalid tries'));\n\n if (opts.template && !opts.template.match(TEMPLATE_PATTERN))\n return cb(new Error('Invalid template provided'));\n\n (function _getUniqueName() {\n const name = _generateTmpName(opts);\n\n // check whether the path exists then retry if needed\n fs.stat(name, function (err) {\n if (!err) {\n if (tries-- > 0) return _getUniqueName();\n\n return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));\n }\n\n cb(null, name);\n });\n }());\n}\n\n/**\n * Synchronous version of tmpName.\n *\n * @param {Object} options\n * @returns {string} the generated random name\n * @throws {Error} if the options are invalid or could not generate a filename\n */\nfunction tmpNameSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0],\n tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;\n\n if (isNaN(tries) || tries < 0)\n throw new Error('Invalid tries');\n\n if (opts.template && !opts.template.match(TEMPLATE_PATTERN))\n throw new Error('Invalid template provided');\n\n do {\n const name = _generateTmpName(opts);\n try {\n fs.statSync(name);\n } catch (e) {\n return name;\n }\n } while (tries-- > 0);\n\n throw new Error('Could not get a unique tmp filename, max tries reached');\n}\n\n/**\n * Creates and opens a temporary file.\n *\n * @param {(Options|fileCallback)} options the config options or the callback function\n * @param {?fileCallback} callback\n */\nfunction file(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1];\n\n opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix;\n\n // gets a temporary filename\n tmpName(opts, function _tmpNameCreated(err, name) {\n if (err) return cb(err);\n\n // create and open the file\n fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) {\n if (err) return cb(err);\n\n if (opts.discardDescriptor) {\n return fs.close(fd, function _discardCallback(err) {\n if (err) {\n // Low probability, and the file exists, so this could be\n // ignored. If it isn't we certainly need to unlink the\n // file, and if that fails too its error is more\n // important.\n try {\n fs.unlinkSync(name);\n } catch (e) {\n if (!isENOENT(e)) {\n err = e;\n }\n }\n return cb(err);\n }\n cb(null, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts));\n });\n }\n if (opts.detachDescriptor) {\n return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts));\n }\n cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts));\n });\n });\n}\n\n/**\n * Synchronous version of file.\n *\n * @param {Options} options\n * @returns {FileSyncObject} object consists of name, fd and removeCallback\n * @throws {Error} if cannot create a file\n */\nfunction fileSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0];\n\n opts.postfix = opts.postfix || '.tmp';\n\n const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;\n const name = tmpNameSync(opts);\n var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);\n if (opts.discardDescriptor) {\n fs.closeSync(fd); \n fd = undefined;\n }\n\n return {\n name: name,\n fd: fd,\n removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts)\n };\n}\n\n/**\n * Removes files and folders in a directory recursively.\n *\n * @param {string} root\n * @private\n */\nfunction _rmdirRecursiveSync(root) {\n const dirs = [root];\n\n do {\n var\n dir = dirs.pop(),\n deferred = false,\n files = fs.readdirSync(dir);\n\n for (var i = 0, length = files.length; i < length; i++) {\n var\n file = path.join(dir, files[i]),\n stat = fs.lstatSync(file); // lstat so we don't recurse into symlinked directories\n\n if (stat.isDirectory()) {\n if (!deferred) {\n deferred = true;\n dirs.push(dir);\n }\n dirs.push(file);\n } else {\n fs.unlinkSync(file);\n }\n }\n\n if (!deferred) {\n fs.rmdirSync(dir);\n }\n } while (dirs.length !== 0);\n}\n\n/**\n * Creates a temporary directory.\n *\n * @param {(Options|dirCallback)} options the options or the callback function\n * @param {?dirCallback} callback\n */\nfunction dir(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1];\n\n // gets a temporary filename\n tmpName(opts, function _tmpNameCreated(err, name) {\n if (err) return cb(err);\n\n // create the directory\n fs.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err) {\n if (err) return cb(err);\n\n cb(null, name, _prepareTmpDirRemoveCallback(name, opts));\n });\n });\n}\n\n/**\n * Synchronous version of dir.\n *\n * @param {Options} options\n * @returns {DirSyncObject} object consists of name and removeCallback\n * @throws {Error} if it cannot create a directory\n */\nfunction dirSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0];\n\n const name = tmpNameSync(opts);\n fs.mkdirSync(name, opts.mode || DIR_MODE);\n\n return {\n name: name,\n removeCallback: _prepareTmpDirRemoveCallback(name, opts)\n };\n}\n\n/**\n * Prepares the callback for removal of the temporary file.\n *\n * @param {string} name the path of the file\n * @param {number} fd file descriptor\n * @param {Object} opts\n * @returns {fileCallback}\n * @private\n */\nfunction _prepareTmpFileRemoveCallback(name, fd, opts) {\n const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) {\n try {\n if (0 <= fdPath[0]) {\n fs.closeSync(fdPath[0]);\n }\n }\n catch (e) {\n // under some node/windows related circumstances, a temporary file\n // may have not be created as expected or the file was already closed\n // by the user, in which case we will simply ignore the error\n if (!isEBADF(e) && !isENOENT(e)) {\n // reraise any unanticipated error\n throw e;\n }\n }\n try {\n fs.unlinkSync(fdPath[1]);\n }\n catch (e) {\n if (!isENOENT(e)) {\n // reraise any unanticipated error\n throw e;\n }\n }\n }, [fd, name]);\n\n if (!opts.keep) {\n _removeObjects.unshift(removeCallback);\n }\n\n return removeCallback;\n}\n\n/**\n * Prepares the callback for removal of the temporary directory.\n *\n * @param {string} name\n * @param {Object} opts\n * @returns {Function} the callback\n * @private\n */\nfunction _prepareTmpDirRemoveCallback(name, opts) {\n const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs.rmdirSync.bind(fs);\n const removeCallback = _prepareRemoveCallback(removeFunction, name);\n\n if (!opts.keep) {\n _removeObjects.unshift(removeCallback);\n }\n\n return removeCallback;\n}\n\n/**\n * Creates a guarded function wrapping the removeFunction call.\n *\n * @param {Function} removeFunction\n * @param {Object} arg\n * @returns {Function}\n * @private\n */\nfunction _prepareRemoveCallback(removeFunction, arg) {\n var called = false;\n\n return function _cleanupCallback(next) {\n if (!called) {\n const index = _removeObjects.indexOf(_cleanupCallback);\n if (index >= 0) {\n _removeObjects.splice(index, 1);\n }\n\n called = true;\n removeFunction(arg);\n }\n\n if (next) next(null);\n };\n}\n\n/**\n * The garbage collector.\n *\n * @private\n */\nfunction _garbageCollector() {\n if (_uncaughtException && !_gracefulCleanup) {\n return;\n }\n\n // the function being called removes itself from _removeObjects,\n // loop until _removeObjects is empty\n while (_removeObjects.length) {\n try {\n _removeObjects[0].call(null);\n } catch (e) {\n // already removed?\n }\n }\n}\n\n/**\n * Helper for testing against EBADF to compensate changes made to Node 7.x under Windows.\n */\nfunction isEBADF(error) {\n return isExpectedError(error, -EBADF, 'EBADF');\n}\n\n/**\n * Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows.\n */\nfunction isENOENT(error) {\n return isExpectedError(error, -ENOENT, 'ENOENT');\n}\n\n/**\n * Helper to determine whether the expected error code matches the actual code and errno,\n * which will differ between the supported node versions.\n *\n * - Node >= 7.0:\n * error.code {String}\n * error.errno {String|Number} any numerical value will be negated\n *\n * - Node >= 6.0 < 7.0:\n * error.code {String}\n * error.errno {Number} negated\n *\n * - Node >= 4.0 < 6.0: introduces SystemError\n * error.code {String}\n * error.errno {Number} negated\n *\n * - Node >= 0.10 < 4.0:\n * error.code {Number} negated\n * error.errno n/a\n */\nfunction isExpectedError(error, code, errno) {\n return error.code == code || error.code == errno;\n}\n\n/**\n * Sets the graceful cleanup.\n *\n * Also removes the created files and directories when an uncaught exception occurs.\n */\nfunction setGracefulCleanup() {\n _gracefulCleanup = true;\n}\n\nconst version = process.versions.node.split('.').map(function (value) {\n return parseInt(value, 10);\n});\n\nif (version[0] === 0 && (version[1] < 9 || version[1] === 9 && version[2] < 5)) {\n process.addListener('uncaughtException', function _uncaughtExceptionThrown(err) {\n _uncaughtException = true;\n _garbageCollector();\n\n throw err;\n });\n}\n\nprocess.addListener('exit', function _exit(code) {\n if (code) _uncaughtException = true;\n _garbageCollector();\n});\n\n/**\n * Configuration options.\n *\n * @typedef {Object} Options\n * @property {?number} tries the number of tries before give up the name generation\n * @property {?string} template the \"mkstemp\" like filename template\n * @property {?string} name fix name\n * @property {?string} dir the tmp directory to use\n * @property {?string} prefix prefix for the generated name\n * @property {?string} postfix postfix for the generated name\n */\n\n/**\n * @typedef {Object} FileSyncObject\n * @property {string} name the name of the file\n * @property {string} fd the file descriptor\n * @property {fileCallback} removeCallback the callback function to remove the file\n */\n\n/**\n * @typedef {Object} DirSyncObject\n * @property {string} name the name of the directory\n * @property {fileCallback} removeCallback the callback function to remove the directory\n */\n\n/**\n * @callback tmpNameCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n */\n\n/**\n * @callback fileCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n * @param {number} fd the file descriptor\n * @param {cleanupCallback} fn the cleanup callback function\n */\n\n/**\n * @callback dirCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n * @param {cleanupCallback} fn the cleanup callback function\n */\n\n/**\n * Removes the temporary created file or directory.\n *\n * @callback cleanupCallback\n * @param {simpleCallback} [next] function to call after entry was removed\n */\n\n/**\n * Callback function for function composition.\n * @see {@link https://github.com/raszi/node-tmp/issues/57|raszi/node-tmp#57}\n *\n * @callback simpleCallback\n */\n\n// exporting all the needed methods\nmodule.exports.tmpdir = tmpDir;\n\nmodule.exports.dir = dir;\nmodule.exports.dirSync = dirSync;\n\nmodule.exports.file = file;\nmodule.exports.fileSync = fileSync;\n\nmodule.exports.tmpName = tmpName;\nmodule.exports.tmpNameSync = tmpNameSync;\n\nmodule.exports.setGracefulCleanup = setGracefulCleanup;\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar isWindows = process.platform === 'win32';\nvar trailingSlashRe = isWindows ? /[^:]\\\\$/ : /.\\/$/;\n\n// https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43\nmodule.exports = function () {\n\tvar path;\n\n\tif (isWindows) {\n\t\tpath = process.env.TEMP ||\n\t\t\tprocess.env.TMP ||\n\t\t\t(process.env.SystemRoot || process.env.windir) + '\\\\temp';\n\t} else {\n\t\tpath = process.env.TMPDIR ||\n\t\t\tprocess.env.TMP ||\n\t\t\tprocess.env.TEMP ||\n\t\t\t'/tmp';\n\t}\n\n\tif (trailingSlashRe.test(path)) {\n\t\tpath = path.slice(0, -1);\n\t}\n\n\treturn path;\n};\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst ProxiedFS_1 = __webpack_require__(3);\nclass AliasFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs, pathUtils }) {\n super(pathUtils);\n this.target = target;\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.target;\n }\n getBaseFs() {\n return this.baseFs;\n }\n mapFromBase(p) {\n return p;\n }\n mapToBase(p) {\n return p;\n }\n}\nexports.AliasFS = AliasFS;\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\nclass CwdFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.target = target;\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.target);\n }\n mapFromBase(path) {\n return this.pathUtils.relative(this.getRealPath(), path);\n }\n mapToBase(path) {\n return this.pathUtils.resolve(this.getRealPath(), path);\n }\n}\nexports.CwdFS = CwdFS;\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\nconst JAIL_ROOT = path_1.PortablePath.root;\nclass JailFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.target = this.pathUtils.resolve(path_1.PortablePath.root, target);\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.pathUtils.relative(path_1.PortablePath.root, this.target));\n }\n getTarget() {\n return this.target;\n }\n getBaseFs() {\n return this.baseFs;\n }\n mapToBase(p) {\n const normalized = this.pathUtils.normalize(p);\n if (this.pathUtils.isAbsolute(p))\n return this.pathUtils.resolve(this.target, this.pathUtils.relative(JAIL_ROOT, p));\n if (normalized.match(/^\\.\\.\\//))\n throw new Error(`Resolving this path (${p}) would escape the jail`);\n return this.pathUtils.resolve(this.target, p);\n }\n mapFromBase(p) {\n return this.pathUtils.resolve(JAIL_ROOT, this.pathUtils.relative(this.target, p));\n }\n}\nexports.JailFS = JailFS;\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst ProxiedFS_1 = __webpack_require__(3);\nclass LazyFS extends ProxiedFS_1.ProxiedFS {\n constructor(factory, pathUtils) {\n super(pathUtils);\n this.instance = null;\n this.factory = factory;\n }\n get baseFs() {\n if (!this.instance)\n this.instance = this.factory();\n return this.instance;\n }\n mapFromBase(p) {\n return p;\n }\n mapToBase(p) {\n return p;\n }\n}\nexports.LazyFS = LazyFS;\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\nclass PosixFS extends ProxiedFS_1.ProxiedFS {\n constructor(baseFs) {\n super(path_1.npath);\n this.baseFs = baseFs;\n }\n mapFromBase(path) {\n return NodeFS_1.NodeFS.fromPortablePath(path);\n }\n mapToBase(path) {\n return NodeFS_1.NodeFS.toPortablePath(path);\n }\n}\nexports.PosixFS = PosixFS;\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\n// https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js\nconst escapeRegexp = (s) => s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\nclass VirtualFS extends ProxiedFS_1.ProxiedFS {\n static makeVirtualPath(base, component, to) {\n // Obtains the relative distance between the virtual path and its actual target\n const target = path_1.ppath.relative(path_1.ppath.dirname(base), to);\n const segments = target.split(`/`);\n // Counts how many levels we need to go back to start applying the rest of the path\n let depth = 0;\n while (depth < segments.length && segments[depth] === `..`)\n depth += 1;\n const finalSegments = segments.slice(depth);\n const fullVirtualPath = path_1.ppath.join(base, component, String(depth), ...finalSegments);\n return fullVirtualPath;\n }\n constructor(virtual, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.baseFs = baseFs;\n this.target = path_1.ppath.dirname(virtual);\n this.virtual = virtual;\n this.mapToBaseRegExp = new RegExp(`^(${escapeRegexp(this.virtual)})((?:/([^\\/]+)(?:/([^/]+))?)?((?:/.*)?))$`);\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.target);\n }\n realpathSync(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return this.baseFs.realpathSync(p);\n if (!match[5])\n return p;\n const realpath = this.baseFs.realpathSync(this.mapToBase(p));\n return VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n async realpathPromise(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return await this.baseFs.realpathPromise(p);\n if (!match[5])\n return p;\n const realpath = await this.baseFs.realpathPromise(this.mapToBase(p));\n return VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n mapToBase(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return p;\n if (match[3])\n return this.mapToBase(path_1.ppath.join(this.target, `../`.repeat(Number(match[4])), match[5]));\n return this.target;\n }\n mapFromBase(p) {\n return p;\n }\n}\nexports.VirtualFS = VirtualFS;\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst libzip_1 = __importDefault(__webpack_require__(21));\nconst number64 = [\n `number`,\n `number`,\n];\n// eslint-disable-next-line arca/no-default-export\nexports.default = {\n // Those are getters because they can change after memory growth\n get HEAP8() { return libzip_1.default.HEAP8; },\n get HEAPU8() { return libzip_1.default.HEAPU8; },\n ZIP_CHECKCONS: 4,\n ZIP_CREATE: 1,\n ZIP_EXCL: 2,\n ZIP_TRUNCATE: 8,\n ZIP_RDONLY: 16,\n ZIP_FL_OVERWRITE: 8192,\n ZIP_OPSYS_DOS: 0x00,\n ZIP_OPSYS_AMIGA: 0x01,\n ZIP_OPSYS_OPENVMS: 0x02,\n ZIP_OPSYS_UNIX: 0x03,\n ZIP_OPSYS_VM_CMS: 0x04,\n ZIP_OPSYS_ATARI_ST: 0x05,\n ZIP_OPSYS_OS_2: 0x06,\n ZIP_OPSYS_MACINTOSH: 0x07,\n ZIP_OPSYS_Z_SYSTEM: 0x08,\n ZIP_OPSYS_CPM: 0x09,\n ZIP_OPSYS_WINDOWS_NTFS: 0x0a,\n ZIP_OPSYS_MVS: 0x0b,\n ZIP_OPSYS_VSE: 0x0c,\n ZIP_OPSYS_ACORN_RISC: 0x0d,\n ZIP_OPSYS_VFAT: 0x0e,\n ZIP_OPSYS_ALTERNATE_MVS: 0x0f,\n ZIP_OPSYS_BEOS: 0x10,\n ZIP_OPSYS_TANDEM: 0x11,\n ZIP_OPSYS_OS_400: 0x12,\n ZIP_OPSYS_OS_X: 0x13,\n uint08S: libzip_1.default._malloc(1),\n uint16S: libzip_1.default._malloc(2),\n uint32S: libzip_1.default._malloc(4),\n uint64S: libzip_1.default._malloc(8),\n malloc: libzip_1.default._malloc,\n free: libzip_1.default._free,\n getValue: libzip_1.default.getValue,\n open: libzip_1.default.cwrap(`zip_open`, `number`, [`string`, `number`, `number`]),\n openFromSource: libzip_1.default.cwrap(`zip_open_from_source`, `number`, [`number`, `number`, `number`]),\n close: libzip_1.default.cwrap(`zip_close`, `number`, [`number`]),\n discard: libzip_1.default.cwrap(`zip_discard`, `void`, [`number`]),\n getError: libzip_1.default.cwrap(`zip_get_error`, `number`, [`number`]),\n getName: libzip_1.default.cwrap(`zip_get_name`, `string`, [`number`, `number`, `number`]),\n getNumEntries: libzip_1.default.cwrap(`zip_get_num_entries`, `number`, [`number`, `number`]),\n stat: libzip_1.default.cwrap(`zip_stat`, `number`, [`number`, `string`, `number`, `number`]),\n statIndex: libzip_1.default.cwrap(`zip_stat_index`, `number`, [`number`, ...number64, `number`, `number`]),\n fopen: libzip_1.default.cwrap(`zip_fopen`, `number`, [`number`, `string`, `number`]),\n fopenIndex: libzip_1.default.cwrap(`zip_fopen_index`, `number`, [`number`, ...number64, `number`]),\n fread: libzip_1.default.cwrap(`zip_fread`, `number`, [`number`, `number`, `number`, `number`]),\n fclose: libzip_1.default.cwrap(`zip_fclose`, `number`, [`number`]),\n dir: {\n add: libzip_1.default.cwrap(`zip_dir_add`, `number`, [`number`, `string`]),\n },\n file: {\n add: libzip_1.default.cwrap(`zip_file_add`, `number`, [`number`, `string`, `number`, `number`]),\n getError: libzip_1.default.cwrap(`zip_file_get_error`, `number`, [`number`]),\n getExternalAttributes: libzip_1.default.cwrap(`zip_file_get_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setExternalAttributes: libzip_1.default.cwrap(`zip_file_set_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setMtime: libzip_1.default.cwrap(`zip_file_set_mtime`, `number`, [`number`, ...number64, `number`, `number`]),\n },\n error: {\n initWithCode: libzip_1.default.cwrap(`zip_error_init_with_code`, `void`, [`number`, `number`]),\n strerror: libzip_1.default.cwrap(`zip_error_strerror`, `string`, [`number`]),\n },\n name: {\n locate: libzip_1.default.cwrap(`zip_name_locate`, `number`, [`number`, `string`, `number`]),\n },\n source: {\n fromUnattachedBuffer: libzip_1.default.cwrap(`zip_source_buffer_create`, `number`, [`number`, `number`, `number`, `number`]),\n fromBuffer: libzip_1.default.cwrap(`zip_source_buffer`, `number`, [`number`, `number`, ...number64, `number`]),\n free: libzip_1.default.cwrap(`zip_source_free`, `void`, [`number`]),\n },\n struct: {\n stat: libzip_1.default.cwrap(`zipstruct_stat`, `number`, []),\n statS: libzip_1.default.cwrap(`zipstruct_statS`, `number`, []),\n statName: libzip_1.default.cwrap(`zipstruct_stat_name`, `string`, [`number`]),\n statIndex: libzip_1.default.cwrap(`zipstruct_stat_index`, `number`, [`number`]),\n statSize: libzip_1.default.cwrap(`zipstruct_stat_size`, `number`, [`number`]),\n statMtime: libzip_1.default.cwrap(`zipstruct_stat_mtime`, `number`, [`number`]),\n error: libzip_1.default.cwrap(`zipstruct_error`, `number`, []),\n errorS: libzip_1.default.cwrap(`zipstruct_errorS`, `number`, []),\n },\n};\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar frozenFs = Object.assign({}, __webpack_require__(2));\nvar Module=typeof Module!==\"undefined\"?Module:{};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_WORKER=false;var ENVIRONMENT_IS_NODE=true;if(Module[\"ENVIRONMENT\"]){throw new Error(\"Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)\")}var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}else{return scriptDirectory+path}}if(ENVIRONMENT_IS_NODE){if(!(typeof process===\"object\"&&\"function\"===\"function\"))throw new Error(\"not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)\");scriptDirectory=__dirname+\"/\";var nodeFS;var nodePath;Module[\"read\"]=function shell_read(filename,binary){var ret;ret=tryParseAsDataURI(filename);if(!ret){if(!nodeFS)nodeFS=frozenFs;if(!nodePath)nodePath=__webpack_require__(4);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);if(true){module[\"exports\"]=Module}(function(){})(\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});(function(){})(\"unhandledRejection\",abort);Module[\"quit\"]=function(status){process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else{throw new Error(\"environment detection error\")}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;assert(typeof Module[\"memoryInitializerPrefixURL\"]===\"undefined\",\"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"pthreadMainPrefixURL\"]===\"undefined\",\"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"cdInitializerPrefixURL\"]===\"undefined\",\"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"filePackagePrefixURL\"]===\"undefined\",\"Module.filePackagePrefixURL option was removed, use Module.locateFile instead\");stackSave=stackRestore=stackAlloc=function(){abort(\"cannot use the stack before compiled code is ready to run, and has provided stack access\")};function dynamicAlloc(size){assert(DYNAMICTOP_PTR);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}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}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\"){abort(\"No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.\")}function getValue(ptr,type,noSafe){type=type||\"i8\";if(type.charAt(type.length-1)===\"*\")type=\"i32\";if(noSafe){switch(type){case\"i1\":return HEAP8[ptr>>0];case\"i8\":return HEAP8[ptr>>0];case\"i16\":return HEAP16[ptr>>1];case\"i32\":return HEAP32[ptr>>2];case\"i64\":return HEAP32[ptr>>2];case\"float\":return HEAPF32[ptr>>2];case\"double\":return HEAPF64[ptr>>3];default:abort(\"invalid type for getValue: \"+type)}}else{switch(type){case\"i1\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i8\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i16\":return SAFE_HEAP_LOAD(ptr|0,2,0)|0;case\"i32\":return SAFE_HEAP_LOAD(ptr|0,4,0)|0;case\"i64\":return SAFE_HEAP_LOAD(ptr|0,8,0)|0;case\"float\":return Math_fround(SAFE_HEAP_LOAD_D(ptr|0,4,0));case\"double\":return+SAFE_HEAP_LOAD_D(ptr|0,8,0);default:abort(\"invalid type for getValue: \"+type)}}return null}function getSafeHeapType(bytes,isFloat){switch(bytes){case 1:return\"i8\";case 2:return\"i16\";case 4:return isFloat?\"float\":\"i32\";case 8:return\"double\";default:assert(0)}}function SAFE_HEAP_STORE(dest,value,bytes,isFloat){if(dest<=0)abort(\"segmentation fault storing \"+bytes+\" bytes to address \"+dest);if(dest%bytes!==0)abort(\"alignment error storing to address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when storing \"+bytes+\" bytes to address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);setValue(dest,value,getSafeHeapType(bytes,isFloat),1)}function SAFE_HEAP_STORE_D(dest,value,bytes){SAFE_HEAP_STORE(dest,value,bytes,true)}function SAFE_HEAP_LOAD(dest,bytes,unsigned,isFloat){if(dest<=0)abort(\"segmentation fault loading \"+bytes+\" bytes from address \"+dest);if(dest%bytes!==0)abort(\"alignment error loading from address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when loading \"+bytes+\" bytes from address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);var type=getSafeHeapType(bytes,isFloat);var ret=getValue(dest,type,1);if(unsigned)ret=unSign(ret,parseInt(type.substr(1)),1);return ret}function SAFE_HEAP_LOAD_D(dest,bytes,unsigned){return SAFE_HEAP_LOAD(dest,bytes,unsigned,true)}function segfault(){abort(\"segmentation fault\")}function alignfault(){abort(\"alignment fault\")}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;assert(returnType!==\"array\",'Return type should not be \"array\".');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)}}else{switch(type){case\"i1\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i8\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i16\":SAFE_HEAP_STORE(ptr|0,value|0,2);break;case\"i32\":SAFE_HEAP_STORE(ptr|0,value|0,4);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)],SAFE_HEAP_STORE(ptr|0,tempI64[0]|0,4),SAFE_HEAP_STORE(ptr+4|0,tempI64[1]|0,4);break;case\"float\":SAFE_HEAP_STORE_D(ptr|0,Math_fround(value),4);break;case\"double\":SAFE_HEAP_STORE_D(ptr|0,+value,8);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;if(u>=2097152)warnOnce(\"Invalid Unicode code point 0x\"+u.toString(16)+\" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF).\");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){assert(typeof maxBytesToWrite==\"number\",\"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");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){assert(array.length>=0,\"writeArrayToMemory array must have a length (should be an array or typed array)\");HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i0){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 STACK_BASE=22720,STACK_MAX=5265600,DYNAMIC_BASE=5265600,DYNAMICTOP_PTR=22464;assert(STACK_BASE%16===0,\"stack must start aligned\");assert(DYNAMIC_BASE%16===0,\"heap must start aligned\");var TOTAL_STACK=5242880;if(Module[\"TOTAL_STACK\"])assert(TOTAL_STACK===Module[\"TOTAL_STACK\"],\"the stack size can no longer be determined at runtime\");var INITIAL_TOTAL_MEMORY=Module[\"TOTAL_MEMORY\"]||16777216;if(INITIAL_TOTAL_MEMORY>2]=DYNAMIC_BASE;function writeStackCookie(){assert((STACK_MAX&3)==0);HEAPU32[(STACK_MAX>>2)-1]=34821223;HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(HEAPU32[(STACK_MAX>>2)-1]!=34821223||HEAPU32[(STACK_MAX>>2)-2]!=2310721022){abort(\"Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x\"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+\" \"+HEAPU32[(STACK_MAX>>2)-1].toString(16))}if(HEAP32[0]!==1668509029)throw\"Runtime error: The application has corrupted its heap memory area (address zero)!\"}function abortStackOverflow(allocSize){abort(\"Stack overflow! Attempted to allocate \"+allocSize+\" bytes on the stack, but stack has only \"+(STACK_MAX-stackSave()+allocSize)+\" bytes available!\")}HEAP32[0]=1668509029;HEAP16[1]=25459;if(HEAPU8[2]!==115||HEAPU8[3]!==99)throw\"Runtime error: expected the system to be little-endian!\";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(){checkStackCookie();if(runtimeInitialized)return;runtimeInitialized=true;if(!Module[\"noFSInit\"]&&!FS.init.initialized)FS.init();TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){checkStackCookie();FS.ignorePermissions=false;callRuntimeCallbacks(__ATMAIN__)}function postRun(){checkStackCookie();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)}function unSign(value,bits,ignore){if(value>=0){return value}return bits<=32?2*Math.abs(1<=0){err(\"Memory size incompatibility issues may be due to changing TOTAL_MEMORY at runtime to something too large. Use ALLOW_MEMORY_GROWTH to allow any size memory (and also make sure not to set TOTAL_MEMORY at runtime to something smaller than it was at compile time).\")}return false}receiveInstance(instance,module);return Module[\"asm\"]}Module[\"asm\"]=function(global,env,providedBuffer){env[\"memory\"]=wasmMemory;env[\"table\"]=wasmTable=new WebAssembly.Table({\"initial\":55,\"maximum\":55,\"element\":\"anyfunc\"});env[\"__memory_base\"]=1024;env[\"__table_base\"]=0;var exports=createWasm(env);assert(exports,\"binaryen setup failed (no wasm support?)\");return exports};__ATINIT__.push({func:function(){___emscripten_environ_constructor()}});var tempDoublePtr=22704;assert(tempDoublePtr%8==0);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);SAFE_HEAP_STORE(envPtr|0,poolPtr|0,4);SAFE_HEAP_STORE(environ|0,envPtr|0,4)}else{envPtr=SAFE_HEAP_LOAD(environ|0,4,0)|0;poolPtr=SAFE_HEAP_LOAD(envPtr|0,4,0)|0}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=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)},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.resolve(from).substr(1);to=PATH.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(ERRNO_CODES.EPERM)}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);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length>2}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}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(ERRNO_CODES.EINVAL)}},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(ERRNO_CODES[e.code])}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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},readdir:function(node){var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}},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(ERRNO_CODES[e.code])}}}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}return position}}};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 NODERAWFS={lookupPath:function(path){return{path:path,node:{mode:NODEFS.getMode(path)}}},createStandardStreams:function(){FS.streams[0]={fd:0,nfd:0,position:0,path:\"\",flags:0,tty:true,seekable:false};for(var i=1;i<3;i++){FS.streams[i]={fd:i,nfd:i,position:0,path:\"\",flags:577,tty:true,seekable:false}}},cwd:function(){return process.cwd()},chdir:function(){process.chdir.apply(void 0,arguments)},mknod:function(path,mode){if(FS.isDir(path)){fs.mkdirSync(path,mode)}else{fs.writeFileSync(path,\"\",{mode:mode})}},mkdir:function(){fs.mkdirSync.apply(void 0,arguments)},symlink:function(){fs.symlinkSync.apply(void 0,arguments)},rename:function(){fs.renameSync.apply(void 0,arguments)},rmdir:function(){fs.rmdirSync.apply(void 0,arguments)},readdir:function(){fs.readdirSync.apply(void 0,arguments)},unlink:function(){fs.unlinkSync.apply(void 0,arguments)},readlink:function(){return fs.readlinkSync.apply(void 0,arguments)},stat:function(){return fs.statSync.apply(void 0,arguments)},lstat:function(){return fs.lstatSync.apply(void 0,arguments)},chmod:function(){fs.chmodSync.apply(void 0,arguments)},fchmod:function(){fs.fchmodSync.apply(void 0,arguments)},chown:function(){fs.chownSync.apply(void 0,arguments)},fchown:function(){fs.fchownSync.apply(void 0,arguments)},truncate:function(){fs.truncateSync.apply(void 0,arguments)},ftruncate:function(){fs.ftruncateSync.apply(void 0,arguments)},utime:function(){fs.utimesSync.apply(void 0,arguments)},open:function(path,flags,mode,suggestFD){if(typeof flags===\"string\"){flags=VFS.modeStringToFlags(flags)}var nfd=fs.openSync(path,NODEFS.flagsForNode(flags),mode);var fd=suggestFD!=null?suggestFD:FS.nextfd(nfd);var stream={fd:fd,nfd:nfd,position:0,path:path,flags:flags,seekable:true};FS.streams[fd]=stream;return stream},close:function(stream){if(!stream.stream_ops){fs.closeSync(stream.nfd)}FS.closeStream(stream.fd)},llseek:function(stream,offset,whence){if(stream.stream_ops){return VFS.llseek(stream,offset,whence)}var position=offset;if(whence===1){position+=stream.position}else if(whence===2){position+=fs.fstatSync(stream.nfd).size}else if(whence!==0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}stream.position=position;return position},read:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.read(stream,buffer,offset,length,position)}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesRead=fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.write(stream,buffer,offset,length,position)}if(stream.flags&+\"1024\"){FS.llseek(stream,0,+\"2\")}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesWritten=fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:function(){throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP)},mmap:function(){throw new FS.ErrnoError(ERRNO_CODES.ENODEV)},msync:function(){return 0},munmap:function(){return 0},ioctl:function(){throw new FS.ErrnoError(ERRNO_CODES.ENOTTY)}};var ERRNO_MESSAGES={0:\"Success\",1:\"Not super-user\",2:\"No such file or directory\",3:\"No such process\",4:\"Interrupted system call\",5:\"I/O error\",6:\"No such device or address\",7:\"Arg list too long\",8:\"Exec format error\",9:\"Bad file number\",10:\"No children\",11:\"No more processes\",12:\"Not enough core\",13:\"Permission denied\",14:\"Bad address\",15:\"Block device required\",16:\"Mount device busy\",17:\"File exists\",18:\"Cross-device link\",19:\"No such device\",20:\"Not a directory\",21:\"Is a directory\",22:\"Invalid argument\",23:\"Too many open files in system\",24:\"Too many open files\",25:\"Not a typewriter\",26:\"Text file busy\",27:\"File too large\",28:\"No space left on device\",29:\"Illegal seek\",30:\"Read only file system\",31:\"Too many links\",32:\"Broken pipe\",33:\"Math arg out of domain of func\",34:\"Math result not representable\",35:\"File locking deadlock error\",36:\"File or path name too long\",37:\"No record locks available\",38:\"Function not implemented\",39:\"Directory not empty\",40:\"Too many symbolic links\",42:\"No message of desired type\",43:\"Identifier removed\",44:\"Channel number out of range\",45:\"Level 2 not synchronized\",46:\"Level 3 halted\",47:\"Level 3 reset\",48:\"Link number out of range\",49:\"Protocol driver not attached\",50:\"No CSI structure available\",51:\"Level 2 halted\",52:\"Invalid exchange\",53:\"Invalid request descriptor\",54:\"Exchange full\",55:\"No anode\",56:\"Invalid request code\",57:\"Invalid slot\",59:\"Bad font file fmt\",60:\"Device not a stream\",61:\"No data (for no delay io)\",62:\"Timer expired\",63:\"Out of streams resources\",64:\"Machine is not on the network\",65:\"Package not installed\",66:\"The object is remote\",67:\"The link has been severed\",68:\"Advertise error\",69:\"Srmount error\",70:\"Communication error on send\",71:\"Protocol error\",72:\"Multihop attempted\",73:\"Cross mount point (not really error)\",74:\"Trying to read unreadable message\",75:\"Value too large for defined data type\",76:\"Given log. name not unique\",77:\"f.d. invalid for this operation\",78:\"Remote address changed\",79:\"Can access a needed shared lib\",80:\"Accessing a corrupted shared lib\",81:\".lib section in a.out corrupted\",82:\"Attempting to link in too many libs\",83:\"Attempting to exec a shared library\",84:\"Illegal byte sequence\",86:\"Streams pipe error\",87:\"Too many users\",88:\"Socket operation on non-socket\",89:\"Destination address required\",90:\"Message too long\",91:\"Protocol wrong type for socket\",92:\"Protocol not available\",93:\"Unknown protocol\",94:\"Socket type not supported\",95:\"Not supported\",96:\"Protocol family not supported\",97:\"Address family not supported by protocol family\",98:\"Address already in use\",99:\"Address not available\",100:\"Network interface is not configured\",101:\"Network is unreachable\",102:\"Connection reset by network\",103:\"Connection aborted\",104:\"Connection reset by peer\",105:\"No buffer space available\",106:\"Socket is already connected\",107:\"Socket is not connected\",108:\"Can't send after socket shutdown\",109:\"Too many references\",110:\"Connection timed out\",111:\"Connection refused\",112:\"Host is down\",113:\"Host is unreachable\",114:\"Socket already connected\",115:\"Connection already in progress\",116:\"Stale file handle\",122:\"Quota exceeded\",123:\"No medium (in tape drive)\",125:\"Operation canceled\",130:\"Previous owner died\",131:\"State not recoverable\"};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.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){assert(FS.syncFSRequests>0);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);assert(idx!==-1);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,\"NODEFS\":NODEFS}},init:function(input,output,error){assert(!FS.init.initialized,\"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)\");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);assert(size>=0);if(contents.slice){for(var i=0;i=0)assert(high===0);else assert(high===-1);return low},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall10(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.unlink(path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}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();var offset=offset_low;FS.llseek(stream,offset,whence);SAFE_HEAP_STORE(result|0,stream.position|0,4);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 ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}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 ___syscall15(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),mode=SYSCALLS.get();FS.chmod(path,mode);return 0}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 ___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-ERRNO_CODES.EINVAL}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;SAFE_HEAP_STORE(arg+offset|0,2|0,2);return 0}case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:___setErrNo(ERRNO_CODES.EINVAL);return-1;default:{return-ERRNO_CODES.EINVAL}}}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall38(which,varargs){SYSCALLS.varargs=varargs;try{var old_path=SYSCALLS.getStr(),new_path=SYSCALLS.getStr();FS.rename(old_path,new_path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall40(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.rmdir(path);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 ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),op=SYSCALLS.get();switch(op){case 21509:case 21505:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21519:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;var argp=SYSCALLS.get();SAFE_HEAP_STORE(argp|0,0|0,4);return 0}case 21520:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return-ERRNO_CODES.EINVAL}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21524:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}default:abort(\"bad ioctl syscall \"+op)}}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 ___syscall60(which,varargs){SYSCALLS.varargs=varargs;try{var mask=SYSCALLS.get();var old=SYSCALLS.umask;SYSCALLS.umask=mask;return old}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___unlock(){}function _emscripten_get_heap_size(){return HEAP8.length}function abortOnCannotGrowMemory(requestedSize){abort(\"Cannot enlarge memory arrays to size \"+requestedSize+\" bytes (OOM). Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value \"+HEAP8.length+\", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 \")}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)){return buffer=wasmMemory.buffer}else{return null}}catch(e){console.error(\"emscripten_realloc_buffer: Attempted to grow from \"+oldSize+\" bytes to \"+size+\" bytes, but got error: \"+e);return null}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();assert(requestedSize>oldSize);var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT){err(\"Cannot enlarge memory, asked to go up to \"+requestedSize+\" bytes, but the limit is \"+LIMIT+\" bytes!\");return false}var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}SAFE_HEAP_STORE(tmPtr+24|0,date.getDay()|0,4);var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;SAFE_HEAP_STORE(tmPtr+28|0,yday|0,4);return date.getTime()/1e3|0}function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){SAFE_HEAP_STORE(ptr|0,ret|0,4)}return ret}if(ENVIRONMENT_IS_NODE){_emscripten_get_now=function _emscripten_get_now_actual(){var t=process[\"hrtime\"]();return t[0]*1e3+t[1]/1e6}}else if(typeof dateNow!==\"undefined\"){_emscripten_get_now=dateNow}else if(typeof performance===\"object\"&&performance&&typeof performance[\"now\"]===\"function\"){_emscripten_get_now=function(){return performance[\"now\"]()}}else{_emscripten_get_now=Date.now}FS.staticInit();if(ENVIRONMENT_IS_NODE){var fs=frozenFs;var NODEJS_PATH=__webpack_require__(4);NODEFS.staticInit()}if(ENVIRONMENT_IS_NODE){var _wrapNodeError=function(func){return function(){try{return func.apply(this,arguments)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}};var VFS=Object.assign({},FS);for(var _key in NODERAWFS)FS[_key]=_wrapNodeError(NODERAWFS[_key])}else{throw new Error(\"NODERAWFS is currently only supported on Node.js environment.\")}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 decodeBase64=typeof atob===\"function\"?atob:function(input){var keyStr=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";var output=\"\";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\\+\\/\\=]/g,\"\");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i0){return}writeStackCookie();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\"]();assert(!Module[\"_main\"],'compiled without a main, but one is present. if you added it from JS, use Module[\"onRuntimeInitialized\"]');postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}checkStackCookie()}Module[\"run\"]=run;var abortDecorators=[];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;var extra=\"\";var output=\"abort(\"+what+\") at \"+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach(function(decorator){output=decorator(output,what)})}throw output}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();\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"stream\");\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"util\");\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fs_1 = __webpack_require__(2);\nconst FakeFS_1 = __webpack_require__(6);\nconst NodeFS_1 = __webpack_require__(1);\nconst ZipFS_1 = __webpack_require__(9);\nconst path_1 = __webpack_require__(0);\nconst ZIP_FD = 0x80000000;\nclass ZipOpenFS extends FakeFS_1.BasePortableFakeFS {\n constructor({ baseFs = new NodeFS_1.NodeFS(), filter = null, useCache = true } = {}) {\n super();\n this.fdMap = new Map();\n this.nextFd = 3;\n this.isZip = new Set();\n this.notZip = new Set();\n this.baseFs = baseFs;\n this.zipInstances = useCache ? new Map() : null;\n this.filter = filter;\n this.isZip = new Set();\n this.notZip = new Set();\n }\n static open(fn) {\n const zipOpenFs = new ZipOpenFS();\n try {\n return fn(zipOpenFs);\n }\n finally {\n zipOpenFs.saveAndClose();\n }\n }\n static async openPromise(fn) {\n const zipOpenFs = new ZipOpenFS();\n try {\n return await fn(zipOpenFs);\n }\n finally {\n zipOpenFs.saveAndClose();\n }\n }\n getRealPath() {\n return this.baseFs.getRealPath();\n }\n saveAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.saveAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n discardAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.discardAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n remapFd(zipFs, fd) {\n const remappedFd = this.nextFd++ | ZIP_FD;\n this.fdMap.set(remappedFd, [zipFs, fd]);\n return remappedFd;\n }\n async openPromise(p, flags, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.openPromise(p, flags, mode);\n }, async (zipFs, { subPath }) => {\n return this.remapFd(zipFs, await zipFs.openPromise(subPath, flags, mode));\n });\n }\n openSync(p, flags, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.openSync(p, flags, mode);\n }, (zipFs, { subPath }) => {\n return this.remapFd(zipFs, zipFs.openSync(subPath, flags, mode));\n });\n }\n async readPromise(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0)\n return await this.baseFs.readPromise(fd, buffer, offset, length, position);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`)\n throw Object.assign(new Error(`EBADF: bad file descriptor, read`), { code: `EBADF` });\n const [zipFs, realFd] = entry;\n return await zipFs.readPromise(realFd, buffer, offset, length, position);\n }\n readSync(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0)\n return this.baseFs.readSync(fd, buffer, offset, length, position);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`)\n throw Object.assign(new Error(`EBADF: bad file descriptor, read`), { code: `EBADF` });\n const [zipFs, realFd] = entry;\n return zipFs.readSync(realFd, buffer, offset, length, position);\n }\n async writePromise(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0) {\n if (typeof buffer === `string`) {\n return await this.baseFs.writePromise(fd, buffer, offset);\n }\n else {\n return await this.baseFs.writePromise(fd, buffer, offset, length, position);\n }\n }\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`)\n throw Object.assign(new Error(`EBADF: bad file descriptor, write`), { code: `EBADF` });\n const [zipFs, realFd] = entry;\n if (typeof buffer === `string`) {\n return await zipFs.writePromise(realFd, buffer, offset);\n }\n else {\n return await zipFs.writePromise(realFd, buffer, offset, length, position);\n }\n }\n writeSync(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0) {\n if (typeof buffer === `string`) {\n return this.baseFs.writeSync(fd, buffer, offset);\n }\n else {\n return this.baseFs.writeSync(fd, buffer, offset, length, position);\n }\n }\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`)\n throw Object.assign(new Error(`EBADF: bad file descriptor, write`), { code: `EBADF` });\n const [zipFs, realFd] = entry;\n if (typeof buffer === `string`) {\n return zipFs.writeSync(realFd, buffer, offset);\n }\n else {\n return zipFs.writeSync(realFd, buffer, offset, length, position);\n }\n }\n async closePromise(fd) {\n if ((fd & ZIP_FD) === 0)\n return await this.baseFs.closePromise(fd);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`)\n throw Object.assign(new Error(`EBADF: bad file descriptor, close`), { code: `EBADF` });\n this.fdMap.delete(fd);\n const [zipFs, realFd] = entry;\n return await zipFs.closePromise(realFd);\n }\n closeSync(fd) {\n if ((fd & ZIP_FD) === 0)\n return this.baseFs.closeSync(fd);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`)\n throw Object.assign(new Error(`EBADF: bad file descriptor, close`), { code: `EBADF` });\n this.fdMap.delete(fd);\n const [zipFs, realFd] = entry;\n return zipFs.closeSync(realFd);\n }\n createReadStream(p, opts) {\n if (p === null)\n return this.baseFs.createReadStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createReadStream(p, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.createReadStream(subPath, opts);\n });\n }\n createWriteStream(p, opts) {\n if (p === null)\n return this.baseFs.createWriteStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createWriteStream(p, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.createWriteStream(subPath, opts);\n });\n }\n async realpathPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.realpathPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return this.pathUtils.resolve(await this.baseFs.realpathPromise(archivePath), this.pathUtils.relative(path_1.PortablePath.root, await zipFs.realpathPromise(subPath)));\n });\n }\n realpathSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.realpathSync(p);\n }, (zipFs, { archivePath, subPath }) => {\n return this.pathUtils.resolve(this.baseFs.realpathSync(archivePath), this.pathUtils.relative(path_1.PortablePath.root, zipFs.realpathSync(subPath)));\n });\n }\n async existsPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.existsPromise(p);\n }, async (zipFs, { subPath }) => {\n return await zipFs.existsPromise(subPath);\n });\n }\n existsSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.existsSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.existsSync(subPath);\n });\n }\n async accessPromise(p, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.accessPromise(p, mode);\n }, async (zipFs, { subPath }) => {\n return await zipFs.accessPromise(subPath, mode);\n });\n }\n accessSync(p, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.accessSync(p, mode);\n }, (zipFs, { subPath }) => {\n return zipFs.accessSync(subPath, mode);\n });\n }\n async statPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.statPromise(p);\n }, async (zipFs, { subPath }) => {\n return await zipFs.statPromise(subPath);\n });\n }\n statSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.statSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.statSync(subPath);\n });\n }\n async lstatPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.lstatPromise(p);\n }, async (zipFs, { subPath }) => {\n return await zipFs.lstatPromise(subPath);\n });\n }\n lstatSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.lstatSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.lstatSync(subPath);\n });\n }\n async chmodPromise(p, mask) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.chmodPromise(p, mask);\n }, async (zipFs, { subPath }) => {\n return await zipFs.chmodPromise(subPath, mask);\n });\n }\n chmodSync(p, mask) {\n return this.makeCallSync(p, () => {\n return this.baseFs.chmodSync(p, mask);\n }, (zipFs, { subPath }) => {\n return zipFs.chmodSync(subPath, mask);\n });\n }\n async renamePromise(oldP, newP) {\n return await this.makeCallPromise(oldP, async () => {\n return await this.makeCallPromise(newP, async () => {\n return await this.baseFs.renamePromise(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n });\n }, async (zipFsO, { subPath: subPathO }) => {\n return await this.makeCallPromise(newP, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }, async (zipFsN, { subPath: subPathN }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }\n else {\n return await zipFsO.renamePromise(subPathO, subPathN);\n }\n });\n });\n }\n renameSync(oldP, newP) {\n return this.makeCallSync(oldP, () => {\n return this.makeCallSync(newP, () => {\n return this.baseFs.renameSync(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n });\n }, (zipFsO, { subPath: subPathO }) => {\n return this.makeCallSync(newP, () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }, (zipFsN, { subPath: subPathN }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }\n else {\n return zipFsO.renameSync(subPathO, subPathN);\n }\n });\n });\n }\n async copyFilePromise(sourceP, destP, flags = 0) {\n const fallback = async (sourceFs, sourceP, destFs, destP) => {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), { code: `EXDEV` });\n if ((flags & fs_1.constants.COPYFILE_EXCL) && await this.existsPromise(sourceP))\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n let content;\n try {\n content = await sourceFs.readFilePromise(sourceP);\n }\n catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n }\n await destFs.writeFilePromise(destP, content);\n };\n return await this.makeCallPromise(sourceP, async () => {\n return await this.makeCallPromise(destP, async () => {\n return await this.baseFs.copyFilePromise(sourceP, destP, flags);\n }, async (zipFsD, { subPath: subPathD }) => {\n return await fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, async (zipFsS, { subPath: subPathS }) => {\n return await this.makeCallPromise(destP, async () => {\n return await fallback(zipFsS, subPathS, this.baseFs, destP);\n }, async (zipFsD, { subPath: subPathD }) => {\n if (zipFsS !== zipFsD) {\n return await fallback(zipFsS, subPathS, zipFsD, subPathD);\n }\n else {\n return await zipFsS.copyFilePromise(subPathS, subPathD, flags);\n }\n });\n });\n }\n copyFileSync(sourceP, destP, flags = 0) {\n const fallback = (sourceFs, sourceP, destFs, destP) => {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), { code: `EXDEV` });\n if ((flags & fs_1.constants.COPYFILE_EXCL) && this.existsSync(sourceP))\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n let content;\n try {\n content = sourceFs.readFileSync(sourceP);\n }\n catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n }\n destFs.writeFileSync(destP, content);\n };\n return this.makeCallSync(sourceP, () => {\n return this.makeCallSync(destP, () => {\n return this.baseFs.copyFileSync(sourceP, destP, flags);\n }, (zipFsD, { subPath: subPathD }) => {\n return fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, (zipFsS, { subPath: subPathS }) => {\n return this.makeCallSync(destP, () => {\n return fallback(zipFsS, subPathS, this.baseFs, destP);\n }, (zipFsD, { subPath: subPathD }) => {\n if (zipFsS !== zipFsD) {\n return fallback(zipFsS, subPathS, zipFsD, subPathD);\n }\n else {\n return zipFsS.copyFileSync(subPathS, subPathD, flags);\n }\n });\n });\n }\n async appendFilePromise(p, content, opts) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.appendFilePromise(p, content, opts);\n }, async (zipFs, { subPath }) => {\n return await zipFs.appendFilePromise(subPath, content, opts);\n });\n }\n appendFileSync(p, content, opts) {\n return this.makeCallSync(p, () => {\n return this.baseFs.appendFileSync(p, content, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.appendFileSync(subPath, content, opts);\n });\n }\n async writeFilePromise(p, content, opts) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.writeFilePromise(p, content, opts);\n }, async (zipFs, { subPath }) => {\n return await zipFs.writeFilePromise(subPath, content, opts);\n });\n }\n writeFileSync(p, content, opts) {\n return this.makeCallSync(p, () => {\n return this.baseFs.writeFileSync(p, content, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.writeFileSync(subPath, content, opts);\n });\n }\n async unlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.unlinkPromise(p);\n }, async (zipFs, { subPath }) => {\n return await zipFs.unlinkPromise(subPath);\n });\n }\n unlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.unlinkSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.unlinkSync(subPath);\n });\n }\n async utimesPromise(p, atime, mtime) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.utimesPromise(p, atime, mtime);\n }, async (zipFs, { subPath }) => {\n return await zipFs.utimesPromise(subPath, atime, mtime);\n });\n }\n utimesSync(p, atime, mtime) {\n return this.makeCallSync(p, () => {\n return this.baseFs.utimesSync(p, atime, mtime);\n }, (zipFs, { subPath }) => {\n return zipFs.utimesSync(subPath, atime, mtime);\n });\n }\n async mkdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.mkdirPromise(p);\n }, async (zipFs, { subPath }) => {\n return await zipFs.mkdirPromise(subPath);\n });\n }\n mkdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.mkdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.mkdirSync(subPath);\n });\n }\n async rmdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.rmdirPromise(p);\n }, async (zipFs, { subPath }) => {\n return await zipFs.rmdirPromise(subPath);\n });\n }\n rmdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.rmdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.rmdirSync(subPath);\n });\n }\n async symlinkPromise(target, p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.symlinkPromise(target, p);\n }, async (zipFs, { subPath }) => {\n return await zipFs.symlinkPromise(target, subPath);\n });\n }\n symlinkSync(target, p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.symlinkSync(target, p);\n }, (zipFs, { subPath }) => {\n return zipFs.symlinkSync(target, subPath);\n });\n }\n async readFilePromise(p, encoding) {\n return this.makeCallPromise(p, async () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return await this.baseFs.readFilePromise(p, encoding);\n default:\n return await this.baseFs.readFilePromise(p, encoding);\n }\n }, async (zipFs, { subPath }) => {\n return await zipFs.readFilePromise(subPath, encoding);\n });\n }\n readFileSync(p, encoding) {\n return this.makeCallSync(p, () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.baseFs.readFileSync(p, encoding);\n default:\n return this.baseFs.readFileSync(p, encoding);\n }\n }, (zipFs, { subPath }) => {\n return zipFs.readFileSync(subPath, encoding);\n });\n }\n async readdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readdirPromise(p);\n }, async (zipFs, { subPath }) => {\n return await zipFs.readdirPromise(subPath);\n }, {\n requireSubpath: false,\n });\n }\n readdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.readdirSync(subPath);\n }, {\n requireSubpath: false,\n });\n }\n async readlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readlinkPromise(p);\n }, async (zipFs, { subPath }) => {\n return await zipFs.readlinkPromise(subPath);\n });\n }\n readlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readlinkSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.readlinkSync(subPath);\n });\n }\n watch(p, a, b) {\n return this.makeCallSync(p, () => {\n return this.baseFs.watch(p, \n // @ts-ignore\n a, b);\n }, (zipFs, { subPath }) => {\n return zipFs.watch(subPath, \n // @ts-ignore\n a, b);\n });\n }\n async makeCallPromise(p, discard, accept, { requireSubpath = true } = {}) {\n if (typeof p !== `string`)\n return await discard();\n const normalizedP = this.pathUtils.normalize(this.pathUtils.resolve(path_1.PortablePath.root, p));\n const zipInfo = this.findZip(normalizedP);\n if (!zipInfo)\n return await discard();\n if (requireSubpath && zipInfo.subPath === `/`)\n return await discard();\n return await this.getZipPromise(zipInfo.archivePath, async (zipFs) => await accept(zipFs, zipInfo));\n }\n makeCallSync(p, discard, accept, { requireSubpath = true } = {}) {\n if (typeof p !== `string`)\n return discard();\n const normalizedP = this.pathUtils.normalize(this.pathUtils.resolve(path_1.PortablePath.root, p));\n const zipInfo = this.findZip(normalizedP);\n if (!zipInfo)\n return discard();\n if (requireSubpath && zipInfo.subPath === `/`)\n return discard();\n return this.getZipSync(zipInfo.archivePath, zipFs => accept(zipFs, zipInfo));\n }\n findZip(p) {\n if (this.filter && !this.filter.test(p))\n return null;\n const parts = p.split(/\\//g);\n for (let t = 2; t <= parts.length; ++t) {\n const archivePath = parts.slice(0, t).join(`/`);\n if (this.notZip.has(archivePath))\n continue;\n if (this.isZip.has(archivePath))\n return { archivePath, subPath: this.pathUtils.resolve(path_1.PortablePath.root, parts.slice(t).join(`/`)) };\n let realArchivePath = archivePath;\n let stat;\n while (true) {\n try {\n stat = this.baseFs.lstatSync(realArchivePath);\n }\n catch (error) {\n return null;\n }\n if (stat.isSymbolicLink()) {\n realArchivePath = this.pathUtils.resolve(this.pathUtils.dirname(realArchivePath), this.baseFs.readlinkSync(realArchivePath));\n }\n else {\n break;\n }\n }\n const isZip = stat.isFile() && this.pathUtils.extname(realArchivePath) === `.zip`;\n if (isZip) {\n this.isZip.add(archivePath);\n return { archivePath, subPath: this.pathUtils.resolve(path_1.PortablePath.root, parts.slice(t).join(`/`)) };\n }\n else {\n this.notZip.add(archivePath);\n if (stat.isFile()) {\n return null;\n }\n }\n }\n return null;\n }\n async getZipPromise(p, accept) {\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs)\n this.zipInstances.set(p, zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs, stats: await this.baseFs.statPromise(p) }));\n return await accept(zipFs);\n }\n else {\n const zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs, stats: await this.baseFs.statPromise(p) });\n try {\n return await accept(zipFs);\n }\n finally {\n zipFs.saveAndClose();\n }\n }\n }\n getZipSync(p, accept) {\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs)\n this.zipInstances.set(p, zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs }));\n return accept(zipFs);\n }\n else {\n const zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs });\n try {\n return accept(zipFs);\n }\n finally {\n zipFs.saveAndClose();\n }\n }\n }\n}\nexports.ZipOpenFS = ZipOpenFS;\n\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"string_decoder\");\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nconst fs_1 = __importDefault(__webpack_require__(2));\nconst module_1 = __importDefault(__webpack_require__(7));\nconst path_1 = __importDefault(__webpack_require__(4));\nconst internalTools_1 = __webpack_require__(10);\nfunction applyPatch(pnpapi, opts) {\n // @ts-ignore\n const builtinModules = new Set(module_1.default.builtinModules || Object.keys(process.binding('natives')));\n // The callback function gets called to wrap the return value of the module names matching the regexp\n const patchedModules = [];\n if (opts.compatibilityMode) {\n // Modern versions of `resolve` support a specific entry point that custom resolvers can use\n // to inject a specific resolution logic without having to patch the whole package.\n //\n // Cf: https://github.com/browserify/resolve/pull/174\n patchedModules.push([\n /^\\.\\/normalize-options\\.js$/,\n (issuer, normalizeOptions) => {\n if (!issuer || issuer.name !== 'resolve')\n return normalizeOptions;\n return (request, opts) => {\n opts = opts || {};\n if (opts.forceNodeResolution)\n return opts;\n opts.preserveSymlinks = true;\n opts.paths = function (request, basedir, getNodeModulesDir, opts) {\n // Extract the name of the package being requested (1=full name, 2=scope name, 3=local name)\n const parts = request.match(/^((?:(@[^\\/]+)\\/)?([^\\/]+))/);\n if (!parts)\n throw new Error(`Assertion failed: Expected the \"resolve\" package to call the \"paths\" callback with package names only (got \"${request}\")`);\n // make sure that basedir ends with a slash\n if (basedir.charAt(basedir.length - 1) !== '/')\n basedir = path_1.default.join(basedir, '/');\n // TODO Handle portable paths\n // This is guaranteed to return the path to the \"package.json\" file from the given package\n const manifestPath = pnpapi.resolveToUnqualified(`${parts[1]}/package.json`, basedir, {\n considerBuiltins: false,\n });\n if (manifestPath === null)\n throw new Error(`Assertion failed: The resolution thinks that \"${parts[1]}\" is a Node builtin`);\n // The first dirname strips the package.json, the second strips the local named folder\n let nodeModules = path_1.default.dirname(path_1.default.dirname(manifestPath));\n // Strips the scope named folder if needed\n if (parts[2])\n nodeModules = path_1.default.dirname(nodeModules);\n return [nodeModules];\n };\n return opts;\n };\n },\n ]);\n }\n /**\n * Used to disable the resolution hooks (for when we want to fallback to the previous resolution - we then need\n * a way to \"reset\" the environment temporarily)\n */\n let enableNativeHooks = true;\n // @ts-ignore\n process.versions.pnp = String(pnpapi.VERSIONS.std);\n // A small note: we don't replace the cache here (and instead use the native one). This is an effort to not\n // break code similar to \"delete require.cache[require.resolve(FOO)]\", where FOO is a package located outside\n // of the Yarn dependency tree. In this case, we defer the load to the native loader. If we were to replace the\n // cache by our own, the native loader would populate its own cache, which wouldn't be exposed anymore, so the\n // delete call would be broken.\n const originalModuleLoad = module_1.default._load;\n module_1.default._load = function (request, parent, isMain) {\n if (!enableNativeHooks)\n return originalModuleLoad.call(module_1.default, request, parent, isMain);\n // Builtins are managed by the regular Node loader\n if (builtinModules.has(request)) {\n try {\n enableNativeHooks = false;\n return originalModuleLoad.call(module_1.default, request, parent, isMain);\n }\n finally {\n enableNativeHooks = true;\n }\n }\n // The 'pnpapi' name is reserved to return the PnP api currently in use by the program\n if (request === `pnpapi`)\n return pnpapi;\n // Request `Module._resolveFilename` (ie. `resolveRequest`) to tell us which file we should load\n const modulePath = module_1.default._resolveFilename(request, parent, isMain);\n // Check if the module has already been created for the given file\n const cacheEntry = module_1.default._cache[modulePath];\n if (cacheEntry)\n return cacheEntry.exports;\n // Create a new module and store it into the cache\n // @ts-ignore\n const module = new module_1.default(modulePath, parent);\n module_1.default._cache[modulePath] = module;\n // The main module is exposed as global variable\n if (isMain) {\n // @ts-ignore\n process.mainModule = module;\n module.id = '.';\n }\n // Try to load the module, and remove it from the cache if it fails\n let hasThrown = true;\n try {\n module.load(modulePath);\n hasThrown = false;\n }\n finally {\n if (hasThrown) {\n delete module_1.default._cache[modulePath];\n }\n }\n // Some modules might have to be patched for compatibility purposes\n for (const [filter, patchFn] of patchedModules) {\n if (filter.test(request)) {\n const issuer = parent && parent.filename ? pnpapi.findPackageLocator(parent.filename) : null;\n module.exports = patchFn(issuer, module.exports);\n }\n }\n return module.exports;\n };\n const originalModuleResolveFilename = module_1.default._resolveFilename;\n module_1.default._resolveFilename = function (request, parent, isMain, options) {\n if (request === `pnpapi`)\n return request;\n if (!enableNativeHooks)\n return originalModuleResolveFilename.call(module_1.default, request, parent, isMain, options);\n if (options && options.plugnplay === false) {\n try {\n enableNativeHooks = false;\n return originalModuleResolveFilename.call(module_1.default, request, parent, isMain, options);\n }\n finally {\n enableNativeHooks = true;\n }\n }\n let issuers;\n if (options) {\n const optionNames = new Set(Object.keys(options));\n optionNames.delete(`paths`);\n optionNames.delete(`plugnplay`);\n if (optionNames.size > 0) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNSUPPORTED, `Some options passed to require() aren't supported by PnP yet (${Array.from(optionNames).join(', ')})`);\n }\n if (options.paths) {\n issuers = options.paths.map((entry) => {\n return `${path_1.default.normalize(entry)}/`;\n });\n }\n }\n if (!issuers) {\n const issuerModule = internalTools_1.getIssuerModule(parent);\n const issuer = issuerModule ? issuerModule.filename : `${fslib_1.NodeFS.toPortablePath(process.cwd())}/`;\n issuers = [issuer];\n }\n // When Node is called, it tries to require the main script but can't\n // because PnP already patched 'Module'\n // We test it for an absolute Windows path and convert it to a portable path.\n // We should probably always call toPortablePath and check for this directly\n if (/^[A-Z]:.*/.test(request))\n request = fslib_1.NodeFS.toPortablePath(request);\n let firstError;\n for (const issuer of issuers) {\n let resolution;\n try {\n resolution = pnpapi.resolveRequest(request, issuer);\n }\n catch (error) {\n firstError = firstError || error;\n continue;\n }\n return resolution !== null ? resolution : request;\n }\n throw firstError;\n };\n const originalFindPath = module_1.default._findPath;\n module_1.default._findPath = function (request, paths, isMain) {\n if (request === `pnpapi`)\n return false;\n if (!enableNativeHooks)\n return originalFindPath.call(module_1.default, request, paths, isMain);\n for (const path of paths) {\n let resolution;\n try {\n // TODO Convert path to portable path?\n resolution = pnpapi.resolveRequest(request, path);\n }\n catch (error) {\n continue;\n }\n if (resolution) {\n return resolution;\n }\n }\n return false;\n };\n fslib_1.patchFs(fs_1.default, new fslib_1.PosixFS(opts.fakeFs));\n}\nexports.applyPatch = applyPatch;\n;\n\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nfunction hydrateRuntimeState(data, { basePath }) {\n const portablePath = fslib_1.NodeFS.toPortablePath(basePath);\n const ignorePattern = data.ignorePatternData !== null\n ? new RegExp(data.ignorePatternData)\n : null;\n const packageRegistry = new Map(data.packageRegistryData.map(([packageName, packageStoreData]) => {\n return [packageName, new Map(packageStoreData.map(([packageReference, packageInformationData]) => {\n return [packageReference, {\n packageLocation: fslib_1.ppath.resolve(portablePath, packageInformationData.packageLocation),\n packageDependencies: new Map(packageInformationData.packageDependencies),\n }];\n }))];\n }));\n const packageLocatorsByLocations = new Map();\n for (const [packageName, storeData] of data.packageRegistryData) {\n for (const [packageReference, packageInformationData] of storeData) {\n if ((packageName === null) !== (packageReference === null))\n throw new Error(`Assertion failed: The name and reference should be null, or neither should`);\n // @ts-ignore: TypeScript isn't smart enough to understand the type assertion\n const packageLocator = { name: packageName, reference: packageReference };\n packageLocatorsByLocations.set(packageInformationData.packageLocation, packageLocator);\n }\n }\n for (const location of data.locationBlacklistData)\n packageLocatorsByLocations.set(location, null);\n const fallbackExclusionList = new Map(data.fallbackExclusionList.map(([packageName, packageReferences]) => {\n return [packageName, new Set(packageReferences)];\n }));\n const virtualRoots = data.virtualRoots.map(virtualRoot => {\n return fslib_1.ppath.resolve(portablePath, virtualRoot);\n });\n const enableTopLevelFallback = data.enableTopLevelFallback;\n const packageLocationLengths = data.locationLengthData;\n return {\n basePath: portablePath,\n enableTopLevelFallback,\n fallbackExclusionList,\n ignorePattern,\n packageLocationLengths,\n packageLocatorsByLocations,\n packageRegistry,\n virtualRoots,\n };\n}\nexports.hydrateRuntimeState = hydrateRuntimeState;\n\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/// \nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nconst fslib_2 = __webpack_require__(5);\nconst module_1 = __importDefault(__webpack_require__(7));\nconst internalTools_1 = __webpack_require__(10);\nfunction makeApi(runtimeState, opts) {\n // @ts-ignore\n const builtinModules = new Set(module_1.default.builtinModules || Object.keys(process.binding('natives')));\n // Splits a require request into its components, or return null if the request is a file path\n const pathRegExp = /^(?![a-zA-Z]:[\\\\\\/]|\\\\\\\\|\\.{0,2}(?:\\/|$))((?:@[^\\/]+\\/)?[^\\/]+)\\/?(.*|)$/;\n // Matches if the path starts with a valid path qualifier (./, ../, /)\n // eslint-disable-next-line no-unused-vars\n const isStrictRegExp = /^\\.{0,2}\\//;\n // Matches if the path must point to a directory (ie ends with /)\n const isDirRegExp = /\\/$/;\n // We only instantiate one of those so that we can use strict-equal comparisons\n const topLevelLocator = { name: null, reference: null };\n // Used for compatibility purposes - cf setupCompatibilityLayer\n const fallbackLocators = [];\n if (runtimeState.enableTopLevelFallback === true)\n fallbackLocators.push(topLevelLocator);\n if (opts.compatibilityMode) {\n // ESLint currently doesn't have any portable way for shared configs to\n // specify their own plugins that should be used (cf issue #10125). This\n // will likely get fixed at some point but it'll take time, so in the\n // meantime we'll just add additional fallback entries for common shared\n // configs.\n // Similarly, Gatsby generates files within the `public` folder located\n // within the project, but doesn't pre-resolve the `require` calls to use\n // its own dependencies. Meaning that when PnP see a file from the `public`\n // folder making a require, it thinks that your project forgot to list one\n // of your dependencies.\n for (const name of [`react-scripts`, `gatsby`]) {\n const packageStore = runtimeState.packageRegistry.get(name);\n if (packageStore) {\n for (const reference of packageStore.keys()) {\n if (reference === null) {\n throw new Error(`Assertion failed: This reference shouldn't be null`);\n }\n else {\n fallbackLocators.push({ name, reference });\n }\n }\n }\n }\n }\n /**\n * The setup code will be injected here. The tables listed below are guaranteed to be filled after the call to\n * the $$DYNAMICALLY_GENERATED_CODE function.\n */\n const { ignorePattern, packageRegistry, packageLocatorsByLocations, packageLocationLengths, } = runtimeState;\n /**\n * Allows to print useful logs just be setting a value in the environment\n */\n function makeLogEntry(name, args) {\n return {\n fn: name,\n args: args,\n error: null,\n result: null,\n };\n }\n function maybeLog(name, fn) {\n if (opts.allowDebug === false)\n return fn;\n const level = Number(process.env.PNP_DEBUG_LEVEL);\n if (Number.isFinite(level)) {\n if (level >= 2) {\n return (...args) => {\n const logEntry = makeLogEntry(name, args);\n try {\n return logEntry.result = fn(...args);\n }\n catch (error) {\n throw logEntry.error = error;\n }\n finally {\n console.error(logEntry);\n }\n };\n }\n else if (level >= 1) {\n return (...args) => {\n try {\n return fn(...args);\n }\n catch (error) {\n const logEntry = makeLogEntry(name, args);\n logEntry.error = error;\n console.error(logEntry);\n throw error;\n }\n };\n }\n }\n return fn;\n }\n /**\n * Returns information about a package in a safe way (will throw if they cannot be retrieved)\n */\n function getPackageInformationSafe(packageLocator) {\n const packageInformation = getPackageInformation(packageLocator);\n if (!packageInformation) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.INTERNAL, `Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)`);\n }\n return packageInformation;\n }\n /**\n * Implements the node resolution for folder access and extension selection\n */\n function applyNodeExtensionResolution(unqualifiedPath, candidates, { extensions }) {\n // We use this \"infinite while\" so that we can restart the process as long as we hit package folders\n while (true) {\n let stat;\n try {\n candidates.push(unqualifiedPath);\n stat = opts.fakeFs.statSync(unqualifiedPath);\n }\n catch (error) { }\n // If the file exists and is a file, we can stop right there\n if (stat && !stat.isDirectory()) {\n // If the very last component of the resolved path is a symlink to a file, we then resolve it to a file. We only\n // do this first the last component, and not the rest of the path! This allows us to support the case of bin\n // symlinks, where a symlink in \"/xyz/pkg-name/.bin/bin-name\" will point somewhere else (like \"/xyz/pkg-name/index.js\").\n // In such a case, we want relative requires to be resolved relative to \"/xyz/pkg-name/\" rather than \"/xyz/pkg-name/.bin/\".\n //\n // Also note that the reason we must use readlink on the last component (instead of realpath on the whole path)\n // is that we must preserve the other symlinks, in particular those used by pnp to deambiguate packages using\n // peer dependencies. For example, \"/xyz/.pnp/local/pnp-01234569/.bin/bin-name\" should see its relative requires\n // be resolved relative to \"/xyz/.pnp/local/pnp-0123456789/\" rather than \"/xyz/pkg-with-peers/\", because otherwise\n // we would lose the information that would tell us what are the dependencies of pkg-with-peers relative to its\n // ancestors.\n if (opts.fakeFs.lstatSync(unqualifiedPath).isSymbolicLink())\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(fslib_2.ppath.dirname(unqualifiedPath), opts.fakeFs.readlinkSync(unqualifiedPath)));\n return unqualifiedPath;\n }\n // If the file is a directory, we must check if it contains a package.json with a \"main\" entry\n if (stat && stat.isDirectory()) {\n let pkgJson;\n try {\n pkgJson = JSON.parse(opts.fakeFs.readFileSync(fslib_2.ppath.join(unqualifiedPath, fslib_2.toFilename(`package.json`)), `utf8`));\n }\n catch (error) { }\n let nextUnqualifiedPath;\n if (pkgJson && pkgJson.main)\n nextUnqualifiedPath = fslib_2.ppath.resolve(unqualifiedPath, pkgJson.main);\n // If the \"main\" field changed the path, we start again from this new location\n if (nextUnqualifiedPath && nextUnqualifiedPath !== unqualifiedPath) {\n const resolution = applyNodeExtensionResolution(nextUnqualifiedPath, candidates, { extensions });\n if (resolution !== null) {\n return resolution;\n }\n }\n }\n // Otherwise we check if we find a file that match one of the supported extensions\n const qualifiedPath = extensions\n .map(extension => {\n return `${unqualifiedPath}${extension}`;\n })\n .find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n if (qualifiedPath)\n return qualifiedPath;\n // Otherwise, we check if the path is a folder - in such a case, we try to use its index\n if (stat && stat.isDirectory()) {\n const indexPath = extensions\n .map(extension => {\n return fslib_2.ppath.format({ dir: unqualifiedPath, name: fslib_2.toFilename(`index`), ext: extension });\n })\n .find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n if (indexPath) {\n return indexPath;\n }\n }\n // Otherwise there's nothing else we can do :(\n return null;\n }\n }\n /**\n * This function creates fake modules that can be used with the _resolveFilename function.\n * Ideally it would be nice to be able to avoid this, since it causes useless allocations\n * and cannot be cached efficiently (we recompute the nodeModulePaths every time).\n *\n * Fortunately, this should only affect the fallback, and there hopefully shouldn't have a\n * lot of them.\n */\n function makeFakeModule(path) {\n // @ts-ignore\n const fakeModule = new module_1.default(path, null);\n fakeModule.filename = path;\n fakeModule.paths = module_1.default._nodeModulePaths(path);\n return fakeModule;\n }\n /**\n * Normalize path to posix format.\n */\n function normalizePath(p) {\n return fslib_1.NodeFS.toPortablePath(p);\n }\n /**\n * Forward the resolution to the next resolver (usually the native one)\n */\n function callNativeResolution(request, issuer) {\n if (issuer.endsWith(`/`))\n issuer = fslib_2.ppath.join(issuer, fslib_2.toFilename(`internal.js`));\n // Since we would need to create a fake module anyway (to call _resolveLookupPath that\n // would give us the paths to give to _resolveFilename), we can as well not use\n // the {paths} option at all, since it internally makes _resolveFilename create another\n // fake module anyway.\n return module_1.default._resolveFilename(request, makeFakeModule(fslib_1.NodeFS.fromPortablePath(issuer)), false, { plugnplay: false });\n }\n /**\n * This key indicates which version of the standard is implemented by this resolver. The `std` key is the\n * Plug'n'Play standard, and any other key are third-party extensions. Third-party extensions are not allowed\n * to override the standard, and can only offer new methods.\n *\n * If an new version of the Plug'n'Play standard is released and some extensions conflict with newly added\n * functions, they'll just have to fix the conflicts and bump their own version number.\n */\n const VERSIONS = { std: 2 };\n /**\n * We export a special symbol for easy access to the top level locator.\n */\n const topLevel = topLevelLocator;\n /**\n * Gets the package information for a given locator. Returns null if they cannot be retrieved.\n */\n function getPackageInformation({ name, reference }) {\n const packageInformationStore = packageRegistry.get(name);\n if (!packageInformationStore)\n return null;\n const packageInformation = packageInformationStore.get(reference);\n if (!packageInformation)\n return null;\n return packageInformation;\n }\n /**\n * Finds the package locator that owns the specified path. If none is found, returns null instead.\n */\n function findPackageLocator(location) {\n let relativeLocation = normalizePath(fslib_2.ppath.relative(runtimeState.basePath, location));\n if (!relativeLocation.match(isStrictRegExp))\n relativeLocation = `./${relativeLocation}`;\n if (location.match(isDirRegExp) && !relativeLocation.endsWith(`/`))\n relativeLocation = `${relativeLocation}/`;\n let from = 0;\n // If someone wants to use a binary search to go from O(n) to O(log n), be my guest\n while (from < packageLocationLengths.length && packageLocationLengths[from] > relativeLocation.length)\n from += 1;\n for (let t = from; t < packageLocationLengths.length; ++t) {\n const locator = packageLocatorsByLocations.get(relativeLocation.substr(0, packageLocationLengths[t]));\n if (typeof locator === `undefined`)\n continue;\n // Ensures that the returned locator isn't a blacklisted one.\n //\n // Blacklisted packages are packages that cannot be used because their dependencies cannot be deduced. This only\n // happens with peer dependencies, which effectively have different sets of dependencies depending on their\n // parents.\n //\n // In order to deambiguate those different sets of dependencies, the Yarn implementation of PnP will generate a\n // symlink for each combination of // it will find, and will\n // blacklist the target of those symlinks. By doing this, we ensure that files loaded through a specific path\n // will always have the same set of dependencies, provided the symlinks are correctly preserved.\n //\n // Unfortunately, some tools do not preserve them, and when it happens PnP isn't able anymore to deduce the set of\n // dependencies based on the path of the file that makes the require calls. But since we've blacklisted those\n // paths, we're able to print a more helpful error message that points out that a third-party package is doing\n // something incompatible!\n if (locator === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BLACKLISTED, `A forbidden path has been used in the package resolution process - this is usually caused by one of your tools calling 'fs.realpath' on the return value of 'require.resolve'. Since we need to use symlinks to simultaneously provide valid filesystem paths and disambiguate peer dependencies, they must be passed untransformed to 'require'.\\n\\nForbidden path: ${location}`, { location });\n }\n return locator;\n }\n return null;\n }\n /**\n * Transforms a request (what's typically passed as argument to the require function) into an unqualified path.\n * This path is called \"unqualified\" because it only changes the package name to the package location on the disk,\n * which means that the end result still cannot be directly accessed (for example, it doesn't try to resolve the\n * file extension, or to resolve directories to their \"index.js\" content). Use the \"resolveUnqualified\" function\n * to convert them to fully-qualified paths, or just use \"resolveRequest\" that do both operations in one go.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n function resolveToUnqualified(request, issuer, { considerBuiltins = true } = {}) {\n // The 'pnpapi' request is reserved and will always return the path to the PnP file, from everywhere\n if (request === `pnpapi`)\n return fslib_1.NodeFS.toPortablePath(opts.pnpapiResolution);\n // Bailout if the request is a native module\n if (considerBuiltins && builtinModules.has(request))\n return null;\n // We allow disabling the pnp resolution for some subpaths. This is because some projects, often legacy,\n // contain multiple levels of dependencies (ie. a yarn.lock inside a subfolder of a yarn.lock). This is\n // typically solved using workspaces, but not all of them have been converted already.\n if (ignorePattern && issuer && ignorePattern.test(normalizePath(issuer))) {\n const result = callNativeResolution(request, issuer);\n if (result === false) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer was explicitely ignored by the regexp)\\n\\nRequire request: \"${request}\"\\nRequired by: ${issuer}\\n`, { request, issuer });\n }\n return fslib_1.NodeFS.toPortablePath(result);\n }\n let unqualifiedPath;\n // If the request is a relative or absolute path, we just return it normalized\n const dependencyNameMatch = request.match(pathRegExp);\n if (!dependencyNameMatch) {\n if (fslib_2.ppath.isAbsolute(request)) {\n unqualifiedPath = fslib_2.ppath.normalize(request);\n }\n else {\n if (!issuer) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, { request, issuer });\n }\n if (issuer.match(isDirRegExp)) {\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(issuer, request));\n }\n else {\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(fslib_2.ppath.dirname(issuer), request));\n }\n }\n // No need to use the return value; we just want to check the blacklist status\n findPackageLocator(unqualifiedPath);\n }\n // Things are more hairy if it's a package require - we then need to figure out which package is needed, and in\n // particular the exact version for the given location on the dependency tree\n else {\n if (!issuer) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, { request, issuer });\n }\n const [, dependencyName, subPath] = dependencyNameMatch;\n const issuerLocator = findPackageLocator(issuer);\n // If the issuer file doesn't seem to be owned by a package managed through pnp, then we resort to using the next\n // resolution algorithm in the chain, usually the native Node resolution one\n if (!issuerLocator) {\n const result = callNativeResolution(request, issuer);\n if (result === false) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree)\\n\\nRequire path: \"${request}\"\\nRequired by: ${issuer}\\n`, { request, issuer });\n }\n return fslib_1.NodeFS.toPortablePath(result);\n }\n const issuerInformation = getPackageInformationSafe(issuerLocator);\n // We obtain the dependency reference in regard to the package that request it\n let dependencyReference = issuerInformation.packageDependencies.get(dependencyName);\n // If we can't find it, we check if we can potentially load it from the packages that have been defined as potential fallbacks.\n // It's a bit of a hack, but it improves compatibility with the existing Node ecosystem. Hopefully we should eventually be able\n // to kill this logic and become stricter once pnp gets enough traction and the affected packages fix themselves.\n if (issuerLocator.name !== null) {\n // To allow programs to become gradually stricter, starting from the v2 we enforce that workspaces cannot depend on fallbacks.\n // This works by having a list containing all their locators, and checking when a fallback is required whether it's one of them.\n const exclusionEntry = runtimeState.fallbackExclusionList.get(issuerLocator.name);\n const canUseFallbacks = !exclusionEntry || !exclusionEntry.has(issuerLocator.reference);\n if (canUseFallbacks) {\n for (let t = 0, T = fallbackLocators.length; dependencyReference === undefined && t < T; ++t) {\n const fallbackInformation = getPackageInformationSafe(fallbackLocators[t]);\n const fallbackReference = fallbackInformation.packageDependencies.get(dependencyName);\n if (fallbackReference !== null) {\n dependencyReference = fallbackReference;\n }\n }\n }\n }\n // If we can't find the path, and if the package making the request is the top-level, we can offer nicer error messages\n if (dependencyReference === null) {\n if (issuerLocator.name === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_PEER_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a peer dependency; this isn't allowed as the peer dependency cannot be provided by any parent package\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, { request, issuer, dependencyName });\n }\n else {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_PEER_DEPENDENCY, `A package is trying to access a peer dependency that should be provided by its direct ancestor but isn't\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, issuerLocator: Object.assign({}, issuerLocator), dependencyName });\n }\n }\n else if (dependencyReference === undefined) {\n if (issuerLocator.name === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNDECLARED_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a package that is not declared in your dependencies\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, { request, issuer, dependencyName });\n }\n else {\n const candidates = Array.from(issuerInformation.packageDependencies.keys());\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNDECLARED_DEPENDENCY, `A package is trying to access another package without the second one being listed as a dependency of the first one\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, issuerLocator: Object.assign({}, issuerLocator), dependencyName, candidates });\n }\n }\n // We need to check that the package exists on the filesystem, because it might not have been installed\n const dependencyLocator = Array.isArray(dependencyReference)\n ? { name: dependencyReference[0], reference: dependencyReference[1] }\n : { name: dependencyName, reference: dependencyReference };\n const dependencyInformation = getPackageInformationSafe(dependencyLocator);\n if (!dependencyInformation.packageLocation) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_DEPENDENCY, `A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod.\\n\\nRequired package: ${dependencyLocator.name}@${dependencyLocator.reference} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, dependencyLocator: Object.assign({}, dependencyLocator) });\n }\n // Now that we know which package we should resolve to, we only have to find out the file location\n const dependencyLocation = fslib_2.ppath.resolve(runtimeState.basePath, dependencyInformation.packageLocation);\n if (subPath) {\n unqualifiedPath = fslib_2.ppath.resolve(dependencyLocation, subPath);\n }\n else {\n unqualifiedPath = dependencyLocation;\n }\n }\n return fslib_2.ppath.normalize(unqualifiedPath);\n }\n ;\n /**\n * Transforms an unqualified path into a qualified path by using the Node resolution algorithm (which automatically\n * appends \".js\" / \".json\", and transforms directory accesses into \"index.js\").\n */\n function resolveUnqualified(unqualifiedPath, { extensions = Object.keys(module_1.default._extensions) } = {}) {\n const candidates = [];\n const qualifiedPath = applyNodeExtensionResolution(unqualifiedPath, candidates, { extensions });\n if (qualifiedPath) {\n return fslib_2.ppath.normalize(qualifiedPath);\n }\n else {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED, `Couldn't find a suitable Node resolution for the specified unqualified path\\n\\nSource path: ${unqualifiedPath}\\n${candidates.map(candidate => `Rejected resolution: ${candidate}\\n`).join(``)}`, { unqualifiedPath });\n }\n }\n ;\n /**\n * Transforms a request into a fully qualified path.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n function resolveRequest(request, issuer, { considerBuiltins, extensions } = {}) {\n let unqualifiedPath = resolveToUnqualified(request, issuer, { considerBuiltins });\n if (unqualifiedPath === null)\n return null;\n try {\n return resolveUnqualified(unqualifiedPath, { extensions });\n }\n catch (resolutionError) {\n if (resolutionError.pnpCode === 'QUALIFIED_PATH_RESOLUTION_FAILED')\n Object.assign(resolutionError.data, { request, issuer });\n throw resolutionError;\n }\n }\n ;\n return {\n VERSIONS,\n topLevel,\n getPackageInformation: (locator) => {\n const info = getPackageInformation(locator);\n if (info === null)\n return null;\n const packageLocation = fslib_1.NodeFS.fromPortablePath(info.packageLocation);\n const nativeInfo = Object.assign({}, info, { packageLocation });\n return nativeInfo;\n },\n findPackageLocator: (path) => {\n return findPackageLocator(fslib_1.NodeFS.toPortablePath(path));\n },\n resolveToUnqualified: maybeLog(`resolveToUnqualified`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? fslib_1.NodeFS.toPortablePath(issuer) : null;\n const resolution = resolveToUnqualified(fslib_1.NodeFS.toPortablePath(request), portableIssuer, opts);\n if (resolution === null)\n return null;\n return fslib_1.NodeFS.fromPortablePath(resolution);\n }),\n resolveUnqualified: maybeLog(`resolveUnqualified`, (unqualifiedPath, opts) => {\n return fslib_1.NodeFS.fromPortablePath(resolveUnqualified(fslib_1.NodeFS.toPortablePath(unqualifiedPath), opts));\n }),\n resolveRequest: maybeLog(`resolveRequest`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? fslib_1.NodeFS.toPortablePath(issuer) : null;\n const resolution = resolveRequest(fslib_1.NodeFS.toPortablePath(request), portableIssuer, opts);\n if (resolution === null)\n return null;\n return fslib_1.NodeFS.fromPortablePath(resolution);\n }),\n };\n}\nexports.makeApi = makeApi;\n\n\n/***/ })\n/******/ ]);"; diff --git a/packages/berry-pnpify/sources/NodeModulesFS.ts b/packages/berry-pnpify/sources/NodeModulesFS.ts index d52ef38ca87f..d344f78b4dc1 100644 --- a/packages/berry-pnpify/sources/NodeModulesFS.ts +++ b/packages/berry-pnpify/sources/NodeModulesFS.ts @@ -143,6 +143,34 @@ class PortableNodeModulesFs extends FakeFS { return this.baseFs.openSync(this.resolveFilePath(p), flags, mode); } + async readPromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number) { + return await this.baseFs.readPromise(fd, buffer, offset, length, position); + } + + readSync(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number) { + return this.baseFs.readSync(fd, buffer, offset, length, position); + } + + writePromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): Promise; + writePromise(fd: number, buffer: string, position?: number): Promise; + async writePromise(fd: number, buffer: Buffer | string, offset?: number, length?: number, position?: number): Promise { + if (typeof buffer === `string`) { + return await this.baseFs.writePromise(fd, buffer, offset); + } else { + return await this.baseFs.writePromise(fd, buffer, offset, length, position); + } + } + + writeSync(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): number; + writeSync(fd: number, buffer: string, position?: number): number; + writeSync(fd: number, buffer: Buffer | string, offset?: number, length?: number, position?: number) { + if (typeof buffer === `string`) { + return this.baseFs.writeSync(fd, buffer, offset); + } else { + return this.baseFs.writeSync(fd, buffer, offset, length, position); + } + } + async closePromise(fd: number) { await this.baseFs.closePromise(fd); }