create-next-app 16.1.1-canary.15 → 16.1.1-canary.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71,4 +71,4 @@ var o=i(4300);var a=o.Buffer;function copyProps(t,r){for(var i in t){r[i]=t[i]}}
|
|
|
71
71
|
* Released under the MIT License.
|
|
72
72
|
*/const o=i(3576);const toRegexRange=(t,r,i)=>{if(o(t)===false){throw new TypeError("toRegexRange: expected the first argument to be a number")}if(r===void 0||t===r){return String(t)}if(o(r)===false){throw new TypeError("toRegexRange: expected the second argument to be a number.")}let a={relaxZeros:true,...i};if(typeof a.strictZeros==="boolean"){a.relaxZeros=a.strictZeros===false}let c=String(a.relaxZeros);let l=String(a.shorthand);let u=String(a.capture);let h=String(a.wrap);let d=t+":"+r+"="+c+l+u+h;if(toRegexRange.cache.hasOwnProperty(d)){return toRegexRange.cache[d].result}let p=Math.min(t,r);let m=Math.max(t,r);if(Math.abs(p-m)===1){let i=t+"|"+r;if(a.capture){return`(${i})`}if(a.wrap===false){return i}return`(?:${i})`}let g=hasPadding(t)||hasPadding(r);let y={min:t,max:r,a:p,b:m};let v=[];let b=[];if(g){y.isPadded=g;y.maxLen=String(y.max).length}if(p<0){let t=m<0?Math.abs(m):1;b=splitToPatterns(t,Math.abs(p),y,a);p=y.a=0}if(m>=0){v=splitToPatterns(p,m,y,a)}y.negatives=b;y.positives=v;y.result=collatePatterns(b,v,a);if(a.capture===true){y.result=`(${y.result})`}else if(a.wrap!==false&&v.length+b.length>1){y.result=`(?:${y.result})`}toRegexRange.cache[d]=y;return y.result};function collatePatterns(t,r,i){let o=filterPatterns(t,r,"-",false,i)||[];let a=filterPatterns(r,t,"",false,i)||[];let c=filterPatterns(t,r,"-?",true,i)||[];let l=o.concat(c).concat(a);return l.join("|")}function splitToRanges(t,r){let i=1;let o=1;let a=countNines(t,i);let c=new Set([r]);while(t<=a&&a<=r){c.add(a);i+=1;a=countNines(t,i)}a=countZeros(r+1,o)-1;while(t<a&&a<=r){c.add(a);o+=1;a=countZeros(r+1,o)-1}c=[...c];c.sort(compare);return c}function rangeToPattern(t,r,i){if(t===r){return{pattern:t,count:[],digits:0}}let o=zip(t,r);let a=o.length;let c="";let l=0;for(let t=0;t<a;t++){let[r,a]=o[t];if(r===a){c+=r}else if(r!=="0"||a!=="9"){c+=toCharacterClass(r,a,i)}else{l++}}if(l){c+=i.shorthand===true?"\\d":"[0-9]"}return{pattern:c,count:[l],digits:a}}function splitToPatterns(t,r,i,o){let a=splitToRanges(t,r);let c=[];let l=t;let u;for(let t=0;t<a.length;t++){let r=a[t];let h=rangeToPattern(String(l),String(r),o);let d="";if(!i.isPadded&&u&&u.pattern===h.pattern){if(u.count.length>1){u.count.pop()}u.count.push(h.count[0]);u.string=u.pattern+toQuantifier(u.count);l=r+1;continue}if(i.isPadded){d=padZeros(r,i,o)}h.string=d+h.pattern+toQuantifier(h.count);c.push(h);l=r+1;u=h}return c}function filterPatterns(t,r,i,o,a){let c=[];for(let a of t){let{string:t}=a;if(!o&&!contains(r,"string",t)){c.push(i+t)}if(o&&contains(r,"string",t)){c.push(i+t)}}return c}function zip(t,r){let i=[];for(let o=0;o<t.length;o++)i.push([t[o],r[o]]);return i}function compare(t,r){return t>r?1:r>t?-1:0}function contains(t,r,i){return t.some((t=>t[r]===i))}function countNines(t,r){return Number(String(t).slice(0,-r)+"9".repeat(r))}function countZeros(t,r){return t-t%Math.pow(10,r)}function toQuantifier(t){let[r=0,i=""]=t;if(i||r>1){return`{${r+(i?","+i:"")}}`}return""}function toCharacterClass(t,r,i){return`[${t}${r-t===1?"":"-"}${r}]`}function hasPadding(t){return/^-?(0+)\d/.test(t)}function padZeros(t,r,i){if(!r.isPadded){return t}let o=Math.abs(r.maxLen-String(t).length);let a=i.relaxZeros!==false;switch(o){case 0:return"";case 1:return a?"0?":"0";case 2:return a?"0{0,2}":"00";default:{return a?`0{0,${o}}`:`0{${o}}`}}}toRegexRange.cache={};toRegexRange.clearCache=()=>toRegexRange.cache={};t.exports=toRegexRange},9886:(t,r,i)=>{const{URL:o}=i(7310);const{join:a}=i(1017);const c=i(7147);const{promisify:l}=i(3837);const{tmpdir:u}=i(2037);const h=i(2107);const d=l(c.writeFile);const p=l(c.mkdir);const m=l(c.readFile);const compareVersions=(t,r)=>t.localeCompare(r,"en-US",{numeric:true});const encode=t=>encodeURIComponent(t).replace(/^%40/,"@");const getFile=async(t,r)=>{const i=u();const o=a(i,"update-check");if(!c.existsSync(o)){await p(o)}let l=`${t.name}-${r}.json`;if(t.scope){l=`${t.scope}-${l}`}return a(o,l)};const evaluateCache=async(t,r,i)=>{if(c.existsSync(t)){const o=await m(t,"utf8");const{lastUpdate:a,latest:c}=JSON.parse(o);const l=a+i;if(l>r){return{shouldCheck:false,latest:c}}}return{shouldCheck:true,latest:null}};const updateCache=async(t,r,i)=>{const o=JSON.stringify({latest:r,lastUpdate:i});await d(t,o,"utf8")};const loadPackage=(t,r)=>new Promise(((o,a)=>{const c={host:t.hostname,path:t.pathname,port:t.port,headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"},timeout:2e3};if(r){c.headers.authorization=`${r.type} ${r.token}`}const{get:l}=i(t.protocol==="https:"?5687:3685);l(c,(t=>{const{statusCode:r}=t;if(r!==200){const i=new Error(`Request failed with code ${r}`);i.code=r;a(i);t.resume();return}let i="";t.setEncoding("utf8");t.on("data",(t=>{i+=t}));t.on("end",(()=>{try{const t=JSON.parse(i);o(t)}catch(t){a(t)}}))})).on("error",a).on("timeout",a)}));const getMostRecent=async({full:t,scope:r},a)=>{const c=h(r);const l=new o(t,c);let u=null;try{u=await loadPackage(l)}catch(t){if(t.code&&String(t.code).startsWith(4)){const t=i(6084);const r=t(c,{recursive:true});u=await loadPackage(l,r)}else{throw t}}const d=u["dist-tags"][a];if(!d){throw new Error(`Distribution tag ${a} is not available`)}return d};const g={interval:36e5,distTag:"latest"};const getDetails=t=>{const r={full:encode(t)};if(t.includes("/")){const i=t.split("/");r.scope=i[0];r.name=i[1]}else{r.scope=null;r.name=t}return r};t.exports=async(t,r)=>{if(typeof t!=="object"){throw new Error("The first parameter should be your package.json file content")}const i=getDetails(t.name);const o=Date.now();const{distTag:a,interval:c}=Object.assign({},g,r);const l=await getFile(i,a);let u=null;let h=true;({shouldCheck:h,latest:u}=await evaluateCache(l,o,c));if(h){u=await getMostRecent(i,a);await updateCache(l,u,o)}const d=compareVersions(t.version,u);if(d===-1){return{latest:u,fromCache:!h}}return null}},2267:function(t,r){
|
|
73
73
|
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
74
|
-
(function(t,i){true?i(r):0})(this,(function(t){"use strict";function merge(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++){r[i]=arguments[i]}if(r.length>1){r[0]=r[0].slice(0,-1);var o=r.length-1;for(var a=1;a<o;++a){r[a]=r[a].slice(1,-1)}r[o]=r[o].slice(1);return r.join("")}else{return r[0]}}function subexp(t){return"(?:"+t+")"}function typeOf(t){return t===undefined?"undefined":t===null?"null":Object.prototype.toString.call(t).split(" ").pop().split("]").shift().toLowerCase()}function toUpperCase(t){return t.toUpperCase()}function toArray(t){return t!==undefined&&t!==null?t instanceof Array?t:typeof t.length!=="number"||t.split||t.setInterval||t.call?[t]:Array.prototype.slice.call(t):[]}function assign(t,r){var i=t;if(r){for(var o in r){i[o]=r[o]}}return i}function buildExps(t){var r="[A-Za-z]",i="[\\x0D]",o="[0-9]",a="[\\x22]",c=merge(o,"[A-Fa-f]"),l="[\\x0A]",u="[\\x20]",h=subexp(subexp("%[EFef]"+c+"%"+c+c+"%"+c+c)+"|"+subexp("%[89A-Fa-f]"+c+"%"+c+c)+"|"+subexp("%"+c+c)),d="[\\:\\/\\?\\#\\[\\]\\@]",p="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",m=merge(d,p),g=t?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",y=t?"[\\uE000-\\uF8FF]":"[]",v=merge(r,o,"[\\-\\.\\_\\~]",g),b=subexp(r+merge(r,o,"[\\+\\-\\.]")+"*"),w=subexp(subexp(h+"|"+merge(v,p,"[\\:]"))+"*"),E=subexp(subexp("25[0-5]")+"|"+subexp("2[0-4]"+o)+"|"+subexp("1"+o+o)+"|"+subexp("[1-9]"+o)+"|"+o),S=subexp(subexp("25[0-5]")+"|"+subexp("2[0-4]"+o)+"|"+subexp("1"+o+o)+"|"+subexp("0?[1-9]"+o)+"|0?0?"+o),$=subexp(S+"\\."+S+"\\."+S+"\\."+S),x=subexp(c+"{1,4}"),R=subexp(subexp(x+"\\:"+x)+"|"+$),O=subexp(subexp(x+"\\:")+"{6}"+R),P=subexp("\\:\\:"+subexp(x+"\\:")+"{5}"+R),A=subexp(subexp(x)+"?\\:\\:"+subexp(x+"\\:")+"{4}"+R),T=subexp(subexp(subexp(x+"\\:")+"{0,1}"+x)+"?\\:\\:"+subexp(x+"\\:")+"{3}"+R),C=subexp(subexp(subexp(x+"\\:")+"{0,2}"+x)+"?\\:\\:"+subexp(x+"\\:")+"{2}"+R),k=subexp(subexp(subexp(x+"\\:")+"{0,3}"+x)+"?\\:\\:"+x+"\\:"+R),I=subexp(subexp(subexp(x+"\\:")+"{0,4}"+x)+"?\\:\\:"+R),N=subexp(subexp(subexp(x+"\\:")+"{0,5}"+x)+"?\\:\\:"+x),D=subexp(subexp(subexp(x+"\\:")+"{0,6}"+x)+"?\\:\\:"),L=subexp([O,P,A,T,C,k,I,N,D].join("|")),M=subexp(subexp(v+"|"+h)+"+"),j=subexp(L+"\\%25"+M),U=subexp(L+subexp("\\%25|\\%(?!"+c+"{2})")+M),B=subexp("[vV]"+c+"+\\."+merge(v,p,"[\\:]")+"+"),H=subexp("\\["+subexp(U+"|"+L+"|"+B)+"\\]"),V=subexp(subexp(h+"|"+merge(v,p))+"*"),z=subexp(H+"|"+$+"(?!"+V+")"+"|"+V),G=subexp(o+"*"),q=subexp(subexp(w+"@")+"?"+z+subexp("\\:"+G)+"?"),W=subexp(h+"|"+merge(v,p,"[\\:\\@]")),K=subexp(W+"*"),Y=subexp(W+"+"),Z=subexp(subexp(h+"|"+merge(v,p,"[\\@]"))+"+"),X=subexp(subexp("\\/"+K)+"*"),J=subexp("\\/"+subexp(Y+X)+"?"),Q=subexp(Z+X),ee=subexp(Y+X),te="(?!"+W+")",re=subexp(X+"|"+J+"|"+Q+"|"+ee+"|"+te),se=subexp(subexp(W+"|"+merge("[\\/\\?]",y))+"*"),ie=subexp(subexp(W+"|[\\/\\?]")+"*"),ne=subexp(subexp("\\/\\/"+q+X)+"|"+J+"|"+ee+"|"+te),oe=subexp(b+"\\:"+ne+subexp("\\?"+se)+"?"+subexp("\\#"+ie)+"?"),ae=subexp(subexp("\\/\\/"+q+X)+"|"+J+"|"+Q+"|"+te),ce=subexp(ae+subexp("\\?"+se)+"?"+subexp("\\#"+ie)+"?"),le=subexp(oe+"|"+ce),ue=subexp(b+"\\:"+ne+subexp("\\?"+se)+"?"),he="^("+b+")\\:"+subexp(subexp("\\/\\/("+subexp("("+w+")@")+"?("+z+")"+subexp("\\:("+G+")")+"?)")+"?("+X+"|"+J+"|"+ee+"|"+te+")")+subexp("\\?("+se+")")+"?"+subexp("\\#("+ie+")")+"?$",de="^(){0}"+subexp(subexp("\\/\\/("+subexp("("+w+")@")+"?("+z+")"+subexp("\\:("+G+")")+"?)")+"?("+X+"|"+J+"|"+Q+"|"+te+")")+subexp("\\?("+se+")")+"?"+subexp("\\#("+ie+")")+"?$",fe="^("+b+")\\:"+subexp(subexp("\\/\\/("+subexp("("+w+")@")+"?("+z+")"+subexp("\\:("+G+")")+"?)")+"?("+X+"|"+J+"|"+ee+"|"+te+")")+subexp("\\?("+se+")")+"?$",pe="^"+subexp("\\#("+ie+")")+"?$",me="^"+subexp("("+w+")@")+"?("+z+")"+subexp("\\:("+G+")")+"?$";return{NOT_SCHEME:new RegExp(merge("[^]",r,o,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(merge("[^\\%\\:]",v,p),"g"),NOT_HOST:new RegExp(merge("[^\\%\\[\\]\\:]",v,p),"g"),NOT_PATH:new RegExp(merge("[^\\%\\/\\:\\@]",v,p),"g"),NOT_PATH_NOSCHEME:new RegExp(merge("[^\\%\\/\\@]",v,p),"g"),NOT_QUERY:new RegExp(merge("[^\\%]",v,p,"[\\:\\@\\/\\?]",y),"g"),NOT_FRAGMENT:new RegExp(merge("[^\\%]",v,p,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(merge("[^]",v,p),"g"),UNRESERVED:new RegExp(v,"g"),OTHER_CHARS:new RegExp(merge("[^\\%]",v,m),"g"),PCT_ENCODED:new RegExp(h,"g"),IPV4ADDRESS:new RegExp("^("+$+")$"),IPV6ADDRESS:new RegExp("^\\[?("+L+")"+subexp(subexp("\\%25|\\%(?!"+c+"{2})")+"("+M+")")+"?\\]?$")}}var r=buildExps(false);var i=buildExps(true);var o=function(){function sliceIterator(t,r){var i=[];var o=true;var a=false;var c=undefined;try{for(var l=t[Symbol.iterator](),u;!(o=(u=l.next()).done);o=true){i.push(u.value);if(r&&i.length===r)break}}catch(t){a=true;c=t}finally{try{if(!o&&l["return"])l["return"]()}finally{if(a)throw c}}return i}return function(t,r){if(Array.isArray(t)){return t}else if(Symbol.iterator in Object(t)){return sliceIterator(t,r)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();var toConsumableArray=function(t){if(Array.isArray(t)){for(var r=0,i=Array(t.length);r<t.length;r++)i[r]=t[r];return i}else{return Array.from(t)}};var a=2147483647;var c=36;var l=1;var u=26;var h=38;var d=700;var p=72;var m=128;var g="-";var y=/^xn--/;var v=/[^\0-\x7E]/;var b=/[\x2E\u3002\uFF0E\uFF61]/g;var w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"};var E=c-l;var S=Math.floor;var $=String.fromCharCode;function error$1(t){throw new RangeError(w[t])}function map(t,r){var i=[];var o=t.length;while(o--){i[o]=r(t[o])}return i}function mapDomain(t,r){var i=t.split("@");var o="";if(i.length>1){o=i[0]+"@";t=i[1]}t=t.replace(b,".");var a=t.split(".");var c=map(a,r).join(".");return o+c}function ucs2decode(t){var r=[];var i=0;var o=t.length;while(i<o){var a=t.charCodeAt(i++);if(a>=55296&&a<=56319&&i<o){var c=t.charCodeAt(i++);if((c&64512)==56320){r.push(((a&1023)<<10)+(c&1023)+65536)}else{r.push(a);i--}}else{r.push(a)}}return r}var x=function ucs2encode(t){return String.fromCodePoint.apply(String,toConsumableArray(t))};var R=function basicToDigit(t){if(t-48<10){return t-22}if(t-65<26){return t-65}if(t-97<26){return t-97}return c};var O=function digitToBasic(t,r){return t+22+75*(t<26)-((r!=0)<<5)};var P=function adapt(t,r,i){var o=0;t=i?S(t/d):t>>1;t+=S(t/r);for(;t>E*u>>1;o+=c){t=S(t/E)}return S(o+(E+1)*t/(t+h))};var A=function decode(t){var r=[];var i=t.length;var o=0;var h=m;var d=p;var y=t.lastIndexOf(g);if(y<0){y=0}for(var v=0;v<y;++v){if(t.charCodeAt(v)>=128){error$1("not-basic")}r.push(t.charCodeAt(v))}for(var b=y>0?y+1:0;b<i;){var w=o;for(var E=1,$=c;;$+=c){if(b>=i){error$1("invalid-input")}var x=R(t.charCodeAt(b++));if(x>=c||x>S((a-o)/E)){error$1("overflow")}o+=x*E;var O=$<=d?l:$>=d+u?u:$-d;if(x<O){break}var A=c-O;if(E>S(a/A)){error$1("overflow")}E*=A}var T=r.length+1;d=P(o-w,T,w==0);if(S(o/T)>a-h){error$1("overflow")}h+=S(o/T);o%=T;r.splice(o++,0,h)}return String.fromCodePoint.apply(String,r)};var T=function encode(t){var r=[];t=ucs2decode(t);var i=t.length;var o=m;var h=0;var d=p;var y=true;var v=false;var b=undefined;try{for(var w=t[Symbol.iterator](),E;!(y=(E=w.next()).done);y=true){var x=E.value;if(x<128){r.push($(x))}}}catch(t){v=true;b=t}finally{try{if(!y&&w.return){w.return()}}finally{if(v){throw b}}}var R=r.length;var A=R;if(R){r.push(g)}while(A<i){var T=a;var C=true;var k=false;var I=undefined;try{for(var N=t[Symbol.iterator](),D;!(C=(D=N.next()).done);C=true){var L=D.value;if(L>=o&&L<T){T=L}}}catch(t){k=true;I=t}finally{try{if(!C&&N.return){N.return()}}finally{if(k){throw I}}}var M=A+1;if(T-o>S((a-h)/M)){error$1("overflow")}h+=(T-o)*M;o=T;var j=true;var U=false;var B=undefined;try{for(var H=t[Symbol.iterator](),V;!(j=(V=H.next()).done);j=true){var z=V.value;if(z<o&&++h>a){error$1("overflow")}if(z==o){var G=h;for(var q=c;;q+=c){var W=q<=d?l:q>=d+u?u:q-d;if(G<W){break}var K=G-W;var Y=c-W;r.push($(O(W+K%Y,0)));G=S(K/Y)}r.push($(O(G,0)));d=P(h,M,A==R);h=0;++A}}}catch(t){U=true;B=t}finally{try{if(!j&&H.return){H.return()}}finally{if(U){throw B}}}++h;++o}return r.join("")};var C=function toUnicode(t){return mapDomain(t,(function(t){return y.test(t)?A(t.slice(4).toLowerCase()):t}))};var k=function toASCII(t){return mapDomain(t,(function(t){return v.test(t)?"xn--"+T(t):t}))};var I={version:"2.1.0",ucs2:{decode:ucs2decode,encode:x},decode:A,encode:T,toASCII:k,toUnicode:C};var N={};function pctEncChar(t){var r=t.charCodeAt(0);var i=void 0;if(r<16)i="%0"+r.toString(16).toUpperCase();else if(r<128)i="%"+r.toString(16).toUpperCase();else if(r<2048)i="%"+(r>>6|192).toString(16).toUpperCase()+"%"+(r&63|128).toString(16).toUpperCase();else i="%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(r&63|128).toString(16).toUpperCase();return i}function pctDecChars(t){var r="";var i=0;var o=t.length;while(i<o){var a=parseInt(t.substr(i+1,2),16);if(a<128){r+=String.fromCharCode(a);i+=3}else if(a>=194&&a<224){if(o-i>=6){var c=parseInt(t.substr(i+4,2),16);r+=String.fromCharCode((a&31)<<6|c&63)}else{r+=t.substr(i,6)}i+=6}else if(a>=224){if(o-i>=9){var l=parseInt(t.substr(i+4,2),16);var u=parseInt(t.substr(i+7,2),16);r+=String.fromCharCode((a&15)<<12|(l&63)<<6|u&63)}else{r+=t.substr(i,9)}i+=9}else{r+=t.substr(i,3);i+=3}}return r}function _normalizeComponentEncoding(t,r){function decodeUnreserved(t){var i=pctDecChars(t);return!i.match(r.UNRESERVED)?t:i}if(t.scheme)t.scheme=String(t.scheme).replace(r.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(r.NOT_SCHEME,"");if(t.userinfo!==undefined)t.userinfo=String(t.userinfo).replace(r.PCT_ENCODED,decodeUnreserved).replace(r.NOT_USERINFO,pctEncChar).replace(r.PCT_ENCODED,toUpperCase);if(t.host!==undefined)t.host=String(t.host).replace(r.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(r.NOT_HOST,pctEncChar).replace(r.PCT_ENCODED,toUpperCase);if(t.path!==undefined)t.path=String(t.path).replace(r.PCT_ENCODED,decodeUnreserved).replace(t.scheme?r.NOT_PATH:r.NOT_PATH_NOSCHEME,pctEncChar).replace(r.PCT_ENCODED,toUpperCase);if(t.query!==undefined)t.query=String(t.query).replace(r.PCT_ENCODED,decodeUnreserved).replace(r.NOT_QUERY,pctEncChar).replace(r.PCT_ENCODED,toUpperCase);if(t.fragment!==undefined)t.fragment=String(t.fragment).replace(r.PCT_ENCODED,decodeUnreserved).replace(r.NOT_FRAGMENT,pctEncChar).replace(r.PCT_ENCODED,toUpperCase);return t}function _stripLeadingZeros(t){return t.replace(/^0*(.*)/,"$1")||"0"}function _normalizeIPv4(t,r){var i=t.match(r.IPV4ADDRESS)||[];var a=o(i,2),c=a[1];if(c){return c.split(".").map(_stripLeadingZeros).join(".")}else{return t}}function _normalizeIPv6(t,r){var i=t.match(r.IPV6ADDRESS)||[];var a=o(i,3),c=a[1],l=a[2];if(c){var u=c.toLowerCase().split("::").reverse(),h=o(u,2),d=h[0],p=h[1];var m=p?p.split(":").map(_stripLeadingZeros):[];var g=d.split(":").map(_stripLeadingZeros);var y=r.IPV4ADDRESS.test(g[g.length-1]);var v=y?7:8;var b=g.length-v;var w=Array(v);for(var E=0;E<v;++E){w[E]=m[E]||g[b+E]||""}if(y){w[v-1]=_normalizeIPv4(w[v-1],r)}var S=w.reduce((function(t,r,i){if(!r||r==="0"){var o=t[t.length-1];if(o&&o.index+o.length===i){o.length++}else{t.push({index:i,length:1})}}return t}),[]);var $=S.sort((function(t,r){return r.length-t.length}))[0];var x=void 0;if($&&$.length>1){var R=w.slice(0,$.index);var O=w.slice($.index+$.length);x=R.join(":")+"::"+O.join(":")}else{x=w.join(":")}if(l){x+="%"+l}return x}else{return t}}var D=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;var L="".match(/(){0}/)[1]===undefined;function parse(t){var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var a={};var c=o.iri!==false?i:r;if(o.reference==="suffix")t=(o.scheme?o.scheme+":":"")+"//"+t;var l=t.match(D);if(l){if(L){a.scheme=l[1];a.userinfo=l[3];a.host=l[4];a.port=parseInt(l[5],10);a.path=l[6]||"";a.query=l[7];a.fragment=l[8];if(isNaN(a.port)){a.port=l[5]}}else{a.scheme=l[1]||undefined;a.userinfo=t.indexOf("@")!==-1?l[3]:undefined;a.host=t.indexOf("//")!==-1?l[4]:undefined;a.port=parseInt(l[5],10);a.path=l[6]||"";a.query=t.indexOf("?")!==-1?l[7]:undefined;a.fragment=t.indexOf("#")!==-1?l[8]:undefined;if(isNaN(a.port)){a.port=t.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?l[4]:undefined}}if(a.host){a.host=_normalizeIPv6(_normalizeIPv4(a.host,c),c)}if(a.scheme===undefined&&a.userinfo===undefined&&a.host===undefined&&a.port===undefined&&!a.path&&a.query===undefined){a.reference="same-document"}else if(a.scheme===undefined){a.reference="relative"}else if(a.fragment===undefined){a.reference="absolute"}else{a.reference="uri"}if(o.reference&&o.reference!=="suffix"&&o.reference!==a.reference){a.error=a.error||"URI is not a "+o.reference+" reference."}var u=N[(o.scheme||a.scheme||"").toLowerCase()];if(!o.unicodeSupport&&(!u||!u.unicodeSupport)){if(a.host&&(o.domainHost||u&&u.domainHost)){try{a.host=I.toASCII(a.host.replace(c.PCT_ENCODED,pctDecChars).toLowerCase())}catch(t){a.error=a.error||"Host's domain name can not be converted to ASCII via punycode: "+t}}_normalizeComponentEncoding(a,r)}else{_normalizeComponentEncoding(a,c)}if(u&&u.parse){u.parse(a,o)}}else{a.error=a.error||"URI can not be parsed."}return a}function _recomposeAuthority(t,o){var a=o.iri!==false?i:r;var c=[];if(t.userinfo!==undefined){c.push(t.userinfo);c.push("@")}if(t.host!==undefined){c.push(_normalizeIPv6(_normalizeIPv4(String(t.host),a),a).replace(a.IPV6ADDRESS,(function(t,r,i){return"["+r+(i?"%25"+i:"")+"]"})))}if(typeof t.port==="number"||typeof t.port==="string"){c.push(":");c.push(String(t.port))}return c.length?c.join(""):undefined}var M=/^\.\.?\//;var j=/^\/\.(\/|$)/;var U=/^\/\.\.(\/|$)/;var B=/^\/?(?:.|\n)*?(?=\/|$)/;function removeDotSegments(t){var r=[];while(t.length){if(t.match(M)){t=t.replace(M,"")}else if(t.match(j)){t=t.replace(j,"/")}else if(t.match(U)){t=t.replace(U,"/");r.pop()}else if(t==="."||t===".."){t=""}else{var i=t.match(B);if(i){var o=i[0];t=t.slice(o.length);r.push(o)}else{throw new Error("Unexpected dot segment condition")}}}return r.join("")}function serialize(t){var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var a=o.iri?i:r;var c=[];var l=N[(o.scheme||t.scheme||"").toLowerCase()];if(l&&l.serialize)l.serialize(t,o);if(t.host){if(a.IPV6ADDRESS.test(t.host)){}else if(o.domainHost||l&&l.domainHost){try{t.host=!o.iri?I.toASCII(t.host.replace(a.PCT_ENCODED,pctDecChars).toLowerCase()):I.toUnicode(t.host)}catch(r){t.error=t.error||"Host's domain name can not be converted to "+(!o.iri?"ASCII":"Unicode")+" via punycode: "+r}}}_normalizeComponentEncoding(t,a);if(o.reference!=="suffix"&&t.scheme){c.push(t.scheme);c.push(":")}var u=_recomposeAuthority(t,o);if(u!==undefined){if(o.reference!=="suffix"){c.push("//")}c.push(u);if(t.path&&t.path.charAt(0)!=="/"){c.push("/")}}if(t.path!==undefined){var h=t.path;if(!o.absolutePath&&(!l||!l.absolutePath)){h=removeDotSegments(h)}if(u===undefined){h=h.replace(/^\/\//,"/%2F")}c.push(h)}if(t.query!==undefined){c.push("?");c.push(t.query)}if(t.fragment!==undefined){c.push("#");c.push(t.fragment)}return c.join("")}function resolveComponents(t,r){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var o=arguments[3];var a={};if(!o){t=parse(serialize(t,i),i);r=parse(serialize(r,i),i)}i=i||{};if(!i.tolerant&&r.scheme){a.scheme=r.scheme;a.userinfo=r.userinfo;a.host=r.host;a.port=r.port;a.path=removeDotSegments(r.path||"");a.query=r.query}else{if(r.userinfo!==undefined||r.host!==undefined||r.port!==undefined){a.userinfo=r.userinfo;a.host=r.host;a.port=r.port;a.path=removeDotSegments(r.path||"");a.query=r.query}else{if(!r.path){a.path=t.path;if(r.query!==undefined){a.query=r.query}else{a.query=t.query}}else{if(r.path.charAt(0)==="/"){a.path=removeDotSegments(r.path)}else{if((t.userinfo!==undefined||t.host!==undefined||t.port!==undefined)&&!t.path){a.path="/"+r.path}else if(!t.path){a.path=r.path}else{a.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path}a.path=removeDotSegments(a.path)}a.query=r.query}a.userinfo=t.userinfo;a.host=t.host;a.port=t.port}a.scheme=t.scheme}a.fragment=r.fragment;return a}function resolve(t,r,i){var o=assign({scheme:"null"},i);return serialize(resolveComponents(parse(t,o),parse(r,o),o,true),o)}function normalize(t,r){if(typeof t==="string"){t=serialize(parse(t,r),r)}else if(typeOf(t)==="object"){t=parse(serialize(t,r),r)}return t}function equal(t,r,i){if(typeof t==="string"){t=serialize(parse(t,i),i)}else if(typeOf(t)==="object"){t=serialize(t,i)}if(typeof r==="string"){r=serialize(parse(r,i),i)}else if(typeOf(r)==="object"){r=serialize(r,i)}return t===r}function escapeComponent(t,o){return t&&t.toString().replace(!o||!o.iri?r.ESCAPE:i.ESCAPE,pctEncChar)}function unescapeComponent(t,o){return t&&t.toString().replace(!o||!o.iri?r.PCT_ENCODED:i.PCT_ENCODED,pctDecChars)}var H={scheme:"http",domainHost:true,parse:function parse(t,r){if(!t.host){t.error=t.error||"HTTP URIs must have a host."}return t},serialize:function serialize(t,r){var i=String(t.scheme).toLowerCase()==="https";if(t.port===(i?443:80)||t.port===""){t.port=undefined}if(!t.path){t.path="/"}return t}};var V={scheme:"https",domainHost:H.domainHost,parse:H.parse,serialize:H.serialize};function isSecure(t){return typeof t.secure==="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}var z={scheme:"ws",domainHost:true,parse:function parse(t,r){var i=t;i.secure=isSecure(i);i.resourceName=(i.path||"/")+(i.query?"?"+i.query:"");i.path=undefined;i.query=undefined;return i},serialize:function serialize(t,r){if(t.port===(isSecure(t)?443:80)||t.port===""){t.port=undefined}if(typeof t.secure==="boolean"){t.scheme=t.secure?"wss":"ws";t.secure=undefined}if(t.resourceName){var i=t.resourceName.split("?"),a=o(i,2),c=a[0],l=a[1];t.path=c&&c!=="/"?c:undefined;t.query=l;t.resourceName=undefined}t.fragment=undefined;return t}};var G={scheme:"wss",domainHost:z.domainHost,parse:z.parse,serialize:z.serialize};var q={};var W=true;var K="[A-Za-z0-9\\-\\.\\_\\~"+(W?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]";var Y="[0-9A-Fa-f]";var Z=subexp(subexp("%[EFef]"+Y+"%"+Y+Y+"%"+Y+Y)+"|"+subexp("%[89A-Fa-f]"+Y+"%"+Y+Y)+"|"+subexp("%"+Y+Y));var X="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";var J="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";var Q=merge(J,'[\\"\\\\]');var ee="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";var te=new RegExp(K,"g");var re=new RegExp(Z,"g");var se=new RegExp(merge("[^]",X,"[\\.]",'[\\"]',Q),"g");var ie=new RegExp(merge("[^]",K,ee),"g");var ne=ie;function decodeUnreserved(t){var r=pctDecChars(t);return!r.match(te)?t:r}var oe={scheme:"mailto",parse:function parse$$1(t,r){var i=t;var o=i.to=i.path?i.path.split(","):[];i.path=undefined;if(i.query){var a=false;var c={};var l=i.query.split("&");for(var u=0,h=l.length;u<h;++u){var d=l[u].split("=");switch(d[0]){case"to":var p=d[1].split(",");for(var m=0,g=p.length;m<g;++m){o.push(p[m])}break;case"subject":i.subject=unescapeComponent(d[1],r);break;case"body":i.body=unescapeComponent(d[1],r);break;default:a=true;c[unescapeComponent(d[0],r)]=unescapeComponent(d[1],r);break}}if(a)i.headers=c}i.query=undefined;for(var y=0,v=o.length;y<v;++y){var b=o[y].split("@");b[0]=unescapeComponent(b[0]);if(!r.unicodeSupport){try{b[1]=I.toASCII(unescapeComponent(b[1],r).toLowerCase())}catch(t){i.error=i.error||"Email address's domain name can not be converted to ASCII via punycode: "+t}}else{b[1]=unescapeComponent(b[1],r).toLowerCase()}o[y]=b.join("@")}return i},serialize:function serialize$$1(t,r){var i=t;var o=toArray(t.to);if(o){for(var a=0,c=o.length;a<c;++a){var l=String(o[a]);var u=l.lastIndexOf("@");var h=l.slice(0,u).replace(re,decodeUnreserved).replace(re,toUpperCase).replace(se,pctEncChar);var d=l.slice(u+1);try{d=!r.iri?I.toASCII(unescapeComponent(d,r).toLowerCase()):I.toUnicode(d)}catch(t){i.error=i.error||"Email address's domain name can not be converted to "+(!r.iri?"ASCII":"Unicode")+" via punycode: "+t}o[a]=h+"@"+d}i.path=o.join(",")}var p=t.headers=t.headers||{};if(t.subject)p["subject"]=t.subject;if(t.body)p["body"]=t.body;var m=[];for(var g in p){if(p[g]!==q[g]){m.push(g.replace(re,decodeUnreserved).replace(re,toUpperCase).replace(ie,pctEncChar)+"="+p[g].replace(re,decodeUnreserved).replace(re,toUpperCase).replace(ne,pctEncChar))}}if(m.length){i.query=m.join("&")}return i}};var ae=/^([^\:]+)\:(.*)/;var ce={scheme:"urn",parse:function parse$$1(t,r){var i=t.path&&t.path.match(ae);var o=t;if(i){var a=r.scheme||o.scheme||"urn";var c=i[1].toLowerCase();var l=i[2];var u=a+":"+(r.nid||c);var h=N[u];o.nid=c;o.nss=l;o.path=undefined;if(h){o=h.parse(o,r)}}else{o.error=o.error||"URN can not be parsed."}return o},serialize:function serialize$$1(t,r){var i=r.scheme||t.scheme||"urn";var o=t.nid;var a=i+":"+(r.nid||o);var c=N[a];if(c){t=c.serialize(t,r)}var l=t;var u=t.nss;l.path=(o||r.nid)+":"+u;return l}};var le=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;var ue={scheme:"urn:uuid",parse:function parse(t,r){var i=t;i.uuid=i.nss;i.nss=undefined;if(!r.tolerant&&(!i.uuid||!i.uuid.match(le))){i.error=i.error||"UUID is not valid."}return i},serialize:function serialize(t,r){var i=t;i.nss=(t.uuid||"").toLowerCase();return i}};N[H.scheme]=H;N[V.scheme]=V;N[z.scheme]=z;N[G.scheme]=G;N[oe.scheme]=oe;N[ce.scheme]=ce;N[ue.scheme]=ue;t.SCHEMES=N;t.pctEncChar=pctEncChar;t.pctDecChars=pctDecChars;t.parse=parse;t.removeDotSegments=removeDotSegments;t.serialize=serialize;t.resolveComponents=resolveComponents;t.resolve=resolve;t.normalize=normalize;t.equal=equal;t.escapeComponent=escapeComponent;t.unescapeComponent=unescapeComponent;Object.defineProperty(t,"__esModule",{value:true})}))},6982:(t,r,i)=>{"use strict";const{builtinModules:o}=i(8188);var a=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");var c=["node_modules","favicon.ico"];function validate(t){var r=[];var i=[];if(t===null){i.push("name cannot be null");return done(r,i)}if(t===undefined){i.push("name cannot be undefined");return done(r,i)}if(typeof t!=="string"){i.push("name must be a string");return done(r,i)}if(!t.length){i.push("name length must be greater than zero")}if(t.match(/^\./)){i.push("name cannot start with a period")}if(t.match(/^_/)){i.push("name cannot start with an underscore")}if(t.trim()!==t){i.push("name cannot contain leading or trailing spaces")}c.forEach((function(r){if(t.toLowerCase()===r){i.push(r+" is a blacklisted name")}}));if(o.includes(t.toLowerCase())){r.push(t+" is a core module name")}if(t.length>214){r.push("name can no longer contain more than 214 characters")}if(t.toLowerCase()!==t){r.push("name can no longer contain capital letters")}if(/[~'!()*]/.test(t.split("/").slice(-1)[0])){r.push('name can no longer contain special characters ("~\'!()*")')}if(encodeURIComponent(t)!==t){var l=t.match(a);if(l){var u=l[1];var h=l[2];if(encodeURIComponent(u)===u&&encodeURIComponent(h)===h){return done(r,i)}}i.push("name can only contain URL-friendly characters")}return done(r,i)}var done=function(t,r){var i={validForNewPackages:r.length===0&&t.length===0,validForOldPackages:r.length===0,warnings:t,errors:r};if(!i.warnings.length){delete i.warnings}if(!i.errors.length){delete i.errors}return i};t.exports=validate},6470:(t,r,i)=>{const o=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys";const a=i(1017);const c=o?";":":";const l=i(2636);const getNotFoundError=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"});const getPathInfo=(t,r)=>{const i=r.colon||c;const a=t.match(/\//)||o&&t.match(/\\/)?[""]:[...o?[process.cwd()]:[],...(r.path||process.env.PATH||"").split(i)];const l=o?r.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"";const u=o?l.split(i):[""];if(o){if(t.indexOf(".")!==-1&&u[0]!=="")u.unshift("")}return{pathEnv:a,pathExt:u,pathExtExe:l}};const which=(t,r,i)=>{if(typeof r==="function"){i=r;r={}}if(!r)r={};const{pathEnv:o,pathExt:c,pathExtExe:u}=getPathInfo(t,r);const h=[];const step=i=>new Promise(((c,l)=>{if(i===o.length)return r.all&&h.length?c(h):l(getNotFoundError(t));const u=o[i];const d=/^".*"$/.test(u)?u.slice(1,-1):u;const p=a.join(d,t);const m=!d&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;c(subStep(m,i,0))}));const subStep=(t,i,o)=>new Promise(((a,d)=>{if(o===c.length)return a(step(i+1));const p=c[o];l(t+p,{pathExt:u},((c,l)=>{if(!c&&l){if(r.all)h.push(t+p);else return a(t+p)}return a(subStep(t,i,o+1))}))}));return i?step(0).then((t=>i(null,t)),i):step(0)};const whichSync=(t,r)=>{r=r||{};const{pathEnv:i,pathExt:o,pathExtExe:c}=getPathInfo(t,r);const u=[];for(let h=0;h<i.length;h++){const d=i[h];const p=/^".*"$/.test(d)?d.slice(1,-1):d;const m=a.join(p,t);const g=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;for(let t=0;t<o.length;t++){const i=g+o[t];try{const t=l.sync(i,{pathExt:c});if(t){if(r.all)u.push(i);else return i}}catch(t){}}}if(r.all&&u.length)return u;if(r.nothrow)return null;throw getNotFoundError(t)};t.exports=which;which.sync=whichSync},4300:t=>{"use strict";t.exports=require("buffer")},2081:t=>{"use strict";t.exports=require("child_process")},2361:t=>{"use strict";t.exports=require("events")},7147:t=>{"use strict";t.exports=require("fs")},3685:t=>{"use strict";t.exports=require("http")},5687:t=>{"use strict";t.exports=require("https")},8188:t=>{"use strict";t.exports=require("module")},7718:t=>{"use strict";t.exports=require("node:child_process")},5673:t=>{"use strict";t.exports=require("node:events")},7561:t=>{"use strict";t.exports=require("node:fs")},9411:t=>{"use strict";t.exports=require("node:path")},7742:t=>{"use strict";t.exports=require("node:process")},2037:t=>{"use strict";t.exports=require("os")},1017:t=>{"use strict";t.exports=require("path")},4521:t=>{"use strict";t.exports=require("readline")},9955:t=>{"use strict";t.exports=require("stream")},6224:t=>{"use strict";t.exports=require("tty")},7310:t=>{"use strict";t.exports=require("url")},3837:t=>{"use strict";t.exports=require("util")},8878:(t,r,i)=>{const{Argument:o}=i(6654);const{Command:a}=i(5955);const{CommanderError:c,InvalidArgumentError:l}=i(2829);const{Help:u}=i(8567);const{Option:h}=i(9230);r.program=new a;r.createCommand=t=>new a(t);r.createOption=(t,r)=>new h(t,r);r.createArgument=(t,r)=>new o(t,r);r.Command=a;r.Option=h;r.Argument=o;r.Help=u;r.CommanderError=c;r.InvalidArgumentError=l;r.InvalidOptionArgumentError=l},6654:(t,r,i)=>{const{InvalidArgumentError:o}=i(2829);class Argument{constructor(t,r){this.description=r||"";this.variadic=false;this.parseArg=undefined;this.defaultValue=undefined;this.defaultValueDescription=undefined;this.argChoices=undefined;switch(t[0]){case"<":this.required=true;this._name=t.slice(1,-1);break;case"[":this.required=false;this._name=t.slice(1,-1);break;default:this.required=true;this._name=t;break}if(this._name.length>3&&this._name.slice(-3)==="..."){this.variadic=true;this._name=this._name.slice(0,-3)}}name(){return this._name}_concatValue(t,r){if(r===this.defaultValue||!Array.isArray(r)){return[t]}return r.concat(t)}default(t,r){this.defaultValue=t;this.defaultValueDescription=r;return this}argParser(t){this.parseArg=t;return this}choices(t){this.argChoices=t.slice();this.parseArg=(t,r)=>{if(!this.argChoices.includes(t)){throw new o(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,r)}return t};return this}argRequired(){this.required=true;return this}argOptional(){this.required=false;return this}}function humanReadableArgName(t){const r=t.name()+(t.variadic===true?"...":"");return t.required?"<"+r+">":"["+r+"]"}r.Argument=Argument;r.humanReadableArgName=humanReadableArgName},5955:(t,r,i)=>{const o=i(5673).EventEmitter;const a=i(7718);const c=i(9411);const l=i(7561);const u=i(7742);const{Argument:h,humanReadableArgName:d}=i(6654);const{CommanderError:p}=i(2829);const{Help:m}=i(8567);const{Option:g,DualOptions:y}=i(9230);const{suggestSimilar:v}=i(3241);class Command extends o{constructor(t){super();this.commands=[];this.options=[];this.parent=null;this._allowUnknownOption=false;this._allowExcessArguments=true;this.registeredArguments=[];this._args=this.registeredArguments;this.args=[];this.rawArgs=[];this.processedArgs=[];this._scriptPath=null;this._name=t||"";this._optionValues={};this._optionValueSources={};this._storeOptionsAsProperties=false;this._actionHandler=null;this._executableHandler=false;this._executableFile=null;this._executableDir=null;this._defaultCommandName=null;this._exitCallback=null;this._aliases=[];this._combineFlagAndOptionalValue=true;this._description="";this._summary="";this._argsDescription=undefined;this._enablePositionalOptions=false;this._passThroughOptions=false;this._lifeCycleHooks={};this._showHelpAfterError=false;this._showSuggestionAfterError=true;this._outputConfiguration={writeOut:t=>u.stdout.write(t),writeErr:t=>u.stderr.write(t),getOutHelpWidth:()=>u.stdout.isTTY?u.stdout.columns:undefined,getErrHelpWidth:()=>u.stderr.isTTY?u.stderr.columns:undefined,outputError:(t,r)=>r(t)};this._hidden=false;this._helpOption=undefined;this._addImplicitHelpCommand=undefined;this._helpCommand=undefined;this._helpConfiguration={}}copyInheritedSettings(t){this._outputConfiguration=t._outputConfiguration;this._helpOption=t._helpOption;this._helpCommand=t._helpCommand;this._helpConfiguration=t._helpConfiguration;this._exitCallback=t._exitCallback;this._storeOptionsAsProperties=t._storeOptionsAsProperties;this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue;this._allowExcessArguments=t._allowExcessArguments;this._enablePositionalOptions=t._enablePositionalOptions;this._showHelpAfterError=t._showHelpAfterError;this._showSuggestionAfterError=t._showSuggestionAfterError;return this}_getCommandAndAncestors(){const t=[];for(let r=this;r;r=r.parent){t.push(r)}return t}command(t,r,i){let o=r;let a=i;if(typeof o==="object"&&o!==null){a=o;o=null}a=a||{};const[,c,l]=t.match(/([^ ]+) *(.*)/);const u=this.createCommand(c);if(o){u.description(o);u._executableHandler=true}if(a.isDefault)this._defaultCommandName=u._name;u._hidden=!!(a.noHelp||a.hidden);u._executableFile=a.executableFile||null;if(l)u.arguments(l);this._registerCommand(u);u.parent=this;u.copyInheritedSettings(this);if(o)return this;return u}createCommand(t){return new Command(t)}createHelp(){return Object.assign(new m,this.configureHelp())}configureHelp(t){if(t===undefined)return this._helpConfiguration;this._helpConfiguration=t;return this}configureOutput(t){if(t===undefined)return this._outputConfiguration;Object.assign(this._outputConfiguration,t);return this}showHelpAfterError(t=true){if(typeof t!=="string")t=!!t;this._showHelpAfterError=t;return this}showSuggestionAfterError(t=true){this._showSuggestionAfterError=!!t;return this}addCommand(t,r){if(!t._name){throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`)}r=r||{};if(r.isDefault)this._defaultCommandName=t._name;if(r.noHelp||r.hidden)t._hidden=true;this._registerCommand(t);t.parent=this;t._checkForBrokenPassThrough();return this}createArgument(t,r){return new h(t,r)}argument(t,r,i,o){const a=this.createArgument(t,r);if(typeof i==="function"){a.default(o).argParser(i)}else{a.default(i)}this.addArgument(a);return this}arguments(t){t.trim().split(/ +/).forEach((t=>{this.argument(t)}));return this}addArgument(t){const r=this.registeredArguments.slice(-1)[0];if(r&&r.variadic){throw new Error(`only the last argument can be variadic '${r.name()}'`)}if(t.required&&t.defaultValue!==undefined&&t.parseArg===undefined){throw new Error(`a default value for a required argument is never used: '${t.name()}'`)}this.registeredArguments.push(t);return this}helpCommand(t,r){if(typeof t==="boolean"){this._addImplicitHelpCommand=t;return this}t=t??"help [command]";const[,i,o]=t.match(/([^ ]+) *(.*)/);const a=r??"display help for command";const c=this.createCommand(i);c.helpOption(false);if(o)c.arguments(o);if(a)c.description(a);this._addImplicitHelpCommand=true;this._helpCommand=c;return this}addHelpCommand(t,r){if(typeof t!=="object"){this.helpCommand(t,r);return this}this._addImplicitHelpCommand=true;this._helpCommand=t;return this}_getHelpCommand(){const t=this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"));if(t){if(this._helpCommand===undefined){this.helpCommand(undefined,undefined)}return this._helpCommand}return null}hook(t,r){const i=["preSubcommand","preAction","postAction"];if(!i.includes(t)){throw new Error(`Unexpected value for event passed to hook : '${t}'.\nExpecting one of '${i.join("', '")}'`)}if(this._lifeCycleHooks[t]){this._lifeCycleHooks[t].push(r)}else{this._lifeCycleHooks[t]=[r]}return this}exitOverride(t){if(t){this._exitCallback=t}else{this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync"){throw t}else{}}}return this}_exit(t,r,i){if(this._exitCallback){this._exitCallback(new p(t,r,i))}u.exit(t)}action(t){const listener=r=>{const i=this.registeredArguments.length;const o=r.slice(0,i);if(this._storeOptionsAsProperties){o[i]=this}else{o[i]=this.opts()}o.push(this);return t.apply(this,o)};this._actionHandler=listener;return this}createOption(t,r){return new g(t,r)}_callParseArg(t,r,i,o){try{return t.parseArg(r,i)}catch(t){if(t.code==="commander.invalidArgument"){const r=`${o} ${t.message}`;this.error(r,{exitCode:t.exitCode,code:t.code})}throw t}}_registerOption(t){const r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){const i=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'\n- already used by option '${r.flags}'`)}this.options.push(t)}_registerCommand(t){const knownBy=t=>[t.name()].concat(t.aliases());const r=knownBy(t).find((t=>this._findCommand(t)));if(r){const i=knownBy(this._findCommand(r)).join("|");const o=knownBy(t).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);const r=t.name();const i=t.attributeName();if(t.negate){const r=t.long.replace(/^--no-/,"--");if(!this._findOption(r)){this.setOptionValueWithSource(i,t.defaultValue===undefined?true:t.defaultValue,"default")}}else if(t.defaultValue!==undefined){this.setOptionValueWithSource(i,t.defaultValue,"default")}const handleOptionValue=(r,o,a)=>{if(r==null&&t.presetArg!==undefined){r=t.presetArg}const c=this.getOptionValue(i);if(r!==null&&t.parseArg){r=this._callParseArg(t,r,c,o)}else if(r!==null&&t.variadic){r=t._concatValue(r,c)}if(r==null){if(t.negate){r=false}else if(t.isBoolean()||t.optional){r=true}else{r=""}}this.setOptionValueWithSource(i,r,a)};this.on("option:"+r,(r=>{const i=`error: option '${t.flags}' argument '${r}' is invalid.`;handleOptionValue(r,i,"cli")}));if(t.envVar){this.on("optionEnv:"+r,(r=>{const i=`error: option '${t.flags}' value '${r}' from env '${t.envVar}' is invalid.`;handleOptionValue(r,i,"env")}))}return this}_optionEx(t,r,i,o,a){if(typeof r==="object"&&r instanceof g){throw new Error("To add an Option object use addOption() instead of option() or requiredOption()")}const c=this.createOption(r,i);c.makeOptionMandatory(!!t.mandatory);if(typeof o==="function"){c.default(a).argParser(o)}else if(o instanceof RegExp){const t=o;o=(r,i)=>{const o=t.exec(r);return o?o[0]:i};c.default(a).argParser(o)}else{c.default(o)}return this.addOption(c)}option(t,r,i,o){return this._optionEx({},t,r,i,o)}requiredOption(t,r,i,o){return this._optionEx({mandatory:true},t,r,i,o)}combineFlagAndOptionalValue(t=true){this._combineFlagAndOptionalValue=!!t;return this}allowUnknownOption(t=true){this._allowUnknownOption=!!t;return this}allowExcessArguments(t=true){this._allowExcessArguments=!!t;return this}enablePositionalOptions(t=true){this._enablePositionalOptions=!!t;return this}passThroughOptions(t=true){this._passThroughOptions=!!t;this._checkForBrokenPassThrough();return this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions){throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}}storeOptionsAsProperties(t=true){if(this.options.length){throw new Error("call .storeOptionsAsProperties() before adding options")}if(Object.keys(this._optionValues).length){throw new Error("call .storeOptionsAsProperties() before setting option values")}this._storeOptionsAsProperties=!!t;return this}getOptionValue(t){if(this._storeOptionsAsProperties){return this[t]}return this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,undefined)}setOptionValueWithSource(t,r,i){if(this._storeOptionsAsProperties){this[t]=r}else{this._optionValues[t]=r}this._optionValueSources[t]=i;return this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;this._getCommandAndAncestors().forEach((i=>{if(i.getOptionValueSource(t)!==undefined){r=i.getOptionValueSource(t)}}));return r}_prepareUserArgs(t,r){if(t!==undefined&&!Array.isArray(t)){throw new Error("first parameter to parse must be array or undefined")}r=r||{};if(t===undefined&&r.from===undefined){if(u.versions?.electron){r.from="electron"}const t=u.execArgv??[];if(t.includes("-e")||t.includes("--eval")||t.includes("-p")||t.includes("--print")){r.from="eval"}}if(t===undefined){t=u.argv}this.rawArgs=t.slice();let i;switch(r.from){case undefined:case"node":this._scriptPath=t[1];i=t.slice(2);break;case"electron":if(u.defaultApp){this._scriptPath=t[1];i=t.slice(2)}else{i=t.slice(1)}break;case"user":i=t.slice(0);break;case"eval":i=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);this._name=this._name||"program";return i}parse(t,r){const i=this._prepareUserArgs(t,r);this._parseCommand([],i);return this}async parseAsync(t,r){const i=this._prepareUserArgs(t,r);await this._parseCommand([],i);return this}_executeSubCommand(t,r){r=r.slice();let i=false;const o=[".js",".ts",".tsx",".mjs",".cjs"];function findFile(t,r){const i=c.resolve(t,r);if(l.existsSync(i))return i;if(o.includes(c.extname(r)))return undefined;const a=o.find((t=>l.existsSync(`${i}${t}`)));if(a)return`${i}${a}`;return undefined}this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();let h=t._executableFile||`${this._name}-${t._name}`;let d=this._executableDir||"";if(this._scriptPath){let t;try{t=l.realpathSync(this._scriptPath)}catch(r){t=this._scriptPath}d=c.resolve(c.dirname(t),d)}if(d){let r=findFile(d,h);if(!r&&!t._executableFile&&this._scriptPath){const i=c.basename(this._scriptPath,c.extname(this._scriptPath));if(i!==this._name){r=findFile(d,`${i}-${t._name}`)}}h=r||h}i=o.includes(c.extname(h));let m;if(u.platform!=="win32"){if(i){r.unshift(h);r=incrementNodeInspectorPort(u.execArgv).concat(r);m=a.spawn(u.argv[0],r,{stdio:"inherit"})}else{m=a.spawn(h,r,{stdio:"inherit"})}}else{r.unshift(h);r=incrementNodeInspectorPort(u.execArgv).concat(r);m=a.spawn(u.execPath,r,{stdio:"inherit"})}if(!m.killed){const t=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];t.forEach((t=>{u.on(t,(()=>{if(m.killed===false&&m.exitCode===null){m.kill(t)}}))}))}const g=this._exitCallback;m.on("close",(t=>{t=t??1;if(!g){u.exit(t)}else{g(new p(t,"commander.executeSubCommandAsync","(close)"))}}));m.on("error",(r=>{if(r.code==="ENOENT"){const r=d?`searched for local subcommand relative to directory '${d}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";const i=`'${h}' does not exist\n - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${r}`;throw new Error(i)}else if(r.code==="EACCES"){throw new Error(`'${h}' not executable`)}if(!g){u.exit(1)}else{const t=new p(1,"commander.executeSubCommandAsync","(error)");t.nestedError=r;g(t)}}));this.runningCommand=m}_dispatchSubcommand(t,r,i){const o=this._findCommand(t);if(!o)this.help({error:true});let a;a=this._chainOrCallSubCommandHook(a,o,"preSubcommand");a=this._chainOrCall(a,(()=>{if(o._executableHandler){this._executeSubCommand(o,r.concat(i))}else{return o._parseCommand(r,i)}}));return a}_dispatchHelpCommand(t){if(!t){this.help()}const r=this._findCommand(t);if(r&&!r._executableHandler){r.help()}return this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach(((t,r)=>{if(t.required&&this.args[r]==null){this.missingArgument(t.name())}}));if(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic){return}if(this.args.length>this.registeredArguments.length){this._excessArguments(this.args)}}_processArguments(){const myParseArg=(t,r,i)=>{let o=r;if(r!==null&&t.parseArg){const a=`error: command-argument value '${r}' is invalid for argument '${t.name()}'.`;o=this._callParseArg(t,r,i,a)}return o};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach(((r,i)=>{let o=r.defaultValue;if(r.variadic){if(i<this.args.length){o=this.args.slice(i);if(r.parseArg){o=o.reduce(((t,i)=>myParseArg(r,i,t)),r.defaultValue)}}else if(o===undefined){o=[]}}else if(i<this.args.length){o=this.args[i];if(r.parseArg){o=myParseArg(r,o,r.defaultValue)}}t[i]=o}));this.processedArgs=t}_chainOrCall(t,r){if(t&&t.then&&typeof t.then==="function"){return t.then((()=>r()))}return r()}_chainOrCallHooks(t,r){let i=t;const o=[];this._getCommandAndAncestors().reverse().filter((t=>t._lifeCycleHooks[r]!==undefined)).forEach((t=>{t._lifeCycleHooks[r].forEach((r=>{o.push({hookedCommand:t,callback:r})}))}));if(r==="postAction"){o.reverse()}o.forEach((t=>{i=this._chainOrCall(i,(()=>t.callback(t.hookedCommand,this)))}));return i}_chainOrCallSubCommandHook(t,r,i){let o=t;if(this._lifeCycleHooks[i]!==undefined){this._lifeCycleHooks[i].forEach((t=>{o=this._chainOrCall(o,(()=>t(this,r)))}))}return o}_parseCommand(t,r){const i=this.parseOptions(r);this._parseOptionsEnv();this._parseOptionsImplied();t=t.concat(i.operands);r=i.unknown;this.args=t.concat(r);if(t&&this._findCommand(t[0])){return this._dispatchSubcommand(t[0],t.slice(1),r)}if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name()){return this._dispatchHelpCommand(t[1])}if(this._defaultCommandName){this._outputHelpIfRequested(r);return this._dispatchSubcommand(this._defaultCommandName,t,r)}if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName){this.help({error:true})}this._outputHelpIfRequested(i.unknown);this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();const checkForUnknownOptions=()=>{if(i.unknown.length>0){this.unknownOption(i.unknown[0])}};const o=`command:${this.name()}`;if(this._actionHandler){checkForUnknownOptions();this._processArguments();let i;i=this._chainOrCallHooks(i,"preAction");i=this._chainOrCall(i,(()=>this._actionHandler(this.processedArgs)));if(this.parent){i=this._chainOrCall(i,(()=>{this.parent.emit(o,t,r)}))}i=this._chainOrCallHooks(i,"postAction");return i}if(this.parent&&this.parent.listenerCount(o)){checkForUnknownOptions();this._processArguments();this.parent.emit(o,t,r)}else if(t.length){if(this._findCommand("*")){return this._dispatchSubcommand("*",t,r)}if(this.listenerCount("command:*")){this.emit("command:*",t,r)}else if(this.commands.length){this.unknownCommand()}else{checkForUnknownOptions();this._processArguments()}}else if(this.commands.length){checkForUnknownOptions();this.help({error:true})}else{checkForUnknownOptions();this._processArguments()}}_findCommand(t){if(!t)return undefined;return this.commands.find((r=>r._name===t||r._aliases.includes(t)))}_findOption(t){return this.options.find((r=>r.is(t)))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((t=>{t.options.forEach((r=>{if(r.mandatory&&t.getOptionValue(r.attributeName())===undefined){t.missingMandatoryOptionValue(r)}}))}))}_checkForConflictingLocalOptions(){const t=this.options.filter((t=>{const r=t.attributeName();if(this.getOptionValue(r)===undefined){return false}return this.getOptionValueSource(r)!=="default"}));const r=t.filter((t=>t.conflictsWith.length>0));r.forEach((r=>{const i=t.find((t=>r.conflictsWith.includes(t.attributeName())));if(i){this._conflictingOption(r,i)}}))}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((t=>{t._checkForConflictingLocalOptions()}))}parseOptions(t){const r=[];const i=[];let o=r;const a=t.slice();function maybeOption(t){return t.length>1&&t[0]==="-"}let c=null;while(a.length){const t=a.shift();if(t==="--"){if(o===i)o.push(t);o.push(...a);break}if(c&&!maybeOption(t)){this.emit(`option:${c.name()}`,t);continue}c=null;if(maybeOption(t)){const r=this._findOption(t);if(r){if(r.required){const t=a.shift();if(t===undefined)this.optionMissingArgument(r);this.emit(`option:${r.name()}`,t)}else if(r.optional){let t=null;if(a.length>0&&!maybeOption(a[0])){t=a.shift()}this.emit(`option:${r.name()}`,t)}else{this.emit(`option:${r.name()}`)}c=r.variadic?r:null;continue}}if(t.length>2&&t[0]==="-"&&t[1]!=="-"){const r=this._findOption(`-${t[1]}`);if(r){if(r.required||r.optional&&this._combineFlagAndOptionalValue){this.emit(`option:${r.name()}`,t.slice(2))}else{this.emit(`option:${r.name()}`);a.unshift(`-${t.slice(2)}`)}continue}}if(/^--[^=]+=/.test(t)){const r=t.indexOf("=");const i=this._findOption(t.slice(0,r));if(i&&(i.required||i.optional)){this.emit(`option:${i.name()}`,t.slice(r+1));continue}}if(maybeOption(t)){o=i}if((this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&i.length===0){if(this._findCommand(t)){r.push(t);if(a.length>0)i.push(...a);break}else if(this._getHelpCommand()&&t===this._getHelpCommand().name()){r.push(t);if(a.length>0)r.push(...a);break}else if(this._defaultCommandName){i.push(t);if(a.length>0)i.push(...a);break}}if(this._passThroughOptions){o.push(t);if(a.length>0)o.push(...a);break}o.push(t)}return{operands:r,unknown:i}}opts(){if(this._storeOptionsAsProperties){const t={};const r=this.options.length;for(let i=0;i<r;i++){const r=this.options[i].attributeName();t[r]=r===this._versionOptionName?this._version:this[r]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(((t,r)=>Object.assign(t,r.opts())),{})}error(t,r){this._outputConfiguration.outputError(`${t}\n`,this._outputConfiguration.writeErr);if(typeof this._showHelpAfterError==="string"){this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`)}else if(this._showHelpAfterError){this._outputConfiguration.writeErr("\n");this.outputHelp({error:true})}const i=r||{};const o=i.exitCode||1;const a=i.code||"commander.error";this._exit(o,a,t)}_parseOptionsEnv(){this.options.forEach((t=>{if(t.envVar&&t.envVar in u.env){const r=t.attributeName();if(this.getOptionValue(r)===undefined||["default","config","env"].includes(this.getOptionValueSource(r))){if(t.required||t.optional){this.emit(`optionEnv:${t.name()}`,u.env[t.envVar])}else{this.emit(`optionEnv:${t.name()}`)}}}}))}_parseOptionsImplied(){const t=new y(this.options);const hasCustomOptionValue=t=>this.getOptionValue(t)!==undefined&&!["default","implied"].includes(this.getOptionValueSource(t));this.options.filter((r=>r.implied!==undefined&&hasCustomOptionValue(r.attributeName())&&t.valueFromOption(this.getOptionValue(r.attributeName()),r))).forEach((t=>{Object.keys(t.implied).filter((t=>!hasCustomOptionValue(t))).forEach((r=>{this.setOptionValueWithSource(r,t.implied[r],"implied")}))}))}missingArgument(t){const r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){const r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){const r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){const findBestOptionFromValue=t=>{const r=t.attributeName();const i=this.getOptionValue(r);const o=this.options.find((t=>t.negate&&r===t.attributeName()));const a=this.options.find((t=>!t.negate&&r===t.attributeName()));if(o&&(o.presetArg===undefined&&i===false||o.presetArg!==undefined&&i===o.presetArg)){return o}return a||t};const getErrorMessage=t=>{const r=findBestOptionFromValue(t);const i=r.attributeName();const o=this.getOptionValueSource(i);if(o==="env"){return`environment variable '${r.envVar}'`}return`option '${r.flags}'`};const i=`error: ${getErrorMessage(t)} cannot be used with ${getErrorMessage(r)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let i=[];let o=this;do{const t=o.createHelp().visibleOptions(o).filter((t=>t.long)).map((t=>t.long));i=i.concat(t);o=o.parent}while(o&&!o._enablePositionalOptions);r=v(t,i)}const i=`error: unknown option '${t}'${r}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;const r=this.registeredArguments.length;const i=r===1?"":"s";const o=this.parent?` for '${this.name()}'`:"";const a=`error: too many arguments${o}. Expected ${r} argument${i} but got ${t.length}.`;this.error(a,{code:"commander.excessArguments"})}unknownCommand(){const t=this.args[0];let r="";if(this._showSuggestionAfterError){const i=[];this.createHelp().visibleCommands(this).forEach((t=>{i.push(t.name());if(t.alias())i.push(t.alias())}));r=v(t,i)}const i=`error: unknown command '${t}'${r}`;this.error(i,{code:"commander.unknownCommand"})}version(t,r,i){if(t===undefined)return this._version;this._version=t;r=r||"-V, --version";i=i||"output the version number";const o=this.createOption(r,i);this._versionOptionName=o.attributeName();this._registerOption(o);this.on("option:"+o.name(),(()=>{this._outputConfiguration.writeOut(`${t}\n`);this._exit(0,"commander.version",t)}));return this}description(t,r){if(t===undefined&&r===undefined)return this._description;this._description=t;if(r){this._argsDescription=r}return this}summary(t){if(t===undefined)return this._summary;this._summary=t;return this}alias(t){if(t===undefined)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler){r=this.commands[this.commands.length-1]}if(t===r._name)throw new Error("Command alias can't be the same as its name");const i=this.parent?._findCommand(t);if(i){const r=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${r}'`)}r._aliases.push(t);return this}aliases(t){if(t===undefined)return this._aliases;t.forEach((t=>this.alias(t)));return this}usage(t){if(t===undefined){if(this._usage)return this._usage;const t=this.registeredArguments.map((t=>d(t)));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}this._usage=t;return this}name(t){if(t===undefined)return this._name;this._name=t;return this}nameFromFilename(t){this._name=c.basename(t,c.extname(t));return this}executableDir(t){if(t===undefined)return this._executableDir;this._executableDir=t;return this}helpInformation(t){const r=this.createHelp();if(r.helpWidth===undefined){r.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()}return r.formatHelp(this,r)}_getHelpContext(t){t=t||{};const r={error:!!t.error};let i;if(r.error){i=t=>this._outputConfiguration.writeErr(t)}else{i=t=>this._outputConfiguration.writeOut(t)}r.write=t.write||i;r.command=this;return r}outputHelp(t){let r;if(typeof t==="function"){r=t;t=undefined}const i=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach((t=>t.emit("beforeAllHelp",i)));this.emit("beforeHelp",i);let o=this.helpInformation(i);if(r){o=r(o);if(typeof o!=="string"&&!Buffer.isBuffer(o)){throw new Error("outputHelp callback must return a string or a Buffer")}}i.write(o);if(this._getHelpOption()?.long){this.emit(this._getHelpOption().long)}this.emit("afterHelp",i);this._getCommandAndAncestors().forEach((t=>t.emit("afterAllHelp",i)))}helpOption(t,r){if(typeof t==="boolean"){if(t){this._helpOption=this._helpOption??undefined}else{this._helpOption=null}return this}t=t??"-h, --help";r=r??"display help for command";this._helpOption=this.createOption(t,r);return this}_getHelpOption(){if(this._helpOption===undefined){this.helpOption(undefined,undefined)}return this._helpOption}addHelpOption(t){this._helpOption=t;return this}help(t){this.outputHelp(t);let r=u.exitCode||0;if(r===0&&t&&typeof t!=="function"&&t.error){r=1}this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){const i=["beforeAll","before","after","afterAll"];if(!i.includes(t)){throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${i.join("', '")}'`)}const o=`${t}Help`;this.on(o,(t=>{let i;if(typeof r==="function"){i=r({error:t.error,command:t.command})}else{i=r}if(i){t.write(`${i}\n`)}}));return this}_outputHelpIfRequested(t){const r=this._getHelpOption();const i=r&&t.find((t=>r.is(t)));if(i){this.outputHelp();this._exit(0,"commander.helpDisplayed","(outputHelp)")}}}function incrementNodeInspectorPort(t){return t.map((t=>{if(!t.startsWith("--inspect")){return t}let r;let i="127.0.0.1";let o="9229";let a;if((a=t.match(/^(--inspect(-brk)?)$/))!==null){r=a[1]}else if((a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){r=a[1];if(/^\d+$/.test(a[3])){o=a[3]}else{i=a[3]}}else if((a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){r=a[1];i=a[3];o=a[4]}if(r&&o!=="0"){return`${r}=${i}:${parseInt(o)+1}`}return t}))}r.Command=Command},2829:(t,r)=>{class CommanderError extends Error{constructor(t,r,i){super(i);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name;this.code=r;this.exitCode=t;this.nestedError=undefined}}class InvalidArgumentError extends CommanderError{constructor(t){super(1,"commander.invalidArgument",t);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name}}r.CommanderError=CommanderError;r.InvalidArgumentError=InvalidArgumentError},8567:(t,r,i)=>{const{humanReadableArgName:o}=i(6654);class Help{constructor(){this.helpWidth=undefined;this.sortSubcommands=false;this.sortOptions=false;this.showGlobalOptions=false}visibleCommands(t){const r=t.commands.filter((t=>!t._hidden));const i=t._getHelpCommand();if(i&&!i._hidden){r.push(i)}if(this.sortSubcommands){r.sort(((t,r)=>t.name().localeCompare(r.name())))}return r}compareOptions(t,r){const getSortKey=t=>t.short?t.short.replace(/^-/,""):t.long.replace(/^--/,"");return getSortKey(t).localeCompare(getSortKey(r))}visibleOptions(t){const r=t.options.filter((t=>!t.hidden));const i=t._getHelpOption();if(i&&!i.hidden){const o=i.short&&t._findOption(i.short);const a=i.long&&t._findOption(i.long);if(!o&&!a){r.push(i)}else if(i.long&&!a){r.push(t.createOption(i.long,i.description))}else if(i.short&&!o){r.push(t.createOption(i.short,i.description))}}if(this.sortOptions){r.sort(this.compareOptions)}return r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];const r=[];for(let i=t.parent;i;i=i.parent){const t=i.options.filter((t=>!t.hidden));r.push(...t)}if(this.sortOptions){r.sort(this.compareOptions)}return r}visibleArguments(t){if(t._argsDescription){t.registeredArguments.forEach((r=>{r.description=r.description||t._argsDescription[r.name()]||""}))}if(t.registeredArguments.find((t=>t.description))){return t.registeredArguments}return[]}subcommandTerm(t){const r=t.registeredArguments.map((t=>o(t))).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce(((t,i)=>Math.max(t,r.subcommandTerm(i).length)),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce(((t,i)=>Math.max(t,r.optionTerm(i).length)),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce(((t,i)=>Math.max(t,r.optionTerm(i).length)),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce(((t,i)=>Math.max(t,r.argumentTerm(i).length)),0)}commandUsage(t){let r=t._name;if(t._aliases[0]){r=r+"|"+t._aliases[0]}let i="";for(let r=t.parent;r;r=r.parent){i=r.name()+" "+i}return i+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){const r=[];if(t.argChoices){r.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){const i=t.required||t.optional||t.isBoolean()&&typeof t.defaultValue==="boolean";if(i){r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}}if(t.presetArg!==undefined&&t.optional){r.push(`preset: ${JSON.stringify(t.presetArg)}`)}if(t.envVar!==undefined){r.push(`env: ${t.envVar}`)}if(r.length>0){return`${t.description} (${r.join(", ")})`}return t.description}argumentDescription(t){const r=[];if(t.argChoices){r.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}if(r.length>0){const i=`(${r.join(", ")})`;if(t.description){return`${t.description} ${i}`}return i}return t.description}formatHelp(t,r){const i=r.padWidth(t,r);const o=r.helpWidth||80;const a=2;const c=2;function formatItem(t,l){if(l){const u=`${t.padEnd(i+c)}${l}`;return r.wrap(u,o-a,i+c)}return t}function formatList(t){return t.join("\n").replace(/^/gm," ".repeat(a))}let l=[`Usage: ${r.commandUsage(t)}`,""];const u=r.commandDescription(t);if(u.length>0){l=l.concat([r.wrap(u,o,0),""])}const h=r.visibleArguments(t).map((t=>formatItem(r.argumentTerm(t),r.argumentDescription(t))));if(h.length>0){l=l.concat(["Arguments:",formatList(h),""])}const d=r.visibleOptions(t).map((t=>formatItem(r.optionTerm(t),r.optionDescription(t))));if(d.length>0){l=l.concat(["Options:",formatList(d),""])}if(this.showGlobalOptions){const i=r.visibleGlobalOptions(t).map((t=>formatItem(r.optionTerm(t),r.optionDescription(t))));if(i.length>0){l=l.concat(["Global Options:",formatList(i),""])}}const p=r.visibleCommands(t).map((t=>formatItem(r.subcommandTerm(t),r.subcommandDescription(t))));if(p.length>0){l=l.concat(["Commands:",formatList(p),""])}return l.join("\n")}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}wrap(t,r,i,o=40){const a=" \\f\\t\\v - \ufeff";const c=new RegExp(`[\\n][${a}]+`);if(t.match(c))return t;const l=r-i;if(l<o)return t;const u=t.slice(0,i);const h=t.slice(i).replace("\r\n","\n");const d=" ".repeat(i);const p="";const m=`\\s${p}`;const g=new RegExp(`\n|.{1,${l-1}}([${m}]|$)|[^${m}]+?([${m}]|$)`,"g");const y=h.match(g)||[];return u+y.map(((t,r)=>{if(t==="\n")return"";return(r>0?d:"")+t.trimEnd()})).join("\n")}}r.Help=Help},9230:(t,r,i)=>{const{InvalidArgumentError:o}=i(2829);class Option{constructor(t,r){this.flags=t;this.description=r||"";this.required=t.includes("<");this.optional=t.includes("[");this.variadic=/\w\.\.\.[>\]]$/.test(t);this.mandatory=false;const i=splitOptionFlags(t);this.short=i.shortFlag;this.long=i.longFlag;this.negate=false;if(this.long){this.negate=this.long.startsWith("--no-")}this.defaultValue=undefined;this.defaultValueDescription=undefined;this.presetArg=undefined;this.envVar=undefined;this.parseArg=undefined;this.hidden=false;this.argChoices=undefined;this.conflictsWith=[];this.implied=undefined}default(t,r){this.defaultValue=t;this.defaultValueDescription=r;return this}preset(t){this.presetArg=t;return this}conflicts(t){this.conflictsWith=this.conflictsWith.concat(t);return this}implies(t){let r=t;if(typeof t==="string"){r={[t]:true}}this.implied=Object.assign(this.implied||{},r);return this}env(t){this.envVar=t;return this}argParser(t){this.parseArg=t;return this}makeOptionMandatory(t=true){this.mandatory=!!t;return this}hideHelp(t=true){this.hidden=!!t;return this}_concatValue(t,r){if(r===this.defaultValue||!Array.isArray(r)){return[t]}return r.concat(t)}choices(t){this.argChoices=t.slice();this.parseArg=(t,r)=>{if(!this.argChoices.includes(t)){throw new o(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,r)}return t};return this}name(){if(this.long){return this.long.replace(/^--/,"")}return this.short.replace(/^-/,"")}attributeName(){return camelcase(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class DualOptions{constructor(t){this.positiveOptions=new Map;this.negativeOptions=new Map;this.dualOptions=new Set;t.forEach((t=>{if(t.negate){this.negativeOptions.set(t.attributeName(),t)}else{this.positiveOptions.set(t.attributeName(),t)}}));this.negativeOptions.forEach(((t,r)=>{if(this.positiveOptions.has(r)){this.dualOptions.add(r)}}))}valueFromOption(t,r){const i=r.attributeName();if(!this.dualOptions.has(i))return true;const o=this.negativeOptions.get(i).presetArg;const a=o!==undefined?o:false;return r.negate===(a===t)}}function camelcase(t){return t.split("-").reduce(((t,r)=>t+r[0].toUpperCase()+r.slice(1)))}function splitOptionFlags(t){let r;let i;const o=t.split(/[ |,]+/);if(o.length>1&&!/^[[<]/.test(o[1]))r=o.shift();i=o.shift();if(!r&&/^-[^-]$/.test(i)){r=i;i=undefined}return{shortFlag:r,longFlag:i}}r.Option=Option;r.DualOptions=DualOptions},3241:(t,r)=>{const i=3;function editDistance(t,r){if(Math.abs(t.length-r.length)>i)return Math.max(t.length,r.length);const o=[];for(let r=0;r<=t.length;r++){o[r]=[r]}for(let t=0;t<=r.length;t++){o[0][t]=t}for(let i=1;i<=r.length;i++){for(let a=1;a<=t.length;a++){let c=1;if(t[a-1]===r[i-1]){c=0}else{c=1}o[a][i]=Math.min(o[a-1][i]+1,o[a][i-1]+1,o[a-1][i-1]+c);if(a>1&&i>1&&t[a-1]===r[i-2]&&t[a-2]===r[i-1]){o[a][i]=Math.min(o[a][i],o[a-2][i-2]+1)}}}return o[t.length][r.length]}function suggestSimilar(t,r){if(!r||r.length===0)return"";r=Array.from(new Set(r));const o=t.startsWith("--");if(o){t=t.slice(2);r=r.map((t=>t.slice(2)))}let a=[];let c=i;const l=.4;r.forEach((r=>{if(r.length<=1)return;const i=editDistance(t,r);const o=Math.max(t.length,r.length);const u=(o-i)/o;if(u>l){if(i<c){c=i;a=[r]}else if(i===c){a.push(r)}}}));a.sort(((t,r)=>t.localeCompare(r)));if(o){a=a.map((t=>`--${t}`))}if(a.length>1){return`\n(Did you mean one of ${a.join(", ")}?)`}if(a.length===1){return`\n(Did you mean ${a[0]}?)`}return""}r.suggestSimilar=suggestSimilar},5227:t=>{"use strict";t.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},2650:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/applicator","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/applicator":true},"$dynamicAnchor":"meta","title":"Applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"prefixItems":{"$ref":"#/$defs/schemaArray"},"items":{"$dynamicRef":"#meta"},"contains":{"$dynamicRef":"#meta"},"additionalProperties":{"$dynamicRef":"#meta"},"properties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"propertyNames":{"format":"regex"},"default":{}},"dependentSchemas":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"propertyNames":{"$dynamicRef":"#meta"},"if":{"$dynamicRef":"#meta"},"then":{"$dynamicRef":"#meta"},"else":{"$dynamicRef":"#meta"},"allOf":{"$ref":"#/$defs/schemaArray"},"anyOf":{"$ref":"#/$defs/schemaArray"},"oneOf":{"$ref":"#/$defs/schemaArray"},"not":{"$dynamicRef":"#meta"}},"$defs":{"schemaArray":{"type":"array","minItems":1,"items":{"$dynamicRef":"#meta"}}}}')},1828:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/content","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Content vocabulary meta-schema","type":["object","boolean"],"properties":{"contentEncoding":{"type":"string"},"contentMediaType":{"type":"string"},"contentSchema":{"$dynamicRef":"#meta"}}}')},2720:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/core","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true},"$dynamicAnchor":"meta","title":"Core vocabulary meta-schema","type":["object","boolean"],"properties":{"$id":{"$ref":"#/$defs/uriReferenceString","$comment":"Non-empty fragments not allowed.","pattern":"^[^#]*#?$"},"$schema":{"$ref":"#/$defs/uriString"},"$ref":{"$ref":"#/$defs/uriReferenceString"},"$anchor":{"$ref":"#/$defs/anchorString"},"$dynamicRef":{"$ref":"#/$defs/uriReferenceString"},"$dynamicAnchor":{"$ref":"#/$defs/anchorString"},"$vocabulary":{"type":"object","propertyNames":{"$ref":"#/$defs/uriString"},"additionalProperties":{"type":"boolean"}},"$comment":{"type":"string"},"$defs":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"}}},"$defs":{"anchorString":{"type":"string","pattern":"^[A-Za-z_][-A-Za-z0-9._]*$"},"uriString":{"type":"string","format":"uri"},"uriReferenceString":{"type":"string","format":"uri-reference"}}}')},8805:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/format-annotation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/format-annotation":true},"$dynamicAnchor":"meta","title":"Format vocabulary meta-schema for annotation results","type":["object","boolean"],"properties":{"format":{"type":"string"}}}')},5607:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/meta-data","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/meta-data":true},"$dynamicAnchor":"meta","title":"Meta-data vocabulary meta-schema","type":["object","boolean"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"default":true,"deprecated":{"type":"boolean","default":false},"readOnly":{"type":"boolean","default":false},"writeOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true}}}')},8814:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/unevaluated","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/unevaluated":true},"$dynamicAnchor":"meta","title":"Unevaluated applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"unevaluatedItems":{"$dynamicRef":"#meta"},"unevaluatedProperties":{"$dynamicRef":"#meta"}}}')},1400:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/validation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/validation":true},"$dynamicAnchor":"meta","title":"Validation vocabulary meta-schema","type":["object","boolean"],"properties":{"type":{"anyOf":[{"$ref":"#/$defs/simpleTypes"},{"type":"array","items":{"$ref":"#/$defs/simpleTypes"},"minItems":1,"uniqueItems":true}]},"const":true,"enum":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/$defs/nonNegativeInteger"},"minLength":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"maxItems":{"$ref":"#/$defs/nonNegativeInteger"},"minItems":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"maxContains":{"$ref":"#/$defs/nonNegativeInteger"},"minContains":{"$ref":"#/$defs/nonNegativeInteger","default":1},"maxProperties":{"$ref":"#/$defs/nonNegativeInteger"},"minProperties":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"required":{"$ref":"#/$defs/stringArray"},"dependentRequired":{"type":"object","additionalProperties":{"$ref":"#/$defs/stringArray"}}},"$defs":{"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"$ref":"#/$defs/nonNegativeInteger","default":0},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}}}')},6642:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/schema","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true,"https://json-schema.org/draft/2020-12/vocab/applicator":true,"https://json-schema.org/draft/2020-12/vocab/unevaluated":true,"https://json-schema.org/draft/2020-12/vocab/validation":true,"https://json-schema.org/draft/2020-12/vocab/meta-data":true,"https://json-schema.org/draft/2020-12/vocab/format-annotation":true,"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Core and Validation specifications meta-schema","allOf":[{"$ref":"meta/core"},{"$ref":"meta/applicator"},{"$ref":"meta/unevaluated"},{"$ref":"meta/validation"},{"$ref":"meta/meta-data"},{"$ref":"meta/format-annotation"},{"$ref":"meta/content"}],"type":["object","boolean"],"$comment":"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.","properties":{"definitions":{"$comment":"\\"definitions\\" has been replaced by \\"$defs\\".","type":"object","additionalProperties":{"$dynamicRef":"#meta"},"deprecated":true,"default":{}},"dependencies":{"$comment":"\\"dependencies\\" has been split and replaced by \\"dependentSchemas\\" and \\"dependentRequired\\" in order to serve their differing semantics.","type":"object","additionalProperties":{"anyOf":[{"$dynamicRef":"#meta"},{"$ref":"meta/validation#/$defs/stringArray"}]},"deprecated":true,"default":{}},"$recursiveAnchor":{"$comment":"\\"$recursiveAnchor\\" has been replaced by \\"$dynamicAnchor\\".","$ref":"meta/core#/$defs/anchorString","deprecated":true},"$recursiveRef":{"$comment":"\\"$recursiveRef\\" has been replaced by \\"$dynamicRef\\".","$ref":"meta/core#/$defs/uriReferenceString","deprecated":true}}}')},5137:t=>{"use strict";t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},9116:t=>{"use strict";t.exports=JSON.parse('[{"name":"Agola CI","constant":"AGOLA","env":"AGOLA_GIT_REF","pr":"AGOLA_PULL_REQUEST_ID"},{"name":"Appcircle","constant":"APPCIRCLE","env":"AC_APPCIRCLE"},{"name":"AppVeyor","constant":"APPVEYOR","env":"APPVEYOR","pr":"APPVEYOR_PULL_REQUEST_NUMBER"},{"name":"AWS CodeBuild","constant":"CODEBUILD","env":"CODEBUILD_BUILD_ARN"},{"name":"Azure Pipelines","constant":"AZURE_PIPELINES","env":"TF_BUILD","pr":{"BUILD_REASON":"PullRequest"}},{"name":"Bamboo","constant":"BAMBOO","env":"bamboo_planKey"},{"name":"Bitbucket Pipelines","constant":"BITBUCKET","env":"BITBUCKET_COMMIT","pr":"BITBUCKET_PR_ID"},{"name":"Bitrise","constant":"BITRISE","env":"BITRISE_IO","pr":"BITRISE_PULL_REQUEST"},{"name":"Buddy","constant":"BUDDY","env":"BUDDY_WORKSPACE_ID","pr":"BUDDY_EXECUTION_PULL_REQUEST_ID"},{"name":"Buildkite","constant":"BUILDKITE","env":"BUILDKITE","pr":{"env":"BUILDKITE_PULL_REQUEST","ne":"false"}},{"name":"CircleCI","constant":"CIRCLE","env":"CIRCLECI","pr":"CIRCLE_PULL_REQUEST"},{"name":"Cirrus CI","constant":"CIRRUS","env":"CIRRUS_CI","pr":"CIRRUS_PR"},{"name":"Codefresh","constant":"CODEFRESH","env":"CF_BUILD_ID","pr":{"any":["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{"name":"Codemagic","constant":"CODEMAGIC","env":"CM_BUILD_ID","pr":"CM_PULL_REQUEST"},{"name":"Codeship","constant":"CODESHIP","env":{"CI_NAME":"codeship"}},{"name":"Drone","constant":"DRONE","env":"DRONE","pr":{"DRONE_BUILD_EVENT":"pull_request"}},{"name":"dsari","constant":"DSARI","env":"DSARI"},{"name":"Earthly","constant":"EARTHLY","env":"EARTHLY_CI"},{"name":"Expo Application Services","constant":"EAS","env":"EAS_BUILD"},{"name":"Gerrit","constant":"GERRIT","env":"GERRIT_PROJECT"},{"name":"Gitea Actions","constant":"GITEA_ACTIONS","env":"GITEA_ACTIONS"},{"name":"GitHub Actions","constant":"GITHUB_ACTIONS","env":"GITHUB_ACTIONS","pr":{"GITHUB_EVENT_NAME":"pull_request"}},{"name":"GitLab CI","constant":"GITLAB","env":"GITLAB_CI","pr":"CI_MERGE_REQUEST_ID"},{"name":"GoCD","constant":"GOCD","env":"GO_PIPELINE_LABEL"},{"name":"Google Cloud Build","constant":"GOOGLE_CLOUD_BUILD","env":"BUILDER_OUTPUT"},{"name":"Harness CI","constant":"HARNESS","env":"HARNESS_BUILD_ID"},{"name":"Heroku","constant":"HEROKU","env":{"env":"NODE","includes":"/app/.heroku/node/bin/node"}},{"name":"Hudson","constant":"HUDSON","env":"HUDSON_URL"},{"name":"Jenkins","constant":"JENKINS","env":["JENKINS_URL","BUILD_ID"],"pr":{"any":["ghprbPullId","CHANGE_ID"]}},{"name":"LayerCI","constant":"LAYERCI","env":"LAYERCI","pr":"LAYERCI_PULL_REQUEST"},{"name":"Magnum CI","constant":"MAGNUM","env":"MAGNUM"},{"name":"Netlify CI","constant":"NETLIFY","env":"NETLIFY","pr":{"env":"PULL_REQUEST","ne":"false"}},{"name":"Nevercode","constant":"NEVERCODE","env":"NEVERCODE","pr":{"env":"NEVERCODE_PULL_REQUEST","ne":"false"}},{"name":"Prow","constant":"PROW","env":"PROW_JOB_ID"},{"name":"ReleaseHub","constant":"RELEASEHUB","env":"RELEASE_BUILD_ID"},{"name":"Render","constant":"RENDER","env":"RENDER","pr":{"IS_PULL_REQUEST":"true"}},{"name":"Sail CI","constant":"SAIL","env":"SAILCI","pr":"SAIL_PULL_REQUEST_NUMBER"},{"name":"Screwdriver","constant":"SCREWDRIVER","env":"SCREWDRIVER","pr":{"env":"SD_PULL_REQUEST","ne":"false"}},{"name":"Semaphore","constant":"SEMAPHORE","env":"SEMAPHORE","pr":"PULL_REQUEST_NUMBER"},{"name":"Sourcehut","constant":"SOURCEHUT","env":{"CI_NAME":"sourcehut"}},{"name":"Strider CD","constant":"STRIDER","env":"STRIDER"},{"name":"TaskCluster","constant":"TASKCLUSTER","env":["TASK_ID","RUN_ID"]},{"name":"TeamCity","constant":"TEAMCITY","env":"TEAMCITY_VERSION"},{"name":"Travis CI","constant":"TRAVIS","env":"TRAVIS","pr":{"env":"TRAVIS_PULL_REQUEST","ne":"false"}},{"name":"Vela","constant":"VELA","env":"VELA","pr":{"VELA_PULL_REQUEST":"1"}},{"name":"Vercel","constant":"VERCEL","env":{"any":["NOW_BUILDER","VERCEL"]},"pr":"VERCEL_GIT_PULL_REQUEST_ID"},{"name":"Visual Studio App Center","constant":"APPCENTER","env":"APPCENTER_BUILD_ID"},{"name":"Woodpecker","constant":"WOODPECKER","env":{"CI":"woodpecker"},"pr":{"CI_BUILD_EVENT":"pull_request"}},{"name":"Xcode Cloud","constant":"XCODE_CLOUD","env":"CI_XCODE_PROJECT","pr":"CI_PULL_REQUEST_NUMBER"},{"name":"Xcode Server","constant":"XCODE_SERVER","env":"XCS"}]')}};var r={};function __nccwpck_require__(i){var o=r[i];if(o!==undefined){return o.exports}var a=r[i]={exports:{}};var c=true;try{t[i].call(a.exports,a,a.exports,__nccwpck_require__);c=false}finally{if(c)delete r[i]}return a.exports}(()=>{__nccwpck_require__.n=t=>{var r=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(r,{a:r});return r}})();(()=>{__nccwpck_require__.d=(t,r)=>{for(var i in r){if(__nccwpck_require__.o(r,i)&&!__nccwpck_require__.o(t,i)){Object.defineProperty(t,i,{enumerable:true,get:r[i]})}}}})();(()=>{__nccwpck_require__.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i={};(()=>{"use strict";__nccwpck_require__.r(i);var t=__nccwpck_require__(150);var r=__nccwpck_require__.n(t);var o=__nccwpck_require__(8878);const{program:a,createCommand:c,createArgument:l,createOption:u,CommanderError:h,InvalidArgumentError:d,InvalidOptionArgumentError:p,Command:m,Argument:g,Option:y,Help:v}=o;const b=require("node:util");var w=__nccwpck_require__(7742);var E=__nccwpck_require__(7561);var S=__nccwpck_require__(9411);const $=require("node:crypto");const x=require("node:assert");const isObject=t=>{const r=typeof t;return t!==null&&(r==="object"||r==="function")};const isEmptyObject=t=>isObject(t)&&Object.keys(t).length===0;const R=new Set(["__proto__","prototype","constructor"]);const O=new Set("0123456789");function getPathSegments(t){const r=[];let i="";let o="start";let a=false;for(const c of t){switch(c){case"\\":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){throw new Error("Invalid character after an index")}if(a){i+=c}o="property";a=!a;break}case".":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){o="property";break}if(a){a=false;i+=c;break}if(R.has(i)){return[]}r.push(i);i="";o="property";break}case"[":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){o="index";break}if(a){a=false;i+=c;break}if(o==="property"){if(R.has(i)){return[]}r.push(i);i=""}o="index";break}case"]":{if(o==="index"){r.push(Number.parseInt(i,10));i="";o="indexEnd";break}if(o==="indexEnd"){throw new Error("Invalid character after an index")}}default:{if(o==="index"&&!O.has(c)){throw new Error("Invalid character in an index")}if(o==="indexEnd"){throw new Error("Invalid character after an index")}if(o==="start"){o="property"}if(a){a=false;i+="\\"}i+=c}}}if(a){i+="\\"}switch(o){case"property":{if(R.has(i)){return[]}r.push(i);break}case"index":{throw new Error("Index was not closed")}case"start":{r.push("");break}}return r}function isStringIndex(t,r){if(typeof r!=="number"&&Array.isArray(t)){const i=Number.parseInt(r,10);return Number.isInteger(i)&&t[i]===t[r]}return false}function assertNotStringIndex(t,r){if(isStringIndex(t,r)){throw new Error("Cannot use string index")}}function getProperty(t,r,i){if(!isObject(t)||typeof r!=="string"){return i===undefined?t:i}const o=getPathSegments(r);if(o.length===0){return i}for(let r=0;r<o.length;r++){const a=o[r];if(isStringIndex(t,a)){t=r===o.length-1?undefined:null}else{t=t[a]}if(t===undefined||t===null){if(r!==o.length-1){return i}break}}return t===undefined?i:t}function setProperty(t,r,i){if(!isObject(t)||typeof r!=="string"){return t}const o=t;const a=getPathSegments(r);for(let r=0;r<a.length;r++){const o=a[r];assertNotStringIndex(t,o);if(r===a.length-1){t[o]=i}else if(!isObject(t[o])){t[o]=typeof a[r+1]==="number"?[]:{}}t=t[o]}return o}function deleteProperty(t,r){if(!isObject(t)||typeof r!=="string"){return false}const i=getPathSegments(r);for(let r=0;r<i.length;r++){const o=i[r];assertNotStringIndex(t,o);if(r===i.length-1){delete t[o];return true}t=t[o];if(!isObject(t)){return false}}}function hasProperty(t,r){if(!isObject(t)||typeof r!=="string"){return false}const i=getPathSegments(r);if(i.length===0){return false}for(const r of i){if(!isObject(t)||!(r in t)||isStringIndex(t,r)){return false}t=t[r]}return true}function escapePath(t){if(typeof t!=="string"){throw new TypeError("Expected a string")}return t.replaceAll(/[\\.[]/g,"\\$&")}function entries(t){const r=Object.entries(t);if(Array.isArray(t)){return r.map((([t,r])=>[Number(t),r]))}return r}function stringifyPath(t){let r="";for(let[i,o]of entries(t)){if(typeof o==="number"){r+=`[${o}]`}else{o=escapePath(o);r+=i===0?o:`.${o}`}}return r}function*deepKeysIterator(t,r=[]){if(!isObject(t)||isEmptyObject(t)){if(r.length>0){yield stringifyPath(r)}return}for(const[i,o]of entries(t)){yield*deepKeysIterator(o,[...r,i])}}function deepKeys(t){return[...deepKeysIterator(t)]}const P=require("node:os");const A=P.homedir();const T=P.tmpdir();const{env:C}=w;const macos=t=>{const r=S.join(A,"Library");return{data:S.join(r,"Application Support",t),config:S.join(r,"Preferences",t),cache:S.join(r,"Caches",t),log:S.join(r,"Logs",t),temp:S.join(T,t)}};const windows=t=>{const r=C.APPDATA||S.join(A,"AppData","Roaming");const i=C.LOCALAPPDATA||S.join(A,"AppData","Local");return{data:S.join(i,t,"Data"),config:S.join(r,t,"Config"),cache:S.join(i,t,"Cache"),log:S.join(i,t,"Log"),temp:S.join(T,t)}};const linux=t=>{const r=S.basename(A);return{data:S.join(C.XDG_DATA_HOME||S.join(A,".local","share"),t),config:S.join(C.XDG_CONFIG_HOME||S.join(A,".config"),t),cache:S.join(C.XDG_CACHE_HOME||S.join(A,".cache"),t),log:S.join(C.XDG_STATE_HOME||S.join(A,".local","state"),t),temp:S.join(T,r,t)}};function envPaths(t,{suffix:r="nodejs"}={}){if(typeof t!=="string"){throw new TypeError(`Expected a string, got ${typeof t}`)}if(r){t+=`-${r}`}if(w.platform==="darwin"){return macos(t)}if(w.platform==="win32"){return windows(t)}return linux(t)}const attemptifyAsync=(t,r)=>function attemptified(...i){return t.apply(undefined,i).catch(r)};const attemptifySync=(t,r)=>function attemptified(...i){try{return t.apply(undefined,i)}catch(t){return r(t)}};const k=w.getuid?!w.getuid():false;const I=1e4;const NOOP=()=>undefined;const N={isChangeErrorOk:t=>{if(!N.isNodeError(t))return false;const{code:r}=t;if(r==="ENOSYS")return true;if(!k&&(r==="EINVAL"||r==="EPERM"))return true;return false},isNodeError:t=>t instanceof Error,isRetriableError:t=>{if(!N.isNodeError(t))return false;const{code:r}=t;if(r==="EMFILE"||r==="ENFILE"||r==="EAGAIN"||r==="EBUSY"||r==="EACCESS"||r==="EACCES"||r==="EACCS"||r==="EPERM")return true;return false},onChangeError:t=>{if(!N.isNodeError(t))throw t;if(N.isChangeErrorOk(t))return;throw t}};const D=N;class RetryfyQueue{constructor(){this.interval=25;this.intervalId=undefined;this.limit=I;this.queueActive=new Set;this.queueWaiting=new Set;this.init=()=>{if(this.intervalId)return;this.intervalId=setInterval(this.tick,this.interval)};this.reset=()=>{if(!this.intervalId)return;clearInterval(this.intervalId);delete this.intervalId};this.add=t=>{this.queueWaiting.add(t);if(this.queueActive.size<this.limit/2){this.tick()}else{this.init()}};this.remove=t=>{this.queueWaiting.delete(t);this.queueActive.delete(t)};this.schedule=()=>new Promise((t=>{const cleanup=()=>this.remove(resolver);const resolver=()=>t(cleanup);this.add(resolver)}));this.tick=()=>{if(this.queueActive.size>=this.limit)return;if(!this.queueWaiting.size)return this.reset();for(const t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t);this.queueActive.add(t);t()}}}}const L=new RetryfyQueue;const retryifyAsync=(t,r)=>function retrified(i){return function attempt(...o){return L.schedule().then((a=>{const onResolve=t=>{a();return t};const onReject=t=>{a();if(Date.now()>=i)throw t;if(r(t)){const t=Math.round(100*Math.random());const r=new Promise((r=>setTimeout(r,t)));return r.then((()=>attempt.apply(undefined,o)))}throw t};return t.apply(undefined,o).then(onResolve,onReject)}))}};const retryifySync=(t,r)=>function retrified(i){return function attempt(...o){try{return t.apply(undefined,o)}catch(t){if(Date.now()>i)throw t;if(r(t))return attempt.apply(undefined,o);throw t}}};const M={attempt:{chmod:attemptifyAsync((0,b.promisify)(E.chmod),D.onChangeError),chown:attemptifyAsync((0,b.promisify)(E.chown),D.onChangeError),close:attemptifyAsync((0,b.promisify)(E.close),NOOP),fsync:attemptifyAsync((0,b.promisify)(E.fsync),NOOP),mkdir:attemptifyAsync((0,b.promisify)(E.mkdir),NOOP),realpath:attemptifyAsync((0,b.promisify)(E.realpath),NOOP),stat:attemptifyAsync((0,b.promisify)(E.stat),NOOP),unlink:attemptifyAsync((0,b.promisify)(E.unlink),NOOP),chmodSync:attemptifySync(E.chmodSync,D.onChangeError),chownSync:attemptifySync(E.chownSync,D.onChangeError),closeSync:attemptifySync(E.closeSync,NOOP),existsSync:attemptifySync(E.existsSync,NOOP),fsyncSync:attemptifySync(E.fsync,NOOP),mkdirSync:attemptifySync(E.mkdirSync,NOOP),realpathSync:attemptifySync(E.realpathSync,NOOP),statSync:attemptifySync(E.statSync,NOOP),unlinkSync:attemptifySync(E.unlinkSync,NOOP)},retry:{close:retryifyAsync((0,b.promisify)(E.close),D.isRetriableError),fsync:retryifyAsync((0,b.promisify)(E.fsync),D.isRetriableError),open:retryifyAsync((0,b.promisify)(E.open),D.isRetriableError),readFile:retryifyAsync((0,b.promisify)(E.readFile),D.isRetriableError),rename:retryifyAsync((0,b.promisify)(E.rename),D.isRetriableError),stat:retryifyAsync((0,b.promisify)(E.stat),D.isRetriableError),write:retryifyAsync((0,b.promisify)(E.write),D.isRetriableError),writeFile:retryifyAsync((0,b.promisify)(E.writeFile),D.isRetriableError),closeSync:retryifySync(E.closeSync,D.isRetriableError),fsyncSync:retryifySync(E.fsyncSync,D.isRetriableError),openSync:retryifySync(E.openSync,D.isRetriableError),readFileSync:retryifySync(E.readFileSync,D.isRetriableError),renameSync:retryifySync(E.renameSync,D.isRetriableError),statSync:retryifySync(E.statSync,D.isRetriableError),writeSync:retryifySync(E.writeSync,D.isRetriableError),writeFileSync:retryifySync(E.writeFileSync,D.isRetriableError)}};const j=M;const U="utf8";const B=438;const H=511;const V={};const z={};const G=P.userInfo().uid;const q=P.userInfo().gid;const W=7500;const K=1e3;const Y=!!w.getuid;const Z=w.getuid?!w.getuid():false;const X=128;const J=1e4;const constants_NOOP=()=>{};const lang_isException=t=>t instanceof Error&&"code"in t;const lang_isFunction=t=>typeof t==="function";const lang_isString=t=>typeof t==="string";const lang_isUndefined=t=>t===undefined;const Q={};const ee={next:t=>{const r=Q[t];if(!r)return;r.shift();const i=r[0];if(i){i((()=>ee.next(t)))}else{delete Q[t]}},schedule:t=>new Promise((r=>{let i=Q[t];if(!i)i=Q[t]=[];i.push(r);if(i.length>1)return;r((()=>ee.next(t)))}))};const te=null&ⅇconst re=w.platform==="linux";const se=w.platform==="win32";const ie=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(!se){ie.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT")}if(re){ie.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}const ne=ie;class Interceptor{constructor(){this.callbacks=new Set;this.exited=false;this.exit=t=>{if(this.exited)return;this.exited=true;for(const t of this.callbacks){t()}if(t){if(se&&(t!=="SIGINT"&&t!=="SIGTERM"&&t!=="SIGKILL")){w.kill(w.pid,"SIGTERM")}else{w.kill(w.pid,t)}}};this.hook=()=>{w.once("exit",(()=>this.exit()));for(const t of ne){w.once(t,(()=>this.exit(t)))}};this.register=t=>{this.callbacks.add(t);return()=>{this.callbacks.delete(t)}};this.hook()}}const oe=new Interceptor;const ae=oe.register;const ce=ae;const le={store:{},create:t=>{const r=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6);const i=Date.now().toString().slice(-10);const o="tmp-";const a=`.${o}${i}${r}`;const c=`${t}${a}`;return c},get:(t,r,i=true)=>{const o=le.truncate(r(t));if(o in le.store)return le.get(t,r,i);le.store[o]=i;const disposer=()=>delete le.store[o];return[o,disposer]},purge:t=>{if(!le.store[t])return;delete le.store[t];j.attempt.unlink(t)},purgeSync:t=>{if(!le.store[t])return;delete le.store[t];j.attempt.unlinkSync(t)},purgeSyncAll:()=>{for(const t in le.store){le.purgeSync(t)}},truncate:t=>{const r=S.basename(t);if(r.length<=X)return t;const i=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(r);if(!i)return t;const o=r.length-X;return`${t.slice(0,-r.length)}${i[1]}${i[2].slice(0,-o)}${i[3]}`}};ce(le.purgeSyncAll);const ue=le;function readFile(t,r=DEFAULT_READ_OPTIONS){if(isString(r))return readFile(t,{encoding:r});const i=Date.now()+((r.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);return fs.retry.readFile(i)(t,r)}function readFileSync(t,r=DEFAULT_READ_OPTIONS){if(isString(r))return readFileSync(t,{encoding:r});const i=Date.now()+((r.timeout??DEFAULT_TIMEOUT_SYNC)||-1);return fs.retry.readFileSync(i)(t,r)}function writeFile(t,r,i,o){if(isFunction(i))return writeFile(t,r,DEFAULT_WRITE_OPTIONS,i);const a=writeFileAsync(t,r,i);if(o)a.then(o,o);return a}async function writeFileAsync(t,r,i=DEFAULT_WRITE_OPTIONS){if(isString(i))return writeFileAsync(t,r,{encoding:i});const o=Date.now()+((i.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);let a=null;let c=null;let l=null;let u=null;let h=null;try{if(i.schedule)a=await i.schedule(t);c=await Scheduler.schedule(t);const d=await fs.attempt.realpath(t);const p=!!d;t=d||t;[u,l]=Temp.get(t,i.tmpCreate||Temp.create,!(i.tmpPurge===false));const m=IS_POSIX&&isUndefined(i.chown);const g=isUndefined(i.mode);if(p&&(m||g)){const r=await fs.attempt.stat(t);if(r){i={...i};if(m){i.chown={uid:r.uid,gid:r.gid}}if(g){i.mode=r.mode}}}if(!p){const r=path.dirname(t);await fs.attempt.mkdir(r,{mode:DEFAULT_FOLDER_MODE,recursive:true})}h=await fs.retry.open(o)(u,"w",i.mode||DEFAULT_FILE_MODE);if(i.tmpCreated){i.tmpCreated(u)}if(isString(r)){await fs.retry.write(o)(h,r,0,i.encoding||DEFAULT_ENCODING)}else if(!isUndefined(r)){await fs.retry.write(o)(h,r,0,r.length,0)}if(i.fsync!==false){if(i.fsyncWait!==false){await fs.retry.fsync(o)(h)}else{fs.attempt.fsync(h)}}await fs.retry.close(o)(h);h=null;if(i.chown&&(i.chown.uid!==DEFAULT_USER_UID||i.chown.gid!==DEFAULT_USER_GID)){await fs.attempt.chown(u,i.chown.uid,i.chown.gid)}if(i.mode&&i.mode!==DEFAULT_FILE_MODE){await fs.attempt.chmod(u,i.mode)}try{await fs.retry.rename(o)(u,t)}catch(r){if(!isException(r))throw r;if(r.code!=="ENAMETOOLONG")throw r;await fs.retry.rename(o)(u,Temp.truncate(t))}l();u=null}finally{if(h)await fs.attempt.close(h);if(u)Temp.purge(u);if(a)a();if(c)c()}}function writeFileSync(t,r,i=z){if(lang_isString(i))return writeFileSync(t,r,{encoding:i});const o=Date.now()+((i.timeout??K)||-1);let a=null;let c=null;let l=null;try{const u=j.attempt.realpathSync(t);const h=!!u;t=u||t;[c,a]=ue.get(t,i.tmpCreate||ue.create,!(i.tmpPurge===false));const d=Y&&lang_isUndefined(i.chown);const p=lang_isUndefined(i.mode);if(h&&(d||p)){const r=j.attempt.statSync(t);if(r){i={...i};if(d){i.chown={uid:r.uid,gid:r.gid}}if(p){i.mode=r.mode}}}if(!h){const r=S.dirname(t);j.attempt.mkdirSync(r,{mode:H,recursive:true})}l=j.retry.openSync(o)(c,"w",i.mode||B);if(i.tmpCreated){i.tmpCreated(c)}if(lang_isString(r)){j.retry.writeSync(o)(l,r,0,i.encoding||U)}else if(!lang_isUndefined(r)){j.retry.writeSync(o)(l,r,0,r.length,0)}if(i.fsync!==false){if(i.fsyncWait!==false){j.retry.fsyncSync(o)(l)}else{j.attempt.fsync(l)}}j.retry.closeSync(o)(l);l=null;if(i.chown&&(i.chown.uid!==G||i.chown.gid!==q)){j.attempt.chownSync(c,i.chown.uid,i.chown.gid)}if(i.mode&&i.mode!==B){j.attempt.chmodSync(c,i.mode)}try{j.retry.renameSync(o)(c,t)}catch(r){if(!lang_isException(r))throw r;if(r.code!=="ENAMETOOLONG")throw r;j.retry.renameSync(o)(c,ue.truncate(t))}a();c=null}finally{if(l)j.attempt.closeSync(l);if(c)ue.purge(c)}}var he=__nccwpck_require__(8018);var de=__nccwpck_require__(8735);const copyProperty=(t,r,i,o)=>{if(i==="length"||i==="prototype"){return}if(i==="arguments"||i==="caller"){return}const a=Object.getOwnPropertyDescriptor(t,i);const c=Object.getOwnPropertyDescriptor(r,i);if(!canCopyProperty(a,c)&&o){return}Object.defineProperty(t,i,c)};const canCopyProperty=function(t,r){return t===undefined||t.configurable||t.writable===r.writable&&t.enumerable===r.enumerable&&t.configurable===r.configurable&&(t.writable||t.value===r.value)};const changePrototype=(t,r)=>{const i=Object.getPrototypeOf(r);if(i===Object.getPrototypeOf(t)){return}Object.setPrototypeOf(t,i)};const wrappedToString=(t,r)=>`/* Wrapped ${t}*/\n${r}`;const fe=Object.getOwnPropertyDescriptor(Function.prototype,"toString");const pe=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");const changeToString=(t,r,i)=>{const o=i===""?"":`with ${i.trim()}() `;const a=wrappedToString.bind(null,o,r.toString());Object.defineProperty(a,"name",pe);const{writable:c,enumerable:l,configurable:u}=fe;Object.defineProperty(t,"toString",{value:a,writable:c,enumerable:l,configurable:u})};function mimicFunction(t,r,{ignoreNonConfigurable:i=false}={}){const{name:o}=t;for(const o of Reflect.ownKeys(r)){copyProperty(t,r,o,i)}changePrototype(t,r);changeToString(t,r,o);return t}const debounceFunction=(t,r={})=>{if(typeof t!=="function"){throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``)}const{wait:i=0,maxWait:o=Number.POSITIVE_INFINITY,before:a=false,after:c=true}=r;if(i<0||o<0){throw new RangeError("`wait` and `maxWait` must not be negative.")}if(!a&&!c){throw new Error("Both `before` and `after` are false, function wouldn't be called.")}let l;let u;let h;const debouncedFunction=function(...r){const d=this;const later=()=>{l=undefined;if(u){clearTimeout(u);u=undefined}if(c){h=t.apply(d,r)}};const maxLater=()=>{u=undefined;if(l){clearTimeout(l);l=undefined}if(c){h=t.apply(d,r)}};const p=a&&!l;clearTimeout(l);l=setTimeout(later,i);if(o>0&&o!==Number.POSITIVE_INFINITY&&!u){u=setTimeout(maxLater,o)}if(p){h=t.apply(d,r)}return h};mimicFunction(debouncedFunction,t);debouncedFunction.cancel=()=>{if(l){clearTimeout(l);l=undefined}if(u){clearTimeout(u);u=undefined}};return debouncedFunction};const me=debounceFunction;var ge=__nccwpck_require__(6546);const ye=Object.prototype.toString;const ve="[object Uint8Array]";function isUint8Array(t){if(!t){return false}if(t.constructor===Uint8Array){return true}return ye.call(t)===ve}function assertUint8Array(t){if(!isUint8Array(t)){throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof t}\``)}}function toUint8Array(t){if(t instanceof ArrayBuffer){return new Uint8Array(t)}if(ArrayBuffer.isView(t)){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}throw new TypeError(`Unsupported value, got \`${typeof t}\`.`)}function concatUint8Arrays(t,r){if(t.length===0){return new Uint8Array(0)}r??=t.reduce(((t,r)=>t+r.length),0);const i=new Uint8Array(r);let o=0;for(const r of t){assertUint8Array(r);i.set(r,o);o+=r.length}return i}function areUint8ArraysEqual(t,r){assertUint8Array(t);assertUint8Array(r);if(t===r){return true}if(t.length!==r.length){return false}for(let i=0;i<t.length;i++){if(t[i]!==r[i]){return false}}return true}function compareUint8Arrays(t,r){assertUint8Array(t);assertUint8Array(r);const i=Math.min(t.length,r.length);for(let o=0;o<i;o++){const i=t[o]-r[o];if(i!==0){return Math.sign(i)}}return Math.sign(t.length-r.length)}const be=new globalThis.TextDecoder;function uint8ArrayToString(t){assertUint8Array(t);return be.decode(t)}function assertString(t){if(typeof t!=="string"){throw new TypeError(`Expected \`string\`, got \`${typeof t}\``)}}const _e=new globalThis.TextEncoder;function stringToUint8Array(t){assertString(t);return _e.encode(t)}function base64ToBase64Url(t){return t.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function base64UrlToBase64(t){return t.replaceAll("-","+").replaceAll("_","/")}const we=65535;function uint8ArrayToBase64(t,{urlSafe:r=false}={}){assertUint8Array(t);let i;if(t.length<we){i=globalThis.btoa(String.fromCodePoint.apply(this,t))}else{i="";for(const r of t){i+=String.fromCodePoint(r)}i=globalThis.btoa(i)}return r?base64ToBase64Url(i):i}function base64ToUint8Array(t){assertString(t);return Uint8Array.from(globalThis.atob(base64UrlToBase64(t)),(t=>t.codePointAt(0)))}function stringToBase64(t,{urlSafe:r=false}={}){assertString(t);return uint8ArrayToBase64(stringToUint8Array(t),{urlSafe:r})}function base64ToString(t){assertString(t);return uint8ArrayToString(base64ToUint8Array(t))}const Ee=Array.from({length:256},((t,r)=>r.toString(16).padStart(2,"0")));function uint8ArrayToHex(t){assertUint8Array(t);let r="";for(let i=0;i<t.length;i++){r+=Ee[t[i]]}return r}const Se={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function hexToUint8Array(t){assertString(t);if(t.length%2!==0){throw new Error("Invalid Hex string length.")}const r=t.length/2;const i=new Uint8Array(r);for(let o=0;o<r;o++){const r=Se[t[o*2]];const a=Se[t[o*2+1]];if(r===undefined||a===undefined){throw new Error(`Invalid Hex character encountered at position ${o*2}`)}i[o]=r<<4|a}return i}const $e=de["default"];const xe="aes-256-cbc";const createPlainObject=()=>Object.create(null);const isExist=t=>t!==undefined&&t!==null;const checkValueType=(t,r)=>{const i=new Set(["undefined","symbol","function"]);const o=typeof r;if(i.has(o)){throw new TypeError(`Setting a value of type \`${o}\` for key \`${t}\` is not allowed as it's not supported by JSON`)}};const Re="__internal__";const Oe=`${Re}.migrations.version`;class Conf{path;events;#e;#t;#r;#s={};constructor(t={}){const r={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:false,accessPropertiesByDotNotation:true,configFileMode:438,...t};if(!r.cwd){if(!r.projectName){throw new Error("Please specify the `projectName` option.")}r.cwd=envPaths(r.projectName,{suffix:r.projectSuffix}).config}this.#r=r;if(r.schema){if(typeof r.schema!=="object"){throw new TypeError("The `schema` option must be an object.")}const t=new he.Ajv2020({allErrors:true,useDefaults:true});$e(t);const i={type:"object",properties:r.schema};this.#e=t.compile(i);for(const[t,i]of Object.entries(r.schema)){if(i?.default){this.#s[t]=i.default}}}if(r.defaults){this.#s={...this.#s,...r.defaults}}if(r.serialize){this._serialize=r.serialize}if(r.deserialize){this._deserialize=r.deserialize}this.events=new EventTarget;this.#t=r.encryptionKey;const i=r.fileExtension?`.${r.fileExtension}`:"";this.path=S.resolve(r.cwd,`${r.configName??"config"}${i}`);const o=this.store;const a=Object.assign(createPlainObject(),r.defaults,o);if(r.migrations){if(!r.projectVersion){throw new Error("Please specify the `projectVersion` option.")}this._migrate(r.migrations,r.projectVersion,r.beforeEachMigration)}this._validate(a);try{x.deepEqual(o,a)}catch{this.store=a}if(r.watch){this._watch()}}get(t,r){if(this.#r.accessPropertiesByDotNotation){return this._get(t,r)}const{store:i}=this;return t in i?i[t]:r}set(t,r){if(typeof t!=="string"&&typeof t!=="object"){throw new TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof t}`)}if(typeof t!=="object"&&r===undefined){throw new TypeError("Use `delete()` to clear values")}if(this._containsReservedKey(t)){throw new TypeError(`Please don't use the ${Re} key, as it's used to manage this module internal operations.`)}const{store:i}=this;const set=(t,r)=>{checkValueType(t,r);if(this.#r.accessPropertiesByDotNotation){setProperty(i,t,r)}else{i[t]=r}};if(typeof t==="object"){const r=t;for(const[t,i]of Object.entries(r)){set(t,i)}}else{set(t,r)}this.store=i}has(t){if(this.#r.accessPropertiesByDotNotation){return hasProperty(this.store,t)}return t in this.store}reset(...t){for(const r of t){if(isExist(this.#s[r])){this.set(r,this.#s[r])}}}delete(t){const{store:r}=this;if(this.#r.accessPropertiesByDotNotation){deleteProperty(r,t)}else{delete r[t]}this.store=r}clear(){this.store=createPlainObject();for(const t of Object.keys(this.#s)){this.reset(t)}}onDidChange(t,r){if(typeof t!=="string"){throw new TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof t}`)}if(typeof r!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof r}`)}return this._handleChange((()=>this.get(t)),r)}onDidAnyChange(t){if(typeof t!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`)}return this._handleChange((()=>this.store),t)}get size(){return Object.keys(this.store).length}get store(){try{const t=E.readFileSync(this.path,this.#t?null:"utf8");const r=this._encryptData(t);const i=this._deserialize(r);this._validate(i);return Object.assign(createPlainObject(),i)}catch(t){if(t?.code==="ENOENT"){this._ensureDirectory();return createPlainObject()}if(this.#r.clearInvalidConfig&&t.name==="SyntaxError"){return createPlainObject()}throw t}}set store(t){this._ensureDirectory();this._validate(t);this._write(t);this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(const[t,r]of Object.entries(this.store)){yield[t,r]}}_encryptData(t){if(!this.#t){return typeof t==="string"?t:uint8ArrayToString(t)}try{const r=t.slice(0,16);const i=$.pbkdf2Sync(this.#t,r.toString(),1e4,32,"sha512");const o=$.createDecipheriv(xe,i,r);const a=t.slice(17);const c=typeof a==="string"?stringToUint8Array(a):a;return uint8ArrayToString(concatUint8Arrays([o.update(c),o.final()]))}catch{}return t.toString()}_handleChange(t,r){let i=t();const onChange=()=>{const o=i;const a=t();if((0,b.isDeepStrictEqual)(a,o)){return}i=a;r.call(this,a,o)};this.events.addEventListener("change",onChange);return()=>{this.events.removeEventListener("change",onChange)}}_deserialize=t=>JSON.parse(t);_serialize=t=>JSON.stringify(t,undefined,"\t");_validate(t){if(!this.#e){return}const r=this.#e(t);if(r||!this.#e.errors){return}const i=this.#e.errors.map((({instancePath:t,message:r=""})=>`\`${t.slice(1)}\` ${r}`));throw new Error("Config schema violation: "+i.join("; "))}_ensureDirectory(){E.mkdirSync(S.dirname(this.path),{recursive:true})}_write(t){let r=this._serialize(t);if(this.#t){const t=$.randomBytes(16);const i=$.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512");const o=$.createCipheriv(xe,i,t);r=concatUint8Arrays([t,stringToUint8Array(":"),o.update(stringToUint8Array(r)),o.final()])}if(w.env.SNAP){E.writeFileSync(this.path,r,{mode:this.#r.configFileMode})}else{try{writeFileSync(this.path,r,{mode:this.#r.configFileMode})}catch(t){if(t?.code==="EXDEV"){E.writeFileSync(this.path,r,{mode:this.#r.configFileMode});return}throw t}}}_watch(){this._ensureDirectory();if(!E.existsSync(this.path)){this._write(createPlainObject())}if(w.platform==="win32"){E.watch(this.path,{persistent:false},me((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:100}))}else{E.watchFile(this.path,{persistent:false},me((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:5e3}))}}_migrate(t,r,i){let o=this._get(Oe,"0.0.0");const a=Object.keys(t).filter((t=>this._shouldPerformMigration(t,o,r)));let c={...this.store};for(const l of a){try{if(i){i(this,{fromVersion:o,toVersion:l,finalVersion:r,versions:a})}const u=t[l];u?.(this);this._set(Oe,l);o=l;c={...this.store}}catch(t){this.store=c;throw new Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${t}`)}}if(this._isVersionInRangeFormat(o)||!ge.eq(o,r)){this._set(Oe,r)}}_containsReservedKey(t){if(typeof t==="object"){const r=Object.keys(t)[0];if(r===Re){return true}}if(typeof t!=="string"){return false}if(this.#r.accessPropertiesByDotNotation){if(t.startsWith(`${Re}.`)){return true}return false}return false}_isVersionInRangeFormat(t){return ge.clean(t)===null}_shouldPerformMigration(t,r,i){if(this._isVersionInRangeFormat(t)){if(r!=="0.0.0"&&ge.satisfies(r,t)){return false}return ge.satisfies(i,t)}if(ge.lte(t,r)){return false}if(ge.gt(t,i)){return false}return true}_get(t,r){return getProperty(this.store,t,r)}_set(t,r){const{store:i}=this;setProperty(i,t,r);this.store=i}}var Pe=__nccwpck_require__(6399);var Ae=__nccwpck_require__(5918);var Te=__nccwpck_require__.n(Ae);var Ce=__nccwpck_require__(9886);var ke=__nccwpck_require__.n(Ce);var Ie=__nccwpck_require__(8311);var Ne=__nccwpck_require__.n(Ie);const De=require("node:stream");const Le=require("node:stream/promises");var Me=__nccwpck_require__(2361);var je=__nccwpck_require__(7147);var Fe=__nccwpck_require__(5673);const Ue=require("node:string_decoder");const Be=typeof process==="object"&&process?process:{stdout:null,stderr:null};const isStream=t=>!!t&&typeof t==="object"&&(t instanceof Minipass||t instanceof De||isReadable(t)||isWritable(t));const isReadable=t=>!!t&&typeof t==="object"&&t instanceof Fe.EventEmitter&&typeof t.pipe==="function"&&t.pipe!==De.Writable.prototype.pipe;const isWritable=t=>!!t&&typeof t==="object"&&t instanceof Fe.EventEmitter&&typeof t.write==="function"&&typeof t.end==="function";const He=Symbol("EOF");const Ve=Symbol("maybeEmitEnd");const ze=Symbol("emittedEnd");const Ge=Symbol("emittingEnd");const qe=Symbol("emittedError");const We=Symbol("closed");const Ke=Symbol("read");const Ye=Symbol("flush");const Ze=Symbol("flushChunk");const Xe=Symbol("encoding");const Je=Symbol("decoder");const Qe=Symbol("flowing");const et=Symbol("paused");const tt=Symbol("resume");const rt=Symbol("buffer");const st=Symbol("pipes");const it=Symbol("bufferLength");const nt=Symbol("bufferPush");const ot=Symbol("bufferShift");const at=Symbol("objectMode");const ct=Symbol("destroyed");const ut=Symbol("error");const ht=Symbol("emitData");const dt=Symbol("emitEnd");const ft=Symbol("emitEnd2");const pt=Symbol("async");const mt=Symbol("abort");const yt=Symbol("aborted");const vt=Symbol("signal");const bt=Symbol("dataListeners");const _t=Symbol("discarded");const defer=t=>Promise.resolve().then(t);const nodefer=t=>t();const isEndish=t=>t==="end"||t==="finish"||t==="prefinish";const isArrayBufferLike=t=>t instanceof ArrayBuffer||!!t&&typeof t==="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0;const isArrayBufferView=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t);class Pipe{src;dest;opts;ondrain;constructor(t,r,i){this.src=t;this.dest=r;this.opts=i;this.ondrain=()=>t[tt]();this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe();if(this.opts.end)this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener("error",this.proxyErrors);super.unpipe()}constructor(t,r,i){super(t,r,i);this.proxyErrors=t=>r.emit("error",t);t.on("error",this.proxyErrors)}}const isObjectModeOptions=t=>!!t.objectMode;const isEncodingOptions=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer";class Minipass extends Fe.EventEmitter{[Qe]=false;[et]=false;[st]=[];[rt]=[];[at];[Xe];[pt];[Je];[He]=false;[ze]=false;[Ge]=false;[We]=false;[qe]=null;[it]=0;[ct]=false;[vt];[yt]=false;[bt]=0;[_t]=false;writable=true;readable=true;constructor(...t){const r=t[0]||{};super();if(r.objectMode&&typeof r.encoding==="string"){throw new TypeError("Encoding and objectMode may not be used together")}if(isObjectModeOptions(r)){this[at]=true;this[Xe]=null}else if(isEncodingOptions(r)){this[Xe]=r.encoding;this[at]=false}else{this[at]=false;this[Xe]=null}this[pt]=!!r.async;this[Je]=this[Xe]?new Ue.StringDecoder(this[Xe]):null;if(r&&r.debugExposeBuffer===true){Object.defineProperty(this,"buffer",{get:()=>this[rt]})}if(r&&r.debugExposePipes===true){Object.defineProperty(this,"pipes",{get:()=>this[st]})}const{signal:i}=r;if(i){this[vt]=i;if(i.aborted){this[mt]()}else{i.addEventListener("abort",(()=>this[mt]()))}}}get bufferLength(){return this[it]}get encoding(){return this[Xe]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[at]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[pt]}set["async"](t){this[pt]=this[pt]||!!t}[mt](){this[yt]=true;this.emit("abort",this[vt]?.reason);this.destroy(this[vt]?.reason)}get aborted(){return this[yt]}set aborted(t){}write(t,r,i){if(this[yt])return false;if(this[He])throw new Error("write after end");if(this[ct]){this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"}));return true}if(typeof r==="function"){i=r;r="utf8"}if(!r)r="utf8";const o=this[pt]?defer:nodefer;if(!this[at]&&!Buffer.isBuffer(t)){if(isArrayBufferView(t)){t=Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(isArrayBufferLike(t)){t=Buffer.from(t)}else if(typeof t!=="string"){throw new Error("Non-contiguous data written to non-objectMode stream")}}if(this[at]){if(this[Qe]&&this[it]!==0)this[Ye](true);if(this[Qe])this.emit("data",t);else this[nt](t);if(this[it]!==0)this.emit("readable");if(i)o(i);return this[Qe]}if(!t.length){if(this[it]!==0)this.emit("readable");if(i)o(i);return this[Qe]}if(typeof t==="string"&&!(r===this[Xe]&&!this[Je]?.lastNeed)){t=Buffer.from(t,r)}if(Buffer.isBuffer(t)&&this[Xe]){t=this[Je].write(t)}if(this[Qe]&&this[it]!==0)this[Ye](true);if(this[Qe])this.emit("data",t);else this[nt](t);if(this[it]!==0)this.emit("readable");if(i)o(i);return this[Qe]}read(t){if(this[ct])return null;this[_t]=false;if(this[it]===0||t===0||t&&t>this[it]){this[Ve]();return null}if(this[at])t=null;if(this[rt].length>1&&!this[at]){this[rt]=[this[Xe]?this[rt].join(""):Buffer.concat(this[rt],this[it])]}const r=this[Ke](t||null,this[rt][0]);this[Ve]();return r}[Ke](t,r){if(this[at])this[ot]();else{const i=r;if(t===i.length||t===null)this[ot]();else if(typeof i==="string"){this[rt][0]=i.slice(t);r=i.slice(0,t);this[it]-=t}else{this[rt][0]=i.subarray(t);r=i.subarray(0,t);this[it]-=t}}this.emit("data",r);if(!this[rt].length&&!this[He])this.emit("drain");return r}end(t,r,i){if(typeof t==="function"){i=t;t=undefined}if(typeof r==="function"){i=r;r="utf8"}if(t!==undefined)this.write(t,r);if(i)this.once("end",i);this[He]=true;this.writable=false;if(this[Qe]||!this[et])this[Ve]();return this}[tt](){if(this[ct])return;if(!this[bt]&&!this[st].length){this[_t]=true}this[et]=false;this[Qe]=true;this.emit("resume");if(this[rt].length)this[Ye]();else if(this[He])this[Ve]();else this.emit("drain")}resume(){return this[tt]()}pause(){this[Qe]=false;this[et]=true;this[_t]=false}get destroyed(){return this[ct]}get flowing(){return this[Qe]}get paused(){return this[et]}[nt](t){if(this[at])this[it]+=1;else this[it]+=t.length;this[rt].push(t)}[ot](){if(this[at])this[it]-=1;else this[it]-=this[rt][0].length;return this[rt].shift()}[Ye](t=false){do{}while(this[Ze](this[ot]())&&this[rt].length);if(!t&&!this[rt].length&&!this[He])this.emit("drain")}[Ze](t){this.emit("data",t);return this[Qe]}pipe(t,r){if(this[ct])return t;this[_t]=false;const i=this[ze];r=r||{};if(t===Be.stdout||t===Be.stderr)r.end=false;else r.end=r.end!==false;r.proxyErrors=!!r.proxyErrors;if(i){if(r.end)t.end()}else{this[st].push(!r.proxyErrors?new Pipe(this,t,r):new PipeProxyErrors(this,t,r));if(this[pt])defer((()=>this[tt]()));else this[tt]()}return t}unpipe(t){const r=this[st].find((r=>r.dest===t));if(r){if(this[st].length===1){if(this[Qe]&&this[bt]===0){this[Qe]=false}this[st]=[]}else this[st].splice(this[st].indexOf(r),1);r.unpipe()}}addListener(t,r){return this.on(t,r)}on(t,r){const i=super.on(t,r);if(t==="data"){this[_t]=false;this[bt]++;if(!this[st].length&&!this[Qe]){this[tt]()}}else if(t==="readable"&&this[it]!==0){super.emit("readable")}else if(isEndish(t)&&this[ze]){super.emit(t);this.removeAllListeners(t)}else if(t==="error"&&this[qe]){const t=r;if(this[pt])defer((()=>t.call(this,this[qe])));else t.call(this,this[qe])}return i}removeListener(t,r){return this.off(t,r)}off(t,r){const i=super.off(t,r);if(t==="data"){this[bt]=this.listeners("data").length;if(this[bt]===0&&!this[_t]&&!this[st].length){this[Qe]=false}}return i}removeAllListeners(t){const r=super.removeAllListeners(t);if(t==="data"||t===undefined){this[bt]=0;if(!this[_t]&&!this[st].length){this[Qe]=false}}return r}get emittedEnd(){return this[ze]}[Ve](){if(!this[Ge]&&!this[ze]&&!this[ct]&&this[rt].length===0&&this[He]){this[Ge]=true;this.emit("end");this.emit("prefinish");this.emit("finish");if(this[We])this.emit("close");this[Ge]=false}}emit(t,...r){const i=r[0];if(t!=="error"&&t!=="close"&&t!==ct&&this[ct]){return false}else if(t==="data"){return!this[at]&&!i?false:this[pt]?(defer((()=>this[ht](i))),true):this[ht](i)}else if(t==="end"){return this[dt]()}else if(t==="close"){this[We]=true;if(!this[ze]&&!this[ct])return false;const t=super.emit("close");this.removeAllListeners("close");return t}else if(t==="error"){this[qe]=i;super.emit(ut,i);const t=!this[vt]||this.listeners("error").length?super.emit("error",i):false;this[Ve]();return t}else if(t==="resume"){const t=super.emit("resume");this[Ve]();return t}else if(t==="finish"||t==="prefinish"){const r=super.emit(t);this.removeAllListeners(t);return r}const o=super.emit(t,...r);this[Ve]();return o}[ht](t){for(const r of this[st]){if(r.dest.write(t)===false)this.pause()}const r=this[_t]?false:super.emit("data",t);this[Ve]();return r}[dt](){if(this[ze])return false;this[ze]=true;this.readable=false;return this[pt]?(defer((()=>this[ft]())),true):this[ft]()}[ft](){if(this[Je]){const t=this[Je].end();if(t){for(const r of this[st]){r.dest.write(t)}if(!this[_t])super.emit("data",t)}}for(const t of this[st]){t.end()}const t=super.emit("end");this.removeAllListeners("end");return t}async collect(){const t=Object.assign([],{dataLength:0});if(!this[at])t.dataLength=0;const r=this.promise();this.on("data",(r=>{t.push(r);if(!this[at])t.dataLength+=r.length}));await r;return t}async concat(){if(this[at]){throw new Error("cannot concat in objectMode")}const t=await this.collect();return this[Xe]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,r)=>{this.on(ct,(()=>r(new Error("stream destroyed"))));this.on("error",(t=>r(t)));this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[_t]=false;let t=false;const stop=async()=>{this.pause();t=true;return{value:undefined,done:true}};const next=()=>{if(t)return stop();const r=this.read();if(r!==null)return Promise.resolve({done:false,value:r});if(this[He])return stop();let i;let o;const onerr=t=>{this.off("data",ondata);this.off("end",onend);this.off(ct,ondestroy);stop();o(t)};const ondata=t=>{this.off("error",onerr);this.off("end",onend);this.off(ct,ondestroy);this.pause();i({value:t,done:!!this[He]})};const onend=()=>{this.off("error",onerr);this.off("data",ondata);this.off(ct,ondestroy);stop();i({done:true,value:undefined})};const ondestroy=()=>onerr(new Error("stream destroyed"));return new Promise(((t,r)=>{o=r;i=t;this.once(ct,ondestroy);this.once("error",onerr);this.once("end",onend);this.once("data",ondata)}))};return{next:next,throw:stop,return:stop,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[_t]=false;let t=false;const stop=()=>{this.pause();this.off(ut,stop);this.off(ct,stop);this.off("end",stop);t=true;return{done:true,value:undefined}};const next=()=>{if(t)return stop();const r=this.read();return r===null?stop():{done:false,value:r}};this.once("end",stop);this.once(ut,stop);this.once(ct,stop);return{next:next,throw:stop,return:stop,[Symbol.iterator](){return this}}}destroy(t){if(this[ct]){if(t)this.emit("error",t);else this.emit(ct);return this}this[ct]=true;this[_t]=true;this[rt].length=0;this[it]=0;const r=this;if(typeof r.close==="function"&&!this[We])r.close();if(t)this.emit("error",t);else this.emit(ct);return this}static get isStream(){return isStream}}const wt=je.writev;const Et=Symbol("_autoClose");const St=Symbol("_close");const $t=Symbol("_ended");const xt=Symbol("_fd");const Rt=Symbol("_finished");const Ot=Symbol("_flags");const Pt=Symbol("_flush");const At=Symbol("_handleChunk");const Tt=Symbol("_makeBuf");const Ct=Symbol("_mode");const kt=Symbol("_needDrain");const It=Symbol("_onerror");const Nt=Symbol("_onopen");const Dt=Symbol("_onread");const Lt=Symbol("_onwrite");const Mt=Symbol("_open");const jt=Symbol("_path");const Ft=Symbol("_pos");const Ut=Symbol("_queue");const Bt=Symbol("_read");const Ht=Symbol("_readSize");const Vt=Symbol("_reading");const zt=Symbol("_remain");const Gt=Symbol("_size");const qt=Symbol("_write");const Wt=Symbol("_writing");const Kt=Symbol("_defaultFlag");const Yt=Symbol("_errored");class ReadStream extends Minipass{[Yt]=false;[xt];[jt];[Ht];[Vt]=false;[Gt];[zt];[Et];constructor(t,r){r=r||{};super(r);this.readable=true;this.writable=false;if(typeof t!=="string"){throw new TypeError("path must be a string")}this[Yt]=false;this[xt]=typeof r.fd==="number"?r.fd:undefined;this[jt]=t;this[Ht]=r.readSize||16*1024*1024;this[Vt]=false;this[Gt]=typeof r.size==="number"?r.size:Infinity;this[zt]=this[Gt];this[Et]=typeof r.autoClose==="boolean"?r.autoClose:true;if(typeof this[xt]==="number"){this[Bt]()}else{this[Mt]()}}get fd(){return this[xt]}get path(){return this[jt]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Mt](){je.open(this[jt],"r",((t,r)=>this[Nt](t,r)))}[Nt](t,r){if(t){this[It](t)}else{this[xt]=r;this.emit("open",r);this[Bt]()}}[Tt](){return Buffer.allocUnsafe(Math.min(this[Ht],this[zt]))}[Bt](){if(!this[Vt]){this[Vt]=true;const t=this[Tt]();if(t.length===0){return process.nextTick((()=>this[Dt](null,0,t)))}je.read(this[xt],t,0,t.length,null,((t,r,i)=>this[Dt](t,r,i)))}}[Dt](t,r,i){this[Vt]=false;if(t){this[It](t)}else if(this[At](r,i)){this[Bt]()}}[St](){if(this[Et]&&typeof this[xt]==="number"){const t=this[xt];this[xt]=undefined;je.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}[It](t){this[Vt]=true;this[St]();this.emit("error",t)}[At](t,r){let i=false;this[zt]-=t;if(t>0){i=super.write(t<r.length?r.subarray(0,t):r)}if(t===0||this[zt]<=0){i=false;this[St]();super.end()}return i}emit(t,...r){switch(t){case"prefinish":case"finish":return false;case"drain":if(typeof this[xt]==="number"){this[Bt]()}return false;case"error":if(this[Yt]){return false}this[Yt]=true;return super.emit(t,...r);default:return super.emit(t,...r)}}}class ReadStreamSync extends ReadStream{[Mt](){let t=true;try{this[Nt](null,je.openSync(this[jt],"r"));t=false}finally{if(t){this[St]()}}}[Bt](){let t=true;try{if(!this[Vt]){this[Vt]=true;do{const t=this[Tt]();const r=t.length===0?0:je.readSync(this[xt],t,0,t.length,null);if(!this[At](r,t)){break}}while(true);this[Vt]=false}t=false}finally{if(t){this[St]()}}}[St](){if(this[Et]&&typeof this[xt]==="number"){const t=this[xt];this[xt]=undefined;je.closeSync(t);this.emit("close")}}}class WriteStream extends Me{readable=false;writable=true;[Yt]=false;[Wt]=false;[$t]=false;[Ut]=[];[kt]=false;[jt];[Ct];[Et];[xt];[Kt];[Ot];[Rt]=false;[Ft];constructor(t,r){r=r||{};super(r);this[jt]=t;this[xt]=typeof r.fd==="number"?r.fd:undefined;this[Ct]=r.mode===undefined?438:r.mode;this[Ft]=typeof r.start==="number"?r.start:undefined;this[Et]=typeof r.autoClose==="boolean"?r.autoClose:true;const i=this[Ft]!==undefined?"r+":"w";this[Kt]=r.flags===undefined;this[Ot]=r.flags===undefined?i:r.flags;if(this[xt]===undefined){this[Mt]()}}emit(t,...r){if(t==="error"){if(this[Yt]){return false}this[Yt]=true}return super.emit(t,...r)}get fd(){return this[xt]}get path(){return this[jt]}[It](t){this[St]();this[Wt]=true;this.emit("error",t)}[Mt](){je.open(this[jt],this[Ot],this[Ct],((t,r)=>this[Nt](t,r)))}[Nt](t,r){if(this[Kt]&&this[Ot]==="r+"&&t&&t.code==="ENOENT"){this[Ot]="w";this[Mt]()}else if(t){this[It](t)}else{this[xt]=r;this.emit("open",r);if(!this[Wt]){this[Pt]()}}}end(t,r){if(t){this.write(t,r)}this[$t]=true;if(!this[Wt]&&!this[Ut].length&&typeof this[xt]==="number"){this[Lt](null,0)}return this}write(t,r){if(typeof t==="string"){t=Buffer.from(t,r)}if(this[$t]){this.emit("error",new Error("write() after end()"));return false}if(this[xt]===undefined||this[Wt]||this[Ut].length){this[Ut].push(t);this[kt]=true;return false}this[Wt]=true;this[qt](t);return true}[qt](t){je.write(this[xt],t,0,t.length,this[Ft],((t,r)=>this[Lt](t,r)))}[Lt](t,r){if(t){this[It](t)}else{if(this[Ft]!==undefined&&typeof r==="number"){this[Ft]+=r}if(this[Ut].length){this[Pt]()}else{this[Wt]=false;if(this[$t]&&!this[Rt]){this[Rt]=true;this[St]();this.emit("finish")}else if(this[kt]){this[kt]=false;this.emit("drain")}}}}[Pt](){if(this[Ut].length===0){if(this[$t]){this[Lt](null,0)}}else if(this[Ut].length===1){this[qt](this[Ut].pop())}else{const t=this[Ut];this[Ut]=[];wt(this[xt],t,this[Ft],((t,r)=>this[Lt](t,r)))}}[St](){if(this[Et]&&typeof this[xt]==="number"){const t=this[xt];this[xt]=undefined;je.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}}class WriteStreamSync extends WriteStream{[Mt](){let t;if(this[Kt]&&this[Ot]==="r+"){try{t=je.openSync(this[jt],this[Ot],this[Ct])}catch(t){if(t?.code==="ENOENT"){this[Ot]="w";return this[Mt]()}else{throw t}}}else{t=je.openSync(this[jt],this[Ot],this[Ct])}this[Nt](null,t)}[St](){if(this[Et]&&typeof this[xt]==="number"){const t=this[xt];this[xt]=undefined;je.closeSync(t);this.emit("close")}}[qt](t){let r=true;try{this[Lt](null,je.writeSync(this[xt],t,0,t.length,this[Ft]));r=false}finally{if(r){try{this[St]()}catch{}}}}}var Zt=__nccwpck_require__(1017);var Xt=__nccwpck_require__.n(Zt);const Jt=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"]]);const isSyncFile=t=>!!t.sync&&!!t.file;const isAsyncFile=t=>!t.sync&&!!t.file;const isSyncNoFile=t=>!!t.sync&&!t.file;const isAsyncNoFile=t=>!t.sync&&!t.file;const isSync=t=>!!t.sync;const isAsync=t=>!t.sync;const isFile=t=>!!t.file;const isNoFile=t=>!t.file;const dealiasKey=t=>{const r=Jt.get(t);if(r)return r;return t};const dealias=(t={})=>{if(!t)return{};const r={};for(const[i,o]of Object.entries(t)){const t=dealiasKey(i);r[t]=o}if(r.chmod===undefined&&r.noChmod===false){r.chmod=true}delete r.noChmod;return r};const makeCommand=(t,r,i,o,a)=>Object.assign(((c=[],l,u)=>{if(Array.isArray(c)){l=c;c={}}if(typeof l==="function"){u=l;l=undefined}if(!l){l=[]}else{l=Array.from(l)}const h=dealias(c);a?.(h,l);if(isSyncFile(h)){if(typeof u==="function"){throw new TypeError("callback not supported for sync tar functions")}return t(h,l)}else if(isAsyncFile(h)){const t=r(h,l);const i=u?u:undefined;return i?t.then((()=>i()),i):t}else if(isSyncNoFile(h)){if(typeof u==="function"){throw new TypeError("callback not supported for sync tar functions")}return i(h,l)}else if(isAsyncNoFile(h)){if(typeof u==="function"){throw new TypeError("callback only supported with file option")}return o(h,l)}else{throw new Error("impossible options??")}}),{syncFile:t,asyncFile:r,syncNoFile:i,asyncNoFile:o,validate:a});const Qt=require("assert");var er=__nccwpck_require__(4300);const tr=require("zlib");const rr=tr.constants||{ZLIB_VERNUM:4736};const sr=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:Infinity,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},rr));const ir=er.Buffer.concat;const nr=Symbol("_superWrite");class ZlibError extends Error{code;errno;constructor(t){super("zlib: "+t.message);this.code=t.code;this.errno=t.errno;if(!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+t.message;Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}const ar=Symbol("flushFlag");class ZlibBase extends Minipass{#i=false;#n=false;#o;#a;#c;#l;#u;get sawError(){return this.#i}get handle(){return this.#l}get flushFlag(){return this.#o}constructor(t,r){if(!t||typeof t!=="object")throw new TypeError("invalid options for ZlibBase constructor");super(t);this.#o=t.flush??0;this.#a=t.finishFlush??0;this.#c=t.fullFlushFlag??0;try{this.#l=new tr[r](t)}catch(t){throw new ZlibError(t)}this.#u=t=>{if(this.#i)return;this.#i=true;this.close();this.emit("error",t)};this.#l?.on("error",(t=>this.#u(new ZlibError(t))));this.once("end",(()=>this.close))}close(){if(this.#l){this.#l.close();this.#l=undefined;this.emit("close")}}reset(){if(!this.#i){Qt(this.#l,"zlib binding closed");return this.#l.reset?.()}}flush(t){if(this.ended)return;if(typeof t!=="number")t=this.#c;this.write(Object.assign(er.Buffer.alloc(0),{[ar]:t}))}end(t,r,i){if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(t){if(r)this.write(t,r);else this.write(t)}this.flush(this.#a);this.#n=true;return super.end(i)}get ended(){return this.#n}[nr](t){return super.write(t)}write(t,r,i){if(typeof r==="function")i=r,r="utf8";if(typeof t==="string")t=er.Buffer.from(t,r);if(this.#i)return;Qt(this.#l,"zlib binding closed");const o=this.#l._handle;const a=o.close;o.close=()=>{};const c=this.#l.close;this.#l.close=()=>{};er.Buffer.concat=t=>t;let l=undefined;try{const r=typeof t[ar]==="number"?t[ar]:this.#o;l=this.#l._processChunk(t,r);er.Buffer.concat=ir}catch(t){er.Buffer.concat=ir;this.#u(new ZlibError(t))}finally{if(this.#l){this.#l._handle=o;o.close=a;this.#l.close=c;this.#l.removeAllListeners("error")}}if(this.#l)this.#l.on("error",(t=>this.#u(new ZlibError(t))));let u;if(l){if(Array.isArray(l)&&l.length>0){const t=l[0];u=this[nr](er.Buffer.from(t));for(let t=1;t<l.length;t++){u=this[nr](l[t])}}else{u=this[nr](er.Buffer.from(l))}}if(i)i();return u}}class Zlib extends ZlibBase{#h;#d;constructor(t,r){t=t||{};t.flush=t.flush||sr.Z_NO_FLUSH;t.finishFlush=t.finishFlush||sr.Z_FINISH;t.fullFlushFlag=sr.Z_FULL_FLUSH;super(t,r);this.#h=t.level;this.#d=t.strategy}params(t,r){if(this.sawError)return;if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#h!==t||this.#d!==r){this.flush(sr.Z_SYNC_FLUSH);Qt(this.handle,"zlib binding closed");const i=this.handle.flush;this.handle.flush=(t,r)=>{if(typeof t==="function"){r=t;t=this.flushFlag}this.flush(t);r?.()};try{this.handle.params(t,r)}finally{this.handle.flush=i}if(this.handle){this.#h=t;this.#d=r}}}}class Deflate extends(null&&Zlib){constructor(t){super(t,"Deflate")}}class Inflate extends(null&&Zlib){constructor(t){super(t,"Inflate")}}class Gzip extends Zlib{#f;constructor(t){super(t,"Gzip");this.#f=t&&!!t.portable}[nr](t){if(!this.#f)return super[nr](t);this.#f=false;t[9]=255;return super[nr](t)}}class Gunzip extends(null&&Zlib){constructor(t){super(t,"Gunzip")}}class DeflateRaw extends(null&&Zlib){constructor(t){super(t,"DeflateRaw")}}class InflateRaw extends(null&&Zlib){constructor(t){super(t,"InflateRaw")}}class Unzip extends Zlib{constructor(t){super(t,"Unzip")}}class Brotli extends ZlibBase{constructor(t,r){t=t||{};t.flush=t.flush||sr.BROTLI_OPERATION_PROCESS;t.finishFlush=t.finishFlush||sr.BROTLI_OPERATION_FINISH;t.fullFlushFlag=sr.BROTLI_OPERATION_FLUSH;super(t,r)}}class BrotliCompress extends Brotli{constructor(t){super(t,"BrotliCompress")}}class BrotliDecompress extends Brotli{constructor(t){super(t,"BrotliDecompress")}}class Yallist{tail;head;length=0;static create(t=[]){return new Yallist(t)}constructor(t=[]){for(const r of t){this.push(r)}}*[Symbol.iterator](){for(let t=this.head;t;t=t.next){yield t.value}}removeNode(t){if(t.list!==this){throw new Error("removing node which does not belong to this list")}const r=t.next;const i=t.prev;if(r){r.prev=i}if(i){i.next=r}if(t===this.head){this.head=r}if(t===this.tail){this.tail=i}this.length--;t.next=undefined;t.prev=undefined;t.list=undefined;return r}unshiftNode(t){if(t===this.head){return}if(t.list){t.list.removeNode(t)}const r=this.head;t.list=this;t.next=r;if(r){r.prev=t}this.head=t;if(!this.tail){this.tail=t}this.length++}pushNode(t){if(t===this.tail){return}if(t.list){t.list.removeNode(t)}const r=this.tail;t.list=this;t.prev=r;if(r){r.next=t}this.tail=t;if(!this.head){this.head=t}this.length++}push(...t){for(let r=0,i=t.length;r<i;r++){push(this,t[r])}return this.length}unshift(...t){for(var r=0,i=t.length;r<i;r++){unshift(this,t[r])}return this.length}pop(){if(!this.tail){return undefined}const t=this.tail.value;const r=this.tail;this.tail=this.tail.prev;if(this.tail){this.tail.next=undefined}else{this.head=undefined}r.list=undefined;this.length--;return t}shift(){if(!this.head){return undefined}const t=this.head.value;const r=this.head;this.head=this.head.next;if(this.head){this.head.prev=undefined}else{this.tail=undefined}r.list=undefined;this.length--;return t}forEach(t,r){r=r||this;for(let i=this.head,o=0;!!i;o++){t.call(r,i.value,o,this);i=i.next}}forEachReverse(t,r){r=r||this;for(let i=this.tail,o=this.length-1;!!i;o--){t.call(r,i.value,o,this);i=i.prev}}get(t){let r=0;let i=this.head;for(;!!i&&r<t;r++){i=i.next}if(r===t&&!!i){return i.value}}getReverse(t){let r=0;let i=this.tail;for(;!!i&&r<t;r++){i=i.prev}if(r===t&&!!i){return i.value}}map(t,r){r=r||this;const i=new Yallist;for(let o=this.head;!!o;){i.push(t.call(r,o.value,this));o=o.next}return i}mapReverse(t,r){r=r||this;var i=new Yallist;for(let o=this.tail;!!o;){i.push(t.call(r,o.value,this));o=o.prev}return i}reduce(t,r){let i;let o=this.head;if(arguments.length>1){i=r}else if(this.head){o=this.head.next;i=this.head.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(var a=0;!!o;a++){i=t(i,o.value,a);o=o.next}return i}reduceReverse(t,r){let i;let o=this.tail;if(arguments.length>1){i=r}else if(this.tail){o=this.tail.prev;i=this.tail.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(let r=this.length-1;!!o;r--){i=t(i,o.value,r);o=o.prev}return i}toArray(){const t=new Array(this.length);for(let r=0,i=this.head;!!i;r++){t[r]=i.value;i=i.next}return t}toArrayReverse(){const t=new Array(this.length);for(let r=0,i=this.tail;!!i;r++){t[r]=i.value;i=i.prev}return t}slice(t=0,r=this.length){if(r<0){r+=this.length}if(t<0){t+=this.length}const i=new Yallist;if(r<t||r<0){return i}if(t<0){t=0}if(r>this.length){r=this.length}let o=this.head;let a=0;for(a=0;!!o&&a<t;a++){o=o.next}for(;!!o&&a<r;a++,o=o.next){i.push(o.value)}return i}sliceReverse(t=0,r=this.length){if(r<0){r+=this.length}if(t<0){t+=this.length}const i=new Yallist;if(r<t||r<0){return i}if(t<0){t=0}if(r>this.length){r=this.length}let o=this.length;let a=this.tail;for(;!!a&&o>r;o--){a=a.prev}for(;!!a&&o>t;o--,a=a.prev){i.push(a.value)}return i}splice(t,r=0,...i){if(t>this.length){t=this.length-1}if(t<0){t=this.length+t}let o=this.head;for(let r=0;!!o&&r<t;r++){o=o.next}const a=[];for(let t=0;!!o&&t<r;t++){a.push(o.value);o=this.removeNode(o)}if(!o){o=this.tail}else if(o!==this.tail){o=o.prev}for(const t of i){o=insertAfter(this,o,t)}return a}reverse(){const t=this.head;const r=this.tail;for(let r=t;!!r;r=r.prev){const t=r.prev;r.prev=r.next;r.next=t}this.head=r;this.tail=t;return this}}function insertAfter(t,r,i){const o=r;const a=r?r.next:t.head;const c=new Node(i,o,a,t);if(c.next===undefined){t.tail=c}if(c.prev===undefined){t.head=c}t.length++;return c}function push(t,r){t.tail=new Node(r,t.tail,undefined,t);if(!t.head){t.head=t.tail}t.length++}function unshift(t,r){t.head=new Node(r,undefined,t.head,t);if(!t.tail){t.tail=t.head}t.length++}class Node{list;next;prev;value;constructor(t,r,i,o){this.list=o;this.value=t;if(r){r.next=this;this.prev=r}else{this.prev=undefined}if(i){i.prev=this;this.next=i}else{this.next=undefined}}}const encode=(t,r)=>{if(!Number.isSafeInteger(t)){throw Error("cannot encode number outside of javascript safe integer range")}else if(t<0){encodeNegative(t,r)}else{encodePositive(t,r)}return r};const encodePositive=(t,r)=>{r[0]=128;for(var i=r.length;i>1;i--){r[i-1]=t&255;t=Math.floor(t/256)}};const encodeNegative=(t,r)=>{r[0]=255;var i=false;t=t*-1;for(var o=r.length;o>1;o--){var a=t&255;t=Math.floor(t/256);if(i){r[o-1]=onesComp(a)}else if(a===0){r[o-1]=0}else{i=true;r[o-1]=twosComp(a)}}};const parse=t=>{const r=t[0];const i=r===128?pos(t.subarray(1,t.length)):r===255?twos(t):null;if(i===null){throw Error("invalid base256 encoding")}if(!Number.isSafeInteger(i)){throw Error("parsed number outside of javascript safe integer range")}return i};const twos=t=>{var r=t.length;var i=0;var o=false;for(var a=r-1;a>-1;a--){var c=Number(t[a]);var l;if(o){l=onesComp(c)}else if(c===0){l=c}else{o=true;l=twosComp(c)}if(l!==0){i-=l*Math.pow(256,r-a-1)}}return i};const pos=t=>{var r=t.length;var i=0;for(var o=r-1;o>-1;o--){var a=Number(t[o]);if(a!==0){i+=a*Math.pow(256,r-o-1)}}return i};const onesComp=t=>(255^t)&255;const twosComp=t=>(255^t)+1&255;const isCode=t=>cr.has(t);const isName=t=>lr.has(t);const cr=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"]]);const lr=new Map(Array.from(cr).map((t=>[t[1],t[0]])));class Header{cksumValid=false;needPax=false;nullBlock=false;block;path;mode;uid;gid;size;cksum;#p="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,r=0,i,o){if(Buffer.isBuffer(t)){this.decode(t,r||0,i,o)}else if(t){this.#m(t)}}decode(t,r,i,o){if(!r){r=0}if(!t||!(t.length>=r+512)){throw new Error("need 512 bytes for header")}this.path=decString(t,r,100);this.mode=decNumber(t,r+100,8);this.uid=decNumber(t,r+108,8);this.gid=decNumber(t,r+116,8);this.size=decNumber(t,r+124,12);this.mtime=decDate(t,r+136,12);this.cksum=decNumber(t,r+148,12);if(o)this.#m(o,true);if(i)this.#m(i);const a=decString(t,r+156,1);if(isCode(a)){this.#p=a||"0"}if(this.#p==="0"&&this.path.slice(-1)==="/"){this.#p="5"}if(this.#p==="5"){this.size=0}this.linkpath=decString(t,r+157,100);if(t.subarray(r+257,r+265).toString()==="ustar\x0000"){this.uname=decString(t,r+265,32);this.gname=decString(t,r+297,32);this.devmaj=decNumber(t,r+329,8)??0;this.devmin=decNumber(t,r+337,8)??0;if(t[r+475]!==0){const i=decString(t,r+345,155);this.path=i+"/"+this.path}else{const i=decString(t,r+345,130);if(i){this.path=i+"/"+this.path}this.atime=decDate(t,r+476,12);this.ctime=decDate(t,r+488,12)}}let c=8*32;for(let i=r;i<r+148;i++){c+=t[i]}for(let i=r+156;i<r+512;i++){c+=t[i]}this.cksumValid=c===this.cksum;if(this.cksum===undefined&&c===8*32){this.nullBlock=true}}#m(t,r=false){Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(i===null||i===undefined||t==="path"&&r||t==="linkpath"&&r||t==="global")))))}encode(t,r=0){if(!t){t=this.block=Buffer.alloc(512)}if(this.#p==="Unsupported"){this.#p="0"}if(!(t.length>=r+512)){throw new Error("need 512 bytes for header")}const i=this.ctime||this.atime?130:155;const o=splitPrefix(this.path||"",i);const a=o[0];const c=o[1];this.needPax=!!o[2];this.needPax=encString(t,r,100,a)||this.needPax;this.needPax=encNumber(t,r+100,8,this.mode)||this.needPax;this.needPax=encNumber(t,r+108,8,this.uid)||this.needPax;this.needPax=encNumber(t,r+116,8,this.gid)||this.needPax;this.needPax=encNumber(t,r+124,12,this.size)||this.needPax;this.needPax=encDate(t,r+136,12,this.mtime)||this.needPax;t[r+156]=this.#p.charCodeAt(0);this.needPax=encString(t,r+157,100,this.linkpath)||this.needPax;t.write("ustar\x0000",r+257,8);this.needPax=encString(t,r+265,32,this.uname)||this.needPax;this.needPax=encString(t,r+297,32,this.gname)||this.needPax;this.needPax=encNumber(t,r+329,8,this.devmaj)||this.needPax;this.needPax=encNumber(t,r+337,8,this.devmin)||this.needPax;this.needPax=encString(t,r+345,i,c)||this.needPax;if(t[r+475]!==0){this.needPax=encString(t,r+345,155,c)||this.needPax}else{this.needPax=encString(t,r+345,130,c)||this.needPax;this.needPax=encDate(t,r+476,12,this.atime)||this.needPax;this.needPax=encDate(t,r+488,12,this.ctime)||this.needPax}let l=8*32;for(let i=r;i<r+148;i++){l+=t[i]}for(let i=r+156;i<r+512;i++){l+=t[i]}this.cksum=l;encNumber(t,r+148,8,this.cksum);this.cksumValid=true;return this.needPax}get type(){return this.#p==="Unsupported"?this.#p:cr.get(this.#p)}get typeKey(){return this.#p}set type(t){const r=String(lr.get(t));if(isCode(r)||r==="Unsupported"){this.#p=r}else if(isCode(t)){this.#p=t}else{throw new TypeError("invalid entry type: "+t)}}}const splitPrefix=(t,r)=>{const i=100;let o=t;let a="";let c=undefined;const l=S.posix.parse(t).root||".";if(Buffer.byteLength(o)<i){c=[o,a,false]}else{a=S.posix.dirname(o);o=S.posix.basename(o);do{if(Buffer.byteLength(o)<=i&&Buffer.byteLength(a)<=r){c=[o,a,false]}else if(Buffer.byteLength(o)>i&&Buffer.byteLength(a)<=r){c=[o.slice(0,i-1),a,true]}else{o=S.posix.join(S.posix.basename(a),o);a=S.posix.dirname(a)}}while(a!==l&&c===undefined);if(!c){c=[t.slice(0,i-1),"",true]}}return c};const decString=(t,r,i)=>t.subarray(r,r+i).toString("utf8").replace(/\0.*/,"");const decDate=(t,r,i)=>numToDate(decNumber(t,r,i));const numToDate=t=>t===undefined?undefined:new Date(t*1e3);const decNumber=(t,r,i)=>Number(t[r])&128?parse(t.subarray(r,r+i)):decSmallNumber(t,r,i);const nanUndef=t=>isNaN(t)?undefined:t;const decSmallNumber=(t,r,i)=>nanUndef(parseInt(t.subarray(r,r+i).toString("utf8").replace(/\0.*$/,"").trim(),8));const ur={12:8589934591,8:2097151};const encNumber=(t,r,i,o)=>o===undefined?false:o>ur[i]||o<0?(encode(o,t.subarray(r,r+i)),true):(encSmallNumber(t,r,i,o),false);const encSmallNumber=(t,r,i,o)=>t.write(octalString(o,i),r,i,"ascii");const octalString=(t,r)=>padOctal(Math.floor(t).toString(8),r);const padOctal=(t,r)=>(t.length===r-1?t:new Array(r-t.length-1).join("0")+t+" ")+"\0";const encDate=(t,r,i,o)=>o===undefined?false:encNumber(t,r,i,o.getTime()/1e3);const hr=new Array(156).join("\0");const encString=(t,r,i,o)=>o===undefined?false:(t.write(o+hr,r,i,"utf8"),o.length!==Buffer.byteLength(o)||o.length>i);class Pax{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,r=false){this.atime=t.atime;this.charset=t.charset;this.comment=t.comment;this.ctime=t.ctime;this.dev=t.dev;this.gid=t.gid;this.global=r;this.gname=t.gname;this.ino=t.ino;this.linkpath=t.linkpath;this.mtime=t.mtime;this.nlink=t.nlink;this.path=t.path;this.size=t.size;this.uid=t.uid;this.uname=t.uname}encode(){const t=this.encodeBody();if(t===""){return Buffer.allocUnsafe(0)}const r=Buffer.byteLength(t);const i=512*Math.ceil(1+r/512);const o=Buffer.allocUnsafe(i);for(let t=0;t<512;t++){o[t]=0}new Header({path:("PaxHeader/"+(0,S.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:r,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(o);o.write(t,512,r,"utf8");for(let t=r+512;t<o.length;t++){o[t]=0}return o}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===undefined){return""}const r=this[t];const i=r instanceof Date?r.getTime()/1e3:r;const o=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+i+"\n";const a=Buffer.byteLength(o);let c=Math.floor(Math.log(a)/Math.log(10))+1;if(a+c>=Math.pow(10,c)){c+=1}const l=c+a;return l+o}static parse(t,r,i=false){return new Pax(merge(parseKV(t),r),i)}}const merge=(t,r)=>r?Object.assign({},r,t):t;const parseKV=t=>t.replace(/\n$/,"").split("\n").reduce(parseKVLine,Object.create(null));const parseKVLine=(t,r)=>{const i=parseInt(r,10);if(i!==Buffer.byteLength(r)+1){return t}r=r.slice((i+" ").length);const o=r.split("=");const a=o.shift();if(!a){return t}const c=a.replace(/^SCHILY\.(dev|ino|nlink)/,"$1");const l=o.join("=");t[c]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(c)?new Date(Number(l)*1e3):/^[0-9]+$/.test(l)?+l:l;return t};const dr=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const fr=dr!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");class ReadEntry extends Minipass{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=false;ignore=false;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=false;absolute;unsupported=false;constructor(t,r,i){super({});this.pause();this.extended=r;this.globalExtended=i;this.header=t;this.remain=t.size??0;this.startBlockSize=512*Math.ceil(this.remain/512);this.blockRemain=this.startBlockSize;this.type=t.type;switch(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=true;break;default:this.ignore=true}if(!t.path){throw new Error("no path provided for tar.ReadEntry")}this.path=fr(t.path);this.mode=t.mode;if(this.mode){this.mode=this.mode&4095}this.uid=t.uid;this.gid=t.gid;this.uname=t.uname;this.gname=t.gname;this.size=this.remain;this.mtime=t.mtime;this.atime=t.atime;this.ctime=t.ctime;this.linkpath=t.linkpath?fr(t.linkpath):undefined;this.uname=t.uname;this.gname=t.gname;if(r){this.#m(r)}if(i){this.#m(i,true)}}write(t){const r=t.length;if(r>this.blockRemain){throw new Error("writing more to entry than is appropriate")}const i=this.remain;const o=this.blockRemain;this.remain=Math.max(0,i-r);this.blockRemain=Math.max(0,o-r);if(this.ignore){return true}if(i>=r){return super.write(t)}return super.write(t.subarray(0,i))}#m(t,r=false){if(t.path)t.path=fr(t.path);if(t.linkpath)t.linkpath=fr(t.linkpath);Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(i===null||i===undefined||t==="path"&&r)))))}}const warnMethod=(t,r,i,o={})=>{if(t.file){o.file=t.file}if(t.cwd){o.cwd=t.cwd}o.code=i instanceof Error&&i.code||r;o.tarCode=r;if(!t.strict&&o.recoverable!==false){if(i instanceof Error){o=Object.assign(i,o);i=i.message}t.emit("warn",r,i,o)}else if(i instanceof Error){t.emit("error",Object.assign(i,o))}else{t.emit("error",Object.assign(new Error(`${r}: ${i}`),o))}};const pr=1024*1024;const mr=Buffer.from([31,139]);const gr=Symbol("state");const yr=Symbol("writeEntry");const vr=Symbol("readEntry");const br=Symbol("nextEntry");const _r=Symbol("processEntry");const wr=Symbol("extendedHeader");const Er=Symbol("globalExtendedHeader");const Sr=Symbol("meta");const $r=Symbol("emitMeta");const xr=Symbol("buffer");const Rr=Symbol("queue");const Or=Symbol("ended");const Pr=Symbol("emittedEnd");const Ar=Symbol("emit");const Tr=Symbol("unzip");const Cr=Symbol("consumeChunk");const kr=Symbol("consumeChunkSub");const Ir=Symbol("consumeBody");const Nr=Symbol("consumeMeta");const Dr=Symbol("consumeHeader");const Lr=Symbol("consuming");const Mr=Symbol("bufferConcat");const jr=Symbol("maybeEnd");const Fr=Symbol("writing");const Ur=Symbol("aborted");const Br=Symbol("onDone");const Hr=Symbol("sawValidEntry");const Vr=Symbol("sawNullBlock");const zr=Symbol("sawEOF");const Gr=Symbol("closeStream");const noop=()=>true;class Parser extends Me.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;writable=true;readable=false;[Rr]=new Yallist;[xr];[vr];[yr];[gr]="begin";[Sr]="";[wr];[Er];[Or]=false;[Tr];[Ur]=false;[Hr];[Vr]=false;[zr]=false;[Fr]=false;[Lr]=false;[Pr]=false;constructor(t={}){super();this.file=t.file||"";this.on(Br,(()=>{if(this[gr]==="begin"||this[Hr]===false){this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}}));if(t.ondone){this.on(Br,t.ondone)}else{this.on(Br,(()=>{this.emit("prefinish");this.emit("finish");this.emit("end")}))}this.strict=!!t.strict;this.maxMetaEntrySize=t.maxMetaEntrySize||pr;this.filter=typeof t.filter==="function"?t.filter:noop;const r=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!t.gzip&&t.brotli!==undefined?t.brotli:r?undefined:false;this.on("end",(()=>this[Gr]()));if(typeof t.onwarn==="function"){this.on("warn",t.onwarn)}if(typeof t.onReadEntry==="function"){this.on("entry",t.onReadEntry)}}warn(t,r,i={}){warnMethod(this,t,r,i)}[Dr](t,r){if(this[Hr]===undefined){this[Hr]=false}let i;try{i=new Header(t,r,this[wr],this[Er])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(i.nullBlock){if(this[Vr]){this[zr]=true;if(this[gr]==="begin"){this[gr]="header"}this[Ar]("eof")}else{this[Vr]=true;this[Ar]("nullBlock")}}else{this[Vr]=false;if(!i.cksumValid){this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i})}else if(!i.path){this.warn("TAR_ENTRY_INVALID","path is required",{header:i})}else{const t=i.type;if(/^(Symbolic)?Link$/.test(t)&&!i.linkpath){this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i})}else if(!/^(Symbolic)?Link$/.test(t)&&!/^(Global)?ExtendedHeader$/.test(t)&&i.linkpath){this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i})}else{const t=this[yr]=new ReadEntry(i,this[wr],this[Er]);if(!this[Hr]){if(t.remain){const onend=()=>{if(!t.invalid){this[Hr]=true}};t.on("end",onend)}else{this[Hr]=true}}if(t.meta){if(t.size>this.maxMetaEntrySize){t.ignore=true;this[Ar]("ignoredEntry",t);this[gr]="ignore";t.resume()}else if(t.size>0){this[Sr]="";t.on("data",(t=>this[Sr]+=t));this[gr]="meta"}}else{this[wr]=undefined;t.ignore=t.ignore||!this.filter(t.path,t);if(t.ignore){this[Ar]("ignoredEntry",t);this[gr]=t.remain?"ignore":"header";t.resume()}else{if(t.remain){this[gr]="body"}else{this[gr]="header";t.end()}if(!this[vr]){this[Rr].push(t);this[br]()}else{this[Rr].push(t)}}}}}}}[Gr](){queueMicrotask((()=>this.emit("close")))}[_r](t){let r=true;if(!t){this[vr]=undefined;r=false}else if(Array.isArray(t)){const[r,...i]=t;this.emit(r,...i)}else{this[vr]=t;this.emit("entry",t);if(!t.emittedEnd){t.on("end",(()=>this[br]()));r=false}}return r}[br](){do{}while(this[_r](this[Rr].shift()));if(!this[Rr].length){const t=this[vr];const r=!t||t.flowing||t.size===t.remain;if(r){if(!this[Fr]){this.emit("drain")}}else{t.once("drain",(()=>this.emit("drain")))}}}[Ir](t,r){const i=this[yr];if(!i){throw new Error("attempt to consume body without entry??")}const o=i.blockRemain??0;const a=o>=t.length&&r===0?t:t.subarray(r,r+o);i.write(a);if(!i.blockRemain){this[gr]="header";this[yr]=undefined;i.end()}return a.length}[Nr](t,r){const i=this[yr];const o=this[Ir](t,r);if(!this[yr]&&i){this[$r](i)}return o}[Ar](t,r,i){if(!this[Rr].length&&!this[vr]){this.emit(t,r,i)}else{this[Rr].push([t,r,i])}}[$r](t){this[Ar]("meta",this[Sr]);switch(t.type){case"ExtendedHeader":case"OldExtendedHeader":this[wr]=Pax.parse(this[Sr],this[wr],false);break;case"GlobalExtendedHeader":this[Er]=Pax.parse(this[Sr],this[Er],true);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const t=this[wr]??Object.create(null);this[wr]=t;t.path=this[Sr].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const t=this[wr]||Object.create(null);this[wr]=t;t.linkpath=this[Sr].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){this[Ur]=true;this.emit("abort",t);this.warn("TAR_ABORT",t,{recoverable:false})}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}if(this[Ur]){i?.();return false}const o=this[Tr]===undefined||this.brotli===undefined&&this[Tr]===false;if(o&&t){if(this[xr]){t=Buffer.concat([this[xr],t]);this[xr]=undefined}if(t.length<mr.length){this[xr]=t;i?.();return true}for(let r=0;this[Tr]===undefined&&r<mr.length;r++){if(t[r]!==mr[r]){this[Tr]=false}}const r=this.brotli===undefined;if(this[Tr]===false&&r){if(t.length<512){if(this[Or]){this.brotli=true}else{this[xr]=t;i?.();return true}}else{try{new Header(t.subarray(0,512));this.brotli=false}catch(t){this.brotli=true}}}if(this[Tr]===undefined||this[Tr]===false&&this.brotli){const r=this[Or];this[Or]=false;this[Tr]=this[Tr]===undefined?new Unzip({}):new BrotliDecompress({});this[Tr].on("data",(t=>this[Cr](t)));this[Tr].on("error",(t=>this.abort(t)));this[Tr].on("end",(()=>{this[Or]=true;this[Cr]()}));this[Fr]=true;const o=!!this[Tr][r?"end":"write"](t);this[Fr]=false;i?.();return o}}this[Fr]=true;if(this[Tr]){this[Tr].write(t)}else{this[Cr](t)}this[Fr]=false;const a=this[Rr].length?false:this[vr]?this[vr].flowing:true;if(!a&&!this[Rr].length){this[vr]?.once("drain",(()=>this.emit("drain")))}i?.();return a}[Mr](t){if(t&&!this[Ur]){this[xr]=this[xr]?Buffer.concat([this[xr],t]):t}}[jr](){if(this[Or]&&!this[Pr]&&!this[Ur]&&!this[Lr]){this[Pr]=true;const t=this[yr];if(t&&t.blockRemain){const r=this[xr]?this[xr].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${r} available)`,{entry:t});if(this[xr]){t.write(this[xr])}t.end()}this[Ar](Br)}}[Cr](t){if(this[Lr]&&t){this[Mr](t)}else if(!t&&!this[xr]){this[jr]()}else if(t){this[Lr]=true;if(this[xr]){this[Mr](t);const r=this[xr];this[xr]=undefined;this[kr](r)}else{this[kr](t)}while(this[xr]&&this[xr]?.length>=512&&!this[Ur]&&!this[zr]){const t=this[xr];this[xr]=undefined;this[kr](t)}this[Lr]=false}if(!this[xr]||this[Or]){this[jr]()}}[kr](t){let r=0;const i=t.length;while(r+512<=i&&!this[Ur]&&!this[zr]){switch(this[gr]){case"begin":case"header":this[Dr](t,r);r+=512;break;case"ignore":case"body":r+=this[Ir](t,r);break;case"meta":r+=this[Nr](t,r);break;default:throw new Error("invalid state: "+this[gr])}}if(r<i){if(this[xr]){this[xr]=Buffer.concat([t.subarray(r),this[xr]])}else{this[xr]=t.subarray(r)}}}end(t,r,i){if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,r)}if(i)this.once("finish",i);if(!this[Ur]){if(this[Tr]){if(t)this[Tr].write(t);this[Tr].end()}else{this[Or]=true;if(this.brotli===undefined)t=t||Buffer.alloc(0);if(t)this.write(t);this[jr]()}}return this}}const stripTrailingSlashes=t=>{let r=t.length-1;let i=-1;while(r>-1&&t.charAt(r)==="/"){i=r;r--}return i===-1?t:t.slice(0,i)};const onReadEntryFunction=t=>{const r=t.onReadEntry;t.onReadEntry=r?t=>{r(t);t.resume()}:t=>t.resume()};const filesFilter=(t,r)=>{const i=new Map(r.map((t=>[stripTrailingSlashes(t),true])));const o=t.filter;const mapHas=(t,r="")=>{const o=r||(0,Zt.parse)(t).root||".";let a;if(t===o)a=false;else{const r=i.get(t);if(r!==undefined){a=r}else{a=mapHas((0,Zt.dirname)(t),o)}}i.set(t,a);return a};t.filter=o?(t,r)=>o(t,r)&&mapHas(stripTrailingSlashes(t)):t=>mapHas(stripTrailingSlashes(t))};const listFileSync=t=>{const r=new Parser(t);const i=t.file;let o;try{const a=E.statSync(i);const c=t.maxReadSize||16*1024*1024;if(a.size<c){r.end(E.readFileSync(i))}else{let t=0;const l=Buffer.allocUnsafe(c);o=E.openSync(i,"r");while(t<a.size){const i=E.readSync(o,l,0,c,t);t+=i;r.write(l.subarray(0,i))}r.end()}}finally{if(typeof o==="number"){try{E.closeSync(o)}catch(t){}}}};const listFile=(t,r)=>{const i=new Parser(t);const o=t.maxReadSize||16*1024*1024;const a=t.file;const c=new Promise(((t,r)=>{i.on("error",r);i.on("end",t);E.stat(a,((t,c)=>{if(t){r(t)}else{const t=new ReadStream(a,{readSize:o,size:c.size});t.on("error",r);t.pipe(i)}}))}));return c};const qr=makeCommand(listFileSync,listFile,(t=>new Parser(t)),(t=>new Parser(t)),((t,r)=>{if(r?.length)filesFilter(t,r);if(!t.noResume)onReadEntryFunction(t)}));const modeFix=(t,r,i)=>{t&=4095;if(i){t=(t|384)&~18}if(r){if(t&256){t|=64}if(t&32){t|=8}if(t&4){t|=1}}return t};const{isAbsolute:Wr,parse:Kr}=S.win32;const stripAbsolutePath=t=>{let r="";let i=Kr(t);while(Wr(t)||i.root){const o=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":i.root;t=t.slice(o.length);r+=o;i=Kr(t)}return[r,t]};const Yr=["|","<",">","?",":"];const Zr=Yr.map((t=>String.fromCharCode(61440+t.charCodeAt(0))));const Xr=new Map(Yr.map(((t,r)=>[t,Zr[r]])));const Jr=new Map(Zr.map(((t,r)=>[t,Yr[r]])));const winchars_encode=t=>Yr.reduce(((t,r)=>t.split(r).join(Xr.get(r))),t);const decode=t=>Zr.reduce(((t,r)=>t.split(r).join(Jr.get(r))),t);const prefixPath=(t,r)=>{if(!r){return fr(t)}t=fr(t).replace(/^\.(\/|$)/,"");return stripTrailingSlashes(r)+"/"+t};const Qr=16*1024*1024;const es=Symbol("process");const ts=Symbol("file");const rs=Symbol("directory");const ss=Symbol("symlink");const is=Symbol("hardlink");const ns=Symbol("header");const os=Symbol("read");const as=Symbol("lstat");const cs=Symbol("onlstat");const ls=Symbol("onread");const us=Symbol("onreadlink");const hs=Symbol("openfile");const ds=Symbol("onopenfile");const ps=Symbol("close");const ms=Symbol("mode");const gs=Symbol("awaitDrain");const ys=Symbol("ondrain");const vs=Symbol("prefix");class WriteEntry extends Minipass{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#g=false;constructor(t,r={}){const i=dealias(r);super();this.path=fr(t);this.portable=!!i.portable;this.maxReadSize=i.maxReadSize||Qr;this.linkCache=i.linkCache||new Map;this.statCache=i.statCache||new Map;this.preservePaths=!!i.preservePaths;this.cwd=fr(i.cwd||process.cwd());this.strict=!!i.strict;this.noPax=!!i.noPax;this.noMtime=!!i.noMtime;this.mtime=i.mtime;this.prefix=i.prefix?fr(i.prefix):undefined;this.onWriteEntry=i.onWriteEntry;if(typeof i.onwarn==="function"){this.on("warn",i.onwarn)}let o=false;if(!this.preservePaths){const[t,r]=stripAbsolutePath(this.path);if(t&&typeof r==="string"){this.path=r;o=t}}this.win32=!!i.win32||process.platform==="win32";if(this.win32){this.path=decode(this.path.replace(/\\/g,"/"));t=t.replace(/\\/g,"/")}this.absolute=fr(i.absolute||Zt.resolve(this.cwd,t));if(this.path===""){this.path="./"}if(o){this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path})}const a=this.statCache.get(this.absolute);if(a){this[cs](a)}else{this[as]()}}warn(t,r,i={}){return warnMethod(this,t,r,i)}emit(t,...r){if(t==="error"){this.#g=true}return super.emit(t,...r)}[as](){je.lstat(this.absolute,((t,r)=>{if(t){return this.emit("error",t)}this[cs](r)}))}[cs](t){this.statCache.set(this.absolute,t);this.stat=t;if(!t.isFile()){t.size=0}this.type=getType(t);this.emit("stat",t);this[es]()}[es](){switch(this.type){case"File":return this[ts]();case"Directory":return this[rs]();case"SymbolicLink":return this[ss]();default:return this.end()}}[ms](t){return modeFix(t,this.type==="Directory",this.portable)}[vs](t){return prefixPath(t,this.prefix)}[ns](){if(!this.stat){throw new Error("cannot write header before stat")}if(this.type==="Directory"&&this.portable){this.noMtime=true}this.onWriteEntry?.(this);this.header=new Header({path:this[vs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[vs](this.linkpath):this.linkpath,mode:this[ms](this.stat.mode),uid:this.portable?undefined:this.stat.uid,gid:this.portable?undefined:this.stat.gid,size:this.stat.size,mtime:this.noMtime?undefined:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?undefined:this.type,uname:this.portable?undefined:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?undefined:this.stat.atime,ctime:this.portable?undefined:this.stat.ctime});if(this.header.encode()&&!this.noPax){super.write(new Pax({atime:this.portable?undefined:this.header.atime,ctime:this.portable?undefined:this.header.ctime,gid:this.portable?undefined:this.header.gid,mtime:this.noMtime?undefined:this.mtime||this.header.mtime,path:this[vs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[vs](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?undefined:this.header.uid,uname:this.portable?undefined:this.header.uname,dev:this.portable?undefined:this.stat.dev,ino:this.portable?undefined:this.stat.ino,nlink:this.portable?undefined:this.stat.nlink}).encode())}const t=this.header?.block;if(!t){throw new Error("failed to encode header")}super.write(t)}[rs](){if(!this.stat){throw new Error("cannot create directory entry without stat")}if(this.path.slice(-1)!=="/"){this.path+="/"}this.stat.size=0;this[ns]();this.end()}[ss](){je.readlink(this.absolute,((t,r)=>{if(t){return this.emit("error",t)}this[us](r)}))}[us](t){this.linkpath=fr(t);this[ns]();this.end()}[is](t){if(!this.stat){throw new Error("cannot create link entry without stat")}this.type="Link";this.linkpath=fr(Zt.relative(this.cwd,t));this.stat.size=0;this[ns]();this.end()}[ts](){if(!this.stat){throw new Error("cannot create file entry without stat")}if(this.stat.nlink>1){const t=`${this.stat.dev}:${this.stat.ino}`;const r=this.linkCache.get(t);if(r?.indexOf(this.cwd)===0){return this[is](r)}this.linkCache.set(t,this.absolute)}this[ns]();if(this.stat.size===0){return this.end()}this[hs]()}[hs](){je.open(this.absolute,"r",((t,r)=>{if(t){return this.emit("error",t)}this[ds](r)}))}[ds](t){this.fd=t;if(this.#g){return this[ps]()}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 r=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(r);this.offset=0;this.pos=0;this.remain=this.stat.size;this.length=this.buf.length;this[os]()}[os](){const{fd:t,buf:r,offset:i,length:o,pos:a}=this;if(t===undefined||r===undefined){throw new Error("cannot read file without first opening")}je.read(t,r,i,o,a,((t,r)=>{if(t){return this[ps]((()=>this.emit("error",t)))}this[ls](r)}))}[ps](t=(()=>{})){if(this.fd!==undefined)je.close(this.fd,t)}[ls](t){if(t<=0&&this.remain>0){const t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[ps]((()=>this.emit("error",t)))}if(t>this.remain){const t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[ps]((()=>this.emit("error",t)))}if(!this.buf){throw new Error("should have created buffer prior to reading")}if(t===this.remain){for(let r=t;r<this.length&&t<this.blockRemain;r++){this.buf[r+this.offset]=0;t++;this.remain++}}const r=this.offset===0&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);const i=this.write(r);if(!i){this[gs]((()=>this[ys]()))}else{this[ys]()}}[gs](t){this.once("drain",t)}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}if(this.blockRemain<t.length){const t=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}this.remain-=t.length;this.blockRemain-=t.length;this.pos+=t.length;this.offset+=t.length;return super.write(t,null,i)}[ys](){if(!this.remain){if(this.blockRemain){super.write(Buffer.alloc(this.blockRemain))}return this[ps]((t=>t?this.emit("error",t):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[os]()}}class WriteEntrySync extends WriteEntry{sync=true;[as](){this[cs](je.lstatSync(this.absolute))}[ss](){this[us](je.readlinkSync(this.absolute))}[hs](){this[ds](je.openSync(this.absolute,"r"))}[os](){let t=true;try{const{fd:r,buf:i,offset:o,length:a,pos:c}=this;if(r===undefined||i===undefined){throw new Error("fd and buf must be set in READ method")}const l=je.readSync(r,i,o,a,c);this[ls](l);t=false}finally{if(t){try{this[ps]((()=>{}))}catch(t){}}}}[gs](t){t()}[ps](t=(()=>{})){if(this.fd!==undefined)je.closeSync(this.fd);t()}}class WriteEntryTar extends Minipass{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,r,i={}){return warnMethod(this,t,r,i)}constructor(t,r={}){const i=dealias(r);super();this.preservePaths=!!i.preservePaths;this.portable=!!i.portable;this.strict=!!i.strict;this.noPax=!!i.noPax;this.noMtime=!!i.noMtime;this.onWriteEntry=i.onWriteEntry;this.readEntry=t;const{type:o}=t;if(o==="Unsupported"){throw new Error("writing entry that should be ignored")}this.type=o;if(this.type==="Directory"&&this.portable){this.noMtime=true}this.prefix=i.prefix;this.path=fr(t.path);this.mode=t.mode!==undefined?this[ms](t.mode):undefined;this.uid=this.portable?undefined:t.uid;this.gid=this.portable?undefined:t.gid;this.uname=this.portable?undefined:t.uname;this.gname=this.portable?undefined:t.gname;this.size=t.size;this.mtime=this.noMtime?undefined:i.mtime||t.mtime;this.atime=this.portable?undefined:t.atime;this.ctime=this.portable?undefined:t.ctime;this.linkpath=t.linkpath!==undefined?fr(t.linkpath):undefined;if(typeof i.onwarn==="function"){this.on("warn",i.onwarn)}let a=false;if(!this.preservePaths){const[t,r]=stripAbsolutePath(this.path);if(t&&typeof r==="string"){this.path=r;a=t}}this.remain=t.size;this.blockRemain=t.startBlockSize;this.onWriteEntry?.(this);this.header=new Header({path:this[vs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[vs](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?undefined:this.uid,gid:this.portable?undefined:this.gid,size:this.size,mtime:this.noMtime?undefined:this.mtime,type:this.type,uname:this.portable?undefined:this.uname,atime:this.portable?undefined:this.atime,ctime:this.portable?undefined:this.ctime});if(a){this.warn("TAR_ENTRY_INFO",`stripping ${a} from absolute path`,{entry:this,path:a+this.path})}if(this.header.encode()&&!this.noPax){super.write(new Pax({atime:this.portable?undefined:this.atime,ctime:this.portable?undefined:this.ctime,gid:this.portable?undefined:this.gid,mtime:this.noMtime?undefined:this.mtime,path:this[vs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[vs](this.linkpath):this.linkpath,size:this.size,uid:this.portable?undefined:this.uid,uname:this.portable?undefined:this.uname,dev:this.portable?undefined:this.readEntry.dev,ino:this.portable?undefined:this.readEntry.ino,nlink:this.portable?undefined:this.readEntry.nlink}).encode())}const c=this.header?.block;if(!c)throw new Error("failed to encode header");super.write(c);t.pipe(this)}[vs](t){return prefixPath(t,this.prefix)}[ms](t){return modeFix(t,this.type==="Directory",this.portable)}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}const o=t.length;if(o>this.blockRemain){throw new Error("writing more to entry than is appropriate")}this.blockRemain-=o;return super.write(t,i)}end(t,r,i){if(this.blockRemain){super.write(Buffer.alloc(this.blockRemain))}if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,r??"utf8")}if(i)this.once("finish",i);t?super.end(t,i):super.end(i);return this}}const getType=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";class PackJob{path;absolute;entry;stat;readdir;pending=false;ignore=false;piped=false;constructor(t,r){this.path=t||"./";this.absolute=r}}const bs=Buffer.alloc(1024);const _s=Symbol("onStat");const ws=Symbol("ended");const Es=Symbol("queue");const Ss=Symbol("current");const $s=Symbol("process");const xs=Symbol("processing");const Rs=Symbol("processJob");const Os=Symbol("jobs");const Ps=Symbol("jobDone");const As=Symbol("addFSEntry");const Ts=Symbol("addTarEntry");const Cs=Symbol("stat");const ks=Symbol("readdir");const Is=Symbol("onreaddir");const Ns=Symbol("pipe");const Ds=Symbol("entry");const Ls=Symbol("entryOpt");const Ms=Symbol("writeEntryClass");const js=Symbol("write");const Fs=Symbol("ondrain");class Pack extends Minipass{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Ms];onWriteEntry;[Es];[Os]=0;[xs]=false;[ws]=false;constructor(t={}){super();this.opt=t;this.file=t.file||"";this.cwd=t.cwd||process.cwd();this.maxReadSize=t.maxReadSize;this.preservePaths=!!t.preservePaths;this.strict=!!t.strict;this.noPax=!!t.noPax;this.prefix=fr(t.prefix||"");this.linkCache=t.linkCache||new Map;this.statCache=t.statCache||new Map;this.readdirCache=t.readdirCache||new Map;this.onWriteEntry=t.onWriteEntry;this[Ms]=WriteEntry;if(typeof t.onwarn==="function"){this.on("warn",t.onwarn)}this.portable=!!t.portable;if(t.gzip||t.brotli){if(t.gzip&&t.brotli){throw new TypeError("gzip and brotli are mutually exclusive")}if(t.gzip){if(typeof t.gzip!=="object"){t.gzip={}}if(this.portable){t.gzip.portable=true}this.zip=new Gzip(t.gzip)}if(t.brotli){if(typeof t.brotli!=="object"){t.brotli={}}this.zip=new BrotliCompress(t.brotli)}if(!this.zip)throw new Error("impossible");const r=this.zip;r.on("data",(t=>super.write(t)));r.on("end",(()=>super.end()));r.on("drain",(()=>this[Fs]()));this.on("resume",(()=>r.resume()))}else{this.on("drain",this[Fs])}this.noDirRecurse=!!t.noDirRecurse;this.follow=!!t.follow;this.noMtime=!!t.noMtime;if(t.mtime)this.mtime=t.mtime;this.filter=typeof t.filter==="function"?t.filter:()=>true;this[Es]=new Yallist;this[Os]=0;this.jobs=Number(t.jobs)||4;this[xs]=false;this[ws]=false}[js](t){return super.write(t)}add(t){this.write(t);return this}end(t,r,i){if(typeof t==="function"){i=t;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(t){this.add(t)}this[ws]=true;this[$s]();if(i)i();return this}write(t){if(this[ws]){throw new Error("write after end")}if(t instanceof ReadEntry){this[Ts](t)}else{this[As](t)}return this.flowing}[Ts](t){const r=fr(Zt.resolve(this.cwd,t.path));if(!this.filter(t.path,t)){t.resume()}else{const i=new PackJob(t.path,r);i.entry=new WriteEntryTar(t,this[Ls](i));i.entry.on("end",(()=>this[Ps](i)));this[Os]+=1;this[Es].push(i)}this[$s]()}[As](t){const r=fr(Zt.resolve(this.cwd,t));this[Es].push(new PackJob(t,r));this[$s]()}[Cs](t){t.pending=true;this[Os]+=1;const r=this.follow?"stat":"lstat";je[r](t.absolute,((r,i)=>{t.pending=false;this[Os]-=1;if(r){this.emit("error",r)}else{this[_s](t,i)}}))}[_s](t,r){this.statCache.set(t.absolute,r);t.stat=r;if(!this.filter(t.path,r)){t.ignore=true}this[$s]()}[ks](t){t.pending=true;this[Os]+=1;je.readdir(t.absolute,((r,i)=>{t.pending=false;this[Os]-=1;if(r){return this.emit("error",r)}this[Is](t,i)}))}[Is](t,r){this.readdirCache.set(t.absolute,r);t.readdir=r;this[$s]()}[$s](){if(this[xs]){return}this[xs]=true;for(let t=this[Es].head;!!t&&this[Os]<this.jobs;t=t.next){this[Rs](t.value);if(t.value.ignore){const r=t.next;this[Es].removeNode(t);t.next=r}}this[xs]=false;if(this[ws]&&!this[Es].length&&this[Os]===0){if(this.zip){this.zip.end(bs)}else{super.write(bs);super.end()}}}get[Ss](){return this[Es]&&this[Es].head&&this[Es].head.value}[Ps](t){this[Es].shift();this[Os]-=1;this[$s]()}[Rs](t){if(t.pending){return}if(t.entry){if(t===this[Ss]&&!t.piped){this[Ns](t)}return}if(!t.stat){const r=this.statCache.get(t.absolute);if(r){this[_s](t,r)}else{this[Cs](t)}}if(!t.stat){return}if(t.ignore){return}if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){const r=this.readdirCache.get(t.absolute);if(r){this[Is](t,r)}else{this[ks](t)}if(!t.readdir){return}}t.entry=this[Ds](t);if(!t.entry){t.ignore=true;return}if(t===this[Ss]&&!t.piped){this[Ns](t)}}[Ls](t){return{onwarn:(t,r,i)=>this.warn(t,r,i),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Ds](t){this[Os]+=1;try{const r=new this[Ms](t.path,this[Ls](t));return r.on("end",(()=>this[Ps](t))).on("error",(t=>this.emit("error",t)))}catch(t){this.emit("error",t)}}[Fs](){if(this[Ss]&&this[Ss].entry){this[Ss].entry.resume()}}[Ns](t){t.piped=true;if(t.readdir){t.readdir.forEach((r=>{const i=t.path;const o=i==="./"?"":i.replace(/\/*$/,"/");this[As](o+r)}))}const r=t.entry;const i=this.zip;if(!r)throw new Error("cannot pipe without source");if(i){r.on("data",(t=>{if(!i.write(t)){r.pause()}}))}else{r.on("data",(t=>{if(!super.write(t)){r.pause()}}))}}pause(){if(this.zip){this.zip.pause()}return super.pause()}warn(t,r,i={}){warnMethod(this,t,r,i)}}class PackSync extends Pack{sync=true;constructor(t){super(t);this[Ms]=WriteEntrySync}pause(){}resume(){}[Cs](t){const r=this.follow?"statSync":"lstatSync";this[_s](t,je[r](t.absolute))}[ks](t){this[Is](t,je.readdirSync(t.absolute))}[Ns](t){const r=t.entry;const i=this.zip;if(t.readdir){t.readdir.forEach((r=>{const i=t.path;const o=i==="./"?"":i.replace(/\/*$/,"/");this[As](o+r)}))}if(!r)throw new Error("Cannot pipe without source");if(i){r.on("data",(t=>{i.write(t)}))}else{r.on("data",(t=>{super[js](t)}))}}}const createFileSync=(t,r)=>{const i=new PackSync(t);const o=new WriteStreamSync(t.file,{mode:t.mode||438});i.pipe(o);addFilesSync(i,r)};const createFile=(t,r)=>{const i=new Pack(t);const o=new WriteStream(t.file,{mode:t.mode||438});i.pipe(o);const a=new Promise(((t,r)=>{o.on("error",r);o.on("close",t);i.on("error",r)}));addFilesAsync(i,r);return a};const addFilesSync=(t,r)=>{r.forEach((r=>{if(r.charAt(0)==="@"){qr({file:S.resolve(t.cwd,r.slice(1)),sync:true,noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(r)}}));t.end()};const addFilesAsync=async(t,r)=>{for(let i=0;i<r.length;i++){const o=String(r[i]);if(o.charAt(0)==="@"){await qr({file:S.resolve(String(t.cwd),o.slice(1)),noResume:true,onReadEntry:r=>{t.add(r)}})}else{t.add(o)}}t.end()};const createSync=(t,r)=>{const i=new PackSync(t);addFilesSync(i,r);return i};const createAsync=(t,r)=>{const i=new Pack(t);addFilesAsync(i,r);return i};const Us=makeCommand(createFileSync,createFile,createSync,createAsync,((t,r)=>{if(!r?.length){throw new TypeError("no paths specified to add to archive")}}));const Bs=process.env.__FAKE_PLATFORM__||process.platform;const Hs=Bs==="win32";const{O_CREAT:Vs,O_TRUNC:zs,O_WRONLY:Gs}=je.constants;const qs=Number(process.env.__FAKE_FS_O_FILENAME__)||je.constants.UV_FS_O_FILEMAP||0;const Ws=Hs&&!!qs;const Ks=512*1024;const Ys=qs|zs|Vs|Gs;const Zs=!Ws?()=>"w":t=>t<Ks?Ys:"w";const lchownSync=(t,r,i)=>{try{return E.lchownSync(t,r,i)}catch(t){if(t?.code!=="ENOENT")throw t}};const chown=(t,r,i,o)=>{E.lchown(t,r,i,(t=>{o(t&&t?.code!=="ENOENT"?t:null)}))};const chownrKid=(t,r,i,o,a)=>{if(r.isDirectory()){chownr(S.resolve(t,r.name),i,o,(c=>{if(c)return a(c);const l=S.resolve(t,r.name);chown(l,i,o,a)}))}else{const c=S.resolve(t,r.name);chown(c,i,o,a)}};const chownr=(t,r,i,o)=>{E.readdir(t,{withFileTypes:true},((a,c)=>{if(a){if(a.code==="ENOENT")return o();else if(a.code!=="ENOTDIR"&&a.code!=="ENOTSUP")return o(a)}if(a||!c.length)return chown(t,r,i,o);let l=c.length;let u=null;const then=a=>{if(u)return;if(a)return o(u=a);if(--l===0)return chown(t,r,i,o)};for(const o of c){chownrKid(t,o,r,i,then)}}))};const chownrKidSync=(t,r,i,o)=>{if(r.isDirectory())chownrSync(S.resolve(t,r.name),i,o);lchownSync(S.resolve(t,r.name),i,o)};const chownrSync=(t,r,i)=>{let o;try{o=E.readdirSync(t,{withFileTypes:true})}catch(o){const a=o;if(a?.code==="ENOENT")return;else if(a?.code==="ENOTDIR"||a?.code==="ENOTSUP")return lchownSync(t,r,i);else throw a}for(const a of o){chownrKidSync(t,a,r,i)}return lchownSync(t,r,i)};const optsArg=t=>{if(!t){t={mode:511}}else if(typeof t==="object"){t={mode:511,...t}}else if(typeof t==="number"){t={mode:t}}else if(typeof t==="string"){t={mode:parseInt(t,8)}}else{throw new TypeError("invalid options argument")}const r=t;const i=t.fs||{};t.mkdir=t.mkdir||i.mkdir||je.mkdir;t.mkdirAsync=t.mkdirAsync?t.mkdirAsync:async(t,i)=>new Promise(((o,a)=>r.mkdir(t,i,((t,r)=>t?a(t):o(r)))));t.stat=t.stat||i.stat||je.stat;t.statAsync=t.statAsync?t.statAsync:async t=>new Promise(((i,o)=>r.stat(t,((t,r)=>t?o(t):i(r)))));t.statSync=t.statSync||i.statSync||je.statSync;t.mkdirSync=t.mkdirSync||i.mkdirSync||je.mkdirSync;return r};const mkdirp_manual_mkdirpManualSync=(t,r,i)=>{const o=(0,Zt.dirname)(t);const a={...optsArg(r),recursive:false};if(o===t){try{return a.mkdirSync(t,a)}catch(t){const r=t;if(r&&r.code!=="EISDIR"){throw t}return}}try{a.mkdirSync(t,a);return i||t}catch(r){const c=r;if(c&&c.code==="ENOENT"){return mkdirp_manual_mkdirpManualSync(t,a,mkdirp_manual_mkdirpManualSync(o,a,i))}if(c&&c.code!=="EEXIST"&&c&&c.code!=="EROFS"){throw r}try{if(!a.statSync(t).isDirectory())throw r}catch(t){throw r}}};const Xs=Object.assign((async(t,r,i)=>{const o=optsArg(r);o.recursive=false;const a=(0,Zt.dirname)(t);if(a===t){return o.mkdirAsync(t,o).catch((t=>{const r=t;if(r&&r.code!=="EISDIR"){throw t}}))}return o.mkdirAsync(t,o).then((()=>i||t),(async r=>{const c=r;if(c&&c.code==="ENOENT"){return Xs(a,o).then((r=>Xs(t,o,r)))}if(c&&c.code!=="EEXIST"&&c.code!=="EROFS"){throw r}return o.statAsync(t).then((t=>{if(t.isDirectory()){return i}else{throw r}}),(()=>{throw r}))}))}),{sync:mkdirp_manual_mkdirpManualSync});const findMade=async(t,r,i)=>{if(i===r){return}return t.statAsync(r).then((t=>t.isDirectory()?i:undefined),(i=>{const o=i;return o&&o.code==="ENOENT"?findMade(t,(0,Zt.dirname)(r),r):undefined}))};const findMadeSync=(t,r,i)=>{if(i===r){return undefined}try{return t.statSync(r).isDirectory()?i:undefined}catch(i){const o=i;return o&&o.code==="ENOENT"?findMadeSync(t,(0,Zt.dirname)(r),r):undefined}};const mkdirp_native_mkdirpNativeSync=(t,r)=>{const i=optsArg(r);i.recursive=true;const o=(0,Zt.dirname)(t);if(o===t){return i.mkdirSync(t,i)}const a=findMadeSync(i,t);try{i.mkdirSync(t,i);return a}catch(r){const o=r;if(o&&o.code==="ENOENT"){return mkdirp_manual_mkdirpManualSync(t,i)}else{throw r}}};const Js=Object.assign((async(t,r)=>{const i={...optsArg(r),recursive:true};const o=(0,Zt.dirname)(t);if(o===t){return await i.mkdirAsync(t,i)}return findMade(i,t).then((r=>i.mkdirAsync(t,i).then((t=>r||t)).catch((r=>{const o=r;if(o&&o.code==="ENOENT"){return Xs(t,i)}else{throw r}}))))}),{sync:mkdirp_native_mkdirpNativeSync});const Qs=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform;const pathArg=t=>{if(/\0/.test(t)){throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"})}t=(0,Zt.resolve)(t);if(Qs==="win32"){const r=/[*|"<>?:]/;const{root:i}=(0,Zt.parse)(t);if(r.test(t.substring(i.length))){throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}}return t};const ei=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version;const ti=ei.replace(/^v/,"").split(".");const ri=+ti[0]>10||+ti[0]===10&&+ti[1]>=12;const si=!ri?()=>false:t=>optsArg(t).mkdirSync===je.mkdirSync;const ii=Object.assign(!ri?()=>false:t=>optsArg(t).mkdir===je.mkdir,{sync:si});const mkdirpSync=(t,r)=>{t=pathArg(t);const i=optsArg(r);return si(i)?mkdirp_native_mkdirpNativeSync(t,i):mkdirp_manual_mkdirpManualSync(t,i)};const ni=null&&mkdirpSync;const oi=null&&mkdirpManual;const ai=null&&mkdirpManualSync;const ci=null&&mkdirpNative;const li=null&&mkdirpNativeSync;const ui=Object.assign((async(t,r)=>{t=pathArg(t);const i=optsArg(r);return ii(i)?Js(t,i):Xs(t,i)}),{mkdirpSync:mkdirpSync,mkdirpNative:Js,mkdirpNativeSync:mkdirp_native_mkdirpNativeSync,mkdirpManual:Xs,mkdirpManualSync:mkdirp_manual_mkdirpManualSync,sync:mkdirpSync,native:Js,nativeSync:mkdirp_native_mkdirpNativeSync,manual:Xs,manualSync:mkdirp_manual_mkdirpManualSync,useNative:ii,useNativeSync:si});class CwdError extends Error{path;code;syscall="chdir";constructor(t,r){super(`${r}: Cannot cd into '${t}'`);this.path=t;this.code=r}get name(){return"CwdError"}}class SymlinkError extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,r){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");this.symlink=t;this.path=r}get name(){return"SymlinkError"}}const cGet=(t,r)=>t.get(fr(r));const cSet=(t,r,i)=>t.set(fr(r),i);const checkCwd=(t,r)=>{je.stat(t,((i,o)=>{if(i||!o.isDirectory()){i=new CwdError(t,i?.code||"ENOTDIR")}r(i)}))};const mkdir=(t,r,i)=>{t=fr(t);const o=r.umask??18;const a=r.mode|448;const c=(a&o)!==0;const l=r.uid;const u=r.gid;const h=typeof l==="number"&&typeof u==="number"&&(l!==r.processUid||u!==r.processGid);const d=r.preserve;const p=r.unlink;const m=r.cache;const g=fr(r.cwd);const done=(r,o)=>{if(r){i(r)}else{cSet(m,t,true);if(o&&h){chownr(o,l,u,(t=>done(t)))}else if(c){je.chmod(t,a,i)}else{i()}}};if(m&&cGet(m,t)===true){return done()}if(t===g){return checkCwd(t,done)}if(d){return ui(t,{mode:a}).then((t=>done(null,t??undefined)),done)}const y=fr(S.relative(g,t));const v=y.split("/");mkdir_(g,v,a,m,p,g,undefined,done)};const mkdir_=(t,r,i,o,a,c,l,u)=>{if(!r.length){return u(null,l)}const h=r.shift();const d=fr(S.resolve(t+"/"+h));if(cGet(o,d)){return mkdir_(d,r,i,o,a,c,l,u)}je.mkdir(d,i,onmkdir(d,r,i,o,a,c,l,u))};const onmkdir=(t,r,i,o,a,c,l,u)=>h=>{if(h){je.lstat(t,((d,p)=>{if(d){d.path=d.path&&fr(d.path);u(d)}else if(p.isDirectory()){mkdir_(t,r,i,o,a,c,l,u)}else if(a){je.unlink(t,(h=>{if(h){return u(h)}je.mkdir(t,i,onmkdir(t,r,i,o,a,c,l,u))}))}else if(p.isSymbolicLink()){return u(new SymlinkError(t,t+"/"+r.join("/")))}else{u(h)}}))}else{l=l||t;mkdir_(t,r,i,o,a,c,l,u)}};const checkCwdSync=t=>{let r=false;let i=undefined;try{r=je.statSync(t).isDirectory()}catch(t){i=t?.code}finally{if(!r){throw new CwdError(t,i??"ENOTDIR")}}};const mkdirSync=(t,r)=>{t=fr(t);const i=r.umask??18;const o=r.mode|448;const a=(o&i)!==0;const c=r.uid;const l=r.gid;const u=typeof c==="number"&&typeof l==="number"&&(c!==r.processUid||l!==r.processGid);const h=r.preserve;const d=r.unlink;const p=r.cache;const m=fr(r.cwd);const done=r=>{cSet(p,t,true);if(r&&u){chownrSync(r,c,l)}if(a){je.chmodSync(t,o)}};if(p&&cGet(p,t)===true){return done()}if(t===m){checkCwdSync(m);return done()}if(h){return done(mkdirpSync(t,o)??undefined)}const g=fr(S.relative(m,t));const y=g.split("/");let v=undefined;for(let t=y.shift(),r=m;t&&(r+="/"+t);t=y.shift()){r=fr(S.resolve(r));if(cGet(p,r)){continue}try{je.mkdirSync(r,o);v=v||r;cSet(p,r,true)}catch(t){const i=je.lstatSync(r);if(i.isDirectory()){cSet(p,r,true);continue}else if(d){je.unlinkSync(r);je.mkdirSync(r,o);v=v||r;cSet(p,r,true);continue}else if(i.isSymbolicLink()){return new SymlinkError(r,r+"/"+y.join("/"))}}}return done(v)};const hi=Object.create(null);const{hasOwnProperty:di}=Object.prototype;const normalizeUnicode=t=>{if(!di.call(hi,t)){hi[t]=t.normalize("NFD")}return hi[t]};const fi=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const pi=fi==="win32";const getDirs=t=>{const r=t.split("/").slice(0,-1).reduce(((t,r)=>{const i=t[t.length-1];if(i!==undefined){r=(0,S.join)(i,r)}t.push(r||"/");return t}),[]);return r};class PathReservations{#y=new Map;#v=new Map;#b=new Set;reserve(t,r){t=pi?["win32 parallelization disabled"]:t.map((t=>stripTrailingSlashes((0,S.join)(normalizeUnicode(t))).toLowerCase()));const i=new Set(t.map((t=>getDirs(t))).reduce(((t,r)=>t.concat(r))));this.#v.set(r,{dirs:i,paths:t});for(const i of t){const t=this.#y.get(i);if(!t){this.#y.set(i,[r])}else{t.push(r)}}for(const t of i){const i=this.#y.get(t);if(!i){this.#y.set(t,[new Set([r])])}else{const t=i[i.length-1];if(t instanceof Set){t.add(r)}else{i.push(new Set([r]))}}}return this.#_(r)}#w(t){const r=this.#v.get(t);if(!r){throw new Error("function does not have any path reservations")}return{paths:r.paths.map((t=>this.#y.get(t))),dirs:[...r.dirs].map((t=>this.#y.get(t)))}}check(t){const{paths:r,dirs:i}=this.#w(t);return r.every((r=>r&&r[0]===t))&&i.every((r=>r&&r[0]instanceof Set&&r[0].has(t)))}#_(t){if(this.#b.has(t)||!this.check(t)){return false}this.#b.add(t);t((()=>this.#E(t)));return true}#E(t){if(!this.#b.has(t)){return false}const r=this.#v.get(t);if(!r){throw new Error("invalid reservation")}const{paths:i,dirs:o}=r;const a=new Set;for(const r of i){const i=this.#y.get(r);if(!i||i?.[0]!==t){continue}const o=i[1];if(!o){this.#y.delete(r);continue}i.shift();if(typeof o==="function"){a.add(o)}else{for(const t of o){a.add(t)}}}for(const r of o){const i=this.#y.get(r);const o=i?.[0];if(!i||!(o instanceof Set))continue;if(o.size===1&&i.length===1){this.#y.delete(r);continue}else if(o.size===1){i.shift();const t=i[0];if(typeof t==="function"){a.add(t)}}else{o.delete(t)}}this.#b.delete(t);a.forEach((t=>this.#_(t)));return true}}const mi=Symbol("onEntry");const gi=Symbol("checkFs");const yi=Symbol("checkFs2");const vi=Symbol("pruneCache");const bi=Symbol("isReusable");const _i=Symbol("makeFs");const wi=Symbol("file");const Ei=Symbol("directory");const Si=Symbol("link");const $i=Symbol("symlink");const xi=Symbol("hardlink");const Ri=Symbol("unsupported");const Oi=Symbol("checkPath");const Pi=Symbol("mkdir");const Ai=Symbol("onError");const Ti=Symbol("pending");const Ci=Symbol("pend");const ki=Symbol("unpend");const Ii=Symbol("ended");const Ni=Symbol("maybeClose");const Di=Symbol("skip");const Li=Symbol("doChown");const Mi=Symbol("uid");const ji=Symbol("gid");const Fi=Symbol("checkedCwd");const Ui=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const Bi=Ui==="win32";const Hi=1024;const unlinkFile=(t,r)=>{if(!Bi){return E.unlink(t,r)}const i=t+".DELETE."+(0,$.randomBytes)(16).toString("hex");E.rename(t,i,(t=>{if(t){return r(t)}E.unlink(i,r)}))};const unlinkFileSync=t=>{if(!Bi){return E.unlinkSync(t)}const r=t+".DELETE."+(0,$.randomBytes)(16).toString("hex");E.renameSync(t,r);E.unlinkSync(r)};const uint32=(t,r,i)=>t!==undefined&&t===t>>>0?t:r!==undefined&&r===r>>>0?r:i;const cacheKeyNormalize=t=>stripTrailingSlashes(fr(normalizeUnicode(t))).toLowerCase();const pruneCache=(t,r)=>{r=cacheKeyNormalize(r);for(const i of t.keys()){const o=cacheKeyNormalize(i);if(o===r||o.indexOf(r+"/")===0){t.delete(i)}}};const dropCache=t=>{for(const r of t.keys()){t.delete(r)}};class Unpack extends Parser{[Ii]=false;[Fi]=false;[Ti]=0;reservations=new PathReservations;transform;writable=true;readable=false;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){t.ondone=()=>{this[Ii]=true;this[Ni]()};super(t);this.transform=t.transform;this.dirCache=t.dirCache||new Map;this.chmod=!!t.chmod;if(typeof t.uid==="number"||typeof t.gid==="number"){if(typeof t.uid!=="number"||typeof t.gid!=="number"){throw new TypeError("cannot set owner without number uid and gid")}if(t.preserveOwner){throw new TypeError("cannot preserve owner in archive and also set owner explicitly")}this.uid=t.uid;this.gid=t.gid;this.setOwner=true}else{this.uid=undefined;this.gid=undefined;this.setOwner=false}if(t.preserveOwner===undefined&&typeof t.uid!=="number"){this.preserveOwner=!!(process.getuid&&process.getuid()===0)}else{this.preserveOwner=!!t.preserveOwner}this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():undefined;this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():undefined;this.maxDepth=typeof t.maxDepth==="number"?t.maxDepth:Hi;this.forceChown=t.forceChown===true;this.win32=!!t.win32||Bi;this.newer=!!t.newer;this.keep=!!t.keep;this.noMtime=!!t.noMtime;this.preservePaths=!!t.preservePaths;this.unlink=!!t.unlink;this.cwd=fr(S.resolve(t.cwd||process.cwd()));this.strip=Number(t.strip)||0;this.processUmask=!this.chmod?0:typeof t.processUmask==="number"?t.processUmask:process.umask();this.umask=typeof t.umask==="number"?t.umask:this.processUmask;this.dmode=t.dmode||511&~this.umask;this.fmode=t.fmode||438&~this.umask;this.on("entry",(t=>this[mi](t)))}warn(t,r,i={}){if(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT"){i.recoverable=false}return super.warn(t,r,i)}[Ni](){if(this[Ii]&&this[Ti]===0){this.emit("prefinish");this.emit("finish");this.emit("end")}}[Oi](t){const r=fr(t.path);const i=r.split("/");if(this.strip){if(i.length<this.strip){return false}if(t.type==="Link"){const r=fr(String(t.linkpath)).split("/");if(r.length>=this.strip){t.linkpath=r.slice(this.strip).join("/")}else{return false}}i.splice(0,this.strip);t.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth){this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:r,depth:i.length,maxDepth:this.maxDepth});return false}if(!this.preservePaths){if(i.includes("..")||Bi&&/^[a-z]:\.\.$/i.test(i[0]??"")){this.warn("TAR_ENTRY_ERROR",`path contains '..'`,{entry:t,path:r});return false}const[o,a]=stripAbsolutePath(r);if(o){t.path=String(a);this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:t,path:r})}}if(S.isAbsolute(t.path)){t.absolute=fr(S.resolve(t.path))}else{t.absolute=fr(S.resolve(this.cwd,t.path))}if(!this.preservePaths&&typeof t.absolute==="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd){this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:fr(t.path),resolvedPath:t.absolute,cwd:this.cwd});return false}if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir"){return false}if(this.win32){const{root:r}=S.win32.parse(String(t.absolute));t.absolute=r+winchars_encode(String(t.absolute).slice(r.length));const{root:i}=S.win32.parse(t.path);t.path=i+winchars_encode(t.path.slice(i.length))}return true}[mi](t){if(!this[Oi](t)){return t.resume()}x.equal(typeof t.absolute,"string");switch(t.type){case"Directory":case"GNUDumpDir":if(t.mode){t.mode=t.mode|448}case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[gi](t);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[Ri](t)}}[Ai](t,r){if(t.name==="CwdError"){this.emit("error",t)}else{this.warn("TAR_ENTRY_ERROR",t,{entry:r});this[ki]();r.resume()}}[Pi](t,r,i){mkdir(fr(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r},i)}[Li](t){return this.forceChown||this.preserveOwner&&(typeof t.uid==="number"&&t.uid!==this.processUid||typeof t.gid==="number"&&t.gid!==this.processGid)||typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid}[Mi](t){return uint32(this.uid,t.uid,this.processUid)}[ji](t){return uint32(this.gid,t.gid,this.processGid)}[wi](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.fmode;const o=new WriteStream(String(t.absolute),{flags:Zs(t.size),mode:i,autoClose:false});o.on("error",(i=>{if(o.fd){E.close(o.fd,(()=>{}))}o.write=()=>true;this[Ai](i,t);r()}));let a=1;const done=i=>{if(i){if(o.fd){E.close(o.fd,(()=>{}))}this[Ai](i,t);r();return}if(--a===0){if(o.fd!==undefined){E.close(o.fd,(i=>{if(i){this[Ai](i,t)}else{this[ki]()}r()}))}}};o.on("finish",(()=>{const r=String(t.absolute);const i=o.fd;if(typeof i==="number"&&t.mtime&&!this.noMtime){a++;const o=t.atime||new Date;const c=t.mtime;E.futimes(i,o,c,(t=>t?E.utimes(r,o,c,(r=>done(r&&t))):done()))}if(typeof i==="number"&&this[Li](t)){a++;const o=this[Mi](t);const c=this[ji](t);if(typeof o==="number"&&typeof c==="number"){E.fchown(i,o,c,(t=>t?E.chown(r,o,c,(r=>done(r&&t))):done()))}}done()}));const c=this.transform?this.transform(t)||t:t;if(c!==t){c.on("error",(i=>{this[Ai](i,t);r()}));t.pipe(c)}c.pipe(o)}[Ei](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.dmode;this[Pi](String(t.absolute),i,(i=>{if(i){this[Ai](i,t);r();return}let o=1;const done=()=>{if(--o===0){r();this[ki]();t.resume()}};if(t.mtime&&!this.noMtime){o++;E.utimes(String(t.absolute),t.atime||new Date,t.mtime,done)}if(this[Li](t)){o++;E.chown(String(t.absolute),Number(this[Mi](t)),Number(this[ji](t)),done)}done()}))}[Ri](t){t.unsupported=true;this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t});t.resume()}[$i](t,r){this[Si](t,String(t.linkpath),"symlink",r)}[xi](t,r){const i=fr(S.resolve(this.cwd,String(t.linkpath)));this[Si](t,i,"link",r)}[Ci](){this[Ti]++}[ki](){this[Ti]--;this[Ni]()}[Di](t){this[ki]();t.resume()}[bi](t,r){return t.type==="File"&&!this.unlink&&r.isFile()&&r.nlink<=1&&!Bi}[gi](t){this[Ci]();const r=[t.path];if(t.linkpath){r.push(t.linkpath)}this.reservations.reserve(r,(r=>this[yi](t,r)))}[vi](t){if(t.type==="SymbolicLink"){dropCache(this.dirCache)}else if(t.type!=="Directory"){pruneCache(this.dirCache,String(t.absolute))}}[yi](t,r){this[vi](t);const done=i=>{this[vi](t);r(i)};const checkCwd=()=>{this[Pi](this.cwd,this.dmode,(r=>{if(r){this[Ai](r,t);done();return}this[Fi]=true;start()}))};const start=()=>{if(t.absolute!==this.cwd){const r=fr(S.dirname(String(t.absolute)));if(r!==this.cwd){return this[Pi](r,this.dmode,(r=>{if(r){this[Ai](r,t);done();return}afterMakeParent()}))}}afterMakeParent()};const afterMakeParent=()=>{E.lstat(String(t.absolute),((r,i)=>{if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime))){this[Di](t);done();return}if(r||this[bi](t,i)){return this[_i](null,t,done)}if(i.isDirectory()){if(t.type==="Directory"){const r=this.chmod&&t.mode&&(i.mode&4095)!==t.mode;const afterChmod=r=>this[_i](r??null,t,done);if(!r){return afterChmod()}return E.chmod(String(t.absolute),Number(t.mode),afterChmod)}if(t.absolute!==this.cwd){return E.rmdir(String(t.absolute),(r=>this[_i](r??null,t,done)))}}if(t.absolute===this.cwd){return this[_i](null,t,done)}unlinkFile(String(t.absolute),(r=>this[_i](r??null,t,done)))}))};if(this[Fi]){start()}else{checkCwd()}}[_i](t,r,i){if(t){this[Ai](t,r);i();return}switch(r.type){case"File":case"OldFile":case"ContiguousFile":return this[wi](r,i);case"Link":return this[xi](r,i);case"SymbolicLink":return this[$i](r,i);case"Directory":case"GNUDumpDir":return this[Ei](r,i)}}[Si](t,r,i,o){E[i](r,String(t.absolute),(r=>{if(r){this[Ai](r,t)}else{this[ki]();t.resume()}o()}))}}const callSync=t=>{try{return[null,t()]}catch(t){return[t,null]}};class UnpackSync extends Unpack{sync=true;[_i](t,r){return super[_i](t,r,(()=>{}))}[gi](t){this[vi](t);if(!this[Fi]){const r=this[Pi](this.cwd,this.dmode);if(r){return this[Ai](r,t)}this[Fi]=true}if(t.absolute!==this.cwd){const r=fr(S.dirname(String(t.absolute)));if(r!==this.cwd){const i=this[Pi](r,this.dmode);if(i){return this[Ai](i,t)}}}const[r,i]=callSync((()=>E.lstatSync(String(t.absolute))));if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime))){return this[Di](t)}if(r||this[bi](t,i)){return this[_i](null,t)}if(i.isDirectory()){if(t.type==="Directory"){const r=this.chmod&&t.mode&&(i.mode&4095)!==t.mode;const[o]=r?callSync((()=>{E.chmodSync(String(t.absolute),Number(t.mode))})):[];return this[_i](o,t)}const[r]=callSync((()=>E.rmdirSync(String(t.absolute))));this[_i](r,t)}const[o]=t.absolute===this.cwd?[]:callSync((()=>unlinkFileSync(String(t.absolute))));this[_i](o,t)}[wi](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.fmode;const oner=i=>{let a;try{E.closeSync(o)}catch(t){a=t}if(i||a){this[Ai](i||a,t)}r()};let o;try{o=E.openSync(String(t.absolute),Zs(t.size),i)}catch(t){return oner(t)}const a=this.transform?this.transform(t)||t:t;if(a!==t){a.on("error",(r=>this[Ai](r,t)));t.pipe(a)}a.on("data",(t=>{try{E.writeSync(o,t,0,t.length)}catch(t){oner(t)}}));a.on("end",(()=>{let r=null;if(t.mtime&&!this.noMtime){const i=t.atime||new Date;const a=t.mtime;try{E.futimesSync(o,i,a)}catch(o){try{E.utimesSync(String(t.absolute),i,a)}catch(t){r=o}}}if(this[Li](t)){const i=this[Mi](t);const a=this[ji](t);try{E.fchownSync(o,Number(i),Number(a))}catch(o){try{E.chownSync(String(t.absolute),Number(i),Number(a))}catch(t){r=r||o}}}oner(r)}))}[Ei](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.dmode;const o=this[Pi](String(t.absolute),i);if(o){this[Ai](o,t);r();return}if(t.mtime&&!this.noMtime){try{E.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch(o){}}if(this[Li](t)){try{E.chownSync(String(t.absolute),Number(this[Mi](t)),Number(this[ji](t)))}catch(o){}}r();t.resume()}[Pi](t,r){try{return mkdirSync(fr(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r})}catch(t){return t}}[Si](t,r,i,o){const a=`${i}Sync`;try{E[a](r,String(t.absolute));o();t.resume()}catch(r){return this[Ai](r,t)}}}const extractFileSync=t=>{const r=new UnpackSync(t);const i=t.file;const o=E.statSync(i);const a=t.maxReadSize||16*1024*1024;const c=new ReadStreamSync(i,{readSize:a,size:o.size});c.pipe(r)};const extractFile=(t,r)=>{const i=new Unpack(t);const o=t.maxReadSize||16*1024*1024;const a=t.file;const c=new Promise(((t,r)=>{i.on("error",r);i.on("close",t);E.stat(a,((t,c)=>{if(t){r(t)}else{const t=new ReadStream(a,{readSize:o,size:c.size});t.on("error",r);t.pipe(i)}}))}));return c};const Vi=makeCommand(extractFileSync,extractFile,(t=>new UnpackSync(t)),(t=>new Unpack(t)),((t,r)=>{if(r?.length)filesFilter(t,r)}));const replaceSync=(t,r)=>{const i=new PackSync(t);let o=true;let a;let c;try{try{a=E.openSync(t.file,"r+")}catch(r){if(r?.code==="ENOENT"){a=E.openSync(t.file,"w+")}else{throw r}}const l=E.fstatSync(a);const u=Buffer.alloc(512);e:for(c=0;c<l.size;c+=512){for(let t=0,r=0;t<512;t+=r){r=E.readSync(a,u,t,u.length-t,c+t);if(c===0&&u[0]===31&&u[1]===139){throw new Error("cannot append to compressed archives")}if(!r){break e}}const r=new Header(u);if(!r.cksumValid){break}const i=512*Math.ceil((r.size||0)/512);if(c+i+512>l.size){break}c+=i;if(t.mtimeCache&&r.mtime){t.mtimeCache.set(String(r.path),r.mtime)}}o=false;streamSync(t,i,c,a,r)}finally{if(o){try{E.closeSync(a)}catch(t){}}}};const streamSync=(t,r,i,o,a)=>{const c=new WriteStreamSync(t.file,{fd:o,start:i});r.pipe(c);replace_addFilesSync(r,a)};const replaceAsync=(t,r)=>{r=Array.from(r);const i=new Pack(t);const getPos=(r,i,o)=>{const cb=(t,i)=>{if(t){E.close(r,(r=>o(t)))}else{o(null,i)}};let a=0;if(i===0){return cb(null,0)}let c=0;const l=Buffer.alloc(512);const onread=(o,u)=>{if(o||typeof u==="undefined"){return cb(o)}c+=u;if(c<512&&u){return E.read(r,l,c,l.length-c,a+c,onread)}if(a===0&&l[0]===31&&l[1]===139){return cb(new Error("cannot append to compressed archives"))}if(c<512){return cb(null,a)}const h=new Header(l);if(!h.cksumValid){return cb(null,a)}const d=512*Math.ceil((h.size??0)/512);if(a+d+512>i){return cb(null,a)}a+=d+512;if(a>=i){return cb(null,a)}if(t.mtimeCache&&h.mtime){t.mtimeCache.set(String(h.path),h.mtime)}c=0;E.read(r,l,0,512,a,onread)};E.read(r,l,0,512,a,onread)};const o=new Promise(((o,a)=>{i.on("error",a);let c="r+";const onopen=(l,u)=>{if(l&&l.code==="ENOENT"&&c==="r+"){c="w+";return E.open(t.file,c,onopen)}if(l||!u){return a(l)}E.fstat(u,((c,l)=>{if(c){return E.close(u,(()=>a(c)))}getPos(u,l.size,((c,l)=>{if(c){return a(c)}const h=new WriteStream(t.file,{fd:u,start:l});i.pipe(h);h.on("error",a);h.on("close",o);replace_addFilesAsync(i,r)}))}))};E.open(t.file,c,onopen)}));return o};const replace_addFilesSync=(t,r)=>{r.forEach((r=>{if(r.charAt(0)==="@"){qr({file:S.resolve(t.cwd,r.slice(1)),sync:true,noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(r)}}));t.end()};const replace_addFilesAsync=async(t,r)=>{for(let i=0;i<r.length;i++){const o=String(r[i]);if(o.charAt(0)==="@"){await qr({file:S.resolve(String(t.cwd),o.slice(1)),noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(o)}}t.end()};const zi=makeCommand(replaceSync,replaceAsync,(()=>{throw new TypeError("file is required")}),(()=>{throw new TypeError("file is required")}),((t,r)=>{if(!isFile(t)){throw new TypeError("file is required")}if(t.gzip||t.brotli||t.file.endsWith(".br")||t.file.endsWith(".tbr")){throw new TypeError("cannot append to compressed archives")}if(!r?.length){throw new TypeError("no paths specified to add/replace")}}));const Gi=makeCommand(zi.syncFile,zi.asyncFile,zi.syncNoFile,zi.asyncNoFile,((t,r=[])=>{zi.validate?.(t,r);mtimeFilter(t)}));const mtimeFilter=t=>{const r=t.filter;if(!t.mtimeCache){t.mtimeCache=new Map}t.filter=r?(i,o)=>r(i,o)&&!((t.mtimeCache?.get(i)??o.mtime??0)>(o.mtime??0)):(r,i)=>!((t.mtimeCache?.get(r)??i.mtime??0)>(i.mtime??0))};async function isUrlOk(t){try{const r=await fetch(t,{method:"HEAD"});return r.status===200}catch{return false}}async function getRepoInfo(t,r){const[,i,o,a,c,...l]=t.pathname.split("/");const u=r?r.replace(/^\//,""):l.join("/");if(a===undefined||a===""&&c===undefined){try{const t=await fetch(`https://api.github.com/repos/${i}/${o}`);if(t.status!==200){return}const r=await t.json();return{username:i,name:o,branch:r["default_branch"],filePath:u}}catch{return}}const h=r?`${c}/${l.join("/")}`.replace(new RegExp(`/${u}|/$`),""):c;if(i&&o&&h&&a==="tree"){return{username:i,name:o,branch:h,filePath:u}}}function hasRepo({username:t,name:r,branch:i,filePath:o}){const a=`https://api.github.com/repos/${t}/${r}/contents`;const c=`${o?`/${o}`:""}/package.json`;return isUrlOk(a+c+`?ref=${i}`)}function existsInRepo(t){try{const r=new URL(t);return isUrlOk(r.href)}catch{return isUrlOk(`https://api.github.com/repos/vercel/next.js/contents/examples/${encodeURIComponent(t)}`)}}async function downloadTarStream(t){const r=await fetch(t);if(!r.body){throw new Error(`Failed to download: ${t}`)}return De.Readable.fromWeb(r.body)}async function downloadAndExtractRepo(t,{username:r,name:i,branch:o,filePath:a}){let c=null;await(0,Le.pipeline)(await downloadTarStream(`https://codeload.github.com/${r}/${i}/tar.gz/${o}`),Vi({cwd:t,strip:a?a.split("/").length+1:1,filter:t=>{const r=t.split(S.sep).join(S.posix.sep);if(c===null){const t=r.split(S.posix.sep);c=t.length?t[0]:null}return r.startsWith(`${c}${a?`/${a}/`:"/"}`)}}))}async function downloadAndExtractExample(t,r){if(r==="__internal-testing-retry"){throw new Error("This is an internal example for testing the CLI.")}await(0,Le.pipeline)(await downloadTarStream("https://codeload.github.com/vercel/next.js/tar.gz/canary"),Vi({cwd:t,strip:2+r.split("/").length,filter:t=>t.includes(`next.js-canary/examples/${r}/`)}))}var qi=__nccwpck_require__(7718);function isInGitRepository(){try{(0,qi.execSync)("git rev-parse --is-inside-work-tree",{stdio:"ignore"});return true}catch(t){}return false}function isInMercurialRepository(){try{(0,qi.execSync)("hg --cwd . root",{stdio:"ignore"});return true}catch(t){}return false}function isDefaultBranchSet(){try{(0,qi.execSync)("git config init.defaultBranch",{stdio:"ignore"});return true}catch(t){}return false}function tryGitInit(t){let r=false;try{(0,qi.execSync)("git --version",{stdio:"ignore"});if(isInGitRepository()||isInMercurialRepository()){return false}(0,qi.execSync)("git init",{stdio:"ignore"});r=true;if(!isDefaultBranchSet()){(0,qi.execSync)("git checkout -b main",{stdio:"ignore"})}(0,qi.execSync)("git add -A",{stdio:"ignore"});(0,qi.execSync)('git commit -m "Initial commit from Create Next App"',{stdio:"ignore"});return true}catch(i){if(r){try{(0,E.rmSync)((0,S.join)(t,".git"),{recursive:true,force:true})}catch(t){}}return false}}var Wi=__nccwpck_require__(1405);var Ki=__nccwpck_require__.n(Wi);async function install(t,r){const i=["install"];if(!r){console.log((0,Pe.yellow)("You appear to be offline.\nFalling back to the local cache."));i.push("--offline")}return new Promise(((r,o)=>{const a=Ki()(t,i,{stdio:"inherit",env:{...process.env,ADBLOCK:"1",NODE_ENV:"development",DISABLE_OPENCOLLECTIVE:"1"}});a.on("close",(a=>{if(a!==0){o({command:`${t} ${i.join(" ")}`});return}r()}))}))}function isFolderEmpty(t,r){const i=[".DS_Store",".git",".gitattributes",".gitignore",".gitlab-ci.yml",".hg",".hgcheck",".hgignore",".idea",".npmignore",".travis.yml","LICENSE","Thumbs.db","docs","mkdocs.yml","npm-debug.log","yarn-debug.log","yarn-error.log","yarnrc.yml",".yarn"];const o=(0,E.readdirSync)(t).filter((t=>!i.includes(t)&&!/\.iml$/.test(t)));if(o.length>0){console.log(`The directory ${(0,Pe.green)(r)} contains files that could conflict:`);console.log();for(const r of o){try{const i=(0,E.lstatSync)((0,S.join)(t,r));if(i.isDirectory()){console.log(` ${(0,Pe.blue)(r)}/`)}else{console.log(` ${r}`)}}catch{console.log(` ${r}`)}}console.log();console.log("Either try using a new directory name, or remove the files listed above.");console.log();return false}return true}const Yi=require("node:dns/promises");const Zi=require("node:url");function getProxy(){if(process.env.https_proxy){return process.env.https_proxy}try{const t=(0,qi.execSync)("npm config get https-proxy").toString().trim();return t!=="null"?t:undefined}catch(t){return}}async function getOnline(){try{await(0,Yi.lookup)("registry.yarnpkg.com");return true}catch{const t=getProxy();if(!t){return false}let r;try{r=new Zi.URL(t)}catch{return false}const{hostname:i}=r;if(!i){return false}try{await(0,Yi.lookup)(i);return true}catch{return false}}}const Xi=require("node:constants");const Ji=require("node:fs/promises");async function isWriteable(t){try{await(0,Ji.access)(t,Xi.W_OK);return true}catch(t){return false}}async function runTypegen(t){return new Promise(((r,i)=>{let o;let a;switch(t){case"npm":o="npm";a=["exec","next","--","typegen"];break;case"yarn":o="yarn";a=["exec","next","--","typegen"];break;case"pnpm":o="pnpm";a=["exec","next","--","typegen"];break;case"bun":o="bun";a=["next","typegen"];break;default:t;throw new Error(`Unsupported package manager: ${t}`)}const c=Ki()(o,a,{stdio:"inherit",env:{...process.env}});c.on("close",(t=>{if(t!==0){i(new Error(`next typegen exited with code ${t}`));return}r()}))}))}var Qi=__nccwpck_require__(9453);const identity=t=>t;const copy=async(t,r,{cwd:i,rename:o=identity,parents:a=true}={})=>{const c=typeof t==="string"?[t]:t;if(c.length===0||!r){throw new TypeError("`src` and `dest` are required")}const l=await(0,Qi.async)(c,{cwd:i,dot:true,absolute:false,stats:false});const u=i?(0,S.resolve)(i,r):r;return Promise.all(l.map((async t=>{const r=(0,S.dirname)(t);const c=o((0,S.basename)(t));const l=i?(0,S.resolve)(i,t):t;const h=a?(0,S.join)(u,r,c):(0,S.join)(u,c);await(0,Ji.mkdir)((0,S.dirname)(h),{recursive:true});return(0,Ji.copyFile)(l,h)})))};var en=__nccwpck_require__(2037);var tn=__nccwpck_require__.n(en);const rn=require("fs/promises");var sn=__nccwpck_require__.n(rn);var nn=__nccwpck_require__(833);const on=JSON.parse('{"name":"create-next-app","version":"16.1.1-canary.15","keywords":["react","next","next.js"],"description":"Create Next.js-powered React apps with one command","repository":{"type":"git","url":"https://github.com/vercel/next.js","directory":"packages/create-next-app"},"author":"Next.js Team <support@vercel.com>","license":"MIT","bin":{"create-next-app":"./dist/index.js"},"files":["dist"],"scripts":{"dev":"ncc build ./index.ts -w -o dist/","prebuild":"node ../../scripts/rm.mjs dist","build":"ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register","prepublishOnly":"cd ../../ && turbo run build","lint-fix":"pnpm prettier -w --plugin prettier-plugin-tailwindcss \'templates/*-tw/{ts,js}/{app,pages}/**/*.{js,ts,tsx}\'"},"devDependencies":{"@types/async-retry":"1.4.2","@types/cross-spawn":"6.0.0","@types/node":"20.14.2","@types/prompts":"2.4.2","@types/tar":"6.1.13","@types/validate-npm-package-name":"4.0.2","@vercel/ncc":"0.38.1","async-retry":"1.3.1","ci-info":"4.0.0","commander":"12.1.0","conf":"13.0.1","cross-spawn":"7.0.3","fast-glob":"3.3.1","picocolors":"1.0.0","prettier-plugin-tailwindcss":"0.6.2","prompts":"2.4.2","tar":"7.4.3","update-check":"1.5.4","validate-npm-package-name":"5.0.1"},"engines":{"node":">=20.9.0"}}');var an;(function(t){t["Turbopack"]="turbopack";t["Webpack"]="webpack";t["Rspack"]="rspack"})(an||(an={}));const cn="19.2.3";function sorted(t){return Object.keys(t).sort().reduce(((r,i)=>{r[i]=t[i];return r}),{})}const getTemplateFile=({template:t,mode:r,file:i})=>__nccwpck_require__.ab+"templates/"+t+"/"+r+"/"+i;const ln=["app","pages","styles"];const installTemplate=async({appName:t,root:r,packageManager:i,isOnline:o,template:a,mode:c,tailwind:l,eslint:u,biome:h,srcDir:d,importAlias:p,skipInstall:m,bundler:g,reactCompiler:y})=>{var v;console.log((0,Pe.bold)(`Using ${i}.`));console.log("\nInitializing project with template:",a,"\n");const b=a==="app-api";const w=__nccwpck_require__.ab+"templates/"+a+"/"+c;const E=["**"];if(!u)E.push("!eslint.config.mjs");if(!h)E.push("!biome.json");if(!l)E.push("!postcss.config.mjs");await copy(E,r,{parents:true,cwd:w,rename(t){switch(t){case"gitignore":{return`.${t}`}case"README-template.md":{return"README.md"}default:{return t}}}});if(g===an.Rspack){const t=Xt().join(r,c==="js"?"next.config.mjs":"next.config.ts");await sn().writeFile(t,`import withRspack from "next-rspack";\n\n`+(await sn().readFile(t,"utf8")).replace("export default nextConfig;","export default withRspack(nextConfig);"))}if(y){const t=Xt().join(r,c==="js"?"next.config.mjs":"next.config.ts");let i=await sn().readFile(t,"utf8");i=i.replace("/* config options here */\n","/* config options here */\n reactCompiler: true,\n");await sn().writeFile(t,i)}const S=Xt().join(r,c==="js"?"jsconfig.json":"tsconfig.json");await sn().writeFile(S,(await sn().readFile(S,"utf8")).replace(`"@/*": ["./*"]`,d?`"@/*": ["./src/*"]`:`"@/*": ["./*"]`).replace(`"@/*":`,`"${p}":`));if(p!=="@/*"){const t=await(0,Qi.async)("**/*",{cwd:r,dot:true,stats:false,ignore:["tsconfig.json","jsconfig.json",".git/**/*","**/fonts/**","**/favicon.ico"]});const i=new nn.Sema(8,{capacity:t.length});await Promise.all(t.map((async t=>{await i.acquire();const o=Xt().join(r,t);if((await sn().stat(o)).isFile()){await sn().writeFile(o,(await sn().readFile(o,"utf8")).replace(`@/`,`${p.replace(/\*/g,"")}`))}i.release()})))}if(d){await sn().mkdir(Xt().join(r,"src"),{recursive:true});await Promise.all(ln.map((async t=>{await sn().rename(Xt().join(r,t),Xt().join(r,"src",t)).catch((t=>{if(t.code!=="ENOENT"){throw t}}))})));if(!b){const t=a.startsWith("app");const r=Xt().join("src",t?"app":"pages",`${t?"page":"index"}.${c==="ts"?"tsx":"js"}`);await sn().writeFile(r,(await sn().readFile(r,"utf8")).replace(t?"app/page":"pages/index",t?"src/app/page":"src/pages/index"))}}const $=(v=process.env.NEXT_PRIVATE_TEST_VERSION)!==null&&v!==void 0?v:on.version;const x=g===an.Webpack?" --webpack":"";const R={name:t,version:"0.1.0",private:true,scripts:{dev:`next dev${x}`,build:`next build${x}`,start:"next start",...u&&{lint:"eslint"},...h&&{lint:"biome check",format:"biome format --write"}},dependencies:{react:cn,"react-dom":cn,next:$},devDependencies:{}};if(g===an.Rspack){const t=process.env.NEXT_PRIVATE_TEST_VERSION;if(t&&Xt().isAbsolute(t)){R.dependencies["next-rspack"]=Xt().resolve(Xt().dirname(t),"../next-rspack/next-rspack-packed.tgz")}else{R.dependencies["next-rspack"]=$}}if(y){R.devDependencies["babel-plugin-react-compiler"]="1.0.0"}if(c==="ts"){R.devDependencies={...R.devDependencies,typescript:"^5","@types/node":"^20","@types/react":"^19","@types/react-dom":"^19"}}if(l){R.devDependencies={...R.devDependencies,"@tailwindcss/postcss":"^4",tailwindcss:"^4"}}if(u){R.devDependencies={...R.devDependencies,eslint:"^9","eslint-config-next":$}}if(h){R.devDependencies={...R.devDependencies,"@biomejs/biome":"2.2.0"}}if(b){delete R.dependencies.react;delete R.dependencies["react-dom"];delete R.devDependencies["@types/react-dom"];delete R.scripts.lint;delete R.scripts.format}const O=Object.keys(R.devDependencies).length;if(!O)delete R.devDependencies;if(R.dependencies){R.dependencies=sorted(R.dependencies)}if(R.devDependencies){R.devDependencies=sorted(R.devDependencies)}if(i==="pnpm"){const t=["packages:"," - .","ignoredBuiltDependencies:"," - sharp"," - unrs-resolver",""].join(tn().EOL);await sn().writeFile(Xt().join(r,"pnpm-workspace.yaml"),t)}if(i==="bun"){R.ignoreScripts=["sharp","unrs-resolver"];R.trustedDependencies=["sharp","unrs-resolver"]}await sn().writeFile(Xt().join(r,"package.json"),JSON.stringify(R,null,2)+tn().EOL);if(m)return;console.log("\nInstalling dependencies:");for(const t in R.dependencies)console.log(`- ${(0,Pe.cyan)(t)}`);if(O){console.log("\nInstalling devDependencies:");for(const t in R.devDependencies)console.log(`- ${(0,Pe.cyan)(t)}`)}console.log();await install(i,o);try{console.log();await runTypegen(i);console.log()}catch(t){console.error("Error running typegen:",t)}};class DownloadError extends Error{}async function createApp({appPath:t,packageManager:r,example:i,examplePath:o,typescript:a,tailwind:c,eslint:l,biome:u,app:h,srcDir:d,importAlias:p,skipInstall:m,empty:g,api:y,bundler:v,disableGit:b,reactCompiler:w}){let $;const x=a?"ts":"js";const R=`${h?"app":"default"}${c?"-tw":""}${g?"-empty":""}`;if(i){let D;try{D=new URL(i)}catch(L){const M=L;if(!(M instanceof TypeError)){console.error(L);process.exit(1)}}if(D){if(D.origin!=="https://github.com"){console.error(`Invalid URL: ${(0,Pe.red)(`"${i}"`)}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`);process.exit(1)}$=await getRepoInfo(D,o);if(!$){console.error(`Found invalid GitHub URL: ${(0,Pe.red)(`"${i}"`)}. Please fix the URL and try again.`);process.exit(1)}const j=await hasRepo($);if(!j){console.error(`Could not locate the repository for ${(0,Pe.red)(`"${i}"`)}. Please check that the repository exists and try again.`);process.exit(1)}}else if(i!=="__internal-testing-retry"){const U=await existsInRepo(i);if(!U){console.error(`Could not locate an example named ${(0,Pe.red)(`"${i}"`)}. It could be due to the following:\n`,`1. Your spelling of example ${(0,Pe.red)(`"${i}"`)} might be incorrect.\n`,`2. You might not be connected to the internet or you are behind a proxy.`);process.exit(1)}}}const O=(0,S.resolve)(t);if(!await isWriteable((0,S.dirname)(O))){console.error("The application path is not writable, please check folder permissions and try again.");console.error("It is likely you do not have write permissions for this folder.");process.exit(1)}const P=(0,S.basename)(O);(0,E.mkdirSync)(O,{recursive:true});if(!isFolderEmpty(O,P)){process.exit(1)}const A=r==="yarn";const T=!A||await getOnline();const C=process.cwd();console.log(`Creating a new Next.js app in ${(0,Pe.green)(O)}.`);console.log();process.chdir(O);const k=(0,S.join)(O,"package.json");let I=false;if(i){try{if($){const V=$;console.log(`Downloading files from repo ${(0,Pe.cyan)(i)}. This might take a moment.`);console.log();await Ne()((()=>downloadAndExtractRepo(O,V)),{retries:3})}else{console.log(`Downloading files for example ${(0,Pe.cyan)(i)}. This might take a moment.`);console.log();await Ne()((()=>downloadAndExtractExample(O,i)),{retries:3})}}catch(z){function isErrorLike(t){return typeof t==="object"&&t!==null&&typeof t.message==="string"}throw new DownloadError(isErrorLike(z)?z.message:z+"")}const B=(0,S.join)(O,".gitignore");if(!(0,E.existsSync)(B)){(0,E.copyFileSync)(getTemplateFile({template:R,mode:x,file:"gitignore"}),B)}const H=(0,S.join)(O,"tsconfig.json");if((0,E.existsSync)(H)){(0,E.copyFileSync)(getTemplateFile({template:R,mode:"ts",file:"next-env.d.ts"}),(0,S.join)(O,"next-env.d.ts"))}I=(0,E.existsSync)(k);if(!m&&I){console.log("Installing packages. This might take a couple of minutes.");console.log();await install(r,T);console.log();try{console.log();await runTypegen(r);console.log()}catch(G){console.error("Error running typegen:",G)}}}else{await installTemplate({appName:P,root:O,template:y?"app-api":R,mode:x,packageManager:r,isOnline:T,tailwind:c,eslint:l,biome:u,srcDir:d,importAlias:p,skipInstall:m,bundler:v,reactCompiler:w})}if(b){console.log("Skipping git initialization.");console.log()}else if(tryGitInit(O)){console.log("Initialized a git repository.");console.log()}let N;if((0,S.join)(C,P)===t){N=P}else{N=t}console.log(`${(0,Pe.green)("Success!")} Created ${P} at ${t}`);if(I){console.log("Inside that directory, you can run several commands:");console.log();console.log((0,Pe.cyan)(` ${r} ${A?"":"run "}dev`));console.log(" Starts the development server.");console.log();console.log((0,Pe.cyan)(` ${r} ${A?"":"run "}build`));console.log(" Builds the app for production.");console.log();console.log((0,Pe.cyan)(` ${r} start`));console.log(" Runs the built app in production mode.");console.log();console.log("We suggest that you begin by typing:");console.log();console.log((0,Pe.cyan)(" cd"),N);console.log(` ${(0,Pe.cyan)(`${r} ${A?"":"run "}dev`)}`)}console.log()}function getPkgManager(){const t=process.env.npm_config_user_agent||"";if(t.startsWith("yarn")){return"yarn"}if(t.startsWith("pnpm")){return"pnpm"}if(t.startsWith("bun")){return"bun"}return"npm"}var un=__nccwpck_require__(6982);var hn=__nccwpck_require__.n(un);function validateNpmName(t){const r=hn()(t);if(r.validForNewPackages){return{valid:true}}return{valid:false,problems:[...r.errors||[],...r.warnings||[]]}}let dn="";const handleSigTerm=()=>process.exit(0);process.on("SIGINT",handleSigTerm);process.on("SIGTERM",handleSigTerm);const onPromptState=t=>{if(t.aborted){process.stdout.write("[?25h");process.stdout.write("\n");process.exit(1)}};const fn=new m(on.name).version(on.version,"-v, --version","Output the current version of create-next-app.").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","Display this help message.").option("--ts, --typescript","Initialize as a TypeScript project. (default)").option("--js, --javascript","Initialize as a JavaScript project.").option("--tailwind","Initialize with Tailwind CSS config. (default)").option("--react-compiler","Initialize with React Compiler enabled.").option("--eslint","Initialize with ESLint config.").option("--biome","Initialize with Biome config.").option("--app","Initialize as an App Router project.").option("--src-dir","Initialize inside a 'src/' directory.").option("--turbopack","Enable Turbopack as the bundler.").option("--webpack","Enable Webpack as the bundler.").option("--rspack","Enable Rspack as the bundler.").option("--import-alias <prefix/*>",'Specify import alias to use (default "@/*").').option("--api","Initialize a headless API using the App Router.").option("--empty","Initialize an empty project.").option("--use-npm","Explicitly tell the CLI to bootstrap the application using npm.").option("--use-pnpm","Explicitly tell the CLI to bootstrap the application using pnpm.").option("--use-yarn","Explicitly tell the CLI to bootstrap the application using Yarn.").option("--use-bun","Explicitly tell the CLI to bootstrap the application using Bun.").option("--reset, --reset-preferences","Reset the preferences saved for create-next-app.").option("--skip-install","Explicitly tell the CLI to skip installing packages.").option("--yes","Use saved preferences or defaults for unprovided options.").option("-e, --example <example-name|github-url>",`\n\n An example to bootstrap the app with. You can use an example name\n from the official Next.js repo or a public GitHub URL. The URL can use\n any branch and/or subdirectory.\n`).option("--example-path <path-to-example>",`\n\n In a rare case, your GitHub URL might contain a branch name with\n a slash (e.g. bug/fix-1) and the path to the example (e.g. foo/bar).\n In this case, you must specify the path to the example separately:\n --example-path foo/bar\n`).option("--disable-git",`Skip initializing a git repository.`).action((t=>{if(t&&!t.startsWith("--no-")){dn=t}})).allowUnknownOption().parse(process.argv);const pn=fn.opts();const{args:mn}=fn;const gn=!!pn.useNpm?"npm":!!pn.usePnpm?"pnpm":!!pn.useYarn?"yarn":!!pn.useBun?"bun":getPkgManager();async function run(){const t=new Conf({projectName:"create-next-app"});if(pn.resetPreferences){const{resetPreferences:r}=await Te()({onState:onPromptState,type:"toggle",name:"resetPreferences",message:"Would you like to reset the saved preferences?",initial:false,active:"Yes",inactive:"No"});if(r){t.clear();console.log("The preferences have been reset successfully!")}process.exit(0)}if(typeof dn==="string"){dn=dn.trim()}if(!dn){const t=await Te()({onState:onPromptState,type:"text",name:"path",message:"What is your project named?",initial:"my-app",validate:t=>{const r=validateNpmName((0,S.basename)((0,S.resolve)(t)));if(r.valid){return true}return"Invalid project name: "+r.problems[0]}});if(typeof t.path==="string"){dn=t.path.trim()}}if(!dn){console.log("\nPlease specify the project directory:\n"+` ${(0,Pe.cyan)(pn.name())} ${(0,Pe.green)("<project-directory>")}\n`+"For example:\n"+` ${(0,Pe.cyan)(pn.name())} ${(0,Pe.green)("my-next-app")}\n\n`+`Run ${(0,Pe.cyan)(`${pn.name()} --help`)} to see all options.`);process.exit(1)}const i=(0,S.resolve)(dn);const o=(0,S.basename)(i);const a=validateNpmName(o);if(!a.valid){console.error(`Could not create a project called ${(0,Pe.red)(`"${o}"`)} because of npm naming restrictions:`);a.problems.forEach((t=>console.error(` ${(0,Pe.red)((0,Pe.bold)("*"))} ${t}`)));process.exit(1)}if(pn.example===true){console.error("Please provide an example name or url, otherwise remove the example option.");process.exit(1)}if((0,E.existsSync)(i)&&!isFolderEmpty(i,o)){process.exit(1)}const c=typeof pn.example==="string"&&pn.example.trim();const l=t.get("preferences")||{};let u=r().isCI||pn.yes;let h=false;if(!c){const t={typescript:true,eslint:false,linter:"eslint",tailwind:true,app:true,srcDir:false,importAlias:"@/*",customizeImportAlias:false,empty:false,disableGit:false,reactCompiler:false};const r=[{key:"typescript",values:{true:"TypeScript",false:"JavaScript"}},{key:"linter",values:{eslint:"ESLint",biome:"Biome"}},{key:"reactCompiler",values:{true:"React Compiler"}},{key:"tailwind",values:{true:"Tailwind CSS"}},{key:"srcDir",values:{true:"src/ dir"}},{key:"app",values:{true:"App Router",false:"Pages Router"}}];const formatSettingsDescription=t=>{const i=[];for(const o of r){const r=t[o.key];if(o.values){const t=o.values[String(r)];if(t){i.push(t)}}}return i.join(", ")};const i=Object.keys(l).length>0;const o=process.argv.some((t=>t.startsWith("--")));if(!u&&!o){const r=[{title:"Yes, use recommended defaults",value:"recommended",description:formatSettingsDescription(t)},{title:"No, customize settings",value:"customize",description:"Choose your own preferences"}];if(i){const t=formatSettingsDescription(l);r.splice(1,0,{title:"No, reuse previous settings",value:"reuse",description:t})}const{setupChoice:o}=await Te()({type:"select",name:"setupChoice",message:"Would you like to use the recommended Next.js defaults?",choices:r,initial:0},{onCancel:()=>{console.error("Exiting.");process.exit(1)}});if(o==="recommended"){h=true;u=true}else if(o==="reuse"){u=true}}if(h){Object.assign(l,t)}const getPrefOrDefault=r=>{var i;if(h){return t[r]}return(i=l[r])!==null&&i!==void 0?i:t[r]};if(!pn.typescript&&!pn.javascript){if(u){pn.typescript=getPrefOrDefault("typescript")}else{const t=(0,Pe.blue)("TypeScript");const{typescript:r}=await Te()({type:"toggle",name:"typescript",message:`Would you like to use ${t}?`,initial:getPrefOrDefault("typescript"),active:"Yes",inactive:"No"},{onCancel:()=>{console.error("Exiting.");process.exit(1)}});pn.typescript=Boolean(r);pn.javascript=!r;l.typescript=Boolean(r)}}const a=mn.includes("--no-linter")||mn.includes("--no-eslint");if(!pn.eslint&&!pn.biome&&!a&&!pn.api){if(u){const t=getPrefOrDefault("linter");pn.eslint=t==="eslint";pn.biome=t==="biome"}else{const t={eslint:0,biome:1,none:2};const{linter:r}=await Te()({onState:onPromptState,type:"select",name:"linter",message:"Which linter would you like to use?",choices:[{title:"ESLint",value:"eslint",description:"More comprehensive lint rules"},{title:"Biome",value:"biome",description:"Fast formatter and linter (fewer rules)"},{title:"None",value:"none",description:"Skip linter configuration"}],initial:t[getPrefOrDefault("linter")]});pn.eslint=r==="eslint";pn.biome=r==="biome";l.linter=r;l.eslint=r==="eslint"}}else if(pn.eslint){pn.biome=false;l.linter="eslint";l.eslint=true}else if(pn.biome){pn.eslint=false;l.linter="biome";l.eslint=false}else if(a){pn.eslint=false;pn.biome=false;l.linter="none";l.eslint=false}if(!pn.reactCompiler&&!mn.includes("--no-react-compiler")&&!pn.api){if(u){pn.reactCompiler=getPrefOrDefault("reactCompiler")}else{const t=(0,Pe.blue)("React Compiler");const{reactCompiler:r}=await Te()({onState:onPromptState,type:"toggle",name:"reactCompiler",message:`Would you like to use ${t}?`,initial:getPrefOrDefault("reactCompiler"),active:"Yes",inactive:"No"});pn.reactCompiler=Boolean(r);l.reactCompiler=Boolean(r)}}if(!pn.tailwind&&!mn.includes("--no-tailwind")&&!pn.api){if(u){pn.tailwind=getPrefOrDefault("tailwind")}else{const t=(0,Pe.blue)("Tailwind CSS");const{tailwind:r}=await Te()({onState:onPromptState,type:"toggle",name:"tailwind",message:`Would you like to use ${t}?`,initial:getPrefOrDefault("tailwind"),active:"Yes",inactive:"No"});pn.tailwind=Boolean(r);l.tailwind=Boolean(r)}}if(!pn.srcDir&&!mn.includes("--no-src-dir")){if(u){pn.srcDir=getPrefOrDefault("srcDir")}else{const t=(0,Pe.blue)("`src/` directory");const{srcDir:r}=await Te()({onState:onPromptState,type:"toggle",name:"srcDir",message:`Would you like your code inside a ${t}?`,initial:getPrefOrDefault("srcDir"),active:"Yes",inactive:"No"});pn.srcDir=Boolean(r);l.srcDir=Boolean(r)}}if(!pn.app&&!mn.includes("--no-app")&&!pn.api){if(u){pn.app=getPrefOrDefault("app")}else{const t=(0,Pe.blue)("App Router");const{app:r}=await Te()({onState:onPromptState,type:"toggle",name:"app",message:`Would you like to use ${t}? (recommended)`,initial:getPrefOrDefault("app"),active:"Yes",inactive:"No"});pn.app=Boolean(r);l.app=Boolean(r)}}const c=/^[^*"]+\/\*\s*$/;if(typeof pn.importAlias!=="string"||!c.test(pn.importAlias)){if(u){pn.importAlias=t.importAlias}else if(mn.includes("--no-import-alias")){pn.importAlias=t.importAlias}else{const r=(0,Pe.blue)("import alias");const{customizeImportAlias:i}=await Te()({onState:onPromptState,type:"toggle",name:"customizeImportAlias",message:`Would you like to customize the ${r} (\`${t.importAlias}\` by default)?`,initial:getPrefOrDefault("customizeImportAlias"),active:"Yes",inactive:"No"});if(!i){pn.importAlias=t.importAlias}else{const{importAlias:t}=await Te()({onState:onPromptState,type:"text",name:"importAlias",message:`What ${r} would you like configured?`,initial:getPrefOrDefault("importAlias"),validate:t=>c.test(t)?true:"Import alias must follow the pattern <prefix>/*"});pn.importAlias=t;l.importAlias=t}}}}const d=pn.turbopack?an.Turbopack:pn.webpack?an.Webpack:pn.rspack?an.Rspack:an.Turbopack;try{await createApp({appPath:i,packageManager:gn,example:c&&c!=="default"?c:undefined,examplePath:pn.examplePath,typescript:pn.typescript,tailwind:pn.tailwind,eslint:pn.eslint,biome:pn.biome,app:pn.app,srcDir:pn.srcDir,importAlias:pn.importAlias,skipInstall:pn.skipInstall,empty:pn.empty,api:pn.api,bundler:d,disableGit:pn.disableGit,reactCompiler:pn.reactCompiler})}catch(t){if(!(t instanceof DownloadError)){throw t}const r=await Te()({onState:onPromptState,type:"confirm",name:"builtin",message:`Could not download "${c}" because of a connectivity issue between your machine and GitHub.\n`+`Do you want to use the default template instead?`,initial:true});if(!r.builtin){throw t}await createApp({appPath:i,packageManager:gn,typescript:pn.typescript,eslint:pn.eslint,biome:pn.biome,tailwind:pn.tailwind,app:pn.app,srcDir:pn.srcDir,importAlias:pn.importAlias,skipInstall:pn.skipInstall,empty:pn.empty,bundler:d,disableGit:pn.disableGit,reactCompiler:pn.reactCompiler})}t.set("preferences",l)}const yn=ke()(on).catch((()=>null));async function notifyUpdate(){var t;try{if((t=await yn)===null||t===void 0?void 0:t.latest){const t={npm:"npm i -g",yarn:"yarn global add",pnpm:"pnpm add -g",bun:"bun add -g"};const r=`${t[gn]} create-next-app`;console.log((0,Pe.yellow)((0,Pe.bold)("A new version of `create-next-app` is available!"))+"\n"+"You can update by running: "+(0,Pe.cyan)(r)+"\n")}process.exit(0)}catch{}}async function exit(t){console.log();console.log("Aborting installation.");if(t.command){console.log(` ${(0,Pe.cyan)(t.command)} has failed.`)}else{console.log((0,Pe.red)("Unexpected error. Please report it as a bug:")+"\n",t)}console.log();await notifyUpdate();process.exit(1)}run().then(notifyUpdate).catch(exit)})();module.exports=i})();
|
|
74
|
+
(function(t,i){true?i(r):0})(this,(function(t){"use strict";function merge(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++){r[i]=arguments[i]}if(r.length>1){r[0]=r[0].slice(0,-1);var o=r.length-1;for(var a=1;a<o;++a){r[a]=r[a].slice(1,-1)}r[o]=r[o].slice(1);return r.join("")}else{return r[0]}}function subexp(t){return"(?:"+t+")"}function typeOf(t){return t===undefined?"undefined":t===null?"null":Object.prototype.toString.call(t).split(" ").pop().split("]").shift().toLowerCase()}function toUpperCase(t){return t.toUpperCase()}function toArray(t){return t!==undefined&&t!==null?t instanceof Array?t:typeof t.length!=="number"||t.split||t.setInterval||t.call?[t]:Array.prototype.slice.call(t):[]}function assign(t,r){var i=t;if(r){for(var o in r){i[o]=r[o]}}return i}function buildExps(t){var r="[A-Za-z]",i="[\\x0D]",o="[0-9]",a="[\\x22]",c=merge(o,"[A-Fa-f]"),l="[\\x0A]",u="[\\x20]",h=subexp(subexp("%[EFef]"+c+"%"+c+c+"%"+c+c)+"|"+subexp("%[89A-Fa-f]"+c+"%"+c+c)+"|"+subexp("%"+c+c)),d="[\\:\\/\\?\\#\\[\\]\\@]",p="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",m=merge(d,p),g=t?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",y=t?"[\\uE000-\\uF8FF]":"[]",v=merge(r,o,"[\\-\\.\\_\\~]",g),b=subexp(r+merge(r,o,"[\\+\\-\\.]")+"*"),w=subexp(subexp(h+"|"+merge(v,p,"[\\:]"))+"*"),E=subexp(subexp("25[0-5]")+"|"+subexp("2[0-4]"+o)+"|"+subexp("1"+o+o)+"|"+subexp("[1-9]"+o)+"|"+o),S=subexp(subexp("25[0-5]")+"|"+subexp("2[0-4]"+o)+"|"+subexp("1"+o+o)+"|"+subexp("0?[1-9]"+o)+"|0?0?"+o),$=subexp(S+"\\."+S+"\\."+S+"\\."+S),x=subexp(c+"{1,4}"),R=subexp(subexp(x+"\\:"+x)+"|"+$),O=subexp(subexp(x+"\\:")+"{6}"+R),P=subexp("\\:\\:"+subexp(x+"\\:")+"{5}"+R),A=subexp(subexp(x)+"?\\:\\:"+subexp(x+"\\:")+"{4}"+R),T=subexp(subexp(subexp(x+"\\:")+"{0,1}"+x)+"?\\:\\:"+subexp(x+"\\:")+"{3}"+R),C=subexp(subexp(subexp(x+"\\:")+"{0,2}"+x)+"?\\:\\:"+subexp(x+"\\:")+"{2}"+R),k=subexp(subexp(subexp(x+"\\:")+"{0,3}"+x)+"?\\:\\:"+x+"\\:"+R),I=subexp(subexp(subexp(x+"\\:")+"{0,4}"+x)+"?\\:\\:"+R),N=subexp(subexp(subexp(x+"\\:")+"{0,5}"+x)+"?\\:\\:"+x),D=subexp(subexp(subexp(x+"\\:")+"{0,6}"+x)+"?\\:\\:"),L=subexp([O,P,A,T,C,k,I,N,D].join("|")),M=subexp(subexp(v+"|"+h)+"+"),j=subexp(L+"\\%25"+M),U=subexp(L+subexp("\\%25|\\%(?!"+c+"{2})")+M),B=subexp("[vV]"+c+"+\\."+merge(v,p,"[\\:]")+"+"),H=subexp("\\["+subexp(U+"|"+L+"|"+B)+"\\]"),V=subexp(subexp(h+"|"+merge(v,p))+"*"),z=subexp(H+"|"+$+"(?!"+V+")"+"|"+V),G=subexp(o+"*"),q=subexp(subexp(w+"@")+"?"+z+subexp("\\:"+G)+"?"),W=subexp(h+"|"+merge(v,p,"[\\:\\@]")),K=subexp(W+"*"),Y=subexp(W+"+"),Z=subexp(subexp(h+"|"+merge(v,p,"[\\@]"))+"+"),X=subexp(subexp("\\/"+K)+"*"),J=subexp("\\/"+subexp(Y+X)+"?"),Q=subexp(Z+X),ee=subexp(Y+X),te="(?!"+W+")",re=subexp(X+"|"+J+"|"+Q+"|"+ee+"|"+te),se=subexp(subexp(W+"|"+merge("[\\/\\?]",y))+"*"),ie=subexp(subexp(W+"|[\\/\\?]")+"*"),ne=subexp(subexp("\\/\\/"+q+X)+"|"+J+"|"+ee+"|"+te),oe=subexp(b+"\\:"+ne+subexp("\\?"+se)+"?"+subexp("\\#"+ie)+"?"),ae=subexp(subexp("\\/\\/"+q+X)+"|"+J+"|"+Q+"|"+te),ce=subexp(ae+subexp("\\?"+se)+"?"+subexp("\\#"+ie)+"?"),le=subexp(oe+"|"+ce),ue=subexp(b+"\\:"+ne+subexp("\\?"+se)+"?"),he="^("+b+")\\:"+subexp(subexp("\\/\\/("+subexp("("+w+")@")+"?("+z+")"+subexp("\\:("+G+")")+"?)")+"?("+X+"|"+J+"|"+ee+"|"+te+")")+subexp("\\?("+se+")")+"?"+subexp("\\#("+ie+")")+"?$",de="^(){0}"+subexp(subexp("\\/\\/("+subexp("("+w+")@")+"?("+z+")"+subexp("\\:("+G+")")+"?)")+"?("+X+"|"+J+"|"+Q+"|"+te+")")+subexp("\\?("+se+")")+"?"+subexp("\\#("+ie+")")+"?$",fe="^("+b+")\\:"+subexp(subexp("\\/\\/("+subexp("("+w+")@")+"?("+z+")"+subexp("\\:("+G+")")+"?)")+"?("+X+"|"+J+"|"+ee+"|"+te+")")+subexp("\\?("+se+")")+"?$",pe="^"+subexp("\\#("+ie+")")+"?$",me="^"+subexp("("+w+")@")+"?("+z+")"+subexp("\\:("+G+")")+"?$";return{NOT_SCHEME:new RegExp(merge("[^]",r,o,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(merge("[^\\%\\:]",v,p),"g"),NOT_HOST:new RegExp(merge("[^\\%\\[\\]\\:]",v,p),"g"),NOT_PATH:new RegExp(merge("[^\\%\\/\\:\\@]",v,p),"g"),NOT_PATH_NOSCHEME:new RegExp(merge("[^\\%\\/\\@]",v,p),"g"),NOT_QUERY:new RegExp(merge("[^\\%]",v,p,"[\\:\\@\\/\\?]",y),"g"),NOT_FRAGMENT:new RegExp(merge("[^\\%]",v,p,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(merge("[^]",v,p),"g"),UNRESERVED:new RegExp(v,"g"),OTHER_CHARS:new RegExp(merge("[^\\%]",v,m),"g"),PCT_ENCODED:new RegExp(h,"g"),IPV4ADDRESS:new RegExp("^("+$+")$"),IPV6ADDRESS:new RegExp("^\\[?("+L+")"+subexp(subexp("\\%25|\\%(?!"+c+"{2})")+"("+M+")")+"?\\]?$")}}var r=buildExps(false);var i=buildExps(true);var o=function(){function sliceIterator(t,r){var i=[];var o=true;var a=false;var c=undefined;try{for(var l=t[Symbol.iterator](),u;!(o=(u=l.next()).done);o=true){i.push(u.value);if(r&&i.length===r)break}}catch(t){a=true;c=t}finally{try{if(!o&&l["return"])l["return"]()}finally{if(a)throw c}}return i}return function(t,r){if(Array.isArray(t)){return t}else if(Symbol.iterator in Object(t)){return sliceIterator(t,r)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();var toConsumableArray=function(t){if(Array.isArray(t)){for(var r=0,i=Array(t.length);r<t.length;r++)i[r]=t[r];return i}else{return Array.from(t)}};var a=2147483647;var c=36;var l=1;var u=26;var h=38;var d=700;var p=72;var m=128;var g="-";var y=/^xn--/;var v=/[^\0-\x7E]/;var b=/[\x2E\u3002\uFF0E\uFF61]/g;var w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"};var E=c-l;var S=Math.floor;var $=String.fromCharCode;function error$1(t){throw new RangeError(w[t])}function map(t,r){var i=[];var o=t.length;while(o--){i[o]=r(t[o])}return i}function mapDomain(t,r){var i=t.split("@");var o="";if(i.length>1){o=i[0]+"@";t=i[1]}t=t.replace(b,".");var a=t.split(".");var c=map(a,r).join(".");return o+c}function ucs2decode(t){var r=[];var i=0;var o=t.length;while(i<o){var a=t.charCodeAt(i++);if(a>=55296&&a<=56319&&i<o){var c=t.charCodeAt(i++);if((c&64512)==56320){r.push(((a&1023)<<10)+(c&1023)+65536)}else{r.push(a);i--}}else{r.push(a)}}return r}var x=function ucs2encode(t){return String.fromCodePoint.apply(String,toConsumableArray(t))};var R=function basicToDigit(t){if(t-48<10){return t-22}if(t-65<26){return t-65}if(t-97<26){return t-97}return c};var O=function digitToBasic(t,r){return t+22+75*(t<26)-((r!=0)<<5)};var P=function adapt(t,r,i){var o=0;t=i?S(t/d):t>>1;t+=S(t/r);for(;t>E*u>>1;o+=c){t=S(t/E)}return S(o+(E+1)*t/(t+h))};var A=function decode(t){var r=[];var i=t.length;var o=0;var h=m;var d=p;var y=t.lastIndexOf(g);if(y<0){y=0}for(var v=0;v<y;++v){if(t.charCodeAt(v)>=128){error$1("not-basic")}r.push(t.charCodeAt(v))}for(var b=y>0?y+1:0;b<i;){var w=o;for(var E=1,$=c;;$+=c){if(b>=i){error$1("invalid-input")}var x=R(t.charCodeAt(b++));if(x>=c||x>S((a-o)/E)){error$1("overflow")}o+=x*E;var O=$<=d?l:$>=d+u?u:$-d;if(x<O){break}var A=c-O;if(E>S(a/A)){error$1("overflow")}E*=A}var T=r.length+1;d=P(o-w,T,w==0);if(S(o/T)>a-h){error$1("overflow")}h+=S(o/T);o%=T;r.splice(o++,0,h)}return String.fromCodePoint.apply(String,r)};var T=function encode(t){var r=[];t=ucs2decode(t);var i=t.length;var o=m;var h=0;var d=p;var y=true;var v=false;var b=undefined;try{for(var w=t[Symbol.iterator](),E;!(y=(E=w.next()).done);y=true){var x=E.value;if(x<128){r.push($(x))}}}catch(t){v=true;b=t}finally{try{if(!y&&w.return){w.return()}}finally{if(v){throw b}}}var R=r.length;var A=R;if(R){r.push(g)}while(A<i){var T=a;var C=true;var k=false;var I=undefined;try{for(var N=t[Symbol.iterator](),D;!(C=(D=N.next()).done);C=true){var L=D.value;if(L>=o&&L<T){T=L}}}catch(t){k=true;I=t}finally{try{if(!C&&N.return){N.return()}}finally{if(k){throw I}}}var M=A+1;if(T-o>S((a-h)/M)){error$1("overflow")}h+=(T-o)*M;o=T;var j=true;var U=false;var B=undefined;try{for(var H=t[Symbol.iterator](),V;!(j=(V=H.next()).done);j=true){var z=V.value;if(z<o&&++h>a){error$1("overflow")}if(z==o){var G=h;for(var q=c;;q+=c){var W=q<=d?l:q>=d+u?u:q-d;if(G<W){break}var K=G-W;var Y=c-W;r.push($(O(W+K%Y,0)));G=S(K/Y)}r.push($(O(G,0)));d=P(h,M,A==R);h=0;++A}}}catch(t){U=true;B=t}finally{try{if(!j&&H.return){H.return()}}finally{if(U){throw B}}}++h;++o}return r.join("")};var C=function toUnicode(t){return mapDomain(t,(function(t){return y.test(t)?A(t.slice(4).toLowerCase()):t}))};var k=function toASCII(t){return mapDomain(t,(function(t){return v.test(t)?"xn--"+T(t):t}))};var I={version:"2.1.0",ucs2:{decode:ucs2decode,encode:x},decode:A,encode:T,toASCII:k,toUnicode:C};var N={};function pctEncChar(t){var r=t.charCodeAt(0);var i=void 0;if(r<16)i="%0"+r.toString(16).toUpperCase();else if(r<128)i="%"+r.toString(16).toUpperCase();else if(r<2048)i="%"+(r>>6|192).toString(16).toUpperCase()+"%"+(r&63|128).toString(16).toUpperCase();else i="%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(r&63|128).toString(16).toUpperCase();return i}function pctDecChars(t){var r="";var i=0;var o=t.length;while(i<o){var a=parseInt(t.substr(i+1,2),16);if(a<128){r+=String.fromCharCode(a);i+=3}else if(a>=194&&a<224){if(o-i>=6){var c=parseInt(t.substr(i+4,2),16);r+=String.fromCharCode((a&31)<<6|c&63)}else{r+=t.substr(i,6)}i+=6}else if(a>=224){if(o-i>=9){var l=parseInt(t.substr(i+4,2),16);var u=parseInt(t.substr(i+7,2),16);r+=String.fromCharCode((a&15)<<12|(l&63)<<6|u&63)}else{r+=t.substr(i,9)}i+=9}else{r+=t.substr(i,3);i+=3}}return r}function _normalizeComponentEncoding(t,r){function decodeUnreserved(t){var i=pctDecChars(t);return!i.match(r.UNRESERVED)?t:i}if(t.scheme)t.scheme=String(t.scheme).replace(r.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(r.NOT_SCHEME,"");if(t.userinfo!==undefined)t.userinfo=String(t.userinfo).replace(r.PCT_ENCODED,decodeUnreserved).replace(r.NOT_USERINFO,pctEncChar).replace(r.PCT_ENCODED,toUpperCase);if(t.host!==undefined)t.host=String(t.host).replace(r.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(r.NOT_HOST,pctEncChar).replace(r.PCT_ENCODED,toUpperCase);if(t.path!==undefined)t.path=String(t.path).replace(r.PCT_ENCODED,decodeUnreserved).replace(t.scheme?r.NOT_PATH:r.NOT_PATH_NOSCHEME,pctEncChar).replace(r.PCT_ENCODED,toUpperCase);if(t.query!==undefined)t.query=String(t.query).replace(r.PCT_ENCODED,decodeUnreserved).replace(r.NOT_QUERY,pctEncChar).replace(r.PCT_ENCODED,toUpperCase);if(t.fragment!==undefined)t.fragment=String(t.fragment).replace(r.PCT_ENCODED,decodeUnreserved).replace(r.NOT_FRAGMENT,pctEncChar).replace(r.PCT_ENCODED,toUpperCase);return t}function _stripLeadingZeros(t){return t.replace(/^0*(.*)/,"$1")||"0"}function _normalizeIPv4(t,r){var i=t.match(r.IPV4ADDRESS)||[];var a=o(i,2),c=a[1];if(c){return c.split(".").map(_stripLeadingZeros).join(".")}else{return t}}function _normalizeIPv6(t,r){var i=t.match(r.IPV6ADDRESS)||[];var a=o(i,3),c=a[1],l=a[2];if(c){var u=c.toLowerCase().split("::").reverse(),h=o(u,2),d=h[0],p=h[1];var m=p?p.split(":").map(_stripLeadingZeros):[];var g=d.split(":").map(_stripLeadingZeros);var y=r.IPV4ADDRESS.test(g[g.length-1]);var v=y?7:8;var b=g.length-v;var w=Array(v);for(var E=0;E<v;++E){w[E]=m[E]||g[b+E]||""}if(y){w[v-1]=_normalizeIPv4(w[v-1],r)}var S=w.reduce((function(t,r,i){if(!r||r==="0"){var o=t[t.length-1];if(o&&o.index+o.length===i){o.length++}else{t.push({index:i,length:1})}}return t}),[]);var $=S.sort((function(t,r){return r.length-t.length}))[0];var x=void 0;if($&&$.length>1){var R=w.slice(0,$.index);var O=w.slice($.index+$.length);x=R.join(":")+"::"+O.join(":")}else{x=w.join(":")}if(l){x+="%"+l}return x}else{return t}}var D=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;var L="".match(/(){0}/)[1]===undefined;function parse(t){var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var a={};var c=o.iri!==false?i:r;if(o.reference==="suffix")t=(o.scheme?o.scheme+":":"")+"//"+t;var l=t.match(D);if(l){if(L){a.scheme=l[1];a.userinfo=l[3];a.host=l[4];a.port=parseInt(l[5],10);a.path=l[6]||"";a.query=l[7];a.fragment=l[8];if(isNaN(a.port)){a.port=l[5]}}else{a.scheme=l[1]||undefined;a.userinfo=t.indexOf("@")!==-1?l[3]:undefined;a.host=t.indexOf("//")!==-1?l[4]:undefined;a.port=parseInt(l[5],10);a.path=l[6]||"";a.query=t.indexOf("?")!==-1?l[7]:undefined;a.fragment=t.indexOf("#")!==-1?l[8]:undefined;if(isNaN(a.port)){a.port=t.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?l[4]:undefined}}if(a.host){a.host=_normalizeIPv6(_normalizeIPv4(a.host,c),c)}if(a.scheme===undefined&&a.userinfo===undefined&&a.host===undefined&&a.port===undefined&&!a.path&&a.query===undefined){a.reference="same-document"}else if(a.scheme===undefined){a.reference="relative"}else if(a.fragment===undefined){a.reference="absolute"}else{a.reference="uri"}if(o.reference&&o.reference!=="suffix"&&o.reference!==a.reference){a.error=a.error||"URI is not a "+o.reference+" reference."}var u=N[(o.scheme||a.scheme||"").toLowerCase()];if(!o.unicodeSupport&&(!u||!u.unicodeSupport)){if(a.host&&(o.domainHost||u&&u.domainHost)){try{a.host=I.toASCII(a.host.replace(c.PCT_ENCODED,pctDecChars).toLowerCase())}catch(t){a.error=a.error||"Host's domain name can not be converted to ASCII via punycode: "+t}}_normalizeComponentEncoding(a,r)}else{_normalizeComponentEncoding(a,c)}if(u&&u.parse){u.parse(a,o)}}else{a.error=a.error||"URI can not be parsed."}return a}function _recomposeAuthority(t,o){var a=o.iri!==false?i:r;var c=[];if(t.userinfo!==undefined){c.push(t.userinfo);c.push("@")}if(t.host!==undefined){c.push(_normalizeIPv6(_normalizeIPv4(String(t.host),a),a).replace(a.IPV6ADDRESS,(function(t,r,i){return"["+r+(i?"%25"+i:"")+"]"})))}if(typeof t.port==="number"||typeof t.port==="string"){c.push(":");c.push(String(t.port))}return c.length?c.join(""):undefined}var M=/^\.\.?\//;var j=/^\/\.(\/|$)/;var U=/^\/\.\.(\/|$)/;var B=/^\/?(?:.|\n)*?(?=\/|$)/;function removeDotSegments(t){var r=[];while(t.length){if(t.match(M)){t=t.replace(M,"")}else if(t.match(j)){t=t.replace(j,"/")}else if(t.match(U)){t=t.replace(U,"/");r.pop()}else if(t==="."||t===".."){t=""}else{var i=t.match(B);if(i){var o=i[0];t=t.slice(o.length);r.push(o)}else{throw new Error("Unexpected dot segment condition")}}}return r.join("")}function serialize(t){var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var a=o.iri?i:r;var c=[];var l=N[(o.scheme||t.scheme||"").toLowerCase()];if(l&&l.serialize)l.serialize(t,o);if(t.host){if(a.IPV6ADDRESS.test(t.host)){}else if(o.domainHost||l&&l.domainHost){try{t.host=!o.iri?I.toASCII(t.host.replace(a.PCT_ENCODED,pctDecChars).toLowerCase()):I.toUnicode(t.host)}catch(r){t.error=t.error||"Host's domain name can not be converted to "+(!o.iri?"ASCII":"Unicode")+" via punycode: "+r}}}_normalizeComponentEncoding(t,a);if(o.reference!=="suffix"&&t.scheme){c.push(t.scheme);c.push(":")}var u=_recomposeAuthority(t,o);if(u!==undefined){if(o.reference!=="suffix"){c.push("//")}c.push(u);if(t.path&&t.path.charAt(0)!=="/"){c.push("/")}}if(t.path!==undefined){var h=t.path;if(!o.absolutePath&&(!l||!l.absolutePath)){h=removeDotSegments(h)}if(u===undefined){h=h.replace(/^\/\//,"/%2F")}c.push(h)}if(t.query!==undefined){c.push("?");c.push(t.query)}if(t.fragment!==undefined){c.push("#");c.push(t.fragment)}return c.join("")}function resolveComponents(t,r){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var o=arguments[3];var a={};if(!o){t=parse(serialize(t,i),i);r=parse(serialize(r,i),i)}i=i||{};if(!i.tolerant&&r.scheme){a.scheme=r.scheme;a.userinfo=r.userinfo;a.host=r.host;a.port=r.port;a.path=removeDotSegments(r.path||"");a.query=r.query}else{if(r.userinfo!==undefined||r.host!==undefined||r.port!==undefined){a.userinfo=r.userinfo;a.host=r.host;a.port=r.port;a.path=removeDotSegments(r.path||"");a.query=r.query}else{if(!r.path){a.path=t.path;if(r.query!==undefined){a.query=r.query}else{a.query=t.query}}else{if(r.path.charAt(0)==="/"){a.path=removeDotSegments(r.path)}else{if((t.userinfo!==undefined||t.host!==undefined||t.port!==undefined)&&!t.path){a.path="/"+r.path}else if(!t.path){a.path=r.path}else{a.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path}a.path=removeDotSegments(a.path)}a.query=r.query}a.userinfo=t.userinfo;a.host=t.host;a.port=t.port}a.scheme=t.scheme}a.fragment=r.fragment;return a}function resolve(t,r,i){var o=assign({scheme:"null"},i);return serialize(resolveComponents(parse(t,o),parse(r,o),o,true),o)}function normalize(t,r){if(typeof t==="string"){t=serialize(parse(t,r),r)}else if(typeOf(t)==="object"){t=parse(serialize(t,r),r)}return t}function equal(t,r,i){if(typeof t==="string"){t=serialize(parse(t,i),i)}else if(typeOf(t)==="object"){t=serialize(t,i)}if(typeof r==="string"){r=serialize(parse(r,i),i)}else if(typeOf(r)==="object"){r=serialize(r,i)}return t===r}function escapeComponent(t,o){return t&&t.toString().replace(!o||!o.iri?r.ESCAPE:i.ESCAPE,pctEncChar)}function unescapeComponent(t,o){return t&&t.toString().replace(!o||!o.iri?r.PCT_ENCODED:i.PCT_ENCODED,pctDecChars)}var H={scheme:"http",domainHost:true,parse:function parse(t,r){if(!t.host){t.error=t.error||"HTTP URIs must have a host."}return t},serialize:function serialize(t,r){var i=String(t.scheme).toLowerCase()==="https";if(t.port===(i?443:80)||t.port===""){t.port=undefined}if(!t.path){t.path="/"}return t}};var V={scheme:"https",domainHost:H.domainHost,parse:H.parse,serialize:H.serialize};function isSecure(t){return typeof t.secure==="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}var z={scheme:"ws",domainHost:true,parse:function parse(t,r){var i=t;i.secure=isSecure(i);i.resourceName=(i.path||"/")+(i.query?"?"+i.query:"");i.path=undefined;i.query=undefined;return i},serialize:function serialize(t,r){if(t.port===(isSecure(t)?443:80)||t.port===""){t.port=undefined}if(typeof t.secure==="boolean"){t.scheme=t.secure?"wss":"ws";t.secure=undefined}if(t.resourceName){var i=t.resourceName.split("?"),a=o(i,2),c=a[0],l=a[1];t.path=c&&c!=="/"?c:undefined;t.query=l;t.resourceName=undefined}t.fragment=undefined;return t}};var G={scheme:"wss",domainHost:z.domainHost,parse:z.parse,serialize:z.serialize};var q={};var W=true;var K="[A-Za-z0-9\\-\\.\\_\\~"+(W?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]";var Y="[0-9A-Fa-f]";var Z=subexp(subexp("%[EFef]"+Y+"%"+Y+Y+"%"+Y+Y)+"|"+subexp("%[89A-Fa-f]"+Y+"%"+Y+Y)+"|"+subexp("%"+Y+Y));var X="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";var J="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";var Q=merge(J,'[\\"\\\\]');var ee="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";var te=new RegExp(K,"g");var re=new RegExp(Z,"g");var se=new RegExp(merge("[^]",X,"[\\.]",'[\\"]',Q),"g");var ie=new RegExp(merge("[^]",K,ee),"g");var ne=ie;function decodeUnreserved(t){var r=pctDecChars(t);return!r.match(te)?t:r}var oe={scheme:"mailto",parse:function parse$$1(t,r){var i=t;var o=i.to=i.path?i.path.split(","):[];i.path=undefined;if(i.query){var a=false;var c={};var l=i.query.split("&");for(var u=0,h=l.length;u<h;++u){var d=l[u].split("=");switch(d[0]){case"to":var p=d[1].split(",");for(var m=0,g=p.length;m<g;++m){o.push(p[m])}break;case"subject":i.subject=unescapeComponent(d[1],r);break;case"body":i.body=unescapeComponent(d[1],r);break;default:a=true;c[unescapeComponent(d[0],r)]=unescapeComponent(d[1],r);break}}if(a)i.headers=c}i.query=undefined;for(var y=0,v=o.length;y<v;++y){var b=o[y].split("@");b[0]=unescapeComponent(b[0]);if(!r.unicodeSupport){try{b[1]=I.toASCII(unescapeComponent(b[1],r).toLowerCase())}catch(t){i.error=i.error||"Email address's domain name can not be converted to ASCII via punycode: "+t}}else{b[1]=unescapeComponent(b[1],r).toLowerCase()}o[y]=b.join("@")}return i},serialize:function serialize$$1(t,r){var i=t;var o=toArray(t.to);if(o){for(var a=0,c=o.length;a<c;++a){var l=String(o[a]);var u=l.lastIndexOf("@");var h=l.slice(0,u).replace(re,decodeUnreserved).replace(re,toUpperCase).replace(se,pctEncChar);var d=l.slice(u+1);try{d=!r.iri?I.toASCII(unescapeComponent(d,r).toLowerCase()):I.toUnicode(d)}catch(t){i.error=i.error||"Email address's domain name can not be converted to "+(!r.iri?"ASCII":"Unicode")+" via punycode: "+t}o[a]=h+"@"+d}i.path=o.join(",")}var p=t.headers=t.headers||{};if(t.subject)p["subject"]=t.subject;if(t.body)p["body"]=t.body;var m=[];for(var g in p){if(p[g]!==q[g]){m.push(g.replace(re,decodeUnreserved).replace(re,toUpperCase).replace(ie,pctEncChar)+"="+p[g].replace(re,decodeUnreserved).replace(re,toUpperCase).replace(ne,pctEncChar))}}if(m.length){i.query=m.join("&")}return i}};var ae=/^([^\:]+)\:(.*)/;var ce={scheme:"urn",parse:function parse$$1(t,r){var i=t.path&&t.path.match(ae);var o=t;if(i){var a=r.scheme||o.scheme||"urn";var c=i[1].toLowerCase();var l=i[2];var u=a+":"+(r.nid||c);var h=N[u];o.nid=c;o.nss=l;o.path=undefined;if(h){o=h.parse(o,r)}}else{o.error=o.error||"URN can not be parsed."}return o},serialize:function serialize$$1(t,r){var i=r.scheme||t.scheme||"urn";var o=t.nid;var a=i+":"+(r.nid||o);var c=N[a];if(c){t=c.serialize(t,r)}var l=t;var u=t.nss;l.path=(o||r.nid)+":"+u;return l}};var le=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;var ue={scheme:"urn:uuid",parse:function parse(t,r){var i=t;i.uuid=i.nss;i.nss=undefined;if(!r.tolerant&&(!i.uuid||!i.uuid.match(le))){i.error=i.error||"UUID is not valid."}return i},serialize:function serialize(t,r){var i=t;i.nss=(t.uuid||"").toLowerCase();return i}};N[H.scheme]=H;N[V.scheme]=V;N[z.scheme]=z;N[G.scheme]=G;N[oe.scheme]=oe;N[ce.scheme]=ce;N[ue.scheme]=ue;t.SCHEMES=N;t.pctEncChar=pctEncChar;t.pctDecChars=pctDecChars;t.parse=parse;t.removeDotSegments=removeDotSegments;t.serialize=serialize;t.resolveComponents=resolveComponents;t.resolve=resolve;t.normalize=normalize;t.equal=equal;t.escapeComponent=escapeComponent;t.unescapeComponent=unescapeComponent;Object.defineProperty(t,"__esModule",{value:true})}))},6982:(t,r,i)=>{"use strict";const{builtinModules:o}=i(8188);var a=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");var c=["node_modules","favicon.ico"];function validate(t){var r=[];var i=[];if(t===null){i.push("name cannot be null");return done(r,i)}if(t===undefined){i.push("name cannot be undefined");return done(r,i)}if(typeof t!=="string"){i.push("name must be a string");return done(r,i)}if(!t.length){i.push("name length must be greater than zero")}if(t.match(/^\./)){i.push("name cannot start with a period")}if(t.match(/^_/)){i.push("name cannot start with an underscore")}if(t.trim()!==t){i.push("name cannot contain leading or trailing spaces")}c.forEach((function(r){if(t.toLowerCase()===r){i.push(r+" is a blacklisted name")}}));if(o.includes(t.toLowerCase())){r.push(t+" is a core module name")}if(t.length>214){r.push("name can no longer contain more than 214 characters")}if(t.toLowerCase()!==t){r.push("name can no longer contain capital letters")}if(/[~'!()*]/.test(t.split("/").slice(-1)[0])){r.push('name can no longer contain special characters ("~\'!()*")')}if(encodeURIComponent(t)!==t){var l=t.match(a);if(l){var u=l[1];var h=l[2];if(encodeURIComponent(u)===u&&encodeURIComponent(h)===h){return done(r,i)}}i.push("name can only contain URL-friendly characters")}return done(r,i)}var done=function(t,r){var i={validForNewPackages:r.length===0&&t.length===0,validForOldPackages:r.length===0,warnings:t,errors:r};if(!i.warnings.length){delete i.warnings}if(!i.errors.length){delete i.errors}return i};t.exports=validate},6470:(t,r,i)=>{const o=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys";const a=i(1017);const c=o?";":":";const l=i(2636);const getNotFoundError=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"});const getPathInfo=(t,r)=>{const i=r.colon||c;const a=t.match(/\//)||o&&t.match(/\\/)?[""]:[...o?[process.cwd()]:[],...(r.path||process.env.PATH||"").split(i)];const l=o?r.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"";const u=o?l.split(i):[""];if(o){if(t.indexOf(".")!==-1&&u[0]!=="")u.unshift("")}return{pathEnv:a,pathExt:u,pathExtExe:l}};const which=(t,r,i)=>{if(typeof r==="function"){i=r;r={}}if(!r)r={};const{pathEnv:o,pathExt:c,pathExtExe:u}=getPathInfo(t,r);const h=[];const step=i=>new Promise(((c,l)=>{if(i===o.length)return r.all&&h.length?c(h):l(getNotFoundError(t));const u=o[i];const d=/^".*"$/.test(u)?u.slice(1,-1):u;const p=a.join(d,t);const m=!d&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;c(subStep(m,i,0))}));const subStep=(t,i,o)=>new Promise(((a,d)=>{if(o===c.length)return a(step(i+1));const p=c[o];l(t+p,{pathExt:u},((c,l)=>{if(!c&&l){if(r.all)h.push(t+p);else return a(t+p)}return a(subStep(t,i,o+1))}))}));return i?step(0).then((t=>i(null,t)),i):step(0)};const whichSync=(t,r)=>{r=r||{};const{pathEnv:i,pathExt:o,pathExtExe:c}=getPathInfo(t,r);const u=[];for(let h=0;h<i.length;h++){const d=i[h];const p=/^".*"$/.test(d)?d.slice(1,-1):d;const m=a.join(p,t);const g=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;for(let t=0;t<o.length;t++){const i=g+o[t];try{const t=l.sync(i,{pathExt:c});if(t){if(r.all)u.push(i);else return i}}catch(t){}}}if(r.all&&u.length)return u;if(r.nothrow)return null;throw getNotFoundError(t)};t.exports=which;which.sync=whichSync},4300:t=>{"use strict";t.exports=require("buffer")},2081:t=>{"use strict";t.exports=require("child_process")},2361:t=>{"use strict";t.exports=require("events")},7147:t=>{"use strict";t.exports=require("fs")},3685:t=>{"use strict";t.exports=require("http")},5687:t=>{"use strict";t.exports=require("https")},8188:t=>{"use strict";t.exports=require("module")},7718:t=>{"use strict";t.exports=require("node:child_process")},5673:t=>{"use strict";t.exports=require("node:events")},7561:t=>{"use strict";t.exports=require("node:fs")},9411:t=>{"use strict";t.exports=require("node:path")},7742:t=>{"use strict";t.exports=require("node:process")},2037:t=>{"use strict";t.exports=require("os")},1017:t=>{"use strict";t.exports=require("path")},4521:t=>{"use strict";t.exports=require("readline")},9955:t=>{"use strict";t.exports=require("stream")},6224:t=>{"use strict";t.exports=require("tty")},7310:t=>{"use strict";t.exports=require("url")},3837:t=>{"use strict";t.exports=require("util")},8878:(t,r,i)=>{const{Argument:o}=i(6654);const{Command:a}=i(5955);const{CommanderError:c,InvalidArgumentError:l}=i(2829);const{Help:u}=i(8567);const{Option:h}=i(9230);r.program=new a;r.createCommand=t=>new a(t);r.createOption=(t,r)=>new h(t,r);r.createArgument=(t,r)=>new o(t,r);r.Command=a;r.Option=h;r.Argument=o;r.Help=u;r.CommanderError=c;r.InvalidArgumentError=l;r.InvalidOptionArgumentError=l},6654:(t,r,i)=>{const{InvalidArgumentError:o}=i(2829);class Argument{constructor(t,r){this.description=r||"";this.variadic=false;this.parseArg=undefined;this.defaultValue=undefined;this.defaultValueDescription=undefined;this.argChoices=undefined;switch(t[0]){case"<":this.required=true;this._name=t.slice(1,-1);break;case"[":this.required=false;this._name=t.slice(1,-1);break;default:this.required=true;this._name=t;break}if(this._name.length>3&&this._name.slice(-3)==="..."){this.variadic=true;this._name=this._name.slice(0,-3)}}name(){return this._name}_concatValue(t,r){if(r===this.defaultValue||!Array.isArray(r)){return[t]}return r.concat(t)}default(t,r){this.defaultValue=t;this.defaultValueDescription=r;return this}argParser(t){this.parseArg=t;return this}choices(t){this.argChoices=t.slice();this.parseArg=(t,r)=>{if(!this.argChoices.includes(t)){throw new o(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,r)}return t};return this}argRequired(){this.required=true;return this}argOptional(){this.required=false;return this}}function humanReadableArgName(t){const r=t.name()+(t.variadic===true?"...":"");return t.required?"<"+r+">":"["+r+"]"}r.Argument=Argument;r.humanReadableArgName=humanReadableArgName},5955:(t,r,i)=>{const o=i(5673).EventEmitter;const a=i(7718);const c=i(9411);const l=i(7561);const u=i(7742);const{Argument:h,humanReadableArgName:d}=i(6654);const{CommanderError:p}=i(2829);const{Help:m}=i(8567);const{Option:g,DualOptions:y}=i(9230);const{suggestSimilar:v}=i(3241);class Command extends o{constructor(t){super();this.commands=[];this.options=[];this.parent=null;this._allowUnknownOption=false;this._allowExcessArguments=true;this.registeredArguments=[];this._args=this.registeredArguments;this.args=[];this.rawArgs=[];this.processedArgs=[];this._scriptPath=null;this._name=t||"";this._optionValues={};this._optionValueSources={};this._storeOptionsAsProperties=false;this._actionHandler=null;this._executableHandler=false;this._executableFile=null;this._executableDir=null;this._defaultCommandName=null;this._exitCallback=null;this._aliases=[];this._combineFlagAndOptionalValue=true;this._description="";this._summary="";this._argsDescription=undefined;this._enablePositionalOptions=false;this._passThroughOptions=false;this._lifeCycleHooks={};this._showHelpAfterError=false;this._showSuggestionAfterError=true;this._outputConfiguration={writeOut:t=>u.stdout.write(t),writeErr:t=>u.stderr.write(t),getOutHelpWidth:()=>u.stdout.isTTY?u.stdout.columns:undefined,getErrHelpWidth:()=>u.stderr.isTTY?u.stderr.columns:undefined,outputError:(t,r)=>r(t)};this._hidden=false;this._helpOption=undefined;this._addImplicitHelpCommand=undefined;this._helpCommand=undefined;this._helpConfiguration={}}copyInheritedSettings(t){this._outputConfiguration=t._outputConfiguration;this._helpOption=t._helpOption;this._helpCommand=t._helpCommand;this._helpConfiguration=t._helpConfiguration;this._exitCallback=t._exitCallback;this._storeOptionsAsProperties=t._storeOptionsAsProperties;this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue;this._allowExcessArguments=t._allowExcessArguments;this._enablePositionalOptions=t._enablePositionalOptions;this._showHelpAfterError=t._showHelpAfterError;this._showSuggestionAfterError=t._showSuggestionAfterError;return this}_getCommandAndAncestors(){const t=[];for(let r=this;r;r=r.parent){t.push(r)}return t}command(t,r,i){let o=r;let a=i;if(typeof o==="object"&&o!==null){a=o;o=null}a=a||{};const[,c,l]=t.match(/([^ ]+) *(.*)/);const u=this.createCommand(c);if(o){u.description(o);u._executableHandler=true}if(a.isDefault)this._defaultCommandName=u._name;u._hidden=!!(a.noHelp||a.hidden);u._executableFile=a.executableFile||null;if(l)u.arguments(l);this._registerCommand(u);u.parent=this;u.copyInheritedSettings(this);if(o)return this;return u}createCommand(t){return new Command(t)}createHelp(){return Object.assign(new m,this.configureHelp())}configureHelp(t){if(t===undefined)return this._helpConfiguration;this._helpConfiguration=t;return this}configureOutput(t){if(t===undefined)return this._outputConfiguration;Object.assign(this._outputConfiguration,t);return this}showHelpAfterError(t=true){if(typeof t!=="string")t=!!t;this._showHelpAfterError=t;return this}showSuggestionAfterError(t=true){this._showSuggestionAfterError=!!t;return this}addCommand(t,r){if(!t._name){throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`)}r=r||{};if(r.isDefault)this._defaultCommandName=t._name;if(r.noHelp||r.hidden)t._hidden=true;this._registerCommand(t);t.parent=this;t._checkForBrokenPassThrough();return this}createArgument(t,r){return new h(t,r)}argument(t,r,i,o){const a=this.createArgument(t,r);if(typeof i==="function"){a.default(o).argParser(i)}else{a.default(i)}this.addArgument(a);return this}arguments(t){t.trim().split(/ +/).forEach((t=>{this.argument(t)}));return this}addArgument(t){const r=this.registeredArguments.slice(-1)[0];if(r&&r.variadic){throw new Error(`only the last argument can be variadic '${r.name()}'`)}if(t.required&&t.defaultValue!==undefined&&t.parseArg===undefined){throw new Error(`a default value for a required argument is never used: '${t.name()}'`)}this.registeredArguments.push(t);return this}helpCommand(t,r){if(typeof t==="boolean"){this._addImplicitHelpCommand=t;return this}t=t??"help [command]";const[,i,o]=t.match(/([^ ]+) *(.*)/);const a=r??"display help for command";const c=this.createCommand(i);c.helpOption(false);if(o)c.arguments(o);if(a)c.description(a);this._addImplicitHelpCommand=true;this._helpCommand=c;return this}addHelpCommand(t,r){if(typeof t!=="object"){this.helpCommand(t,r);return this}this._addImplicitHelpCommand=true;this._helpCommand=t;return this}_getHelpCommand(){const t=this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"));if(t){if(this._helpCommand===undefined){this.helpCommand(undefined,undefined)}return this._helpCommand}return null}hook(t,r){const i=["preSubcommand","preAction","postAction"];if(!i.includes(t)){throw new Error(`Unexpected value for event passed to hook : '${t}'.\nExpecting one of '${i.join("', '")}'`)}if(this._lifeCycleHooks[t]){this._lifeCycleHooks[t].push(r)}else{this._lifeCycleHooks[t]=[r]}return this}exitOverride(t){if(t){this._exitCallback=t}else{this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync"){throw t}else{}}}return this}_exit(t,r,i){if(this._exitCallback){this._exitCallback(new p(t,r,i))}u.exit(t)}action(t){const listener=r=>{const i=this.registeredArguments.length;const o=r.slice(0,i);if(this._storeOptionsAsProperties){o[i]=this}else{o[i]=this.opts()}o.push(this);return t.apply(this,o)};this._actionHandler=listener;return this}createOption(t,r){return new g(t,r)}_callParseArg(t,r,i,o){try{return t.parseArg(r,i)}catch(t){if(t.code==="commander.invalidArgument"){const r=`${o} ${t.message}`;this.error(r,{exitCode:t.exitCode,code:t.code})}throw t}}_registerOption(t){const r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){const i=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'\n- already used by option '${r.flags}'`)}this.options.push(t)}_registerCommand(t){const knownBy=t=>[t.name()].concat(t.aliases());const r=knownBy(t).find((t=>this._findCommand(t)));if(r){const i=knownBy(this._findCommand(r)).join("|");const o=knownBy(t).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);const r=t.name();const i=t.attributeName();if(t.negate){const r=t.long.replace(/^--no-/,"--");if(!this._findOption(r)){this.setOptionValueWithSource(i,t.defaultValue===undefined?true:t.defaultValue,"default")}}else if(t.defaultValue!==undefined){this.setOptionValueWithSource(i,t.defaultValue,"default")}const handleOptionValue=(r,o,a)=>{if(r==null&&t.presetArg!==undefined){r=t.presetArg}const c=this.getOptionValue(i);if(r!==null&&t.parseArg){r=this._callParseArg(t,r,c,o)}else if(r!==null&&t.variadic){r=t._concatValue(r,c)}if(r==null){if(t.negate){r=false}else if(t.isBoolean()||t.optional){r=true}else{r=""}}this.setOptionValueWithSource(i,r,a)};this.on("option:"+r,(r=>{const i=`error: option '${t.flags}' argument '${r}' is invalid.`;handleOptionValue(r,i,"cli")}));if(t.envVar){this.on("optionEnv:"+r,(r=>{const i=`error: option '${t.flags}' value '${r}' from env '${t.envVar}' is invalid.`;handleOptionValue(r,i,"env")}))}return this}_optionEx(t,r,i,o,a){if(typeof r==="object"&&r instanceof g){throw new Error("To add an Option object use addOption() instead of option() or requiredOption()")}const c=this.createOption(r,i);c.makeOptionMandatory(!!t.mandatory);if(typeof o==="function"){c.default(a).argParser(o)}else if(o instanceof RegExp){const t=o;o=(r,i)=>{const o=t.exec(r);return o?o[0]:i};c.default(a).argParser(o)}else{c.default(o)}return this.addOption(c)}option(t,r,i,o){return this._optionEx({},t,r,i,o)}requiredOption(t,r,i,o){return this._optionEx({mandatory:true},t,r,i,o)}combineFlagAndOptionalValue(t=true){this._combineFlagAndOptionalValue=!!t;return this}allowUnknownOption(t=true){this._allowUnknownOption=!!t;return this}allowExcessArguments(t=true){this._allowExcessArguments=!!t;return this}enablePositionalOptions(t=true){this._enablePositionalOptions=!!t;return this}passThroughOptions(t=true){this._passThroughOptions=!!t;this._checkForBrokenPassThrough();return this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions){throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}}storeOptionsAsProperties(t=true){if(this.options.length){throw new Error("call .storeOptionsAsProperties() before adding options")}if(Object.keys(this._optionValues).length){throw new Error("call .storeOptionsAsProperties() before setting option values")}this._storeOptionsAsProperties=!!t;return this}getOptionValue(t){if(this._storeOptionsAsProperties){return this[t]}return this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,undefined)}setOptionValueWithSource(t,r,i){if(this._storeOptionsAsProperties){this[t]=r}else{this._optionValues[t]=r}this._optionValueSources[t]=i;return this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;this._getCommandAndAncestors().forEach((i=>{if(i.getOptionValueSource(t)!==undefined){r=i.getOptionValueSource(t)}}));return r}_prepareUserArgs(t,r){if(t!==undefined&&!Array.isArray(t)){throw new Error("first parameter to parse must be array or undefined")}r=r||{};if(t===undefined&&r.from===undefined){if(u.versions?.electron){r.from="electron"}const t=u.execArgv??[];if(t.includes("-e")||t.includes("--eval")||t.includes("-p")||t.includes("--print")){r.from="eval"}}if(t===undefined){t=u.argv}this.rawArgs=t.slice();let i;switch(r.from){case undefined:case"node":this._scriptPath=t[1];i=t.slice(2);break;case"electron":if(u.defaultApp){this._scriptPath=t[1];i=t.slice(2)}else{i=t.slice(1)}break;case"user":i=t.slice(0);break;case"eval":i=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);this._name=this._name||"program";return i}parse(t,r){const i=this._prepareUserArgs(t,r);this._parseCommand([],i);return this}async parseAsync(t,r){const i=this._prepareUserArgs(t,r);await this._parseCommand([],i);return this}_executeSubCommand(t,r){r=r.slice();let i=false;const o=[".js",".ts",".tsx",".mjs",".cjs"];function findFile(t,r){const i=c.resolve(t,r);if(l.existsSync(i))return i;if(o.includes(c.extname(r)))return undefined;const a=o.find((t=>l.existsSync(`${i}${t}`)));if(a)return`${i}${a}`;return undefined}this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();let h=t._executableFile||`${this._name}-${t._name}`;let d=this._executableDir||"";if(this._scriptPath){let t;try{t=l.realpathSync(this._scriptPath)}catch(r){t=this._scriptPath}d=c.resolve(c.dirname(t),d)}if(d){let r=findFile(d,h);if(!r&&!t._executableFile&&this._scriptPath){const i=c.basename(this._scriptPath,c.extname(this._scriptPath));if(i!==this._name){r=findFile(d,`${i}-${t._name}`)}}h=r||h}i=o.includes(c.extname(h));let m;if(u.platform!=="win32"){if(i){r.unshift(h);r=incrementNodeInspectorPort(u.execArgv).concat(r);m=a.spawn(u.argv[0],r,{stdio:"inherit"})}else{m=a.spawn(h,r,{stdio:"inherit"})}}else{r.unshift(h);r=incrementNodeInspectorPort(u.execArgv).concat(r);m=a.spawn(u.execPath,r,{stdio:"inherit"})}if(!m.killed){const t=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];t.forEach((t=>{u.on(t,(()=>{if(m.killed===false&&m.exitCode===null){m.kill(t)}}))}))}const g=this._exitCallback;m.on("close",(t=>{t=t??1;if(!g){u.exit(t)}else{g(new p(t,"commander.executeSubCommandAsync","(close)"))}}));m.on("error",(r=>{if(r.code==="ENOENT"){const r=d?`searched for local subcommand relative to directory '${d}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";const i=`'${h}' does not exist\n - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${r}`;throw new Error(i)}else if(r.code==="EACCES"){throw new Error(`'${h}' not executable`)}if(!g){u.exit(1)}else{const t=new p(1,"commander.executeSubCommandAsync","(error)");t.nestedError=r;g(t)}}));this.runningCommand=m}_dispatchSubcommand(t,r,i){const o=this._findCommand(t);if(!o)this.help({error:true});let a;a=this._chainOrCallSubCommandHook(a,o,"preSubcommand");a=this._chainOrCall(a,(()=>{if(o._executableHandler){this._executeSubCommand(o,r.concat(i))}else{return o._parseCommand(r,i)}}));return a}_dispatchHelpCommand(t){if(!t){this.help()}const r=this._findCommand(t);if(r&&!r._executableHandler){r.help()}return this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach(((t,r)=>{if(t.required&&this.args[r]==null){this.missingArgument(t.name())}}));if(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic){return}if(this.args.length>this.registeredArguments.length){this._excessArguments(this.args)}}_processArguments(){const myParseArg=(t,r,i)=>{let o=r;if(r!==null&&t.parseArg){const a=`error: command-argument value '${r}' is invalid for argument '${t.name()}'.`;o=this._callParseArg(t,r,i,a)}return o};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach(((r,i)=>{let o=r.defaultValue;if(r.variadic){if(i<this.args.length){o=this.args.slice(i);if(r.parseArg){o=o.reduce(((t,i)=>myParseArg(r,i,t)),r.defaultValue)}}else if(o===undefined){o=[]}}else if(i<this.args.length){o=this.args[i];if(r.parseArg){o=myParseArg(r,o,r.defaultValue)}}t[i]=o}));this.processedArgs=t}_chainOrCall(t,r){if(t&&t.then&&typeof t.then==="function"){return t.then((()=>r()))}return r()}_chainOrCallHooks(t,r){let i=t;const o=[];this._getCommandAndAncestors().reverse().filter((t=>t._lifeCycleHooks[r]!==undefined)).forEach((t=>{t._lifeCycleHooks[r].forEach((r=>{o.push({hookedCommand:t,callback:r})}))}));if(r==="postAction"){o.reverse()}o.forEach((t=>{i=this._chainOrCall(i,(()=>t.callback(t.hookedCommand,this)))}));return i}_chainOrCallSubCommandHook(t,r,i){let o=t;if(this._lifeCycleHooks[i]!==undefined){this._lifeCycleHooks[i].forEach((t=>{o=this._chainOrCall(o,(()=>t(this,r)))}))}return o}_parseCommand(t,r){const i=this.parseOptions(r);this._parseOptionsEnv();this._parseOptionsImplied();t=t.concat(i.operands);r=i.unknown;this.args=t.concat(r);if(t&&this._findCommand(t[0])){return this._dispatchSubcommand(t[0],t.slice(1),r)}if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name()){return this._dispatchHelpCommand(t[1])}if(this._defaultCommandName){this._outputHelpIfRequested(r);return this._dispatchSubcommand(this._defaultCommandName,t,r)}if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName){this.help({error:true})}this._outputHelpIfRequested(i.unknown);this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();const checkForUnknownOptions=()=>{if(i.unknown.length>0){this.unknownOption(i.unknown[0])}};const o=`command:${this.name()}`;if(this._actionHandler){checkForUnknownOptions();this._processArguments();let i;i=this._chainOrCallHooks(i,"preAction");i=this._chainOrCall(i,(()=>this._actionHandler(this.processedArgs)));if(this.parent){i=this._chainOrCall(i,(()=>{this.parent.emit(o,t,r)}))}i=this._chainOrCallHooks(i,"postAction");return i}if(this.parent&&this.parent.listenerCount(o)){checkForUnknownOptions();this._processArguments();this.parent.emit(o,t,r)}else if(t.length){if(this._findCommand("*")){return this._dispatchSubcommand("*",t,r)}if(this.listenerCount("command:*")){this.emit("command:*",t,r)}else if(this.commands.length){this.unknownCommand()}else{checkForUnknownOptions();this._processArguments()}}else if(this.commands.length){checkForUnknownOptions();this.help({error:true})}else{checkForUnknownOptions();this._processArguments()}}_findCommand(t){if(!t)return undefined;return this.commands.find((r=>r._name===t||r._aliases.includes(t)))}_findOption(t){return this.options.find((r=>r.is(t)))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((t=>{t.options.forEach((r=>{if(r.mandatory&&t.getOptionValue(r.attributeName())===undefined){t.missingMandatoryOptionValue(r)}}))}))}_checkForConflictingLocalOptions(){const t=this.options.filter((t=>{const r=t.attributeName();if(this.getOptionValue(r)===undefined){return false}return this.getOptionValueSource(r)!=="default"}));const r=t.filter((t=>t.conflictsWith.length>0));r.forEach((r=>{const i=t.find((t=>r.conflictsWith.includes(t.attributeName())));if(i){this._conflictingOption(r,i)}}))}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((t=>{t._checkForConflictingLocalOptions()}))}parseOptions(t){const r=[];const i=[];let o=r;const a=t.slice();function maybeOption(t){return t.length>1&&t[0]==="-"}let c=null;while(a.length){const t=a.shift();if(t==="--"){if(o===i)o.push(t);o.push(...a);break}if(c&&!maybeOption(t)){this.emit(`option:${c.name()}`,t);continue}c=null;if(maybeOption(t)){const r=this._findOption(t);if(r){if(r.required){const t=a.shift();if(t===undefined)this.optionMissingArgument(r);this.emit(`option:${r.name()}`,t)}else if(r.optional){let t=null;if(a.length>0&&!maybeOption(a[0])){t=a.shift()}this.emit(`option:${r.name()}`,t)}else{this.emit(`option:${r.name()}`)}c=r.variadic?r:null;continue}}if(t.length>2&&t[0]==="-"&&t[1]!=="-"){const r=this._findOption(`-${t[1]}`);if(r){if(r.required||r.optional&&this._combineFlagAndOptionalValue){this.emit(`option:${r.name()}`,t.slice(2))}else{this.emit(`option:${r.name()}`);a.unshift(`-${t.slice(2)}`)}continue}}if(/^--[^=]+=/.test(t)){const r=t.indexOf("=");const i=this._findOption(t.slice(0,r));if(i&&(i.required||i.optional)){this.emit(`option:${i.name()}`,t.slice(r+1));continue}}if(maybeOption(t)){o=i}if((this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&i.length===0){if(this._findCommand(t)){r.push(t);if(a.length>0)i.push(...a);break}else if(this._getHelpCommand()&&t===this._getHelpCommand().name()){r.push(t);if(a.length>0)r.push(...a);break}else if(this._defaultCommandName){i.push(t);if(a.length>0)i.push(...a);break}}if(this._passThroughOptions){o.push(t);if(a.length>0)o.push(...a);break}o.push(t)}return{operands:r,unknown:i}}opts(){if(this._storeOptionsAsProperties){const t={};const r=this.options.length;for(let i=0;i<r;i++){const r=this.options[i].attributeName();t[r]=r===this._versionOptionName?this._version:this[r]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(((t,r)=>Object.assign(t,r.opts())),{})}error(t,r){this._outputConfiguration.outputError(`${t}\n`,this._outputConfiguration.writeErr);if(typeof this._showHelpAfterError==="string"){this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`)}else if(this._showHelpAfterError){this._outputConfiguration.writeErr("\n");this.outputHelp({error:true})}const i=r||{};const o=i.exitCode||1;const a=i.code||"commander.error";this._exit(o,a,t)}_parseOptionsEnv(){this.options.forEach((t=>{if(t.envVar&&t.envVar in u.env){const r=t.attributeName();if(this.getOptionValue(r)===undefined||["default","config","env"].includes(this.getOptionValueSource(r))){if(t.required||t.optional){this.emit(`optionEnv:${t.name()}`,u.env[t.envVar])}else{this.emit(`optionEnv:${t.name()}`)}}}}))}_parseOptionsImplied(){const t=new y(this.options);const hasCustomOptionValue=t=>this.getOptionValue(t)!==undefined&&!["default","implied"].includes(this.getOptionValueSource(t));this.options.filter((r=>r.implied!==undefined&&hasCustomOptionValue(r.attributeName())&&t.valueFromOption(this.getOptionValue(r.attributeName()),r))).forEach((t=>{Object.keys(t.implied).filter((t=>!hasCustomOptionValue(t))).forEach((r=>{this.setOptionValueWithSource(r,t.implied[r],"implied")}))}))}missingArgument(t){const r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){const r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){const r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){const findBestOptionFromValue=t=>{const r=t.attributeName();const i=this.getOptionValue(r);const o=this.options.find((t=>t.negate&&r===t.attributeName()));const a=this.options.find((t=>!t.negate&&r===t.attributeName()));if(o&&(o.presetArg===undefined&&i===false||o.presetArg!==undefined&&i===o.presetArg)){return o}return a||t};const getErrorMessage=t=>{const r=findBestOptionFromValue(t);const i=r.attributeName();const o=this.getOptionValueSource(i);if(o==="env"){return`environment variable '${r.envVar}'`}return`option '${r.flags}'`};const i=`error: ${getErrorMessage(t)} cannot be used with ${getErrorMessage(r)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let i=[];let o=this;do{const t=o.createHelp().visibleOptions(o).filter((t=>t.long)).map((t=>t.long));i=i.concat(t);o=o.parent}while(o&&!o._enablePositionalOptions);r=v(t,i)}const i=`error: unknown option '${t}'${r}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;const r=this.registeredArguments.length;const i=r===1?"":"s";const o=this.parent?` for '${this.name()}'`:"";const a=`error: too many arguments${o}. Expected ${r} argument${i} but got ${t.length}.`;this.error(a,{code:"commander.excessArguments"})}unknownCommand(){const t=this.args[0];let r="";if(this._showSuggestionAfterError){const i=[];this.createHelp().visibleCommands(this).forEach((t=>{i.push(t.name());if(t.alias())i.push(t.alias())}));r=v(t,i)}const i=`error: unknown command '${t}'${r}`;this.error(i,{code:"commander.unknownCommand"})}version(t,r,i){if(t===undefined)return this._version;this._version=t;r=r||"-V, --version";i=i||"output the version number";const o=this.createOption(r,i);this._versionOptionName=o.attributeName();this._registerOption(o);this.on("option:"+o.name(),(()=>{this._outputConfiguration.writeOut(`${t}\n`);this._exit(0,"commander.version",t)}));return this}description(t,r){if(t===undefined&&r===undefined)return this._description;this._description=t;if(r){this._argsDescription=r}return this}summary(t){if(t===undefined)return this._summary;this._summary=t;return this}alias(t){if(t===undefined)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler){r=this.commands[this.commands.length-1]}if(t===r._name)throw new Error("Command alias can't be the same as its name");const i=this.parent?._findCommand(t);if(i){const r=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${r}'`)}r._aliases.push(t);return this}aliases(t){if(t===undefined)return this._aliases;t.forEach((t=>this.alias(t)));return this}usage(t){if(t===undefined){if(this._usage)return this._usage;const t=this.registeredArguments.map((t=>d(t)));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}this._usage=t;return this}name(t){if(t===undefined)return this._name;this._name=t;return this}nameFromFilename(t){this._name=c.basename(t,c.extname(t));return this}executableDir(t){if(t===undefined)return this._executableDir;this._executableDir=t;return this}helpInformation(t){const r=this.createHelp();if(r.helpWidth===undefined){r.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()}return r.formatHelp(this,r)}_getHelpContext(t){t=t||{};const r={error:!!t.error};let i;if(r.error){i=t=>this._outputConfiguration.writeErr(t)}else{i=t=>this._outputConfiguration.writeOut(t)}r.write=t.write||i;r.command=this;return r}outputHelp(t){let r;if(typeof t==="function"){r=t;t=undefined}const i=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach((t=>t.emit("beforeAllHelp",i)));this.emit("beforeHelp",i);let o=this.helpInformation(i);if(r){o=r(o);if(typeof o!=="string"&&!Buffer.isBuffer(o)){throw new Error("outputHelp callback must return a string or a Buffer")}}i.write(o);if(this._getHelpOption()?.long){this.emit(this._getHelpOption().long)}this.emit("afterHelp",i);this._getCommandAndAncestors().forEach((t=>t.emit("afterAllHelp",i)))}helpOption(t,r){if(typeof t==="boolean"){if(t){this._helpOption=this._helpOption??undefined}else{this._helpOption=null}return this}t=t??"-h, --help";r=r??"display help for command";this._helpOption=this.createOption(t,r);return this}_getHelpOption(){if(this._helpOption===undefined){this.helpOption(undefined,undefined)}return this._helpOption}addHelpOption(t){this._helpOption=t;return this}help(t){this.outputHelp(t);let r=u.exitCode||0;if(r===0&&t&&typeof t!=="function"&&t.error){r=1}this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){const i=["beforeAll","before","after","afterAll"];if(!i.includes(t)){throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${i.join("', '")}'`)}const o=`${t}Help`;this.on(o,(t=>{let i;if(typeof r==="function"){i=r({error:t.error,command:t.command})}else{i=r}if(i){t.write(`${i}\n`)}}));return this}_outputHelpIfRequested(t){const r=this._getHelpOption();const i=r&&t.find((t=>r.is(t)));if(i){this.outputHelp();this._exit(0,"commander.helpDisplayed","(outputHelp)")}}}function incrementNodeInspectorPort(t){return t.map((t=>{if(!t.startsWith("--inspect")){return t}let r;let i="127.0.0.1";let o="9229";let a;if((a=t.match(/^(--inspect(-brk)?)$/))!==null){r=a[1]}else if((a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){r=a[1];if(/^\d+$/.test(a[3])){o=a[3]}else{i=a[3]}}else if((a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){r=a[1];i=a[3];o=a[4]}if(r&&o!=="0"){return`${r}=${i}:${parseInt(o)+1}`}return t}))}r.Command=Command},2829:(t,r)=>{class CommanderError extends Error{constructor(t,r,i){super(i);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name;this.code=r;this.exitCode=t;this.nestedError=undefined}}class InvalidArgumentError extends CommanderError{constructor(t){super(1,"commander.invalidArgument",t);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name}}r.CommanderError=CommanderError;r.InvalidArgumentError=InvalidArgumentError},8567:(t,r,i)=>{const{humanReadableArgName:o}=i(6654);class Help{constructor(){this.helpWidth=undefined;this.sortSubcommands=false;this.sortOptions=false;this.showGlobalOptions=false}visibleCommands(t){const r=t.commands.filter((t=>!t._hidden));const i=t._getHelpCommand();if(i&&!i._hidden){r.push(i)}if(this.sortSubcommands){r.sort(((t,r)=>t.name().localeCompare(r.name())))}return r}compareOptions(t,r){const getSortKey=t=>t.short?t.short.replace(/^-/,""):t.long.replace(/^--/,"");return getSortKey(t).localeCompare(getSortKey(r))}visibleOptions(t){const r=t.options.filter((t=>!t.hidden));const i=t._getHelpOption();if(i&&!i.hidden){const o=i.short&&t._findOption(i.short);const a=i.long&&t._findOption(i.long);if(!o&&!a){r.push(i)}else if(i.long&&!a){r.push(t.createOption(i.long,i.description))}else if(i.short&&!o){r.push(t.createOption(i.short,i.description))}}if(this.sortOptions){r.sort(this.compareOptions)}return r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];const r=[];for(let i=t.parent;i;i=i.parent){const t=i.options.filter((t=>!t.hidden));r.push(...t)}if(this.sortOptions){r.sort(this.compareOptions)}return r}visibleArguments(t){if(t._argsDescription){t.registeredArguments.forEach((r=>{r.description=r.description||t._argsDescription[r.name()]||""}))}if(t.registeredArguments.find((t=>t.description))){return t.registeredArguments}return[]}subcommandTerm(t){const r=t.registeredArguments.map((t=>o(t))).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce(((t,i)=>Math.max(t,r.subcommandTerm(i).length)),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce(((t,i)=>Math.max(t,r.optionTerm(i).length)),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce(((t,i)=>Math.max(t,r.optionTerm(i).length)),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce(((t,i)=>Math.max(t,r.argumentTerm(i).length)),0)}commandUsage(t){let r=t._name;if(t._aliases[0]){r=r+"|"+t._aliases[0]}let i="";for(let r=t.parent;r;r=r.parent){i=r.name()+" "+i}return i+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){const r=[];if(t.argChoices){r.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){const i=t.required||t.optional||t.isBoolean()&&typeof t.defaultValue==="boolean";if(i){r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}}if(t.presetArg!==undefined&&t.optional){r.push(`preset: ${JSON.stringify(t.presetArg)}`)}if(t.envVar!==undefined){r.push(`env: ${t.envVar}`)}if(r.length>0){return`${t.description} (${r.join(", ")})`}return t.description}argumentDescription(t){const r=[];if(t.argChoices){r.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}if(r.length>0){const i=`(${r.join(", ")})`;if(t.description){return`${t.description} ${i}`}return i}return t.description}formatHelp(t,r){const i=r.padWidth(t,r);const o=r.helpWidth||80;const a=2;const c=2;function formatItem(t,l){if(l){const u=`${t.padEnd(i+c)}${l}`;return r.wrap(u,o-a,i+c)}return t}function formatList(t){return t.join("\n").replace(/^/gm," ".repeat(a))}let l=[`Usage: ${r.commandUsage(t)}`,""];const u=r.commandDescription(t);if(u.length>0){l=l.concat([r.wrap(u,o,0),""])}const h=r.visibleArguments(t).map((t=>formatItem(r.argumentTerm(t),r.argumentDescription(t))));if(h.length>0){l=l.concat(["Arguments:",formatList(h),""])}const d=r.visibleOptions(t).map((t=>formatItem(r.optionTerm(t),r.optionDescription(t))));if(d.length>0){l=l.concat(["Options:",formatList(d),""])}if(this.showGlobalOptions){const i=r.visibleGlobalOptions(t).map((t=>formatItem(r.optionTerm(t),r.optionDescription(t))));if(i.length>0){l=l.concat(["Global Options:",formatList(i),""])}}const p=r.visibleCommands(t).map((t=>formatItem(r.subcommandTerm(t),r.subcommandDescription(t))));if(p.length>0){l=l.concat(["Commands:",formatList(p),""])}return l.join("\n")}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}wrap(t,r,i,o=40){const a=" \\f\\t\\v - \ufeff";const c=new RegExp(`[\\n][${a}]+`);if(t.match(c))return t;const l=r-i;if(l<o)return t;const u=t.slice(0,i);const h=t.slice(i).replace("\r\n","\n");const d=" ".repeat(i);const p="";const m=`\\s${p}`;const g=new RegExp(`\n|.{1,${l-1}}([${m}]|$)|[^${m}]+?([${m}]|$)`,"g");const y=h.match(g)||[];return u+y.map(((t,r)=>{if(t==="\n")return"";return(r>0?d:"")+t.trimEnd()})).join("\n")}}r.Help=Help},9230:(t,r,i)=>{const{InvalidArgumentError:o}=i(2829);class Option{constructor(t,r){this.flags=t;this.description=r||"";this.required=t.includes("<");this.optional=t.includes("[");this.variadic=/\w\.\.\.[>\]]$/.test(t);this.mandatory=false;const i=splitOptionFlags(t);this.short=i.shortFlag;this.long=i.longFlag;this.negate=false;if(this.long){this.negate=this.long.startsWith("--no-")}this.defaultValue=undefined;this.defaultValueDescription=undefined;this.presetArg=undefined;this.envVar=undefined;this.parseArg=undefined;this.hidden=false;this.argChoices=undefined;this.conflictsWith=[];this.implied=undefined}default(t,r){this.defaultValue=t;this.defaultValueDescription=r;return this}preset(t){this.presetArg=t;return this}conflicts(t){this.conflictsWith=this.conflictsWith.concat(t);return this}implies(t){let r=t;if(typeof t==="string"){r={[t]:true}}this.implied=Object.assign(this.implied||{},r);return this}env(t){this.envVar=t;return this}argParser(t){this.parseArg=t;return this}makeOptionMandatory(t=true){this.mandatory=!!t;return this}hideHelp(t=true){this.hidden=!!t;return this}_concatValue(t,r){if(r===this.defaultValue||!Array.isArray(r)){return[t]}return r.concat(t)}choices(t){this.argChoices=t.slice();this.parseArg=(t,r)=>{if(!this.argChoices.includes(t)){throw new o(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,r)}return t};return this}name(){if(this.long){return this.long.replace(/^--/,"")}return this.short.replace(/^-/,"")}attributeName(){return camelcase(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class DualOptions{constructor(t){this.positiveOptions=new Map;this.negativeOptions=new Map;this.dualOptions=new Set;t.forEach((t=>{if(t.negate){this.negativeOptions.set(t.attributeName(),t)}else{this.positiveOptions.set(t.attributeName(),t)}}));this.negativeOptions.forEach(((t,r)=>{if(this.positiveOptions.has(r)){this.dualOptions.add(r)}}))}valueFromOption(t,r){const i=r.attributeName();if(!this.dualOptions.has(i))return true;const o=this.negativeOptions.get(i).presetArg;const a=o!==undefined?o:false;return r.negate===(a===t)}}function camelcase(t){return t.split("-").reduce(((t,r)=>t+r[0].toUpperCase()+r.slice(1)))}function splitOptionFlags(t){let r;let i;const o=t.split(/[ |,]+/);if(o.length>1&&!/^[[<]/.test(o[1]))r=o.shift();i=o.shift();if(!r&&/^-[^-]$/.test(i)){r=i;i=undefined}return{shortFlag:r,longFlag:i}}r.Option=Option;r.DualOptions=DualOptions},3241:(t,r)=>{const i=3;function editDistance(t,r){if(Math.abs(t.length-r.length)>i)return Math.max(t.length,r.length);const o=[];for(let r=0;r<=t.length;r++){o[r]=[r]}for(let t=0;t<=r.length;t++){o[0][t]=t}for(let i=1;i<=r.length;i++){for(let a=1;a<=t.length;a++){let c=1;if(t[a-1]===r[i-1]){c=0}else{c=1}o[a][i]=Math.min(o[a-1][i]+1,o[a][i-1]+1,o[a-1][i-1]+c);if(a>1&&i>1&&t[a-1]===r[i-2]&&t[a-2]===r[i-1]){o[a][i]=Math.min(o[a][i],o[a-2][i-2]+1)}}}return o[t.length][r.length]}function suggestSimilar(t,r){if(!r||r.length===0)return"";r=Array.from(new Set(r));const o=t.startsWith("--");if(o){t=t.slice(2);r=r.map((t=>t.slice(2)))}let a=[];let c=i;const l=.4;r.forEach((r=>{if(r.length<=1)return;const i=editDistance(t,r);const o=Math.max(t.length,r.length);const u=(o-i)/o;if(u>l){if(i<c){c=i;a=[r]}else if(i===c){a.push(r)}}}));a.sort(((t,r)=>t.localeCompare(r)));if(o){a=a.map((t=>`--${t}`))}if(a.length>1){return`\n(Did you mean one of ${a.join(", ")}?)`}if(a.length===1){return`\n(Did you mean ${a[0]}?)`}return""}r.suggestSimilar=suggestSimilar},5227:t=>{"use strict";t.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},2650:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/applicator","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/applicator":true},"$dynamicAnchor":"meta","title":"Applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"prefixItems":{"$ref":"#/$defs/schemaArray"},"items":{"$dynamicRef":"#meta"},"contains":{"$dynamicRef":"#meta"},"additionalProperties":{"$dynamicRef":"#meta"},"properties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"propertyNames":{"format":"regex"},"default":{}},"dependentSchemas":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"propertyNames":{"$dynamicRef":"#meta"},"if":{"$dynamicRef":"#meta"},"then":{"$dynamicRef":"#meta"},"else":{"$dynamicRef":"#meta"},"allOf":{"$ref":"#/$defs/schemaArray"},"anyOf":{"$ref":"#/$defs/schemaArray"},"oneOf":{"$ref":"#/$defs/schemaArray"},"not":{"$dynamicRef":"#meta"}},"$defs":{"schemaArray":{"type":"array","minItems":1,"items":{"$dynamicRef":"#meta"}}}}')},1828:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/content","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Content vocabulary meta-schema","type":["object","boolean"],"properties":{"contentEncoding":{"type":"string"},"contentMediaType":{"type":"string"},"contentSchema":{"$dynamicRef":"#meta"}}}')},2720:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/core","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true},"$dynamicAnchor":"meta","title":"Core vocabulary meta-schema","type":["object","boolean"],"properties":{"$id":{"$ref":"#/$defs/uriReferenceString","$comment":"Non-empty fragments not allowed.","pattern":"^[^#]*#?$"},"$schema":{"$ref":"#/$defs/uriString"},"$ref":{"$ref":"#/$defs/uriReferenceString"},"$anchor":{"$ref":"#/$defs/anchorString"},"$dynamicRef":{"$ref":"#/$defs/uriReferenceString"},"$dynamicAnchor":{"$ref":"#/$defs/anchorString"},"$vocabulary":{"type":"object","propertyNames":{"$ref":"#/$defs/uriString"},"additionalProperties":{"type":"boolean"}},"$comment":{"type":"string"},"$defs":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"}}},"$defs":{"anchorString":{"type":"string","pattern":"^[A-Za-z_][-A-Za-z0-9._]*$"},"uriString":{"type":"string","format":"uri"},"uriReferenceString":{"type":"string","format":"uri-reference"}}}')},8805:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/format-annotation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/format-annotation":true},"$dynamicAnchor":"meta","title":"Format vocabulary meta-schema for annotation results","type":["object","boolean"],"properties":{"format":{"type":"string"}}}')},5607:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/meta-data","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/meta-data":true},"$dynamicAnchor":"meta","title":"Meta-data vocabulary meta-schema","type":["object","boolean"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"default":true,"deprecated":{"type":"boolean","default":false},"readOnly":{"type":"boolean","default":false},"writeOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true}}}')},8814:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/unevaluated","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/unevaluated":true},"$dynamicAnchor":"meta","title":"Unevaluated applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"unevaluatedItems":{"$dynamicRef":"#meta"},"unevaluatedProperties":{"$dynamicRef":"#meta"}}}')},1400:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/validation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/validation":true},"$dynamicAnchor":"meta","title":"Validation vocabulary meta-schema","type":["object","boolean"],"properties":{"type":{"anyOf":[{"$ref":"#/$defs/simpleTypes"},{"type":"array","items":{"$ref":"#/$defs/simpleTypes"},"minItems":1,"uniqueItems":true}]},"const":true,"enum":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/$defs/nonNegativeInteger"},"minLength":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"maxItems":{"$ref":"#/$defs/nonNegativeInteger"},"minItems":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"maxContains":{"$ref":"#/$defs/nonNegativeInteger"},"minContains":{"$ref":"#/$defs/nonNegativeInteger","default":1},"maxProperties":{"$ref":"#/$defs/nonNegativeInteger"},"minProperties":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"required":{"$ref":"#/$defs/stringArray"},"dependentRequired":{"type":"object","additionalProperties":{"$ref":"#/$defs/stringArray"}}},"$defs":{"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"$ref":"#/$defs/nonNegativeInteger","default":0},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}}}')},6642:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/schema","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true,"https://json-schema.org/draft/2020-12/vocab/applicator":true,"https://json-schema.org/draft/2020-12/vocab/unevaluated":true,"https://json-schema.org/draft/2020-12/vocab/validation":true,"https://json-schema.org/draft/2020-12/vocab/meta-data":true,"https://json-schema.org/draft/2020-12/vocab/format-annotation":true,"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Core and Validation specifications meta-schema","allOf":[{"$ref":"meta/core"},{"$ref":"meta/applicator"},{"$ref":"meta/unevaluated"},{"$ref":"meta/validation"},{"$ref":"meta/meta-data"},{"$ref":"meta/format-annotation"},{"$ref":"meta/content"}],"type":["object","boolean"],"$comment":"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.","properties":{"definitions":{"$comment":"\\"definitions\\" has been replaced by \\"$defs\\".","type":"object","additionalProperties":{"$dynamicRef":"#meta"},"deprecated":true,"default":{}},"dependencies":{"$comment":"\\"dependencies\\" has been split and replaced by \\"dependentSchemas\\" and \\"dependentRequired\\" in order to serve their differing semantics.","type":"object","additionalProperties":{"anyOf":[{"$dynamicRef":"#meta"},{"$ref":"meta/validation#/$defs/stringArray"}]},"deprecated":true,"default":{}},"$recursiveAnchor":{"$comment":"\\"$recursiveAnchor\\" has been replaced by \\"$dynamicAnchor\\".","$ref":"meta/core#/$defs/anchorString","deprecated":true},"$recursiveRef":{"$comment":"\\"$recursiveRef\\" has been replaced by \\"$dynamicRef\\".","$ref":"meta/core#/$defs/uriReferenceString","deprecated":true}}}')},5137:t=>{"use strict";t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},9116:t=>{"use strict";t.exports=JSON.parse('[{"name":"Agola CI","constant":"AGOLA","env":"AGOLA_GIT_REF","pr":"AGOLA_PULL_REQUEST_ID"},{"name":"Appcircle","constant":"APPCIRCLE","env":"AC_APPCIRCLE"},{"name":"AppVeyor","constant":"APPVEYOR","env":"APPVEYOR","pr":"APPVEYOR_PULL_REQUEST_NUMBER"},{"name":"AWS CodeBuild","constant":"CODEBUILD","env":"CODEBUILD_BUILD_ARN"},{"name":"Azure Pipelines","constant":"AZURE_PIPELINES","env":"TF_BUILD","pr":{"BUILD_REASON":"PullRequest"}},{"name":"Bamboo","constant":"BAMBOO","env":"bamboo_planKey"},{"name":"Bitbucket Pipelines","constant":"BITBUCKET","env":"BITBUCKET_COMMIT","pr":"BITBUCKET_PR_ID"},{"name":"Bitrise","constant":"BITRISE","env":"BITRISE_IO","pr":"BITRISE_PULL_REQUEST"},{"name":"Buddy","constant":"BUDDY","env":"BUDDY_WORKSPACE_ID","pr":"BUDDY_EXECUTION_PULL_REQUEST_ID"},{"name":"Buildkite","constant":"BUILDKITE","env":"BUILDKITE","pr":{"env":"BUILDKITE_PULL_REQUEST","ne":"false"}},{"name":"CircleCI","constant":"CIRCLE","env":"CIRCLECI","pr":"CIRCLE_PULL_REQUEST"},{"name":"Cirrus CI","constant":"CIRRUS","env":"CIRRUS_CI","pr":"CIRRUS_PR"},{"name":"Codefresh","constant":"CODEFRESH","env":"CF_BUILD_ID","pr":{"any":["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{"name":"Codemagic","constant":"CODEMAGIC","env":"CM_BUILD_ID","pr":"CM_PULL_REQUEST"},{"name":"Codeship","constant":"CODESHIP","env":{"CI_NAME":"codeship"}},{"name":"Drone","constant":"DRONE","env":"DRONE","pr":{"DRONE_BUILD_EVENT":"pull_request"}},{"name":"dsari","constant":"DSARI","env":"DSARI"},{"name":"Earthly","constant":"EARTHLY","env":"EARTHLY_CI"},{"name":"Expo Application Services","constant":"EAS","env":"EAS_BUILD"},{"name":"Gerrit","constant":"GERRIT","env":"GERRIT_PROJECT"},{"name":"Gitea Actions","constant":"GITEA_ACTIONS","env":"GITEA_ACTIONS"},{"name":"GitHub Actions","constant":"GITHUB_ACTIONS","env":"GITHUB_ACTIONS","pr":{"GITHUB_EVENT_NAME":"pull_request"}},{"name":"GitLab CI","constant":"GITLAB","env":"GITLAB_CI","pr":"CI_MERGE_REQUEST_ID"},{"name":"GoCD","constant":"GOCD","env":"GO_PIPELINE_LABEL"},{"name":"Google Cloud Build","constant":"GOOGLE_CLOUD_BUILD","env":"BUILDER_OUTPUT"},{"name":"Harness CI","constant":"HARNESS","env":"HARNESS_BUILD_ID"},{"name":"Heroku","constant":"HEROKU","env":{"env":"NODE","includes":"/app/.heroku/node/bin/node"}},{"name":"Hudson","constant":"HUDSON","env":"HUDSON_URL"},{"name":"Jenkins","constant":"JENKINS","env":["JENKINS_URL","BUILD_ID"],"pr":{"any":["ghprbPullId","CHANGE_ID"]}},{"name":"LayerCI","constant":"LAYERCI","env":"LAYERCI","pr":"LAYERCI_PULL_REQUEST"},{"name":"Magnum CI","constant":"MAGNUM","env":"MAGNUM"},{"name":"Netlify CI","constant":"NETLIFY","env":"NETLIFY","pr":{"env":"PULL_REQUEST","ne":"false"}},{"name":"Nevercode","constant":"NEVERCODE","env":"NEVERCODE","pr":{"env":"NEVERCODE_PULL_REQUEST","ne":"false"}},{"name":"Prow","constant":"PROW","env":"PROW_JOB_ID"},{"name":"ReleaseHub","constant":"RELEASEHUB","env":"RELEASE_BUILD_ID"},{"name":"Render","constant":"RENDER","env":"RENDER","pr":{"IS_PULL_REQUEST":"true"}},{"name":"Sail CI","constant":"SAIL","env":"SAILCI","pr":"SAIL_PULL_REQUEST_NUMBER"},{"name":"Screwdriver","constant":"SCREWDRIVER","env":"SCREWDRIVER","pr":{"env":"SD_PULL_REQUEST","ne":"false"}},{"name":"Semaphore","constant":"SEMAPHORE","env":"SEMAPHORE","pr":"PULL_REQUEST_NUMBER"},{"name":"Sourcehut","constant":"SOURCEHUT","env":{"CI_NAME":"sourcehut"}},{"name":"Strider CD","constant":"STRIDER","env":"STRIDER"},{"name":"TaskCluster","constant":"TASKCLUSTER","env":["TASK_ID","RUN_ID"]},{"name":"TeamCity","constant":"TEAMCITY","env":"TEAMCITY_VERSION"},{"name":"Travis CI","constant":"TRAVIS","env":"TRAVIS","pr":{"env":"TRAVIS_PULL_REQUEST","ne":"false"}},{"name":"Vela","constant":"VELA","env":"VELA","pr":{"VELA_PULL_REQUEST":"1"}},{"name":"Vercel","constant":"VERCEL","env":{"any":["NOW_BUILDER","VERCEL"]},"pr":"VERCEL_GIT_PULL_REQUEST_ID"},{"name":"Visual Studio App Center","constant":"APPCENTER","env":"APPCENTER_BUILD_ID"},{"name":"Woodpecker","constant":"WOODPECKER","env":{"CI":"woodpecker"},"pr":{"CI_BUILD_EVENT":"pull_request"}},{"name":"Xcode Cloud","constant":"XCODE_CLOUD","env":"CI_XCODE_PROJECT","pr":"CI_PULL_REQUEST_NUMBER"},{"name":"Xcode Server","constant":"XCODE_SERVER","env":"XCS"}]')}};var r={};function __nccwpck_require__(i){var o=r[i];if(o!==undefined){return o.exports}var a=r[i]={exports:{}};var c=true;try{t[i].call(a.exports,a,a.exports,__nccwpck_require__);c=false}finally{if(c)delete r[i]}return a.exports}(()=>{__nccwpck_require__.n=t=>{var r=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(r,{a:r});return r}})();(()=>{__nccwpck_require__.d=(t,r)=>{for(var i in r){if(__nccwpck_require__.o(r,i)&&!__nccwpck_require__.o(t,i)){Object.defineProperty(t,i,{enumerable:true,get:r[i]})}}}})();(()=>{__nccwpck_require__.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i={};(()=>{"use strict";__nccwpck_require__.r(i);var t=__nccwpck_require__(150);var r=__nccwpck_require__.n(t);var o=__nccwpck_require__(8878);const{program:a,createCommand:c,createArgument:l,createOption:u,CommanderError:h,InvalidArgumentError:d,InvalidOptionArgumentError:p,Command:m,Argument:g,Option:y,Help:v}=o;const b=require("node:util");var w=__nccwpck_require__(7742);var E=__nccwpck_require__(7561);var S=__nccwpck_require__(9411);const $=require("node:crypto");const x=require("node:assert");const isObject=t=>{const r=typeof t;return t!==null&&(r==="object"||r==="function")};const isEmptyObject=t=>isObject(t)&&Object.keys(t).length===0;const R=new Set(["__proto__","prototype","constructor"]);const O=new Set("0123456789");function getPathSegments(t){const r=[];let i="";let o="start";let a=false;for(const c of t){switch(c){case"\\":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){throw new Error("Invalid character after an index")}if(a){i+=c}o="property";a=!a;break}case".":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){o="property";break}if(a){a=false;i+=c;break}if(R.has(i)){return[]}r.push(i);i="";o="property";break}case"[":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){o="index";break}if(a){a=false;i+=c;break}if(o==="property"){if(R.has(i)){return[]}r.push(i);i=""}o="index";break}case"]":{if(o==="index"){r.push(Number.parseInt(i,10));i="";o="indexEnd";break}if(o==="indexEnd"){throw new Error("Invalid character after an index")}}default:{if(o==="index"&&!O.has(c)){throw new Error("Invalid character in an index")}if(o==="indexEnd"){throw new Error("Invalid character after an index")}if(o==="start"){o="property"}if(a){a=false;i+="\\"}i+=c}}}if(a){i+="\\"}switch(o){case"property":{if(R.has(i)){return[]}r.push(i);break}case"index":{throw new Error("Index was not closed")}case"start":{r.push("");break}}return r}function isStringIndex(t,r){if(typeof r!=="number"&&Array.isArray(t)){const i=Number.parseInt(r,10);return Number.isInteger(i)&&t[i]===t[r]}return false}function assertNotStringIndex(t,r){if(isStringIndex(t,r)){throw new Error("Cannot use string index")}}function getProperty(t,r,i){if(!isObject(t)||typeof r!=="string"){return i===undefined?t:i}const o=getPathSegments(r);if(o.length===0){return i}for(let r=0;r<o.length;r++){const a=o[r];if(isStringIndex(t,a)){t=r===o.length-1?undefined:null}else{t=t[a]}if(t===undefined||t===null){if(r!==o.length-1){return i}break}}return t===undefined?i:t}function setProperty(t,r,i){if(!isObject(t)||typeof r!=="string"){return t}const o=t;const a=getPathSegments(r);for(let r=0;r<a.length;r++){const o=a[r];assertNotStringIndex(t,o);if(r===a.length-1){t[o]=i}else if(!isObject(t[o])){t[o]=typeof a[r+1]==="number"?[]:{}}t=t[o]}return o}function deleteProperty(t,r){if(!isObject(t)||typeof r!=="string"){return false}const i=getPathSegments(r);for(let r=0;r<i.length;r++){const o=i[r];assertNotStringIndex(t,o);if(r===i.length-1){delete t[o];return true}t=t[o];if(!isObject(t)){return false}}}function hasProperty(t,r){if(!isObject(t)||typeof r!=="string"){return false}const i=getPathSegments(r);if(i.length===0){return false}for(const r of i){if(!isObject(t)||!(r in t)||isStringIndex(t,r)){return false}t=t[r]}return true}function escapePath(t){if(typeof t!=="string"){throw new TypeError("Expected a string")}return t.replaceAll(/[\\.[]/g,"\\$&")}function entries(t){const r=Object.entries(t);if(Array.isArray(t)){return r.map((([t,r])=>[Number(t),r]))}return r}function stringifyPath(t){let r="";for(let[i,o]of entries(t)){if(typeof o==="number"){r+=`[${o}]`}else{o=escapePath(o);r+=i===0?o:`.${o}`}}return r}function*deepKeysIterator(t,r=[]){if(!isObject(t)||isEmptyObject(t)){if(r.length>0){yield stringifyPath(r)}return}for(const[i,o]of entries(t)){yield*deepKeysIterator(o,[...r,i])}}function deepKeys(t){return[...deepKeysIterator(t)]}const P=require("node:os");const A=P.homedir();const T=P.tmpdir();const{env:C}=w;const macos=t=>{const r=S.join(A,"Library");return{data:S.join(r,"Application Support",t),config:S.join(r,"Preferences",t),cache:S.join(r,"Caches",t),log:S.join(r,"Logs",t),temp:S.join(T,t)}};const windows=t=>{const r=C.APPDATA||S.join(A,"AppData","Roaming");const i=C.LOCALAPPDATA||S.join(A,"AppData","Local");return{data:S.join(i,t,"Data"),config:S.join(r,t,"Config"),cache:S.join(i,t,"Cache"),log:S.join(i,t,"Log"),temp:S.join(T,t)}};const linux=t=>{const r=S.basename(A);return{data:S.join(C.XDG_DATA_HOME||S.join(A,".local","share"),t),config:S.join(C.XDG_CONFIG_HOME||S.join(A,".config"),t),cache:S.join(C.XDG_CACHE_HOME||S.join(A,".cache"),t),log:S.join(C.XDG_STATE_HOME||S.join(A,".local","state"),t),temp:S.join(T,r,t)}};function envPaths(t,{suffix:r="nodejs"}={}){if(typeof t!=="string"){throw new TypeError(`Expected a string, got ${typeof t}`)}if(r){t+=`-${r}`}if(w.platform==="darwin"){return macos(t)}if(w.platform==="win32"){return windows(t)}return linux(t)}const attemptifyAsync=(t,r)=>function attemptified(...i){return t.apply(undefined,i).catch(r)};const attemptifySync=(t,r)=>function attemptified(...i){try{return t.apply(undefined,i)}catch(t){return r(t)}};const k=w.getuid?!w.getuid():false;const I=1e4;const NOOP=()=>undefined;const N={isChangeErrorOk:t=>{if(!N.isNodeError(t))return false;const{code:r}=t;if(r==="ENOSYS")return true;if(!k&&(r==="EINVAL"||r==="EPERM"))return true;return false},isNodeError:t=>t instanceof Error,isRetriableError:t=>{if(!N.isNodeError(t))return false;const{code:r}=t;if(r==="EMFILE"||r==="ENFILE"||r==="EAGAIN"||r==="EBUSY"||r==="EACCESS"||r==="EACCES"||r==="EACCS"||r==="EPERM")return true;return false},onChangeError:t=>{if(!N.isNodeError(t))throw t;if(N.isChangeErrorOk(t))return;throw t}};const D=N;class RetryfyQueue{constructor(){this.interval=25;this.intervalId=undefined;this.limit=I;this.queueActive=new Set;this.queueWaiting=new Set;this.init=()=>{if(this.intervalId)return;this.intervalId=setInterval(this.tick,this.interval)};this.reset=()=>{if(!this.intervalId)return;clearInterval(this.intervalId);delete this.intervalId};this.add=t=>{this.queueWaiting.add(t);if(this.queueActive.size<this.limit/2){this.tick()}else{this.init()}};this.remove=t=>{this.queueWaiting.delete(t);this.queueActive.delete(t)};this.schedule=()=>new Promise((t=>{const cleanup=()=>this.remove(resolver);const resolver=()=>t(cleanup);this.add(resolver)}));this.tick=()=>{if(this.queueActive.size>=this.limit)return;if(!this.queueWaiting.size)return this.reset();for(const t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t);this.queueActive.add(t);t()}}}}const L=new RetryfyQueue;const retryifyAsync=(t,r)=>function retrified(i){return function attempt(...o){return L.schedule().then((a=>{const onResolve=t=>{a();return t};const onReject=t=>{a();if(Date.now()>=i)throw t;if(r(t)){const t=Math.round(100*Math.random());const r=new Promise((r=>setTimeout(r,t)));return r.then((()=>attempt.apply(undefined,o)))}throw t};return t.apply(undefined,o).then(onResolve,onReject)}))}};const retryifySync=(t,r)=>function retrified(i){return function attempt(...o){try{return t.apply(undefined,o)}catch(t){if(Date.now()>i)throw t;if(r(t))return attempt.apply(undefined,o);throw t}}};const M={attempt:{chmod:attemptifyAsync((0,b.promisify)(E.chmod),D.onChangeError),chown:attemptifyAsync((0,b.promisify)(E.chown),D.onChangeError),close:attemptifyAsync((0,b.promisify)(E.close),NOOP),fsync:attemptifyAsync((0,b.promisify)(E.fsync),NOOP),mkdir:attemptifyAsync((0,b.promisify)(E.mkdir),NOOP),realpath:attemptifyAsync((0,b.promisify)(E.realpath),NOOP),stat:attemptifyAsync((0,b.promisify)(E.stat),NOOP),unlink:attemptifyAsync((0,b.promisify)(E.unlink),NOOP),chmodSync:attemptifySync(E.chmodSync,D.onChangeError),chownSync:attemptifySync(E.chownSync,D.onChangeError),closeSync:attemptifySync(E.closeSync,NOOP),existsSync:attemptifySync(E.existsSync,NOOP),fsyncSync:attemptifySync(E.fsync,NOOP),mkdirSync:attemptifySync(E.mkdirSync,NOOP),realpathSync:attemptifySync(E.realpathSync,NOOP),statSync:attemptifySync(E.statSync,NOOP),unlinkSync:attemptifySync(E.unlinkSync,NOOP)},retry:{close:retryifyAsync((0,b.promisify)(E.close),D.isRetriableError),fsync:retryifyAsync((0,b.promisify)(E.fsync),D.isRetriableError),open:retryifyAsync((0,b.promisify)(E.open),D.isRetriableError),readFile:retryifyAsync((0,b.promisify)(E.readFile),D.isRetriableError),rename:retryifyAsync((0,b.promisify)(E.rename),D.isRetriableError),stat:retryifyAsync((0,b.promisify)(E.stat),D.isRetriableError),write:retryifyAsync((0,b.promisify)(E.write),D.isRetriableError),writeFile:retryifyAsync((0,b.promisify)(E.writeFile),D.isRetriableError),closeSync:retryifySync(E.closeSync,D.isRetriableError),fsyncSync:retryifySync(E.fsyncSync,D.isRetriableError),openSync:retryifySync(E.openSync,D.isRetriableError),readFileSync:retryifySync(E.readFileSync,D.isRetriableError),renameSync:retryifySync(E.renameSync,D.isRetriableError),statSync:retryifySync(E.statSync,D.isRetriableError),writeSync:retryifySync(E.writeSync,D.isRetriableError),writeFileSync:retryifySync(E.writeFileSync,D.isRetriableError)}};const j=M;const U="utf8";const B=438;const H=511;const V={};const z={};const G=P.userInfo().uid;const q=P.userInfo().gid;const W=7500;const K=1e3;const Y=!!w.getuid;const Z=w.getuid?!w.getuid():false;const X=128;const J=1e4;const constants_NOOP=()=>{};const lang_isException=t=>t instanceof Error&&"code"in t;const lang_isFunction=t=>typeof t==="function";const lang_isString=t=>typeof t==="string";const lang_isUndefined=t=>t===undefined;const Q={};const ee={next:t=>{const r=Q[t];if(!r)return;r.shift();const i=r[0];if(i){i((()=>ee.next(t)))}else{delete Q[t]}},schedule:t=>new Promise((r=>{let i=Q[t];if(!i)i=Q[t]=[];i.push(r);if(i.length>1)return;r((()=>ee.next(t)))}))};const te=null&ⅇconst re=w.platform==="linux";const se=w.platform==="win32";const ie=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(!se){ie.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT")}if(re){ie.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}const ne=ie;class Interceptor{constructor(){this.callbacks=new Set;this.exited=false;this.exit=t=>{if(this.exited)return;this.exited=true;for(const t of this.callbacks){t()}if(t){if(se&&(t!=="SIGINT"&&t!=="SIGTERM"&&t!=="SIGKILL")){w.kill(w.pid,"SIGTERM")}else{w.kill(w.pid,t)}}};this.hook=()=>{w.once("exit",(()=>this.exit()));for(const t of ne){w.once(t,(()=>this.exit(t)))}};this.register=t=>{this.callbacks.add(t);return()=>{this.callbacks.delete(t)}};this.hook()}}const oe=new Interceptor;const ae=oe.register;const ce=ae;const le={store:{},create:t=>{const r=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6);const i=Date.now().toString().slice(-10);const o="tmp-";const a=`.${o}${i}${r}`;const c=`${t}${a}`;return c},get:(t,r,i=true)=>{const o=le.truncate(r(t));if(o in le.store)return le.get(t,r,i);le.store[o]=i;const disposer=()=>delete le.store[o];return[o,disposer]},purge:t=>{if(!le.store[t])return;delete le.store[t];j.attempt.unlink(t)},purgeSync:t=>{if(!le.store[t])return;delete le.store[t];j.attempt.unlinkSync(t)},purgeSyncAll:()=>{for(const t in le.store){le.purgeSync(t)}},truncate:t=>{const r=S.basename(t);if(r.length<=X)return t;const i=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(r);if(!i)return t;const o=r.length-X;return`${t.slice(0,-r.length)}${i[1]}${i[2].slice(0,-o)}${i[3]}`}};ce(le.purgeSyncAll);const ue=le;function readFile(t,r=DEFAULT_READ_OPTIONS){if(isString(r))return readFile(t,{encoding:r});const i=Date.now()+((r.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);return fs.retry.readFile(i)(t,r)}function readFileSync(t,r=DEFAULT_READ_OPTIONS){if(isString(r))return readFileSync(t,{encoding:r});const i=Date.now()+((r.timeout??DEFAULT_TIMEOUT_SYNC)||-1);return fs.retry.readFileSync(i)(t,r)}function writeFile(t,r,i,o){if(isFunction(i))return writeFile(t,r,DEFAULT_WRITE_OPTIONS,i);const a=writeFileAsync(t,r,i);if(o)a.then(o,o);return a}async function writeFileAsync(t,r,i=DEFAULT_WRITE_OPTIONS){if(isString(i))return writeFileAsync(t,r,{encoding:i});const o=Date.now()+((i.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);let a=null;let c=null;let l=null;let u=null;let h=null;try{if(i.schedule)a=await i.schedule(t);c=await Scheduler.schedule(t);const d=await fs.attempt.realpath(t);const p=!!d;t=d||t;[u,l]=Temp.get(t,i.tmpCreate||Temp.create,!(i.tmpPurge===false));const m=IS_POSIX&&isUndefined(i.chown);const g=isUndefined(i.mode);if(p&&(m||g)){const r=await fs.attempt.stat(t);if(r){i={...i};if(m){i.chown={uid:r.uid,gid:r.gid}}if(g){i.mode=r.mode}}}if(!p){const r=path.dirname(t);await fs.attempt.mkdir(r,{mode:DEFAULT_FOLDER_MODE,recursive:true})}h=await fs.retry.open(o)(u,"w",i.mode||DEFAULT_FILE_MODE);if(i.tmpCreated){i.tmpCreated(u)}if(isString(r)){await fs.retry.write(o)(h,r,0,i.encoding||DEFAULT_ENCODING)}else if(!isUndefined(r)){await fs.retry.write(o)(h,r,0,r.length,0)}if(i.fsync!==false){if(i.fsyncWait!==false){await fs.retry.fsync(o)(h)}else{fs.attempt.fsync(h)}}await fs.retry.close(o)(h);h=null;if(i.chown&&(i.chown.uid!==DEFAULT_USER_UID||i.chown.gid!==DEFAULT_USER_GID)){await fs.attempt.chown(u,i.chown.uid,i.chown.gid)}if(i.mode&&i.mode!==DEFAULT_FILE_MODE){await fs.attempt.chmod(u,i.mode)}try{await fs.retry.rename(o)(u,t)}catch(r){if(!isException(r))throw r;if(r.code!=="ENAMETOOLONG")throw r;await fs.retry.rename(o)(u,Temp.truncate(t))}l();u=null}finally{if(h)await fs.attempt.close(h);if(u)Temp.purge(u);if(a)a();if(c)c()}}function writeFileSync(t,r,i=z){if(lang_isString(i))return writeFileSync(t,r,{encoding:i});const o=Date.now()+((i.timeout??K)||-1);let a=null;let c=null;let l=null;try{const u=j.attempt.realpathSync(t);const h=!!u;t=u||t;[c,a]=ue.get(t,i.tmpCreate||ue.create,!(i.tmpPurge===false));const d=Y&&lang_isUndefined(i.chown);const p=lang_isUndefined(i.mode);if(h&&(d||p)){const r=j.attempt.statSync(t);if(r){i={...i};if(d){i.chown={uid:r.uid,gid:r.gid}}if(p){i.mode=r.mode}}}if(!h){const r=S.dirname(t);j.attempt.mkdirSync(r,{mode:H,recursive:true})}l=j.retry.openSync(o)(c,"w",i.mode||B);if(i.tmpCreated){i.tmpCreated(c)}if(lang_isString(r)){j.retry.writeSync(o)(l,r,0,i.encoding||U)}else if(!lang_isUndefined(r)){j.retry.writeSync(o)(l,r,0,r.length,0)}if(i.fsync!==false){if(i.fsyncWait!==false){j.retry.fsyncSync(o)(l)}else{j.attempt.fsync(l)}}j.retry.closeSync(o)(l);l=null;if(i.chown&&(i.chown.uid!==G||i.chown.gid!==q)){j.attempt.chownSync(c,i.chown.uid,i.chown.gid)}if(i.mode&&i.mode!==B){j.attempt.chmodSync(c,i.mode)}try{j.retry.renameSync(o)(c,t)}catch(r){if(!lang_isException(r))throw r;if(r.code!=="ENAMETOOLONG")throw r;j.retry.renameSync(o)(c,ue.truncate(t))}a();c=null}finally{if(l)j.attempt.closeSync(l);if(c)ue.purge(c)}}var he=__nccwpck_require__(8018);var de=__nccwpck_require__(8735);const copyProperty=(t,r,i,o)=>{if(i==="length"||i==="prototype"){return}if(i==="arguments"||i==="caller"){return}const a=Object.getOwnPropertyDescriptor(t,i);const c=Object.getOwnPropertyDescriptor(r,i);if(!canCopyProperty(a,c)&&o){return}Object.defineProperty(t,i,c)};const canCopyProperty=function(t,r){return t===undefined||t.configurable||t.writable===r.writable&&t.enumerable===r.enumerable&&t.configurable===r.configurable&&(t.writable||t.value===r.value)};const changePrototype=(t,r)=>{const i=Object.getPrototypeOf(r);if(i===Object.getPrototypeOf(t)){return}Object.setPrototypeOf(t,i)};const wrappedToString=(t,r)=>`/* Wrapped ${t}*/\n${r}`;const fe=Object.getOwnPropertyDescriptor(Function.prototype,"toString");const pe=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");const changeToString=(t,r,i)=>{const o=i===""?"":`with ${i.trim()}() `;const a=wrappedToString.bind(null,o,r.toString());Object.defineProperty(a,"name",pe);const{writable:c,enumerable:l,configurable:u}=fe;Object.defineProperty(t,"toString",{value:a,writable:c,enumerable:l,configurable:u})};function mimicFunction(t,r,{ignoreNonConfigurable:i=false}={}){const{name:o}=t;for(const o of Reflect.ownKeys(r)){copyProperty(t,r,o,i)}changePrototype(t,r);changeToString(t,r,o);return t}const debounceFunction=(t,r={})=>{if(typeof t!=="function"){throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``)}const{wait:i=0,maxWait:o=Number.POSITIVE_INFINITY,before:a=false,after:c=true}=r;if(i<0||o<0){throw new RangeError("`wait` and `maxWait` must not be negative.")}if(!a&&!c){throw new Error("Both `before` and `after` are false, function wouldn't be called.")}let l;let u;let h;const debouncedFunction=function(...r){const d=this;const later=()=>{l=undefined;if(u){clearTimeout(u);u=undefined}if(c){h=t.apply(d,r)}};const maxLater=()=>{u=undefined;if(l){clearTimeout(l);l=undefined}if(c){h=t.apply(d,r)}};const p=a&&!l;clearTimeout(l);l=setTimeout(later,i);if(o>0&&o!==Number.POSITIVE_INFINITY&&!u){u=setTimeout(maxLater,o)}if(p){h=t.apply(d,r)}return h};mimicFunction(debouncedFunction,t);debouncedFunction.cancel=()=>{if(l){clearTimeout(l);l=undefined}if(u){clearTimeout(u);u=undefined}};return debouncedFunction};const me=debounceFunction;var ge=__nccwpck_require__(6546);const ye=Object.prototype.toString;const ve="[object Uint8Array]";function isUint8Array(t){if(!t){return false}if(t.constructor===Uint8Array){return true}return ye.call(t)===ve}function assertUint8Array(t){if(!isUint8Array(t)){throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof t}\``)}}function toUint8Array(t){if(t instanceof ArrayBuffer){return new Uint8Array(t)}if(ArrayBuffer.isView(t)){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}throw new TypeError(`Unsupported value, got \`${typeof t}\`.`)}function concatUint8Arrays(t,r){if(t.length===0){return new Uint8Array(0)}r??=t.reduce(((t,r)=>t+r.length),0);const i=new Uint8Array(r);let o=0;for(const r of t){assertUint8Array(r);i.set(r,o);o+=r.length}return i}function areUint8ArraysEqual(t,r){assertUint8Array(t);assertUint8Array(r);if(t===r){return true}if(t.length!==r.length){return false}for(let i=0;i<t.length;i++){if(t[i]!==r[i]){return false}}return true}function compareUint8Arrays(t,r){assertUint8Array(t);assertUint8Array(r);const i=Math.min(t.length,r.length);for(let o=0;o<i;o++){const i=t[o]-r[o];if(i!==0){return Math.sign(i)}}return Math.sign(t.length-r.length)}const be=new globalThis.TextDecoder;function uint8ArrayToString(t){assertUint8Array(t);return be.decode(t)}function assertString(t){if(typeof t!=="string"){throw new TypeError(`Expected \`string\`, got \`${typeof t}\``)}}const _e=new globalThis.TextEncoder;function stringToUint8Array(t){assertString(t);return _e.encode(t)}function base64ToBase64Url(t){return t.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function base64UrlToBase64(t){return t.replaceAll("-","+").replaceAll("_","/")}const we=65535;function uint8ArrayToBase64(t,{urlSafe:r=false}={}){assertUint8Array(t);let i;if(t.length<we){i=globalThis.btoa(String.fromCodePoint.apply(this,t))}else{i="";for(const r of t){i+=String.fromCodePoint(r)}i=globalThis.btoa(i)}return r?base64ToBase64Url(i):i}function base64ToUint8Array(t){assertString(t);return Uint8Array.from(globalThis.atob(base64UrlToBase64(t)),(t=>t.codePointAt(0)))}function stringToBase64(t,{urlSafe:r=false}={}){assertString(t);return uint8ArrayToBase64(stringToUint8Array(t),{urlSafe:r})}function base64ToString(t){assertString(t);return uint8ArrayToString(base64ToUint8Array(t))}const Ee=Array.from({length:256},((t,r)=>r.toString(16).padStart(2,"0")));function uint8ArrayToHex(t){assertUint8Array(t);let r="";for(let i=0;i<t.length;i++){r+=Ee[t[i]]}return r}const Se={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function hexToUint8Array(t){assertString(t);if(t.length%2!==0){throw new Error("Invalid Hex string length.")}const r=t.length/2;const i=new Uint8Array(r);for(let o=0;o<r;o++){const r=Se[t[o*2]];const a=Se[t[o*2+1]];if(r===undefined||a===undefined){throw new Error(`Invalid Hex character encountered at position ${o*2}`)}i[o]=r<<4|a}return i}const $e=de["default"];const xe="aes-256-cbc";const createPlainObject=()=>Object.create(null);const isExist=t=>t!==undefined&&t!==null;const checkValueType=(t,r)=>{const i=new Set(["undefined","symbol","function"]);const o=typeof r;if(i.has(o)){throw new TypeError(`Setting a value of type \`${o}\` for key \`${t}\` is not allowed as it's not supported by JSON`)}};const Re="__internal__";const Oe=`${Re}.migrations.version`;class Conf{path;events;#e;#t;#r;#s={};constructor(t={}){const r={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:false,accessPropertiesByDotNotation:true,configFileMode:438,...t};if(!r.cwd){if(!r.projectName){throw new Error("Please specify the `projectName` option.")}r.cwd=envPaths(r.projectName,{suffix:r.projectSuffix}).config}this.#r=r;if(r.schema){if(typeof r.schema!=="object"){throw new TypeError("The `schema` option must be an object.")}const t=new he.Ajv2020({allErrors:true,useDefaults:true});$e(t);const i={type:"object",properties:r.schema};this.#e=t.compile(i);for(const[t,i]of Object.entries(r.schema)){if(i?.default){this.#s[t]=i.default}}}if(r.defaults){this.#s={...this.#s,...r.defaults}}if(r.serialize){this._serialize=r.serialize}if(r.deserialize){this._deserialize=r.deserialize}this.events=new EventTarget;this.#t=r.encryptionKey;const i=r.fileExtension?`.${r.fileExtension}`:"";this.path=S.resolve(r.cwd,`${r.configName??"config"}${i}`);const o=this.store;const a=Object.assign(createPlainObject(),r.defaults,o);if(r.migrations){if(!r.projectVersion){throw new Error("Please specify the `projectVersion` option.")}this._migrate(r.migrations,r.projectVersion,r.beforeEachMigration)}this._validate(a);try{x.deepEqual(o,a)}catch{this.store=a}if(r.watch){this._watch()}}get(t,r){if(this.#r.accessPropertiesByDotNotation){return this._get(t,r)}const{store:i}=this;return t in i?i[t]:r}set(t,r){if(typeof t!=="string"&&typeof t!=="object"){throw new TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof t}`)}if(typeof t!=="object"&&r===undefined){throw new TypeError("Use `delete()` to clear values")}if(this._containsReservedKey(t)){throw new TypeError(`Please don't use the ${Re} key, as it's used to manage this module internal operations.`)}const{store:i}=this;const set=(t,r)=>{checkValueType(t,r);if(this.#r.accessPropertiesByDotNotation){setProperty(i,t,r)}else{i[t]=r}};if(typeof t==="object"){const r=t;for(const[t,i]of Object.entries(r)){set(t,i)}}else{set(t,r)}this.store=i}has(t){if(this.#r.accessPropertiesByDotNotation){return hasProperty(this.store,t)}return t in this.store}reset(...t){for(const r of t){if(isExist(this.#s[r])){this.set(r,this.#s[r])}}}delete(t){const{store:r}=this;if(this.#r.accessPropertiesByDotNotation){deleteProperty(r,t)}else{delete r[t]}this.store=r}clear(){this.store=createPlainObject();for(const t of Object.keys(this.#s)){this.reset(t)}}onDidChange(t,r){if(typeof t!=="string"){throw new TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof t}`)}if(typeof r!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof r}`)}return this._handleChange((()=>this.get(t)),r)}onDidAnyChange(t){if(typeof t!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`)}return this._handleChange((()=>this.store),t)}get size(){return Object.keys(this.store).length}get store(){try{const t=E.readFileSync(this.path,this.#t?null:"utf8");const r=this._encryptData(t);const i=this._deserialize(r);this._validate(i);return Object.assign(createPlainObject(),i)}catch(t){if(t?.code==="ENOENT"){this._ensureDirectory();return createPlainObject()}if(this.#r.clearInvalidConfig&&t.name==="SyntaxError"){return createPlainObject()}throw t}}set store(t){this._ensureDirectory();this._validate(t);this._write(t);this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(const[t,r]of Object.entries(this.store)){yield[t,r]}}_encryptData(t){if(!this.#t){return typeof t==="string"?t:uint8ArrayToString(t)}try{const r=t.slice(0,16);const i=$.pbkdf2Sync(this.#t,r.toString(),1e4,32,"sha512");const o=$.createDecipheriv(xe,i,r);const a=t.slice(17);const c=typeof a==="string"?stringToUint8Array(a):a;return uint8ArrayToString(concatUint8Arrays([o.update(c),o.final()]))}catch{}return t.toString()}_handleChange(t,r){let i=t();const onChange=()=>{const o=i;const a=t();if((0,b.isDeepStrictEqual)(a,o)){return}i=a;r.call(this,a,o)};this.events.addEventListener("change",onChange);return()=>{this.events.removeEventListener("change",onChange)}}_deserialize=t=>JSON.parse(t);_serialize=t=>JSON.stringify(t,undefined,"\t");_validate(t){if(!this.#e){return}const r=this.#e(t);if(r||!this.#e.errors){return}const i=this.#e.errors.map((({instancePath:t,message:r=""})=>`\`${t.slice(1)}\` ${r}`));throw new Error("Config schema violation: "+i.join("; "))}_ensureDirectory(){E.mkdirSync(S.dirname(this.path),{recursive:true})}_write(t){let r=this._serialize(t);if(this.#t){const t=$.randomBytes(16);const i=$.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512");const o=$.createCipheriv(xe,i,t);r=concatUint8Arrays([t,stringToUint8Array(":"),o.update(stringToUint8Array(r)),o.final()])}if(w.env.SNAP){E.writeFileSync(this.path,r,{mode:this.#r.configFileMode})}else{try{writeFileSync(this.path,r,{mode:this.#r.configFileMode})}catch(t){if(t?.code==="EXDEV"){E.writeFileSync(this.path,r,{mode:this.#r.configFileMode});return}throw t}}}_watch(){this._ensureDirectory();if(!E.existsSync(this.path)){this._write(createPlainObject())}if(w.platform==="win32"){E.watch(this.path,{persistent:false},me((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:100}))}else{E.watchFile(this.path,{persistent:false},me((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:5e3}))}}_migrate(t,r,i){let o=this._get(Oe,"0.0.0");const a=Object.keys(t).filter((t=>this._shouldPerformMigration(t,o,r)));let c={...this.store};for(const l of a){try{if(i){i(this,{fromVersion:o,toVersion:l,finalVersion:r,versions:a})}const u=t[l];u?.(this);this._set(Oe,l);o=l;c={...this.store}}catch(t){this.store=c;throw new Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${t}`)}}if(this._isVersionInRangeFormat(o)||!ge.eq(o,r)){this._set(Oe,r)}}_containsReservedKey(t){if(typeof t==="object"){const r=Object.keys(t)[0];if(r===Re){return true}}if(typeof t!=="string"){return false}if(this.#r.accessPropertiesByDotNotation){if(t.startsWith(`${Re}.`)){return true}return false}return false}_isVersionInRangeFormat(t){return ge.clean(t)===null}_shouldPerformMigration(t,r,i){if(this._isVersionInRangeFormat(t)){if(r!=="0.0.0"&&ge.satisfies(r,t)){return false}return ge.satisfies(i,t)}if(ge.lte(t,r)){return false}if(ge.gt(t,i)){return false}return true}_get(t,r){return getProperty(this.store,t,r)}_set(t,r){const{store:i}=this;setProperty(i,t,r);this.store=i}}var Pe=__nccwpck_require__(6399);var Ae=__nccwpck_require__(5918);var Te=__nccwpck_require__.n(Ae);var Ce=__nccwpck_require__(9886);var ke=__nccwpck_require__.n(Ce);var Ie=__nccwpck_require__(8311);var Ne=__nccwpck_require__.n(Ie);const De=require("node:stream");const Le=require("node:stream/promises");var Me=__nccwpck_require__(2361);var je=__nccwpck_require__(7147);var Fe=__nccwpck_require__(5673);const Ue=require("node:string_decoder");const Be=typeof process==="object"&&process?process:{stdout:null,stderr:null};const isStream=t=>!!t&&typeof t==="object"&&(t instanceof Minipass||t instanceof De||isReadable(t)||isWritable(t));const isReadable=t=>!!t&&typeof t==="object"&&t instanceof Fe.EventEmitter&&typeof t.pipe==="function"&&t.pipe!==De.Writable.prototype.pipe;const isWritable=t=>!!t&&typeof t==="object"&&t instanceof Fe.EventEmitter&&typeof t.write==="function"&&typeof t.end==="function";const He=Symbol("EOF");const Ve=Symbol("maybeEmitEnd");const ze=Symbol("emittedEnd");const Ge=Symbol("emittingEnd");const qe=Symbol("emittedError");const We=Symbol("closed");const Ke=Symbol("read");const Ye=Symbol("flush");const Ze=Symbol("flushChunk");const Xe=Symbol("encoding");const Je=Symbol("decoder");const Qe=Symbol("flowing");const et=Symbol("paused");const tt=Symbol("resume");const rt=Symbol("buffer");const st=Symbol("pipes");const it=Symbol("bufferLength");const nt=Symbol("bufferPush");const ot=Symbol("bufferShift");const at=Symbol("objectMode");const ct=Symbol("destroyed");const ut=Symbol("error");const ht=Symbol("emitData");const dt=Symbol("emitEnd");const ft=Symbol("emitEnd2");const pt=Symbol("async");const mt=Symbol("abort");const yt=Symbol("aborted");const vt=Symbol("signal");const bt=Symbol("dataListeners");const _t=Symbol("discarded");const defer=t=>Promise.resolve().then(t);const nodefer=t=>t();const isEndish=t=>t==="end"||t==="finish"||t==="prefinish";const isArrayBufferLike=t=>t instanceof ArrayBuffer||!!t&&typeof t==="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0;const isArrayBufferView=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t);class Pipe{src;dest;opts;ondrain;constructor(t,r,i){this.src=t;this.dest=r;this.opts=i;this.ondrain=()=>t[tt]();this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe();if(this.opts.end)this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener("error",this.proxyErrors);super.unpipe()}constructor(t,r,i){super(t,r,i);this.proxyErrors=t=>r.emit("error",t);t.on("error",this.proxyErrors)}}const isObjectModeOptions=t=>!!t.objectMode;const isEncodingOptions=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer";class Minipass extends Fe.EventEmitter{[Qe]=false;[et]=false;[st]=[];[rt]=[];[at];[Xe];[pt];[Je];[He]=false;[ze]=false;[Ge]=false;[We]=false;[qe]=null;[it]=0;[ct]=false;[vt];[yt]=false;[bt]=0;[_t]=false;writable=true;readable=true;constructor(...t){const r=t[0]||{};super();if(r.objectMode&&typeof r.encoding==="string"){throw new TypeError("Encoding and objectMode may not be used together")}if(isObjectModeOptions(r)){this[at]=true;this[Xe]=null}else if(isEncodingOptions(r)){this[Xe]=r.encoding;this[at]=false}else{this[at]=false;this[Xe]=null}this[pt]=!!r.async;this[Je]=this[Xe]?new Ue.StringDecoder(this[Xe]):null;if(r&&r.debugExposeBuffer===true){Object.defineProperty(this,"buffer",{get:()=>this[rt]})}if(r&&r.debugExposePipes===true){Object.defineProperty(this,"pipes",{get:()=>this[st]})}const{signal:i}=r;if(i){this[vt]=i;if(i.aborted){this[mt]()}else{i.addEventListener("abort",(()=>this[mt]()))}}}get bufferLength(){return this[it]}get encoding(){return this[Xe]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[at]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[pt]}set["async"](t){this[pt]=this[pt]||!!t}[mt](){this[yt]=true;this.emit("abort",this[vt]?.reason);this.destroy(this[vt]?.reason)}get aborted(){return this[yt]}set aborted(t){}write(t,r,i){if(this[yt])return false;if(this[He])throw new Error("write after end");if(this[ct]){this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"}));return true}if(typeof r==="function"){i=r;r="utf8"}if(!r)r="utf8";const o=this[pt]?defer:nodefer;if(!this[at]&&!Buffer.isBuffer(t)){if(isArrayBufferView(t)){t=Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(isArrayBufferLike(t)){t=Buffer.from(t)}else if(typeof t!=="string"){throw new Error("Non-contiguous data written to non-objectMode stream")}}if(this[at]){if(this[Qe]&&this[it]!==0)this[Ye](true);if(this[Qe])this.emit("data",t);else this[nt](t);if(this[it]!==0)this.emit("readable");if(i)o(i);return this[Qe]}if(!t.length){if(this[it]!==0)this.emit("readable");if(i)o(i);return this[Qe]}if(typeof t==="string"&&!(r===this[Xe]&&!this[Je]?.lastNeed)){t=Buffer.from(t,r)}if(Buffer.isBuffer(t)&&this[Xe]){t=this[Je].write(t)}if(this[Qe]&&this[it]!==0)this[Ye](true);if(this[Qe])this.emit("data",t);else this[nt](t);if(this[it]!==0)this.emit("readable");if(i)o(i);return this[Qe]}read(t){if(this[ct])return null;this[_t]=false;if(this[it]===0||t===0||t&&t>this[it]){this[Ve]();return null}if(this[at])t=null;if(this[rt].length>1&&!this[at]){this[rt]=[this[Xe]?this[rt].join(""):Buffer.concat(this[rt],this[it])]}const r=this[Ke](t||null,this[rt][0]);this[Ve]();return r}[Ke](t,r){if(this[at])this[ot]();else{const i=r;if(t===i.length||t===null)this[ot]();else if(typeof i==="string"){this[rt][0]=i.slice(t);r=i.slice(0,t);this[it]-=t}else{this[rt][0]=i.subarray(t);r=i.subarray(0,t);this[it]-=t}}this.emit("data",r);if(!this[rt].length&&!this[He])this.emit("drain");return r}end(t,r,i){if(typeof t==="function"){i=t;t=undefined}if(typeof r==="function"){i=r;r="utf8"}if(t!==undefined)this.write(t,r);if(i)this.once("end",i);this[He]=true;this.writable=false;if(this[Qe]||!this[et])this[Ve]();return this}[tt](){if(this[ct])return;if(!this[bt]&&!this[st].length){this[_t]=true}this[et]=false;this[Qe]=true;this.emit("resume");if(this[rt].length)this[Ye]();else if(this[He])this[Ve]();else this.emit("drain")}resume(){return this[tt]()}pause(){this[Qe]=false;this[et]=true;this[_t]=false}get destroyed(){return this[ct]}get flowing(){return this[Qe]}get paused(){return this[et]}[nt](t){if(this[at])this[it]+=1;else this[it]+=t.length;this[rt].push(t)}[ot](){if(this[at])this[it]-=1;else this[it]-=this[rt][0].length;return this[rt].shift()}[Ye](t=false){do{}while(this[Ze](this[ot]())&&this[rt].length);if(!t&&!this[rt].length&&!this[He])this.emit("drain")}[Ze](t){this.emit("data",t);return this[Qe]}pipe(t,r){if(this[ct])return t;this[_t]=false;const i=this[ze];r=r||{};if(t===Be.stdout||t===Be.stderr)r.end=false;else r.end=r.end!==false;r.proxyErrors=!!r.proxyErrors;if(i){if(r.end)t.end()}else{this[st].push(!r.proxyErrors?new Pipe(this,t,r):new PipeProxyErrors(this,t,r));if(this[pt])defer((()=>this[tt]()));else this[tt]()}return t}unpipe(t){const r=this[st].find((r=>r.dest===t));if(r){if(this[st].length===1){if(this[Qe]&&this[bt]===0){this[Qe]=false}this[st]=[]}else this[st].splice(this[st].indexOf(r),1);r.unpipe()}}addListener(t,r){return this.on(t,r)}on(t,r){const i=super.on(t,r);if(t==="data"){this[_t]=false;this[bt]++;if(!this[st].length&&!this[Qe]){this[tt]()}}else if(t==="readable"&&this[it]!==0){super.emit("readable")}else if(isEndish(t)&&this[ze]){super.emit(t);this.removeAllListeners(t)}else if(t==="error"&&this[qe]){const t=r;if(this[pt])defer((()=>t.call(this,this[qe])));else t.call(this,this[qe])}return i}removeListener(t,r){return this.off(t,r)}off(t,r){const i=super.off(t,r);if(t==="data"){this[bt]=this.listeners("data").length;if(this[bt]===0&&!this[_t]&&!this[st].length){this[Qe]=false}}return i}removeAllListeners(t){const r=super.removeAllListeners(t);if(t==="data"||t===undefined){this[bt]=0;if(!this[_t]&&!this[st].length){this[Qe]=false}}return r}get emittedEnd(){return this[ze]}[Ve](){if(!this[Ge]&&!this[ze]&&!this[ct]&&this[rt].length===0&&this[He]){this[Ge]=true;this.emit("end");this.emit("prefinish");this.emit("finish");if(this[We])this.emit("close");this[Ge]=false}}emit(t,...r){const i=r[0];if(t!=="error"&&t!=="close"&&t!==ct&&this[ct]){return false}else if(t==="data"){return!this[at]&&!i?false:this[pt]?(defer((()=>this[ht](i))),true):this[ht](i)}else if(t==="end"){return this[dt]()}else if(t==="close"){this[We]=true;if(!this[ze]&&!this[ct])return false;const t=super.emit("close");this.removeAllListeners("close");return t}else if(t==="error"){this[qe]=i;super.emit(ut,i);const t=!this[vt]||this.listeners("error").length?super.emit("error",i):false;this[Ve]();return t}else if(t==="resume"){const t=super.emit("resume");this[Ve]();return t}else if(t==="finish"||t==="prefinish"){const r=super.emit(t);this.removeAllListeners(t);return r}const o=super.emit(t,...r);this[Ve]();return o}[ht](t){for(const r of this[st]){if(r.dest.write(t)===false)this.pause()}const r=this[_t]?false:super.emit("data",t);this[Ve]();return r}[dt](){if(this[ze])return false;this[ze]=true;this.readable=false;return this[pt]?(defer((()=>this[ft]())),true):this[ft]()}[ft](){if(this[Je]){const t=this[Je].end();if(t){for(const r of this[st]){r.dest.write(t)}if(!this[_t])super.emit("data",t)}}for(const t of this[st]){t.end()}const t=super.emit("end");this.removeAllListeners("end");return t}async collect(){const t=Object.assign([],{dataLength:0});if(!this[at])t.dataLength=0;const r=this.promise();this.on("data",(r=>{t.push(r);if(!this[at])t.dataLength+=r.length}));await r;return t}async concat(){if(this[at]){throw new Error("cannot concat in objectMode")}const t=await this.collect();return this[Xe]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,r)=>{this.on(ct,(()=>r(new Error("stream destroyed"))));this.on("error",(t=>r(t)));this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[_t]=false;let t=false;const stop=async()=>{this.pause();t=true;return{value:undefined,done:true}};const next=()=>{if(t)return stop();const r=this.read();if(r!==null)return Promise.resolve({done:false,value:r});if(this[He])return stop();let i;let o;const onerr=t=>{this.off("data",ondata);this.off("end",onend);this.off(ct,ondestroy);stop();o(t)};const ondata=t=>{this.off("error",onerr);this.off("end",onend);this.off(ct,ondestroy);this.pause();i({value:t,done:!!this[He]})};const onend=()=>{this.off("error",onerr);this.off("data",ondata);this.off(ct,ondestroy);stop();i({done:true,value:undefined})};const ondestroy=()=>onerr(new Error("stream destroyed"));return new Promise(((t,r)=>{o=r;i=t;this.once(ct,ondestroy);this.once("error",onerr);this.once("end",onend);this.once("data",ondata)}))};return{next:next,throw:stop,return:stop,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[_t]=false;let t=false;const stop=()=>{this.pause();this.off(ut,stop);this.off(ct,stop);this.off("end",stop);t=true;return{done:true,value:undefined}};const next=()=>{if(t)return stop();const r=this.read();return r===null?stop():{done:false,value:r}};this.once("end",stop);this.once(ut,stop);this.once(ct,stop);return{next:next,throw:stop,return:stop,[Symbol.iterator](){return this}}}destroy(t){if(this[ct]){if(t)this.emit("error",t);else this.emit(ct);return this}this[ct]=true;this[_t]=true;this[rt].length=0;this[it]=0;const r=this;if(typeof r.close==="function"&&!this[We])r.close();if(t)this.emit("error",t);else this.emit(ct);return this}static get isStream(){return isStream}}const wt=je.writev;const Et=Symbol("_autoClose");const St=Symbol("_close");const $t=Symbol("_ended");const xt=Symbol("_fd");const Rt=Symbol("_finished");const Ot=Symbol("_flags");const Pt=Symbol("_flush");const At=Symbol("_handleChunk");const Tt=Symbol("_makeBuf");const Ct=Symbol("_mode");const kt=Symbol("_needDrain");const It=Symbol("_onerror");const Nt=Symbol("_onopen");const Dt=Symbol("_onread");const Lt=Symbol("_onwrite");const Mt=Symbol("_open");const jt=Symbol("_path");const Ft=Symbol("_pos");const Ut=Symbol("_queue");const Bt=Symbol("_read");const Ht=Symbol("_readSize");const Vt=Symbol("_reading");const zt=Symbol("_remain");const Gt=Symbol("_size");const qt=Symbol("_write");const Wt=Symbol("_writing");const Kt=Symbol("_defaultFlag");const Yt=Symbol("_errored");class ReadStream extends Minipass{[Yt]=false;[xt];[jt];[Ht];[Vt]=false;[Gt];[zt];[Et];constructor(t,r){r=r||{};super(r);this.readable=true;this.writable=false;if(typeof t!=="string"){throw new TypeError("path must be a string")}this[Yt]=false;this[xt]=typeof r.fd==="number"?r.fd:undefined;this[jt]=t;this[Ht]=r.readSize||16*1024*1024;this[Vt]=false;this[Gt]=typeof r.size==="number"?r.size:Infinity;this[zt]=this[Gt];this[Et]=typeof r.autoClose==="boolean"?r.autoClose:true;if(typeof this[xt]==="number"){this[Bt]()}else{this[Mt]()}}get fd(){return this[xt]}get path(){return this[jt]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Mt](){je.open(this[jt],"r",((t,r)=>this[Nt](t,r)))}[Nt](t,r){if(t){this[It](t)}else{this[xt]=r;this.emit("open",r);this[Bt]()}}[Tt](){return Buffer.allocUnsafe(Math.min(this[Ht],this[zt]))}[Bt](){if(!this[Vt]){this[Vt]=true;const t=this[Tt]();if(t.length===0){return process.nextTick((()=>this[Dt](null,0,t)))}je.read(this[xt],t,0,t.length,null,((t,r,i)=>this[Dt](t,r,i)))}}[Dt](t,r,i){this[Vt]=false;if(t){this[It](t)}else if(this[At](r,i)){this[Bt]()}}[St](){if(this[Et]&&typeof this[xt]==="number"){const t=this[xt];this[xt]=undefined;je.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}[It](t){this[Vt]=true;this[St]();this.emit("error",t)}[At](t,r){let i=false;this[zt]-=t;if(t>0){i=super.write(t<r.length?r.subarray(0,t):r)}if(t===0||this[zt]<=0){i=false;this[St]();super.end()}return i}emit(t,...r){switch(t){case"prefinish":case"finish":return false;case"drain":if(typeof this[xt]==="number"){this[Bt]()}return false;case"error":if(this[Yt]){return false}this[Yt]=true;return super.emit(t,...r);default:return super.emit(t,...r)}}}class ReadStreamSync extends ReadStream{[Mt](){let t=true;try{this[Nt](null,je.openSync(this[jt],"r"));t=false}finally{if(t){this[St]()}}}[Bt](){let t=true;try{if(!this[Vt]){this[Vt]=true;do{const t=this[Tt]();const r=t.length===0?0:je.readSync(this[xt],t,0,t.length,null);if(!this[At](r,t)){break}}while(true);this[Vt]=false}t=false}finally{if(t){this[St]()}}}[St](){if(this[Et]&&typeof this[xt]==="number"){const t=this[xt];this[xt]=undefined;je.closeSync(t);this.emit("close")}}}class WriteStream extends Me{readable=false;writable=true;[Yt]=false;[Wt]=false;[$t]=false;[Ut]=[];[kt]=false;[jt];[Ct];[Et];[xt];[Kt];[Ot];[Rt]=false;[Ft];constructor(t,r){r=r||{};super(r);this[jt]=t;this[xt]=typeof r.fd==="number"?r.fd:undefined;this[Ct]=r.mode===undefined?438:r.mode;this[Ft]=typeof r.start==="number"?r.start:undefined;this[Et]=typeof r.autoClose==="boolean"?r.autoClose:true;const i=this[Ft]!==undefined?"r+":"w";this[Kt]=r.flags===undefined;this[Ot]=r.flags===undefined?i:r.flags;if(this[xt]===undefined){this[Mt]()}}emit(t,...r){if(t==="error"){if(this[Yt]){return false}this[Yt]=true}return super.emit(t,...r)}get fd(){return this[xt]}get path(){return this[jt]}[It](t){this[St]();this[Wt]=true;this.emit("error",t)}[Mt](){je.open(this[jt],this[Ot],this[Ct],((t,r)=>this[Nt](t,r)))}[Nt](t,r){if(this[Kt]&&this[Ot]==="r+"&&t&&t.code==="ENOENT"){this[Ot]="w";this[Mt]()}else if(t){this[It](t)}else{this[xt]=r;this.emit("open",r);if(!this[Wt]){this[Pt]()}}}end(t,r){if(t){this.write(t,r)}this[$t]=true;if(!this[Wt]&&!this[Ut].length&&typeof this[xt]==="number"){this[Lt](null,0)}return this}write(t,r){if(typeof t==="string"){t=Buffer.from(t,r)}if(this[$t]){this.emit("error",new Error("write() after end()"));return false}if(this[xt]===undefined||this[Wt]||this[Ut].length){this[Ut].push(t);this[kt]=true;return false}this[Wt]=true;this[qt](t);return true}[qt](t){je.write(this[xt],t,0,t.length,this[Ft],((t,r)=>this[Lt](t,r)))}[Lt](t,r){if(t){this[It](t)}else{if(this[Ft]!==undefined&&typeof r==="number"){this[Ft]+=r}if(this[Ut].length){this[Pt]()}else{this[Wt]=false;if(this[$t]&&!this[Rt]){this[Rt]=true;this[St]();this.emit("finish")}else if(this[kt]){this[kt]=false;this.emit("drain")}}}}[Pt](){if(this[Ut].length===0){if(this[$t]){this[Lt](null,0)}}else if(this[Ut].length===1){this[qt](this[Ut].pop())}else{const t=this[Ut];this[Ut]=[];wt(this[xt],t,this[Ft],((t,r)=>this[Lt](t,r)))}}[St](){if(this[Et]&&typeof this[xt]==="number"){const t=this[xt];this[xt]=undefined;je.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}}class WriteStreamSync extends WriteStream{[Mt](){let t;if(this[Kt]&&this[Ot]==="r+"){try{t=je.openSync(this[jt],this[Ot],this[Ct])}catch(t){if(t?.code==="ENOENT"){this[Ot]="w";return this[Mt]()}else{throw t}}}else{t=je.openSync(this[jt],this[Ot],this[Ct])}this[Nt](null,t)}[St](){if(this[Et]&&typeof this[xt]==="number"){const t=this[xt];this[xt]=undefined;je.closeSync(t);this.emit("close")}}[qt](t){let r=true;try{this[Lt](null,je.writeSync(this[xt],t,0,t.length,this[Ft]));r=false}finally{if(r){try{this[St]()}catch{}}}}}var Zt=__nccwpck_require__(1017);var Xt=__nccwpck_require__.n(Zt);const Jt=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"]]);const isSyncFile=t=>!!t.sync&&!!t.file;const isAsyncFile=t=>!t.sync&&!!t.file;const isSyncNoFile=t=>!!t.sync&&!t.file;const isAsyncNoFile=t=>!t.sync&&!t.file;const isSync=t=>!!t.sync;const isAsync=t=>!t.sync;const isFile=t=>!!t.file;const isNoFile=t=>!t.file;const dealiasKey=t=>{const r=Jt.get(t);if(r)return r;return t};const dealias=(t={})=>{if(!t)return{};const r={};for(const[i,o]of Object.entries(t)){const t=dealiasKey(i);r[t]=o}if(r.chmod===undefined&&r.noChmod===false){r.chmod=true}delete r.noChmod;return r};const makeCommand=(t,r,i,o,a)=>Object.assign(((c=[],l,u)=>{if(Array.isArray(c)){l=c;c={}}if(typeof l==="function"){u=l;l=undefined}if(!l){l=[]}else{l=Array.from(l)}const h=dealias(c);a?.(h,l);if(isSyncFile(h)){if(typeof u==="function"){throw new TypeError("callback not supported for sync tar functions")}return t(h,l)}else if(isAsyncFile(h)){const t=r(h,l);const i=u?u:undefined;return i?t.then((()=>i()),i):t}else if(isSyncNoFile(h)){if(typeof u==="function"){throw new TypeError("callback not supported for sync tar functions")}return i(h,l)}else if(isAsyncNoFile(h)){if(typeof u==="function"){throw new TypeError("callback only supported with file option")}return o(h,l)}else{throw new Error("impossible options??")}}),{syncFile:t,asyncFile:r,syncNoFile:i,asyncNoFile:o,validate:a});const Qt=require("assert");var er=__nccwpck_require__(4300);const tr=require("zlib");const rr=tr.constants||{ZLIB_VERNUM:4736};const sr=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:Infinity,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},rr));const ir=er.Buffer.concat;const nr=Symbol("_superWrite");class ZlibError extends Error{code;errno;constructor(t){super("zlib: "+t.message);this.code=t.code;this.errno=t.errno;if(!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+t.message;Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}const ar=Symbol("flushFlag");class ZlibBase extends Minipass{#i=false;#n=false;#o;#a;#c;#l;#u;get sawError(){return this.#i}get handle(){return this.#l}get flushFlag(){return this.#o}constructor(t,r){if(!t||typeof t!=="object")throw new TypeError("invalid options for ZlibBase constructor");super(t);this.#o=t.flush??0;this.#a=t.finishFlush??0;this.#c=t.fullFlushFlag??0;try{this.#l=new tr[r](t)}catch(t){throw new ZlibError(t)}this.#u=t=>{if(this.#i)return;this.#i=true;this.close();this.emit("error",t)};this.#l?.on("error",(t=>this.#u(new ZlibError(t))));this.once("end",(()=>this.close))}close(){if(this.#l){this.#l.close();this.#l=undefined;this.emit("close")}}reset(){if(!this.#i){Qt(this.#l,"zlib binding closed");return this.#l.reset?.()}}flush(t){if(this.ended)return;if(typeof t!=="number")t=this.#c;this.write(Object.assign(er.Buffer.alloc(0),{[ar]:t}))}end(t,r,i){if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(t){if(r)this.write(t,r);else this.write(t)}this.flush(this.#a);this.#n=true;return super.end(i)}get ended(){return this.#n}[nr](t){return super.write(t)}write(t,r,i){if(typeof r==="function")i=r,r="utf8";if(typeof t==="string")t=er.Buffer.from(t,r);if(this.#i)return;Qt(this.#l,"zlib binding closed");const o=this.#l._handle;const a=o.close;o.close=()=>{};const c=this.#l.close;this.#l.close=()=>{};er.Buffer.concat=t=>t;let l=undefined;try{const r=typeof t[ar]==="number"?t[ar]:this.#o;l=this.#l._processChunk(t,r);er.Buffer.concat=ir}catch(t){er.Buffer.concat=ir;this.#u(new ZlibError(t))}finally{if(this.#l){this.#l._handle=o;o.close=a;this.#l.close=c;this.#l.removeAllListeners("error")}}if(this.#l)this.#l.on("error",(t=>this.#u(new ZlibError(t))));let u;if(l){if(Array.isArray(l)&&l.length>0){const t=l[0];u=this[nr](er.Buffer.from(t));for(let t=1;t<l.length;t++){u=this[nr](l[t])}}else{u=this[nr](er.Buffer.from(l))}}if(i)i();return u}}class Zlib extends ZlibBase{#h;#d;constructor(t,r){t=t||{};t.flush=t.flush||sr.Z_NO_FLUSH;t.finishFlush=t.finishFlush||sr.Z_FINISH;t.fullFlushFlag=sr.Z_FULL_FLUSH;super(t,r);this.#h=t.level;this.#d=t.strategy}params(t,r){if(this.sawError)return;if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#h!==t||this.#d!==r){this.flush(sr.Z_SYNC_FLUSH);Qt(this.handle,"zlib binding closed");const i=this.handle.flush;this.handle.flush=(t,r)=>{if(typeof t==="function"){r=t;t=this.flushFlag}this.flush(t);r?.()};try{this.handle.params(t,r)}finally{this.handle.flush=i}if(this.handle){this.#h=t;this.#d=r}}}}class Deflate extends(null&&Zlib){constructor(t){super(t,"Deflate")}}class Inflate extends(null&&Zlib){constructor(t){super(t,"Inflate")}}class Gzip extends Zlib{#f;constructor(t){super(t,"Gzip");this.#f=t&&!!t.portable}[nr](t){if(!this.#f)return super[nr](t);this.#f=false;t[9]=255;return super[nr](t)}}class Gunzip extends(null&&Zlib){constructor(t){super(t,"Gunzip")}}class DeflateRaw extends(null&&Zlib){constructor(t){super(t,"DeflateRaw")}}class InflateRaw extends(null&&Zlib){constructor(t){super(t,"InflateRaw")}}class Unzip extends Zlib{constructor(t){super(t,"Unzip")}}class Brotli extends ZlibBase{constructor(t,r){t=t||{};t.flush=t.flush||sr.BROTLI_OPERATION_PROCESS;t.finishFlush=t.finishFlush||sr.BROTLI_OPERATION_FINISH;t.fullFlushFlag=sr.BROTLI_OPERATION_FLUSH;super(t,r)}}class BrotliCompress extends Brotli{constructor(t){super(t,"BrotliCompress")}}class BrotliDecompress extends Brotli{constructor(t){super(t,"BrotliDecompress")}}class Yallist{tail;head;length=0;static create(t=[]){return new Yallist(t)}constructor(t=[]){for(const r of t){this.push(r)}}*[Symbol.iterator](){for(let t=this.head;t;t=t.next){yield t.value}}removeNode(t){if(t.list!==this){throw new Error("removing node which does not belong to this list")}const r=t.next;const i=t.prev;if(r){r.prev=i}if(i){i.next=r}if(t===this.head){this.head=r}if(t===this.tail){this.tail=i}this.length--;t.next=undefined;t.prev=undefined;t.list=undefined;return r}unshiftNode(t){if(t===this.head){return}if(t.list){t.list.removeNode(t)}const r=this.head;t.list=this;t.next=r;if(r){r.prev=t}this.head=t;if(!this.tail){this.tail=t}this.length++}pushNode(t){if(t===this.tail){return}if(t.list){t.list.removeNode(t)}const r=this.tail;t.list=this;t.prev=r;if(r){r.next=t}this.tail=t;if(!this.head){this.head=t}this.length++}push(...t){for(let r=0,i=t.length;r<i;r++){push(this,t[r])}return this.length}unshift(...t){for(var r=0,i=t.length;r<i;r++){unshift(this,t[r])}return this.length}pop(){if(!this.tail){return undefined}const t=this.tail.value;const r=this.tail;this.tail=this.tail.prev;if(this.tail){this.tail.next=undefined}else{this.head=undefined}r.list=undefined;this.length--;return t}shift(){if(!this.head){return undefined}const t=this.head.value;const r=this.head;this.head=this.head.next;if(this.head){this.head.prev=undefined}else{this.tail=undefined}r.list=undefined;this.length--;return t}forEach(t,r){r=r||this;for(let i=this.head,o=0;!!i;o++){t.call(r,i.value,o,this);i=i.next}}forEachReverse(t,r){r=r||this;for(let i=this.tail,o=this.length-1;!!i;o--){t.call(r,i.value,o,this);i=i.prev}}get(t){let r=0;let i=this.head;for(;!!i&&r<t;r++){i=i.next}if(r===t&&!!i){return i.value}}getReverse(t){let r=0;let i=this.tail;for(;!!i&&r<t;r++){i=i.prev}if(r===t&&!!i){return i.value}}map(t,r){r=r||this;const i=new Yallist;for(let o=this.head;!!o;){i.push(t.call(r,o.value,this));o=o.next}return i}mapReverse(t,r){r=r||this;var i=new Yallist;for(let o=this.tail;!!o;){i.push(t.call(r,o.value,this));o=o.prev}return i}reduce(t,r){let i;let o=this.head;if(arguments.length>1){i=r}else if(this.head){o=this.head.next;i=this.head.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(var a=0;!!o;a++){i=t(i,o.value,a);o=o.next}return i}reduceReverse(t,r){let i;let o=this.tail;if(arguments.length>1){i=r}else if(this.tail){o=this.tail.prev;i=this.tail.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(let r=this.length-1;!!o;r--){i=t(i,o.value,r);o=o.prev}return i}toArray(){const t=new Array(this.length);for(let r=0,i=this.head;!!i;r++){t[r]=i.value;i=i.next}return t}toArrayReverse(){const t=new Array(this.length);for(let r=0,i=this.tail;!!i;r++){t[r]=i.value;i=i.prev}return t}slice(t=0,r=this.length){if(r<0){r+=this.length}if(t<0){t+=this.length}const i=new Yallist;if(r<t||r<0){return i}if(t<0){t=0}if(r>this.length){r=this.length}let o=this.head;let a=0;for(a=0;!!o&&a<t;a++){o=o.next}for(;!!o&&a<r;a++,o=o.next){i.push(o.value)}return i}sliceReverse(t=0,r=this.length){if(r<0){r+=this.length}if(t<0){t+=this.length}const i=new Yallist;if(r<t||r<0){return i}if(t<0){t=0}if(r>this.length){r=this.length}let o=this.length;let a=this.tail;for(;!!a&&o>r;o--){a=a.prev}for(;!!a&&o>t;o--,a=a.prev){i.push(a.value)}return i}splice(t,r=0,...i){if(t>this.length){t=this.length-1}if(t<0){t=this.length+t}let o=this.head;for(let r=0;!!o&&r<t;r++){o=o.next}const a=[];for(let t=0;!!o&&t<r;t++){a.push(o.value);o=this.removeNode(o)}if(!o){o=this.tail}else if(o!==this.tail){o=o.prev}for(const t of i){o=insertAfter(this,o,t)}return a}reverse(){const t=this.head;const r=this.tail;for(let r=t;!!r;r=r.prev){const t=r.prev;r.prev=r.next;r.next=t}this.head=r;this.tail=t;return this}}function insertAfter(t,r,i){const o=r;const a=r?r.next:t.head;const c=new Node(i,o,a,t);if(c.next===undefined){t.tail=c}if(c.prev===undefined){t.head=c}t.length++;return c}function push(t,r){t.tail=new Node(r,t.tail,undefined,t);if(!t.head){t.head=t.tail}t.length++}function unshift(t,r){t.head=new Node(r,undefined,t.head,t);if(!t.tail){t.tail=t.head}t.length++}class Node{list;next;prev;value;constructor(t,r,i,o){this.list=o;this.value=t;if(r){r.next=this;this.prev=r}else{this.prev=undefined}if(i){i.prev=this;this.next=i}else{this.next=undefined}}}const encode=(t,r)=>{if(!Number.isSafeInteger(t)){throw Error("cannot encode number outside of javascript safe integer range")}else if(t<0){encodeNegative(t,r)}else{encodePositive(t,r)}return r};const encodePositive=(t,r)=>{r[0]=128;for(var i=r.length;i>1;i--){r[i-1]=t&255;t=Math.floor(t/256)}};const encodeNegative=(t,r)=>{r[0]=255;var i=false;t=t*-1;for(var o=r.length;o>1;o--){var a=t&255;t=Math.floor(t/256);if(i){r[o-1]=onesComp(a)}else if(a===0){r[o-1]=0}else{i=true;r[o-1]=twosComp(a)}}};const parse=t=>{const r=t[0];const i=r===128?pos(t.subarray(1,t.length)):r===255?twos(t):null;if(i===null){throw Error("invalid base256 encoding")}if(!Number.isSafeInteger(i)){throw Error("parsed number outside of javascript safe integer range")}return i};const twos=t=>{var r=t.length;var i=0;var o=false;for(var a=r-1;a>-1;a--){var c=Number(t[a]);var l;if(o){l=onesComp(c)}else if(c===0){l=c}else{o=true;l=twosComp(c)}if(l!==0){i-=l*Math.pow(256,r-a-1)}}return i};const pos=t=>{var r=t.length;var i=0;for(var o=r-1;o>-1;o--){var a=Number(t[o]);if(a!==0){i+=a*Math.pow(256,r-o-1)}}return i};const onesComp=t=>(255^t)&255;const twosComp=t=>(255^t)+1&255;const isCode=t=>cr.has(t);const isName=t=>lr.has(t);const cr=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"]]);const lr=new Map(Array.from(cr).map((t=>[t[1],t[0]])));class Header{cksumValid=false;needPax=false;nullBlock=false;block;path;mode;uid;gid;size;cksum;#p="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,r=0,i,o){if(Buffer.isBuffer(t)){this.decode(t,r||0,i,o)}else if(t){this.#m(t)}}decode(t,r,i,o){if(!r){r=0}if(!t||!(t.length>=r+512)){throw new Error("need 512 bytes for header")}this.path=decString(t,r,100);this.mode=decNumber(t,r+100,8);this.uid=decNumber(t,r+108,8);this.gid=decNumber(t,r+116,8);this.size=decNumber(t,r+124,12);this.mtime=decDate(t,r+136,12);this.cksum=decNumber(t,r+148,12);if(o)this.#m(o,true);if(i)this.#m(i);const a=decString(t,r+156,1);if(isCode(a)){this.#p=a||"0"}if(this.#p==="0"&&this.path.slice(-1)==="/"){this.#p="5"}if(this.#p==="5"){this.size=0}this.linkpath=decString(t,r+157,100);if(t.subarray(r+257,r+265).toString()==="ustar\x0000"){this.uname=decString(t,r+265,32);this.gname=decString(t,r+297,32);this.devmaj=decNumber(t,r+329,8)??0;this.devmin=decNumber(t,r+337,8)??0;if(t[r+475]!==0){const i=decString(t,r+345,155);this.path=i+"/"+this.path}else{const i=decString(t,r+345,130);if(i){this.path=i+"/"+this.path}this.atime=decDate(t,r+476,12);this.ctime=decDate(t,r+488,12)}}let c=8*32;for(let i=r;i<r+148;i++){c+=t[i]}for(let i=r+156;i<r+512;i++){c+=t[i]}this.cksumValid=c===this.cksum;if(this.cksum===undefined&&c===8*32){this.nullBlock=true}}#m(t,r=false){Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(i===null||i===undefined||t==="path"&&r||t==="linkpath"&&r||t==="global")))))}encode(t,r=0){if(!t){t=this.block=Buffer.alloc(512)}if(this.#p==="Unsupported"){this.#p="0"}if(!(t.length>=r+512)){throw new Error("need 512 bytes for header")}const i=this.ctime||this.atime?130:155;const o=splitPrefix(this.path||"",i);const a=o[0];const c=o[1];this.needPax=!!o[2];this.needPax=encString(t,r,100,a)||this.needPax;this.needPax=encNumber(t,r+100,8,this.mode)||this.needPax;this.needPax=encNumber(t,r+108,8,this.uid)||this.needPax;this.needPax=encNumber(t,r+116,8,this.gid)||this.needPax;this.needPax=encNumber(t,r+124,12,this.size)||this.needPax;this.needPax=encDate(t,r+136,12,this.mtime)||this.needPax;t[r+156]=this.#p.charCodeAt(0);this.needPax=encString(t,r+157,100,this.linkpath)||this.needPax;t.write("ustar\x0000",r+257,8);this.needPax=encString(t,r+265,32,this.uname)||this.needPax;this.needPax=encString(t,r+297,32,this.gname)||this.needPax;this.needPax=encNumber(t,r+329,8,this.devmaj)||this.needPax;this.needPax=encNumber(t,r+337,8,this.devmin)||this.needPax;this.needPax=encString(t,r+345,i,c)||this.needPax;if(t[r+475]!==0){this.needPax=encString(t,r+345,155,c)||this.needPax}else{this.needPax=encString(t,r+345,130,c)||this.needPax;this.needPax=encDate(t,r+476,12,this.atime)||this.needPax;this.needPax=encDate(t,r+488,12,this.ctime)||this.needPax}let l=8*32;for(let i=r;i<r+148;i++){l+=t[i]}for(let i=r+156;i<r+512;i++){l+=t[i]}this.cksum=l;encNumber(t,r+148,8,this.cksum);this.cksumValid=true;return this.needPax}get type(){return this.#p==="Unsupported"?this.#p:cr.get(this.#p)}get typeKey(){return this.#p}set type(t){const r=String(lr.get(t));if(isCode(r)||r==="Unsupported"){this.#p=r}else if(isCode(t)){this.#p=t}else{throw new TypeError("invalid entry type: "+t)}}}const splitPrefix=(t,r)=>{const i=100;let o=t;let a="";let c=undefined;const l=S.posix.parse(t).root||".";if(Buffer.byteLength(o)<i){c=[o,a,false]}else{a=S.posix.dirname(o);o=S.posix.basename(o);do{if(Buffer.byteLength(o)<=i&&Buffer.byteLength(a)<=r){c=[o,a,false]}else if(Buffer.byteLength(o)>i&&Buffer.byteLength(a)<=r){c=[o.slice(0,i-1),a,true]}else{o=S.posix.join(S.posix.basename(a),o);a=S.posix.dirname(a)}}while(a!==l&&c===undefined);if(!c){c=[t.slice(0,i-1),"",true]}}return c};const decString=(t,r,i)=>t.subarray(r,r+i).toString("utf8").replace(/\0.*/,"");const decDate=(t,r,i)=>numToDate(decNumber(t,r,i));const numToDate=t=>t===undefined?undefined:new Date(t*1e3);const decNumber=(t,r,i)=>Number(t[r])&128?parse(t.subarray(r,r+i)):decSmallNumber(t,r,i);const nanUndef=t=>isNaN(t)?undefined:t;const decSmallNumber=(t,r,i)=>nanUndef(parseInt(t.subarray(r,r+i).toString("utf8").replace(/\0.*$/,"").trim(),8));const ur={12:8589934591,8:2097151};const encNumber=(t,r,i,o)=>o===undefined?false:o>ur[i]||o<0?(encode(o,t.subarray(r,r+i)),true):(encSmallNumber(t,r,i,o),false);const encSmallNumber=(t,r,i,o)=>t.write(octalString(o,i),r,i,"ascii");const octalString=(t,r)=>padOctal(Math.floor(t).toString(8),r);const padOctal=(t,r)=>(t.length===r-1?t:new Array(r-t.length-1).join("0")+t+" ")+"\0";const encDate=(t,r,i,o)=>o===undefined?false:encNumber(t,r,i,o.getTime()/1e3);const hr=new Array(156).join("\0");const encString=(t,r,i,o)=>o===undefined?false:(t.write(o+hr,r,i,"utf8"),o.length!==Buffer.byteLength(o)||o.length>i);class Pax{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,r=false){this.atime=t.atime;this.charset=t.charset;this.comment=t.comment;this.ctime=t.ctime;this.dev=t.dev;this.gid=t.gid;this.global=r;this.gname=t.gname;this.ino=t.ino;this.linkpath=t.linkpath;this.mtime=t.mtime;this.nlink=t.nlink;this.path=t.path;this.size=t.size;this.uid=t.uid;this.uname=t.uname}encode(){const t=this.encodeBody();if(t===""){return Buffer.allocUnsafe(0)}const r=Buffer.byteLength(t);const i=512*Math.ceil(1+r/512);const o=Buffer.allocUnsafe(i);for(let t=0;t<512;t++){o[t]=0}new Header({path:("PaxHeader/"+(0,S.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:r,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(o);o.write(t,512,r,"utf8");for(let t=r+512;t<o.length;t++){o[t]=0}return o}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===undefined){return""}const r=this[t];const i=r instanceof Date?r.getTime()/1e3:r;const o=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+i+"\n";const a=Buffer.byteLength(o);let c=Math.floor(Math.log(a)/Math.log(10))+1;if(a+c>=Math.pow(10,c)){c+=1}const l=c+a;return l+o}static parse(t,r,i=false){return new Pax(merge(parseKV(t),r),i)}}const merge=(t,r)=>r?Object.assign({},r,t):t;const parseKV=t=>t.replace(/\n$/,"").split("\n").reduce(parseKVLine,Object.create(null));const parseKVLine=(t,r)=>{const i=parseInt(r,10);if(i!==Buffer.byteLength(r)+1){return t}r=r.slice((i+" ").length);const o=r.split("=");const a=o.shift();if(!a){return t}const c=a.replace(/^SCHILY\.(dev|ino|nlink)/,"$1");const l=o.join("=");t[c]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(c)?new Date(Number(l)*1e3):/^[0-9]+$/.test(l)?+l:l;return t};const dr=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const fr=dr!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");class ReadEntry extends Minipass{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=false;ignore=false;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=false;absolute;unsupported=false;constructor(t,r,i){super({});this.pause();this.extended=r;this.globalExtended=i;this.header=t;this.remain=t.size??0;this.startBlockSize=512*Math.ceil(this.remain/512);this.blockRemain=this.startBlockSize;this.type=t.type;switch(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=true;break;default:this.ignore=true}if(!t.path){throw new Error("no path provided for tar.ReadEntry")}this.path=fr(t.path);this.mode=t.mode;if(this.mode){this.mode=this.mode&4095}this.uid=t.uid;this.gid=t.gid;this.uname=t.uname;this.gname=t.gname;this.size=this.remain;this.mtime=t.mtime;this.atime=t.atime;this.ctime=t.ctime;this.linkpath=t.linkpath?fr(t.linkpath):undefined;this.uname=t.uname;this.gname=t.gname;if(r){this.#m(r)}if(i){this.#m(i,true)}}write(t){const r=t.length;if(r>this.blockRemain){throw new Error("writing more to entry than is appropriate")}const i=this.remain;const o=this.blockRemain;this.remain=Math.max(0,i-r);this.blockRemain=Math.max(0,o-r);if(this.ignore){return true}if(i>=r){return super.write(t)}return super.write(t.subarray(0,i))}#m(t,r=false){if(t.path)t.path=fr(t.path);if(t.linkpath)t.linkpath=fr(t.linkpath);Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(i===null||i===undefined||t==="path"&&r)))))}}const warnMethod=(t,r,i,o={})=>{if(t.file){o.file=t.file}if(t.cwd){o.cwd=t.cwd}o.code=i instanceof Error&&i.code||r;o.tarCode=r;if(!t.strict&&o.recoverable!==false){if(i instanceof Error){o=Object.assign(i,o);i=i.message}t.emit("warn",r,i,o)}else if(i instanceof Error){t.emit("error",Object.assign(i,o))}else{t.emit("error",Object.assign(new Error(`${r}: ${i}`),o))}};const pr=1024*1024;const mr=Buffer.from([31,139]);const gr=Symbol("state");const yr=Symbol("writeEntry");const vr=Symbol("readEntry");const br=Symbol("nextEntry");const _r=Symbol("processEntry");const wr=Symbol("extendedHeader");const Er=Symbol("globalExtendedHeader");const Sr=Symbol("meta");const $r=Symbol("emitMeta");const xr=Symbol("buffer");const Rr=Symbol("queue");const Or=Symbol("ended");const Pr=Symbol("emittedEnd");const Ar=Symbol("emit");const Tr=Symbol("unzip");const Cr=Symbol("consumeChunk");const kr=Symbol("consumeChunkSub");const Ir=Symbol("consumeBody");const Nr=Symbol("consumeMeta");const Dr=Symbol("consumeHeader");const Lr=Symbol("consuming");const Mr=Symbol("bufferConcat");const jr=Symbol("maybeEnd");const Fr=Symbol("writing");const Ur=Symbol("aborted");const Br=Symbol("onDone");const Hr=Symbol("sawValidEntry");const Vr=Symbol("sawNullBlock");const zr=Symbol("sawEOF");const Gr=Symbol("closeStream");const noop=()=>true;class Parser extends Me.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;writable=true;readable=false;[Rr]=new Yallist;[xr];[vr];[yr];[gr]="begin";[Sr]="";[wr];[Er];[Or]=false;[Tr];[Ur]=false;[Hr];[Vr]=false;[zr]=false;[Fr]=false;[Lr]=false;[Pr]=false;constructor(t={}){super();this.file=t.file||"";this.on(Br,(()=>{if(this[gr]==="begin"||this[Hr]===false){this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}}));if(t.ondone){this.on(Br,t.ondone)}else{this.on(Br,(()=>{this.emit("prefinish");this.emit("finish");this.emit("end")}))}this.strict=!!t.strict;this.maxMetaEntrySize=t.maxMetaEntrySize||pr;this.filter=typeof t.filter==="function"?t.filter:noop;const r=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!t.gzip&&t.brotli!==undefined?t.brotli:r?undefined:false;this.on("end",(()=>this[Gr]()));if(typeof t.onwarn==="function"){this.on("warn",t.onwarn)}if(typeof t.onReadEntry==="function"){this.on("entry",t.onReadEntry)}}warn(t,r,i={}){warnMethod(this,t,r,i)}[Dr](t,r){if(this[Hr]===undefined){this[Hr]=false}let i;try{i=new Header(t,r,this[wr],this[Er])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(i.nullBlock){if(this[Vr]){this[zr]=true;if(this[gr]==="begin"){this[gr]="header"}this[Ar]("eof")}else{this[Vr]=true;this[Ar]("nullBlock")}}else{this[Vr]=false;if(!i.cksumValid){this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i})}else if(!i.path){this.warn("TAR_ENTRY_INVALID","path is required",{header:i})}else{const t=i.type;if(/^(Symbolic)?Link$/.test(t)&&!i.linkpath){this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i})}else if(!/^(Symbolic)?Link$/.test(t)&&!/^(Global)?ExtendedHeader$/.test(t)&&i.linkpath){this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i})}else{const t=this[yr]=new ReadEntry(i,this[wr],this[Er]);if(!this[Hr]){if(t.remain){const onend=()=>{if(!t.invalid){this[Hr]=true}};t.on("end",onend)}else{this[Hr]=true}}if(t.meta){if(t.size>this.maxMetaEntrySize){t.ignore=true;this[Ar]("ignoredEntry",t);this[gr]="ignore";t.resume()}else if(t.size>0){this[Sr]="";t.on("data",(t=>this[Sr]+=t));this[gr]="meta"}}else{this[wr]=undefined;t.ignore=t.ignore||!this.filter(t.path,t);if(t.ignore){this[Ar]("ignoredEntry",t);this[gr]=t.remain?"ignore":"header";t.resume()}else{if(t.remain){this[gr]="body"}else{this[gr]="header";t.end()}if(!this[vr]){this[Rr].push(t);this[br]()}else{this[Rr].push(t)}}}}}}}[Gr](){queueMicrotask((()=>this.emit("close")))}[_r](t){let r=true;if(!t){this[vr]=undefined;r=false}else if(Array.isArray(t)){const[r,...i]=t;this.emit(r,...i)}else{this[vr]=t;this.emit("entry",t);if(!t.emittedEnd){t.on("end",(()=>this[br]()));r=false}}return r}[br](){do{}while(this[_r](this[Rr].shift()));if(!this[Rr].length){const t=this[vr];const r=!t||t.flowing||t.size===t.remain;if(r){if(!this[Fr]){this.emit("drain")}}else{t.once("drain",(()=>this.emit("drain")))}}}[Ir](t,r){const i=this[yr];if(!i){throw new Error("attempt to consume body without entry??")}const o=i.blockRemain??0;const a=o>=t.length&&r===0?t:t.subarray(r,r+o);i.write(a);if(!i.blockRemain){this[gr]="header";this[yr]=undefined;i.end()}return a.length}[Nr](t,r){const i=this[yr];const o=this[Ir](t,r);if(!this[yr]&&i){this[$r](i)}return o}[Ar](t,r,i){if(!this[Rr].length&&!this[vr]){this.emit(t,r,i)}else{this[Rr].push([t,r,i])}}[$r](t){this[Ar]("meta",this[Sr]);switch(t.type){case"ExtendedHeader":case"OldExtendedHeader":this[wr]=Pax.parse(this[Sr],this[wr],false);break;case"GlobalExtendedHeader":this[Er]=Pax.parse(this[Sr],this[Er],true);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const t=this[wr]??Object.create(null);this[wr]=t;t.path=this[Sr].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const t=this[wr]||Object.create(null);this[wr]=t;t.linkpath=this[Sr].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){this[Ur]=true;this.emit("abort",t);this.warn("TAR_ABORT",t,{recoverable:false})}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}if(this[Ur]){i?.();return false}const o=this[Tr]===undefined||this.brotli===undefined&&this[Tr]===false;if(o&&t){if(this[xr]){t=Buffer.concat([this[xr],t]);this[xr]=undefined}if(t.length<mr.length){this[xr]=t;i?.();return true}for(let r=0;this[Tr]===undefined&&r<mr.length;r++){if(t[r]!==mr[r]){this[Tr]=false}}const r=this.brotli===undefined;if(this[Tr]===false&&r){if(t.length<512){if(this[Or]){this.brotli=true}else{this[xr]=t;i?.();return true}}else{try{new Header(t.subarray(0,512));this.brotli=false}catch(t){this.brotli=true}}}if(this[Tr]===undefined||this[Tr]===false&&this.brotli){const r=this[Or];this[Or]=false;this[Tr]=this[Tr]===undefined?new Unzip({}):new BrotliDecompress({});this[Tr].on("data",(t=>this[Cr](t)));this[Tr].on("error",(t=>this.abort(t)));this[Tr].on("end",(()=>{this[Or]=true;this[Cr]()}));this[Fr]=true;const o=!!this[Tr][r?"end":"write"](t);this[Fr]=false;i?.();return o}}this[Fr]=true;if(this[Tr]){this[Tr].write(t)}else{this[Cr](t)}this[Fr]=false;const a=this[Rr].length?false:this[vr]?this[vr].flowing:true;if(!a&&!this[Rr].length){this[vr]?.once("drain",(()=>this.emit("drain")))}i?.();return a}[Mr](t){if(t&&!this[Ur]){this[xr]=this[xr]?Buffer.concat([this[xr],t]):t}}[jr](){if(this[Or]&&!this[Pr]&&!this[Ur]&&!this[Lr]){this[Pr]=true;const t=this[yr];if(t&&t.blockRemain){const r=this[xr]?this[xr].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${r} available)`,{entry:t});if(this[xr]){t.write(this[xr])}t.end()}this[Ar](Br)}}[Cr](t){if(this[Lr]&&t){this[Mr](t)}else if(!t&&!this[xr]){this[jr]()}else if(t){this[Lr]=true;if(this[xr]){this[Mr](t);const r=this[xr];this[xr]=undefined;this[kr](r)}else{this[kr](t)}while(this[xr]&&this[xr]?.length>=512&&!this[Ur]&&!this[zr]){const t=this[xr];this[xr]=undefined;this[kr](t)}this[Lr]=false}if(!this[xr]||this[Or]){this[jr]()}}[kr](t){let r=0;const i=t.length;while(r+512<=i&&!this[Ur]&&!this[zr]){switch(this[gr]){case"begin":case"header":this[Dr](t,r);r+=512;break;case"ignore":case"body":r+=this[Ir](t,r);break;case"meta":r+=this[Nr](t,r);break;default:throw new Error("invalid state: "+this[gr])}}if(r<i){if(this[xr]){this[xr]=Buffer.concat([t.subarray(r),this[xr]])}else{this[xr]=t.subarray(r)}}}end(t,r,i){if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,r)}if(i)this.once("finish",i);if(!this[Ur]){if(this[Tr]){if(t)this[Tr].write(t);this[Tr].end()}else{this[Or]=true;if(this.brotli===undefined)t=t||Buffer.alloc(0);if(t)this.write(t);this[jr]()}}return this}}const stripTrailingSlashes=t=>{let r=t.length-1;let i=-1;while(r>-1&&t.charAt(r)==="/"){i=r;r--}return i===-1?t:t.slice(0,i)};const onReadEntryFunction=t=>{const r=t.onReadEntry;t.onReadEntry=r?t=>{r(t);t.resume()}:t=>t.resume()};const filesFilter=(t,r)=>{const i=new Map(r.map((t=>[stripTrailingSlashes(t),true])));const o=t.filter;const mapHas=(t,r="")=>{const o=r||(0,Zt.parse)(t).root||".";let a;if(t===o)a=false;else{const r=i.get(t);if(r!==undefined){a=r}else{a=mapHas((0,Zt.dirname)(t),o)}}i.set(t,a);return a};t.filter=o?(t,r)=>o(t,r)&&mapHas(stripTrailingSlashes(t)):t=>mapHas(stripTrailingSlashes(t))};const listFileSync=t=>{const r=new Parser(t);const i=t.file;let o;try{const a=E.statSync(i);const c=t.maxReadSize||16*1024*1024;if(a.size<c){r.end(E.readFileSync(i))}else{let t=0;const l=Buffer.allocUnsafe(c);o=E.openSync(i,"r");while(t<a.size){const i=E.readSync(o,l,0,c,t);t+=i;r.write(l.subarray(0,i))}r.end()}}finally{if(typeof o==="number"){try{E.closeSync(o)}catch(t){}}}};const listFile=(t,r)=>{const i=new Parser(t);const o=t.maxReadSize||16*1024*1024;const a=t.file;const c=new Promise(((t,r)=>{i.on("error",r);i.on("end",t);E.stat(a,((t,c)=>{if(t){r(t)}else{const t=new ReadStream(a,{readSize:o,size:c.size});t.on("error",r);t.pipe(i)}}))}));return c};const qr=makeCommand(listFileSync,listFile,(t=>new Parser(t)),(t=>new Parser(t)),((t,r)=>{if(r?.length)filesFilter(t,r);if(!t.noResume)onReadEntryFunction(t)}));const modeFix=(t,r,i)=>{t&=4095;if(i){t=(t|384)&~18}if(r){if(t&256){t|=64}if(t&32){t|=8}if(t&4){t|=1}}return t};const{isAbsolute:Wr,parse:Kr}=S.win32;const stripAbsolutePath=t=>{let r="";let i=Kr(t);while(Wr(t)||i.root){const o=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":i.root;t=t.slice(o.length);r+=o;i=Kr(t)}return[r,t]};const Yr=["|","<",">","?",":"];const Zr=Yr.map((t=>String.fromCharCode(61440+t.charCodeAt(0))));const Xr=new Map(Yr.map(((t,r)=>[t,Zr[r]])));const Jr=new Map(Zr.map(((t,r)=>[t,Yr[r]])));const winchars_encode=t=>Yr.reduce(((t,r)=>t.split(r).join(Xr.get(r))),t);const decode=t=>Zr.reduce(((t,r)=>t.split(r).join(Jr.get(r))),t);const prefixPath=(t,r)=>{if(!r){return fr(t)}t=fr(t).replace(/^\.(\/|$)/,"");return stripTrailingSlashes(r)+"/"+t};const Qr=16*1024*1024;const es=Symbol("process");const ts=Symbol("file");const rs=Symbol("directory");const ss=Symbol("symlink");const is=Symbol("hardlink");const ns=Symbol("header");const os=Symbol("read");const as=Symbol("lstat");const cs=Symbol("onlstat");const ls=Symbol("onread");const us=Symbol("onreadlink");const hs=Symbol("openfile");const ds=Symbol("onopenfile");const ps=Symbol("close");const ms=Symbol("mode");const gs=Symbol("awaitDrain");const ys=Symbol("ondrain");const vs=Symbol("prefix");class WriteEntry extends Minipass{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#g=false;constructor(t,r={}){const i=dealias(r);super();this.path=fr(t);this.portable=!!i.portable;this.maxReadSize=i.maxReadSize||Qr;this.linkCache=i.linkCache||new Map;this.statCache=i.statCache||new Map;this.preservePaths=!!i.preservePaths;this.cwd=fr(i.cwd||process.cwd());this.strict=!!i.strict;this.noPax=!!i.noPax;this.noMtime=!!i.noMtime;this.mtime=i.mtime;this.prefix=i.prefix?fr(i.prefix):undefined;this.onWriteEntry=i.onWriteEntry;if(typeof i.onwarn==="function"){this.on("warn",i.onwarn)}let o=false;if(!this.preservePaths){const[t,r]=stripAbsolutePath(this.path);if(t&&typeof r==="string"){this.path=r;o=t}}this.win32=!!i.win32||process.platform==="win32";if(this.win32){this.path=decode(this.path.replace(/\\/g,"/"));t=t.replace(/\\/g,"/")}this.absolute=fr(i.absolute||Zt.resolve(this.cwd,t));if(this.path===""){this.path="./"}if(o){this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path})}const a=this.statCache.get(this.absolute);if(a){this[cs](a)}else{this[as]()}}warn(t,r,i={}){return warnMethod(this,t,r,i)}emit(t,...r){if(t==="error"){this.#g=true}return super.emit(t,...r)}[as](){je.lstat(this.absolute,((t,r)=>{if(t){return this.emit("error",t)}this[cs](r)}))}[cs](t){this.statCache.set(this.absolute,t);this.stat=t;if(!t.isFile()){t.size=0}this.type=getType(t);this.emit("stat",t);this[es]()}[es](){switch(this.type){case"File":return this[ts]();case"Directory":return this[rs]();case"SymbolicLink":return this[ss]();default:return this.end()}}[ms](t){return modeFix(t,this.type==="Directory",this.portable)}[vs](t){return prefixPath(t,this.prefix)}[ns](){if(!this.stat){throw new Error("cannot write header before stat")}if(this.type==="Directory"&&this.portable){this.noMtime=true}this.onWriteEntry?.(this);this.header=new Header({path:this[vs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[vs](this.linkpath):this.linkpath,mode:this[ms](this.stat.mode),uid:this.portable?undefined:this.stat.uid,gid:this.portable?undefined:this.stat.gid,size:this.stat.size,mtime:this.noMtime?undefined:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?undefined:this.type,uname:this.portable?undefined:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?undefined:this.stat.atime,ctime:this.portable?undefined:this.stat.ctime});if(this.header.encode()&&!this.noPax){super.write(new Pax({atime:this.portable?undefined:this.header.atime,ctime:this.portable?undefined:this.header.ctime,gid:this.portable?undefined:this.header.gid,mtime:this.noMtime?undefined:this.mtime||this.header.mtime,path:this[vs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[vs](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?undefined:this.header.uid,uname:this.portable?undefined:this.header.uname,dev:this.portable?undefined:this.stat.dev,ino:this.portable?undefined:this.stat.ino,nlink:this.portable?undefined:this.stat.nlink}).encode())}const t=this.header?.block;if(!t){throw new Error("failed to encode header")}super.write(t)}[rs](){if(!this.stat){throw new Error("cannot create directory entry without stat")}if(this.path.slice(-1)!=="/"){this.path+="/"}this.stat.size=0;this[ns]();this.end()}[ss](){je.readlink(this.absolute,((t,r)=>{if(t){return this.emit("error",t)}this[us](r)}))}[us](t){this.linkpath=fr(t);this[ns]();this.end()}[is](t){if(!this.stat){throw new Error("cannot create link entry without stat")}this.type="Link";this.linkpath=fr(Zt.relative(this.cwd,t));this.stat.size=0;this[ns]();this.end()}[ts](){if(!this.stat){throw new Error("cannot create file entry without stat")}if(this.stat.nlink>1){const t=`${this.stat.dev}:${this.stat.ino}`;const r=this.linkCache.get(t);if(r?.indexOf(this.cwd)===0){return this[is](r)}this.linkCache.set(t,this.absolute)}this[ns]();if(this.stat.size===0){return this.end()}this[hs]()}[hs](){je.open(this.absolute,"r",((t,r)=>{if(t){return this.emit("error",t)}this[ds](r)}))}[ds](t){this.fd=t;if(this.#g){return this[ps]()}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 r=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(r);this.offset=0;this.pos=0;this.remain=this.stat.size;this.length=this.buf.length;this[os]()}[os](){const{fd:t,buf:r,offset:i,length:o,pos:a}=this;if(t===undefined||r===undefined){throw new Error("cannot read file without first opening")}je.read(t,r,i,o,a,((t,r)=>{if(t){return this[ps]((()=>this.emit("error",t)))}this[ls](r)}))}[ps](t=(()=>{})){if(this.fd!==undefined)je.close(this.fd,t)}[ls](t){if(t<=0&&this.remain>0){const t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[ps]((()=>this.emit("error",t)))}if(t>this.remain){const t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[ps]((()=>this.emit("error",t)))}if(!this.buf){throw new Error("should have created buffer prior to reading")}if(t===this.remain){for(let r=t;r<this.length&&t<this.blockRemain;r++){this.buf[r+this.offset]=0;t++;this.remain++}}const r=this.offset===0&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);const i=this.write(r);if(!i){this[gs]((()=>this[ys]()))}else{this[ys]()}}[gs](t){this.once("drain",t)}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}if(this.blockRemain<t.length){const t=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}this.remain-=t.length;this.blockRemain-=t.length;this.pos+=t.length;this.offset+=t.length;return super.write(t,null,i)}[ys](){if(!this.remain){if(this.blockRemain){super.write(Buffer.alloc(this.blockRemain))}return this[ps]((t=>t?this.emit("error",t):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[os]()}}class WriteEntrySync extends WriteEntry{sync=true;[as](){this[cs](je.lstatSync(this.absolute))}[ss](){this[us](je.readlinkSync(this.absolute))}[hs](){this[ds](je.openSync(this.absolute,"r"))}[os](){let t=true;try{const{fd:r,buf:i,offset:o,length:a,pos:c}=this;if(r===undefined||i===undefined){throw new Error("fd and buf must be set in READ method")}const l=je.readSync(r,i,o,a,c);this[ls](l);t=false}finally{if(t){try{this[ps]((()=>{}))}catch(t){}}}}[gs](t){t()}[ps](t=(()=>{})){if(this.fd!==undefined)je.closeSync(this.fd);t()}}class WriteEntryTar extends Minipass{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,r,i={}){return warnMethod(this,t,r,i)}constructor(t,r={}){const i=dealias(r);super();this.preservePaths=!!i.preservePaths;this.portable=!!i.portable;this.strict=!!i.strict;this.noPax=!!i.noPax;this.noMtime=!!i.noMtime;this.onWriteEntry=i.onWriteEntry;this.readEntry=t;const{type:o}=t;if(o==="Unsupported"){throw new Error("writing entry that should be ignored")}this.type=o;if(this.type==="Directory"&&this.portable){this.noMtime=true}this.prefix=i.prefix;this.path=fr(t.path);this.mode=t.mode!==undefined?this[ms](t.mode):undefined;this.uid=this.portable?undefined:t.uid;this.gid=this.portable?undefined:t.gid;this.uname=this.portable?undefined:t.uname;this.gname=this.portable?undefined:t.gname;this.size=t.size;this.mtime=this.noMtime?undefined:i.mtime||t.mtime;this.atime=this.portable?undefined:t.atime;this.ctime=this.portable?undefined:t.ctime;this.linkpath=t.linkpath!==undefined?fr(t.linkpath):undefined;if(typeof i.onwarn==="function"){this.on("warn",i.onwarn)}let a=false;if(!this.preservePaths){const[t,r]=stripAbsolutePath(this.path);if(t&&typeof r==="string"){this.path=r;a=t}}this.remain=t.size;this.blockRemain=t.startBlockSize;this.onWriteEntry?.(this);this.header=new Header({path:this[vs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[vs](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?undefined:this.uid,gid:this.portable?undefined:this.gid,size:this.size,mtime:this.noMtime?undefined:this.mtime,type:this.type,uname:this.portable?undefined:this.uname,atime:this.portable?undefined:this.atime,ctime:this.portable?undefined:this.ctime});if(a){this.warn("TAR_ENTRY_INFO",`stripping ${a} from absolute path`,{entry:this,path:a+this.path})}if(this.header.encode()&&!this.noPax){super.write(new Pax({atime:this.portable?undefined:this.atime,ctime:this.portable?undefined:this.ctime,gid:this.portable?undefined:this.gid,mtime:this.noMtime?undefined:this.mtime,path:this[vs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[vs](this.linkpath):this.linkpath,size:this.size,uid:this.portable?undefined:this.uid,uname:this.portable?undefined:this.uname,dev:this.portable?undefined:this.readEntry.dev,ino:this.portable?undefined:this.readEntry.ino,nlink:this.portable?undefined:this.readEntry.nlink}).encode())}const c=this.header?.block;if(!c)throw new Error("failed to encode header");super.write(c);t.pipe(this)}[vs](t){return prefixPath(t,this.prefix)}[ms](t){return modeFix(t,this.type==="Directory",this.portable)}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}const o=t.length;if(o>this.blockRemain){throw new Error("writing more to entry than is appropriate")}this.blockRemain-=o;return super.write(t,i)}end(t,r,i){if(this.blockRemain){super.write(Buffer.alloc(this.blockRemain))}if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,r??"utf8")}if(i)this.once("finish",i);t?super.end(t,i):super.end(i);return this}}const getType=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";class PackJob{path;absolute;entry;stat;readdir;pending=false;ignore=false;piped=false;constructor(t,r){this.path=t||"./";this.absolute=r}}const bs=Buffer.alloc(1024);const _s=Symbol("onStat");const ws=Symbol("ended");const Es=Symbol("queue");const Ss=Symbol("current");const $s=Symbol("process");const xs=Symbol("processing");const Rs=Symbol("processJob");const Os=Symbol("jobs");const Ps=Symbol("jobDone");const As=Symbol("addFSEntry");const Ts=Symbol("addTarEntry");const Cs=Symbol("stat");const ks=Symbol("readdir");const Is=Symbol("onreaddir");const Ns=Symbol("pipe");const Ds=Symbol("entry");const Ls=Symbol("entryOpt");const Ms=Symbol("writeEntryClass");const js=Symbol("write");const Fs=Symbol("ondrain");class Pack extends Minipass{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Ms];onWriteEntry;[Es];[Os]=0;[xs]=false;[ws]=false;constructor(t={}){super();this.opt=t;this.file=t.file||"";this.cwd=t.cwd||process.cwd();this.maxReadSize=t.maxReadSize;this.preservePaths=!!t.preservePaths;this.strict=!!t.strict;this.noPax=!!t.noPax;this.prefix=fr(t.prefix||"");this.linkCache=t.linkCache||new Map;this.statCache=t.statCache||new Map;this.readdirCache=t.readdirCache||new Map;this.onWriteEntry=t.onWriteEntry;this[Ms]=WriteEntry;if(typeof t.onwarn==="function"){this.on("warn",t.onwarn)}this.portable=!!t.portable;if(t.gzip||t.brotli){if(t.gzip&&t.brotli){throw new TypeError("gzip and brotli are mutually exclusive")}if(t.gzip){if(typeof t.gzip!=="object"){t.gzip={}}if(this.portable){t.gzip.portable=true}this.zip=new Gzip(t.gzip)}if(t.brotli){if(typeof t.brotli!=="object"){t.brotli={}}this.zip=new BrotliCompress(t.brotli)}if(!this.zip)throw new Error("impossible");const r=this.zip;r.on("data",(t=>super.write(t)));r.on("end",(()=>super.end()));r.on("drain",(()=>this[Fs]()));this.on("resume",(()=>r.resume()))}else{this.on("drain",this[Fs])}this.noDirRecurse=!!t.noDirRecurse;this.follow=!!t.follow;this.noMtime=!!t.noMtime;if(t.mtime)this.mtime=t.mtime;this.filter=typeof t.filter==="function"?t.filter:()=>true;this[Es]=new Yallist;this[Os]=0;this.jobs=Number(t.jobs)||4;this[xs]=false;this[ws]=false}[js](t){return super.write(t)}add(t){this.write(t);return this}end(t,r,i){if(typeof t==="function"){i=t;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(t){this.add(t)}this[ws]=true;this[$s]();if(i)i();return this}write(t){if(this[ws]){throw new Error("write after end")}if(t instanceof ReadEntry){this[Ts](t)}else{this[As](t)}return this.flowing}[Ts](t){const r=fr(Zt.resolve(this.cwd,t.path));if(!this.filter(t.path,t)){t.resume()}else{const i=new PackJob(t.path,r);i.entry=new WriteEntryTar(t,this[Ls](i));i.entry.on("end",(()=>this[Ps](i)));this[Os]+=1;this[Es].push(i)}this[$s]()}[As](t){const r=fr(Zt.resolve(this.cwd,t));this[Es].push(new PackJob(t,r));this[$s]()}[Cs](t){t.pending=true;this[Os]+=1;const r=this.follow?"stat":"lstat";je[r](t.absolute,((r,i)=>{t.pending=false;this[Os]-=1;if(r){this.emit("error",r)}else{this[_s](t,i)}}))}[_s](t,r){this.statCache.set(t.absolute,r);t.stat=r;if(!this.filter(t.path,r)){t.ignore=true}this[$s]()}[ks](t){t.pending=true;this[Os]+=1;je.readdir(t.absolute,((r,i)=>{t.pending=false;this[Os]-=1;if(r){return this.emit("error",r)}this[Is](t,i)}))}[Is](t,r){this.readdirCache.set(t.absolute,r);t.readdir=r;this[$s]()}[$s](){if(this[xs]){return}this[xs]=true;for(let t=this[Es].head;!!t&&this[Os]<this.jobs;t=t.next){this[Rs](t.value);if(t.value.ignore){const r=t.next;this[Es].removeNode(t);t.next=r}}this[xs]=false;if(this[ws]&&!this[Es].length&&this[Os]===0){if(this.zip){this.zip.end(bs)}else{super.write(bs);super.end()}}}get[Ss](){return this[Es]&&this[Es].head&&this[Es].head.value}[Ps](t){this[Es].shift();this[Os]-=1;this[$s]()}[Rs](t){if(t.pending){return}if(t.entry){if(t===this[Ss]&&!t.piped){this[Ns](t)}return}if(!t.stat){const r=this.statCache.get(t.absolute);if(r){this[_s](t,r)}else{this[Cs](t)}}if(!t.stat){return}if(t.ignore){return}if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){const r=this.readdirCache.get(t.absolute);if(r){this[Is](t,r)}else{this[ks](t)}if(!t.readdir){return}}t.entry=this[Ds](t);if(!t.entry){t.ignore=true;return}if(t===this[Ss]&&!t.piped){this[Ns](t)}}[Ls](t){return{onwarn:(t,r,i)=>this.warn(t,r,i),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Ds](t){this[Os]+=1;try{const r=new this[Ms](t.path,this[Ls](t));return r.on("end",(()=>this[Ps](t))).on("error",(t=>this.emit("error",t)))}catch(t){this.emit("error",t)}}[Fs](){if(this[Ss]&&this[Ss].entry){this[Ss].entry.resume()}}[Ns](t){t.piped=true;if(t.readdir){t.readdir.forEach((r=>{const i=t.path;const o=i==="./"?"":i.replace(/\/*$/,"/");this[As](o+r)}))}const r=t.entry;const i=this.zip;if(!r)throw new Error("cannot pipe without source");if(i){r.on("data",(t=>{if(!i.write(t)){r.pause()}}))}else{r.on("data",(t=>{if(!super.write(t)){r.pause()}}))}}pause(){if(this.zip){this.zip.pause()}return super.pause()}warn(t,r,i={}){warnMethod(this,t,r,i)}}class PackSync extends Pack{sync=true;constructor(t){super(t);this[Ms]=WriteEntrySync}pause(){}resume(){}[Cs](t){const r=this.follow?"statSync":"lstatSync";this[_s](t,je[r](t.absolute))}[ks](t){this[Is](t,je.readdirSync(t.absolute))}[Ns](t){const r=t.entry;const i=this.zip;if(t.readdir){t.readdir.forEach((r=>{const i=t.path;const o=i==="./"?"":i.replace(/\/*$/,"/");this[As](o+r)}))}if(!r)throw new Error("Cannot pipe without source");if(i){r.on("data",(t=>{i.write(t)}))}else{r.on("data",(t=>{super[js](t)}))}}}const createFileSync=(t,r)=>{const i=new PackSync(t);const o=new WriteStreamSync(t.file,{mode:t.mode||438});i.pipe(o);addFilesSync(i,r)};const createFile=(t,r)=>{const i=new Pack(t);const o=new WriteStream(t.file,{mode:t.mode||438});i.pipe(o);const a=new Promise(((t,r)=>{o.on("error",r);o.on("close",t);i.on("error",r)}));addFilesAsync(i,r);return a};const addFilesSync=(t,r)=>{r.forEach((r=>{if(r.charAt(0)==="@"){qr({file:S.resolve(t.cwd,r.slice(1)),sync:true,noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(r)}}));t.end()};const addFilesAsync=async(t,r)=>{for(let i=0;i<r.length;i++){const o=String(r[i]);if(o.charAt(0)==="@"){await qr({file:S.resolve(String(t.cwd),o.slice(1)),noResume:true,onReadEntry:r=>{t.add(r)}})}else{t.add(o)}}t.end()};const createSync=(t,r)=>{const i=new PackSync(t);addFilesSync(i,r);return i};const createAsync=(t,r)=>{const i=new Pack(t);addFilesAsync(i,r);return i};const Us=makeCommand(createFileSync,createFile,createSync,createAsync,((t,r)=>{if(!r?.length){throw new TypeError("no paths specified to add to archive")}}));const Bs=process.env.__FAKE_PLATFORM__||process.platform;const Hs=Bs==="win32";const{O_CREAT:Vs,O_TRUNC:zs,O_WRONLY:Gs}=je.constants;const qs=Number(process.env.__FAKE_FS_O_FILENAME__)||je.constants.UV_FS_O_FILEMAP||0;const Ws=Hs&&!!qs;const Ks=512*1024;const Ys=qs|zs|Vs|Gs;const Zs=!Ws?()=>"w":t=>t<Ks?Ys:"w";const lchownSync=(t,r,i)=>{try{return E.lchownSync(t,r,i)}catch(t){if(t?.code!=="ENOENT")throw t}};const chown=(t,r,i,o)=>{E.lchown(t,r,i,(t=>{o(t&&t?.code!=="ENOENT"?t:null)}))};const chownrKid=(t,r,i,o,a)=>{if(r.isDirectory()){chownr(S.resolve(t,r.name),i,o,(c=>{if(c)return a(c);const l=S.resolve(t,r.name);chown(l,i,o,a)}))}else{const c=S.resolve(t,r.name);chown(c,i,o,a)}};const chownr=(t,r,i,o)=>{E.readdir(t,{withFileTypes:true},((a,c)=>{if(a){if(a.code==="ENOENT")return o();else if(a.code!=="ENOTDIR"&&a.code!=="ENOTSUP")return o(a)}if(a||!c.length)return chown(t,r,i,o);let l=c.length;let u=null;const then=a=>{if(u)return;if(a)return o(u=a);if(--l===0)return chown(t,r,i,o)};for(const o of c){chownrKid(t,o,r,i,then)}}))};const chownrKidSync=(t,r,i,o)=>{if(r.isDirectory())chownrSync(S.resolve(t,r.name),i,o);lchownSync(S.resolve(t,r.name),i,o)};const chownrSync=(t,r,i)=>{let o;try{o=E.readdirSync(t,{withFileTypes:true})}catch(o){const a=o;if(a?.code==="ENOENT")return;else if(a?.code==="ENOTDIR"||a?.code==="ENOTSUP")return lchownSync(t,r,i);else throw a}for(const a of o){chownrKidSync(t,a,r,i)}return lchownSync(t,r,i)};const optsArg=t=>{if(!t){t={mode:511}}else if(typeof t==="object"){t={mode:511,...t}}else if(typeof t==="number"){t={mode:t}}else if(typeof t==="string"){t={mode:parseInt(t,8)}}else{throw new TypeError("invalid options argument")}const r=t;const i=t.fs||{};t.mkdir=t.mkdir||i.mkdir||je.mkdir;t.mkdirAsync=t.mkdirAsync?t.mkdirAsync:async(t,i)=>new Promise(((o,a)=>r.mkdir(t,i,((t,r)=>t?a(t):o(r)))));t.stat=t.stat||i.stat||je.stat;t.statAsync=t.statAsync?t.statAsync:async t=>new Promise(((i,o)=>r.stat(t,((t,r)=>t?o(t):i(r)))));t.statSync=t.statSync||i.statSync||je.statSync;t.mkdirSync=t.mkdirSync||i.mkdirSync||je.mkdirSync;return r};const mkdirp_manual_mkdirpManualSync=(t,r,i)=>{const o=(0,Zt.dirname)(t);const a={...optsArg(r),recursive:false};if(o===t){try{return a.mkdirSync(t,a)}catch(t){const r=t;if(r&&r.code!=="EISDIR"){throw t}return}}try{a.mkdirSync(t,a);return i||t}catch(r){const c=r;if(c&&c.code==="ENOENT"){return mkdirp_manual_mkdirpManualSync(t,a,mkdirp_manual_mkdirpManualSync(o,a,i))}if(c&&c.code!=="EEXIST"&&c&&c.code!=="EROFS"){throw r}try{if(!a.statSync(t).isDirectory())throw r}catch(t){throw r}}};const Xs=Object.assign((async(t,r,i)=>{const o=optsArg(r);o.recursive=false;const a=(0,Zt.dirname)(t);if(a===t){return o.mkdirAsync(t,o).catch((t=>{const r=t;if(r&&r.code!=="EISDIR"){throw t}}))}return o.mkdirAsync(t,o).then((()=>i||t),(async r=>{const c=r;if(c&&c.code==="ENOENT"){return Xs(a,o).then((r=>Xs(t,o,r)))}if(c&&c.code!=="EEXIST"&&c.code!=="EROFS"){throw r}return o.statAsync(t).then((t=>{if(t.isDirectory()){return i}else{throw r}}),(()=>{throw r}))}))}),{sync:mkdirp_manual_mkdirpManualSync});const findMade=async(t,r,i)=>{if(i===r){return}return t.statAsync(r).then((t=>t.isDirectory()?i:undefined),(i=>{const o=i;return o&&o.code==="ENOENT"?findMade(t,(0,Zt.dirname)(r),r):undefined}))};const findMadeSync=(t,r,i)=>{if(i===r){return undefined}try{return t.statSync(r).isDirectory()?i:undefined}catch(i){const o=i;return o&&o.code==="ENOENT"?findMadeSync(t,(0,Zt.dirname)(r),r):undefined}};const mkdirp_native_mkdirpNativeSync=(t,r)=>{const i=optsArg(r);i.recursive=true;const o=(0,Zt.dirname)(t);if(o===t){return i.mkdirSync(t,i)}const a=findMadeSync(i,t);try{i.mkdirSync(t,i);return a}catch(r){const o=r;if(o&&o.code==="ENOENT"){return mkdirp_manual_mkdirpManualSync(t,i)}else{throw r}}};const Js=Object.assign((async(t,r)=>{const i={...optsArg(r),recursive:true};const o=(0,Zt.dirname)(t);if(o===t){return await i.mkdirAsync(t,i)}return findMade(i,t).then((r=>i.mkdirAsync(t,i).then((t=>r||t)).catch((r=>{const o=r;if(o&&o.code==="ENOENT"){return Xs(t,i)}else{throw r}}))))}),{sync:mkdirp_native_mkdirpNativeSync});const Qs=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform;const pathArg=t=>{if(/\0/.test(t)){throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"})}t=(0,Zt.resolve)(t);if(Qs==="win32"){const r=/[*|"<>?:]/;const{root:i}=(0,Zt.parse)(t);if(r.test(t.substring(i.length))){throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}}return t};const ei=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version;const ti=ei.replace(/^v/,"").split(".");const ri=+ti[0]>10||+ti[0]===10&&+ti[1]>=12;const si=!ri?()=>false:t=>optsArg(t).mkdirSync===je.mkdirSync;const ii=Object.assign(!ri?()=>false:t=>optsArg(t).mkdir===je.mkdir,{sync:si});const mkdirpSync=(t,r)=>{t=pathArg(t);const i=optsArg(r);return si(i)?mkdirp_native_mkdirpNativeSync(t,i):mkdirp_manual_mkdirpManualSync(t,i)};const ni=null&&mkdirpSync;const oi=null&&mkdirpManual;const ai=null&&mkdirpManualSync;const ci=null&&mkdirpNative;const li=null&&mkdirpNativeSync;const ui=Object.assign((async(t,r)=>{t=pathArg(t);const i=optsArg(r);return ii(i)?Js(t,i):Xs(t,i)}),{mkdirpSync:mkdirpSync,mkdirpNative:Js,mkdirpNativeSync:mkdirp_native_mkdirpNativeSync,mkdirpManual:Xs,mkdirpManualSync:mkdirp_manual_mkdirpManualSync,sync:mkdirpSync,native:Js,nativeSync:mkdirp_native_mkdirpNativeSync,manual:Xs,manualSync:mkdirp_manual_mkdirpManualSync,useNative:ii,useNativeSync:si});class CwdError extends Error{path;code;syscall="chdir";constructor(t,r){super(`${r}: Cannot cd into '${t}'`);this.path=t;this.code=r}get name(){return"CwdError"}}class SymlinkError extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,r){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");this.symlink=t;this.path=r}get name(){return"SymlinkError"}}const cGet=(t,r)=>t.get(fr(r));const cSet=(t,r,i)=>t.set(fr(r),i);const checkCwd=(t,r)=>{je.stat(t,((i,o)=>{if(i||!o.isDirectory()){i=new CwdError(t,i?.code||"ENOTDIR")}r(i)}))};const mkdir=(t,r,i)=>{t=fr(t);const o=r.umask??18;const a=r.mode|448;const c=(a&o)!==0;const l=r.uid;const u=r.gid;const h=typeof l==="number"&&typeof u==="number"&&(l!==r.processUid||u!==r.processGid);const d=r.preserve;const p=r.unlink;const m=r.cache;const g=fr(r.cwd);const done=(r,o)=>{if(r){i(r)}else{cSet(m,t,true);if(o&&h){chownr(o,l,u,(t=>done(t)))}else if(c){je.chmod(t,a,i)}else{i()}}};if(m&&cGet(m,t)===true){return done()}if(t===g){return checkCwd(t,done)}if(d){return ui(t,{mode:a}).then((t=>done(null,t??undefined)),done)}const y=fr(S.relative(g,t));const v=y.split("/");mkdir_(g,v,a,m,p,g,undefined,done)};const mkdir_=(t,r,i,o,a,c,l,u)=>{if(!r.length){return u(null,l)}const h=r.shift();const d=fr(S.resolve(t+"/"+h));if(cGet(o,d)){return mkdir_(d,r,i,o,a,c,l,u)}je.mkdir(d,i,onmkdir(d,r,i,o,a,c,l,u))};const onmkdir=(t,r,i,o,a,c,l,u)=>h=>{if(h){je.lstat(t,((d,p)=>{if(d){d.path=d.path&&fr(d.path);u(d)}else if(p.isDirectory()){mkdir_(t,r,i,o,a,c,l,u)}else if(a){je.unlink(t,(h=>{if(h){return u(h)}je.mkdir(t,i,onmkdir(t,r,i,o,a,c,l,u))}))}else if(p.isSymbolicLink()){return u(new SymlinkError(t,t+"/"+r.join("/")))}else{u(h)}}))}else{l=l||t;mkdir_(t,r,i,o,a,c,l,u)}};const checkCwdSync=t=>{let r=false;let i=undefined;try{r=je.statSync(t).isDirectory()}catch(t){i=t?.code}finally{if(!r){throw new CwdError(t,i??"ENOTDIR")}}};const mkdirSync=(t,r)=>{t=fr(t);const i=r.umask??18;const o=r.mode|448;const a=(o&i)!==0;const c=r.uid;const l=r.gid;const u=typeof c==="number"&&typeof l==="number"&&(c!==r.processUid||l!==r.processGid);const h=r.preserve;const d=r.unlink;const p=r.cache;const m=fr(r.cwd);const done=r=>{cSet(p,t,true);if(r&&u){chownrSync(r,c,l)}if(a){je.chmodSync(t,o)}};if(p&&cGet(p,t)===true){return done()}if(t===m){checkCwdSync(m);return done()}if(h){return done(mkdirpSync(t,o)??undefined)}const g=fr(S.relative(m,t));const y=g.split("/");let v=undefined;for(let t=y.shift(),r=m;t&&(r+="/"+t);t=y.shift()){r=fr(S.resolve(r));if(cGet(p,r)){continue}try{je.mkdirSync(r,o);v=v||r;cSet(p,r,true)}catch(t){const i=je.lstatSync(r);if(i.isDirectory()){cSet(p,r,true);continue}else if(d){je.unlinkSync(r);je.mkdirSync(r,o);v=v||r;cSet(p,r,true);continue}else if(i.isSymbolicLink()){return new SymlinkError(r,r+"/"+y.join("/"))}}}return done(v)};const hi=Object.create(null);const{hasOwnProperty:di}=Object.prototype;const normalizeUnicode=t=>{if(!di.call(hi,t)){hi[t]=t.normalize("NFD")}return hi[t]};const fi=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const pi=fi==="win32";const getDirs=t=>{const r=t.split("/").slice(0,-1).reduce(((t,r)=>{const i=t[t.length-1];if(i!==undefined){r=(0,S.join)(i,r)}t.push(r||"/");return t}),[]);return r};class PathReservations{#y=new Map;#v=new Map;#b=new Set;reserve(t,r){t=pi?["win32 parallelization disabled"]:t.map((t=>stripTrailingSlashes((0,S.join)(normalizeUnicode(t))).toLowerCase()));const i=new Set(t.map((t=>getDirs(t))).reduce(((t,r)=>t.concat(r))));this.#v.set(r,{dirs:i,paths:t});for(const i of t){const t=this.#y.get(i);if(!t){this.#y.set(i,[r])}else{t.push(r)}}for(const t of i){const i=this.#y.get(t);if(!i){this.#y.set(t,[new Set([r])])}else{const t=i[i.length-1];if(t instanceof Set){t.add(r)}else{i.push(new Set([r]))}}}return this.#_(r)}#w(t){const r=this.#v.get(t);if(!r){throw new Error("function does not have any path reservations")}return{paths:r.paths.map((t=>this.#y.get(t))),dirs:[...r.dirs].map((t=>this.#y.get(t)))}}check(t){const{paths:r,dirs:i}=this.#w(t);return r.every((r=>r&&r[0]===t))&&i.every((r=>r&&r[0]instanceof Set&&r[0].has(t)))}#_(t){if(this.#b.has(t)||!this.check(t)){return false}this.#b.add(t);t((()=>this.#E(t)));return true}#E(t){if(!this.#b.has(t)){return false}const r=this.#v.get(t);if(!r){throw new Error("invalid reservation")}const{paths:i,dirs:o}=r;const a=new Set;for(const r of i){const i=this.#y.get(r);if(!i||i?.[0]!==t){continue}const o=i[1];if(!o){this.#y.delete(r);continue}i.shift();if(typeof o==="function"){a.add(o)}else{for(const t of o){a.add(t)}}}for(const r of o){const i=this.#y.get(r);const o=i?.[0];if(!i||!(o instanceof Set))continue;if(o.size===1&&i.length===1){this.#y.delete(r);continue}else if(o.size===1){i.shift();const t=i[0];if(typeof t==="function"){a.add(t)}}else{o.delete(t)}}this.#b.delete(t);a.forEach((t=>this.#_(t)));return true}}const mi=Symbol("onEntry");const gi=Symbol("checkFs");const yi=Symbol("checkFs2");const vi=Symbol("pruneCache");const bi=Symbol("isReusable");const _i=Symbol("makeFs");const wi=Symbol("file");const Ei=Symbol("directory");const Si=Symbol("link");const $i=Symbol("symlink");const xi=Symbol("hardlink");const Ri=Symbol("unsupported");const Oi=Symbol("checkPath");const Pi=Symbol("mkdir");const Ai=Symbol("onError");const Ti=Symbol("pending");const Ci=Symbol("pend");const ki=Symbol("unpend");const Ii=Symbol("ended");const Ni=Symbol("maybeClose");const Di=Symbol("skip");const Li=Symbol("doChown");const Mi=Symbol("uid");const ji=Symbol("gid");const Fi=Symbol("checkedCwd");const Ui=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const Bi=Ui==="win32";const Hi=1024;const unlinkFile=(t,r)=>{if(!Bi){return E.unlink(t,r)}const i=t+".DELETE."+(0,$.randomBytes)(16).toString("hex");E.rename(t,i,(t=>{if(t){return r(t)}E.unlink(i,r)}))};const unlinkFileSync=t=>{if(!Bi){return E.unlinkSync(t)}const r=t+".DELETE."+(0,$.randomBytes)(16).toString("hex");E.renameSync(t,r);E.unlinkSync(r)};const uint32=(t,r,i)=>t!==undefined&&t===t>>>0?t:r!==undefined&&r===r>>>0?r:i;const cacheKeyNormalize=t=>stripTrailingSlashes(fr(normalizeUnicode(t))).toLowerCase();const pruneCache=(t,r)=>{r=cacheKeyNormalize(r);for(const i of t.keys()){const o=cacheKeyNormalize(i);if(o===r||o.indexOf(r+"/")===0){t.delete(i)}}};const dropCache=t=>{for(const r of t.keys()){t.delete(r)}};class Unpack extends Parser{[Ii]=false;[Fi]=false;[Ti]=0;reservations=new PathReservations;transform;writable=true;readable=false;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){t.ondone=()=>{this[Ii]=true;this[Ni]()};super(t);this.transform=t.transform;this.dirCache=t.dirCache||new Map;this.chmod=!!t.chmod;if(typeof t.uid==="number"||typeof t.gid==="number"){if(typeof t.uid!=="number"||typeof t.gid!=="number"){throw new TypeError("cannot set owner without number uid and gid")}if(t.preserveOwner){throw new TypeError("cannot preserve owner in archive and also set owner explicitly")}this.uid=t.uid;this.gid=t.gid;this.setOwner=true}else{this.uid=undefined;this.gid=undefined;this.setOwner=false}if(t.preserveOwner===undefined&&typeof t.uid!=="number"){this.preserveOwner=!!(process.getuid&&process.getuid()===0)}else{this.preserveOwner=!!t.preserveOwner}this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():undefined;this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():undefined;this.maxDepth=typeof t.maxDepth==="number"?t.maxDepth:Hi;this.forceChown=t.forceChown===true;this.win32=!!t.win32||Bi;this.newer=!!t.newer;this.keep=!!t.keep;this.noMtime=!!t.noMtime;this.preservePaths=!!t.preservePaths;this.unlink=!!t.unlink;this.cwd=fr(S.resolve(t.cwd||process.cwd()));this.strip=Number(t.strip)||0;this.processUmask=!this.chmod?0:typeof t.processUmask==="number"?t.processUmask:process.umask();this.umask=typeof t.umask==="number"?t.umask:this.processUmask;this.dmode=t.dmode||511&~this.umask;this.fmode=t.fmode||438&~this.umask;this.on("entry",(t=>this[mi](t)))}warn(t,r,i={}){if(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT"){i.recoverable=false}return super.warn(t,r,i)}[Ni](){if(this[Ii]&&this[Ti]===0){this.emit("prefinish");this.emit("finish");this.emit("end")}}[Oi](t){const r=fr(t.path);const i=r.split("/");if(this.strip){if(i.length<this.strip){return false}if(t.type==="Link"){const r=fr(String(t.linkpath)).split("/");if(r.length>=this.strip){t.linkpath=r.slice(this.strip).join("/")}else{return false}}i.splice(0,this.strip);t.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth){this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:r,depth:i.length,maxDepth:this.maxDepth});return false}if(!this.preservePaths){if(i.includes("..")||Bi&&/^[a-z]:\.\.$/i.test(i[0]??"")){this.warn("TAR_ENTRY_ERROR",`path contains '..'`,{entry:t,path:r});return false}const[o,a]=stripAbsolutePath(r);if(o){t.path=String(a);this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:t,path:r})}}if(S.isAbsolute(t.path)){t.absolute=fr(S.resolve(t.path))}else{t.absolute=fr(S.resolve(this.cwd,t.path))}if(!this.preservePaths&&typeof t.absolute==="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd){this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:fr(t.path),resolvedPath:t.absolute,cwd:this.cwd});return false}if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir"){return false}if(this.win32){const{root:r}=S.win32.parse(String(t.absolute));t.absolute=r+winchars_encode(String(t.absolute).slice(r.length));const{root:i}=S.win32.parse(t.path);t.path=i+winchars_encode(t.path.slice(i.length))}return true}[mi](t){if(!this[Oi](t)){return t.resume()}x.equal(typeof t.absolute,"string");switch(t.type){case"Directory":case"GNUDumpDir":if(t.mode){t.mode=t.mode|448}case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[gi](t);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[Ri](t)}}[Ai](t,r){if(t.name==="CwdError"){this.emit("error",t)}else{this.warn("TAR_ENTRY_ERROR",t,{entry:r});this[ki]();r.resume()}}[Pi](t,r,i){mkdir(fr(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r},i)}[Li](t){return this.forceChown||this.preserveOwner&&(typeof t.uid==="number"&&t.uid!==this.processUid||typeof t.gid==="number"&&t.gid!==this.processGid)||typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid}[Mi](t){return uint32(this.uid,t.uid,this.processUid)}[ji](t){return uint32(this.gid,t.gid,this.processGid)}[wi](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.fmode;const o=new WriteStream(String(t.absolute),{flags:Zs(t.size),mode:i,autoClose:false});o.on("error",(i=>{if(o.fd){E.close(o.fd,(()=>{}))}o.write=()=>true;this[Ai](i,t);r()}));let a=1;const done=i=>{if(i){if(o.fd){E.close(o.fd,(()=>{}))}this[Ai](i,t);r();return}if(--a===0){if(o.fd!==undefined){E.close(o.fd,(i=>{if(i){this[Ai](i,t)}else{this[ki]()}r()}))}}};o.on("finish",(()=>{const r=String(t.absolute);const i=o.fd;if(typeof i==="number"&&t.mtime&&!this.noMtime){a++;const o=t.atime||new Date;const c=t.mtime;E.futimes(i,o,c,(t=>t?E.utimes(r,o,c,(r=>done(r&&t))):done()))}if(typeof i==="number"&&this[Li](t)){a++;const o=this[Mi](t);const c=this[ji](t);if(typeof o==="number"&&typeof c==="number"){E.fchown(i,o,c,(t=>t?E.chown(r,o,c,(r=>done(r&&t))):done()))}}done()}));const c=this.transform?this.transform(t)||t:t;if(c!==t){c.on("error",(i=>{this[Ai](i,t);r()}));t.pipe(c)}c.pipe(o)}[Ei](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.dmode;this[Pi](String(t.absolute),i,(i=>{if(i){this[Ai](i,t);r();return}let o=1;const done=()=>{if(--o===0){r();this[ki]();t.resume()}};if(t.mtime&&!this.noMtime){o++;E.utimes(String(t.absolute),t.atime||new Date,t.mtime,done)}if(this[Li](t)){o++;E.chown(String(t.absolute),Number(this[Mi](t)),Number(this[ji](t)),done)}done()}))}[Ri](t){t.unsupported=true;this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t});t.resume()}[$i](t,r){this[Si](t,String(t.linkpath),"symlink",r)}[xi](t,r){const i=fr(S.resolve(this.cwd,String(t.linkpath)));this[Si](t,i,"link",r)}[Ci](){this[Ti]++}[ki](){this[Ti]--;this[Ni]()}[Di](t){this[ki]();t.resume()}[bi](t,r){return t.type==="File"&&!this.unlink&&r.isFile()&&r.nlink<=1&&!Bi}[gi](t){this[Ci]();const r=[t.path];if(t.linkpath){r.push(t.linkpath)}this.reservations.reserve(r,(r=>this[yi](t,r)))}[vi](t){if(t.type==="SymbolicLink"){dropCache(this.dirCache)}else if(t.type!=="Directory"){pruneCache(this.dirCache,String(t.absolute))}}[yi](t,r){this[vi](t);const done=i=>{this[vi](t);r(i)};const checkCwd=()=>{this[Pi](this.cwd,this.dmode,(r=>{if(r){this[Ai](r,t);done();return}this[Fi]=true;start()}))};const start=()=>{if(t.absolute!==this.cwd){const r=fr(S.dirname(String(t.absolute)));if(r!==this.cwd){return this[Pi](r,this.dmode,(r=>{if(r){this[Ai](r,t);done();return}afterMakeParent()}))}}afterMakeParent()};const afterMakeParent=()=>{E.lstat(String(t.absolute),((r,i)=>{if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime))){this[Di](t);done();return}if(r||this[bi](t,i)){return this[_i](null,t,done)}if(i.isDirectory()){if(t.type==="Directory"){const r=this.chmod&&t.mode&&(i.mode&4095)!==t.mode;const afterChmod=r=>this[_i](r??null,t,done);if(!r){return afterChmod()}return E.chmod(String(t.absolute),Number(t.mode),afterChmod)}if(t.absolute!==this.cwd){return E.rmdir(String(t.absolute),(r=>this[_i](r??null,t,done)))}}if(t.absolute===this.cwd){return this[_i](null,t,done)}unlinkFile(String(t.absolute),(r=>this[_i](r??null,t,done)))}))};if(this[Fi]){start()}else{checkCwd()}}[_i](t,r,i){if(t){this[Ai](t,r);i();return}switch(r.type){case"File":case"OldFile":case"ContiguousFile":return this[wi](r,i);case"Link":return this[xi](r,i);case"SymbolicLink":return this[$i](r,i);case"Directory":case"GNUDumpDir":return this[Ei](r,i)}}[Si](t,r,i,o){E[i](r,String(t.absolute),(r=>{if(r){this[Ai](r,t)}else{this[ki]();t.resume()}o()}))}}const callSync=t=>{try{return[null,t()]}catch(t){return[t,null]}};class UnpackSync extends Unpack{sync=true;[_i](t,r){return super[_i](t,r,(()=>{}))}[gi](t){this[vi](t);if(!this[Fi]){const r=this[Pi](this.cwd,this.dmode);if(r){return this[Ai](r,t)}this[Fi]=true}if(t.absolute!==this.cwd){const r=fr(S.dirname(String(t.absolute)));if(r!==this.cwd){const i=this[Pi](r,this.dmode);if(i){return this[Ai](i,t)}}}const[r,i]=callSync((()=>E.lstatSync(String(t.absolute))));if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime))){return this[Di](t)}if(r||this[bi](t,i)){return this[_i](null,t)}if(i.isDirectory()){if(t.type==="Directory"){const r=this.chmod&&t.mode&&(i.mode&4095)!==t.mode;const[o]=r?callSync((()=>{E.chmodSync(String(t.absolute),Number(t.mode))})):[];return this[_i](o,t)}const[r]=callSync((()=>E.rmdirSync(String(t.absolute))));this[_i](r,t)}const[o]=t.absolute===this.cwd?[]:callSync((()=>unlinkFileSync(String(t.absolute))));this[_i](o,t)}[wi](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.fmode;const oner=i=>{let a;try{E.closeSync(o)}catch(t){a=t}if(i||a){this[Ai](i||a,t)}r()};let o;try{o=E.openSync(String(t.absolute),Zs(t.size),i)}catch(t){return oner(t)}const a=this.transform?this.transform(t)||t:t;if(a!==t){a.on("error",(r=>this[Ai](r,t)));t.pipe(a)}a.on("data",(t=>{try{E.writeSync(o,t,0,t.length)}catch(t){oner(t)}}));a.on("end",(()=>{let r=null;if(t.mtime&&!this.noMtime){const i=t.atime||new Date;const a=t.mtime;try{E.futimesSync(o,i,a)}catch(o){try{E.utimesSync(String(t.absolute),i,a)}catch(t){r=o}}}if(this[Li](t)){const i=this[Mi](t);const a=this[ji](t);try{E.fchownSync(o,Number(i),Number(a))}catch(o){try{E.chownSync(String(t.absolute),Number(i),Number(a))}catch(t){r=r||o}}}oner(r)}))}[Ei](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.dmode;const o=this[Pi](String(t.absolute),i);if(o){this[Ai](o,t);r();return}if(t.mtime&&!this.noMtime){try{E.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch(o){}}if(this[Li](t)){try{E.chownSync(String(t.absolute),Number(this[Mi](t)),Number(this[ji](t)))}catch(o){}}r();t.resume()}[Pi](t,r){try{return mkdirSync(fr(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r})}catch(t){return t}}[Si](t,r,i,o){const a=`${i}Sync`;try{E[a](r,String(t.absolute));o();t.resume()}catch(r){return this[Ai](r,t)}}}const extractFileSync=t=>{const r=new UnpackSync(t);const i=t.file;const o=E.statSync(i);const a=t.maxReadSize||16*1024*1024;const c=new ReadStreamSync(i,{readSize:a,size:o.size});c.pipe(r)};const extractFile=(t,r)=>{const i=new Unpack(t);const o=t.maxReadSize||16*1024*1024;const a=t.file;const c=new Promise(((t,r)=>{i.on("error",r);i.on("close",t);E.stat(a,((t,c)=>{if(t){r(t)}else{const t=new ReadStream(a,{readSize:o,size:c.size});t.on("error",r);t.pipe(i)}}))}));return c};const Vi=makeCommand(extractFileSync,extractFile,(t=>new UnpackSync(t)),(t=>new Unpack(t)),((t,r)=>{if(r?.length)filesFilter(t,r)}));const replaceSync=(t,r)=>{const i=new PackSync(t);let o=true;let a;let c;try{try{a=E.openSync(t.file,"r+")}catch(r){if(r?.code==="ENOENT"){a=E.openSync(t.file,"w+")}else{throw r}}const l=E.fstatSync(a);const u=Buffer.alloc(512);e:for(c=0;c<l.size;c+=512){for(let t=0,r=0;t<512;t+=r){r=E.readSync(a,u,t,u.length-t,c+t);if(c===0&&u[0]===31&&u[1]===139){throw new Error("cannot append to compressed archives")}if(!r){break e}}const r=new Header(u);if(!r.cksumValid){break}const i=512*Math.ceil((r.size||0)/512);if(c+i+512>l.size){break}c+=i;if(t.mtimeCache&&r.mtime){t.mtimeCache.set(String(r.path),r.mtime)}}o=false;streamSync(t,i,c,a,r)}finally{if(o){try{E.closeSync(a)}catch(t){}}}};const streamSync=(t,r,i,o,a)=>{const c=new WriteStreamSync(t.file,{fd:o,start:i});r.pipe(c);replace_addFilesSync(r,a)};const replaceAsync=(t,r)=>{r=Array.from(r);const i=new Pack(t);const getPos=(r,i,o)=>{const cb=(t,i)=>{if(t){E.close(r,(r=>o(t)))}else{o(null,i)}};let a=0;if(i===0){return cb(null,0)}let c=0;const l=Buffer.alloc(512);const onread=(o,u)=>{if(o||typeof u==="undefined"){return cb(o)}c+=u;if(c<512&&u){return E.read(r,l,c,l.length-c,a+c,onread)}if(a===0&&l[0]===31&&l[1]===139){return cb(new Error("cannot append to compressed archives"))}if(c<512){return cb(null,a)}const h=new Header(l);if(!h.cksumValid){return cb(null,a)}const d=512*Math.ceil((h.size??0)/512);if(a+d+512>i){return cb(null,a)}a+=d+512;if(a>=i){return cb(null,a)}if(t.mtimeCache&&h.mtime){t.mtimeCache.set(String(h.path),h.mtime)}c=0;E.read(r,l,0,512,a,onread)};E.read(r,l,0,512,a,onread)};const o=new Promise(((o,a)=>{i.on("error",a);let c="r+";const onopen=(l,u)=>{if(l&&l.code==="ENOENT"&&c==="r+"){c="w+";return E.open(t.file,c,onopen)}if(l||!u){return a(l)}E.fstat(u,((c,l)=>{if(c){return E.close(u,(()=>a(c)))}getPos(u,l.size,((c,l)=>{if(c){return a(c)}const h=new WriteStream(t.file,{fd:u,start:l});i.pipe(h);h.on("error",a);h.on("close",o);replace_addFilesAsync(i,r)}))}))};E.open(t.file,c,onopen)}));return o};const replace_addFilesSync=(t,r)=>{r.forEach((r=>{if(r.charAt(0)==="@"){qr({file:S.resolve(t.cwd,r.slice(1)),sync:true,noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(r)}}));t.end()};const replace_addFilesAsync=async(t,r)=>{for(let i=0;i<r.length;i++){const o=String(r[i]);if(o.charAt(0)==="@"){await qr({file:S.resolve(String(t.cwd),o.slice(1)),noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(o)}}t.end()};const zi=makeCommand(replaceSync,replaceAsync,(()=>{throw new TypeError("file is required")}),(()=>{throw new TypeError("file is required")}),((t,r)=>{if(!isFile(t)){throw new TypeError("file is required")}if(t.gzip||t.brotli||t.file.endsWith(".br")||t.file.endsWith(".tbr")){throw new TypeError("cannot append to compressed archives")}if(!r?.length){throw new TypeError("no paths specified to add/replace")}}));const Gi=makeCommand(zi.syncFile,zi.asyncFile,zi.syncNoFile,zi.asyncNoFile,((t,r=[])=>{zi.validate?.(t,r);mtimeFilter(t)}));const mtimeFilter=t=>{const r=t.filter;if(!t.mtimeCache){t.mtimeCache=new Map}t.filter=r?(i,o)=>r(i,o)&&!((t.mtimeCache?.get(i)??o.mtime??0)>(o.mtime??0)):(r,i)=>!((t.mtimeCache?.get(r)??i.mtime??0)>(i.mtime??0))};async function isUrlOk(t){try{const r=await fetch(t,{method:"HEAD"});return r.status===200}catch{return false}}async function getRepoInfo(t,r){const[,i,o,a,c,...l]=t.pathname.split("/");const u=r?r.replace(/^\//,""):l.join("/");if(a===undefined||a===""&&c===undefined){try{const t=await fetch(`https://api.github.com/repos/${i}/${o}`);if(t.status!==200){return}const r=await t.json();return{username:i,name:o,branch:r["default_branch"],filePath:u}}catch{return}}const h=r?`${c}/${l.join("/")}`.replace(new RegExp(`/${u}|/$`),""):c;if(i&&o&&h&&a==="tree"){return{username:i,name:o,branch:h,filePath:u}}}function hasRepo({username:t,name:r,branch:i,filePath:o}){const a=`https://api.github.com/repos/${t}/${r}/contents`;const c=`${o?`/${o}`:""}/package.json`;return isUrlOk(a+c+`?ref=${i}`)}function existsInRepo(t){try{const r=new URL(t);return isUrlOk(r.href)}catch{return isUrlOk(`https://api.github.com/repos/vercel/next.js/contents/examples/${encodeURIComponent(t)}`)}}async function downloadTarStream(t){const r=await fetch(t);if(!r.body){throw new Error(`Failed to download: ${t}`)}return De.Readable.fromWeb(r.body)}async function downloadAndExtractRepo(t,{username:r,name:i,branch:o,filePath:a}){let c=null;await(0,Le.pipeline)(await downloadTarStream(`https://codeload.github.com/${r}/${i}/tar.gz/${o}`),Vi({cwd:t,strip:a?a.split("/").length+1:1,filter:t=>{const r=t.split(S.sep).join(S.posix.sep);if(c===null){const t=r.split(S.posix.sep);c=t.length?t[0]:null}return r.startsWith(`${c}${a?`/${a}/`:"/"}`)}}))}async function downloadAndExtractExample(t,r){if(r==="__internal-testing-retry"){throw new Error("This is an internal example for testing the CLI.")}await(0,Le.pipeline)(await downloadTarStream("https://codeload.github.com/vercel/next.js/tar.gz/canary"),Vi({cwd:t,strip:2+r.split("/").length,filter:t=>t.includes(`next.js-canary/examples/${r}/`)}))}var qi=__nccwpck_require__(7718);function isInGitRepository(){try{(0,qi.execSync)("git rev-parse --is-inside-work-tree",{stdio:"ignore"});return true}catch(t){}return false}function isInMercurialRepository(){try{(0,qi.execSync)("hg --cwd . root",{stdio:"ignore"});return true}catch(t){}return false}function isDefaultBranchSet(){try{(0,qi.execSync)("git config init.defaultBranch",{stdio:"ignore"});return true}catch(t){}return false}function tryGitInit(t){let r=false;try{(0,qi.execSync)("git --version",{stdio:"ignore"});if(isInGitRepository()||isInMercurialRepository()){return false}(0,qi.execSync)("git init",{stdio:"ignore"});r=true;if(!isDefaultBranchSet()){(0,qi.execSync)("git checkout -b main",{stdio:"ignore"})}(0,qi.execSync)("git add -A",{stdio:"ignore"});(0,qi.execSync)('git commit -m "Initial commit from Create Next App"',{stdio:"ignore"});return true}catch(i){if(r){try{(0,E.rmSync)((0,S.join)(t,".git"),{recursive:true,force:true})}catch(t){}}return false}}var Wi=__nccwpck_require__(1405);var Ki=__nccwpck_require__.n(Wi);async function install(t,r){const i=["install"];if(!r){console.log((0,Pe.yellow)("You appear to be offline.\nFalling back to the local cache."));i.push("--offline")}return new Promise(((r,o)=>{const a=Ki()(t,i,{stdio:"inherit",env:{...process.env,ADBLOCK:"1",NODE_ENV:"development",DISABLE_OPENCOLLECTIVE:"1"}});a.on("close",(a=>{if(a!==0){o({command:`${t} ${i.join(" ")}`});return}r()}))}))}function isFolderEmpty(t,r){const i=[".DS_Store",".git",".gitattributes",".gitignore",".gitlab-ci.yml",".hg",".hgcheck",".hgignore",".idea",".npmignore",".travis.yml","LICENSE","Thumbs.db","docs","mkdocs.yml","npm-debug.log","yarn-debug.log","yarn-error.log","yarnrc.yml",".yarn"];const o=(0,E.readdirSync)(t).filter((t=>!i.includes(t)&&!/\.iml$/.test(t)));if(o.length>0){console.log(`The directory ${(0,Pe.green)(r)} contains files that could conflict:`);console.log();for(const r of o){try{const i=(0,E.lstatSync)((0,S.join)(t,r));if(i.isDirectory()){console.log(` ${(0,Pe.blue)(r)}/`)}else{console.log(` ${r}`)}}catch{console.log(` ${r}`)}}console.log();console.log("Either try using a new directory name, or remove the files listed above.");console.log();return false}return true}const Yi=require("node:dns/promises");const Zi=require("node:url");function getProxy(){if(process.env.https_proxy){return process.env.https_proxy}try{const t=(0,qi.execSync)("npm config get https-proxy").toString().trim();return t!=="null"?t:undefined}catch(t){return}}async function getOnline(){try{await(0,Yi.lookup)("registry.yarnpkg.com");return true}catch{const t=getProxy();if(!t){return false}let r;try{r=new Zi.URL(t)}catch{return false}const{hostname:i}=r;if(!i){return false}try{await(0,Yi.lookup)(i);return true}catch{return false}}}const Xi=require("node:constants");const Ji=require("node:fs/promises");async function isWriteable(t){try{await(0,Ji.access)(t,Xi.W_OK);return true}catch(t){return false}}async function runTypegen(t){return new Promise(((r,i)=>{let o;let a;switch(t){case"npm":o="npm";a=["exec","next","--","typegen"];break;case"yarn":o="yarn";a=["exec","next","--","typegen"];break;case"pnpm":o="pnpm";a=["exec","next","--","typegen"];break;case"bun":o="bun";a=["next","typegen"];break;default:t;throw new Error(`Unsupported package manager: ${t}`)}const c=Ki()(o,a,{stdio:"inherit",env:{...process.env}});c.on("close",(t=>{if(t!==0){i(new Error(`next typegen exited with code ${t}`));return}r()}))}))}var Qi=__nccwpck_require__(9453);const identity=t=>t;const copy=async(t,r,{cwd:i,rename:o=identity,parents:a=true}={})=>{const c=typeof t==="string"?[t]:t;if(c.length===0||!r){throw new TypeError("`src` and `dest` are required")}const l=await(0,Qi.async)(c,{cwd:i,dot:true,absolute:false,stats:false});const u=i?(0,S.resolve)(i,r):r;return Promise.all(l.map((async t=>{const r=(0,S.dirname)(t);const c=o((0,S.basename)(t));const l=i?(0,S.resolve)(i,t):t;const h=a?(0,S.join)(u,r,c):(0,S.join)(u,c);await(0,Ji.mkdir)((0,S.dirname)(h),{recursive:true});return(0,Ji.copyFile)(l,h)})))};var en=__nccwpck_require__(2037);var tn=__nccwpck_require__.n(en);const rn=require("fs/promises");var sn=__nccwpck_require__.n(rn);var nn=__nccwpck_require__(833);const on=JSON.parse('{"name":"create-next-app","version":"16.1.1-canary.17","keywords":["react","next","next.js"],"description":"Create Next.js-powered React apps with one command","repository":{"type":"git","url":"https://github.com/vercel/next.js","directory":"packages/create-next-app"},"author":"Next.js Team <support@vercel.com>","license":"MIT","bin":{"create-next-app":"./dist/index.js"},"files":["dist"],"scripts":{"dev":"ncc build ./index.ts -w -o dist/","prebuild":"node ../../scripts/rm.mjs dist","build":"ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register","prepublishOnly":"cd ../../ && turbo run build","lint-fix":"pnpm prettier -w --plugin prettier-plugin-tailwindcss \'templates/*-tw/{ts,js}/{app,pages}/**/*.{js,ts,tsx}\'"},"devDependencies":{"@types/async-retry":"1.4.2","@types/cross-spawn":"6.0.0","@types/node":"20.14.2","@types/prompts":"2.4.2","@types/tar":"6.1.13","@types/validate-npm-package-name":"4.0.2","@vercel/ncc":"0.38.1","async-retry":"1.3.1","ci-info":"4.0.0","commander":"12.1.0","conf":"13.0.1","cross-spawn":"7.0.3","fast-glob":"3.3.1","picocolors":"1.0.0","prettier-plugin-tailwindcss":"0.6.2","prompts":"2.4.2","tar":"7.4.3","update-check":"1.5.4","validate-npm-package-name":"5.0.1"},"engines":{"node":">=20.9.0"}}');var an;(function(t){t["Turbopack"]="turbopack";t["Webpack"]="webpack";t["Rspack"]="rspack"})(an||(an={}));const cn="19.2.3";function sorted(t){return Object.keys(t).sort().reduce(((r,i)=>{r[i]=t[i];return r}),{})}const getTemplateFile=({template:t,mode:r,file:i})=>__nccwpck_require__.ab+"templates/"+t+"/"+r+"/"+i;const ln=["app","pages","styles"];const installTemplate=async({appName:t,root:r,packageManager:i,isOnline:o,template:a,mode:c,tailwind:l,eslint:u,biome:h,srcDir:d,importAlias:p,skipInstall:m,bundler:g,reactCompiler:y})=>{var v;console.log((0,Pe.bold)(`Using ${i}.`));console.log("\nInitializing project with template:",a,"\n");const b=a==="app-api";const w=__nccwpck_require__.ab+"templates/"+a+"/"+c;const E=["**"];if(!u)E.push("!eslint.config.mjs");if(!h)E.push("!biome.json");if(!l)E.push("!postcss.config.mjs");await copy(E,r,{parents:true,cwd:w,rename(t){switch(t){case"gitignore":{return`.${t}`}case"README-template.md":{return"README.md"}default:{return t}}}});if(g===an.Rspack){const t=Xt().join(r,c==="js"?"next.config.mjs":"next.config.ts");await sn().writeFile(t,`import withRspack from "next-rspack";\n\n`+(await sn().readFile(t,"utf8")).replace("export default nextConfig;","export default withRspack(nextConfig);"))}if(y){const t=Xt().join(r,c==="js"?"next.config.mjs":"next.config.ts");let i=await sn().readFile(t,"utf8");i=i.replace("/* config options here */\n","/* config options here */\n reactCompiler: true,\n");await sn().writeFile(t,i)}const S=Xt().join(r,c==="js"?"jsconfig.json":"tsconfig.json");await sn().writeFile(S,(await sn().readFile(S,"utf8")).replace(`"@/*": ["./*"]`,d?`"@/*": ["./src/*"]`:`"@/*": ["./*"]`).replace(`"@/*":`,`"${p}":`));if(p!=="@/*"){const t=await(0,Qi.async)("**/*",{cwd:r,dot:true,stats:false,ignore:["tsconfig.json","jsconfig.json",".git/**/*","**/fonts/**","**/favicon.ico"]});const i=new nn.Sema(8,{capacity:t.length});await Promise.all(t.map((async t=>{await i.acquire();const o=Xt().join(r,t);if((await sn().stat(o)).isFile()){await sn().writeFile(o,(await sn().readFile(o,"utf8")).replace(`@/`,`${p.replace(/\*/g,"")}`))}i.release()})))}if(d){await sn().mkdir(Xt().join(r,"src"),{recursive:true});await Promise.all(ln.map((async t=>{await sn().rename(Xt().join(r,t),Xt().join(r,"src",t)).catch((t=>{if(t.code!=="ENOENT"){throw t}}))})));if(!b){const t=a.startsWith("app");const r=Xt().join("src",t?"app":"pages",`${t?"page":"index"}.${c==="ts"?"tsx":"js"}`);await sn().writeFile(r,(await sn().readFile(r,"utf8")).replace(t?"app/page":"pages/index",t?"src/app/page":"src/pages/index"))}}const $=(v=process.env.NEXT_PRIVATE_TEST_VERSION)!==null&&v!==void 0?v:on.version;const x=g===an.Webpack?" --webpack":"";const R={name:t,version:"0.1.0",private:true,scripts:{dev:`next dev${x}`,build:`next build${x}`,start:"next start",...u&&{lint:"eslint"},...h&&{lint:"biome check",format:"biome format --write"}},dependencies:{react:cn,"react-dom":cn,next:$},devDependencies:{}};if(g===an.Rspack){const t=process.env.NEXT_PRIVATE_TEST_VERSION;if(t&&Xt().isAbsolute(t)){R.dependencies["next-rspack"]=Xt().resolve(Xt().dirname(t),"../next-rspack/next-rspack-packed.tgz")}else{R.dependencies["next-rspack"]=$}}if(y){R.devDependencies["babel-plugin-react-compiler"]="1.0.0"}if(c==="ts"){R.devDependencies={...R.devDependencies,typescript:"^5","@types/node":"^20","@types/react":"^19","@types/react-dom":"^19"}}if(l){R.devDependencies={...R.devDependencies,"@tailwindcss/postcss":"^4",tailwindcss:"^4"}}if(u){R.devDependencies={...R.devDependencies,eslint:"^9","eslint-config-next":$}}if(h){R.devDependencies={...R.devDependencies,"@biomejs/biome":"2.2.0"}}if(b){delete R.dependencies.react;delete R.dependencies["react-dom"];delete R.devDependencies["@types/react-dom"];delete R.scripts.lint;delete R.scripts.format}const O=Object.keys(R.devDependencies).length;if(!O)delete R.devDependencies;if(R.dependencies){R.dependencies=sorted(R.dependencies)}if(R.devDependencies){R.devDependencies=sorted(R.devDependencies)}if(i==="pnpm"){const t=["packages:"," - .","ignoredBuiltDependencies:"," - sharp"," - unrs-resolver",""].join(tn().EOL);await sn().writeFile(Xt().join(r,"pnpm-workspace.yaml"),t)}if(i==="bun"){R.ignoreScripts=["sharp","unrs-resolver"];R.trustedDependencies=["sharp","unrs-resolver"]}await sn().writeFile(Xt().join(r,"package.json"),JSON.stringify(R,null,2)+tn().EOL);if(m)return;console.log("\nInstalling dependencies:");for(const t in R.dependencies)console.log(`- ${(0,Pe.cyan)(t)}`);if(O){console.log("\nInstalling devDependencies:");for(const t in R.devDependencies)console.log(`- ${(0,Pe.cyan)(t)}`)}console.log();await install(i,o);try{console.log();await runTypegen(i);console.log()}catch(t){console.error("Error running typegen:",t)}};class DownloadError extends Error{}async function createApp({appPath:t,packageManager:r,example:i,examplePath:o,typescript:a,tailwind:c,eslint:l,biome:u,app:h,srcDir:d,importAlias:p,skipInstall:m,empty:g,api:y,bundler:v,disableGit:b,reactCompiler:w}){let $;const x=a?"ts":"js";const R=`${h?"app":"default"}${c?"-tw":""}${g?"-empty":""}`;if(i){let D;try{D=new URL(i)}catch(L){const M=L;if(!(M instanceof TypeError)){console.error(L);process.exit(1)}}if(D){if(D.origin!=="https://github.com"){console.error(`Invalid URL: ${(0,Pe.red)(`"${i}"`)}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`);process.exit(1)}$=await getRepoInfo(D,o);if(!$){console.error(`Found invalid GitHub URL: ${(0,Pe.red)(`"${i}"`)}. Please fix the URL and try again.`);process.exit(1)}const j=await hasRepo($);if(!j){console.error(`Could not locate the repository for ${(0,Pe.red)(`"${i}"`)}. Please check that the repository exists and try again.`);process.exit(1)}}else if(i!=="__internal-testing-retry"){const U=await existsInRepo(i);if(!U){console.error(`Could not locate an example named ${(0,Pe.red)(`"${i}"`)}. It could be due to the following:\n`,`1. Your spelling of example ${(0,Pe.red)(`"${i}"`)} might be incorrect.\n`,`2. You might not be connected to the internet or you are behind a proxy.`);process.exit(1)}}}const O=(0,S.resolve)(t);if(!await isWriteable((0,S.dirname)(O))){console.error("The application path is not writable, please check folder permissions and try again.");console.error("It is likely you do not have write permissions for this folder.");process.exit(1)}const P=(0,S.basename)(O);(0,E.mkdirSync)(O,{recursive:true});if(!isFolderEmpty(O,P)){process.exit(1)}const A=r==="yarn";const T=!A||await getOnline();const C=process.cwd();console.log(`Creating a new Next.js app in ${(0,Pe.green)(O)}.`);console.log();process.chdir(O);const k=(0,S.join)(O,"package.json");let I=false;if(i){try{if($){const V=$;console.log(`Downloading files from repo ${(0,Pe.cyan)(i)}. This might take a moment.`);console.log();await Ne()((()=>downloadAndExtractRepo(O,V)),{retries:3})}else{console.log(`Downloading files for example ${(0,Pe.cyan)(i)}. This might take a moment.`);console.log();await Ne()((()=>downloadAndExtractExample(O,i)),{retries:3})}}catch(z){function isErrorLike(t){return typeof t==="object"&&t!==null&&typeof t.message==="string"}throw new DownloadError(isErrorLike(z)?z.message:z+"")}const B=(0,S.join)(O,".gitignore");if(!(0,E.existsSync)(B)){(0,E.copyFileSync)(getTemplateFile({template:R,mode:x,file:"gitignore"}),B)}const H=(0,S.join)(O,"tsconfig.json");if((0,E.existsSync)(H)){(0,E.copyFileSync)(getTemplateFile({template:R,mode:"ts",file:"next-env.d.ts"}),(0,S.join)(O,"next-env.d.ts"))}I=(0,E.existsSync)(k);if(!m&&I){console.log("Installing packages. This might take a couple of minutes.");console.log();await install(r,T);console.log();try{console.log();await runTypegen(r);console.log()}catch(G){console.error("Error running typegen:",G)}}}else{await installTemplate({appName:P,root:O,template:y?"app-api":R,mode:x,packageManager:r,isOnline:T,tailwind:c,eslint:l,biome:u,srcDir:d,importAlias:p,skipInstall:m,bundler:v,reactCompiler:w})}if(b){console.log("Skipping git initialization.");console.log()}else if(tryGitInit(O)){console.log("Initialized a git repository.");console.log()}let N;if((0,S.join)(C,P)===t){N=P}else{N=t}console.log(`${(0,Pe.green)("Success!")} Created ${P} at ${t}`);if(I){console.log("Inside that directory, you can run several commands:");console.log();console.log((0,Pe.cyan)(` ${r} ${A?"":"run "}dev`));console.log(" Starts the development server.");console.log();console.log((0,Pe.cyan)(` ${r} ${A?"":"run "}build`));console.log(" Builds the app for production.");console.log();console.log((0,Pe.cyan)(` ${r} start`));console.log(" Runs the built app in production mode.");console.log();console.log("We suggest that you begin by typing:");console.log();console.log((0,Pe.cyan)(" cd"),N);console.log(` ${(0,Pe.cyan)(`${r} ${A?"":"run "}dev`)}`)}console.log()}function getPkgManager(){const t=process.env.npm_config_user_agent||"";if(t.startsWith("yarn")){return"yarn"}if(t.startsWith("pnpm")){return"pnpm"}if(t.startsWith("bun")){return"bun"}return"npm"}var un=__nccwpck_require__(6982);var hn=__nccwpck_require__.n(un);function validateNpmName(t){const r=hn()(t);if(r.validForNewPackages){return{valid:true}}return{valid:false,problems:[...r.errors||[],...r.warnings||[]]}}let dn="";const handleSigTerm=()=>process.exit(0);process.on("SIGINT",handleSigTerm);process.on("SIGTERM",handleSigTerm);const onPromptState=t=>{if(t.aborted){process.stdout.write("[?25h");process.stdout.write("\n");process.exit(1)}};const fn=new m(on.name).version(on.version,"-v, --version","Output the current version of create-next-app.").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","Display this help message.").option("--ts, --typescript","Initialize as a TypeScript project. (default)").option("--js, --javascript","Initialize as a JavaScript project.").option("--tailwind","Initialize with Tailwind CSS config. (default)").option("--react-compiler","Initialize with React Compiler enabled.").option("--eslint","Initialize with ESLint config.").option("--biome","Initialize with Biome config.").option("--app","Initialize as an App Router project.").option("--src-dir","Initialize inside a 'src/' directory.").option("--turbopack","Enable Turbopack as the bundler.").option("--webpack","Enable Webpack as the bundler.").option("--rspack","Enable Rspack as the bundler.").option("--import-alias <prefix/*>",'Specify import alias to use (default "@/*").').option("--api","Initialize a headless API using the App Router.").option("--empty","Initialize an empty project.").option("--use-npm","Explicitly tell the CLI to bootstrap the application using npm.").option("--use-pnpm","Explicitly tell the CLI to bootstrap the application using pnpm.").option("--use-yarn","Explicitly tell the CLI to bootstrap the application using Yarn.").option("--use-bun","Explicitly tell the CLI to bootstrap the application using Bun.").option("--reset, --reset-preferences","Reset the preferences saved for create-next-app.").option("--skip-install","Explicitly tell the CLI to skip installing packages.").option("--yes","Use saved preferences or defaults for unprovided options.").option("-e, --example <example-name|github-url>",`\n\n An example to bootstrap the app with. You can use an example name\n from the official Next.js repo or a public GitHub URL. The URL can use\n any branch and/or subdirectory.\n`).option("--example-path <path-to-example>",`\n\n In a rare case, your GitHub URL might contain a branch name with\n a slash (e.g. bug/fix-1) and the path to the example (e.g. foo/bar).\n In this case, you must specify the path to the example separately:\n --example-path foo/bar\n`).option("--disable-git",`Skip initializing a git repository.`).action((t=>{if(t&&!t.startsWith("--no-")){dn=t}})).allowUnknownOption().parse(process.argv);const pn=fn.opts();const{args:mn}=fn;const gn=!!pn.useNpm?"npm":!!pn.usePnpm?"pnpm":!!pn.useYarn?"yarn":!!pn.useBun?"bun":getPkgManager();async function run(){const t=new Conf({projectName:"create-next-app"});if(pn.resetPreferences){const{resetPreferences:r}=await Te()({onState:onPromptState,type:"toggle",name:"resetPreferences",message:"Would you like to reset the saved preferences?",initial:false,active:"Yes",inactive:"No"});if(r){t.clear();console.log("The preferences have been reset successfully!")}process.exit(0)}if(typeof dn==="string"){dn=dn.trim()}if(!dn){const t=await Te()({onState:onPromptState,type:"text",name:"path",message:"What is your project named?",initial:"my-app",validate:t=>{const r=validateNpmName((0,S.basename)((0,S.resolve)(t)));if(r.valid){return true}return"Invalid project name: "+r.problems[0]}});if(typeof t.path==="string"){dn=t.path.trim()}}if(!dn){console.log("\nPlease specify the project directory:\n"+` ${(0,Pe.cyan)(pn.name())} ${(0,Pe.green)("<project-directory>")}\n`+"For example:\n"+` ${(0,Pe.cyan)(pn.name())} ${(0,Pe.green)("my-next-app")}\n\n`+`Run ${(0,Pe.cyan)(`${pn.name()} --help`)} to see all options.`);process.exit(1)}const i=(0,S.resolve)(dn);const o=(0,S.basename)(i);const a=validateNpmName(o);if(!a.valid){console.error(`Could not create a project called ${(0,Pe.red)(`"${o}"`)} because of npm naming restrictions:`);a.problems.forEach((t=>console.error(` ${(0,Pe.red)((0,Pe.bold)("*"))} ${t}`)));process.exit(1)}if(pn.example===true){console.error("Please provide an example name or url, otherwise remove the example option.");process.exit(1)}if((0,E.existsSync)(i)&&!isFolderEmpty(i,o)){process.exit(1)}const c=typeof pn.example==="string"&&pn.example.trim();const l=t.get("preferences")||{};let u=r().isCI||pn.yes;let h=false;if(!c){const t={typescript:true,eslint:false,linter:"eslint",tailwind:true,app:true,srcDir:false,importAlias:"@/*",customizeImportAlias:false,empty:false,disableGit:false,reactCompiler:false};const r=[{key:"typescript",values:{true:"TypeScript",false:"JavaScript"}},{key:"linter",values:{eslint:"ESLint",biome:"Biome"}},{key:"reactCompiler",values:{true:"React Compiler"}},{key:"tailwind",values:{true:"Tailwind CSS"}},{key:"srcDir",values:{true:"src/ dir"}},{key:"app",values:{true:"App Router",false:"Pages Router"}}];const formatSettingsDescription=t=>{const i=[];for(const o of r){const r=t[o.key];if(o.values){const t=o.values[String(r)];if(t){i.push(t)}}}return i.join(", ")};const i=Object.keys(l).length>0;const o=process.argv.some((t=>t.startsWith("--")));if(!u&&!o){const r=[{title:"Yes, use recommended defaults",value:"recommended",description:formatSettingsDescription(t)},{title:"No, customize settings",value:"customize",description:"Choose your own preferences"}];if(i){const t=formatSettingsDescription(l);r.splice(1,0,{title:"No, reuse previous settings",value:"reuse",description:t})}const{setupChoice:o}=await Te()({type:"select",name:"setupChoice",message:"Would you like to use the recommended Next.js defaults?",choices:r,initial:0},{onCancel:()=>{console.error("Exiting.");process.exit(1)}});if(o==="recommended"){h=true;u=true}else if(o==="reuse"){u=true}}if(h){Object.assign(l,t)}const getPrefOrDefault=r=>{var i;if(h){return t[r]}return(i=l[r])!==null&&i!==void 0?i:t[r]};if(!pn.typescript&&!pn.javascript){if(u){pn.typescript=getPrefOrDefault("typescript")}else{const t=(0,Pe.blue)("TypeScript");const{typescript:r}=await Te()({type:"toggle",name:"typescript",message:`Would you like to use ${t}?`,initial:getPrefOrDefault("typescript"),active:"Yes",inactive:"No"},{onCancel:()=>{console.error("Exiting.");process.exit(1)}});pn.typescript=Boolean(r);pn.javascript=!r;l.typescript=Boolean(r)}}const a=mn.includes("--no-linter")||mn.includes("--no-eslint");if(!pn.eslint&&!pn.biome&&!a&&!pn.api){if(u){const t=getPrefOrDefault("linter");pn.eslint=t==="eslint";pn.biome=t==="biome"}else{const t={eslint:0,biome:1,none:2};const{linter:r}=await Te()({onState:onPromptState,type:"select",name:"linter",message:"Which linter would you like to use?",choices:[{title:"ESLint",value:"eslint",description:"More comprehensive lint rules"},{title:"Biome",value:"biome",description:"Fast formatter and linter (fewer rules)"},{title:"None",value:"none",description:"Skip linter configuration"}],initial:t[getPrefOrDefault("linter")]});pn.eslint=r==="eslint";pn.biome=r==="biome";l.linter=r;l.eslint=r==="eslint"}}else if(pn.eslint){pn.biome=false;l.linter="eslint";l.eslint=true}else if(pn.biome){pn.eslint=false;l.linter="biome";l.eslint=false}else if(a){pn.eslint=false;pn.biome=false;l.linter="none";l.eslint=false}if(!pn.reactCompiler&&!mn.includes("--no-react-compiler")&&!pn.api){if(u){pn.reactCompiler=getPrefOrDefault("reactCompiler")}else{const t=(0,Pe.blue)("React Compiler");const{reactCompiler:r}=await Te()({onState:onPromptState,type:"toggle",name:"reactCompiler",message:`Would you like to use ${t}?`,initial:getPrefOrDefault("reactCompiler"),active:"Yes",inactive:"No"});pn.reactCompiler=Boolean(r);l.reactCompiler=Boolean(r)}}if(!pn.tailwind&&!mn.includes("--no-tailwind")&&!pn.api){if(u){pn.tailwind=getPrefOrDefault("tailwind")}else{const t=(0,Pe.blue)("Tailwind CSS");const{tailwind:r}=await Te()({onState:onPromptState,type:"toggle",name:"tailwind",message:`Would you like to use ${t}?`,initial:getPrefOrDefault("tailwind"),active:"Yes",inactive:"No"});pn.tailwind=Boolean(r);l.tailwind=Boolean(r)}}if(!pn.srcDir&&!mn.includes("--no-src-dir")){if(u){pn.srcDir=getPrefOrDefault("srcDir")}else{const t=(0,Pe.blue)("`src/` directory");const{srcDir:r}=await Te()({onState:onPromptState,type:"toggle",name:"srcDir",message:`Would you like your code inside a ${t}?`,initial:getPrefOrDefault("srcDir"),active:"Yes",inactive:"No"});pn.srcDir=Boolean(r);l.srcDir=Boolean(r)}}if(!pn.app&&!mn.includes("--no-app")&&!pn.api){if(u){pn.app=getPrefOrDefault("app")}else{const t=(0,Pe.blue)("App Router");const{app:r}=await Te()({onState:onPromptState,type:"toggle",name:"app",message:`Would you like to use ${t}? (recommended)`,initial:getPrefOrDefault("app"),active:"Yes",inactive:"No"});pn.app=Boolean(r);l.app=Boolean(r)}}const c=/^[^*"]+\/\*\s*$/;if(typeof pn.importAlias!=="string"||!c.test(pn.importAlias)){if(u){pn.importAlias=t.importAlias}else if(mn.includes("--no-import-alias")){pn.importAlias=t.importAlias}else{const r=(0,Pe.blue)("import alias");const{customizeImportAlias:i}=await Te()({onState:onPromptState,type:"toggle",name:"customizeImportAlias",message:`Would you like to customize the ${r} (\`${t.importAlias}\` by default)?`,initial:getPrefOrDefault("customizeImportAlias"),active:"Yes",inactive:"No"});if(!i){pn.importAlias=t.importAlias}else{const{importAlias:t}=await Te()({onState:onPromptState,type:"text",name:"importAlias",message:`What ${r} would you like configured?`,initial:getPrefOrDefault("importAlias"),validate:t=>c.test(t)?true:"Import alias must follow the pattern <prefix>/*"});pn.importAlias=t;l.importAlias=t}}}}const d=pn.turbopack?an.Turbopack:pn.webpack?an.Webpack:pn.rspack?an.Rspack:an.Turbopack;try{await createApp({appPath:i,packageManager:gn,example:c&&c!=="default"?c:undefined,examplePath:pn.examplePath,typescript:pn.typescript,tailwind:pn.tailwind,eslint:pn.eslint,biome:pn.biome,app:pn.app,srcDir:pn.srcDir,importAlias:pn.importAlias,skipInstall:pn.skipInstall,empty:pn.empty,api:pn.api,bundler:d,disableGit:pn.disableGit,reactCompiler:pn.reactCompiler})}catch(t){if(!(t instanceof DownloadError)){throw t}const r=await Te()({onState:onPromptState,type:"confirm",name:"builtin",message:`Could not download "${c}" because of a connectivity issue between your machine and GitHub.\n`+`Do you want to use the default template instead?`,initial:true});if(!r.builtin){throw t}await createApp({appPath:i,packageManager:gn,typescript:pn.typescript,eslint:pn.eslint,biome:pn.biome,tailwind:pn.tailwind,app:pn.app,srcDir:pn.srcDir,importAlias:pn.importAlias,skipInstall:pn.skipInstall,empty:pn.empty,bundler:d,disableGit:pn.disableGit,reactCompiler:pn.reactCompiler})}t.set("preferences",l)}const yn=ke()(on).catch((()=>null));async function notifyUpdate(){var t;try{if((t=await yn)===null||t===void 0?void 0:t.latest){const t={npm:"npm i -g",yarn:"yarn global add",pnpm:"pnpm add -g",bun:"bun add -g"};const r=`${t[gn]} create-next-app`;console.log((0,Pe.yellow)((0,Pe.bold)("A new version of `create-next-app` is available!"))+"\n"+"You can update by running: "+(0,Pe.cyan)(r)+"\n")}process.exit(0)}catch{}}async function exit(t){console.log();console.log("Aborting installation.");if(t.command){console.log(` ${(0,Pe.cyan)(t.command)} has failed.`)}else{console.log((0,Pe.red)("Unexpected error. Please report it as a bug:")+"\n",t)}console.log();await notifyUpdate();process.exit(1)}run().then(notifyUpdate).catch(exit)})();module.exports=i})();
|