@libp2p/daemon 2.0.9 → 3.0.0

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,15 @@
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 Ri=Object.create;var qe=Object.defineProperty;var Vi=Object.getOwnPropertyDescriptor;var qi=Object.getOwnPropertyNames;var Hi=Object.getPrototypeOf,Gi=Object.prototype.hasOwnProperty;var H=(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 new Error('Dynamic require of "'+r+'" is not supported')});var je=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),gt=(r,t)=>{for(var e in t)qe(r,e,{get:t[e],enumerable:!0})},Lr=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of qi(t))!Gi.call(r,s)&&s!==e&&qe(r,s,{get:()=>t[s],enumerable:!(n=Vi(t,s))||n.enumerable});return r};var kt=(r,t,e)=>(e=r!=null?Ri(Hi(r)):{},Lr(t||!r||!r.__esModule?qe(e,"default",{value:r,enumerable:!0}):e,r)),Yi=r=>Lr(qe({},"__esModule",{value:!0}),r);var cs=je((yl,as)=>{as.exports=Jn;var os=128,aa=127,ca=~aa,la=Math.pow(2,31);function Jn(r,t,e){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw Jn.bytes=0,new RangeError("Could not encode varint");t=t||[],e=e||0;for(var n=e;r>=la;)t[e++]=r&255|os,r/=128;for(;r&ca;)t[e++]=r&255|os,r>>>=7;return t[e]=r|0,Jn.bytes=e-n+1,t}});var hs=je((xl,fs)=>{fs.exports=Qn;var fa=128,ls=127;function Qn(r,n){var e=0,n=n||0,s=0,i=n,o,c=r.length;do{if(i>=c||s>49)throw Qn.bytes=0,new RangeError("Could not decode varint");o=r[i++],e+=s<28?(o&ls)<<s:(o&ls)*Math.pow(2,s),s+=7}while(o>=fa);return Qn.bytes=i-n,e}});var ds=je((Ol,us)=>{var ha=Math.pow(2,7),ua=Math.pow(2,14),da=Math.pow(2,21),pa=Math.pow(2,28),ma=Math.pow(2,35),ga=Math.pow(2,42),ba=Math.pow(2,49),wa=Math.pow(2,56),ya=Math.pow(2,63);us.exports=function(r){return r<ha?1:r<ua?2:r<da?3:r<pa?4:r<ma?5:r<ga?6:r<ba?7:r<wa?8:r<ya?9:10}});var Qe=je((Al,ps)=>{ps.exports={encode:cs(),decode:hs(),encodingLength:ds()}});var zi=je((_u,Fi)=>{var $r=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((s,i)=>{let o=Object.assign({},this.ctx,{resolve:s,reject:i});e.parse(t,o,function(c,m,w){return n=m,c?m.reject(c):m.resolve(w)})}).then(s=>Promise.resolve(s)).then(s=>s&&s.argv?s:{data:s,argv:n}).catch(s=>Promise.resolve(s).then(i=>i&&i.argv?Promise.reject(i):Promise.reject({error:i,argv:n})))}};Fi.exports=$r});var Oc={};gt(Oc,{createLibp2pServer:()=>Bi,default:()=>Ur});var Rt=H("node:net");function He(r){return!!(0,Rt.isIP)(r)}var jn={};gt(jn,{identity:()=>ki});function Ki(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 s=0;s<r.length;s++){var i=r.charAt(s),o=i.charCodeAt(0);if(e[o]!==255)throw new TypeError(i+" is ambiguous");e[o]=s}var c=r.length,m=r.charAt(0),w=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function h(x){if(x instanceof Uint8Array||(ArrayBuffer.isView(x)?x=new Uint8Array(x.buffer,x.byteOffset,x.byteLength):Array.isArray(x)&&(x=Uint8Array.from(x))),!(x instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(x.length===0)return"";for(var O=0,p=0,N=0,U=x.length;N!==U&&x[N]===0;)N++,O++;for(var W=(U-N)*d+1>>>0,z=new Uint8Array(W);N!==U;){for(var B=x[N],ft=0,Z=W-1;(B!==0||ft<p)&&Z!==-1;Z--,ft++)B+=256*z[Z]>>>0,z[Z]=B%c>>>0,B=B/c>>>0;if(B!==0)throw new Error("Non-zero carry");p=ft,N++}for(var ht=W-p;ht!==W&&z[ht]===0;)ht++;for(var Ot=m.repeat(O);ht<W;++ht)Ot+=r.charAt(z[ht]);return Ot}function g(x){if(typeof x!="string")throw new TypeError("Expected String");if(x.length===0)return new Uint8Array;var O=0;if(x[O]!==" "){for(var p=0,N=0;x[O]===m;)p++,O++;for(var U=(x.length-O)*w+1>>>0,W=new Uint8Array(U);x[O];){var z=e[x.charCodeAt(O)];if(z===255)return;for(var B=0,ft=U-1;(z!==0||B<N)&&ft!==-1;ft--,B++)z+=c*W[ft]>>>0,W[ft]=z%256>>>0,z=z/256>>>0;if(z!==0)throw new Error("Non-zero carry");N=B,O++}if(x[O]!==" "){for(var Z=U-N;Z!==U&&W[Z]===0;)Z++;for(var ht=new Uint8Array(p+(U-Z)),Ot=p;Z!==U;)ht[Ot++]=W[Z++];return ht}}}function y(x){var O=g(x);if(O)return O;throw new Error(`Non-${t} character`)}return{encode:h,decodeUnsafe:g,decode:y}}var Ji=Ki,Qi=Ji,Dr=Qi;var Sc=new Uint8Array(0);var Wr=(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},At=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")};var Br=r=>new TextEncoder().encode(r),Rr=r=>new TextDecoder().decode(r);var _n=class{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")}},Sn=class{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),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 qr(this,t)}},vn=class{constructor(t){this.decoders=t}or(t){return qr(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},qr=(r,t)=>new vn({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Pn=class{constructor(t,e,n,s){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=s,this.encoder=new _n(t,e,n),this.decoder=new Sn(t,e,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},pe=({name:r,prefix:t,encode:e,decode:n})=>new Pn(r,t,e,n),Vt=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:s}=Dr(e,t);return pe({prefix:r,name:t,encode:n,decode:i=>At(s(i))})},Xi=(r,t,e,n)=>{let s={};for(let d=0;d<t.length;++d)s[t[d]]=d;let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*e/8|0),c=0,m=0,w=0;for(let d=0;d<i;++d){let h=s[r[d]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);m=m<<e|h,c+=e,c>=8&&(c-=8,o[w++]=255&m>>c)}if(c>=e||255&m<<8-c)throw new SyntaxError("Unexpected end of data");return o},Zi=(r,t,e)=>{let n=t[t.length-1]==="=",s=(1<<e)-1,i="",o=0,c=0;for(let m=0;m<r.length;++m)for(c=c<<8|r[m],o+=8;o>e;)o-=e,i+=t[s&c>>o];if(o&&(i+=t[s&c<<e-o]),n)for(;i.length*e&7;)i+="=";return i},nt=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>pe({prefix:t,name:r,encode(s){return Zi(s,n,e)},decode(s){return Xi(s,n,e,r)}});var ki=pe({prefix:"\0",name:"identity",encode:r=>Rr(r),decode:r=>Br(r)});var In={};gt(In,{base2:()=>to});var to=nt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Mn={};gt(Mn,{base8:()=>eo});var eo=nt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var $n={};gt($n,{base10:()=>no});var no=Vt({prefix:"9",name:"base10",alphabet:"0123456789"});var Nn={};gt(Nn,{base16:()=>ro,base16upper:()=>so});var ro=nt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),so=nt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Tn={};gt(Tn,{base32:()=>Ut,base32hex:()=>co,base32hexpad:()=>fo,base32hexpadupper:()=>ho,base32hexupper:()=>lo,base32pad:()=>oo,base32padupper:()=>ao,base32upper:()=>io,base32z:()=>uo});var Ut=nt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),io=nt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oo=nt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ao=nt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),co=nt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),lo=nt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fo=nt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ho=nt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uo=nt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Fn={};gt(Fn,{base36:()=>po,base36upper:()=>mo});var po=Vt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),mo=Vt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var zn={};gt(zn,{base58btc:()=>pt,base58flickr:()=>go});var pt=Vt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),go=Vt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Un={};gt(Un,{base64:()=>bo,base64pad:()=>wo,base64url:()=>yo,base64urlpad:()=>xo});var bo=nt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),wo=nt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),yo=nt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),xo=nt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ln={};gt(Ln,{base256emoji:()=>_o});var Hr=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}"),Oo=Hr.reduce((r,t,e)=>(r[e]=t,r),[]),Ao=Hr.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Eo(r){return r.reduce((t,e)=>(t+=Oo[e],t),"")}function Co(r){let t=[];for(let e of r){let n=Ao[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var _o=pe({prefix:"\u{1F680}",name:"base256emoji",encode:Eo,decode:Co});var Vn={};gt(Vn,{sha256:()=>qo,sha512:()=>Ho});var Rn=kt(H("crypto"),1);var So=Kr,Gr=128,vo=127,Po=~vo,jo=Math.pow(2,31);function Kr(r,t,e){t=t||[],e=e||0;for(var n=e;r>=jo;)t[e++]=r&255|Gr,r/=128;for(;r&Po;)t[e++]=r&255|Gr,r>>>=7;return t[e]=r|0,Kr.bytes=e-n+1,t}var Io=Dn,Mo=128,Yr=127;function Dn(r,n){var e=0,n=n||0,s=0,i=n,o,c=r.length;do{if(i>=c)throw Dn.bytes=0,new RangeError("Could not decode varint");o=r[i++],e+=s<28?(o&Yr)<<s:(o&Yr)*Math.pow(2,s),s+=7}while(o>=Mo);return Dn.bytes=i-n,e}var $o=Math.pow(2,7),No=Math.pow(2,14),To=Math.pow(2,21),Fo=Math.pow(2,28),zo=Math.pow(2,35),Uo=Math.pow(2,42),Lo=Math.pow(2,49),Do=Math.pow(2,56),Wo=Math.pow(2,63),Bo=function(r){return r<$o?1:r<No?2:r<To?3:r<Fo?4:r<zo?5:r<Uo?6:r<Lo?7:r<Do?8:r<Wo?9:10},Ro={encode:So,decode:Io,encodingLength:Bo},Vo=Ro,Ie=Vo;var Me=(r,t=0)=>[Ie.decode(r,t),Ie.decode.bytes],me=(r,t,e=0)=>(Ie.encode(r,t,e),t),ge=r=>Ie.encodingLength(r);var te=(r,t)=>{let e=t.byteLength,n=ge(r),s=n+ge(e),i=new Uint8Array(s+e);return me(r,i,0),me(e,i,n),i.set(t,s),new be(r,e,t,i)},Ye=r=>{let t=At(r),[e,n]=Me(t),[s,i]=Me(t.subarray(n)),o=t.subarray(n+i);if(o.byteLength!==s)throw new Error("Incorrect length");return new be(e,s,o,t)},Jr=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Wr(r.bytes,e.bytes)}},be=class{constructor(t,e,n,s){this.code=t,this.size=e,this.digest=n,this.bytes=s}};var Bn=({name:r,code:t,encode:e})=>new Wn(r,t,e),Wn=class{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?te(this.code,e):e.then(n=>te(this.code,n))}else throw Error("Unknown type, must be binary type")}};var qo=Bn({name:"sha2-256",code:18,encode:r=>At(Rn.default.createHash("sha256").update(r).digest())}),Ho=Bn({name:"sha2-512",code:19,encode:r=>At(Rn.default.createHash("sha512").update(r).digest())});var qn={};gt(qn,{identity:()=>Ko});var Xr=0,Go="identity",Zr=At,Yo=r=>te(Xr,Zr(r)),Ko={code:Xr,name:Go,encode:Zr,digest:Yo};var Kc=new TextEncoder,Jc=new TextDecoder;var kr=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return Zo(e,Hn(r),t||pt.encoder);default:return ko(e,Hn(r),t||Ut.encoder)}};var ts=new WeakMap,Hn=r=>{let t=ts.get(r);if(t==null){let e=new Map;return ts.set(r,e),e}return t},X=class{constructor(t,e,n,s){this.code=e,this.version=t,this.multihash=n,this.bytes=s,this["/"]=s}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!==$e)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==ta)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return X.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=te(t,e);return X.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 X.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Jr(t.multihash,n.multihash)}toString(t){return kr(this,t)}toJSON(){return{"/":kr(this)}}link(){return this}get[Symbol.toStringTag](){return"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 X)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:s,multihash:i,bytes:o}=e;return new X(n,s,i,o||es(n,s,i.bytes))}else if(e[ea]===!0){let{version:n,multihash:s,code:i}=e,o=Ye(s);return X.create(n,i,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!==$e)throw new Error(`Version 0 CID must use dag-pb (code: ${$e}) block encoding`);return new X(t,e,n,n.bytes)}case 1:{let s=es(t,e,n.bytes);return new X(t,e,n,s)}default:throw new Error("Invalid version")}}static createV0(t){return X.create(0,$e,t)}static createV1(t,e){return X.create(1,t,e)}static decode(t){let[e,n]=X.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=X.inspectBytes(t),n=e.size-e.multihashSize,s=At(t.subarray(n,n+e.multihashSize));if(s.byteLength!==e.multihashSize)throw new Error("Incorrect length");let i=s.subarray(e.multihashSize-e.digestSize),o=new be(e.multihashCode,e.digestSize,i,s);return[e.version===0?X.createV0(o):X.createV1(e.codec,o),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[h,g]=Me(t.subarray(e));return e+=g,h},s=n(),i=$e;if(s===18?(s=0,e=0):i=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let o=e,c=n(),m=n(),w=e+m,d=w-o;return{version:s,codec:i,multihashCode:c,digestSize:m,multihashSize:d,size:w}}static parse(t,e){let[n,s]=Xo(t,e),i=X.decode(s);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Hn(i).set(n,t),i}},Xo=(r,t)=>{switch(r[0]){case"Q":{let e=t||pt;return[pt.prefix,e.decode(`${pt.prefix}${r}`)]}case pt.prefix:{let e=t||pt;return[pt.prefix,e.decode(r)]}case Ut.prefix:{let e=t||Ut;return[Ut.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},Zo=(r,t,e)=>{let{prefix:n}=e;if(n!==pt.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let s=t.get(n);if(s==null){let i=e.encode(r).slice(1);return t.set(n,i),i}else return s},ko=(r,t,e)=>{let{prefix:n}=e,s=t.get(n);if(s==null){let i=e.encode(r);return t.set(n,i),i}else return s},$e=112,ta=18,es=(r,t,e)=>{let n=ge(r),s=n+ge(t),i=new Uint8Array(s+e.byteLength);return me(r,i,0),me(t,i,n),i.set(e,s),i},ea=Symbol.for("@ipld/js-cid/CID");var Ne={...jn,...In,...Mn,...$n,...Nn,...Tn,...Fn,...zn,...Un,...Ln},il={...Vn,...qn};function ye(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Ke(r=0){return globalThis.Buffer?.allocUnsafe!=null?ye(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function rs(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var ns=rs("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Gn=rs("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=Ke(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),na={utf8:ns,"utf-8":ns,hex:Ne.base16,latin1:Gn,ascii:Gn,binary:Gn,...Ne},Je=na;function mt(r,t="utf8"){let e=Je[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}var ss=Rt.isIPv4,ra=Rt.isIPv6,Yn=function(r){let t=0;if(r=r.toString().trim(),ss(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(ra(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let i=ss(e[n]),o;i&&(o=Yn(e[n]),e[n]=mt(o.slice(0,2),"base16")),o!=null&&++n<8&&e.splice(n,0,mt(o.slice(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 i=[n,1];for(n=9-e.length;n>0;n--)i.push("0");e.splice.apply(e,i)}let s=new Uint8Array(t+16);for(n=0;n<e.length;n++){let i=parseInt(e[n],16);s[t++]=i>>8&255,s[t++]=i&255}return s}throw new Error("invalid ip address")},is=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let s=[];for(let i=0;i<e;i++)s.push(r[t+i]);return s.join(".")}if(e===16){let s=[];for(let i=0;i<e;i+=2)s.push(n.getUint16(t+i).toString(16));return s.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Te={},Kn={},ia=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];ia.forEach(r=>{let t=oa(...r);Kn[t.code]=t,Te[t.name]=t});function oa(r,t,e,n,s){return{code:r,size:t,name:e,resolvable:!!n,path:!!s}}function K(r){if(typeof r=="number"){if(Kn[r]!=null)return Kn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Te[r]!=null)return Te[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var $t=kt(Qe(),1);function Xn(r,t="utf8"){let e=Je[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ye(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function Lt(r,t){t==null&&(t=r.reduce((s,i)=>s+i.length,0));let e=Ke(t),n=0;for(let s of r)e.set(s,n),n+=s.length;return ye(e)}var Xe=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,s){return this.readAtomically(()=>{let i=0,o=0,c=this.peekChar();if(c===void 0)return;let m=c==="0",w=2**(8*s)-1;for(;;){let d=this.readAtomically(()=>{let h=this.readChar();if(h===void 0)return;let g=Number.parseInt(h,t);if(!Number.isNaN(g))return g});if(d===void 0)break;if(i*=t,i+=d,i>w||(o+=1,e!==void 0&&o>e))return}if(o!==0)return!n&&m&&o>1?void 0:i})}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 s=n*2;if(n<e.length-3){let o=this.readSeparator(":",n,()=>this.readIPv4Addr());if(o!==void 0)return e[s]=o[0],e[s+1]=o[1],e[s+2]=o[2],e[s+3]=o[3],[s+4,!0]}let i=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[s,!1];e[s]=i>>8,e[s+1]=i&255}return[e.length,!1]};return this.readAtomically(()=>{let e=new Uint8Array(16),[n,s]=t(e);if(n===16)return e;if(s||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let i=new Uint8Array(14),o=16-(n+2),[c]=t(i.subarray(0,o));return e.set(i.subarray(0,c),16-c),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Ml=new Xe;var Dl=parseInt("0xFFFF",16),Wl=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var xf=K("ip4"),Of=K("ip6"),Af=K("ipcidr");function Os(r,t){switch(K(r).code){case 4:case 41:return Sa(t);case 42:return ys(t);case 6:case 273:case 33:case 132:return Es(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ys(t);case 421:return Ia(t);case 444:return xs(t);case 445:return xs(t);case 466:return ja(t);default:return mt(t,"base16")}}function As(r,t){switch(K(r).code){case 4:return bs(t);case 41:return bs(t);case 42:return ws(t);case 6:case 273:case 33:case 132:return kn(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ws(t);case 421:return va(t);case 444:return Ma(t);case 445:return $a(t);case 466:return Pa(t);default:return Xn(t,"base16")}}var Zn=Object.values(Ne).map(r=>r.decoder),_a=function(){let r=Zn[0].or(Zn[1]);return Zn.slice(2).forEach(t=>r=r.or(t)),r}();function bs(r){if(!He(r))throw new Error("invalid ip address");return Yn(r)}function Sa(r){let t=is(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!He(t))throw new Error("invalid ip address");return t}function kn(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function Es(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function ws(r){let t=Xn(r),e=Uint8Array.from($t.default.encode(t.length));return Lt([e,t],e.length+t.length)}function ys(r){let t=$t.default.decode(r);if(r=r.slice($t.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return mt(r)}function va(r){let t;r[0]==="Q"||r[0]==="1"?t=Ye(pt.decode(`z${r}`)).bytes:t=X.parse(r).multihash.bytes;let e=Uint8Array.from($t.default.encode(t.length));return Lt([e,t],e.length+t.length)}function Pa(r){let t=_a.decode(r),e=Uint8Array.from($t.default.encode(t.length));return Lt([e,t],e.length+t.length)}function ja(r){let t=$t.default.decode(r),e=r.slice($t.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+mt(e,"base64url")}function Ia(r){let t=$t.default.decode(r),e=r.slice($t.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return mt(e,"base58btc")}function Ma(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=Ut.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 s=kn(n);return Lt([e,s],e.length+s.length)}function $a(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=Ut.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 s=kn(n);return Lt([e,s],e.length+s.length)}function xs(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=mt(t,"base32"),s=Es(e);return`${n}:${s}`}var xe=kt(Qe(),1);function Na(r){let t=[],e=r.split("/").slice(1);if(e.length===1&&e[0]==="")return[];for(let n=0;n<e.length;n++){let s=e[n],i=K(s);if(i.size===0){t.push([s]);continue}if(n++,n>=e.length)throw _s("invalid address: "+r);if(i.path===!0){t.push([s,sr(e.slice(n).join("/"))]);break}t.push([s,e[n]])}return t}function Ta(r){let t=[];return r.map(e=>{let n=tn(e);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),sr(t.join("/"))}function Fa(r){return r.map(t=>{Array.isArray(t)||(t=[t]);let e=tn(t);return t.length>1?[e.code,As(e.code,t[1])]:[e.code]})}function tr(r){return r.map(t=>{let e=tn(t);return t[1]!=null?[e.code,Os(e.code,t[1])]:[e.code]})}function er(r){return ke(Lt(r.map(t=>{let e=tn(t),n=Uint8Array.from(xe.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=Lt([n,t[1]])),n})))}function nr(r,t){return r.size>0?r.size/8:r.size===0?0:xe.default.decode(t)+(xe.default.decode.bytes??0)}function Ze(r){let t=[],e=0;for(;e<r.length;){let n=xe.default.decode(r,e),s=xe.default.decode.bytes??0,i=K(n),o=nr(i,r.slice(e+s));if(o===0){t.push([n]),e+=s;continue}let c=r.slice(e+s,e+s+o);if(e+=o+s,e>r.length)throw _s("Invalid address Uint8Array: "+mt(r,"base16"));t.push([n,c])}return t}function rr(r){let t=Ze(r),e=tr(t);return Ta(e)}function za(r){r=sr(r);let t=Na(r),e=Fa(t);return er(e)}function Cs(r){return za(r)}function ke(r){let t=Ua(r);if(t!=null)throw t;return Uint8Array.from(r)}function Ua(r){try{Ze(r)}catch(t){return t}}function sr(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function _s(r){return new Error("Error parsing address: "+r)}function tn(r){return K(r[0])}var or=kt(Qe(),1);var en=class extends Error{constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};function Ss(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 Dt=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)},Oe=function(r,t,e,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!s:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(r,e):s?s.value=e:t.set(r,e),e},Fe,ze,Ue,qt,vs,Da=Symbol.for("nodejs.util.inspect.custom"),Wa=[K("dns").code,K("dns4").code,K("dns6").code,K("dnsaddr").code],Ba=new Map,Ps=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Ra(r){return!!r?.[Ps]}var Wt=class{constructor(t){if(Fe.set(this,void 0),ze.set(this,void 0),Ue.set(this,void 0),qt.set(this,void 0),this[vs]=!0,t==null&&(t=""),t instanceof Uint8Array)this.bytes=ke(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);this.bytes=Cs(t)}else if(Ra(t))this.bytes=ke(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return Dt(this,Fe,"f")==null&&Oe(this,Fe,rr(this.bytes),"f"),Dt(this,Fe,"f")}toJSON(){return this.toString()}toOptions(){let t,e,n,s,i="",o=K("tcp"),c=K("udp"),m=K("ip4"),w=K("ip6"),d=K("dns6"),h=K("ip6zone");for(let[y,x]of this.stringTuples())y===h.code&&(i=`%${x??""}`),Wa.includes(y)&&(e=o.name,s=443,n=`${x??""}${i}`,t=y===d.code?6:4),(y===o.code||y===c.code)&&(e=K(y).name,s=parseInt(x??"")),(y===m.code||y===w.code)&&(e=K(y).name,n=`${x??""}${i}`,t=y===w.code?6:4);if(t==null||e==null||n==null||s==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:s}}protos(){return this.protoCodes().map(t=>Object.assign({},K(t)))}protoCodes(){let t=[],e=this.bytes,n=0;for(;n<e.length;){let s=or.default.decode(e,n),i=or.default.decode.bytes??0,o=K(s),c=nr(o,e.slice(n+i));n+=c+i,t.push(s)}return t}protoNames(){return this.protos().map(t=>t.name)}tuples(){return Dt(this,ze,"f")==null&&Oe(this,ze,Ze(this.bytes),"f"),Dt(this,ze,"f")}stringTuples(){return Dt(this,Ue,"f")==null&&Oe(this,Ue,tr(this.tuples()),"f"),Dt(this,Ue,"f")}encapsulate(t){return t=new Wt(t),new Wt(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),s=n.lastIndexOf(e);if(s<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new Wt(n.slice(0,s))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new Wt(er(e.slice(0,n)));return this}getPeerId(){try{let e=this.stringTuples().filter(n=>n[0]===Te.ipfs.code).pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?mt(pt.decode(`z${n}`),"base58btc"):mt(X.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if(Dt(this,qt,"f")===void 0)try{Oe(this,qt,this.stringTuples().filter(t=>K(t[0]).path===!0)[0][1],"f"),Dt(this,qt,"f")==null&&Oe(this,qt,null,"f")}catch{Oe(this,qt,null,"f")}return Dt(this,qt,"f")}equals(t){return Ss(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(i=>i.resolvable);if(e==null)return[this];let n=Ba.get(e.name);if(n==null)throw new en(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(i=>new Wt(i))}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(t){let e=(t??this).protos();return!(e.length!==2||e[0].code!==4&&e[0].code!==41||e[1].code!==6&&e[1].code!==273)}[(Fe=new WeakMap,ze=new WeakMap,Ue=new WeakMap,qt=new WeakMap,vs=Ps,Da)](){return`Multiaddr(${rr(this.bytes)})`}};function ir(r){return new Wt(r)}var fn=H("assert");var Va={right:Ka,center:Ja},qa=0,nn=1,Ha=2,rn=3,ar=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(s=>s.split(" ")),n=0;return e.forEach(s=>{s.length>1&&bt.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),bt.stringWidth(s[0])))}),e.forEach(s=>{this.div(...s.map((i,o)=>({text:i.trim(),padding:this.measurePadding(i),width:o===0&&s.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){let e=bt.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,s)=>{let i="";n.forEach((o,c)=>{let{width:m}=t[c],w=this.negatePadding(t[c]),d=o;if(w>bt.stringWidth(o)&&(d+=" ".repeat(w-bt.stringWidth(o))),t[c].align&&t[c].align!=="left"&&this.wrap){let g=Va[t[c].align];d=g(d,w),bt.stringWidth(d)<w&&(d+=" ".repeat((m||0)-bt.stringWidth(d)-1))}let h=t[c].padding||[0,0,0,0];h[rn]&&(i+=" ".repeat(h[rn])),i+=js(t[c],d,"| "),i+=d,i+=js(t[c],d," |"),h[nn]&&(i+=" ".repeat(h[nn])),s===0&&e.length>0&&(i=this.renderInline(i,e[e.length-1]))}),e.push({text:i.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){let n=t.match(/^ */),s=n?n[0].length:0,i=e.text,o=bt.stringWidth(i.trimRight());return e.span?this.wrap?s<o?t:(e.hidden=!0,i.trimRight()+" ".repeat(s-o)+t.trimLeft()):(e.hidden=!0,i+t):t}rasterize(t){let e=[],n=this.columnWidths(t),s;return t.forEach((i,o)=>{i.width=n[o],this.wrap?s=bt.wrap(i.text,this.negatePadding(i),{hard:!0}).split(`
3
+ "use strict";var Libp2PDaemon=(()=>{var $o=Object.create;var Qt=Object.defineProperty;var Do=Object.getOwnPropertyDescriptor;var Uo=Object.getOwnPropertyNames;var zo=Object.getPrototypeOf,To=Object.prototype.hasOwnProperty;var G=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var zt=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),X=(r,e)=>{for(var t in e)Qt(r,t,{get:e[t],enumerable:!0})},hs=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Uo(e))!To.call(r,s)&&s!==t&&Qt(r,s,{get:()=>e[s],enumerable:!(n=Do(e,s))||n.enumerable});return r};var et=(r,e,t)=>(t=r!=null?$o(zo(r)):{},hs(e||!r||!r.__esModule?Qt(t,"default",{value:r,enumerable:!0}):t,r)),Fo=r=>hs(Qt({},"__esModule",{value:!0}),r);var Ks=zt((_h,Ys)=>{Ys.exports=or;var Gs=128,jc=127,Mc=~jc,Nc=Math.pow(2,31);function or(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw or.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=Nc;)e[t++]=r&255|Gs,r/=128;for(;r&Mc;)e[t++]=r&255|Gs,r>>>=7;return e[t]=r|0,or.bytes=t-n+1,e}});var Xs=zt((Ih,Qs)=>{Qs.exports=ar;var $c=128,Js=127;function ar(r,n){var t=0,n=n||0,s=0,i=n,o,c=r.length;do{if(i>=c||s>49)throw ar.bytes=0,new RangeError("Could not decode varint");o=r[i++],t+=s<28?(o&Js)<<s:(o&Js)*Math.pow(2,s),s+=7}while(o>=$c);return ar.bytes=i-n,t}});var ks=zt((Ph,Zs)=>{var Dc=Math.pow(2,7),Uc=Math.pow(2,14),zc=Math.pow(2,21),Tc=Math.pow(2,28),Fc=Math.pow(2,35),Lc=Math.pow(2,42),Bc=Math.pow(2,49),Rc=Math.pow(2,56),Vc=Math.pow(2,63);Zs.exports=function(r){return r<Dc?1:r<Uc?2:r<zc?3:r<Tc?4:r<Fc?5:r<Lc?6:r<Bc?7:r<Rc?8:r<Vc?9:10}});var cr=zt((jh,ei)=>{ei.exports={encode:Ks(),decode:Xs(),encodingLength:ks()}});var Po=zt((nm,Io)=>{var cs=class{constructor(e,t){this.ctx=t||{},this.yargs=e,this.parse=this.parse.bind(this),this.command=this.yargs.command,this.commandDir=this.yargs.commandDir}parse(e){let t=this.yargs,n;return new Promise((s,i)=>{let o=Object.assign({},this.ctx,{resolve:s,reject:i});t.parse(e,o,function(c,l,b){return n=l,c?l.reject(c):l.resolve(b)})}).then(s=>Promise.resolve(s)).then(s=>s&&s.argv?s:{data:s,argv:n}).catch(s=>Promise.resolve(s).then(i=>i&&i.argv?Promise.reject(i):Promise.reject({error:i,argv:n})))}};Io.exports=cs});var pl={};X(pl,{createLibp2pServer:()=>No,default:()=>ls});var Xt=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};var $n={};X($n,{base58btc:()=>ge,base58flickr:()=>qo});function Lo(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var s=0;s<r.length;s++){var i=r.charAt(s),o=i.charCodeAt(0);if(t[o]!==255)throw new TypeError(i+" is ambiguous");t[o]=s}var c=r.length,l=r.charAt(0),b=Math.log(c)/Math.log(256),h=Math.log(256)/Math.log(c);function d(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var C=0,m=0,_=0,j=w.length;_!==j&&w[_]===0;)_++,C++;for(var U=(j-_)*h+1>>>0,M=new Uint8Array(U);_!==j;){for(var T=w[_],K=0,V=U-1;(T!==0||K<m)&&V!==-1;V--,K++)T+=256*M[V]>>>0,M[V]=T%c>>>0,T=T/c>>>0;if(T!==0)throw new Error("Non-zero carry");m=K,_++}for(var J=U-m;J!==U&&M[J]===0;)J++;for(var de=l.repeat(C);J<U;++J)de+=r.charAt(M[J]);return de}function g(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var C=0;if(w[C]!==" "){for(var m=0,_=0;w[C]===l;)m++,C++;for(var j=(w.length-C)*b+1>>>0,U=new Uint8Array(j);w[C];){var M=t[w.charCodeAt(C)];if(M===255)return;for(var T=0,K=j-1;(M!==0||T<_)&&K!==-1;K--,T++)M+=c*U[K]>>>0,U[K]=M%256>>>0,M=M/256>>>0;if(M!==0)throw new Error("Non-zero carry");_=T,C++}if(w[C]!==" "){for(var V=j-_;V!==j&&U[V]===0;)V++;for(var J=new Uint8Array(m+(j-V)),de=m;V!==j;)J[de++]=U[V++];return J}}}function x(w){var C=g(w);if(C)return C;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:x}}var Bo=Lo,Ro=Bo,us=Ro;var yl=new Uint8Array(0);var ds=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},Ae=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")};var ps=r=>new TextEncoder().encode(r),ms=r=>new TextDecoder().decode(r);var Pn=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},jn=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}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 bs(this,e)}},Mn=class{constructor(e){this.decoders=e}or(e){return bs(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},bs=(r,e)=>new Mn({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Nn=class{constructor(e,t,n,s){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=s,this.encoder=new Pn(e,t,n),this.decoder=new jn(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},gt=({name:r,prefix:e,encode:t,decode:n})=>new Nn(r,e,t,n),Ve=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:s}=us(t,e);return gt({prefix:r,name:e,encode:n,decode:i=>Ae(s(i))})},Vo=(r,e,t,n)=>{let s={};for(let h=0;h<e.length;++h)s[e[h]]=h;let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*t/8|0),c=0,l=0,b=0;for(let h=0;h<i;++h){let d=s[r[h]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<t|d,c+=t,c>=8&&(c-=8,o[b++]=255&l>>c)}if(c>=t||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return o},Wo=(r,e,t)=>{let n=e[e.length-1]==="=",s=(1<<t)-1,i="",o=0,c=0;for(let l=0;l<r.length;++l)for(c=c<<8|r[l],o+=8;o>t;)o-=t,i+=e[s&c>>o];if(o&&(i+=e[s&c<<t-o]),n)for(;i.length*t&7;)i+="=";return i},se=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>gt({prefix:e,name:r,encode(s){return Wo(s,n,t)},decode(s){return Vo(s,n,t,r)}});var ge=Ve({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),qo=Ve({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ho=xs,ws=128,Go=127,Yo=~Go,Ko=Math.pow(2,31);function xs(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Ko;)e[t++]=r&255|ws,r/=128;for(;r&Yo;)e[t++]=r&255|ws,r>>>=7;return e[t]=r|0,xs.bytes=t-n+1,e}var Jo=Dn,Qo=128,ys=127;function Dn(r,n){var t=0,n=n||0,s=0,i=n,o,c=r.length;do{if(i>=c)throw Dn.bytes=0,new RangeError("Could not decode varint");o=r[i++],t+=s<28?(o&ys)<<s:(o&ys)*Math.pow(2,s),s+=7}while(o>=Qo);return Dn.bytes=i-n,t}var Xo=Math.pow(2,7),Zo=Math.pow(2,14),ko=Math.pow(2,21),ea=Math.pow(2,28),ta=Math.pow(2,35),na=Math.pow(2,42),ra=Math.pow(2,49),sa=Math.pow(2,56),ia=Math.pow(2,63),oa=function(r){return r<Xo?1:r<Zo?2:r<ko?3:r<ea?4:r<ta?5:r<na?6:r<ra?7:r<sa?8:r<ia?9:10},aa={encode:Ho,decode:Jo,encodingLength:oa},ca=aa,Tt=ca;var Ft=(r,e=0)=>[Tt.decode(r,e),Tt.decode.bytes],bt=(r,e,t=0)=>(Tt.encode(r,e,t),e),wt=r=>Tt.encodingLength(r);var tt=(r,e)=>{let t=e.byteLength,n=wt(r),s=n+wt(t),i=new Uint8Array(s+t);return bt(r,i,0),bt(t,i,n),i.set(e,s),new yt(r,t,e,i)},kt=r=>{let e=Ae(r),[t,n]=Ft(e),[s,i]=Ft(e.subarray(n)),o=e.subarray(n+i);if(o.byteLength!==s)throw new Error("Incorrect length");return new yt(t,s,o,e)},Cs=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&ds(r.bytes,t.bytes)}},yt=class{constructor(e,t,n,s){this.code=e,this.size=t,this.digest=n,this.bytes=s}};var Un={};X(Un,{base32:()=>Le,base32hex:()=>ua,base32hexpad:()=>pa,base32hexpadupper:()=>ma,base32hexupper:()=>da,base32pad:()=>la,base32padupper:()=>ha,base32upper:()=>fa,base32z:()=>ga});var Le=se({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),fa=se({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),la=se({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ha=se({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ua=se({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),da=se({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pa=se({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ma=se({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ga=se({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var As=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return wa(t,zn(r),e||ge.encoder);default:return ya(t,zn(r),e||Le.encoder)}};var Es=new WeakMap,zn=r=>{let e=Es.get(r);if(e==null){let t=new Map;return Es.set(r,t),t}return e},We=class r{constructor(e,t,n,s){this.code=t,this.version=e,this.multihash=n,this.bytes=s,this["/"]=s}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:t}=this;if(e!==Lt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==xa)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}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:t}=this.multihash,n=tt(e,t);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(e){return r.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&Cs(e.multihash,n.multihash)}toString(e){return As(this,e)}toJSON(){return{"/":As(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:s,multihash:i,bytes:o}=t;return new r(n,s,i,o||Os(n,s,i.bytes))}else if(t[Ca]===!0){let{version:n,multihash:s,code:i}=t,o=kt(s);return r.create(n,i,o)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Lt)throw new Error(`Version 0 CID must use dag-pb (code: ${Lt}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let s=Os(e,t,n.bytes);return new r(e,t,n,s)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Lt,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,s=Ae(e.subarray(n,n+t.multihashSize));if(s.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=s.subarray(t.multihashSize-t.digestSize),o=new yt(t.multihashCode,t.digestSize,i,s);return[t.version===0?r.createV0(o):r.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[d,g]=Ft(e.subarray(t));return t+=g,d},s=n(),i=Lt;if(s===18?(s=0,t=0):i=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let o=t,c=n(),l=n(),b=t+l,h=b-o;return{version:s,codec:i,multihashCode:c,digestSize:l,multihashSize:h,size:b}}static parse(e,t){let[n,s]=ba(e,t),i=r.decode(s);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return zn(i).set(n,e),i}},ba=(r,e)=>{switch(r[0]){case"Q":{let t=e||ge;return[ge.prefix,t.decode(`${ge.prefix}${r}`)]}case ge.prefix:{let t=e||ge;return[ge.prefix,t.decode(r)]}case Le.prefix:{let t=e||Le;return[Le.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},wa=(r,e,t)=>{let{prefix:n}=t;if(n!==ge.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let s=e.get(n);if(s==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return s},ya=(r,e,t)=>{let{prefix:n}=t,s=e.get(n);if(s==null){let i=t.encode(r);return e.set(n,i),i}else return s},Lt=112,xa=18,Os=(r,e,t)=>{let n=wt(r),s=n+wt(e),i=new Uint8Array(s+t.byteLength);return bt(r,i,0),bt(e,i,n),i.set(t,s),i},Ca=Symbol.for("@ipld/js-cid/CID");function vs(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var Rn={};X(Rn,{identity:()=>_a});function Aa(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var s=0;s<r.length;s++){var i=r.charAt(s),o=i.charCodeAt(0);if(t[o]!==255)throw new TypeError(i+" is ambiguous");t[o]=s}var c=r.length,l=r.charAt(0),b=Math.log(c)/Math.log(256),h=Math.log(256)/Math.log(c);function d(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var C=0,m=0,_=0,j=w.length;_!==j&&w[_]===0;)_++,C++;for(var U=(j-_)*h+1>>>0,M=new Uint8Array(U);_!==j;){for(var T=w[_],K=0,V=U-1;(T!==0||K<m)&&V!==-1;V--,K++)T+=256*M[V]>>>0,M[V]=T%c>>>0,T=T/c>>>0;if(T!==0)throw new Error("Non-zero carry");m=K,_++}for(var J=U-m;J!==U&&M[J]===0;)J++;for(var de=l.repeat(C);J<U;++J)de+=r.charAt(M[J]);return de}function g(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var C=0;if(w[C]!==" "){for(var m=0,_=0;w[C]===l;)m++,C++;for(var j=(w.length-C)*b+1>>>0,U=new Uint8Array(j);w[C];){var M=t[w.charCodeAt(C)];if(M===255)return;for(var T=0,K=j-1;(M!==0||T<_)&&K!==-1;K--,T++)M+=c*U[K]>>>0,U[K]=M%256>>>0,M=M/256>>>0;if(M!==0)throw new Error("Non-zero carry");_=T,C++}if(w[C]!==" "){for(var V=j-_;V!==j&&U[V]===0;)V++;for(var J=new Uint8Array(m+(j-V)),de=m;V!==j;)J[de++]=U[V++];return J}}}function x(w){var C=g(w);if(C)return C;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:x}}var Ea=Aa,Oa=Ea,Ss=Oa;var Ul=new Uint8Array(0);var _s=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},Ee=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")};var Is=r=>new TextEncoder().encode(r),Ps=r=>new TextDecoder().decode(r);var Tn=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Fn=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}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 Ms(this,e)}},Ln=class{constructor(e){this.decoders=e}or(e){return Ms(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Ms=(r,e)=>new Ln({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Bn=class{constructor(e,t,n,s){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=s,this.encoder=new Tn(e,t,n),this.decoder=new Fn(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ct=({name:r,prefix:e,encode:t,decode:n})=>new Bn(r,e,t,n),qe=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:s}=Ss(t,e);return Ct({prefix:r,name:e,encode:n,decode:i=>Ee(s(i))})},va=(r,e,t,n)=>{let s={};for(let h=0;h<e.length;++h)s[e[h]]=h;let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*t/8|0),c=0,l=0,b=0;for(let h=0;h<i;++h){let d=s[r[h]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<t|d,c+=t,c>=8&&(c-=8,o[b++]=255&l>>c)}if(c>=t||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return o},Sa=(r,e,t)=>{let n=e[e.length-1]==="=",s=(1<<t)-1,i="",o=0,c=0;for(let l=0;l<r.length;++l)for(c=c<<8|r[l],o+=8;o>t;)o-=t,i+=e[s&c>>o];if(o&&(i+=e[s&c<<t-o]),n)for(;i.length*t&7;)i+="=";return i},ie=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Ct({prefix:e,name:r,encode(s){return Sa(s,n,t)},decode(s){return va(s,n,t,r)}});var _a=Ct({prefix:"\0",name:"identity",encode:r=>Ps(r),decode:r=>Is(r)});var Vn={};X(Vn,{base2:()=>Ia});var Ia=ie({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Wn={};X(Wn,{base8:()=>Pa});var Pa=ie({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var qn={};X(qn,{base10:()=>ja});var ja=qe({prefix:"9",name:"base10",alphabet:"0123456789"});var Hn={};X(Hn,{base16:()=>Ma,base16upper:()=>Na});var Ma=ie({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Na=ie({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Gn={};X(Gn,{base32:()=>At,base32hex:()=>za,base32hexpad:()=>Fa,base32hexpadupper:()=>La,base32hexupper:()=>Ta,base32pad:()=>Da,base32padupper:()=>Ua,base32upper:()=>$a,base32z:()=>Ba});var At=ie({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),$a=ie({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Da=ie({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ua=ie({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),za=ie({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ta=ie({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Fa=ie({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),La=ie({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ba=ie({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Yn={};X(Yn,{base36:()=>Ra,base36upper:()=>Va});var Ra=qe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Va=qe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Kn={};X(Kn,{base58btc:()=>$e,base58flickr:()=>Wa});var $e=qe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Wa=qe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Jn={};X(Jn,{base64:()=>qa,base64pad:()=>Ha,base64url:()=>Ga,base64urlpad:()=>Ya});var qa=ie({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ha=ie({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ga=ie({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ya=ie({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Qn={};X(Qn,{base256emoji:()=>Za});var Ns=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}"),Ka=Ns.reduce((r,e,t)=>(r[t]=e,r),[]),Ja=Ns.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Qa(r){return r.reduce((e,t)=>(e+=Ka[t],e),"")}function Xa(r){let e=[];for(let t of r){let n=Ja[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Za=Ct({prefix:"\u{1F680}",name:"base256emoji",encode:Qa,decode:Xa});var tr={};X(tr,{sha256:()=>bc,sha512:()=>wc});var er=et(G("crypto"),1);var ka=Us,$s=128,ec=127,tc=~ec,nc=Math.pow(2,31);function Us(r,e,t){e=e||[],t=t||0;for(var n=t;r>=nc;)e[t++]=r&255|$s,r/=128;for(;r&tc;)e[t++]=r&255|$s,r>>>=7;return e[t]=r|0,Us.bytes=t-n+1,e}var rc=Xn,sc=128,Ds=127;function Xn(r,n){var t=0,n=n||0,s=0,i=n,o,c=r.length;do{if(i>=c)throw Xn.bytes=0,new RangeError("Could not decode varint");o=r[i++],t+=s<28?(o&Ds)<<s:(o&Ds)*Math.pow(2,s),s+=7}while(o>=sc);return Xn.bytes=i-n,t}var ic=Math.pow(2,7),oc=Math.pow(2,14),ac=Math.pow(2,21),cc=Math.pow(2,28),fc=Math.pow(2,35),lc=Math.pow(2,42),hc=Math.pow(2,49),uc=Math.pow(2,56),dc=Math.pow(2,63),pc=function(r){return r<ic?1:r<oc?2:r<ac?3:r<cc?4:r<fc?5:r<lc?6:r<hc?7:r<uc?8:r<dc?9:10},mc={encode:ka,decode:rc,encodingLength:pc},gc=mc,Bt=gc;var Rt=(r,e=0)=>[Bt.decode(r,e),Bt.decode.bytes],Et=(r,e,t=0)=>(Bt.encode(r,e,t),e),Ot=r=>Bt.encodingLength(r);var nt=(r,e)=>{let t=e.byteLength,n=Ot(r),s=n+Ot(t),i=new Uint8Array(s+t);return Et(r,i,0),Et(t,i,n),i.set(e,s),new vt(r,t,e,i)},zs=r=>{let e=Ee(r),[t,n]=Rt(e),[s,i]=Rt(e.subarray(n)),o=e.subarray(n+i);if(o.byteLength!==s)throw new Error("Incorrect length");return new vt(t,s,o,e)},Ts=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&_s(r.bytes,t.bytes)}},vt=class{constructor(e,t,n,s){this.code=e,this.size=t,this.digest=n,this.bytes=s}};var kn=({name:r,code:e,encode:t})=>new Zn(r,e,t),Zn=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?nt(this.code,t):t.then(n=>nt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var bc=kn({name:"sha2-256",code:18,encode:r=>Ee(er.default.createHash("sha256").update(r).digest())}),wc=kn({name:"sha2-512",code:19,encode:r=>Ee(er.default.createHash("sha512").update(r).digest())});var nr={};X(nr,{identity:()=>Cc});var Ls=0,yc="identity",Bs=Ee,xc=r=>nt(Ls,Bs(r)),Cc={code:Ls,name:yc,encode:Bs,digest:xc};var rh=new TextEncoder,sh=new TextDecoder;var Rs=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return vc(t,rr(r),e||$e.encoder);default:return Sc(t,rr(r),e||At.encoder)}};var Vs=new WeakMap,rr=r=>{let e=Vs.get(r);if(e==null){let t=new Map;return Vs.set(r,t),t}return e},tn=class r{constructor(e,t,n,s){this.code=t,this.version=e,this.multihash=n,this.bytes=s,this["/"]=s}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:t}=this;if(e!==Wt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==_c)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}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:t}=this.multihash,n=nt(e,t);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(e){return r.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&Ts(e.multihash,n.multihash)}toString(e){return Rs(this,e)}toJSON(){return{"/":Rs(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:s,multihash:i,bytes:o}=t;return new r(n,s,i,o||Ws(n,s,i.bytes))}else if(t[Ic]===!0){let{version:n,multihash:s,code:i}=t,o=zs(s);return r.create(n,i,o)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Wt)throw new Error(`Version 0 CID must use dag-pb (code: ${Wt}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let s=Ws(e,t,n.bytes);return new r(e,t,n,s)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Wt,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,s=Ee(e.subarray(n,n+t.multihashSize));if(s.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=s.subarray(t.multihashSize-t.digestSize),o=new vt(t.multihashCode,t.digestSize,i,s);return[t.version===0?r.createV0(o):r.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[d,g]=Rt(e.subarray(t));return t+=g,d},s=n(),i=Wt;if(s===18?(s=0,t=0):i=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let o=t,c=n(),l=n(),b=t+l,h=b-o;return{version:s,codec:i,multihashCode:c,digestSize:l,multihashSize:h,size:b}}static parse(e,t){let[n,s]=Oc(e,t),i=r.decode(s);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return rr(i).set(n,e),i}},Oc=(r,e)=>{switch(r[0]){case"Q":{let t=e||$e;return[$e.prefix,t.decode(`${$e.prefix}${r}`)]}case $e.prefix:{let t=e||$e;return[$e.prefix,t.decode(r)]}case At.prefix:{let t=e||At;return[At.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},vc=(r,e,t)=>{let{prefix:n}=t;if(n!==$e.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let s=e.get(n);if(s==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return s},Sc=(r,e,t)=>{let{prefix:n}=t,s=e.get(n);if(s==null){let i=t.encode(r);return e.set(n,i),i}else return s},Wt=112,_c=18,Ws=(r,e,t)=>{let n=Ot(r),s=n+Ot(e),i=new Uint8Array(s+t.byteLength);return Et(r,i,0),Et(e,i,n),i.set(t,s),i},Ic=Symbol.for("@ipld/js-cid/CID");var sr={...Rn,...Vn,...Wn,...qn,...Hn,...Gn,...Yn,...Kn,...Jn,...Qn},ph={...tr,...nr};function St(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function nn(r=0){return globalThis.Buffer?.allocUnsafe!=null?St(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Hs(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var qs=Hs("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),ir=Hs("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=nn(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Pc={utf8:qs,"utf-8":qs,hex:sr.base16,latin1:ir,ascii:ir,binary:ir,...sr},rn=Pc;function be(r,e="utf8"){let t=rn[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}function Be(r,e){e==null&&(e=r.reduce((s,i)=>s+i.length,0));let t=nn(e),n=0;for(let s of r)t.set(s,n),n+=s.length;return St(t)}var It=et(cr(),1);var sn=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let t=this.index,n=e();return n===void 0&&(this.index=t),n}parseWith(e){let t=e();if(this.index===this.input.length)return t}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 t=this.readChar();if(t===e)return t})}readSeparator(e,t,n){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,t,n,s){return this.readAtomically(()=>{let i=0,o=0,c=this.peekChar();if(c===void 0)return;let l=c==="0",b=2**(8*s)-1;for(;;){let h=this.readAtomically(()=>{let d=this.readChar();if(d===void 0)return;let g=Number.parseInt(d,e);if(!Number.isNaN(g))return g});if(h===void 0)break;if(i*=e,i+=h,i>b||(o+=1,t!==void 0&&o>t))return}if(o!==0)return!n&&l&&o>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;t<e.length;t++){let n=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[t]=n}return e})}readIPv6Addr(){let e=t=>{for(let n=0;n<t.length/2;n++){let s=n*2;if(n<t.length-3){let o=this.readSeparator(":",n,()=>this.readIPv4Addr());if(o!==void 0)return t[s]=o[0],t[s+1]=o[1],t[s+2]=o[2],t[s+3]=o[3],[s+4,!0]}let i=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[s,!1];t[s]=i>>8,t[s+1]=i&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,s]=e(t);if(n===16)return t;if(s||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let i=new Uint8Array(14),o=16-(n+2),[c]=e(i.subarray(0,o));return t.set(i.subarray(0,c),16-c),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var $h=new sn;var Rh=parseInt("0xFFFF",16),Vh=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var fr={};X(fr,{identity:()=>Kc});var Kc=gt({prefix:"\0",name:"identity",encode:r=>ms(r),decode:r=>ps(r)});var lr={};X(lr,{base2:()=>Jc});var Jc=se({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var hr={};X(hr,{base8:()=>Qc});var Qc=se({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ur={};X(ur,{base10:()=>Xc});var Xc=Ve({prefix:"9",name:"base10",alphabet:"0123456789"});var dr={};X(dr,{base16:()=>Zc,base16upper:()=>kc});var Zc=se({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),kc=se({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var pr={};X(pr,{base36:()=>ef,base36upper:()=>tf});var ef=Ve({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tf=Ve({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var mr={};X(mr,{base64:()=>nf,base64pad:()=>rf,base64url:()=>sf,base64urlpad:()=>of});var nf=se({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),rf=se({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),sf=se({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),of=se({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var gr={};X(gr,{base256emoji:()=>hf});var ri=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}"),af=ri.reduce((r,e,t)=>(r[t]=e,r),[]),cf=ri.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function ff(r){return r.reduce((e,t)=>(e+=af[t],e),"")}function lf(r){let e=[];for(let t of r){let n=cf[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var hf=gt({prefix:"\u{1F680}",name:"base256emoji",encode:ff,decode:lf});var xr={};X(xr,{sha256:()=>uf,sha512:()=>df});var yr=et(G("crypto"),1);var wr=({name:r,code:e,encode:t})=>new br(r,e,t),br=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?tt(this.code,t):t.then(n=>tt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var uf=wr({name:"sha2-256",code:18,encode:r=>Ae(yr.default.createHash("sha256").update(r).digest())}),df=wr({name:"sha2-512",code:19,encode:r=>Ae(yr.default.createHash("sha512").update(r).digest())});var Cr={};X(Cr,{identity:()=>gf});var ii=0,pf="identity",oi=Ae,mf=r=>tt(ii,oi(r)),gf={code:ii,name:pf,encode:oi,digest:mf};var vu=new TextEncoder,Su=new TextDecoder;var ai={...fr,...lr,...hr,...ur,...dr,...Un,...pr,...$n,...mr,...gr},Mu={...xr,...Cr};function Ar(r,e="utf8"){let t=rn[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?St(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}var De=et(cr(),1);var He=G("node:net");function on(r){return!!(0,He.isIP)(r)}var ci=He.isIPv4,yf=He.isIPv6,Er=function(r){let e=0;if(r=r.toString().trim(),ci(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(yf(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let i=ci(t[n]),o;i&&(o=Er(t[n]),t[n]=be(o.slice(0,2),"base16")),o!=null&&++n<8&&t.splice(n,0,be(o.slice(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let i=[n,1];for(n=9-t.length;n>0;n--)i.push("0");t.splice.apply(t,i)}let s=new Uint8Array(e+16);for(n=0;n<t.length;n++){let i=parseInt(t[n],16);s[e++]=i>>8&255,s[e++]=i&255}return s}throw new Error("invalid ip address")},fi=function(r,e=0,t){e=~~e,t=t??r.length-e;let n=new DataView(r.buffer);if(t===4){let s=[];for(let i=0;i<t;i++)s.push(r[e+i]);return s.join(".")}if(t===16){let s=[];for(let i=0;i<t;i+=2)s.push(n.getUint16(e+i).toString(16));return s.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var _t={},Or={},Cf=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];Cf.forEach(r=>{let e=Af(...r);Or[e.code]=e,_t[e.name]=e});function Af(r,e,t,n,s){return{code:r,size:e,name:t,resolvable:!!n,path:!!s}}function Q(r){if(typeof r=="number"){if(Or[r]!=null)return Or[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(_t[r]!=null)return _t[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Qu=Q("ip4"),Xu=Q("ip6"),Zu=Q("ipcidr");function Sr(r,e){switch(Q(r).code){case 4:case 41:return Of(e);case 42:return ui(e);case 6:case 273:case 33:case 132:return pi(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ui(e);case 421:return If(e);case 444:return di(e);case 445:return di(e);case 466:return _f(e);default:return be(e,"base16")}}function _r(r,e){switch(Q(r).code){case 4:return li(e);case 41:return li(e);case 42:return hi(e);case 6:case 273:case 33:case 132:return Ir(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return hi(e);case 421:return vf(e);case 444:return Pf(e);case 445:return jf(e);case 466:return Sf(e);default:return Ar(e,"base16")}}var vr=Object.values(ai).map(r=>r.decoder),Ef=function(){let r=vr[0].or(vr[1]);return vr.slice(2).forEach(e=>r=r.or(e)),r}();function li(r){if(!on(r))throw new Error("invalid ip address");return Er(r)}function Of(r){let e=fi(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!on(e))throw new Error("invalid ip address");return e}function Ir(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function pi(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function hi(r){let e=Ar(r),t=Uint8Array.from(De.default.encode(e.length));return Be([t,e],t.length+e.length)}function ui(r){let e=De.default.decode(r);if(r=r.slice(De.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return be(r)}function vf(r){let e;r[0]==="Q"||r[0]==="1"?e=kt(ge.decode(`z${r}`)).bytes:e=We.parse(r).multihash.bytes;let t=Uint8Array.from(De.default.encode(e.length));return Be([t,e],t.length+e.length)}function Sf(r){let e=Ef.decode(r),t=Uint8Array.from(De.default.encode(e.length));return Be([t,e],t.length+e.length)}function _f(r){let e=De.default.decode(r),t=r.slice(De.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+be(t,"base64url")}function If(r){let e=De.default.decode(r),t=r.slice(De.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return be(t,"base58btc")}function Pf(r){let e=r.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 t=Le.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let s=Ir(n);return Be([t,s],t.length+s.length)}function jf(r){let e=r.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 t=Le.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let s=Ir(n);return Be([t,s],t.length+s.length)}function di(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=be(e,"base32"),s=pi(t);return`${n}:${s}`}function mi(r){r=Pr(r);let e=[],t=[],n=null,s=r.split("/").slice(1);if(s.length===1&&s[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let i=0;i<s.length;i++){let o=s[i],c=Q(o);if(c.size===0){e.push([c.code]),t.push([c.code]);continue}if(i++,i>=s.length)throw bi("invalid address: "+r);if(c.path===!0){n=Pr(s.slice(i).join("/")),e.push([c.code,_r(c.code,n)]),t.push([c.code,n]);break}let l=_r(c.code,s[i]);e.push([c.code,l]),t.push([c.code,Sr(c.code,l)])}return{string:gi(t),bytes:Mr(e),tuples:e,stringTuples:t,path:n}}function jr(r){let e=[],t=[],n=null,s=0;for(;s<r.length;){let i=It.default.decode(r,s),o=It.default.decode.bytes??0,c=Q(i),l=Mf(c,r.slice(s+o));if(l===0){e.push([i]),t.push([i]),s+=o;continue}let b=r.slice(s+o,s+o+l);if(s+=l+o,s>r.length)throw bi("Invalid address Uint8Array: "+be(r,"base16"));e.push([i,b]);let h=Sr(i,b);if(t.push([i,h]),c.path===!0){n=h;break}}return{bytes:Uint8Array.from(r),string:gi(t),tuples:e,stringTuples:t,path:n}}function gi(r){let e=[];return r.map(t=>{let n=Q(t[0]);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),Pr(e.join("/"))}function Mr(r){return Be(r.map(e=>{let t=Q(e[0]),n=Uint8Array.from(It.default.encode(t.code));return e.length>1&&e[1]!=null&&(n=Be([n,e[1]])),n}))}function Mf(r,e){return r.size>0?r.size/8:r.size===0?0:It.default.decode(e)+(It.default.decode.bytes??0)}function Pr(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function bi(r){return new Error("Error parsing address: "+r)}var Nf=Symbol.for("nodejs.util.inspect.custom"),$f=[Q("dns").code,Q("dns4").code,Q("dns6").code,Q("dnsaddr").code],Df=new Map,wi=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Uf(r){return!!r?.[wi]}var $r=class r{bytes;#t;#e;#n;#r;[wi]=!0;constructor(e){e==null&&(e="");let t;if(e instanceof Uint8Array)t=jr(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);t=mi(e)}else if(Uf(e))t=jr(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=t.bytes,this.#t=t.string,this.#e=t.tuples,this.#n=t.stringTuples,this.#r=t.path}toString(){return this.#t}toJSON(){return this.toString()}toOptions(){let e,t,n,s,i="",o=Q("tcp"),c=Q("udp"),l=Q("ip4"),b=Q("ip6"),h=Q("dns6"),d=Q("ip6zone");for(let[x,w]of this.stringTuples())x===d.code&&(i=`%${w??""}`),$f.includes(x)&&(t=o.name,s=443,n=`${w??""}${i}`,e=x===h.code?6:4),(x===o.code||x===c.code)&&(t=Q(x).name,s=parseInt(w??"")),(x===l.code||x===b.code)&&(t=Q(x).name,n=`${w??""}${i}`,e=x===b.code?6:4);if(e==null||t==null||n==null||s==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:s}}protos(){return this.#e.map(([e])=>Object.assign({},Q(e)))}protoCodes(){return this.#e.map(([e])=>e)}protoNames(){return this.#e.map(([e])=>Q(e).name)}tuples(){return this.#e}stringTuples(){return this.#n}encapsulate(e){return e=new r(e),new r(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),n=this.toString(),s=n.lastIndexOf(t);if(s<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new r(n.slice(0,s))}decapsulateCode(e){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new r(Mr(t.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,s])=>{n===_t.p2p.code&&e.push([n,s]),n===_t["p2p-circuit"].code&&(e=[])});let t=e.pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?be(ge.decode(`z${n}`),"base58btc"):be(We.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#r}equals(e){return vs(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(i=>i.resolvable);if(t==null)return[this];let n=Df.get(t.name);if(n==null)throw new Xt(`no available resolver for ${t.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(i=>new r(i))}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(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[Nf](){return`Multiaddr(${this.#t})`}};function Nr(r){return new $r(r)}var Ur=et(G("path"),1),Dr=et(G("process"),1),yi=G("module"),xi=G("url");function zf(r){let e=Ur.default.extname(r);return e?r.slice(0,-e.length):r}function zr(r){if(!r||!Dr.default.argv[1])return!1;let t=(0,yi.createRequire)(r.url).resolve(Dr.default.argv[1]),n=(0,xi.fileURLToPath)(r.url);return Ur.default.extname(t)?n===t:zf(n)===t}var pn=G("assert");var Tf={right:Vf,center:Wf},Ff=0,an=1,Lf=2,cn=3,Tr=class{constructor(e){var t;this.width=e.width,this.wrap=(t=e.wrap)!==null&&t!==void 0?t:!0,this.rows=[]}span(...e){let t=this.div(...e);t.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 t=e.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(t),t}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let t=e.split(`
4
+ `).map(s=>s.split(" ")),n=0;return t.forEach(s=>{s.length>1&&we.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),we.stringWidth(s[0])))}),t.forEach(s=>{this.div(...s.map((i,o)=>({text:i.trim(),padding:this.measurePadding(i),width:o===0&&s.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let t=we.stripAnsi(e);return[0,t.match(/\s*$/)[0].length,0,t.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(t=>{this.rowToString(t,e)}),e.filter(t=>!t.hidden).map(t=>t.text).join(`
5
+ `)}rowToString(e,t){return this.rasterize(e).forEach((n,s)=>{let i="";n.forEach((o,c)=>{let{width:l}=e[c],b=this.negatePadding(e[c]),h=o;if(b>we.stringWidth(o)&&(h+=" ".repeat(b-we.stringWidth(o))),e[c].align&&e[c].align!=="left"&&this.wrap){let g=Tf[e[c].align];h=g(h,b),we.stringWidth(h)<b&&(h+=" ".repeat((l||0)-we.stringWidth(h)-1))}let d=e[c].padding||[0,0,0,0];d[cn]&&(i+=" ".repeat(d[cn])),i+=Ci(e[c],h,"| "),i+=h,i+=Ci(e[c],h," |"),d[an]&&(i+=" ".repeat(d[an])),s===0&&t.length>0&&(i=this.renderInline(i,t[t.length-1]))}),t.push({text:i.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){let n=e.match(/^ */),s=n?n[0].length:0,i=t.text,o=we.stringWidth(i.trimRight());return t.span?this.wrap?s<o?e:(t.hidden=!0,i.trimRight()+" ".repeat(s-o)+e.trimLeft()):(t.hidden=!0,i+e):e}rasterize(e){let t=[],n=this.columnWidths(e),s;return e.forEach((i,o)=>{i.width=n[o],this.wrap?s=we.wrap(i.text,this.negatePadding(i),{hard:!0}).split(`
6
6
  `):s=i.text.split(`
7
- `),i.border&&(s.unshift("."+"-".repeat(this.negatePadding(i)+2)+"."),s.push("'"+"-".repeat(this.negatePadding(i)+2)+"'")),i.padding&&(s.unshift(...new Array(i.padding[qa]||0).fill("")),s.push(...new Array(i.padding[Ha]||0).fill(""))),s.forEach((c,m)=>{e[m]||e.push([]);let w=e[m];for(let d=0;d<o;d++)w[d]===void 0&&w.push("");w.push(c)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[rn]||0)+(t.padding[nn]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(o=>o.width||bt.stringWidth(o.text));let e=t.length,n=this.width,s=t.map(o=>{if(o.width)return e--,n-=o.width,o.width}),i=e?Math.floor(n/e):0;return s.map((o,c)=>o===void 0?Math.max(i,Ga(t[c])):o)}};function js(r,t,e){return r.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function Ga(r){let t=r.padding||[],e=1+(t[rn]||0)+(t[nn]||0);return r.border?e+4:e}function Ya(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Ka(r,t){r=r.trim();let e=bt.stringWidth(r);return e<t?" ".repeat(t-e)+r:r}function Ja(r,t){r=r.trim();let e=bt.stringWidth(r);return e>=t?r:" ".repeat(t-e>>1)+r}var bt;function Is(r,t){return bt=t,new ar({width:r?.width||Ya(),wrap:r?.wrap})}var Ms=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function cr(r){return r.replace(Ms,"")}function $s(r,t){let[e,n]=r.match(Ms)||["",""];r=cr(r);let s="";for(let i=0;i<r.length;i++)i!==0&&i%t===0&&(s+=`
8
- `),s+=r.charAt(i);return e&&n&&(s=`${e}${s}${n}`),s}function lr(r){return Is(r,{stringWidth:t=>[...t].length,stripAnsi:cr,wrap:$s})}var Ae=H("path"),sn=H("fs");function Ns(r,t){let e=(0,Ae.resolve)(".",r),n;for((0,sn.statSync)(e).isDirectory()||(e=(0,Ae.dirname)(e));;){if(n=t(e,(0,sn.readdirSync)(e)),n)return(0,Ae.resolve)(e,n);if(e=(0,Ae.dirname)(n=e),n===e)break}}var Js=H("util"),Qs=H("fs"),Xs=H("url");var Ls=H("util"),ln=H("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,s=r.match(/^-+/);for(let i=s?s[0].length:0;i<r.length;i++){let o=r.charAt(i);n&&(n=!1,o=o.toUpperCase()),i!==0&&(o==="-"||o==="_")?n=!0:o!=="-"&&o!=="_"&&(e+=o)}return e}}function on(r,t){let e=r.toLowerCase();t=t||"-";let n="";for(let s=0;s<r.length;s++){let i=e.charAt(s),o=r.charAt(s);i!==o&&s>0?n+=`${t}${e.charAt(s)}`:n+=o}return n}function an(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 Ts(r){if(Array.isArray(r))return r.map(o=>typeof o!="string"?o+"":o);r=r.trim();let t=0,e=null,n=null,s=null,i=[];for(let o=0;o<r.length;o++){if(e=n,n=r.charAt(o),n===" "&&!s){e!==" "&&t++;continue}n===s?s=null:(n==="'"||n==='"')&&!s&&(s=n),i[t]||(i[t]=""),i[t]+=n}return i}var Et;(function(r){r.BOOLEAN="boolean",r.STRING="string",r.NUMBER="number",r.ARRAY="array"})(Et||(Et={}));var Bt,cn=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),s=Ts(t),i=typeof t=="string",o=Qa(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),m=Object.assign(Object.create(null),n.default),w=n.configObjects||[],d=n.envPrefix,h=c["populate--"],g=h?"--":"_",y=Object.create(null),x=Object.create(null),O=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:[]},N=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,U=new RegExp("^--"+c["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let u=typeof l=="object"?l.key:l,A=Object.keys(l).map(function(b){return{boolean:"bools",string:"strings",number:"numbers"}[b]}).filter(Boolean).pop();A&&(p[A][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)})),Zt(n.key,o,n.default,p.arrays),Object.keys(m).forEach(function(l){(p.aliases[l]||[]).forEach(function(u){m[u]=m[l]})});let W=null;Ve();let z=[],B=Object.assign(Object.create(null),{_:[]}),ft={};for(let l=0;l<s.length;l++){let u=s[l],A=u.replace(/^-{3,}/,"---"),b,f,P,C,M,ct;if(u!=="--"&&/^-/.test(u)&&tt(u))Z(u);else if(A.match(/^---+(=|$)/)){Z(u);continue}else if(u.match(/^--.+=/)||!c["short-option-groups"]&&u.match(/^-.+=/))C=u.match(/^--?([^=]+)=([\s\S]*)$/),C!==null&&Array.isArray(C)&&C.length>=3&&(T(C[1],p.arrays)?l=Ot(l,C[1],s,C[2]):T(C[1],p.nargs)!==!1?l=ht(l,C[1],s,C[2]):G(C[1],C[2],!0));else if(u.match(U)&&c["boolean-negation"])C=u.match(U),C!==null&&Array.isArray(C)&&C.length>=2&&(f=C[1],G(f,T(f,p.arrays)?[!1]:!1));else if(u.match(/^--.+/)||!c["short-option-groups"]&&u.match(/^-[^-]+/))C=u.match(/^--?(.+)/),C!==null&&Array.isArray(C)&&C.length>=2&&(f=C[1],T(f,p.arrays)?l=Ot(l,f,s):T(f,p.nargs)!==!1?l=ht(l,f,s):(M=s[l+1],M!==void 0&&(!M.match(/^-/)||M.match(N))&&!T(f,p.bools)&&!T(f,p.counts)||/^(true|false)$/.test(M)?(G(f,M),l++):G(f,et(f))));else if(u.match(/^-.\..+=/))C=u.match(/^-([^=]+)=([\s\S]*)$/),C!==null&&Array.isArray(C)&&C.length>=3&&G(C[1],C[2]);else if(u.match(/^-.\..+/)&&!u.match(N))M=s[l+1],C=u.match(/^-(.\..+)/),C!==null&&Array.isArray(C)&&C.length>=2&&(f=C[1],M!==void 0&&!M.match(/^-/)&&!T(f,p.bools)&&!T(f,p.counts)?(G(f,M),l++):G(f,et(f)));else if(u.match(/^-[^-]+/)&&!u.match(N)){P=u.slice(1,-1).split(""),b=!1;for(let ut=0;ut<P.length;ut++){if(M=u.slice(ut+2),P[ut+1]&&P[ut+1]==="="){ct=u.slice(ut+3),f=P[ut],T(f,p.arrays)?l=Ot(l,f,s,ct):T(f,p.nargs)!==!1?l=ht(l,f,s,ct):G(f,ct),b=!0;break}if(M==="-"){G(P[ut],M);continue}if(/[A-Za-z]/.test(P[ut])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(M)&&T(M,p.bools)===!1){G(P[ut],M),b=!0;break}if(P[ut+1]&&P[ut+1].match(/\W/)){G(P[ut],M),b=!0;break}else G(P[ut],et(P[ut]))}f=u.slice(-1)[0],!b&&f!=="-"&&(T(f,p.arrays)?l=Ot(l,f,s):T(f,p.nargs)!==!1?l=ht(l,f,s):(M=s[l+1],M!==void 0&&(!/^(-|--)[^-]/.test(M)||M.match(N))&&!T(f,p.bools)&&!T(f,p.counts)||/^(true|false)$/.test(M)?(G(f,M),l++):G(f,et(f))))}else if(u.match(/^-[0-9]$/)&&u.match(N)&&T(u.slice(1),p.bools))f=u.slice(1),G(f,et(f));else if(u==="--"){z=s.slice(l+1);break}else if(c["halt-at-non-option"]){z=s.slice(l);break}else Z(u)}V(B,!0),V(B,!1),D(B),ot(),k(B,p.aliases,m,!0),at(B),c["set-placeholder-key"]&&Xt(B),Object.keys(p.counts).forEach(function(l){Ft(B,l.split("."))||G(l,0)}),h&&z.length&&(B[g]=[]),z.forEach(function(l){B[g].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 Z(l){let u=v("_",l);(typeof u=="string"||typeof u=="number")&&B._.push(u)}function ht(l,u,A,b){let f,P=T(u,p.nargs);if(P=typeof P!="number"||isNaN(P)?1:P,P===0)return jt(b)||(W=Error(O("Argument unexpected for: %s",u))),G(u,et(u)),l;let C=jt(b)?0:1;if(c["nargs-eats-options"])A.length-(l+1)+C<P&&(W=Error(O("Not enough arguments following: %s",u))),C=P;else{for(f=l+1;f<A.length&&(!A[f].match(/^-[^0-9]/)||A[f].match(N)||tt(A[f]));f++)C++;C<P&&(W=Error(O("Not enough arguments following: %s",u)))}let M=Math.min(C,P);for(!jt(b)&&M>0&&(G(u,b),M--),f=l+1;f<M+l+1;f++)G(u,A[f]);return l+M}function Ot(l,u,A,b){let f=[],P=b||A[l+1],C=T(u,p.nargs);if(T(u,p.bools)&&!/^(true|false)$/.test(P))f.push(!0);else if(jt(P)||jt(b)&&/^-/.test(P)&&!N.test(P)&&!tt(P)){if(m[u]!==void 0){let M=m[u];f=Array.isArray(M)?M:[M]}}else{jt(b)||f.push(E(u,b,!0));for(let M=l+1;M<A.length&&!(!c["greedy-arrays"]&&f.length>0||C&&typeof C=="number"&&f.length>=C||(P=A[M],/^-/.test(P)&&!N.test(P)&&!tt(P)));M++)l=M,f.push(E(u,P,i))}return typeof C=="number"&&(C&&f.length<C||isNaN(C)&&f.length===0)&&(W=Error(O("Not enough arguments following: %s",u))),G(u,f),l}function G(l,u,A=i){if(/-/.test(l)&&c["camel-case-expansion"]){let P=l.split(".").map(function(C){return ee(C)}).join(".");j(l,P)}let b=E(l,u,A),f=l.split(".");zt(B,f,b),p.aliases[l]&&p.aliases[l].forEach(function(P){let C=P.split(".");zt(B,C,b)}),f.length>1&&c["dot-notation"]&&(p.aliases[f[0]]||[]).forEach(function(P){let C=P.split("."),M=[].concat(f);M.shift(),C=C.concat(M),(p.aliases[l]||[]).includes(C.join("."))||zt(B,C,b)}),T(l,p.normalize)&&!T(l,p.arrays)&&[l].concat(p.aliases[l]||[]).forEach(function(C){Object.defineProperty(ft,C,{enumerable:!0,get(){return u},set(M){u=typeof M=="string"?Bt.normalize(M):M}})})}function j(l,u){p.aliases[l]&&p.aliases[l].length||(p.aliases[l]=[u],y[u]=!0),p.aliases[u]&&p.aliases[u].length||j(u,l)}function E(l,u,A){A&&(u=Xa(u)),(T(l,p.bools)||T(l,p.counts))&&typeof u=="string"&&(u=u==="true");let b=Array.isArray(u)?u.map(function(f){return v(l,f)}):v(l,u);return T(l,p.counts)&&(jt(b)||typeof b=="boolean")&&(b=fr()),T(l,p.normalize)&&T(l,p.arrays)&&(Array.isArray(u)?b=u.map(f=>Bt.normalize(f)):b=Bt.normalize(u)),b}function v(l,u){return!c["parse-positional-numbers"]&&l==="_"||!T(l,p.strings)&&!T(l,p.bools)&&!Array.isArray(u)&&(an(u)&&c["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${u}`)))||!jt(u)&&T(l,p.numbers))&&(u=Number(u)),u}function D(l){let u=Object.create(null);k(u,p.aliases,m),Object.keys(p.configs).forEach(function(A){let b=l[A]||u[A];if(b)try{let f=null,P=Bt.resolve(Bt.cwd(),b),C=p.configs[A];if(typeof C=="function"){try{f=C(P)}catch(M){f=M}if(f instanceof Error){W=f;return}}else f=Bt.require(P);q(f)}catch(f){f.name==="PermissionDenied"?W=f:l[A]&&(W=Error(O("Invalid JSON config file: %s",b)))}})}function q(l,u){Object.keys(l).forEach(function(A){let b=l[A],f=u?u+"."+A:A;typeof b=="object"&&b!==null&&!Array.isArray(b)&&c["dot-notation"]?q(b,f):(!Ft(B,f.split("."))||T(f,p.arrays)&&c["combine-arrays"])&&G(f,b)})}function ot(){typeof w<"u"&&w.forEach(function(l){q(l)})}function V(l,u){if(typeof d>"u")return;let A=typeof d=="string"?d:"",b=Bt.env();Object.keys(b).forEach(function(f){if(A===""||f.lastIndexOf(A,0)===0){let P=f.split("__").map(function(C,M){return M===0&&(C=C.substring(A.length)),ee(C)});(u&&p.configs[P.join(".")]||!u)&&!Ft(l,P)&&G(P.join("."),b[f])}})}function at(l){let u,A=new Set;Object.keys(l).forEach(function(b){if(!A.has(b)&&(u=T(b,p.coercions),typeof u=="function"))try{let f=v(b,u(l[b]));[].concat(p.aliases[b]||[],b).forEach(P=>{A.add(P),l[P]=f})}catch(f){W=f}})}function Xt(l){return p.keys.forEach(u=>{~u.indexOf(".")||typeof l[u]>"u"&&(l[u]=void 0)}),l}function k(l,u,A,b=!1){Object.keys(A).forEach(function(f){Ft(l,f.split("."))||(zt(l,f.split("."),A[f]),b&&(x[f]=!0),(u[f]||[]).forEach(function(P){Ft(l,P.split("."))||zt(l,P.split("."),A[f])}))})}function Ft(l,u){let A=l;c["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(f){A=A[f]||{}});let b=u[u.length-1];return typeof A!="object"?!1:b in A}function zt(l,u,A){let b=l;c["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(ct){ct=Fs(ct),typeof b=="object"&&b[ct]===void 0&&(b[ct]={}),typeof b[ct]!="object"||Array.isArray(b[ct])?(Array.isArray(b[ct])?b[ct].push({}):b[ct]=[b[ct],{}],b=b[ct][b[ct].length-1]):b=b[ct]});let f=Fs(u[u.length-1]),P=T(u.join("."),p.arrays),C=Array.isArray(A),M=c["duplicate-arguments-array"];!M&&T(f,p.nargs)&&(M=!0,(!jt(b[f])&&p.nargs[f]===1||Array.isArray(b[f])&&b[f].length===p.nargs[f])&&(b[f]=void 0)),A===fr()?b[f]=fr(b[f]):Array.isArray(b[f])?M&&P&&C?b[f]=c["flatten-duplicate-arrays"]?b[f].concat(A):(Array.isArray(b[f][0])?b[f]:[b[f]]).concat([A]):!M&&!!P==!!C?b[f]=A:b[f]=b[f].concat([A]):b[f]===void 0&&P?b[f]=C?A:[A]:M&&!(b[f]===void 0||T(f,p.counts)||T(f,p.bools))?b[f]=[b[f],A]:b[f]=A}function Zt(...l){l.forEach(function(u){Object.keys(u||{}).forEach(function(A){p.aliases[A]||(p.aliases[A]=[].concat(o[A]||[]),p.aliases[A].concat(A).forEach(function(b){if(/-/.test(b)&&c["camel-case-expansion"]){let f=ee(b);f!==A&&p.aliases[A].indexOf(f)===-1&&(p.aliases[A].push(f),y[f]=!0)}}),p.aliases[A].concat(A).forEach(function(b){if(b.length>1&&/[A-Z]/.test(b)&&c["camel-case-expansion"]){let f=on(b,"-");f!==A&&p.aliases[A].indexOf(f)===-1&&(p.aliases[A].push(f),y[f]=!0)}}),p.aliases[A].forEach(function(b){p.aliases[b]=[A].concat(p.aliases[A].filter(function(f){return b!==f}))}))})})}function T(l,u){let A=[].concat(p.aliases[l]||[],l),b=Object.keys(u),f=A.find(P=>b.includes(P));return f?u[f]:!1}function Cn(l){let u=Object.keys(p);return[].concat(u.map(b=>p[b])).some(function(b){return Array.isArray(b)?b.includes(l):b[l]})}function $(l,...u){return[].concat(...u).some(function(b){let f=l.match(b);return f&&Cn(f[1])})}function Q(l){if(l.match(N)||!l.match(/^-[^-]+/))return!1;let u=!0,A,b=l.slice(1).split("");for(let f=0;f<b.length;f++){if(A=l.slice(f+2),!Cn(b[f])){u=!1;break}if(b[f+1]&&b[f+1]==="="||A==="-"||/[A-Za-z]/.test(b[f])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(A)||b[f+1]&&b[f+1].match(/\W/))break}return u}function tt(l){return c["unknown-options-as-args"]&&R(l)}function R(l){return l=l.replace(/^-{3,}/,"--"),l.match(N)||Q(l)?!1:!$(l,/^-+([^=]+?)=[\s\S]*$/,U,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function et(l){return!T(l,p.bools)&&!T(l,p.counts)&&`${l}`in m?m[l]:st(Pt(l))}function st(l){return{[Et.BOOLEAN]:!0,[Et.STRING]:"",[Et.NUMBER]:void 0,[Et.ARRAY]:[]}[l]}function Pt(l){let u=Et.BOOLEAN;return T(l,p.strings)?u=Et.STRING:T(l,p.numbers)?u=Et.NUMBER:T(l,p.bools)?u=Et.BOOLEAN:T(l,p.arrays)&&(u=Et.ARRAY),u}function jt(l){return l===void 0}function Ve(){Object.keys(p.counts).find(l=>T(l,p.arrays)?(W=Error(O("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):T(l,p.nargs)?(W=Error(O("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({},x),error:W,newAliases:Object.assign({},y)}}};function Qa(r){let t=[],e=Object.create(null),n=!0;for(Object.keys(r).forEach(function(s){t.push([].concat(r[s],s))});n;){n=!1;for(let s=0;s<t.length;s++)for(let i=s+1;i<t.length;i++)if(t[s].filter(function(c){return t[i].indexOf(c)!==-1}).length){t[s]=t[s].concat(t[i]),t.splice(i,1),n=!0;break}}return t.forEach(function(s){s=s.filter(function(o,c,m){return m.indexOf(o)===c});let i=s.pop();i!==void 0&&typeof i=="string"&&(e[i]=s)}),e}function fr(r){return r!==void 0?r+1:1}function Fs(r){return r==="__proto__"?"___proto___":r}function Xa(r){return typeof r=="string"&&(r[0]==="'"||r[0]==='"')&&r[r.length-1]===r[0]?r.substring(1,r.length-1):r}var Ds=H("fs");var hr,ur,dr,zs=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Us=(ur=(hr=process==null?void 0:process.versions)===null||hr===void 0?void 0:hr.node)!==null&&ur!==void 0?ur:(dr=process==null?void 0:process.version)===null||dr===void 0?void 0:dr.slice(1);if(Us&&Number(Us.match(/^([^.]+)/)[1])<zs)throw Error(`yargs parser supports a minimum Node.js version of ${zs}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var Za=process?process.env:{},Ws=new cn({cwd:process.cwd,env:()=>Za,format:Ls.format,normalize:ln.normalize,resolve:ln.resolve,require:r=>{if(typeof H<"u")return H(r);if(r.match(/\.json$/))return JSON.parse((0,Ds.readFileSync)(r,"utf8"));throw Error("only .json config files are supported in ESM")}}),Le=function(t,e){return Ws.parse(t.slice(),e).argv};Le.detailed=function(r,t){return Ws.parse(r.slice(),t)};Le.camelCase=ee;Le.decamelize=on;Le.looksLikeNumber=an;var Bs=Le;var Mt=H("path");function ka(){return tc()?0:1}function tc(){return ec()&&!process.defaultApp}function ec(){return!!process.versions.electron}function Rs(){return process.argv[ka()]}var Y=class extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,Y)}};var Ee=H("fs"),Vs=H("util"),qs=H("path"),Hs={fs:{readFileSync:Ee.readFileSync,writeFile:Ee.writeFile},format:Vs.format,resolve:qs.resolve,exists:r=>{try{return(0,Ee.statSync)(r).isFile()}catch{return!1}}};var It,pr=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(),It.format.apply(It.format,[this.cache[this.locale][e]||e].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),s=t.shift(),i=function(){};typeof t[t.length-1]=="function"&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let o=s===1?e:n;this.cache[this.locale][e]&&(o=this.cache[this.locale][e][s===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:i})):i();let c=[o];return~o.indexOf("%d")&&c.push(s),It.format.apply(It.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(s,i){let o=e[i+1];n+=s,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,s=e.locale,i=e.cb,o=this._resolveLocaleFile(n,s),c=JSON.stringify(this.cache[s],null,2);It.fs.writeFile(o,c,"utf-8",function(m){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(m)})}_readLocaleFile(){let t={},e=this._resolveLocaleFile(this.directory,this.locale);try{It.fs.readFileSync&&(t=JSON.parse(It.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=It.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){let s=It.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(t){return It.exists(t)}};function Gs(r,t){It=t;let e=new pr(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 nc=r=>Gs(r,Hs),Ys=nc;var ic={},rc="require is not supported by ESM",Ks="loading a directory of commands is not supported yet for ESM",De;try{De=(0,Xs.fileURLToPath)(ic.url)}catch{De=process.cwd()}var sc=De.substring(0,De.lastIndexOf("node_modules")),Zs={assert:{notStrictEqual:fn.notStrictEqual,strictEqual:fn.strictEqual},cliui:lr,findUp:Ns,getEnv:r=>process.env[r],inspect:Js.inspect,getCallerFile:()=>{throw new Y(Ks)},getProcessArgvBin:Rs,mainFilename:sc||process.cwd(),Parser:Bs,path:{basename:Mt.basename,dirname:Mt.dirname,extname:Mt.extname,relative:Mt.relative,resolve:Mt.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:Qs.readFileSync,require:()=>{throw new Y(rc)},requireDirectory:()=>{throw new Y(Ks)},stringWidth:r=>[...r].length,y18n:Ys({directory:(0,Mt.resolve)(De,"../../../locales"),updateFiles:!1})};function dt(r,t,e,n){e.assert.notStrictEqual(r,t,n)}function mr(r,t){t.assert.strictEqual(typeof r,"string")}function Ce(r){return Object.keys(r)}function J(r){return!!r&&!!r.then&&typeof r.then=="function"}function Ht(r){let e=r.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=e.shift();if(!s)throw new Error(`No command found in: ${r}`);let i={cmd:s.replace(n,""),demanded:[],optional:[]};return e.forEach((o,c)=>{let m=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&c===e.length-1&&(m=!0),/^\[/.test(o)?i.optional.push({cmd:o.replace(n,"").split("|"),variadic:m}):i.demanded.push({cmd:o.replace(n,"").split("|"),variadic:m})}),i}var oc=["first","second","third","fourth","fifth","sixth"];function _(r,t,e){function n(){return typeof r=="object"?[{demanded:[],optional:[]},r,t]:[Ht(`cmd ${r}`),t,e]}try{let s=0,[i,o,c]=n(),m=[].slice.call(o);for(;m.length&&m[m.length-1]===void 0;)m.pop();let w=c||m.length;if(w<i.demanded.length)throw new Y(`Not enough arguments provided. Expected ${i.demanded.length} but received ${m.length}.`);let d=i.demanded.length+i.optional.length;if(w>d)throw new Y(`Too many arguments provided. Expected max ${d} but received ${w}.`);i.demanded.forEach(h=>{let g=m.shift(),y=ks(g);h.cmd.filter(O=>O===y||O==="*").length===0&&ti(y,h.cmd,s),s+=1}),i.optional.forEach(h=>{if(m.length===0)return;let g=m.shift(),y=ks(g);h.cmd.filter(O=>O===y||O==="*").length===0&&ti(y,h.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function ks(r){return Array.isArray(r)?"array":r===null?"null":typeof r}function ti(r,t,e){throw new Y(`Invalid ${oc[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,s=!1){if(_("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let i=0;i<t.length;i++){if(typeof t[i]!="function")throw Error("middleware must be a function");let o=t[i];o.applyBeforeValidation=e,o.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){let i=t;i.applyBeforeValidation=e,i.global=n,i.mutates=s,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(s=>{let i=[...n[e]||[],e];return s.option?!i.includes(s.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 ei(r){return r?r.map(t=>(t.applyBeforeValidation=!1,t)):[]}function ne(r,t,e,n){return e.reduce((s,i)=>{if(i.applyBeforeValidation!==n)return s;if(i.mutates){if(i.applied)return s;i.applied=!0}if(J(s))return s.then(o=>Promise.all([o,i(o,t)])).then(([o,c])=>Object.assign(o,c));{let o=i(s,t);return J(o)?o.then(c=>Object.assign(s,c)):Object.assign(s,o)}},r)}function re(r,t,e=n=>{throw n}){try{let n=ac(r)?r():r;return J(n)?n.then(s=>t(s)):t(n)}catch(n){return e(n)}}function ac(r){return typeof r=="function"}function gr(r){if(typeof H>"u")return null;for(let t=0,e=Object.keys(H.cache),n;t<e.length;t++)if(n=H.cache[e[t]],n.exports===r)return n;return null}var _e=/(^\*)|(^\$0)/,br=class{constructor(t,e,n,s){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=s,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,s){s=s||{},typeof s.recurse!="boolean"&&(s.recurse=!1),Array.isArray(s.extensions)||(s.extensions=["js"]);let i=typeof s.visit=="function"?s.visit:o=>o;s.visit=(o,c,m)=>{let w=i(o,c,m);if(w){if(this.requireCache.has(c))return w;this.requireCache.add(c),this.addHandler(w)}return w},this.shim.requireDirectory({require:e,filename:n},t,s)}addHandler(t,e,n,s,i,o){let c=[],m=ei(i);if(s=s||(()=>{}),Array.isArray(t))if(cc(t))[t,...c]=t;else for(let w of t)this.addHandler(w);else if(fc(t)){let w=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(w=[].concat(w).concat(t.aliases)),this.addHandler(w,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(ni(n)){this.addHandler([t].concat(c),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){let w=Ht(t);c=c.map(g=>Ht(g).cmd);let d=!1,h=[w.cmd].concat(c).filter(g=>_e.test(g)?(d=!0,!1):!0);h.length===0&&d&&h.push("$0"),d&&(w.cmd=h[0],c=h.slice(1),t=t.replace(_e,w.cmd)),c.forEach(g=>{this.aliasMap[g]=w.cmd}),e!==!1&&this.usage.command(t,e,d,c,o),this.handlers[w.cmd]={original:t,description:e,handler:s,builder:n||{},middlewares:m,deprecated:o,demanded:w.demanded,optional:w.optional},d&&(this.defaultCommand=this.handlers[w.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,s,i,o){let c=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,m=e.getInternalMethods().getContext(),w=m.commands.slice(),d=!t;t&&(m.commands.push(t),m.fullCommands.push(c.original));let h=this.applyBuilderUpdateUsageAndParse(d,c,e,n.aliases,w,s,i,o);return J(h)?h.then(g=>this.applyMiddlewareAndGetResult(d,c,g.innerArgv,m,i,g.aliases,e)):this.applyMiddlewareAndGetResult(d,c,h.innerArgv,m,i,h.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,s,i,o,c,m){let w=e.builder,d=n;if(un(w)){n.getInternalMethods().getUsageInstance().freeze();let h=w(n.getInternalMethods().reset(s),m);if(J(h))return h.then(g=>(d=si(g)?g:n,this.parseAndUpdateUsage(t,e,d,i,o,c)))}else lc(w)&&(n.getInternalMethods().getUsageInstance().freeze(),d=n.getInternalMethods().reset(s),Object.keys(e.builder).forEach(h=>{d.option(h,w[h])}));return this.parseAndUpdateUsage(t,e,d,i,o,c)}parseAndUpdateUsage(t,e,n,s,i,o){t&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(s,e),e.description);let c=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,o);return J(c)?c.then(m=>({aliases:n.parsed.aliases,innerArgv:m})):{aliases:n.parsed.aliases,innerArgv:c}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){let n=_e.test(e.original)?e.original.replace(_e,"").trim():e.original,s=t.filter(i=>!_e.test(i));return s.push(n),`$0 ${s.join(" ")}`}handleValidationAndGetResult(t,e,n,s,i,o,c,m){if(!o.getInternalMethods().getHasOutput()){let w=o.getInternalMethods().runValidation(i,m,o.parsed.error,t);n=re(n,d=>(w(d),d))}if(e.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();let w=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(n,w,!1,!1),n=ne(n,o,c,!1),n=re(n,d=>{let h=e.handler(d);return J(h)?h.then(()=>d):d}),t||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),J(n)&&!o.getInternalMethods().hasParseCallback()&&n.catch(d=>{try{o.getInternalMethods().getUsageInstance().fail(null,d)}catch{}})}return t||(s.commands.pop(),s.fullCommands.pop()),n}applyMiddlewareAndGetResult(t,e,n,s,i,o,c){let m={};if(i)return n;c.getInternalMethods().getHasOutput()||(m=this.populatePositionals(e,n,s,c));let w=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),d=ne(n,c,w,!0);return J(d)?d.then(h=>this.handleValidationAndGetResult(t,e,h,s,o,c,w,m)):this.handleValidationAndGetResult(t,e,d,s,o,c,w,m)}populatePositionals(t,e,n,s){e._=e._.slice(n.commands.length);let i=t.demanded.slice(0),o=t.optional.slice(0),c={};for(this.validation.positionalCount(i.length,e._.length);i.length;){let m=i.shift();this.populatePositional(m,e,c)}for(;o.length;){let m=o.shift();this.populatePositional(m,e,c)}return e._=n.commands.concat(e._.map(m=>""+m)),this.postProcessPositionals(e,c,this.cmdToParseOptions(t.original),s),c}populatePositional(t,e,n){let s=t.cmd[0];t.variadic?n[s]=e._.splice(0).map(String):e._.length&&(n[s]=[String(e._.shift())])}cmdToParseOptions(t){let e={array:[],default:{},alias:{},demand:{}},n=Ht(t);return n.demanded.forEach(s=>{let[i,...o]=s.cmd;s.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=o,e.demand[i]=!0}),n.optional.forEach(s=>{let[i,...o]=s.cmd;s.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=o}),e}postProcessPositionals(t,e,n,s){let i=Object.assign({},s.getOptions());i.default=Object.assign(n.default,i.default);for(let w of Object.keys(n.alias))i.alias[w]=(i.alias[w]||[]).concat(n.alias[w]);i.array=i.array.concat(n.array),i.config={};let o=[];if(Object.keys(e).forEach(w=>{e[w].map(d=>{i.configuration["unknown-options-as-args"]&&(i.key[w]=!0),o.push(`--${w}`),o.push(d)})}),!o.length)return;let c=Object.assign({},i.configuration,{"populate--":!1}),m=this.shim.Parser.detailed(o,Object.assign({},i,{configuration:c}));if(m.error)s.getInternalMethods().getUsageInstance().fail(m.error.message,m.error);else{let w=Object.keys(e);Object.keys(e).forEach(d=>{w.push(...m.aliases[d])}),Object.keys(m.argv).forEach(d=>{w.includes(d)&&(e[d]||(e[d]=m.argv[d]),!this.isInConfigs(s,d)&&!this.isDefaulted(s,d)&&Object.prototype.hasOwnProperty.call(t,d)&&Object.prototype.hasOwnProperty.call(m.argv,d)&&(Array.isArray(t[d])||Array.isArray(m.argv[d]))?t[d]=[].concat(t[d],m.argv[d]):t[d]=m.argv[d])})}}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(s=>Object.prototype.hasOwnProperty.call(s,e))||n.some(s=>Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e)))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let n=_e.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(un(e))return e(t,!0);ni(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){let e=gr(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 s of[t,e,n]){if(typeof s=="string"||s===!1)return s;dt(s,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let t=this.frozens.pop();dt(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 ri(r,t,e,n){return new br(r,t,e,n)}function ni(r){return typeof r=="object"&&!!r.builder&&typeof r.handler=="function"}function cc(r){return r.every(t=>typeof t=="string")}function un(r){return typeof r=="function"}function lc(r){return typeof r=="object"}function fc(r){return typeof r=="object"&&!Array.isArray(r)}function Gt(r={},t=()=>!0){let e={};return Ce(r).forEach(n=>{t(n,r[n])&&(e[n]=r[n])}),e}function Yt(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 hc(r){return typeof r=="boolean"}function oi(r,t){let e=t.y18n.__,n={},s=[];n.failFn=function(E){s.push(E)};let i=null,o=null,c=!0;n.showHelpOnFail=function(E=!0,v){let[D,q]=typeof E=="string"?[!0,E]:[E,v];return r.getInternalMethods().isGlobalContext()&&(o=q),i=q,c=D,n};let m=!1;n.fail=function(E,v){let D=r.getInternalMethods().getLoggerInstance();if(s.length)for(let q=s.length-1;q>=0;--q){let ot=s[q];if(hc(ot)){if(v)throw v;if(E)throw Error(E)}else ot(E,v,n)}else{if(r.getExitProcess()&&Yt(!0),!m){m=!0,c&&(r.showHelp("error"),D.error()),(E||v)&&D.error(E||v);let q=i||o;q&&((E||v)&&D.error(""),D.error(q))}if(v=v||new Y(E),r.getExitProcess())return r.exit(1);if(r.getInternalMethods().hasParseCallback())return r.exit(1,v);throw v}};let w=[],d=!1;n.usage=(j,E)=>j===null?(d=!0,w=[],n):(d=!1,w.push([j,E||""]),n),n.getUsage=()=>w,n.getUsageDisabled=()=>d,n.getPositionalGroupName=()=>e("Positionals:");let h=[];n.example=(j,E)=>{h.push([j,E||""])};let g=[];n.command=function(E,v,D,q,ot=!1){D&&(g=g.map(V=>(V[2]=!1,V))),g.push([E,v||"",D,q,ot])},n.getCommands=()=>g;let y={};n.describe=function(E,v){Array.isArray(E)?E.forEach(D=>{n.describe(D,v)}):typeof E=="object"?Object.keys(E).forEach(D=>{n.describe(D,E[D])}):y[E]=v},n.getDescriptions=()=>y;let x=[];n.epilog=j=>{x.push(j)};let O=!1,p;n.wrap=j=>{O=!0,p=j},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(O||(p=ht(),O=!0),p);let N="__yargsString__:";n.deferY18nLookup=j=>N+j,n.help=function(){if(z)return z;W();let E=r.customScriptName?r.$0:t.path.basename(r.$0),v=r.getDemandedOptions(),D=r.getDemandedCommands(),q=r.getDeprecatedOptions(),ot=r.getGroups(),V=r.getOptions(),at=[];at=at.concat(Object.keys(y)),at=at.concat(Object.keys(v)),at=at.concat(Object.keys(D)),at=at.concat(Object.keys(V.default)),at=at.filter(ft),at=Object.keys(at.reduce(($,Q)=>(Q!=="_"&&($[Q]=!0),$),{}));let Xt=n.getWrap(),k=t.cliui({width:Xt,wrap:!!Xt});if(!d){if(w.length)w.forEach($=>{k.div({text:`${$[0].replace(/\$0/g,E)}`}),$[1]&&k.div({text:`${$[1]}`,padding:[1,0,0,0]})}),k.div();else if(g.length){let $=null;D._?$=`${E} <${e("command")}>
9
- `:$=`${E} [${e("command")}]
10
- `,k.div(`${$}`)}}if(g.length>1||g.length===1&&!g[0][2]){k.div(e("Commands:"));let $=r.getInternalMethods().getContext(),Q=$.commands.length?`${$.commands.join(" ")} `:"";r.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(g=g.sort((R,et)=>R[0].localeCompare(et[0])));let tt=E?`${E} `:"";g.forEach(R=>{let et=`${tt}${Q}${R[0].replace(/^\$0 ?/,"")}`;k.span({text:et,padding:[0,2,0,2],width:U(g,Xt,`${E}${Q}`)+4},{text:R[1]});let st=[];R[2]&&st.push(`[${e("default")}]`),R[3]&&R[3].length&&st.push(`[${e("aliases:")} ${R[3].join(", ")}]`),R[4]&&(typeof R[4]=="string"?st.push(`[${e("deprecated: %s",R[4])}]`):st.push(`[${e("deprecated")}]`)),st.length?k.div({text:st.join(" "),padding:[0,0,0,2],align:"right"}):k.div()}),k.div()}let Ft=(Object.keys(V.alias)||[]).concat(Object.keys(r.parsed.newAliases)||[]);at=at.filter($=>!r.parsed.newAliases[$]&&Ft.every(Q=>(V.alias[Q]||[]).indexOf($)===-1));let zt=e("Options:");ot[zt]||(ot[zt]=[]),B(at,V.alias,ot,zt);let Zt=$=>/^--/.test(dn($)),T=Object.keys(ot).filter($=>ot[$].length>0).map($=>{let Q=ot[$].filter(ft).map(tt=>{if(Ft.includes(tt))return tt;for(let R=0,et;(et=Ft[R])!==void 0;R++)if((V.alias[et]||[]).includes(tt))return et;return tt});return{groupName:$,normalizedKeys:Q}}).filter(({normalizedKeys:$})=>$.length>0).map(({groupName:$,normalizedKeys:Q})=>{let tt=Q.reduce((R,et)=>(R[et]=[et].concat(V.alias[et]||[]).map(st=>$===n.getPositionalGroupName()?st:(/^[0-9]$/.test(st)?V.boolean.includes(et)?"-":"--":st.length>1?"--":"-")+st).sort((st,Pt)=>Zt(st)===Zt(Pt)?0:Zt(st)?1:-1).join(", "),R),{});return{groupName:$,normalizedKeys:Q,switches:tt}});if(T.filter(({groupName:$})=>$!==n.getPositionalGroupName()).some(({normalizedKeys:$,switches:Q})=>!$.every(tt=>Zt(Q[tt])))&&T.filter(({groupName:$})=>$!==n.getPositionalGroupName()).forEach(({normalizedKeys:$,switches:Q})=>{$.forEach(tt=>{Zt(Q[tt])&&(Q[tt]=uc(Q[tt],4))})}),T.forEach(({groupName:$,normalizedKeys:Q,switches:tt})=>{k.div($),Q.forEach(R=>{let et=tt[R],st=y[R]||"",Pt=null;st.includes(N)&&(st=e(st.substring(N.length))),V.boolean.includes(R)&&(Pt=`[${e("boolean")}]`),V.count.includes(R)&&(Pt=`[${e("count")}]`),V.string.includes(R)&&(Pt=`[${e("string")}]`),V.normalize.includes(R)&&(Pt=`[${e("string")}]`),V.array.includes(R)&&(Pt=`[${e("array")}]`),V.number.includes(R)&&(Pt=`[${e("number")}]`);let jt=u=>typeof u=="string"?`[${e("deprecated: %s",u)}]`:`[${e("deprecated")}]`,Ve=[R in q?jt(q[R]):null,Pt,R in v?`[${e("required")}]`:null,V.choices&&V.choices[R]?`[${e("choices:")} ${n.stringifiedValues(V.choices[R])}]`:null,Z(V.default[R],V.defaultDescription[R])].filter(Boolean).join(" ");k.span({text:dn(et),padding:[0,2,0,2+ii(et)],width:U(tt,Xt)+4},st);let l=r.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;Ve&&!l?k.div({text:Ve,padding:[0,0,0,2],align:"right"}):k.div()}),k.div()}),h.length&&(k.div(e("Examples:")),h.forEach($=>{$[0]=$[0].replace(/\$0/g,E)}),h.forEach($=>{$[1]===""?k.div({text:$[0],padding:[0,2,0,2]}):k.div({text:$[0],padding:[0,2,0,2],width:U(h,Xt)+4},{text:$[1]})}),k.div()),x.length>0){let $=x.map(Q=>Q.replace(/\$0/g,E)).join(`
11
- `);k.div(`${$}
12
- `)}return k.toString().replace(/\s*$/,"")};function U(j,E,v){let D=0;return Array.isArray(j)||(j=Object.values(j).map(q=>[q])),j.forEach(q=>{D=Math.max(t.stringWidth(v?`${v} ${dn(q[0])}`:dn(q[0]))+ii(q[0]),D)}),E&&(D=Math.min(D,parseInt((E*.5).toString(),10))),D}function W(){let j=r.getDemandedOptions(),E=r.getOptions();(Object.keys(E.alias)||[]).forEach(v=>{E.alias[v].forEach(D=>{y[D]&&n.describe(v,y[D]),D in j&&r.demandOption(v,j[D]),E.boolean.includes(D)&&r.boolean(v),E.count.includes(D)&&r.count(v),E.string.includes(D)&&r.string(v),E.normalize.includes(D)&&r.normalize(v),E.array.includes(D)&&r.array(v),E.number.includes(D)&&r.number(v)})})}let z;n.cacheHelpMessage=function(){z=this.help()},n.clearCachedHelpMessage=function(){z=void 0},n.hasCachedHelpMessage=function(){return!!z};function B(j,E,v,D){let q=[],ot=null;return Object.keys(v).forEach(V=>{q=q.concat(v[V])}),j.forEach(V=>{ot=[V].concat(E[V]),ot.some(at=>q.indexOf(at)!==-1)||v[D].push(V)}),q}function ft(j){return r.getOptions().hiddenOptions.indexOf(j)<0||r.parsed.argv[r.getOptions().showHiddenOpt]}n.showHelp=j=>{let E=r.getInternalMethods().getLoggerInstance();j||(j="error"),(typeof j=="function"?j:E[j])(n.help())},n.functionDescription=j=>["(",j.name?t.Parser.decamelize(j.name,"-"):e("generated-value"),")"].join(""),n.stringifiedValues=function(E,v){let D="",q=v||", ",ot=[].concat(E);return!E||!ot.length||ot.forEach(V=>{D.length&&(D+=q),D+=JSON.stringify(V)}),D};function Z(j,E){let v=`[${e("default:")} `;if(j===void 0&&!E)return null;if(E)v+=E;else switch(typeof j){case"string":v+=`"${j}"`;break;case"object":v+=JSON.stringify(j);break;default:v+=j}return`${v}]`}function ht(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let Ot=null;n.version=j=>{Ot=j},n.showVersion=j=>{let E=r.getInternalMethods().getLoggerInstance();j||(j="error"),(typeof j=="function"?j:E[j])(Ot)},n.reset=function(E){return i=null,m=!1,w=[],d=!1,x=[],h=[],g=[],y=Gt(y,v=>!E[v]),n};let G=[];return n.freeze=function(){G.push({failMessage:i,failureOutput:m,usages:w,usageDisabled:d,epilogs:x,examples:h,commands:g,descriptions:y})},n.unfreeze=function(E=!1){let v=G.pop();v&&(E?(y={...v.descriptions,...y},g=[...v.commands,...g],w=[...v.usages,...w],h=[...v.examples,...h],x=[...v.epilogs,...x]):{failMessage:i,failureOutput:m,usages:w,usageDisabled:d,epilogs:x,examples:h,commands:g,descriptions:y}=v)},n}function wr(r){return typeof r=="object"}function uc(r,t){return wr(r)?{text:r.text,indentation:r.indentation+t}:{text:r,indentation:t}}function ii(r){return wr(r)?r.indentation:0}function dn(r){return wr(r)?r.text:r}var ai=`###-begin-{{app_name}}-completions-###
7
+ `),i.border&&(s.unshift("."+"-".repeat(this.negatePadding(i)+2)+"."),s.push("'"+"-".repeat(this.negatePadding(i)+2)+"'")),i.padding&&(s.unshift(...new Array(i.padding[Ff]||0).fill("")),s.push(...new Array(i.padding[Lf]||0).fill(""))),s.forEach((c,l)=>{t[l]||t.push([]);let b=t[l];for(let h=0;h<o;h++)b[h]===void 0&&b.push("");b.push(c)})}),t}negatePadding(e){let t=e.width||0;return e.padding&&(t-=(e.padding[cn]||0)+(e.padding[an]||0)),e.border&&(t-=4),t}columnWidths(e){if(!this.wrap)return e.map(o=>o.width||we.stringWidth(o.text));let t=e.length,n=this.width,s=e.map(o=>{if(o.width)return t--,n-=o.width,o.width}),i=t?Math.floor(n/t):0;return s.map((o,c)=>o===void 0?Math.max(i,Bf(e[c])):o)}};function Ci(r,e,t){return r.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function Bf(r){let e=r.padding||[],t=1+(e[cn]||0)+(e[an]||0);return r.border?t+4:t}function Rf(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Vf(r,e){r=r.trim();let t=we.stringWidth(r);return t<e?" ".repeat(e-t)+r:r}function Wf(r,e){r=r.trim();let t=we.stringWidth(r);return t>=e?r:" ".repeat(e-t>>1)+r}var we;function Ai(r,e){return we=e,new Tr({width:r?.width||Rf(),wrap:r?.wrap})}var Ei=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function Fr(r){return r.replace(Ei,"")}function Oi(r,e){let[t,n]=r.match(Ei)||["",""];r=Fr(r);let s="";for(let i=0;i<r.length;i++)i!==0&&i%e===0&&(s+=`
8
+ `),s+=r.charAt(i);return t&&n&&(s=`${t}${s}${n}`),s}function Lr(r){return Ai(r,{stringWidth:e=>[...e].length,stripAnsi:Fr,wrap:Oi})}var Pt=G("path"),fn=G("fs");function vi(r,e){let t=(0,Pt.resolve)(".",r),n;for((0,fn.statSync)(t).isDirectory()||(t=(0,Pt.dirname)(t));;){if(n=e(t,(0,fn.readdirSync)(t)),n)return(0,Pt.resolve)(t,n);if(t=(0,Pt.dirname)(n=t),n===t)break}}var Ri=G("util"),Vi=G("fs"),Wi=G("url");var ji=G("util"),dn=G("path");function rt(r){if(r!==r.toLowerCase()&&r!==r.toUpperCase()||(r=r.toLowerCase()),r.indexOf("-")===-1&&r.indexOf("_")===-1)return r;{let t="",n=!1,s=r.match(/^-+/);for(let i=s?s[0].length:0;i<r.length;i++){let o=r.charAt(i);n&&(n=!1,o=o.toUpperCase()),i!==0&&(o==="-"||o==="_")?n=!0:o!=="-"&&o!=="_"&&(t+=o)}return t}}function ln(r,e){let t=r.toLowerCase();e=e||"-";let n="";for(let s=0;s<r.length;s++){let i=t.charAt(s),o=r.charAt(s);i!==o&&s>0?n+=`${e}${t.charAt(s)}`:n+=o}return n}function hn(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 Si(r){if(Array.isArray(r))return r.map(o=>typeof o!="string"?o+"":o);r=r.trim();let e=0,t=null,n=null,s=null,i=[];for(let o=0;o<r.length;o++){if(t=n,n=r.charAt(o),n===" "&&!s){t!==" "&&e++;continue}n===s?s=null:(n==="'"||n==='"')&&!s&&(s=n),i[e]||(i[e]=""),i[e]+=n}return i}var Oe;(function(r){r.BOOLEAN="boolean",r.STRING="string",r.NUMBER="number",r.ARRAY="array"})(Oe||(Oe={}));var Re,un=class{constructor(e){Re=e}parse(e,t){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},t),s=Si(e),i=typeof e=="string",o=qf(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),l=Object.assign(Object.create(null),n.default),b=n.configObjects||[],h=n.envPrefix,d=c["populate--"],g=d?"--":"_",x=Object.create(null),w=Object.create(null),C=n.__||Re.format,m={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:[]},_=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,j=new RegExp("^--"+c["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(f){let p=typeof f=="object"?f.key:f,A=Object.keys(f).map(function(y){return{boolean:"bools",string:"strings",number:"numbers"}[y]}).filter(Boolean).pop();A&&(m[A][p]=!0),m.arrays[p]=!0,m.keys.push(p)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(f){m.bools[f]=!0,m.keys.push(f)}),[].concat(n.string||[]).filter(Boolean).forEach(function(f){m.strings[f]=!0,m.keys.push(f)}),[].concat(n.number||[]).filter(Boolean).forEach(function(f){m.numbers[f]=!0,m.keys.push(f)}),[].concat(n.count||[]).filter(Boolean).forEach(function(f){m.counts[f]=!0,m.keys.push(f)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(f){m.normalize[f]=!0,m.keys.push(f)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([f,p])=>{typeof p=="number"&&(m.nargs[f]=p,m.keys.push(f))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([f,p])=>{typeof p=="function"&&(m.coercions[f]=p,m.keys.push(f))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(f){m.configs[f]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([f,p])=>{(typeof p=="boolean"||typeof p=="function")&&(m.configs[f]=p)})),ke(n.key,o,n.default,m.arrays),Object.keys(l).forEach(function(f){(m.aliases[f]||[]).forEach(function(p){l[p]=l[f]})});let U=null;Jt();let M=[],T=Object.assign(Object.create(null),{_:[]}),K={};for(let f=0;f<s.length;f++){let p=s[f],A=p.replace(/^-{3,}/,"---"),y,u,P,O,D,he;if(p!=="--"&&/^-/.test(p)&&ne(p))V(p);else if(A.match(/^---+(=|$)/)){V(p);continue}else if(p.match(/^--.+=/)||!c["short-option-groups"]&&p.match(/^-.+=/))O=p.match(/^--?([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&(F(O[1],m.arrays)?f=de(f,O[1],s,O[2]):F(O[1],m.nargs)!==!1?f=J(f,O[1],s,O[2]):Y(O[1],O[2],!0));else if(p.match(j)&&c["boolean-negation"])O=p.match(j),O!==null&&Array.isArray(O)&&O.length>=2&&(u=O[1],Y(u,F(u,m.arrays)?[!1]:!1));else if(p.match(/^--.+/)||!c["short-option-groups"]&&p.match(/^-[^-]+/))O=p.match(/^--?(.+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(u=O[1],F(u,m.arrays)?f=de(f,u,s):F(u,m.nargs)!==!1?f=J(f,u,s):(D=s[f+1],D!==void 0&&(!D.match(/^-/)||D.match(_))&&!F(u,m.bools)&&!F(u,m.counts)||/^(true|false)$/.test(D)?(Y(u,D),f++):Y(u,re(u))));else if(p.match(/^-.\..+=/))O=p.match(/^-([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&Y(O[1],O[2]);else if(p.match(/^-.\..+/)&&!p.match(_))D=s[f+1],O=p.match(/^-(.\..+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(u=O[1],D!==void 0&&!D.match(/^-/)&&!F(u,m.bools)&&!F(u,m.counts)?(Y(u,D),f++):Y(u,re(u)));else if(p.match(/^-[^-]+/)&&!p.match(_)){P=p.slice(1,-1).split(""),y=!1;for(let pe=0;pe<P.length;pe++){if(D=p.slice(pe+2),P[pe+1]&&P[pe+1]==="="){he=p.slice(pe+3),u=P[pe],F(u,m.arrays)?f=de(f,u,s,he):F(u,m.nargs)!==!1?f=J(f,u,s,he):Y(u,he),y=!0;break}if(D==="-"){Y(P[pe],D);continue}if(/[A-Za-z]/.test(P[pe])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(D)&&F(D,m.bools)===!1){Y(P[pe],D),y=!0;break}if(P[pe+1]&&P[pe+1].match(/\W/)){Y(P[pe],D),y=!0;break}else Y(P[pe],re(P[pe]))}u=p.slice(-1)[0],!y&&u!=="-"&&(F(u,m.arrays)?f=de(f,u,s):F(u,m.nargs)!==!1?f=J(f,u,s):(D=s[f+1],D!==void 0&&(!/^(-|--)[^-]/.test(D)||D.match(_))&&!F(u,m.bools)&&!F(u,m.counts)||/^(true|false)$/.test(D)?(Y(u,D),f++):Y(u,re(u))))}else if(p.match(/^-[0-9]$/)&&p.match(_)&&F(p.slice(1),m.bools))u=p.slice(1),Y(u,re(u));else if(p==="--"){M=s.slice(f+1);break}else if(c["halt-at-non-option"]){M=s.slice(f);break}else V(p)}q(T,!0),q(T,!1),R(T),fe(),te(T,m.aliases,l,!0),le(T),c["set-placeholder-key"]&&Ze(T),Object.keys(m.counts).forEach(function(f){Te(T,f.split("."))||Y(f,0)}),d&&M.length&&(T[g]=[]),M.forEach(function(f){T[g].push(f)}),c["camel-case-expansion"]&&c["strip-dashed"]&&Object.keys(T).filter(f=>f!=="--"&&f.includes("-")).forEach(f=>{delete T[f]}),c["strip-aliased"]&&[].concat(...Object.keys(o).map(f=>o[f])).forEach(f=>{c["camel-case-expansion"]&&f.includes("-")&&delete T[f.split(".").map(p=>rt(p)).join(".")],delete T[f]});function V(f){let p=I("_",f);(typeof p=="string"||typeof p=="number")&&T._.push(p)}function J(f,p,A,y){let u,P=F(p,m.nargs);if(P=typeof P!="number"||isNaN(P)?1:P,P===0)return je(y)||(U=Error(C("Argument unexpected for: %s",p))),Y(p,re(p)),f;let O=je(y)?0:1;if(c["nargs-eats-options"])A.length-(f+1)+O<P&&(U=Error(C("Not enough arguments following: %s",p))),O=P;else{for(u=f+1;u<A.length&&(!A[u].match(/^-[^0-9]/)||A[u].match(_)||ne(A[u]));u++)O++;O<P&&(U=Error(C("Not enough arguments following: %s",p)))}let D=Math.min(O,P);for(!je(y)&&D>0&&(Y(p,y),D--),u=f+1;u<D+f+1;u++)Y(p,A[u]);return f+D}function de(f,p,A,y){let u=[],P=y||A[f+1],O=F(p,m.nargs);if(F(p,m.bools)&&!/^(true|false)$/.test(P))u.push(!0);else if(je(P)||je(y)&&/^-/.test(P)&&!_.test(P)&&!ne(P)){if(l[p]!==void 0){let D=l[p];u=Array.isArray(D)?D:[D]}}else{je(y)||u.push(E(p,y,!0));for(let D=f+1;D<A.length&&!(!c["greedy-arrays"]&&u.length>0||O&&typeof O=="number"&&u.length>=O||(P=A[D],/^-/.test(P)&&!_.test(P)&&!ne(P)));D++)f=D,u.push(E(p,P,i))}return typeof O=="number"&&(O&&u.length<O||isNaN(O)&&u.length===0)&&(U=Error(C("Not enough arguments following: %s",p))),Y(p,u),f}function Y(f,p,A=i){if(/-/.test(f)&&c["camel-case-expansion"]){let P=f.split(".").map(function(O){return rt(O)}).join(".");N(f,P)}let y=E(f,p,A),u=f.split(".");Fe(T,u,y),m.aliases[f]&&m.aliases[f].forEach(function(P){let O=P.split(".");Fe(T,O,y)}),u.length>1&&c["dot-notation"]&&(m.aliases[u[0]]||[]).forEach(function(P){let O=P.split("."),D=[].concat(u);D.shift(),O=O.concat(D),(m.aliases[f]||[]).includes(O.join("."))||Fe(T,O,y)}),F(f,m.normalize)&&!F(f,m.arrays)&&[f].concat(m.aliases[f]||[]).forEach(function(O){Object.defineProperty(K,O,{enumerable:!0,get(){return p},set(D){p=typeof D=="string"?Re.normalize(D):D}})})}function N(f,p){m.aliases[f]&&m.aliases[f].length||(m.aliases[f]=[p],x[p]=!0),m.aliases[p]&&m.aliases[p].length||N(p,f)}function E(f,p,A){A&&(p=Hf(p)),(F(f,m.bools)||F(f,m.counts))&&typeof p=="string"&&(p=p==="true");let y=Array.isArray(p)?p.map(function(u){return I(f,u)}):I(f,p);return F(f,m.counts)&&(je(y)||typeof y=="boolean")&&(y=Br()),F(f,m.normalize)&&F(f,m.arrays)&&(Array.isArray(p)?y=p.map(u=>Re.normalize(u)):y=Re.normalize(p)),y}function I(f,p){return!c["parse-positional-numbers"]&&f==="_"||!F(f,m.strings)&&!F(f,m.bools)&&!Array.isArray(p)&&(hn(p)&&c["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${p}`)))||!je(p)&&F(f,m.numbers))&&(p=Number(p)),p}function R(f){let p=Object.create(null);te(p,m.aliases,l),Object.keys(m.configs).forEach(function(A){let y=f[A]||p[A];if(y)try{let u=null,P=Re.resolve(Re.cwd(),y),O=m.configs[A];if(typeof O=="function"){try{u=O(P)}catch(D){u=D}if(u instanceof Error){U=u;return}}else u=Re.require(P);H(u)}catch(u){u.name==="PermissionDenied"?U=u:f[A]&&(U=Error(C("Invalid JSON config file: %s",y)))}})}function H(f,p){Object.keys(f).forEach(function(A){let y=f[A],u=p?p+"."+A:A;typeof y=="object"&&y!==null&&!Array.isArray(y)&&c["dot-notation"]?H(y,u):(!Te(T,u.split("."))||F(u,m.arrays)&&c["combine-arrays"])&&Y(u,y)})}function fe(){typeof b<"u"&&b.forEach(function(f){H(f)})}function q(f,p){if(typeof h>"u")return;let A=typeof h=="string"?h:"",y=Re.env();Object.keys(y).forEach(function(u){if(A===""||u.lastIndexOf(A,0)===0){let P=u.split("__").map(function(O,D){return D===0&&(O=O.substring(A.length)),rt(O)});(p&&m.configs[P.join(".")]||!p)&&!Te(f,P)&&Y(P.join("."),y[u])}})}function le(f){let p,A=new Set;Object.keys(f).forEach(function(y){if(!A.has(y)&&(p=F(y,m.coercions),typeof p=="function"))try{let u=I(y,p(f[y]));[].concat(m.aliases[y]||[],y).forEach(P=>{A.add(P),f[P]=u})}catch(u){U=u}})}function Ze(f){return m.keys.forEach(p=>{~p.indexOf(".")||typeof f[p]>"u"&&(f[p]=void 0)}),f}function te(f,p,A,y=!1){Object.keys(A).forEach(function(u){Te(f,u.split("."))||(Fe(f,u.split("."),A[u]),y&&(w[u]=!0),(p[u]||[]).forEach(function(P){Te(f,P.split("."))||Fe(f,P.split("."),A[u])}))})}function Te(f,p){let A=f;c["dot-notation"]||(p=[p.join(".")]),p.slice(0,-1).forEach(function(u){A=A[u]||{}});let y=p[p.length-1];return typeof A!="object"?!1:y in A}function Fe(f,p,A){let y=f;c["dot-notation"]||(p=[p.join(".")]),p.slice(0,-1).forEach(function(he){he=_i(he),typeof y=="object"&&y[he]===void 0&&(y[he]={}),typeof y[he]!="object"||Array.isArray(y[he])?(Array.isArray(y[he])?y[he].push({}):y[he]=[y[he],{}],y=y[he][y[he].length-1]):y=y[he]});let u=_i(p[p.length-1]),P=F(p.join("."),m.arrays),O=Array.isArray(A),D=c["duplicate-arguments-array"];!D&&F(u,m.nargs)&&(D=!0,(!je(y[u])&&m.nargs[u]===1||Array.isArray(y[u])&&y[u].length===m.nargs[u])&&(y[u]=void 0)),A===Br()?y[u]=Br(y[u]):Array.isArray(y[u])?D&&P&&O?y[u]=c["flatten-duplicate-arrays"]?y[u].concat(A):(Array.isArray(y[u][0])?y[u]:[y[u]]).concat([A]):!D&&!!P==!!O?y[u]=A:y[u]=y[u].concat([A]):y[u]===void 0&&P?y[u]=O?A:[A]:D&&!(y[u]===void 0||F(u,m.counts)||F(u,m.bools))?y[u]=[y[u],A]:y[u]=A}function ke(...f){f.forEach(function(p){Object.keys(p||{}).forEach(function(A){m.aliases[A]||(m.aliases[A]=[].concat(o[A]||[]),m.aliases[A].concat(A).forEach(function(y){if(/-/.test(y)&&c["camel-case-expansion"]){let u=rt(y);u!==A&&m.aliases[A].indexOf(u)===-1&&(m.aliases[A].push(u),x[u]=!0)}}),m.aliases[A].concat(A).forEach(function(y){if(y.length>1&&/[A-Z]/.test(y)&&c["camel-case-expansion"]){let u=ln(y,"-");u!==A&&m.aliases[A].indexOf(u)===-1&&(m.aliases[A].push(u),x[u]=!0)}}),m.aliases[A].forEach(function(y){m.aliases[y]=[A].concat(m.aliases[A].filter(function(u){return y!==u}))}))})})}function F(f,p){let A=[].concat(m.aliases[f]||[],f),y=Object.keys(p),u=A.find(P=>y.includes(P));return u?p[u]:!1}function In(f){let p=Object.keys(m);return[].concat(p.map(y=>m[y])).some(function(y){return Array.isArray(y)?y.includes(f):y[f]})}function z(f,...p){return[].concat(...p).some(function(y){let u=f.match(y);return u&&In(u[1])})}function ee(f){if(f.match(_)||!f.match(/^-[^-]+/))return!1;let p=!0,A,y=f.slice(1).split("");for(let u=0;u<y.length;u++){if(A=f.slice(u+2),!In(y[u])){p=!1;break}if(y[u+1]&&y[u+1]==="="||A==="-"||/[A-Za-z]/.test(y[u])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(A)||y[u+1]&&y[u+1].match(/\W/))break}return p}function ne(f){return c["unknown-options-as-args"]&&W(f)}function W(f){return f=f.replace(/^-{3,}/,"--"),f.match(_)||ee(f)?!1:!z(f,/^-+([^=]+?)=[\s\S]*$/,j,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function re(f){return!F(f,m.bools)&&!F(f,m.counts)&&`${f}`in l?l[f]:ae(Pe(f))}function ae(f){return{[Oe.BOOLEAN]:!0,[Oe.STRING]:"",[Oe.NUMBER]:void 0,[Oe.ARRAY]:[]}[f]}function Pe(f){let p=Oe.BOOLEAN;return F(f,m.strings)?p=Oe.STRING:F(f,m.numbers)?p=Oe.NUMBER:F(f,m.bools)?p=Oe.BOOLEAN:F(f,m.arrays)&&(p=Oe.ARRAY),p}function je(f){return f===void 0}function Jt(){Object.keys(m.counts).find(f=>F(f,m.arrays)?(U=Error(C("Invalid configuration: %s, opts.count excludes opts.array.",f)),!0):F(f,m.nargs)?(U=Error(C("Invalid configuration: %s, opts.count excludes opts.narg.",f)),!0):!1)}return{aliases:Object.assign({},m.aliases),argv:Object.assign(K,T),configuration:c,defaulted:Object.assign({},w),error:U,newAliases:Object.assign({},x)}}};function qf(r){let e=[],t=Object.create(null),n=!0;for(Object.keys(r).forEach(function(s){e.push([].concat(r[s],s))});n;){n=!1;for(let s=0;s<e.length;s++)for(let i=s+1;i<e.length;i++)if(e[s].filter(function(c){return e[i].indexOf(c)!==-1}).length){e[s]=e[s].concat(e[i]),e.splice(i,1),n=!0;break}}return e.forEach(function(s){s=s.filter(function(o,c,l){return l.indexOf(o)===c});let i=s.pop();i!==void 0&&typeof i=="string"&&(t[i]=s)}),t}function Br(r){return r!==void 0?r+1:1}function _i(r){return r==="__proto__"?"___proto___":r}function Hf(r){return typeof r=="string"&&(r[0]==="'"||r[0]==='"')&&r[r.length-1]===r[0]?r.substring(1,r.length-1):r}var Mi=G("fs");var Rr,Vr,Wr,Ii=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Pi=(Vr=(Rr=process==null?void 0:process.versions)===null||Rr===void 0?void 0:Rr.node)!==null&&Vr!==void 0?Vr:(Wr=process==null?void 0:process.version)===null||Wr===void 0?void 0:Wr.slice(1);if(Pi&&Number(Pi.match(/^([^.]+)/)[1])<Ii)throw Error(`yargs parser supports a minimum Node.js version of ${Ii}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var Gf=process?process.env:{},Ni=new un({cwd:process.cwd,env:()=>Gf,format:ji.format,normalize:dn.normalize,resolve:dn.resolve,require:r=>{if(typeof G<"u")return G(r);if(r.match(/\.json$/))return JSON.parse((0,Mi.readFileSync)(r,"utf8"));throw Error("only .json config files are supported in ESM")}}),qt=function(e,t){return Ni.parse(e.slice(),t).argv};qt.detailed=function(r,e){return Ni.parse(r.slice(),e)};qt.camelCase=rt;qt.decamelize=ln;qt.looksLikeNumber=hn;var $i=qt;var Ne=G("path");function Yf(){return Kf()?0:1}function Kf(){return Jf()&&!process.defaultApp}function Jf(){return!!process.versions.electron}function Di(){return process.argv[Yf()]}var Z=class r extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,r)}};var jt=G("fs"),Ui=G("util"),zi=G("path"),Ti={fs:{readFileSync:jt.readFileSync,writeFile:jt.writeFile},format:Ui.format,resolve:zi.resolve,exists:r=>{try{return(0,jt.statSync)(r).isFile()}catch{return!1}}};var Me,qr=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 t=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]=t,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Me.format.apply(Me.format,[this.cache[this.locale][t]||t].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),s=e.shift(),i=function(){};typeof e[e.length-1]=="function"&&(i=e.pop()),this.cache[this.locale]||this._readLocaleFile();let o=s===1?t:n;this.cache[this.locale][t]&&(o=this.cache[this.locale][t][s===1?"one":"other"]),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]={one:t,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();let c=[o];return~o.indexOf("%d")&&c.push(s),Me.format.apply(Me.format,c.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.cache[this.locale][t]=e[t])}_taggedLiteral(e,...t){let n="";return e.forEach(function(s,i){let o=t[i+1];n+=s,typeof o<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(t,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,t=this.writeQueue[0],n=t.directory,s=t.locale,i=t.cb,o=this._resolveLocaleFile(n,s),c=JSON.stringify(this.cache[s],null,2);Me.fs.writeFile(o,c,"utf-8",function(l){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),i(l)})}_readLocaleFile(){let e={},t=this._resolveLocaleFile(this.directory,this.locale);try{Me.fs.readFileSync&&(e=JSON.parse(Me.fs.readFileSync(t,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+t),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,t){let n=Me.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){let s=Me.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(e){return Me.exists(e)}};function Fi(r,e){Me=e;let t=new qr(r);return{__:t.__.bind(t),__n:t.__n.bind(t),setLocale:t.setLocale.bind(t),getLocale:t.getLocale.bind(t),updateLocale:t.updateLocale.bind(t),locale:t.locale}}var Qf=r=>Fi(r,Ti),Li=Qf;var kf={},Xf="require is not supported by ESM",Bi="loading a directory of commands is not supported yet for ESM",Ht;try{Ht=(0,Wi.fileURLToPath)(kf.url)}catch{Ht=process.cwd()}var Zf=Ht.substring(0,Ht.lastIndexOf("node_modules")),qi={assert:{notStrictEqual:pn.notStrictEqual,strictEqual:pn.strictEqual},cliui:Lr,findUp:vi,getEnv:r=>process.env[r],inspect:Ri.inspect,getCallerFile:()=>{throw new Z(Bi)},getProcessArgvBin:Di,mainFilename:Zf||process.cwd(),Parser:$i,path:{basename:Ne.basename,dirname:Ne.dirname,extname:Ne.extname,relative:Ne.relative,resolve:Ne.resolve},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(r,e)=>process.emitWarning(r,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Vi.readFileSync,require:()=>{throw new Z(Xf)},requireDirectory:()=>{throw new Z(Bi)},stringWidth:r=>[...r].length,y18n:Li({directory:(0,Ne.resolve)(Ht,"../../../locales"),updateFiles:!1})};function me(r,e,t,n){t.assert.notStrictEqual(r,e,n)}function Hr(r,e){e.assert.strictEqual(typeof r,"string")}function Mt(r){return Object.keys(r)}function k(r){return!!r&&!!r.then&&typeof r.then=="function"}function Ge(r){let t=r.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=t.shift();if(!s)throw new Error(`No command found in: ${r}`);let i={cmd:s.replace(n,""),demanded:[],optional:[]};return t.forEach((o,c)=>{let l=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&c===t.length-1&&(l=!0),/^\[/.test(o)?i.optional.push({cmd:o.replace(n,"").split("|"),variadic:l}):i.demanded.push({cmd:o.replace(n,"").split("|"),variadic:l})}),i}var el=["first","second","third","fourth","fifth","sixth"];function v(r,e,t){function n(){return typeof r=="object"?[{demanded:[],optional:[]},r,e]:[Ge(`cmd ${r}`),e,t]}try{let s=0,[i,o,c]=n(),l=[].slice.call(o);for(;l.length&&l[l.length-1]===void 0;)l.pop();let b=c||l.length;if(b<i.demanded.length)throw new Z(`Not enough arguments provided. Expected ${i.demanded.length} but received ${l.length}.`);let h=i.demanded.length+i.optional.length;if(b>h)throw new Z(`Too many arguments provided. Expected max ${h} but received ${b}.`);i.demanded.forEach(d=>{let g=l.shift(),x=Hi(g);d.cmd.filter(C=>C===x||C==="*").length===0&&Gi(x,d.cmd,s),s+=1}),i.optional.forEach(d=>{if(l.length===0)return;let g=l.shift(),x=Hi(g);d.cmd.filter(C=>C===x||C==="*").length===0&&Gi(x,d.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function Hi(r){return Array.isArray(r)?"array":r===null?"null":typeof r}function Gi(r,e,t){throw new Z(`Invalid ${el[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${r}.`)}var mn=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,s=!1){if(v("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let i=0;i<e.length;i++){if(typeof e[i]!="function")throw Error("middleware must be a function");let o=e[i];o.applyBeforeValidation=t,o.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){let i=e;i.applyBeforeValidation=t,i.global=n,i.mutates=s,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(s=>{let i=[...n[t]||[],t];return s.option?!i.includes(s.option):!0}),e.option=t,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 Yi(r){return r?r.map(e=>(e.applyBeforeValidation=!1,e)):[]}function st(r,e,t,n){return t.reduce((s,i)=>{if(i.applyBeforeValidation!==n)return s;if(i.mutates){if(i.applied)return s;i.applied=!0}if(k(s))return s.then(o=>Promise.all([o,i(o,e)])).then(([o,c])=>Object.assign(o,c));{let o=i(s,e);return k(o)?o.then(c=>Object.assign(s,c)):Object.assign(s,o)}},r)}function it(r,e,t=n=>{throw n}){try{let n=tl(r)?r():r;return k(n)?n.then(s=>e(s)):e(n)}catch(n){return t(n)}}function tl(r){return typeof r=="function"}function Gr(r){if(typeof G>"u")return null;for(let e=0,t=Object.keys(G.cache),n;e<t.length;e++)if(n=G.cache[t[e]],n.exports===r)return n;return null}var Nt=/(^\*)|(^\$0)/,Yr=class{constructor(e,t,n,s){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=s,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,s){s=s||{},typeof s.recurse!="boolean"&&(s.recurse=!1),Array.isArray(s.extensions)||(s.extensions=["js"]);let i=typeof s.visit=="function"?s.visit:o=>o;s.visit=(o,c,l)=>{let b=i(o,c,l);if(b){if(this.requireCache.has(c))return b;this.requireCache.add(c),this.addHandler(b)}return b},this.shim.requireDirectory({require:t,filename:n},e,s)}addHandler(e,t,n,s,i,o){let c=[],l=Yi(i);if(s=s||(()=>{}),Array.isArray(e))if(nl(e))[e,...c]=e;else for(let b of e)this.addHandler(b);else if(sl(e)){let b=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(b=[].concat(b).concat(e.aliases)),this.addHandler(b,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(Ki(n)){this.addHandler([e].concat(c),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){let b=Ge(e);c=c.map(g=>Ge(g).cmd);let h=!1,d=[b.cmd].concat(c).filter(g=>Nt.test(g)?(h=!0,!1):!0);d.length===0&&h&&d.push("$0"),h&&(b.cmd=d[0],c=d.slice(1),e=e.replace(Nt,b.cmd)),c.forEach(g=>{this.aliasMap[g]=b.cmd}),t!==!1&&this.usage.command(e,t,h,c,o),this.handlers[b.cmd]={original:e,description:t,handler:s,builder:n||{},middlewares:l,deprecated:o,demanded:b.demanded,optional:b.optional},h&&(this.defaultCommand=this.handlers[b.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,s,i,o){let c=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,l=t.getInternalMethods().getContext(),b=l.commands.slice(),h=!e;e&&(l.commands.push(e),l.fullCommands.push(c.original));let d=this.applyBuilderUpdateUsageAndParse(h,c,t,n.aliases,b,s,i,o);return k(d)?d.then(g=>this.applyMiddlewareAndGetResult(h,c,g.innerArgv,l,i,g.aliases,t)):this.applyMiddlewareAndGetResult(h,c,d.innerArgv,l,i,d.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,s,i,o,c,l){let b=t.builder,h=n;if(gn(b)){n.getInternalMethods().getUsageInstance().freeze();let d=b(n.getInternalMethods().reset(s),l);if(k(d))return d.then(g=>(h=Qi(g)?g:n,this.parseAndUpdateUsage(e,t,h,i,o,c)))}else rl(b)&&(n.getInternalMethods().getUsageInstance().freeze(),h=n.getInternalMethods().reset(s),Object.keys(t.builder).forEach(d=>{h.option(d,b[d])}));return this.parseAndUpdateUsage(e,t,h,i,o,c)}parseAndUpdateUsage(e,t,n,s,i,o){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(s,t),t.description);let c=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,o);return k(c)?c.then(l=>({aliases:n.parsed.aliases,innerArgv:l})):{aliases:n.parsed.aliases,innerArgv:c}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){let n=Nt.test(t.original)?t.original.replace(Nt,"").trim():t.original,s=e.filter(i=>!Nt.test(i));return s.push(n),`$0 ${s.join(" ")}`}handleValidationAndGetResult(e,t,n,s,i,o,c,l){if(!o.getInternalMethods().getHasOutput()){let b=o.getInternalMethods().runValidation(i,l,o.parsed.error,e);n=it(n,h=>(b(h),h))}if(t.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();let b=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(n,b,!1,!1),n=st(n,o,c,!1),n=it(n,h=>{let d=t.handler(h);return k(d)?d.then(()=>h):h}),e||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),k(n)&&!o.getInternalMethods().hasParseCallback()&&n.catch(h=>{try{o.getInternalMethods().getUsageInstance().fail(null,h)}catch{}})}return e||(s.commands.pop(),s.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,s,i,o,c){let l={};if(i)return n;c.getInternalMethods().getHasOutput()||(l=this.populatePositionals(t,n,s,c));let b=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),h=st(n,c,b,!0);return k(h)?h.then(d=>this.handleValidationAndGetResult(e,t,d,s,o,c,b,l)):this.handleValidationAndGetResult(e,t,h,s,o,c,b,l)}populatePositionals(e,t,n,s){t._=t._.slice(n.commands.length);let i=e.demanded.slice(0),o=e.optional.slice(0),c={};for(this.validation.positionalCount(i.length,t._.length);i.length;){let l=i.shift();this.populatePositional(l,t,c)}for(;o.length;){let l=o.shift();this.populatePositional(l,t,c)}return t._=n.commands.concat(t._.map(l=>""+l)),this.postProcessPositionals(t,c,this.cmdToParseOptions(e.original),s),c}populatePositional(e,t,n){let s=e.cmd[0];e.variadic?n[s]=t._.splice(0).map(String):t._.length&&(n[s]=[String(t._.shift())])}cmdToParseOptions(e){let t={array:[],default:{},alias:{},demand:{}},n=Ge(e);return n.demanded.forEach(s=>{let[i,...o]=s.cmd;s.variadic&&(t.array.push(i),t.default[i]=[]),t.alias[i]=o,t.demand[i]=!0}),n.optional.forEach(s=>{let[i,...o]=s.cmd;s.variadic&&(t.array.push(i),t.default[i]=[]),t.alias[i]=o}),t}postProcessPositionals(e,t,n,s){let i=Object.assign({},s.getOptions());i.default=Object.assign(n.default,i.default);for(let b of Object.keys(n.alias))i.alias[b]=(i.alias[b]||[]).concat(n.alias[b]);i.array=i.array.concat(n.array),i.config={};let o=[];if(Object.keys(t).forEach(b=>{t[b].map(h=>{i.configuration["unknown-options-as-args"]&&(i.key[b]=!0),o.push(`--${b}`),o.push(h)})}),!o.length)return;let c=Object.assign({},i.configuration,{"populate--":!1}),l=this.shim.Parser.detailed(o,Object.assign({},i,{configuration:c}));if(l.error)s.getInternalMethods().getUsageInstance().fail(l.error.message,l.error);else{let b=Object.keys(t);Object.keys(t).forEach(h=>{b.push(...l.aliases[h])}),Object.keys(l.argv).forEach(h=>{b.includes(h)&&(t[h]||(t[h]=l.argv[h]),!this.isInConfigs(s,h)&&!this.isDefaulted(s,h)&&Object.prototype.hasOwnProperty.call(e,h)&&Object.prototype.hasOwnProperty.call(l.argv,h)&&(Array.isArray(e[h])||Array.isArray(l.argv[h]))?e[h]=[].concat(e[h],l.argv[h]):e[h]=l.argv[h])})}}isDefaulted(e,t){let{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){let{configObjects:n}=e.getOptions();return n.some(s=>Object.prototype.hasOwnProperty.call(s,t))||n.some(s=>Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=Nt.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let t=this.defaultCommand.builder;if(gn(t))return t(e,!0);Ki(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){let t=Gr(e);if(!t)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(t.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:t,desc:n}){for(let s of[e,t,n]){if(typeof s=="string"||s===!1)return s;me(s,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();me(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 Ji(r,e,t,n){return new Yr(r,e,t,n)}function Ki(r){return typeof r=="object"&&!!r.builder&&typeof r.handler=="function"}function nl(r){return r.every(e=>typeof e=="string")}function gn(r){return typeof r=="function"}function rl(r){return typeof r=="object"}function sl(r){return typeof r=="object"&&!Array.isArray(r)}function Ye(r={},e=()=>!0){let t={};return Mt(r).forEach(n=>{e(n,r[n])&&(t[n]=r[n])}),t}function Ke(r){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let t=e;t._handle&&t.isTTY&&typeof t._handle.setBlocking=="function"&&t._handle.setBlocking(r)})}function il(r){return typeof r=="boolean"}function Zi(r,e){let t=e.y18n.__,n={},s=[];n.failFn=function(E){s.push(E)};let i=null,o=null,c=!0;n.showHelpOnFail=function(E=!0,I){let[R,H]=typeof E=="string"?[!0,E]:[E,I];return r.getInternalMethods().isGlobalContext()&&(o=H),i=H,c=R,n};let l=!1;n.fail=function(E,I){let R=r.getInternalMethods().getLoggerInstance();if(s.length)for(let H=s.length-1;H>=0;--H){let fe=s[H];if(il(fe)){if(I)throw I;if(E)throw Error(E)}else fe(E,I,n)}else{if(r.getExitProcess()&&Ke(!0),!l){l=!0,c&&(r.showHelp("error"),R.error()),(E||I)&&R.error(E||I);let H=i||o;H&&((E||I)&&R.error(""),R.error(H))}if(I=I||new Z(E),r.getExitProcess())return r.exit(1);if(r.getInternalMethods().hasParseCallback())return r.exit(1,I);throw I}};let b=[],h=!1;n.usage=(N,E)=>N===null?(h=!0,b=[],n):(h=!1,b.push([N,E||""]),n),n.getUsage=()=>b,n.getUsageDisabled=()=>h,n.getPositionalGroupName=()=>t("Positionals:");let d=[];n.example=(N,E)=>{d.push([N,E||""])};let g=[];n.command=function(E,I,R,H,fe=!1){R&&(g=g.map(q=>(q[2]=!1,q))),g.push([E,I||"",R,H,fe])},n.getCommands=()=>g;let x={};n.describe=function(E,I){Array.isArray(E)?E.forEach(R=>{n.describe(R,I)}):typeof E=="object"?Object.keys(E).forEach(R=>{n.describe(R,E[R])}):x[E]=I},n.getDescriptions=()=>x;let w=[];n.epilog=N=>{w.push(N)};let C=!1,m;n.wrap=N=>{C=!0,m=N},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(C||(m=J(),C=!0),m);let _="__yargsString__:";n.deferY18nLookup=N=>_+N,n.help=function(){if(M)return M;U();let E=r.customScriptName?r.$0:e.path.basename(r.$0),I=r.getDemandedOptions(),R=r.getDemandedCommands(),H=r.getDeprecatedOptions(),fe=r.getGroups(),q=r.getOptions(),le=[];le=le.concat(Object.keys(x)),le=le.concat(Object.keys(I)),le=le.concat(Object.keys(R)),le=le.concat(Object.keys(q.default)),le=le.filter(K),le=Object.keys(le.reduce((z,ee)=>(ee!=="_"&&(z[ee]=!0),z),{}));let Ze=n.getWrap(),te=e.cliui({width:Ze,wrap:!!Ze});if(!h){if(b.length)b.forEach(z=>{te.div({text:`${z[0].replace(/\$0/g,E)}`}),z[1]&&te.div({text:`${z[1]}`,padding:[1,0,0,0]})}),te.div();else if(g.length){let z=null;R._?z=`${E} <${t("command")}>
9
+ `:z=`${E} [${t("command")}]
10
+ `,te.div(`${z}`)}}if(g.length>1||g.length===1&&!g[0][2]){te.div(t("Commands:"));let z=r.getInternalMethods().getContext(),ee=z.commands.length?`${z.commands.join(" ")} `:"";r.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(g=g.sort((W,re)=>W[0].localeCompare(re[0])));let ne=E?`${E} `:"";g.forEach(W=>{let re=`${ne}${ee}${W[0].replace(/^\$0 ?/,"")}`;te.span({text:re,padding:[0,2,0,2],width:j(g,Ze,`${E}${ee}`)+4},{text:W[1]});let ae=[];W[2]&&ae.push(`[${t("default")}]`),W[3]&&W[3].length&&ae.push(`[${t("aliases:")} ${W[3].join(", ")}]`),W[4]&&(typeof W[4]=="string"?ae.push(`[${t("deprecated: %s",W[4])}]`):ae.push(`[${t("deprecated")}]`)),ae.length?te.div({text:ae.join(" "),padding:[0,0,0,2],align:"right"}):te.div()}),te.div()}let Te=(Object.keys(q.alias)||[]).concat(Object.keys(r.parsed.newAliases)||[]);le=le.filter(z=>!r.parsed.newAliases[z]&&Te.every(ee=>(q.alias[ee]||[]).indexOf(z)===-1));let Fe=t("Options:");fe[Fe]||(fe[Fe]=[]),T(le,q.alias,fe,Fe);let ke=z=>/^--/.test(bn(z)),F=Object.keys(fe).filter(z=>fe[z].length>0).map(z=>{let ee=fe[z].filter(K).map(ne=>{if(Te.includes(ne))return ne;for(let W=0,re;(re=Te[W])!==void 0;W++)if((q.alias[re]||[]).includes(ne))return re;return ne});return{groupName:z,normalizedKeys:ee}}).filter(({normalizedKeys:z})=>z.length>0).map(({groupName:z,normalizedKeys:ee})=>{let ne=ee.reduce((W,re)=>(W[re]=[re].concat(q.alias[re]||[]).map(ae=>z===n.getPositionalGroupName()?ae:(/^[0-9]$/.test(ae)?q.boolean.includes(re)?"-":"--":ae.length>1?"--":"-")+ae).sort((ae,Pe)=>ke(ae)===ke(Pe)?0:ke(ae)?1:-1).join(", "),W),{});return{groupName:z,normalizedKeys:ee,switches:ne}});if(F.filter(({groupName:z})=>z!==n.getPositionalGroupName()).some(({normalizedKeys:z,switches:ee})=>!z.every(ne=>ke(ee[ne])))&&F.filter(({groupName:z})=>z!==n.getPositionalGroupName()).forEach(({normalizedKeys:z,switches:ee})=>{z.forEach(ne=>{ke(ee[ne])&&(ee[ne]=ol(ee[ne],4))})}),F.forEach(({groupName:z,normalizedKeys:ee,switches:ne})=>{te.div(z),ee.forEach(W=>{let re=ne[W],ae=x[W]||"",Pe=null;ae.includes(_)&&(ae=t(ae.substring(_.length))),q.boolean.includes(W)&&(Pe=`[${t("boolean")}]`),q.count.includes(W)&&(Pe=`[${t("count")}]`),q.string.includes(W)&&(Pe=`[${t("string")}]`),q.normalize.includes(W)&&(Pe=`[${t("string")}]`),q.array.includes(W)&&(Pe=`[${t("array")}]`),q.number.includes(W)&&(Pe=`[${t("number")}]`);let je=p=>typeof p=="string"?`[${t("deprecated: %s",p)}]`:`[${t("deprecated")}]`,Jt=[W in H?je(H[W]):null,Pe,W in I?`[${t("required")}]`:null,q.choices&&q.choices[W]?`[${t("choices:")} ${n.stringifiedValues(q.choices[W])}]`:null,V(q.default[W],q.defaultDescription[W])].filter(Boolean).join(" ");te.span({text:bn(re),padding:[0,2,0,2+Xi(re)],width:j(ne,Ze)+4},ae);let f=r.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;Jt&&!f?te.div({text:Jt,padding:[0,0,0,2],align:"right"}):te.div()}),te.div()}),d.length&&(te.div(t("Examples:")),d.forEach(z=>{z[0]=z[0].replace(/\$0/g,E)}),d.forEach(z=>{z[1]===""?te.div({text:z[0],padding:[0,2,0,2]}):te.div({text:z[0],padding:[0,2,0,2],width:j(d,Ze)+4},{text:z[1]})}),te.div()),w.length>0){let z=w.map(ee=>ee.replace(/\$0/g,E)).join(`
11
+ `);te.div(`${z}
12
+ `)}return te.toString().replace(/\s*$/,"")};function j(N,E,I){let R=0;return Array.isArray(N)||(N=Object.values(N).map(H=>[H])),N.forEach(H=>{R=Math.max(e.stringWidth(I?`${I} ${bn(H[0])}`:bn(H[0]))+Xi(H[0]),R)}),E&&(R=Math.min(R,parseInt((E*.5).toString(),10))),R}function U(){let N=r.getDemandedOptions(),E=r.getOptions();(Object.keys(E.alias)||[]).forEach(I=>{E.alias[I].forEach(R=>{x[R]&&n.describe(I,x[R]),R in N&&r.demandOption(I,N[R]),E.boolean.includes(R)&&r.boolean(I),E.count.includes(R)&&r.count(I),E.string.includes(R)&&r.string(I),E.normalize.includes(R)&&r.normalize(I),E.array.includes(R)&&r.array(I),E.number.includes(R)&&r.number(I)})})}let M;n.cacheHelpMessage=function(){M=this.help()},n.clearCachedHelpMessage=function(){M=void 0},n.hasCachedHelpMessage=function(){return!!M};function T(N,E,I,R){let H=[],fe=null;return Object.keys(I).forEach(q=>{H=H.concat(I[q])}),N.forEach(q=>{fe=[q].concat(E[q]),fe.some(le=>H.indexOf(le)!==-1)||I[R].push(q)}),H}function K(N){return r.getOptions().hiddenOptions.indexOf(N)<0||r.parsed.argv[r.getOptions().showHiddenOpt]}n.showHelp=N=>{let E=r.getInternalMethods().getLoggerInstance();N||(N="error"),(typeof N=="function"?N:E[N])(n.help())},n.functionDescription=N=>["(",N.name?e.Parser.decamelize(N.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(E,I){let R="",H=I||", ",fe=[].concat(E);return!E||!fe.length||fe.forEach(q=>{R.length&&(R+=H),R+=JSON.stringify(q)}),R};function V(N,E){let I=`[${t("default:")} `;if(N===void 0&&!E)return null;if(E)I+=E;else switch(typeof N){case"string":I+=`"${N}"`;break;case"object":I+=JSON.stringify(N);break;default:I+=N}return`${I}]`}function J(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let de=null;n.version=N=>{de=N},n.showVersion=N=>{let E=r.getInternalMethods().getLoggerInstance();N||(N="error"),(typeof N=="function"?N:E[N])(de)},n.reset=function(E){return i=null,l=!1,b=[],h=!1,w=[],d=[],g=[],x=Ye(x,I=>!E[I]),n};let Y=[];return n.freeze=function(){Y.push({failMessage:i,failureOutput:l,usages:b,usageDisabled:h,epilogs:w,examples:d,commands:g,descriptions:x})},n.unfreeze=function(E=!1){let I=Y.pop();I&&(E?(x={...I.descriptions,...x},g=[...I.commands,...g],b=[...I.usages,...b],d=[...I.examples,...d],w=[...I.epilogs,...w]):{failMessage:i,failureOutput:l,usages:b,usageDisabled:h,epilogs:w,examples:d,commands:g,descriptions:x}=I)},n}function Kr(r){return typeof r=="object"}function ol(r,e){return Kr(r)?{text:r.text,indentation:r.indentation+e}:{text:r,indentation:e}}function Xi(r){return Kr(r)?r.indentation:0}function bn(r){return Kr(r)?r.text:r}var ki=`###-begin-{{app_name}}-completions-###
13
13
  #
14
14
  # yargs command completion script
15
15
  #
@@ -37,7 +37,7 @@ _{{app_name}}_yargs_completions()
37
37
  }
38
38
  complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
39
39
  ###-end-{{app_name}}-completions-###
40
- `,ci=`#compdef {{app_name}}
40
+ `,eo=`#compdef {{app_name}}
41
41
  ###-begin-{{app_name}}-completions-###
42
42
  #
43
43
  # yargs command completion script
@@ -56,14 +56,14 @@ _{{app_name}}_yargs_completions()
56
56
  }
57
57
  compdef _{{app_name}}_yargs_completions {{app_name}}
58
58
  ###-end-{{app_name}}-completions-###
59
- `;var yr=class{constructor(t,e,n,s){var i,o,c;this.yargs=t,this.usage=e,this.command=n,this.shim=s,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(c=((i=this.shim.getEnv("SHELL"))===null||i===void 0?void 0:i.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,s){let i=this.command.getCommandHandlers();for(let c=0,m=t.length;c<m;++c)if(i[t[c]]&&i[t[c]].builder){let w=i[t[c]].builder;if(un(w)){this.indexAfterLastReset=c+1;let d=this.yargs.getInternalMethods().reset();return w(d,!0),d.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),s(null,o)}commandCompletions(t,e,n){let s=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&s[s.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(i=>{let o=Ht(i[0]).cmd;if(e.indexOf(o)===-1)if(!this.zshShell)t.push(o);else{let c=i[1]||"";t.push(o.replace(/:/g,"\\:")+":"+c)}})}optionCompletions(t,e,n,s){if((s.match(/^-/)||s===""&&t.length===0)&&!this.previousArgHasChoices(e)){let i=this.yargs.getOptions(),o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(i.key).forEach(c=>{let m=!!i.configuration["boolean-negation"]&&i.boolean.includes(c);!o.includes(c)&&!i.hiddenOptions.includes(c)&&!this.argsContainKey(e,c,m)&&(this.completeOptionKey(c,t,s),m&&i.default[c]&&this.completeOptionKey(`no-${c}`,t,s))})}}choicesFromOptionsCompletions(t,e,n,s){if(this.previousArgHasChoices(e)){let i=this.getPreviousArgChoices(e);i&&i.length>0&&t.push(...i.map(o=>o.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,e,n,s){if(s===""&&t.length>0&&this.previousArgHasChoices(e))return;let i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],o=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),c=i[n._.length-o-1];if(!c)return;let m=this.yargs.getOptions().choices[c]||[];for(let w of m)w.startsWith(s)&&t.push(w.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 s=e.replace(/^-+/,""),i=this.yargs.getOptions(),o=[s,...this.yargs.getAliases()[s]||[]],c;for(let m of o)if(Object.prototype.hasOwnProperty.call(i.key,m)&&Array.isArray(i.choices[m])){c=i.choices[m];break}if(c)return c.filter(m=>!n||m.startsWith(n))}previousArgHasChoices(t){let e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n){let s=i=>t.indexOf((/^[^0-9]$/.test(i)?"-":"--")+i)!==-1;if(s(e)||n&&s(`no-${e}`))return!0;if(this.aliases){for(let i of this.aliases[e])if(s(i))return!0}return!1}completeOptionKey(t,e,n){var s,i,o;let c=this.usage.getDescriptions(),m=h=>/^--/.test(h),w=h=>/^[^0-9]$/.test(h),d=!m(n)&&w(t)?"-":"--";if(!this.zshShell)e.push(d+t);else{let h=(s=this===null||this===void 0?void 0:this.aliases)===null||s===void 0?void 0:s[t].find(x=>{let O=c[x];return typeof O=="string"&&O.length>0}),g=h?c[h]:void 0,y=(o=(i=c[t])!==null&&i!==void 0?i:g)!==null&&o!==void 0?o:"";e.push(d+`${t.replace(/:/g,"\\:")}:${y.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`)}}customCompletion(t,e,n,s){if(dt(this.customCompletionFunction,null,this.shim),pc(this.customCompletionFunction)){let i=this.customCompletionFunction(n,e);return J(i)?i.then(o=>{this.shim.process.nextTick(()=>{s(null,o)})}).catch(o=>{this.shim.process.nextTick(()=>{s(o,void 0)})}):s(null,i)}else return mc(this.customCompletionFunction)?this.customCompletionFunction(n,e,(i=s)=>this.defaultCompletion(t,e,n,i),i=>{s(null,i)}):this.customCompletionFunction(n,e,i=>{s(null,i)})}getCompletion(t,e){let n=t.length?t[t.length-1]:"",s=this.yargs.parse(t,!0),i=this.customCompletionFunction?o=>this.customCompletion(t,o,n,e):o=>this.defaultCompletion(t,o,n,e);return J(s)?s.then(i):i(s)}generateCompletionScript(t,e){let n=this.zshShell?ci:ai,s=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,s),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 li(r,t,e,n){return new yr(r,t,e,n)}function pc(r){return r.length<3}function mc(r){return r.length>3}function fi(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 s;for(s=0;s<=r.length;s++)e[0][s]=s;for(n=1;n<=t.length;n++)for(s=1;s<=r.length;s++)t.charAt(n-1)===r.charAt(s-1)?e[n][s]=e[n-1][s-1]:n>1&&s>1&&t.charAt(n-2)===r.charAt(s-1)&&t.charAt(n-1)===r.charAt(s-2)?e[n][s]=e[n-2][s-2]+1:e[n][s]=Math.min(e[n-1][s-1]+1,Math.min(e[n][s-1]+1,e[n-1][s]+1));return e[t.length][r.length]}var hi=["$0","--","_"];function ui(r,t,e){let n=e.y18n.__,s=e.y18n.__n,i={};i.nonOptionCount=function(h){let g=r.getDemandedCommands(),x=h._.length+(h["--"]?h["--"].length:0)-r.getInternalMethods().getContext().commands.length;g._&&(x<g._.min||x>g._.max)&&(x<g._.min?g._.minMsg!==void 0?t.fail(g._.minMsg?g._.minMsg.replace(/\$0/g,x.toString()).replace(/\$1/,g._.min.toString()):null):t.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",x,x.toString(),g._.min.toString())):x>g._.max&&(g._.maxMsg!==void 0?t.fail(g._.maxMsg?g._.maxMsg.replace(/\$0/g,x.toString()).replace(/\$1/,g._.max.toString()):null):t.fail(s("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",x,x.toString(),g._.max.toString()))))},i.positionalCount=function(h,g){g<h&&t.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",g,g+"",h+""))},i.requiredArguments=function(h,g){let y=null;for(let x of Object.keys(g))(!Object.prototype.hasOwnProperty.call(h,x)||typeof h[x]>"u")&&(y=y||{},y[x]=g[x]);if(y){let x=[];for(let p of Object.keys(y)){let N=y[p];N&&x.indexOf(N)<0&&x.push(N)}let O=x.length?`
60
- ${x.join(`
61
- `)}`:"";t.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(y).length,Object.keys(y).join(", ")+O))}},i.unknownArguments=function(h,g,y,x,O=!0){var p;let N=r.getInternalMethods().getCommandInstance().getCommands(),U=[],W=r.getInternalMethods().getContext();if(Object.keys(h).forEach(z=>{!hi.includes(z)&&!Object.prototype.hasOwnProperty.call(y,z)&&!Object.prototype.hasOwnProperty.call(r.getInternalMethods().getParseContext(),z)&&!i.isValidAndSomeAliasIsNotNew(z,g)&&U.push(z)}),O&&(W.commands.length>0||N.length>0||x)&&h._.slice(W.commands.length).forEach(z=>{N.includes(""+z)||U.push(""+z)}),O){let B=((p=r.getDemandedCommands()._)===null||p===void 0?void 0:p.max)||0,ft=W.commands.length+B;ft<h._.length&&h._.slice(ft).forEach(Z=>{Z=String(Z),!W.commands.includes(Z)&&!U.includes(Z)&&U.push(Z)})}U.length&&t.fail(s("Unknown argument: %s","Unknown arguments: %s",U.length,U.map(z=>z.trim()?z:`"${z}"`).join(", ")))},i.unknownCommands=function(h){let g=r.getInternalMethods().getCommandInstance().getCommands(),y=[],x=r.getInternalMethods().getContext();return(x.commands.length>0||g.length>0)&&h._.slice(x.commands.length).forEach(O=>{g.includes(""+O)||y.push(""+O)}),y.length>0?(t.fail(s("Unknown command: %s","Unknown commands: %s",y.length,y.join(", "))),!0):!1},i.isValidAndSomeAliasIsNotNew=function(h,g){if(!Object.prototype.hasOwnProperty.call(g,h))return!1;let y=r.parsed.newAliases;return[h,...g[h]].some(x=>!Object.prototype.hasOwnProperty.call(y,x)||!y[h])},i.limitedChoices=function(h){let g=r.getOptions(),y={};if(!Object.keys(g.choices).length)return;Object.keys(h).forEach(p=>{hi.indexOf(p)===-1&&Object.prototype.hasOwnProperty.call(g.choices,p)&&[].concat(h[p]).forEach(N=>{g.choices[p].indexOf(N)===-1&&N!==void 0&&(y[p]=(y[p]||[]).concat(N))})});let x=Object.keys(y);if(!x.length)return;let O=n("Invalid values:");x.forEach(p=>{O+=`
62
- ${n("Argument: %s, Given: %s, Choices: %s",p,t.stringifiedValues(y[p]),t.stringifiedValues(g.choices[p]))}`}),t.fail(O)};let o={};i.implies=function(h,g){_("<string|object> [array|number|string]",[h,g],arguments.length),typeof h=="object"?Object.keys(h).forEach(y=>{i.implies(y,h[y])}):(r.global(h),o[h]||(o[h]=[]),Array.isArray(g)?g.forEach(y=>i.implies(h,y)):(dt(g,void 0,e),o[h].push(g)))},i.getImplied=function(){return o};function c(d,h){let g=Number(h);return h=isNaN(g)?h:g,typeof h=="number"?h=d._.length>=h:h.match(/^--no-.+/)?(h=h.match(/^--no-(.+)/)[1],h=!Object.prototype.hasOwnProperty.call(d,h)):h=Object.prototype.hasOwnProperty.call(d,h),h}i.implications=function(h){let g=[];if(Object.keys(o).forEach(y=>{let x=y;(o[y]||[]).forEach(O=>{let p=x,N=O;p=c(h,p),O=c(h,O),p&&!O&&g.push(` ${x} -> ${N}`)})}),g.length){let y=`${n("Implications failed:")}
63
- `;g.forEach(x=>{y+=x}),t.fail(y)}};let m={};i.conflicts=function(h,g){_("<string|object> [array|string]",[h,g],arguments.length),typeof h=="object"?Object.keys(h).forEach(y=>{i.conflicts(y,h[y])}):(r.global(h),m[h]||(m[h]=[]),Array.isArray(g)?g.forEach(y=>i.conflicts(h,y)):m[h].push(g))},i.getConflicting=()=>m,i.conflicting=function(h){Object.keys(h).forEach(g=>{m[g]&&m[g].forEach(y=>{y&&h[g]!==void 0&&h[y]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",g,y))})}),r.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(m).forEach(g=>{m[g].forEach(y=>{y&&h[e.Parser.camelCase(g)]!==void 0&&h[e.Parser.camelCase(y)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",g,y))})})},i.recommendCommands=function(h,g){g=g.sort((p,N)=>N.length-p.length);let x=null,O=1/0;for(let p=0,N;(N=g[p])!==void 0;p++){let U=fi(h,N);U<=3&&U<O&&(O=U,x=N)}x&&t.fail(n("Did you mean %s?",x))},i.reset=function(h){return o=Gt(o,g=>!h[g]),m=Gt(m,g=>!h[g]),i};let w=[];return i.freeze=function(){w.push({implied:o,conflicting:m})},i.unfreeze=function(){let h=w.pop();dt(h,void 0,e),{implied:o,conflicting:m}=h},i}var xr=[],We;function pn(r,t,e,n){We=n;let s={};if(Object.prototype.hasOwnProperty.call(r,"extends")){if(typeof r.extends!="string")return s;let i=/\.json|\..*rc$/.test(r.extends),o=null;if(i)o=bc(t,r.extends);else try{o=H.resolve(r.extends)}catch{return r}gc(o),xr.push(o),s=i?JSON.parse(We.readFileSync(o,"utf8")):H(r.extends),delete r.extends,s=pn(s,We.path.dirname(o),e,We)}return xr=[],e?di(s,r):Object.assign({},s,r)}function gc(r){if(xr.indexOf(r)>-1)throw new Y(`Circular extended configurations: '${r}'.`)}function bc(r,t){return We.path.resolve(r,t)}function di(r,t){let e={};function n(s){return s&&typeof s=="object"&&!Array.isArray(s)}Object.assign(e,r);for(let s of Object.keys(t))n(t[s])&&n(e[s])?e[s]=di(r[s],t[s]):e[s]=t[s];return e}var S=function(r,t,e,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!s:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(r,e):s?s.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,se,Be,Ct,wt,mn,Kt,ie,gn,_t,bn,St,Nt,yt,vt,wn,Se,lt,I,yn,xn,xt,oe,ve,ae,Jt,On,F,ce,le,fe,L,An,Tt,rt;function Ni(r){return(t=[],e=r.process.cwd(),n)=>{let s=new Mr(t,e,n,r);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}var pi=Symbol("copyDoubleDash"),mi=Symbol("copyDoubleDash"),Or=Symbol("deleteFromParserHintObject"),gi=Symbol("emitWarning"),bi=Symbol("freeze"),wi=Symbol("getDollarZero"),he=Symbol("getParserConfiguration"),yi=Symbol("getUsageConfiguration"),Ar=Symbol("guessLocale"),xi=Symbol("guessVersion"),Oi=Symbol("parsePositionalNumbers"),Er=Symbol("pkgUp"),Qt=Symbol("populateParserHintArray"),Pe=Symbol("populateParserHintSingleValueDictionary"),Cr=Symbol("populateParserHintArrayDictionary"),_r=Symbol("populateParserHintDictionary"),Sr=Symbol("sanitizeKey"),vr=Symbol("setKey"),Pr=Symbol("unfreeze"),Ai=Symbol("validateAsync"),Ei=Symbol("getCommandInstance"),Ci=Symbol("getContext"),_i=Symbol("getHasOutput"),Si=Symbol("getLoggerInstance"),vi=Symbol("getParseContext"),Pi=Symbol("getUsageInstance"),ji=Symbol("getValidationInstance"),En=Symbol("hasParseCallback"),Ii=Symbol("isGlobalContext"),ue=Symbol("postProcess"),Mi=Symbol("rebase"),jr=Symbol("reset"),Re=Symbol("runYargsParserAndExecuteCommands"),Ir=Symbol("runValidation"),$i=Symbol("setHasOutput"),de=Symbol("kTrackManuallySetKeys"),Mr=class{constructor(t=[],e,n,s){this.customScriptName=!1,this.parsed=!1,it.set(this,void 0),se.set(this,void 0),Be.set(this,{commands:[],fullCommands:[]}),Ct.set(this,null),wt.set(this,null),mn.set(this,"show-hidden"),Kt.set(this,null),ie.set(this,!0),gn.set(this,{}),_t.set(this,!0),bn.set(this,[]),St.set(this,void 0),Nt.set(this,{}),yt.set(this,!1),vt.set(this,null),wn.set(this,!0),Se.set(this,void 0),lt.set(this,""),I.set(this,void 0),yn.set(this,void 0),xn.set(this,{}),xt.set(this,null),oe.set(this,null),ve.set(this,{}),ae.set(this,{}),Jt.set(this,void 0),On.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),An.set(this,{}),Tt.set(this,null),rt.set(this,void 0),S(this,F,s,"f"),S(this,Jt,t,"f"),S(this,se,e,"f"),S(this,yn,n,"f"),S(this,St,new hn(this),"f"),this.$0=this[wi](),this[jr](),S(this,it,a(this,it,"f"),"f"),S(this,L,a(this,L,"f"),"f"),S(this,rt,a(this,rt,"f"),"f"),S(this,I,a(this,I,"f"),"f"),a(this,I,"f").showHiddenOpt=a(this,mn,"f"),S(this,Se,this[mi](),"f")}addHelpOpt(t,e){let n="help";return _("[string|boolean] [string]",[t,e],arguments.length),a(this,vt,"f")&&(this[Or](a(this,vt,"f")),S(this,vt,null,"f")),t===!1&&e===void 0?this:(S(this,vt,typeof t=="string"?t:n,"f"),this.boolean(a(this,vt,"f")),this.describe(a(this,vt,"f"),e||a(this,L,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(_("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;let n=typeof t=="string"?t:a(this,mn,"f");return this.boolean(n),this.describe(n,e||a(this,L,"f").deferY18nLookup("Show hidden options")),a(this,I,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return _("<object|string|array> [string|array]",[t,e],arguments.length),this[Cr](this.alias.bind(this),"alias",t,e),this}array(t){return _("<array|string>",[t],arguments.length),this[Qt]("array",t),this[de](t),this}boolean(t){return _("<array|string>",[t],arguments.length),this[Qt]("boolean",t),this[de](t),this}check(t,e){return _("<function> [boolean]",[t,e],arguments.length),this.middleware((n,s)=>re(()=>t(n,s.getOptions()),i=>(i?(typeof i=="string"||i instanceof Error)&&a(this,L,"f").fail(i.toString(),i):a(this,L,"f").fail(a(this,F,"f").y18n.__("Argument check failed: %s",t.toString())),n),i=>(a(this,L,"f").fail(i.message?i.message:i.toString(),i),n)),!1,e),this}choices(t,e){return _("<object|string|array> [string|array]",[t,e],arguments.length),this[Cr](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(_("<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,I,"f").key[t]=!0,a(this,St,"f").addCoerceMiddleware((n,s)=>{let i;return Object.prototype.hasOwnProperty.call(n,t)?re(()=>(i=s.getAliases(),e(n[t])),c=>{n[t]=c;let m=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&m!==!0)for(let w of i[t])n[w]=c;return n},c=>{throw new Y(c.message)}):n},t),this}conflicts(t,e){return _("<string|object> [string|array]",[t,e],arguments.length),a(this,rt,"f").conflicts(t,e),this}config(t="config",e,n){return _("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=pn(t,a(this,se,"f"),this[he]()["deep-merge-config"]||!1,a(this,F,"f")),a(this,I,"f").configObjects=(a(this,I,"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(s=>{a(this,I,"f").config[s]=n||!0}),this)}completion(t,e,n){return _("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),S(this,wt,t||a(this,wt,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(a(this,wt,"f"),e),n&&a(this,Ct,"f").registerFunction(n),this}command(t,e,n,s,i,o){return _("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,s,i,o],arguments.length),a(this,it,"f").addHandler(t,e,n,s,i,o),this}commands(t,e,n,s,i,o){return this.command(t,e,n,s,i,o)}commandDir(t,e){_("<string> [object]",[t,e],arguments.length);let n=a(this,yn,"f")||a(this,F,"f").require;return a(this,it,"f").addDirectory(t,n,a(this,F,"f").getCallerFile(),e),this}count(t){return _("<array|string>",[t],arguments.length),this[Qt]("count",t),this[de](t),this}default(t,e,n){return _("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(mr(t,a(this,F,"f")),a(this,I,"f").defaultDescription[t]=n),typeof e=="function"&&(mr(t,a(this,F,"f")),a(this,I,"f").defaultDescription[t]||(a(this,I,"f").defaultDescription[t]=a(this,L,"f").functionDescription(e)),e=e.call()),this[Pe](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,s){return _("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,s],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),a(this,I,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:s},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(s=>{dt(n,!0,a(this,F,"f")),this.demandOption(s,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(dt(n,!0,a(this,F,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(s=>{dt(n,!0,a(this,F,"f")),this.demandOption(s,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return _("<object|string|array> [string]",[t,e],arguments.length),this[Pe](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return _("<string> [string|boolean]",[t,e],arguments.length),a(this,I,"f").deprecatedOptions[t]=e,this}describe(t,e){return _("<object|string|array> [string]",[t,e],arguments.length),this[vr](t,!0),a(this,L,"f").describe(t,e),this}detectLocale(t){return _("<boolean>",[t],arguments.length),S(this,ie,t,"f"),this}env(t){return _("[string|boolean]",[t],arguments.length),t===!1?delete a(this,I,"f").envPrefix:a(this,I,"f").envPrefix=t||"",this}epilogue(t){return _("<string>",[t],arguments.length),a(this,L,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return _("<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,yt,!0,"f"),S(this,Kt,e,"f"),a(this,_t,"f")&&a(this,F,"f").process.exit(t)}exitProcess(t=!0){return _("[boolean]",[t],arguments.length),S(this,_t,t,"f"),this}fail(t){if(_("<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 _("<array> [function]",[t,e],arguments.length),e?a(this,Ct,"f").getCompletion(t,e):new Promise((n,s)=>{a(this,Ct,"f").getCompletion(t,(i,o)=>{i?s(i):n(o)})})}getDemandedOptions(){return _([],0),a(this,I,"f").demandedOptions}getDemandedCommands(){return _([],0),a(this,I,"f").demandedCommands}getDeprecatedOptions(){return _([],0),a(this,I,"f").deprecatedOptions}getDetectLocale(){return a(this,ie,"f")}getExitProcess(){return a(this,_t,"f")}getGroups(){return Object.assign({},a(this,Nt,"f"),a(this,ae,"f"))}getHelp(){if(S(this,yt,!0,"f"),!a(this,L,"f").hasCachedHelpMessage()){if(!this.parsed){let e=this[Re](a(this,Jt,"f"),void 0,void 0,0,!0);if(J(e))return e.then(()=>a(this,L,"f").help())}let t=a(this,it,"f").runDefaultBuilderOn(this);if(J(t))return t.then(()=>a(this,L,"f").help())}return Promise.resolve(a(this,L,"f").help())}getOptions(){return a(this,I,"f")}getStrict(){return a(this,ce,"f")}getStrictCommands(){return a(this,le,"f")}getStrictOptions(){return a(this,fe,"f")}global(t,e){return _("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?a(this,I,"f").local=a(this,I,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{a(this,I,"f").local.includes(n)||a(this,I,"f").local.push(n)}),this}group(t,e){_("<string|array> <string>",[t,e],arguments.length);let n=a(this,ae,"f")[e]||a(this,Nt,"f")[e];a(this,ae,"f")[e]&&delete a(this,ae,"f")[e];let s={};return a(this,Nt,"f")[e]=(n||[]).concat(t).filter(i=>s[i]?!1:s[i]=!0),this}hide(t){return _("<string>",[t],arguments.length),a(this,I,"f").hiddenOptions.push(t),this}implies(t,e){return _("<string|object> [number|string|array]",[t,e],arguments.length),a(this,rt,"f").implies(t,e),this}locale(t){return _("[string]",[t],arguments.length),t===void 0?(this[Ar](),a(this,F,"f").y18n.getLocale()):(S(this,ie,!1,"f"),a(this,F,"f").y18n.setLocale(t),this)}middleware(t,e,n){return a(this,St,"f").addMiddleware(t,!!e,n)}nargs(t,e){return _("<string|object|array> [number]",[t,e],arguments.length),this[Pe](this.nargs.bind(this),"narg",t,e),this}normalize(t){return _("<array|string>",[t],arguments.length),this[Qt]("normalize",t),this}number(t){return _("<array|string>",[t],arguments.length),this[Qt]("number",t),this[de](t),this}option(t,e){if(_("<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,Tt,"f")&&(t==="version"||e?.alias==="version")&&this[gi](['"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,I,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);let n=e.deprecate||e.deprecated;n&&this.deprecateOption(t,n);let s=e.demand||e.required||e.require;s&&this.demand(t,s),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,I,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);let i=e.describe||e.description||e.desc,o=a(this,L,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(o,t)||typeof i=="string")&&this.describe(t,i),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,n){_("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[bi](),typeof t>"u"&&(t=a(this,Jt,"f")),typeof e=="object"&&(S(this,oe,e,"f"),e=n),typeof e=="function"&&(S(this,xt,e,"f"),e=!1),e||S(this,Jt,t,"f"),a(this,xt,"f")&&S(this,_t,!1,"f");let s=this[Re](t,!!e),i=this.parsed;return a(this,Ct,"f").setParsed(this.parsed),J(s)?s.then(o=>(a(this,xt,"f")&&a(this,xt,"f").call(this,a(this,Kt,"f"),o,a(this,lt,"f")),o)).catch(o=>{throw a(this,xt,"f")&&a(this,xt,"f")(o,this.parsed.argv,a(this,lt,"f")),o}).finally(()=>{this[Pr](),this.parsed=i}):(a(this,xt,"f")&&a(this,xt,"f").call(this,a(this,Kt,"f"),s,a(this,lt,"f")),this[Pr](),this.parsed=i,s)}parseAsync(t,e,n){let s=this.parse(t,e,n);return J(s)?s:Promise.resolve(s)}parseSync(t,e,n){let s=this.parse(t,e,n);if(J(s))throw new Y(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}parserConfiguration(t){return _("<object>",[t],arguments.length),S(this,xn,t,"f"),this}pkgConf(t,e){_("<string> [string]",[t,e],arguments.length);let n=null,s=this[Er](e||a(this,se,"f"));return s[t]&&typeof s[t]=="object"&&(n=pn(s[t],e||a(this,se,"f"),this[he]()["deep-merge-config"]||!1,a(this,F,"f")),a(this,I,"f").configObjects=(a(this,I,"f").configObjects||[]).concat(n)),this}positional(t,e){_("<string> <object>",[t,e],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=Gt(e,(o,c)=>o==="type"&&!["string","number","boolean"].includes(c)?!1:n.includes(o));let s=a(this,Be,"f").fullCommands[a(this,Be,"f").fullCommands.length-1],i=s?a(this,it,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return Ce(i).forEach(o=>{let c=i[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 _("[boolean]",[t],arguments.length),S(this,On,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 _("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&a(this,I,"f").narg[t]?this:(this[Pe](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return _("[string] [string]",[t,e],arguments.length),t=t||this.$0,a(this,Se,"f").log(a(this,Ct,"f").generateCompletionScript(t,e||a(this,wt,"f")||"completion")),this}showHelp(t){if(_("[string|function]",[t],arguments.length),S(this,yt,!0,"f"),!a(this,L,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[Re](a(this,Jt,"f"),void 0,void 0,0,!0);if(J(n))return n.then(()=>{a(this,L,"f").showHelp(t)}),this}let e=a(this,it,"f").runDefaultBuilderOn(this);if(J(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 _("[boolean|string] [string]",[t,e],arguments.length),a(this,L,"f").showHelpOnFail(t,e),this}showVersion(t){return _("[string|function]",[t],arguments.length),a(this,L,"f").showVersion(t),this}skipValidation(t){return _("<array|string>",[t],arguments.length),this[Qt]("skipValidation",t),this}strict(t){return _("[boolean]",[t],arguments.length),S(this,ce,t!==!1,"f"),this}strictCommands(t){return _("[boolean]",[t],arguments.length),S(this,le,t!==!1,"f"),this}strictOptions(t){return _("[boolean]",[t],arguments.length),S(this,fe,t!==!1,"f"),this}string(t){return _("<array|string>",[t],arguments.length),this[Qt]("string",t),this[de](t),this}terminalWidth(){return _([],0),a(this,F,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return _("<object>",[t],arguments.length),S(this,ie,!1,"f"),a(this,F,"f").y18n.updateLocale(t),this}usage(t,e,n,s){if(_("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,s],arguments.length),e!==void 0){if(dt(t,null,a(this,F,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,s);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 _("<object>",[t],arguments.length),S(this,An,t,"f"),this}version(t,e,n){let s="version";if(_("[boolean|string] [string] [string]",[t,e,n],arguments.length),a(this,Tt,"f")&&(this[Or](a(this,Tt,"f")),a(this,L,"f").version(void 0),S(this,Tt,null,"f")),arguments.length===0)n=this[xi](),t=s;else if(arguments.length===1){if(t===!1)return this;n=t,t=s}else arguments.length===2&&(n=e,e=void 0);return S(this,Tt,typeof t=="string"?t:s,"f"),e=e||a(this,L,"f").deferY18nLookup("Show version number"),a(this,L,"f").version(n||void 0),this.boolean(a(this,Tt,"f")),this.describe(a(this,Tt,"f"),e),this}wrap(t){return _("<number|null|undefined>",[t],arguments.length),a(this,L,"f").wrap(t),this}[(it=new WeakMap,se=new WeakMap,Be=new WeakMap,Ct=new WeakMap,wt=new WeakMap,mn=new WeakMap,Kt=new WeakMap,ie=new WeakMap,gn=new WeakMap,_t=new WeakMap,bn=new WeakMap,St=new WeakMap,Nt=new WeakMap,yt=new WeakMap,vt=new WeakMap,wn=new WeakMap,Se=new WeakMap,lt=new WeakMap,I=new WeakMap,yn=new WeakMap,xn=new WeakMap,xt=new WeakMap,oe=new WeakMap,ve=new WeakMap,ae=new WeakMap,Jt=new WeakMap,On=new WeakMap,F=new WeakMap,ce=new WeakMap,le=new WeakMap,fe=new WeakMap,L=new WeakMap,An=new WeakMap,Tt=new WeakMap,rt=new WeakMap,pi)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[mi](){return{log:(...t)=>{this[En]()||console.log(...t),S(this,yt,!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[En]()||console.error(...t),S(this,yt,!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")}}}[Or](t){Ce(a(this,I,"f")).forEach(e=>{if((s=>s==="configObjects")(e))return;let n=a(this,I,"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]}[gi](t,e,n){a(this,gn,"f")[n]||(a(this,F,"f").process.emitWarning(t,e),a(this,gn,"f")[n]=!0)}[bi](){a(this,bn,"f").push({options:a(this,I,"f"),configObjects:a(this,I,"f").configObjects.slice(0),exitProcess:a(this,_t,"f"),groups:a(this,Nt,"f"),strict:a(this,ce,"f"),strictCommands:a(this,le,"f"),strictOptions:a(this,fe,"f"),completionCommand:a(this,wt,"f"),output:a(this,lt,"f"),exitError:a(this,Kt,"f"),hasOutput:a(this,yt,"f"),parsed:this.parsed,parseFn:a(this,xt,"f"),parseContext:a(this,oe,"f")}),a(this,L,"f").freeze(),a(this,rt,"f").freeze(),a(this,it,"f").freeze(),a(this,St,"f").freeze()}[wi](){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 s=this[Mi](a(this,se,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<n.length?s: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}[he](){return a(this,xn,"f")}[yi](){return a(this,An,"f")}[Ar](){if(!a(this,ie,"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(/[.:].*/,""))}[xi](){return this[Er]().version||"unknown"}[Oi](t){let e=t["--"]?t["--"]:t._;for(let n=0,s;(s=e[n])!==void 0;n++)a(this,F,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(e[n]=Number(s));return t}[Er](t){let e=t||"*";if(a(this,ve,"f")[e])return a(this,ve,"f")[e];let n={};try{let s=t||a(this,F,"f").mainFilename;!t&&a(this,F,"f").path.extname(s)&&(s=a(this,F,"f").path.dirname(s));let i=a(this,F,"f").findUp(s,(o,c)=>{if(c.includes("package.json"))return"package.json"});dt(i,void 0,a(this,F,"f")),n=JSON.parse(a(this,F,"f").readFileSync(i,"utf8"))}catch{}return a(this,ve,"f")[e]=n||{},a(this,ve,"f")[e]}[Qt](t,e){e=[].concat(e),e.forEach(n=>{n=this[Sr](n),a(this,I,"f")[t].push(n)})}[Pe](t,e,n,s){this[_r](t,e,n,s,(i,o,c)=>{a(this,I,"f")[i][o]=c})}[Cr](t,e,n,s){this[_r](t,e,n,s,(i,o,c)=>{a(this,I,"f")[i][o]=(a(this,I,"f")[i][o]||[]).concat(c)})}[_r](t,e,n,s,i){if(Array.isArray(n))n.forEach(o=>{t(o,s)});else if((o=>typeof o=="object")(n))for(let o of Ce(n))t(o,n[o]);else i(e,this[Sr](n),s)}[Sr](t){return t==="__proto__"?"___proto___":t}[vr](t,e){return this[Pe](this[vr].bind(this),"key",t,e),this}[Pr](){var t,e,n,s,i,o,c,m,w,d,h,g;let y=a(this,bn,"f").pop();dt(y,void 0,a(this,F,"f"));let x;t=this,e=this,n=this,s=this,i=this,o=this,c=this,m=this,w=this,d=this,h=this,g=this,{options:{set value(O){S(t,I,O,"f")}}.value,configObjects:x,exitProcess:{set value(O){S(e,_t,O,"f")}}.value,groups:{set value(O){S(n,Nt,O,"f")}}.value,output:{set value(O){S(s,lt,O,"f")}}.value,exitError:{set value(O){S(i,Kt,O,"f")}}.value,hasOutput:{set value(O){S(o,yt,O,"f")}}.value,parsed:this.parsed,strict:{set value(O){S(c,ce,O,"f")}}.value,strictCommands:{set value(O){S(m,le,O,"f")}}.value,strictOptions:{set value(O){S(w,fe,O,"f")}}.value,completionCommand:{set value(O){S(d,wt,O,"f")}}.value,parseFn:{set value(O){S(h,xt,O,"f")}}.value,parseContext:{set value(O){S(g,oe,O,"f")}}.value}=y,a(this,I,"f").configObjects=x,a(this,L,"f").unfreeze(),a(this,rt,"f").unfreeze(),a(this,it,"f").unfreeze(),a(this,St,"f").unfreeze()}[Ai](t,e){return re(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Ei].bind(this),getContext:this[Ci].bind(this),getHasOutput:this[_i].bind(this),getLoggerInstance:this[Si].bind(this),getParseContext:this[vi].bind(this),getParserConfiguration:this[he].bind(this),getUsageConfiguration:this[yi].bind(this),getUsageInstance:this[Pi].bind(this),getValidationInstance:this[ji].bind(this),hasParseCallback:this[En].bind(this),isGlobalContext:this[Ii].bind(this),postProcess:this[ue].bind(this),reset:this[jr].bind(this),runValidation:this[Ir].bind(this),runYargsParserAndExecuteCommands:this[Re].bind(this),setHasOutput:this[$i].bind(this)}}[Ei](){return a(this,it,"f")}[Ci](){return a(this,Be,"f")}[_i](){return a(this,yt,"f")}[Si](){return a(this,Se,"f")}[vi](){return a(this,oe,"f")||{}}[Pi](){return a(this,L,"f")}[ji](){return a(this,rt,"f")}[En](){return!!a(this,xt,"f")}[Ii](){return a(this,wn,"f")}[ue](t,e,n,s){return n||J(t)||(e||(t=this[pi](t)),(this[he]()["parse-positional-numbers"]||this[he]()["parse-positional-numbers"]===void 0)&&(t=this[Oi](t)),s&&(t=ne(t,this,a(this,St,"f").getMiddleware(),!1))),t}[jr](t={}){S(this,I,a(this,I,"f")||{},"f");let e={};e.local=a(this,I,"f").local||[],e.configObjects=a(this,I,"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,Nt,"f")).reduce((o,c)=>{let m=a(this,Nt,"f")[c].filter(w=>!(w in n));return m.length>0&&(o[c]=m),o},{})),S(this,Nt,{},"f");let s=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],i=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return s.forEach(o=>{e[o]=(a(this,I,"f")[o]||[]).filter(c=>!n[c])}),i.forEach(o=>{e[o]=Gt(a(this,I,"f")[o],c=>!n[c])}),e.envPrefix=a(this,I,"f").envPrefix,S(this,I,e,"f"),S(this,L,a(this,L,"f")?a(this,L,"f").reset(n):oi(this,a(this,F,"f")),"f"),S(this,rt,a(this,rt,"f")?a(this,rt,"f").reset(n):ui(this,a(this,L,"f"),a(this,F,"f")),"f"),S(this,it,a(this,it,"f")?a(this,it,"f").reset():ri(a(this,L,"f"),a(this,rt,"f"),a(this,St,"f"),a(this,F,"f")),"f"),a(this,Ct,"f")||S(this,Ct,li(this,a(this,L,"f"),a(this,it,"f"),a(this,F,"f")),"f"),a(this,St,"f").reset(),S(this,wt,null,"f"),S(this,lt,"","f"),S(this,Kt,null,"f"),S(this,yt,!1,"f"),this.parsed=!1,this}[Mi](t,e){return a(this,F,"f").path.relative(t,e)}[Re](t,e,n,s=0,i=!1){let o=!!n||i;t=t||a(this,Jt,"f"),a(this,I,"f").__=a(this,F,"f").y18n.__,a(this,I,"f").configuration=this[he]();let c=!!a(this,I,"f").configuration["populate--"],m=Object.assign({},a(this,I,"f").configuration,{"populate--":!0}),w=a(this,F,"f").Parser.detailed(t,Object.assign({},a(this,I,"f"),{configuration:{"parse-positional-numbers":!1,...m}})),d=Object.assign(w.argv,a(this,oe,"f")),h,g=w.aliases,y=!1,x=!1;Object.keys(d).forEach(O=>{O===a(this,vt,"f")&&d[O]?y=!0:O===a(this,Tt,"f")&&d[O]&&(x=!0)}),d.$0=this.$0,this.parsed=w,s===0&&a(this,L,"f").clearCachedHelpMessage();try{if(this[Ar](),e)return this[ue](d,c,!!n,!1);a(this,vt,"f")&&[a(this,vt,"f")].concat(g[a(this,vt,"f")]||[]).filter(W=>W.length>1).includes(""+d._[d._.length-1])&&(d._.pop(),y=!0),S(this,wn,!1,"f");let O=a(this,it,"f").getCommands(),p=a(this,Ct,"f").completionKey in d,N=y||p||i;if(d._.length){if(O.length){let U;for(let W=s||0,z;d._[W]!==void 0;W++)if(z=String(d._[W]),O.includes(z)&&z!==a(this,wt,"f")){let B=a(this,it,"f").runCommand(z,this,w,W+1,i,y||x||i);return this[ue](B,c,!!n,!1)}else if(!U&&z!==a(this,wt,"f")){U=z;break}!a(this,it,"f").hasDefaultCommand()&&a(this,On,"f")&&U&&!N&&a(this,rt,"f").recommendCommands(U,O)}a(this,wt,"f")&&d._.includes(a(this,wt,"f"))&&!p&&(a(this,_t,"f")&&Yt(!0),this.showCompletionScript(),this.exit(0))}if(a(this,it,"f").hasDefaultCommand()&&!N){let U=a(this,it,"f").runCommand(null,this,w,0,i,y||x||i);return this[ue](U,c,!!n,!1)}if(p){a(this,_t,"f")&&Yt(!0),t=[].concat(t);let U=t.slice(t.indexOf(`--${a(this,Ct,"f").completionKey}`)+1);return a(this,Ct,"f").getCompletion(U,(W,z)=>{if(W)throw new Y(W.message);(z||[]).forEach(B=>{a(this,Se,"f").log(B)}),this.exit(0)}),this[ue](d,!c,!!n,!1)}if(a(this,yt,"f")||(y?(a(this,_t,"f")&&Yt(!0),o=!0,this.showHelp("log"),this.exit(0)):x&&(a(this,_t,"f")&&Yt(!0),o=!0,a(this,L,"f").showVersion("log"),this.exit(0))),!o&&a(this,I,"f").skipValidation.length>0&&(o=Object.keys(d).some(U=>a(this,I,"f").skipValidation.indexOf(U)>=0&&d[U]===!0)),!o){if(w.error)throw new Y(w.error.message);if(!p){let U=this[Ir](g,{},w.error);n||(h=ne(d,this,a(this,St,"f").getMiddleware(),!0)),h=this[Ai](U,h??d),J(h)&&!n&&(h=h.then(()=>ne(d,this,a(this,St,"f").getMiddleware(),!1)))}}}catch(O){if(O instanceof Y)a(this,L,"f").fail(O.message,O);else throw O}return this[ue](h??d,c,!!n,!0)}[Ir](t,e,n,s){let i={...this.getDemandedOptions()};return o=>{if(n)throw new Y(n.message);a(this,rt,"f").nonOptionCount(o),a(this,rt,"f").requiredArguments(o,i);let c=!1;a(this,le,"f")&&(c=a(this,rt,"f").unknownCommands(o)),a(this,ce,"f")&&!c?a(this,rt,"f").unknownArguments(o,t,e,!!s):a(this,fe,"f")&&a(this,rt,"f").unknownArguments(o,t,{},!1,!1),a(this,rt,"f").limitedChoices(o),a(this,rt,"f").implications(o),a(this,rt,"f").conflicting(o)}}[$i](){S(this,yt,!0,"f")}[de](t){if(typeof t=="string")a(this,I,"f").key[t]=!0;else for(let e of t)a(this,I,"f").key[e]=!0}};function si(r){return!!r&&typeof r.getInternalMethods=="function"}var wc=Ni(Zs),Ti=wc;var Wi=kt(zi(),1);var Tr=kt(H("path"),1),Nr=kt(H("process"),1),Ui=H("module"),Li=H("url");function yc(r){let t=Tr.default.extname(r);return t?r.slice(0,-t.length):r}function Fr(r){if(!r||!Nr.default.argv[1])return!1;let e=(0,Ui.createRequire)(r.url).resolve(Nr.default.argv[1]),n=(0,Li.fileURLToPath)(r.url);return Tr.default.extname(e)?n===e:yc(n)===e}var Ac={},xc=process.argv.slice(2),Di=new Wi.default(Ti),zr=console.log;async function Ur(r){Di.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((s,i,o)=>{if(i!=null)throw i;xc.length>0&&zr(s),o.showHelp()});let{data:t,argv:e}=await Di.parse(r);t!=null&&(zr(t),process.exit(0)),await(await Bi(ir(e.listen),e)).start(),e.quiet!==!0&&zr("daemon has started")}async function Bi(r,t){throw new Error("Not implemented yet")}Fr(Ac)&&Ur(process.argv).catch(r=>{console.error(r),process.exit(1)});return Yi(Oc);})();
59
+ `;var Jr=class{constructor(e,t,n,s){var i,o,c;this.yargs=e,this.usage=t,this.command=n,this.shim=s,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(c=((i=this.shim.getEnv("SHELL"))===null||i===void 0?void 0:i.includes("zsh"))||((o=this.shim.getEnv("ZSH_NAME"))===null||o===void 0?void 0:o.includes("zsh")))!==null&&c!==void 0?c:!1}defaultCompletion(e,t,n,s){let i=this.command.getCommandHandlers();for(let c=0,l=e.length;c<l;++c)if(i[e[c]]&&i[e[c]].builder){let b=i[e[c]].builder;if(gn(b)){this.indexAfterLastReset=c+1;let h=this.yargs.getInternalMethods().reset();return b(h,!0),h.argv}}let o=[];this.commandCompletions(o,e,n),this.optionCompletions(o,e,t,n),this.choicesFromOptionsCompletions(o,e,t,n),this.choicesFromPositionalsCompletions(o,e,t,n),s(null,o)}commandCompletions(e,t,n){let s=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&s[s.length-1]!==n&&!this.previousArgHasChoices(t)&&this.usage.getCommands().forEach(i=>{let o=Ge(i[0]).cmd;if(t.indexOf(o)===-1)if(!this.zshShell)e.push(o);else{let c=i[1]||"";e.push(o.replace(/:/g,"\\:")+":"+c)}})}optionCompletions(e,t,n,s){if((s.match(/^-/)||s===""&&e.length===0)&&!this.previousArgHasChoices(t)){let i=this.yargs.getOptions(),o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(i.key).forEach(c=>{let l=!!i.configuration["boolean-negation"]&&i.boolean.includes(c);!o.includes(c)&&!i.hiddenOptions.includes(c)&&!this.argsContainKey(t,c,l)&&this.completeOptionKey(c,e,s,l&&!!i.default[c])})}}choicesFromOptionsCompletions(e,t,n,s){if(this.previousArgHasChoices(t)){let i=this.getPreviousArgChoices(t);i&&i.length>0&&e.push(...i.map(o=>o.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,t,n,s){if(s===""&&e.length>0&&this.previousArgHasChoices(t))return;let i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],o=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),c=i[n._.length-o-1];if(!c)return;let l=this.yargs.getOptions().choices[c]||[];for(let b of l)b.startsWith(s)&&e.push(b.replace(/:/g,"\\:"))}getPreviousArgChoices(e){if(e.length<1)return;let t=e[e.length-1],n="";if(!t.startsWith("-")&&e.length>1&&(n=t,t=e[e.length-2]),!t.startsWith("-"))return;let s=t.replace(/^-+/,""),i=this.yargs.getOptions(),o=[s,...this.yargs.getAliases()[s]||[]],c;for(let l of o)if(Object.prototype.hasOwnProperty.call(i.key,l)&&Array.isArray(i.choices[l])){c=i.choices[l];break}if(c)return c.filter(l=>!n||l.startsWith(n))}previousArgHasChoices(e){let t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){let s=i=>e.indexOf((/^[^0-9]$/.test(i)?"-":"--")+i)!==-1;if(s(t)||n&&s(`no-${t}`))return!0;if(this.aliases){for(let i of this.aliases[t])if(s(i))return!0}return!1}completeOptionKey(e,t,n,s){var i,o,c,l;let b=e;if(this.zshShell){let x=this.usage.getDescriptions(),w=(o=(i=this===null||this===void 0?void 0:this.aliases)===null||i===void 0?void 0:i[e])===null||o===void 0?void 0:o.find(_=>{let j=x[_];return typeof j=="string"&&j.length>0}),C=w?x[w]:void 0,m=(l=(c=x[e])!==null&&c!==void 0?c:C)!==null&&l!==void 0?l:"";b=`${e.replace(/:/g,"\\:")}:${m.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let h=x=>/^--/.test(x),d=x=>/^[^0-9]$/.test(x),g=!h(n)&&d(e)?"-":"--";t.push(g+b),s&&t.push(g+"no-"+b)}customCompletion(e,t,n,s){if(me(this.customCompletionFunction,null,this.shim),cl(this.customCompletionFunction)){let i=this.customCompletionFunction(n,t);return k(i)?i.then(o=>{this.shim.process.nextTick(()=>{s(null,o)})}).catch(o=>{this.shim.process.nextTick(()=>{s(o,void 0)})}):s(null,i)}else return fl(this.customCompletionFunction)?this.customCompletionFunction(n,t,(i=s)=>this.defaultCompletion(e,t,n,i),i=>{s(null,i)}):this.customCompletionFunction(n,t,i=>{s(null,i)})}getCompletion(e,t){let n=e.length?e[e.length-1]:"",s=this.yargs.parse(e,!0),i=this.customCompletionFunction?o=>this.customCompletion(e,o,n,t):o=>this.defaultCompletion(e,o,n,t);return k(s)?s.then(i):i(s)}generateCompletionScript(e,t){let n=this.zshShell?eo:ki,s=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,s),n=n.replace(/{{completion_command}}/g,t),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}};function to(r,e,t,n){return new Jr(r,e,t,n)}function cl(r){return r.length<3}function fl(r){return r.length>3}function no(r,e){if(r.length===0)return e.length;if(e.length===0)return r.length;let t=[],n;for(n=0;n<=e.length;n++)t[n]=[n];let s;for(s=0;s<=r.length;s++)t[0][s]=s;for(n=1;n<=e.length;n++)for(s=1;s<=r.length;s++)e.charAt(n-1)===r.charAt(s-1)?t[n][s]=t[n-1][s-1]:n>1&&s>1&&e.charAt(n-2)===r.charAt(s-1)&&e.charAt(n-1)===r.charAt(s-2)?t[n][s]=t[n-2][s-2]+1:t[n][s]=Math.min(t[n-1][s-1]+1,Math.min(t[n][s-1]+1,t[n-1][s]+1));return t[e.length][r.length]}var ro=["$0","--","_"];function so(r,e,t){let n=t.y18n.__,s=t.y18n.__n,i={};i.nonOptionCount=function(d){let g=r.getDemandedCommands(),w=d._.length+(d["--"]?d["--"].length:0)-r.getInternalMethods().getContext().commands.length;g._&&(w<g._.min||w>g._.max)&&(w<g._.min?g._.minMsg!==void 0?e.fail(g._.minMsg?g._.minMsg.replace(/\$0/g,w.toString()).replace(/\$1/,g._.min.toString()):null):e.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",w,w.toString(),g._.min.toString())):w>g._.max&&(g._.maxMsg!==void 0?e.fail(g._.maxMsg?g._.maxMsg.replace(/\$0/g,w.toString()).replace(/\$1/,g._.max.toString()):null):e.fail(s("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",w,w.toString(),g._.max.toString()))))},i.positionalCount=function(d,g){g<d&&e.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",g,g+"",d+""))},i.requiredArguments=function(d,g){let x=null;for(let w of Object.keys(g))(!Object.prototype.hasOwnProperty.call(d,w)||typeof d[w]>"u")&&(x=x||{},x[w]=g[w]);if(x){let w=[];for(let m of Object.keys(x)){let _=x[m];_&&w.indexOf(_)<0&&w.push(_)}let C=w.length?`
60
+ ${w.join(`
61
+ `)}`:"";e.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(x).length,Object.keys(x).join(", ")+C))}},i.unknownArguments=function(d,g,x,w,C=!0){var m;let _=r.getInternalMethods().getCommandInstance().getCommands(),j=[],U=r.getInternalMethods().getContext();if(Object.keys(d).forEach(M=>{!ro.includes(M)&&!Object.prototype.hasOwnProperty.call(x,M)&&!Object.prototype.hasOwnProperty.call(r.getInternalMethods().getParseContext(),M)&&!i.isValidAndSomeAliasIsNotNew(M,g)&&j.push(M)}),C&&(U.commands.length>0||_.length>0||w)&&d._.slice(U.commands.length).forEach(M=>{_.includes(""+M)||j.push(""+M)}),C){let T=((m=r.getDemandedCommands()._)===null||m===void 0?void 0:m.max)||0,K=U.commands.length+T;K<d._.length&&d._.slice(K).forEach(V=>{V=String(V),!U.commands.includes(V)&&!j.includes(V)&&j.push(V)})}j.length&&e.fail(s("Unknown argument: %s","Unknown arguments: %s",j.length,j.map(M=>M.trim()?M:`"${M}"`).join(", ")))},i.unknownCommands=function(d){let g=r.getInternalMethods().getCommandInstance().getCommands(),x=[],w=r.getInternalMethods().getContext();return(w.commands.length>0||g.length>0)&&d._.slice(w.commands.length).forEach(C=>{g.includes(""+C)||x.push(""+C)}),x.length>0?(e.fail(s("Unknown command: %s","Unknown commands: %s",x.length,x.join(", "))),!0):!1},i.isValidAndSomeAliasIsNotNew=function(d,g){if(!Object.prototype.hasOwnProperty.call(g,d))return!1;let x=r.parsed.newAliases;return[d,...g[d]].some(w=>!Object.prototype.hasOwnProperty.call(x,w)||!x[d])},i.limitedChoices=function(d){let g=r.getOptions(),x={};if(!Object.keys(g.choices).length)return;Object.keys(d).forEach(m=>{ro.indexOf(m)===-1&&Object.prototype.hasOwnProperty.call(g.choices,m)&&[].concat(d[m]).forEach(_=>{g.choices[m].indexOf(_)===-1&&_!==void 0&&(x[m]=(x[m]||[]).concat(_))})});let w=Object.keys(x);if(!w.length)return;let C=n("Invalid values:");w.forEach(m=>{C+=`
62
+ ${n("Argument: %s, Given: %s, Choices: %s",m,e.stringifiedValues(x[m]),e.stringifiedValues(g.choices[m]))}`}),e.fail(C)};let o={};i.implies=function(d,g){v("<string|object> [array|number|string]",[d,g],arguments.length),typeof d=="object"?Object.keys(d).forEach(x=>{i.implies(x,d[x])}):(r.global(d),o[d]||(o[d]=[]),Array.isArray(g)?g.forEach(x=>i.implies(d,x)):(me(g,void 0,t),o[d].push(g)))},i.getImplied=function(){return o};function c(h,d){let g=Number(d);return d=isNaN(g)?d:g,typeof d=="number"?d=h._.length>=d:d.match(/^--no-.+/)?(d=d.match(/^--no-(.+)/)[1],d=!Object.prototype.hasOwnProperty.call(h,d)):d=Object.prototype.hasOwnProperty.call(h,d),d}i.implications=function(d){let g=[];if(Object.keys(o).forEach(x=>{let w=x;(o[x]||[]).forEach(C=>{let m=w,_=C;m=c(d,m),C=c(d,C),m&&!C&&g.push(` ${w} -> ${_}`)})}),g.length){let x=`${n("Implications failed:")}
63
+ `;g.forEach(w=>{x+=w}),e.fail(x)}};let l={};i.conflicts=function(d,g){v("<string|object> [array|string]",[d,g],arguments.length),typeof d=="object"?Object.keys(d).forEach(x=>{i.conflicts(x,d[x])}):(r.global(d),l[d]||(l[d]=[]),Array.isArray(g)?g.forEach(x=>i.conflicts(d,x)):l[d].push(g))},i.getConflicting=()=>l,i.conflicting=function(d){Object.keys(d).forEach(g=>{l[g]&&l[g].forEach(x=>{x&&d[g]!==void 0&&d[x]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",g,x))})}),r.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach(g=>{l[g].forEach(x=>{x&&d[t.Parser.camelCase(g)]!==void 0&&d[t.Parser.camelCase(x)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",g,x))})})},i.recommendCommands=function(d,g){g=g.sort((m,_)=>_.length-m.length);let w=null,C=1/0;for(let m=0,_;(_=g[m])!==void 0;m++){let j=no(d,_);j<=3&&j<C&&(C=j,w=_)}w&&e.fail(n("Did you mean %s?",w))},i.reset=function(d){return o=Ye(o,g=>!d[g]),l=Ye(l,g=>!d[g]),i};let b=[];return i.freeze=function(){b.push({implied:o,conflicting:l})},i.unfreeze=function(){let d=b.pop();me(d,void 0,t),{implied:o,conflicting:l}=d},i}var Qr=[],Gt;function wn(r,e,t,n){Gt=n;let s={};if(Object.prototype.hasOwnProperty.call(r,"extends")){if(typeof r.extends!="string")return s;let i=/\.json|\..*rc$/.test(r.extends),o=null;if(i)o=hl(e,r.extends);else try{o=G.resolve(r.extends)}catch{return r}ll(o),Qr.push(o),s=i?JSON.parse(Gt.readFileSync(o,"utf8")):G(r.extends),delete r.extends,s=wn(s,Gt.path.dirname(o),t,Gt)}return Qr=[],t?io(s,r):Object.assign({},s,r)}function ll(r){if(Qr.indexOf(r)>-1)throw new Z(`Circular extended configurations: '${r}'.`)}function hl(r,e){return Gt.path.resolve(r,e)}function io(r,e){let t={};function n(s){return s&&typeof s=="object"&&!Array.isArray(s)}Object.assign(t,r);for(let s of Object.keys(e))n(e[s])&&n(t[s])?t[s]=io(r[s],e[s]):t[s]=e[s];return t}var S=function(r,e,t,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(r,t):s?s.value=t:e.set(r,t),t},a=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ce,ot,Yt,ve,ye,yn,Je,at,xn,Se,Cn,_e,Ue,xe,Ie,An,$t,ue,$,En,On,Ce,ct,Dt,ft,Qe,vn,L,lt,ht,ut,B,Sn,ze,oe;function So(r){return(e=[],t=r.process.cwd(),n)=>{let s=new as(e,t,n,r);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}var oo=Symbol("copyDoubleDash"),ao=Symbol("copyDoubleDash"),Xr=Symbol("deleteFromParserHintObject"),co=Symbol("emitWarning"),fo=Symbol("freeze"),lo=Symbol("getDollarZero"),dt=Symbol("getParserConfiguration"),ho=Symbol("getUsageConfiguration"),Zr=Symbol("guessLocale"),uo=Symbol("guessVersion"),po=Symbol("parsePositionalNumbers"),kr=Symbol("pkgUp"),Xe=Symbol("populateParserHintArray"),Ut=Symbol("populateParserHintSingleValueDictionary"),es=Symbol("populateParserHintArrayDictionary"),ts=Symbol("populateParserHintDictionary"),ns=Symbol("sanitizeKey"),rs=Symbol("setKey"),ss=Symbol("unfreeze"),mo=Symbol("validateAsync"),go=Symbol("getCommandInstance"),bo=Symbol("getContext"),wo=Symbol("getHasOutput"),yo=Symbol("getLoggerInstance"),xo=Symbol("getParseContext"),Co=Symbol("getUsageInstance"),Ao=Symbol("getValidationInstance"),_n=Symbol("hasParseCallback"),Eo=Symbol("isGlobalContext"),pt=Symbol("postProcess"),Oo=Symbol("rebase"),is=Symbol("reset"),Kt=Symbol("runYargsParserAndExecuteCommands"),os=Symbol("runValidation"),vo=Symbol("setHasOutput"),mt=Symbol("kTrackManuallySetKeys"),as=class{constructor(e=[],t,n,s){this.customScriptName=!1,this.parsed=!1,ce.set(this,void 0),ot.set(this,void 0),Yt.set(this,{commands:[],fullCommands:[]}),ve.set(this,null),ye.set(this,null),yn.set(this,"show-hidden"),Je.set(this,null),at.set(this,!0),xn.set(this,{}),Se.set(this,!0),Cn.set(this,[]),_e.set(this,void 0),Ue.set(this,{}),xe.set(this,!1),Ie.set(this,null),An.set(this,!0),$t.set(this,void 0),ue.set(this,""),$.set(this,void 0),En.set(this,void 0),On.set(this,{}),Ce.set(this,null),ct.set(this,null),Dt.set(this,{}),ft.set(this,{}),Qe.set(this,void 0),vn.set(this,!1),L.set(this,void 0),lt.set(this,!1),ht.set(this,!1),ut.set(this,!1),B.set(this,void 0),Sn.set(this,{}),ze.set(this,null),oe.set(this,void 0),S(this,L,s,"f"),S(this,Qe,e,"f"),S(this,ot,t,"f"),S(this,En,n,"f"),S(this,_e,new mn(this),"f"),this.$0=this[lo](),this[is](),S(this,ce,a(this,ce,"f"),"f"),S(this,B,a(this,B,"f"),"f"),S(this,oe,a(this,oe,"f"),"f"),S(this,$,a(this,$,"f"),"f"),a(this,$,"f").showHiddenOpt=a(this,yn,"f"),S(this,$t,this[ao](),"f")}addHelpOpt(e,t){let n="help";return v("[string|boolean] [string]",[e,t],arguments.length),a(this,Ie,"f")&&(this[Xr](a(this,Ie,"f")),S(this,Ie,null,"f")),e===!1&&t===void 0?this:(S(this,Ie,typeof e=="string"?e:n,"f"),this.boolean(a(this,Ie,"f")),this.describe(a(this,Ie,"f"),t||a(this,B,"f").deferY18nLookup("Show help")),this)}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if(v("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;let n=typeof e=="string"?e:a(this,yn,"f");return this.boolean(n),this.describe(n,t||a(this,B,"f").deferY18nLookup("Show hidden options")),a(this,$,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return v("<object|string|array> [string|array]",[e,t],arguments.length),this[es](this.alias.bind(this),"alias",e,t),this}array(e){return v("<array|string>",[e],arguments.length),this[Xe]("array",e),this[mt](e),this}boolean(e){return v("<array|string>",[e],arguments.length),this[Xe]("boolean",e),this[mt](e),this}check(e,t){return v("<function> [boolean]",[e,t],arguments.length),this.middleware((n,s)=>it(()=>e(n,s.getOptions()),i=>(i?(typeof i=="string"||i instanceof Error)&&a(this,B,"f").fail(i.toString(),i):a(this,B,"f").fail(a(this,L,"f").y18n.__("Argument check failed: %s",e.toString())),n),i=>(a(this,B,"f").fail(i.message?i.message:i.toString(),i),n)),!1,t),this}choices(e,t){return v("<object|string|array> [string|array]",[e,t],arguments.length),this[es](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if(v("<object|string|array> [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new Z("coerce callback must be provided");for(let n of e)this.coerce(n,t);return this}else if(typeof e=="object"){for(let n of Object.keys(e))this.coerce(n,e[n]);return this}if(!t)throw new Z("coerce callback must be provided");return a(this,$,"f").key[e]=!0,a(this,_e,"f").addCoerceMiddleware((n,s)=>{let i;return Object.prototype.hasOwnProperty.call(n,e)?it(()=>(i=s.getAliases(),t(n[e])),c=>{n[e]=c;let l=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[e]&&l!==!0)for(let b of i[e])n[b]=c;return n},c=>{throw new Z(c.message)}):n},e),this}conflicts(e,t){return v("<string|object> [string|array]",[e,t],arguments.length),a(this,oe,"f").conflicts(e,t),this}config(e="config",t,n){return v("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=wn(e,a(this,ot,"f"),this[dt]()["deep-merge-config"]||!1,a(this,L,"f")),a(this,$,"f").configObjects=(a(this,$,"f").configObjects||[]).concat(e),this):(typeof t=="function"&&(n=t,t=void 0),this.describe(e,t||a(this,B,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(s=>{a(this,$,"f").config[s]=n||!0}),this)}completion(e,t,n){return v("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t=="function"&&(n=t,t=void 0),S(this,ye,e||a(this,ye,"f")||"completion","f"),!t&&t!==!1&&(t="generate completion script"),this.command(a(this,ye,"f"),t),n&&a(this,ve,"f").registerFunction(n),this}command(e,t,n,s,i,o){return v("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,s,i,o],arguments.length),a(this,ce,"f").addHandler(e,t,n,s,i,o),this}commands(e,t,n,s,i,o){return this.command(e,t,n,s,i,o)}commandDir(e,t){v("<string> [object]",[e,t],arguments.length);let n=a(this,En,"f")||a(this,L,"f").require;return a(this,ce,"f").addDirectory(e,n,a(this,L,"f").getCallerFile(),t),this}count(e){return v("<array|string>",[e],arguments.length),this[Xe]("count",e),this[mt](e),this}default(e,t,n){return v("<object|string|array> [*] [string]",[e,t,n],arguments.length),n&&(Hr(e,a(this,L,"f")),a(this,$,"f").defaultDescription[e]=n),typeof t=="function"&&(Hr(e,a(this,L,"f")),a(this,$,"f").defaultDescription[e]||(a(this,$,"f").defaultDescription[e]=a(this,B,"f").functionDescription(t)),t=t.call()),this[Ut](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,s){return v("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,s],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),a(this,$,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:s},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(s=>{me(n,!0,a(this,L,"f")),this.demandOption(s,n)}),t=1/0):typeof t!="number"&&(n=t,t=1/0),typeof e=="number"?(me(n,!0,a(this,L,"f")),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(s=>{me(n,!0,a(this,L,"f")),this.demandOption(s,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return v("<object|string|array> [string]",[e,t],arguments.length),this[Ut](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return v("<string> [string|boolean]",[e,t],arguments.length),a(this,$,"f").deprecatedOptions[e]=t,this}describe(e,t){return v("<object|string|array> [string]",[e,t],arguments.length),this[rs](e,!0),a(this,B,"f").describe(e,t),this}detectLocale(e){return v("<boolean>",[e],arguments.length),S(this,at,e,"f"),this}env(e){return v("[string|boolean]",[e],arguments.length),e===!1?delete a(this,$,"f").envPrefix:a(this,$,"f").envPrefix=e||"",this}epilogue(e){return v("<string>",[e],arguments.length),a(this,B,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return v("<string|array> [string]",[e,t],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):a(this,B,"f").example(e,t),this}exit(e,t){S(this,xe,!0,"f"),S(this,Je,t,"f"),a(this,Se,"f")&&a(this,L,"f").process.exit(e)}exitProcess(e=!0){return v("[boolean]",[e],arguments.length),S(this,Se,e,"f"),this}fail(e){if(v("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new Z("Invalid first argument. Expected function or boolean 'false'");return a(this,B,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return v("<array> [function]",[e,t],arguments.length),t?a(this,ve,"f").getCompletion(e,t):new Promise((n,s)=>{a(this,ve,"f").getCompletion(e,(i,o)=>{i?s(i):n(o)})})}getDemandedOptions(){return v([],0),a(this,$,"f").demandedOptions}getDemandedCommands(){return v([],0),a(this,$,"f").demandedCommands}getDeprecatedOptions(){return v([],0),a(this,$,"f").deprecatedOptions}getDetectLocale(){return a(this,at,"f")}getExitProcess(){return a(this,Se,"f")}getGroups(){return Object.assign({},a(this,Ue,"f"),a(this,ft,"f"))}getHelp(){if(S(this,xe,!0,"f"),!a(this,B,"f").hasCachedHelpMessage()){if(!this.parsed){let t=this[Kt](a(this,Qe,"f"),void 0,void 0,0,!0);if(k(t))return t.then(()=>a(this,B,"f").help())}let e=a(this,ce,"f").runDefaultBuilderOn(this);if(k(e))return e.then(()=>a(this,B,"f").help())}return Promise.resolve(a(this,B,"f").help())}getOptions(){return a(this,$,"f")}getStrict(){return a(this,lt,"f")}getStrictCommands(){return a(this,ht,"f")}getStrictOptions(){return a(this,ut,"f")}global(e,t){return v("<string|array> [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1?a(this,$,"f").local=a(this,$,"f").local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{a(this,$,"f").local.includes(n)||a(this,$,"f").local.push(n)}),this}group(e,t){v("<string|array> <string>",[e,t],arguments.length);let n=a(this,ft,"f")[t]||a(this,Ue,"f")[t];a(this,ft,"f")[t]&&delete a(this,ft,"f")[t];let s={};return a(this,Ue,"f")[t]=(n||[]).concat(e).filter(i=>s[i]?!1:s[i]=!0),this}hide(e){return v("<string>",[e],arguments.length),a(this,$,"f").hiddenOptions.push(e),this}implies(e,t){return v("<string|object> [number|string|array]",[e,t],arguments.length),a(this,oe,"f").implies(e,t),this}locale(e){return v("[string]",[e],arguments.length),e===void 0?(this[Zr](),a(this,L,"f").y18n.getLocale()):(S(this,at,!1,"f"),a(this,L,"f").y18n.setLocale(e),this)}middleware(e,t,n){return a(this,_e,"f").addMiddleware(e,!!t,n)}nargs(e,t){return v("<string|object|array> [number]",[e,t],arguments.length),this[Ut](this.nargs.bind(this),"narg",e,t),this}normalize(e){return v("<array|string>",[e],arguments.length),this[Xe]("normalize",e),this}number(e){return v("<array|string>",[e],arguments.length),this[Xe]("number",e),this[mt](e),this}option(e,t){if(v("<string|object> [object]",[e,t],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof t!="object"&&(t={}),this[mt](e),a(this,ze,"f")&&(e==="version"||t?.alias==="version")&&this[co](['"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,$,"f").key[e]=!0,t.alias&&this.alias(e,t.alias);let n=t.deprecate||t.deprecated;n&&this.deprecateOption(e,n);let s=t.demand||t.required||t.require;s&&this.demand(e,s),t.demandOption&&this.demandOption(e,typeof t.demandOption=="string"?t.demandOption:void 0),t.conflicts&&this.conflicts(e,t.conflicts),"default"in t&&this.default(e,t.default),t.implies!==void 0&&this.implies(e,t.implies),t.nargs!==void 0&&this.nargs(e,t.nargs),t.config&&this.config(e,t.configParser),t.normalize&&this.normalize(e),t.choices&&this.choices(e,t.choices),t.coerce&&this.coerce(e,t.coerce),t.group&&this.group(e,t.group),(t.boolean||t.type==="boolean")&&(this.boolean(e),t.alias&&this.boolean(t.alias)),(t.array||t.type==="array")&&(this.array(e),t.alias&&this.array(t.alias)),(t.number||t.type==="number")&&(this.number(e),t.alias&&this.number(t.alias)),(t.string||t.type==="string")&&(this.string(e),t.alias&&this.string(t.alias)),(t.count||t.type==="count")&&this.count(e),typeof t.global=="boolean"&&this.global(e,t.global),t.defaultDescription&&(a(this,$,"f").defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);let i=t.describe||t.description||t.desc,o=a(this,B,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(o,e)||typeof i=="string")&&this.describe(e,i),t.hidden&&this.hide(e),t.requiresArg&&this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){v("[string|array] [function|boolean|object] [function]",[e,t,n],arguments.length),this[fo](),typeof e>"u"&&(e=a(this,Qe,"f")),typeof t=="object"&&(S(this,ct,t,"f"),t=n),typeof t=="function"&&(S(this,Ce,t,"f"),t=!1),t||S(this,Qe,e,"f"),a(this,Ce,"f")&&S(this,Se,!1,"f");let s=this[Kt](e,!!t),i=this.parsed;return a(this,ve,"f").setParsed(this.parsed),k(s)?s.then(o=>(a(this,Ce,"f")&&a(this,Ce,"f").call(this,a(this,Je,"f"),o,a(this,ue,"f")),o)).catch(o=>{throw a(this,Ce,"f")&&a(this,Ce,"f")(o,this.parsed.argv,a(this,ue,"f")),o}).finally(()=>{this[ss](),this.parsed=i}):(a(this,Ce,"f")&&a(this,Ce,"f").call(this,a(this,Je,"f"),s,a(this,ue,"f")),this[ss](),this.parsed=i,s)}parseAsync(e,t,n){let s=this.parse(e,t,n);return k(s)?s:Promise.resolve(s)}parseSync(e,t,n){let s=this.parse(e,t,n);if(k(s))throw new Z(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}parserConfiguration(e){return v("<object>",[e],arguments.length),S(this,On,e,"f"),this}pkgConf(e,t){v("<string> [string]",[e,t],arguments.length);let n=null,s=this[kr](t||a(this,ot,"f"));return s[e]&&typeof s[e]=="object"&&(n=wn(s[e],t||a(this,ot,"f"),this[dt]()["deep-merge-config"]||!1,a(this,L,"f")),a(this,$,"f").configObjects=(a(this,$,"f").configObjects||[]).concat(n)),this}positional(e,t){v("<string> <object>",[e,t],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=Ye(t,(o,c)=>o==="type"&&!["string","number","boolean"].includes(c)?!1:n.includes(o));let s=a(this,Yt,"f").fullCommands[a(this,Yt,"f").fullCommands.length-1],i=s?a(this,ce,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return Mt(i).forEach(o=>{let c=i[o];Array.isArray(c)?c.indexOf(e)!==-1&&(t[o]=!0):c[e]&&!(o in t)&&(t[o]=c[e])}),this.group(e,a(this,B,"f").getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return v("[boolean]",[e],arguments.length),S(this,vn,e,"f"),this}required(e,t,n){return this.demand(e,t,n)}require(e,t,n){return this.demand(e,t,n)}requiresArg(e){return v("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&a(this,$,"f").narg[e]?this:(this[Ut](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,t){return v("[string] [string]",[e,t],arguments.length),e=e||this.$0,a(this,$t,"f").log(a(this,ve,"f").generateCompletionScript(e,t||a(this,ye,"f")||"completion")),this}showHelp(e){if(v("[string|function]",[e],arguments.length),S(this,xe,!0,"f"),!a(this,B,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[Kt](a(this,Qe,"f"),void 0,void 0,0,!0);if(k(n))return n.then(()=>{a(this,B,"f").showHelp(e)}),this}let t=a(this,ce,"f").runDefaultBuilderOn(this);if(k(t))return t.then(()=>{a(this,B,"f").showHelp(e)}),this}return a(this,B,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return v("[boolean|string] [string]",[e,t],arguments.length),a(this,B,"f").showHelpOnFail(e,t),this}showVersion(e){return v("[string|function]",[e],arguments.length),a(this,B,"f").showVersion(e),this}skipValidation(e){return v("<array|string>",[e],arguments.length),this[Xe]("skipValidation",e),this}strict(e){return v("[boolean]",[e],arguments.length),S(this,lt,e!==!1,"f"),this}strictCommands(e){return v("[boolean]",[e],arguments.length),S(this,ht,e!==!1,"f"),this}strictOptions(e){return v("[boolean]",[e],arguments.length),S(this,ut,e!==!1,"f"),this}string(e){return v("<array|string>",[e],arguments.length),this[Xe]("string",e),this[mt](e),this}terminalWidth(){return v([],0),a(this,L,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return v("<object>",[e],arguments.length),S(this,at,!1,"f"),a(this,L,"f").y18n.updateLocale(e),this}usage(e,t,n,s){if(v("<string|null|undefined> [string|boolean] [function|object] [function]",[e,t,n,s],arguments.length),t!==void 0){if(me(e,null,a(this,L,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,s);throw new Z(".usage() description must start with $0 if being used as alias for .command()")}else return a(this,B,"f").usage(e),this}usageConfiguration(e){return v("<object>",[e],arguments.length),S(this,Sn,e,"f"),this}version(e,t,n){let s="version";if(v("[boolean|string] [string] [string]",[e,t,n],arguments.length),a(this,ze,"f")&&(this[Xr](a(this,ze,"f")),a(this,B,"f").version(void 0),S(this,ze,null,"f")),arguments.length===0)n=this[uo](),e=s;else if(arguments.length===1){if(e===!1)return this;n=e,e=s}else arguments.length===2&&(n=t,t=void 0);return S(this,ze,typeof e=="string"?e:s,"f"),t=t||a(this,B,"f").deferY18nLookup("Show version number"),a(this,B,"f").version(n||void 0),this.boolean(a(this,ze,"f")),this.describe(a(this,ze,"f"),t),this}wrap(e){return v("<number|null|undefined>",[e],arguments.length),a(this,B,"f").wrap(e),this}[(ce=new WeakMap,ot=new WeakMap,Yt=new WeakMap,ve=new WeakMap,ye=new WeakMap,yn=new WeakMap,Je=new WeakMap,at=new WeakMap,xn=new WeakMap,Se=new WeakMap,Cn=new WeakMap,_e=new WeakMap,Ue=new WeakMap,xe=new WeakMap,Ie=new WeakMap,An=new WeakMap,$t=new WeakMap,ue=new WeakMap,$=new WeakMap,En=new WeakMap,On=new WeakMap,Ce=new WeakMap,ct=new WeakMap,Dt=new WeakMap,ft=new WeakMap,Qe=new WeakMap,vn=new WeakMap,L=new WeakMap,lt=new WeakMap,ht=new WeakMap,ut=new WeakMap,B=new WeakMap,Sn=new WeakMap,ze=new WeakMap,oe=new WeakMap,oo)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[ao](){return{log:(...e)=>{this[_n]()||console.log(...e),S(this,xe,!0,"f"),a(this,ue,"f").length&&S(this,ue,a(this,ue,"f")+`
65
+ `,"f"),S(this,ue,a(this,ue,"f")+e.join(" "),"f")},error:(...e)=>{this[_n]()||console.error(...e),S(this,xe,!0,"f"),a(this,ue,"f").length&&S(this,ue,a(this,ue,"f")+`
66
+ `,"f"),S(this,ue,a(this,ue,"f")+e.join(" "),"f")}}}[Xr](e){Mt(a(this,$,"f")).forEach(t=>{if((s=>s==="configObjects")(t))return;let n=a(this,$,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete a(this,B,"f").getDescriptions()[e]}[co](e,t,n){a(this,xn,"f")[n]||(a(this,L,"f").process.emitWarning(e,t),a(this,xn,"f")[n]=!0)}[fo](){a(this,Cn,"f").push({options:a(this,$,"f"),configObjects:a(this,$,"f").configObjects.slice(0),exitProcess:a(this,Se,"f"),groups:a(this,Ue,"f"),strict:a(this,lt,"f"),strictCommands:a(this,ht,"f"),strictOptions:a(this,ut,"f"),completionCommand:a(this,ye,"f"),output:a(this,ue,"f"),exitError:a(this,Je,"f"),hasOutput:a(this,xe,"f"),parsed:this.parsed,parseFn:a(this,Ce,"f"),parseContext:a(this,ct,"f")}),a(this,B,"f").freeze(),a(this,oe,"f").freeze(),a(this,ce,"f").freeze(),a(this,_e,"f").freeze()}[lo](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(a(this,L,"f").process.argv()[0])?t=a(this,L,"f").process.argv().slice(1,2):t=a(this,L,"f").process.argv().slice(0,1),e=t.map(n=>{let s=this[Oo](a(this,ot,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<n.length?s:n}).join(" ").trim(),a(this,L,"f").getEnv("_")&&a(this,L,"f").getProcessArgvBin()===a(this,L,"f").getEnv("_")&&(e=a(this,L,"f").getEnv("_").replace(`${a(this,L,"f").path.dirname(a(this,L,"f").process.execPath())}/`,"")),e}[dt](){return a(this,On,"f")}[ho](){return a(this,Sn,"f")}[Zr](){if(!a(this,at,"f"))return;let e=a(this,L,"f").getEnv("LC_ALL")||a(this,L,"f").getEnv("LC_MESSAGES")||a(this,L,"f").getEnv("LANG")||a(this,L,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[uo](){return this[kr]().version||"unknown"}[po](e){let t=e["--"]?e["--"]:e._;for(let n=0,s;(s=t[n])!==void 0;n++)a(this,L,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(t[n]=Number(s));return e}[kr](e){let t=e||"*";if(a(this,Dt,"f")[t])return a(this,Dt,"f")[t];let n={};try{let s=e||a(this,L,"f").mainFilename;!e&&a(this,L,"f").path.extname(s)&&(s=a(this,L,"f").path.dirname(s));let i=a(this,L,"f").findUp(s,(o,c)=>{if(c.includes("package.json"))return"package.json"});me(i,void 0,a(this,L,"f")),n=JSON.parse(a(this,L,"f").readFileSync(i,"utf8"))}catch{}return a(this,Dt,"f")[t]=n||{},a(this,Dt,"f")[t]}[Xe](e,t){t=[].concat(t),t.forEach(n=>{n=this[ns](n),a(this,$,"f")[e].push(n)})}[Ut](e,t,n,s){this[ts](e,t,n,s,(i,o,c)=>{a(this,$,"f")[i][o]=c})}[es](e,t,n,s){this[ts](e,t,n,s,(i,o,c)=>{a(this,$,"f")[i][o]=(a(this,$,"f")[i][o]||[]).concat(c)})}[ts](e,t,n,s,i){if(Array.isArray(n))n.forEach(o=>{e(o,s)});else if((o=>typeof o=="object")(n))for(let o of Mt(n))e(o,n[o]);else i(t,this[ns](n),s)}[ns](e){return e==="__proto__"?"___proto___":e}[rs](e,t){return this[Ut](this[rs].bind(this),"key",e,t),this}[ss](){var e,t,n,s,i,o,c,l,b,h,d,g;let x=a(this,Cn,"f").pop();me(x,void 0,a(this,L,"f"));let w;e=this,t=this,n=this,s=this,i=this,o=this,c=this,l=this,b=this,h=this,d=this,g=this,{options:{set value(C){S(e,$,C,"f")}}.value,configObjects:w,exitProcess:{set value(C){S(t,Se,C,"f")}}.value,groups:{set value(C){S(n,Ue,C,"f")}}.value,output:{set value(C){S(s,ue,C,"f")}}.value,exitError:{set value(C){S(i,Je,C,"f")}}.value,hasOutput:{set value(C){S(o,xe,C,"f")}}.value,parsed:this.parsed,strict:{set value(C){S(c,lt,C,"f")}}.value,strictCommands:{set value(C){S(l,ht,C,"f")}}.value,strictOptions:{set value(C){S(b,ut,C,"f")}}.value,completionCommand:{set value(C){S(h,ye,C,"f")}}.value,parseFn:{set value(C){S(d,Ce,C,"f")}}.value,parseContext:{set value(C){S(g,ct,C,"f")}}.value}=x,a(this,$,"f").configObjects=w,a(this,B,"f").unfreeze(),a(this,oe,"f").unfreeze(),a(this,ce,"f").unfreeze(),a(this,_e,"f").unfreeze()}[mo](e,t){return it(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[go].bind(this),getContext:this[bo].bind(this),getHasOutput:this[wo].bind(this),getLoggerInstance:this[yo].bind(this),getParseContext:this[xo].bind(this),getParserConfiguration:this[dt].bind(this),getUsageConfiguration:this[ho].bind(this),getUsageInstance:this[Co].bind(this),getValidationInstance:this[Ao].bind(this),hasParseCallback:this[_n].bind(this),isGlobalContext:this[Eo].bind(this),postProcess:this[pt].bind(this),reset:this[is].bind(this),runValidation:this[os].bind(this),runYargsParserAndExecuteCommands:this[Kt].bind(this),setHasOutput:this[vo].bind(this)}}[go](){return a(this,ce,"f")}[bo](){return a(this,Yt,"f")}[wo](){return a(this,xe,"f")}[yo](){return a(this,$t,"f")}[xo](){return a(this,ct,"f")||{}}[Co](){return a(this,B,"f")}[Ao](){return a(this,oe,"f")}[_n](){return!!a(this,Ce,"f")}[Eo](){return a(this,An,"f")}[pt](e,t,n,s){return n||k(e)||(t||(e=this[oo](e)),(this[dt]()["parse-positional-numbers"]||this[dt]()["parse-positional-numbers"]===void 0)&&(e=this[po](e)),s&&(e=st(e,this,a(this,_e,"f").getMiddleware(),!1))),e}[is](e={}){S(this,$,a(this,$,"f")||{},"f");let t={};t.local=a(this,$,"f").local||[],t.configObjects=a(this,$,"f").configObjects||[];let n={};t.local.forEach(o=>{n[o]=!0,(e[o]||[]).forEach(c=>{n[c]=!0})}),Object.assign(a(this,ft,"f"),Object.keys(a(this,Ue,"f")).reduce((o,c)=>{let l=a(this,Ue,"f")[c].filter(b=>!(b in n));return l.length>0&&(o[c]=l),o},{})),S(this,Ue,{},"f");let s=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],i=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return s.forEach(o=>{t[o]=(a(this,$,"f")[o]||[]).filter(c=>!n[c])}),i.forEach(o=>{t[o]=Ye(a(this,$,"f")[o],c=>!n[c])}),t.envPrefix=a(this,$,"f").envPrefix,S(this,$,t,"f"),S(this,B,a(this,B,"f")?a(this,B,"f").reset(n):Zi(this,a(this,L,"f")),"f"),S(this,oe,a(this,oe,"f")?a(this,oe,"f").reset(n):so(this,a(this,B,"f"),a(this,L,"f")),"f"),S(this,ce,a(this,ce,"f")?a(this,ce,"f").reset():Ji(a(this,B,"f"),a(this,oe,"f"),a(this,_e,"f"),a(this,L,"f")),"f"),a(this,ve,"f")||S(this,ve,to(this,a(this,B,"f"),a(this,ce,"f"),a(this,L,"f")),"f"),a(this,_e,"f").reset(),S(this,ye,null,"f"),S(this,ue,"","f"),S(this,Je,null,"f"),S(this,xe,!1,"f"),this.parsed=!1,this}[Oo](e,t){return a(this,L,"f").path.relative(e,t)}[Kt](e,t,n,s=0,i=!1){let o=!!n||i;e=e||a(this,Qe,"f"),a(this,$,"f").__=a(this,L,"f").y18n.__,a(this,$,"f").configuration=this[dt]();let c=!!a(this,$,"f").configuration["populate--"],l=Object.assign({},a(this,$,"f").configuration,{"populate--":!0}),b=a(this,L,"f").Parser.detailed(e,Object.assign({},a(this,$,"f"),{configuration:{"parse-positional-numbers":!1,...l}})),h=Object.assign(b.argv,a(this,ct,"f")),d,g=b.aliases,x=!1,w=!1;Object.keys(h).forEach(C=>{C===a(this,Ie,"f")&&h[C]?x=!0:C===a(this,ze,"f")&&h[C]&&(w=!0)}),h.$0=this.$0,this.parsed=b,s===0&&a(this,B,"f").clearCachedHelpMessage();try{if(this[Zr](),t)return this[pt](h,c,!!n,!1);a(this,Ie,"f")&&[a(this,Ie,"f")].concat(g[a(this,Ie,"f")]||[]).filter(U=>U.length>1).includes(""+h._[h._.length-1])&&(h._.pop(),x=!0),S(this,An,!1,"f");let C=a(this,ce,"f").getCommands(),m=a(this,ve,"f").completionKey in h,_=x||m||i;if(h._.length){if(C.length){let j;for(let U=s||0,M;h._[U]!==void 0;U++)if(M=String(h._[U]),C.includes(M)&&M!==a(this,ye,"f")){let T=a(this,ce,"f").runCommand(M,this,b,U+1,i,x||w||i);return this[pt](T,c,!!n,!1)}else if(!j&&M!==a(this,ye,"f")){j=M;break}!a(this,ce,"f").hasDefaultCommand()&&a(this,vn,"f")&&j&&!_&&a(this,oe,"f").recommendCommands(j,C)}a(this,ye,"f")&&h._.includes(a(this,ye,"f"))&&!m&&(a(this,Se,"f")&&Ke(!0),this.showCompletionScript(),this.exit(0))}if(a(this,ce,"f").hasDefaultCommand()&&!_){let j=a(this,ce,"f").runCommand(null,this,b,0,i,x||w||i);return this[pt](j,c,!!n,!1)}if(m){a(this,Se,"f")&&Ke(!0),e=[].concat(e);let j=e.slice(e.indexOf(`--${a(this,ve,"f").completionKey}`)+1);return a(this,ve,"f").getCompletion(j,(U,M)=>{if(U)throw new Z(U.message);(M||[]).forEach(T=>{a(this,$t,"f").log(T)}),this.exit(0)}),this[pt](h,!c,!!n,!1)}if(a(this,xe,"f")||(x?(a(this,Se,"f")&&Ke(!0),o=!0,this.showHelp("log"),this.exit(0)):w&&(a(this,Se,"f")&&Ke(!0),o=!0,a(this,B,"f").showVersion("log"),this.exit(0))),!o&&a(this,$,"f").skipValidation.length>0&&(o=Object.keys(h).some(j=>a(this,$,"f").skipValidation.indexOf(j)>=0&&h[j]===!0)),!o){if(b.error)throw new Z(b.error.message);if(!m){let j=this[os](g,{},b.error);n||(d=st(h,this,a(this,_e,"f").getMiddleware(),!0)),d=this[mo](j,d??h),k(d)&&!n&&(d=d.then(()=>st(h,this,a(this,_e,"f").getMiddleware(),!1)))}}}catch(C){if(C instanceof Z)a(this,B,"f").fail(C.message,C);else throw C}return this[pt](d??h,c,!!n,!0)}[os](e,t,n,s){let i={...this.getDemandedOptions()};return o=>{if(n)throw new Z(n.message);a(this,oe,"f").nonOptionCount(o),a(this,oe,"f").requiredArguments(o,i);let c=!1;a(this,ht,"f")&&(c=a(this,oe,"f").unknownCommands(o)),a(this,lt,"f")&&!c?a(this,oe,"f").unknownArguments(o,e,t,!!s):a(this,ut,"f")&&a(this,oe,"f").unknownArguments(o,e,{},!1,!1),a(this,oe,"f").limitedChoices(o),a(this,oe,"f").implications(o),a(this,oe,"f").conflicting(o)}}[vo](){S(this,xe,!0,"f")}[mt](e){if(typeof e=="string")a(this,$,"f").key[e]=!0;else for(let t of e)a(this,$,"f").key[t]=!0}};function Qi(r){return!!r&&typeof r.getInternalMethods=="function"}var ul=So(qi),_o=ul;var Mo=et(Po(),1),ml={},dl=process.argv.slice(2),jo=new Mo.default(_o),fs=console.log;async function ls(r){jo.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((s,i,o)=>{if(i!=null)throw i;dl.length>0&&fs(s),o.showHelp()});let{data:e,argv:t}=await jo.parse(r);e!=null&&(fs(e),process.exit(0)),await(await No(Nr(t.listen),t)).start(),t.quiet!==!0&&fs("daemon has started")}async function No(r,e){throw new Error("Not implemented yet")}zr(ml)&&ls(process.argv).catch(r=>{console.error(r),process.exit(1)});return Fo(pl);})();
67
67
  /*! Bundled license information:
68
68
 
69
69
  yargs-parser/build/lib/string-utils.js:
@@ -1,6 +1,6 @@
1
1
  #! /usr/bin/env node
2
- import type { Multiaddr } from '@multiformats/multiaddr';
3
2
  import type { Libp2pServer } from '@libp2p/daemon-server';
3
+ import type { Multiaddr } from '@multiformats/multiaddr';
4
4
  export default function main(processArgs: string[]): Promise<void>;
5
5
  export declare function createLibp2pServer(listenAddr: Multiaddr, argv: any): Promise<Libp2pServer>;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAKxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAQzD,wBAA8B,IAAI,CAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0GxE;AAED,wBAAsB,kBAAkB,CAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,CAKjG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAOxD,wBAA8B,IAAI,CAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0GxE;AAED,wBAAsB,kBAAkB,CAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,CAKjG"}
package/dist/src/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #! /usr/bin/env node
2
2
  /* eslint no-console: ["error", { allow: ["log", "warn", "error"] }] */
3
3
  import { multiaddr } from '@multiformats/multiaddr';
4
+ import esMain from 'es-main';
4
5
  import yargs from 'yargs';
5
6
  // @ts-expect-error no types
6
7
  import YargsPromise from 'yargs-promise';
7
- import esMain from 'es-main';
8
8
  const args = process.argv.slice(2);
9
9
  const parser = new YargsPromise(yargs);
10
10
  const log = console.log;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA,uEAAuE;AAGvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,4BAA4B;AAC5B,OAAO,YAAY,MAAM,eAAe,CAAA;AAExC,OAAO,MAAM,MAAM,SAAS,CAAA;AAE5B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAClC,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,CAAA;AAEtC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;AAEvB,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,IAAI,CAAE,WAAqB;IACvD,MAAM,CAAC,KAAK;SACT,MAAM,CAAC,QAAQ,EAAE;QAChB,IAAI,EAAE,iCAAiC;QACvC,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,qBAAqB;KAC/B,CAAC;SACD,MAAM,CAAC,OAAO,EAAE;QACf,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,IAAI,EAAE;QACZ,IAAI,EAAE,iCAAiC;QACvC,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;KACZ,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,IAAI,EAAE,8DAA8D;QACpE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;KACZ,CAAC;SACD,MAAM,CAAC,eAAe,EAAE;QACvB,IAAI,EAAE,4EAA4E;QAClF,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;KACZ,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,+DAA+D;QACrE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,gBAAgB,EAAE;QACxB,IAAI,EAAE,yEAAyE;QAC/E,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;KACZ,CAAC;SACD,MAAM,CAAC,KAAK,EAAE;QACb,IAAI,EAAE,mCAAmC;QACzC,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,IAAI,EAAE,oDAAoD;QAC1D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,KAAK,EAAE;QACb,IAAI,EAAE,gCAAgC;QACtC,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QACjB,IAAI,EAAE,oDAAoD;QAC1D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,IAAI,EAAE,0GAA0G;QAChH,IAAI,EAAE,QAAQ;KACf,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,IAAI,EAAE,8HAA8H;QACpI,IAAI,EAAE,QAAQ;KACf,CAAC;SACD,MAAM,CAAC,QAAQ,EAAE;QAChB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,cAAc,EAAE;QACtB,IAAI,EAAE,4CAA4C;QAClD,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,WAAW;KACrB,CAAC;SACD,IAAI,CAAC,CAAC,GAAW,EAAE,GAAsB,EAAE,KAAW,EAAE,EAAE;QACzD,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,MAAM,GAAG,CAAA,CAAC,iBAAiB;SAC5B;QAED,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,2BAA2B;YAC3B,GAAG,CAAC,GAAG,CAAC,CAAA;SACT;QAED,KAAK,CAAC,QAAQ,EAAE,CAAA;IAClB,CAAC,CAAC,CAAA;IAEJ,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IAEtD,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,oBAAoB;QACpB,2BAA2B;QAC3B,GAAG,CAAC,IAAI,CAAC,CAAA;QACT,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;IAED,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAA;IACrE,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IAEpB,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE;QACvB,2BAA2B;QAC3B,GAAG,CAAC,oBAAoB,CAAC,CAAA;KAC1B;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAE,UAAqB,EAAE,IAAS;IACxE,0CAA0C;IAC1C,oEAAoE;IAEpE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;AACxC,CAAC;AAED,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;IACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;SACf,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;CACL"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA,uEAAuE;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,4BAA4B;AAC5B,OAAO,YAAY,MAAM,eAAe,CAAA;AAIxC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAClC,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,CAAA;AAEtC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;AAEvB,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,IAAI,CAAE,WAAqB;IACvD,MAAM,CAAC,KAAK;SACT,MAAM,CAAC,QAAQ,EAAE;QAChB,IAAI,EAAE,iCAAiC;QACvC,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,qBAAqB;KAC/B,CAAC;SACD,MAAM,CAAC,OAAO,EAAE;QACf,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,IAAI,EAAE;QACZ,IAAI,EAAE,iCAAiC;QACvC,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;KACZ,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,IAAI,EAAE,8DAA8D;QACpE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;KACZ,CAAC;SACD,MAAM,CAAC,eAAe,EAAE;QACvB,IAAI,EAAE,4EAA4E;QAClF,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;KACZ,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,+DAA+D;QACrE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,gBAAgB,EAAE;QACxB,IAAI,EAAE,yEAAyE;QAC/E,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;KACZ,CAAC;SACD,MAAM,CAAC,KAAK,EAAE;QACb,IAAI,EAAE,mCAAmC;QACzC,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,IAAI,EAAE,oDAAoD;QAC1D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,KAAK,EAAE;QACb,IAAI,EAAE,gCAAgC;QACtC,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QACjB,IAAI,EAAE,oDAAoD;QAC1D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,IAAI,EAAE,0GAA0G;QAChH,IAAI,EAAE,QAAQ;KACf,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,IAAI,EAAE,8HAA8H;QACpI,IAAI,EAAE,QAAQ;KACf,CAAC;SACD,MAAM,CAAC,QAAQ,EAAE;QAChB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,cAAc,EAAE;QACtB,IAAI,EAAE,4CAA4C;QAClD,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,WAAW;KACrB,CAAC;SACD,IAAI,CAAC,CAAC,GAAW,EAAE,GAAsB,EAAE,KAAW,EAAE,EAAE;QACzD,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,MAAM,GAAG,CAAA,CAAC,iBAAiB;SAC5B;QAED,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,2BAA2B;YAC3B,GAAG,CAAC,GAAG,CAAC,CAAA;SACT;QAED,KAAK,CAAC,QAAQ,EAAE,CAAA;IAClB,CAAC,CAAC,CAAA;IAEJ,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IAEtD,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,oBAAoB;QACpB,2BAA2B;QAC3B,GAAG,CAAC,IAAI,CAAC,CAAA;QACT,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;IAED,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAA;IACrE,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IAEpB,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE;QACvB,2BAA2B;QAC3B,GAAG,CAAC,oBAAoB,CAAC,CAAA;KAC1B;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAE,UAAqB,EAAE,IAAS;IACxE,0CAA0C;IAC1C,oEAAoE;IAEpE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;AACxC,CAAC;AAED,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;IACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;SACf,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;CACL"}
@@ -0,0 +1,4 @@
1
+ {
2
+ "createLibp2pServer": "https://libp2p.github.io/js-libp2p-daemon/functions/_libp2p_daemon.createLibp2pServer.html",
3
+ "default": "https://libp2p.github.io/js-libp2p-daemon/functions/_libp2p_daemon.default.html"
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/daemon",
3
- "version": "2.0.9",
3
+ "version": "3.0.0",
4
4
  "description": "libp2p-daemon JavaScript implementation",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p-daemon/tree/master/packages/libp2p-daemon#readme",
@@ -14,10 +14,6 @@
14
14
  "keywords": [
15
15
  "libp2p"
16
16
  ],
17
- "engines": {
18
- "node": ">=16.0.0",
19
- "npm": ">=7.0.0"
20
- },
21
17
  "bin": {
22
18
  "jsp2pd": "dist/src/index.js"
23
19
  },
@@ -136,14 +132,14 @@
136
132
  "release": "aegir release"
137
133
  },
138
134
  "dependencies": {
139
- "@libp2p/daemon-server": "^5.0.0",
140
- "@multiformats/multiaddr": "^12.0.0",
135
+ "@libp2p/daemon-server": "^6.0.0",
136
+ "@multiformats/multiaddr": "^12.1.3",
141
137
  "es-main": "^1.0.2",
142
138
  "yargs": "^17.3.1",
143
139
  "yargs-promise": "^1.1.0"
144
140
  },
145
141
  "devDependencies": {
146
- "aegir": "^38.1.6",
147
- "sinon": "^15.0.1"
142
+ "aegir": "^40.0.1",
143
+ "sinon": "^15.1.2"
148
144
  }
149
145
  }
package/src/index.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  #! /usr/bin/env node
2
2
  /* eslint no-console: ["error", { allow: ["log", "warn", "error"] }] */
3
3
 
4
- import type { Multiaddr } from '@multiformats/multiaddr'
5
4
  import { multiaddr } from '@multiformats/multiaddr'
5
+ import esMain from 'es-main'
6
6
  import yargs from 'yargs'
7
7
  // @ts-expect-error no types
8
8
  import YargsPromise from 'yargs-promise'
9
9
  import type { Libp2pServer } from '@libp2p/daemon-server'
10
- import esMain from 'es-main'
10
+ import type { Multiaddr } from '@multiformats/multiaddr'
11
11
 
12
12
  const args = process.argv.slice(2)
13
13
  const parser = new YargsPromise(yargs)