@tencent-ai/codebuddy-code 1.21.0-next.6cd5427.20251029 → 1.21.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencent-ai/codebuddy-code",
3
- "version": "1.21.0-next.6cd5427.20251029",
3
+ "version": "1.21.1",
4
4
  "description": "Use CodeBuddy, Tencent's AI assistant, right from your terminal. CodeBuddy can understand your codebase, edit files, run terminal commands, and handle entire workflows for you.",
5
5
  "main": "lib/node/index.js",
6
6
  "typings": "lib/node/index.d.ts",
@@ -29,8 +29,7 @@
29
29
  "url": "https://cnb.cool/codebuddy/codebuddy-code/-/issues"
30
30
  },
31
31
  "publishConfig": {
32
- "access": "public",
33
- "tag": "next"
32
+ "access": "public"
34
33
  },
35
34
  "scripts": {},
36
35
  "devDependencies": {}
@@ -173,6 +173,6 @@
173
173
  "productFeatures": {
174
174
  "BillingNotice": false
175
175
  },
176
- "commit": "6cd542726cb87f019de5a30e50b8b740ece3dfb2",
177
- "date": "2025-10-28T16:05:26.105Z"
176
+ "commit": "d3e55a09433799f116baa8d461336e545ea8c70a",
177
+ "date": "2025-10-29T08:13:29.869Z"
178
178
  }
@@ -175,6 +175,6 @@
175
175
  "productFeatures": {
176
176
  "BillingNotice": false
177
177
  },
178
- "commit": "6cd542726cb87f019de5a30e50b8b740ece3dfb2",
179
- "date": "2025-10-28T16:05:23.668Z"
178
+ "commit": "d3e55a09433799f116baa8d461336e545ea8c70a",
179
+ "date": "2025-10-29T08:13:27.438Z"
180
180
  }
package/product.ioa.json CHANGED
@@ -318,6 +318,6 @@
318
318
  "productFeatures": {
319
319
  "BillingNotice": false
320
320
  },
321
- "commit": "6cd542726cb87f019de5a30e50b8b740ece3dfb2",
322
- "date": "2025-10-28T16:05:24.884Z"
321
+ "commit": "d3e55a09433799f116baa8d461336e545ea8c70a",
322
+ "date": "2025-10-29T08:13:28.663Z"
323
323
  }
package/product.json CHANGED
@@ -692,6 +692,6 @@
692
692
  "description": "tool-skill-description"
693
693
  }
694
694
  ],
695
- "commit": "6cd542726cb87f019de5a30e50b8b740ece3dfb2",
696
- "date": "2025-10-28T16:05:22.463Z"
695
+ "commit": "d3e55a09433799f116baa8d461336e545ea8c70a",
696
+ "date": "2025-10-29T08:13:26.228Z"
697
697
  }
@@ -145,6 +145,6 @@
145
145
  "productFeatures": {
146
146
  "BillingNotice": false
147
147
  },
148
- "commit": "6cd542726cb87f019de5a30e50b8b740ece3dfb2",
149
- "date": "2025-10-28T16:05:27.321Z"
148
+ "commit": "d3e55a09433799f116baa8d461336e545ea8c70a",
149
+ "date": "2025-10-29T08:13:31.091Z"
150
150
  }
