@visulima/vis 1.0.0-alpha.35 → 1.0.0-alpha.37
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/CHANGELOG.md +74 -0
- package/LICENSE.md +3244 -1611
- package/README.md +44 -0
- package/dashboard/dist/index.html +11 -11
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +74 -2
- package/dist/config/index.js +1 -1
- package/dist/generate/index.js +1 -1
- package/dist/packem_chunks/bin.js +584 -588
- package/dist/packem_chunks/bloom-status.js +2 -2
- package/dist/packem_chunks/bloom-sync.js +2 -2
- package/dist/packem_chunks/cache-attestation.js +1 -1
- package/dist/packem_chunks/config.js +18 -16
- package/dist/packem_chunks/devtools.js +56 -57
- package/dist/packem_chunks/doctor-probe.js +2 -2
- package/dist/packem_chunks/fix.js +11 -11
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +5 -5
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +7 -7
- package/dist/packem_chunks/handler14.js +4 -4
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +3 -3
- package/dist/packem_chunks/handler20.js +5 -5
- package/dist/packem_chunks/handler21.js +2 -2
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -5
- package/dist/packem_chunks/handler26.js +5 -1
- package/dist/packem_chunks/handler27.js +1 -3
- package/dist/packem_chunks/handler28.js +3 -1
- package/dist/packem_chunks/handler29.js +1 -7
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +6 -32
- package/dist/packem_chunks/handler31.js +33 -3
- package/dist/packem_chunks/handler32.js +3 -8
- package/dist/packem_chunks/handler33.js +8 -1
- package/dist/packem_chunks/handler34.js +4 -5
- package/dist/packem_chunks/handler35.js +1 -11
- package/dist/packem_chunks/handler36.js +5 -3
- package/dist/packem_chunks/handler37.js +11 -22
- package/dist/packem_chunks/handler38.js +3 -61
- package/dist/packem_chunks/handler39.js +22 -3
- package/dist/packem_chunks/handler4.js +6 -6
- package/dist/packem_chunks/handler40.js +61 -6
- package/dist/packem_chunks/handler41.js +3 -24
- package/dist/packem_chunks/handler42.js +6 -25
- package/dist/packem_chunks/handler43.js +24 -153
- package/dist/packem_chunks/handler44.js +25 -10
- package/dist/packem_chunks/handler45.js +152 -707
- package/dist/packem_chunks/handler46.js +10 -24
- package/dist/packem_chunks/handler47.js +24 -322
- package/dist/packem_chunks/handler48.js +322 -48
- package/dist/packem_chunks/handler49.js +708 -3
- package/dist/packem_chunks/handler5.js +7 -7
- package/dist/packem_chunks/handler50.js +48 -27
- package/dist/packem_chunks/handler51.js +21 -189
- package/dist/packem_chunks/handler52.js +3 -34
- package/dist/packem_chunks/handler53.js +200 -0
- package/dist/packem_chunks/handler54.js +38 -0
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +7 -7
- package/dist/packem_chunks/heal.js +11 -11
- package/dist/packem_chunks/help-command.js +30 -7
- package/dist/packem_chunks/index.js +6 -6
- package/dist/packem_chunks/keys-refresh.js +4 -4
- package/dist/packem_chunks/list.js +2 -2
- package/dist/packem_chunks/loader.js +4 -4
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/prune.js +3 -3
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/status.js +2 -2
- package/dist/packem_chunks/sync.js +2 -2
- package/dist/packem_chunks/sync2.js +2 -2
- package/dist/packem_chunks/tar.js +3 -3
- package/dist/packem_chunks/tripwire.js +2 -2
- package/dist/packem_chunks/verify-lockfile.js +2 -2
- package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +1 -0
- package/dist/packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js +3 -0
- package/dist/packem_shared/Table-CcVkyULl-B_ef6zfS.js +35 -0
- package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +1 -0
- package/dist/packem_shared/advisories-DLeO5KMN.js +1 -0
- package/dist/packem_shared/affected-shas-cVnX8-zs.js +1 -0
- package/dist/packem_shared/ai-analysis-DT3bU-_M.js +68 -0
- package/dist/packem_shared/ai-fix-BkNqd5nP.js +43 -0
- package/dist/packem_shared/build-scripts-CCCi8U66.js +1 -0
- package/dist/packem_shared/cyclonedx-86-DbHtf.js +4 -0
- package/dist/packem_shared/definePlugin-DoUcoYSy.js +1 -0
- package/dist/packem_shared/dependency-scan-BDTH898x.js +1 -0
- package/dist/packem_shared/docker-tNrDU3oK.js +59 -0
- package/dist/packem_shared/failure-log-Dwqt6_Ga.js +2 -0
- package/dist/packem_shared/giget-DHY1sQZC.js +2 -0
- package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +1 -0
- package/dist/packem_shared/index-BDmTbWX1.js +19 -0
- package/dist/packem_shared/index-CB4p298r.js +1 -0
- package/dist/packem_shared/index-DMefdF51.js +1 -0
- package/dist/packem_shared/index-dQ37x8_P.js +30 -0
- package/dist/packem_shared/license-t5KnNX6v.js +1 -0
- package/dist/packem_shared/lifecycle-4z9hHE5b.js +2 -0
- package/dist/packem_shared/lockfile-C8Q1_4KK.js +1 -0
- package/dist/packem_shared/manifests-Dj3pRKBT.js +1 -0
- package/dist/packem_shared/min-release-age-D1alDE3K.js +34 -0
- package/dist/packem_shared/missing-package-json-41VUWFBY.js +1 -0
- package/dist/packem_shared/native-config-sync-BKAZ0NIs.js +21 -0
- package/dist/packem_shared/osv-bloom-B03tUWf3.js +2 -0
- package/dist/packem_shared/otelPlugin-DmKDBaPo.js +1 -0
- package/dist/packem_shared/peer-warnings-BXAzXqY3.js +1 -0
- package/dist/packem_shared/pm-runner-pVihAfxV.js +1 -0
- package/dist/packem_shared/provenance-DMuEftgc.js +1 -0
- package/dist/packem_shared/registry-keys-Bf2zzlcZ.js +1 -0
- package/dist/packem_shared/resolve-explicit-jH0RKyMJ.js +5 -0
- package/dist/packem_shared/runtime-check-Stc9AI78.js +1 -0
- package/dist/packem_shared/s1ngularity-BkfgC6NO.js +1 -0
- package/dist/packem_shared/scan-progress-JBbd9QeT.js +2 -0
- package/dist/packem_shared/selectors-GCJIe342.js +3 -0
- package/dist/packem_shared/signatures-D1H6h6GH.js +2 -0
- package/dist/packem_shared/spinner-BXSl864p.js +1 -0
- package/dist/packem_shared/subtree-C7bZuiSQ.js +2 -0
- package/dist/packem_shared/symbols-DPTlrJ3B.js +1 -0
- package/dist/packem_shared/tabs-BqUepRaD.js +1 -0
- package/dist/packem_shared/toolchain-pR7AJ-tB.js +5 -0
- package/dist/packem_shared/typosquats-C8qg1neE.js +1 -0
- package/dist/packem_shared/use-measured-height-BBJ9intr.js +1 -0
- package/dist/packem_shared/utils-Cxree603.js +1 -0
- package/dist/packem_shared/verify-Du7xZ2BJ.js +1 -0
- package/dist/packem_shared/vis-update-app-CTwRkNgj.js +1 -0
- package/dist/packem_shared/watch-BvIwLG4N.js +1 -0
- package/dist/packem_shared/watch-loop-DWkvv2tK.js +11 -0
- package/index.d.ts +201 -201
- package/index.js +751 -567
- package/package.json +16 -16
- package/schemas/vis-config.schema.json +4 -0
- package/dist/packem_shared/Table-3pFgIUZ2-DABgc6rj.js +0 -12
- package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +0 -1
- package/dist/packem_shared/advisories-CGKZo9Rx.js +0 -1
- package/dist/packem_shared/affected-shas-BdnlfiV1.js +0 -1
- package/dist/packem_shared/ai-analysis-3QD_RS6F.js +0 -68
- package/dist/packem_shared/ai-fix-TsjDQz_0.js +0 -43
- package/dist/packem_shared/applyDefaults-BogleaFi.js +0 -1
- package/dist/packem_shared/build-scripts-DE6U8jVq.js +0 -1
- package/dist/packem_shared/cyclonedx-zf9R2jCs.js +0 -4
- package/dist/packem_shared/definePlugin-CWm4Dv_t.js +0 -1
- package/dist/packem_shared/dependency-scan-B70azq4x.js +0 -1
- package/dist/packem_shared/docker-EJiTY0Sz.js +0 -60
- package/dist/packem_shared/failure-log-Dxafk3t4.js +0 -2
- package/dist/packem_shared/giget-CcEy_Elm.js +0 -2
- package/dist/packem_shared/glob-D_7bct6p-D8itOHsr.js +0 -1
- package/dist/packem_shared/index-BpbjpCNL.js +0 -1
- package/dist/packem_shared/index-DH-5hsrC.js +0 -1
- package/dist/packem_shared/index-Dc3ht2bL.js +0 -30
- package/dist/packem_shared/license-zZU7aavK.js +0 -1
- package/dist/packem_shared/lifecycle-DvVTL8nx.js +0 -2
- package/dist/packem_shared/lockfile-CedmXr44.js +0 -1
- package/dist/packem_shared/lockfile-Cu2BH6bl.js +0 -1
- package/dist/packem_shared/manifests-BzWpKW8F.js +0 -1
- package/dist/packem_shared/min-release-age-DKMW2N_v.js +0 -34
- package/dist/packem_shared/missing-package-json-DKAwoiWK.js +0 -1
- package/dist/packem_shared/native-config-sync-DBkJ-hsF.js +0 -21
- package/dist/packem_shared/osv-bloom-0Vu8YRhg.js +0 -2
- package/dist/packem_shared/otelPlugin-CJR2T_lk.js +0 -1
- package/dist/packem_shared/peer-warnings-EvSJ18gE.js +0 -1
- package/dist/packem_shared/pm-runner-DmKT2FqF.js +0 -1
- package/dist/packem_shared/provenance-Cu6VR1Hy.js +0 -1
- package/dist/packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js +0 -1
- package/dist/packem_shared/registry-keys-CuBAVdsk.js +0 -1
- package/dist/packem_shared/resolve-explicit-Xue0oq8V.js +0 -5
- package/dist/packem_shared/runtime-check-CilFOqUU.js +0 -1
- package/dist/packem_shared/s1ngularity-adnHbyTd.js +0 -1
- package/dist/packem_shared/scan-progress-lZdk5KJ-.js +0 -2
- package/dist/packem_shared/selectors-DkgYFzdq.js +0 -3
- package/dist/packem_shared/signatures-FGbYV5QE.js +0 -2
- package/dist/packem_shared/spinner-0acw5pd_.js +0 -1
- package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +0 -1
- package/dist/packem_shared/symbols-CQmER5MT.js +0 -1
- package/dist/packem_shared/tabs-zUSdR1HI.js +0 -1
- package/dist/packem_shared/toolchain-DoG6b_G_.js +0 -5
- package/dist/packem_shared/typosquats-acxQ7blw.js +0 -1
- package/dist/packem_shared/use-measured-height-DyCBfLtu.js +0 -1
- package/dist/packem_shared/utils-DrNg0XTR.js +0 -1
- package/dist/packem_shared/verify-BYzxSKWD.js +0 -1
- package/dist/packem_shared/vis-update-app-D0QyGneK.js +0 -1
- package/dist/packem_shared/watch-DEL0yol9.js +0 -1
- package/dist/packem_shared/watch-loop-jmQQl2Qe.js +0 -11
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var lr=Object.defineProperty;var f=(e,t)=>lr(e,"name",{value:t,configurable:!0});import{createRequire as dr}from"node:module";import{p as fr}from"../packem_shared/giget-CcEy_Elm.js";const ur=dr(import.meta.url),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=f(e=>{if(typeof Me<"u"&&Me.versions&&Me.versions.node){const[t,i]=Me.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return Me.getBuiltinModule(e)}return ur(e)},"__cjs_getBuiltinModule"),d=N("node:fs"),cr=N("node:fs/promises"),As=N("node:stream"),p=N("node:path"),{posix:ve,basename:mr,join:Ds,win32:pr}=p,Ns=N("events"),{EventEmitter:yr}=Ns,b=N("fs"),{EventEmitter:Pi}=N("node:events"),{StringDecoder:br}=N("node:string_decoder"),rt=N("path"),{parse:Er,dirname:gr}=rt,pi=N("assert"),{Buffer:we}=N("buffer"),Xi=N("zlib"),qi={...Xi,default:Xi},wr=N("zlib"),Rr=N("node:assert"),{randomBytes:Is}=N("node:crypto");var _r=Object.defineProperty,o=f((e,t)=>_r(e,"name",{value:t,configurable:!0}),"o"),rn=fr({Header:o(()=>le,"Header"),Pack:o(()=>ot,"Pack"),PackJob:o(()=>ki,"PackJob"),PackSync:o(()=>Ut,"PackSync"),Parser:o(()=>Ie,"Parser"),Pax:o(()=>ht,"Pax"),ReadEntry:o(()=>Zi,"ReadEntry"),Unpack:o(()=>Ft,"Unpack"),UnpackSync:o(()=>Mi,"UnpackSync"),WriteEntry:o(()=>Yi,"WriteEntry"),WriteEntrySync:o(()=>Gs,"WriteEntrySync"),WriteEntryTar:o(()=>$s,"WriteEntryTar"),c:o(()=>bs,"c"),create:o(()=>bs,"create"),extract:o(()=>xs,"extract"),filesFilter:o(()=>Wi,"filesFilter"),list:o(()=>Ce,"list"),r:o(()=>ge,"r"),replace:o(()=>ge,"replace"),t:o(()=>Ce,"t"),types:o(()=>js,"types"),x:o(()=>xs,"x")}),Sr=Object.defineProperty,vr=o((e,t)=>{for(var i in t)Sr(e,i,{get:t[i],enumerable:!0})},"ue"),Ji=process||{stdout:null,stderr:null},Or=o(e=>!!e&&typeof e=="object"&&(e instanceof Se||e instanceof As||Tr(e)||kr(e)),"fe"),Tr=o(e=>!!e&&typeof e=="object"&&e instanceof Pi&&typeof e.pipe=="function"&&e.pipe!==As.Writable.prototype.pipe,"pe"),kr=o(e=>!!e&&typeof e=="object"&&e instanceof Pi&&typeof e.write=="function"&&typeof e.end=="function","me"),$=Symbol("EOF"),Y=Symbol("maybeEmitEnd"),J=Symbol("emittedEnd"),at=Symbol("emittingEnd"),Pe=Symbol("emittedError"),lt=Symbol("closed"),Qi=Symbol("read"),dt=Symbol("flush"),es=Symbol("flushChunk"),C=Symbol("encoding"),Oe=Symbol("decoder"),v=Symbol("flowing"),ze=Symbol("paused"),xe=Symbol("resume"),O=Symbol("buffer"),D=Symbol("pipes"),T=Symbol("bufferLength"),Ht=Symbol("bufferPush"),ut=Symbol("bufferShift"),A=Symbol("objectMode"),R=Symbol("destroyed"),Zt=Symbol("error"),Wt=Symbol("emitData"),ts=Symbol("emitEnd"),Gt=Symbol("emitEnd2"),j=Symbol("async"),$t=Symbol("abort"),ft=Symbol("aborted"),Ue=Symbol("signal"),de=Symbol("dataListeners"),I=Symbol("discarded"),je=o(e=>Promise.resolve().then(e),"Pe"),Lr=o(e=>e(),"Fe"),xr=o(e=>e==="end"||e==="finish"||e==="prefinish","Ie"),Ar=o(e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,"Le"),Dr=o(e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),"Re"),Bs=class{static{f(this,"As")}static{o(this,"ze")}src;dest;opts;ondrain;constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[xe](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Nr=class extends Bs{static{f(this,"Sr")}static{o(this,"Be")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=s=>this.dest.emit("error",s),e.on("error",this.proxyErrors)}},Ir=o(e=>!!e.objectMode,"Ve"),Br=o(e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer","He"),Se=class extends Pi{static{f(this,"Rt")}static{o(this,"Ue")}[v]=!1;[ze]=!1;[D]=[];[O]=[];[A];[C];[j];[Oe];[$]=!1;[J]=!1;[at]=!1;[lt]=!1;[Pe]=null;[T]=0;[R]=!1;[Ue];[ft]=!1;[de]=0;[I]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");Ir(t)?(this[A]=!0,this[C]=null):Br(t)?(this[C]=t.encoding,this[A]=!1):(this[A]=!1,this[C]=null),this[j]=!!t.async,this[Oe]=this[C]?new br(this[C]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[O],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[D],"get")});let{signal:i}=t;i&&(this[Ue]=i,i.aborted?this[$t]():i.addEventListener("abort",()=>this[$t]()))}get bufferLength(){return this[T]}get encoding(){return this[C]}set encoding(e){throw Error("Encoding must be set at instantiation time")}setEncoding(e){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[A]}set objectMode(e){throw Error("objectMode must be set at instantiation time")}get async(){return this[j]}set async(e){this[j]=this[j]||!!e}[$t](){this[ft]=!0,this.emit("abort",this[Ue]?.reason),this.destroy(this[Ue]?.reason)}get aborted(){return this[ft]}set aborted(e){}write(e,t,i){if(this[ft])return!1;if(this[$])throw Error("write after end");if(this[R])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||="utf8";let s=this[j]?je:Lr;if(!this[A]&&!Buffer.isBuffer(e)){if(Dr(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Ar(e))e=Buffer.from(e);else if(typeof e!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[A]?(this[v]&&this[T]!==0&&this[dt](!0),this[v]?this.emit("data",e):this[Ht](e),this[T]!==0&&this.emit("readable"),i&&s(i),this[v]):e.length?(typeof e=="string"&&!(t===this[C]&&!this[Oe]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[C]&&(e=this[Oe].write(e)),this[v]&&this[T]!==0&&this[dt](!0),this[v]?this.emit("data",e):this[Ht](e),this[T]!==0&&this.emit("readable"),i&&s(i),this[v]):(this[T]!==0&&this.emit("readable"),i&&s(i),this[v])}read(e){if(this[R])return null;if(this[I]=!1,this[T]===0||e===0||e&&e>this[T])return this[Y](),null;this[A]&&(e=null),this[O].length>1&&!this[A]&&(this[O]=[this[C]?this[O].join(""):Buffer.concat(this[O],this[T])]);let t=this[Qi](e||null,this[O][0]);return this[Y](),t}[Qi](e,t){if(this[A])this[ut]();else{let i=t;e===i.length||e===null?this[ut]():typeof i=="string"?(this[O][0]=i.slice(e),t=i.slice(0,e),this[T]-=e):(this[O][0]=i.subarray(e),t=i.subarray(0,e),this[T]-=e)}return this.emit("data",t),!this[O].length&&!this[$]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t="utf8"),e!==void 0&&this.write(e,t),i&&this.once("end",i),this[$]=!0,this.writable=!1,(this[v]||!this[ze])&&this[Y](),this}[xe](){this[R]||(!this[de]&&!this[D].length&&(this[I]=!0),this[ze]=!1,this[v]=!0,this.emit("resume"),this[O].length?this[dt]():this[$]?this[Y]():this.emit("drain"))}resume(){return this[xe]()}pause(){this[v]=!1,this[ze]=!0,this[I]=!1}get destroyed(){return this[R]}get flowing(){return this[v]}get paused(){return this[ze]}[Ht](e){this[A]?this[T]+=1:this[T]+=e.length,this[O].push(e)}[ut](){return this[A]?--this[T]:this[T]-=this[O][0].length,this[O].shift()}[dt](e=!1){do;while(this[es](this[ut]())&&this[O].length);!e&&!this[O].length&&!this[$]&&this.emit("drain")}[es](e){return this.emit("data",e),this[v]}pipe(e,t){if(this[R])return e;this[I]=!1;let i=this[J];return t||={},e===Ji.stdout||e===Ji.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this[D].push(t.proxyErrors?new Nr(this,e,t):new Bs(this,e,t)),this[j]?je(()=>this[xe]()):this[xe]()),e}unpipe(e){let t=this[D].find(i=>i.dest===e);t&&(this[D].length===1?(this[v]&&this[de]===0&&(this[v]=!1),this[D]=[]):this[D].splice(this[D].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);if(e==="data")this[I]=!1,this[de]++,!this[D].length&&!this[v]&&this[xe]();else if(e==="readable"&&this[T]!==0)super.emit("readable");else if(xr(e)&&this[J])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Pe]){let s=t;this[j]?je(()=>s.call(this,this[Pe])):s.call(this,this[Pe])}return i}removeListener(e,t){return this.off(e,t)}off(e,t){let i=super.off(e,t);return e==="data"&&(this[de]=this.listeners("data").length,this[de]===0&&!this[I]&&!this[D].length&&(this[v]=!1)),i}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[de]=0,!this[I]&&!this[D].length&&(this[v]=!1)),t}get emittedEnd(){return this[J]}[Y](){!this[at]&&!this[J]&&!this[R]&&this[O].length===0&&this[$]&&(this[at]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[lt]&&this.emit("close"),this[at]=!1)}emit(e,...t){let i=t[0];if(e!=="error"&&e!=="close"&&e!==R&&this[R])return!1;if(e==="data")return!this[A]&&!i?!1:this[j]?(je(()=>this[Wt](i)),!0):this[Wt](i);if(e==="end")return this[ts]();if(e==="close"){if(this[lt]=!0,!this[J]&&!this[R])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[Pe]=i,super.emit(Zt,i);let r=!this[Ue]||this.listeners("error").length?super.emit("error",i):!1;return this[Y](),r}else if(e==="resume"){let r=super.emit("resume");return this[Y](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let s=super.emit(e,...t);return this[Y](),s}[Wt](e){for(let i of this[D])i.dest.write(e)===!1&&this.pause();let t=this[I]?!1:super.emit("data",e);return this[Y](),t}[ts](){return this[J]?!1:(this[J]=!0,this.readable=!1,this[j]?(je(()=>this[Gt]()),!0):this[Gt]())}[Gt](){if(this[Oe]){let t=this[Oe].end();if(t){for(let i of this[D])i.dest.write(t);this[I]||super.emit("data",t)}}for(let t of this[D])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[A]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[A]||(e.dataLength+=i.length)}),await t,e}async concat(){if(this[A])throw Error("cannot concat in objectMode");let e=await this.collect();return this[C]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(R,()=>t(Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[I]=!1;let e=!1,t=o(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"t");return{next:o(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[$])return t();let s,r,h=o(u=>{this.off("data",n),this.off("end",a),this.off(R,l),t(),r(u)},"a"),n=o(u=>{this.off("error",h),this.off("end",a),this.off(R,l),this.pause(),s({value:u,done:!!this[$]})},"o"),a=o(()=>{this.off("error",h),this.off("data",n),this.off(R,l),t(),s({done:!0,value:void 0})},"s"),l=o(()=>h(Error("stream destroyed")),"c");return new Promise((u,m)=>{r=m,s=u,this.once(R,l),this.once("error",h),this.once("end",a),this.once("data",n)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[I]=!1;let e=!1,t=o(()=>(this.pause(),this.off(Zt,t),this.off(R,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"t");return this.once("end",t),this.once(Zt,t),this.once(R,t),{next:o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next"),throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[R])return e?this.emit("error",e):this.emit(R),this;this[R]=!0,this[I]=!0,this[O].length=0,this[T]=0;let t=this;return typeof t.close=="function"&&!this[lt]&&t.close(),e?this.emit("error",e):this.emit(R),this}static get isStream(){return Or}},Fr=b.writev,oe=Symbol("_autoClose"),U=Symbol("_close"),He=Symbol("_ended"),y=Symbol("_fd"),Yt=Symbol("_finished"),q=Symbol("_flags"),Vt=Symbol("_flush"),yi=Symbol("_handleChunk"),bi=Symbol("_makeBuf"),qe=Symbol("_mode"),ct=Symbol("_needDrain"),Be=Symbol("_onerror"),Fe=Symbol("_onopen"),Kt=Symbol("_onread"),Ae=Symbol("_onwrite"),ae=Symbol("_open"),z=Symbol("_path"),ie=Symbol("_pos"),H=Symbol("_queue"),De=Symbol("_read"),Xt=Symbol("_readSize"),X=Symbol("_reading"),Ze=Symbol("_remain"),qt=Symbol("_size"),_t=Symbol("_write"),ue=Symbol("_writing"),St=Symbol("_defaultFlag"),Re=Symbol("_errored"),zi=class extends Se{static{f(this,"Ce")}static{o(this,"dt")}[Re]=!1;[y];[z];[Xt];[X]=!1;[qt];[Ze];[oe];constructor(e,t){if(t||={},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw TypeError("path must be a string");this[Re]=!1,this[y]=typeof t.fd=="number"?t.fd:void 0,this[z]=e,this[Xt]=t.readSize||16*1024*1024,this[X]=!1,this[qt]=typeof t.size=="number"?t.size:1/0,this[Ze]=this[qt],this[oe]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[y]=="number"?this[De]():this[ae]()}get fd(){return this[y]}get path(){return this[z]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[ae](){b.open(this[z],"r",(e,t)=>this[Fe](e,t))}[Fe](e,t){e?this[Be](e):(this[y]=t,this.emit("open",t),this[De]())}[bi](){return Buffer.allocUnsafe(Math.min(this[Xt],this[Ze]))}[De](){if(!this[X]){this[X]=!0;let e=this[bi]();if(e.length===0)return process.nextTick(()=>this[Kt](null,0,e));b.read(this[y],e,0,e.length,null,(t,i,s)=>this[Kt](t,i,s))}}[Kt](e,t,i){this[X]=!1,e?this[Be](e):this[yi](t,i)&&this[De]()}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Be](e){this[X]=!0,this[U](),this.emit("error",e)}[yi](e,t){let i=!1;return this[Ze]-=e,e>0&&(i=super.write(e<t.length?t.subarray(0,e):t)),(e===0||this[Ze]<=0)&&(i=!1,this[U](),super.end()),i}emit(e,...t){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[y]=="number"&&this[De](),!1;case"error":return this[Re]?!1:(this[Re]=!0,super.emit(e,...t));default:return super.emit(e,...t)}}},Cr=class extends zi{static{f(this,"kr")}static{o(this,"ft")}[ae](){let e=!0;try{this[Fe](null,b.openSync(this[z],"r")),e=!1}finally{e&&this[U]()}}[De](){let e=!0;try{if(!this[X]){this[X]=!0;do{let t=this[bi](),i=t.length===0?0:b.readSync(this[y],t,0,t.length,null);if(!this[yi](i,t))break}while(!0);this[X]=!1}e=!1}finally{e&&this[U]()}}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.closeSync(e),this.emit("close")}}},Ct=class extends Ns{static{f(this,"Ii")}static{o(this,"pt")}readable=!1;writable=!0;[Re]=!1;[ue]=!1;[He]=!1;[H]=[];[ct]=!1;[z];[qe];[oe];[y];[St];[q];[Yt]=!1;[ie];constructor(e,t){t||={},super(t),this[z]=e,this[y]=typeof t.fd=="number"?t.fd:void 0,this[qe]=t.mode===void 0?438:t.mode,this[ie]=typeof t.start=="number"?t.start:void 0,this[oe]=typeof t.autoClose=="boolean"?t.autoClose:!0;let i=this[ie]===void 0?"w":"r+";this[St]=t.flags===void 0,this[q]=t.flags===void 0?i:t.flags,this[y]===void 0&&this[ae]()}emit(e,...t){if(e==="error"){if(this[Re])return!1;this[Re]=!0}return super.emit(e,...t)}get fd(){return this[y]}get path(){return this[z]}[Be](e){this[U](),this[ue]=!0,this.emit("error",e)}[ae](){b.open(this[z],this[q],this[qe],(e,t)=>this[Fe](e,t))}[Fe](e,t){this[St]&&this[q]==="r+"&&e&&e.code==="ENOENT"?(this[q]="w",this[ae]()):e?this[Be](e):(this[y]=t,this.emit("open",t),this[ue]||this[Vt]())}end(e,t){return e&&this.write(e,t),this[He]=!0,!this[ue]&&!this[H].length&&typeof this[y]=="number"&&this[Ae](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[He]?(this.emit("error",Error("write() after end()")),!1):this[y]===void 0||this[ue]||this[H].length?(this[H].push(e),this[ct]=!0,!1):(this[ue]=!0,this[_t](e),!0)}[_t](e){b.write(this[y],e,0,e.length,this[ie],(t,i)=>this[Ae](t,i))}[Ae](e,t){e?this[Be](e):(this[ie]!==void 0&&typeof t=="number"&&(this[ie]+=t),this[H].length?this[Vt]():(this[ue]=!1,this[He]&&!this[Yt]?(this[Yt]=!0,this[U](),this.emit("finish")):this[ct]&&(this[ct]=!1,this.emit("drain"))))}[Vt](){if(this[H].length===0)this[He]&&this[Ae](null,0);else if(this[H].length===1)this[_t](this[H].pop());else{let e=this[H];this[H]=[],Fr(this[y],e,this[ie],(t,i)=>this[Ae](t,i))}}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},Fs=class extends Ct{static{f(this,"Ds")}static{o(this,"mt")}[ae](){let e;if(this[St]&&this[q]==="r+")try{e=b.openSync(this[z],this[q],this[qe])}catch(t){if(t?.code==="ENOENT")return this[q]="w",this[ae]();throw t}else e=b.openSync(this[z],this[q],this[qe]);this[Fe](null,e)}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.closeSync(e),this.emit("close")}}[_t](e){let t=!0;try{this[Ae](null,b.writeSync(this[y],e,0,e.length,this[ie])),t=!1}finally{if(t)try{this[U]()}catch{}}}},Mr=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"]]),Pr=o(e=>!!e.sync&&!!e.file,"gt"),zr=o(e=>!e.sync&&!!e.file,"_t"),Ur=o(e=>!!e.sync&&!e.file,"vt"),jr=o(e=>!e.sync&&!e.file,"yt"),Hr=o(e=>!!e.file,"bt"),Zr=o(e=>Mr.get(e)||e,"xt"),Ui=o((e={})=>{if(!e)return{};let t={};for(let[i,s]of Object.entries(e)){let r=Zr(i);t[r]=s}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t},"St"),nt=o((e,t,i,s,r)=>Object.assign((h=[],n,a)=>{Array.isArray(h)&&(n=h,h={}),typeof n=="function"&&(a=n,n=void 0),n=n?Array.from(n):[];let l=Ui(h);if(r?.(l,n),Pr(l)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return e(l,n)}else if(zr(l)){let u=t(l,n);return a?u.then(()=>a(),a):u}else if(Ur(l)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return i(l,n)}else if(jr(l)){if(typeof a=="function")throw TypeError("callback only supported with file option");return s(l,n)}throw Error("impossible options??")},{syncFile:e,asyncFile:t,syncNoFile:i,asyncNoFile:s,validate:r}),"Ct"),Wr=wr.constants||{ZLIB_VERNUM:4736},G=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},Wr)),Gr=we.concat,is=Object.getOwnPropertyDescriptor(we,"concat"),$r=o(e=>e,"Dt"),Jt=is?.writable===!0||is?.set!==void 0?e=>{we.concat=e?$r:Gr}:e=>{},_e=Symbol("_superWrite"),mt=class extends Error{static{f(this,"di")}static{o(this,"At")}code;errno;constructor(e,t){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||="ZLIB_ERROR",this.message="zlib: "+e.message,Error.captureStackTrace(this,t??this.constructor)}get name(){return"ZlibError"}},Qt=Symbol("flushFlag"),ji=class extends Se{static{f(this,"Pe")}static{o(this,"Mt")}#e=!1;#i=!1;#s;#h;#r;#t;#n;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#s}constructor(e,t){if(!e||typeof e!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(e),this.#s=e.flush??0,this.#h=e.finishFlush??0,this.#r=e.fullFlushFlag??0,typeof qi[t]!="function")throw TypeError("Compression method not supported: "+t);try{this.#t=new qi[t](e)}catch(i){throw new mt(i,this.constructor)}this.#n=i=>{this.#e||(this.#e=!0,this.close(),this.emit("error",i))},this.#t?.on("error",i=>this.#n(new mt(i))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return pi(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#r),this.write(Object.assign(we.alloc(0),{[Qt]:e})))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#h),this.#i=!0,super.end(i)}get ended(){return this.#i}[_e](e){return super.write(e)}write(e,t,i){if(typeof t=="function"&&(i=t,t="utf8"),typeof e=="string"&&(e=we.from(e,t)),this.#e)return;pi(this.#t,"zlib binding closed");let s=this.#t._handle,r=s.close;s.close=()=>{};let h=this.#t.close;this.#t.close=()=>{},Jt(!0);let n;try{let l=typeof e[Qt]=="number"?e[Qt]:this.#s;n=this.#t._processChunk(e,l),Jt(!1)}catch(l){Jt(!1),this.#n(new mt(l,this.write))}finally{this.#t&&(this.#t._handle=s,s.close=r,this.#t.close=h,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",l=>this.#n(new mt(l,this.write)));let a;if(n)if(Array.isArray(n)&&n.length>0){let l=n[0];a=this[_e](we.from(l));for(let u=1;u<n.length;u++)a=this[_e](n[u])}else a=this[_e](we.from(n));return i&&i(),a}},Cs=class extends ji{static{f(this,"xs")}static{o(this,"Nt")}#e;#i;constructor(e,t){e||={},e.flush=e.flush||G.Z_NO_FLUSH,e.finishFlush=e.finishFlush||G.Z_FINISH,e.fullFlushFlag=G.Z_FULL_FLUSH,super(e,t),this.#e=e.level,this.#i=e.strategy}params(e,t){if(!this.sawError){if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#e!==e||this.#i!==t){this.flush(G.Z_SYNC_FLUSH),pi(this.handle,"zlib binding closed");let i=this.handle.flush;this.handle.flush=(s,r)=>{typeof s=="function"&&(r=s,s=this.flushFlag),this.flush(s),r?.()};try{this.handle.params(e,t)}finally{this.handle.flush=i}this.handle&&(this.#e=e,this.#i=t)}}}},Yr=class extends Cs{static{f(this,"Pr")}static{o(this,"Pt")}#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[_e](e){return this.#e?(this.#e=!1,e[9]=255,super[_e](e)):super[_e](e)}},Vr=class extends Cs{static{f(this,"zr")}static{o(this,"Ft")}constructor(e){super(e,"Unzip")}},Ms=class extends ji{static{f(this,"Ns")}static{o(this,"It")}constructor(e,t){e||={},e.flush=e.flush||G.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||G.BROTLI_OPERATION_FINISH,e.fullFlushFlag=G.BROTLI_OPERATION_FLUSH,super(e,t)}},Kr=class extends Ms{static{f(this,"Ur")}static{o(this,"Lt")}constructor(e){super(e,"BrotliCompress")}},Xr=class extends Ms{static{f(this,"jr")}static{o(this,"Rt")}constructor(e){super(e,"BrotliDecompress")}},Ps=class extends ji{static{f(this,"Is")}static{o(this,"zt")}constructor(e,t){e||={},e.flush=e.flush||G.ZSTD_e_continue,e.finishFlush=e.finishFlush||G.ZSTD_e_end,e.fullFlushFlag=G.ZSTD_e_flush,super(e,t)}},qr=class extends Ps{static{f(this,"Hr")}static{o(this,"Bt")}constructor(e){super(e,"ZstdCompress")}},Jr=class extends Ps{static{f(this,"Zr")}static{o(this,"Vt")}constructor(e){super(e,"ZstdDecompress")}},Qr=o((e,t)=>{if(Number.isSafeInteger(e))e<0?th(e,t):eh(e,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},"Ht"),eh=o((e,t)=>{t[0]=128;for(var i=t.length;i>1;i--)t[i-1]=e&255,e=Math.floor(e/256)},"Ut"),th=o((e,t)=>{t[0]=255;var i=!1;e*=-1;for(var s=t.length;s>1;s--){var r=e&255;e=Math.floor(e/256),i?t[s-1]=zs(r):r===0?t[s-1]=0:(i=!0,t[s-1]=Us(r))}},"Wt"),ih=o(e=>{let t=e[0],i=t===128?rh(e.subarray(1,e.length)):t===255?sh(e):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},"Gt"),sh=o(e=>{for(var t=e.length,i=0,s=!1,r=t-1;r>-1;r--){var h=Number(e[r]),n;s?n=zs(h):h===0?n=h:(s=!0,n=Us(h)),n!==0&&(i-=n*256**(t-r-1))}return i},"Kt"),rh=o(e=>{for(var t=e.length,i=0,s=t-1;s>-1;s--){var r=Number(e[s]);r!==0&&(i+=r*256**(t-s-1))}return i},"qt"),zs=o(e=>(255^e)&255,"Jt"),Us=o(e=>(255^e)+1&255,"Yt"),js={};vr(js,{code:o(()=>Hi,"code"),isCode:o(()=>vt,"isCode"),isName:o(()=>hh,"isName"),name:o(()=>Mt,"name")});var vt=o(e=>Mt.has(e),"Zt"),hh=o(e=>Hi.has(e),"Qt"),Mt=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"]]),Hi=new Map(Array.from(Mt).map(e=>[e[1],e[0]])),le=class{static{f(this,"ot")}static{o(this,"I")}cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,i,s){Buffer.isBuffer(e)?this.decode(e,t||0,i,s):e&&this.#i(e)}decode(e,t,i,s){if(t||=0,!e||!(e.length>=t+512))throw Error("need 512 bytes for header");this.path=i?.path??fe(e,t,100),this.mode=i?.mode??s?.mode??se(e,t+100,8),this.uid=i?.uid??s?.uid??se(e,t+108,8),this.gid=i?.gid??s?.gid??se(e,t+116,8),this.size=i?.size??s?.size??se(e,t+124,12),this.mtime=i?.mtime??s?.mtime??ei(e,t+136,12),this.cksum=se(e,t+148,12),s&&this.#i(s,!0),i&&this.#i(i);let r=fe(e,t+156,1);if(vt(r)&&(this.#e=r||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=fe(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=i?.uname??s?.uname??fe(e,t+265,32),this.gname=i?.gname??s?.gname??fe(e,t+297,32),this.devmaj=i?.devmaj??s?.devmaj??se(e,t+329,8)??0,this.devmin=i?.devmin??s?.devmin??se(e,t+337,8)??0,e[t+475]!==0)this.path=fe(e,t+345,155)+"/"+this.path;else{let n=fe(e,t+345,130);n&&(this.path=n+"/"+this.path),this.atime=i?.atime??s?.atime??ei(e,t+476,12),this.ctime=i?.ctime??s?.ctime??ei(e,t+488,12)}let h=256;for(let n=t;n<t+148;n++)h+=e[n];for(let n=t+156;n<t+512;n++)h+=e[n];this.cksumValid=h===this.cksum,this.cksum===void 0&&h===256&&(this.nullBlock=!0)}#i(e,t=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,s])=>!(s==null||i==="path"&&t||i==="linkpath"&&t||i==="global"))))}encode(e,t=0){if(e||=this.block=Buffer.alloc(512),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,s=nh(this.path||"",i),r=s[0],h=s[1];this.needPax=!!s[2],this.needPax=ce(e,t,100,r)||this.needPax,this.needPax=re(e,t+100,8,this.mode)||this.needPax,this.needPax=re(e,t+108,8,this.uid)||this.needPax,this.needPax=re(e,t+116,8,this.gid)||this.needPax,this.needPax=re(e,t+124,12,this.size)||this.needPax,this.needPax=ti(e,t+136,12,this.mtime)||this.needPax,e[t+156]=Number(this.#e.codePointAt(0)),this.needPax=ce(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=ce(e,t+265,32,this.uname)||this.needPax,this.needPax=ce(e,t+297,32,this.gname)||this.needPax,this.needPax=re(e,t+329,8,this.devmaj)||this.needPax,this.needPax=re(e,t+337,8,this.devmin)||this.needPax,this.needPax=ce(e,t+345,i,h)||this.needPax,e[t+475]===0?(this.needPax=ce(e,t+345,130,h)||this.needPax,this.needPax=ti(e,t+476,12,this.atime)||this.needPax,this.needPax=ti(e,t+488,12,this.ctime)||this.needPax):this.needPax=ce(e,t+345,155,h)||this.needPax;let n=256;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return this.cksum=n,re(e,t+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:Mt.get(this.#e)}get typeKey(){return this.#e}set type(e){let t=String(Hi.get(e));if(vt(t)||t==="Unsupported")this.#e=t;else if(vt(e))this.#e=e;else throw TypeError("invalid entry type: "+e)}},nh=o((e,t)=>{let i=e,s="",r,h=ve.parse(e).root||".";if(Buffer.byteLength(i)<100)r=[i,s,!1];else{s=ve.dirname(i),i=ve.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(s)<=t?r=[i,s,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(s)<=t?r=[i.slice(0,99),s,!0]:(i=ve.join(ve.basename(s),i),s=ve.dirname(s));while(s!==h&&r===void 0);r||=[e.slice(0,99),"",!0]}return r},"tn"),fe=o((e,t,i)=>e.subarray(t,t+i).toString("utf8").replace(/\0.*/,""),"nn"),ei=o((e,t,i)=>oh(se(e,t,i)),"rn"),oh=o(e=>e===void 0?void 0:new Date(e*1e3),"an"),se=o((e,t,i)=>Number(e[t])&128?ih(e.subarray(t,t+i)):lh(e,t,i),"L"),ah=o(e=>isNaN(e)?void 0:e,"on"),lh=o((e,t,i)=>ah(parseInt(e.subarray(t,t+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),"sn"),dh={12:8589934591,8:2097151},re=o((e,t,i,s)=>s===void 0?!1:s>dh[i]||s<0?(Qr(s,e.subarray(t,t+i)),!0):(uh(e,t,i,s),!1),"R"),uh=o((e,t,i,s)=>e.write(fh(s,i),t,i,"ascii"),"ln"),fh=o((e,t)=>ch(Math.floor(e).toString(8),t),"un"),ch=o((e,t)=>(e.length===t-1?e:Array(t-e.length-1).join("0")+e+" ")+"\0","dn"),ti=o((e,t,i,s)=>s===void 0?!1:re(e,t,i,s.getTime()/1e3),"fn"),mh=Array(156).join("\0"),ce=o((e,t,i,s)=>s===void 0?!1:(e.write(s+mh,t,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),"mn"),ht=class Hs{static{f(this,"Ms")}static{o(this,"e")}atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,i=!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=i,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(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(t),s=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(s);for(let h=0;h<512;h++)r[h]=0;new le({path:("PaxHeader/"+mr(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,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(r),r.write(t,512,i,"utf8");for(let h=i+512;h<r.length;h++)r[h]=0;return r}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(this[t]===void 0)return"";let i=this[t],s=i instanceof Date?i.getTime()/1e3:i,r=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+s+`
|
|
2
|
-
`,h=Buffer.byteLength(r),n=Math.floor(Math.log(h)/Math.log(10))+1;return h+n>=10**n&&(n+=1),n+h+r}static parse(t,i,s=!1){return new
|
|
3
|
-
`).reduce(bh,Object.create(null)),"_n"),bh=o((e,t)=>{let i=parseInt(t,10);if(i!==Buffer.byteLength(t)+1)return e;t=t.slice((i+" ").length);let s=t.split("="),r=s.shift();if(!r)return e;let h=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),n=s.join("=");return e[h]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(h)?new Date(Number(n)*1e3):/^[0-9]+$/.test(n)?+n:n,e},"vn"),c=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32"?e=>e&&e.replaceAll(/\\/g,"/"):e=>e,Zi=class extends Se{static{f(this,"Ue")}static{o(this,"yn")}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(e,t,i){switch(super({}),this.pause(),this.extended=t,this.globalExtended=i,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.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(!e.path)throw Error("no path provided for tar.ReadEntry");this.path=c(e.path),this.mode=e.mode,this.mode&&(this.mode&=4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?c(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),i&&this.#e(i,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw Error("writing more to entry than is appropriate");let i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-t),this.blockRemain=Math.max(0,s-t),this.ignore?!0:i>=t?super.write(e):super.write(e.subarray(0,i))}#e(e,t=!1){e.path&&=c(e.path),e.linkpath&&=c(e.linkpath),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,s])=>!(s==null||i==="path"&&t))))}},Pt=o((e,t,i,s={})=>{e.file&&(s.file=e.file),e.cwd&&(s.cwd=e.cwd),s.code=i instanceof Error&&i.code||t,s.tarCode=t,!e.strict&&s.recoverable!==!1?(i instanceof Error&&(s=Object.assign(i,s),i=i.message),e.emit("warn",t,i,s)):i instanceof Error?e.emit("error",Object.assign(i,s)):e.emit("error",Object.assign(Error(`${t}: ${i}`),s))},"bn"),Eh=1024*1024,Ei=Buffer.from([31,139]),gi=Buffer.from([40,181,47,253]),gh=Math.max(Ei.length,gi.length),B=Symbol("state"),me=Symbol("writeEntry"),V=Symbol("readEntry"),ii=Symbol("nextEntry"),ss=Symbol("processEntry"),Z=Symbol("extendedHeader"),We=Symbol("globalExtendedHeader"),Q=Symbol("meta"),rs=Symbol("emitMeta"),E=Symbol("buffer"),K=Symbol("queue"),ee=Symbol("ended"),si=Symbol("emittedEnd"),pe=Symbol("emit"),S=Symbol("unzip"),pt=Symbol("consumeChunk"),yt=Symbol("consumeChunkSub"),ri=Symbol("consumeBody"),hs=Symbol("consumeMeta"),ns=Symbol("consumeHeader"),Ge=Symbol("consuming"),hi=Symbol("bufferConcat"),bt=Symbol("maybeEnd"),Te=Symbol("writing"),te=Symbol("aborted"),Et=Symbol("onDone"),ye=Symbol("sawValidEntry"),gt=Symbol("sawNullBlock"),wt=Symbol("sawEOF"),os=Symbol("closeStream"),wh=o(()=>!0,"qn"),Ie=class extends yr{static{f(this,"xt")}static{o(this,"Jn")}file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[K]=[];[E];[V];[me];[B]="begin";[Q]="";[Z];[We];[ee]=!1;[S];[te]=!1;[ye];[gt]=!1;[wt]=!1;[Te]=!1;[Ge]=!1;[si]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(Et,()=>{(this[B]==="begin"||this[ye]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(Et,e.ondone):this.on(Et,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||Eh,this.filter=typeof e.filter=="function"?e.filter:wh;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:t?void 0:!1;let i=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:i?!0:void 0,this.on("end",()=>this[os]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,i={}){Pt(this,e,t,i)}[ns](e,t){this[ye]===void 0&&(this[ye]=!1);let i;try{i=new le(e,t,this[Z],this[We])}catch(s){return this.warn("TAR_ENTRY_INVALID",s)}if(i.nullBlock)this[gt]?(this[wt]=!0,this[B]==="begin"&&(this[B]="header"),this[pe]("eof")):(this[gt]=!0,this[pe]("nullBlock"));else if(this[gt]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let s=i.type;if(/^(Symbolic)?Link$/.test(s)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(s)&&!/^(Global)?ExtendedHeader$/.test(s)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let r=this[me]=new Zi(i,this[Z],this[We]);this[ye]||(r.remain?r.on("end",()=>{r.invalid||(this[ye]=!0)}):this[ye]=!0),r.meta?r.size>this.maxMetaEntrySize?(r.ignore=!0,this[pe]("ignoredEntry",r),this[B]="ignore",r.resume()):r.size>0&&(this[Q]="",r.on("data",h=>this[Q]+=h),this[B]="meta"):(this[Z]=void 0,r.ignore=r.ignore||!this.filter(r.path,r),r.ignore?(this[pe]("ignoredEntry",r),this[B]=r.remain?"ignore":"header",r.resume()):(r.remain?this[B]="body":(this[B]="header",r.end()),this[V]?this[K].push(r):(this[K].push(r),this[ii]())))}}}[os](){queueMicrotask(()=>this.emit("close"))}[ss](e){let t=!0;if(!e)this[V]=void 0,t=!1;else if(Array.isArray(e)){let[i,...s]=e;this.emit(i,...s)}else this[V]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[ii]()),t=!1);return t}[ii](){do;while(this[ss](this[K].shift()));if(this[K].length===0){let e=this[V];!e||e.flowing||e.size===e.remain?this[Te]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[ri](e,t){let i=this[me];if(!i)throw Error("attempt to consume body without entry??");let s=i.blockRemain??0,r=s>=e.length&&t===0?e:e.subarray(t,t+s);return i.write(r),i.blockRemain||(this[B]="header",this[me]=void 0,i.end()),r.length}[hs](e,t){let i=this[me],s=this[ri](e,t);return!this[me]&&i&&this[rs](i),s}[pe](e,t,i){this[K].length===0&&!this[V]?this.emit(e,t,i):this[K].push([e,t,i])}[rs](e){switch(this[pe]("meta",this[Q]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Z]=ht.parse(this[Q],this[Z],!1);break;case"GlobalExtendedHeader":this[We]=ht.parse(this[Q],this[We],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[Z]??Object.create(null);this[Z]=t,t.path=this[Q].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[Z]||Object.create(null);this[Z]=t,t.linkpath=this[Q].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+e.type)}}abort(e){this[te]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[te])return i?.(),!1;if((this[S]===void 0||this.brotli===void 0&&this[S]===!1)&&e){if(this[E]&&(e=Buffer.concat([this[E],e]),this[E]=void 0),e.length<gh)return this[E]=e,i?.(),!0;for(let n=0;this[S]===void 0&&n<Ei.length;n++)e[n]!==Ei[n]&&(this[S]=!1);let r=!1;if(this[S]===!1&&this.zstd!==!1){r=!0;for(let n=0;n<gi.length;n++)if(e[n]!==gi[n]){r=!1;break}}let h=this.brotli===void 0&&!r;if(this[S]===!1&&h)if(e.length<512)if(this[ee])this.brotli=!0;else return this[E]=e,i?.(),!0;else try{new le(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[S]===void 0||this[S]===!1&&(this.brotli||r)){let n=this[ee];this[ee]=!1,this[S]=this[S]===void 0?new Vr({}):r?new Jr({}):new Xr({}),this[S].on("data",l=>this[pt](l)),this[S].on("error",l=>this.abort(l)),this[S].on("end",()=>{this[ee]=!0,this[pt]()}),this[Te]=!0;let a=!!this[S][n?"end":"write"](e);return this[Te]=!1,i?.(),a}}this[Te]=!0,this[S]?this[S].write(e):this[pt](e),this[Te]=!1;let s=this[K].length>0?!1:this[V]?this[V].flowing:!0;return!s&&this[K].length===0&&this[V]?.once("drain",()=>this.emit("drain")),i?.(),s}[hi](e){e&&!this[te]&&(this[E]=this[E]?Buffer.concat([this[E],e]):e)}[bt](){if(this[ee]&&!this[si]&&!this[te]&&!this[Ge]){this[si]=!0;let e=this[me];if(e&&e.blockRemain){let t=this[E]?this[E].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[E]&&e.write(this[E]),e.end()}this[pe](Et)}}[pt](e){if(this[Ge]&&e)this[hi](e);else if(!e&&!this[E])this[bt]();else if(e){if(this[Ge]=!0,this[E]){this[hi](e);let t=this[E];this[E]=void 0,this[yt](t)}else this[yt](e);for(;this[E]&&this[E]?.length>=512&&!this[te]&&!this[wt];){let t=this[E];this[E]=void 0,this[yt](t)}this[Ge]=!1}(!this[E]||this[ee])&&this[bt]()}[yt](e){let t=0,i=e.length;for(;t+512<=i&&!this[te]&&!this[wt];)switch(this[B]){case"begin":case"header":this[ns](e,t),t+=512;break;case"ignore":case"body":t+=this[ri](e,t);break;case"meta":t+=this[hs](e,t);break;default:throw Error("invalid state: "+this[B])}t<i&&(this[E]=this[E]?Buffer.concat([e.subarray(t),this[E]]):e.subarray(t))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t)),i&&this.once("finish",i),this[te]||(this[S]?(e&&this[S].write(e),this[S].end()):(this[ee]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e||=Buffer.alloc(0)),e&&this.write(e),this[bt]())),this}},Je=o(e=>{let t=e.length-1,i=-1;for(;t>-1&&e.charAt(t)==="/";)i=t,t--;return i===-1?e:e.slice(0,i)},"Yn"),Rh=o(e=>{let t=e.onReadEntry;e.onReadEntry=t?i=>{t(i),i.resume()}:i=>i.resume()},"Xn"),Wi=o((e,t)=>{let i=new Map(t.map(h=>[Je(h),!0])),s=e.filter,r=o((h,n="")=>{let a=n||Er(h).root||".",l;if(h===a)l=!1;else{let u=i.get(h);l=u===void 0?r(gr(h),a):u}return i.set(h,l),l},"i");e.filter=s?(h,n)=>s(h,n)&&r(Je(h)):h=>r(Je(h))},"Zn"),Ce=nt(e=>{let t=new Ie(e),i=e.file,s;try{s=d.openSync(i,"r");let r=d.fstatSync(s),h=e.maxReadSize||16*1024*1024;if(r.size<h){let n=Buffer.allocUnsafe(r.size),a=d.readSync(s,n,0,r.size,0);t.end(a===n.byteLength?n:n.subarray(0,a))}else{let n=0,a=Buffer.allocUnsafe(h);for(;n<r.size;){let l=d.readSync(s,a,0,h,n);if(l===0)break;n+=l,t.write(a.subarray(0,l))}t.end()}}finally{if(typeof s=="number")try{d.closeSync(s)}catch{}}},(e,t)=>{let i=new Ie(e),s=e.maxReadSize||16*1024*1024,r=e.file;return new Promise((h,n)=>{i.on("error",n),i.on("end",h),d.stat(r,(a,l)=>{if(a)n(a);else{let u=new zi(r,{readSize:s,size:l.size});u.on("error",n),u.pipe(i)}})})},e=>new Ie(e),e=>new Ie(e),(e,t)=>{t?.length&&Wi(e,t),e.noResume||Rh(e)}),Zs=o((e,t,i)=>(e&=4095,i&&(e=(e|384)&-19),t&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),"$n"),{isAbsolute:_h,parse:as}=pr,Gi=o(e=>{let t="",i=as(e);for(;_h(e)||i.root;){let s=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":i.root;e=e.slice(s.length),t+=s,i=as(e)}return[t,e]},"nr"),zt=["|","<",">","?",":"],$i=zt.map(e=>String.fromCodePoint(61440+Number(e.codePointAt(0)))),Sh=new Map(zt.map((e,t)=>[e,$i[t]])),vh=new Map($i.map((e,t)=>[e,zt[t]])),ls=o(e=>zt.reduce((t,i)=>t.split(i).join(Sh.get(i)),e),"sr"),Oh=o(e=>$i.reduce((t,i)=>t.split(i).join(vh.get(i)),e),"cr"),Ws=o((e,t)=>t?(e=c(e).replace(/^\.(\/|$)/,""),Je(t)+"/"+e):c(e),"lr"),Th=16*1024*1024,ds=Symbol("process"),us=Symbol("file"),fs=Symbol("directory"),wi=Symbol("symlink"),cs=Symbol("hardlink"),$e=Symbol("header"),Ot=Symbol("read"),Ri=Symbol("lstat"),Tt=Symbol("onlstat"),_i=Symbol("onread"),Si=Symbol("onreadlink"),vi=Symbol("openfile"),Oi=Symbol("onopenfile"),he=Symbol("close"),It=Symbol("mode"),Ti=Symbol("awaitDrain"),ni=Symbol("ondrain"),W=Symbol("prefix"),Yi=class extends Se{static{f(this,"We")}static{o(this,"Dr")}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;#e=!1;constructor(e,t={}){let i=Ui(t);super(),this.path=c(e),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||Th,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=c(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?c(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){let[h,n]=Gi(this.path);h&&typeof n=="string"&&(this.path=n,s=h)}this.win32=!!i.win32||process.platform==="win32",this.win32&&(this.path=Oh(this.path.replaceAll(/\\/g,"/")),e=e.replaceAll(/\\/g,"/")),this.absolute=c(i.absolute||rt.resolve(this.cwd,e)),this.path===""&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});let r=this.statCache.get(this.absolute);r?this[Tt](r):this[Ri]()}warn(e,t,i={}){return Pt(this,e,t,i)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[Ri](){b.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Tt](t)})}[Tt](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=kh(e),this.emit("stat",e),this[ds]()}[ds](){switch(this.type){case"File":return this[us]();case"Directory":return this[fs]();case"SymbolicLink":return this[wi]();default:return this.end()}}[It](e){return Zs(e,this.type==="Directory",this.portable)}[W](e){return Ws(e,this.prefix)}[$e](){if(!this.stat)throw Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new le({path:this[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](this.linkpath):this.linkpath,mode:this[It](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:this.type==="Unsupported"?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 ht({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[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](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());let e=this.header?.block;if(!e)throw Error("failed to encode header");super.write(e)}[fs](){if(!this.stat)throw Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[$e](),this.end()}[wi](){b.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Si](t)})}[Si](e){this.linkpath=c(e),this[$e](),this.end()}[cs](e){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=c(rt.relative(this.cwd,e)),this.stat.size=0,this[$e](),this.end()}[us](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[cs](t);this.linkCache.set(e,this.absolute)}if(this[$e](),this.stat.size===0)return this.end();this[vi]()}[vi](){b.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[Oi](t)})}[Oi](e){if(this.fd=e,this.#e)return this[he]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Ot]()}[Ot](){let{fd:e,buf:t,offset:i,length:s,pos:r}=this;if(e===void 0||t===void 0)throw Error("cannot read file without first opening");b.read(e,t,i,s,r,(h,n)=>{if(h)return this[he](()=>this.emit("error",h));this[_i](n)})}[he](e=()=>{}){this.fd!==void 0&&b.close(this.fd,e)}[_i](e){if(e<=0&&this.remain>0){let i=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[he](()=>this.emit("error",i))}if(e>this.remain){let i=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[he](()=>this.emit("error",i))}if(!this.buf)throw Error("should have created buffer prior to reading");if(e===this.remain)for(let i=e;i<this.length&&e<this.blockRemain;i++)this.buf[i+this.offset]=0,e++,this.remain++;let t=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(t)?this[ni]():this[Ti](()=>this[ni]())}[Ti](e){this.once("drain",e)}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemain<e.length){let s=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",s)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,i)}[ni](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[he](e=>e?this.emit("error",e):this.end());if(!this.buf)throw 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[Ot]()}},Gs=class extends Yi{static{f(this,"Us")}static{o(this,"Or")}sync=!0;[Ri](){this[Tt](b.lstatSync(this.absolute))}[wi](){this[Si](b.readlinkSync(this.absolute))}[vi](){this[Oi](b.openSync(this.absolute,"r"))}[Ot](){let e=!0;try{let{fd:t,buf:i,offset:s,length:r,pos:h}=this;if(t===void 0||i===void 0)throw Error("fd and buf must be set in READ method");let n=b.readSync(t,i,s,r,h);this[_i](n),e=!1}finally{if(e)try{this[he](()=>{})}catch{}}}[Ti](e){e()}[he](e=()=>{}){this.fd!==void 0&&b.closeSync(this.fd),e()}},$s=class extends Se{static{f(this,"js")}static{o(this,"kr")}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(e,t,i={}){return Pt(this,e,t,i)}constructor(e,t={}){let i=Ui(t);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=e;let{type:s}=e;if(s==="Unsupported")throw Error("writing entry that should be ignored");this.type=s,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=c(e.path),this.mode=e.mode===void 0?void 0:this[It](e.mode),this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:i.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath===void 0?void 0:c(e.linkpath),typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){let[n,a]=Gi(this.path);n&&typeof a=="string"&&(this.path=a,r=n)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new le({path:this[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](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 ht({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[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](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());let h=this.header?.block;if(!h)throw Error("failed to encode header");super.write(h),e.pipe(this)}[W](e){return Ws(e,this.prefix)}[It](e){return Zs(e,this.type==="Directory",this.portable)}write(e,t,i){typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let s=e.length;if(s>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(e,i)}end(e,t,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),i&&this.once("finish",i),e?super.end(e,i):super.end(i),this}},kh=o(e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported","Ar"),Lh=class Ne{static{f(this,"Dt")}static{o(this,"e")}tail;head;length=0;static create(t=[]){return new Ne(t)}constructor(t=[]){for(let i of t)this.push(i)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw Error("removing node which does not belong to this list");let i=t.next,s=t.prev;return i&&(i.prev=s),s&&(s.next=i),t===this.head&&(this.head=i),t===this.tail&&(this.tail=s),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,i}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let i=this.head;t.list=this,t.next=i,i&&(i.prev=t),this.head=t,this.tail||=t,this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let i=this.tail;t.list=this,t.prev=i,i&&(i.next=t),this.tail=t,this.head||=t,this.length++}push(...t){for(let i=0,s=t.length;i<s;i++)Vs(this,t[i]);return this.length}unshift(...t){for(var i=0,s=t.length;i<s;i++)Ks(this,t[i]);return this.length}pop(){if(!this.tail)return;let t=this.tail.value,i=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,i.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,i=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,i.list=void 0,this.length--,t}forEach(t,i){i||=this;for(let s=this.head,r=0;s;r++)t.call(i,s.value,r,this),s=s.next}forEachReverse(t,i){i||=this;for(let s=this.tail,r=this.length-1;s;r--)t.call(i,s.value,r,this),s=s.prev}get(t){let i=0,s=this.head;for(;s&&i<t;i++)s=s.next;if(i===t&&s)return s.value}getReverse(t){let i=0,s=this.tail;for(;s&&i<t;i++)s=s.prev;if(i===t&&s)return s.value}map(t,i){i||=this;let s=new Ne;for(let r=this.head;r;)s.push(t.call(i,r.value,this)),r=r.next;return s}mapReverse(t,i){i||=this;var s=new Ne;for(let r=this.tail;r;)s.push(t.call(i,r.value,this)),r=r.prev;return s}reduce(t,i){let s,r=this.head;if(arguments.length>1)s=i;else if(this.head)r=this.head.next,s=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var h=0;r;h++)s=t(s,r.value,h),r=r.next;return s}reduceReverse(t,i){let s,r=this.tail;if(arguments.length>1)s=i;else if(this.tail)r=this.tail.prev,s=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let h=this.length-1;r;h--)s=t(s,r.value,h),r=r.prev;return s}toArray(){let t=Array(this.length);for(let i=0,s=this.head;s;i++)t[i]=s.value,s=s.next;return t}toArrayReverse(){let t=Array(this.length);for(let i=0,s=this.tail;s;i++)t[i]=s.value,s=s.prev;return t}slice(t=0,i=this.length){i<0&&(i+=this.length),t<0&&(t+=this.length);let s=new Ne;if(i<t||i<0)return s;t<0&&(t=0),i>this.length&&(i=this.length);let r=this.head,h=0;for(h=0;r&&h<t;h++)r=r.next;for(;r&&h<i;h++,r=r.next)s.push(r.value);return s}sliceReverse(t=0,i=this.length){i<0&&(i+=this.length),t<0&&(t+=this.length);let s=new Ne;if(i<t||i<0)return s;t<0&&(t=0),i>this.length&&(i=this.length);let r=this.length,h=this.tail;for(;h&&r>i;r--)h=h.prev;for(;h&&r>t;r--,h=h.prev)s.push(h.value);return s}splice(t,i=0,...s){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let r=this.head;for(let n=0;r&&n<t;n++)r=r.next;let h=[];for(let n=0;r&&n<i;n++)h.push(r.value),r=this.removeNode(r);r?r!==this.tail&&(r=r.prev):r=this.tail;for(let n of s)r=Ys(this,r,n);return h}reverse(){let t=this.head,i=this.tail;for(let s=t;s;s=s.prev){let r=s.prev;s.prev=s.next,s.next=r}return this.head=i,this.tail=t,this}};function Ys(e,t,i){let s=new Vi(i,t,t?t.next:e.head,e);return s.next===void 0&&(e.tail=s),s.prev===void 0&&(e.head=s),e.length++,s}f(Ys,"wh");o(Ys,"Mr");function Vs(e,t){e.tail=new Vi(t,e.tail,void 0,e),e.head||=e.tail,e.length++}f(Vs,"Rh");o(Vs,"Nr");function Ks(e,t){e.head=new Vi(t,void 0,e.head,e),e.tail||=e.head,e.length++}f(Ks,"_h");o(Ks,"Pr");var Vi=class{static{f(this,"Ge")}static{o(this,"Fr")}list;next;prev;value;constructor(e,t,i,s){this.list=s,this.value=e,t?(t.next=this,this.prev=t):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}},ki=class{static{f(this,"ve")}static{o(this,"Ir")}path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,t){this.path=e||"./",this.absolute=t}},ms=Buffer.alloc(1024),kt=Symbol("onStat"),Ye=Symbol("ended"),M=Symbol("queue"),be=Symbol("current"),Ee=Symbol("process"),Ve=Symbol("processing"),oi=Symbol("processJob"),P=Symbol("jobs"),ai=Symbol("jobDone"),Lt=Symbol("addFSEntry"),ps=Symbol("addTarEntry"),Li=Symbol("stat"),xi=Symbol("readdir"),xt=Symbol("onreaddir"),At=Symbol("pipe"),ys=Symbol("entry"),li=Symbol("entryOpt"),Dt=Symbol("writeEntryClass"),Xs=Symbol("write"),di=Symbol("ondrain"),ot=class extends Se{static{f(this,"si")}static{o(this,"ni")}sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Dt];onWriteEntry;[M];[P]=0;[Ve]=!1;[Ye]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=c(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[Dt]=Yi,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new Yr(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new Kr(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new qr(e.zstd)),!this.zip)throw Error("impossible");let t=this.zip;t.on("data",i=>super.write(i)),t.on("end",()=>super.end()),t.on("drain",()=>this[di]()),this.on("resume",()=>t.resume())}else this.on("drain",this[di]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[M]=new Lh,this[P]=0,this.jobs=Number(e.jobs)||4,this[Ve]=!1,this[Ye]=!1}[Xs](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&this.add(e),this[Ye]=!0,this[Ee](),i&&i(),this}write(e){if(this[Ye])throw Error("write after end");return e instanceof Zi?this[ps](e):this[Lt](e),this.flowing}[ps](e){let t=c(rt.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let i=new ki(e.path,t);i.entry=new $s(e,this[li](i)),i.entry.on("end",()=>this[ai](i)),this[P]+=1,this[M].push(i)}this[Ee]()}[Lt](e){let t=c(rt.resolve(this.cwd,e));this[M].push(new ki(e,t)),this[Ee]()}[Li](e){e.pending=!0,this[P]+=1,b[this.follow?"stat":"lstat"](e.absolute,(t,i)=>{e.pending=!1,--this[P],t?this.emit("error",t):this[kt](e,i)})}[kt](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)?t.isFile()&&t.nlink>1&&e===this[be]&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync&&this[oi](e):e.ignore=!0,this[Ee]()}[xi](e){e.pending=!0,this[P]+=1,b.readdir(e.absolute,(t,i)=>{if(e.pending=!1,--this[P],t)return this.emit("error",t);this[xt](e,i)})}[xt](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[Ee]()}[Ee](){if(!this[Ve]){this[Ve]=!0;for(let e=this[M].head;e&&this[P]<this.jobs;e=e.next)if(this[oi](e.value),e.value.ignore){let t=e.next;this[M].removeNode(e),e.next=t}this[Ve]=!1,this[Ye]&&this[M].length===0&&this[P]===0&&(this.zip?this.zip.end(ms):(super.write(ms),super.end()))}}get[be](){return this[M]&&this[M].head&&this[M].head.value}[ai](e){this[M].shift(),--this[P],this[Ee]()}[oi](e){if(!e.pending){if(e.entry){e===this[be]&&!e.piped&&this[At](e);return}if(!e.stat){let t=this.statCache.get(e.absolute);t?this[kt](e,t):this[Li](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let t=this.readdirCache.get(e.absolute);if(t?this[xt](e,t):this[xi](e),!e.readdir)return}if(e.entry=this[ys](e),!e.entry){e.ignore=!0;return}e===this[be]&&!e.piped&&this[At](e)}}}[li](e){return{onwarn:o((t,i,s)=>this.warn(t,i,s),"onwarn"),noPax:this.noPax,cwd:this.cwd,absolute:e.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}}[ys](e){this[P]+=1;try{return new this[Dt](e.path,this[li](e)).on("end",()=>this[ai](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[di](){this[be]&&this[be].entry&&this[be].entry.resume()}[At](e){e.piped=!0,e.readdir&&e.readdir.forEach(s=>{let r=e.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[Lt](h+s)});let t=e.entry,i=this.zip;if(!t)throw Error("cannot pipe without source");i?t.on("data",s=>{i.write(s)||t.pause()}):t.on("data",s=>{super.write(s)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,i={}){Pt(this,e,t,i)}},Ut=class extends ot{static{f(this,"Mi")}static{o(this,"ri")}sync=!0;constructor(e){super(e),this[Dt]=Gs}pause(){}resume(){}[Li](e){let t=this.follow?"statSync":"lstatSync";this[kt](e,b[t](e.absolute))}[xi](e){this[xt](e,b.readdirSync(e.absolute))}[At](e){let t=e.entry,i=this.zip;if(e.readdir&&e.readdir.forEach(s=>{let r=e.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[Lt](h+s)}),!t)throw Error("Cannot pipe without source");i?t.on("data",s=>{i.write(s)}):t.on("data",s=>{super[Xs](s)})}},xh=o((e,t)=>{let i=new Ut(e),s=new Fs(e.file,{mode:e.mode||438});i.pipe(s),qs(i,t)},"ii"),Ah=o((e,t)=>{let i=new ot(e),s=new Ct(e.file,{mode:e.mode||438});i.pipe(s);let r=new Promise((h,n)=>{s.on("error",n),s.on("close",h),i.on("error",n)});return Js(i,t).catch(h=>i.emit("error",h)),r},"ai"),qs=o((e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Ce({file:p.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:o(s=>e.add(s),"onReadEntry")}):e.add(i)}),e.end()},"oi"),Js=o(async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Ce({file:p.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:o(s=>{e.add(s)},"onReadEntry")}):e.add(i);e.end()},"si"),bs=nt(xh,Ah,(e,t)=>{let i=new Ut(e);return qs(i,t),i},(e,t)=>{let i=new ot(e);return Js(i,t).catch(s=>i.emit("error",s)),i},(e,t)=>{if(!t?.length)throw TypeError("no paths specified to add to archive")}),Qs=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",{O_CREAT:er,O_NOFOLLOW:Es,O_TRUNC:tr,O_WRONLY:ir}=b.constants,sr=Number(process.env.__FAKE_FS_O_FILENAME__)||b.constants.UV_FS_O_FILEMAP||0,Dh=Qs&&!!sr,Nh=512*1024,Ih=sr|tr|er|ir,gs=!Qs&&typeof Es=="number"?Es|tr|er|ir:null,rr=gs===null?Dh?e=>e<Nh?Ih:"w":()=>"w":()=>gs,Ai=o((e,t,i)=>{try{return d.lchownSync(e,t,i)}catch(s){if(s?.code!=="ENOENT")throw s}},"bi"),Bt=o((e,t,i,s)=>{d.lchown(e,t,i,r=>{s(r&&r?.code!=="ENOENT"?r:null)})},"xi"),Bh=o((e,t,i,s,r)=>{t.isDirectory()?hr(p.resolve(e,t.name),i,s,h=>{if(h)return r(h);Bt(p.resolve(e,t.name),i,s,r)}):Bt(p.resolve(e,t.name),i,s,r)},"Si"),hr=o((e,t,i,s)=>{d.readdir(e,{withFileTypes:!0},(r,h)=>{if(r){if(r.code==="ENOENT")return s();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return s(r)}if(r||!h.length)return Bt(e,t,i,s);let n=h.length,a=null,l=o(u=>{if(!a){if(u)return s(a=u);if(--n===0)return Bt(e,t,i,s)}},"c");for(let u of h)Bh(e,u,t,i,l)})},"Ci"),Fh=o((e,t,i,s)=>{t.isDirectory()&&nr(p.resolve(e,t.name),i,s),Ai(p.resolve(e,t.name),i,s)},"wi"),nr=o((e,t,i)=>{let s;try{s=d.readdirSync(e,{withFileTypes:!0})}catch(r){let h=r;if(h?.code==="ENOENT")return;if(h?.code==="ENOTDIR"||h?.code==="ENOTSUP")return Ai(e,t,i);throw h}for(let r of s)Fh(e,r,t,i);return Ai(e,t,i)},"Ti"),or=class extends Error{static{f(this,"Js")}static{o(this,"Ei")}path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}},jt=class extends Error{static{f(this,"Pi")}static{o(this,"Di")}path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}},Ch=o((e,t)=>{d.stat(e,(i,s)=>{(i||!s.isDirectory())&&(i=new or(e,i?.code||"ENOTDIR")),t(i)})},"Oi"),Mh=o((e,t,i)=>{e=c(e);let s=t.umask??18,r=t.mode|448,h=(r&s)!==0,n=t.uid,a=t.gid,l=typeof n=="number"&&typeof a=="number"&&(n!==t.processUid||a!==t.processGid),u=t.preserve,m=t.unlink,g=c(t.cwd),w=o((L,_)=>{L?i(L):_&&l?hr(_,n,a,x=>w(x)):h?d.chmod(e,r,i):i()},"m");if(e===g)return Ch(e,w);if(u)return cr.mkdir(e,{mode:r,recursive:!0}).then(L=>w(null,L??void 0),w);Di(g,c(p.relative(g,e)).split("/"),r,m,g,void 0,w)},"ki"),Di=o((e,t,i,s,r,h,n)=>{if(t.length===0)return n(null,h);let a=t.shift(),l=c(p.resolve(e+"/"+a));d.mkdir(l,i,ar(l,t,i,s,r,h,n))},"Ai"),ar=o((e,t,i,s,r,h,n)=>a=>{a?d.lstat(e,(l,u)=>{if(l)l.path=l.path&&c(l.path),n(l);else if(u.isDirectory())Di(e,t,i,s,r,h,n);else if(s)d.unlink(e,m=>{if(m)return n(m);d.mkdir(e,i,ar(e,t,i,s,r,h,n))});else{if(u.isSymbolicLink())return n(new jt(e,e+"/"+t.join("/")));n(a)}}):(h||=e,Di(e,t,i,s,r,h,n))},"ji"),Ph=o(e=>{let t=!1,i;try{t=d.statSync(e).isDirectory()}catch(s){i=s?.code}finally{if(!t)throw new or(e,i??"ENOTDIR")}},"Mi"),zh=o((e,t)=>{e=c(e);let i=t.umask??18,s=t.mode|448,r=(s&i)!==0,h=t.uid,n=t.gid,a=typeof h=="number"&&typeof n=="number"&&(h!==t.processUid||n!==t.processGid),l=t.preserve,u=t.unlink,m=c(t.cwd),g=o(_=>{_&&a&&nr(_,h,n),r&&d.chmodSync(e,s)},"ee");if(e===m)return Ph(m),g();if(l)return g(d.mkdirSync(e,{mode:s,recursive:!0})??void 0);let w=c(p.relative(m,e)).split("/"),L;for(let _=w.shift(),x=m;_&&(x+="/"+_);_=w.shift()){x=c(p.resolve(x));try{d.mkdirSync(x,s),L||=x}catch{let Ki=d.lstatSync(x);if(Ki.isDirectory())continue;if(u){d.unlinkSync(x),d.mkdirSync(x,s),L||=x;continue}else if(Ki.isSymbolicLink())return new jt(x,x+"/"+w.join("/"))}}return g(L)},"Ni"),ui=Object.create(null),ws=1e4,ke=new Set,Uh=o(e=>{ke.has(e)?ke.delete(e):ui[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),ke.add(e);let t=ui[e],i=ke.size-ws;if(i>ws/10){for(let s of ke)if(ke.delete(s),delete ui[s],--i<=0)break}return t},"Li"),jh=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",Hh=o(e=>e.split("/").slice(0,-1).reduce((t,i)=>{let s=t.at(-1);return s!==void 0&&(i=Ds(s,i)),t.push(i||"/"),t},[]),"zi"),Zh=class{static{f(this,"Mh")}static{o(this,"Bi")}#e=new Map;#i=new Map;#s=new Set;reserve(e,t){e=jh?["win32 parallelization disabled"]:e.map(s=>Je(Ds(Uh(s))));let i=new Set(e.map(s=>Hh(s)).reduce((s,r)=>s.concat(r)));this.#i.set(t,{dirs:i,paths:e});for(let s of e){let r=this.#e.get(s);r?r.push(t):this.#e.set(s,[t])}for(let s of i){let r=this.#e.get(s);if(!r)this.#e.set(s,[new Set([t])]);else{let h=r.at(-1);h instanceof Set?h.add(t):r.push(new Set([t]))}}return this.#r(t)}#h(e){let t=this.#i.get(e);if(!t)throw Error("function does not have any path reservations");return{paths:t.paths.map(i=>this.#e.get(i)),dirs:[...t.dirs].map(i=>this.#e.get(i))}}check(e){let{paths:t,dirs:i}=this.#h(e);return t.every(s=>s&&s[0]===e)&&i.every(s=>s&&s[0]instanceof Set&&s[0].has(e))}#r(e){return this.#s.has(e)||!this.check(e)?!1:(this.#s.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#s.has(e))return!1;let t=this.#i.get(e);if(!t)throw Error("invalid reservation");let{paths:i,dirs:s}=t,r=new Set;for(let h of i){let n=this.#e.get(h);if(!n||n?.[0]!==e)continue;let a=n[1];if(!a){this.#e.delete(h);continue}if(n.shift(),typeof a=="function")r.add(a);else for(let l of a)r.add(l)}for(let h of s){let n=this.#e.get(h),a=n?.[0];if(!(!n||!(a instanceof Set)))if(a.size===1&&n.length===1){this.#e.delete(h);continue}else if(a.size===1){n.shift();let l=n[0];typeof l=="function"&&r.add(l)}else a.delete(e)}return this.#s.delete(e),r.forEach(h=>this.#r(h)),!0}},Wh=o(()=>process.umask(),"Vi"),Rs=Symbol("onEntry"),Ni=Symbol("checkFs"),_s=Symbol("checkFs2"),Ii=Symbol("isReusable"),F=Symbol("makeFs"),Bi=Symbol("file"),Fi=Symbol("directory"),Nt=Symbol("link"),Ss=Symbol("symlink"),vs=Symbol("hardlink"),Xe=Symbol("ensureNoSymlink"),Os=Symbol("unsupported"),Ts=Symbol("checkPath"),fi=Symbol("stripAbsolutePath"),ne=Symbol("mkdir"),k=Symbol("onError"),Rt=Symbol("pending"),ks=Symbol("pend"),Le=Symbol("unpend"),ci=Symbol("ended"),mi=Symbol("maybeClose"),Ci=Symbol("skip"),Qe=Symbol("doChown"),et=Symbol("uid"),tt=Symbol("gid"),it=Symbol("checkedCwd"),st=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",Gh=1024,$h=o((e,t)=>{if(!st)return d.unlink(e,t);let i=e+".DELETE."+Is(16).toString("hex");d.rename(e,i,s=>{if(s)return t(s);d.unlink(i,t)})},"ma"),Yh=o(e=>{if(!st)return d.unlinkSync(e);let t=e+".DELETE."+Is(16).toString("hex");d.renameSync(e,t),d.unlinkSync(t)},"ha"),Ls=o((e,t,i)=>e!==void 0&&e===e>>>0?e:t!==void 0&&t===t>>>0?t:i,"ga"),Ft=class extends Ie{static{f(this,"Ni")}static{o(this,"_a")}[ci]=!1;[it]=!1;[Rt]=0;reservations=new Zh;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[ci]=!0,this[mi]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=e.preserveOwner===void 0&&typeof e.uid!="number"?!!(process.getuid&&process.getuid()===0):!!e.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=typeof e.maxDepth=="number"?e.maxDepth:Gh,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||st,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=c(p.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:Wh():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[Rs](t))}warn(e,t,i={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(i.recoverable=!1),super.warn(e,t,i)}[mi](){this[ci]&&this[Rt]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[fi](e,t){let i=e[t],{type:s}=e;if(!i||this.preservePaths)return!0;let[r,h]=Gi(i),n=h.replaceAll(/\\/g,"/").split("/");if(n.includes("..")||st&&/^[a-z]:\.\.$/i.test(n[0]??"")){if(t==="path"||s==="Link")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:i}),!1;let a=p.posix.dirname(e.path),l=p.posix.normalize(p.posix.join(a,n.join("/")));if(l.startsWith("../")||l==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:i}),!1}return r&&(e[t]=String(h),this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute ${t}`,{entry:e,[t]:i})),!0}[Ts](e){let t=c(e.path),i=t.split("/");if(this.strip){if(i.length<this.strip)return!1;if(e.type==="Link"){let s=c(String(e.linkpath)).split("/");if(s.length>=this.strip)e.linkpath=s.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),e.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[fi](e,"path")||!this[fi](e,"linkpath"))return!1;if(e.absolute=p.isAbsolute(e.path)?c(p.resolve(e.path)):c(p.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:c(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:s}=p.win32.parse(String(e.absolute));e.absolute=s+ls(String(e.absolute).slice(s.length));let{root:r}=p.win32.parse(e.path);e.path=r+ls(e.path.slice(r.length))}return!0}[Rs](e){if(!this[Ts](e))return e.resume();switch(Rr.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode|=448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Ni](e);default:return this[Os](e)}}[k](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[Le](),t.resume())}[ne](e,t,i){Mh(c(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t},i)}[Qe](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[et](e){return Ls(this.uid,e.uid,this.processUid)}[tt](e){return Ls(this.gid,e.gid,this.processGid)}[Bi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=new Ct(String(e.absolute),{flags:rr(e.size),mode:i,autoClose:!1});s.on("error",a=>{s.fd&&d.close(s.fd,()=>{}),s.write=()=>!0,this[k](a,e),t()});let r=1,h=o(a=>{if(a){s.fd&&d.close(s.fd,()=>{}),this[k](a,e),t();return}--r===0&&s.fd!==void 0&&d.close(s.fd,l=>{l?this[k](l,e):this[Le](),t()})},"o");s.on("finish",()=>{let a=String(e.absolute),l=s.fd;if(typeof l=="number"&&e.mtime&&!this.noMtime){r++;let u=e.atime||new Date,m=e.mtime;d.futimes(l,u,m,g=>g?d.utimes(a,u,m,w=>h(w&&g)):h())}if(typeof l=="number"&&this[Qe](e)){r++;let u=this[et](e),m=this[tt](e);typeof u=="number"&&typeof m=="number"&&d.fchown(l,u,m,g=>g?d.chown(a,u,m,w=>h(w&&g)):h())}h()});let n=this.transform&&this.transform(e)||e;n!==e&&(n.on("error",a=>{this[k](a,e),t()}),e.pipe(n)),n.pipe(s)}[Fi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode;this[ne](String(e.absolute),i,s=>{if(s){this[k](s,e),t();return}let r=1,h=o(()=>{--r===0&&(t(),this[Le](),e.resume())},"a");e.mtime&&!this.noMtime&&(r++,d.utimes(String(e.absolute),e.atime||new Date,e.mtime,h)),this[Qe](e)&&(r++,d.chown(String(e.absolute),Number(this[et](e)),Number(this[tt](e)),h)),h()})}[Os](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[Ss](e,t){let i=c(p.relative(this.cwd,p.resolve(p.dirname(String(e.absolute)),String(e.linkpath)))).split("/");this[Xe](e,this.cwd,i,()=>this[Nt](e,String(e.linkpath),"symlink",t),s=>{this[k](s,e),t()})}[vs](e,t){let i=c(p.resolve(this.cwd,String(e.linkpath))),s=c(String(e.linkpath)).split("/");this[Xe](e,this.cwd,s,()=>this[Nt](e,i,"link",t),r=>{this[k](r,e),t()})}[Xe](e,t,i,s,r){let h=i.shift();if(this.preservePaths||h===void 0)return s();let n=p.resolve(t,h);d.lstat(n,(a,l)=>{if(a)return s();if(l?.isSymbolicLink())return r(new jt(n,p.resolve(n,i.join("/"))));this[Xe](e,n,i,s,r)})}[ks](){this[Rt]++}[Le](){this[Rt]--,this[mi]()}[Ci](e){this[Le](),e.resume()}[Ii](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!st}[Ni](e){this[ks]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,i=>this[_s](e,i))}[_s](e,t){let i=o(n=>{t(n)},"r"),s=o(()=>{this[ne](this.cwd,this.dmode,n=>{if(n){this[k](n,e),i();return}this[it]=!0,r()})},"a"),r=o(()=>{if(e.absolute!==this.cwd){let n=c(p.dirname(String(e.absolute)));if(n!==this.cwd)return this[ne](n,this.dmode,a=>{if(a){this[k](a,e),i();return}h()})}h()},"o"),h=o(()=>{d.lstat(String(e.absolute),(n,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(e.mtime??a.mtime))){this[Ci](e),i();return}if(n||this[Ii](e,a))return this[F](null,e,i);if(a.isDirectory()){if(e.type==="Directory"){let l=this.chmod&&e.mode&&(a.mode&4095)!==e.mode,u=o(m=>this[F](m??null,e,i),"a");return l?d.chmod(String(e.absolute),Number(e.mode),u):u()}if(e.absolute!==this.cwd)return d.rmdir(String(e.absolute),l=>this[F](l??null,e,i))}if(e.absolute===this.cwd)return this[F](null,e,i);$h(String(e.absolute),l=>this[F](l??null,e,i))})},"s");this[it]?r():s()}[F](e,t,i){if(e){this[k](e,t),i();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[Bi](t,i);case"Link":return this[vs](t,i);case"SymbolicLink":return this[Ss](t,i);case"Directory":case"GNUDumpDir":return this[Fi](t,i)}}[Nt](e,t,i,s){d[i](t,String(e.absolute),r=>{r?this[k](r,e):(this[Le](),e.resume()),s()})}},Ke=o(e=>{try{return[null,e()]}catch(t){return[t,null]}},"va"),Mi=class extends Ft{static{f(this,"Be")}static{o(this,"ya")}sync=!0;[F](e,t){return super[F](e,t,()=>{})}[Ni](e){if(!this[it]){let r=this[ne](this.cwd,this.dmode);if(r)return this[k](r,e);this[it]=!0}if(e.absolute!==this.cwd){let r=c(p.dirname(String(e.absolute)));if(r!==this.cwd){let h=this[ne](r,this.dmode);if(h)return this[k](h,e)}}let[t,i]=Ke(()=>d.lstatSync(String(e.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(e.mtime??i.mtime)))return this[Ci](e);if(t||this[Ii](e,i))return this[F](null,e);if(i.isDirectory()){if(e.type==="Directory"){let[h]=this.chmod&&e.mode&&(i.mode&4095)!==e.mode?Ke(()=>{d.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[F](h,e)}let[r]=Ke(()=>d.rmdirSync(String(e.absolute)));this[F](r,e)}let[s]=e.absolute===this.cwd?[]:Ke(()=>Yh(String(e.absolute)));this[F](s,e)}[Bi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=o(n=>{let a;try{d.closeSync(r)}catch(l){a=l}(n||a)&&this[k](n||a,e),t()},"i"),r;try{r=d.openSync(String(e.absolute),rr(e.size),i)}catch(n){return s(n)}let h=this.transform&&this.transform(e)||e;h!==e&&(h.on("error",n=>this[k](n,e)),e.pipe(h)),h.on("data",n=>{try{d.writeSync(r,n,0,n.length)}catch(a){s(a)}}),h.on("end",()=>{let n=null;if(e.mtime&&!this.noMtime){let a=e.atime||new Date,l=e.mtime;try{d.futimesSync(r,a,l)}catch(u){try{d.utimesSync(String(e.absolute),a,l)}catch{n=u}}}if(this[Qe](e)){let a=this[et](e),l=this[tt](e);try{d.fchownSync(r,Number(a),Number(l))}catch(u){try{d.chownSync(String(e.absolute),Number(a),Number(l))}catch{n||=u}}}s(n)})}[Fi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode,s=this[ne](String(e.absolute),i);if(s){this[k](s,e),t();return}if(e.mtime&&!this.noMtime)try{d.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Qe](e))try{d.chownSync(String(e.absolute),Number(this[et](e)),Number(this[tt](e)))}catch{}t(),e.resume()}[ne](e,t){try{return zh(c(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t})}catch(i){return i}}[Xe](e,t,i,s,r){if(this.preservePaths||i.length===0)return s();let h=t;for(let n of i){h=p.resolve(h,n);let[a,l]=Ke(()=>d.lstatSync(h));if(a)return s();if(l.isSymbolicLink())return r(new jt(h,p.resolve(t,i.join("/"))))}s()}[Nt](e,t,i,s){let r=`${i}Sync`;try{d[r](t,String(e.absolute)),s(),e.resume()}catch(h){return this[k](h,e)}}},xs=nt(e=>{let t=new Mi(e),i=e.file,s=d.statSync(i);new Cr(i,{readSize:e.maxReadSize||16*1024*1024,size:s.size}).pipe(t)},(e,t)=>{let i=new Ft(e),s=e.maxReadSize||16*1024*1024,r=e.file;return new Promise((h,n)=>{i.on("error",n),i.on("close",h),d.stat(r,(a,l)=>{if(a)n(a);else{let u=new zi(r,{readSize:s,size:l.size});u.on("error",n),u.pipe(i)}})})},e=>new Mi(e),e=>new Ft(e),(e,t)=>{t?.length&&Wi(e,t)}),Vh=o((e,t)=>{let i=new Ut(e),s=!0,r,h;try{try{r=d.openSync(e.file,"r+")}catch(l){if(l?.code==="ENOENT")r=d.openSync(e.file,"w+");else throw l}let n=d.fstatSync(r),a=Buffer.alloc(512);e:for(h=0;h<n.size;h+=512){for(let m=0,g=0;m<512;m+=g){if(g=d.readSync(r,a,m,a.length-m,h+m),h===0&&a[0]===31&&a[1]===139)throw Error("cannot append to compressed archives");if(!g)break e}let l=new le(a);if(!l.cksumValid)break;let u=512*Math.ceil((l.size||0)/512);if(h+u+512>n.size)break;h+=u,e.mtimeCache&&l.mtime&&e.mtimeCache.set(String(l.path),l.mtime)}s=!1,Kh(e,i,h,r,t)}finally{if(s)try{d.closeSync(r)}catch{}}},"xa"),Kh=o((e,t,i,s,r)=>{let h=new Fs(e.file,{fd:s,start:i});t.pipe(h),qh(t,r)},"Sa"),Xh=o((e,t)=>{t=Array.from(t);let i=new ot(e),s=o((r,h,n)=>{let a=o((w,L)=>{w?d.close(r,_=>n(w)):n(null,L)},"a"),l=0;if(h===0)return a(null,0);let u=0,m=Buffer.alloc(512),g=o((w,L)=>{if(w||L===void 0)return a(w);if(u+=L,u<512&&L)return d.read(r,m,u,m.length-u,l+u,g);if(l===0&&m[0]===31&&m[1]===139)return a(Error("cannot append to compressed archives"));if(u<512)return a(null,l);let _=new le(m);if(!_.cksumValid)return a(null,l);let x=512*Math.ceil((_.size??0)/512);if(l+x+512>h||(l+=x+512,l>=h))return a(null,l);e.mtimeCache&&_.mtime&&e.mtimeCache.set(String(_.path),_.mtime),u=0,d.read(r,m,0,512,l,g)},"l");d.read(r,m,0,512,l,g)},"i");return new Promise((r,h)=>{i.on("error",h);let n="r+",a=o((l,u)=>{if(l&&l.code==="ENOENT"&&n==="r+")return n="w+",d.open(e.file,n,a);if(l||!u)return h(l);d.fstat(u,(m,g)=>{if(m)return d.close(u,()=>h(m));s(u,g.size,(w,L)=>{if(w)return h(w);let _=new Ct(e.file,{fd:u,start:L});i.pipe(_),_.on("error",h),_.on("close",r),Jh(i,t)})})},"c");d.open(e.file,n,a)})},"Ca"),qh=o((e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Ce({file:p.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:o(s=>e.add(s),"onReadEntry")}):e.add(i)}),e.end()},"wa"),Jh=o(async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Ce({file:p.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:o(s=>e.add(s),"onReadEntry")}):e.add(i);e.end()},"Ta"),ge=nt(Vh,Xh,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(e,t)=>{if(!Hr(e))throw TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!t?.length)throw TypeError("no paths specified to add/replace")});nt(ge.syncFile,ge.asyncFile,ge.syncNoFile,ge.asyncNoFile,(e,t=[])=>{ge.validate?.(e,t),Qh(e)});var Qh=o(e=>{let t=e.filter;e.mtimeCache||=new Map,e.filter=t?(i,s)=>t(i,s)&&!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(i,s)=>!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0))},"Da");export{rn as t};
|
|
1
|
+
import{createRequire as nr}from"node:module";import{l as ar}from"../packem_shared/giget-DHY1sQZC.js";const or=nr(import.meta.url),Fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=e=>{if(typeof Fe<"u"&&Fe.versions&&Fe.versions.node){const[t,i]=Fe.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return Fe.getBuiltinModule(e)}return or(e)},d=D("node:fs"),lr=D("node:fs/promises"),Ls=D("node:stream"),c=D("node:path"),{posix:Re,basename:dr,join:As,win32:ur}=c,Ds=D("events"),{EventEmitter:fr}=Ds,p=D("fs"),{EventEmitter:Ci}=D("node:events"),{StringDecoder:cr}=D("node:string_decoder"),st=D("path"),{parse:mr,dirname:pr}=st,mi=D("assert"),{Buffer:ge}=D("buffer"),Vi=D("zlib"),Ki={...Vi,default:Vi},yr=D("zlib"),br=D("node:assert"),{randomBytes:xs}=D("node:crypto");var en=ar({Header:()=>ae,Pack:()=>nt,PackJob:()=>Ti,PackSync:()=>Ut,Parser:()=>xe,Pax:()=>rt,ReadEntry:()=>Hs,Unpack:()=>Ft,UnpackSync:()=>Mi,WriteEntry:()=>Gi,WriteEntrySync:()=>Gs,WriteEntryTar:()=>$s,c:()=>ps,create:()=>ps,extract:()=>ks,filesFilter:()=>Hi,list:()=>Be,r:()=>be,replace:()=>be,t:()=>Be,types:()=>zs,x:()=>ks}),gr=Object.defineProperty,Er=(e,t)=>{for(var i in t)gr(e,i,{get:t[i],enumerable:!0})},Xi=process||{stdout:null,stderr:null},wr=e=>!!e&&typeof e=="object"&&(e instanceof _e||e instanceof Ls||_r(e)||Rr(e)),_r=e=>!!e&&typeof e=="object"&&e instanceof Ci&&typeof e.pipe=="function"&&e.pipe!==Ls.Writable.prototype.pipe,Rr=e=>!!e&&typeof e=="object"&&e instanceof Ci&&typeof e.write=="function"&&typeof e.end=="function",W=Symbol("EOF"),G=Symbol("maybeEmitEnd"),X=Symbol("emittedEnd"),ot=Symbol("emittingEnd"),Me=Symbol("emittedError"),at=Symbol("closed"),qi=Symbol("read"),lt=Symbol("flush"),Qi=Symbol("flushChunk"),B=Symbol("encoding"),Se=Symbol("decoder"),R=Symbol("flowing"),Ce=Symbol("paused"),ke=Symbol("resume"),S=Symbol("buffer"),A=Symbol("pipes"),v=Symbol("bufferLength"),Ht=Symbol("bufferPush"),dt=Symbol("bufferShift"),L=Symbol("objectMode"),E=Symbol("destroyed"),Zt=Symbol("error"),Wt=Symbol("emitData"),Ji=Symbol("emitEnd"),Gt=Symbol("emitEnd2"),z=Symbol("async"),$t=Symbol("abort"),ut=Symbol("aborted"),Pe=Symbol("signal"),le=Symbol("dataListeners"),x=Symbol("discarded"),ze=e=>Promise.resolve().then(e),Sr=e=>e(),vr=e=>e==="end"||e==="finish"||e==="prefinish",Or=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,Tr=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),Ns=class{src;dest;opts;ondrain;constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[ke](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},kr=class extends Ns{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=s=>this.dest.emit("error",s),e.on("error",this.proxyErrors)}},Lr=e=>!!e.objectMode,Ar=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",_e=class extends Ci{[R]=!1;[Ce]=!1;[A]=[];[S]=[];[L];[B];[z];[Se];[W]=!1;[X]=!1;[ot]=!1;[at]=!1;[Me]=null;[v]=0;[E]=!1;[Pe];[ut]=!1;[le]=0;[x]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");Lr(t)?(this[L]=!0,this[B]=null):Ar(t)?(this[B]=t.encoding,this[L]=!1):(this[L]=!1,this[B]=null),this[z]=!!t.async,this[Se]=this[B]?new cr(this[B]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[S]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[A]});let{signal:i}=t;i&&(this[Pe]=i,i.aborted?this[$t]():i.addEventListener("abort",()=>this[$t]()))}get bufferLength(){return this[v]}get encoding(){return this[B]}set encoding(e){throw Error("Encoding must be set at instantiation time")}setEncoding(e){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[L]}set objectMode(e){throw Error("objectMode must be set at instantiation time")}get async(){return this[z]}set async(e){this[z]=this[z]||!!e}[$t](){this[ut]=!0,this.emit("abort",this[Pe]?.reason),this.destroy(this[Pe]?.reason)}get aborted(){return this[ut]}set aborted(e){}write(e,t,i){if(this[ut])return!1;if(this[W])throw Error("write after end");if(this[E])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||="utf8";let s=this[z]?ze:Sr;if(!this[L]&&!Buffer.isBuffer(e)){if(Tr(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Or(e))e=Buffer.from(e);else if(typeof e!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[L]?(this[R]&&this[v]!==0&&this[lt](!0),this[R]?this.emit("data",e):this[Ht](e),this[v]!==0&&this.emit("readable"),i&&s(i),this[R]):e.length?(typeof e=="string"&&!(t===this[B]&&!this[Se]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[B]&&(e=this[Se].write(e)),this[R]&&this[v]!==0&&this[lt](!0),this[R]?this.emit("data",e):this[Ht](e),this[v]!==0&&this.emit("readable"),i&&s(i),this[R]):(this[v]!==0&&this.emit("readable"),i&&s(i),this[R])}read(e){if(this[E])return null;if(this[x]=!1,this[v]===0||e===0||e&&e>this[v])return this[G](),null;this[L]&&(e=null),this[S].length>1&&!this[L]&&(this[S]=[this[B]?this[S].join(""):Buffer.concat(this[S],this[v])]);let t=this[qi](e||null,this[S][0]);return this[G](),t}[qi](e,t){if(this[L])this[dt]();else{let i=t;e===i.length||e===null?this[dt]():typeof i=="string"?(this[S][0]=i.slice(e),t=i.slice(0,e),this[v]-=e):(this[S][0]=i.subarray(e),t=i.subarray(0,e),this[v]-=e)}return this.emit("data",t),!this[S].length&&!this[W]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t="utf8"),e!==void 0&&this.write(e,t),i&&this.once("end",i),this[W]=!0,this.writable=!1,(this[R]||!this[Ce])&&this[G](),this}[ke](){this[E]||(!this[le]&&!this[A].length&&(this[x]=!0),this[Ce]=!1,this[R]=!0,this.emit("resume"),this[S].length?this[lt]():this[W]?this[G]():this.emit("drain"))}resume(){return this[ke]()}pause(){this[R]=!1,this[Ce]=!0,this[x]=!1}get destroyed(){return this[E]}get flowing(){return this[R]}get paused(){return this[Ce]}[Ht](e){this[L]?this[v]+=1:this[v]+=e.length,this[S].push(e)}[dt](){return this[L]?--this[v]:this[v]-=this[S][0].length,this[S].shift()}[lt](e=!1){do;while(this[Qi](this[dt]())&&this[S].length);!e&&!this[S].length&&!this[W]&&this.emit("drain")}[Qi](e){return this.emit("data",e),this[R]}pipe(e,t){if(this[E])return e;this[x]=!1;let i=this[X];return t||={},e===Xi.stdout||e===Xi.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this[A].push(t.proxyErrors?new kr(this,e,t):new Ns(this,e,t)),this[z]?ze(()=>this[ke]()):this[ke]()),e}unpipe(e){let t=this[A].find(i=>i.dest===e);t&&(this[A].length===1?(this[R]&&this[le]===0&&(this[R]=!1),this[A]=[]):this[A].splice(this[A].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);if(e==="data")this[x]=!1,this[le]++,!this[A].length&&!this[R]&&this[ke]();else if(e==="readable"&&this[v]!==0)super.emit("readable");else if(vr(e)&&this[X])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Me]){let s=t;this[z]?ze(()=>s.call(this,this[Me])):s.call(this,this[Me])}return i}removeListener(e,t){return this.off(e,t)}off(e,t){let i=super.off(e,t);return e==="data"&&(this[le]=this.listeners("data").length,this[le]===0&&!this[x]&&!this[A].length&&(this[R]=!1)),i}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[le]=0,!this[x]&&!this[A].length&&(this[R]=!1)),t}get emittedEnd(){return this[X]}[G](){!this[ot]&&!this[X]&&!this[E]&&this[S].length===0&&this[W]&&(this[ot]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[at]&&this.emit("close"),this[ot]=!1)}emit(e,...t){let i=t[0];if(e!=="error"&&e!=="close"&&e!==E&&this[E])return!1;if(e==="data")return!this[L]&&!i?!1:this[z]?(ze(()=>this[Wt](i)),!0):this[Wt](i);if(e==="end")return this[Ji]();if(e==="close"){if(this[at]=!0,!this[X]&&!this[E])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[Me]=i,super.emit(Zt,i);let r=!this[Pe]||this.listeners("error").length?super.emit("error",i):!1;return this[G](),r}else if(e==="resume"){let r=super.emit("resume");return this[G](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let s=super.emit(e,...t);return this[G](),s}[Wt](e){for(let i of this[A])i.dest.write(e)===!1&&this.pause();let t=this[x]?!1:super.emit("data",e);return this[G](),t}[Ji](){return this[X]?!1:(this[X]=!0,this.readable=!1,this[z]?(ze(()=>this[Gt]()),!0):this[Gt]())}[Gt](){if(this[Se]){let t=this[Se].end();if(t){for(let i of this[A])i.dest.write(t);this[x]||super.emit("data",t)}}for(let t of this[A])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[L]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[L]||(e.dataLength+=i.length)}),await t,e}async concat(){if(this[L])throw Error("cannot concat in objectMode");let e=await this.collect();return this[B]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(E,()=>t(Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[x]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[W])return t();let s,r,h=l=>{this.off("data",n),this.off("end",o),this.off(E,a),t(),r(l)},n=l=>{this.off("error",h),this.off("end",o),this.off(E,a),this.pause(),s({value:l,done:!!this[W]})},o=()=>{this.off("error",h),this.off("data",n),this.off(E,a),t(),s({done:!0,value:void 0})},a=()=>h(Error("stream destroyed"));return new Promise((l,f)=>{r=f,s=l,this.once(E,a),this.once("error",h),this.once("end",o),this.once("data",n)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[x]=!1;let e=!1,t=()=>(this.pause(),this.off(Zt,t),this.off(E,t),this.off("end",t),e=!0,{done:!0,value:void 0});return this.once("end",t),this.once(Zt,t),this.once(E,t),{next:()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[E])return e?this.emit("error",e):this.emit(E),this;this[E]=!0,this[x]=!0,this[S].length=0,this[v]=0;let t=this;return typeof t.close=="function"&&!this[at]&&t.close(),e?this.emit("error",e):this.emit(E),this}static get isStream(){return wr}},Dr=p.writev,ne=Symbol("_autoClose"),P=Symbol("_close"),Ue=Symbol("_ended"),m=Symbol("_fd"),Yt=Symbol("_finished"),K=Symbol("_flags"),Vt=Symbol("_flush"),pi=Symbol("_handleChunk"),yi=Symbol("_makeBuf"),Xe=Symbol("_mode"),ft=Symbol("_needDrain"),Ne=Symbol("_onerror"),Ie=Symbol("_onopen"),Kt=Symbol("_onread"),Le=Symbol("_onwrite"),oe=Symbol("_open"),C=Symbol("_path"),te=Symbol("_pos"),U=Symbol("_queue"),Ae=Symbol("_read"),Xt=Symbol("_readSize"),V=Symbol("_reading"),je=Symbol("_remain"),qt=Symbol("_size"),Rt=Symbol("_write"),de=Symbol("_writing"),St=Symbol("_defaultFlag"),Ee=Symbol("_errored"),Pi=class extends _e{[Ee]=!1;[m];[C];[Xt];[V]=!1;[qt];[je];[ne];constructor(e,t){if(t||={},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw TypeError("path must be a string");this[Ee]=!1,this[m]=typeof t.fd=="number"?t.fd:void 0,this[C]=e,this[Xt]=t.readSize||16*1024*1024,this[V]=!1,this[qt]=typeof t.size=="number"?t.size:1/0,this[je]=this[qt],this[ne]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[m]=="number"?this[Ae]():this[oe]()}get fd(){return this[m]}get path(){return this[C]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[oe](){p.open(this[C],"r",(e,t)=>this[Ie](e,t))}[Ie](e,t){e?this[Ne](e):(this[m]=t,this.emit("open",t),this[Ae]())}[yi](){return Buffer.allocUnsafe(Math.min(this[Xt],this[je]))}[Ae](){if(!this[V]){this[V]=!0;let e=this[yi]();if(e.length===0)return process.nextTick(()=>this[Kt](null,0,e));p.read(this[m],e,0,e.length,null,(t,i,s)=>this[Kt](t,i,s))}}[Kt](e,t,i){this[V]=!1,e?this[Ne](e):this[pi](t,i)&&this[Ae]()}[P](){if(this[ne]&&typeof this[m]=="number"){let e=this[m];this[m]=void 0,p.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Ne](e){this[V]=!0,this[P](),this.emit("error",e)}[pi](e,t){let i=!1;return this[je]-=e,e>0&&(i=super.write(e<t.length?t.subarray(0,e):t)),(e===0||this[je]<=0)&&(i=!1,this[P](),super.end()),i}emit(e,...t){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[m]=="number"&&this[Ae](),!1;case"error":return this[Ee]?!1:(this[Ee]=!0,super.emit(e,...t));default:return super.emit(e,...t)}}},xr=class extends Pi{[oe](){let e=!0;try{this[Ie](null,p.openSync(this[C],"r")),e=!1}finally{e&&this[P]()}}[Ae](){let e=!0;try{if(!this[V]){this[V]=!0;do{let t=this[yi](),i=t.length===0?0:p.readSync(this[m],t,0,t.length,null);if(!this[pi](i,t))break}while(!0);this[V]=!1}e=!1}finally{e&&this[P]()}}[P](){if(this[ne]&&typeof this[m]=="number"){let e=this[m];this[m]=void 0,p.closeSync(e),this.emit("close")}}},Mt=class extends Ds{readable=!1;writable=!0;[Ee]=!1;[de]=!1;[Ue]=!1;[U]=[];[ft]=!1;[C];[Xe];[ne];[m];[St];[K];[Yt]=!1;[te];constructor(e,t){t||={},super(t),this[C]=e,this[m]=typeof t.fd=="number"?t.fd:void 0,this[Xe]=t.mode===void 0?438:t.mode,this[te]=typeof t.start=="number"?t.start:void 0,this[ne]=typeof t.autoClose=="boolean"?t.autoClose:!0;let i=this[te]===void 0?"w":"r+";this[St]=t.flags===void 0,this[K]=t.flags===void 0?i:t.flags,this[m]===void 0&&this[oe]()}emit(e,...t){if(e==="error"){if(this[Ee])return!1;this[Ee]=!0}return super.emit(e,...t)}get fd(){return this[m]}get path(){return this[C]}[Ne](e){this[P](),this[de]=!0,this.emit("error",e)}[oe](){p.open(this[C],this[K],this[Xe],(e,t)=>this[Ie](e,t))}[Ie](e,t){this[St]&&this[K]==="r+"&&e&&e.code==="ENOENT"?(this[K]="w",this[oe]()):e?this[Ne](e):(this[m]=t,this.emit("open",t),this[de]||this[Vt]())}end(e,t){return e&&this.write(e,t),this[Ue]=!0,!this[de]&&!this[U].length&&typeof this[m]=="number"&&this[Le](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[Ue]?(this.emit("error",Error("write() after end()")),!1):this[m]===void 0||this[de]||this[U].length?(this[U].push(e),this[ft]=!0,!1):(this[de]=!0,this[Rt](e),!0)}[Rt](e){p.write(this[m],e,0,e.length,this[te],(t,i)=>this[Le](t,i))}[Le](e,t){e?this[Ne](e):(this[te]!==void 0&&typeof t=="number"&&(this[te]+=t),this[U].length?this[Vt]():(this[de]=!1,this[Ue]&&!this[Yt]?(this[Yt]=!0,this[P](),this.emit("finish")):this[ft]&&(this[ft]=!1,this.emit("drain"))))}[Vt](){if(this[U].length===0)this[Ue]&&this[Le](null,0);else if(this[U].length===1)this[Rt](this[U].pop());else{let e=this[U];this[U]=[],Dr(this[m],e,this[te],(t,i)=>this[Le](t,i))}}[P](){if(this[ne]&&typeof this[m]=="number"){let e=this[m];this[m]=void 0,p.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},Is=class extends Mt{[oe](){let e;if(this[St]&&this[K]==="r+")try{e=p.openSync(this[C],this[K],this[Xe])}catch(t){if(t?.code==="ENOENT")return this[K]="w",this[oe]();throw t}else e=p.openSync(this[C],this[K],this[Xe]);this[Ie](null,e)}[P](){if(this[ne]&&typeof this[m]=="number"){let e=this[m];this[m]=void 0,p.closeSync(e),this.emit("close")}}[Rt](e){let t=!0;try{this[Le](null,p.writeSync(this[m],e,0,e.length,this[te])),t=!1}finally{if(t)try{this[P]()}catch{}}}},Nr=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"]]),Ir=e=>!!e.sync&&!!e.file,Br=e=>!e.sync&&!!e.file,Fr=e=>!!e.sync&&!e.file,Mr=e=>!e.sync&&!e.file,Cr=e=>!!e.file,Pr=e=>Nr.get(e)||e,zi=(e={})=>{if(!e)return{};let t={};for(let[i,s]of Object.entries(e)){let r=Pr(i);t[r]=s}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t},ht=(e,t,i,s,r)=>Object.assign((h=[],n,o)=>{Array.isArray(h)&&(n=h,h={}),typeof n=="function"&&(o=n,n=void 0),n=n?Array.from(n):[];let a=zi(h);if(r?.(a,n),Ir(a)){if(typeof o=="function")throw TypeError("callback not supported for sync tar functions");return e(a,n)}else if(Br(a)){let l=t(a,n);return o?l.then(()=>o(),o):l}else if(Fr(a)){if(typeof o=="function")throw TypeError("callback not supported for sync tar functions");return i(a,n)}else if(Mr(a)){if(typeof o=="function")throw TypeError("callback only supported with file option");return s(a,n)}throw Error("impossible options??")},{syncFile:e,asyncFile:t,syncNoFile:i,asyncNoFile:s,validate:r}),zr=yr.constants||{ZLIB_VERNUM:4736},Z=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},zr)),Ur=ge.concat,es=Object.getOwnPropertyDescriptor(ge,"concat"),jr=e=>e,Qt=es?.writable===!0||es?.set!==void 0?e=>{ge.concat=e?jr:Ur}:e=>{},we=Symbol("_superWrite"),ct=class extends Error{code;errno;constructor(e,t){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||="ZLIB_ERROR",this.message="zlib: "+e.message,Error.captureStackTrace(this,t??this.constructor)}get name(){return"ZlibError"}},Jt=Symbol("flushFlag"),Ui=class extends _e{#e=!1;#i=!1;#s;#h;#r;#t;#n;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#s}constructor(e,t){if(!e||typeof e!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(e),this.#s=e.flush??0,this.#h=e.finishFlush??0,this.#r=e.fullFlushFlag??0,typeof Ki[t]!="function")throw TypeError("Compression method not supported: "+t);try{this.#t=new Ki[t](e)}catch(i){throw new ct(i,this.constructor)}this.#n=i=>{this.#e||(this.#e=!0,this.close(),this.emit("error",i))},this.#t?.on("error",i=>this.#n(new ct(i))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return mi(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#r),this.write(Object.assign(ge.alloc(0),{[Jt]:e})))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#h),this.#i=!0,super.end(i)}get ended(){return this.#i}[we](e){return super.write(e)}write(e,t,i){if(typeof t=="function"&&(i=t,t="utf8"),typeof e=="string"&&(e=ge.from(e,t)),this.#e)return;mi(this.#t,"zlib binding closed");let s=this.#t._handle,r=s.close;s.close=()=>{};let h=this.#t.close;this.#t.close=()=>{},Qt(!0);let n;try{let a=typeof e[Jt]=="number"?e[Jt]:this.#s;n=this.#t._processChunk(e,a),Qt(!1)}catch(a){Qt(!1),this.#n(new ct(a,this.write))}finally{this.#t&&(this.#t._handle=s,s.close=r,this.#t.close=h,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",a=>this.#n(new ct(a,this.write)));let o;if(n)if(Array.isArray(n)&&n.length>0){let a=n[0];o=this[we](ge.from(a));for(let l=1;l<n.length;l++)o=this[we](n[l])}else o=this[we](ge.from(n));return i&&i(),o}},Bs=class extends Ui{#e;#i;constructor(e,t){e||={},e.flush=e.flush||Z.Z_NO_FLUSH,e.finishFlush=e.finishFlush||Z.Z_FINISH,e.fullFlushFlag=Z.Z_FULL_FLUSH,super(e,t),this.#e=e.level,this.#i=e.strategy}params(e,t){if(!this.sawError){if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#e!==e||this.#i!==t){this.flush(Z.Z_SYNC_FLUSH),mi(this.handle,"zlib binding closed");let i=this.handle.flush;this.handle.flush=(s,r)=>{typeof s=="function"&&(r=s,s=this.flushFlag),this.flush(s),r?.()};try{this.handle.params(e,t)}finally{this.handle.flush=i}this.handle&&(this.#e=e,this.#i=t)}}}},Hr=class extends Bs{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[we](e){return this.#e?(this.#e=!1,e[9]=255,super[we](e)):super[we](e)}},Zr=class extends Bs{constructor(e){super(e,"Unzip")}},Fs=class extends Ui{constructor(e,t){e||={},e.flush=e.flush||Z.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||Z.BROTLI_OPERATION_FINISH,e.fullFlushFlag=Z.BROTLI_OPERATION_FLUSH,super(e,t)}},Wr=class extends Fs{constructor(e){super(e,"BrotliCompress")}},Gr=class extends Fs{constructor(e){super(e,"BrotliDecompress")}},Ms=class extends Ui{constructor(e,t){e||={},e.flush=e.flush||Z.ZSTD_e_continue,e.finishFlush=e.finishFlush||Z.ZSTD_e_end,e.fullFlushFlag=Z.ZSTD_e_flush,super(e,t)}},$r=class extends Ms{constructor(e){super(e,"ZstdCompress")}},Yr=class extends Ms{constructor(e){super(e,"ZstdDecompress")}},Vr=(e,t)=>{if(Number.isSafeInteger(e))e<0?Xr(e,t):Kr(e,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},Kr=(e,t)=>{t[0]=128;for(var i=t.length;i>1;i--)t[i-1]=e&255,e=Math.floor(e/256)},Xr=(e,t)=>{t[0]=255;var i=!1;e*=-1;for(var s=t.length;s>1;s--){var r=e&255;e=Math.floor(e/256),i?t[s-1]=Cs(r):r===0?t[s-1]=0:(i=!0,t[s-1]=Ps(r))}},qr=e=>{let t=e[0],i=t===128?Jr(e.subarray(1,e.length)):t===255?Qr(e):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},Qr=e=>{for(var t=e.length,i=0,s=!1,r=t-1;r>-1;r--){var h=Number(e[r]),n;s?n=Cs(h):h===0?n=h:(s=!0,n=Ps(h)),n!==0&&(i-=n*256**(t-r-1))}return i},Jr=e=>{for(var t=e.length,i=0,s=t-1;s>-1;s--){var r=Number(e[s]);r!==0&&(i+=r*256**(t-s-1))}return i},Cs=e=>(255^e)&255,Ps=e=>(255^e)+1&255,zs={};Er(zs,{code:()=>ji,isCode:()=>vt,isName:()=>eh,name:()=>Ct,normalFsTypes:()=>Us});var vt=e=>Ct.has(e),eh=e=>ji.has(e),Us=new Set(["0","","1","2","3","4","5","6","7","D"]),Ct=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"]]),ji=new Map(Array.from(Ct).map(e=>[e[1],e[0]])),ae=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,i,s){Buffer.isBuffer(e)?this.decode(e,t||0,i,s):e&&this.#i(e)}decode(e,t,i,s){if(t||=0,!e||!(e.length>=t+512))throw Error("need 512 bytes for header");let r=ue(e,t+156,1),h=Us.has(r),n=h?i:void 0,o=h?s:void 0;if(this.path=n?.path??ue(e,t,100),this.mode=n?.mode??o?.mode??ie(e,t+100,8),this.uid=n?.uid??o?.uid??ie(e,t+108,8),this.gid=n?.gid??o?.gid??ie(e,t+116,8),this.size=n?.size??o?.size??ie(e,t+124,12),this.mtime=n?.mtime??o?.mtime??ei(e,t+136,12),this.cksum=ie(e,t+148,12),o&&this.#i(o,!0),n&&this.#i(n),vt(r)&&(this.#e=r||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=ue(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=n?.uname??o?.uname??ue(e,t+265,32),this.gname=n?.gname??o?.gname??ue(e,t+297,32),this.devmaj=n?.devmaj??o?.devmaj??ie(e,t+329,8)??0,this.devmin=n?.devmin??o?.devmin??ie(e,t+337,8)??0,e[t+475]!==0){let l=ue(e,t+345,155);this.path=l+"/"+this.path}else{let l=ue(e,t+345,130);l&&(this.path=l+"/"+this.path),this.atime=i?.atime??s?.atime??ei(e,t+476,12),this.ctime=i?.ctime??s?.ctime??ei(e,t+488,12)}let a=256;for(let l=t;l<t+148;l++)a+=e[l];for(let l=t+156;l<t+512;l++)a+=e[l];this.cksumValid=a===this.cksum,this.cksum===void 0&&a===256&&(this.nullBlock=!0)}#i(e,t=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,s])=>!(s==null||i==="path"&&t||i==="linkpath"&&t||i==="global"))))}encode(e,t=0){if(e||=this.block=Buffer.alloc(512),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,s=th(this.path||"",i),r=s[0],h=s[1];this.needPax=!!s[2],this.needPax=fe(e,t,100,r)||this.needPax,this.needPax=se(e,t+100,8,this.mode)||this.needPax,this.needPax=se(e,t+108,8,this.uid)||this.needPax,this.needPax=se(e,t+116,8,this.gid)||this.needPax,this.needPax=se(e,t+124,12,this.size)||this.needPax,this.needPax=ti(e,t+136,12,this.mtime)||this.needPax,e[t+156]=Number(this.#e.codePointAt(0)),this.needPax=fe(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=fe(e,t+265,32,this.uname)||this.needPax,this.needPax=fe(e,t+297,32,this.gname)||this.needPax,this.needPax=se(e,t+329,8,this.devmaj)||this.needPax,this.needPax=se(e,t+337,8,this.devmin)||this.needPax,this.needPax=fe(e,t+345,i,h)||this.needPax,e[t+475]===0?(this.needPax=fe(e,t+345,130,h)||this.needPax,this.needPax=ti(e,t+476,12,this.atime)||this.needPax,this.needPax=ti(e,t+488,12,this.ctime)||this.needPax):this.needPax=fe(e,t+345,155,h)||this.needPax;let n=256;for(let o=t;o<t+148;o++)n+=e[o];for(let o=t+156;o<t+512;o++)n+=e[o];return this.cksum=n,se(e,t+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:Ct.get(this.#e)}get typeKey(){return this.#e}set type(e){let t=String(ji.get(e));if(vt(t)||t==="Unsupported")this.#e=t;else if(vt(e))this.#e=e;else throw TypeError("invalid entry type: "+e)}},th=(e,t)=>{let i=e,s="",r,h=Re.parse(e).root||".";if(Buffer.byteLength(i)<100)r=[i,s,!1];else{s=Re.dirname(i),i=Re.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(s)<=t?r=[i,s,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(s)<=t?r=[i.slice(0,99),s,!0]:(i=Re.join(Re.basename(s),i),s=Re.dirname(s));while(s!==h&&r===void 0);r||=[e.slice(0,99),"",!0]}return r},ue=(e,t,i)=>e.subarray(t,t+i).toString("utf8").replace(/\0.*/,""),ei=(e,t,i)=>ih(ie(e,t,i)),ih=e=>e===void 0?void 0:new Date(e*1e3),ie=(e,t,i)=>Number(e[t])&128?qr(e.subarray(t,t+i)):rh(e,t,i),sh=e=>isNaN(e)?void 0:e,rh=(e,t,i)=>sh(parseInt(e.subarray(t,t+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),hh={12:8589934591,8:2097151},se=(e,t,i,s)=>s===void 0?!1:s>hh[i]||s<0?(Vr(s,e.subarray(t,t+i)),!0):(nh(e,t,i,s),!1),nh=(e,t,i,s)=>e.write(oh(s,i),t,i,"ascii"),oh=(e,t)=>ah(Math.floor(e).toString(8),t),ah=(e,t)=>(e.length===t-1?e:Array(t-e.length-1).join("0")+e+" ")+"\0",ti=(e,t,i,s)=>s===void 0?!1:se(e,t,i,s.getTime()/1e3),lh=Array(156).join("\0"),fe=(e,t,i,s)=>s===void 0?!1:(e.write(s+lh,t,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),rt=class js{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,i=!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=i,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(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(t),s=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(s);for(let h=0;h<512;h++)r[h]=0;new ae({path:("PaxHeader/"+dr(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,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(r),r.write(t,512,i,"utf8");for(let h=i+512;h<r.length;h++)r[h]=0;return r}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(this[t]===void 0)return"";let i=this[t],s=i instanceof Date?i.getTime()/1e3:i,r=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+s+`
|
|
2
|
+
`,h=Buffer.byteLength(r),n=Math.floor(Math.log(h)/Math.log(10))+1;return h+n>=10**n&&(n+=1),n+h+r}static parse(t,i,s=!1){return new js(dh(uh(t),i),s)}},dh=(e,t)=>t?Object.assign({},t,e):e,uh=e=>e.replace(/\n$/,"").split(`
|
|
3
|
+
`).reduce(fh,Object.create(null)),fh=(e,t)=>{let i=parseInt(t,10);if(i!==Buffer.byteLength(t)+1)return e;t=t.slice((i+" ").length);let s=t.split("="),r=s.shift();if(!r)return e;let h=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),n=s.join("=");return e[h]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(h)?new Date(Number(n)*1e3):/^[0-9]+$/.test(n)?+n:n,e},u=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32"?e=>e&&e.replaceAll(/\\/g,"/"):e=>e,Hs=class extends _e{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(e,t,i){switch(super({}),this.pause(),this.extended=t,this.globalExtended=i,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.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(!e.path)throw Error("no path provided for tar.ReadEntry");this.path=u(e.path),this.mode=e.mode,this.mode&&(this.mode&=4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?u(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),i&&this.#e(i,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw Error("writing more to entry than is appropriate");let i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-t),this.blockRemain=Math.max(0,s-t),this.ignore?!0:i>=t?super.write(e):super.write(e.subarray(0,i))}#e(e,t=!1){e.path&&=u(e.path),e.linkpath&&=u(e.linkpath),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,s])=>!(s==null||i==="path"&&t))))}},Pt=(e,t,i,s={})=>{e.file&&(s.file=e.file),e.cwd&&(s.cwd=e.cwd),s.code=i instanceof Error&&i.code||t,s.tarCode=t,!e.strict&&s.recoverable!==!1?(i instanceof Error&&(s=Object.assign(i,s),i=i.message),e.emit("warn",t,i,s)):i instanceof Error?e.emit("error",Object.assign(i,s)):e.emit("error",Object.assign(Error(`${t}: ${i}`),s))},ch=1024*1024,bi=Buffer.from([31,139]),gi=Buffer.from([40,181,47,253]),mh=Math.max(bi.length,gi.length),N=Symbol("state"),ce=Symbol("writeEntry"),$=Symbol("readEntry"),ii=Symbol("nextEntry"),ts=Symbol("processEntry"),j=Symbol("extendedHeader"),He=Symbol("globalExtendedHeader"),q=Symbol("meta"),is=Symbol("emitMeta"),y=Symbol("buffer"),Y=Symbol("queue"),Q=Symbol("ended"),si=Symbol("emittedEnd"),me=Symbol("emit"),_=Symbol("unzip"),mt=Symbol("consumeChunk"),pt=Symbol("consumeChunkSub"),ri=Symbol("consumeBody"),ss=Symbol("consumeMeta"),rs=Symbol("consumeHeader"),Ze=Symbol("consuming"),hi=Symbol("bufferConcat"),yt=Symbol("maybeEnd"),ve=Symbol("writing"),J=Symbol("aborted"),bt=Symbol("onDone"),pe=Symbol("sawValidEntry"),gt=Symbol("sawNullBlock"),Et=Symbol("sawEOF"),hs=Symbol("closeStream"),ph=()=>!0,xe=class extends fr{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[Y]=[];[y];[$];[ce];[N]="begin";[q]="";[j];[He];[Q]=!1;[_];[J]=!1;[pe];[gt]=!1;[Et]=!1;[ve]=!1;[Ze]=!1;[si]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(bt,()=>{(this[N]==="begin"||this[pe]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(bt,e.ondone):this.on(bt,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||ch,this.filter=typeof e.filter=="function"?e.filter:ph;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:t?void 0:!1;let i=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:i?!0:void 0,this.on("end",()=>this[hs]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,i={}){Pt(this,e,t,i)}[rs](e,t){this[pe]===void 0&&(this[pe]=!1);let i;try{i=new ae(e,t,this[j],this[He])}catch(s){return this.warn("TAR_ENTRY_INVALID",s)}if(i.nullBlock)this[gt]?(this[Et]=!0,this[N]==="begin"&&(this[N]="header"),this[me]("eof")):(this[gt]=!0,this[me]("nullBlock"));else if(this[gt]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let s=i.type;if(/^(Symbolic)?Link$/.test(s)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(s)&&!/^(Global)?ExtendedHeader$/.test(s)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let r=this[ce]=new Hs(i,this[j],this[He]);this[pe]||(r.remain?r.on("end",()=>{r.invalid||(this[pe]=!0)}):this[pe]=!0),r.meta?r.size>this.maxMetaEntrySize?(r.ignore=!0,this[me]("ignoredEntry",r),this[N]="ignore",r.resume()):r.size>0&&(this[q]="",r.on("data",h=>this[q]+=h),this[N]="meta"):(this[j]=void 0,r.ignore=r.ignore||!this.filter(r.path,r),r.ignore?(this[me]("ignoredEntry",r),this[N]=r.remain?"ignore":"header",r.resume()):(r.remain?this[N]="body":(this[N]="header",r.end()),this[$]?this[Y].push(r):(this[Y].push(r),this[ii]())))}}}[hs](){queueMicrotask(()=>this.emit("close"))}[ts](e){let t=!0;if(!e)this[$]=void 0,t=!1;else if(Array.isArray(e)){let[i,...s]=e;this.emit(i,...s)}else this[$]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[ii]()),t=!1);return t}[ii](){do;while(this[ts](this[Y].shift()));if(this[Y].length===0){let e=this[$];!e||e.flowing||e.size===e.remain?this[ve]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[ri](e,t){let i=this[ce];if(!i)throw Error("attempt to consume body without entry??");let s=i.blockRemain??0,r=s>=e.length&&t===0?e:e.subarray(t,t+s);return i.write(r),i.blockRemain||(this[N]="header",this[ce]=void 0,i.end()),r.length}[ss](e,t){let i=this[ce],s=this[ri](e,t);return!this[ce]&&i&&this[is](i),s}[me](e,t,i){this[Y].length===0&&!this[$]?this.emit(e,t,i):this[Y].push([e,t,i])}[is](e){switch(this[me]("meta",this[q]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[j]=rt.parse(this[q],this[j],!1);break;case"GlobalExtendedHeader":this[He]=rt.parse(this[q],this[He],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[j]??Object.create(null);this[j]=t,t.path=this[q].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[j]||Object.create(null);this[j]=t,t.linkpath=this[q].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+e.type)}}abort(e){this[J]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[J])return i?.(),!1;if((this[_]===void 0||this.brotli===void 0&&this[_]===!1)&&e){if(this[y]&&(e=Buffer.concat([this[y],e]),this[y]=void 0),e.length<mh)return this[y]=e,i?.(),!0;for(let n=0;this[_]===void 0&&n<bi.length;n++)e[n]!==bi[n]&&(this[_]=!1);let r=!1;if(this[_]===!1&&this.zstd!==!1){r=!0;for(let n=0;n<gi.length;n++)if(e[n]!==gi[n]){r=!1;break}}let h=this.brotli===void 0&&!r;if(this[_]===!1&&h)if(e.length<512)if(this[Q])this.brotli=!0;else return this[y]=e,i?.(),!0;else try{new ae(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[_]===void 0||this[_]===!1&&(this.brotli||r)){let n=this[Q];this[Q]=!1,this[_]=this[_]===void 0?new Zr({}):r?new Yr({}):new Gr({}),this[_].on("data",a=>this[mt](a)),this[_].on("error",a=>this.abort(a)),this[_].on("end",()=>{this[Q]=!0,this[mt]()}),this[ve]=!0;let o=!!this[_][n?"end":"write"](e);return this[ve]=!1,i?.(),o}}this[ve]=!0,this[_]?this[_].write(e):this[mt](e),this[ve]=!1;let s=this[Y].length>0?!1:this[$]?this[$].flowing:!0;return!s&&this[Y].length===0&&this[$]?.once("drain",()=>this.emit("drain")),i?.(),s}[hi](e){e&&!this[J]&&(this[y]=this[y]?Buffer.concat([this[y],e]):e)}[yt](){if(this[Q]&&!this[si]&&!this[J]&&!this[Ze]){this[si]=!0;let e=this[ce];if(e&&e.blockRemain){let t=this[y]?this[y].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[y]&&e.write(this[y]),e.end()}this[me](bt)}}[mt](e){if(this[Ze]&&e)this[hi](e);else if(!e&&!this[y])this[yt]();else if(e){if(this[Ze]=!0,this[y]){this[hi](e);let t=this[y];this[y]=void 0,this[pt](t)}else this[pt](e);for(;this[y]&&this[y]?.length>=512&&!this[J]&&!this[Et];){let t=this[y];this[y]=void 0,this[pt](t)}this[Ze]=!1}(!this[y]||this[Q])&&this[yt]()}[pt](e){let t=0,i=e.length;for(;t+512<=i&&!this[J]&&!this[Et];)switch(this[N]){case"begin":case"header":this[rs](e,t),t+=512;break;case"ignore":case"body":t+=this[ri](e,t);break;case"meta":t+=this[ss](e,t);break;default:throw Error("invalid state: "+this[N])}t<i&&(this[y]=this[y]?Buffer.concat([e.subarray(t),this[y]]):e.subarray(t))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t)),i&&this.once("finish",i),this[J]||(this[_]?(e&&this[_].write(e),this[_].end()):(this[Q]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e||=Buffer.alloc(0)),e&&this.write(e),this[yt]())),this}},qe=e=>{let t=e.length-1,i=-1;for(;t>-1&&e.charAt(t)==="/";)i=t,t--;return i===-1?e:e.slice(0,i)},yh=e=>{let t=e.onReadEntry;e.onReadEntry=t?i=>{t(i),i.resume()}:i=>i.resume()},Hi=(e,t)=>{let i=new Map(t.map(h=>[qe(h),!0])),s=e.filter,r=(h,n="")=>{let o=n||mr(h).root||".",a;if(h===o)a=!1;else{let l=i.get(h);a=l===void 0?r(pr(h),o):l}return i.set(h,a),a};e.filter=s?(h,n)=>s(h,n)&&r(qe(h)):h=>r(qe(h))},Be=ht(e=>{let t=new xe(e),i=e.file,s;try{s=d.openSync(i,"r");let r=d.fstatSync(s),h=e.maxReadSize||16*1024*1024;if(r.size<h){let n=Buffer.allocUnsafe(r.size),o=d.readSync(s,n,0,r.size,0);t.end(o===n.byteLength?n:n.subarray(0,o))}else{let n=0,o=Buffer.allocUnsafe(h);for(;n<r.size;){let a=d.readSync(s,o,0,h,n);if(a===0)break;n+=a,t.write(o.subarray(0,a))}t.end()}}finally{if(typeof s=="number")try{d.closeSync(s)}catch{}}},(e,t)=>{let i=new xe(e),s=e.maxReadSize||16*1024*1024,r=e.file;return new Promise((h,n)=>{i.on("error",n),i.on("end",h),d.stat(r,(o,a)=>{if(o)n(o);else{let l=new Pi(r,{readSize:s,size:a.size});l.on("error",n),l.pipe(i)}})})},e=>new xe(e),e=>new xe(e),(e,t)=>{t?.length&&Hi(e,t),e.noResume||yh(e)}),Zs=(e,t,i)=>(e&=4095,i&&(e=(e|384)&-19),t&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),{isAbsolute:bh,parse:ns}=ur,Zi=e=>{let t="",i=ns(e);for(;bh(e)||i.root;){let s=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":i.root;e=e.slice(s.length),t+=s,i=ns(e)}return[t,e]},zt=["|","<",">","?",":"],Wi=zt.map(e=>String.fromCodePoint(61440+Number(e.codePointAt(0)))),gh=new Map(zt.map((e,t)=>[e,Wi[t]])),Eh=new Map(Wi.map((e,t)=>[e,zt[t]])),os=e=>zt.reduce((t,i)=>t.split(i).join(gh.get(i)),e),wh=e=>Wi.reduce((t,i)=>t.split(i).join(Eh.get(i)),e),Ws=(e,t)=>t?(e=u(e).replace(/^\.(\/|$)/,""),qe(t)+"/"+e):u(e),_h=16*1024*1024,as=Symbol("process"),ls=Symbol("file"),ds=Symbol("directory"),Ei=Symbol("symlink"),us=Symbol("hardlink"),We=Symbol("header"),Ot=Symbol("read"),wi=Symbol("lstat"),Tt=Symbol("onlstat"),_i=Symbol("onread"),Ri=Symbol("onreadlink"),Si=Symbol("openfile"),vi=Symbol("onopenfile"),re=Symbol("close"),It=Symbol("mode"),Oi=Symbol("awaitDrain"),ni=Symbol("ondrain"),H=Symbol("prefix"),Gi=class extends _e{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;#e=!1;constructor(e,t={}){let i=zi(t);super(),this.path=u(e),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||_h,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=u(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?u(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){let[h,n]=Zi(this.path);h&&typeof n=="string"&&(this.path=n,s=h)}this.win32=!!i.win32||process.platform==="win32",this.win32&&(this.path=wh(this.path.replaceAll(/\\/g,"/")),e=e.replaceAll(/\\/g,"/")),this.absolute=u(i.absolute||st.resolve(this.cwd,e)),this.path===""&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});let r=this.statCache.get(this.absolute);r?this[Tt](r):this[wi]()}warn(e,t,i={}){return Pt(this,e,t,i)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[wi](){p.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Tt](t)})}[Tt](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=Rh(e),this.emit("stat",e),this[as]()}[as](){switch(this.type){case"File":return this[ls]();case"Directory":return this[ds]();case"SymbolicLink":return this[Ei]();default:return this.end()}}[It](e){return Zs(e,this.type==="Directory",this.portable)}[H](e){return Ws(e,this.prefix)}[We](){if(!this.stat)throw Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new ae({path:this[H](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[H](this.linkpath):this.linkpath,mode:this[It](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:this.type==="Unsupported"?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 rt({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[H](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[H](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());let e=this.header?.block;if(!e)throw Error("failed to encode header");super.write(e)}[ds](){if(!this.stat)throw Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[We](),this.end()}[Ei](){p.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Ri](t)})}[Ri](e){this.linkpath=u(e),this[We](),this.end()}[us](e){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=u(st.relative(this.cwd,e)),this.stat.size=0,this[We](),this.end()}[ls](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[us](t);this.linkCache.set(e,this.absolute)}if(this[We](),this.stat.size===0)return this.end();this[Si]()}[Si](){p.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[vi](t)})}[vi](e){if(this.fd=e,this.#e)return this[re]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Ot]()}[Ot](){let{fd:e,buf:t,offset:i,length:s,pos:r}=this;if(e===void 0||t===void 0)throw Error("cannot read file without first opening");p.read(e,t,i,s,r,(h,n)=>{if(h)return this[re](()=>this.emit("error",h));this[_i](n)})}[re](e=()=>{}){this.fd!==void 0&&p.close(this.fd,e)}[_i](e){if(e<=0&&this.remain>0){let i=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[re](()=>this.emit("error",i))}if(e>this.remain){let i=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[re](()=>this.emit("error",i))}if(!this.buf)throw Error("should have created buffer prior to reading");if(e===this.remain)for(let i=e;i<this.length&&e<this.blockRemain;i++)this.buf[i+this.offset]=0,e++,this.remain++;let t=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(t)?this[ni]():this[Oi](()=>this[ni]())}[Oi](e){this.once("drain",e)}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemain<e.length){let s=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",s)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,i)}[ni](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[re](e=>e?this.emit("error",e):this.end());if(!this.buf)throw 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[Ot]()}},Gs=class extends Gi{sync=!0;[wi](){this[Tt](p.lstatSync(this.absolute))}[Ei](){this[Ri](p.readlinkSync(this.absolute))}[Si](){this[vi](p.openSync(this.absolute,"r"))}[Ot](){let e=!0;try{let{fd:t,buf:i,offset:s,length:r,pos:h}=this;if(t===void 0||i===void 0)throw Error("fd and buf must be set in READ method");let n=p.readSync(t,i,s,r,h);this[_i](n),e=!1}finally{if(e)try{this[re](()=>{})}catch{}}}[Oi](e){e()}[re](e=()=>{}){this.fd!==void 0&&p.closeSync(this.fd),e()}},$s=class extends _e{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(e,t,i={}){return Pt(this,e,t,i)}constructor(e,t={}){let i=zi(t);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=e;let{type:s}=e;if(s==="Unsupported")throw Error("writing entry that should be ignored");this.type=s,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=u(e.path),this.mode=e.mode===void 0?void 0:this[It](e.mode),this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:i.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath===void 0?void 0:u(e.linkpath),typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){let[n,o]=Zi(this.path);n&&typeof o=="string"&&(this.path=o,r=n)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new ae({path:this[H](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[H](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 rt({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[H](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[H](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());let h=this.header?.block;if(!h)throw Error("failed to encode header");super.write(h),e.pipe(this)}[H](e){return Ws(e,this.prefix)}[It](e){return Zs(e,this.type==="Directory",this.portable)}write(e,t,i){typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let s=e.length;if(s>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(e,i)}end(e,t,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),i&&this.once("finish",i),e?super.end(e,i):super.end(i),this}},Rh=e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported",Sh=class De{tail;head;length=0;static create(t=[]){return new De(t)}constructor(t=[]){for(let i of t)this.push(i)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw Error("removing node which does not belong to this list");let i=t.next,s=t.prev;return i&&(i.prev=s),s&&(s.next=i),t===this.head&&(this.head=i),t===this.tail&&(this.tail=s),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,i}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let i=this.head;t.list=this,t.next=i,i&&(i.prev=t),this.head=t,this.tail||=t,this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let i=this.tail;t.list=this,t.prev=i,i&&(i.next=t),this.tail=t,this.head||=t,this.length++}push(...t){for(let i=0,s=t.length;i<s;i++)Oh(this,t[i]);return this.length}unshift(...t){for(var i=0,s=t.length;i<s;i++)Th(this,t[i]);return this.length}pop(){if(!this.tail)return;let t=this.tail.value,i=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,i.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,i=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,i.list=void 0,this.length--,t}forEach(t,i){i||=this;for(let s=this.head,r=0;s;r++)t.call(i,s.value,r,this),s=s.next}forEachReverse(t,i){i||=this;for(let s=this.tail,r=this.length-1;s;r--)t.call(i,s.value,r,this),s=s.prev}get(t){let i=0,s=this.head;for(;s&&i<t;i++)s=s.next;if(i===t&&s)return s.value}getReverse(t){let i=0,s=this.tail;for(;s&&i<t;i++)s=s.prev;if(i===t&&s)return s.value}map(t,i){i||=this;let s=new De;for(let r=this.head;r;)s.push(t.call(i,r.value,this)),r=r.next;return s}mapReverse(t,i){i||=this;var s=new De;for(let r=this.tail;r;)s.push(t.call(i,r.value,this)),r=r.prev;return s}reduce(t,i){let s,r=this.head;if(arguments.length>1)s=i;else if(this.head)r=this.head.next,s=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var h=0;r;h++)s=t(s,r.value,h),r=r.next;return s}reduceReverse(t,i){let s,r=this.tail;if(arguments.length>1)s=i;else if(this.tail)r=this.tail.prev,s=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let h=this.length-1;r;h--)s=t(s,r.value,h),r=r.prev;return s}toArray(){let t=Array(this.length);for(let i=0,s=this.head;s;i++)t[i]=s.value,s=s.next;return t}toArrayReverse(){let t=Array(this.length);for(let i=0,s=this.tail;s;i++)t[i]=s.value,s=s.prev;return t}slice(t=0,i=this.length){i<0&&(i+=this.length),t<0&&(t+=this.length);let s=new De;if(i<t||i<0)return s;t<0&&(t=0),i>this.length&&(i=this.length);let r=this.head,h=0;for(h=0;r&&h<t;h++)r=r.next;for(;r&&h<i;h++,r=r.next)s.push(r.value);return s}sliceReverse(t=0,i=this.length){i<0&&(i+=this.length),t<0&&(t+=this.length);let s=new De;if(i<t||i<0)return s;t<0&&(t=0),i>this.length&&(i=this.length);let r=this.length,h=this.tail;for(;h&&r>i;r--)h=h.prev;for(;h&&r>t;r--,h=h.prev)s.push(h.value);return s}splice(t,i=0,...s){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let r=this.head;for(let n=0;r&&n<t;n++)r=r.next;let h=[];for(let n=0;r&&n<i;n++)h.push(r.value),r=this.removeNode(r);r?r!==this.tail&&(r=r.prev):r=this.tail;for(let n of s)r=vh(this,r,n);return h}reverse(){let t=this.head,i=this.tail;for(let s=t;s;s=s.prev){let r=s.prev;s.prev=s.next,s.next=r}return this.head=i,this.tail=t,this}};function vh(e,t,i){let s=new $i(i,t,t?t.next:e.head,e);return s.next===void 0&&(e.tail=s),s.prev===void 0&&(e.head=s),e.length++,s}function Oh(e,t){e.tail=new $i(t,e.tail,void 0,e),e.head||=e.tail,e.length++}function Th(e,t){e.head=new $i(t,void 0,e.head,e),e.tail||=e.head,e.length++}var $i=class{list;next;prev;value;constructor(e,t,i,s){this.list=s,this.value=e,t?(t.next=this,this.prev=t):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}},Ti=class{path;absolute;entry;stat;readdir;pending=!1;pendingLink=!1;ignore=!1;piped=!1;constructor(e,t){this.path=e||"./",this.absolute=t}},fs=Buffer.alloc(1024),kt=Symbol("onStat"),Ge=Symbol("ended"),F=Symbol("queue"),$e=Symbol("pendingLinks"),ee=Symbol("current"),ye=Symbol("process"),Ye=Symbol("processing"),wt=Symbol("processJob"),M=Symbol("jobs"),oi=Symbol("jobDone"),Lt=Symbol("addFSEntry"),cs=Symbol("addTarEntry"),ki=Symbol("stat"),Li=Symbol("readdir"),At=Symbol("onreaddir"),Dt=Symbol("pipe"),ms=Symbol("entry"),ai=Symbol("entryOpt"),xt=Symbol("writeEntryClass"),Ys=Symbol("write"),li=Symbol("ondrain"),nt=class extends _e{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[xt];onWriteEntry;[F];[$e]=new Map;[M]=0;[Ye]=!1;[Ge]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=u(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[xt]=Gi,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if(+!!e.gzip+ +!!e.brotli+ +!!e.zstd>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new Hr(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new Wr(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new $r(e.zstd)),!this.zip)throw Error("impossible");let t=this.zip;t.on("data",i=>super.write(i)),t.on("end",()=>super.end()),t.on("drain",()=>this[li]()),this.on("resume",()=>t.resume())}else this.on("drain",this[li]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[F]=new Sh,this[M]=0,this.jobs=Number(e.jobs)||4,this[Ye]=!1,this[Ge]=!1}[Ys](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&this.add(e),this[Ge]=!0,this[ye](),i&&i(),this}write(e){if(this[Ge])throw Error("write after end");return typeof e=="string"?this[Lt](e):this[cs](e),this.flowing}[cs](e){let t=u(st.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let i=new Ti(e.path,t);i.entry=new $s(e,this[ai](i)),i.entry.on("end",()=>this[oi](i)),this[M]+=1,this[F].push(i)}this[ye]()}[Lt](e){let t=u(st.resolve(this.cwd,e));this[F].push(new Ti(e,t)),this[ye]()}[ki](e){e.pending=!0,this[M]+=1,p[this.follow?"stat":"lstat"](e.absolute,(t,i)=>{e.pending=!1,--this[M],t?this.emit("error",t):this[kt](e,i)})}[kt](e,t){if(this.statCache.set(e.absolute,t),e.stat=t,!this.filter(e.path,t))e.ignore=!0;else if(t.isFile()&&t.nlink>1&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync)if(e===this[ee])this[wt](e);else{let i=`${t.dev}:${t.ino}`,s=this[$e].get(i);s?s.push(e):this[$e].set(i,[e]),e.pendingLink=!0,e.pending=!0}this[ye]()}[Li](e){e.pending=!0,this[M]+=1,p.readdir(e.absolute,(t,i)=>{if(e.pending=!1,--this[M],t)return this.emit("error",t);this[At](e,i)})}[At](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[ye]()}[ye](){if(!this[Ye]){this[Ye]=!0;for(let e=this[F].head;e&&this[M]<this.jobs;e=e.next)if(this[wt](e.value),e.value.ignore){let t=e.next;this[F].removeNode(e),e.next=t}this[Ye]=!1,this[Ge]&&this[F].length===0&&this[M]===0&&(this.zip?this.zip.end(fs):(super.write(fs),super.end()))}}get[ee](){return this[F]&&this[F].head&&this[F].head.value}[oi](e){this[F].shift(),--this[M];let{stat:t}=e;if(t&&t.isFile()&&t.nlink>1){let i=`${t.dev}:${t.ino}`,s=this[$e].get(i);if(s){this[$e].delete(i);for(let r of s)r.pending=!1,this[wt](r)}}this[ye]()}[wt](e){if(e.pending&&e.pendingLink&&e===this[ee]&&(e.pending=!1,e.pendingLink=!1),!e.pending){if(e.entry){e===this[ee]&&!e.piped&&this[Dt](e);return}if(!e.stat){let t=this.statCache.get(e.absolute);t?this[kt](e,t):this[ki](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let t=this.readdirCache.get(e.absolute);if(t?this[At](e,t):this[Li](e),!e.readdir)return}if(e.entry=this[ms](e),!e.entry){e.ignore=!0;return}e===this[ee]&&!e.piped&&this[Dt](e)}}}[ai](e){return{onwarn:(t,i,s)=>this.warn(t,i,s),noPax:this.noPax,cwd:this.cwd,absolute:e.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}}[ms](e){this[M]+=1;try{return new this[xt](e.path,this[ai](e)).on("end",()=>this[oi](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[li](){this[ee]&&this[ee].entry&&this[ee].entry.resume()}[Dt](e){e.piped=!0,e.readdir&&e.readdir.forEach(s=>{let r=e.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[Lt](h+s)});let t=e.entry,i=this.zip;if(!t)throw Error("cannot pipe without source");i?t.on("data",s=>{i.write(s)||t.pause()}):t.on("data",s=>{super.write(s)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,i={}){Pt(this,e,t,i)}},Ut=class extends nt{sync=!0;constructor(e){super(e),this[xt]=Gs}pause(){}resume(){}[ki](e){let t=this.follow?"statSync":"lstatSync";this[kt](e,p[t](e.absolute))}[Li](e){this[At](e,p.readdirSync(e.absolute))}[Dt](e){let t=e.entry,i=this.zip;if(e.readdir&&e.readdir.forEach(s=>{let r=e.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[Lt](h+s)}),!t)throw Error("Cannot pipe without source");i?t.on("data",s=>{i.write(s)}):t.on("data",s=>{super[Ys](s)})}},kh=(e,t)=>{let i=new Ut(e),s=new Is(e.file,{mode:e.mode||438});i.pipe(s),Vs(i,t)},Lh=(e,t)=>{let i=new nt(e),s=new Mt(e.file,{mode:e.mode||438});i.pipe(s);let r=new Promise((h,n)=>{s.on("error",n),s.on("close",h),i.on("error",n)});return Ks(i,t).catch(h=>i.emit("error",h)),r},Vs=(e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Be({file:c.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:s=>e.add(s)}):e.add(i)}),e.end()},Ks=async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Be({file:c.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:s=>{e.add(s)}}):e.add(i);e.end()},ps=ht(kh,Lh,(e,t)=>{let i=new Ut(e);return Vs(i,t),i},(e,t)=>{let i=new nt(e);return Ks(i,t).catch(s=>i.emit("error",s)),i},(e,t)=>{if(!t?.length)throw TypeError("no paths specified to add to archive")}),Xs=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",{O_CREAT:qs,O_NOFOLLOW:ys,O_TRUNC:Qs,O_WRONLY:Js}=p.constants,er=Number(process.env.__FAKE_FS_O_FILENAME__)||p.constants.UV_FS_O_FILEMAP||0,Ah=Xs&&!!er,Dh=512*1024,xh=er|Qs|qs|Js,bs=!Xs&&typeof ys=="number"?ys|Qs|qs|Js:null,tr=bs===null?Ah?e=>e<Dh?xh:"w":()=>"w":()=>bs,Ai=(e,t,i)=>{try{return d.lchownSync(e,t,i)}catch(s){if(s?.code!=="ENOENT")throw s}},Bt=(e,t,i,s)=>{d.lchown(e,t,i,r=>{s(r&&r?.code!=="ENOENT"?r:null)})},Nh=(e,t,i,s,r)=>{t.isDirectory()?ir(c.resolve(e,t.name),i,s,h=>{if(h)return r(h);Bt(c.resolve(e,t.name),i,s,r)}):Bt(c.resolve(e,t.name),i,s,r)},ir=(e,t,i,s)=>{d.readdir(e,{withFileTypes:!0},(r,h)=>{if(r){if(r.code==="ENOENT")return s();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return s(r)}if(r||!h.length)return Bt(e,t,i,s);let n=h.length,o=null,a=l=>{if(!o){if(l)return s(o=l);if(--n===0)return Bt(e,t,i,s)}};for(let l of h)Nh(e,l,t,i,a)})},Ih=(e,t,i,s)=>{t.isDirectory()&&sr(c.resolve(e,t.name),i,s),Ai(c.resolve(e,t.name),i,s)},sr=(e,t,i)=>{let s;try{s=d.readdirSync(e,{withFileTypes:!0})}catch(r){let h=r;if(h?.code==="ENOENT")return;if(h?.code==="ENOTDIR"||h?.code==="ENOTSUP")return Ai(e,t,i);throw h}for(let r of s)Ih(e,r,t,i);return Ai(e,t,i)},rr=class extends Error{path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}},jt=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}},Bh=(e,t)=>{d.stat(e,(i,s)=>{(i||!s.isDirectory())&&(i=new rr(e,i?.code||"ENOTDIR")),t(i)})},Fh=(e,t,i)=>{e=u(e);let s=t.umask??18,r=t.mode|448,h=(r&s)!==0,n=t.uid,o=t.gid,a=typeof n=="number"&&typeof o=="number"&&(n!==t.processUid||o!==t.processGid),l=t.preserve,f=t.unlink,b=u(t.cwd),g=(T,w)=>{T?i(T):w&&a?ir(w,n,o,k=>g(k)):h?d.chmod(e,r,i):i()};if(e===b)return Bh(e,g);if(l)return lr.mkdir(e,{mode:r,recursive:!0}).then(T=>g(null,T??void 0),g);Di(b,u(c.relative(b,e)).split("/"),r,f,b,void 0,g)},Di=(e,t,i,s,r,h,n)=>{if(t.length===0)return n(null,h);let o=t.shift(),a=u(c.resolve(e+"/"+o));d.mkdir(a,i,hr(a,t,i,s,r,h,n))},hr=(e,t,i,s,r,h,n)=>o=>{o?d.lstat(e,(a,l)=>{if(a)a.path=a.path&&u(a.path),n(a);else if(l.isDirectory())Di(e,t,i,s,r,h,n);else if(s)d.unlink(e,f=>{if(f)return n(f);d.mkdir(e,i,hr(e,t,i,s,r,h,n))});else{if(l.isSymbolicLink())return n(new jt(e,e+"/"+t.join("/")));n(o)}}):(h||=e,Di(e,t,i,s,r,h,n))},Mh=e=>{let t=!1,i;try{t=d.statSync(e).isDirectory()}catch(s){i=s?.code}finally{if(!t)throw new rr(e,i??"ENOTDIR")}},Ch=(e,t)=>{e=u(e);let i=t.umask??18,s=t.mode|448,r=(s&i)!==0,h=t.uid,n=t.gid,o=typeof h=="number"&&typeof n=="number"&&(h!==t.processUid||n!==t.processGid),a=t.preserve,l=t.unlink,f=u(t.cwd),b=w=>{w&&o&&sr(w,h,n),r&&d.chmodSync(e,s)};if(e===f)return Mh(f),b();if(a)return b(d.mkdirSync(e,{mode:s,recursive:!0})??void 0);let g=u(c.relative(f,e)).split("/"),T;for(let w=g.shift(),k=f;w&&(k+="/"+w);w=g.shift()){k=u(c.resolve(k));try{d.mkdirSync(k,s),T||=k}catch{let Yi=d.lstatSync(k);if(Yi.isDirectory())continue;if(l){d.unlinkSync(k),d.mkdirSync(k,s),T||=k;continue}else if(Yi.isSymbolicLink())return new jt(k,k+"/"+g.join("/"))}}return b(T)},di=Object.create(null),gs=1e4,Oe=new Set,Ph=e=>{Oe.has(e)?Oe.delete(e):di[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Oe.add(e);let t=di[e],i=Oe.size-gs;if(i>gs/10){for(let s of Oe)if(Oe.delete(s),delete di[s],--i<=0)break}return t},zh=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",Uh=e=>e.split("/").slice(0,-1).reduce((t,i)=>{let s=t.at(-1);return s!==void 0&&(i=As(s,i)),t.push(i||"/"),t},[]),jh=class{#e=new Map;#i=new Map;#s=new Set;reserve(e,t){e=zh?["win32 parallelization disabled"]:e.map(s=>qe(As(Ph(s))));let i=new Set(e.map(s=>Uh(s)).reduce((s,r)=>s.concat(r)));this.#i.set(t,{dirs:i,paths:e});for(let s of e){let r=this.#e.get(s);r?r.push(t):this.#e.set(s,[t])}for(let s of i){let r=this.#e.get(s);if(!r)this.#e.set(s,[new Set([t])]);else{let h=r.at(-1);h instanceof Set?h.add(t):r.push(new Set([t]))}}return this.#r(t)}#h(e){let t=this.#i.get(e);if(!t)throw Error("function does not have any path reservations");return{paths:t.paths.map(i=>this.#e.get(i)),dirs:[...t.dirs].map(i=>this.#e.get(i))}}check(e){let{paths:t,dirs:i}=this.#h(e);return t.every(s=>s&&s[0]===e)&&i.every(s=>s&&s[0]instanceof Set&&s[0].has(e))}#r(e){return this.#s.has(e)||!this.check(e)?!1:(this.#s.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#s.has(e))return!1;let t=this.#i.get(e);if(!t)throw Error("invalid reservation");let{paths:i,dirs:s}=t,r=new Set;for(let h of i){let n=this.#e.get(h);if(!n||n?.[0]!==e)continue;let o=n[1];if(!o){this.#e.delete(h);continue}if(n.shift(),typeof o=="function")r.add(o);else for(let a of o)r.add(a)}for(let h of s){let n=this.#e.get(h),o=n?.[0];if(!(!n||!(o instanceof Set)))if(o.size===1&&n.length===1){this.#e.delete(h);continue}else if(o.size===1){n.shift();let a=n[0];typeof a=="function"&&r.add(a)}else o.delete(e)}return this.#s.delete(e),r.forEach(h=>this.#r(h)),!0}},Hh=()=>process.umask(),Es=Symbol("onEntry"),xi=Symbol("checkFs"),ws=Symbol("checkFs2"),Ni=Symbol("isReusable"),I=Symbol("makeFs"),Ii=Symbol("file"),Bi=Symbol("directory"),Nt=Symbol("link"),_s=Symbol("symlink"),Rs=Symbol("hardlink"),Ke=Symbol("ensureNoSymlink"),Ss=Symbol("unsupported"),vs=Symbol("checkPath"),ui=Symbol("stripAbsolutePath"),he=Symbol("mkdir"),O=Symbol("onError"),_t=Symbol("pending"),Os=Symbol("pend"),Te=Symbol("unpend"),fi=Symbol("ended"),ci=Symbol("maybeClose"),Fi=Symbol("skip"),Qe=Symbol("doChown"),Je=Symbol("uid"),et=Symbol("gid"),tt=Symbol("checkedCwd"),it=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",Zh=1024,Wh=(e,t)=>{if(!it)return d.unlink(e,t);let i=e+".DELETE."+xs(16).toString("hex");d.rename(e,i,s=>{if(s)return t(s);d.unlink(i,t)})},Gh=e=>{if(!it)return d.unlinkSync(e);let t=e+".DELETE."+xs(16).toString("hex");d.renameSync(e,t),d.unlinkSync(t)},Ts=(e,t,i)=>e!==void 0&&e===e>>>0?e:t!==void 0&&t===t>>>0?t:i,Ft=class extends xe{[fi]=!1;[tt]=!1;[_t]=0;reservations=new jh;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[fi]=!0,this[ci]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=e.preserveOwner===void 0&&typeof e.uid!="number"?!!(process.getuid&&process.getuid()===0):!!e.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=typeof e.maxDepth=="number"?e.maxDepth:Zh,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||it,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=u(c.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:Hh():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[Es](t))}warn(e,t,i={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(i.recoverable=!1),super.warn(e,t,i)}[ci](){this[fi]&&this[_t]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[ui](e,t){let i=e[t],{type:s}=e;if(!i||this.preservePaths)return!0;let[r,h]=Zi(i),n=h.replaceAll(/\\/g,"/").split("/");if(n.includes("..")||it&&/^[a-z]:\.\.$/i.test(n[0]??"")){if(t==="path"||s==="Link")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:i}),!1;let o=c.posix.dirname(e.path),a=c.posix.normalize(c.posix.join(o,n.join("/")));if(a.startsWith("../")||a==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:i}),!1}return r&&(e[t]=String(h),this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute ${t}`,{entry:e,[t]:i})),!0}[vs](e){let t=u(e.path),i=t.split("/");if(this.strip){if(i.length<this.strip)return!1;if(e.type==="Link"){let s=u(String(e.linkpath)).split("/");if(s.length>=this.strip)e.linkpath=s.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),e.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[ui](e,"path")||!this[ui](e,"linkpath"))return!1;if(e.absolute=c.isAbsolute(e.path)?u(c.resolve(e.path)):u(c.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:u(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:s}=c.win32.parse(String(e.absolute));e.absolute=s+os(String(e.absolute).slice(s.length));let{root:r}=c.win32.parse(e.path);e.path=r+os(e.path.slice(r.length))}return!0}[Es](e){if(!this[vs](e))return e.resume();switch(br.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode|=448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[xi](e);default:return this[Ss](e)}}[O](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[Te](),t.resume())}[he](e,t,i){Fh(u(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t},i)}[Qe](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[Je](e){return Ts(this.uid,e.uid,this.processUid)}[et](e){return Ts(this.gid,e.gid,this.processGid)}[Ii](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=new Mt(String(e.absolute),{flags:tr(e.size),mode:i,autoClose:!1});s.on("error",o=>{s.fd&&d.close(s.fd,()=>{}),s.write=()=>!0,this[O](o,e),t()});let r=1,h=o=>{if(o){s.fd&&d.close(s.fd,()=>{}),this[O](o,e),t();return}--r===0&&s.fd!==void 0&&d.close(s.fd,a=>{a?this[O](a,e):this[Te](),t()})};s.on("finish",()=>{let o=String(e.absolute),a=s.fd;if(typeof a=="number"&&e.mtime&&!this.noMtime){r++;let l=e.atime||new Date,f=e.mtime;d.futimes(a,l,f,b=>b?d.utimes(o,l,f,g=>h(g&&b)):h())}if(typeof a=="number"&&this[Qe](e)){r++;let l=this[Je](e),f=this[et](e);typeof l=="number"&&typeof f=="number"&&d.fchown(a,l,f,b=>b?d.chown(o,l,f,g=>h(g&&b)):h())}h()});let n=this.transform&&this.transform(e)||e;n!==e&&(n.on("error",o=>{this[O](o,e),t()}),e.pipe(n)),n.pipe(s)}[Bi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode;this[he](String(e.absolute),i,s=>{if(s){this[O](s,e),t();return}let r=1,h=()=>{--r===0&&(t(),this[Te](),e.resume())};e.mtime&&!this.noMtime&&(r++,d.utimes(String(e.absolute),e.atime||new Date,e.mtime,h)),this[Qe](e)&&(r++,d.chown(String(e.absolute),Number(this[Je](e)),Number(this[et](e)),h)),h()})}[Ss](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[_s](e,t){let i=u(c.relative(this.cwd,c.resolve(c.dirname(String(e.absolute)),String(e.linkpath)))).split("/");this[Ke](e,this.cwd,i,()=>this[Nt](e,String(e.linkpath),"symlink",t),s=>{this[O](s,e),t()})}[Rs](e,t){let i=u(c.resolve(this.cwd,String(e.linkpath))),s=u(String(e.linkpath)).split("/");this[Ke](e,this.cwd,s,()=>this[Nt](e,i,"link",t),r=>{this[O](r,e),t()})}[Ke](e,t,i,s,r){let h=i.shift();if(this.preservePaths||h===void 0)return s();let n=c.resolve(t,h);d.lstat(n,(o,a)=>{if(o)return s();if(a?.isSymbolicLink())return r(new jt(n,c.resolve(n,i.join("/"))));this[Ke](e,n,i,s,r)})}[Os](){this[_t]++}[Te](){this[_t]--,this[ci]()}[Fi](e){this[Te](),e.resume()}[Ni](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!it}[xi](e){this[Os]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,i=>this[ws](e,i))}[ws](e,t){let i=n=>{t(n)},s=()=>{this[he](this.cwd,this.dmode,n=>{if(n){this[O](n,e),i();return}this[tt]=!0,r()})},r=()=>{if(e.absolute!==this.cwd){let n=u(c.dirname(String(e.absolute)));if(n!==this.cwd)return this[he](n,this.dmode,o=>{if(o){this[O](o,e),i();return}h()})}h()},h=()=>{d.lstat(String(e.absolute),(n,o)=>{if(o&&(this.keep||this.newer&&o.mtime>(e.mtime??o.mtime))){this[Fi](e),i();return}if(n||this[Ni](e,o))return this[I](null,e,i);if(o.isDirectory()){if(e.type==="Directory"){let a=this.chmod&&e.mode&&(o.mode&4095)!==e.mode,l=f=>this[I](f??null,e,i);return a?d.chmod(String(e.absolute),Number(e.mode),l):l()}if(e.absolute!==this.cwd)return d.rmdir(String(e.absolute),a=>this[I](a??null,e,i))}if(e.absolute===this.cwd)return this[I](null,e,i);Wh(String(e.absolute),a=>this[I](a??null,e,i))})};this[tt]?r():s()}[I](e,t,i){if(e){this[O](e,t),i();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[Ii](t,i);case"Link":return this[Rs](t,i);case"SymbolicLink":return this[_s](t,i);case"Directory":case"GNUDumpDir":return this[Bi](t,i)}}[Nt](e,t,i,s){d[i](t,String(e.absolute),r=>{r?this[O](r,e):(this[Te](),e.resume()),s()})}},Ve=e=>{try{return[null,e()]}catch(t){return[t,null]}},Mi=class extends Ft{sync=!0;[I](e,t){return super[I](e,t,()=>{})}[xi](e){if(!this[tt]){let r=this[he](this.cwd,this.dmode);if(r)return this[O](r,e);this[tt]=!0}if(e.absolute!==this.cwd){let r=u(c.dirname(String(e.absolute)));if(r!==this.cwd){let h=this[he](r,this.dmode);if(h)return this[O](h,e)}}let[t,i]=Ve(()=>d.lstatSync(String(e.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(e.mtime??i.mtime)))return this[Fi](e);if(t||this[Ni](e,i))return this[I](null,e);if(i.isDirectory()){if(e.type==="Directory"){let[h]=this.chmod&&e.mode&&(i.mode&4095)!==e.mode?Ve(()=>{d.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[I](h,e)}let[r]=Ve(()=>d.rmdirSync(String(e.absolute)));this[I](r,e)}let[s]=e.absolute===this.cwd?[]:Ve(()=>Gh(String(e.absolute)));this[I](s,e)}[Ii](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=n=>{let o;try{d.closeSync(r)}catch(a){o=a}(n||o)&&this[O](n||o,e),t()},r;try{r=d.openSync(String(e.absolute),tr(e.size),i)}catch(n){return s(n)}let h=this.transform&&this.transform(e)||e;h!==e&&(h.on("error",n=>this[O](n,e)),e.pipe(h)),h.on("data",n=>{try{d.writeSync(r,n,0,n.length)}catch(o){s(o)}}),h.on("end",()=>{let n=null;if(e.mtime&&!this.noMtime){let o=e.atime||new Date,a=e.mtime;try{d.futimesSync(r,o,a)}catch(l){try{d.utimesSync(String(e.absolute),o,a)}catch{n=l}}}if(this[Qe](e)){let o=this[Je](e),a=this[et](e);try{d.fchownSync(r,Number(o),Number(a))}catch(l){try{d.chownSync(String(e.absolute),Number(o),Number(a))}catch{n||=l}}}s(n)})}[Bi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode,s=this[he](String(e.absolute),i);if(s){this[O](s,e),t();return}if(e.mtime&&!this.noMtime)try{d.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Qe](e))try{d.chownSync(String(e.absolute),Number(this[Je](e)),Number(this[et](e)))}catch{}t(),e.resume()}[he](e,t){try{return Ch(u(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t})}catch(i){return i}}[Ke](e,t,i,s,r){if(this.preservePaths||i.length===0)return s();let h=t;for(let n of i){h=c.resolve(h,n);let[o,a]=Ve(()=>d.lstatSync(h));if(o)return s();if(a.isSymbolicLink())return r(new jt(h,c.resolve(t,i.join("/"))))}s()}[Nt](e,t,i,s){let r=`${i}Sync`;try{d[r](t,String(e.absolute)),s(),e.resume()}catch(h){return this[O](h,e)}}},ks=ht(e=>{let t=new Mi(e),i=e.file,s=d.statSync(i);new xr(i,{readSize:e.maxReadSize||16*1024*1024,size:s.size}).pipe(t)},(e,t)=>{let i=new Ft(e),s=e.maxReadSize||16*1024*1024,r=e.file;return new Promise((h,n)=>{i.on("error",n),i.on("close",h),d.stat(r,(o,a)=>{if(o)n(o);else{let l=new Pi(r,{readSize:s,size:a.size});l.on("error",n),l.pipe(i)}})})},e=>new Mi(e),e=>new Ft(e),(e,t)=>{t?.length&&Hi(e,t)}),$h=(e,t)=>{let i=new Ut(e),s=!0,r,h;try{try{r=d.openSync(e.file,"r+")}catch(a){if(a?.code==="ENOENT")r=d.openSync(e.file,"w+");else throw a}let n=d.fstatSync(r),o=Buffer.alloc(512);e:for(h=0;h<n.size;h+=512){for(let f=0,b=0;f<512;f+=b){if(b=d.readSync(r,o,f,o.length-f,h+f),h===0&&o[0]===31&&o[1]===139)throw Error("cannot append to compressed archives");if(!b)break e}let a=new ae(o);if(!a.cksumValid)break;let l=512*Math.ceil((a.size||0)/512);if(h+l+512>n.size)break;h+=l,e.mtimeCache&&a.mtime&&e.mtimeCache.set(String(a.path),a.mtime)}s=!1,Yh(e,i,h,r,t)}finally{if(s)try{d.closeSync(r)}catch{}}},Yh=(e,t,i,s,r)=>{let h=new Is(e.file,{fd:s,start:i});t.pipe(h),Kh(t,r)},Vh=(e,t)=>{t=Array.from(t);let i=new nt(e),s=(r,h,n)=>{let o=(g,T)=>{g?d.close(r,w=>n(g)):n(null,T)},a=0;if(h===0)return o(null,0);let l=0,f=Buffer.alloc(512),b=(g,T)=>{if(g||T===void 0)return o(g);if(l+=T,l<512&&T)return d.read(r,f,l,f.length-l,a+l,b);if(a===0&&f[0]===31&&f[1]===139)return o(Error("cannot append to compressed archives"));if(l<512)return o(null,a);let w=new ae(f);if(!w.cksumValid)return o(null,a);let k=512*Math.ceil((w.size??0)/512);if(a+k+512>h||(a+=k+512,a>=h))return o(null,a);e.mtimeCache&&w.mtime&&e.mtimeCache.set(String(w.path),w.mtime),l=0,d.read(r,f,0,512,a,b)};d.read(r,f,0,512,a,b)};return new Promise((r,h)=>{i.on("error",h);let n="r+",o=(a,l)=>{if(a&&a.code==="ENOENT"&&n==="r+")return n="w+",d.open(e.file,n,o);if(a||!l)return h(a);d.fstat(l,(f,b)=>{if(f)return d.close(l,()=>h(f));s(l,b.size,(g,T)=>{if(g)return h(g);let w=new Mt(e.file,{fd:l,start:T});i.pipe(w),w.on("error",h),w.on("close",r),Xh(i,t)})})};d.open(e.file,n,o)})},Kh=(e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Be({file:c.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:s=>e.add(s)}):e.add(i)}),e.end()},Xh=async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Be({file:c.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:s=>e.add(s)}):e.add(i);e.end()},be=ht($h,Vh,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(e,t)=>{if(!Cr(e))throw TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!t?.length)throw TypeError("no paths specified to add/replace")});ht(be.syncFile,be.asyncFile,be.syncNoFile,be.asyncNoFile,(e,t=[])=>{be.validate?.(e,t),qh(e)});var qh=e=>{let t=e.filter;e.mtimeCache||=new Map,e.filter=t?(i,s)=>t(i,s)&&!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(i,s)=>!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0))};export{en as index_min_exports};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
`),
|
|
1
|
+
import{createRequire as m}from"node:module";import{m as d,f as p,T as v}from"../packem_shared/index-BDmTbWX1.js";import{p as e}from"./bin.js";import{w as $}from"../packem_shared/pm-runner-pVihAfxV.js";import{a as u}from"./config.js";const g=m(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=o=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[t,s]=c.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return c.getBuiltinModule(o)}return g(o)},{spawnSync:y}=w("node:child_process"),n="@lavamoat/preinstall-always-fail",l=o=>{const t=d(o,"package.json");if(!p(t))return"no-package-json";try{const s=u(t);if(s.devDependencies?.[n]||s.dependencies?.[n])return"installed"}catch{}return"missing"},h=o=>{const t=d(o,"package.json");if(!p(t))return!1;try{const s=u(t);let i=!1;const a=r=>!r||!(n in r)?r:(i=!0,Object.fromEntries(Object.entries(r).filter(([f])=>f!==n)));return s.devDependencies=a(s.devDependencies),s.dependencies=a(s.dependencies),i&&v(t,`${JSON.stringify(s,null,2)}
|
|
2
|
+
`),i}catch{return!1}},D=({options:o,workspaceRoot:t})=>{const s=t??process.cwd();if(o.status){switch(l(s)){case"installed":{e.success(`Preinstall tripwire is installed (${n}).`),e.info("Removing 'ignore-scripts=true' will cause future installs to fail loudly.");break}case"missing":{e.warn("Preinstall tripwire is not installed."),e.info(`Run 'vis security tripwire' to add ${n} as a devDependency.`);break}default:e.error("No package.json found at the workspace root."),process.exitCode=1}return}if(o.remove){h(s)?e.success(`Removed ${n} from package.json. Run your PM's install to clean node_modules.`):e.info(`${n} was not present in package.json.`);return}if(l(s)==="installed"){e.info(`${n} is already installed.`);return}const i=$(s),a={bun:["add","-d",n],npm:["install","--save-dev",n],pnpm:["add","-D","-w",n],yarn:["add","-D",n]}[i.name];if(!a){e.error(`Cannot install tripwire — unsupported package manager '${i.name}'.`),process.exitCode=1;return}e.info(`Installing ${n} via ${i.name}…`);const r=y(i.name,a,{cwd:s,stdio:"inherit"});if(r.error){e.error(`Failed to install tripwire: ${r.error.message}`),process.exitCode=1;return}if(r.signal!==null){e.error(`${i.name} was terminated by signal ${r.signal}`),process.exitCode=1;return}if(r.status!==0){e.error(`${i.name} exited with code ${String(r.status)}`),process.exitCode=r.status??1;return}e.success(`Installed ${n} as a devDependency.`),e.notice(""),e.notice("How the tripwire works:"),e.notice(` ${n} declares a preinstall script that always fails.`),e.notice(" When 'ignore-scripts=true' is set (.npmrc / bunfig.toml / .yarnrc.yml),"),e.notice(" the script is skipped and installs succeed normally. If someone deletes"),e.notice(" that setting, the next install fails — loudly — instead of silently"),e.notice(" running every dependency's lifecycle scripts.")};export{D as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
`),n.status==="fail"&&(process.exitCode=1);return}const[c,...l]=
|
|
1
|
+
import{D as b,p}from"./bin.js";import{w}from"../packem_shared/pm-runner-pVihAfxV.js";import{r as y,l as $,L as v}from"../packem_shared/dependency-scan-BDTH898x.js";import{v as C,m,f as S}from"../packem_shared/index-BDmTbWX1.js";import{e as x}from"../packem_shared/index-DMefdF51.js";const M=e=>{const s=e.trim();return s===""?!1:/^(?:git\+|git:\/\/|git@|ssh:\/\/)/i.test(s)||/^(?:github|gitlab|bitbucket|gist):/i.test(s)||/^[\w.-]+\/[\w.-]+(?:#.+)?$/.test(s)&&!s.includes("@")?!0:/^https?:\/\//i.test(s)},L=(e,s)=>{for(const t of s)if(t===e||t.endsWith("*")&&e.startsWith(t.slice(0,-1)))return!0;return!1},D=(e,s,t={})=>{const o=y(e,s);if(!o)return[];let i;try{i=C(m(e,o.file))}catch{return[]}const n=b(i,o.type);if(n.length===0)return[];const c=t.allow??[],l=[],f=new Set;for(const r of n){const a=`${r.name}@${r.version}`;for(const d of[r.dependencies,r.optionalDependencies])if(d){for(const[u,h]of Object.entries(d))if(!L(u,c))for(const k of h){if(!M(k))continue;const g=`${a}->${u}@${k}`;f.has(g)||(f.add(g),l.push({declaredBy:a,packageName:u,source:k}))}}}return l.sort((r,a)=>r.packageName.localeCompare(a.packageName)||r.declaredBy.localeCompare(a.declaredBy))},E=new Set(["firstSeen","publisherChange"]),N=e=>e.severity==="block"&&e.acceptedRisk===void 0,R=e=>{const s=e.security?.policies?.firstSeen?.minutes,t=typeof s=="number"&&s>0,o=e.security?.policies?.publisherChange?.mode==="no-downgrade",i=e.security?.blockExoticSubdeps===!0;return t||o||i},V=async e=>{const{offline:s=!1,packageManager:t,visConfig:o,workspaceRoot:i}=e,n=Date.now();if(!R(o))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!1,status:"skipped"};const c=y(i,t);if(!c||!S(m(i,c.file)))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!0,status:"fail"};const l=$(i,t,{includeDev:!0}),f=l.length,r=await x({offline:s,packageManager:t,packages:l,workspaceRoot:i},"install",{enabledPolicies:new Set(E),visConfig:o}),a=o.security?.blockExoticSubdeps===!0?D(i,t,{allow:o.security.exoticSubdepsAllow}):[],d=r.some(u=>N(u))||a.length>0;return{decisions:r,durationMs:Date.now()-n,entryCount:f,exoticViolations:a,lockfileMissing:!1,status:d?"fail":"pass"}},B=e=>e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`,P=e=>{if(e.status==="skipped")return["– Lockfile supply-chain verification skipped (no firstSeen / publisherChange / blockExoticSubdeps policy configured)"];if(e.lockfileMissing)return["✗ Lockfile supply-chain verification failed — no lockfile found, the resolved closure cannot be attested"];const s=`(${String(e.entryCount)} ${e.entryCount===1?"entry":"entries"}, ${B(e.durationMs)})`;if(e.status==="pass")return[`✓ Lockfile passes supply-chain policies ${s}`];const t=[`✗ Lockfile failed supply-chain policy check ${s}`];for(const o of e.decisions)o.severity==="block"&&o.acceptedRisk===void 0&&t.push(` [${o.policy}] ${o.reason}`);for(const o of e.exoticViolations)t.push(` [blockExoticSubdeps] ${o.packageName} pulled from exotic source by ${o.declaredBy}: ${o.source}`);return t},I=async({options:e,visConfig:s,workspaceRoot:t})=>{const o=t??process.cwd(),i=w(o);if(!v[i.name]){p.warn(`Package manager '${i.name}' has no lockfile vis can verify.`);return}const n=await V({offline:!!e.offline,packageManager:i.name,visConfig:s??{},workspaceRoot:o});if(e.json){process.stdout.write(`${JSON.stringify(n,void 0,2)}
|
|
2
|
+
`),n.status==="fail"&&(process.exitCode=1);return}const[c,...l]=P(n);if(n.status==="skipped"){p.info(c);return}if(n.status==="pass"){p.success(c);return}p.error(c);for(const f of l)p.error(f);process.exitCode=1};export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";import{m as f,q as l,C as _,h as p,k as d,r as u,o as c,b as g,j as m,Z as T,i as C}from"../packem_chunks/config.js";import"./index-BDmTbWX1.js";import"jiti";import{otelPlugin as F}from"./otelPlugin-DmKDBaPo.js";import{definePlugin as S}from"./definePlugin-DoUcoYSy.js";const i=e(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;export{f as CONFIG_FILES,l as DEFAULT_MIN_RELEASE_AGE_MINUTES,_ as SECURITY_DEFAULTS,p as TASK_CONFIG_FILES,d as applyDefaults,u as defineConfig,S as definePlugin,c as defineTaskConfig,g as findVisConfigFile,m as findVisTaskConfigFile,T as loadVisConfig,C as loadVisTaskConfig,F as otelPlugin};
|