{"use strict";Tp.exports=Op;function Op(r,e,t){r instanceof RegExp&&(r=kp(r,t)),e instanceof RegExp&&(e=kp(e,t));var i=Cp(r,e,t);return i&&{start:i[0],end:i[1],pre:t.slice(0,i[0]),body:t.slice(i[0]+r.length,i[1]),post:t.slice(i[1]+e.length)}}function kp(r,e){var t=e.match(r);return t?t[0]:null}Op.range=Cp;function Cp(r,e,t){var i,n,s,a,o,l=t.indexOf(r),c=t.indexOf(e,l+1),u=l;if(l>=0&&c>0){if(r===e)return[l,c];for(i=[],s=t.length;u>=0&&!o;)u==l?(i.push(u),l=t.indexOf(r,u+1)):i.length==1?o=[i.pop(),c]:(n=i.pop(),n=0?l:c;i.length&&(o=[s,a])}return o}});var Dp=w((NL,Mp)=>{var x1=Ep(),Ip=Ap();Mp.exports=E1;var Np="\0SLASH"+Math.random()+"\0",Lp="\0OPEN"+Math.random()+"\0",ec="\0CLOSE"+Math.random()+"\0",Bp="\0COMMA"+Math.random()+"\0",Rp="\0PERIOD"+Math.random()+"\0";function Xl(r){return parseInt(r,10)==r?parseInt(r,10):r.charCodeAt(0)}function w1(r){return r.split("\\\\").join(Np).split("\\{").join(Lp).split("\\}").join(ec).split("\\,").join(Bp).split("\\.").join(Rp)}function S1(r){return r.split(Np).join("\\").split(Lp).join("{").split(ec).join("}").split(Bp).join(",").split(Rp).join(".")}function Pp(r){if(!r)return[""];var e=[],t=Ip("{","}",r);if(!t)return r.split(",");var i=t.pre,n=t.body,s=t.post,a=i.split(",");a[a.length-1]+="{"+n+"}";var o=Pp(s);return s.length&&(a[a.length-1]+=o.shift(),a.push.apply(a,o)),e.push.apply(e,a),e}function E1(r){return r?(r.substr(0,2)==="{}"&&(r="\\{\\}"+r.substr(2)),gn(w1(r),!0).map(S1)):[]}function k1(r){return"{"+r+"}"}function O1(r){return/^-?0\d/.test(r)}function C1(r,e){return r<=e}function T1(r,e){return r>=e}function gn(r,e){var t=[],i=Ip("{","}",r);if(!i||/\$$/.test(i.pre))return[r];var n=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),s=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),a=n||s,o=i.body.indexOf(",")>=0;if(!a&&!o)return i.post.match(/,(?!,).*\}/)?(r=i.pre+"{"+i.body+ec+i.post,gn(r)):[r];var l;if(a)l=i.body.split(/\.\./);else if(l=Pp(i.body),l.length===1&&(l=gn(l[0],!1).map(k1),l.length===1)){var u=i.post.length?gn(i.post,!1):[""];return u.map(function(P){return i.pre+l[0]+P})}var c=i.pre,u=i.post.length?gn(i.post,!1):[""],f;if(a){var p=Xl(l[0]),m=Xl(l[1]),g=Math.max(l[0].length,l[1].length),y=l.length==3?Math.abs(Xl(l[2])):1,_=C1,x=m0){var R=new Array(E+1).join("0");O<0?k="-"+R+k.slice(1):k=R+k}}f.push(k)}}else f=x1(l,function(L){return gn(L,!1)});for(var T=0;T{$p.exports=Dt;Dt.Minimatch=ct;var as=(function(){try{return require("path")}catch{}})()||{sep:"/"};Dt.sep=as.sep;var ic=Dt.GLOBSTAR=ct.GLOBSTAR={},A1=Dp(),Fp={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},tc="[^/]",rc=tc+"*?",I1="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",N1="(?:(?!(?:\\/|^)\\.).)*?",qp=L1("().*{}+?[]^$\\!");function L1(r){return r.split("").reduce(function(e,t){return e[t]=!0,e},{})}var jp=/\/+/;Dt.filter=B1;function B1(r,e){return e=e||{},function(t,i,n){return Dt(t,r,e)}}function Hr(r,e){e=e||{};var t={};return Object.keys(r).forEach(function(i){t[i]=r[i]}),Object.keys(e).forEach(function(i){t[i]=e[i]}),t}Dt.defaults=function(r){if(!r||typeof r!="object"||!Object.keys(r).length)return Dt;var e=Dt,t=function(n,s,a){return e(n,s,Hr(r,a))};return t.Minimatch=function(n,s){return new e.Minimatch(n,Hr(r,s))},t.Minimatch.defaults=function(n){return e.defaults(Hr(r,n)).Minimatch},t.filter=function(n,s){return e.filter(n,Hr(r,s))},t.defaults=function(n){return e.defaults(Hr(r,n))},t.makeRe=function(n,s){return e.makeRe(n,Hr(r,s))},t.braceExpand=function(n,s){return e.braceExpand(n,Hr(r,s))},t.match=function(i,n,s){return e.match(i,n,Hr(r,s))},t};ct.defaults=function(r){return Dt.defaults(r).Minimatch};function Dt(r,e,t){return Da(e),t||(t={}),!t.nocomment&&e.charAt(0)==="#"?!1:new ct(e,t).match(r)}function ct(r,e){if(!(this instanceof ct))return new ct(r,e);Da(r),e||(e={}),r=r.trim(),!e.allowWindowsEscape&&as.sep!=="/"&&(r=r.split(as.sep).join("/")),this.options=e,this.set=[],this.pattern=r,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.make()}ct.prototype.debug=function(){};ct.prototype.make=R1;function R1(){var r=this.pattern,e=this.options;if(!e.nocomment&&r.charAt(0)==="#"){this.comment=!0;return}if(!r){this.empty=!0;return}this.parseNegate();var t=this.globSet=this.braceExpand();e.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,t),t=this.globParts=t.map(function(i){return i.split(jp)}),this.debug(this.pattern,t),t=t.map(function(i,n,s){return i.map(this.parse,this)},this),this.debug(this.pattern,t),t=t.filter(function(i){return i.indexOf(!1)===-1}),this.debug(this.pattern,t),this.set=t}ct.prototype.parseNegate=P1;function P1(){var r=this.pattern,e=!1,t=this.options,i=0;if(!t.nonegate){for(var n=0,s=r.length;nM1)throw new TypeError("pattern is too long")};ct.prototype.parse=D1;var Ma={};function D1(r,e){Da(r);var t=this.options;if(r==="**")if(t.noglobstar)r="*";else return ic;if(r==="")return"";var i="",n=!!t.nocase,s=!1,a=[],o=[],l,c=!1,u=-1,f=-1,p=r.charAt(0)==="."?"":t.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",m=this;function g(){if(l){switch(l){case"*":i+=rc,n=!0;break;case"?":i+=tc,n=!0;break;default:i+="\\"+l;break}m.debug("clearStateChar %j %j",l,i),l=!1}}for(var y=0,_=r.length,x;y<_&&(x=r.charAt(y));y++){if(this.debug("%s %s %s %j",r,y,i,x),s&&qp[x]){i+="\\"+x,s=!1;continue}switch(x){case"/":return!1;case"\\":g(),s=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",r,y,i,x),c){this.debug(" in class"),x==="!"&&y===f+1&&(x="^"),i+=x;continue}m.debug("call clearStateChar %j",l),g(),l=x,t.noext&&g();continue;case"(":if(c){i+="(";continue}if(!l){i+="\\(";continue}a.push({type:l,start:y-1,reStart:i.length,open:Fp[l].open,close:Fp[l].close}),i+=l==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",l,i),l=!1;continue;case")":if(c||!a.length){i+="\\)";continue}g(),n=!0;var S=a.pop();i+=S.close,S.type==="!"&&o.push(S),S.reEnd=i.length;continue;case"|":if(c||!a.length||s){i+="\\|",s=!1;continue}g(),i+="|";continue;case"[":if(g(),c){i+="\\"+x;continue}c=!0,f=y,u=i.length,i+=x;continue;case"]":if(y===f+1||!c){i+="\\"+x,s=!1;continue}var O=r.substring(f+1,y);try{RegExp("["+O+"]")}catch{var k=this.parse(O,Ma);i=i.substr(0,u)+"\\["+k[0]+"\\]",n=n||k[1],c=!1;continue}n=!0,c=!1,i+=x;continue;default:g(),s?s=!1:qp[x]&&!(x==="^"&&c)&&(i+="\\"),i+=x}}for(c&&(O=r.substr(f+1),k=this.parse(O,Ma),i=i.substr(0,u)+"\\["+k[0],n=n||k[1]),S=a.pop();S;S=a.pop()){var E=i.slice(S.reStart+S.open.length);this.debug("setting tail",i,S),E=E.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(we,de,ue){return ue||(ue="\\"),de+de+ue+"|"}),this.debug(`tail=%j
- %s`,E,E,S,i);var R=S.type==="*"?rc:S.type==="?"?tc:"\\"+S.type;n=!0,i=i.slice(0,S.reStart)+R+"\\("+E}g(),s&&(i+="\\\\");var T=!1;switch(i.charAt(0)){case"[":case".":case"(":T=!0}for(var A=o.length-1;A>-1;A--){var C=o[A],L=i.slice(0,C.reStart),P=i.slice(C.reStart,C.reEnd-8),$=i.slice(C.reEnd-8,C.reEnd),q=i.slice(C.reEnd);$+=q;var G=L.split("(").length-1,U=q;for(y=0;y=0&&(s=e[a],!s);a--);for(a=0;a>> no match, partial?`,r,u,e,f),u===a))}var m;if(typeof l=="string"?(m=c===l,this.debug("string match",l,c,m)):(m=c.match(l),this.debug("pattern match",l,c,m)),!m)return!1}if(n===a&&s===o)return!0;if(n===a)return t;if(s===o)return n===a-1&&r[n]==="";throw new Error("wtf?")};function q1(r){return r.replace(/\\(.)/g,"$1")}function j1(r){return r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var sc=w((BL,Gp)=>{"use strict";var Hp=require("fs"),nc;function U1(){try{return Hp.statSync("/.dockerenv"),!0}catch{return!1}}function $1(){try{return Hp.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}Gp.exports=()=>(nc===void 0&&(nc=U1()||$1()),nc)});var Yp=w((RL,ac)=>{"use strict";var V1=require("os"),H1=require("fs"),Wp=sc(),zp=()=>{if(process.platform!=="linux")return!1;if(V1.release().toLowerCase().includes("microsoft"))return!Wp();try{return H1.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Wp():!1}catch{return!1}};process.env.__IS_WSL_TEST__?ac.exports=zp:ac.exports=zp()});var Zp=w((PL,Kp)=>{"use strict";Kp.exports=(r,e,t)=>{let i=n=>Object.defineProperty(r,e,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get(){let n=t();return i(n),n},set(n){i(n)}}),r}});var im=w((ML,rm)=>{var G1=require("path"),W1=require("child_process"),{promises:oc,constants:tm}=require("fs"),Fa=Yp(),z1=sc(),lc=Zp(),Jp=G1.join(__dirname,"xdg-open"),{platform:vn,arch:Qp}=process,Y1=(()=>{let r="/mnt/",e;return async function(){if(e)return e;let t="/etc/wsl.conf",i=!1;try{await oc.access(t,tm.F_OK),i=!0}catch{}if(!i)return r;let n=await oc.readFile(t,{encoding:"utf8"}),s=/(?.*)/g.exec(n);return s?(e=s.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):r}})(),Xp=async(r,e)=>{let t;for(let i of r)try{return await e(i)}catch(n){t=n}throw t},qa=async r=>{if(r={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...r},Array.isArray(r.app))return Xp(r.app,o=>qa({...r,app:o}));let{name:e,arguments:t=[]}=r.app||{};if(t=[...t],Array.isArray(e))return Xp(e,o=>qa({...r,app:{name:o,arguments:t}}));let i,n=[],s={};if(vn==="darwin")i="open",r.wait&&n.push("--wait-apps"),r.background&&n.push("--background"),r.newInstance&&n.push("--new"),e&&n.push("-a",e);else if(vn==="win32"||Fa&&!z1()){let o=await Y1();i=Fa?`${o}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,n.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),Fa||(s.windowsVerbatimArguments=!0);let l=["Start"];r.wait&&l.push("-Wait"),e?(l.push(`"\`"${e}\`""`,"-ArgumentList"),r.target&&t.unshift(r.target)):r.target&&l.push(`"${r.target}"`),t.length>0&&(t=t.map(c=>`"\`"${c}\`""`),l.push(t.join(","))),r.target=Buffer.from(l.join(" "),"utf16le").toString("base64")}else{if(e)i=e;else{let o=!__dirname||__dirname==="/",l=!1;try{await oc.access(Jp,tm.X_OK),l=!0}catch{}i=process.versions.electron||vn==="android"||o||!l?"xdg-open":Jp}t.length>0&&n.push(...t),r.wait||(s.stdio="ignore",s.detached=!0)}r.target&&n.push(r.target),vn==="darwin"&&t.length>0&&n.push("--args",...t);let a=W1.spawn(i,n,s);return r.wait?new Promise((o,l)=>{a.once("error",l),a.once("close",c=>{if(r.allowNonzeroExitCode&&c>0){l(new Error(`Exited with code ${c}`));return}o(a)})}):(a.unref(),a)},cc=(r,e)=>{if(typeof r!="string")throw new TypeError("Expected a `target`");return qa({...e,target:r})},K1=(r,e)=>{if(typeof r!="string")throw new TypeError("Expected a `name`");let{arguments:t=[]}=e||{};if(t!=null&&!Array.isArray(t))throw new TypeError("Expected `appArguments` as Array type");return qa({...e,app:{name:r,arguments:t}})};function em(r){if(typeof r=="string"||Array.isArray(r))return r;let{[Qp]:e}=r;if(!e)throw new Error(`${Qp} is not supported`);return e}function uc({[vn]:r},{wsl:e}){if(e&&Fa)return em(e);if(!r)throw new Error(`${vn} is not supported`);return em(r)}var ja={};lc(ja,"chrome",()=>uc({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));lc(ja,"firefox",()=>uc({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));lc(ja,"edge",()=>uc({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));cc.apps=ja;cc.openApp=K1;rm.exports=cc});var fc=w((DL,sm)=>{"use strict";var Z1=require("util"),nm=require("stream"),sr=sm.exports=function(){nm.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};Z1.inherits(sr,nm);sr.prototype.read=function(r,e){this._reads.push({length:Math.abs(r),allowLess:r<0,func:e}),process.nextTick(function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}.bind(this))};sr.prototype.write=function(r,e){if(!this.writable)return this.emit("error",new Error("Stream not writable")),!1;let t;return Buffer.isBuffer(r)?t=r:t=Buffer.from(r,e||this._encoding),this._buffers.push(t),this._buffered+=t.length,this._process(),this._reads&&this._reads.length===0&&(this._paused=!0),this.writable&&!this._paused};sr.prototype.end=function(r,e){r&&this.write(r,e),this.writable=!1,this._buffers&&(this._buffers.length===0?this._end():(this._buffers.push(null),this._process()))};sr.prototype.destroySoon=sr.prototype.end;sr.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()};sr.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))};sr.prototype._processReadAllowingLess=function(r){this._reads.shift();let e=this._buffers[0];e.length>r.length?(this._buffered-=r.length,this._buffers[0]=e.slice(r.length),r.func.call(this,e.slice(0,r.length))):(this._buffered-=e.length,this._buffers.shift(),r.func.call(this,e))};sr.prototype._processRead=function(r){this._reads.shift();let e=0,t=0,i=Buffer.alloc(r.length);for(;e0&&this._buffers.splice(0,t),this._buffered-=r.length,r.func.call(this,i)};sr.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let r=this._reads[0];if(r.allowLess)this._processReadAllowingLess(r);else if(this._buffered>=r.length)this._processRead(r);else break}this._buffers&&!this.writable&&this._end()}catch(r){this.emit("error",r)}}});var dc=w(hc=>{"use strict";var Gr=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];hc.getImagePasses=function(r,e){let t=[],i=r%8,n=e%8,s=(r-i)/8,a=(e-n)/8;for(let o=0;o0&&u>0&&t.push({width:c,height:u,index:o})}return t};hc.getInterlaceIterator=function(r){return function(e,t,i){let n=e%Gr[i].x.length,s=(e-n)/Gr[i].x.length*8+Gr[i].x[n],a=t%Gr[i].y.length,o=(t-a)/Gr[i].y.length*8+Gr[i].y[a];return s*4+o*r*4}}});var pc=w((qL,am)=>{"use strict";am.exports=function(e,t,i){let n=e+t-i,s=Math.abs(n-e),a=Math.abs(n-t),o=Math.abs(n-i);return s<=a&&s<=o?e:a<=o?t:i}});var mc=w((jL,lm)=>{"use strict";var J1=dc(),Q1=pc();function om(r,e,t){let i=r*e;return t!==8&&(i=Math.ceil(i/(8/t))),i}var yn=lm.exports=function(r,e){let t=r.width,i=r.height,n=r.interlace,s=r.bpp,a=r.depth;if(this.read=e.read,this.write=e.write,this.complete=e.complete,this._imageIndex=0,this._images=[],n){let o=J1.getImagePasses(t,i);for(let l=0;ln?e[s-i]:0;e[s]=a+o}};yn.prototype._unFilterType2=function(r,e,t){let i=this._lastLine;for(let n=0;nn?e[a-i]:0,u=Math.floor((c+l)/2);e[a]=o+u}};yn.prototype._unFilterType4=function(r,e,t){let i=this._xComparison,n=i-1,s=this._lastLine;for(let a=0;an?e[a-i]:0,u=a>n&&s?s[a-i]:0,f=Q1(c,l,u);e[a]=o+f}};yn.prototype._reverseFilterLine=function(r){let e=r[0],t,i=this._images[this._imageIndex],n=i.byteWidth;if(e===0)t=r.slice(1,n+1);else switch(t=Buffer.alloc(n),e){case 1:this._unFilterType1(r,t,n);break;case 2:this._unFilterType2(r,t,n);break;case 3:this._unFilterType3(r,t,n);break;case 4:this._unFilterType4(r,t,n);break;default:throw new Error("Unrecognised filter type - "+e)}this.write(t),i.lineIndex++,i.lineIndex>=i.height?(this._lastLine=null,this._imageIndex++,i=this._images[this._imageIndex]):this._lastLine=t,i?this.read(i.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}});var fm=w((UL,um)=>{"use strict";var X1=require("util"),cm=fc(),eS=mc(),tS=um.exports=function(r){cm.call(this);let e=[],t=this;this._filter=new eS(r,{read:this.read.bind(this),write:function(i){e.push(i)},complete:function(){t.emit("complete",Buffer.concat(e))}}),this._filter.start()};X1.inherits(tS,cm)});var _n=w(($L,hm)=>{"use strict";hm.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}});var yc=w((VL,dm)=>{"use strict";var gc=[];(function(){for(let r=0;r<256;r++){let e=r;for(let t=0;t<8;t++)e&1?e=3988292384^e>>>1:e=e>>>1;gc[r]=e}})();var vc=dm.exports=function(){this._crc=-1};vc.prototype.write=function(r){for(let e=0;e>>8;return!0};vc.prototype.crc32=function(){return this._crc^-1};vc.crc32=function(r){let e=-1;for(let t=0;t>>8;return e^-1}});var _c=w((HL,pm)=>{"use strict";var Xe=_n(),rS=yc(),nt=pm.exports=function(r,e){this._options=r,r.checkCRC=r.checkCRC!==!1,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[Xe.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[Xe.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[Xe.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[Xe.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[Xe.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[Xe.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.finished=e.finished,this.simpleTransparency=e.simpleTransparency,this.headersFinished=e.headersFinished||function(){}};nt.prototype.start=function(){this.read(Xe.PNG_SIGNATURE.length,this._parseSignature.bind(this))};nt.prototype._parseSignature=function(r){let e=Xe.PNG_SIGNATURE;for(let t=0;tthis._palette.length){this.error(new Error("More transparent colors than palette size"));return}for(let e=0;e0?this._handleIDAT(t):this._handleChunkEnd()};nt.prototype._handleIEND=function(r){this.read(r,this._parseIEND.bind(this))};nt.prototype._parseIEND=function(r){this._crc.write(r),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}});var bc=w(gm=>{"use strict";var mm=dc(),iS=[function(){},function(r,e,t,i){if(i===e.length)throw new Error("Ran out of data");let n=e[i];r[t]=n,r[t+1]=n,r[t+2]=n,r[t+3]=255},function(r,e,t,i){if(i+1>=e.length)throw new Error("Ran out of data");let n=e[i];r[t]=n,r[t+1]=n,r[t+2]=n,r[t+3]=e[i+1]},function(r,e,t,i){if(i+2>=e.length)throw new Error("Ran out of data");r[t]=e[i],r[t+1]=e[i+1],r[t+2]=e[i+2],r[t+3]=255},function(r,e,t,i){if(i+3>=e.length)throw new Error("Ran out of data");r[t]=e[i],r[t+1]=e[i+1],r[t+2]=e[i+2],r[t+3]=e[i+3]}],nS=[function(){},function(r,e,t,i){let n=e[0];r[t]=n,r[t+1]=n,r[t+2]=n,r[t+3]=i},function(r,e,t){let i=e[0];r[t]=i,r[t+1]=i,r[t+2]=i,r[t+3]=e[1]},function(r,e,t,i){r[t]=e[0],r[t+1]=e[1],r[t+2]=e[2],r[t+3]=i},function(r,e,t){r[t]=e[0],r[t+1]=e[1],r[t+2]=e[2],r[t+3]=e[3]}];function sS(r,e){let t=[],i=0;function n(){if(i===r.length)throw new Error("Ran out of data");let s=r[i];i++;let a,o,l,c,u,f,p,m;switch(e){default:throw new Error("unrecognised depth");case 16:p=r[i],i++,t.push((s<<8)+p);break;case 4:p=s&15,m=s>>4,t.push(m,p);break;case 2:u=s&3,f=s>>2&3,p=s>>4&3,m=s>>6&3,t.push(m,p,f,u);break;case 1:a=s&1,o=s>>1&1,l=s>>2&1,c=s>>3&1,u=s>>4&1,f=s>>5&1,p=s>>6&1,m=s>>7&1,t.push(m,p,f,u,c,l,o,a);break}}return{get:function(s){for(;t.length{"use strict";function lS(r,e,t,i,n){let s=0;for(let a=0;a{"use strict";var fS=require("util"),wc=require("zlib"),ym=fc(),hS=fm(),dS=_c(),pS=bc(),mS=xc(),hr=_m.exports=function(r){ym.call(this),this._parser=new dS(r,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=r,this.writable=!0,this._parser.start()};fS.inherits(hr,ym);hr.prototype._handleError=function(r){this.emit("error",r),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",function(){})),this.errord=!0};hr.prototype._inflateData=function(r){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=wc.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let t=((this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1)*this._bitmapInfo.height,i=Math.max(t,wc.Z_MIN_CHUNK);this._inflate=wc.createInflate({chunkSize:i});let n=t,s=this.emit.bind(this,"error");this._inflate.on("error",function(o){n&&s(o)}),this._filter.on("complete",this._complete.bind(this));let a=this._filter.write.bind(this._filter);this._inflate.on("data",function(o){n&&(o.length>n&&(o=o.slice(0,n)),n-=o.length,a(o))}),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(r)};hr.prototype._handleMetaData=function(r){this._metaData=r,this._bitmapInfo=Object.create(r),this._filter=new hS(this._bitmapInfo)};hr.prototype._handleTransColor=function(r){this._bitmapInfo.transColor=r};hr.prototype._handlePalette=function(r){this._bitmapInfo.palette=r};hr.prototype._simpleTransparency=function(){this._metaData.alpha=!0};hr.prototype._headersFinished=function(){this.emit("metadata",this._metaData)};hr.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))};hr.prototype._complete=function(r){if(this.errord)return;let e;try{let t=pS.dataToBitMap(r,this._bitmapInfo);e=mS(t,this._bitmapInfo,this._options.skipRescale),t=null}catch(t){this._handleError(t);return}this.emit("parsed",e)}});var wm=w((YL,xm)=>{"use strict";var Gt=_n();xm.exports=function(r,e,t,i){let n=[Gt.COLORTYPE_COLOR_ALPHA,Gt.COLORTYPE_ALPHA].indexOf(i.colorType)!==-1;if(i.colorType===i.inputColorType){let g=(function(){let y=new ArrayBuffer(2);return new DataView(y).setInt16(0,256,!0),new Int16Array(y)[0]!==256})();if(i.bitDepth===8||i.bitDepth===16&&g)return r}let s=i.bitDepth!==16?r:new Uint16Array(r.buffer),a=255,o=Gt.COLORTYPE_TO_BPP_MAP[i.inputColorType];o===4&&!i.inputHasAlpha&&(o=3);let l=Gt.COLORTYPE_TO_BPP_MAP[i.colorType];i.bitDepth===16&&(a=65535,l*=2);let c=Buffer.alloc(e*t*l),u=0,f=0,p=i.bgColor||{};p.red===void 0&&(p.red=a),p.green===void 0&&(p.green=a),p.blue===void 0&&(p.blue=a);function m(){let g,y,_,x=a;switch(i.inputColorType){case Gt.COLORTYPE_COLOR_ALPHA:x=s[u+3],g=s[u],y=s[u+1],_=s[u+2];break;case Gt.COLORTYPE_COLOR:g=s[u],y=s[u+1],_=s[u+2];break;case Gt.COLORTYPE_ALPHA:x=s[u+1],g=s[u],y=g,_=g;break;case Gt.COLORTYPE_GRAYSCALE:g=s[u],y=g,_=g;break;default:throw new Error("input color type:"+i.inputColorType+" is not supported at present")}return i.inputHasAlpha&&(n||(x/=a,g=Math.min(Math.max(Math.round((1-x)*p.red+x*g),0),a),y=Math.min(Math.max(Math.round((1-x)*p.green+x*y),0),a),_=Math.min(Math.max(Math.round((1-x)*p.blue+x*_),0),a))),{red:g,green:y,blue:_,alpha:x}}for(let g=0;g{"use strict";var Sm=pc();function gS(r,e,t,i,n){for(let s=0;s=s?r[e+a-s]:0,l=r[e+a]-o;i[n+a]=l}}function _S(r,e,t,i){let n=0;for(let s=0;s=i?r[e+s-i]:0,o=r[e+s]-a;n+=Math.abs(o)}return n}function bS(r,e,t,i,n){for(let s=0;s0?r[e+s-t]:0,o=r[e+s]-a;i[n+s]=o}}function xS(r,e,t){let i=0,n=e+t;for(let s=e;s0?r[s-t]:0,o=r[s]-a;i+=Math.abs(o)}return i}function wS(r,e,t,i,n,s){for(let a=0;a=s?r[e+a-s]:0,l=e>0?r[e+a-t]:0,c=r[e+a]-(o+l>>1);i[n+a]=c}}function SS(r,e,t,i){let n=0;for(let s=0;s=i?r[e+s-i]:0,o=e>0?r[e+s-t]:0,l=r[e+s]-(a+o>>1);n+=Math.abs(l)}return n}function ES(r,e,t,i,n,s){for(let a=0;a=s?r[e+a-s]:0,l=e>0?r[e+a-t]:0,c=e>0&&a>=s?r[e+a-(t+s)]:0,u=r[e+a]-Sm(o,l,c);i[n+a]=u}}function kS(r,e,t,i){let n=0;for(let s=0;s=i?r[e+s-i]:0,o=e>0?r[e+s-t]:0,l=e>0&&s>=i?r[e+s-(t+i)]:0,c=r[e+s]-Sm(a,o,l);n+=Math.abs(c)}return n}var OS={0:gS,1:yS,2:bS,3:wS,4:ES},CS={0:vS,1:_S,2:xS,3:SS,4:kS};Em.exports=function(r,e,t,i,n){let s;if(!("filterType"in i)||i.filterType===-1)s=[0,1,2,3,4];else if(typeof i.filterType=="number")s=[i.filterType];else throw new Error("unrecognised filter types");i.bitDepth===16&&(n*=2);let a=e*n,o=0,l=0,c=Buffer.alloc((a+1)*t),u=s[0];for(let f=0;f1){let p=1/0;for(let m=0;m{"use strict";var dt=_n(),TS=yc(),AS=wm(),IS=km(),NS=require("zlib"),Wr=Om.exports=function(r){if(this._options=r,r.deflateChunkSize=r.deflateChunkSize||32*1024,r.deflateLevel=r.deflateLevel!=null?r.deflateLevel:9,r.deflateStrategy=r.deflateStrategy!=null?r.deflateStrategy:3,r.inputHasAlpha=r.inputHasAlpha!=null?r.inputHasAlpha:!0,r.deflateFactory=r.deflateFactory||NS.createDeflate,r.bitDepth=r.bitDepth||8,r.colorType=typeof r.colorType=="number"?r.colorType:dt.COLORTYPE_COLOR_ALPHA,r.inputColorType=typeof r.inputColorType=="number"?r.inputColorType:dt.COLORTYPE_COLOR_ALPHA,[dt.COLORTYPE_GRAYSCALE,dt.COLORTYPE_COLOR,dt.COLORTYPE_COLOR_ALPHA,dt.COLORTYPE_ALPHA].indexOf(r.colorType)===-1)throw new Error("option color type:"+r.colorType+" is not supported at present");if([dt.COLORTYPE_GRAYSCALE,dt.COLORTYPE_COLOR,dt.COLORTYPE_COLOR_ALPHA,dt.COLORTYPE_ALPHA].indexOf(r.inputColorType)===-1)throw new Error("option input color type:"+r.inputColorType+" is not supported at present");if(r.bitDepth!==8&&r.bitDepth!==16)throw new Error("option bit depth:"+r.bitDepth+" is not supported at present")};Wr.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}};Wr.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())};Wr.prototype.filterData=function(r,e,t){let i=AS(r,e,t,this._options),n=dt.COLORTYPE_TO_BPP_MAP[this._options.colorType];return IS(i,e,t,this._options,n)};Wr.prototype._packChunk=function(r,e){let t=e?e.length:0,i=Buffer.alloc(t+12);return i.writeUInt32BE(t,0),i.writeUInt32BE(r,4),e&&e.copy(i,8),i.writeInt32BE(TS.crc32(i.slice(4,i.length-4)),i.length-4),i};Wr.prototype.packGAMA=function(r){let e=Buffer.alloc(4);return e.writeUInt32BE(Math.floor(r*dt.GAMMA_DIVISION),0),this._packChunk(dt.TYPE_gAMA,e)};Wr.prototype.packIHDR=function(r,e){let t=Buffer.alloc(13);return t.writeUInt32BE(r,0),t.writeUInt32BE(e,4),t[8]=this._options.bitDepth,t[9]=this._options.colorType,t[10]=0,t[11]=0,t[12]=0,this._packChunk(dt.TYPE_IHDR,t)};Wr.prototype.packIDAT=function(r){return this._packChunk(dt.TYPE_IDAT,r)};Wr.prototype.packIEND=function(){return this._packChunk(dt.TYPE_IEND,null)}});var Im=w((JL,Am)=>{"use strict";var LS=require("util"),Cm=require("stream"),BS=_n(),RS=Sc(),Tm=Am.exports=function(r){Cm.call(this);let e=r||{};this._packer=new RS(e),this._deflate=this._packer.createDeflate(),this.readable=!0};LS.inherits(Tm,Cm);Tm.prototype.pack=function(r,e,t,i){this.emit("data",Buffer.from(BS.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,t)),i&&this.emit("data",this._packer.packGAMA(i));let n=this._packer.filterData(r,e,t);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(s){this.emit("data",this._packer.packIDAT(s))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(n)}});var Mm=w((os,Pm)=>{"use strict";var Nm=require("assert").ok,bn=require("zlib"),PS=require("util"),Lm=require("buffer").kMaxLength;function Si(r){if(!(this instanceof Si))return new Si(r);r&&r.chunkSize=0,"have should not go down"),_>0){let x=i._buffer.slice(i._offset,i._offset+_);if(i._offset+=_,x.length>a&&(x=x.slice(0,a)),l.push(x),c+=x.length,a-=x.length,a===0)return!1}return(y===0||i._offset>=i._chunkSize)&&(s=i._chunkSize,i._offset=0,i._buffer=Buffer.allocUnsafe(i._chunkSize)),y===0?(o+=n-g,n=g,!0):!1}Nm(this._handle,"zlib binding closed");let p;do p=this._handle.writeSync(e,r,o,n,this._buffer,this._offset,s),p=p||this._writeState;while(!this._hadError&&f(p[0],p[1]));if(this._hadError)throw u;if(c>=Lm)throw Bm(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+Lm.toString(16)+" bytes");let m=Buffer.concat(l,c);return Bm(this),m};PS.inherits(Si,bn.Inflate);function DS(r,e){if(typeof e=="string"&&(e=Buffer.from(e)),!(e instanceof Buffer))throw new TypeError("Not a string or buffer");let t=r._finishFlushFlag;return t==null&&(t=bn.Z_FINISH),r._processChunk(e,t)}function Rm(r,e){return DS(new Si(e),r)}Pm.exports=os=Rm;os.Inflate=Si;os.createInflate=MS;os.inflateSync=Rm});var Ec=w((QL,Fm)=>{"use strict";var Dm=Fm.exports=function(r){this._buffer=r,this._reads=[]};Dm.prototype.read=function(r,e){this._reads.push({length:Math.abs(r),allowLess:r<0,func:e})};Dm.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let r=this._reads[0];if(this._buffer.length&&(this._buffer.length>=r.length||r.allowLess)){this._reads.shift();let e=this._buffer;this._buffer=e.slice(r.length),r.func.call(this,e.slice(0,r.length))}else break}if(this._reads.length>0)throw new Error("There are some read requests waitng on finished stream");if(this._buffer.length>0)throw new Error("unrecognised content at end of stream")}});var jm=w(qm=>{"use strict";var FS=Ec(),qS=mc();qm.process=function(r,e){let t=[],i=new FS(r);return new qS(e,{read:i.read.bind(i),write:function(s){t.push(s)},complete:function(){}}).start(),i.process(),Buffer.concat(t)}});var Hm=w((eB,Vm)=>{"use strict";var Um=!0,$m=require("zlib"),jS=Mm();$m.deflateSync||(Um=!1);var US=Ec(),$S=jm(),VS=_c(),HS=bc(),GS=xc();Vm.exports=function(r,e){if(!Um)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let t;function i(k){t=k}let n;function s(k){n=k}function a(k){n.transColor=k}function o(k){n.palette=k}function l(){n.alpha=!0}let c;function u(k){c=k}let f=[];function p(k){f.push(k)}let m=new US(r);if(new VS(e,{read:m.read.bind(m),error:i,metadata:s,gamma:u,palette:o,transColor:a,inflateData:p,simpleTransparency:l}).start(),m.process(),t)throw t;let y=Buffer.concat(f);f.length=0;let _;if(n.interlace)_=$m.inflateSync(y);else{let E=((n.width*n.bpp*n.depth+7>>3)+1)*n.height;_=jS(y,{chunkSize:E,maxLength:E})}if(y=null,!_||!_.length)throw new Error("bad png - invalid inflate data response");let x=$S.process(_,n);y=null;let S=HS.dataToBitMap(x,n);x=null;let O=GS(S,n,e.skipRescale);return n.data=O,n.gamma=c||0,n}});var Ym=w((tB,zm)=>{"use strict";var Gm=!0,Wm=require("zlib");Wm.deflateSync||(Gm=!1);var WS=_n(),zS=Sc();zm.exports=function(r,e){if(!Gm)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let t=e||{},i=new zS(t),n=[];n.push(Buffer.from(WS.PNG_SIGNATURE)),n.push(i.packIHDR(r.width,r.height)),r.gamma&&n.push(i.packGAMA(r.gamma));let s=i.filterData(r.data,r.width,r.height),a=Wm.deflateSync(s,i.getDeflateOptions());if(s=null,!a||!a.length)throw new Error("bad png - invalid compressed data response");return n.push(i.packIDAT(a)),n.push(i.packIEND()),Buffer.concat(n)}});var Km=w(kc=>{"use strict";var YS=Hm(),KS=Ym();kc.read=function(r,e){return YS(r,e||{})};kc.write=function(r,e){return KS(r,e)}});var Qm=w(Jm=>{"use strict";var ZS=require("util"),Zm=require("stream"),JS=bm(),QS=Im(),XS=Km(),_t=Jm.PNG=function(r){Zm.call(this),r=r||{},this.width=r.width|0,this.height=r.height|0,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,r.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new JS(r),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(e){this.data=e,this.emit("parsed",e)}.bind(this)),this._packer=new QS(r),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};ZS.inherits(_t,Zm);_t.sync=XS;_t.prototype.pack=function(){return!this.data||!this.data.length?(this.emit("error","No data provided"),this):(process.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this)};_t.prototype.parse=function(r,e){if(e){let t,i;t=function(n){this.removeListener("error",i),this.data=n,e(null,this)}.bind(this),i=function(n){this.removeListener("parsed",t),e(n,null)}.bind(this),this.once("parsed",t),this.once("error",i)}return this.end(r),this};_t.prototype.write=function(r){return this._parser.write(r),!0};_t.prototype.end=function(r){this._parser.end(r)};_t.prototype._metadata=function(r){this.width=r.width,this.height=r.height,this.emit("metadata",r)};_t.prototype._gamma=function(r){this.gamma=r};_t.prototype._handleClose=function(){!this._parser.writable&&!this._packer.readable&&this.emit("close")};_t.bitblt=function(r,e,t,i,n,s,a,o){if(t|=0,i|=0,n|=0,s|=0,a|=0,o|=0,t>r.width||i>r.height||t+n>r.width||i+s>r.height)throw new Error("bitblt reading outside image");if(a>e.width||o>e.height||a+n>e.width||o+s>e.height)throw new Error("bitblt writing outside image");for(let l=0;l{var Ua=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Oc=class extends Ua{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Cc.CommanderError=Ua;Cc.InvalidArgumentError=Oc});var $a=w(Ac=>{var{InvalidArgumentError:eE}=ls(),Tc=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new eE(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function tE(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}Ac.Argument=Tc;Ac.humanReadableArgName=tE});var Lc=w(Nc=>{var{humanReadableArgName:rE}=$a(),Ic=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){var t,i;this.helpWidth=(i=(t=this.helpWidth)!=null?t:e.helpWidth)!=null?i:80}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((n,s)=>n.name().localeCompare(s.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),i=e._getHelpOption();if(i&&!i.hidden){let n=i.short&&e._findOption(i.short),s=i.long&&e._findOption(i.long);!n&&!s?t.push(i):i.long&&!s?t.push(e.createOption(i.long,i.description)):i.short&&!n&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>rE(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){var f;let i=t.padWidth(e,t),n=(f=t.helpWidth)!=null?f:80;function s(p,m){return t.formatItem(p,i,m,t)}let a=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),n),""]));let l=t.visibleArguments(e).map(p=>s(t.styleArgumentTerm(t.argumentTerm(p)),t.styleArgumentDescription(t.argumentDescription(p))));l.length>0&&(a=a.concat([t.styleTitle("Arguments:"),...l,""]));let c=t.visibleOptions(e).map(p=>s(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));if(c.length>0&&(a=a.concat([t.styleTitle("Options:"),...c,""])),t.showGlobalOptions){let p=t.visibleGlobalOptions(e).map(m=>s(t.styleOptionTerm(t.optionTerm(m)),t.styleOptionDescription(t.optionDescription(m))));p.length>0&&(a=a.concat([t.styleTitle("Global Options:"),...p,""]))}let u=t.visibleCommands(e).map(p=>s(t.styleSubcommandTerm(t.subcommandTerm(p)),t.styleSubcommandDescription(t.subcommandDescription(p))));return u.length>0&&(a=a.concat([t.styleTitle("Commands:"),...u,""])),a.join(`
-`)}displayWidth(e){return Xm(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,i,n){var p;let a=" ".repeat(2);if(!i)return a+e;let o=e.padEnd(t+e.length-n.displayWidth(e)),l=2,u=((p=this.helpWidth)!=null?p:80)-t-l-2,f;return u{let o=a.match(n);if(o===null){s.push("");return}let l=[o.shift()],c=this.displayWidth(l[0]);o.forEach(u=>{let f=this.displayWidth(u);if(c+f<=t){l.push(u),c+=f;return}s.push(l.join(""));let p=u.trimStart();l=[p],c=this.displayWidth(p)}),s.push(l.join(""))}),s.join(`
-`)}};function Xm(r){let e=/\x1b\[\d*(;\d*)*m/g;return r.replace(e,"")}Nc.Help=Ic;Nc.stripColor=Xm});var Mc=w(Pc=>{var{InvalidArgumentError:iE}=ls(),Bc=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=nE(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new iE(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?eg(this.name().replace(/^no-/,"")):eg(this.name())}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Rc=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,s=n!==void 0?n:!1;return t.negate===(s===e)}};function eg(r){return r.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function nE(r){let e,t,i=/^-[^-]$/,n=/^--[^-]/,s=r.split(/[ |,]+/).concat("guard");if(i.test(s[0])&&(e=s.shift()),n.test(s[0])&&(t=s.shift()),!e&&i.test(s[0])&&(e=s.shift()),!e&&n.test(s[0])&&(e=t,t=s.shift()),s[0].startsWith("-")){let a=s[0],o=`option creation failed due to '${a}' in option flags '${r}'`;throw/^-[^-][^-]/.test(a)?new Error(`${o}
-- a short flag is a single dash and a single character
- - either use a single dash and a single character (for a short flag)
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):i.test(a)?new Error(`${o}
-- too many short flags`):n.test(a)?new Error(`${o}
-- too many long flags`):new Error(`${o}
-- unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${r}'.`);return{shortFlag:e,longFlag:t}}Pc.Option=Bc;Pc.DualOptions=Rc});var rg=w(tg=>{function sE(r,e){if(Math.abs(r.length-e.length)>3)return Math.max(r.length,e.length);let t=[];for(let i=0;i<=r.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let n=1;n<=r.length;n++){let s=1;r[n-1]===e[i-1]?s=0:s=1,t[n][i]=Math.min(t[n-1][i]+1,t[n][i-1]+1,t[n-1][i-1]+s),n>1&&i>1&&r[n-1]===e[i-2]&&r[n-2]===e[i-1]&&(t[n][i]=Math.min(t[n][i],t[n-2][i-2]+1))}return t[r.length][e.length]}function aE(r,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=r.startsWith("--");t&&(r=r.slice(2),e=e.map(a=>a.slice(2)));let i=[],n=3,s=.4;return e.forEach(a=>{if(a.length<=1)return;let o=sE(r,a),l=Math.max(r.length,a.length);(l-o)/l>s&&(oa.localeCompare(o)),t&&(i=i.map(a=>`--${a}`)),i.length>1?`
-(Did you mean one of ${i.join(", ")}?)`:i.length===1?`
-(Did you mean ${i[0]}?)`:""}tg.suggestSimilar=aE});var ag=w(Uc=>{var oE=require("node:events").EventEmitter,Dc=require("node:child_process"),Ar=require("node:path"),Va=require("node:fs"),Re=require("node:process"),{Argument:lE,humanReadableArgName:cE}=$a(),{CommanderError:Fc}=ls(),{Help:uE,stripColor:fE}=Lc(),{Option:ig,DualOptions:hE}=Mc(),{suggestSimilar:ng}=rg(),qc=class r extends oE{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:t=>Re.stdout.write(t),writeErr:t=>Re.stderr.write(t),outputError:(t,i)=>i(t),getOutHelpWidth:()=>Re.stdout.isTTY?Re.stdout.columns:void 0,getErrHelpWidth:()=>Re.stderr.isTTY?Re.stderr.columns:void 0,getOutHasColors:()=>{var t,i,n;return(n=jc())!=null?n:Re.stdout.isTTY&&((i=(t=Re.stdout).hasColors)==null?void 0:i.call(t))},getErrHasColors:()=>{var t,i,n;return(n=jc())!=null?n:Re.stderr.isTTY&&((i=(t=Re.stderr).hasColors)==null?void 0:i.call(t))},stripColor:t=>fE(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let n=t,s=i;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,a,o]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(a);return n&&(l.description(n),l._executableHandler=!0),s.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(s.noHelp||s.hidden),l._executableFile=s.executableFile||null,o&&l.arguments(o),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),n?this:l}createCommand(e){return new r(e)}createHelp(){return Object.assign(new uE,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
-- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new lE(e,t)}argument(e,t,i,n){let s=this.createArgument(e,t);return typeof i=="function"?s.default(n).argParser(i):s.default(i),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e!=null?e:"help [command]";let[,i,n]=e.match(/([^ ]+) *(.*)/),s=t!=null?t:"display help for command",a=this.createCommand(i);return a.helpOption(!1),n&&a.arguments(n),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){var t;return((t=this._addImplicitHelpCommand)!=null?t:this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
-Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new Fc(e,t,i)),Re.exit(e)}action(e){let t=i=>{let n=this.registeredArguments.length,s=i.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new ig(e,t)}_callParseArg(e,t,i,n){try{return e.parseArg(t,i)}catch(s){if(s.code==="commander.invalidArgument"){let a=`${n} ${s.message}`;this.error(a,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
-- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=n=>[n.name()].concat(n.aliases()),i=t(e).find(n=>this._findCommand(n));if(i){let n=t(this._findCommand(i)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let n=(s,a,o)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let l=this.getOptionValue(i);s!==null&&e.parseArg?s=this._callParseArg(e,s,l,a):s!==null&&e.variadic&&(s=e._concatValue(s,l)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,o)};return this.on("option:"+t,s=>{let a=`error: option '${e.flags}' argument '${s}' is invalid.`;n(s,a,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let a=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;n(s,a,"env")}),this}_optionEx(e,t,i,n,s){if(typeof t=="object"&&t instanceof ig)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(t,i);if(a.makeOptionMandatory(!!e.mandatory),typeof n=="function")a.default(s).argParser(n);else if(n instanceof RegExp){let o=n;n=(l,c)=>{let u=o.exec(l);return u?u[0]:c},a.default(s).argParser(n)}else a.default(n);return this.addOption(a)}option(e,t,i,n){return this._optionEx({},e,t,i,n)}requiredOption(e,t,i,n){return this._optionEx({mandatory:!0},e,t,i,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),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(e=!0){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");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){var n,s;if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){(n=Re.versions)!=null&&n.electron&&(t.from="electron");let a=(s=Re.execArgv)!=null?s:[];(a.includes("-e")||a.includes("--eval")||a.includes("-p")||a.includes("--print"))&&(t.from="eval")}e===void 0&&(e=Re.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":Re.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(e,t){this._prepareForParse();let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){this._prepareForParse();let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
-- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,i){if(Va.existsSync(e))return;let n=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",s=`'${e}' does not exist
- - if '${i}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
- - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
- - ${n}`;throw new Error(s)}_executeSubCommand(e,t){t=t.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(u,f){let p=Ar.resolve(u,f);if(Va.existsSync(p))return p;if(n.includes(Ar.extname(f)))return;let m=n.find(g=>Va.existsSync(`${p}${g}`));if(m)return`${p}${m}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,o=this._executableDir||"";if(this._scriptPath){let u;try{u=Va.realpathSync(this._scriptPath)}catch{u=this._scriptPath}o=Ar.resolve(Ar.dirname(u),o)}if(o){let u=s(o,a);if(!u&&!e._executableFile&&this._scriptPath){let f=Ar.basename(this._scriptPath,Ar.extname(this._scriptPath));f!==this._name&&(u=s(o,`${f}-${e._name}`))}a=u||a}i=n.includes(Ar.extname(a));let l;Re.platform!=="win32"?i?(t.unshift(a),t=sg(Re.execArgv).concat(t),l=Dc.spawn(Re.argv[0],t,{stdio:"inherit"})):l=Dc.spawn(a,t,{stdio:"inherit"}):(this._checkForMissingExecutable(a,o,e._name),t.unshift(a),t=sg(Re.execArgv).concat(t),l=Dc.spawn(Re.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{Re.on(f,()=>{l.killed===!1&&l.exitCode===null&&l.kill(f)})});let c=this._exitCallback;l.on("close",u=>{u=u!=null?u:1,c?c(new Fc(u,"commander.executeSubCommandAsync","(close)")):Re.exit(u)}),l.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(a,o,e._name);else if(u.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)Re.exit(1);else{let f=new Fc(1,"commander.executeSubCommandAsync","(error)");f.nestedError=u,c(f)}}),this.runningCommand=l}_dispatchSubcommand(e,t,i){let n=this._findCommand(e);n||this.help({error:!0}),n._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(i));else return n._parseCommand(t,i)}),s}_dispatchHelpCommand(e){var i,n,s,a;e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[(a=(s=(i=this._getHelpOption())==null?void 0:i.long)!=null?s:(n=this._getHelpOption())==null?void 0:n.short)!=null?a:"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(i,n,s)=>{let a=n;if(n!==null&&i.parseArg){let o=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;a=this._callParseArg(i,n,s,o)}return a};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,n)=>{let s=i.defaultValue;i.variadic?ne(i,o,a),i.defaultValue))):s===void 0&&(s=[]):nt()):t()}_chainOrCallHooks(e,t){let i=e,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(a=>{n.push({hookedCommand:s,callback:a})})}),t==="postAction"&&n.reverse(),n.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let n=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{n=this._chainOrCall(n,()=>s(this,t))}),n}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(s,e,t)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent&&this.parent.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=e.find(s=>i.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],n=t,s=e.slice();function a(l){return l.length>1&&l[0]==="-"}let o=null;for(;s.length;){let l=s.shift();if(l==="--"){n===i&&n.push(l),n.push(...s);break}if(o&&!a(l)){this.emit(`option:${o.name()}`,l);continue}if(o=null,a(l)){let c=this._findOption(l);if(c){if(c.required){let u=s.shift();u===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,u)}else if(c.optional){let u=null;s.length>0&&!a(s[0])&&(u=s.shift()),this.emit(`option:${c.name()}`,u)}else this.emit(`option:${c.name()}`);o=c.variadic?c:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let c=this._findOption(`-${l[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,l.slice(2)):(this.emit(`option:${c.name()}`),s.unshift(`-${l.slice(2)}`));continue}}if(/^--[^=]+=/.test(l)){let c=l.indexOf("="),u=this._findOption(l.slice(0,c));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,l.slice(c+1));continue}}if(a(l)&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(l)){t.push(l),s.length>0&&i.push(...s);break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l),s.length>0&&t.push(...s);break}else if(this._defaultCommandName){i.push(l),s.length>0&&i.push(...s);break}}if(this._passThroughOptions){n.push(l),s.length>0&&n.push(...s);break}n.push(l)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;iObject.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
-`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
-`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
-`),this.outputHelp({error:!0}));let i=t||{},n=i.exitCode||1,s=i.code||"commander.error";this._exit(n,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Re.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Re.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new hE(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!t(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let i=a=>{let o=a.attributeName(),l=this.getOptionValue(o),c=this.options.find(f=>f.negate&&o===f.attributeName()),u=this.options.find(f=>!f.negate&&o===f.attributeName());return c&&(c.presetArg===void 0&&l===!1||c.presetArg!==void 0&&l===c.presetArg)?c:u||a},n=a=>{let o=i(a),l=o.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${o.envVar}'`:`option '${o.flags}'`},s=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let a=s.createHelp().visibleOptions(s).filter(o=>o.long).map(o=>o.long);n=n.concat(a),s=s.parent}while(s&&!s._enablePositionalOptions);t=ng(e,n)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),t=ng(e,n)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let n=this.createOption(t,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
-`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){var n;if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let i=(n=this.parent)==null?void 0:n._findCommand(e);if(i){let s=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${s}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(i=>cE(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=Ar.basename(e,Ar.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),i=this._getOutputContext(e);t.prepareContext({error:i.error,helpWidth:i.helpWidth,outputHasColors:i.hasColors});let n=t.formatHelp(this,t);return i.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(e){e=e||{};let t=!!e.error,i,n,s;return t?(i=o=>this._outputConfiguration.writeErr(o),n=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(i=o=>this._outputConfiguration.writeOut(o),n=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:t,write:o=>(n||(o=this._outputConfiguration.stripColor(o)),i(o)),hasColors:n,helpWidth:s}}outputHelp(e){var a;let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getOutputContext(e),n={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let s=this.helpInformation({error:i.error});if(t&&(s=t(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(s),(a=this._getHelpOption())!=null&&a.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(o=>o.emit("afterAllHelp",n))}helpOption(e,t){var i;return typeof e=="boolean"?(e?this._helpOption=(i=this._helpOption)!=null?i:void 0:this._helpOption=null,this):(e=e!=null?e:"-h, --help",t=t!=null?t:"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){var i;this.outputHelp(e);let t=Number((i=Re.exitCode)!=null?i:0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
-Expecting one of '${i.join("', '")}'`);let n=`${e}Help`;return this.on(n,s=>{let a;typeof t=="function"?a=t({error:s.error,command:s.command}):a=t,a&&s.write(`${a}
-`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function sg(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",n="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],i=s[3],n=s[4]),t&&n!=="0"?`${t}=${i}:${parseInt(n)+1}`:e})}function jc(){if(Re.env.NO_COLOR||Re.env.FORCE_COLOR==="0"||Re.env.FORCE_COLOR==="false")return!1;if(Re.env.FORCE_COLOR||Re.env.CLICOLOR_FORCE!==void 0)return!0}Uc.Command=qc;Uc.useColor=jc});var ug=w(Wt=>{var{Argument:og}=$a(),{Command:$c}=ag(),{CommanderError:dE,InvalidArgumentError:lg}=ls(),{Help:pE}=Lc(),{Option:cg}=Mc();Wt.program=new $c;Wt.createCommand=r=>new $c(r);Wt.createOption=(r,e)=>new cg(r,e);Wt.createArgument=(r,e)=>new og(r,e);Wt.Command=$c;Wt.Option=cg;Wt.Argument=og;Wt.Help=pE;Wt.CommanderError=dE;Wt.InvalidArgumentError=lg;Wt.InvalidOptionArgumentError=lg});var gg=w((pg,mg)=>{pg=mg.exports=xn;function xn(r,e){if(this.stream=e.stream||process.stderr,typeof e=="number"){var t=e;e={},e.total=t}else{if(e=e||{},typeof r!="string")throw new Error("format required");if(typeof e.total!="number")throw new Error("total required")}this.fmt=r,this.curr=e.curr||0,this.total=e.total,this.width=e.width||this.total,this.clear=e.clear,this.chars={complete:e.complete||"=",incomplete:e.incomplete||"-",head:e.head||e.complete||"="},this.renderThrottle=e.renderThrottle!==0?e.renderThrottle||16:0,this.lastRender=-1/0,this.callback=e.callback||function(){},this.tokens={},this.lastDraw=""}xn.prototype.tick=function(r,e){if(r!==0&&(r=r||1),typeof r=="object"&&(e=r,r=1),e&&(this.tokens=e),this.curr==0&&(this.start=new Date),this.curr+=r,this.render(),this.curr>=this.total){this.render(void 0,!0),this.complete=!0,this.terminate(),this.callback(this);return}};xn.prototype.render=function(r,e){if(e=e!==void 0?e:!1,r&&(this.tokens=r),!!this.stream.isTTY){var t=Date.now(),i=t-this.lastRender;if(!(!e&&i0&&(o=o.slice(0,-1)+this.chars.head),p=p.replace(":bar",o+a),this.tokens)for(var y in this.tokens)p=p.replace(":"+y,this.tokens[y]);this.lastDraw!==p&&(this.stream.cursorTo(0),this.stream.write(p),this.stream.clearLine(1),this.lastDraw=p)}}};xn.prototype.update=function(r,e){var t=Math.floor(r*this.total),i=t-this.curr;this.tick(i,e)};xn.prototype.interrupt=function(r){this.stream.clearLine(),this.stream.cursorTo(0),this.stream.write(r),this.stream.write(`
-`),this.stream.write(this.lastDraw)};xn.prototype.terminate=function(){this.clear?this.stream.clearLine&&(this.stream.clearLine(),this.stream.cursorTo(0)):this.stream.write(`
-`)}});var yg=w((xB,vg)=>{vg.exports=gg()});var wg=w(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});var _g=require("buffer"),Ei={INVALID_ENCODING:"Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.",INVALID_SMARTBUFFER_SIZE:"Invalid size provided. Size must be a valid integer greater than zero.",INVALID_SMARTBUFFER_BUFFER:"Invalid Buffer provided in SmartBufferOptions.",INVALID_SMARTBUFFER_OBJECT:"Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.",INVALID_OFFSET:"An invalid offset value was provided.",INVALID_OFFSET_NON_NUMBER:"An invalid offset value was provided. A numeric value is required.",INVALID_LENGTH:"An invalid length value was provided.",INVALID_LENGTH_NON_NUMBER:"An invalid length value was provived. A numeric value is required.",INVALID_TARGET_OFFSET:"Target offset is beyond the bounds of the internal SmartBuffer data.",INVALID_TARGET_LENGTH:"Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.",INVALID_READ_BEYOND_BOUNDS:"Attempted to read beyond the bounds of the managed data.",INVALID_WRITE_BEYOND_BOUNDS:"Attempted to write beyond the bounds of the managed data."};Ir.ERRORS=Ei;function mE(r){if(!_g.Buffer.isEncoding(r))throw new Error(Ei.INVALID_ENCODING)}Ir.checkEncoding=mE;function bg(r){return typeof r=="number"&&isFinite(r)&&_E(r)}Ir.isFiniteInteger=bg;function xg(r,e){if(typeof r=="number"){if(!bg(r)||r<0)throw new Error(e?Ei.INVALID_OFFSET:Ei.INVALID_LENGTH)}else throw new Error(e?Ei.INVALID_OFFSET_NON_NUMBER:Ei.INVALID_LENGTH_NON_NUMBER)}function gE(r){xg(r,!1)}Ir.checkLengthValue=gE;function vE(r){xg(r,!0)}Ir.checkOffsetValue=vE;function yE(r,e){if(r<0||r>e.length)throw new Error(Ei.INVALID_TARGET_OFFSET)}Ir.checkTargetOffset=yE;function _E(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r}function bE(r){if(typeof BigInt=="undefined")throw new Error("Platform does not support JS BigInt type.");if(typeof _g.Buffer.prototype[r]=="undefined")throw new Error(`Platform does not support Buffer.prototype.${r}.`)}Ir.bigIntAndBufferInt64Check=bE});var Eg=w(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});var be=wg(),Sg=4096,xE="utf8",Vc=class r{constructor(e){if(this.length=0,this._encoding=xE,this._writeOffset=0,this._readOffset=0,r.isSmartBufferOptions(e))if(e.encoding&&(be.checkEncoding(e.encoding),this._encoding=e.encoding),e.size)if(be.isFiniteInteger(e.size)&&e.size>0)this._buff=Buffer.allocUnsafe(e.size);else throw new Error(be.ERRORS.INVALID_SMARTBUFFER_SIZE);else if(e.buff)if(Buffer.isBuffer(e.buff))this._buff=e.buff,this.length=e.buff.length;else throw new Error(be.ERRORS.INVALID_SMARTBUFFER_BUFFER);else this._buff=Buffer.allocUnsafe(Sg);else{if(typeof e!="undefined")throw new Error(be.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=Buffer.allocUnsafe(Sg)}}static fromSize(e,t){return new this({size:e,encoding:t})}static fromBuffer(e,t){return new this({buff:e,encoding:t})}static fromOptions(e){return new this(e)}static isSmartBufferOptions(e){let t=e;return t&&(t.encoding!==void 0||t.size!==void 0||t.buff!==void 0)}readInt8(e){return this._readNumberValue(Buffer.prototype.readInt8,1,e)}readInt16BE(e){return this._readNumberValue(Buffer.prototype.readInt16BE,2,e)}readInt16LE(e){return this._readNumberValue(Buffer.prototype.readInt16LE,2,e)}readInt32BE(e){return this._readNumberValue(Buffer.prototype.readInt32BE,4,e)}readInt32LE(e){return this._readNumberValue(Buffer.prototype.readInt32LE,4,e)}readBigInt64BE(e){return be.bigIntAndBufferInt64Check("readBigInt64BE"),this._readNumberValue(Buffer.prototype.readBigInt64BE,8,e)}readBigInt64LE(e){return be.bigIntAndBufferInt64Check("readBigInt64LE"),this._readNumberValue(Buffer.prototype.readBigInt64LE,8,e)}writeInt8(e,t){return this._writeNumberValue(Buffer.prototype.writeInt8,1,e,t),this}insertInt8(e,t){return this._insertNumberValue(Buffer.prototype.writeInt8,1,e,t)}writeInt16BE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt16BE,2,e,t)}insertInt16BE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt16BE,2,e,t)}writeInt16LE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt16LE,2,e,t)}insertInt16LE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt16LE,2,e,t)}writeInt32BE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt32BE,4,e,t)}insertInt32BE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt32BE,4,e,t)}writeInt32LE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt32LE,4,e,t)}insertInt32LE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt32LE,4,e,t)}writeBigInt64BE(e,t){return be.bigIntAndBufferInt64Check("writeBigInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigInt64BE,8,e,t)}insertBigInt64BE(e,t){return be.bigIntAndBufferInt64Check("writeBigInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigInt64BE,8,e,t)}writeBigInt64LE(e,t){return be.bigIntAndBufferInt64Check("writeBigInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigInt64LE,8,e,t)}insertBigInt64LE(e,t){return be.bigIntAndBufferInt64Check("writeBigInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigInt64LE,8,e,t)}readUInt8(e){return this._readNumberValue(Buffer.prototype.readUInt8,1,e)}readUInt16BE(e){return this._readNumberValue(Buffer.prototype.readUInt16BE,2,e)}readUInt16LE(e){return this._readNumberValue(Buffer.prototype.readUInt16LE,2,e)}readUInt32BE(e){return this._readNumberValue(Buffer.prototype.readUInt32BE,4,e)}readUInt32LE(e){return this._readNumberValue(Buffer.prototype.readUInt32LE,4,e)}readBigUInt64BE(e){return be.bigIntAndBufferInt64Check("readBigUInt64BE"),this._readNumberValue(Buffer.prototype.readBigUInt64BE,8,e)}readBigUInt64LE(e){return be.bigIntAndBufferInt64Check("readBigUInt64LE"),this._readNumberValue(Buffer.prototype.readBigUInt64LE,8,e)}writeUInt8(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt8,1,e,t)}insertUInt8(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt8,1,e,t)}writeUInt16BE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt16BE,2,e,t)}insertUInt16BE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt16BE,2,e,t)}writeUInt16LE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt16LE,2,e,t)}insertUInt16LE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt16LE,2,e,t)}writeUInt32BE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt32BE,4,e,t)}insertUInt32BE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt32BE,4,e,t)}writeUInt32LE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt32LE,4,e,t)}insertUInt32LE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt32LE,4,e,t)}writeBigUInt64BE(e,t){return be.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64BE,8,e,t)}insertBigUInt64BE(e,t){return be.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64BE,8,e,t)}writeBigUInt64LE(e,t){return be.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64LE,8,e,t)}insertBigUInt64LE(e,t){return be.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64LE,8,e,t)}readFloatBE(e){return this._readNumberValue(Buffer.prototype.readFloatBE,4,e)}readFloatLE(e){return this._readNumberValue(Buffer.prototype.readFloatLE,4,e)}writeFloatBE(e,t){return this._writeNumberValue(Buffer.prototype.writeFloatBE,4,e,t)}insertFloatBE(e,t){return this._insertNumberValue(Buffer.prototype.writeFloatBE,4,e,t)}writeFloatLE(e,t){return this._writeNumberValue(Buffer.prototype.writeFloatLE,4,e,t)}insertFloatLE(e,t){return this._insertNumberValue(Buffer.prototype.writeFloatLE,4,e,t)}readDoubleBE(e){return this._readNumberValue(Buffer.prototype.readDoubleBE,8,e)}readDoubleLE(e){return this._readNumberValue(Buffer.prototype.readDoubleLE,8,e)}writeDoubleBE(e,t){return this._writeNumberValue(Buffer.prototype.writeDoubleBE,8,e,t)}insertDoubleBE(e,t){return this._insertNumberValue(Buffer.prototype.writeDoubleBE,8,e,t)}writeDoubleLE(e,t){return this._writeNumberValue(Buffer.prototype.writeDoubleLE,8,e,t)}insertDoubleLE(e,t){return this._insertNumberValue(Buffer.prototype.writeDoubleLE,8,e,t)}readString(e,t){let i;typeof e=="number"?(be.checkLengthValue(e),i=Math.min(e,this.length-this._readOffset)):(t=e,i=this.length-this._readOffset),typeof t!="undefined"&&be.checkEncoding(t);let n=this._buff.slice(this._readOffset,this._readOffset+i).toString(t||this._encoding);return this._readOffset+=i,n}insertString(e,t,i){return be.checkOffsetValue(t),this._handleString(e,!0,t,i)}writeString(e,t,i){return this._handleString(e,!1,t,i)}readStringNT(e){typeof e!="undefined"&&be.checkEncoding(e);let t=this.length;for(let n=this._readOffset;nthis.length)throw new Error(be.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(e,t){be.checkOffsetValue(t),this._ensureCapacity(this.length+e),tthis.length?this.length=t+e:this.length+=e}_ensureWriteable(e,t){let i=typeof t=="number"?t:this._writeOffset;this._ensureCapacity(i+e),i+e>this.length&&(this.length=i+e)}_ensureCapacity(e){let t=this._buff.length;if(e>t){let i=this._buff,n=t*3/2+1;n{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.SOCKS5_NO_ACCEPTABLE_AUTH=Ue.SOCKS5_CUSTOM_AUTH_END=Ue.SOCKS5_CUSTOM_AUTH_START=Ue.SOCKS_INCOMING_PACKET_SIZES=Ue.SocksClientState=Ue.Socks5Response=Ue.Socks5HostType=Ue.Socks5Auth=Ue.Socks4Response=Ue.SocksCommand=Ue.ERRORS=Ue.DEFAULT_TIMEOUT=void 0;var wE=3e4;Ue.DEFAULT_TIMEOUT=wE;var SE={InvalidSocksCommand:"An invalid SOCKS command was provided. Valid options are connect, bind, and associate.",InvalidSocksCommandForOperation:"An invalid SOCKS command was provided. Only a subset of commands are supported for this operation.",InvalidSocksCommandChain:"An invalid SOCKS command was provided. Chaining currently only supports the connect command.",InvalidSocksClientOptionsDestination:"An invalid destination host was provided.",InvalidSocksClientOptionsExistingSocket:"An invalid existing socket was provided. This should be an instance of stream.Duplex.",InvalidSocksClientOptionsProxy:"Invalid SOCKS proxy details were provided.",InvalidSocksClientOptionsTimeout:"An invalid timeout value was provided. Please enter a value above 0 (in ms).",InvalidSocksClientOptionsProxiesLength:"At least two socks proxies must be provided for chaining.",InvalidSocksClientOptionsCustomAuthRange:"Custom auth must be a value between 0x80 and 0xFE.",InvalidSocksClientOptionsCustomAuthOptions:"When a custom_auth_method is provided, custom_auth_request_handler, custom_auth_response_size, and custom_auth_response_handler must also be provided and valid.",NegotiationError:"Negotiation error",SocketClosed:"Socket closed",ProxyConnectionTimedOut:"Proxy connection timed out",InternalError:"SocksClient internal error (this should not happen)",InvalidSocks4HandshakeResponse:"Received invalid Socks4 handshake response",Socks4ProxyRejectedConnection:"Socks4 Proxy rejected connection",InvalidSocks4IncomingConnectionResponse:"Socks4 invalid incoming connection response",Socks4ProxyRejectedIncomingBoundConnection:"Socks4 Proxy rejected incoming bound connection",InvalidSocks5InitialHandshakeResponse:"Received invalid Socks5 initial handshake response",InvalidSocks5IntiailHandshakeSocksVersion:"Received invalid Socks5 initial handshake (invalid socks version)",InvalidSocks5InitialHandshakeNoAcceptedAuthType:"Received invalid Socks5 initial handshake (no accepted authentication type)",InvalidSocks5InitialHandshakeUnknownAuthType:"Received invalid Socks5 initial handshake (unknown authentication type)",Socks5AuthenticationFailed:"Socks5 Authentication failed",InvalidSocks5FinalHandshake:"Received invalid Socks5 final handshake response",InvalidSocks5FinalHandshakeRejected:"Socks5 proxy rejected connection",InvalidSocks5IncomingConnectionResponse:"Received invalid Socks5 incoming connection response",Socks5ProxyRejectedIncomingBoundConnection:"Socks5 Proxy rejected incoming bound connection"};Ue.ERRORS=SE;var EE={Socks5InitialHandshakeResponse:2,Socks5UserPassAuthenticationResponse:2,Socks5ResponseHeader:5,Socks5ResponseIPv4:10,Socks5ResponseIPv6:22,Socks5ResponseHostname:r=>r+7,Socks4Response:8};Ue.SOCKS_INCOMING_PACKET_SIZES=EE;var kg;(function(r){r[r.connect=1]="connect",r[r.bind=2]="bind",r[r.associate=3]="associate"})(kg||(Ue.SocksCommand=kg={}));var Og;(function(r){r[r.Granted=90]="Granted",r[r.Failed=91]="Failed",r[r.Rejected=92]="Rejected",r[r.RejectedIdent=93]="RejectedIdent"})(Og||(Ue.Socks4Response=Og={}));var Cg;(function(r){r[r.NoAuth=0]="NoAuth",r[r.GSSApi=1]="GSSApi",r[r.UserPass=2]="UserPass"})(Cg||(Ue.Socks5Auth=Cg={}));var kE=128;Ue.SOCKS5_CUSTOM_AUTH_START=kE;var OE=254;Ue.SOCKS5_CUSTOM_AUTH_END=OE;var CE=255;Ue.SOCKS5_NO_ACCEPTABLE_AUTH=CE;var Tg;(function(r){r[r.Granted=0]="Granted",r[r.Failure=1]="Failure",r[r.NotAllowed=2]="NotAllowed",r[r.NetworkUnreachable=3]="NetworkUnreachable",r[r.HostUnreachable=4]="HostUnreachable",r[r.ConnectionRefused=5]="ConnectionRefused",r[r.TTLExpired=6]="TTLExpired",r[r.CommandNotSupported=7]="CommandNotSupported",r[r.AddressNotSupported=8]="AddressNotSupported"})(Tg||(Ue.Socks5Response=Tg={}));var Ag;(function(r){r[r.IPv4=1]="IPv4",r[r.Hostname=3]="Hostname",r[r.IPv6=4]="IPv6"})(Ag||(Ue.Socks5HostType=Ag={}));var Ig;(function(r){r[r.Created=0]="Created",r[r.Connecting=1]="Connecting",r[r.Connected=2]="Connected",r[r.SentInitialHandshake=3]="SentInitialHandshake",r[r.ReceivedInitialHandshakeResponse=4]="ReceivedInitialHandshakeResponse",r[r.SentAuthentication=5]="SentAuthentication",r[r.ReceivedAuthenticationResponse=6]="ReceivedAuthenticationResponse",r[r.SentFinalHandshake=7]="SentFinalHandshake",r[r.ReceivedFinalResponse=8]="ReceivedFinalResponse",r[r.BoundWaitingForConnection=9]="BoundWaitingForConnection",r[r.Established=10]="Established",r[r.Disconnected=11]="Disconnected",r[r.Error=99]="Error"})(Ig||(Ue.SocksClientState=Ig={}))});var zc=w(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.shuffleArray=wn.SocksClientError=void 0;var Wc=class extends Error{constructor(e,t){super(e),this.options=t}};wn.SocksClientError=Wc;function TE(r){for(let e=r.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[r[e],r[t]]=[r[t],r[e]]}}wn.shuffleArray=TE});var Yc=w(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.isCorrect=Sn.isInSubnet=void 0;function AE(r){return this.subnetMask{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.RE_SUBNET_STRING=dr.RE_ADDRESS=dr.GROUPS=dr.BITS=void 0;dr.BITS=32;dr.GROUPS=4;dr.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g;dr.RE_SUBNET_STRING=/\/\d{1,2}$/});var Ga=w(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.AddressError=void 0;var Zc=class extends Error{constructor(e,t){super(e),this.name="AddressError",t!==null&&(this.parseMessage=t)}};Ha.AddressError=Zc});var Jc=w((Wa,Ng)=>{(function(){var r,e=0xdeadbeefcafe,t=(e&16777215)==15715070;function i(h,d,v){h!=null&&(typeof h=="number"?this.fromNumber(h,d,v):d==null&&typeof h!="string"?this.fromString(h,256):this.fromString(h,d))}function n(){return new i(null)}function s(h,d,v,b,B,M){for(;--M>=0;){var z=d*this[h++]+v[b]+B;B=Math.floor(z/67108864),v[b++]=z&67108863}return B}function a(h,d,v,b,B,M){for(var z=d&32767,J=d>>15;--M>=0;){var He=this[h]&32767,rt=this[h++]>>15,Ut=J*He+rt*z;He=z*He+((Ut&32767)<<15)+v[b]+(B&1073741823),B=(He>>>30)+(Ut>>>15)+J*rt+(B>>>30),v[b++]=He&1073741823}return B}function o(h,d,v,b,B,M){for(var z=d&16383,J=d>>14;--M>=0;){var He=this[h]&16383,rt=this[h++]>>14,Ut=J*He+rt*z;He=z*He+((Ut&16383)<<14)+v[b]+B,B=(He>>28)+(Ut>>14)+J*rt,v[b++]=He&268435455}return B}var l=typeof navigator!="undefined";l&&t&&navigator.appName=="Microsoft Internet Explorer"?(i.prototype.am=a,r=30):l&&t&&navigator.appName!="Netscape"?(i.prototype.am=s,r=26):(i.prototype.am=o,r=28),i.prototype.DB=r,i.prototype.DM=(1<=0;--d)h[d]=this[d];h.t=this.t,h.s=this.s}function x(h){this.t=1,this.s=h<0?-1:0,h>0?this[0]=h:h<-1?this[0]=h+this.DV:this.t=0}function S(h){var d=n();return d.fromInt(h),d}function O(h,d){var v;if(d==16)v=4;else if(d==8)v=3;else if(d==256)v=8;else if(d==2)v=1;else if(d==32)v=5;else if(d==4)v=2;else{this.fromRadix(h,d);return}this.t=0,this.s=0;for(var b=h.length,B=!1,M=0;--b>=0;){var z=v==8?h[b]&255:y(h,b);if(z<0){h.charAt(b)=="-"&&(B=!0);continue}B=!1,M==0?this[this.t++]=z:M+v>this.DB?(this[this.t-1]|=(z&(1<>this.DB-M):this[this.t-1]|=z<=this.DB&&(M-=this.DB)}v==8&&(h[0]&128)!=0&&(this.s=-1,M>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==h;)--this.t}function E(h){if(this.s<0)return"-"+this.negate().toString(h);var d;if(h==16)d=4;else if(h==8)d=3;else if(h==2)d=1;else if(h==32)d=5;else if(h==4)d=2;else return this.toRadix(h);var v=(1<0)for(J>J)>0&&(B=!0,M=g(b));z>=0;)J>(J+=this.DB-d)):(b=this[z]>>(J-=d)&v,J<=0&&(J+=this.DB,--z)),b>0&&(B=!0),B&&(M+=g(b));return B?M:"0"}function R(){var h=n();return i.ZERO.subTo(this,h),h}function T(){return this.s<0?this.negate():this}function A(h){var d=this.s-h.s;if(d!=0)return d;var v=this.t;if(d=v-h.t,d!=0)return this.s<0?-d:d;for(;--v>=0;)if((d=this[v]-h[v])!=0)return d;return 0}function C(h){var d=1,v;return(v=h>>>16)!=0&&(h=v,d+=16),(v=h>>8)!=0&&(h=v,d+=8),(v=h>>4)!=0&&(h=v,d+=4),(v=h>>2)!=0&&(h=v,d+=2),(v=h>>1)!=0&&(h=v,d+=1),d}function L(){return this.t<=0?0:this.DB*(this.t-1)+C(this[this.t-1]^this.s&this.DM)}function P(h,d){var v;for(v=this.t-1;v>=0;--v)d[v+h]=this[v];for(v=h-1;v>=0;--v)d[v]=0;d.t=this.t+h,d.s=this.s}function $(h,d){for(var v=h;v=0;--J)d[J+M+1]=this[J]>>b|z,z=(this[J]&B)<=0;--J)d[J]=0;d[M]=z,d.t=this.t+M+1,d.s=this.s,d.clamp()}function G(h,d){d.s=this.s;var v=Math.floor(h/this.DB);if(v>=this.t){d.t=0;return}var b=h%this.DB,B=this.DB-b,M=(1<>b;for(var z=v+1;z>b;b>0&&(d[this.t-v-1]|=(this.s&M)<>=this.DB;if(h.t>=this.DB;b+=this.s}else{for(b+=this.s;v>=this.DB;b-=h.s}d.s=b<0?-1:0,b<-1?d[v++]=this.DV+b:b>0&&(d[v++]=b),d.t=v,d.clamp()}function H(h,d){var v=this.abs(),b=h.abs(),B=v.t;for(d.t=B+b.t;--B>=0;)d[B]=0;for(B=0;B=0;)h[v]=0;for(v=0;v=d.DV&&(h[v+d.t]-=d.DV,h[v+d.t+1]=1)}h.t>0&&(h[h.t-1]+=d.am(v,d[v],h,2*v,0,1)),h.s=0,h.clamp()}function re(h,d,v){var b=h.abs();if(!(b.t<=0)){var B=this.abs();if(B.t0?(b.lShiftTo(He,M),B.lShiftTo(He,v)):(b.copyTo(M),B.copyTo(v));var rt=M.t,Ut=M[rt-1];if(Ut!=0){var Rt=Ut*(1<1?M[rt-2]>>this.F2:0),Or=this.FV/Rt,pa=(1<=0&&(v[v.t++]=1,v.subTo(Vr,v)),i.ONE.dlShiftTo(rt,Vr),Vr.subTo(M,M);M.t