From 7f13ba97757ca767264b5b0dfb6b73ea90093d7a Mon Sep 17 00:00:00 2001 From: ChecksumDev Date: Wed, 17 Jul 2024 21:01:45 -0500 Subject: [PATCH] chore(main): release 1.5.0 (#29) * chore(main): release 1.5.0 * chore: bundle update --------- Co-authored-by: BeatForge CI --- CHANGELOG.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ dist/index.js | 2 +- package.json | 2 +- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d39ee3c..b082d44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,55 @@ # Changelog +## [1.5.0](https://github.com/beat-forge/init-beatsaber/compare/v1.4.13...v1.5.0) (2024-07-18) + + +### Features + +* add host flag for customizable git URL + refactor ([b3f3198](https://github.com/beat-forge/init-beatsaber/commit/b3f3198f38b5860d5f60355c67798da0572296ab)) +* init ([f323b53](https://github.com/beat-forge/init-beatsaber/commit/f323b535ec0c9f308447bc97e294cb4bca1d54cd)) +* switch from file downloading to branch downloading ([31da1cd](https://github.com/beat-forge/init-beatsaber/commit/31da1cdd178cc22d7ef5ffc51b7fdcc101ebe29c)) + + +### Bug Fixes + +* `checkout` ([8879ee4](https://github.com/beat-forge/init-beatsaber/commit/8879ee41e3ef324bb989f71e4af22461c7fd8f90)) +* bundling ([a4d329d](https://github.com/beat-forge/init-beatsaber/commit/a4d329db7679c8981104f1bfc1435630e924b98b)) +* bundling again ([a30b6ab](https://github.com/beat-forge/init-beatsaber/commit/a30b6abf78c93d911c9834792ec5cec6771c4ac3)) +* bundling again again ([9bdf6c3](https://github.com/beat-forge/init-beatsaber/commit/9bdf6c3ca2c34f892d5aceb4d009b99fd6fcc254)) +* checkout ([ac73884](https://github.com/beat-forge/init-beatsaber/commit/ac738845a309c968b80843b6d4ff012da0c13b52)) +* ensure the directories are actually created. ([c07ef2c](https://github.com/beat-forge/init-beatsaber/commit/c07ef2c78a315abd39837c6d415ec84643bc8c0f)) +* ensure the directory is created properly ([07966dd](https://github.com/beat-forge/init-beatsaber/commit/07966dd279a16d6ecbf37c563aca038ebb5e65fb)) +* fetch all branches from `origin` ([fcbd32e](https://github.com/beat-forge/init-beatsaber/commit/fcbd32e73926a16837c5e5ccc5c04acc4a46c537)) +* force build ([9da0df6](https://github.com/beat-forge/init-beatsaber/commit/9da0df6a3d1473b7ac2c1caa7b2039d7909cc857)) +* I'm gonna bundle myself in a minute if this doesn't work ([2a2cc20](https://github.com/beat-forge/init-beatsaber/commit/2a2cc2042bbdf41609fdac5be462259bc24bc5c3)) +* identify ci ([1ba2d92](https://github.com/beat-forge/init-beatsaber/commit/1ba2d9278107040a6a90be8217becfdb3224c967)) +* just a bump to release the action ([2ada7b9](https://github.com/beat-forge/init-beatsaber/commit/2ada7b9de7bd19371f590a4abea44b51655fc9e2)) +* log EVERYTHING for debugging. ([5c700a0](https://github.com/beat-forge/init-beatsaber/commit/5c700a0414289fdca30b5f7b85f1e872a2692a75)) +* mkdir + debugging ([a4df869](https://github.com/beat-forge/init-beatsaber/commit/a4df869c797de9aa10247b572b53254ea83191e3)) +* my dyslexia ([8879ee4](https://github.com/beat-forge/init-beatsaber/commit/8879ee41e3ef324bb989f71e4af22461c7fd8f90)) +* proper `raw.githubusercontent.com` link ([0e525e8](https://github.com/beat-forge/init-beatsaber/commit/0e525e85a0f358cbfe2366b326cfff1512d3f6b5)) +* regression in functionality vs documentation ([4f3ad6b](https://github.com/beat-forge/init-beatsaber/commit/4f3ad6b784d8c47c856d31f15e71fcbca8dd0869)) +* remove unused github (fix for force release) ([123c72a](https://github.com/beat-forge/init-beatsaber/commit/123c72afd188944f4f533fc3bd88d874d262d6cb)) +* response headers logging ([3a1c7f8](https://github.com/beat-forge/init-beatsaber/commit/3a1c7f8d370c3e4ba5a05ed8449ca2e90350e7ee)) +* slight rewrite, should download properly now. ([68c8af6](https://github.com/beat-forge/init-beatsaber/commit/68c8af6f90af3a1432cf811d485c6316e185e44c)) +* tag subversions ([8879ee4](https://github.com/beat-forge/init-beatsaber/commit/8879ee41e3ef324bb989f71e4af22461c7fd8f90)) +* the final bundle ([1a81a58](https://github.com/beat-forge/init-beatsaber/commit/1a81a58447bbc7a318181aa1afa368ae2abb1fa6)) +* update bundle workflow to fetch full history ([0f2ad2f](https://github.com/beat-forge/init-beatsaber/commit/0f2ad2fc841d9e7c2bbbbc78b26149d3e6b934ae)) +* update dist damn it ([3dda875](https://github.com/beat-forge/init-beatsaber/commit/3dda8757dd3193110a37ae720a5982f8dd3f45ef)) +* update release workflow to include git pull before pushing changes ([b7c1db4](https://github.com/beat-forge/init-beatsaber/commit/b7c1db4f2d7958f9ef6e80c4ff1233ed41c6cf28)) +* update release workflow to use RELEASE_GITHUB_TOKEN ([c7a6cad](https://github.com/beat-forge/init-beatsaber/commit/c7a6cad9f975b661dac33afcdfa0470d34121ee1)) +* update tar extraction to filter only 'data/' paths ([bd649f8](https://github.com/beat-forge/init-beatsaber/commit/bd649f83772e8f77c1dd6219a62402a3be75ccb0)) +* update tar extraction to filter only 'data/' paths and use `version` instead of `versions`. ([6c5ce9c](https://github.com/beat-forge/init-beatsaber/commit/6c5ce9c8ae497572b7ea5dc985ff431549bb9ae8)) +* use native fetch ([30aa353](https://github.com/beat-forge/init-beatsaber/commit/30aa35394eddc842469e2f1ae64ba4b028545c5d)) +* use the `data` directory ([97ab249](https://github.com/beat-forge/init-beatsaber/commit/97ab2494c3e1f3bd8dbaa635ceb13980bfc9fea6)) +* who needs local CI testing right? ([fe1342f](https://github.com/beat-forge/init-beatsaber/commit/fe1342f85f8b763653c3aebce7f02e1c1cdb2e69)) +* witchcraft ([f028bf6](https://github.com/beat-forge/init-beatsaber/commit/f028bf64449eb04d51b3c16a96525203791a1a25)) + + +### Performance Improvements + +* switch to `bun`! (node runtime, for now.) ([1c4c5ed](https://github.com/beat-forge/init-beatsaber/commit/1c4c5ed7ed22f30bea7f01f82f37693b88d2b6d0)) + ## [1.4.12](https://github.com/beat-forge/init-beatsaber/compare/v1.4.11...v1.4.12) (2024-07-18) diff --git a/dist/index.js b/dist/index.js index 248c506..54a2ecf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,3 +1,3 @@ import{createRequire as C4} from"node:module";var H4=Object.create;var{defineProperty:_8,getPrototypeOf:x4,getOwnPropertyNames:U4}=Object;var O4=Object.prototype.hasOwnProperty;var T4=($,Q,V)=>{V=$!=null?H4(x4($)):{};const X=Q||!$||!$.__esModule?_8(V,"default",{value:$,enumerable:!0}):V;for(let J of U4($))if(!O4.call(X,J))_8(X,J,{get:()=>$[J],enumerable:!0});return X};var F=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var O=C4(import.meta.url);var o$=F((R8)=>{var j4=function($){if($===null||$===void 0)return"";else if(typeof $==="string"||$ instanceof String)return $;return JSON.stringify($)},D4=function($){if(!Object.keys($).length)return{};return{title:$.title,file:$.file,line:$.startLine,endLine:$.endLine,col:$.startColumn,endColumn:$.endColumn}};Object.defineProperty(R8,"__esModule",{value:!0});R8.toCommandProperties=R8.toCommandValue=void 0;R8.toCommandValue=j4;R8.toCommandProperties=D4});var E8=F((d)=>{var m8=function($,Q,V){const X=new b8($,Q,V);process.stdout.write(X.toString()+g4.EOL)},k4=function($,Q=""){m8($,{},Q)},y4=function($){return y8.toCommandValue($).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")},m4=function($){return y8.toCommandValue($).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")},N4=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]}),_4=d&&d.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),R4=d&&d.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))N4(Q,$,V)}return _4(Q,$),Q};Object.defineProperty(d,"__esModule",{value:!0});d.issue=d.issueCommand=void 0;var g4=R4(O("os")),y8=o$();d.issueCommand=m8;d.issue=k4;var k8="::";class b8{constructor($,Q,V){if(!$)$="missing.command";this.command=$,this.properties=Q,this.message=V}toString(){let $=k8+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}=${m4(X)}`}}}return $+=`${k8}${y4(this.message)}`,$}}});var n5=F((h8)=>{var E4=function($){return $&&$.__esModule?$:{default:$}},h4=function(){if(t$>e$.length-16)b4.default.randomFillSync(e$),t$=0;return e$.slice(t$,t$+=16)};Object.defineProperty(h8,"__esModule",{value:!0});h8.default=h4;var b4=E4(O("crypto")),e$=new Uint8Array(256),t$=e$.length});var c8=F((u8)=>{Object.defineProperty(u8,"__esModule",{value:!0});u8.default=void 0;var f4=/^(?:[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;u8.default=f4});var x$=F((l8)=>{var l4=function($){return $&&$.__esModule?$:{default:$}},d4=function($){return typeof $==="string"&&c4.default.test($)};Object.defineProperty(l8,"__esModule",{value:!0});l8.default=void 0;var c4=l4(c8()),i4=d4;l8.default=i4});var U$=F((i8)=>{var a4=function($){return $&&$.__esModule?$:{default:$}},n4=function($,Q=0){const V=(R[$[Q+0]]+R[$[Q+1]]+R[$[Q+2]]+R[$[Q+3]]+"-"+R[$[Q+4]]+R[$[Q+5]]+"-"+R[$[Q+6]]+R[$[Q+7]]+"-"+R[$[Q+8]]+R[$[Q+9]]+"-"+R[$[Q+10]]+R[$[Q+11]]+R[$[Q+12]]+R[$[Q+13]]+R[$[Q+14]]+R[$[Q+15]]).toLowerCase();if(!p4.default(V))throw TypeError("Stringified UUID is invalid");return V};Object.defineProperty(i8,"__esModule",{value:!0});i8.default=void 0;var p4=a4(x$()),R=[];for(let $=0;$<256;++$)R.push(($+256).toString(16).substr(1));var s4=n4;i8.default=s4});var o8=F((s8)=>{var n8=function($){return $&&$.__esModule?$:{default:$}},t4=function($,Q,V){let X=Q&&V||0;const J=Q||new Array(16);$=$||{};let Z=$.node||a8,K=$.clockseq!==void 0?$.clockseq:s5;if(Z==null||K==null){const L=$.random||($.rng||r4.default)();if(Z==null)Z=a8=[L[0]|1,L[1],L[2],L[3],L[4],L[5]];if(K==null)K=s5=(L[6]<<8|L[7])&16383}let G=$.msecs!==void 0?$.msecs:Date.now(),Y=$.nsecs!==void 0?$.nsecs:o5+1;const W=G-r5+(Y-o5)/1e4;if(W<0&&$.clockseq===void 0)K=K+1&16383;if((W<0||G>r5)&&$.nsecs===void 0)Y=0;if(Y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");r5=G,o5=Y,s5=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 L=0;L<6;++L)J[X+L]=Z[L];return Q||o4.default(J)};Object.defineProperty(s8,"__esModule",{value:!0});s8.default=void 0;var r4=n8(n5()),o4=n8(U$()),a8,s5,r5=0,o5=0,e4=t4;s8.default=e4});var t5=F((t8)=>{var Q6=function($){return $&&$.__esModule?$:{default:$}},V6=function($){if(!$6.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(t8,"__esModule",{value:!0});t8.default=void 0;var $6=Q6(x$()),X6=V6;t8.default=X6});var e5=F((X9)=>{var $9=function($){return $&&$.__esModule?$:{default:$}},K6=function($){$=unescape(encodeURIComponent($));const Q=[];for(let V=0;V<$.length;++V)Q.push($.charCodeAt(V));return Q},G6=function($,Q,V){function X(J,Z,K,G){if(typeof J==="string")J=K6(J);if(typeof Z==="string")Z=Z6.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 J6.default(Y)}try{X.name=$}catch(J){}return X.DNS=Q9,X.URL=V9,X};Object.defineProperty(X9,"__esModule",{value:!0});X9.default=G6;X9.URL=X9.DNS=void 0;var J6=$9(U$()),Z6=$9(t5()),Q9="6ba7b810-9dad-11d1-80b4-00c04fd430c8";X9.DNS=Q9;var V9="6ba7b811-9dad-11d1-80b4-00c04fd430c8";X9.URL=V9});var G9=F((Z9)=>{var q6=function($){return $&&$.__esModule?$:{default:$}},B6=function($){if(Array.isArray($))$=Buffer.from($);else if(typeof $==="string")$=Buffer.from($,"utf8");return W6.default.createHash("md5").update($).digest()};Object.defineProperty(Z9,"__esModule",{value:!0});Z9.default=void 0;var W6=q6(O("crypto")),L6=B6;Z9.default=L6});var q9=F((z9)=>{var Y9=function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(z9,"__esModule",{value:!0});z9.default=void 0;var M6=Y9(e5()),w6=Y9(G9()),A6=M6.default("v3",48,w6.default),I6=A6;z9.default=I6});var w9=F((L9)=>{var B9=function($){return $&&$.__esModule?$:{default:$}},v6=function($,Q,V){$=$||{};const X=$.random||($.rng||P6.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 F6.default(X)};Object.defineProperty(L9,"__esModule",{value:!0});L9.default=void 0;var P6=B9(n5()),F6=B9(U$()),H6=v6;L9.default=H6});var P9=F((A9)=>{var U6=function($){return $&&$.__esModule?$:{default:$}},O6=function($){if(Array.isArray($))$=Buffer.from($);else if(typeof $==="string")$=Buffer.from($,"utf8");return x6.default.createHash("sha1").update($).digest()};Object.defineProperty(A9,"__esModule",{value:!0});A9.default=void 0;var x6=U6(O("crypto")),T6=O6;A9.default=T6});var x9=F((v9)=>{var F9=function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(v9,"__esModule",{value:!0});v9.default=void 0;var C6=F9(e5()),j6=F9(P9()),D6=C6.default("v5",80,j6.default),S6=D6;v9.default=S6});var T9=F((U9)=>{Object.defineProperty(U9,"__esModule",{value:!0});U9.default=void 0;var N6="00000000-0000-0000-0000-000000000000";U9.default=N6});var D9=F((C9)=>{var R6=function($){return $&&$.__esModule?$:{default:$}},g6=function($){if(!_6.default($))throw TypeError("Invalid UUID");return parseInt($.substr(14,1),16)};Object.defineProperty(C9,"__esModule",{value:!0});C9.default=void 0;var _6=R6(x$()),k6=g6;C9.default=k6});var S9=F((t)=>{var w0=function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(t,"__esModule",{value:!0});Object.defineProperty(t,"v1",{enumerable:!0,get:function(){return y6.default}});Object.defineProperty(t,"v3",{enumerable:!0,get:function(){return m6.default}});Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return b6.default}});Object.defineProperty(t,"v5",{enumerable:!0,get:function(){return E6.default}});Object.defineProperty(t,"NIL",{enumerable:!0,get:function(){return h6.default}});Object.defineProperty(t,"version",{enumerable:!0,get:function(){return u6.default}});Object.defineProperty(t,"validate",{enumerable:!0,get:function(){return f6.default}});Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return c6.default}});Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return l6.default}});var y6=w0(o8()),m6=w0(q9()),b6=w0(w9()),E6=w0(x9()),h6=w0(T9()),u6=w0(D9()),f6=w0(x$()),c6=w0(U$()),l6=w0(t5())});var g9=F((i)=>{var a6=function($,Q){const V=process.env[`GITHUB_${$}`];if(!V)throw new Error(`Unable to find environment variable for file command ${$}`);if(!N9.existsSync(V))throw new Error(`Missing file at path: ${V}`);N9.appendFileSync(V,`${R9.toCommandValue(Q)}${$1.EOL}`,{encoding:"utf8"})},n6=function($,Q){const V=`ghadelimiter_${p6.v4()}`,X=R9.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}${$1.EOL}${X}${$1.EOL}${V}`},d6=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]}),i6=i&&i.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),_9=i&&i.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))d6(Q,$,V)}return i6(Q,$),Q};Object.defineProperty(i,"__esModule",{value:!0});i.prepareKeyValueMessage=i.issueFileCommand=void 0;var N9=_9(O("fs")),$1=_9(O("os")),p6=S9(),R9=o$();i.issueFileCommand=a6;i.prepareKeyValueMessage=n6});var b9=F((y9)=>{var s6=function($){const Q=$.protocol==="https:";if(k9($))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},k9=function($){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},r6=function($){const Q=$.toLowerCase();return Q==="localhost"||Q.startsWith("127.")||Q.startsWith("[::1]")||Q.startsWith("[0:0:0:0:0:0:0:1]")};Object.defineProperty(y9,"__esModule",{value:!0});y9.checkBypass=y9.getProxyUrl=void 0;y9.getProxyUrl=s6;y9.checkBypass=k9});var f9=F((ZQ)=>{var QQ=function($){var Q=new A0($);return Q.request=Q1.request,Q},VQ=function($){var Q=new A0($);return Q.request=Q1.request,Q.createSocket=h9,Q.defaultPort=443,Q},XQ=function($){var Q=new A0($);return Q.request=E9.request,Q},JQ=function($){var Q=new A0($);return Q.request=E9.request,Q.createSocket=h9,Q.defaultPort=443,Q},A0=function($){var Q=this;Q.options=$||{},Q.proxyOptions=Q.options.proxy||{},Q.maxSockets=Q.options.maxSockets||Q1.Agent.defaultMaxSockets,Q.requests=[],Q.sockets=[],Q.on("free",function V(X,J,Z,K){var G=u9(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)}})};A0.prototype.createSocket=function $(Q,V){var X=this,J={};X.sockets.push(J);var Z=V1({},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,L,U){process.nextTick(function(){W(q,L,U)})}function W(q,L,U){if(K.removeAllListeners(),L.removeAllListeners(),q.statusCode!==200){j0("tunneling socket could not be established, statusCode=%d",q.statusCode),L.destroy();var C=new Error("tunneling socket could not be established, statusCode="+q.statusCode);C.code="ECONNRESET",Q.request.emit("error",C),X.removeSocket(J);return}if(U.length>0){j0("got illegal response body from proxy"),L.destroy();var C=new Error("got illegal response body from proxy");C.code="ECONNRESET",Q.request.emit("error",C),X.removeSocket(J);return}return j0("tunneling connection has established"),X.sockets[X.sockets.indexOf(J)]=L,V(L)}function z(q){K.removeAllListeners(),j0("tunneling socket could not be established, cause=%s\n",q.message,q.stack);var L=new Error("tunneling socket could not be established, cause="+q.message);L.code="ECONNRESET",Q.request.emit("error",L),X.removeSocket(J)}};A0.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(){};ZQ.debug=j0});var d9=F((P)=>{var LQ=function($){const Q=c9.getProxyUrl(new URL($));return Q?Q.href:""},FQ=function($){return new URL($).protocol==="https:"},qQ=P&&P.__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]}),BQ=P&&P.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),X5=P&&P.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))qQ(Q,$,V)}return BQ(Q,$),Q},H=P&&P.__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(P,"__esModule",{value:!0});P.HttpClient=P.isHttps=P.HttpClientResponse=P.HttpClientError=P.getProxyUrl=P.MediaTypes=P.Headers=P.HttpCodes=void 0;var $5=X5(O("http")),X1=X5(O("https")),c9=X5(b9()),Q5=X5(f9()),e;(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"})(e=P.HttpCodes||(P.HttpCodes={}));var y;(function($){$.Accept="accept",$.ContentType="content-type"})(y=P.Headers||(P.Headers={}));var D0;(function($){$.ApplicationJson="application/json"})(D0=P.MediaTypes||(P.MediaTypes={}));P.getProxyUrl=LQ;var MQ=[e.MovedPermanently,e.ResourceMoved,e.SeeOther,e.TemporaryRedirect,e.PermanentRedirect],wQ=[e.BadGateway,e.ServiceUnavailable,e.GatewayTimeout],AQ=["OPTIONS","GET","DELETE","HEAD"],IQ=10,PQ=5;class J5 extends Error{constructor($,Q){super($);this.name="HttpClientError",this.statusCode=Q,Object.setPrototypeOf(this,J5.prototype)}}P.HttpClientError=J5;class J1{constructor($){this.message=$}readBody(){return H(this,void 0,void 0,function*(){return new Promise(($)=>H(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 H(this,void 0,void 0,function*(){return new Promise(($)=>H(this,void 0,void 0,function*(){const Q=[];this.message.on("data",(V)=>{Q.push(V)}),this.message.on("end",()=>{$(Buffer.concat(Q))})}))})}}P.HttpClientResponse=J1;P.isHttps=FQ;class l9{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 H(this,void 0,void 0,function*(){return this.request("OPTIONS",$,null,Q||{})})}get($,Q){return H(this,void 0,void 0,function*(){return this.request("GET",$,null,Q||{})})}del($,Q){return H(this,void 0,void 0,function*(){return this.request("DELETE",$,null,Q||{})})}post($,Q,V){return H(this,void 0,void 0,function*(){return this.request("POST",$,Q,V||{})})}patch($,Q,V){return H(this,void 0,void 0,function*(){return this.request("PATCH",$,Q,V||{})})}put($,Q,V){return H(this,void 0,void 0,function*(){return this.request("PUT",$,Q,V||{})})}head($,Q){return H(this,void 0,void 0,function*(){return this.request("HEAD",$,null,Q||{})})}sendStream($,Q,V,X){return H(this,void 0,void 0,function*(){return this.request($,Q,V,X)})}getJson($,Q={}){return H(this,void 0,void 0,function*(){Q[y.Accept]=this._getExistingOrDefaultHeader(Q,y.Accept,D0.ApplicationJson);const V=yield this.get($,Q);return this._processResponse(V,this.requestOptions)})}postJson($,Q,V={}){return H(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[y.Accept]=this._getExistingOrDefaultHeader(V,y.Accept,D0.ApplicationJson),V[y.ContentType]=this._getExistingOrDefaultHeader(V,y.ContentType,D0.ApplicationJson);const J=yield this.post($,X,V);return this._processResponse(J,this.requestOptions)})}putJson($,Q,V={}){return H(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[y.Accept]=this._getExistingOrDefaultHeader(V,y.Accept,D0.ApplicationJson),V[y.ContentType]=this._getExistingOrDefaultHeader(V,y.ContentType,D0.ApplicationJson);const J=yield this.put($,X,V);return this._processResponse(J,this.requestOptions)})}patchJson($,Q,V={}){return H(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[y.Accept]=this._getExistingOrDefaultHeader(V,y.Accept,D0.ApplicationJson),V[y.ContentType]=this._getExistingOrDefaultHeader(V,y.ContentType,D0.ApplicationJson);const J=yield this.patch($,X,V);return this._processResponse(J,this.requestOptions)})}request($,Q,V,X){return H(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&&AQ.includes($)?this._maxRetries+1:1;let G=0,Y;do{if(Y=yield this.requestRaw(Z,V),Y&&Y.message&&Y.message.statusCode===e.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&&MQ.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 L in X)if(L.toLowerCase()==="authorization")delete X[L]}Z=this._prepareRequest($,q,X),Y=yield this.requestRaw(Z,V),W--}if(!Y.message.statusCode||!wQ.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 J1(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?X1:$5;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({},V5(this.requestOptions.headers),V5($||{}));return V5($||{})}_getExistingOrDefaultHeader($,Q,V){let X;if(this.requestOptions&&this.requestOptions.headers)X=V5(this.requestOptions.headers)[Q];return $[Q]||X||V}_getAgent($){let Q;const V=c9.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||$5.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?Q5.httpsOverHttps:Q5.httpsOverHttp;else G=Y?Q5.httpOverHttps:Q5.httpOverHttp;Q=G(K),this._proxyAgent=Q}if(this._keepAlive&&!Q){const K={keepAlive:this._keepAlive,maxSockets:Z};Q=J?new X1.Agent(K):new $5.Agent(K),this._agent=Q}if(!Q)Q=J?X1.globalAgent:$5.globalAgent;if(J&&this._ignoreSslError)Q.options=Object.assign(Q.options||{},{rejectUnauthorized:!1});return Q}_performExponentialBackoff($){return H(this,void 0,void 0,function*(){$=Math.min(IQ,$);const Q=PQ*Math.pow(2,$);return new Promise((V)=>setTimeout(()=>V(),Q))})}_processResponse($,Q){return H(this,void 0,void 0,function*(){return new Promise((V,X)=>H(this,void 0,void 0,function*(){const J=$.message.statusCode||0,Z={statusCode:J,result:null,headers:{}};if(J===e.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 J5(W,J);z.result=Z.result,X(z)}else V(Z)}))})}}P.HttpClient=l9;var V5=($)=>Object.keys($).reduce((Q,V)=>(Q[V.toLowerCase()]=$[V],Q),{})});var n9=F((Z0)=>{var Z1=Z0&&Z0.__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(Z0,"__esModule",{value:!0});Z0.PersonalAccessTokenCredentialHandler=Z0.BearerCredentialHandler=Z0.BasicCredentialHandler=void 0;class i9{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 Z1(this,void 0,void 0,function*(){throw new Error("not implemented")})}}Z0.BasicCredentialHandler=i9;class p9{constructor($){this.token=$}prepareRequest($){if(!$.headers)throw Error("The request has no headers");$.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return Z1(this,void 0,void 0,function*(){throw new Error("not implemented")})}}Z0.BearerCredentialHandler=p9;class a9{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 Z1(this,void 0,void 0,function*(){throw new Error("not implemented")})}}Z0.PersonalAccessTokenCredentialHandler=a9});var o9=F((K$)=>{var s9=K$&&K$.__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(K$,"__esModule",{value:!0});K$.OidcClient=void 0;var vQ=d9(),HQ=n9(),r9=K1();class Z${static createHttpClient($=!0,Q=10){const V={allowRetries:$,maxRetries:Q};return new vQ.HttpClient("actions/oidc-client",[new HQ.BearerCredentialHandler(Z$.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 s9(this,void 0,void 0,function*(){const J=(Q=(yield Z$.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 s9(this,void 0,void 0,function*(){try{let Q=Z$.getIDTokenUrl();if($){const X=encodeURIComponent($);Q=`${Q}&audience=${X}`}r9.debug(`ID token url is ${Q}`);const V=yield Z$.getCall(Q);return r9.setSecret(V),V}catch(Q){throw new Error(`Error message: ${Q.message}`)}})}}K$.OidcClient=Z$});var z1=F((E)=>{var G1=E&&E.__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(E,"__esModule",{value:!0});E.summary=E.markdownSummary=E.SUMMARY_DOCS_URL=E.SUMMARY_ENV_VAR=void 0;var xQ=O("os"),Y1=O("fs"),{access:UQ,appendFile:OQ,writeFile:TQ}=Y1.promises;E.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";E.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";class t9{constructor(){this._buffer=""}filePath(){return G1(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;const $=process.env[E.SUMMARY_ENV_VAR];if(!$)throw new Error(`Unable to find environment variable for \$${E.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield UQ($,Y1.constants.R_OK|Y1.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 G1(this,void 0,void 0,function*(){const Q=!!($===null||$===void 0?void 0:$.overwrite),V=yield this.filePath();return yield(Q?TQ:OQ)(V,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return G1(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(xQ.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 e9=new t9;E.markdownSummary=e9;E.summary=e9});var $7=F((h)=>{var NQ=function($){return $.replace(/[\\]/g,"/")},_Q=function($){return $.replace(/[/]/g,"\\")},RQ=function($){return $.replace(/[/\\]/g,SQ.sep)},CQ=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]}),jQ=h&&h.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),DQ=h&&h.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))CQ(Q,$,V)}return jQ(Q,$),Q};Object.defineProperty(h,"__esModule",{value:!0});h.toPlatformPath=h.toWin32Path=h.toPosixPath=void 0;var SQ=DQ(O("path"));h.toPosixPath=NQ;h.toWin32Path=_Q;h.toPlatformPath=RQ});var K1=F((B)=>{var bQ=function($,Q){const V=G$.toCommandValue(Q);if(process.env[$]=V,process.env.GITHUB_ENV||"")return i0.issueFileCommand("ENV",i0.prepareKeyValueMessage($,Q));p.issueCommand("set-env",{name:$},V)},EQ=function($){p.issueCommand("add-mask",{},$)},hQ=function($){if(process.env.GITHUB_PATH||"")i0.issueFileCommand("PATH",$);else p.issueCommand("add-path",{},$);process.env.PATH=`${$}${yQ.delimiter}${process.env.PATH}`},W1=function($,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()},uQ=function($,Q){const V=W1($,Q).split("\n").filter((X)=>X!=="");if(Q&&Q.trimWhitespace===!1)return V;return V.map((X)=>X.trim())},fQ=function($,Q){const V=["true","True","TRUE"],X=["false","False","FALSE"],J=W1($,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\``)},cQ=function($,Q){if(process.env.GITHUB_OUTPUT||"")return i0.issueFileCommand("OUTPUT",i0.prepareKeyValueMessage($,Q));process.stdout.write(X7.EOL),p.issueCommand("set-output",{name:$},G$.toCommandValue(Q))},lQ=function($){p.issue("echo",$?"on":"off")},dQ=function($){process.exitCode=J7.Failure,Z7($)},iQ=function(){return process.env.RUNNER_DEBUG==="1"},pQ=function($){p.issueCommand("debug",{},$)},Z7=function($,Q={}){p.issueCommand("error",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},aQ=function($,Q={}){p.issueCommand("warning",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},nQ=function($,Q={}){p.issueCommand("notice",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},sQ=function($){process.stdout.write($+X7.EOL)},K7=function($){p.issue("group",$)},G7=function(){p.issue("endgroup")},rQ=function($,Q){return V7(this,void 0,void 0,function*(){K7($);let V;try{V=yield Q()}finally{G7()}return V})},oQ=function($,Q){if(process.env.GITHUB_STATE||"")return i0.issueFileCommand("STATE",i0.prepareKeyValueMessage($,Q));p.issueCommand("save-state",{name:$},G$.toCommandValue(Q))},tQ=function($){return process.env[`STATE_${$}`]||""},eQ=function($){return V7(this,void 0,void 0,function*(){return yield mQ.OidcClient.getIDToken($)})},gQ=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]}),kQ=B&&B.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),Q7=B&&B.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))gQ(Q,$,V)}return kQ(Q,$),Q},V7=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=E8(),i0=g9(),G$=o$(),X7=Q7(O("os")),yQ=Q7(O("path")),mQ=o9(),J7;(function($){$[$.Success=0]="Success",$[$.Failure=1]="Failure"})(J7=B.ExitCode||(B.ExitCode={}));B.exportVariable=bQ;B.setSecret=EQ;B.addPath=hQ;B.getInput=W1;B.getMultilineInput=uQ;B.getBooleanInput=fQ;B.setOutput=cQ;B.setCommandEcho=lQ;B.setFailed=dQ;B.isDebug=iQ;B.debug=pQ;B.error=Z7;B.warning=aQ;B.notice=nQ;B.info=sQ;B.startGroup=K7;B.endGroup=G7;B.group=rQ;B.saveState=oQ;B.getState=tQ;B.getIDToken=eQ;var $V=z1();Object.defineProperty(B,"summary",{enumerable:!0,get:function(){return $V.summary}});var QV=z1();Object.defineProperty(B,"markdownSummary",{enumerable:!0,get:function(){return QV.markdownSummary}});var q1=$7();Object.defineProperty(B,"toPosixPath",{enumerable:!0,get:function(){return q1.toPosixPath}});Object.defineProperty(B,"toWin32Path",{enumerable:!0,get:function(){return q1.toWin32Path}});Object.defineProperty(B,"toPlatformPath",{enumerable:!0,get:function(){return q1.toPlatformPath}})});var P4=F((b3,rX)=>{rX.exports={name:"init-beatsaber",description:"A GitHub Action to initialize a Beat Saber modding environment",version:"1.4.12",author:"BeatForge",private:!0,type:"module",homepage:"https://github.com/beat-forge/init-beatsaber",repository:{type:"git",url:"git+https://github.com/beat-forge/init-beatsaber.git"},bugs:{url:"https://github.com/beat-forge/init-beatsaber/issues"},main:"dist/index.js",engines:{node:">=20"},scripts:{all:"bun run format:write && bun run package","package:node":"bun build --target=node ./src/index.ts --outfile=dist/index.js --minify","package:bun":"bun build --target=bun ./src/index.ts --outfile=dist/index.js --minify","format:write":"prettier --write \"**/*.{ts,tsx}\"",bundle:"bun run format:write && bun run package:node"},license:"AGPL-3.0",dependencies:{"@actions/core":"^1.10.1","@actions/github":"^5.1.1",tar:"^7.4.0"},devDependencies:{"@types/node":"^20.14.10","bun-types":"^1.1.20",prettier:"^3.3.3",typescript:"^5.5.3"}}});var w=T4(K1(),1);import{promises as d0,createWriteStream as oX} from"fs";import{dirname as F4,join as D8,resolve as tX} from"path";import BV from"events";import u from"fs";import{EventEmitter as I1} from"node:events";import B7 from"node:stream";import{StringDecoder as VV} from"node:string_decoder";var Y7=typeof process==="object"&&process?process:{stdout:null,stderr:null},XV=($)=>!!$&&typeof $==="object"&&($ instanceof c||$ instanceof B7||JV($)||ZV($)),JV=($)=>!!$&&typeof $==="object"&&$ instanceof I1&&typeof $.pipe==="function"&&$.pipe!==B7.Writable.prototype.pipe,ZV=($)=>!!$&&typeof $==="object"&&$ instanceof I1&&typeof $.write==="function"&&typeof $.end==="function",I0=Symbol("EOF"),P0=Symbol("maybeEmitEnd"),S0=Symbol("emittedEnd"),Z5=Symbol("emittingEnd"),O$=Symbol("emittedError"),K5=Symbol("closed"),z7=Symbol("read"),G5=Symbol("flush"),W7=Symbol("flushChunk"),$0=Symbol("encoding"),Y$=Symbol("decoder"),S=Symbol("flowing"),T$=Symbol("paused"),z$=Symbol("resume"),N=Symbol("buffer"),m=Symbol("pipes"),_=Symbol("bufferLength"),B1=Symbol("bufferPush"),Y5=Symbol("bufferShift"),g=Symbol("objectMode"),x=Symbol("destroyed"),L1=Symbol("error"),M1=Symbol("emitData"),q7=Symbol("emitEnd"),w1=Symbol("emitEnd2"),K0=Symbol("async"),A1=Symbol("abort"),z5=Symbol("aborted"),C$=Symbol("signal"),p0=Symbol("dataListeners"),f=Symbol("discarded"),j$=($)=>Promise.resolve().then($),KV=($)=>$(),GV=($)=>$==="end"||$==="finish"||$==="prefinish",YV=($)=>$ instanceof ArrayBuffer||!!$&&typeof $==="object"&&$.constructor&&$.constructor.name==="ArrayBuffer"&&$.byteLength>=0,zV=($)=>!Buffer.isBuffer($)&&ArrayBuffer.isView($);class P1{src;dest;opts;ondrain;constructor($,Q,V){this.src=$,this.dest=Q,this.opts=V,this.ondrain=()=>$[z$](),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 L7 extends P1{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 WV=($)=>!!$.objectMode,qV=($)=>!$.objectMode&&!!$.encoding&&$.encoding!=="buffer";class c extends I1{[S]=!1;[T$]=!1;[m]=[];[N]=[];[g];[$0];[K0];[Y$];[I0]=!1;[S0]=!1;[Z5]=!1;[K5]=!1;[O$]=null;[_]=0;[x]=!1;[C$];[z5]=!1;[p0]=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(WV(Q))this[g]=!0,this[$0]=null;else if(qV(Q))this[$0]=Q.encoding,this[g]=!1;else this[g]=!1,this[$0]=null;if(this[K0]=!!Q.async,this[Y$]=this[$0]?new VV(this[$0]):null,Q&&Q.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[N]});if(Q&&Q.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[m]});const{signal:V}=Q;if(V)if(this[C$]=V,V.aborted)this[A1]();else V.addEventListener("abort",()=>this[A1]())}get bufferLength(){return this[_]}get encoding(){return this[$0]}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[g]}set objectMode($){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[K0]}set["async"]($){this[K0]=this[K0]||!!$}[A1](){this[z5]=!0,this.emit("abort",this[C$]?.reason),this.destroy(this[C$]?.reason)}get aborted(){return this[z5]}set aborted($){}write($,Q,V){if(this[z5])return!1;if(this[I0])throw new Error("write after end");if(this[x])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[K0]?j$:KV;if(!this[g]&&!Buffer.isBuffer($)){if(zV($))$=Buffer.from($.buffer,$.byteOffset,$.byteLength);else if(YV($))$=Buffer.from($);else if(typeof $!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[g]){if(this[S]&&this[_]!==0)this[G5](!0);if(this[S])this.emit("data",$);else this[B1]($);if(this[_]!==0)this.emit("readable");if(V)X(V);return this[S]}if(!$.length){if(this[_]!==0)this.emit("readable");if(V)X(V);return this[S]}if(typeof $==="string"&&!(Q===this[$0]&&!this[Y$]?.lastNeed))$=Buffer.from($,Q);if(Buffer.isBuffer($)&&this[$0])$=this[Y$].write($);if(this[S]&&this[_]!==0)this[G5](!0);if(this[S])this.emit("data",$);else this[B1]($);if(this[_]!==0)this.emit("readable");if(V)X(V);return this[S]}read($){if(this[x])return null;if(this[f]=!1,this[_]===0||$===0||$&&$>this[_])return this[P0](),null;if(this[g])$=null;if(this[N].length>1&&!this[g])this[N]=[this[$0]?this[N].join(""):Buffer.concat(this[N],this[_])];const Q=this[z7]($||null,this[N][0]);return this[P0](),Q}[z7]($,Q){if(this[g])this[Y5]();else{const V=Q;if($===V.length||$===null)this[Y5]();else if(typeof V==="string")this[N][0]=V.slice($),Q=V.slice(0,$),this[_]-=$;else this[N][0]=V.subarray($),Q=V.subarray(0,$),this[_]-=$}if(this.emit("data",Q),!this[N].length&&!this[I0])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[I0]=!0,this.writable=!1,this[S]||!this[T$])this[P0]();return this}[z$](){if(this[x])return;if(!this[p0]&&!this[m].length)this[f]=!0;if(this[T$]=!1,this[S]=!0,this.emit("resume"),this[N].length)this[G5]();else if(this[I0])this[P0]();else this.emit("drain")}resume(){return this[z$]()}pause(){this[S]=!1,this[T$]=!0,this[f]=!1}get destroyed(){return this[x]}get flowing(){return this[S]}get paused(){return this[T$]}[B1]($){if(this[g])this[_]+=1;else this[_]+=$.length;this[N].push($)}[Y5](){if(this[g])this[_]-=1;else this[_]-=this[N][0].length;return this[N].shift()}[G5]($=!1){do;while(this[W7](this[Y5]())&&this[N].length);if(!$&&!this[N].length&&!this[I0])this.emit("drain")}[W7]($){return this.emit("data",$),this[S]}pipe($,Q){if(this[x])return $;this[f]=!1;const V=this[S0];if(Q=Q||{},$===Y7.stdout||$===Y7.stderr)Q.end=!1;else Q.end=Q.end!==!1;if(Q.proxyErrors=!!Q.proxyErrors,V){if(Q.end)$.end()}else if(this[m].push(!Q.proxyErrors?new P1(this,$,Q):new L7(this,$,Q)),this[K0])j$(()=>this[z$]());else this[z$]();return $}unpipe($){const Q=this[m].find((V)=>V.dest===$);if(Q){if(this[m].length===1){if(this[S]&&this[p0]===0)this[S]=!1;this[m]=[]}else this[m].splice(this[m].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[p0]++,!this[m].length&&!this[S])this[z$]()}else if($==="readable"&&this[_]!==0)super.emit("readable");else if(GV($)&&this[S0])super.emit($),this.removeAllListeners($);else if($==="error"&&this[O$]){const X=Q;if(this[K0])j$(()=>X.call(this,this[O$]));else X.call(this,this[O$])}return V}removeListener($,Q){return this.off($,Q)}off($,Q){const V=super.off($,Q);if($==="data"){if(this[p0]=this.listeners("data").length,this[p0]===0&&!this[f]&&!this[m].length)this[S]=!1}return V}removeAllListeners($){const Q=super.removeAllListeners($);if($==="data"||$===void 0){if(this[p0]=0,!this[f]&&!this[m].length)this[S]=!1}return Q}get emittedEnd(){return this[S0]}[P0](){if(!this[Z5]&&!this[S0]&&!this[x]&&this[N].length===0&&this[I0]){if(this[Z5]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[K5])this.emit("close");this[Z5]=!1}}emit($,...Q){const V=Q[0];if($!=="error"&&$!=="close"&&$!==x&&this[x])return!1;else if($==="data")return!this[g]&&!V?!1:this[K0]?(j$(()=>this[M1](V)),!0):this[M1](V);else if($==="end")return this[q7]();else if($==="close"){if(this[K5]=!0,!this[S0]&&!this[x])return!1;const J=super.emit("close");return this.removeAllListeners("close"),J}else if($==="error"){this[O$]=V,super.emit(L1,V);const J=!this[C$]||this.listeners("error").length?super.emit("error",V):!1;return this[P0](),J}else if($==="resume"){const J=super.emit("resume");return this[P0](),J}else if($==="finish"||$==="prefinish"){const J=super.emit($);return this.removeAllListeners($),J}const X=super.emit($,...Q);return this[P0](),X}[M1]($){for(let V of this[m])if(V.dest.write($)===!1)this.pause();const Q=this[f]?!1:super.emit("data",$);return this[P0](),Q}[q7](){if(this[S0])return!1;return this[S0]=!0,this.readable=!1,this[K0]?(j$(()=>this[w1]()),!0):this[w1]()}[w1](){if(this[Y$]){const Q=this[Y$].end();if(Q){for(let V of this[m])V.dest.write(Q);if(!this[f])super.emit("data",Q)}}for(let Q of this[m])Q.end();const $=super.emit("end");return this.removeAllListeners("end"),$}async collect(){const $=Object.assign([],{dataLength:0});if(!this[g])$.dataLength=0;const Q=this.promise();return this.on("data",(V)=>{if($.push(V),!this[g])$.dataLength+=V.length}),await Q,$}async concat(){if(this[g])throw new Error("cannot concat in objectMode");const $=await this.collect();return this[$0]?$.join(""):Buffer.concat($,$.dataLength)}async promise(){return new Promise(($,Q)=>{this.on(x,()=>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[I0])return Q();let J,Z;const K=(z)=>{this.off("data",G),this.off("end",Y),this.off(x,W),Q(),Z(z)},G=(z)=>{this.off("error",K),this.off("end",Y),this.off(x,W),this.pause(),J({value:z,done:!!this[I0]})},Y=()=>{this.off("error",K),this.off("data",G),this.off(x,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(x,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(L1,Q),this.off(x,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(L1,Q),this.once(x,Q),{next:V,throw:Q,return:Q,[Symbol.iterator](){return this}}}destroy($){if(this[x]){if($)this.emit("error",$);else this.emit(x);return this}this[x]=!0,this[f]=!0,this[N].length=0,this[_]=0;const Q=this;if(typeof Q.close==="function"&&!this[K5])Q.close();if($)this.emit("error",$);else this.emit(x);return this}static get isStream(){return XV}}var LV=u.writev,_0=Symbol("_autoClose"),V0=Symbol("_close"),D$=Symbol("_ended"),I=Symbol("_fd"),F1=Symbol("_finished"),v0=Symbol("_flags"),v1=Symbol("_flush"),O1=Symbol("_handleChunk"),T1=Symbol("_makeBuf"),N$=Symbol("_mode"),W5=Symbol("_needDrain"),B$=Symbol("_onerror"),L$=Symbol("_onopen"),H1=Symbol("_onread"),W$=Symbol("_onwrite"),R0=Symbol("_open"),Q0=Symbol("_path"),N0=Symbol("_pos"),G0=Symbol("_queue"),q$=Symbol("_read"),x1=Symbol("_readSize"),F0=Symbol("_reading"),S$=Symbol("_remain"),U1=Symbol("_size"),q5=Symbol("_write"),a0=Symbol("_writing"),B5=Symbol("_defaultFlag"),n0=Symbol("_errored");class M$ extends c{[n0]=!1;[I];[Q0];[x1];[F0]=!1;[U1];[S$];[_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[n0]=!1,this[I]=typeof Q.fd==="number"?Q.fd:void 0,this[Q0]=$,this[x1]=Q.readSize||16777216,this[F0]=!1,this[U1]=typeof Q.size==="number"?Q.size:1/0,this[S$]=this[U1],this[_0]=typeof Q.autoClose==="boolean"?Q.autoClose:!0,typeof this[I]==="number")this[q$]();else this[R0]()}get fd(){return this[I]}get path(){return this[Q0]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[R0](){u.open(this[Q0],"r",($,Q)=>this[L$]($,Q))}[L$]($,Q){if($)this[B$]($);else this[I]=Q,this.emit("open",Q),this[q$]()}[T1](){return Buffer.allocUnsafe(Math.min(this[x1],this[S$]))}[q$](){if(!this[F0]){this[F0]=!0;const $=this[T1]();if($.length===0)return process.nextTick(()=>this[H1](null,0,$));u.read(this[I],$,0,$.length,null,(Q,V,X)=>this[H1](Q,V,X))}}[H1]($,Q,V){if(this[F0]=!1,$)this[B$]($);else if(this[O1](Q,V))this[q$]()}[V0](){if(this[_0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}[B$]($){this[F0]=!0,this[V0](),this.emit("error",$)}[O1]($,Q){let V=!1;if(this[S$]-=$,$>0)V=super.write($this[L$]($,Q))}[L$]($,Q){if(this[B5]&&this[v0]==="r+"&&$&&$.code==="ENOENT")this[v0]="w",this[R0]();else if($)this[B$]($);else if(this[I]=Q,this.emit("open",Q),!this[a0])this[v1]()}end($,Q){if($)this.write($,Q);if(this[D$]=!0,!this[a0]&&!this[G0].length&&typeof this[I]==="number")this[W$](null,0);return this}write($,Q){if(typeof $==="string")$=Buffer.from($,Q);if(this[D$])return this.emit("error",new Error("write() after end()")),!1;if(this[I]===void 0||this[a0]||this[G0].length)return this[G0].push($),this[W5]=!0,!1;return this[a0]=!0,this[q5]($),!0}[q5]($){u.write(this[I],$,0,$.length,this[N0],(Q,V)=>this[W$](Q,V))}[W$]($,Q){if($)this[B$]($);else{if(this[N0]!==void 0&&typeof Q==="number")this[N0]+=Q;if(this[G0].length)this[v1]();else if(this[a0]=!1,this[D$]&&!this[F1])this[F1]=!0,this[V0](),this.emit("finish");else if(this[W5])this[W5]=!1,this.emit("drain")}}[v1](){if(this[G0].length===0){if(this[D$])this[W$](null,0)}else if(this[G0].length===1)this[q5](this[G0].pop());else{const $=this[G0];this[G0]=[],LV(this[I],$,this[N0],(Q,V)=>this[W$](Q,V))}}[V0](){if(this[_0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}}class _$ extends g0{[R0](){let $;if(this[B5]&&this[v0]==="r+")try{$=u.openSync(this[Q0],this[v0],this[N$])}catch(Q){if(Q?.code==="ENOENT")return this[v0]="w",this[R0]();else throw Q}else $=u.openSync(this[Q0],this[v0],this[N$]);this[L$](null,$)}[V0](){if(this[_0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.closeSync($),this.emit("close")}}[q5]($){let Q=!0;try{this[W$](null,u.writeSync(this[I],$,0,$.length,this[N0])),Q=!1}finally{if(Q)try{this[V0]()}catch{}}}}import p7 from"node:path";import I$ from"node:fs";import{dirname as iV,parse as pV} from"path";var MV=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"]]),M7=($)=>!!$.sync&&!!$.file,w7=($)=>!$.sync&&!!$.file,A7=($)=>!!$.sync&&!$.file,I7=($)=>!$.sync&&!$.file;var P7=($)=>!!$.file;var wV=($)=>{const Q=MV.get($);if(Q)return Q;return $},R$=($={})=>{if(!$)return{};const Q={};for(let[V,X]of Object.entries($)){const J=wV(V);Q[J]=X}if(Q.chmod===void 0&&Q.noChmod===!1)Q.chmod=!0;return delete Q.noChmod,Q};var Y0=($,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=R$(Z);if(J?.(Y,K),M7(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return $(Y,K)}else if(w7(Y)){const W=Q(Y,K),z=G?G:void 0;return z?W.then(()=>z(),z):W}else if(A7(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return V(Y,K)}else if(I7(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 cV} from"events";import S1 from"assert";import{Buffer as k0} from"buffer";import PV from"zlib";import AV from"zlib";var IV=AV.constants||{ZLIB_VERNUM:4736},H0=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},IV));var F7=k0.concat,s0=Symbol("_superWrite");class g$ 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 D1=Symbol("flushFlag");class N1 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 PV[Q]($)}catch(V){throw new g$(V)}this.#K=(V)=>{if(this.#$)return;this.#$=!0,this.close(),this.emit("error",V)},this.#Q?.on("error",(V)=>this.#K(new g$(V))),this.once("end",()=>this.close)}close(){if(this.#Q)this.#Q.close(),this.#Q=void 0,this.emit("close")}reset(){if(!this.#$)return S1(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),{[D1]:$}))}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}[s0]($){return super.write($)}write($,Q,V){if(typeof Q==="function")V=Q,Q="utf8";if(typeof $==="string")$=k0.from($,Q);if(this.#$)return;S1(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 $[D1]==="number"?$[D1]:this.#X;K=this.#Q._processChunk($,Y),k0.concat=F7}catch(Y){k0.concat=F7,this.#K(new g$(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 g$(Y)));let G;if(K)if(Array.isArray(K)&&K.length>0){const Y=K[0];G=this[s0](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 R1 extends _1{#$;constructor($){super($,"Gzip");this.#$=$&&!!$.portable}[s0]($){if(!this.#$)return super[s0]($);return this.#$=!1,$[9]=255,super[s0]($)}}class g1 extends _1{constructor($){super($,"Unzip")}}class k1 extends N1{constructor($,Q){$=$||{},$.flush=$.flush||H0.BROTLI_OPERATION_PROCESS,$.finishFlush=$.finishFlush||H0.BROTLI_OPERATION_FINISH,$.fullFlushFlag=H0.BROTLI_OPERATION_FLUSH;super($,Q)}}class y1 extends k1{constructor($){super($,"BrotliCompress")}}class m1 extends k1{constructor($){super($,"BrotliDecompress")}}var vV=function($,Q,V){const X=Q,J=Q?Q.next:$.head,Z=new L5(V,X,J,$);if(Z.next===void 0)$.tail=Z;if(Z.prev===void 0)$.head=Z;return $.length++,Z},HV=function($,Q){if($.tail=new L5(Q,$.tail,void 0,$),!$.head)$.head=$.tail;$.length++},xV=function($,Q){if($.head=new L5(Q,void 0,$.head,$),!$.tail)$.tail=$.head;$.length++};class z0{tail;head;length=0;static create($=[]){return new z0($)}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 z0;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)OV($,Q);else UV($,Q);return Q},UV=($,Q)=>{Q[0]=128;for(var V=Q.length;V>1;V--)Q[V-1]=$&255,$=Math.floor($/256)},OV=($,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]=x7(J);else if(J===0)Q[X-1]=0;else V=!0,Q[X-1]=U7(J)}},H7=($)=>{const Q=$[0],V=Q===128?CV($.subarray(1,$.length)):Q===255?TV($):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},TV=($)=>{var Q=$.length,V=0,X=!1;for(var J=Q-1;J>-1;J--){var Z=Number($[J]),K;if(X)K=x7(Z);else if(Z===0)K=Z;else X=!0,K=U7(Z);if(K!==0)V-=K*Math.pow(256,Q-J-1)}return V},CV=($)=>{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},x7=($)=>(255^$)&255,U7=($)=>(255^$)+1&255;var M5=($)=>w5.has($);var w5=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"]]),O7=new Map(Array.from(w5).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=r0($,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=b1($,Q+136,12),this.cksum=y0($,Q+148,12),X)this.#V(X,!0);if(V)this.#V(V);const J=r0($,Q+156,1);if(M5(J))this.#$=J||"0";if(this.#$==="0"&&this.path.slice(-1)==="/")this.#$="5";if(this.#$==="5")this.size=0;if(this.linkpath=r0($,Q+157,100),$.subarray(Q+257,Q+265).toString()==="ustar\x0000")if(this.uname=r0($,Q+265,32),this.gname=r0($,Q+297,32),this.devmaj=y0($,Q+329,8)??0,this.devmin=y0($,Q+337,8)??0,$[Q+475]!==0){const K=r0($,Q+345,155);this.path=K+"/"+this.path}else{const K=r0($,Q+345,130);if(K)this.path=K+"/"+this.path;this.atime=b1($,Q+476,12),this.ctime=b1($,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=DV(this.path||"",V),J=X[0],Z=X[1];if(this.needPax=!!X[2],this.needPax=o0($,Q,100,J)||this.needPax,this.needPax=m0($,Q+100,8,this.mode)||this.needPax,this.needPax=m0($,Q+108,8,this.uid)||this.needPax,this.needPax=m0($,Q+116,8,this.gid)||this.needPax,this.needPax=m0($,Q+124,12,this.size)||this.needPax,this.needPax=E1($,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=m0($,Q+329,8,this.devmaj)||this.needPax,this.needPax=m0($,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=E1($,Q+476,12,this.atime)||this.needPax,this.needPax=E1($,Q+488,12,this.ctime)||this.needPax;let K=256;for(let G=Q;G{let X=$,J="",Z=void 0;const K=w$.parse($).root||".";if(Buffer.byteLength(X)<100)Z=[X,J,!1];else{J=w$.dirname(X),X=w$.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=w$.join(w$.basename(J),X),J=w$.dirname(J);while(J!==K&&Z===void 0);if(!Z)Z=[$.slice(0,99),"",!0]}return Z},r0=($,Q,V)=>$.subarray(Q,Q+V).toString("utf8").replace(/\0.*/,""),b1=($,Q,V)=>SV(y0($,Q,V)),SV=($)=>$===void 0?void 0:new Date($*1000),y0=($,Q,V)=>Number($[Q])&128?H7($.subarray(Q,Q+V)):_V($,Q,V),NV=($)=>isNaN($)?void 0:$,_V=($,Q,V)=>NV(parseInt($.subarray(Q,Q+V).toString("utf8").replace(/\0.*$/,"").trim(),8)),RV={12:8589934591,8:2097151},m0=($,Q,V,X)=>X===void 0?!1:X>RV[V]||X<0?(v7(X,$.subarray(Q,Q+V)),!0):(gV($,Q,V,X),!1),gV=($,Q,V,X)=>$.write(kV(X,V),Q,V,"ascii"),kV=($,Q)=>yV(Math.floor($).toString(8),Q),yV=($,Q)=>($.length===Q-1?$:new Array(Q-$.length-1).join("0")+$+" ")+"\0",E1=($,Q,V,X)=>X===void 0?!1:m0($,Q,V,X.getTime()/1000),mV=new Array(156).join("\0"),o0=($,Q,V,X)=>X===void 0?!1:($.write(X+mV,Q,V,"utf8"),X.length!==Buffer.byteLength(X)||X.length>V);import{basename as bV} 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/"+bV(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(EV(hV($),Q),V)}}var EV=($,Q)=>Q?Object.assign({},Q,$):$,hV=($)=>$.replace(/\n$/,"").split("\n").reduce(uV,Object.create(null)),uV=($,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 fV=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,M=fV!=="win32"?($)=>$:($)=>$&&$.replace(/\\/g,"/");class k$ 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=M($.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?M($.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=M($.path);if($.linkpath)$.linkpath=M($.linkpath);Object.assign(this,Object.fromEntries(Object.entries($).filter(([V,X])=>{return!(X===null||X===void 0||V==="path"&&Q)})))}}var t0=($,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 lV=1048576,h1=Buffer.from([31,139]),n=Symbol("state"),e0=Symbol("writeEntry"),x0=Symbol("readEntry"),u1=Symbol("nextEntry"),C7=Symbol("processEntry"),W0=Symbol("extendedHeader"),y$=Symbol("globalExtendedHeader"),E0=Symbol("meta"),j7=Symbol("emitMeta"),v=Symbol("buffer"),U0=Symbol("queue"),h0=Symbol("ended"),f1=Symbol("emittedEnd"),$$=Symbol("emit"),T=Symbol("unzip"),A5=Symbol("consumeChunk"),I5=Symbol("consumeChunkSub"),c1=Symbol("consumeBody"),D7=Symbol("consumeMeta"),S7=Symbol("consumeHeader"),m$=Symbol("consuming"),l1=Symbol("bufferConcat"),P5=Symbol("maybeEnd"),A$=Symbol("writing"),u0=Symbol("aborted"),F5=Symbol("onDone"),Q$=Symbol("sawValidEntry"),v5=Symbol("sawNullBlock"),H5=Symbol("sawEOF"),N7=Symbol("closeStream"),dV=()=>!0;class f0 extends cV{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[U0]=new z0;[v];[x0];[e0];[n]="begin";[E0]="";[W0];[y$];[h0]=!1;[T];[u0]=!1;[Q$];[v5]=!1;[H5]=!1;[A$]=!1;[m$]=!1;[f1]=!1;constructor($={}){super();if(this.file=$.file||"",this.on(F5,()=>{if(this[n]==="begin"||this[Q$]===!1)this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),$.ondone)this.on(F5,$.ondone);else this.on(F5,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")});this.strict=!!$.strict,this.maxMetaEntrySize=$.maxMetaEntrySize||lV,this.filter=typeof $.filter==="function"?$.filter:dV;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[N7]()),typeof $.onwarn==="function")this.on("warn",$.onwarn);if(typeof $.onReadEntry==="function")this.on("entry",$.onReadEntry)}warn($,Q,V={}){t0(this,$,Q,V)}[S7]($,Q){if(this[Q$]===void 0)this[Q$]=!1;let V;try{V=new a($,Q,this[W0],this[y$])}catch(X){return this.warn("TAR_ENTRY_INVALID",X)}if(V.nullBlock)if(this[v5]){if(this[H5]=!0,this[n]==="begin")this[n]="header";this[$$]("eof")}else this[v5]=!0,this[$$]("nullBlock");else if(this[v5]=!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[e0]=new k$(V,this[W0],this[y$]);if(!this[Q$])if(J.remain){const Z=()=>{if(!J.invalid)this[Q$]=!0};J.on("end",Z)}else this[Q$]=!0;if(J.meta){if(J.size>this.maxMetaEntrySize)J.ignore=!0,this[$$]("ignoredEntry",J),this[n]="ignore",J.resume();else if(J.size>0)this[E0]="",J.on("data",(Z)=>this[E0]+=Z),this[n]="meta"}else if(this[W0]=void 0,J.ignore=J.ignore||!this.filter(J.path,J),J.ignore)this[$$]("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[x0])this[U0].push(J),this[u1]();else this[U0].push(J)}}}}[N7](){queueMicrotask(()=>this.emit("close"))}[C7]($){let Q=!0;if(!$)this[x0]=void 0,Q=!1;else if(Array.isArray($)){const[V,...X]=$;this.emit(V,...X)}else if(this[x0]=$,this.emit("entry",$),!$.emittedEnd)$.on("end",()=>this[u1]()),Q=!1;return Q}[u1](){do;while(this[C7](this[U0].shift()));if(!this[U0].length){const $=this[x0];if(!$||$.flowing||$.size===$.remain){if(!this[A$])this.emit("drain")}else $.once("drain",()=>this.emit("drain"))}}[c1]($,Q){const V=this[e0];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[e0]=void 0,V.end();return J.length}[D7]($,Q){const V=this[e0],X=this[c1]($,Q);if(!this[e0]&&V)this[j7](V);return X}[$$]($,Q,V){if(!this[U0].length&&!this[x0])this.emit($,Q,V);else this[U0].push([$,Q,V])}[j7]($){switch(this[$$]("meta",this[E0]),$.type){case"ExtendedHeader":case"OldExtendedHeader":this[W0]=b0.parse(this[E0],this[W0],!1);break;case"GlobalExtendedHeader":this[y$]=b0.parse(this[E0],this[y$],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const Q=this[W0]??Object.create(null);this[W0]=Q,Q.path=this[E0].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const Q=this[W0]||Object.create(null);this[W0]=Q,Q.linkpath=this[E0].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[T]===void 0||this.brotli===void 0&&this[T]===!1)&&$){if(this[v])$=Buffer.concat([this[v],$]),this[v]=void 0;if($.lengththis[A5](Y)),this[T].on("error",(Y)=>this.abort(Y)),this[T].on("end",()=>{this[h0]=!0,this[A5]()}),this[A$]=!0;const G=!!this[T][K?"end":"write"]($);return this[A$]=!1,V?.(),G}}if(this[A$]=!0,this[T])this[T].write($);else this[A5]($);this[A$]=!1;const J=this[U0].length?!1:this[x0]?this[x0].flowing:!0;if(!J&&!this[U0].length)this[x0]?.once("drain",()=>this.emit("drain"));return V?.(),J}[l1]($){if($&&!this[u0])this[v]=this[v]?Buffer.concat([this[v],$]):$}[P5](){if(this[h0]&&!this[f1]&&!this[u0]&&!this[m$]){this[f1]=!0;const $=this[e0];if($&&$.blockRemain){const Q=this[v]?this[v].length:0;if(this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${$.blockRemain} more bytes, only ${Q} available)`,{entry:$}),this[v])$.write(this[v]);$.end()}this[$$](F5)}}[A5]($){if(this[m$]&&$)this[l1]($);else if(!$&&!this[v])this[P5]();else if($){if(this[m$]=!0,this[v]){this[l1]($);const Q=this[v];this[v]=void 0,this[I5](Q)}else this[I5]($);while(this[v]&&this[v]?.length>=512&&!this[u0]&&!this[H5]){const Q=this[v];this[v]=void 0,this[I5](Q)}this[m$]=!1}if(!this[v]||this[h0])this[P5]()}[I5]($){let Q=0;const V=$.length;while(Q+512<=V&&!this[u0]&&!this[H5])switch(this[n]){case"begin":case"header":this[S7]($,Q),Q+=512;break;case"ignore":case"body":Q+=this[c1]($,Q);break;case"meta":Q+=this[D7]($,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 aV=($)=>{const Q=$.onReadEntry;$.onReadEntry=Q?(V)=>{Q(V),V.resume()}:(V)=>V.resume()},d1=($,Q)=>{const V=new Map(Q.map((Z)=>[q0(Z),!0])),X=$.filter,J=(Z,K="")=>{const G=K||pV(Z).root||".";let Y;if(Z===G)Y=!1;else{const W=V.get(Z);if(W!==void 0)Y=W;else Y=J(iV(Z),G)}return V.set(Z,Y),Y};$.filter=X?(Z,K)=>X(Z,K)&&J(q0(Z)):(Z)=>J(q0(Z))},nV=($)=>{const Q=new f0($),V=$.file;let X;try{const J=I$.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),I$.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M$(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},O0=Y0(nV,sV,($)=>new f0($),($)=>new f0($),($,Q)=>{if(Q?.length)d1($,Q);if(!$.noResume)aV($)});import R5 from"fs";import B0 from"fs";import k7 from"path";var i1=($,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:oV,parse:_7}=rV,b$=($)=>{let Q="",V=_7($);while(oV($)||V.root){const X=$.charAt(0)==="/"&&$.slice(0,4)!=="//?/"?"/":V.root;$=$.slice(X.length),Q+=X,V=_7($)}return[Q,$]};var x5=["|","<",">","?",":"],p1=x5.map(($)=>String.fromCharCode(61440+$.charCodeAt(0))),tV=new Map(x5.map(($,Q)=>[$,p1[Q]])),eV=new Map(p1.map(($,Q)=>[$,x5[Q]])),a1=($)=>x5.reduce((Q,V)=>Q.split(V).join(tV.get(V)),$),R7=($)=>p1.reduce((Q,V)=>Q.split(V).join(eV.get(V)),$);var h7=($,Q)=>{if(!Q)return M($);return $=M($).replace(/^\.(\/|$)/,""),q0(Q)+"/"+$},$X=16777216,y7=Symbol("process"),m7=Symbol("file"),b7=Symbol("directory"),s1=Symbol("symlink"),E7=Symbol("hardlink"),E$=Symbol("header"),U5=Symbol("read"),r1=Symbol("lstat"),O5=Symbol("onlstat"),o1=Symbol("onread"),t1=Symbol("onreadlink"),e1=Symbol("openfile"),$8=Symbol("onopenfile"),c0=Symbol("close"),T5=Symbol("mode"),Q8=Symbol("awaitDrain"),n1=Symbol("ondrain"),L0=Symbol("prefix");class C5 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=R$(Q);super();if(this.path=M($),this.portable=!!V.portable,this.maxReadSize=V.maxReadSize||$X,this.linkCache=V.linkCache||new Map,this.statCache=V.statCache||new Map,this.preservePaths=!!V.preservePaths,this.cwd=M(V.cwd||process.cwd()),this.strict=!!V.strict,this.noPax=!!V.noPax,this.noMtime=!!V.noMtime,this.mtime=V.mtime,this.prefix=V.prefix?M(V.prefix):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let X=!1;if(!this.preservePaths){const[Z,K]=b$(this.path);if(Z&&typeof K==="string")this.path=K,X=Z}if(this.win32=!!V.win32||process.platform==="win32",this.win32)this.path=R7(this.path.replace(/\\/g,"/")),$=$.replace(/\\/g,"/");if(this.absolute=M(V.absolute||k7.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[O5](J);else this[r1]()}warn($,Q,V={}){return t0(this,$,Q,V)}emit($,...Q){if($==="error")this.#$=!0;return super.emit($,...Q)}[r1](){B0.lstat(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[O5](Q)})}[O5]($){if(this.statCache.set(this.absolute,$),this.stat=$,!$.isFile())$.size=0;this.type=QX($),this.emit("stat",$),this[y7]()}[y7](){switch(this.type){case"File":return this[m7]();case"Directory":return this[b7]();case"SymbolicLink":return this[s1]();default:return this.end()}}[T5]($){return i1($,this.type==="Directory",this.portable)}[L0]($){return h7($,this.prefix)}[E$](){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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](this.linkpath):this.linkpath,mode:this[T5](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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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($)}[b7](){if(!this.stat)throw new Error("cannot create directory entry without stat");if(this.path.slice(-1)!=="/")this.path+="/";this.stat.size=0,this[E$](),this.end()}[s1](){B0.readlink(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[t1](Q)})}[t1]($){this.linkpath=M($),this[E$](),this.end()}[E7]($){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=M(k7.relative(this.cwd,$)),this.stat.size=0,this[E$](),this.end()}[m7](){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[E7](Q);this.linkCache.set($,this.absolute)}if(this[E$](),this.stat.size===0)return this.end();this[e1]()}[e1](){B0.open(this.absolute,"r",($,Q)=>{if($)return this.emit("error",$);this[$8](Q)})}[$8]($){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[U5]()}[U5](){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");B0.read($,Q,V,X,J,(Z,K)=>{if(Z)return this[c0](()=>this.emit("error",Z));this[o1](K)})}[c0]($=()=>{}){if(this.fd!==void 0)B0.close(this.fd,$)}[o1]($){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[n1]());else this[n1]()}[Q8]($){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)}[n1](){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[U5]()}}class V8 extends C5{sync=!0;[r1](){this[O5](B0.lstatSync(this.absolute))}[s1](){this[t1](B0.readlinkSync(this.absolute))}[e1](){this[$8](B0.openSync(this.absolute,"r"))}[U5](){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=B0.readSync(Q,V,X,J,Z);this[o1](K),$=!1}finally{if($)try{this[c0](()=>{})}catch(Q){}}}[Q8]($){$()}[c0]($=()=>{}){if(this.fd!==void 0)B0.closeSync(this.fd);$()}}class X8 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 t0(this,$,Q,V)}constructor($,Q={}){const V=R$(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=M($.path),this.mode=$.mode!==void 0?this[T5]($.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?M($.linkpath):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let J=!1;if(!this.preservePaths){const[K,G]=b$(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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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)}[L0]($){return h7($,this.prefix)}[T5]($){return i1($,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 QX=($)=>$.isFile()?"File":$.isDirectory()?"Directory":$.isSymbolicLink()?"SymbolicLink":"Unsupported";import d7 from"path";class G8{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor($,Q){this.path=$||"./",this.absolute=Q}}var u7=Buffer.alloc(1024),j5=Symbol("onStat"),h$=Symbol("ended"),X0=Symbol("queue"),P$=Symbol("current"),V$=Symbol("process"),u$=Symbol("processing"),f7=Symbol("processJob"),J0=Symbol("jobs"),J8=Symbol("jobDone"),D5=Symbol("addFSEntry"),c7=Symbol("addTarEntry"),Y8=Symbol("stat"),z8=Symbol("readdir"),S5=Symbol("onreaddir"),N5=Symbol("pipe"),l7=Symbol("entry"),Z8=Symbol("entryOpt"),_5=Symbol("writeEntryClass"),i7=Symbol("write"),K8=Symbol("ondrain");class X$ extends c{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[_5];onWriteEntry;[X0];[J0]=0;[u$]=!1;[h$]=!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=M($.prefix||""),this.linkCache=$.linkCache||new Map,this.statCache=$.statCache||new Map,this.readdirCache=$.readdirCache||new Map,this.onWriteEntry=$.onWriteEntry,this[_5]=C5,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 R1($.gzip)}if($.brotli){if(typeof $.brotli!=="object")$.brotli={};this.zip=new y1($.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[K8]()),this.on("resume",()=>Q.resume())}else this.on("drain",this[K8]);if(this.noDirRecurse=!!$.noDirRecurse,this.follow=!!$.follow,this.noMtime=!!$.noMtime,$.mtime)this.mtime=$.mtime;this.filter=typeof $.filter==="function"?$.filter:()=>!0,this[X0]=new z0,this[J0]=0,this.jobs=Number($.jobs)||4,this[u$]=!1,this[h$]=!1}[i7]($){return super.write($)}add($){return this.write($),this}end($){if($)this.add($);return this[h$]=!0,this[V$](),this}write($){if(this[h$])throw new Error("write after end");if($ instanceof k$)this[c7]($);else this[D5]($);return this.flowing}[c7]($){const Q=M(d7.resolve(this.cwd,$.path));if(!this.filter($.path,$))$.resume();else{const V=new G8($.path,Q);V.entry=new X8($,this[Z8](V)),V.entry.on("end",()=>this[J8](V)),this[J0]+=1,this[X0].push(V)}this[V$]()}[D5]($){const Q=M(d7.resolve(this.cwd,$));this[X0].push(new G8($,Q)),this[V$]()}[Y8]($){$.pending=!0,this[J0]+=1;const Q=this.follow?"stat":"lstat";R5[Q]($.absolute,(V,X)=>{if($.pending=!1,this[J0]-=1,V)this.emit("error",V);else this[j5]($,X)})}[j5]($,Q){if(this.statCache.set($.absolute,Q),$.stat=Q,!this.filter($.path,Q))$.ignore=!0;this[V$]()}[z8]($){$.pending=!0,this[J0]+=1,R5.readdir($.absolute,(Q,V)=>{if($.pending=!1,this[J0]-=1,Q)return this.emit("error",Q);this[S5]($,V)})}[S5]($,Q){this.readdirCache.set($.absolute,Q),$.readdir=Q,this[V$]()}[V$](){if(this[u$])return;this[u$]=!0;for(let $=this[X0].head;!!$&&this[J0]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}}[l7]($){this[J0]+=1;try{const Q=new this[_5]($.path,this[Z8]($));return this.onWriteEntry?.(Q),Q.on("end",()=>this[J8]($)).on("error",(V)=>this.emit("error",V))}catch(Q){this.emit("error",Q)}}[K8](){if(this[P$]&&this[P$].entry)this[P$].entry.resume()}[N5]($){if($.piped=!0,$.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[D5](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={}){t0(this,$,Q,V)}}class F$ extends X${sync=!0;constructor($){super($);this[_5]=V8}pause(){}resume(){}[Y8]($){const Q=this.follow?"statSync":"lstatSync";this[j5]($,R5[Q]($.absolute))}[z8]($){this[S5]($,R5.readdirSync($.absolute))}[N5]($){const Q=$.entry,V=this.zip;if($.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[D5](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[i7](X)})}}var VX=($,Q)=>{const V=new F$($),X=new _$($.file,{mode:$.mode||438});V.pipe(X),a7(V,Q)},XX=($,Q)=>{const V=new X$($),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 n7(V,Q),J},a7=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")O0({file:p7.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},n7=async($,Q)=>{for(let V=0;V{$.add(J)}});else $.add(X)}$.end()},JX=($,Q)=>{const V=new F$($);return a7(V,Q),V},ZX=($,Q)=>{const V=new X$($);return n7(V,Q),V},KX=Y0(VX,XX,JX,ZX,($,Q)=>{if(!Q?.length)throw new TypeError("no paths specified to add to archive")});import A4 from"node:fs";import gX from"node:assert";import{randomBytes as w4} from"node:crypto";import A from"node:fs";import C0 from"node:path";import s7 from"fs";var GX=process.env.__FAKE_PLATFORM__||process.platform,YX=GX==="win32",{O_CREAT:zX,O_TRUNC:WX,O_WRONLY:qX}=s7.constants,r7=Number(process.env.__FAKE_FS_O_FILENAME__)||s7.constants.UV_FS_O_FILEMAP||0,BX=YX&&!!r7,LX=524288,MX=r7|WX|zX|qX,W8=!BX?()=>"w":($)=>${try{return k5.lchownSync($,Q,V)}catch(X){if(X?.code!=="ENOENT")throw X}},g5=($,Q,V,X)=>{k5.lchown($,Q,V,(J)=>{X(J&&J?.code!=="ENOENT"?J:null)})},wX=($,Q,V,X,J)=>{if(Q.isDirectory())B8(f$.resolve($,Q.name),V,X,(Z)=>{if(Z)return J(Z);const K=f$.resolve($,Q.name);g5(K,V,X,J)});else{const Z=f$.resolve($,Q.name);g5(Z,V,X,J)}},B8=($,Q,V,X)=>{k5.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 g5($,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 g5($,Q,V,X)};for(let W of Z)wX($,W,Q,V,Y)})},AX=($,Q,V,X)=>{if(Q.isDirectory())L8(f$.resolve($,Q.name),V,X);q8(f$.resolve($,Q.name),V,X)},L8=($,Q,V)=>{let X;try{X=k5.readdirSync($,{withFileTypes:!0})}catch(J){const Z=J;if(Z?.code==="ENOENT")return;else if(Z?.code==="ENOTDIR"||Z?.code==="ENOTSUP")return q8($,Q,V);else throw Z}for(let J of X)AX($,J,Q,V);return q8($,Q,V)};import r from"fs";import{dirname as o7} from"path";import{mkdir as IX,mkdirSync as PX,stat as FX,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||IX,$.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||FX,$.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||PX,Q};var M0=($,Q,V)=>{const X=o7($),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 M0($,J,M0(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=o7($);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:M0});import{dirname as e7} from"path";import{dirname as t7} from"path";var M8=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"?M8($,t7(Q),Q):void 0})},w8=($,Q,V)=>{if(V===Q)return;try{return $.statSync(Q).isDirectory()?V:void 0}catch(X){const J=X;return J&&J.code==="ENOENT"?w8($,t7(Q),Q):void 0}};var v$=($,Q)=>{const V=s(Q);if(V.recursive=!0,e7($)===$)return V.mkdirSync($,V);const J=w8(V,$);try{return V.mkdirSync($,V),J}catch(Z){const K=Z;if(K&&K.code==="ENOENT")return M0($,V);else throw Z}},c$=Object.assign(async($,Q)=>{const V={...s(Q),recursive:!0};if(e7($)===$)return await V.mkdirAsync($,V);return M8(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:v$});import{parse as xX,resolve as UX} from"path";var HX=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,A8=($)=>{if(/\0/.test($))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:$,code:"ERR_INVALID_ARG_VALUE"});if($=UX($),HX==="win32"){const Q=/[*|"<>?:]/,{root:V}=xX($);if(Q.test($.substring(V.length)))throw Object.assign(new Error("Illegal characters in path."),{path:$,code:"EINVAL"})}return $};import{mkdir as OX,mkdirSync as TX} from"fs";var CX=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,I8=CX.replace(/^v/,"").split("."),$4=+I8[0]>10||+I8[0]===10&&+I8[1]>=12,l$=!$4?()=>!1:($)=>s($).mkdirSync===TX,y5=Object.assign(!$4?()=>!1:($)=>s($).mkdir===OX,{sync:l$});var m5=($,Q)=>{$=A8($);const V=s(Q);return l$(V)?v$($,V):M0($,V)};var Q4=Object.assign(async($,Q)=>{$=A8($);const V=s(Q);return y5(V)?c$($,V):T0($,V)},{mkdirpSync:m5,mkdirpNative:c$,mkdirpNativeSync:v$,mkdirpManual:T0,mkdirpManualSync:M0,sync:m5,native:c$,nativeSync:v$,manual:T0,manualSync:M0,useNative:y5,useNativeSync:l$});import h5 from"node:path";class b5 extends Error{path;code;syscall="chdir";constructor($,Q){super(`${Q}: Cannot cd into '${$}'`);this.path=$,this.code=Q}get name(){return"CwdError"}}class E5 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 u5=($,Q)=>$.get(M(Q)),d$=($,Q,V)=>$.set(M(Q),V),jX=($,Q)=>{r.stat($,(V,X)=>{if(V||!X.isDirectory())V=new b5($,V?.code||"ENOTDIR");Q(V)})},V4=($,Q,V)=>{$=M($);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,L=M(Q.cwd),U=(b,D)=>{if(b)V(b);else if(d$(q,$,!0),D&&Y)B8(D,K,G,(S8)=>U(S8));else if(Z)r.chmod($,J,V);else V()};if(q&&u5(q,$)===!0)return U();if($===L)return jX($,U);if(W)return Q4($,{mode:J}).then((b)=>U(null,b??void 0),U);const j=M(h5.relative(L,$)).split("/");f5(L,j,J,q,z,L,void 0,U)},f5=($,Q,V,X,J,Z,K,G)=>{if(!Q.length)return G(null,K);const Y=Q.shift(),W=M(h5.resolve($+"/"+Y));if(u5(X,W))return f5(W,Q,V,X,J,Z,K,G);r.mkdir(W,V,X4(W,Q,V,X,J,Z,K,G))},X4=($,Q,V,X,J,Z,K,G)=>(Y)=>{if(Y)r.lstat($,(W,z)=>{if(W)W.path=W.path&&M(W.path),G(W);else if(z.isDirectory())f5($,Q,V,X,J,Z,K,G);else if(J)r.unlink($,(q)=>{if(q)return G(q);r.mkdir($,V,X4($,Q,V,X,J,Z,K,G))});else if(z.isSymbolicLink())return G(new E5($,$+"/"+Q.join("/")));else G(Y)});else K=K||$,f5($,Q,V,X,J,Z,K,G)},DX=($)=>{let Q=!1,V=void 0;try{Q=r.statSync($).isDirectory()}catch(X){V=X?.code}finally{if(!Q)throw new b5($,V??"ENOTDIR")}},J4=($,Q)=>{$=M($);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=M(Q.cwd),L=(b)=>{if(d$(z,$,!0),b&&G)L8(b,Z,K);if(J)r.chmodSync($,X)};if(z&&u5(z,$)===!0)return L();if($===q)return DX(q),L();if(Y)return L(m5($,X)??void 0);const C=M(h5.relative(q,$)).split("/");let j=void 0;for(let b=C.shift(),D=q;b&&(D+="/"+b);b=C.shift()){if(D=M(h5.resolve(D)),u5(z,D))continue;try{r.mkdirSync(D,X),j=j||D,d$(z,D,!0)}catch(S8){const N8=r.lstatSync(D);if(N8.isDirectory()){d$(z,D,!0);continue}else if(W){r.unlinkSync(D),r.mkdirSync(D,X),j=j||D,d$(z,D,!0);continue}else if(N8.isSymbolicLink())return new E5(D,D+"/"+C.join("/"))}}return L(j)};var P8=Object.create(null),{hasOwnProperty:SX}=Object.prototype,c5=($)=>{if(!SX.call(P8,$))P8[$]=$.normalize("NFD");return P8[$]};import{join as Z4} from"node:path";var NX=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,_X=NX==="win32",RX=($)=>{return $.split("/").slice(0,-1).reduce((V,X)=>{const J=V[V.length-1];if(J!==void 0)X=Z4(J,X);return V.push(X||"/"),V},[])};class F8{#$=new Map;#V=new Map;#X=new Set;reserve($,Q){$=_X?["win32 parallelization disabled"]:$.map((X)=>{return q0(Z4(c5(X))).toLowerCase()});const V=new Set($.map((X)=>RX(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 K4=Symbol("onEntry"),x8=Symbol("checkFs"),G4=Symbol("checkFs2"),i5=Symbol("pruneCache"),U8=Symbol("isReusable"),o=Symbol("makeFs"),O8=Symbol("file"),T8=Symbol("directory"),p5=Symbol("link"),Y4=Symbol("symlink"),z4=Symbol("hardlink"),W4=Symbol("unsupported"),q4=Symbol("checkPath"),l0=Symbol("mkdir"),k=Symbol("onError"),l5=Symbol("pending"),B4=Symbol("pend"),H$=Symbol("unpend"),v8=Symbol("ended"),H8=Symbol("maybeClose"),C8=Symbol("skip"),i$=Symbol("doChown"),p$=Symbol("uid"),a$=Symbol("gid"),n$=Symbol("checkedCwd"),kX=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,s$=kX==="win32",yX=1024,mX=($,Q)=>{if(!s$)return A.unlink($,Q);const V=$+".DELETE."+w4(16).toString("hex");A.rename($,V,(X)=>{if(X)return Q(X);A.unlink(V,Q)})},bX=($)=>{if(!s$)return A.unlinkSync($);const Q=$+".DELETE."+w4(16).toString("hex");A.renameSync($,Q),A.unlinkSync(Q)},L4=($,Q,V)=>$!==void 0&&$===$>>>0?$:Q!==void 0&&Q===Q>>>0?Q:V,M4=($)=>q0(M(c5($))).toLowerCase(),EX=($,Q)=>{Q=M4(Q);for(let V of $.keys()){const X=M4(V);if(X===Q||X.indexOf(Q+"/")===0)$.delete(V)}},hX=($)=>{for(let Q of $.keys())$.delete(Q)};class r$ extends f0{[v8]=!1;[n$]=!1;[l5]=0;reservations=new F8;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[v8]=!0,this[H8]()};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:yX,this.forceChown=$.forceChown===!0,this.win32=!!$.win32||s$,this.newer=!!$.newer,this.keep=!!$.keep,this.noMtime=!!$.noMtime,this.preservePaths=!!$.preservePaths,this.unlink=!!$.unlink,this.cwd=M(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[K4](Q))}warn($,Q,V={}){if($==="TAR_BAD_ARCHIVE"||$==="TAR_ABORT")V.recoverable=!1;return super.warn($,Q,V)}[H8](){if(this[v8]&&this[l5]===0)this.emit("prefinish"),this.emit("finish"),this.emit("end")}[q4]($){const Q=M($.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("..")||s$&&/^[a-z]:\.\.$/i.test(V[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:$,path:Q}),!1;const[X,J]=b$(Q);if(X)$.path=String(J),this.warn("TAR_ENTRY_INFO",`stripping ${X} from absolute path`,{entry:$,path:Q})}if(C0.isAbsolute($.path))$.absolute=M(C0.resolve($.path));else $.absolute=M(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:M($.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+a1(String($.absolute).slice(X.length));const{root:J}=C0.win32.parse($.path);$.path=J+a1($.path.slice(J.length))}return!0}[K4]($){if(!this[q4]($))return $.resume();switch(gX.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[x8]($);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[W4]($)}}[k]($,Q){if($.name==="CwdError")this.emit("error",$);else this.warn("TAR_ENTRY_ERROR",$,{entry:Q}),this[H$](),Q.resume()}[l0]($,Q,V){V4(M($),{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)}[i$]($){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}[p$]($){return L4(this.uid,$.uid,this.processUid)}[a$]($){return L4(this.gid,$.gid,this.processGid)}[O8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=new g0(String($.absolute),{flags:W8($.size),mode:V,autoClose:!1});X.on("error",(G)=>{if(X.fd)A.close(X.fd,()=>{});X.write=()=>!0,this[k](G,$),Q()});let J=1;const Z=(G)=>{if(G){if(X.fd)A.close(X.fd,()=>{});this[k](G,$),Q();return}if(--J===0){if(X.fd!==void 0)A.close(X.fd,(Y)=>{if(Y)this[k](Y,$);else this[H$]();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;A.futimes(Y,W,z,(q)=>q?A.utimes(G,W,z,(L)=>Z(L&&q)):Z())}if(typeof Y==="number"&&this[i$]($)){J++;const W=this[p$]($),z=this[a$]($);if(typeof W==="number"&&typeof z==="number")A.fchown(Y,W,z,(q)=>q?A.chown(G,W,z,(L)=>Z(L&&q)):Z())}Z()});const K=this.transform?this.transform($)||$:$;if(K!==$)K.on("error",(G)=>{this[k](G,$),Q()}),$.pipe(K);K.pipe(X)}[T8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode;this[l0](String($.absolute),V,(X)=>{if(X){this[k](X,$),Q();return}let J=1;const Z=()=>{if(--J===0)Q(),this[H$](),$.resume()};if($.mtime&&!this.noMtime)J++,A.utimes(String($.absolute),$.atime||new Date,$.mtime,Z);if(this[i$]($))J++,A.chown(String($.absolute),Number(this[p$]($)),Number(this[a$]($)),Z);Z()})}[W4]($){$.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${$.type}`,{entry:$}),$.resume()}[Y4]($,Q){this[p5]($,String($.linkpath),"symlink",Q)}[z4]($,Q){const V=M(C0.resolve(this.cwd,String($.linkpath)));this[p5]($,V,"link",Q)}[B4](){this[l5]++}[H$](){this[l5]--,this[H8]()}[C8]($){this[H$](),$.resume()}[U8]($,Q){return $.type==="File"&&!this.unlink&&Q.isFile()&&Q.nlink<=1&&!s$}[x8]($){this[B4]();const Q=[$.path];if($.linkpath)Q.push($.linkpath);this.reservations.reserve(Q,(V)=>this[G4]($,V))}[i5]($){if($.type==="SymbolicLink")hX(this.dirCache);else if($.type!=="Directory")EX(this.dirCache,String($.absolute))}[G4]($,Q){this[i5]($);const V=(K)=>{this[i5]($),Q(K)},X=()=>{this[l0](this.cwd,this.dmode,(K)=>{if(K){this[k](K,$),V();return}this[n$]=!0,J()})},J=()=>{if($.absolute!==this.cwd){const K=M(C0.dirname(String($.absolute)));if(K!==this.cwd)return this[l0](K,this.dmode,(G)=>{if(G){this[k](G,$),V();return}Z()})}Z()},Z=()=>{A.lstat(String($.absolute),(K,G)=>{if(G&&(this.keep||this.newer&&G.mtime>($.mtime??G.mtime))){this[C8]($),V();return}if(K||this[U8]($,G))return this[o](null,$,V);if(G.isDirectory()){if($.type==="Directory"){const Y=this.chmod&&$.mode&&(G.mode&4095)!==$.mode,W=(z)=>this[o](z??null,$,V);if(!Y)return W();return A.chmod(String($.absolute),Number($.mode),W)}if($.absolute!==this.cwd)return A.rmdir(String($.absolute),(Y)=>this[o](Y??null,$,V))}if($.absolute===this.cwd)return this[o](null,$,V);mX(String($.absolute),(Y)=>this[o](Y??null,$,V))})};if(this[n$])J();else X()}[o]($,Q,V){if($){this[k]($,Q),V();return}switch(Q.type){case"File":case"OldFile":case"ContiguousFile":return this[O8](Q,V);case"Link":return this[z4](Q,V);case"SymbolicLink":return this[Y4](Q,V);case"Directory":case"GNUDumpDir":return this[T8](Q,V)}}[p5]($,Q,V,X){A[V](Q,String($.absolute),(J)=>{if(J)this[k](J,$);else this[H$](),$.resume();X()})}}var d5=($)=>{try{return[null,$()]}catch(Q){return[Q,null]}};class a5 extends r${sync=!0;[o]($,Q){return super[o]($,Q,()=>{})}[x8]($){if(this[i5]($),!this[n$]){const J=this[l0](this.cwd,this.dmode);if(J)return this[k](J,$);this[n$]=!0}if($.absolute!==this.cwd){const J=M(C0.dirname(String($.absolute)));if(J!==this.cwd){const Z=this[l0](J,this.dmode);if(Z)return this[k](Z,$)}}const[Q,V]=d5(()=>A.lstatSync(String($.absolute)));if(V&&(this.keep||this.newer&&V.mtime>($.mtime??V.mtime)))return this[C8]($);if(Q||this[U8]($,V))return this[o](null,$);if(V.isDirectory()){if($.type==="Directory"){const Z=this.chmod&&$.mode&&(V.mode&4095)!==$.mode,[K]=Z?d5(()=>{A.chmodSync(String($.absolute),Number($.mode))}):[];return this[o](K,$)}const[J]=d5(()=>A.rmdirSync(String($.absolute)));this[o](J,$)}const[X]=$.absolute===this.cwd?[]:d5(()=>bX(String($.absolute)));this[o](X,$)}[O8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=(K)=>{let G;try{A.closeSync(J)}catch(Y){G=Y}if(K||G)this[k](K||G,$);Q()};let J;try{J=A.openSync(String($.absolute),W8($.size),V)}catch(K){return X(K)}const Z=this.transform?this.transform($)||$:$;if(Z!==$)Z.on("error",(K)=>this[k](K,$)),$.pipe(Z);Z.on("data",(K)=>{try{A.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{A.futimesSync(J,G,Y)}catch(W){try{A.utimesSync(String($.absolute),G,Y)}catch(z){K=W}}}if(this[i$]($)){const G=this[p$]($),Y=this[a$]($);try{A.fchownSync(J,Number(G),Number(Y))}catch(W){try{A.chownSync(String($.absolute),Number(G),Number(Y))}catch(z){K=K||W}}}X(K)})}[T8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode,X=this[l0](String($.absolute),V);if(X){this[k](X,$),Q();return}if($.mtime&&!this.noMtime)try{A.utimesSync(String($.absolute),$.atime||new Date,$.mtime)}catch(J){}if(this[i$]($))try{A.chownSync(String($.absolute),Number(this[p$]($)),Number(this[a$]($)))}catch(J){}Q(),$.resume()}[l0]($,Q){try{return J4(M($),{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}}[p5]($,Q,V,X){const J=`${V}Sync`;try{A[J](Q,String($.absolute)),X(),$.resume()}catch(Z){return this[k](Z,$)}}}var uX=($)=>{const Q=new a5($),V=$.file,X=A4.statSync(V),J=$.maxReadSize||16777216;new C1(V,{readSize:J,size:X.size}).pipe(Q)},fX=($,Q)=>{const V=new r$($),X=$.maxReadSize||16777216,J=$.file;return new Promise((K,G)=>{V.on("error",G),V.on("close",K),A4.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M$(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},j8=Y0(uX,fX,($)=>new a5($),($)=>new r$($),($,Q)=>{if(Q?.length)d1($,Q)});import l from"node:fs";import I4 from"node:path";var cX=($,Q)=>{const V=new F$($);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,lX($,V,Z,J,Q)}finally{if(X)try{l.closeSync(J)}catch(K){}}},lX=($,Q,V,X,J)=>{const Z=new _$($.file,{fd:X,start:V});Q.pipe(Z),iX(Q,J)},dX=($,Q)=>{Q=Array.from(Q);const V=new X$($),X=(Z,K,G)=>{const Y=(U,C)=>{if(U)l.close(Z,(j)=>G(U));else G(null,C)};let W=0;if(K===0)return Y(null,0);let z=0;const q=Buffer.alloc(512),L=(U,C)=>{if(U||typeof C==="undefined")return Y(U);if(z+=C,z<512&&C)return l.read(Z,q,z,q.length-z,W+z,L);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 j=new a(q);if(!j.cksumValid)return Y(null,W);const b=512*Math.ceil((j.size??0)/512);if(W+b+512>K)return Y(null,W);if(W+=b+512,W>=K)return Y(null,W);if($.mtimeCache&&j.mtime)$.mtimeCache.set(String(j.path),j.mtime);z=0,l.read(Z,q,0,512,W,L)};l.read(Z,q,0,512,W,L)};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,L)=>{if(q)return l.close(z,()=>K(q));X(z,L.size,(U,C)=>{if(U)return K(U);const j=new g0($.file,{fd:z,start:C});V.pipe(j),j.on("error",K),j.on("close",Z),pX(V,Q)})})};l.open($.file,G,Y)})},iX=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")O0({file:I4.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},pX=async($,Q)=>{for(let V=0;V$.add(J)});else $.add(X)}$.end()},J$=Y0(cX,dX,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},($,Q)=>{if(!P7($))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 aX=Y0(J$.syncFile,J$.asyncFile,J$.syncNoFile,J$.asyncNoFile,($,Q=[])=>{J$.validate?.($,Q),nX($)}),nX=($)=>{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))};async function eX($,Q,V){w.info(`Starting download from URL: ${$}`);const J=`beat-forge/init-beatsaber@${P4().version}`;w.info(`User-Agent: ${J}`);const Z=await fetch($,{headers:{"User-Agent":J,Authorization:`token ${V}`}});if(!Z.ok)throw w.error(`Failed to download file: ${Z.statusText}`),new Error(`Failed to download file: ${Z.statusText}`);w.info(`Response status: ${Z.status}`),w.info(`Response headers: ${JSON.stringify(Z.headers.raw())}`),await d0.mkdir(F4(Q),{recursive:!0}),w.info(`Directory created for output path: ${F4(Q)}`);const K=oX(Q),G=Z.body?.getReader();if(!G)throw w.error("Failed to get reader from response body"),new Error("Failed to get reader from response body");w.info("Starting to read and write file stream"),await(async()=>{while(!0){const{done:W,value:z}=await G.read();if(W)break;if(z)K.write(z)}K.close()})(),w.info("File downloaded and written successfully")}async function $J($,Q){w.info(`Extracting tarball from ${$} to ${Q}`),await d0.mkdir(Q,{recursive:!0}),w.info(`Directory created for extraction: ${Q}`),w.info(`Listing contents of tarball: ${$}`),await O0({file:$,onentry:(V)=>{w.info(`Tarball entry: ${V.path}`)}}),await j8({file:$,cwd:Q}),w.info("Extraction completed successfully")}async function v4($,Q){w.info(`Moving contents from ${$} to ${Q}`);try{await d0.mkdir(Q,{recursive:!0});const V=await d0.readdir($,{withFileTypes:!0});w.info(`Files to move: ${V.map((X)=>X.name).join(", ")}`);for(let X of V){const J=D8($,X.name),Z=D8(Q,X.name);if(X.isDirectory())await v4(J,Z);else await d0.rename(J,Z);w.info(`Moved ${J} to ${Z}`)}}catch(V){throw w.error(`Failed to move contents from ${$} to ${Q}`),w.error(`Error details: ${V}`),V}w.info("Content move completed successfully")}async function QJ(){try{w.info("Initializing Beat Saber references...");const $=w.getInput("token",{required:!0}),Q=w.getInput("version",{required:!0}),V=w.getInput("path")||"./Refs",X=w.getInput("repo")||"beat-forge/beatsaber-stripped",J=w.getInput("host")||"github.com";w.info(`Inputs: token=${$}, version=${Q}, path=${V}, repo=${X}, host=${J}`);const[Z,K]=X.split("/");if(!Z||!K)throw w.error("Repository input is invalid. Expected format {owner}/{repo}."),new Error("Repository input is invalid. Expected format {owner}/{repo}.");const G=`version/${Q}`,Y=`https://${J}/${Z}/${K}/archive/refs/heads/${G}.tar.gz`,W=`./${K}-${G}.tar.gz`,z=`./${K}-${G}`,q=tX(V);w.info(`Calculated paths: archiveUrl=${Y}, tarballPath=${W}, extractPath=${z}, refsPath=${q}`);const L=await d0.readdir(".");w.info(`${process.cwd()} contents: ${L.join(", ")}`),w.info(`Downloading ${Y} to ${W}...`),await eX(Y,W,$),w.info(`Extracting ${W} to ${z}...`),await $J(W,z),w.info(`Moving 'data' folder contents from ${z} to ${q}...`),await v4(D8(z,"data"),q),w.info("Cleaning up..."),await d0.rm(W),await d0.rm(z,{recursive:!0}),w.info("Cleanup completed successfully")}catch($){w.error(`An error occurred: ${$}`),w.setFailed($ instanceof Error?$.message:"An unknown error occurred")}}QJ(); + 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 s9(this,void 0,void 0,function*(){try{let Q=Z$.getIDTokenUrl();if($){const X=encodeURIComponent($);Q=`${Q}&audience=${X}`}r9.debug(`ID token url is ${Q}`);const V=yield Z$.getCall(Q);return r9.setSecret(V),V}catch(Q){throw new Error(`Error message: ${Q.message}`)}})}}K$.OidcClient=Z$});var z1=F((E)=>{var G1=E&&E.__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(E,"__esModule",{value:!0});E.summary=E.markdownSummary=E.SUMMARY_DOCS_URL=E.SUMMARY_ENV_VAR=void 0;var xQ=O("os"),Y1=O("fs"),{access:UQ,appendFile:OQ,writeFile:TQ}=Y1.promises;E.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";E.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";class t9{constructor(){this._buffer=""}filePath(){return G1(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;const $=process.env[E.SUMMARY_ENV_VAR];if(!$)throw new Error(`Unable to find environment variable for \$${E.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield UQ($,Y1.constants.R_OK|Y1.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 G1(this,void 0,void 0,function*(){const Q=!!($===null||$===void 0?void 0:$.overwrite),V=yield this.filePath();return yield(Q?TQ:OQ)(V,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return G1(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(xQ.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 e9=new t9;E.markdownSummary=e9;E.summary=e9});var $7=F((h)=>{var NQ=function($){return $.replace(/[\\]/g,"/")},_Q=function($){return $.replace(/[/]/g,"\\")},RQ=function($){return $.replace(/[/\\]/g,SQ.sep)},CQ=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]}),jQ=h&&h.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),DQ=h&&h.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))CQ(Q,$,V)}return jQ(Q,$),Q};Object.defineProperty(h,"__esModule",{value:!0});h.toPlatformPath=h.toWin32Path=h.toPosixPath=void 0;var SQ=DQ(O("path"));h.toPosixPath=NQ;h.toWin32Path=_Q;h.toPlatformPath=RQ});var K1=F((B)=>{var bQ=function($,Q){const V=G$.toCommandValue(Q);if(process.env[$]=V,process.env.GITHUB_ENV||"")return i0.issueFileCommand("ENV",i0.prepareKeyValueMessage($,Q));p.issueCommand("set-env",{name:$},V)},EQ=function($){p.issueCommand("add-mask",{},$)},hQ=function($){if(process.env.GITHUB_PATH||"")i0.issueFileCommand("PATH",$);else p.issueCommand("add-path",{},$);process.env.PATH=`${$}${yQ.delimiter}${process.env.PATH}`},W1=function($,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()},uQ=function($,Q){const V=W1($,Q).split("\n").filter((X)=>X!=="");if(Q&&Q.trimWhitespace===!1)return V;return V.map((X)=>X.trim())},fQ=function($,Q){const V=["true","True","TRUE"],X=["false","False","FALSE"],J=W1($,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\``)},cQ=function($,Q){if(process.env.GITHUB_OUTPUT||"")return i0.issueFileCommand("OUTPUT",i0.prepareKeyValueMessage($,Q));process.stdout.write(X7.EOL),p.issueCommand("set-output",{name:$},G$.toCommandValue(Q))},lQ=function($){p.issue("echo",$?"on":"off")},dQ=function($){process.exitCode=J7.Failure,Z7($)},iQ=function(){return process.env.RUNNER_DEBUG==="1"},pQ=function($){p.issueCommand("debug",{},$)},Z7=function($,Q={}){p.issueCommand("error",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},aQ=function($,Q={}){p.issueCommand("warning",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},nQ=function($,Q={}){p.issueCommand("notice",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},sQ=function($){process.stdout.write($+X7.EOL)},K7=function($){p.issue("group",$)},G7=function(){p.issue("endgroup")},rQ=function($,Q){return V7(this,void 0,void 0,function*(){K7($);let V;try{V=yield Q()}finally{G7()}return V})},oQ=function($,Q){if(process.env.GITHUB_STATE||"")return i0.issueFileCommand("STATE",i0.prepareKeyValueMessage($,Q));p.issueCommand("save-state",{name:$},G$.toCommandValue(Q))},tQ=function($){return process.env[`STATE_${$}`]||""},eQ=function($){return V7(this,void 0,void 0,function*(){return yield mQ.OidcClient.getIDToken($)})},gQ=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]}),kQ=B&&B.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),Q7=B&&B.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))gQ(Q,$,V)}return kQ(Q,$),Q},V7=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=E8(),i0=g9(),G$=o$(),X7=Q7(O("os")),yQ=Q7(O("path")),mQ=o9(),J7;(function($){$[$.Success=0]="Success",$[$.Failure=1]="Failure"})(J7=B.ExitCode||(B.ExitCode={}));B.exportVariable=bQ;B.setSecret=EQ;B.addPath=hQ;B.getInput=W1;B.getMultilineInput=uQ;B.getBooleanInput=fQ;B.setOutput=cQ;B.setCommandEcho=lQ;B.setFailed=dQ;B.isDebug=iQ;B.debug=pQ;B.error=Z7;B.warning=aQ;B.notice=nQ;B.info=sQ;B.startGroup=K7;B.endGroup=G7;B.group=rQ;B.saveState=oQ;B.getState=tQ;B.getIDToken=eQ;var $V=z1();Object.defineProperty(B,"summary",{enumerable:!0,get:function(){return $V.summary}});var QV=z1();Object.defineProperty(B,"markdownSummary",{enumerable:!0,get:function(){return QV.markdownSummary}});var q1=$7();Object.defineProperty(B,"toPosixPath",{enumerable:!0,get:function(){return q1.toPosixPath}});Object.defineProperty(B,"toWin32Path",{enumerable:!0,get:function(){return q1.toWin32Path}});Object.defineProperty(B,"toPlatformPath",{enumerable:!0,get:function(){return q1.toPlatformPath}})});var P4=F((b3,rX)=>{rX.exports={name:"init-beatsaber",description:"A GitHub Action to initialize a Beat Saber modding environment",version:"1.5.0",author:"BeatForge",private:!0,type:"module",homepage:"https://github.com/beat-forge/init-beatsaber",repository:{type:"git",url:"git+https://github.com/beat-forge/init-beatsaber.git"},bugs:{url:"https://github.com/beat-forge/init-beatsaber/issues"},main:"dist/index.js",engines:{node:">=20"},scripts:{all:"bun run format:write && bun run package","package:node":"bun build --target=node ./src/index.ts --outfile=dist/index.js --minify","package:bun":"bun build --target=bun ./src/index.ts --outfile=dist/index.js --minify","format:write":"prettier --write \"**/*.{ts,tsx}\"",bundle:"bun run format:write && bun run package:node"},license:"AGPL-3.0",dependencies:{"@actions/core":"^1.10.1","@actions/github":"^5.1.1",tar:"^7.4.0"},devDependencies:{"@types/node":"^20.14.10","bun-types":"^1.1.20",prettier:"^3.3.3",typescript:"^5.5.3"}}});var w=T4(K1(),1);import{promises as d0,createWriteStream as oX} from"fs";import{dirname as F4,join as D8,resolve as tX} from"path";import BV from"events";import u from"fs";import{EventEmitter as I1} from"node:events";import B7 from"node:stream";import{StringDecoder as VV} from"node:string_decoder";var Y7=typeof process==="object"&&process?process:{stdout:null,stderr:null},XV=($)=>!!$&&typeof $==="object"&&($ instanceof c||$ instanceof B7||JV($)||ZV($)),JV=($)=>!!$&&typeof $==="object"&&$ instanceof I1&&typeof $.pipe==="function"&&$.pipe!==B7.Writable.prototype.pipe,ZV=($)=>!!$&&typeof $==="object"&&$ instanceof I1&&typeof $.write==="function"&&typeof $.end==="function",I0=Symbol("EOF"),P0=Symbol("maybeEmitEnd"),S0=Symbol("emittedEnd"),Z5=Symbol("emittingEnd"),O$=Symbol("emittedError"),K5=Symbol("closed"),z7=Symbol("read"),G5=Symbol("flush"),W7=Symbol("flushChunk"),$0=Symbol("encoding"),Y$=Symbol("decoder"),S=Symbol("flowing"),T$=Symbol("paused"),z$=Symbol("resume"),N=Symbol("buffer"),m=Symbol("pipes"),_=Symbol("bufferLength"),B1=Symbol("bufferPush"),Y5=Symbol("bufferShift"),g=Symbol("objectMode"),x=Symbol("destroyed"),L1=Symbol("error"),M1=Symbol("emitData"),q7=Symbol("emitEnd"),w1=Symbol("emitEnd2"),K0=Symbol("async"),A1=Symbol("abort"),z5=Symbol("aborted"),C$=Symbol("signal"),p0=Symbol("dataListeners"),f=Symbol("discarded"),j$=($)=>Promise.resolve().then($),KV=($)=>$(),GV=($)=>$==="end"||$==="finish"||$==="prefinish",YV=($)=>$ instanceof ArrayBuffer||!!$&&typeof $==="object"&&$.constructor&&$.constructor.name==="ArrayBuffer"&&$.byteLength>=0,zV=($)=>!Buffer.isBuffer($)&&ArrayBuffer.isView($);class P1{src;dest;opts;ondrain;constructor($,Q,V){this.src=$,this.dest=Q,this.opts=V,this.ondrain=()=>$[z$](),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 L7 extends P1{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 WV=($)=>!!$.objectMode,qV=($)=>!$.objectMode&&!!$.encoding&&$.encoding!=="buffer";class c extends I1{[S]=!1;[T$]=!1;[m]=[];[N]=[];[g];[$0];[K0];[Y$];[I0]=!1;[S0]=!1;[Z5]=!1;[K5]=!1;[O$]=null;[_]=0;[x]=!1;[C$];[z5]=!1;[p0]=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(WV(Q))this[g]=!0,this[$0]=null;else if(qV(Q))this[$0]=Q.encoding,this[g]=!1;else this[g]=!1,this[$0]=null;if(this[K0]=!!Q.async,this[Y$]=this[$0]?new VV(this[$0]):null,Q&&Q.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[N]});if(Q&&Q.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[m]});const{signal:V}=Q;if(V)if(this[C$]=V,V.aborted)this[A1]();else V.addEventListener("abort",()=>this[A1]())}get bufferLength(){return this[_]}get encoding(){return this[$0]}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[g]}set objectMode($){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[K0]}set["async"]($){this[K0]=this[K0]||!!$}[A1](){this[z5]=!0,this.emit("abort",this[C$]?.reason),this.destroy(this[C$]?.reason)}get aborted(){return this[z5]}set aborted($){}write($,Q,V){if(this[z5])return!1;if(this[I0])throw new Error("write after end");if(this[x])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[K0]?j$:KV;if(!this[g]&&!Buffer.isBuffer($)){if(zV($))$=Buffer.from($.buffer,$.byteOffset,$.byteLength);else if(YV($))$=Buffer.from($);else if(typeof $!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[g]){if(this[S]&&this[_]!==0)this[G5](!0);if(this[S])this.emit("data",$);else this[B1]($);if(this[_]!==0)this.emit("readable");if(V)X(V);return this[S]}if(!$.length){if(this[_]!==0)this.emit("readable");if(V)X(V);return this[S]}if(typeof $==="string"&&!(Q===this[$0]&&!this[Y$]?.lastNeed))$=Buffer.from($,Q);if(Buffer.isBuffer($)&&this[$0])$=this[Y$].write($);if(this[S]&&this[_]!==0)this[G5](!0);if(this[S])this.emit("data",$);else this[B1]($);if(this[_]!==0)this.emit("readable");if(V)X(V);return this[S]}read($){if(this[x])return null;if(this[f]=!1,this[_]===0||$===0||$&&$>this[_])return this[P0](),null;if(this[g])$=null;if(this[N].length>1&&!this[g])this[N]=[this[$0]?this[N].join(""):Buffer.concat(this[N],this[_])];const Q=this[z7]($||null,this[N][0]);return this[P0](),Q}[z7]($,Q){if(this[g])this[Y5]();else{const V=Q;if($===V.length||$===null)this[Y5]();else if(typeof V==="string")this[N][0]=V.slice($),Q=V.slice(0,$),this[_]-=$;else this[N][0]=V.subarray($),Q=V.subarray(0,$),this[_]-=$}if(this.emit("data",Q),!this[N].length&&!this[I0])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[I0]=!0,this.writable=!1,this[S]||!this[T$])this[P0]();return this}[z$](){if(this[x])return;if(!this[p0]&&!this[m].length)this[f]=!0;if(this[T$]=!1,this[S]=!0,this.emit("resume"),this[N].length)this[G5]();else if(this[I0])this[P0]();else this.emit("drain")}resume(){return this[z$]()}pause(){this[S]=!1,this[T$]=!0,this[f]=!1}get destroyed(){return this[x]}get flowing(){return this[S]}get paused(){return this[T$]}[B1]($){if(this[g])this[_]+=1;else this[_]+=$.length;this[N].push($)}[Y5](){if(this[g])this[_]-=1;else this[_]-=this[N][0].length;return this[N].shift()}[G5]($=!1){do;while(this[W7](this[Y5]())&&this[N].length);if(!$&&!this[N].length&&!this[I0])this.emit("drain")}[W7]($){return this.emit("data",$),this[S]}pipe($,Q){if(this[x])return $;this[f]=!1;const V=this[S0];if(Q=Q||{},$===Y7.stdout||$===Y7.stderr)Q.end=!1;else Q.end=Q.end!==!1;if(Q.proxyErrors=!!Q.proxyErrors,V){if(Q.end)$.end()}else if(this[m].push(!Q.proxyErrors?new P1(this,$,Q):new L7(this,$,Q)),this[K0])j$(()=>this[z$]());else this[z$]();return $}unpipe($){const Q=this[m].find((V)=>V.dest===$);if(Q){if(this[m].length===1){if(this[S]&&this[p0]===0)this[S]=!1;this[m]=[]}else this[m].splice(this[m].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[p0]++,!this[m].length&&!this[S])this[z$]()}else if($==="readable"&&this[_]!==0)super.emit("readable");else if(GV($)&&this[S0])super.emit($),this.removeAllListeners($);else if($==="error"&&this[O$]){const X=Q;if(this[K0])j$(()=>X.call(this,this[O$]));else X.call(this,this[O$])}return V}removeListener($,Q){return this.off($,Q)}off($,Q){const V=super.off($,Q);if($==="data"){if(this[p0]=this.listeners("data").length,this[p0]===0&&!this[f]&&!this[m].length)this[S]=!1}return V}removeAllListeners($){const Q=super.removeAllListeners($);if($==="data"||$===void 0){if(this[p0]=0,!this[f]&&!this[m].length)this[S]=!1}return Q}get emittedEnd(){return this[S0]}[P0](){if(!this[Z5]&&!this[S0]&&!this[x]&&this[N].length===0&&this[I0]){if(this[Z5]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[K5])this.emit("close");this[Z5]=!1}}emit($,...Q){const V=Q[0];if($!=="error"&&$!=="close"&&$!==x&&this[x])return!1;else if($==="data")return!this[g]&&!V?!1:this[K0]?(j$(()=>this[M1](V)),!0):this[M1](V);else if($==="end")return this[q7]();else if($==="close"){if(this[K5]=!0,!this[S0]&&!this[x])return!1;const J=super.emit("close");return this.removeAllListeners("close"),J}else if($==="error"){this[O$]=V,super.emit(L1,V);const J=!this[C$]||this.listeners("error").length?super.emit("error",V):!1;return this[P0](),J}else if($==="resume"){const J=super.emit("resume");return this[P0](),J}else if($==="finish"||$==="prefinish"){const J=super.emit($);return this.removeAllListeners($),J}const X=super.emit($,...Q);return this[P0](),X}[M1]($){for(let V of this[m])if(V.dest.write($)===!1)this.pause();const Q=this[f]?!1:super.emit("data",$);return this[P0](),Q}[q7](){if(this[S0])return!1;return this[S0]=!0,this.readable=!1,this[K0]?(j$(()=>this[w1]()),!0):this[w1]()}[w1](){if(this[Y$]){const Q=this[Y$].end();if(Q){for(let V of this[m])V.dest.write(Q);if(!this[f])super.emit("data",Q)}}for(let Q of this[m])Q.end();const $=super.emit("end");return this.removeAllListeners("end"),$}async collect(){const $=Object.assign([],{dataLength:0});if(!this[g])$.dataLength=0;const Q=this.promise();return this.on("data",(V)=>{if($.push(V),!this[g])$.dataLength+=V.length}),await Q,$}async concat(){if(this[g])throw new Error("cannot concat in objectMode");const $=await this.collect();return this[$0]?$.join(""):Buffer.concat($,$.dataLength)}async promise(){return new Promise(($,Q)=>{this.on(x,()=>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[I0])return Q();let J,Z;const K=(z)=>{this.off("data",G),this.off("end",Y),this.off(x,W),Q(),Z(z)},G=(z)=>{this.off("error",K),this.off("end",Y),this.off(x,W),this.pause(),J({value:z,done:!!this[I0]})},Y=()=>{this.off("error",K),this.off("data",G),this.off(x,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(x,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(L1,Q),this.off(x,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(L1,Q),this.once(x,Q),{next:V,throw:Q,return:Q,[Symbol.iterator](){return this}}}destroy($){if(this[x]){if($)this.emit("error",$);else this.emit(x);return this}this[x]=!0,this[f]=!0,this[N].length=0,this[_]=0;const Q=this;if(typeof Q.close==="function"&&!this[K5])Q.close();if($)this.emit("error",$);else this.emit(x);return this}static get isStream(){return XV}}var LV=u.writev,_0=Symbol("_autoClose"),V0=Symbol("_close"),D$=Symbol("_ended"),I=Symbol("_fd"),F1=Symbol("_finished"),v0=Symbol("_flags"),v1=Symbol("_flush"),O1=Symbol("_handleChunk"),T1=Symbol("_makeBuf"),N$=Symbol("_mode"),W5=Symbol("_needDrain"),B$=Symbol("_onerror"),L$=Symbol("_onopen"),H1=Symbol("_onread"),W$=Symbol("_onwrite"),R0=Symbol("_open"),Q0=Symbol("_path"),N0=Symbol("_pos"),G0=Symbol("_queue"),q$=Symbol("_read"),x1=Symbol("_readSize"),F0=Symbol("_reading"),S$=Symbol("_remain"),U1=Symbol("_size"),q5=Symbol("_write"),a0=Symbol("_writing"),B5=Symbol("_defaultFlag"),n0=Symbol("_errored");class M$ extends c{[n0]=!1;[I];[Q0];[x1];[F0]=!1;[U1];[S$];[_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[n0]=!1,this[I]=typeof Q.fd==="number"?Q.fd:void 0,this[Q0]=$,this[x1]=Q.readSize||16777216,this[F0]=!1,this[U1]=typeof Q.size==="number"?Q.size:1/0,this[S$]=this[U1],this[_0]=typeof Q.autoClose==="boolean"?Q.autoClose:!0,typeof this[I]==="number")this[q$]();else this[R0]()}get fd(){return this[I]}get path(){return this[Q0]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[R0](){u.open(this[Q0],"r",($,Q)=>this[L$]($,Q))}[L$]($,Q){if($)this[B$]($);else this[I]=Q,this.emit("open",Q),this[q$]()}[T1](){return Buffer.allocUnsafe(Math.min(this[x1],this[S$]))}[q$](){if(!this[F0]){this[F0]=!0;const $=this[T1]();if($.length===0)return process.nextTick(()=>this[H1](null,0,$));u.read(this[I],$,0,$.length,null,(Q,V,X)=>this[H1](Q,V,X))}}[H1]($,Q,V){if(this[F0]=!1,$)this[B$]($);else if(this[O1](Q,V))this[q$]()}[V0](){if(this[_0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}[B$]($){this[F0]=!0,this[V0](),this.emit("error",$)}[O1]($,Q){let V=!1;if(this[S$]-=$,$>0)V=super.write($this[L$]($,Q))}[L$]($,Q){if(this[B5]&&this[v0]==="r+"&&$&&$.code==="ENOENT")this[v0]="w",this[R0]();else if($)this[B$]($);else if(this[I]=Q,this.emit("open",Q),!this[a0])this[v1]()}end($,Q){if($)this.write($,Q);if(this[D$]=!0,!this[a0]&&!this[G0].length&&typeof this[I]==="number")this[W$](null,0);return this}write($,Q){if(typeof $==="string")$=Buffer.from($,Q);if(this[D$])return this.emit("error",new Error("write() after end()")),!1;if(this[I]===void 0||this[a0]||this[G0].length)return this[G0].push($),this[W5]=!0,!1;return this[a0]=!0,this[q5]($),!0}[q5]($){u.write(this[I],$,0,$.length,this[N0],(Q,V)=>this[W$](Q,V))}[W$]($,Q){if($)this[B$]($);else{if(this[N0]!==void 0&&typeof Q==="number")this[N0]+=Q;if(this[G0].length)this[v1]();else if(this[a0]=!1,this[D$]&&!this[F1])this[F1]=!0,this[V0](),this.emit("finish");else if(this[W5])this[W5]=!1,this.emit("drain")}}[v1](){if(this[G0].length===0){if(this[D$])this[W$](null,0)}else if(this[G0].length===1)this[q5](this[G0].pop());else{const $=this[G0];this[G0]=[],LV(this[I],$,this[N0],(Q,V)=>this[W$](Q,V))}}[V0](){if(this[_0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}}class _$ extends g0{[R0](){let $;if(this[B5]&&this[v0]==="r+")try{$=u.openSync(this[Q0],this[v0],this[N$])}catch(Q){if(Q?.code==="ENOENT")return this[v0]="w",this[R0]();else throw Q}else $=u.openSync(this[Q0],this[v0],this[N$]);this[L$](null,$)}[V0](){if(this[_0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.closeSync($),this.emit("close")}}[q5]($){let Q=!0;try{this[W$](null,u.writeSync(this[I],$,0,$.length,this[N0])),Q=!1}finally{if(Q)try{this[V0]()}catch{}}}}import p7 from"node:path";import I$ from"node:fs";import{dirname as iV,parse as pV} from"path";var MV=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"]]),M7=($)=>!!$.sync&&!!$.file,w7=($)=>!$.sync&&!!$.file,A7=($)=>!!$.sync&&!$.file,I7=($)=>!$.sync&&!$.file;var P7=($)=>!!$.file;var wV=($)=>{const Q=MV.get($);if(Q)return Q;return $},R$=($={})=>{if(!$)return{};const Q={};for(let[V,X]of Object.entries($)){const J=wV(V);Q[J]=X}if(Q.chmod===void 0&&Q.noChmod===!1)Q.chmod=!0;return delete Q.noChmod,Q};var Y0=($,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=R$(Z);if(J?.(Y,K),M7(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return $(Y,K)}else if(w7(Y)){const W=Q(Y,K),z=G?G:void 0;return z?W.then(()=>z(),z):W}else if(A7(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return V(Y,K)}else if(I7(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 cV} from"events";import S1 from"assert";import{Buffer as k0} from"buffer";import PV from"zlib";import AV from"zlib";var IV=AV.constants||{ZLIB_VERNUM:4736},H0=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},IV));var F7=k0.concat,s0=Symbol("_superWrite");class g$ 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 D1=Symbol("flushFlag");class N1 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 PV[Q]($)}catch(V){throw new g$(V)}this.#K=(V)=>{if(this.#$)return;this.#$=!0,this.close(),this.emit("error",V)},this.#Q?.on("error",(V)=>this.#K(new g$(V))),this.once("end",()=>this.close)}close(){if(this.#Q)this.#Q.close(),this.#Q=void 0,this.emit("close")}reset(){if(!this.#$)return S1(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),{[D1]:$}))}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}[s0]($){return super.write($)}write($,Q,V){if(typeof Q==="function")V=Q,Q="utf8";if(typeof $==="string")$=k0.from($,Q);if(this.#$)return;S1(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 $[D1]==="number"?$[D1]:this.#X;K=this.#Q._processChunk($,Y),k0.concat=F7}catch(Y){k0.concat=F7,this.#K(new g$(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 g$(Y)));let G;if(K)if(Array.isArray(K)&&K.length>0){const Y=K[0];G=this[s0](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 R1 extends _1{#$;constructor($){super($,"Gzip");this.#$=$&&!!$.portable}[s0]($){if(!this.#$)return super[s0]($);return this.#$=!1,$[9]=255,super[s0]($)}}class g1 extends _1{constructor($){super($,"Unzip")}}class k1 extends N1{constructor($,Q){$=$||{},$.flush=$.flush||H0.BROTLI_OPERATION_PROCESS,$.finishFlush=$.finishFlush||H0.BROTLI_OPERATION_FINISH,$.fullFlushFlag=H0.BROTLI_OPERATION_FLUSH;super($,Q)}}class y1 extends k1{constructor($){super($,"BrotliCompress")}}class m1 extends k1{constructor($){super($,"BrotliDecompress")}}var vV=function($,Q,V){const X=Q,J=Q?Q.next:$.head,Z=new L5(V,X,J,$);if(Z.next===void 0)$.tail=Z;if(Z.prev===void 0)$.head=Z;return $.length++,Z},HV=function($,Q){if($.tail=new L5(Q,$.tail,void 0,$),!$.head)$.head=$.tail;$.length++},xV=function($,Q){if($.head=new L5(Q,void 0,$.head,$),!$.tail)$.tail=$.head;$.length++};class z0{tail;head;length=0;static create($=[]){return new z0($)}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 z0;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)OV($,Q);else UV($,Q);return Q},UV=($,Q)=>{Q[0]=128;for(var V=Q.length;V>1;V--)Q[V-1]=$&255,$=Math.floor($/256)},OV=($,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]=x7(J);else if(J===0)Q[X-1]=0;else V=!0,Q[X-1]=U7(J)}},H7=($)=>{const Q=$[0],V=Q===128?CV($.subarray(1,$.length)):Q===255?TV($):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},TV=($)=>{var Q=$.length,V=0,X=!1;for(var J=Q-1;J>-1;J--){var Z=Number($[J]),K;if(X)K=x7(Z);else if(Z===0)K=Z;else X=!0,K=U7(Z);if(K!==0)V-=K*Math.pow(256,Q-J-1)}return V},CV=($)=>{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},x7=($)=>(255^$)&255,U7=($)=>(255^$)+1&255;var M5=($)=>w5.has($);var w5=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"]]),O7=new Map(Array.from(w5).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=r0($,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=b1($,Q+136,12),this.cksum=y0($,Q+148,12),X)this.#V(X,!0);if(V)this.#V(V);const J=r0($,Q+156,1);if(M5(J))this.#$=J||"0";if(this.#$==="0"&&this.path.slice(-1)==="/")this.#$="5";if(this.#$==="5")this.size=0;if(this.linkpath=r0($,Q+157,100),$.subarray(Q+257,Q+265).toString()==="ustar\x0000")if(this.uname=r0($,Q+265,32),this.gname=r0($,Q+297,32),this.devmaj=y0($,Q+329,8)??0,this.devmin=y0($,Q+337,8)??0,$[Q+475]!==0){const K=r0($,Q+345,155);this.path=K+"/"+this.path}else{const K=r0($,Q+345,130);if(K)this.path=K+"/"+this.path;this.atime=b1($,Q+476,12),this.ctime=b1($,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=DV(this.path||"",V),J=X[0],Z=X[1];if(this.needPax=!!X[2],this.needPax=o0($,Q,100,J)||this.needPax,this.needPax=m0($,Q+100,8,this.mode)||this.needPax,this.needPax=m0($,Q+108,8,this.uid)||this.needPax,this.needPax=m0($,Q+116,8,this.gid)||this.needPax,this.needPax=m0($,Q+124,12,this.size)||this.needPax,this.needPax=E1($,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=m0($,Q+329,8,this.devmaj)||this.needPax,this.needPax=m0($,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=E1($,Q+476,12,this.atime)||this.needPax,this.needPax=E1($,Q+488,12,this.ctime)||this.needPax;let K=256;for(let G=Q;G{let X=$,J="",Z=void 0;const K=w$.parse($).root||".";if(Buffer.byteLength(X)<100)Z=[X,J,!1];else{J=w$.dirname(X),X=w$.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=w$.join(w$.basename(J),X),J=w$.dirname(J);while(J!==K&&Z===void 0);if(!Z)Z=[$.slice(0,99),"",!0]}return Z},r0=($,Q,V)=>$.subarray(Q,Q+V).toString("utf8").replace(/\0.*/,""),b1=($,Q,V)=>SV(y0($,Q,V)),SV=($)=>$===void 0?void 0:new Date($*1000),y0=($,Q,V)=>Number($[Q])&128?H7($.subarray(Q,Q+V)):_V($,Q,V),NV=($)=>isNaN($)?void 0:$,_V=($,Q,V)=>NV(parseInt($.subarray(Q,Q+V).toString("utf8").replace(/\0.*$/,"").trim(),8)),RV={12:8589934591,8:2097151},m0=($,Q,V,X)=>X===void 0?!1:X>RV[V]||X<0?(v7(X,$.subarray(Q,Q+V)),!0):(gV($,Q,V,X),!1),gV=($,Q,V,X)=>$.write(kV(X,V),Q,V,"ascii"),kV=($,Q)=>yV(Math.floor($).toString(8),Q),yV=($,Q)=>($.length===Q-1?$:new Array(Q-$.length-1).join("0")+$+" ")+"\0",E1=($,Q,V,X)=>X===void 0?!1:m0($,Q,V,X.getTime()/1000),mV=new Array(156).join("\0"),o0=($,Q,V,X)=>X===void 0?!1:($.write(X+mV,Q,V,"utf8"),X.length!==Buffer.byteLength(X)||X.length>V);import{basename as bV} 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/"+bV(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(EV(hV($),Q),V)}}var EV=($,Q)=>Q?Object.assign({},Q,$):$,hV=($)=>$.replace(/\n$/,"").split("\n").reduce(uV,Object.create(null)),uV=($,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 fV=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,M=fV!=="win32"?($)=>$:($)=>$&&$.replace(/\\/g,"/");class k$ 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=M($.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?M($.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=M($.path);if($.linkpath)$.linkpath=M($.linkpath);Object.assign(this,Object.fromEntries(Object.entries($).filter(([V,X])=>{return!(X===null||X===void 0||V==="path"&&Q)})))}}var t0=($,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 lV=1048576,h1=Buffer.from([31,139]),n=Symbol("state"),e0=Symbol("writeEntry"),x0=Symbol("readEntry"),u1=Symbol("nextEntry"),C7=Symbol("processEntry"),W0=Symbol("extendedHeader"),y$=Symbol("globalExtendedHeader"),E0=Symbol("meta"),j7=Symbol("emitMeta"),v=Symbol("buffer"),U0=Symbol("queue"),h0=Symbol("ended"),f1=Symbol("emittedEnd"),$$=Symbol("emit"),T=Symbol("unzip"),A5=Symbol("consumeChunk"),I5=Symbol("consumeChunkSub"),c1=Symbol("consumeBody"),D7=Symbol("consumeMeta"),S7=Symbol("consumeHeader"),m$=Symbol("consuming"),l1=Symbol("bufferConcat"),P5=Symbol("maybeEnd"),A$=Symbol("writing"),u0=Symbol("aborted"),F5=Symbol("onDone"),Q$=Symbol("sawValidEntry"),v5=Symbol("sawNullBlock"),H5=Symbol("sawEOF"),N7=Symbol("closeStream"),dV=()=>!0;class f0 extends cV{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[U0]=new z0;[v];[x0];[e0];[n]="begin";[E0]="";[W0];[y$];[h0]=!1;[T];[u0]=!1;[Q$];[v5]=!1;[H5]=!1;[A$]=!1;[m$]=!1;[f1]=!1;constructor($={}){super();if(this.file=$.file||"",this.on(F5,()=>{if(this[n]==="begin"||this[Q$]===!1)this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),$.ondone)this.on(F5,$.ondone);else this.on(F5,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")});this.strict=!!$.strict,this.maxMetaEntrySize=$.maxMetaEntrySize||lV,this.filter=typeof $.filter==="function"?$.filter:dV;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[N7]()),typeof $.onwarn==="function")this.on("warn",$.onwarn);if(typeof $.onReadEntry==="function")this.on("entry",$.onReadEntry)}warn($,Q,V={}){t0(this,$,Q,V)}[S7]($,Q){if(this[Q$]===void 0)this[Q$]=!1;let V;try{V=new a($,Q,this[W0],this[y$])}catch(X){return this.warn("TAR_ENTRY_INVALID",X)}if(V.nullBlock)if(this[v5]){if(this[H5]=!0,this[n]==="begin")this[n]="header";this[$$]("eof")}else this[v5]=!0,this[$$]("nullBlock");else if(this[v5]=!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[e0]=new k$(V,this[W0],this[y$]);if(!this[Q$])if(J.remain){const Z=()=>{if(!J.invalid)this[Q$]=!0};J.on("end",Z)}else this[Q$]=!0;if(J.meta){if(J.size>this.maxMetaEntrySize)J.ignore=!0,this[$$]("ignoredEntry",J),this[n]="ignore",J.resume();else if(J.size>0)this[E0]="",J.on("data",(Z)=>this[E0]+=Z),this[n]="meta"}else if(this[W0]=void 0,J.ignore=J.ignore||!this.filter(J.path,J),J.ignore)this[$$]("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[x0])this[U0].push(J),this[u1]();else this[U0].push(J)}}}}[N7](){queueMicrotask(()=>this.emit("close"))}[C7]($){let Q=!0;if(!$)this[x0]=void 0,Q=!1;else if(Array.isArray($)){const[V,...X]=$;this.emit(V,...X)}else if(this[x0]=$,this.emit("entry",$),!$.emittedEnd)$.on("end",()=>this[u1]()),Q=!1;return Q}[u1](){do;while(this[C7](this[U0].shift()));if(!this[U0].length){const $=this[x0];if(!$||$.flowing||$.size===$.remain){if(!this[A$])this.emit("drain")}else $.once("drain",()=>this.emit("drain"))}}[c1]($,Q){const V=this[e0];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[e0]=void 0,V.end();return J.length}[D7]($,Q){const V=this[e0],X=this[c1]($,Q);if(!this[e0]&&V)this[j7](V);return X}[$$]($,Q,V){if(!this[U0].length&&!this[x0])this.emit($,Q,V);else this[U0].push([$,Q,V])}[j7]($){switch(this[$$]("meta",this[E0]),$.type){case"ExtendedHeader":case"OldExtendedHeader":this[W0]=b0.parse(this[E0],this[W0],!1);break;case"GlobalExtendedHeader":this[y$]=b0.parse(this[E0],this[y$],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const Q=this[W0]??Object.create(null);this[W0]=Q,Q.path=this[E0].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const Q=this[W0]||Object.create(null);this[W0]=Q,Q.linkpath=this[E0].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[T]===void 0||this.brotli===void 0&&this[T]===!1)&&$){if(this[v])$=Buffer.concat([this[v],$]),this[v]=void 0;if($.lengththis[A5](Y)),this[T].on("error",(Y)=>this.abort(Y)),this[T].on("end",()=>{this[h0]=!0,this[A5]()}),this[A$]=!0;const G=!!this[T][K?"end":"write"]($);return this[A$]=!1,V?.(),G}}if(this[A$]=!0,this[T])this[T].write($);else this[A5]($);this[A$]=!1;const J=this[U0].length?!1:this[x0]?this[x0].flowing:!0;if(!J&&!this[U0].length)this[x0]?.once("drain",()=>this.emit("drain"));return V?.(),J}[l1]($){if($&&!this[u0])this[v]=this[v]?Buffer.concat([this[v],$]):$}[P5](){if(this[h0]&&!this[f1]&&!this[u0]&&!this[m$]){this[f1]=!0;const $=this[e0];if($&&$.blockRemain){const Q=this[v]?this[v].length:0;if(this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${$.blockRemain} more bytes, only ${Q} available)`,{entry:$}),this[v])$.write(this[v]);$.end()}this[$$](F5)}}[A5]($){if(this[m$]&&$)this[l1]($);else if(!$&&!this[v])this[P5]();else if($){if(this[m$]=!0,this[v]){this[l1]($);const Q=this[v];this[v]=void 0,this[I5](Q)}else this[I5]($);while(this[v]&&this[v]?.length>=512&&!this[u0]&&!this[H5]){const Q=this[v];this[v]=void 0,this[I5](Q)}this[m$]=!1}if(!this[v]||this[h0])this[P5]()}[I5]($){let Q=0;const V=$.length;while(Q+512<=V&&!this[u0]&&!this[H5])switch(this[n]){case"begin":case"header":this[S7]($,Q),Q+=512;break;case"ignore":case"body":Q+=this[c1]($,Q);break;case"meta":Q+=this[D7]($,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 aV=($)=>{const Q=$.onReadEntry;$.onReadEntry=Q?(V)=>{Q(V),V.resume()}:(V)=>V.resume()},d1=($,Q)=>{const V=new Map(Q.map((Z)=>[q0(Z),!0])),X=$.filter,J=(Z,K="")=>{const G=K||pV(Z).root||".";let Y;if(Z===G)Y=!1;else{const W=V.get(Z);if(W!==void 0)Y=W;else Y=J(iV(Z),G)}return V.set(Z,Y),Y};$.filter=X?(Z,K)=>X(Z,K)&&J(q0(Z)):(Z)=>J(q0(Z))},nV=($)=>{const Q=new f0($),V=$.file;let X;try{const J=I$.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),I$.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M$(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},O0=Y0(nV,sV,($)=>new f0($),($)=>new f0($),($,Q)=>{if(Q?.length)d1($,Q);if(!$.noResume)aV($)});import R5 from"fs";import B0 from"fs";import k7 from"path";var i1=($,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:oV,parse:_7}=rV,b$=($)=>{let Q="",V=_7($);while(oV($)||V.root){const X=$.charAt(0)==="/"&&$.slice(0,4)!=="//?/"?"/":V.root;$=$.slice(X.length),Q+=X,V=_7($)}return[Q,$]};var x5=["|","<",">","?",":"],p1=x5.map(($)=>String.fromCharCode(61440+$.charCodeAt(0))),tV=new Map(x5.map(($,Q)=>[$,p1[Q]])),eV=new Map(p1.map(($,Q)=>[$,x5[Q]])),a1=($)=>x5.reduce((Q,V)=>Q.split(V).join(tV.get(V)),$),R7=($)=>p1.reduce((Q,V)=>Q.split(V).join(eV.get(V)),$);var h7=($,Q)=>{if(!Q)return M($);return $=M($).replace(/^\.(\/|$)/,""),q0(Q)+"/"+$},$X=16777216,y7=Symbol("process"),m7=Symbol("file"),b7=Symbol("directory"),s1=Symbol("symlink"),E7=Symbol("hardlink"),E$=Symbol("header"),U5=Symbol("read"),r1=Symbol("lstat"),O5=Symbol("onlstat"),o1=Symbol("onread"),t1=Symbol("onreadlink"),e1=Symbol("openfile"),$8=Symbol("onopenfile"),c0=Symbol("close"),T5=Symbol("mode"),Q8=Symbol("awaitDrain"),n1=Symbol("ondrain"),L0=Symbol("prefix");class C5 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=R$(Q);super();if(this.path=M($),this.portable=!!V.portable,this.maxReadSize=V.maxReadSize||$X,this.linkCache=V.linkCache||new Map,this.statCache=V.statCache||new Map,this.preservePaths=!!V.preservePaths,this.cwd=M(V.cwd||process.cwd()),this.strict=!!V.strict,this.noPax=!!V.noPax,this.noMtime=!!V.noMtime,this.mtime=V.mtime,this.prefix=V.prefix?M(V.prefix):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let X=!1;if(!this.preservePaths){const[Z,K]=b$(this.path);if(Z&&typeof K==="string")this.path=K,X=Z}if(this.win32=!!V.win32||process.platform==="win32",this.win32)this.path=R7(this.path.replace(/\\/g,"/")),$=$.replace(/\\/g,"/");if(this.absolute=M(V.absolute||k7.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[O5](J);else this[r1]()}warn($,Q,V={}){return t0(this,$,Q,V)}emit($,...Q){if($==="error")this.#$=!0;return super.emit($,...Q)}[r1](){B0.lstat(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[O5](Q)})}[O5]($){if(this.statCache.set(this.absolute,$),this.stat=$,!$.isFile())$.size=0;this.type=QX($),this.emit("stat",$),this[y7]()}[y7](){switch(this.type){case"File":return this[m7]();case"Directory":return this[b7]();case"SymbolicLink":return this[s1]();default:return this.end()}}[T5]($){return i1($,this.type==="Directory",this.portable)}[L0]($){return h7($,this.prefix)}[E$](){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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](this.linkpath):this.linkpath,mode:this[T5](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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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($)}[b7](){if(!this.stat)throw new Error("cannot create directory entry without stat");if(this.path.slice(-1)!=="/")this.path+="/";this.stat.size=0,this[E$](),this.end()}[s1](){B0.readlink(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[t1](Q)})}[t1]($){this.linkpath=M($),this[E$](),this.end()}[E7]($){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=M(k7.relative(this.cwd,$)),this.stat.size=0,this[E$](),this.end()}[m7](){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[E7](Q);this.linkCache.set($,this.absolute)}if(this[E$](),this.stat.size===0)return this.end();this[e1]()}[e1](){B0.open(this.absolute,"r",($,Q)=>{if($)return this.emit("error",$);this[$8](Q)})}[$8]($){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[U5]()}[U5](){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");B0.read($,Q,V,X,J,(Z,K)=>{if(Z)return this[c0](()=>this.emit("error",Z));this[o1](K)})}[c0]($=()=>{}){if(this.fd!==void 0)B0.close(this.fd,$)}[o1]($){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[n1]());else this[n1]()}[Q8]($){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)}[n1](){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[U5]()}}class V8 extends C5{sync=!0;[r1](){this[O5](B0.lstatSync(this.absolute))}[s1](){this[t1](B0.readlinkSync(this.absolute))}[e1](){this[$8](B0.openSync(this.absolute,"r"))}[U5](){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=B0.readSync(Q,V,X,J,Z);this[o1](K),$=!1}finally{if($)try{this[c0](()=>{})}catch(Q){}}}[Q8]($){$()}[c0]($=()=>{}){if(this.fd!==void 0)B0.closeSync(this.fd);$()}}class X8 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 t0(this,$,Q,V)}constructor($,Q={}){const V=R$(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=M($.path),this.mode=$.mode!==void 0?this[T5]($.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?M($.linkpath):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let J=!1;if(!this.preservePaths){const[K,G]=b$(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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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)}[L0]($){return h7($,this.prefix)}[T5]($){return i1($,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 QX=($)=>$.isFile()?"File":$.isDirectory()?"Directory":$.isSymbolicLink()?"SymbolicLink":"Unsupported";import d7 from"path";class G8{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor($,Q){this.path=$||"./",this.absolute=Q}}var u7=Buffer.alloc(1024),j5=Symbol("onStat"),h$=Symbol("ended"),X0=Symbol("queue"),P$=Symbol("current"),V$=Symbol("process"),u$=Symbol("processing"),f7=Symbol("processJob"),J0=Symbol("jobs"),J8=Symbol("jobDone"),D5=Symbol("addFSEntry"),c7=Symbol("addTarEntry"),Y8=Symbol("stat"),z8=Symbol("readdir"),S5=Symbol("onreaddir"),N5=Symbol("pipe"),l7=Symbol("entry"),Z8=Symbol("entryOpt"),_5=Symbol("writeEntryClass"),i7=Symbol("write"),K8=Symbol("ondrain");class X$ extends c{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[_5];onWriteEntry;[X0];[J0]=0;[u$]=!1;[h$]=!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=M($.prefix||""),this.linkCache=$.linkCache||new Map,this.statCache=$.statCache||new Map,this.readdirCache=$.readdirCache||new Map,this.onWriteEntry=$.onWriteEntry,this[_5]=C5,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 R1($.gzip)}if($.brotli){if(typeof $.brotli!=="object")$.brotli={};this.zip=new y1($.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[K8]()),this.on("resume",()=>Q.resume())}else this.on("drain",this[K8]);if(this.noDirRecurse=!!$.noDirRecurse,this.follow=!!$.follow,this.noMtime=!!$.noMtime,$.mtime)this.mtime=$.mtime;this.filter=typeof $.filter==="function"?$.filter:()=>!0,this[X0]=new z0,this[J0]=0,this.jobs=Number($.jobs)||4,this[u$]=!1,this[h$]=!1}[i7]($){return super.write($)}add($){return this.write($),this}end($){if($)this.add($);return this[h$]=!0,this[V$](),this}write($){if(this[h$])throw new Error("write after end");if($ instanceof k$)this[c7]($);else this[D5]($);return this.flowing}[c7]($){const Q=M(d7.resolve(this.cwd,$.path));if(!this.filter($.path,$))$.resume();else{const V=new G8($.path,Q);V.entry=new X8($,this[Z8](V)),V.entry.on("end",()=>this[J8](V)),this[J0]+=1,this[X0].push(V)}this[V$]()}[D5]($){const Q=M(d7.resolve(this.cwd,$));this[X0].push(new G8($,Q)),this[V$]()}[Y8]($){$.pending=!0,this[J0]+=1;const Q=this.follow?"stat":"lstat";R5[Q]($.absolute,(V,X)=>{if($.pending=!1,this[J0]-=1,V)this.emit("error",V);else this[j5]($,X)})}[j5]($,Q){if(this.statCache.set($.absolute,Q),$.stat=Q,!this.filter($.path,Q))$.ignore=!0;this[V$]()}[z8]($){$.pending=!0,this[J0]+=1,R5.readdir($.absolute,(Q,V)=>{if($.pending=!1,this[J0]-=1,Q)return this.emit("error",Q);this[S5]($,V)})}[S5]($,Q){this.readdirCache.set($.absolute,Q),$.readdir=Q,this[V$]()}[V$](){if(this[u$])return;this[u$]=!0;for(let $=this[X0].head;!!$&&this[J0]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}}[l7]($){this[J0]+=1;try{const Q=new this[_5]($.path,this[Z8]($));return this.onWriteEntry?.(Q),Q.on("end",()=>this[J8]($)).on("error",(V)=>this.emit("error",V))}catch(Q){this.emit("error",Q)}}[K8](){if(this[P$]&&this[P$].entry)this[P$].entry.resume()}[N5]($){if($.piped=!0,$.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[D5](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={}){t0(this,$,Q,V)}}class F$ extends X${sync=!0;constructor($){super($);this[_5]=V8}pause(){}resume(){}[Y8]($){const Q=this.follow?"statSync":"lstatSync";this[j5]($,R5[Q]($.absolute))}[z8]($){this[S5]($,R5.readdirSync($.absolute))}[N5]($){const Q=$.entry,V=this.zip;if($.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[D5](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[i7](X)})}}var VX=($,Q)=>{const V=new F$($),X=new _$($.file,{mode:$.mode||438});V.pipe(X),a7(V,Q)},XX=($,Q)=>{const V=new X$($),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 n7(V,Q),J},a7=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")O0({file:p7.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},n7=async($,Q)=>{for(let V=0;V{$.add(J)}});else $.add(X)}$.end()},JX=($,Q)=>{const V=new F$($);return a7(V,Q),V},ZX=($,Q)=>{const V=new X$($);return n7(V,Q),V},KX=Y0(VX,XX,JX,ZX,($,Q)=>{if(!Q?.length)throw new TypeError("no paths specified to add to archive")});import A4 from"node:fs";import gX from"node:assert";import{randomBytes as w4} from"node:crypto";import A from"node:fs";import C0 from"node:path";import s7 from"fs";var GX=process.env.__FAKE_PLATFORM__||process.platform,YX=GX==="win32",{O_CREAT:zX,O_TRUNC:WX,O_WRONLY:qX}=s7.constants,r7=Number(process.env.__FAKE_FS_O_FILENAME__)||s7.constants.UV_FS_O_FILEMAP||0,BX=YX&&!!r7,LX=524288,MX=r7|WX|zX|qX,W8=!BX?()=>"w":($)=>${try{return k5.lchownSync($,Q,V)}catch(X){if(X?.code!=="ENOENT")throw X}},g5=($,Q,V,X)=>{k5.lchown($,Q,V,(J)=>{X(J&&J?.code!=="ENOENT"?J:null)})},wX=($,Q,V,X,J)=>{if(Q.isDirectory())B8(f$.resolve($,Q.name),V,X,(Z)=>{if(Z)return J(Z);const K=f$.resolve($,Q.name);g5(K,V,X,J)});else{const Z=f$.resolve($,Q.name);g5(Z,V,X,J)}},B8=($,Q,V,X)=>{k5.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 g5($,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 g5($,Q,V,X)};for(let W of Z)wX($,W,Q,V,Y)})},AX=($,Q,V,X)=>{if(Q.isDirectory())L8(f$.resolve($,Q.name),V,X);q8(f$.resolve($,Q.name),V,X)},L8=($,Q,V)=>{let X;try{X=k5.readdirSync($,{withFileTypes:!0})}catch(J){const Z=J;if(Z?.code==="ENOENT")return;else if(Z?.code==="ENOTDIR"||Z?.code==="ENOTSUP")return q8($,Q,V);else throw Z}for(let J of X)AX($,J,Q,V);return q8($,Q,V)};import r from"fs";import{dirname as o7} from"path";import{mkdir as IX,mkdirSync as PX,stat as FX,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||IX,$.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||FX,$.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||PX,Q};var M0=($,Q,V)=>{const X=o7($),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 M0($,J,M0(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=o7($);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:M0});import{dirname as e7} from"path";import{dirname as t7} from"path";var M8=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"?M8($,t7(Q),Q):void 0})},w8=($,Q,V)=>{if(V===Q)return;try{return $.statSync(Q).isDirectory()?V:void 0}catch(X){const J=X;return J&&J.code==="ENOENT"?w8($,t7(Q),Q):void 0}};var v$=($,Q)=>{const V=s(Q);if(V.recursive=!0,e7($)===$)return V.mkdirSync($,V);const J=w8(V,$);try{return V.mkdirSync($,V),J}catch(Z){const K=Z;if(K&&K.code==="ENOENT")return M0($,V);else throw Z}},c$=Object.assign(async($,Q)=>{const V={...s(Q),recursive:!0};if(e7($)===$)return await V.mkdirAsync($,V);return M8(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:v$});import{parse as xX,resolve as UX} from"path";var HX=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,A8=($)=>{if(/\0/.test($))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:$,code:"ERR_INVALID_ARG_VALUE"});if($=UX($),HX==="win32"){const Q=/[*|"<>?:]/,{root:V}=xX($);if(Q.test($.substring(V.length)))throw Object.assign(new Error("Illegal characters in path."),{path:$,code:"EINVAL"})}return $};import{mkdir as OX,mkdirSync as TX} from"fs";var CX=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,I8=CX.replace(/^v/,"").split("."),$4=+I8[0]>10||+I8[0]===10&&+I8[1]>=12,l$=!$4?()=>!1:($)=>s($).mkdirSync===TX,y5=Object.assign(!$4?()=>!1:($)=>s($).mkdir===OX,{sync:l$});var m5=($,Q)=>{$=A8($);const V=s(Q);return l$(V)?v$($,V):M0($,V)};var Q4=Object.assign(async($,Q)=>{$=A8($);const V=s(Q);return y5(V)?c$($,V):T0($,V)},{mkdirpSync:m5,mkdirpNative:c$,mkdirpNativeSync:v$,mkdirpManual:T0,mkdirpManualSync:M0,sync:m5,native:c$,nativeSync:v$,manual:T0,manualSync:M0,useNative:y5,useNativeSync:l$});import h5 from"node:path";class b5 extends Error{path;code;syscall="chdir";constructor($,Q){super(`${Q}: Cannot cd into '${$}'`);this.path=$,this.code=Q}get name(){return"CwdError"}}class E5 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 u5=($,Q)=>$.get(M(Q)),d$=($,Q,V)=>$.set(M(Q),V),jX=($,Q)=>{r.stat($,(V,X)=>{if(V||!X.isDirectory())V=new b5($,V?.code||"ENOTDIR");Q(V)})},V4=($,Q,V)=>{$=M($);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,L=M(Q.cwd),U=(b,D)=>{if(b)V(b);else if(d$(q,$,!0),D&&Y)B8(D,K,G,(S8)=>U(S8));else if(Z)r.chmod($,J,V);else V()};if(q&&u5(q,$)===!0)return U();if($===L)return jX($,U);if(W)return Q4($,{mode:J}).then((b)=>U(null,b??void 0),U);const j=M(h5.relative(L,$)).split("/");f5(L,j,J,q,z,L,void 0,U)},f5=($,Q,V,X,J,Z,K,G)=>{if(!Q.length)return G(null,K);const Y=Q.shift(),W=M(h5.resolve($+"/"+Y));if(u5(X,W))return f5(W,Q,V,X,J,Z,K,G);r.mkdir(W,V,X4(W,Q,V,X,J,Z,K,G))},X4=($,Q,V,X,J,Z,K,G)=>(Y)=>{if(Y)r.lstat($,(W,z)=>{if(W)W.path=W.path&&M(W.path),G(W);else if(z.isDirectory())f5($,Q,V,X,J,Z,K,G);else if(J)r.unlink($,(q)=>{if(q)return G(q);r.mkdir($,V,X4($,Q,V,X,J,Z,K,G))});else if(z.isSymbolicLink())return G(new E5($,$+"/"+Q.join("/")));else G(Y)});else K=K||$,f5($,Q,V,X,J,Z,K,G)},DX=($)=>{let Q=!1,V=void 0;try{Q=r.statSync($).isDirectory()}catch(X){V=X?.code}finally{if(!Q)throw new b5($,V??"ENOTDIR")}},J4=($,Q)=>{$=M($);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=M(Q.cwd),L=(b)=>{if(d$(z,$,!0),b&&G)L8(b,Z,K);if(J)r.chmodSync($,X)};if(z&&u5(z,$)===!0)return L();if($===q)return DX(q),L();if(Y)return L(m5($,X)??void 0);const C=M(h5.relative(q,$)).split("/");let j=void 0;for(let b=C.shift(),D=q;b&&(D+="/"+b);b=C.shift()){if(D=M(h5.resolve(D)),u5(z,D))continue;try{r.mkdirSync(D,X),j=j||D,d$(z,D,!0)}catch(S8){const N8=r.lstatSync(D);if(N8.isDirectory()){d$(z,D,!0);continue}else if(W){r.unlinkSync(D),r.mkdirSync(D,X),j=j||D,d$(z,D,!0);continue}else if(N8.isSymbolicLink())return new E5(D,D+"/"+C.join("/"))}}return L(j)};var P8=Object.create(null),{hasOwnProperty:SX}=Object.prototype,c5=($)=>{if(!SX.call(P8,$))P8[$]=$.normalize("NFD");return P8[$]};import{join as Z4} from"node:path";var NX=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,_X=NX==="win32",RX=($)=>{return $.split("/").slice(0,-1).reduce((V,X)=>{const J=V[V.length-1];if(J!==void 0)X=Z4(J,X);return V.push(X||"/"),V},[])};class F8{#$=new Map;#V=new Map;#X=new Set;reserve($,Q){$=_X?["win32 parallelization disabled"]:$.map((X)=>{return q0(Z4(c5(X))).toLowerCase()});const V=new Set($.map((X)=>RX(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 K4=Symbol("onEntry"),x8=Symbol("checkFs"),G4=Symbol("checkFs2"),i5=Symbol("pruneCache"),U8=Symbol("isReusable"),o=Symbol("makeFs"),O8=Symbol("file"),T8=Symbol("directory"),p5=Symbol("link"),Y4=Symbol("symlink"),z4=Symbol("hardlink"),W4=Symbol("unsupported"),q4=Symbol("checkPath"),l0=Symbol("mkdir"),k=Symbol("onError"),l5=Symbol("pending"),B4=Symbol("pend"),H$=Symbol("unpend"),v8=Symbol("ended"),H8=Symbol("maybeClose"),C8=Symbol("skip"),i$=Symbol("doChown"),p$=Symbol("uid"),a$=Symbol("gid"),n$=Symbol("checkedCwd"),kX=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,s$=kX==="win32",yX=1024,mX=($,Q)=>{if(!s$)return A.unlink($,Q);const V=$+".DELETE."+w4(16).toString("hex");A.rename($,V,(X)=>{if(X)return Q(X);A.unlink(V,Q)})},bX=($)=>{if(!s$)return A.unlinkSync($);const Q=$+".DELETE."+w4(16).toString("hex");A.renameSync($,Q),A.unlinkSync(Q)},L4=($,Q,V)=>$!==void 0&&$===$>>>0?$:Q!==void 0&&Q===Q>>>0?Q:V,M4=($)=>q0(M(c5($))).toLowerCase(),EX=($,Q)=>{Q=M4(Q);for(let V of $.keys()){const X=M4(V);if(X===Q||X.indexOf(Q+"/")===0)$.delete(V)}},hX=($)=>{for(let Q of $.keys())$.delete(Q)};class r$ extends f0{[v8]=!1;[n$]=!1;[l5]=0;reservations=new F8;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[v8]=!0,this[H8]()};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:yX,this.forceChown=$.forceChown===!0,this.win32=!!$.win32||s$,this.newer=!!$.newer,this.keep=!!$.keep,this.noMtime=!!$.noMtime,this.preservePaths=!!$.preservePaths,this.unlink=!!$.unlink,this.cwd=M(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[K4](Q))}warn($,Q,V={}){if($==="TAR_BAD_ARCHIVE"||$==="TAR_ABORT")V.recoverable=!1;return super.warn($,Q,V)}[H8](){if(this[v8]&&this[l5]===0)this.emit("prefinish"),this.emit("finish"),this.emit("end")}[q4]($){const Q=M($.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("..")||s$&&/^[a-z]:\.\.$/i.test(V[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:$,path:Q}),!1;const[X,J]=b$(Q);if(X)$.path=String(J),this.warn("TAR_ENTRY_INFO",`stripping ${X} from absolute path`,{entry:$,path:Q})}if(C0.isAbsolute($.path))$.absolute=M(C0.resolve($.path));else $.absolute=M(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:M($.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+a1(String($.absolute).slice(X.length));const{root:J}=C0.win32.parse($.path);$.path=J+a1($.path.slice(J.length))}return!0}[K4]($){if(!this[q4]($))return $.resume();switch(gX.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[x8]($);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[W4]($)}}[k]($,Q){if($.name==="CwdError")this.emit("error",$);else this.warn("TAR_ENTRY_ERROR",$,{entry:Q}),this[H$](),Q.resume()}[l0]($,Q,V){V4(M($),{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)}[i$]($){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}[p$]($){return L4(this.uid,$.uid,this.processUid)}[a$]($){return L4(this.gid,$.gid,this.processGid)}[O8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=new g0(String($.absolute),{flags:W8($.size),mode:V,autoClose:!1});X.on("error",(G)=>{if(X.fd)A.close(X.fd,()=>{});X.write=()=>!0,this[k](G,$),Q()});let J=1;const Z=(G)=>{if(G){if(X.fd)A.close(X.fd,()=>{});this[k](G,$),Q();return}if(--J===0){if(X.fd!==void 0)A.close(X.fd,(Y)=>{if(Y)this[k](Y,$);else this[H$]();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;A.futimes(Y,W,z,(q)=>q?A.utimes(G,W,z,(L)=>Z(L&&q)):Z())}if(typeof Y==="number"&&this[i$]($)){J++;const W=this[p$]($),z=this[a$]($);if(typeof W==="number"&&typeof z==="number")A.fchown(Y,W,z,(q)=>q?A.chown(G,W,z,(L)=>Z(L&&q)):Z())}Z()});const K=this.transform?this.transform($)||$:$;if(K!==$)K.on("error",(G)=>{this[k](G,$),Q()}),$.pipe(K);K.pipe(X)}[T8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode;this[l0](String($.absolute),V,(X)=>{if(X){this[k](X,$),Q();return}let J=1;const Z=()=>{if(--J===0)Q(),this[H$](),$.resume()};if($.mtime&&!this.noMtime)J++,A.utimes(String($.absolute),$.atime||new Date,$.mtime,Z);if(this[i$]($))J++,A.chown(String($.absolute),Number(this[p$]($)),Number(this[a$]($)),Z);Z()})}[W4]($){$.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${$.type}`,{entry:$}),$.resume()}[Y4]($,Q){this[p5]($,String($.linkpath),"symlink",Q)}[z4]($,Q){const V=M(C0.resolve(this.cwd,String($.linkpath)));this[p5]($,V,"link",Q)}[B4](){this[l5]++}[H$](){this[l5]--,this[H8]()}[C8]($){this[H$](),$.resume()}[U8]($,Q){return $.type==="File"&&!this.unlink&&Q.isFile()&&Q.nlink<=1&&!s$}[x8]($){this[B4]();const Q=[$.path];if($.linkpath)Q.push($.linkpath);this.reservations.reserve(Q,(V)=>this[G4]($,V))}[i5]($){if($.type==="SymbolicLink")hX(this.dirCache);else if($.type!=="Directory")EX(this.dirCache,String($.absolute))}[G4]($,Q){this[i5]($);const V=(K)=>{this[i5]($),Q(K)},X=()=>{this[l0](this.cwd,this.dmode,(K)=>{if(K){this[k](K,$),V();return}this[n$]=!0,J()})},J=()=>{if($.absolute!==this.cwd){const K=M(C0.dirname(String($.absolute)));if(K!==this.cwd)return this[l0](K,this.dmode,(G)=>{if(G){this[k](G,$),V();return}Z()})}Z()},Z=()=>{A.lstat(String($.absolute),(K,G)=>{if(G&&(this.keep||this.newer&&G.mtime>($.mtime??G.mtime))){this[C8]($),V();return}if(K||this[U8]($,G))return this[o](null,$,V);if(G.isDirectory()){if($.type==="Directory"){const Y=this.chmod&&$.mode&&(G.mode&4095)!==$.mode,W=(z)=>this[o](z??null,$,V);if(!Y)return W();return A.chmod(String($.absolute),Number($.mode),W)}if($.absolute!==this.cwd)return A.rmdir(String($.absolute),(Y)=>this[o](Y??null,$,V))}if($.absolute===this.cwd)return this[o](null,$,V);mX(String($.absolute),(Y)=>this[o](Y??null,$,V))})};if(this[n$])J();else X()}[o]($,Q,V){if($){this[k]($,Q),V();return}switch(Q.type){case"File":case"OldFile":case"ContiguousFile":return this[O8](Q,V);case"Link":return this[z4](Q,V);case"SymbolicLink":return this[Y4](Q,V);case"Directory":case"GNUDumpDir":return this[T8](Q,V)}}[p5]($,Q,V,X){A[V](Q,String($.absolute),(J)=>{if(J)this[k](J,$);else this[H$](),$.resume();X()})}}var d5=($)=>{try{return[null,$()]}catch(Q){return[Q,null]}};class a5 extends r${sync=!0;[o]($,Q){return super[o]($,Q,()=>{})}[x8]($){if(this[i5]($),!this[n$]){const J=this[l0](this.cwd,this.dmode);if(J)return this[k](J,$);this[n$]=!0}if($.absolute!==this.cwd){const J=M(C0.dirname(String($.absolute)));if(J!==this.cwd){const Z=this[l0](J,this.dmode);if(Z)return this[k](Z,$)}}const[Q,V]=d5(()=>A.lstatSync(String($.absolute)));if(V&&(this.keep||this.newer&&V.mtime>($.mtime??V.mtime)))return this[C8]($);if(Q||this[U8]($,V))return this[o](null,$);if(V.isDirectory()){if($.type==="Directory"){const Z=this.chmod&&$.mode&&(V.mode&4095)!==$.mode,[K]=Z?d5(()=>{A.chmodSync(String($.absolute),Number($.mode))}):[];return this[o](K,$)}const[J]=d5(()=>A.rmdirSync(String($.absolute)));this[o](J,$)}const[X]=$.absolute===this.cwd?[]:d5(()=>bX(String($.absolute)));this[o](X,$)}[O8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=(K)=>{let G;try{A.closeSync(J)}catch(Y){G=Y}if(K||G)this[k](K||G,$);Q()};let J;try{J=A.openSync(String($.absolute),W8($.size),V)}catch(K){return X(K)}const Z=this.transform?this.transform($)||$:$;if(Z!==$)Z.on("error",(K)=>this[k](K,$)),$.pipe(Z);Z.on("data",(K)=>{try{A.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{A.futimesSync(J,G,Y)}catch(W){try{A.utimesSync(String($.absolute),G,Y)}catch(z){K=W}}}if(this[i$]($)){const G=this[p$]($),Y=this[a$]($);try{A.fchownSync(J,Number(G),Number(Y))}catch(W){try{A.chownSync(String($.absolute),Number(G),Number(Y))}catch(z){K=K||W}}}X(K)})}[T8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode,X=this[l0](String($.absolute),V);if(X){this[k](X,$),Q();return}if($.mtime&&!this.noMtime)try{A.utimesSync(String($.absolute),$.atime||new Date,$.mtime)}catch(J){}if(this[i$]($))try{A.chownSync(String($.absolute),Number(this[p$]($)),Number(this[a$]($)))}catch(J){}Q(),$.resume()}[l0]($,Q){try{return J4(M($),{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}}[p5]($,Q,V,X){const J=`${V}Sync`;try{A[J](Q,String($.absolute)),X(),$.resume()}catch(Z){return this[k](Z,$)}}}var uX=($)=>{const Q=new a5($),V=$.file,X=A4.statSync(V),J=$.maxReadSize||16777216;new C1(V,{readSize:J,size:X.size}).pipe(Q)},fX=($,Q)=>{const V=new r$($),X=$.maxReadSize||16777216,J=$.file;return new Promise((K,G)=>{V.on("error",G),V.on("close",K),A4.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M$(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},j8=Y0(uX,fX,($)=>new a5($),($)=>new r$($),($,Q)=>{if(Q?.length)d1($,Q)});import l from"node:fs";import I4 from"node:path";var cX=($,Q)=>{const V=new F$($);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,lX($,V,Z,J,Q)}finally{if(X)try{l.closeSync(J)}catch(K){}}},lX=($,Q,V,X,J)=>{const Z=new _$($.file,{fd:X,start:V});Q.pipe(Z),iX(Q,J)},dX=($,Q)=>{Q=Array.from(Q);const V=new X$($),X=(Z,K,G)=>{const Y=(U,C)=>{if(U)l.close(Z,(j)=>G(U));else G(null,C)};let W=0;if(K===0)return Y(null,0);let z=0;const q=Buffer.alloc(512),L=(U,C)=>{if(U||typeof C==="undefined")return Y(U);if(z+=C,z<512&&C)return l.read(Z,q,z,q.length-z,W+z,L);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 j=new a(q);if(!j.cksumValid)return Y(null,W);const b=512*Math.ceil((j.size??0)/512);if(W+b+512>K)return Y(null,W);if(W+=b+512,W>=K)return Y(null,W);if($.mtimeCache&&j.mtime)$.mtimeCache.set(String(j.path),j.mtime);z=0,l.read(Z,q,0,512,W,L)};l.read(Z,q,0,512,W,L)};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,L)=>{if(q)return l.close(z,()=>K(q));X(z,L.size,(U,C)=>{if(U)return K(U);const j=new g0($.file,{fd:z,start:C});V.pipe(j),j.on("error",K),j.on("close",Z),pX(V,Q)})})};l.open($.file,G,Y)})},iX=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")O0({file:I4.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},pX=async($,Q)=>{for(let V=0;V$.add(J)});else $.add(X)}$.end()},J$=Y0(cX,dX,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},($,Q)=>{if(!P7($))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 aX=Y0(J$.syncFile,J$.asyncFile,J$.syncNoFile,J$.asyncNoFile,($,Q=[])=>{J$.validate?.($,Q),nX($)}),nX=($)=>{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))};async function eX($,Q,V){w.info(`Starting download from URL: ${$}`);const J=`beat-forge/init-beatsaber@${P4().version}`;w.info(`User-Agent: ${J}`);const Z=await fetch($,{headers:{"User-Agent":J,Authorization:`token ${V}`}});if(w.info(`Response status: ${Z.status}`),w.info(`Response headers: ${JSON.stringify([...Z.headers])}`),!Z.ok)throw w.error(`Failed to download file: ${Z.statusText}`),new Error(`Failed to download file: ${Z.statusText}`);await d0.mkdir(F4(Q),{recursive:!0}),w.info(`Directory created for output path: ${F4(Q)}`);const K=oX(Q),G=Z.body?.getReader();if(!G)throw w.error("Failed to get reader from response body"),new Error("Failed to get reader from response body");w.info("Starting to read and write file stream"),await(async()=>{while(!0){const{done:W,value:z}=await G.read();if(W)break;if(z)K.write(z)}K.close()})(),w.info("File downloaded and written successfully")}async function $J($,Q){w.info(`Extracting tarball from ${$} to ${Q}`),await d0.mkdir(Q,{recursive:!0}),w.info(`Directory created for extraction: ${Q}`),w.info(`Listing contents of tarball: ${$}`),await O0({file:$,onReadEntry:(V)=>{w.info(`Tarball entry: ${V.path}`)}}),await j8({file:$,cwd:Q}),w.info("Extraction completed successfully")}async function v4($,Q){w.info(`Moving contents from ${$} to ${Q}`);try{await d0.mkdir(Q,{recursive:!0});const V=await d0.readdir($,{withFileTypes:!0});w.info(`Files to move: ${V.map((X)=>X.name).join(", ")}`);for(let X of V){const J=D8($,X.name),Z=D8(Q,X.name);if(X.isDirectory())await v4(J,Z);else await d0.rename(J,Z);w.info(`Moved ${J} to ${Z}`)}}catch(V){throw w.error(`Failed to move contents from ${$} to ${Q}`),w.error(`Error details: ${V}`),V}w.info("Content move completed successfully")}async function QJ(){try{w.info("Initializing Beat Saber references...");const $=w.getInput("token",{required:!0}),Q=w.getInput("version",{required:!0}),V=w.getInput("path")||"./Refs",X=w.getInput("repo")||"beat-forge/beatsaber-stripped",J=w.getInput("host")||"github.com";w.info(`Inputs: token=${$}, version=${Q}, path=${V}, repo=${X}, host=${J}`);const[Z,K]=X.split("/");if(!Z||!K)throw w.error("Repository input is invalid. Expected format {owner}/{repo}."),new Error("Repository input is invalid. Expected format {owner}/{repo}.");const G=`version/${Q}`,Y=`https://${J}/${Z}/${K}/archive/refs/heads/${G}.tar.gz`,W=`./${K}-${G}.tar.gz`,z=`./${K}-${G}`,q=tX(V);w.info(`Calculated paths: archiveUrl=${Y}, tarballPath=${W}, extractPath=${z}, refsPath=${q}`);const L=await d0.readdir(".");w.info(`${process.cwd()} contents: ${L.join(", ")}`),w.info(`Downloading ${Y} to ${W}...`),await eX(Y,W,$),w.info(`Extracting ${W} to ${z}...`),await $J(W,z),w.info(`Moving 'data' folder contents from ${z} to ${q}...`),await v4(D8(z,"data"),q),w.info("Cleaning up..."),await d0.rm(W),await d0.rm(z,{recursive:!0}),w.info("Cleanup completed successfully")}catch($){w.error(`An error occurred: ${$}`),w.setFailed($ instanceof Error?$.message:"An unknown error occurred")}}QJ(); diff --git a/package.json b/package.json index 1dd7f22..b66e628 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "init-beatsaber", "description": "A GitHub Action to initialize a Beat Saber modding environment", - "version": "1.4.12", + "version": "1.5.0", "author": "BeatForge", "private": true, "type": "module",