@envsa/knip-config
Version:
Knip configuration for @envsa/shared-config.
13 lines • 107 kB
JavaScript
#!/usr/bin/env node
var gs=Object.create;var Nn=Object.defineProperty;var bs=Object.getOwnPropertyDescriptor;var ys=Object.getOwnPropertyNames;var ws=Object.getPrototypeOf,Os=Object.prototype.hasOwnProperty;var je=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Cs=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var xs=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ys(e))!Os.call(i,s)&&s!==t&&Nn(i,s,{get:()=>e[s],enumerable:!(n=bs(e,s))||n.enumerable});return i};var _s=(i,e,t)=>(t=i!=null?gs(ws(i)):{},xs(e||!i||!i.__esModule?Nn(t,"default",{value:i,enumerable:!0}):t,i));var is=Cs((zc,ns)=>{"use strict";var Dr=function(e){return Wr(e)&&!Lr(e)};function Wr(i){return!!i&&typeof i=="object"}function Lr(i){var e=Object.prototype.toString.call(i);return e==="[object RegExp]"||e==="[object Date]"||zr(i)}var Ur=typeof Symbol=="function"&&Symbol.for,Br=Ur?Symbol.for("react.element"):60103;function zr(i){return i.$$typeof===Br}function kr(i){return Array.isArray(i)?[]:{}}function Ct(i,e){return e.clone!==!1&&e.isMergeableObject(i)?ut(kr(i),i,e):i}function Yr(i,e,t){return i.concat(e).map(function(n){return Ct(n,t)})}function Gr(i,e){if(!e.customMerge)return ut;var t=e.customMerge(i);return typeof t=="function"?t:ut}function Hr(i){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(i).filter(function(e){return Object.propertyIsEnumerable.call(i,e)}):[]}function es(i){return Object.keys(i).concat(Hr(i))}function ts(i,e){try{return e in i}catch{return!1}}function Vr(i,e){return ts(i,e)&&!(Object.hasOwnProperty.call(i,e)&&Object.propertyIsEnumerable.call(i,e))}function Kr(i,e,t){var n={};return t.isMergeableObject(i)&&es(i).forEach(function(s){n[s]=Ct(i[s],t)}),es(e).forEach(function(s){Vr(i,s)||(ts(i,s)&&t.isMergeableObject(e[s])?n[s]=Gr(s,t)(i[s],e[s],t):n[s]=Ct(e[s],t))}),n}function ut(i,e,t){t=t||{},t.arrayMerge=t.arrayMerge||Yr,t.isMergeableObject=t.isMergeableObject||Dr,t.cloneUnlessOtherwiseSpecified=Ct;var n=Array.isArray(e),s=Array.isArray(i),r=n===s;return r?n?t.arrayMerge(i,e,t):Kr(i,e,t):Ct(e,t)}ut.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(n,s){return ut(n,s,t)},{})};var qr=ut;ns.exports=qr});var Rn=(i=0)=>e=>`\x1B[${e+i}m`,Tn=(i=0)=>e=>`\x1B[${38+i};5;${e}m`,Dn=(i=0)=>(e,t,n)=>`\x1B[${38+i};2;${e};${t};${n}m`,q={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},bo=Object.keys(q.modifier),As=Object.keys(q.color),Es=Object.keys(q.bgColor),yo=[...As,...Es];function js(){let i=new Map;for(let[e,t]of Object.entries(q)){for(let[n,s]of Object.entries(t))q[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},t[n]=q[n],i.set(s[0],s[1]);Object.defineProperty(q,e,{value:t,enumerable:!1})}return Object.defineProperty(q,"codes",{value:i,enumerable:!1}),q.color.close="\x1B[39m",q.bgColor.close="\x1B[49m",q.color.ansi=Rn(),q.color.ansi256=Tn(),q.color.ansi16m=Dn(),q.bgColor.ansi=Rn(10),q.bgColor.ansi256=Tn(10),q.bgColor.ansi16m=Dn(10),Object.defineProperties(q,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(r=>r+r).join(""));let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>q.rgbToAnsi256(...q.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,s;if(e>=232)t=((e-232)*10+8)/255,n=t,s=t;else{e-=16;let c=e%36;t=Math.floor(e/36)/5,n=Math.floor(c/6)/5,s=c%6/5}let r=Math.max(t,n,s)*2;if(r===0)return 30;let o=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(t));return r===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>q.ansi256ToAnsi(q.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>q.ansi256ToAnsi(q.hexToAnsi256(e)),enumerable:!1}}),q}var Ss=js(),_e=Ss;import qt from"node:process";import Ps from"node:os";import Wn from"node:tty";function de(i,e=globalThis.Deno?globalThis.Deno.args:qt.argv){let t=i.startsWith("-")?"":i.length===1?"-":"--",n=e.indexOf(t+i),s=e.indexOf("--");return n!==-1&&(s===-1||n<s)}var{env:X}=qt,_t;de("no-color")||de("no-colors")||de("color=false")||de("color=never")?_t=0:(de("color")||de("colors")||de("color=true")||de("color=always"))&&(_t=1);function Ms(){if("FORCE_COLOR"in X)return X.FORCE_COLOR==="true"?1:X.FORCE_COLOR==="false"?0:X.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(X.FORCE_COLOR,10),3)}function Is(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function vs(i,{streamIsTTY:e,sniffFlags:t=!0}={}){let n=Ms();n!==void 0&&(_t=n);let s=t?_t:n;if(s===0)return 0;if(t){if(de("color=16m")||de("color=full")||de("color=truecolor"))return 3;if(de("color=256"))return 2}if("TF_BUILD"in X&&"AGENT_NAME"in X)return 1;if(i&&!e&&s===void 0)return 0;let r=s||0;if(X.TERM==="dumb")return r;if(qt.platform==="win32"){let o=Ps.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in X)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(o=>o in X)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(o=>o in X)||X.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in X)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(X.TEAMCITY_VERSION)?1:0;if(X.COLORTERM==="truecolor"||X.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in X){let o=Number.parseInt((X.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(X.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(X.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(X.TERM)||"COLORTERM"in X?1:r}function Ln(i,e={}){let t=vs(i,{streamIsTTY:i&&i.isTTY,...e});return Is(t)}var $s={stdout:Ln({isTTY:Wn.isatty(1)}),stderr:Ln({isTTY:Wn.isatty(2)})},Un=$s;function Bn(i,e,t){let n=i.indexOf(e);if(n===-1)return i;let s=e.length,r=0,o="";do o+=i.slice(r,n)+e+t,r=n+s,n=i.indexOf(e,r);while(n!==-1);return o+=i.slice(r),o}function zn(i,e,t,n){let s=0,r="";do{let o=i[n-1]==="\r";r+=i.slice(s,o?n-1:n)+e+(o?`\r
`:`
`)+t,s=n+1,n=i.indexOf(`
`,s)}while(n!==-1);return r+=i.slice(s),r}var{stdout:kn,stderr:Yn}=Un,Jt=Symbol("GENERATOR"),st=Symbol("STYLER"),dt=Symbol("IS_EMPTY"),Gn=["ansi","ansi","ansi256","ansi16m"],rt=Object.create(null),Fs=(i,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=kn?kn.level:0;i.level=e.level===void 0?t:e.level};var Ns=i=>{let e=(...t)=>t.join(" ");return Fs(e,i),Object.setPrototypeOf(e,pt.prototype),e};function pt(i){return Ns(i)}Object.setPrototypeOf(pt.prototype,Function.prototype);for(let[i,e]of Object.entries(_e))rt[i]={get(){let t=At(this,Zt(e.open,e.close,this[st]),this[dt]);return Object.defineProperty(this,i,{value:t}),t}};rt.visible={get(){let i=At(this,this[st],!0);return Object.defineProperty(this,"visible",{value:i}),i}};var Qt=(i,e,t,...n)=>i==="rgb"?e==="ansi16m"?_e[t].ansi16m(...n):e==="ansi256"?_e[t].ansi256(_e.rgbToAnsi256(...n)):_e[t].ansi(_e.rgbToAnsi(...n)):i==="hex"?Qt("rgb",e,t,..._e.hexToRgb(...n)):_e[t][i](...n),Rs=["rgb","hex","ansi256"];for(let i of Rs){rt[i]={get(){let{level:t}=this;return function(...n){let s=Zt(Qt(i,Gn[t],"color",...n),_e.color.close,this[st]);return At(this,s,this[dt])}}};let e="bg"+i[0].toUpperCase()+i.slice(1);rt[e]={get(){let{level:t}=this;return function(...n){let s=Zt(Qt(i,Gn[t],"bgColor",...n),_e.bgColor.close,this[st]);return At(this,s,this[dt])}}}}var Ts=Object.defineProperties(()=>{},{...rt,level:{enumerable:!0,get(){return this[Jt].level},set(i){this[Jt].level=i}}}),Zt=(i,e,t)=>{let n,s;return t===void 0?(n=i,s=e):(n=t.openAll+i,s=e+t.closeAll),{open:i,close:e,openAll:n,closeAll:s,parent:t}},At=(i,e,t)=>{let n=(...s)=>Ds(n,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(n,Ts),n[Jt]=i,n[st]=e,n[dt]=t,n},Ds=(i,e)=>{if(i.level<=0||!e)return i[dt]?"":e;let t=i[st];if(t===void 0)return e;let{openAll:n,closeAll:s}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=Bn(e,t.close,t.open),t=t.parent;let r=e.indexOf(`
`);return r!==-1&&(e=zn(e,s,n,r)),n+e+s};Object.defineProperties(pt.prototype,rt);var Ws=pt(),Po=pt({level:Yn?Yn.level:0});var Fe=Ws;import{cosmiconfig as io}from"cosmiconfig";import{execa as so}from"execa";import Ee from"fs-extra";import fs from"node:fs";import Ht from"node:path";import{PassThrough as ro}from"node:stream";import{fileURLToPath as oo}from"node:url";import qn from"node:process";import Hn from"node:process";import Ls from"node:fs/promises";import{fileURLToPath as Us}from"node:url";import Bs from"node:fs";import pe from"node:path";var Et=i=>i instanceof URL?Us(i):i;async function Vn(i,{cwd:e=Hn.cwd(),type:t="file",stopAt:n}={}){let s=pe.resolve(Et(e)??""),{root:r}=pe.parse(s);for(n=pe.resolve(s,Et(n??r));s&&s!==n&&s!==r;){let o=pe.isAbsolute(i)?i:pe.join(s,i);try{let c=await Ls.stat(o);if(t==="file"&&c.isFile()||t==="directory"&&c.isDirectory())return o}catch{}s=pe.dirname(s)}}function Kn(i,{cwd:e=Hn.cwd(),type:t="file",stopAt:n}={}){let s=pe.resolve(Et(e)??""),{root:r}=pe.parse(s);for(n=pe.resolve(s,Et(n)??r);s&&s!==n&&s!==r;){let o=pe.isAbsolute(i)?i:pe.join(s,i);try{let c=Bs.statSync(o,{throwIfNoEntry:!1});if(t==="file"&&c?.isFile()||t==="directory"&&c?.isDirectory())return o}catch{}s=pe.dirname(s)}}async function Xt({cwd:i=qn.cwd()}={}){return Vn("package.json",{cwd:i})}function Jn({cwd:i=qn.cwd()}={}){return Kn("package.json",{cwd:i})}import{notStrictEqual as hr,strictEqual as dr}from"assert";var zs={right:Vs,center:Ks},ks=0,jt=1,Ys=2,St=3,en=class{constructor(e){var t;this.width=e.width,this.wrap=(t=e.wrap)!==null&&t!==void 0?t:!0,this.rows=[]}span(...e){let t=this.div(...e);t.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);let t=e.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(t),t}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let t=e.split(`
`).map(s=>s.split(" ")),n=0;return t.forEach(s=>{s.length>1&&le.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),le.stringWidth(s[0])))}),t.forEach(s=>{this.div(...s.map((r,o)=>({text:r.trim(),padding:this.measurePadding(r),width:o===0&&s.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let t=le.stripAnsi(e);return[0,t.match(/\s*$/)[0].length,0,t.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(t=>{this.rowToString(t,e)}),e.filter(t=>!t.hidden).map(t=>t.text).join(`
`)}rowToString(e,t){return this.rasterize(e).forEach((n,s)=>{let r="";n.forEach((o,c)=>{let{width:b}=e[c],y=this.negatePadding(e[c]),m=o;if(y>le.stringWidth(o)&&(m+=" ".repeat(y-le.stringWidth(o))),e[c].align&&e[c].align!=="left"&&this.wrap){let u=zs[e[c].align];m=u(m,y),le.stringWidth(m)<y&&(m+=" ".repeat((b||0)-le.stringWidth(m)-1))}let f=e[c].padding||[0,0,0,0];f[St]&&(r+=" ".repeat(f[St])),r+=Qn(e[c],m,"| "),r+=m,r+=Qn(e[c],m," |"),f[jt]&&(r+=" ".repeat(f[jt])),s===0&&t.length>0&&(r=this.renderInline(r,t[t.length-1]))}),t.push({text:r.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){let n=e.match(/^ */),s=n?n[0].length:0,r=t.text,o=le.stringWidth(r.trimRight());return t.span?this.wrap?s<o?e:(t.hidden=!0,r.trimRight()+" ".repeat(s-o)+e.trimLeft()):(t.hidden=!0,r+e):e}rasterize(e){let t=[],n=this.columnWidths(e),s;return e.forEach((r,o)=>{r.width=n[o],this.wrap?s=le.wrap(r.text,this.negatePadding(r),{hard:!0}).split(`
`):s=r.text.split(`
`),r.border&&(s.unshift("."+"-".repeat(this.negatePadding(r)+2)+"."),s.push("'"+"-".repeat(this.negatePadding(r)+2)+"'")),r.padding&&(s.unshift(...new Array(r.padding[ks]||0).fill("")),s.push(...new Array(r.padding[Ys]||0).fill(""))),s.forEach((c,b)=>{t[b]||t.push([]);let y=t[b];for(let m=0;m<o;m++)y[m]===void 0&&y.push("");y.push(c)})}),t}negatePadding(e){let t=e.width||0;return e.padding&&(t-=(e.padding[St]||0)+(e.padding[jt]||0)),e.border&&(t-=4),t}columnWidths(e){if(!this.wrap)return e.map(o=>o.width||le.stringWidth(o.text));let t=e.length,n=this.width,s=e.map(o=>{if(o.width)return t--,n-=o.width,o.width}),r=t?Math.floor(n/t):0;return s.map((o,c)=>o===void 0?Math.max(r,Gs(e[c])):o)}};function Qn(i,e,t){return i.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function Gs(i){let e=i.padding||[],t=1+(e[St]||0)+(e[jt]||0);return i.border?t+4:t}function Hs(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Vs(i,e){i=i.trim();let t=le.stringWidth(i);return t<e?" ".repeat(e-t)+i:i}function Ks(i,e){i=i.trim();let t=le.stringWidth(i);return t>=e?i:" ".repeat(e-t>>1)+i}var le;function Zn(i,e){return le=e,new en({width:i?.width||Hs(),wrap:i?.wrap})}var Xn=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function tn(i){return i.replace(Xn,"")}function ei(i,e){let[t,n]=i.match(Xn)||["",""];i=tn(i);let s="";for(let r=0;r<i.length;r++)r!==0&&r%e===0&&(s+=`
`),s+=i.charAt(r);return t&&n&&(s=`${t}${s}${n}`),s}function nn(i){return Zn(i,{stringWidth:e=>[...e].length,stripAnsi:tn,wrap:ei})}import{dirname as ti,resolve as ni}from"path";import{readdirSync as qs,statSync as Js}from"fs";function ii(i,e){let t=ni(".",i),n;for(Js(t).isDirectory()||(t=ti(t));;){if(n=e(t,qs(t)),n)return ni(t,n);if(t=ti(n=t),n===t)break}}import{inspect as pr}from"util";import{readFileSync as mr}from"fs";import{fileURLToPath as gr}from"url";import{format as Xs}from"util";import{normalize as er,resolve as tr}from"path";function ke(i){if(i!==i.toLowerCase()&&i!==i.toUpperCase()||(i=i.toLowerCase()),i.indexOf("-")===-1&&i.indexOf("_")===-1)return i;{let t="",n=!1,s=i.match(/^-+/);for(let r=s?s[0].length:0;r<i.length;r++){let o=i.charAt(r);n&&(n=!1,o=o.toUpperCase()),r!==0&&(o==="-"||o==="_")?n=!0:o!=="-"&&o!=="_"&&(t+=o)}return t}}function Pt(i,e){let t=i.toLowerCase();e=e||"-";let n="";for(let s=0;s<i.length;s++){let r=t.charAt(s),o=i.charAt(s);r!==o&&s>0?n+=`${e}${t.charAt(s)}`:n+=o}return n}function Mt(i){return i==null?!1:typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^0[^.]/.test(i)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function si(i){if(Array.isArray(i))return i.map(o=>typeof o!="string"?o+"":o);i=i.trim();let e=0,t=null,n=null,s=null,r=[];for(let o=0;o<i.length;o++){if(t=n,n=i.charAt(o),n===" "&&!s){t!==" "&&e++;continue}n===s?s=null:(n==="'"||n==='"')&&!s&&(s=n),r[e]||(r[e]=""),r[e]+=n}return r}var me;(function(i){i.BOOLEAN="boolean",i.STRING="string",i.NUMBER="number",i.ARRAY="array"})(me||(me={}));var ve,It=class{constructor(e){ve=e}parse(e,t){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},t),s=si(e),r=typeof e=="string",o=Qs(Object.assign(Object.create(null),n.alias)),c=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),b=Object.assign(Object.create(null),n.default),y=n.configObjects||[],m=n.envPrefix,f=c["populate--"],u=f?"--":"_",g=Object.create(null),C=Object.create(null),O=n.__||ve.format,p={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},R=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,W=new RegExp("^--"+c["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let d=typeof l=="object"?l.key:l,x=Object.keys(l).map(function(w){return{boolean:"bools",string:"strings",number:"numbers"}[w]}).filter(Boolean).pop();x&&(p[x][d]=!0),p.arrays[d]=!0,p.keys.push(d)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(l){p.bools[l]=!0,p.keys.push(l)}),[].concat(n.string||[]).filter(Boolean).forEach(function(l){p.strings[l]=!0,p.keys.push(l)}),[].concat(n.number||[]).filter(Boolean).forEach(function(l){p.numbers[l]=!0,p.keys.push(l)}),[].concat(n.count||[]).filter(Boolean).forEach(function(l){p.counts[l]=!0,p.keys.push(l)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(l){p.normalize[l]=!0,p.keys.push(l)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([l,d])=>{typeof d=="number"&&(p.nargs[l]=d,p.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,d])=>{typeof d=="function"&&(p.coercions[l]=d,p.keys.push(l))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(l){p.configs[l]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([l,d])=>{(typeof d=="boolean"||typeof d=="function")&&(p.configs[l]=d)})),ze(n.key,o,n.default,p.arrays),Object.keys(b).forEach(function(l){(p.aliases[l]||[]).forEach(function(d){b[d]=b[l]})});let B=null;xt();let L=[],Y=Object.assign(Object.create(null),{_:[]}),$e={};for(let l=0;l<s.length;l++){let d=s[l],x=d.replace(/^-{3,}/,"---"),w,h,P,A,v,re;if(d!=="--"&&/^-/.test(d)&&Q(d))Oe(d);else if(x.match(/^---+(=|$)/)){Oe(d);continue}else if(d.match(/^--.+=/)||!c["short-option-groups"]&&d.match(/^-.+=/))A=d.match(/^--?([^=]+)=([\s\S]*)$/),A!==null&&Array.isArray(A)&&A.length>=3&&(F(A[1],p.arrays)?l=Ue(l,A[1],s,A[2]):F(A[1],p.nargs)!==!1?l=it(l,A[1],s,A[2]):G(A[1],A[2],!0));else if(d.match(W)&&c["boolean-negation"])A=d.match(W),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],G(h,F(h,p.arrays)?[!1]:!1));else if(d.match(/^--.+/)||!c["short-option-groups"]&&d.match(/^-[^-]+/))A=d.match(/^--?(.+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],F(h,p.arrays)?l=Ue(l,h,s):F(h,p.nargs)!==!1?l=it(l,h,s):(v=s[l+1],v!==void 0&&(!v.match(/^-/)||v.match(R))&&!F(h,p.bools)&&!F(h,p.counts)||/^(true|false)$/.test(v)?(G(h,v),l++):G(h,Z(h))));else if(d.match(/^-.\..+=/))A=d.match(/^-([^=]+)=([\s\S]*)$/),A!==null&&Array.isArray(A)&&A.length>=3&&G(A[1],A[2]);else if(d.match(/^-.\..+/)&&!d.match(R))v=s[l+1],A=d.match(/^-(.\..+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],v!==void 0&&!v.match(/^-/)&&!F(h,p.bools)&&!F(h,p.counts)?(G(h,v),l++):G(h,Z(h)));else if(d.match(/^-[^-]+/)&&!d.match(R)){P=d.slice(1,-1).split(""),w=!1;for(let ae=0;ae<P.length;ae++){if(v=d.slice(ae+2),P[ae+1]&&P[ae+1]==="="){re=d.slice(ae+3),h=P[ae],F(h,p.arrays)?l=Ue(l,h,s,re):F(h,p.nargs)!==!1?l=it(l,h,s,re):G(h,re),w=!0;break}if(v==="-"){G(P[ae],v);continue}if(/[A-Za-z]/.test(P[ae])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(v)&&F(v,p.bools)===!1){G(P[ae],v),w=!0;break}if(P[ae+1]&&P[ae+1].match(/\W/)){G(P[ae],v),w=!0;break}else G(P[ae],Z(P[ae]))}h=d.slice(-1)[0],!w&&h!=="-"&&(F(h,p.arrays)?l=Ue(l,h,s):F(h,p.nargs)!==!1?l=it(l,h,s):(v=s[l+1],v!==void 0&&(!/^(-|--)[^-]/.test(v)||v.match(R))&&!F(h,p.bools)&&!F(h,p.counts)||/^(true|false)$/.test(v)?(G(h,v),l++):G(h,Z(h))))}else if(d.match(/^-[0-9]$/)&&d.match(R)&&F(d.slice(1),p.bools))h=d.slice(1),G(h,Z(h));else if(d==="--"){L=s.slice(l+1);break}else if(c["halt-at-non-option"]){L=s.slice(l);break}else Oe(d)}z(Y,!0),z(Y,!1),D(Y),ie(),J(Y,p.aliases,b,!0),se(Y),c["set-placeholder-key"]&&Be(Y),Object.keys(p.counts).forEach(function(l){Me(Y,l.split("."))||G(l,0)}),f&&L.length&&(Y[u]=[]),L.forEach(function(l){Y[u].push(l)}),c["camel-case-expansion"]&&c["strip-dashed"]&&Object.keys(Y).filter(l=>l!=="--"&&l.includes("-")).forEach(l=>{delete Y[l]}),c["strip-aliased"]&&[].concat(...Object.keys(o).map(l=>o[l])).forEach(l=>{c["camel-case-expansion"]&&l.includes("-")&&delete Y[l.split(".").map(d=>ke(d)).join(".")],delete Y[l]});function Oe(l){let d=S("_",l);(typeof d=="string"||typeof d=="number")&&Y._.push(d)}function it(l,d,x,w){let h,P=F(d,p.nargs);if(P=typeof P!="number"||isNaN(P)?1:P,P===0)return xe(w)||(B=Error(O("Argument unexpected for: %s",d))),G(d,Z(d)),l;let A=xe(w)?0:1;if(c["nargs-eats-options"])x.length-(l+1)+A<P&&(B=Error(O("Not enough arguments following: %s",d))),A=P;else{for(h=l+1;h<x.length&&(!x[h].match(/^-[^0-9]/)||x[h].match(R)||Q(x[h]));h++)A++;A<P&&(B=Error(O("Not enough arguments following: %s",d)))}let v=Math.min(A,P);for(!xe(w)&&v>0&&(G(d,w),v--),h=l+1;h<v+l+1;h++)G(d,x[h]);return l+v}function Ue(l,d,x,w){let h=[],P=w||x[l+1],A=F(d,p.nargs);if(F(d,p.bools)&&!/^(true|false)$/.test(P))h.push(!0);else if(xe(P)||xe(w)&&/^-/.test(P)&&!R.test(P)&&!Q(P)){if(b[d]!==void 0){let v=b[d];h=Array.isArray(v)?v:[v]}}else{xe(w)||h.push(_(d,w,!0));for(let v=l+1;v<x.length&&!(!c["greedy-arrays"]&&h.length>0||A&&typeof A=="number"&&h.length>=A||(P=x[v],/^-/.test(P)&&!R.test(P)&&!Q(P)));v++)l=v,h.push(_(d,P,r))}return typeof A=="number"&&(A&&h.length<A||isNaN(A)&&h.length===0)&&(B=Error(O("Not enough arguments following: %s",d))),G(d,h),l}function G(l,d,x=r){if(/-/.test(l)&&c["camel-case-expansion"]){let P=l.split(".").map(function(A){return ke(A)}).join(".");M(l,P)}let w=_(l,d,x),h=l.split(".");Ie(Y,h,w),p.aliases[l]&&p.aliases[l].forEach(function(P){let A=P.split(".");Ie(Y,A,w)}),h.length>1&&c["dot-notation"]&&(p.aliases[h[0]]||[]).forEach(function(P){let A=P.split("."),v=[].concat(h);v.shift(),A=A.concat(v),(p.aliases[l]||[]).includes(A.join("."))||Ie(Y,A,w)}),F(l,p.normalize)&&!F(l,p.arrays)&&[l].concat(p.aliases[l]||[]).forEach(function(A){Object.defineProperty($e,A,{enumerable:!0,get(){return d},set(v){d=typeof v=="string"?ve.normalize(v):v}})})}function M(l,d){p.aliases[l]&&p.aliases[l].length||(p.aliases[l]=[d],g[d]=!0),p.aliases[d]&&p.aliases[d].length||M(d,l)}function _(l,d,x){x&&(d=Zs(d)),(F(l,p.bools)||F(l,p.counts))&&typeof d=="string"&&(d=d==="true");let w=Array.isArray(d)?d.map(function(h){return S(l,h)}):S(l,d);return F(l,p.counts)&&(xe(w)||typeof w=="boolean")&&(w=sn()),F(l,p.normalize)&&F(l,p.arrays)&&(Array.isArray(d)?w=d.map(h=>ve.normalize(h)):w=ve.normalize(d)),w}function S(l,d){return!c["parse-positional-numbers"]&&l==="_"||!F(l,p.strings)&&!F(l,p.bools)&&!Array.isArray(d)&&(Mt(d)&&c["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${d}`)))||!xe(d)&&F(l,p.numbers))&&(d=Number(d)),d}function D(l){let d=Object.create(null);J(d,p.aliases,b),Object.keys(p.configs).forEach(function(x){let w=l[x]||d[x];if(w)try{let h=null,P=ve.resolve(ve.cwd(),w),A=p.configs[x];if(typeof A=="function"){try{h=A(P)}catch(v){h=v}if(h instanceof Error){B=h;return}}else h=ve.require(P);k(h)}catch(h){h.name==="PermissionDenied"?B=h:l[x]&&(B=Error(O("Invalid JSON config file: %s",w)))}})}function k(l,d){Object.keys(l).forEach(function(x){let w=l[x],h=d?d+"."+x:x;typeof w=="object"&&w!==null&&!Array.isArray(w)&&c["dot-notation"]?k(w,h):(!Me(Y,h.split("."))||F(h,p.arrays)&&c["combine-arrays"])&&G(h,w)})}function ie(){typeof y<"u"&&y.forEach(function(l){k(l)})}function z(l,d){if(typeof m>"u")return;let x=typeof m=="string"?m:"",w=ve.env();Object.keys(w).forEach(function(h){if(x===""||h.lastIndexOf(x,0)===0){let P=h.split("__").map(function(A,v){return v===0&&(A=A.substring(x.length)),ke(A)});(d&&p.configs[P.join(".")]||!d)&&!Me(l,P)&&G(P.join("."),w[h])}})}function se(l){let d,x=new Set;Object.keys(l).forEach(function(w){if(!x.has(w)&&(d=F(w,p.coercions),typeof d=="function"))try{let h=S(w,d(l[w]));[].concat(p.aliases[w]||[],w).forEach(P=>{x.add(P),l[P]=h})}catch(h){B=h}})}function Be(l){return p.keys.forEach(d=>{~d.indexOf(".")||typeof l[d]>"u"&&(l[d]=void 0)}),l}function J(l,d,x,w=!1){Object.keys(x).forEach(function(h){Me(l,h.split("."))||(Ie(l,h.split("."),x[h]),w&&(C[h]=!0),(d[h]||[]).forEach(function(P){Me(l,P.split("."))||Ie(l,P.split("."),x[h])}))})}function Me(l,d){let x=l;c["dot-notation"]||(d=[d.join(".")]),d.slice(0,-1).forEach(function(h){x=x[h]||{}});let w=d[d.length-1];return typeof x!="object"?!1:w in x}function Ie(l,d,x){let w=l;c["dot-notation"]||(d=[d.join(".")]),d.slice(0,-1).forEach(function(re){re=ri(re),typeof w=="object"&&w[re]===void 0&&(w[re]={}),typeof w[re]!="object"||Array.isArray(w[re])?(Array.isArray(w[re])?w[re].push({}):w[re]=[w[re],{}],w=w[re][w[re].length-1]):w=w[re]});let h=ri(d[d.length-1]),P=F(d.join("."),p.arrays),A=Array.isArray(x),v=c["duplicate-arguments-array"];!v&&F(h,p.nargs)&&(v=!0,(!xe(w[h])&&p.nargs[h]===1||Array.isArray(w[h])&&w[h].length===p.nargs[h])&&(w[h]=void 0)),x===sn()?w[h]=sn(w[h]):Array.isArray(w[h])?v&&P&&A?w[h]=c["flatten-duplicate-arrays"]?w[h].concat(x):(Array.isArray(w[h][0])?w[h]:[w[h]]).concat([x]):!v&&!!P==!!A?w[h]=x:w[h]=w[h].concat([x]):w[h]===void 0&&P?w[h]=A?x:[x]:v&&!(w[h]===void 0||F(h,p.counts)||F(h,p.bools))?w[h]=[w[h],x]:w[h]=x}function ze(...l){l.forEach(function(d){Object.keys(d||{}).forEach(function(x){p.aliases[x]||(p.aliases[x]=[].concat(o[x]||[]),p.aliases[x].concat(x).forEach(function(w){if(/-/.test(w)&&c["camel-case-expansion"]){let h=ke(w);h!==x&&p.aliases[x].indexOf(h)===-1&&(p.aliases[x].push(h),g[h]=!0)}}),p.aliases[x].concat(x).forEach(function(w){if(w.length>1&&/[A-Z]/.test(w)&&c["camel-case-expansion"]){let h=Pt(w,"-");h!==x&&p.aliases[x].indexOf(h)===-1&&(p.aliases[x].push(h),g[h]=!0)}}),p.aliases[x].forEach(function(w){p.aliases[w]=[x].concat(p.aliases[x].filter(function(h){return w!==h}))}))})})}function F(l,d){let x=[].concat(p.aliases[l]||[],l),w=Object.keys(d),h=x.find(P=>w.includes(P));return h?d[h]:!1}function Kt(l){let d=Object.keys(p);return[].concat(d.map(w=>p[w])).some(function(w){return Array.isArray(w)?w.includes(l):w[l]})}function $(l,...d){return[].concat(...d).some(function(w){let h=l.match(w);return h&&Kt(h[1])})}function K(l){if(l.match(R)||!l.match(/^-[^-]+/))return!1;let d=!0,x,w=l.slice(1).split("");for(let h=0;h<w.length;h++){if(x=l.slice(h+2),!Kt(w[h])){d=!1;break}if(w[h+1]&&w[h+1]==="="||x==="-"||/[A-Za-z]/.test(w[h])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(x)||w[h+1]&&w[h+1].match(/\W/))break}return d}function Q(l){return c["unknown-options-as-args"]&&U(l)}function U(l){return l=l.replace(/^-{3,}/,"--"),l.match(R)||K(l)?!1:!$(l,/^-+([^=]+?)=[\s\S]*$/,W,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function Z(l){return!F(l,p.bools)&&!F(l,p.counts)&&`${l}`in b?b[l]:te(Ce(l))}function te(l){return{[me.BOOLEAN]:!0,[me.STRING]:"",[me.NUMBER]:void 0,[me.ARRAY]:[]}[l]}function Ce(l){let d=me.BOOLEAN;return F(l,p.strings)?d=me.STRING:F(l,p.numbers)?d=me.NUMBER:F(l,p.bools)?d=me.BOOLEAN:F(l,p.arrays)&&(d=me.ARRAY),d}function xe(l){return l===void 0}function xt(){Object.keys(p.counts).find(l=>F(l,p.arrays)?(B=Error(O("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):F(l,p.nargs)?(B=Error(O("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},p.aliases),argv:Object.assign($e,Y),configuration:c,defaulted:Object.assign({},C),error:B,newAliases:Object.assign({},g)}}};function Qs(i){let e=[],t=Object.create(null),n=!0;for(Object.keys(i).forEach(function(s){e.push([].concat(i[s],s))});n;){n=!1;for(let s=0;s<e.length;s++)for(let r=s+1;r<e.length;r++)if(e[s].filter(function(c){return e[r].indexOf(c)!==-1}).length){e[s]=e[s].concat(e[r]),e.splice(r,1),n=!0;break}}return e.forEach(function(s){s=s.filter(function(o,c,b){return b.indexOf(o)===c});let r=s.pop();r!==void 0&&typeof r=="string"&&(t[r]=s)}),t}function sn(i){return i!==void 0?i+1:1}function ri(i){return i==="__proto__"?"___proto___":i}function Zs(i){return typeof i=="string"&&(i[0]==="'"||i[0]==='"')&&i[i.length-1]===i[0]?i.substring(1,i.length-1):i}import{readFileSync as nr}from"fs";var rn,on,an,oi=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,ai=(on=(rn=process==null?void 0:process.versions)===null||rn===void 0?void 0:rn.node)!==null&&on!==void 0?on:(an=process==null?void 0:process.version)===null||an===void 0?void 0:an.slice(1);if(ai&&Number(ai.match(/^([^.]+)/)[1])<oi)throw Error(`yargs parser supports a minimum Node.js version of ${oi}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var ir=process?process.env:{},ci=new It({cwd:process.cwd,env:()=>ir,format:Xs,normalize:er,resolve:tr,require:i=>{if(typeof je<"u")return je(i);if(i.match(/\.json$/))return JSON.parse(nr(i,"utf8"));throw Error("only .json config files are supported in ESM")}}),mt=function(e,t){return ci.parse(e.slice(),t).argv};mt.detailed=function(i,e){return ci.parse(i.slice(),e)};mt.camelCase=ke;mt.decamelize=Pt;mt.looksLikeNumber=Mt;var cn=mt;import{basename as br,dirname as yr,extname as wr,relative as Or,resolve as pi}from"path";function li(){return sr()?0:1}function sr(){return rr()&&!process.defaultApp}function rr(){return!!process.versions.electron}function ln(i){return i.slice(li()+1)}function fi(){return process.argv[li()]}var H=class i extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,i)}};import{readFileSync as or,statSync as ar,writeFile as cr}from"fs";import{format as lr}from"util";import{resolve as fr}from"path";var ui={fs:{readFileSync:or,writeFile:cr},format:lr,resolve:fr,exists:i=>{try{return ar(i).isFile()}catch{return!1}}};var Ae,fn=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let t=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]=t,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Ae.format.apply(Ae.format,[this.cache[this.locale][t]||t].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),s=e.shift(),r=function(){};typeof e[e.length-1]=="function"&&(r=e.pop()),this.cache[this.locale]||this._readLocaleFile();let o=s===1?t:n;this.cache[this.locale][t]&&(o=this.cache[this.locale][t][s===1?"one":"other"]),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]={one:t,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r();let c=[o];return~o.indexOf("%d")&&c.push(s),Ae.format.apply(Ae.format,c.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.cache[this.locale][t]=e[t])}_taggedLiteral(e,...t){let n="";return e.forEach(function(s,r){let o=t[r+1];n+=s,typeof o<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(t,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,t=this.writeQueue[0],n=t.directory,s=t.locale,r=t.cb,o=this._resolveLocaleFile(n,s),c=JSON.stringify(this.cache[s],null,2);Ae.fs.writeFile(o,c,"utf-8",function(b){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),r(b)})}_readLocaleFile(){let e={},t=this._resolveLocaleFile(this.directory,this.locale);try{Ae.fs.readFileSync&&(e=JSON.parse(Ae.fs.readFileSync(t,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+t),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,t){let n=Ae.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){let s=Ae.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(e){return Ae.exists(e)}};function hi(i,e){Ae=e;let t=new fn(i);return{__:t.__.bind(t),__n:t.__n.bind(t),setLocale:t.setLocale.bind(t),getLocale:t.getLocale.bind(t),updateLocale:t.updateLocale.bind(t),locale:t.locale}}var ur=i=>hi(i,ui),di=ur;var Cr="require is not supported by ESM",mi="loading a directory of commands is not supported yet for ESM",gt;try{gt=gr(import.meta.url)}catch{gt=process.cwd()}var xr=gt.substring(0,gt.lastIndexOf("node_modules")),un={assert:{notStrictEqual:hr,strictEqual:dr},cliui:nn,findUp:ii,getEnv:i=>process.env[i],inspect:pr,getCallerFile:()=>{throw new H(mi)},getProcessArgvBin:fi,mainFilename:xr||process.cwd(),Parser:cn,path:{basename:br,dirname:yr,extname:wr,relative:Or,resolve:pi},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(i,e)=>process.emitWarning(i,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:mr,require:()=>{throw new H(Cr)},requireDirectory:()=>{throw new H(mi)},stringWidth:i=>[...i].length,y18n:di({directory:pi(gt,"../../../locales"),updateFiles:!1})};function ce(i,e,t,n){t.assert.notStrictEqual(i,e,n)}function hn(i,e){e.assert.strictEqual(typeof i,"string")}function ot(i){return Object.keys(i)}function V(i){return!!i&&!!i.then&&typeof i.then=="function"}function Ne(i){let t=i.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=t.shift();if(!s)throw new Error(`No command found in: ${i}`);let r={cmd:s.replace(n,""),demanded:[],optional:[]};return t.forEach((o,c)=>{let b=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&c===t.length-1&&(b=!0),/^\[/.test(o)?r.optional.push({cmd:o.replace(n,"").split("|"),variadic:b}):r.demanded.push({cmd:o.replace(n,"").split("|"),variadic:b})}),r}var _r=["first","second","third","fourth","fifth","sixth"];function E(i,e,t){function n(){return typeof i=="object"?[{demanded:[],optional:[]},i,e]:[Ne(`cmd ${i}`),e,t]}try{let s=0,[r,o,c]=n(),b=[].slice.call(o);for(;b.length&&b[b.length-1]===void 0;)b.pop();let y=c||b.length;if(y<r.demanded.length)throw new H(`Not enough arguments provided. Expected ${r.demanded.length} but received ${b.length}.`);let m=r.demanded.length+r.optional.length;if(y>m)throw new H(`Too many arguments provided. Expected max ${m} but received ${y}.`);r.demanded.forEach(f=>{let u=b.shift(),g=gi(u);f.cmd.filter(O=>O===g||O==="*").length===0&&bi(g,f.cmd,s),s+=1}),r.optional.forEach(f=>{if(b.length===0)return;let u=b.shift(),g=gi(u);f.cmd.filter(O=>O===g||O==="*").length===0&&bi(g,f.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function gi(i){return Array.isArray(i)?"array":i===null?"null":typeof i}function bi(i,e,t){throw new H(`Invalid ${_r[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${i}.`)}var vt=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,s=!1){if(E("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let r=0;r<e.length;r++){if(typeof e[r]!="function")throw Error("middleware must be a function");let o=e[r];o.applyBeforeValidation=t,o.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){let r=e;r.applyBeforeValidation=t,r.global=n,r.mutates=s,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(s=>{let r=[...n[t]||[],t];return s.option?!r.includes(s.option):!0}),e.option=t,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function yi(i){return i?i.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Ye(i,e,t,n){return t.reduce((s,r)=>{if(r.applyBeforeValidation!==n)return s;if(r.mutates){if(r.applied)return s;r.applied=!0}if(V(s))return s.then(o=>Promise.all([o,r(o,e)])).then(([o,c])=>Object.assign(o,c));{let o=r(s,e);return V(o)?o.then(c=>Object.assign(s,c)):Object.assign(s,o)}},i)}function Ge(i,e,t=n=>{throw n}){try{let n=Ar(i)?i():i;return V(n)?n.then(s=>e(s)):e(n)}catch(n){return t(n)}}function Ar(i){return typeof i=="function"}function dn(i){if(typeof je>"u")return null;for(let e=0,t=Object.keys(je.cache),n;e<t.length;e++)if(n=je.cache[t[e]],n.exports===i)return n;return null}var at=/(^\*)|(^\$0)/,pn=class{constructor(e,t,n,s){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=s,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,s){s=s||{},typeof s.recurse!="boolean"&&(s.recurse=!1),Array.isArray(s.extensions)||(s.extensions=["js"]);let r=typeof s.visit=="function"?s.visit:o=>o;s.visit=(o,c,b)=>{let y=r(o,c,b);if(y){if(this.requireCache.has(c))return y;this.requireCache.add(c),this.addHandler(y)}return y},this.shim.requireDirectory({require:t,filename:n},e,s)}addHandler(e,t,n,s,r,o){let c=[],b=yi(r);if(s=s||(()=>{}),Array.isArray(e))if(Er(e))[e,...c]=e;else for(let y of e)this.addHandler(y);else if(Sr(e)){let y=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(y=[].concat(y).concat(e.aliases)),this.addHandler(y,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(wi(n)){this.addHandler([e].concat(c),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){let y=Ne(e);c=c.map(u=>Ne(u).cmd);let m=!1,f=[y.cmd].concat(c).filter(u=>at.test(u)?(m=!0,!1):!0);f.length===0&&m&&f.push("$0"),m&&(y.cmd=f[0],c=f.slice(1),e=e.replace(at,y.cmd)),c.forEach(u=>{this.aliasMap[u]=y.cmd}),t!==!1&&this.usage.command(e,t,m,c,o),this.handlers[y.cmd]={original:e,description:t,handler:s,builder:n||{},middlewares:b,deprecated:o,demanded:y.demanded,optional:y.optional},m&&(this.defaultCommand=this.handlers[y.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,s,r,o){let c=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,b=t.getInternalMethods().getContext(),y=b.commands.slice(),m=!e;e&&(b.commands.push(e),b.fullCommands.push(c.original));let f=this.applyBuilderUpdateUsageAndParse(m,c,t,n.aliases,y,s,r,o);return V(f)?f.then(u=>this.applyMiddlewareAndGetResult(m,c,u.innerArgv,b,r,u.aliases,t)):this.applyMiddlewareAndGetResult(m,c,f.innerArgv,b,r,f.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,s,r,o,c,b){let y=t.builder,m=n;if($t(y)){n.getInternalMethods().getUsageInstance().freeze();let f=y(n.getInternalMethods().reset(s),b);if(V(f))return f.then(u=>(m=Ci(u)?u:n,this.parseAndUpdateUsage(e,t,m,r,o,c)))}else jr(y)&&(n.getInternalMethods().getUsageInstance().freeze(),m=n.getInternalMethods().reset(s),Object.keys(t.builder).forEach(f=>{m.option(f,y[f])}));return this.parseAndUpdateUsage(e,t,m,r,o,c)}parseAndUpdateUsage(e,t,n,s,r,o){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(s,t),t.description);let c=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,r,o);return V(c)?c.then(b=>({aliases:n.parsed.aliases,innerArgv:b})):{aliases:n.parsed.aliases,innerArgv:c}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){let n=at.test(t.original)?t.original.replace(at,"").trim():t.original,s=e.filter(r=>!at.test(r));return s.push(n),`$0 ${s.join(" ")}`}handleValidationAndGetResult(e,t,n,s,r,o,c,b){if(!o.getInternalMethods().getHasOutput()){let y=o.getInternalMethods().runValidation(r,b,o.parsed.error,e);n=Ge(n,m=>(y(m),m))}if(t.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();let y=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(n,y,!1,!1),n=Ye(n,o,c,!1),n=Ge(n,m=>{let f=t.handler(m);return V(f)?f.then(()=>m):m}),e||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),V(n)&&!o.getInternalMethods().hasParseCallback()&&n.catch(m=>{try{o.getInternalMethods().getUsageInstance().fail(null,m)}catch{}})}return e||(s.commands.pop(),s.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,s,r,o,c){let b={};if(r)return n;c.getInternalMethods().getHasOutput()||(b=this.populatePositionals(t,n,s,c));let y=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),m=Ye(n,c,y,!0);return V(m)?m.then(f=>this.handleValidationAndGetResult(e,t,f,s,o,c,y,b)):this.handleValidationAndGetResult(e,t,m,s,o,c,y,b)}populatePositionals(e,t,n,s){t._=t._.slice(n.commands.length);let r=e.demanded.slice(0),o=e.optional.slice(0),c={};for(this.validation.positionalCount(r.length,t._.length);r.length;){let b=r.shift();this.populatePositional(b,t,c)}for(;o.length;){let b=o.shift();this.populatePositional(b,t,c)}return t._=n.commands.concat(t._.map(b=>""+b)),this.postProcessPositionals(t,c,this.cmdToParseOptions(e.original),s),c}populatePositional(e,t,n){let s=e.cmd[0];e.variadic?n[s]=t._.splice(0).map(String):t._.length&&(n[s]=[String(t._.shift())])}cmdToParseOptions(e){let t={array:[],default:{},alias:{},demand:{}},n=Ne(e);return n.demanded.forEach(s=>{let[r,...o]=s.cmd;s.variadic&&(t.array.push(r),t.default[r]=[]),t.alias[r]=o,t.demand[r]=!0}),n.optional.forEach(s=>{let[r,...o]=s.cmd;s.variadic&&(t.array.push(r),t.default[r]=[]),t.alias[r]=o}),t}postProcessPositionals(e,t,n,s){let r=Object.assign({},s.getOptions());r.default=Object.assign(n.default,r.default);for(let y of Object.keys(n.alias))r.alias[y]=(r.alias[y]||[]).concat(n.alias[y]);r.array=r.array.concat(n.array),r.config={};let o=[];if(Object.keys(t).forEach(y=>{t[y].map(m=>{r.configuration["unknown-options-as-args"]&&(r.key[y]=!0),o.push(`--${y}`),o.push(m)})}),!o.length)return;let c=Object.assign({},r.configuration,{"populate--":!1}),b=this.shim.Parser.detailed(o,Object.assign({},r,{configuration:c}));if(b.error)s.getInternalMethods().getUsageInstance().fail(b.error.message,b.error);else{let y=Object.keys(t);Object.keys(t).forEach(m=>{y.push(...b.aliases[m])}),Object.keys(b.argv).forEach(m=>{y.includes(m)&&(t[m]||(t[m]=b.argv[m]),!this.isInConfigs(s,m)&&!this.isDefaulted(s,m)&&Object.prototype.hasOwnProperty.call(e,m)&&Object.prototype.hasOwnProperty.call(b.argv,m)&&(Array.isArray(e[m])||Array.isArray(b.argv[m]))?e[m]=[].concat(e[m],b.argv[m]):e[m]=b.argv[m])})}}isDefaulted(e,t){let{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){let{configObjects:n}=e.getOptions();return n.some(s=>Object.prototype.hasOwnProperty.call(s,t))||n.some(s=>Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=at.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let t=this.defaultCommand.builder;if($t(t))return t(e,!0);wi(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){let t=dn(e);if(!t)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(t.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:t,desc:n}){for(let s of[e,t,n]){if(typeof s=="string"||s===!1)return s;ce(s,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();ce(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function Oi(i,e,t,n){return new pn(i,e,t,n)}function wi(i){return typeof i=="object"&&!!i.builder&&typeof i.handler=="function"}function Er(i){return i.every(e=>typeof e=="string")}function $t(i){return typeof i=="function"}function jr(i){return typeof i=="object"}function Sr(i){return typeof i=="object"&&!Array.isArray(i)}function Re(i={},e=()=>!0){let t={};return ot(i).forEach(n=>{e(n,i[n])&&(t[n]=i[n])}),t}function Te(i){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let t=e;t._handle&&t.isTTY&&typeof t._handle.setBlocking=="function"&&t._handle.setBlocking(i)})}function Pr(i){return typeof i=="boolean"}function _i(i,e){let t=e.y18n.__,n={},s=[];n.failFn=function(_){s.push(_)};let r=null,o=null,c=!0;n.showHelpOnFail=function(_=!0,S){let[D,k]=typeof _=="string"?[!0,_]:[_,S];return i.getInternalMethods().isGlobalContext()&&(o=k),r=k,c=D,n};let b=!1;n.fail=function(_,S){let D=i.getInternalMethods().getLoggerInstance();if(s.length)for(let k=s.length-1;k>=0;--k){let ie=s[k];if(Pr(ie)){if(S)throw S;if(_)throw Error(_)}else ie(_,S,n)}else{if(i.getExitProcess()&&Te(!0),!b){b=!0,c&&(i.showHelp("error"),D.error()),(_||S)&&D.error(_||S);let k=r||o;k&&((_||S)&&D.error(""),D.error(k))}if(S=S||new H(_),i.getExitProcess())return i.exit(1);if(i.getInternalMethods().hasParseCallback())return i.exit(1,S);throw S}};let y=[],m=!1;n.usage=(M,_)=>M===null?(m=!0,y=[],n):(m=!1,y.push([M,_||""]),n),n.getUsage=()=>y,n.getUsageDisabled=()=>m,n.getPositionalGroupName=()=>t("Positionals:");let f=[];n.example=(M,_)=>{f.push([M,_||""])};let u=[];n.command=function(_,S,D,k,ie=!1){D&&(u=u.map(z=>(z[2]=!1,z))),u.push([_,S||"",D,k,ie])},n.getCommands=()=>u;let g={};n.describe=function(_,S){Array.isArray(_)?_.forEach(D=>{n.describe(D,S)}):typeof _=="object"?Object.keys(_).forEach(D=>{n.describe(D,_[D])}):g[_]=S},n.getDescriptions=()=>g;let C=[];n.epilog=M=>{C.push(M)};let O=!1,p;n.wrap=M=>{O=!0,p=M},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(O||(p=it(),O=!0),p);let R="__yargsString__:";n.deferY18nLookup=M=>R+M,n.help=function(){if(L)return L;B();let _=i.customScriptName?i.$0:e.path.basename(i.$0),S=i.getDemandedOptions(),D=i.getDemandedCommands(),k=i.getDeprecatedOptions(),ie=i.getGroups(),z=i.getOptions(),se=[];se=se.concat(Object.keys(g)),se=se.concat(Object.keys(S)),se=se.concat(Object.keys(D)),se=se.concat(Object.keys(z.default)),se=se.filter($e),se=Object.keys(se.reduce(($,K)=>(K!=="_"&&($[K]=!0),$),{}));let Be=n.getWrap(),J=e.cliui({width:Be,wrap:!!Be});if(!m){if(y.length)y.forEach($=>{J.div({text:`${$[0].replace(/\$0/g,_)}`}),$[1]&&J.div({text:`${$[1]}`,padding:[1,0,0,0]})}),J.div();else if(u.length){let $=null;D._?$=`${_} <${t("command")}>
`:$=`${_} [${t("command")}]
`,J.div(`${$}`)}}if(u.length>1||u.length===1&&!u[0][2]){J.div(t("Commands:"));let $=i.getInternalMethods().getContext(),K=$.commands.length?`${$.commands.join(" ")} `:"";i.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(u=u.sort((U,Z)=>U[0].localeCompare(Z[0])));let Q=_?`${_} `:"";u.forEach(U=>{let Z=`${Q}${K}${U[0].replace(/^\$0 ?/,"")}`;J.span({text:Z,padding:[0,2,0,2],width:W(u,Be,`${_}${K}`)+4},{text:U[1]});let te=[];U[2]&&te.push(`[${t("default")}]`),U[3]&&U[3].length&&te.push(`[${t("aliases:")} ${U[3].join(", ")}]`),U[4]&&(typeof U[4]=="string"?te.push(`[${t("deprecated: %s",U[4])}]`):te.push(`[${t("deprecated")}]`)),te.length?J.div({text:te.join(" "),padding:[0,0,0,2],align:"right"}):J.div()}),J.div()}let Me=(Object.keys(z.alias)||[]).concat(Object.keys(i.parsed.newAliases)||[]);se=se.filter($=>!i.parsed.newAliases[$]&&Me.every(K=>(z.alias[K]||[]).indexOf($)===-1));let Ie=t("Options:");ie[Ie]||(ie[Ie]=[]),Y(se,z.alias,ie,Ie);let ze=$=>/^--/.test(Ft($)),F=Object.keys(ie).filter($=>ie[$].length>0).map($=>{let K=ie[$].filter($e).map(Q=>{if(Me.includes(Q))return Q;for(let U=0,Z;(Z=Me[U])!==void 0;U++)if((z.alias[Z]||[]).includes(Q))return Z;return Q});return{groupName:$,normalizedKeys:K}}).filter(({normalizedKeys:$})=>$.length>0).map(({groupName:$,normalizedKeys:K})=>{let Q=K.reduce((U,Z)=>(U[Z]=[Z].concat(z.alias[Z]||[]).map(te=>$===n.getPositionalGroupName()?te:(/^[0-9]$/.test(te)?z.boolean.includes(Z)?"-":"--":te.length>1?"--":"-")+te).sort((te,Ce)=>ze(te)===ze(Ce)?0:ze(te)?1:-1).join(", "),U),{});return{groupName:$,normalizedKeys:K,switches:Q}});if(F.filter(({groupName:$})=>$!==n.getPositionalGroupName()).some(({normalizedKeys:$,switches:K})=>!$.every(Q=>ze(K[Q])))&&F.filter(({groupName:$})=>$!==n.getPositionalGroupName()).forEach(({normalizedKeys:$,switches:K})=>{$.forEach(Q=>{ze(K[Q])&&(K[Q]=Mr(K[Q],4))})}),F.forEach(({groupName:$,normalizedKeys:K,switches:Q})=>{J.div($),K.forEach(U=>{let Z=Q[U],te=g[U]||"",Ce=null;t