From ab0f32afca25ac6512ca3e425e8571b83b691026 Mon Sep 17 00:00:00 2001 From: BeatForge CI Date: Fri, 4 Oct 2024 23:18:51 +0000 Subject: [PATCH] chore: bundle update --- dist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 3504131..e05d1ad 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,3 +1,3 @@ import{createRequire as j4}from"node:module";var O4=Object.create;var{getPrototypeOf:U4,defineProperty:g$,getOwnPropertyNames:x4}=Object;var T4=Object.prototype.hasOwnProperty;var C4=($,Q,V)=>{V=$!=null?O4(U4($)):{};const X=Q||!$||!$.__esModule?g$(V,"default",{value:$,enumerable:!0}):V;for(let J of x4($))if(!T4.call(X,J))g$(X,J,{get:()=>$[J],enumerable:!0});return X};var H=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var j=j4(import.meta.url);var t5=H((k$)=>{function D4($){if($===null||$===void 0)return"";else if(typeof $==="string"||$ instanceof String)return $;return JSON.stringify($)}function N4($){if(!Object.keys($).length)return{};return{title:$.title,file:$.file,line:$.startLine,endLine:$.endLine,col:$.startColumn,endColumn:$.endColumn}}Object.defineProperty(k$,"__esModule",{value:!0});k$.toCommandProperties=k$.toCommandValue=void 0;k$.toCommandValue=D4;k$.toCommandProperties=N4});var u$=H((d)=>{function m$($,Q,V){const X=new h$($,Q,V);process.stdout.write(X.toString()+k4.EOL)}function y4($,Q=""){m$($,{},Q)}function E4($){return b$.toCommandValue($).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function b4($){return b$.toCommandValue($).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}var _4=d&&d.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),R4=d&&d.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),g4=d&&d.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))_4(Q,$,V)}return R4(Q,$),Q};Object.defineProperty(d,"__esModule",{value:!0});d.issue=d.issueCommand=void 0;var k4=g4(j("os")),b$=t5();d.issueCommand=m$;d.issue=y4;var E$="::";class h${constructor($,Q,V){if(!$)$="missing.command";this.command=$,this.properties=Q,this.message=V}toString(){let $=E$+this.command;if(this.properties&&Object.keys(this.properties).length>0){$+=" ";let Q=!0;for(let V in this.properties)if(this.properties.hasOwnProperty(V)){const X=this.properties[V];if(X){if(Q)Q=!1;else $+=",";$+=`${V}=${b4(X)}`}}}return $+=`${E$}${E4(this.message)}`,$}}});var s8=H((f$)=>{function h4($){return $&&$.__esModule?$:{default:$}}function u4(){if(e5>$8.length-16)m4.default.randomFillSync($8),e5=0;return $8.slice(e5,e5+=16)}Object.defineProperty(f$,"__esModule",{value:!0});f$.default=u4;var m4=h4(j("crypto")),$8=new Uint8Array(256),e5=$8.length});var d$=H((c$)=>{Object.defineProperty(c$,"__esModule",{value:!0});c$.default=void 0;var c4=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;c$.default=c4});var U5=H((i$)=>{function d4($){return $&&$.__esModule?$:{default:$}}function i4($){return typeof $==="string"&&l4.default.test($)}Object.defineProperty(i$,"__esModule",{value:!0});i$.default=void 0;var l4=d4(d$()),p4=i4;i$.default=p4});var x5=H((a$)=>{function n4($){return $&&$.__esModule?$:{default:$}}function s4($,Q=0){const V=(g[$[Q+0]]+g[$[Q+1]]+g[$[Q+2]]+g[$[Q+3]]+"-"+g[$[Q+4]]+g[$[Q+5]]+"-"+g[$[Q+6]]+g[$[Q+7]]+"-"+g[$[Q+8]]+g[$[Q+9]]+"-"+g[$[Q+10]]+g[$[Q+11]]+g[$[Q+12]]+g[$[Q+13]]+g[$[Q+14]]+g[$[Q+15]]).toLowerCase();if(!a4.default(V))throw TypeError("Stringified UUID is invalid");return V}Object.defineProperty(a$,"__esModule",{value:!0});a$.default=void 0;var a4=n4(U5()),g=[];for(let $=0;$<256;++$)g.push(($+256).toString(16).substr(1));var o4=s4;a$.default=o4});var e$=H((r$)=>{function o$($){return $&&$.__esModule?$:{default:$}}function e4($,Q,V){let X=Q&&V||0;const J=Q||new Array(16);$=$||{};let Z=$.node||s$,K=$.clockseq!==void 0?$.clockseq:o8;if(Z==null||K==null){const M=$.random||($.rng||r4.default)();if(Z==null)Z=s$=[M[0]|1,M[1],M[2],M[3],M[4],M[5]];if(K==null)K=o8=(M[6]<<8|M[7])&16383}let G=$.msecs!==void 0?$.msecs:Date.now(),Y=$.nsecs!==void 0?$.nsecs:t8+1;const W=G-r8+(Y-t8)/1e4;if(W<0&&$.clockseq===void 0)K=K+1&16383;if((W<0||G>r8)&&$.nsecs===void 0)Y=0;if(Y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");r8=G,t8=Y,o8=K,G+=12219292800000;const z=((G&268435455)*1e4+Y)%4294967296;J[X++]=z>>>24&255,J[X++]=z>>>16&255,J[X++]=z>>>8&255,J[X++]=z&255;const q=G/4294967296*1e4&268435455;J[X++]=q>>>8&255,J[X++]=q&255,J[X++]=q>>>24&15|16,J[X++]=q>>>16&255,J[X++]=K>>>8|128,J[X++]=K&255;for(let M=0;M<6;++M)J[X+M]=Z[M];return Q||t4.default(J)}Object.defineProperty(r$,"__esModule",{value:!0});r$.default=void 0;var r4=o$(s8()),t4=o$(x5()),s$,o8,r8=0,t8=0,$6=e4;r$.default=$6});var e8=H(($7)=>{function V6($){return $&&$.__esModule?$:{default:$}}function X6($){if(!Q6.default($))throw TypeError("Invalid UUID");let Q;const V=new Uint8Array(16);return V[0]=(Q=parseInt($.slice(0,8),16))>>>24,V[1]=Q>>>16&255,V[2]=Q>>>8&255,V[3]=Q&255,V[4]=(Q=parseInt($.slice(9,13),16))>>>8,V[5]=Q&255,V[6]=(Q=parseInt($.slice(14,18),16))>>>8,V[7]=Q&255,V[8]=(Q=parseInt($.slice(19,23),16))>>>8,V[9]=Q&255,V[10]=(Q=parseInt($.slice(24,36),16))/1099511627776&255,V[11]=Q/4294967296&255,V[12]=Q>>>24&255,V[13]=Q>>>16&255,V[14]=Q>>>8&255,V[15]=Q&255,V}Object.defineProperty($7,"__esModule",{value:!0});$7.default=void 0;var Q6=V6(U5()),J6=X6;$7.default=J6});var $9=H((Z7)=>{function V7($){return $&&$.__esModule?$:{default:$}}function G6($){$=unescape(encodeURIComponent($));const Q=[];for(let V=0;V<$.length;++V)Q.push($.charCodeAt(V));return Q}function Y6($,Q,V){function X(J,Z,K,G){if(typeof J==="string")J=G6(J);if(typeof Z==="string")Z=K6.default(Z);if(Z.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let Y=new Uint8Array(16+J.length);if(Y.set(Z),Y.set(J,Z.length),Y=V(Y),Y[6]=Y[6]&15|Q,Y[8]=Y[8]&63|128,K){G=G||0;for(let W=0;W<16;++W)K[G+W]=Y[W];return K}return Z6.default(Y)}try{X.name=$}catch(J){}return X.DNS=X7,X.URL=J7,X}Object.defineProperty(Z7,"__esModule",{value:!0});Z7.default=Y6;Z7.URL=Z7.DNS=void 0;var Z6=V7(x5()),K6=V7(e8()),X7="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Z7.DNS=X7;var J7="6ba7b811-9dad-11d1-80b4-00c04fd430c8";Z7.URL=J7});var z7=H((G7)=>{function B6($){return $&&$.__esModule?$:{default:$}}function L6($){if(Array.isArray($))$=Buffer.from($);else if(typeof $==="string")$=Buffer.from($,"utf8");return q6.default.createHash("md5").update($).digest()}Object.defineProperty(G7,"__esModule",{value:!0});G7.default=void 0;var q6=B6(j("crypto")),M6=L6;G7.default=M6});var L7=H((q7)=>{function W7($){return $&&$.__esModule?$:{default:$}}Object.defineProperty(q7,"__esModule",{value:!0});q7.default=void 0;var A6=W7($9()),I6=W7(z7()),w6=A6.default("v3",48,I6.default),F6=w6;q7.default=F6});var w7=H((A7)=>{function M7($){return $&&$.__esModule?$:{default:$}}function v6($,Q,V){$=$||{};const X=$.random||($.rng||H6.default)();if(X[6]=X[6]&15|64,X[8]=X[8]&63|128,Q){V=V||0;for(let J=0;J<16;++J)Q[V+J]=X[J];return Q}return P6.default(X)}Object.defineProperty(A7,"__esModule",{value:!0});A7.default=void 0;var H6=M7(s8()),P6=M7(x5()),O6=v6;A7.default=O6});var P7=H((F7)=>{function x6($){return $&&$.__esModule?$:{default:$}}function T6($){if(Array.isArray($))$=Buffer.from($);else if(typeof $==="string")$=Buffer.from($,"utf8");return U6.default.createHash("sha1").update($).digest()}Object.defineProperty(F7,"__esModule",{value:!0});F7.default=void 0;var U6=x6(j("crypto")),C6=T6;F7.default=C6});var x7=H((O7)=>{function v7($){return $&&$.__esModule?$:{default:$}}Object.defineProperty(O7,"__esModule",{value:!0});O7.default=void 0;var j6=v7($9()),D6=v7(P7()),N6=j6.default("v5",80,D6.default),S6=N6;O7.default=S6});var j7=H((T7)=>{Object.defineProperty(T7,"__esModule",{value:!0});T7.default=void 0;var _6="00000000-0000-0000-0000-000000000000";T7.default=_6});var S7=H((D7)=>{function g6($){return $&&$.__esModule?$:{default:$}}function k6($){if(!R6.default($))throw TypeError("Invalid UUID");return parseInt($.substr(14,1),16)}Object.defineProperty(D7,"__esModule",{value:!0});D7.default=void 0;var R6=g6(U5()),y6=k6;D7.default=y6});var _7=H((e)=>{function I0($){return $&&$.__esModule?$:{default:$}}Object.defineProperty(e,"__esModule",{value:!0});Object.defineProperty(e,"v1",{enumerable:!0,get:function(){return E6.default}});Object.defineProperty(e,"v3",{enumerable:!0,get:function(){return b6.default}});Object.defineProperty(e,"v4",{enumerable:!0,get:function(){return m6.default}});Object.defineProperty(e,"v5",{enumerable:!0,get:function(){return h6.default}});Object.defineProperty(e,"NIL",{enumerable:!0,get:function(){return u6.default}});Object.defineProperty(e,"version",{enumerable:!0,get:function(){return f6.default}});Object.defineProperty(e,"validate",{enumerable:!0,get:function(){return c6.default}});Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l6.default}});Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return d6.default}});var E6=I0(e$()),b6=I0(L7()),m6=I0(w7()),h6=I0(x7()),u6=I0(j7()),f6=I0(S7()),c6=I0(U5()),l6=I0(x5()),d6=I0(e8())});var y7=H((i)=>{function n6($,Q){const V=process.env[`GITHUB_${$}`];if(!V)throw new Error(`Unable to find environment variable for file command ${$}`);if(!R7.existsSync(V))throw new Error(`Missing file at path: ${V}`);R7.appendFileSync(V,`${k7.toCommandValue(Q)}${Q9.EOL}`,{encoding:"utf8"})}function s6($,Q){const V=`ghadelimiter_${a6.v4()}`,X=k7.toCommandValue(Q);if($.includes(V))throw new Error(`Unexpected input: name should not contain the delimiter "${V}"`);if(X.includes(V))throw new Error(`Unexpected input: value should not contain the delimiter "${V}"`);return`${$}<<${V}${Q9.EOL}${X}${Q9.EOL}${V}`}var i6=i&&i.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),p6=i&&i.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),g7=i&&i.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))i6(Q,$,V)}return p6(Q,$),Q};Object.defineProperty(i,"__esModule",{value:!0});i.prepareKeyValueMessage=i.issueFileCommand=void 0;var R7=g7(j("fs")),Q9=g7(j("os")),a6=_7(),k7=t5();i.issueFileCommand=n6;i.prepareKeyValueMessage=s6});var h7=H((b7)=>{function o6($){const Q=$.protocol==="https:";if(E7($))return;const V=(()=>{if(Q)return process.env.https_proxy||process.env.HTTPS_PROXY;else return process.env.http_proxy||process.env.HTTP_PROXY})();if(V)try{return new URL(V)}catch(X){if(!V.startsWith("http://")&&!V.startsWith("https://"))return new URL(`http://${V}`)}else return}function E7($){if(!$.hostname)return!1;const Q=$.hostname;if(r6(Q))return!0;const V=process.env.no_proxy||process.env.NO_PROXY||"";if(!V)return!1;let X;if($.port)X=Number($.port);else if($.protocol==="http:")X=80;else if($.protocol==="https:")X=443;const J=[$.hostname.toUpperCase()];if(typeof X==="number")J.push(`${J[0]}:${X}`);for(let Z of V.split(",").map((K)=>K.trim().toUpperCase()).filter((K)=>K))if(Z==="*"||J.some((K)=>K===Z||K.endsWith(`.${Z}`)||Z.startsWith(".")&&K.endsWith(`${Z}`)))return!0;return!1}function r6($){const Q=$.toLowerCase();return Q==="localhost"||Q.startsWith("127.")||Q.startsWith("[::1]")||Q.startsWith("[0:0:0:0:0:0:0:1]")}Object.defineProperty(b7,"__esModule",{value:!0});b7.checkBypass=b7.getProxyUrl=void 0;b7.getProxyUrl=o6;b7.checkBypass=E7});var l7=H((KQ)=>{function VQ($){var Q=new w0($);return Q.request=V9.request,Q}function XQ($){var Q=new w0($);return Q.request=V9.request,Q.createSocket=f7,Q.defaultPort=443,Q}function JQ($){var Q=new w0($);return Q.request=u7.request,Q}function ZQ($){var Q=new w0($);return Q.request=u7.request,Q.createSocket=f7,Q.defaultPort=443,Q}function w0($){var Q=this;Q.options=$||{},Q.proxyOptions=Q.options.proxy||{},Q.maxSockets=Q.options.maxSockets||V9.Agent.defaultMaxSockets,Q.requests=[],Q.sockets=[],Q.on("free",function V(X,J,Z,K){var G=c7(J,Z,K);for(var Y=0,W=Q.requests.length;Y=this.maxSockets){Z.requests.push(K);return}Z.createSocket(K,function(G){G.on("free",Y),G.on("close",W),G.on("agentRemove",W),Q.onSocket(G);function Y(){Z.emit("free",G,K)}function W(z){Z.removeSocket(G),G.removeListener("free",Y),G.removeListener("close",W),G.removeListener("agentRemove",W)}})};w0.prototype.createSocket=function $(Q,V){var X=this,J={};X.sockets.push(J);var Z=X9({},X.proxyOptions,{method:"CONNECT",path:Q.host+":"+Q.port,agent:!1,headers:{host:Q.host+":"+Q.port}});if(Q.localAddress)Z.localAddress=Q.localAddress;if(Z.proxyAuth)Z.headers=Z.headers||{},Z.headers["Proxy-Authorization"]="Basic "+new Buffer(Z.proxyAuth).toString("base64");j0("making CONNECT request");var K=X.request(Z);K.useChunkedEncodingByDefault=!1,K.once("response",G),K.once("upgrade",Y),K.once("connect",W),K.once("error",z),K.end();function G(q){q.upgrade=!0}function Y(q,M,O){process.nextTick(function(){W(q,M,O)})}function W(q,M,O){if(K.removeAllListeners(),M.removeAllListeners(),q.statusCode!==200){j0("tunneling socket could not be established, statusCode=%d",q.statusCode),M.destroy();var U=new Error("tunneling socket could not be established, statusCode="+q.statusCode);U.code="ECONNRESET",Q.request.emit("error",U),X.removeSocket(J);return}if(O.length>0){j0("got illegal response body from proxy"),M.destroy();var U=new Error("got illegal response body from proxy");U.code="ECONNRESET",Q.request.emit("error",U),X.removeSocket(J);return}return j0("tunneling connection has established"),X.sockets[X.sockets.indexOf(J)]=M,V(M)}function z(q){K.removeAllListeners(),j0("tunneling socket could not be established, cause=%s\n",q.message,q.stack);var M=new Error("tunneling socket could not be established, cause="+q.message);M.code="ECONNRESET",Q.request.emit("error",M),X.removeSocket(J)}};w0.prototype.removeSocket=function $(Q){var V=this.sockets.indexOf(Q);if(V===-1)return;this.sockets.splice(V,1);var X=this.requests.shift();if(X)this.createSocket(X,function(J){X.request.onSocket(J)})};var j0;if(process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG))j0=function(){var $=Array.prototype.slice.call(arguments);if(typeof $[0]==="string")$[0]="TUNNEL: "+$[0];else $.unshift("TUNNEL:");console.error.apply(console,$)};else j0=function(){};KQ.debug=j0});var p7=H((F)=>{function MQ($){const Q=d7.getProxyUrl(new URL($));return Q?Q.href:""}function PQ($){return new URL($).protocol==="https:"}var BQ=F&&F.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),LQ=F&&F.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),J8=F&&F.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))BQ(Q,$,V)}return LQ(Q,$),Q},T=F&&F.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(F,"__esModule",{value:!0});F.HttpClient=F.isHttps=F.HttpClientResponse=F.HttpClientError=F.getProxyUrl=F.MediaTypes=F.Headers=F.HttpCodes=void 0;var Q8=J8(j("http")),J9=J8(j("https")),d7=J8(h7()),V8=J8(l7()),$0;(function($){$[$.OK=200]="OK",$[$.MultipleChoices=300]="MultipleChoices",$[$.MovedPermanently=301]="MovedPermanently",$[$.ResourceMoved=302]="ResourceMoved",$[$.SeeOther=303]="SeeOther",$[$.NotModified=304]="NotModified",$[$.UseProxy=305]="UseProxy",$[$.SwitchProxy=306]="SwitchProxy",$[$.TemporaryRedirect=307]="TemporaryRedirect",$[$.PermanentRedirect=308]="PermanentRedirect",$[$.BadRequest=400]="BadRequest",$[$.Unauthorized=401]="Unauthorized",$[$.PaymentRequired=402]="PaymentRequired",$[$.Forbidden=403]="Forbidden",$[$.NotFound=404]="NotFound",$[$.MethodNotAllowed=405]="MethodNotAllowed",$[$.NotAcceptable=406]="NotAcceptable",$[$.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",$[$.RequestTimeout=408]="RequestTimeout",$[$.Conflict=409]="Conflict",$[$.Gone=410]="Gone",$[$.TooManyRequests=429]="TooManyRequests",$[$.InternalServerError=500]="InternalServerError",$[$.NotImplemented=501]="NotImplemented",$[$.BadGateway=502]="BadGateway",$[$.ServiceUnavailable=503]="ServiceUnavailable",$[$.GatewayTimeout=504]="GatewayTimeout"})($0=F.HttpCodes||(F.HttpCodes={}));var E;(function($){$.Accept="accept",$.ContentType="content-type"})(E=F.Headers||(F.Headers={}));var D0;(function($){$.ApplicationJson="application/json"})(D0=F.MediaTypes||(F.MediaTypes={}));F.getProxyUrl=MQ;var AQ=[$0.MovedPermanently,$0.ResourceMoved,$0.SeeOther,$0.TemporaryRedirect,$0.PermanentRedirect],IQ=[$0.BadGateway,$0.ServiceUnavailable,$0.GatewayTimeout],wQ=["OPTIONS","GET","DELETE","HEAD"],FQ=10,HQ=5;class Z8 extends Error{constructor($,Q){super($);this.name="HttpClientError",this.statusCode=Q,Object.setPrototypeOf(this,Z8.prototype)}}F.HttpClientError=Z8;class Z9{constructor($){this.message=$}readBody(){return T(this,void 0,void 0,function*(){return new Promise(($)=>T(this,void 0,void 0,function*(){let Q=Buffer.alloc(0);this.message.on("data",(V)=>{Q=Buffer.concat([Q,V])}),this.message.on("end",()=>{$(Q.toString())})}))})}readBodyBuffer(){return T(this,void 0,void 0,function*(){return new Promise(($)=>T(this,void 0,void 0,function*(){const Q=[];this.message.on("data",(V)=>{Q.push(V)}),this.message.on("end",()=>{$(Buffer.concat(Q))})}))})}}F.HttpClientResponse=Z9;F.isHttps=PQ;class i7{constructor($,Q,V){if(this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=$,this.handlers=Q||[],this.requestOptions=V,V){if(V.ignoreSslError!=null)this._ignoreSslError=V.ignoreSslError;if(this._socketTimeout=V.socketTimeout,V.allowRedirects!=null)this._allowRedirects=V.allowRedirects;if(V.allowRedirectDowngrade!=null)this._allowRedirectDowngrade=V.allowRedirectDowngrade;if(V.maxRedirects!=null)this._maxRedirects=Math.max(V.maxRedirects,0);if(V.keepAlive!=null)this._keepAlive=V.keepAlive;if(V.allowRetries!=null)this._allowRetries=V.allowRetries;if(V.maxRetries!=null)this._maxRetries=V.maxRetries}}options($,Q){return T(this,void 0,void 0,function*(){return this.request("OPTIONS",$,null,Q||{})})}get($,Q){return T(this,void 0,void 0,function*(){return this.request("GET",$,null,Q||{})})}del($,Q){return T(this,void 0,void 0,function*(){return this.request("DELETE",$,null,Q||{})})}post($,Q,V){return T(this,void 0,void 0,function*(){return this.request("POST",$,Q,V||{})})}patch($,Q,V){return T(this,void 0,void 0,function*(){return this.request("PATCH",$,Q,V||{})})}put($,Q,V){return T(this,void 0,void 0,function*(){return this.request("PUT",$,Q,V||{})})}head($,Q){return T(this,void 0,void 0,function*(){return this.request("HEAD",$,null,Q||{})})}sendStream($,Q,V,X){return T(this,void 0,void 0,function*(){return this.request($,Q,V,X)})}getJson($,Q={}){return T(this,void 0,void 0,function*(){Q[E.Accept]=this._getExistingOrDefaultHeader(Q,E.Accept,D0.ApplicationJson);const V=yield this.get($,Q);return this._processResponse(V,this.requestOptions)})}postJson($,Q,V={}){return T(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[E.Accept]=this._getExistingOrDefaultHeader(V,E.Accept,D0.ApplicationJson),V[E.ContentType]=this._getExistingOrDefaultHeader(V,E.ContentType,D0.ApplicationJson);const J=yield this.post($,X,V);return this._processResponse(J,this.requestOptions)})}putJson($,Q,V={}){return T(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[E.Accept]=this._getExistingOrDefaultHeader(V,E.Accept,D0.ApplicationJson),V[E.ContentType]=this._getExistingOrDefaultHeader(V,E.ContentType,D0.ApplicationJson);const J=yield this.put($,X,V);return this._processResponse(J,this.requestOptions)})}patchJson($,Q,V={}){return T(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[E.Accept]=this._getExistingOrDefaultHeader(V,E.Accept,D0.ApplicationJson),V[E.ContentType]=this._getExistingOrDefaultHeader(V,E.ContentType,D0.ApplicationJson);const J=yield this.patch($,X,V);return this._processResponse(J,this.requestOptions)})}request($,Q,V,X){return T(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");const J=new URL(Q);let Z=this._prepareRequest($,J,X);const K=this._allowRetries&&wQ.includes($)?this._maxRetries+1:1;let G=0,Y;do{if(Y=yield this.requestRaw(Z,V),Y&&Y.message&&Y.message.statusCode===$0.Unauthorized){let z;for(let q of this.handlers)if(q.canHandleAuthentication(Y)){z=q;break}if(z)return z.handleAuthentication(this,Z,V);else return Y}let W=this._maxRedirects;while(Y.message.statusCode&&AQ.includes(Y.message.statusCode)&&this._allowRedirects&&W>0){const z=Y.message.headers.location;if(!z)break;const q=new URL(z);if(J.protocol==="https:"&&J.protocol!==q.protocol&&!this._allowRedirectDowngrade)throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");if(yield Y.readBody(),q.hostname!==J.hostname){for(let M in X)if(M.toLowerCase()==="authorization")delete X[M]}Z=this._prepareRequest($,q,X),Y=yield this.requestRaw(Z,V),W--}if(!Y.message.statusCode||!IQ.includes(Y.message.statusCode))return Y;if(G+=1,G{function J(Z,K){if(Z)X(Z);else if(!K)X(new Error("Unknown error"));else V(K)}this.requestRawWithCallback($,Q,J)})})}requestRawWithCallback($,Q,V){if(typeof Q==="string"){if(!$.options.headers)$.options.headers={};$.options.headers["Content-Length"]=Buffer.byteLength(Q,"utf8")}let X=!1;function J(G,Y){if(!X)X=!0,V(G,Y)}const Z=$.httpModule.request($.options,(G)=>{const Y=new Z9(G);J(void 0,Y)});let K;if(Z.on("socket",(G)=>{K=G}),Z.setTimeout(this._socketTimeout||180000,()=>{if(K)K.end();J(new Error(`Request timeout: ${$.options.path}`))}),Z.on("error",function(G){J(G)}),Q&&typeof Q==="string")Z.write(Q,"utf8");if(Q&&typeof Q!=="string")Q.on("close",function(){Z.end()}),Q.pipe(Z);else Z.end()}getAgent($){const Q=new URL($);return this._getAgent(Q)}_prepareRequest($,Q,V){const X={};X.parsedUrl=Q;const J=X.parsedUrl.protocol==="https:";X.httpModule=J?J9:Q8;const Z=J?443:80;if(X.options={},X.options.host=X.parsedUrl.hostname,X.options.port=X.parsedUrl.port?parseInt(X.parsedUrl.port):Z,X.options.path=(X.parsedUrl.pathname||"")+(X.parsedUrl.search||""),X.options.method=$,X.options.headers=this._mergeHeaders(V),this.userAgent!=null)X.options.headers["user-agent"]=this.userAgent;if(X.options.agent=this._getAgent(X.parsedUrl),this.handlers)for(let K of this.handlers)K.prepareRequest(X.options);return X}_mergeHeaders($){if(this.requestOptions&&this.requestOptions.headers)return Object.assign({},X8(this.requestOptions.headers),X8($||{}));return X8($||{})}_getExistingOrDefaultHeader($,Q,V){let X;if(this.requestOptions&&this.requestOptions.headers)X=X8(this.requestOptions.headers)[Q];return $[Q]||X||V}_getAgent($){let Q;const V=d7.getProxyUrl($),X=V&&V.hostname;if(this._keepAlive&&X)Q=this._proxyAgent;if(this._keepAlive&&!X)Q=this._agent;if(Q)return Q;const J=$.protocol==="https:";let Z=100;if(this.requestOptions)Z=this.requestOptions.maxSockets||Q8.globalAgent.maxSockets;if(V&&V.hostname){const K={maxSockets:Z,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(V.username||V.password)&&{proxyAuth:`${V.username}:${V.password}`}),{host:V.hostname,port:V.port})};let G;const Y=V.protocol==="https:";if(J)G=Y?V8.httpsOverHttps:V8.httpsOverHttp;else G=Y?V8.httpOverHttps:V8.httpOverHttp;Q=G(K),this._proxyAgent=Q}if(this._keepAlive&&!Q){const K={keepAlive:this._keepAlive,maxSockets:Z};Q=J?new J9.Agent(K):new Q8.Agent(K),this._agent=Q}if(!Q)Q=J?J9.globalAgent:Q8.globalAgent;if(J&&this._ignoreSslError)Q.options=Object.assign(Q.options||{},{rejectUnauthorized:!1});return Q}_performExponentialBackoff($){return T(this,void 0,void 0,function*(){$=Math.min(FQ,$);const Q=HQ*Math.pow(2,$);return new Promise((V)=>setTimeout(()=>V(),Q))})}_processResponse($,Q){return T(this,void 0,void 0,function*(){return new Promise((V,X)=>T(this,void 0,void 0,function*(){const J=$.message.statusCode||0,Z={statusCode:J,result:null,headers:{}};if(J===$0.NotFound)V(Z);function K(W,z){if(typeof z==="string"){const q=new Date(z);if(!isNaN(q.valueOf()))return q}return z}let G,Y;try{if(Y=yield $.readBody(),Y&&Y.length>0){if(Q&&Q.deserializeDates)G=JSON.parse(Y,K);else G=JSON.parse(Y);Z.result=G}Z.headers=$.message.headers}catch(W){}if(J>299){let W;if(G&&G.message)W=G.message;else if(Y&&Y.length>0)W=Y;else W=`Failed request: (${J})`;const z=new Z8(W,J);z.result=Z.result,X(z)}else V(Z)}))})}}F.HttpClient=i7;var X8=($)=>Object.keys($).reduce((Q,V)=>(Q[V.toLowerCase()]=$[V],Q),{})});var o7=H((K0)=>{var K9=K0&&K0.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(K0,"__esModule",{value:!0});K0.PersonalAccessTokenCredentialHandler=K0.BearerCredentialHandler=K0.BasicCredentialHandler=void 0;class a7{constructor($,Q){this.username=$,this.password=Q}prepareRequest($){if(!$.headers)throw Error("The request has no headers");$.headers.Authorization=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return K9(this,void 0,void 0,function*(){throw new Error("not implemented")})}}K0.BasicCredentialHandler=a7;class n7{constructor($){this.token=$}prepareRequest($){if(!$.headers)throw Error("The request has no headers");$.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return K9(this,void 0,void 0,function*(){throw new Error("not implemented")})}}K0.BearerCredentialHandler=n7;class s7{constructor($){this.token=$}prepareRequest($){if(!$.headers)throw Error("The request has no headers");$.headers.Authorization=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return K9(this,void 0,void 0,function*(){throw new Error("not implemented")})}}K0.PersonalAccessTokenCredentialHandler=s7});var e7=H((K5)=>{var r7=K5&&K5.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(K5,"__esModule",{value:!0});K5.OidcClient=void 0;var vQ=p7(),OQ=o7(),t7=G9();class Z5{static createHttpClient($=!0,Q=10){const V={allowRetries:$,maxRetries:Q};return new vQ.HttpClient("actions/oidc-client",[new OQ.BearerCredentialHandler(Z5.getRequestToken())],V)}static getRequestToken(){const $=process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!$)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return $}static getIDTokenUrl(){const $=process.env.ACTIONS_ID_TOKEN_REQUEST_URL;if(!$)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return $}static getCall($){var Q;return r7(this,void 0,void 0,function*(){const J=(Q=(yield Z5.createHttpClient().getJson($).catch((Z)=>{throw new Error(`Failed to get ID Token. \n Error Code : ${Z.statusCode}\n - Error Message: ${Z.message}`)})).result)===null||Q===void 0?void 0:Q.value;if(!J)throw new Error("Response json body do not have ID Token field");return J})}static getIDToken($){return r7(this,void 0,void 0,function*(){try{let Q=Z5.getIDTokenUrl();if($){const X=encodeURIComponent($);Q=`${Q}&audience=${X}`}t7.debug(`ID token url is ${Q}`);const V=yield Z5.getCall(Q);return t7.setSecret(V),V}catch(Q){throw new Error(`Error message: ${Q.message}`)}})}}K5.OidcClient=Z5});var W9=H((m)=>{var Y9=m&&m.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(m,"__esModule",{value:!0});m.summary=m.markdownSummary=m.SUMMARY_DOCS_URL=m.SUMMARY_ENV_VAR=void 0;var UQ=j("os"),z9=j("fs"),{access:xQ,appendFile:TQ,writeFile:CQ}=z9.promises;m.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";m.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";class $1{constructor(){this._buffer=""}filePath(){return Y9(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;const $=process.env[m.SUMMARY_ENV_VAR];if(!$)throw new Error(`Unable to find environment variable for \$${m.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield xQ($,z9.constants.R_OK|z9.constants.W_OK)}catch(Q){throw new Error(`Unable to access summary file: '${$}'. Check if the file has correct read/write permissions.`)}return this._filePath=$,this._filePath})}wrap($,Q,V={}){const X=Object.entries(V).map(([J,Z])=>` ${J}="${Z}"`).join("");if(!Q)return`<${$}${X}>`;return`<${$}${X}>${Q}`}write($){return Y9(this,void 0,void 0,function*(){const Q=!!($===null||$===void 0?void 0:$.overwrite),V=yield this.filePath();return yield(Q?CQ:TQ)(V,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return Y9(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw($,Q=!1){return this._buffer+=$,Q?this.addEOL():this}addEOL(){return this.addRaw(UQ.EOL)}addCodeBlock($,Q){const V=Object.assign({},Q&&{lang:Q}),X=this.wrap("pre",this.wrap("code",$),V);return this.addRaw(X).addEOL()}addList($,Q=!1){const V=Q?"ol":"ul",X=$.map((Z)=>this.wrap("li",Z)).join(""),J=this.wrap(V,X);return this.addRaw(J).addEOL()}addTable($){const Q=$.map((X)=>{const J=X.map((Z)=>{if(typeof Z==="string")return this.wrap("td",Z);const{header:K,data:G,colspan:Y,rowspan:W}=Z,z=K?"th":"td",q=Object.assign(Object.assign({},Y&&{colspan:Y}),W&&{rowspan:W});return this.wrap(z,G,q)}).join("");return this.wrap("tr",J)}).join(""),V=this.wrap("table",Q);return this.addRaw(V).addEOL()}addDetails($,Q){const V=this.wrap("details",this.wrap("summary",$)+Q);return this.addRaw(V).addEOL()}addImage($,Q,V){const{width:X,height:J}=V||{},Z=Object.assign(Object.assign({},X&&{width:X}),J&&{height:J}),K=this.wrap("img",null,Object.assign({src:$,alt:Q},Z));return this.addRaw(K).addEOL()}addHeading($,Q){const V=`h${Q}`,X=["h1","h2","h3","h4","h5","h6"].includes(V)?V:"h1",J=this.wrap(X,$);return this.addRaw(J).addEOL()}addSeparator(){const $=this.wrap("hr",null);return this.addRaw($).addEOL()}addBreak(){const $=this.wrap("br",null);return this.addRaw($).addEOL()}addQuote($,Q){const V=Object.assign({},Q&&{cite:Q}),X=this.wrap("blockquote",$,V);return this.addRaw(X).addEOL()}addLink($,Q){const V=this.wrap("a",$,{href:Q});return this.addRaw(V).addEOL()}}var Q1=new $1;m.markdownSummary=Q1;m.summary=Q1});var V1=H((h)=>{function _Q($){return $.replace(/[\\]/g,"/")}function RQ($){return $.replace(/[/]/g,"\\")}function gQ($){return $.replace(/[/\\]/g,SQ.sep)}var jQ=h&&h.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),DQ=h&&h.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),NQ=h&&h.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))jQ(Q,$,V)}return DQ(Q,$),Q};Object.defineProperty(h,"__esModule",{value:!0});h.toPlatformPath=h.toWin32Path=h.toPosixPath=void 0;var SQ=NQ(j("path"));h.toPosixPath=_Q;h.toWin32Path=RQ;h.toPlatformPath=gQ});var G9=H((B)=>{function mQ($,Q){const V=G5.toCommandValue(Q);if(process.env[$]=V,process.env.GITHUB_ENV||"")return d0.issueFileCommand("ENV",d0.prepareKeyValueMessage($,Q));p.issueCommand("set-env",{name:$},V)}function hQ($){p.issueCommand("add-mask",{},$)}function uQ($){if(process.env.GITHUB_PATH||"")d0.issueFileCommand("PATH",$);else p.issueCommand("add-path",{},$);process.env.PATH=`${$}${EQ.delimiter}${process.env.PATH}`}function q9($,Q){const V=process.env[`INPUT_${$.replace(/ /g,"_").toUpperCase()}`]||"";if(Q&&Q.required&&!V)throw new Error(`Input required and not supplied: ${$}`);if(Q&&Q.trimWhitespace===!1)return V;return V.trim()}function fQ($,Q){const V=q9($,Q).split("\n").filter((X)=>X!=="");if(Q&&Q.trimWhitespace===!1)return V;return V.map((X)=>X.trim())}function cQ($,Q){const V=["true","True","TRUE"],X=["false","False","FALSE"],J=q9($,Q);if(V.includes(J))return!0;if(X.includes(J))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${$}\nSupport boolean input list: \`true | True | TRUE | false | False | FALSE\``)}function lQ($,Q){if(process.env.GITHUB_OUTPUT||"")return d0.issueFileCommand("OUTPUT",d0.prepareKeyValueMessage($,Q));process.stdout.write(Z1.EOL),p.issueCommand("set-output",{name:$},G5.toCommandValue(Q))}function dQ($){p.issue("echo",$?"on":"off")}function iQ($){process.exitCode=K1.Failure,G1($)}function pQ(){return process.env.RUNNER_DEBUG==="1"}function aQ($){p.issueCommand("debug",{},$)}function G1($,Q={}){p.issueCommand("error",G5.toCommandProperties(Q),$ instanceof Error?$.toString():$)}function nQ($,Q={}){p.issueCommand("warning",G5.toCommandProperties(Q),$ instanceof Error?$.toString():$)}function sQ($,Q={}){p.issueCommand("notice",G5.toCommandProperties(Q),$ instanceof Error?$.toString():$)}function oQ($){process.stdout.write($+Z1.EOL)}function Y1($){p.issue("group",$)}function z1(){p.issue("endgroup")}function rQ($,Q){return J1(this,void 0,void 0,function*(){Y1($);let V;try{V=yield Q()}finally{z1()}return V})}function tQ($,Q){if(process.env.GITHUB_STATE||"")return d0.issueFileCommand("STATE",d0.prepareKeyValueMessage($,Q));p.issueCommand("save-state",{name:$},G5.toCommandValue(Q))}function eQ($){return process.env[`STATE_${$}`]||""}function $V($){return J1(this,void 0,void 0,function*(){return yield bQ.OidcClient.getIDToken($)})}var kQ=B&&B.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),yQ=B&&B.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),X1=B&&B.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))kQ(Q,$,V)}return yQ(Q,$),Q},J1=B&&B.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(B,"__esModule",{value:!0});B.getIDToken=B.getState=B.saveState=B.group=B.endGroup=B.startGroup=B.info=B.notice=B.warning=B.error=B.debug=B.isDebug=B.setFailed=B.setCommandEcho=B.setOutput=B.getBooleanInput=B.getMultilineInput=B.getInput=B.addPath=B.setSecret=B.exportVariable=B.ExitCode=void 0;var p=u$(),d0=y7(),G5=t5(),Z1=X1(j("os")),EQ=X1(j("path")),bQ=e7(),K1;(function($){$[$.Success=0]="Success",$[$.Failure=1]="Failure"})(K1=B.ExitCode||(B.ExitCode={}));B.exportVariable=mQ;B.setSecret=hQ;B.addPath=uQ;B.getInput=q9;B.getMultilineInput=fQ;B.getBooleanInput=cQ;B.setOutput=lQ;B.setCommandEcho=dQ;B.setFailed=iQ;B.isDebug=pQ;B.debug=aQ;B.error=G1;B.warning=nQ;B.notice=sQ;B.info=oQ;B.startGroup=Y1;B.endGroup=z1;B.group=rQ;B.saveState=tQ;B.getState=eQ;B.getIDToken=$V;var QV=W9();Object.defineProperty(B,"summary",{enumerable:!0,get:function(){return QV.summary}});var VV=W9();Object.defineProperty(B,"markdownSummary",{enumerable:!0,get:function(){return VV.markdownSummary}});var B9=V1();Object.defineProperty(B,"toPosixPath",{enumerable:!0,get:function(){return B9.toPosixPath}});Object.defineProperty(B,"toWin32Path",{enumerable:!0,get:function(){return B9.toWin32Path}});Object.defineProperty(B,"toPlatformPath",{enumerable:!0,get:function(){return B9.toPlatformPath}})});var L=C4(G9(),1);import{promises as t,createWriteStream as rX}from"fs";import{dirname as N$,join as O5,resolve as S$}from"path";import{pipeline as tX}from"stream/promises";import LV from"events";import u from"fs";import{EventEmitter as F9}from"node:events";import M1 from"node:stream";import{StringDecoder as XV}from"node:string_decoder";var W1=typeof process==="object"&&process?process:{stdout:null,stderr:null},JV=($)=>!!$&&typeof $==="object"&&($ instanceof c||$ instanceof M1||ZV($)||KV($)),ZV=($)=>!!$&&typeof $==="object"&&$ instanceof F9&&typeof $.pipe==="function"&&$.pipe!==M1.Writable.prototype.pipe,KV=($)=>!!$&&typeof $==="object"&&$ instanceof F9&&typeof $.write==="function"&&typeof $.end==="function",F0=Symbol("EOF"),H0=Symbol("maybeEmitEnd"),N0=Symbol("emittedEnd"),K8=Symbol("emittingEnd"),T5=Symbol("emittedError"),G8=Symbol("closed"),q1=Symbol("read"),Y8=Symbol("flush"),B1=Symbol("flushChunk"),Q0=Symbol("encoding"),Y5=Symbol("decoder"),S=Symbol("flowing"),C5=Symbol("paused"),z5=Symbol("resume"),_=Symbol("buffer"),b=Symbol("pipes"),R=Symbol("bufferLength"),L9=Symbol("bufferPush"),z8=Symbol("bufferShift"),k=Symbol("objectMode"),C=Symbol("destroyed"),M9=Symbol("error"),A9=Symbol("emitData"),L1=Symbol("emitEnd"),I9=Symbol("emitEnd2"),G0=Symbol("async"),w9=Symbol("abort"),W8=Symbol("aborted"),j5=Symbol("signal"),i0=Symbol("dataListeners"),f=Symbol("discarded"),D5=($)=>Promise.resolve().then($),GV=($)=>$(),YV=($)=>$==="end"||$==="finish"||$==="prefinish",zV=($)=>$ instanceof ArrayBuffer||!!$&&typeof $==="object"&&$.constructor&&$.constructor.name==="ArrayBuffer"&&$.byteLength>=0,WV=($)=>!Buffer.isBuffer($)&&ArrayBuffer.isView($);class H9{src;dest;opts;ondrain;constructor($,Q,V){this.src=$,this.dest=Q,this.opts=V,this.ondrain=()=>$[z5](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors($){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class A1 extends H9{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor($,Q,V){super($,Q,V);this.proxyErrors=(X)=>Q.emit("error",X),$.on("error",this.proxyErrors)}}var qV=($)=>!!$.objectMode,BV=($)=>!$.objectMode&&!!$.encoding&&$.encoding!=="buffer";class c extends F9{[S]=!1;[C5]=!1;[b]=[];[_]=[];[k];[Q0];[G0];[Y5];[F0]=!1;[N0]=!1;[K8]=!1;[G8]=!1;[T5]=null;[R]=0;[C]=!1;[j5];[W8]=!1;[i0]=0;[f]=!1;writable=!0;readable=!0;constructor(...$){const Q=$[0]||{};super();if(Q.objectMode&&typeof Q.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(qV(Q))this[k]=!0,this[Q0]=null;else if(BV(Q))this[Q0]=Q.encoding,this[k]=!1;else this[k]=!1,this[Q0]=null;if(this[G0]=!!Q.async,this[Y5]=this[Q0]?new XV(this[Q0]):null,Q&&Q.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[_]});if(Q&&Q.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[b]});const{signal:V}=Q;if(V)if(this[j5]=V,V.aborted)this[w9]();else V.addEventListener("abort",()=>this[w9]())}get bufferLength(){return this[R]}get encoding(){return this[Q0]}set encoding($){throw new Error("Encoding must be set at instantiation time")}setEncoding($){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[k]}set objectMode($){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[G0]}set["async"]($){this[G0]=this[G0]||!!$}[w9](){this[W8]=!0,this.emit("abort",this[j5]?.reason),this.destroy(this[j5]?.reason)}get aborted(){return this[W8]}set aborted($){}write($,Q,V){if(this[W8])return!1;if(this[F0])throw new Error("write after end");if(this[C])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof Q==="function")V=Q,Q="utf8";if(!Q)Q="utf8";const X=this[G0]?D5:GV;if(!this[k]&&!Buffer.isBuffer($)){if(WV($))$=Buffer.from($.buffer,$.byteOffset,$.byteLength);else if(zV($))$=Buffer.from($);else if(typeof $!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[k]){if(this[S]&&this[R]!==0)this[Y8](!0);if(this[S])this.emit("data",$);else this[L9]($);if(this[R]!==0)this.emit("readable");if(V)X(V);return this[S]}if(!$.length){if(this[R]!==0)this.emit("readable");if(V)X(V);return this[S]}if(typeof $==="string"&&!(Q===this[Q0]&&!this[Y5]?.lastNeed))$=Buffer.from($,Q);if(Buffer.isBuffer($)&&this[Q0])$=this[Y5].write($);if(this[S]&&this[R]!==0)this[Y8](!0);if(this[S])this.emit("data",$);else this[L9]($);if(this[R]!==0)this.emit("readable");if(V)X(V);return this[S]}read($){if(this[C])return null;if(this[f]=!1,this[R]===0||$===0||$&&$>this[R])return this[H0](),null;if(this[k])$=null;if(this[_].length>1&&!this[k])this[_]=[this[Q0]?this[_].join(""):Buffer.concat(this[_],this[R])];const Q=this[q1]($||null,this[_][0]);return this[H0](),Q}[q1]($,Q){if(this[k])this[z8]();else{const V=Q;if($===V.length||$===null)this[z8]();else if(typeof V==="string")this[_][0]=V.slice($),Q=V.slice(0,$),this[R]-=$;else this[_][0]=V.subarray($),Q=V.subarray(0,$),this[R]-=$}if(this.emit("data",Q),!this[_].length&&!this[F0])this.emit("drain");return Q}end($,Q,V){if(typeof $==="function")V=$,$=void 0;if(typeof Q==="function")V=Q,Q="utf8";if($!==void 0)this.write($,Q);if(V)this.once("end",V);if(this[F0]=!0,this.writable=!1,this[S]||!this[C5])this[H0]();return this}[z5](){if(this[C])return;if(!this[i0]&&!this[b].length)this[f]=!0;if(this[C5]=!1,this[S]=!0,this.emit("resume"),this[_].length)this[Y8]();else if(this[F0])this[H0]();else this.emit("drain")}resume(){return this[z5]()}pause(){this[S]=!1,this[C5]=!0,this[f]=!1}get destroyed(){return this[C]}get flowing(){return this[S]}get paused(){return this[C5]}[L9]($){if(this[k])this[R]+=1;else this[R]+=$.length;this[_].push($)}[z8](){if(this[k])this[R]-=1;else this[R]-=this[_][0].length;return this[_].shift()}[Y8]($=!1){do;while(this[B1](this[z8]())&&this[_].length);if(!$&&!this[_].length&&!this[F0])this.emit("drain")}[B1]($){return this.emit("data",$),this[S]}pipe($,Q){if(this[C])return $;this[f]=!1;const V=this[N0];if(Q=Q||{},$===W1.stdout||$===W1.stderr)Q.end=!1;else Q.end=Q.end!==!1;if(Q.proxyErrors=!!Q.proxyErrors,V){if(Q.end)$.end()}else if(this[b].push(!Q.proxyErrors?new H9(this,$,Q):new A1(this,$,Q)),this[G0])D5(()=>this[z5]());else this[z5]();return $}unpipe($){const Q=this[b].find((V)=>V.dest===$);if(Q){if(this[b].length===1){if(this[S]&&this[i0]===0)this[S]=!1;this[b]=[]}else this[b].splice(this[b].indexOf(Q),1);Q.unpipe()}}addListener($,Q){return this.on($,Q)}on($,Q){const V=super.on($,Q);if($==="data"){if(this[f]=!1,this[i0]++,!this[b].length&&!this[S])this[z5]()}else if($==="readable"&&this[R]!==0)super.emit("readable");else if(YV($)&&this[N0])super.emit($),this.removeAllListeners($);else if($==="error"&&this[T5]){const X=Q;if(this[G0])D5(()=>X.call(this,this[T5]));else X.call(this,this[T5])}return V}removeListener($,Q){return this.off($,Q)}off($,Q){const V=super.off($,Q);if($==="data"){if(this[i0]=this.listeners("data").length,this[i0]===0&&!this[f]&&!this[b].length)this[S]=!1}return V}removeAllListeners($){const Q=super.removeAllListeners($);if($==="data"||$===void 0){if(this[i0]=0,!this[f]&&!this[b].length)this[S]=!1}return Q}get emittedEnd(){return this[N0]}[H0](){if(!this[K8]&&!this[N0]&&!this[C]&&this[_].length===0&&this[F0]){if(this[K8]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[G8])this.emit("close");this[K8]=!1}}emit($,...Q){const V=Q[0];if($!=="error"&&$!=="close"&&$!==C&&this[C])return!1;else if($==="data")return!this[k]&&!V?!1:this[G0]?(D5(()=>this[A9](V)),!0):this[A9](V);else if($==="end")return this[L1]();else if($==="close"){if(this[G8]=!0,!this[N0]&&!this[C])return!1;const J=super.emit("close");return this.removeAllListeners("close"),J}else if($==="error"){this[T5]=V,super.emit(M9,V);const J=!this[j5]||this.listeners("error").length?super.emit("error",V):!1;return this[H0](),J}else if($==="resume"){const J=super.emit("resume");return this[H0](),J}else if($==="finish"||$==="prefinish"){const J=super.emit($);return this.removeAllListeners($),J}const X=super.emit($,...Q);return this[H0](),X}[A9]($){for(let V of this[b])if(V.dest.write($)===!1)this.pause();const Q=this[f]?!1:super.emit("data",$);return this[H0](),Q}[L1](){if(this[N0])return!1;return this[N0]=!0,this.readable=!1,this[G0]?(D5(()=>this[I9]()),!0):this[I9]()}[I9](){if(this[Y5]){const Q=this[Y5].end();if(Q){for(let V of this[b])V.dest.write(Q);if(!this[f])super.emit("data",Q)}}for(let Q of this[b])Q.end();const $=super.emit("end");return this.removeAllListeners("end"),$}async collect(){const $=Object.assign([],{dataLength:0});if(!this[k])$.dataLength=0;const Q=this.promise();return this.on("data",(V)=>{if($.push(V),!this[k])$.dataLength+=V.length}),await Q,$}async concat(){if(this[k])throw new Error("cannot concat in objectMode");const $=await this.collect();return this[Q0]?$.join(""):Buffer.concat($,$.dataLength)}async promise(){return new Promise(($,Q)=>{this.on(C,()=>Q(new Error("stream destroyed"))),this.on("error",(V)=>Q(V)),this.on("end",()=>$())})}[Symbol.asyncIterator](){this[f]=!1;let $=!1;const Q=async()=>{return this.pause(),$=!0,{value:void 0,done:!0}};return{next:()=>{if($)return Q();const X=this.read();if(X!==null)return Promise.resolve({done:!1,value:X});if(this[F0])return Q();let J,Z;const K=(z)=>{this.off("data",G),this.off("end",Y),this.off(C,W),Q(),Z(z)},G=(z)=>{this.off("error",K),this.off("end",Y),this.off(C,W),this.pause(),J({value:z,done:!!this[F0]})},Y=()=>{this.off("error",K),this.off("data",G),this.off(C,W),Q(),J({done:!0,value:void 0})},W=()=>K(new Error("stream destroyed"));return new Promise((z,q)=>{Z=q,J=z,this.once(C,W),this.once("error",K),this.once("end",Y),this.once("data",G)})},throw:Q,return:Q,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[f]=!1;let $=!1;const Q=()=>{return this.pause(),this.off(M9,Q),this.off(C,Q),this.off("end",Q),$=!0,{done:!0,value:void 0}},V=()=>{if($)return Q();const X=this.read();return X===null?Q():{done:!1,value:X}};return this.once("end",Q),this.once(M9,Q),this.once(C,Q),{next:V,throw:Q,return:Q,[Symbol.iterator](){return this}}}destroy($){if(this[C]){if($)this.emit("error",$);else this.emit(C);return this}this[C]=!0,this[f]=!0,this[_].length=0,this[R]=0;const Q=this;if(typeof Q.close==="function"&&!this[G8])Q.close();if($)this.emit("error",$);else this.emit(C);return this}static get isStream(){return JV}}var MV=u.writev,_0=Symbol("_autoClose"),X0=Symbol("_close"),N5=Symbol("_ended"),w=Symbol("_fd"),P9=Symbol("_finished"),v0=Symbol("_flags"),v9=Symbol("_flush"),T9=Symbol("_handleChunk"),C9=Symbol("_makeBuf"),_5=Symbol("_mode"),q8=Symbol("_needDrain"),B5=Symbol("_onerror"),L5=Symbol("_onopen"),O9=Symbol("_onread"),W5=Symbol("_onwrite"),R0=Symbol("_open"),V0=Symbol("_path"),S0=Symbol("_pos"),Y0=Symbol("_queue"),q5=Symbol("_read"),U9=Symbol("_readSize"),P0=Symbol("_reading"),S5=Symbol("_remain"),x9=Symbol("_size"),B8=Symbol("_write"),p0=Symbol("_writing"),L8=Symbol("_defaultFlag"),a0=Symbol("_errored");class M5 extends c{[a0]=!1;[w];[V0];[U9];[P0]=!1;[x9];[S5];[_0];constructor($,Q){Q=Q||{};super(Q);if(this.readable=!0,this.writable=!1,typeof $!=="string")throw new TypeError("path must be a string");if(this[a0]=!1,this[w]=typeof Q.fd==="number"?Q.fd:void 0,this[V0]=$,this[U9]=Q.readSize||16777216,this[P0]=!1,this[x9]=typeof Q.size==="number"?Q.size:1/0,this[S5]=this[x9],this[_0]=typeof Q.autoClose==="boolean"?Q.autoClose:!0,typeof this[w]==="number")this[q5]();else this[R0]()}get fd(){return this[w]}get path(){return this[V0]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[R0](){u.open(this[V0],"r",($,Q)=>this[L5]($,Q))}[L5]($,Q){if($)this[B5]($);else this[w]=Q,this.emit("open",Q),this[q5]()}[C9](){return Buffer.allocUnsafe(Math.min(this[U9],this[S5]))}[q5](){if(!this[P0]){this[P0]=!0;const $=this[C9]();if($.length===0)return process.nextTick(()=>this[O9](null,0,$));u.read(this[w],$,0,$.length,null,(Q,V,X)=>this[O9](Q,V,X))}}[O9]($,Q,V){if(this[P0]=!1,$)this[B5]($);else if(this[T9](Q,V))this[q5]()}[X0](){if(this[_0]&&typeof this[w]==="number"){const $=this[w];this[w]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}[B5]($){this[P0]=!0,this[X0](),this.emit("error",$)}[T9]($,Q){let V=!1;if(this[S5]-=$,$>0)V=super.write($this[L5]($,Q))}[L5]($,Q){if(this[L8]&&this[v0]==="r+"&&$&&$.code==="ENOENT")this[v0]="w",this[R0]();else if($)this[B5]($);else if(this[w]=Q,this.emit("open",Q),!this[p0])this[v9]()}end($,Q){if($)this.write($,Q);if(this[N5]=!0,!this[p0]&&!this[Y0].length&&typeof this[w]==="number")this[W5](null,0);return this}write($,Q){if(typeof $==="string")$=Buffer.from($,Q);if(this[N5])return this.emit("error",new Error("write() after end()")),!1;if(this[w]===void 0||this[p0]||this[Y0].length)return this[Y0].push($),this[q8]=!0,!1;return this[p0]=!0,this[B8]($),!0}[B8]($){u.write(this[w],$,0,$.length,this[S0],(Q,V)=>this[W5](Q,V))}[W5]($,Q){if($)this[B5]($);else{if(this[S0]!==void 0&&typeof Q==="number")this[S0]+=Q;if(this[Y0].length)this[v9]();else if(this[p0]=!1,this[N5]&&!this[P9])this[P9]=!0,this[X0](),this.emit("finish");else if(this[q8])this[q8]=!1,this.emit("drain")}}[v9](){if(this[Y0].length===0){if(this[N5])this[W5](null,0)}else if(this[Y0].length===1)this[B8](this[Y0].pop());else{const $=this[Y0];this[Y0]=[],MV(this[w],$,this[S0],(Q,V)=>this[W5](Q,V))}}[X0](){if(this[_0]&&typeof this[w]==="number"){const $=this[w];this[w]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}}class R5 extends g0{[R0](){let $;if(this[L8]&&this[v0]==="r+")try{$=u.openSync(this[V0],this[v0],this[_5])}catch(Q){if(Q?.code==="ENOENT")return this[v0]="w",this[R0]();else throw Q}else $=u.openSync(this[V0],this[v0],this[_5]);this[L5](null,$)}[X0](){if(this[_0]&&typeof this[w]==="number"){const $=this[w];this[w]=void 0,u.closeSync($),this.emit("close")}}[B8]($){let Q=!0;try{this[W5](null,u.writeSync(this[w],$,0,$.length,this[S0])),Q=!1}finally{if(Q)try{this[X0]()}catch{}}}}import n1 from"node:path";import w5 from"node:fs";import{dirname as pV,parse as aV}from"path";var AV=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"]]),I1=($)=>!!$.sync&&!!$.file,w1=($)=>!$.sync&&!!$.file,F1=($)=>!!$.sync&&!$.file,H1=($)=>!$.sync&&!$.file;var P1=($)=>!!$.file;var IV=($)=>{const Q=AV.get($);if(Q)return Q;return $},g5=($={})=>{if(!$)return{};const Q={};for(let[V,X]of Object.entries($)){const J=IV(V);Q[J]=X}if(Q.chmod===void 0&&Q.noChmod===!1)Q.chmod=!0;return delete Q.noChmod,Q};var z0=($,Q,V,X,J)=>{return Object.assign((Z=[],K,G)=>{if(Array.isArray(Z))K=Z,Z={};if(typeof K==="function")G=K,K=void 0;if(!K)K=[];else K=Array.from(K);const Y=g5(Z);if(J?.(Y,K),I1(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return $(Y,K)}else if(w1(Y)){const W=Q(Y,K),z=G?G:void 0;return z?W.then(()=>z(),z):W}else if(F1(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return V(Y,K)}else if(H1(Y)){if(typeof G==="function")throw new TypeError("callback only supported with file option");return X(Y,K)}else throw new Error("impossible options??")},{syncFile:$,asyncFile:Q,syncNoFile:V,asyncNoFile:X,validate:J})};import{EventEmitter as lV}from"events";import S9 from"assert";import{Buffer as k0}from"buffer";import HV from"zlib";import wV from"zlib";var FV=wV.constants||{ZLIB_VERNUM:4736},O0=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},FV));var v1=k0.concat,n0=Symbol("_superWrite");class k5 extends Error{code;errno;constructor($){super("zlib: "+$.message);if(this.code=$.code,this.errno=$.errno,!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+$.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}var N9=Symbol("flushFlag");class _9 extends c{#$=!1;#V=!1;#X;#Z;#J;#Q;#K;get sawError(){return this.#$}get handle(){return this.#Q}get flushFlag(){return this.#X}constructor($,Q){if(!$||typeof $!=="object")throw new TypeError("invalid options for ZlibBase constructor");super($);this.#X=$.flush??0,this.#Z=$.finishFlush??0,this.#J=$.fullFlushFlag??0;try{this.#Q=new HV[Q]($)}catch(V){throw new k5(V)}this.#K=(V)=>{if(this.#$)return;this.#$=!0,this.close(),this.emit("error",V)},this.#Q?.on("error",(V)=>this.#K(new k5(V))),this.once("end",()=>this.close)}close(){if(this.#Q)this.#Q.close(),this.#Q=void 0,this.emit("close")}reset(){if(!this.#$)return S9(this.#Q,"zlib binding closed"),this.#Q.reset?.()}flush($){if(this.ended)return;if(typeof $!=="number")$=this.#J;this.write(Object.assign(k0.alloc(0),{[N9]:$}))}end($,Q,V){if(typeof $==="function")V=$,Q=void 0,$=void 0;if(typeof Q==="function")V=Q,Q=void 0;if($)if(Q)this.write($,Q);else this.write($);return this.flush(this.#Z),this.#V=!0,super.end(V)}get ended(){return this.#V}[n0]($){return super.write($)}write($,Q,V){if(typeof Q==="function")V=Q,Q="utf8";if(typeof $==="string")$=k0.from($,Q);if(this.#$)return;S9(this.#Q,"zlib binding closed");const X=this.#Q._handle,J=X.close;X.close=()=>{};const Z=this.#Q.close;this.#Q.close=()=>{},k0.concat=(Y)=>Y;let K=void 0;try{const Y=typeof $[N9]==="number"?$[N9]:this.#X;K=this.#Q._processChunk($,Y),k0.concat=v1}catch(Y){k0.concat=v1,this.#K(new k5(Y))}finally{if(this.#Q)this.#Q._handle=X,X.close=J,this.#Q.close=Z,this.#Q.removeAllListeners("error")}if(this.#Q)this.#Q.on("error",(Y)=>this.#K(new k5(Y)));let G;if(K)if(Array.isArray(K)&&K.length>0){const Y=K[0];G=this[n0](k0.from(Y));for(let W=1;W{if(typeof X==="function")J=X,X=this.flushFlag;this.flush(X),J?.()};try{this.handle.params($,Q)}finally{this.handle.flush=V}if(this.handle)this.#$=$,this.#V=Q}}}class g9 extends R9{#$;constructor($){super($,"Gzip");this.#$=$&&!!$.portable}[n0]($){if(!this.#$)return super[n0]($);return this.#$=!1,$[9]=255,super[n0]($)}}class k9 extends R9{constructor($){super($,"Unzip")}}class y9 extends _9{constructor($,Q){$=$||{},$.flush=$.flush||O0.BROTLI_OPERATION_PROCESS,$.finishFlush=$.finishFlush||O0.BROTLI_OPERATION_FINISH,$.fullFlushFlag=O0.BROTLI_OPERATION_FLUSH;super($,Q)}}class E9 extends y9{constructor($){super($,"BrotliCompress")}}class b9 extends y9{constructor($){super($,"BrotliDecompress")}}function vV($,Q,V){const X=Q,J=Q?Q.next:$.head,Z=new M8(V,X,J,$);if(Z.next===void 0)$.tail=Z;if(Z.prev===void 0)$.head=Z;return $.length++,Z}function OV($,Q){if($.tail=new M8(Q,$.tail,void 0,$),!$.head)$.head=$.tail;$.length++}function UV($,Q){if($.head=new M8(Q,void 0,$.head,$),!$.tail)$.tail=$.head;$.length++}class W0{tail;head;length=0;static create($=[]){return new W0($)}constructor($=[]){for(let Q of $)this.push(Q)}*[Symbol.iterator](){for(let $=this.head;$;$=$.next)yield $.value}removeNode($){if($.list!==this)throw new Error("removing node which does not belong to this list");const{next:Q,prev:V}=$;if(Q)Q.prev=V;if(V)V.next=Q;if($===this.head)this.head=Q;if($===this.tail)this.tail=V;return this.length--,$.next=void 0,$.prev=void 0,$.list=void 0,Q}unshiftNode($){if($===this.head)return;if($.list)$.list.removeNode($);const Q=this.head;if($.list=this,$.next=Q,Q)Q.prev=$;if(this.head=$,!this.tail)this.tail=$;this.length++}pushNode($){if($===this.tail)return;if($.list)$.list.removeNode($);const Q=this.tail;if($.list=this,$.prev=Q,Q)Q.next=$;if(this.tail=$,!this.head)this.head=$;this.length++}push(...$){for(let Q=0,V=$.length;Q1)V=Q;else if(this.head)X=this.head.next,V=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var J=0;X;J++)V=$(V,X.value,J),X=X.next;return V}reduceReverse($,Q){let V,X=this.tail;if(arguments.length>1)V=Q;else if(this.tail)X=this.tail.prev,V=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let J=this.length-1;X;J--)V=$(V,X.value,J),X=X.prev;return V}toArray(){const $=new Array(this.length);for(let Q=0,V=this.head;V;Q++)$[Q]=V.value,V=V.next;return $}toArrayReverse(){const $=new Array(this.length);for(let Q=0,V=this.tail;V;Q++)$[Q]=V.value,V=V.prev;return $}slice($=0,Q=this.length){if(Q<0)Q+=this.length;if($<0)$+=this.length;const V=new W0;if(Q<$||Q<0)return V;if($<0)$=0;if(Q>this.length)Q=this.length;let X=this.head,J=0;for(J=0;!!X&&J<$;J++)X=X.next;for(;!!X&&Jthis.length)Q=this.length;let X=this.length,J=this.tail;for(;!!J&&X>Q;X--)J=J.prev;for(;!!J&&X>$;X--,J=J.prev)V.push(J.value);return V}splice($,Q=0,...V){if($>this.length)$=this.length-1;if($<0)$=this.length+$;let X=this.head;for(let Z=0;!!X&&Z<$;Z++)X=X.next;const J=[];for(let Z=0;!!X&&Z{if(!Number.isSafeInteger($))throw Error("cannot encode number outside of javascript safe integer range");else if($<0)TV($,Q);else xV($,Q);return Q},xV=($,Q)=>{Q[0]=128;for(var V=Q.length;V>1;V--)Q[V-1]=$&255,$=Math.floor($/256)},TV=($,Q)=>{Q[0]=255;var V=!1;$=$*-1;for(var X=Q.length;X>1;X--){var J=$&255;if($=Math.floor($/256),V)Q[X-1]=x1(J);else if(J===0)Q[X-1]=0;else V=!0,Q[X-1]=T1(J)}},U1=($)=>{const Q=$[0],V=Q===128?jV($.subarray(1,$.length)):Q===255?CV($):null;if(V===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(V))throw Error("parsed number outside of javascript safe integer range");return V},CV=($)=>{var Q=$.length,V=0,X=!1;for(var J=Q-1;J>-1;J--){var Z=Number($[J]),K;if(X)K=x1(Z);else if(Z===0)K=Z;else X=!0,K=T1(Z);if(K!==0)V-=K*Math.pow(256,Q-J-1)}return V},jV=($)=>{var Q=$.length,V=0;for(var X=Q-1;X>-1;X--){var J=Number($[X]);if(J!==0)V+=J*Math.pow(256,Q-X-1)}return V},x1=($)=>(255^$)&255,T1=($)=>(255^$)+1&255;var A8=($)=>I8.has($);var I8=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"]]),C1=new Map(Array.from(I8).map(($)=>[$[1],$[0]]));class a{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#$="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor($,Q=0,V,X){if(Buffer.isBuffer($))this.decode($,Q||0,V,X);else if($)this.#V($)}decode($,Q,V,X){if(!Q)Q=0;if(!$||!($.length>=Q+512))throw new Error("need 512 bytes for header");if(this.path=s0($,Q,100),this.mode=y0($,Q+100,8),this.uid=y0($,Q+108,8),this.gid=y0($,Q+116,8),this.size=y0($,Q+124,12),this.mtime=m9($,Q+136,12),this.cksum=y0($,Q+148,12),X)this.#V(X,!0);if(V)this.#V(V);const J=s0($,Q+156,1);if(A8(J))this.#$=J||"0";if(this.#$==="0"&&this.path.slice(-1)==="/")this.#$="5";if(this.#$==="5")this.size=0;if(this.linkpath=s0($,Q+157,100),$.subarray(Q+257,Q+265).toString()==="ustar\x0000")if(this.uname=s0($,Q+265,32),this.gname=s0($,Q+297,32),this.devmaj=y0($,Q+329,8)??0,this.devmin=y0($,Q+337,8)??0,$[Q+475]!==0){const K=s0($,Q+345,155);this.path=K+"/"+this.path}else{const K=s0($,Q+345,130);if(K)this.path=K+"/"+this.path;this.atime=m9($,Q+476,12),this.ctime=m9($,Q+488,12)}let Z=256;for(let K=Q;K{return!(X===null||X===void 0||V==="path"&&Q||V==="linkpath"&&Q||V==="global")})))}encode($,Q=0){if(!$)$=this.block=Buffer.alloc(512);if(this.#$==="Unsupported")this.#$="0";if(!($.length>=Q+512))throw new Error("need 512 bytes for header");const V=this.ctime||this.atime?130:155,X=NV(this.path||"",V),J=X[0],Z=X[1];if(this.needPax=!!X[2],this.needPax=o0($,Q,100,J)||this.needPax,this.needPax=E0($,Q+100,8,this.mode)||this.needPax,this.needPax=E0($,Q+108,8,this.uid)||this.needPax,this.needPax=E0($,Q+116,8,this.gid)||this.needPax,this.needPax=E0($,Q+124,12,this.size)||this.needPax,this.needPax=h9($,Q+136,12,this.mtime)||this.needPax,$[Q+156]=this.#$.charCodeAt(0),this.needPax=o0($,Q+157,100,this.linkpath)||this.needPax,$.write("ustar\x0000",Q+257,8),this.needPax=o0($,Q+265,32,this.uname)||this.needPax,this.needPax=o0($,Q+297,32,this.gname)||this.needPax,this.needPax=E0($,Q+329,8,this.devmaj)||this.needPax,this.needPax=E0($,Q+337,8,this.devmin)||this.needPax,this.needPax=o0($,Q+345,V,Z)||this.needPax,$[Q+475]!==0)this.needPax=o0($,Q+345,155,Z)||this.needPax;else this.needPax=o0($,Q+345,130,Z)||this.needPax,this.needPax=h9($,Q+476,12,this.atime)||this.needPax,this.needPax=h9($,Q+488,12,this.ctime)||this.needPax;let K=256;for(let G=Q;G{let X=$,J="",Z=void 0;const K=A5.parse($).root||".";if(Buffer.byteLength(X)<100)Z=[X,J,!1];else{J=A5.dirname(X),X=A5.basename(X);do if(Buffer.byteLength(X)<=100&&Buffer.byteLength(J)<=Q)Z=[X,J,!1];else if(Buffer.byteLength(X)>100&&Buffer.byteLength(J)<=Q)Z=[X.slice(0,99),J,!0];else X=A5.join(A5.basename(J),X),J=A5.dirname(J);while(J!==K&&Z===void 0);if(!Z)Z=[$.slice(0,99),"",!0]}return Z},s0=($,Q,V)=>$.subarray(Q,Q+V).toString("utf8").replace(/\0.*/,""),m9=($,Q,V)=>SV(y0($,Q,V)),SV=($)=>$===void 0?void 0:new Date($*1000),y0=($,Q,V)=>Number($[Q])&128?U1($.subarray(Q,Q+V)):RV($,Q,V),_V=($)=>isNaN($)?void 0:$,RV=($,Q,V)=>_V(parseInt($.subarray(Q,Q+V).toString("utf8").replace(/\0.*$/,"").trim(),8)),gV={12:8589934591,8:2097151},E0=($,Q,V,X)=>X===void 0?!1:X>gV[V]||X<0?(O1(X,$.subarray(Q,Q+V)),!0):(kV($,Q,V,X),!1),kV=($,Q,V,X)=>$.write(yV(X,V),Q,V,"ascii"),yV=($,Q)=>EV(Math.floor($).toString(8),Q),EV=($,Q)=>($.length===Q-1?$:new Array(Q-$.length-1).join("0")+$+" ")+"\0",h9=($,Q,V,X)=>X===void 0?!1:E0($,Q,V,X.getTime()/1000),bV=new Array(156).join("\0"),o0=($,Q,V,X)=>X===void 0?!1:($.write(X+bV,Q,V,"utf8"),X.length!==Buffer.byteLength(X)||X.length>V);import{basename as mV}from"node:path";class b0{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor($,Q=!1){this.atime=$.atime,this.charset=$.charset,this.comment=$.comment,this.ctime=$.ctime,this.dev=$.dev,this.gid=$.gid,this.global=Q,this.gname=$.gname,this.ino=$.ino,this.linkpath=$.linkpath,this.mtime=$.mtime,this.nlink=$.nlink,this.path=$.path,this.size=$.size,this.uid=$.uid,this.uname=$.uname}encode(){const $=this.encodeBody();if($==="")return Buffer.allocUnsafe(0);const Q=Buffer.byteLength($),V=512*Math.ceil(1+Q/512),X=Buffer.allocUnsafe(V);for(let J=0;J<512;J++)X[J]=0;new a({path:("PaxHeader/"+mV(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:Q,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(X),X.write($,512,Q,"utf8");for(let J=Q+512;J=Math.pow(10,Z))Z+=1;return Z+J+X}static parse($,Q,V=!1){return new b0(hV(uV($),Q),V)}}var hV=($,Q)=>Q?Object.assign({},Q,$):$,uV=($)=>$.replace(/\n$/,"").split("\n").reduce(fV,Object.create(null)),fV=($,Q)=>{const V=parseInt(Q,10);if(V!==Buffer.byteLength(Q)+1)return $;Q=Q.slice((V+" ").length);const X=Q.split("="),J=X.shift();if(!J)return $;const Z=J.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),K=X.join("=");return $[Z]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(Z)?new Date(Number(K)*1000):/^[0-9]+$/.test(K)?+K:K,$};var cV=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,A=cV!=="win32"?($)=>$:($)=>$&&$.replace(/\\/g,"/");class y5 extends c{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($,Q,V){super({});switch(this.pause(),this.extended=Q,this.globalExtended=V,this.header=$,this.remain=$.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=$.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(!$.path)throw new Error("no path provided for tar.ReadEntry");if(this.path=A($.path),this.mode=$.mode,this.mode)this.mode=this.mode&4095;if(this.uid=$.uid,this.gid=$.gid,this.uname=$.uname,this.gname=$.gname,this.size=this.remain,this.mtime=$.mtime,this.atime=$.atime,this.ctime=$.ctime,this.linkpath=$.linkpath?A($.linkpath):void 0,this.uname=$.uname,this.gname=$.gname,Q)this.#$(Q);if(V)this.#$(V,!0)}write($){const Q=$.length;if(Q>this.blockRemain)throw new Error("writing more to entry than is appropriate");const V=this.remain,X=this.blockRemain;if(this.remain=Math.max(0,V-Q),this.blockRemain=Math.max(0,X-Q),this.ignore)return!0;if(V>=Q)return super.write($);return super.write($.subarray(0,V))}#$($,Q=!1){if($.path)$.path=A($.path);if($.linkpath)$.linkpath=A($.linkpath);Object.assign(this,Object.fromEntries(Object.entries($).filter(([V,X])=>{return!(X===null||X===void 0||V==="path"&&Q)})))}}var r0=($,Q,V,X={})=>{if($.file)X.file=$.file;if($.cwd)X.cwd=$.cwd;if(X.code=V instanceof Error&&V.code||Q,X.tarCode=Q,!$.strict&&X.recoverable!==!1){if(V instanceof Error)X=Object.assign(V,X),V=V.message;$.emit("warn",Q,V,X)}else if(V instanceof Error)$.emit("error",Object.assign(V,X));else $.emit("error",Object.assign(new Error(`${Q}: ${V}`),X))};var dV=1048576,u9=Buffer.from([31,139]),n=Symbol("state"),t0=Symbol("writeEntry"),U0=Symbol("readEntry"),f9=Symbol("nextEntry"),D1=Symbol("processEntry"),q0=Symbol("extendedHeader"),E5=Symbol("globalExtendedHeader"),m0=Symbol("meta"),N1=Symbol("emitMeta"),P=Symbol("buffer"),x0=Symbol("queue"),h0=Symbol("ended"),c9=Symbol("emittedEnd"),e0=Symbol("emit"),D=Symbol("unzip"),w8=Symbol("consumeChunk"),F8=Symbol("consumeChunkSub"),l9=Symbol("consumeBody"),S1=Symbol("consumeMeta"),_1=Symbol("consumeHeader"),b5=Symbol("consuming"),d9=Symbol("bufferConcat"),H8=Symbol("maybeEnd"),I5=Symbol("writing"),u0=Symbol("aborted"),P8=Symbol("onDone"),$5=Symbol("sawValidEntry"),v8=Symbol("sawNullBlock"),O8=Symbol("sawEOF"),R1=Symbol("closeStream"),iV=()=>!0;class f0 extends lV{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[x0]=new W0;[P];[U0];[t0];[n]="begin";[m0]="";[q0];[E5];[h0]=!1;[D];[u0]=!1;[$5];[v8]=!1;[O8]=!1;[I5]=!1;[b5]=!1;[c9]=!1;constructor($={}){super();if(this.file=$.file||"",this.on(P8,()=>{if(this[n]==="begin"||this[$5]===!1)this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),$.ondone)this.on(P8,$.ondone);else this.on(P8,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")});this.strict=!!$.strict,this.maxMetaEntrySize=$.maxMetaEntrySize||dV,this.filter=typeof $.filter==="function"?$.filter:iV;const Q=$.file&&($.file.endsWith(".tar.br")||$.file.endsWith(".tbr"));if(this.brotli=!$.gzip&&$.brotli!==void 0?$.brotli:Q?void 0:!1,this.on("end",()=>this[R1]()),typeof $.onwarn==="function")this.on("warn",$.onwarn);if(typeof $.onReadEntry==="function")this.on("entry",$.onReadEntry)}warn($,Q,V={}){r0(this,$,Q,V)}[_1]($,Q){if(this[$5]===void 0)this[$5]=!1;let V;try{V=new a($,Q,this[q0],this[E5])}catch(X){return this.warn("TAR_ENTRY_INVALID",X)}if(V.nullBlock)if(this[v8]){if(this[O8]=!0,this[n]==="begin")this[n]="header";this[e0]("eof")}else this[v8]=!0,this[e0]("nullBlock");else if(this[v8]=!1,!V.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:V});else if(!V.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:V});else{const X=V.type;if(/^(Symbolic)?Link$/.test(X)&&!V.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:V});else if(!/^(Symbolic)?Link$/.test(X)&&!/^(Global)?ExtendedHeader$/.test(X)&&V.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:V});else{const J=this[t0]=new y5(V,this[q0],this[E5]);if(!this[$5])if(J.remain){const Z=()=>{if(!J.invalid)this[$5]=!0};J.on("end",Z)}else this[$5]=!0;if(J.meta){if(J.size>this.maxMetaEntrySize)J.ignore=!0,this[e0]("ignoredEntry",J),this[n]="ignore",J.resume();else if(J.size>0)this[m0]="",J.on("data",(Z)=>this[m0]+=Z),this[n]="meta"}else if(this[q0]=void 0,J.ignore=J.ignore||!this.filter(J.path,J),J.ignore)this[e0]("ignoredEntry",J),this[n]=J.remain?"ignore":"header",J.resume();else{if(J.remain)this[n]="body";else this[n]="header",J.end();if(!this[U0])this[x0].push(J),this[f9]();else this[x0].push(J)}}}}[R1](){queueMicrotask(()=>this.emit("close"))}[D1]($){let Q=!0;if(!$)this[U0]=void 0,Q=!1;else if(Array.isArray($)){const[V,...X]=$;this.emit(V,...X)}else if(this[U0]=$,this.emit("entry",$),!$.emittedEnd)$.on("end",()=>this[f9]()),Q=!1;return Q}[f9](){do;while(this[D1](this[x0].shift()));if(!this[x0].length){const $=this[U0];if(!$||$.flowing||$.size===$.remain){if(!this[I5])this.emit("drain")}else $.once("drain",()=>this.emit("drain"))}}[l9]($,Q){const V=this[t0];if(!V)throw new Error("attempt to consume body without entry??");const X=V.blockRemain??0,J=X>=$.length&&Q===0?$:$.subarray(Q,Q+X);if(V.write(J),!V.blockRemain)this[n]="header",this[t0]=void 0,V.end();return J.length}[S1]($,Q){const V=this[t0],X=this[l9]($,Q);if(!this[t0]&&V)this[N1](V);return X}[e0]($,Q,V){if(!this[x0].length&&!this[U0])this.emit($,Q,V);else this[x0].push([$,Q,V])}[N1]($){switch(this[e0]("meta",this[m0]),$.type){case"ExtendedHeader":case"OldExtendedHeader":this[q0]=b0.parse(this[m0],this[q0],!1);break;case"GlobalExtendedHeader":this[E5]=b0.parse(this[m0],this[E5],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const Q=this[q0]??Object.create(null);this[q0]=Q,Q.path=this[m0].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const Q=this[q0]||Object.create(null);this[q0]=Q,Q.linkpath=this[m0].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+$.type)}}abort($){this[u0]=!0,this.emit("abort",$),this.warn("TAR_ABORT",$,{recoverable:!1})}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");if(this[u0])return V?.(),!1;if((this[D]===void 0||this.brotli===void 0&&this[D]===!1)&&$){if(this[P])$=Buffer.concat([this[P],$]),this[P]=void 0;if($.lengththis[w8](Y)),this[D].on("error",(Y)=>this.abort(Y)),this[D].on("end",()=>{this[h0]=!0,this[w8]()}),this[I5]=!0;const G=!!this[D][K?"end":"write"]($);return this[I5]=!1,V?.(),G}}if(this[I5]=!0,this[D])this[D].write($);else this[w8]($);this[I5]=!1;const J=this[x0].length?!1:this[U0]?this[U0].flowing:!0;if(!J&&!this[x0].length)this[U0]?.once("drain",()=>this.emit("drain"));return V?.(),J}[d9]($){if($&&!this[u0])this[P]=this[P]?Buffer.concat([this[P],$]):$}[H8](){if(this[h0]&&!this[c9]&&!this[u0]&&!this[b5]){this[c9]=!0;const $=this[t0];if($&&$.blockRemain){const Q=this[P]?this[P].length:0;if(this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${$.blockRemain} more bytes, only ${Q} available)`,{entry:$}),this[P])$.write(this[P]);$.end()}this[e0](P8)}}[w8]($){if(this[b5]&&$)this[d9]($);else if(!$&&!this[P])this[H8]();else if($){if(this[b5]=!0,this[P]){this[d9]($);const Q=this[P];this[P]=void 0,this[F8](Q)}else this[F8]($);while(this[P]&&this[P]?.length>=512&&!this[u0]&&!this[O8]){const Q=this[P];this[P]=void 0,this[F8](Q)}this[b5]=!1}if(!this[P]||this[h0])this[H8]()}[F8]($){let Q=0;const V=$.length;while(Q+512<=V&&!this[u0]&&!this[O8])switch(this[n]){case"begin":case"header":this[_1]($,Q),Q+=512;break;case"ignore":case"body":Q+=this[l9]($,Q);break;case"meta":Q+=this[S1]($,Q);break;default:throw new Error("invalid state: "+this[n])}if(Q{let Q=$.length-1,V=-1;while(Q>-1&&$.charAt(Q)==="/")V=Q,Q--;return V===-1?$:$.slice(0,V)};var nV=($)=>{const Q=$.onReadEntry;$.onReadEntry=Q?(V)=>{Q(V),V.resume()}:(V)=>V.resume()},i9=($,Q)=>{const V=new Map(Q.map((Z)=>[B0(Z),!0])),X=$.filter,J=(Z,K="")=>{const G=K||aV(Z).root||".";let Y;if(Z===G)Y=!1;else{const W=V.get(Z);if(W!==void 0)Y=W;else Y=J(pV(Z),G)}return V.set(Z,Y),Y};$.filter=X?(Z,K)=>X(Z,K)&&J(B0(Z)):(Z)=>J(B0(Z))},sV=($)=>{const Q=new f0($),V=$.file;let X;try{const J=w5.statSync(V),Z=$.maxReadSize||16777216;if(J.size{const V=new f0($),X=$.maxReadSize||16777216,J=$.file;return new Promise((K,G)=>{V.on("error",G),V.on("end",K),w5.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M5(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},Q5=z0(sV,oV,($)=>new f0($),($)=>new f0($),($,Q)=>{if(Q?.length)i9($,Q);if(!$.noResume)nV($)});import g8 from"fs";import L0 from"fs";import E1 from"path";var p9=($,Q,V)=>{if($&=4095,V)$=($|384)&-19;if(Q){if($&256)$|=64;if($&32)$|=8;if($&4)$|=1}return $};import{win32 as rV}from"node:path";var{isAbsolute:tV,parse:g1}=rV,m5=($)=>{let Q="",V=g1($);while(tV($)||V.root){const X=$.charAt(0)==="/"&&$.slice(0,4)!=="//?/"?"/":V.root;$=$.slice(X.length),Q+=X,V=g1($)}return[Q,$]};var U8=["|","<",">","?",":"],a9=U8.map(($)=>String.fromCharCode(61440+$.charCodeAt(0))),eV=new Map(U8.map(($,Q)=>[$,a9[Q]])),$X=new Map(a9.map(($,Q)=>[$,U8[Q]])),n9=($)=>U8.reduce((Q,V)=>Q.split(V).join(eV.get(V)),$),k1=($)=>a9.reduce((Q,V)=>Q.split(V).join($X.get(V)),$);var f1=($,Q)=>{if(!Q)return A($);return $=A($).replace(/^\.(\/|$)/,""),B0(Q)+"/"+$},QX=16777216,b1=Symbol("process"),m1=Symbol("file"),h1=Symbol("directory"),o9=Symbol("symlink"),u1=Symbol("hardlink"),h5=Symbol("header"),x8=Symbol("read"),r9=Symbol("lstat"),T8=Symbol("onlstat"),t9=Symbol("onread"),e9=Symbol("onreadlink"),$$=Symbol("openfile"),Q$=Symbol("onopenfile"),c0=Symbol("close"),C8=Symbol("mode"),V$=Symbol("awaitDrain"),s9=Symbol("ondrain"),M0=Symbol("prefix");class j8 extends c{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;#$=!1;constructor($,Q={}){const V=g5(Q);super();if(this.path=A($),this.portable=!!V.portable,this.maxReadSize=V.maxReadSize||QX,this.linkCache=V.linkCache||new Map,this.statCache=V.statCache||new Map,this.preservePaths=!!V.preservePaths,this.cwd=A(V.cwd||process.cwd()),this.strict=!!V.strict,this.noPax=!!V.noPax,this.noMtime=!!V.noMtime,this.mtime=V.mtime,this.prefix=V.prefix?A(V.prefix):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let X=!1;if(!this.preservePaths){const[Z,K]=m5(this.path);if(Z&&typeof K==="string")this.path=K,X=Z}if(this.win32=!!V.win32||process.platform==="win32",this.win32)this.path=k1(this.path.replace(/\\/g,"/")),$=$.replace(/\\/g,"/");if(this.absolute=A(V.absolute||E1.resolve(this.cwd,$)),this.path==="")this.path="./";if(X)this.warn("TAR_ENTRY_INFO",`stripping ${X} from absolute path`,{entry:this,path:X+this.path});const J=this.statCache.get(this.absolute);if(J)this[T8](J);else this[r9]()}warn($,Q,V={}){return r0(this,$,Q,V)}emit($,...Q){if($==="error")this.#$=!0;return super.emit($,...Q)}[r9](){L0.lstat(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[T8](Q)})}[T8]($){if(this.statCache.set(this.absolute,$),this.stat=$,!$.isFile())$.size=0;this.type=VX($),this.emit("stat",$),this[b1]()}[b1](){switch(this.type){case"File":return this[m1]();case"Directory":return this[h1]();case"SymbolicLink":return this[o9]();default:return this.end()}}[C8]($){return p9($,this.type==="Directory",this.portable)}[M0]($){return f1($,this.prefix)}[h5](){if(!this.stat)throw new Error("cannot write header before stat");if(this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.header=new a({path:this[M0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[M0](this.linkpath):this.linkpath,mode:this[C8](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 b0({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[M0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[M0](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());const $=this.header?.block;if(!$)throw new Error("failed to encode header");super.write($)}[h1](){if(!this.stat)throw new Error("cannot create directory entry without stat");if(this.path.slice(-1)!=="/")this.path+="/";this.stat.size=0,this[h5](),this.end()}[o9](){L0.readlink(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[e9](Q)})}[e9]($){this.linkpath=A($),this[h5](),this.end()}[u1]($){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=A(E1.relative(this.cwd,$)),this.stat.size=0,this[h5](),this.end()}[m1](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){const $=`${this.stat.dev}:${this.stat.ino}`,Q=this.linkCache.get($);if(Q?.indexOf(this.cwd)===0)return this[u1](Q);this.linkCache.set($,this.absolute)}if(this[h5](),this.stat.size===0)return this.end();this[$$]()}[$$](){L0.open(this.absolute,"r",($,Q)=>{if($)return this.emit("error",$);this[Q$](Q)})}[Q$]($){if(this.fd=$,this.#$)return this[c0]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;const Q=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(Q),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[x8]()}[x8](){const{fd:$,buf:Q,offset:V,length:X,pos:J}=this;if($===void 0||Q===void 0)throw new Error("cannot read file without first opening");L0.read($,Q,V,X,J,(Z,K)=>{if(Z)return this[c0](()=>this.emit("error",Z));this[t9](K)})}[c0]($=()=>{}){if(this.fd!==void 0)L0.close(this.fd,$)}[t9]($){if($<=0&&this.remain>0){const X=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[c0](()=>this.emit("error",X))}if($>this.remain){const X=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[c0](()=>this.emit("error",X))}if(!this.buf)throw new Error("should have created buffer prior to reading");if($===this.remain)for(let X=$;Xthis[s9]());else this[s9]()}[V$]($){this.once("drain",$)}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");if(this.blockRemain<$.length){const X=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",X)}return this.remain-=$.length,this.blockRemain-=$.length,this.pos+=$.length,this.offset+=$.length,super.write($,null,V)}[s9](){if(!this.remain){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));return this[c0](($)=>$?this.emit("error",$):this.end())}if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");if(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[x8]()}}class X$ extends j8{sync=!0;[r9](){this[T8](L0.lstatSync(this.absolute))}[o9](){this[e9](L0.readlinkSync(this.absolute))}[$$](){this[Q$](L0.openSync(this.absolute,"r"))}[x8](){let $=!0;try{const{fd:Q,buf:V,offset:X,length:J,pos:Z}=this;if(Q===void 0||V===void 0)throw new Error("fd and buf must be set in READ method");const K=L0.readSync(Q,V,X,J,Z);this[t9](K),$=!1}finally{if($)try{this[c0](()=>{})}catch(Q){}}}[V$]($){$()}[c0]($=()=>{}){if(this.fd!==void 0)L0.closeSync(this.fd);$()}}class J$ extends c{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;warn($,Q,V={}){return r0(this,$,Q,V)}constructor($,Q={}){const V=g5(Q);super();this.preservePaths=!!V.preservePaths,this.portable=!!V.portable,this.strict=!!V.strict,this.noPax=!!V.noPax,this.noMtime=!!V.noMtime,this.readEntry=$;const{type:X}=$;if(X==="Unsupported")throw new Error("writing entry that should be ignored");if(this.type=X,this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.prefix=V.prefix,this.path=A($.path),this.mode=$.mode!==void 0?this[C8]($.mode):void 0,this.uid=this.portable?void 0:$.uid,this.gid=this.portable?void 0:$.gid,this.uname=this.portable?void 0:$.uname,this.gname=this.portable?void 0:$.gname,this.size=$.size,this.mtime=this.noMtime?void 0:V.mtime||$.mtime,this.atime=this.portable?void 0:$.atime,this.ctime=this.portable?void 0:$.ctime,this.linkpath=$.linkpath!==void 0?A($.linkpath):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let J=!1;if(!this.preservePaths){const[K,G]=m5(this.path);if(K&&typeof G==="string")this.path=G,J=K}if(this.remain=$.size,this.blockRemain=$.startBlockSize,this.header=new a({path:this[M0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[M0](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}),J)this.warn("TAR_ENTRY_INFO",`stripping ${J} from absolute path`,{entry:this,path:J+this.path});if(this.header.encode()&&!this.noPax)super.write(new b0({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[M0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[M0](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());const Z=this.header?.block;if(!Z)throw new Error("failed to encode header");super.write(Z),$.pipe(this)}[M0]($){return f1($,this.prefix)}[C8]($){return p9($,this.type==="Directory",this.portable)}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");const X=$.length;if(X>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=X,super.write($,V)}end($,Q,V){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));if(typeof $==="function")V=$,Q=void 0,$=void 0;if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,Q??"utf8");if(V)this.once("finish",V);return $?super.end($,V):super.end(V),this}}var VX=($)=>$.isFile()?"File":$.isDirectory()?"Directory":$.isSymbolicLink()?"SymbolicLink":"Unsupported";import p1 from"path";class Y${path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor($,Q){this.path=$||"./",this.absolute=Q}}var c1=Buffer.alloc(1024),D8=Symbol("onStat"),u5=Symbol("ended"),J0=Symbol("queue"),F5=Symbol("current"),V5=Symbol("process"),f5=Symbol("processing"),l1=Symbol("processJob"),Z0=Symbol("jobs"),Z$=Symbol("jobDone"),N8=Symbol("addFSEntry"),d1=Symbol("addTarEntry"),z$=Symbol("stat"),W$=Symbol("readdir"),S8=Symbol("onreaddir"),_8=Symbol("pipe"),i1=Symbol("entry"),K$=Symbol("entryOpt"),R8=Symbol("writeEntryClass"),a1=Symbol("write"),G$=Symbol("ondrain");class X5 extends c{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[R8];onWriteEntry;[J0];[Z0]=0;[f5]=!1;[u5]=!1;constructor($={}){super();if(this.opt=$,this.file=$.file||"",this.cwd=$.cwd||process.cwd(),this.maxReadSize=$.maxReadSize,this.preservePaths=!!$.preservePaths,this.strict=!!$.strict,this.noPax=!!$.noPax,this.prefix=A($.prefix||""),this.linkCache=$.linkCache||new Map,this.statCache=$.statCache||new Map,this.readdirCache=$.readdirCache||new Map,this.onWriteEntry=$.onWriteEntry,this[R8]=j8,typeof $.onwarn==="function")this.on("warn",$.onwarn);if(this.portable=!!$.portable,$.gzip||$.brotli){if($.gzip&&$.brotli)throw new TypeError("gzip and brotli are mutually exclusive");if($.gzip){if(typeof $.gzip!=="object")$.gzip={};if(this.portable)$.gzip.portable=!0;this.zip=new g9($.gzip)}if($.brotli){if(typeof $.brotli!=="object")$.brotli={};this.zip=new E9($.brotli)}if(!this.zip)throw new Error("impossible");const Q=this.zip;Q.on("data",(V)=>super.write(V)),Q.on("end",()=>super.end()),Q.on("drain",()=>this[G$]()),this.on("resume",()=>Q.resume())}else this.on("drain",this[G$]);if(this.noDirRecurse=!!$.noDirRecurse,this.follow=!!$.follow,this.noMtime=!!$.noMtime,$.mtime)this.mtime=$.mtime;this.filter=typeof $.filter==="function"?$.filter:()=>!0,this[J0]=new W0,this[Z0]=0,this.jobs=Number($.jobs)||4,this[f5]=!1,this[u5]=!1}[a1]($){return super.write($)}add($){return this.write($),this}end($){if($)this.add($);return this[u5]=!0,this[V5](),this}write($){if(this[u5])throw new Error("write after end");if($ instanceof y5)this[d1]($);else this[N8]($);return this.flowing}[d1]($){const Q=A(p1.resolve(this.cwd,$.path));if(!this.filter($.path,$))$.resume();else{const V=new Y$($.path,Q);V.entry=new J$($,this[K$](V)),V.entry.on("end",()=>this[Z$](V)),this[Z0]+=1,this[J0].push(V)}this[V5]()}[N8]($){const Q=A(p1.resolve(this.cwd,$));this[J0].push(new Y$($,Q)),this[V5]()}[z$]($){$.pending=!0,this[Z0]+=1;const Q=this.follow?"stat":"lstat";g8[Q]($.absolute,(V,X)=>{if($.pending=!1,this[Z0]-=1,V)this.emit("error",V);else this[D8]($,X)})}[D8]($,Q){if(this.statCache.set($.absolute,Q),$.stat=Q,!this.filter($.path,Q))$.ignore=!0;this[V5]()}[W$]($){$.pending=!0,this[Z0]+=1,g8.readdir($.absolute,(Q,V)=>{if($.pending=!1,this[Z0]-=1,Q)return this.emit("error",Q);this[S8]($,V)})}[S8]($,Q){this.readdirCache.set($.absolute,Q),$.readdir=Q,this[V5]()}[V5](){if(this[f5])return;this[f5]=!0;for(let $=this[J0].head;!!$&&this[Z0]this.warn(Q,V,X),noPax:this.noPax,cwd:this.cwd,absolute:$.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}}[i1]($){this[Z0]+=1;try{const Q=new this[R8]($.path,this[K$]($));return this.onWriteEntry?.(Q),Q.on("end",()=>this[Z$]($)).on("error",(V)=>this.emit("error",V))}catch(Q){this.emit("error",Q)}}[G$](){if(this[F5]&&this[F5].entry)this[F5].entry.resume()}[_8]($){if($.piped=!0,$.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[N8](Z+X)});const Q=$.entry,V=this.zip;if(!Q)throw new Error("cannot pipe without source");if(V)Q.on("data",(X)=>{if(!V.write(X))Q.pause()});else Q.on("data",(X)=>{if(!super.write(X))Q.pause()})}pause(){if(this.zip)this.zip.pause();return super.pause()}warn($,Q,V={}){r0(this,$,Q,V)}}class H5 extends X5{sync=!0;constructor($){super($);this[R8]=X$}pause(){}resume(){}[z$]($){const Q=this.follow?"statSync":"lstatSync";this[D8]($,g8[Q]($.absolute))}[W$]($){this[S8]($,g8.readdirSync($.absolute))}[_8]($){const Q=$.entry,V=this.zip;if($.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[N8](Z+X)});if(!Q)throw new Error("Cannot pipe without source");if(V)Q.on("data",(X)=>{V.write(X)});else Q.on("data",(X)=>{super[a1](X)})}}var XX=($,Q)=>{const V=new H5($),X=new R5($.file,{mode:$.mode||438});V.pipe(X),s1(V,Q)},JX=($,Q)=>{const V=new X5($),X=new g0($.file,{mode:$.mode||438});V.pipe(X);const J=new Promise((Z,K)=>{X.on("error",K),X.on("close",Z),V.on("error",K)});return o1(V,Q),J},s1=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")Q5({file:n1.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},o1=async($,Q)=>{for(let V=0;V{$.add(J)}});else $.add(X)}$.end()},ZX=($,Q)=>{const V=new H5($);return s1(V,Q),V},KX=($,Q)=>{const V=new X5($);return o1(V,Q),V},GX=z0(XX,JX,ZX,KX,($,Q)=>{if(!Q?.length)throw new TypeError("no paths specified to add to archive")});import F4 from"node:fs";import kX from"node:assert";import{randomBytes as w4}from"node:crypto";import I from"node:fs";import C0 from"node:path";import r1 from"fs";var YX=process.env.__FAKE_PLATFORM__||process.platform,zX=YX==="win32",{O_CREAT:WX,O_TRUNC:qX,O_WRONLY:BX}=r1.constants,t1=Number(process.env.__FAKE_FS_O_FILENAME__)||r1.constants.UV_FS_O_FILEMAP||0,LX=zX&&!!t1,MX=524288,AX=t1|qX|WX|BX,q$=!LX?()=>"w":($)=>${try{return y8.lchownSync($,Q,V)}catch(X){if(X?.code!=="ENOENT")throw X}},k8=($,Q,V,X)=>{y8.lchown($,Q,V,(J)=>{X(J&&J?.code!=="ENOENT"?J:null)})},IX=($,Q,V,X,J)=>{if(Q.isDirectory())L$(c5.resolve($,Q.name),V,X,(Z)=>{if(Z)return J(Z);const K=c5.resolve($,Q.name);k8(K,V,X,J)});else{const Z=c5.resolve($,Q.name);k8(Z,V,X,J)}},L$=($,Q,V,X)=>{y8.readdir($,{withFileTypes:!0},(J,Z)=>{if(J){if(J.code==="ENOENT")return X();else if(J.code!=="ENOTDIR"&&J.code!=="ENOTSUP")return X(J)}if(J||!Z.length)return k8($,Q,V,X);let K=Z.length,G=null;const Y=(W)=>{if(G)return;if(W)return X(G=W);if(--K===0)return k8($,Q,V,X)};for(let W of Z)IX($,W,Q,V,Y)})},wX=($,Q,V,X)=>{if(Q.isDirectory())M$(c5.resolve($,Q.name),V,X);B$(c5.resolve($,Q.name),V,X)},M$=($,Q,V)=>{let X;try{X=y8.readdirSync($,{withFileTypes:!0})}catch(J){const Z=J;if(Z?.code==="ENOENT")return;else if(Z?.code==="ENOTDIR"||Z?.code==="ENOTSUP")return B$($,Q,V);else throw Z}for(let J of X)wX($,J,Q,V);return B$($,Q,V)};import o from"fs";import{dirname as e1}from"path";import{mkdir as FX,mkdirSync as HX,stat as PX,statSync as vX}from"fs";var s=($)=>{if(!$)$={mode:511};else if(typeof $==="object")$={mode:511,...$};else if(typeof $==="number")$={mode:$};else if(typeof $==="string")$={mode:parseInt($,8)};else throw new TypeError("invalid options argument");const Q=$,V=$.fs||{};return $.mkdir=$.mkdir||V.mkdir||FX,$.mkdirAsync=$.mkdirAsync?$.mkdirAsync:async(X,J)=>{return new Promise((Z,K)=>Q.mkdir(X,J,(G,Y)=>G?K(G):Z(Y)))},$.stat=$.stat||V.stat||PX,$.statAsync=$.statAsync?$.statAsync:async(X)=>new Promise((J,Z)=>Q.stat(X,(K,G)=>K?Z(K):J(G))),$.statSync=$.statSync||V.statSync||vX,$.mkdirSync=$.mkdirSync||V.mkdirSync||HX,Q};var A0=($,Q,V)=>{const X=e1($),J={...s(Q),recursive:!1};if(X===$)try{return J.mkdirSync($,J)}catch(Z){const K=Z;if(K&&K.code!=="EISDIR")throw Z;return}try{return J.mkdirSync($,J),V||$}catch(Z){const K=Z;if(K&&K.code==="ENOENT")return A0($,J,A0(X,J,V));if(K&&K.code!=="EEXIST"&&K&&K.code!=="EROFS")throw Z;try{if(!J.statSync($).isDirectory())throw Z}catch(G){throw Z}}},T0=Object.assign(async($,Q,V)=>{const X=s(Q);X.recursive=!1;const J=e1($);if(J===$)return X.mkdirAsync($,X).catch((Z)=>{const K=Z;if(K&&K.code!=="EISDIR")throw Z});return X.mkdirAsync($,X).then(()=>V||$,async(Z)=>{const K=Z;if(K&&K.code==="ENOENT")return T0(J,X).then((G)=>T0($,X,G));if(K&&K.code!=="EEXIST"&&K.code!=="EROFS")throw Z;return X.statAsync($).then((G)=>{if(G.isDirectory())return V;else throw Z},()=>{throw Z})})},{sync:A0});import{dirname as Q4}from"path";import{dirname as $4}from"path";var A$=async($,Q,V)=>{if(V===Q)return;return $.statAsync(Q).then((X)=>X.isDirectory()?V:void 0,(X)=>{const J=X;return J&&J.code==="ENOENT"?A$($,$4(Q),Q):void 0})},I$=($,Q,V)=>{if(V===Q)return;try{return $.statSync(Q).isDirectory()?V:void 0}catch(X){const J=X;return J&&J.code==="ENOENT"?I$($,$4(Q),Q):void 0}};var P5=($,Q)=>{const V=s(Q);if(V.recursive=!0,Q4($)===$)return V.mkdirSync($,V);const J=I$(V,$);try{return V.mkdirSync($,V),J}catch(Z){const K=Z;if(K&&K.code==="ENOENT")return A0($,V);else throw Z}},l5=Object.assign(async($,Q)=>{const V={...s(Q),recursive:!0};if(Q4($)===$)return await V.mkdirAsync($,V);return A$(V,$).then((J)=>V.mkdirAsync($,V).then((Z)=>J||Z).catch((Z)=>{const K=Z;if(K&&K.code==="ENOENT")return T0($,V);else throw Z}))},{sync:P5});import{parse as UX,resolve as xX}from"path";var OX=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,w$=($)=>{if(/\0/.test($))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:$,code:"ERR_INVALID_ARG_VALUE"});if($=xX($),OX==="win32"){const Q=/[*|"<>?:]/,{root:V}=UX($);if(Q.test($.substring(V.length)))throw Object.assign(new Error("Illegal characters in path."),{path:$,code:"EINVAL"})}return $};import{mkdir as TX,mkdirSync as CX}from"fs";var jX=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,F$=jX.replace(/^v/,"").split("."),V4=+F$[0]>10||+F$[0]===10&&+F$[1]>=12,d5=!V4?()=>!1:($)=>s($).mkdirSync===CX,E8=Object.assign(!V4?()=>!1:($)=>s($).mkdir===TX,{sync:d5});var b8=($,Q)=>{$=w$($);const V=s(Q);return d5(V)?P5($,V):A0($,V)};var X4=Object.assign(async($,Q)=>{$=w$($);const V=s(Q);return E8(V)?l5($,V):T0($,V)},{mkdirpSync:b8,mkdirpNative:l5,mkdirpNativeSync:P5,mkdirpManual:T0,mkdirpManualSync:A0,sync:b8,native:l5,nativeSync:P5,manual:T0,manualSync:A0,useNative:E8,useNativeSync:d5});import u8 from"node:path";class m8 extends Error{path;code;syscall="chdir";constructor($,Q){super(`${Q}: Cannot cd into '${$}'`);this.path=$,this.code=Q}get name(){return"CwdError"}}class h8 extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor($,Q){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");this.symlink=$,this.path=Q}get name(){return"SymlinkError"}}var f8=($,Q)=>$.get(A(Q)),i5=($,Q,V)=>$.set(A(Q),V),DX=($,Q)=>{o.stat($,(V,X)=>{if(V||!X.isDirectory())V=new m8($,V?.code||"ENOTDIR");Q(V)})},J4=($,Q,V)=>{$=A($);const X=Q.umask??18,J=Q.mode|448,Z=(J&X)!==0,K=Q.uid,G=Q.gid,Y=typeof K==="number"&&typeof G==="number"&&(K!==Q.processUid||G!==Q.processGid),W=Q.preserve,z=Q.unlink,q=Q.cache,M=A(Q.cwd),O=(N,x)=>{if(N)V(N);else if(i5(q,$,!0),x&&Y)L$(x,K,G,(_$)=>O(_$));else if(Z)o.chmod($,J,V);else V()};if(q&&f8(q,$)===!0)return O();if($===M)return DX($,O);if(W)return X4($,{mode:J}).then((N)=>O(null,N??void 0),O);const v=A(u8.relative(M,$)).split("/");c8(M,v,J,q,z,M,void 0,O)},c8=($,Q,V,X,J,Z,K,G)=>{if(!Q.length)return G(null,K);const Y=Q.shift(),W=A(u8.resolve($+"/"+Y));if(f8(X,W))return c8(W,Q,V,X,J,Z,K,G);o.mkdir(W,V,Z4(W,Q,V,X,J,Z,K,G))},Z4=($,Q,V,X,J,Z,K,G)=>(Y)=>{if(Y)o.lstat($,(W,z)=>{if(W)W.path=W.path&&A(W.path),G(W);else if(z.isDirectory())c8($,Q,V,X,J,Z,K,G);else if(J)o.unlink($,(q)=>{if(q)return G(q);o.mkdir($,V,Z4($,Q,V,X,J,Z,K,G))});else if(z.isSymbolicLink())return G(new h8($,$+"/"+Q.join("/")));else G(Y)});else K=K||$,c8($,Q,V,X,J,Z,K,G)},NX=($)=>{let Q=!1,V=void 0;try{Q=o.statSync($).isDirectory()}catch(X){V=X?.code}finally{if(!Q)throw new m8($,V??"ENOTDIR")}},K4=($,Q)=>{$=A($);const V=Q.umask??18,X=Q.mode|448,J=(X&V)!==0,Z=Q.uid,K=Q.gid,G=typeof Z==="number"&&typeof K==="number"&&(Z!==Q.processUid||K!==Q.processGid),Y=Q.preserve,W=Q.unlink,z=Q.cache,q=A(Q.cwd),M=(N)=>{if(i5(z,$,!0),N&&G)M$(N,Z,K);if(J)o.chmodSync($,X)};if(z&&f8(z,$)===!0)return M();if($===q)return NX(q),M();if(Y)return M(b8($,X)??void 0);const U=A(u8.relative(q,$)).split("/");let v=void 0;for(let N=U.shift(),x=q;N&&(x+="/"+N);N=U.shift()){if(x=A(u8.resolve(x)),f8(z,x))continue;try{o.mkdirSync(x,X),v=v||x,i5(z,x,!0)}catch(_$){const R$=o.lstatSync(x);if(R$.isDirectory()){i5(z,x,!0);continue}else if(W){o.unlinkSync(x),o.mkdirSync(x,X),v=v||x,i5(z,x,!0);continue}else if(R$.isSymbolicLink())return new h8(x,x+"/"+U.join("/"))}}return M(v)};var H$=Object.create(null),{hasOwnProperty:SX}=Object.prototype,l8=($)=>{if(!SX.call(H$,$))H$[$]=$.normalize("NFD");return H$[$]};import{join as G4}from"node:path";var _X=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,RX=_X==="win32",gX=($)=>{return $.split("/").slice(0,-1).reduce((V,X)=>{const J=V[V.length-1];if(J!==void 0)X=G4(J,X);return V.push(X||"/"),V},[])};class P${#$=new Map;#V=new Map;#X=new Set;reserve($,Q){$=RX?["win32 parallelization disabled"]:$.map((X)=>{return B0(G4(l8(X))).toLowerCase()});const V=new Set($.map((X)=>gX(X)).reduce((X,J)=>X.concat(J)));this.#V.set(Q,{dirs:V,paths:$});for(let X of $){const J=this.#$.get(X);if(!J)this.#$.set(X,[Q]);else J.push(Q)}for(let X of V){const J=this.#$.get(X);if(!J)this.#$.set(X,[new Set([Q])]);else{const Z=J[J.length-1];if(Z instanceof Set)Z.add(Q);else J.push(new Set([Q]))}}return this.#J(Q)}#Z($){const Q=this.#V.get($);if(!Q)throw new Error("function does not have any path reservations");return{paths:Q.paths.map((V)=>this.#$.get(V)),dirs:[...Q.dirs].map((V)=>this.#$.get(V))}}check($){const{paths:Q,dirs:V}=this.#Z($);return Q.every((X)=>X&&X[0]===$)&&V.every((X)=>X&&X[0]instanceof Set&&X[0].has($))}#J($){if(this.#X.has($)||!this.check($))return!1;return this.#X.add($),$(()=>this.#Q($)),!0}#Q($){if(!this.#X.has($))return!1;const Q=this.#V.get($);if(!Q)throw new Error("invalid reservation");const{paths:V,dirs:X}=Q,J=new Set;for(let Z of V){const K=this.#$.get(Z);if(!K||K?.[0]!==$)continue;const G=K[1];if(!G){this.#$.delete(Z);continue}if(K.shift(),typeof G==="function")J.add(G);else for(let Y of G)J.add(Y)}for(let Z of X){const K=this.#$.get(Z),G=K?.[0];if(!K||!(G instanceof Set))continue;if(G.size===1&&K.length===1){this.#$.delete(Z);continue}else if(G.size===1){K.shift();const Y=K[0];if(typeof Y==="function")J.add(Y)}else G.delete($)}return this.#X.delete($),J.forEach((Z)=>this.#J(Z)),!0}}var Y4=Symbol("onEntry"),U$=Symbol("checkFs"),z4=Symbol("checkFs2"),p8=Symbol("pruneCache"),x$=Symbol("isReusable"),r=Symbol("makeFs"),T$=Symbol("file"),C$=Symbol("directory"),a8=Symbol("link"),W4=Symbol("symlink"),q4=Symbol("hardlink"),B4=Symbol("unsupported"),L4=Symbol("checkPath"),l0=Symbol("mkdir"),y=Symbol("onError"),d8=Symbol("pending"),M4=Symbol("pend"),v5=Symbol("unpend"),v$=Symbol("ended"),O$=Symbol("maybeClose"),j$=Symbol("skip"),p5=Symbol("doChown"),a5=Symbol("uid"),n5=Symbol("gid"),s5=Symbol("checkedCwd"),yX=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,o5=yX==="win32",EX=1024,bX=($,Q)=>{if(!o5)return I.unlink($,Q);const V=$+".DELETE."+w4(16).toString("hex");I.rename($,V,(X)=>{if(X)return Q(X);I.unlink(V,Q)})},mX=($)=>{if(!o5)return I.unlinkSync($);const Q=$+".DELETE."+w4(16).toString("hex");I.renameSync($,Q),I.unlinkSync(Q)},A4=($,Q,V)=>$!==void 0&&$===$>>>0?$:Q!==void 0&&Q===Q>>>0?Q:V,I4=($)=>B0(A(l8($))).toLowerCase(),hX=($,Q)=>{Q=I4(Q);for(let V of $.keys()){const X=I4(V);if(X===Q||X.indexOf(Q+"/")===0)$.delete(V)}},uX=($)=>{for(let Q of $.keys())$.delete(Q)};class r5 extends f0{[v$]=!1;[s5]=!1;[d8]=0;reservations=new P$;transform;writable=!0;readable=!1;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor($={}){$.ondone=()=>{this[v$]=!0,this[O$]()};super($);if(this.transform=$.transform,this.dirCache=$.dirCache||new Map,this.chmod=!!$.chmod,typeof $.uid==="number"||typeof $.gid==="number"){if(typeof $.uid!=="number"||typeof $.gid!=="number")throw new TypeError("cannot set owner without number uid and gid");if($.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=$.uid,this.gid=$.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;if($.preserveOwner===void 0&&typeof $.uid!=="number")this.preserveOwner=!!(process.getuid&&process.getuid()===0);else this.preserveOwner=!!$.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 $.maxDepth==="number"?$.maxDepth:EX,this.forceChown=$.forceChown===!0,this.win32=!!$.win32||o5,this.newer=!!$.newer,this.keep=!!$.keep,this.noMtime=!!$.noMtime,this.preservePaths=!!$.preservePaths,this.unlink=!!$.unlink,this.cwd=A(C0.resolve($.cwd||process.cwd())),this.strip=Number($.strip)||0,this.processUmask=!this.chmod?0:typeof $.processUmask==="number"?$.processUmask:process.umask(),this.umask=typeof $.umask==="number"?$.umask:this.processUmask,this.dmode=$.dmode||511&~this.umask,this.fmode=$.fmode||438&~this.umask,this.on("entry",(Q)=>this[Y4](Q))}warn($,Q,V={}){if($==="TAR_BAD_ARCHIVE"||$==="TAR_ABORT")V.recoverable=!1;return super.warn($,Q,V)}[O$](){if(this[v$]&&this[d8]===0)this.emit("prefinish"),this.emit("finish"),this.emit("end")}[L4]($){const Q=A($.path),V=Q.split("/");if(this.strip){if(V.length=this.strip)$.linkpath=X.slice(this.strip).join("/");else return!1}V.splice(0,this.strip),$.path=V.join("/")}if(isFinite(this.maxDepth)&&V.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:$,path:Q,depth:V.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(V.includes("..")||o5&&/^[a-z]:\.\.$/i.test(V[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:$,path:Q}),!1;const[X,J]=m5(Q);if(X)$.path=String(J),this.warn("TAR_ENTRY_INFO",`stripping ${X} from absolute path`,{entry:$,path:Q})}if(C0.isAbsolute($.path))$.absolute=A(C0.resolve($.path));else $.absolute=A(C0.resolve(this.cwd,$.path));if(!this.preservePaths&&typeof $.absolute==="string"&&$.absolute.indexOf(this.cwd+"/")!==0&&$.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:$,path:A($.path),resolvedPath:$.absolute,cwd:this.cwd}),!1;if($.absolute===this.cwd&&$.type!=="Directory"&&$.type!=="GNUDumpDir")return!1;if(this.win32){const{root:X}=C0.win32.parse(String($.absolute));$.absolute=X+n9(String($.absolute).slice(X.length));const{root:J}=C0.win32.parse($.path);$.path=J+n9($.path.slice(J.length))}return!0}[Y4]($){if(!this[L4]($))return $.resume();switch(kX.equal(typeof $.absolute,"string"),$.type){case"Directory":case"GNUDumpDir":if($.mode)$.mode=$.mode|448;case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[U$]($);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[B4]($)}}[y]($,Q){if($.name==="CwdError")this.emit("error",$);else this.warn("TAR_ENTRY_ERROR",$,{entry:Q}),this[v5](),Q.resume()}[l0]($,Q,V){J4(A($),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:Q},V)}[p5]($){return this.forceChown||this.preserveOwner&&(typeof $.uid==="number"&&$.uid!==this.processUid||typeof $.gid==="number"&&$.gid!==this.processGid)||typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid}[a5]($){return A4(this.uid,$.uid,this.processUid)}[n5]($){return A4(this.gid,$.gid,this.processGid)}[T$]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=new g0(String($.absolute),{flags:q$($.size),mode:V,autoClose:!1});X.on("error",(G)=>{if(X.fd)I.close(X.fd,()=>{});X.write=()=>!0,this[y](G,$),Q()});let J=1;const Z=(G)=>{if(G){if(X.fd)I.close(X.fd,()=>{});this[y](G,$),Q();return}if(--J===0){if(X.fd!==void 0)I.close(X.fd,(Y)=>{if(Y)this[y](Y,$);else this[v5]();Q()})}};X.on("finish",()=>{const G=String($.absolute),Y=X.fd;if(typeof Y==="number"&&$.mtime&&!this.noMtime){J++;const W=$.atime||new Date,z=$.mtime;I.futimes(Y,W,z,(q)=>q?I.utimes(G,W,z,(M)=>Z(M&&q)):Z())}if(typeof Y==="number"&&this[p5]($)){J++;const W=this[a5]($),z=this[n5]($);if(typeof W==="number"&&typeof z==="number")I.fchown(Y,W,z,(q)=>q?I.chown(G,W,z,(M)=>Z(M&&q)):Z())}Z()});const K=this.transform?this.transform($)||$:$;if(K!==$)K.on("error",(G)=>{this[y](G,$),Q()}),$.pipe(K);K.pipe(X)}[C$]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode;this[l0](String($.absolute),V,(X)=>{if(X){this[y](X,$),Q();return}let J=1;const Z=()=>{if(--J===0)Q(),this[v5](),$.resume()};if($.mtime&&!this.noMtime)J++,I.utimes(String($.absolute),$.atime||new Date,$.mtime,Z);if(this[p5]($))J++,I.chown(String($.absolute),Number(this[a5]($)),Number(this[n5]($)),Z);Z()})}[B4]($){$.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${$.type}`,{entry:$}),$.resume()}[W4]($,Q){this[a8]($,String($.linkpath),"symlink",Q)}[q4]($,Q){const V=A(C0.resolve(this.cwd,String($.linkpath)));this[a8]($,V,"link",Q)}[M4](){this[d8]++}[v5](){this[d8]--,this[O$]()}[j$]($){this[v5](),$.resume()}[x$]($,Q){return $.type==="File"&&!this.unlink&&Q.isFile()&&Q.nlink<=1&&!o5}[U$]($){this[M4]();const Q=[$.path];if($.linkpath)Q.push($.linkpath);this.reservations.reserve(Q,(V)=>this[z4]($,V))}[p8]($){if($.type==="SymbolicLink")uX(this.dirCache);else if($.type!=="Directory")hX(this.dirCache,String($.absolute))}[z4]($,Q){this[p8]($);const V=(K)=>{this[p8]($),Q(K)},X=()=>{this[l0](this.cwd,this.dmode,(K)=>{if(K){this[y](K,$),V();return}this[s5]=!0,J()})},J=()=>{if($.absolute!==this.cwd){const K=A(C0.dirname(String($.absolute)));if(K!==this.cwd)return this[l0](K,this.dmode,(G)=>{if(G){this[y](G,$),V();return}Z()})}Z()},Z=()=>{I.lstat(String($.absolute),(K,G)=>{if(G&&(this.keep||this.newer&&G.mtime>($.mtime??G.mtime))){this[j$]($),V();return}if(K||this[x$]($,G))return this[r](null,$,V);if(G.isDirectory()){if($.type==="Directory"){const Y=this.chmod&&$.mode&&(G.mode&4095)!==$.mode,W=(z)=>this[r](z??null,$,V);if(!Y)return W();return I.chmod(String($.absolute),Number($.mode),W)}if($.absolute!==this.cwd)return I.rmdir(String($.absolute),(Y)=>this[r](Y??null,$,V))}if($.absolute===this.cwd)return this[r](null,$,V);bX(String($.absolute),(Y)=>this[r](Y??null,$,V))})};if(this[s5])J();else X()}[r]($,Q,V){if($){this[y]($,Q),V();return}switch(Q.type){case"File":case"OldFile":case"ContiguousFile":return this[T$](Q,V);case"Link":return this[q4](Q,V);case"SymbolicLink":return this[W4](Q,V);case"Directory":case"GNUDumpDir":return this[C$](Q,V)}}[a8]($,Q,V,X){I[V](Q,String($.absolute),(J)=>{if(J)this[y](J,$);else this[v5](),$.resume();X()})}}var i8=($)=>{try{return[null,$()]}catch(Q){return[Q,null]}};class n8 extends r5{sync=!0;[r]($,Q){return super[r]($,Q,()=>{})}[U$]($){if(this[p8]($),!this[s5]){const J=this[l0](this.cwd,this.dmode);if(J)return this[y](J,$);this[s5]=!0}if($.absolute!==this.cwd){const J=A(C0.dirname(String($.absolute)));if(J!==this.cwd){const Z=this[l0](J,this.dmode);if(Z)return this[y](Z,$)}}const[Q,V]=i8(()=>I.lstatSync(String($.absolute)));if(V&&(this.keep||this.newer&&V.mtime>($.mtime??V.mtime)))return this[j$]($);if(Q||this[x$]($,V))return this[r](null,$);if(V.isDirectory()){if($.type==="Directory"){const Z=this.chmod&&$.mode&&(V.mode&4095)!==$.mode,[K]=Z?i8(()=>{I.chmodSync(String($.absolute),Number($.mode))}):[];return this[r](K,$)}const[J]=i8(()=>I.rmdirSync(String($.absolute)));this[r](J,$)}const[X]=$.absolute===this.cwd?[]:i8(()=>mX(String($.absolute)));this[r](X,$)}[T$]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=(K)=>{let G;try{I.closeSync(J)}catch(Y){G=Y}if(K||G)this[y](K||G,$);Q()};let J;try{J=I.openSync(String($.absolute),q$($.size),V)}catch(K){return X(K)}const Z=this.transform?this.transform($)||$:$;if(Z!==$)Z.on("error",(K)=>this[y](K,$)),$.pipe(Z);Z.on("data",(K)=>{try{I.writeSync(J,K,0,K.length)}catch(G){X(G)}}),Z.on("end",()=>{let K=null;if($.mtime&&!this.noMtime){const G=$.atime||new Date,Y=$.mtime;try{I.futimesSync(J,G,Y)}catch(W){try{I.utimesSync(String($.absolute),G,Y)}catch(z){K=W}}}if(this[p5]($)){const G=this[a5]($),Y=this[n5]($);try{I.fchownSync(J,Number(G),Number(Y))}catch(W){try{I.chownSync(String($.absolute),Number(G),Number(Y))}catch(z){K=K||W}}}X(K)})}[C$]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode,X=this[l0](String($.absolute),V);if(X){this[y](X,$),Q();return}if($.mtime&&!this.noMtime)try{I.utimesSync(String($.absolute),$.atime||new Date,$.mtime)}catch(J){}if(this[p5]($))try{I.chownSync(String($.absolute),Number(this[a5]($)),Number(this[n5]($)))}catch(J){}Q(),$.resume()}[l0]($,Q){try{return K4(A($),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:Q})}catch(V){return V}}[a8]($,Q,V,X){const J=`${V}Sync`;try{I[J](Q,String($.absolute)),X(),$.resume()}catch(Z){return this[y](Z,$)}}}var fX=($)=>{const Q=new n8($),V=$.file,X=F4.statSync(V),J=$.maxReadSize||16777216;new j9(V,{readSize:J,size:X.size}).pipe(Q)},cX=($,Q)=>{const V=new r5($),X=$.maxReadSize||16777216,J=$.file;return new Promise((K,G)=>{V.on("error",G),V.on("close",K),F4.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M5(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},D$=z0(fX,cX,($)=>new n8($),($)=>new r5($),($,Q)=>{if(Q?.length)i9($,Q)});import l from"node:fs";import H4 from"node:path";var lX=($,Q)=>{const V=new H5($);let X=!0,J,Z;try{try{J=l.openSync($.file,"r+")}catch(Y){if(Y?.code==="ENOENT")J=l.openSync($.file,"w+");else throw Y}const K=l.fstatSync(J),G=Buffer.alloc(512);$:for(Z=0;ZK.size)break;if(Z+=W,$.mtimeCache&&Y.mtime)$.mtimeCache.set(String(Y.path),Y.mtime)}X=!1,dX($,V,Z,J,Q)}finally{if(X)try{l.closeSync(J)}catch(K){}}},dX=($,Q,V,X,J)=>{const Z=new R5($.file,{fd:X,start:V});Q.pipe(Z),pX(Q,J)},iX=($,Q)=>{Q=Array.from(Q);const V=new X5($),X=(Z,K,G)=>{const Y=(O,U)=>{if(O)l.close(Z,(v)=>G(O));else G(null,U)};let W=0;if(K===0)return Y(null,0);let z=0;const q=Buffer.alloc(512),M=(O,U)=>{if(O||typeof U==="undefined")return Y(O);if(z+=U,z<512&&U)return l.read(Z,q,z,q.length-z,W+z,M);if(W===0&&q[0]===31&&q[1]===139)return Y(new Error("cannot append to compressed archives"));if(z<512)return Y(null,W);const v=new a(q);if(!v.cksumValid)return Y(null,W);const N=512*Math.ceil((v.size??0)/512);if(W+N+512>K)return Y(null,W);if(W+=N+512,W>=K)return Y(null,W);if($.mtimeCache&&v.mtime)$.mtimeCache.set(String(v.path),v.mtime);z=0,l.read(Z,q,0,512,W,M)};l.read(Z,q,0,512,W,M)};return new Promise((Z,K)=>{V.on("error",K);let G="r+";const Y=(W,z)=>{if(W&&W.code==="ENOENT"&&G==="r+")return G="w+",l.open($.file,G,Y);if(W||!z)return K(W);l.fstat(z,(q,M)=>{if(q)return l.close(z,()=>K(q));X(z,M.size,(O,U)=>{if(O)return K(O);const v=new g0($.file,{fd:z,start:U});V.pipe(v),v.on("error",K),v.on("close",Z),aX(V,Q)})})};l.open($.file,G,Y)})},pX=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")Q5({file:H4.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},aX=async($,Q)=>{for(let V=0;V$.add(J)});else $.add(X)}$.end()},J5=z0(lX,iX,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},($,Q)=>{if(!P1($))throw new TypeError("file is required");if($.gzip||$.brotli||$.file.endsWith(".br")||$.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!Q?.length)throw new TypeError("no paths specified to add/replace")});var nX=z0(J5.syncFile,J5.asyncFile,J5.syncNoFile,J5.asyncNoFile,($,Q=[])=>{J5.validate?.($,Q),sX($)}),sX=($)=>{const Q=$.filter;if(!$.mtimeCache)$.mtimeCache=new Map;$.filter=Q?(V,X)=>Q(V,X)&&!(($.mtimeCache?.get(V)??X.mtime??0)>(X.mtime??0)):(V,X)=>!(($.mtimeCache?.get(V)??X.mtime??0)>(X.mtime??0))};import eX from"os";async function $J($,Q,V){L.info(`Starting download from URL: ${$}`);const X=S$(__dirname,"../package.json");let J;try{J=await t.readFile(X,"utf-8")}catch(z){throw L.error(`Failed to read package.json from ${X}`),new Error(`Failed to read package.json: ${z}`)}let Z;try{Z=JSON.parse(J)}catch(z){throw L.error(`Failed to parse package.json: ${z}`),new Error(`Failed to parse package.json: ${z}`)}const K=`beat-forge/init-beatsaber@${Z.version}`;L.debug(`User-Agent: ${K}`);const G=new Headers({"User-Agent":K,Accept:"application/octet-stream"});if(V)G.set("Authorization",`token ${V}`);let Y;try{Y=await fetch($,{headers:G})}catch(z){throw L.error(`Network error while fetching ${$}: ${z}`),new Error(`Network error: ${z}`)}if(L.info(`Response status: ${Y.status} ${Y.statusText}`),!Y.ok){const z=await Y.text().catch(()=>"No response body");throw L.error(`Failed to download file: ${Y.statusText}`),L.debug(`Error response body: ${z}`),new Error(`Failed to download file: ${Y.status} ${Y.statusText}`)}try{await t.mkdir(N$(Q),{recursive:!0}),L.debug(`Created directory for output path: ${N$(Q)}`)}catch(z){throw L.error(`Failed to create directory ${N$(Q)}: ${z}`),z}const W=rX(Q);if(L.info("Starting to read and write file stream"),Y.body)try{await tX(Y.body,W)}catch(z){throw L.error(`Error during file stream pipeline: ${z}`),z}else throw new Error("Response body is null");L.info("File downloaded and written successfully")}async function QJ($,Q){L.info(`Extracting tarball from ${$} to ${Q}`);try{await t.mkdir(Q,{recursive:!0}),await D$({file:$,cwd:Q,strip:1}),L.info("Tarball extraction completed successfully")}catch(V){throw L.error(`Failed to extract tarball from ${$} to ${Q}: ${V}`),V}}async function P4($,Q){L.info(`Moving contents from ${$} to ${Q}`);try{await t.mkdir(Q,{recursive:!0});const V=await t.readdir($,{withFileTypes:!0});L.debug(`Entries to move: ${V.map((X)=>X.name).join(", ")}`);for(let X of V){const J=O5($,X.name),Z=O5(Q,X.name);if(X.isDirectory())await P4(J,Z);else try{await t.rename(J,Z),L.debug(`Renamed ${J} to ${Z}`)}catch(K){L.debug(`Rename failed for ${J}. Attempting to copy and delete.`),await t.copyFile(J,Z),await t.unlink(J),L.debug(`Copied and deleted ${J} to ${Z}`)}}L.info("Content move completed successfully")}catch(V){throw L.error(`Failed to move contents from ${$} to ${Q}: ${V}`),V}}async function v4($){L.info(`Searching for manifest.json in directory: ${$}`);try{const Q=await t.readdir($,{withFileTypes:!0});for(let V of Q){const X=O5($,V.name);if(V.isDirectory()){const J=await v4(X);if(J)return J}else if(V.isFile()&&V.name==="manifest.json")return L.info(`Found manifest.json at ${X}`),X}return L.debug(`No manifest.json found in directory: ${$}`),null}catch(Q){throw L.error(`Error searching for manifest.json in ${$}: ${Q}`),Q}}async function VJ(){let $=void 0;try{L.info("Initializing Beat Saber modding environment...");const Q=L.getInput("token",{required:!1}),V=L.getInput("repo",{required:!0}),X=L.getInput("host",{required:!0}),J=L.getInput("manifest",{required:!1}),Z=L.getInput("path",{required:!0});let K=L.getInput("version",{required:!1});const G=L.getInput("ref",{required:!1});if(L.debug(`Inputs - version: ${K}, manifest: ${J}, path: ${Z}, repo: ${V}, host: ${X}, ref: ${G}`),!/^([\w-]+)\/([\w-]+)$/.test(V))throw new Error(`Invalid repo format: "${V}". Expected format "owner/repo".`);let Y=K;if(!G&&!Y){L.info("No ref or version specified. Attempting to infer version from manifest.json...");const U=J?S$(J):await v4(process.cwd());if(U){L.info(`Using manifest.json at ${U} to infer version.`);let v;try{v=await t.readFile(U,"utf-8")}catch(x){throw L.error(`Failed to read manifest.json: ${x}`),new Error("Failed to read manifest.json.")}if(v.charCodeAt(0)===65279)L.debug("Removing BOM from manifest.json"),v=v.slice(1);let N;try{N=JSON.parse(v)}catch(x){throw L.error(`Failed to parse manifest.json: ${x}`),new Error("Invalid JSON in manifest.json.")}if(N.gameVersion)Y=N.gameVersion,L.info(`Inferred version from manifest: ${Y}`);else throw new Error('No version specified and "gameVersion" not found in manifest.json.')}else throw new Error("No manifest.json found and no version specified.")}let W;if(G)W=G,L.info(`Using ref from input: ${W}`);else if(Y)W=`version/${Y}`,L.info(`Using ref from version: ${W}`);else throw new Error("No ref or version specified, and unable to infer from manifest.");const z=`https://${X}/${V}/archive/${W}.tar.gz`;$=await t.mkdtemp(O5(eX.tmpdir(),"action-"));const q=O5($,"archive.tar.gz"),M=O5($,"extract"),O=S$(Z);L.info(`Downloading tarball from ${z}`),await $J(z,q,Q),L.info(`Extracting tarball to ${M}`),await QJ(q,M),L.info(`Moving extracted contents to ${O}`),await P4(M,O),L.info("Beat Saber references initialized successfully")}catch(Q){if(Q instanceof Error)L.setFailed(`Action failed with error: ${Q.message}`);else L.setFailed(`Action failed with unknown error: ${Q}`)}finally{if($)try{await t.rm($,{recursive:!0,force:!0}),L.debug(`Cleaned up temporary directory: ${$}`)}catch(Q){L.warning(`Failed to clean up temporary directory: ${Q}`)}}}var __dirname="/home/checksum/projects/beatforge/init-beatsaber/src";VJ(); + Error Message: ${Z.message}`)})).result)===null||Q===void 0?void 0:Q.value;if(!J)throw new Error("Response json body do not have ID Token field");return J})}static getIDToken($){return r7(this,void 0,void 0,function*(){try{let Q=Z5.getIDTokenUrl();if($){const X=encodeURIComponent($);Q=`${Q}&audience=${X}`}t7.debug(`ID token url is ${Q}`);const V=yield Z5.getCall(Q);return t7.setSecret(V),V}catch(Q){throw new Error(`Error message: ${Q.message}`)}})}}K5.OidcClient=Z5});var W9=H((m)=>{var Y9=m&&m.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(m,"__esModule",{value:!0});m.summary=m.markdownSummary=m.SUMMARY_DOCS_URL=m.SUMMARY_ENV_VAR=void 0;var UQ=j("os"),z9=j("fs"),{access:xQ,appendFile:TQ,writeFile:CQ}=z9.promises;m.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";m.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";class $1{constructor(){this._buffer=""}filePath(){return Y9(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;const $=process.env[m.SUMMARY_ENV_VAR];if(!$)throw new Error(`Unable to find environment variable for \$${m.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield xQ($,z9.constants.R_OK|z9.constants.W_OK)}catch(Q){throw new Error(`Unable to access summary file: '${$}'. Check if the file has correct read/write permissions.`)}return this._filePath=$,this._filePath})}wrap($,Q,V={}){const X=Object.entries(V).map(([J,Z])=>` ${J}="${Z}"`).join("");if(!Q)return`<${$}${X}>`;return`<${$}${X}>${Q}`}write($){return Y9(this,void 0,void 0,function*(){const Q=!!($===null||$===void 0?void 0:$.overwrite),V=yield this.filePath();return yield(Q?CQ:TQ)(V,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return Y9(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw($,Q=!1){return this._buffer+=$,Q?this.addEOL():this}addEOL(){return this.addRaw(UQ.EOL)}addCodeBlock($,Q){const V=Object.assign({},Q&&{lang:Q}),X=this.wrap("pre",this.wrap("code",$),V);return this.addRaw(X).addEOL()}addList($,Q=!1){const V=Q?"ol":"ul",X=$.map((Z)=>this.wrap("li",Z)).join(""),J=this.wrap(V,X);return this.addRaw(J).addEOL()}addTable($){const Q=$.map((X)=>{const J=X.map((Z)=>{if(typeof Z==="string")return this.wrap("td",Z);const{header:K,data:G,colspan:Y,rowspan:W}=Z,z=K?"th":"td",q=Object.assign(Object.assign({},Y&&{colspan:Y}),W&&{rowspan:W});return this.wrap(z,G,q)}).join("");return this.wrap("tr",J)}).join(""),V=this.wrap("table",Q);return this.addRaw(V).addEOL()}addDetails($,Q){const V=this.wrap("details",this.wrap("summary",$)+Q);return this.addRaw(V).addEOL()}addImage($,Q,V){const{width:X,height:J}=V||{},Z=Object.assign(Object.assign({},X&&{width:X}),J&&{height:J}),K=this.wrap("img",null,Object.assign({src:$,alt:Q},Z));return this.addRaw(K).addEOL()}addHeading($,Q){const V=`h${Q}`,X=["h1","h2","h3","h4","h5","h6"].includes(V)?V:"h1",J=this.wrap(X,$);return this.addRaw(J).addEOL()}addSeparator(){const $=this.wrap("hr",null);return this.addRaw($).addEOL()}addBreak(){const $=this.wrap("br",null);return this.addRaw($).addEOL()}addQuote($,Q){const V=Object.assign({},Q&&{cite:Q}),X=this.wrap("blockquote",$,V);return this.addRaw(X).addEOL()}addLink($,Q){const V=this.wrap("a",$,{href:Q});return this.addRaw(V).addEOL()}}var Q1=new $1;m.markdownSummary=Q1;m.summary=Q1});var V1=H((h)=>{function _Q($){return $.replace(/[\\]/g,"/")}function RQ($){return $.replace(/[/]/g,"\\")}function gQ($){return $.replace(/[/\\]/g,SQ.sep)}var jQ=h&&h.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),DQ=h&&h.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),NQ=h&&h.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))jQ(Q,$,V)}return DQ(Q,$),Q};Object.defineProperty(h,"__esModule",{value:!0});h.toPlatformPath=h.toWin32Path=h.toPosixPath=void 0;var SQ=NQ(j("path"));h.toPosixPath=_Q;h.toWin32Path=RQ;h.toPlatformPath=gQ});var G9=H((B)=>{function mQ($,Q){const V=G5.toCommandValue(Q);if(process.env[$]=V,process.env.GITHUB_ENV||"")return d0.issueFileCommand("ENV",d0.prepareKeyValueMessage($,Q));p.issueCommand("set-env",{name:$},V)}function hQ($){p.issueCommand("add-mask",{},$)}function uQ($){if(process.env.GITHUB_PATH||"")d0.issueFileCommand("PATH",$);else p.issueCommand("add-path",{},$);process.env.PATH=`${$}${EQ.delimiter}${process.env.PATH}`}function q9($,Q){const V=process.env[`INPUT_${$.replace(/ /g,"_").toUpperCase()}`]||"";if(Q&&Q.required&&!V)throw new Error(`Input required and not supplied: ${$}`);if(Q&&Q.trimWhitespace===!1)return V;return V.trim()}function fQ($,Q){const V=q9($,Q).split("\n").filter((X)=>X!=="");if(Q&&Q.trimWhitespace===!1)return V;return V.map((X)=>X.trim())}function cQ($,Q){const V=["true","True","TRUE"],X=["false","False","FALSE"],J=q9($,Q);if(V.includes(J))return!0;if(X.includes(J))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${$}\nSupport boolean input list: \`true | True | TRUE | false | False | FALSE\``)}function lQ($,Q){if(process.env.GITHUB_OUTPUT||"")return d0.issueFileCommand("OUTPUT",d0.prepareKeyValueMessage($,Q));process.stdout.write(Z1.EOL),p.issueCommand("set-output",{name:$},G5.toCommandValue(Q))}function dQ($){p.issue("echo",$?"on":"off")}function iQ($){process.exitCode=K1.Failure,G1($)}function pQ(){return process.env.RUNNER_DEBUG==="1"}function aQ($){p.issueCommand("debug",{},$)}function G1($,Q={}){p.issueCommand("error",G5.toCommandProperties(Q),$ instanceof Error?$.toString():$)}function nQ($,Q={}){p.issueCommand("warning",G5.toCommandProperties(Q),$ instanceof Error?$.toString():$)}function sQ($,Q={}){p.issueCommand("notice",G5.toCommandProperties(Q),$ instanceof Error?$.toString():$)}function oQ($){process.stdout.write($+Z1.EOL)}function Y1($){p.issue("group",$)}function z1(){p.issue("endgroup")}function rQ($,Q){return J1(this,void 0,void 0,function*(){Y1($);let V;try{V=yield Q()}finally{z1()}return V})}function tQ($,Q){if(process.env.GITHUB_STATE||"")return d0.issueFileCommand("STATE",d0.prepareKeyValueMessage($,Q));p.issueCommand("save-state",{name:$},G5.toCommandValue(Q))}function eQ($){return process.env[`STATE_${$}`]||""}function $V($){return J1(this,void 0,void 0,function*(){return yield bQ.OidcClient.getIDToken($)})}var kQ=B&&B.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),yQ=B&&B.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),X1=B&&B.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))kQ(Q,$,V)}return yQ(Q,$),Q},J1=B&&B.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(B,"__esModule",{value:!0});B.getIDToken=B.getState=B.saveState=B.group=B.endGroup=B.startGroup=B.info=B.notice=B.warning=B.error=B.debug=B.isDebug=B.setFailed=B.setCommandEcho=B.setOutput=B.getBooleanInput=B.getMultilineInput=B.getInput=B.addPath=B.setSecret=B.exportVariable=B.ExitCode=void 0;var p=u$(),d0=y7(),G5=t5(),Z1=X1(j("os")),EQ=X1(j("path")),bQ=e7(),K1;(function($){$[$.Success=0]="Success",$[$.Failure=1]="Failure"})(K1=B.ExitCode||(B.ExitCode={}));B.exportVariable=mQ;B.setSecret=hQ;B.addPath=uQ;B.getInput=q9;B.getMultilineInput=fQ;B.getBooleanInput=cQ;B.setOutput=lQ;B.setCommandEcho=dQ;B.setFailed=iQ;B.isDebug=pQ;B.debug=aQ;B.error=G1;B.warning=nQ;B.notice=sQ;B.info=oQ;B.startGroup=Y1;B.endGroup=z1;B.group=rQ;B.saveState=tQ;B.getState=eQ;B.getIDToken=$V;var QV=W9();Object.defineProperty(B,"summary",{enumerable:!0,get:function(){return QV.summary}});var VV=W9();Object.defineProperty(B,"markdownSummary",{enumerable:!0,get:function(){return VV.markdownSummary}});var B9=V1();Object.defineProperty(B,"toPosixPath",{enumerable:!0,get:function(){return B9.toPosixPath}});Object.defineProperty(B,"toWin32Path",{enumerable:!0,get:function(){return B9.toWin32Path}});Object.defineProperty(B,"toPlatformPath",{enumerable:!0,get:function(){return B9.toPlatformPath}})});var L=C4(G9(),1);import{promises as t,createWriteStream as rX}from"fs";import{dirname as N$,join as O5,resolve as S$}from"path";import{pipeline as tX}from"stream/promises";import LV from"events";import u from"fs";import{EventEmitter as F9}from"node:events";import M1 from"node:stream";import{StringDecoder as XV}from"node:string_decoder";var W1=typeof process==="object"&&process?process:{stdout:null,stderr:null},JV=($)=>!!$&&typeof $==="object"&&($ instanceof c||$ instanceof M1||ZV($)||KV($)),ZV=($)=>!!$&&typeof $==="object"&&$ instanceof F9&&typeof $.pipe==="function"&&$.pipe!==M1.Writable.prototype.pipe,KV=($)=>!!$&&typeof $==="object"&&$ instanceof F9&&typeof $.write==="function"&&typeof $.end==="function",F0=Symbol("EOF"),H0=Symbol("maybeEmitEnd"),N0=Symbol("emittedEnd"),K8=Symbol("emittingEnd"),T5=Symbol("emittedError"),G8=Symbol("closed"),q1=Symbol("read"),Y8=Symbol("flush"),B1=Symbol("flushChunk"),Q0=Symbol("encoding"),Y5=Symbol("decoder"),S=Symbol("flowing"),C5=Symbol("paused"),z5=Symbol("resume"),_=Symbol("buffer"),b=Symbol("pipes"),R=Symbol("bufferLength"),L9=Symbol("bufferPush"),z8=Symbol("bufferShift"),k=Symbol("objectMode"),C=Symbol("destroyed"),M9=Symbol("error"),A9=Symbol("emitData"),L1=Symbol("emitEnd"),I9=Symbol("emitEnd2"),G0=Symbol("async"),w9=Symbol("abort"),W8=Symbol("aborted"),j5=Symbol("signal"),i0=Symbol("dataListeners"),f=Symbol("discarded"),D5=($)=>Promise.resolve().then($),GV=($)=>$(),YV=($)=>$==="end"||$==="finish"||$==="prefinish",zV=($)=>$ instanceof ArrayBuffer||!!$&&typeof $==="object"&&$.constructor&&$.constructor.name==="ArrayBuffer"&&$.byteLength>=0,WV=($)=>!Buffer.isBuffer($)&&ArrayBuffer.isView($);class H9{src;dest;opts;ondrain;constructor($,Q,V){this.src=$,this.dest=Q,this.opts=V,this.ondrain=()=>$[z5](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors($){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class A1 extends H9{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor($,Q,V){super($,Q,V);this.proxyErrors=(X)=>Q.emit("error",X),$.on("error",this.proxyErrors)}}var qV=($)=>!!$.objectMode,BV=($)=>!$.objectMode&&!!$.encoding&&$.encoding!=="buffer";class c extends F9{[S]=!1;[C5]=!1;[b]=[];[_]=[];[k];[Q0];[G0];[Y5];[F0]=!1;[N0]=!1;[K8]=!1;[G8]=!1;[T5]=null;[R]=0;[C]=!1;[j5];[W8]=!1;[i0]=0;[f]=!1;writable=!0;readable=!0;constructor(...$){const Q=$[0]||{};super();if(Q.objectMode&&typeof Q.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(qV(Q))this[k]=!0,this[Q0]=null;else if(BV(Q))this[Q0]=Q.encoding,this[k]=!1;else this[k]=!1,this[Q0]=null;if(this[G0]=!!Q.async,this[Y5]=this[Q0]?new XV(this[Q0]):null,Q&&Q.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[_]});if(Q&&Q.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[b]});const{signal:V}=Q;if(V)if(this[j5]=V,V.aborted)this[w9]();else V.addEventListener("abort",()=>this[w9]())}get bufferLength(){return this[R]}get encoding(){return this[Q0]}set encoding($){throw new Error("Encoding must be set at instantiation time")}setEncoding($){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[k]}set objectMode($){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[G0]}set["async"]($){this[G0]=this[G0]||!!$}[w9](){this[W8]=!0,this.emit("abort",this[j5]?.reason),this.destroy(this[j5]?.reason)}get aborted(){return this[W8]}set aborted($){}write($,Q,V){if(this[W8])return!1;if(this[F0])throw new Error("write after end");if(this[C])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof Q==="function")V=Q,Q="utf8";if(!Q)Q="utf8";const X=this[G0]?D5:GV;if(!this[k]&&!Buffer.isBuffer($)){if(WV($))$=Buffer.from($.buffer,$.byteOffset,$.byteLength);else if(zV($))$=Buffer.from($);else if(typeof $!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[k]){if(this[S]&&this[R]!==0)this[Y8](!0);if(this[S])this.emit("data",$);else this[L9]($);if(this[R]!==0)this.emit("readable");if(V)X(V);return this[S]}if(!$.length){if(this[R]!==0)this.emit("readable");if(V)X(V);return this[S]}if(typeof $==="string"&&!(Q===this[Q0]&&!this[Y5]?.lastNeed))$=Buffer.from($,Q);if(Buffer.isBuffer($)&&this[Q0])$=this[Y5].write($);if(this[S]&&this[R]!==0)this[Y8](!0);if(this[S])this.emit("data",$);else this[L9]($);if(this[R]!==0)this.emit("readable");if(V)X(V);return this[S]}read($){if(this[C])return null;if(this[f]=!1,this[R]===0||$===0||$&&$>this[R])return this[H0](),null;if(this[k])$=null;if(this[_].length>1&&!this[k])this[_]=[this[Q0]?this[_].join(""):Buffer.concat(this[_],this[R])];const Q=this[q1]($||null,this[_][0]);return this[H0](),Q}[q1]($,Q){if(this[k])this[z8]();else{const V=Q;if($===V.length||$===null)this[z8]();else if(typeof V==="string")this[_][0]=V.slice($),Q=V.slice(0,$),this[R]-=$;else this[_][0]=V.subarray($),Q=V.subarray(0,$),this[R]-=$}if(this.emit("data",Q),!this[_].length&&!this[F0])this.emit("drain");return Q}end($,Q,V){if(typeof $==="function")V=$,$=void 0;if(typeof Q==="function")V=Q,Q="utf8";if($!==void 0)this.write($,Q);if(V)this.once("end",V);if(this[F0]=!0,this.writable=!1,this[S]||!this[C5])this[H0]();return this}[z5](){if(this[C])return;if(!this[i0]&&!this[b].length)this[f]=!0;if(this[C5]=!1,this[S]=!0,this.emit("resume"),this[_].length)this[Y8]();else if(this[F0])this[H0]();else this.emit("drain")}resume(){return this[z5]()}pause(){this[S]=!1,this[C5]=!0,this[f]=!1}get destroyed(){return this[C]}get flowing(){return this[S]}get paused(){return this[C5]}[L9]($){if(this[k])this[R]+=1;else this[R]+=$.length;this[_].push($)}[z8](){if(this[k])this[R]-=1;else this[R]-=this[_][0].length;return this[_].shift()}[Y8]($=!1){do;while(this[B1](this[z8]())&&this[_].length);if(!$&&!this[_].length&&!this[F0])this.emit("drain")}[B1]($){return this.emit("data",$),this[S]}pipe($,Q){if(this[C])return $;this[f]=!1;const V=this[N0];if(Q=Q||{},$===W1.stdout||$===W1.stderr)Q.end=!1;else Q.end=Q.end!==!1;if(Q.proxyErrors=!!Q.proxyErrors,V){if(Q.end)$.end()}else if(this[b].push(!Q.proxyErrors?new H9(this,$,Q):new A1(this,$,Q)),this[G0])D5(()=>this[z5]());else this[z5]();return $}unpipe($){const Q=this[b].find((V)=>V.dest===$);if(Q){if(this[b].length===1){if(this[S]&&this[i0]===0)this[S]=!1;this[b]=[]}else this[b].splice(this[b].indexOf(Q),1);Q.unpipe()}}addListener($,Q){return this.on($,Q)}on($,Q){const V=super.on($,Q);if($==="data"){if(this[f]=!1,this[i0]++,!this[b].length&&!this[S])this[z5]()}else if($==="readable"&&this[R]!==0)super.emit("readable");else if(YV($)&&this[N0])super.emit($),this.removeAllListeners($);else if($==="error"&&this[T5]){const X=Q;if(this[G0])D5(()=>X.call(this,this[T5]));else X.call(this,this[T5])}return V}removeListener($,Q){return this.off($,Q)}off($,Q){const V=super.off($,Q);if($==="data"){if(this[i0]=this.listeners("data").length,this[i0]===0&&!this[f]&&!this[b].length)this[S]=!1}return V}removeAllListeners($){const Q=super.removeAllListeners($);if($==="data"||$===void 0){if(this[i0]=0,!this[f]&&!this[b].length)this[S]=!1}return Q}get emittedEnd(){return this[N0]}[H0](){if(!this[K8]&&!this[N0]&&!this[C]&&this[_].length===0&&this[F0]){if(this[K8]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[G8])this.emit("close");this[K8]=!1}}emit($,...Q){const V=Q[0];if($!=="error"&&$!=="close"&&$!==C&&this[C])return!1;else if($==="data")return!this[k]&&!V?!1:this[G0]?(D5(()=>this[A9](V)),!0):this[A9](V);else if($==="end")return this[L1]();else if($==="close"){if(this[G8]=!0,!this[N0]&&!this[C])return!1;const J=super.emit("close");return this.removeAllListeners("close"),J}else if($==="error"){this[T5]=V,super.emit(M9,V);const J=!this[j5]||this.listeners("error").length?super.emit("error",V):!1;return this[H0](),J}else if($==="resume"){const J=super.emit("resume");return this[H0](),J}else if($==="finish"||$==="prefinish"){const J=super.emit($);return this.removeAllListeners($),J}const X=super.emit($,...Q);return this[H0](),X}[A9]($){for(let V of this[b])if(V.dest.write($)===!1)this.pause();const Q=this[f]?!1:super.emit("data",$);return this[H0](),Q}[L1](){if(this[N0])return!1;return this[N0]=!0,this.readable=!1,this[G0]?(D5(()=>this[I9]()),!0):this[I9]()}[I9](){if(this[Y5]){const Q=this[Y5].end();if(Q){for(let V of this[b])V.dest.write(Q);if(!this[f])super.emit("data",Q)}}for(let Q of this[b])Q.end();const $=super.emit("end");return this.removeAllListeners("end"),$}async collect(){const $=Object.assign([],{dataLength:0});if(!this[k])$.dataLength=0;const Q=this.promise();return this.on("data",(V)=>{if($.push(V),!this[k])$.dataLength+=V.length}),await Q,$}async concat(){if(this[k])throw new Error("cannot concat in objectMode");const $=await this.collect();return this[Q0]?$.join(""):Buffer.concat($,$.dataLength)}async promise(){return new Promise(($,Q)=>{this.on(C,()=>Q(new Error("stream destroyed"))),this.on("error",(V)=>Q(V)),this.on("end",()=>$())})}[Symbol.asyncIterator](){this[f]=!1;let $=!1;const Q=async()=>{return this.pause(),$=!0,{value:void 0,done:!0}};return{next:()=>{if($)return Q();const X=this.read();if(X!==null)return Promise.resolve({done:!1,value:X});if(this[F0])return Q();let J,Z;const K=(z)=>{this.off("data",G),this.off("end",Y),this.off(C,W),Q(),Z(z)},G=(z)=>{this.off("error",K),this.off("end",Y),this.off(C,W),this.pause(),J({value:z,done:!!this[F0]})},Y=()=>{this.off("error",K),this.off("data",G),this.off(C,W),Q(),J({done:!0,value:void 0})},W=()=>K(new Error("stream destroyed"));return new Promise((z,q)=>{Z=q,J=z,this.once(C,W),this.once("error",K),this.once("end",Y),this.once("data",G)})},throw:Q,return:Q,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[f]=!1;let $=!1;const Q=()=>{return this.pause(),this.off(M9,Q),this.off(C,Q),this.off("end",Q),$=!0,{done:!0,value:void 0}},V=()=>{if($)return Q();const X=this.read();return X===null?Q():{done:!1,value:X}};return this.once("end",Q),this.once(M9,Q),this.once(C,Q),{next:V,throw:Q,return:Q,[Symbol.iterator](){return this}}}destroy($){if(this[C]){if($)this.emit("error",$);else this.emit(C);return this}this[C]=!0,this[f]=!0,this[_].length=0,this[R]=0;const Q=this;if(typeof Q.close==="function"&&!this[G8])Q.close();if($)this.emit("error",$);else this.emit(C);return this}static get isStream(){return JV}}var MV=u.writev,_0=Symbol("_autoClose"),X0=Symbol("_close"),N5=Symbol("_ended"),w=Symbol("_fd"),P9=Symbol("_finished"),v0=Symbol("_flags"),v9=Symbol("_flush"),T9=Symbol("_handleChunk"),C9=Symbol("_makeBuf"),_5=Symbol("_mode"),q8=Symbol("_needDrain"),B5=Symbol("_onerror"),L5=Symbol("_onopen"),O9=Symbol("_onread"),W5=Symbol("_onwrite"),R0=Symbol("_open"),V0=Symbol("_path"),S0=Symbol("_pos"),Y0=Symbol("_queue"),q5=Symbol("_read"),U9=Symbol("_readSize"),P0=Symbol("_reading"),S5=Symbol("_remain"),x9=Symbol("_size"),B8=Symbol("_write"),p0=Symbol("_writing"),L8=Symbol("_defaultFlag"),a0=Symbol("_errored");class M5 extends c{[a0]=!1;[w];[V0];[U9];[P0]=!1;[x9];[S5];[_0];constructor($,Q){Q=Q||{};super(Q);if(this.readable=!0,this.writable=!1,typeof $!=="string")throw new TypeError("path must be a string");if(this[a0]=!1,this[w]=typeof Q.fd==="number"?Q.fd:void 0,this[V0]=$,this[U9]=Q.readSize||16777216,this[P0]=!1,this[x9]=typeof Q.size==="number"?Q.size:1/0,this[S5]=this[x9],this[_0]=typeof Q.autoClose==="boolean"?Q.autoClose:!0,typeof this[w]==="number")this[q5]();else this[R0]()}get fd(){return this[w]}get path(){return this[V0]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[R0](){u.open(this[V0],"r",($,Q)=>this[L5]($,Q))}[L5]($,Q){if($)this[B5]($);else this[w]=Q,this.emit("open",Q),this[q5]()}[C9](){return Buffer.allocUnsafe(Math.min(this[U9],this[S5]))}[q5](){if(!this[P0]){this[P0]=!0;const $=this[C9]();if($.length===0)return process.nextTick(()=>this[O9](null,0,$));u.read(this[w],$,0,$.length,null,(Q,V,X)=>this[O9](Q,V,X))}}[O9]($,Q,V){if(this[P0]=!1,$)this[B5]($);else if(this[T9](Q,V))this[q5]()}[X0](){if(this[_0]&&typeof this[w]==="number"){const $=this[w];this[w]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}[B5]($){this[P0]=!0,this[X0](),this.emit("error",$)}[T9]($,Q){let V=!1;if(this[S5]-=$,$>0)V=super.write($this[L5]($,Q))}[L5]($,Q){if(this[L8]&&this[v0]==="r+"&&$&&$.code==="ENOENT")this[v0]="w",this[R0]();else if($)this[B5]($);else if(this[w]=Q,this.emit("open",Q),!this[p0])this[v9]()}end($,Q){if($)this.write($,Q);if(this[N5]=!0,!this[p0]&&!this[Y0].length&&typeof this[w]==="number")this[W5](null,0);return this}write($,Q){if(typeof $==="string")$=Buffer.from($,Q);if(this[N5])return this.emit("error",new Error("write() after end()")),!1;if(this[w]===void 0||this[p0]||this[Y0].length)return this[Y0].push($),this[q8]=!0,!1;return this[p0]=!0,this[B8]($),!0}[B8]($){u.write(this[w],$,0,$.length,this[S0],(Q,V)=>this[W5](Q,V))}[W5]($,Q){if($)this[B5]($);else{if(this[S0]!==void 0&&typeof Q==="number")this[S0]+=Q;if(this[Y0].length)this[v9]();else if(this[p0]=!1,this[N5]&&!this[P9])this[P9]=!0,this[X0](),this.emit("finish");else if(this[q8])this[q8]=!1,this.emit("drain")}}[v9](){if(this[Y0].length===0){if(this[N5])this[W5](null,0)}else if(this[Y0].length===1)this[B8](this[Y0].pop());else{const $=this[Y0];this[Y0]=[],MV(this[w],$,this[S0],(Q,V)=>this[W5](Q,V))}}[X0](){if(this[_0]&&typeof this[w]==="number"){const $=this[w];this[w]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}}class R5 extends g0{[R0](){let $;if(this[L8]&&this[v0]==="r+")try{$=u.openSync(this[V0],this[v0],this[_5])}catch(Q){if(Q?.code==="ENOENT")return this[v0]="w",this[R0]();else throw Q}else $=u.openSync(this[V0],this[v0],this[_5]);this[L5](null,$)}[X0](){if(this[_0]&&typeof this[w]==="number"){const $=this[w];this[w]=void 0,u.closeSync($),this.emit("close")}}[B8]($){let Q=!0;try{this[W5](null,u.writeSync(this[w],$,0,$.length,this[S0])),Q=!1}finally{if(Q)try{this[X0]()}catch{}}}}import n1 from"node:path";import w5 from"node:fs";import{dirname as pV,parse as aV}from"path";var AV=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"]]),I1=($)=>!!$.sync&&!!$.file,w1=($)=>!$.sync&&!!$.file,F1=($)=>!!$.sync&&!$.file,H1=($)=>!$.sync&&!$.file;var P1=($)=>!!$.file;var IV=($)=>{const Q=AV.get($);if(Q)return Q;return $},g5=($={})=>{if(!$)return{};const Q={};for(let[V,X]of Object.entries($)){const J=IV(V);Q[J]=X}if(Q.chmod===void 0&&Q.noChmod===!1)Q.chmod=!0;return delete Q.noChmod,Q};var z0=($,Q,V,X,J)=>{return Object.assign((Z=[],K,G)=>{if(Array.isArray(Z))K=Z,Z={};if(typeof K==="function")G=K,K=void 0;if(!K)K=[];else K=Array.from(K);const Y=g5(Z);if(J?.(Y,K),I1(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return $(Y,K)}else if(w1(Y)){const W=Q(Y,K),z=G?G:void 0;return z?W.then(()=>z(),z):W}else if(F1(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return V(Y,K)}else if(H1(Y)){if(typeof G==="function")throw new TypeError("callback only supported with file option");return X(Y,K)}else throw new Error("impossible options??")},{syncFile:$,asyncFile:Q,syncNoFile:V,asyncNoFile:X,validate:J})};import{EventEmitter as lV}from"events";import S9 from"assert";import{Buffer as k0}from"buffer";import HV from"zlib";import wV from"zlib";var FV=wV.constants||{ZLIB_VERNUM:4736},O0=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},FV));var v1=k0.concat,n0=Symbol("_superWrite");class k5 extends Error{code;errno;constructor($){super("zlib: "+$.message);if(this.code=$.code,this.errno=$.errno,!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+$.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}var N9=Symbol("flushFlag");class _9 extends c{#$=!1;#V=!1;#X;#Z;#J;#Q;#K;get sawError(){return this.#$}get handle(){return this.#Q}get flushFlag(){return this.#X}constructor($,Q){if(!$||typeof $!=="object")throw new TypeError("invalid options for ZlibBase constructor");super($);this.#X=$.flush??0,this.#Z=$.finishFlush??0,this.#J=$.fullFlushFlag??0;try{this.#Q=new HV[Q]($)}catch(V){throw new k5(V)}this.#K=(V)=>{if(this.#$)return;this.#$=!0,this.close(),this.emit("error",V)},this.#Q?.on("error",(V)=>this.#K(new k5(V))),this.once("end",()=>this.close)}close(){if(this.#Q)this.#Q.close(),this.#Q=void 0,this.emit("close")}reset(){if(!this.#$)return S9(this.#Q,"zlib binding closed"),this.#Q.reset?.()}flush($){if(this.ended)return;if(typeof $!=="number")$=this.#J;this.write(Object.assign(k0.alloc(0),{[N9]:$}))}end($,Q,V){if(typeof $==="function")V=$,Q=void 0,$=void 0;if(typeof Q==="function")V=Q,Q=void 0;if($)if(Q)this.write($,Q);else this.write($);return this.flush(this.#Z),this.#V=!0,super.end(V)}get ended(){return this.#V}[n0]($){return super.write($)}write($,Q,V){if(typeof Q==="function")V=Q,Q="utf8";if(typeof $==="string")$=k0.from($,Q);if(this.#$)return;S9(this.#Q,"zlib binding closed");const X=this.#Q._handle,J=X.close;X.close=()=>{};const Z=this.#Q.close;this.#Q.close=()=>{},k0.concat=(Y)=>Y;let K=void 0;try{const Y=typeof $[N9]==="number"?$[N9]:this.#X;K=this.#Q._processChunk($,Y),k0.concat=v1}catch(Y){k0.concat=v1,this.#K(new k5(Y))}finally{if(this.#Q)this.#Q._handle=X,X.close=J,this.#Q.close=Z,this.#Q.removeAllListeners("error")}if(this.#Q)this.#Q.on("error",(Y)=>this.#K(new k5(Y)));let G;if(K)if(Array.isArray(K)&&K.length>0){const Y=K[0];G=this[n0](k0.from(Y));for(let W=1;W{if(typeof X==="function")J=X,X=this.flushFlag;this.flush(X),J?.()};try{this.handle.params($,Q)}finally{this.handle.flush=V}if(this.handle)this.#$=$,this.#V=Q}}}class g9 extends R9{#$;constructor($){super($,"Gzip");this.#$=$&&!!$.portable}[n0]($){if(!this.#$)return super[n0]($);return this.#$=!1,$[9]=255,super[n0]($)}}class k9 extends R9{constructor($){super($,"Unzip")}}class y9 extends _9{constructor($,Q){$=$||{},$.flush=$.flush||O0.BROTLI_OPERATION_PROCESS,$.finishFlush=$.finishFlush||O0.BROTLI_OPERATION_FINISH,$.fullFlushFlag=O0.BROTLI_OPERATION_FLUSH;super($,Q)}}class E9 extends y9{constructor($){super($,"BrotliCompress")}}class b9 extends y9{constructor($){super($,"BrotliDecompress")}}function vV($,Q,V){const X=Q,J=Q?Q.next:$.head,Z=new M8(V,X,J,$);if(Z.next===void 0)$.tail=Z;if(Z.prev===void 0)$.head=Z;return $.length++,Z}function OV($,Q){if($.tail=new M8(Q,$.tail,void 0,$),!$.head)$.head=$.tail;$.length++}function UV($,Q){if($.head=new M8(Q,void 0,$.head,$),!$.tail)$.tail=$.head;$.length++}class W0{tail;head;length=0;static create($=[]){return new W0($)}constructor($=[]){for(let Q of $)this.push(Q)}*[Symbol.iterator](){for(let $=this.head;$;$=$.next)yield $.value}removeNode($){if($.list!==this)throw new Error("removing node which does not belong to this list");const{next:Q,prev:V}=$;if(Q)Q.prev=V;if(V)V.next=Q;if($===this.head)this.head=Q;if($===this.tail)this.tail=V;return this.length--,$.next=void 0,$.prev=void 0,$.list=void 0,Q}unshiftNode($){if($===this.head)return;if($.list)$.list.removeNode($);const Q=this.head;if($.list=this,$.next=Q,Q)Q.prev=$;if(this.head=$,!this.tail)this.tail=$;this.length++}pushNode($){if($===this.tail)return;if($.list)$.list.removeNode($);const Q=this.tail;if($.list=this,$.prev=Q,Q)Q.next=$;if(this.tail=$,!this.head)this.head=$;this.length++}push(...$){for(let Q=0,V=$.length;Q1)V=Q;else if(this.head)X=this.head.next,V=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var J=0;X;J++)V=$(V,X.value,J),X=X.next;return V}reduceReverse($,Q){let V,X=this.tail;if(arguments.length>1)V=Q;else if(this.tail)X=this.tail.prev,V=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let J=this.length-1;X;J--)V=$(V,X.value,J),X=X.prev;return V}toArray(){const $=new Array(this.length);for(let Q=0,V=this.head;V;Q++)$[Q]=V.value,V=V.next;return $}toArrayReverse(){const $=new Array(this.length);for(let Q=0,V=this.tail;V;Q++)$[Q]=V.value,V=V.prev;return $}slice($=0,Q=this.length){if(Q<0)Q+=this.length;if($<0)$+=this.length;const V=new W0;if(Q<$||Q<0)return V;if($<0)$=0;if(Q>this.length)Q=this.length;let X=this.head,J=0;for(J=0;!!X&&J<$;J++)X=X.next;for(;!!X&&Jthis.length)Q=this.length;let X=this.length,J=this.tail;for(;!!J&&X>Q;X--)J=J.prev;for(;!!J&&X>$;X--,J=J.prev)V.push(J.value);return V}splice($,Q=0,...V){if($>this.length)$=this.length-1;if($<0)$=this.length+$;let X=this.head;for(let Z=0;!!X&&Z<$;Z++)X=X.next;const J=[];for(let Z=0;!!X&&Z{if(!Number.isSafeInteger($))throw Error("cannot encode number outside of javascript safe integer range");else if($<0)TV($,Q);else xV($,Q);return Q},xV=($,Q)=>{Q[0]=128;for(var V=Q.length;V>1;V--)Q[V-1]=$&255,$=Math.floor($/256)},TV=($,Q)=>{Q[0]=255;var V=!1;$=$*-1;for(var X=Q.length;X>1;X--){var J=$&255;if($=Math.floor($/256),V)Q[X-1]=x1(J);else if(J===0)Q[X-1]=0;else V=!0,Q[X-1]=T1(J)}},U1=($)=>{const Q=$[0],V=Q===128?jV($.subarray(1,$.length)):Q===255?CV($):null;if(V===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(V))throw Error("parsed number outside of javascript safe integer range");return V},CV=($)=>{var Q=$.length,V=0,X=!1;for(var J=Q-1;J>-1;J--){var Z=Number($[J]),K;if(X)K=x1(Z);else if(Z===0)K=Z;else X=!0,K=T1(Z);if(K!==0)V-=K*Math.pow(256,Q-J-1)}return V},jV=($)=>{var Q=$.length,V=0;for(var X=Q-1;X>-1;X--){var J=Number($[X]);if(J!==0)V+=J*Math.pow(256,Q-X-1)}return V},x1=($)=>(255^$)&255,T1=($)=>(255^$)+1&255;var A8=($)=>I8.has($);var I8=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"]]),C1=new Map(Array.from(I8).map(($)=>[$[1],$[0]]));class a{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#$="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor($,Q=0,V,X){if(Buffer.isBuffer($))this.decode($,Q||0,V,X);else if($)this.#V($)}decode($,Q,V,X){if(!Q)Q=0;if(!$||!($.length>=Q+512))throw new Error("need 512 bytes for header");if(this.path=s0($,Q,100),this.mode=y0($,Q+100,8),this.uid=y0($,Q+108,8),this.gid=y0($,Q+116,8),this.size=y0($,Q+124,12),this.mtime=m9($,Q+136,12),this.cksum=y0($,Q+148,12),X)this.#V(X,!0);if(V)this.#V(V);const J=s0($,Q+156,1);if(A8(J))this.#$=J||"0";if(this.#$==="0"&&this.path.slice(-1)==="/")this.#$="5";if(this.#$==="5")this.size=0;if(this.linkpath=s0($,Q+157,100),$.subarray(Q+257,Q+265).toString()==="ustar\x0000")if(this.uname=s0($,Q+265,32),this.gname=s0($,Q+297,32),this.devmaj=y0($,Q+329,8)??0,this.devmin=y0($,Q+337,8)??0,$[Q+475]!==0){const K=s0($,Q+345,155);this.path=K+"/"+this.path}else{const K=s0($,Q+345,130);if(K)this.path=K+"/"+this.path;this.atime=m9($,Q+476,12),this.ctime=m9($,Q+488,12)}let Z=256;for(let K=Q;K{return!(X===null||X===void 0||V==="path"&&Q||V==="linkpath"&&Q||V==="global")})))}encode($,Q=0){if(!$)$=this.block=Buffer.alloc(512);if(this.#$==="Unsupported")this.#$="0";if(!($.length>=Q+512))throw new Error("need 512 bytes for header");const V=this.ctime||this.atime?130:155,X=NV(this.path||"",V),J=X[0],Z=X[1];if(this.needPax=!!X[2],this.needPax=o0($,Q,100,J)||this.needPax,this.needPax=E0($,Q+100,8,this.mode)||this.needPax,this.needPax=E0($,Q+108,8,this.uid)||this.needPax,this.needPax=E0($,Q+116,8,this.gid)||this.needPax,this.needPax=E0($,Q+124,12,this.size)||this.needPax,this.needPax=h9($,Q+136,12,this.mtime)||this.needPax,$[Q+156]=this.#$.charCodeAt(0),this.needPax=o0($,Q+157,100,this.linkpath)||this.needPax,$.write("ustar\x0000",Q+257,8),this.needPax=o0($,Q+265,32,this.uname)||this.needPax,this.needPax=o0($,Q+297,32,this.gname)||this.needPax,this.needPax=E0($,Q+329,8,this.devmaj)||this.needPax,this.needPax=E0($,Q+337,8,this.devmin)||this.needPax,this.needPax=o0($,Q+345,V,Z)||this.needPax,$[Q+475]!==0)this.needPax=o0($,Q+345,155,Z)||this.needPax;else this.needPax=o0($,Q+345,130,Z)||this.needPax,this.needPax=h9($,Q+476,12,this.atime)||this.needPax,this.needPax=h9($,Q+488,12,this.ctime)||this.needPax;let K=256;for(let G=Q;G{let X=$,J="",Z=void 0;const K=A5.parse($).root||".";if(Buffer.byteLength(X)<100)Z=[X,J,!1];else{J=A5.dirname(X),X=A5.basename(X);do if(Buffer.byteLength(X)<=100&&Buffer.byteLength(J)<=Q)Z=[X,J,!1];else if(Buffer.byteLength(X)>100&&Buffer.byteLength(J)<=Q)Z=[X.slice(0,99),J,!0];else X=A5.join(A5.basename(J),X),J=A5.dirname(J);while(J!==K&&Z===void 0);if(!Z)Z=[$.slice(0,99),"",!0]}return Z},s0=($,Q,V)=>$.subarray(Q,Q+V).toString("utf8").replace(/\0.*/,""),m9=($,Q,V)=>SV(y0($,Q,V)),SV=($)=>$===void 0?void 0:new Date($*1000),y0=($,Q,V)=>Number($[Q])&128?U1($.subarray(Q,Q+V)):RV($,Q,V),_V=($)=>isNaN($)?void 0:$,RV=($,Q,V)=>_V(parseInt($.subarray(Q,Q+V).toString("utf8").replace(/\0.*$/,"").trim(),8)),gV={12:8589934591,8:2097151},E0=($,Q,V,X)=>X===void 0?!1:X>gV[V]||X<0?(O1(X,$.subarray(Q,Q+V)),!0):(kV($,Q,V,X),!1),kV=($,Q,V,X)=>$.write(yV(X,V),Q,V,"ascii"),yV=($,Q)=>EV(Math.floor($).toString(8),Q),EV=($,Q)=>($.length===Q-1?$:new Array(Q-$.length-1).join("0")+$+" ")+"\0",h9=($,Q,V,X)=>X===void 0?!1:E0($,Q,V,X.getTime()/1000),bV=new Array(156).join("\0"),o0=($,Q,V,X)=>X===void 0?!1:($.write(X+bV,Q,V,"utf8"),X.length!==Buffer.byteLength(X)||X.length>V);import{basename as mV}from"node:path";class b0{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor($,Q=!1){this.atime=$.atime,this.charset=$.charset,this.comment=$.comment,this.ctime=$.ctime,this.dev=$.dev,this.gid=$.gid,this.global=Q,this.gname=$.gname,this.ino=$.ino,this.linkpath=$.linkpath,this.mtime=$.mtime,this.nlink=$.nlink,this.path=$.path,this.size=$.size,this.uid=$.uid,this.uname=$.uname}encode(){const $=this.encodeBody();if($==="")return Buffer.allocUnsafe(0);const Q=Buffer.byteLength($),V=512*Math.ceil(1+Q/512),X=Buffer.allocUnsafe(V);for(let J=0;J<512;J++)X[J]=0;new a({path:("PaxHeader/"+mV(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:Q,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(X),X.write($,512,Q,"utf8");for(let J=Q+512;J=Math.pow(10,Z))Z+=1;return Z+J+X}static parse($,Q,V=!1){return new b0(hV(uV($),Q),V)}}var hV=($,Q)=>Q?Object.assign({},Q,$):$,uV=($)=>$.replace(/\n$/,"").split("\n").reduce(fV,Object.create(null)),fV=($,Q)=>{const V=parseInt(Q,10);if(V!==Buffer.byteLength(Q)+1)return $;Q=Q.slice((V+" ").length);const X=Q.split("="),J=X.shift();if(!J)return $;const Z=J.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),K=X.join("=");return $[Z]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(Z)?new Date(Number(K)*1000):/^[0-9]+$/.test(K)?+K:K,$};var cV=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,A=cV!=="win32"?($)=>$:($)=>$&&$.replace(/\\/g,"/");class y5 extends c{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($,Q,V){super({});switch(this.pause(),this.extended=Q,this.globalExtended=V,this.header=$,this.remain=$.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=$.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(!$.path)throw new Error("no path provided for tar.ReadEntry");if(this.path=A($.path),this.mode=$.mode,this.mode)this.mode=this.mode&4095;if(this.uid=$.uid,this.gid=$.gid,this.uname=$.uname,this.gname=$.gname,this.size=this.remain,this.mtime=$.mtime,this.atime=$.atime,this.ctime=$.ctime,this.linkpath=$.linkpath?A($.linkpath):void 0,this.uname=$.uname,this.gname=$.gname,Q)this.#$(Q);if(V)this.#$(V,!0)}write($){const Q=$.length;if(Q>this.blockRemain)throw new Error("writing more to entry than is appropriate");const V=this.remain,X=this.blockRemain;if(this.remain=Math.max(0,V-Q),this.blockRemain=Math.max(0,X-Q),this.ignore)return!0;if(V>=Q)return super.write($);return super.write($.subarray(0,V))}#$($,Q=!1){if($.path)$.path=A($.path);if($.linkpath)$.linkpath=A($.linkpath);Object.assign(this,Object.fromEntries(Object.entries($).filter(([V,X])=>{return!(X===null||X===void 0||V==="path"&&Q)})))}}var r0=($,Q,V,X={})=>{if($.file)X.file=$.file;if($.cwd)X.cwd=$.cwd;if(X.code=V instanceof Error&&V.code||Q,X.tarCode=Q,!$.strict&&X.recoverable!==!1){if(V instanceof Error)X=Object.assign(V,X),V=V.message;$.emit("warn",Q,V,X)}else if(V instanceof Error)$.emit("error",Object.assign(V,X));else $.emit("error",Object.assign(new Error(`${Q}: ${V}`),X))};var dV=1048576,u9=Buffer.from([31,139]),n=Symbol("state"),t0=Symbol("writeEntry"),U0=Symbol("readEntry"),f9=Symbol("nextEntry"),D1=Symbol("processEntry"),q0=Symbol("extendedHeader"),E5=Symbol("globalExtendedHeader"),m0=Symbol("meta"),N1=Symbol("emitMeta"),P=Symbol("buffer"),x0=Symbol("queue"),h0=Symbol("ended"),c9=Symbol("emittedEnd"),e0=Symbol("emit"),D=Symbol("unzip"),w8=Symbol("consumeChunk"),F8=Symbol("consumeChunkSub"),l9=Symbol("consumeBody"),S1=Symbol("consumeMeta"),_1=Symbol("consumeHeader"),b5=Symbol("consuming"),d9=Symbol("bufferConcat"),H8=Symbol("maybeEnd"),I5=Symbol("writing"),u0=Symbol("aborted"),P8=Symbol("onDone"),$5=Symbol("sawValidEntry"),v8=Symbol("sawNullBlock"),O8=Symbol("sawEOF"),R1=Symbol("closeStream"),iV=()=>!0;class f0 extends lV{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[x0]=new W0;[P];[U0];[t0];[n]="begin";[m0]="";[q0];[E5];[h0]=!1;[D];[u0]=!1;[$5];[v8]=!1;[O8]=!1;[I5]=!1;[b5]=!1;[c9]=!1;constructor($={}){super();if(this.file=$.file||"",this.on(P8,()=>{if(this[n]==="begin"||this[$5]===!1)this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),$.ondone)this.on(P8,$.ondone);else this.on(P8,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")});this.strict=!!$.strict,this.maxMetaEntrySize=$.maxMetaEntrySize||dV,this.filter=typeof $.filter==="function"?$.filter:iV;const Q=$.file&&($.file.endsWith(".tar.br")||$.file.endsWith(".tbr"));if(this.brotli=!$.gzip&&$.brotli!==void 0?$.brotli:Q?void 0:!1,this.on("end",()=>this[R1]()),typeof $.onwarn==="function")this.on("warn",$.onwarn);if(typeof $.onReadEntry==="function")this.on("entry",$.onReadEntry)}warn($,Q,V={}){r0(this,$,Q,V)}[_1]($,Q){if(this[$5]===void 0)this[$5]=!1;let V;try{V=new a($,Q,this[q0],this[E5])}catch(X){return this.warn("TAR_ENTRY_INVALID",X)}if(V.nullBlock)if(this[v8]){if(this[O8]=!0,this[n]==="begin")this[n]="header";this[e0]("eof")}else this[v8]=!0,this[e0]("nullBlock");else if(this[v8]=!1,!V.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:V});else if(!V.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:V});else{const X=V.type;if(/^(Symbolic)?Link$/.test(X)&&!V.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:V});else if(!/^(Symbolic)?Link$/.test(X)&&!/^(Global)?ExtendedHeader$/.test(X)&&V.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:V});else{const J=this[t0]=new y5(V,this[q0],this[E5]);if(!this[$5])if(J.remain){const Z=()=>{if(!J.invalid)this[$5]=!0};J.on("end",Z)}else this[$5]=!0;if(J.meta){if(J.size>this.maxMetaEntrySize)J.ignore=!0,this[e0]("ignoredEntry",J),this[n]="ignore",J.resume();else if(J.size>0)this[m0]="",J.on("data",(Z)=>this[m0]+=Z),this[n]="meta"}else if(this[q0]=void 0,J.ignore=J.ignore||!this.filter(J.path,J),J.ignore)this[e0]("ignoredEntry",J),this[n]=J.remain?"ignore":"header",J.resume();else{if(J.remain)this[n]="body";else this[n]="header",J.end();if(!this[U0])this[x0].push(J),this[f9]();else this[x0].push(J)}}}}[R1](){queueMicrotask(()=>this.emit("close"))}[D1]($){let Q=!0;if(!$)this[U0]=void 0,Q=!1;else if(Array.isArray($)){const[V,...X]=$;this.emit(V,...X)}else if(this[U0]=$,this.emit("entry",$),!$.emittedEnd)$.on("end",()=>this[f9]()),Q=!1;return Q}[f9](){do;while(this[D1](this[x0].shift()));if(!this[x0].length){const $=this[U0];if(!$||$.flowing||$.size===$.remain){if(!this[I5])this.emit("drain")}else $.once("drain",()=>this.emit("drain"))}}[l9]($,Q){const V=this[t0];if(!V)throw new Error("attempt to consume body without entry??");const X=V.blockRemain??0,J=X>=$.length&&Q===0?$:$.subarray(Q,Q+X);if(V.write(J),!V.blockRemain)this[n]="header",this[t0]=void 0,V.end();return J.length}[S1]($,Q){const V=this[t0],X=this[l9]($,Q);if(!this[t0]&&V)this[N1](V);return X}[e0]($,Q,V){if(!this[x0].length&&!this[U0])this.emit($,Q,V);else this[x0].push([$,Q,V])}[N1]($){switch(this[e0]("meta",this[m0]),$.type){case"ExtendedHeader":case"OldExtendedHeader":this[q0]=b0.parse(this[m0],this[q0],!1);break;case"GlobalExtendedHeader":this[E5]=b0.parse(this[m0],this[E5],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const Q=this[q0]??Object.create(null);this[q0]=Q,Q.path=this[m0].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const Q=this[q0]||Object.create(null);this[q0]=Q,Q.linkpath=this[m0].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+$.type)}}abort($){this[u0]=!0,this.emit("abort",$),this.warn("TAR_ABORT",$,{recoverable:!1})}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");if(this[u0])return V?.(),!1;if((this[D]===void 0||this.brotli===void 0&&this[D]===!1)&&$){if(this[P])$=Buffer.concat([this[P],$]),this[P]=void 0;if($.lengththis[w8](Y)),this[D].on("error",(Y)=>this.abort(Y)),this[D].on("end",()=>{this[h0]=!0,this[w8]()}),this[I5]=!0;const G=!!this[D][K?"end":"write"]($);return this[I5]=!1,V?.(),G}}if(this[I5]=!0,this[D])this[D].write($);else this[w8]($);this[I5]=!1;const J=this[x0].length?!1:this[U0]?this[U0].flowing:!0;if(!J&&!this[x0].length)this[U0]?.once("drain",()=>this.emit("drain"));return V?.(),J}[d9]($){if($&&!this[u0])this[P]=this[P]?Buffer.concat([this[P],$]):$}[H8](){if(this[h0]&&!this[c9]&&!this[u0]&&!this[b5]){this[c9]=!0;const $=this[t0];if($&&$.blockRemain){const Q=this[P]?this[P].length:0;if(this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${$.blockRemain} more bytes, only ${Q} available)`,{entry:$}),this[P])$.write(this[P]);$.end()}this[e0](P8)}}[w8]($){if(this[b5]&&$)this[d9]($);else if(!$&&!this[P])this[H8]();else if($){if(this[b5]=!0,this[P]){this[d9]($);const Q=this[P];this[P]=void 0,this[F8](Q)}else this[F8]($);while(this[P]&&this[P]?.length>=512&&!this[u0]&&!this[O8]){const Q=this[P];this[P]=void 0,this[F8](Q)}this[b5]=!1}if(!this[P]||this[h0])this[H8]()}[F8]($){let Q=0;const V=$.length;while(Q+512<=V&&!this[u0]&&!this[O8])switch(this[n]){case"begin":case"header":this[_1]($,Q),Q+=512;break;case"ignore":case"body":Q+=this[l9]($,Q);break;case"meta":Q+=this[S1]($,Q);break;default:throw new Error("invalid state: "+this[n])}if(Q{let Q=$.length-1,V=-1;while(Q>-1&&$.charAt(Q)==="/")V=Q,Q--;return V===-1?$:$.slice(0,V)};var nV=($)=>{const Q=$.onReadEntry;$.onReadEntry=Q?(V)=>{Q(V),V.resume()}:(V)=>V.resume()},i9=($,Q)=>{const V=new Map(Q.map((Z)=>[B0(Z),!0])),X=$.filter,J=(Z,K="")=>{const G=K||aV(Z).root||".";let Y;if(Z===G)Y=!1;else{const W=V.get(Z);if(W!==void 0)Y=W;else Y=J(pV(Z),G)}return V.set(Z,Y),Y};$.filter=X?(Z,K)=>X(Z,K)&&J(B0(Z)):(Z)=>J(B0(Z))},sV=($)=>{const Q=new f0($),V=$.file;let X;try{const J=w5.statSync(V),Z=$.maxReadSize||16777216;if(J.size{const V=new f0($),X=$.maxReadSize||16777216,J=$.file;return new Promise((K,G)=>{V.on("error",G),V.on("end",K),w5.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M5(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},Q5=z0(sV,oV,($)=>new f0($),($)=>new f0($),($,Q)=>{if(Q?.length)i9($,Q);if(!$.noResume)nV($)});import g8 from"fs";import L0 from"fs";import E1 from"path";var p9=($,Q,V)=>{if($&=4095,V)$=($|384)&-19;if(Q){if($&256)$|=64;if($&32)$|=8;if($&4)$|=1}return $};import{win32 as rV}from"node:path";var{isAbsolute:tV,parse:g1}=rV,m5=($)=>{let Q="",V=g1($);while(tV($)||V.root){const X=$.charAt(0)==="/"&&$.slice(0,4)!=="//?/"?"/":V.root;$=$.slice(X.length),Q+=X,V=g1($)}return[Q,$]};var U8=["|","<",">","?",":"],a9=U8.map(($)=>String.fromCharCode(61440+$.charCodeAt(0))),eV=new Map(U8.map(($,Q)=>[$,a9[Q]])),$X=new Map(a9.map(($,Q)=>[$,U8[Q]])),n9=($)=>U8.reduce((Q,V)=>Q.split(V).join(eV.get(V)),$),k1=($)=>a9.reduce((Q,V)=>Q.split(V).join($X.get(V)),$);var f1=($,Q)=>{if(!Q)return A($);return $=A($).replace(/^\.(\/|$)/,""),B0(Q)+"/"+$},QX=16777216,b1=Symbol("process"),m1=Symbol("file"),h1=Symbol("directory"),o9=Symbol("symlink"),u1=Symbol("hardlink"),h5=Symbol("header"),x8=Symbol("read"),r9=Symbol("lstat"),T8=Symbol("onlstat"),t9=Symbol("onread"),e9=Symbol("onreadlink"),$$=Symbol("openfile"),Q$=Symbol("onopenfile"),c0=Symbol("close"),C8=Symbol("mode"),V$=Symbol("awaitDrain"),s9=Symbol("ondrain"),M0=Symbol("prefix");class j8 extends c{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;#$=!1;constructor($,Q={}){const V=g5(Q);super();if(this.path=A($),this.portable=!!V.portable,this.maxReadSize=V.maxReadSize||QX,this.linkCache=V.linkCache||new Map,this.statCache=V.statCache||new Map,this.preservePaths=!!V.preservePaths,this.cwd=A(V.cwd||process.cwd()),this.strict=!!V.strict,this.noPax=!!V.noPax,this.noMtime=!!V.noMtime,this.mtime=V.mtime,this.prefix=V.prefix?A(V.prefix):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let X=!1;if(!this.preservePaths){const[Z,K]=m5(this.path);if(Z&&typeof K==="string")this.path=K,X=Z}if(this.win32=!!V.win32||process.platform==="win32",this.win32)this.path=k1(this.path.replace(/\\/g,"/")),$=$.replace(/\\/g,"/");if(this.absolute=A(V.absolute||E1.resolve(this.cwd,$)),this.path==="")this.path="./";if(X)this.warn("TAR_ENTRY_INFO",`stripping ${X} from absolute path`,{entry:this,path:X+this.path});const J=this.statCache.get(this.absolute);if(J)this[T8](J);else this[r9]()}warn($,Q,V={}){return r0(this,$,Q,V)}emit($,...Q){if($==="error")this.#$=!0;return super.emit($,...Q)}[r9](){L0.lstat(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[T8](Q)})}[T8]($){if(this.statCache.set(this.absolute,$),this.stat=$,!$.isFile())$.size=0;this.type=VX($),this.emit("stat",$),this[b1]()}[b1](){switch(this.type){case"File":return this[m1]();case"Directory":return this[h1]();case"SymbolicLink":return this[o9]();default:return this.end()}}[C8]($){return p9($,this.type==="Directory",this.portable)}[M0]($){return f1($,this.prefix)}[h5](){if(!this.stat)throw new Error("cannot write header before stat");if(this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.header=new a({path:this[M0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[M0](this.linkpath):this.linkpath,mode:this[C8](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 b0({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[M0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[M0](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());const $=this.header?.block;if(!$)throw new Error("failed to encode header");super.write($)}[h1](){if(!this.stat)throw new Error("cannot create directory entry without stat");if(this.path.slice(-1)!=="/")this.path+="/";this.stat.size=0,this[h5](),this.end()}[o9](){L0.readlink(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[e9](Q)})}[e9]($){this.linkpath=A($),this[h5](),this.end()}[u1]($){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=A(E1.relative(this.cwd,$)),this.stat.size=0,this[h5](),this.end()}[m1](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){const $=`${this.stat.dev}:${this.stat.ino}`,Q=this.linkCache.get($);if(Q?.indexOf(this.cwd)===0)return this[u1](Q);this.linkCache.set($,this.absolute)}if(this[h5](),this.stat.size===0)return this.end();this[$$]()}[$$](){L0.open(this.absolute,"r",($,Q)=>{if($)return this.emit("error",$);this[Q$](Q)})}[Q$]($){if(this.fd=$,this.#$)return this[c0]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;const Q=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(Q),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[x8]()}[x8](){const{fd:$,buf:Q,offset:V,length:X,pos:J}=this;if($===void 0||Q===void 0)throw new Error("cannot read file without first opening");L0.read($,Q,V,X,J,(Z,K)=>{if(Z)return this[c0](()=>this.emit("error",Z));this[t9](K)})}[c0]($=()=>{}){if(this.fd!==void 0)L0.close(this.fd,$)}[t9]($){if($<=0&&this.remain>0){const X=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[c0](()=>this.emit("error",X))}if($>this.remain){const X=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[c0](()=>this.emit("error",X))}if(!this.buf)throw new Error("should have created buffer prior to reading");if($===this.remain)for(let X=$;Xthis[s9]());else this[s9]()}[V$]($){this.once("drain",$)}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");if(this.blockRemain<$.length){const X=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",X)}return this.remain-=$.length,this.blockRemain-=$.length,this.pos+=$.length,this.offset+=$.length,super.write($,null,V)}[s9](){if(!this.remain){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));return this[c0](($)=>$?this.emit("error",$):this.end())}if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");if(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[x8]()}}class X$ extends j8{sync=!0;[r9](){this[T8](L0.lstatSync(this.absolute))}[o9](){this[e9](L0.readlinkSync(this.absolute))}[$$](){this[Q$](L0.openSync(this.absolute,"r"))}[x8](){let $=!0;try{const{fd:Q,buf:V,offset:X,length:J,pos:Z}=this;if(Q===void 0||V===void 0)throw new Error("fd and buf must be set in READ method");const K=L0.readSync(Q,V,X,J,Z);this[t9](K),$=!1}finally{if($)try{this[c0](()=>{})}catch(Q){}}}[V$]($){$()}[c0]($=()=>{}){if(this.fd!==void 0)L0.closeSync(this.fd);$()}}class J$ extends c{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;warn($,Q,V={}){return r0(this,$,Q,V)}constructor($,Q={}){const V=g5(Q);super();this.preservePaths=!!V.preservePaths,this.portable=!!V.portable,this.strict=!!V.strict,this.noPax=!!V.noPax,this.noMtime=!!V.noMtime,this.readEntry=$;const{type:X}=$;if(X==="Unsupported")throw new Error("writing entry that should be ignored");if(this.type=X,this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.prefix=V.prefix,this.path=A($.path),this.mode=$.mode!==void 0?this[C8]($.mode):void 0,this.uid=this.portable?void 0:$.uid,this.gid=this.portable?void 0:$.gid,this.uname=this.portable?void 0:$.uname,this.gname=this.portable?void 0:$.gname,this.size=$.size,this.mtime=this.noMtime?void 0:V.mtime||$.mtime,this.atime=this.portable?void 0:$.atime,this.ctime=this.portable?void 0:$.ctime,this.linkpath=$.linkpath!==void 0?A($.linkpath):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let J=!1;if(!this.preservePaths){const[K,G]=m5(this.path);if(K&&typeof G==="string")this.path=G,J=K}if(this.remain=$.size,this.blockRemain=$.startBlockSize,this.header=new a({path:this[M0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[M0](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}),J)this.warn("TAR_ENTRY_INFO",`stripping ${J} from absolute path`,{entry:this,path:J+this.path});if(this.header.encode()&&!this.noPax)super.write(new b0({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[M0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[M0](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());const Z=this.header?.block;if(!Z)throw new Error("failed to encode header");super.write(Z),$.pipe(this)}[M0]($){return f1($,this.prefix)}[C8]($){return p9($,this.type==="Directory",this.portable)}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");const X=$.length;if(X>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=X,super.write($,V)}end($,Q,V){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));if(typeof $==="function")V=$,Q=void 0,$=void 0;if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,Q??"utf8");if(V)this.once("finish",V);return $?super.end($,V):super.end(V),this}}var VX=($)=>$.isFile()?"File":$.isDirectory()?"Directory":$.isSymbolicLink()?"SymbolicLink":"Unsupported";import p1 from"path";class Y${path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor($,Q){this.path=$||"./",this.absolute=Q}}var c1=Buffer.alloc(1024),D8=Symbol("onStat"),u5=Symbol("ended"),J0=Symbol("queue"),F5=Symbol("current"),V5=Symbol("process"),f5=Symbol("processing"),l1=Symbol("processJob"),Z0=Symbol("jobs"),Z$=Symbol("jobDone"),N8=Symbol("addFSEntry"),d1=Symbol("addTarEntry"),z$=Symbol("stat"),W$=Symbol("readdir"),S8=Symbol("onreaddir"),_8=Symbol("pipe"),i1=Symbol("entry"),K$=Symbol("entryOpt"),R8=Symbol("writeEntryClass"),a1=Symbol("write"),G$=Symbol("ondrain");class X5 extends c{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[R8];onWriteEntry;[J0];[Z0]=0;[f5]=!1;[u5]=!1;constructor($={}){super();if(this.opt=$,this.file=$.file||"",this.cwd=$.cwd||process.cwd(),this.maxReadSize=$.maxReadSize,this.preservePaths=!!$.preservePaths,this.strict=!!$.strict,this.noPax=!!$.noPax,this.prefix=A($.prefix||""),this.linkCache=$.linkCache||new Map,this.statCache=$.statCache||new Map,this.readdirCache=$.readdirCache||new Map,this.onWriteEntry=$.onWriteEntry,this[R8]=j8,typeof $.onwarn==="function")this.on("warn",$.onwarn);if(this.portable=!!$.portable,$.gzip||$.brotli){if($.gzip&&$.brotli)throw new TypeError("gzip and brotli are mutually exclusive");if($.gzip){if(typeof $.gzip!=="object")$.gzip={};if(this.portable)$.gzip.portable=!0;this.zip=new g9($.gzip)}if($.brotli){if(typeof $.brotli!=="object")$.brotli={};this.zip=new E9($.brotli)}if(!this.zip)throw new Error("impossible");const Q=this.zip;Q.on("data",(V)=>super.write(V)),Q.on("end",()=>super.end()),Q.on("drain",()=>this[G$]()),this.on("resume",()=>Q.resume())}else this.on("drain",this[G$]);if(this.noDirRecurse=!!$.noDirRecurse,this.follow=!!$.follow,this.noMtime=!!$.noMtime,$.mtime)this.mtime=$.mtime;this.filter=typeof $.filter==="function"?$.filter:()=>!0,this[J0]=new W0,this[Z0]=0,this.jobs=Number($.jobs)||4,this[f5]=!1,this[u5]=!1}[a1]($){return super.write($)}add($){return this.write($),this}end($){if($)this.add($);return this[u5]=!0,this[V5](),this}write($){if(this[u5])throw new Error("write after end");if($ instanceof y5)this[d1]($);else this[N8]($);return this.flowing}[d1]($){const Q=A(p1.resolve(this.cwd,$.path));if(!this.filter($.path,$))$.resume();else{const V=new Y$($.path,Q);V.entry=new J$($,this[K$](V)),V.entry.on("end",()=>this[Z$](V)),this[Z0]+=1,this[J0].push(V)}this[V5]()}[N8]($){const Q=A(p1.resolve(this.cwd,$));this[J0].push(new Y$($,Q)),this[V5]()}[z$]($){$.pending=!0,this[Z0]+=1;const Q=this.follow?"stat":"lstat";g8[Q]($.absolute,(V,X)=>{if($.pending=!1,this[Z0]-=1,V)this.emit("error",V);else this[D8]($,X)})}[D8]($,Q){if(this.statCache.set($.absolute,Q),$.stat=Q,!this.filter($.path,Q))$.ignore=!0;this[V5]()}[W$]($){$.pending=!0,this[Z0]+=1,g8.readdir($.absolute,(Q,V)=>{if($.pending=!1,this[Z0]-=1,Q)return this.emit("error",Q);this[S8]($,V)})}[S8]($,Q){this.readdirCache.set($.absolute,Q),$.readdir=Q,this[V5]()}[V5](){if(this[f5])return;this[f5]=!0;for(let $=this[J0].head;!!$&&this[Z0]this.warn(Q,V,X),noPax:this.noPax,cwd:this.cwd,absolute:$.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}}[i1]($){this[Z0]+=1;try{const Q=new this[R8]($.path,this[K$]($));return this.onWriteEntry?.(Q),Q.on("end",()=>this[Z$]($)).on("error",(V)=>this.emit("error",V))}catch(Q){this.emit("error",Q)}}[G$](){if(this[F5]&&this[F5].entry)this[F5].entry.resume()}[_8]($){if($.piped=!0,$.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[N8](Z+X)});const Q=$.entry,V=this.zip;if(!Q)throw new Error("cannot pipe without source");if(V)Q.on("data",(X)=>{if(!V.write(X))Q.pause()});else Q.on("data",(X)=>{if(!super.write(X))Q.pause()})}pause(){if(this.zip)this.zip.pause();return super.pause()}warn($,Q,V={}){r0(this,$,Q,V)}}class H5 extends X5{sync=!0;constructor($){super($);this[R8]=X$}pause(){}resume(){}[z$]($){const Q=this.follow?"statSync":"lstatSync";this[D8]($,g8[Q]($.absolute))}[W$]($){this[S8]($,g8.readdirSync($.absolute))}[_8]($){const Q=$.entry,V=this.zip;if($.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[N8](Z+X)});if(!Q)throw new Error("Cannot pipe without source");if(V)Q.on("data",(X)=>{V.write(X)});else Q.on("data",(X)=>{super[a1](X)})}}var XX=($,Q)=>{const V=new H5($),X=new R5($.file,{mode:$.mode||438});V.pipe(X),s1(V,Q)},JX=($,Q)=>{const V=new X5($),X=new g0($.file,{mode:$.mode||438});V.pipe(X);const J=new Promise((Z,K)=>{X.on("error",K),X.on("close",Z),V.on("error",K)});return o1(V,Q),J},s1=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")Q5({file:n1.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},o1=async($,Q)=>{for(let V=0;V{$.add(J)}});else $.add(X)}$.end()},ZX=($,Q)=>{const V=new H5($);return s1(V,Q),V},KX=($,Q)=>{const V=new X5($);return o1(V,Q),V},GX=z0(XX,JX,ZX,KX,($,Q)=>{if(!Q?.length)throw new TypeError("no paths specified to add to archive")});import F4 from"node:fs";import kX from"node:assert";import{randomBytes as w4}from"node:crypto";import I from"node:fs";import C0 from"node:path";import r1 from"fs";var YX=process.env.__FAKE_PLATFORM__||process.platform,zX=YX==="win32",{O_CREAT:WX,O_TRUNC:qX,O_WRONLY:BX}=r1.constants,t1=Number(process.env.__FAKE_FS_O_FILENAME__)||r1.constants.UV_FS_O_FILEMAP||0,LX=zX&&!!t1,MX=524288,AX=t1|qX|WX|BX,q$=!LX?()=>"w":($)=>${try{return y8.lchownSync($,Q,V)}catch(X){if(X?.code!=="ENOENT")throw X}},k8=($,Q,V,X)=>{y8.lchown($,Q,V,(J)=>{X(J&&J?.code!=="ENOENT"?J:null)})},IX=($,Q,V,X,J)=>{if(Q.isDirectory())L$(c5.resolve($,Q.name),V,X,(Z)=>{if(Z)return J(Z);const K=c5.resolve($,Q.name);k8(K,V,X,J)});else{const Z=c5.resolve($,Q.name);k8(Z,V,X,J)}},L$=($,Q,V,X)=>{y8.readdir($,{withFileTypes:!0},(J,Z)=>{if(J){if(J.code==="ENOENT")return X();else if(J.code!=="ENOTDIR"&&J.code!=="ENOTSUP")return X(J)}if(J||!Z.length)return k8($,Q,V,X);let K=Z.length,G=null;const Y=(W)=>{if(G)return;if(W)return X(G=W);if(--K===0)return k8($,Q,V,X)};for(let W of Z)IX($,W,Q,V,Y)})},wX=($,Q,V,X)=>{if(Q.isDirectory())M$(c5.resolve($,Q.name),V,X);B$(c5.resolve($,Q.name),V,X)},M$=($,Q,V)=>{let X;try{X=y8.readdirSync($,{withFileTypes:!0})}catch(J){const Z=J;if(Z?.code==="ENOENT")return;else if(Z?.code==="ENOTDIR"||Z?.code==="ENOTSUP")return B$($,Q,V);else throw Z}for(let J of X)wX($,J,Q,V);return B$($,Q,V)};import o from"fs";import{dirname as e1}from"path";import{mkdir as FX,mkdirSync as HX,stat as PX,statSync as vX}from"fs";var s=($)=>{if(!$)$={mode:511};else if(typeof $==="object")$={mode:511,...$};else if(typeof $==="number")$={mode:$};else if(typeof $==="string")$={mode:parseInt($,8)};else throw new TypeError("invalid options argument");const Q=$,V=$.fs||{};return $.mkdir=$.mkdir||V.mkdir||FX,$.mkdirAsync=$.mkdirAsync?$.mkdirAsync:async(X,J)=>{return new Promise((Z,K)=>Q.mkdir(X,J,(G,Y)=>G?K(G):Z(Y)))},$.stat=$.stat||V.stat||PX,$.statAsync=$.statAsync?$.statAsync:async(X)=>new Promise((J,Z)=>Q.stat(X,(K,G)=>K?Z(K):J(G))),$.statSync=$.statSync||V.statSync||vX,$.mkdirSync=$.mkdirSync||V.mkdirSync||HX,Q};var A0=($,Q,V)=>{const X=e1($),J={...s(Q),recursive:!1};if(X===$)try{return J.mkdirSync($,J)}catch(Z){const K=Z;if(K&&K.code!=="EISDIR")throw Z;return}try{return J.mkdirSync($,J),V||$}catch(Z){const K=Z;if(K&&K.code==="ENOENT")return A0($,J,A0(X,J,V));if(K&&K.code!=="EEXIST"&&K&&K.code!=="EROFS")throw Z;try{if(!J.statSync($).isDirectory())throw Z}catch(G){throw Z}}},T0=Object.assign(async($,Q,V)=>{const X=s(Q);X.recursive=!1;const J=e1($);if(J===$)return X.mkdirAsync($,X).catch((Z)=>{const K=Z;if(K&&K.code!=="EISDIR")throw Z});return X.mkdirAsync($,X).then(()=>V||$,async(Z)=>{const K=Z;if(K&&K.code==="ENOENT")return T0(J,X).then((G)=>T0($,X,G));if(K&&K.code!=="EEXIST"&&K.code!=="EROFS")throw Z;return X.statAsync($).then((G)=>{if(G.isDirectory())return V;else throw Z},()=>{throw Z})})},{sync:A0});import{dirname as Q4}from"path";import{dirname as $4}from"path";var A$=async($,Q,V)=>{if(V===Q)return;return $.statAsync(Q).then((X)=>X.isDirectory()?V:void 0,(X)=>{const J=X;return J&&J.code==="ENOENT"?A$($,$4(Q),Q):void 0})},I$=($,Q,V)=>{if(V===Q)return;try{return $.statSync(Q).isDirectory()?V:void 0}catch(X){const J=X;return J&&J.code==="ENOENT"?I$($,$4(Q),Q):void 0}};var P5=($,Q)=>{const V=s(Q);if(V.recursive=!0,Q4($)===$)return V.mkdirSync($,V);const J=I$(V,$);try{return V.mkdirSync($,V),J}catch(Z){const K=Z;if(K&&K.code==="ENOENT")return A0($,V);else throw Z}},l5=Object.assign(async($,Q)=>{const V={...s(Q),recursive:!0};if(Q4($)===$)return await V.mkdirAsync($,V);return A$(V,$).then((J)=>V.mkdirAsync($,V).then((Z)=>J||Z).catch((Z)=>{const K=Z;if(K&&K.code==="ENOENT")return T0($,V);else throw Z}))},{sync:P5});import{parse as UX,resolve as xX}from"path";var OX=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,w$=($)=>{if(/\0/.test($))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:$,code:"ERR_INVALID_ARG_VALUE"});if($=xX($),OX==="win32"){const Q=/[*|"<>?:]/,{root:V}=UX($);if(Q.test($.substring(V.length)))throw Object.assign(new Error("Illegal characters in path."),{path:$,code:"EINVAL"})}return $};import{mkdir as TX,mkdirSync as CX}from"fs";var jX=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,F$=jX.replace(/^v/,"").split("."),V4=+F$[0]>10||+F$[0]===10&&+F$[1]>=12,d5=!V4?()=>!1:($)=>s($).mkdirSync===CX,E8=Object.assign(!V4?()=>!1:($)=>s($).mkdir===TX,{sync:d5});var b8=($,Q)=>{$=w$($);const V=s(Q);return d5(V)?P5($,V):A0($,V)};var X4=Object.assign(async($,Q)=>{$=w$($);const V=s(Q);return E8(V)?l5($,V):T0($,V)},{mkdirpSync:b8,mkdirpNative:l5,mkdirpNativeSync:P5,mkdirpManual:T0,mkdirpManualSync:A0,sync:b8,native:l5,nativeSync:P5,manual:T0,manualSync:A0,useNative:E8,useNativeSync:d5});import u8 from"node:path";class m8 extends Error{path;code;syscall="chdir";constructor($,Q){super(`${Q}: Cannot cd into '${$}'`);this.path=$,this.code=Q}get name(){return"CwdError"}}class h8 extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor($,Q){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");this.symlink=$,this.path=Q}get name(){return"SymlinkError"}}var f8=($,Q)=>$.get(A(Q)),i5=($,Q,V)=>$.set(A(Q),V),DX=($,Q)=>{o.stat($,(V,X)=>{if(V||!X.isDirectory())V=new m8($,V?.code||"ENOTDIR");Q(V)})},J4=($,Q,V)=>{$=A($);const X=Q.umask??18,J=Q.mode|448,Z=(J&X)!==0,K=Q.uid,G=Q.gid,Y=typeof K==="number"&&typeof G==="number"&&(K!==Q.processUid||G!==Q.processGid),W=Q.preserve,z=Q.unlink,q=Q.cache,M=A(Q.cwd),O=(N,x)=>{if(N)V(N);else if(i5(q,$,!0),x&&Y)L$(x,K,G,(_$)=>O(_$));else if(Z)o.chmod($,J,V);else V()};if(q&&f8(q,$)===!0)return O();if($===M)return DX($,O);if(W)return X4($,{mode:J}).then((N)=>O(null,N??void 0),O);const v=A(u8.relative(M,$)).split("/");c8(M,v,J,q,z,M,void 0,O)},c8=($,Q,V,X,J,Z,K,G)=>{if(!Q.length)return G(null,K);const Y=Q.shift(),W=A(u8.resolve($+"/"+Y));if(f8(X,W))return c8(W,Q,V,X,J,Z,K,G);o.mkdir(W,V,Z4(W,Q,V,X,J,Z,K,G))},Z4=($,Q,V,X,J,Z,K,G)=>(Y)=>{if(Y)o.lstat($,(W,z)=>{if(W)W.path=W.path&&A(W.path),G(W);else if(z.isDirectory())c8($,Q,V,X,J,Z,K,G);else if(J)o.unlink($,(q)=>{if(q)return G(q);o.mkdir($,V,Z4($,Q,V,X,J,Z,K,G))});else if(z.isSymbolicLink())return G(new h8($,$+"/"+Q.join("/")));else G(Y)});else K=K||$,c8($,Q,V,X,J,Z,K,G)},NX=($)=>{let Q=!1,V=void 0;try{Q=o.statSync($).isDirectory()}catch(X){V=X?.code}finally{if(!Q)throw new m8($,V??"ENOTDIR")}},K4=($,Q)=>{$=A($);const V=Q.umask??18,X=Q.mode|448,J=(X&V)!==0,Z=Q.uid,K=Q.gid,G=typeof Z==="number"&&typeof K==="number"&&(Z!==Q.processUid||K!==Q.processGid),Y=Q.preserve,W=Q.unlink,z=Q.cache,q=A(Q.cwd),M=(N)=>{if(i5(z,$,!0),N&&G)M$(N,Z,K);if(J)o.chmodSync($,X)};if(z&&f8(z,$)===!0)return M();if($===q)return NX(q),M();if(Y)return M(b8($,X)??void 0);const U=A(u8.relative(q,$)).split("/");let v=void 0;for(let N=U.shift(),x=q;N&&(x+="/"+N);N=U.shift()){if(x=A(u8.resolve(x)),f8(z,x))continue;try{o.mkdirSync(x,X),v=v||x,i5(z,x,!0)}catch(_$){const R$=o.lstatSync(x);if(R$.isDirectory()){i5(z,x,!0);continue}else if(W){o.unlinkSync(x),o.mkdirSync(x,X),v=v||x,i5(z,x,!0);continue}else if(R$.isSymbolicLink())return new h8(x,x+"/"+U.join("/"))}}return M(v)};var H$=Object.create(null),{hasOwnProperty:SX}=Object.prototype,l8=($)=>{if(!SX.call(H$,$))H$[$]=$.normalize("NFD");return H$[$]};import{join as G4}from"node:path";var _X=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,RX=_X==="win32",gX=($)=>{return $.split("/").slice(0,-1).reduce((V,X)=>{const J=V[V.length-1];if(J!==void 0)X=G4(J,X);return V.push(X||"/"),V},[])};class P${#$=new Map;#V=new Map;#X=new Set;reserve($,Q){$=RX?["win32 parallelization disabled"]:$.map((X)=>{return B0(G4(l8(X))).toLowerCase()});const V=new Set($.map((X)=>gX(X)).reduce((X,J)=>X.concat(J)));this.#V.set(Q,{dirs:V,paths:$});for(let X of $){const J=this.#$.get(X);if(!J)this.#$.set(X,[Q]);else J.push(Q)}for(let X of V){const J=this.#$.get(X);if(!J)this.#$.set(X,[new Set([Q])]);else{const Z=J[J.length-1];if(Z instanceof Set)Z.add(Q);else J.push(new Set([Q]))}}return this.#J(Q)}#Z($){const Q=this.#V.get($);if(!Q)throw new Error("function does not have any path reservations");return{paths:Q.paths.map((V)=>this.#$.get(V)),dirs:[...Q.dirs].map((V)=>this.#$.get(V))}}check($){const{paths:Q,dirs:V}=this.#Z($);return Q.every((X)=>X&&X[0]===$)&&V.every((X)=>X&&X[0]instanceof Set&&X[0].has($))}#J($){if(this.#X.has($)||!this.check($))return!1;return this.#X.add($),$(()=>this.#Q($)),!0}#Q($){if(!this.#X.has($))return!1;const Q=this.#V.get($);if(!Q)throw new Error("invalid reservation");const{paths:V,dirs:X}=Q,J=new Set;for(let Z of V){const K=this.#$.get(Z);if(!K||K?.[0]!==$)continue;const G=K[1];if(!G){this.#$.delete(Z);continue}if(K.shift(),typeof G==="function")J.add(G);else for(let Y of G)J.add(Y)}for(let Z of X){const K=this.#$.get(Z),G=K?.[0];if(!K||!(G instanceof Set))continue;if(G.size===1&&K.length===1){this.#$.delete(Z);continue}else if(G.size===1){K.shift();const Y=K[0];if(typeof Y==="function")J.add(Y)}else G.delete($)}return this.#X.delete($),J.forEach((Z)=>this.#J(Z)),!0}}var Y4=Symbol("onEntry"),U$=Symbol("checkFs"),z4=Symbol("checkFs2"),p8=Symbol("pruneCache"),x$=Symbol("isReusable"),r=Symbol("makeFs"),T$=Symbol("file"),C$=Symbol("directory"),a8=Symbol("link"),W4=Symbol("symlink"),q4=Symbol("hardlink"),B4=Symbol("unsupported"),L4=Symbol("checkPath"),l0=Symbol("mkdir"),y=Symbol("onError"),d8=Symbol("pending"),M4=Symbol("pend"),v5=Symbol("unpend"),v$=Symbol("ended"),O$=Symbol("maybeClose"),j$=Symbol("skip"),p5=Symbol("doChown"),a5=Symbol("uid"),n5=Symbol("gid"),s5=Symbol("checkedCwd"),yX=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,o5=yX==="win32",EX=1024,bX=($,Q)=>{if(!o5)return I.unlink($,Q);const V=$+".DELETE."+w4(16).toString("hex");I.rename($,V,(X)=>{if(X)return Q(X);I.unlink(V,Q)})},mX=($)=>{if(!o5)return I.unlinkSync($);const Q=$+".DELETE."+w4(16).toString("hex");I.renameSync($,Q),I.unlinkSync(Q)},A4=($,Q,V)=>$!==void 0&&$===$>>>0?$:Q!==void 0&&Q===Q>>>0?Q:V,I4=($)=>B0(A(l8($))).toLowerCase(),hX=($,Q)=>{Q=I4(Q);for(let V of $.keys()){const X=I4(V);if(X===Q||X.indexOf(Q+"/")===0)$.delete(V)}},uX=($)=>{for(let Q of $.keys())$.delete(Q)};class r5 extends f0{[v$]=!1;[s5]=!1;[d8]=0;reservations=new P$;transform;writable=!0;readable=!1;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor($={}){$.ondone=()=>{this[v$]=!0,this[O$]()};super($);if(this.transform=$.transform,this.dirCache=$.dirCache||new Map,this.chmod=!!$.chmod,typeof $.uid==="number"||typeof $.gid==="number"){if(typeof $.uid!=="number"||typeof $.gid!=="number")throw new TypeError("cannot set owner without number uid and gid");if($.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=$.uid,this.gid=$.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;if($.preserveOwner===void 0&&typeof $.uid!=="number")this.preserveOwner=!!(process.getuid&&process.getuid()===0);else this.preserveOwner=!!$.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 $.maxDepth==="number"?$.maxDepth:EX,this.forceChown=$.forceChown===!0,this.win32=!!$.win32||o5,this.newer=!!$.newer,this.keep=!!$.keep,this.noMtime=!!$.noMtime,this.preservePaths=!!$.preservePaths,this.unlink=!!$.unlink,this.cwd=A(C0.resolve($.cwd||process.cwd())),this.strip=Number($.strip)||0,this.processUmask=!this.chmod?0:typeof $.processUmask==="number"?$.processUmask:process.umask(),this.umask=typeof $.umask==="number"?$.umask:this.processUmask,this.dmode=$.dmode||511&~this.umask,this.fmode=$.fmode||438&~this.umask,this.on("entry",(Q)=>this[Y4](Q))}warn($,Q,V={}){if($==="TAR_BAD_ARCHIVE"||$==="TAR_ABORT")V.recoverable=!1;return super.warn($,Q,V)}[O$](){if(this[v$]&&this[d8]===0)this.emit("prefinish"),this.emit("finish"),this.emit("end")}[L4]($){const Q=A($.path),V=Q.split("/");if(this.strip){if(V.length=this.strip)$.linkpath=X.slice(this.strip).join("/");else return!1}V.splice(0,this.strip),$.path=V.join("/")}if(isFinite(this.maxDepth)&&V.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:$,path:Q,depth:V.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(V.includes("..")||o5&&/^[a-z]:\.\.$/i.test(V[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:$,path:Q}),!1;const[X,J]=m5(Q);if(X)$.path=String(J),this.warn("TAR_ENTRY_INFO",`stripping ${X} from absolute path`,{entry:$,path:Q})}if(C0.isAbsolute($.path))$.absolute=A(C0.resolve($.path));else $.absolute=A(C0.resolve(this.cwd,$.path));if(!this.preservePaths&&typeof $.absolute==="string"&&$.absolute.indexOf(this.cwd+"/")!==0&&$.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:$,path:A($.path),resolvedPath:$.absolute,cwd:this.cwd}),!1;if($.absolute===this.cwd&&$.type!=="Directory"&&$.type!=="GNUDumpDir")return!1;if(this.win32){const{root:X}=C0.win32.parse(String($.absolute));$.absolute=X+n9(String($.absolute).slice(X.length));const{root:J}=C0.win32.parse($.path);$.path=J+n9($.path.slice(J.length))}return!0}[Y4]($){if(!this[L4]($))return $.resume();switch(kX.equal(typeof $.absolute,"string"),$.type){case"Directory":case"GNUDumpDir":if($.mode)$.mode=$.mode|448;case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[U$]($);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[B4]($)}}[y]($,Q){if($.name==="CwdError")this.emit("error",$);else this.warn("TAR_ENTRY_ERROR",$,{entry:Q}),this[v5](),Q.resume()}[l0]($,Q,V){J4(A($),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:Q},V)}[p5]($){return this.forceChown||this.preserveOwner&&(typeof $.uid==="number"&&$.uid!==this.processUid||typeof $.gid==="number"&&$.gid!==this.processGid)||typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid}[a5]($){return A4(this.uid,$.uid,this.processUid)}[n5]($){return A4(this.gid,$.gid,this.processGid)}[T$]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=new g0(String($.absolute),{flags:q$($.size),mode:V,autoClose:!1});X.on("error",(G)=>{if(X.fd)I.close(X.fd,()=>{});X.write=()=>!0,this[y](G,$),Q()});let J=1;const Z=(G)=>{if(G){if(X.fd)I.close(X.fd,()=>{});this[y](G,$),Q();return}if(--J===0){if(X.fd!==void 0)I.close(X.fd,(Y)=>{if(Y)this[y](Y,$);else this[v5]();Q()})}};X.on("finish",()=>{const G=String($.absolute),Y=X.fd;if(typeof Y==="number"&&$.mtime&&!this.noMtime){J++;const W=$.atime||new Date,z=$.mtime;I.futimes(Y,W,z,(q)=>q?I.utimes(G,W,z,(M)=>Z(M&&q)):Z())}if(typeof Y==="number"&&this[p5]($)){J++;const W=this[a5]($),z=this[n5]($);if(typeof W==="number"&&typeof z==="number")I.fchown(Y,W,z,(q)=>q?I.chown(G,W,z,(M)=>Z(M&&q)):Z())}Z()});const K=this.transform?this.transform($)||$:$;if(K!==$)K.on("error",(G)=>{this[y](G,$),Q()}),$.pipe(K);K.pipe(X)}[C$]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode;this[l0](String($.absolute),V,(X)=>{if(X){this[y](X,$),Q();return}let J=1;const Z=()=>{if(--J===0)Q(),this[v5](),$.resume()};if($.mtime&&!this.noMtime)J++,I.utimes(String($.absolute),$.atime||new Date,$.mtime,Z);if(this[p5]($))J++,I.chown(String($.absolute),Number(this[a5]($)),Number(this[n5]($)),Z);Z()})}[B4]($){$.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${$.type}`,{entry:$}),$.resume()}[W4]($,Q){this[a8]($,String($.linkpath),"symlink",Q)}[q4]($,Q){const V=A(C0.resolve(this.cwd,String($.linkpath)));this[a8]($,V,"link",Q)}[M4](){this[d8]++}[v5](){this[d8]--,this[O$]()}[j$]($){this[v5](),$.resume()}[x$]($,Q){return $.type==="File"&&!this.unlink&&Q.isFile()&&Q.nlink<=1&&!o5}[U$]($){this[M4]();const Q=[$.path];if($.linkpath)Q.push($.linkpath);this.reservations.reserve(Q,(V)=>this[z4]($,V))}[p8]($){if($.type==="SymbolicLink")uX(this.dirCache);else if($.type!=="Directory")hX(this.dirCache,String($.absolute))}[z4]($,Q){this[p8]($);const V=(K)=>{this[p8]($),Q(K)},X=()=>{this[l0](this.cwd,this.dmode,(K)=>{if(K){this[y](K,$),V();return}this[s5]=!0,J()})},J=()=>{if($.absolute!==this.cwd){const K=A(C0.dirname(String($.absolute)));if(K!==this.cwd)return this[l0](K,this.dmode,(G)=>{if(G){this[y](G,$),V();return}Z()})}Z()},Z=()=>{I.lstat(String($.absolute),(K,G)=>{if(G&&(this.keep||this.newer&&G.mtime>($.mtime??G.mtime))){this[j$]($),V();return}if(K||this[x$]($,G))return this[r](null,$,V);if(G.isDirectory()){if($.type==="Directory"){const Y=this.chmod&&$.mode&&(G.mode&4095)!==$.mode,W=(z)=>this[r](z??null,$,V);if(!Y)return W();return I.chmod(String($.absolute),Number($.mode),W)}if($.absolute!==this.cwd)return I.rmdir(String($.absolute),(Y)=>this[r](Y??null,$,V))}if($.absolute===this.cwd)return this[r](null,$,V);bX(String($.absolute),(Y)=>this[r](Y??null,$,V))})};if(this[s5])J();else X()}[r]($,Q,V){if($){this[y]($,Q),V();return}switch(Q.type){case"File":case"OldFile":case"ContiguousFile":return this[T$](Q,V);case"Link":return this[q4](Q,V);case"SymbolicLink":return this[W4](Q,V);case"Directory":case"GNUDumpDir":return this[C$](Q,V)}}[a8]($,Q,V,X){I[V](Q,String($.absolute),(J)=>{if(J)this[y](J,$);else this[v5](),$.resume();X()})}}var i8=($)=>{try{return[null,$()]}catch(Q){return[Q,null]}};class n8 extends r5{sync=!0;[r]($,Q){return super[r]($,Q,()=>{})}[U$]($){if(this[p8]($),!this[s5]){const J=this[l0](this.cwd,this.dmode);if(J)return this[y](J,$);this[s5]=!0}if($.absolute!==this.cwd){const J=A(C0.dirname(String($.absolute)));if(J!==this.cwd){const Z=this[l0](J,this.dmode);if(Z)return this[y](Z,$)}}const[Q,V]=i8(()=>I.lstatSync(String($.absolute)));if(V&&(this.keep||this.newer&&V.mtime>($.mtime??V.mtime)))return this[j$]($);if(Q||this[x$]($,V))return this[r](null,$);if(V.isDirectory()){if($.type==="Directory"){const Z=this.chmod&&$.mode&&(V.mode&4095)!==$.mode,[K]=Z?i8(()=>{I.chmodSync(String($.absolute),Number($.mode))}):[];return this[r](K,$)}const[J]=i8(()=>I.rmdirSync(String($.absolute)));this[r](J,$)}const[X]=$.absolute===this.cwd?[]:i8(()=>mX(String($.absolute)));this[r](X,$)}[T$]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=(K)=>{let G;try{I.closeSync(J)}catch(Y){G=Y}if(K||G)this[y](K||G,$);Q()};let J;try{J=I.openSync(String($.absolute),q$($.size),V)}catch(K){return X(K)}const Z=this.transform?this.transform($)||$:$;if(Z!==$)Z.on("error",(K)=>this[y](K,$)),$.pipe(Z);Z.on("data",(K)=>{try{I.writeSync(J,K,0,K.length)}catch(G){X(G)}}),Z.on("end",()=>{let K=null;if($.mtime&&!this.noMtime){const G=$.atime||new Date,Y=$.mtime;try{I.futimesSync(J,G,Y)}catch(W){try{I.utimesSync(String($.absolute),G,Y)}catch(z){K=W}}}if(this[p5]($)){const G=this[a5]($),Y=this[n5]($);try{I.fchownSync(J,Number(G),Number(Y))}catch(W){try{I.chownSync(String($.absolute),Number(G),Number(Y))}catch(z){K=K||W}}}X(K)})}[C$]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode,X=this[l0](String($.absolute),V);if(X){this[y](X,$),Q();return}if($.mtime&&!this.noMtime)try{I.utimesSync(String($.absolute),$.atime||new Date,$.mtime)}catch(J){}if(this[p5]($))try{I.chownSync(String($.absolute),Number(this[a5]($)),Number(this[n5]($)))}catch(J){}Q(),$.resume()}[l0]($,Q){try{return K4(A($),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:Q})}catch(V){return V}}[a8]($,Q,V,X){const J=`${V}Sync`;try{I[J](Q,String($.absolute)),X(),$.resume()}catch(Z){return this[y](Z,$)}}}var fX=($)=>{const Q=new n8($),V=$.file,X=F4.statSync(V),J=$.maxReadSize||16777216;new j9(V,{readSize:J,size:X.size}).pipe(Q)},cX=($,Q)=>{const V=new r5($),X=$.maxReadSize||16777216,J=$.file;return new Promise((K,G)=>{V.on("error",G),V.on("close",K),F4.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M5(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},D$=z0(fX,cX,($)=>new n8($),($)=>new r5($),($,Q)=>{if(Q?.length)i9($,Q)});import l from"node:fs";import H4 from"node:path";var lX=($,Q)=>{const V=new H5($);let X=!0,J,Z;try{try{J=l.openSync($.file,"r+")}catch(Y){if(Y?.code==="ENOENT")J=l.openSync($.file,"w+");else throw Y}const K=l.fstatSync(J),G=Buffer.alloc(512);$:for(Z=0;ZK.size)break;if(Z+=W,$.mtimeCache&&Y.mtime)$.mtimeCache.set(String(Y.path),Y.mtime)}X=!1,dX($,V,Z,J,Q)}finally{if(X)try{l.closeSync(J)}catch(K){}}},dX=($,Q,V,X,J)=>{const Z=new R5($.file,{fd:X,start:V});Q.pipe(Z),pX(Q,J)},iX=($,Q)=>{Q=Array.from(Q);const V=new X5($),X=(Z,K,G)=>{const Y=(O,U)=>{if(O)l.close(Z,(v)=>G(O));else G(null,U)};let W=0;if(K===0)return Y(null,0);let z=0;const q=Buffer.alloc(512),M=(O,U)=>{if(O||typeof U==="undefined")return Y(O);if(z+=U,z<512&&U)return l.read(Z,q,z,q.length-z,W+z,M);if(W===0&&q[0]===31&&q[1]===139)return Y(new Error("cannot append to compressed archives"));if(z<512)return Y(null,W);const v=new a(q);if(!v.cksumValid)return Y(null,W);const N=512*Math.ceil((v.size??0)/512);if(W+N+512>K)return Y(null,W);if(W+=N+512,W>=K)return Y(null,W);if($.mtimeCache&&v.mtime)$.mtimeCache.set(String(v.path),v.mtime);z=0,l.read(Z,q,0,512,W,M)};l.read(Z,q,0,512,W,M)};return new Promise((Z,K)=>{V.on("error",K);let G="r+";const Y=(W,z)=>{if(W&&W.code==="ENOENT"&&G==="r+")return G="w+",l.open($.file,G,Y);if(W||!z)return K(W);l.fstat(z,(q,M)=>{if(q)return l.close(z,()=>K(q));X(z,M.size,(O,U)=>{if(O)return K(O);const v=new g0($.file,{fd:z,start:U});V.pipe(v),v.on("error",K),v.on("close",Z),aX(V,Q)})})};l.open($.file,G,Y)})},pX=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")Q5({file:H4.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},aX=async($,Q)=>{for(let V=0;V$.add(J)});else $.add(X)}$.end()},J5=z0(lX,iX,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},($,Q)=>{if(!P1($))throw new TypeError("file is required");if($.gzip||$.brotli||$.file.endsWith(".br")||$.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!Q?.length)throw new TypeError("no paths specified to add/replace")});var nX=z0(J5.syncFile,J5.asyncFile,J5.syncNoFile,J5.asyncNoFile,($,Q=[])=>{J5.validate?.($,Q),sX($)}),sX=($)=>{const Q=$.filter;if(!$.mtimeCache)$.mtimeCache=new Map;$.filter=Q?(V,X)=>Q(V,X)&&!(($.mtimeCache?.get(V)??X.mtime??0)>(X.mtime??0)):(V,X)=>!(($.mtimeCache?.get(V)??X.mtime??0)>(X.mtime??0))};import eX from"os";async function $J($,Q,V){L.info(`Starting download from URL: ${$}`);const X=S$(__dirname,"../package.json");let J;try{J=await t.readFile(X,"utf-8")}catch(z){throw L.error(`Failed to read package.json from ${X}`),new Error(`Failed to read package.json: ${z}`)}let Z;try{Z=JSON.parse(J)}catch(z){throw L.error(`Failed to parse package.json: ${z}`),new Error(`Failed to parse package.json: ${z}`)}const K=`beat-forge/init-beatsaber@${Z.version}`;L.debug(`User-Agent: ${K}`);const G=new Headers({"User-Agent":K,Accept:"application/octet-stream"});if(V)G.set("Authorization",`token ${V}`);let Y;try{Y=await fetch($,{headers:G})}catch(z){throw L.error(`Network error while fetching ${$}: ${z}`),new Error(`Network error: ${z}`)}if(L.info(`Response status: ${Y.status} ${Y.statusText}`),!Y.ok){const z=await Y.text().catch(()=>"No response body");throw L.error(`Failed to download file: ${Y.statusText}`),L.debug(`Error response body: ${z}`),new Error(`Failed to download file: ${Y.status} ${Y.statusText}`)}try{await t.mkdir(N$(Q),{recursive:!0}),L.debug(`Created directory for output path: ${N$(Q)}`)}catch(z){throw L.error(`Failed to create directory ${N$(Q)}: ${z}`),z}const W=rX(Q);if(L.info("Starting to read and write file stream"),Y.body)try{await tX(Y.body,W)}catch(z){throw L.error(`Error during file stream pipeline: ${z}`),z}else throw new Error("Response body is null");L.info("File downloaded and written successfully")}async function QJ($,Q){L.info(`Extracting tarball from ${$} to ${Q}`);try{await t.mkdir(Q,{recursive:!0}),await D$({file:$,cwd:Q,strip:1}),L.info("Tarball extraction completed successfully")}catch(V){throw L.error(`Failed to extract tarball from ${$} to ${Q}: ${V}`),V}}async function P4($,Q){L.info(`Moving contents from ${$} to ${Q}`);try{await t.mkdir(Q,{recursive:!0});const V=await t.readdir($,{withFileTypes:!0});L.debug(`Entries to move: ${V.map((X)=>X.name).join(", ")}`);for(let X of V){const J=O5($,X.name),Z=O5(Q,X.name);if(X.isDirectory())await P4(J,Z);else try{await t.rename(J,Z),L.debug(`Renamed ${J} to ${Z}`)}catch(K){L.debug(`Rename failed for ${J}. Attempting to copy and delete.`),await t.copyFile(J,Z),await t.unlink(J),L.debug(`Copied and deleted ${J} to ${Z}`)}}L.info("Content move completed successfully")}catch(V){throw L.error(`Failed to move contents from ${$} to ${Q}: ${V}`),V}}async function v4($){L.info(`Searching for manifest.json in directory: ${$}`);try{const Q=await t.readdir($,{withFileTypes:!0});for(let V of Q){const X=O5($,V.name);if(V.isDirectory()){const J=await v4(X);if(J)return J}else if(V.isFile()&&V.name==="manifest.json")return L.info(`Found manifest.json at ${X}`),X}return L.debug(`No manifest.json found in directory: ${$}`),null}catch(Q){throw L.error(`Error searching for manifest.json in ${$}: ${Q}`),Q}}async function VJ(){let $=void 0;try{L.info("Initializing Beat Saber modding environment...");const Q=L.getInput("token",{required:!1}),V=L.getInput("repo",{required:!0}),X=L.getInput("host",{required:!0}),J=L.getInput("manifest",{required:!1}),Z=L.getInput("path",{required:!0});let K=L.getInput("version",{required:!1});const G=L.getInput("ref",{required:!1});if(L.debug(`Inputs - version: ${K}, manifest: ${J}, path: ${Z}, repo: ${V}, host: ${X}, ref: ${G}`),!/^([\w-]+)\/([\w-]+)$/.test(V))throw new Error(`Invalid repo format: "${V}". Expected format "owner/repo".`);let Y=K;if(!G&&!Y){L.info("No ref or version specified. Attempting to infer version from manifest.json...");const U=J?S$(J):await v4(process.cwd());if(U){L.info(`Using manifest.json at ${U} to infer version.`);let v;try{v=await t.readFile(U,"utf-8")}catch(x){throw L.error(`Failed to read manifest.json: ${x}`),new Error("Failed to read manifest.json.")}if(v.charCodeAt(0)===65279)L.debug("Removing BOM from manifest.json"),v=v.slice(1);let N;try{N=JSON.parse(v)}catch(x){throw L.error(`Failed to parse manifest.json: ${x}`),new Error("Invalid JSON in manifest.json.")}if(N.gameVersion)Y=N.gameVersion,L.info(`Inferred version from manifest: ${Y}`);else throw new Error('No version specified and "gameVersion" not found in manifest.json.')}else throw new Error("No manifest.json found and no version specified.")}let W;if(G)W=G,L.info(`Using ref from input: ${W}`);else if(Y)W=`version/${Y}`,L.info(`Using ref from version: ${W}`);else throw new Error("No ref or version specified, and unable to infer from manifest.");const z=`https://${X}/${V}/archive/${W}.tar.gz`;$=await t.mkdtemp(O5(eX.tmpdir(),"action-"));const q=O5($,"archive.tar.gz"),M=O5($,"extract"),O=S$(Z);L.info(`Downloading tarball from ${z}`),await $J(z,q,Q),L.info(`Extracting tarball to ${M}`),await QJ(q,M),L.info(`Moving extracted contents to ${O}`),await P4(M,O),L.info("Beat Saber references initialized successfully")}catch(Q){if(Q instanceof Error)L.setFailed(`Action failed with error: ${Q.message}`);else L.setFailed(`Action failed with unknown error: ${Q}`)}finally{if($)try{await t.rm($,{recursive:!0,force:!0}),L.debug(`Cleaned up temporary directory: ${$}`)}catch(Q){L.warning(`Failed to clean up temporary directory: ${Q}`)}}}var __dirname="/home/runner/work/init-beatsaber/init-beatsaber/src";VJ();