lakutata
Version:
An IoC-based universal application framework.
2,076 lines (1,691 loc) • 282 kB
JavaScript
import { _ as e, a as t } from "../../../vendor/Package.1.mjs";
import { Component as n } from "../../lib/core/Component.mjs";
import { Singleton as r } from "../../decorators/di/Lifetime.mjs";
import { DockerImage as i } from "./lib/DockerImage.mjs";
import { DockerContainer as s } from "./lib/DockerContainer.mjs";
import { platform as a } from "os";
import { Configurable as o } from "../../decorators/di/Configurable.mjs";
import { D as u } from "../../../vendor/Package.2.mjs";
import { D as c, a as l } from "../../../vendor/Package.19.mjs";
import { DockerConnectionException as f } from "./exceptions/DockerConnectionException.mjs";
import { DockerImageNotFoundException as h } from "./exceptions/DockerImageNotFoundException.mjs";
import { ImagePullOptions as d } from "./options/image/ImagePullOptions.mjs";
import { Accept as g } from "../../decorators/dto/Accept.mjs";
import { createInterface as p } from "node:readline";
import { DockerImagePullException as m } from "./exceptions/DockerImagePullException.mjs";
import { IsAbortError as b } from "../../lib/helpers/IsAbortError.mjs";
import { ImageBuildOptions as _ } from "./options/image/ImageBuildOptions.mjs";
import { DockerImageBuildException as v } from "./exceptions/DockerImageBuildException.mjs";
import { ImageImportOptions as y } from "./options/image/ImageImportOptions.mjs";
import { DockerImageImportException as A } from "./exceptions/DockerImageImportException.mjs";
import { g as w, c as k, a as x } from "../../../vendor/Package.5.mjs";
import "../../../vendor/Package.8.mjs";
import S from "events";
import { createReadStream as R } from "node:fs";
import { PassThrough as I } from "node:stream";
import { NetworkCreateOptions as P } from "./options/network/NetworkCreateOptions.mjs";
import { As as C } from "../../lib/helpers/As.mjs";
import { Time as O } from "../../lib/core/Time.mjs";
import { DockerNetworkNotFoundException as E } from "./exceptions/DockerNetworkNotFoundException.mjs";
import { ContainerSettingOptions as j } from "./options/container/ContainerSettingOptions.mjs";
import { DockerPruneOptions as T } from "./options/DockerPruneOptions.mjs";
import { DockerAuthOptions as L } from "./options/auth/DockerAuthOptions.mjs";
import { DevNull as N } from "../../lib/helpers/DevNull.mjs";
import { c as D } from "../../../vendor/Package.7.mjs";
import { readFile as F } from "node:fs/promises";
import M from "node:path";
import "../../../vendor/Package.3.mjs";
import "../../lib/base/async-constructor/AsyncConstructor.mjs";
import "../../lib/base/async-constructor/Append.mjs";
import "../../lib/helpers/IsPromiseLike.mjs";
import "../../lib/helpers/IsPromise.mjs";
import "util/types";
import "../../exceptions/MethodNotFoundException.mjs";
import "../../lib/base/abstracts/Exception.mjs";
import "../../lib/base/internal/BasicInfo.mjs";
import "../../../vendor/Package.6.mjs";
import "../../lib/base/internal/ThrowWarning.mjs";
import "../../lib/helpers/Templating.mjs";
import "../../lib/base/internal/CamelCase.mjs";
import "../../lib/helpers/NoCase.mjs";
import "../../lib/ioc/DependencyInjectionContainer.mjs";
import "util";
import "../../lib/ioc/Errors.mjs";
import "../../exceptions/di/DependencyInjectionException.mjs";
import "../../lib/base/internal/ConstructorSymbol.mjs";
import "../../constants/DIMetadataKey.mjs";
import "../../../vendor/Package.4.mjs";
import "node:crypto";
import "../../lib/base/internal/DataValidator.mjs";
import "node:util/types";
import "../../lib/validation/VLD.mjs";
import "../../../vendor/Package.11.mjs";
import "url";
import "../../../vendor/Package.10.mjs";
import "../../exceptions/dto/InvalidValueException.mjs";
import "../../../vendor/Package.9.mjs";
import "../../lib/helpers/IsHtml.mjs";
import "../../lib/helpers/IsXML.mjs";
import "../../constants/DTOMetadataKey.mjs";
import "../../lib/helpers/ObjectConstructor.mjs";
import "../../lib/helpers/ObjectParentConstructors.mjs";
import "../../lib/helpers/ObjectParentConstructor.mjs";
import "../../lib/helpers/ObjectPrototype.mjs";
import "../../lib/ioc/InjectionMode.mjs";
import "../../lib/ioc/Lifetime.mjs";
import "../../lib/ioc/ListModules.mjs";
import "path";
import "stream";
import "fs";
import "../../lib/ioc/Utils.mjs";
import "../../lib/ioc/FunctionTokenizer.mjs";
import "../../lib/ioc/LoadModules.mjs";
import "../../lib/ioc/Resolvers.mjs";
import "../../lib/ioc/ParamParser.mjs";
import "../../lib/base/internal/ObjectLifetime.mjs";
import "../../exceptions/di/LifetimeLockedException.mjs";
import "../../lib/base/internal/ObjectWeakRefs.mjs";
import "../../lib/base/internal/ConfigurableRecordsInjection.mjs";
import "../../lib/base/internal/ObjectConfiguration.mjs";
import "../../lib/base/internal/ObjectInjection.mjs";
import "../../lib/base/internal/ObjectContainer.mjs";
import "../../decorators/dto/Expect.mjs";
import "../../decorators/dto/IndexSignature.mjs";
import "../../lib/helpers/IsEmptyObject.mjs";
import "../../lib/base/EventEmitter.mjs";
import "../../lib/core/Provider.mjs";
import "../../lib/base/internal/MethodValidation.mjs";
import "../../exceptions/dto/InvalidMethodAcceptException.mjs";
import "../../exceptions/dto/InvalidMethodReturnException.mjs";
import "./options/image/ImageTagOptions.mjs";
import "./options/image/ImageExportOptions.mjs";
import "stream/promises";
import "./exceptions/DockerImageRepoTagNotFoundException.mjs";
import "./options/image/ImageRemoveOptions.mjs";
import "./options/image/ImagePushOptions.mjs";
import "./exceptions/DockerImagePushException.mjs";
import "./lib/ParseRepositoryTag.mjs";
import "./lib/ParseEnvToRecord.mjs";
import "./options/container/ContainerStopOptions.mjs";
import "./options/container/ContainerRemoveOptions.mjs";
import "./options/container/ContainerKillOptions.mjs";
import "../../lib/helpers/UniqueArray.mjs";
import "./options/container/ContainerCommitOptions.mjs";
import "./options/container/ContainerCreateTTYOptions.mjs";
import "./options/container/ContainerTTYConsoleSizeOptions.mjs";
import "./options/container/ContainerLogsOptions.mjs";
import "./options/container/ContainerExecOptions.mjs";
import "./options/container/ContainerExportDirectoryOptions.mjs";
import "querystring";
import "https";
import "http";
import "net";
import "child_process";
import "../../../vendor/Package.15.mjs";
import "crypto";
import "../../../vendor/Package.18.mjs";
import "assert";
import "../../../vendor/Package.14.mjs";
import "buffer";
import "tls";
import "dns";
import "zlib";
import "../../../vendor/Package.62.mjs";
import "../../../vendor/Package.132.mjs";
import "module";
import "tty";
import "../../../vendor/Package.17.mjs";
import "worker_threads";
import "string_decoder";
import "../../../vendor/Package.20.mjs";
import "constants";
import "process";
import "http2";
import "../../decorators/di/Inject.mjs";
import "./types/ContainerCapability.mjs";
// -- Shims --
import cjsUrl from 'node:url';
import cjsPath from 'node:path';
import cjsModule from 'node:module';
const __filename = cjsUrl.fileURLToPath(import.meta.url);
const __dirname = cjsPath.dirname(__filename);
const require = cjsModule.createRequire(import.meta.url);
var V = {};
var B = class FixedFIFO {
constructor(e) {
if (!(e > 0) || (e - 1 & e) !== 0) throw new Error("Max size for a FixedFIFO should be a power of two");
this.buffer = new Array(e);
this.mask = e - 1;
this.top = 0;
this.btm = 0;
this.next = null;
}
clear() {
this.top = this.btm = 0;
this.next = null;
this.buffer.fill(undefined);
}
push(e) {
if (this.buffer[this.top] !== undefined) return false;
this.buffer[this.top] = e;
this.top = this.top + 1 & this.mask;
return true;
}
shift() {
const e = this.buffer[this.btm];
if (e === undefined) return undefined;
this.buffer[this.btm] = undefined;
this.btm = this.btm + 1 & this.mask;
return e;
}
peek() {
return this.buffer[this.btm];
}
isEmpty() {
return this.buffer[this.btm] === undefined;
}
};
const U = w(B);
const W = B;
var H = class FastFIFO {
constructor(e) {
this.hwm = e || 16;
this.head = new W(this.hwm);
this.tail = this.head;
this.length = 0;
}
clear() {
this.head = this.tail;
this.head.clear();
this.length = 0;
}
push(e) {
this.length++;
if (!this.head.push(e)) {
const t = this.head;
this.head = t.next = new W(2 * this.head.buffer.length);
this.head.push(e);
}
}
shift() {
if (this.length !== 0) this.length--;
const e = this.tail.shift();
if (e === undefined && this.tail.next) {
const e = this.tail.next;
this.tail.next = null;
this.tail = e;
return this.tail.shift();
}
return e;
}
peek() {
const e = this.tail.peek();
if (e === undefined && this.tail.next) return this.tail.next.peek();
return e;
}
isEmpty() {
return this.length === 0;
}
};
const z = w(H);
function K(e) {
return Buffer.isBuffer(e) || e instanceof Uint8Array;
}
function q(e) {
return Buffer.isEncoding(e);
}
function $(e, t, n) {
return Buffer.alloc(e, t, n);
}
function J(e) {
return Buffer.allocUnsafe(e);
}
function G(e) {
return Buffer.allocUnsafeSlow(e);
}
function X(e, t) {
return Buffer.byteLength(e, t);
}
function Y(e, t) {
return Buffer.compare(e, t);
}
function Z(e, t) {
return Buffer.concat(e, t);
}
function Q(e, t, n, r, i) {
return ce(e).copy(t, n, r, i);
}
function ee(e, t) {
return ce(e).equals(t);
}
function te(e, t, n, r, i) {
return ce(e).fill(t, n, r, i);
}
function ne(e, t, n) {
return Buffer.from(e, t, n);
}
function re(e, t, n, r) {
return ce(e).includes(t, n, r);
}
function ie(e, t, n, r) {
return ce(e).indexOf(t, n, r);
}
function se(e, t, n, r) {
return ce(e).lastIndexOf(t, n, r);
}
function ae(e) {
return ce(e).swap16();
}
function oe(e) {
return ce(e).swap32();
}
function ue(e) {
return ce(e).swap64();
}
function ce(e) {
if (Buffer.isBuffer(e)) return e;
return Buffer.from(e.buffer, e.byteOffset, e.byteLength);
}
function le(e, t, n, r) {
return ce(e).toString(t, n, r);
}
function fe(e, t, n, r, i) {
return ce(e).write(t, n, r, i);
}
function he(e, t, n) {
return ce(e).writeDoubleLE(t, n);
}
function de(e, t, n) {
return ce(e).writeFloatLE(t, n);
}
function ge(e, t, n) {
return ce(e).writeUInt32LE(t, n);
}
function pe(e, t, n) {
return ce(e).writeInt32LE(t, n);
}
function me(e, t) {
return ce(e).readDoubleLE(t);
}
function be(e, t) {
return ce(e).readFloatLE(t);
}
function _e(e, t) {
return ce(e).readUInt32LE(t);
}
function ve(e, t) {
return ce(e).readInt32LE(t);
}
function ye(e, t, n) {
return ce(e).writeDoubleBE(t, n);
}
function Ae(e, t, n) {
return ce(e).writeFloatBE(t, n);
}
function we(e, t, n) {
return ce(e).writeUInt32BE(t, n);
}
function ke(e, t, n) {
return ce(e).writeInt32BE(t, n);
}
function xe(e, t) {
return ce(e).readDoubleBE(t);
}
function Se(e, t) {
return ce(e).readFloatBE(t);
}
function Re(e, t) {
return ce(e).readUInt32BE(t);
}
function Ie(e, t) {
return ce(e).readInt32BE(t);
}
var Pe = {
isBuffer: K,
isEncoding: q,
alloc: $,
allocUnsafe: J,
allocUnsafeSlow: G,
byteLength: X,
compare: Y,
concat: Z,
copy: Q,
equals: ee,
fill: te,
from: ne,
includes: re,
indexOf: ie,
lastIndexOf: se,
swap16: ae,
swap32: oe,
swap64: ue,
toBuffer: ce,
toString: le,
write: fe,
writeDoubleLE: he,
writeFloatLE: de,
writeUInt32LE: ge,
writeInt32LE: pe,
readDoubleLE: me,
readFloatLE: be,
readUInt32LE: _e,
readInt32LE: ve,
writeDoubleBE: ye,
writeFloatBE: Ae,
writeUInt32BE: we,
writeInt32BE: ke,
readDoubleBE: xe,
readFloatBE: Se,
readUInt32BE: Re,
readInt32BE: Ie
};
const Ce = w(Pe);
const Oe = Pe;
var Ee = class PassThroughDecoder {
constructor(e) {
this.encoding = e;
}
get remaining() {
return 0;
}
decode(e) {
return Oe.toString(e, this.encoding);
}
flush() {
return "";
}
};
const je = w(Ee);
const Te = Pe;
var Le = class UTF8Decoder {
constructor() {
this.codePoint = 0;
this.bytesSeen = 0;
this.bytesNeeded = 0;
this.lowerBoundary = 128;
this.upperBoundary = 191;
}
get remaining() {
return this.bytesSeen;
}
decode(e) {
if (this.bytesNeeded === 0) {
let t = true;
for (let n = Math.max(0, e.byteLength - 4), r = e.byteLength; n < r && t; n++) {
t = e[n] <= 127;
}
if (t) return Te.toString(e, "utf8");
}
let t = "";
for (let n = 0, r = e.byteLength; n < r; n++) {
const r = e[n];
if (this.bytesNeeded === 0) {
if (r <= 127) {
t += String.fromCharCode(r);
} else {
this.bytesSeen = 1;
if (r >= 194 && r <= 223) {
this.bytesNeeded = 2;
this.codePoint = r & 31;
} else if (r >= 224 && r <= 239) {
if (r === 224) this.lowerBoundary = 160; else if (r === 237) this.upperBoundary = 159;
this.bytesNeeded = 3;
this.codePoint = r & 15;
} else if (r >= 240 && r <= 244) {
if (r === 240) this.lowerBoundary = 144;
if (r === 244) this.upperBoundary = 143;
this.bytesNeeded = 4;
this.codePoint = r & 7;
} else {
t += "�";
}
}
continue;
}
if (r < this.lowerBoundary || r > this.upperBoundary) {
this.codePoint = 0;
this.bytesNeeded = 0;
this.bytesSeen = 0;
this.lowerBoundary = 128;
this.upperBoundary = 191;
t += "�";
continue;
}
this.lowerBoundary = 128;
this.upperBoundary = 191;
this.codePoint = this.codePoint << 6 | r & 63;
this.bytesSeen++;
if (this.bytesSeen !== this.bytesNeeded) continue;
t += String.fromCodePoint(this.codePoint);
this.codePoint = 0;
this.bytesNeeded = 0;
this.bytesSeen = 0;
}
return t;
}
flush() {
const e = this.bytesNeeded > 0 ? "�" : "";
this.codePoint = 0;
this.bytesNeeded = 0;
this.bytesSeen = 0;
this.lowerBoundary = 128;
this.upperBoundary = 191;
return e;
}
};
const Ne = w(Le);
const De = Ee;
const Fe = Le;
var Me = class TextDecoder {
constructor(e = "utf8") {
this.encoding = Ve(e);
switch (this.encoding) {
case "utf8":
this.decoder = new Fe;
break;
case "utf16le":
case "base64":
throw new Error("Unsupported encoding: " + this.encoding);
default:
this.decoder = new De(this.encoding);
}
}
get remaining() {
return this.decoder.remaining;
}
push(e) {
if (typeof e === "string") return e;
return this.decoder.decode(e);
}
write(e) {
return this.push(e);
}
end(e) {
let t = "";
if (e) t = this.push(e);
t += this.decoder.flush();
return t;
}
};
function Ve(e) {
e = e.toLowerCase();
switch (e) {
case "utf8":
case "utf-8":
return "utf8";
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return "utf16le";
case "latin1":
case "binary":
return "latin1";
case "base64":
case "ascii":
case "hex":
return e;
default:
throw new Error("Unknown encoding: " + e);
}
}
const Be = w(Me);
const {EventEmitter: Ue} = S;
const We = new Error("Stream was destroyed");
const He = new Error("Premature close");
const ze = H;
const Ke = Me;
const qe = typeof queueMicrotask === "undefined" ? e => k.process.nextTick(e) : queueMicrotask;
const $e = (1 << 29) - 1;
const Je = 1;
const Ge = 2;
const Xe = 4;
const Ye = 8;
const Ze = $e ^ Je;
const Qe = $e ^ Ge;
const et = 1 << 4;
const tt = 2 << 4;
const nt = 4 << 4;
const rt = 8 << 4;
const it = 16 << 4;
const st = 32 << 4;
const at = 64 << 4;
const ot = 128 << 4;
const ut = 256 << 4;
const ct = 512 << 4;
const lt = 1024 << 4;
const ft = 2048 << 4;
const ht = 4096 << 4;
const dt = 8192 << 4;
const gt = it | st;
const pt = et | ht;
const mt = nt | et;
const bt = ut | rt;
const _t = it | dt;
const vt = $e ^ et;
const yt = $e ^ nt;
const At = $e ^ (nt | ht);
const wt = $e ^ ht;
const kt = $e ^ it;
const xt = $e ^ (rt | ct);
const St = $e ^ at;
const Rt = $e ^ gt;
const It = $e ^ ft;
const Pt = $e ^ tt;
const Ct = $e ^ dt;
const Ot = $e ^ _t;
const Et = 1 << 18;
const jt = 2 << 18;
const Tt = 4 << 18;
const Lt = 8 << 18;
const Nt = 16 << 18;
const Dt = 32 << 18;
const Ft = 64 << 18;
const Mt = 128 << 18;
const Vt = 256 << 18;
const Bt = 512 << 18;
const Ut = 1024 << 18;
const Wt = $e ^ (Et | Vt);
const Ht = $e ^ Tt;
const zt = $e ^ (Et | Bt);
const Kt = $e ^ Nt;
const qt = $e ^ Lt;
const $t = $e ^ Mt;
const Jt = $e ^ jt;
const Gt = $e ^ Ut;
const Xt = et | Et;
const Yt = $e ^ Xt;
const Zt = lt | Dt;
const Qt = Xe | Ye | Ge;
const en = Qt | Je;
const tn = Qt | Zt;
const nn = Ht & yt;
const rn = Mt | ft;
const sn = rn & Yt;
const an = en | sn;
const on = en | at | lt;
const un = en | lt | rt;
const cn = en | at | rt;
const ln = en | ut | rt | ct;
const fn = en | et | at | lt | ht | dt;
const hn = Qt | at | lt;
const dn = tt | en | ft | nt;
const gn = ft | Je;
const pn = en | Bt | Dt;
const mn = Lt | Nt;
const bn = Lt | Et;
const _n = Lt | Nt | en | Et;
const vn = en | Et | Lt | Ut;
const yn = Tt | Et;
const An = Et | Vt;
const wn = en | Bt | bn | Dt;
const kn = Nt | Qt | Bt | Dt;
const xn = jt | en | Mt | Tt;
const Sn = Bt | Dt | Qt;
const Rn = Symbol.asyncIterator || Symbol("asyncIterator");
class WritableState {
constructor(e, {highWaterMark: t = 16384, map: n = null, mapWritable: r, byteLength: i, byteLengthWritable: s} = {}) {
this.stream = e;
this.queue = new ze;
this.highWaterMark = t;
this.buffered = 0;
this.error = null;
this.pipeline = null;
this.drains = null;
this.byteLength = s || i || Zn;
this.map = r || n;
this.afterWrite = On.bind(this);
this.afterUpdateNextTick = Tn.bind(this);
}
get ended() {
return (this.stream._duplexState & Dt) !== 0;
}
push(e) {
if ((this.stream._duplexState & Sn) !== 0) return false;
if (this.map !== null) e = this.map(e);
this.buffered += this.byteLength(e);
this.queue.push(e);
if (this.buffered < this.highWaterMark) {
this.stream._duplexState |= Lt;
return true;
}
this.stream._duplexState |= mn;
return false;
}
shift() {
const e = this.queue.shift();
this.buffered -= this.byteLength(e);
if (this.buffered === 0) this.stream._duplexState &= qt;
return e;
}
end(e) {
if (typeof e === "function") this.stream.once("finish", e); else if (e !== undefined && e !== null) this.push(e);
this.stream._duplexState = (this.stream._duplexState | Bt) & Ht;
}
autoBatch(e, t) {
const n = [];
const r = this.stream;
n.push(e);
while ((r._duplexState & vn) === bn) {
n.push(r._writableState.shift());
}
if ((r._duplexState & en) !== 0) return t(null);
r._writev(n, t);
}
update() {
const e = this.stream;
e._duplexState |= jt;
do {
while ((e._duplexState & vn) === Lt) {
const t = this.shift();
e._duplexState |= An;
e._write(t, this.afterWrite);
}
if ((e._duplexState & yn) === 0) this.updateNonPrimary();
} while (this.continueUpdate() === true);
e._duplexState &= Jt;
}
updateNonPrimary() {
const e = this.stream;
if ((e._duplexState & wn) === Bt) {
e._duplexState = e._duplexState | Et;
e._final(Pn.bind(this));
return;
}
if ((e._duplexState & Qt) === Xe) {
if ((e._duplexState & rn) === 0) {
e._duplexState |= Xt;
e._destroy(Cn.bind(this));
}
return;
}
if ((e._duplexState & an) === Je) {
e._duplexState = (e._duplexState | Xt) & Ze;
e._open(Nn.bind(this));
}
}
continueUpdate() {
if ((this.stream._duplexState & Mt) === 0) return false;
this.stream._duplexState &= $t;
return true;
}
updateCallback() {
if ((this.stream._duplexState & xn) === Tt) this.update(); else this.updateNextTick();
}
updateNextTick() {
if ((this.stream._duplexState & Mt) !== 0) return;
this.stream._duplexState |= Mt;
if ((this.stream._duplexState & jt) === 0) qe(this.afterUpdateNextTick);
}
}
class ReadableState {
constructor(e, {highWaterMark: t = 16384, map: n = null, mapReadable: r, byteLength: i, byteLengthReadable: s} = {}) {
this.stream = e;
this.queue = new ze;
this.highWaterMark = t === 0 ? 1 : t;
this.buffered = 0;
this.readAhead = t > 0;
this.error = null;
this.pipeline = null;
this.byteLength = s || i || Zn;
this.map = r || n;
this.pipeTo = null;
this.afterRead = En.bind(this);
this.afterUpdateNextTick = jn.bind(this);
}
get ended() {
return (this.stream._duplexState & lt) !== 0;
}
pipe(e, t) {
if (this.pipeTo !== null) throw new Error("Can only pipe to one destination");
if (typeof t !== "function") t = null;
this.stream._duplexState |= st;
this.pipeTo = e;
this.pipeline = new Pipeline(this.stream, e, t);
if (t) this.stream.on("error", Qn);
if (Kn(e)) {
e._writableState.pipeline = this.pipeline;
if (t) e.on("error", Qn);
e.on("finish", this.pipeline.finished.bind(this.pipeline));
} else {
const t = this.pipeline.done.bind(this.pipeline, e);
const n = this.pipeline.done.bind(this.pipeline, e, null);
e.on("error", t);
e.on("close", n);
e.on("finish", this.pipeline.finished.bind(this.pipeline));
}
e.on("drain", In.bind(this));
this.stream.emit("piping", e);
e.emit("pipe", this.stream);
}
push(e) {
const t = this.stream;
if (e === null) {
this.highWaterMark = 0;
t._duplexState = (t._duplexState | at) & At;
return false;
}
if (this.map !== null) {
e = this.map(e);
if (e === null) {
t._duplexState &= wt;
return this.buffered < this.highWaterMark;
}
}
this.buffered += this.byteLength(e);
this.queue.push(e);
t._duplexState = (t._duplexState | rt) & wt;
return this.buffered < this.highWaterMark;
}
shift() {
const e = this.queue.shift();
this.buffered -= this.byteLength(e);
if (this.buffered === 0) this.stream._duplexState &= xt;
return e;
}
unshift(e) {
const t = [ this.map !== null ? this.map(e) : e ];
while (this.buffered > 0) t.push(this.shift());
for (let e = 0; e < t.length - 1; e++) {
const n = t[e];
this.buffered += this.byteLength(n);
this.queue.push(n);
}
this.push(t[t.length - 1]);
}
read() {
const e = this.stream;
if ((e._duplexState & un) === rt) {
const t = this.shift();
if (this.pipeTo !== null && this.pipeTo.write(t) === false) e._duplexState &= Rt;
if ((e._duplexState & ot) !== 0) e.emit("data", t);
return t;
}
if (this.readAhead === false) {
e._duplexState |= dt;
this.updateNextTick();
}
return null;
}
drain() {
const e = this.stream;
while ((e._duplexState & un) === rt && (e._duplexState & gt) !== 0) {
const t = this.shift();
if (this.pipeTo !== null && this.pipeTo.write(t) === false) e._duplexState &= Rt;
if ((e._duplexState & ot) !== 0) e.emit("data", t);
}
}
update() {
const e = this.stream;
e._duplexState |= tt;
do {
this.drain();
while (this.buffered < this.highWaterMark && (e._duplexState & fn) === dt) {
e._duplexState |= pt;
e._read(this.afterRead);
this.drain();
}
if ((e._duplexState & ln) === bt) {
e._duplexState |= ct;
e.emit("readable");
}
if ((e._duplexState & mt) === 0) this.updateNonPrimary();
} while (this.continueUpdate() === true);
e._duplexState &= Pt;
}
updateNonPrimary() {
const e = this.stream;
if ((e._duplexState & cn) === at) {
e._duplexState = (e._duplexState | lt) & St;
e.emit("end");
if ((e._duplexState & tn) === Zt) e._duplexState |= Xe;
if (this.pipeTo !== null) this.pipeTo.end();
}
if ((e._duplexState & Qt) === Xe) {
if ((e._duplexState & rn) === 0) {
e._duplexState |= Xt;
e._destroy(Cn.bind(this));
}
return;
}
if ((e._duplexState & an) === Je) {
e._duplexState = (e._duplexState | Xt) & Ze;
e._open(Nn.bind(this));
}
}
continueUpdate() {
if ((this.stream._duplexState & ft) === 0) return false;
this.stream._duplexState &= It;
return true;
}
updateCallback() {
if ((this.stream._duplexState & dn) === nt) this.update(); else this.updateNextTick();
}
updateNextTickIfOpen() {
if ((this.stream._duplexState & gn) !== 0) return;
this.stream._duplexState |= ft;
if ((this.stream._duplexState & tt) === 0) qe(this.afterUpdateNextTick);
}
updateNextTick() {
if ((this.stream._duplexState & ft) !== 0) return;
this.stream._duplexState |= ft;
if ((this.stream._duplexState & tt) === 0) qe(this.afterUpdateNextTick);
}
}
class TransformState {
constructor(e) {
this.data = null;
this.afterTransform = Dn.bind(e);
this.afterFinal = null;
}
}
class Pipeline {
constructor(e, t, n) {
this.from = e;
this.to = t;
this.afterPipe = n;
this.error = null;
this.pipeToFinished = false;
}
finished() {
this.pipeToFinished = true;
}
done(e, t) {
if (t) this.error = t;
if (e === this.to) {
this.to = null;
if (this.from !== null) {
if ((this.from._duplexState & lt) === 0 || !this.pipeToFinished) {
this.from.destroy(this.error || new Error("Writable stream closed prematurely"));
}
return;
}
}
if (e === this.from) {
this.from = null;
if (this.to !== null) {
if ((e._duplexState & lt) === 0) {
this.to.destroy(this.error || new Error("Readable stream closed before ending"));
}
return;
}
}
if (this.afterPipe !== null) this.afterPipe(this.error);
this.to = this.from = this.afterPipe = null;
}
}
function In() {
this.stream._duplexState |= st;
this.updateCallback();
}
function Pn(e) {
const t = this.stream;
if (e) t.destroy(e);
if ((t._duplexState & Qt) === 0) {
t._duplexState |= Dt;
t.emit("finish");
}
if ((t._duplexState & tn) === Zt) {
t._duplexState |= Xe;
}
t._duplexState &= zt;
if ((t._duplexState & jt) === 0) this.update(); else this.updateNextTick();
}
function Cn(e) {
const t = this.stream;
if (!e && this.error !== We) e = this.error;
if (e) t.emit("error", e);
t._duplexState |= Ye;
t.emit("close");
const n = t._readableState;
const r = t._writableState;
if (n !== null && n.pipeline !== null) n.pipeline.done(t, e);
if (r !== null) {
while (r.drains !== null && r.drains.length > 0) r.drains.shift().resolve(false);
if (r.pipeline !== null) r.pipeline.done(t, e);
}
}
function On(e) {
const t = this.stream;
if (e) t.destroy(e);
t._duplexState &= Wt;
if (this.drains !== null) Ln(this.drains);
if ((t._duplexState & _n) === Nt) {
t._duplexState &= Kt;
if ((t._duplexState & Ft) === Ft) {
t.emit("drain");
}
}
this.updateCallback();
}
function En(e) {
if (e) this.stream.destroy(e);
this.stream._duplexState &= vt;
if (this.readAhead === false && (this.stream._duplexState & it) === 0) this.stream._duplexState &= Ct;
this.updateCallback();
}
function jn() {
if ((this.stream._duplexState & tt) === 0) {
this.stream._duplexState &= It;
this.update();
}
}
function Tn() {
if ((this.stream._duplexState & jt) === 0) {
this.stream._duplexState &= $t;
this.update();
}
}
function Ln(e) {
for (let t = 0; t < e.length; t++) {
if (--e[t].writes === 0) {
e.shift().resolve(true);
t--;
}
}
}
function Nn(e) {
const t = this.stream;
if (e) t.destroy(e);
if ((t._duplexState & Xe) === 0) {
if ((t._duplexState & on) === 0) t._duplexState |= nt;
if ((t._duplexState & pn) === 0) t._duplexState |= Tt;
t.emit("open");
}
t._duplexState &= Yt;
if (t._writableState !== null) {
t._writableState.updateCallback();
}
if (t._readableState !== null) {
t._readableState.updateCallback();
}
}
function Dn(e, t) {
if (t !== undefined && t !== null) this.push(t);
this._writableState.afterWrite(e);
}
function Fn(e) {
if (this._readableState !== null) {
if (e === "data") {
this._duplexState |= ot | _t;
this._readableState.updateNextTick();
}
if (e === "readable") {
this._duplexState |= ut;
this._readableState.updateNextTick();
}
}
if (this._writableState !== null) {
if (e === "drain") {
this._duplexState |= Ft;
this._writableState.updateNextTick();
}
}
}
class Stream extends Ue {
constructor(e) {
super();
this._duplexState = 0;
this._readableState = null;
this._writableState = null;
if (e) {
if (e.open) this._open = e.open;
if (e.destroy) this._destroy = e.destroy;
if (e.predestroy) this._predestroy = e.predestroy;
if (e.signal) {
e.signal.addEventListener("abort", er.bind(this));
}
}
this.on("newListener", Fn);
}
_open(e) {
e(null);
}
_destroy(e) {
e(null);
}
_predestroy() {}
get readable() {
return this._readableState !== null ? true : undefined;
}
get writable() {
return this._writableState !== null ? true : undefined;
}
get destroyed() {
return (this._duplexState & Ye) !== 0;
}
get destroying() {
return (this._duplexState & Qt) !== 0;
}
destroy(e) {
if ((this._duplexState & Qt) === 0) {
if (!e) e = We;
this._duplexState = (this._duplexState | Xe) & nn;
if (this._readableState !== null) {
this._readableState.highWaterMark = 0;
this._readableState.error = e;
}
if (this._writableState !== null) {
this._writableState.highWaterMark = 0;
this._writableState.error = e;
}
this._duplexState |= Ge;
this._predestroy();
this._duplexState &= Qe;
if (this._readableState !== null) this._readableState.updateNextTick();
if (this._writableState !== null) this._writableState.updateNextTick();
}
}
}
let Mn = class Readable extends Stream {
constructor(e) {
super(e);
this._duplexState |= Je | Dt | dt;
this._readableState = new ReadableState(this, e);
if (e) {
if (this._readableState.readAhead === false) this._duplexState &= Ct;
if (e.read) this._read = e.read;
if (e.eagerOpen) this._readableState.updateNextTick();
if (e.encoding) this.setEncoding(e.encoding);
}
}
setEncoding(e) {
const t = new Ke(e);
const n = this._readableState.map || Hn;
this._readableState.map = r;
return this;
function r(e) {
const r = t.push(e);
return r === "" && (e.byteLength !== 0 || t.remaining > 0) ? null : n(r);
}
}
_read(e) {
e(null);
}
pipe(e, t) {
this._readableState.updateNextTick();
this._readableState.pipe(e, t);
return e;
}
read() {
this._readableState.updateNextTick();
return this._readableState.read();
}
push(e) {
this._readableState.updateNextTickIfOpen();
return this._readableState.push(e);
}
unshift(e) {
this._readableState.updateNextTickIfOpen();
return this._readableState.unshift(e);
}
resume() {
this._duplexState |= _t;
this._readableState.updateNextTick();
return this;
}
pause() {
this._duplexState &= this._readableState.readAhead === false ? Ot : kt;
return this;
}
static _fromAsyncIterator(e, t) {
let n;
const r = new Readable({
...t,
read(t) {
e.next().then(i).then(t.bind(null, null)).catch(t);
},
predestroy() {
n = e.return();
},
destroy(e) {
if (!n) return e(null);
n.then(e.bind(null, null)).catch(e);
}
});
return r;
function i(e) {
if (e.done) r.push(null); else r.push(e.value);
}
}
static from(e, t) {
if (Gn(e)) return e;
if (e[Rn]) return this._fromAsyncIterator(e[Rn](), t);
if (!Array.isArray(e)) e = e === undefined ? [] : [ e ];
let n = 0;
return new Readable({
...t,
read(t) {
this.push(n === e.length ? null : e[n++]);
t(null);
}
});
}
static isBackpressured(e) {
return (e._duplexState & hn) !== 0 || e._readableState.buffered >= e._readableState.highWaterMark;
}
static isPaused(e) {
return (e._duplexState & it) === 0;
}
[Rn]() {
const e = this;
let t = null;
let n = null;
let r = null;
this.on("error", (e => {
t = e;
}));
this.on("readable", i);
this.on("close", s);
return {
[Rn]() {
return this;
},
next() {
return new Promise((function(t, i) {
n = t;
r = i;
const s = e.read();
if (s !== null) a(s); else if ((e._duplexState & Ye) !== 0) a(null);
}));
},
return() {
return o(null);
},
throw(e) {
return o(e);
}
};
function i() {
if (n !== null) a(e.read());
}
function s() {
if (n !== null) a(null);
}
function a(i) {
if (r === null) return;
if (t) r(t); else if (i === null && (e._duplexState & lt) === 0) r(We); else n({
value: i,
done: i === null
});
r = n = null;
}
function o(t) {
e.destroy(t);
return new Promise(((n, r) => {
if (e._duplexState & Ye) return n({
value: undefined,
done: true
});
e.once("close", (function() {
if (t) r(t); else n({
value: undefined,
done: true
});
}));
}));
}
}
};
let Vn = class Writable extends Stream {
constructor(e) {
super(e);
this._duplexState |= Je | lt;
this._writableState = new WritableState(this, e);
if (e) {
if (e.writev) this._writev = e.writev;
if (e.write) this._write = e.write;
if (e.final) this._final = e.final;
if (e.eagerOpen) this._writableState.updateNextTick();
}
}
cork() {
this._duplexState |= Ut;
}
uncork() {
this._duplexState &= Gt;
this._writableState.updateNextTick();
}
_writev(e, t) {
t(null);
}
_write(e, t) {
this._writableState.autoBatch(e, t);
}
_final(e) {
e(null);
}
static isBackpressured(e) {
return (e._duplexState & kn) !== 0;
}
static drained(e) {
if (e.destroyed) return Promise.resolve(false);
const t = e._writableState;
const n = tr(e) ? Math.min(1, t.queue.length) : t.queue.length;
const r = n + (e._duplexState & Vt ? 1 : 0);
if (r === 0) return Promise.resolve(true);
if (t.drains === null) t.drains = [];
return new Promise((e => {
t.drains.push({
writes: r,
resolve: e
});
}));
}
write(e) {
this._writableState.updateNextTick();
return this._writableState.push(e);
}
end(e) {
this._writableState.updateNextTick();
this._writableState.end(e);
return this;
}
};
class Duplex extends Mn {
constructor(e) {
super(e);
this._duplexState = Je | this._duplexState & dt;
this._writableState = new WritableState(this, e);
if (e) {
if (e.writev) this._writev = e.writev;
if (e.write) this._write = e.write;
if (e.final) this._final = e.final;
}
}
cork() {
this._duplexState |= Ut;
}
uncork() {
this._duplexState &= Gt;
this._writableState.updateNextTick();
}
_writev(e, t) {
t(null);
}
_write(e, t) {
this._writableState.autoBatch(e, t);
}
_final(e) {
e(null);
}
write(e) {
this._writableState.updateNextTick();
return this._writableState.push(e);
}
end(e) {
this._writableState.updateNextTick();
this._writableState.end(e);
return this;
}
}
class Transform extends Duplex {
constructor(e) {
super(e);
this._transformState = new TransformState(this);
if (e) {
if (e.transform) this._transform = e.transform;
if (e.flush) this._flush = e.flush;
}
}
_write(e, t) {
if (this._readableState.buffered >= this._readableState.highWaterMark) {
this._transformState.data = e;
} else {
this._transform(e, this._transformState.afterTransform);
}
}
_read(e) {
if (this._transformState.data !== null) {
const t = this._transformState.data;
this._transformState.data = null;
e(null);
this._transform(t, this._transformState.afterTransform);
} else {
e(null);
}
}
destroy(e) {
super.destroy(e);
if (this._transformState.data !== null) {
this._transformState.data = null;
this._transformState.afterTransform();
}
}
_transform(e, t) {
t(null, e);
}
_flush(e) {
e(null);
}
_final(e) {
this._transformState.afterFinal = e;
this._flush(Bn.bind(this));
}
}
class PassThrough extends Transform {}
function Bn(e, t) {
const n = this._transformState.afterFinal;
if (e) return n(e);
if (t !== null && t !== undefined) this.push(t);
this.push(null);
n(null);
}
function Un(...e) {
return new Promise(((t, n) => Wn(...e, (e => {
if (e) return n(e);
t();
}))));
}
function Wn(e, ...t) {
const n = Array.isArray(e) ? [ ...e, ...t ] : [ e, ...t ];
const r = n.length && typeof n[n.length - 1] === "function" ? n.pop() : null;
if (n.length < 2) throw new Error("Pipeline requires at least 2 streams");
let i = n[0];
let s = null;
let a = null;
for (let e = 1; e < n.length; e++) {
s = n[e];
if (Kn(i)) {
i.pipe(s, u);
} else {
o(i, true, e > 1, u);
i.pipe(s);
}
i = s;
}
if (r) {
let e = false;
const t = Kn(s) || !!(s._writableState && s._writableState.autoDestroy);
s.on("error", (e => {
if (a === null) a = e;
}));
s.on("finish", (() => {
e = true;
if (!t) r(a);
}));
if (t) {
s.on("close", (() => r(a || (e ? null : He))));
}
}
return s;
function o(e, t, n, r) {
e.on("error", r);
e.on("close", i);
function i() {
if (t && e._readableState && !e._readableState.ended) return r(He);
if (n && e._writableState && !e._writableState.ended) return r(He);
}
}
function u(e) {
if (!e || a) return;
a = e;
for (const t of n) {
t.destroy(e);
}
}
}
function Hn(e) {
return e;
}
function zn(e) {
return !!e._readableState || !!e._writableState;
}
function Kn(e) {
return typeof e._duplexState === "number" && zn(e);
}
function qn(e) {
return !!e._readableState && e._readableState.ended;
}
function $n(e) {
return !!e._writableState && e._writableState.ended;
}
function Jn(e, t = {}) {
const n = e._readableState && e._readableState.error || e._writableState && e._writableState.error;
return !t.all && n === We ? null : n;
}
function Gn(e) {
return Kn(e) && e.readable;
}
function Xn(e) {
return (e._duplexState & Je) !== Je || (e._duplexState & rn) !== 0;
}
function Yn(e) {
return typeof e === "object" && e !== null && typeof e.byteLength === "number";
}
function Zn(e) {
return Yn(e) ? e.byteLength : 1024;
}
function Qn() {}
function er() {
this.destroy(new Error("Stream aborted."));
}
function tr(e) {
return e._writev !== Vn.prototype._writev && e._writev !== Duplex.prototype._writev;
}
var nr = {
pipeline: Wn,
pipelinePromise: Un,
isStream: zn,
isStreamx: Kn,
isEnded: qn,
isFinished: $n,
isDisturbed: Xn,
getStreamError: Jn,
Stream: Stream,
Writable: Vn,
Readable: Mn,
Duplex: Duplex,
Transform: Transform,
PassThrough: PassThrough
};
const rr = w(nr);
var ir = {};
const sr = Pe;
const ar = "0000000000000000000";
const or = "7777777777777777777";
const ur = "0".charCodeAt(0);
const cr = sr.from([ 117, 115, 116, 97, 114, 0 ]);
const lr = sr.from([ ur, ur ]);
const fr = sr.from([ 117, 115, 116, 97, 114, 32 ]);
const hr = sr.from([ 32, 0 ]);
const dr = 4095;
const gr = 257;
const pr = 263;
var mr = ir.decodeLongPath = function e(t, n) {
return Tr(t, 0, t.length, n);
};
var br = ir.encodePax = function e(t) {
let n = "";
if (t.name) n += Lr(" path=" + t.name + "\n");
if (t.linkname) n += Lr(" linkpath=" + t.linkname + "\n");
const r = t.pax;
if (r) {
for (const e in r) {
n += Lr(" " + e + "=" + r[e] + "\n");
}
}
return sr.from(n);
};
var _r = ir.decodePax = function e(t) {
const n = {};
while (t.length) {
let e = 0;
while (e < t.length && t[e] !== 32) e++;
const r = parseInt(sr.toString(t.subarray(0, e)), 10);
if (!r) return n;
const i = sr.toString(t.subarray(e + 1, r - 1));
const s = i.indexOf("=");
if (s === -1) return n;
n[i.slice(0, s)] = i.slice(s + 1);
t = t.subarray(r);
}
return n;
};
var vr = ir.encode = function e(t) {
const n = sr.alloc(512);
let r = t.name;
let i = "";
if (t.typeflag === 5 && r[r.length - 1] !== "/") r += "/";
if (sr.byteLength(r) !== r.length) return null;
while (sr.byteLength(r) > 100) {
const e = r.indexOf("/");
if (e === -1) return null;
i += i ? "/" + r.slice(0, e) : r.slice(0, e);
r = r.slice(e + 1);
}
if (sr.byteLength(r) > 100 || sr.byteLength(i) > 155) return null;
if (t.linkname && sr.byteLength(t.linkname) > 100) return null;
sr.write(n, r);
sr.write(n, Pr(t.mode & dr, 6), 100);
sr.write(n, Pr(t.uid, 6), 108);
sr.write(n, Pr(t.gid, 6), 116);
Or(t.size, n, 124);
sr.write(n, Pr(t.mtime.getTime() / 1e3 | 0, 11), 136);
n[156] = ur + Sr(t.type);
if (t.linkname) sr.write(n, t.linkname, 157);
sr.copy(cr, n, gr);
sr.copy(lr, n, pr);
if (t.uname) sr.write(n, t.uname, 265);
if (t.gname) sr.write(n, t.gname, 297);
sr.write(n, Pr(t.devmajor || 0, 6), 329);
sr.write(n, Pr(t.devminor || 0, 6), 337);
if (i) sr.write(n, i, 345);
sr.write(n, Pr(Ir(n), 6), 148);
return n;
};
var yr = ir.decode = function e(t, n, r) {
let i = t[156] === 0 ? 0 : t[156] - ur;
let s = Tr(t, 0, 100, n);
const a = jr(t, 100, 8);
const o = jr(t, 108, 8);
const u = jr(t, 116, 8);
const c = jr(t, 124, 12);
const l = jr(t, 136, 12);
const f = xr(i);
const h = t[157] === 0 ? null : Tr(t, 157, 100, n);
const d = Tr(t, 265, 32);
const g = Tr(t, 297, 32);
const p = jr(t, 329, 8);
const m = jr(t, 337, 8);
const b = Ir(t);
if (b === 8 * 32) return null;
if (b !== jr(t, 148, 8)) throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");
if (Ar(t)) {
if (t[345]) s = Tr(t, 345, 155, n) + "/" + s;
} else if (wr(t)) {} else {
if (!r) {
throw new Error("Invalid tar header: unknown format.");
}
}
if (i === 0 && s && s[s.length - 1] === "/") i = 5;
return {
name: s,
mode: a,
uid: o,
gid: u,
size: c,
mtime: new Date(1e3 * l),
type: f,
linkname: h,
uname: d,
gname: g,
devmajor: p,
devminor: m,
pax: null
};
};
function Ar(e) {
return sr.equals(cr, e.subarray(gr, gr + 6));
}
function wr(e) {
return sr.equals(fr, e.subarray(gr, gr + 6)) && sr.equals(hr, e.subarray(pr, pr + 2));
}
function kr(e, t, n) {
if (typeof e !== "number") return n;
e = ~~e;
if (e >= t) return t;
if (e >= 0) return e;
e += t;
if (e >= 0) return e;
return 0;
}
function xr(e) {
switch (e) {
case 0:
return "file";
case 1:
return "link";
case 2:
return "symlink";
case 3:
return "character-device";
case 4:
return "block-device";
case 5:
return "directory";
case 6:
return "fifo";
case 7:
return "contiguous-file";
case 72:
return "pax-header";
case 55:
return "pax-global-header";
case 27:
return "gnu-long-link-path";
case 28:
case 30:
return "gnu-long-path";
}
return null;
}
function Sr(e) {
switch (e) {
case "file":
return 0;
case "link":
return 1;
case "symlink":
return 2;
case "character-device":
return 3;
case "block-device":
return 4;
case "directory":
return 5;
case "fifo":
return 6;
case "contiguous-file":
return 7;
case "pax-header":
return 72;
}
return 0;
}
function Rr(e, t, n, r) {
for (;n < r; n++) {
if (e[n] === t) return n;
}
return r;
}
function Ir(e) {
let t = 8 * 32;
for (let n = 0; n < 148; n++) t += e[n];
for (let n = 156; n < 512; n++) t += e[n];
return t;
}
function Pr(e, t) {
e = e.toString(8);
if (e.length > t) return or.slice(0, t) + " ";
return ar.slice(0, t - e.length) + e + " ";
}
function Cr(e, t, n) {
t[n] = 128;
for (let r = 11; r > 0; r--) {
t[n + r] = e & 255;
e = Math.floor(e / 256);
}
}
function Or(e, t, n) {
if (e.toString(8).length > 11)