UNPKG

mdclint

Version:
908 lines (886 loc) 106 kB
import { readFile, mkdir, rm, writeFile } from 'node:fs/promises'; import { existsSync, readdirSync, renameSync, createWriteStream } from 'node:fs'; import j$1$1 from 'assert'; import sysPath from 'path'; import nt from 'events'; import ot from 'stream'; import ht from 'string_decoder'; import P$1 from 'buffer'; import O$2$1 from 'zlib'; import nt$1 from 'process'; import V$1 from 'fs'; import a$a$1 from 'util'; import require$$3 from 'crypto'; import { r as resolve$1, j as join, n as normalize$1, d as defu, c as dirname$1, e as basename } from '../shared/mdclint.CxcuYGgq.mjs'; import { PassThrough, pipeline } from 'node:stream'; import { spawn } from 'node:child_process'; import { homedir, tmpdir } from 'node:os'; import { promisify } from 'node:util'; import 'node:module'; import { createRequire } from 'module'; import { normalize, delimiter, resolve, dirname } from 'node:path'; import { cwd } from 'node:process'; import c$6 from 'node:readline'; import 'os'; import 'node:url'; import 'node:assert'; import 'node:v8'; import 'node:events'; import 'node:string_decoder'; var l$1 = Object.create; var u$5 = Object.defineProperty; var d = Object.getOwnPropertyDescriptor; var f$4 = Object.getOwnPropertyNames; var p$1 = Object.getPrototypeOf; var m$3 = Object.prototype.hasOwnProperty; var h$1 = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports); var g = (e, t, n, r) => { if (t && typeof t === "object" || typeof t === "function") for (var i = f$4(t), a = 0, o = i.length, s; a < o; a++) { s = i[a]; if (!m$3.call(e, s) && s !== n) u$5(e, s, { get: ((e) => t[e]).bind(null, s), enumerable: !(r = d(t, s)) || r.enumerable }); } return e; }; var _$1 = (e, t, n) => (n = e != null ? l$1(p$1(e)) : {}, g(u$5(n, "default", { value: e, enumerable: true }) , e)); var v$2 = /* @__PURE__ */ createRequire(import.meta.url); const y$3 = /^path$/i; const b = { key: "PATH", value: "" }; function x(e) { for (const t in e) { if (!Object.prototype.hasOwnProperty.call(e, t) || !y$3.test(t)) continue; const n = e[t]; if (!n) return b; return { key: t, value: n }; } return b; } function S$1(e, t) { const i = t.value.split(delimiter); let o = e; let s; do { i.push(resolve(o, "node_modules", ".bin")); s = o; o = dirname(o); } while (o !== s); return { key: t.key, value: i.join(delimiter) }; } function C$1(e, t) { const n = { ...process.env, ...t }; const r = S$1(e, x(n)); n[r.key] = r.value; return n; } const w$2 = (e) => { let t = e.length; const n = new PassThrough(); const r = () => { if (--t === 0) n.emit("end"); }; for (const t of e) { t.pipe(n, { end: false }); t.on("end", r); } return n; }; var T$1 = h$1((exports$1, t) => { t.exports = a; a.sync = o; var n = v$2("fs"); function r(e, t) { var n = t.pathExt !== void 0 ? t.pathExt : process.env.PATHEXT; if (!n) return true; n = n.split(";"); if (n.indexOf("") !== -1) return true; for (var r = 0; r < n.length; r++) { var i = n[r].toLowerCase(); if (i && e.substr(-i.length).toLowerCase() === i) return true; } return false; } function i(e, t, n) { if (!e.isSymbolicLink() && !e.isFile()) return false; return r(t, n); } function a(e, t, r) { n.stat(e, function(n, a) { r(n, n ? false : i(a, e, t)); }); } function o(e, t) { return i(n.statSync(e), e, t); } }); var E$1 = h$1((exports$1, t) => { t.exports = r; r.sync = i; var n = v$2("fs"); function r(e, t, r) { n.stat(e, function(e, n) { r(e, e ? false : a(n, t)); }); } function i(e, t) { return a(n.statSync(e), t); } function a(e, t) { return e.isFile() && o(e, t); } function o(e, t) { var n = e.mode; var r = e.uid; var i = e.gid; var a = t.uid !== void 0 ? t.uid : process.getuid && process.getuid(); var o = t.gid !== void 0 ? t.gid : process.getgid && process.getgid(); var s = parseInt("100", 8); var c = parseInt("010", 8); var l = parseInt("001", 8); var u = s | c; var d = n & l || n & c && i === o || n & s && r === a || n & u && a === 0; return d; } }); var D = h$1((exports$1, t) => { v$2("fs"); var r; if (process.platform === "win32" || global.TESTING_WINDOWS) r = T$1(); else r = E$1(); t.exports = i; i.sync = a; function i(e, t, n) { if (typeof t === "function") { n = t; t = {}; } if (!n) { if (typeof Promise !== "function") throw new TypeError("callback not provided"); return new Promise(function(n, r) { i(e, t || {}, function(e, t) { if (e) r(e); else n(t); }); }); } r(e, t || {}, function(e, r) { if (e) { if (e.code === "EACCES" || t && t.ignoreErrors) { e = null; r = false; } } n(e, r); }); } function a(e, t) { try { return r.sync(e, t || {}); } catch (e) { if (t && t.ignoreErrors || e.code === "EACCES") return false; else throw e; } } }); var O$2 = h$1((exports$1, t) => { const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys"; const r = v$2("path"); const i = n ? ";" : ":"; const a = D(); const o = (e) => Object.assign(new Error(`not found: ${e}`), { code: "ENOENT" }); const s = (e, t) => { const r = t.colon || i; const a = e.match(/\//) || n && e.match(/\\/) ? [""] : [...n ? [process.cwd()] : [], ...(t.path || process.env.PATH || "").split(r)]; const o = n ? t.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : ""; const s = n ? o.split(r) : [""]; if (n) { if (e.indexOf(".") !== -1 && s[0] !== "") s.unshift(""); } return { pathEnv: a, pathExt: s, pathExtExe: o }; }; const c = (e, t, n) => { if (typeof t === "function") { n = t; t = {}; } if (!t) t = {}; const { pathEnv: i, pathExt: c, pathExtExe: l } = s(e, t); const u = []; const d = (n) => new Promise((a, s) => { if (n === i.length) return t.all && u.length ? a(u) : s(o(e)); const c = i[n]; const l = /^".*"$/.test(c) ? c.slice(1, -1) : c; const d = r.join(l, e); const p = !l && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d; a(f(p, n, 0)); }); const f = (e, n, r) => new Promise((i, o) => { if (r === c.length) return i(d(n + 1)); const s = c[r]; a(e + s, { pathExt: l }, (a, o) => { if (!a && o) if (t.all) u.push(e + s); else return i(e + s); return i(f(e, n, r + 1)); }); }); return n ? d(0).then((e) => n(null, e), n) : d(0); }; const l = (e, t) => { t = t || {}; const { pathEnv: n, pathExt: i, pathExtExe: c } = s(e, t); const l = []; for (let o = 0; o < n.length; o++) { const s = n[o]; const u = /^".*"$/.test(s) ? s.slice(1, -1) : s; const d = r.join(u, e); const f = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d; for (let e = 0; e < i.length; e++) { const n = f + i[e]; try { const e = a.sync(n, { pathExt: c }); if (e) if (t.all) l.push(n); else return n; } catch (e) {} } } if (t.all && l.length) return l; if (t.nothrow) return null; throw o(e); }; t.exports = c; c.sync = l; }); var k$1 = h$1((exports$1, t) => { const n = (e = {}) => { const t = e.env || process.env; const n = e.platform || process.platform; if (n !== "win32") return "PATH"; return Object.keys(t).reverse().find((e) => e.toUpperCase() === "PATH") || "Path"; }; t.exports = n; t.exports.default = n; }); var A = h$1((exports$1, t) => { const n = v$2("path"); const r = O$2(); const i = k$1(); function a(e, t) { const a = e.options.env || process.env; const o = process.cwd(); const s = e.options.cwd != null; const c = s && process.chdir !== void 0 && !process.chdir.disabled; if (c) try { process.chdir(e.options.cwd); } catch (e) {} let l; try { l = r.sync(e.command, { path: a[i({ env: a })], pathExt: t ? n.delimiter : void 0 }); } catch (e) {} finally { if (c) process.chdir(o); } if (l) l = n.resolve(s ? e.options.cwd : "", l); return l; } function o(e) { return a(e) || a(e, true); } t.exports = o; }); var j$1 = h$1((exports$1, t) => { const n = /([()\][%!^"`<>&|;, *?])/g; function r(e) { e = e.replace(n, "^$1"); return e; } function i(e, t) { e = `${e}`; e = e.replace(/(\\*)"/g, "$1$1\\\""); e = e.replace(/(\\*)$/, "$1$1"); e = `"${e}"`; e = e.replace(n, "^$1"); if (t) e = e.replace(n, "^$1"); return e; } t.exports.command = r; t.exports.argument = i; }); var M = h$1((exports$1, t) => { t.exports = /^#!(.*)/; }); var N = h$1((exports$1, t) => { const n = M(); t.exports = (e = "") => { const t = e.match(n); if (!t) return null; const [r, i] = t[0].replace(/#! ?/, "").split(" "); const a = r.split("/").pop(); if (a === "env") return i; return i ? `${a} ${i}` : a; }; }); var P = h$1((exports$1, t) => { const n = v$2("fs"); const r = N(); function i(e) { const t = 150; const i = Buffer.alloc(t); let a; try { a = n.openSync(e, "r"); n.readSync(a, i, 0, t, 0); n.closeSync(a); } catch (e) {} return r(i.toString()); } t.exports = i; }); var F$3 = h$1((exports$1, t) => { const n = v$2("path"); const r = A(); const i = j$1(); const a = P(); const o = process.platform === "win32"; const s = /\.(?:com|exe)$/i; const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; function l(e) { e.file = r(e); const t = e.file && a(e.file); if (t) { e.args.unshift(e.file); e.command = t; return r(e); } return e.file; } function u(e) { if (!o) return e; const t = l(e); const r = !s.test(t); if (e.options.forceShell || r) { const r = c.test(t); e.command = n.normalize(e.command); e.command = i.command(e.command); e.args = e.args.map((e) => i.argument(e, r)); const a = [e.command].concat(e.args).join(" "); e.args = [ "/d", "/s", "/c", `"${a}"` ]; e.command = process.env.comspec || "cmd.exe"; e.options.windowsVerbatimArguments = true; } return e; } function d(e, t, n) { if (t && !Array.isArray(t)) { n = t; t = null; } t = t ? t.slice(0) : []; n = Object.assign({}, n); const r = { command: e, args: t, options: n, file: void 0, original: { command: e, args: t } }; return n.shell ? r : u(r); } t.exports = d; }); var I = h$1((exports$1, t) => { const n = process.platform === "win32"; function r(e, t) { return Object.assign(new Error(`${t} ${e.command} ENOENT`), { code: "ENOENT", errno: "ENOENT", syscall: `${t} ${e.command}`, path: e.command, spawnargs: e.args }); } function i(e, t) { if (!n) return; const r = e.emit; e.emit = function(n, i) { if (n === "exit") { const n = a(i, t); if (n) return r.call(e, "error", n); } return r.apply(e, arguments); }; } function a(e, t) { if (n && e === 1 && !t.file) return r(t.original, "spawn"); return null; } function o(e, t) { if (n && e === 1 && !t.file) return r(t.original, "spawnSync"); return null; } t.exports = { hookChildProcess: i, verifyENOENT: a, verifyENOENTSync: o, notFoundError: r }; }); var L = h$1((exports$1, t) => { const n = v$2("child_process"); const r = F$3(); const i = I(); function a(e, t, a) { const o = r(e, t, a); const s = n.spawn(o.command, o.args, o.options); i.hookChildProcess(s, o); return s; } function o(e, t, a) { const o = r(e, t, a); const s = n.spawnSync(o.command, o.args, o.options); s.error = s.error || i.verifyENOENTSync(s.status, o); return s; } t.exports = a; t.exports.spawn = a; t.exports.sync = o; t.exports._parse = r; t.exports._enoent = i; }); var R$2 = _$1(L()); var z$1 = class z extends Error { result; output; get exitCode() { if (this.result.exitCode !== null) return this.result.exitCode; return void 0; } constructor(e, t) { super(`Process exited with non-zero status (${e.exitCode})`); this.result = e; this.output = t; } }; const B = { timeout: void 0, persist: false }; const V = { windowsHide: true }; function H$2(e, t) { const n = normalize(e); const r = t ?? []; return { command: n, args: r }; } function U(e) { const t = new AbortController(); for (const n of e) { if (n.aborted) { t.abort(); return n; } const e = () => { t.abort(n.reason); }; n.addEventListener("abort", e, { signal: t.signal }); } return t.signal; } async function W(e) { let t = ""; for await (const n of e) t += n.toString(); return t; } var G$1 = class G { _process; _aborted = false; _options; _command; _args; _resolveClose; _processClosed; _thrownError; get process() { return this._process; } get pid() { return this._process?.pid; } get exitCode() { if (this._process && this._process.exitCode !== null) return this._process.exitCode; return void 0; } constructor(e, t, n) { this._options = { ...B, ...n }; this._command = e; this._args = t ?? []; this._processClosed = new Promise((e) => { this._resolveClose = e; }); } kill(e) { return this._process?.kill(e) === true; } get aborted() { return this._aborted; } get killed() { return this._process?.killed === true; } pipe(e, t, n) { return q$1(e, t, { ...n, stdin: this }); } async *[Symbol.asyncIterator]() { const e = this._process; if (!e) return; const t = []; if (this._streamErr) t.push(this._streamErr); if (this._streamOut) t.push(this._streamOut); const n = w$2(t); const r = c$6.createInterface({ input: n }); for await (const e of r) yield e.toString(); await this._processClosed; e.removeAllListeners(); if (this._thrownError) throw this._thrownError; if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z$1(this); } async _waitForOutput() { const e = this._process; if (!e) throw new Error("No process was started"); const [t, n] = await Promise.all([this._streamOut ? W(this._streamOut) : "", this._streamErr ? W(this._streamErr) : ""]); await this._processClosed; if (this._options?.stdin) await this._options.stdin; e.removeAllListeners(); if (this._thrownError) throw this._thrownError; const r = { stderr: n, stdout: t, exitCode: this.exitCode }; if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z$1(this, r); return r; } then(e, t) { return this._waitForOutput().then(e, t); } _streamOut; _streamErr; spawn() { const e = cwd(); const n = this._options; const r = { ...V, ...n.nodeOptions }; const i = []; this._resetState(); if (n.timeout !== void 0) i.push(AbortSignal.timeout(n.timeout)); if (n.signal !== void 0) i.push(n.signal); if (n.persist === true) r.detached = true; if (i.length > 0) r.signal = U(i); r.env = C$1(e, r.env); const { command: a, args: s } = H$2(this._command, this._args); const c = (0, R$2._parse)(a, s, r); const l = spawn(c.command, c.args, c.options); if (l.stderr) this._streamErr = l.stderr; if (l.stdout) this._streamOut = l.stdout; this._process = l; l.once("error", this._onError); l.once("close", this._onClose); if (n.stdin !== void 0 && l.stdin && n.stdin.process) { const { stdout: e } = n.stdin.process; if (e) e.pipe(l.stdin); } } _resetState() { this._aborted = false; this._processClosed = new Promise((e) => { this._resolveClose = e; }); this._thrownError = void 0; } _onError = (e) => { if (e.name === "AbortError" && (!(e.cause instanceof Error) || e.cause.name !== "TimeoutError")) { this._aborted = true; return; } this._thrownError = e; }; _onClose = () => { if (this._resolveClose) this._resolveClose(); }; }; const K = (e, t, n) => { const r = new G$1(e, t, n); r.spawn(); return r; }; const q$1 = K; async function findup(cwd, match, options = {}) { const segments = normalize$1(cwd).split("/"); while (segments.length > 0) { const path = segments.join("/") || "/"; const result = await match(path); if (result || !options.includeParentDirs) { return result; } segments.pop(); } } function cached(fn) { let v; return () => { if (v === void 0) { v = fn().then((r) => { v = r; return v; }); } return v; }; } const hasCorepack = cached(async () => { if (globalThis.process?.versions?.webcontainer) { return false; } try { const { exitCode } = await K("corepack", ["--version"]); return exitCode === 0; } catch { return false; } }); async function executeCommand(command, args, options = {}) { const xArgs = command === "npm" || command === "bun" || command === "deno" || !await hasCorepack() ? [command, args] : ["corepack", [command, ...args]]; const { exitCode, stdout, stderr } = await K(xArgs[0], xArgs[1], { nodeOptions: { cwd: resolve$1(options.cwd || process.cwd()), env: options.env, stdio: options.silent ? "pipe" : "inherit" } }); if (exitCode !== 0) { throw new Error( `\`${xArgs.flat().join(" ")}\` failed.${options.silent ? ["", stdout, stderr].join("\n") : ""}` ); } } const NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG = "No package manager auto-detected."; async function resolveOperationOptions(options = {}) { const cwd = options.cwd || process.cwd(); const env = { ...process.env, ...options.env }; const packageManager = (typeof options.packageManager === "string" ? packageManagers.find((pm) => pm.name === options.packageManager) : options.packageManager) || await detectPackageManager(options.cwd || process.cwd()); if (!packageManager) { throw new Error(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG); } return { cwd, env, silent: options.silent ?? false, packageManager, dev: options.dev ?? false, workspace: options.workspace, global: options.global ?? false, dry: options.dry ?? false }; } function parsePackageManagerField(packageManager) { const [name, _version] = (packageManager || "").split("@"); const [version, buildMeta] = _version?.split("+") || []; if (name && name !== "-" && /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name)) { return { name, version, buildMeta }; } const sanitized = name.replace(/\W+/g, ""); const warnings = [ `Abnormal characters found in \`packageManager\` field, sanitizing from \`${name}\` to \`${sanitized}\`` ]; return { name: sanitized, version, buildMeta, warnings }; } const packageManagers = [ { name: "npm", command: "npm", lockFile: "package-lock.json" }, { name: "pnpm", command: "pnpm", lockFile: "pnpm-lock.yaml", files: ["pnpm-workspace.yaml"] }, { name: "bun", command: "bun", lockFile: ["bun.lockb", "bun.lock"] }, { name: "yarn", command: "yarn", lockFile: "yarn.lock", files: [".yarnrc.yml"] }, { name: "deno", command: "deno", lockFile: "deno.lock", files: ["deno.json"] } ]; async function detectPackageManager(cwd, options = {}) { const detected = await findup( resolve$1(cwd || "."), async (path) => { if (!options.ignorePackageJSON) { const packageJSONPath = join(path, "package.json"); if (existsSync(packageJSONPath)) { const packageJSON = JSON.parse( await readFile(packageJSONPath, "utf8") ); if (packageJSON?.packageManager) { const { name, version = "0.0.0", buildMeta, warnings } = parsePackageManagerField(packageJSON.packageManager); if (name) { const majorVersion = version.split(".")[0]; const packageManager = packageManagers.find( (pm) => pm.name === name && pm.majorVersion === majorVersion ) || packageManagers.find((pm) => pm.name === name); return { name, command: name, version, majorVersion, buildMeta, warnings, files: packageManager?.files, lockFile: packageManager?.lockFile }; } } } const denoJSONPath = join(path, "deno.json"); if (existsSync(denoJSONPath)) { return packageManagers.find((pm) => pm.name === "deno"); } } if (!options.ignoreLockFile) { for (const packageManager of packageManagers) { const detectionsFiles = [ packageManager.lockFile, packageManager.files ].flat().filter(Boolean); if (detectionsFiles.some((file) => existsSync(resolve$1(path, file)))) { return { ...packageManager }; } } } }, { includeParentDirs: options.includeParentDirs ?? true } ); if (!detected && !options.ignoreArgv) { const scriptArg = process.argv[1]; if (scriptArg) { for (const packageManager of packageManagers) { const re = new RegExp(`[/\\\\]\\.?${packageManager.command}`); if (re.test(scriptArg)) { return packageManager; } } } } return detected; } async function installDependencies(options = {}) { const resolvedOptions = await resolveOperationOptions(options); const pmToFrozenLockfileInstallCommand = { npm: ["ci"], yarn: ["install", "--immutable"], bun: ["install", "--frozen-lockfile"], pnpm: ["install", "--frozen-lockfile"], deno: ["install", "--frozen"] }; const commandArgs = options.frozenLockFile ? pmToFrozenLockfileInstallCommand[resolvedOptions.packageManager.name] : ["install"]; if (!resolvedOptions.dry) { await executeCommand(resolvedOptions.packageManager.command, commandArgs, { cwd: resolvedOptions.cwd, silent: resolvedOptions.silent }); } return { exec: { command: resolvedOptions.packageManager.command, args: commandArgs } }; } var n$4=Object.defineProperty;var e$6=(t,r)=>n$4(t,"name",{value:r,configurable:true});var i$7=Object.defineProperty,c$5=e$6((t,r)=>i$7(t,"name",{value:r,configurable:true}),"e");function a$a(){return {agent:void 0,dispatcher:void 0}}e$6(a$a,"createProxy"),c$5(a$a,"createProxy");function o$5(){return globalThis.fetch}e$6(o$5,"createFetch"),c$5(o$5,"createFetch");const h=globalThis.fetch; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var i$6,t$5;function s$6(){if(t$5)return i$6;t$5=1;const n=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"]]);return i$6=r=>r?Object.keys(r).map(e=>[n.has(e)?n.get(e):e,r[e]]).reduce((e,p)=>(e[p[0]]=p[1],e),Object.create(null)):{},i$6} var e$5,t$4;function c$4(){return t$4||(t$4=1,e$5=o=>class extends o{warn(n,i,r={}){this.file&&(r.file=this.file),this.cwd&&(r.cwd=this.cwd),r.code=i instanceof Error&&i.code||n,r.tarCode=n,!this.strict&&r.recoverable!==false?(i instanceof Error&&(r=Object.assign(i,r),i=i.message),this.emit("warn",r.tarCode,i,r)):i instanceof Error?this.emit("error",Object.assign(i,r)):this.emit("error",Object.assign(new Error(`${n}: ${i}`),r));}}),e$5} var e$4={}; var a$9;function n$3(){return a$9?e$4:(a$9=1,function(e){e.name=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),e.code=new Map(Array.from(e.name).map(i=>[i[1],i[0]]));}(e$4),e$4)} var f$3,i$5;function w$1(){if(i$5)return f$3;i$5=1;const v=(e,r)=>{if(Number.isSafeInteger(e))e<0?g(e,r):p(e,r);else throw Error("cannot encode number outside of javascript safe integer range");return r},p=(e,r)=>{r[0]=128;for(var o=r.length;o>1;o--)r[o-1]=e&255,e=Math.floor(e/256);},g=(e,r)=>{r[0]=255;var o=false;e=e*-1;for(var s=r.length;s>1;s--){var a=e&255;e=Math.floor(e/256),o?r[s-1]=l(a):a===0?r[s-1]=0:(o=true,r[s-1]=c(a));}},h=e=>{const r=e[0],o=r===128?d(e.slice(1,e.length)):r===255?x(e):null;if(o===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(o))throw Error("parsed number outside of javascript safe integer range");return o},x=e=>{for(var r=e.length,o=0,s=false,a=r-1;a>-1;a--){var n=e[a],t;s?t=l(n):n===0?t=n:(s=true,t=c(n)),t!==0&&(o-=t*Math.pow(256,r-a-1));}return o},d=e=>{for(var r=e.length,o=0,s=r-1;s>-1;s--){var a=e[s];a!==0&&(o+=a*Math.pow(256,r-s-1));}return o},l=e=>(255^e)&255,c=e=>(255^e)+1&255;return f$3={encode:v,parse:h},f$3} var k,w;function E(){if(w)return k;w=1;const u=n$3(),x=sysPath.posix,y=w$1(),P=Symbol("slurp"),a=Symbol("type");class B{constructor(e,t,i,h){this.cksumValid=false,this.needPax=false,this.nullBlock=false,this.block=null,this.path=null,this.mode=null,this.uid=null,this.gid=null,this.size=null,this.mtime=null,this.cksum=null,this[a]="0",this.linkpath=null,this.uname=null,this.gname=null,this.devmaj=0,this.devmin=0,this.atime=null,this.ctime=null,Buffer.isBuffer(e)?this.decode(e,t||0,i,h):e&&this.set(e);}decode(e,t,i,h){if(t||(t=0),!e||!(e.length>=t+512))throw new Error("need 512 bytes for header");if(this.path=d(e,t,100),this.mode=r(e,t+100,8),this.uid=r(e,t+108,8),this.gid=r(e,t+116,8),this.size=r(e,t+124,12),this.mtime=o(e,t+136,12),this.cksum=r(e,t+148,12),this[P](i),this[P](h,true),this[a]=d(e,t+156,1),this[a]===""&&(this[a]="0"),this[a]==="0"&&this.path.slice(-1)==="/"&&(this[a]="5"),this[a]==="5"&&(this.size=0),this.linkpath=d(e,t+157,100),e.slice(t+257,t+265).toString()==="ustar\x0000")if(this.uname=d(e,t+265,32),this.gname=d(e,t+297,32),this.devmaj=r(e,t+329,8),this.devmin=r(e,t+337,8),e[t+475]!==0){const n=d(e,t+345,155);this.path=n+"/"+this.path;}else {const n=d(e,t+345,130);n&&(this.path=n+"/"+this.path),this.atime=o(e,t+476,12),this.ctime=o(e,t+488,12);}let l=8*32;for(let n=t;n<t+148;n++)l+=e[n];for(let n=t+156;n<t+512;n++)l+=e[n];this.cksumValid=l===this.cksum,this.cksum===null&&l===8*32&&(this.nullBlock=true);}[P](e,t){for(const i in e)e[i]!==null&&e[i]!==void 0&&!(t&&i==="path")&&(this[i]=e[i]);}encode(e,t){if(e||(e=this.block=Buffer.alloc(512),t=0),t||(t=0),!(e.length>=t+512))throw new Error("need 512 bytes for header");const i=this.ctime||this.atime?130:155,h=L(this.path||"",i),l=h[0],n=h[1];this.needPax=h[2],this.needPax=m(e,t,100,l)||this.needPax,this.needPax=c(e,t+100,8,this.mode)||this.needPax,this.needPax=c(e,t+108,8,this.uid)||this.needPax,this.needPax=c(e,t+116,8,this.gid)||this.needPax,this.needPax=c(e,t+124,12,this.size)||this.needPax,this.needPax=g(e,t+136,12,this.mtime)||this.needPax,e[t+156]=this[a].charCodeAt(0),this.needPax=m(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=m(e,t+265,32,this.uname)||this.needPax,this.needPax=m(e,t+297,32,this.gname)||this.needPax,this.needPax=c(e,t+329,8,this.devmaj)||this.needPax,this.needPax=c(e,t+337,8,this.devmin)||this.needPax,this.needPax=m(e,t+345,i,n)||this.needPax,e[t+475]!==0?this.needPax=m(e,t+345,155,n)||this.needPax:(this.needPax=m(e,t+345,130,n)||this.needPax,this.needPax=g(e,t+476,12,this.atime)||this.needPax,this.needPax=g(e,t+488,12,this.ctime)||this.needPax);let S=8*32;for(let p=t;p<t+148;p++)S+=e[p];for(let p=t+156;p<t+512;p++)S+=e[p];return this.cksum=S,c(e,t+148,8,this.cksum),this.cksumValid=true,this.needPax}set(e){for(const t in e)e[t]!==null&&e[t]!==void 0&&(this[t]=e[t]);}get type(){return u.name.get(this[a])||this[a]}get typeKey(){return this[a]}set type(e){u.code.has(e)?this[a]=u.code.get(e):this[a]=e;}}const L=(s,e)=>{let i=s,h="",l;const n=x.parse(s).root||".";if(Buffer.byteLength(i)<100)l=[i,h,false];else {h=x.dirname(i),i=x.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(h)<=e?l=[i,h,false]:Buffer.byteLength(i)>100&&Buffer.byteLength(h)<=e?l=[i.slice(0,99),h,true]:(i=x.join(x.basename(h),i),h=x.dirname(h));while(h!==n&&!l);l||(l=[s.slice(0,99),"",true]);}return l},d=(s,e,t)=>s.slice(e,e+t).toString("utf8").replace(/\0.*/,""),o=(s,e,t)=>N(r(s,e,t)),N=s=>s===null?null:new Date(s*1e3),r=(s,e,t)=>s[e]&128?y.parse(s.slice(e,e+t)):j(s,e,t),q=s=>isNaN(s)?null:s,j=(s,e,t)=>q(parseInt(s.slice(e,e+t).toString("utf8").replace(/\0.*$/,"").trim(),8)),v={12:8589934591,8:2097151},c=(s,e,t,i)=>i===null?false:i>v[t]||i<0?(y.encode(i,s.slice(e,e+t)),true):($(s,e,t,i),false),$=(s,e,t,i)=>s.write(_(i,t),e,t,"ascii"),_=(s,e)=>z(Math.floor(s).toString(8),e),z=(s,e)=>(s.length===e-1?s:new Array(e-s.length-1).join("0")+s+" ")+"\0",g=(s,e,t,i)=>i===null?false:c(s,e,t,i.getTime()/1e3),A=new Array(156).join("\0"),m=(s,e,t,i)=>i===null?false:(s.write(i+A,e,t,"utf8"),i.length!==Buffer.byteLength(i)||i.length>t);return k=B,k} var e$3,t$3;function i$4(){return t$3||(t$3=1,e$3=function(o){o.prototype[Symbol.iterator]=function*(){for(let r=this.head;r;r=r.next)yield r.value;};}),e$3} var u$4,a$8;function c$3(){if(a$8)return u$4;a$8=1,u$4=r,r.Node=s,r.create=r;function r(t){var i=this;if(i instanceof r||(i=new r),i.tail=null,i.head=null,i.length=0,t&&typeof t.forEach=="function")t.forEach(function(n){i.push(n);});else if(arguments.length>0)for(var e=0,h=arguments.length;e<h;e++)i.push(arguments[e]);return i}r.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var i=t.next,e=t.prev;return i&&(i.prev=e),e&&(e.next=i),t===this.head&&(this.head=i),t===this.tail&&(this.tail=e),t.list.length--,t.next=null,t.prev=null,t.list=null,i},r.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var i=this.head;t.list=this,t.next=i,i&&(i.prev=t),this.head=t,this.tail||(this.tail=t),this.length++;}},r.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var i=this.tail;t.list=this,t.prev=i,i&&(i.next=t),this.tail=t,this.head||(this.head=t),this.length++;}},r.prototype.push=function(){for(var t=0,i=arguments.length;t<i;t++)f(this,arguments[t]);return this.length},r.prototype.unshift=function(){for(var t=0,i=arguments.length;t<i;t++)o(this,arguments[t]);return this.length},r.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},r.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},r.prototype.forEach=function(t,i){i=i||this;for(var e=this.head,h=0;e!==null;h++)t.call(i,e.value,h,this),e=e.next;},r.prototype.forEachReverse=function(t,i){i=i||this;for(var e=this.tail,h=this.length-1;e!==null;h--)t.call(i,e.value,h,this),e=e.prev;},r.prototype.get=function(t){for(var i=0,e=this.head;e!==null&&i<t;i++)e=e.next;if(i===t&&e!==null)return e.value},r.prototype.getReverse=function(t){for(var i=0,e=this.tail;e!==null&&i<t;i++)e=e.prev;if(i===t&&e!==null)return e.value},r.prototype.map=function(t,i){i=i||this;for(var e=new r,h=this.head;h!==null;)e.push(t.call(i,h.value,this)),h=h.next;return e},r.prototype.mapReverse=function(t,i){i=i||this;for(var e=new r,h=this.tail;h!==null;)e.push(t.call(i,h.value,this)),h=h.prev;return e},r.prototype.reduce=function(t,i){var e,h=this.head;if(arguments.length>1)e=i;else if(this.head)h=this.head.next,e=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;h!==null;n++)e=t(e,h.value,n),h=h.next;return e},r.prototype.reduceReverse=function(t,i){var e,h=this.tail;if(arguments.length>1)e=i;else if(this.tail)h=this.tail.prev,e=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=this.length-1;h!==null;n--)e=t(e,h.value,n),h=h.prev;return e},r.prototype.toArray=function(){for(var t=new Array(this.length),i=0,e=this.head;e!==null;i++)t[i]=e.value,e=e.next;return t},r.prototype.toArrayReverse=function(){for(var t=new Array(this.length),i=0,e=this.tail;e!==null;i++)t[i]=e.value,e=e.prev;return t},r.prototype.slice=function(t,i){i=i||this.length,i<0&&(i+=this.length),t=t||0,t<0&&(t+=this.length);var e=new r;if(i<t||i<0)return e;t<0&&(t=0),i>this.length&&(i=this.length);for(var h=0,n=this.head;n!==null&&h<t;h++)n=n.next;for(;n!==null&&h<i;h++,n=n.next)e.push(n.value);return e},r.prototype.sliceReverse=function(t,i){i=i||this.length,i<0&&(i+=this.length),t=t||0,t<0&&(t+=this.length);var e=new r;if(i<t||i<0)return e;t<0&&(t=0),i>this.length&&(i=this.length);for(var h=this.length,n=this.tail;n!==null&&h>i;h--)n=n.prev;for(;n!==null&&h>t;h--,n=n.prev)e.push(n.value);return e},r.prototype.splice=function(t,i,...e){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var h=0,n=this.head;n!==null&&h<t;h++)n=n.next;for(var l=[],h=0;n&&h<i;h++)l.push(n.value),n=this.removeNode(n);n===null&&(n=this.tail),n!==this.head&&n!==this.tail&&(n=n.prev);for(var h=0;h<e.length;h++)n=v(this,n,e[h]);return l},r.prototype.reverse=function(){for(var t=this.head,i=this.tail,e=t;e!==null;e=e.prev){var h=e.prev;e.prev=e.next,e.next=h;}return this.head=i,this.tail=t,this};function v(t,i,e){var h=i===t.head?new s(e,null,i,t):new s(e,i,i.next,t);return h.next===null&&(t.tail=h),h.prev===null&&(t.head=h),t.length++,h}function f(t,i){t.tail=new s(i,t.tail,null,t),t.head||(t.head=t.tail),t.length++;}function o(t,i){t.head=new s(i,null,t.head,t),t.tail||(t.tail=t.head),t.length++;}function s(t,i,e,h){if(!(this instanceof s))return new s(t,i,e,h);this.list=h,this.value=t,i?(i.next=this,this.prev=i):this.prev=null,e?(e.prev=this,this.next=e):this.next=null;}try{i$4()(r);}catch{}return u$4} var s$5={}; var X$1;function ft(){if(X$1)return s$5;X$1=1;const H=typeof process=="object"&&process?process:{stdout:null,stderr:null},Z=nt,q=ot,G=ht.StringDecoder,m=Symbol("EOF"),d=Symbol("maybeEmitEnd"),y=Symbol("emittedEnd"),R=Symbol("emittingEnd"),g=Symbol("emittedError"),B=Symbol("closed"),Y=Symbol("read"),T=Symbol("flush"),$=Symbol("flushChunk"),f=Symbol("encoding"),c=Symbol("decoder"),M=Symbol("flowing"),S=Symbol("paused"),b=Symbol("resume"),i=Symbol("buffer"),a=Symbol("pipes"),n=Symbol("bufferLength"),j=Symbol("bufferPush"),I=Symbol("bufferShift"),o=Symbol("objectMode"),r=Symbol("destroyed"),P=Symbol("error"),x=Symbol("emitData"),V=Symbol("emitEnd"),N=Symbol("emitEnd2"),p=Symbol("async"),_=Symbol("abort"),O=Symbol("aborted"),E=Symbol("signal"),w=h=>Promise.resolve().then(h),J=commonjsGlobal._MP_NO_ITERATOR_SYMBOLS_!=="1",K=J&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),W=J&&Symbol.iterator||Symbol("iterator not implemented"),k=h=>h==="end"||h==="finish"||h==="prefinish",tt=h=>h instanceof ArrayBuffer||typeof h=="object"&&h.constructor&&h.constructor.name==="ArrayBuffer"&&h.byteLength>=0,et=h=>!Buffer.isBuffer(h)&&ArrayBuffer.isView(h);class z{constructor(t,e,s){this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[b](),e.on("drain",this.ondrain);}unpipe(){this.dest.removeListener("drain",this.ondrain);}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end();}}class st extends z{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe();}constructor(t,e,s){super(t,e,s),this.proxyErrors=l=>e.emit("error",l),t.on("error",this.proxyErrors);}}class F extends q{constructor(t){super(),this[M]=false,this[S]=false,this[a]=[],this[i]=[],this[o]=t&&t.objectMode||false,this[o]?this[f]=null:this[f]=t&&t.encoding||null,this[f]==="buffer"&&(this[f]=null),this[p]=t&&!!t.async||false,this[c]=this[f]?new G(this[f]):null,this[m]=false,this[y]=false,this[R]=false,this[B]=false,this[g]=null,this.writable=true,this.readable=true,this[n]=0,this[r]=false,t&&t.debugExposeBuffer===true&&Object.defineProperty(this,"buffer",{get:()=>this[i]}),t&&t.debugExposePipes===true&&Object.defineProperty(this,"pipes",{get:()=>this[a]}),this[E]=t&&t.signal,this[O]=false,this[E]&&(this[E].addEventListener("abort",()=>this[_]()),this[E].aborted&&this[_]());}get bufferLength(){return this[n]}get encoding(){return this[f]}set encoding(t){if(this[o])throw new Error("cannot set encoding in objectMode");if(this[f]&&t!==this[f]&&(this[c]&&this[c].lastNeed||this[n]))throw new Error("cannot change encoding");this[f]!==t&&(this[c]=t?new G(t):null,this[i].length&&(this[i]=this[i].map(e=>this[c].write(e)))),this[f]=t;}setEncoding(t){this.encoding=t;}get objectMode(){return this[o]}set objectMode(t){this[o]=this[o]||!!t;}get async(){return this[p]}set async(t){this[p]=this[p]||!!t;}[_](){this[O]=true,this.emit("abort",this[E].reason),this.destroy(this[E].reason);}get aborted(){return this[O]}set aborted(t){}write(t,e,s){if(this[O])return false;if(this[m])throw new Error("write after end");if(this[r])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),true;typeof e=="function"&&(s=e,e="utf8"),e||(e="utf8");const l=this[p]?w:u=>u();return !this[o]&&!Buffer.isBuffer(t)&&(et(t)?t=Buffer.from(t.buffer,t.byteOffset,t.byteLength):tt(t)?t=Buffer.from(t):typeof t!="string"&&(this.objectMode=true)),this[o]?(this.flowing&&this[n]!==0&&this[T](true),this.flowing?this.emit("data",t):this[j](t),this[n]!==0&&this.emit("readable"),s&&l(s),this.flowing):t.length?(typeof t=="string"&&!(e===this[f]&&!this[c].lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[f]&&(t=this[c].write(t)),this.flowing&&this[n]!==0&&this[T](true),this.flowing?this.emit("data",t):this[j](t),this[n]!==0&&this.emit("readable"),s&&l(s),this.flowing):(this[n]!==0&&this.emit("readable"),s&&l(s),this.flowing)}read(t){if(this[r])return null;if(this[n]===0||t===0||t>this[n])return this[d](),null;this[o]&&(t=null),this[i].length>1&&!this[o]&&(this.encoding?this[i]=[this[i].join("")]:this[i]=[Buffer.concat(this[i],this[n])]);const e=this[Y](t||null,this[i][0]);return this[d](),e}[Y](t,e){return t===e.length||t===null?this[I]():(this[i][0]=e.slice(t),e=e.slice(0,t),this[n]-=t),this.emit("data",e),!this[i].length&&!this[m]&&this.emit("drain"),e}end(t,e,s){return typeof t=="function"&&(s=t,t=null),typeof e=="function"&&(s=e,e="utf8"),t&&this.write(t,e),s&&this.once("end",s),this[m]=true,this.writable=false,(this.flowing||!this[S])&&this[d](),this}[b](){this[r]||(this[S]=false,this[M]=true,this.emit("resume"),this[i].length?this[T]():this[m]?this[d]():this.emit("drain"));}resume(){return this[b]()}pause(){this[M]=false,this[S]=true;}get destroyed(){return this[r]}get flowing(){return this[M]}get paused(){return this[S]}[j](t){this[o]?this[n]+=1:this[n]+=t.length,this[i].push(t);}[I](){return this[o]?this[n]-=1:this[n]-=this[i][0].length,this[i].shift()}[T](t){do;while(this[$](this[I]())&&this[i].length);!t&&!this[i].length&&!this[m]&&this.emit("drain");}[$](t){return this.emit("data",t),this.flowing}pipe(t,e){if(this[r])return;const s=this[y];return e=e||{},t===H.stdout||t===H.stderr?e.end=false:e.end=e.end!==false,e.proxyErrors=!!e.proxyErrors,s?e.end&&t.end():(this[a].push(e.proxyErrors?new st(this,t,e):new z(this,t,e)),this[p]?w(()=>this[b]()):this[b]()),t}unpipe(t){const e=this[a].find(s=>s.dest===t);e&&(this[a].splice(this[a].indexOf(e),1),e.unpipe());}addListener(t,e){return this.on(t,e)}on(t,e){const s=super.on(t,e);return t==="data"&&!this[a].length&&!this.flowing?this[b]():t==="readable"&&this[n]!==0?super.emit("readable"):k(t)&&this[y]?(super.emit(t),this.removeAllListeners(t)):t==="error"&&this[g]&&(this[p]?w(()=>e.call(this,this[g])):e.call(this,this[g])),s}get emittedEnd(){return this[y]}[d](){!this[R]&&!this[y]&&!this[r]&&this[i].length===0&&this[m]&&(this[R]=true,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[B]&&this.emit("close"),this[R]=false);}emit(t,e,...s){if(t!=="error"&&t!=="close"&&t!==r&&this[r])return;if(t==="data")return !this[o]&&!e?false:this[p]?w(()=>this[x](e)):this[x](e);if(t==="end")return this[V]();if(t==="close"){if(this[B]=true,!this[y]&&!this[r])return;const u=super.emit("close");return this.removeAllListeners("close"),u}else if(t==="error"){this[g]=e,super.emit(P,e);const u=!this[E]||this.listeners("error").length?super.emit("error",e):false;return this[d](),u}else if(t==="resume"){const u=super.emit("resume");return this[d](),u}else if(t==="finish"||t==="prefinish"){const u=super.emit(t);return this.removeAllListeners(t),u}const l=super.emit(t,e,...s);return this[d](),l}[x](t){for(const s of this[a])s.dest.write(t)===false&&this.pause();const e=super.emit("data",t);return this[d](),e}[V](){this[y]||(this[y]=true,this.readable=false,this[p]?w(()=>this[N]()):this[N]());}[N](){if(this[c]){const e=this[c].end();if(e){for(const s of this[a])s.dest.write(e);super.emit("data",e);}}for(const e of this[a])e.end();const t=super.emit("end");return this.removeAllListeners("end"),t}collect(){const t=[];this[o]||(t.dataLength=0);const e=this.promise();return this.on("data",s=>{t.push(s),this[o]||(t.dataLength+=s.length);}),e.then(()=>t)}concat(){return this[o]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(t=>this[o]?Promise.reject(new Error("cannot concat in objectMode")):this[f]?t.join(""):Buffer.concat(t,t.dataLength))}promise(){return new Promise((t,e)=>{this.on(r,()=>e(new Error("stream destroyed"))),this.on("error",s=>e(s)),this.on("end",()=>t());})}[K](){let t=false;const e=()=>(this.pause(),t=true,Promise.resolve({done:true}));return {next:()=>{if(t)return e();const l=this.read();if(l!==null)return Promise.resolve({done:false,value:l});if(this[m])return e();let u=null,Q=null;const A=L=>{this.removeListener("data",U),this.removeListener("end",C),this.removeListener(r,D),e(),Q(L);},U=L=>{this.removeListener("error",A),this.removeListener("end",C),this.removeListener(r,D),this.pause(),u({value:L,done:!!this[m]});},C=()=>{this.removeListener("error",A),this.removeListener("data",U),this.removeListener(r,D),e(),u({done:true});},D=()=>A(new Error("stream destroyed"));return new Promise((L,it)=>{Q=it,u=L,this.once(r,D),this.once("error",A),this.once("end",C),this.once("data",U);})},throw:e,return:e,[K](){return this}}}[W](){let t=false;const e=()=>(this.pause(),this.removeListener(P,e),this.removeListener(r,e),this.removeListener("end",e),t=true,{done:true}),s=()=>{if(t)return e();const l=this.read();return l===null?e():{value:l}};return this.once("end",e),this.once(P,e),this.once(r,e),{next:s,throw:e,return:e,[W](){return this}}}destroy(t){return this[r]?(t?this.emit("error",t):this.emit(r),this):(this[r]=true,this[i].length=0,this[n]=0,typeof this.close=="function"&&!this[B]&&this.close(),t?this.emit("error",t):this.emit(r),this)}static isStream(t){return !!t&&(t instanceof F||t instanceof q||t instanceof Z&&(typeof t.pipe=="function"||typeof t.write=="function"&&typeof t.end=="function"))}}return s$5.Minipass=F,s$5} var e$2,o$4;function a$7(){return o$4||(o$4=1,e$2=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)!=="win32"?r=>r:r=>r&&r.replace(/\\/g,"/")),e$2} var n$2,a$6;function u$3(){if(a$6)return n$2;a$6=1;const{Minipass:o}=ft(),s=a$7(),r=Symbol("slurp");return n$2=class extends o{constructor(t,e,i){switch(super(),this.pause(),this.extended=e,this.globalExtended=i,this.header=t,this.startBlockSize=512*Math.ceil(t.size/512),this.blockRemain=this.startBlockSize,this.remain=t.size,this.type=t.type,this.meta=false,this.ignore=false,this.type){case "File":case "OldFile":case "Link":case "SymbolicLink":case "CharacterDevice":case "BlockDevice":case "Directory":case "FIFO":case "ContiguousFile":case "GNUDumpDir":break;case "NextFileHasLongLinkpath":case "NextFileHasLongPath":case "OldGnuLongPath":case "GlobalExtendedHeader":case "ExtendedHeader":case "OldExtendedHeader":this.meta=true;break;default:this.ignore=true;}this.path=s(t.path),this.mode=t.mode,this.mode&&(this.mode=this.mode&4095),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=t.size,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=s(t.linkpath),this.uname=t.uname,this.gname=t.gname,e&&this[r](e),i&&this[r](i,true);}write(t){const e=t.length;if(e>this.blockRemain)throw new Error("writing more to entry than is appropriate");const i=this.remain,c=this.blockRemain;return this.remain=Math.max(0,i-e),this.blockRemain=Math.max(0,c-e),this.ignore?true:i>=e?super.write(t):super.write(t.slice(0,i))}[r](t,e){for(const i in t)t[i]!==null&&t[i]!==void 0&&!(e&&i==="path")&&(this[i]=i==="path"||i==="linkpath"?s(t[i]):t[i]);}},n$2} var r$2,a$5;function f$2(){if(a$5)return r$2;a$5=1;const c=E(),d=sysPath;class h{constructor(e,n){this.atime=e.atime||null,this.charset=e.charset||null,this.comment=e.comment||null,this.ctime=e.ctime||null,this.gid=e.gid||null,this.gname=e.gname||null,this.linkpath=e.linkpath||null,this.mtime=e.mtime||null,this.path=e.path||null,this.size=e.size||null,this.uid=e.uid||null,this.uname=e.uname||null,this.dev=e.dev||null,this.ino=e.ino||null,this.nlink=e.nlink||null,this.global=n||false;}encode(){const e=this.encodeBody();if(e==="")return null;const n=Buffer.byteLength(e),l=512*Math.ceil(1+n/512),i=Buffer.allocUnsafe(l);for(let t=0;t<512;t++)i[t]=0;new c({path:("PaxHeader/"+d.basename(this.path)).slice(0,99),mode:this.mode||420,uid:this.uid||null,gid:this.gid||null,size:n,mtime:this.mtime||null,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime||null,ctime:this.ctime||null}).encode(i),i.write(e,512,n,"utf8");for(let t=n+512;t<i.length;t++)i[t]=0;return i}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===null||this[e]===void 0)return "";const n=this[e]instanceof Date?this[e].getTime()/1e3:this[e],l=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+n+` `,i=Buffer.byteLength(l);let t=Math.floor(Math.log(i)/Math.log(10))+1;return i+t>=Math.pow(10,t)&&(t+=1),t+i+l}}h.parse=(s,e,n)=>new h(o(u(s),e),n);const o=(s,e)=>e?Object.keys(s).reduce((n,l)=>(n[l]=s[l],n),e):s,u=s=>s.replace(/\n$/,"").split(` `).reduce(m,Object.create(null)),m=(s,e)=>{const n=parseInt(e,10);if(n!==Buffer.byteLength(e)+1)return s;e=e.slice((n+" ").length);const l=e.split("="),i=l.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!i)return s;const t=l.join("=");return s[i]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(i)?new Date(t*1e3):/^[0-9]+$/.test(t)?+t:t,s};return r$2=h,r$2} var i$3={}; var _,R$1;function T(){if(R$1)return _;R$1=1;const E=O$2$1.constants||{ZLIB_VERNUM:4736};return _=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_D