UNPKG

@modern-js/utils

Version:

A Progressive React Framework for modern web development.

1,204 lines 165 kB
/*! LICENSE: index.js.LICENSE.txt */ (()=>{ var e = { 695: (e, t, r)=>{ "use strict"; const { Buffer: i } = r(300); const n = Symbol.for("BufferList"); function BufferList(e) { if (!(this instanceof BufferList)) return new BufferList(e); BufferList._init.call(this, e); } BufferList._init = function(e) { Object.defineProperty(this, n, { value: true }); this._bufs = []; this.length = 0; if (e) this.append(e); }; BufferList.prototype._new = function(e) { return new BufferList(e); }; BufferList.prototype._offset = function(e) { if (0 === e) return [ 0, 0 ]; let t = 0; for(let r = 0; r < this._bufs.length; r++){ const i = t + this._bufs[r].length; if (e < i || r === this._bufs.length - 1) return [ r, e - t ]; t = i; } }; BufferList.prototype._reverseOffset = function(e) { const t = e[0]; let r = e[1]; for(let e = 0; e < t; e++)r += this._bufs[e].length; return r; }; BufferList.prototype.get = function(e) { if (e > this.length || e < 0) return; const t = this._offset(e); return this._bufs[t[0]][t[1]]; }; BufferList.prototype.slice = function(e, t) { if ("number" == typeof e && e < 0) e += this.length; if ("number" == typeof t && t < 0) t += this.length; return this.copy(null, 0, e, t); }; BufferList.prototype.copy = function(e, t, r, n) { if ("number" != typeof r || r < 0) r = 0; if ("number" != typeof n || n > this.length) n = this.length; if (r >= this.length) return e || i.alloc(0); if (n <= 0) return e || i.alloc(0); const copy = !!e; const s = this._offset(r); const a = n - r; let o = a; let f = copy && t || 0; let l = s[1]; if (0 === r && n === this.length) { if (!copy) return 1 === this._bufs.length ? this._bufs[0] : i.concat(this._bufs, this.length); for(let t = 0; t < this._bufs.length; t++){ this._bufs[t].copy(e, f); f += this._bufs[t].length; } return e; } if (o <= this._bufs[s[0]].length - l) return copy ? this._bufs[s[0]].copy(e, t, l, l + o) : this._bufs[s[0]].slice(l, l + o); if (!copy) e = i.allocUnsafe(a); for(let t = s[0]; t < this._bufs.length; t++){ const r = this._bufs[t].length - l; if (o > r) { this._bufs[t].copy(e, f, l); f += r; } else { this._bufs[t].copy(e, f, l, l + o); f += r; break; } o -= r; if (l) l = 0; } if (e.length > f) return e.slice(0, f); return e; }; BufferList.prototype.shallowSlice = function(e, t) { e = e || 0; t = "number" != typeof t ? this.length : t; if (e < 0) e += this.length; if (t < 0) t += this.length; if (e === t) return this._new(); const r = this._offset(e); const i = this._offset(t); const n = this._bufs.slice(r[0], i[0] + 1); if (0 === i[1]) n.pop(); else n[n.length - 1] = n[n.length - 1].slice(0, i[1]); if (0 !== r[1]) n[0] = n[0].slice(r[1]); return this._new(n); }; BufferList.prototype.toString = function(e, t, r) { return this.slice(t, r).toString(e); }; BufferList.prototype.consume = function(e) { e = Math.trunc(e); if (Number.isNaN(e) || e <= 0) return this; while(this._bufs.length)if (e >= this._bufs[0].length) { e -= this._bufs[0].length; this.length -= this._bufs[0].length; this._bufs.shift(); } else { this._bufs[0] = this._bufs[0].slice(e); this.length -= e; break; } return this; }; BufferList.prototype.duplicate = function() { const e = this._new(); for(let t = 0; t < this._bufs.length; t++)e.append(this._bufs[t]); return e; }; BufferList.prototype.append = function(e) { if (null == e) return this; if (e.buffer) this._appendBuffer(i.from(e.buffer, e.byteOffset, e.byteLength)); else if (Array.isArray(e)) for(let t = 0; t < e.length; t++)this.append(e[t]); else if (this._isBufferList(e)) for(let t = 0; t < e._bufs.length; t++)this.append(e._bufs[t]); else { if ("number" == typeof e) e = e.toString(); this._appendBuffer(i.from(e)); } return this; }; BufferList.prototype._appendBuffer = function(e) { this._bufs.push(e); this.length += e.length; }; BufferList.prototype.indexOf = function(e, t, r) { if (void 0 === r && "string" == typeof t) { r = t; t = void 0; } if ("function" == typeof e || Array.isArray(e)) throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.'); if ("number" == typeof e) e = i.from([ e ]); else if ("string" == typeof e) e = i.from(e, r); else if (this._isBufferList(e)) e = e.slice(); else if (Array.isArray(e.buffer)) e = i.from(e.buffer, e.byteOffset, e.byteLength); else if (!i.isBuffer(e)) e = i.from(e); t = Number(t || 0); if (isNaN(t)) t = 0; if (t < 0) t = this.length + t; if (t < 0) t = 0; if (0 === e.length) return t > this.length ? this.length : t; const n = this._offset(t); let s = n[0]; let a = n[1]; for(; s < this._bufs.length; s++){ const t = this._bufs[s]; while(a < t.length){ const r = t.length - a; if (r >= e.length) { const r = t.indexOf(e, a); if (-1 !== r) return this._reverseOffset([ s, r ]); a = t.length - e.length + 1; } else { const t = this._reverseOffset([ s, a ]); if (this._match(t, e)) return t; a++; } } a = 0; } return -1; }; BufferList.prototype._match = function(e, t) { if (this.length - e < t.length) return false; for(let r = 0; r < t.length; r++)if (this.get(e + r) !== t[r]) return false; return true; }; (function() { const e = { readDoubleBE: 8, readDoubleLE: 8, readFloatBE: 4, readFloatLE: 4, readInt32BE: 4, readInt32LE: 4, readUInt32BE: 4, readUInt32LE: 4, readInt16BE: 2, readInt16LE: 2, readUInt16BE: 2, readUInt16LE: 2, readInt8: 1, readUInt8: 1, readIntBE: null, readIntLE: null, readUIntBE: null, readUIntLE: null }; for(const t in e)(function(t) { if (null === e[t]) BufferList.prototype[t] = function(e, r) { return this.slice(e, e + r)[t](0, r); }; else BufferList.prototype[t] = function(r = 0) { return this.slice(r, r + e[t])[t](0); }; })(t); })(); BufferList.prototype._isBufferList = function(e) { return e instanceof BufferList || BufferList.isBufferList(e); }; BufferList.isBufferList = function(e) { return null != e && e[n]; }; e.exports = BufferList; }, 49: (e, t, r)=>{ "use strict"; const i = r(505).Duplex; const n = r(315); const s = r(695); function BufferListStream(e) { if (!(this instanceof BufferListStream)) return new BufferListStream(e); if ("function" == typeof e) { this._callback = e; const t = (function(e) { if (this._callback) { this._callback(e); this._callback = null; } }).bind(this); this.on("pipe", function(e) { e.on("error", t); }); this.on("unpipe", function(e) { e.removeListener("error", t); }); e = null; } s._init.call(this, e); i.call(this); } n(BufferListStream, i); Object.assign(BufferListStream.prototype, s.prototype); BufferListStream.prototype._new = function(e) { return new BufferListStream(e); }; BufferListStream.prototype._write = function(e, t, r) { this._appendBuffer(e); if ("function" == typeof r) r(); }; BufferListStream.prototype._read = function(e) { if (!this.length) return this.push(null); e = Math.min(e, this.length); this.push(this.slice(0, e)); this.consume(e); }; BufferListStream.prototype.end = function(e) { i.prototype.end.call(this, e); if (this._callback) { this._callback(null, this.slice()); this._callback = null; } }; BufferListStream.prototype._destroy = function(e, t) { this._bufs.length = 0; this.length = 0; t(e); }; BufferListStream.prototype._isBufferList = function(e) { return e instanceof BufferListStream || e instanceof s || BufferListStream.isBufferList(e); }; BufferListStream.isBufferList = s.isBufferList; e.exports = BufferListStream; e.exports.BufferListStream = BufferListStream; e.exports.BufferList = s; }, 805: (e, t, r)=>{ "use strict"; const i = r(598); let n = false; t.show = (e = process.stderr)=>{ if (!e.isTTY) return; n = false; e.write("[?25h"); }; t.hide = (e = process.stderr)=>{ if (!e.isTTY) return; i(); n = true; e.write("[?25l"); }; t.toggle = (e, r)=>{ if (void 0 !== e) n = e; if (n) t.show(r); else t.hide(r); }; }, 414: (e, t, r)=>{ "use strict"; const i = Object.assign({}, r(32)); const n = Object.keys(i); Object.defineProperty(i, "random", { get () { const e = Math.floor(Math.random() * n.length); const t = n[e]; return i[t]; } }); e.exports = i; }, 332: (e)=>{ var t = function() { "use strict"; function clone(e, t, r, i) { if ("object" == typeof t) { r = t.depth; i = t.prototype; t.filter; t = t.circular; } var s = []; var a = []; var o = "u" > typeof Buffer; if (void 0 === t) t = true; if (void 0 === r) r = 1 / 0; function _clone(e, r) { if (null === e) return null; if (0 == r) return e; var n; var f; if ("object" != typeof e) return e; if (clone.__isArray(e)) n = []; else if (clone.__isRegExp(e)) { n = new RegExp(e.source, __getRegExpFlags(e)); if (e.lastIndex) n.lastIndex = e.lastIndex; } else if (clone.__isDate(e)) n = new Date(e.getTime()); else if (o && Buffer.isBuffer(e)) { n = Buffer.allocUnsafe ? Buffer.allocUnsafe(e.length) : new Buffer(e.length); e.copy(n); return n; } else if (void 0 === i) { f = Object.getPrototypeOf(e); n = Object.create(f); } else { n = Object.create(i); f = i; } if (t) { var l = s.indexOf(e); if (-1 != l) return a[l]; s.push(e); a.push(n); } for(var u in e){ var h; if (f) h = Object.getOwnPropertyDescriptor(f, u); if (!h || null != h.set) n[u] = _clone(e[u], r - 1); } return n; } return _clone(e, r); } clone.clonePrototype = function(e) { if (null === e) return null; var c = function() {}; c.prototype = e; return new c; }; function __objToStr(e) { return Object.prototype.toString.call(e); } clone.__objToStr = __objToStr; function __isDate(e) { return "object" == typeof e && "[object Date]" === __objToStr(e); } clone.__isDate = __isDate; function __isArray(e) { return "object" == typeof e && "[object Array]" === __objToStr(e); } clone.__isArray = __isArray; function __isRegExp(e) { return "object" == typeof e && "[object RegExp]" === __objToStr(e); } clone.__isRegExp = __isRegExp; function __getRegExpFlags(e) { var t = ""; if (e.global) t += "g"; if (e.ignoreCase) t += "i"; if (e.multiline) t += "m"; return t; } clone.__getRegExpFlags = __getRegExpFlags; return clone; }(); if (e.exports) e.exports = t; }, 906: (e, t, r)=>{ var i = r(332); e.exports = function(e, t) { e = e || {}; Object.keys(t).forEach(function(r) { if (void 0 === e[r]) e[r] = i(t[r]); }); return e; }; }, 315: (e, t, r)=>{ try { var i = r(837); if ("function" != typeof i.inherits) throw ""; e.exports = i.inherits; } catch (t) { e.exports = r(494); } }, 494: (e)=>{ if ("function" == typeof Object.create) e.exports = function(e, t) { if (t) { e.super_ = t; e.prototype = Object.create(t.prototype, { constructor: { value: e, enumerable: false, writable: true, configurable: true } }); } }; else e.exports = function(e, t) { if (t) { e.super_ = t; var TempCtor = function() {}; TempCtor.prototype = t.prototype; e.prototype = new TempCtor; e.prototype.constructor = e; } }; }, 520: (e)=>{ "use strict"; e.exports = ({ stream: e = process.stdout } = {})=>Boolean(e && e.isTTY && "dumb" !== process.env.TERM && !("CI" in process.env)); }, 457: (e)=>{ "use strict"; e.exports = ()=>{ if ("win32" !== process.platform) return true; return Boolean(process.env.CI) || Boolean(process.env.WT_SESSION) || "vscode" === process.env.TERM_PROGRAM || "xterm-256color" === process.env.TERM || "alacritty" === process.env.TERM; }; }, 59: (e, t, r)=>{ "use strict"; const i = r(234); const n = r(457); const s = { info: i.blue("ℹ"), success: i.green("✔"), warning: i.yellow("⚠"), error: i.red("✖") }; const a = { info: i.blue("i"), success: i.green("√"), warning: i.yellow("‼"), error: i.red("×") }; e.exports = n() ? s : a; }, 693: (e)=>{ "use strict"; const mimicFn = (e, t)=>{ for (const r of Reflect.ownKeys(t))Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); return e; }; e.exports = mimicFn; e.exports["default"] = mimicFn; }, 591: (e, t, r)=>{ "use strict"; const i = r(693); const n = new WeakMap; const onetime = (e, t = {})=>{ if ("function" != typeof e) throw new TypeError("Expected a function"); let r; let s = 0; const a = e.displayName || e.name || "<anonymous>"; const onetime = function(...i) { n.set(onetime, ++s); if (1 === s) { r = e.apply(this, i); e = null; } else if (true === t.throw) throw new Error(`Function \`${a}\` can only be called once`); return r; }; i(onetime, e); n.set(onetime, s); return onetime; }; e.exports = onetime; e.exports["default"] = onetime; e.exports.callCount = (e)=>{ if (!n.has(e)) throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`); return n.get(e); }; }, 942: (e, t, r)=>{ "use strict"; const i = r(521); const n = r(234); const s = r(805); const a = r(414); const o = r(59); const f = r(286); const l = r(74); const u = r(520); const h = r(457); const { BufferListStream: d } = r(49); const p = Symbol("text"); const _ = Symbol("prefixText"); const b = 3; class StdinDiscarder { constructor(){ this.requests = 0; this.mutedStream = new d; this.mutedStream.pipe(process.stdout); const e = this; this.ourEmit = function(t, r, ...i) { const { stdin: n } = process; if (e.requests > 0 || n.emit === e.ourEmit) { if ("keypress" === t) return; if ("data" === t && r.includes(b)) process.emit("SIGINT"); Reflect.apply(e.oldEmit, this, [ t, r, ...i ]); } else Reflect.apply(process.stdin.emit, this, [ t, r, ...i ]); }; } start() { this.requests++; if (1 === this.requests) this.realStart(); } stop() { if (this.requests <= 0) throw new Error("`stop` called more times than `start`"); this.requests--; if (0 === this.requests) this.realStop(); } realStart() { if ("win32" === process.platform) return; this.rl = i.createInterface({ input: process.stdin, output: this.mutedStream }); this.rl.on("SIGINT", ()=>{ if (0 === process.listenerCount("SIGINT")) process.emit("SIGINT"); else { this.rl.close(); process.kill(process.pid, "SIGINT"); } }); } realStop() { if ("win32" === process.platform) return; this.rl.close(); this.rl = void 0; } } let g; class Ora { constructor(e){ if (!g) g = new StdinDiscarder; if ("string" == typeof e) e = { text: e }; this.options = { text: "", color: "cyan", stream: process.stderr, discardStdin: true, ...e }; this.spinner = this.options.spinner; this.color = this.options.color; this.hideCursor = false !== this.options.hideCursor; this.interval = this.options.interval || this.spinner.interval || 100; this.stream = this.options.stream; this.id = void 0; this.isEnabled = "boolean" == typeof this.options.isEnabled ? this.options.isEnabled : u({ stream: this.stream }); this.isSilent = "boolean" == typeof this.options.isSilent ? this.options.isSilent : false; this.text = this.options.text; this.prefixText = this.options.prefixText; this.linesToClear = 0; this.indent = this.options.indent; this.discardStdin = this.options.discardStdin; this.isDiscardingStdin = false; } get indent() { return this._indent; } set indent(e = 0) { if (!(e >= 0 && Number.isInteger(e))) throw new Error("The `indent` option must be an integer from 0 and up"); this._indent = e; } _updateInterval(e) { if (void 0 !== e) this.interval = e; } get spinner() { return this._spinner; } set spinner(e) { this.frameIndex = 0; if ("object" == typeof e) { if (void 0 === e.frames) throw new Error("The given spinner must have a `frames` property"); this._spinner = e; } else if (h()) if (void 0 === e) this._spinner = a.dots; else if ("default" !== e && a[e]) this._spinner = a[e]; else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`); else this._spinner = a.line; this._updateInterval(this._spinner.interval); } get text() { return this[p]; } set text(e) { this[p] = e; this.updateLineCount(); } get prefixText() { return this[_]; } set prefixText(e) { this[_] = e; this.updateLineCount(); } get isSpinning() { return void 0 !== this.id; } getFullPrefixText(e = this[_], t = " ") { if ("string" == typeof e) return e + t; if ("function" == typeof e) return e() + t; return ""; } updateLineCount() { const e = this.stream.columns || 80; const t = this.getFullPrefixText(this.prefixText, "-"); this.lineCount = 0; for (const r of f(t + "--" + this[p]).split("\n"))this.lineCount += Math.max(1, Math.ceil(l(r) / e)); } get isEnabled() { return this._isEnabled && !this.isSilent; } set isEnabled(e) { if ("boolean" != typeof e) throw new TypeError("The `isEnabled` option must be a boolean"); this._isEnabled = e; } get isSilent() { return this._isSilent; } set isSilent(e) { if ("boolean" != typeof e) throw new TypeError("The `isSilent` option must be a boolean"); this._isSilent = e; } frame() { const { frames: e } = this.spinner; let t = e[this.frameIndex]; if (this.color) t = n[this.color](t); this.frameIndex = ++this.frameIndex % e.length; const r = "string" == typeof this.prefixText && "" !== this.prefixText ? this.prefixText + " " : ""; const i = "string" == typeof this.text ? " " + this.text : ""; return r + t + i; } clear() { if (!this.isEnabled || !this.stream.isTTY) return this; for(let e = 0; e < this.linesToClear; e++){ if (e > 0) this.stream.moveCursor(0, -1); this.stream.clearLine(); this.stream.cursorTo(this.indent); } this.linesToClear = 0; return this; } render() { if (this.isSilent) return this; this.clear(); this.stream.write(this.frame()); this.linesToClear = this.lineCount; return this; } start(e) { if (e) this.text = e; if (this.isSilent) return this; if (!this.isEnabled) { if (this.text) this.stream.write(`- ${this.text}\n`); return this; } if (this.isSpinning) return this; if (this.hideCursor) s.hide(this.stream); if (this.discardStdin && process.stdin.isTTY) { this.isDiscardingStdin = true; g.start(); } this.render(); this.id = setInterval(this.render.bind(this), this.interval); return this; } stop() { if (!this.isEnabled) return this; clearInterval(this.id); this.id = void 0; this.frameIndex = 0; this.clear(); if (this.hideCursor) s.show(this.stream); if (this.discardStdin && process.stdin.isTTY && this.isDiscardingStdin) { g.stop(); this.isDiscardingStdin = false; } return this; } succeed(e) { return this.stopAndPersist({ symbol: o.success, text: e }); } fail(e) { return this.stopAndPersist({ symbol: o.error, text: e }); } warn(e) { return this.stopAndPersist({ symbol: o.warning, text: e }); } info(e) { return this.stopAndPersist({ symbol: o.info, text: e }); } stopAndPersist(e = {}) { if (this.isSilent) return this; const t = e.prefixText || this.prefixText; const r = e.text || this.text; const i = "string" == typeof r ? " " + r : ""; this.stop(); this.stream.write(`${this.getFullPrefixText(t, " ")}${e.symbol || " "}${i}\n`); return this; } } const oraFactory = function(e) { return new Ora(e); }; e.exports = oraFactory; e.exports.promise = (e, t)=>{ if ("function" != typeof e.then) throw new TypeError("Parameter `action` must be a Promise"); const r = new Ora(t); r.start(); (async ()=>{ try { await e; r.succeed(); } catch { r.fail(); } })(); return r; }; }, 959: (e)=>{ "use strict"; const t = {}; function createErrorType(e, r, i) { if (!i) i = Error; function getMessage(e, t, i) { if ("string" == typeof r) return r; return r(e, t, i); } class NodeError extends i { constructor(e, t, r){ super(getMessage(e, t, r)); } } NodeError.prototype.name = i.name; NodeError.prototype.code = e; t[e] = NodeError; } function oneOf(e, t) { if (!Array.isArray(e)) return `of ${t} ${String(e)}`; { const r = e.length; e = e.map((e)=>String(e)); if (r > 2) return `one of ${t} ${e.slice(0, r - 1).join(", ")}, or ` + e[r - 1]; if (2 === r) return `one of ${t} ${e[0]} or ${e[1]}`; return `of ${t} ${e[0]}`; } } function startsWith(e, t, r) { return e.substr(!r || r < 0 ? 0 : +r, t.length) === t; } function endsWith(e, t, r) { if (void 0 === r || r > e.length) r = e.length; return e.substring(r - t.length, r) === t; } function includes(e, t, r) { if ("number" != typeof r) r = 0; if (r + t.length > e.length) return false; return -1 !== e.indexOf(t, r); } createErrorType("ERR_INVALID_OPT_VALUE", function(e, t) { return 'The value "' + t + '" is invalid for option "' + e + '"'; }, TypeError); createErrorType("ERR_INVALID_ARG_TYPE", function(e, t, r) { let i; if ("string" == typeof t && startsWith(t, "not ")) { i = "must not be"; t = t.replace(/^not /, ""); } else i = "must be"; let n; if (endsWith(e, " argument")) n = `The ${e} ${i} ${oneOf(t, "type")}`; else { const r = includes(e, ".") ? "property" : "argument"; n = `The "${e}" ${r} ${i} ${oneOf(t, "type")}`; } n += `. Received type ${typeof r}`; return n; }, TypeError); createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"); createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(e) { return "The " + e + " method is not implemented"; }); createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close"); createErrorType("ERR_STREAM_DESTROYED", function(e) { return "Cannot call " + e + " after a stream was destroyed"; }); createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"); createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"); createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end"); createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError); createErrorType("ERR_UNKNOWN_ENCODING", function(e) { return "Unknown encoding: " + e; }, TypeError); createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"); e.exports.q = t; }, 548: (e, t, r)=>{ "use strict"; var i = Object.keys || function(e) { var t = []; for(var r in e)t.push(r); return t; }; e.exports = Duplex; var n = r(852); var s = r(379); r(315)(Duplex, n); var a = i(s.prototype); for(var o = 0; o < a.length; o++){ var f = a[o]; if (!Duplex.prototype[f]) Duplex.prototype[f] = s.prototype[f]; } function Duplex(e) { if (!(this instanceof Duplex)) return new Duplex(e); n.call(this, e); s.call(this, e); this.allowHalfOpen = true; if (e) { if (false === e.readable) this.readable = false; if (false === e.writable) this.writable = false; if (false === e.allowHalfOpen) { this.allowHalfOpen = false; this.once("end", onend); } } } Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { enumerable: false, get: function() { return this._writableState.highWaterMark; } }); Object.defineProperty(Duplex.prototype, "writableBuffer", { enumerable: false, get: function() { return this._writableState && this._writableState.getBuffer(); } }); Object.defineProperty(Duplex.prototype, "writableLength", { enumerable: false, get: function() { return this._writableState.length; } }); function onend() { if (this._writableState.ended) return; process.nextTick(onEndNT, this); } function onEndNT(e) { e.end(); } Object.defineProperty(Duplex.prototype, "destroyed", { enumerable: false, get: function() { if (void 0 === this._readableState || void 0 === this._writableState) return false; return this._readableState.destroyed && this._writableState.destroyed; }, set: function(e) { if (void 0 === this._readableState || void 0 === this._writableState) return; this._readableState.destroyed = e; this._writableState.destroyed = e; } }); }, 184: (e, t, r)=>{ "use strict"; e.exports = PassThrough; var i = r(770); r(315)(PassThrough, i); function PassThrough(e) { if (!(this instanceof PassThrough)) return new PassThrough(e); i.call(this, e); } PassThrough.prototype._transform = function(e, t, r) { r(null, e); }; }, 852: (e, t, r)=>{ "use strict"; e.exports = Readable; var i; Readable.ReadableState = ReadableState; r(361).EventEmitter; var s = function(e, t) { return e.listeners(t).length; }; var a = r(604); var o = r(300).Buffer; var f = global.Uint8Array || function() {}; function _uint8ArrayToBuffer(e) { return o.from(e); } function _isUint8Array(e) { return o.isBuffer(e) || e instanceof f; } var l = r(837); var u; u = l && l.debuglog ? l.debuglog("stream") : function() {}; var h = r(706); var d = r(97); var p = r(841), _ = p.getHighWaterMark; var b = r(959).q, g = b.ERR_INVALID_ARG_TYPE, y = b.ERR_STREAM_PUSH_AFTER_EOF, m = b.ERR_METHOD_NOT_IMPLEMENTED, v = b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; var w; var S; var R; r(315)(Readable, a); var E = d.errorOrDestroy; var x = [ "error", "close", "destroy", "pause", "resume" ]; function prependListener(e, t, r) { if ("function" == typeof e.prependListener) return e.prependListener(t, r); if (e._events && e._events[t]) if (Array.isArray(e._events[t])) e._events[t].unshift(r); else e._events[t] = [ r, e._events[t] ]; else e.on(t, r); } function ReadableState(e, t, n) { i = i || r(548); e = e || {}; if ("boolean" != typeof n) n = t instanceof i; this.objectMode = !!e.objectMode; if (n) this.objectMode = this.objectMode || !!e.readableObjectMode; this.highWaterMark = _(this, e, "readableHighWaterMark", n); this.buffer = new h; this.length = 0; this.pipes = null; this.pipesCount = 0; this.flowing = null; this.ended = false; this.endEmitted = false; this.reading = false; this.sync = true; this.needReadable = false; this.emittedReadable = false; this.readableListening = false; this.resumeScheduled = false; this.paused = true; this.emitClose = false !== e.emitClose; this.autoDestroy = !!e.autoDestroy; this.destroyed = false; this.defaultEncoding = e.defaultEncoding || "utf8"; this.awaitDrain = 0; this.readingMore = false; this.decoder = null; this.encoding = null; if (e.encoding) { if (!w) w = r(259).s; this.decoder = new w(e.encoding); this.encoding = e.encoding; } } function Readable(e) { i = i || r(548); if (!(this instanceof Readable)) return new Readable(e); var t = this instanceof i; this._readableState = new ReadableState(e, this, t); this.readable = true; if (e) { if ("function" == typeof e.read) this._read = e.read; if ("function" == typeof e.destroy) this._destroy = e.destroy; } a.call(this); } Object.defineProperty(Readable.prototype, "destroyed", { enumerable: false, get: function() { if (void 0 === this._readableState) return false; return this._readableState.destroyed; }, set: function(e) { if (!this._readableState) return; this._readableState.destroyed = e; } }); Readable.prototype.destroy = d.destroy; Readable.prototype._undestroy = d.undestroy; Readable.prototype._destroy = function(e, t) { t(e); }; Readable.prototype.push = function(e, t) { var r = this._readableState; var i; if (r.objectMode) i = true; else if ("string" == typeof e) { t = t || r.defaultEncoding; if (t !== r.encoding) { e = o.from(e, t); t = ""; } i = true; } return readableAddChunk(this, e, t, false, i); }; Readable.prototype.unshift = function(e) { return readableAddChunk(this, e, null, true, false); }; function readableAddChunk(e, t, r, i, n) { u("readableAddChunk", t); var s = e._readableState; if (null === t) { s.reading = false; onEofChunk(e, s); } else { var a; if (!n) a = chunkInvalid(s, t); if (a) E(e, a); else if (s.objectMode || t && t.length > 0) { if ("string" != typeof t && !s.objectMode && Object.getPrototypeOf(t) !== o.prototype) t = _uint8ArrayToBuffer(t); if (i) if (s.endEmitted) E(e, new v); else addChunk(e, s, t, true); else if (s.ended) E(e, new y); else { if (s.destroyed) return false; s.reading = false; if (s.decoder && !r) { t = s.decoder.write(t); if (s.objectMode || 0 !== t.length) addChunk(e, s, t, false); else maybeReadMore(e, s); } else addChunk(e, s, t, false); } } else if (!i) { s.reading = false; maybeReadMore(e, s); } } return !s.ended && (s.length < s.highWaterMark || 0 === s.length); } function addChunk(e, t, r, i) { if (t.flowing && 0 === t.length && !t.sync) { t.awaitDrain = 0; e.emit("data", r); } else { t.length += t.objectMode ? 1 : r.length; if (i) t.buffer.unshift(r); else t.buffer.push(r); if (t.needReadable) emitReadable(e); } maybeReadMore(e, t); } function chunkInvalid(e, t) { var r; if (!_isUint8Array(t) && "string" != typeof t && void 0 !== t && !e.objectMode) r = new g("chunk", [ "string", "Buffer", "Uint8Array" ], t); return r; } Readable.prototype.isPaused = function() { return false === this._readableState.flowing; }; Readable.prototype.setEncoding = function(e) { if (!w) w = r(259).s; var t = new w(e); this._readableState.decoder = t; this._readableState.encoding = this._readableState.decoder.encoding; var i = this._readableState.buffer.head; var n = ""; while(null !== i){ n += t.write(i.data); i = i.next; } this._readableState.buffer.clear(); if ("" !== n) this._readableState.buffer.push(n); this._readableState.length = n.length; return this; }; var T = 1073741824; function computeNewHighWaterMark(e) { if (e >= T) e = T; else { e--; e |= e >>> 1; e |= e >>> 2; e |= e >>> 4; e |= e >>> 8; e |= e >>> 16; e++; } return e; } function howMuchToRead(e, t) { if (e <= 0 || 0 === t.length && t.ended) return 0; if (t.objectMode) return 1; if (e !== e) if (t.flowing && t.length) return t.buffer.head.data.length; else return t.length; if (e > t.highWaterMark) t.highWaterMark = computeNewHighWaterMark(e); if (e <= t.length) return e; if (!t.ended) { t.needReadable = true; return 0; } return t.length; } Readable.prototype.read = function(e) { u("read", e); e = parseInt(e, 10); var t = this._readableState; var r = e; if (0 !== e) t.emittedReadable = false; if (0 === e && t.needReadable && ((0 !== t.highWaterMark ? t.length >= t.highWaterMark : t.length > 0) || t.ended)) { u("read: emitReadable", t.length, t.ended); if (0 === t.length && t.ended) endReadable(this); else emitReadable(this); return null; } e = howMuchToRead(e, t); if (0 === e && t.ended) { if (0 === t.length) endReadable(this); return null; } var i = t.needReadable; u("need readable", i); if (0 === t.length || t.length - e < t.highWaterMark) { i = true; u("length less than watermark", i); } if (t.ended || t.reading) { i = false; u("reading or ended", i); } else if (i) { u("do read"); t.reading = true; t.sync = true; if (0 === t.length)