@libp2p/daemon 5.0.3 → 5.0.4-a02cb0461

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.min.js CHANGED
@@ -1,15 +1,21 @@
1
1
  #! /usr/bin/env node
2
2
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PDaemon = factory()}(typeof self !== 'undefined' ? self : this, function () {
3
- "use strict";var Libp2PDaemon=(()=>{var Qs=Object.create;var Ge=Object.defineProperty;var Js=Object.getOwnPropertyDescriptor;var Zs=Object.getOwnPropertyNames;var Xs=Object.getPrototypeOf,ks=Object.prototype.hasOwnProperty;var V=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var to=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),gt=(r,t)=>{for(var e in t)Ge(r,e,{get:t[e],enumerable:!0})},Yr=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Zs(t))!ks.call(r,i)&&i!==e&&Ge(r,i,{get:()=>t[i],enumerable:!(n=Js(t,i))||n.enumerable});return r};var Ye=(r,t,e)=>(e=r!=null?Qs(Xs(r)):{},Yr(t||!r||!r.__esModule?Ge(e,"default",{value:r,enumerable:!0}):e,r)),eo=r=>Yr(Ge({},"__esModule",{value:!0}),r);var qs=to((hd,Hs)=>{var Hr=class{constructor(t,e){this.ctx=e||{},this.yargs=t,this.parse=this.parse.bind(this),this.command=this.yargs.command,this.commandDir=this.yargs.commandDir}parse(t){let e=this.yargs,n;return new Promise((i,s)=>{let o=Object.assign({},this.ctx,{resolve:i,reject:s});e.parse(t,o,function(c,h,g){return n=h,c?h.reject(c):h.resolve(g)})}).then(i=>Promise.resolve(i)).then(i=>i&&i.argv?i:{data:i,argv:n}).catch(i=>Promise.resolve(i).then(s=>s&&s.argv?Promise.reject(s):Promise.reject({error:s,argv:n})))}};Hs.exports=Hr});var Rc={};gt(Rc,{createLibp2pServer:()=>Ks,default:()=>Gr});var gi=V("node:buffer");var Dn={};gt(Dn,{base10:()=>co});var Vc=new Uint8Array(0);function Kr(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function Ot(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function Qr(r){return new TextEncoder().encode(r)}function Jr(r){return new TextDecoder().decode(r)}function no(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var s=r.charAt(i),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=i}var c=r.length,h=r.charAt(0),g=Math.log(c)/Math.log(256),m=Math.log(256)/Math.log(c);function d(C){if(C instanceof Uint8Array||(ArrayBuffer.isView(C)?C=new Uint8Array(C.buffer,C.byteOffset,C.byteLength):Array.isArray(C)&&(C=Uint8Array.from(C))),!(C instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(C.length===0)return"";for(var x=0,p=0,M=0,N=C.length;M!==N&&C[M]===0;)M++,x++;for(var R=(N-M)*m+1>>>0,U=new Uint8Array(R);M!==N;){for(var B=C[M],ft=0,J=R-1;(B!==0||ft<p)&&J!==-1;J--,ft++)B+=256*U[J]>>>0,U[J]=B%c>>>0,B=B/c>>>0;if(B!==0)throw new Error("Non-zero carry");p=ft,M++}for(var ht=R-p;ht!==R&&U[ht]===0;)ht++;for(var Et=h.repeat(x);ht<R;++ht)Et+=r.charAt(U[ht]);return Et}function b(C){if(typeof C!="string")throw new TypeError("Expected String");if(C.length===0)return new Uint8Array;var x=0;if(C[x]!==" "){for(var p=0,M=0;C[x]===h;)p++,x++;for(var N=(C.length-x)*g+1>>>0,R=new Uint8Array(N);C[x];){var U=e[C.charCodeAt(x)];if(U===255)return;for(var B=0,ft=N-1;(U!==0||B<M)&&ft!==-1;ft--,B++)U+=c*R[ft]>>>0,R[ft]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");M=B,x++}if(C[x]!==" "){for(var J=N-M;J!==N&&R[J]===0;)J++;for(var ht=new Uint8Array(p+(N-J)),Et=p;J!==N;)ht[Et++]=R[J++];return ht}}}function y(C){var x=b(C);if(x)return x;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:b,decode:y}}var ro=no,io=ro,Xr=io;var Sn=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Pn=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){this.name=t,this.prefix=e;let i=e.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return kr(this,t)}},In=class{decoders;constructor(t){this.decoders=t}or(t){return kr(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function kr(r,t){return new In({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var vn=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new Sn(t,e,n),this.decoder=new Pn(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function pe({name:r,prefix:t,encode:e,decode:n}){return new vn(r,t,e,n)}function Wt({name:r,prefix:t,alphabet:e}){let{encode:n,decode:i}=Xr(e,r);return pe({prefix:t,name:r,encode:n,decode:s=>Ot(i(s))})}function so(r,t,e,n){let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*e/8|0),o=0,c=0,h=0;for(let g=0;g<i;++g){let m=t[r[g]];if(m===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<e|m,o+=e,o>=8&&(o-=8,s[h++]=255&c>>o)}if(o>=e||(255&c<<8-o)!==0)throw new SyntaxError("Unexpected end of data");return s}function oo(r,t,e){let n=t[t.length-1]==="=",i=(1<<e)-1,s="",o=0,c=0;for(let h=0;h<r.length;++h)for(c=c<<8|r[h],o+=8;o>e;)o-=e,s+=t[i&c>>o];if(o!==0&&(s+=t[i&c<<e-o]),n)for(;(s.length*e&7)!==0;)s+="=";return s}function ao(r){let t={};for(let e=0;e<r.length;++e)t[r[e]]=e;return t}function et({name:r,prefix:t,bitsPerChar:e,alphabet:n}){let i=ao(n);return pe({prefix:t,name:r,encode(s){return oo(s,n,e)},decode(s){return so(s,i,e,r)}})}var co=Wt({prefix:"9",name:"base10",alphabet:"0123456789"});var jn={};gt(jn,{base16:()=>lo,base16upper:()=>fo});var lo=et({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),fo=et({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Mn={};gt(Mn,{base2:()=>uo});var uo=et({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Tn={};gt(Tn,{base256emoji:()=>bo});var ti=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),ho=ti.reduce((r,t,e)=>(r[e]=t,r),[]),po=ti.reduce((r,t,e)=>{let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);return r[n]=e,r},[]);function mo(r){return r.reduce((t,e)=>(t+=ho[e],t),"")}function go(r){let t=[];for(let e of r){let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);let i=po[n];if(i==null)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}var bo=pe({prefix:"\u{1F680}",name:"base256emoji",encode:mo,decode:go});var Nn={};gt(Nn,{base32:()=>Vt,base32hex:()=>Co,base32hexpad:()=>Oo,base32hexpadupper:()=>_o,base32hexupper:()=>Eo,base32pad:()=>yo,base32padupper:()=>xo,base32upper:()=>wo,base32z:()=>Ao});var Vt=et({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),wo=et({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),yo=et({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),xo=et({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Co=et({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Eo=et({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Oo=et({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_o=et({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ao=et({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var $n={};gt($n,{base36:()=>ve,base36upper:()=>So});var ve=Wt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),So=Wt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Fn={};gt(Fn,{base58btc:()=>_t,base58flickr:()=>Po});var _t=Wt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Po=Wt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ln={};gt(Ln,{base64:()=>Io,base64pad:()=>vo,base64url:()=>Un,base64urlpad:()=>Do});var Io=et({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),vo=et({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Un=et({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Do=et({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var zn={};gt(zn,{base8:()=>jo});var jo=et({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Rn={};gt(Rn,{identity:()=>Mo});var Mo=pe({prefix:"\0",name:"identity",encode:r=>Jr(r),decode:r=>Qr(r)});var sl=new TextEncoder,ol=new TextDecoder;var Wn={};gt(Wn,{identity:()=>ea});var $o=ri,ei=128,Fo=127,Uo=~Fo,Lo=Math.pow(2,31);function ri(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Lo;)t[e++]=r&255|ei,r/=128;for(;r&Uo;)t[e++]=r&255|ei,r>>>=7;return t[e]=r|0,ri.bytes=e-n+1,t}var zo=Bn,Ro=128,ni=127;function Bn(r,n){var e=0,n=n||0,i=0,s=n,o,c=r.length;do{if(s>=c)throw Bn.bytes=0,new RangeError("Could not decode varint");o=r[s++],e+=i<28?(o&ni)<<i:(o&ni)*Math.pow(2,i),i+=7}while(o>=Ro);return Bn.bytes=s-n,e}var Bo=Math.pow(2,7),Wo=Math.pow(2,14),Vo=Math.pow(2,21),Ho=Math.pow(2,28),qo=Math.pow(2,35),Go=Math.pow(2,42),Yo=Math.pow(2,49),Ko=Math.pow(2,56),Qo=Math.pow(2,63),Jo=function(r){return r<Bo?1:r<Wo?2:r<Vo?3:r<Ho?4:r<qo?5:r<Go?6:r<Yo?7:r<Ko?8:r<Qo?9:10},Zo={encode:$o,decode:zo,encodingLength:Jo},Xo=Zo,De=Xo;function je(r,t=0){return[De.decode(r,t),De.decode.bytes]}function me(r,t,e=0){return De.encode(r,t,e),t}function ge(r){return De.encodingLength(r)}function we(r,t){let e=t.byteLength,n=ge(r),i=n+ge(e),s=new Uint8Array(i+e);return me(r,s,0),me(e,s,n),s.set(t,i),new be(r,e,t,s)}function ii(r){let t=Ot(r),[e,n]=je(t),[i,s]=je(t.subarray(n)),o=t.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new be(e,i,o,t)}function si(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Kr(r.bytes,e.bytes)}}var be=class{code;size;digest;bytes;constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}};var oi=0,ko="identity",ai=Ot;function ta(r,t){if(t?.truncate!=null&&t.truncate!==r.byteLength){if(t.truncate<0||t.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t.truncate)}return we(oi,ai(r))}var ea={code:oi,name:ko,encode:ai,digest:ta};var Gn={};gt(Gn,{sha256:()=>ra,sha512:()=>ia});var qn=Ye(V("crypto"),1);var na=20;function Hn({name:r,code:t,encode:e,minDigestLength:n,maxDigestLength:i}){return new Vn(r,t,e,n,i)}var Vn=class{name;code;encode;minDigestLength;maxDigestLength;constructor(t,e,n,i,s){this.name=t,this.code=e,this.encode=n,this.minDigestLength=i??na,this.maxDigestLength=s}digest(t,e){if(e?.truncate!=null){if(e.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&e.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(t instanceof Uint8Array){let n=this.encode(t);return n instanceof Uint8Array?ci(n,this.code,e?.truncate):n.then(i=>ci(i,this.code,e?.truncate))}else throw Error("Unknown type, must be binary type")}};function ci(r,t,e){if(e!=null&&e!==r.byteLength){if(e>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e)}return we(t,r)}var ra=Hn({name:"sha2-256",code:18,encode:r=>Ot(qn.default.createHash("sha256").update(r).digest())}),ia=Hn({name:"sha2-512",code:19,encode:r=>Ot(qn.default.createHash("sha512").update(r).digest())});function fi(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return oa(e,Yn(r),t??_t.encoder);default:return aa(e,Yn(r),t??Vt.encoder)}}var ui=new WeakMap;function Yn(r){let t=ui.get(r);if(t==null){let e=new Map;return ui.set(r,e),e}return t}var Ht=class r{code;version;multihash;bytes;"/";constructor(t,e,n,i){this.code=e,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==Te)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==ca)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=we(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&si(t.multihash,n.multihash)}toString(t){return fi(this,t)}toJSON(){return{"/":fi(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:i,multihash:s,bytes:o}=e;return new r(n,i,s,o??hi(n,i,s.bytes))}else if(e[la]===!0){let{version:n,multihash:i,code:s}=e,o=ii(i);return r.create(n,s,o)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Te)throw new Error(`Version 0 CID must use dag-pb (code: ${Te}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let i=hi(t,e,n.bytes);return new r(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Te,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,i=Ot(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");let s=i.subarray(e.multihashSize-e.digestSize),o=new be(e.multihashCode,e.digestSize,s,i);return[e.version===0?r.createV0(o):r.createV1(e.codec,o),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[d,b]=je(t.subarray(e));return e+=b,d},i=n(),s=Te;if(i===18?(i=0,e=0):s=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=e,c=n(),h=n(),g=e+h,m=g-o;return{version:i,codec:s,multihashCode:c,digestSize:h,multihashSize:m,size:g}}static parse(t,e){let[n,i]=sa(t,e),s=r.decode(i);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Yn(s).set(n,t),s}};function sa(r,t){switch(r[0]){case"Q":{let e=t??_t;return[_t.prefix,e.decode(`${_t.prefix}${r}`)]}case _t.prefix:{let e=t??_t;return[_t.prefix,e.decode(r)]}case Vt.prefix:{let e=t??Vt;return[Vt.prefix,e.decode(r)]}case ve.prefix:{let e=t??ve;return[ve.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function oa(r,t,e){let{prefix:n}=e;if(n!==_t.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let i=t.get(n);if(i==null){let s=e.encode(r).slice(1);return t.set(n,s),s}else return i}function aa(r,t,e){let{prefix:n}=e,i=t.get(n);if(i==null){let s=e.encode(r);return t.set(n,s),s}else return i}var Te=112,ca=18;function hi(r,t,e){let n=ge(r),i=n+ge(t),s=new Uint8Array(i+e.byteLength);return me(r,s,0),me(t,s,n),s.set(e,i),s}var la=Symbol.for("@ipld/js-cid/CID");var Ne={...Rn,...Mn,...zn,...Dn,...jn,...Nn,...$n,...Fn,...Ln,...Tn},vl={...Gn,...Wn};var di=V("node:buffer");function ye(r){return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}function Kn(r=0){return ye(di.Buffer.allocUnsafe(r))}function mi(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var pi=mi("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Qn=mi("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=Kn(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),fa={utf8:pi,"utf-8":pi,hex:Ne.base16,latin1:Qn,ascii:Qn,binary:Qn,...Ne},Qe=fa;function At(r,t="utf8"){let e=Qe[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return t==="utf8"||t==="utf-8"?gi.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}var ut=class extends Error{static name="InvalidMultiaddrError";name="InvalidMultiaddrError"},zt=class extends Error{static name="ValidationError";name="ValidationError"},$e=class extends Error{static name="InvalidParametersError";name="InvalidParametersError"},Je=class extends Error{static name="UnknownProtocolError";name="UnknownProtocolError"};function bi(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var wi=V("node:buffer");function qt(r,t="utf8"){let e=Qe[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return t==="utf8"||t==="utf-8"?ye(wi.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var ua=Math.pow(2,7),ha=Math.pow(2,14),da=Math.pow(2,21),Jn=Math.pow(2,28),Zn=Math.pow(2,35),Xn=Math.pow(2,42),kn=Math.pow(2,49),X=128,dt=127;function xe(r){if(r<ua)return 1;if(r<ha)return 2;if(r<da)return 3;if(r<Jn)return 4;if(r<Zn)return 5;if(r<Xn)return 6;if(r<kn)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function tr(r,t,e=0){switch(xe(r)){case 8:t[e++]=r&255|X,r/=128;case 7:t[e++]=r&255|X,r/=128;case 6:t[e++]=r&255|X,r/=128;case 5:t[e++]=r&255|X,r/=128;case 4:t[e++]=r&255|X,r>>>=7;case 3:t[e++]=r&255|X,r>>>=7;case 2:t[e++]=r&255|X,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function pa(r,t){let e=r[t],n=0;if(n+=e&dt,e<X||(e=r[t+1],n+=(e&dt)<<7,e<X)||(e=r[t+2],n+=(e&dt)<<14,e<X)||(e=r[t+3],n+=(e&dt)<<21,e<X)||(e=r[t+4],n+=(e&dt)*Jn,e<X)||(e=r[t+5],n+=(e&dt)*Zn,e<X)||(e=r[t+6],n+=(e&dt)*Xn,e<X)||(e=r[t+7],n+=(e&dt)*kn,e<X))return n;throw new RangeError("Could not decode varint")}function ma(r,t){let e=r.get(t),n=0;if(n+=e&dt,e<X||(e=r.get(t+1),n+=(e&dt)<<7,e<X)||(e=r.get(t+2),n+=(e&dt)<<14,e<X)||(e=r.get(t+3),n+=(e&dt)<<21,e<X)||(e=r.get(t+4),n+=(e&dt)*Jn,e<X)||(e=r.get(t+5),n+=(e&dt)*Zn,e<X)||(e=r.get(t+6),n+=(e&dt)*Xn,e<X)||(e=r.get(t+7),n+=(e&dt)*kn,e<X))return n;throw new RangeError("Could not decode varint")}function er(r,t=0){return r instanceof Uint8Array?pa(r,t):ma(r,t)}var yi=V("node:buffer");function Fe(r,t){return ye(yi.Buffer.concat(r,t))}var Rt=V("node:net");function rr(r){return t=>At(t,r)}function ir(r){return t=>qt(t,r)}function Ce(r){return new DataView(r.buffer).getUint16(r.byteOffset).toString()}function te(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,typeof r=="string"?parseInt(r):r),new Uint8Array(t)}function xi(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==16)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion address.`);let e=qt(t[0],"base32"),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=te(n);return Fe([e,i],e.length+i.length)}function Ci(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==56)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion3 address.`);let e=Vt.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=te(n);return Fe([e,i],e.length+i.length)}function sr(r){let t=r.subarray(0,r.length-2),e=r.subarray(r.length-2),n=At(t,"base32"),i=Ce(e);return`${n}:${i}`}var or=function(r){r=r.toString().trim();let t=new Uint8Array(4);return r.split(/\./g).forEach((e,n)=>{let i=parseInt(e,10);if(isNaN(i)||i<0||i>255)throw new ut("Invalid byte value in IP address");t[n]=i}),t},Ei=function(r){let t=0;r=r.toString().trim();let e=r.split(":",8),n;for(n=0;n<e.length;n++){let s=(0,Rt.isIPv4)(e[n]),o;s&&(o=or(e[n]),e[n]=At(o.subarray(0,2),"base16")),o!=null&&++n<8&&e.splice(n,0,At(o.subarray(2,4),"base16"))}if(e[0]==="")for(;e.length<8;)e.unshift("0");else if(e[e.length-1]==="")for(;e.length<8;)e.push("0");else if(e.length<8){for(n=0;n<e.length&&e[n]!=="";n++);let s=[n,1];for(n=9-e.length;n>0;n--)s.push("0");e.splice.apply(e,s)}let i=new Uint8Array(t+16);for(n=0;n<e.length;n++){e[n]===""&&(e[n]="0");let s=parseInt(e[n],16);if(isNaN(s)||s<0||s>65535)throw new ut("Invalid byte value in IP address");i[t++]=s>>8&255,i[t++]=s&255}return i},Oi=function(r){if(r.byteLength!==4)throw new ut("IPv4 address was incorrect length");let t=[];for(let e=0;e<r.byteLength;e++)t.push(r[e]);return t.join(".")},_i=function(r){if(r.byteLength!==16)throw new ut("IPv6 address was incorrect length");let t=[];for(let n=0;n<r.byteLength;n+=2){let i=r[n],s=r[n+1],o=`${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`;t.push(o)}let e=t.join(":");try{let n=new URL(`http://[${e}]`);return n.hostname.substring(1,n.hostname.length-1)}catch{throw new ut(`Invalid IPv6 address "${e}"`)}};function Ai(r){try{let t=new URL(`http://[${r}]`);return t.hostname.substring(1,t.hostname.length-1)}catch{throw new ut(`Invalid IPv6 address "${r}"`)}}var nr=Object.values(Ne).map(r=>r.decoder),ba=(function(){let r=nr[0].or(nr[1]);return nr.slice(2).forEach(t=>r=r.or(t)),r})();function Si(r){return ba.decode(r)}function Pi(r){return t=>r.encoder.encode(t)}function wa(r){if(parseInt(r).toString()!==r)throw new zt("Value must be an integer")}function ya(r){if(r<0)throw new zt("Value must be a positive integer, or zero")}function xa(r){return t=>{if(t>r)throw new zt(`Value must be smaller than or equal to ${r}`)}}function Ca(...r){return t=>{for(let e of r)e(t)}}var Ue=Ca(wa,ya,xa(65535));var ct=-1,ar=class{protocolsByCode=new Map;protocolsByName=new Map;getProtocol(t){let e;if(typeof t=="string"?e=this.protocolsByName.get(t):e=this.protocolsByCode.get(t),e==null)throw new Je(`Protocol ${t} was unknown`);return e}addProtocol(t){this.protocolsByCode.set(t.code,t),this.protocolsByName.set(t.name,t),t.aliases?.forEach(e=>{this.protocolsByName.set(e,t)})}removeProtocol(t){let e=this.protocolsByCode.get(t);e!=null&&(this.protocolsByCode.delete(e.code),this.protocolsByName.delete(e.name),e.aliases?.forEach(n=>{this.protocolsByName.delete(n)}))}},bt=new ar,Za=[{code:4,name:"ip4",size:32,valueToBytes:or,bytesToValue:Oi,validate:r=>{if(!(0,Rt.isIPv4)(r))throw new zt(`Invalid IPv4 address "${r}"`)}},{code:6,name:"tcp",size:16,valueToBytes:te,bytesToValue:Ce,validate:Ue},{code:273,name:"udp",size:16,valueToBytes:te,bytesToValue:Ce,validate:Ue},{code:33,name:"dccp",size:16,valueToBytes:te,bytesToValue:Ce,validate:Ue},{code:41,name:"ip6",size:128,valueToBytes:Ei,bytesToValue:_i,stringToValue:Ai,validate:r=>{if(!(0,Rt.isIPv6)(r))throw new zt(`Invalid IPv6 address "${r}"`)}},{code:42,name:"ip6zone",size:ct},{code:43,name:"ipcidr",size:8,bytesToValue:rr("base10"),valueToBytes:ir("base10")},{code:53,name:"dns",size:ct,resolvable:!0},{code:54,name:"dns4",size:ct,resolvable:!0},{code:55,name:"dns6",size:ct,resolvable:!0},{code:56,name:"dnsaddr",size:ct,resolvable:!0},{code:132,name:"sctp",size:16,valueToBytes:te,bytesToValue:Ce,validate:Ue},{code:301,name:"udt"},{code:302,name:"utp"},{code:400,name:"unix",size:ct,path:!0,stringToValue:r=>decodeURIComponent(r),valueToString:r=>encodeURIComponent(r)},{code:421,name:"p2p",aliases:["ipfs"],size:ct,bytesToValue:rr("base58btc"),valueToBytes:r=>r.startsWith("Q")||r.startsWith("1")?ir("base58btc")(r):Ht.parse(r).multihash.bytes},{code:444,name:"onion",size:96,bytesToValue:sr,valueToBytes:xi},{code:445,name:"onion3",size:296,bytesToValue:sr,valueToBytes:Ci},{code:446,name:"garlic64",size:ct},{code:447,name:"garlic32",size:ct},{code:448,name:"tls"},{code:449,name:"sni",size:ct},{code:454,name:"noise"},{code:460,name:"quic"},{code:461,name:"quic-v1"},{code:465,name:"webtransport"},{code:466,name:"certhash",size:ct,bytesToValue:Pi(Un),valueToBytes:Si},{code:480,name:"http"},{code:481,name:"http-path",size:ct,stringToValue:r=>`/${decodeURIComponent(r)}`,valueToString:r=>encodeURIComponent(r.substring(1))},{code:443,name:"https"},{code:477,name:"ws"},{code:478,name:"wss"},{code:479,name:"p2p-websocket-star"},{code:277,name:"p2p-stardust"},{code:275,name:"p2p-webrtc-star"},{code:276,name:"p2p-webrtc-direct"},{code:280,name:"webrtc-direct"},{code:281,name:"webrtc"},{code:290,name:"p2p-circuit"},{code:777,name:"memory",size:ct}];Za.forEach(r=>{bt.addProtocol(r)});function Ii(r){let t=[],e=0;for(;e<r.length;){let n=er(r,e),i=bt.getProtocol(n),s=xe(n),o=Xa(i,r,e+s),c=0;o>0&&i.size===ct&&(c=xe(o));let h=s+c+o,g={code:n,name:i.name,bytes:r.subarray(e,e+h)};if(o>0){let m=e+s+c,d=r.subarray(m,m+o);g.value=i.bytesToValue?.(d)??At(d)}t.push(g),e+=h}return t}function vi(r){let t=0,e=[];for(let n of r){if(n.bytes==null){let i=bt.getProtocol(n.code),s=xe(n.code),o,c=0,h=0;n.value!=null&&(o=i.valueToBytes?.(n.value)??qt(n.value),c=o.byteLength,i.size===ct&&(h=xe(c)));let g=new Uint8Array(s+h+c),m=0;tr(n.code,g,m),m+=s,o!=null&&(i.size===ct&&(tr(c,g,m),m+=h),g.set(o,m)),n.bytes=g}e.push(n.bytes),t+=n.bytes.byteLength}return Fe(e,t)}function Di(r){if(r.charAt(0)!=="/")throw new ut('String multiaddr must start with "/"');let t=[],e="protocol",n="",i="";for(let s=1;s<r.length;s++){let o=r.charAt(s);o!=="/"&&(e==="protocol"?i+=r.charAt(s):n+=r.charAt(s));let c=s===r.length-1;if(o==="/"||c){let h=bt.getProtocol(i);if(e==="protocol"){if(h.size==null||h.size===0){t.push({code:h.code,name:h.name}),n="",i="",e="protocol";continue}else if(c)throw new ut(`Component ${i} was missing value`);e="value"}else if(e==="value"){let g={code:h.code,name:h.name};if(h.size!=null&&h.size!==0){if(n==="")throw new ut(`Component ${i} was missing value`);g.value=h.stringToValue?.(n)??n}t.push(g),n="",i="",e="protocol"}}}if(i!==""&&n!=="")throw new ut("Incomplete multiaddr");return t}function ji(r){return`/${r.flatMap(t=>{if(t.value==null)return t.name;let e=bt.getProtocol(t.code);if(e==null)throw new ut(`Unknown protocol code ${t.code}`);return[t.name,e.valueToString?.(t.value)??t.value]}).join("/")}`}function Xa(r,t,e){return r.size==null||r.size===0?0:r.size>0?r.size/8:er(t,e)}var ka=Symbol.for("nodejs.util.inspect.custom"),mr=Symbol.for("@multiformats/multiaddr"),tc=[53,54,55,56],pr=class extends Error{constructor(t="No available resolver"){super(t),this.name="NoAvailableResolverError"}};function ec(r){if(r==null&&(r="/"),Ti(r))return r.getComponents();if(r instanceof Uint8Array)return Ii(r);if(typeof r=="string")return r=r.replace(/\/(\/)+/,"/").replace(/(\/)+$/,""),r===""&&(r="/"),Di(r);if(Array.isArray(r))return r;throw new ut("Must be a string, Uint8Array, Component[], or another Multiaddr")}var en=class r{[mr]=!0;#t;#e;#n;constructor(t="/",e={}){this.#t=ec(t),e.validate!==!1&&nc(this)}get bytes(){return this.#n==null&&(this.#n=vi(this.#t)),this.#n}toString(){return this.#e==null&&(this.#e=ji(this.#t)),this.#e}toJSON(){return this.toString()}toOptions(){let t,e,n,i,s="";for(let{code:c,name:h,value:g}of this.#t)c===42&&(s=`%${g??""}`),tc.includes(c)&&(e="tcp",i=443,n=`${g??""}${s}`,t=c===55?6:4),(c===6||c===273)&&(e=h==="tcp"?"tcp":"udp",i=parseInt(g??"")),(c===4||c===41)&&(e="tcp",n=`${g??""}${s}`,t=c===41?6:4);if(t==null||e==null||n==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:t,host:n,transport:e,port:i}}getComponents(){return[...this.#t]}protos(){return this.#t.map(({code:t,value:e})=>{let n=bt.getProtocol(t);return{code:t,size:n.size??0,name:n.name,resolvable:!!n.resolvable,path:!!n.path}})}protoCodes(){return this.#t.map(({code:t})=>t)}protoNames(){return this.#t.map(({name:t})=>t)}tuples(){return this.#t.map(({code:t,value:e})=>{if(e==null)return[t];let n=bt.getProtocol(t),i=[t];return e!=null&&i.push(n.valueToBytes?.(e)??qt(e)),i})}stringTuples(){return this.#t.map(({code:t,value:e})=>e==null?[t]:[t,e])}encapsulate(t){let e=new r(t);return new r([...this.#t,...e.getComponents()],{validate:!1})}decapsulate(t){let e=t.toString(),n=this.toString(),i=n.lastIndexOf(e);if(i<0)throw new $e(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new r(n.slice(0,i),{validate:!1})}decapsulateCode(t){let e;for(let n=this.#t.length-1;n>-1;n--)if(this.#t[n].code===t){e=n;break}return new r(this.#t.slice(0,e),{validate:!1})}getPeerId(){try{let t=[];this.#t.forEach(({code:n,value:i})=>{n===421&&t.push([n,i]),n===290&&(t=[])});let e=t.pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?At(_t.decode(`z${n}`),"base58btc"):At(Ht.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){for(let t of this.#t)if(bt.getProtocol(t.code).path)return t.value??null;return null}equals(t){return bi(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(s=>s.resolvable);if(e==null)return[this];let n=Mi.get(e.name);if(n==null)throw new pr(`no available resolver for ${e.name}`);return(await n(this,t)).map(s=>ze(s))}nodeAddress(){let t=this.toOptions();if(t.transport!=="tcp"&&t.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${t.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:t.family,address:t.host,port:t.port}}isThinWaistAddress(){return!(this.#t.length!==2||this.#t[0].code!==4&&this.#t[0].code!==41||this.#t[1].code!==6&&this.#t[1].code!==273)}[ka](){return`Multiaddr(${this.toString()})`}};function nc(r){r.getComponents().forEach(t=>{let e=bt.getProtocol(t.code);t.value!=null&&e.validate?.(t.value)})}var nn=class{index=0;input="";new(t){return this.index=0,this.input=t,this}readAtomically(t){let e=this.index,n=t();return n===void 0&&(this.index=e),n}parseWith(t){let e=t();if(this.index===this.input.length)return e}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(t){return this.readAtomically(()=>{let e=this.readChar();if(e===t)return e})}readSeparator(t,e,n){return this.readAtomically(()=>{if(!(e>0&&this.readGivenChar(t)===void 0))return n()})}readNumber(t,e,n,i){return this.readAtomically(()=>{let s=0,o=0,c=this.peekChar();if(c===void 0)return;let h=c==="0",g=2**(8*i)-1;for(;;){let m=this.readAtomically(()=>{let d=this.readChar();if(d===void 0)return;let b=Number.parseInt(d,t);if(!Number.isNaN(b))return b});if(m===void 0)break;if(s*=t,s+=m,s>g||(o+=1,e!==void 0&&o>e))return}if(o!==0)return!n&&h&&o>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let t=new Uint8Array(4);for(let e=0;e<t.length;e++){let n=this.readSeparator(".",e,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;t[e]=n}return t})}readIPv6Addr(){let t=e=>{for(let n=0;n<e.length/2;n++){let i=n*2;if(n<e.length-3){let o=this.readSeparator(":",n,()=>this.readIPv4Addr());if(o!==void 0)return e[i]=o[0],e[i+1]=o[1],e[i+2]=o[2],e[i+3]=o[3],[i+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[i,!1];e[i]=s>>8,e[i+1]=s&255}return[e.length,!1]};return this.readAtomically(()=>{let e=new Uint8Array(16),[n,i]=t(e);if(n===16)return e;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),o=16-(n+2),[c]=t(s.subarray(0,o));return e.set(s.subarray(0,c),16-c),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Tf=new nn;var Bf=parseInt("0xFFFF",16),Wf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var Mi=new Map;function Ti(r){return!!r?.[mr]}function ze(r){return new en(r)}var Fi=V("module"),br=Ye(V("path"),1),gr=Ye(V("process"),1),Ui=V("url");function cc(r){let t=br.default.extname(r);return t?r.slice(0,-t.length):r}function wr(r){if(!r)return!1;if("main"in r)return!!r.main;if(!gr.default.argv[1])return!1;let e=(0,Fi.createRequire)(r.url).resolve(gr.default.argv[1]),n=(0,Ui.fileURLToPath)(r.url);return br.default.extname(e)?n===e:cc(n)===e}var un=V("assert");var lc={right:pc,center:mc},fc=0,rn=1,uc=2,sn=3,yr=class{constructor(t){var e;this.width=t.width,this.wrap=(e=t.wrap)!==null&&e!==void 0?e:!0,this.rows=[]}span(...t){let e=this.div(...t);e.span=!0}resetOutput(){this.rows=[]}div(...t){if(t.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...t)&&typeof t[0]=="string")return this.applyLayoutDSL(t[0]);let e=t.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(e),e}shouldApplyLayoutDSL(...t){return t.length===1&&typeof t[0]=="string"&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){let e=t.split(`
4
- `).map(i=>i.split(" ")),n=0;return e.forEach(i=>{i.length>1&&wt.stringWidth(i[0])>n&&(n=Math.min(Math.floor(this.width*.5),wt.stringWidth(i[0])))}),e.forEach(i=>{this.div(...i.map((s,o)=>({text:s.trim(),padding:this.measurePadding(s),width:o===0&&i.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){let e=wt.stripAnsi(t);return[0,e.match(/\s*$/)[0].length,0,e.match(/^\s*/)[0].length]}toString(){let t=[];return this.rows.forEach(e=>{this.rowToString(e,t)}),t.filter(e=>!e.hidden).map(e=>e.text).join(`
5
- `)}rowToString(t,e){return this.rasterize(t).forEach((n,i)=>{let s="";n.forEach((o,c)=>{let{width:h}=t[c],g=this.negatePadding(t[c]),m=o;if(g>wt.stringWidth(o)&&(m+=" ".repeat(g-wt.stringWidth(o))),t[c].align&&t[c].align!=="left"&&this.wrap){let b=lc[t[c].align];m=b(m,g),wt.stringWidth(m)<g&&(m+=" ".repeat((h||0)-wt.stringWidth(m)-1))}let d=t[c].padding||[0,0,0,0];d[sn]&&(s+=" ".repeat(d[sn])),s+=Li(t[c],m,"| "),s+=m,s+=Li(t[c],m," |"),d[rn]&&(s+=" ".repeat(d[rn])),i===0&&e.length>0&&(s=this.renderInline(s,e[e.length-1]))}),e.push({text:s.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){let n=t.match(/^ */),i=n?n[0].length:0,s=e.text,o=wt.stringWidth(s.trimRight());return e.span?this.wrap?i<o?t:(e.hidden=!0,s.trimRight()+" ".repeat(i-o)+t.trimLeft()):(e.hidden=!0,s+t):t}rasterize(t){let e=[],n=this.columnWidths(t),i;return t.forEach((s,o)=>{s.width=n[o],this.wrap?i=wt.wrap(s.text,this.negatePadding(s),{hard:!0}).split(`
3
+ "use strict";var Libp2PDaemon=(()=>{var wo=Object.create;var kt=Object.defineProperty;var yo=Object.getOwnPropertyDescriptor;var Ao=Object.getOwnPropertyNames;var Bo=Object.getPrototypeOf,Oo=Object.prototype.hasOwnProperty;var k=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Pn=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ce=(t,e)=>{for(var n in e)kt(t,n,{get:e[n],enumerable:!0})},ii=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ao(e))!Oo.call(t,i)&&i!==n&&kt(t,i,{get:()=>e[i],enumerable:!(r=yo(e,i))||r.enumerable});return t};var gt=(t,e,n)=>(n=t!=null?wo(Bo(t)):{},ii(e||!t||!t.__esModule?kt(n,"default",{value:t,enumerable:!0}):n,t)),_o=t=>ii(kt({},"__esModule",{value:!0}),t);var ns=Pn((AD,ts)=>{ts.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var Ss=Pn((ih,_s)=>{"use strict";_s.exports=function(e){if(e===void 0&&(e=2),e>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+e+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");var n=Error.prepareStackTrace;Error.prepareStackTrace=function(i,s){return s};var r=new Error().stack;if(Error.prepareStackTrace=n,r!==null&&typeof r=="object")return r[e]?r[e].getFileName():void 0}});var Co=Pn((dd,go)=>{var ti=class{constructor(e,n){this.ctx=n||{},this.yargs=e,this.parse=this.parse.bind(this),this.command=this.yargs.command,this.commandDir=this.yargs.commandDir}parse(e){let n=this.yargs,r;return new Promise((i,s)=>{let o=Object.assign({},this.ctx,{resolve:i,reject:s});n.parse(e,o,function(a,f,p){return r=f,a?f.reject(a):f.resolve(p)})}).then(i=>Promise.resolve(i)).then(i=>i&&i.argv?i:{data:i,argv:r}).catch(i=>Promise.resolve(i).then(s=>s&&s.argv?Promise.reject(s):Promise.reject({error:s,argv:r})))}};go.exports=ti});var Oc={};Ce(Oc,{createLibp2pServer:()=>xo,default:()=>ri});var Oi=k("node:buffer");var Nn={};Ce(Nn,{base10:()=>Mo});var vc=new Uint8Array(0);function si(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.byteLength;n++)if(t[n]!==e[n])return!1;return!0}function Be(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}function oi(t){return new TextEncoder().encode(t)}function ui(t){return new TextDecoder().decode(t)}function So(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),o=s.charCodeAt(0);if(n[o]!==255)throw new TypeError(s+" is ambiguous");n[o]=i}var a=t.length,f=t.charAt(0),p=Math.log(a)/Math.log(256),m=Math.log(256)/Math.log(a);function l(C){if(C instanceof Uint8Array||(ArrayBuffer.isView(C)?C=new Uint8Array(C.buffer,C.byteOffset,C.byteLength):Array.isArray(C)&&(C=Uint8Array.from(C))),!(C instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(C.length===0)return"";for(var b=0,d=0,I=0,z=C.length;I!==z&&C[I]===0;)I++,b++;for(var L=(z-I)*m+1>>>0,U=new Uint8Array(L);I!==z;){for(var R=C[I],W=0,H=L-1;(R!==0||W<d)&&H!==-1;H--,W++)R+=256*U[H]>>>0,U[H]=R%a>>>0,R=R/a>>>0;if(R!==0)throw new Error("Non-zero carry");d=W,I++}for(var K=L-d;K!==L&&U[K]===0;)K++;for(var de=f.repeat(b);K<L;++K)de+=t.charAt(U[K]);return de}function F(C){if(typeof C!="string")throw new TypeError("Expected String");if(C.length===0)return new Uint8Array;var b=0;if(C[b]!==" "){for(var d=0,I=0;C[b]===f;)d++,b++;for(var z=(C.length-b)*p+1>>>0,L=new Uint8Array(z);C[b];){var U=n[C.charCodeAt(b)];if(U===255)return;for(var R=0,W=z-1;(U!==0||R<I)&&W!==-1;W--,R++)U+=a*L[W]>>>0,L[W]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");I=R,b++}if(C[b]!==" "){for(var H=z-I;H!==z&&L[H]===0;)H++;for(var K=new Uint8Array(d+(z-H)),de=d;H!==z;)K[de++]=L[H++];return K}}}function E(C){var b=F(C);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:F,decode:E}}var vo=So,Po=vo,ci=Po;var In=class{name;prefix;baseEncode;constructor(e,n,r){this.name=e,this.prefix=n,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},jn=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,n,r){this.name=e,this.prefix=n;let i=n.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return li(this,e)}},Tn=class{decoders;constructor(e){this.decoders=e}or(e){return li(this,e)}decode(e){let n=e[0],r=this.decoders[n];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function li(t,e){return new Tn({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var Mn=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,n,r,i){this.name=e,this.prefix=n,this.baseEncode=r,this.baseDecode=i,this.encoder=new In(e,n,r),this.decoder=new jn(e,n,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Ct({name:t,prefix:e,encode:n,decode:r}){return new Mn(t,e,n,r)}function He({name:t,prefix:e,alphabet:n}){let{encode:r,decode:i}=ci(n,t);return Ct({prefix:e,name:t,encode:r,decode:s=>Be(i(s))})}function Io(t,e,n,r){let i=t.length;for(;t[i-1]==="=";)--i;let s=new Uint8Array(i*n/8|0),o=0,a=0,f=0;for(let p=0;p<i;++p){let m=e[t[p]];if(m===void 0)throw new SyntaxError(`Non-${r} character`);a=a<<n|m,o+=n,o>=8&&(o-=8,s[f++]=255&a>>o)}if(o>=n||(255&a<<8-o)!==0)throw new SyntaxError("Unexpected end of data");return s}function jo(t,e,n){let r=e[e.length-1]==="=",i=(1<<n)-1,s="",o=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],o+=8;o>n;)o-=n,s+=e[i&a>>o];if(o!==0&&(s+=e[i&a<<n-o]),r)for(;(s.length*n&7)!==0;)s+="=";return s}function To(t){let e={};for(let n=0;n<t.length;++n)e[t[n]]=n;return e}function re({name:t,prefix:e,bitsPerChar:n,alphabet:r}){let i=To(r);return Ct({prefix:e,name:t,encode(s){return jo(s,r,n)},decode(s){return Io(s,i,n,t)}})}var Mo=He({prefix:"9",name:"base10",alphabet:"0123456789"});var $n={};Ce($n,{base16:()=>No,base16upper:()=>$o});var No=re({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$o=re({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ln={};Ce(Ln,{base2:()=>Lo});var Lo=re({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Un={};Ce(Un,{base256emoji:()=>Vo});var fi=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Uo=fi.reduce((t,e,n)=>(t[n]=e,t),[]),zo=fi.reduce((t,e,n)=>{let r=e.codePointAt(0);if(r==null)throw new Error(`Invalid character: ${e}`);return t[r]=n,t},[]);function Ro(t){return t.reduce((e,n)=>(e+=Uo[n],e),"")}function Wo(t){let e=[];for(let n of t){let r=n.codePointAt(0);if(r==null)throw new Error(`Invalid character: ${n}`);let i=zo[r];if(i==null)throw new Error(`Non-base256emoji character: ${n}`);e.push(i)}return new Uint8Array(e)}var Vo=Ct({prefix:"\u{1F680}",name:"base256emoji",encode:Ro,decode:Wo});var zn={};Ce(zn,{base32:()=>Ge,base32hex:()=>Yo,base32hexpad:()=>ko,base32hexpadupper:()=>Jo,base32hexupper:()=>Ko,base32pad:()=>Go,base32padupper:()=>qo,base32upper:()=>Ho,base32z:()=>Qo});var Ge=re({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ho=re({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Go=re({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),qo=re({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Yo=re({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ko=re({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ko=re({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Jo=re({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Qo=re({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Rn={};Ce(Rn,{base36:()=>jt,base36upper:()=>Zo});var jt=He({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Zo=He({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Wn={};Ce(Wn,{base58btc:()=>Oe,base58flickr:()=>Xo});var Oe=He({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Xo=He({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Hn={};Ce(Hn,{base64:()=>eu,base64pad:()=>tu,base64url:()=>Vn,base64urlpad:()=>nu});var eu=re({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),tu=re({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Vn=re({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),nu=re({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Gn={};Ce(Gn,{base8:()=>ru});var ru=re({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var qn={};Ce(qn,{identity:()=>iu});var iu=Ct({prefix:"\0",name:"identity",encode:t=>ui(t),decode:t=>oi(t)});var qc=new TextEncoder,Yc=new TextDecoder;var Kn={};Ce(Kn,{identity:()=>Ou});var uu=di,Di=128,au=127,cu=~au,lu=Math.pow(2,31);function di(t,e,n){e=e||[],n=n||0;for(var r=n;t>=lu;)e[n++]=t&255|Di,t/=128;for(;t&cu;)e[n++]=t&255|Di,t>>>=7;return e[n]=t|0,di.bytes=n-r+1,e}var fu=Yn,Du=128,hi=127;function Yn(t,r){var n=0,r=r||0,i=0,s=r,o,a=t.length;do{if(s>=a)throw Yn.bytes=0,new RangeError("Could not decode varint");o=t[s++],n+=i<28?(o&hi)<<i:(o&hi)*Math.pow(2,i),i+=7}while(o>=Du);return Yn.bytes=s-r,n}var hu=Math.pow(2,7),du=Math.pow(2,14),pu=Math.pow(2,21),mu=Math.pow(2,28),Fu=Math.pow(2,35),gu=Math.pow(2,42),Cu=Math.pow(2,49),Eu=Math.pow(2,56),bu=Math.pow(2,63),xu=function(t){return t<hu?1:t<du?2:t<pu?3:t<mu?4:t<Fu?5:t<gu?6:t<Cu?7:t<Eu?8:t<bu?9:10},wu={encode:uu,decode:fu,encodingLength:xu},yu=wu,Tt=yu;function Mt(t,e=0){return[Tt.decode(t,e),Tt.decode.bytes]}function Et(t,e,n=0){return Tt.encode(t,e,n),e}function bt(t){return Tt.encodingLength(t)}function wt(t,e){let n=e.byteLength,r=bt(t),i=r+bt(n),s=new Uint8Array(i+n);return Et(t,s,0),Et(n,s,r),s.set(e,i),new xt(t,n,e,s)}function pi(t){let e=Be(t),[n,r]=Mt(e),[i,s]=Mt(e.subarray(r)),o=e.subarray(r+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new xt(n,i,o,e)}function mi(t,e){if(t===e)return!0;{let n=e;return t.code===n.code&&t.size===n.size&&n.bytes instanceof Uint8Array&&si(t.bytes,n.bytes)}}var xt=class{code;size;digest;bytes;constructor(e,n,r,i){this.code=e,this.size=n,this.digest=r,this.bytes=i}};var Fi=0,Au="identity",gi=Be;function Bu(t,e){if(e?.truncate!=null&&e.truncate!==t.byteLength){if(e.truncate<0||e.truncate>t.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${t.byteLength}`);t=t.subarray(0,e.truncate)}return wt(Fi,gi(t))}var Ou={code:Fi,name:Au,encode:gi,digest:Bu};var Zn={};Ce(Zn,{sha256:()=>Su,sha512:()=>vu});var Qn=gt(k("crypto"),1);var _u=20;function Jn({name:t,code:e,encode:n,minDigestLength:r,maxDigestLength:i}){return new kn(t,e,n,r,i)}var kn=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,n,r,i,s){this.name=e,this.code=n,this.encode=r,this.minDigestLength=i??_u,this.maxDigestLength=s}digest(e,n){if(n?.truncate!=null){if(n.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&n.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Ci(r,this.code,n?.truncate):r.then(i=>Ci(i,this.code,n?.truncate))}else throw Error("Unknown type, must be binary type")}};function Ci(t,e,n){if(n!=null&&n!==t.byteLength){if(n>t.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${t.byteLength}`);t=t.subarray(0,n)}return wt(e,t)}var Su=Jn({name:"sha2-256",code:18,encode:t=>Be(Qn.default.createHash("sha256").update(t).digest())}),vu=Jn({name:"sha2-512",code:19,encode:t=>Be(Qn.default.createHash("sha512").update(t).digest())});function bi(t,e){let{bytes:n,version:r}=t;switch(r){case 0:return Iu(n,Xn(t),e??Oe.encoder);default:return ju(n,Xn(t),e??Ge.encoder)}}var xi=new WeakMap;function Xn(t){let e=xi.get(t);if(e==null){let n=new Map;return xi.set(t,n),n}return e}var qe=class t{code;version;multihash;bytes;"/";constructor(e,n,r,i){this.code=n,this.version=e,this.multihash=r,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:n}=this;if(e!==$t)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(n.code!==Tu)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(n)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:n}=this.multihash,r=wt(e,n);return t.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,n){let r=n;return r!=null&&e.code===r.code&&e.version===r.version&&mi(e.multihash,r.multihash)}toString(e){return bi(this,e)}toJSON(){return{"/":bi(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let n=e;if(n instanceof t)return n;if(n["/"]!=null&&n["/"]===n.bytes||n.asCID===n){let{version:r,code:i,multihash:s,bytes:o}=n;return new t(r,i,s,o??wi(r,i,s.bytes))}else if(n[Mu]===!0){let{version:r,multihash:i,code:s}=n,o=pi(i);return t.create(r,s,o)}else return null}static create(e,n,r){if(typeof n!="number")throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(n!==$t)throw new Error(`Version 0 CID must use dag-pb (code: ${$t}) block encoding`);return new t(e,n,r,r.bytes)}case 1:{let i=wi(e,n,r.bytes);return new t(e,n,r,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,$t,e)}static createV1(e,n){return t.create(1,e,n)}static decode(e){let[n,r]=t.decodeFirst(e);if(r.length!==0)throw new Error("Incorrect length");return n}static decodeFirst(e){let n=t.inspectBytes(e),r=n.size-n.multihashSize,i=Be(e.subarray(r,r+n.multihashSize));if(i.byteLength!==n.multihashSize)throw new Error("Incorrect length");let s=i.subarray(n.multihashSize-n.digestSize),o=new xt(n.multihashCode,n.digestSize,s,i);return[n.version===0?t.createV0(o):t.createV1(n.codec,o),e.subarray(n.size)]}static inspectBytes(e){let n=0,r=()=>{let[l,F]=Mt(e.subarray(n));return n+=F,l},i=r(),s=$t;if(i===18?(i=0,n=0):s=r(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=n,a=r(),f=r(),p=n+f,m=p-o;return{version:i,codec:s,multihashCode:a,digestSize:f,multihashSize:m,size:p}}static parse(e,n){let[r,i]=Pu(e,n),s=t.decode(i);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Xn(s).set(r,e),s}};function Pu(t,e){switch(t[0]){case"Q":{let n=e??Oe;return[Oe.prefix,n.decode(`${Oe.prefix}${t}`)]}case Oe.prefix:{let n=e??Oe;return[Oe.prefix,n.decode(t)]}case Ge.prefix:{let n=e??Ge;return[Ge.prefix,n.decode(t)]}case jt.prefix:{let n=e??jt;return[jt.prefix,n.decode(t)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function Iu(t,e,n){let{prefix:r}=n;if(r!==Oe.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);let i=e.get(r);if(i==null){let s=n.encode(t).slice(1);return e.set(r,s),s}else return i}function ju(t,e,n){let{prefix:r}=n,i=e.get(r);if(i==null){let s=n.encode(t);return e.set(r,s),s}else return i}var $t=112,Tu=18;function wi(t,e,n){let r=bt(t),i=r+bt(e),s=new Uint8Array(i+n.byteLength);return Et(t,s,0),Et(e,s,r),s.set(n,i),s}var Mu=Symbol.for("@ipld/js-cid/CID");var Lt={...qn,...Ln,...Gn,...Nn,...$n,...zn,...Rn,...Wn,...Hn,...Un},ml={...Zn,...Kn};var yi=k("node:buffer");function yt(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function er(t=0){return yt(yi.Buffer.allocUnsafe(t))}function Bi(t,e,n,r){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:n},decoder:{decode:r}}}var Ai=Bi("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),tr=Bi("ascii","a",t=>{let e="a";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e},t=>{t=t.substring(1);let e=er(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}),Nu={utf8:Ai,"utf-8":Ai,hex:Lt.base16,latin1:tr,ascii:tr,binary:tr,...Lt},Qt=Nu;function _e(t,e="utf8"){let n=Qt[e];if(n==null)throw new Error(`Unsupported encoding "${e}"`);return e==="utf8"||e==="utf-8"?Oi.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):n.encoder.encode(t).substring(1)}var he=class extends Error{static name="InvalidMultiaddrError";name="InvalidMultiaddrError"},Re=class extends Error{static name="ValidationError";name="ValidationError"},Ut=class extends Error{static name="InvalidParametersError";name="InvalidParametersError"},Zt=class extends Error{static name="UnknownProtocolError";name="UnknownProtocolError"};function _i(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.byteLength;n++)if(t[n]!==e[n])return!1;return!0}var Si=k("node:buffer");function Ye(t,e="utf8"){let n=Qt[e];if(n==null)throw new Error(`Unsupported encoding "${e}"`);return e==="utf8"||e==="utf-8"?yt(Si.Buffer.from(t,"utf-8")):n.decoder.decode(`${n.prefix}${t}`)}var $u=Math.pow(2,7),Lu=Math.pow(2,14),Uu=Math.pow(2,21),nr=Math.pow(2,28),rr=Math.pow(2,35),ir=Math.pow(2,42),sr=Math.pow(2,49),ee=128,pe=127;function At(t){if(t<$u)return 1;if(t<Lu)return 2;if(t<Uu)return 3;if(t<nr)return 4;if(t<rr)return 5;if(t<ir)return 6;if(t<sr)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function or(t,e,n=0){switch(At(t)){case 8:e[n++]=t&255|ee,t/=128;case 7:e[n++]=t&255|ee,t/=128;case 6:e[n++]=t&255|ee,t/=128;case 5:e[n++]=t&255|ee,t/=128;case 4:e[n++]=t&255|ee,t>>>=7;case 3:e[n++]=t&255|ee,t>>>=7;case 2:e[n++]=t&255|ee,t>>>=7;case 1:{e[n++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function zu(t,e){let n=t[e],r=0;if(r+=n&pe,n<ee||(n=t[e+1],r+=(n&pe)<<7,n<ee)||(n=t[e+2],r+=(n&pe)<<14,n<ee)||(n=t[e+3],r+=(n&pe)<<21,n<ee)||(n=t[e+4],r+=(n&pe)*nr,n<ee)||(n=t[e+5],r+=(n&pe)*rr,n<ee)||(n=t[e+6],r+=(n&pe)*ir,n<ee)||(n=t[e+7],r+=(n&pe)*sr,n<ee))return r;throw new RangeError("Could not decode varint")}function Ru(t,e){let n=t.get(e),r=0;if(r+=n&pe,n<ee||(n=t.get(e+1),r+=(n&pe)<<7,n<ee)||(n=t.get(e+2),r+=(n&pe)<<14,n<ee)||(n=t.get(e+3),r+=(n&pe)<<21,n<ee)||(n=t.get(e+4),r+=(n&pe)*nr,n<ee)||(n=t.get(e+5),r+=(n&pe)*rr,n<ee)||(n=t.get(e+6),r+=(n&pe)*ir,n<ee)||(n=t.get(e+7),r+=(n&pe)*sr,n<ee))return r;throw new RangeError("Could not decode varint")}function ur(t,e=0){return t instanceof Uint8Array?zu(t,e):Ru(t,e)}var vi=k("node:buffer");function zt(t,e){return yt(vi.Buffer.concat(t,e))}var We=k("node:net");function cr(t){return e=>_e(e,t)}function lr(t){return e=>Ye(e,t)}function Bt(t){return new DataView(t.buffer).getUint16(t.byteOffset).toString()}function nt(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,typeof t=="string"?parseInt(t):t),new Uint8Array(e)}function Pi(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let n=Ye(e[0],"base32"),r=parseInt(e[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");let i=nt(r);return zt([n,i],n.length+i.length)}function Ii(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let n=Ge.decode(`b${e[0]}`),r=parseInt(e[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");let i=nt(r);return zt([n,i],n.length+i.length)}function fr(t){let e=t.subarray(0,t.length-2),n=t.subarray(t.length-2),r=_e(e,"base32"),i=Bt(n);return`${r}:${i}`}var Dr=function(t){t=t.toString().trim();let e=new Uint8Array(4);return t.split(/\./g).forEach((n,r)=>{let i=parseInt(n,10);if(isNaN(i)||i<0||i>255)throw new he("Invalid byte value in IP address");e[r]=i}),e},ji=function(t){let e=0;t=t.toString().trim();let n=t.split(":",8),r;for(r=0;r<n.length;r++){let s=(0,We.isIPv4)(n[r]),o;s&&(o=Dr(n[r]),n[r]=_e(o.subarray(0,2),"base16")),o!=null&&++r<8&&n.splice(r,0,_e(o.subarray(2,4),"base16"))}if(n[0]==="")for(;n.length<8;)n.unshift("0");else if(n[n.length-1]==="")for(;n.length<8;)n.push("0");else if(n.length<8){for(r=0;r<n.length&&n[r]!=="";r++);let s=[r,1];for(r=9-n.length;r>0;r--)s.push("0");n.splice.apply(n,s)}let i=new Uint8Array(e+16);for(r=0;r<n.length;r++){n[r]===""&&(n[r]="0");let s=parseInt(n[r],16);if(isNaN(s)||s<0||s>65535)throw new he("Invalid byte value in IP address");i[e++]=s>>8&255,i[e++]=s&255}return i},Ti=function(t){if(t.byteLength!==4)throw new he("IPv4 address was incorrect length");let e=[];for(let n=0;n<t.byteLength;n++)e.push(t[n]);return e.join(".")},Mi=function(t){if(t.byteLength!==16)throw new he("IPv6 address was incorrect length");let e=[];for(let r=0;r<t.byteLength;r+=2){let i=t[r],s=t[r+1],o=`${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`;e.push(o)}let n=e.join(":");try{let r=new URL(`http://[${n}]`);return r.hostname.substring(1,r.hostname.length-1)}catch{throw new he(`Invalid IPv6 address "${n}"`)}};function Ni(t){try{let e=new URL(`http://[${t}]`);return e.hostname.substring(1,e.hostname.length-1)}catch{throw new he(`Invalid IPv6 address "${t}"`)}}var ar=Object.values(Lt).map(t=>t.decoder),Vu=(function(){let t=ar[0].or(ar[1]);return ar.slice(2).forEach(e=>t=t.or(e)),t})();function $i(t){return Vu.decode(t)}function Li(t){return e=>t.encoder.encode(e)}function Hu(t){if(parseInt(t).toString()!==t)throw new Re("Value must be an integer")}function Gu(t){if(t<0)throw new Re("Value must be a positive integer, or zero")}function qu(t){return e=>{if(e>t)throw new Re(`Value must be smaller than or equal to ${t}`)}}function Yu(...t){return e=>{for(let n of t)n(e)}}var Rt=Yu(Hu,Gu,qu(65535));var fe=-1,hr=class{protocolsByCode=new Map;protocolsByName=new Map;getProtocol(e){let n;if(typeof e=="string"?n=this.protocolsByName.get(e):n=this.protocolsByCode.get(e),n==null)throw new Zt(`Protocol ${e} was unknown`);return n}addProtocol(e){this.protocolsByCode.set(e.code,e),this.protocolsByName.set(e.name,e),e.aliases?.forEach(n=>{this.protocolsByName.set(n,e)})}removeProtocol(e){let n=this.protocolsByCode.get(e);n!=null&&(this.protocolsByCode.delete(n.code),this.protocolsByName.delete(n.name),n.aliases?.forEach(r=>{this.protocolsByName.delete(r)}))}},Ee=new hr,wa=[{code:4,name:"ip4",size:32,valueToBytes:Dr,bytesToValue:Ti,validate:t=>{if(!(0,We.isIPv4)(t))throw new Re(`Invalid IPv4 address "${t}"`)}},{code:6,name:"tcp",size:16,valueToBytes:nt,bytesToValue:Bt,validate:Rt},{code:273,name:"udp",size:16,valueToBytes:nt,bytesToValue:Bt,validate:Rt},{code:33,name:"dccp",size:16,valueToBytes:nt,bytesToValue:Bt,validate:Rt},{code:41,name:"ip6",size:128,valueToBytes:ji,bytesToValue:Mi,stringToValue:Ni,validate:t=>{if(!(0,We.isIPv6)(t))throw new Re(`Invalid IPv6 address "${t}"`)}},{code:42,name:"ip6zone",size:fe},{code:43,name:"ipcidr",size:8,bytesToValue:cr("base10"),valueToBytes:lr("base10")},{code:53,name:"dns",size:fe,resolvable:!0},{code:54,name:"dns4",size:fe,resolvable:!0},{code:55,name:"dns6",size:fe,resolvable:!0},{code:56,name:"dnsaddr",size:fe,resolvable:!0},{code:132,name:"sctp",size:16,valueToBytes:nt,bytesToValue:Bt,validate:Rt},{code:301,name:"udt"},{code:302,name:"utp"},{code:400,name:"unix",size:fe,path:!0,stringToValue:t=>decodeURIComponent(t),valueToString:t=>encodeURIComponent(t)},{code:421,name:"p2p",aliases:["ipfs"],size:fe,bytesToValue:cr("base58btc"),valueToBytes:t=>t.startsWith("Q")||t.startsWith("1")?lr("base58btc")(t):qe.parse(t).multihash.bytes},{code:444,name:"onion",size:96,bytesToValue:fr,valueToBytes:Pi},{code:445,name:"onion3",size:296,bytesToValue:fr,valueToBytes:Ii},{code:446,name:"garlic64",size:fe},{code:447,name:"garlic32",size:fe},{code:448,name:"tls"},{code:449,name:"sni",size:fe},{code:454,name:"noise"},{code:460,name:"quic"},{code:461,name:"quic-v1"},{code:465,name:"webtransport"},{code:466,name:"certhash",size:fe,bytesToValue:Li(Vn),valueToBytes:$i},{code:480,name:"http"},{code:481,name:"http-path",size:fe,stringToValue:t=>`/${decodeURIComponent(t)}`,valueToString:t=>encodeURIComponent(t.substring(1))},{code:443,name:"https"},{code:477,name:"ws"},{code:478,name:"wss"},{code:479,name:"p2p-websocket-star"},{code:277,name:"p2p-stardust"},{code:275,name:"p2p-webrtc-star"},{code:276,name:"p2p-webrtc-direct"},{code:280,name:"webrtc-direct"},{code:281,name:"webrtc"},{code:290,name:"p2p-circuit"},{code:777,name:"memory",size:fe}];wa.forEach(t=>{Ee.addProtocol(t)});function Ui(t){let e=[],n=0;for(;n<t.length;){let r=ur(t,n),i=Ee.getProtocol(r),s=At(r),o=ya(i,t,n+s),a=0;o>0&&i.size===fe&&(a=At(o));let f=s+a+o,p={code:r,name:i.name,bytes:t.subarray(n,n+f)};if(o>0){let m=n+s+a,l=t.subarray(m,m+o);p.value=i.bytesToValue?.(l)??_e(l)}e.push(p),n+=f}return e}function zi(t){let e=0,n=[];for(let r of t){if(r.bytes==null){let i=Ee.getProtocol(r.code),s=At(r.code),o,a=0,f=0;r.value!=null&&(o=i.valueToBytes?.(r.value)??Ye(r.value),a=o.byteLength,i.size===fe&&(f=At(a)));let p=new Uint8Array(s+f+a),m=0;or(r.code,p,m),m+=s,o!=null&&(i.size===fe&&(or(a,p,m),m+=f),p.set(o,m)),r.bytes=p}n.push(r.bytes),e+=r.bytes.byteLength}return zt(n,e)}function Ri(t){if(t.charAt(0)!=="/")throw new he('String multiaddr must start with "/"');let e=[],n="protocol",r="",i="";for(let s=1;s<t.length;s++){let o=t.charAt(s);o!=="/"&&(n==="protocol"?i+=t.charAt(s):r+=t.charAt(s));let a=s===t.length-1;if(o==="/"||a){let f=Ee.getProtocol(i);if(n==="protocol"){if(f.size==null||f.size===0){e.push({code:f.code,name:f.name}),r="",i="",n="protocol";continue}else if(a)throw new he(`Component ${i} was missing value`);n="value"}else if(n==="value"){let p={code:f.code,name:f.name};if(f.size!=null&&f.size!==0){if(r==="")throw new he(`Component ${i} was missing value`);p.value=f.stringToValue?.(r)??r}e.push(p),r="",i="",n="protocol"}}}if(i!==""&&r!=="")throw new he("Incomplete multiaddr");return e}function Wi(t){return`/${t.flatMap(e=>{if(e.value==null)return e.name;let n=Ee.getProtocol(e.code);if(n==null)throw new he(`Unknown protocol code ${e.code}`);return[e.name,n.valueToString?.(e.value)??e.value]}).join("/")}`}function ya(t,e,n){return t.size==null||t.size===0?0:t.size>0?t.size/8:ur(e,n)}var Aa=Symbol.for("nodejs.util.inspect.custom"),br=Symbol.for("@multiformats/multiaddr"),Ba=[53,54,55,56],Er=class extends Error{constructor(e="No available resolver"){super(e),this.name="NoAvailableResolverError"}};function Oa(t){if(t==null&&(t="/"),Hi(t))return t.getComponents();if(t instanceof Uint8Array)return Ui(t);if(typeof t=="string")return t=t.replace(/\/(\/)+/,"/").replace(/(\/)+$/,""),t===""&&(t="/"),Ri(t);if(Array.isArray(t))return t;throw new he("Must be a string, Uint8Array, Component[], or another Multiaddr")}var rn=class t{[br]=!0;#e;#t;#n;constructor(e="/",n={}){this.#e=Oa(e),n.validate!==!1&&_a(this)}get bytes(){return this.#n==null&&(this.#n=zi(this.#e)),this.#n}toString(){return this.#t==null&&(this.#t=Wi(this.#e)),this.#t}toJSON(){return this.toString()}toOptions(){let e,n,r,i,s="";for(let{code:a,name:f,value:p}of this.#e)a===42&&(s=`%${p??""}`),Ba.includes(a)&&(n="tcp",i=443,r=`${p??""}${s}`,e=a===55?6:4),(a===6||a===273)&&(n=f==="tcp"?"tcp":"udp",i=parseInt(p??"")),(a===4||a===41)&&(n="tcp",r=`${p??""}${s}`,e=a===41?6:4);if(e==null||n==null||r==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:r,transport:n,port:i}}getComponents(){return[...this.#e]}protos(){return this.#e.map(({code:e,value:n})=>{let r=Ee.getProtocol(e);return{code:e,size:r.size??0,name:r.name,resolvable:!!r.resolvable,path:!!r.path}})}protoCodes(){return this.#e.map(({code:e})=>e)}protoNames(){return this.#e.map(({name:e})=>e)}tuples(){return this.#e.map(({code:e,value:n})=>{if(n==null)return[e];let r=Ee.getProtocol(e),i=[e];return n!=null&&i.push(r.valueToBytes?.(n)??Ye(n)),i})}stringTuples(){return this.#e.map(({code:e,value:n})=>n==null?[e]:[e,n])}encapsulate(e){let n=new t(e);return new t([...this.#e,...n.getComponents()],{validate:!1})}decapsulate(e){let n=e.toString(),r=this.toString(),i=r.lastIndexOf(n);if(i<0)throw new Ut(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new t(r.slice(0,i),{validate:!1})}decapsulateCode(e){let n;for(let r=this.#e.length-1;r>-1;r--)if(this.#e[r].code===e){n=r;break}return new t(this.#e.slice(0,n),{validate:!1})}getPeerId(){try{let e=[];this.#e.forEach(({code:r,value:i})=>{r===421&&e.push([r,i]),r===290&&(e=[])});let n=e.pop();if(n?.[1]!=null){let r=n[1];return r[0]==="Q"||r[0]==="1"?_e(Oe.decode(`z${r}`),"base58btc"):_e(qe.parse(r).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){for(let e of this.#e)if(Ee.getProtocol(e.code).path)return e.value??null;return null}equals(e){return _i(this.bytes,e.bytes)}async resolve(e){let n=this.protos().find(s=>s.resolvable);if(n==null)return[this];let r=Vi.get(n.name);if(r==null)throw new Er(`no available resolver for ${n.name}`);return(await r(this,e)).map(s=>Vt(s))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(){return!(this.#e.length!==2||this.#e[0].code!==4&&this.#e[0].code!==41||this.#e[1].code!==6&&this.#e[1].code!==273)}[Aa](){return`Multiaddr(${this.toString()})`}};function _a(t){t.getComponents().forEach(e=>{let n=Ee.getProtocol(e.code);e.value!=null&&n.validate?.(e.value)})}var sn=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let n=this.index,r=e();return r===void 0&&(this.index=n),r}parseWith(e){let n=e();if(this.index===this.input.length)return n}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let n=this.readChar();if(n===e)return n})}readSeparator(e,n,r){return this.readAtomically(()=>{if(!(n>0&&this.readGivenChar(e)===void 0))return r()})}readNumber(e,n,r,i){return this.readAtomically(()=>{let s=0,o=0,a=this.peekChar();if(a===void 0)return;let f=a==="0",p=2**(8*i)-1;for(;;){let m=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let F=Number.parseInt(l,e);if(!Number.isNaN(F))return F});if(m===void 0)break;if(s*=e,s+=m,s>p||(o+=1,n!==void 0&&o>n))return}if(o!==0)return!r&&f&&o>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let n=0;n<e.length;n++){let r=this.readSeparator(".",n,()=>this.readNumber(10,3,!1,1));if(r===void 0)return;e[n]=r}return e})}readIPv6Addr(){let e=n=>{for(let r=0;r<n.length/2;r++){let i=r*2;if(r<n.length-3){let o=this.readSeparator(":",r,()=>this.readIPv4Addr());if(o!==void 0)return n[i]=o[0],n[i+1]=o[1],n[i+2]=o[2],n[i+3]=o[3],[i+4,!0]}let s=this.readSeparator(":",r,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[i,!1];n[i]=s>>8,n[i+1]=s&255}return[n.length,!1]};return this.readAtomically(()=>{let n=new Uint8Array(16),[r,i]=e(n);if(r===16)return n;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),o=16-(r+2),[a]=e(s.subarray(0,o));return n.set(s.subarray(0,a),16-a),n})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Ef=new sn;var _f=parseInt("0xFFFF",16),Sf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var Vi=new Map;function Hi(t){return!!t?.[br]}function Vt(t){return new rn(t)}var Yi=k("module"),wr=gt(k("path"),1),xr=gt(k("process"),1),Ki=k("url");function Ta(t){let e=wr.default.extname(t);return e?t.slice(0,-e.length):t}function yr(t){if(!t)return!1;if("main"in t)return!!t.main;if(!xr.default.argv[1])return!1;let n=(0,Yi.createRequire)(t.url).resolve(xr.default.argv[1]),r=(0,Ki.fileURLToPath)(t.url);return wr.default.extname(n)?r===n:Ta(r)===n}var pn=k("assert");var Ma={right:za,center:Ra},Na=0,on=1,$a=2,un=3,Ar=class{constructor(e){var n;this.width=e.width,this.wrap=(n=e.wrap)!==null&&n!==void 0?n:!0,this.rows=[]}span(...e){let n=this.div(...e);n.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);let n=e.map(r=>typeof r=="string"?this.colFromString(r):r);return this.rows.push(n),n}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let n=e.split(`
4
+ `).map(i=>i.split(" ")),r=0;return n.forEach(i=>{i.length>1&&be.stringWidth(i[0])>r&&(r=Math.min(Math.floor(this.width*.5),be.stringWidth(i[0])))}),n.forEach(i=>{this.div(...i.map((s,o)=>({text:s.trim(),padding:this.measurePadding(s),width:o===0&&i.length>1?r:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let n=be.stripAnsi(e);return[0,n.match(/\s*$/)[0].length,0,n.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(n=>{this.rowToString(n,e)}),e.filter(n=>!n.hidden).map(n=>n.text).join(`
5
+ `)}rowToString(e,n){return this.rasterize(e).forEach((r,i)=>{let s="";r.forEach((o,a)=>{let{width:f}=e[a],p=this.negatePadding(e[a]),m=o;if(p>be.stringWidth(o)&&(m+=" ".repeat(p-be.stringWidth(o))),e[a].align&&e[a].align!=="left"&&this.wrap){let F=Ma[e[a].align];m=F(m,p),be.stringWidth(m)<p&&(m+=" ".repeat((f||0)-be.stringWidth(m)-1))}let l=e[a].padding||[0,0,0,0];l[un]&&(s+=" ".repeat(l[un])),s+=ki(e[a],m,"| "),s+=m,s+=ki(e[a],m," |"),l[on]&&(s+=" ".repeat(l[on])),i===0&&n.length>0&&(s=this.renderInline(s,n[n.length-1]))}),n.push({text:s.replace(/ +$/,""),span:e.span})}),n}renderInline(e,n){let r=e.match(/^ */),i=r?r[0].length:0,s=n.text,o=be.stringWidth(s.trimRight());return n.span?this.wrap?i<o?e:(n.hidden=!0,s.trimRight()+" ".repeat(i-o)+e.trimLeft()):(n.hidden=!0,s+e):e}rasterize(e){let n=[],r=this.columnWidths(e),i;return e.forEach((s,o)=>{s.width=r[o],this.wrap?i=be.wrap(s.text,this.negatePadding(s),{hard:!0}).split(`
6
6
  `):i=s.text.split(`
7
- `),s.border&&(i.unshift("."+"-".repeat(this.negatePadding(s)+2)+"."),i.push("'"+"-".repeat(this.negatePadding(s)+2)+"'")),s.padding&&(i.unshift(...new Array(s.padding[fc]||0).fill("")),i.push(...new Array(s.padding[uc]||0).fill(""))),i.forEach((c,h)=>{e[h]||e.push([]);let g=e[h];for(let m=0;m<o;m++)g[m]===void 0&&g.push("");g.push(c)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[sn]||0)+(t.padding[rn]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(o=>o.width||wt.stringWidth(o.text));let e=t.length,n=this.width,i=t.map(o=>{if(o.width)return e--,n-=o.width,o.width}),s=e?Math.floor(n/e):0;return i.map((o,c)=>o===void 0?Math.max(s,hc(t[c])):o)}};function Li(r,t,e){return r.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function hc(r){let t=r.padding||[],e=1+(t[sn]||0)+(t[rn]||0);return r.border?e+4:e}function dc(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function pc(r,t){r=r.trim();let e=wt.stringWidth(r);return e<t?" ".repeat(t-e)+r:r}function mc(r,t){r=r.trim();let e=wt.stringWidth(r);return e>=t?r:" ".repeat(t-e>>1)+r}var wt;function zi(r,t){return wt=t,new yr({width:r?.width||dc(),wrap:r?.wrap})}var Ri=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function xr(r){return r.replace(Ri,"")}function Bi(r,t){let[e,n]=r.match(Ri)||["",""];r=xr(r);let i="";for(let s=0;s<r.length;s++)s!==0&&s%t===0&&(i+=`
8
- `),i+=r.charAt(s);return e&&n&&(i=`${e}${i}${n}`),i}function Cr(r){return zi(r,{stringWidth:t=>[...t].length,stripAnsi:xr,wrap:Bi})}var Ee=V("path"),on=V("fs");function Wi(r,t){let e=(0,Ee.resolve)(".",r),n;for((0,on.statSync)(e).isDirectory()||(e=(0,Ee.dirname)(e));;){if(n=t(e,(0,on.readdirSync)(e)),n)return(0,Ee.resolve)(e,n);if(e=(0,Ee.dirname)(n=e),n===e)break}}var is=V("util"),ss=V("fs"),os=V("url");var Yi=V("util"),fn=V("path");function ee(r){if(r!==r.toLowerCase()&&r!==r.toUpperCase()||(r=r.toLowerCase()),r.indexOf("-")===-1&&r.indexOf("_")===-1)return r;{let e="",n=!1,i=r.match(/^-+/);for(let s=i?i[0].length:0;s<r.length;s++){let o=r.charAt(s);n&&(n=!1,o=o.toUpperCase()),s!==0&&(o==="-"||o==="_")?n=!0:o!=="-"&&o!=="_"&&(e+=o)}return e}}function an(r,t){let e=r.toLowerCase();t=t||"-";let n="";for(let i=0;i<r.length;i++){let s=e.charAt(i),o=r.charAt(i);s!==o&&i>0?n+=`${t}${e.charAt(i)}`:n+=o}return n}function cn(r){return r==null?!1:typeof r=="number"||/^0x[0-9a-f]+$/i.test(r)?!0:/^0[^.]/.test(r)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(r)}function Vi(r){if(Array.isArray(r))return r.map(o=>typeof o!="string"?o+"":o);r=r.trim();let t=0,e=null,n=null,i=null,s=[];for(let o=0;o<r.length;o++){if(e=n,n=r.charAt(o),n===" "&&!i){e!==" "&&t++;continue}n===i?i=null:(n==="'"||n==='"')&&!i&&(i=n),s[t]||(s[t]=""),s[t]+=n}return s}var St;(function(r){r.BOOLEAN="boolean",r.STRING="string",r.NUMBER="number",r.ARRAY="array"})(St||(St={}));var Bt,ln=class{constructor(t){Bt=t}parse(t,e){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},e),i=Vi(t),s=typeof t=="string",o=gc(Object.assign(Object.create(null),n.alias)),c=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),h=Object.assign(Object.create(null),n.default),g=n.configObjects||[],m=n.envPrefix,d=c["populate--"],b=d?"--":"_",y=Object.create(null),C=Object.create(null),x=n.__||Bt.format,p={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},M=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,N=new RegExp("^--"+c["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let u=typeof l=="object"?l.key:l,E=Object.keys(l).map(function(w){return{boolean:"bools",string:"strings",number:"numbers"}[w]}).filter(Boolean).pop();E&&(p[E][u]=!0),p.arrays[u]=!0,p.keys.push(u)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(l){p.bools[l]=!0,p.keys.push(l)}),[].concat(n.string||[]).filter(Boolean).forEach(function(l){p.strings[l]=!0,p.keys.push(l)}),[].concat(n.number||[]).filter(Boolean).forEach(function(l){p.numbers[l]=!0,p.keys.push(l)}),[].concat(n.count||[]).filter(Boolean).forEach(function(l){p.counts[l]=!0,p.keys.push(l)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(l){p.normalize[l]=!0,p.keys.push(l)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([l,u])=>{typeof u=="number"&&(p.nargs[l]=u,p.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,u])=>{typeof u=="function"&&(p.coercions[l]=u,p.keys.push(l))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(l){p.configs[l]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([l,u])=>{(typeof u=="boolean"||typeof u=="function")&&(p.configs[l]=u)})),kt(n.key,o,n.default,p.arrays),Object.keys(h).forEach(function(l){(p.aliases[l]||[]).forEach(function(u){h[u]=h[l]})});let R=null;qe();let U=[],B=Object.assign(Object.create(null),{_:[]}),ft={};for(let l=0;l<i.length;l++){let u=i[l],E=u.replace(/^-{3,}/,"---"),w,f,I,_,j,at;if(u!=="--"&&/^-/.test(u)&&k(u))J(u);else if(E.match(/^---+(=|$)/)){J(u);continue}else if(u.match(/^--.+=/)||!c["short-option-groups"]&&u.match(/^-.+=/))_=u.match(/^--?([^=]+)=([\s\S]*)$/),_!==null&&Array.isArray(_)&&_.length>=3&&($(_[1],p.arrays)?l=Et(l,_[1],i,_[2]):$(_[1],p.nargs)!==!1?l=ht(l,_[1],i,_[2]):G(_[1],_[2],!0));else if(u.match(N)&&c["boolean-negation"])_=u.match(N),_!==null&&Array.isArray(_)&&_.length>=2&&(f=_[1],G(f,$(f,p.arrays)?[!1]:!1));else if(u.match(/^--.+/)||!c["short-option-groups"]&&u.match(/^-[^-]+/))_=u.match(/^--?(.+)/),_!==null&&Array.isArray(_)&&_.length>=2&&(f=_[1],$(f,p.arrays)?l=Et(l,f,i):$(f,p.nargs)!==!1?l=ht(l,f,i):(j=i[l+1],j!==void 0&&(!j.match(/^-/)||j.match(M))&&!$(f,p.bools)&&!$(f,p.counts)||/^(true|false)$/.test(j)?(G(f,j),l++):G(f,tt(f))));else if(u.match(/^-.\..+=/))_=u.match(/^-([^=]+)=([\s\S]*)$/),_!==null&&Array.isArray(_)&&_.length>=3&&G(_[1],_[2]);else if(u.match(/^-.\..+/)&&!u.match(M))j=i[l+1],_=u.match(/^-(.\..+)/),_!==null&&Array.isArray(_)&&_.length>=2&&(f=_[1],j!==void 0&&!j.match(/^-/)&&!$(f,p.bools)&&!$(f,p.counts)?(G(f,j),l++):G(f,tt(f)));else if(u.match(/^-[^-]+/)&&!u.match(M)){I=u.slice(1,-1).split(""),w=!1;for(let pt=0;pt<I.length;pt++){if(j=u.slice(pt+2),I[pt+1]&&I[pt+1]==="="){at=u.slice(pt+3),f=I[pt],$(f,p.arrays)?l=Et(l,f,i,at):$(f,p.nargs)!==!1?l=ht(l,f,i,at):G(f,at),w=!0;break}if(j==="-"){G(I[pt],j);continue}if(/[A-Za-z]/.test(I[pt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(j)&&$(j,p.bools)===!1){G(I[pt],j),w=!0;break}if(I[pt+1]&&I[pt+1].match(/\W/)){G(I[pt],j),w=!0;break}else G(I[pt],tt(I[pt]))}f=u.slice(-1)[0],!w&&f!=="-"&&($(f,p.arrays)?l=Et(l,f,i):$(f,p.nargs)!==!1?l=ht(l,f,i):(j=i[l+1],j!==void 0&&(!/^(-|--)[^-]/.test(j)||j.match(M))&&!$(f,p.bools)&&!$(f,p.counts)||/^(true|false)$/.test(j)?(G(f,j),l++):G(f,tt(f))))}else if(u.match(/^-[0-9]$/)&&u.match(M)&&$(u.slice(1),p.bools))f=u.slice(1),G(f,tt(f));else if(u==="--"){U=i.slice(l+1);break}else if(c["halt-at-non-option"]){U=i.slice(l);break}else J(u)}H(B,!0),H(B,!1),z(B),st(),Z(B,p.aliases,h,!0),ot(B),c["set-placeholder-key"]&&Xt(B),Object.keys(p.counts).forEach(function(l){Ut(B,l.split("."))||G(l,0)}),d&&U.length&&(B[b]=[]),U.forEach(function(l){B[b].push(l)}),c["camel-case-expansion"]&&c["strip-dashed"]&&Object.keys(B).filter(l=>l!=="--"&&l.includes("-")).forEach(l=>{delete B[l]}),c["strip-aliased"]&&[].concat(...Object.keys(o).map(l=>o[l])).forEach(l=>{c["camel-case-expansion"]&&l.includes("-")&&delete B[l.split(".").map(u=>ee(u)).join(".")],delete B[l]});function J(l){let u=P("_",l);(typeof u=="string"||typeof u=="number")&&B._.push(u)}function ht(l,u,E,w){let f,I=$(u,p.nargs);if(I=typeof I!="number"||isNaN(I)?1:I,I===0)return Mt(w)||(R=Error(x("Argument unexpected for: %s",u))),G(u,tt(u)),l;let _=Mt(w)?0:1;if(c["nargs-eats-options"])E.length-(l+1)+_<I&&(R=Error(x("Not enough arguments following: %s",u))),_=I;else{for(f=l+1;f<E.length&&(!E[f].match(/^-[^0-9]/)||E[f].match(M)||k(E[f]));f++)_++;_<I&&(R=Error(x("Not enough arguments following: %s",u)))}let j=Math.min(_,I);for(!Mt(w)&&j>0&&(G(u,w),j--),f=l+1;f<j+l+1;f++)G(u,E[f]);return l+j}function Et(l,u,E,w){let f=[],I=w||E[l+1],_=$(u,p.nargs);if($(u,p.bools)&&!/^(true|false)$/.test(I))f.push(!0);else if(Mt(I)||Mt(w)&&/^-/.test(I)&&!M.test(I)&&!k(I)){if(h[u]!==void 0){let j=h[u];f=Array.isArray(j)?j:[j]}}else{Mt(w)||f.push(O(u,w,!0));for(let j=l+1;j<E.length&&!(!c["greedy-arrays"]&&f.length>0||_&&typeof _=="number"&&f.length>=_||(I=E[j],/^-/.test(I)&&!M.test(I)&&!k(I)));j++)l=j,f.push(O(u,I,s))}return typeof _=="number"&&(_&&f.length<_||isNaN(_)&&f.length===0)&&(R=Error(x("Not enough arguments following: %s",u))),G(u,f),l}function G(l,u,E=s){if(/-/.test(l)&&c["camel-case-expansion"]){let I=l.split(".").map(function(_){return ee(_)}).join(".");v(l,I)}let w=O(l,u,E),f=l.split(".");Lt(B,f,w),p.aliases[l]&&p.aliases[l].forEach(function(I){let _=I.split(".");Lt(B,_,w)}),f.length>1&&c["dot-notation"]&&(p.aliases[f[0]]||[]).forEach(function(I){let _=I.split("."),j=[].concat(f);j.shift(),_=_.concat(j),(p.aliases[l]||[]).includes(_.join("."))||Lt(B,_,w)}),$(l,p.normalize)&&!$(l,p.arrays)&&[l].concat(p.aliases[l]||[]).forEach(function(_){Object.defineProperty(ft,_,{enumerable:!0,get(){return u},set(j){u=typeof j=="string"?Bt.normalize(j):j}})})}function v(l,u){p.aliases[l]&&p.aliases[l].length||(p.aliases[l]=[u],y[u]=!0),p.aliases[u]&&p.aliases[u].length||v(u,l)}function O(l,u,E){E&&(u=bc(u)),($(l,p.bools)||$(l,p.counts))&&typeof u=="string"&&(u=u==="true");let w=Array.isArray(u)?u.map(function(f){return P(l,f)}):P(l,u);return $(l,p.counts)&&(Mt(w)||typeof w=="boolean")&&(w=Er()),$(l,p.normalize)&&$(l,p.arrays)&&(Array.isArray(u)?w=u.map(f=>Bt.normalize(f)):w=Bt.normalize(u)),w}function P(l,u){return!c["parse-positional-numbers"]&&l==="_"||!$(l,p.strings)&&!$(l,p.bools)&&!Array.isArray(u)&&(cn(u)&&c["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${u}`)))||!Mt(u)&&$(l,p.numbers))&&(u=Number(u)),u}function z(l){let u=Object.create(null);Z(u,p.aliases,h),Object.keys(p.configs).forEach(function(E){let w=l[E]||u[E];if(w)try{let f=null,I=Bt.resolve(Bt.cwd(),w),_=p.configs[E];if(typeof _=="function"){try{f=_(I)}catch(j){f=j}if(f instanceof Error){R=f;return}}else f=Bt.require(I);q(f)}catch(f){f.name==="PermissionDenied"?R=f:l[E]&&(R=Error(x("Invalid JSON config file: %s",w)))}})}function q(l,u){Object.keys(l).forEach(function(E){let w=l[E],f=u?u+"."+E:E;typeof w=="object"&&w!==null&&!Array.isArray(w)&&c["dot-notation"]?q(w,f):(!Ut(B,f.split("."))||$(f,p.arrays)&&c["combine-arrays"])&&G(f,w)})}function st(){typeof g<"u"&&g.forEach(function(l){q(l)})}function H(l,u){if(typeof m>"u")return;let E=typeof m=="string"?m:"",w=Bt.env();Object.keys(w).forEach(function(f){if(E===""||f.lastIndexOf(E,0)===0){let I=f.split("__").map(function(_,j){return j===0&&(_=_.substring(E.length)),ee(_)});(u&&p.configs[I.join(".")]||!u)&&!Ut(l,I)&&G(I.join("."),w[f])}})}function ot(l){let u,E=new Set;Object.keys(l).forEach(function(w){if(!E.has(w)&&(u=$(w,p.coercions),typeof u=="function"))try{let f=P(w,u(l[w]));[].concat(p.aliases[w]||[],w).forEach(I=>{E.add(I),l[I]=f})}catch(f){R=f}})}function Xt(l){return p.keys.forEach(u=>{~u.indexOf(".")||typeof l[u]>"u"&&(l[u]=void 0)}),l}function Z(l,u,E,w=!1){Object.keys(E).forEach(function(f){Ut(l,f.split("."))||(Lt(l,f.split("."),E[f]),w&&(C[f]=!0),(u[f]||[]).forEach(function(I){Ut(l,I.split("."))||Lt(l,I.split("."),E[f])}))})}function Ut(l,u){let E=l;c["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(f){E=E[f]||{}});let w=u[u.length-1];return typeof E!="object"?!1:w in E}function Lt(l,u,E){let w=l;c["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(at){at=Hi(at),typeof w=="object"&&w[at]===void 0&&(w[at]={}),typeof w[at]!="object"||Array.isArray(w[at])?(Array.isArray(w[at])?w[at].push({}):w[at]=[w[at],{}],w=w[at][w[at].length-1]):w=w[at]});let f=Hi(u[u.length-1]),I=$(u.join("."),p.arrays),_=Array.isArray(E),j=c["duplicate-arguments-array"];!j&&$(f,p.nargs)&&(j=!0,(!Mt(w[f])&&p.nargs[f]===1||Array.isArray(w[f])&&w[f].length===p.nargs[f])&&(w[f]=void 0)),E===Er()?w[f]=Er(w[f]):Array.isArray(w[f])?j&&I&&_?w[f]=c["flatten-duplicate-arrays"]?w[f].concat(E):(Array.isArray(w[f][0])?w[f]:[w[f]]).concat([E]):!j&&!!I==!!_?w[f]=E:w[f]=w[f].concat([E]):w[f]===void 0&&I?w[f]=_?E:[E]:j&&!(w[f]===void 0||$(f,p.counts)||$(f,p.bools))?w[f]=[w[f],E]:w[f]=E}function kt(...l){l.forEach(function(u){Object.keys(u||{}).forEach(function(E){p.aliases[E]||(p.aliases[E]=[].concat(o[E]||[]),p.aliases[E].concat(E).forEach(function(w){if(/-/.test(w)&&c["camel-case-expansion"]){let f=ee(w);f!==E&&p.aliases[E].indexOf(f)===-1&&(p.aliases[E].push(f),y[f]=!0)}}),p.aliases[E].concat(E).forEach(function(w){if(w.length>1&&/[A-Z]/.test(w)&&c["camel-case-expansion"]){let f=an(w,"-");f!==E&&p.aliases[E].indexOf(f)===-1&&(p.aliases[E].push(f),y[f]=!0)}}),p.aliases[E].forEach(function(w){p.aliases[w]=[E].concat(p.aliases[E].filter(function(f){return w!==f}))}))})})}function $(l,u){let E=[].concat(p.aliases[l]||[],l),w=Object.keys(u),f=E.find(I=>w.includes(I));return f?u[f]:!1}function An(l){let u=Object.keys(p);return[].concat(u.map(w=>p[w])).some(function(w){return Array.isArray(w)?w.includes(l):w[l]})}function T(l,...u){return[].concat(...u).some(function(w){let f=l.match(w);return f&&An(f[1])})}function Q(l){if(l.match(M)||!l.match(/^-[^-]+/))return!1;let u=!0,E,w=l.slice(1).split("");for(let f=0;f<w.length;f++){if(E=l.slice(f+2),!An(w[f])){u=!1;break}if(w[f+1]&&w[f+1]==="="||E==="-"||/[A-Za-z]/.test(w[f])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(E)||w[f+1]&&w[f+1].match(/\W/))break}return u}function k(l){return c["unknown-options-as-args"]&&W(l)}function W(l){return l=l.replace(/^-{3,}/,"--"),l.match(M)||Q(l)?!1:!T(l,/^-+([^=]+?)=[\s\S]*$/,N,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function tt(l){return!$(l,p.bools)&&!$(l,p.counts)&&`${l}`in h?h[l]:rt(jt(l))}function rt(l){return{[St.BOOLEAN]:!0,[St.STRING]:"",[St.NUMBER]:void 0,[St.ARRAY]:[]}[l]}function jt(l){let u=St.BOOLEAN;return $(l,p.strings)?u=St.STRING:$(l,p.numbers)?u=St.NUMBER:$(l,p.bools)?u=St.BOOLEAN:$(l,p.arrays)&&(u=St.ARRAY),u}function Mt(l){return l===void 0}function qe(){Object.keys(p.counts).find(l=>$(l,p.arrays)?(R=Error(x("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):$(l,p.nargs)?(R=Error(x("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},p.aliases),argv:Object.assign(ft,B),configuration:c,defaulted:Object.assign({},C),error:R,newAliases:Object.assign({},y)}}};function gc(r){let t=[],e=Object.create(null),n=!0;for(Object.keys(r).forEach(function(i){t.push([].concat(r[i],i))});n;){n=!1;for(let i=0;i<t.length;i++)for(let s=i+1;s<t.length;s++)if(t[i].filter(function(c){return t[s].indexOf(c)!==-1}).length){t[i]=t[i].concat(t[s]),t.splice(s,1),n=!0;break}}return t.forEach(function(i){i=i.filter(function(o,c,h){return h.indexOf(o)===c});let s=i.pop();s!==void 0&&typeof s=="string"&&(e[s]=i)}),e}function Er(r){return r!==void 0?r+1:1}function Hi(r){return r==="__proto__"?"___proto___":r}function bc(r){return typeof r=="string"&&(r[0]==="'"||r[0]==='"')&&r[r.length-1]===r[0]?r.substring(1,r.length-1):r}var Ki=V("fs");var Or,_r,Ar,qi=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Gi=(_r=(Or=process==null?void 0:process.versions)===null||Or===void 0?void 0:Or.node)!==null&&_r!==void 0?_r:(Ar=process==null?void 0:process.version)===null||Ar===void 0?void 0:Ar.slice(1);if(Gi&&Number(Gi.match(/^([^.]+)/)[1])<qi)throw Error(`yargs parser supports a minimum Node.js version of ${qi}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var wc=process?process.env:{},Qi=new ln({cwd:process.cwd,env:()=>wc,format:Yi.format,normalize:fn.normalize,resolve:fn.resolve,require:r=>{if(typeof V<"u")return V(r);if(r.match(/\.json$/))return JSON.parse((0,Ki.readFileSync)(r,"utf8"));throw Error("only .json config files are supported in ESM")}}),Re=function(t,e){return Qi.parse(t.slice(),e).argv};Re.detailed=function(r,t){return Qi.parse(r.slice(),t)};Re.camelCase=ee;Re.decamelize=an;Re.looksLikeNumber=cn;var Ji=Re;var Nt=V("path");function yc(){return xc()?0:1}function xc(){return Cc()&&!process.defaultApp}function Cc(){return!!process.versions.electron}function Zi(){return process.argv[yc()]}var Y=class r extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,r)}};var Oe=V("fs"),Xi=V("util"),ki=V("path"),ts={fs:{readFileSync:Oe.readFileSync,writeFile:Oe.writeFile},format:Xi.format,resolve:ki.resolve,exists:r=>{try{return(0,Oe.statSync)(r).isFile()}catch{return!1}}};var Tt,Sr=class{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let e=t.shift(),n=function(){};return typeof t[t.length-1]=="function"&&(n=t.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]=e,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Tt.format.apply(Tt.format,[this.cache[this.locale][e]||e].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),i=t.shift(),s=function(){};typeof t[t.length-1]=="function"&&(s=t.pop()),this.cache[this.locale]||this._readLocaleFile();let o=i===1?e:n;this.cache[this.locale][e]&&(o=this.cache[this.locale][e][i===1?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:s})):s();let c=[o];return~o.indexOf("%d")&&c.push(i),Tt.format.apply(Tt.format,c.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let n="";return t.forEach(function(i,s){let o=e[s+1];n+=i,typeof o<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let t=this,e=this.writeQueue[0],n=e.directory,i=e.locale,s=e.cb,o=this._resolveLocaleFile(n,i),c=JSON.stringify(this.cache[i],null,2);Tt.fs.writeFile(o,c,"utf-8",function(h){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),s(h)})}_readLocaleFile(){let t={},e=this._resolveLocaleFile(this.directory,this.locale);try{Tt.fs.readFileSync&&(t=JSON.parse(Tt.fs.readFileSync(e,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+e),n.code==="ENOENT")t={};else throw n}this.cache[this.locale]=t}_resolveLocaleFile(t,e){let n=Tt.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){let i=Tt.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(i)&&(n=i)}return n}_fileExistsSync(t){return Tt.exists(t)}};function es(r,t){Tt=t;let e=new Sr(r);return{__:e.__.bind(e),__n:e.__n.bind(e),setLocale:e.setLocale.bind(e),getLocale:e.getLocale.bind(e),updateLocale:e.updateLocale.bind(e),locale:e.locale}}var Ec=r=>es(r,ts),ns=Ec;var Ac={},Oc="require is not supported by ESM",rs="loading a directory of commands is not supported yet for ESM",Be;try{Be=(0,os.fileURLToPath)(Ac.url)}catch{Be=process.cwd()}var _c=Be.substring(0,Be.lastIndexOf("node_modules")),as={assert:{notStrictEqual:un.notStrictEqual,strictEqual:un.strictEqual},cliui:Cr,findUp:Wi,getEnv:r=>process.env[r],inspect:is.inspect,getCallerFile:()=>{throw new Y(rs)},getProcessArgvBin:Zi,mainFilename:_c||process.cwd(),Parser:Ji,path:{basename:Nt.basename,dirname:Nt.dirname,extname:Nt.extname,relative:Nt.relative,resolve:Nt.resolve},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(r,t)=>process.emitWarning(r,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:ss.readFileSync,require:()=>{throw new Y(Oc)},requireDirectory:()=>{throw new Y(rs)},stringWidth:r=>[...r].length,y18n:ns({directory:(0,Nt.resolve)(Be,"../../../locales"),updateFiles:!1})};function mt(r,t,e,n){e.assert.notStrictEqual(r,t,n)}function Pr(r,t){t.assert.strictEqual(typeof r,"string")}function _e(r){return Object.keys(r)}function K(r){return!!r&&!!r.then&&typeof r.then=="function"}function Gt(r){let e=r.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${r}`);let s={cmd:i.replace(n,""),demanded:[],optional:[]};return e.forEach((o,c)=>{let h=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&c===e.length-1&&(h=!0),/^\[/.test(o)?s.optional.push({cmd:o.replace(n,"").split("|"),variadic:h}):s.demanded.push({cmd:o.replace(n,"").split("|"),variadic:h})}),s}var Sc=["first","second","third","fourth","fifth","sixth"];function A(r,t,e){function n(){return typeof r=="object"?[{demanded:[],optional:[]},r,t]:[Gt(`cmd ${r}`),t,e]}try{let i=0,[s,o,c]=n(),h=[].slice.call(o);for(;h.length&&h[h.length-1]===void 0;)h.pop();let g=c||h.length;if(g<s.demanded.length)throw new Y(`Not enough arguments provided. Expected ${s.demanded.length} but received ${h.length}.`);let m=s.demanded.length+s.optional.length;if(g>m)throw new Y(`Too many arguments provided. Expected max ${m} but received ${g}.`);s.demanded.forEach(d=>{let b=h.shift(),y=cs(b);d.cmd.filter(x=>x===y||x==="*").length===0&&ls(y,d.cmd,i),i+=1}),s.optional.forEach(d=>{if(h.length===0)return;let b=h.shift(),y=cs(b);d.cmd.filter(x=>x===y||x==="*").length===0&&ls(y,d.cmd,i),i+=1})}catch(i){console.warn(i.stack)}}function cs(r){return Array.isArray(r)?"array":r===null?"null":typeof r}function ls(r,t,e){throw new Y(`Invalid ${Sc[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${r}.`)}var hn=class{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,i=!1){if(A("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let s=0;s<t.length;s++){if(typeof t[s]!="function")throw Error("middleware must be a function");let o=t[s];o.applyBeforeValidation=e,o.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){let s=t;s.applyBeforeValidation=e,s.global=n,s.mutates=i,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(i=>{let s=[...n[e]||[],e];return i.option?!s.includes(i.option):!0}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let t=this.frozens.pop();t!==void 0&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}};function fs(r){return r?r.map(t=>(t.applyBeforeValidation=!1,t)):[]}function ne(r,t,e,n){return e.reduce((i,s)=>{if(s.applyBeforeValidation!==n)return i;if(s.mutates){if(s.applied)return i;s.applied=!0}if(K(i))return i.then(o=>Promise.all([o,s(o,t)])).then(([o,c])=>Object.assign(o,c));{let o=s(i,t);return K(o)?o.then(c=>Object.assign(i,c)):Object.assign(i,o)}},r)}function re(r,t,e=n=>{throw n}){try{let n=Pc(r)?r():r;return K(n)?n.then(i=>t(i)):t(n)}catch(n){return e(n)}}function Pc(r){return typeof r=="function"}function Ir(r){if(typeof V>"u")return null;for(let t=0,e=Object.keys(V.cache),n;t<e.length;t++)if(n=V.cache[e[t]],n.exports===r)return n;return null}var Ae=/(^\*)|(^\$0)/,vr=class{constructor(t,e,n,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,i){i=i||{},typeof i.recurse!="boolean"&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);let s=typeof i.visit=="function"?i.visit:o=>o;i.visit=(o,c,h)=>{let g=s(o,c,h);if(g){if(this.requireCache.has(c))return g;this.requireCache.add(c),this.addHandler(g)}return g},this.shim.requireDirectory({require:e,filename:n},t,i)}addHandler(t,e,n,i,s,o){let c=[],h=fs(s);if(i=i||(()=>{}),Array.isArray(t))if(Ic(t))[t,...c]=t;else for(let g of t)this.addHandler(g);else if(Dc(t)){let g=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(g=[].concat(g).concat(t.aliases)),this.addHandler(g,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(us(n)){this.addHandler([t].concat(c),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){let g=Gt(t);c=c.map(b=>Gt(b).cmd);let m=!1,d=[g.cmd].concat(c).filter(b=>Ae.test(b)?(m=!0,!1):!0);d.length===0&&m&&d.push("$0"),m&&(g.cmd=d[0],c=d.slice(1),t=t.replace(Ae,g.cmd)),c.forEach(b=>{this.aliasMap[b]=g.cmd}),e!==!1&&this.usage.command(t,e,m,c,o),this.handlers[g.cmd]={original:t,description:e,handler:i,builder:n||{},middlewares:h,deprecated:o,demanded:g.demanded,optional:g.optional},m&&(this.defaultCommand=this.handlers[g.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,i,s,o){let c=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,h=e.getInternalMethods().getContext(),g=h.commands.slice(),m=!t;t&&(h.commands.push(t),h.fullCommands.push(c.original));let d=this.applyBuilderUpdateUsageAndParse(m,c,e,n.aliases,g,i,s,o);return K(d)?d.then(b=>this.applyMiddlewareAndGetResult(m,c,b.innerArgv,h,s,b.aliases,e)):this.applyMiddlewareAndGetResult(m,c,d.innerArgv,h,s,d.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,i,s,o,c,h){let g=e.builder,m=n;if(dn(g)){n.getInternalMethods().getUsageInstance().freeze();let d=g(n.getInternalMethods().reset(i),h);if(K(d))return d.then(b=>(m=ds(b)?b:n,this.parseAndUpdateUsage(t,e,m,s,o,c)))}else vc(g)&&(n.getInternalMethods().getUsageInstance().freeze(),m=n.getInternalMethods().reset(i),Object.keys(e.builder).forEach(d=>{m.option(d,g[d])}));return this.parseAndUpdateUsage(t,e,m,s,o,c)}parseAndUpdateUsage(t,e,n,i,s,o){t&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);let c=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,s,o);return K(c)?c.then(h=>({aliases:n.parsed.aliases,innerArgv:h})):{aliases:n.parsed.aliases,innerArgv:c}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){let n=Ae.test(e.original)?e.original.replace(Ae,"").trim():e.original,i=t.filter(s=>!Ae.test(s));return i.push(n),`$0 ${i.join(" ")}`}handleValidationAndGetResult(t,e,n,i,s,o,c,h){if(!o.getInternalMethods().getHasOutput()){let g=o.getInternalMethods().runValidation(s,h,o.parsed.error,t);n=re(n,m=>(g(m),m))}if(e.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();let g=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(n,g,!1,!1),n=ne(n,o,c,!1),n=re(n,m=>{let d=e.handler(m);return K(d)?d.then(()=>m):m}),t||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),K(n)&&!o.getInternalMethods().hasParseCallback()&&n.catch(m=>{try{o.getInternalMethods().getUsageInstance().fail(null,m)}catch{}})}return t||(i.commands.pop(),i.fullCommands.pop()),n}applyMiddlewareAndGetResult(t,e,n,i,s,o,c){let h={};if(s)return n;c.getInternalMethods().getHasOutput()||(h=this.populatePositionals(e,n,i,c));let g=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),m=ne(n,c,g,!0);return K(m)?m.then(d=>this.handleValidationAndGetResult(t,e,d,i,o,c,g,h)):this.handleValidationAndGetResult(t,e,m,i,o,c,g,h)}populatePositionals(t,e,n,i){e._=e._.slice(n.commands.length);let s=t.demanded.slice(0),o=t.optional.slice(0),c={};for(this.validation.positionalCount(s.length,e._.length);s.length;){let h=s.shift();this.populatePositional(h,e,c)}for(;o.length;){let h=o.shift();this.populatePositional(h,e,c)}return e._=n.commands.concat(e._.map(h=>""+h)),this.postProcessPositionals(e,c,this.cmdToParseOptions(t.original),i),c}populatePositional(t,e,n){let i=t.cmd[0];t.variadic?n[i]=e._.splice(0).map(String):e._.length&&(n[i]=[String(e._.shift())])}cmdToParseOptions(t){let e={array:[],default:{},alias:{},demand:{}},n=Gt(t);return n.demanded.forEach(i=>{let[s,...o]=i.cmd;i.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=o,e.demand[s]=!0}),n.optional.forEach(i=>{let[s,...o]=i.cmd;i.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=o}),e}postProcessPositionals(t,e,n,i){let s=Object.assign({},i.getOptions());s.default=Object.assign(n.default,s.default);for(let g of Object.keys(n.alias))s.alias[g]=(s.alias[g]||[]).concat(n.alias[g]);s.array=s.array.concat(n.array),s.config={};let o=[];if(Object.keys(e).forEach(g=>{e[g].map(m=>{s.configuration["unknown-options-as-args"]&&(s.key[g]=!0),o.push(`--${g}`),o.push(m)})}),!o.length)return;let c=Object.assign({},s.configuration,{"populate--":!1}),h=this.shim.Parser.detailed(o,Object.assign({},s,{configuration:c}));if(h.error)i.getInternalMethods().getUsageInstance().fail(h.error.message,h.error);else{let g=Object.keys(e);Object.keys(e).forEach(m=>{g.push(...h.aliases[m])}),Object.keys(h.argv).forEach(m=>{g.includes(m)&&(e[m]||(e[m]=h.argv[m]),!this.isInConfigs(i,m)&&!this.isDefaulted(i,m)&&Object.prototype.hasOwnProperty.call(t,m)&&Object.prototype.hasOwnProperty.call(h.argv,m)&&(Array.isArray(t[m])||Array.isArray(h.argv[m]))?t[m]=[].concat(t[m],h.argv[m]):t[m]=h.argv[m])})}}isDefaulted(t,e){let{default:n}=t.getOptions();return Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(e))}isInConfigs(t,e){let{configObjects:n}=t.getOptions();return n.some(i=>Object.prototype.hasOwnProperty.call(i,e))||n.some(i=>Object.prototype.hasOwnProperty.call(i,this.shim.Parser.camelCase(e)))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let n=Ae.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let e=this.defaultCommand.builder;if(dn(e))return e(t,!0);us(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){let e=Ir(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:n}){for(let i of[t,e,n]){if(typeof i=="string"||i===!1)return i;mt(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let t=this.frozens.pop();mt(t,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function hs(r,t,e,n){return new vr(r,t,e,n)}function us(r){return typeof r=="object"&&!!r.builder&&typeof r.handler=="function"}function Ic(r){return r.every(t=>typeof t=="string")}function dn(r){return typeof r=="function"}function vc(r){return typeof r=="object"}function Dc(r){return typeof r=="object"&&!Array.isArray(r)}function Yt(r={},t=()=>!0){let e={};return _e(r).forEach(n=>{t(n,r[n])&&(e[n]=r[n])}),e}function Kt(r){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{let e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(r)})}function jc(r){return typeof r=="boolean"}function ms(r,t){let e=t.y18n.__,n={},i=[];n.failFn=function(O){i.push(O)};let s=null,o=null,c=!0;n.showHelpOnFail=function(O=!0,P){let[z,q]=typeof O=="string"?[!0,O]:[O,P];return r.getInternalMethods().isGlobalContext()&&(o=q),s=q,c=z,n};let h=!1;n.fail=function(O,P){let z=r.getInternalMethods().getLoggerInstance();if(i.length)for(let q=i.length-1;q>=0;--q){let st=i[q];if(jc(st)){if(P)throw P;if(O)throw Error(O)}else st(O,P,n)}else{if(r.getExitProcess()&&Kt(!0),!h){h=!0,c&&(r.showHelp("error"),z.error()),(O||P)&&z.error(O||P);let q=s||o;q&&((O||P)&&z.error(""),z.error(q))}if(P=P||new Y(O),r.getExitProcess())return r.exit(1);if(r.getInternalMethods().hasParseCallback())return r.exit(1,P);throw P}};let g=[],m=!1;n.usage=(v,O)=>v===null?(m=!0,g=[],n):(m=!1,g.push([v,O||""]),n),n.getUsage=()=>g,n.getUsageDisabled=()=>m,n.getPositionalGroupName=()=>e("Positionals:");let d=[];n.example=(v,O)=>{d.push([v,O||""])};let b=[];n.command=function(O,P,z,q,st=!1){z&&(b=b.map(H=>(H[2]=!1,H))),b.push([O,P||"",z,q,st])},n.getCommands=()=>b;let y={};n.describe=function(O,P){Array.isArray(O)?O.forEach(z=>{n.describe(z,P)}):typeof O=="object"?Object.keys(O).forEach(z=>{n.describe(z,O[z])}):y[O]=P},n.getDescriptions=()=>y;let C=[];n.epilog=v=>{C.push(v)};let x=!1,p;n.wrap=v=>{x=!0,p=v},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(x||(p=ht(),x=!0),p);let M="__yargsString__:";n.deferY18nLookup=v=>M+v,n.help=function(){if(U)return U;R();let O=r.customScriptName?r.$0:t.path.basename(r.$0),P=r.getDemandedOptions(),z=r.getDemandedCommands(),q=r.getDeprecatedOptions(),st=r.getGroups(),H=r.getOptions(),ot=[];ot=ot.concat(Object.keys(y)),ot=ot.concat(Object.keys(P)),ot=ot.concat(Object.keys(z)),ot=ot.concat(Object.keys(H.default)),ot=ot.filter(ft),ot=Object.keys(ot.reduce((T,Q)=>(Q!=="_"&&(T[Q]=!0),T),{}));let Xt=n.getWrap(),Z=t.cliui({width:Xt,wrap:!!Xt});if(!m){if(g.length)g.forEach(T=>{Z.div({text:`${T[0].replace(/\$0/g,O)}`}),T[1]&&Z.div({text:`${T[1]}`,padding:[1,0,0,0]})}),Z.div();else if(b.length){let T=null;z._?T=`${O} <${e("command")}>
9
- `:T=`${O} [${e("command")}]
10
- `,Z.div(`${T}`)}}if(b.length>1||b.length===1&&!b[0][2]){Z.div(e("Commands:"));let T=r.getInternalMethods().getContext(),Q=T.commands.length?`${T.commands.join(" ")} `:"";r.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(b=b.sort((W,tt)=>W[0].localeCompare(tt[0])));let k=O?`${O} `:"";b.forEach(W=>{let tt=`${k}${Q}${W[0].replace(/^\$0 ?/,"")}`;Z.span({text:tt,padding:[0,2,0,2],width:N(b,Xt,`${O}${Q}`)+4},{text:W[1]});let rt=[];W[2]&&rt.push(`[${e("default")}]`),W[3]&&W[3].length&&rt.push(`[${e("aliases:")} ${W[3].join(", ")}]`),W[4]&&(typeof W[4]=="string"?rt.push(`[${e("deprecated: %s",W[4])}]`):rt.push(`[${e("deprecated")}]`)),rt.length?Z.div({text:rt.join(" "),padding:[0,0,0,2],align:"right"}):Z.div()}),Z.div()}let Ut=(Object.keys(H.alias)||[]).concat(Object.keys(r.parsed.newAliases)||[]);ot=ot.filter(T=>!r.parsed.newAliases[T]&&Ut.every(Q=>(H.alias[Q]||[]).indexOf(T)===-1));let Lt=e("Options:");st[Lt]||(st[Lt]=[]),B(ot,H.alias,st,Lt);let kt=T=>/^--/.test(pn(T)),$=Object.keys(st).filter(T=>st[T].length>0).map(T=>{let Q=st[T].filter(ft).map(k=>{if(Ut.includes(k))return k;for(let W=0,tt;(tt=Ut[W])!==void 0;W++)if((H.alias[tt]||[]).includes(k))return tt;return k});return{groupName:T,normalizedKeys:Q}}).filter(({normalizedKeys:T})=>T.length>0).map(({groupName:T,normalizedKeys:Q})=>{let k=Q.reduce((W,tt)=>(W[tt]=[tt].concat(H.alias[tt]||[]).map(rt=>T===n.getPositionalGroupName()?rt:(/^[0-9]$/.test(rt)?H.boolean.includes(tt)?"-":"--":rt.length>1?"--":"-")+rt).sort((rt,jt)=>kt(rt)===kt(jt)?0:kt(rt)?1:-1).join(", "),W),{});return{groupName:T,normalizedKeys:Q,switches:k}});if($.filter(({groupName:T})=>T!==n.getPositionalGroupName()).some(({normalizedKeys:T,switches:Q})=>!T.every(k=>kt(Q[k])))&&$.filter(({groupName:T})=>T!==n.getPositionalGroupName()).forEach(({normalizedKeys:T,switches:Q})=>{T.forEach(k=>{kt(Q[k])&&(Q[k]=Mc(Q[k],4))})}),$.forEach(({groupName:T,normalizedKeys:Q,switches:k})=>{Z.div(T),Q.forEach(W=>{let tt=k[W],rt=y[W]||"",jt=null;rt.includes(M)&&(rt=e(rt.substring(M.length))),H.boolean.includes(W)&&(jt=`[${e("boolean")}]`),H.count.includes(W)&&(jt=`[${e("count")}]`),H.string.includes(W)&&(jt=`[${e("string")}]`),H.normalize.includes(W)&&(jt=`[${e("string")}]`),H.array.includes(W)&&(jt=`[${e("array")}]`),H.number.includes(W)&&(jt=`[${e("number")}]`);let Mt=u=>typeof u=="string"?`[${e("deprecated: %s",u)}]`:`[${e("deprecated")}]`,qe=[W in q?Mt(q[W]):null,jt,W in P?`[${e("required")}]`:null,H.choices&&H.choices[W]?`[${e("choices:")} ${n.stringifiedValues(H.choices[W])}]`:null,J(H.default[W],H.defaultDescription[W])].filter(Boolean).join(" ");Z.span({text:pn(tt),padding:[0,2,0,2+ps(tt)],width:N(k,Xt)+4},rt);let l=r.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;qe&&!l?Z.div({text:qe,padding:[0,0,0,2],align:"right"}):Z.div()}),Z.div()}),d.length&&(Z.div(e("Examples:")),d.forEach(T=>{T[0]=T[0].replace(/\$0/g,O)}),d.forEach(T=>{T[1]===""?Z.div({text:T[0],padding:[0,2,0,2]}):Z.div({text:T[0],padding:[0,2,0,2],width:N(d,Xt)+4},{text:T[1]})}),Z.div()),C.length>0){let T=C.map(Q=>Q.replace(/\$0/g,O)).join(`
11
- `);Z.div(`${T}
12
- `)}return Z.toString().replace(/\s*$/,"")};function N(v,O,P){let z=0;return Array.isArray(v)||(v=Object.values(v).map(q=>[q])),v.forEach(q=>{z=Math.max(t.stringWidth(P?`${P} ${pn(q[0])}`:pn(q[0]))+ps(q[0]),z)}),O&&(z=Math.min(z,parseInt((O*.5).toString(),10))),z}function R(){let v=r.getDemandedOptions(),O=r.getOptions();(Object.keys(O.alias)||[]).forEach(P=>{O.alias[P].forEach(z=>{y[z]&&n.describe(P,y[z]),z in v&&r.demandOption(P,v[z]),O.boolean.includes(z)&&r.boolean(P),O.count.includes(z)&&r.count(P),O.string.includes(z)&&r.string(P),O.normalize.includes(z)&&r.normalize(P),O.array.includes(z)&&r.array(P),O.number.includes(z)&&r.number(P)})})}let U;n.cacheHelpMessage=function(){U=this.help()},n.clearCachedHelpMessage=function(){U=void 0},n.hasCachedHelpMessage=function(){return!!U};function B(v,O,P,z){let q=[],st=null;return Object.keys(P).forEach(H=>{q=q.concat(P[H])}),v.forEach(H=>{st=[H].concat(O[H]),st.some(ot=>q.indexOf(ot)!==-1)||P[z].push(H)}),q}function ft(v){return r.getOptions().hiddenOptions.indexOf(v)<0||r.parsed.argv[r.getOptions().showHiddenOpt]}n.showHelp=v=>{let O=r.getInternalMethods().getLoggerInstance();v||(v="error"),(typeof v=="function"?v:O[v])(n.help())},n.functionDescription=v=>["(",v.name?t.Parser.decamelize(v.name,"-"):e("generated-value"),")"].join(""),n.stringifiedValues=function(O,P){let z="",q=P||", ",st=[].concat(O);return!O||!st.length||st.forEach(H=>{z.length&&(z+=q),z+=JSON.stringify(H)}),z};function J(v,O){let P=`[${e("default:")} `;if(v===void 0&&!O)return null;if(O)P+=O;else switch(typeof v){case"string":P+=`"${v}"`;break;case"object":P+=JSON.stringify(v);break;default:P+=v}return`${P}]`}function ht(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let Et=null;n.version=v=>{Et=v},n.showVersion=v=>{let O=r.getInternalMethods().getLoggerInstance();v||(v="error"),(typeof v=="function"?v:O[v])(Et)},n.reset=function(O){return s=null,h=!1,g=[],m=!1,C=[],d=[],b=[],y=Yt(y,P=>!O[P]),n};let G=[];return n.freeze=function(){G.push({failMessage:s,failureOutput:h,usages:g,usageDisabled:m,epilogs:C,examples:d,commands:b,descriptions:y})},n.unfreeze=function(O=!1){let P=G.pop();P&&(O?(y={...P.descriptions,...y},b=[...P.commands,...b],g=[...P.usages,...g],d=[...P.examples,...d],C=[...P.epilogs,...C]):{failMessage:s,failureOutput:h,usages:g,usageDisabled:m,epilogs:C,examples:d,commands:b,descriptions:y}=P)},n}function Dr(r){return typeof r=="object"}function Mc(r,t){return Dr(r)?{text:r.text,indentation:r.indentation+t}:{text:r,indentation:t}}function ps(r){return Dr(r)?r.indentation:0}function pn(r){return Dr(r)?r.text:r}var gs=`###-begin-{{app_name}}-completions-###
7
+ `),s.border&&(i.unshift("."+"-".repeat(this.negatePadding(s)+2)+"."),i.push("'"+"-".repeat(this.negatePadding(s)+2)+"'")),s.padding&&(i.unshift(...new Array(s.padding[Na]||0).fill("")),i.push(...new Array(s.padding[$a]||0).fill(""))),i.forEach((a,f)=>{n[f]||n.push([]);let p=n[f];for(let m=0;m<o;m++)p[m]===void 0&&p.push("");p.push(a)})}),n}negatePadding(e){let n=e.width||0;return e.padding&&(n-=(e.padding[un]||0)+(e.padding[on]||0)),e.border&&(n-=4),n}columnWidths(e){if(!this.wrap)return e.map(o=>o.width||be.stringWidth(o.text));let n=e.length,r=this.width,i=e.map(o=>{if(o.width)return n--,r-=o.width,o.width}),s=n?Math.floor(r/n):0;return i.map((o,a)=>o===void 0?Math.max(s,La(e[a])):o)}};function ki(t,e,n){return t.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?n:" ":""}function La(t){let e=t.padding||[],n=1+(e[un]||0)+(e[on]||0);return t.border?n+4:n}function Ua(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function za(t,e){t=t.trim();let n=be.stringWidth(t);return n<e?" ".repeat(e-n)+t:t}function Ra(t,e){t=t.trim();let n=be.stringWidth(t);return n>=e?t:" ".repeat(e-n>>1)+t}var be;function Ji(t,e){return be=e,new Ar({width:t?.width||Ua(),wrap:t?.wrap})}function Br({onlyFirst:t=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,t?void 0:"g")}var Wa=Br();function rt(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Wa,"")}function Qi(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function Zi(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function Xi(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t===94192||t===94193||t>=94208&&t<=100343||t>=100352&&t<=101589||t>=101631&&t<=101640||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128727||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129673||t>=129679&&t<=129734||t>=129742&&t<=129756||t>=129759&&t<=129769||t>=129776&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}function Va(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function es(t,{ambiguousAsWide:e=!1}={}){return Va(t),Zi(t)||Xi(t)||e&&Qi(t)?2:1}var rs=gt(ns(),1),Ha=new Intl.Segmenter,Ga=/^\p{Default_Ignorable_Code_Point}$/u;function Me(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=e;if(r||(t=rt(t)),t.length===0)return 0;let i=0,s={ambiguousAsWide:!n};for(let{segment:o}of Ha.segment(t)){let a=o.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!Ga.test(o)){if((0,rs.default)().test(o)){i+=2;continue}i+=es(a,s)}}return i}var is=(t=0)=>e=>`\x1B[${e+t}m`,ss=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,os=(t=0)=>(e,n,r)=>`\x1B[${38+t};2;${e};${n};${r}m`,Z={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},SD=Object.keys(Z.modifier),qa=Object.keys(Z.color),Ya=Object.keys(Z.bgColor),vD=[...qa,...Ya];function Ka(){let t=new Map;for(let[e,n]of Object.entries(Z)){for(let[r,i]of Object.entries(n))Z[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[r]=Z[r],t.set(i[0],i[1]);Object.defineProperty(Z,e,{value:n,enumerable:!1})}return Object.defineProperty(Z,"codes",{value:t,enumerable:!1}),Z.color.close="\x1B[39m",Z.bgColor.close="\x1B[49m",Z.color.ansi=is(),Z.color.ansi256=ss(),Z.color.ansi16m=os(),Z.bgColor.ansi=is(10),Z.bgColor.ansi256=ss(10),Z.bgColor.ansi16m=os(10),Object.defineProperties(Z,{rgbToAnsi256:{value:(e,n,r)=>e===n&&n===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:e=>{let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!n)return[0,0,0];let[r]=n;r.length===3&&(r=[...r].map(s=>s+s).join(""));let i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>Z.rgbToAnsi256(...Z.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let n,r,i;if(e>=232)n=((e-232)*10+8)/255,r=n,i=n;else{e-=16;let a=e%36;n=Math.floor(e/36)/5,r=Math.floor(a/6)/5,i=a%6/5}let s=Math.max(n,r,i)*2;if(s===0)return 30;let o=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(n));return s===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,n,r)=>Z.ansi256ToAnsi(Z.rgbToAnsi256(e,n,r)),enumerable:!1},hexToAnsi:{value:e=>Z.ansi256ToAnsi(Z.hexToAnsi256(e)),enumerable:!1}}),Z}var ka=Ka(),us=ka;var cn=new Set(["\x1B","\x9B"]),Ja=39,_r="\x07",ls="[",Qa="]",fs="m",an=`${Qa}8;;`,as=t=>`${cn.values().next().value}${ls}${t}${fs}`,cs=t=>`${cn.values().next().value}${an}${t}${_r}`,Za=t=>t.split(" ").map(e=>Me(e)),Or=(t,e,n)=>{let r=[...e],i=!1,s=!1,o=Me(rt(t.at(-1)));for(let[a,f]of r.entries()){let p=Me(f);if(o+p<=n?t[t.length-1]+=f:(t.push(f),o=0),cn.has(f)&&(i=!0,s=r.slice(a+1,a+1+an.length).join("")===an),i){s?f===_r&&(i=!1,s=!1):f===fs&&(i=!1);continue}o+=p,o===n&&a<r.length-1&&(t.push(""),o=0)}!o&&t.at(-1).length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Xa=t=>{let e=t.split(" "),n=e.length;for(;n>0&&!(Me(e[n-1])>0);)n--;return n===e.length?t:e.slice(0,n).join(" ")+e.slice(n).join("")},ec=(t,e,n={})=>{if(n.trim!==!1&&t.trim()==="")return"";let r="",i,s,o=Za(t),a=[""];for(let[l,F]of t.split(" ").entries()){n.trim!==!1&&(a[a.length-1]=a.at(-1).trimStart());let E=Me(a.at(-1));if(l!==0&&(E>=e&&(n.wordWrap===!1||n.trim===!1)&&(a.push(""),E=0),(E>0||n.trim===!1)&&(a[a.length-1]+=" ",E++)),n.hard&&o[l]>e){let C=e-E,b=1+Math.floor((o[l]-C-1)/e);Math.floor((o[l]-1)/e)<b&&a.push(""),Or(a,F,e);continue}if(E+o[l]>e&&E>0&&o[l]>0){if(n.wordWrap===!1&&E<e){Or(a,F,e);continue}a.push("")}if(E+o[l]>e&&n.wordWrap===!1){Or(a,F,e);continue}a[a.length-1]+=F}n.trim!==!1&&(a=a.map(l=>Xa(l)));let f=a.join(`
8
+ `),p=[...f],m=0;for(let[l,F]of p.entries()){if(r+=F,cn.has(F)){let{groups:C}=new RegExp(`(?:\\${ls}(?<code>\\d+)m|\\${an}(?<uri>.*)${_r})`).exec(f.slice(m))||{groups:{}};if(C.code!==void 0){let b=Number.parseFloat(C.code);i=b===Ja?void 0:b}else C.uri!==void 0&&(s=C.uri.length===0?void 0:C.uri)}let E=us.codes.get(Number(i));p[l+1]===`
9
+ `?(s&&(r+=cs("")),i&&E&&(r+=as(E))):F===`
10
+ `&&(i&&E&&(r+=as(i)),s&&(r+=cs(s))),m+=F.length}return r};function Sr(t,e,n){return String(t).normalize().replaceAll(`\r
11
+ `,`
12
+ `).split(`
13
+ `).map(r=>ec(r,e,n)).join(`
14
+ `)}function vr(t){return Ji(t,{stringWidth:Me,stripAnsi:rt,wrap:Sr})}var Ot=k("path"),ln=k("fs");function Ds(t,e){let n=(0,Ot.resolve)(".",t),r;for((0,ln.statSync)(n).isDirectory()||(n=(0,Ot.dirname)(n));;){if(r=e(n,(0,ln.readdirSync)(n)),r)return(0,Ot.resolve)(n,r);if(n=(0,Ot.dirname)(r=n),r===n)break}}var vs=k("util"),Lr=k("url");var gs=k("util"),dn=k("path");function it(t){if(t!==t.toLowerCase()&&t!==t.toUpperCase()||(t=t.toLowerCase()),t.indexOf("-")===-1&&t.indexOf("_")===-1)return t;{let n="",r=!1,i=t.match(/^-+/);for(let s=i?i[0].length:0;s<t.length;s++){let o=t.charAt(s);r&&(r=!1,o=o.toUpperCase()),s!==0&&(o==="-"||o==="_")?r=!0:o!=="-"&&o!=="_"&&(n+=o)}return n}}function fn(t,e){let n=t.toLowerCase();e=e||"-";let r="";for(let i=0;i<t.length;i++){let s=n.charAt(i),o=t.charAt(i);s!==o&&i>0?r+=`${e}${n.charAt(i)}`:r+=o}return r}function Dn(t){return t==null?!1:typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^0[^.]/.test(t)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function hs(t){if(Array.isArray(t))return t.map(o=>typeof o!="string"?o+"":o);t=t.trim();let e=0,n=null,r=null,i=null,s=[];for(let o=0;o<t.length;o++){if(n=r,r=t.charAt(o),r===" "&&!i){n!==" "&&e++;continue}r===i?i=null:(r==="'"||r==='"')&&!i&&(i=r),s[e]||(s[e]=""),s[e]+=r}return s}var Se;(function(t){t.BOOLEAN="boolean",t.STRING="string",t.NUMBER="number",t.ARRAY="array"})(Se||(Se={}));var Ve,hn=class{constructor(e){Ve=e}parse(e,n){let r=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},n),i=hs(e),s=typeof e=="string",o=tc(Object.assign(Object.create(null),r.alias)),a=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},r.configuration),f=Object.assign(Object.create(null),r.default),p=r.configObjects||[],m=r.envPrefix,l=a["populate--"],F=l?"--":"_",E=Object.create(null),C=Object.create(null),b=r.__||Ve.format,d={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},I=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,z=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(r.array||[]).filter(Boolean).forEach(function(c){let h=typeof c=="object"?c.key:c,x=Object.keys(c).map(function(g){return{boolean:"bools",string:"strings",number:"numbers"}[g]}).filter(Boolean).pop();x&&(d[x][h]=!0),d.arrays[h]=!0,d.keys.push(h)}),[].concat(r.boolean||[]).filter(Boolean).forEach(function(c){d.bools[c]=!0,d.keys.push(c)}),[].concat(r.string||[]).filter(Boolean).forEach(function(c){d.strings[c]=!0,d.keys.push(c)}),[].concat(r.number||[]).filter(Boolean).forEach(function(c){d.numbers[c]=!0,d.keys.push(c)}),[].concat(r.count||[]).filter(Boolean).forEach(function(c){d.counts[c]=!0,d.keys.push(c)}),[].concat(r.normalize||[]).filter(Boolean).forEach(function(c){d.normalize[c]=!0,d.keys.push(c)}),typeof r.narg=="object"&&Object.entries(r.narg).forEach(([c,h])=>{typeof h=="number"&&(d.nargs[c]=h,d.keys.push(c))}),typeof r.coerce=="object"&&Object.entries(r.coerce).forEach(([c,h])=>{typeof h=="function"&&(d.coercions[c]=h,d.keys.push(c))}),typeof r.config<"u"&&(Array.isArray(r.config)||typeof r.config=="string"?[].concat(r.config).filter(Boolean).forEach(function(c){d.configs[c]=!0}):typeof r.config=="object"&&Object.entries(r.config).forEach(([c,h])=>{(typeof h=="boolean"||typeof h=="function")&&(d.configs[c]=h)})),tt(r.key,o,r.default,d.arrays),Object.keys(f).forEach(function(c){(d.aliases[c]||[]).forEach(function(h){f[h]=f[c]})});let L=null;Kt();let U=[],R=Object.assign(Object.create(null),{_:[]}),W={};for(let c=0;c<i.length;c++){let h=i[c],x=h.replace(/^-{3,}/,"---"),g,D,_,y,P,le;if(h!=="--"&&/^-/.test(h)&&te(h))H(h);else if(x.match(/^---+(=|$)/)){H(h);continue}else if(h.match(/^--.+=/)||!a["short-option-groups"]&&h.match(/^-.+=/))y=h.match(/^--?([^=]+)=([\s\S]*)$/),y!==null&&Array.isArray(y)&&y.length>=3&&(M(y[1],d.arrays)?c=de(c,y[1],i,y[2]):M(y[1],d.nargs)!==!1?c=K(c,y[1],i,y[2]):Y(y[1],y[2],!0));else if(h.match(z)&&a["boolean-negation"])y=h.match(z),y!==null&&Array.isArray(y)&&y.length>=2&&(D=y[1],Y(D,M(D,d.arrays)?[!1]:!1));else if(h.match(/^--.+/)||!a["short-option-groups"]&&h.match(/^-[^-]+/))y=h.match(/^--?(.+)/),y!==null&&Array.isArray(y)&&y.length>=2&&(D=y[1],M(D,d.arrays)?c=de(c,D,i):M(D,d.nargs)!==!1?c=K(c,D,i):(P=i[c+1],P!==void 0&&(!P.match(/^-/)||P.match(I))&&!M(D,d.bools)&&!M(D,d.counts)||/^(true|false)$/.test(P)?(Y(D,P),c++):Y(D,ne(D))));else if(h.match(/^-.\..+=/))y=h.match(/^-([^=]+)=([\s\S]*)$/),y!==null&&Array.isArray(y)&&y.length>=3&&Y(y[1],y[2]);else if(h.match(/^-.\..+/)&&!h.match(I))P=i[c+1],y=h.match(/^-(.\..+)/),y!==null&&Array.isArray(y)&&y.length>=2&&(D=y[1],P!==void 0&&!P.match(/^-/)&&!M(D,d.bools)&&!M(D,d.counts)?(Y(D,P),c++):Y(D,ne(D)));else if(h.match(/^-[^-]+/)&&!h.match(I)){_=h.slice(1,-1).split(""),g=!1;for(let me=0;me<_.length;me++){if(P=h.slice(me+2),_[me+1]&&_[me+1]==="="){le=h.slice(me+3),D=_[me],M(D,d.arrays)?c=de(c,D,i,le):M(D,d.nargs)!==!1?c=K(c,D,i,le):Y(D,le),g=!0;break}if(P==="-"){Y(_[me],P);continue}if(/[A-Za-z]/.test(_[me])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(P)&&M(P,d.bools)===!1){Y(_[me],P),g=!0;break}if(_[me+1]&&_[me+1].match(/\W/)){Y(_[me],P),g=!0;break}else Y(_[me],ne(_[me]))}D=h.slice(-1)[0],!g&&D!=="-"&&(M(D,d.arrays)?c=de(c,D,i):M(D,d.nargs)!==!1?c=K(c,D,i):(P=i[c+1],P!==void 0&&(!/^(-|--)[^-]/.test(P)||P.match(I))&&!M(D,d.bools)&&!M(D,d.counts)||/^(true|false)$/.test(P)?(Y(D,P),c++):Y(D,ne(D))))}else if(h.match(/^-[0-9]$/)&&h.match(I)&&M(h.slice(1),d.bools))D=h.slice(1),Y(D,ne(D));else if(h==="--"){U=i.slice(c+1);break}else if(a["halt-at-non-option"]){U=i.slice(c);break}else H(h)}G(R,!0),G(R,!1),$(R),ae(),X(R,d.aliases,f,!0),ce(R),a["set-placeholder-key"]&&et(R),Object.keys(d.counts).forEach(function(c){Ue(R,c.split("."))||Y(c,0)}),l&&U.length&&(R[F]=[]),U.forEach(function(c){R[F].push(c)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(R).filter(c=>c!=="--"&&c.includes("-")).forEach(c=>{delete R[c]}),a["strip-aliased"]&&[].concat(...Object.keys(o).map(c=>o[c])).forEach(c=>{a["camel-case-expansion"]&&c.includes("-")&&delete R[c.split(".").map(h=>it(h)).join(".")],delete R[c]});function H(c){let h=O("_",c);(typeof h=="string"||typeof h=="number")&&R._.push(h)}function K(c,h,x,g){let D,_=M(h,d.nargs);if(_=typeof _!="number"||isNaN(_)?1:_,_===0)return Te(g)||(L=Error(b("Argument unexpected for: %s",h))),Y(h,ne(h)),c;let y=Te(g)?0:1;if(a["nargs-eats-options"])x.length-(c+1)+y<_&&(L=Error(b("Not enough arguments following: %s",h))),y=_;else{for(D=c+1;D<x.length&&(!x[D].match(/^-[^0-9]/)||x[D].match(I)||te(x[D]));D++)y++;y<_&&(L=Error(b("Not enough arguments following: %s",h)))}let P=Math.min(y,_);for(!Te(g)&&P>0&&(Y(h,g),P--),D=c+1;D<P+c+1;D++)Y(h,x[D]);return c+P}function de(c,h,x,g){let D=[],_=g||x[c+1],y=M(h,d.nargs);if(M(h,d.bools)&&!/^(true|false)$/.test(_))D.push(!0);else if(Te(_)||Te(g)&&/^-/.test(_)&&!I.test(_)&&!te(_)){if(f[h]!==void 0){let P=f[h];D=Array.isArray(P)?P:[P]}}else{Te(g)||D.push(w(h,g,!0));for(let P=c+1;P<x.length&&!(!a["greedy-arrays"]&&D.length>0||y&&typeof y=="number"&&D.length>=y||(_=x[P],/^-/.test(_)&&!I.test(_)&&!te(_)));P++)c=P,D.push(w(h,_,s))}return typeof y=="number"&&(y&&D.length<y||isNaN(y)&&D.length===0)&&(L=Error(b("Not enough arguments following: %s",h))),Y(h,D),c}function Y(c,h,x=s){if(/-/.test(c)&&a["camel-case-expansion"]){let _=c.split(".").map(function(y){return it(y)}).join(".");S(c,_)}let g=w(c,h,x),D=c.split(".");ze(R,D,g),d.aliases[c]&&d.aliases[c].forEach(function(_){let y=_.split(".");ze(R,y,g)}),D.length>1&&a["dot-notation"]&&(d.aliases[D[0]]||[]).forEach(function(_){let y=_.split("."),P=[].concat(D);P.shift(),y=y.concat(P),(d.aliases[c]||[]).includes(y.join("."))||ze(R,y,g)}),M(c,d.normalize)&&!M(c,d.arrays)&&[c].concat(d.aliases[c]||[]).forEach(function(y){Object.defineProperty(W,y,{enumerable:!0,get(){return h},set(P){h=typeof P=="string"?Ve.normalize(P):P}})})}function S(c,h){d.aliases[c]&&d.aliases[c].length||(d.aliases[c]=[h],E[h]=!0),d.aliases[h]&&d.aliases[h].length||S(h,c)}function w(c,h,x){x&&(h=nc(h)),(M(c,d.bools)||M(c,d.counts))&&typeof h=="string"&&(h=h==="true");let g=Array.isArray(h)?h.map(function(D){return O(c,D)}):O(c,h);return M(c,d.counts)&&(Te(g)||typeof g=="boolean")&&(g=Pr()),M(c,d.normalize)&&M(c,d.arrays)&&(Array.isArray(h)?g=h.map(D=>Ve.normalize(D)):g=Ve.normalize(h)),g}function O(c,h){return!a["parse-positional-numbers"]&&c==="_"||!M(c,d.strings)&&!M(c,d.bools)&&!Array.isArray(h)&&(Dn(h)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${h}`)))||!Te(h)&&M(c,d.numbers))&&(h=Number(h)),h}function $(c){let h=Object.create(null);X(h,d.aliases,f),Object.keys(d.configs).forEach(function(x){let g=c[x]||h[x];if(g)try{let D=null,_=Ve.resolve(Ve.cwd(),g),y=d.configs[x];if(typeof y=="function"){try{D=y(_)}catch(P){D=P}if(D instanceof Error){L=D;return}}else D=Ve.require(_);q(D)}catch(D){D.name==="PermissionDenied"?L=D:c[x]&&(L=Error(b("Invalid JSON config file: %s",g)))}})}function q(c,h){Object.keys(c).forEach(function(x){let g=c[x],D=h?h+"."+x:x;typeof g=="object"&&g!==null&&!Array.isArray(g)&&a["dot-notation"]?q(g,D):(!Ue(R,D.split("."))||M(D,d.arrays)&&a["combine-arrays"])&&Y(D,g)})}function ae(){typeof p<"u"&&p.forEach(function(c){q(c)})}function G(c,h){if(typeof m>"u")return;let x=typeof m=="string"?m:"",g=Ve.env();Object.keys(g).forEach(function(D){if(x===""||D.lastIndexOf(x,0)===0){let _=D.split("__").map(function(y,P){return P===0&&(y=y.substring(x.length)),it(y)});(h&&d.configs[_.join(".")]||!h)&&!Ue(c,_)&&Y(_.join("."),g[D])}})}function ce(c){let h,x=new Set;Object.keys(c).forEach(function(g){if(!x.has(g)&&(h=M(g,d.coercions),typeof h=="function"))try{let D=O(g,h(c[g]));[].concat(d.aliases[g]||[],g).forEach(_=>{x.add(_),c[_]=D})}catch(D){L=D}})}function et(c){return d.keys.forEach(h=>{~h.indexOf(".")||typeof c[h]>"u"&&(c[h]=void 0)}),c}function X(c,h,x,g=!1){Object.keys(x).forEach(function(D){Ue(c,D.split("."))||(ze(c,D.split("."),x[D]),g&&(C[D]=!0),(h[D]||[]).forEach(function(_){Ue(c,_.split("."))||ze(c,_.split("."),x[D])}))})}function Ue(c,h){let x=c;a["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(D){x=x[D]||{}});let g=h[h.length-1];return typeof x!="object"?!1:g in x}function ze(c,h,x){let g=c;a["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(le){le=ds(le),typeof g=="object"&&g[le]===void 0&&(g[le]={}),typeof g[le]!="object"||Array.isArray(g[le])?(Array.isArray(g[le])?g[le].push({}):g[le]=[g[le],{}],g=g[le][g[le].length-1]):g=g[le]});let D=ds(h[h.length-1]),_=M(h.join("."),d.arrays),y=Array.isArray(x),P=a["duplicate-arguments-array"];!P&&M(D,d.nargs)&&(P=!0,(!Te(g[D])&&d.nargs[D]===1||Array.isArray(g[D])&&g[D].length===d.nargs[D])&&(g[D]=void 0)),x===Pr()?g[D]=Pr(g[D]):Array.isArray(g[D])?P&&_&&y?g[D]=a["flatten-duplicate-arrays"]?g[D].concat(x):(Array.isArray(g[D][0])?g[D]:[g[D]]).concat([x]):!P&&!!_==!!y?g[D]=x:g[D]=g[D].concat([x]):g[D]===void 0&&_?g[D]=y?x:[x]:P&&!(g[D]===void 0||M(D,d.counts)||M(D,d.bools))?g[D]=[g[D],x]:g[D]=x}function tt(...c){c.forEach(function(h){Object.keys(h||{}).forEach(function(x){d.aliases[x]||(d.aliases[x]=[].concat(o[x]||[]),d.aliases[x].concat(x).forEach(function(g){if(/-/.test(g)&&a["camel-case-expansion"]){let D=it(g);D!==x&&d.aliases[x].indexOf(D)===-1&&(d.aliases[x].push(D),E[D]=!0)}}),d.aliases[x].concat(x).forEach(function(g){if(g.length>1&&/[A-Z]/.test(g)&&a["camel-case-expansion"]){let D=fn(g,"-");D!==x&&d.aliases[x].indexOf(D)===-1&&(d.aliases[x].push(D),E[D]=!0)}}),d.aliases[x].forEach(function(g){d.aliases[g]=[x].concat(d.aliases[x].filter(function(D){return g!==D}))}))})})}function M(c,h){let x=[].concat(d.aliases[c]||[],c),g=Object.keys(h),D=x.find(_=>g.includes(_));return D?h[D]:!1}function vn(c){let h=Object.keys(d);return[].concat(h.map(g=>d[g])).some(function(g){return Array.isArray(g)?g.includes(c):g[c]})}function j(c,...h){return[].concat(...h).some(function(g){let D=c.match(g);return D&&vn(D[1])})}function Q(c){if(c.match(I)||!c.match(/^-[^-]+/))return!1;let h=!0,x,g=c.slice(1).split("");for(let D=0;D<g.length;D++){if(x=c.slice(D+2),!vn(g[D])){h=!1;break}if(g[D+1]&&g[D+1]==="="||x==="-"||/[A-Za-z]/.test(g[D])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(x)||g[D+1]&&g[D+1].match(/\W/))break}return h}function te(c){return a["unknown-options-as-args"]&&V(c)}function V(c){return c=c.replace(/^-{3,}/,"--"),c.match(I)||Q(c)?!1:!j(c,/^-+([^=]+?)=[\s\S]*$/,z,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function ne(c){return!M(c,d.bools)&&!M(c,d.counts)&&`${c}`in f?f[c]:se(je(c))}function se(c){return{[Se.BOOLEAN]:!0,[Se.STRING]:"",[Se.NUMBER]:void 0,[Se.ARRAY]:[]}[c]}function je(c){let h=Se.BOOLEAN;return M(c,d.strings)?h=Se.STRING:M(c,d.numbers)?h=Se.NUMBER:M(c,d.bools)?h=Se.BOOLEAN:M(c,d.arrays)&&(h=Se.ARRAY),h}function Te(c){return c===void 0}function Kt(){Object.keys(d.counts).find(c=>M(c,d.arrays)?(L=Error(b("Invalid configuration: %s, opts.count excludes opts.array.",c)),!0):M(c,d.nargs)?(L=Error(b("Invalid configuration: %s, opts.count excludes opts.narg.",c)),!0):!1)}return{aliases:Object.assign({},d.aliases),argv:Object.assign(W,R),configuration:a,defaulted:Object.assign({},C),error:L,newAliases:Object.assign({},E)}}};function tc(t){let e=[],n=Object.create(null),r=!0;for(Object.keys(t).forEach(function(i){e.push([].concat(t[i],i))});r;){r=!1;for(let i=0;i<e.length;i++)for(let s=i+1;s<e.length;s++)if(e[i].filter(function(a){return e[s].indexOf(a)!==-1}).length){e[i]=e[i].concat(e[s]),e.splice(s,1),r=!0;break}}return e.forEach(function(i){i=i.filter(function(o,a,f){return f.indexOf(o)===a});let s=i.pop();s!==void 0&&typeof s=="string"&&(n[s]=i)}),n}function Pr(t){return t!==void 0?t+1:1}function ds(t){return t==="__proto__"?"___proto___":t}function nc(t){return typeof t=="string"&&(t[0]==="'"||t[0]==='"')&&t[t.length-1]===t[0]?t.substring(1,t.length-1):t}var Cs=k("fs"),Mr=k("node:module"),ic={};var Ir,jr,Tr,ps=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):20,ms=(jr=(Ir=process==null?void 0:process.versions)===null||Ir===void 0?void 0:Ir.node)!==null&&jr!==void 0?jr:(Tr=process==null?void 0:process.version)===null||Tr===void 0?void 0:Tr.slice(1);if(ms&&Number(ms.match(/^([^.]+)/)[1])<ps)throw Error(`yargs parser supports a minimum Node.js version of ${ps}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var rc=process?process.env:{},Fs=Mr.createRequire?(0,Mr.createRequire)(ic.url):void 0,Es=new hn({cwd:process.cwd,env:()=>rc,format:gs.format,normalize:dn.normalize,resolve:dn.resolve,require:t=>{if(typeof Fs<"u")return Fs(t);if(t.match(/\.json$/))return JSON.parse((0,Cs.readFileSync)(t,"utf8"));throw Error("only .json config files are supported in ESM")}}),Ht=function(e,n){return Es.parse(e.slice(),n).argv};Ht.detailed=function(t,e){return Es.parse(t.slice(),e)};Ht.camelCase=it;Ht.decamelize=fn;Ht.looksLikeNumber=Dn;var bs=Ht;var xe=k("path");function sc(){return oc()?0:1}function oc(){return uc()&&!process.defaultApp}function uc(){return!!process.versions.electron}function xs(){return process.argv[sc()]}var _t=k("fs"),ws=k("util"),ys=k("path"),As={fs:{readFileSync:_t.readFileSync,writeFile:_t.writeFile},format:ws.format,resolve:ys.resolve,exists:t=>{try{return(0,_t.statSync)(t).isFile()}catch{return!1}}};var Ne,Nr=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let n=e.shift(),r=function(){};return typeof e[e.length-1]=="function"&&(r=e.pop()),r=r||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]=n,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r(),Ne.format.apply(Ne.format,[this.cache[this.locale][n]||n].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),n=e.shift(),r=e.shift(),i=e.shift(),s=function(){};typeof e[e.length-1]=="function"&&(s=e.pop()),this.cache[this.locale]||this._readLocaleFile();let o=i===1?n:r;this.cache[this.locale][n]&&(o=this.cache[this.locale][n][i===1?"one":"other"]),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]={one:n,other:r},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:s})):s();let a=[o];return~o.indexOf("%d")&&a.push(i),Ne.format.apply(Ne.format,a.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this.cache[this.locale][n]=e[n])}_taggedLiteral(e,...n){let r="";return e.forEach(function(i,s){let o=n[s+1];r+=i,typeof o<"u"&&(r+="%s")}),this.__.apply(this,[r].concat([].slice.call(n,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,n=this.writeQueue[0],r=n.directory,i=n.locale,s=n.cb,o=this._resolveLocaleFile(r,i),a=JSON.stringify(this.cache[i],null,2);Ne.fs.writeFile(o,a,"utf-8",function(f){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),s(f)})}_readLocaleFile(){let e={},n=this._resolveLocaleFile(this.directory,this.locale);try{Ne.fs.readFileSync&&(e=JSON.parse(Ne.fs.readFileSync(n,"utf-8")))}catch(r){if(r instanceof SyntaxError&&(r.message="syntax error in "+n),r.code==="ENOENT")e={};else throw r}this.cache[this.locale]=e}_resolveLocaleFile(e,n){let r=Ne.resolve(e,"./",n+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(r)&&~n.lastIndexOf("_")){let i=Ne.resolve(e,"./",n.split("_")[0]+".json");this._fileExistsSync(i)&&(r=i)}return r}_fileExistsSync(e){return Ne.exists(e)}};function Bs(t,e){Ne=e;let n=new Nr(t);return{__:n.__.bind(n),__n:n.__n.bind(n),setLocale:n.setLocale.bind(n),getLocale:n.getLocale.bind(n),updateLocale:n.updateLocale.bind(n),locale:n.locale}}var ac=t=>Bs(t,As),Os=ac;var Ps=k("node:module"),Is=gt(Ss(),1),mn=k("node:fs"),Ts={},$r=(0,Lr.fileURLToPath)(Ts.url),cc=$r.substring(0,$r.lastIndexOf("node_modules")),lc=(0,Ps.createRequire)(Ts.url),js={assert:{notStrictEqual:pn.notStrictEqual,strictEqual:pn.strictEqual},cliui:vr,findUp:Ds,getEnv:t=>process.env[t],inspect:vs.inspect,getProcessArgvBin:xs,mainFilename:cc||process.cwd(),Parser:bs,path:{basename:xe.basename,dirname:xe.dirname,extname:xe.extname,relative:xe.relative,resolve:xe.resolve,join:xe.join},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:t=>{process.exit(t)},nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:mn.readFileSync,readdirSync:mn.readdirSync,require:lc,getCallerFile:()=>{let t=(0,Is.default)(3);return t.match(/^file:\/\//)?(0,Lr.fileURLToPath)(t):t},stringWidth:Me,y18n:Os({directory:(0,xe.resolve)($r,"../../../locales"),updateFiles:!1})};function Fe(t,e,n,r){n.assert.notStrictEqual(t,e,r)}function Ur(t,e){e.assert.strictEqual(typeof t,"string")}function St(t){return Object.keys(t)}function J(t){return!!t&&!!t.then&&typeof t.then=="function"}var oe=class t extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}};function Ke(t){let n=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),r=/\.*[\][<>]/g,i=n.shift();if(!i)throw new Error(`No command found in: ${t}`);let s={cmd:i.replace(r,""),demanded:[],optional:[]};return n.forEach((o,a)=>{let f=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&a===n.length-1&&(f=!0),/^\[/.test(o)?s.optional.push({cmd:o.replace(r,"").split("|"),variadic:f}):s.demanded.push({cmd:o.replace(r,"").split("|"),variadic:f})}),s}var fc=["first","second","third","fourth","fifth","sixth"];function A(t,e,n){function r(){return typeof t=="object"?[{demanded:[],optional:[]},t,e]:[Ke(`cmd ${t}`),e,n]}try{let i=0,[s,o,a]=r(),f=[].slice.call(o);for(;f.length&&f[f.length-1]===void 0;)f.pop();let p=a||f.length;if(p<s.demanded.length)throw new oe(`Not enough arguments provided. Expected ${s.demanded.length} but received ${f.length}.`);let m=s.demanded.length+s.optional.length;if(p>m)throw new oe(`Too many arguments provided. Expected max ${m} but received ${p}.`);s.demanded.forEach(l=>{let F=f.shift(),E=Ms(F);l.cmd.filter(b=>b===E||b==="*").length===0&&Ns(E,l.cmd,i),i+=1}),s.optional.forEach(l=>{if(f.length===0)return;let F=f.shift(),E=Ms(F);l.cmd.filter(b=>b===E||b==="*").length===0&&Ns(E,l.cmd,i),i+=1})}catch(i){console.warn(i.stack)}}function Ms(t){return Array.isArray(t)?"array":t===null?"null":typeof t}function Ns(t,e,n){throw new oe(`Invalid ${fc[n]||"manyith"} argument. Expected ${e.join(" or ")} but received ${t}.`)}var Fn=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,n,r=!0,i=!1){if(A("<array|function> [boolean] [boolean] [boolean]",[e,n,r],arguments.length),Array.isArray(e)){for(let s=0;s<e.length;s++){if(typeof e[s]!="function")throw Error("middleware must be a function");let o=e[s];o.applyBeforeValidation=n,o.global=r}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){let s=e;s.applyBeforeValidation=n,s.global=r,s.mutates=i,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,n){let r=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(i=>{let s=[...r[n]||[],n];return i.option?!s.includes(i.option):!0}),e.option=n,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function $s(t){return t?t.map(e=>(e.applyBeforeValidation=!1,e)):[]}function st(t,e,n,r){return n.reduce((i,s)=>{if(s.applyBeforeValidation!==r)return i;if(s.mutates){if(s.applied)return i;s.applied=!0}if(J(i))return i.then(o=>Promise.all([o,s(o,e)])).then(([o,a])=>Object.assign(o,a));{let o=s(i,e);return J(o)?o.then(a=>Object.assign(i,a)):Object.assign(i,o)}},t)}function ot(t,e,n=r=>{throw r}){try{let r=Dc(t)?t():t;return J(r)?r.then(i=>e(i)):e(r)}catch(r){return n(r)}}function Dc(t){return typeof t=="function"}var vt=/(^\*)|(^\$0)/,zr=class{constructor(e,n,r,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=e,this.globalMiddleware=r,this.validation=n}addDirectory(e,n,r,i){i=i||{},this.requireCache.add(r);let s=this.shim.path.resolve(this.shim.path.dirname(r),e),o=this.shim.readdirSync(s,{recursive:!!i.recurse});Array.isArray(i.extensions)||(i.extensions=["js"]);let a=typeof i.visit=="function"?i.visit:f=>f;for(let f of o){let p=f.toString();if(i.exclude){let l=!1;if(typeof i.exclude=="function"?l=i.exclude(p):l=i.exclude.test(p),l)continue}if(i.include){let l=!1;if(typeof i.include=="function"?l=i.include(p):l=i.include.test(p),!l)continue}let m=!1;for(let l of i.extensions)p.endsWith(l)&&(m=!0);if(m){let l=this.shim.path.join(s,p),F=n(l),E=Object.create(null,Object.getOwnPropertyDescriptors({...F}));if(a(E,l,p)){if(this.requireCache.has(l))continue;this.requireCache.add(l),E.command||(E.command=this.shim.path.basename(l,this.shim.path.extname(l))),this.addHandler(E)}}}}addHandler(e,n,r,i,s,o){let a=[],f=$s(s);if(i=i||(()=>{}),Array.isArray(e))if(hc(e))[e,...a]=e;else for(let p of e)this.addHandler(p);else if(pc(e)){let p=Array.isArray(e.command)||typeof e.command=="string"?e.command:null;if(p===null)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);e.aliases&&(p=[].concat(p).concat(e.aliases)),this.addHandler(p,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(Ls(r)){this.addHandler([e].concat(a),n,r.builder,r.handler,r.middlewares,r.deprecated);return}if(typeof e=="string"){let p=Ke(e);a=a.map(F=>Ke(F).cmd);let m=!1,l=[p.cmd].concat(a).filter(F=>vt.test(F)?(m=!0,!1):!0);l.length===0&&m&&l.push("$0"),m&&(p.cmd=l[0],a=l.slice(1),e=e.replace(vt,p.cmd)),a.forEach(F=>{this.aliasMap[F]=p.cmd}),n!==!1&&this.usage.command(e,n,m,a,o),this.handlers[p.cmd]={original:e,description:n,handler:i,builder:r||{},middlewares:f,deprecated:o,demanded:p.demanded,optional:p.optional},m&&(this.defaultCommand=this.handlers[p.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,n,r,i,s,o){let a=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,f=n.getInternalMethods().getContext(),p=f.commands.slice(),m=!e;e&&(f.commands.push(e),f.fullCommands.push(a.original));let l=this.applyBuilderUpdateUsageAndParse(m,a,n,r.aliases,p,i,s,o);return J(l)?l.then(F=>this.applyMiddlewareAndGetResult(m,a,F.innerArgv,f,s,F.aliases,n)):this.applyMiddlewareAndGetResult(m,a,l.innerArgv,f,s,l.aliases,n)}applyBuilderUpdateUsageAndParse(e,n,r,i,s,o,a,f){let p=n.builder,m=r;if(gn(p)){r.getInternalMethods().getUsageInstance().freeze();let l=p(r.getInternalMethods().reset(i),f);if(J(l))return l.then(F=>(m=zs(F)?F:r,this.parseAndUpdateUsage(e,n,m,s,o,a)))}else dc(p)&&(r.getInternalMethods().getUsageInstance().freeze(),m=r.getInternalMethods().reset(i),Object.keys(n.builder).forEach(l=>{m.option(l,p[l])}));return this.parseAndUpdateUsage(e,n,m,s,o,a)}parseAndUpdateUsage(e,n,r,i,s,o){e&&r.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(r)&&r.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,n),n.description);let a=r.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,s,o);return J(a)?a.then(f=>({aliases:r.parsed.aliases,innerArgv:f})):{aliases:r.parsed.aliases,innerArgv:a}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,n){let r=vt.test(n.original)?n.original.replace(vt,"").trim():n.original,i=e.filter(s=>!vt.test(s));return i.push(r),`$0 ${i.join(" ")}`}handleValidationAndGetResult(e,n,r,i,s,o,a,f){if(!o.getInternalMethods().getHasOutput()){let p=o.getInternalMethods().runValidation(s,f,o.parsed.error,e);r=ot(r,m=>(p(m),m))}if(n.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();let p=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(r,p,!1,!1),r=st(r,o,a,!1),r=ot(r,m=>{let l=n.handler(m);return J(l)?l.then(()=>m):m}),e||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),J(r)&&!o.getInternalMethods().hasParseCallback()&&r.catch(m=>{try{o.getInternalMethods().getUsageInstance().fail(null,m)}catch{}})}return e||(i.commands.pop(),i.fullCommands.pop()),r}applyMiddlewareAndGetResult(e,n,r,i,s,o,a){let f={};if(s)return r;a.getInternalMethods().getHasOutput()||(f=this.populatePositionals(n,r,i,a));let p=this.globalMiddleware.getMiddleware().slice(0).concat(n.middlewares),m=st(r,a,p,!0);return J(m)?m.then(l=>this.handleValidationAndGetResult(e,n,l,i,o,a,p,f)):this.handleValidationAndGetResult(e,n,m,i,o,a,p,f)}populatePositionals(e,n,r,i){n._=n._.slice(r.commands.length);let s=e.demanded.slice(0),o=e.optional.slice(0),a={};for(this.validation.positionalCount(s.length,n._.length);s.length;){let f=s.shift();this.populatePositional(f,n,a)}for(;o.length;){let f=o.shift();this.populatePositional(f,n,a)}return n._=r.commands.concat(n._.map(f=>""+f)),this.postProcessPositionals(n,a,this.cmdToParseOptions(e.original),i),a}populatePositional(e,n,r){let i=e.cmd[0];e.variadic?r[i]=n._.splice(0).map(String):n._.length&&(r[i]=[String(n._.shift())])}cmdToParseOptions(e){let n={array:[],default:{},alias:{},demand:{}},r=Ke(e);return r.demanded.forEach(i=>{let[s,...o]=i.cmd;i.variadic&&(n.array.push(s),n.default[s]=[]),n.alias[s]=o,n.demand[s]=!0}),r.optional.forEach(i=>{let[s,...o]=i.cmd;i.variadic&&(n.array.push(s),n.default[s]=[]),n.alias[s]=o}),n}postProcessPositionals(e,n,r,i){let s=Object.assign({},i.getOptions());s.default=Object.assign(r.default,s.default);for(let p of Object.keys(r.alias))s.alias[p]=(s.alias[p]||[]).concat(r.alias[p]);s.array=s.array.concat(r.array),s.config={};let o=[];if(Object.keys(n).forEach(p=>{n[p].map(m=>{s.configuration["unknown-options-as-args"]&&(s.key[p]=!0),o.push(`--${p}`),o.push(m)})}),!o.length)return;let a=Object.assign({},s.configuration,{"populate--":!1}),f=this.shim.Parser.detailed(o,Object.assign({},s,{configuration:a}));if(f.error)i.getInternalMethods().getUsageInstance().fail(f.error.message,f.error);else{let p=Object.keys(n);Object.keys(n).forEach(m=>{p.push(...f.aliases[m])}),Object.keys(f.argv).forEach(m=>{p.includes(m)&&(n[m]||(n[m]=f.argv[m]),!this.isInConfigs(i,m)&&!this.isDefaulted(i,m)&&Object.prototype.hasOwnProperty.call(e,m)&&Object.prototype.hasOwnProperty.call(f.argv,m)&&(Array.isArray(e[m])||Array.isArray(f.argv[m]))?e[m]=[].concat(e[m],f.argv[m]):e[m]=f.argv[m])})}}isDefaulted(e,n){let{default:r}=e.getOptions();return Object.prototype.hasOwnProperty.call(r,n)||Object.prototype.hasOwnProperty.call(r,this.shim.Parser.camelCase(n))}isInConfigs(e,n){let{configObjects:r}=e.getOptions();return r.some(i=>Object.prototype.hasOwnProperty.call(i,n))||r.some(i=>Object.prototype.hasOwnProperty.call(i,this.shim.Parser.camelCase(n)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let r=vt.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(r,this.defaultCommand.description)}let n=this.defaultCommand.builder;if(gn(n))return n(e,!0);Ls(n)||Object.keys(n).forEach(r=>{e.option(r,n[r])})}extractDesc({describe:e,description:n,desc:r}){for(let i of[e,n,r]){if(typeof i=="string"||i===!1)return i;Fe(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();Fe(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function Us(t,e,n,r){return new zr(t,e,n,r)}function Ls(t){return typeof t=="object"&&!!t.builder&&typeof t.handler=="function"}function hc(t){return t.every(e=>typeof e=="string")}function gn(t){return typeof t=="function"}function dc(t){return typeof t=="object"}function pc(t){return typeof t=="object"&&!Array.isArray(t)}function ke(t={},e=()=>!0){let n={};return St(t).forEach(r=>{e(r,t[r])&&(n[r]=t[r])}),n}function Je(t){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let n=e;n._handle&&n.isTTY&&typeof n._handle.setBlocking=="function"&&n._handle.setBlocking(t)})}function mc(t){return typeof t=="boolean"}function Ws(t,e){let n=e.y18n.__,r={},i=[];r.failFn=function(w){i.push(w)};let s=null,o=null,a=!0;r.showHelpOnFail=function(w=!0,O){let[$,q]=typeof w=="string"?[!0,w]:[w,O];return t.getInternalMethods().isGlobalContext()&&(o=q),s=q,a=$,r};let f=!1;r.fail=function(w,O){let $=t.getInternalMethods().getLoggerInstance();if(i.length)for(let q=i.length-1;q>=0;--q){let ae=i[q];if(mc(ae)){if(O)throw O;if(w)throw Error(w)}else ae(w,O,r)}else{if(t.getExitProcess()&&Je(!0),!f){f=!0,a&&(t.showHelp("error"),$.error()),(w||O)&&$.error(w||O);let q=s||o;q&&((w||O)&&$.error(""),$.error(q))}if(O=O||new oe(w),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,O);throw O}};let p=[],m=!1;r.usage=(S,w)=>S===null?(m=!0,p=[],r):(m=!1,p.push([S,w||""]),r),r.getUsage=()=>p,r.getUsageDisabled=()=>m,r.getPositionalGroupName=()=>n("Positionals:");let l=[];r.example=(S,w)=>{l.push([S,w||""])};let F=[];r.command=function(w,O,$,q,ae=!1){$&&(F=F.map(G=>(G[2]=!1,G))),F.push([w,O||"",$,q,ae])},r.getCommands=()=>F;let E={};r.describe=function(w,O){Array.isArray(w)?w.forEach($=>{r.describe($,O)}):typeof w=="object"?Object.keys(w).forEach($=>{r.describe($,w[$])}):E[w]=O},r.getDescriptions=()=>E;let C=[];r.epilog=S=>{C.push(S)};let b=!1,d;r.wrap=S=>{b=!0,d=S},r.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(b||(d=K(),b=!0),d);let I="__yargsString__:";r.deferY18nLookup=S=>I+S,r.help=function(){if(U)return U;L();let w=t.customScriptName?t.$0:e.path.basename(t.$0),O=t.getDemandedOptions(),$=t.getDemandedCommands(),q=t.getDeprecatedOptions(),ae=t.getGroups(),G=t.getOptions(),ce=[];ce=ce.concat(Object.keys(E)),ce=ce.concat(Object.keys(O)),ce=ce.concat(Object.keys($)),ce=ce.concat(Object.keys(G.default)),ce=ce.filter(W),ce=Object.keys(ce.reduce((j,Q)=>(Q!=="_"&&(j[Q]=!0),j),{}));let et=r.getWrap(),X=e.cliui({width:et,wrap:!!et});if(!m){if(p.length)p.forEach(j=>{X.div({text:`${j[0].replace(/\$0/g,w)}`}),j[1]&&X.div({text:`${j[1]}`,padding:[1,0,0,0]})}),X.div();else if(F.length){let j=null;$._?j=`${w} <${n("command")}>
15
+ `:j=`${w} [${n("command")}]
16
+ `,X.div(`${j}`)}}if(F.length>1||F.length===1&&!F[0][2]){X.div(n("Commands:"));let j=t.getInternalMethods().getContext(),Q=j.commands.length?`${j.commands.join(" ")} `:"";t.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(F=F.sort((V,ne)=>V[0].localeCompare(ne[0])));let te=w?`${w} `:"";F.forEach(V=>{let ne=`${te}${Q}${V[0].replace(/^\$0 ?/,"")}`;X.span({text:ne,padding:[0,2,0,2],width:z(F,et,`${w}${Q}`)+4},{text:V[1]});let se=[];V[2]&&se.push(`[${n("default")}]`),V[3]&&V[3].length&&se.push(`[${n("aliases:")} ${V[3].join(", ")}]`),V[4]&&(typeof V[4]=="string"?se.push(`[${n("deprecated: %s",V[4])}]`):se.push(`[${n("deprecated")}]`)),se.length?X.div({text:se.join(" "),padding:[0,0,0,2],align:"right"}):X.div()}),X.div()}let Ue=(Object.keys(G.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);ce=ce.filter(j=>!t.parsed.newAliases[j]&&Ue.every(Q=>(G.alias[Q]||[]).indexOf(j)===-1));let ze=n("Options:");ae[ze]||(ae[ze]=[]),R(ce,G.alias,ae,ze);let tt=j=>/^--/.test(Cn(j)),M=Object.keys(ae).filter(j=>ae[j].length>0).map(j=>{let Q=ae[j].filter(W).map(te=>{if(Ue.includes(te))return te;for(let V=0,ne;(ne=Ue[V])!==void 0;V++)if((G.alias[ne]||[]).includes(te))return ne;return te});return{groupName:j,normalizedKeys:Q}}).filter(({normalizedKeys:j})=>j.length>0).map(({groupName:j,normalizedKeys:Q})=>{let te=Q.reduce((V,ne)=>(V[ne]=[ne].concat(G.alias[ne]||[]).map(se=>j===r.getPositionalGroupName()?se:(/^[0-9]$/.test(se)?G.boolean.includes(ne)?"-":"--":se.length>1?"--":"-")+se).sort((se,je)=>tt(se)===tt(je)?0:tt(se)?1:-1).join(", "),V),{});return{groupName:j,normalizedKeys:Q,switches:te}});if(M.filter(({groupName:j})=>j!==r.getPositionalGroupName()).some(({normalizedKeys:j,switches:Q})=>!j.every(te=>tt(Q[te])))&&M.filter(({groupName:j})=>j!==r.getPositionalGroupName()).forEach(({normalizedKeys:j,switches:Q})=>{j.forEach(te=>{tt(Q[te])&&(Q[te]=Fc(Q[te],4))})}),M.forEach(({groupName:j,normalizedKeys:Q,switches:te})=>{X.div(j),Q.forEach(V=>{let ne=te[V],se=E[V]||"",je=null;se.includes(I)&&(se=n(se.substring(I.length))),G.boolean.includes(V)&&(je=`[${n("boolean")}]`),G.count.includes(V)&&(je=`[${n("count")}]`),G.string.includes(V)&&(je=`[${n("string")}]`),G.normalize.includes(V)&&(je=`[${n("string")}]`),G.array.includes(V)&&(je=`[${n("array")}]`),G.number.includes(V)&&(je=`[${n("number")}]`);let Te=h=>typeof h=="string"?`[${n("deprecated: %s",h)}]`:`[${n("deprecated")}]`,Kt=[V in q?Te(q[V]):null,je,V in O?`[${n("required")}]`:null,G.choices&&G.choices[V]?`[${n("choices:")} ${r.stringifiedValues(G.choices[V])}]`:null,H(G.default[V],G.defaultDescription[V])].filter(Boolean).join(" ");X.span({text:Cn(ne),padding:[0,2,0,2+Rs(ne)],width:z(te,et)+4},se);let c=t.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;Kt&&!c?X.div({text:Kt,padding:[0,0,0,2],align:"right"}):X.div()}),X.div()}),l.length&&(X.div(n("Examples:")),l.forEach(j=>{j[0]=j[0].replace(/\$0/g,w)}),l.forEach(j=>{j[1]===""?X.div({text:j[0],padding:[0,2,0,2]}):X.div({text:j[0],padding:[0,2,0,2],width:z(l,et)+4},{text:j[1]})}),X.div()),C.length>0){let j=C.map(Q=>Q.replace(/\$0/g,w)).join(`
17
+ `);X.div(`${j}
18
+ `)}return X.toString().replace(/\s*$/,"")};function z(S,w,O){let $=0;return Array.isArray(S)||(S=Object.values(S).map(q=>[q])),S.forEach(q=>{$=Math.max(e.stringWidth(O?`${O} ${Cn(q[0])}`:Cn(q[0]))+Rs(q[0]),$)}),w&&($=Math.min($,parseInt((w*.5).toString(),10))),$}function L(){let S=t.getDemandedOptions(),w=t.getOptions();(Object.keys(w.alias)||[]).forEach(O=>{w.alias[O].forEach($=>{E[$]&&r.describe(O,E[$]),$ in S&&t.demandOption(O,S[$]),w.boolean.includes($)&&t.boolean(O),w.count.includes($)&&t.count(O),w.string.includes($)&&t.string(O),w.normalize.includes($)&&t.normalize(O),w.array.includes($)&&t.array(O),w.number.includes($)&&t.number(O)})})}let U;r.cacheHelpMessage=function(){U=this.help()},r.clearCachedHelpMessage=function(){U=void 0},r.hasCachedHelpMessage=function(){return!!U};function R(S,w,O,$){let q=[],ae=null;return Object.keys(O).forEach(G=>{q=q.concat(O[G])}),S.forEach(G=>{ae=[G].concat(w[G]),ae.some(ce=>q.indexOf(ce)!==-1)||O[$].push(G)}),q}function W(S){return t.getOptions().hiddenOptions.indexOf(S)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}r.showHelp=S=>{let w=t.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:w[S])(r.help())},r.functionDescription=S=>["(",S.name?e.Parser.decamelize(S.name,"-"):n("generated-value"),")"].join(""),r.stringifiedValues=function(w,O){let $="",q=O||", ",ae=[].concat(w);return!w||!ae.length||ae.forEach(G=>{$.length&&($+=q),$+=JSON.stringify(G)}),$};function H(S,w){let O=`[${n("default:")} `;if(S===void 0&&!w)return null;if(w)O+=w;else switch(typeof S){case"string":O+=`"${S}"`;break;case"object":O+=JSON.stringify(S);break;default:O+=S}return`${O}]`}function K(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let de=null;r.version=S=>{de=S},r.showVersion=S=>{let w=t.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:w[S])(de)},r.reset=function(w){return s=null,f=!1,p=[],m=!1,C=[],l=[],F=[],E=ke(E,O=>!w[O]),r};let Y=[];return r.freeze=function(){Y.push({failMessage:s,failureOutput:f,usages:p,usageDisabled:m,epilogs:C,examples:l,commands:F,descriptions:E})},r.unfreeze=function(w=!1){let O=Y.pop();O&&(w?(E={...O.descriptions,...E},F=[...O.commands,...F],p=[...O.usages,...p],l=[...O.examples,...l],C=[...O.epilogs,...C]):{failMessage:s,failureOutput:f,usages:p,usageDisabled:m,epilogs:C,examples:l,commands:F,descriptions:E}=O)},r}function Rr(t){return typeof t=="object"}function Fc(t,e){return Rr(t)?{text:t.text,indentation:t.indentation+e}:{text:t,indentation:e}}function Rs(t){return Rr(t)?t.indentation:0}function Cn(t){return Rr(t)?t.text:t}var Vs=`###-begin-{{app_name}}-completions-###
13
19
  #
14
20
  # yargs command completion script
15
21
  #
@@ -24,9 +30,10 @@ _{{app_name}}_yargs_completions()
24
30
  args=("\${COMP_WORDS[@]}")
25
31
 
26
32
  # ask yargs to generate completions.
27
- type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
28
-
29
- COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
33
+ # see https://stackoverflow.com/a/40944195/7080036 for the spaces-handling awk
34
+ mapfile -t type_list < <({{app_path}} --get-yargs-completions "\${args[@]}")
35
+ mapfile -t COMPREPLY < <(compgen -W "$( printf '%q ' "\${type_list[@]}" )" -- "\${cur_word}" |
36
+ awk '/ / { print "\\""$0"\\"" } /^[^ ]+$/ { print $0 }')
30
37
 
31
38
  # if no match was found, fall back to filename completion
32
39
  if [ \${#COMPREPLY[@]} -eq 0 ]; then
@@ -37,7 +44,7 @@ _{{app_name}}_yargs_completions()
37
44
  }
38
45
  complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
39
46
  ###-end-{{app_name}}-completions-###
40
- `,bs=`#compdef {{app_name}}
47
+ `,Hs=`#compdef {{app_name}}
41
48
  ###-begin-{{app_name}}-completions-###
42
49
  #
43
50
  # yargs command completion script
@@ -52,18 +59,26 @@ _{{app_name}}_yargs_completions()
52
59
  IFS=$'
53
60
  ' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
54
61
  IFS=$si
55
- _describe 'values' reply
62
+ if [[ \${#reply} -gt 0 ]]; then
63
+ _describe 'values' reply
64
+ else
65
+ _default
66
+ fi
56
67
  }
57
- compdef _{{app_name}}_yargs_completions {{app_name}}
68
+ if [[ "'\${zsh_eval_context[-1]}" == "loadautofunc" ]]; then
69
+ _{{app_name}}_yargs_completions "$@"
70
+ else
71
+ compdef _{{app_name}}_yargs_completions {{app_name}}
72
+ fi
58
73
  ###-end-{{app_name}}-completions-###
59
- `;var jr=class{constructor(t,e,n,i){var s,o,c;this.yargs=t,this.usage=e,this.command=n,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(c=((s=this.shim.getEnv("SHELL"))===null||s===void 0?void 0:s.includes("zsh"))||((o=this.shim.getEnv("ZSH_NAME"))===null||o===void 0?void 0:o.includes("zsh")))!==null&&c!==void 0?c:!1}defaultCompletion(t,e,n,i){let s=this.command.getCommandHandlers();for(let c=0,h=t.length;c<h;++c)if(s[t[c]]&&s[t[c]].builder){let g=s[t[c]].builder;if(dn(g)){this.indexAfterLastReset=c+1;let m=this.yargs.getInternalMethods().reset();return g(m,!0),m.argv}}let o=[];this.commandCompletions(o,t,n),this.optionCompletions(o,t,e,n),this.choicesFromOptionsCompletions(o,t,e,n),this.choicesFromPositionalsCompletions(o,t,e,n),i(null,o)}commandCompletions(t,e,n){let i=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&i[i.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(s=>{let o=Gt(s[0]).cmd;if(e.indexOf(o)===-1)if(!this.zshShell)t.push(o);else{let c=s[1]||"";t.push(o.replace(/:/g,"\\:")+":"+c)}})}optionCompletions(t,e,n,i){if((i.match(/^-/)||i===""&&t.length===0)&&!this.previousArgHasChoices(e)){let s=this.yargs.getOptions(),o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach(c=>{let h=!!s.configuration["boolean-negation"]&&s.boolean.includes(c);!o.includes(c)&&!s.hiddenOptions.includes(c)&&!this.argsContainKey(e,c,h)&&this.completeOptionKey(c,t,i,h&&!!s.default[c])})}}choicesFromOptionsCompletions(t,e,n,i){if(this.previousArgHasChoices(e)){let s=this.getPreviousArgChoices(e);s&&s.length>0&&t.push(...s.map(o=>o.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,e,n,i){if(i===""&&t.length>0&&this.previousArgHasChoices(e))return;let s=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],o=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),c=s[n._.length-o-1];if(!c)return;let h=this.yargs.getOptions().choices[c]||[];for(let g of h)g.startsWith(i)&&t.push(g.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],n="";if(!e.startsWith("-")&&t.length>1&&(n=e,e=t[t.length-2]),!e.startsWith("-"))return;let i=e.replace(/^-+/,""),s=this.yargs.getOptions(),o=[i,...this.yargs.getAliases()[i]||[]],c;for(let h of o)if(Object.prototype.hasOwnProperty.call(s.key,h)&&Array.isArray(s.choices[h])){c=s.choices[h];break}if(c)return c.filter(h=>!n||h.startsWith(n))}previousArgHasChoices(t){let e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n){let i=s=>t.indexOf((/^[^0-9]$/.test(s)?"-":"--")+s)!==-1;if(i(e)||n&&i(`no-${e}`))return!0;if(this.aliases){for(let s of this.aliases[e])if(i(s))return!0}return!1}completeOptionKey(t,e,n,i){var s,o,c,h;let g=t;if(this.zshShell){let y=this.usage.getDescriptions(),C=(o=(s=this===null||this===void 0?void 0:this.aliases)===null||s===void 0?void 0:s[t])===null||o===void 0?void 0:o.find(M=>{let N=y[M];return typeof N=="string"&&N.length>0}),x=C?y[C]:void 0,p=(h=(c=y[t])!==null&&c!==void 0?c:x)!==null&&h!==void 0?h:"";g=`${t.replace(/:/g,"\\:")}:${p.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let m=y=>/^--/.test(y),d=y=>/^[^0-9]$/.test(y),b=!m(n)&&d(t)?"-":"--";e.push(b+g),i&&e.push(b+"no-"+g)}customCompletion(t,e,n,i){if(mt(this.customCompletionFunction,null,this.shim),Nc(this.customCompletionFunction)){let s=this.customCompletionFunction(n,e);return K(s)?s.then(o=>{this.shim.process.nextTick(()=>{i(null,o)})}).catch(o=>{this.shim.process.nextTick(()=>{i(o,void 0)})}):i(null,s)}else return $c(this.customCompletionFunction)?this.customCompletionFunction(n,e,(s=i)=>this.defaultCompletion(t,e,n,s),s=>{i(null,s)}):this.customCompletionFunction(n,e,s=>{i(null,s)})}getCompletion(t,e){let n=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),s=this.customCompletionFunction?o=>this.customCompletion(t,o,n,e):o=>this.defaultCompletion(t,o,n,e);return K(i)?i.then(s):s(i)}generateCompletionScript(t,e){let n=this.zshShell?bs:gs,i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,i),n=n.replace(/{{completion_command}}/g,e),n.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}};function ws(r,t,e,n){return new jr(r,t,e,n)}function Nc(r){return r.length<3}function $c(r){return r.length>3}function ys(r,t){if(r.length===0)return t.length;if(t.length===0)return r.length;let e=[],n;for(n=0;n<=t.length;n++)e[n]=[n];let i;for(i=0;i<=r.length;i++)e[0][i]=i;for(n=1;n<=t.length;n++)for(i=1;i<=r.length;i++)t.charAt(n-1)===r.charAt(i-1)?e[n][i]=e[n-1][i-1]:n>1&&i>1&&t.charAt(n-2)===r.charAt(i-1)&&t.charAt(n-1)===r.charAt(i-2)?e[n][i]=e[n-2][i-2]+1:e[n][i]=Math.min(e[n-1][i-1]+1,Math.min(e[n][i-1]+1,e[n-1][i]+1));return e[t.length][r.length]}var xs=["$0","--","_"];function Cs(r,t,e){let n=e.y18n.__,i=e.y18n.__n,s={};s.nonOptionCount=function(d){let b=r.getDemandedCommands(),C=d._.length+(d["--"]?d["--"].length:0)-r.getInternalMethods().getContext().commands.length;b._&&(C<b._.min||C>b._.max)&&(C<b._.min?b._.minMsg!==void 0?t.fail(b._.minMsg?b._.minMsg.replace(/\$0/g,C.toString()).replace(/\$1/,b._.min.toString()):null):t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",C,C.toString(),b._.min.toString())):C>b._.max&&(b._.maxMsg!==void 0?t.fail(b._.maxMsg?b._.maxMsg.replace(/\$0/g,C.toString()).replace(/\$1/,b._.max.toString()):null):t.fail(i("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",C,C.toString(),b._.max.toString()))))},s.positionalCount=function(d,b){b<d&&t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",b,b+"",d+""))},s.requiredArguments=function(d,b){let y=null;for(let C of Object.keys(b))(!Object.prototype.hasOwnProperty.call(d,C)||typeof d[C]>"u")&&(y=y||{},y[C]=b[C]);if(y){let C=[];for(let p of Object.keys(y)){let M=y[p];M&&C.indexOf(M)<0&&C.push(M)}let x=C.length?`
74
+ `;var Wr=class{constructor(e,n,r,i){var s,o,a;this.yargs=e,this.usage=n,this.command=r,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(a=((s=this.shim.getEnv("SHELL"))===null||s===void 0?void 0:s.includes("zsh"))||((o=this.shim.getEnv("ZSH_NAME"))===null||o===void 0?void 0:o.includes("zsh")))!==null&&a!==void 0?a:!1}defaultCompletion(e,n,r,i){let s=this.command.getCommandHandlers();for(let a=0,f=e.length;a<f;++a)if(s[e[a]]&&s[e[a]].builder){let p=s[e[a]].builder;if(gn(p)){this.indexAfterLastReset=a+1;let m=this.yargs.getInternalMethods().reset();return p(m,!0),m.argv}}let o=[];this.commandCompletions(o,e,r),this.optionCompletions(o,e,n,r),this.choicesFromOptionsCompletions(o,e,n,r),this.choicesFromPositionalsCompletions(o,e,n,r),i(null,o)}commandCompletions(e,n,r){let i=this.yargs.getInternalMethods().getContext().commands;!r.match(/^-/)&&i[i.length-1]!==r&&!this.previousArgHasChoices(n)&&this.usage.getCommands().forEach(s=>{let o=Ke(s[0]).cmd;if(n.indexOf(o)===-1)if(!this.zshShell)e.push(o);else{let a=s[1]||"";e.push(o.replace(/:/g,"\\:")+":"+a)}})}optionCompletions(e,n,r,i){if((i.match(/^-/)||i===""&&e.length===0)&&!this.previousArgHasChoices(n)){let s=this.yargs.getOptions(),o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach(a=>{let f=!!s.configuration["boolean-negation"]&&s.boolean.includes(a);!o.includes(a)&&!s.hiddenOptions.includes(a)&&!this.argsContainKey(n,a,f)&&this.completeOptionKey(a,e,i,f&&!!s.default[a])})}}choicesFromOptionsCompletions(e,n,r,i){if(this.previousArgHasChoices(n)){let s=this.getPreviousArgChoices(n);s&&s.length>0&&e.push(...s.map(o=>o.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,n,r,i){if(i===""&&e.length>0&&this.previousArgHasChoices(n))return;let s=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],o=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),a=s[r._.length-o-1];if(!a)return;let f=this.yargs.getOptions().choices[a]||[];for(let p of f)p.startsWith(i)&&e.push(p.replace(/:/g,"\\:"))}getPreviousArgChoices(e){if(e.length<1)return;let n=e[e.length-1],r="";if(!n.startsWith("-")&&e.length>1&&(r=n,n=e[e.length-2]),!n.startsWith("-"))return;let i=n.replace(/^-+/,""),s=this.yargs.getOptions(),o=[i,...this.yargs.getAliases()[i]||[]],a;for(let f of o)if(Object.prototype.hasOwnProperty.call(s.key,f)&&Array.isArray(s.choices[f])){a=s.choices[f];break}if(a)return a.filter(f=>!r||f.startsWith(r))}previousArgHasChoices(e){let n=this.getPreviousArgChoices(e);return n!==void 0&&n.length>0}argsContainKey(e,n,r){let i=s=>e.indexOf((/^[^0-9]$/.test(s)?"-":"--")+s)!==-1;if(i(n)||r&&i(`no-${n}`))return!0;if(this.aliases){for(let s of this.aliases[n])if(i(s))return!0}return!1}completeOptionKey(e,n,r,i){var s,o,a,f;let p=e;if(this.zshShell){let E=this.usage.getDescriptions(),C=(o=(s=this===null||this===void 0?void 0:this.aliases)===null||s===void 0?void 0:s[e])===null||o===void 0?void 0:o.find(I=>{let z=E[I];return typeof z=="string"&&z.length>0}),b=C?E[C]:void 0,d=(f=(a=E[e])!==null&&a!==void 0?a:b)!==null&&f!==void 0?f:"";p=`${e.replace(/:/g,"\\:")}:${d.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let m=E=>/^--/.test(E),l=E=>/^[^0-9]$/.test(E),F=!m(r)&&l(e)?"-":"--";n.push(F+p),i&&n.push(F+"no-"+p)}customCompletion(e,n,r,i){if(Fe(this.customCompletionFunction,null,this.shim),Cc(this.customCompletionFunction)){let s=this.customCompletionFunction(r,n);return J(s)?s.then(o=>{this.shim.process.nextTick(()=>{i(null,o)})}).catch(o=>{this.shim.process.nextTick(()=>{i(o,void 0)})}):i(null,s)}else return Ec(this.customCompletionFunction)?this.customCompletionFunction(r,n,(s=i)=>this.defaultCompletion(e,n,r,s),s=>{i(null,s)}):this.customCompletionFunction(r,n,s=>{i(null,s)})}getCompletion(e,n){let r=e.length?e[e.length-1]:"",i=this.yargs.parse(e,!0),s=this.customCompletionFunction?o=>this.customCompletion(e,o,r,n):o=>this.defaultCompletion(e,o,r,n);return J(i)?i.then(s):s(i)}generateCompletionScript(e,n){let r=this.zshShell?Hs:Vs,i=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),r=r.replace(/{{app_name}}/g,i),r=r.replace(/{{completion_command}}/g,n),r.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}};function Gs(t,e,n,r){return new Wr(t,e,n,r)}function Cc(t){return t.length<3}function Ec(t){return t.length>3}function qs(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let n=[],r;for(r=0;r<=e.length;r++)n[r]=[r];let i;for(i=0;i<=t.length;i++)n[0][i]=i;for(r=1;r<=e.length;r++)for(i=1;i<=t.length;i++)e.charAt(r-1)===t.charAt(i-1)?n[r][i]=n[r-1][i-1]:r>1&&i>1&&e.charAt(r-2)===t.charAt(i-1)&&e.charAt(r-1)===t.charAt(i-2)?n[r][i]=n[r-2][i-2]+1:n[r][i]=Math.min(n[r-1][i-1]+1,Math.min(n[r][i-1]+1,n[r-1][i]+1));return n[e.length][t.length]}var Ys=["$0","--","_"];function Ks(t,e,n){let r=n.y18n.__,i=n.y18n.__n,s={};s.nonOptionCount=function(l){let F=t.getDemandedCommands(),C=l._.length+(l["--"]?l["--"].length:0)-t.getInternalMethods().getContext().commands.length;F._&&(C<F._.min||C>F._.max)&&(C<F._.min?F._.minMsg!==void 0?e.fail(F._.minMsg?F._.minMsg.replace(/\$0/g,C.toString()).replace(/\$1/,F._.min.toString()):null):e.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",C,C.toString(),F._.min.toString())):C>F._.max&&(F._.maxMsg!==void 0?e.fail(F._.maxMsg?F._.maxMsg.replace(/\$0/g,C.toString()).replace(/\$1/,F._.max.toString()):null):e.fail(i("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",C,C.toString(),F._.max.toString()))))},s.positionalCount=function(l,F){F<l&&e.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",F,F+"",l+""))},s.requiredArguments=function(l,F){let E=null;for(let C of Object.keys(F))(!Object.prototype.hasOwnProperty.call(l,C)||typeof l[C]>"u")&&(E=E||{},E[C]=F[C]);if(E){let C=[];for(let d of Object.keys(E)){let I=E[d];I&&C.indexOf(I)<0&&C.push(I)}let b=C.length?`
60
75
  ${C.join(`
61
- `)}`:"";t.fail(i("Missing required argument: %s","Missing required arguments: %s",Object.keys(y).length,Object.keys(y).join(", ")+x))}},s.unknownArguments=function(d,b,y,C,x=!0){var p;let M=r.getInternalMethods().getCommandInstance().getCommands(),N=[],R=r.getInternalMethods().getContext();if(Object.keys(d).forEach(U=>{!xs.includes(U)&&!Object.prototype.hasOwnProperty.call(y,U)&&!Object.prototype.hasOwnProperty.call(r.getInternalMethods().getParseContext(),U)&&!s.isValidAndSomeAliasIsNotNew(U,b)&&N.push(U)}),x&&(R.commands.length>0||M.length>0||C)&&d._.slice(R.commands.length).forEach(U=>{M.includes(""+U)||N.push(""+U)}),x){let B=((p=r.getDemandedCommands()._)===null||p===void 0?void 0:p.max)||0,ft=R.commands.length+B;ft<d._.length&&d._.slice(ft).forEach(J=>{J=String(J),!R.commands.includes(J)&&!N.includes(J)&&N.push(J)})}N.length&&t.fail(i("Unknown argument: %s","Unknown arguments: %s",N.length,N.map(U=>U.trim()?U:`"${U}"`).join(", ")))},s.unknownCommands=function(d){let b=r.getInternalMethods().getCommandInstance().getCommands(),y=[],C=r.getInternalMethods().getContext();return(C.commands.length>0||b.length>0)&&d._.slice(C.commands.length).forEach(x=>{b.includes(""+x)||y.push(""+x)}),y.length>0?(t.fail(i("Unknown command: %s","Unknown commands: %s",y.length,y.join(", "))),!0):!1},s.isValidAndSomeAliasIsNotNew=function(d,b){if(!Object.prototype.hasOwnProperty.call(b,d))return!1;let y=r.parsed.newAliases;return[d,...b[d]].some(C=>!Object.prototype.hasOwnProperty.call(y,C)||!y[d])},s.limitedChoices=function(d){let b=r.getOptions(),y={};if(!Object.keys(b.choices).length)return;Object.keys(d).forEach(p=>{xs.indexOf(p)===-1&&Object.prototype.hasOwnProperty.call(b.choices,p)&&[].concat(d[p]).forEach(M=>{b.choices[p].indexOf(M)===-1&&M!==void 0&&(y[p]=(y[p]||[]).concat(M))})});let C=Object.keys(y);if(!C.length)return;let x=n("Invalid values:");C.forEach(p=>{x+=`
62
- ${n("Argument: %s, Given: %s, Choices: %s",p,t.stringifiedValues(y[p]),t.stringifiedValues(b.choices[p]))}`}),t.fail(x)};let o={};s.implies=function(d,b){A("<string|object> [array|number|string]",[d,b],arguments.length),typeof d=="object"?Object.keys(d).forEach(y=>{s.implies(y,d[y])}):(r.global(d),o[d]||(o[d]=[]),Array.isArray(b)?b.forEach(y=>s.implies(d,y)):(mt(b,void 0,e),o[d].push(b)))},s.getImplied=function(){return o};function c(m,d){let b=Number(d);return d=isNaN(b)?d:b,typeof d=="number"?d=m._.length>=d:d.match(/^--no-.+/)?(d=d.match(/^--no-(.+)/)[1],d=!Object.prototype.hasOwnProperty.call(m,d)):d=Object.prototype.hasOwnProperty.call(m,d),d}s.implications=function(d){let b=[];if(Object.keys(o).forEach(y=>{let C=y;(o[y]||[]).forEach(x=>{let p=C,M=x;p=c(d,p),x=c(d,x),p&&!x&&b.push(` ${C} -> ${M}`)})}),b.length){let y=`${n("Implications failed:")}
63
- `;b.forEach(C=>{y+=C}),t.fail(y)}};let h={};s.conflicts=function(d,b){A("<string|object> [array|string]",[d,b],arguments.length),typeof d=="object"?Object.keys(d).forEach(y=>{s.conflicts(y,d[y])}):(r.global(d),h[d]||(h[d]=[]),Array.isArray(b)?b.forEach(y=>s.conflicts(d,y)):h[d].push(b))},s.getConflicting=()=>h,s.conflicting=function(d){Object.keys(d).forEach(b=>{h[b]&&h[b].forEach(y=>{y&&d[b]!==void 0&&d[y]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",b,y))})}),r.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(h).forEach(b=>{h[b].forEach(y=>{y&&d[e.Parser.camelCase(b)]!==void 0&&d[e.Parser.camelCase(y)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",b,y))})})},s.recommendCommands=function(d,b){b=b.sort((p,M)=>M.length-p.length);let C=null,x=1/0;for(let p=0,M;(M=b[p])!==void 0;p++){let N=ys(d,M);N<=3&&N<x&&(x=N,C=M)}C&&t.fail(n("Did you mean %s?",C))},s.reset=function(d){return o=Yt(o,b=>!d[b]),h=Yt(h,b=>!d[b]),s};let g=[];return s.freeze=function(){g.push({implied:o,conflicting:h})},s.unfreeze=function(){let d=g.pop();mt(d,void 0,e),{implied:o,conflicting:h}=d},s}var Mr=[],We;function mn(r,t,e,n){We=n;let i={};if(Object.prototype.hasOwnProperty.call(r,"extends")){if(typeof r.extends!="string")return i;let s=/\.json|\..*rc$/.test(r.extends),o=null;if(s)o=Uc(t,r.extends);else try{o=V.resolve(r.extends)}catch{return r}Fc(o),Mr.push(o),i=s?JSON.parse(We.readFileSync(o,"utf8")):V(r.extends),delete r.extends,i=mn(i,We.path.dirname(o),e,We)}return Mr=[],e?Es(i,r):Object.assign({},i,r)}function Fc(r){if(Mr.indexOf(r)>-1)throw new Y(`Circular extended configurations: '${r}'.`)}function Uc(r,t){return We.path.resolve(r,t)}function Es(r,t){let e={};function n(i){return i&&typeof i=="object"&&!Array.isArray(i)}Object.assign(e,r);for(let i of Object.keys(t))n(t[i])&&n(e[i])?e[i]=Es(r[i],t[i]):e[i]=t[i];return e}var S=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},a=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},it,ie,Ve,Pt,yt,gn,Qt,se,bn,It,wn,vt,$t,xt,Dt,yn,Se,lt,D,xn,Cn,Ct,oe,Pe,ae,Jt,En,F,ce,le,fe,L,On,Ft,nt;function Ws(r){return(t=[],e=r.process.cwd(),n)=>{let i=new Vr(t,e,n,r);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}}var Os=Symbol("copyDoubleDash"),_s=Symbol("copyDoubleDash"),Tr=Symbol("deleteFromParserHintObject"),As=Symbol("emitWarning"),Ss=Symbol("freeze"),Ps=Symbol("getDollarZero"),ue=Symbol("getParserConfiguration"),Is=Symbol("getUsageConfiguration"),Nr=Symbol("guessLocale"),vs=Symbol("guessVersion"),Ds=Symbol("parsePositionalNumbers"),$r=Symbol("pkgUp"),Zt=Symbol("populateParserHintArray"),Ie=Symbol("populateParserHintSingleValueDictionary"),Fr=Symbol("populateParserHintArrayDictionary"),Ur=Symbol("populateParserHintDictionary"),Lr=Symbol("sanitizeKey"),zr=Symbol("setKey"),Rr=Symbol("unfreeze"),js=Symbol("validateAsync"),Ms=Symbol("getCommandInstance"),Ts=Symbol("getContext"),Ns=Symbol("getHasOutput"),$s=Symbol("getLoggerInstance"),Fs=Symbol("getParseContext"),Us=Symbol("getUsageInstance"),Ls=Symbol("getValidationInstance"),_n=Symbol("hasParseCallback"),zs=Symbol("isGlobalContext"),he=Symbol("postProcess"),Rs=Symbol("rebase"),Br=Symbol("reset"),He=Symbol("runYargsParserAndExecuteCommands"),Wr=Symbol("runValidation"),Bs=Symbol("setHasOutput"),de=Symbol("kTrackManuallySetKeys"),Vr=class{constructor(t=[],e,n,i){this.customScriptName=!1,this.parsed=!1,it.set(this,void 0),ie.set(this,void 0),Ve.set(this,{commands:[],fullCommands:[]}),Pt.set(this,null),yt.set(this,null),gn.set(this,"show-hidden"),Qt.set(this,null),se.set(this,!0),bn.set(this,{}),It.set(this,!0),wn.set(this,[]),vt.set(this,void 0),$t.set(this,{}),xt.set(this,!1),Dt.set(this,null),yn.set(this,!0),Se.set(this,void 0),lt.set(this,""),D.set(this,void 0),xn.set(this,void 0),Cn.set(this,{}),Ct.set(this,null),oe.set(this,null),Pe.set(this,{}),ae.set(this,{}),Jt.set(this,void 0),En.set(this,!1),F.set(this,void 0),ce.set(this,!1),le.set(this,!1),fe.set(this,!1),L.set(this,void 0),On.set(this,{}),Ft.set(this,null),nt.set(this,void 0),S(this,F,i,"f"),S(this,Jt,t,"f"),S(this,ie,e,"f"),S(this,xn,n,"f"),S(this,vt,new hn(this),"f"),this.$0=this[Ps](),this[Br](),S(this,it,a(this,it,"f"),"f"),S(this,L,a(this,L,"f"),"f"),S(this,nt,a(this,nt,"f"),"f"),S(this,D,a(this,D,"f"),"f"),a(this,D,"f").showHiddenOpt=a(this,gn,"f"),S(this,Se,this[_s](),"f")}addHelpOpt(t,e){let n="help";return A("[string|boolean] [string]",[t,e],arguments.length),a(this,Dt,"f")&&(this[Tr](a(this,Dt,"f")),S(this,Dt,null,"f")),t===!1&&e===void 0?this:(S(this,Dt,typeof t=="string"?t:n,"f"),this.boolean(a(this,Dt,"f")),this.describe(a(this,Dt,"f"),e||a(this,L,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(A("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;let n=typeof t=="string"?t:a(this,gn,"f");return this.boolean(n),this.describe(n,e||a(this,L,"f").deferY18nLookup("Show hidden options")),a(this,D,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return A("<object|string|array> [string|array]",[t,e],arguments.length),this[Fr](this.alias.bind(this),"alias",t,e),this}array(t){return A("<array|string>",[t],arguments.length),this[Zt]("array",t),this[de](t),this}boolean(t){return A("<array|string>",[t],arguments.length),this[Zt]("boolean",t),this[de](t),this}check(t,e){return A("<function> [boolean]",[t,e],arguments.length),this.middleware((n,i)=>re(()=>t(n,i.getOptions()),s=>(s?(typeof s=="string"||s instanceof Error)&&a(this,L,"f").fail(s.toString(),s):a(this,L,"f").fail(a(this,F,"f").y18n.__("Argument check failed: %s",t.toString())),n),s=>(a(this,L,"f").fail(s.message?s.message:s.toString(),s),n)),!1,e),this}choices(t,e){return A("<object|string|array> [string|array]",[t,e],arguments.length),this[Fr](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(A("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new Y("coerce callback must be provided");for(let n of t)this.coerce(n,e);return this}else if(typeof t=="object"){for(let n of Object.keys(t))this.coerce(n,t[n]);return this}if(!e)throw new Y("coerce callback must be provided");return a(this,D,"f").key[t]=!0,a(this,vt,"f").addCoerceMiddleware((n,i)=>{let s;return Object.prototype.hasOwnProperty.call(n,t)?re(()=>(s=i.getAliases(),e(n[t])),c=>{n[t]=c;let h=i.getInternalMethods().getParserConfiguration()["strip-aliased"];if(s[t]&&h!==!0)for(let g of s[t])n[g]=c;return n},c=>{throw new Y(c.message)}):n},t),this}conflicts(t,e){return A("<string|object> [string|array]",[t,e],arguments.length),a(this,nt,"f").conflicts(t,e),this}config(t="config",e,n){return A("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=mn(t,a(this,ie,"f"),this[ue]()["deep-merge-config"]||!1,a(this,F,"f")),a(this,D,"f").configObjects=(a(this,D,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||a(this,L,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(i=>{a(this,D,"f").config[i]=n||!0}),this)}completion(t,e,n){return A("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),S(this,yt,t||a(this,yt,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(a(this,yt,"f"),e),n&&a(this,Pt,"f").registerFunction(n),this}command(t,e,n,i,s,o){return A("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,i,s,o],arguments.length),a(this,it,"f").addHandler(t,e,n,i,s,o),this}commands(t,e,n,i,s,o){return this.command(t,e,n,i,s,o)}commandDir(t,e){A("<string> [object]",[t,e],arguments.length);let n=a(this,xn,"f")||a(this,F,"f").require;return a(this,it,"f").addDirectory(t,n,a(this,F,"f").getCallerFile(),e),this}count(t){return A("<array|string>",[t],arguments.length),this[Zt]("count",t),this[de](t),this}default(t,e,n){return A("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(Pr(t,a(this,F,"f")),a(this,D,"f").defaultDescription[t]=n),typeof e=="function"&&(Pr(t,a(this,F,"f")),a(this,D,"f").defaultDescription[t]||(a(this,D,"f").defaultDescription[t]=a(this,L,"f").functionDescription(e)),e=e.call()),this[Ie](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,i){return A("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,i],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),a(this,D,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:i},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(i=>{mt(n,!0,a(this,F,"f")),this.demandOption(i,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(mt(n,!0,a(this,F,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(i=>{mt(n,!0,a(this,F,"f")),this.demandOption(i,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return A("<object|string|array> [string]",[t,e],arguments.length),this[Ie](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return A("<string> [string|boolean]",[t,e],arguments.length),a(this,D,"f").deprecatedOptions[t]=e,this}describe(t,e){return A("<object|string|array> [string]",[t,e],arguments.length),this[zr](t,!0),a(this,L,"f").describe(t,e),this}detectLocale(t){return A("<boolean>",[t],arguments.length),S(this,se,t,"f"),this}env(t){return A("[string|boolean]",[t],arguments.length),t===!1?delete a(this,D,"f").envPrefix:a(this,D,"f").envPrefix=t||"",this}epilogue(t){return A("<string>",[t],arguments.length),a(this,L,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return A("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):a(this,L,"f").example(t,e),this}exit(t,e){S(this,xt,!0,"f"),S(this,Qt,e,"f"),a(this,It,"f")&&a(this,F,"f").process.exit(t)}exitProcess(t=!0){return A("[boolean]",[t],arguments.length),S(this,It,t,"f"),this}fail(t){if(A("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new Y("Invalid first argument. Expected function or boolean 'false'");return a(this,L,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return A("<array> [function]",[t,e],arguments.length),e?a(this,Pt,"f").getCompletion(t,e):new Promise((n,i)=>{a(this,Pt,"f").getCompletion(t,(s,o)=>{s?i(s):n(o)})})}getDemandedOptions(){return A([],0),a(this,D,"f").demandedOptions}getDemandedCommands(){return A([],0),a(this,D,"f").demandedCommands}getDeprecatedOptions(){return A([],0),a(this,D,"f").deprecatedOptions}getDetectLocale(){return a(this,se,"f")}getExitProcess(){return a(this,It,"f")}getGroups(){return Object.assign({},a(this,$t,"f"),a(this,ae,"f"))}getHelp(){if(S(this,xt,!0,"f"),!a(this,L,"f").hasCachedHelpMessage()){if(!this.parsed){let e=this[He](a(this,Jt,"f"),void 0,void 0,0,!0);if(K(e))return e.then(()=>a(this,L,"f").help())}let t=a(this,it,"f").runDefaultBuilderOn(this);if(K(t))return t.then(()=>a(this,L,"f").help())}return Promise.resolve(a(this,L,"f").help())}getOptions(){return a(this,D,"f")}getStrict(){return a(this,ce,"f")}getStrictCommands(){return a(this,le,"f")}getStrictOptions(){return a(this,fe,"f")}global(t,e){return A("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?a(this,D,"f").local=a(this,D,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{a(this,D,"f").local.includes(n)||a(this,D,"f").local.push(n)}),this}group(t,e){A("<string|array> <string>",[t,e],arguments.length);let n=a(this,ae,"f")[e]||a(this,$t,"f")[e];a(this,ae,"f")[e]&&delete a(this,ae,"f")[e];let i={};return a(this,$t,"f")[e]=(n||[]).concat(t).filter(s=>i[s]?!1:i[s]=!0),this}hide(t){return A("<string>",[t],arguments.length),a(this,D,"f").hiddenOptions.push(t),this}implies(t,e){return A("<string|object> [number|string|array]",[t,e],arguments.length),a(this,nt,"f").implies(t,e),this}locale(t){return A("[string]",[t],arguments.length),t===void 0?(this[Nr](),a(this,F,"f").y18n.getLocale()):(S(this,se,!1,"f"),a(this,F,"f").y18n.setLocale(t),this)}middleware(t,e,n){return a(this,vt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return A("<string|object|array> [number]",[t,e],arguments.length),this[Ie](this.nargs.bind(this),"narg",t,e),this}normalize(t){return A("<array|string>",[t],arguments.length),this[Zt]("normalize",t),this}number(t){return A("<array|string>",[t],arguments.length),this[Zt]("number",t),this[de](t),this}option(t,e){if(A("<string|object> [object]",[t,e],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof e!="object"&&(e={}),this[de](t),a(this,Ft,"f")&&(t==="version"||e?.alias==="version")&&this[As](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
64
- `),void 0,"versionWarning"),a(this,D,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);let n=e.deprecate||e.deprecated;n&&this.deprecateOption(t,n);let i=e.demand||e.required||e.require;i&&this.demand(t,i),e.demandOption&&this.demandOption(t,typeof e.demandOption=="string"?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),e.implies!==void 0&&this.implies(t,e.implies),e.nargs!==void 0&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||e.type==="boolean")&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||e.type==="array")&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||e.type==="number")&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||e.type==="string")&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||e.type==="count")&&this.count(t),typeof e.global=="boolean"&&this.global(t,e.global),e.defaultDescription&&(a(this,D,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);let s=e.describe||e.description||e.desc,o=a(this,L,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(o,t)||typeof s=="string")&&this.describe(t,s),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,n){A("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[Ss](),typeof t>"u"&&(t=a(this,Jt,"f")),typeof e=="object"&&(S(this,oe,e,"f"),e=n),typeof e=="function"&&(S(this,Ct,e,"f"),e=!1),e||S(this,Jt,t,"f"),a(this,Ct,"f")&&S(this,It,!1,"f");let i=this[He](t,!!e),s=this.parsed;return a(this,Pt,"f").setParsed(this.parsed),K(i)?i.then(o=>(a(this,Ct,"f")&&a(this,Ct,"f").call(this,a(this,Qt,"f"),o,a(this,lt,"f")),o)).catch(o=>{throw a(this,Ct,"f")&&a(this,Ct,"f")(o,this.parsed.argv,a(this,lt,"f")),o}).finally(()=>{this[Rr](),this.parsed=s}):(a(this,Ct,"f")&&a(this,Ct,"f").call(this,a(this,Qt,"f"),i,a(this,lt,"f")),this[Rr](),this.parsed=s,i)}parseAsync(t,e,n){let i=this.parse(t,e,n);return K(i)?i:Promise.resolve(i)}parseSync(t,e,n){let i=this.parse(t,e,n);if(K(i))throw new Y(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(t){return A("<object>",[t],arguments.length),S(this,Cn,t,"f"),this}pkgConf(t,e){A("<string> [string]",[t,e],arguments.length);let n=null,i=this[$r](e||a(this,ie,"f"));return i[t]&&typeof i[t]=="object"&&(n=mn(i[t],e||a(this,ie,"f"),this[ue]()["deep-merge-config"]||!1,a(this,F,"f")),a(this,D,"f").configObjects=(a(this,D,"f").configObjects||[]).concat(n)),this}positional(t,e){A("<string> <object>",[t,e],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=Yt(e,(o,c)=>o==="type"&&!["string","number","boolean"].includes(c)?!1:n.includes(o));let i=a(this,Ve,"f").fullCommands[a(this,Ve,"f").fullCommands.length-1],s=i?a(this,it,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return _e(s).forEach(o=>{let c=s[o];Array.isArray(c)?c.indexOf(t)!==-1&&(e[o]=!0):c[t]&&!(o in e)&&(e[o]=c[t])}),this.group(t,a(this,L,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return A("[boolean]",[t],arguments.length),S(this,En,t,"f"),this}required(t,e,n){return this.demand(t,e,n)}require(t,e,n){return this.demand(t,e,n)}requiresArg(t){return A("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&a(this,D,"f").narg[t]?this:(this[Ie](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return A("[string] [string]",[t,e],arguments.length),t=t||this.$0,a(this,Se,"f").log(a(this,Pt,"f").generateCompletionScript(t,e||a(this,yt,"f")||"completion")),this}showHelp(t){if(A("[string|function]",[t],arguments.length),S(this,xt,!0,"f"),!a(this,L,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[He](a(this,Jt,"f"),void 0,void 0,0,!0);if(K(n))return n.then(()=>{a(this,L,"f").showHelp(t)}),this}let e=a(this,it,"f").runDefaultBuilderOn(this);if(K(e))return e.then(()=>{a(this,L,"f").showHelp(t)}),this}return a(this,L,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return A("[boolean|string] [string]",[t,e],arguments.length),a(this,L,"f").showHelpOnFail(t,e),this}showVersion(t){return A("[string|function]",[t],arguments.length),a(this,L,"f").showVersion(t),this}skipValidation(t){return A("<array|string>",[t],arguments.length),this[Zt]("skipValidation",t),this}strict(t){return A("[boolean]",[t],arguments.length),S(this,ce,t!==!1,"f"),this}strictCommands(t){return A("[boolean]",[t],arguments.length),S(this,le,t!==!1,"f"),this}strictOptions(t){return A("[boolean]",[t],arguments.length),S(this,fe,t!==!1,"f"),this}string(t){return A("<array|string>",[t],arguments.length),this[Zt]("string",t),this[de](t),this}terminalWidth(){return A([],0),a(this,F,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return A("<object>",[t],arguments.length),S(this,se,!1,"f"),a(this,F,"f").y18n.updateLocale(t),this}usage(t,e,n,i){if(A("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,i],arguments.length),e!==void 0){if(mt(t,null,a(this,F,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,i);throw new Y(".usage() description must start with $0 if being used as alias for .command()")}else return a(this,L,"f").usage(t),this}usageConfiguration(t){return A("<object>",[t],arguments.length),S(this,On,t,"f"),this}version(t,e,n){let i="version";if(A("[boolean|string] [string] [string]",[t,e,n],arguments.length),a(this,Ft,"f")&&(this[Tr](a(this,Ft,"f")),a(this,L,"f").version(void 0),S(this,Ft,null,"f")),arguments.length===0)n=this[vs](),t=i;else if(arguments.length===1){if(t===!1)return this;n=t,t=i}else arguments.length===2&&(n=e,e=void 0);return S(this,Ft,typeof t=="string"?t:i,"f"),e=e||a(this,L,"f").deferY18nLookup("Show version number"),a(this,L,"f").version(n||void 0),this.boolean(a(this,Ft,"f")),this.describe(a(this,Ft,"f"),e),this}wrap(t){return A("<number|null|undefined>",[t],arguments.length),a(this,L,"f").wrap(t),this}[(it=new WeakMap,ie=new WeakMap,Ve=new WeakMap,Pt=new WeakMap,yt=new WeakMap,gn=new WeakMap,Qt=new WeakMap,se=new WeakMap,bn=new WeakMap,It=new WeakMap,wn=new WeakMap,vt=new WeakMap,$t=new WeakMap,xt=new WeakMap,Dt=new WeakMap,yn=new WeakMap,Se=new WeakMap,lt=new WeakMap,D=new WeakMap,xn=new WeakMap,Cn=new WeakMap,Ct=new WeakMap,oe=new WeakMap,Pe=new WeakMap,ae=new WeakMap,Jt=new WeakMap,En=new WeakMap,F=new WeakMap,ce=new WeakMap,le=new WeakMap,fe=new WeakMap,L=new WeakMap,On=new WeakMap,Ft=new WeakMap,nt=new WeakMap,Os)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[_s](){return{log:(...t)=>{this[_n]()||console.log(...t),S(this,xt,!0,"f"),a(this,lt,"f").length&&S(this,lt,a(this,lt,"f")+`
65
- `,"f"),S(this,lt,a(this,lt,"f")+t.join(" "),"f")},error:(...t)=>{this[_n]()||console.error(...t),S(this,xt,!0,"f"),a(this,lt,"f").length&&S(this,lt,a(this,lt,"f")+`
66
- `,"f"),S(this,lt,a(this,lt,"f")+t.join(" "),"f")}}}[Tr](t){_e(a(this,D,"f")).forEach(e=>{if((i=>i==="configObjects")(e))return;let n=a(this,D,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete a(this,L,"f").getDescriptions()[t]}[As](t,e,n){a(this,bn,"f")[n]||(a(this,F,"f").process.emitWarning(t,e),a(this,bn,"f")[n]=!0)}[Ss](){a(this,wn,"f").push({options:a(this,D,"f"),configObjects:a(this,D,"f").configObjects.slice(0),exitProcess:a(this,It,"f"),groups:a(this,$t,"f"),strict:a(this,ce,"f"),strictCommands:a(this,le,"f"),strictOptions:a(this,fe,"f"),completionCommand:a(this,yt,"f"),output:a(this,lt,"f"),exitError:a(this,Qt,"f"),hasOutput:a(this,xt,"f"),parsed:this.parsed,parseFn:a(this,Ct,"f"),parseContext:a(this,oe,"f")}),a(this,L,"f").freeze(),a(this,nt,"f").freeze(),a(this,it,"f").freeze(),a(this,vt,"f").freeze()}[Ps](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(a(this,F,"f").process.argv()[0])?e=a(this,F,"f").process.argv().slice(1,2):e=a(this,F,"f").process.argv().slice(0,1),t=e.map(n=>{let i=this[Rs](a(this,ie,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),a(this,F,"f").getEnv("_")&&a(this,F,"f").getProcessArgvBin()===a(this,F,"f").getEnv("_")&&(t=a(this,F,"f").getEnv("_").replace(`${a(this,F,"f").path.dirname(a(this,F,"f").process.execPath())}/`,"")),t}[ue](){return a(this,Cn,"f")}[Is](){return a(this,On,"f")}[Nr](){if(!a(this,se,"f"))return;let t=a(this,F,"f").getEnv("LC_ALL")||a(this,F,"f").getEnv("LC_MESSAGES")||a(this,F,"f").getEnv("LANG")||a(this,F,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[vs](){return this[$r]().version||"unknown"}[Ds](t){let e=t["--"]?t["--"]:t._;for(let n=0,i;(i=e[n])!==void 0;n++)a(this,F,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(e[n]=Number(i));return t}[$r](t){let e=t||"*";if(a(this,Pe,"f")[e])return a(this,Pe,"f")[e];let n={};try{let i=t||a(this,F,"f").mainFilename;!t&&a(this,F,"f").path.extname(i)&&(i=a(this,F,"f").path.dirname(i));let s=a(this,F,"f").findUp(i,(o,c)=>{if(c.includes("package.json"))return"package.json"});mt(s,void 0,a(this,F,"f")),n=JSON.parse(a(this,F,"f").readFileSync(s,"utf8"))}catch{}return a(this,Pe,"f")[e]=n||{},a(this,Pe,"f")[e]}[Zt](t,e){e=[].concat(e),e.forEach(n=>{n=this[Lr](n),a(this,D,"f")[t].push(n)})}[Ie](t,e,n,i){this[Ur](t,e,n,i,(s,o,c)=>{a(this,D,"f")[s][o]=c})}[Fr](t,e,n,i){this[Ur](t,e,n,i,(s,o,c)=>{a(this,D,"f")[s][o]=(a(this,D,"f")[s][o]||[]).concat(c)})}[Ur](t,e,n,i,s){if(Array.isArray(n))n.forEach(o=>{t(o,i)});else if((o=>typeof o=="object")(n))for(let o of _e(n))t(o,n[o]);else s(e,this[Lr](n),i)}[Lr](t){return t==="__proto__"?"___proto___":t}[zr](t,e){return this[Ie](this[zr].bind(this),"key",t,e),this}[Rr](){var t,e,n,i,s,o,c,h,g,m,d,b;let y=a(this,wn,"f").pop();mt(y,void 0,a(this,F,"f"));let C;t=this,e=this,n=this,i=this,s=this,o=this,c=this,h=this,g=this,m=this,d=this,b=this,{options:{set value(x){S(t,D,x,"f")}}.value,configObjects:C,exitProcess:{set value(x){S(e,It,x,"f")}}.value,groups:{set value(x){S(n,$t,x,"f")}}.value,output:{set value(x){S(i,lt,x,"f")}}.value,exitError:{set value(x){S(s,Qt,x,"f")}}.value,hasOutput:{set value(x){S(o,xt,x,"f")}}.value,parsed:this.parsed,strict:{set value(x){S(c,ce,x,"f")}}.value,strictCommands:{set value(x){S(h,le,x,"f")}}.value,strictOptions:{set value(x){S(g,fe,x,"f")}}.value,completionCommand:{set value(x){S(m,yt,x,"f")}}.value,parseFn:{set value(x){S(d,Ct,x,"f")}}.value,parseContext:{set value(x){S(b,oe,x,"f")}}.value}=y,a(this,D,"f").configObjects=C,a(this,L,"f").unfreeze(),a(this,nt,"f").unfreeze(),a(this,it,"f").unfreeze(),a(this,vt,"f").unfreeze()}[js](t,e){return re(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Ms].bind(this),getContext:this[Ts].bind(this),getHasOutput:this[Ns].bind(this),getLoggerInstance:this[$s].bind(this),getParseContext:this[Fs].bind(this),getParserConfiguration:this[ue].bind(this),getUsageConfiguration:this[Is].bind(this),getUsageInstance:this[Us].bind(this),getValidationInstance:this[Ls].bind(this),hasParseCallback:this[_n].bind(this),isGlobalContext:this[zs].bind(this),postProcess:this[he].bind(this),reset:this[Br].bind(this),runValidation:this[Wr].bind(this),runYargsParserAndExecuteCommands:this[He].bind(this),setHasOutput:this[Bs].bind(this)}}[Ms](){return a(this,it,"f")}[Ts](){return a(this,Ve,"f")}[Ns](){return a(this,xt,"f")}[$s](){return a(this,Se,"f")}[Fs](){return a(this,oe,"f")||{}}[Us](){return a(this,L,"f")}[Ls](){return a(this,nt,"f")}[_n](){return!!a(this,Ct,"f")}[zs](){return a(this,yn,"f")}[he](t,e,n,i){return n||K(t)||(e||(t=this[Os](t)),(this[ue]()["parse-positional-numbers"]||this[ue]()["parse-positional-numbers"]===void 0)&&(t=this[Ds](t)),i&&(t=ne(t,this,a(this,vt,"f").getMiddleware(),!1))),t}[Br](t={}){S(this,D,a(this,D,"f")||{},"f");let e={};e.local=a(this,D,"f").local||[],e.configObjects=a(this,D,"f").configObjects||[];let n={};e.local.forEach(o=>{n[o]=!0,(t[o]||[]).forEach(c=>{n[c]=!0})}),Object.assign(a(this,ae,"f"),Object.keys(a(this,$t,"f")).reduce((o,c)=>{let h=a(this,$t,"f")[c].filter(g=>!(g in n));return h.length>0&&(o[c]=h),o},{})),S(this,$t,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(o=>{e[o]=(a(this,D,"f")[o]||[]).filter(c=>!n[c])}),s.forEach(o=>{e[o]=Yt(a(this,D,"f")[o],c=>!n[c])}),e.envPrefix=a(this,D,"f").envPrefix,S(this,D,e,"f"),S(this,L,a(this,L,"f")?a(this,L,"f").reset(n):ms(this,a(this,F,"f")),"f"),S(this,nt,a(this,nt,"f")?a(this,nt,"f").reset(n):Cs(this,a(this,L,"f"),a(this,F,"f")),"f"),S(this,it,a(this,it,"f")?a(this,it,"f").reset():hs(a(this,L,"f"),a(this,nt,"f"),a(this,vt,"f"),a(this,F,"f")),"f"),a(this,Pt,"f")||S(this,Pt,ws(this,a(this,L,"f"),a(this,it,"f"),a(this,F,"f")),"f"),a(this,vt,"f").reset(),S(this,yt,null,"f"),S(this,lt,"","f"),S(this,Qt,null,"f"),S(this,xt,!1,"f"),this.parsed=!1,this}[Rs](t,e){return a(this,F,"f").path.relative(t,e)}[He](t,e,n,i=0,s=!1){let o=!!n||s;t=t||a(this,Jt,"f"),a(this,D,"f").__=a(this,F,"f").y18n.__,a(this,D,"f").configuration=this[ue]();let c=!!a(this,D,"f").configuration["populate--"],h=Object.assign({},a(this,D,"f").configuration,{"populate--":!0}),g=a(this,F,"f").Parser.detailed(t,Object.assign({},a(this,D,"f"),{configuration:{"parse-positional-numbers":!1,...h}})),m=Object.assign(g.argv,a(this,oe,"f")),d,b=g.aliases,y=!1,C=!1;Object.keys(m).forEach(x=>{x===a(this,Dt,"f")&&m[x]?y=!0:x===a(this,Ft,"f")&&m[x]&&(C=!0)}),m.$0=this.$0,this.parsed=g,i===0&&a(this,L,"f").clearCachedHelpMessage();try{if(this[Nr](),e)return this[he](m,c,!!n,!1);a(this,Dt,"f")&&[a(this,Dt,"f")].concat(b[a(this,Dt,"f")]||[]).filter(R=>R.length>1).includes(""+m._[m._.length-1])&&(m._.pop(),y=!0),S(this,yn,!1,"f");let x=a(this,it,"f").getCommands(),p=a(this,Pt,"f").completionKey in m,M=y||p||s;if(m._.length){if(x.length){let N;for(let R=i||0,U;m._[R]!==void 0;R++)if(U=String(m._[R]),x.includes(U)&&U!==a(this,yt,"f")){let B=a(this,it,"f").runCommand(U,this,g,R+1,s,y||C||s);return this[he](B,c,!!n,!1)}else if(!N&&U!==a(this,yt,"f")){N=U;break}!a(this,it,"f").hasDefaultCommand()&&a(this,En,"f")&&N&&!M&&a(this,nt,"f").recommendCommands(N,x)}a(this,yt,"f")&&m._.includes(a(this,yt,"f"))&&!p&&(a(this,It,"f")&&Kt(!0),this.showCompletionScript(),this.exit(0))}if(a(this,it,"f").hasDefaultCommand()&&!M){let N=a(this,it,"f").runCommand(null,this,g,0,s,y||C||s);return this[he](N,c,!!n,!1)}if(p){a(this,It,"f")&&Kt(!0),t=[].concat(t);let N=t.slice(t.indexOf(`--${a(this,Pt,"f").completionKey}`)+1);return a(this,Pt,"f").getCompletion(N,(R,U)=>{if(R)throw new Y(R.message);(U||[]).forEach(B=>{a(this,Se,"f").log(B)}),this.exit(0)}),this[he](m,!c,!!n,!1)}if(a(this,xt,"f")||(y?(a(this,It,"f")&&Kt(!0),o=!0,this.showHelp("log"),this.exit(0)):C&&(a(this,It,"f")&&Kt(!0),o=!0,a(this,L,"f").showVersion("log"),this.exit(0))),!o&&a(this,D,"f").skipValidation.length>0&&(o=Object.keys(m).some(N=>a(this,D,"f").skipValidation.indexOf(N)>=0&&m[N]===!0)),!o){if(g.error)throw new Y(g.error.message);if(!p){let N=this[Wr](b,{},g.error);n||(d=ne(m,this,a(this,vt,"f").getMiddleware(),!0)),d=this[js](N,d??m),K(d)&&!n&&(d=d.then(()=>ne(m,this,a(this,vt,"f").getMiddleware(),!1)))}}}catch(x){if(x instanceof Y)a(this,L,"f").fail(x.message,x);else throw x}return this[he](d??m,c,!!n,!0)}[Wr](t,e,n,i){let s={...this.getDemandedOptions()};return o=>{if(n)throw new Y(n.message);a(this,nt,"f").nonOptionCount(o),a(this,nt,"f").requiredArguments(o,s);let c=!1;a(this,le,"f")&&(c=a(this,nt,"f").unknownCommands(o)),a(this,ce,"f")&&!c?a(this,nt,"f").unknownArguments(o,t,e,!!i):a(this,fe,"f")&&a(this,nt,"f").unknownArguments(o,t,{},!1,!1),a(this,nt,"f").limitedChoices(o),a(this,nt,"f").implications(o),a(this,nt,"f").conflicting(o)}}[Bs](){S(this,xt,!0,"f")}[de](t){if(typeof t=="string")a(this,D,"f").key[t]=!0;else for(let e of t)a(this,D,"f").key[e]=!0}};function ds(r){return!!r&&typeof r.getInternalMethods=="function"}var Lc=Ws(as),Vs=Lc;var Ys=Ye(qs(),1),Bc={},zc=process.argv.slice(2),Gs=new Ys.default(Vs),qr=console.log;async function Gr(r){Gs.yargs.option("listen",{desc:"daemon control listen multiaddr",type:"string",default:"/unix/tmp/p2pd.sock"}).option("quiet",{alias:"q",desc:"be quiet",type:"boolean",default:!1}).option("id",{desc:"peer identity; private key file",type:"string",default:""}).option("hostAddrs",{desc:"Comma separated list of multiaddrs the host should listen on",type:"string",default:""}).option("announceAddrs",{desc:"Comma separated list of multiaddrs the host should announce to the network",type:"string",default:""}).option("bootstrap",{alias:"b",desc:"Connects to bootstrap peers and bootstraps the dht if enabled",type:"boolean",default:!1}).option("bootstrapPeers",{desc:"Comma separated list of bootstrap peers; defaults to the IPFS DHT peers",type:"string",default:""}).option("dht",{desc:"Enables the DHT in full node mode",type:"boolean",default:!1}).option("dhtClient",{desc:"(Not yet supported) Enables the DHT in client mode",type:"boolean",default:!1}).option("nat",{desc:"Enables UPnP NAT hole punching",type:"boolean",default:!1}).option("connMgr",{desc:"(Not yet supported) Enables the Connection Manager",type:"boolean",default:!1}).option("connMgrLo",{desc:"Number identifying the number of peers below which this node will not activate preemptive disconnections",type:"number"}).option("connMgrHi",{desc:"Number identifying the maximum number of peers the current peer is willing to be connected to before is starts disconnecting",type:"number"}).option("pubsub",{desc:"Enables pubsub",type:"boolean",default:!1}).option("pubsubRouter",{desc:"Specifies the pubsub router implementation",type:"string",default:"gossipsub"}).fail((i,s,o)=>{if(s!=null)throw s;zc.length>0&&qr(i),o.showHelp()});let{data:t,argv:e}=await Gs.parse(r);t!=null&&(qr(t),process.exit(0)),await(await Ks(ze(e.listen),e)).start(),e.quiet!==!0&&qr("daemon has started")}async function Ks(r,t){throw new Error("Not implemented yet")}wr(Bc)&&Gr(process.argv).catch(r=>{console.error(r),process.exit(1)});return eo(Rc);})();
76
+ `)}`:"";e.fail(i("Missing required argument: %s","Missing required arguments: %s",Object.keys(E).length,Object.keys(E).join(", ")+b))}},s.unknownArguments=function(l,F,E,C,b=!0){var d;let I=t.getInternalMethods().getCommandInstance().getCommands(),z=[],L=t.getInternalMethods().getContext();if(Object.keys(l).forEach(U=>{!Ys.includes(U)&&!Object.prototype.hasOwnProperty.call(E,U)&&!Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),U)&&!s.isValidAndSomeAliasIsNotNew(U,F)&&z.push(U)}),b&&(L.commands.length>0||I.length>0||C)&&l._.slice(L.commands.length).forEach(U=>{I.includes(""+U)||z.push(""+U)}),b){let R=((d=t.getDemandedCommands()._)===null||d===void 0?void 0:d.max)||0,W=L.commands.length+R;W<l._.length&&l._.slice(W).forEach(H=>{H=String(H),!L.commands.includes(H)&&!z.includes(H)&&z.push(H)})}z.length&&e.fail(i("Unknown argument: %s","Unknown arguments: %s",z.length,z.map(U=>U.trim()?U:`"${U}"`).join(", ")))},s.unknownCommands=function(l){let F=t.getInternalMethods().getCommandInstance().getCommands(),E=[],C=t.getInternalMethods().getContext();return(C.commands.length>0||F.length>0)&&l._.slice(C.commands.length).forEach(b=>{F.includes(""+b)||E.push(""+b)}),E.length>0?(e.fail(i("Unknown command: %s","Unknown commands: %s",E.length,E.join(", "))),!0):!1},s.isValidAndSomeAliasIsNotNew=function(l,F){if(!Object.prototype.hasOwnProperty.call(F,l))return!1;let E=t.parsed.newAliases;return[l,...F[l]].some(C=>!Object.prototype.hasOwnProperty.call(E,C)||!E[l])},s.limitedChoices=function(l){let F=t.getOptions(),E={};if(!Object.keys(F.choices).length)return;Object.keys(l).forEach(d=>{Ys.indexOf(d)===-1&&Object.prototype.hasOwnProperty.call(F.choices,d)&&[].concat(l[d]).forEach(I=>{F.choices[d].indexOf(I)===-1&&I!==void 0&&(E[d]=(E[d]||[]).concat(I))})});let C=Object.keys(E);if(!C.length)return;let b=r("Invalid values:");C.forEach(d=>{b+=`
77
+ ${r("Argument: %s, Given: %s, Choices: %s",d,e.stringifiedValues(E[d]),e.stringifiedValues(F.choices[d]))}`}),e.fail(b)};let o={};s.implies=function(l,F){A("<string|object> [array|number|string]",[l,F],arguments.length),typeof l=="object"?Object.keys(l).forEach(E=>{s.implies(E,l[E])}):(t.global(l),o[l]||(o[l]=[]),Array.isArray(F)?F.forEach(E=>s.implies(l,E)):(Fe(F,void 0,n),o[l].push(F)))},s.getImplied=function(){return o};function a(m,l){let F=Number(l);return l=isNaN(F)?l:F,typeof l=="number"?l=m._.length>=l:l.match(/^--no-.+/)?(l=l.match(/^--no-(.+)/)[1],l=!Object.prototype.hasOwnProperty.call(m,l)):l=Object.prototype.hasOwnProperty.call(m,l),l}s.implications=function(l){let F=[];if(Object.keys(o).forEach(E=>{let C=E;(o[E]||[]).forEach(b=>{let d=C,I=b;d=a(l,d),b=a(l,b),d&&!b&&F.push(` ${C} -> ${I}`)})}),F.length){let E=`${r("Implications failed:")}
78
+ `;F.forEach(C=>{E+=C}),e.fail(E)}};let f={};s.conflicts=function(l,F){A("<string|object> [array|string]",[l,F],arguments.length),typeof l=="object"?Object.keys(l).forEach(E=>{s.conflicts(E,l[E])}):(t.global(l),f[l]||(f[l]=[]),Array.isArray(F)?F.forEach(E=>s.conflicts(l,E)):f[l].push(F))},s.getConflicting=()=>f,s.conflicting=function(l){Object.keys(l).forEach(F=>{f[F]&&f[F].forEach(E=>{E&&l[F]!==void 0&&l[E]!==void 0&&e.fail(r("Arguments %s and %s are mutually exclusive",F,E))})}),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(f).forEach(F=>{f[F].forEach(E=>{E&&l[n.Parser.camelCase(F)]!==void 0&&l[n.Parser.camelCase(E)]!==void 0&&e.fail(r("Arguments %s and %s are mutually exclusive",F,E))})})},s.recommendCommands=function(l,F){F=F.sort((d,I)=>I.length-d.length);let C=null,b=1/0;for(let d=0,I;(I=F[d])!==void 0;d++){let z=qs(l,I);z<=3&&z<b&&(b=z,C=I)}C&&e.fail(r("Did you mean %s?",C))},s.reset=function(l){return o=ke(o,F=>!l[F]),f=ke(f,F=>!l[F]),s};let p=[];return s.freeze=function(){p.push({implied:o,conflicting:f})},s.unfreeze=function(){let l=p.pop();Fe(l,void 0,n),{implied:o,conflicting:f}=l},s}var wc={},Vr=[],Gt;function En(t,e,n,r){Gt=r;let i={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if(typeof t.extends!="string")return i;let s=/\.json|\..*rc$/.test(t.extends),o=null;if(s)o=xc(e,t.extends);else try{o=wc.resolve(t.extends)}catch{return t}bc(o),Vr.push(o),i=s?JSON.parse(Gt.readFileSync(o,"utf8")):r.require(t.extends),delete t.extends,i=En(i,Gt.path.dirname(o),n,Gt)}return Vr=[],n?ks(i,t):Object.assign({},i,t)}function bc(t){if(Vr.indexOf(t)>-1)throw new oe(`Circular extended configurations: '${t}'.`)}function xc(t,e){return Gt.path.resolve(t,e)}function ks(t,e){let n={};function r(i){return i&&typeof i=="object"&&!Array.isArray(i)}Object.assign(n,t);for(let i of Object.keys(e))r(e[i])&&r(n[i])?n[i]=ks(t[i],e[i]):n[i]=e[i];return n}var B=function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},u=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},ue,ut,qt,ge,we,bn,Qe,at,xn,ve,wn,Pe,$e,ye,Ie,yn,ct,De,v,An,Bn,Ae,lt,Pt,ft,Ze,On,T,Dt,ht,dt,N,_n,Le,ie;function mo(t){return(e=[],n=t.process.cwd(),r)=>{let i=new ei(e,n,r,t);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}}var Js=Symbol("copyDoubleDash"),Qs=Symbol("copyDoubleDash"),Hr=Symbol("deleteFromParserHintObject"),Zs=Symbol("emitWarning"),Xs=Symbol("freeze"),eo=Symbol("getDollarZero"),pt=Symbol("getParserConfiguration"),to=Symbol("getUsageConfiguration"),Gr=Symbol("guessLocale"),no=Symbol("guessVersion"),ro=Symbol("parsePositionalNumbers"),qr=Symbol("pkgUp"),Xe=Symbol("populateParserHintArray"),It=Symbol("populateParserHintSingleValueDictionary"),Yr=Symbol("populateParserHintArrayDictionary"),Kr=Symbol("populateParserHintDictionary"),kr=Symbol("sanitizeKey"),Jr=Symbol("setKey"),Qr=Symbol("unfreeze"),io=Symbol("validateAsync"),so=Symbol("getCommandInstance"),oo=Symbol("getContext"),uo=Symbol("getHasOutput"),ao=Symbol("getLoggerInstance"),co=Symbol("getParseContext"),lo=Symbol("getUsageInstance"),fo=Symbol("getValidationInstance"),Sn=Symbol("hasParseCallback"),Do=Symbol("isGlobalContext"),mt=Symbol("postProcess"),ho=Symbol("rebase"),Zr=Symbol("reset"),Yt=Symbol("runYargsParserAndExecuteCommands"),Xr=Symbol("runValidation"),po=Symbol("setHasOutput"),Ft=Symbol("kTrackManuallySetKeys"),yc="en_US",ei=class{constructor(e=[],n,r,i){this.customScriptName=!1,this.parsed=!1,ue.set(this,void 0),ut.set(this,void 0),qt.set(this,{commands:[],fullCommands:[]}),ge.set(this,null),we.set(this,null),bn.set(this,"show-hidden"),Qe.set(this,null),at.set(this,!0),xn.set(this,{}),ve.set(this,!0),wn.set(this,[]),Pe.set(this,void 0),$e.set(this,{}),ye.set(this,!1),Ie.set(this,null),yn.set(this,!0),ct.set(this,void 0),De.set(this,""),v.set(this,void 0),An.set(this,void 0),Bn.set(this,{}),Ae.set(this,null),lt.set(this,null),Pt.set(this,{}),ft.set(this,{}),Ze.set(this,void 0),On.set(this,!1),T.set(this,void 0),Dt.set(this,!1),ht.set(this,!1),dt.set(this,!1),N.set(this,void 0),_n.set(this,{}),Le.set(this,null),ie.set(this,void 0),B(this,T,i,"f"),B(this,Ze,e,"f"),B(this,ut,n,"f"),B(this,An,r,"f"),B(this,Pe,new Fn(this),"f"),this.$0=this[eo](),this[Zr](),B(this,ue,u(this,ue,"f"),"f"),B(this,N,u(this,N,"f"),"f"),B(this,ie,u(this,ie,"f"),"f"),B(this,v,u(this,v,"f"),"f"),u(this,v,"f").showHiddenOpt=u(this,bn,"f"),B(this,ct,this[Qs](),"f"),u(this,T,"f").y18n.setLocale(yc)}addHelpOpt(e,n){let r="help";return A("[string|boolean] [string]",[e,n],arguments.length),u(this,Ie,"f")&&(this[Hr](u(this,Ie,"f")),B(this,Ie,null,"f")),e===!1&&n===void 0?this:(B(this,Ie,typeof e=="string"?e:r,"f"),this.boolean(u(this,Ie,"f")),this.describe(u(this,Ie,"f"),n||u(this,N,"f").deferY18nLookup("Show help")),this)}help(e,n){return this.addHelpOpt(e,n)}addShowHiddenOpt(e,n){if(A("[string|boolean] [string]",[e,n],arguments.length),e===!1&&n===void 0)return this;let r=typeof e=="string"?e:u(this,bn,"f");return this.boolean(r),this.describe(r,n||u(this,N,"f").deferY18nLookup("Show hidden options")),u(this,v,"f").showHiddenOpt=r,this}showHidden(e,n){return this.addShowHiddenOpt(e,n)}alias(e,n){return A("<object|string|array> [string|array]",[e,n],arguments.length),this[Yr](this.alias.bind(this),"alias",e,n),this}array(e){return A("<array|string>",[e],arguments.length),this[Xe]("array",e),this[Ft](e),this}boolean(e){return A("<array|string>",[e],arguments.length),this[Xe]("boolean",e),this[Ft](e),this}check(e,n){return A("<function> [boolean]",[e,n],arguments.length),this.middleware((r,i)=>ot(()=>e(r,i.getOptions()),s=>(s?(typeof s=="string"||s instanceof Error)&&u(this,N,"f").fail(s.toString(),s):u(this,N,"f").fail(u(this,T,"f").y18n.__("Argument check failed: %s",e.toString())),r),s=>(u(this,N,"f").fail(s.message?s.message:s.toString(),s),r)),!1,n),this}choices(e,n){return A("<object|string|array> [string|array]",[e,n],arguments.length),this[Yr](this.choices.bind(this),"choices",e,n),this}coerce(e,n){if(A("<object|string|array> [function]",[e,n],arguments.length),Array.isArray(e)){if(!n)throw new oe("coerce callback must be provided");for(let i of e)this.coerce(i,n);return this}else if(typeof e=="object"){for(let i of Object.keys(e))this.coerce(i,e[i]);return this}if(!n)throw new oe("coerce callback must be provided");let r=e;return u(this,v,"f").key[r]=!0,u(this,Pe,"f").addCoerceMiddleware((i,s)=>{var o;let a=(o=s.getAliases()[r])!==null&&o!==void 0?o:[],f=[r,...a].filter(p=>Object.prototype.hasOwnProperty.call(i,p));return f.length===0?i:ot(()=>n(i[f[0]]),p=>(f.forEach(m=>{i[m]=p}),i),p=>{throw new oe(p.message)})},r),this}conflicts(e,n){return A("<string|object> [string|array]",[e,n],arguments.length),u(this,ie,"f").conflicts(e,n),this}config(e="config",n,r){return A("[object|string] [string|function] [function]",[e,n,r],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=En(e,u(this,ut,"f"),this[pt]()["deep-merge-config"]||!1,u(this,T,"f")),u(this,v,"f").configObjects=(u(this,v,"f").configObjects||[]).concat(e),this):(typeof n=="function"&&(r=n,n=void 0),this.describe(e,n||u(this,N,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(i=>{u(this,v,"f").config[i]=r||!0}),this)}completion(e,n,r){return A("[string] [string|boolean|function] [function]",[e,n,r],arguments.length),typeof n=="function"&&(r=n,n=void 0),B(this,we,e||u(this,we,"f")||"completion","f"),!n&&n!==!1&&(n="generate completion script"),this.command(u(this,we,"f"),n),r&&u(this,ge,"f").registerFunction(r),this}command(e,n,r,i,s,o){return A("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,n,r,i,s,o],arguments.length),u(this,ue,"f").addHandler(e,n,r,i,s,o),this}commands(e,n,r,i,s,o){return this.command(e,n,r,i,s,o)}commandDir(e,n){A("<string> [object]",[e,n],arguments.length);let r=u(this,An,"f")||u(this,T,"f").require;return u(this,ue,"f").addDirectory(e,r,u(this,T,"f").getCallerFile(),n),this}count(e){return A("<array|string>",[e],arguments.length),this[Xe]("count",e),this[Ft](e),this}default(e,n,r){return A("<object|string|array> [*] [string]",[e,n,r],arguments.length),r&&(Ur(e,u(this,T,"f")),u(this,v,"f").defaultDescription[e]=r),typeof n=="function"&&(Ur(e,u(this,T,"f")),u(this,v,"f").defaultDescription[e]||(u(this,v,"f").defaultDescription[e]=u(this,N,"f").functionDescription(n)),n=n.call()),this[It](this.default.bind(this),"default",e,n),this}defaults(e,n,r){return this.default(e,n,r)}demandCommand(e=1,n,r,i){return A("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,n,r,i],arguments.length),typeof n!="number"&&(r=n,n=1/0),this.global("_",!1),u(this,v,"f").demandedCommands._={min:e,max:n,minMsg:r,maxMsg:i},this}demand(e,n,r){return Array.isArray(n)?(n.forEach(i=>{Fe(r,!0,u(this,T,"f")),this.demandOption(i,r)}),n=1/0):typeof n!="number"&&(r=n,n=1/0),typeof e=="number"?(Fe(r,!0,u(this,T,"f")),this.demandCommand(e,n,r,r)):Array.isArray(e)?e.forEach(i=>{Fe(r,!0,u(this,T,"f")),this.demandOption(i,r)}):typeof r=="string"?this.demandOption(e,r):(r===!0||typeof r>"u")&&this.demandOption(e),this}demandOption(e,n){return A("<object|string|array> [string]",[e,n],arguments.length),this[It](this.demandOption.bind(this),"demandedOptions",e,n),this}deprecateOption(e,n){return A("<string> [string|boolean]",[e,n],arguments.length),u(this,v,"f").deprecatedOptions[e]=n,this}describe(e,n){return A("<object|string|array> [string]",[e,n],arguments.length),this[Jr](e,!0),u(this,N,"f").describe(e,n),this}detectLocale(e){return A("<boolean>",[e],arguments.length),B(this,at,e,"f"),this}env(e){return A("[string|boolean]",[e],arguments.length),e===!1?delete u(this,v,"f").envPrefix:u(this,v,"f").envPrefix=e||"",this}epilogue(e){return A("<string>",[e],arguments.length),u(this,N,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,n){return A("<string|array> [string]",[e,n],arguments.length),Array.isArray(e)?e.forEach(r=>this.example(...r)):u(this,N,"f").example(e,n),this}exit(e,n){B(this,ye,!0,"f"),B(this,Qe,n,"f"),u(this,ve,"f")&&u(this,T,"f").process.exit(e)}exitProcess(e=!0){return A("[boolean]",[e],arguments.length),B(this,ve,e,"f"),this}fail(e){if(A("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new oe("Invalid first argument. Expected function or boolean 'false'");return u(this,N,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,n){return A("<array> [function]",[e,n],arguments.length),n?u(this,ge,"f").getCompletion(e,n):new Promise((r,i)=>{u(this,ge,"f").getCompletion(e,(s,o)=>{s?i(s):r(o)})})}getDemandedOptions(){return A([],0),u(this,v,"f").demandedOptions}getDemandedCommands(){return A([],0),u(this,v,"f").demandedCommands}getDeprecatedOptions(){return A([],0),u(this,v,"f").deprecatedOptions}getDetectLocale(){return u(this,at,"f")}getExitProcess(){return u(this,ve,"f")}getGroups(){return Object.assign({},u(this,$e,"f"),u(this,ft,"f"))}getHelp(){if(B(this,ye,!0,"f"),!u(this,N,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[Yt](u(this,Ze,"f"),void 0,void 0,0,!0);if(J(n))return n.then(()=>u(this,N,"f").help())}let e=u(this,ue,"f").runDefaultBuilderOn(this);if(J(e))return e.then(()=>u(this,N,"f").help())}return Promise.resolve(u(this,N,"f").help())}getOptions(){return u(this,v,"f")}getStrict(){return u(this,Dt,"f")}getStrictCommands(){return u(this,ht,"f")}getStrictOptions(){return u(this,dt,"f")}global(e,n){return A("<string|array> [boolean]",[e,n],arguments.length),e=[].concat(e),n!==!1?u(this,v,"f").local=u(this,v,"f").local.filter(r=>e.indexOf(r)===-1):e.forEach(r=>{u(this,v,"f").local.includes(r)||u(this,v,"f").local.push(r)}),this}group(e,n){A("<string|array> <string>",[e,n],arguments.length);let r=u(this,ft,"f")[n]||u(this,$e,"f")[n];u(this,ft,"f")[n]&&delete u(this,ft,"f")[n];let i={};return u(this,$e,"f")[n]=(r||[]).concat(e).filter(s=>i[s]?!1:i[s]=!0),this}hide(e){return A("<string>",[e],arguments.length),u(this,v,"f").hiddenOptions.push(e),this}implies(e,n){return A("<string|object> [number|string|array]",[e,n],arguments.length),u(this,ie,"f").implies(e,n),this}locale(e){return A("[string]",[e],arguments.length),e===void 0?(this[Gr](),u(this,T,"f").y18n.getLocale()):(B(this,at,!1,"f"),u(this,T,"f").y18n.setLocale(e),this)}middleware(e,n,r){return u(this,Pe,"f").addMiddleware(e,!!n,r)}nargs(e,n){return A("<string|object|array> [number]",[e,n],arguments.length),this[It](this.nargs.bind(this),"narg",e,n),this}normalize(e){return A("<array|string>",[e],arguments.length),this[Xe]("normalize",e),this}number(e){return A("<array|string>",[e],arguments.length),this[Xe]("number",e),this[Ft](e),this}option(e,n){if(A("<string|object> [object]",[e,n],arguments.length),typeof e=="object")Object.keys(e).forEach(r=>{this.options(r,e[r])});else{typeof n!="object"&&(n={}),this[Ft](e),u(this,Le,"f")&&(e==="version"||n?.alias==="version")&&this[Zs](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
79
+ `),void 0,"versionWarning"),u(this,v,"f").key[e]=!0,n.alias&&this.alias(e,n.alias);let r=n.deprecate||n.deprecated;r&&this.deprecateOption(e,r);let i=n.demand||n.required||n.require;i&&this.demand(e,i),n.demandOption&&this.demandOption(e,typeof n.demandOption=="string"?n.demandOption:void 0),n.conflicts&&this.conflicts(e,n.conflicts),"default"in n&&this.default(e,n.default),n.implies!==void 0&&this.implies(e,n.implies),n.nargs!==void 0&&this.nargs(e,n.nargs),n.config&&this.config(e,n.configParser),n.normalize&&this.normalize(e),n.choices&&this.choices(e,n.choices),n.coerce&&this.coerce(e,n.coerce),n.group&&this.group(e,n.group),(n.boolean||n.type==="boolean")&&(this.boolean(e),n.alias&&this.boolean(n.alias)),(n.array||n.type==="array")&&(this.array(e),n.alias&&this.array(n.alias)),(n.number||n.type==="number")&&(this.number(e),n.alias&&this.number(n.alias)),(n.string||n.type==="string")&&(this.string(e),n.alias&&this.string(n.alias)),(n.count||n.type==="count")&&this.count(e),typeof n.global=="boolean"&&this.global(e,n.global),n.defaultDescription&&(u(this,v,"f").defaultDescription[e]=n.defaultDescription),n.skipValidation&&this.skipValidation(e);let s=n.describe||n.description||n.desc,o=u(this,N,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(o,e)||typeof s=="string")&&this.describe(e,s),n.hidden&&this.hide(e),n.requiresArg&&this.requiresArg(e)}return this}options(e,n){return this.option(e,n)}parse(e,n,r){A("[string|array] [function|boolean|object] [function]",[e,n,r],arguments.length),this[Xs](),typeof e>"u"&&(e=u(this,Ze,"f")),typeof n=="object"&&(B(this,lt,n,"f"),n=r),typeof n=="function"&&(B(this,Ae,n,"f"),n=!1),n||B(this,Ze,e,"f"),u(this,Ae,"f")&&B(this,ve,!1,"f");let i=this[Yt](e,!!n),s=this.parsed;return u(this,ge,"f").setParsed(this.parsed),J(i)?i.then(o=>(u(this,Ae,"f")&&u(this,Ae,"f").call(this,u(this,Qe,"f"),o,u(this,De,"f")),o)).catch(o=>{throw u(this,Ae,"f")&&u(this,Ae,"f")(o,this.parsed.argv,u(this,De,"f")),o}).finally(()=>{this[Qr](),this.parsed=s}):(u(this,Ae,"f")&&u(this,Ae,"f").call(this,u(this,Qe,"f"),i,u(this,De,"f")),this[Qr](),this.parsed=s,i)}parseAsync(e,n,r){let i=this.parse(e,n,r);return J(i)?i:Promise.resolve(i)}parseSync(e,n,r){let i=this.parse(e,n,r);if(J(i))throw new oe(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(e){return A("<object>",[e],arguments.length),B(this,Bn,e,"f"),this}pkgConf(e,n){A("<string> [string]",[e,n],arguments.length);let r=null,i=this[qr](n||u(this,ut,"f"));return i[e]&&typeof i[e]=="object"&&(r=En(i[e],n||u(this,ut,"f"),this[pt]()["deep-merge-config"]||!1,u(this,T,"f")),u(this,v,"f").configObjects=(u(this,v,"f").configObjects||[]).concat(r)),this}positional(e,n){A("<string> <object>",[e,n],arguments.length);let r=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];n=ke(n,(o,a)=>o==="type"&&!["string","number","boolean"].includes(a)?!1:r.includes(o));let i=u(this,qt,"f").fullCommands[u(this,qt,"f").fullCommands.length-1],s=i?u(this,ue,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return St(s).forEach(o=>{let a=s[o];Array.isArray(a)?a.indexOf(e)!==-1&&(n[o]=!0):a[e]&&!(o in n)&&(n[o]=a[e])}),this.group(e,u(this,N,"f").getPositionalGroupName()),this.option(e,n)}recommendCommands(e=!0){return A("[boolean]",[e],arguments.length),B(this,On,e,"f"),this}required(e,n,r){return this.demand(e,n,r)}require(e,n,r){return this.demand(e,n,r)}requiresArg(e){return A("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&u(this,v,"f").narg[e]?this:(this[It](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,n){return A("[string] [string]",[e,n],arguments.length),e=e||this.$0,u(this,ct,"f").log(u(this,ge,"f").generateCompletionScript(e,n||u(this,we,"f")||"completion")),this}showHelp(e){if(A("[string|function]",[e],arguments.length),B(this,ye,!0,"f"),!u(this,N,"f").hasCachedHelpMessage()){if(!this.parsed){let r=this[Yt](u(this,Ze,"f"),void 0,void 0,0,!0);if(J(r))return r.then(()=>{u(this,N,"f").showHelp(e)}),this}let n=u(this,ue,"f").runDefaultBuilderOn(this);if(J(n))return n.then(()=>{u(this,N,"f").showHelp(e)}),this}return u(this,N,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,n){return A("[boolean|string] [string]",[e,n],arguments.length),u(this,N,"f").showHelpOnFail(e,n),this}showVersion(e){return A("[string|function]",[e],arguments.length),u(this,N,"f").showVersion(e),this}skipValidation(e){return A("<array|string>",[e],arguments.length),this[Xe]("skipValidation",e),this}strict(e){return A("[boolean]",[e],arguments.length),B(this,Dt,e!==!1,"f"),this}strictCommands(e){return A("[boolean]",[e],arguments.length),B(this,ht,e!==!1,"f"),this}strictOptions(e){return A("[boolean]",[e],arguments.length),B(this,dt,e!==!1,"f"),this}string(e){return A("<array|string>",[e],arguments.length),this[Xe]("string",e),this[Ft](e),this}terminalWidth(){return A([],0),u(this,T,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return A("<object>",[e],arguments.length),B(this,at,!1,"f"),u(this,T,"f").y18n.updateLocale(e),this}usage(e,n,r,i){if(A("<string|null|undefined> [string|boolean] [function|object] [function]",[e,n,r,i],arguments.length),n!==void 0){if(Fe(e,null,u(this,T,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,n,r,i);throw new oe(".usage() description must start with $0 if being used as alias for .command()")}else return u(this,N,"f").usage(e),this}usageConfiguration(e){return A("<object>",[e],arguments.length),B(this,_n,e,"f"),this}version(e,n,r){let i="version";if(A("[boolean|string] [string] [string]",[e,n,r],arguments.length),u(this,Le,"f")&&(this[Hr](u(this,Le,"f")),u(this,N,"f").version(void 0),B(this,Le,null,"f")),arguments.length===0)r=this[no](),e=i;else if(arguments.length===1){if(e===!1)return this;r=e,e=i}else arguments.length===2&&(r=n,n=void 0);return B(this,Le,typeof e=="string"?e:i,"f"),n=n||u(this,N,"f").deferY18nLookup("Show version number"),u(this,N,"f").version(r||void 0),this.boolean(u(this,Le,"f")),this.describe(u(this,Le,"f"),n),this}wrap(e){return A("<number|null|undefined>",[e],arguments.length),u(this,N,"f").wrap(e),this}[(ue=new WeakMap,ut=new WeakMap,qt=new WeakMap,ge=new WeakMap,we=new WeakMap,bn=new WeakMap,Qe=new WeakMap,at=new WeakMap,xn=new WeakMap,ve=new WeakMap,wn=new WeakMap,Pe=new WeakMap,$e=new WeakMap,ye=new WeakMap,Ie=new WeakMap,yn=new WeakMap,ct=new WeakMap,De=new WeakMap,v=new WeakMap,An=new WeakMap,Bn=new WeakMap,Ae=new WeakMap,lt=new WeakMap,Pt=new WeakMap,ft=new WeakMap,Ze=new WeakMap,On=new WeakMap,T=new WeakMap,Dt=new WeakMap,ht=new WeakMap,dt=new WeakMap,N=new WeakMap,_n=new WeakMap,Le=new WeakMap,ie=new WeakMap,Js)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[Qs](){return{log:(...e)=>{this[Sn]()||console.log(...e),B(this,ye,!0,"f"),u(this,De,"f").length&&B(this,De,u(this,De,"f")+`
80
+ `,"f"),B(this,De,u(this,De,"f")+e.join(" "),"f")},error:(...e)=>{this[Sn]()||console.error(...e),B(this,ye,!0,"f"),u(this,De,"f").length&&B(this,De,u(this,De,"f")+`
81
+ `,"f"),B(this,De,u(this,De,"f")+e.join(" "),"f")}}}[Hr](e){St(u(this,v,"f")).forEach(n=>{if((i=>i==="configObjects")(n))return;let r=u(this,v,"f")[n];Array.isArray(r)?r.includes(e)&&r.splice(r.indexOf(e),1):typeof r=="object"&&delete r[e]}),delete u(this,N,"f").getDescriptions()[e]}[Zs](e,n,r){u(this,xn,"f")[r]||(u(this,T,"f").process.emitWarning(e,n),u(this,xn,"f")[r]=!0)}[Xs](){u(this,wn,"f").push({options:u(this,v,"f"),configObjects:u(this,v,"f").configObjects.slice(0),exitProcess:u(this,ve,"f"),groups:u(this,$e,"f"),strict:u(this,Dt,"f"),strictCommands:u(this,ht,"f"),strictOptions:u(this,dt,"f"),completionCommand:u(this,we,"f"),output:u(this,De,"f"),exitError:u(this,Qe,"f"),hasOutput:u(this,ye,"f"),parsed:this.parsed,parseFn:u(this,Ae,"f"),parseContext:u(this,lt,"f")}),u(this,N,"f").freeze(),u(this,ie,"f").freeze(),u(this,ue,"f").freeze(),u(this,Pe,"f").freeze()}[eo](){let e="",n;return/\b(node|iojs|electron)(\.exe)?$/.test(u(this,T,"f").process.argv()[0])?n=u(this,T,"f").process.argv().slice(1,2):n=u(this,T,"f").process.argv().slice(0,1),e=n.map(r=>{let i=this[ho](u(this,ut,"f"),r);return r.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<r.length?i:r}).join(" ").trim(),u(this,T,"f").getEnv("_")&&u(this,T,"f").getProcessArgvBin()===u(this,T,"f").getEnv("_")&&(e=u(this,T,"f").getEnv("_").replace(`${u(this,T,"f").path.dirname(u(this,T,"f").process.execPath())}/`,"")),e}[pt](){return u(this,Bn,"f")}[to](){return u(this,_n,"f")}[Gr](){if(!u(this,at,"f"))return;let e=u(this,T,"f").getEnv("LC_ALL")||u(this,T,"f").getEnv("LC_MESSAGES")||u(this,T,"f").getEnv("LANG")||u(this,T,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[no](){return this[qr]().version||"unknown"}[ro](e){let n=e["--"]?e["--"]:e._;for(let r=0,i;(i=n[r])!==void 0;r++)u(this,T,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(n[r]=Number(i));return e}[qr](e){let n=e||"*";if(u(this,Pt,"f")[n])return u(this,Pt,"f")[n];let r={};try{let i=e||u(this,T,"f").mainFilename;u(this,T,"f").path.extname(i)&&(i=u(this,T,"f").path.dirname(i));let s=u(this,T,"f").findUp(i,(o,a)=>{if(a.includes("package.json"))return"package.json"});Fe(s,void 0,u(this,T,"f")),r=JSON.parse(u(this,T,"f").readFileSync(s,"utf8"))}catch{}return u(this,Pt,"f")[n]=r||{},u(this,Pt,"f")[n]}[Xe](e,n){n=[].concat(n),n.forEach(r=>{r=this[kr](r),u(this,v,"f")[e].push(r)})}[It](e,n,r,i){this[Kr](e,n,r,i,(s,o,a)=>{u(this,v,"f")[s][o]=a})}[Yr](e,n,r,i){this[Kr](e,n,r,i,(s,o,a)=>{u(this,v,"f")[s][o]=(u(this,v,"f")[s][o]||[]).concat(a)})}[Kr](e,n,r,i,s){if(Array.isArray(r))r.forEach(o=>{e(o,i)});else if((o=>typeof o=="object")(r))for(let o of St(r))e(o,r[o]);else s(n,this[kr](r),i)}[kr](e){return e==="__proto__"?"___proto___":e}[Jr](e,n){return this[It](this[Jr].bind(this),"key",e,n),this}[Qr](){var e,n,r,i,s,o,a,f,p,m,l,F;let E=u(this,wn,"f").pop();Fe(E,void 0,u(this,T,"f"));let C;e=this,n=this,r=this,i=this,s=this,o=this,a=this,f=this,p=this,m=this,l=this,F=this,{options:{set value(b){B(e,v,b,"f")}}.value,configObjects:C,exitProcess:{set value(b){B(n,ve,b,"f")}}.value,groups:{set value(b){B(r,$e,b,"f")}}.value,output:{set value(b){B(i,De,b,"f")}}.value,exitError:{set value(b){B(s,Qe,b,"f")}}.value,hasOutput:{set value(b){B(o,ye,b,"f")}}.value,parsed:this.parsed,strict:{set value(b){B(a,Dt,b,"f")}}.value,strictCommands:{set value(b){B(f,ht,b,"f")}}.value,strictOptions:{set value(b){B(p,dt,b,"f")}}.value,completionCommand:{set value(b){B(m,we,b,"f")}}.value,parseFn:{set value(b){B(l,Ae,b,"f")}}.value,parseContext:{set value(b){B(F,lt,b,"f")}}.value}=E,u(this,v,"f").configObjects=C,u(this,N,"f").unfreeze(),u(this,ie,"f").unfreeze(),u(this,ue,"f").unfreeze(),u(this,Pe,"f").unfreeze()}[io](e,n){return ot(n,r=>(e(r),r))}getInternalMethods(){return{getCommandInstance:this[so].bind(this),getContext:this[oo].bind(this),getHasOutput:this[uo].bind(this),getLoggerInstance:this[ao].bind(this),getParseContext:this[co].bind(this),getParserConfiguration:this[pt].bind(this),getUsageConfiguration:this[to].bind(this),getUsageInstance:this[lo].bind(this),getValidationInstance:this[fo].bind(this),hasParseCallback:this[Sn].bind(this),isGlobalContext:this[Do].bind(this),postProcess:this[mt].bind(this),reset:this[Zr].bind(this),runValidation:this[Xr].bind(this),runYargsParserAndExecuteCommands:this[Yt].bind(this),setHasOutput:this[po].bind(this)}}[so](){return u(this,ue,"f")}[oo](){return u(this,qt,"f")}[uo](){return u(this,ye,"f")}[ao](){return u(this,ct,"f")}[co](){return u(this,lt,"f")||{}}[lo](){return u(this,N,"f")}[fo](){return u(this,ie,"f")}[Sn](){return!!u(this,Ae,"f")}[Do](){return u(this,yn,"f")}[mt](e,n,r,i){return r||J(e)||(n||(e=this[Js](e)),(this[pt]()["parse-positional-numbers"]||this[pt]()["parse-positional-numbers"]===void 0)&&(e=this[ro](e)),i&&(e=st(e,this,u(this,Pe,"f").getMiddleware(),!1))),e}[Zr](e={}){B(this,v,u(this,v,"f")||{},"f");let n={};n.local=u(this,v,"f").local||[],n.configObjects=u(this,v,"f").configObjects||[];let r={};n.local.forEach(o=>{r[o]=!0,(e[o]||[]).forEach(a=>{r[a]=!0})}),Object.assign(u(this,ft,"f"),Object.keys(u(this,$e,"f")).reduce((o,a)=>{let f=u(this,$e,"f")[a].filter(p=>!(p in r));return f.length>0&&(o[a]=f),o},{})),B(this,$e,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(o=>{n[o]=(u(this,v,"f")[o]||[]).filter(a=>!r[a])}),s.forEach(o=>{n[o]=ke(u(this,v,"f")[o],a=>!r[a])}),n.envPrefix=u(this,v,"f").envPrefix,B(this,v,n,"f"),B(this,N,u(this,N,"f")?u(this,N,"f").reset(r):Ws(this,u(this,T,"f")),"f"),B(this,ie,u(this,ie,"f")?u(this,ie,"f").reset(r):Ks(this,u(this,N,"f"),u(this,T,"f")),"f"),B(this,ue,u(this,ue,"f")?u(this,ue,"f").reset():Us(u(this,N,"f"),u(this,ie,"f"),u(this,Pe,"f"),u(this,T,"f")),"f"),u(this,ge,"f")||B(this,ge,Gs(this,u(this,N,"f"),u(this,ue,"f"),u(this,T,"f")),"f"),u(this,Pe,"f").reset(),B(this,we,null,"f"),B(this,De,"","f"),B(this,Qe,null,"f"),B(this,ye,!1,"f"),this.parsed=!1,this}[ho](e,n){return u(this,T,"f").path.relative(e,n)}[Yt](e,n,r,i=0,s=!1){var o,a,f,p;let m=!!r||s;e=e||u(this,Ze,"f"),u(this,v,"f").__=u(this,T,"f").y18n.__,u(this,v,"f").configuration=this[pt]();let l=!!u(this,v,"f").configuration["populate--"],F=Object.assign({},u(this,v,"f").configuration,{"populate--":!0}),E=u(this,T,"f").Parser.detailed(e,Object.assign({},u(this,v,"f"),{configuration:{"parse-positional-numbers":!1,...F}})),C=Object.assign(E.argv,u(this,lt,"f")),b,d=E.aliases,I=!1,z=!1;Object.keys(C).forEach(L=>{L===u(this,Ie,"f")&&C[L]?I=!0:L===u(this,Le,"f")&&C[L]&&(z=!0)}),C.$0=this.$0,this.parsed=E,i===0&&u(this,N,"f").clearCachedHelpMessage();try{if(this[Gr](),n)return this[mt](C,l,!!r,!1);u(this,Ie,"f")&&[u(this,Ie,"f")].concat(d[u(this,Ie,"f")]||[]).filter(H=>H.length>1).includes(""+C._[C._.length-1])&&(C._.pop(),I=!0),B(this,yn,!1,"f");let L=u(this,ue,"f").getCommands(),U=!((o=u(this,ge,"f"))===null||o===void 0)&&o.completionKey?[(a=u(this,ge,"f"))===null||a===void 0?void 0:a.completionKey,...(p=this.getAliases()[(f=u(this,ge,"f"))===null||f===void 0?void 0:f.completionKey])!==null&&p!==void 0?p:[]].some(W=>Object.prototype.hasOwnProperty.call(C,W)):!1,R=I||U||s;if(C._.length){if(L.length){let W;for(let H=i||0,K;C._[H]!==void 0;H++)if(K=String(C._[H]),L.includes(K)&&K!==u(this,we,"f")){let de=u(this,ue,"f").runCommand(K,this,E,H+1,s,I||z||s);return this[mt](de,l,!!r,!1)}else if(!W&&K!==u(this,we,"f")){W=K;break}!u(this,ue,"f").hasDefaultCommand()&&u(this,On,"f")&&W&&!R&&u(this,ie,"f").recommendCommands(W,L)}u(this,we,"f")&&C._.includes(u(this,we,"f"))&&!U&&(u(this,ve,"f")&&Je(!0),this.showCompletionScript(),this.exit(0))}if(u(this,ue,"f").hasDefaultCommand()&&!R){let W=u(this,ue,"f").runCommand(null,this,E,0,s,I||z||s);return this[mt](W,l,!!r,!1)}if(U){u(this,ve,"f")&&Je(!0),e=[].concat(e);let W=e.slice(e.indexOf(`--${u(this,ge,"f").completionKey}`)+1);return u(this,ge,"f").getCompletion(W,(H,K)=>{if(H)throw new oe(H.message);(K||[]).forEach(de=>{u(this,ct,"f").log(de)}),this.exit(0)}),this[mt](C,!l,!!r,!1)}if(u(this,ye,"f")||(I?(u(this,ve,"f")&&Je(!0),m=!0,this.showHelp(W=>{u(this,ct,"f").log(W),this.exit(0)})):z&&(u(this,ve,"f")&&Je(!0),m=!0,u(this,N,"f").showVersion("log"),this.exit(0))),!m&&u(this,v,"f").skipValidation.length>0&&(m=Object.keys(C).some(W=>u(this,v,"f").skipValidation.indexOf(W)>=0&&C[W]===!0)),!m){if(E.error)throw new oe(E.error.message);if(!U){let W=this[Xr](d,{},E.error);r||(b=st(C,this,u(this,Pe,"f").getMiddleware(),!0)),b=this[io](W,b??C),J(b)&&!r&&(b=b.then(()=>st(C,this,u(this,Pe,"f").getMiddleware(),!1)))}}}catch(L){if(L instanceof oe)u(this,N,"f").fail(L.message,L);else throw L}return this[mt](b??C,l,!!r,!0)}[Xr](e,n,r,i){let s={...this.getDemandedOptions()};return o=>{if(r)throw new oe(r.message);u(this,ie,"f").nonOptionCount(o),u(this,ie,"f").requiredArguments(o,s);let a=!1;u(this,ht,"f")&&(a=u(this,ie,"f").unknownCommands(o)),u(this,Dt,"f")&&!a?u(this,ie,"f").unknownArguments(o,e,n,!!i):u(this,dt,"f")&&u(this,ie,"f").unknownArguments(o,e,{},!1,!1),u(this,ie,"f").limitedChoices(o),u(this,ie,"f").implications(o),u(this,ie,"f").conflicting(o)}}[po](){B(this,ye,!0,"f")}[Ft](e){if(typeof e=="string")u(this,v,"f").key[e]=!0;else for(let n of e)u(this,v,"f").key[n]=!0}};function zs(t){return!!t&&typeof t.getInternalMethods=="function"}var Ac=mo(js),Fo=Ac;var bo=gt(Co(),1),_c={},Bc=process.argv.slice(2),Eo=new bo.default(Fo),ni=console.log;async function ri(t){Eo.yargs.option("listen",{desc:"daemon control listen multiaddr",type:"string",default:"/unix/tmp/p2pd.sock"}).option("quiet",{alias:"q",desc:"be quiet",type:"boolean",default:!1}).option("id",{desc:"peer identity; private key file",type:"string",default:""}).option("hostAddrs",{desc:"Comma separated list of multiaddrs the host should listen on",type:"string",default:""}).option("announceAddrs",{desc:"Comma separated list of multiaddrs the host should announce to the network",type:"string",default:""}).option("bootstrap",{alias:"b",desc:"Connects to bootstrap peers and bootstraps the dht if enabled",type:"boolean",default:!1}).option("bootstrapPeers",{desc:"Comma separated list of bootstrap peers; defaults to the IPFS DHT peers",type:"string",default:""}).option("dht",{desc:"Enables the DHT in full node mode",type:"boolean",default:!1}).option("dhtClient",{desc:"(Not yet supported) Enables the DHT in client mode",type:"boolean",default:!1}).option("nat",{desc:"Enables UPnP NAT hole punching",type:"boolean",default:!1}).option("connMgr",{desc:"(Not yet supported) Enables the Connection Manager",type:"boolean",default:!1}).option("connMgrLo",{desc:"Number identifying the number of peers below which this node will not activate preemptive disconnections",type:"number"}).option("connMgrHi",{desc:"Number identifying the maximum number of peers the current peer is willing to be connected to before is starts disconnecting",type:"number"}).option("pubsub",{desc:"Enables pubsub",type:"boolean",default:!1}).option("pubsubRouter",{desc:"Specifies the pubsub router implementation",type:"string",default:"gossipsub"}).fail((i,s,o)=>{if(s!=null)throw s;Bc.length>0&&ni(i),o.showHelp()});let{data:e,argv:n}=await Eo.parse(t);e!=null&&(ni(e),process.exit(0)),await(await xo(Vt(n.listen),n)).start(),n.quiet!==!0&&ni("daemon has started")}async function xo(t,e){throw new Error("Not implemented yet")}yr(_c)&&ri(process.argv).catch(t=>{console.error(t),process.exit(1)});return _o(Oc);})();
67
82
  /*! Bundled license information:
68
83
 
69
84
  yargs-parser/build/lib/string-utils.js:
@@ -79,7 +94,6 @@ yargs-parser/build/lib/yargs-parser.js:
79
94
  yargs-parser/build/lib/index.js:
80
95
  (**
81
96
  * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
82
- * CJS and ESM environments.
83
97
  *
84
98
  * @license
85
99
  * Copyright (c) 2016, Contributors