@libp2p/daemon 3.0.1 → 4.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/README.md +1 -1
- package/dist/index.min.js +15 -15
- package/dist/src/index.js.map +1 -1
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[](http://libp2p.io/)
|
|
2
2
|
[](https://discuss.libp2p.io)
|
|
3
3
|
[](https://codecov.io/gh/libp2p/js-libp2p-daemon)
|
|
4
|
-
[](https://github.com/libp2p/js-libp2p-daemon/actions/workflows/js-test-and-release.yml?query=branch%3Amain)
|
|
5
5
|
|
|
6
6
|
> libp2p-daemon JavaScript implementation
|
|
7
7
|
|
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 _i=Object.create;var Le=Object.defineProperty;var Si=Object.getOwnPropertyDescriptor;var Pi=Object.getOwnPropertyNames;var Ii=Object.getPrototypeOf,ji=Object.prototype.hasOwnProperty;var G=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var vi=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),bt=(r,t)=>{for(var e in t)Le(r,e,{get:t[e],enumerable:!0})},Mr=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pi(t))!ji.call(r,s)&&s!==e&&Le(r,s,{get:()=>t[s],enumerable:!(n=Si(t,s))||n.enumerable});return r};var Re=(r,t,e)=>(e=r!=null?_i(Ii(r)):{},Mr(t||!r||!r.__esModule?Le(e,"default",{value:r,enumerable:!0}):e,r)),Mi=r=>Mr(Le({},"__esModule",{value:!0}),r);var Oi=vi((Zh,xi)=>{var Ir=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,p,b){return n=p,c?p.reject(c):p.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})))}};xi.exports=Ir});var Ka={};bt(Ka,{createLibp2pServer:()=>Ei,default:()=>vr});var We=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var xn={};bt(xn,{base58btc:()=>mt,base58flickr:()=>Ti});function $i(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,p=r.charAt(0),b=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function u(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,m=0,$=0,N=x.length;$!==N&&x[$]===0;)$++,O++;for(var R=(N-$)*d+1>>>0,T=new Uint8Array(R);$!==N;){for(var W=x[$],ft=0,Z=R-1;(W!==0||ft<m)&&Z!==-1;Z--,ft++)W+=256*T[Z]>>>0,T[Z]=W%c>>>0,W=W/c>>>0;if(W!==0)throw new Error("Non-zero carry");m=ft,$++}for(var ht=R-m;ht!==R&&T[ht]===0;)ht++;for(var At=p.repeat(O);ht<R;++ht)At+=r.charAt(T[ht]);return At}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 m=0,$=0;x[O]===p;)m++,O++;for(var N=(x.length-O)*b+1>>>0,R=new Uint8Array(N);x[O];){var T=e[x.charCodeAt(O)];if(T===255)return;for(var W=0,ft=N-1;(T!==0||W<$)&&ft!==-1;ft--,W++)T+=c*R[ft]>>>0,R[ft]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");$=W,O++}if(x[O]!==" "){for(var Z=N-$;Z!==N&&R[Z]===0;)Z++;for(var ht=new Uint8Array(m+(N-Z)),At=m;Z!==N;)ht[At++]=R[Z++];return ht}}}function y(x){var O=g(x);if(O)return O;throw new Error(`Non-${t} character`)}return{encode:u,decodeUnsafe:g,decode:y}}var Fi=$i,Ni=Fi,$r=Ni;var ka=new Uint8Array(0);var Fr=(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},Ct=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 Nr=r=>new TextEncoder().encode(r),Ur=r=>new TextDecoder().decode(r);var gn=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")}},bn=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 Tr(this,t)}},wn=class{constructor(t){this.decoders=t}or(t){return Tr(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`)}},Tr=(r,t)=>new wn({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),yn=class{constructor(t,e,n,s){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=s,this.encoder=new gn(t,e,n),this.decoder=new bn(t,e,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},de=({name:r,prefix:t,encode:e,decode:n})=>new yn(r,t,e,n),Wt=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:s}=$r(e,t);return de({prefix:r,name:t,encode:n,decode:i=>Ct(s(i))})},Ui=(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,p=0,b=0;for(let d=0;d<i;++d){let u=s[r[d]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<e|u,c+=e,c>=8&&(c-=8,o[b++]=255&p>>c)}if(c>=e||255&p<<8-c)throw new SyntaxError("Unexpected end of data");return o},Di=(r,t,e)=>{let n=t[t.length-1]==="=",s=(1<<e)-1,i="",o=0,c=0;for(let p=0;p<r.length;++p)for(c=c<<8|r[p],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})=>de({prefix:t,name:r,encode(s){return Di(s,n,e)},decode(s){return Ui(s,n,e,r)}});var mt=Wt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ti=Wt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var On={};bt(On,{base32:()=>zt,base32hex:()=>Wi,base32hexpad:()=>Vi,base32hexpadupper:()=>Hi,base32hexupper:()=>Bi,base32pad:()=>Li,base32padupper:()=>Ri,base32upper:()=>zi,base32z:()=>qi});var zt=nt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),zi=nt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Li=nt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ri=nt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Wi=nt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Bi=nt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Vi=nt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Hi=nt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),qi=nt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Gi=Rr,zr=128,Yi=127,Ki=~Yi,Ji=Math.pow(2,31);function Rr(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Ji;)t[e++]=r&255|zr,r/=128;for(;r&Ki;)t[e++]=r&255|zr,r>>>=7;return t[e]=r|0,Rr.bytes=e-n+1,t}var Qi=An,Xi=128,Lr=127;function An(r,n){var e=0,n=n||0,s=0,i=n,o,c=r.length;do{if(i>=c)throw An.bytes=0,new RangeError("Could not decode varint");o=r[i++],e+=s<28?(o&Lr)<<s:(o&Lr)*Math.pow(2,s),s+=7}while(o>=Xi);return An.bytes=i-n,e}var Zi=Math.pow(2,7),ki=Math.pow(2,14),to=Math.pow(2,21),eo=Math.pow(2,28),no=Math.pow(2,35),ro=Math.pow(2,42),so=Math.pow(2,49),io=Math.pow(2,56),oo=Math.pow(2,63),ao=function(r){return r<Zi?1:r<ki?2:r<to?3:r<eo?4:r<no?5:r<ro?6:r<so?7:r<io?8:r<oo?9:10},co={encode:Gi,decode:Qi,encodingLength:ao},lo=co,je=lo;var ve=(r,t=0)=>[je.decode(r,t),je.decode.bytes],pe=(r,t,e=0)=>(je.encode(r,t,e),t),me=r=>je.encodingLength(r);var Zt=(r,t)=>{let e=t.byteLength,n=me(r),s=n+me(e),i=new Uint8Array(s+e);return pe(r,i,0),pe(e,i,n),i.set(t,s),new ge(r,e,t,i)},Ve=r=>{let t=Ct(r),[e,n]=ve(t),[s,i]=ve(t.subarray(n)),o=t.subarray(n+i);if(o.byteLength!==s)throw new Error("Incorrect length");return new ge(e,s,o,t)},Wr=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Fr(r.bytes,e.bytes)}},ge=class{constructor(t,e,n,s){this.code=t,this.size=e,this.digest=n,this.bytes=s}};var Br=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return ho(e,Cn(r),t||mt.encoder);default:return uo(e,Cn(r),t||zt.encoder)}};var Vr=new WeakMap,Cn=r=>{let t=Vr.get(r);if(t==null){let e=new Map;return Vr.set(r,e),e}return t},Bt=class r{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!==Me)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==po)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=Zt(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Wr(t.multihash,n.multihash)}toString(t){return Br(this,t)}toJSON(){return{"/":Br(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 r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:s,multihash:i,bytes:o}=e;return new r(n,s,i,o||Hr(n,s,i.bytes))}else if(e[mo]===!0){let{version:n,multihash:s,code:i}=e,o=Ve(s);return r.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!==Me)throw new Error(`Version 0 CID must use dag-pb (code: ${Me}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let s=Hr(t,e,n.bytes);return new r(t,e,n,s)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Me,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,s=Ct(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 ge(e.multihashCode,e.digestSize,i,s);return[e.version===0?r.createV0(o):r.createV1(e.codec,o),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[u,g]=ve(t.subarray(e));return e+=g,u},s=n(),i=Me;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(),p=n(),b=e+p,d=b-o;return{version:s,codec:i,multihashCode:c,digestSize:p,multihashSize:d,size:b}}static parse(t,e){let[n,s]=fo(t,e),i=r.decode(s);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Cn(i).set(n,t),i}},fo=(r,t)=>{switch(r[0]){case"Q":{let e=t||mt;return[mt.prefix,e.decode(`${mt.prefix}${r}`)]}case mt.prefix:{let e=t||mt;return[mt.prefix,e.decode(r)]}case zt.prefix:{let e=t||zt;return[zt.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)]}}},ho=(r,t,e)=>{let{prefix:n}=e;if(n!==mt.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},uo=(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},Me=112,po=18,Hr=(r,t,e)=>{let n=me(r),s=n+me(t),i=new Uint8Array(s+e.byteLength);return pe(r,i,0),pe(t,i,n),i.set(e,s),i},mo=Symbol.for("@ipld/js-cid/CID");function qr(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 En={};bt(En,{base10:()=>go});var go=Wt({prefix:"9",name:"base10",alphabet:"0123456789"});var _n={};bt(_n,{base16:()=>bo,base16upper:()=>wo});var bo=nt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),wo=nt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Sn={};bt(Sn,{base2:()=>yo});var yo=nt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Pn={};bt(Pn,{base256emoji:()=>Eo});var Gr=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}"),xo=Gr.reduce((r,t,e)=>(r[e]=t,r),[]),Oo=Gr.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Ao(r){return r.reduce((t,e)=>(t+=xo[e],t),"")}function Co(r){let t=[];for(let e of r){let n=Oo[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var Eo=de({prefix:"\u{1F680}",name:"base256emoji",encode:Ao,decode:Co});var In={};bt(In,{base36:()=>_o,base36upper:()=>So});var _o=Wt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),So=Wt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var jn={};bt(jn,{base64:()=>Po,base64pad:()=>Io,base64url:()=>jo,base64urlpad:()=>vo});var Po=nt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Io=nt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),jo=nt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),vo=nt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var vn={};bt(vn,{base8:()=>Mo});var Mo=nt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Mn={};bt(Mn,{identity:()=>$o});var $o=de({prefix:"\0",name:"identity",encode:r=>Ur(r),decode:r=>Nr(r)});var Cc=new TextEncoder,Ec=new TextDecoder;var $n={};bt($n,{identity:()=>To});var Yr=0,Uo="identity",Kr=Ct,Do=r=>Zt(Yr,Kr(r)),To={code:Yr,name:Uo,encode:Kr,digest:Do};var Dn={};bt(Dn,{sha256:()=>zo,sha512:()=>Lo});var Un=Re(G("crypto"),1);var Nn=({name:r,code:t,encode:e})=>new Fn(r,t,e),Fn=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?Zt(this.code,e):e.then(n=>Zt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var zo=Nn({name:"sha2-256",code:18,encode:r=>Ct(Un.default.createHash("sha256").update(r).digest())}),Lo=Nn({name:"sha2-512",code:19,encode:r=>Ct(Un.default.createHash("sha512").update(r).digest())});var $e={...Mn,...Sn,...vn,...En,..._n,...On,...In,...xn,...jn,...Pn},Fc={...Dn,...$n};function we(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function ye(r=0){return globalThis.Buffer?.allocUnsafe!=null?we(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Xr(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Qr=Xr("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Tn=Xr("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=ye(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Ro={utf8:Qr,"utf-8":Qr,hex:$e.base16,latin1:Tn,ascii:Tn,binary:Tn,...$e},He=Ro;function gt(r,t="utf8"){let e=He[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 Wo=Math.pow(2,7),Bo=Math.pow(2,14),Vo=Math.pow(2,21),zn=Math.pow(2,28),Ln=Math.pow(2,35),Rn=Math.pow(2,42),Wn=Math.pow(2,49),q=128,ut=127;function Ft(r){if(r<Wo)return 1;if(r<Bo)return 2;if(r<Vo)return 3;if(r<zn)return 4;if(r<Ln)return 5;if(r<Rn)return 6;if(r<Wn)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Ho(r,t,e=0){switch(Ft(r)){case 8:t[e++]=r&255|q,r/=128;case 7:t[e++]=r&255|q,r/=128;case 6:t[e++]=r&255|q,r/=128;case 5:t[e++]=r&255|q,r/=128;case 4:t[e++]=r&255|q,r>>>=7;case 3:t[e++]=r&255|q,r>>>=7;case 2:t[e++]=r&255|q,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function qo(r,t,e=0){switch(Ft(r)){case 8:t.set(e++,r&255|q),r/=128;case 7:t.set(e++,r&255|q),r/=128;case 6:t.set(e++,r&255|q),r/=128;case 5:t.set(e++,r&255|q),r/=128;case 4:t.set(e++,r&255|q),r>>>=7;case 3:t.set(e++,r&255|q),r>>>=7;case 2:t.set(e++,r&255|q),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function Go(r,t){let e=r[t],n=0;if(n+=e&ut,e<q||(e=r[t+1],n+=(e&ut)<<7,e<q)||(e=r[t+2],n+=(e&ut)<<14,e<q)||(e=r[t+3],n+=(e&ut)<<21,e<q)||(e=r[t+4],n+=(e&ut)*zn,e<q)||(e=r[t+5],n+=(e&ut)*Ln,e<q)||(e=r[t+6],n+=(e&ut)*Rn,e<q)||(e=r[t+7],n+=(e&ut)*Wn,e<q))return n;throw new RangeError("Could not decode varint")}function Yo(r,t){let e=r.get(t),n=0;if(n+=e&ut,e<q||(e=r.get(t+1),n+=(e&ut)<<7,e<q)||(e=r.get(t+2),n+=(e&ut)<<14,e<q)||(e=r.get(t+3),n+=(e&ut)<<21,e<q)||(e=r.get(t+4),n+=(e&ut)*zn,e<q)||(e=r.get(t+5),n+=(e&ut)*Ln,e<q)||(e=r.get(t+6),n+=(e&ut)*Rn,e<q)||(e=r.get(t+7),n+=(e&ut)*Wn,e<q))return n;throw new RangeError("Could not decode varint")}function xe(r,t,e=0){return t==null&&(t=ye(Ft(r))),t instanceof Uint8Array?Ho(r,t,e):qo(r,t,e)}function kt(r,t=0){return r instanceof Uint8Array?Go(r,t):Yo(r,t)}function Lt(r,t){t==null&&(t=r.reduce((s,i)=>s+i.length,0));let e=ye(t),n=0;for(let s of r)e.set(s,n),n+=s.length;return we(e)}var qe=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 p=c==="0",b=2**(8*s)-1;for(;;){let d=this.readAtomically(()=>{let u=this.readChar();if(u===void 0)return;let g=Number.parseInt(u,t);if(!Number.isNaN(g))return g});if(d===void 0)break;if(i*=t,i+=d,i>b||(o+=1,e!==void 0&&o>e))return}if(o!==0)return!n&&p&&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 Jc=new qe;var rl=parseInt("0xFFFF",16),sl=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Bn(r,t="utf8"){let e=He[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?we(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var Vt=G("node:net");function Ge(r){return!!(0,Vt.isIP)(r)}var es=Vt.isIPv4,ko=Vt.isIPv6,Vn=function(r){let t=0;if(r=r.toString().trim(),es(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(ko(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let i=es(e[n]),o;i&&(o=Vn(e[n]),e[n]=gt(o.slice(0,2),"base16")),o!=null&&++n<8&&e.splice(n,0,gt(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")},ns=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 Oe={},Hn={},ea=[[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"]];ea.forEach(r=>{let t=na(...r);Hn[t.code]=t,Oe[t.name]=t});function na(r,t,e,n,s){return{code:r,size:t,name:e,resolvable:!!n,path:!!s}}function K(r){if(typeof r=="number"){if(Hn[r]!=null)return Hn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Oe[r]!=null)return Oe[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var ql=K("ip4"),Gl=K("ip6"),Yl=K("ipcidr");function Gn(r,t){switch(K(r).code){case 4:case 41:return sa(t);case 42:return is(t);case 6:case 273:case 33:case 132:return as(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return is(t);case 421:return ca(t);case 444:return os(t);case 445:return os(t);case 466:return aa(t);default:return gt(t,"base16")}}function Yn(r,t){switch(K(r).code){case 4:return rs(t);case 41:return rs(t);case 42:return ss(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 ss(t);case 421:return ia(t);case 444:return la(t);case 445:return fa(t);case 466:return oa(t);default:return Bn(t,"base16")}}var qn=Object.values($e).map(r=>r.decoder),ra=function(){let r=qn[0].or(qn[1]);return qn.slice(2).forEach(t=>r=r.or(t)),r}();function rs(r){if(!Ge(r))throw new Error("invalid ip address");return Vn(r)}function sa(r){let t=ns(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!Ge(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 as(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function ss(r){let t=Bn(r),e=Uint8Array.from(xe(t.length));return Lt([e,t],e.length+t.length)}function is(r){let t=kt(r);if(r=r.slice(Ft(t)),r.length!==t)throw new Error("inconsistent lengths");return gt(r)}function ia(r){let t;r[0]==="Q"||r[0]==="1"?t=Ve(mt.decode(`z${r}`)).bytes:t=Bt.parse(r).multihash.bytes;let e=Uint8Array.from(xe(t.length));return Lt([e,t],e.length+t.length)}function oa(r){let t=ra.decode(r),e=Uint8Array.from(xe(t.length));return Lt([e,t],e.length+t.length)}function aa(r){let t=kt(r),e=r.slice(Ft(t));if(e.length!==t)throw new Error("inconsistent lengths");return"u"+gt(e,"base64url")}function ca(r){let t=kt(r),e=r.slice(Ft(t));if(e.length!==t)throw new Error("inconsistent lengths");return gt(e,"base58btc")}function la(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=zt.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 fa(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=zt.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 os(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=gt(t,"base32"),s=as(e);return`${n}:${s}`}function cs(r){r=Jn(r);let t=[],e=[],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=K(o);if(c.size===0){t.push([c.code]),e.push([c.code]);continue}if(i++,i>=s.length)throw fs("invalid address: "+r);if(c.path===!0){n=Jn(s.slice(i).join("/")),t.push([c.code,Yn(c.code,n)]),e.push([c.code,n]);break}let p=Yn(c.code,s[i]);t.push([c.code,p]),e.push([c.code,Gn(c.code,p)])}return{string:ls(e),bytes:Xn(t),tuples:t,stringTuples:e,path:n}}function Qn(r){let t=[],e=[],n=null,s=0;for(;s<r.length;){let i=kt(r,s),o=Ft(i),c=K(i),p=ha(c,r.slice(s+o));if(p===0){t.push([i]),e.push([i]),s+=o;continue}let b=r.slice(s+o,s+o+p);if(s+=p+o,s>r.length)throw fs("Invalid address Uint8Array: "+gt(r,"base16"));t.push([i,b]);let d=Gn(i,b);if(e.push([i,d]),c.path===!0){n=d;break}}return{bytes:Uint8Array.from(r),string:ls(e),tuples:t,stringTuples:e,path:n}}function ls(r){let t=[];return r.map(e=>{let n=K(e[0]);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),Jn(t.join("/"))}function Xn(r){return Lt(r.map(t=>{let e=K(t[0]),n=Uint8Array.from(xe(e.code));return t.length>1&&t[1]!=null&&(n=Lt([n,t[1]])),n}))}function ha(r,t){if(r.size>0)return r.size/8;if(r.size===0)return 0;{let e=kt(t instanceof Uint8Array?t:Uint8Array.from(t));return e+Ft(e)}}function Jn(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function fs(r){return new Error("Error parsing address: "+r)}var ua=Symbol.for("nodejs.util.inspect.custom"),da=[K("dns").code,K("dns4").code,K("dns6").code,K("dnsaddr").code],pa=new Map,hs=Symbol.for("@multiformats/js-multiaddr/multiaddr");function ma(r){return!!r?.[hs]}var kn=class r{bytes;#e;#t;#n;#r;[hs]=!0;constructor(t){t==null&&(t="");let e;if(t instanceof Uint8Array)e=Qn(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);e=cs(t)}else if(ma(t))e=Qn(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=e.bytes,this.#e=e.string,this.#t=e.tuples,this.#n=e.stringTuples,this.#r=e.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let t,e,n,s,i="",o=K("tcp"),c=K("udp"),p=K("ip4"),b=K("ip6"),d=K("dns6"),u=K("ip6zone");for(let[y,x]of this.stringTuples())y===u.code&&(i=`%${x??""}`),da.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===p.code||y===b.code)&&(e=K(y).name,n=`${x??""}${i}`,t=y===b.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.#t.map(([t])=>Object.assign({},K(t)))}protoCodes(){return this.#t.map(([t])=>t)}protoNames(){return this.#t.map(([t])=>K(t).name)}tuples(){return this.#t}stringTuples(){return this.#n}encapsulate(t){return t=new r(t),new r(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 r(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 r(Xn(e.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,s])=>{n===Oe.p2p.code&&t.push([n,s]),n===Oe["p2p-circuit"].code&&(t=[])});let e=t.pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?gt(mt.decode(`z${n}`),"base58btc"):gt(Bt.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#r}equals(t){return qr(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(i=>i.resolvable);if(e==null)return[this];let n=pa.get(e.name);if(n==null)throw new We(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(i=>new r(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)}[ua](){return`Multiaddr(${this.#e})`}};function Zn(r){return new kn(r)}var er=Re(G("path"),1),tr=Re(G("process"),1),us=G("module"),ds=G("url");function ga(r){let t=er.default.extname(r);return t?r.slice(0,-t.length):r}function nr(r){if(!r||!tr.default.argv[1])return!1;let e=(0,us.createRequire)(r.url).resolve(tr.default.argv[1]),n=(0,ds.fileURLToPath)(r.url);return er.default.extname(e)?n===e:ga(n)===e}var tn=G("assert");var ba={right:Aa,center:Ca},wa=0,Ye=1,ya=2,Ke=3,rr=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(`
|
|
3
|
+
"use strict";var Libp2PDaemon=(()=>{var Pi=Object.create;var Le=Object.defineProperty;var Ii=Object.getOwnPropertyDescriptor;var ji=Object.getOwnPropertyNames;var vi=Object.getPrototypeOf,Mi=Object.prototype.hasOwnProperty;var G=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var $i=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),bt=(r,t)=>{for(var e in t)Le(r,e,{get:t[e],enumerable:!0})},$r=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ji(t))!Mi.call(r,s)&&s!==e&&Le(r,s,{get:()=>t[s],enumerable:!(n=Ii(t,s))||n.enumerable});return r};var Re=(r,t,e)=>(e=r!=null?Pi(vi(r)):{},$r(t||!r||!r.__esModule?Le(e,"default",{value:r,enumerable:!0}):e,r)),Fi=r=>$r(Le({},"__esModule",{value:!0}),r);var Ai=$i((nu,Oi)=>{var jr=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,p,b){return n=p,c?p.reject(c):p.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})))}};Oi.exports=jr});var Ka={};bt(Ka,{createLibp2pServer:()=>Si,default:()=>Mr});var We=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var Cn={};bt(Cn,{base58btc:()=>mt,base58flickr:()=>Li});function Ni(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,p=r.charAt(0),b=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function u(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 C=0,m=0,$=0,N=x.length;$!==N&&x[$]===0;)$++,C++;for(var R=(N-$)*d+1>>>0,T=new Uint8Array(R);$!==N;){for(var W=x[$],ft=0,Z=R-1;(W!==0||ft<m)&&Z!==-1;Z--,ft++)W+=256*T[Z]>>>0,T[Z]=W%c>>>0,W=W/c>>>0;if(W!==0)throw new Error("Non-zero carry");m=ft,$++}for(var ht=R-m;ht!==R&&T[ht]===0;)ht++;for(var Ot=p.repeat(C);ht<R;++ht)Ot+=r.charAt(T[ht]);return Ot}function g(x){if(typeof x!="string")throw new TypeError("Expected String");if(x.length===0)return new Uint8Array;var C=0;if(x[C]!==" "){for(var m=0,$=0;x[C]===p;)m++,C++;for(var N=(x.length-C)*b+1>>>0,R=new Uint8Array(N);x[C];){var T=e[x.charCodeAt(C)];if(T===255)return;for(var W=0,ft=N-1;(T!==0||W<$)&&ft!==-1;ft--,W++)T+=c*R[ft]>>>0,R[ft]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");$=W,C++}if(x[C]!==" "){for(var Z=N-$;Z!==N&&R[Z]===0;)Z++;for(var ht=new Uint8Array(m+(N-Z)),Ot=m;Z!==N;)ht[Ot++]=R[Z++];return ht}}}function y(x){var C=g(x);if(C)return C;throw new Error(`Non-${t} character`)}return{encode:u,decodeUnsafe:g,decode:y}}var Ui=Ni,Di=Ui,Fr=Di;var ka=new Uint8Array(0);var Nr=(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 Ur=r=>new TextEncoder().encode(r),Dr=r=>new TextDecoder().decode(r);var bn=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")}},wn=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 zr(this,t)}},yn=class{constructor(t){this.decoders=t}or(t){return zr(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`)}},zr=(r,t)=>new yn({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),xn=class{constructor(t,e,n,s){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=s,this.encoder=new bn(t,e,n),this.decoder=new wn(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 xn(r,t,e,n),Wt=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:s}=Fr(e,t);return pe({prefix:r,name:t,encode:n,decode:i=>At(s(i))})},Ti=(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,p=0,b=0;for(let d=0;d<i;++d){let u=s[r[d]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<e|u,c+=e,c>=8&&(c-=8,o[b++]=255&p>>c)}if(c>=e||255&p<<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 p=0;p<r.length;++p)for(c=c<<8|r[p],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 Ti(s,n,e,r)}});var mt=Wt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Li=Wt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var On={};bt(On,{base32:()=>zt,base32hex:()=>Vi,base32hexpad:()=>qi,base32hexpadupper:()=>Gi,base32hexupper:()=>Hi,base32pad:()=>Wi,base32padupper:()=>Bi,base32upper:()=>Ri,base32z:()=>Yi});var zt=nt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ri=nt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Wi=nt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Bi=nt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Vi=nt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Hi=nt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),qi=nt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Gi=nt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Yi=nt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ki=Wr,Lr=128,Ji=127,Qi=~Ji,Xi=Math.pow(2,31);function Wr(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Xi;)t[e++]=r&255|Lr,r/=128;for(;r&Qi;)t[e++]=r&255|Lr,r>>>=7;return t[e]=r|0,Wr.bytes=e-n+1,t}var Zi=An,ki=128,Rr=127;function An(r,n){var e=0,n=n||0,s=0,i=n,o,c=r.length;do{if(i>=c)throw An.bytes=0,new RangeError("Could not decode varint");o=r[i++],e+=s<28?(o&Rr)<<s:(o&Rr)*Math.pow(2,s),s+=7}while(o>=ki);return An.bytes=i-n,e}var to=Math.pow(2,7),eo=Math.pow(2,14),no=Math.pow(2,21),ro=Math.pow(2,28),so=Math.pow(2,35),io=Math.pow(2,42),oo=Math.pow(2,49),ao=Math.pow(2,56),co=Math.pow(2,63),lo=function(r){return r<to?1:r<eo?2:r<no?3:r<ro?4:r<so?5:r<io?6:r<oo?7:r<ao?8:r<co?9:10},fo={encode:Ki,decode:Zi,encodingLength:lo},ho=fo,je=ho;var ve=(r,t=0)=>[je.decode(r,t),je.decode.bytes],me=(r,t,e=0)=>(je.encode(r,t,e),t),ge=r=>je.encodingLength(r);var Zt=(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)},Ve=r=>{let t=At(r),[e,n]=ve(t),[s,i]=ve(t.subarray(n)),o=t.subarray(n+i);if(o.byteLength!==s)throw new Error("Incorrect length");return new be(e,s,o,t)},Br=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Nr(r.bytes,e.bytes)}},be=class{constructor(t,e,n,s){this.code=t,this.size=e,this.digest=n,this.bytes=s}};var Vr=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return po(e,En(r),t||mt.encoder);default:return mo(e,En(r),t||zt.encoder)}};var Hr=new WeakMap,En=r=>{let t=Hr.get(r);if(t==null){let e=new Map;return Hr.set(r,e),e}return t},Bt=class r{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!==Me)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==go)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=Zt(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Br(t.multihash,n.multihash)}toString(t){return Vr(this,t)}toJSON(){return{"/":Vr(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 r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:s,multihash:i,bytes:o}=e;return new r(n,s,i,o||qr(n,s,i.bytes))}else if(e[bo]===!0){let{version:n,multihash:s,code:i}=e,o=Ve(s);return r.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!==Me)throw new Error(`Version 0 CID must use dag-pb (code: ${Me}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let s=qr(t,e,n.bytes);return new r(t,e,n,s)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Me,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.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?r.createV0(o):r.createV1(e.codec,o),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[u,g]=ve(t.subarray(e));return e+=g,u},s=n(),i=Me;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(),p=n(),b=e+p,d=b-o;return{version:s,codec:i,multihashCode:c,digestSize:p,multihashSize:d,size:b}}static parse(t,e){let[n,s]=uo(t,e),i=r.decode(s);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return En(i).set(n,t),i}},uo=(r,t)=>{switch(r[0]){case"Q":{let e=t||mt;return[mt.prefix,e.decode(`${mt.prefix}${r}`)]}case mt.prefix:{let e=t||mt;return[mt.prefix,e.decode(r)]}case zt.prefix:{let e=t||zt;return[zt.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)]}}},po=(r,t,e)=>{let{prefix:n}=e;if(n!==mt.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},mo=(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},Me=112,go=18,qr=(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},bo=Symbol.for("@ipld/js-cid/CID");function Gr(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 _n={};bt(_n,{base10:()=>wo});var wo=Wt({prefix:"9",name:"base10",alphabet:"0123456789"});var Sn={};bt(Sn,{base16:()=>yo,base16upper:()=>xo});var yo=nt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),xo=nt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Pn={};bt(Pn,{base2:()=>Co});var Co=nt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var In={};bt(In,{base256emoji:()=>So});var Yr=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=Yr.reduce((r,t,e)=>(r[e]=t,r),[]),Ao=Yr.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Eo(r){return r.reduce((t,e)=>(t+=Oo[e],t),"")}function _o(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 So=pe({prefix:"\u{1F680}",name:"base256emoji",encode:Eo,decode:_o});var jn={};bt(jn,{base36:()=>Po,base36upper:()=>Io});var Po=Wt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Io=Wt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var vn={};bt(vn,{base64:()=>jo,base64pad:()=>vo,base64url:()=>Mo,base64urlpad:()=>$o});var jo=nt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),vo=nt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Mo=nt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),$o=nt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Mn={};bt(Mn,{base8:()=>Fo});var Fo=nt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var $n={};bt($n,{identity:()=>No});var No=pe({prefix:"\0",name:"identity",encode:r=>Dr(r),decode:r=>Ur(r)});var Ac=new TextEncoder,Ec=new TextDecoder;var Fn={};bt(Fn,{identity:()=>Lo});var Kr=0,To="identity",Jr=At,zo=r=>Zt(Kr,Jr(r)),Lo={code:Kr,name:To,encode:Jr,digest:zo};var Tn={};bt(Tn,{sha256:()=>Ro,sha512:()=>Wo});var Dn=Re(G("crypto"),1);var Un=({name:r,code:t,encode:e})=>new Nn(r,t,e),Nn=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?Zt(this.code,e):e.then(n=>Zt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Ro=Un({name:"sha2-256",code:18,encode:r=>At(Dn.default.createHash("sha256").update(r).digest())}),Wo=Un({name:"sha2-512",code:19,encode:r=>At(Dn.default.createHash("sha512").update(r).digest())});var $e={...$n,...Pn,...Mn,..._n,...Sn,...On,...jn,...Cn,...vn,...In},Fc={...Tn,...Fn};function kt(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function ye(r=0){return globalThis.Buffer?.allocUnsafe!=null?kt(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Zr(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Xr=Zr("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),zn=Zr("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=ye(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Bo={utf8:Xr,"utf-8":Xr,hex:$e.base16,latin1:zn,ascii:zn,binary:zn,...$e},He=Bo;function gt(r,t="utf8"){let e=He[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 Vo=Math.pow(2,7),Ho=Math.pow(2,14),qo=Math.pow(2,21),Ln=Math.pow(2,28),Rn=Math.pow(2,35),Wn=Math.pow(2,42),Bn=Math.pow(2,49),q=128,ut=127;function Ft(r){if(r<Vo)return 1;if(r<Ho)return 2;if(r<qo)return 3;if(r<Ln)return 4;if(r<Rn)return 5;if(r<Wn)return 6;if(r<Bn)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Go(r,t,e=0){switch(Ft(r)){case 8:t[e++]=r&255|q,r/=128;case 7:t[e++]=r&255|q,r/=128;case 6:t[e++]=r&255|q,r/=128;case 5:t[e++]=r&255|q,r/=128;case 4:t[e++]=r&255|q,r>>>=7;case 3:t[e++]=r&255|q,r>>>=7;case 2:t[e++]=r&255|q,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Yo(r,t,e=0){switch(Ft(r)){case 8:t.set(e++,r&255|q),r/=128;case 7:t.set(e++,r&255|q),r/=128;case 6:t.set(e++,r&255|q),r/=128;case 5:t.set(e++,r&255|q),r/=128;case 4:t.set(e++,r&255|q),r>>>=7;case 3:t.set(e++,r&255|q),r>>>=7;case 2:t.set(e++,r&255|q),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function Ko(r,t){let e=r[t],n=0;if(n+=e&ut,e<q||(e=r[t+1],n+=(e&ut)<<7,e<q)||(e=r[t+2],n+=(e&ut)<<14,e<q)||(e=r[t+3],n+=(e&ut)<<21,e<q)||(e=r[t+4],n+=(e&ut)*Ln,e<q)||(e=r[t+5],n+=(e&ut)*Rn,e<q)||(e=r[t+6],n+=(e&ut)*Wn,e<q)||(e=r[t+7],n+=(e&ut)*Bn,e<q))return n;throw new RangeError("Could not decode varint")}function Jo(r,t){let e=r.get(t),n=0;if(n+=e&ut,e<q||(e=r.get(t+1),n+=(e&ut)<<7,e<q)||(e=r.get(t+2),n+=(e&ut)<<14,e<q)||(e=r.get(t+3),n+=(e&ut)<<21,e<q)||(e=r.get(t+4),n+=(e&ut)*Ln,e<q)||(e=r.get(t+5),n+=(e&ut)*Rn,e<q)||(e=r.get(t+6),n+=(e&ut)*Wn,e<q)||(e=r.get(t+7),n+=(e&ut)*Bn,e<q))return n;throw new RangeError("Could not decode varint")}function xe(r,t,e=0){return t==null&&(t=ye(Ft(r))),t instanceof Uint8Array?Go(r,t,e):Yo(r,t,e)}function te(r,t=0){return r instanceof Uint8Array?Ko(r,t):Jo(r,t)}function Lt(r,t){if(globalThis.Buffer!=null)return kt(globalThis.Buffer.concat(r,t));t==null&&(t=r.reduce((s,i)=>s+i.length,0));let e=ye(t),n=0;for(let s of r)e.set(s,n),n+=s.length;return kt(e)}var qe=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 p=c==="0",b=2**(8*s)-1;for(;;){let d=this.readAtomically(()=>{let u=this.readChar();if(u===void 0)return;let g=Number.parseInt(u,t);if(!Number.isNaN(g))return g});if(d===void 0)break;if(i*=t,i+=d,i>b||(o+=1,e!==void 0&&o>e))return}if(o!==0)return!n&&p&&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 Jc=new qe;var rl=parseInt("0xFFFF",16),sl=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Vn(r,t="utf8"){let e=He[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?kt(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var Vt=G("node:net");function Ge(r){return!!(0,Vt.isIP)(r)}var ns=Vt.isIPv4,ea=Vt.isIPv6,Hn=function(r){let t=0;if(r=r.toString().trim(),ns(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(ea(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let i=ns(e[n]),o;i&&(o=Hn(e[n]),e[n]=gt(o.slice(0,2),"base16")),o!=null&&++n<8&&e.splice(n,0,gt(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")},rs=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 Ce={},qn={},ra=[[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"]];ra.forEach(r=>{let t=sa(...r);qn[t.code]=t,Ce[t.name]=t});function sa(r,t,e,n,s){return{code:r,size:t,name:e,resolvable:!!n,path:!!s}}function K(r){if(typeof r=="number"){if(qn[r]!=null)return qn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ce[r]!=null)return Ce[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var ql=K("ip4"),Gl=K("ip6"),Yl=K("ipcidr");function Yn(r,t){switch(K(r).code){case 4:case 41:return oa(t);case 42:return os(t);case 6:case 273:case 33:case 132:return cs(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return os(t);case 421:return fa(t);case 444:return as(t);case 445:return as(t);case 466:return la(t);default:return gt(t,"base16")}}function Kn(r,t){switch(K(r).code){case 4:return ss(t);case 41:return ss(t);case 42:return is(t);case 6:case 273:case 33:case 132:return Jn(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return is(t);case 421:return aa(t);case 444:return ha(t);case 445:return ua(t);case 466:return ca(t);default:return Vn(t,"base16")}}var Gn=Object.values($e).map(r=>r.decoder),ia=function(){let r=Gn[0].or(Gn[1]);return Gn.slice(2).forEach(t=>r=r.or(t)),r}();function ss(r){if(!Ge(r))throw new Error("invalid ip address");return Hn(r)}function oa(r){let t=rs(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!Ge(t))throw new Error("invalid ip address");return t}function Jn(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function cs(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function is(r){let t=Vn(r),e=Uint8Array.from(xe(t.length));return Lt([e,t],e.length+t.length)}function os(r){let t=te(r);if(r=r.slice(Ft(t)),r.length!==t)throw new Error("inconsistent lengths");return gt(r)}function aa(r){let t;r[0]==="Q"||r[0]==="1"?t=Ve(mt.decode(`z${r}`)).bytes:t=Bt.parse(r).multihash.bytes;let e=Uint8Array.from(xe(t.length));return Lt([e,t],e.length+t.length)}function ca(r){let t=ia.decode(r),e=Uint8Array.from(xe(t.length));return Lt([e,t],e.length+t.length)}function la(r){let t=te(r),e=r.slice(Ft(t));if(e.length!==t)throw new Error("inconsistent lengths");return"u"+gt(e,"base64url")}function fa(r){let t=te(r),e=r.slice(Ft(t));if(e.length!==t)throw new Error("inconsistent lengths");return gt(e,"base58btc")}function ha(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=zt.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=Jn(n);return Lt([e,s],e.length+s.length)}function ua(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=zt.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=Jn(n);return Lt([e,s],e.length+s.length)}function as(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=gt(t,"base32"),s=cs(e);return`${n}:${s}`}function ls(r){r=Qn(r);let t=[],e=[],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=K(o);if(c.size===0){t.push([c.code]),e.push([c.code]);continue}if(i++,i>=s.length)throw hs("invalid address: "+r);if(c.path===!0){n=Qn(s.slice(i).join("/")),t.push([c.code,Kn(c.code,n)]),e.push([c.code,n]);break}let p=Kn(c.code,s[i]);t.push([c.code,p]),e.push([c.code,Yn(c.code,p)])}return{string:fs(e),bytes:Zn(t),tuples:t,stringTuples:e,path:n}}function Xn(r){let t=[],e=[],n=null,s=0;for(;s<r.length;){let i=te(r,s),o=Ft(i),c=K(i),p=da(c,r.slice(s+o));if(p===0){t.push([i]),e.push([i]),s+=o;continue}let b=r.slice(s+o,s+o+p);if(s+=p+o,s>r.length)throw hs("Invalid address Uint8Array: "+gt(r,"base16"));t.push([i,b]);let d=Yn(i,b);if(e.push([i,d]),c.path===!0){n=d;break}}return{bytes:Uint8Array.from(r),string:fs(e),tuples:t,stringTuples:e,path:n}}function fs(r){let t=[];return r.map(e=>{let n=K(e[0]);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),Qn(t.join("/"))}function Zn(r){return Lt(r.map(t=>{let e=K(t[0]),n=Uint8Array.from(xe(e.code));return t.length>1&&t[1]!=null&&(n=Lt([n,t[1]])),n}))}function da(r,t){if(r.size>0)return r.size/8;if(r.size===0)return 0;{let e=te(t instanceof Uint8Array?t:Uint8Array.from(t));return e+Ft(e)}}function Qn(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function hs(r){return new Error("Error parsing address: "+r)}var pa=Symbol.for("nodejs.util.inspect.custom"),kn=Symbol.for("@multiformats/js-multiaddr/multiaddr"),ma=[K("dns").code,K("dns4").code,K("dns6").code,K("dnsaddr").code],Ye=class r{bytes;#e;#t;#n;#r;[kn]=!0;constructor(t){t==null&&(t="");let e;if(t instanceof Uint8Array)e=Xn(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);e=ls(t)}else if(ds(t))e=Xn(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=e.bytes,this.#e=e.string,this.#t=e.tuples,this.#n=e.stringTuples,this.#r=e.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let t,e,n,s,i="",o=K("tcp"),c=K("udp"),p=K("ip4"),b=K("ip6"),d=K("dns6"),u=K("ip6zone");for(let[y,x]of this.stringTuples())y===u.code&&(i=`%${x??""}`),ma.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===p.code||y===b.code)&&(e=K(y).name,n=`${x??""}${i}`,t=y===b.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.#t.map(([t])=>Object.assign({},K(t)))}protoCodes(){return this.#t.map(([t])=>t)}protoNames(){return this.#t.map(([t])=>K(t).name)}tuples(){return this.#t}stringTuples(){return this.#n}encapsulate(t){return t=new r(t),new r(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 r(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 r(Zn(e.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,s])=>{n===Ce.p2p.code&&t.push([n,s]),n===Ce["p2p-circuit"].code&&(t=[])});let e=t.pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?gt(mt.decode(`z${n}`),"base58btc"):gt(Bt.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#r}equals(t){return Gr(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(i=>i.resolvable);if(e==null)return[this];let n=us.get(e.name);if(n==null)throw new We(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(i=>new r(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)}[pa](){return`Multiaddr(${this.#e})`}};var us=new Map;function ds(r){return!!r?.[kn]}function tr(r){return new Ye(r)}var nr=Re(G("path"),1),er=Re(G("process"),1),ps=G("module"),ms=G("url");function ga(r){let t=nr.default.extname(r);return t?r.slice(0,-t.length):r}function rr(r){if(!r||!er.default.argv[1])return!1;let e=(0,ps.createRequire)(r.url).resolve(er.default.argv[1]),n=(0,ms.fileURLToPath)(r.url);return nr.default.extname(e)?n===e:ga(n)===e}var en=G("assert");var ba={right:Oa,center:Aa},wa=0,Ke=1,ya=2,Je=3,sr=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
4
|
`).map(s=>s.split(" ")),n=0;return e.forEach(s=>{s.length>1&&wt.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),wt.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=wt.stripAnsi(t);return[0,e.match(/\s*$/)[0].length,0,e.match(/^\s*/)[0].length]}toString(){let t=[];return this.rows.forEach(e=>{this.rowToString(e,t)}),t.filter(e=>!e.hidden).map(e=>e.text).join(`
|
|
5
|
-
`)}rowToString(t,e){return this.rasterize(t).forEach((n,s)=>{let i="";n.forEach((o,c)=>{let{width:p}=t[c],b=this.negatePadding(t[c]),d=o;if(b>wt.stringWidth(o)&&(d+=" ".repeat(b-wt.stringWidth(o))),t[c].align&&t[c].align!=="left"&&this.wrap){let g=ba[t[c].align];d=g(d,b),wt.stringWidth(d)<b&&(d+=" ".repeat((p||0)-wt.stringWidth(d)-1))}let u=t[c].padding||[0,0,0,0];u[
|
|
5
|
+
`)}rowToString(t,e){return this.rasterize(t).forEach((n,s)=>{let i="";n.forEach((o,c)=>{let{width:p}=t[c],b=this.negatePadding(t[c]),d=o;if(b>wt.stringWidth(o)&&(d+=" ".repeat(b-wt.stringWidth(o))),t[c].align&&t[c].align!=="left"&&this.wrap){let g=ba[t[c].align];d=g(d,b),wt.stringWidth(d)<b&&(d+=" ".repeat((p||0)-wt.stringWidth(d)-1))}let u=t[c].padding||[0,0,0,0];u[Je]&&(i+=" ".repeat(u[Je])),i+=gs(t[c],d,"| "),i+=d,i+=gs(t[c],d," |"),u[Ke]&&(i+=" ".repeat(u[Ke])),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=wt.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=wt.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[wa]||0).fill("")),s.push(...new Array(i.padding[ya]||0).fill(""))),s.forEach((c,p)=>{e[p]||e.push([]);let b=e[p];for(let d=0;d<o;d++)b[d]===void 0&&b.push("");b.push(c)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[
|
|
8
|
-
`),s+=r.charAt(i);return e&&n&&(s=`${e}${s}${n}`),s}function ir(r){return ms(r,{stringWidth:t=>[...t].length,stripAnsi:sr,wrap:bs})}var Ae=G("path"),Je=G("fs");function ws(r,t){let e=(0,Ae.resolve)(".",r),n;for((0,Je.statSync)(e).isDirectory()||(e=(0,Ae.dirname)(e));;){if(n=t(e,(0,Je.readdirSync)(e)),n)return(0,Ae.resolve)(e,n);if(e=(0,Ae.dirname)(n=e),n===e)break}}var Ns=G("util"),Us=G("fs"),Ds=G("url");var Cs=G("util"),ke=G("path");function te(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 Qe(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 Xe(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 ys(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 Rt,Ze=class{constructor(t){Rt=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=ys(t),i=typeof t=="string",o=Ea(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),p=Object.assign(Object.create(null),n.default),b=n.configObjects||[],d=n.envPrefix,u=c["populate--"],g=u?"--":"_",y=Object.create(null),x=Object.create(null),O=n.__||Rt.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]+)$/,N=new RegExp("^--"+c["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let h=typeof l=="object"?l.key:l,A=Object.keys(l).map(function(w){return{boolean:"bools",string:"strings",number:"numbers"}[w]}).filter(Boolean).pop();A&&(m[A][h]=!0),m.arrays[h]=!0,m.keys.push(h)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(l){m.bools[l]=!0,m.keys.push(l)}),[].concat(n.string||[]).filter(Boolean).forEach(function(l){m.strings[l]=!0,m.keys.push(l)}),[].concat(n.number||[]).filter(Boolean).forEach(function(l){m.numbers[l]=!0,m.keys.push(l)}),[].concat(n.count||[]).filter(Boolean).forEach(function(l){m.counts[l]=!0,m.keys.push(l)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(l){m.normalize[l]=!0,m.keys.push(l)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([l,h])=>{typeof h=="number"&&(m.nargs[l]=h,m.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,h])=>{typeof h=="function"&&(m.coercions[l]=h,m.keys.push(l))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(l){m.configs[l]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([l,h])=>{(typeof h=="boolean"||typeof h=="function")&&(m.configs[l]=h)})),Xt(n.key,o,n.default,m.arrays),Object.keys(p).forEach(function(l){(m.aliases[l]||[]).forEach(function(h){p[h]=p[l]})});let R=null;ze();let T=[],W=Object.assign(Object.create(null),{_:[]}),ft={};for(let l=0;l<s.length;l++){let h=s[l],A=h.replace(/^-{3,}/,"---"),w,f,I,E,M,ct;if(h!=="--"&&/^-/.test(h)&&tt(h))Z(h);else if(A.match(/^---+(=|$)/)){Z(h);continue}else if(h.match(/^--.+=/)||!c["short-option-groups"]&&h.match(/^-.+=/))E=h.match(/^--?([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&(U(E[1],m.arrays)?l=At(l,E[1],s,E[2]):U(E[1],m.nargs)!==!1?l=ht(l,E[1],s,E[2]):Y(E[1],E[2],!0));else if(h.match(N)&&c["boolean-negation"])E=h.match(N),E!==null&&Array.isArray(E)&&E.length>=2&&(f=E[1],Y(f,U(f,m.arrays)?[!1]:!1));else if(h.match(/^--.+/)||!c["short-option-groups"]&&h.match(/^-[^-]+/))E=h.match(/^--?(.+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(f=E[1],U(f,m.arrays)?l=At(l,f,s):U(f,m.nargs)!==!1?l=ht(l,f,s):(M=s[l+1],M!==void 0&&(!M.match(/^-/)||M.match($))&&!U(f,m.bools)&&!U(f,m.counts)||/^(true|false)$/.test(M)?(Y(f,M),l++):Y(f,et(f))));else if(h.match(/^-.\..+=/))E=h.match(/^-([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&Y(E[1],E[2]);else if(h.match(/^-.\..+/)&&!h.match($))M=s[l+1],E=h.match(/^-(.\..+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(f=E[1],M!==void 0&&!M.match(/^-/)&&!U(f,m.bools)&&!U(f,m.counts)?(Y(f,M),l++):Y(f,et(f)));else if(h.match(/^-[^-]+/)&&!h.match($)){I=h.slice(1,-1).split(""),w=!1;for(let dt=0;dt<I.length;dt++){if(M=h.slice(dt+2),I[dt+1]&&I[dt+1]==="="){ct=h.slice(dt+3),f=I[dt],U(f,m.arrays)?l=At(l,f,s,ct):U(f,m.nargs)!==!1?l=ht(l,f,s,ct):Y(f,ct),w=!0;break}if(M==="-"){Y(I[dt],M);continue}if(/[A-Za-z]/.test(I[dt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(M)&&U(M,m.bools)===!1){Y(I[dt],M),w=!0;break}if(I[dt+1]&&I[dt+1].match(/\W/)){Y(I[dt],M),w=!0;break}else Y(I[dt],et(I[dt]))}f=h.slice(-1)[0],!w&&f!=="-"&&(U(f,m.arrays)?l=At(l,f,s):U(f,m.nargs)!==!1?l=ht(l,f,s):(M=s[l+1],M!==void 0&&(!/^(-|--)[^-]/.test(M)||M.match($))&&!U(f,m.bools)&&!U(f,m.counts)||/^(true|false)$/.test(M)?(Y(f,M),l++):Y(f,et(f))))}else if(h.match(/^-[0-9]$/)&&h.match($)&&U(h.slice(1),m.bools))f=h.slice(1),Y(f,et(f));else if(h==="--"){T=s.slice(l+1);break}else if(c["halt-at-non-option"]){T=s.slice(l);break}else Z(h)}V(W,!0),V(W,!1),L(W),ot(),k(W,m.aliases,p,!0),at(W),c["set-placeholder-key"]&&Qt(W),Object.keys(m.counts).forEach(function(l){Dt(W,l.split("."))||Y(l,0)}),u&&T.length&&(W[g]=[]),T.forEach(function(l){W[g].push(l)}),c["camel-case-expansion"]&&c["strip-dashed"]&&Object.keys(W).filter(l=>l!=="--"&&l.includes("-")).forEach(l=>{delete W[l]}),c["strip-aliased"]&&[].concat(...Object.keys(o).map(l=>o[l])).forEach(l=>{c["camel-case-expansion"]&&l.includes("-")&&delete W[l.split(".").map(h=>te(h)).join(".")],delete W[l]});function Z(l){let h=P("_",l);(typeof h=="string"||typeof h=="number")&&W._.push(h)}function ht(l,h,A,w){let f,I=U(h,m.nargs);if(I=typeof I!="number"||isNaN(I)?1:I,I===0)return vt(w)||(R=Error(O("Argument unexpected for: %s",h))),Y(h,et(h)),l;let E=vt(w)?0:1;if(c["nargs-eats-options"])A.length-(l+1)+E<I&&(R=Error(O("Not enough arguments following: %s",h))),E=I;else{for(f=l+1;f<A.length&&(!A[f].match(/^-[^0-9]/)||A[f].match($)||tt(A[f]));f++)E++;E<I&&(R=Error(O("Not enough arguments following: %s",h)))}let M=Math.min(E,I);for(!vt(w)&&M>0&&(Y(h,w),M--),f=l+1;f<M+l+1;f++)Y(h,A[f]);return l+M}function At(l,h,A,w){let f=[],I=w||A[l+1],E=U(h,m.nargs);if(U(h,m.bools)&&!/^(true|false)$/.test(I))f.push(!0);else if(vt(I)||vt(w)&&/^-/.test(I)&&!$.test(I)&&!tt(I)){if(p[h]!==void 0){let M=p[h];f=Array.isArray(M)?M:[M]}}else{vt(w)||f.push(C(h,w,!0));for(let M=l+1;M<A.length&&!(!c["greedy-arrays"]&&f.length>0||E&&typeof E=="number"&&f.length>=E||(I=A[M],/^-/.test(I)&&!$.test(I)&&!tt(I)));M++)l=M,f.push(C(h,I,i))}return typeof E=="number"&&(E&&f.length<E||isNaN(E)&&f.length===0)&&(R=Error(O("Not enough arguments following: %s",h))),Y(h,f),l}function Y(l,h,A=i){if(/-/.test(l)&&c["camel-case-expansion"]){let I=l.split(".").map(function(E){return te(E)}).join(".");j(l,I)}let w=C(l,h,A),f=l.split(".");Tt(W,f,w),m.aliases[l]&&m.aliases[l].forEach(function(I){let E=I.split(".");Tt(W,E,w)}),f.length>1&&c["dot-notation"]&&(m.aliases[f[0]]||[]).forEach(function(I){let E=I.split("."),M=[].concat(f);M.shift(),E=E.concat(M),(m.aliases[l]||[]).includes(E.join("."))||Tt(W,E,w)}),U(l,m.normalize)&&!U(l,m.arrays)&&[l].concat(m.aliases[l]||[]).forEach(function(E){Object.defineProperty(ft,E,{enumerable:!0,get(){return h},set(M){h=typeof M=="string"?Rt.normalize(M):M}})})}function j(l,h){m.aliases[l]&&m.aliases[l].length||(m.aliases[l]=[h],y[h]=!0),m.aliases[h]&&m.aliases[h].length||j(h,l)}function C(l,h,A){A&&(h=_a(h)),(U(l,m.bools)||U(l,m.counts))&&typeof h=="string"&&(h=h==="true");let w=Array.isArray(h)?h.map(function(f){return P(l,f)}):P(l,h);return U(l,m.counts)&&(vt(w)||typeof w=="boolean")&&(w=or()),U(l,m.normalize)&&U(l,m.arrays)&&(Array.isArray(h)?w=h.map(f=>Rt.normalize(f)):w=Rt.normalize(h)),w}function P(l,h){return!c["parse-positional-numbers"]&&l==="_"||!U(l,m.strings)&&!U(l,m.bools)&&!Array.isArray(h)&&(Xe(h)&&c["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${h}`)))||!vt(h)&&U(l,m.numbers))&&(h=Number(h)),h}function L(l){let h=Object.create(null);k(h,m.aliases,p),Object.keys(m.configs).forEach(function(A){let w=l[A]||h[A];if(w)try{let f=null,I=Rt.resolve(Rt.cwd(),w),E=m.configs[A];if(typeof E=="function"){try{f=E(I)}catch(M){f=M}if(f instanceof Error){R=f;return}}else f=Rt.require(I);H(f)}catch(f){f.name==="PermissionDenied"?R=f:l[A]&&(R=Error(O("Invalid JSON config file: %s",w)))}})}function H(l,h){Object.keys(l).forEach(function(A){let w=l[A],f=h?h+"."+A:A;typeof w=="object"&&w!==null&&!Array.isArray(w)&&c["dot-notation"]?H(w,f):(!Dt(W,f.split("."))||U(f,m.arrays)&&c["combine-arrays"])&&Y(f,w)})}function ot(){typeof b<"u"&&b.forEach(function(l){H(l)})}function V(l,h){if(typeof d>"u")return;let A=typeof d=="string"?d:"",w=Rt.env();Object.keys(w).forEach(function(f){if(A===""||f.lastIndexOf(A,0)===0){let I=f.split("__").map(function(E,M){return M===0&&(E=E.substring(A.length)),te(E)});(h&&m.configs[I.join(".")]||!h)&&!Dt(l,I)&&Y(I.join("."),w[f])}})}function at(l){let h,A=new Set;Object.keys(l).forEach(function(w){if(!A.has(w)&&(h=U(w,m.coercions),typeof h=="function"))try{let f=P(w,h(l[w]));[].concat(m.aliases[w]||[],w).forEach(I=>{A.add(I),l[I]=f})}catch(f){R=f}})}function Qt(l){return m.keys.forEach(h=>{~h.indexOf(".")||typeof l[h]>"u"&&(l[h]=void 0)}),l}function k(l,h,A,w=!1){Object.keys(A).forEach(function(f){Dt(l,f.split("."))||(Tt(l,f.split("."),A[f]),w&&(x[f]=!0),(h[f]||[]).forEach(function(I){Dt(l,I.split("."))||Tt(l,I.split("."),A[f])}))})}function Dt(l,h){let A=l;c["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(f){A=A[f]||{}});let w=h[h.length-1];return typeof A!="object"?!1:w in A}function Tt(l,h,A){let w=l;c["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(ct){ct=xs(ct),typeof w=="object"&&w[ct]===void 0&&(w[ct]={}),typeof w[ct]!="object"||Array.isArray(w[ct])?(Array.isArray(w[ct])?w[ct].push({}):w[ct]=[w[ct],{}],w=w[ct][w[ct].length-1]):w=w[ct]});let f=xs(h[h.length-1]),I=U(h.join("."),m.arrays),E=Array.isArray(A),M=c["duplicate-arguments-array"];!M&&U(f,m.nargs)&&(M=!0,(!vt(w[f])&&m.nargs[f]===1||Array.isArray(w[f])&&w[f].length===m.nargs[f])&&(w[f]=void 0)),A===or()?w[f]=or(w[f]):Array.isArray(w[f])?M&&I&&E?w[f]=c["flatten-duplicate-arrays"]?w[f].concat(A):(Array.isArray(w[f][0])?w[f]:[w[f]]).concat([A]):!M&&!!I==!!E?w[f]=A:w[f]=w[f].concat([A]):w[f]===void 0&&I?w[f]=E?A:[A]:M&&!(w[f]===void 0||U(f,m.counts)||U(f,m.bools))?w[f]=[w[f],A]:w[f]=A}function Xt(...l){l.forEach(function(h){Object.keys(h||{}).forEach(function(A){m.aliases[A]||(m.aliases[A]=[].concat(o[A]||[]),m.aliases[A].concat(A).forEach(function(w){if(/-/.test(w)&&c["camel-case-expansion"]){let f=te(w);f!==A&&m.aliases[A].indexOf(f)===-1&&(m.aliases[A].push(f),y[f]=!0)}}),m.aliases[A].concat(A).forEach(function(w){if(w.length>1&&/[A-Z]/.test(w)&&c["camel-case-expansion"]){let f=Qe(w,"-");f!==A&&m.aliases[A].indexOf(f)===-1&&(m.aliases[A].push(f),y[f]=!0)}}),m.aliases[A].forEach(function(w){m.aliases[w]=[A].concat(m.aliases[A].filter(function(f){return w!==f}))}))})})}function U(l,h){let A=[].concat(m.aliases[l]||[],l),w=Object.keys(h),f=A.find(I=>w.includes(I));return f?h[f]:!1}function mn(l){let h=Object.keys(m);return[].concat(h.map(w=>m[w])).some(function(w){return Array.isArray(w)?w.includes(l):w[l]})}function F(l,...h){return[].concat(...h).some(function(w){let f=l.match(w);return f&&mn(f[1])})}function X(l){if(l.match($)||!l.match(/^-[^-]+/))return!1;let h=!0,A,w=l.slice(1).split("");for(let f=0;f<w.length;f++){if(A=l.slice(f+2),!mn(w[f])){h=!1;break}if(w[f+1]&&w[f+1]==="="||A==="-"||/[A-Za-z]/.test(w[f])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(A)||w[f+1]&&w[f+1].match(/\W/))break}return h}function tt(l){return c["unknown-options-as-args"]&&B(l)}function B(l){return l=l.replace(/^-{3,}/,"--"),l.match($)||X(l)?!1:!F(l,/^-+([^=]+?)=[\s\S]*$/,N,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function et(l){return!U(l,m.bools)&&!U(l,m.counts)&&`${l}`in p?p[l]:st(jt(l))}function st(l){return{[Et.BOOLEAN]:!0,[Et.STRING]:"",[Et.NUMBER]:void 0,[Et.ARRAY]:[]}[l]}function jt(l){let h=Et.BOOLEAN;return U(l,m.strings)?h=Et.STRING:U(l,m.numbers)?h=Et.NUMBER:U(l,m.bools)?h=Et.BOOLEAN:U(l,m.arrays)&&(h=Et.ARRAY),h}function vt(l){return l===void 0}function ze(){Object.keys(m.counts).find(l=>U(l,m.arrays)?(R=Error(O("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):U(l,m.nargs)?(R=Error(O("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},m.aliases),argv:Object.assign(ft,W),configuration:c,defaulted:Object.assign({},x),error:R,newAliases:Object.assign({},y)}}};function Ea(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,p){return p.indexOf(o)===c});let i=s.pop();i!==void 0&&typeof i=="string"&&(e[i]=s)}),e}function or(r){return r!==void 0?r+1:1}function xs(r){return r==="__proto__"?"___proto___":r}function _a(r){return typeof r=="string"&&(r[0]==="'"||r[0]==='"')&&r[r.length-1]===r[0]?r.substring(1,r.length-1):r}var Es=G("fs");var ar,cr,lr,Os=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,As=(cr=(ar=process==null?void 0:process.versions)===null||ar===void 0?void 0:ar.node)!==null&&cr!==void 0?cr:(lr=process==null?void 0:process.version)===null||lr===void 0?void 0:lr.slice(1);if(As&&Number(As.match(/^([^.]+)/)[1])<Os)throw Error(`yargs parser supports a minimum Node.js version of ${Os}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var Sa=process?process.env:{},_s=new Ze({cwd:process.cwd,env:()=>Sa,format:Cs.format,normalize:ke.normalize,resolve:ke.resolve,require:r=>{if(typeof G<"u")return G(r);if(r.match(/\.json$/))return JSON.parse((0,Es.readFileSync)(r,"utf8"));throw Error("only .json config files are supported in ESM")}}),Fe=function(t,e){return _s.parse(t.slice(),e).argv};Fe.detailed=function(r,t){return _s.parse(r.slice(),t)};Fe.camelCase=te;Fe.decamelize=Qe;Fe.looksLikeNumber=Xe;var Ss=Fe;var $t=G("path");function Pa(){return Ia()?0:1}function Ia(){return ja()&&!process.defaultApp}function ja(){return!!process.versions.electron}function Ps(){return process.argv[Pa()]}var J=class r extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,r)}};var Ce=G("fs"),Is=G("util"),js=G("path"),vs={fs:{readFileSync:Ce.readFileSync,writeFile:Ce.writeFile},format:Is.format,resolve:js.resolve,exists:r=>{try{return(0,Ce.statSync)(r).isFile()}catch{return!1}}};var Mt,fr=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(),Mt.format.apply(Mt.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),Mt.format.apply(Mt.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);Mt.fs.writeFile(o,c,"utf-8",function(p){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(p)})}_readLocaleFile(){let t={},e=this._resolveLocaleFile(this.directory,this.locale);try{Mt.fs.readFileSync&&(t=JSON.parse(Mt.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=Mt.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){let s=Mt.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(t){return Mt.exists(t)}};function Ms(r,t){Mt=t;let e=new fr(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 va=r=>Ms(r,vs),$s=va;var Fa={},Ma="require is not supported by ESM",Fs="loading a directory of commands is not supported yet for ESM",Ne;try{Ne=(0,Ds.fileURLToPath)(Fa.url)}catch{Ne=process.cwd()}var $a=Ne.substring(0,Ne.lastIndexOf("node_modules")),Ts={assert:{notStrictEqual:tn.notStrictEqual,strictEqual:tn.strictEqual},cliui:ir,findUp:ws,getEnv:r=>process.env[r],inspect:Ns.inspect,getCallerFile:()=>{throw new J(Fs)},getProcessArgvBin:Ps,mainFilename:$a||process.cwd(),Parser:Ss,path:{basename:$t.basename,dirname:$t.dirname,extname:$t.extname,relative:$t.relative,resolve:$t.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:Us.readFileSync,require:()=>{throw new J(Ma)},requireDirectory:()=>{throw new J(Fs)},stringWidth:r=>[...r].length,y18n:$s({directory:(0,$t.resolve)(Ne,"../../../locales"),updateFiles:!1})};function pt(r,t,e,n){e.assert.notStrictEqual(r,t,n)}function hr(r,t){t.assert.strictEqual(typeof r,"string")}function Ee(r){return Object.keys(r)}function Q(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 p=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&c===e.length-1&&(p=!0),/^\[/.test(o)?i.optional.push({cmd:o.replace(n,"").split("|"),variadic:p}):i.demanded.push({cmd:o.replace(n,"").split("|"),variadic:p})}),i}var Na=["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(),p=[].slice.call(o);for(;p.length&&p[p.length-1]===void 0;)p.pop();let b=c||p.length;if(b<i.demanded.length)throw new J(`Not enough arguments provided. Expected ${i.demanded.length} but received ${p.length}.`);let d=i.demanded.length+i.optional.length;if(b>d)throw new J(`Too many arguments provided. Expected max ${d} but received ${b}.`);i.demanded.forEach(u=>{let g=p.shift(),y=zs(g);u.cmd.filter(O=>O===y||O==="*").length===0&&Ls(y,u.cmd,s),s+=1}),i.optional.forEach(u=>{if(p.length===0)return;let g=p.shift(),y=zs(g);u.cmd.filter(O=>O===y||O==="*").length===0&&Ls(y,u.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function zs(r){return Array.isArray(r)?"array":r===null?"null":typeof r}function Ls(r,t,e){throw new J(`Invalid ${Na[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${r}.`)}var en=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 Rs(r){return r?r.map(t=>(t.applyBeforeValidation=!1,t)):[]}function ee(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(Q(s))return s.then(o=>Promise.all([o,i(o,t)])).then(([o,c])=>Object.assign(o,c));{let o=i(s,t);return Q(o)?o.then(c=>Object.assign(s,c)):Object.assign(s,o)}},r)}function ne(r,t,e=n=>{throw n}){try{let n=Ua(r)?r():r;return Q(n)?n.then(s=>t(s)):t(n)}catch(n){return e(n)}}function Ua(r){return typeof r=="function"}function ur(r){if(typeof G>"u")return null;for(let t=0,e=Object.keys(G.cache),n;t<e.length;t++)if(n=G.cache[e[t]],n.exports===r)return n;return null}var _e=/(^\*)|(^\$0)/,dr=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,p)=>{let b=i(o,c,p);if(b){if(this.requireCache.has(c))return b;this.requireCache.add(c),this.addHandler(b)}return b},this.shim.requireDirectory({require:e,filename:n},t,s)}addHandler(t,e,n,s,i,o){let c=[],p=Rs(i);if(s=s||(()=>{}),Array.isArray(t))if(Da(t))[t,...c]=t;else for(let b of t)this.addHandler(b);else if(za(t)){let b=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(b=[].concat(b).concat(t.aliases)),this.addHandler(b,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(Ws(n)){this.addHandler([t].concat(c),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){let b=Ht(t);c=c.map(g=>Ht(g).cmd);let d=!1,u=[b.cmd].concat(c).filter(g=>_e.test(g)?(d=!0,!1):!0);u.length===0&&d&&u.push("$0"),d&&(b.cmd=u[0],c=u.slice(1),t=t.replace(_e,b.cmd)),c.forEach(g=>{this.aliasMap[g]=b.cmd}),e!==!1&&this.usage.command(t,e,d,c,o),this.handlers[b.cmd]={original:t,description:e,handler:s,builder:n||{},middlewares:p,deprecated:o,demanded:b.demanded,optional:b.optional},d&&(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(t,e,n,s,i,o){let c=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,p=e.getInternalMethods().getContext(),b=p.commands.slice(),d=!t;t&&(p.commands.push(t),p.fullCommands.push(c.original));let u=this.applyBuilderUpdateUsageAndParse(d,c,e,n.aliases,b,s,i,o);return Q(u)?u.then(g=>this.applyMiddlewareAndGetResult(d,c,g.innerArgv,p,i,g.aliases,e)):this.applyMiddlewareAndGetResult(d,c,u.innerArgv,p,i,u.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,s,i,o,c,p){let b=e.builder,d=n;if(nn(b)){n.getInternalMethods().getUsageInstance().freeze();let u=b(n.getInternalMethods().reset(s),p);if(Q(u))return u.then(g=>(d=Vs(g)?g:n,this.parseAndUpdateUsage(t,e,d,i,o,c)))}else Ta(b)&&(n.getInternalMethods().getUsageInstance().freeze(),d=n.getInternalMethods().reset(s),Object.keys(e.builder).forEach(u=>{d.option(u,b[u])}));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 Q(c)?c.then(p=>({aliases:n.parsed.aliases,innerArgv:p})):{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,p){if(!o.getInternalMethods().getHasOutput()){let b=o.getInternalMethods().runValidation(i,p,o.parsed.error,t);n=ne(n,d=>(b(d),d))}if(e.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();let b=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(n,b,!1,!1),n=ee(n,o,c,!1),n=ne(n,d=>{let u=e.handler(d);return Q(u)?u.then(()=>d):d}),t||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),Q(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 p={};if(i)return n;c.getInternalMethods().getHasOutput()||(p=this.populatePositionals(e,n,s,c));let b=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),d=ee(n,c,b,!0);return Q(d)?d.then(u=>this.handleValidationAndGetResult(t,e,u,s,o,c,b,p)):this.handleValidationAndGetResult(t,e,d,s,o,c,b,p)}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 p=i.shift();this.populatePositional(p,e,c)}for(;o.length;){let p=o.shift();this.populatePositional(p,e,c)}return e._=n.commands.concat(e._.map(p=>""+p)),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 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(e).forEach(b=>{e[b].map(d=>{i.configuration["unknown-options-as-args"]&&(i.key[b]=!0),o.push(`--${b}`),o.push(d)})}),!o.length)return;let c=Object.assign({},i.configuration,{"populate--":!1}),p=this.shim.Parser.detailed(o,Object.assign({},i,{configuration:c}));if(p.error)s.getInternalMethods().getUsageInstance().fail(p.error.message,p.error);else{let b=Object.keys(e);Object.keys(e).forEach(d=>{b.push(...p.aliases[d])}),Object.keys(p.argv).forEach(d=>{b.includes(d)&&(e[d]||(e[d]=p.argv[d]),!this.isInConfigs(s,d)&&!this.isDefaulted(s,d)&&Object.prototype.hasOwnProperty.call(t,d)&&Object.prototype.hasOwnProperty.call(p.argv,d)&&(Array.isArray(t[d])||Array.isArray(p.argv[d]))?t[d]=[].concat(t[d],p.argv[d]):t[d]=p.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(nn(e))return e(t,!0);Ws(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){let e=ur(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;pt(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();pt(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 Bs(r,t,e,n){return new dr(r,t,e,n)}function Ws(r){return typeof r=="object"&&!!r.builder&&typeof r.handler=="function"}function Da(r){return r.every(t=>typeof t=="string")}function nn(r){return typeof r=="function"}function Ta(r){return typeof r=="object"}function za(r){return typeof r=="object"&&!Array.isArray(r)}function qt(r={},t=()=>!0){let e={};return Ee(r).forEach(n=>{t(n,r[n])&&(e[n]=r[n])}),e}function Gt(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 La(r){return typeof r=="boolean"}function qs(r,t){let e=t.y18n.__,n={},s=[];n.failFn=function(C){s.push(C)};let i=null,o=null,c=!0;n.showHelpOnFail=function(C=!0,P){let[L,H]=typeof C=="string"?[!0,C]:[C,P];return r.getInternalMethods().isGlobalContext()&&(o=H),i=H,c=L,n};let p=!1;n.fail=function(C,P){let L=r.getInternalMethods().getLoggerInstance();if(s.length)for(let H=s.length-1;H>=0;--H){let ot=s[H];if(La(ot)){if(P)throw P;if(C)throw Error(C)}else ot(C,P,n)}else{if(r.getExitProcess()&&Gt(!0),!p){p=!0,c&&(r.showHelp("error"),L.error()),(C||P)&&L.error(C||P);let H=i||o;H&&((C||P)&&L.error(""),L.error(H))}if(P=P||new J(C),r.getExitProcess())return r.exit(1);if(r.getInternalMethods().hasParseCallback())return r.exit(1,P);throw P}};let b=[],d=!1;n.usage=(j,C)=>j===null?(d=!0,b=[],n):(d=!1,b.push([j,C||""]),n),n.getUsage=()=>b,n.getUsageDisabled=()=>d,n.getPositionalGroupName=()=>e("Positionals:");let u=[];n.example=(j,C)=>{u.push([j,C||""])};let g=[];n.command=function(C,P,L,H,ot=!1){L&&(g=g.map(V=>(V[2]=!1,V))),g.push([C,P||"",L,H,ot])},n.getCommands=()=>g;let y={};n.describe=function(C,P){Array.isArray(C)?C.forEach(L=>{n.describe(L,P)}):typeof C=="object"?Object.keys(C).forEach(L=>{n.describe(L,C[L])}):y[C]=P},n.getDescriptions=()=>y;let x=[];n.epilog=j=>{x.push(j)};let O=!1,m;n.wrap=j=>{O=!0,m=j},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(O||(m=ht(),O=!0),m);let $="__yargsString__:";n.deferY18nLookup=j=>$+j,n.help=function(){if(T)return T;R();let C=r.customScriptName?r.$0:t.path.basename(r.$0),P=r.getDemandedOptions(),L=r.getDemandedCommands(),H=r.getDeprecatedOptions(),ot=r.getGroups(),V=r.getOptions(),at=[];at=at.concat(Object.keys(y)),at=at.concat(Object.keys(P)),at=at.concat(Object.keys(L)),at=at.concat(Object.keys(V.default)),at=at.filter(ft),at=Object.keys(at.reduce((F,X)=>(X!=="_"&&(F[X]=!0),F),{}));let Qt=n.getWrap(),k=t.cliui({width:Qt,wrap:!!Qt});if(!d){if(b.length)b.forEach(F=>{k.div({text:`${F[0].replace(/\$0/g,C)}`}),F[1]&&k.div({text:`${F[1]}`,padding:[1,0,0,0]})}),k.div();else if(g.length){let F=null;L._?F=`${C} <${e("command")}>
|
|
9
|
-
`:F=`${
|
|
10
|
-
`,k.div(`${F}`)}}if(g.length>1||g.length===1&&!g[0][2]){k.div(e("Commands:"));let F=r.getInternalMethods().getContext(),X=F.commands.length?`${F.commands.join(" ")} `:"";r.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(g=g.sort((B,et)=>B[0].localeCompare(et[0])));let tt=
|
|
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[wa]||0).fill("")),s.push(...new Array(i.padding[ya]||0).fill(""))),s.forEach((c,p)=>{e[p]||e.push([]);let b=e[p];for(let d=0;d<o;d++)b[d]===void 0&&b.push("");b.push(c)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[Je]||0)+(t.padding[Ke]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(o=>o.width||wt.stringWidth(o.text));let e=t.length,n=this.width,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,xa(t[c])):o)}};function gs(r,t,e){return r.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function xa(r){let t=r.padding||[],e=1+(t[Je]||0)+(t[Ke]||0);return r.border?e+4:e}function Ca(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Oa(r,t){r=r.trim();let e=wt.stringWidth(r);return e<t?" ".repeat(t-e)+r:r}function Aa(r,t){r=r.trim();let e=wt.stringWidth(r);return e>=t?r:" ".repeat(t-e>>1)+r}var wt;function bs(r,t){return wt=t,new sr({width:r?.width||Ca(),wrap:r?.wrap})}var ws=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function ir(r){return r.replace(ws,"")}function ys(r,t){let[e,n]=r.match(ws)||["",""];r=ir(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 or(r){return bs(r,{stringWidth:t=>[...t].length,stripAnsi:ir,wrap:ys})}var Oe=G("path"),Qe=G("fs");function xs(r,t){let e=(0,Oe.resolve)(".",r),n;for((0,Qe.statSync)(e).isDirectory()||(e=(0,Oe.dirname)(e));;){if(n=t(e,(0,Qe.readdirSync)(e)),n)return(0,Oe.resolve)(e,n);if(e=(0,Oe.dirname)(n=e),n===e)break}}var Ds=G("util"),Ts=G("fs"),zs=G("url");var _s=G("util"),tn=G("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 Xe(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 Ze(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 Cs(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 Rt,ke=class{constructor(t){Rt=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=Cs(t),i=typeof t=="string",o=Ea(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),p=Object.assign(Object.create(null),n.default),b=n.configObjects||[],d=n.envPrefix,u=c["populate--"],g=u?"--":"_",y=Object.create(null),x=Object.create(null),C=n.__||Rt.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]+)$/,N=new RegExp("^--"+c["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let h=typeof l=="object"?l.key:l,O=Object.keys(l).map(function(w){return{boolean:"bools",string:"strings",number:"numbers"}[w]}).filter(Boolean).pop();O&&(m[O][h]=!0),m.arrays[h]=!0,m.keys.push(h)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(l){m.bools[l]=!0,m.keys.push(l)}),[].concat(n.string||[]).filter(Boolean).forEach(function(l){m.strings[l]=!0,m.keys.push(l)}),[].concat(n.number||[]).filter(Boolean).forEach(function(l){m.numbers[l]=!0,m.keys.push(l)}),[].concat(n.count||[]).filter(Boolean).forEach(function(l){m.counts[l]=!0,m.keys.push(l)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(l){m.normalize[l]=!0,m.keys.push(l)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([l,h])=>{typeof h=="number"&&(m.nargs[l]=h,m.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,h])=>{typeof h=="function"&&(m.coercions[l]=h,m.keys.push(l))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(l){m.configs[l]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([l,h])=>{(typeof h=="boolean"||typeof h=="function")&&(m.configs[l]=h)})),Xt(n.key,o,n.default,m.arrays),Object.keys(p).forEach(function(l){(m.aliases[l]||[]).forEach(function(h){p[h]=p[l]})});let R=null;ze();let T=[],W=Object.assign(Object.create(null),{_:[]}),ft={};for(let l=0;l<s.length;l++){let h=s[l],O=h.replace(/^-{3,}/,"---"),w,f,I,E,M,ct;if(h!=="--"&&/^-/.test(h)&&tt(h))Z(h);else if(O.match(/^---+(=|$)/)){Z(h);continue}else if(h.match(/^--.+=/)||!c["short-option-groups"]&&h.match(/^-.+=/))E=h.match(/^--?([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&(U(E[1],m.arrays)?l=Ot(l,E[1],s,E[2]):U(E[1],m.nargs)!==!1?l=ht(l,E[1],s,E[2]):Y(E[1],E[2],!0));else if(h.match(N)&&c["boolean-negation"])E=h.match(N),E!==null&&Array.isArray(E)&&E.length>=2&&(f=E[1],Y(f,U(f,m.arrays)?[!1]:!1));else if(h.match(/^--.+/)||!c["short-option-groups"]&&h.match(/^-[^-]+/))E=h.match(/^--?(.+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(f=E[1],U(f,m.arrays)?l=Ot(l,f,s):U(f,m.nargs)!==!1?l=ht(l,f,s):(M=s[l+1],M!==void 0&&(!M.match(/^-/)||M.match($))&&!U(f,m.bools)&&!U(f,m.counts)||/^(true|false)$/.test(M)?(Y(f,M),l++):Y(f,et(f))));else if(h.match(/^-.\..+=/))E=h.match(/^-([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&Y(E[1],E[2]);else if(h.match(/^-.\..+/)&&!h.match($))M=s[l+1],E=h.match(/^-(.\..+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(f=E[1],M!==void 0&&!M.match(/^-/)&&!U(f,m.bools)&&!U(f,m.counts)?(Y(f,M),l++):Y(f,et(f)));else if(h.match(/^-[^-]+/)&&!h.match($)){I=h.slice(1,-1).split(""),w=!1;for(let dt=0;dt<I.length;dt++){if(M=h.slice(dt+2),I[dt+1]&&I[dt+1]==="="){ct=h.slice(dt+3),f=I[dt],U(f,m.arrays)?l=Ot(l,f,s,ct):U(f,m.nargs)!==!1?l=ht(l,f,s,ct):Y(f,ct),w=!0;break}if(M==="-"){Y(I[dt],M);continue}if(/[A-Za-z]/.test(I[dt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(M)&&U(M,m.bools)===!1){Y(I[dt],M),w=!0;break}if(I[dt+1]&&I[dt+1].match(/\W/)){Y(I[dt],M),w=!0;break}else Y(I[dt],et(I[dt]))}f=h.slice(-1)[0],!w&&f!=="-"&&(U(f,m.arrays)?l=Ot(l,f,s):U(f,m.nargs)!==!1?l=ht(l,f,s):(M=s[l+1],M!==void 0&&(!/^(-|--)[^-]/.test(M)||M.match($))&&!U(f,m.bools)&&!U(f,m.counts)||/^(true|false)$/.test(M)?(Y(f,M),l++):Y(f,et(f))))}else if(h.match(/^-[0-9]$/)&&h.match($)&&U(h.slice(1),m.bools))f=h.slice(1),Y(f,et(f));else if(h==="--"){T=s.slice(l+1);break}else if(c["halt-at-non-option"]){T=s.slice(l);break}else Z(h)}V(W,!0),V(W,!1),L(W),ot(),k(W,m.aliases,p,!0),at(W),c["set-placeholder-key"]&&Qt(W),Object.keys(m.counts).forEach(function(l){Dt(W,l.split("."))||Y(l,0)}),u&&T.length&&(W[g]=[]),T.forEach(function(l){W[g].push(l)}),c["camel-case-expansion"]&&c["strip-dashed"]&&Object.keys(W).filter(l=>l!=="--"&&l.includes("-")).forEach(l=>{delete W[l]}),c["strip-aliased"]&&[].concat(...Object.keys(o).map(l=>o[l])).forEach(l=>{c["camel-case-expansion"]&&l.includes("-")&&delete W[l.split(".").map(h=>ee(h)).join(".")],delete W[l]});function Z(l){let h=P("_",l);(typeof h=="string"||typeof h=="number")&&W._.push(h)}function ht(l,h,O,w){let f,I=U(h,m.nargs);if(I=typeof I!="number"||isNaN(I)?1:I,I===0)return vt(w)||(R=Error(C("Argument unexpected for: %s",h))),Y(h,et(h)),l;let E=vt(w)?0:1;if(c["nargs-eats-options"])O.length-(l+1)+E<I&&(R=Error(C("Not enough arguments following: %s",h))),E=I;else{for(f=l+1;f<O.length&&(!O[f].match(/^-[^0-9]/)||O[f].match($)||tt(O[f]));f++)E++;E<I&&(R=Error(C("Not enough arguments following: %s",h)))}let M=Math.min(E,I);for(!vt(w)&&M>0&&(Y(h,w),M--),f=l+1;f<M+l+1;f++)Y(h,O[f]);return l+M}function Ot(l,h,O,w){let f=[],I=w||O[l+1],E=U(h,m.nargs);if(U(h,m.bools)&&!/^(true|false)$/.test(I))f.push(!0);else if(vt(I)||vt(w)&&/^-/.test(I)&&!$.test(I)&&!tt(I)){if(p[h]!==void 0){let M=p[h];f=Array.isArray(M)?M:[M]}}else{vt(w)||f.push(A(h,w,!0));for(let M=l+1;M<O.length&&!(!c["greedy-arrays"]&&f.length>0||E&&typeof E=="number"&&f.length>=E||(I=O[M],/^-/.test(I)&&!$.test(I)&&!tt(I)));M++)l=M,f.push(A(h,I,i))}return typeof E=="number"&&(E&&f.length<E||isNaN(E)&&f.length===0)&&(R=Error(C("Not enough arguments following: %s",h))),Y(h,f),l}function Y(l,h,O=i){if(/-/.test(l)&&c["camel-case-expansion"]){let I=l.split(".").map(function(E){return ee(E)}).join(".");j(l,I)}let w=A(l,h,O),f=l.split(".");Tt(W,f,w),m.aliases[l]&&m.aliases[l].forEach(function(I){let E=I.split(".");Tt(W,E,w)}),f.length>1&&c["dot-notation"]&&(m.aliases[f[0]]||[]).forEach(function(I){let E=I.split("."),M=[].concat(f);M.shift(),E=E.concat(M),(m.aliases[l]||[]).includes(E.join("."))||Tt(W,E,w)}),U(l,m.normalize)&&!U(l,m.arrays)&&[l].concat(m.aliases[l]||[]).forEach(function(E){Object.defineProperty(ft,E,{enumerable:!0,get(){return h},set(M){h=typeof M=="string"?Rt.normalize(M):M}})})}function j(l,h){m.aliases[l]&&m.aliases[l].length||(m.aliases[l]=[h],y[h]=!0),m.aliases[h]&&m.aliases[h].length||j(h,l)}function A(l,h,O){O&&(h=_a(h)),(U(l,m.bools)||U(l,m.counts))&&typeof h=="string"&&(h=h==="true");let w=Array.isArray(h)?h.map(function(f){return P(l,f)}):P(l,h);return U(l,m.counts)&&(vt(w)||typeof w=="boolean")&&(w=ar()),U(l,m.normalize)&&U(l,m.arrays)&&(Array.isArray(h)?w=h.map(f=>Rt.normalize(f)):w=Rt.normalize(h)),w}function P(l,h){return!c["parse-positional-numbers"]&&l==="_"||!U(l,m.strings)&&!U(l,m.bools)&&!Array.isArray(h)&&(Ze(h)&&c["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${h}`)))||!vt(h)&&U(l,m.numbers))&&(h=Number(h)),h}function L(l){let h=Object.create(null);k(h,m.aliases,p),Object.keys(m.configs).forEach(function(O){let w=l[O]||h[O];if(w)try{let f=null,I=Rt.resolve(Rt.cwd(),w),E=m.configs[O];if(typeof E=="function"){try{f=E(I)}catch(M){f=M}if(f instanceof Error){R=f;return}}else f=Rt.require(I);H(f)}catch(f){f.name==="PermissionDenied"?R=f:l[O]&&(R=Error(C("Invalid JSON config file: %s",w)))}})}function H(l,h){Object.keys(l).forEach(function(O){let w=l[O],f=h?h+"."+O:O;typeof w=="object"&&w!==null&&!Array.isArray(w)&&c["dot-notation"]?H(w,f):(!Dt(W,f.split("."))||U(f,m.arrays)&&c["combine-arrays"])&&Y(f,w)})}function ot(){typeof b<"u"&&b.forEach(function(l){H(l)})}function V(l,h){if(typeof d>"u")return;let O=typeof d=="string"?d:"",w=Rt.env();Object.keys(w).forEach(function(f){if(O===""||f.lastIndexOf(O,0)===0){let I=f.split("__").map(function(E,M){return M===0&&(E=E.substring(O.length)),ee(E)});(h&&m.configs[I.join(".")]||!h)&&!Dt(l,I)&&Y(I.join("."),w[f])}})}function at(l){let h,O=new Set;Object.keys(l).forEach(function(w){if(!O.has(w)&&(h=U(w,m.coercions),typeof h=="function"))try{let f=P(w,h(l[w]));[].concat(m.aliases[w]||[],w).forEach(I=>{O.add(I),l[I]=f})}catch(f){R=f}})}function Qt(l){return m.keys.forEach(h=>{~h.indexOf(".")||typeof l[h]>"u"&&(l[h]=void 0)}),l}function k(l,h,O,w=!1){Object.keys(O).forEach(function(f){Dt(l,f.split("."))||(Tt(l,f.split("."),O[f]),w&&(x[f]=!0),(h[f]||[]).forEach(function(I){Dt(l,I.split("."))||Tt(l,I.split("."),O[f])}))})}function Dt(l,h){let O=l;c["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(f){O=O[f]||{}});let w=h[h.length-1];return typeof O!="object"?!1:w in O}function Tt(l,h,O){let w=l;c["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(ct){ct=Os(ct),typeof w=="object"&&w[ct]===void 0&&(w[ct]={}),typeof w[ct]!="object"||Array.isArray(w[ct])?(Array.isArray(w[ct])?w[ct].push({}):w[ct]=[w[ct],{}],w=w[ct][w[ct].length-1]):w=w[ct]});let f=Os(h[h.length-1]),I=U(h.join("."),m.arrays),E=Array.isArray(O),M=c["duplicate-arguments-array"];!M&&U(f,m.nargs)&&(M=!0,(!vt(w[f])&&m.nargs[f]===1||Array.isArray(w[f])&&w[f].length===m.nargs[f])&&(w[f]=void 0)),O===ar()?w[f]=ar(w[f]):Array.isArray(w[f])?M&&I&&E?w[f]=c["flatten-duplicate-arrays"]?w[f].concat(O):(Array.isArray(w[f][0])?w[f]:[w[f]]).concat([O]):!M&&!!I==!!E?w[f]=O:w[f]=w[f].concat([O]):w[f]===void 0&&I?w[f]=E?O:[O]:M&&!(w[f]===void 0||U(f,m.counts)||U(f,m.bools))?w[f]=[w[f],O]:w[f]=O}function Xt(...l){l.forEach(function(h){Object.keys(h||{}).forEach(function(O){m.aliases[O]||(m.aliases[O]=[].concat(o[O]||[]),m.aliases[O].concat(O).forEach(function(w){if(/-/.test(w)&&c["camel-case-expansion"]){let f=ee(w);f!==O&&m.aliases[O].indexOf(f)===-1&&(m.aliases[O].push(f),y[f]=!0)}}),m.aliases[O].concat(O).forEach(function(w){if(w.length>1&&/[A-Z]/.test(w)&&c["camel-case-expansion"]){let f=Xe(w,"-");f!==O&&m.aliases[O].indexOf(f)===-1&&(m.aliases[O].push(f),y[f]=!0)}}),m.aliases[O].forEach(function(w){m.aliases[w]=[O].concat(m.aliases[O].filter(function(f){return w!==f}))}))})})}function U(l,h){let O=[].concat(m.aliases[l]||[],l),w=Object.keys(h),f=O.find(I=>w.includes(I));return f?h[f]:!1}function gn(l){let h=Object.keys(m);return[].concat(h.map(w=>m[w])).some(function(w){return Array.isArray(w)?w.includes(l):w[l]})}function F(l,...h){return[].concat(...h).some(function(w){let f=l.match(w);return f&&gn(f[1])})}function X(l){if(l.match($)||!l.match(/^-[^-]+/))return!1;let h=!0,O,w=l.slice(1).split("");for(let f=0;f<w.length;f++){if(O=l.slice(f+2),!gn(w[f])){h=!1;break}if(w[f+1]&&w[f+1]==="="||O==="-"||/[A-Za-z]/.test(w[f])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(O)||w[f+1]&&w[f+1].match(/\W/))break}return h}function tt(l){return c["unknown-options-as-args"]&&B(l)}function B(l){return l=l.replace(/^-{3,}/,"--"),l.match($)||X(l)?!1:!F(l,/^-+([^=]+?)=[\s\S]*$/,N,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function et(l){return!U(l,m.bools)&&!U(l,m.counts)&&`${l}`in p?p[l]:st(jt(l))}function st(l){return{[Et.BOOLEAN]:!0,[Et.STRING]:"",[Et.NUMBER]:void 0,[Et.ARRAY]:[]}[l]}function jt(l){let h=Et.BOOLEAN;return U(l,m.strings)?h=Et.STRING:U(l,m.numbers)?h=Et.NUMBER:U(l,m.bools)?h=Et.BOOLEAN:U(l,m.arrays)&&(h=Et.ARRAY),h}function vt(l){return l===void 0}function ze(){Object.keys(m.counts).find(l=>U(l,m.arrays)?(R=Error(C("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):U(l,m.nargs)?(R=Error(C("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},m.aliases),argv:Object.assign(ft,W),configuration:c,defaulted:Object.assign({},x),error:R,newAliases:Object.assign({},y)}}};function Ea(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,p){return p.indexOf(o)===c});let i=s.pop();i!==void 0&&typeof i=="string"&&(e[i]=s)}),e}function ar(r){return r!==void 0?r+1:1}function Os(r){return r==="__proto__"?"___proto___":r}function _a(r){return typeof r=="string"&&(r[0]==="'"||r[0]==='"')&&r[r.length-1]===r[0]?r.substring(1,r.length-1):r}var Ss=G("fs");var cr,lr,fr,As=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Es=(lr=(cr=process==null?void 0:process.versions)===null||cr===void 0?void 0:cr.node)!==null&&lr!==void 0?lr:(fr=process==null?void 0:process.version)===null||fr===void 0?void 0:fr.slice(1);if(Es&&Number(Es.match(/^([^.]+)/)[1])<As)throw Error(`yargs parser supports a minimum Node.js version of ${As}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var Sa=process?process.env:{},Ps=new ke({cwd:process.cwd,env:()=>Sa,format:_s.format,normalize:tn.normalize,resolve:tn.resolve,require:r=>{if(typeof G<"u")return G(r);if(r.match(/\.json$/))return JSON.parse((0,Ss.readFileSync)(r,"utf8"));throw Error("only .json config files are supported in ESM")}}),Fe=function(t,e){return Ps.parse(t.slice(),e).argv};Fe.detailed=function(r,t){return Ps.parse(r.slice(),t)};Fe.camelCase=ee;Fe.decamelize=Xe;Fe.looksLikeNumber=Ze;var Is=Fe;var $t=G("path");function Pa(){return Ia()?0:1}function Ia(){return ja()&&!process.defaultApp}function ja(){return!!process.versions.electron}function js(){return process.argv[Pa()]}var J=class r extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,r)}};var Ae=G("fs"),vs=G("util"),Ms=G("path"),$s={fs:{readFileSync:Ae.readFileSync,writeFile:Ae.writeFile},format:vs.format,resolve:Ms.resolve,exists:r=>{try{return(0,Ae.statSync)(r).isFile()}catch{return!1}}};var Mt,hr=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(),Mt.format.apply(Mt.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),Mt.format.apply(Mt.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);Mt.fs.writeFile(o,c,"utf-8",function(p){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(p)})}_readLocaleFile(){let t={},e=this._resolveLocaleFile(this.directory,this.locale);try{Mt.fs.readFileSync&&(t=JSON.parse(Mt.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=Mt.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){let s=Mt.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(t){return Mt.exists(t)}};function Fs(r,t){Mt=t;let e=new hr(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 va=r=>Fs(r,$s),Ns=va;var Fa={},Ma="require is not supported by ESM",Us="loading a directory of commands is not supported yet for ESM",Ne;try{Ne=(0,zs.fileURLToPath)(Fa.url)}catch{Ne=process.cwd()}var $a=Ne.substring(0,Ne.lastIndexOf("node_modules")),Ls={assert:{notStrictEqual:en.notStrictEqual,strictEqual:en.strictEqual},cliui:or,findUp:xs,getEnv:r=>process.env[r],inspect:Ds.inspect,getCallerFile:()=>{throw new J(Us)},getProcessArgvBin:js,mainFilename:$a||process.cwd(),Parser:Is,path:{basename:$t.basename,dirname:$t.dirname,extname:$t.extname,relative:$t.relative,resolve:$t.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:Ts.readFileSync,require:()=>{throw new J(Ma)},requireDirectory:()=>{throw new J(Us)},stringWidth:r=>[...r].length,y18n:Ns({directory:(0,$t.resolve)(Ne,"../../../locales"),updateFiles:!1})};function pt(r,t,e,n){e.assert.notStrictEqual(r,t,n)}function ur(r,t){t.assert.strictEqual(typeof r,"string")}function Ee(r){return Object.keys(r)}function Q(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 p=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&c===e.length-1&&(p=!0),/^\[/.test(o)?i.optional.push({cmd:o.replace(n,"").split("|"),variadic:p}):i.demanded.push({cmd:o.replace(n,"").split("|"),variadic:p})}),i}var Na=["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(),p=[].slice.call(o);for(;p.length&&p[p.length-1]===void 0;)p.pop();let b=c||p.length;if(b<i.demanded.length)throw new J(`Not enough arguments provided. Expected ${i.demanded.length} but received ${p.length}.`);let d=i.demanded.length+i.optional.length;if(b>d)throw new J(`Too many arguments provided. Expected max ${d} but received ${b}.`);i.demanded.forEach(u=>{let g=p.shift(),y=Rs(g);u.cmd.filter(C=>C===y||C==="*").length===0&&Ws(y,u.cmd,s),s+=1}),i.optional.forEach(u=>{if(p.length===0)return;let g=p.shift(),y=Rs(g);u.cmd.filter(C=>C===y||C==="*").length===0&&Ws(y,u.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function Rs(r){return Array.isArray(r)?"array":r===null?"null":typeof r}function Ws(r,t,e){throw new J(`Invalid ${Na[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${r}.`)}var nn=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 Bs(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(Q(s))return s.then(o=>Promise.all([o,i(o,t)])).then(([o,c])=>Object.assign(o,c));{let o=i(s,t);return Q(o)?o.then(c=>Object.assign(s,c)):Object.assign(s,o)}},r)}function re(r,t,e=n=>{throw n}){try{let n=Ua(r)?r():r;return Q(n)?n.then(s=>t(s)):t(n)}catch(n){return e(n)}}function Ua(r){return typeof r=="function"}function dr(r){if(typeof G>"u")return null;for(let t=0,e=Object.keys(G.cache),n;t<e.length;t++)if(n=G.cache[e[t]],n.exports===r)return n;return null}var _e=/(^\*)|(^\$0)/,pr=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,p)=>{let b=i(o,c,p);if(b){if(this.requireCache.has(c))return b;this.requireCache.add(c),this.addHandler(b)}return b},this.shim.requireDirectory({require:e,filename:n},t,s)}addHandler(t,e,n,s,i,o){let c=[],p=Bs(i);if(s=s||(()=>{}),Array.isArray(t))if(Da(t))[t,...c]=t;else for(let b of t)this.addHandler(b);else if(za(t)){let b=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(b=[].concat(b).concat(t.aliases)),this.addHandler(b,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(Vs(n)){this.addHandler([t].concat(c),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){let b=Ht(t);c=c.map(g=>Ht(g).cmd);let d=!1,u=[b.cmd].concat(c).filter(g=>_e.test(g)?(d=!0,!1):!0);u.length===0&&d&&u.push("$0"),d&&(b.cmd=u[0],c=u.slice(1),t=t.replace(_e,b.cmd)),c.forEach(g=>{this.aliasMap[g]=b.cmd}),e!==!1&&this.usage.command(t,e,d,c,o),this.handlers[b.cmd]={original:t,description:e,handler:s,builder:n||{},middlewares:p,deprecated:o,demanded:b.demanded,optional:b.optional},d&&(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(t,e,n,s,i,o){let c=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,p=e.getInternalMethods().getContext(),b=p.commands.slice(),d=!t;t&&(p.commands.push(t),p.fullCommands.push(c.original));let u=this.applyBuilderUpdateUsageAndParse(d,c,e,n.aliases,b,s,i,o);return Q(u)?u.then(g=>this.applyMiddlewareAndGetResult(d,c,g.innerArgv,p,i,g.aliases,e)):this.applyMiddlewareAndGetResult(d,c,u.innerArgv,p,i,u.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,s,i,o,c,p){let b=e.builder,d=n;if(rn(b)){n.getInternalMethods().getUsageInstance().freeze();let u=b(n.getInternalMethods().reset(s),p);if(Q(u))return u.then(g=>(d=qs(g)?g:n,this.parseAndUpdateUsage(t,e,d,i,o,c)))}else Ta(b)&&(n.getInternalMethods().getUsageInstance().freeze(),d=n.getInternalMethods().reset(s),Object.keys(e.builder).forEach(u=>{d.option(u,b[u])}));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 Q(c)?c.then(p=>({aliases:n.parsed.aliases,innerArgv:p})):{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,p){if(!o.getInternalMethods().getHasOutput()){let b=o.getInternalMethods().runValidation(i,p,o.parsed.error,t);n=re(n,d=>(b(d),d))}if(e.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();let b=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(n,b,!1,!1),n=ne(n,o,c,!1),n=re(n,d=>{let u=e.handler(d);return Q(u)?u.then(()=>d):d}),t||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),Q(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 p={};if(i)return n;c.getInternalMethods().getHasOutput()||(p=this.populatePositionals(e,n,s,c));let b=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),d=ne(n,c,b,!0);return Q(d)?d.then(u=>this.handleValidationAndGetResult(t,e,u,s,o,c,b,p)):this.handleValidationAndGetResult(t,e,d,s,o,c,b,p)}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 p=i.shift();this.populatePositional(p,e,c)}for(;o.length;){let p=o.shift();this.populatePositional(p,e,c)}return e._=n.commands.concat(e._.map(p=>""+p)),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 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(e).forEach(b=>{e[b].map(d=>{i.configuration["unknown-options-as-args"]&&(i.key[b]=!0),o.push(`--${b}`),o.push(d)})}),!o.length)return;let c=Object.assign({},i.configuration,{"populate--":!1}),p=this.shim.Parser.detailed(o,Object.assign({},i,{configuration:c}));if(p.error)s.getInternalMethods().getUsageInstance().fail(p.error.message,p.error);else{let b=Object.keys(e);Object.keys(e).forEach(d=>{b.push(...p.aliases[d])}),Object.keys(p.argv).forEach(d=>{b.includes(d)&&(e[d]||(e[d]=p.argv[d]),!this.isInConfigs(s,d)&&!this.isDefaulted(s,d)&&Object.prototype.hasOwnProperty.call(t,d)&&Object.prototype.hasOwnProperty.call(p.argv,d)&&(Array.isArray(t[d])||Array.isArray(p.argv[d]))?t[d]=[].concat(t[d],p.argv[d]):t[d]=p.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(rn(e))return e(t,!0);Vs(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){let e=dr(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;pt(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();pt(t,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function Hs(r,t,e,n){return new pr(r,t,e,n)}function Vs(r){return typeof r=="object"&&!!r.builder&&typeof r.handler=="function"}function Da(r){return r.every(t=>typeof t=="string")}function rn(r){return typeof r=="function"}function Ta(r){return typeof r=="object"}function za(r){return typeof r=="object"&&!Array.isArray(r)}function qt(r={},t=()=>!0){let e={};return Ee(r).forEach(n=>{t(n,r[n])&&(e[n]=r[n])}),e}function Gt(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 La(r){return typeof r=="boolean"}function Ys(r,t){let e=t.y18n.__,n={},s=[];n.failFn=function(A){s.push(A)};let i=null,o=null,c=!0;n.showHelpOnFail=function(A=!0,P){let[L,H]=typeof A=="string"?[!0,A]:[A,P];return r.getInternalMethods().isGlobalContext()&&(o=H),i=H,c=L,n};let p=!1;n.fail=function(A,P){let L=r.getInternalMethods().getLoggerInstance();if(s.length)for(let H=s.length-1;H>=0;--H){let ot=s[H];if(La(ot)){if(P)throw P;if(A)throw Error(A)}else ot(A,P,n)}else{if(r.getExitProcess()&&Gt(!0),!p){p=!0,c&&(r.showHelp("error"),L.error()),(A||P)&&L.error(A||P);let H=i||o;H&&((A||P)&&L.error(""),L.error(H))}if(P=P||new J(A),r.getExitProcess())return r.exit(1);if(r.getInternalMethods().hasParseCallback())return r.exit(1,P);throw P}};let b=[],d=!1;n.usage=(j,A)=>j===null?(d=!0,b=[],n):(d=!1,b.push([j,A||""]),n),n.getUsage=()=>b,n.getUsageDisabled=()=>d,n.getPositionalGroupName=()=>e("Positionals:");let u=[];n.example=(j,A)=>{u.push([j,A||""])};let g=[];n.command=function(A,P,L,H,ot=!1){L&&(g=g.map(V=>(V[2]=!1,V))),g.push([A,P||"",L,H,ot])},n.getCommands=()=>g;let y={};n.describe=function(A,P){Array.isArray(A)?A.forEach(L=>{n.describe(L,P)}):typeof A=="object"?Object.keys(A).forEach(L=>{n.describe(L,A[L])}):y[A]=P},n.getDescriptions=()=>y;let x=[];n.epilog=j=>{x.push(j)};let C=!1,m;n.wrap=j=>{C=!0,m=j},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(C||(m=ht(),C=!0),m);let $="__yargsString__:";n.deferY18nLookup=j=>$+j,n.help=function(){if(T)return T;R();let A=r.customScriptName?r.$0:t.path.basename(r.$0),P=r.getDemandedOptions(),L=r.getDemandedCommands(),H=r.getDeprecatedOptions(),ot=r.getGroups(),V=r.getOptions(),at=[];at=at.concat(Object.keys(y)),at=at.concat(Object.keys(P)),at=at.concat(Object.keys(L)),at=at.concat(Object.keys(V.default)),at=at.filter(ft),at=Object.keys(at.reduce((F,X)=>(X!=="_"&&(F[X]=!0),F),{}));let Qt=n.getWrap(),k=t.cliui({width:Qt,wrap:!!Qt});if(!d){if(b.length)b.forEach(F=>{k.div({text:`${F[0].replace(/\$0/g,A)}`}),F[1]&&k.div({text:`${F[1]}`,padding:[1,0,0,0]})}),k.div();else if(g.length){let F=null;L._?F=`${A} <${e("command")}>
|
|
9
|
+
`:F=`${A} [${e("command")}]
|
|
10
|
+
`,k.div(`${F}`)}}if(g.length>1||g.length===1&&!g[0][2]){k.div(e("Commands:"));let F=r.getInternalMethods().getContext(),X=F.commands.length?`${F.commands.join(" ")} `:"";r.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(g=g.sort((B,et)=>B[0].localeCompare(et[0])));let tt=A?`${A} `:"";g.forEach(B=>{let et=`${tt}${X}${B[0].replace(/^\$0 ?/,"")}`;k.span({text:et,padding:[0,2,0,2],width:N(g,Qt,`${A}${X}`)+4},{text:B[1]});let st=[];B[2]&&st.push(`[${e("default")}]`),B[3]&&B[3].length&&st.push(`[${e("aliases:")} ${B[3].join(", ")}]`),B[4]&&(typeof B[4]=="string"?st.push(`[${e("deprecated: %s",B[4])}]`):st.push(`[${e("deprecated")}]`)),st.length?k.div({text:st.join(" "),padding:[0,0,0,2],align:"right"}):k.div()}),k.div()}let Dt=(Object.keys(V.alias)||[]).concat(Object.keys(r.parsed.newAliases)||[]);at=at.filter(F=>!r.parsed.newAliases[F]&&Dt.every(X=>(V.alias[X]||[]).indexOf(F)===-1));let Tt=e("Options:");ot[Tt]||(ot[Tt]=[]),W(at,V.alias,ot,Tt);let Xt=F=>/^--/.test(sn(F)),U=Object.keys(ot).filter(F=>ot[F].length>0).map(F=>{let X=ot[F].filter(ft).map(tt=>{if(Dt.includes(tt))return tt;for(let B=0,et;(et=Dt[B])!==void 0;B++)if((V.alias[et]||[]).includes(tt))return et;return tt});return{groupName:F,normalizedKeys:X}}).filter(({normalizedKeys:F})=>F.length>0).map(({groupName:F,normalizedKeys:X})=>{let tt=X.reduce((B,et)=>(B[et]=[et].concat(V.alias[et]||[]).map(st=>F===n.getPositionalGroupName()?st:(/^[0-9]$/.test(st)?V.boolean.includes(et)?"-":"--":st.length>1?"--":"-")+st).sort((st,jt)=>Xt(st)===Xt(jt)?0:Xt(st)?1:-1).join(", "),B),{});return{groupName:F,normalizedKeys:X,switches:tt}});if(U.filter(({groupName:F})=>F!==n.getPositionalGroupName()).some(({normalizedKeys:F,switches:X})=>!F.every(tt=>Xt(X[tt])))&&U.filter(({groupName:F})=>F!==n.getPositionalGroupName()).forEach(({normalizedKeys:F,switches:X})=>{F.forEach(tt=>{Xt(X[tt])&&(X[tt]=Ra(X[tt],4))})}),U.forEach(({groupName:F,normalizedKeys:X,switches:tt})=>{k.div(F),X.forEach(B=>{let et=tt[B],st=y[B]||"",jt=null;st.includes($)&&(st=e(st.substring($.length))),V.boolean.includes(B)&&(jt=`[${e("boolean")}]`),V.count.includes(B)&&(jt=`[${e("count")}]`),V.string.includes(B)&&(jt=`[${e("string")}]`),V.normalize.includes(B)&&(jt=`[${e("string")}]`),V.array.includes(B)&&(jt=`[${e("array")}]`),V.number.includes(B)&&(jt=`[${e("number")}]`);let vt=h=>typeof h=="string"?`[${e("deprecated: %s",h)}]`:`[${e("deprecated")}]`,ze=[B in H?vt(H[B]):null,jt,B in P?`[${e("required")}]`:null,V.choices&&V.choices[B]?`[${e("choices:")} ${n.stringifiedValues(V.choices[B])}]`:null,Z(V.default[B],V.defaultDescription[B])].filter(Boolean).join(" ");k.span({text:sn(et),padding:[0,2,0,2+Gs(et)],width:N(tt,Qt)+4},st);let l=r.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;ze&&!l?k.div({text:ze,padding:[0,0,0,2],align:"right"}):k.div()}),k.div()}),u.length&&(k.div(e("Examples:")),u.forEach(F=>{F[0]=F[0].replace(/\$0/g,A)}),u.forEach(F=>{F[1]===""?k.div({text:F[0],padding:[0,2,0,2]}):k.div({text:F[0],padding:[0,2,0,2],width:N(u,Qt)+4},{text:F[1]})}),k.div()),x.length>0){let F=x.map(X=>X.replace(/\$0/g,A)).join(`
|
|
11
11
|
`);k.div(`${F}
|
|
12
|
-
`)}return k.toString().replace(/\s*$/,"")};function N(j,
|
|
12
|
+
`)}return k.toString().replace(/\s*$/,"")};function N(j,A,P){let L=0;return Array.isArray(j)||(j=Object.values(j).map(H=>[H])),j.forEach(H=>{L=Math.max(t.stringWidth(P?`${P} ${sn(H[0])}`:sn(H[0]))+Gs(H[0]),L)}),A&&(L=Math.min(L,parseInt((A*.5).toString(),10))),L}function R(){let j=r.getDemandedOptions(),A=r.getOptions();(Object.keys(A.alias)||[]).forEach(P=>{A.alias[P].forEach(L=>{y[L]&&n.describe(P,y[L]),L in j&&r.demandOption(P,j[L]),A.boolean.includes(L)&&r.boolean(P),A.count.includes(L)&&r.count(P),A.string.includes(L)&&r.string(P),A.normalize.includes(L)&&r.normalize(P),A.array.includes(L)&&r.array(P),A.number.includes(L)&&r.number(P)})})}let T;n.cacheHelpMessage=function(){T=this.help()},n.clearCachedHelpMessage=function(){T=void 0},n.hasCachedHelpMessage=function(){return!!T};function W(j,A,P,L){let H=[],ot=null;return Object.keys(P).forEach(V=>{H=H.concat(P[V])}),j.forEach(V=>{ot=[V].concat(A[V]),ot.some(at=>H.indexOf(at)!==-1)||P[L].push(V)}),H}function ft(j){return r.getOptions().hiddenOptions.indexOf(j)<0||r.parsed.argv[r.getOptions().showHiddenOpt]}n.showHelp=j=>{let A=r.getInternalMethods().getLoggerInstance();j||(j="error"),(typeof j=="function"?j:A[j])(n.help())},n.functionDescription=j=>["(",j.name?t.Parser.decamelize(j.name,"-"):e("generated-value"),")"].join(""),n.stringifiedValues=function(A,P){let L="",H=P||", ",ot=[].concat(A);return!A||!ot.length||ot.forEach(V=>{L.length&&(L+=H),L+=JSON.stringify(V)}),L};function Z(j,A){let P=`[${e("default:")} `;if(j===void 0&&!A)return null;if(A)P+=A;else switch(typeof j){case"string":P+=`"${j}"`;break;case"object":P+=JSON.stringify(j);break;default:P+=j}return`${P}]`}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 A=r.getInternalMethods().getLoggerInstance();j||(j="error"),(typeof j=="function"?j:A[j])(Ot)},n.reset=function(A){return i=null,p=!1,b=[],d=!1,x=[],u=[],g=[],y=qt(y,P=>!A[P]),n};let Y=[];return n.freeze=function(){Y.push({failMessage:i,failureOutput:p,usages:b,usageDisabled:d,epilogs:x,examples:u,commands:g,descriptions:y})},n.unfreeze=function(A=!1){let P=Y.pop();P&&(A?(y={...P.descriptions,...y},g=[...P.commands,...g],b=[...P.usages,...b],u=[...P.examples,...u],x=[...P.epilogs,...x]):{failMessage:i,failureOutput:p,usages:b,usageDisabled:d,epilogs:x,examples:u,commands:g,descriptions:y}=P)},n}function mr(r){return typeof r=="object"}function Ra(r,t){return mr(r)?{text:r.text,indentation:r.indentation+t}:{text:r,indentation:t}}function Gs(r){return mr(r)?r.indentation:0}function sn(r){return mr(r)?r.text:r}var Ks=`###-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
|
-
`,
|
|
40
|
+
`,Js=`#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
|
|
59
|
+
`;var gr=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,p=t.length;c<p;++c)if(i[t[c]]&&i[t[c]].builder){let b=i[t[c]].builder;if(rn(b)){this.indexAfterLastReset=c+1;let d=this.yargs.getInternalMethods().reset();return b(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 p=!!i.configuration["boolean-negation"]&&i.boolean.includes(c);!o.includes(c)&&!i.hiddenOptions.includes(c)&&!this.argsContainKey(e,c,p)&&this.completeOptionKey(c,t,s,p&&!!i.default[c])})}}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 p=this.yargs.getOptions().choices[c]||[];for(let b of p)b.startsWith(s)&&t.push(b.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 p of o)if(Object.prototype.hasOwnProperty.call(i.key,p)&&Array.isArray(i.choices[p])){c=i.choices[p];break}if(c)return c.filter(p=>!n||p.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,s){var i,o,c,p;let b=t;if(this.zshShell){let y=this.usage.getDescriptions(),x=(o=(i=this===null||this===void 0?void 0:this.aliases)===null||i===void 0?void 0:i[t])===null||o===void 0?void 0:o.find($=>{let N=y[$];return typeof N=="string"&&N.length>0}),C=x?y[x]:void 0,m=(p=(c=y[t])!==null&&c!==void 0?c:C)!==null&&p!==void 0?p:"";b=`${t.replace(/:/g,"\\:")}:${m.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let d=y=>/^--/.test(y),u=y=>/^[^0-9]$/.test(y),g=!d(n)&&u(t)?"-":"--";e.push(g+b),s&&e.push(g+"no-"+b)}customCompletion(t,e,n,s){if(pt(this.customCompletionFunction,null,this.shim),Ba(this.customCompletionFunction)){let i=this.customCompletionFunction(n,e);return Q(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 Va(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 Q(s)?s.then(i):i(s)}generateCompletionScript(t,e){let n=this.zshShell?Js:Ks,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 Qs(r,t,e,n){return new gr(r,t,e,n)}function Ba(r){return r.length<3}function Va(r){return r.length>3}function Xs(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 Zs=["$0","--","_"];function ks(r,t,e){let n=e.y18n.__,s=e.y18n.__n,i={};i.nonOptionCount=function(u){let g=r.getDemandedCommands(),x=u._.length+(u["--"]?u["--"].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(u,g){g<u&&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+"",u+""))},i.requiredArguments=function(u,g){let y=null;for(let x of Object.keys(g))(!Object.prototype.hasOwnProperty.call(u,x)||typeof u[x]>"u")&&(y=y||{},y[x]=g[x]);if(y){let x=[];for(let m of Object.keys(y)){let $=y[m];$&&x.indexOf($)<0&&x.push($)}let C=x.length?`
|
|
60
60
|
${x.join(`
|
|
61
|
-
`)}`:"";t.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(y).length,Object.keys(y).join(", ")+
|
|
62
|
-
${n("Argument: %s, Given: %s, Choices: %s",m,t.stringifiedValues(y[m]),t.stringifiedValues(g.choices[m]))}`}),t.fail(
|
|
63
|
-
`;g.forEach(x=>{y+=x}),t.fail(y)}};let p={};i.conflicts=function(u,g){_("<string|object> [array|string]",[u,g],arguments.length),typeof u=="object"?Object.keys(u).forEach(y=>{i.conflicts(y,u[y])}):(r.global(u),p[u]||(p[u]=[]),Array.isArray(g)?g.forEach(y=>i.conflicts(u,y)):p[u].push(g))},i.getConflicting=()=>p,i.conflicting=function(u){Object.keys(u).forEach(g=>{p[g]&&p[g].forEach(y=>{y&&u[g]!==void 0&&u[y]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",g,y))})}),r.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(p).forEach(g=>{p[g].forEach(y=>{y&&u[e.Parser.camelCase(g)]!==void 0&&u[e.Parser.camelCase(y)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",g,y))})})},i.recommendCommands=function(u,g){g=g.sort((m,$)=>$.length-m.length);let x=null,O=1/0;for(let m=0,$;($=g[m])!==void 0;m++){let N=Js(u,$);N<=3&&N<O&&(O=N,x=$)}x&&t.fail(n("Did you mean %s?",x))},i.reset=function(u){return o=qt(o,g=>!u[g]),p=qt(p,g=>!u[g]),i};let b=[];return i.freeze=function(){b.push({implied:o,conflicting:p})},i.unfreeze=function(){let u=b.pop();pt(u,void 0,e),{implied:o,conflicting:p}=u},i}var gr=[],Ue;function sn(r,t,e,n){Ue=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=qa(t,r.extends);else try{o=G.resolve(r.extends)}catch{return r}Ha(o),gr.push(o),s=i?JSON.parse(Ue.readFileSync(o,"utf8")):G(r.extends),delete r.extends,s=sn(s,Ue.path.dirname(o),e,Ue)}return gr=[],e?Zs(s,r):Object.assign({},s,r)}function Ha(r){if(gr.indexOf(r)>-1)throw new J(`Circular extended configurations: '${r}'.`)}function qa(r,t){return Ue.path.resolve(r,t)}function Zs(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]=Zs(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,re,De,_t,yt,on,Yt,se,an,St,cn,Pt,Nt,xt,It,ln,Se,lt,v,fn,hn,Ot,ie,Pe,oe,Kt,un,D,ae,ce,le,z,dn,Ut,rt;function wi(r){return(t=[],e=r.process.cwd(),n)=>{let s=new Pr(t,e,n,r);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}var ks=Symbol("copyDoubleDash"),ti=Symbol("copyDoubleDash"),br=Symbol("deleteFromParserHintObject"),ei=Symbol("emitWarning"),ni=Symbol("freeze"),ri=Symbol("getDollarZero"),fe=Symbol("getParserConfiguration"),si=Symbol("getUsageConfiguration"),wr=Symbol("guessLocale"),ii=Symbol("guessVersion"),oi=Symbol("parsePositionalNumbers"),yr=Symbol("pkgUp"),Jt=Symbol("populateParserHintArray"),Ie=Symbol("populateParserHintSingleValueDictionary"),xr=Symbol("populateParserHintArrayDictionary"),Or=Symbol("populateParserHintDictionary"),Ar=Symbol("sanitizeKey"),Cr=Symbol("setKey"),Er=Symbol("unfreeze"),ai=Symbol("validateAsync"),ci=Symbol("getCommandInstance"),li=Symbol("getContext"),fi=Symbol("getHasOutput"),hi=Symbol("getLoggerInstance"),ui=Symbol("getParseContext"),di=Symbol("getUsageInstance"),pi=Symbol("getValidationInstance"),pn=Symbol("hasParseCallback"),mi=Symbol("isGlobalContext"),he=Symbol("postProcess"),gi=Symbol("rebase"),_r=Symbol("reset"),Te=Symbol("runYargsParserAndExecuteCommands"),Sr=Symbol("runValidation"),bi=Symbol("setHasOutput"),ue=Symbol("kTrackManuallySetKeys"),Pr=class{constructor(t=[],e,n,s){this.customScriptName=!1,this.parsed=!1,it.set(this,void 0),re.set(this,void 0),De.set(this,{commands:[],fullCommands:[]}),_t.set(this,null),yt.set(this,null),on.set(this,"show-hidden"),Yt.set(this,null),se.set(this,!0),an.set(this,{}),St.set(this,!0),cn.set(this,[]),Pt.set(this,void 0),Nt.set(this,{}),xt.set(this,!1),It.set(this,null),ln.set(this,!0),Se.set(this,void 0),lt.set(this,""),v.set(this,void 0),fn.set(this,void 0),hn.set(this,{}),Ot.set(this,null),ie.set(this,null),Pe.set(this,{}),oe.set(this,{}),Kt.set(this,void 0),un.set(this,!1),D.set(this,void 0),ae.set(this,!1),ce.set(this,!1),le.set(this,!1),z.set(this,void 0),dn.set(this,{}),Ut.set(this,null),rt.set(this,void 0),S(this,D,s,"f"),S(this,Kt,t,"f"),S(this,re,e,"f"),S(this,fn,n,"f"),S(this,Pt,new en(this),"f"),this.$0=this[ri](),this[_r](),S(this,it,a(this,it,"f"),"f"),S(this,z,a(this,z,"f"),"f"),S(this,rt,a(this,rt,"f"),"f"),S(this,v,a(this,v,"f"),"f"),a(this,v,"f").showHiddenOpt=a(this,on,"f"),S(this,Se,this[ti](),"f")}addHelpOpt(t,e){let n="help";return _("[string|boolean] [string]",[t,e],arguments.length),a(this,It,"f")&&(this[br](a(this,It,"f")),S(this,It,null,"f")),t===!1&&e===void 0?this:(S(this,It,typeof t=="string"?t:n,"f"),this.boolean(a(this,It,"f")),this.describe(a(this,It,"f"),e||a(this,z,"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,on,"f");return this.boolean(n),this.describe(n,e||a(this,z,"f").deferY18nLookup("Show hidden options")),a(this,v,"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[xr](this.alias.bind(this),"alias",t,e),this}array(t){return _("<array|string>",[t],arguments.length),this[Jt]("array",t),this[ue](t),this}boolean(t){return _("<array|string>",[t],arguments.length),this[Jt]("boolean",t),this[ue](t),this}check(t,e){return _("<function> [boolean]",[t,e],arguments.length),this.middleware((n,s)=>ne(()=>t(n,s.getOptions()),i=>(i?(typeof i=="string"||i instanceof Error)&&a(this,z,"f").fail(i.toString(),i):a(this,z,"f").fail(a(this,D,"f").y18n.__("Argument check failed: %s",t.toString())),n),i=>(a(this,z,"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[xr](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 J("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 J("coerce callback must be provided");return a(this,v,"f").key[t]=!0,a(this,Pt,"f").addCoerceMiddleware((n,s)=>{let i;return Object.prototype.hasOwnProperty.call(n,t)?ne(()=>(i=s.getAliases(),e(n[t])),c=>{n[t]=c;let p=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&p!==!0)for(let b of i[t])n[b]=c;return n},c=>{throw new J(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=sn(t,a(this,re,"f"),this[fe]()["deep-merge-config"]||!1,a(this,D,"f")),a(this,v,"f").configObjects=(a(this,v,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||a(this,z,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(s=>{a(this,v,"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,yt,t||a(this,yt,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(a(this,yt,"f"),e),n&&a(this,_t,"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,fn,"f")||a(this,D,"f").require;return a(this,it,"f").addDirectory(t,n,a(this,D,"f").getCallerFile(),e),this}count(t){return _("<array|string>",[t],arguments.length),this[Jt]("count",t),this[ue](t),this}default(t,e,n){return _("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(hr(t,a(this,D,"f")),a(this,v,"f").defaultDescription[t]=n),typeof e=="function"&&(hr(t,a(this,D,"f")),a(this,v,"f").defaultDescription[t]||(a(this,v,"f").defaultDescription[t]=a(this,z,"f").functionDescription(e)),e=e.call()),this[Ie](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,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,v,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:s},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(s=>{pt(n,!0,a(this,D,"f")),this.demandOption(s,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(pt(n,!0,a(this,D,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(s=>{pt(n,!0,a(this,D,"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[Ie](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return _("<string> [string|boolean]",[t,e],arguments.length),a(this,v,"f").deprecatedOptions[t]=e,this}describe(t,e){return _("<object|string|array> [string]",[t,e],arguments.length),this[Cr](t,!0),a(this,z,"f").describe(t,e),this}detectLocale(t){return _("<boolean>",[t],arguments.length),S(this,se,t,"f"),this}env(t){return _("[string|boolean]",[t],arguments.length),t===!1?delete a(this,v,"f").envPrefix:a(this,v,"f").envPrefix=t||"",this}epilogue(t){return _("<string>",[t],arguments.length),a(this,z,"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,z,"f").example(t,e),this}exit(t,e){S(this,xt,!0,"f"),S(this,Yt,e,"f"),a(this,St,"f")&&a(this,D,"f").process.exit(t)}exitProcess(t=!0){return _("[boolean]",[t],arguments.length),S(this,St,t,"f"),this}fail(t){if(_("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new J("Invalid first argument. Expected function or boolean 'false'");return a(this,z,"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,_t,"f").getCompletion(t,e):new Promise((n,s)=>{a(this,_t,"f").getCompletion(t,(i,o)=>{i?s(i):n(o)})})}getDemandedOptions(){return _([],0),a(this,v,"f").demandedOptions}getDemandedCommands(){return _([],0),a(this,v,"f").demandedCommands}getDeprecatedOptions(){return _([],0),a(this,v,"f").deprecatedOptions}getDetectLocale(){return a(this,se,"f")}getExitProcess(){return a(this,St,"f")}getGroups(){return Object.assign({},a(this,Nt,"f"),a(this,oe,"f"))}getHelp(){if(S(this,xt,!0,"f"),!a(this,z,"f").hasCachedHelpMessage()){if(!this.parsed){let e=this[Te](a(this,Kt,"f"),void 0,void 0,0,!0);if(Q(e))return e.then(()=>a(this,z,"f").help())}let t=a(this,it,"f").runDefaultBuilderOn(this);if(Q(t))return t.then(()=>a(this,z,"f").help())}return Promise.resolve(a(this,z,"f").help())}getOptions(){return a(this,v,"f")}getStrict(){return a(this,ae,"f")}getStrictCommands(){return a(this,ce,"f")}getStrictOptions(){return a(this,le,"f")}global(t,e){return _("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?a(this,v,"f").local=a(this,v,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{a(this,v,"f").local.includes(n)||a(this,v,"f").local.push(n)}),this}group(t,e){_("<string|array> <string>",[t,e],arguments.length);let n=a(this,oe,"f")[e]||a(this,Nt,"f")[e];a(this,oe,"f")[e]&&delete a(this,oe,"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,v,"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[wr](),a(this,D,"f").y18n.getLocale()):(S(this,se,!1,"f"),a(this,D,"f").y18n.setLocale(t),this)}middleware(t,e,n){return a(this,Pt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return _("<string|object|array> [number]",[t,e],arguments.length),this[Ie](this.nargs.bind(this),"narg",t,e),this}normalize(t){return _("<array|string>",[t],arguments.length),this[Jt]("normalize",t),this}number(t){return _("<array|string>",[t],arguments.length),this[Jt]("number",t),this[ue](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[ue](t),a(this,Ut,"f")&&(t==="version"||e?.alias==="version")&&this[ei](['"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,v,"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,v,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);let i=e.describe||e.description||e.desc,o=a(this,z,"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[
|
|
65
|
-
`,"f"),S(this,lt,a(this,lt,"f")+t.join(" "),"f")},error:(...t)=>{this[
|
|
66
|
-
`,"f"),S(this,lt,a(this,lt,"f")+t.join(" "),"f")}}}[br](t){Ee(a(this,v,"f")).forEach(e=>{if((s=>s==="configObjects")(e))return;let n=a(this,v,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete a(this,z,"f").getDescriptions()[t]}[ei](t,e,n){a(this,an,"f")[n]||(a(this,D,"f").process.emitWarning(t,e),a(this,an,"f")[n]=!0)}[ni](){a(this,cn,"f").push({options:a(this,v,"f"),configObjects:a(this,v,"f").configObjects.slice(0),exitProcess:a(this,St,"f"),groups:a(this,Nt,"f"),strict:a(this,ae,"f"),strictCommands:a(this,ce,"f"),strictOptions:a(this,le,"f"),completionCommand:a(this,yt,"f"),output:a(this,lt,"f"),exitError:a(this,Yt,"f"),hasOutput:a(this,xt,"f"),parsed:this.parsed,parseFn:a(this,Ot,"f"),parseContext:a(this,ie,"f")}),a(this,z,"f").freeze(),a(this,rt,"f").freeze(),a(this,it,"f").freeze(),a(this,Pt,"f").freeze()}[ri](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(a(this,D,"f").process.argv()[0])?e=a(this,D,"f").process.argv().slice(1,2):e=a(this,D,"f").process.argv().slice(0,1),t=e.map(n=>{let s=this[gi](a(this,re,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<n.length?s:n}).join(" ").trim(),a(this,D,"f").getEnv("_")&&a(this,D,"f").getProcessArgvBin()===a(this,D,"f").getEnv("_")&&(t=a(this,D,"f").getEnv("_").replace(`${a(this,D,"f").path.dirname(a(this,D,"f").process.execPath())}/`,"")),t}[fe](){return a(this,hn,"f")}[si](){return a(this,dn,"f")}[wr](){if(!a(this,se,"f"))return;let t=a(this,D,"f").getEnv("LC_ALL")||a(this,D,"f").getEnv("LC_MESSAGES")||a(this,D,"f").getEnv("LANG")||a(this,D,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[ii](){return this[yr]().version||"unknown"}[oi](t){let e=t["--"]?t["--"]:t._;for(let n=0,s;(s=e[n])!==void 0;n++)a(this,D,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(e[n]=Number(s));return t}[yr](t){let e=t||"*";if(a(this,Pe,"f")[e])return a(this,Pe,"f")[e];let n={};try{let s=t||a(this,D,"f").mainFilename;!t&&a(this,D,"f").path.extname(s)&&(s=a(this,D,"f").path.dirname(s));let i=a(this,D,"f").findUp(s,(o,c)=>{if(c.includes("package.json"))return"package.json"});pt(i,void 0,a(this,D,"f")),n=JSON.parse(a(this,D,"f").readFileSync(i,"utf8"))}catch{}return a(this,Pe,"f")[e]=n||{},a(this,Pe,"f")[e]}[Jt](t,e){e=[].concat(e),e.forEach(n=>{n=this[Ar](n),a(this,v,"f")[t].push(n)})}[Ie](t,e,n,s){this[Or](t,e,n,s,(i,o,c)=>{a(this,v,"f")[i][o]=c})}[xr](t,e,n,s){this[Or](t,e,n,s,(i,o,c)=>{a(this,v,"f")[i][o]=(a(this,v,"f")[i][o]||[]).concat(c)})}[Or](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 Ee(n))t(o,n[o]);else i(e,this[Ar](n),s)}[Ar](t){return t==="__proto__"?"___proto___":t}[Cr](t,e){return this[Ie](this[Cr].bind(this),"key",t,e),this}[Er](){var t,e,n,s,i,o,c,p,b,d,u,g;let y=a(this,cn,"f").pop();pt(y,void 0,a(this,D,"f"));let x;t=this,e=this,n=this,s=this,i=this,o=this,c=this,p=this,b=this,d=this,u=this,g=this,{options:{set value(O){S(t,v,O,"f")}}.value,configObjects:x,exitProcess:{set value(O){S(e,St,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,Yt,O,"f")}}.value,hasOutput:{set value(O){S(o,xt,O,"f")}}.value,parsed:this.parsed,strict:{set value(O){S(c,ae,O,"f")}}.value,strictCommands:{set value(O){S(p,ce,O,"f")}}.value,strictOptions:{set value(O){S(b,le,O,"f")}}.value,completionCommand:{set value(O){S(d,yt,O,"f")}}.value,parseFn:{set value(O){S(u,Ot,O,"f")}}.value,parseContext:{set value(O){S(g,ie,O,"f")}}.value}=y,a(this,v,"f").configObjects=x,a(this,z,"f").unfreeze(),a(this,rt,"f").unfreeze(),a(this,it,"f").unfreeze(),a(this,Pt,"f").unfreeze()}[ai](t,e){return ne(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[ci].bind(this),getContext:this[li].bind(this),getHasOutput:this[fi].bind(this),getLoggerInstance:this[hi].bind(this),getParseContext:this[ui].bind(this),getParserConfiguration:this[fe].bind(this),getUsageConfiguration:this[si].bind(this),getUsageInstance:this[di].bind(this),getValidationInstance:this[pi].bind(this),hasParseCallback:this[pn].bind(this),isGlobalContext:this[mi].bind(this),postProcess:this[he].bind(this),reset:this[_r].bind(this),runValidation:this[Sr].bind(this),runYargsParserAndExecuteCommands:this[Te].bind(this),setHasOutput:this[bi].bind(this)}}[ci](){return a(this,it,"f")}[li](){return a(this,De,"f")}[fi](){return a(this,xt,"f")}[hi](){return a(this,Se,"f")}[ui](){return a(this,ie,"f")||{}}[di](){return a(this,z,"f")}[pi](){return a(this,rt,"f")}[pn](){return!!a(this,Ot,"f")}[mi](){return a(this,ln,"f")}[he](t,e,n,s){return n||Q(t)||(e||(t=this[ks](t)),(this[fe]()["parse-positional-numbers"]||this[fe]()["parse-positional-numbers"]===void 0)&&(t=this[oi](t)),s&&(t=ee(t,this,a(this,Pt,"f").getMiddleware(),!1))),t}[_r](t={}){S(this,v,a(this,v,"f")||{},"f");let e={};e.local=a(this,v,"f").local||[],e.configObjects=a(this,v,"f").configObjects||[];let n={};e.local.forEach(o=>{n[o]=!0,(t[o]||[]).forEach(c=>{n[c]=!0})}),Object.assign(a(this,oe,"f"),Object.keys(a(this,Nt,"f")).reduce((o,c)=>{let p=a(this,Nt,"f")[c].filter(b=>!(b in n));return p.length>0&&(o[c]=p),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,v,"f")[o]||[]).filter(c=>!n[c])}),i.forEach(o=>{e[o]=qt(a(this,v,"f")[o],c=>!n[c])}),e.envPrefix=a(this,v,"f").envPrefix,S(this,v,e,"f"),S(this,z,a(this,z,"f")?a(this,z,"f").reset(n):qs(this,a(this,D,"f")),"f"),S(this,rt,a(this,rt,"f")?a(this,rt,"f").reset(n):Xs(this,a(this,z,"f"),a(this,D,"f")),"f"),S(this,it,a(this,it,"f")?a(this,it,"f").reset():Bs(a(this,z,"f"),a(this,rt,"f"),a(this,Pt,"f"),a(this,D,"f")),"f"),a(this,_t,"f")||S(this,_t,Ks(this,a(this,z,"f"),a(this,it,"f"),a(this,D,"f")),"f"),a(this,Pt,"f").reset(),S(this,yt,null,"f"),S(this,lt,"","f"),S(this,Yt,null,"f"),S(this,xt,!1,"f"),this.parsed=!1,this}[gi](t,e){return a(this,D,"f").path.relative(t,e)}[Te](t,e,n,s=0,i=!1){let o=!!n||i;t=t||a(this,Kt,"f"),a(this,v,"f").__=a(this,D,"f").y18n.__,a(this,v,"f").configuration=this[fe]();let c=!!a(this,v,"f").configuration["populate--"],p=Object.assign({},a(this,v,"f").configuration,{"populate--":!0}),b=a(this,D,"f").Parser.detailed(t,Object.assign({},a(this,v,"f"),{configuration:{"parse-positional-numbers":!1,...p}})),d=Object.assign(b.argv,a(this,ie,"f")),u,g=b.aliases,y=!1,x=!1;Object.keys(d).forEach(O=>{O===a(this,It,"f")&&d[O]?y=!0:O===a(this,Ut,"f")&&d[O]&&(x=!0)}),d.$0=this.$0,this.parsed=b,s===0&&a(this,z,"f").clearCachedHelpMessage();try{if(this[wr](),e)return this[he](d,c,!!n,!1);a(this,It,"f")&&[a(this,It,"f")].concat(g[a(this,It,"f")]||[]).filter(R=>R.length>1).includes(""+d._[d._.length-1])&&(d._.pop(),y=!0),S(this,ln,!1,"f");let O=a(this,it,"f").getCommands(),m=a(this,_t,"f").completionKey in d,$=y||m||i;if(d._.length){if(O.length){let N;for(let R=s||0,T;d._[R]!==void 0;R++)if(T=String(d._[R]),O.includes(T)&&T!==a(this,yt,"f")){let W=a(this,it,"f").runCommand(T,this,b,R+1,i,y||x||i);return this[he](W,c,!!n,!1)}else if(!N&&T!==a(this,yt,"f")){N=T;break}!a(this,it,"f").hasDefaultCommand()&&a(this,un,"f")&&N&&!$&&a(this,rt,"f").recommendCommands(N,O)}a(this,yt,"f")&&d._.includes(a(this,yt,"f"))&&!m&&(a(this,St,"f")&&Gt(!0),this.showCompletionScript(),this.exit(0))}if(a(this,it,"f").hasDefaultCommand()&&!$){let N=a(this,it,"f").runCommand(null,this,b,0,i,y||x||i);return this[he](N,c,!!n,!1)}if(m){a(this,St,"f")&&Gt(!0),t=[].concat(t);let N=t.slice(t.indexOf(`--${a(this,_t,"f").completionKey}`)+1);return a(this,_t,"f").getCompletion(N,(R,T)=>{if(R)throw new J(R.message);(T||[]).forEach(W=>{a(this,Se,"f").log(W)}),this.exit(0)}),this[he](d,!c,!!n,!1)}if(a(this,xt,"f")||(y?(a(this,St,"f")&&Gt(!0),o=!0,this.showHelp("log"),this.exit(0)):x&&(a(this,St,"f")&&Gt(!0),o=!0,a(this,z,"f").showVersion("log"),this.exit(0))),!o&&a(this,v,"f").skipValidation.length>0&&(o=Object.keys(d).some(N=>a(this,v,"f").skipValidation.indexOf(N)>=0&&d[N]===!0)),!o){if(b.error)throw new J(b.error.message);if(!m){let N=this[Sr](g,{},b.error);n||(u=ee(d,this,a(this,Pt,"f").getMiddleware(),!0)),u=this[ai](N,u??d),Q(u)&&!n&&(u=u.then(()=>ee(d,this,a(this,Pt,"f").getMiddleware(),!1)))}}}catch(O){if(O instanceof J)a(this,z,"f").fail(O.message,O);else throw O}return this[he](u??d,c,!!n,!0)}[Sr](t,e,n,s){let i={...this.getDemandedOptions()};return o=>{if(n)throw new J(n.message);a(this,rt,"f").nonOptionCount(o),a(this,rt,"f").requiredArguments(o,i);let c=!1;a(this,ce,"f")&&(c=a(this,rt,"f").unknownCommands(o)),a(this,ae,"f")&&!c?a(this,rt,"f").unknownArguments(o,t,e,!!s):a(this,le,"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)}}[bi](){S(this,xt,!0,"f")}[ue](t){if(typeof t=="string")a(this,v,"f").key[t]=!0;else for(let e of t)a(this,v,"f").key[e]=!0}};function Vs(r){return!!r&&typeof r.getInternalMethods=="function"}var Ga=wi(Ts),yi=Ga;var Ci=Re(Oi(),1),Ja={},Ya=process.argv.slice(2),Ai=new Ci.default(yi),jr=console.log;async function vr(r){Ai.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;Ya.length>0&&jr(s),o.showHelp()});let{data:t,argv:e}=await Ai.parse(r);t!=null&&(jr(t),process.exit(0)),await(await Ei(Zn(e.listen),e)).start(),e.quiet!==!0&&jr("daemon has started")}async function Ei(r,t){throw new Error("Not implemented yet")}nr(Ja)&&vr(process.argv).catch(r=>{console.error(r),process.exit(1)});return Mi(Ka);})();
|
|
61
|
+
`)}`:"";t.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(y).length,Object.keys(y).join(", ")+C))}},i.unknownArguments=function(u,g,y,x,C=!0){var m;let $=r.getInternalMethods().getCommandInstance().getCommands(),N=[],R=r.getInternalMethods().getContext();if(Object.keys(u).forEach(T=>{!Zs.includes(T)&&!Object.prototype.hasOwnProperty.call(y,T)&&!Object.prototype.hasOwnProperty.call(r.getInternalMethods().getParseContext(),T)&&!i.isValidAndSomeAliasIsNotNew(T,g)&&N.push(T)}),C&&(R.commands.length>0||$.length>0||x)&&u._.slice(R.commands.length).forEach(T=>{$.includes(""+T)||N.push(""+T)}),C){let W=((m=r.getDemandedCommands()._)===null||m===void 0?void 0:m.max)||0,ft=R.commands.length+W;ft<u._.length&&u._.slice(ft).forEach(Z=>{Z=String(Z),!R.commands.includes(Z)&&!N.includes(Z)&&N.push(Z)})}N.length&&t.fail(s("Unknown argument: %s","Unknown arguments: %s",N.length,N.map(T=>T.trim()?T:`"${T}"`).join(", ")))},i.unknownCommands=function(u){let g=r.getInternalMethods().getCommandInstance().getCommands(),y=[],x=r.getInternalMethods().getContext();return(x.commands.length>0||g.length>0)&&u._.slice(x.commands.length).forEach(C=>{g.includes(""+C)||y.push(""+C)}),y.length>0?(t.fail(s("Unknown command: %s","Unknown commands: %s",y.length,y.join(", "))),!0):!1},i.isValidAndSomeAliasIsNotNew=function(u,g){if(!Object.prototype.hasOwnProperty.call(g,u))return!1;let y=r.parsed.newAliases;return[u,...g[u]].some(x=>!Object.prototype.hasOwnProperty.call(y,x)||!y[u])},i.limitedChoices=function(u){let g=r.getOptions(),y={};if(!Object.keys(g.choices).length)return;Object.keys(u).forEach(m=>{Zs.indexOf(m)===-1&&Object.prototype.hasOwnProperty.call(g.choices,m)&&[].concat(u[m]).forEach($=>{g.choices[m].indexOf($)===-1&&$!==void 0&&(y[m]=(y[m]||[]).concat($))})});let x=Object.keys(y);if(!x.length)return;let C=n("Invalid values:");x.forEach(m=>{C+=`
|
|
62
|
+
${n("Argument: %s, Given: %s, Choices: %s",m,t.stringifiedValues(y[m]),t.stringifiedValues(g.choices[m]))}`}),t.fail(C)};let o={};i.implies=function(u,g){_("<string|object> [array|number|string]",[u,g],arguments.length),typeof u=="object"?Object.keys(u).forEach(y=>{i.implies(y,u[y])}):(r.global(u),o[u]||(o[u]=[]),Array.isArray(g)?g.forEach(y=>i.implies(u,y)):(pt(g,void 0,e),o[u].push(g)))},i.getImplied=function(){return o};function c(d,u){let g=Number(u);return u=isNaN(g)?u:g,typeof u=="number"?u=d._.length>=u:u.match(/^--no-.+/)?(u=u.match(/^--no-(.+)/)[1],u=!Object.prototype.hasOwnProperty.call(d,u)):u=Object.prototype.hasOwnProperty.call(d,u),u}i.implications=function(u){let g=[];if(Object.keys(o).forEach(y=>{let x=y;(o[y]||[]).forEach(C=>{let m=x,$=C;m=c(u,m),C=c(u,C),m&&!C&&g.push(` ${x} -> ${$}`)})}),g.length){let y=`${n("Implications failed:")}
|
|
63
|
+
`;g.forEach(x=>{y+=x}),t.fail(y)}};let p={};i.conflicts=function(u,g){_("<string|object> [array|string]",[u,g],arguments.length),typeof u=="object"?Object.keys(u).forEach(y=>{i.conflicts(y,u[y])}):(r.global(u),p[u]||(p[u]=[]),Array.isArray(g)?g.forEach(y=>i.conflicts(u,y)):p[u].push(g))},i.getConflicting=()=>p,i.conflicting=function(u){Object.keys(u).forEach(g=>{p[g]&&p[g].forEach(y=>{y&&u[g]!==void 0&&u[y]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",g,y))})}),r.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(p).forEach(g=>{p[g].forEach(y=>{y&&u[e.Parser.camelCase(g)]!==void 0&&u[e.Parser.camelCase(y)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",g,y))})})},i.recommendCommands=function(u,g){g=g.sort((m,$)=>$.length-m.length);let x=null,C=1/0;for(let m=0,$;($=g[m])!==void 0;m++){let N=Xs(u,$);N<=3&&N<C&&(C=N,x=$)}x&&t.fail(n("Did you mean %s?",x))},i.reset=function(u){return o=qt(o,g=>!u[g]),p=qt(p,g=>!u[g]),i};let b=[];return i.freeze=function(){b.push({implied:o,conflicting:p})},i.unfreeze=function(){let u=b.pop();pt(u,void 0,e),{implied:o,conflicting:p}=u},i}var br=[],Ue;function on(r,t,e,n){Ue=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=qa(t,r.extends);else try{o=G.resolve(r.extends)}catch{return r}Ha(o),br.push(o),s=i?JSON.parse(Ue.readFileSync(o,"utf8")):G(r.extends),delete r.extends,s=on(s,Ue.path.dirname(o),e,Ue)}return br=[],e?ti(s,r):Object.assign({},s,r)}function Ha(r){if(br.indexOf(r)>-1)throw new J(`Circular extended configurations: '${r}'.`)}function qa(r,t){return Ue.path.resolve(r,t)}function ti(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]=ti(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,De,_t,yt,an,Yt,ie,cn,St,ln,Pt,Nt,xt,It,fn,Se,lt,v,hn,un,Ct,oe,Pe,ae,Kt,dn,D,ce,le,fe,z,pn,Ut,rt;function xi(r){return(t=[],e=r.process.cwd(),n)=>{let s=new Ir(t,e,n,r);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}var ei=Symbol("copyDoubleDash"),ni=Symbol("copyDoubleDash"),wr=Symbol("deleteFromParserHintObject"),ri=Symbol("emitWarning"),si=Symbol("freeze"),ii=Symbol("getDollarZero"),he=Symbol("getParserConfiguration"),oi=Symbol("getUsageConfiguration"),yr=Symbol("guessLocale"),ai=Symbol("guessVersion"),ci=Symbol("parsePositionalNumbers"),xr=Symbol("pkgUp"),Jt=Symbol("populateParserHintArray"),Ie=Symbol("populateParserHintSingleValueDictionary"),Cr=Symbol("populateParserHintArrayDictionary"),Or=Symbol("populateParserHintDictionary"),Ar=Symbol("sanitizeKey"),Er=Symbol("setKey"),_r=Symbol("unfreeze"),li=Symbol("validateAsync"),fi=Symbol("getCommandInstance"),hi=Symbol("getContext"),ui=Symbol("getHasOutput"),di=Symbol("getLoggerInstance"),pi=Symbol("getParseContext"),mi=Symbol("getUsageInstance"),gi=Symbol("getValidationInstance"),mn=Symbol("hasParseCallback"),bi=Symbol("isGlobalContext"),ue=Symbol("postProcess"),wi=Symbol("rebase"),Sr=Symbol("reset"),Te=Symbol("runYargsParserAndExecuteCommands"),Pr=Symbol("runValidation"),yi=Symbol("setHasOutput"),de=Symbol("kTrackManuallySetKeys"),Ir=class{constructor(t=[],e,n,s){this.customScriptName=!1,this.parsed=!1,it.set(this,void 0),se.set(this,void 0),De.set(this,{commands:[],fullCommands:[]}),_t.set(this,null),yt.set(this,null),an.set(this,"show-hidden"),Yt.set(this,null),ie.set(this,!0),cn.set(this,{}),St.set(this,!0),ln.set(this,[]),Pt.set(this,void 0),Nt.set(this,{}),xt.set(this,!1),It.set(this,null),fn.set(this,!0),Se.set(this,void 0),lt.set(this,""),v.set(this,void 0),hn.set(this,void 0),un.set(this,{}),Ct.set(this,null),oe.set(this,null),Pe.set(this,{}),ae.set(this,{}),Kt.set(this,void 0),dn.set(this,!1),D.set(this,void 0),ce.set(this,!1),le.set(this,!1),fe.set(this,!1),z.set(this,void 0),pn.set(this,{}),Ut.set(this,null),rt.set(this,void 0),S(this,D,s,"f"),S(this,Kt,t,"f"),S(this,se,e,"f"),S(this,hn,n,"f"),S(this,Pt,new nn(this),"f"),this.$0=this[ii](),this[Sr](),S(this,it,a(this,it,"f"),"f"),S(this,z,a(this,z,"f"),"f"),S(this,rt,a(this,rt,"f"),"f"),S(this,v,a(this,v,"f"),"f"),a(this,v,"f").showHiddenOpt=a(this,an,"f"),S(this,Se,this[ni](),"f")}addHelpOpt(t,e){let n="help";return _("[string|boolean] [string]",[t,e],arguments.length),a(this,It,"f")&&(this[wr](a(this,It,"f")),S(this,It,null,"f")),t===!1&&e===void 0?this:(S(this,It,typeof t=="string"?t:n,"f"),this.boolean(a(this,It,"f")),this.describe(a(this,It,"f"),e||a(this,z,"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,an,"f");return this.boolean(n),this.describe(n,e||a(this,z,"f").deferY18nLookup("Show hidden options")),a(this,v,"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[Jt]("array",t),this[de](t),this}boolean(t){return _("<array|string>",[t],arguments.length),this[Jt]("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,z,"f").fail(i.toString(),i):a(this,z,"f").fail(a(this,D,"f").y18n.__("Argument check failed: %s",t.toString())),n),i=>(a(this,z,"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 J("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 J("coerce callback must be provided");return a(this,v,"f").key[t]=!0,a(this,Pt,"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 p=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&p!==!0)for(let b of i[t])n[b]=c;return n},c=>{throw new J(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=on(t,a(this,se,"f"),this[he]()["deep-merge-config"]||!1,a(this,D,"f")),a(this,v,"f").configObjects=(a(this,v,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||a(this,z,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(s=>{a(this,v,"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,yt,t||a(this,yt,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(a(this,yt,"f"),e),n&&a(this,_t,"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,hn,"f")||a(this,D,"f").require;return a(this,it,"f").addDirectory(t,n,a(this,D,"f").getCallerFile(),e),this}count(t){return _("<array|string>",[t],arguments.length),this[Jt]("count",t),this[de](t),this}default(t,e,n){return _("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(ur(t,a(this,D,"f")),a(this,v,"f").defaultDescription[t]=n),typeof e=="function"&&(ur(t,a(this,D,"f")),a(this,v,"f").defaultDescription[t]||(a(this,v,"f").defaultDescription[t]=a(this,z,"f").functionDescription(e)),e=e.call()),this[Ie](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,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,v,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:s},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(s=>{pt(n,!0,a(this,D,"f")),this.demandOption(s,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(pt(n,!0,a(this,D,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(s=>{pt(n,!0,a(this,D,"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[Ie](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return _("<string> [string|boolean]",[t,e],arguments.length),a(this,v,"f").deprecatedOptions[t]=e,this}describe(t,e){return _("<object|string|array> [string]",[t,e],arguments.length),this[Er](t,!0),a(this,z,"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,v,"f").envPrefix:a(this,v,"f").envPrefix=t||"",this}epilogue(t){return _("<string>",[t],arguments.length),a(this,z,"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,z,"f").example(t,e),this}exit(t,e){S(this,xt,!0,"f"),S(this,Yt,e,"f"),a(this,St,"f")&&a(this,D,"f").process.exit(t)}exitProcess(t=!0){return _("[boolean]",[t],arguments.length),S(this,St,t,"f"),this}fail(t){if(_("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new J("Invalid first argument. Expected function or boolean 'false'");return a(this,z,"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,_t,"f").getCompletion(t,e):new Promise((n,s)=>{a(this,_t,"f").getCompletion(t,(i,o)=>{i?s(i):n(o)})})}getDemandedOptions(){return _([],0),a(this,v,"f").demandedOptions}getDemandedCommands(){return _([],0),a(this,v,"f").demandedCommands}getDeprecatedOptions(){return _([],0),a(this,v,"f").deprecatedOptions}getDetectLocale(){return a(this,ie,"f")}getExitProcess(){return a(this,St,"f")}getGroups(){return Object.assign({},a(this,Nt,"f"),a(this,ae,"f"))}getHelp(){if(S(this,xt,!0,"f"),!a(this,z,"f").hasCachedHelpMessage()){if(!this.parsed){let e=this[Te](a(this,Kt,"f"),void 0,void 0,0,!0);if(Q(e))return e.then(()=>a(this,z,"f").help())}let t=a(this,it,"f").runDefaultBuilderOn(this);if(Q(t))return t.then(()=>a(this,z,"f").help())}return Promise.resolve(a(this,z,"f").help())}getOptions(){return a(this,v,"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,v,"f").local=a(this,v,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{a(this,v,"f").local.includes(n)||a(this,v,"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,v,"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[yr](),a(this,D,"f").y18n.getLocale()):(S(this,ie,!1,"f"),a(this,D,"f").y18n.setLocale(t),this)}middleware(t,e,n){return a(this,Pt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return _("<string|object|array> [number]",[t,e],arguments.length),this[Ie](this.nargs.bind(this),"narg",t,e),this}normalize(t){return _("<array|string>",[t],arguments.length),this[Jt]("normalize",t),this}number(t){return _("<array|string>",[t],arguments.length),this[Jt]("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,Ut,"f")&&(t==="version"||e?.alias==="version")&&this[ri](['"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,v,"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,v,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);let i=e.describe||e.description||e.desc,o=a(this,z,"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[si](),typeof t>"u"&&(t=a(this,Kt,"f")),typeof e=="object"&&(S(this,oe,e,"f"),e=n),typeof e=="function"&&(S(this,Ct,e,"f"),e=!1),e||S(this,Kt,t,"f"),a(this,Ct,"f")&&S(this,St,!1,"f");let s=this[Te](t,!!e),i=this.parsed;return a(this,_t,"f").setParsed(this.parsed),Q(s)?s.then(o=>(a(this,Ct,"f")&&a(this,Ct,"f").call(this,a(this,Yt,"f"),o,a(this,lt,"f")),o)).catch(o=>{throw a(this,Ct,"f")&&a(this,Ct,"f")(o,this.parsed.argv,a(this,lt,"f")),o}).finally(()=>{this[_r](),this.parsed=i}):(a(this,Ct,"f")&&a(this,Ct,"f").call(this,a(this,Yt,"f"),s,a(this,lt,"f")),this[_r](),this.parsed=i,s)}parseAsync(t,e,n){let s=this.parse(t,e,n);return Q(s)?s:Promise.resolve(s)}parseSync(t,e,n){let s=this.parse(t,e,n);if(Q(s))throw new J(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}parserConfiguration(t){return _("<object>",[t],arguments.length),S(this,un,t,"f"),this}pkgConf(t,e){_("<string> [string]",[t,e],arguments.length);let n=null,s=this[xr](e||a(this,se,"f"));return s[t]&&typeof s[t]=="object"&&(n=on(s[t],e||a(this,se,"f"),this[he]()["deep-merge-config"]||!1,a(this,D,"f")),a(this,v,"f").configObjects=(a(this,v,"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=qt(e,(o,c)=>o==="type"&&!["string","number","boolean"].includes(c)?!1:n.includes(o));let s=a(this,De,"f").fullCommands[a(this,De,"f").fullCommands.length-1],i=s?a(this,it,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return Ee(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,z,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return _("[boolean]",[t],arguments.length),S(this,dn,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,v,"f").narg[t]?this:(this[Ie](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,_t,"f").generateCompletionScript(t,e||a(this,yt,"f")||"completion")),this}showHelp(t){if(_("[string|function]",[t],arguments.length),S(this,xt,!0,"f"),!a(this,z,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[Te](a(this,Kt,"f"),void 0,void 0,0,!0);if(Q(n))return n.then(()=>{a(this,z,"f").showHelp(t)}),this}let e=a(this,it,"f").runDefaultBuilderOn(this);if(Q(e))return e.then(()=>{a(this,z,"f").showHelp(t)}),this}return a(this,z,"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,z,"f").showHelpOnFail(t,e),this}showVersion(t){return _("[string|function]",[t],arguments.length),a(this,z,"f").showVersion(t),this}skipValidation(t){return _("<array|string>",[t],arguments.length),this[Jt]("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[Jt]("string",t),this[de](t),this}terminalWidth(){return _([],0),a(this,D,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return _("<object>",[t],arguments.length),S(this,ie,!1,"f"),a(this,D,"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(pt(t,null,a(this,D,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,s);throw new J(".usage() description must start with $0 if being used as alias for .command()")}else return a(this,z,"f").usage(t),this}usageConfiguration(t){return _("<object>",[t],arguments.length),S(this,pn,t,"f"),this}version(t,e,n){let s="version";if(_("[boolean|string] [string] [string]",[t,e,n],arguments.length),a(this,Ut,"f")&&(this[wr](a(this,Ut,"f")),a(this,z,"f").version(void 0),S(this,Ut,null,"f")),arguments.length===0)n=this[ai](),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,Ut,typeof t=="string"?t:s,"f"),e=e||a(this,z,"f").deferY18nLookup("Show version number"),a(this,z,"f").version(n||void 0),this.boolean(a(this,Ut,"f")),this.describe(a(this,Ut,"f"),e),this}wrap(t){return _("<number|null|undefined>",[t],arguments.length),a(this,z,"f").wrap(t),this}[(it=new WeakMap,se=new WeakMap,De=new WeakMap,_t=new WeakMap,yt=new WeakMap,an=new WeakMap,Yt=new WeakMap,ie=new WeakMap,cn=new WeakMap,St=new WeakMap,ln=new WeakMap,Pt=new WeakMap,Nt=new WeakMap,xt=new WeakMap,It=new WeakMap,fn=new WeakMap,Se=new WeakMap,lt=new WeakMap,v=new WeakMap,hn=new WeakMap,un=new WeakMap,Ct=new WeakMap,oe=new WeakMap,Pe=new WeakMap,ae=new WeakMap,Kt=new WeakMap,dn=new WeakMap,D=new WeakMap,ce=new WeakMap,le=new WeakMap,fe=new WeakMap,z=new WeakMap,pn=new WeakMap,Ut=new WeakMap,rt=new WeakMap,ei)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[ni](){return{log:(...t)=>{this[mn]()||console.log(...t),S(this,xt,!0,"f"),a(this,lt,"f").length&&S(this,lt,a(this,lt,"f")+`
|
|
65
|
+
`,"f"),S(this,lt,a(this,lt,"f")+t.join(" "),"f")},error:(...t)=>{this[mn]()||console.error(...t),S(this,xt,!0,"f"),a(this,lt,"f").length&&S(this,lt,a(this,lt,"f")+`
|
|
66
|
+
`,"f"),S(this,lt,a(this,lt,"f")+t.join(" "),"f")}}}[wr](t){Ee(a(this,v,"f")).forEach(e=>{if((s=>s==="configObjects")(e))return;let n=a(this,v,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete a(this,z,"f").getDescriptions()[t]}[ri](t,e,n){a(this,cn,"f")[n]||(a(this,D,"f").process.emitWarning(t,e),a(this,cn,"f")[n]=!0)}[si](){a(this,ln,"f").push({options:a(this,v,"f"),configObjects:a(this,v,"f").configObjects.slice(0),exitProcess:a(this,St,"f"),groups:a(this,Nt,"f"),strict:a(this,ce,"f"),strictCommands:a(this,le,"f"),strictOptions:a(this,fe,"f"),completionCommand:a(this,yt,"f"),output:a(this,lt,"f"),exitError:a(this,Yt,"f"),hasOutput:a(this,xt,"f"),parsed:this.parsed,parseFn:a(this,Ct,"f"),parseContext:a(this,oe,"f")}),a(this,z,"f").freeze(),a(this,rt,"f").freeze(),a(this,it,"f").freeze(),a(this,Pt,"f").freeze()}[ii](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(a(this,D,"f").process.argv()[0])?e=a(this,D,"f").process.argv().slice(1,2):e=a(this,D,"f").process.argv().slice(0,1),t=e.map(n=>{let s=this[wi](a(this,se,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<n.length?s:n}).join(" ").trim(),a(this,D,"f").getEnv("_")&&a(this,D,"f").getProcessArgvBin()===a(this,D,"f").getEnv("_")&&(t=a(this,D,"f").getEnv("_").replace(`${a(this,D,"f").path.dirname(a(this,D,"f").process.execPath())}/`,"")),t}[he](){return a(this,un,"f")}[oi](){return a(this,pn,"f")}[yr](){if(!a(this,ie,"f"))return;let t=a(this,D,"f").getEnv("LC_ALL")||a(this,D,"f").getEnv("LC_MESSAGES")||a(this,D,"f").getEnv("LANG")||a(this,D,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[ai](){return this[xr]().version||"unknown"}[ci](t){let e=t["--"]?t["--"]:t._;for(let n=0,s;(s=e[n])!==void 0;n++)a(this,D,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(e[n]=Number(s));return t}[xr](t){let e=t||"*";if(a(this,Pe,"f")[e])return a(this,Pe,"f")[e];let n={};try{let s=t||a(this,D,"f").mainFilename;!t&&a(this,D,"f").path.extname(s)&&(s=a(this,D,"f").path.dirname(s));let i=a(this,D,"f").findUp(s,(o,c)=>{if(c.includes("package.json"))return"package.json"});pt(i,void 0,a(this,D,"f")),n=JSON.parse(a(this,D,"f").readFileSync(i,"utf8"))}catch{}return a(this,Pe,"f")[e]=n||{},a(this,Pe,"f")[e]}[Jt](t,e){e=[].concat(e),e.forEach(n=>{n=this[Ar](n),a(this,v,"f")[t].push(n)})}[Ie](t,e,n,s){this[Or](t,e,n,s,(i,o,c)=>{a(this,v,"f")[i][o]=c})}[Cr](t,e,n,s){this[Or](t,e,n,s,(i,o,c)=>{a(this,v,"f")[i][o]=(a(this,v,"f")[i][o]||[]).concat(c)})}[Or](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 Ee(n))t(o,n[o]);else i(e,this[Ar](n),s)}[Ar](t){return t==="__proto__"?"___proto___":t}[Er](t,e){return this[Ie](this[Er].bind(this),"key",t,e),this}[_r](){var t,e,n,s,i,o,c,p,b,d,u,g;let y=a(this,ln,"f").pop();pt(y,void 0,a(this,D,"f"));let x;t=this,e=this,n=this,s=this,i=this,o=this,c=this,p=this,b=this,d=this,u=this,g=this,{options:{set value(C){S(t,v,C,"f")}}.value,configObjects:x,exitProcess:{set value(C){S(e,St,C,"f")}}.value,groups:{set value(C){S(n,Nt,C,"f")}}.value,output:{set value(C){S(s,lt,C,"f")}}.value,exitError:{set value(C){S(i,Yt,C,"f")}}.value,hasOutput:{set value(C){S(o,xt,C,"f")}}.value,parsed:this.parsed,strict:{set value(C){S(c,ce,C,"f")}}.value,strictCommands:{set value(C){S(p,le,C,"f")}}.value,strictOptions:{set value(C){S(b,fe,C,"f")}}.value,completionCommand:{set value(C){S(d,yt,C,"f")}}.value,parseFn:{set value(C){S(u,Ct,C,"f")}}.value,parseContext:{set value(C){S(g,oe,C,"f")}}.value}=y,a(this,v,"f").configObjects=x,a(this,z,"f").unfreeze(),a(this,rt,"f").unfreeze(),a(this,it,"f").unfreeze(),a(this,Pt,"f").unfreeze()}[li](t,e){return re(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[fi].bind(this),getContext:this[hi].bind(this),getHasOutput:this[ui].bind(this),getLoggerInstance:this[di].bind(this),getParseContext:this[pi].bind(this),getParserConfiguration:this[he].bind(this),getUsageConfiguration:this[oi].bind(this),getUsageInstance:this[mi].bind(this),getValidationInstance:this[gi].bind(this),hasParseCallback:this[mn].bind(this),isGlobalContext:this[bi].bind(this),postProcess:this[ue].bind(this),reset:this[Sr].bind(this),runValidation:this[Pr].bind(this),runYargsParserAndExecuteCommands:this[Te].bind(this),setHasOutput:this[yi].bind(this)}}[fi](){return a(this,it,"f")}[hi](){return a(this,De,"f")}[ui](){return a(this,xt,"f")}[di](){return a(this,Se,"f")}[pi](){return a(this,oe,"f")||{}}[mi](){return a(this,z,"f")}[gi](){return a(this,rt,"f")}[mn](){return!!a(this,Ct,"f")}[bi](){return a(this,fn,"f")}[ue](t,e,n,s){return n||Q(t)||(e||(t=this[ei](t)),(this[he]()["parse-positional-numbers"]||this[he]()["parse-positional-numbers"]===void 0)&&(t=this[ci](t)),s&&(t=ne(t,this,a(this,Pt,"f").getMiddleware(),!1))),t}[Sr](t={}){S(this,v,a(this,v,"f")||{},"f");let e={};e.local=a(this,v,"f").local||[],e.configObjects=a(this,v,"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 p=a(this,Nt,"f")[c].filter(b=>!(b in n));return p.length>0&&(o[c]=p),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,v,"f")[o]||[]).filter(c=>!n[c])}),i.forEach(o=>{e[o]=qt(a(this,v,"f")[o],c=>!n[c])}),e.envPrefix=a(this,v,"f").envPrefix,S(this,v,e,"f"),S(this,z,a(this,z,"f")?a(this,z,"f").reset(n):Ys(this,a(this,D,"f")),"f"),S(this,rt,a(this,rt,"f")?a(this,rt,"f").reset(n):ks(this,a(this,z,"f"),a(this,D,"f")),"f"),S(this,it,a(this,it,"f")?a(this,it,"f").reset():Hs(a(this,z,"f"),a(this,rt,"f"),a(this,Pt,"f"),a(this,D,"f")),"f"),a(this,_t,"f")||S(this,_t,Qs(this,a(this,z,"f"),a(this,it,"f"),a(this,D,"f")),"f"),a(this,Pt,"f").reset(),S(this,yt,null,"f"),S(this,lt,"","f"),S(this,Yt,null,"f"),S(this,xt,!1,"f"),this.parsed=!1,this}[wi](t,e){return a(this,D,"f").path.relative(t,e)}[Te](t,e,n,s=0,i=!1){let o=!!n||i;t=t||a(this,Kt,"f"),a(this,v,"f").__=a(this,D,"f").y18n.__,a(this,v,"f").configuration=this[he]();let c=!!a(this,v,"f").configuration["populate--"],p=Object.assign({},a(this,v,"f").configuration,{"populate--":!0}),b=a(this,D,"f").Parser.detailed(t,Object.assign({},a(this,v,"f"),{configuration:{"parse-positional-numbers":!1,...p}})),d=Object.assign(b.argv,a(this,oe,"f")),u,g=b.aliases,y=!1,x=!1;Object.keys(d).forEach(C=>{C===a(this,It,"f")&&d[C]?y=!0:C===a(this,Ut,"f")&&d[C]&&(x=!0)}),d.$0=this.$0,this.parsed=b,s===0&&a(this,z,"f").clearCachedHelpMessage();try{if(this[yr](),e)return this[ue](d,c,!!n,!1);a(this,It,"f")&&[a(this,It,"f")].concat(g[a(this,It,"f")]||[]).filter(R=>R.length>1).includes(""+d._[d._.length-1])&&(d._.pop(),y=!0),S(this,fn,!1,"f");let C=a(this,it,"f").getCommands(),m=a(this,_t,"f").completionKey in d,$=y||m||i;if(d._.length){if(C.length){let N;for(let R=s||0,T;d._[R]!==void 0;R++)if(T=String(d._[R]),C.includes(T)&&T!==a(this,yt,"f")){let W=a(this,it,"f").runCommand(T,this,b,R+1,i,y||x||i);return this[ue](W,c,!!n,!1)}else if(!N&&T!==a(this,yt,"f")){N=T;break}!a(this,it,"f").hasDefaultCommand()&&a(this,dn,"f")&&N&&!$&&a(this,rt,"f").recommendCommands(N,C)}a(this,yt,"f")&&d._.includes(a(this,yt,"f"))&&!m&&(a(this,St,"f")&&Gt(!0),this.showCompletionScript(),this.exit(0))}if(a(this,it,"f").hasDefaultCommand()&&!$){let N=a(this,it,"f").runCommand(null,this,b,0,i,y||x||i);return this[ue](N,c,!!n,!1)}if(m){a(this,St,"f")&&Gt(!0),t=[].concat(t);let N=t.slice(t.indexOf(`--${a(this,_t,"f").completionKey}`)+1);return a(this,_t,"f").getCompletion(N,(R,T)=>{if(R)throw new J(R.message);(T||[]).forEach(W=>{a(this,Se,"f").log(W)}),this.exit(0)}),this[ue](d,!c,!!n,!1)}if(a(this,xt,"f")||(y?(a(this,St,"f")&&Gt(!0),o=!0,this.showHelp("log"),this.exit(0)):x&&(a(this,St,"f")&&Gt(!0),o=!0,a(this,z,"f").showVersion("log"),this.exit(0))),!o&&a(this,v,"f").skipValidation.length>0&&(o=Object.keys(d).some(N=>a(this,v,"f").skipValidation.indexOf(N)>=0&&d[N]===!0)),!o){if(b.error)throw new J(b.error.message);if(!m){let N=this[Pr](g,{},b.error);n||(u=ne(d,this,a(this,Pt,"f").getMiddleware(),!0)),u=this[li](N,u??d),Q(u)&&!n&&(u=u.then(()=>ne(d,this,a(this,Pt,"f").getMiddleware(),!1)))}}}catch(C){if(C instanceof J)a(this,z,"f").fail(C.message,C);else throw C}return this[ue](u??d,c,!!n,!0)}[Pr](t,e,n,s){let i={...this.getDemandedOptions()};return o=>{if(n)throw new J(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)}}[yi](){S(this,xt,!0,"f")}[de](t){if(typeof t=="string")a(this,v,"f").key[t]=!0;else for(let e of t)a(this,v,"f").key[e]=!0}};function qs(r){return!!r&&typeof r.getInternalMethods=="function"}var Ga=xi(Ls),Ci=Ga;var _i=Re(Ai(),1),Ja={},Ya=process.argv.slice(2),Ei=new _i.default(Ci),vr=console.log;async function Mr(r){Ei.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;Ya.length>0&&vr(s),o.showHelp()});let{data:t,argv:e}=await Ei.parse(r);t!=null&&(vr(t),process.exit(0)),await(await Si(tr(e.listen),e)).start(),e.quiet!==!0&&vr("daemon has started")}async function Si(r,t){throw new Error("Not implemented yet")}rr(Ja)&&Mr(process.argv).catch(r=>{console.error(r),process.exit(1)});return Fi(Ka);})();
|
|
67
67
|
/*! Bundled license information:
|
|
68
68
|
|
|
69
69
|
yargs-parser/build/lib/string-utils.js:
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,CAAC;YAChB,MAAM,GAAG,CAAA,CAAC,iBAAiB;QAC7B,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,2BAA2B;YAC3B,GAAG,CAAC,GAAG,CAAC,CAAA;QACV,CAAC;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,CAAC;QACjB,oBAAoB;QACpB,2BAA2B;QAC3B,GAAG,CAAC,IAAI,CAAC,CAAA;QACT,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;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,CAAC;QACxB,2BAA2B;QAC3B,GAAG,CAAC,oBAAoB,CAAC,CAAA;IAC3B,CAAC;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,CAAC;IACxB,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;AACN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/daemon",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "libp2p-daemon JavaScript implementation",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
|
-
"homepage": "https://github.com/libp2p/js-libp2p-daemon/tree/
|
|
6
|
+
"homepage": "https://github.com/libp2p/js-libp2p-daemon/tree/main/packages/libp2p-daemon#readme",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/libp2p/js-libp2p-daemon.git"
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/libp2p/js-libp2p-daemon/issues"
|
|
13
13
|
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public",
|
|
16
|
+
"provenance": true
|
|
17
|
+
},
|
|
14
18
|
"keywords": [
|
|
15
19
|
"libp2p"
|
|
16
20
|
],
|
|
@@ -40,7 +44,7 @@
|
|
|
40
44
|
},
|
|
41
45
|
"release": {
|
|
42
46
|
"branches": [
|
|
43
|
-
"
|
|
47
|
+
"main"
|
|
44
48
|
],
|
|
45
49
|
"plugins": [
|
|
46
50
|
[
|
|
@@ -133,7 +137,7 @@
|
|
|
133
137
|
"release": "aegir release"
|
|
134
138
|
},
|
|
135
139
|
"dependencies": {
|
|
136
|
-
"@libp2p/daemon-server": "^
|
|
140
|
+
"@libp2p/daemon-server": "^7.0.0",
|
|
137
141
|
"@multiformats/multiaddr": "^12.1.3",
|
|
138
142
|
"es-main": "^1.0.2",
|
|
139
143
|
"yargs": "^17.3.1",
|