@@ -1 +0,0 @@
1
- "use strict";exports.id=293,exports.ids=[293],exports.modules={28293:(t,e,s)=>{s.d(e,{n_:()=>Minipass});var i=s(78474),r=s(57075),n=s(46193);const h="object"==typeof process&&process?process:{stdout:null,stderr:null},isStream=t=>!!t&&"object"==typeof t&&(t instanceof Minipass||t instanceof r||isReadable(t)||isWritable(t)),isReadable=t=>!!t&&"object"==typeof t&&t instanceof i.EventEmitter&&"function"==typeof t.pipe&&t.pipe!==r.Writable.prototype.pipe,isWritable=t=>!!t&&"object"==typeof t&&t instanceof i.EventEmitter&&"function"==typeof t.write&&"function"==typeof t.end,o=Symbol("EOF"),a=Symbol("maybeEmitEnd"),u=Symbol("emittedEnd"),f=Symbol("emittingEnd"),d=Symbol("emittedError"),l=Symbol("closed"),c=Symbol("read"),m=Symbol("flush"),p=Symbol("flushChunk"),b=Symbol("encoding"),y=Symbol("decoder"),g=Symbol("flowing"),E=Symbol("paused"),w=Symbol("resume"),S=Symbol("buffer"),v=Symbol("pipes"),j=Symbol("bufferLength"),L=Symbol("bufferPush"),x=Symbol("bufferShift"),B=Symbol("objectMode"),P=Symbol("destroyed"),M=Symbol("error"),A=Symbol("emitData"),O=Symbol("emitEnd"),D=Symbol("emitEnd2"),R=Symbol("async"),T=Symbol("abort"),_=Symbol("aborted"),C=Symbol("signal"),I=Symbol("dataListeners"),N=Symbol("discarded"),defer=t=>Promise.resolve().then(t),nodefer=t=>t();class Pipe{src;dest;opts;ondrain;constructor(t,e,s){this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[w](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=t=>e.emit("error",t),t.on("error",this.proxyErrors)}}class Minipass extends i.EventEmitter{[g]=!1;[E]=!1;[v]=[];[S]=[];[B];[b];[R];[y];[o]=!1;[u]=!1;[f]=!1;[l]=!1;[d]=null;[j]=0;[P]=!1;[C];[_]=!1;[I]=0;[N]=!1;writable=!0;readable=!0;constructor(...t){const e=t[0]||{};if(super(),e.objectMode&&"string"==typeof e.encoding)throw new TypeError("Encoding and objectMode may not be used together");e.objectMode?(this[B]=!0,this[b]=null):(t=>!t.objectMode&&!!t.encoding&&"buffer"!==t.encoding)(e)?(this[b]=e.encoding,this[B]=!1):(this[B]=!1,this[b]=null),this[R]=!!e.async,this[y]=this[b]?new n.StringDecoder(this[b]):null,e&&!0===e.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[S]}),e&&!0===e.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[v]});const{signal:s}=e;s&&(this[C]=s,s.aborted?this[T]():s.addEventListener("abort",(()=>this[T]())))}get bufferLength(){return this[j]}get encoding(){return this[b]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[B]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[R]}set async(t){this[R]=this[R]||!!t}[T](){this[_]=!0,this.emit("abort",this[C]?.reason),this.destroy(this[C]?.reason)}get aborted(){return this[_]}set aborted(t){}write(t,e,s){if(this[_])return!1;if(this[o])throw new Error("write after end");if(this[P])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;"function"==typeof e&&(s=e,e="utf8"),e||(e="utf8");const i=this[R]?defer:nodefer;if(!this[B]&&!Buffer.isBuffer(t))if(r=t,!Buffer.isBuffer(r)&&ArrayBuffer.isView(r))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if((t=>t instanceof ArrayBuffer||!!t&&"object"==typeof t&&t.constructor&&"ArrayBuffer"===t.constructor.name&&t.byteLength>=0)(t))t=Buffer.from(t);else if("string"!=typeof t)throw new Error("Non-contiguous data written to non-objectMode stream");var r;return this[B]?(this[g]&&0!==this[j]&&this[m](!0),this[g]?this.emit("data",t):this[L](t),0!==this[j]&&this.emit("readable"),s&&i(s),this[g]):t.length?("string"!=typeof t||e===this[b]&&!this[y]?.lastNeed||(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[b]&&(t=this[y].write(t)),this[g]&&0!==this[j]&&this[m](!0),this[g]?this.emit("data",t):this[L](t),0!==this[j]&&this.emit("readable"),s&&i(s),this[g]):(0!==this[j]&&this.emit("readable"),s&&i(s),this[g])}read(t){if(this[P])return null;if(this[N]=!1,0===this[j]||0===t||t&&t>this[j])return this[a](),null;this[B]&&(t=null),this[S].length>1&&!this[B]&&(this[S]=[this[b]?this[S].join(""):Buffer.concat(this[S],this[j])]);const e=this[c](t||null,this[S][0]);return this[a](),e}[c](t,e){if(this[B])this[x]();else{const s=e;t===s.length||null===t?this[x]():"string"==typeof s?(this[S][0]=s.slice(t),e=s.slice(0,t),this[j]-=t):(this[S][0]=s.subarray(t),e=s.subarray(0,t),this[j]-=t)}return this.emit("data",e),this[S].length||this[o]||this.emit("drain"),e}end(t,e,s){return"function"==typeof t&&(s=t,t=void 0),"function"==typeof e&&(s=e,e="utf8"),void 0!==t&&this.write(t,e),s&&this.once("end",s),this[o]=!0,this.writable=!1,!this[g]&&this[E]||this[a](),this}[w](){this[P]||(this[I]||this[v].length||(this[N]=!0),this[E]=!1,this[g]=!0,this.emit("resume"),this[S].length?this[m]():this[o]?this[a]():this.emit("drain"))}resume(){return this[w]()}pause(){this[g]=!1,this[E]=!0,this[N]=!1}get destroyed(){return this[P]}get flowing(){return this[g]}get paused(){return this[E]}[L](t){this[B]?this[j]+=1:this[j]+=t.length,this[S].push(t)}[x](){return this[B]?this[j]-=1:this[j]-=this[S][0].length,this[S].shift()}[m](t=!1){do{}while(this[p](this[x]())&&this[S].length);t||this[S].length||this[o]||this.emit("drain")}[p](t){return this.emit("data",t),this[g]}pipe(t,e){if(this[P])return t;this[N]=!1;const s=this[u];return e=e||{},t===h.stdout||t===h.stderr?e.end=!1:e.end=!1!==e.end,e.proxyErrors=!!e.proxyErrors,s?e.end&&t.end():(this[v].push(e.proxyErrors?new PipeProxyErrors(this,t,e):new Pipe(this,t,e)),this[R]?defer((()=>this[w]())):this[w]()),t}unpipe(t){const e=this[v].find((e=>e.dest===t));e&&(1===this[v].length?(this[g]&&0===this[I]&&(this[g]=!1),this[v]=[]):this[v].splice(this[v].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){const s=super.on(t,e);if("data"===t)this[N]=!1,this[I]++,this[v].length||this[g]||this[w]();else if("readable"===t&&0!==this[j])super.emit("readable");else if((t=>"end"===t||"finish"===t||"prefinish"===t)(t)&&this[u])super.emit(t),this.removeAllListeners(t);else if("error"===t&&this[d]){const t=e;this[R]?defer((()=>t.call(this,this[d]))):t.call(this,this[d])}return s}removeListener(t,e){return this.off(t,e)}off(t,e){const s=super.off(t,e);return"data"===t&&(this[I]=this.listeners("data").length,0!==this[I]||this[N]||this[v].length||(this[g]=!1)),s}removeAllListeners(t){const e=super.removeAllListeners(t);return"data"!==t&&void 0!==t||(this[I]=0,this[N]||this[v].length||(this[g]=!1)),e}get emittedEnd(){return this[u]}[a](){this[f]||this[u]||this[P]||0!==this[S].length||!this[o]||(this[f]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[l]&&this.emit("close"),this[f]=!1)}emit(t,...e){const s=e[0];if("error"!==t&&"close"!==t&&t!==P&&this[P])return!1;if("data"===t)return!(!this[B]&&!s)&&(this[R]?(defer((()=>this[A](s))),!0):this[A](s));if("end"===t)return this[O]();if("close"===t){if(this[l]=!0,!this[u]&&!this[P])return!1;const t=super.emit("close");return this.removeAllListeners("close"),t}if("error"===t){this[d]=s,super.emit(M,s);const t=!(this[C]&&!this.listeners("error").length)&&super.emit("error",s);return this[a](),t}if("resume"===t){const t=super.emit("resume");return this[a](),t}if("finish"===t||"prefinish"===t){const e=super.emit(t);return this.removeAllListeners(t),e}const i=super.emit(t,...e);return this[a](),i}[A](t){for(const e of this[v])!1===e.dest.write(t)&&this.pause();const e=!this[N]&&super.emit("data",t);return this[a](),e}[O](){return!this[u]&&(this[u]=!0,this.readable=!1,this[R]?(defer((()=>this[D]())),!0):this[D]())}[D](){if(this[y]){const t=this[y].end();if(t){for(const e of this[v])e.dest.write(t);this[N]||super.emit("data",t)}}for(const t of this[v])t.end();const t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){const t=Object.assign([],{dataLength:0});this[B]||(t.dataLength=0);const e=this.promise();return this.on("data",(e=>{t.push(e),this[B]||(t.dataLength+=e.length)})),await e,t}async concat(){if(this[B])throw new Error("cannot concat in objectMode");const t=await this.collect();return this[b]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,e)=>{this.on(P,(()=>e(new Error("stream destroyed")))),this.on("error",(t=>e(t))),this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[N]=!1;let t=!1;const stop=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return stop();const e=this.read();if(null!==e)return Promise.resolve({done:!1,value:e});if(this[o])return stop();let s,i;const onerr=t=>{this.off("data",ondata),this.off("end",onend),this.off(P,ondestroy),stop(),i(t)},ondata=t=>{this.off("error",onerr),this.off("end",onend),this.off(P,ondestroy),this.pause(),s({value:t,done:!!this[o]})},onend=()=>{this.off("error",onerr),this.off("data",ondata),this.off(P,ondestroy),stop(),s({done:!0,value:void 0})},ondestroy=()=>onerr(new Error("stream destroyed"));return new Promise(((t,e)=>{i=e,s=t,this.once(P,ondestroy),this.once("error",onerr),this.once("end",onend),this.once("data",ondata)}))},throw:stop,return:stop,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[N]=!1;let t=!1;const stop=()=>(this.pause(),this.off(M,stop),this.off(P,stop),this.off("end",stop),t=!0,{done:!0,value:void 0});return this.once("end",stop),this.once(M,stop),this.once(P,stop),{next:()=>{if(t)return stop();const e=this.read();return null===e?stop():{done:!1,value:e}},throw:stop,return:stop,[Symbol.iterator](){return this}}}destroy(t){if(this[P])return t?this.emit("error",t):this.emit(P),this;this[P]=!0,this[N]=!0,this[S].length=0,this[j]=0;return"function"!=typeof this.close||this[l]||this.close(),t?this.emit("error",t):this.emit(P),this}static get isStream(){return isStream}}}};
@@ -1 +0,0 @@
1
- "use strict";exports.id=33,exports.ids=[33],exports.modules={53033:(t,e,i)=>{i.r(e),i.d(e,{Header:()=>Header,Pack:()=>Pack,PackJob:()=>PackJob,PackSync:()=>PackSync,Parser:()=>Parser,Pax:()=>Pax,ReadEntry:()=>ReadEntry,Unpack:()=>Unpack,UnpackSync:()=>UnpackSync,WriteEntry:()=>WriteEntry,WriteEntrySync:()=>WriteEntrySync,WriteEntryTar:()=>WriteEntryTar,c:()=>hi,create:()=>hi,extract:()=>Qi,filesFilter:()=>filesFilter,list:()=>pe,r:()=>ts,replace:()=>ts,t:()=>pe,types:()=>s,u:()=>es,update:()=>es,x:()=>Qi});var s={};i.r(s),i.d(s,{code:()=>It,isCode:()=>isCode,isName:()=>isName,name:()=>xt});var r=i(24434),n=i(79896),h=i(78474),o=i(57075),a=i(46193);const l="object"==typeof process&&process?process:{stdout:null,stderr:null},isStream=t=>!!t&&"object"==typeof t&&(t instanceof Minipass||t instanceof o||isReadable(t)||isWritable(t)),isReadable=t=>!!t&&"object"==typeof t&&t instanceof h.EventEmitter&&"function"==typeof t.pipe&&t.pipe!==o.Writable.prototype.pipe,isWritable=t=>!!t&&"object"==typeof t&&t instanceof h.EventEmitter&&"function"==typeof t.write&&"function"==typeof t.end,c=Symbol("EOF"),d=Symbol("maybeEmitEnd"),u=Symbol("emittedEnd"),m=Symbol("emittingEnd"),p=Symbol("emittedError"),f=Symbol("closed"),y=Symbol("read"),b=Symbol("flush"),E=Symbol("flushChunk"),w=Symbol("encoding"),g=Symbol("decoder"),S=Symbol("flowing"),R=Symbol("paused"),_=Symbol("resume"),v=Symbol("buffer"),O=Symbol("pipes"),k=Symbol("bufferLength"),T=Symbol("bufferPush"),L=Symbol("bufferShift"),A=Symbol("objectMode"),N=Symbol("destroyed"),D=Symbol("error"),x=Symbol("emitData"),I=Symbol("emitEnd"),P=Symbol("emitEnd2"),B=Symbol("async"),F=Symbol("abort"),C=Symbol("aborted"),M=Symbol("signal"),z=Symbol("dataListeners"),U=Symbol("discarded"),defer=t=>Promise.resolve().then(t),nodefer=t=>t();class Pipe{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[_](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=t=>e.emit("error",t),t.on("error",this.proxyErrors)}}class Minipass extends h.EventEmitter{[S]=!1;[R]=!1;[O]=[];[v]=[];[A];[w];[B];[g];[c]=!1;[u]=!1;[m]=!1;[f]=!1;[p]=null;[k]=0;[N]=!1;[M];[C]=!1;[z]=0;[U]=!1;writable=!0;readable=!0;constructor(...t){const e=t[0]||{};if(super(),e.objectMode&&"string"==typeof e.encoding)throw new TypeError("Encoding and objectMode may not be used together");e.objectMode?(this[A]=!0,this[w]=null):(t=>!t.objectMode&&!!t.encoding&&"buffer"!==t.encoding)(e)?(this[w]=e.encoding,this[A]=!1):(this[A]=!1,this[w]=null),this[B]=!!e.async,this[g]=this[w]?new a.StringDecoder(this[w]):null,e&&!0===e.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[v]}),e&&!0===e.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[O]});const{signal:i}=e;i&&(this[M]=i,i.aborted?this[F]():i.addEventListener("abort",(()=>this[F]())))}get bufferLength(){return this[k]}get encoding(){return this[w]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[A]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[B]}set async(t){this[B]=this[B]||!!t}[F](){this[C]=!0,this.emit("abort",this[M]?.reason),this.destroy(this[M]?.reason)}get aborted(){return this[C]}set aborted(t){}write(t,e,i){if(this[C])return!1;if(this[c])throw new Error("write after end");if(this[N])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;"function"==typeof e&&(i=e,e="utf8"),e||(e="utf8");const s=this[B]?defer:nodefer;if(!this[A]&&!Buffer.isBuffer(t))if(r=t,!Buffer.isBuffer(r)&&ArrayBuffer.isView(r))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if((t=>t instanceof ArrayBuffer||!!t&&"object"==typeof t&&t.constructor&&"ArrayBuffer"===t.constructor.name&&t.byteLength>=0)(t))t=Buffer.from(t);else if("string"!=typeof t)throw new Error("Non-contiguous data written to non-objectMode stream");var r;return this[A]?(this[S]&&0!==this[k]&&this[b](!0),this[S]?this.emit("data",t):this[T](t),0!==this[k]&&this.emit("readable"),i&&s(i),this[S]):t.length?("string"!=typeof t||e===this[w]&&!this[g]?.lastNeed||(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[w]&&(t=this[g].write(t)),this[S]&&0!==this[k]&&this[b](!0),this[S]?this.emit("data",t):this[T](t),0!==this[k]&&this.emit("readable"),i&&s(i),this[S]):(0!==this[k]&&this.emit("readable"),i&&s(i),this[S])}read(t){if(this[N])return null;if(this[U]=!1,0===this[k]||0===t||t&&t>this[k])return this[d](),null;this[A]&&(t=null),this[v].length>1&&!this[A]&&(this[v]=[this[w]?this[v].join(""):Buffer.concat(this[v],this[k])]);const e=this[y](t||null,this[v][0]);return this[d](),e}[y](t,e){if(this[A])this[L]();else{const i=e;t===i.length||null===t?this[L]():"string"==typeof i?(this[v][0]=i.slice(t),e=i.slice(0,t),this[k]-=t):(this[v][0]=i.subarray(t),e=i.subarray(0,t),this[k]-=t)}return this.emit("data",e),this[v].length||this[c]||this.emit("drain"),e}end(t,e,i){return"function"==typeof t&&(i=t,t=void 0),"function"==typeof e&&(i=e,e="utf8"),void 0!==t&&this.write(t,e),i&&this.once("end",i),this[c]=!0,this.writable=!1,!this[S]&&this[R]||this[d](),this}[_](){this[N]||(this[z]||this[O].length||(this[U]=!0),this[R]=!1,this[S]=!0,this.emit("resume"),this[v].length?this[b]():this[c]?this[d]():this.emit("drain"))}resume(){return this[_]()}pause(){this[S]=!1,this[R]=!0,this[U]=!1}get destroyed(){return this[N]}get flowing(){return this[S]}get paused(){return this[R]}[T](t){this[A]?this[k]+=1:this[k]+=t.length,this[v].push(t)}[L](){return this[A]?this[k]-=1:this[k]-=this[v][0].length,this[v].shift()}[b](t=!1){do{}while(this[E](this[L]())&&this[v].length);t||this[v].length||this[c]||this.emit("drain")}[E](t){return this.emit("data",t),this[S]}pipe(t,e){if(this[N])return t;this[U]=!1;const i=this[u];return e=e||{},t===l.stdout||t===l.stderr?e.end=!1:e.end=!1!==e.end,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[O].push(e.proxyErrors?new PipeProxyErrors(this,t,e):new Pipe(this,t,e)),this[B]?defer((()=>this[_]())):this[_]()),t}unpipe(t){const e=this[O].find((e=>e.dest===t));e&&(1===this[O].length?(this[S]&&0===this[z]&&(this[S]=!1),this[O]=[]):this[O].splice(this[O].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){const i=super.on(t,e);if("data"===t)this[U]=!1,this[z]++,this[O].length||this[S]||this[_]();else if("readable"===t&&0!==this[k])super.emit("readable");else if((t=>"end"===t||"finish"===t||"prefinish"===t)(t)&&this[u])super.emit(t),this.removeAllListeners(t);else if("error"===t&&this[p]){const t=e;this[B]?defer((()=>t.call(this,this[p]))):t.call(this,this[p])}return i}removeListener(t,e){return this.off(t,e)}off(t,e){const i=super.off(t,e);return"data"===t&&(this[z]=this.listeners("data").length,0!==this[z]||this[U]||this[O].length||(this[S]=!1)),i}removeAllListeners(t){const e=super.removeAllListeners(t);return"data"!==t&&void 0!==t||(this[z]=0,this[U]||this[O].length||(this[S]=!1)),e}get emittedEnd(){return this[u]}[d](){this[m]||this[u]||this[N]||0!==this[v].length||!this[c]||(this[m]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[f]&&this.emit("close"),this[m]=!1)}emit(t,...e){const i=e[0];if("error"!==t&&"close"!==t&&t!==N&&this[N])return!1;if("data"===t)return!(!this[A]&&!i)&&(this[B]?(defer((()=>this[x](i))),!0):this[x](i));if("end"===t)return this[I]();if("close"===t){if(this[f]=!0,!this[u]&&!this[N])return!1;const t=super.emit("close");return this.removeAllListeners("close"),t}if("error"===t){this[p]=i,super.emit(D,i);const t=!(this[M]&&!this.listeners("error").length)&&super.emit("error",i);return this[d](),t}if("resume"===t){const t=super.emit("resume");return this[d](),t}if("finish"===t||"prefinish"===t){const e=super.emit(t);return this.removeAllListeners(t),e}const s=super.emit(t,...e);return this[d](),s}[x](t){for(const e of this[O])!1===e.dest.write(t)&&this.pause();const e=!this[U]&&super.emit("data",t);return this[d](),e}[I](){return!this[u]&&(this[u]=!0,this.readable=!1,this[B]?(defer((()=>this[P]())),!0):this[P]())}[P](){if(this[g]){const t=this[g].end();if(t){for(const e of this[O])e.dest.write(t);this[U]||super.emit("data",t)}}for(const t of this[O])t.end();const t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){const t=Object.assign([],{dataLength:0});this[A]||(t.dataLength=0);const e=this.promise();return this.on("data",(e=>{t.push(e),this[A]||(t.dataLength+=e.length)})),await e,t}async concat(){if(this[A])throw new Error("cannot concat in objectMode");const t=await this.collect();return this[w]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,e)=>{this.on(N,(()=>e(new Error("stream destroyed")))),this.on("error",(t=>e(t))),this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[U]=!1;let t=!1;const stop=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return stop();const e=this.read();if(null!==e)return Promise.resolve({done:!1,value:e});if(this[c])return stop();let i,s;const onerr=t=>{this.off("data",ondata),this.off("end",onend),this.off(N,ondestroy),stop(),s(t)},ondata=t=>{this.off("error",onerr),this.off("end",onend),this.off(N,ondestroy),this.pause(),i({value:t,done:!!this[c]})},onend=()=>{this.off("error",onerr),this.off("data",ondata),this.off(N,ondestroy),stop(),i({done:!0,value:void 0})},ondestroy=()=>onerr(new Error("stream destroyed"));return new Promise(((t,e)=>{s=e,i=t,this.once(N,ondestroy),this.once("error",onerr),this.once("end",onend),this.once("data",ondata)}))},throw:stop,return:stop,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[U]=!1;let t=!1;const stop=()=>(this.pause(),this.off(D,stop),this.off(N,stop),this.off("end",stop),t=!0,{done:!0,value:void 0});return this.once("end",stop),this.once(D,stop),this.once(N,stop),{next:()=>{if(t)return stop();const e=this.read();return null===e?stop():{done:!1,value:e}},throw:stop,return:stop,[Symbol.iterator](){return this}}}destroy(t){if(this[N])return t?this.emit("error",t):this.emit(N),this;this[N]=!0,this[U]=!0,this[v].length=0,this[k]=0;return"function"!=typeof this.close||this[f]||this.close(),t?this.emit("error",t):this.emit(N),this}static get isStream(){return isStream}}const j=n.writev,W=Symbol("_autoClose"),H=Symbol("_close"),Z=Symbol("_ended"),G=Symbol("_fd"),Y=Symbol("_finished"),V=Symbol("_flags"),$=Symbol("_flush"),K=Symbol("_handleChunk"),q=Symbol("_makeBuf"),X=Symbol("_mode"),J=Symbol("_needDrain"),Q=Symbol("_onerror"),tt=Symbol("_onopen"),et=Symbol("_onread"),it=Symbol("_onwrite"),st=Symbol("_open"),rt=Symbol("_path"),nt=Symbol("_pos"),ht=Symbol("_queue"),ot=Symbol("_read"),at=Symbol("_readSize"),lt=Symbol("_reading"),ct=Symbol("_remain"),dt=Symbol("_size"),ut=Symbol("_write"),mt=Symbol("_writing"),pt=Symbol("_defaultFlag"),ft=Symbol("_errored");class ReadStream extends Minipass{[ft]=!1;[G];[rt];[at];[lt]=!1;[dt];[ct];[W];constructor(t,e){if(super(e=e||{}),this.readable=!0,this.writable=!1,"string"!=typeof t)throw new TypeError("path must be a string");this[ft]=!1,this[G]="number"==typeof e.fd?e.fd:void 0,this[rt]=t,this[at]=e.readSize||16777216,this[lt]=!1,this[dt]="number"==typeof e.size?e.size:1/0,this[ct]=this[dt],this[W]="boolean"!=typeof e.autoClose||e.autoClose,"number"==typeof this[G]?this[ot]():this[st]()}get fd(){return this[G]}get path(){return this[rt]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[st](){n.open(this[rt],"r",((t,e)=>this[tt](t,e)))}[tt](t,e){t?this[Q](t):(this[G]=e,this.emit("open",e),this[ot]())}[q](){return Buffer.allocUnsafe(Math.min(this[at],this[ct]))}[ot](){if(!this[lt]){this[lt]=!0;const t=this[q]();if(0===t.length)return process.nextTick((()=>this[et](null,0,t)));n.read(this[G],t,0,t.length,null,((t,e,i)=>this[et](t,e,i)))}}[et](t,e,i){this[lt]=!1,t?this[Q](t):this[K](e,i)&&this[ot]()}[H](){if(this[W]&&"number"==typeof this[G]){const t=this[G];this[G]=void 0,n.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}[Q](t){this[lt]=!0,this[H](),this.emit("error",t)}[K](t,e){let i=!1;return this[ct]-=t,t>0&&(i=super.write(t<e.length?e.subarray(0,t):e)),(0===t||this[ct]<=0)&&(i=!1,this[H](),super.end()),i}emit(t,...e){switch(t){case"prefinish":case"finish":return!1;case"drain":return"number"==typeof this[G]&&this[ot](),!1;case"error":return!this[ft]&&(this[ft]=!0,super.emit(t,...e));default:return super.emit(t,...e)}}}class ReadStreamSync extends ReadStream{[st](){let t=!0;try{this[tt](null,n.openSync(this[rt],"r")),t=!1}finally{t&&this[H]()}}[ot](){let t=!0;try{if(!this[lt]){for(this[lt]=!0;;){const t=this[q](),e=0===t.length?0:n.readSync(this[G],t,0,t.length,null);if(!this[K](e,t))break}this[lt]=!1}t=!1}finally{t&&this[H]()}}[H](){if(this[W]&&"number"==typeof this[G]){const t=this[G];this[G]=void 0,n.closeSync(t),this.emit("close")}}}class WriteStream extends r{readable=!1;writable=!0;[ft]=!1;[mt]=!1;[Z]=!1;[ht]=[];[J]=!1;[rt];[X];[W];[G];[pt];[V];[Y]=!1;[nt];constructor(t,e){super(e=e||{}),this[rt]=t,this[G]="number"==typeof e.fd?e.fd:void 0,this[X]=void 0===e.mode?438:e.mode,this[nt]="number"==typeof e.start?e.start:void 0,this[W]="boolean"!=typeof e.autoClose||e.autoClose;const i=void 0!==this[nt]?"r+":"w";this[pt]=void 0===e.flags,this[V]=void 0===e.flags?i:e.flags,void 0===this[G]&&this[st]()}emit(t,...e){if("error"===t){if(this[ft])return!1;this[ft]=!0}return super.emit(t,...e)}get fd(){return this[G]}get path(){return this[rt]}[Q](t){this[H](),this[mt]=!0,this.emit("error",t)}[st](){n.open(this[rt],this[V],this[X],((t,e)=>this[tt](t,e)))}[tt](t,e){this[pt]&&"r+"===this[V]&&t&&"ENOENT"===t.code?(this[V]="w",this[st]()):t?this[Q](t):(this[G]=e,this.emit("open",e),this[mt]||this[$]())}end(t,e){return t&&this.write(t,e),this[Z]=!0,this[mt]||this[ht].length||"number"!=typeof this[G]||this[it](null,0),this}write(t,e){return"string"==typeof t&&(t=Buffer.from(t,e)),this[Z]?(this.emit("error",new Error("write() after end()")),!1):void 0===this[G]||this[mt]||this[ht].length?(this[ht].push(t),this[J]=!0,!1):(this[mt]=!0,this[ut](t),!0)}[ut](t){n.write(this[G],t,0,t.length,this[nt],((t,e)=>this[it](t,e)))}[it](t,e){t?this[Q](t):(void 0!==this[nt]&&"number"==typeof e&&(this[nt]+=e),this[ht].length?this[$]():(this[mt]=!1,this[Z]&&!this[Y]?(this[Y]=!0,this[H](),this.emit("finish")):this[J]&&(this[J]=!1,this.emit("drain"))))}[$](){if(0===this[ht].length)this[Z]&&this[it](null,0);else if(1===this[ht].length)this[ut](this[ht].pop());else{const t=this[ht];this[ht]=[],j(this[G],t,this[nt],((t,e)=>this[it](t,e)))}}[H](){if(this[W]&&"number"==typeof this[G]){const t=this[G];this[G]=void 0,n.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}}class WriteStreamSync extends WriteStream{[st](){let t;if(this[pt]&&"r+"===this[V])try{t=n.openSync(this[rt],this[V],this[X])}catch(t){if("ENOENT"===t?.code)return this[V]="w",this[st]();throw t}else t=n.openSync(this[rt],this[V],this[X]);this[tt](null,t)}[H](){if(this[W]&&"number"==typeof this[G]){const t=this[G];this[G]=void 0,n.closeSync(t),this.emit("close")}}[ut](t){let e=!0;try{this[it](null,n.writeSync(this[G],t,0,t.length,this[nt])),e=!1}finally{if(e)try{this[H]()}catch{}}}}var yt=i(76760),bt=i(73024),Et=i(16928);const wt=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),dealiasKey=t=>{const e=wt.get(t);return e||t},dealias=(t={})=>{if(!t)return{};const e={};for(const[i,s]of Object.entries(t)){e[dealiasKey(i)]=s}return void 0===e.chmod&&!1===e.noChmod&&(e.chmod=!0),delete e.noChmod,e},makeCommand=(t,e,i,s,r)=>Object.assign(((n=[],h,o)=>{Array.isArray(n)&&(h=n,n={}),"function"==typeof h&&(o=h,h=void 0),h=h?Array.from(h):[];const a=dealias(n);if(r?.(a,h),(l=a).sync&&l.file){if("function"==typeof o)throw new TypeError("callback not supported for sync tar functions");return t(a,h)}if((t=>!t.sync&&!!t.file)(a)){const t=e(a,h),i=o||void 0;return i?t.then((()=>i()),i):t}if((t=>!!t.sync&&!t.file)(a)){if("function"==typeof o)throw new TypeError("callback not supported for sync tar functions");return i(a,h)}if((t=>!t.sync&&!t.file)(a)){if("function"==typeof o)throw new TypeError("callback only supported with file option");return s(a,h)}throw new Error("impossible options??");var l}),{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:s,validate:r});var gt=i(42613),St=i(20181),Rt=i(28293),_t=i(43106),vt=i.t(_t,2);const Ot=_t.constants||{ZLIB_VERNUM:4736},kt=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Ot)),Tt=St.Buffer.concat,Lt=Object.getOwnPropertyDescriptor(St.Buffer,"concat"),noop=t=>t,At=!0===Lt?.writable||void 0!==Lt?.set?t=>{St.Buffer.concat=t?noop:Tt}:t=>{},Nt=Symbol("_superWrite");class ZlibError extends Error{code;errno;constructor(t){super("zlib: "+t.message),this.code=t.code,this.errno=t.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+t.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}const Dt=Symbol("flushFlag");class ZlibBase extends Rt.n_{#t=!1;#e=!1;#i;#s;#r;#n;#h;get sawError(){return this.#t}get handle(){return this.#n}get flushFlag(){return this.#i}constructor(t,e){if(!t||"object"!=typeof t)throw new TypeError("invalid options for ZlibBase constructor");super(t),this.#i=t.flush??0,this.#s=t.finishFlush??0,this.#r=t.fullFlushFlag??0;try{this.#n=new vt[e](t)}catch(t){throw new ZlibError(t)}this.#h=t=>{this.#t||(this.#t=!0,this.close(),this.emit("error",t))},this.#n?.on("error",(t=>this.#h(new ZlibError(t)))),this.once("end",(()=>this.close))}close(){this.#n&&(this.#n.close(),this.#n=void 0,this.emit("close"))}reset(){if(!this.#t)return gt(this.#n,"zlib binding closed"),this.#n.reset?.()}flush(t){this.ended||("number"!=typeof t&&(t=this.#r),this.write(Object.assign(St.Buffer.alloc(0),{[Dt]:t})))}end(t,e,i){return"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),t&&(e?this.write(t,e):this.write(t)),this.flush(this.#s),this.#e=!0,super.end(i)}get ended(){return this.#e}[Nt](t){return super.write(t)}write(t,e,i){if("function"==typeof e&&(i=e,e="utf8"),"string"==typeof t&&(t=St.Buffer.from(t,e)),this.#t)return;gt(this.#n,"zlib binding closed");const s=this.#n._handle,r=s.close;s.close=()=>{};const n=this.#n.close;let h,o;this.#n.close=()=>{},At(!0);try{const e="number"==typeof t[Dt]?t[Dt]:this.#i;h=this.#n._processChunk(t,e),At(!1)}catch(t){At(!1),this.#h(new ZlibError(t))}finally{this.#n&&(this.#n._handle=s,s.close=r,this.#n.close=n,this.#n.removeAllListeners("error"))}if(this.#n&&this.#n.on("error",(t=>this.#h(new ZlibError(t)))),h)if(Array.isArray(h)&&h.length>0){const t=h[0];o=this[Nt](St.Buffer.from(t));for(let t=1;t<h.length;t++)o=this[Nt](h[t])}else o=this[Nt](St.Buffer.from(h));return i&&i(),o}}class Zlib extends ZlibBase{#o;#a;constructor(t,e){(t=t||{}).flush=t.flush||kt.Z_NO_FLUSH,t.finishFlush=t.finishFlush||kt.Z_FINISH,t.fullFlushFlag=kt.Z_FULL_FLUSH,super(t,e),this.#o=t.level,this.#a=t.strategy}params(t,e){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#o!==t||this.#a!==e){this.flush(kt.Z_SYNC_FLUSH),gt(this.handle,"zlib binding closed");const i=this.handle.flush;this.handle.flush=(t,e)=>{"function"==typeof t&&(e=t,t=this.flushFlag),this.flush(t),e?.()};try{this.handle.params(t,e)}finally{this.handle.flush=i}this.handle&&(this.#o=t,this.#a=e)}}}}class Gzip extends Zlib{#l;constructor(t){super(t,"Gzip"),this.#l=t&&!!t.portable}[Nt](t){return this.#l?(this.#l=!1,t[9]=255,super[Nt](t)):super[Nt](t)}}class Unzip extends Zlib{constructor(t){super(t,"Unzip")}}class Brotli extends ZlibBase{constructor(t,e){(t=t||{}).flush=t.flush||kt.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||kt.BROTLI_OPERATION_FINISH,t.fullFlushFlag=kt.BROTLI_OPERATION_FLUSH,super(t,e)}}class BrotliCompress extends Brotli{constructor(t){super(t,"BrotliCompress")}}class BrotliDecompress extends Brotli{constructor(t){super(t,"BrotliDecompress")}}class Yallist{tail;head;length=0;static create(t=[]){return new Yallist(t)}constructor(t=[]){for(const e of t)this.push(e)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");const e=t.next,i=t.prev;return e&&(e.prev=i),i&&(i.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=i),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,e}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);const e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);const e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let e=0,i=t.length;e<i;e++)push(this,t[e]);return this.length}unshift(...t){for(var e=0,i=t.length;e<i;e++)unshift(this,t[e]);return this.length}pop(){if(!this.tail)return;const t=this.tail.value,e=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,e.list=void 0,this.length--,t}shift(){if(!this.head)return;const t=this.head.value,e=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,e.list=void 0,this.length--,t}forEach(t,e){e=e||this;for(let i=this.head,s=0;i;s++)t.call(e,i.value,s,this),i=i.next}forEachReverse(t,e){e=e||this;for(let i=this.tail,s=this.length-1;i;s--)t.call(e,i.value,s,this),i=i.prev}get(t){let e=0,i=this.head;for(;i&&e<t;e++)i=i.next;if(e===t&&i)return i.value}getReverse(t){let e=0,i=this.tail;for(;i&&e<t;e++)i=i.prev;if(e===t&&i)return i.value}map(t,e){e=e||this;const i=new Yallist;for(let s=this.head;s;)i.push(t.call(e,s.value,this)),s=s.next;return i}mapReverse(t,e){e=e||this;var i=new Yallist;for(let s=this.tail;s;)i.push(t.call(e,s.value,this)),s=s.prev;return i}reduce(t,e){let i,s=this.head;if(arguments.length>1)i=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");s=this.head.next,i=this.head.value}for(var r=0;s;r++)i=t(i,s.value,r),s=s.next;return i}reduceReverse(t,e){let i,s=this.tail;if(arguments.length>1)i=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");s=this.tail.prev,i=this.tail.value}for(let e=this.length-1;s;e--)i=t(i,s.value,e),s=s.prev;return i}toArray(){const t=new Array(this.length);for(let e=0,i=this.head;i;e++)t[e]=i.value,i=i.next;return t}toArrayReverse(){const t=new Array(this.length);for(let e=0,i=this.tail;i;e++)t[e]=i.value,i=i.prev;return t}slice(t=0,e=this.length){e<0&&(e+=this.length),t<0&&(t+=this.length);const i=new Yallist;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);let s=this.head,r=0;for(r=0;s&&r<t;r++)s=s.next;for(;s&&r<e;r++,s=s.next)i.push(s.value);return i}sliceReverse(t=0,e=this.length){e<0&&(e+=this.length),t<0&&(t+=this.length);const i=new Yallist;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);let s=this.length,r=this.tail;for(;r&&s>e;s--)r=r.prev;for(;r&&s>t;s--,r=r.prev)i.push(r.value);return i}splice(t,e=0,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let s=this.head;for(let e=0;s&&e<t;e++)s=s.next;const r=[];for(let t=0;s&&t<e;t++)r.push(s.value),s=this.removeNode(s);s?s!==this.tail&&(s=s.prev):s=this.tail;for(const t of i)s=insertAfter(this,s,t);return r}reverse(){const t=this.head,e=this.tail;for(let e=t;e;e=e.prev){const t=e.prev;e.prev=e.next,e.next=t}return this.head=e,this.tail=t,this}}function insertAfter(t,e,i){const s=e,r=e?e.next:t.head,n=new Node(i,s,r,t);return void 0===n.next&&(t.tail=n),void 0===n.prev&&(t.head=n),t.length++,n}function push(t,e){t.tail=new Node(e,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function unshift(t,e){t.head=new Node(e,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}class Node{list;next;prev;value;constructor(t,e,i,s){this.list=s,this.value=t,e?(e.next=this,this.prev=e):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}}const encodePositive=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=255&t,t=Math.floor(t/256)},encodeNegative=(t,e)=>{e[0]=255;var i=!1;t*=-1;for(var s=e.length;s>1;s--){var r=255&t;t=Math.floor(t/256),i?e[s-1]=onesComp(r):0===r?e[s-1]=0:(i=!0,e[s-1]=twosComp(r))}},twos=t=>{for(var e=t.length,i=0,s=!1,r=e-1;r>-1;r--){var n,h=Number(t[r]);s?n=onesComp(h):0===h?n=h:(s=!0,n=twosComp(h)),0!==n&&(i-=n*Math.pow(256,e-r-1))}return i},pos=t=>{for(var e=t.length,i=0,s=e-1;s>-1;s--){var r=Number(t[s]);0!==r&&(i+=r*Math.pow(256,e-s-1))}return i},onesComp=t=>255&(255^t),twosComp=t=>1+(255^t)&255,isCode=t=>xt.has(t),isName=t=>It.has(t),xt=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),It=new Map(Array.from(xt).map((t=>[t[1],t[0]])));class Header{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#c="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,e=0,i,s){Buffer.isBuffer(t)?this.decode(t,e||0,i,s):t&&this.#d(t)}decode(t,e,i,s){if(e||(e=0),!(t&&t.length>=e+512))throw new Error("need 512 bytes for header");this.path=decString(t,e,100),this.mode=decNumber(t,e+100,8),this.uid=decNumber(t,e+108,8),this.gid=decNumber(t,e+116,8),this.size=decNumber(t,e+124,12),this.mtime=decDate(t,e+136,12),this.cksum=decNumber(t,e+148,12),s&&this.#d(s,!0),i&&this.#d(i);const r=decString(t,e+156,1);if(isCode(r)&&(this.#c=r||"0"),"0"===this.#c&&"/"===this.path.slice(-1)&&(this.#c="5"),"5"===this.#c&&(this.size=0),this.linkpath=decString(t,e+157,100),"ustar\x0000"===t.subarray(e+257,e+265).toString())if(this.uname=decString(t,e+265,32),this.gname=decString(t,e+297,32),this.devmaj=decNumber(t,e+329,8)??0,this.devmin=decNumber(t,e+337,8)??0,0!==t[e+475]){const i=decString(t,e+345,155);this.path=i+"/"+this.path}else{const i=decString(t,e+345,130);i&&(this.path=i+"/"+this.path),this.atime=decDate(t,e+476,12),this.ctime=decDate(t,e+488,12)}let n=256;for(let i=e;i<e+148;i++)n+=t[i];for(let i=e+156;i<e+512;i++)n+=t[i];this.cksumValid=n===this.cksum,void 0===this.cksum&&256===n&&(this.nullBlock=!0)}#d(t,e=!1){Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(null==i||"path"===t&&e||"linkpath"===t&&e||"global"===t)))))}encode(t,e=0){if(t||(t=this.block=Buffer.alloc(512)),"Unsupported"===this.#c&&(this.#c="0"),!(t.length>=e+512))throw new Error("need 512 bytes for header");const i=this.ctime||this.atime?130:155,s=splitPrefix(this.path||"",i),r=s[0],n=s[1];this.needPax=!!s[2],this.needPax=encString(t,e,100,r)||this.needPax,this.needPax=encNumber(t,e+100,8,this.mode)||this.needPax,this.needPax=encNumber(t,e+108,8,this.uid)||this.needPax,this.needPax=encNumber(t,e+116,8,this.gid)||this.needPax,this.needPax=encNumber(t,e+124,12,this.size)||this.needPax,this.needPax=encDate(t,e+136,12,this.mtime)||this.needPax,t[e+156]=this.#c.charCodeAt(0),this.needPax=encString(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=encString(t,e+265,32,this.uname)||this.needPax,this.needPax=encString(t,e+297,32,this.gname)||this.needPax,this.needPax=encNumber(t,e+329,8,this.devmaj)||this.needPax,this.needPax=encNumber(t,e+337,8,this.devmin)||this.needPax,this.needPax=encString(t,e+345,i,n)||this.needPax,0!==t[e+475]?this.needPax=encString(t,e+345,155,n)||this.needPax:(this.needPax=encString(t,e+345,130,n)||this.needPax,this.needPax=encDate(t,e+476,12,this.atime)||this.needPax,this.needPax=encDate(t,e+488,12,this.ctime)||this.needPax);let h=256;for(let i=e;i<e+148;i++)h+=t[i];for(let i=e+156;i<e+512;i++)h+=t[i];return this.cksum=h,encNumber(t,e+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return"Unsupported"===this.#c?this.#c:xt.get(this.#c)}get typeKey(){return this.#c}set type(t){const e=String(It.get(t));if(isCode(e)||"Unsupported"===e)this.#c=e;else{if(!isCode(t))throw new TypeError("invalid entry type: "+t);this.#c=t}}}const splitPrefix=(t,e)=>{const i=100;let s,r=t,n="";const h=yt.posix.parse(t).root||".";if(Buffer.byteLength(r)<i)s=[r,n,!1];else{n=yt.posix.dirname(r),r=yt.posix.basename(r);do{Buffer.byteLength(r)<=i&&Buffer.byteLength(n)<=e?s=[r,n,!1]:Buffer.byteLength(r)>i&&Buffer.byteLength(n)<=e?s=[r.slice(0,99),n,!0]:(r=yt.posix.join(yt.posix.basename(n),r),n=yt.posix.dirname(n))}while(n!==h&&void 0===s);s||(s=[t.slice(0,99),"",!0])}return s},decString=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),decDate=(t,e,i)=>numToDate(decNumber(t,e,i)),numToDate=t=>void 0===t?void 0:new Date(1e3*t),decNumber=(t,e,i)=>128&Number(t[e])?(t=>{const e=t[0],i=128===e?pos(t.subarray(1,t.length)):255===e?twos(t):null;if(null===i)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i})(t.subarray(e,e+i)):decSmallNumber(t,e,i),decSmallNumber=(t,e,i)=>{return s=parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8),isNaN(s)?void 0:s;var s},Pt={12:8589934591,8:2097151},encNumber=(t,e,i,s)=>void 0!==s&&(s>Pt[i]||s<0?(((t,e)=>{if(!Number.isSafeInteger(t))throw Error("cannot encode number outside of javascript safe integer range");t<0?encodeNegative(t,e):encodePositive(t,e)})(s,t.subarray(e,e+i)),!0):(encSmallNumber(t,e,i,s),!1)),encSmallNumber=(t,e,i,s)=>t.write(octalString(s,i),e,i,"ascii"),octalString=(t,e)=>padOctal(Math.floor(t).toString(8),e),padOctal=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",encDate=(t,e,i,s)=>void 0!==s&&encNumber(t,e,i,s.getTime()/1e3),Bt=new Array(156).join("\0"),encString=(t,e,i,s)=>void 0!==s&&(t.write(s+Bt,e,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i);class Pax{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,e=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=e,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){const t=this.encodeBody();if(""===t)return Buffer.allocUnsafe(0);const e=Buffer.byteLength(t),i=512*Math.ceil(1+e/512),s=Buffer.allocUnsafe(i);for(let t=0;t<512;t++)s[t]=0;new Header({path:("PaxHeader/"+(0,yt.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:e,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(s),s.write(t,512,e,"utf8");for(let t=e+512;t<s.length;t++)s[t]=0;return s}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(void 0===this[t])return"";const e=this[t],i=" "+("dev"===t||"ino"===t||"nlink"===t?"SCHILY.":"")+t+"="+(e instanceof Date?e.getTime()/1e3:e)+"\n",s=Buffer.byteLength(i);let r=Math.floor(Math.log(s)/Math.log(10))+1;s+r>=Math.pow(10,r)&&(r+=1);return r+s+i}static parse(t,e,i=!1){return new Pax(merge(parseKV(t),e),i)}}const merge=(t,e)=>e?Object.assign({},e,t):t,parseKV=t=>t.replace(/\n$/,"").split("\n").reduce(parseKVLine,Object.create(null)),parseKVLine=(t,e)=>{const i=parseInt(e,10);if(i!==Buffer.byteLength(e)+1)return t;const s=(e=e.slice((i+" ").length)).split("="),r=s.shift();if(!r)return t;const n=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),h=s.join("=");return t[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(1e3*Number(h)):/^[0-9]+$/.test(h)?+h:h,t},Ft="win32"!==(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)?t=>t:t=>t&&t.replace(/\\/g,"/");class ReadEntry extends Rt.n_{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(t,e,i){switch(super({}),this.pause(),this.extended=e,this.globalExtended=i,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!t.path)throw new Error("no path provided for tar.ReadEntry");this.path=Ft(t.path),this.mode=t.mode,this.mode&&(this.mode=4095&this.mode),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?Ft(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,e&&this.#d(e),i&&this.#d(i,!0)}write(t){const e=t.length;if(e>this.blockRemain)throw new Error("writing more to entry than is appropriate");const i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-e),this.blockRemain=Math.max(0,s-e),!!this.ignore||(i>=e?super.write(t):super.write(t.subarray(0,i)))}#d(t,e=!1){t.path&&(t.path=Ft(t.path)),t.linkpath&&(t.linkpath=Ft(t.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(null==i||"path"===t&&e)))))}}const warnMethod=(t,e,i,s={})=>{t.file&&(s.file=t.file),t.cwd&&(s.cwd=t.cwd),s.code=i instanceof Error&&i.code||e,s.tarCode=e,t.strict||!1===s.recoverable?i instanceof Error?t.emit("error",Object.assign(i,s)):t.emit("error",Object.assign(new Error(`${e}: ${i}`),s)):(i instanceof Error&&(s=Object.assign(i,s),i=i.message),t.emit("warn",e,i,s))},Ct=Buffer.from([31,139]),Mt=Symbol("state"),zt=Symbol("writeEntry"),Ut=Symbol("readEntry"),jt=Symbol("nextEntry"),Wt=Symbol("processEntry"),Ht=Symbol("extendedHeader"),Zt=Symbol("globalExtendedHeader"),Gt=Symbol("meta"),Yt=Symbol("emitMeta"),Vt=Symbol("buffer"),$t=Symbol("queue"),Kt=Symbol("ended"),qt=Symbol("emittedEnd"),Xt=Symbol("emit"),Jt=Symbol("unzip"),Qt=Symbol("consumeChunk"),te=Symbol("consumeChunkSub"),ee=Symbol("consumeBody"),ie=Symbol("consumeMeta"),se=Symbol("consumeHeader"),re=Symbol("consuming"),ne=Symbol("bufferConcat"),he=Symbol("maybeEnd"),oe=Symbol("writing"),ae=Symbol("aborted"),le=Symbol("onDone"),ce=Symbol("sawValidEntry"),de=Symbol("sawNullBlock"),ue=Symbol("sawEOF"),me=Symbol("closeStream"),parse_noop=()=>!0;class Parser extends r.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[$t]=new Yallist;[Vt];[Ut];[zt];[Mt]="begin";[Gt]="";[Ht];[Zt];[Kt]=!1;[Jt];[ae]=!1;[ce];[de]=!1;[ue]=!1;[oe]=!1;[re]=!1;[qt]=!1;constructor(t={}){super(),this.file=t.file||"",this.on(le,(()=>{"begin"!==this[Mt]&&!1!==this[ce]||this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")})),t.ondone?this.on(le,t.ondone):this.on(le,(()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")})),this.strict=!!t.strict,this.maxMetaEntrySize=t.maxMetaEntrySize||1048576,this.filter="function"==typeof t.filter?t.filter:parse_noop;const e=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=t.gzip||void 0===t.brotli?!!e&&void 0:t.brotli,this.on("end",(()=>this[me]())),"function"==typeof t.onwarn&&this.on("warn",t.onwarn),"function"==typeof t.onReadEntry&&this.on("entry",t.onReadEntry)}warn(t,e,i={}){warnMethod(this,t,e,i)}[se](t,e){let i;void 0===this[ce]&&(this[ce]=!1);try{i=new Header(t,e,this[Ht],this[Zt])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(i.nullBlock)this[de]?(this[ue]=!0,"begin"===this[Mt]&&(this[Mt]="header"),this[Xt]("eof")):(this[de]=!0,this[Xt]("nullBlock"));else if(this[de]=!1,i.cksumValid)if(i.path){const t=i.type;if(/^(Symbolic)?Link$/.test(t)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(/^(Symbolic)?Link$/.test(t)||/^(Global)?ExtendedHeader$/.test(t)||!i.linkpath){const t=this[zt]=new ReadEntry(i,this[Ht],this[Zt]);if(!this[ce])if(t.remain){const onend=()=>{t.invalid||(this[ce]=!0)};t.on("end",onend)}else this[ce]=!0;t.meta?t.size>this.maxMetaEntrySize?(t.ignore=!0,this[Xt]("ignoredEntry",t),this[Mt]="ignore",t.resume()):t.size>0&&(this[Gt]="",t.on("data",(t=>this[Gt]+=t)),this[Mt]="meta"):(this[Ht]=void 0,t.ignore=t.ignore||!this.filter(t.path,t),t.ignore?(this[Xt]("ignoredEntry",t),this[Mt]=t.remain?"ignore":"header",t.resume()):(t.remain?this[Mt]="body":(this[Mt]="header",t.end()),this[Ut]?this[$t].push(t):(this[$t].push(t),this[jt]())))}else this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i})}else this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i})}[me](){queueMicrotask((()=>this.emit("close")))}[Wt](t){let e=!0;if(t)if(Array.isArray(t)){const[e,...i]=t;this.emit(e,...i)}else this[Ut]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",(()=>this[jt]())),e=!1);else this[Ut]=void 0,e=!1;return e}[jt](){do{}while(this[Wt](this[$t].shift()));if(!this[$t].length){const t=this[Ut];!t||t.flowing||t.size===t.remain?this[oe]||this.emit("drain"):t.once("drain",(()=>this.emit("drain")))}}[ee](t,e){const i=this[zt];if(!i)throw new Error("attempt to consume body without entry??");const s=i.blockRemain??0,r=s>=t.length&&0===e?t:t.subarray(e,e+s);return i.write(r),i.blockRemain||(this[Mt]="header",this[zt]=void 0,i.end()),r.length}[ie](t,e){const i=this[zt],s=this[ee](t,e);return!this[zt]&&i&&this[Yt](i),s}[Xt](t,e,i){this[$t].length||this[Ut]?this[$t].push([t,e,i]):this.emit(t,e,i)}[Yt](t){switch(this[Xt]("meta",this[Gt]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[Ht]=Pax.parse(this[Gt],this[Ht],!1);break;case"GlobalExtendedHeader":this[Zt]=Pax.parse(this[Gt],this[Zt],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const t=this[Ht]??Object.create(null);this[Ht]=t,t.path=this[Gt].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const t=this[Ht]||Object.create(null);this[Ht]=t,t.linkpath=this[Gt].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){this[ae]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}write(t,e,i){if("function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8")),this[ae])return i?.(),!1;if((void 0===this[Jt]||void 0===this.brotli&&!1===this[Jt])&&t){if(this[Vt]&&(t=Buffer.concat([this[Vt],t]),this[Vt]=void 0),t.length<Ct.length)return this[Vt]=t,i?.(),!0;for(let e=0;void 0===this[Jt]&&e<Ct.length;e++)t[e]!==Ct[e]&&(this[Jt]=!1);const e=void 0===this.brotli;if(!1===this[Jt]&&e)if(t.length<512){if(!this[Kt])return this[Vt]=t,i?.(),!0;this.brotli=!0}else try{new Header(t.subarray(0,512)),this.brotli=!1}catch(t){this.brotli=!0}if(void 0===this[Jt]||!1===this[Jt]&&this.brotli){const e=this[Kt];this[Kt]=!1,this[Jt]=void 0===this[Jt]?new Unzip({}):new BrotliDecompress({}),this[Jt].on("data",(t=>this[Qt](t))),this[Jt].on("error",(t=>this.abort(t))),this[Jt].on("end",(()=>{this[Kt]=!0,this[Qt]()})),this[oe]=!0;const s=!!this[Jt][e?"end":"write"](t);return this[oe]=!1,i?.(),s}}this[oe]=!0,this[Jt]?this[Jt].write(t):this[Qt](t),this[oe]=!1;const s=!this[$t].length&&(!this[Ut]||this[Ut].flowing);return s||this[$t].length||this[Ut]?.once("drain",(()=>this.emit("drain"))),i?.(),s}[ne](t){t&&!this[ae]&&(this[Vt]=this[Vt]?Buffer.concat([this[Vt],t]):t)}[he](){if(this[Kt]&&!this[qt]&&!this[ae]&&!this[re]){this[qt]=!0;const t=this[zt];if(t&&t.blockRemain){const e=this[Vt]?this[Vt].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`,{entry:t}),this[Vt]&&t.write(this[Vt]),t.end()}this[Xt](le)}}[Qt](t){if(this[re]&&t)this[ne](t);else if(t||this[Vt]){if(t){if(this[re]=!0,this[Vt]){this[ne](t);const e=this[Vt];this[Vt]=void 0,this[te](e)}else this[te](t);for(;this[Vt]&&this[Vt]?.length>=512&&!this[ae]&&!this[ue];){const t=this[Vt];this[Vt]=void 0,this[te](t)}this[re]=!1}}else this[he]();this[Vt]&&!this[Kt]||this[he]()}[te](t){let e=0;const i=t.length;for(;e+512<=i&&!this[ae]&&!this[ue];)switch(this[Mt]){case"begin":case"header":this[se](t,e),e+=512;break;case"ignore":case"body":e+=this[ee](t,e);break;case"meta":e+=this[ie](t,e);break;default:throw new Error("invalid state: "+this[Mt])}e<i&&(this[Vt]?this[Vt]=Buffer.concat([t.subarray(e),this[Vt]]):this[Vt]=t.subarray(e))}end(t,e,i){return"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,e)),i&&this.once("finish",i),this[ae]||(this[Jt]?(t&&this[Jt].write(t),this[Jt].end()):(this[Kt]=!0,void 0===this.brotli&&(t=t||Buffer.alloc(0)),t&&this.write(t),this[he]())),this}}const stripTrailingSlashes=t=>{let e=t.length-1,i=-1;for(;e>-1&&"/"===t.charAt(e);)i=e,e--;return-1===i?t:t.slice(0,i)},filesFilter=(t,e)=>{const i=new Map(e.map((t=>[stripTrailingSlashes(t),!0]))),s=t.filter,mapHas=(t,e="")=>{const s=e||(0,Et.parse)(t).root||".";let r;if(t===s)r=!1;else{const e=i.get(t);r=void 0!==e?e:mapHas((0,Et.dirname)(t),s)}return i.set(t,r),r};t.filter=s?(t,e)=>s(t,e)&&mapHas(stripTrailingSlashes(t)):t=>mapHas(stripTrailingSlashes(t))},pe=makeCommand((t=>{const e=new Parser(t),i=t.file;let s;try{const r=bt.statSync(i),n=t.maxReadSize||16777216;if(r.size<n)e.end(bt.readFileSync(i));else{let t=0;const h=Buffer.allocUnsafe(n);for(s=bt.openSync(i,"r");t<r.size;){const i=bt.readSync(s,h,0,n,t);t+=i,e.write(h.subarray(0,i))}e.end()}}finally{if("number"==typeof s)try{bt.closeSync(s)}catch(t){}}}),((t,e)=>{const i=new Parser(t),s=t.maxReadSize||16777216,r=t.file;return new Promise(((t,e)=>{i.on("error",e),i.on("end",t),bt.stat(r,((t,n)=>{if(t)e(t);else{const t=new ReadStream(r,{readSize:s,size:n.size});t.on("error",e),t.pipe(i)}}))}))}),(t=>new Parser(t)),(t=>new Parser(t)),((t,e)=>{e?.length&&filesFilter(t,e),t.noResume||(t=>{const e=t.onReadEntry;t.onReadEntry=e?t=>{e(t),t.resume()}:t=>t.resume()})(t)})),modeFix=(t,e,i)=>(t&=4095,i&&(t=-19&t|384),e&&(256&t&&(t|=64),32&t&&(t|=8),4&t&&(t|=1)),t),{isAbsolute:fe,parse:ye}=yt.win32,stripAbsolutePath=t=>{let e="",i=ye(t);for(;fe(t)||i.root;){const s="/"===t.charAt(0)&&"//?/"!==t.slice(0,4)?"/":i.root;t=t.slice(s.length),e+=s,i=ye(t)}return[e,t]},be=["|","<",">","?",":"],Ee=be.map((t=>String.fromCharCode(61440+t.charCodeAt(0)))),we=new Map(be.map(((t,e)=>[t,Ee[e]]))),ge=new Map(Ee.map(((t,e)=>[t,be[e]]))),winchars_encode=t=>be.reduce(((t,e)=>t.split(e).join(we.get(e))),t),prefixPath=(t,e)=>e?(t=Ft(t).replace(/^\.(\/|$)/,""),stripTrailingSlashes(e)+"/"+t):Ft(t),Se=Symbol("process"),Re=Symbol("file"),_e=Symbol("directory"),ve=Symbol("symlink"),Oe=Symbol("hardlink"),ke=Symbol("header"),Te=Symbol("read"),Le=Symbol("lstat"),Ae=Symbol("onlstat"),Ne=Symbol("onread"),De=Symbol("onreadlink"),xe=Symbol("openfile"),Ie=Symbol("onopenfile"),Pe=Symbol("close"),Be=Symbol("mode"),Fe=Symbol("awaitDrain"),Ce=Symbol("ondrain"),Me=Symbol("prefix");class WriteEntry extends Rt.n_{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#u=!1;constructor(t,e={}){const i=dealias(e);super(),this.path=Ft(t),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||16777216,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=Ft(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?Ft(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,"function"==typeof i.onwarn&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){const[t,e]=stripAbsolutePath(this.path);t&&"string"==typeof e&&(this.path=e,s=t)}var r;this.win32=!!i.win32||"win32"===process.platform,this.win32&&(this.path=(r=this.path.replace(/\\/g,"/"),Ee.reduce(((t,e)=>t.split(e).join(ge.get(e))),r)),t=t.replace(/\\/g,"/")),this.absolute=Ft(i.absolute||Et.resolve(this.cwd,t)),""===this.path&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});const n=this.statCache.get(this.absolute);n?this[Ae](n):this[Le]()}warn(t,e,i={}){return warnMethod(this,t,e,i)}emit(t,...e){return"error"===t&&(this.#u=!0),super.emit(t,...e)}[Le](){n.lstat(this.absolute,((t,e)=>{if(t)return this.emit("error",t);this[Ae](e)}))}[Ae](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=getType(t),this.emit("stat",t),this[Se]()}[Se](){switch(this.type){case"File":return this[Re]();case"Directory":return this[_e]();case"SymbolicLink":return this[ve]();default:return this.end()}}[Be](t){return modeFix(t,"Directory"===this.type,this.portable)}[Me](t){return prefixPath(t,this.prefix)}[ke](){if(!this.stat)throw new Error("cannot write header before stat");"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new Header({path:this[Me](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[Me](this.linkpath):this.linkpath,mode:this[Be](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:"Unsupported"===this.type?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Pax({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[Me](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[Me](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());const t=this.header?.block;if(!t)throw new Error("failed to encode header");super.write(t)}[_e](){if(!this.stat)throw new Error("cannot create directory entry without stat");"/"!==this.path.slice(-1)&&(this.path+="/"),this.stat.size=0,this[ke](),this.end()}[ve](){n.readlink(this.absolute,((t,e)=>{if(t)return this.emit("error",t);this[De](e)}))}[De](t){this.linkpath=Ft(t),this[ke](),this.end()}[Oe](t){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=Ft(Et.relative(this.cwd,t)),this.stat.size=0,this[ke](),this.end()}[Re](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){const t=`${this.stat.dev}:${this.stat.ino}`,e=this.linkCache.get(t);if(0===e?.indexOf(this.cwd))return this[Oe](e);this.linkCache.set(t,this.absolute)}if(this[ke](),0===this.stat.size)return this.end();this[xe]()}[xe](){n.open(this.absolute,"r",((t,e)=>{if(t)return this.emit("error",t);this[Ie](e)}))}[Ie](t){if(this.fd=t,this.#u)return this[Pe]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;const e=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(e),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Te]()}[Te](){const{fd:t,buf:e,offset:i,length:s,pos:r}=this;if(void 0===t||void 0===e)throw new Error("cannot read file without first opening");n.read(t,e,i,s,r,((t,e)=>{if(t)return this[Pe]((()=>this.emit("error",t)));this[Ne](e)}))}[Pe](t=()=>{}){void 0!==this.fd&&n.close(this.fd,t)}[Ne](t){if(t<=0&&this.remain>0){const t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Pe]((()=>this.emit("error",t)))}if(t>this.remain){const t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Pe]((()=>this.emit("error",t)))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(t===this.remain)for(let e=t;e<this.length&&t<this.blockRemain;e++)this.buf[e+this.offset]=0,t++,this.remain++;const e=0===this.offset&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);this.write(e)?this[Ce]():this[Fe]((()=>this[Ce]()))}[Fe](t){this.once("drain",t)}write(t,e,i){if("function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8")),this.blockRemain<t.length){const t=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}return this.remain-=t.length,this.blockRemain-=t.length,this.pos+=t.length,this.offset+=t.length,super.write(t,null,i)}[Ce](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[Pe]((t=>t?this.emit("error",t):this.end()));if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Te]()}}class WriteEntrySync extends WriteEntry{sync=!0;[Le](){this[Ae](n.lstatSync(this.absolute))}[ve](){this[De](n.readlinkSync(this.absolute))}[xe](){this[Ie](n.openSync(this.absolute,"r"))}[Te](){let t=!0;try{const{fd:e,buf:i,offset:s,length:r,pos:h}=this;if(void 0===e||void 0===i)throw new Error("fd and buf must be set in READ method");const o=n.readSync(e,i,s,r,h);this[Ne](o),t=!1}finally{if(t)try{this[Pe]((()=>{}))}catch(t){}}}[Fe](t){t()}[Pe](t=()=>{}){void 0!==this.fd&&n.closeSync(this.fd),t()}}class WriteEntryTar extends Rt.n_{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,e,i={}){return warnMethod(this,t,e,i)}constructor(t,e={}){const i=dealias(e);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=t;const{type:s}=t;if("Unsupported"===s)throw new Error("writing entry that should be ignored");this.type=s,"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=Ft(t.path),this.mode=void 0!==t.mode?this[Be](t.mode):void 0,this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:i.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=void 0!==t.linkpath?Ft(t.linkpath):void 0,"function"==typeof i.onwarn&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){const[t,e]=stripAbsolutePath(this.path);t&&"string"==typeof e&&(this.path=e,r=t)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new Header({path:this[Me](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[Me](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path}),this.header.encode()&&!this.noPax&&super.write(new Pax({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[Me](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[Me](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());const n=this.header?.block;if(!n)throw new Error("failed to encode header");super.write(n),t.pipe(this)}[Me](t){return prefixPath(t,this.prefix)}[Be](t){return modeFix(t,"Directory"===this.type,this.portable)}write(t,e,i){"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8"));const s=t.length;if(s>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(t,i)}end(t,e,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,e??"utf8")),i&&this.once("finish",i),t?super.end(t,i):super.end(i),this}}const getType=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";class PackJob{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(t,e){this.path=t||"./",this.absolute=e}}const ze=Buffer.alloc(1024),Ue=Symbol("onStat"),je=Symbol("ended"),We=Symbol("queue"),He=Symbol("current"),Ze=Symbol("process"),Ge=Symbol("processing"),Ye=Symbol("processJob"),Ve=Symbol("jobs"),$e=Symbol("jobDone"),Ke=Symbol("addFSEntry"),qe=Symbol("addTarEntry"),Xe=Symbol("stat"),Je=Symbol("readdir"),Qe=Symbol("onreaddir"),ti=Symbol("pipe"),ei=Symbol("entry"),ii=Symbol("entryOpt"),si=Symbol("writeEntryClass"),ri=Symbol("write"),ni=Symbol("ondrain");class Pack extends Rt.n_{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[si];onWriteEntry;[We];[Ve]=0;[Ge]=!1;[je]=!1;constructor(t={}){if(super(),this.opt=t,this.file=t.file||"",this.cwd=t.cwd||process.cwd(),this.maxReadSize=t.maxReadSize,this.preservePaths=!!t.preservePaths,this.strict=!!t.strict,this.noPax=!!t.noPax,this.prefix=Ft(t.prefix||""),this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.readdirCache=t.readdirCache||new Map,this.onWriteEntry=t.onWriteEntry,this[si]=WriteEntry,"function"==typeof t.onwarn&&this.on("warn",t.onwarn),this.portable=!!t.portable,t.gzip||t.brotli){if(t.gzip&&t.brotli)throw new TypeError("gzip and brotli are mutually exclusive");if(t.gzip&&("object"!=typeof t.gzip&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new Gzip(t.gzip)),t.brotli&&("object"!=typeof t.brotli&&(t.brotli={}),this.zip=new BrotliCompress(t.brotli)),!this.zip)throw new Error("impossible");const e=this.zip;e.on("data",(t=>super.write(t))),e.on("end",(()=>super.end())),e.on("drain",(()=>this[ni]())),this.on("resume",(()=>e.resume()))}else this.on("drain",this[ni]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter="function"==typeof t.filter?t.filter:()=>!0,this[We]=new Yallist,this[Ve]=0,this.jobs=Number(t.jobs)||4,this[Ge]=!1,this[je]=!1}[ri](t){return super.write(t)}add(t){return this.write(t),this}end(t,e,i){return"function"==typeof t&&(i=t,t=void 0),"function"==typeof e&&(i=e,e=void 0),t&&this.add(t),this[je]=!0,this[Ze](),i&&i(),this}write(t){if(this[je])throw new Error("write after end");return t instanceof ReadEntry?this[qe](t):this[Ke](t),this.flowing}[qe](t){const e=Ft(Et.resolve(this.cwd,t.path));if(this.filter(t.path,t)){const i=new PackJob(t.path,e);i.entry=new WriteEntryTar(t,this[ii](i)),i.entry.on("end",(()=>this[$e](i))),this[Ve]+=1,this[We].push(i)}else t.resume();this[Ze]()}[Ke](t){const e=Ft(Et.resolve(this.cwd,t));this[We].push(new PackJob(t,e)),this[Ze]()}[Xe](t){t.pending=!0,this[Ve]+=1;const e=this.follow?"stat":"lstat";n[e](t.absolute,((e,i)=>{t.pending=!1,this[Ve]-=1,e?this.emit("error",e):this[Ue](t,i)}))}[Ue](t,e){this.statCache.set(t.absolute,e),t.stat=e,this.filter(t.path,e)||(t.ignore=!0),this[Ze]()}[Je](t){t.pending=!0,this[Ve]+=1,n.readdir(t.absolute,((e,i)=>{if(t.pending=!1,this[Ve]-=1,e)return this.emit("error",e);this[Qe](t,i)}))}[Qe](t,e){this.readdirCache.set(t.absolute,e),t.readdir=e,this[Ze]()}[Ze](){if(!this[Ge]){this[Ge]=!0;for(let t=this[We].head;t&&this[Ve]<this.jobs;t=t.next)if(this[Ye](t.value),t.value.ignore){const e=t.next;this[We].removeNode(t),t.next=e}this[Ge]=!1,this[je]&&!this[We].length&&0===this[Ve]&&(this.zip?this.zip.end(ze):(super.write(ze),super.end()))}}get[He](){return this[We]&&this[We].head&&this[We].head.value}[$e](t){this[We].shift(),this[Ve]-=1,this[Ze]()}[Ye](t){if(!t.pending)if(t.entry)t!==this[He]||t.piped||this[ti](t);else{if(!t.stat){const e=this.statCache.get(t.absolute);e?this[Ue](t,e):this[Xe](t)}if(t.stat&&!t.ignore){if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){const e=this.readdirCache.get(t.absolute);if(e?this[Qe](t,e):this[Je](t),!t.readdir)return}t.entry=this[ei](t),t.entry?t!==this[He]||t.piped||this[ti](t):t.ignore=!0}}}[ii](t){return{onwarn:(t,e,i)=>this.warn(t,e,i),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[ei](t){this[Ve]+=1;try{return new this[si](t.path,this[ii](t)).on("end",(()=>this[$e](t))).on("error",(t=>this.emit("error",t)))}catch(t){this.emit("error",t)}}[ni](){this[He]&&this[He].entry&&this[He].entry.resume()}[ti](t){t.piped=!0,t.readdir&&t.readdir.forEach((e=>{const i=t.path,s="./"===i?"":i.replace(/\/*$/,"/");this[Ke](s+e)}));const e=t.entry,i=this.zip;if(!e)throw new Error("cannot pipe without source");i?e.on("data",(t=>{i.write(t)||e.pause()})):e.on("data",(t=>{super.write(t)||e.pause()}))}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,e,i={}){warnMethod(this,t,e,i)}}class PackSync extends Pack{sync=!0;constructor(t){super(t),this[si]=WriteEntrySync}pause(){}resume(){}[Xe](t){const e=this.follow?"statSync":"lstatSync";this[Ue](t,n[e](t.absolute))}[Je](t){this[Qe](t,n.readdirSync(t.absolute))}[ti](t){const e=t.entry,i=this.zip;if(t.readdir&&t.readdir.forEach((e=>{const i=t.path,s="./"===i?"":i.replace(/\/*$/,"/");this[Ke](s+e)})),!e)throw new Error("Cannot pipe without source");i?e.on("data",(t=>{i.write(t)})):e.on("data",(t=>{super[ri](t)}))}}const addFilesSync=(t,e)=>{e.forEach((e=>{"@"===e.charAt(0)?pe({file:yt.resolve(t.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:e=>t.add(e)}):t.add(e)})),t.end()},addFilesAsync=async(t,e)=>{for(let i=0;i<e.length;i++){const s=String(e[i]);"@"===s.charAt(0)?await pe({file:yt.resolve(String(t.cwd),s.slice(1)),noResume:!0,onReadEntry:e=>{t.add(e)}}):t.add(s)}t.end()},hi=makeCommand(((t,e)=>{const i=new PackSync(t),s=new WriteStreamSync(t.file,{mode:t.mode||438});i.pipe(s),addFilesSync(i,e)}),((t,e)=>{const i=new Pack(t),s=new WriteStream(t.file,{mode:t.mode||438});i.pipe(s);const r=new Promise(((t,e)=>{s.on("error",e),s.on("close",t),i.on("error",e)}));return addFilesAsync(i,e),r}),((t,e)=>{const i=new PackSync(t);return addFilesSync(i,e),i}),((t,e)=>{const i=new Pack(t);return addFilesAsync(i,e),i}),((t,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")}));var oi=i(34589),ai=i(77598);const li="win32"===(process.env.__FAKE_PLATFORM__||process.platform),{O_CREAT:ci,O_TRUNC:di,O_WRONLY:ui}=n.constants,mi=Number(process.env.__FAKE_FS_O_FILENAME__)||n.constants.UV_FS_O_FILEMAP||0,pi=mi|di|ci|ui,fi=li&&!!mi?t=>t<524288?pi:"w":()=>"w",lchownSync=(t,e,i)=>{try{return bt.lchownSync(t,e,i)}catch(t){if("ENOENT"!==t?.code)throw t}},chown=(t,e,i,s)=>{bt.lchown(t,e,i,(t=>{s(t&&"ENOENT"!==t?.code?t:null)}))},chownrKid=(t,e,i,s,r)=>{if(e.isDirectory())chownr(yt.resolve(t,e.name),i,s,(n=>{if(n)return r(n);const h=yt.resolve(t,e.name);chown(h,i,s,r)}));else{const n=yt.resolve(t,e.name);chown(n,i,s,r)}},chownr=(t,e,i,s)=>{bt.readdir(t,{withFileTypes:!0},((r,n)=>{if(r){if("ENOENT"===r.code)return s();if("ENOTDIR"!==r.code&&"ENOTSUP"!==r.code)return s(r)}if(r||!n.length)return chown(t,e,i,s);let h=n.length,o=null;const then=r=>{if(!o)return r?s(o=r):0==--h?chown(t,e,i,s):void 0};for(const s of n)chownrKid(t,s,e,i,then)}))},chownrKidSync=(t,e,i,s)=>{e.isDirectory()&&chownrSync(yt.resolve(t,e.name),i,s),lchownSync(yt.resolve(t,e.name),i,s)},chownrSync=(t,e,i)=>{let s;try{s=bt.readdirSync(t,{withFileTypes:!0})}catch(s){const r=s;if("ENOENT"===r?.code)return;if("ENOTDIR"===r?.code||"ENOTSUP"===r?.code)return lchownSync(t,e,i);throw r}for(const r of s)chownrKidSync(t,r,e,i);return lchownSync(t,e,i)},optsArg=t=>{if(t)if("object"==typeof t)t={mode:511,...t};else if("number"==typeof t)t={mode:t};else{if("string"!=typeof t)throw new TypeError("invalid options argument");t={mode:parseInt(t,8)}}else t={mode:511};const e=t,i=t.fs||{};return t.mkdir=t.mkdir||i.mkdir||n.mkdir,t.mkdirAsync=t.mkdirAsync?t.mkdirAsync:async(t,i)=>new Promise(((s,r)=>e.mkdir(t,i,((t,e)=>t?r(t):s(e))))),t.stat=t.stat||i.stat||n.stat,t.statAsync=t.statAsync?t.statAsync:async t=>new Promise(((i,s)=>e.stat(t,((t,e)=>t?s(t):i(e))))),t.statSync=t.statSync||i.statSync||n.statSync,t.mkdirSync=t.mkdirSync||i.mkdirSync||n.mkdirSync,e},mkdirp_manual_mkdirpManualSync=(t,e,i)=>{const s=(0,Et.dirname)(t),r={...optsArg(e),recursive:!1};if(s===t)try{return r.mkdirSync(t,r)}catch(t){if(t&&"EISDIR"!==t.code)throw t;return}try{return r.mkdirSync(t,r),i||t}catch(e){const n=e;if(n&&"ENOENT"===n.code)return mkdirp_manual_mkdirpManualSync(t,r,mkdirp_manual_mkdirpManualSync(s,r,i));if(n&&"EEXIST"!==n.code&&n&&"EROFS"!==n.code)throw e;try{if(!r.statSync(t).isDirectory())throw e}catch(t){throw e}}},yi=Object.assign((async(t,e,i)=>{const s=optsArg(e);s.recursive=!1;const r=(0,Et.dirname)(t);return r===t?s.mkdirAsync(t,s).catch((t=>{if(t&&"EISDIR"!==t.code)throw t})):s.mkdirAsync(t,s).then((()=>i||t),(async e=>{const n=e;if(n&&"ENOENT"===n.code)return yi(r,s).then((e=>yi(t,s,e)));if(n&&"EEXIST"!==n.code&&"EROFS"!==n.code)throw e;return s.statAsync(t).then((t=>{if(t.isDirectory())return i;throw e}),(()=>{throw e}))}))}),{sync:mkdirp_manual_mkdirpManualSync}),findMade=async(t,e,i)=>{if(i!==e)return t.statAsync(e).then((t=>t.isDirectory()?i:void 0),(i=>i&&"ENOENT"===i.code?findMade(t,(0,Et.dirname)(e),e):void 0))},findMadeSync=(t,e,i)=>{if(i!==e)try{return t.statSync(e).isDirectory()?i:void 0}catch(i){return i&&"ENOENT"===i.code?findMadeSync(t,(0,Et.dirname)(e),e):void 0}},mkdirp_native_mkdirpNativeSync=(t,e)=>{const i=optsArg(e);i.recursive=!0;if((0,Et.dirname)(t)===t)return i.mkdirSync(t,i);const s=findMadeSync(i,t);try{return i.mkdirSync(t,i),s}catch(e){if(e&&"ENOENT"===e.code)return mkdirp_manual_mkdirpManualSync(t,i);throw e}},bi=Object.assign((async(t,e)=>{const i={...optsArg(e),recursive:!0};return(0,Et.dirname)(t)===t?await i.mkdirAsync(t,i):findMade(i,t).then((e=>i.mkdirAsync(t,i).then((t=>e||t)).catch((e=>{if(e&&"ENOENT"===e.code)return yi(t,i);throw e}))))}),{sync:mkdirp_native_mkdirpNativeSync}),Ei=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,pathArg=t=>{if(/\0/.test(t))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"});if(t=(0,Et.resolve)(t),"win32"===Ei){const e=/[*|"<>?:]/,{root:i}=(0,Et.parse)(t);if(e.test(t.substring(i.length)))throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}return t},wi=(process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version).replace(/^v/,"").split("."),gi=+wi[0]>10||10==+wi[0]&&+wi[1]>=12,Si=gi?t=>optsArg(t).mkdirSync===n.mkdirSync:()=>!1,Ri=Object.assign(gi?t=>optsArg(t).mkdir===n.mkdir:()=>!1,{sync:Si}),mkdirpSync=(t,e)=>{t=pathArg(t);const i=optsArg(e);return Si(i)?mkdirp_native_mkdirpNativeSync(t,i):mkdirp_manual_mkdirpManualSync(t,i)},_i=Object.assign((async(t,e)=>{t=pathArg(t);const i=optsArg(e);return Ri(i)?bi(t,i):yi(t,i)}),{mkdirpSync,mkdirpNative:bi,mkdirpNativeSync:mkdirp_native_mkdirpNativeSync,mkdirpManual:yi,mkdirpManualSync:mkdirp_manual_mkdirpManualSync,sync:mkdirpSync,native:bi,nativeSync:mkdirp_native_mkdirpNativeSync,manual:yi,manualSync:mkdirp_manual_mkdirpManualSync,useNative:Ri,useNativeSync:Si});class CwdError extends Error{path;code;syscall="chdir";constructor(t,e){super(`${e}: Cannot cd into '${t}'`),this.path=t,this.code=e}get name(){return"CwdError"}}class SymlinkError extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,e){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=e}get name(){return"SymlinkError"}}const cGet=(t,e)=>t.get(Ft(e)),cSet=(t,e,i)=>t.set(Ft(e),i),mkdir=(t,e,i)=>{t=Ft(t);const s=e.umask??18,r=448|e.mode,h=!!(r&s),o=e.uid,a=e.gid,l="number"==typeof o&&"number"==typeof a&&(o!==e.processUid||a!==e.processGid),c=e.preserve,d=e.unlink,u=e.cache,m=Ft(e.cwd),done=(e,s)=>{e?i(e):(cSet(u,t,!0),s&&l?chownr(s,o,a,(t=>done(t))):h?n.chmod(t,r,i):i())};if(u&&!0===cGet(u,t))return done();if(t===m)return((t,e)=>{n.stat(t,((i,s)=>{!i&&s.isDirectory()||(i=new CwdError(t,i?.code||"ENOTDIR")),e(i)}))})(t,done);if(c)return _i(t,{mode:r}).then((t=>done(null,t??void 0)),done);const p=Ft(yt.relative(m,t)).split("/");mkdir_(m,p,r,u,d,m,void 0,done)},mkdir_=(t,e,i,s,r,h,o,a)=>{if(!e.length)return a(null,o);const l=e.shift(),c=Ft(yt.resolve(t+"/"+l));if(cGet(s,c))return mkdir_(c,e,i,s,r,h,o,a);n.mkdir(c,i,onmkdir(c,e,i,s,r,h,o,a))},onmkdir=(t,e,i,s,r,h,o,a)=>l=>{l?n.lstat(t,((c,d)=>{if(c)c.path=c.path&&Ft(c.path),a(c);else if(d.isDirectory())mkdir_(t,e,i,s,r,h,o,a);else if(r)n.unlink(t,(l=>{if(l)return a(l);n.mkdir(t,i,onmkdir(t,e,i,s,r,h,o,a))}));else{if(d.isSymbolicLink())return a(new SymlinkError(t,t+"/"+e.join("/")));a(l)}})):mkdir_(t,e,i,s,r,h,o=o||t,a)},mkdirSync=(t,e)=>{t=Ft(t);const i=e.umask??18,s=448|e.mode,r=!!(s&i),h=e.uid,o=e.gid,a="number"==typeof h&&"number"==typeof o&&(h!==e.processUid||o!==e.processGid),l=e.preserve,c=e.unlink,d=e.cache,u=Ft(e.cwd),done=e=>{cSet(d,t,!0),e&&a&&chownrSync(e,h,o),r&&n.chmodSync(t,s)};if(d&&!0===cGet(d,t))return done();if(t===u)return(t=>{let e,i=!1;try{i=n.statSync(t).isDirectory()}catch(t){e=t?.code}finally{if(!i)throw new CwdError(t,e??"ENOTDIR")}})(u),done();if(l)return done(mkdirpSync(t,s)??void 0);const m=Ft(yt.relative(u,t)).split("/");let p;for(let t=m.shift(),e=u;t&&(e+="/"+t);t=m.shift())if(e=Ft(yt.resolve(e)),!cGet(d,e))try{n.mkdirSync(e,s),p=p||e,cSet(d,e,!0)}catch(t){const i=n.lstatSync(e);if(i.isDirectory()){cSet(d,e,!0);continue}if(c){n.unlinkSync(e),n.mkdirSync(e,s),p=p||e,cSet(d,e,!0);continue}if(i.isSymbolicLink())return new SymlinkError(e,e+"/"+m.join("/"))}return done(p)},vi=Object.create(null),{hasOwnProperty:Oi}=Object.prototype,normalizeUnicode=t=>(Oi.call(vi,t)||(vi[t]=t.normalize("NFD")),vi[t]),ki="win32"===(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform);class PathReservations{#m=new Map;#p=new Map;#f=new Set;reserve(t,e){t=ki?["win32 parallelization disabled"]:t.map((t=>stripTrailingSlashes((0,yt.join)(normalizeUnicode(t))).toLowerCase()));const i=new Set(t.map((t=>(t=>{const e=t.split("/").slice(0,-1).reduce(((t,e)=>{const i=t[t.length-1];return void 0!==i&&(e=(0,yt.join)(i,e)),t.push(e||"/"),t}),[]);return e})(t))).reduce(((t,e)=>t.concat(e))));this.#p.set(e,{dirs:i,paths:t});for(const i of t){const t=this.#m.get(i);t?t.push(e):this.#m.set(i,[e])}for(const t of i){const i=this.#m.get(t);if(i){const t=i[i.length-1];t instanceof Set?t.add(e):i.push(new Set([e]))}else this.#m.set(t,[new Set([e])])}return this.#y(e)}#b(t){const e=this.#p.get(t);if(!e)throw new Error("function does not have any path reservations");return{paths:e.paths.map((t=>this.#m.get(t))),dirs:[...e.dirs].map((t=>this.#m.get(t)))}}check(t){const{paths:e,dirs:i}=this.#b(t);return e.every((e=>e&&e[0]===t))&&i.every((e=>e&&e[0]instanceof Set&&e[0].has(t)))}#y(t){return!(this.#f.has(t)||!this.check(t))&&(this.#f.add(t),t((()=>this.#E(t))),!0)}#E(t){if(!this.#f.has(t))return!1;const e=this.#p.get(t);if(!e)throw new Error("invalid reservation");const{paths:i,dirs:s}=e,r=new Set;for(const e of i){const i=this.#m.get(e);if(!i||i?.[0]!==t)continue;const s=i[1];if(s)if(i.shift(),"function"==typeof s)r.add(s);else for(const t of s)r.add(t);else this.#m.delete(e)}for(const e of s){const i=this.#m.get(e),s=i?.[0];if(i&&s instanceof Set)if(1!==s.size||1!==i.length)if(1===s.size){i.shift();const t=i[0];"function"==typeof t&&r.add(t)}else s.delete(t);else this.#m.delete(e)}return this.#f.delete(t),r.forEach((t=>this.#y(t))),!0}}const Ti=Symbol("onEntry"),Li=Symbol("checkFs"),Ai=Symbol("checkFs2"),Ni=Symbol("pruneCache"),Di=Symbol("isReusable"),xi=Symbol("makeFs"),Ii=Symbol("file"),Pi=Symbol("directory"),Bi=Symbol("link"),Fi=Symbol("symlink"),Ci=Symbol("hardlink"),Mi=Symbol("unsupported"),zi=Symbol("checkPath"),Ui=Symbol("mkdir"),ji=Symbol("onError"),Wi=Symbol("pending"),Hi=Symbol("pend"),Zi=Symbol("unpend"),Gi=Symbol("ended"),Yi=Symbol("maybeClose"),Vi=Symbol("skip"),$i=Symbol("doChown"),Ki=Symbol("uid"),qi=Symbol("gid"),Xi=Symbol("checkedCwd"),Ji="win32"===(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform),uint32=(t,e,i)=>void 0!==t&&t===t>>>0?t:void 0!==e&&e===e>>>0?e:i,cacheKeyNormalize=t=>stripTrailingSlashes(Ft(normalizeUnicode(t))).toLowerCase();class Unpack extends Parser{[Gi]=!1;[Xi]=!1;[Wi]=0;reservations=new PathReservations;transform;writable=!0;readable=!1;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){if(t.ondone=()=>{this[Gi]=!0,this[Yi]()},super(t),this.transform=t.transform,this.dirCache=t.dirCache||new Map,this.chmod=!!t.chmod,"number"==typeof t.uid||"number"==typeof t.gid){if("number"!=typeof t.uid||"number"!=typeof t.gid)throw new TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;void 0===t.preserveOwner&&"number"!=typeof t.uid?this.preserveOwner=!(!process.getuid||0!==process.getuid()):this.preserveOwner=!!t.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth="number"==typeof t.maxDepth?t.maxDepth:1024,this.forceChown=!0===t.forceChown,this.win32=!!t.win32||Ji,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=Ft(yt.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?"number"==typeof t.processUmask?t.processUmask:process.umask():0,this.umask="number"==typeof t.umask?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",(t=>this[Ti](t)))}warn(t,e,i={}){return"TAR_BAD_ARCHIVE"!==t&&"TAR_ABORT"!==t||(i.recoverable=!1),super.warn(t,e,i)}[Yi](){this[Gi]&&0===this[Wi]&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[zi](t){const e=Ft(t.path),i=e.split("/");if(this.strip){if(i.length<this.strip)return!1;if("Link"===t.type){const e=Ft(String(t.linkpath)).split("/");if(!(e.length>=this.strip))return!1;t.linkpath=e.slice(this.strip).join("/")}i.splice(0,this.strip),t.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:e,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(i.includes("..")||Ji&&/^[a-z]:\.\.$/i.test(i[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:t,path:e}),!1;const[s,r]=stripAbsolutePath(e);s&&(t.path=String(r),this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:t,path:e}))}if(yt.isAbsolute(t.path)?t.absolute=Ft(yt.resolve(t.path)):t.absolute=Ft(yt.resolve(this.cwd,t.path)),!this.preservePaths&&"string"==typeof t.absolute&&0!==t.absolute.indexOf(this.cwd+"/")&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:Ft(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&"Directory"!==t.type&&"GNUDumpDir"!==t.type)return!1;if(this.win32){const{root:e}=yt.win32.parse(String(t.absolute));t.absolute=e+winchars_encode(String(t.absolute).slice(e.length));const{root:i}=yt.win32.parse(t.path);t.path=i+winchars_encode(t.path.slice(i.length))}return!0}[Ti](t){if(!this[zi](t))return t.resume();switch(oi.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode=448|t.mode);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Li](t);default:return this[Mi](t)}}[ji](t,e){"CwdError"===t.name?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:e}),this[Zi](),e.resume())}[Ui](t,e,i){mkdir(Ft(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:e},i)}[$i](t){return this.forceChown||this.preserveOwner&&("number"==typeof t.uid&&t.uid!==this.processUid||"number"==typeof t.gid&&t.gid!==this.processGid)||"number"==typeof this.uid&&this.uid!==this.processUid||"number"==typeof this.gid&&this.gid!==this.processGid}[Ki](t){return uint32(this.uid,t.uid,this.processUid)}[qi](t){return uint32(this.gid,t.gid,this.processGid)}[Ii](t,e){const i="number"==typeof t.mode?4095&t.mode:this.fmode,s=new WriteStream(String(t.absolute),{flags:fi(t.size),mode:i,autoClose:!1});s.on("error",(i=>{s.fd&&bt.close(s.fd,(()=>{})),s.write=()=>!0,this[ji](i,t),e()}));let r=1;const done=i=>{if(i)return s.fd&&bt.close(s.fd,(()=>{})),this[ji](i,t),void e();0==--r&&void 0!==s.fd&&bt.close(s.fd,(i=>{i?this[ji](i,t):this[Zi](),e()}))};s.on("finish",(()=>{const e=String(t.absolute),i=s.fd;if("number"==typeof i&&t.mtime&&!this.noMtime){r++;const s=t.atime||new Date,n=t.mtime;bt.futimes(i,s,n,(t=>t?bt.utimes(e,s,n,(e=>done(e&&t))):done()))}if("number"==typeof i&&this[$i](t)){r++;const s=this[Ki](t),n=this[qi](t);"number"==typeof s&&"number"==typeof n&&bt.fchown(i,s,n,(t=>t?bt.chown(e,s,n,(e=>done(e&&t))):done()))}done()}));const n=this.transform&&this.transform(t)||t;n!==t&&(n.on("error",(i=>{this[ji](i,t),e()})),t.pipe(n)),n.pipe(s)}[Pi](t,e){const i="number"==typeof t.mode?4095&t.mode:this.dmode;this[Ui](String(t.absolute),i,(i=>{if(i)return this[ji](i,t),void e();let s=1;const done=()=>{0==--s&&(e(),this[Zi](),t.resume())};t.mtime&&!this.noMtime&&(s++,bt.utimes(String(t.absolute),t.atime||new Date,t.mtime,done)),this[$i](t)&&(s++,bt.chown(String(t.absolute),Number(this[Ki](t)),Number(this[qi](t)),done)),done()}))}[Mi](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[Fi](t,e){this[Bi](t,String(t.linkpath),"symlink",e)}[Ci](t,e){const i=Ft(yt.resolve(this.cwd,String(t.linkpath)));this[Bi](t,i,"link",e)}[Hi](){this[Wi]++}[Zi](){this[Wi]--,this[Yi]()}[Vi](t){this[Zi](),t.resume()}[Di](t,e){return"File"===t.type&&!this.unlink&&e.isFile()&&e.nlink<=1&&!Ji}[Li](t){this[Hi]();const e=[t.path];t.linkpath&&e.push(t.linkpath),this.reservations.reserve(e,(e=>this[Ai](t,e)))}[Ni](t){"SymbolicLink"===t.type?(t=>{for(const e of t.keys())t.delete(e)})(this.dirCache):"Directory"!==t.type&&((t,e)=>{e=cacheKeyNormalize(e);for(const i of t.keys()){const s=cacheKeyNormalize(i);s!==e&&0!==s.indexOf(e+"/")||t.delete(i)}})(this.dirCache,String(t.absolute))}[Ai](t,e){this[Ni](t);const done=i=>{this[Ni](t),e(i)},checkCwd=()=>{this[Ui](this.cwd,this.dmode,(e=>{if(e)return this[ji](e,t),void done();this[Xi]=!0,start()}))},start=()=>{if(t.absolute!==this.cwd){const e=Ft(yt.dirname(String(t.absolute)));if(e!==this.cwd)return this[Ui](e,this.dmode,(e=>{if(e)return this[ji](e,t),void done();afterMakeParent()}))}afterMakeParent()},afterMakeParent=()=>{bt.lstat(String(t.absolute),((e,i)=>{if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime)))return this[Vi](t),void done();if(e||this[Di](t,i))return this[xi](null,t,done);if(i.isDirectory()){if("Directory"===t.type){const afterChmod=e=>this[xi](e??null,t,done);return this.chmod&&t.mode&&(4095&i.mode)!==t.mode?bt.chmod(String(t.absolute),Number(t.mode),afterChmod):afterChmod()}if(t.absolute!==this.cwd)return bt.rmdir(String(t.absolute),(e=>this[xi](e??null,t,done)))}if(t.absolute===this.cwd)return this[xi](null,t,done);((t,e)=>{if(!Ji)return bt.unlink(t,e);const i=t+".DELETE."+(0,ai.randomBytes)(16).toString("hex");bt.rename(t,i,(t=>{if(t)return e(t);bt.unlink(i,e)}))})(String(t.absolute),(e=>this[xi](e??null,t,done)))}))};this[Xi]?start():checkCwd()}[xi](t,e,i){if(t)return this[ji](t,e),void i();switch(e.type){case"File":case"OldFile":case"ContiguousFile":return this[Ii](e,i);case"Link":return this[Ci](e,i);case"SymbolicLink":return this[Fi](e,i);case"Directory":case"GNUDumpDir":return this[Pi](e,i)}}[Bi](t,e,i,s){bt[i](e,String(t.absolute),(e=>{e?this[ji](e,t):(this[Zi](),t.resume()),s()}))}}const callSync=t=>{try{return[null,t()]}catch(t){return[t,null]}};class UnpackSync extends Unpack{sync=!0;[xi](t,e){return super[xi](t,e,(()=>{}))}[Li](t){if(this[Ni](t),!this[Xi]){const e=this[Ui](this.cwd,this.dmode);if(e)return this[ji](e,t);this[Xi]=!0}if(t.absolute!==this.cwd){const e=Ft(yt.dirname(String(t.absolute)));if(e!==this.cwd){const i=this[Ui](e,this.dmode);if(i)return this[ji](i,t)}}const[e,i]=callSync((()=>bt.lstatSync(String(t.absolute))));if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime)))return this[Vi](t);if(e||this[Di](t,i))return this[xi](null,t);if(i.isDirectory()){if("Directory"===t.type){const e=this.chmod&&t.mode&&(4095&i.mode)!==t.mode,[s]=e?callSync((()=>{bt.chmodSync(String(t.absolute),Number(t.mode))})):[];return this[xi](s,t)}const[e]=callSync((()=>bt.rmdirSync(String(t.absolute))));this[xi](e,t)}const[s]=t.absolute===this.cwd?[]:callSync((()=>(t=>{if(!Ji)return bt.unlinkSync(t);const e=t+".DELETE."+(0,ai.randomBytes)(16).toString("hex");bt.renameSync(t,e),bt.unlinkSync(e)})(String(t.absolute))));this[xi](s,t)}[Ii](t,e){const i="number"==typeof t.mode?4095&t.mode:this.fmode,oner=i=>{let r;try{bt.closeSync(s)}catch(t){r=t}(i||r)&&this[ji](i||r,t),e()};let s;try{s=bt.openSync(String(t.absolute),fi(t.size),i)}catch(t){return oner(t)}const r=this.transform&&this.transform(t)||t;r!==t&&(r.on("error",(e=>this[ji](e,t))),t.pipe(r)),r.on("data",(t=>{try{bt.writeSync(s,t,0,t.length)}catch(t){oner(t)}})),r.on("end",(()=>{let e=null;if(t.mtime&&!this.noMtime){const i=t.atime||new Date,r=t.mtime;try{bt.futimesSync(s,i,r)}catch(s){try{bt.utimesSync(String(t.absolute),i,r)}catch(t){e=s}}}if(this[$i](t)){const i=this[Ki](t),r=this[qi](t);try{bt.fchownSync(s,Number(i),Number(r))}catch(s){try{bt.chownSync(String(t.absolute),Number(i),Number(r))}catch(t){e=e||s}}}oner(e)}))}[Pi](t,e){const i="number"==typeof t.mode?4095&t.mode:this.dmode,s=this[Ui](String(t.absolute),i);if(s)return this[ji](s,t),void e();if(t.mtime&&!this.noMtime)try{bt.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch(s){}if(this[$i](t))try{bt.chownSync(String(t.absolute),Number(this[Ki](t)),Number(this[qi](t)))}catch(s){}e(),t.resume()}[Ui](t,e){try{return mkdirSync(Ft(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:e})}catch(t){return t}}[Bi](t,e,i,s){const r=`${i}Sync`;try{bt[r](e,String(t.absolute)),s(),t.resume()}catch(e){return this[ji](e,t)}}}const Qi=makeCommand((t=>{const e=new UnpackSync(t),i=t.file,s=bt.statSync(i),r=t.maxReadSize||16777216;new ReadStreamSync(i,{readSize:r,size:s.size}).pipe(e)}),((t,e)=>{const i=new Unpack(t),s=t.maxReadSize||16777216,r=t.file;return new Promise(((t,e)=>{i.on("error",e),i.on("close",t),bt.stat(r,((t,n)=>{if(t)e(t);else{const t=new ReadStream(r,{readSize:s,size:n.size});t.on("error",e),t.pipe(i)}}))}))}),(t=>new UnpackSync(t)),(t=>new Unpack(t)),((t,e)=>{e?.length&&filesFilter(t,e)})),streamSync=(t,e,i,s,r)=>{const n=new WriteStreamSync(t.file,{fd:s,start:i});e.pipe(n),replace_addFilesSync(e,r)},replace_addFilesSync=(t,e)=>{e.forEach((e=>{"@"===e.charAt(0)?pe({file:yt.resolve(t.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:e=>t.add(e)}):t.add(e)})),t.end()},replace_addFilesAsync=async(t,e)=>{for(let i=0;i<e.length;i++){const s=String(e[i]);"@"===s.charAt(0)?await pe({file:yt.resolve(String(t.cwd),s.slice(1)),noResume:!0,onReadEntry:e=>t.add(e)}):t.add(s)}t.end()},ts=makeCommand(((t,e)=>{const i=new PackSync(t);let s,r,n=!0;try{try{s=bt.openSync(t.file,"r+")}catch(e){if("ENOENT"!==e?.code)throw e;s=bt.openSync(t.file,"w+")}const h=bt.fstatSync(s),o=Buffer.alloc(512);t:for(r=0;r<h.size;r+=512){for(let t=0,e=0;t<512;t+=e){if(e=bt.readSync(s,o,t,o.length-t,r+t),0===r&&31===o[0]&&139===o[1])throw new Error("cannot append to compressed archives");if(!e)break t}const e=new Header(o);if(!e.cksumValid)break;const i=512*Math.ceil((e.size||0)/512);if(r+i+512>h.size)break;r+=i,t.mtimeCache&&e.mtime&&t.mtimeCache.set(String(e.path),e.mtime)}n=!1,streamSync(t,i,r,s,e)}finally{if(n)try{bt.closeSync(s)}catch(t){}}}),((t,e)=>{e=Array.from(e);const i=new Pack(t),s=new Promise(((s,r)=>{i.on("error",r);let n="r+";const onopen=(h,o)=>h&&"ENOENT"===h.code&&"r+"===n?(n="w+",bt.open(t.file,n,onopen)):h||!o?r(h):void bt.fstat(o,((n,h)=>{if(n)return bt.close(o,(()=>r(n)));((e,i,s)=>{const cb=(t,i)=>{t?bt.close(e,(e=>s(t))):s(null,i)};let r=0;if(0===i)return cb(null,0);let n=0;const h=Buffer.alloc(512),onread=(s,o)=>{if(s||void 0===o)return cb(s);if(n+=o,n<512&&o)return bt.read(e,h,n,h.length-n,r+n,onread);if(0===r&&31===h[0]&&139===h[1])return cb(new Error("cannot append to compressed archives"));if(n<512)return cb(null,r);const a=new Header(h);if(!a.cksumValid)return cb(null,r);const l=512*Math.ceil((a.size??0)/512);return r+l+512>i?cb(null,r):(r+=l+512,r>=i?cb(null,r):(t.mtimeCache&&a.mtime&&t.mtimeCache.set(String(a.path),a.mtime),n=0,void bt.read(e,h,0,512,r,onread)))};bt.read(e,h,0,512,r,onread)})(o,h.size,((n,h)=>{if(n)return r(n);const a=new WriteStream(t.file,{fd:o,start:h});i.pipe(a),a.on("error",r),a.on("close",s),replace_addFilesAsync(i,e)}))}));bt.open(t.file,n,onopen)}));return s}),(()=>{throw new TypeError("file is required")}),(()=>{throw new TypeError("file is required")}),((t,e)=>{if(!t.file)throw new TypeError("file is required");if(t.gzip||t.brotli||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e?.length)throw new TypeError("no paths specified to add/replace")})),es=makeCommand(ts.syncFile,ts.asyncFile,ts.syncNoFile,ts.asyncNoFile,((t,e=[])=>{ts.validate?.(t,e),mtimeFilter(t)})),mtimeFilter=t=>{const e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(i,s)=>e(i,s)&&!((t.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(e,i)=>!((t.mtimeCache?.get(e)??i.mtime??0)>(i.mtime??0))}}};