wrangler 0.0.25 → 0.0.26

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.
@@ -1,13 +1,13 @@
1
- var wt=(s=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(s,{get:(t,e)=>(typeof require!="undefined"?require:t)[e]}):s)(function(s){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+s+'" is not supported')});import{Log as qi,LogLevel as Be,Miniflare as Vi}from"miniflare";import{notStrictEqual as wi,strictEqual as yi}from"assert";var Qn={right:ei,center:ni},Zn=0,ae=1,Xn=2,le=3,Ve=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(`
2
- `).map(i=>i.split(" ")),n=0;return e.forEach(i=>{i.length>1&&at.stringWidth(i[0])>n&&(n=Math.min(Math.floor(this.width*.5),at.stringWidth(i[0])))}),e.forEach(i=>{this.div(...i.map((o,a)=>({text:o.trim(),padding:this.measurePadding(o),width:a===0&&i.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){let e=at.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(`
3
- `)}rowToString(t,e){return this.rasterize(t).forEach((n,i)=>{let o="";n.forEach((a,f)=>{let{width:g}=t[f],O=this.negatePadding(t[f]),b=a;O>at.stringWidth(a)&&(b+=" ".repeat(O-at.stringWidth(a))),t[f].align&&t[f].align!=="left"&&this.wrap&&(b=Qn[t[f].align](b,O),at.stringWidth(b)<O&&(b+=" ".repeat((g||0)-at.stringWidth(b)-1)));let c=t[f].padding||[0,0,0,0];c[le]&&(o+=" ".repeat(c[le])),o+=qe(t[f],b,"| "),o+=b,o+=qe(t[f],b," |"),c[ae]&&(o+=" ".repeat(c[ae])),i===0&&e.length>0&&(o=this.renderInline(o,e[e.length-1]))}),e.push({text:o.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){let n=t.match(/^ */),i=n?n[0].length:0,o=e.text,a=at.stringWidth(o.trimRight());return e.span?this.wrap?i<a?t:(e.hidden=!0,o.trimRight()+" ".repeat(i-a)+t.trimLeft()):(e.hidden=!0,o+t):t}rasterize(t){let e=[],n=this.columnWidths(t),i;return t.forEach((o,a)=>{o.width=n[a],this.wrap?i=at.wrap(o.text,this.negatePadding(o),{hard:!0}).split(`
1
+ var _t=(s=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(s,{get:(t,e)=>(typeof require!="undefined"?require:t)[e]}):s)(function(s){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+s+'" is not supported')});import{Log as Vi,LogLevel as Je,Miniflare as Ki}from"miniflare";import{notStrictEqual as Ci,strictEqual as Ei}from"assert";var Xn={right:ii,center:si},kn=0,oe=1,ti=2,ae=3,je=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(`
2
+ `).map(i=>i.split(" ")),n=0;return e.forEach(i=>{i.length>1&&lt.stringWidth(i[0])>n&&(n=Math.min(Math.floor(this.width*.5),lt.stringWidth(i[0])))}),e.forEach(i=>{this.div(...i.map((o,a)=>({text:o.trim(),padding:this.measurePadding(o),width:a===0&&i.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){let e=lt.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(`
3
+ `)}rowToString(t,e){return this.rasterize(t).forEach((n,i)=>{let o="";n.forEach((a,f)=>{let{width:g}=t[f],O=this.negatePadding(t[f]),b=a;O>lt.stringWidth(a)&&(b+=" ".repeat(O-lt.stringWidth(a))),t[f].align&&t[f].align!=="left"&&this.wrap&&(b=Xn[t[f].align](b,O),lt.stringWidth(b)<O&&(b+=" ".repeat((g||0)-lt.stringWidth(b)-1)));let h=t[f].padding||[0,0,0,0];h[ae]&&(o+=" ".repeat(h[ae])),o+=Ze(t[f],b,"| "),o+=b,o+=Ze(t[f],b," |"),h[oe]&&(o+=" ".repeat(h[oe])),i===0&&e.length>0&&(o=this.renderInline(o,e[e.length-1]))}),e.push({text:o.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){let n=t.match(/^ */),i=n?n[0].length:0,o=e.text,a=lt.stringWidth(o.trimRight());return e.span?this.wrap?i<a?t:(e.hidden=!0,o.trimRight()+" ".repeat(i-a)+t.trimLeft()):(e.hidden=!0,o+t):t}rasterize(t){let e=[],n=this.columnWidths(t),i;return t.forEach((o,a)=>{o.width=n[a],this.wrap?i=lt.wrap(o.text,this.negatePadding(o),{hard:!0}).split(`
4
4
  `):i=o.text.split(`
5
- `),o.border&&(i.unshift("."+"-".repeat(this.negatePadding(o)+2)+"."),i.push("'"+"-".repeat(this.negatePadding(o)+2)+"'")),o.padding&&(i.unshift(...new Array(o.padding[Zn]||0).fill("")),i.push(...new Array(o.padding[Xn]||0).fill(""))),i.forEach((f,g)=>{e[g]||e.push([]);let O=e[g];for(let b=0;b<a;b++)O[b]===void 0&&O.push("");O.push(f)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[le]||0)+(t.padding[ae]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(a=>a.width||at.stringWidth(a.text));let e=t.length,n=this.width,i=t.map(a=>{if(a.width)return e--,n-=a.width,a.width}),o=e?Math.floor(n/e):0;return i.map((a,f)=>a===void 0?Math.max(o,kn(t[f])):a)}};function qe(s,t,e){return s.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function kn(s){let t=s.padding||[],e=1+(t[le]||0)+(t[ae]||0);return s.border?e+4:e}function ti(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function ei(s,t){s=s.trim();let e=at.stringWidth(s);return e<t?" ".repeat(t-e)+s:s}function ni(s,t){s=s.trim();let e=at.stringWidth(s);return e>=t?s:" ".repeat(t-e>>1)+s}var at;function Ge(s,t){return at=t,new Ve({width:(s==null?void 0:s.width)||ti(),wrap:s==null?void 0:s.wrap})}var Ke=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function Ce(s){return s.replace(Ke,"")}function Je(s,t){let[e,n]=s.match(Ke)||["",""];s=Ce(s);let i="";for(let o=0;o<s.length;o++)o!==0&&o%t===0&&(i+=`
6
- `),i+=s.charAt(o);return e&&n&&(i=`${e}${i}${n}`),i}function Ee(s){return Ge(s,{stringWidth:t=>[...t].length,stripAnsi:Ce,wrap:Je})}import{dirname as Qe,resolve as Ze}from"path";import{readdirSync as ii,statSync as si}from"fs";function Xe(s,t){let e=Ze(".",s),n;for(si(e).isDirectory()||(e=Qe(e));;){if(n=t(e,ii(e)),n)return Ze(e,n);if(e=Qe(n=e),n===e)break}}import{inspect as Ci}from"util";import{readFileSync as Ei}from"fs";import{fileURLToPath as ji}from"url";import{format as ai}from"util";import{normalize as li,resolve as fi}from"path";function zt(s){if(s!==s.toLowerCase()&&s!==s.toUpperCase()||(s=s.toLowerCase()),s.indexOf("-")===-1&&s.indexOf("_")===-1)return s;{let e="",n=!1,i=s.match(/^-+/);for(let o=i?i[0].length:0;o<s.length;o++){let a=s.charAt(o);n&&(n=!1,a=a.toUpperCase()),o!==0&&(a==="-"||a==="_")?n=!0:a!=="-"&&a!=="_"&&(e+=a)}return e}}function fe(s,t){let e=s.toLowerCase();t=t||"-";let n="";for(let i=0;i<s.length;i++){let o=e.charAt(i),a=s.charAt(i);o!==a&&i>0?n+=`${t}${e.charAt(i)}`:n+=a}return n}function ce(s){return s==null?!1:typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^0[^.]/.test(s)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function ke(s){if(Array.isArray(s))return s.map(a=>typeof a!="string"?a+"":a);s=s.trim();let t=0,e=null,n=null,i=null,o=[];for(let a=0;a<s.length;a++){if(e=n,n=s.charAt(a),n===" "&&!i){e!==" "&&t++;continue}n===i?i=null:(n==="'"||n==='"')&&!i&&(i=n),o[t]||(o[t]=""),o[t]+=n}return o}var ht;(function(s){s.BOOLEAN="boolean",s.STRING="string",s.NUMBER="number",s.ARRAY="array"})(ht||(ht={}));var xt,xe=class{constructor(t){xt=t}parse(t,e){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},e),i=ke(t),o=typeof t=="string",a=ri(Object.assign(Object.create(null),n.alias)),f=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),g=Object.assign(Object.create(null),n.default),O=n.configObjects||[],b=n.envPrefix,c=f["populate--"],m=c?"--":"_",w=Object.create(null),M=Object.create(null),y=n.__||xt.format,d={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},D=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,R=new RegExp("^--"+f["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let u=typeof l=="object"?l.key:l,_=Object.keys(l).map(function(p){return{boolean:"bools",string:"strings",number:"numbers"}[p]}).filter(Boolean).pop();_&&(d[_][u]=!0),d.arrays[u]=!0,d.keys.push(u)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(l){d.bools[l]=!0,d.keys.push(l)}),[].concat(n.string||[]).filter(Boolean).forEach(function(l){d.strings[l]=!0,d.keys.push(l)}),[].concat(n.number||[]).filter(Boolean).forEach(function(l){d.numbers[l]=!0,d.keys.push(l)}),[].concat(n.count||[]).filter(Boolean).forEach(function(l){d.counts[l]=!0,d.keys.push(l)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(l){d.normalize[l]=!0,d.keys.push(l)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([l,u])=>{typeof u=="number"&&(d.nargs[l]=u,d.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,u])=>{typeof u=="function"&&(d.coercions[l]=u,d.keys.push(l))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(l){d.configs[l]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([l,u])=>{(typeof u=="boolean"||typeof u=="function")&&(d.configs[l]=u)})),Lt(n.key,a,n.default,d.arrays),Object.keys(g).forEach(function(l){(d.aliases[l]||[]).forEach(function(u){g[u]=g[l]})});let Y=null;oe();let H=[],T=Object.assign(Object.create(null),{_:[]}),At={};for(let l=0;l<i.length;l++){let u=i[l],_=u.replace(/^-{3,}/,"---"),p,h,A,E,I,it;if(u!=="--"&&Q(u))gt(u);else if(_.match(/---+(=|$)/)){gt(u);continue}else if(u.match(/^--.+=/)||!f["short-option-groups"]&&u.match(/^-.+=/))E=u.match(/^--?([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&(F(E[1],d.arrays)?l=Ft(l,E[1],i,E[2]):F(E[1],d.nargs)!==!1?l=Jt(l,E[1],i,E[2]):B(E[1],E[2],!0));else if(u.match(R)&&f["boolean-negation"])E=u.match(R),E!==null&&Array.isArray(E)&&E.length>=2&&(h=E[1],B(h,F(h,d.arrays)?[!1]:!1));else if(u.match(/^--.+/)||!f["short-option-groups"]&&u.match(/^-[^-]+/))E=u.match(/^--?(.+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(h=E[1],F(h,d.arrays)?l=Ft(l,h,i):F(h,d.nargs)!==!1?l=Jt(l,h,i):(I=i[l+1],I!==void 0&&(!I.match(/^-/)||I.match(D))&&!F(h,d.bools)&&!F(h,d.counts)||/^(true|false)$/.test(I)?(B(h,I),l++):B(h,Z(h))));else if(u.match(/^-.\..+=/))E=u.match(/^-([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&B(E[1],E[2]);else if(u.match(/^-.\..+/)&&!u.match(D))I=i[l+1],E=u.match(/^-(.\..+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(h=E[1],I!==void 0&&!I.match(/^-/)&&!F(h,d.bools)&&!F(h,d.counts)?(B(h,I),l++):B(h,Z(h)));else if(u.match(/^-[^-]+/)&&!u.match(D)){A=u.slice(1,-1).split(""),p=!1;for(let rt=0;rt<A.length;rt++){if(I=u.slice(rt+2),A[rt+1]&&A[rt+1]==="="){it=u.slice(rt+3),h=A[rt],F(h,d.arrays)?l=Ft(l,h,i,it):F(h,d.nargs)!==!1?l=Jt(l,h,i,it):B(h,it),p=!0;break}if(I==="-"){B(A[rt],I);continue}if(/[A-Za-z]/.test(A[rt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(I)&&F(I,d.bools)===!1){B(A[rt],I),p=!0;break}if(A[rt+1]&&A[rt+1].match(/\W/)){B(A[rt],I),p=!0;break}else B(A[rt],Z(A[rt]))}h=u.slice(-1)[0],!p&&h!=="-"&&(F(h,d.arrays)?l=Ft(l,h,i):F(h,d.nargs)!==!1?l=Jt(l,h,i):(I=i[l+1],I!==void 0&&(!/^(-|--)[^-]/.test(I)||I.match(D))&&!F(h,d.bools)&&!F(h,d.counts)||/^(true|false)$/.test(I)?(B(h,I),l++):B(h,Z(h))))}else if(u.match(/^-[0-9]$/)&&u.match(D)&&F(u.slice(1),d.bools))h=u.slice(1),B(h,Z(h));else if(u==="--"){H=i.slice(l+1);break}else if(f["halt-at-non-option"]){H=i.slice(l);break}else gt(u)}U(T,!0),U(T,!1),L(T),k(),J(T,d.aliases,g,!0),nt(T),f["set-placeholder-key"]&&Wt(T),Object.keys(d.counts).forEach(function(l){Et(T,l.split("."))||B(l,0)}),c&&H.length&&(T[m]=[]),H.forEach(function(l){T[m].push(l)}),f["camel-case-expansion"]&&f["strip-dashed"]&&Object.keys(T).filter(l=>l!=="--"&&l.includes("-")).forEach(l=>{delete T[l]}),f["strip-aliased"]&&[].concat(...Object.keys(a).map(l=>a[l])).forEach(l=>{f["camel-case-expansion"]&&l.includes("-")&&delete T[l.split(".").map(u=>zt(u)).join(".")],delete T[l]});function gt(l){let u=$("_",l);(typeof u=="string"||typeof u=="number")&&T._.push(u)}function Jt(l,u,_,p){let h,A=F(u,d.nargs);if(A=typeof A!="number"||isNaN(A)?1:A,A===0)return Ot(p)||(Y=Error(y("Argument unexpected for: %s",u))),B(u,Z(u)),l;let E=Ot(p)?0:1;if(f["nargs-eats-options"])_.length-(l+1)+E<A&&(Y=Error(y("Not enough arguments following: %s",u))),E=A;else{for(h=l+1;h<_.length&&(!_[h].match(/^-[^0-9]/)||_[h].match(D)||Q(_[h]));h++)E++;E<A&&(Y=Error(y("Not enough arguments following: %s",u)))}let I=Math.min(E,A);for(!Ot(p)&&I>0&&(B(u,p),I--),h=l+1;h<I+l+1;h++)B(u,_[h]);return l+I}function Ft(l,u,_,p){let h=[],A=p||_[l+1],E=F(u,d.nargs);if(F(u,d.bools)&&!/^(true|false)$/.test(A))h.push(!0);else if(Ot(A)||Ot(p)&&/^-/.test(A)&&!D.test(A)&&!Q(A)){if(g[u]!==void 0){let I=g[u];h=Array.isArray(I)?I:[I]}}else{Ot(p)||h.push(C(u,p,!0));for(let I=l+1;I<_.length&&!(!f["greedy-arrays"]&&h.length>0||E&&typeof E=="number"&&h.length>=E||(A=_[I],/^-/.test(A)&&!D.test(A)&&!Q(A)));I++)l=I,h.push(C(u,A,o))}return typeof E=="number"&&(E&&h.length<E||isNaN(E)&&h.length===0)&&(Y=Error(y("Not enough arguments following: %s",u))),B(u,h),l}function B(l,u,_=o){if(/-/.test(l)&&f["camel-case-expansion"]){let A=l.split(".").map(function(E){return zt(E)}).join(".");S(l,A)}let p=C(l,u,_),h=l.split(".");jt(T,h,p),d.aliases[l]&&d.aliases[l].forEach(function(A){let E=A.split(".");jt(T,E,p)}),h.length>1&&f["dot-notation"]&&(d.aliases[h[0]]||[]).forEach(function(A){let E=A.split("."),I=[].concat(h);I.shift(),E=E.concat(I),(d.aliases[l]||[]).includes(E.join("."))||jt(T,E,p)}),F(l,d.normalize)&&!F(l,d.arrays)&&[l].concat(d.aliases[l]||[]).forEach(function(E){Object.defineProperty(At,E,{enumerable:!0,get(){return u},set(I){u=typeof I=="string"?xt.normalize(I):I}})})}function S(l,u){d.aliases[l]&&d.aliases[l].length||(d.aliases[l]=[u],w[u]=!0),d.aliases[u]&&d.aliases[u].length||S(u,l)}function C(l,u,_){_&&(u=oi(u)),(F(l,d.bools)||F(l,d.counts))&&typeof u=="string"&&(u=u==="true");let p=Array.isArray(u)?u.map(function(h){return $(l,h)}):$(l,u);return F(l,d.counts)&&(Ot(p)||typeof p=="boolean")&&(p=je()),F(l,d.normalize)&&F(l,d.arrays)&&(Array.isArray(u)?p=u.map(h=>xt.normalize(h)):p=xt.normalize(u)),p}function $(l,u){return!f["parse-positional-numbers"]&&l==="_"||!F(l,d.strings)&&!F(l,d.bools)&&!Array.isArray(u)&&(ce(u)&&f["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${u}`)))||!Ot(u)&&F(l,d.numbers))&&(u=Number(u)),u}function L(l){let u=Object.create(null);J(u,d.aliases,g),Object.keys(d.configs).forEach(function(_){let p=l[_]||u[_];if(p)try{let h=null,A=xt.resolve(xt.cwd(),p),E=d.configs[_];if(typeof E=="function"){try{h=E(A)}catch(I){h=I}if(h instanceof Error){Y=h;return}}else h=xt.require(A);q(h)}catch(h){h.name==="PermissionDenied"?Y=h:l[_]&&(Y=Error(y("Invalid JSON config file: %s",p)))}})}function q(l,u){Object.keys(l).forEach(function(_){let p=l[_],h=u?u+"."+_:_;typeof p=="object"&&p!==null&&!Array.isArray(p)&&f["dot-notation"]?q(p,h):(!Et(T,h.split("."))||F(h,d.arrays)&&f["combine-arrays"])&&B(h,p)})}function k(){typeof O<"u"&&O.forEach(function(l){q(l)})}function U(l,u){if(typeof b>"u")return;let _=typeof b=="string"?b:"",p=xt.env();Object.keys(p).forEach(function(h){if(_===""||h.lastIndexOf(_,0)===0){let A=h.split("__").map(function(E,I){return I===0&&(E=E.substring(_.length)),zt(E)});(u&&d.configs[A.join(".")]||!u)&&!Et(l,A)&&B(A.join("."),p[h])}})}function nt(l){let u,_=new Set;Object.keys(l).forEach(function(p){if(!_.has(p)&&(u=F(p,d.coercions),typeof u=="function"))try{let h=$(p,u(l[p]));[].concat(d.aliases[p]||[],p).forEach(A=>{_.add(A),l[A]=h})}catch(h){Y=h}})}function Wt(l){return d.keys.forEach(u=>{~u.indexOf(".")||typeof l[u]>"u"&&(l[u]=void 0)}),l}function J(l,u,_,p=!1){Object.keys(_).forEach(function(h){Et(l,h.split("."))||(jt(l,h.split("."),_[h]),p&&(M[h]=!0),(u[h]||[]).forEach(function(A){Et(l,A.split("."))||jt(l,A.split("."),_[h])}))})}function Et(l,u){let _=l;f["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(h){_=_[h]||{}});let p=u[u.length-1];return typeof _!="object"?!1:p in _}function jt(l,u,_){let p=l;f["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(it){it=tn(it),typeof p=="object"&&p[it]===void 0&&(p[it]={}),typeof p[it]!="object"||Array.isArray(p[it])?(Array.isArray(p[it])?p[it].push({}):p[it]=[p[it],{}],p=p[it][p[it].length-1]):p=p[it]});let h=tn(u[u.length-1]),A=F(u.join("."),d.arrays),E=Array.isArray(_),I=f["duplicate-arguments-array"];!I&&F(h,d.nargs)&&(I=!0,(!Ot(p[h])&&d.nargs[h]===1||Array.isArray(p[h])&&p[h].length===d.nargs[h])&&(p[h]=void 0)),_===je()?p[h]=je(p[h]):Array.isArray(p[h])?I&&A&&E?p[h]=f["flatten-duplicate-arrays"]?p[h].concat(_):(Array.isArray(p[h][0])?p[h]:[p[h]]).concat([_]):!I&&Boolean(A)===Boolean(E)?p[h]=_:p[h]=p[h].concat([_]):p[h]===void 0&&A?p[h]=E?_:[_]:I&&!(p[h]===void 0||F(h,d.counts)||F(h,d.bools))?p[h]=[p[h],_]:p[h]=_}function Lt(...l){l.forEach(function(u){Object.keys(u||{}).forEach(function(_){d.aliases[_]||(d.aliases[_]=[].concat(a[_]||[]),d.aliases[_].concat(_).forEach(function(p){if(/-/.test(p)&&f["camel-case-expansion"]){let h=zt(p);h!==_&&d.aliases[_].indexOf(h)===-1&&(d.aliases[_].push(h),w[h]=!0)}}),d.aliases[_].concat(_).forEach(function(p){if(p.length>1&&/[A-Z]/.test(p)&&f["camel-case-expansion"]){let h=fe(p,"-");h!==_&&d.aliases[_].indexOf(h)===-1&&(d.aliases[_].push(h),w[h]=!0)}}),d.aliases[_].forEach(function(p){d.aliases[p]=[_].concat(d.aliases[_].filter(function(h){return p!==h}))}))})})}function F(l,u){let _=[].concat(d.aliases[l]||[],l),p=Object.keys(u),h=_.find(A=>p.includes(A));return h?u[h]:!1}function ye(l){let u=Object.keys(d);return[].concat(u.map(p=>d[p])).some(function(p){return Array.isArray(p)?p.includes(l):p[l]})}function N(l,...u){return[].concat(...u).some(function(p){let h=l.match(p);return h&&ye(h[1])})}function G(l){if(l.match(D)||!l.match(/^-[^-]+/))return!1;let u=!0,_,p=l.slice(1).split("");for(let h=0;h<p.length;h++){if(_=l.slice(h+2),!ye(p[h])){u=!1;break}if(p[h+1]&&p[h+1]==="="||_==="-"||/[A-Za-z]/.test(p[h])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(_)||p[h+1]&&p[h+1].match(/\W/))break}return u}function Q(l){return f["unknown-options-as-args"]&&v(l)}function v(l){return l=l.replace(/^-{3,}/,"--"),l.match(D)||G(l)?!1:!N(l,/^-+([^=]+?)=[\s\S]*$/,R,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function Z(l){return!F(l,d.bools)&&!F(l,d.counts)&&`${l}`in g?g[l]:tt(bt(l))}function tt(l){return{[ht.BOOLEAN]:!0,[ht.STRING]:"",[ht.NUMBER]:void 0,[ht.ARRAY]:[]}[l]}function bt(l){let u=ht.BOOLEAN;return F(l,d.strings)?u=ht.STRING:F(l,d.numbers)?u=ht.NUMBER:F(l,d.bools)?u=ht.BOOLEAN:F(l,d.arrays)&&(u=ht.ARRAY),u}function Ot(l){return l===void 0}function oe(){Object.keys(d.counts).find(l=>F(l,d.arrays)?(Y=Error(y("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):F(l,d.nargs)?(Y=Error(y("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},d.aliases),argv:Object.assign(At,T),configuration:f,defaulted:Object.assign({},M),error:Y,newAliases:Object.assign({},w)}}};function ri(s){let t=[],e=Object.create(null),n=!0;for(Object.keys(s).forEach(function(i){t.push([].concat(s[i],i))});n;){n=!1;for(let i=0;i<t.length;i++)for(let o=i+1;o<t.length;o++)if(t[i].filter(function(f){return t[o].indexOf(f)!==-1}).length){t[i]=t[i].concat(t[o]),t.splice(o,1),n=!0;break}}return t.forEach(function(i){i=i.filter(function(a,f,g){return g.indexOf(a)===f});let o=i.pop();o!==void 0&&typeof o=="string"&&(e[o]=i)}),e}function je(s){return s!==void 0?s+1:1}function tn(s){return s==="__proto__"?"___proto___":s}function oi(s){return typeof s=="string"&&(s[0]==="'"||s[0]==='"')&&s[s.length-1]===s[0]?s.substring(1,s.length-1):s}import{readFileSync as ci}from"fs";var en=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version&&Number(process.version.match(/v([^.]+)/)[1])<en)throw Error(`yargs parser supports a minimum Node.js version of ${en}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var hi=process?process.env:{},nn=new xe({cwd:process.cwd,env:()=>hi,format:ai,normalize:li,resolve:fi,require:s=>{if(typeof wt<"u")return wt(s);if(s.match(/\.json$/))return JSON.parse(ci(s,"utf8"));throw Error("only .json config files are supported in ESM")}}),ee=function(t,e){return nn.parse(t.slice(),e).argv};ee.detailed=function(s,t){return nn.parse(s.slice(),t)};ee.camelCase=zt;ee.decamelize=fe;ee.looksLikeNumber=ce;var Ae=ee;import{basename as xi,dirname as Ai,extname as Si,relative as Pi,resolve as cn}from"path";function sn(){return ui()?0:1}function ui(){return di()&&!process.defaultApp}function di(){return!!process.versions.electron}function Se(s){return s.slice(sn()+1)}function rn(){return process.argv[sn()]}var V=class extends Error{constructor(t){super(t||"yargs error");this.name="YError",Error.captureStackTrace(this,V)}};import{readFileSync as pi,statSync as mi,writeFile as gi}from"fs";import{format as bi}from"util";import{resolve as Oi}from"path";var on={fs:{readFileSync:pi,writeFile:gi},format:bi,resolve:Oi,exists:s=>{try{return mi(s).isFile()}catch{return!1}}};var _t,an=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(),_t.format.apply(_t.format,[this.cache[this.locale][e]||e].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),i=t.shift(),o=function(){};typeof t[t.length-1]=="function"&&(o=t.pop()),this.cache[this.locale]||this._readLocaleFile();let a=i===1?e:n;this.cache[this.locale][e]&&(a=this.cache[this.locale][e][i===1?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:o})):o();let f=[a];return~a.indexOf("%d")&&f.push(i),_t.format.apply(_t.format,f.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let n="";return t.forEach(function(i,o){let a=e[o+1];n+=i,typeof a<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let t=this,e=this.writeQueue[0],n=e.directory,i=e.locale,o=e.cb,a=this._resolveLocaleFile(n,i),f=JSON.stringify(this.cache[i],null,2);_t.fs.writeFile(a,f,"utf-8",function(g){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),o(g)})}_readLocaleFile(){let t={},e=this._resolveLocaleFile(this.directory,this.locale);try{_t.fs.readFileSync&&(t=JSON.parse(_t.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=_t.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){let i=_t.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(i)&&(n=i)}return n}_fileExistsSync(t){return _t.exists(t)}};function ln(s,t){_t=t;let e=new an(s);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 _i=s=>ln(s,on),fn=_i;var Mi="require is not supported by ESM",hn="loading a directory of commands is not supported yet for ESM",he;try{he=ji(import.meta.url)}catch{he=process.cwd()}var Ii=he.split("node_modules")[0],Pe={assert:{notStrictEqual:wi,strictEqual:yi},cliui:Ee,findUp:Xe,getEnv:s=>process.env[s],inspect:Ci,getCallerFile:()=>{throw new V(hn)},getProcessArgvBin:rn,mainFilename:Ii||process.cwd(),Parser:Ae,path:{basename:xi,dirname:Ai,extname:Si,relative:Pi,resolve:cn},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(s,t)=>process.emitWarning(s,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Ei,require:()=>{throw new V(Mi)},requireDirectory:()=>{throw new V(hn)},stringWidth:s=>[...s].length,y18n:fn({directory:cn(he,"../../../locales"),updateFiles:!1})};function ot(s,t,e,n){e.assert.notStrictEqual(s,t,n)}function Me(s,t){t.assert.strictEqual(typeof s,"string")}function Qt(s){return Object.keys(s)}function K(s){return!!s&&!!s.then&&typeof s.then=="function"}function St(s){let e=s.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${s}`);let o={cmd:i.replace(n,""),demanded:[],optional:[]};return e.forEach((a,f)=>{let g=!1;a=a.replace(/\s/g,""),/\.+[\]>]/.test(a)&&f===e.length-1&&(g=!0),/^\[/.test(a)?o.optional.push({cmd:a.replace(n,"").split("|"),variadic:g}):o.demanded.push({cmd:a.replace(n,"").split("|"),variadic:g})}),o}var $i=["first","second","third","fourth","fifth","sixth"];function j(s,t,e){function n(){return typeof s=="object"?[{demanded:[],optional:[]},s,t]:[St(`cmd ${s}`),t,e]}try{let i=0,[o,a,f]=n(),g=[].slice.call(a);for(;g.length&&g[g.length-1]===void 0;)g.pop();let O=f||g.length;if(O<o.demanded.length)throw new V(`Not enough arguments provided. Expected ${o.demanded.length} but received ${g.length}.`);let b=o.demanded.length+o.optional.length;if(O>b)throw new V(`Too many arguments provided. Expected max ${b} but received ${O}.`);o.demanded.forEach(c=>{let m=g.shift(),w=un(m);c.cmd.filter(y=>y===w||y==="*").length===0&&dn(w,c.cmd,i),i+=1}),o.optional.forEach(c=>{if(g.length===0)return;let m=g.shift(),w=un(m);c.cmd.filter(y=>y===w||y==="*").length===0&&dn(w,c.cmd,i),i+=1})}catch(i){console.warn(i.stack)}}function un(s){return Array.isArray(s)?"array":s===null?"null":typeof s}function dn(s,t,e){throw new V(`Invalid ${$i[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${s}.`)}var Ie=class{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,i=!1){if(j("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let o=0;o<t.length;o++){if(typeof t[o]!="function")throw Error("middleware must be a function");let a=t[o];a.applyBeforeValidation=e,a.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){let o=t;o.applyBeforeValidation=e,o.global=n,o.mutates=i,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(i=>{let o=[...n[e]||[],e];return i.option?!o.includes(i.option):!0}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let t=this.frozens.pop();t!==void 0&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}};function pn(s){return s?s.map(t=>(t.applyBeforeValidation=!1,t)):[]}function Dt(s,t,e,n){return e.reduce((i,o)=>{if(o.applyBeforeValidation!==n)return i;if(o.mutates){if(o.applied)return i;o.applied=!0}if(K(i))return i.then(a=>Promise.all([a,o(a,t)])).then(([a,f])=>Object.assign(a,f));{let a=o(i,t);return K(a)?a.then(f=>Object.assign(i,f)):Object.assign(i,a)}},s)}function vt(s,t,e=n=>{throw n}){try{let n=Ni(s)?s():s;return K(n)?n.then(i=>t(i)):t(n)}catch(n){return e(n)}}function Ni(s){return typeof s=="function"}function $e(s){if(typeof wt>"u")return null;for(let t=0,e=Object.keys(wt.cache),n;t<e.length;t++)if(n=wt.cache[e[t]],n.exports===s)return n;return null}var Zt=/(^\*)|(^\$0)/,gn=class{constructor(t,e,n,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,i){i=i||{},typeof i.recurse!="boolean"&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);let o=typeof i.visit=="function"?i.visit:a=>a;i.visit=(a,f,g)=>{let O=o(a,f,g);if(O){if(this.requireCache.has(f))return O;this.requireCache.add(f),this.addHandler(O)}return O},this.shim.requireDirectory({require:e,filename:n},t,i)}addHandler(t,e,n,i,o,a){let f=[],g=pn(o);if(i=i||(()=>{}),Array.isArray(t))if(Fi(t))[t,...f]=t;else for(let O of t)this.addHandler(O);else if(Li(t)){let O=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(O=[].concat(O).concat(t.aliases)),this.addHandler(O,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(mn(n)){this.addHandler([t].concat(f),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){let O=St(t);f=f.map(m=>St(m).cmd);let b=!1,c=[O.cmd].concat(f).filter(m=>Zt.test(m)?(b=!0,!1):!0);c.length===0&&b&&c.push("$0"),b&&(O.cmd=c[0],f=c.slice(1),t=t.replace(Zt,O.cmd)),f.forEach(m=>{this.aliasMap[m]=O.cmd}),e!==!1&&this.usage.command(t,e,b,f,a),this.handlers[O.cmd]={original:t,description:e,handler:i,builder:n||{},middlewares:g,deprecated:a,demanded:O.demanded,optional:O.optional},b&&(this.defaultCommand=this.handlers[O.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,i,o,a){let f=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,g=e.getInternalMethods().getContext(),O=g.commands.slice(),b=!t;t&&(g.commands.push(t),g.fullCommands.push(f.original));let c=this.applyBuilderUpdateUsageAndParse(b,f,e,n.aliases,O,i,o,a);return K(c)?c.then(m=>this.applyMiddlewareAndGetResult(b,f,m.innerArgv,g,o,m.aliases,e)):this.applyMiddlewareAndGetResult(b,f,c.innerArgv,g,o,c.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,i,o,a,f,g){let O=e.builder,b=n;if(ue(O)){let c=O(n.getInternalMethods().reset(i),g);if(K(c))return c.then(m=>(b=On(m)?m:n,this.parseAndUpdateUsage(t,e,b,o,a,f)))}else Wi(O)&&(b=n.getInternalMethods().reset(i),Object.keys(e.builder).forEach(c=>{b.option(c,O[c])}));return this.parseAndUpdateUsage(t,e,b,o,a,f)}parseAndUpdateUsage(t,e,n,i,o,a){t&&n.getInternalMethods().getUsageInstance().unfreeze(),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);let f=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,o,a);return K(f)?f.then(g=>({aliases:n.parsed.aliases,innerArgv:g})):{aliases:n.parsed.aliases,innerArgv:f}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){let n=Zt.test(e.original)?e.original.replace(Zt,"").trim():e.original,i=t.filter(o=>!Zt.test(o));return i.push(n),`$0 ${i.join(" ")}`}applyMiddlewareAndGetResult(t,e,n,i,o,a,f){let g={};if(o)return n;f.getInternalMethods().getHasOutput()||(g=this.populatePositionals(e,n,i,f));let O=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares);if(n=Dt(n,f,O,!0),!f.getInternalMethods().getHasOutput()){let b=f.getInternalMethods().runValidation(a,g,f.parsed.error,t);n=vt(n,c=>(b(c),c))}if(e.handler&&!f.getInternalMethods().getHasOutput()){f.getInternalMethods().setHasOutput();let b=!!f.getOptions().configuration["populate--"];f.getInternalMethods().postProcess(n,b,!1,!1),n=Dt(n,f,O,!1),n=vt(n,c=>{let m=e.handler(c);return K(m)?m.then(()=>c):c}),t||f.getInternalMethods().getUsageInstance().cacheHelpMessage(),K(n)&&!f.getInternalMethods().hasParseCallback()&&n.catch(c=>{try{f.getInternalMethods().getUsageInstance().fail(null,c)}catch{}})}return t||(i.commands.pop(),i.fullCommands.pop()),n}populatePositionals(t,e,n,i){e._=e._.slice(n.commands.length);let o=t.demanded.slice(0),a=t.optional.slice(0),f={};for(this.validation.positionalCount(o.length,e._.length);o.length;){let g=o.shift();this.populatePositional(g,e,f)}for(;a.length;){let g=a.shift();this.populatePositional(g,e,f)}return e._=n.commands.concat(e._.map(g=>""+g)),this.postProcessPositionals(e,f,this.cmdToParseOptions(t.original),i),f}populatePositional(t,e,n){let i=t.cmd[0];t.variadic?n[i]=e._.splice(0).map(String):e._.length&&(n[i]=[String(e._.shift())])}cmdToParseOptions(t){let e={array:[],default:{},alias:{},demand:{}},n=St(t);return n.demanded.forEach(i=>{let[o,...a]=i.cmd;i.variadic&&(e.array.push(o),e.default[o]=[]),e.alias[o]=a,e.demand[o]=!0}),n.optional.forEach(i=>{let[o,...a]=i.cmd;i.variadic&&(e.array.push(o),e.default[o]=[]),e.alias[o]=a}),e}postProcessPositionals(t,e,n,i){let o=Object.assign({},i.getOptions());o.default=Object.assign(n.default,o.default);for(let O of Object.keys(n.alias))o.alias[O]=(o.alias[O]||[]).concat(n.alias[O]);o.array=o.array.concat(n.array),o.config={};let a=[];if(Object.keys(e).forEach(O=>{e[O].map(b=>{o.configuration["unknown-options-as-args"]&&(o.key[O]=!0),a.push(`--${O}`),a.push(b)})}),!a.length)return;let f=Object.assign({},o.configuration,{"populate--":!1}),g=this.shim.Parser.detailed(a,Object.assign({},o,{configuration:f}));if(g.error)i.getInternalMethods().getUsageInstance().fail(g.error.message,g.error);else{let O=Object.keys(e);Object.keys(e).forEach(c=>{O.push(...g.aliases[c])});let b=i.getOptions().default;Object.keys(g.argv).forEach(c=>{O.includes(c)&&(e[c]||(e[c]=g.argv[c]),!Object.prototype.hasOwnProperty.call(b,c)&&Object.prototype.hasOwnProperty.call(t,c)&&Object.prototype.hasOwnProperty.call(g.argv,c)&&(Array.isArray(t[c])||Array.isArray(g.argv[c]))?t[c]=[].concat(t[c],g.argv[c]):t[c]=g.argv[c])})}}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let n=Zt.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(ue(e))return e(t,!0);mn(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){let e=$e(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:n}){for(let i of[t,e,n]){if(typeof i=="string"||i===!1)return i;ot(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let t=this.frozens.pop();ot(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 bn(s,t,e,n){return new gn(s,t,e,n)}function mn(s){return typeof s=="object"&&!!s.builder&&typeof s.handler=="function"}function Fi(s){return s.every(t=>typeof t=="string")}function ue(s){return typeof s=="function"}function Wi(s){return typeof s=="object"}function Li(s){return typeof s=="object"&&!Array.isArray(s)}function Pt(s={},t=()=>!0){let e={};return Qt(s).forEach(n=>{t(n,s[n])&&(e[n]=s[n])}),e}function Mt(s){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{let e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(s)})}function zi(s){return typeof s=="boolean"}function wn(s,t){let e=t.y18n.__,n={},i=[];n.failFn=function(C){i.push(C)};let o=null,a=!0;n.showHelpOnFail=function(C=!0,$){function L(){return typeof C=="string"?[!0,C]:[C,$]}let[q,k]=L();return o=k,a=q,n};let f=!1;n.fail=function(C,$){let L=s.getInternalMethods().getLoggerInstance();if(i.length)for(let q=i.length-1;q>=0;--q){let k=i[q];if(zi(k)){if($)throw $;if(C)throw Error(C)}else k(C,$,n)}else{if(s.getExitProcess()&&Mt(!0),f||(f=!0,a&&(s.showHelp("error"),L.error()),(C||$)&&L.error(C||$),o&&((C||$)&&L.error(""),L.error(o))),$=$||new V(C),s.getExitProcess())return s.exit(1);if(s.getInternalMethods().hasParseCallback())return s.exit(1,$);throw $}};let g=[],O=!1;n.usage=(S,C)=>S===null?(O=!0,g=[],n):(O=!1,g.push([S,C||""]),n),n.getUsage=()=>g,n.getUsageDisabled=()=>O,n.getPositionalGroupName=()=>e("Positionals:");let b=[];n.example=(S,C)=>{b.push([S,C||""])};let c=[];n.command=function(C,$,L,q,k=!1){L&&(c=c.map(U=>(U[2]=!1,U))),c.push([C,$||"",L,q,k])},n.getCommands=()=>c;let m={};n.describe=function(C,$){Array.isArray(C)?C.forEach(L=>{n.describe(L,$)}):typeof C=="object"?Object.keys(C).forEach(L=>{n.describe(L,C[L])}):m[C]=$},n.getDescriptions=()=>m;let w=[];n.epilog=S=>{w.push(S)};let M=!1,y;n.wrap=S=>{M=!0,y=S};function d(){return M||(y=Jt(),M=!0),y}let D="__yargsString__:";n.deferY18nLookup=S=>D+S,n.help=function(){if(H)return H;Y();let C=s.customScriptName?s.$0:t.path.basename(s.$0),$=s.getDemandedOptions(),L=s.getDemandedCommands(),q=s.getDeprecatedOptions(),k=s.getGroups(),U=s.getOptions(),nt=[];nt=nt.concat(Object.keys(m)),nt=nt.concat(Object.keys($)),nt=nt.concat(Object.keys(L)),nt=nt.concat(Object.keys(U.default)),nt=nt.filter(At),nt=Object.keys(nt.reduce((N,G)=>(G!=="_"&&(N[G]=!0),N),{}));let Wt=d(),J=t.cliui({width:Wt,wrap:!!Wt});if(!O){if(g.length)g.forEach(N=>{J.div({text:`${N[0].replace(/\$0/g,C)}`}),N[1]&&J.div({text:`${N[1]}`,padding:[1,0,0,0]})}),J.div();else if(c.length){let N=null;L._?N=`${C} <${e("command")}>
5
+ `),o.border&&(i.unshift("."+"-".repeat(this.negatePadding(o)+2)+"."),i.push("'"+"-".repeat(this.negatePadding(o)+2)+"'")),o.padding&&(i.unshift(...new Array(o.padding[kn]||0).fill("")),i.push(...new Array(o.padding[ti]||0).fill(""))),i.forEach((f,g)=>{e[g]||e.push([]);let O=e[g];for(let b=0;b<a;b++)O[b]===void 0&&O.push("");O.push(f)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[ae]||0)+(t.padding[oe]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(a=>a.width||lt.stringWidth(a.text));let e=t.length,n=this.width,i=t.map(a=>{if(a.width)return e--,n-=a.width,a.width}),o=e?Math.floor(n/e):0;return i.map((a,f)=>a===void 0?Math.max(o,ei(t[f])):a)}};function Ze(s,t,e){return s.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function ei(s){let t=s.padding||[],e=1+(t[ae]||0)+(t[oe]||0);return s.border?e+4:e}function ni(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function ii(s,t){s=s.trim();let e=lt.stringWidth(s);return e<t?" ".repeat(t-e)+s:s}function si(s,t){s=s.trim();let e=lt.stringWidth(s);return e>=t?s:" ".repeat(t-e>>1)+s}var lt;function Xe(s,t){return lt=t,new je({width:s?.width||ni(),wrap:s?.wrap})}var ke=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function xe(s){return s.replace(ke,"")}function tn(s,t){let[e,n]=s.match(ke)||["",""];s=xe(s);let i="";for(let o=0;o<s.length;o++)o!==0&&o%t===0&&(i+=`
6
+ `),i+=s.charAt(o);return e&&n&&(i=`${e}${i}${n}`),i}function Ae(s){return Xe(s,{stringWidth:t=>[...t].length,stripAnsi:xe,wrap:tn})}import{dirname as en,resolve as nn}from"path";import{readdirSync as ri,statSync as oi}from"fs";function sn(s,t){let e=nn(".",s),n;for(oi(e).isDirectory()||(e=en(e));;){if(n=t(e,ri(e)),n)return nn(e,n);if(e=en(n=e),n===e)break}}import{inspect as ji}from"util";import{readFileSync as xi}from"fs";import{fileURLToPath as Ai}from"url";import{format as fi}from"util";import{normalize as ci,resolve as hi}from"path";function Ft(s){if(s!==s.toLowerCase()&&s!==s.toUpperCase()||(s=s.toLowerCase()),s.indexOf("-")===-1&&s.indexOf("_")===-1)return s;{let e="",n=!1,i=s.match(/^-+/);for(let o=i?i[0].length:0;o<s.length;o++){let a=s.charAt(o);n&&(n=!1,a=a.toUpperCase()),o!==0&&(a==="-"||a==="_")?n=!0:a!=="-"&&a!=="_"&&(e+=a)}return e}}function le(s,t){let e=s.toLowerCase();t=t||"-";let n="";for(let i=0;i<s.length;i++){let o=e.charAt(i),a=s.charAt(i);o!==a&&i>0?n+=`${t}${e.charAt(i)}`:n+=a}return n}function fe(s){return s==null?!1:typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^0[^.]/.test(s)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function rn(s){if(Array.isArray(s))return s.map(a=>typeof a!="string"?a+"":a);s=s.trim();let t=0,e=null,n=null,i=null,o=[];for(let a=0;a<s.length;a++){if(e=n,n=s.charAt(a),n===" "&&!i){e!==" "&&t++;continue}n===i?i=null:(n==="'"||n==='"')&&!i&&(i=n),o[t]||(o[t]=""),o[t]+=n}return o}var dt;(function(s){s.BOOLEAN="boolean",s.STRING="string",s.NUMBER="number",s.ARRAY="array"})(dt||(dt={}));var Et,ce=class{constructor(t){Et=t}parse(t,e){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},e),i=rn(t),o=typeof t=="string",a=ai(Object.assign(Object.create(null),n.alias)),f=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),g=Object.assign(Object.create(null),n.default),O=n.configObjects||[],b=n.envPrefix,h=f["populate--"],p=h?"--":"_",_=Object.create(null),A=Object.create(null),y=n.__||Et.format,d={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},R=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,v=new RegExp("^--"+f["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let u=typeof l=="object"?l.key:l,w=Object.keys(l).map(function(m){return{boolean:"bools",string:"strings",number:"numbers"}[m]}).filter(Boolean).pop();w&&(d[w][u]=!0),d.arrays[u]=!0,d.keys.push(u)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(l){d.bools[l]=!0,d.keys.push(l)}),[].concat(n.string||[]).filter(Boolean).forEach(function(l){d.strings[l]=!0,d.keys.push(l)}),[].concat(n.number||[]).filter(Boolean).forEach(function(l){d.numbers[l]=!0,d.keys.push(l)}),[].concat(n.count||[]).filter(Boolean).forEach(function(l){d.counts[l]=!0,d.keys.push(l)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(l){d.normalize[l]=!0,d.keys.push(l)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([l,u])=>{typeof u=="number"&&(d.nargs[l]=u,d.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,u])=>{typeof u=="function"&&(d.coercions[l]=u,d.keys.push(l))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(l){d.configs[l]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([l,u])=>{(typeof u=="boolean"||typeof u=="function")&&(d.configs[l]=u)})),te(n.key,a,n.default,d.arrays),Object.keys(g).forEach(function(l){(d.aliases[l]||[]).forEach(function(u){g[u]=g[l]})});let T=null;Ee();let Y=[],H=Object.assign(Object.create(null),{_:[]}),$t={};for(let l=0;l<i.length;l++){let u=i[l],w=u.replace(/^-{3,}/,"---"),m,c,S,E,$,it;if(u!=="--"&&q(u))ut(u);else if(w.match(/---+(=|$)/)){ut(u);continue}else if(u.match(/^--.+=/)||!f["short-option-groups"]&&u.match(/^-.+=/))E=u.match(/^--?([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&(F(E[1],d.arrays)?l=qt(l,E[1],i,E[2]):F(E[1],d.nargs)!==!1?l=Gt(l,E[1],i,E[2]):G(E[1],E[2],!0));else if(u.match(v)&&f["boolean-negation"])E=u.match(v),E!==null&&Array.isArray(E)&&E.length>=2&&(c=E[1],G(c,F(c,d.arrays)?[!1]:!1));else if(u.match(/^--.+/)||!f["short-option-groups"]&&u.match(/^-[^-]+/))E=u.match(/^--?(.+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(c=E[1],F(c,d.arrays)?l=qt(l,c,i):F(c,d.nargs)!==!1?l=Gt(l,c,i):($=i[l+1],$!==void 0&&(!$.match(/^-/)||$.match(R))&&!F(c,d.bools)&&!F(c,d.counts)||/^(true|false)$/.test($)?(G(c,$),l++):G(c,D(c))));else if(u.match(/^-.\..+=/))E=u.match(/^-([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&G(E[1],E[2]);else if(u.match(/^-.\..+/)&&!u.match(R))$=i[l+1],E=u.match(/^-(.\..+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(c=E[1],$!==void 0&&!$.match(/^-/)&&!F(c,d.bools)&&!F(c,d.counts)?(G(c,$),l++):G(c,D(c)));else if(u.match(/^-[^-]+/)&&!u.match(R)){S=u.slice(1,-1).split(""),m=!1;for(let ot=0;ot<S.length;ot++){if($=u.slice(ot+2),S[ot+1]&&S[ot+1]==="="){it=u.slice(ot+3),c=S[ot],F(c,d.arrays)?l=qt(l,c,i,it):F(c,d.nargs)!==!1?l=Gt(l,c,i,it):G(c,it),m=!0;break}if($==="-"){G(S[ot],$);continue}if(/[A-Za-z]/.test(S[ot])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test($)&&F($,d.bools)===!1){G(S[ot],$),m=!0;break}if(S[ot+1]&&S[ot+1].match(/\W/)){G(S[ot],$),m=!0;break}else G(S[ot],D(S[ot]))}c=u.slice(-1)[0],!m&&c!=="-"&&(F(c,d.arrays)?l=qt(l,c,i):F(c,d.nargs)!==!1?l=Gt(l,c,i):($=i[l+1],$!==void 0&&(!/^(-|--)[^-]/.test($)||$.match(R))&&!F(c,d.bools)&&!F(c,d.counts)||/^(true|false)$/.test($)?(G(c,$),l++):G(c,D(c))))}else if(u.match(/^-[0-9]$/)&&u.match(R)&&F(u.slice(1),d.bools))c=u.slice(1),G(c,D(c));else if(u==="--"){Y=i.slice(l+1);break}else if(f["halt-at-non-option"]){Y=i.slice(l);break}else ut(u)}k(H,!0),k(H,!1),M(H),B(),jt(H,d.aliases,g,!0),U(H),f["set-placeholder-key"]&&tt(H),Object.keys(d.counts).forEach(function(l){K(H,l.split("."))||G(l,0)}),h&&Y.length&&(H[p]=[]),Y.forEach(function(l){H[p].push(l)}),f["camel-case-expansion"]&&f["strip-dashed"]&&Object.keys(H).filter(l=>l!=="--"&&l.includes("-")).forEach(l=>{delete H[l]}),f["strip-aliased"]&&[].concat(...Object.keys(a).map(l=>a[l])).forEach(l=>{f["camel-case-expansion"]&&l.includes("-")&&delete H[l.split(".").map(u=>Ft(u)).join(".")],delete H[l]});function ut(l){let u=C("_",l);(typeof u=="string"||typeof u=="number")&&H._.push(u)}function Gt(l,u,w,m){let c,S=F(u,d.nargs);if(S=typeof S!="number"||isNaN(S)?1:S,S===0)return nt(m)||(T=Error(y("Argument unexpected for: %s",u))),G(u,D(u)),l;let E=nt(m)?0:1;if(f["nargs-eats-options"])w.length-(l+1)+E<S&&(T=Error(y("Not enough arguments following: %s",u))),E=S;else{for(c=l+1;c<w.length&&(!w[c].match(/^-[^0-9]/)||w[c].match(R)||q(w[c]));c++)E++;E<S&&(T=Error(y("Not enough arguments following: %s",u)))}let $=Math.min(E,S);for(!nt(m)&&$>0&&(G(u,m),$--),c=l+1;c<$+l+1;c++)G(u,w[c]);return l+$}function qt(l,u,w,m){let c=[],S=m||w[l+1],E=F(u,d.nargs);if(F(u,d.bools)&&!/^(true|false)$/.test(S))c.push(!0);else if(nt(S)||nt(m)&&/^-/.test(S)&&!R.test(S)&&!q(S)){if(g[u]!==void 0){let $=g[u];c=Array.isArray($)?$:[$]}}else{nt(m)||c.push(P(u,m,!0));for(let $=l+1;$<w.length&&!(!f["greedy-arrays"]&&c.length>0||E&&typeof E=="number"&&c.length>=E||(S=w[$],/^-/.test(S)&&!R.test(S)&&!q(S)));$++)l=$,c.push(P(u,S,o))}return typeof E=="number"&&(E&&c.length<E||isNaN(E)&&c.length===0)&&(T=Error(y("Not enough arguments following: %s",u))),G(u,c),l}function G(l,u,w=o){if(/-/.test(l)&&f["camel-case-expansion"]){let S=l.split(".").map(function(E){return Ft(E)}).join(".");kt(l,S)}let m=P(l,u,w),c=l.split(".");Ct(H,c,m),d.aliases[l]&&d.aliases[l].forEach(function(S){let E=S.split(".");Ct(H,E,m)}),c.length>1&&f["dot-notation"]&&(d.aliases[c[0]]||[]).forEach(function(S){let E=S.split("."),$=[].concat(c);$.shift(),E=E.concat($),(d.aliases[l]||[]).includes(E.join("."))||Ct(H,E,m)}),F(l,d.normalize)&&!F(l,d.arrays)&&[l].concat(d.aliases[l]||[]).forEach(function(E){Object.defineProperty($t,E,{enumerable:!0,get(){return u},set($){u=typeof $=="string"?Et.normalize($):$}})})}function kt(l,u){d.aliases[l]&&d.aliases[l].length||(d.aliases[l]=[u],_[u]=!0),d.aliases[u]&&d.aliases[u].length||kt(u,l)}function P(l,u,w){w&&(u=li(u)),(F(l,d.bools)||F(l,d.counts))&&typeof u=="string"&&(u=u==="true");let m=Array.isArray(u)?u.map(function(c){return C(l,c)}):C(l,u);return F(l,d.counts)&&(nt(m)||typeof m=="boolean")&&(m=Se()),F(l,d.normalize)&&F(l,d.arrays)&&(Array.isArray(u)?m=u.map(c=>Et.normalize(c)):m=Et.normalize(u)),m}function C(l,u){return!f["parse-positional-numbers"]&&l==="_"||!F(l,d.strings)&&!F(l,d.bools)&&!Array.isArray(u)&&(fe(u)&&f["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${u}`)))||!nt(u)&&F(l,d.numbers))&&(u=Number(u)),u}function M(l){let u=Object.create(null);jt(u,d.aliases,g),Object.keys(d.configs).forEach(function(w){let m=l[w]||u[w];if(m)try{let c=null,S=Et.resolve(Et.cwd(),m),E=d.configs[w];if(typeof E=="function"){try{c=E(S)}catch($){c=$}if(c instanceof Error){T=c;return}}else c=Et.require(S);L(c)}catch(c){c.name==="PermissionDenied"?T=c:l[w]&&(T=Error(y("Invalid JSON config file: %s",m)))}})}function L(l,u){Object.keys(l).forEach(function(w){let m=l[w],c=u?u+"."+w:w;typeof m=="object"&&m!==null&&!Array.isArray(m)&&f["dot-notation"]?L(m,c):(!K(H,c.split("."))||F(c,d.arrays)&&f["combine-arrays"])&&G(c,m)})}function B(){typeof O<"u"&&O.forEach(function(l){L(l)})}function k(l,u){if(typeof b>"u")return;let w=typeof b=="string"?b:"",m=Et.env();Object.keys(m).forEach(function(c){if(w===""||c.lastIndexOf(w,0)===0){let S=c.split("__").map(function(E,$){return $===0&&(E=E.substring(w.length)),Ft(E)});(u&&d.configs[S.join(".")]||!u)&&!K(l,S)&&G(S.join("."),m[c])}})}function U(l){let u,w=new Set;Object.keys(l).forEach(function(m){if(!w.has(m)&&(u=F(m,d.coercions),typeof u=="function"))try{let c=C(m,u(l[m]));[].concat(d.aliases[m]||[],m).forEach(S=>{w.add(S),l[S]=c})}catch(c){T=c}})}function tt(l){return d.keys.forEach(u=>{~u.indexOf(".")||typeof l[u]>"u"&&(l[u]=void 0)}),l}function jt(l,u,w,m=!1){Object.keys(w).forEach(function(c){K(l,c.split("."))||(Ct(l,c.split("."),w[c]),m&&(A[c]=!0),(u[c]||[]).forEach(function(S){K(l,S.split("."))||Ct(l,S.split("."),w[c])}))})}function K(l,u){let w=l;f["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(c){w=w[c]||{}});let m=u[u.length-1];return typeof w!="object"?!1:m in w}function Ct(l,u,w){let m=l;f["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(it){it=on(it),typeof m=="object"&&m[it]===void 0&&(m[it]={}),typeof m[it]!="object"||Array.isArray(m[it])?(Array.isArray(m[it])?m[it].push({}):m[it]=[m[it],{}],m=m[it][m[it].length-1]):m=m[it]});let c=on(u[u.length-1]),S=F(u.join("."),d.arrays),E=Array.isArray(w),$=f["duplicate-arguments-array"];!$&&F(c,d.nargs)&&($=!0,(!nt(m[c])&&d.nargs[c]===1||Array.isArray(m[c])&&m[c].length===d.nargs[c])&&(m[c]=void 0)),w===Se()?m[c]=Se(m[c]):Array.isArray(m[c])?$&&S&&E?m[c]=f["flatten-duplicate-arrays"]?m[c].concat(w):(Array.isArray(m[c][0])?m[c]:[m[c]]).concat([w]):!$&&Boolean(S)===Boolean(E)?m[c]=w:m[c]=m[c].concat([w]):m[c]===void 0&&S?m[c]=E?w:[w]:$&&!(m[c]===void 0||F(c,d.counts)||F(c,d.bools))?m[c]=[m[c],w]:m[c]=w}function te(...l){l.forEach(function(u){Object.keys(u||{}).forEach(function(w){d.aliases[w]||(d.aliases[w]=[].concat(a[w]||[]),d.aliases[w].concat(w).forEach(function(m){if(/-/.test(m)&&f["camel-case-expansion"]){let c=Ft(m);c!==w&&d.aliases[w].indexOf(c)===-1&&(d.aliases[w].push(c),_[c]=!0)}}),d.aliases[w].concat(w).forEach(function(m){if(m.length>1&&/[A-Z]/.test(m)&&f["camel-case-expansion"]){let c=le(m,"-");c!==w&&d.aliases[w].indexOf(c)===-1&&(d.aliases[w].push(c),_[c]=!0)}}),d.aliases[w].forEach(function(m){d.aliases[m]=[w].concat(d.aliases[w].filter(function(c){return m!==c}))}))})})}function F(l,u){let w=[].concat(d.aliases[l]||[],l),m=Object.keys(u),c=w.find(S=>m.includes(S));return c?u[c]:!1}function Vt(l){let u=Object.keys(d);return[].concat(u.map(m=>d[m])).some(function(m){return Array.isArray(m)?m.includes(l):m[l]})}function Qe(l,...u){return[].concat(...u).some(function(m){let c=l.match(m);return c&&Vt(c[1])})}function N(l){if(l.match(R)||!l.match(/^-[^-]+/))return!1;let u=!0,w,m=l.slice(1).split("");for(let c=0;c<m.length;c++){if(w=l.slice(c+2),!Vt(m[c])){u=!1;break}if(m[c+1]&&m[c+1]==="="||w==="-"||/[A-Za-z]/.test(m[c])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(w)||m[c+1]&&m[c+1].match(/\W/))break}return u}function q(l){return f["unknown-options-as-args"]&&et(l)}function et(l){return l=l.replace(/^-{3,}/,"--"),l.match(R)||N(l)?!1:!Qe(l,/^-+([^=]+?)=[\s\S]*$/,v,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function D(l){return!F(l,d.bools)&&!F(l,d.counts)&&`${l}`in g?g[l]:rt(Z(l))}function rt(l){return{[dt.BOOLEAN]:!0,[dt.STRING]:"",[dt.NUMBER]:void 0,[dt.ARRAY]:[]}[l]}function Z(l){let u=dt.BOOLEAN;return F(l,d.strings)?u=dt.STRING:F(l,d.numbers)?u=dt.NUMBER:F(l,d.bools)?u=dt.BOOLEAN:F(l,d.arrays)&&(u=dt.ARRAY),u}function nt(l){return l===void 0}function Ee(){Object.keys(d.counts).find(l=>F(l,d.arrays)?(T=Error(y("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):F(l,d.nargs)?(T=Error(y("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},d.aliases),argv:Object.assign($t,H),configuration:f,defaulted:Object.assign({},A),error:T,newAliases:Object.assign({},_)}}};function ai(s){let t=[],e=Object.create(null),n=!0;for(Object.keys(s).forEach(function(i){t.push([].concat(s[i],i))});n;){n=!1;for(let i=0;i<t.length;i++)for(let o=i+1;o<t.length;o++)if(t[i].filter(function(f){return t[o].indexOf(f)!==-1}).length){t[i]=t[i].concat(t[o]),t.splice(o,1),n=!0;break}}return t.forEach(function(i){i=i.filter(function(a,f,g){return g.indexOf(a)===f});let o=i.pop();o!==void 0&&typeof o=="string"&&(e[o]=i)}),e}function Se(s){return s!==void 0?s+1:1}function on(s){return s==="__proto__"?"___proto___":s}function li(s){return typeof s=="string"&&(s[0]==="'"||s[0]==='"')&&s[s.length-1]===s[0]?s.substring(1,s.length-1):s}import{readFileSync as ui}from"fs";var an=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version&&Number(process.version.match(/v([^.]+)/)[1])<an)throw Error(`yargs parser supports a minimum Node.js version of ${an}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var di=process?process.env:{},ln=new ce({cwd:process.cwd,env:()=>di,format:fi,normalize:ci,resolve:hi,require:s=>{if(typeof _t<"u")return _t(s);if(s.match(/\.json$/))return JSON.parse(ui(s,"utf8"));throw Error("only .json config files are supported in ESM")}}),ee=function(t,e){return ln.parse(t.slice(),e).argv};ee.detailed=function(s,t){return ln.parse(s.slice(),t)};ee.camelCase=Ft;ee.decamelize=le;ee.looksLikeNumber=fe;var Pe=ee;import{basename as Si,dirname as Pi,extname as Mi,relative as Ii,resolve as pn}from"path";function fn(){return pi()?0:1}function pi(){return mi()&&!process.defaultApp}function mi(){return!!process.versions.electron}function Me(s){return s.slice(fn()+1)}function cn(){return process.argv[fn()]}var V=class extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace(this,V)}};import{readFileSync as gi,statSync as bi,writeFile as Oi}from"fs";import{format as _i}from"util";import{resolve as wi}from"path";var hn={fs:{readFileSync:gi,writeFile:Oi},format:_i,resolve:wi,exists:s=>{try{return bi(s).isFile()}catch{return!1}}};var Ot,Ie=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(),Ot.format.apply(Ot.format,[this.cache[this.locale][e]||e].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),i=t.shift(),o=function(){};typeof t[t.length-1]=="function"&&(o=t.pop()),this.cache[this.locale]||this._readLocaleFile();let a=i===1?e:n;this.cache[this.locale][e]&&(a=this.cache[this.locale][e][i===1?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:o})):o();let f=[a];return~a.indexOf("%d")&&f.push(i),Ot.format.apply(Ot.format,f.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let n="";return t.forEach(function(i,o){let a=e[o+1];n+=i,typeof a<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let t=this,e=this.writeQueue[0],n=e.directory,i=e.locale,o=e.cb,a=this._resolveLocaleFile(n,i),f=JSON.stringify(this.cache[i],null,2);Ot.fs.writeFile(a,f,"utf-8",function(g){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),o(g)})}_readLocaleFile(){let t={},e=this._resolveLocaleFile(this.directory,this.locale);try{Ot.fs.readFileSync&&(t=JSON.parse(Ot.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=Ot.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){let i=Ot.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(i)&&(n=i)}return n}_fileExistsSync(t){return Ot.exists(t)}};function un(s,t){Ot=t;let e=new Ie(s);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 yi=s=>un(s,hn),dn=yi;var $i="require is not supported by ESM",mn="loading a directory of commands is not supported yet for ESM",he;try{he=Ai(import.meta.url)}catch{he=process.cwd()}var Fi=he.split("node_modules")[0],$e={assert:{notStrictEqual:Ci,strictEqual:Ei},cliui:Ae,findUp:sn,getEnv:s=>process.env[s],inspect:ji,getCallerFile:()=>{throw new V(mn)},getProcessArgvBin:cn,mainFilename:Fi||process.cwd(),Parser:Pe,path:{basename:Si,dirname:Pi,extname:Mi,relative:Ii,resolve:pn},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(s,t)=>process.emitWarning(s,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:xi,require:()=>{throw new V($i)},requireDirectory:()=>{throw new V(mn)},stringWidth:s=>[...s].length,y18n:dn({directory:pn(he,"../../../locales"),updateFiles:!1})};function at(s,t,e,n){e.assert.notStrictEqual(s,t,n)}function Fe(s,t){t.assert.strictEqual(typeof s,"string")}function Kt(s){return Object.keys(s)}function J(s){return!!s&&!!s.then&&typeof s.then=="function"}function xt(s){let e=s.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${s}`);let o={cmd:i.replace(n,""),demanded:[],optional:[]};return e.forEach((a,f)=>{let g=!1;a=a.replace(/\s/g,""),/\.+[\]>]/.test(a)&&f===e.length-1&&(g=!0),/^\[/.test(a)?o.optional.push({cmd:a.replace(n,"").split("|"),variadic:g}):o.demanded.push({cmd:a.replace(n,"").split("|"),variadic:g})}),o}var Ni=["first","second","third","fourth","fifth","sixth"];function j(s,t,e){function n(){return typeof s=="object"?[{demanded:[],optional:[]},s,t]:[xt(`cmd ${s}`),t,e]}try{let i=0,[o,a,f]=n(),g=[].slice.call(a);for(;g.length&&g[g.length-1]===void 0;)g.pop();let O=f||g.length;if(O<o.demanded.length)throw new V(`Not enough arguments provided. Expected ${o.demanded.length} but received ${g.length}.`);let b=o.demanded.length+o.optional.length;if(O>b)throw new V(`Too many arguments provided. Expected max ${b} but received ${O}.`);o.demanded.forEach(h=>{let p=g.shift(),_=gn(p);h.cmd.filter(y=>y===_||y==="*").length===0&&bn(_,h.cmd,i),i+=1}),o.optional.forEach(h=>{if(g.length===0)return;let p=g.shift(),_=gn(p);h.cmd.filter(y=>y===_||y==="*").length===0&&bn(_,h.cmd,i),i+=1})}catch(i){console.warn(i.stack)}}function gn(s){return Array.isArray(s)?"array":s===null?"null":typeof s}function bn(s,t,e){throw new V(`Invalid ${Ni[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${s}.`)}var ue=class{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,i=!1){if(j("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let o=0;o<t.length;o++){if(typeof t[o]!="function")throw Error("middleware must be a function");let a=t[o];a.applyBeforeValidation=e,a.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){let o=t;o.applyBeforeValidation=e,o.global=n,o.mutates=i,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(i=>{let o=[...n[e]||[],e];return i.option?!o.includes(i.option):!0}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let t=this.frozens.pop();t!==void 0&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}};function On(s){return s?s.map(t=>(t.applyBeforeValidation=!1,t)):[]}function Nt(s,t,e,n){return e.reduce((i,o)=>{if(o.applyBeforeValidation!==n)return i;if(o.mutates){if(o.applied)return i;o.applied=!0}if(J(i))return i.then(a=>Promise.all([a,o(a,t)])).then(([a,f])=>Object.assign(a,f));{let a=o(i,t);return J(a)?a.then(f=>Object.assign(i,f)):Object.assign(i,a)}},s)}function Wt(s,t,e=n=>{throw n}){try{let n=Wi(s)?s():s;return J(n)?n.then(i=>t(i)):t(n)}catch(n){return e(n)}}function Wi(s){return typeof s=="function"}function Ne(s){if(typeof _t>"u")return null;for(let t=0,e=Object.keys(_t.cache),n;t<e.length;t++)if(n=_t.cache[e[t]],n.exports===s)return n;return null}var Jt=/(^\*)|(^\$0)/,We=class{constructor(t,e,n,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,i){i=i||{},typeof i.recurse!="boolean"&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);let o=typeof i.visit=="function"?i.visit:a=>a;i.visit=(a,f,g)=>{let O=o(a,f,g);if(O){if(this.requireCache.has(f))return O;this.requireCache.add(f),this.addHandler(O)}return O},this.shim.requireDirectory({require:e,filename:n},t,i)}addHandler(t,e,n,i,o,a){let f=[],g=On(o);if(i=i||(()=>{}),Array.isArray(t))if(Li(t))[t,...f]=t;else for(let O of t)this.addHandler(O);else if(Di(t)){let O=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(O=[].concat(O).concat(t.aliases)),this.addHandler(O,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(_n(n)){this.addHandler([t].concat(f),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){let O=xt(t);f=f.map(p=>xt(p).cmd);let b=!1,h=[O.cmd].concat(f).filter(p=>Jt.test(p)?(b=!0,!1):!0);h.length===0&&b&&h.push("$0"),b&&(O.cmd=h[0],f=h.slice(1),t=t.replace(Jt,O.cmd)),f.forEach(p=>{this.aliasMap[p]=O.cmd}),e!==!1&&this.usage.command(t,e,b,f,a),this.handlers[O.cmd]={original:t,description:e,handler:i,builder:n||{},middlewares:g,deprecated:a,demanded:O.demanded,optional:O.optional},b&&(this.defaultCommand=this.handlers[O.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,i,o,a){let f=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,g=e.getInternalMethods().getContext(),O=g.commands.slice(),b=!t;t&&(g.commands.push(t),g.fullCommands.push(f.original));let h=this.applyBuilderUpdateUsageAndParse(b,f,e,n.aliases,O,i,o,a);return J(h)?h.then(p=>this.applyMiddlewareAndGetResult(b,f,p.innerArgv,g,o,p.aliases,e)):this.applyMiddlewareAndGetResult(b,f,h.innerArgv,g,o,h.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,i,o,a,f,g){let O=e.builder,b=n;if(de(O)){let h=O(n.getInternalMethods().reset(i),g);if(J(h))return h.then(p=>(b=yn(p)?p:n,this.parseAndUpdateUsage(t,e,b,o,a,f)))}else zi(O)&&(b=n.getInternalMethods().reset(i),Object.keys(e.builder).forEach(h=>{b.option(h,O[h])}));return this.parseAndUpdateUsage(t,e,b,o,a,f)}parseAndUpdateUsage(t,e,n,i,o,a){t&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);let f=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,o,a);return J(f)?f.then(g=>({aliases:n.parsed.aliases,innerArgv:g})):{aliases:n.parsed.aliases,innerArgv:f}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){let n=Jt.test(e.original)?e.original.replace(Jt,"").trim():e.original,i=t.filter(o=>!Jt.test(o));return i.push(n),`$0 ${i.join(" ")}`}applyMiddlewareAndGetResult(t,e,n,i,o,a,f){let g={};if(o)return n;f.getInternalMethods().getHasOutput()||(g=this.populatePositionals(e,n,i,f));let O=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares);if(n=Nt(n,f,O,!0),!f.getInternalMethods().getHasOutput()){let b=f.getInternalMethods().runValidation(a,g,f.parsed.error,t);n=Wt(n,h=>(b(h),h))}if(e.handler&&!f.getInternalMethods().getHasOutput()){f.getInternalMethods().setHasOutput();let b=!!f.getOptions().configuration["populate--"];f.getInternalMethods().postProcess(n,b,!1,!1),n=Nt(n,f,O,!1),n=Wt(n,h=>{let p=e.handler(h);return J(p)?p.then(()=>h):h}),t||f.getInternalMethods().getUsageInstance().cacheHelpMessage(),J(n)&&!f.getInternalMethods().hasParseCallback()&&n.catch(h=>{try{f.getInternalMethods().getUsageInstance().fail(null,h)}catch{}})}return t||(i.commands.pop(),i.fullCommands.pop()),n}populatePositionals(t,e,n,i){e._=e._.slice(n.commands.length);let o=t.demanded.slice(0),a=t.optional.slice(0),f={};for(this.validation.positionalCount(o.length,e._.length);o.length;){let g=o.shift();this.populatePositional(g,e,f)}for(;a.length;){let g=a.shift();this.populatePositional(g,e,f)}return e._=n.commands.concat(e._.map(g=>""+g)),this.postProcessPositionals(e,f,this.cmdToParseOptions(t.original),i),f}populatePositional(t,e,n){let i=t.cmd[0];t.variadic?n[i]=e._.splice(0).map(String):e._.length&&(n[i]=[String(e._.shift())])}cmdToParseOptions(t){let e={array:[],default:{},alias:{},demand:{}},n=xt(t);return n.demanded.forEach(i=>{let[o,...a]=i.cmd;i.variadic&&(e.array.push(o),e.default[o]=[]),e.alias[o]=a,e.demand[o]=!0}),n.optional.forEach(i=>{let[o,...a]=i.cmd;i.variadic&&(e.array.push(o),e.default[o]=[]),e.alias[o]=a}),e}postProcessPositionals(t,e,n,i){let o=Object.assign({},i.getOptions());o.default=Object.assign(n.default,o.default);for(let O of Object.keys(n.alias))o.alias[O]=(o.alias[O]||[]).concat(n.alias[O]);o.array=o.array.concat(n.array),o.config={};let a=[];if(Object.keys(e).forEach(O=>{e[O].map(b=>{o.configuration["unknown-options-as-args"]&&(o.key[O]=!0),a.push(`--${O}`),a.push(b)})}),!a.length)return;let f=Object.assign({},o.configuration,{"populate--":!1}),g=this.shim.Parser.detailed(a,Object.assign({},o,{configuration:f}));if(g.error)i.getInternalMethods().getUsageInstance().fail(g.error.message,g.error);else{let O=Object.keys(e);Object.keys(e).forEach(h=>{O.push(...g.aliases[h])});let b=i.getOptions().default;Object.keys(g.argv).forEach(h=>{O.includes(h)&&(e[h]||(e[h]=g.argv[h]),!Object.hasOwnProperty.call(b,h)&&Object.hasOwnProperty.call(t,h)&&Object.hasOwnProperty.call(g.argv,h)&&(Array.isArray(t[h])||Array.isArray(g.argv[h]))?t[h]=[].concat(t[h],g.argv[h]):t[h]=g.argv[h])})}}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let n=Jt.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(de(e))return e(t,!0);_n(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){let e=Ne(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:n}){for(let i of[t,e,n]){if(typeof i=="string"||i===!1)return i;at(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let t=this.frozens.pop();at(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 wn(s,t,e,n){return new We(s,t,e,n)}function _n(s){return typeof s=="object"&&!!s.builder&&typeof s.handler=="function"}function Li(s){return s.every(t=>typeof t=="string")}function de(s){return typeof s=="function"}function zi(s){return typeof s=="object"}function Di(s){return typeof s=="object"&&!Array.isArray(s)}function At(s={},t=()=>!0){let e={};return Kt(s).forEach(n=>{t(n,s[n])&&(e[n]=s[n])}),e}function St(s){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{let e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(s)})}function Ri(s){return typeof s=="boolean"}function En(s,t){let e=t.y18n.__,n={},i=[];n.failFn=function(C){i.push(C)};let o=null,a=null,f=!0;n.showHelpOnFail=function(C=!0,M){let[L,B]=typeof C=="string"?[!0,C]:[C,M];return s.getInternalMethods().isGlobalContext()&&(a=B),o=B,f=L,n};let g=!1;n.fail=function(C,M){let L=s.getInternalMethods().getLoggerInstance();if(i.length)for(let B=i.length-1;B>=0;--B){let k=i[B];if(Ri(k)){if(M)throw M;if(C)throw Error(C)}else k(C,M,n)}else{if(s.getExitProcess()&&St(!0),!g){g=!0,f&&(s.showHelp("error"),L.error()),(C||M)&&L.error(C||M);let B=o||a;B&&((C||M)&&L.error(""),L.error(B))}if(M=M||new V(C),s.getExitProcess())return s.exit(1);if(s.getInternalMethods().hasParseCallback())return s.exit(1,M);throw M}};let O=[],b=!1;n.usage=(P,C)=>P===null?(b=!0,O=[],n):(b=!1,O.push([P,C||""]),n),n.getUsage=()=>O,n.getUsageDisabled=()=>b,n.getPositionalGroupName=()=>e("Positionals:");let h=[];n.example=(P,C)=>{h.push([P,C||""])};let p=[];n.command=function(C,M,L,B,k=!1){L&&(p=p.map(U=>(U[2]=!1,U))),p.push([C,M||"",L,B,k])},n.getCommands=()=>p;let _={};n.describe=function(C,M){Array.isArray(C)?C.forEach(L=>{n.describe(L,M)}):typeof C=="object"?Object.keys(C).forEach(L=>{n.describe(L,C[L])}):_[C]=M},n.getDescriptions=()=>_;let A=[];n.epilog=P=>{A.push(P)};let y=!1,d;n.wrap=P=>{y=!0,d=P};function R(){return y||(d=qt(),y=!0),d}let v="__yargsString__:";n.deferY18nLookup=P=>v+P,n.help=function(){if(H)return H;Y();let C=s.customScriptName?s.$0:t.path.basename(s.$0),M=s.getDemandedOptions(),L=s.getDemandedCommands(),B=s.getDeprecatedOptions(),k=s.getGroups(),U=s.getOptions(),tt=[];tt=tt.concat(Object.keys(_)),tt=tt.concat(Object.keys(M)),tt=tt.concat(Object.keys(L)),tt=tt.concat(Object.keys(U.default)),tt=tt.filter(ut),tt=Object.keys(tt.reduce((N,q)=>(q!=="_"&&(N[q]=!0),N),{}));let jt=R(),K=t.cliui({width:jt,wrap:!!jt});if(!b){if(O.length)O.forEach(N=>{K.div({text:`${N[0].replace(/\$0/g,C)}`}),N[1]&&K.div({text:`${N[1]}`,padding:[1,0,0,0]})}),K.div();else if(p.length){let N=null;L._?N=`${C} <${e("command")}>
7
7
  `:N=`${C} [${e("command")}]
8
- `,J.div(`${N}`)}}if(c.length>1||c.length===1&&!c[0][2]){J.div(e("Commands:"));let N=s.getInternalMethods().getContext(),G=N.commands.length?`${N.commands.join(" ")} `:"";s.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(c=c.sort((v,Z)=>v[0].localeCompare(Z[0])));let Q=C?`${C} `:"";c.forEach(v=>{let Z=`${Q}${G}${v[0].replace(/^\$0 ?/,"")}`;J.span({text:Z,padding:[0,2,0,2],width:R(c,Wt,`${C}${G}`)+4},{text:v[1]});let tt=[];v[2]&&tt.push(`[${e("default")}]`),v[3]&&v[3].length&&tt.push(`[${e("aliases:")} ${v[3].join(", ")}]`),v[4]&&(typeof v[4]=="string"?tt.push(`[${e("deprecated: %s",v[4])}]`):tt.push(`[${e("deprecated")}]`)),tt.length?J.div({text:tt.join(" "),padding:[0,0,0,2],align:"right"}):J.div()}),J.div()}let Et=(Object.keys(U.alias)||[]).concat(Object.keys(s.parsed.newAliases)||[]);nt=nt.filter(N=>!s.parsed.newAliases[N]&&Et.every(G=>(U.alias[G]||[]).indexOf(N)===-1));let jt=e("Options:");k[jt]||(k[jt]=[]),T(nt,U.alias,k,jt);let Lt=N=>/^--/.test(de(N)),F=Object.keys(k).filter(N=>k[N].length>0).map(N=>{let G=k[N].filter(At).map(Q=>{if(Et.includes(Q))return Q;for(let v=0,Z;(Z=Et[v])!==void 0;v++)if((U.alias[Z]||[]).includes(Q))return Z;return Q});return{groupName:N,normalizedKeys:G}}).filter(({normalizedKeys:N})=>N.length>0).map(({groupName:N,normalizedKeys:G})=>{let Q=G.reduce((v,Z)=>(v[Z]=[Z].concat(U.alias[Z]||[]).map(tt=>N===n.getPositionalGroupName()?tt:(/^[0-9]$/.test(tt)?U.boolean.includes(Z)?"-":"--":tt.length>1?"--":"-")+tt).sort((tt,bt)=>Lt(tt)===Lt(bt)?0:Lt(tt)?1:-1).join(", "),v),{});return{groupName:N,normalizedKeys:G,switches:Q}});if(F.filter(({groupName:N})=>N!==n.getPositionalGroupName()).some(({normalizedKeys:N,switches:G})=>!N.every(Q=>Lt(G[Q])))&&F.filter(({groupName:N})=>N!==n.getPositionalGroupName()).forEach(({normalizedKeys:N,switches:G})=>{N.forEach(Q=>{Lt(G[Q])&&(G[Q]=Di(G[Q],4))})}),F.forEach(({groupName:N,normalizedKeys:G,switches:Q})=>{J.div(N),G.forEach(v=>{let Z=Q[v],tt=m[v]||"",bt=null;tt.includes(D)&&(tt=e(tt.substring(D.length))),U.boolean.includes(v)&&(bt=`[${e("boolean")}]`),U.count.includes(v)&&(bt=`[${e("count")}]`),U.string.includes(v)&&(bt=`[${e("string")}]`),U.normalize.includes(v)&&(bt=`[${e("string")}]`),U.array.includes(v)&&(bt=`[${e("array")}]`),U.number.includes(v)&&(bt=`[${e("number")}]`);let Ot=l=>typeof l=="string"?`[${e("deprecated: %s",l)}]`:`[${e("deprecated")}]`,oe=[v in q?Ot(q[v]):null,bt,v in $?`[${e("required")}]`:null,U.choices&&U.choices[v]?`[${e("choices:")} ${n.stringifiedValues(U.choices[v])}]`:null,gt(U.default[v],U.defaultDescription[v])].filter(Boolean).join(" ");J.span({text:de(Z),padding:[0,2,0,2+_n(Z)],width:R(Q,Wt)+4},tt),oe?J.div({text:oe,padding:[0,0,0,2],align:"right"}):J.div()}),J.div()}),b.length&&(J.div(e("Examples:")),b.forEach(N=>{N[0]=N[0].replace(/\$0/g,C)}),b.forEach(N=>{N[1]===""?J.div({text:N[0],padding:[0,2,0,2]}):J.div({text:N[0],padding:[0,2,0,2],width:R(b,Wt)+4},{text:N[1]})}),J.div()),w.length>0){let N=w.map(G=>G.replace(/\$0/g,C)).join(`
9
- `);J.div(`${N}
10
- `)}return J.toString().replace(/\s*$/,"")};function R(S,C,$){let L=0;return Array.isArray(S)||(S=Object.values(S).map(q=>[q])),S.forEach(q=>{L=Math.max(t.stringWidth($?`${$} ${de(q[0])}`:de(q[0]))+_n(q[0]),L)}),C&&(L=Math.min(L,parseInt((C*.5).toString(),10))),L}function Y(){let S=s.getDemandedOptions(),C=s.getOptions();(Object.keys(C.alias)||[]).forEach($=>{C.alias[$].forEach(L=>{m[L]&&n.describe($,m[L]),L in S&&s.demandOption($,S[L]),C.boolean.includes(L)&&s.boolean($),C.count.includes(L)&&s.count($),C.string.includes(L)&&s.string($),C.normalize.includes(L)&&s.normalize($),C.array.includes(L)&&s.array($),C.number.includes(L)&&s.number($)})})}let H;n.cacheHelpMessage=function(){H=this.help()},n.clearCachedHelpMessage=function(){H=void 0},n.hasCachedHelpMessage=function(){return!!H};function T(S,C,$,L){let q=[],k=null;return Object.keys($).forEach(U=>{q=q.concat($[U])}),S.forEach(U=>{k=[U].concat(C[U]),k.some(nt=>q.indexOf(nt)!==-1)||$[L].push(U)}),q}function At(S){return s.getOptions().hiddenOptions.indexOf(S)<0||s.parsed.argv[s.getOptions().showHiddenOpt]}n.showHelp=S=>{let C=s.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:C[S])(n.help())},n.functionDescription=S=>{let C=S.name?t.Parser.decamelize(S.name,"-"):e("generated-value");return["(",C,")"].join("")},n.stringifiedValues=function(C,$){let L="",q=$||", ",k=[].concat(C);return!C||!k.length||k.forEach(U=>{L.length&&(L+=q),L+=JSON.stringify(U)}),L};function gt(S,C){let $=`[${e("default:")} `;if(S===void 0&&!C)return null;if(C)$+=C;else switch(typeof S){case"string":$+=`"${S}"`;break;case"object":$+=JSON.stringify(S);break;default:$+=S}return`${$}]`}function Jt(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let Ft=null;n.version=S=>{Ft=S},n.showVersion=S=>{let C=s.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:C[S])(Ft)},n.reset=function(C){return o=null,f=!1,g=[],O=!1,w=[],b=[],c=[],m=Pt(m,$=>!C[$]),n};let B=[];return n.freeze=function(){B.push({failMessage:o,failureOutput:f,usages:g,usageDisabled:O,epilogs:w,examples:b,commands:c,descriptions:m})},n.unfreeze=function(){let C=B.pop();!C||({failMessage:o,failureOutput:f,usages:g,usageDisabled:O,epilogs:w,examples:b,commands:c,descriptions:m}=C)},n}function Ne(s){return typeof s=="object"}function Di(s,t){return Ne(s)?{text:s.text,indentation:s.indentation+t}:{text:s,indentation:t}}function _n(s){return Ne(s)?s.indentation:0}function de(s){return Ne(s)?s.text:s}var yn=`###-begin-{{app_name}}-completions-###
8
+ `,K.div(`${N}`)}}if(p.length>1||p.length===1&&!p[0][2]){K.div(e("Commands:"));let N=s.getInternalMethods().getContext(),q=N.commands.length?`${N.commands.join(" ")} `:"";s.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(p=p.sort((D,rt)=>D[0].localeCompare(rt[0])));let et=C?`${C} `:"";p.forEach(D=>{let rt=`${et}${q}${D[0].replace(/^\$0 ?/,"")}`;K.span({text:rt,padding:[0,2,0,2],width:T(p,jt,`${C}${q}`)+4},{text:D[1]});let Z=[];D[2]&&Z.push(`[${e("default")}]`),D[3]&&D[3].length&&Z.push(`[${e("aliases:")} ${D[3].join(", ")}]`),D[4]&&(typeof D[4]=="string"?Z.push(`[${e("deprecated: %s",D[4])}]`):Z.push(`[${e("deprecated")}]`)),Z.length?K.div({text:Z.join(" "),padding:[0,0,0,2],align:"right"}):K.div()}),K.div()}let Ct=(Object.keys(U.alias)||[]).concat(Object.keys(s.parsed.newAliases)||[]);tt=tt.filter(N=>!s.parsed.newAliases[N]&&Ct.every(q=>(U.alias[q]||[]).indexOf(N)===-1));let te=e("Options:");k[te]||(k[te]=[]),$t(tt,U.alias,k,te);let F=N=>/^--/.test(pe(N)),Vt=Object.keys(k).filter(N=>k[N].length>0).map(N=>{let q=k[N].filter(ut).map(et=>{if(Ct.includes(et))return et;for(let D=0,rt;(rt=Ct[D])!==void 0;D++)if((U.alias[rt]||[]).includes(et))return rt;return et});return{groupName:N,normalizedKeys:q}}).filter(({normalizedKeys:N})=>N.length>0).map(({groupName:N,normalizedKeys:q})=>{let et=q.reduce((D,rt)=>(D[rt]=[rt].concat(U.alias[rt]||[]).map(Z=>N===n.getPositionalGroupName()?Z:(/^[0-9]$/.test(Z)?U.boolean.includes(rt)?"-":"--":Z.length>1?"--":"-")+Z).sort((Z,nt)=>F(Z)===F(nt)?0:F(Z)?1:-1).join(", "),D),{});return{groupName:N,normalizedKeys:q,switches:et}});if(Vt.filter(({groupName:N})=>N!==n.getPositionalGroupName()).some(({normalizedKeys:N,switches:q})=>!N.every(et=>F(q[et])))&&Vt.filter(({groupName:N})=>N!==n.getPositionalGroupName()).forEach(({normalizedKeys:N,switches:q})=>{N.forEach(et=>{F(q[et])&&(q[et]=vi(q[et],4))})}),Vt.forEach(({groupName:N,normalizedKeys:q,switches:et})=>{K.div(N),q.forEach(D=>{let rt=et[D],Z=_[D]||"",nt=null;Z.includes(v)&&(Z=e(Z.substring(v.length))),U.boolean.includes(D)&&(nt=`[${e("boolean")}]`),U.count.includes(D)&&(nt=`[${e("count")}]`),U.string.includes(D)&&(nt=`[${e("string")}]`),U.normalize.includes(D)&&(nt=`[${e("string")}]`),U.array.includes(D)&&(nt=`[${e("array")}]`),U.number.includes(D)&&(nt=`[${e("number")}]`);let Ee=u=>typeof u=="string"?`[${e("deprecated: %s",u)}]`:`[${e("deprecated")}]`,l=[D in B?Ee(B[D]):null,nt,D in M?`[${e("required")}]`:null,U.choices&&U.choices[D]?`[${e("choices:")} ${n.stringifiedValues(U.choices[D])}]`:null,Gt(U.default[D],U.defaultDescription[D])].filter(Boolean).join(" ");K.span({text:pe(rt),padding:[0,2,0,2+Cn(rt)],width:T(et,jt)+4},Z),l?K.div({text:l,padding:[0,0,0,2],align:"right"}):K.div()}),K.div()}),h.length&&(K.div(e("Examples:")),h.forEach(N=>{N[0]=N[0].replace(/\$0/g,C)}),h.forEach(N=>{N[1]===""?K.div({text:N[0],padding:[0,2,0,2]}):K.div({text:N[0],padding:[0,2,0,2],width:T(h,jt)+4},{text:N[1]})}),K.div()),A.length>0){let N=A.map(q=>q.replace(/\$0/g,C)).join(`
9
+ `);K.div(`${N}
10
+ `)}return K.toString().replace(/\s*$/,"")};function T(P,C,M){let L=0;return Array.isArray(P)||(P=Object.values(P).map(B=>[B])),P.forEach(B=>{L=Math.max(t.stringWidth(M?`${M} ${pe(B[0])}`:pe(B[0]))+Cn(B[0]),L)}),C&&(L=Math.min(L,parseInt((C*.5).toString(),10))),L}function Y(){let P=s.getDemandedOptions(),C=s.getOptions();(Object.keys(C.alias)||[]).forEach(M=>{C.alias[M].forEach(L=>{_[L]&&n.describe(M,_[L]),L in P&&s.demandOption(M,P[L]),C.boolean.includes(L)&&s.boolean(M),C.count.includes(L)&&s.count(M),C.string.includes(L)&&s.string(M),C.normalize.includes(L)&&s.normalize(M),C.array.includes(L)&&s.array(M),C.number.includes(L)&&s.number(M)})})}let H;n.cacheHelpMessage=function(){H=this.help()},n.clearCachedHelpMessage=function(){H=void 0},n.hasCachedHelpMessage=function(){return!!H};function $t(P,C,M,L){let B=[],k=null;return Object.keys(M).forEach(U=>{B=B.concat(M[U])}),P.forEach(U=>{k=[U].concat(C[U]),k.some(tt=>B.indexOf(tt)!==-1)||M[L].push(U)}),B}function ut(P){return s.getOptions().hiddenOptions.indexOf(P)<0||s.parsed.argv[s.getOptions().showHiddenOpt]}n.showHelp=P=>{let C=s.getInternalMethods().getLoggerInstance();P||(P="error"),(typeof P=="function"?P:C[P])(n.help())},n.functionDescription=P=>{let C=P.name?t.Parser.decamelize(P.name,"-"):e("generated-value");return["(",C,")"].join("")},n.stringifiedValues=function(C,M){let L="",B=M||", ",k=[].concat(C);return!C||!k.length||k.forEach(U=>{L.length&&(L+=B),L+=JSON.stringify(U)}),L};function Gt(P,C){let M=`[${e("default:")} `;if(P===void 0&&!C)return null;if(C)M+=C;else switch(typeof P){case"string":M+=`"${P}"`;break;case"object":M+=JSON.stringify(P);break;default:M+=P}return`${M}]`}function qt(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let G=null;n.version=P=>{G=P},n.showVersion=P=>{let C=s.getInternalMethods().getLoggerInstance();P||(P="error"),(typeof P=="function"?P:C[P])(G)},n.reset=function(C){return o=null,g=!1,O=[],b=!1,A=[],h=[],p=[],_=At(_,M=>!C[M]),n};let kt=[];return n.freeze=function(){kt.push({failMessage:o,failureOutput:g,usages:O,usageDisabled:b,epilogs:A,examples:h,commands:p,descriptions:_})},n.unfreeze=function(C=!1){let M=kt.pop();!M||(C?(_={...M.descriptions,..._},p=[...M.commands,...p],O=[...M.usages,...O],h=[...M.examples,...h],A=[...M.epilogs,...A]):{failMessage:o,failureOutput:g,usages:O,usageDisabled:b,epilogs:A,examples:h,commands:p,descriptions:_}=M)},n}function Le(s){return typeof s=="object"}function vi(s,t){return Le(s)?{text:s.text,indentation:s.indentation+t}:{text:s,indentation:t}}function Cn(s){return Le(s)?s.indentation:0}function pe(s){return Le(s)?s.text:s}var jn=`###-begin-{{app_name}}-completions-###
11
11
  #
12
12
  # yargs command completion script
13
13
  #
@@ -35,7 +35,7 @@ _{{app_name}}_yargs_completions()
35
35
  }
36
36
  complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
37
37
  ###-end-{{app_name}}-completions-###
38
- `,Cn=`#compdef {{app_name}}
38
+ `,xn=`#compdef {{app_name}}
39
39
  ###-begin-{{app_name}}-completions-###
40
40
  #
41
41
  # yargs command completion script
@@ -54,15 +54,15 @@ _{{app_name}}_yargs_completions()
54
54
  }
55
55
  compdef _{{app_name}}_yargs_completions {{app_name}}
56
56
  ###-end-{{app_name}}-completions-###
57
- `;var En=class{constructor(t,e,n,i){var o,a,f;this.yargs=t,this.usage=e,this.command=n,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.zshShell=(f=((o=this.shim.getEnv("SHELL"))===null||o===void 0?void 0:o.includes("zsh"))||((a=this.shim.getEnv("ZSH_NAME"))===null||a===void 0?void 0:a.includes("zsh")))!==null&&f!==void 0?f:!1}defaultCompletion(t,e,n,i){let o=this.command.getCommandHandlers();for(let f=0,g=t.length;f<g;++f)if(o[t[f]]&&o[t[f]].builder){let O=o[t[f]].builder;if(ue(O)){let b=this.yargs.getInternalMethods().reset();return O(b,!0),b.argv}}let a=[];this.commandCompletions(a,t,n),this.optionCompletions(a,t,e,n),this.choicesCompletions(a,t,e,n),i(null,a)}commandCompletions(t,e,n){let i=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&i[i.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(o=>{let a=St(o[0]).cmd;if(e.indexOf(a)===-1)if(!this.zshShell)t.push(a);else{let f=o[1]||"";t.push(a.replace(/:/g,"\\:")+":"+f)}})}optionCompletions(t,e,n,i){if((i.match(/^-/)||i===""&&t.length===0)&&!this.previousArgHasChoices(e)){let o=this.yargs.getOptions(),a=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(o.key).forEach(f=>{let g=!!o.configuration["boolean-negation"]&&o.boolean.includes(f);!a.includes(f)&&!this.argsContainKey(e,n,f,g)&&(this.completeOptionKey(f,t,i),g&&!!o.default[f]&&this.completeOptionKey(`no-${f}`,t,i))})}}choicesCompletions(t,e,n,i){if(this.previousArgHasChoices(e)){let o=this.getPreviousArgChoices(e);o&&o.length>0&&t.push(...o)}}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],n="";if(!e.startsWith("--")&&t.length>1&&(n=e,e=t[t.length-2]),!e.startsWith("--"))return;let i=e.replace(/-/g,""),o=this.yargs.getOptions();if(Object.keys(o.key).some(a=>a===i)&&Array.isArray(o.choices[i]))return o.choices[i].filter(a=>!n||a.startsWith(n))}previousArgHasChoices(t){let e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n,i){if(t.indexOf(`--${n}`)!==-1||i&&t.indexOf(`--no-${n}`)!==-1)return!0;if(this.aliases){for(let o of this.aliases[n])if(e[o]!==void 0)return!0}return!1}completeOptionKey(t,e,n){let i=this.usage.getDescriptions(),o=g=>/^--/.test(g),a=g=>/^[^0-9]$/.test(g),f=!o(n)&&a(t)?"-":"--";if(!this.zshShell)e.push(f+t);else{let g=i[t]||"";e.push(f+`${t.replace(/:/g,"\\:")}:${g.replace("__yargsString__:","")}`)}}customCompletion(t,e,n,i){if(ot(this.customCompletionFunction,null,this.shim),Ri(this.customCompletionFunction)){let o=this.customCompletionFunction(n,e);return K(o)?o.then(a=>{this.shim.process.nextTick(()=>{i(null,a)})}).catch(a=>{this.shim.process.nextTick(()=>{i(a,void 0)})}):i(null,o)}else return Ui(this.customCompletionFunction)?this.customCompletionFunction(n,e,(o=i)=>this.defaultCompletion(t,e,n,o),o=>{i(null,o)}):this.customCompletionFunction(n,e,o=>{i(null,o)})}getCompletion(t,e){let n=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),o=this.customCompletionFunction?a=>this.customCompletion(t,a,n,e):a=>this.defaultCompletion(t,a,n,e);return K(i)?i.then(o):o(i)}generateCompletionScript(t,e){let n=this.zshShell?Cn:yn,i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,i),n=n.replace(/{{completion_command}}/g,e),n.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}};function jn(s,t,e,n){return new En(s,t,e,n)}function Ri(s){return s.length<3}function Ui(s){return s.length>3}function xn(s,t){if(s.length===0)return t.length;if(t.length===0)return s.length;let e=[],n;for(n=0;n<=t.length;n++)e[n]=[n];let i;for(i=0;i<=s.length;i++)e[0][i]=i;for(n=1;n<=t.length;n++)for(i=1;i<=s.length;i++)t.charAt(n-1)===s.charAt(i-1)?e[n][i]=e[n-1][i-1]:n>1&&i>1&&t.charAt(n-2)===s.charAt(i-1)&&t.charAt(n-1)===s.charAt(i-2)?e[n][i]=e[n-2][i-2]+1:e[n][i]=Math.min(e[n-1][i-1]+1,Math.min(e[n][i-1]+1,e[n-1][i]+1));return e[t.length][s.length]}var An=["$0","--","_"];function Sn(s,t,e){let n=e.y18n.__,i=e.y18n.__n,o={};o.nonOptionCount=function(c){let m=s.getDemandedCommands(),M=c._.length+(c["--"]?c["--"].length:0)-s.getInternalMethods().getContext().commands.length;m._&&(M<m._.min||M>m._.max)&&(M<m._.min?m._.minMsg!==void 0?t.fail(m._.minMsg?m._.minMsg.replace(/\$0/g,M.toString()).replace(/\$1/,m._.min.toString()):null):t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",M,M.toString(),m._.min.toString())):M>m._.max&&(m._.maxMsg!==void 0?t.fail(m._.maxMsg?m._.maxMsg.replace(/\$0/g,M.toString()).replace(/\$1/,m._.max.toString()):null):t.fail(i("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",M,M.toString(),m._.max.toString()))))},o.positionalCount=function(c,m){m<c&&t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",m,m+"",c+""))},o.requiredArguments=function(c,m){let w=null;for(let M of Object.keys(m))(!Object.prototype.hasOwnProperty.call(c,M)||typeof c[M]>"u")&&(w=w||{},w[M]=m[M]);if(w){let M=[];for(let d of Object.keys(w)){let D=w[d];D&&M.indexOf(D)<0&&M.push(D)}let y=M.length?`
58
- ${M.join(`
59
- `)}`:"";t.fail(i("Missing required argument: %s","Missing required arguments: %s",Object.keys(w).length,Object.keys(w).join(", ")+y))}},o.unknownArguments=function(c,m,w,M,y=!0){var d;let D=s.getInternalMethods().getCommandInstance().getCommands(),R=[],Y=s.getInternalMethods().getContext();if(Object.keys(c).forEach(H=>{!An.includes(H)&&!Object.prototype.hasOwnProperty.call(w,H)&&!Object.prototype.hasOwnProperty.call(s.getInternalMethods().getParseContext(),H)&&!o.isValidAndSomeAliasIsNotNew(H,m)&&R.push(H)}),y&&(Y.commands.length>0||D.length>0||M)&&c._.slice(Y.commands.length).forEach(H=>{D.includes(""+H)||R.push(""+H)}),y){let T=((d=s.getDemandedCommands()._)===null||d===void 0?void 0:d.max)||0,At=Y.commands.length+T;At<c._.length&&c._.slice(At).forEach(gt=>{gt=String(gt),!Y.commands.includes(gt)&&!R.includes(gt)&&R.push(gt)})}R.length&&t.fail(i("Unknown argument: %s","Unknown arguments: %s",R.length,R.join(", ")))},o.unknownCommands=function(c){let m=s.getInternalMethods().getCommandInstance().getCommands(),w=[],M=s.getInternalMethods().getContext();return(M.commands.length>0||m.length>0)&&c._.slice(M.commands.length).forEach(y=>{m.includes(""+y)||w.push(""+y)}),w.length>0?(t.fail(i("Unknown command: %s","Unknown commands: %s",w.length,w.join(", "))),!0):!1},o.isValidAndSomeAliasIsNotNew=function(c,m){if(!Object.prototype.hasOwnProperty.call(m,c))return!1;let w=s.parsed.newAliases;return[c,...m[c]].some(M=>!Object.prototype.hasOwnProperty.call(w,M)||!w[c])},o.limitedChoices=function(c){let m=s.getOptions(),w={};if(!Object.keys(m.choices).length)return;Object.keys(c).forEach(d=>{An.indexOf(d)===-1&&Object.prototype.hasOwnProperty.call(m.choices,d)&&[].concat(c[d]).forEach(D=>{m.choices[d].indexOf(D)===-1&&D!==void 0&&(w[d]=(w[d]||[]).concat(D))})});let M=Object.keys(w);if(!M.length)return;let y=n("Invalid values:");M.forEach(d=>{y+=`
60
- ${n("Argument: %s, Given: %s, Choices: %s",d,t.stringifiedValues(w[d]),t.stringifiedValues(m.choices[d]))}`}),t.fail(y)};let a={};o.implies=function(c,m){j("<string|object> [array|number|string]",[c,m],arguments.length),typeof c=="object"?Object.keys(c).forEach(w=>{o.implies(w,c[w])}):(s.global(c),a[c]||(a[c]=[]),Array.isArray(m)?m.forEach(w=>o.implies(c,w)):(ot(m,void 0,e),a[c].push(m)))},o.getImplied=function(){return a};function f(b,c){let m=Number(c);return c=isNaN(m)?c:m,typeof c=="number"?c=b._.length>=c:c.match(/^--no-.+/)?(c=c.match(/^--no-(.+)/)[1],c=!Object.prototype.hasOwnProperty.call(b,c)):c=Object.prototype.hasOwnProperty.call(b,c),c}o.implications=function(c){let m=[];if(Object.keys(a).forEach(w=>{let M=w;(a[w]||[]).forEach(y=>{let d=M,D=y;d=f(c,d),y=f(c,y),d&&!y&&m.push(` ${M} -> ${D}`)})}),m.length){let w=`${n("Implications failed:")}
61
- `;m.forEach(M=>{w+=M}),t.fail(w)}};let g={};o.conflicts=function(c,m){j("<string|object> [array|string]",[c,m],arguments.length),typeof c=="object"?Object.keys(c).forEach(w=>{o.conflicts(w,c[w])}):(s.global(c),g[c]||(g[c]=[]),Array.isArray(m)?m.forEach(w=>o.conflicts(c,w)):g[c].push(m))},o.getConflicting=()=>g,o.conflicting=function(c){Object.keys(c).forEach(m=>{g[m]&&g[m].forEach(w=>{w&&c[m]!==void 0&&c[w]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",m,w))})}),s.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(g).forEach(m=>{g[m].forEach(w=>{w&&c[e.Parser.camelCase(m)]!==void 0&&c[e.Parser.camelCase(w)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",m,w))})})},o.recommendCommands=function(c,m){m=m.sort((d,D)=>D.length-d.length);let M=null,y=1/0;for(let d=0,D;(D=m[d])!==void 0;d++){let R=xn(c,D);R<=3&&R<y&&(y=R,M=D)}M&&t.fail(n("Did you mean %s?",M))},o.reset=function(c){return a=Pt(a,m=>!c[m]),g=Pt(g,m=>!c[m]),o};let O=[];return o.freeze=function(){O.push({implied:a,conflicting:g})},o.unfreeze=function(){let c=O.pop();ot(c,void 0,e),{implied:a,conflicting:g}=c},o}var Fe=[],ne;function ie(s,t,e,n){ne=n;let i={};if(Object.prototype.hasOwnProperty.call(s,"extends")){if(typeof s.extends!="string")return i;let o=/\.json|\..*rc$/.test(s.extends),a=null;if(o)a=Yi(t,s.extends);else try{a=wt.resolve(s.extends)}catch{return s}Hi(a),Fe.push(a),i=o?JSON.parse(ne.readFileSync(a,"utf8")):wt(s.extends),delete s.extends,i=ie(i,ne.path.dirname(a),e,ne)}return Fe=[],e?Pn(i,s):Object.assign({},i,s)}function Hi(s){if(Fe.indexOf(s)>-1)throw new V(`Circular extended configurations: '${s}'.`)}function Yi(s,t){return ne.path.resolve(s,t)}function Pn(s,t){let e={};function n(i){return i&&typeof i=="object"&&!Array.isArray(i)}Object.assign(e,s);for(let i of Object.keys(t))n(t[i])&&n(e[i])?e[i]=Pn(s[i],t[i]):e[i]=t[i];return e}var x=function(s,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!i:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(s,e):i?i.value=e:t.set(s,e),e},r=function(s,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!n:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(s):n?n.value:t.get(s)},et,Rt,se,ut,lt,pe,It,Ut,me,dt,ge,pt,yt,ft,mt,Xt,st,P,be,Oe,ct,Ht,kt,Yt,$t,_e,W,Tt,Bt,qt,z,Ct,X;function Vn(s){return(t=[],e=s.process.cwd(),n)=>{let i=new Gn(t,e,n,s);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}}var Mn=Symbol("copyDoubleDash"),In=Symbol("copyDoubleDash"),We=Symbol("deleteFromParserHintObject"),$n=Symbol("emitWarning"),Nn=Symbol("freeze"),Fn=Symbol("getDollarZero"),Vt=Symbol("getParserConfiguration"),Le=Symbol("guessLocale"),Wn=Symbol("guessVersion"),Ln=Symbol("parsePositionalNumbers"),ze=Symbol("pkgUp"),Nt=Symbol("populateParserHintArray"),te=Symbol("populateParserHintSingleValueDictionary"),De=Symbol("populateParserHintArrayDictionary"),ve=Symbol("populateParserHintDictionary"),Re=Symbol("sanitizeKey"),Ue=Symbol("setKey"),He=Symbol("unfreeze"),zn=Symbol("validateAsync"),Dn=Symbol("getCommandInstance"),vn=Symbol("getContext"),Rn=Symbol("getHasOutput"),Un=Symbol("getLoggerInstance"),Hn=Symbol("getParseContext"),Yn=Symbol("getUsageInstance"),Tn=Symbol("getValidationInstance"),we=Symbol("hasParseCallback"),Gt=Symbol("postProcess"),Bn=Symbol("rebase"),Ye=Symbol("reset"),re=Symbol("runYargsParserAndExecuteCommands"),Te=Symbol("runValidation"),qn=Symbol("setHasOutput"),Kt=Symbol("kTrackManuallySetKeys"),Gn=class{constructor(t=[],e,n,i){this.customScriptName=!1,this.parsed=!1,et.set(this,void 0),Rt.set(this,void 0),se.set(this,{commands:[],fullCommands:[]}),ut.set(this,null),lt.set(this,null),pe.set(this,"show-hidden"),It.set(this,null),Ut.set(this,!0),me.set(this,{}),dt.set(this,!0),ge.set(this,[]),pt.set(this,void 0),yt.set(this,{}),ft.set(this,!1),mt.set(this,null),Xt.set(this,void 0),st.set(this,""),P.set(this,void 0),be.set(this,void 0),Oe.set(this,{}),ct.set(this,null),Ht.set(this,null),kt.set(this,{}),Yt.set(this,{}),$t.set(this,void 0),_e.set(this,!1),W.set(this,void 0),Tt.set(this,!1),Bt.set(this,!1),qt.set(this,!1),z.set(this,void 0),Ct.set(this,null),X.set(this,void 0),x(this,W,i,"f"),x(this,$t,t,"f"),x(this,Rt,e,"f"),x(this,be,n,"f"),x(this,pt,new Ie(this),"f"),this.$0=this[Fn](),this[Ye](),x(this,et,r(this,et,"f"),"f"),x(this,z,r(this,z,"f"),"f"),x(this,X,r(this,X,"f"),"f"),x(this,P,r(this,P,"f"),"f"),r(this,P,"f").showHiddenOpt=r(this,pe,"f"),x(this,Xt,this[In](),"f")}addHelpOpt(t,e){let n="help";return j("[string|boolean] [string]",[t,e],arguments.length),r(this,mt,"f")&&(this[We](r(this,mt,"f")),x(this,mt,null,"f")),t===!1&&e===void 0?this:(x(this,mt,typeof t=="string"?t:n,"f"),this.boolean(r(this,mt,"f")),this.describe(r(this,mt,"f"),e||r(this,z,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(j("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;let n=typeof t=="string"?t:r(this,pe,"f");return this.boolean(n),this.describe(n,e||r(this,z,"f").deferY18nLookup("Show hidden options")),r(this,P,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return j("<object|string|array> [string|array]",[t,e],arguments.length),this[De](this.alias.bind(this),"alias",t,e),this}array(t){return j("<array|string>",[t],arguments.length),this[Nt]("array",t),this[Kt](t),this}boolean(t){return j("<array|string>",[t],arguments.length),this[Nt]("boolean",t),this[Kt](t),this}check(t,e){return j("<function> [boolean]",[t,e],arguments.length),this.middleware((n,i)=>vt(()=>t(n,i.getOptions()),o=>(o?(typeof o=="string"||o instanceof Error)&&r(this,z,"f").fail(o.toString(),o):r(this,z,"f").fail(r(this,W,"f").y18n.__("Argument check failed: %s",t.toString())),n),o=>(r(this,z,"f").fail(o.message?o.message:o.toString(),o),n)),!1,e),this}choices(t,e){return j("<object|string|array> [string|array]",[t,e],arguments.length),this[De](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(j("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new V("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 V("coerce callback must be provided");return r(this,P,"f").key[t]=!0,r(this,pt,"f").addCoerceMiddleware((n,i)=>{let o;return vt(()=>(o=i.getAliases(),e(n[t])),a=>{if(n[t]=a,o[t])for(let f of o[t])n[f]=a;return n},a=>{throw new V(a.message)})},t),this}conflicts(t,e){return j("<string|object> [string|array]",[t,e],arguments.length),r(this,X,"f").conflicts(t,e),this}config(t="config",e,n){return j("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=ie(t,r(this,Rt,"f"),this[Vt]()["deep-merge-config"]||!1,r(this,W,"f")),r(this,P,"f").configObjects=(r(this,P,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||r(this,z,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(i=>{r(this,P,"f").config[i]=n||!0}),this)}completion(t,e,n){return j("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),x(this,lt,t||r(this,lt,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(r(this,lt,"f"),e),n&&r(this,ut,"f").registerFunction(n),this}command(t,e,n,i,o,a){return j("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,i,o,a],arguments.length),r(this,et,"f").addHandler(t,e,n,i,o,a),this}commands(t,e,n,i,o,a){return this.command(t,e,n,i,o,a)}commandDir(t,e){j("<string> [object]",[t,e],arguments.length);let n=r(this,be,"f")||r(this,W,"f").require;return r(this,et,"f").addDirectory(t,n,r(this,W,"f").getCallerFile(),e),this}count(t){return j("<array|string>",[t],arguments.length),this[Nt]("count",t),this[Kt](t),this}default(t,e,n){return j("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(Me(t,r(this,W,"f")),r(this,P,"f").defaultDescription[t]=n),typeof e=="function"&&(Me(t,r(this,W,"f")),r(this,P,"f").defaultDescription[t]||(r(this,P,"f").defaultDescription[t]=r(this,z,"f").functionDescription(e)),e=e.call()),this[te](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,i){return j("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,i],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),r(this,P,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:i},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(i=>{ot(n,!0,r(this,W,"f")),this.demandOption(i,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(ot(n,!0,r(this,W,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(i=>{ot(n,!0,r(this,W,"f")),this.demandOption(i,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return j("<object|string|array> [string]",[t,e],arguments.length),this[te](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return j("<string> [string|boolean]",[t,e],arguments.length),r(this,P,"f").deprecatedOptions[t]=e,this}describe(t,e){return j("<object|string|array> [string]",[t,e],arguments.length),this[Ue](t,!0),r(this,z,"f").describe(t,e),this}detectLocale(t){return j("<boolean>",[t],arguments.length),x(this,Ut,t,"f"),this}env(t){return j("[string|boolean]",[t],arguments.length),t===!1?delete r(this,P,"f").envPrefix:r(this,P,"f").envPrefix=t||"",this}epilogue(t){return j("<string>",[t],arguments.length),r(this,z,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return j("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):r(this,z,"f").example(t,e),this}exit(t,e){x(this,ft,!0,"f"),x(this,It,e,"f"),r(this,dt,"f")&&r(this,W,"f").process.exit(t)}exitProcess(t=!0){return j("[boolean]",[t],arguments.length),x(this,dt,t,"f"),this}fail(t){if(j("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new V("Invalid first argument. Expected function or boolean 'false'");return r(this,z,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return j("<array> [function]",[t,e],arguments.length),e?r(this,ut,"f").getCompletion(t,e):new Promise((n,i)=>{r(this,ut,"f").getCompletion(t,(o,a)=>{o?i(o):n(a)})})}getDemandedOptions(){return j([],0),r(this,P,"f").demandedOptions}getDemandedCommands(){return j([],0),r(this,P,"f").demandedCommands}getDeprecatedOptions(){return j([],0),r(this,P,"f").deprecatedOptions}getDetectLocale(){return r(this,Ut,"f")}getExitProcess(){return r(this,dt,"f")}getGroups(){return Object.assign({},r(this,yt,"f"),r(this,Yt,"f"))}getHelp(){if(x(this,ft,!0,"f"),!r(this,z,"f").hasCachedHelpMessage()){if(!this.parsed){let e=this[re](r(this,$t,"f"),void 0,void 0,0,!0);if(K(e))return e.then(()=>r(this,z,"f").help())}let t=r(this,et,"f").runDefaultBuilderOn(this);if(K(t))return t.then(()=>r(this,z,"f").help())}return Promise.resolve(r(this,z,"f").help())}getOptions(){return r(this,P,"f")}getStrict(){return r(this,Tt,"f")}getStrictCommands(){return r(this,Bt,"f")}getStrictOptions(){return r(this,qt,"f")}global(t,e){return j("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?r(this,P,"f").local=r(this,P,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{r(this,P,"f").local.includes(n)||r(this,P,"f").local.push(n)}),this}group(t,e){j("<string|array> <string>",[t,e],arguments.length);let n=r(this,Yt,"f")[e]||r(this,yt,"f")[e];r(this,Yt,"f")[e]&&delete r(this,Yt,"f")[e];let i={};return r(this,yt,"f")[e]=(n||[]).concat(t).filter(o=>i[o]?!1:i[o]=!0),this}hide(t){return j("<string>",[t],arguments.length),r(this,P,"f").hiddenOptions.push(t),this}implies(t,e){return j("<string|object> [number|string|array]",[t,e],arguments.length),r(this,X,"f").implies(t,e),this}locale(t){return j("[string]",[t],arguments.length),t?(x(this,Ut,!1,"f"),r(this,W,"f").y18n.setLocale(t),this):(this[Le](),r(this,W,"f").y18n.getLocale())}middleware(t,e,n){return r(this,pt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return j("<string|object|array> [number]",[t,e],arguments.length),this[te](this.nargs.bind(this),"narg",t,e),this}normalize(t){return j("<array|string>",[t],arguments.length),this[Nt]("normalize",t),this}number(t){return j("<array|string>",[t],arguments.length),this[Nt]("number",t),this[Kt](t),this}option(t,e){if(j("<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[Kt](t),r(this,Ct,"f")&&(t==="version"||(e==null?void 0:e.alias)==="version")&&this[$n](['"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(`
62
- `),void 0,"versionWarning"),r(this,P,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);let n=e.deprecate||e.deprecated;n&&this.deprecateOption(t,n);let i=e.demand||e.required||e.require;i&&this.demand(t,i),e.demandOption&&this.demandOption(t,typeof e.demandOption=="string"?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),e.implies!==void 0&&this.implies(t,e.implies),e.nargs!==void 0&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||e.type==="boolean")&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||e.type==="array")&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||e.type==="number")&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||e.type==="string")&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||e.type==="count")&&this.count(t),typeof e.global=="boolean"&&this.global(t,e.global),e.defaultDescription&&(r(this,P,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);let o=e.describe||e.description||e.desc;this.describe(t,o),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,n){j("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[Nn](),typeof t>"u"&&(t=r(this,$t,"f")),typeof e=="object"&&(x(this,Ht,e,"f"),e=n),typeof e=="function"&&(x(this,ct,e,"f"),e=!1),e||x(this,$t,t,"f"),r(this,ct,"f")&&x(this,dt,!1,"f");let i=this[re](t,!!e),o=this.parsed;return r(this,ut,"f").setParsed(this.parsed),K(i)?i.then(a=>(r(this,ct,"f")&&r(this,ct,"f").call(this,r(this,It,"f"),a,r(this,st,"f")),a)).catch(a=>{throw r(this,ct,"f")&&r(this,ct,"f")(a,this.parsed.argv,r(this,st,"f")),a}).finally(()=>{this[He](),this.parsed=o}):(r(this,ct,"f")&&r(this,ct,"f").call(this,r(this,It,"f"),i,r(this,st,"f")),this[He](),this.parsed=o,i)}parseAsync(t,e,n){let i=this.parse(t,e,n);return K(i)?i:Promise.resolve(i)}parseSync(t,e,n){let i=this.parse(t,e,n);if(K(i))throw new V(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(t){return j("<object>",[t],arguments.length),x(this,Oe,t,"f"),this}pkgConf(t,e){j("<string> [string]",[t,e],arguments.length);let n=null,i=this[ze](e||r(this,Rt,"f"));return i[t]&&typeof i[t]=="object"&&(n=ie(i[t],e||r(this,Rt,"f"),this[Vt]()["deep-merge-config"]||!1,r(this,W,"f")),r(this,P,"f").configObjects=(r(this,P,"f").configObjects||[]).concat(n)),this}positional(t,e){j("<string> <object>",[t,e],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=Pt(e,(a,f)=>a==="type"&&!["string","number","boolean"].includes(f)?!1:n.includes(a));let i=r(this,se,"f").fullCommands[r(this,se,"f").fullCommands.length-1],o=i?r(this,et,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return Qt(o).forEach(a=>{let f=o[a];Array.isArray(f)?f.indexOf(t)!==-1&&(e[a]=!0):f[t]&&!(a in e)&&(e[a]=f[t])}),this.group(t,r(this,z,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return j("[boolean]",[t],arguments.length),x(this,_e,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 j("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&r(this,P,"f").narg[t]?this:(this[te](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return j("[string] [string]",[t,e],arguments.length),t=t||this.$0,r(this,Xt,"f").log(r(this,ut,"f").generateCompletionScript(t,e||r(this,lt,"f")||"completion")),this}showHelp(t){if(j("[string|function]",[t],arguments.length),x(this,ft,!0,"f"),!r(this,z,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[re](r(this,$t,"f"),void 0,void 0,0,!0);if(K(n))return n.then(()=>{r(this,z,"f").showHelp(t)}),this}let e=r(this,et,"f").runDefaultBuilderOn(this);if(K(e))return e.then(()=>{r(this,z,"f").showHelp(t)}),this}return r(this,z,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return j("[boolean|string] [string]",[t,e],arguments.length),r(this,z,"f").showHelpOnFail(t,e),this}showVersion(t){return j("[string|function]",[t],arguments.length),r(this,z,"f").showVersion(t),this}skipValidation(t){return j("<array|string>",[t],arguments.length),this[Nt]("skipValidation",t),this}strict(t){return j("[boolean]",[t],arguments.length),x(this,Tt,t!==!1,"f"),this}strictCommands(t){return j("[boolean]",[t],arguments.length),x(this,Bt,t!==!1,"f"),this}strictOptions(t){return j("[boolean]",[t],arguments.length),x(this,qt,t!==!1,"f"),this}string(t){return j("<array|string>",[t],arguments.length),this[Nt]("string",t),this[Kt](t),this}terminalWidth(){return j([],0),r(this,W,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return j("<object>",[t],arguments.length),x(this,Ut,!1,"f"),r(this,W,"f").y18n.updateLocale(t),this}usage(t,e,n,i){if(j("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,i],arguments.length),e!==void 0){if(ot(t,null,r(this,W,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,i);throw new V(".usage() description must start with $0 if being used as alias for .command()")}else return r(this,z,"f").usage(t),this}version(t,e,n){let i="version";if(j("[boolean|string] [string] [string]",[t,e,n],arguments.length),r(this,Ct,"f")&&(this[We](r(this,Ct,"f")),r(this,z,"f").version(void 0),x(this,Ct,null,"f")),arguments.length===0)n=this[Wn](),t=i;else if(arguments.length===1){if(t===!1)return this;n=t,t=i}else arguments.length===2&&(n=e,e=void 0);return x(this,Ct,typeof t=="string"?t:i,"f"),e=e||r(this,z,"f").deferY18nLookup("Show version number"),r(this,z,"f").version(n||void 0),this.boolean(r(this,Ct,"f")),this.describe(r(this,Ct,"f"),e),this}wrap(t){return j("<number|null|undefined>",[t],arguments.length),r(this,z,"f").wrap(t),this}[(et=new WeakMap,Rt=new WeakMap,se=new WeakMap,ut=new WeakMap,lt=new WeakMap,pe=new WeakMap,It=new WeakMap,Ut=new WeakMap,me=new WeakMap,dt=new WeakMap,ge=new WeakMap,pt=new WeakMap,yt=new WeakMap,ft=new WeakMap,mt=new WeakMap,Xt=new WeakMap,st=new WeakMap,P=new WeakMap,be=new WeakMap,Oe=new WeakMap,ct=new WeakMap,Ht=new WeakMap,kt=new WeakMap,Yt=new WeakMap,$t=new WeakMap,_e=new WeakMap,W=new WeakMap,Tt=new WeakMap,Bt=new WeakMap,qt=new WeakMap,z=new WeakMap,Ct=new WeakMap,X=new WeakMap,Mn)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[In](){return{log:(...t)=>{this[we]()||console.log(...t),x(this,ft,!0,"f"),r(this,st,"f").length&&x(this,st,r(this,st,"f")+`
63
- `,"f"),x(this,st,r(this,st,"f")+t.join(" "),"f")},error:(...t)=>{this[we]()||console.error(...t),x(this,ft,!0,"f"),r(this,st,"f").length&&x(this,st,r(this,st,"f")+`
64
- `,"f"),x(this,st,r(this,st,"f")+t.join(" "),"f")}}}[We](t){Qt(r(this,P,"f")).forEach(e=>{if((i=>i==="configObjects")(e))return;let n=r(this,P,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete r(this,z,"f").getDescriptions()[t]}[$n](t,e,n){r(this,me,"f")[n]||(r(this,W,"f").process.emitWarning(t,e),r(this,me,"f")[n]=!0)}[Nn](){r(this,ge,"f").push({options:r(this,P,"f"),configObjects:r(this,P,"f").configObjects.slice(0),exitProcess:r(this,dt,"f"),groups:r(this,yt,"f"),strict:r(this,Tt,"f"),strictCommands:r(this,Bt,"f"),strictOptions:r(this,qt,"f"),completionCommand:r(this,lt,"f"),output:r(this,st,"f"),exitError:r(this,It,"f"),hasOutput:r(this,ft,"f"),parsed:this.parsed,parseFn:r(this,ct,"f"),parseContext:r(this,Ht,"f")}),r(this,z,"f").freeze(),r(this,X,"f").freeze(),r(this,et,"f").freeze(),r(this,pt,"f").freeze()}[Fn](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(r(this,W,"f").process.argv()[0])?e=r(this,W,"f").process.argv().slice(1,2):e=r(this,W,"f").process.argv().slice(0,1),t=e.map(n=>{let i=this[Bn](r(this,Rt,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),r(this,W,"f").getEnv("_")&&r(this,W,"f").getProcessArgvBin()===r(this,W,"f").getEnv("_")&&(t=r(this,W,"f").getEnv("_").replace(`${r(this,W,"f").path.dirname(r(this,W,"f").process.execPath())}/`,"")),t}[Vt](){return r(this,Oe,"f")}[Le](){if(!r(this,Ut,"f"))return;let t=r(this,W,"f").getEnv("LC_ALL")||r(this,W,"f").getEnv("LC_MESSAGES")||r(this,W,"f").getEnv("LANG")||r(this,W,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Wn](){return this[ze]().version||"unknown"}[Ln](t){let e=t["--"]?t["--"]:t._;for(let n=0,i;(i=e[n])!==void 0;n++)r(this,W,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(e[n]=Number(i));return t}[ze](t){let e=t||"*";if(r(this,kt,"f")[e])return r(this,kt,"f")[e];let n={};try{let i=t||r(this,W,"f").mainFilename;!t&&r(this,W,"f").path.extname(i)&&(i=r(this,W,"f").path.dirname(i));let o=r(this,W,"f").findUp(i,(a,f)=>{if(f.includes("package.json"))return"package.json"});ot(o,void 0,r(this,W,"f")),n=JSON.parse(r(this,W,"f").readFileSync(o,"utf8"))}catch{}return r(this,kt,"f")[e]=n||{},r(this,kt,"f")[e]}[Nt](t,e){e=[].concat(e),e.forEach(n=>{n=this[Re](n),r(this,P,"f")[t].push(n)})}[te](t,e,n,i){this[ve](t,e,n,i,(o,a,f)=>{r(this,P,"f")[o][a]=f})}[De](t,e,n,i){this[ve](t,e,n,i,(o,a,f)=>{r(this,P,"f")[o][a]=(r(this,P,"f")[o][a]||[]).concat(f)})}[ve](t,e,n,i,o){if(Array.isArray(n))n.forEach(a=>{t(a,i)});else if((a=>typeof a=="object")(n))for(let a of Qt(n))t(a,n[a]);else o(e,this[Re](n),i)}[Re](t){return t==="__proto__"?"___proto___":t}[Ue](t,e){return this[te](this[Ue].bind(this),"key",t,e),this}[He](){var t,e,n,i,o,a,f,g,O,b,c,m;let w=r(this,ge,"f").pop();ot(w,void 0,r(this,W,"f"));let M;t=this,e=this,n=this,i=this,o=this,a=this,f=this,g=this,O=this,b=this,c=this,m=this,{options:{set value(y){x(t,P,y,"f")}}.value,configObjects:M,exitProcess:{set value(y){x(e,dt,y,"f")}}.value,groups:{set value(y){x(n,yt,y,"f")}}.value,output:{set value(y){x(i,st,y,"f")}}.value,exitError:{set value(y){x(o,It,y,"f")}}.value,hasOutput:{set value(y){x(a,ft,y,"f")}}.value,parsed:this.parsed,strict:{set value(y){x(f,Tt,y,"f")}}.value,strictCommands:{set value(y){x(g,Bt,y,"f")}}.value,strictOptions:{set value(y){x(O,qt,y,"f")}}.value,completionCommand:{set value(y){x(b,lt,y,"f")}}.value,parseFn:{set value(y){x(c,ct,y,"f")}}.value,parseContext:{set value(y){x(m,Ht,y,"f")}}.value}=w,r(this,P,"f").configObjects=M,r(this,z,"f").unfreeze(),r(this,X,"f").unfreeze(),r(this,et,"f").unfreeze(),r(this,pt,"f").unfreeze()}[zn](t,e){return vt(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Dn].bind(this),getContext:this[vn].bind(this),getHasOutput:this[Rn].bind(this),getLoggerInstance:this[Un].bind(this),getParseContext:this[Hn].bind(this),getParserConfiguration:this[Vt].bind(this),getUsageInstance:this[Yn].bind(this),getValidationInstance:this[Tn].bind(this),hasParseCallback:this[we].bind(this),postProcess:this[Gt].bind(this),reset:this[Ye].bind(this),runValidation:this[Te].bind(this),runYargsParserAndExecuteCommands:this[re].bind(this),setHasOutput:this[qn].bind(this)}}[Dn](){return r(this,et,"f")}[vn](){return r(this,se,"f")}[Rn](){return r(this,ft,"f")}[Un](){return r(this,Xt,"f")}[Hn](){return r(this,Ht,"f")||{}}[Yn](){return r(this,z,"f")}[Tn](){return r(this,X,"f")}[we](){return!!r(this,ct,"f")}[Gt](t,e,n,i){return n||K(t)||(e||(t=this[Mn](t)),(this[Vt]()["parse-positional-numbers"]||this[Vt]()["parse-positional-numbers"]===void 0)&&(t=this[Ln](t)),i&&(t=Dt(t,this,r(this,pt,"f").getMiddleware(),!1))),t}[Ye](t={}){x(this,P,r(this,P,"f")||{},"f");let e={};e.local=r(this,P,"f").local||[],e.configObjects=r(this,P,"f").configObjects||[];let n={};e.local.forEach(a=>{n[a]=!0,(t[a]||[]).forEach(f=>{n[f]=!0})}),Object.assign(r(this,Yt,"f"),Object.keys(r(this,yt,"f")).reduce((a,f)=>{let g=r(this,yt,"f")[f].filter(O=>!(O in n));return g.length>0&&(a[f]=g),a},{})),x(this,yt,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],o=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(a=>{e[a]=(r(this,P,"f")[a]||[]).filter(f=>!n[f])}),o.forEach(a=>{e[a]=Pt(r(this,P,"f")[a],f=>!n[f])}),e.envPrefix=r(this,P,"f").envPrefix,x(this,P,e,"f"),x(this,z,r(this,z,"f")?r(this,z,"f").reset(n):wn(this,r(this,W,"f")),"f"),x(this,X,r(this,X,"f")?r(this,X,"f").reset(n):Sn(this,r(this,z,"f"),r(this,W,"f")),"f"),x(this,et,r(this,et,"f")?r(this,et,"f").reset():bn(r(this,z,"f"),r(this,X,"f"),r(this,pt,"f"),r(this,W,"f")),"f"),r(this,ut,"f")||x(this,ut,jn(this,r(this,z,"f"),r(this,et,"f"),r(this,W,"f")),"f"),r(this,pt,"f").reset(),x(this,lt,null,"f"),x(this,st,"","f"),x(this,It,null,"f"),x(this,ft,!1,"f"),this.parsed=!1,this}[Bn](t,e){return r(this,W,"f").path.relative(t,e)}[re](t,e,n,i=0,o=!1){let a=!!n||o;t=t||r(this,$t,"f"),r(this,P,"f").__=r(this,W,"f").y18n.__,r(this,P,"f").configuration=this[Vt]();let f=!!r(this,P,"f").configuration["populate--"],g=Object.assign({},r(this,P,"f").configuration,{"populate--":!0}),O=r(this,W,"f").Parser.detailed(t,Object.assign({},r(this,P,"f"),{configuration:{"parse-positional-numbers":!1,...g}})),b=Object.assign(O.argv,r(this,Ht,"f")),c,m=O.aliases,w=!1,M=!1;Object.keys(b).forEach(y=>{y===r(this,mt,"f")&&b[y]?w=!0:y===r(this,Ct,"f")&&b[y]&&(M=!0)}),b.$0=this.$0,this.parsed=O,i===0&&r(this,z,"f").clearCachedHelpMessage();try{if(this[Le](),e)return this[Gt](b,f,!!n,!1);r(this,mt,"f")&&[r(this,mt,"f")].concat(m[r(this,mt,"f")]||[]).filter(Y=>Y.length>1).includes(""+b._[b._.length-1])&&(b._.pop(),w=!0);let y=r(this,et,"f").getCommands(),d=r(this,ut,"f").completionKey in b,D=w||d||o;if(b._.length){if(y.length){let R;for(let Y=i||0,H;b._[Y]!==void 0;Y++)if(H=String(b._[Y]),y.includes(H)&&H!==r(this,lt,"f")){let T=r(this,et,"f").runCommand(H,this,O,Y+1,o,w||M||o);return this[Gt](T,f,!!n,!1)}else if(!R&&H!==r(this,lt,"f")){R=H;break}!r(this,et,"f").hasDefaultCommand()&&r(this,_e,"f")&&R&&!D&&r(this,X,"f").recommendCommands(R,y)}r(this,lt,"f")&&b._.includes(r(this,lt,"f"))&&!d&&(r(this,dt,"f")&&Mt(!0),this.showCompletionScript(),this.exit(0))}if(r(this,et,"f").hasDefaultCommand()&&!D){let R=r(this,et,"f").runCommand(null,this,O,0,o,w||M||o);return this[Gt](R,f,!!n,!1)}if(d){r(this,dt,"f")&&Mt(!0),t=[].concat(t);let R=t.slice(t.indexOf(`--${r(this,ut,"f").completionKey}`)+1);return r(this,ut,"f").getCompletion(R,(Y,H)=>{if(Y)throw new V(Y.message);(H||[]).forEach(T=>{r(this,Xt,"f").log(T)}),this.exit(0)}),this[Gt](b,!f,!!n,!1)}if(r(this,ft,"f")||(w?(r(this,dt,"f")&&Mt(!0),a=!0,this.showHelp("log"),this.exit(0)):M&&(r(this,dt,"f")&&Mt(!0),a=!0,r(this,z,"f").showVersion("log"),this.exit(0))),!a&&r(this,P,"f").skipValidation.length>0&&(a=Object.keys(b).some(R=>r(this,P,"f").skipValidation.indexOf(R)>=0&&b[R]===!0)),!a){if(O.error)throw new V(O.error.message);if(!d){let R=this[Te](m,{},O.error);n||(c=Dt(b,this,r(this,pt,"f").getMiddleware(),!0)),c=this[zn](R,c??b),K(c)&&!n&&(c=c.then(()=>Dt(b,this,r(this,pt,"f").getMiddleware(),!1)))}}}catch(y){if(y instanceof V)r(this,z,"f").fail(y.message,y);else throw y}return this[Gt](c??b,f,!!n,!0)}[Te](t,e,n,i){let o={...this.getDemandedOptions()};return a=>{if(n)throw new V(n.message);r(this,X,"f").nonOptionCount(a),r(this,X,"f").requiredArguments(a,o);let f=!1;r(this,Bt,"f")&&(f=r(this,X,"f").unknownCommands(a)),r(this,Tt,"f")&&!f?r(this,X,"f").unknownArguments(a,t,e,!!i):r(this,qt,"f")&&r(this,X,"f").unknownArguments(a,t,{},!1,!1),r(this,X,"f").limitedChoices(a),r(this,X,"f").implications(a),r(this,X,"f").conflicting(a)}}[qn](){x(this,ft,!0,"f")}[Kt](t){if(typeof t=="string")r(this,P,"f").key[t]=!0;else for(let e of t)r(this,P,"f").key[e]=!0}};function On(s){return!!s&&typeof s.getInternalMethods=="function"}var Ti=Vn(Pe),Kn=Ti;var Bi=s=>{let t={...s};return Object.values(s).forEach(e=>typeof e=="number"&&delete t[e]),t},Jn=s=>Object.keys(Bi(s));async function Gi(){let s=await Kn(Se(process.argv)).help(!1).version(!1).option("log",{choices:Jn(Be)}).argv,t=Be[s.log??"INFO"],e={...JSON.parse(s._[0]??"{}"),log:new qi(t)};t>Be.INFO&&console.log(`OPTIONS:
65
- `,JSON.stringify(e,null,2));let n=new Vi(e);try{await n.startServer(),await n.startScheduler()}catch(i){n.log.error(i),process.exitCode=1,await n.dispose()}}await Gi();
57
+ `;var ze=class{constructor(t,e,n,i){var o,a,f;this.yargs=t,this.usage=e,this.command=n,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(f=((o=this.shim.getEnv("SHELL"))===null||o===void 0?void 0:o.includes("zsh"))||((a=this.shim.getEnv("ZSH_NAME"))===null||a===void 0?void 0:a.includes("zsh")))!==null&&f!==void 0?f:!1}defaultCompletion(t,e,n,i){let o=this.command.getCommandHandlers();for(let f=0,g=t.length;f<g;++f)if(o[t[f]]&&o[t[f]].builder){let O=o[t[f]].builder;if(de(O)){this.indexAfterLastReset=f+1;let b=this.yargs.getInternalMethods().reset();return O(b,!0),b.argv}}let a=[];this.commandCompletions(a,t,n),this.optionCompletions(a,t,e,n),this.choicesFromOptionsCompletions(a,t,e,n),this.choicesFromPositionalsCompletions(a,t,e,n),i(null,a)}commandCompletions(t,e,n){let i=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&i[i.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(o=>{let a=xt(o[0]).cmd;if(e.indexOf(a)===-1)if(!this.zshShell)t.push(a);else{let f=o[1]||"";t.push(a.replace(/:/g,"\\:")+":"+f)}})}optionCompletions(t,e,n,i){if((i.match(/^-/)||i===""&&t.length===0)&&!this.previousArgHasChoices(e)){let o=this.yargs.getOptions(),a=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(o.key).forEach(f=>{let g=!!o.configuration["boolean-negation"]&&o.boolean.includes(f);!a.includes(f)&&!o.hiddenOptions.includes(f)&&!this.argsContainKey(e,n,f,g)&&(this.completeOptionKey(f,t,i),g&&!!o.default[f]&&this.completeOptionKey(`no-${f}`,t,i))})}}choicesFromOptionsCompletions(t,e,n,i){if(this.previousArgHasChoices(e)){let o=this.getPreviousArgChoices(e);o&&o.length>0&&t.push(...o.map(a=>a.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,e,n,i){if(i===""&&t.length>0&&this.previousArgHasChoices(e))return;let o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],a=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),f=o[n._.length-a-1];if(!f)return;let g=this.yargs.getOptions().choices[f]||[];for(let O of g)O.startsWith(i)&&t.push(O.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],n="";if(!e.startsWith("-")&&t.length>1&&(n=e,e=t[t.length-2]),!e.startsWith("-"))return;let i=e.replace(/^-+/,""),o=this.yargs.getOptions(),a=[i,...this.yargs.getAliases()[i]||[]],f;for(let g of a)if(Object.prototype.hasOwnProperty.call(o.key,g)&&Array.isArray(o.choices[g])){f=o.choices[g];break}if(f)return f.filter(g=>!n||g.startsWith(n))}previousArgHasChoices(t){let e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n,i){if(t.indexOf(`--${n}`)!==-1||i&&t.indexOf(`--no-${n}`)!==-1)return!0;if(this.aliases){for(let o of this.aliases[n])if(e[o]!==void 0)return!0}return!1}completeOptionKey(t,e,n){let i=this.usage.getDescriptions(),o=g=>/^--/.test(g),a=g=>/^[^0-9]$/.test(g),f=!o(n)&&a(t)?"-":"--";if(!this.zshShell)e.push(f+t);else{let g=i[t]||"";e.push(f+`${t.replace(/:/g,"\\:")}:${g.replace("__yargsString__:","")}`)}}customCompletion(t,e,n,i){if(at(this.customCompletionFunction,null,this.shim),Ui(this.customCompletionFunction)){let o=this.customCompletionFunction(n,e);return J(o)?o.then(a=>{this.shim.process.nextTick(()=>{i(null,a)})}).catch(a=>{this.shim.process.nextTick(()=>{i(a,void 0)})}):i(null,o)}else return Ti(this.customCompletionFunction)?this.customCompletionFunction(n,e,(o=i)=>this.defaultCompletion(t,e,n,o),o=>{i(null,o)}):this.customCompletionFunction(n,e,o=>{i(null,o)})}getCompletion(t,e){let n=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),o=this.customCompletionFunction?a=>this.customCompletion(t,a,n,e):a=>this.defaultCompletion(t,a,n,e);return J(i)?i.then(o):o(i)}generateCompletionScript(t,e){let n=this.zshShell?xn:jn,i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,i),n=n.replace(/{{completion_command}}/g,e),n.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}};function An(s,t,e,n){return new ze(s,t,e,n)}function Ui(s){return s.length<3}function Ti(s){return s.length>3}function Sn(s,t){if(s.length===0)return t.length;if(t.length===0)return s.length;let e=[],n;for(n=0;n<=t.length;n++)e[n]=[n];let i;for(i=0;i<=s.length;i++)e[0][i]=i;for(n=1;n<=t.length;n++)for(i=1;i<=s.length;i++)t.charAt(n-1)===s.charAt(i-1)?e[n][i]=e[n-1][i-1]:n>1&&i>1&&t.charAt(n-2)===s.charAt(i-1)&&t.charAt(n-1)===s.charAt(i-2)?e[n][i]=e[n-2][i-2]+1:e[n][i]=Math.min(e[n-1][i-1]+1,Math.min(e[n][i-1]+1,e[n-1][i]+1));return e[t.length][s.length]}var Pn=["$0","--","_"];function Mn(s,t,e){let n=e.y18n.__,i=e.y18n.__n,o={};o.nonOptionCount=function(h){let p=s.getDemandedCommands(),A=h._.length+(h["--"]?h["--"].length:0)-s.getInternalMethods().getContext().commands.length;p._&&(A<p._.min||A>p._.max)&&(A<p._.min?p._.minMsg!==void 0?t.fail(p._.minMsg?p._.minMsg.replace(/\$0/g,A.toString()).replace(/\$1/,p._.min.toString()):null):t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",A,A.toString(),p._.min.toString())):A>p._.max&&(p._.maxMsg!==void 0?t.fail(p._.maxMsg?p._.maxMsg.replace(/\$0/g,A.toString()).replace(/\$1/,p._.max.toString()):null):t.fail(i("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",A,A.toString(),p._.max.toString()))))},o.positionalCount=function(h,p){p<h&&t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",p,p+"",h+""))},o.requiredArguments=function(h,p){let _=null;for(let A of Object.keys(p))(!Object.prototype.hasOwnProperty.call(h,A)||typeof h[A]>"u")&&(_=_||{},_[A]=p[A]);if(_){let A=[];for(let d of Object.keys(_)){let R=_[d];R&&A.indexOf(R)<0&&A.push(R)}let y=A.length?`
58
+ ${A.join(`
59
+ `)}`:"";t.fail(i("Missing required argument: %s","Missing required arguments: %s",Object.keys(_).length,Object.keys(_).join(", ")+y))}},o.unknownArguments=function(h,p,_,A,y=!0){var d;let R=s.getInternalMethods().getCommandInstance().getCommands(),v=[],T=s.getInternalMethods().getContext();if(Object.keys(h).forEach(Y=>{!Pn.includes(Y)&&!Object.prototype.hasOwnProperty.call(_,Y)&&!Object.prototype.hasOwnProperty.call(s.getInternalMethods().getParseContext(),Y)&&!o.isValidAndSomeAliasIsNotNew(Y,p)&&v.push(Y)}),y&&(T.commands.length>0||R.length>0||A)&&h._.slice(T.commands.length).forEach(Y=>{R.includes(""+Y)||v.push(""+Y)}),y){let H=((d=s.getDemandedCommands()._)===null||d===void 0?void 0:d.max)||0,$t=T.commands.length+H;$t<h._.length&&h._.slice($t).forEach(ut=>{ut=String(ut),!T.commands.includes(ut)&&!v.includes(ut)&&v.push(ut)})}v.length&&t.fail(i("Unknown argument: %s","Unknown arguments: %s",v.length,v.map(Y=>Y.trim()?Y:`"${Y}"`).join(", ")))},o.unknownCommands=function(h){let p=s.getInternalMethods().getCommandInstance().getCommands(),_=[],A=s.getInternalMethods().getContext();return(A.commands.length>0||p.length>0)&&h._.slice(A.commands.length).forEach(y=>{p.includes(""+y)||_.push(""+y)}),_.length>0?(t.fail(i("Unknown command: %s","Unknown commands: %s",_.length,_.join(", "))),!0):!1},o.isValidAndSomeAliasIsNotNew=function(h,p){if(!Object.prototype.hasOwnProperty.call(p,h))return!1;let _=s.parsed.newAliases;return[h,...p[h]].some(A=>!Object.prototype.hasOwnProperty.call(_,A)||!_[h])},o.limitedChoices=function(h){let p=s.getOptions(),_={};if(!Object.keys(p.choices).length)return;Object.keys(h).forEach(d=>{Pn.indexOf(d)===-1&&Object.prototype.hasOwnProperty.call(p.choices,d)&&[].concat(h[d]).forEach(R=>{p.choices[d].indexOf(R)===-1&&R!==void 0&&(_[d]=(_[d]||[]).concat(R))})});let A=Object.keys(_);if(!A.length)return;let y=n("Invalid values:");A.forEach(d=>{y+=`
60
+ ${n("Argument: %s, Given: %s, Choices: %s",d,t.stringifiedValues(_[d]),t.stringifiedValues(p.choices[d]))}`}),t.fail(y)};let a={};o.implies=function(h,p){j("<string|object> [array|number|string]",[h,p],arguments.length),typeof h=="object"?Object.keys(h).forEach(_=>{o.implies(_,h[_])}):(s.global(h),a[h]||(a[h]=[]),Array.isArray(p)?p.forEach(_=>o.implies(h,_)):(at(p,void 0,e),a[h].push(p)))},o.getImplied=function(){return a};function f(b,h){let p=Number(h);return h=isNaN(p)?h:p,typeof h=="number"?h=b._.length>=h:h.match(/^--no-.+/)?(h=h.match(/^--no-(.+)/)[1],h=!Object.prototype.hasOwnProperty.call(b,h)):h=Object.prototype.hasOwnProperty.call(b,h),h}o.implications=function(h){let p=[];if(Object.keys(a).forEach(_=>{let A=_;(a[_]||[]).forEach(y=>{let d=A,R=y;d=f(h,d),y=f(h,y),d&&!y&&p.push(` ${A} -> ${R}`)})}),p.length){let _=`${n("Implications failed:")}
61
+ `;p.forEach(A=>{_+=A}),t.fail(_)}};let g={};o.conflicts=function(h,p){j("<string|object> [array|string]",[h,p],arguments.length),typeof h=="object"?Object.keys(h).forEach(_=>{o.conflicts(_,h[_])}):(s.global(h),g[h]||(g[h]=[]),Array.isArray(p)?p.forEach(_=>o.conflicts(h,_)):g[h].push(p))},o.getConflicting=()=>g,o.conflicting=function(h){Object.keys(h).forEach(p=>{g[p]&&g[p].forEach(_=>{_&&h[p]!==void 0&&h[_]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",p,_))})}),s.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(g).forEach(p=>{g[p].forEach(_=>{_&&h[e.Parser.camelCase(p)]!==void 0&&h[e.Parser.camelCase(_)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",p,_))})})},o.recommendCommands=function(h,p){p=p.sort((d,R)=>R.length-d.length);let A=null,y=1/0;for(let d=0,R;(R=p[d])!==void 0;d++){let v=Sn(h,R);v<=3&&v<y&&(y=v,A=R)}A&&t.fail(n("Did you mean %s?",A))},o.reset=function(h){return a=At(a,p=>!h[p]),g=At(g,p=>!h[p]),o};let O=[];return o.freeze=function(){O.push({implied:a,conflicting:g})},o.unfreeze=function(){let h=O.pop();at(h,void 0,e),{implied:a,conflicting:g}=h},o}var De=[],ne;function ie(s,t,e,n){ne=n;let i={};if(Object.prototype.hasOwnProperty.call(s,"extends")){if(typeof s.extends!="string")return i;let o=/\.json|\..*rc$/.test(s.extends),a=null;if(o)a=Bi(t,s.extends);else try{a=_t.resolve(s.extends)}catch{return s}Yi(a),De.push(a),i=o?JSON.parse(ne.readFileSync(a,"utf8")):_t(s.extends),delete s.extends,i=ie(i,ne.path.dirname(a),e,ne)}return De=[],e?In(i,s):Object.assign({},i,s)}function Yi(s){if(De.indexOf(s)>-1)throw new V(`Circular extended configurations: '${s}'.`)}function Bi(s,t){return ne.path.resolve(s,t)}function In(s,t){let e={};function n(i){return i&&typeof i=="object"&&!Array.isArray(i)}Object.assign(e,s);for(let i of Object.keys(t))n(t[i])&&n(e[i])?e[i]=In(s[i],t[i]):e[i]=t[i];return e}var x=function(s,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!i:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(s,e):i?i.value=e:t.set(s,e),e},r=function(s,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!n:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(s):n?n.value:t.get(s)},X,Lt,se,pt,ft,me,Pt,zt,ge,mt,be,gt,wt,ct,bt,Oe,Qt,st,I,_e,we,ht,Dt,Zt,Rt,Mt,ye,W,vt,Ht,Ut,z,yt,Q;function Jn(s){return(t=[],e=s.process.cwd(),n)=>{let i=new Ke(t,e,n,s);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}}var $n=Symbol("copyDoubleDash"),Fn=Symbol("copyDoubleDash"),Re=Symbol("deleteFromParserHintObject"),Nn=Symbol("emitWarning"),Wn=Symbol("freeze"),Ln=Symbol("getDollarZero"),Tt=Symbol("getParserConfiguration"),ve=Symbol("guessLocale"),zn=Symbol("guessVersion"),Dn=Symbol("parsePositionalNumbers"),He=Symbol("pkgUp"),It=Symbol("populateParserHintArray"),Xt=Symbol("populateParserHintSingleValueDictionary"),Ue=Symbol("populateParserHintArrayDictionary"),Te=Symbol("populateParserHintDictionary"),Ye=Symbol("sanitizeKey"),Be=Symbol("setKey"),Ge=Symbol("unfreeze"),Rn=Symbol("validateAsync"),vn=Symbol("getCommandInstance"),Hn=Symbol("getContext"),Un=Symbol("getHasOutput"),Tn=Symbol("getLoggerInstance"),Yn=Symbol("getParseContext"),Bn=Symbol("getUsageInstance"),Gn=Symbol("getValidationInstance"),Ce=Symbol("hasParseCallback"),qn=Symbol("isGlobalContext"),Yt=Symbol("postProcess"),Vn=Symbol("rebase"),qe=Symbol("reset"),re=Symbol("runYargsParserAndExecuteCommands"),Ve=Symbol("runValidation"),Kn=Symbol("setHasOutput"),Bt=Symbol("kTrackManuallySetKeys"),Ke=class{constructor(t=[],e,n,i){this.customScriptName=!1,this.parsed=!1,X.set(this,void 0),Lt.set(this,void 0),se.set(this,{commands:[],fullCommands:[]}),pt.set(this,null),ft.set(this,null),me.set(this,"show-hidden"),Pt.set(this,null),zt.set(this,!0),ge.set(this,{}),mt.set(this,!0),be.set(this,[]),gt.set(this,void 0),wt.set(this,{}),ct.set(this,!1),bt.set(this,null),Oe.set(this,!0),Qt.set(this,void 0),st.set(this,""),I.set(this,void 0),_e.set(this,void 0),we.set(this,{}),ht.set(this,null),Dt.set(this,null),Zt.set(this,{}),Rt.set(this,{}),Mt.set(this,void 0),ye.set(this,!1),W.set(this,void 0),vt.set(this,!1),Ht.set(this,!1),Ut.set(this,!1),z.set(this,void 0),yt.set(this,null),Q.set(this,void 0),x(this,W,i,"f"),x(this,Mt,t,"f"),x(this,Lt,e,"f"),x(this,_e,n,"f"),x(this,gt,new ue(this),"f"),this.$0=this[Ln](),this[qe](),x(this,X,r(this,X,"f"),"f"),x(this,z,r(this,z,"f"),"f"),x(this,Q,r(this,Q,"f"),"f"),x(this,I,r(this,I,"f"),"f"),r(this,I,"f").showHiddenOpt=r(this,me,"f"),x(this,Qt,this[Fn](),"f")}addHelpOpt(t,e){let n="help";return j("[string|boolean] [string]",[t,e],arguments.length),r(this,bt,"f")&&(this[Re](r(this,bt,"f")),x(this,bt,null,"f")),t===!1&&e===void 0?this:(x(this,bt,typeof t=="string"?t:n,"f"),this.boolean(r(this,bt,"f")),this.describe(r(this,bt,"f"),e||r(this,z,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(j("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;let n=typeof t=="string"?t:r(this,me,"f");return this.boolean(n),this.describe(n,e||r(this,z,"f").deferY18nLookup("Show hidden options")),r(this,I,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return j("<object|string|array> [string|array]",[t,e],arguments.length),this[Ue](this.alias.bind(this),"alias",t,e),this}array(t){return j("<array|string>",[t],arguments.length),this[It]("array",t),this[Bt](t),this}boolean(t){return j("<array|string>",[t],arguments.length),this[It]("boolean",t),this[Bt](t),this}check(t,e){return j("<function> [boolean]",[t,e],arguments.length),this.middleware((n,i)=>Wt(()=>t(n,i.getOptions()),o=>(o?(typeof o=="string"||o instanceof Error)&&r(this,z,"f").fail(o.toString(),o):r(this,z,"f").fail(r(this,W,"f").y18n.__("Argument check failed: %s",t.toString())),n),o=>(r(this,z,"f").fail(o.message?o.message:o.toString(),o),n)),!1,e),this}choices(t,e){return j("<object|string|array> [string|array]",[t,e],arguments.length),this[Ue](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(j("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new V("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 V("coerce callback must be provided");return r(this,I,"f").key[t]=!0,r(this,gt,"f").addCoerceMiddleware((n,i)=>{let o;return Object.hasOwnProperty.call(n,t)?Wt(()=>(o=i.getAliases(),e(n[t])),f=>{n[t]=f;let g=i.getInternalMethods().getParserConfiguration()["strip-aliased"];if(o[t]&&g!==!0)for(let O of o[t])n[O]=f;return n},f=>{throw new V(f.message)}):n},t),this}conflicts(t,e){return j("<string|object> [string|array]",[t,e],arguments.length),r(this,Q,"f").conflicts(t,e),this}config(t="config",e,n){return j("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=ie(t,r(this,Lt,"f"),this[Tt]()["deep-merge-config"]||!1,r(this,W,"f")),r(this,I,"f").configObjects=(r(this,I,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||r(this,z,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(i=>{r(this,I,"f").config[i]=n||!0}),this)}completion(t,e,n){return j("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),x(this,ft,t||r(this,ft,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(r(this,ft,"f"),e),n&&r(this,pt,"f").registerFunction(n),this}command(t,e,n,i,o,a){return j("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,i,o,a],arguments.length),r(this,X,"f").addHandler(t,e,n,i,o,a),this}commands(t,e,n,i,o,a){return this.command(t,e,n,i,o,a)}commandDir(t,e){j("<string> [object]",[t,e],arguments.length);let n=r(this,_e,"f")||r(this,W,"f").require;return r(this,X,"f").addDirectory(t,n,r(this,W,"f").getCallerFile(),e),this}count(t){return j("<array|string>",[t],arguments.length),this[It]("count",t),this[Bt](t),this}default(t,e,n){return j("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(Fe(t,r(this,W,"f")),r(this,I,"f").defaultDescription[t]=n),typeof e=="function"&&(Fe(t,r(this,W,"f")),r(this,I,"f").defaultDescription[t]||(r(this,I,"f").defaultDescription[t]=r(this,z,"f").functionDescription(e)),e=e.call()),this[Xt](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,i){return j("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,i],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),r(this,I,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:i},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(i=>{at(n,!0,r(this,W,"f")),this.demandOption(i,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(at(n,!0,r(this,W,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(i=>{at(n,!0,r(this,W,"f")),this.demandOption(i,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return j("<object|string|array> [string]",[t,e],arguments.length),this[Xt](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return j("<string> [string|boolean]",[t,e],arguments.length),r(this,I,"f").deprecatedOptions[t]=e,this}describe(t,e){return j("<object|string|array> [string]",[t,e],arguments.length),this[Be](t,!0),r(this,z,"f").describe(t,e),this}detectLocale(t){return j("<boolean>",[t],arguments.length),x(this,zt,t,"f"),this}env(t){return j("[string|boolean]",[t],arguments.length),t===!1?delete r(this,I,"f").envPrefix:r(this,I,"f").envPrefix=t||"",this}epilogue(t){return j("<string>",[t],arguments.length),r(this,z,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return j("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):r(this,z,"f").example(t,e),this}exit(t,e){x(this,ct,!0,"f"),x(this,Pt,e,"f"),r(this,mt,"f")&&r(this,W,"f").process.exit(t)}exitProcess(t=!0){return j("[boolean]",[t],arguments.length),x(this,mt,t,"f"),this}fail(t){if(j("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new V("Invalid first argument. Expected function or boolean 'false'");return r(this,z,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return j("<array> [function]",[t,e],arguments.length),e?r(this,pt,"f").getCompletion(t,e):new Promise((n,i)=>{r(this,pt,"f").getCompletion(t,(o,a)=>{o?i(o):n(a)})})}getDemandedOptions(){return j([],0),r(this,I,"f").demandedOptions}getDemandedCommands(){return j([],0),r(this,I,"f").demandedCommands}getDeprecatedOptions(){return j([],0),r(this,I,"f").deprecatedOptions}getDetectLocale(){return r(this,zt,"f")}getExitProcess(){return r(this,mt,"f")}getGroups(){return Object.assign({},r(this,wt,"f"),r(this,Rt,"f"))}getHelp(){if(x(this,ct,!0,"f"),!r(this,z,"f").hasCachedHelpMessage()){if(!this.parsed){let e=this[re](r(this,Mt,"f"),void 0,void 0,0,!0);if(J(e))return e.then(()=>r(this,z,"f").help())}let t=r(this,X,"f").runDefaultBuilderOn(this);if(J(t))return t.then(()=>r(this,z,"f").help())}return Promise.resolve(r(this,z,"f").help())}getOptions(){return r(this,I,"f")}getStrict(){return r(this,vt,"f")}getStrictCommands(){return r(this,Ht,"f")}getStrictOptions(){return r(this,Ut,"f")}global(t,e){return j("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?r(this,I,"f").local=r(this,I,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{r(this,I,"f").local.includes(n)||r(this,I,"f").local.push(n)}),this}group(t,e){j("<string|array> <string>",[t,e],arguments.length);let n=r(this,Rt,"f")[e]||r(this,wt,"f")[e];r(this,Rt,"f")[e]&&delete r(this,Rt,"f")[e];let i={};return r(this,wt,"f")[e]=(n||[]).concat(t).filter(o=>i[o]?!1:i[o]=!0),this}hide(t){return j("<string>",[t],arguments.length),r(this,I,"f").hiddenOptions.push(t),this}implies(t,e){return j("<string|object> [number|string|array]",[t,e],arguments.length),r(this,Q,"f").implies(t,e),this}locale(t){return j("[string]",[t],arguments.length),t?(x(this,zt,!1,"f"),r(this,W,"f").y18n.setLocale(t),this):(this[ve](),r(this,W,"f").y18n.getLocale())}middleware(t,e,n){return r(this,gt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return j("<string|object|array> [number]",[t,e],arguments.length),this[Xt](this.nargs.bind(this),"narg",t,e),this}normalize(t){return j("<array|string>",[t],arguments.length),this[It]("normalize",t),this}number(t){return j("<array|string>",[t],arguments.length),this[It]("number",t),this[Bt](t),this}option(t,e){if(j("<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[Bt](t),r(this,yt,"f")&&(t==="version"||e?.alias==="version")&&this[Nn](['"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(`
62
+ `),void 0,"versionWarning"),r(this,I,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);let n=e.deprecate||e.deprecated;n&&this.deprecateOption(t,n);let i=e.demand||e.required||e.require;i&&this.demand(t,i),e.demandOption&&this.demandOption(t,typeof e.demandOption=="string"?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),e.implies!==void 0&&this.implies(t,e.implies),e.nargs!==void 0&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||e.type==="boolean")&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||e.type==="array")&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||e.type==="number")&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||e.type==="string")&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||e.type==="count")&&this.count(t),typeof e.global=="boolean"&&this.global(t,e.global),e.defaultDescription&&(r(this,I,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);let o=e.describe||e.description||e.desc;this.describe(t,o),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,n){j("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[Wn](),typeof t>"u"&&(t=r(this,Mt,"f")),typeof e=="object"&&(x(this,Dt,e,"f"),e=n),typeof e=="function"&&(x(this,ht,e,"f"),e=!1),e||x(this,Mt,t,"f"),r(this,ht,"f")&&x(this,mt,!1,"f");let i=this[re](t,!!e),o=this.parsed;return r(this,pt,"f").setParsed(this.parsed),J(i)?i.then(a=>(r(this,ht,"f")&&r(this,ht,"f").call(this,r(this,Pt,"f"),a,r(this,st,"f")),a)).catch(a=>{throw r(this,ht,"f")&&r(this,ht,"f")(a,this.parsed.argv,r(this,st,"f")),a}).finally(()=>{this[Ge](),this.parsed=o}):(r(this,ht,"f")&&r(this,ht,"f").call(this,r(this,Pt,"f"),i,r(this,st,"f")),this[Ge](),this.parsed=o,i)}parseAsync(t,e,n){let i=this.parse(t,e,n);return J(i)?i:Promise.resolve(i)}parseSync(t,e,n){let i=this.parse(t,e,n);if(J(i))throw new V(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(t){return j("<object>",[t],arguments.length),x(this,we,t,"f"),this}pkgConf(t,e){j("<string> [string]",[t,e],arguments.length);let n=null,i=this[He](e||r(this,Lt,"f"));return i[t]&&typeof i[t]=="object"&&(n=ie(i[t],e||r(this,Lt,"f"),this[Tt]()["deep-merge-config"]||!1,r(this,W,"f")),r(this,I,"f").configObjects=(r(this,I,"f").configObjects||[]).concat(n)),this}positional(t,e){j("<string> <object>",[t,e],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=At(e,(a,f)=>a==="type"&&!["string","number","boolean"].includes(f)?!1:n.includes(a));let i=r(this,se,"f").fullCommands[r(this,se,"f").fullCommands.length-1],o=i?r(this,X,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return Kt(o).forEach(a=>{let f=o[a];Array.isArray(f)?f.indexOf(t)!==-1&&(e[a]=!0):f[t]&&!(a in e)&&(e[a]=f[t])}),this.group(t,r(this,z,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return j("[boolean]",[t],arguments.length),x(this,ye,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 j("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&r(this,I,"f").narg[t]?this:(this[Xt](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return j("[string] [string]",[t,e],arguments.length),t=t||this.$0,r(this,Qt,"f").log(r(this,pt,"f").generateCompletionScript(t,e||r(this,ft,"f")||"completion")),this}showHelp(t){if(j("[string|function]",[t],arguments.length),x(this,ct,!0,"f"),!r(this,z,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[re](r(this,Mt,"f"),void 0,void 0,0,!0);if(J(n))return n.then(()=>{r(this,z,"f").showHelp(t)}),this}let e=r(this,X,"f").runDefaultBuilderOn(this);if(J(e))return e.then(()=>{r(this,z,"f").showHelp(t)}),this}return r(this,z,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return j("[boolean|string] [string]",[t,e],arguments.length),r(this,z,"f").showHelpOnFail(t,e),this}showVersion(t){return j("[string|function]",[t],arguments.length),r(this,z,"f").showVersion(t),this}skipValidation(t){return j("<array|string>",[t],arguments.length),this[It]("skipValidation",t),this}strict(t){return j("[boolean]",[t],arguments.length),x(this,vt,t!==!1,"f"),this}strictCommands(t){return j("[boolean]",[t],arguments.length),x(this,Ht,t!==!1,"f"),this}strictOptions(t){return j("[boolean]",[t],arguments.length),x(this,Ut,t!==!1,"f"),this}string(t){return j("<array|string>",[t],arguments.length),this[It]("string",t),this[Bt](t),this}terminalWidth(){return j([],0),r(this,W,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return j("<object>",[t],arguments.length),x(this,zt,!1,"f"),r(this,W,"f").y18n.updateLocale(t),this}usage(t,e,n,i){if(j("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,i],arguments.length),e!==void 0){if(at(t,null,r(this,W,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,i);throw new V(".usage() description must start with $0 if being used as alias for .command()")}else return r(this,z,"f").usage(t),this}version(t,e,n){let i="version";if(j("[boolean|string] [string] [string]",[t,e,n],arguments.length),r(this,yt,"f")&&(this[Re](r(this,yt,"f")),r(this,z,"f").version(void 0),x(this,yt,null,"f")),arguments.length===0)n=this[zn](),t=i;else if(arguments.length===1){if(t===!1)return this;n=t,t=i}else arguments.length===2&&(n=e,e=void 0);return x(this,yt,typeof t=="string"?t:i,"f"),e=e||r(this,z,"f").deferY18nLookup("Show version number"),r(this,z,"f").version(n||void 0),this.boolean(r(this,yt,"f")),this.describe(r(this,yt,"f"),e),this}wrap(t){return j("<number|null|undefined>",[t],arguments.length),r(this,z,"f").wrap(t),this}[(X=new WeakMap,Lt=new WeakMap,se=new WeakMap,pt=new WeakMap,ft=new WeakMap,me=new WeakMap,Pt=new WeakMap,zt=new WeakMap,ge=new WeakMap,mt=new WeakMap,be=new WeakMap,gt=new WeakMap,wt=new WeakMap,ct=new WeakMap,bt=new WeakMap,Oe=new WeakMap,Qt=new WeakMap,st=new WeakMap,I=new WeakMap,_e=new WeakMap,we=new WeakMap,ht=new WeakMap,Dt=new WeakMap,Zt=new WeakMap,Rt=new WeakMap,Mt=new WeakMap,ye=new WeakMap,W=new WeakMap,vt=new WeakMap,Ht=new WeakMap,Ut=new WeakMap,z=new WeakMap,yt=new WeakMap,Q=new WeakMap,$n)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[Fn](){return{log:(...t)=>{this[Ce]()||console.log(...t),x(this,ct,!0,"f"),r(this,st,"f").length&&x(this,st,r(this,st,"f")+`
63
+ `,"f"),x(this,st,r(this,st,"f")+t.join(" "),"f")},error:(...t)=>{this[Ce]()||console.error(...t),x(this,ct,!0,"f"),r(this,st,"f").length&&x(this,st,r(this,st,"f")+`
64
+ `,"f"),x(this,st,r(this,st,"f")+t.join(" "),"f")}}}[Re](t){Kt(r(this,I,"f")).forEach(e=>{if((i=>i==="configObjects")(e))return;let n=r(this,I,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete r(this,z,"f").getDescriptions()[t]}[Nn](t,e,n){r(this,ge,"f")[n]||(r(this,W,"f").process.emitWarning(t,e),r(this,ge,"f")[n]=!0)}[Wn](){r(this,be,"f").push({options:r(this,I,"f"),configObjects:r(this,I,"f").configObjects.slice(0),exitProcess:r(this,mt,"f"),groups:r(this,wt,"f"),strict:r(this,vt,"f"),strictCommands:r(this,Ht,"f"),strictOptions:r(this,Ut,"f"),completionCommand:r(this,ft,"f"),output:r(this,st,"f"),exitError:r(this,Pt,"f"),hasOutput:r(this,ct,"f"),parsed:this.parsed,parseFn:r(this,ht,"f"),parseContext:r(this,Dt,"f")}),r(this,z,"f").freeze(),r(this,Q,"f").freeze(),r(this,X,"f").freeze(),r(this,gt,"f").freeze()}[Ln](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(r(this,W,"f").process.argv()[0])?e=r(this,W,"f").process.argv().slice(1,2):e=r(this,W,"f").process.argv().slice(0,1),t=e.map(n=>{let i=this[Vn](r(this,Lt,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),r(this,W,"f").getEnv("_")&&r(this,W,"f").getProcessArgvBin()===r(this,W,"f").getEnv("_")&&(t=r(this,W,"f").getEnv("_").replace(`${r(this,W,"f").path.dirname(r(this,W,"f").process.execPath())}/`,"")),t}[Tt](){return r(this,we,"f")}[ve](){if(!r(this,zt,"f"))return;let t=r(this,W,"f").getEnv("LC_ALL")||r(this,W,"f").getEnv("LC_MESSAGES")||r(this,W,"f").getEnv("LANG")||r(this,W,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[zn](){return this[He]().version||"unknown"}[Dn](t){let e=t["--"]?t["--"]:t._;for(let n=0,i;(i=e[n])!==void 0;n++)r(this,W,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(e[n]=Number(i));return t}[He](t){let e=t||"*";if(r(this,Zt,"f")[e])return r(this,Zt,"f")[e];let n={};try{let i=t||r(this,W,"f").mainFilename;!t&&r(this,W,"f").path.extname(i)&&(i=r(this,W,"f").path.dirname(i));let o=r(this,W,"f").findUp(i,(a,f)=>{if(f.includes("package.json"))return"package.json"});at(o,void 0,r(this,W,"f")),n=JSON.parse(r(this,W,"f").readFileSync(o,"utf8"))}catch{}return r(this,Zt,"f")[e]=n||{},r(this,Zt,"f")[e]}[It](t,e){e=[].concat(e),e.forEach(n=>{n=this[Ye](n),r(this,I,"f")[t].push(n)})}[Xt](t,e,n,i){this[Te](t,e,n,i,(o,a,f)=>{r(this,I,"f")[o][a]=f})}[Ue](t,e,n,i){this[Te](t,e,n,i,(o,a,f)=>{r(this,I,"f")[o][a]=(r(this,I,"f")[o][a]||[]).concat(f)})}[Te](t,e,n,i,o){if(Array.isArray(n))n.forEach(a=>{t(a,i)});else if((a=>typeof a=="object")(n))for(let a of Kt(n))t(a,n[a]);else o(e,this[Ye](n),i)}[Ye](t){return t==="__proto__"?"___proto___":t}[Be](t,e){return this[Xt](this[Be].bind(this),"key",t,e),this}[Ge](){var t,e,n,i,o,a,f,g,O,b,h,p;let _=r(this,be,"f").pop();at(_,void 0,r(this,W,"f"));let A;t=this,e=this,n=this,i=this,o=this,a=this,f=this,g=this,O=this,b=this,h=this,p=this,{options:{set value(y){x(t,I,y,"f")}}.value,configObjects:A,exitProcess:{set value(y){x(e,mt,y,"f")}}.value,groups:{set value(y){x(n,wt,y,"f")}}.value,output:{set value(y){x(i,st,y,"f")}}.value,exitError:{set value(y){x(o,Pt,y,"f")}}.value,hasOutput:{set value(y){x(a,ct,y,"f")}}.value,parsed:this.parsed,strict:{set value(y){x(f,vt,y,"f")}}.value,strictCommands:{set value(y){x(g,Ht,y,"f")}}.value,strictOptions:{set value(y){x(O,Ut,y,"f")}}.value,completionCommand:{set value(y){x(b,ft,y,"f")}}.value,parseFn:{set value(y){x(h,ht,y,"f")}}.value,parseContext:{set value(y){x(p,Dt,y,"f")}}.value}=_,r(this,I,"f").configObjects=A,r(this,z,"f").unfreeze(),r(this,Q,"f").unfreeze(),r(this,X,"f").unfreeze(),r(this,gt,"f").unfreeze()}[Rn](t,e){return Wt(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[vn].bind(this),getContext:this[Hn].bind(this),getHasOutput:this[Un].bind(this),getLoggerInstance:this[Tn].bind(this),getParseContext:this[Yn].bind(this),getParserConfiguration:this[Tt].bind(this),getUsageInstance:this[Bn].bind(this),getValidationInstance:this[Gn].bind(this),hasParseCallback:this[Ce].bind(this),isGlobalContext:this[qn].bind(this),postProcess:this[Yt].bind(this),reset:this[qe].bind(this),runValidation:this[Ve].bind(this),runYargsParserAndExecuteCommands:this[re].bind(this),setHasOutput:this[Kn].bind(this)}}[vn](){return r(this,X,"f")}[Hn](){return r(this,se,"f")}[Un](){return r(this,ct,"f")}[Tn](){return r(this,Qt,"f")}[Yn](){return r(this,Dt,"f")||{}}[Bn](){return r(this,z,"f")}[Gn](){return r(this,Q,"f")}[Ce](){return!!r(this,ht,"f")}[qn](){return r(this,Oe,"f")}[Yt](t,e,n,i){return n||J(t)||(e||(t=this[$n](t)),(this[Tt]()["parse-positional-numbers"]||this[Tt]()["parse-positional-numbers"]===void 0)&&(t=this[Dn](t)),i&&(t=Nt(t,this,r(this,gt,"f").getMiddleware(),!1))),t}[qe](t={}){x(this,I,r(this,I,"f")||{},"f");let e={};e.local=r(this,I,"f").local||[],e.configObjects=r(this,I,"f").configObjects||[];let n={};e.local.forEach(a=>{n[a]=!0,(t[a]||[]).forEach(f=>{n[f]=!0})}),Object.assign(r(this,Rt,"f"),Object.keys(r(this,wt,"f")).reduce((a,f)=>{let g=r(this,wt,"f")[f].filter(O=>!(O in n));return g.length>0&&(a[f]=g),a},{})),x(this,wt,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],o=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(a=>{e[a]=(r(this,I,"f")[a]||[]).filter(f=>!n[f])}),o.forEach(a=>{e[a]=At(r(this,I,"f")[a],f=>!n[f])}),e.envPrefix=r(this,I,"f").envPrefix,x(this,I,e,"f"),x(this,z,r(this,z,"f")?r(this,z,"f").reset(n):En(this,r(this,W,"f")),"f"),x(this,Q,r(this,Q,"f")?r(this,Q,"f").reset(n):Mn(this,r(this,z,"f"),r(this,W,"f")),"f"),x(this,X,r(this,X,"f")?r(this,X,"f").reset():wn(r(this,z,"f"),r(this,Q,"f"),r(this,gt,"f"),r(this,W,"f")),"f"),r(this,pt,"f")||x(this,pt,An(this,r(this,z,"f"),r(this,X,"f"),r(this,W,"f")),"f"),r(this,gt,"f").reset(),x(this,ft,null,"f"),x(this,st,"","f"),x(this,Pt,null,"f"),x(this,ct,!1,"f"),this.parsed=!1,this}[Vn](t,e){return r(this,W,"f").path.relative(t,e)}[re](t,e,n,i=0,o=!1){let a=!!n||o;t=t||r(this,Mt,"f"),r(this,I,"f").__=r(this,W,"f").y18n.__,r(this,I,"f").configuration=this[Tt]();let f=!!r(this,I,"f").configuration["populate--"],g=Object.assign({},r(this,I,"f").configuration,{"populate--":!0}),O=r(this,W,"f").Parser.detailed(t,Object.assign({},r(this,I,"f"),{configuration:{"parse-positional-numbers":!1,...g}})),b=Object.assign(O.argv,r(this,Dt,"f")),h,p=O.aliases,_=!1,A=!1;Object.keys(b).forEach(y=>{y===r(this,bt,"f")&&b[y]?_=!0:y===r(this,yt,"f")&&b[y]&&(A=!0)}),b.$0=this.$0,this.parsed=O,i===0&&r(this,z,"f").clearCachedHelpMessage();try{if(this[ve](),e)return this[Yt](b,f,!!n,!1);r(this,bt,"f")&&[r(this,bt,"f")].concat(p[r(this,bt,"f")]||[]).filter(T=>T.length>1).includes(""+b._[b._.length-1])&&(b._.pop(),_=!0),x(this,Oe,!1,"f");let y=r(this,X,"f").getCommands(),d=r(this,pt,"f").completionKey in b,R=_||d||o;if(b._.length){if(y.length){let v;for(let T=i||0,Y;b._[T]!==void 0;T++)if(Y=String(b._[T]),y.includes(Y)&&Y!==r(this,ft,"f")){let H=r(this,X,"f").runCommand(Y,this,O,T+1,o,_||A||o);return this[Yt](H,f,!!n,!1)}else if(!v&&Y!==r(this,ft,"f")){v=Y;break}!r(this,X,"f").hasDefaultCommand()&&r(this,ye,"f")&&v&&!R&&r(this,Q,"f").recommendCommands(v,y)}r(this,ft,"f")&&b._.includes(r(this,ft,"f"))&&!d&&(r(this,mt,"f")&&St(!0),this.showCompletionScript(),this.exit(0))}if(r(this,X,"f").hasDefaultCommand()&&!R){let v=r(this,X,"f").runCommand(null,this,O,0,o,_||A||o);return this[Yt](v,f,!!n,!1)}if(d){r(this,mt,"f")&&St(!0),t=[].concat(t);let v=t.slice(t.indexOf(`--${r(this,pt,"f").completionKey}`)+1);return r(this,pt,"f").getCompletion(v,(T,Y)=>{if(T)throw new V(T.message);(Y||[]).forEach(H=>{r(this,Qt,"f").log(H)}),this.exit(0)}),this[Yt](b,!f,!!n,!1)}if(r(this,ct,"f")||(_?(r(this,mt,"f")&&St(!0),a=!0,this.showHelp("log"),this.exit(0)):A&&(r(this,mt,"f")&&St(!0),a=!0,r(this,z,"f").showVersion("log"),this.exit(0))),!a&&r(this,I,"f").skipValidation.length>0&&(a=Object.keys(b).some(v=>r(this,I,"f").skipValidation.indexOf(v)>=0&&b[v]===!0)),!a){if(O.error)throw new V(O.error.message);if(!d){let v=this[Ve](p,{},O.error);n||(h=Nt(b,this,r(this,gt,"f").getMiddleware(),!0)),h=this[Rn](v,h??b),J(h)&&!n&&(h=h.then(()=>Nt(b,this,r(this,gt,"f").getMiddleware(),!1)))}}}catch(y){if(y instanceof V)r(this,z,"f").fail(y.message,y);else throw y}return this[Yt](h??b,f,!!n,!0)}[Ve](t,e,n,i){let o={...this.getDemandedOptions()};return a=>{if(n)throw new V(n.message);r(this,Q,"f").nonOptionCount(a),r(this,Q,"f").requiredArguments(a,o);let f=!1;r(this,Ht,"f")&&(f=r(this,Q,"f").unknownCommands(a)),r(this,vt,"f")&&!f?r(this,Q,"f").unknownArguments(a,t,e,!!i):r(this,Ut,"f")&&r(this,Q,"f").unknownArguments(a,t,{},!1,!1),r(this,Q,"f").limitedChoices(a),r(this,Q,"f").implications(a),r(this,Q,"f").conflicting(a)}}[Kn](){x(this,ct,!0,"f")}[Bt](t){if(typeof t=="string")r(this,I,"f").key[t]=!0;else for(let e of t)r(this,I,"f").key[e]=!0}};function yn(s){return!!s&&typeof s.getInternalMethods=="function"}var Gi=Jn($e),Qn=Gi;var qi=s=>{let t={...s};return Object.values(s).forEach(e=>typeof e=="number"&&delete t[e]),t},Zn=s=>Object.keys(qi(s));async function Ji(){let s=await Qn(Me(process.argv)).help(!1).version(!1).option("log",{choices:Zn(Je)}).argv,t=Je[s.log??"INFO"],e={...JSON.parse(s._[0]??"{}"),log:new Vi(t)};t>Je.INFO&&console.log(`OPTIONS:
65
+ `,JSON.stringify(e,null,2));let n=new Ki(e);try{await n.startServer(),await n.startScheduler()}catch(i){n.log.error(i),process.exitCode=1,await n.dispose()}}await Ji();
66
66
  /**
67
67
  * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
68
68
  * CJS and ESM environments.