npm-pkg-lint 3.10.0 → 3.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6512,6 +6512,14 @@ function getLiteralValue(value, token, json5 = false) {
6512
6512
  case "Boolean":
6513
6513
  return value === "true";
6514
6514
  case "Number":
6515
+ if (json5) {
6516
+ if (value.charCodeAt(0) === 45) {
6517
+ return -Number(value.slice(1));
6518
+ }
6519
+ if (value.charCodeAt(0) === 43) {
6520
+ return Number(value.slice(1));
6521
+ }
6522
+ }
6515
6523
  return Number(value);
6516
6524
  case "String":
6517
6525
  return getStringValue(value.slice(1, -1), token, json5);
@@ -6828,13 +6836,13 @@ var import_argparse = __toESM(require_argparse(), 1);
6828
6836
  // node_modules/find-up/index.js
6829
6837
  import path2 from "path";
6830
6838
 
6831
- // node_modules/find-up/node_modules/locate-path/index.js
6839
+ // node_modules/locate-path/index.js
6832
6840
  import process2 from "process";
6833
6841
  import path from "path";
6834
6842
  import fs, { promises as fsPromises } from "fs";
6835
6843
  import { fileURLToPath } from "url";
6836
6844
 
6837
- // node_modules/find-up/node_modules/yocto-queue/index.js
6845
+ // node_modules/p-locate/node_modules/yocto-queue/index.js
6838
6846
  var Node = class {
6839
6847
  value;
6840
6848
  next;
@@ -6896,7 +6904,7 @@ _head = new WeakMap();
6896
6904
  _tail = new WeakMap();
6897
6905
  _size = new WeakMap();
6898
6906
 
6899
- // node_modules/find-up/node_modules/p-limit/index.js
6907
+ // node_modules/p-locate/node_modules/p-limit/index.js
6900
6908
  function pLimit(concurrency) {
6901
6909
  if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
6902
6910
  throw new TypeError("Expected `concurrency` to be a number from 1 and up");
@@ -6947,7 +6955,7 @@ function pLimit(concurrency) {
6947
6955
  return generator;
6948
6956
  }
6949
6957
 
6950
- // node_modules/find-up/node_modules/p-locate/index.js
6958
+ // node_modules/p-locate/index.js
6951
6959
  var EndError = class extends Error {
6952
6960
  constructor(value) {
6953
6961
  super();
@@ -6979,7 +6987,7 @@ async function pLocate(iterable, tester, {
6979
6987
  }
6980
6988
  }
6981
6989
 
6982
- // node_modules/find-up/node_modules/locate-path/index.js
6990
+ // node_modules/locate-path/index.js
6983
6991
  var typeMappings = {
6984
6992
  directory: "isDirectory",
6985
6993
  file: "isFile"
@@ -7060,7 +7068,7 @@ async function findUp(name2, options = {}) {
7060
7068
  // src/index.ts
7061
7069
  var import_tmp = __toESM(require_tmp(), 1);
7062
7070
 
7063
- // node_modules/@html-validate/stylish/node_modules/kleur/colors.mjs
7071
+ // node_modules/kleur/colors.mjs
7064
7072
  var FORCE_COLOR;
7065
7073
  var NODE_DISABLE_COLORS;
7066
7074
  var NO_COLOR;
@@ -7556,7 +7564,7 @@ import fs12 from "fs";
7556
7564
  import EE from "events";
7557
7565
  import fs2 from "fs";
7558
7566
 
7559
- // node_modules/minipass/dist/esm/index.js
7567
+ // node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.js
7560
7568
  import { EventEmitter } from "events";
7561
7569
  import Stream from "stream";
7562
7570
  import { StringDecoder } from "string_decoder";
@@ -8927,1196 +8935,2958 @@ import { EventEmitter as EE2 } from "events";
8927
8935
  // node_modules/minizlib/dist/esm/index.js
8928
8936
  import assert from "assert";
8929
8937
  import { Buffer as Buffer2 } from "buffer";
8930
- import realZlib2 from "zlib";
8931
-
8932
- // node_modules/minizlib/dist/esm/constants.js
8933
- import realZlib from "zlib";
8934
- var realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 };
8935
- var constants = Object.freeze(Object.assign(/* @__PURE__ */ Object.create(null), {
8936
- Z_NO_FLUSH: 0,
8937
- Z_PARTIAL_FLUSH: 1,
8938
- Z_SYNC_FLUSH: 2,
8939
- Z_FULL_FLUSH: 3,
8940
- Z_FINISH: 4,
8941
- Z_BLOCK: 5,
8942
- Z_OK: 0,
8943
- Z_STREAM_END: 1,
8944
- Z_NEED_DICT: 2,
8945
- Z_ERRNO: -1,
8946
- Z_STREAM_ERROR: -2,
8947
- Z_DATA_ERROR: -3,
8948
- Z_MEM_ERROR: -4,
8949
- Z_BUF_ERROR: -5,
8950
- Z_VERSION_ERROR: -6,
8951
- Z_NO_COMPRESSION: 0,
8952
- Z_BEST_SPEED: 1,
8953
- Z_BEST_COMPRESSION: 9,
8954
- Z_DEFAULT_COMPRESSION: -1,
8955
- Z_FILTERED: 1,
8956
- Z_HUFFMAN_ONLY: 2,
8957
- Z_RLE: 3,
8958
- Z_FIXED: 4,
8959
- Z_DEFAULT_STRATEGY: 0,
8960
- DEFLATE: 1,
8961
- INFLATE: 2,
8962
- GZIP: 3,
8963
- GUNZIP: 4,
8964
- DEFLATERAW: 5,
8965
- INFLATERAW: 6,
8966
- UNZIP: 7,
8967
- BROTLI_DECODE: 8,
8968
- BROTLI_ENCODE: 9,
8969
- Z_MIN_WINDOWBITS: 8,
8970
- Z_MAX_WINDOWBITS: 15,
8971
- Z_DEFAULT_WINDOWBITS: 15,
8972
- Z_MIN_CHUNK: 64,
8973
- Z_MAX_CHUNK: Infinity,
8974
- Z_DEFAULT_CHUNK: 16384,
8975
- Z_MIN_MEMLEVEL: 1,
8976
- Z_MAX_MEMLEVEL: 9,
8977
- Z_DEFAULT_MEMLEVEL: 8,
8978
- Z_MIN_LEVEL: -1,
8979
- Z_MAX_LEVEL: 9,
8980
- Z_DEFAULT_LEVEL: -1,
8981
- BROTLI_OPERATION_PROCESS: 0,
8982
- BROTLI_OPERATION_FLUSH: 1,
8983
- BROTLI_OPERATION_FINISH: 2,
8984
- BROTLI_OPERATION_EMIT_METADATA: 3,
8985
- BROTLI_MODE_GENERIC: 0,
8986
- BROTLI_MODE_TEXT: 1,
8987
- BROTLI_MODE_FONT: 2,
8988
- BROTLI_DEFAULT_MODE: 0,
8989
- BROTLI_MIN_QUALITY: 0,
8990
- BROTLI_MAX_QUALITY: 11,
8991
- BROTLI_DEFAULT_QUALITY: 11,
8992
- BROTLI_MIN_WINDOW_BITS: 10,
8993
- BROTLI_MAX_WINDOW_BITS: 24,
8994
- BROTLI_LARGE_MAX_WINDOW_BITS: 30,
8995
- BROTLI_DEFAULT_WINDOW: 22,
8996
- BROTLI_MIN_INPUT_BLOCK_BITS: 16,
8997
- BROTLI_MAX_INPUT_BLOCK_BITS: 24,
8998
- BROTLI_PARAM_MODE: 0,
8999
- BROTLI_PARAM_QUALITY: 1,
9000
- BROTLI_PARAM_LGWIN: 2,
9001
- BROTLI_PARAM_LGBLOCK: 3,
9002
- BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
9003
- BROTLI_PARAM_SIZE_HINT: 5,
9004
- BROTLI_PARAM_LARGE_WINDOW: 6,
9005
- BROTLI_PARAM_NPOSTFIX: 7,
9006
- BROTLI_PARAM_NDIRECT: 8,
9007
- BROTLI_DECODER_RESULT_ERROR: 0,
9008
- BROTLI_DECODER_RESULT_SUCCESS: 1,
9009
- BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
9010
- BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
9011
- BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
9012
- BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
9013
- BROTLI_DECODER_NO_ERROR: 0,
9014
- BROTLI_DECODER_SUCCESS: 1,
9015
- BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
9016
- BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
9017
- BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
9018
- BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
9019
- BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
9020
- BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
9021
- BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
9022
- BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
9023
- BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
9024
- BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
9025
- BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
9026
- BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
9027
- BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
9028
- BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
9029
- BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
9030
- BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
9031
- BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
9032
- BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
9033
- BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
9034
- BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
9035
- BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
9036
- BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
9037
- BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
9038
- BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
9039
- BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
9040
- BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
9041
- BROTLI_DECODER_ERROR_UNREACHABLE: -31
9042
- }, realZlibConstants));
9043
8938
 
9044
- // node_modules/minizlib/dist/esm/index.js
9045
- var OriginalBufferConcat = Buffer2.concat;
9046
- var _superWrite = Symbol("_superWrite");
9047
- var ZlibError = class extends Error {
9048
- code;
9049
- errno;
9050
- constructor(err) {
9051
- super("zlib: " + err.message);
9052
- this.code = err.code;
9053
- this.errno = err.errno;
9054
- if (!this.code)
9055
- this.code = "ZLIB_ERROR";
9056
- this.message = "zlib: " + err.message;
9057
- Error.captureStackTrace(this, this.constructor);
9058
- }
9059
- get name() {
9060
- return "ZlibError";
9061
- }
8939
+ // node_modules/minizlib/node_modules/minipass/dist/esm/index.js
8940
+ import { EventEmitter as EventEmitter2 } from "events";
8941
+ import Stream2 from "stream";
8942
+ import { StringDecoder as StringDecoder2 } from "string_decoder";
8943
+ var proc2 = typeof process === "object" && process ? process : {
8944
+ stdout: null,
8945
+ stderr: null
9062
8946
  };
9063
- var _flushFlag = Symbol("flushFlag");
9064
- var _sawError, _ended3, _flushFlag2, _finishFlushFlag, _fullFlushFlag, _handle, _onError;
9065
- var ZlibBase = class extends Minipass {
9066
- /* c8 ignore stop */
9067
- constructor(opts, mode) {
9068
- var _a;
9069
- if (!opts || typeof opts !== "object")
9070
- throw new TypeError("invalid options for ZlibBase constructor");
9071
- super(opts);
9072
- __privateAdd(this, _sawError, false);
9073
- __privateAdd(this, _ended3, false);
9074
- __privateAdd(this, _flushFlag2);
9075
- __privateAdd(this, _finishFlushFlag);
9076
- __privateAdd(this, _fullFlushFlag);
9077
- __privateAdd(this, _handle);
9078
- __privateAdd(this, _onError);
9079
- __privateSet(this, _flushFlag2, opts.flush ?? 0);
9080
- __privateSet(this, _finishFlushFlag, opts.finishFlush ?? 0);
9081
- __privateSet(this, _fullFlushFlag, opts.fullFlushFlag ?? 0);
9082
- try {
9083
- __privateSet(this, _handle, new realZlib2[mode](opts));
9084
- } catch (er) {
9085
- throw new ZlibError(er);
9086
- }
9087
- __privateSet(this, _onError, (err) => {
9088
- if (__privateGet(this, _sawError))
9089
- return;
9090
- __privateSet(this, _sawError, true);
9091
- this.close();
9092
- this.emit("error", err);
9093
- });
9094
- (_a = __privateGet(this, _handle)) == null ? void 0 : _a.on("error", (er) => __privateGet(this, _onError).call(this, new ZlibError(er)));
9095
- this.once("end", () => this.close);
9096
- }
9097
- get sawError() {
9098
- return __privateGet(this, _sawError);
8947
+ var isStream2 = (s) => !!s && typeof s === "object" && (s instanceof Minipass2 || s instanceof Stream2 || isReadable2(s) || isWritable2(s));
8948
+ var isReadable2 = (s) => !!s && typeof s === "object" && s instanceof EventEmitter2 && typeof s.pipe === "function" && // node core Writable streams have a pipe() method, but it throws
8949
+ s.pipe !== Stream2.Writable.prototype.pipe;
8950
+ var isWritable2 = (s) => !!s && typeof s === "object" && s instanceof EventEmitter2 && typeof s.write === "function" && typeof s.end === "function";
8951
+ var EOF2 = Symbol("EOF");
8952
+ var MAYBE_EMIT_END2 = Symbol("maybeEmitEnd");
8953
+ var EMITTED_END2 = Symbol("emittedEnd");
8954
+ var EMITTING_END2 = Symbol("emittingEnd");
8955
+ var EMITTED_ERROR2 = Symbol("emittedError");
8956
+ var CLOSED2 = Symbol("closed");
8957
+ var READ2 = Symbol("read");
8958
+ var FLUSH2 = Symbol("flush");
8959
+ var FLUSHCHUNK2 = Symbol("flushChunk");
8960
+ var ENCODING2 = Symbol("encoding");
8961
+ var DECODER2 = Symbol("decoder");
8962
+ var FLOWING2 = Symbol("flowing");
8963
+ var PAUSED2 = Symbol("paused");
8964
+ var RESUME2 = Symbol("resume");
8965
+ var BUFFER2 = Symbol("buffer");
8966
+ var PIPES2 = Symbol("pipes");
8967
+ var BUFFERLENGTH2 = Symbol("bufferLength");
8968
+ var BUFFERPUSH2 = Symbol("bufferPush");
8969
+ var BUFFERSHIFT2 = Symbol("bufferShift");
8970
+ var OBJECTMODE2 = Symbol("objectMode");
8971
+ var DESTROYED2 = Symbol("destroyed");
8972
+ var ERROR2 = Symbol("error");
8973
+ var EMITDATA2 = Symbol("emitData");
8974
+ var EMITEND3 = Symbol("emitEnd");
8975
+ var EMITEND22 = Symbol("emitEnd2");
8976
+ var ASYNC2 = Symbol("async");
8977
+ var ABORT2 = Symbol("abort");
8978
+ var ABORTED2 = Symbol("aborted");
8979
+ var SIGNAL2 = Symbol("signal");
8980
+ var DATALISTENERS2 = Symbol("dataListeners");
8981
+ var DISCARDED2 = Symbol("discarded");
8982
+ var defer2 = (fn) => Promise.resolve().then(fn);
8983
+ var nodefer2 = (fn) => fn();
8984
+ var isEndish2 = (ev) => ev === "end" || ev === "finish" || ev === "prefinish";
8985
+ var isArrayBufferLike2 = (b) => b instanceof ArrayBuffer || !!b && typeof b === "object" && b.constructor && b.constructor.name === "ArrayBuffer" && b.byteLength >= 0;
8986
+ var isArrayBufferView2 = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b);
8987
+ var Pipe2 = class {
8988
+ src;
8989
+ dest;
8990
+ opts;
8991
+ ondrain;
8992
+ constructor(src, dest, opts) {
8993
+ this.src = src;
8994
+ this.dest = dest;
8995
+ this.opts = opts;
8996
+ this.ondrain = () => src[RESUME2]();
8997
+ this.dest.on("drain", this.ondrain);
9099
8998
  }
9100
- get handle() {
9101
- return __privateGet(this, _handle);
8999
+ unpipe() {
9000
+ this.dest.removeListener("drain", this.ondrain);
9102
9001
  }
9002
+ // only here for the prototype
9103
9003
  /* c8 ignore start */
9104
- get flushFlag() {
9105
- return __privateGet(this, _flushFlag2);
9004
+ proxyErrors(_er) {
9106
9005
  }
9107
- close() {
9108
- if (__privateGet(this, _handle)) {
9109
- __privateGet(this, _handle).close();
9110
- __privateSet(this, _handle, void 0);
9111
- this.emit("close");
9112
- }
9006
+ /* c8 ignore stop */
9007
+ end() {
9008
+ this.unpipe();
9009
+ if (this.opts.end)
9010
+ this.dest.end();
9113
9011
  }
9114
- reset() {
9115
- var _a, _b;
9116
- if (!__privateGet(this, _sawError)) {
9117
- assert(__privateGet(this, _handle), "zlib binding closed");
9118
- return (_b = (_a = __privateGet(this, _handle)).reset) == null ? void 0 : _b.call(_a);
9119
- }
9012
+ };
9013
+ var PipeProxyErrors2 = class extends Pipe2 {
9014
+ unpipe() {
9015
+ this.src.removeListener("error", this.proxyErrors);
9016
+ super.unpipe();
9120
9017
  }
9121
- flush(flushFlag) {
9122
- if (this.ended)
9123
- return;
9124
- if (typeof flushFlag !== "number")
9125
- flushFlag = __privateGet(this, _fullFlushFlag);
9126
- this.write(Object.assign(Buffer2.alloc(0), { [_flushFlag]: flushFlag }));
9018
+ constructor(src, dest, opts) {
9019
+ super(src, dest, opts);
9020
+ this.proxyErrors = (er) => dest.emit("error", er);
9021
+ src.on("error", this.proxyErrors);
9127
9022
  }
9128
- end(chunk, encoding, cb) {
9129
- if (typeof chunk === "function") {
9130
- cb = chunk;
9131
- encoding = void 0;
9132
- chunk = void 0;
9023
+ };
9024
+ var isObjectModeOptions2 = (o) => !!o.objectMode;
9025
+ var isEncodingOptions2 = (o) => !o.objectMode && !!o.encoding && o.encoding !== "buffer";
9026
+ var Minipass2 = class extends EventEmitter2 {
9027
+ [FLOWING2] = false;
9028
+ [PAUSED2] = false;
9029
+ [PIPES2] = [];
9030
+ [BUFFER2] = [];
9031
+ [OBJECTMODE2];
9032
+ [ENCODING2];
9033
+ [ASYNC2];
9034
+ [DECODER2];
9035
+ [EOF2] = false;
9036
+ [EMITTED_END2] = false;
9037
+ [EMITTING_END2] = false;
9038
+ [CLOSED2] = false;
9039
+ [EMITTED_ERROR2] = null;
9040
+ [BUFFERLENGTH2] = 0;
9041
+ [DESTROYED2] = false;
9042
+ [SIGNAL2];
9043
+ [ABORTED2] = false;
9044
+ [DATALISTENERS2] = 0;
9045
+ [DISCARDED2] = false;
9046
+ /**
9047
+ * true if the stream can be written
9048
+ */
9049
+ writable = true;
9050
+ /**
9051
+ * true if the stream can be read
9052
+ */
9053
+ readable = true;
9054
+ /**
9055
+ * If `RType` is Buffer, then options do not need to be provided.
9056
+ * Otherwise, an options object must be provided to specify either
9057
+ * {@link Minipass.SharedOptions.objectMode} or
9058
+ * {@link Minipass.SharedOptions.encoding}, as appropriate.
9059
+ */
9060
+ constructor(...args) {
9061
+ const options = args[0] || {};
9062
+ super();
9063
+ if (options.objectMode && typeof options.encoding === "string") {
9064
+ throw new TypeError("Encoding and objectMode may not be used together");
9133
9065
  }
9134
- if (typeof encoding === "function") {
9135
- cb = encoding;
9136
- encoding = void 0;
9066
+ if (isObjectModeOptions2(options)) {
9067
+ this[OBJECTMODE2] = true;
9068
+ this[ENCODING2] = null;
9069
+ } else if (isEncodingOptions2(options)) {
9070
+ this[ENCODING2] = options.encoding;
9071
+ this[OBJECTMODE2] = false;
9072
+ } else {
9073
+ this[OBJECTMODE2] = false;
9074
+ this[ENCODING2] = null;
9137
9075
  }
9138
- if (chunk) {
9139
- if (encoding)
9140
- this.write(chunk, encoding);
9141
- else
9142
- this.write(chunk);
9076
+ this[ASYNC2] = !!options.async;
9077
+ this[DECODER2] = this[ENCODING2] ? new StringDecoder2(this[ENCODING2]) : null;
9078
+ if (options && options.debugExposeBuffer === true) {
9079
+ Object.defineProperty(this, "buffer", { get: () => this[BUFFER2] });
9143
9080
  }
9144
- this.flush(__privateGet(this, _finishFlushFlag));
9145
- __privateSet(this, _ended3, true);
9146
- return super.end(cb);
9147
- }
9148
- get ended() {
9149
- return __privateGet(this, _ended3);
9150
- }
9151
- // overridden in the gzip classes to do portable writes
9152
- [_superWrite](data) {
9153
- return super.write(data);
9154
- }
9155
- write(chunk, encoding, cb) {
9156
- if (typeof encoding === "function")
9157
- cb = encoding, encoding = "utf8";
9158
- if (typeof chunk === "string")
9159
- chunk = Buffer2.from(chunk, encoding);
9160
- if (__privateGet(this, _sawError))
9161
- return;
9162
- assert(__privateGet(this, _handle), "zlib binding closed");
9163
- const nativeHandle = __privateGet(this, _handle)._handle;
9164
- const originalNativeClose = nativeHandle.close;
9165
- nativeHandle.close = () => {
9166
- };
9167
- const originalClose = __privateGet(this, _handle).close;
9168
- __privateGet(this, _handle).close = () => {
9169
- };
9170
- Buffer2.concat = (args) => args;
9171
- let result = void 0;
9172
- try {
9173
- const flushFlag = typeof chunk[_flushFlag] === "number" ? chunk[_flushFlag] : __privateGet(this, _flushFlag2);
9174
- result = __privateGet(this, _handle)._processChunk(chunk, flushFlag);
9175
- Buffer2.concat = OriginalBufferConcat;
9176
- } catch (err) {
9177
- Buffer2.concat = OriginalBufferConcat;
9178
- __privateGet(this, _onError).call(this, new ZlibError(err));
9179
- } finally {
9180
- if (__privateGet(this, _handle)) {
9181
- ;
9182
- __privateGet(this, _handle)._handle = nativeHandle;
9183
- nativeHandle.close = originalNativeClose;
9184
- __privateGet(this, _handle).close = originalClose;
9185
- __privateGet(this, _handle).removeAllListeners("error");
9186
- }
9081
+ if (options && options.debugExposePipes === true) {
9082
+ Object.defineProperty(this, "pipes", { get: () => this[PIPES2] });
9187
9083
  }
9188
- if (__privateGet(this, _handle))
9189
- __privateGet(this, _handle).on("error", (er) => __privateGet(this, _onError).call(this, new ZlibError(er)));
9190
- let writeReturn;
9191
- if (result) {
9192
- if (Array.isArray(result) && result.length > 0) {
9193
- const r = result[0];
9194
- writeReturn = this[_superWrite](Buffer2.from(r));
9195
- for (let i = 1; i < result.length; i++) {
9196
- writeReturn = this[_superWrite](result[i]);
9197
- }
9084
+ const { signal } = options;
9085
+ if (signal) {
9086
+ this[SIGNAL2] = signal;
9087
+ if (signal.aborted) {
9088
+ this[ABORT2]();
9198
9089
  } else {
9199
- writeReturn = this[_superWrite](Buffer2.from(result));
9090
+ signal.addEventListener("abort", () => this[ABORT2]());
9200
9091
  }
9201
9092
  }
9202
- if (cb)
9203
- cb();
9204
- return writeReturn;
9205
9093
  }
9206
- };
9207
- _sawError = new WeakMap();
9208
- _ended3 = new WeakMap();
9209
- _flushFlag2 = new WeakMap();
9210
- _finishFlushFlag = new WeakMap();
9211
- _fullFlushFlag = new WeakMap();
9212
- _handle = new WeakMap();
9213
- _onError = new WeakMap();
9214
- var _level, _strategy;
9215
- var Zlib = class extends ZlibBase {
9216
- constructor(opts, mode) {
9217
- opts = opts || {};
9218
- opts.flush = opts.flush || constants.Z_NO_FLUSH;
9219
- opts.finishFlush = opts.finishFlush || constants.Z_FINISH;
9220
- opts.fullFlushFlag = constants.Z_FULL_FLUSH;
9221
- super(opts, mode);
9222
- __privateAdd(this, _level);
9223
- __privateAdd(this, _strategy);
9224
- __privateSet(this, _level, opts.level);
9225
- __privateSet(this, _strategy, opts.strategy);
9094
+ /**
9095
+ * The amount of data stored in the buffer waiting to be read.
9096
+ *
9097
+ * For Buffer strings, this will be the total byte length.
9098
+ * For string encoding streams, this will be the string character length,
9099
+ * according to JavaScript's `string.length` logic.
9100
+ * For objectMode streams, this is a count of the items waiting to be
9101
+ * emitted.
9102
+ */
9103
+ get bufferLength() {
9104
+ return this[BUFFERLENGTH2];
9226
9105
  }
9227
- params(level, strategy) {
9228
- if (this.sawError)
9229
- return;
9230
- if (!this.handle)
9231
- throw new Error("cannot switch params when binding is closed");
9232
- if (!this.handle.params)
9233
- throw new Error("not supported in this implementation");
9234
- if (__privateGet(this, _level) !== level || __privateGet(this, _strategy) !== strategy) {
9235
- this.flush(constants.Z_SYNC_FLUSH);
9236
- assert(this.handle, "zlib binding closed");
9237
- const origFlush = this.handle.flush;
9238
- this.handle.flush = (flushFlag, cb) => {
9239
- if (typeof flushFlag === "function") {
9240
- cb = flushFlag;
9241
- flushFlag = this.flushFlag;
9242
- }
9243
- this.flush(flushFlag);
9244
- cb == null ? void 0 : cb();
9245
- };
9246
- try {
9247
- ;
9248
- this.handle.params(level, strategy);
9249
- } finally {
9250
- this.handle.flush = origFlush;
9251
- }
9252
- if (this.handle) {
9253
- __privateSet(this, _level, level);
9254
- __privateSet(this, _strategy, strategy);
9255
- }
9256
- }
9106
+ /**
9107
+ * The `BufferEncoding` currently in use, or `null`
9108
+ */
9109
+ get encoding() {
9110
+ return this[ENCODING2];
9257
9111
  }
9258
- };
9259
- _level = new WeakMap();
9260
- _strategy = new WeakMap();
9261
- var _portable;
9262
- var Gzip = class extends Zlib {
9263
- constructor(opts) {
9264
- super(opts, "Gzip");
9265
- __privateAdd(this, _portable);
9266
- __privateSet(this, _portable, opts && !!opts.portable);
9112
+ /**
9113
+ * @deprecated - This is a read only property
9114
+ */
9115
+ set encoding(_enc) {
9116
+ throw new Error("Encoding must be set at instantiation time");
9267
9117
  }
9268
- [_superWrite](data) {
9269
- if (!__privateGet(this, _portable))
9270
- return super[_superWrite](data);
9271
- __privateSet(this, _portable, false);
9272
- data[9] = 255;
9273
- return super[_superWrite](data);
9118
+ /**
9119
+ * @deprecated - Encoding may only be set at instantiation time
9120
+ */
9121
+ setEncoding(_enc) {
9122
+ throw new Error("Encoding must be set at instantiation time");
9274
9123
  }
9275
- };
9276
- _portable = new WeakMap();
9277
- var Unzip = class extends Zlib {
9278
- constructor(opts) {
9279
- super(opts, "Unzip");
9124
+ /**
9125
+ * True if this is an objectMode stream
9126
+ */
9127
+ get objectMode() {
9128
+ return this[OBJECTMODE2];
9280
9129
  }
9281
- };
9282
- var Brotli = class extends ZlibBase {
9283
- constructor(opts, mode) {
9284
- opts = opts || {};
9285
- opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS;
9286
- opts.finishFlush = opts.finishFlush || constants.BROTLI_OPERATION_FINISH;
9287
- opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH;
9288
- super(opts, mode);
9130
+ /**
9131
+ * @deprecated - This is a read-only property
9132
+ */
9133
+ set objectMode(_om) {
9134
+ throw new Error("objectMode must be set at instantiation time");
9289
9135
  }
9290
- };
9291
- var BrotliCompress = class extends Brotli {
9292
- constructor(opts) {
9293
- super(opts, "BrotliCompress");
9136
+ /**
9137
+ * true if this is an async stream
9138
+ */
9139
+ get ["async"]() {
9140
+ return this[ASYNC2];
9294
9141
  }
9295
- };
9296
- var BrotliDecompress = class extends Brotli {
9297
- constructor(opts) {
9298
- super(opts, "BrotliDecompress");
9142
+ /**
9143
+ * Set to true to make this stream async.
9144
+ *
9145
+ * Once set, it cannot be unset, as this would potentially cause incorrect
9146
+ * behavior. Ie, a sync stream can be made async, but an async stream
9147
+ * cannot be safely made sync.
9148
+ */
9149
+ set ["async"](a) {
9150
+ this[ASYNC2] = this[ASYNC2] || !!a;
9299
9151
  }
9300
- };
9301
-
9302
- // node_modules/yallist/dist/esm/index.js
9303
- var Yallist = class _Yallist {
9304
- tail;
9305
- head;
9306
- length = 0;
9307
- static create(list2 = []) {
9308
- return new _Yallist(list2);
9152
+ // drop everything and get out of the flow completely
9153
+ [ABORT2]() {
9154
+ var _a, _b;
9155
+ this[ABORTED2] = true;
9156
+ this.emit("abort", (_a = this[SIGNAL2]) == null ? void 0 : _a.reason);
9157
+ this.destroy((_b = this[SIGNAL2]) == null ? void 0 : _b.reason);
9309
9158
  }
9310
- constructor(list2 = []) {
9311
- for (const item of list2) {
9312
- this.push(item);
9313
- }
9159
+ /**
9160
+ * True if the stream has been aborted.
9161
+ */
9162
+ get aborted() {
9163
+ return this[ABORTED2];
9314
9164
  }
9315
- *[Symbol.iterator]() {
9316
- for (let walker = this.head; walker; walker = walker.next) {
9317
- yield walker.value;
9318
- }
9165
+ /**
9166
+ * No-op setter. Stream aborted status is set via the AbortSignal provided
9167
+ * in the constructor options.
9168
+ */
9169
+ set aborted(_) {
9319
9170
  }
9320
- removeNode(node) {
9321
- if (node.list !== this) {
9322
- throw new Error("removing node which does not belong to this list");
9171
+ write(chunk, encoding, cb) {
9172
+ var _a;
9173
+ if (this[ABORTED2])
9174
+ return false;
9175
+ if (this[EOF2])
9176
+ throw new Error("write after end");
9177
+ if (this[DESTROYED2]) {
9178
+ this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" }));
9179
+ return true;
9323
9180
  }
9324
- const next = node.next;
9325
- const prev = node.prev;
9326
- if (next) {
9327
- next.prev = prev;
9181
+ if (typeof encoding === "function") {
9182
+ cb = encoding;
9183
+ encoding = "utf8";
9328
9184
  }
9329
- if (prev) {
9330
- prev.next = next;
9185
+ if (!encoding)
9186
+ encoding = "utf8";
9187
+ const fn = this[ASYNC2] ? defer2 : nodefer2;
9188
+ if (!this[OBJECTMODE2] && !Buffer.isBuffer(chunk)) {
9189
+ if (isArrayBufferView2(chunk)) {
9190
+ chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
9191
+ } else if (isArrayBufferLike2(chunk)) {
9192
+ chunk = Buffer.from(chunk);
9193
+ } else if (typeof chunk !== "string") {
9194
+ throw new Error("Non-contiguous data written to non-objectMode stream");
9195
+ }
9331
9196
  }
9332
- if (node === this.head) {
9333
- this.head = next;
9197
+ if (this[OBJECTMODE2]) {
9198
+ if (this[FLOWING2] && this[BUFFERLENGTH2] !== 0)
9199
+ this[FLUSH2](true);
9200
+ if (this[FLOWING2])
9201
+ this.emit("data", chunk);
9202
+ else
9203
+ this[BUFFERPUSH2](chunk);
9204
+ if (this[BUFFERLENGTH2] !== 0)
9205
+ this.emit("readable");
9206
+ if (cb)
9207
+ fn(cb);
9208
+ return this[FLOWING2];
9334
9209
  }
9335
- if (node === this.tail) {
9336
- this.tail = prev;
9210
+ if (!chunk.length) {
9211
+ if (this[BUFFERLENGTH2] !== 0)
9212
+ this.emit("readable");
9213
+ if (cb)
9214
+ fn(cb);
9215
+ return this[FLOWING2];
9337
9216
  }
9338
- this.length--;
9339
- node.next = void 0;
9340
- node.prev = void 0;
9341
- node.list = void 0;
9342
- return next;
9343
- }
9344
- unshiftNode(node) {
9345
- if (node === this.head) {
9346
- return;
9217
+ if (typeof chunk === "string" && // unless it is a string already ready for us to use
9218
+ !(encoding === this[ENCODING2] && !((_a = this[DECODER2]) == null ? void 0 : _a.lastNeed))) {
9219
+ chunk = Buffer.from(chunk, encoding);
9347
9220
  }
9348
- if (node.list) {
9349
- node.list.removeNode(node);
9221
+ if (Buffer.isBuffer(chunk) && this[ENCODING2]) {
9222
+ chunk = this[DECODER2].write(chunk);
9350
9223
  }
9351
- const head = this.head;
9352
- node.list = this;
9353
- node.next = head;
9354
- if (head) {
9355
- head.prev = node;
9224
+ if (this[FLOWING2] && this[BUFFERLENGTH2] !== 0)
9225
+ this[FLUSH2](true);
9226
+ if (this[FLOWING2])
9227
+ this.emit("data", chunk);
9228
+ else
9229
+ this[BUFFERPUSH2](chunk);
9230
+ if (this[BUFFERLENGTH2] !== 0)
9231
+ this.emit("readable");
9232
+ if (cb)
9233
+ fn(cb);
9234
+ return this[FLOWING2];
9235
+ }
9236
+ /**
9237
+ * Low-level explicit read method.
9238
+ *
9239
+ * In objectMode, the argument is ignored, and one item is returned if
9240
+ * available.
9241
+ *
9242
+ * `n` is the number of bytes (or in the case of encoding streams,
9243
+ * characters) to consume. If `n` is not provided, then the entire buffer
9244
+ * is returned, or `null` is returned if no data is available.
9245
+ *
9246
+ * If `n` is greater that the amount of data in the internal buffer,
9247
+ * then `null` is returned.
9248
+ */
9249
+ read(n) {
9250
+ if (this[DESTROYED2])
9251
+ return null;
9252
+ this[DISCARDED2] = false;
9253
+ if (this[BUFFERLENGTH2] === 0 || n === 0 || n && n > this[BUFFERLENGTH2]) {
9254
+ this[MAYBE_EMIT_END2]();
9255
+ return null;
9356
9256
  }
9357
- this.head = node;
9358
- if (!this.tail) {
9359
- this.tail = node;
9257
+ if (this[OBJECTMODE2])
9258
+ n = null;
9259
+ if (this[BUFFER2].length > 1 && !this[OBJECTMODE2]) {
9260
+ this[BUFFER2] = [
9261
+ this[ENCODING2] ? this[BUFFER2].join("") : Buffer.concat(this[BUFFER2], this[BUFFERLENGTH2])
9262
+ ];
9360
9263
  }
9361
- this.length++;
9264
+ const ret = this[READ2](n || null, this[BUFFER2][0]);
9265
+ this[MAYBE_EMIT_END2]();
9266
+ return ret;
9362
9267
  }
9363
- pushNode(node) {
9364
- if (node === this.tail) {
9365
- return;
9366
- }
9367
- if (node.list) {
9368
- node.list.removeNode(node);
9268
+ [READ2](n, chunk) {
9269
+ if (this[OBJECTMODE2])
9270
+ this[BUFFERSHIFT2]();
9271
+ else {
9272
+ const c = chunk;
9273
+ if (n === c.length || n === null)
9274
+ this[BUFFERSHIFT2]();
9275
+ else if (typeof c === "string") {
9276
+ this[BUFFER2][0] = c.slice(n);
9277
+ chunk = c.slice(0, n);
9278
+ this[BUFFERLENGTH2] -= n;
9279
+ } else {
9280
+ this[BUFFER2][0] = c.subarray(n);
9281
+ chunk = c.subarray(0, n);
9282
+ this[BUFFERLENGTH2] -= n;
9283
+ }
9369
9284
  }
9370
- const tail = this.tail;
9371
- node.list = this;
9372
- node.prev = tail;
9373
- if (tail) {
9374
- tail.next = node;
9285
+ this.emit("data", chunk);
9286
+ if (!this[BUFFER2].length && !this[EOF2])
9287
+ this.emit("drain");
9288
+ return chunk;
9289
+ }
9290
+ end(chunk, encoding, cb) {
9291
+ if (typeof chunk === "function") {
9292
+ cb = chunk;
9293
+ chunk = void 0;
9375
9294
  }
9376
- this.tail = node;
9377
- if (!this.head) {
9378
- this.head = node;
9295
+ if (typeof encoding === "function") {
9296
+ cb = encoding;
9297
+ encoding = "utf8";
9379
9298
  }
9380
- this.length++;
9299
+ if (chunk !== void 0)
9300
+ this.write(chunk, encoding);
9301
+ if (cb)
9302
+ this.once("end", cb);
9303
+ this[EOF2] = true;
9304
+ this.writable = false;
9305
+ if (this[FLOWING2] || !this[PAUSED2])
9306
+ this[MAYBE_EMIT_END2]();
9307
+ return this;
9381
9308
  }
9382
- push(...args) {
9383
- for (let i = 0, l = args.length; i < l; i++) {
9384
- push(this, args[i]);
9309
+ // don't let the internal resume be overwritten
9310
+ [RESUME2]() {
9311
+ if (this[DESTROYED2])
9312
+ return;
9313
+ if (!this[DATALISTENERS2] && !this[PIPES2].length) {
9314
+ this[DISCARDED2] = true;
9385
9315
  }
9386
- return this.length;
9316
+ this[PAUSED2] = false;
9317
+ this[FLOWING2] = true;
9318
+ this.emit("resume");
9319
+ if (this[BUFFER2].length)
9320
+ this[FLUSH2]();
9321
+ else if (this[EOF2])
9322
+ this[MAYBE_EMIT_END2]();
9323
+ else
9324
+ this.emit("drain");
9387
9325
  }
9388
- unshift(...args) {
9389
- for (var i = 0, l = args.length; i < l; i++) {
9390
- unshift(this, args[i]);
9391
- }
9392
- return this.length;
9326
+ /**
9327
+ * Resume the stream if it is currently in a paused state
9328
+ *
9329
+ * If called when there are no pipe destinations or `data` event listeners,
9330
+ * this will place the stream in a "discarded" state, where all data will
9331
+ * be thrown away. The discarded state is removed if a pipe destination or
9332
+ * data handler is added, if pause() is called, or if any synchronous or
9333
+ * asynchronous iteration is started.
9334
+ */
9335
+ resume() {
9336
+ return this[RESUME2]();
9393
9337
  }
9394
- pop() {
9395
- if (!this.tail) {
9396
- return void 0;
9397
- }
9398
- const res = this.tail.value;
9399
- const t = this.tail;
9400
- this.tail = this.tail.prev;
9401
- if (this.tail) {
9402
- this.tail.next = void 0;
9403
- } else {
9404
- this.head = void 0;
9405
- }
9406
- t.list = void 0;
9407
- this.length--;
9408
- return res;
9338
+ /**
9339
+ * Pause the stream
9340
+ */
9341
+ pause() {
9342
+ this[FLOWING2] = false;
9343
+ this[PAUSED2] = true;
9344
+ this[DISCARDED2] = false;
9409
9345
  }
9410
- shift() {
9411
- if (!this.head) {
9412
- return void 0;
9413
- }
9414
- const res = this.head.value;
9415
- const h = this.head;
9416
- this.head = this.head.next;
9417
- if (this.head) {
9418
- this.head.prev = void 0;
9419
- } else {
9420
- this.tail = void 0;
9421
- }
9422
- h.list = void 0;
9423
- this.length--;
9424
- return res;
9346
+ /**
9347
+ * true if the stream has been forcibly destroyed
9348
+ */
9349
+ get destroyed() {
9350
+ return this[DESTROYED2];
9425
9351
  }
9426
- forEach(fn, thisp) {
9427
- thisp = thisp || this;
9428
- for (let walker = this.head, i = 0; !!walker; i++) {
9429
- fn.call(thisp, walker.value, i, this);
9430
- walker = walker.next;
9431
- }
9352
+ /**
9353
+ * true if the stream is currently in a flowing state, meaning that
9354
+ * any writes will be immediately emitted.
9355
+ */
9356
+ get flowing() {
9357
+ return this[FLOWING2];
9432
9358
  }
9433
- forEachReverse(fn, thisp) {
9434
- thisp = thisp || this;
9435
- for (let walker = this.tail, i = this.length - 1; !!walker; i--) {
9436
- fn.call(thisp, walker.value, i, this);
9437
- walker = walker.prev;
9438
- }
9359
+ /**
9360
+ * true if the stream is currently in a paused state
9361
+ */
9362
+ get paused() {
9363
+ return this[PAUSED2];
9439
9364
  }
9440
- get(n) {
9441
- let i = 0;
9442
- let walker = this.head;
9443
- for (; !!walker && i < n; i++) {
9444
- walker = walker.next;
9445
- }
9446
- if (i === n && !!walker) {
9447
- return walker.value;
9448
- }
9365
+ [BUFFERPUSH2](chunk) {
9366
+ if (this[OBJECTMODE2])
9367
+ this[BUFFERLENGTH2] += 1;
9368
+ else
9369
+ this[BUFFERLENGTH2] += chunk.length;
9370
+ this[BUFFER2].push(chunk);
9449
9371
  }
9450
- getReverse(n) {
9451
- let i = 0;
9452
- let walker = this.tail;
9453
- for (; !!walker && i < n; i++) {
9454
- walker = walker.prev;
9455
- }
9456
- if (i === n && !!walker) {
9457
- return walker.value;
9458
- }
9372
+ [BUFFERSHIFT2]() {
9373
+ if (this[OBJECTMODE2])
9374
+ this[BUFFERLENGTH2] -= 1;
9375
+ else
9376
+ this[BUFFERLENGTH2] -= this[BUFFER2][0].length;
9377
+ return this[BUFFER2].shift();
9459
9378
  }
9460
- map(fn, thisp) {
9461
- thisp = thisp || this;
9462
- const res = new _Yallist();
9463
- for (let walker = this.head; !!walker; ) {
9464
- res.push(fn.call(thisp, walker.value, this));
9465
- walker = walker.next;
9466
- }
9467
- return res;
9379
+ [FLUSH2](noDrain = false) {
9380
+ do {
9381
+ } while (this[FLUSHCHUNK2](this[BUFFERSHIFT2]()) && this[BUFFER2].length);
9382
+ if (!noDrain && !this[BUFFER2].length && !this[EOF2])
9383
+ this.emit("drain");
9468
9384
  }
9469
- mapReverse(fn, thisp) {
9470
- thisp = thisp || this;
9471
- var res = new _Yallist();
9472
- for (let walker = this.tail; !!walker; ) {
9473
- res.push(fn.call(thisp, walker.value, this));
9474
- walker = walker.prev;
9475
- }
9476
- return res;
9385
+ [FLUSHCHUNK2](chunk) {
9386
+ this.emit("data", chunk);
9387
+ return this[FLOWING2];
9477
9388
  }
9478
- reduce(fn, initial) {
9479
- let acc;
9480
- let walker = this.head;
9481
- if (arguments.length > 1) {
9482
- acc = initial;
9483
- } else if (this.head) {
9484
- walker = this.head.next;
9485
- acc = this.head.value;
9389
+ /**
9390
+ * Pipe all data emitted by this stream into the destination provided.
9391
+ *
9392
+ * Triggers the flow of data.
9393
+ */
9394
+ pipe(dest, opts) {
9395
+ if (this[DESTROYED2])
9396
+ return dest;
9397
+ this[DISCARDED2] = false;
9398
+ const ended = this[EMITTED_END2];
9399
+ opts = opts || {};
9400
+ if (dest === proc2.stdout || dest === proc2.stderr)
9401
+ opts.end = false;
9402
+ else
9403
+ opts.end = opts.end !== false;
9404
+ opts.proxyErrors = !!opts.proxyErrors;
9405
+ if (ended) {
9406
+ if (opts.end)
9407
+ dest.end();
9486
9408
  } else {
9487
- throw new TypeError("Reduce of empty list with no initial value");
9488
- }
9489
- for (var i = 0; !!walker; i++) {
9490
- acc = fn(acc, walker.value, i);
9491
- walker = walker.next;
9409
+ this[PIPES2].push(!opts.proxyErrors ? new Pipe2(this, dest, opts) : new PipeProxyErrors2(this, dest, opts));
9410
+ if (this[ASYNC2])
9411
+ defer2(() => this[RESUME2]());
9412
+ else
9413
+ this[RESUME2]();
9492
9414
  }
9493
- return acc;
9415
+ return dest;
9494
9416
  }
9495
- reduceReverse(fn, initial) {
9496
- let acc;
9497
- let walker = this.tail;
9498
- if (arguments.length > 1) {
9499
- acc = initial;
9500
- } else if (this.tail) {
9501
- walker = this.tail.prev;
9502
- acc = this.tail.value;
9503
- } else {
9504
- throw new TypeError("Reduce of empty list with no initial value");
9505
- }
9506
- for (let i = this.length - 1; !!walker; i--) {
9507
- acc = fn(acc, walker.value, i);
9508
- walker = walker.prev;
9417
+ /**
9418
+ * Fully unhook a piped destination stream.
9419
+ *
9420
+ * If the destination stream was the only consumer of this stream (ie,
9421
+ * there are no other piped destinations or `'data'` event listeners)
9422
+ * then the flow of data will stop until there is another consumer or
9423
+ * {@link Minipass#resume} is explicitly called.
9424
+ */
9425
+ unpipe(dest) {
9426
+ const p = this[PIPES2].find((p2) => p2.dest === dest);
9427
+ if (p) {
9428
+ if (this[PIPES2].length === 1) {
9429
+ if (this[FLOWING2] && this[DATALISTENERS2] === 0) {
9430
+ this[FLOWING2] = false;
9431
+ }
9432
+ this[PIPES2] = [];
9433
+ } else
9434
+ this[PIPES2].splice(this[PIPES2].indexOf(p), 1);
9435
+ p.unpipe();
9509
9436
  }
9510
- return acc;
9511
9437
  }
9512
- toArray() {
9513
- const arr = new Array(this.length);
9514
- for (let i = 0, walker = this.head; !!walker; i++) {
9515
- arr[i] = walker.value;
9516
- walker = walker.next;
9517
- }
9518
- return arr;
9438
+ /**
9439
+ * Alias for {@link Minipass#on}
9440
+ */
9441
+ addListener(ev, handler) {
9442
+ return this.on(ev, handler);
9519
9443
  }
9520
- toArrayReverse() {
9521
- const arr = new Array(this.length);
9522
- for (let i = 0, walker = this.tail; !!walker; i++) {
9523
- arr[i] = walker.value;
9524
- walker = walker.prev;
9444
+ /**
9445
+ * Mostly identical to `EventEmitter.on`, with the following
9446
+ * behavior differences to prevent data loss and unnecessary hangs:
9447
+ *
9448
+ * - Adding a 'data' event handler will trigger the flow of data
9449
+ *
9450
+ * - Adding a 'readable' event handler when there is data waiting to be read
9451
+ * will cause 'readable' to be emitted immediately.
9452
+ *
9453
+ * - Adding an 'endish' event handler ('end', 'finish', etc.) which has
9454
+ * already passed will cause the event to be emitted immediately and all
9455
+ * handlers removed.
9456
+ *
9457
+ * - Adding an 'error' event handler after an error has been emitted will
9458
+ * cause the event to be re-emitted immediately with the error previously
9459
+ * raised.
9460
+ */
9461
+ on(ev, handler) {
9462
+ const ret = super.on(ev, handler);
9463
+ if (ev === "data") {
9464
+ this[DISCARDED2] = false;
9465
+ this[DATALISTENERS2]++;
9466
+ if (!this[PIPES2].length && !this[FLOWING2]) {
9467
+ this[RESUME2]();
9468
+ }
9469
+ } else if (ev === "readable" && this[BUFFERLENGTH2] !== 0) {
9470
+ super.emit("readable");
9471
+ } else if (isEndish2(ev) && this[EMITTED_END2]) {
9472
+ super.emit(ev);
9473
+ this.removeAllListeners(ev);
9474
+ } else if (ev === "error" && this[EMITTED_ERROR2]) {
9475
+ const h = handler;
9476
+ if (this[ASYNC2])
9477
+ defer2(() => h.call(this, this[EMITTED_ERROR2]));
9478
+ else
9479
+ h.call(this, this[EMITTED_ERROR2]);
9525
9480
  }
9526
- return arr;
9481
+ return ret;
9527
9482
  }
9528
- slice(from = 0, to = this.length) {
9529
- if (to < 0) {
9530
- to += this.length;
9531
- }
9532
- if (from < 0) {
9533
- from += this.length;
9534
- }
9535
- const ret = new _Yallist();
9536
- if (to < from || to < 0) {
9537
- return ret;
9538
- }
9539
- if (from < 0) {
9540
- from = 0;
9541
- }
9542
- if (to > this.length) {
9543
- to = this.length;
9544
- }
9545
- let walker = this.head;
9546
- let i = 0;
9547
- for (i = 0; !!walker && i < from; i++) {
9548
- walker = walker.next;
9549
- }
9550
- for (; !!walker && i < to; i++, walker = walker.next) {
9551
- ret.push(walker.value);
9483
+ /**
9484
+ * Alias for {@link Minipass#off}
9485
+ */
9486
+ removeListener(ev, handler) {
9487
+ return this.off(ev, handler);
9488
+ }
9489
+ /**
9490
+ * Mostly identical to `EventEmitter.off`
9491
+ *
9492
+ * If a 'data' event handler is removed, and it was the last consumer
9493
+ * (ie, there are no pipe destinations or other 'data' event listeners),
9494
+ * then the flow of data will stop until there is another consumer or
9495
+ * {@link Minipass#resume} is explicitly called.
9496
+ */
9497
+ off(ev, handler) {
9498
+ const ret = super.off(ev, handler);
9499
+ if (ev === "data") {
9500
+ this[DATALISTENERS2] = this.listeners("data").length;
9501
+ if (this[DATALISTENERS2] === 0 && !this[DISCARDED2] && !this[PIPES2].length) {
9502
+ this[FLOWING2] = false;
9503
+ }
9552
9504
  }
9553
9505
  return ret;
9554
9506
  }
9555
- sliceReverse(from = 0, to = this.length) {
9556
- if (to < 0) {
9557
- to += this.length;
9558
- }
9559
- if (from < 0) {
9560
- from += this.length;
9561
- }
9562
- const ret = new _Yallist();
9563
- if (to < from || to < 0) {
9564
- return ret;
9565
- }
9566
- if (from < 0) {
9567
- from = 0;
9568
- }
9569
- if (to > this.length) {
9570
- to = this.length;
9571
- }
9572
- let i = this.length;
9573
- let walker = this.tail;
9574
- for (; !!walker && i > to; i--) {
9575
- walker = walker.prev;
9576
- }
9577
- for (; !!walker && i > from; i--, walker = walker.prev) {
9578
- ret.push(walker.value);
9507
+ /**
9508
+ * Mostly identical to `EventEmitter.removeAllListeners`
9509
+ *
9510
+ * If all 'data' event handlers are removed, and they were the last consumer
9511
+ * (ie, there are no pipe destinations), then the flow of data will stop
9512
+ * until there is another consumer or {@link Minipass#resume} is explicitly
9513
+ * called.
9514
+ */
9515
+ removeAllListeners(ev) {
9516
+ const ret = super.removeAllListeners(ev);
9517
+ if (ev === "data" || ev === void 0) {
9518
+ this[DATALISTENERS2] = 0;
9519
+ if (!this[DISCARDED2] && !this[PIPES2].length) {
9520
+ this[FLOWING2] = false;
9521
+ }
9579
9522
  }
9580
9523
  return ret;
9581
9524
  }
9582
- splice(start, deleteCount = 0, ...nodes) {
9583
- if (start > this.length) {
9584
- start = this.length - 1;
9585
- }
9586
- if (start < 0) {
9587
- start = this.length + start;
9588
- }
9589
- let walker = this.head;
9590
- for (let i = 0; !!walker && i < start; i++) {
9591
- walker = walker.next;
9592
- }
9593
- const ret = [];
9594
- for (let i = 0; !!walker && i < deleteCount; i++) {
9595
- ret.push(walker.value);
9596
- walker = this.removeNode(walker);
9597
- }
9598
- if (!walker) {
9599
- walker = this.tail;
9600
- } else if (walker !== this.tail) {
9601
- walker = walker.prev;
9525
+ /**
9526
+ * true if the 'end' event has been emitted
9527
+ */
9528
+ get emittedEnd() {
9529
+ return this[EMITTED_END2];
9530
+ }
9531
+ [MAYBE_EMIT_END2]() {
9532
+ if (!this[EMITTING_END2] && !this[EMITTED_END2] && !this[DESTROYED2] && this[BUFFER2].length === 0 && this[EOF2]) {
9533
+ this[EMITTING_END2] = true;
9534
+ this.emit("end");
9535
+ this.emit("prefinish");
9536
+ this.emit("finish");
9537
+ if (this[CLOSED2])
9538
+ this.emit("close");
9539
+ this[EMITTING_END2] = false;
9602
9540
  }
9603
- for (const v of nodes) {
9604
- walker = insertAfter(this, walker, v);
9541
+ }
9542
+ /**
9543
+ * Mostly identical to `EventEmitter.emit`, with the following
9544
+ * behavior differences to prevent data loss and unnecessary hangs:
9545
+ *
9546
+ * If the stream has been destroyed, and the event is something other
9547
+ * than 'close' or 'error', then `false` is returned and no handlers
9548
+ * are called.
9549
+ *
9550
+ * If the event is 'end', and has already been emitted, then the event
9551
+ * is ignored. If the stream is in a paused or non-flowing state, then
9552
+ * the event will be deferred until data flow resumes. If the stream is
9553
+ * async, then handlers will be called on the next tick rather than
9554
+ * immediately.
9555
+ *
9556
+ * If the event is 'close', and 'end' has not yet been emitted, then
9557
+ * the event will be deferred until after 'end' is emitted.
9558
+ *
9559
+ * If the event is 'error', and an AbortSignal was provided for the stream,
9560
+ * and there are no listeners, then the event is ignored, matching the
9561
+ * behavior of node core streams in the presense of an AbortSignal.
9562
+ *
9563
+ * If the event is 'finish' or 'prefinish', then all listeners will be
9564
+ * removed after emitting the event, to prevent double-firing.
9565
+ */
9566
+ emit(ev, ...args) {
9567
+ const data = args[0];
9568
+ if (ev !== "error" && ev !== "close" && ev !== DESTROYED2 && this[DESTROYED2]) {
9569
+ return false;
9570
+ } else if (ev === "data") {
9571
+ return !this[OBJECTMODE2] && !data ? false : this[ASYNC2] ? (defer2(() => this[EMITDATA2](data)), true) : this[EMITDATA2](data);
9572
+ } else if (ev === "end") {
9573
+ return this[EMITEND3]();
9574
+ } else if (ev === "close") {
9575
+ this[CLOSED2] = true;
9576
+ if (!this[EMITTED_END2] && !this[DESTROYED2])
9577
+ return false;
9578
+ const ret2 = super.emit("close");
9579
+ this.removeAllListeners("close");
9580
+ return ret2;
9581
+ } else if (ev === "error") {
9582
+ this[EMITTED_ERROR2] = data;
9583
+ super.emit(ERROR2, data);
9584
+ const ret2 = !this[SIGNAL2] || this.listeners("error").length ? super.emit("error", data) : false;
9585
+ this[MAYBE_EMIT_END2]();
9586
+ return ret2;
9587
+ } else if (ev === "resume") {
9588
+ const ret2 = super.emit("resume");
9589
+ this[MAYBE_EMIT_END2]();
9590
+ return ret2;
9591
+ } else if (ev === "finish" || ev === "prefinish") {
9592
+ const ret2 = super.emit(ev);
9593
+ this.removeAllListeners(ev);
9594
+ return ret2;
9605
9595
  }
9596
+ const ret = super.emit(ev, ...args);
9597
+ this[MAYBE_EMIT_END2]();
9606
9598
  return ret;
9607
9599
  }
9608
- reverse() {
9609
- const head = this.head;
9610
- const tail = this.tail;
9611
- for (let walker = head; !!walker; walker = walker.prev) {
9612
- const p = walker.prev;
9613
- walker.prev = walker.next;
9614
- walker.next = p;
9600
+ [EMITDATA2](data) {
9601
+ for (const p of this[PIPES2]) {
9602
+ if (p.dest.write(data) === false)
9603
+ this.pause();
9615
9604
  }
9616
- this.head = tail;
9617
- this.tail = head;
9618
- return this;
9605
+ const ret = this[DISCARDED2] ? false : super.emit("data", data);
9606
+ this[MAYBE_EMIT_END2]();
9607
+ return ret;
9619
9608
  }
9620
- };
9621
- function insertAfter(self, node, value) {
9622
- const prev = node;
9623
- const next = node ? node.next : self.head;
9624
- const inserted = new Node2(value, prev, next, self);
9625
- if (inserted.next === void 0) {
9626
- self.tail = inserted;
9609
+ [EMITEND3]() {
9610
+ if (this[EMITTED_END2])
9611
+ return false;
9612
+ this[EMITTED_END2] = true;
9613
+ this.readable = false;
9614
+ return this[ASYNC2] ? (defer2(() => this[EMITEND22]()), true) : this[EMITEND22]();
9627
9615
  }
9628
- if (inserted.prev === void 0) {
9629
- self.head = inserted;
9616
+ [EMITEND22]() {
9617
+ if (this[DECODER2]) {
9618
+ const data = this[DECODER2].end();
9619
+ if (data) {
9620
+ for (const p of this[PIPES2]) {
9621
+ p.dest.write(data);
9622
+ }
9623
+ if (!this[DISCARDED2])
9624
+ super.emit("data", data);
9625
+ }
9626
+ }
9627
+ for (const p of this[PIPES2]) {
9628
+ p.end();
9629
+ }
9630
+ const ret = super.emit("end");
9631
+ this.removeAllListeners("end");
9632
+ return ret;
9630
9633
  }
9631
- self.length++;
9632
- return inserted;
9633
- }
9634
- function push(self, item) {
9635
- self.tail = new Node2(item, self.tail, void 0, self);
9634
+ /**
9635
+ * Return a Promise that resolves to an array of all emitted data once
9636
+ * the stream ends.
9637
+ */
9638
+ async collect() {
9639
+ const buf = Object.assign([], {
9640
+ dataLength: 0
9641
+ });
9642
+ if (!this[OBJECTMODE2])
9643
+ buf.dataLength = 0;
9644
+ const p = this.promise();
9645
+ this.on("data", (c) => {
9646
+ buf.push(c);
9647
+ if (!this[OBJECTMODE2])
9648
+ buf.dataLength += c.length;
9649
+ });
9650
+ await p;
9651
+ return buf;
9652
+ }
9653
+ /**
9654
+ * Return a Promise that resolves to the concatenation of all emitted data
9655
+ * once the stream ends.
9656
+ *
9657
+ * Not allowed on objectMode streams.
9658
+ */
9659
+ async concat() {
9660
+ if (this[OBJECTMODE2]) {
9661
+ throw new Error("cannot concat in objectMode");
9662
+ }
9663
+ const buf = await this.collect();
9664
+ return this[ENCODING2] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
9665
+ }
9666
+ /**
9667
+ * Return a void Promise that resolves once the stream ends.
9668
+ */
9669
+ async promise() {
9670
+ return new Promise((resolve2, reject) => {
9671
+ this.on(DESTROYED2, () => reject(new Error("stream destroyed")));
9672
+ this.on("error", (er) => reject(er));
9673
+ this.on("end", () => resolve2());
9674
+ });
9675
+ }
9676
+ /**
9677
+ * Asynchronous `for await of` iteration.
9678
+ *
9679
+ * This will continue emitting all chunks until the stream terminates.
9680
+ */
9681
+ [Symbol.asyncIterator]() {
9682
+ this[DISCARDED2] = false;
9683
+ let stopped = false;
9684
+ const stop = async () => {
9685
+ this.pause();
9686
+ stopped = true;
9687
+ return { value: void 0, done: true };
9688
+ };
9689
+ const next = () => {
9690
+ if (stopped)
9691
+ return stop();
9692
+ const res = this.read();
9693
+ if (res !== null)
9694
+ return Promise.resolve({ done: false, value: res });
9695
+ if (this[EOF2])
9696
+ return stop();
9697
+ let resolve2;
9698
+ let reject;
9699
+ const onerr = (er) => {
9700
+ this.off("data", ondata);
9701
+ this.off("end", onend);
9702
+ this.off(DESTROYED2, ondestroy);
9703
+ stop();
9704
+ reject(er);
9705
+ };
9706
+ const ondata = (value) => {
9707
+ this.off("error", onerr);
9708
+ this.off("end", onend);
9709
+ this.off(DESTROYED2, ondestroy);
9710
+ this.pause();
9711
+ resolve2({ value, done: !!this[EOF2] });
9712
+ };
9713
+ const onend = () => {
9714
+ this.off("error", onerr);
9715
+ this.off("data", ondata);
9716
+ this.off(DESTROYED2, ondestroy);
9717
+ stop();
9718
+ resolve2({ done: true, value: void 0 });
9719
+ };
9720
+ const ondestroy = () => onerr(new Error("stream destroyed"));
9721
+ return new Promise((res2, rej) => {
9722
+ reject = rej;
9723
+ resolve2 = res2;
9724
+ this.once(DESTROYED2, ondestroy);
9725
+ this.once("error", onerr);
9726
+ this.once("end", onend);
9727
+ this.once("data", ondata);
9728
+ });
9729
+ };
9730
+ return {
9731
+ next,
9732
+ throw: stop,
9733
+ return: stop,
9734
+ [Symbol.asyncIterator]() {
9735
+ return this;
9736
+ }
9737
+ };
9738
+ }
9739
+ /**
9740
+ * Synchronous `for of` iteration.
9741
+ *
9742
+ * The iteration will terminate when the internal buffer runs out, even
9743
+ * if the stream has not yet terminated.
9744
+ */
9745
+ [Symbol.iterator]() {
9746
+ this[DISCARDED2] = false;
9747
+ let stopped = false;
9748
+ const stop = () => {
9749
+ this.pause();
9750
+ this.off(ERROR2, stop);
9751
+ this.off(DESTROYED2, stop);
9752
+ this.off("end", stop);
9753
+ stopped = true;
9754
+ return { done: true, value: void 0 };
9755
+ };
9756
+ const next = () => {
9757
+ if (stopped)
9758
+ return stop();
9759
+ const value = this.read();
9760
+ return value === null ? stop() : { done: false, value };
9761
+ };
9762
+ this.once("end", stop);
9763
+ this.once(ERROR2, stop);
9764
+ this.once(DESTROYED2, stop);
9765
+ return {
9766
+ next,
9767
+ throw: stop,
9768
+ return: stop,
9769
+ [Symbol.iterator]() {
9770
+ return this;
9771
+ }
9772
+ };
9773
+ }
9774
+ /**
9775
+ * Destroy a stream, preventing it from being used for any further purpose.
9776
+ *
9777
+ * If the stream has a `close()` method, then it will be called on
9778
+ * destruction.
9779
+ *
9780
+ * After destruction, any attempt to write data, read data, or emit most
9781
+ * events will be ignored.
9782
+ *
9783
+ * If an error argument is provided, then it will be emitted in an
9784
+ * 'error' event.
9785
+ */
9786
+ destroy(er) {
9787
+ if (this[DESTROYED2]) {
9788
+ if (er)
9789
+ this.emit("error", er);
9790
+ else
9791
+ this.emit(DESTROYED2);
9792
+ return this;
9793
+ }
9794
+ this[DESTROYED2] = true;
9795
+ this[DISCARDED2] = true;
9796
+ this[BUFFER2].length = 0;
9797
+ this[BUFFERLENGTH2] = 0;
9798
+ const wc = this;
9799
+ if (typeof wc.close === "function" && !this[CLOSED2])
9800
+ wc.close();
9801
+ if (er)
9802
+ this.emit("error", er);
9803
+ else
9804
+ this.emit(DESTROYED2);
9805
+ return this;
9806
+ }
9807
+ /**
9808
+ * Alias for {@link isStream}
9809
+ *
9810
+ * Former export location, maintained for backwards compatibility.
9811
+ *
9812
+ * @deprecated
9813
+ */
9814
+ static get isStream() {
9815
+ return isStream2;
9816
+ }
9817
+ };
9818
+
9819
+ // node_modules/minizlib/dist/esm/index.js
9820
+ import realZlib2 from "zlib";
9821
+
9822
+ // node_modules/minizlib/dist/esm/constants.js
9823
+ import realZlib from "zlib";
9824
+ var realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 };
9825
+ var constants = Object.freeze(Object.assign(/* @__PURE__ */ Object.create(null), {
9826
+ Z_NO_FLUSH: 0,
9827
+ Z_PARTIAL_FLUSH: 1,
9828
+ Z_SYNC_FLUSH: 2,
9829
+ Z_FULL_FLUSH: 3,
9830
+ Z_FINISH: 4,
9831
+ Z_BLOCK: 5,
9832
+ Z_OK: 0,
9833
+ Z_STREAM_END: 1,
9834
+ Z_NEED_DICT: 2,
9835
+ Z_ERRNO: -1,
9836
+ Z_STREAM_ERROR: -2,
9837
+ Z_DATA_ERROR: -3,
9838
+ Z_MEM_ERROR: -4,
9839
+ Z_BUF_ERROR: -5,
9840
+ Z_VERSION_ERROR: -6,
9841
+ Z_NO_COMPRESSION: 0,
9842
+ Z_BEST_SPEED: 1,
9843
+ Z_BEST_COMPRESSION: 9,
9844
+ Z_DEFAULT_COMPRESSION: -1,
9845
+ Z_FILTERED: 1,
9846
+ Z_HUFFMAN_ONLY: 2,
9847
+ Z_RLE: 3,
9848
+ Z_FIXED: 4,
9849
+ Z_DEFAULT_STRATEGY: 0,
9850
+ DEFLATE: 1,
9851
+ INFLATE: 2,
9852
+ GZIP: 3,
9853
+ GUNZIP: 4,
9854
+ DEFLATERAW: 5,
9855
+ INFLATERAW: 6,
9856
+ UNZIP: 7,
9857
+ BROTLI_DECODE: 8,
9858
+ BROTLI_ENCODE: 9,
9859
+ Z_MIN_WINDOWBITS: 8,
9860
+ Z_MAX_WINDOWBITS: 15,
9861
+ Z_DEFAULT_WINDOWBITS: 15,
9862
+ Z_MIN_CHUNK: 64,
9863
+ Z_MAX_CHUNK: Infinity,
9864
+ Z_DEFAULT_CHUNK: 16384,
9865
+ Z_MIN_MEMLEVEL: 1,
9866
+ Z_MAX_MEMLEVEL: 9,
9867
+ Z_DEFAULT_MEMLEVEL: 8,
9868
+ Z_MIN_LEVEL: -1,
9869
+ Z_MAX_LEVEL: 9,
9870
+ Z_DEFAULT_LEVEL: -1,
9871
+ BROTLI_OPERATION_PROCESS: 0,
9872
+ BROTLI_OPERATION_FLUSH: 1,
9873
+ BROTLI_OPERATION_FINISH: 2,
9874
+ BROTLI_OPERATION_EMIT_METADATA: 3,
9875
+ BROTLI_MODE_GENERIC: 0,
9876
+ BROTLI_MODE_TEXT: 1,
9877
+ BROTLI_MODE_FONT: 2,
9878
+ BROTLI_DEFAULT_MODE: 0,
9879
+ BROTLI_MIN_QUALITY: 0,
9880
+ BROTLI_MAX_QUALITY: 11,
9881
+ BROTLI_DEFAULT_QUALITY: 11,
9882
+ BROTLI_MIN_WINDOW_BITS: 10,
9883
+ BROTLI_MAX_WINDOW_BITS: 24,
9884
+ BROTLI_LARGE_MAX_WINDOW_BITS: 30,
9885
+ BROTLI_DEFAULT_WINDOW: 22,
9886
+ BROTLI_MIN_INPUT_BLOCK_BITS: 16,
9887
+ BROTLI_MAX_INPUT_BLOCK_BITS: 24,
9888
+ BROTLI_PARAM_MODE: 0,
9889
+ BROTLI_PARAM_QUALITY: 1,
9890
+ BROTLI_PARAM_LGWIN: 2,
9891
+ BROTLI_PARAM_LGBLOCK: 3,
9892
+ BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
9893
+ BROTLI_PARAM_SIZE_HINT: 5,
9894
+ BROTLI_PARAM_LARGE_WINDOW: 6,
9895
+ BROTLI_PARAM_NPOSTFIX: 7,
9896
+ BROTLI_PARAM_NDIRECT: 8,
9897
+ BROTLI_DECODER_RESULT_ERROR: 0,
9898
+ BROTLI_DECODER_RESULT_SUCCESS: 1,
9899
+ BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
9900
+ BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
9901
+ BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
9902
+ BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
9903
+ BROTLI_DECODER_NO_ERROR: 0,
9904
+ BROTLI_DECODER_SUCCESS: 1,
9905
+ BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
9906
+ BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
9907
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
9908
+ BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
9909
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
9910
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
9911
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
9912
+ BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
9913
+ BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
9914
+ BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
9915
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
9916
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
9917
+ BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
9918
+ BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
9919
+ BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
9920
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
9921
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
9922
+ BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
9923
+ BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
9924
+ BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
9925
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
9926
+ BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
9927
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
9928
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
9929
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
9930
+ BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
9931
+ BROTLI_DECODER_ERROR_UNREACHABLE: -31
9932
+ }, realZlibConstants));
9933
+
9934
+ // node_modules/minizlib/dist/esm/index.js
9935
+ var OriginalBufferConcat = Buffer2.concat;
9936
+ var _superWrite = Symbol("_superWrite");
9937
+ var ZlibError = class extends Error {
9938
+ code;
9939
+ errno;
9940
+ constructor(err) {
9941
+ super("zlib: " + err.message);
9942
+ this.code = err.code;
9943
+ this.errno = err.errno;
9944
+ if (!this.code)
9945
+ this.code = "ZLIB_ERROR";
9946
+ this.message = "zlib: " + err.message;
9947
+ Error.captureStackTrace(this, this.constructor);
9948
+ }
9949
+ get name() {
9950
+ return "ZlibError";
9951
+ }
9952
+ };
9953
+ var _flushFlag = Symbol("flushFlag");
9954
+ var _sawError, _ended3, _flushFlag2, _finishFlushFlag, _fullFlushFlag, _handle, _onError;
9955
+ var ZlibBase = class extends Minipass2 {
9956
+ /* c8 ignore stop */
9957
+ constructor(opts, mode) {
9958
+ var _a;
9959
+ if (!opts || typeof opts !== "object")
9960
+ throw new TypeError("invalid options for ZlibBase constructor");
9961
+ super(opts);
9962
+ __privateAdd(this, _sawError, false);
9963
+ __privateAdd(this, _ended3, false);
9964
+ __privateAdd(this, _flushFlag2);
9965
+ __privateAdd(this, _finishFlushFlag);
9966
+ __privateAdd(this, _fullFlushFlag);
9967
+ __privateAdd(this, _handle);
9968
+ __privateAdd(this, _onError);
9969
+ __privateSet(this, _flushFlag2, opts.flush ?? 0);
9970
+ __privateSet(this, _finishFlushFlag, opts.finishFlush ?? 0);
9971
+ __privateSet(this, _fullFlushFlag, opts.fullFlushFlag ?? 0);
9972
+ try {
9973
+ __privateSet(this, _handle, new realZlib2[mode](opts));
9974
+ } catch (er) {
9975
+ throw new ZlibError(er);
9976
+ }
9977
+ __privateSet(this, _onError, (err) => {
9978
+ if (__privateGet(this, _sawError))
9979
+ return;
9980
+ __privateSet(this, _sawError, true);
9981
+ this.close();
9982
+ this.emit("error", err);
9983
+ });
9984
+ (_a = __privateGet(this, _handle)) == null ? void 0 : _a.on("error", (er) => __privateGet(this, _onError).call(this, new ZlibError(er)));
9985
+ this.once("end", () => this.close);
9986
+ }
9987
+ get sawError() {
9988
+ return __privateGet(this, _sawError);
9989
+ }
9990
+ get handle() {
9991
+ return __privateGet(this, _handle);
9992
+ }
9993
+ /* c8 ignore start */
9994
+ get flushFlag() {
9995
+ return __privateGet(this, _flushFlag2);
9996
+ }
9997
+ close() {
9998
+ if (__privateGet(this, _handle)) {
9999
+ __privateGet(this, _handle).close();
10000
+ __privateSet(this, _handle, void 0);
10001
+ this.emit("close");
10002
+ }
10003
+ }
10004
+ reset() {
10005
+ var _a, _b;
10006
+ if (!__privateGet(this, _sawError)) {
10007
+ assert(__privateGet(this, _handle), "zlib binding closed");
10008
+ return (_b = (_a = __privateGet(this, _handle)).reset) == null ? void 0 : _b.call(_a);
10009
+ }
10010
+ }
10011
+ flush(flushFlag) {
10012
+ if (this.ended)
10013
+ return;
10014
+ if (typeof flushFlag !== "number")
10015
+ flushFlag = __privateGet(this, _fullFlushFlag);
10016
+ this.write(Object.assign(Buffer2.alloc(0), { [_flushFlag]: flushFlag }));
10017
+ }
10018
+ end(chunk, encoding, cb) {
10019
+ if (typeof chunk === "function") {
10020
+ cb = chunk;
10021
+ encoding = void 0;
10022
+ chunk = void 0;
10023
+ }
10024
+ if (typeof encoding === "function") {
10025
+ cb = encoding;
10026
+ encoding = void 0;
10027
+ }
10028
+ if (chunk) {
10029
+ if (encoding)
10030
+ this.write(chunk, encoding);
10031
+ else
10032
+ this.write(chunk);
10033
+ }
10034
+ this.flush(__privateGet(this, _finishFlushFlag));
10035
+ __privateSet(this, _ended3, true);
10036
+ return super.end(cb);
10037
+ }
10038
+ get ended() {
10039
+ return __privateGet(this, _ended3);
10040
+ }
10041
+ // overridden in the gzip classes to do portable writes
10042
+ [_superWrite](data) {
10043
+ return super.write(data);
10044
+ }
10045
+ write(chunk, encoding, cb) {
10046
+ if (typeof encoding === "function")
10047
+ cb = encoding, encoding = "utf8";
10048
+ if (typeof chunk === "string")
10049
+ chunk = Buffer2.from(chunk, encoding);
10050
+ if (__privateGet(this, _sawError))
10051
+ return;
10052
+ assert(__privateGet(this, _handle), "zlib binding closed");
10053
+ const nativeHandle = __privateGet(this, _handle)._handle;
10054
+ const originalNativeClose = nativeHandle.close;
10055
+ nativeHandle.close = () => {
10056
+ };
10057
+ const originalClose = __privateGet(this, _handle).close;
10058
+ __privateGet(this, _handle).close = () => {
10059
+ };
10060
+ Buffer2.concat = (args) => args;
10061
+ let result = void 0;
10062
+ try {
10063
+ const flushFlag = typeof chunk[_flushFlag] === "number" ? chunk[_flushFlag] : __privateGet(this, _flushFlag2);
10064
+ result = __privateGet(this, _handle)._processChunk(chunk, flushFlag);
10065
+ Buffer2.concat = OriginalBufferConcat;
10066
+ } catch (err) {
10067
+ Buffer2.concat = OriginalBufferConcat;
10068
+ __privateGet(this, _onError).call(this, new ZlibError(err));
10069
+ } finally {
10070
+ if (__privateGet(this, _handle)) {
10071
+ ;
10072
+ __privateGet(this, _handle)._handle = nativeHandle;
10073
+ nativeHandle.close = originalNativeClose;
10074
+ __privateGet(this, _handle).close = originalClose;
10075
+ __privateGet(this, _handle).removeAllListeners("error");
10076
+ }
10077
+ }
10078
+ if (__privateGet(this, _handle))
10079
+ __privateGet(this, _handle).on("error", (er) => __privateGet(this, _onError).call(this, new ZlibError(er)));
10080
+ let writeReturn;
10081
+ if (result) {
10082
+ if (Array.isArray(result) && result.length > 0) {
10083
+ const r = result[0];
10084
+ writeReturn = this[_superWrite](Buffer2.from(r));
10085
+ for (let i = 1; i < result.length; i++) {
10086
+ writeReturn = this[_superWrite](result[i]);
10087
+ }
10088
+ } else {
10089
+ writeReturn = this[_superWrite](Buffer2.from(result));
10090
+ }
10091
+ }
10092
+ if (cb)
10093
+ cb();
10094
+ return writeReturn;
10095
+ }
10096
+ };
10097
+ _sawError = new WeakMap();
10098
+ _ended3 = new WeakMap();
10099
+ _flushFlag2 = new WeakMap();
10100
+ _finishFlushFlag = new WeakMap();
10101
+ _fullFlushFlag = new WeakMap();
10102
+ _handle = new WeakMap();
10103
+ _onError = new WeakMap();
10104
+ var _level, _strategy;
10105
+ var Zlib = class extends ZlibBase {
10106
+ constructor(opts, mode) {
10107
+ opts = opts || {};
10108
+ opts.flush = opts.flush || constants.Z_NO_FLUSH;
10109
+ opts.finishFlush = opts.finishFlush || constants.Z_FINISH;
10110
+ opts.fullFlushFlag = constants.Z_FULL_FLUSH;
10111
+ super(opts, mode);
10112
+ __privateAdd(this, _level);
10113
+ __privateAdd(this, _strategy);
10114
+ __privateSet(this, _level, opts.level);
10115
+ __privateSet(this, _strategy, opts.strategy);
10116
+ }
10117
+ params(level, strategy) {
10118
+ if (this.sawError)
10119
+ return;
10120
+ if (!this.handle)
10121
+ throw new Error("cannot switch params when binding is closed");
10122
+ if (!this.handle.params)
10123
+ throw new Error("not supported in this implementation");
10124
+ if (__privateGet(this, _level) !== level || __privateGet(this, _strategy) !== strategy) {
10125
+ this.flush(constants.Z_SYNC_FLUSH);
10126
+ assert(this.handle, "zlib binding closed");
10127
+ const origFlush = this.handle.flush;
10128
+ this.handle.flush = (flushFlag, cb) => {
10129
+ if (typeof flushFlag === "function") {
10130
+ cb = flushFlag;
10131
+ flushFlag = this.flushFlag;
10132
+ }
10133
+ this.flush(flushFlag);
10134
+ cb == null ? void 0 : cb();
10135
+ };
10136
+ try {
10137
+ ;
10138
+ this.handle.params(level, strategy);
10139
+ } finally {
10140
+ this.handle.flush = origFlush;
10141
+ }
10142
+ if (this.handle) {
10143
+ __privateSet(this, _level, level);
10144
+ __privateSet(this, _strategy, strategy);
10145
+ }
10146
+ }
10147
+ }
10148
+ };
10149
+ _level = new WeakMap();
10150
+ _strategy = new WeakMap();
10151
+ var _portable;
10152
+ var Gzip = class extends Zlib {
10153
+ constructor(opts) {
10154
+ super(opts, "Gzip");
10155
+ __privateAdd(this, _portable);
10156
+ __privateSet(this, _portable, opts && !!opts.portable);
10157
+ }
10158
+ [_superWrite](data) {
10159
+ if (!__privateGet(this, _portable))
10160
+ return super[_superWrite](data);
10161
+ __privateSet(this, _portable, false);
10162
+ data[9] = 255;
10163
+ return super[_superWrite](data);
10164
+ }
10165
+ };
10166
+ _portable = new WeakMap();
10167
+ var Unzip = class extends Zlib {
10168
+ constructor(opts) {
10169
+ super(opts, "Unzip");
10170
+ }
10171
+ };
10172
+ var Brotli = class extends ZlibBase {
10173
+ constructor(opts, mode) {
10174
+ opts = opts || {};
10175
+ opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS;
10176
+ opts.finishFlush = opts.finishFlush || constants.BROTLI_OPERATION_FINISH;
10177
+ opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH;
10178
+ super(opts, mode);
10179
+ }
10180
+ };
10181
+ var BrotliCompress = class extends Brotli {
10182
+ constructor(opts) {
10183
+ super(opts, "BrotliCompress");
10184
+ }
10185
+ };
10186
+ var BrotliDecompress = class extends Brotli {
10187
+ constructor(opts) {
10188
+ super(opts, "BrotliDecompress");
10189
+ }
10190
+ };
10191
+
10192
+ // node_modules/tar/node_modules/yallist/dist/esm/index.js
10193
+ var Yallist = class _Yallist {
10194
+ tail;
10195
+ head;
10196
+ length = 0;
10197
+ static create(list2 = []) {
10198
+ return new _Yallist(list2);
10199
+ }
10200
+ constructor(list2 = []) {
10201
+ for (const item of list2) {
10202
+ this.push(item);
10203
+ }
10204
+ }
10205
+ *[Symbol.iterator]() {
10206
+ for (let walker = this.head; walker; walker = walker.next) {
10207
+ yield walker.value;
10208
+ }
10209
+ }
10210
+ removeNode(node) {
10211
+ if (node.list !== this) {
10212
+ throw new Error("removing node which does not belong to this list");
10213
+ }
10214
+ const next = node.next;
10215
+ const prev = node.prev;
10216
+ if (next) {
10217
+ next.prev = prev;
10218
+ }
10219
+ if (prev) {
10220
+ prev.next = next;
10221
+ }
10222
+ if (node === this.head) {
10223
+ this.head = next;
10224
+ }
10225
+ if (node === this.tail) {
10226
+ this.tail = prev;
10227
+ }
10228
+ this.length--;
10229
+ node.next = void 0;
10230
+ node.prev = void 0;
10231
+ node.list = void 0;
10232
+ return next;
10233
+ }
10234
+ unshiftNode(node) {
10235
+ if (node === this.head) {
10236
+ return;
10237
+ }
10238
+ if (node.list) {
10239
+ node.list.removeNode(node);
10240
+ }
10241
+ const head = this.head;
10242
+ node.list = this;
10243
+ node.next = head;
10244
+ if (head) {
10245
+ head.prev = node;
10246
+ }
10247
+ this.head = node;
10248
+ if (!this.tail) {
10249
+ this.tail = node;
10250
+ }
10251
+ this.length++;
10252
+ }
10253
+ pushNode(node) {
10254
+ if (node === this.tail) {
10255
+ return;
10256
+ }
10257
+ if (node.list) {
10258
+ node.list.removeNode(node);
10259
+ }
10260
+ const tail = this.tail;
10261
+ node.list = this;
10262
+ node.prev = tail;
10263
+ if (tail) {
10264
+ tail.next = node;
10265
+ }
10266
+ this.tail = node;
10267
+ if (!this.head) {
10268
+ this.head = node;
10269
+ }
10270
+ this.length++;
10271
+ }
10272
+ push(...args) {
10273
+ for (let i = 0, l = args.length; i < l; i++) {
10274
+ push(this, args[i]);
10275
+ }
10276
+ return this.length;
10277
+ }
10278
+ unshift(...args) {
10279
+ for (var i = 0, l = args.length; i < l; i++) {
10280
+ unshift(this, args[i]);
10281
+ }
10282
+ return this.length;
10283
+ }
10284
+ pop() {
10285
+ if (!this.tail) {
10286
+ return void 0;
10287
+ }
10288
+ const res = this.tail.value;
10289
+ const t = this.tail;
10290
+ this.tail = this.tail.prev;
10291
+ if (this.tail) {
10292
+ this.tail.next = void 0;
10293
+ } else {
10294
+ this.head = void 0;
10295
+ }
10296
+ t.list = void 0;
10297
+ this.length--;
10298
+ return res;
10299
+ }
10300
+ shift() {
10301
+ if (!this.head) {
10302
+ return void 0;
10303
+ }
10304
+ const res = this.head.value;
10305
+ const h = this.head;
10306
+ this.head = this.head.next;
10307
+ if (this.head) {
10308
+ this.head.prev = void 0;
10309
+ } else {
10310
+ this.tail = void 0;
10311
+ }
10312
+ h.list = void 0;
10313
+ this.length--;
10314
+ return res;
10315
+ }
10316
+ forEach(fn, thisp) {
10317
+ thisp = thisp || this;
10318
+ for (let walker = this.head, i = 0; !!walker; i++) {
10319
+ fn.call(thisp, walker.value, i, this);
10320
+ walker = walker.next;
10321
+ }
10322
+ }
10323
+ forEachReverse(fn, thisp) {
10324
+ thisp = thisp || this;
10325
+ for (let walker = this.tail, i = this.length - 1; !!walker; i--) {
10326
+ fn.call(thisp, walker.value, i, this);
10327
+ walker = walker.prev;
10328
+ }
10329
+ }
10330
+ get(n) {
10331
+ let i = 0;
10332
+ let walker = this.head;
10333
+ for (; !!walker && i < n; i++) {
10334
+ walker = walker.next;
10335
+ }
10336
+ if (i === n && !!walker) {
10337
+ return walker.value;
10338
+ }
10339
+ }
10340
+ getReverse(n) {
10341
+ let i = 0;
10342
+ let walker = this.tail;
10343
+ for (; !!walker && i < n; i++) {
10344
+ walker = walker.prev;
10345
+ }
10346
+ if (i === n && !!walker) {
10347
+ return walker.value;
10348
+ }
10349
+ }
10350
+ map(fn, thisp) {
10351
+ thisp = thisp || this;
10352
+ const res = new _Yallist();
10353
+ for (let walker = this.head; !!walker; ) {
10354
+ res.push(fn.call(thisp, walker.value, this));
10355
+ walker = walker.next;
10356
+ }
10357
+ return res;
10358
+ }
10359
+ mapReverse(fn, thisp) {
10360
+ thisp = thisp || this;
10361
+ var res = new _Yallist();
10362
+ for (let walker = this.tail; !!walker; ) {
10363
+ res.push(fn.call(thisp, walker.value, this));
10364
+ walker = walker.prev;
10365
+ }
10366
+ return res;
10367
+ }
10368
+ reduce(fn, initial) {
10369
+ let acc;
10370
+ let walker = this.head;
10371
+ if (arguments.length > 1) {
10372
+ acc = initial;
10373
+ } else if (this.head) {
10374
+ walker = this.head.next;
10375
+ acc = this.head.value;
10376
+ } else {
10377
+ throw new TypeError("Reduce of empty list with no initial value");
10378
+ }
10379
+ for (var i = 0; !!walker; i++) {
10380
+ acc = fn(acc, walker.value, i);
10381
+ walker = walker.next;
10382
+ }
10383
+ return acc;
10384
+ }
10385
+ reduceReverse(fn, initial) {
10386
+ let acc;
10387
+ let walker = this.tail;
10388
+ if (arguments.length > 1) {
10389
+ acc = initial;
10390
+ } else if (this.tail) {
10391
+ walker = this.tail.prev;
10392
+ acc = this.tail.value;
10393
+ } else {
10394
+ throw new TypeError("Reduce of empty list with no initial value");
10395
+ }
10396
+ for (let i = this.length - 1; !!walker; i--) {
10397
+ acc = fn(acc, walker.value, i);
10398
+ walker = walker.prev;
10399
+ }
10400
+ return acc;
10401
+ }
10402
+ toArray() {
10403
+ const arr = new Array(this.length);
10404
+ for (let i = 0, walker = this.head; !!walker; i++) {
10405
+ arr[i] = walker.value;
10406
+ walker = walker.next;
10407
+ }
10408
+ return arr;
10409
+ }
10410
+ toArrayReverse() {
10411
+ const arr = new Array(this.length);
10412
+ for (let i = 0, walker = this.tail; !!walker; i++) {
10413
+ arr[i] = walker.value;
10414
+ walker = walker.prev;
10415
+ }
10416
+ return arr;
10417
+ }
10418
+ slice(from = 0, to = this.length) {
10419
+ if (to < 0) {
10420
+ to += this.length;
10421
+ }
10422
+ if (from < 0) {
10423
+ from += this.length;
10424
+ }
10425
+ const ret = new _Yallist();
10426
+ if (to < from || to < 0) {
10427
+ return ret;
10428
+ }
10429
+ if (from < 0) {
10430
+ from = 0;
10431
+ }
10432
+ if (to > this.length) {
10433
+ to = this.length;
10434
+ }
10435
+ let walker = this.head;
10436
+ let i = 0;
10437
+ for (i = 0; !!walker && i < from; i++) {
10438
+ walker = walker.next;
10439
+ }
10440
+ for (; !!walker && i < to; i++, walker = walker.next) {
10441
+ ret.push(walker.value);
10442
+ }
10443
+ return ret;
10444
+ }
10445
+ sliceReverse(from = 0, to = this.length) {
10446
+ if (to < 0) {
10447
+ to += this.length;
10448
+ }
10449
+ if (from < 0) {
10450
+ from += this.length;
10451
+ }
10452
+ const ret = new _Yallist();
10453
+ if (to < from || to < 0) {
10454
+ return ret;
10455
+ }
10456
+ if (from < 0) {
10457
+ from = 0;
10458
+ }
10459
+ if (to > this.length) {
10460
+ to = this.length;
10461
+ }
10462
+ let i = this.length;
10463
+ let walker = this.tail;
10464
+ for (; !!walker && i > to; i--) {
10465
+ walker = walker.prev;
10466
+ }
10467
+ for (; !!walker && i > from; i--, walker = walker.prev) {
10468
+ ret.push(walker.value);
10469
+ }
10470
+ return ret;
10471
+ }
10472
+ splice(start, deleteCount = 0, ...nodes) {
10473
+ if (start > this.length) {
10474
+ start = this.length - 1;
10475
+ }
10476
+ if (start < 0) {
10477
+ start = this.length + start;
10478
+ }
10479
+ let walker = this.head;
10480
+ for (let i = 0; !!walker && i < start; i++) {
10481
+ walker = walker.next;
10482
+ }
10483
+ const ret = [];
10484
+ for (let i = 0; !!walker && i < deleteCount; i++) {
10485
+ ret.push(walker.value);
10486
+ walker = this.removeNode(walker);
10487
+ }
10488
+ if (!walker) {
10489
+ walker = this.tail;
10490
+ } else if (walker !== this.tail) {
10491
+ walker = walker.prev;
10492
+ }
10493
+ for (const v of nodes) {
10494
+ walker = insertAfter(this, walker, v);
10495
+ }
10496
+ return ret;
10497
+ }
10498
+ reverse() {
10499
+ const head = this.head;
10500
+ const tail = this.tail;
10501
+ for (let walker = head; !!walker; walker = walker.prev) {
10502
+ const p = walker.prev;
10503
+ walker.prev = walker.next;
10504
+ walker.next = p;
10505
+ }
10506
+ this.head = tail;
10507
+ this.tail = head;
10508
+ return this;
10509
+ }
10510
+ };
10511
+ function insertAfter(self, node, value) {
10512
+ const prev = node;
10513
+ const next = node ? node.next : self.head;
10514
+ const inserted = new Node2(value, prev, next, self);
10515
+ if (inserted.next === void 0) {
10516
+ self.tail = inserted;
10517
+ }
10518
+ if (inserted.prev === void 0) {
10519
+ self.head = inserted;
10520
+ }
10521
+ self.length++;
10522
+ return inserted;
10523
+ }
10524
+ function push(self, item) {
10525
+ self.tail = new Node2(item, self.tail, void 0, self);
9636
10526
  if (!self.head) {
9637
10527
  self.head = self.tail;
9638
10528
  }
9639
- self.length++;
9640
- }
9641
- function unshift(self, item) {
9642
- self.head = new Node2(item, void 0, self.head, self);
9643
- if (!self.tail) {
9644
- self.tail = self.head;
10529
+ self.length++;
10530
+ }
10531
+ function unshift(self, item) {
10532
+ self.head = new Node2(item, void 0, self.head, self);
10533
+ if (!self.tail) {
10534
+ self.tail = self.head;
10535
+ }
10536
+ self.length++;
10537
+ }
10538
+ var Node2 = class {
10539
+ list;
10540
+ next;
10541
+ prev;
10542
+ value;
10543
+ constructor(value, prev, next, list2) {
10544
+ this.list = list2;
10545
+ this.value = value;
10546
+ if (prev) {
10547
+ prev.next = this;
10548
+ this.prev = prev;
10549
+ } else {
10550
+ this.prev = void 0;
10551
+ }
10552
+ if (next) {
10553
+ next.prev = this;
10554
+ this.next = next;
10555
+ } else {
10556
+ this.next = void 0;
10557
+ }
10558
+ }
10559
+ };
10560
+
10561
+ // node_modules/tar/dist/esm/header.js
10562
+ import { posix as pathModule } from "path";
10563
+
10564
+ // node_modules/tar/dist/esm/large-numbers.js
10565
+ var encode = (num, buf) => {
10566
+ if (!Number.isSafeInteger(num)) {
10567
+ throw Error("cannot encode number outside of javascript safe integer range");
10568
+ } else if (num < 0) {
10569
+ encodeNegative(num, buf);
10570
+ } else {
10571
+ encodePositive(num, buf);
10572
+ }
10573
+ return buf;
10574
+ };
10575
+ var encodePositive = (num, buf) => {
10576
+ buf[0] = 128;
10577
+ for (var i = buf.length; i > 1; i--) {
10578
+ buf[i - 1] = num & 255;
10579
+ num = Math.floor(num / 256);
10580
+ }
10581
+ };
10582
+ var encodeNegative = (num, buf) => {
10583
+ buf[0] = 255;
10584
+ var flipped = false;
10585
+ num = num * -1;
10586
+ for (var i = buf.length; i > 1; i--) {
10587
+ var byte = num & 255;
10588
+ num = Math.floor(num / 256);
10589
+ if (flipped) {
10590
+ buf[i - 1] = onesComp(byte);
10591
+ } else if (byte === 0) {
10592
+ buf[i - 1] = 0;
10593
+ } else {
10594
+ flipped = true;
10595
+ buf[i - 1] = twosComp(byte);
10596
+ }
10597
+ }
10598
+ };
10599
+ var parse2 = (buf) => {
10600
+ const pre = buf[0];
10601
+ const value = pre === 128 ? pos(buf.subarray(1, buf.length)) : pre === 255 ? twos(buf) : null;
10602
+ if (value === null) {
10603
+ throw Error("invalid base256 encoding");
10604
+ }
10605
+ if (!Number.isSafeInteger(value)) {
10606
+ throw Error("parsed number outside of javascript safe integer range");
10607
+ }
10608
+ return value;
10609
+ };
10610
+ var twos = (buf) => {
10611
+ var len = buf.length;
10612
+ var sum = 0;
10613
+ var flipped = false;
10614
+ for (var i = len - 1; i > -1; i--) {
10615
+ var byte = Number(buf[i]);
10616
+ var f;
10617
+ if (flipped) {
10618
+ f = onesComp(byte);
10619
+ } else if (byte === 0) {
10620
+ f = byte;
10621
+ } else {
10622
+ flipped = true;
10623
+ f = twosComp(byte);
10624
+ }
10625
+ if (f !== 0) {
10626
+ sum -= f * Math.pow(256, len - i - 1);
10627
+ }
10628
+ }
10629
+ return sum;
10630
+ };
10631
+ var pos = (buf) => {
10632
+ var len = buf.length;
10633
+ var sum = 0;
10634
+ for (var i = len - 1; i > -1; i--) {
10635
+ var byte = Number(buf[i]);
10636
+ if (byte !== 0) {
10637
+ sum += byte * Math.pow(256, len - i - 1);
10638
+ }
10639
+ }
10640
+ return sum;
10641
+ };
10642
+ var onesComp = (byte) => (255 ^ byte) & 255;
10643
+ var twosComp = (byte) => (255 ^ byte) + 1 & 255;
10644
+
10645
+ // node_modules/tar/dist/esm/types.js
10646
+ var isCode = (c) => name.has(c);
10647
+ var name = /* @__PURE__ */ new Map([
10648
+ ["0", "File"],
10649
+ // same as File
10650
+ ["", "OldFile"],
10651
+ ["1", "Link"],
10652
+ ["2", "SymbolicLink"],
10653
+ // Devices and FIFOs aren't fully supported
10654
+ // they are parsed, but skipped when unpacking
10655
+ ["3", "CharacterDevice"],
10656
+ ["4", "BlockDevice"],
10657
+ ["5", "Directory"],
10658
+ ["6", "FIFO"],
10659
+ // same as File
10660
+ ["7", "ContiguousFile"],
10661
+ // pax headers
10662
+ ["g", "GlobalExtendedHeader"],
10663
+ ["x", "ExtendedHeader"],
10664
+ // vendor-specific stuff
10665
+ // skip
10666
+ ["A", "SolarisACL"],
10667
+ // like 5, but with data, which should be skipped
10668
+ ["D", "GNUDumpDir"],
10669
+ // metadata only, skip
10670
+ ["I", "Inode"],
10671
+ // data = link path of next file
10672
+ ["K", "NextFileHasLongLinkpath"],
10673
+ // data = path of next file
10674
+ ["L", "NextFileHasLongPath"],
10675
+ // skip
10676
+ ["M", "ContinuationFile"],
10677
+ // like L
10678
+ ["N", "OldGnuLongPath"],
10679
+ // skip
10680
+ ["S", "SparseFile"],
10681
+ // skip
10682
+ ["V", "TapeVolumeHeader"],
10683
+ // like x
10684
+ ["X", "OldExtendedHeader"]
10685
+ ]);
10686
+ var code = new Map(Array.from(name).map((kv) => [kv[1], kv[0]]));
10687
+
10688
+ // node_modules/tar/dist/esm/header.js
10689
+ var _type, _Header_instances, slurp_fn;
10690
+ var Header = class {
10691
+ constructor(data, off = 0, ex, gex) {
10692
+ __privateAdd(this, _Header_instances);
10693
+ __publicField(this, "cksumValid", false);
10694
+ __publicField(this, "needPax", false);
10695
+ __publicField(this, "nullBlock", false);
10696
+ __publicField(this, "block");
10697
+ __publicField(this, "path");
10698
+ __publicField(this, "mode");
10699
+ __publicField(this, "uid");
10700
+ __publicField(this, "gid");
10701
+ __publicField(this, "size");
10702
+ __publicField(this, "cksum");
10703
+ __privateAdd(this, _type, "Unsupported");
10704
+ __publicField(this, "linkpath");
10705
+ __publicField(this, "uname");
10706
+ __publicField(this, "gname");
10707
+ __publicField(this, "devmaj", 0);
10708
+ __publicField(this, "devmin", 0);
10709
+ __publicField(this, "atime");
10710
+ __publicField(this, "ctime");
10711
+ __publicField(this, "mtime");
10712
+ __publicField(this, "charset");
10713
+ __publicField(this, "comment");
10714
+ if (Buffer.isBuffer(data)) {
10715
+ this.decode(data, off || 0, ex, gex);
10716
+ } else if (data) {
10717
+ __privateMethod(this, _Header_instances, slurp_fn).call(this, data);
10718
+ }
10719
+ }
10720
+ decode(buf, off, ex, gex) {
10721
+ if (!off) {
10722
+ off = 0;
10723
+ }
10724
+ if (!buf || !(buf.length >= off + 512)) {
10725
+ throw new Error("need 512 bytes for header");
10726
+ }
10727
+ this.path = decString(buf, off, 100);
10728
+ this.mode = decNumber(buf, off + 100, 8);
10729
+ this.uid = decNumber(buf, off + 108, 8);
10730
+ this.gid = decNumber(buf, off + 116, 8);
10731
+ this.size = decNumber(buf, off + 124, 12);
10732
+ this.mtime = decDate(buf, off + 136, 12);
10733
+ this.cksum = decNumber(buf, off + 148, 12);
10734
+ if (gex)
10735
+ __privateMethod(this, _Header_instances, slurp_fn).call(this, gex, true);
10736
+ if (ex)
10737
+ __privateMethod(this, _Header_instances, slurp_fn).call(this, ex);
10738
+ const t = decString(buf, off + 156, 1);
10739
+ if (isCode(t)) {
10740
+ __privateSet(this, _type, t || "0");
10741
+ }
10742
+ if (__privateGet(this, _type) === "0" && this.path.slice(-1) === "/") {
10743
+ __privateSet(this, _type, "5");
10744
+ }
10745
+ if (__privateGet(this, _type) === "5") {
10746
+ this.size = 0;
10747
+ }
10748
+ this.linkpath = decString(buf, off + 157, 100);
10749
+ if (buf.subarray(off + 257, off + 265).toString() === "ustar\x0000") {
10750
+ this.uname = decString(buf, off + 265, 32);
10751
+ this.gname = decString(buf, off + 297, 32);
10752
+ this.devmaj = decNumber(buf, off + 329, 8) ?? 0;
10753
+ this.devmin = decNumber(buf, off + 337, 8) ?? 0;
10754
+ if (buf[off + 475] !== 0) {
10755
+ const prefix2 = decString(buf, off + 345, 155);
10756
+ this.path = prefix2 + "/" + this.path;
10757
+ } else {
10758
+ const prefix2 = decString(buf, off + 345, 130);
10759
+ if (prefix2) {
10760
+ this.path = prefix2 + "/" + this.path;
10761
+ }
10762
+ this.atime = decDate(buf, off + 476, 12);
10763
+ this.ctime = decDate(buf, off + 488, 12);
10764
+ }
10765
+ }
10766
+ let sum = 8 * 32;
10767
+ for (let i = off; i < off + 148; i++) {
10768
+ sum += buf[i];
10769
+ }
10770
+ for (let i = off + 156; i < off + 512; i++) {
10771
+ sum += buf[i];
10772
+ }
10773
+ this.cksumValid = sum === this.cksum;
10774
+ if (this.cksum === void 0 && sum === 8 * 32) {
10775
+ this.nullBlock = true;
10776
+ }
10777
+ }
10778
+ encode(buf, off = 0) {
10779
+ if (!buf) {
10780
+ buf = this.block = Buffer.alloc(512);
10781
+ }
10782
+ if (__privateGet(this, _type) === "Unsupported") {
10783
+ __privateSet(this, _type, "0");
10784
+ }
10785
+ if (!(buf.length >= off + 512)) {
10786
+ throw new Error("need 512 bytes for header");
10787
+ }
10788
+ const prefixSize = this.ctime || this.atime ? 130 : 155;
10789
+ const split = splitPrefix(this.path || "", prefixSize);
10790
+ const path15 = split[0];
10791
+ const prefix2 = split[1];
10792
+ this.needPax = !!split[2];
10793
+ this.needPax = encString(buf, off, 100, path15) || this.needPax;
10794
+ this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax;
10795
+ this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax;
10796
+ this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax;
10797
+ this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax;
10798
+ this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax;
10799
+ buf[off + 156] = __privateGet(this, _type).charCodeAt(0);
10800
+ this.needPax = encString(buf, off + 157, 100, this.linkpath) || this.needPax;
10801
+ buf.write("ustar\x0000", off + 257, 8);
10802
+ this.needPax = encString(buf, off + 265, 32, this.uname) || this.needPax;
10803
+ this.needPax = encString(buf, off + 297, 32, this.gname) || this.needPax;
10804
+ this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax;
10805
+ this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax;
10806
+ this.needPax = encString(buf, off + 345, prefixSize, prefix2) || this.needPax;
10807
+ if (buf[off + 475] !== 0) {
10808
+ this.needPax = encString(buf, off + 345, 155, prefix2) || this.needPax;
10809
+ } else {
10810
+ this.needPax = encString(buf, off + 345, 130, prefix2) || this.needPax;
10811
+ this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax;
10812
+ this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax;
10813
+ }
10814
+ let sum = 8 * 32;
10815
+ for (let i = off; i < off + 148; i++) {
10816
+ sum += buf[i];
10817
+ }
10818
+ for (let i = off + 156; i < off + 512; i++) {
10819
+ sum += buf[i];
10820
+ }
10821
+ this.cksum = sum;
10822
+ encNumber(buf, off + 148, 8, this.cksum);
10823
+ this.cksumValid = true;
10824
+ return this.needPax;
9645
10825
  }
9646
- self.length++;
9647
- }
9648
- var Node2 = class {
9649
- list;
9650
- next;
9651
- prev;
9652
- value;
9653
- constructor(value, prev, next, list2) {
9654
- this.list = list2;
9655
- this.value = value;
9656
- if (prev) {
9657
- prev.next = this;
9658
- this.prev = prev;
10826
+ get type() {
10827
+ return __privateGet(this, _type) === "Unsupported" ? __privateGet(this, _type) : name.get(__privateGet(this, _type));
10828
+ }
10829
+ get typeKey() {
10830
+ return __privateGet(this, _type);
10831
+ }
10832
+ set type(type) {
10833
+ const c = String(code.get(type));
10834
+ if (isCode(c) || c === "Unsupported") {
10835
+ __privateSet(this, _type, c);
10836
+ } else if (isCode(type)) {
10837
+ __privateSet(this, _type, type);
9659
10838
  } else {
9660
- this.prev = void 0;
10839
+ throw new TypeError("invalid entry type: " + type);
10840
+ }
10841
+ }
10842
+ };
10843
+ _type = new WeakMap();
10844
+ _Header_instances = new WeakSet();
10845
+ slurp_fn = function(ex, gex = false) {
10846
+ Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => {
10847
+ return !(v === null || v === void 0 || k === "path" && gex || k === "linkpath" && gex || k === "global");
10848
+ })));
10849
+ };
10850
+ var splitPrefix = (p, prefixSize) => {
10851
+ const pathSize = 100;
10852
+ let pp = p;
10853
+ let prefix2 = "";
10854
+ let ret = void 0;
10855
+ const root = pathModule.parse(p).root || ".";
10856
+ if (Buffer.byteLength(pp) < pathSize) {
10857
+ ret = [pp, prefix2, false];
10858
+ } else {
10859
+ prefix2 = pathModule.dirname(pp);
10860
+ pp = pathModule.basename(pp);
10861
+ do {
10862
+ if (Buffer.byteLength(pp) <= pathSize && Buffer.byteLength(prefix2) <= prefixSize) {
10863
+ ret = [pp, prefix2, false];
10864
+ } else if (Buffer.byteLength(pp) > pathSize && Buffer.byteLength(prefix2) <= prefixSize) {
10865
+ ret = [pp.slice(0, pathSize - 1), prefix2, true];
10866
+ } else {
10867
+ pp = pathModule.join(pathModule.basename(prefix2), pp);
10868
+ prefix2 = pathModule.dirname(prefix2);
10869
+ }
10870
+ } while (prefix2 !== root && ret === void 0);
10871
+ if (!ret) {
10872
+ ret = [p.slice(0, pathSize - 1), "", true];
10873
+ }
10874
+ }
10875
+ return ret;
10876
+ };
10877
+ var decString = (buf, off, size) => buf.subarray(off, off + size).toString("utf8").replace(/\0.*/, "");
10878
+ var decDate = (buf, off, size) => numToDate(decNumber(buf, off, size));
10879
+ var numToDate = (num) => num === void 0 ? void 0 : new Date(num * 1e3);
10880
+ var decNumber = (buf, off, size) => Number(buf[off]) & 128 ? parse2(buf.subarray(off, off + size)) : decSmallNumber(buf, off, size);
10881
+ var nanUndef = (value) => isNaN(value) ? void 0 : value;
10882
+ var decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf.subarray(off, off + size).toString("utf8").replace(/\0.*$/, "").trim(), 8));
10883
+ var MAXNUM = {
10884
+ 12: 8589934591,
10885
+ 8: 2097151
10886
+ };
10887
+ var encNumber = (buf, off, size, num) => num === void 0 ? false : num > MAXNUM[size] || num < 0 ? (encode(num, buf.subarray(off, off + size)), true) : (encSmallNumber(buf, off, size, num), false);
10888
+ var encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, "ascii");
10889
+ var octalString = (num, size) => padOctal(Math.floor(num).toString(8), size);
10890
+ var padOctal = (str, size) => (str.length === size - 1 ? str : new Array(size - str.length - 1).join("0") + str + " ") + "\0";
10891
+ var encDate = (buf, off, size, date) => date === void 0 ? false : encNumber(buf, off, size, date.getTime() / 1e3);
10892
+ var NULLS = new Array(156).join("\0");
10893
+ var encString = (buf, off, size, str) => str === void 0 ? false : (buf.write(str + NULLS, off, size, "utf8"), str.length !== Buffer.byteLength(str) || str.length > size);
10894
+
10895
+ // node_modules/tar/dist/esm/pax.js
10896
+ import { basename } from "path";
10897
+ var Pax = class _Pax {
10898
+ atime;
10899
+ mtime;
10900
+ ctime;
10901
+ charset;
10902
+ comment;
10903
+ gid;
10904
+ uid;
10905
+ gname;
10906
+ uname;
10907
+ linkpath;
10908
+ dev;
10909
+ ino;
10910
+ nlink;
10911
+ path;
10912
+ size;
10913
+ mode;
10914
+ global;
10915
+ constructor(obj, global = false) {
10916
+ this.atime = obj.atime;
10917
+ this.charset = obj.charset;
10918
+ this.comment = obj.comment;
10919
+ this.ctime = obj.ctime;
10920
+ this.dev = obj.dev;
10921
+ this.gid = obj.gid;
10922
+ this.global = global;
10923
+ this.gname = obj.gname;
10924
+ this.ino = obj.ino;
10925
+ this.linkpath = obj.linkpath;
10926
+ this.mtime = obj.mtime;
10927
+ this.nlink = obj.nlink;
10928
+ this.path = obj.path;
10929
+ this.size = obj.size;
10930
+ this.uid = obj.uid;
10931
+ this.uname = obj.uname;
10932
+ }
10933
+ encode() {
10934
+ const body = this.encodeBody();
10935
+ if (body === "") {
10936
+ return Buffer.allocUnsafe(0);
10937
+ }
10938
+ const bodyLen = Buffer.byteLength(body);
10939
+ const bufLen = 512 * Math.ceil(1 + bodyLen / 512);
10940
+ const buf = Buffer.allocUnsafe(bufLen);
10941
+ for (let i = 0; i < 512; i++) {
10942
+ buf[i] = 0;
10943
+ }
10944
+ new Header({
10945
+ // XXX split the path
10946
+ // then the path should be PaxHeader + basename, but less than 99,
10947
+ // prepend with the dirname
10948
+ /* c8 ignore start */
10949
+ path: ("PaxHeader/" + basename(this.path ?? "")).slice(0, 99),
10950
+ /* c8 ignore stop */
10951
+ mode: this.mode || 420,
10952
+ uid: this.uid,
10953
+ gid: this.gid,
10954
+ size: bodyLen,
10955
+ mtime: this.mtime,
10956
+ type: this.global ? "GlobalExtendedHeader" : "ExtendedHeader",
10957
+ linkpath: "",
10958
+ uname: this.uname || "",
10959
+ gname: this.gname || "",
10960
+ devmaj: 0,
10961
+ devmin: 0,
10962
+ atime: this.atime,
10963
+ ctime: this.ctime
10964
+ }).encode(buf);
10965
+ buf.write(body, 512, bodyLen, "utf8");
10966
+ for (let i = bodyLen + 512; i < buf.length; i++) {
10967
+ buf[i] = 0;
9661
10968
  }
9662
- if (next) {
9663
- next.prev = this;
9664
- this.next = next;
9665
- } else {
9666
- this.next = void 0;
10969
+ return buf;
10970
+ }
10971
+ encodeBody() {
10972
+ 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");
10973
+ }
10974
+ encodeField(field) {
10975
+ if (this[field] === void 0) {
10976
+ return "";
10977
+ }
10978
+ const r = this[field];
10979
+ const v = r instanceof Date ? r.getTime() / 1e3 : r;
10980
+ const s = " " + (field === "dev" || field === "ino" || field === "nlink" ? "SCHILY." : "") + field + "=" + v + "\n";
10981
+ const byteLen = Buffer.byteLength(s);
10982
+ let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1;
10983
+ if (byteLen + digits >= Math.pow(10, digits)) {
10984
+ digits += 1;
9667
10985
  }
10986
+ const len = digits + byteLen;
10987
+ return len + s;
9668
10988
  }
9669
- };
9670
-
9671
- // node_modules/tar/dist/esm/header.js
9672
- import { posix as pathModule } from "path";
9673
-
9674
- // node_modules/tar/dist/esm/large-numbers.js
9675
- var encode = (num, buf) => {
9676
- if (!Number.isSafeInteger(num)) {
9677
- throw Error("cannot encode number outside of javascript safe integer range");
9678
- } else if (num < 0) {
9679
- encodeNegative(num, buf);
9680
- } else {
9681
- encodePositive(num, buf);
10989
+ static parse(str, ex, g = false) {
10990
+ return new _Pax(merge(parseKV(str), ex), g);
9682
10991
  }
9683
- return buf;
9684
10992
  };
9685
- var encodePositive = (num, buf) => {
9686
- buf[0] = 128;
9687
- for (var i = buf.length; i > 1; i--) {
9688
- buf[i - 1] = num & 255;
9689
- num = Math.floor(num / 256);
10993
+ var merge = (a, b) => b ? Object.assign({}, b, a) : a;
10994
+ var parseKV = (str) => str.replace(/\n$/, "").split("\n").reduce(parseKVLine, /* @__PURE__ */ Object.create(null));
10995
+ var parseKVLine = (set, line) => {
10996
+ const n = parseInt(line, 10);
10997
+ if (n !== Buffer.byteLength(line) + 1) {
10998
+ return set;
10999
+ }
11000
+ line = line.slice((n + " ").length);
11001
+ const kv = line.split("=");
11002
+ const r = kv.shift();
11003
+ if (!r) {
11004
+ return set;
9690
11005
  }
11006
+ const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, "$1");
11007
+ const v = kv.join("=");
11008
+ set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ? new Date(Number(v) * 1e3) : /^[0-9]+$/.test(v) ? +v : v;
11009
+ return set;
9691
11010
  };
9692
- var encodeNegative = (num, buf) => {
9693
- buf[0] = 255;
9694
- var flipped = false;
9695
- num = num * -1;
9696
- for (var i = buf.length; i > 1; i--) {
9697
- var byte = num & 255;
9698
- num = Math.floor(num / 256);
9699
- if (flipped) {
9700
- buf[i - 1] = onesComp(byte);
9701
- } else if (byte === 0) {
9702
- buf[i - 1] = 0;
9703
- } else {
9704
- flipped = true;
9705
- buf[i - 1] = twosComp(byte);
9706
- }
11011
+
11012
+ // node_modules/tar/node_modules/minipass/dist/esm/index.js
11013
+ import { EventEmitter as EventEmitter3 } from "events";
11014
+ import Stream3 from "stream";
11015
+ import { StringDecoder as StringDecoder3 } from "string_decoder";
11016
+ var proc3 = typeof process === "object" && process ? process : {
11017
+ stdout: null,
11018
+ stderr: null
11019
+ };
11020
+ var isStream3 = (s) => !!s && typeof s === "object" && (s instanceof Minipass3 || s instanceof Stream3 || isReadable3(s) || isWritable3(s));
11021
+ var isReadable3 = (s) => !!s && typeof s === "object" && s instanceof EventEmitter3 && typeof s.pipe === "function" && // node core Writable streams have a pipe() method, but it throws
11022
+ s.pipe !== Stream3.Writable.prototype.pipe;
11023
+ var isWritable3 = (s) => !!s && typeof s === "object" && s instanceof EventEmitter3 && typeof s.write === "function" && typeof s.end === "function";
11024
+ var EOF3 = Symbol("EOF");
11025
+ var MAYBE_EMIT_END3 = Symbol("maybeEmitEnd");
11026
+ var EMITTED_END3 = Symbol("emittedEnd");
11027
+ var EMITTING_END3 = Symbol("emittingEnd");
11028
+ var EMITTED_ERROR3 = Symbol("emittedError");
11029
+ var CLOSED3 = Symbol("closed");
11030
+ var READ3 = Symbol("read");
11031
+ var FLUSH3 = Symbol("flush");
11032
+ var FLUSHCHUNK3 = Symbol("flushChunk");
11033
+ var ENCODING3 = Symbol("encoding");
11034
+ var DECODER3 = Symbol("decoder");
11035
+ var FLOWING3 = Symbol("flowing");
11036
+ var PAUSED3 = Symbol("paused");
11037
+ var RESUME3 = Symbol("resume");
11038
+ var BUFFER3 = Symbol("buffer");
11039
+ var PIPES3 = Symbol("pipes");
11040
+ var BUFFERLENGTH3 = Symbol("bufferLength");
11041
+ var BUFFERPUSH3 = Symbol("bufferPush");
11042
+ var BUFFERSHIFT3 = Symbol("bufferShift");
11043
+ var OBJECTMODE3 = Symbol("objectMode");
11044
+ var DESTROYED3 = Symbol("destroyed");
11045
+ var ERROR3 = Symbol("error");
11046
+ var EMITDATA3 = Symbol("emitData");
11047
+ var EMITEND4 = Symbol("emitEnd");
11048
+ var EMITEND23 = Symbol("emitEnd2");
11049
+ var ASYNC3 = Symbol("async");
11050
+ var ABORT3 = Symbol("abort");
11051
+ var ABORTED3 = Symbol("aborted");
11052
+ var SIGNAL3 = Symbol("signal");
11053
+ var DATALISTENERS3 = Symbol("dataListeners");
11054
+ var DISCARDED3 = Symbol("discarded");
11055
+ var defer3 = (fn) => Promise.resolve().then(fn);
11056
+ var nodefer3 = (fn) => fn();
11057
+ var isEndish3 = (ev) => ev === "end" || ev === "finish" || ev === "prefinish";
11058
+ var isArrayBufferLike3 = (b) => b instanceof ArrayBuffer || !!b && typeof b === "object" && b.constructor && b.constructor.name === "ArrayBuffer" && b.byteLength >= 0;
11059
+ var isArrayBufferView3 = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b);
11060
+ var Pipe3 = class {
11061
+ src;
11062
+ dest;
11063
+ opts;
11064
+ ondrain;
11065
+ constructor(src, dest, opts) {
11066
+ this.src = src;
11067
+ this.dest = dest;
11068
+ this.opts = opts;
11069
+ this.ondrain = () => src[RESUME3]();
11070
+ this.dest.on("drain", this.ondrain);
11071
+ }
11072
+ unpipe() {
11073
+ this.dest.removeListener("drain", this.ondrain);
11074
+ }
11075
+ // only here for the prototype
11076
+ /* c8 ignore start */
11077
+ proxyErrors(_er) {
11078
+ }
11079
+ /* c8 ignore stop */
11080
+ end() {
11081
+ this.unpipe();
11082
+ if (this.opts.end)
11083
+ this.dest.end();
9707
11084
  }
9708
11085
  };
9709
- var parse2 = (buf) => {
9710
- const pre = buf[0];
9711
- const value = pre === 128 ? pos(buf.subarray(1, buf.length)) : pre === 255 ? twos(buf) : null;
9712
- if (value === null) {
9713
- throw Error("invalid base256 encoding");
11086
+ var PipeProxyErrors3 = class extends Pipe3 {
11087
+ unpipe() {
11088
+ this.src.removeListener("error", this.proxyErrors);
11089
+ super.unpipe();
9714
11090
  }
9715
- if (!Number.isSafeInteger(value)) {
9716
- throw Error("parsed number outside of javascript safe integer range");
11091
+ constructor(src, dest, opts) {
11092
+ super(src, dest, opts);
11093
+ this.proxyErrors = (er) => dest.emit("error", er);
11094
+ src.on("error", this.proxyErrors);
9717
11095
  }
9718
- return value;
9719
11096
  };
9720
- var twos = (buf) => {
9721
- var len = buf.length;
9722
- var sum = 0;
9723
- var flipped = false;
9724
- for (var i = len - 1; i > -1; i--) {
9725
- var byte = Number(buf[i]);
9726
- var f;
9727
- if (flipped) {
9728
- f = onesComp(byte);
9729
- } else if (byte === 0) {
9730
- f = byte;
11097
+ var isObjectModeOptions3 = (o) => !!o.objectMode;
11098
+ var isEncodingOptions3 = (o) => !o.objectMode && !!o.encoding && o.encoding !== "buffer";
11099
+ var Minipass3 = class extends EventEmitter3 {
11100
+ [FLOWING3] = false;
11101
+ [PAUSED3] = false;
11102
+ [PIPES3] = [];
11103
+ [BUFFER3] = [];
11104
+ [OBJECTMODE3];
11105
+ [ENCODING3];
11106
+ [ASYNC3];
11107
+ [DECODER3];
11108
+ [EOF3] = false;
11109
+ [EMITTED_END3] = false;
11110
+ [EMITTING_END3] = false;
11111
+ [CLOSED3] = false;
11112
+ [EMITTED_ERROR3] = null;
11113
+ [BUFFERLENGTH3] = 0;
11114
+ [DESTROYED3] = false;
11115
+ [SIGNAL3];
11116
+ [ABORTED3] = false;
11117
+ [DATALISTENERS3] = 0;
11118
+ [DISCARDED3] = false;
11119
+ /**
11120
+ * true if the stream can be written
11121
+ */
11122
+ writable = true;
11123
+ /**
11124
+ * true if the stream can be read
11125
+ */
11126
+ readable = true;
11127
+ /**
11128
+ * If `RType` is Buffer, then options do not need to be provided.
11129
+ * Otherwise, an options object must be provided to specify either
11130
+ * {@link Minipass.SharedOptions.objectMode} or
11131
+ * {@link Minipass.SharedOptions.encoding}, as appropriate.
11132
+ */
11133
+ constructor(...args) {
11134
+ const options = args[0] || {};
11135
+ super();
11136
+ if (options.objectMode && typeof options.encoding === "string") {
11137
+ throw new TypeError("Encoding and objectMode may not be used together");
11138
+ }
11139
+ if (isObjectModeOptions3(options)) {
11140
+ this[OBJECTMODE3] = true;
11141
+ this[ENCODING3] = null;
11142
+ } else if (isEncodingOptions3(options)) {
11143
+ this[ENCODING3] = options.encoding;
11144
+ this[OBJECTMODE3] = false;
9731
11145
  } else {
9732
- flipped = true;
9733
- f = twosComp(byte);
11146
+ this[OBJECTMODE3] = false;
11147
+ this[ENCODING3] = null;
9734
11148
  }
9735
- if (f !== 0) {
9736
- sum -= f * Math.pow(256, len - i - 1);
11149
+ this[ASYNC3] = !!options.async;
11150
+ this[DECODER3] = this[ENCODING3] ? new StringDecoder3(this[ENCODING3]) : null;
11151
+ if (options && options.debugExposeBuffer === true) {
11152
+ Object.defineProperty(this, "buffer", { get: () => this[BUFFER3] });
9737
11153
  }
9738
- }
9739
- return sum;
9740
- };
9741
- var pos = (buf) => {
9742
- var len = buf.length;
9743
- var sum = 0;
9744
- for (var i = len - 1; i > -1; i--) {
9745
- var byte = Number(buf[i]);
9746
- if (byte !== 0) {
9747
- sum += byte * Math.pow(256, len - i - 1);
11154
+ if (options && options.debugExposePipes === true) {
11155
+ Object.defineProperty(this, "pipes", { get: () => this[PIPES3] });
9748
11156
  }
9749
- }
9750
- return sum;
9751
- };
9752
- var onesComp = (byte) => (255 ^ byte) & 255;
9753
- var twosComp = (byte) => (255 ^ byte) + 1 & 255;
9754
-
9755
- // node_modules/tar/dist/esm/types.js
9756
- var isCode = (c) => name.has(c);
9757
- var name = /* @__PURE__ */ new Map([
9758
- ["0", "File"],
9759
- // same as File
9760
- ["", "OldFile"],
9761
- ["1", "Link"],
9762
- ["2", "SymbolicLink"],
9763
- // Devices and FIFOs aren't fully supported
9764
- // they are parsed, but skipped when unpacking
9765
- ["3", "CharacterDevice"],
9766
- ["4", "BlockDevice"],
9767
- ["5", "Directory"],
9768
- ["6", "FIFO"],
9769
- // same as File
9770
- ["7", "ContiguousFile"],
9771
- // pax headers
9772
- ["g", "GlobalExtendedHeader"],
9773
- ["x", "ExtendedHeader"],
9774
- // vendor-specific stuff
9775
- // skip
9776
- ["A", "SolarisACL"],
9777
- // like 5, but with data, which should be skipped
9778
- ["D", "GNUDumpDir"],
9779
- // metadata only, skip
9780
- ["I", "Inode"],
9781
- // data = link path of next file
9782
- ["K", "NextFileHasLongLinkpath"],
9783
- // data = path of next file
9784
- ["L", "NextFileHasLongPath"],
9785
- // skip
9786
- ["M", "ContinuationFile"],
9787
- // like L
9788
- ["N", "OldGnuLongPath"],
9789
- // skip
9790
- ["S", "SparseFile"],
9791
- // skip
9792
- ["V", "TapeVolumeHeader"],
9793
- // like x
9794
- ["X", "OldExtendedHeader"]
9795
- ]);
9796
- var code = new Map(Array.from(name).map((kv) => [kv[1], kv[0]]));
9797
-
9798
- // node_modules/tar/dist/esm/header.js
9799
- var _type, _Header_instances, slurp_fn;
9800
- var Header = class {
9801
- constructor(data, off = 0, ex, gex) {
9802
- __privateAdd(this, _Header_instances);
9803
- __publicField(this, "cksumValid", false);
9804
- __publicField(this, "needPax", false);
9805
- __publicField(this, "nullBlock", false);
9806
- __publicField(this, "block");
9807
- __publicField(this, "path");
9808
- __publicField(this, "mode");
9809
- __publicField(this, "uid");
9810
- __publicField(this, "gid");
9811
- __publicField(this, "size");
9812
- __publicField(this, "cksum");
9813
- __privateAdd(this, _type, "Unsupported");
9814
- __publicField(this, "linkpath");
9815
- __publicField(this, "uname");
9816
- __publicField(this, "gname");
9817
- __publicField(this, "devmaj", 0);
9818
- __publicField(this, "devmin", 0);
9819
- __publicField(this, "atime");
9820
- __publicField(this, "ctime");
9821
- __publicField(this, "mtime");
9822
- __publicField(this, "charset");
9823
- __publicField(this, "comment");
9824
- if (Buffer.isBuffer(data)) {
9825
- this.decode(data, off || 0, ex, gex);
9826
- } else if (data) {
9827
- __privateMethod(this, _Header_instances, slurp_fn).call(this, data);
11157
+ const { signal } = options;
11158
+ if (signal) {
11159
+ this[SIGNAL3] = signal;
11160
+ if (signal.aborted) {
11161
+ this[ABORT3]();
11162
+ } else {
11163
+ signal.addEventListener("abort", () => this[ABORT3]());
11164
+ }
9828
11165
  }
9829
11166
  }
9830
- decode(buf, off, ex, gex) {
9831
- if (!off) {
9832
- off = 0;
11167
+ /**
11168
+ * The amount of data stored in the buffer waiting to be read.
11169
+ *
11170
+ * For Buffer strings, this will be the total byte length.
11171
+ * For string encoding streams, this will be the string character length,
11172
+ * according to JavaScript's `string.length` logic.
11173
+ * For objectMode streams, this is a count of the items waiting to be
11174
+ * emitted.
11175
+ */
11176
+ get bufferLength() {
11177
+ return this[BUFFERLENGTH3];
11178
+ }
11179
+ /**
11180
+ * The `BufferEncoding` currently in use, or `null`
11181
+ */
11182
+ get encoding() {
11183
+ return this[ENCODING3];
11184
+ }
11185
+ /**
11186
+ * @deprecated - This is a read only property
11187
+ */
11188
+ set encoding(_enc) {
11189
+ throw new Error("Encoding must be set at instantiation time");
11190
+ }
11191
+ /**
11192
+ * @deprecated - Encoding may only be set at instantiation time
11193
+ */
11194
+ setEncoding(_enc) {
11195
+ throw new Error("Encoding must be set at instantiation time");
11196
+ }
11197
+ /**
11198
+ * True if this is an objectMode stream
11199
+ */
11200
+ get objectMode() {
11201
+ return this[OBJECTMODE3];
11202
+ }
11203
+ /**
11204
+ * @deprecated - This is a read-only property
11205
+ */
11206
+ set objectMode(_om) {
11207
+ throw new Error("objectMode must be set at instantiation time");
11208
+ }
11209
+ /**
11210
+ * true if this is an async stream
11211
+ */
11212
+ get ["async"]() {
11213
+ return this[ASYNC3];
11214
+ }
11215
+ /**
11216
+ * Set to true to make this stream async.
11217
+ *
11218
+ * Once set, it cannot be unset, as this would potentially cause incorrect
11219
+ * behavior. Ie, a sync stream can be made async, but an async stream
11220
+ * cannot be safely made sync.
11221
+ */
11222
+ set ["async"](a) {
11223
+ this[ASYNC3] = this[ASYNC3] || !!a;
11224
+ }
11225
+ // drop everything and get out of the flow completely
11226
+ [ABORT3]() {
11227
+ var _a, _b;
11228
+ this[ABORTED3] = true;
11229
+ this.emit("abort", (_a = this[SIGNAL3]) == null ? void 0 : _a.reason);
11230
+ this.destroy((_b = this[SIGNAL3]) == null ? void 0 : _b.reason);
11231
+ }
11232
+ /**
11233
+ * True if the stream has been aborted.
11234
+ */
11235
+ get aborted() {
11236
+ return this[ABORTED3];
11237
+ }
11238
+ /**
11239
+ * No-op setter. Stream aborted status is set via the AbortSignal provided
11240
+ * in the constructor options.
11241
+ */
11242
+ set aborted(_) {
11243
+ }
11244
+ write(chunk, encoding, cb) {
11245
+ var _a;
11246
+ if (this[ABORTED3])
11247
+ return false;
11248
+ if (this[EOF3])
11249
+ throw new Error("write after end");
11250
+ if (this[DESTROYED3]) {
11251
+ this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" }));
11252
+ return true;
9833
11253
  }
9834
- if (!buf || !(buf.length >= off + 512)) {
9835
- throw new Error("need 512 bytes for header");
11254
+ if (typeof encoding === "function") {
11255
+ cb = encoding;
11256
+ encoding = "utf8";
9836
11257
  }
9837
- this.path = decString(buf, off, 100);
9838
- this.mode = decNumber(buf, off + 100, 8);
9839
- this.uid = decNumber(buf, off + 108, 8);
9840
- this.gid = decNumber(buf, off + 116, 8);
9841
- this.size = decNumber(buf, off + 124, 12);
9842
- this.mtime = decDate(buf, off + 136, 12);
9843
- this.cksum = decNumber(buf, off + 148, 12);
9844
- if (gex)
9845
- __privateMethod(this, _Header_instances, slurp_fn).call(this, gex, true);
9846
- if (ex)
9847
- __privateMethod(this, _Header_instances, slurp_fn).call(this, ex);
9848
- const t = decString(buf, off + 156, 1);
9849
- if (isCode(t)) {
9850
- __privateSet(this, _type, t || "0");
11258
+ if (!encoding)
11259
+ encoding = "utf8";
11260
+ const fn = this[ASYNC3] ? defer3 : nodefer3;
11261
+ if (!this[OBJECTMODE3] && !Buffer.isBuffer(chunk)) {
11262
+ if (isArrayBufferView3(chunk)) {
11263
+ chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
11264
+ } else if (isArrayBufferLike3(chunk)) {
11265
+ chunk = Buffer.from(chunk);
11266
+ } else if (typeof chunk !== "string") {
11267
+ throw new Error("Non-contiguous data written to non-objectMode stream");
11268
+ }
9851
11269
  }
9852
- if (__privateGet(this, _type) === "0" && this.path.slice(-1) === "/") {
9853
- __privateSet(this, _type, "5");
11270
+ if (this[OBJECTMODE3]) {
11271
+ if (this[FLOWING3] && this[BUFFERLENGTH3] !== 0)
11272
+ this[FLUSH3](true);
11273
+ if (this[FLOWING3])
11274
+ this.emit("data", chunk);
11275
+ else
11276
+ this[BUFFERPUSH3](chunk);
11277
+ if (this[BUFFERLENGTH3] !== 0)
11278
+ this.emit("readable");
11279
+ if (cb)
11280
+ fn(cb);
11281
+ return this[FLOWING3];
9854
11282
  }
9855
- if (__privateGet(this, _type) === "5") {
9856
- this.size = 0;
11283
+ if (!chunk.length) {
11284
+ if (this[BUFFERLENGTH3] !== 0)
11285
+ this.emit("readable");
11286
+ if (cb)
11287
+ fn(cb);
11288
+ return this[FLOWING3];
9857
11289
  }
9858
- this.linkpath = decString(buf, off + 157, 100);
9859
- if (buf.subarray(off + 257, off + 265).toString() === "ustar\x0000") {
9860
- this.uname = decString(buf, off + 265, 32);
9861
- this.gname = decString(buf, off + 297, 32);
9862
- this.devmaj = decNumber(buf, off + 329, 8) ?? 0;
9863
- this.devmin = decNumber(buf, off + 337, 8) ?? 0;
9864
- if (buf[off + 475] !== 0) {
9865
- const prefix2 = decString(buf, off + 345, 155);
9866
- this.path = prefix2 + "/" + this.path;
9867
- } else {
9868
- const prefix2 = decString(buf, off + 345, 130);
9869
- if (prefix2) {
9870
- this.path = prefix2 + "/" + this.path;
9871
- }
9872
- this.atime = decDate(buf, off + 476, 12);
9873
- this.ctime = decDate(buf, off + 488, 12);
9874
- }
11290
+ if (typeof chunk === "string" && // unless it is a string already ready for us to use
11291
+ !(encoding === this[ENCODING3] && !((_a = this[DECODER3]) == null ? void 0 : _a.lastNeed))) {
11292
+ chunk = Buffer.from(chunk, encoding);
9875
11293
  }
9876
- let sum = 8 * 32;
9877
- for (let i = off; i < off + 148; i++) {
9878
- sum += buf[i];
11294
+ if (Buffer.isBuffer(chunk) && this[ENCODING3]) {
11295
+ chunk = this[DECODER3].write(chunk);
9879
11296
  }
9880
- for (let i = off + 156; i < off + 512; i++) {
9881
- sum += buf[i];
11297
+ if (this[FLOWING3] && this[BUFFERLENGTH3] !== 0)
11298
+ this[FLUSH3](true);
11299
+ if (this[FLOWING3])
11300
+ this.emit("data", chunk);
11301
+ else
11302
+ this[BUFFERPUSH3](chunk);
11303
+ if (this[BUFFERLENGTH3] !== 0)
11304
+ this.emit("readable");
11305
+ if (cb)
11306
+ fn(cb);
11307
+ return this[FLOWING3];
11308
+ }
11309
+ /**
11310
+ * Low-level explicit read method.
11311
+ *
11312
+ * In objectMode, the argument is ignored, and one item is returned if
11313
+ * available.
11314
+ *
11315
+ * `n` is the number of bytes (or in the case of encoding streams,
11316
+ * characters) to consume. If `n` is not provided, then the entire buffer
11317
+ * is returned, or `null` is returned if no data is available.
11318
+ *
11319
+ * If `n` is greater that the amount of data in the internal buffer,
11320
+ * then `null` is returned.
11321
+ */
11322
+ read(n) {
11323
+ if (this[DESTROYED3])
11324
+ return null;
11325
+ this[DISCARDED3] = false;
11326
+ if (this[BUFFERLENGTH3] === 0 || n === 0 || n && n > this[BUFFERLENGTH3]) {
11327
+ this[MAYBE_EMIT_END3]();
11328
+ return null;
9882
11329
  }
9883
- this.cksumValid = sum === this.cksum;
9884
- if (this.cksum === void 0 && sum === 8 * 32) {
9885
- this.nullBlock = true;
11330
+ if (this[OBJECTMODE3])
11331
+ n = null;
11332
+ if (this[BUFFER3].length > 1 && !this[OBJECTMODE3]) {
11333
+ this[BUFFER3] = [
11334
+ this[ENCODING3] ? this[BUFFER3].join("") : Buffer.concat(this[BUFFER3], this[BUFFERLENGTH3])
11335
+ ];
9886
11336
  }
11337
+ const ret = this[READ3](n || null, this[BUFFER3][0]);
11338
+ this[MAYBE_EMIT_END3]();
11339
+ return ret;
9887
11340
  }
9888
- encode(buf, off = 0) {
9889
- if (!buf) {
9890
- buf = this.block = Buffer.alloc(512);
11341
+ [READ3](n, chunk) {
11342
+ if (this[OBJECTMODE3])
11343
+ this[BUFFERSHIFT3]();
11344
+ else {
11345
+ const c = chunk;
11346
+ if (n === c.length || n === null)
11347
+ this[BUFFERSHIFT3]();
11348
+ else if (typeof c === "string") {
11349
+ this[BUFFER3][0] = c.slice(n);
11350
+ chunk = c.slice(0, n);
11351
+ this[BUFFERLENGTH3] -= n;
11352
+ } else {
11353
+ this[BUFFER3][0] = c.subarray(n);
11354
+ chunk = c.subarray(0, n);
11355
+ this[BUFFERLENGTH3] -= n;
11356
+ }
9891
11357
  }
9892
- if (__privateGet(this, _type) === "Unsupported") {
9893
- __privateSet(this, _type, "0");
11358
+ this.emit("data", chunk);
11359
+ if (!this[BUFFER3].length && !this[EOF3])
11360
+ this.emit("drain");
11361
+ return chunk;
11362
+ }
11363
+ end(chunk, encoding, cb) {
11364
+ if (typeof chunk === "function") {
11365
+ cb = chunk;
11366
+ chunk = void 0;
9894
11367
  }
9895
- if (!(buf.length >= off + 512)) {
9896
- throw new Error("need 512 bytes for header");
11368
+ if (typeof encoding === "function") {
11369
+ cb = encoding;
11370
+ encoding = "utf8";
9897
11371
  }
9898
- const prefixSize = this.ctime || this.atime ? 130 : 155;
9899
- const split = splitPrefix(this.path || "", prefixSize);
9900
- const path15 = split[0];
9901
- const prefix2 = split[1];
9902
- this.needPax = !!split[2];
9903
- this.needPax = encString(buf, off, 100, path15) || this.needPax;
9904
- this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax;
9905
- this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax;
9906
- this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax;
9907
- this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax;
9908
- this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax;
9909
- buf[off + 156] = __privateGet(this, _type).charCodeAt(0);
9910
- this.needPax = encString(buf, off + 157, 100, this.linkpath) || this.needPax;
9911
- buf.write("ustar\x0000", off + 257, 8);
9912
- this.needPax = encString(buf, off + 265, 32, this.uname) || this.needPax;
9913
- this.needPax = encString(buf, off + 297, 32, this.gname) || this.needPax;
9914
- this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax;
9915
- this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax;
9916
- this.needPax = encString(buf, off + 345, prefixSize, prefix2) || this.needPax;
9917
- if (buf[off + 475] !== 0) {
9918
- this.needPax = encString(buf, off + 345, 155, prefix2) || this.needPax;
11372
+ if (chunk !== void 0)
11373
+ this.write(chunk, encoding);
11374
+ if (cb)
11375
+ this.once("end", cb);
11376
+ this[EOF3] = true;
11377
+ this.writable = false;
11378
+ if (this[FLOWING3] || !this[PAUSED3])
11379
+ this[MAYBE_EMIT_END3]();
11380
+ return this;
11381
+ }
11382
+ // don't let the internal resume be overwritten
11383
+ [RESUME3]() {
11384
+ if (this[DESTROYED3])
11385
+ return;
11386
+ if (!this[DATALISTENERS3] && !this[PIPES3].length) {
11387
+ this[DISCARDED3] = true;
11388
+ }
11389
+ this[PAUSED3] = false;
11390
+ this[FLOWING3] = true;
11391
+ this.emit("resume");
11392
+ if (this[BUFFER3].length)
11393
+ this[FLUSH3]();
11394
+ else if (this[EOF3])
11395
+ this[MAYBE_EMIT_END3]();
11396
+ else
11397
+ this.emit("drain");
11398
+ }
11399
+ /**
11400
+ * Resume the stream if it is currently in a paused state
11401
+ *
11402
+ * If called when there are no pipe destinations or `data` event listeners,
11403
+ * this will place the stream in a "discarded" state, where all data will
11404
+ * be thrown away. The discarded state is removed if a pipe destination or
11405
+ * data handler is added, if pause() is called, or if any synchronous or
11406
+ * asynchronous iteration is started.
11407
+ */
11408
+ resume() {
11409
+ return this[RESUME3]();
11410
+ }
11411
+ /**
11412
+ * Pause the stream
11413
+ */
11414
+ pause() {
11415
+ this[FLOWING3] = false;
11416
+ this[PAUSED3] = true;
11417
+ this[DISCARDED3] = false;
11418
+ }
11419
+ /**
11420
+ * true if the stream has been forcibly destroyed
11421
+ */
11422
+ get destroyed() {
11423
+ return this[DESTROYED3];
11424
+ }
11425
+ /**
11426
+ * true if the stream is currently in a flowing state, meaning that
11427
+ * any writes will be immediately emitted.
11428
+ */
11429
+ get flowing() {
11430
+ return this[FLOWING3];
11431
+ }
11432
+ /**
11433
+ * true if the stream is currently in a paused state
11434
+ */
11435
+ get paused() {
11436
+ return this[PAUSED3];
11437
+ }
11438
+ [BUFFERPUSH3](chunk) {
11439
+ if (this[OBJECTMODE3])
11440
+ this[BUFFERLENGTH3] += 1;
11441
+ else
11442
+ this[BUFFERLENGTH3] += chunk.length;
11443
+ this[BUFFER3].push(chunk);
11444
+ }
11445
+ [BUFFERSHIFT3]() {
11446
+ if (this[OBJECTMODE3])
11447
+ this[BUFFERLENGTH3] -= 1;
11448
+ else
11449
+ this[BUFFERLENGTH3] -= this[BUFFER3][0].length;
11450
+ return this[BUFFER3].shift();
11451
+ }
11452
+ [FLUSH3](noDrain = false) {
11453
+ do {
11454
+ } while (this[FLUSHCHUNK3](this[BUFFERSHIFT3]()) && this[BUFFER3].length);
11455
+ if (!noDrain && !this[BUFFER3].length && !this[EOF3])
11456
+ this.emit("drain");
11457
+ }
11458
+ [FLUSHCHUNK3](chunk) {
11459
+ this.emit("data", chunk);
11460
+ return this[FLOWING3];
11461
+ }
11462
+ /**
11463
+ * Pipe all data emitted by this stream into the destination provided.
11464
+ *
11465
+ * Triggers the flow of data.
11466
+ */
11467
+ pipe(dest, opts) {
11468
+ if (this[DESTROYED3])
11469
+ return dest;
11470
+ this[DISCARDED3] = false;
11471
+ const ended = this[EMITTED_END3];
11472
+ opts = opts || {};
11473
+ if (dest === proc3.stdout || dest === proc3.stderr)
11474
+ opts.end = false;
11475
+ else
11476
+ opts.end = opts.end !== false;
11477
+ opts.proxyErrors = !!opts.proxyErrors;
11478
+ if (ended) {
11479
+ if (opts.end)
11480
+ dest.end();
9919
11481
  } else {
9920
- this.needPax = encString(buf, off + 345, 130, prefix2) || this.needPax;
9921
- this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax;
9922
- this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax;
9923
- }
9924
- let sum = 8 * 32;
9925
- for (let i = off; i < off + 148; i++) {
9926
- sum += buf[i];
11482
+ this[PIPES3].push(!opts.proxyErrors ? new Pipe3(this, dest, opts) : new PipeProxyErrors3(this, dest, opts));
11483
+ if (this[ASYNC3])
11484
+ defer3(() => this[RESUME3]());
11485
+ else
11486
+ this[RESUME3]();
9927
11487
  }
9928
- for (let i = off + 156; i < off + 512; i++) {
9929
- sum += buf[i];
11488
+ return dest;
11489
+ }
11490
+ /**
11491
+ * Fully unhook a piped destination stream.
11492
+ *
11493
+ * If the destination stream was the only consumer of this stream (ie,
11494
+ * there are no other piped destinations or `'data'` event listeners)
11495
+ * then the flow of data will stop until there is another consumer or
11496
+ * {@link Minipass#resume} is explicitly called.
11497
+ */
11498
+ unpipe(dest) {
11499
+ const p = this[PIPES3].find((p2) => p2.dest === dest);
11500
+ if (p) {
11501
+ if (this[PIPES3].length === 1) {
11502
+ if (this[FLOWING3] && this[DATALISTENERS3] === 0) {
11503
+ this[FLOWING3] = false;
11504
+ }
11505
+ this[PIPES3] = [];
11506
+ } else
11507
+ this[PIPES3].splice(this[PIPES3].indexOf(p), 1);
11508
+ p.unpipe();
9930
11509
  }
9931
- this.cksum = sum;
9932
- encNumber(buf, off + 148, 8, this.cksum);
9933
- this.cksumValid = true;
9934
- return this.needPax;
9935
11510
  }
9936
- get type() {
9937
- return __privateGet(this, _type) === "Unsupported" ? __privateGet(this, _type) : name.get(__privateGet(this, _type));
11511
+ /**
11512
+ * Alias for {@link Minipass#on}
11513
+ */
11514
+ addListener(ev, handler) {
11515
+ return this.on(ev, handler);
9938
11516
  }
9939
- get typeKey() {
9940
- return __privateGet(this, _type);
11517
+ /**
11518
+ * Mostly identical to `EventEmitter.on`, with the following
11519
+ * behavior differences to prevent data loss and unnecessary hangs:
11520
+ *
11521
+ * - Adding a 'data' event handler will trigger the flow of data
11522
+ *
11523
+ * - Adding a 'readable' event handler when there is data waiting to be read
11524
+ * will cause 'readable' to be emitted immediately.
11525
+ *
11526
+ * - Adding an 'endish' event handler ('end', 'finish', etc.) which has
11527
+ * already passed will cause the event to be emitted immediately and all
11528
+ * handlers removed.
11529
+ *
11530
+ * - Adding an 'error' event handler after an error has been emitted will
11531
+ * cause the event to be re-emitted immediately with the error previously
11532
+ * raised.
11533
+ */
11534
+ on(ev, handler) {
11535
+ const ret = super.on(ev, handler);
11536
+ if (ev === "data") {
11537
+ this[DISCARDED3] = false;
11538
+ this[DATALISTENERS3]++;
11539
+ if (!this[PIPES3].length && !this[FLOWING3]) {
11540
+ this[RESUME3]();
11541
+ }
11542
+ } else if (ev === "readable" && this[BUFFERLENGTH3] !== 0) {
11543
+ super.emit("readable");
11544
+ } else if (isEndish3(ev) && this[EMITTED_END3]) {
11545
+ super.emit(ev);
11546
+ this.removeAllListeners(ev);
11547
+ } else if (ev === "error" && this[EMITTED_ERROR3]) {
11548
+ const h = handler;
11549
+ if (this[ASYNC3])
11550
+ defer3(() => h.call(this, this[EMITTED_ERROR3]));
11551
+ else
11552
+ h.call(this, this[EMITTED_ERROR3]);
11553
+ }
11554
+ return ret;
9941
11555
  }
9942
- set type(type) {
9943
- const c = String(code.get(type));
9944
- if (isCode(c) || c === "Unsupported") {
9945
- __privateSet(this, _type, c);
9946
- } else if (isCode(type)) {
9947
- __privateSet(this, _type, type);
9948
- } else {
9949
- throw new TypeError("invalid entry type: " + type);
11556
+ /**
11557
+ * Alias for {@link Minipass#off}
11558
+ */
11559
+ removeListener(ev, handler) {
11560
+ return this.off(ev, handler);
11561
+ }
11562
+ /**
11563
+ * Mostly identical to `EventEmitter.off`
11564
+ *
11565
+ * If a 'data' event handler is removed, and it was the last consumer
11566
+ * (ie, there are no pipe destinations or other 'data' event listeners),
11567
+ * then the flow of data will stop until there is another consumer or
11568
+ * {@link Minipass#resume} is explicitly called.
11569
+ */
11570
+ off(ev, handler) {
11571
+ const ret = super.off(ev, handler);
11572
+ if (ev === "data") {
11573
+ this[DATALISTENERS3] = this.listeners("data").length;
11574
+ if (this[DATALISTENERS3] === 0 && !this[DISCARDED3] && !this[PIPES3].length) {
11575
+ this[FLOWING3] = false;
11576
+ }
9950
11577
  }
11578
+ return ret;
9951
11579
  }
9952
- };
9953
- _type = new WeakMap();
9954
- _Header_instances = new WeakSet();
9955
- slurp_fn = function(ex, gex = false) {
9956
- Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => {
9957
- return !(v === null || v === void 0 || k === "path" && gex || k === "linkpath" && gex || k === "global");
9958
- })));
9959
- };
9960
- var splitPrefix = (p, prefixSize) => {
9961
- const pathSize = 100;
9962
- let pp = p;
9963
- let prefix2 = "";
9964
- let ret = void 0;
9965
- const root = pathModule.parse(p).root || ".";
9966
- if (Buffer.byteLength(pp) < pathSize) {
9967
- ret = [pp, prefix2, false];
9968
- } else {
9969
- prefix2 = pathModule.dirname(pp);
9970
- pp = pathModule.basename(pp);
9971
- do {
9972
- if (Buffer.byteLength(pp) <= pathSize && Buffer.byteLength(prefix2) <= prefixSize) {
9973
- ret = [pp, prefix2, false];
9974
- } else if (Buffer.byteLength(pp) > pathSize && Buffer.byteLength(prefix2) <= prefixSize) {
9975
- ret = [pp.slice(0, pathSize - 1), prefix2, true];
9976
- } else {
9977
- pp = pathModule.join(pathModule.basename(prefix2), pp);
9978
- prefix2 = pathModule.dirname(prefix2);
11580
+ /**
11581
+ * Mostly identical to `EventEmitter.removeAllListeners`
11582
+ *
11583
+ * If all 'data' event handlers are removed, and they were the last consumer
11584
+ * (ie, there are no pipe destinations), then the flow of data will stop
11585
+ * until there is another consumer or {@link Minipass#resume} is explicitly
11586
+ * called.
11587
+ */
11588
+ removeAllListeners(ev) {
11589
+ const ret = super.removeAllListeners(ev);
11590
+ if (ev === "data" || ev === void 0) {
11591
+ this[DATALISTENERS3] = 0;
11592
+ if (!this[DISCARDED3] && !this[PIPES3].length) {
11593
+ this[FLOWING3] = false;
9979
11594
  }
9980
- } while (prefix2 !== root && ret === void 0);
9981
- if (!ret) {
9982
- ret = [p.slice(0, pathSize - 1), "", true];
9983
11595
  }
11596
+ return ret;
9984
11597
  }
9985
- return ret;
9986
- };
9987
- var decString = (buf, off, size) => buf.subarray(off, off + size).toString("utf8").replace(/\0.*/, "");
9988
- var decDate = (buf, off, size) => numToDate(decNumber(buf, off, size));
9989
- var numToDate = (num) => num === void 0 ? void 0 : new Date(num * 1e3);
9990
- var decNumber = (buf, off, size) => Number(buf[off]) & 128 ? parse2(buf.subarray(off, off + size)) : decSmallNumber(buf, off, size);
9991
- var nanUndef = (value) => isNaN(value) ? void 0 : value;
9992
- var decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf.subarray(off, off + size).toString("utf8").replace(/\0.*$/, "").trim(), 8));
9993
- var MAXNUM = {
9994
- 12: 8589934591,
9995
- 8: 2097151
9996
- };
9997
- var encNumber = (buf, off, size, num) => num === void 0 ? false : num > MAXNUM[size] || num < 0 ? (encode(num, buf.subarray(off, off + size)), true) : (encSmallNumber(buf, off, size, num), false);
9998
- var encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, "ascii");
9999
- var octalString = (num, size) => padOctal(Math.floor(num).toString(8), size);
10000
- var padOctal = (str, size) => (str.length === size - 1 ? str : new Array(size - str.length - 1).join("0") + str + " ") + "\0";
10001
- var encDate = (buf, off, size, date) => date === void 0 ? false : encNumber(buf, off, size, date.getTime() / 1e3);
10002
- var NULLS = new Array(156).join("\0");
10003
- var encString = (buf, off, size, str) => str === void 0 ? false : (buf.write(str + NULLS, off, size, "utf8"), str.length !== Buffer.byteLength(str) || str.length > size);
10004
-
10005
- // node_modules/tar/dist/esm/pax.js
10006
- import { basename } from "path";
10007
- var Pax = class _Pax {
10008
- atime;
10009
- mtime;
10010
- ctime;
10011
- charset;
10012
- comment;
10013
- gid;
10014
- uid;
10015
- gname;
10016
- uname;
10017
- linkpath;
10018
- dev;
10019
- ino;
10020
- nlink;
10021
- path;
10022
- size;
10023
- mode;
10024
- global;
10025
- constructor(obj, global = false) {
10026
- this.atime = obj.atime;
10027
- this.charset = obj.charset;
10028
- this.comment = obj.comment;
10029
- this.ctime = obj.ctime;
10030
- this.dev = obj.dev;
10031
- this.gid = obj.gid;
10032
- this.global = global;
10033
- this.gname = obj.gname;
10034
- this.ino = obj.ino;
10035
- this.linkpath = obj.linkpath;
10036
- this.mtime = obj.mtime;
10037
- this.nlink = obj.nlink;
10038
- this.path = obj.path;
10039
- this.size = obj.size;
10040
- this.uid = obj.uid;
10041
- this.uname = obj.uname;
11598
+ /**
11599
+ * true if the 'end' event has been emitted
11600
+ */
11601
+ get emittedEnd() {
11602
+ return this[EMITTED_END3];
11603
+ }
11604
+ [MAYBE_EMIT_END3]() {
11605
+ if (!this[EMITTING_END3] && !this[EMITTED_END3] && !this[DESTROYED3] && this[BUFFER3].length === 0 && this[EOF3]) {
11606
+ this[EMITTING_END3] = true;
11607
+ this.emit("end");
11608
+ this.emit("prefinish");
11609
+ this.emit("finish");
11610
+ if (this[CLOSED3])
11611
+ this.emit("close");
11612
+ this[EMITTING_END3] = false;
11613
+ }
11614
+ }
11615
+ /**
11616
+ * Mostly identical to `EventEmitter.emit`, with the following
11617
+ * behavior differences to prevent data loss and unnecessary hangs:
11618
+ *
11619
+ * If the stream has been destroyed, and the event is something other
11620
+ * than 'close' or 'error', then `false` is returned and no handlers
11621
+ * are called.
11622
+ *
11623
+ * If the event is 'end', and has already been emitted, then the event
11624
+ * is ignored. If the stream is in a paused or non-flowing state, then
11625
+ * the event will be deferred until data flow resumes. If the stream is
11626
+ * async, then handlers will be called on the next tick rather than
11627
+ * immediately.
11628
+ *
11629
+ * If the event is 'close', and 'end' has not yet been emitted, then
11630
+ * the event will be deferred until after 'end' is emitted.
11631
+ *
11632
+ * If the event is 'error', and an AbortSignal was provided for the stream,
11633
+ * and there are no listeners, then the event is ignored, matching the
11634
+ * behavior of node core streams in the presense of an AbortSignal.
11635
+ *
11636
+ * If the event is 'finish' or 'prefinish', then all listeners will be
11637
+ * removed after emitting the event, to prevent double-firing.
11638
+ */
11639
+ emit(ev, ...args) {
11640
+ const data = args[0];
11641
+ if (ev !== "error" && ev !== "close" && ev !== DESTROYED3 && this[DESTROYED3]) {
11642
+ return false;
11643
+ } else if (ev === "data") {
11644
+ return !this[OBJECTMODE3] && !data ? false : this[ASYNC3] ? (defer3(() => this[EMITDATA3](data)), true) : this[EMITDATA3](data);
11645
+ } else if (ev === "end") {
11646
+ return this[EMITEND4]();
11647
+ } else if (ev === "close") {
11648
+ this[CLOSED3] = true;
11649
+ if (!this[EMITTED_END3] && !this[DESTROYED3])
11650
+ return false;
11651
+ const ret2 = super.emit("close");
11652
+ this.removeAllListeners("close");
11653
+ return ret2;
11654
+ } else if (ev === "error") {
11655
+ this[EMITTED_ERROR3] = data;
11656
+ super.emit(ERROR3, data);
11657
+ const ret2 = !this[SIGNAL3] || this.listeners("error").length ? super.emit("error", data) : false;
11658
+ this[MAYBE_EMIT_END3]();
11659
+ return ret2;
11660
+ } else if (ev === "resume") {
11661
+ const ret2 = super.emit("resume");
11662
+ this[MAYBE_EMIT_END3]();
11663
+ return ret2;
11664
+ } else if (ev === "finish" || ev === "prefinish") {
11665
+ const ret2 = super.emit(ev);
11666
+ this.removeAllListeners(ev);
11667
+ return ret2;
11668
+ }
11669
+ const ret = super.emit(ev, ...args);
11670
+ this[MAYBE_EMIT_END3]();
11671
+ return ret;
10042
11672
  }
10043
- encode() {
10044
- const body = this.encodeBody();
10045
- if (body === "") {
10046
- return Buffer.allocUnsafe(0);
11673
+ [EMITDATA3](data) {
11674
+ for (const p of this[PIPES3]) {
11675
+ if (p.dest.write(data) === false)
11676
+ this.pause();
10047
11677
  }
10048
- const bodyLen = Buffer.byteLength(body);
10049
- const bufLen = 512 * Math.ceil(1 + bodyLen / 512);
10050
- const buf = Buffer.allocUnsafe(bufLen);
10051
- for (let i = 0; i < 512; i++) {
10052
- buf[i] = 0;
11678
+ const ret = this[DISCARDED3] ? false : super.emit("data", data);
11679
+ this[MAYBE_EMIT_END3]();
11680
+ return ret;
11681
+ }
11682
+ [EMITEND4]() {
11683
+ if (this[EMITTED_END3])
11684
+ return false;
11685
+ this[EMITTED_END3] = true;
11686
+ this.readable = false;
11687
+ return this[ASYNC3] ? (defer3(() => this[EMITEND23]()), true) : this[EMITEND23]();
11688
+ }
11689
+ [EMITEND23]() {
11690
+ if (this[DECODER3]) {
11691
+ const data = this[DECODER3].end();
11692
+ if (data) {
11693
+ for (const p of this[PIPES3]) {
11694
+ p.dest.write(data);
11695
+ }
11696
+ if (!this[DISCARDED3])
11697
+ super.emit("data", data);
11698
+ }
10053
11699
  }
10054
- new Header({
10055
- // XXX split the path
10056
- // then the path should be PaxHeader + basename, but less than 99,
10057
- // prepend with the dirname
10058
- /* c8 ignore start */
10059
- path: ("PaxHeader/" + basename(this.path ?? "")).slice(0, 99),
10060
- /* c8 ignore stop */
10061
- mode: this.mode || 420,
10062
- uid: this.uid,
10063
- gid: this.gid,
10064
- size: bodyLen,
10065
- mtime: this.mtime,
10066
- type: this.global ? "GlobalExtendedHeader" : "ExtendedHeader",
10067
- linkpath: "",
10068
- uname: this.uname || "",
10069
- gname: this.gname || "",
10070
- devmaj: 0,
10071
- devmin: 0,
10072
- atime: this.atime,
10073
- ctime: this.ctime
10074
- }).encode(buf);
10075
- buf.write(body, 512, bodyLen, "utf8");
10076
- for (let i = bodyLen + 512; i < buf.length; i++) {
10077
- buf[i] = 0;
11700
+ for (const p of this[PIPES3]) {
11701
+ p.end();
10078
11702
  }
10079
- return buf;
11703
+ const ret = super.emit("end");
11704
+ this.removeAllListeners("end");
11705
+ return ret;
10080
11706
  }
10081
- encodeBody() {
10082
- 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");
11707
+ /**
11708
+ * Return a Promise that resolves to an array of all emitted data once
11709
+ * the stream ends.
11710
+ */
11711
+ async collect() {
11712
+ const buf = Object.assign([], {
11713
+ dataLength: 0
11714
+ });
11715
+ if (!this[OBJECTMODE3])
11716
+ buf.dataLength = 0;
11717
+ const p = this.promise();
11718
+ this.on("data", (c) => {
11719
+ buf.push(c);
11720
+ if (!this[OBJECTMODE3])
11721
+ buf.dataLength += c.length;
11722
+ });
11723
+ await p;
11724
+ return buf;
10083
11725
  }
10084
- encodeField(field) {
10085
- if (this[field] === void 0) {
10086
- return "";
10087
- }
10088
- const r = this[field];
10089
- const v = r instanceof Date ? r.getTime() / 1e3 : r;
10090
- const s = " " + (field === "dev" || field === "ino" || field === "nlink" ? "SCHILY." : "") + field + "=" + v + "\n";
10091
- const byteLen = Buffer.byteLength(s);
10092
- let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1;
10093
- if (byteLen + digits >= Math.pow(10, digits)) {
10094
- digits += 1;
11726
+ /**
11727
+ * Return a Promise that resolves to the concatenation of all emitted data
11728
+ * once the stream ends.
11729
+ *
11730
+ * Not allowed on objectMode streams.
11731
+ */
11732
+ async concat() {
11733
+ if (this[OBJECTMODE3]) {
11734
+ throw new Error("cannot concat in objectMode");
10095
11735
  }
10096
- const len = digits + byteLen;
10097
- return len + s;
11736
+ const buf = await this.collect();
11737
+ return this[ENCODING3] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
10098
11738
  }
10099
- static parse(str, ex, g = false) {
10100
- return new _Pax(merge(parseKV(str), ex), g);
11739
+ /**
11740
+ * Return a void Promise that resolves once the stream ends.
11741
+ */
11742
+ async promise() {
11743
+ return new Promise((resolve2, reject) => {
11744
+ this.on(DESTROYED3, () => reject(new Error("stream destroyed")));
11745
+ this.on("error", (er) => reject(er));
11746
+ this.on("end", () => resolve2());
11747
+ });
10101
11748
  }
10102
- };
10103
- var merge = (a, b) => b ? Object.assign({}, b, a) : a;
10104
- var parseKV = (str) => str.replace(/\n$/, "").split("\n").reduce(parseKVLine, /* @__PURE__ */ Object.create(null));
10105
- var parseKVLine = (set, line) => {
10106
- const n = parseInt(line, 10);
10107
- if (n !== Buffer.byteLength(line) + 1) {
10108
- return set;
11749
+ /**
11750
+ * Asynchronous `for await of` iteration.
11751
+ *
11752
+ * This will continue emitting all chunks until the stream terminates.
11753
+ */
11754
+ [Symbol.asyncIterator]() {
11755
+ this[DISCARDED3] = false;
11756
+ let stopped = false;
11757
+ const stop = async () => {
11758
+ this.pause();
11759
+ stopped = true;
11760
+ return { value: void 0, done: true };
11761
+ };
11762
+ const next = () => {
11763
+ if (stopped)
11764
+ return stop();
11765
+ const res = this.read();
11766
+ if (res !== null)
11767
+ return Promise.resolve({ done: false, value: res });
11768
+ if (this[EOF3])
11769
+ return stop();
11770
+ let resolve2;
11771
+ let reject;
11772
+ const onerr = (er) => {
11773
+ this.off("data", ondata);
11774
+ this.off("end", onend);
11775
+ this.off(DESTROYED3, ondestroy);
11776
+ stop();
11777
+ reject(er);
11778
+ };
11779
+ const ondata = (value) => {
11780
+ this.off("error", onerr);
11781
+ this.off("end", onend);
11782
+ this.off(DESTROYED3, ondestroy);
11783
+ this.pause();
11784
+ resolve2({ value, done: !!this[EOF3] });
11785
+ };
11786
+ const onend = () => {
11787
+ this.off("error", onerr);
11788
+ this.off("data", ondata);
11789
+ this.off(DESTROYED3, ondestroy);
11790
+ stop();
11791
+ resolve2({ done: true, value: void 0 });
11792
+ };
11793
+ const ondestroy = () => onerr(new Error("stream destroyed"));
11794
+ return new Promise((res2, rej) => {
11795
+ reject = rej;
11796
+ resolve2 = res2;
11797
+ this.once(DESTROYED3, ondestroy);
11798
+ this.once("error", onerr);
11799
+ this.once("end", onend);
11800
+ this.once("data", ondata);
11801
+ });
11802
+ };
11803
+ return {
11804
+ next,
11805
+ throw: stop,
11806
+ return: stop,
11807
+ [Symbol.asyncIterator]() {
11808
+ return this;
11809
+ }
11810
+ };
10109
11811
  }
10110
- line = line.slice((n + " ").length);
10111
- const kv = line.split("=");
10112
- const r = kv.shift();
10113
- if (!r) {
10114
- return set;
11812
+ /**
11813
+ * Synchronous `for of` iteration.
11814
+ *
11815
+ * The iteration will terminate when the internal buffer runs out, even
11816
+ * if the stream has not yet terminated.
11817
+ */
11818
+ [Symbol.iterator]() {
11819
+ this[DISCARDED3] = false;
11820
+ let stopped = false;
11821
+ const stop = () => {
11822
+ this.pause();
11823
+ this.off(ERROR3, stop);
11824
+ this.off(DESTROYED3, stop);
11825
+ this.off("end", stop);
11826
+ stopped = true;
11827
+ return { done: true, value: void 0 };
11828
+ };
11829
+ const next = () => {
11830
+ if (stopped)
11831
+ return stop();
11832
+ const value = this.read();
11833
+ return value === null ? stop() : { done: false, value };
11834
+ };
11835
+ this.once("end", stop);
11836
+ this.once(ERROR3, stop);
11837
+ this.once(DESTROYED3, stop);
11838
+ return {
11839
+ next,
11840
+ throw: stop,
11841
+ return: stop,
11842
+ [Symbol.iterator]() {
11843
+ return this;
11844
+ }
11845
+ };
11846
+ }
11847
+ /**
11848
+ * Destroy a stream, preventing it from being used for any further purpose.
11849
+ *
11850
+ * If the stream has a `close()` method, then it will be called on
11851
+ * destruction.
11852
+ *
11853
+ * After destruction, any attempt to write data, read data, or emit most
11854
+ * events will be ignored.
11855
+ *
11856
+ * If an error argument is provided, then it will be emitted in an
11857
+ * 'error' event.
11858
+ */
11859
+ destroy(er) {
11860
+ if (this[DESTROYED3]) {
11861
+ if (er)
11862
+ this.emit("error", er);
11863
+ else
11864
+ this.emit(DESTROYED3);
11865
+ return this;
11866
+ }
11867
+ this[DESTROYED3] = true;
11868
+ this[DISCARDED3] = true;
11869
+ this[BUFFER3].length = 0;
11870
+ this[BUFFERLENGTH3] = 0;
11871
+ const wc = this;
11872
+ if (typeof wc.close === "function" && !this[CLOSED3])
11873
+ wc.close();
11874
+ if (er)
11875
+ this.emit("error", er);
11876
+ else
11877
+ this.emit(DESTROYED3);
11878
+ return this;
11879
+ }
11880
+ /**
11881
+ * Alias for {@link isStream}
11882
+ *
11883
+ * Former export location, maintained for backwards compatibility.
11884
+ *
11885
+ * @deprecated
11886
+ */
11887
+ static get isStream() {
11888
+ return isStream3;
10115
11889
  }
10116
- const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, "$1");
10117
- const v = kv.join("=");
10118
- set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ? new Date(Number(v) * 1e3) : /^[0-9]+$/.test(v) ? +v : v;
10119
- return set;
10120
11890
  };
10121
11891
 
10122
11892
  // node_modules/tar/dist/esm/normalize-windows-path.js
@@ -10125,7 +11895,7 @@ var normalizeWindowsPath = platform !== "win32" ? (p) => p : (p) => p && p.repla
10125
11895
 
10126
11896
  // node_modules/tar/dist/esm/read-entry.js
10127
11897
  var _ReadEntry_instances, slurp_fn2;
10128
- var ReadEntry = class extends Minipass {
11898
+ var ReadEntry = class extends Minipass3 {
10129
11899
  constructor(header, ex, gex) {
10130
11900
  super({});
10131
11901
  __privateAdd(this, _ReadEntry_instances);
@@ -10278,7 +12048,7 @@ var EX = Symbol("extendedHeader");
10278
12048
  var GEX = Symbol("globalExtendedHeader");
10279
12049
  var META = Symbol("meta");
10280
12050
  var EMITMETA = Symbol("emitMeta");
10281
- var BUFFER2 = Symbol("buffer");
12051
+ var BUFFER4 = Symbol("buffer");
10282
12052
  var QUEUE = Symbol("queue");
10283
12053
  var ENDED = Symbol("ended");
10284
12054
  var EMITTEDEND = Symbol("emittedEnd");
@@ -10293,7 +12063,7 @@ var CONSUMING = Symbol("consuming");
10293
12063
  var BUFFERCONCAT = Symbol("bufferConcat");
10294
12064
  var MAYBEEND = Symbol("maybeEnd");
10295
12065
  var WRITING = Symbol("writing");
10296
- var ABORTED2 = Symbol("aborted");
12066
+ var ABORTED4 = Symbol("aborted");
10297
12067
  var DONE = Symbol("onDone");
10298
12068
  var SAW_VALID_ENTRY = Symbol("sawValidEntry");
10299
12069
  var SAW_NULL_BLOCK = Symbol("sawNullBlock");
@@ -10309,7 +12079,7 @@ var Parser = class extends EE2 {
10309
12079
  writable = true;
10310
12080
  readable = false;
10311
12081
  [QUEUE] = new Yallist();
10312
- [BUFFER2];
12082
+ [BUFFER4];
10313
12083
  [READENTRY];
10314
12084
  [WRITEENTRY];
10315
12085
  [STATE] = "begin";
@@ -10318,7 +12088,7 @@ var Parser = class extends EE2 {
10318
12088
  [GEX];
10319
12089
  [ENDED] = false;
10320
12090
  [UNZIP];
10321
- [ABORTED2] = false;
12091
+ [ABORTED4] = false;
10322
12092
  [SAW_VALID_ENTRY];
10323
12093
  [SAW_NULL_BLOCK] = false;
10324
12094
  [SAW_EOF] = false;
@@ -10541,7 +12311,7 @@ var Parser = class extends EE2 {
10541
12311
  }
10542
12312
  }
10543
12313
  abort(error) {
10544
- this[ABORTED2] = true;
12314
+ this[ABORTED4] = true;
10545
12315
  this.emit("abort", error);
10546
12316
  this.warn("TAR_ABORT", error, { recoverable: false });
10547
12317
  }
@@ -10558,18 +12328,18 @@ var Parser = class extends EE2 {
10558
12328
  typeof encoding === "string" ? encoding : "utf8"
10559
12329
  );
10560
12330
  }
10561
- if (this[ABORTED2]) {
12331
+ if (this[ABORTED4]) {
10562
12332
  cb == null ? void 0 : cb();
10563
12333
  return false;
10564
12334
  }
10565
12335
  const needSniff = this[UNZIP] === void 0 || this.brotli === void 0 && this[UNZIP] === false;
10566
12336
  if (needSniff && chunk) {
10567
- if (this[BUFFER2]) {
10568
- chunk = Buffer.concat([this[BUFFER2], chunk]);
10569
- this[BUFFER2] = void 0;
12337
+ if (this[BUFFER4]) {
12338
+ chunk = Buffer.concat([this[BUFFER4], chunk]);
12339
+ this[BUFFER4] = void 0;
10570
12340
  }
10571
12341
  if (chunk.length < gzipHeader.length) {
10572
- this[BUFFER2] = chunk;
12342
+ this[BUFFER4] = chunk;
10573
12343
  cb == null ? void 0 : cb();
10574
12344
  return true;
10575
12345
  }
@@ -10584,7 +12354,7 @@ var Parser = class extends EE2 {
10584
12354
  if (this[ENDED]) {
10585
12355
  this.brotli = true;
10586
12356
  } else {
10587
- this[BUFFER2] = chunk;
12357
+ this[BUFFER4] = chunk;
10588
12358
  cb == null ? void 0 : cb();
10589
12359
  return true;
10590
12360
  }
@@ -10629,19 +12399,19 @@ var Parser = class extends EE2 {
10629
12399
  return ret;
10630
12400
  }
10631
12401
  [BUFFERCONCAT](c) {
10632
- if (c && !this[ABORTED2]) {
10633
- this[BUFFER2] = this[BUFFER2] ? Buffer.concat([this[BUFFER2], c]) : c;
12402
+ if (c && !this[ABORTED4]) {
12403
+ this[BUFFER4] = this[BUFFER4] ? Buffer.concat([this[BUFFER4], c]) : c;
10634
12404
  }
10635
12405
  }
10636
12406
  [MAYBEEND]() {
10637
- if (this[ENDED] && !this[EMITTEDEND] && !this[ABORTED2] && !this[CONSUMING]) {
12407
+ if (this[ENDED] && !this[EMITTEDEND] && !this[ABORTED4] && !this[CONSUMING]) {
10638
12408
  this[EMITTEDEND] = true;
10639
12409
  const entry = this[WRITEENTRY];
10640
12410
  if (entry && entry.blockRemain) {
10641
- const have = this[BUFFER2] ? this[BUFFER2].length : 0;
12411
+ const have = this[BUFFER4] ? this[BUFFER4].length : 0;
10642
12412
  this.warn("TAR_BAD_ARCHIVE", `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry });
10643
- if (this[BUFFER2]) {
10644
- entry.write(this[BUFFER2]);
12413
+ if (this[BUFFER4]) {
12414
+ entry.write(this[BUFFER4]);
10645
12415
  }
10646
12416
  entry.end();
10647
12417
  }
@@ -10652,33 +12422,33 @@ var Parser = class extends EE2 {
10652
12422
  var _a;
10653
12423
  if (this[CONSUMING] && chunk) {
10654
12424
  this[BUFFERCONCAT](chunk);
10655
- } else if (!chunk && !this[BUFFER2]) {
12425
+ } else if (!chunk && !this[BUFFER4]) {
10656
12426
  this[MAYBEEND]();
10657
12427
  } else if (chunk) {
10658
12428
  this[CONSUMING] = true;
10659
- if (this[BUFFER2]) {
12429
+ if (this[BUFFER4]) {
10660
12430
  this[BUFFERCONCAT](chunk);
10661
- const c = this[BUFFER2];
10662
- this[BUFFER2] = void 0;
12431
+ const c = this[BUFFER4];
12432
+ this[BUFFER4] = void 0;
10663
12433
  this[CONSUMECHUNKSUB](c);
10664
12434
  } else {
10665
12435
  this[CONSUMECHUNKSUB](chunk);
10666
12436
  }
10667
- while (this[BUFFER2] && ((_a = this[BUFFER2]) == null ? void 0 : _a.length) >= 512 && !this[ABORTED2] && !this[SAW_EOF]) {
10668
- const c = this[BUFFER2];
10669
- this[BUFFER2] = void 0;
12437
+ while (this[BUFFER4] && ((_a = this[BUFFER4]) == null ? void 0 : _a.length) >= 512 && !this[ABORTED4] && !this[SAW_EOF]) {
12438
+ const c = this[BUFFER4];
12439
+ this[BUFFER4] = void 0;
10670
12440
  this[CONSUMECHUNKSUB](c);
10671
12441
  }
10672
12442
  this[CONSUMING] = false;
10673
12443
  }
10674
- if (!this[BUFFER2] || this[ENDED]) {
12444
+ if (!this[BUFFER4] || this[ENDED]) {
10675
12445
  this[MAYBEEND]();
10676
12446
  }
10677
12447
  }
10678
12448
  [CONSUMECHUNKSUB](chunk) {
10679
12449
  let position = 0;
10680
12450
  const length = chunk.length;
10681
- while (position + 512 <= length && !this[ABORTED2] && !this[SAW_EOF]) {
12451
+ while (position + 512 <= length && !this[ABORTED4] && !this[SAW_EOF]) {
10682
12452
  switch (this[STATE]) {
10683
12453
  case "begin":
10684
12454
  case "header":
@@ -10698,13 +12468,13 @@ var Parser = class extends EE2 {
10698
12468
  }
10699
12469
  }
10700
12470
  if (position < length) {
10701
- if (this[BUFFER2]) {
10702
- this[BUFFER2] = Buffer.concat([
12471
+ if (this[BUFFER4]) {
12472
+ this[BUFFER4] = Buffer.concat([
10703
12473
  chunk.subarray(position),
10704
- this[BUFFER2]
12474
+ this[BUFFER4]
10705
12475
  ]);
10706
12476
  } else {
10707
- this[BUFFER2] = chunk.subarray(position);
12477
+ this[BUFFER4] = chunk.subarray(position);
10708
12478
  }
10709
12479
  }
10710
12480
  }
@@ -10723,7 +12493,7 @@ var Parser = class extends EE2 {
10723
12493
  }
10724
12494
  if (cb)
10725
12495
  this.once("finish", cb);
10726
- if (!this[ABORTED2]) {
12496
+ if (!this[ABORTED4]) {
10727
12497
  if (this[UNZIP]) {
10728
12498
  if (chunk)
10729
12499
  this[UNZIP].write(chunk);
@@ -10904,7 +12674,7 @@ var DIRECTORY = Symbol("directory");
10904
12674
  var SYMLINK = Symbol("symlink");
10905
12675
  var HARDLINK = Symbol("hardlink");
10906
12676
  var HEADER = Symbol("header");
10907
- var READ2 = Symbol("read");
12677
+ var READ4 = Symbol("read");
10908
12678
  var LSTAT = Symbol("lstat");
10909
12679
  var ONLSTAT = Symbol("onlstat");
10910
12680
  var ONREAD = Symbol("onread");
@@ -10917,7 +12687,7 @@ var AWAITDRAIN = Symbol("awaitDrain");
10917
12687
  var ONDRAIN = Symbol("ondrain");
10918
12688
  var PREFIX = Symbol("prefix");
10919
12689
  var _hadError;
10920
- var WriteEntry = class extends Minipass {
12690
+ var WriteEntry = class extends Minipass3 {
10921
12691
  constructor(p, opt_ = {}) {
10922
12692
  const opt = dealias(opt_);
10923
12693
  super();
@@ -11168,9 +12938,9 @@ var WriteEntry = class extends Minipass {
11168
12938
  this.pos = 0;
11169
12939
  this.remain = this.stat.size;
11170
12940
  this.length = this.buf.length;
11171
- this[READ2]();
12941
+ this[READ4]();
11172
12942
  }
11173
- [READ2]() {
12943
+ [READ4]() {
11174
12944
  const { fd, buf, offset, length, pos: pos2 } = this;
11175
12945
  if (fd === void 0 || buf === void 0) {
11176
12946
  throw new Error("cannot read file without first opening");
@@ -11261,7 +13031,7 @@ var WriteEntry = class extends Minipass {
11261
13031
  this.offset = 0;
11262
13032
  }
11263
13033
  this.length = this.buf.length - this.offset;
11264
- this[READ2]();
13034
+ this[READ4]();
11265
13035
  }
11266
13036
  };
11267
13037
  _hadError = new WeakMap();
@@ -11276,7 +13046,7 @@ var WriteEntrySync = class extends WriteEntry {
11276
13046
  [OPENFILE]() {
11277
13047
  this[ONOPENFILE](fs4.openSync(this.absolute, "r"));
11278
13048
  }
11279
- [READ2]() {
13049
+ [READ4]() {
11280
13050
  let threw = true;
11281
13051
  try {
11282
13052
  const { fd, buf, offset, length, pos: pos2 } = this;
@@ -11307,7 +13077,7 @@ var WriteEntrySync = class extends WriteEntry {
11307
13077
  cb();
11308
13078
  }
11309
13079
  };
11310
- var WriteEntryTar = class extends Minipass {
13080
+ var WriteEntryTar = class extends Minipass3 {
11311
13081
  blockLen = 0;
11312
13082
  blockRemain = 0;
11313
13083
  buf = 0;
@@ -11487,7 +13257,7 @@ var PackJob = class {
11487
13257
  this.absolute = absolute;
11488
13258
  }
11489
13259
  };
11490
- var EOF2 = Buffer.alloc(1024);
13260
+ var EOF4 = Buffer.alloc(1024);
11491
13261
  var ONSTAT = Symbol("onStat");
11492
13262
  var ENDED2 = Symbol("ended");
11493
13263
  var QUEUE2 = Symbol("queue");
@@ -11508,7 +13278,7 @@ var ENTRYOPT = Symbol("entryOpt");
11508
13278
  var WRITEENTRYCLASS = Symbol("writeEntryClass");
11509
13279
  var WRITE = Symbol("write");
11510
13280
  var ONDRAIN2 = Symbol("ondrain");
11511
- var Pack = class extends Minipass {
13281
+ var Pack = class extends Minipass3 {
11512
13282
  opt;
11513
13283
  cwd;
11514
13284
  maxReadSize;
@@ -11703,9 +13473,9 @@ var Pack = class extends Minipass {
11703
13473
  this[PROCESSING] = false;
11704
13474
  if (this[ENDED2] && !this[QUEUE2].length && this[JOBS] === 0) {
11705
13475
  if (this.zip) {
11706
- this.zip.end(EOF2);
13476
+ this.zip.end(EOF4);
11707
13477
  } else {
11708
- super.write(EOF2);
13478
+ super.write(EOF4);
11709
13479
  super.end();
11710
13480
  }
11711
13481
  }