likec4 1.19.1 → 1.19.2

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,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- "use strict";const LikeC4=require("../shared/likec4.CfqfZIn-.cjs");require("node:util");const path$1=require("node:path"),process$1=require("node:process");require("node:tty");const assert=require("assert"),require$$0=require("path"),require$$0$1=require("fs"),require$$0$2=require("util"),require$$0$3=require("url"),fs=require("node:fs"),fsPromises=require("node:fs/promises"),os=require("node:os"),node_url=require("node:url"),c$1=require("@vitejs/plugin-react-swc"),index_DafVOuVd=require("../shared/likec4.D81G5JV4.cjs"),vite=require("vite"),playwright=require("playwright"),net=require("node:net"),promises=require("node:timers/promises");require("tty"),require("os"),require("crypto"),require("net"),require("child_process"),require("@hpcc-js/wasm-graphviz"),require("buffer"),require("node:child_process"),require("node:string_decoder"),require("node:events"),require("node:v8"),require("node:stream"),require("node:buffer"),require("node:stream/promises");var _documentCurrentScript=typeof document<"u"?document.currentScript:null;function _interopDefaultCompat(s){return s&&typeof s=="object"&&"default"in s?s.default:s}const path__default=_interopDefaultCompat(path$1),process__default=_interopDefaultCompat(process$1),fs__default=_interopDefaultCompat(fs),os__default=_interopDefaultCompat(os),c__default=_interopDefaultCompat(c$1),net__default=_interopDefaultCompat(net),i=!1,align={right:alignRight,center:alignCenter},top=0,right=1,bottom=2,left=3;class UI{constructor(e){var t;this.width=e.width,this.wrap=(t=e.wrap)!==null&&t!==void 0?t:!0,this.rows=[]}span(...e){const 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]);const 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){const t=e.split(`
2
+ "use strict";const LikeC4=require("../shared/likec4.-U9_Dinu.cjs");require("node:util");const path$1=require("node:path"),process$1=require("node:process");require("node:tty");const assert=require("assert"),require$$0=require("path"),require$$0$1=require("fs"),require$$0$2=require("util"),require$$0$3=require("url"),fs=require("node:fs"),fsPromises=require("node:fs/promises"),os=require("node:os"),node_url=require("node:url"),c$1=require("@vitejs/plugin-react-swc"),index_KOeaSlL8=require("../shared/likec4.CVn8U3Og.cjs"),vite=require("vite"),playwright=require("playwright"),net=require("node:net"),promises=require("node:timers/promises");require("tty"),require("os"),require("crypto"),require("net"),require("child_process"),require("@hpcc-js/wasm-graphviz"),require("buffer"),require("node:child_process"),require("node:string_decoder"),require("node:events"),require("node:v8"),require("node:stream"),require("node:buffer"),require("node:stream/promises");var _documentCurrentScript=typeof document<"u"?document.currentScript:null;function _interopDefaultCompat(s){return s&&typeof s=="object"&&"default"in s?s.default:s}const path__default=_interopDefaultCompat(path$1),process__default=_interopDefaultCompat(process$1),fs__default=_interopDefaultCompat(fs),os__default=_interopDefaultCompat(os),c__default=_interopDefaultCompat(c$1),net__default=_interopDefaultCompat(net),i=!1,align={right:alignRight,center:alignCenter},top=0,right=1,bottom=2,left=3;class UI{constructor(e){var t;this.width=e.width,this.wrap=(t=e.wrap)!==null&&t!==void 0?t:!0,this.rows=[]}span(...e){const 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]);const 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){const t=e.split(`
3
3
  `).map(o=>o.split(" "));let n=0;return t.forEach(o=>{o.length>1&&mixin$1.stringWidth(o[0])>n&&(n=Math.min(Math.floor(this.width*.5),mixin$1.stringWidth(o[0])))}),t.forEach(o=>{this.div(...o.map((a,l)=>({text:a.trim(),padding:this.measurePadding(a),width:l===0&&o.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){const t=mixin$1.stripAnsi(e);return[0,t.match(/\s*$/)[0].length,0,t.match(/^\s*/)[0].length]}toString(){const e=[];return this.rows.forEach(t=>{this.rowToString(t,e)}),e.filter(t=>!t.hidden).map(t=>t.text).join(`
4
4
  `)}rowToString(e,t){return this.rasterize(e).forEach((n,o)=>{let a="";n.forEach((l,d)=>{const{width:w}=e[d],L=this.negatePadding(e[d]);let y=l;if(L>mixin$1.stringWidth(l)&&(y+=" ".repeat(L-mixin$1.stringWidth(l))),e[d].align&&e[d].align!=="left"&&this.wrap){const N=align[e[d].align];y=N(y,L),mixin$1.stringWidth(y)<L&&(y+=" ".repeat((w||0)-mixin$1.stringWidth(y)-1))}const B=e[d].padding||[0,0,0,0];B[left]&&(a+=" ".repeat(B[left])),a+=addBorder(e[d],y,"| "),a+=y,a+=addBorder(e[d],y," |"),B[right]&&(a+=" ".repeat(B[right])),o===0&&t.length>0&&(a=this.renderInline(a,t[t.length-1]))}),t.push({text:a.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){const n=e.match(/^ */),o=n?n[0].length:0,a=t.text,l=mixin$1.stringWidth(a.trimRight());return t.span?this.wrap?o<l?e:(t.hidden=!0,a.trimRight()+" ".repeat(o-l)+e.trimLeft()):(t.hidden=!0,a+e):e}rasterize(e){const t=[],n=this.columnWidths(e);let o;return e.forEach((a,l)=>{a.width=n[l],this.wrap?o=mixin$1.wrap(a.text,this.negatePadding(a),{hard:!0}).split(`
5
5
  `):o=a.text.split(`
6
6
  `),a.border&&(o.unshift("."+"-".repeat(this.negatePadding(a)+2)+"."),o.push("'"+"-".repeat(this.negatePadding(a)+2)+"'")),a.padding&&(o.unshift(...new Array(a.padding[top]||0).fill("")),o.push(...new Array(a.padding[bottom]||0).fill(""))),o.forEach((d,w)=>{t[w]||t.push([]);const L=t[w];for(let y=0;y<l;y++)L[y]===void 0&&L.push("");L.push(d)})}),t}negatePadding(e){let t=e.width||0;return e.padding&&(t-=(e.padding[left]||0)+(e.padding[right]||0)),e.border&&(t-=4),t}columnWidths(e){if(!this.wrap)return e.map(l=>l.width||mixin$1.stringWidth(l.text));let t=e.length,n=this.width;const o=e.map(l=>{if(l.width)return t--,n-=l.width,l.width}),a=t?Math.floor(n/t):0;return o.map((l,d)=>l===void 0?Math.max(a,_minWidth(e[d])):l)}}function addBorder(s,e,t){return s.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function _minWidth(s){const e=s.padding||[],t=1+(e[left]||0)+(e[right]||0);return s.border?t+4:t}function getWindowWidth(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function alignRight(s,e){s=s.trim();const t=mixin$1.stringWidth(s);return t<e?" ".repeat(e-t)+s:s}function alignCenter(s,e){s=s.trim();const t=mixin$1.stringWidth(s);return t>=e?s:" ".repeat(e-t>>1)+s}let mixin$1;function cliui(s,e){return mixin$1=e,new UI({width:s?.width||getWindowWidth(),wrap:s?.wrap})}const ansi=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function stripAnsi(s){return s.replace(ansi,"")}function wrap(s,e){const[t,n]=s.match(ansi)||["",""];s=stripAnsi(s);let o="";for(let a=0;a<s.length;a++)a!==0&&a%e===0&&(o+=`
7
- `),o+=s.charAt(a);return t&&n&&(o=`${t}${o}${n}`),o}function ui(s){return cliui(s,{stringWidth:e=>[...e].length,stripAnsi,wrap})}function escalade(s,e){let t=require$$0.resolve(".",s),n;for(require$$0$1.statSync(t).isDirectory()||(t=require$$0.dirname(t));;){if(n=e(t,require$$0$1.readdirSync(t)),n)return require$$0.resolve(t,n);if(t=require$$0.dirname(n=t),n===t)break}}function camelCase(s){if(s!==s.toLowerCase()&&s!==s.toUpperCase()||(s=s.toLowerCase()),s.indexOf("-")===-1&&s.indexOf("_")===-1)return s;{let t="",n=!1;const o=s.match(/^-+/);for(let a=o?o[0].length:0;a<s.length;a++){let l=s.charAt(a);n&&(n=!1,l=l.toUpperCase()),a!==0&&(l==="-"||l==="_")?n=!0:l!=="-"&&l!=="_"&&(t+=l)}return t}}function decamelize(s,e){const t=s.toLowerCase();e=e||"-";let n="";for(let o=0;o<s.length;o++){const a=t.charAt(o),l=s.charAt(o);a!==l&&o>0?n+=`${e}${t.charAt(o)}`:n+=l}return n}function looksLikeNumber(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 tokenizeArgString(s){if(Array.isArray(s))return s.map(l=>typeof l!="string"?l+"":l);s=s.trim();let e=0,t=null,n=null,o=null;const a=[];for(let l=0;l<s.length;l++){if(t=n,n=s.charAt(l),n===" "&&!o){t!==" "&&e++;continue}n===o?o=null:(n==="'"||n==='"')&&!o&&(o=n),a[e]||(a[e]=""),a[e]+=n}return a}var DefaultValuesForTypeKey;(function(s){s.BOOLEAN="boolean",s.STRING="string",s.NUMBER="number",s.ARRAY="array"})(DefaultValuesForTypeKey||(DefaultValuesForTypeKey={}));let mixin;class YargsParser{constructor(e){mixin=e}parse(e,t){const 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),o=tokenizeArgString(e),a=typeof e=="string",l=combineAliases(Object.assign(Object.create(null),n.alias)),d=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),w=Object.assign(Object.create(null),n.default),L=n.configObjects||[],y=n.envPrefix,B=d["populate--"],N=B?"--":"_",z=Object.create(null),Q=Object.create(null),H=n.__||mixin.format,T={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:[]},X=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,ne=new RegExp("^--"+d["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(_){const W=typeof _=="object"?_.key:_,Z=Object.keys(_).map(function(K){return{boolean:"bools",string:"strings",number:"numbers"}[K]}).filter(Boolean).pop();Z&&(T[Z][W]=!0),T.arrays[W]=!0,T.keys.push(W)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(_){T.bools[_]=!0,T.keys.push(_)}),[].concat(n.string||[]).filter(Boolean).forEach(function(_){T.strings[_]=!0,T.keys.push(_)}),[].concat(n.number||[]).filter(Boolean).forEach(function(_){T.numbers[_]=!0,T.keys.push(_)}),[].concat(n.count||[]).filter(Boolean).forEach(function(_){T.counts[_]=!0,T.keys.push(_)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(_){T.normalize[_]=!0,T.keys.push(_)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([_,W])=>{typeof W=="number"&&(T.nargs[_]=W,T.keys.push(_))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([_,W])=>{typeof W=="function"&&(T.coercions[_]=W,T.keys.push(_))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(_){T.configs[_]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([_,W])=>{(typeof W=="boolean"||typeof W=="function")&&(T.configs[_]=W)})),Le(n.key,l,n.default,T.arrays),Object.keys(w).forEach(function(_){(T.aliases[_]||[]).forEach(function(W){w[W]=w[_]})});let le=null;Ne();let oe=[];const fe=Object.assign(Object.create(null),{_:[]}),ve={};for(let _=0;_<o.length;_++){const W=o[_],Z=W.replace(/^-{3,}/,"---");let K,U,re,te,ue,ye;if(W!=="--"&&/^-/.test(W)&&we(W))_e(W);else if(Z.match(/^---+(=|$)/)){_e(W);continue}else if(W.match(/^--.+=/)||!d["short-option-groups"]&&W.match(/^-.+=/))te=W.match(/^--?([^=]+)=([\s\S]*)$/),te!==null&&Array.isArray(te)&&te.length>=3&&(ce(te[1],T.arrays)?_=$e(_,te[1],o,te[2]):ce(te[1],T.nargs)!==!1?_=Pe(_,te[1],o,te[2]):ge(te[1],te[2],!0));else if(W.match(ne)&&d["boolean-negation"])te=W.match(ne),te!==null&&Array.isArray(te)&&te.length>=2&&(U=te[1],ge(U,ce(U,T.arrays)?[!1]:!1));else if(W.match(/^--.+/)||!d["short-option-groups"]&&W.match(/^-[^-]+/))te=W.match(/^--?(.+)/),te!==null&&Array.isArray(te)&&te.length>=2&&(U=te[1],ce(U,T.arrays)?_=$e(_,U,o):ce(U,T.nargs)!==!1?_=Pe(_,U,o):(ue=o[_+1],ue!==void 0&&(!ue.match(/^-/)||ue.match(X))&&!ce(U,T.bools)&&!ce(U,T.counts)||/^(true|false)$/.test(ue)?(ge(U,ue),_++):ge(U,Ae(U))));else if(W.match(/^-.\..+=/))te=W.match(/^-([^=]+)=([\s\S]*)$/),te!==null&&Array.isArray(te)&&te.length>=3&&ge(te[1],te[2]);else if(W.match(/^-.\..+/)&&!W.match(X))ue=o[_+1],te=W.match(/^-(.\..+)/),te!==null&&Array.isArray(te)&&te.length>=2&&(U=te[1],ue!==void 0&&!ue.match(/^-/)&&!ce(U,T.bools)&&!ce(U,T.counts)?(ge(U,ue),_++):ge(U,Ae(U)));else if(W.match(/^-[^-]+/)&&!W.match(X)){re=W.slice(1,-1).split(""),K=!1;for(let Be=0;Be<re.length;Be++){if(ue=W.slice(Be+2),re[Be+1]&&re[Be+1]==="="){ye=W.slice(Be+3),U=re[Be],ce(U,T.arrays)?_=$e(_,U,o,ye):ce(U,T.nargs)!==!1?_=Pe(_,U,o,ye):ge(U,ye),K=!0;break}if(ue==="-"){ge(re[Be],ue);continue}if(/[A-Za-z]/.test(re[Be])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(ue)&&ce(ue,T.bools)===!1){ge(re[Be],ue),K=!0;break}if(re[Be+1]&&re[Be+1].match(/\W/)){ge(re[Be],ue),K=!0;break}else ge(re[Be],Ae(re[Be]))}U=W.slice(-1)[0],!K&&U!=="-"&&(ce(U,T.arrays)?_=$e(_,U,o):ce(U,T.nargs)!==!1?_=Pe(_,U,o):(ue=o[_+1],ue!==void 0&&(!/^(-|--)[^-]/.test(ue)||ue.match(X))&&!ce(U,T.bools)&&!ce(U,T.counts)||/^(true|false)$/.test(ue)?(ge(U,ue),_++):ge(U,Ae(U))))}else if(W.match(/^-[0-9]$/)&&W.match(X)&&ce(W.slice(1),T.bools))U=W.slice(1),ge(U,Ae(U));else if(W==="--"){oe=o.slice(_+1);break}else if(d["halt-at-non-option"]){oe=o.slice(_);break}else _e(W)}pe(fe,!0),pe(fe,!1),de(fe),be(),Ce(fe,T.aliases,w,!0),Fe(fe),d["set-placeholder-key"]&&je(fe),Object.keys(T.counts).forEach(function(_){xe(fe,_.split("."))||ge(_,0)}),B&&oe.length&&(fe[N]=[]),oe.forEach(function(_){fe[N].push(_)}),d["camel-case-expansion"]&&d["strip-dashed"]&&Object.keys(fe).filter(_=>_!=="--"&&_.includes("-")).forEach(_=>{delete fe[_]}),d["strip-aliased"]&&[].concat(...Object.keys(l).map(_=>l[_])).forEach(_=>{d["camel-case-expansion"]&&_.includes("-")&&delete fe[_.split(".").map(W=>camelCase(W)).join(".")],delete fe[_]});function _e(_){const W=ie("_",_);(typeof W=="string"||typeof W=="number")&&fe._.push(W)}function Pe(_,W,Z,K){let U,re=ce(W,T.nargs);if(re=typeof re!="number"||isNaN(re)?1:re,re===0)return Se(K)||(le=Error(H("Argument unexpected for: %s",W))),ge(W,Ae(W)),_;let te=Se(K)?0:1;if(d["nargs-eats-options"])Z.length-(_+1)+te<re&&(le=Error(H("Not enough arguments following: %s",W))),te=re;else{for(U=_+1;U<Z.length&&(!Z[U].match(/^-[^0-9]/)||Z[U].match(X)||we(Z[U]));U++)te++;te<re&&(le=Error(H("Not enough arguments following: %s",W)))}let ue=Math.min(te,re);for(!Se(K)&&ue>0&&(ge(W,K),ue--),U=_+1;U<ue+_+1;U++)ge(W,Z[U]);return _+ue}function $e(_,W,Z,K){let U=[],re=K||Z[_+1];const te=ce(W,T.nargs);if(ce(W,T.bools)&&!/^(true|false)$/.test(re))U.push(!0);else if(Se(re)||Se(K)&&/^-/.test(re)&&!X.test(re)&&!we(re)){if(w[W]!==void 0){const ue=w[W];U=Array.isArray(ue)?ue:[ue]}}else{Se(K)||U.push(ee(W,K,!0));for(let ue=_+1;ue<Z.length&&!(!d["greedy-arrays"]&&U.length>0||te&&typeof te=="number"&&U.length>=te||(re=Z[ue],/^-/.test(re)&&!X.test(re)&&!we(re)));ue++)_=ue,U.push(ee(W,re,a))}return typeof te=="number"&&(te&&U.length<te||isNaN(te)&&U.length===0)&&(le=Error(H("Not enough arguments following: %s",W))),ge(W,U),_}function ge(_,W,Z=a){if(/-/.test(_)&&d["camel-case-expansion"]){const re=_.split(".").map(function(te){return camelCase(te)}).join(".");se(_,re)}const K=ee(_,W,Z),U=_.split(".");Ie(fe,U,K),T.aliases[_]&&T.aliases[_].forEach(function(re){const te=re.split(".");Ie(fe,te,K)}),U.length>1&&d["dot-notation"]&&(T.aliases[U[0]]||[]).forEach(function(re){let te=re.split(".");const ue=[].concat(U);ue.shift(),te=te.concat(ue),(T.aliases[_]||[]).includes(te.join("."))||Ie(fe,te,K)}),ce(_,T.normalize)&&!ce(_,T.arrays)&&[_].concat(T.aliases[_]||[]).forEach(function(te){Object.defineProperty(ve,te,{enumerable:!0,get(){return W},set(ue){W=typeof ue=="string"?mixin.normalize(ue):ue}})})}function se(_,W){T.aliases[_]&&T.aliases[_].length||(T.aliases[_]=[W],z[W]=!0),T.aliases[W]&&T.aliases[W].length||se(W,_)}function ee(_,W,Z){Z&&(W=stripQuotes(W)),(ce(_,T.bools)||ce(_,T.counts))&&typeof W=="string"&&(W=W==="true");let K=Array.isArray(W)?W.map(function(U){return ie(_,U)}):ie(_,W);return ce(_,T.counts)&&(Se(K)||typeof K=="boolean")&&(K=increment()),ce(_,T.normalize)&&ce(_,T.arrays)&&(Array.isArray(W)?K=W.map(U=>mixin.normalize(U)):K=mixin.normalize(W)),K}function ie(_,W){return!d["parse-positional-numbers"]&&_==="_"||!ce(_,T.strings)&&!ce(_,T.bools)&&!Array.isArray(W)&&(looksLikeNumber(W)&&d["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${W}`)))||!Se(W)&&ce(_,T.numbers))&&(W=Number(W)),W}function de(_){const W=Object.create(null);Ce(W,T.aliases,w),Object.keys(T.configs).forEach(function(Z){const K=_[Z]||W[Z];if(K)try{let U=null;const re=mixin.resolve(mixin.cwd(),K),te=T.configs[Z];if(typeof te=="function"){try{U=te(re)}catch(ue){U=ue}if(U instanceof Error){le=U;return}}else U=mixin.require(re);me(U)}catch(U){U.name==="PermissionDenied"?le=U:_[Z]&&(le=Error(H("Invalid JSON config file: %s",K)))}})}function me(_,W){Object.keys(_).forEach(function(Z){const K=_[Z],U=W?W+"."+Z:Z;typeof K=="object"&&K!==null&&!Array.isArray(K)&&d["dot-notation"]?me(K,U):(!xe(fe,U.split("."))||ce(U,T.arrays)&&d["combine-arrays"])&&ge(U,K)})}function be(){typeof L<"u"&&L.forEach(function(_){me(_)})}function pe(_,W){if(typeof y>"u")return;const Z=typeof y=="string"?y:"",K=mixin.env();Object.keys(K).forEach(function(U){if(Z===""||U.lastIndexOf(Z,0)===0){const re=U.split("__").map(function(te,ue){return ue===0&&(te=te.substring(Z.length)),camelCase(te)});(W&&T.configs[re.join(".")]||!W)&&!xe(_,re)&&ge(re.join("."),K[U])}})}function Fe(_){let W;const Z=new Set;Object.keys(_).forEach(function(K){if(!Z.has(K)&&(W=ce(K,T.coercions),typeof W=="function"))try{const U=ie(K,W(_[K]));[].concat(T.aliases[K]||[],K).forEach(re=>{Z.add(re),_[re]=U})}catch(U){le=U}})}function je(_){return T.keys.forEach(W=>{~W.indexOf(".")||typeof _[W]>"u"&&(_[W]=void 0)}),_}function Ce(_,W,Z,K=!1){Object.keys(Z).forEach(function(U){xe(_,U.split("."))||(Ie(_,U.split("."),Z[U]),K&&(Q[U]=!0),(W[U]||[]).forEach(function(re){xe(_,re.split("."))||Ie(_,re.split("."),Z[U])}))})}function xe(_,W){let Z=_;d["dot-notation"]||(W=[W.join(".")]),W.slice(0,-1).forEach(function(U){Z=Z[U]||{}});const K=W[W.length-1];return typeof Z!="object"?!1:K in Z}function Ie(_,W,Z){let K=_;d["dot-notation"]||(W=[W.join(".")]),W.slice(0,-1).forEach(function(ye){ye=sanitizeKey(ye),typeof K=="object"&&K[ye]===void 0&&(K[ye]={}),typeof K[ye]!="object"||Array.isArray(K[ye])?(Array.isArray(K[ye])?K[ye].push({}):K[ye]=[K[ye],{}],K=K[ye][K[ye].length-1]):K=K[ye]});const U=sanitizeKey(W[W.length-1]),re=ce(W.join("."),T.arrays),te=Array.isArray(Z);let ue=d["duplicate-arguments-array"];!ue&&ce(U,T.nargs)&&(ue=!0,(!Se(K[U])&&T.nargs[U]===1||Array.isArray(K[U])&&K[U].length===T.nargs[U])&&(K[U]=void 0)),Z===increment()?K[U]=increment(K[U]):Array.isArray(K[U])?ue&&re&&te?K[U]=d["flatten-duplicate-arrays"]?K[U].concat(Z):(Array.isArray(K[U][0])?K[U]:[K[U]]).concat([Z]):!ue&&!!re==!!te?K[U]=Z:K[U]=K[U].concat([Z]):K[U]===void 0&&re?K[U]=te?Z:[Z]:ue&&!(K[U]===void 0||ce(U,T.counts)||ce(U,T.bools))?K[U]=[K[U],Z]:K[U]=Z}function Le(..._){_.forEach(function(W){Object.keys(W||{}).forEach(function(Z){T.aliases[Z]||(T.aliases[Z]=[].concat(l[Z]||[]),T.aliases[Z].concat(Z).forEach(function(K){if(/-/.test(K)&&d["camel-case-expansion"]){const U=camelCase(K);U!==Z&&T.aliases[Z].indexOf(U)===-1&&(T.aliases[Z].push(U),z[U]=!0)}}),T.aliases[Z].concat(Z).forEach(function(K){if(K.length>1&&/[A-Z]/.test(K)&&d["camel-case-expansion"]){const U=decamelize(K,"-");U!==Z&&T.aliases[Z].indexOf(U)===-1&&(T.aliases[Z].push(U),z[U]=!0)}}),T.aliases[Z].forEach(function(K){T.aliases[K]=[Z].concat(T.aliases[Z].filter(function(U){return K!==U}))}))})})}function ce(_,W){const Z=[].concat(T.aliases[_]||[],_),K=Object.keys(W),U=Z.find(re=>K.includes(re));return U?W[U]:!1}function ke(_){const W=Object.keys(T);return[].concat(W.map(K=>T[K])).some(function(K){return Array.isArray(K)?K.includes(_):K[_]})}function ae(_,...W){return[].concat(...W).some(function(K){const U=_.match(K);return U&&ke(U[1])})}function De(_){if(_.match(X)||!_.match(/^-[^-]+/))return!1;let W=!0,Z;const K=_.slice(1).split("");for(let U=0;U<K.length;U++){if(Z=_.slice(U+2),!ke(K[U])){W=!1;break}if(K[U+1]&&K[U+1]==="="||Z==="-"||/[A-Za-z]/.test(K[U])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(Z)||K[U+1]&&K[U+1].match(/\W/))break}return W}function we(_){return d["unknown-options-as-args"]&&he(_)}function he(_){return _=_.replace(/^-{3,}/,"--"),_.match(X)||De(_)?!1:!ae(_,/^-+([^=]+?)=[\s\S]*$/,ne,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function Ae(_){return!ce(_,T.bools)&&!ce(_,T.counts)&&`${_}`in w?w[_]:Ee(Oe(_))}function Ee(_){return{[DefaultValuesForTypeKey.BOOLEAN]:!0,[DefaultValuesForTypeKey.STRING]:"",[DefaultValuesForTypeKey.NUMBER]:void 0,[DefaultValuesForTypeKey.ARRAY]:[]}[_]}function Oe(_){let W=DefaultValuesForTypeKey.BOOLEAN;return ce(_,T.strings)?W=DefaultValuesForTypeKey.STRING:ce(_,T.numbers)?W=DefaultValuesForTypeKey.NUMBER:ce(_,T.bools)?W=DefaultValuesForTypeKey.BOOLEAN:ce(_,T.arrays)&&(W=DefaultValuesForTypeKey.ARRAY),W}function Se(_){return _===void 0}function Ne(){Object.keys(T.counts).find(_=>ce(_,T.arrays)?(le=Error(H("Invalid configuration: %s, opts.count excludes opts.array.",_)),!0):ce(_,T.nargs)?(le=Error(H("Invalid configuration: %s, opts.count excludes opts.narg.",_)),!0):!1)}return{aliases:Object.assign({},T.aliases),argv:Object.assign(ve,fe),configuration:d,defaulted:Object.assign({},Q),error:le,newAliases:Object.assign({},z)}}}function combineAliases(s){const e=[],t=Object.create(null);let n=!0;for(Object.keys(s).forEach(function(o){e.push([].concat(s[o],o))});n;){n=!1;for(let o=0;o<e.length;o++)for(let a=o+1;a<e.length;a++)if(e[o].filter(function(d){return e[a].indexOf(d)!==-1}).length){e[o]=e[o].concat(e[a]),e.splice(a,1),n=!0;break}}return e.forEach(function(o){o=o.filter(function(l,d,w){return w.indexOf(l)===d});const a=o.pop();a!==void 0&&typeof a=="string"&&(t[a]=o)}),t}function increment(s){return s!==void 0?s+1:1}function sanitizeKey(s){return s==="__proto__"?"___proto___":s}function stripQuotes(s){return typeof s=="string"&&(s[0]==="'"||s[0]==='"')&&s[s.length-1]===s[0]?s.substring(1,s.length-1):s}var _a,_b,_c;const minNodeVersion=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,nodeVersion=(_b=(_a=process==null?void 0:process.versions)===null||_a===void 0?void 0:_a.node)!==null&&_b!==void 0?_b:(_c=process==null?void 0:process.version)===null||_c===void 0?void 0:_c.slice(1);if(nodeVersion&&Number(nodeVersion.match(/^([^.]+)/)[1])<minNodeVersion)throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const env=process?process.env:{},parser=new YargsParser({cwd:process.cwd,env:()=>env,format:require$$0$2.format,normalize:require$$0.normalize,resolve:require$$0.resolve,require:s=>{if(typeof require<"u")return require(s);if(s.match(/\.json$/))return JSON.parse(require$$0$1.readFileSync(s,"utf8"));throw Error("only .json config files are supported in ESM")}}),yargsParser=function(e,t){return parser.parse(e.slice(),t).argv};yargsParser.detailed=function(s,e){return parser.parse(s.slice(),e)},yargsParser.camelCase=camelCase,yargsParser.decamelize=decamelize,yargsParser.looksLikeNumber=looksLikeNumber;function getProcessArgvBinIndex(){return isBundledElectronApp()?0:1}function isBundledElectronApp(){return isElectronApp()&&!process.defaultApp}function isElectronApp(){return!!process.versions.electron}function hideBin(s){return s.slice(getProcessArgvBinIndex()+1)}function getProcessArgvBin(){return process.argv[getProcessArgvBinIndex()]}class YError extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,YError)}}const shim$3={fs:{readFileSync:require$$0$1.readFileSync,writeFile:require$$0$1.writeFile},format:require$$0$2.format,resolve:require$$0.resolve,exists:s=>{try{return require$$0$1.statSync(s).isFile()}catch{return!1}}};let shim$2;class Y18N{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);const t=e.shift();let 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(),shim$2.format.apply(shim$2.format,[this.cache[this.locale][t]||t].concat(e))}__n(){const e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),o=e.shift();let a=function(){};typeof e[e.length-1]=="function"&&(a=e.pop()),this.cache[this.locale]||this._readLocaleFile();let l=o===1?t:n;this.cache[this.locale][t]&&(l=this.cache[this.locale][t][o===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:a})):a();const d=[l];return~l.indexOf("%d")&&d.push(o),shim$2.format.apply(shim$2.format,d.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(const 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(o,a){const l=t[a+1];n+=o,typeof l<"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(){const e=this,t=this.writeQueue[0],n=t.directory,o=t.locale,a=t.cb,l=this._resolveLocaleFile(n,o),d=JSON.stringify(this.cache[o],null,2);shim$2.fs.writeFile(l,d,"utf-8",function(w){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),a(w)})}_readLocaleFile(){let e={};const t=this._resolveLocaleFile(this.directory,this.locale);try{shim$2.fs.readFileSync&&(e=JSON.parse(shim$2.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=shim$2.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){const o=shim$2.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(o)&&(n=o)}return n}_fileExistsSync(e){return shim$2.exists(e)}}function y18n$1(s,e){shim$2=e;const t=new Y18N(s);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}}const y18n=s=>y18n$1(s,shim$3),REQUIRE_ERROR="require is not supported by ESM",REQUIRE_DIRECTORY_ERROR="loading a directory of commands is not supported yet for ESM";let __dirname$1;try{__dirname$1=require$$0$3.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("cli/index.cjs",document.baseURI).href)}catch{__dirname$1=process.cwd()}const mainFilename=__dirname$1.substring(0,__dirname$1.lastIndexOf("node_modules")),shim$1={assert:{notStrictEqual:assert.notStrictEqual,strictEqual:assert.strictEqual},cliui:ui,findUp:escalade,getEnv:s=>process.env[s],inspect:require$$0$2.inspect,getCallerFile:()=>{throw new YError(REQUIRE_DIRECTORY_ERROR)},getProcessArgvBin,mainFilename:mainFilename||process.cwd(),Parser:yargsParser,path:{basename:require$$0.basename,dirname:require$$0.dirname,extname:require$$0.extname,relative:require$$0.relative,resolve:require$$0.resolve},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(s,e)=>process.emitWarning(s,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:require$$0$1.readFileSync,require:()=>{throw new YError(REQUIRE_ERROR)},requireDirectory:()=>{throw new YError(REQUIRE_DIRECTORY_ERROR)},stringWidth:s=>[...s].length,y18n:y18n({directory:require$$0.resolve(__dirname$1,"../../../locales"),updateFiles:!1})};function assertNotStrictEqual(s,e,t,n){t.assert.notStrictEqual(s,e,n)}function assertSingleKey(s,e){e.assert.strictEqual(typeof s,"string")}function objectKeys(s){return Object.keys(s)}function isPromise(s){return!!s&&!!s.then&&typeof s.then=="function"}function parseCommand(s){const t=s.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,o=t.shift();if(!o)throw new Error(`No command found in: ${s}`);const a={cmd:o.replace(n,""),demanded:[],optional:[]};return t.forEach((l,d)=>{let w=!1;l=l.replace(/\s/g,""),/\.+[\]>]/.test(l)&&d===t.length-1&&(w=!0),/^\[/.test(l)?a.optional.push({cmd:l.replace(n,"").split("|"),variadic:w}):a.demanded.push({cmd:l.replace(n,"").split("|"),variadic:w})}),a}const positionName=["first","second","third","fourth","fifth","sixth"];function argsert(s,e,t){function n(){return typeof s=="object"?[{demanded:[],optional:[]},s,e]:[parseCommand(`cmd ${s}`),e,t]}try{let o=0;const[a,l,d]=n(),w=[].slice.call(l);for(;w.length&&w[w.length-1]===void 0;)w.pop();const L=d||w.length;if(L<a.demanded.length)throw new YError(`Not enough arguments provided. Expected ${a.demanded.length} but received ${w.length}.`);const y=a.demanded.length+a.optional.length;if(L>y)throw new YError(`Too many arguments provided. Expected max ${y} but received ${L}.`);a.demanded.forEach(B=>{const N=w.shift(),z=guessType(N);B.cmd.filter(H=>H===z||H==="*").length===0&&argumentTypeError(z,B.cmd,o),o+=1}),a.optional.forEach(B=>{if(w.length===0)return;const N=w.shift(),z=guessType(N);B.cmd.filter(H=>H===z||H==="*").length===0&&argumentTypeError(z,B.cmd,o),o+=1})}catch(o){console.warn(o.stack)}}function guessType(s){return Array.isArray(s)?"array":s===null?"null":typeof s}function argumentTypeError(s,e,t){throw new YError(`Invalid ${positionName[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${s}.`)}class GlobalMiddleware{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,o=!1){if(argsert("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let a=0;a<e.length;a++){if(typeof e[a]!="function")throw Error("middleware must be a function");const l=e[a];l.applyBeforeValidation=t,l.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){const a=e;a.applyBeforeValidation=t,a.global=n,a.mutates=o,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){const n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(o=>{const a=[...n[t]||[],t];return o.option?!a.includes(o.option):!0}),e.option=t,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}}function commandMiddlewareFactory(s){return s?s.map(e=>(e.applyBeforeValidation=!1,e)):[]}function applyMiddleware(s,e,t,n){return t.reduce((o,a)=>{if(a.applyBeforeValidation!==n)return o;if(a.mutates){if(a.applied)return o;a.applied=!0}if(isPromise(o))return o.then(l=>Promise.all([l,a(l,e)])).then(([l,d])=>Object.assign(l,d));{const l=a(o,e);return isPromise(l)?l.then(d=>Object.assign(o,d)):Object.assign(o,l)}},s)}function maybeAsyncResult(s,e,t=n=>{throw n}){try{const n=isFunction(s)?s():s;return isPromise(n)?n.then(o=>e(o)):e(n)}catch(n){return t(n)}}function isFunction(s){return typeof s=="function"}function whichModule(s){if(typeof require>"u")return null;for(let e=0,t=Object.keys(require.cache),n;e<t.length;e++)if(n=require.cache[t[e]],n.exports===s)return n;return null}const DEFAULT_MARKER=/(^\*)|(^\$0)/;class CommandInstance{constructor(e,t,n,o){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=o,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,o){o=o||{},typeof o.recurse!="boolean"&&(o.recurse=!1),Array.isArray(o.extensions)||(o.extensions=["js"]);const a=typeof o.visit=="function"?o.visit:l=>l;o.visit=(l,d,w)=>{const L=a(l,d,w);if(L){if(this.requireCache.has(d))return L;this.requireCache.add(d),this.addHandler(L)}return L},this.shim.requireDirectory({require:t,filename:n},e,o)}addHandler(e,t,n,o,a,l){let d=[];const w=commandMiddlewareFactory(a);if(o=o||(()=>{}),Array.isArray(e))if(isCommandAndAliases(e))[e,...d]=e;else for(const L of e)this.addHandler(L);else if(isCommandHandlerDefinition(e)){let L=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(L=[].concat(L).concat(e.aliases)),this.addHandler(L,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(isCommandBuilderDefinition(n)){this.addHandler([e].concat(d),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){const L=parseCommand(e);d=d.map(N=>parseCommand(N).cmd);let y=!1;const B=[L.cmd].concat(d).filter(N=>DEFAULT_MARKER.test(N)?(y=!0,!1):!0);B.length===0&&y&&B.push("$0"),y&&(L.cmd=B[0],d=B.slice(1),e=e.replace(DEFAULT_MARKER,L.cmd)),d.forEach(N=>{this.aliasMap[N]=L.cmd}),t!==!1&&this.usage.command(e,t,y,d,l),this.handlers[L.cmd]={original:e,description:t,handler:o,builder:n||{},middlewares:w,deprecated:l,demanded:L.demanded,optional:L.optional},y&&(this.defaultCommand=this.handlers[L.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,o,a,l){const d=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,w=t.getInternalMethods().getContext(),L=w.commands.slice(),y=!e;e&&(w.commands.push(e),w.fullCommands.push(d.original));const B=this.applyBuilderUpdateUsageAndParse(y,d,t,n.aliases,L,o,a,l);return isPromise(B)?B.then(N=>this.applyMiddlewareAndGetResult(y,d,N.innerArgv,w,a,N.aliases,t)):this.applyMiddlewareAndGetResult(y,d,B.innerArgv,w,a,B.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,o,a,l,d,w){const L=t.builder;let y=n;if(isCommandBuilderCallback(L)){n.getInternalMethods().getUsageInstance().freeze();const B=L(n.getInternalMethods().reset(o),w);if(isPromise(B))return B.then(N=>(y=isYargsInstance(N)?N:n,this.parseAndUpdateUsage(e,t,y,a,l,d)))}else isCommandBuilderOptionDefinitions(L)&&(n.getInternalMethods().getUsageInstance().freeze(),y=n.getInternalMethods().reset(o),Object.keys(t.builder).forEach(B=>{y.option(B,L[B])}));return this.parseAndUpdateUsage(e,t,y,a,l,d)}parseAndUpdateUsage(e,t,n,o,a,l){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(o,t),t.description);const d=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,a,l);return isPromise(d)?d.then(w=>({aliases:n.parsed.aliases,innerArgv:w})):{aliases:n.parsed.aliases,innerArgv:d}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){const n=DEFAULT_MARKER.test(t.original)?t.original.replace(DEFAULT_MARKER,"").trim():t.original,o=e.filter(a=>!DEFAULT_MARKER.test(a));return o.push(n),`$0 ${o.join(" ")}`}handleValidationAndGetResult(e,t,n,o,a,l,d,w){if(!l.getInternalMethods().getHasOutput()){const L=l.getInternalMethods().runValidation(a,w,l.parsed.error,e);n=maybeAsyncResult(n,y=>(L(y),y))}if(t.handler&&!l.getInternalMethods().getHasOutput()){l.getInternalMethods().setHasOutput();const L=!!l.getOptions().configuration["populate--"];l.getInternalMethods().postProcess(n,L,!1,!1),n=applyMiddleware(n,l,d,!1),n=maybeAsyncResult(n,y=>{const B=t.handler(y);return isPromise(B)?B.then(()=>y):y}),e||l.getInternalMethods().getUsageInstance().cacheHelpMessage(),isPromise(n)&&!l.getInternalMethods().hasParseCallback()&&n.catch(y=>{try{l.getInternalMethods().getUsageInstance().fail(null,y)}catch{}})}return e||(o.commands.pop(),o.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,o,a,l,d){let w={};if(a)return n;d.getInternalMethods().getHasOutput()||(w=this.populatePositionals(t,n,o,d));const L=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),y=applyMiddleware(n,d,L,!0);return isPromise(y)?y.then(B=>this.handleValidationAndGetResult(e,t,B,o,l,d,L,w)):this.handleValidationAndGetResult(e,t,y,o,l,d,L,w)}populatePositionals(e,t,n,o){t._=t._.slice(n.commands.length);const a=e.demanded.slice(0),l=e.optional.slice(0),d={};for(this.validation.positionalCount(a.length,t._.length);a.length;){const w=a.shift();this.populatePositional(w,t,d)}for(;l.length;){const w=l.shift();this.populatePositional(w,t,d)}return t._=n.commands.concat(t._.map(w=>""+w)),this.postProcessPositionals(t,d,this.cmdToParseOptions(e.original),o),d}populatePositional(e,t,n){const o=e.cmd[0];e.variadic?n[o]=t._.splice(0).map(String):t._.length&&(n[o]=[String(t._.shift())])}cmdToParseOptions(e){const t={array:[],default:{},alias:{},demand:{}},n=parseCommand(e);return n.demanded.forEach(o=>{const[a,...l]=o.cmd;o.variadic&&(t.array.push(a),t.default[a]=[]),t.alias[a]=l,t.demand[a]=!0}),n.optional.forEach(o=>{const[a,...l]=o.cmd;o.variadic&&(t.array.push(a),t.default[a]=[]),t.alias[a]=l}),t}postProcessPositionals(e,t,n,o){const a=Object.assign({},o.getOptions());a.default=Object.assign(n.default,a.default);for(const L of Object.keys(n.alias))a.alias[L]=(a.alias[L]||[]).concat(n.alias[L]);a.array=a.array.concat(n.array),a.config={};const l=[];if(Object.keys(t).forEach(L=>{t[L].map(y=>{a.configuration["unknown-options-as-args"]&&(a.key[L]=!0),l.push(`--${L}`),l.push(y)})}),!l.length)return;const d=Object.assign({},a.configuration,{"populate--":!1}),w=this.shim.Parser.detailed(l,Object.assign({},a,{configuration:d}));if(w.error)o.getInternalMethods().getUsageInstance().fail(w.error.message,w.error);else{const L=Object.keys(t);Object.keys(t).forEach(y=>{L.push(...w.aliases[y])}),Object.keys(w.argv).forEach(y=>{L.includes(y)&&(t[y]||(t[y]=w.argv[y]),!this.isInConfigs(o,y)&&!this.isDefaulted(o,y)&&Object.prototype.hasOwnProperty.call(e,y)&&Object.prototype.hasOwnProperty.call(w.argv,y)&&(Array.isArray(e[y])||Array.isArray(w.argv[y]))?e[y]=[].concat(e[y],w.argv[y]):e[y]=w.argv[y])})}}isDefaulted(e,t){const{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){const{configObjects:n}=e.getOptions();return n.some(o=>Object.prototype.hasOwnProperty.call(o,t))||n.some(o=>Object.prototype.hasOwnProperty.call(o,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){const n=DEFAULT_MARKER.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}const t=this.defaultCommand.builder;if(isCommandBuilderCallback(t))return t(e,!0);isCommandBuilderDefinition(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){const t=whichModule(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(const o of[e,t,n]){if(typeof o=="string"||o===!1)return o;assertNotStrictEqual(o,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const e=this.frozens.pop();assertNotStrictEqual(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 command(s,e,t,n){return new CommandInstance(s,e,t,n)}function isCommandBuilderDefinition(s){return typeof s=="object"&&!!s.builder&&typeof s.handler=="function"}function isCommandAndAliases(s){return s.every(e=>typeof e=="string")}function isCommandBuilderCallback(s){return typeof s=="function"}function isCommandBuilderOptionDefinitions(s){return typeof s=="object"}function isCommandHandlerDefinition(s){return typeof s=="object"&&!Array.isArray(s)}function objFilter(s={},e=()=>!0){const t={};return objectKeys(s).forEach(n=>{e(n,s[n])&&(t[n]=s[n])}),t}function setBlocking(s){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{const t=e;t._handle&&t.isTTY&&typeof t._handle.setBlocking=="function"&&t._handle.setBlocking(s)})}function isBoolean(s){return typeof s=="boolean"}function usage(s,e){const t=e.y18n.__,n={},o=[];n.failFn=function(ee){o.push(ee)};let a=null,l=null,d=!0;n.showHelpOnFail=function(ee=!0,ie){const[de,me]=typeof ee=="string"?[!0,ee]:[ee,ie];return s.getInternalMethods().isGlobalContext()&&(l=me),a=me,d=de,n};let w=!1;n.fail=function(ee,ie){const de=s.getInternalMethods().getLoggerInstance();if(o.length)for(let me=o.length-1;me>=0;--me){const be=o[me];if(isBoolean(be)){if(ie)throw ie;if(ee)throw Error(ee)}else be(ee,ie,n)}else{if(s.getExitProcess()&&setBlocking(!0),!w){w=!0,d&&(s.showHelp("error"),de.error()),(ee||ie)&&de.error(ee||ie);const me=a||l;me&&((ee||ie)&&de.error(""),de.error(me))}if(ie=ie||new YError(ee),s.getExitProcess())return s.exit(1);if(s.getInternalMethods().hasParseCallback())return s.exit(1,ie);throw ie}};let L=[],y=!1;n.usage=(se,ee)=>se===null?(y=!0,L=[],n):(y=!1,L.push([se,ee||""]),n),n.getUsage=()=>L,n.getUsageDisabled=()=>y,n.getPositionalGroupName=()=>t("Positionals:");let B=[];n.example=(se,ee)=>{B.push([se,ee||""])};let N=[];n.command=function(ee,ie,de,me,be=!1){de&&(N=N.map(pe=>(pe[2]=!1,pe))),N.push([ee,ie||"",de,me,be])},n.getCommands=()=>N;let z={};n.describe=function(ee,ie){Array.isArray(ee)?ee.forEach(de=>{n.describe(de,ie)}):typeof ee=="object"?Object.keys(ee).forEach(de=>{n.describe(de,ee[de])}):z[ee]=ie},n.getDescriptions=()=>z;let Q=[];n.epilog=se=>{Q.push(se)};let H=!1,T;n.wrap=se=>{H=!0,T=se},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(H||(T=Pe(),H=!0),T);const X="__yargsString__:";n.deferY18nLookup=se=>X+se,n.help=function(){if(oe)return oe;le();const ee=s.customScriptName?s.$0:e.path.basename(s.$0),ie=s.getDemandedOptions(),de=s.getDemandedCommands(),me=s.getDeprecatedOptions(),be=s.getGroups(),pe=s.getOptions();let Fe=[];Fe=Fe.concat(Object.keys(z)),Fe=Fe.concat(Object.keys(ie)),Fe=Fe.concat(Object.keys(de)),Fe=Fe.concat(Object.keys(pe.default)),Fe=Fe.filter(ve),Fe=Object.keys(Fe.reduce((ae,De)=>(De!=="_"&&(ae[De]=!0),ae),{}));const je=n.getWrap(),Ce=e.cliui({width:je,wrap:!!je});if(!y){if(L.length)L.forEach(ae=>{Ce.div({text:`${ae[0].replace(/\$0/g,ee)}`}),ae[1]&&Ce.div({text:`${ae[1]}`,padding:[1,0,0,0]})}),Ce.div();else if(N.length){let ae=null;de._?ae=`${ee} <${t("command")}>
7
+ `),o+=s.charAt(a);return t&&n&&(o=`${t}${o}${n}`),o}function ui(s){return cliui(s,{stringWidth:e=>[...e].length,stripAnsi,wrap})}function escalade(s,e){let t=require$$0.resolve(".",s),n;for(require$$0$1.statSync(t).isDirectory()||(t=require$$0.dirname(t));;){if(n=e(t,require$$0$1.readdirSync(t)),n)return require$$0.resolve(t,n);if(t=require$$0.dirname(n=t),n===t)break}}function camelCase(s){if(s!==s.toLowerCase()&&s!==s.toUpperCase()||(s=s.toLowerCase()),s.indexOf("-")===-1&&s.indexOf("_")===-1)return s;{let t="",n=!1;const o=s.match(/^-+/);for(let a=o?o[0].length:0;a<s.length;a++){let l=s.charAt(a);n&&(n=!1,l=l.toUpperCase()),a!==0&&(l==="-"||l==="_")?n=!0:l!=="-"&&l!=="_"&&(t+=l)}return t}}function decamelize(s,e){const t=s.toLowerCase();e=e||"-";let n="";for(let o=0;o<s.length;o++){const a=t.charAt(o),l=s.charAt(o);a!==l&&o>0?n+=`${e}${t.charAt(o)}`:n+=l}return n}function looksLikeNumber(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 tokenizeArgString(s){if(Array.isArray(s))return s.map(l=>typeof l!="string"?l+"":l);s=s.trim();let e=0,t=null,n=null,o=null;const a=[];for(let l=0;l<s.length;l++){if(t=n,n=s.charAt(l),n===" "&&!o){t!==" "&&e++;continue}n===o?o=null:(n==="'"||n==='"')&&!o&&(o=n),a[e]||(a[e]=""),a[e]+=n}return a}var DefaultValuesForTypeKey;(function(s){s.BOOLEAN="boolean",s.STRING="string",s.NUMBER="number",s.ARRAY="array"})(DefaultValuesForTypeKey||(DefaultValuesForTypeKey={}));let mixin;class YargsParser{constructor(e){mixin=e}parse(e,t){const 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),o=tokenizeArgString(e),a=typeof e=="string",l=combineAliases(Object.assign(Object.create(null),n.alias)),d=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),w=Object.assign(Object.create(null),n.default),L=n.configObjects||[],y=n.envPrefix,B=d["populate--"],N=B?"--":"_",z=Object.create(null),Q=Object.create(null),H=n.__||mixin.format,T={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:[]},X=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,ne=new RegExp("^--"+d["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(_){const W=typeof _=="object"?_.key:_,Z=Object.keys(_).map(function(K){return{boolean:"bools",string:"strings",number:"numbers"}[K]}).filter(Boolean).pop();Z&&(T[Z][W]=!0),T.arrays[W]=!0,T.keys.push(W)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(_){T.bools[_]=!0,T.keys.push(_)}),[].concat(n.string||[]).filter(Boolean).forEach(function(_){T.strings[_]=!0,T.keys.push(_)}),[].concat(n.number||[]).filter(Boolean).forEach(function(_){T.numbers[_]=!0,T.keys.push(_)}),[].concat(n.count||[]).filter(Boolean).forEach(function(_){T.counts[_]=!0,T.keys.push(_)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(_){T.normalize[_]=!0,T.keys.push(_)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([_,W])=>{typeof W=="number"&&(T.nargs[_]=W,T.keys.push(_))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([_,W])=>{typeof W=="function"&&(T.coercions[_]=W,T.keys.push(_))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(_){T.configs[_]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([_,W])=>{(typeof W=="boolean"||typeof W=="function")&&(T.configs[_]=W)})),Le(n.key,l,n.default,T.arrays),Object.keys(w).forEach(function(_){(T.aliases[_]||[]).forEach(function(W){w[W]=w[_]})});let le=null;Ne();let ue=[];const fe=Object.assign(Object.create(null),{_:[]}),ve={};for(let _=0;_<o.length;_++){const W=o[_],Z=W.replace(/^-{3,}/,"---");let K,U,re,te,oe,ye;if(W!=="--"&&/^-/.test(W)&&we(W))_e(W);else if(Z.match(/^---+(=|$)/)){_e(W);continue}else if(W.match(/^--.+=/)||!d["short-option-groups"]&&W.match(/^-.+=/))te=W.match(/^--?([^=]+)=([\s\S]*)$/),te!==null&&Array.isArray(te)&&te.length>=3&&(ce(te[1],T.arrays)?_=$e(_,te[1],o,te[2]):ce(te[1],T.nargs)!==!1?_=Pe(_,te[1],o,te[2]):ge(te[1],te[2],!0));else if(W.match(ne)&&d["boolean-negation"])te=W.match(ne),te!==null&&Array.isArray(te)&&te.length>=2&&(U=te[1],ge(U,ce(U,T.arrays)?[!1]:!1));else if(W.match(/^--.+/)||!d["short-option-groups"]&&W.match(/^-[^-]+/))te=W.match(/^--?(.+)/),te!==null&&Array.isArray(te)&&te.length>=2&&(U=te[1],ce(U,T.arrays)?_=$e(_,U,o):ce(U,T.nargs)!==!1?_=Pe(_,U,o):(oe=o[_+1],oe!==void 0&&(!oe.match(/^-/)||oe.match(X))&&!ce(U,T.bools)&&!ce(U,T.counts)||/^(true|false)$/.test(oe)?(ge(U,oe),_++):ge(U,Ae(U))));else if(W.match(/^-.\..+=/))te=W.match(/^-([^=]+)=([\s\S]*)$/),te!==null&&Array.isArray(te)&&te.length>=3&&ge(te[1],te[2]);else if(W.match(/^-.\..+/)&&!W.match(X))oe=o[_+1],te=W.match(/^-(.\..+)/),te!==null&&Array.isArray(te)&&te.length>=2&&(U=te[1],oe!==void 0&&!oe.match(/^-/)&&!ce(U,T.bools)&&!ce(U,T.counts)?(ge(U,oe),_++):ge(U,Ae(U)));else if(W.match(/^-[^-]+/)&&!W.match(X)){re=W.slice(1,-1).split(""),K=!1;for(let Be=0;Be<re.length;Be++){if(oe=W.slice(Be+2),re[Be+1]&&re[Be+1]==="="){ye=W.slice(Be+3),U=re[Be],ce(U,T.arrays)?_=$e(_,U,o,ye):ce(U,T.nargs)!==!1?_=Pe(_,U,o,ye):ge(U,ye),K=!0;break}if(oe==="-"){ge(re[Be],oe);continue}if(/[A-Za-z]/.test(re[Be])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(oe)&&ce(oe,T.bools)===!1){ge(re[Be],oe),K=!0;break}if(re[Be+1]&&re[Be+1].match(/\W/)){ge(re[Be],oe),K=!0;break}else ge(re[Be],Ae(re[Be]))}U=W.slice(-1)[0],!K&&U!=="-"&&(ce(U,T.arrays)?_=$e(_,U,o):ce(U,T.nargs)!==!1?_=Pe(_,U,o):(oe=o[_+1],oe!==void 0&&(!/^(-|--)[^-]/.test(oe)||oe.match(X))&&!ce(U,T.bools)&&!ce(U,T.counts)||/^(true|false)$/.test(oe)?(ge(U,oe),_++):ge(U,Ae(U))))}else if(W.match(/^-[0-9]$/)&&W.match(X)&&ce(W.slice(1),T.bools))U=W.slice(1),ge(U,Ae(U));else if(W==="--"){ue=o.slice(_+1);break}else if(d["halt-at-non-option"]){ue=o.slice(_);break}else _e(W)}pe(fe,!0),pe(fe,!1),de(fe),be(),Ce(fe,T.aliases,w,!0),Fe(fe),d["set-placeholder-key"]&&je(fe),Object.keys(T.counts).forEach(function(_){xe(fe,_.split("."))||ge(_,0)}),B&&ue.length&&(fe[N]=[]),ue.forEach(function(_){fe[N].push(_)}),d["camel-case-expansion"]&&d["strip-dashed"]&&Object.keys(fe).filter(_=>_!=="--"&&_.includes("-")).forEach(_=>{delete fe[_]}),d["strip-aliased"]&&[].concat(...Object.keys(l).map(_=>l[_])).forEach(_=>{d["camel-case-expansion"]&&_.includes("-")&&delete fe[_.split(".").map(W=>camelCase(W)).join(".")],delete fe[_]});function _e(_){const W=ie("_",_);(typeof W=="string"||typeof W=="number")&&fe._.push(W)}function Pe(_,W,Z,K){let U,re=ce(W,T.nargs);if(re=typeof re!="number"||isNaN(re)?1:re,re===0)return Se(K)||(le=Error(H("Argument unexpected for: %s",W))),ge(W,Ae(W)),_;let te=Se(K)?0:1;if(d["nargs-eats-options"])Z.length-(_+1)+te<re&&(le=Error(H("Not enough arguments following: %s",W))),te=re;else{for(U=_+1;U<Z.length&&(!Z[U].match(/^-[^0-9]/)||Z[U].match(X)||we(Z[U]));U++)te++;te<re&&(le=Error(H("Not enough arguments following: %s",W)))}let oe=Math.min(te,re);for(!Se(K)&&oe>0&&(ge(W,K),oe--),U=_+1;U<oe+_+1;U++)ge(W,Z[U]);return _+oe}function $e(_,W,Z,K){let U=[],re=K||Z[_+1];const te=ce(W,T.nargs);if(ce(W,T.bools)&&!/^(true|false)$/.test(re))U.push(!0);else if(Se(re)||Se(K)&&/^-/.test(re)&&!X.test(re)&&!we(re)){if(w[W]!==void 0){const oe=w[W];U=Array.isArray(oe)?oe:[oe]}}else{Se(K)||U.push(ee(W,K,!0));for(let oe=_+1;oe<Z.length&&!(!d["greedy-arrays"]&&U.length>0||te&&typeof te=="number"&&U.length>=te||(re=Z[oe],/^-/.test(re)&&!X.test(re)&&!we(re)));oe++)_=oe,U.push(ee(W,re,a))}return typeof te=="number"&&(te&&U.length<te||isNaN(te)&&U.length===0)&&(le=Error(H("Not enough arguments following: %s",W))),ge(W,U),_}function ge(_,W,Z=a){if(/-/.test(_)&&d["camel-case-expansion"]){const re=_.split(".").map(function(te){return camelCase(te)}).join(".");se(_,re)}const K=ee(_,W,Z),U=_.split(".");Ie(fe,U,K),T.aliases[_]&&T.aliases[_].forEach(function(re){const te=re.split(".");Ie(fe,te,K)}),U.length>1&&d["dot-notation"]&&(T.aliases[U[0]]||[]).forEach(function(re){let te=re.split(".");const oe=[].concat(U);oe.shift(),te=te.concat(oe),(T.aliases[_]||[]).includes(te.join("."))||Ie(fe,te,K)}),ce(_,T.normalize)&&!ce(_,T.arrays)&&[_].concat(T.aliases[_]||[]).forEach(function(te){Object.defineProperty(ve,te,{enumerable:!0,get(){return W},set(oe){W=typeof oe=="string"?mixin.normalize(oe):oe}})})}function se(_,W){T.aliases[_]&&T.aliases[_].length||(T.aliases[_]=[W],z[W]=!0),T.aliases[W]&&T.aliases[W].length||se(W,_)}function ee(_,W,Z){Z&&(W=stripQuotes(W)),(ce(_,T.bools)||ce(_,T.counts))&&typeof W=="string"&&(W=W==="true");let K=Array.isArray(W)?W.map(function(U){return ie(_,U)}):ie(_,W);return ce(_,T.counts)&&(Se(K)||typeof K=="boolean")&&(K=increment()),ce(_,T.normalize)&&ce(_,T.arrays)&&(Array.isArray(W)?K=W.map(U=>mixin.normalize(U)):K=mixin.normalize(W)),K}function ie(_,W){return!d["parse-positional-numbers"]&&_==="_"||!ce(_,T.strings)&&!ce(_,T.bools)&&!Array.isArray(W)&&(looksLikeNumber(W)&&d["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${W}`)))||!Se(W)&&ce(_,T.numbers))&&(W=Number(W)),W}function de(_){const W=Object.create(null);Ce(W,T.aliases,w),Object.keys(T.configs).forEach(function(Z){const K=_[Z]||W[Z];if(K)try{let U=null;const re=mixin.resolve(mixin.cwd(),K),te=T.configs[Z];if(typeof te=="function"){try{U=te(re)}catch(oe){U=oe}if(U instanceof Error){le=U;return}}else U=mixin.require(re);me(U)}catch(U){U.name==="PermissionDenied"?le=U:_[Z]&&(le=Error(H("Invalid JSON config file: %s",K)))}})}function me(_,W){Object.keys(_).forEach(function(Z){const K=_[Z],U=W?W+"."+Z:Z;typeof K=="object"&&K!==null&&!Array.isArray(K)&&d["dot-notation"]?me(K,U):(!xe(fe,U.split("."))||ce(U,T.arrays)&&d["combine-arrays"])&&ge(U,K)})}function be(){typeof L<"u"&&L.forEach(function(_){me(_)})}function pe(_,W){if(typeof y>"u")return;const Z=typeof y=="string"?y:"",K=mixin.env();Object.keys(K).forEach(function(U){if(Z===""||U.lastIndexOf(Z,0)===0){const re=U.split("__").map(function(te,oe){return oe===0&&(te=te.substring(Z.length)),camelCase(te)});(W&&T.configs[re.join(".")]||!W)&&!xe(_,re)&&ge(re.join("."),K[U])}})}function Fe(_){let W;const Z=new Set;Object.keys(_).forEach(function(K){if(!Z.has(K)&&(W=ce(K,T.coercions),typeof W=="function"))try{const U=ie(K,W(_[K]));[].concat(T.aliases[K]||[],K).forEach(re=>{Z.add(re),_[re]=U})}catch(U){le=U}})}function je(_){return T.keys.forEach(W=>{~W.indexOf(".")||typeof _[W]>"u"&&(_[W]=void 0)}),_}function Ce(_,W,Z,K=!1){Object.keys(Z).forEach(function(U){xe(_,U.split("."))||(Ie(_,U.split("."),Z[U]),K&&(Q[U]=!0),(W[U]||[]).forEach(function(re){xe(_,re.split("."))||Ie(_,re.split("."),Z[U])}))})}function xe(_,W){let Z=_;d["dot-notation"]||(W=[W.join(".")]),W.slice(0,-1).forEach(function(U){Z=Z[U]||{}});const K=W[W.length-1];return typeof Z!="object"?!1:K in Z}function Ie(_,W,Z){let K=_;d["dot-notation"]||(W=[W.join(".")]),W.slice(0,-1).forEach(function(ye){ye=sanitizeKey(ye),typeof K=="object"&&K[ye]===void 0&&(K[ye]={}),typeof K[ye]!="object"||Array.isArray(K[ye])?(Array.isArray(K[ye])?K[ye].push({}):K[ye]=[K[ye],{}],K=K[ye][K[ye].length-1]):K=K[ye]});const U=sanitizeKey(W[W.length-1]),re=ce(W.join("."),T.arrays),te=Array.isArray(Z);let oe=d["duplicate-arguments-array"];!oe&&ce(U,T.nargs)&&(oe=!0,(!Se(K[U])&&T.nargs[U]===1||Array.isArray(K[U])&&K[U].length===T.nargs[U])&&(K[U]=void 0)),Z===increment()?K[U]=increment(K[U]):Array.isArray(K[U])?oe&&re&&te?K[U]=d["flatten-duplicate-arrays"]?K[U].concat(Z):(Array.isArray(K[U][0])?K[U]:[K[U]]).concat([Z]):!oe&&!!re==!!te?K[U]=Z:K[U]=K[U].concat([Z]):K[U]===void 0&&re?K[U]=te?Z:[Z]:oe&&!(K[U]===void 0||ce(U,T.counts)||ce(U,T.bools))?K[U]=[K[U],Z]:K[U]=Z}function Le(..._){_.forEach(function(W){Object.keys(W||{}).forEach(function(Z){T.aliases[Z]||(T.aliases[Z]=[].concat(l[Z]||[]),T.aliases[Z].concat(Z).forEach(function(K){if(/-/.test(K)&&d["camel-case-expansion"]){const U=camelCase(K);U!==Z&&T.aliases[Z].indexOf(U)===-1&&(T.aliases[Z].push(U),z[U]=!0)}}),T.aliases[Z].concat(Z).forEach(function(K){if(K.length>1&&/[A-Z]/.test(K)&&d["camel-case-expansion"]){const U=decamelize(K,"-");U!==Z&&T.aliases[Z].indexOf(U)===-1&&(T.aliases[Z].push(U),z[U]=!0)}}),T.aliases[Z].forEach(function(K){T.aliases[K]=[Z].concat(T.aliases[Z].filter(function(U){return K!==U}))}))})})}function ce(_,W){const Z=[].concat(T.aliases[_]||[],_),K=Object.keys(W),U=Z.find(re=>K.includes(re));return U?W[U]:!1}function ke(_){const W=Object.keys(T);return[].concat(W.map(K=>T[K])).some(function(K){return Array.isArray(K)?K.includes(_):K[_]})}function ae(_,...W){return[].concat(...W).some(function(K){const U=_.match(K);return U&&ke(U[1])})}function De(_){if(_.match(X)||!_.match(/^-[^-]+/))return!1;let W=!0,Z;const K=_.slice(1).split("");for(let U=0;U<K.length;U++){if(Z=_.slice(U+2),!ke(K[U])){W=!1;break}if(K[U+1]&&K[U+1]==="="||Z==="-"||/[A-Za-z]/.test(K[U])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(Z)||K[U+1]&&K[U+1].match(/\W/))break}return W}function we(_){return d["unknown-options-as-args"]&&he(_)}function he(_){return _=_.replace(/^-{3,}/,"--"),_.match(X)||De(_)?!1:!ae(_,/^-+([^=]+?)=[\s\S]*$/,ne,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function Ae(_){return!ce(_,T.bools)&&!ce(_,T.counts)&&`${_}`in w?w[_]:Ee(Oe(_))}function Ee(_){return{[DefaultValuesForTypeKey.BOOLEAN]:!0,[DefaultValuesForTypeKey.STRING]:"",[DefaultValuesForTypeKey.NUMBER]:void 0,[DefaultValuesForTypeKey.ARRAY]:[]}[_]}function Oe(_){let W=DefaultValuesForTypeKey.BOOLEAN;return ce(_,T.strings)?W=DefaultValuesForTypeKey.STRING:ce(_,T.numbers)?W=DefaultValuesForTypeKey.NUMBER:ce(_,T.bools)?W=DefaultValuesForTypeKey.BOOLEAN:ce(_,T.arrays)&&(W=DefaultValuesForTypeKey.ARRAY),W}function Se(_){return _===void 0}function Ne(){Object.keys(T.counts).find(_=>ce(_,T.arrays)?(le=Error(H("Invalid configuration: %s, opts.count excludes opts.array.",_)),!0):ce(_,T.nargs)?(le=Error(H("Invalid configuration: %s, opts.count excludes opts.narg.",_)),!0):!1)}return{aliases:Object.assign({},T.aliases),argv:Object.assign(ve,fe),configuration:d,defaulted:Object.assign({},Q),error:le,newAliases:Object.assign({},z)}}}function combineAliases(s){const e=[],t=Object.create(null);let n=!0;for(Object.keys(s).forEach(function(o){e.push([].concat(s[o],o))});n;){n=!1;for(let o=0;o<e.length;o++)for(let a=o+1;a<e.length;a++)if(e[o].filter(function(d){return e[a].indexOf(d)!==-1}).length){e[o]=e[o].concat(e[a]),e.splice(a,1),n=!0;break}}return e.forEach(function(o){o=o.filter(function(l,d,w){return w.indexOf(l)===d});const a=o.pop();a!==void 0&&typeof a=="string"&&(t[a]=o)}),t}function increment(s){return s!==void 0?s+1:1}function sanitizeKey(s){return s==="__proto__"?"___proto___":s}function stripQuotes(s){return typeof s=="string"&&(s[0]==="'"||s[0]==='"')&&s[s.length-1]===s[0]?s.substring(1,s.length-1):s}var _a,_b,_c;const minNodeVersion=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,nodeVersion=(_b=(_a=process==null?void 0:process.versions)===null||_a===void 0?void 0:_a.node)!==null&&_b!==void 0?_b:(_c=process==null?void 0:process.version)===null||_c===void 0?void 0:_c.slice(1);if(nodeVersion&&Number(nodeVersion.match(/^([^.]+)/)[1])<minNodeVersion)throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const env=process?process.env:{},parser=new YargsParser({cwd:process.cwd,env:()=>env,format:require$$0$2.format,normalize:require$$0.normalize,resolve:require$$0.resolve,require:s=>{if(typeof require<"u")return require(s);if(s.match(/\.json$/))return JSON.parse(require$$0$1.readFileSync(s,"utf8"));throw Error("only .json config files are supported in ESM")}}),yargsParser=function(e,t){return parser.parse(e.slice(),t).argv};yargsParser.detailed=function(s,e){return parser.parse(s.slice(),e)},yargsParser.camelCase=camelCase,yargsParser.decamelize=decamelize,yargsParser.looksLikeNumber=looksLikeNumber;function getProcessArgvBinIndex(){return isBundledElectronApp()?0:1}function isBundledElectronApp(){return isElectronApp()&&!process.defaultApp}function isElectronApp(){return!!process.versions.electron}function hideBin(s){return s.slice(getProcessArgvBinIndex()+1)}function getProcessArgvBin(){return process.argv[getProcessArgvBinIndex()]}class YError extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,YError)}}const shim$3={fs:{readFileSync:require$$0$1.readFileSync,writeFile:require$$0$1.writeFile},format:require$$0$2.format,resolve:require$$0.resolve,exists:s=>{try{return require$$0$1.statSync(s).isFile()}catch{return!1}}};let shim$2;class Y18N{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);const t=e.shift();let 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(),shim$2.format.apply(shim$2.format,[this.cache[this.locale][t]||t].concat(e))}__n(){const e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),o=e.shift();let a=function(){};typeof e[e.length-1]=="function"&&(a=e.pop()),this.cache[this.locale]||this._readLocaleFile();let l=o===1?t:n;this.cache[this.locale][t]&&(l=this.cache[this.locale][t][o===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:a})):a();const d=[l];return~l.indexOf("%d")&&d.push(o),shim$2.format.apply(shim$2.format,d.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(const 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(o,a){const l=t[a+1];n+=o,typeof l<"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(){const e=this,t=this.writeQueue[0],n=t.directory,o=t.locale,a=t.cb,l=this._resolveLocaleFile(n,o),d=JSON.stringify(this.cache[o],null,2);shim$2.fs.writeFile(l,d,"utf-8",function(w){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),a(w)})}_readLocaleFile(){let e={};const t=this._resolveLocaleFile(this.directory,this.locale);try{shim$2.fs.readFileSync&&(e=JSON.parse(shim$2.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=shim$2.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){const o=shim$2.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(o)&&(n=o)}return n}_fileExistsSync(e){return shim$2.exists(e)}}function y18n$1(s,e){shim$2=e;const t=new Y18N(s);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}}const y18n=s=>y18n$1(s,shim$3),REQUIRE_ERROR="require is not supported by ESM",REQUIRE_DIRECTORY_ERROR="loading a directory of commands is not supported yet for ESM";let __dirname$1;try{__dirname$1=require$$0$3.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("cli/index.cjs",document.baseURI).href)}catch{__dirname$1=process.cwd()}const mainFilename=__dirname$1.substring(0,__dirname$1.lastIndexOf("node_modules")),shim$1={assert:{notStrictEqual:assert.notStrictEqual,strictEqual:assert.strictEqual},cliui:ui,findUp:escalade,getEnv:s=>process.env[s],inspect:require$$0$2.inspect,getCallerFile:()=>{throw new YError(REQUIRE_DIRECTORY_ERROR)},getProcessArgvBin,mainFilename:mainFilename||process.cwd(),Parser:yargsParser,path:{basename:require$$0.basename,dirname:require$$0.dirname,extname:require$$0.extname,relative:require$$0.relative,resolve:require$$0.resolve},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(s,e)=>process.emitWarning(s,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:require$$0$1.readFileSync,require:()=>{throw new YError(REQUIRE_ERROR)},requireDirectory:()=>{throw new YError(REQUIRE_DIRECTORY_ERROR)},stringWidth:s=>[...s].length,y18n:y18n({directory:require$$0.resolve(__dirname$1,"../../../locales"),updateFiles:!1})};function assertNotStrictEqual(s,e,t,n){t.assert.notStrictEqual(s,e,n)}function assertSingleKey(s,e){e.assert.strictEqual(typeof s,"string")}function objectKeys(s){return Object.keys(s)}function isPromise(s){return!!s&&!!s.then&&typeof s.then=="function"}function parseCommand(s){const t=s.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,o=t.shift();if(!o)throw new Error(`No command found in: ${s}`);const a={cmd:o.replace(n,""),demanded:[],optional:[]};return t.forEach((l,d)=>{let w=!1;l=l.replace(/\s/g,""),/\.+[\]>]/.test(l)&&d===t.length-1&&(w=!0),/^\[/.test(l)?a.optional.push({cmd:l.replace(n,"").split("|"),variadic:w}):a.demanded.push({cmd:l.replace(n,"").split("|"),variadic:w})}),a}const positionName=["first","second","third","fourth","fifth","sixth"];function argsert(s,e,t){function n(){return typeof s=="object"?[{demanded:[],optional:[]},s,e]:[parseCommand(`cmd ${s}`),e,t]}try{let o=0;const[a,l,d]=n(),w=[].slice.call(l);for(;w.length&&w[w.length-1]===void 0;)w.pop();const L=d||w.length;if(L<a.demanded.length)throw new YError(`Not enough arguments provided. Expected ${a.demanded.length} but received ${w.length}.`);const y=a.demanded.length+a.optional.length;if(L>y)throw new YError(`Too many arguments provided. Expected max ${y} but received ${L}.`);a.demanded.forEach(B=>{const N=w.shift(),z=guessType(N);B.cmd.filter(H=>H===z||H==="*").length===0&&argumentTypeError(z,B.cmd,o),o+=1}),a.optional.forEach(B=>{if(w.length===0)return;const N=w.shift(),z=guessType(N);B.cmd.filter(H=>H===z||H==="*").length===0&&argumentTypeError(z,B.cmd,o),o+=1})}catch(o){console.warn(o.stack)}}function guessType(s){return Array.isArray(s)?"array":s===null?"null":typeof s}function argumentTypeError(s,e,t){throw new YError(`Invalid ${positionName[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${s}.`)}class GlobalMiddleware{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,o=!1){if(argsert("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let a=0;a<e.length;a++){if(typeof e[a]!="function")throw Error("middleware must be a function");const l=e[a];l.applyBeforeValidation=t,l.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){const a=e;a.applyBeforeValidation=t,a.global=n,a.mutates=o,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){const n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(o=>{const a=[...n[t]||[],t];return o.option?!a.includes(o.option):!0}),e.option=t,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}}function commandMiddlewareFactory(s){return s?s.map(e=>(e.applyBeforeValidation=!1,e)):[]}function applyMiddleware(s,e,t,n){return t.reduce((o,a)=>{if(a.applyBeforeValidation!==n)return o;if(a.mutates){if(a.applied)return o;a.applied=!0}if(isPromise(o))return o.then(l=>Promise.all([l,a(l,e)])).then(([l,d])=>Object.assign(l,d));{const l=a(o,e);return isPromise(l)?l.then(d=>Object.assign(o,d)):Object.assign(o,l)}},s)}function maybeAsyncResult(s,e,t=n=>{throw n}){try{const n=isFunction(s)?s():s;return isPromise(n)?n.then(o=>e(o)):e(n)}catch(n){return t(n)}}function isFunction(s){return typeof s=="function"}function whichModule(s){if(typeof require>"u")return null;for(let e=0,t=Object.keys(require.cache),n;e<t.length;e++)if(n=require.cache[t[e]],n.exports===s)return n;return null}const DEFAULT_MARKER=/(^\*)|(^\$0)/;class CommandInstance{constructor(e,t,n,o){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=o,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,o){o=o||{},typeof o.recurse!="boolean"&&(o.recurse=!1),Array.isArray(o.extensions)||(o.extensions=["js"]);const a=typeof o.visit=="function"?o.visit:l=>l;o.visit=(l,d,w)=>{const L=a(l,d,w);if(L){if(this.requireCache.has(d))return L;this.requireCache.add(d),this.addHandler(L)}return L},this.shim.requireDirectory({require:t,filename:n},e,o)}addHandler(e,t,n,o,a,l){let d=[];const w=commandMiddlewareFactory(a);if(o=o||(()=>{}),Array.isArray(e))if(isCommandAndAliases(e))[e,...d]=e;else for(const L of e)this.addHandler(L);else if(isCommandHandlerDefinition(e)){let L=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(L=[].concat(L).concat(e.aliases)),this.addHandler(L,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(isCommandBuilderDefinition(n)){this.addHandler([e].concat(d),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){const L=parseCommand(e);d=d.map(N=>parseCommand(N).cmd);let y=!1;const B=[L.cmd].concat(d).filter(N=>DEFAULT_MARKER.test(N)?(y=!0,!1):!0);B.length===0&&y&&B.push("$0"),y&&(L.cmd=B[0],d=B.slice(1),e=e.replace(DEFAULT_MARKER,L.cmd)),d.forEach(N=>{this.aliasMap[N]=L.cmd}),t!==!1&&this.usage.command(e,t,y,d,l),this.handlers[L.cmd]={original:e,description:t,handler:o,builder:n||{},middlewares:w,deprecated:l,demanded:L.demanded,optional:L.optional},y&&(this.defaultCommand=this.handlers[L.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,o,a,l){const d=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,w=t.getInternalMethods().getContext(),L=w.commands.slice(),y=!e;e&&(w.commands.push(e),w.fullCommands.push(d.original));const B=this.applyBuilderUpdateUsageAndParse(y,d,t,n.aliases,L,o,a,l);return isPromise(B)?B.then(N=>this.applyMiddlewareAndGetResult(y,d,N.innerArgv,w,a,N.aliases,t)):this.applyMiddlewareAndGetResult(y,d,B.innerArgv,w,a,B.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,o,a,l,d,w){const L=t.builder;let y=n;if(isCommandBuilderCallback(L)){n.getInternalMethods().getUsageInstance().freeze();const B=L(n.getInternalMethods().reset(o),w);if(isPromise(B))return B.then(N=>(y=isYargsInstance(N)?N:n,this.parseAndUpdateUsage(e,t,y,a,l,d)))}else isCommandBuilderOptionDefinitions(L)&&(n.getInternalMethods().getUsageInstance().freeze(),y=n.getInternalMethods().reset(o),Object.keys(t.builder).forEach(B=>{y.option(B,L[B])}));return this.parseAndUpdateUsage(e,t,y,a,l,d)}parseAndUpdateUsage(e,t,n,o,a,l){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(o,t),t.description);const d=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,a,l);return isPromise(d)?d.then(w=>({aliases:n.parsed.aliases,innerArgv:w})):{aliases:n.parsed.aliases,innerArgv:d}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){const n=DEFAULT_MARKER.test(t.original)?t.original.replace(DEFAULT_MARKER,"").trim():t.original,o=e.filter(a=>!DEFAULT_MARKER.test(a));return o.push(n),`$0 ${o.join(" ")}`}handleValidationAndGetResult(e,t,n,o,a,l,d,w){if(!l.getInternalMethods().getHasOutput()){const L=l.getInternalMethods().runValidation(a,w,l.parsed.error,e);n=maybeAsyncResult(n,y=>(L(y),y))}if(t.handler&&!l.getInternalMethods().getHasOutput()){l.getInternalMethods().setHasOutput();const L=!!l.getOptions().configuration["populate--"];l.getInternalMethods().postProcess(n,L,!1,!1),n=applyMiddleware(n,l,d,!1),n=maybeAsyncResult(n,y=>{const B=t.handler(y);return isPromise(B)?B.then(()=>y):y}),e||l.getInternalMethods().getUsageInstance().cacheHelpMessage(),isPromise(n)&&!l.getInternalMethods().hasParseCallback()&&n.catch(y=>{try{l.getInternalMethods().getUsageInstance().fail(null,y)}catch{}})}return e||(o.commands.pop(),o.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,o,a,l,d){let w={};if(a)return n;d.getInternalMethods().getHasOutput()||(w=this.populatePositionals(t,n,o,d));const L=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),y=applyMiddleware(n,d,L,!0);return isPromise(y)?y.then(B=>this.handleValidationAndGetResult(e,t,B,o,l,d,L,w)):this.handleValidationAndGetResult(e,t,y,o,l,d,L,w)}populatePositionals(e,t,n,o){t._=t._.slice(n.commands.length);const a=e.demanded.slice(0),l=e.optional.slice(0),d={};for(this.validation.positionalCount(a.length,t._.length);a.length;){const w=a.shift();this.populatePositional(w,t,d)}for(;l.length;){const w=l.shift();this.populatePositional(w,t,d)}return t._=n.commands.concat(t._.map(w=>""+w)),this.postProcessPositionals(t,d,this.cmdToParseOptions(e.original),o),d}populatePositional(e,t,n){const o=e.cmd[0];e.variadic?n[o]=t._.splice(0).map(String):t._.length&&(n[o]=[String(t._.shift())])}cmdToParseOptions(e){const t={array:[],default:{},alias:{},demand:{}},n=parseCommand(e);return n.demanded.forEach(o=>{const[a,...l]=o.cmd;o.variadic&&(t.array.push(a),t.default[a]=[]),t.alias[a]=l,t.demand[a]=!0}),n.optional.forEach(o=>{const[a,...l]=o.cmd;o.variadic&&(t.array.push(a),t.default[a]=[]),t.alias[a]=l}),t}postProcessPositionals(e,t,n,o){const a=Object.assign({},o.getOptions());a.default=Object.assign(n.default,a.default);for(const L of Object.keys(n.alias))a.alias[L]=(a.alias[L]||[]).concat(n.alias[L]);a.array=a.array.concat(n.array),a.config={};const l=[];if(Object.keys(t).forEach(L=>{t[L].map(y=>{a.configuration["unknown-options-as-args"]&&(a.key[L]=!0),l.push(`--${L}`),l.push(y)})}),!l.length)return;const d=Object.assign({},a.configuration,{"populate--":!1}),w=this.shim.Parser.detailed(l,Object.assign({},a,{configuration:d}));if(w.error)o.getInternalMethods().getUsageInstance().fail(w.error.message,w.error);else{const L=Object.keys(t);Object.keys(t).forEach(y=>{L.push(...w.aliases[y])}),Object.keys(w.argv).forEach(y=>{L.includes(y)&&(t[y]||(t[y]=w.argv[y]),!this.isInConfigs(o,y)&&!this.isDefaulted(o,y)&&Object.prototype.hasOwnProperty.call(e,y)&&Object.prototype.hasOwnProperty.call(w.argv,y)&&(Array.isArray(e[y])||Array.isArray(w.argv[y]))?e[y]=[].concat(e[y],w.argv[y]):e[y]=w.argv[y])})}}isDefaulted(e,t){const{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){const{configObjects:n}=e.getOptions();return n.some(o=>Object.prototype.hasOwnProperty.call(o,t))||n.some(o=>Object.prototype.hasOwnProperty.call(o,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){const n=DEFAULT_MARKER.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}const t=this.defaultCommand.builder;if(isCommandBuilderCallback(t))return t(e,!0);isCommandBuilderDefinition(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){const t=whichModule(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(const o of[e,t,n]){if(typeof o=="string"||o===!1)return o;assertNotStrictEqual(o,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const e=this.frozens.pop();assertNotStrictEqual(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 command(s,e,t,n){return new CommandInstance(s,e,t,n)}function isCommandBuilderDefinition(s){return typeof s=="object"&&!!s.builder&&typeof s.handler=="function"}function isCommandAndAliases(s){return s.every(e=>typeof e=="string")}function isCommandBuilderCallback(s){return typeof s=="function"}function isCommandBuilderOptionDefinitions(s){return typeof s=="object"}function isCommandHandlerDefinition(s){return typeof s=="object"&&!Array.isArray(s)}function objFilter(s={},e=()=>!0){const t={};return objectKeys(s).forEach(n=>{e(n,s[n])&&(t[n]=s[n])}),t}function setBlocking(s){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{const t=e;t._handle&&t.isTTY&&typeof t._handle.setBlocking=="function"&&t._handle.setBlocking(s)})}function isBoolean(s){return typeof s=="boolean"}function usage(s,e){const t=e.y18n.__,n={},o=[];n.failFn=function(ee){o.push(ee)};let a=null,l=null,d=!0;n.showHelpOnFail=function(ee=!0,ie){const[de,me]=typeof ee=="string"?[!0,ee]:[ee,ie];return s.getInternalMethods().isGlobalContext()&&(l=me),a=me,d=de,n};let w=!1;n.fail=function(ee,ie){const de=s.getInternalMethods().getLoggerInstance();if(o.length)for(let me=o.length-1;me>=0;--me){const be=o[me];if(isBoolean(be)){if(ie)throw ie;if(ee)throw Error(ee)}else be(ee,ie,n)}else{if(s.getExitProcess()&&setBlocking(!0),!w){w=!0,d&&(s.showHelp("error"),de.error()),(ee||ie)&&de.error(ee||ie);const me=a||l;me&&((ee||ie)&&de.error(""),de.error(me))}if(ie=ie||new YError(ee),s.getExitProcess())return s.exit(1);if(s.getInternalMethods().hasParseCallback())return s.exit(1,ie);throw ie}};let L=[],y=!1;n.usage=(se,ee)=>se===null?(y=!0,L=[],n):(y=!1,L.push([se,ee||""]),n),n.getUsage=()=>L,n.getUsageDisabled=()=>y,n.getPositionalGroupName=()=>t("Positionals:");let B=[];n.example=(se,ee)=>{B.push([se,ee||""])};let N=[];n.command=function(ee,ie,de,me,be=!1){de&&(N=N.map(pe=>(pe[2]=!1,pe))),N.push([ee,ie||"",de,me,be])},n.getCommands=()=>N;let z={};n.describe=function(ee,ie){Array.isArray(ee)?ee.forEach(de=>{n.describe(de,ie)}):typeof ee=="object"?Object.keys(ee).forEach(de=>{n.describe(de,ee[de])}):z[ee]=ie},n.getDescriptions=()=>z;let Q=[];n.epilog=se=>{Q.push(se)};let H=!1,T;n.wrap=se=>{H=!0,T=se},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(H||(T=Pe(),H=!0),T);const X="__yargsString__:";n.deferY18nLookup=se=>X+se,n.help=function(){if(ue)return ue;le();const ee=s.customScriptName?s.$0:e.path.basename(s.$0),ie=s.getDemandedOptions(),de=s.getDemandedCommands(),me=s.getDeprecatedOptions(),be=s.getGroups(),pe=s.getOptions();let Fe=[];Fe=Fe.concat(Object.keys(z)),Fe=Fe.concat(Object.keys(ie)),Fe=Fe.concat(Object.keys(de)),Fe=Fe.concat(Object.keys(pe.default)),Fe=Fe.filter(ve),Fe=Object.keys(Fe.reduce((ae,De)=>(De!=="_"&&(ae[De]=!0),ae),{}));const je=n.getWrap(),Ce=e.cliui({width:je,wrap:!!je});if(!y){if(L.length)L.forEach(ae=>{Ce.div({text:`${ae[0].replace(/\$0/g,ee)}`}),ae[1]&&Ce.div({text:`${ae[1]}`,padding:[1,0,0,0]})}),Ce.div();else if(N.length){let ae=null;de._?ae=`${ee} <${t("command")}>
8
8
  `:ae=`${ee} [${t("command")}]
9
9
  `,Ce.div(`${ae}`)}}if(N.length>1||N.length===1&&!N[0][2]){Ce.div(t("Commands:"));const ae=s.getInternalMethods().getContext(),De=ae.commands.length?`${ae.commands.join(" ")} `:"";s.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(N=N.sort((he,Ae)=>he[0].localeCompare(Ae[0])));const we=ee?`${ee} `:"";N.forEach(he=>{const Ae=`${we}${De}${he[0].replace(/^\$0 ?/,"")}`;Ce.span({text:Ae,padding:[0,2,0,2],width:ne(N,je,`${ee}${De}`)+4},{text:he[1]});const Ee=[];he[2]&&Ee.push(`[${t("default")}]`),he[3]&&he[3].length&&Ee.push(`[${t("aliases:")} ${he[3].join(", ")}]`),he[4]&&(typeof he[4]=="string"?Ee.push(`[${t("deprecated: %s",he[4])}]`):Ee.push(`[${t("deprecated")}]`)),Ee.length?Ce.div({text:Ee.join(" "),padding:[0,0,0,2],align:"right"}):Ce.div()}),Ce.div()}const xe=(Object.keys(pe.alias)||[]).concat(Object.keys(s.parsed.newAliases)||[]);Fe=Fe.filter(ae=>!s.parsed.newAliases[ae]&&xe.every(De=>(pe.alias[De]||[]).indexOf(ae)===-1));const Ie=t("Options:");be[Ie]||(be[Ie]=[]),fe(Fe,pe.alias,be,Ie);const Le=ae=>/^--/.test(getText(ae)),ce=Object.keys(be).filter(ae=>be[ae].length>0).map(ae=>{const De=be[ae].filter(ve).map(we=>{if(xe.includes(we))return we;for(let he=0,Ae;(Ae=xe[he])!==void 0;he++)if((pe.alias[Ae]||[]).includes(we))return Ae;return we});return{groupName:ae,normalizedKeys:De}}).filter(({normalizedKeys:ae})=>ae.length>0).map(({groupName:ae,normalizedKeys:De})=>{const we=De.reduce((he,Ae)=>(he[Ae]=[Ae].concat(pe.alias[Ae]||[]).map(Ee=>ae===n.getPositionalGroupName()?Ee:(/^[0-9]$/.test(Ee)?pe.boolean.includes(Ae)?"-":"--":Ee.length>1?"--":"-")+Ee).sort((Ee,Oe)=>Le(Ee)===Le(Oe)?0:Le(Ee)?1:-1).join(", "),he),{});return{groupName:ae,normalizedKeys:De,switches:we}});if(ce.filter(({groupName:ae})=>ae!==n.getPositionalGroupName()).some(({normalizedKeys:ae,switches:De})=>!ae.every(we=>Le(De[we])))&&ce.filter(({groupName:ae})=>ae!==n.getPositionalGroupName()).forEach(({normalizedKeys:ae,switches:De})=>{ae.forEach(we=>{Le(De[we])&&(De[we]=addIndentation(De[we],4))})}),ce.forEach(({groupName:ae,normalizedKeys:De,switches:we})=>{Ce.div(ae),De.forEach(he=>{const Ae=we[he];let Ee=z[he]||"",Oe=null;Ee.includes(X)&&(Ee=t(Ee.substring(X.length))),pe.boolean.includes(he)&&(Oe=`[${t("boolean")}]`),pe.count.includes(he)&&(Oe=`[${t("count")}]`),pe.string.includes(he)&&(Oe=`[${t("string")}]`),pe.normalize.includes(he)&&(Oe=`[${t("string")}]`),pe.array.includes(he)&&(Oe=`[${t("array")}]`),pe.number.includes(he)&&(Oe=`[${t("number")}]`);const Se=W=>typeof W=="string"?`[${t("deprecated: %s",W)}]`:`[${t("deprecated")}]`,Ne=[he in me?Se(me[he]):null,Oe,he in ie?`[${t("required")}]`:null,pe.choices&&pe.choices[he]?`[${t("choices:")} ${n.stringifiedValues(pe.choices[he])}]`:null,_e(pe.default[he],pe.defaultDescription[he])].filter(Boolean).join(" ");Ce.span({text:getText(Ae),padding:[0,2,0,2+getIndentation(Ae)],width:ne(we,je)+4},Ee);const _=s.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;Ne&&!_?Ce.div({text:Ne,padding:[0,0,0,2],align:"right"}):Ce.div()}),Ce.div()}),B.length&&(Ce.div(t("Examples:")),B.forEach(ae=>{ae[0]=ae[0].replace(/\$0/g,ee)}),B.forEach(ae=>{ae[1]===""?Ce.div({text:ae[0],padding:[0,2,0,2]}):Ce.div({text:ae[0],padding:[0,2,0,2],width:ne(B,je)+4},{text:ae[1]})}),Ce.div()),Q.length>0){const ae=Q.map(De=>De.replace(/\$0/g,ee)).join(`
10
10
  `);Ce.div(`${ae}
11
- `)}return Ce.toString().replace(/\s*$/,"")};function ne(se,ee,ie){let de=0;return Array.isArray(se)||(se=Object.values(se).map(me=>[me])),se.forEach(me=>{de=Math.max(e.stringWidth(ie?`${ie} ${getText(me[0])}`:getText(me[0]))+getIndentation(me[0]),de)}),ee&&(de=Math.min(de,parseInt((ee*.5).toString(),10))),de}function le(){const se=s.getDemandedOptions(),ee=s.getOptions();(Object.keys(ee.alias)||[]).forEach(ie=>{ee.alias[ie].forEach(de=>{z[de]&&n.describe(ie,z[de]),de in se&&s.demandOption(ie,se[de]),ee.boolean.includes(de)&&s.boolean(ie),ee.count.includes(de)&&s.count(ie),ee.string.includes(de)&&s.string(ie),ee.normalize.includes(de)&&s.normalize(ie),ee.array.includes(de)&&s.array(ie),ee.number.includes(de)&&s.number(ie)})})}let oe;n.cacheHelpMessage=function(){oe=this.help()},n.clearCachedHelpMessage=function(){oe=void 0},n.hasCachedHelpMessage=function(){return!!oe};function fe(se,ee,ie,de){let me=[],be=null;return Object.keys(ie).forEach(pe=>{me=me.concat(ie[pe])}),se.forEach(pe=>{be=[pe].concat(ee[pe]),be.some(Fe=>me.indexOf(Fe)!==-1)||ie[de].push(pe)}),me}function ve(se){return s.getOptions().hiddenOptions.indexOf(se)<0||s.parsed.argv[s.getOptions().showHiddenOpt]}n.showHelp=se=>{const ee=s.getInternalMethods().getLoggerInstance();se||(se="error"),(typeof se=="function"?se:ee[se])(n.help())},n.functionDescription=se=>["(",se.name?e.Parser.decamelize(se.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(ee,ie){let de="";const me=ie||", ",be=[].concat(ee);return!ee||!be.length||be.forEach(pe=>{de.length&&(de+=me),de+=JSON.stringify(pe)}),de};function _e(se,ee){let ie=`[${t("default:")} `;if(se===void 0&&!ee)return null;if(ee)ie+=ee;else switch(typeof se){case"string":ie+=`"${se}"`;break;case"object":ie+=JSON.stringify(se);break;default:ie+=se}return`${ie}]`}function Pe(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let $e=null;n.version=se=>{$e=se},n.showVersion=se=>{const ee=s.getInternalMethods().getLoggerInstance();se||(se="error"),(typeof se=="function"?se:ee[se])($e)},n.reset=function(ee){return a=null,w=!1,L=[],y=!1,Q=[],B=[],N=[],z=objFilter(z,ie=>!ee[ie]),n};const ge=[];return n.freeze=function(){ge.push({failMessage:a,failureOutput:w,usages:L,usageDisabled:y,epilogs:Q,examples:B,commands:N,descriptions:z})},n.unfreeze=function(ee=!1){const ie=ge.pop();ie&&(ee?(z={...ie.descriptions,...z},N=[...ie.commands,...N],L=[...ie.usages,...L],B=[...ie.examples,...B],Q=[...ie.epilogs,...Q]):{failMessage:a,failureOutput:w,usages:L,usageDisabled:y,epilogs:Q,examples:B,commands:N,descriptions:z}=ie)},n}function isIndentedText(s){return typeof s=="object"}function addIndentation(s,e){return isIndentedText(s)?{text:s.text,indentation:s.indentation+e}:{text:s,indentation:e}}function getIndentation(s){return isIndentedText(s)?s.indentation:0}function getText(s){return isIndentedText(s)?s.text:s}const completionShTemplate=`###-begin-{{app_name}}-completions-###
11
+ `)}return Ce.toString().replace(/\s*$/,"")};function ne(se,ee,ie){let de=0;return Array.isArray(se)||(se=Object.values(se).map(me=>[me])),se.forEach(me=>{de=Math.max(e.stringWidth(ie?`${ie} ${getText(me[0])}`:getText(me[0]))+getIndentation(me[0]),de)}),ee&&(de=Math.min(de,parseInt((ee*.5).toString(),10))),de}function le(){const se=s.getDemandedOptions(),ee=s.getOptions();(Object.keys(ee.alias)||[]).forEach(ie=>{ee.alias[ie].forEach(de=>{z[de]&&n.describe(ie,z[de]),de in se&&s.demandOption(ie,se[de]),ee.boolean.includes(de)&&s.boolean(ie),ee.count.includes(de)&&s.count(ie),ee.string.includes(de)&&s.string(ie),ee.normalize.includes(de)&&s.normalize(ie),ee.array.includes(de)&&s.array(ie),ee.number.includes(de)&&s.number(ie)})})}let ue;n.cacheHelpMessage=function(){ue=this.help()},n.clearCachedHelpMessage=function(){ue=void 0},n.hasCachedHelpMessage=function(){return!!ue};function fe(se,ee,ie,de){let me=[],be=null;return Object.keys(ie).forEach(pe=>{me=me.concat(ie[pe])}),se.forEach(pe=>{be=[pe].concat(ee[pe]),be.some(Fe=>me.indexOf(Fe)!==-1)||ie[de].push(pe)}),me}function ve(se){return s.getOptions().hiddenOptions.indexOf(se)<0||s.parsed.argv[s.getOptions().showHiddenOpt]}n.showHelp=se=>{const ee=s.getInternalMethods().getLoggerInstance();se||(se="error"),(typeof se=="function"?se:ee[se])(n.help())},n.functionDescription=se=>["(",se.name?e.Parser.decamelize(se.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(ee,ie){let de="";const me=ie||", ",be=[].concat(ee);return!ee||!be.length||be.forEach(pe=>{de.length&&(de+=me),de+=JSON.stringify(pe)}),de};function _e(se,ee){let ie=`[${t("default:")} `;if(se===void 0&&!ee)return null;if(ee)ie+=ee;else switch(typeof se){case"string":ie+=`"${se}"`;break;case"object":ie+=JSON.stringify(se);break;default:ie+=se}return`${ie}]`}function Pe(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let $e=null;n.version=se=>{$e=se},n.showVersion=se=>{const ee=s.getInternalMethods().getLoggerInstance();se||(se="error"),(typeof se=="function"?se:ee[se])($e)},n.reset=function(ee){return a=null,w=!1,L=[],y=!1,Q=[],B=[],N=[],z=objFilter(z,ie=>!ee[ie]),n};const ge=[];return n.freeze=function(){ge.push({failMessage:a,failureOutput:w,usages:L,usageDisabled:y,epilogs:Q,examples:B,commands:N,descriptions:z})},n.unfreeze=function(ee=!1){const ie=ge.pop();ie&&(ee?(z={...ie.descriptions,...z},N=[...ie.commands,...N],L=[...ie.usages,...L],B=[...ie.examples,...B],Q=[...ie.epilogs,...Q]):{failMessage:a,failureOutput:w,usages:L,usageDisabled:y,epilogs:Q,examples:B,commands:N,descriptions:z}=ie)},n}function isIndentedText(s){return typeof s=="object"}function addIndentation(s,e){return isIndentedText(s)?{text:s.text,indentation:s.indentation+e}:{text:s,indentation:e}}function getIndentation(s){return isIndentedText(s)?s.indentation:0}function getText(s){return isIndentedText(s)?s.text:s}const completionShTemplate=`###-begin-{{app_name}}-completions-###
12
12
  #
13
13
  # yargs command completion script
14
14
  #
@@ -57,12 +57,12 @@ compdef _{{app_name}}_yargs_completions {{app_name}}
57
57
  ###-end-{{app_name}}-completions-###
58
58
  `;class Completion{constructor(e,t,n,o){var a,l,d;this.yargs=e,this.usage=t,this.command=n,this.shim=o,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(d=((a=this.shim.getEnv("SHELL"))===null||a===void 0?void 0:a.includes("zsh"))||((l=this.shim.getEnv("ZSH_NAME"))===null||l===void 0?void 0:l.includes("zsh")))!==null&&d!==void 0?d:!1}defaultCompletion(e,t,n,o){const a=this.command.getCommandHandlers();for(let d=0,w=e.length;d<w;++d)if(a[e[d]]&&a[e[d]].builder){const L=a[e[d]].builder;if(isCommandBuilderCallback(L)){this.indexAfterLastReset=d+1;const y=this.yargs.getInternalMethods().reset();return L(y,!0),y.argv}}const l=[];this.commandCompletions(l,e,n),this.optionCompletions(l,e,t,n),this.choicesFromOptionsCompletions(l,e,t,n),this.choicesFromPositionalsCompletions(l,e,t,n),o(null,l)}commandCompletions(e,t,n){const o=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&o[o.length-1]!==n&&!this.previousArgHasChoices(t)&&this.usage.getCommands().forEach(a=>{const l=parseCommand(a[0]).cmd;if(t.indexOf(l)===-1)if(!this.zshShell)e.push(l);else{const d=a[1]||"";e.push(l.replace(/:/g,"\\:")+":"+d)}})}optionCompletions(e,t,n,o){if((o.match(/^-/)||o===""&&e.length===0)&&!this.previousArgHasChoices(t)){const a=this.yargs.getOptions(),l=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(a.key).forEach(d=>{const w=!!a.configuration["boolean-negation"]&&a.boolean.includes(d);!l.includes(d)&&!a.hiddenOptions.includes(d)&&!this.argsContainKey(t,d,w)&&this.completeOptionKey(d,e,o,w&&!!a.default[d])})}}choicesFromOptionsCompletions(e,t,n,o){if(this.previousArgHasChoices(t)){const a=this.getPreviousArgChoices(t);a&&a.length>0&&e.push(...a.map(l=>l.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,t,n,o){if(o===""&&e.length>0&&this.previousArgHasChoices(t))return;const a=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],l=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),d=a[n._.length-l-1];if(!d)return;const w=this.yargs.getOptions().choices[d]||[];for(const L of w)L.startsWith(o)&&e.push(L.replace(/:/g,"\\:"))}getPreviousArgChoices(e){if(e.length<1)return;let t=e[e.length-1],n="";if(!t.startsWith("-")&&e.length>1&&(n=t,t=e[e.length-2]),!t.startsWith("-"))return;const o=t.replace(/^-+/,""),a=this.yargs.getOptions(),l=[o,...this.yargs.getAliases()[o]||[]];let d;for(const w of l)if(Object.prototype.hasOwnProperty.call(a.key,w)&&Array.isArray(a.choices[w])){d=a.choices[w];break}if(d)return d.filter(w=>!n||w.startsWith(n))}previousArgHasChoices(e){const t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){const o=a=>e.indexOf((/^[^0-9]$/.test(a)?"-":"--")+a)!==-1;if(o(t)||n&&o(`no-${t}`))return!0;if(this.aliases){for(const a of this.aliases[t])if(o(a))return!0}return!1}completeOptionKey(e,t,n,o){var a,l,d,w;let L=e;if(this.zshShell){const z=this.usage.getDescriptions(),Q=(l=(a=this===null||this===void 0?void 0:this.aliases)===null||a===void 0?void 0:a[e])===null||l===void 0?void 0:l.find(X=>{const ne=z[X];return typeof ne=="string"&&ne.length>0}),H=Q?z[Q]:void 0,T=(w=(d=z[e])!==null&&d!==void 0?d:H)!==null&&w!==void 0?w:"";L=`${e.replace(/:/g,"\\:")}:${T.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const y=z=>/^--/.test(z),B=z=>/^[^0-9]$/.test(z),N=!y(n)&&B(e)?"-":"--";t.push(N+L),o&&t.push(N+"no-"+L)}customCompletion(e,t,n,o){if(assertNotStrictEqual(this.customCompletionFunction,null,this.shim),isSyncCompletionFunction(this.customCompletionFunction)){const a=this.customCompletionFunction(n,t);return isPromise(a)?a.then(l=>{this.shim.process.nextTick(()=>{o(null,l)})}).catch(l=>{this.shim.process.nextTick(()=>{o(l,void 0)})}):o(null,a)}else return isFallbackCompletionFunction(this.customCompletionFunction)?this.customCompletionFunction(n,t,(a=o)=>this.defaultCompletion(e,t,n,a),a=>{o(null,a)}):this.customCompletionFunction(n,t,a=>{o(null,a)})}getCompletion(e,t){const n=e.length?e[e.length-1]:"",o=this.yargs.parse(e,!0),a=this.customCompletionFunction?l=>this.customCompletion(e,l,n,t):l=>this.defaultCompletion(e,l,n,t);return isPromise(o)?o.then(a):a(o)}generateCompletionScript(e,t){let n=this.zshShell?completionZshTemplate:completionShTemplate;const o=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,o),n=n.replace(/{{completion_command}}/g,t),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}}function completion(s,e,t,n){return new Completion(s,e,t,n)}function isSyncCompletionFunction(s){return s.length<3}function isFallbackCompletionFunction(s){return s.length>3}function levenshtein(s,e){if(s.length===0)return e.length;if(e.length===0)return s.length;const t=[];let n;for(n=0;n<=e.length;n++)t[n]=[n];let o;for(o=0;o<=s.length;o++)t[0][o]=o;for(n=1;n<=e.length;n++)for(o=1;o<=s.length;o++)e.charAt(n-1)===s.charAt(o-1)?t[n][o]=t[n-1][o-1]:n>1&&o>1&&e.charAt(n-2)===s.charAt(o-1)&&e.charAt(n-1)===s.charAt(o-2)?t[n][o]=t[n-2][o-2]+1:t[n][o]=Math.min(t[n-1][o-1]+1,Math.min(t[n][o-1]+1,t[n-1][o]+1));return t[e.length][s.length]}const specialKeys=["$0","--","_"];function validation(s,e,t){const n=t.y18n.__,o=t.y18n.__n,a={};a.nonOptionCount=function(B){const N=s.getDemandedCommands(),Q=B._.length+(B["--"]?B["--"].length:0)-s.getInternalMethods().getContext().commands.length;N._&&(Q<N._.min||Q>N._.max)&&(Q<N._.min?N._.minMsg!==void 0?e.fail(N._.minMsg?N._.minMsg.replace(/\$0/g,Q.toString()).replace(/\$1/,N._.min.toString()):null):e.fail(o("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",Q,Q.toString(),N._.min.toString())):Q>N._.max&&(N._.maxMsg!==void 0?e.fail(N._.maxMsg?N._.maxMsg.replace(/\$0/g,Q.toString()).replace(/\$1/,N._.max.toString()):null):e.fail(o("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",Q,Q.toString(),N._.max.toString()))))},a.positionalCount=function(B,N){N<B&&e.fail(o("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",N,N+"",B+""))},a.requiredArguments=function(B,N){let z=null;for(const Q of Object.keys(N))(!Object.prototype.hasOwnProperty.call(B,Q)||typeof B[Q]>"u")&&(z=z||{},z[Q]=N[Q]);if(z){const Q=[];for(const T of Object.keys(z)){const X=z[T];X&&Q.indexOf(X)<0&&Q.push(X)}const H=Q.length?`
59
59
  ${Q.join(`
60
- `)}`:"";e.fail(o("Missing required argument: %s","Missing required arguments: %s",Object.keys(z).length,Object.keys(z).join(", ")+H))}},a.unknownArguments=function(B,N,z,Q,H=!0){var T;const X=s.getInternalMethods().getCommandInstance().getCommands(),ne=[],le=s.getInternalMethods().getContext();if(Object.keys(B).forEach(oe=>{!specialKeys.includes(oe)&&!Object.prototype.hasOwnProperty.call(z,oe)&&!Object.prototype.hasOwnProperty.call(s.getInternalMethods().getParseContext(),oe)&&!a.isValidAndSomeAliasIsNotNew(oe,N)&&ne.push(oe)}),H&&(le.commands.length>0||X.length>0||Q)&&B._.slice(le.commands.length).forEach(oe=>{X.includes(""+oe)||ne.push(""+oe)}),H){const fe=((T=s.getDemandedCommands()._)===null||T===void 0?void 0:T.max)||0,ve=le.commands.length+fe;ve<B._.length&&B._.slice(ve).forEach(_e=>{_e=String(_e),!le.commands.includes(_e)&&!ne.includes(_e)&&ne.push(_e)})}ne.length&&e.fail(o("Unknown argument: %s","Unknown arguments: %s",ne.length,ne.map(oe=>oe.trim()?oe:`"${oe}"`).join(", ")))},a.unknownCommands=function(B){const N=s.getInternalMethods().getCommandInstance().getCommands(),z=[],Q=s.getInternalMethods().getContext();return(Q.commands.length>0||N.length>0)&&B._.slice(Q.commands.length).forEach(H=>{N.includes(""+H)||z.push(""+H)}),z.length>0?(e.fail(o("Unknown command: %s","Unknown commands: %s",z.length,z.join(", "))),!0):!1},a.isValidAndSomeAliasIsNotNew=function(B,N){if(!Object.prototype.hasOwnProperty.call(N,B))return!1;const z=s.parsed.newAliases;return[B,...N[B]].some(Q=>!Object.prototype.hasOwnProperty.call(z,Q)||!z[B])},a.limitedChoices=function(B){const N=s.getOptions(),z={};if(!Object.keys(N.choices).length)return;Object.keys(B).forEach(T=>{specialKeys.indexOf(T)===-1&&Object.prototype.hasOwnProperty.call(N.choices,T)&&[].concat(B[T]).forEach(X=>{N.choices[T].indexOf(X)===-1&&X!==void 0&&(z[T]=(z[T]||[]).concat(X))})});const Q=Object.keys(z);if(!Q.length)return;let H=n("Invalid values:");Q.forEach(T=>{H+=`
60
+ `)}`:"";e.fail(o("Missing required argument: %s","Missing required arguments: %s",Object.keys(z).length,Object.keys(z).join(", ")+H))}},a.unknownArguments=function(B,N,z,Q,H=!0){var T;const X=s.getInternalMethods().getCommandInstance().getCommands(),ne=[],le=s.getInternalMethods().getContext();if(Object.keys(B).forEach(ue=>{!specialKeys.includes(ue)&&!Object.prototype.hasOwnProperty.call(z,ue)&&!Object.prototype.hasOwnProperty.call(s.getInternalMethods().getParseContext(),ue)&&!a.isValidAndSomeAliasIsNotNew(ue,N)&&ne.push(ue)}),H&&(le.commands.length>0||X.length>0||Q)&&B._.slice(le.commands.length).forEach(ue=>{X.includes(""+ue)||ne.push(""+ue)}),H){const fe=((T=s.getDemandedCommands()._)===null||T===void 0?void 0:T.max)||0,ve=le.commands.length+fe;ve<B._.length&&B._.slice(ve).forEach(_e=>{_e=String(_e),!le.commands.includes(_e)&&!ne.includes(_e)&&ne.push(_e)})}ne.length&&e.fail(o("Unknown argument: %s","Unknown arguments: %s",ne.length,ne.map(ue=>ue.trim()?ue:`"${ue}"`).join(", ")))},a.unknownCommands=function(B){const N=s.getInternalMethods().getCommandInstance().getCommands(),z=[],Q=s.getInternalMethods().getContext();return(Q.commands.length>0||N.length>0)&&B._.slice(Q.commands.length).forEach(H=>{N.includes(""+H)||z.push(""+H)}),z.length>0?(e.fail(o("Unknown command: %s","Unknown commands: %s",z.length,z.join(", "))),!0):!1},a.isValidAndSomeAliasIsNotNew=function(B,N){if(!Object.prototype.hasOwnProperty.call(N,B))return!1;const z=s.parsed.newAliases;return[B,...N[B]].some(Q=>!Object.prototype.hasOwnProperty.call(z,Q)||!z[B])},a.limitedChoices=function(B){const N=s.getOptions(),z={};if(!Object.keys(N.choices).length)return;Object.keys(B).forEach(T=>{specialKeys.indexOf(T)===-1&&Object.prototype.hasOwnProperty.call(N.choices,T)&&[].concat(B[T]).forEach(X=>{N.choices[T].indexOf(X)===-1&&X!==void 0&&(z[T]=(z[T]||[]).concat(X))})});const Q=Object.keys(z);if(!Q.length)return;let H=n("Invalid values:");Q.forEach(T=>{H+=`
61
61
  ${n("Argument: %s, Given: %s, Choices: %s",T,e.stringifiedValues(z[T]),e.stringifiedValues(N.choices[T]))}`}),e.fail(H)};let l={};a.implies=function(B,N){argsert("<string|object> [array|number|string]",[B,N],arguments.length),typeof B=="object"?Object.keys(B).forEach(z=>{a.implies(z,B[z])}):(s.global(B),l[B]||(l[B]=[]),Array.isArray(N)?N.forEach(z=>a.implies(B,z)):(assertNotStrictEqual(N,void 0,t),l[B].push(N)))},a.getImplied=function(){return l};function d(y,B){const N=Number(B);return B=isNaN(N)?B:N,typeof B=="number"?B=y._.length>=B:B.match(/^--no-.+/)?(B=B.match(/^--no-(.+)/)[1],B=!Object.prototype.hasOwnProperty.call(y,B)):B=Object.prototype.hasOwnProperty.call(y,B),B}a.implications=function(B){const N=[];if(Object.keys(l).forEach(z=>{const Q=z;(l[z]||[]).forEach(H=>{let T=Q;const X=H;T=d(B,T),H=d(B,H),T&&!H&&N.push(` ${Q} -> ${X}`)})}),N.length){let z=`${n("Implications failed:")}
62
62
  `;N.forEach(Q=>{z+=Q}),e.fail(z)}};let w={};a.conflicts=function(B,N){argsert("<string|object> [array|string]",[B,N],arguments.length),typeof B=="object"?Object.keys(B).forEach(z=>{a.conflicts(z,B[z])}):(s.global(B),w[B]||(w[B]=[]),Array.isArray(N)?N.forEach(z=>a.conflicts(B,z)):w[B].push(N))},a.getConflicting=()=>w,a.conflicting=function(B){Object.keys(B).forEach(N=>{w[N]&&w[N].forEach(z=>{z&&B[N]!==void 0&&B[z]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",N,z))})}),s.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(w).forEach(N=>{w[N].forEach(z=>{z&&B[t.Parser.camelCase(N)]!==void 0&&B[t.Parser.camelCase(z)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",N,z))})})},a.recommendCommands=function(B,N){N=N.sort((T,X)=>X.length-T.length);let Q=null,H=1/0;for(let T=0,X;(X=N[T])!==void 0;T++){const ne=levenshtein(B,X);ne<=3&&ne<H&&(H=ne,Q=X)}Q&&e.fail(n("Did you mean %s?",Q))},a.reset=function(B){return l=objFilter(l,N=>!B[N]),w=objFilter(w,N=>!B[N]),a};const L=[];return a.freeze=function(){L.push({implied:l,conflicting:w})},a.unfreeze=function(){const B=L.pop();assertNotStrictEqual(B,void 0,t),{implied:l,conflicting:w}=B},a}let previouslyVisitedConfigs=[],shim;function applyExtends(s,e,t,n){shim=n;let o={};if(Object.prototype.hasOwnProperty.call(s,"extends")){if(typeof s.extends!="string")return o;const a=/\.json|\..*rc$/.test(s.extends);let l=null;if(a)l=getPathToDefaultConfig(e,s.extends);else try{l=require.resolve(s.extends)}catch{return s}checkForCircularExtends(l),previouslyVisitedConfigs.push(l),o=a?JSON.parse(shim.readFileSync(l,"utf8")):require(s.extends),delete s.extends,o=applyExtends(o,shim.path.dirname(l),t,shim)}return previouslyVisitedConfigs=[],t?mergeDeep(o,s):Object.assign({},o,s)}function checkForCircularExtends(s){if(previouslyVisitedConfigs.indexOf(s)>-1)throw new YError(`Circular extended configurations: '${s}'.`)}function getPathToDefaultConfig(s,e){return shim.path.resolve(s,e)}function mergeDeep(s,e){const t={};function n(o){return o&&typeof o=="object"&&!Array.isArray(o)}Object.assign(t,s);for(const o of Object.keys(e))n(e[o])&&n(t[o])?t[o]=mergeDeep(s[o],e[o]):t[o]=e[o];return t}var __classPrivateFieldSet=function(s,e,t,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!o:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(s,t):o?o.value=t:e.set(s,t),t},__classPrivateFieldGet=function(s,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(s):n?n.value:e.get(s)},_YargsInstance_command,_YargsInstance_cwd,_YargsInstance_context,_YargsInstance_completion,_YargsInstance_completionCommand,_YargsInstance_defaultShowHiddenOpt,_YargsInstance_exitError,_YargsInstance_detectLocale,_YargsInstance_emittedWarnings,_YargsInstance_exitProcess,_YargsInstance_frozens,_YargsInstance_globalMiddleware,_YargsInstance_groups,_YargsInstance_hasOutput,_YargsInstance_helpOpt,_YargsInstance_isGlobalContext,_YargsInstance_logger,_YargsInstance_output,_YargsInstance_options,_YargsInstance_parentRequire,_YargsInstance_parserConfig,_YargsInstance_parseFn,_YargsInstance_parseContext,_YargsInstance_pkgs,_YargsInstance_preservedGroups,_YargsInstance_processArgs,_YargsInstance_recommendCommands,_YargsInstance_shim,_YargsInstance_strict,_YargsInstance_strictCommands,_YargsInstance_strictOptions,_YargsInstance_usage,_YargsInstance_usageConfig,_YargsInstance_versionOpt,_YargsInstance_validation;function YargsFactory(s){return(e=[],t=s.process.cwd(),n)=>{const o=new YargsInstance(e,t,n,s);return Object.defineProperty(o,"argv",{get:()=>o.parse(),enumerable:!0}),o.help(),o.version(),o}}const kCopyDoubleDash=Symbol("copyDoubleDash"),kCreateLogger=Symbol("copyDoubleDash"),kDeleteFromParserHintObject=Symbol("deleteFromParserHintObject"),kEmitWarning=Symbol("emitWarning"),kFreeze=Symbol("freeze"),kGetDollarZero=Symbol("getDollarZero"),kGetParserConfiguration=Symbol("getParserConfiguration"),kGetUsageConfiguration=Symbol("getUsageConfiguration"),kGuessLocale=Symbol("guessLocale"),kGuessVersion=Symbol("guessVersion"),kParsePositionalNumbers=Symbol("parsePositionalNumbers"),kPkgUp=Symbol("pkgUp"),kPopulateParserHintArray=Symbol("populateParserHintArray"),kPopulateParserHintSingleValueDictionary=Symbol("populateParserHintSingleValueDictionary"),kPopulateParserHintArrayDictionary=Symbol("populateParserHintArrayDictionary"),kPopulateParserHintDictionary=Symbol("populateParserHintDictionary"),kSanitizeKey=Symbol("sanitizeKey"),kSetKey=Symbol("setKey"),kUnfreeze=Symbol("unfreeze"),kValidateAsync=Symbol("validateAsync"),kGetCommandInstance=Symbol("getCommandInstance"),kGetContext=Symbol("getContext"),kGetHasOutput=Symbol("getHasOutput"),kGetLoggerInstance=Symbol("getLoggerInstance"),kGetParseContext=Symbol("getParseContext"),kGetUsageInstance=Symbol("getUsageInstance"),kGetValidationInstance=Symbol("getValidationInstance"),kHasParseCallback=Symbol("hasParseCallback"),kIsGlobalContext=Symbol("isGlobalContext"),kPostProcess=Symbol("postProcess"),kRebase=Symbol("rebase"),kReset=Symbol("reset"),kRunYargsParserAndExecuteCommands=Symbol("runYargsParserAndExecuteCommands"),kRunValidation=Symbol("runValidation"),kSetHasOutput=Symbol("setHasOutput"),kTrackManuallySetKeys=Symbol("kTrackManuallySetKeys");class YargsInstance{constructor(e=[],t,n,o){this.customScriptName=!1,this.parsed=!1,_YargsInstance_command.set(this,void 0),_YargsInstance_cwd.set(this,void 0),_YargsInstance_context.set(this,{commands:[],fullCommands:[]}),_YargsInstance_completion.set(this,null),_YargsInstance_completionCommand.set(this,null),_YargsInstance_defaultShowHiddenOpt.set(this,"show-hidden"),_YargsInstance_exitError.set(this,null),_YargsInstance_detectLocale.set(this,!0),_YargsInstance_emittedWarnings.set(this,{}),_YargsInstance_exitProcess.set(this,!0),_YargsInstance_frozens.set(this,[]),_YargsInstance_globalMiddleware.set(this,void 0),_YargsInstance_groups.set(this,{}),_YargsInstance_hasOutput.set(this,!1),_YargsInstance_helpOpt.set(this,null),_YargsInstance_isGlobalContext.set(this,!0),_YargsInstance_logger.set(this,void 0),_YargsInstance_output.set(this,""),_YargsInstance_options.set(this,void 0),_YargsInstance_parentRequire.set(this,void 0),_YargsInstance_parserConfig.set(this,{}),_YargsInstance_parseFn.set(this,null),_YargsInstance_parseContext.set(this,null),_YargsInstance_pkgs.set(this,{}),_YargsInstance_preservedGroups.set(this,{}),_YargsInstance_processArgs.set(this,void 0),_YargsInstance_recommendCommands.set(this,!1),_YargsInstance_shim.set(this,void 0),_YargsInstance_strict.set(this,!1),_YargsInstance_strictCommands.set(this,!1),_YargsInstance_strictOptions.set(this,!1),_YargsInstance_usage.set(this,void 0),_YargsInstance_usageConfig.set(this,{}),_YargsInstance_versionOpt.set(this,null),_YargsInstance_validation.set(this,void 0),__classPrivateFieldSet(this,_YargsInstance_shim,o,"f"),__classPrivateFieldSet(this,_YargsInstance_processArgs,e,"f"),__classPrivateFieldSet(this,_YargsInstance_cwd,t,"f"),__classPrivateFieldSet(this,_YargsInstance_parentRequire,n,"f"),__classPrivateFieldSet(this,_YargsInstance_globalMiddleware,new GlobalMiddleware(this),"f"),this.$0=this[kGetDollarZero](),this[kReset](),__classPrivateFieldSet(this,_YargsInstance_command,__classPrivateFieldGet(this,_YargsInstance_command,"f"),"f"),__classPrivateFieldSet(this,_YargsInstance_usage,__classPrivateFieldGet(this,_YargsInstance_usage,"f"),"f"),__classPrivateFieldSet(this,_YargsInstance_validation,__classPrivateFieldGet(this,_YargsInstance_validation,"f"),"f"),__classPrivateFieldSet(this,_YargsInstance_options,__classPrivateFieldGet(this,_YargsInstance_options,"f"),"f"),__classPrivateFieldGet(this,_YargsInstance_options,"f").showHiddenOpt=__classPrivateFieldGet(this,_YargsInstance_defaultShowHiddenOpt,"f"),__classPrivateFieldSet(this,_YargsInstance_logger,this[kCreateLogger](),"f")}addHelpOpt(e,t){const n="help";return argsert("[string|boolean] [string]",[e,t],arguments.length),__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")&&(this[kDeleteFromParserHintObject](__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")),__classPrivateFieldSet(this,_YargsInstance_helpOpt,null,"f")),e===!1&&t===void 0?this:(__classPrivateFieldSet(this,_YargsInstance_helpOpt,typeof e=="string"?e:n,"f"),this.boolean(__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")),this.describe(__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f"),t||__classPrivateFieldGet(this,_YargsInstance_usage,"f").deferY18nLookup("Show help")),this)}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if(argsert("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;const n=typeof e=="string"?e:__classPrivateFieldGet(this,_YargsInstance_defaultShowHiddenOpt,"f");return this.boolean(n),this.describe(n,t||__classPrivateFieldGet(this,_YargsInstance_usage,"f").deferY18nLookup("Show hidden options")),__classPrivateFieldGet(this,_YargsInstance_options,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return argsert("<object|string|array> [string|array]",[e,t],arguments.length),this[kPopulateParserHintArrayDictionary](this.alias.bind(this),"alias",e,t),this}array(e){return argsert("<array|string>",[e],arguments.length),this[kPopulateParserHintArray]("array",e),this[kTrackManuallySetKeys](e),this}boolean(e){return argsert("<array|string>",[e],arguments.length),this[kPopulateParserHintArray]("boolean",e),this[kTrackManuallySetKeys](e),this}check(e,t){return argsert("<function> [boolean]",[e,t],arguments.length),this.middleware((n,o)=>maybeAsyncResult(()=>e(n,o.getOptions()),a=>(a?(typeof a=="string"||a instanceof Error)&&__classPrivateFieldGet(this,_YargsInstance_usage,"f").fail(a.toString(),a):__classPrivateFieldGet(this,_YargsInstance_usage,"f").fail(__classPrivateFieldGet(this,_YargsInstance_shim,"f").y18n.__("Argument check failed: %s",e.toString())),n),a=>(__classPrivateFieldGet(this,_YargsInstance_usage,"f").fail(a.message?a.message:a.toString(),a),n)),!1,t),this}choices(e,t){return argsert("<object|string|array> [string|array]",[e,t],arguments.length),this[kPopulateParserHintArrayDictionary](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if(argsert("<object|string|array> [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new YError("coerce callback must be provided");for(const n of e)this.coerce(n,t);return this}else if(typeof e=="object"){for(const n of Object.keys(e))this.coerce(n,e[n]);return this}if(!t)throw new YError("coerce callback must be provided");return __classPrivateFieldGet(this,_YargsInstance_options,"f").key[e]=!0,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").addCoerceMiddleware((n,o)=>{let a;return Object.prototype.hasOwnProperty.call(n,e)?maybeAsyncResult(()=>(a=o.getAliases(),t(n[e])),d=>{n[e]=d;const w=o.getInternalMethods().getParserConfiguration()["strip-aliased"];if(a[e]&&w!==!0)for(const L of a[e])n[L]=d;return n},d=>{throw new YError(d.message)}):n},e),this}conflicts(e,t){return argsert("<string|object> [string|array]",[e,t],arguments.length),__classPrivateFieldGet(this,_YargsInstance_validation,"f").conflicts(e,t),this}config(e="config",t,n){return argsert("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=applyExtends(e,__classPrivateFieldGet(this,_YargsInstance_cwd,"f"),this[kGetParserConfiguration]()["deep-merge-config"]||!1,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects=(__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects||[]).concat(e),this):(typeof t=="function"&&(n=t,t=void 0),this.describe(e,t||__classPrivateFieldGet(this,_YargsInstance_usage,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(o=>{__classPrivateFieldGet(this,_YargsInstance_options,"f").config[o]=n||!0}),this)}completion(e,t,n){return argsert("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t=="function"&&(n=t,t=void 0),__classPrivateFieldSet(this,_YargsInstance_completionCommand,e||__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")||"completion","f"),!t&&t!==!1&&(t="generate completion script"),this.command(__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f"),t),n&&__classPrivateFieldGet(this,_YargsInstance_completion,"f").registerFunction(n),this}command(e,t,n,o,a,l){return argsert("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,o,a,l],arguments.length),__classPrivateFieldGet(this,_YargsInstance_command,"f").addHandler(e,t,n,o,a,l),this}commands(e,t,n,o,a,l){return this.command(e,t,n,o,a,l)}commandDir(e,t){argsert("<string> [object]",[e,t],arguments.length);const n=__classPrivateFieldGet(this,_YargsInstance_parentRequire,"f")||__classPrivateFieldGet(this,_YargsInstance_shim,"f").require;return __classPrivateFieldGet(this,_YargsInstance_command,"f").addDirectory(e,n,__classPrivateFieldGet(this,_YargsInstance_shim,"f").getCallerFile(),t),this}count(e){return argsert("<array|string>",[e],arguments.length),this[kPopulateParserHintArray]("count",e),this[kTrackManuallySetKeys](e),this}default(e,t,n){return argsert("<object|string|array> [*] [string]",[e,t,n],arguments.length),n&&(assertSingleKey(e,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),__classPrivateFieldGet(this,_YargsInstance_options,"f").defaultDescription[e]=n),typeof t=="function"&&(assertSingleKey(e,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),__classPrivateFieldGet(this,_YargsInstance_options,"f").defaultDescription[e]||(__classPrivateFieldGet(this,_YargsInstance_options,"f").defaultDescription[e]=__classPrivateFieldGet(this,_YargsInstance_usage,"f").functionDescription(t)),t=t.call()),this[kPopulateParserHintSingleValueDictionary](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,o){return argsert("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,o],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),__classPrivateFieldGet(this,_YargsInstance_options,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:o},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(o=>{assertNotStrictEqual(n,!0,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),this.demandOption(o,n)}),t=1/0):typeof t!="number"&&(n=t,t=1/0),typeof e=="number"?(assertNotStrictEqual(n,!0,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(o=>{assertNotStrictEqual(n,!0,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),this.demandOption(o,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return argsert("<object|string|array> [string]",[e,t],arguments.length),this[kPopulateParserHintSingleValueDictionary](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return argsert("<string> [string|boolean]",[e,t],arguments.length),__classPrivateFieldGet(this,_YargsInstance_options,"f").deprecatedOptions[e]=t,this}describe(e,t){return argsert("<object|string|array> [string]",[e,t],arguments.length),this[kSetKey](e,!0),__classPrivateFieldGet(this,_YargsInstance_usage,"f").describe(e,t),this}detectLocale(e){return argsert("<boolean>",[e],arguments.length),__classPrivateFieldSet(this,_YargsInstance_detectLocale,e,"f"),this}env(e){return argsert("[string|boolean]",[e],arguments.length),e===!1?delete __classPrivateFieldGet(this,_YargsInstance_options,"f").envPrefix:__classPrivateFieldGet(this,_YargsInstance_options,"f").envPrefix=e||"",this}epilogue(e){return argsert("<string>",[e],arguments.length),__classPrivateFieldGet(this,_YargsInstance_usage,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return argsert("<string|array> [string]",[e,t],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):__classPrivateFieldGet(this,_YargsInstance_usage,"f").example(e,t),this}exit(e,t){__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,"f"),__classPrivateFieldSet(this,_YargsInstance_exitError,t,"f"),__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.exit(e)}exitProcess(e=!0){return argsert("[boolean]",[e],arguments.length),__classPrivateFieldSet(this,_YargsInstance_exitProcess,e,"f"),this}fail(e){if(argsert("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new YError("Invalid first argument. Expected function or boolean 'false'");return __classPrivateFieldGet(this,_YargsInstance_usage,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return argsert("<array> [function]",[e,t],arguments.length),t?__classPrivateFieldGet(this,_YargsInstance_completion,"f").getCompletion(e,t):new Promise((n,o)=>{__classPrivateFieldGet(this,_YargsInstance_completion,"f").getCompletion(e,(a,l)=>{a?o(a):n(l)})})}getDemandedOptions(){return argsert([],0),__classPrivateFieldGet(this,_YargsInstance_options,"f").demandedOptions}getDemandedCommands(){return argsert([],0),__classPrivateFieldGet(this,_YargsInstance_options,"f").demandedCommands}getDeprecatedOptions(){return argsert([],0),__classPrivateFieldGet(this,_YargsInstance_options,"f").deprecatedOptions}getDetectLocale(){return __classPrivateFieldGet(this,_YargsInstance_detectLocale,"f")}getExitProcess(){return __classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")}getGroups(){return Object.assign({},__classPrivateFieldGet(this,_YargsInstance_groups,"f"),__classPrivateFieldGet(this,_YargsInstance_preservedGroups,"f"))}getHelp(){if(__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,"f"),!__classPrivateFieldGet(this,_YargsInstance_usage,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this,_YargsInstance_processArgs,"f"),void 0,void 0,0,!0);if(isPromise(t))return t.then(()=>__classPrivateFieldGet(this,_YargsInstance_usage,"f").help())}const e=__classPrivateFieldGet(this,_YargsInstance_command,"f").runDefaultBuilderOn(this);if(isPromise(e))return e.then(()=>__classPrivateFieldGet(this,_YargsInstance_usage,"f").help())}return Promise.resolve(__classPrivateFieldGet(this,_YargsInstance_usage,"f").help())}getOptions(){return __classPrivateFieldGet(this,_YargsInstance_options,"f")}getStrict(){return __classPrivateFieldGet(this,_YargsInstance_strict,"f")}getStrictCommands(){return __classPrivateFieldGet(this,_YargsInstance_strictCommands,"f")}getStrictOptions(){return __classPrivateFieldGet(this,_YargsInstance_strictOptions,"f")}global(e,t){return argsert("<string|array> [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1?__classPrivateFieldGet(this,_YargsInstance_options,"f").local=__classPrivateFieldGet(this,_YargsInstance_options,"f").local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{__classPrivateFieldGet(this,_YargsInstance_options,"f").local.includes(n)||__classPrivateFieldGet(this,_YargsInstance_options,"f").local.push(n)}),this}group(e,t){argsert("<string|array> <string>",[e,t],arguments.length);const n=__classPrivateFieldGet(this,_YargsInstance_preservedGroups,"f")[t]||__classPrivateFieldGet(this,_YargsInstance_groups,"f")[t];__classPrivateFieldGet(this,_YargsInstance_preservedGroups,"f")[t]&&delete __classPrivateFieldGet(this,_YargsInstance_preservedGroups,"f")[t];const o={};return __classPrivateFieldGet(this,_YargsInstance_groups,"f")[t]=(n||[]).concat(e).filter(a=>o[a]?!1:o[a]=!0),this}hide(e){return argsert("<string>",[e],arguments.length),__classPrivateFieldGet(this,_YargsInstance_options,"f").hiddenOptions.push(e),this}implies(e,t){return argsert("<string|object> [number|string|array]",[e,t],arguments.length),__classPrivateFieldGet(this,_YargsInstance_validation,"f").implies(e,t),this}locale(e){return argsert("[string]",[e],arguments.length),e===void 0?(this[kGuessLocale](),__classPrivateFieldGet(this,_YargsInstance_shim,"f").y18n.getLocale()):(__classPrivateFieldSet(this,_YargsInstance_detectLocale,!1,"f"),__classPrivateFieldGet(this,_YargsInstance_shim,"f").y18n.setLocale(e),this)}middleware(e,t,n){return __classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").addMiddleware(e,!!t,n)}nargs(e,t){return argsert("<string|object|array> [number]",[e,t],arguments.length),this[kPopulateParserHintSingleValueDictionary](this.nargs.bind(this),"narg",e,t),this}normalize(e){return argsert("<array|string>",[e],arguments.length),this[kPopulateParserHintArray]("normalize",e),this}number(e){return argsert("<array|string>",[e],arguments.length),this[kPopulateParserHintArray]("number",e),this[kTrackManuallySetKeys](e),this}option(e,t){if(argsert("<string|object> [object]",[e,t],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof t!="object"&&(t={}),this[kTrackManuallySetKeys](e),__classPrivateFieldGet(this,_YargsInstance_versionOpt,"f")&&(e==="version"||t?.alias==="version")&&this[kEmitWarning](['"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(`
63
63
  `),void 0,"versionWarning"),__classPrivateFieldGet(this,_YargsInstance_options,"f").key[e]=!0,t.alias&&this.alias(e,t.alias);const n=t.deprecate||t.deprecated;n&&this.deprecateOption(e,n);const o=t.demand||t.required||t.require;o&&this.demand(e,o),t.demandOption&&this.demandOption(e,typeof t.demandOption=="string"?t.demandOption:void 0),t.conflicts&&this.conflicts(e,t.conflicts),"default"in t&&this.default(e,t.default),t.implies!==void 0&&this.implies(e,t.implies),t.nargs!==void 0&&this.nargs(e,t.nargs),t.config&&this.config(e,t.configParser),t.normalize&&this.normalize(e),t.choices&&this.choices(e,t.choices),t.coerce&&this.coerce(e,t.coerce),t.group&&this.group(e,t.group),(t.boolean||t.type==="boolean")&&(this.boolean(e),t.alias&&this.boolean(t.alias)),(t.array||t.type==="array")&&(this.array(e),t.alias&&this.array(t.alias)),(t.number||t.type==="number")&&(this.number(e),t.alias&&this.number(t.alias)),(t.string||t.type==="string")&&(this.string(e),t.alias&&this.string(t.alias)),(t.count||t.type==="count")&&this.count(e),typeof t.global=="boolean"&&this.global(e,t.global),t.defaultDescription&&(__classPrivateFieldGet(this,_YargsInstance_options,"f").defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);const a=t.describe||t.description||t.desc,l=__classPrivateFieldGet(this,_YargsInstance_usage,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(l,e)||typeof a=="string")&&this.describe(e,a),t.hidden&&this.hide(e),t.requiresArg&&this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){argsert("[string|array] [function|boolean|object] [function]",[e,t,n],arguments.length),this[kFreeze](),typeof e>"u"&&(e=__classPrivateFieldGet(this,_YargsInstance_processArgs,"f")),typeof t=="object"&&(__classPrivateFieldSet(this,_YargsInstance_parseContext,t,"f"),t=n),typeof t=="function"&&(__classPrivateFieldSet(this,_YargsInstance_parseFn,t,"f"),t=!1),t||__classPrivateFieldSet(this,_YargsInstance_processArgs,e,"f"),__classPrivateFieldGet(this,_YargsInstance_parseFn,"f")&&__classPrivateFieldSet(this,_YargsInstance_exitProcess,!1,"f");const o=this[kRunYargsParserAndExecuteCommands](e,!!t),a=this.parsed;return __classPrivateFieldGet(this,_YargsInstance_completion,"f").setParsed(this.parsed),isPromise(o)?o.then(l=>(__classPrivateFieldGet(this,_YargsInstance_parseFn,"f")&&__classPrivateFieldGet(this,_YargsInstance_parseFn,"f").call(this,__classPrivateFieldGet(this,_YargsInstance_exitError,"f"),l,__classPrivateFieldGet(this,_YargsInstance_output,"f")),l)).catch(l=>{throw __classPrivateFieldGet(this,_YargsInstance_parseFn,"f")&&__classPrivateFieldGet(this,_YargsInstance_parseFn,"f")(l,this.parsed.argv,__classPrivateFieldGet(this,_YargsInstance_output,"f")),l}).finally(()=>{this[kUnfreeze](),this.parsed=a}):(__classPrivateFieldGet(this,_YargsInstance_parseFn,"f")&&__classPrivateFieldGet(this,_YargsInstance_parseFn,"f").call(this,__classPrivateFieldGet(this,_YargsInstance_exitError,"f"),o,__classPrivateFieldGet(this,_YargsInstance_output,"f")),this[kUnfreeze](),this.parsed=a,o)}parseAsync(e,t,n){const o=this.parse(e,t,n);return isPromise(o)?o:Promise.resolve(o)}parseSync(e,t,n){const o=this.parse(e,t,n);if(isPromise(o))throw new YError(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return o}parserConfiguration(e){return argsert("<object>",[e],arguments.length),__classPrivateFieldSet(this,_YargsInstance_parserConfig,e,"f"),this}pkgConf(e,t){argsert("<string> [string]",[e,t],arguments.length);let n=null;const o=this[kPkgUp](t||__classPrivateFieldGet(this,_YargsInstance_cwd,"f"));return o[e]&&typeof o[e]=="object"&&(n=applyExtends(o[e],t||__classPrivateFieldGet(this,_YargsInstance_cwd,"f"),this[kGetParserConfiguration]()["deep-merge-config"]||!1,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects=(__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects||[]).concat(n)),this}positional(e,t){argsert("<string> <object>",[e,t],arguments.length);const n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=objFilter(t,(l,d)=>l==="type"&&!["string","number","boolean"].includes(d)?!1:n.includes(l));const o=__classPrivateFieldGet(this,_YargsInstance_context,"f").fullCommands[__classPrivateFieldGet(this,_YargsInstance_context,"f").fullCommands.length-1],a=o?__classPrivateFieldGet(this,_YargsInstance_command,"f").cmdToParseOptions(o):{array:[],alias:{},default:{},demand:{}};return objectKeys(a).forEach(l=>{const d=a[l];Array.isArray(d)?d.indexOf(e)!==-1&&(t[l]=!0):d[e]&&!(l in t)&&(t[l]=d[e])}),this.group(e,__classPrivateFieldGet(this,_YargsInstance_usage,"f").getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return argsert("[boolean]",[e],arguments.length),__classPrivateFieldSet(this,_YargsInstance_recommendCommands,e,"f"),this}required(e,t,n){return this.demand(e,t,n)}require(e,t,n){return this.demand(e,t,n)}requiresArg(e){return argsert("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&__classPrivateFieldGet(this,_YargsInstance_options,"f").narg[e]?this:(this[kPopulateParserHintSingleValueDictionary](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,t){return argsert("[string] [string]",[e,t],arguments.length),e=e||this.$0,__classPrivateFieldGet(this,_YargsInstance_logger,"f").log(__classPrivateFieldGet(this,_YargsInstance_completion,"f").generateCompletionScript(e,t||__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")||"completion")),this}showHelp(e){if(argsert("[string|function]",[e],arguments.length),__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,"f"),!__classPrivateFieldGet(this,_YargsInstance_usage,"f").hasCachedHelpMessage()){if(!this.parsed){const n=this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this,_YargsInstance_processArgs,"f"),void 0,void 0,0,!0);if(isPromise(n))return n.then(()=>{__classPrivateFieldGet(this,_YargsInstance_usage,"f").showHelp(e)}),this}const t=__classPrivateFieldGet(this,_YargsInstance_command,"f").runDefaultBuilderOn(this);if(isPromise(t))return t.then(()=>{__classPrivateFieldGet(this,_YargsInstance_usage,"f").showHelp(e)}),this}return __classPrivateFieldGet(this,_YargsInstance_usage,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return argsert("[boolean|string] [string]",[e,t],arguments.length),__classPrivateFieldGet(this,_YargsInstance_usage,"f").showHelpOnFail(e,t),this}showVersion(e){return argsert("[string|function]",[e],arguments.length),__classPrivateFieldGet(this,_YargsInstance_usage,"f").showVersion(e),this}skipValidation(e){return argsert("<array|string>",[e],arguments.length),this[kPopulateParserHintArray]("skipValidation",e),this}strict(e){return argsert("[boolean]",[e],arguments.length),__classPrivateFieldSet(this,_YargsInstance_strict,e!==!1,"f"),this}strictCommands(e){return argsert("[boolean]",[e],arguments.length),__classPrivateFieldSet(this,_YargsInstance_strictCommands,e!==!1,"f"),this}strictOptions(e){return argsert("[boolean]",[e],arguments.length),__classPrivateFieldSet(this,_YargsInstance_strictOptions,e!==!1,"f"),this}string(e){return argsert("<array|string>",[e],arguments.length),this[kPopulateParserHintArray]("string",e),this[kTrackManuallySetKeys](e),this}terminalWidth(){return argsert([],0),__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return argsert("<object>",[e],arguments.length),__classPrivateFieldSet(this,_YargsInstance_detectLocale,!1,"f"),__classPrivateFieldGet(this,_YargsInstance_shim,"f").y18n.updateLocale(e),this}usage(e,t,n,o){if(argsert("<string|null|undefined> [string|boolean] [function|object] [function]",[e,t,n,o],arguments.length),t!==void 0){if(assertNotStrictEqual(e,null,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,o);throw new YError(".usage() description must start with $0 if being used as alias for .command()")}else return __classPrivateFieldGet(this,_YargsInstance_usage,"f").usage(e),this}usageConfiguration(e){return argsert("<object>",[e],arguments.length),__classPrivateFieldSet(this,_YargsInstance_usageConfig,e,"f"),this}version(e,t,n){const o="version";if(argsert("[boolean|string] [string] [string]",[e,t,n],arguments.length),__classPrivateFieldGet(this,_YargsInstance_versionOpt,"f")&&(this[kDeleteFromParserHintObject](__classPrivateFieldGet(this,_YargsInstance_versionOpt,"f")),__classPrivateFieldGet(this,_YargsInstance_usage,"f").version(void 0),__classPrivateFieldSet(this,_YargsInstance_versionOpt,null,"f")),arguments.length===0)n=this[kGuessVersion](),e=o;else if(arguments.length===1){if(e===!1)return this;n=e,e=o}else arguments.length===2&&(n=t,t=void 0);return __classPrivateFieldSet(this,_YargsInstance_versionOpt,typeof e=="string"?e:o,"f"),t=t||__classPrivateFieldGet(this,_YargsInstance_usage,"f").deferY18nLookup("Show version number"),__classPrivateFieldGet(this,_YargsInstance_usage,"f").version(n||void 0),this.boolean(__classPrivateFieldGet(this,_YargsInstance_versionOpt,"f")),this.describe(__classPrivateFieldGet(this,_YargsInstance_versionOpt,"f"),t),this}wrap(e){return argsert("<number|null|undefined>",[e],arguments.length),__classPrivateFieldGet(this,_YargsInstance_usage,"f").wrap(e),this}[(_YargsInstance_command=new WeakMap,_YargsInstance_cwd=new WeakMap,_YargsInstance_context=new WeakMap,_YargsInstance_completion=new WeakMap,_YargsInstance_completionCommand=new WeakMap,_YargsInstance_defaultShowHiddenOpt=new WeakMap,_YargsInstance_exitError=new WeakMap,_YargsInstance_detectLocale=new WeakMap,_YargsInstance_emittedWarnings=new WeakMap,_YargsInstance_exitProcess=new WeakMap,_YargsInstance_frozens=new WeakMap,_YargsInstance_globalMiddleware=new WeakMap,_YargsInstance_groups=new WeakMap,_YargsInstance_hasOutput=new WeakMap,_YargsInstance_helpOpt=new WeakMap,_YargsInstance_isGlobalContext=new WeakMap,_YargsInstance_logger=new WeakMap,_YargsInstance_output=new WeakMap,_YargsInstance_options=new WeakMap,_YargsInstance_parentRequire=new WeakMap,_YargsInstance_parserConfig=new WeakMap,_YargsInstance_parseFn=new WeakMap,_YargsInstance_parseContext=new WeakMap,_YargsInstance_pkgs=new WeakMap,_YargsInstance_preservedGroups=new WeakMap,_YargsInstance_processArgs=new WeakMap,_YargsInstance_recommendCommands=new WeakMap,_YargsInstance_shim=new WeakMap,_YargsInstance_strict=new WeakMap,_YargsInstance_strictCommands=new WeakMap,_YargsInstance_strictOptions=new WeakMap,_YargsInstance_usage=new WeakMap,_YargsInstance_usageConfig=new WeakMap,_YargsInstance_versionOpt=new WeakMap,_YargsInstance_validation=new WeakMap,kCopyDoubleDash)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[kCreateLogger](){return{log:(...e)=>{this[kHasParseCallback]()||console.log(...e),__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,"f"),__classPrivateFieldGet(this,_YargsInstance_output,"f").length&&__classPrivateFieldSet(this,_YargsInstance_output,__classPrivateFieldGet(this,_YargsInstance_output,"f")+`
64
64
  `,"f"),__classPrivateFieldSet(this,_YargsInstance_output,__classPrivateFieldGet(this,_YargsInstance_output,"f")+e.join(" "),"f")},error:(...e)=>{this[kHasParseCallback]()||console.error(...e),__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,"f"),__classPrivateFieldGet(this,_YargsInstance_output,"f").length&&__classPrivateFieldSet(this,_YargsInstance_output,__classPrivateFieldGet(this,_YargsInstance_output,"f")+`
65
- `,"f"),__classPrivateFieldSet(this,_YargsInstance_output,__classPrivateFieldGet(this,_YargsInstance_output,"f")+e.join(" "),"f")}}}[kDeleteFromParserHintObject](e){objectKeys(__classPrivateFieldGet(this,_YargsInstance_options,"f")).forEach(t=>{if((o=>o==="configObjects")(t))return;const n=__classPrivateFieldGet(this,_YargsInstance_options,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete __classPrivateFieldGet(this,_YargsInstance_usage,"f").getDescriptions()[e]}[kEmitWarning](e,t,n){__classPrivateFieldGet(this,_YargsInstance_emittedWarnings,"f")[n]||(__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.emitWarning(e,t),__classPrivateFieldGet(this,_YargsInstance_emittedWarnings,"f")[n]=!0)}[kFreeze](){__classPrivateFieldGet(this,_YargsInstance_frozens,"f").push({options:__classPrivateFieldGet(this,_YargsInstance_options,"f"),configObjects:__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects.slice(0),exitProcess:__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f"),groups:__classPrivateFieldGet(this,_YargsInstance_groups,"f"),strict:__classPrivateFieldGet(this,_YargsInstance_strict,"f"),strictCommands:__classPrivateFieldGet(this,_YargsInstance_strictCommands,"f"),strictOptions:__classPrivateFieldGet(this,_YargsInstance_strictOptions,"f"),completionCommand:__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f"),output:__classPrivateFieldGet(this,_YargsInstance_output,"f"),exitError:__classPrivateFieldGet(this,_YargsInstance_exitError,"f"),hasOutput:__classPrivateFieldGet(this,_YargsInstance_hasOutput,"f"),parsed:this.parsed,parseFn:__classPrivateFieldGet(this,_YargsInstance_parseFn,"f"),parseContext:__classPrivateFieldGet(this,_YargsInstance_parseContext,"f")}),__classPrivateFieldGet(this,_YargsInstance_usage,"f").freeze(),__classPrivateFieldGet(this,_YargsInstance_validation,"f").freeze(),__classPrivateFieldGet(this,_YargsInstance_command,"f").freeze(),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").freeze()}[kGetDollarZero](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.argv()[0])?t=__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.argv().slice(1,2):t=__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.argv().slice(0,1),e=t.map(n=>{const o=this[kRebase](__classPrivateFieldGet(this,_YargsInstance_cwd,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&o.length<n.length?o:n}).join(" ").trim(),__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("_")&&__classPrivateFieldGet(this,_YargsInstance_shim,"f").getProcessArgvBin()===__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("_")&&(e=__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("_").replace(`${__classPrivateFieldGet(this,_YargsInstance_shim,"f").path.dirname(__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.execPath())}/`,"")),e}[kGetParserConfiguration](){return __classPrivateFieldGet(this,_YargsInstance_parserConfig,"f")}[kGetUsageConfiguration](){return __classPrivateFieldGet(this,_YargsInstance_usageConfig,"f")}[kGuessLocale](){if(!__classPrivateFieldGet(this,_YargsInstance_detectLocale,"f"))return;const e=__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("LC_ALL")||__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("LC_MESSAGES")||__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("LANG")||__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[kGuessVersion](){return this[kPkgUp]().version||"unknown"}[kParsePositionalNumbers](e){const t=e["--"]?e["--"]:e._;for(let n=0,o;(o=t[n])!==void 0;n++)__classPrivateFieldGet(this,_YargsInstance_shim,"f").Parser.looksLikeNumber(o)&&Number.isSafeInteger(Math.floor(parseFloat(`${o}`)))&&(t[n]=Number(o));return e}[kPkgUp](e){const t=e||"*";if(__classPrivateFieldGet(this,_YargsInstance_pkgs,"f")[t])return __classPrivateFieldGet(this,_YargsInstance_pkgs,"f")[t];let n={};try{let o=e||__classPrivateFieldGet(this,_YargsInstance_shim,"f").mainFilename;!e&&__classPrivateFieldGet(this,_YargsInstance_shim,"f").path.extname(o)&&(o=__classPrivateFieldGet(this,_YargsInstance_shim,"f").path.dirname(o));const a=__classPrivateFieldGet(this,_YargsInstance_shim,"f").findUp(o,(l,d)=>{if(d.includes("package.json"))return"package.json"});assertNotStrictEqual(a,void 0,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),n=JSON.parse(__classPrivateFieldGet(this,_YargsInstance_shim,"f").readFileSync(a,"utf8"))}catch{}return __classPrivateFieldGet(this,_YargsInstance_pkgs,"f")[t]=n||{},__classPrivateFieldGet(this,_YargsInstance_pkgs,"f")[t]}[kPopulateParserHintArray](e,t){t=[].concat(t),t.forEach(n=>{n=this[kSanitizeKey](n),__classPrivateFieldGet(this,_YargsInstance_options,"f")[e].push(n)})}[kPopulateParserHintSingleValueDictionary](e,t,n,o){this[kPopulateParserHintDictionary](e,t,n,o,(a,l,d)=>{__classPrivateFieldGet(this,_YargsInstance_options,"f")[a][l]=d})}[kPopulateParserHintArrayDictionary](e,t,n,o){this[kPopulateParserHintDictionary](e,t,n,o,(a,l,d)=>{__classPrivateFieldGet(this,_YargsInstance_options,"f")[a][l]=(__classPrivateFieldGet(this,_YargsInstance_options,"f")[a][l]||[]).concat(d)})}[kPopulateParserHintDictionary](e,t,n,o,a){if(Array.isArray(n))n.forEach(l=>{e(l,o)});else if((l=>typeof l=="object")(n))for(const l of objectKeys(n))e(l,n[l]);else a(t,this[kSanitizeKey](n),o)}[kSanitizeKey](e){return e==="__proto__"?"___proto___":e}[kSetKey](e,t){return this[kPopulateParserHintSingleValueDictionary](this[kSetKey].bind(this),"key",e,t),this}[kUnfreeze](){var e,t,n,o,a,l,d,w,L,y,B,N;const z=__classPrivateFieldGet(this,_YargsInstance_frozens,"f").pop();assertNotStrictEqual(z,void 0,__classPrivateFieldGet(this,_YargsInstance_shim,"f"));let Q;e=this,t=this,n=this,o=this,a=this,l=this,d=this,w=this,L=this,y=this,B=this,N=this,{options:{set value(H){__classPrivateFieldSet(e,_YargsInstance_options,H,"f")}}.value,configObjects:Q,exitProcess:{set value(H){__classPrivateFieldSet(t,_YargsInstance_exitProcess,H,"f")}}.value,groups:{set value(H){__classPrivateFieldSet(n,_YargsInstance_groups,H,"f")}}.value,output:{set value(H){__classPrivateFieldSet(o,_YargsInstance_output,H,"f")}}.value,exitError:{set value(H){__classPrivateFieldSet(a,_YargsInstance_exitError,H,"f")}}.value,hasOutput:{set value(H){__classPrivateFieldSet(l,_YargsInstance_hasOutput,H,"f")}}.value,parsed:this.parsed,strict:{set value(H){__classPrivateFieldSet(d,_YargsInstance_strict,H,"f")}}.value,strictCommands:{set value(H){__classPrivateFieldSet(w,_YargsInstance_strictCommands,H,"f")}}.value,strictOptions:{set value(H){__classPrivateFieldSet(L,_YargsInstance_strictOptions,H,"f")}}.value,completionCommand:{set value(H){__classPrivateFieldSet(y,_YargsInstance_completionCommand,H,"f")}}.value,parseFn:{set value(H){__classPrivateFieldSet(B,_YargsInstance_parseFn,H,"f")}}.value,parseContext:{set value(H){__classPrivateFieldSet(N,_YargsInstance_parseContext,H,"f")}}.value}=z,__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects=Q,__classPrivateFieldGet(this,_YargsInstance_usage,"f").unfreeze(),__classPrivateFieldGet(this,_YargsInstance_validation,"f").unfreeze(),__classPrivateFieldGet(this,_YargsInstance_command,"f").unfreeze(),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").unfreeze()}[kValidateAsync](e,t){return maybeAsyncResult(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[kGetCommandInstance].bind(this),getContext:this[kGetContext].bind(this),getHasOutput:this[kGetHasOutput].bind(this),getLoggerInstance:this[kGetLoggerInstance].bind(this),getParseContext:this[kGetParseContext].bind(this),getParserConfiguration:this[kGetParserConfiguration].bind(this),getUsageConfiguration:this[kGetUsageConfiguration].bind(this),getUsageInstance:this[kGetUsageInstance].bind(this),getValidationInstance:this[kGetValidationInstance].bind(this),hasParseCallback:this[kHasParseCallback].bind(this),isGlobalContext:this[kIsGlobalContext].bind(this),postProcess:this[kPostProcess].bind(this),reset:this[kReset].bind(this),runValidation:this[kRunValidation].bind(this),runYargsParserAndExecuteCommands:this[kRunYargsParserAndExecuteCommands].bind(this),setHasOutput:this[kSetHasOutput].bind(this)}}[kGetCommandInstance](){return __classPrivateFieldGet(this,_YargsInstance_command,"f")}[kGetContext](){return __classPrivateFieldGet(this,_YargsInstance_context,"f")}[kGetHasOutput](){return __classPrivateFieldGet(this,_YargsInstance_hasOutput,"f")}[kGetLoggerInstance](){return __classPrivateFieldGet(this,_YargsInstance_logger,"f")}[kGetParseContext](){return __classPrivateFieldGet(this,_YargsInstance_parseContext,"f")||{}}[kGetUsageInstance](){return __classPrivateFieldGet(this,_YargsInstance_usage,"f")}[kGetValidationInstance](){return __classPrivateFieldGet(this,_YargsInstance_validation,"f")}[kHasParseCallback](){return!!__classPrivateFieldGet(this,_YargsInstance_parseFn,"f")}[kIsGlobalContext](){return __classPrivateFieldGet(this,_YargsInstance_isGlobalContext,"f")}[kPostProcess](e,t,n,o){return n||isPromise(e)||(t||(e=this[kCopyDoubleDash](e)),(this[kGetParserConfiguration]()["parse-positional-numbers"]||this[kGetParserConfiguration]()["parse-positional-numbers"]===void 0)&&(e=this[kParsePositionalNumbers](e)),o&&(e=applyMiddleware(e,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").getMiddleware(),!1))),e}[kReset](e={}){__classPrivateFieldSet(this,_YargsInstance_options,__classPrivateFieldGet(this,_YargsInstance_options,"f")||{},"f");const t={};t.local=__classPrivateFieldGet(this,_YargsInstance_options,"f").local||[],t.configObjects=__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects||[];const n={};t.local.forEach(l=>{n[l]=!0,(e[l]||[]).forEach(d=>{n[d]=!0})}),Object.assign(__classPrivateFieldGet(this,_YargsInstance_preservedGroups,"f"),Object.keys(__classPrivateFieldGet(this,_YargsInstance_groups,"f")).reduce((l,d)=>{const w=__classPrivateFieldGet(this,_YargsInstance_groups,"f")[d].filter(L=>!(L in n));return w.length>0&&(l[d]=w),l},{})),__classPrivateFieldSet(this,_YargsInstance_groups,{},"f");const o=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],a=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return o.forEach(l=>{t[l]=(__classPrivateFieldGet(this,_YargsInstance_options,"f")[l]||[]).filter(d=>!n[d])}),a.forEach(l=>{t[l]=objFilter(__classPrivateFieldGet(this,_YargsInstance_options,"f")[l],d=>!n[d])}),t.envPrefix=__classPrivateFieldGet(this,_YargsInstance_options,"f").envPrefix,__classPrivateFieldSet(this,_YargsInstance_options,t,"f"),__classPrivateFieldSet(this,_YargsInstance_usage,__classPrivateFieldGet(this,_YargsInstance_usage,"f")?__classPrivateFieldGet(this,_YargsInstance_usage,"f").reset(n):usage(this,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),"f"),__classPrivateFieldSet(this,_YargsInstance_validation,__classPrivateFieldGet(this,_YargsInstance_validation,"f")?__classPrivateFieldGet(this,_YargsInstance_validation,"f").reset(n):validation(this,__classPrivateFieldGet(this,_YargsInstance_usage,"f"),__classPrivateFieldGet(this,_YargsInstance_shim,"f")),"f"),__classPrivateFieldSet(this,_YargsInstance_command,__classPrivateFieldGet(this,_YargsInstance_command,"f")?__classPrivateFieldGet(this,_YargsInstance_command,"f").reset():command(__classPrivateFieldGet(this,_YargsInstance_usage,"f"),__classPrivateFieldGet(this,_YargsInstance_validation,"f"),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f"),__classPrivateFieldGet(this,_YargsInstance_shim,"f")),"f"),__classPrivateFieldGet(this,_YargsInstance_completion,"f")||__classPrivateFieldSet(this,_YargsInstance_completion,completion(this,__classPrivateFieldGet(this,_YargsInstance_usage,"f"),__classPrivateFieldGet(this,_YargsInstance_command,"f"),__classPrivateFieldGet(this,_YargsInstance_shim,"f")),"f"),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").reset(),__classPrivateFieldSet(this,_YargsInstance_completionCommand,null,"f"),__classPrivateFieldSet(this,_YargsInstance_output,"","f"),__classPrivateFieldSet(this,_YargsInstance_exitError,null,"f"),__classPrivateFieldSet(this,_YargsInstance_hasOutput,!1,"f"),this.parsed=!1,this}[kRebase](e,t){return __classPrivateFieldGet(this,_YargsInstance_shim,"f").path.relative(e,t)}[kRunYargsParserAndExecuteCommands](e,t,n,o=0,a=!1){let l=!!n||a;e=e||__classPrivateFieldGet(this,_YargsInstance_processArgs,"f"),__classPrivateFieldGet(this,_YargsInstance_options,"f").__=__classPrivateFieldGet(this,_YargsInstance_shim,"f").y18n.__,__classPrivateFieldGet(this,_YargsInstance_options,"f").configuration=this[kGetParserConfiguration]();const d=!!__classPrivateFieldGet(this,_YargsInstance_options,"f").configuration["populate--"],w=Object.assign({},__classPrivateFieldGet(this,_YargsInstance_options,"f").configuration,{"populate--":!0}),L=__classPrivateFieldGet(this,_YargsInstance_shim,"f").Parser.detailed(e,Object.assign({},__classPrivateFieldGet(this,_YargsInstance_options,"f"),{configuration:{"parse-positional-numbers":!1,...w}})),y=Object.assign(L.argv,__classPrivateFieldGet(this,_YargsInstance_parseContext,"f"));let B;const N=L.aliases;let z=!1,Q=!1;Object.keys(y).forEach(H=>{H===__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")&&y[H]?z=!0:H===__classPrivateFieldGet(this,_YargsInstance_versionOpt,"f")&&y[H]&&(Q=!0)}),y.$0=this.$0,this.parsed=L,o===0&&__classPrivateFieldGet(this,_YargsInstance_usage,"f").clearCachedHelpMessage();try{if(this[kGuessLocale](),t)return this[kPostProcess](y,d,!!n,!1);__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")&&[__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")].concat(N[__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")]||[]).filter(le=>le.length>1).includes(""+y._[y._.length-1])&&(y._.pop(),z=!0),__classPrivateFieldSet(this,_YargsInstance_isGlobalContext,!1,"f");const H=__classPrivateFieldGet(this,_YargsInstance_command,"f").getCommands(),T=__classPrivateFieldGet(this,_YargsInstance_completion,"f").completionKey in y,X=z||T||a;if(y._.length){if(H.length){let ne;for(let le=o||0,oe;y._[le]!==void 0;le++)if(oe=String(y._[le]),H.includes(oe)&&oe!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")){const fe=__classPrivateFieldGet(this,_YargsInstance_command,"f").runCommand(oe,this,L,le+1,a,z||Q||a);return this[kPostProcess](fe,d,!!n,!1)}else if(!ne&&oe!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")){ne=oe;break}!__classPrivateFieldGet(this,_YargsInstance_command,"f").hasDefaultCommand()&&__classPrivateFieldGet(this,_YargsInstance_recommendCommands,"f")&&ne&&!X&&__classPrivateFieldGet(this,_YargsInstance_validation,"f").recommendCommands(ne,H)}__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")&&y._.includes(__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f"))&&!T&&(__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),this.showCompletionScript(),this.exit(0))}if(__classPrivateFieldGet(this,_YargsInstance_command,"f").hasDefaultCommand()&&!X){const ne=__classPrivateFieldGet(this,_YargsInstance_command,"f").runCommand(null,this,L,0,a,z||Q||a);return this[kPostProcess](ne,d,!!n,!1)}if(T){__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),e=[].concat(e);const ne=e.slice(e.indexOf(`--${__classPrivateFieldGet(this,_YargsInstance_completion,"f").completionKey}`)+1);return __classPrivateFieldGet(this,_YargsInstance_completion,"f").getCompletion(ne,(le,oe)=>{if(le)throw new YError(le.message);(oe||[]).forEach(fe=>{__classPrivateFieldGet(this,_YargsInstance_logger,"f").log(fe)}),this.exit(0)}),this[kPostProcess](y,!d,!!n,!1)}if(__classPrivateFieldGet(this,_YargsInstance_hasOutput,"f")||(z?(__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),l=!0,this.showHelp("log"),this.exit(0)):Q&&(__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),l=!0,__classPrivateFieldGet(this,_YargsInstance_usage,"f").showVersion("log"),this.exit(0))),!l&&__classPrivateFieldGet(this,_YargsInstance_options,"f").skipValidation.length>0&&(l=Object.keys(y).some(ne=>__classPrivateFieldGet(this,_YargsInstance_options,"f").skipValidation.indexOf(ne)>=0&&y[ne]===!0)),!l){if(L.error)throw new YError(L.error.message);if(!T){const ne=this[kRunValidation](N,{},L.error);n||(B=applyMiddleware(y,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").getMiddleware(),!0)),B=this[kValidateAsync](ne,B??y),isPromise(B)&&!n&&(B=B.then(()=>applyMiddleware(y,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").getMiddleware(),!1)))}}}catch(H){if(H instanceof YError)__classPrivateFieldGet(this,_YargsInstance_usage,"f").fail(H.message,H);else throw H}return this[kPostProcess](B??y,d,!!n,!0)}[kRunValidation](e,t,n,o){const a={...this.getDemandedOptions()};return l=>{if(n)throw new YError(n.message);__classPrivateFieldGet(this,_YargsInstance_validation,"f").nonOptionCount(l),__classPrivateFieldGet(this,_YargsInstance_validation,"f").requiredArguments(l,a);let d=!1;__classPrivateFieldGet(this,_YargsInstance_strictCommands,"f")&&(d=__classPrivateFieldGet(this,_YargsInstance_validation,"f").unknownCommands(l)),__classPrivateFieldGet(this,_YargsInstance_strict,"f")&&!d?__classPrivateFieldGet(this,_YargsInstance_validation,"f").unknownArguments(l,e,t,!!o):__classPrivateFieldGet(this,_YargsInstance_strictOptions,"f")&&__classPrivateFieldGet(this,_YargsInstance_validation,"f").unknownArguments(l,e,{},!1,!1),__classPrivateFieldGet(this,_YargsInstance_validation,"f").limitedChoices(l),__classPrivateFieldGet(this,_YargsInstance_validation,"f").implications(l),__classPrivateFieldGet(this,_YargsInstance_validation,"f").conflicting(l)}}[kSetHasOutput](){__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,"f")}[kTrackManuallySetKeys](e){if(typeof e=="string")__classPrivateFieldGet(this,_YargsInstance_options,"f").key[e]=!0;else for(const t of e)__classPrivateFieldGet(this,_YargsInstance_options,"f").key[t]=!0}}function isYargsInstance(s){return!!s&&typeof s.getInternalMethods=="function"}const Yargs=YargsFactory(shim$1),path={type:"string",desc:"<directory> with LikeC4 sources (default is current directory)",normalize:!0,default:".",coerce:path$1.resolve},useDotBin={alias:"use-dot-bin",boolean:!0,type:"boolean",desc:'use graphviz binaries ("dot" should be on PATH)',default:!1},useHashHistory={boolean:!0,type:"boolean",desc:'use hash history for navigation, e.g. "/#/view" instead of "/view"'},outdir={alias:"o",type:"string",desc:"<directory> output directory",normalize:!0,coerce:path$1.resolve},webcomponentPrefix={alias:"w",type:"string",desc:'prefix for Webcomponents, e.g "c4" generates <c4-view ../>',default:"likec4"},base={alias:["base-url"],type:"string",desc:'base url the app is being served from, e.g. "/" or "/pages/"'},useOverview={boolean:!0,type:"boolean",desc:"overview all diagrams as graph [experimental]",default:!1},toPath=s=>s instanceof URL?node_url.fileURLToPath(s):s;function findUpSync(s,{cwd:e=process__default.cwd(),type:t="file",stopAt:n}={}){let o=path__default.resolve(toPath(e)??"");const{root:a}=path__default.parse(o);for(n=path__default.resolve(o,toPath(n)??a);o&&o!==n&&o!==a;){const l=path__default.isAbsolute(s)?s:path__default.join(o,s);try{const d=fs__default.statSync(l,{throwIfNoEntry:!1});if(t==="file"&&d?.isFile()||t==="directory"&&d?.isDirectory())return l}catch{}o=path__default.dirname(o)}}function packageUpSync({cwd:s=process__default.cwd()}={}){return findUpSync("package.json",{cwd:s})}const r=path$1.dirname(node_url.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("cli/index.cjs",document.baseURI).href)),k=`
65
+ `,"f"),__classPrivateFieldSet(this,_YargsInstance_output,__classPrivateFieldGet(this,_YargsInstance_output,"f")+e.join(" "),"f")}}}[kDeleteFromParserHintObject](e){objectKeys(__classPrivateFieldGet(this,_YargsInstance_options,"f")).forEach(t=>{if((o=>o==="configObjects")(t))return;const n=__classPrivateFieldGet(this,_YargsInstance_options,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete __classPrivateFieldGet(this,_YargsInstance_usage,"f").getDescriptions()[e]}[kEmitWarning](e,t,n){__classPrivateFieldGet(this,_YargsInstance_emittedWarnings,"f")[n]||(__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.emitWarning(e,t),__classPrivateFieldGet(this,_YargsInstance_emittedWarnings,"f")[n]=!0)}[kFreeze](){__classPrivateFieldGet(this,_YargsInstance_frozens,"f").push({options:__classPrivateFieldGet(this,_YargsInstance_options,"f"),configObjects:__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects.slice(0),exitProcess:__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f"),groups:__classPrivateFieldGet(this,_YargsInstance_groups,"f"),strict:__classPrivateFieldGet(this,_YargsInstance_strict,"f"),strictCommands:__classPrivateFieldGet(this,_YargsInstance_strictCommands,"f"),strictOptions:__classPrivateFieldGet(this,_YargsInstance_strictOptions,"f"),completionCommand:__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f"),output:__classPrivateFieldGet(this,_YargsInstance_output,"f"),exitError:__classPrivateFieldGet(this,_YargsInstance_exitError,"f"),hasOutput:__classPrivateFieldGet(this,_YargsInstance_hasOutput,"f"),parsed:this.parsed,parseFn:__classPrivateFieldGet(this,_YargsInstance_parseFn,"f"),parseContext:__classPrivateFieldGet(this,_YargsInstance_parseContext,"f")}),__classPrivateFieldGet(this,_YargsInstance_usage,"f").freeze(),__classPrivateFieldGet(this,_YargsInstance_validation,"f").freeze(),__classPrivateFieldGet(this,_YargsInstance_command,"f").freeze(),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").freeze()}[kGetDollarZero](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.argv()[0])?t=__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.argv().slice(1,2):t=__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.argv().slice(0,1),e=t.map(n=>{const o=this[kRebase](__classPrivateFieldGet(this,_YargsInstance_cwd,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&o.length<n.length?o:n}).join(" ").trim(),__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("_")&&__classPrivateFieldGet(this,_YargsInstance_shim,"f").getProcessArgvBin()===__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("_")&&(e=__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("_").replace(`${__classPrivateFieldGet(this,_YargsInstance_shim,"f").path.dirname(__classPrivateFieldGet(this,_YargsInstance_shim,"f").process.execPath())}/`,"")),e}[kGetParserConfiguration](){return __classPrivateFieldGet(this,_YargsInstance_parserConfig,"f")}[kGetUsageConfiguration](){return __classPrivateFieldGet(this,_YargsInstance_usageConfig,"f")}[kGuessLocale](){if(!__classPrivateFieldGet(this,_YargsInstance_detectLocale,"f"))return;const e=__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("LC_ALL")||__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("LC_MESSAGES")||__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("LANG")||__classPrivateFieldGet(this,_YargsInstance_shim,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[kGuessVersion](){return this[kPkgUp]().version||"unknown"}[kParsePositionalNumbers](e){const t=e["--"]?e["--"]:e._;for(let n=0,o;(o=t[n])!==void 0;n++)__classPrivateFieldGet(this,_YargsInstance_shim,"f").Parser.looksLikeNumber(o)&&Number.isSafeInteger(Math.floor(parseFloat(`${o}`)))&&(t[n]=Number(o));return e}[kPkgUp](e){const t=e||"*";if(__classPrivateFieldGet(this,_YargsInstance_pkgs,"f")[t])return __classPrivateFieldGet(this,_YargsInstance_pkgs,"f")[t];let n={};try{let o=e||__classPrivateFieldGet(this,_YargsInstance_shim,"f").mainFilename;!e&&__classPrivateFieldGet(this,_YargsInstance_shim,"f").path.extname(o)&&(o=__classPrivateFieldGet(this,_YargsInstance_shim,"f").path.dirname(o));const a=__classPrivateFieldGet(this,_YargsInstance_shim,"f").findUp(o,(l,d)=>{if(d.includes("package.json"))return"package.json"});assertNotStrictEqual(a,void 0,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),n=JSON.parse(__classPrivateFieldGet(this,_YargsInstance_shim,"f").readFileSync(a,"utf8"))}catch{}return __classPrivateFieldGet(this,_YargsInstance_pkgs,"f")[t]=n||{},__classPrivateFieldGet(this,_YargsInstance_pkgs,"f")[t]}[kPopulateParserHintArray](e,t){t=[].concat(t),t.forEach(n=>{n=this[kSanitizeKey](n),__classPrivateFieldGet(this,_YargsInstance_options,"f")[e].push(n)})}[kPopulateParserHintSingleValueDictionary](e,t,n,o){this[kPopulateParserHintDictionary](e,t,n,o,(a,l,d)=>{__classPrivateFieldGet(this,_YargsInstance_options,"f")[a][l]=d})}[kPopulateParserHintArrayDictionary](e,t,n,o){this[kPopulateParserHintDictionary](e,t,n,o,(a,l,d)=>{__classPrivateFieldGet(this,_YargsInstance_options,"f")[a][l]=(__classPrivateFieldGet(this,_YargsInstance_options,"f")[a][l]||[]).concat(d)})}[kPopulateParserHintDictionary](e,t,n,o,a){if(Array.isArray(n))n.forEach(l=>{e(l,o)});else if((l=>typeof l=="object")(n))for(const l of objectKeys(n))e(l,n[l]);else a(t,this[kSanitizeKey](n),o)}[kSanitizeKey](e){return e==="__proto__"?"___proto___":e}[kSetKey](e,t){return this[kPopulateParserHintSingleValueDictionary](this[kSetKey].bind(this),"key",e,t),this}[kUnfreeze](){var e,t,n,o,a,l,d,w,L,y,B,N;const z=__classPrivateFieldGet(this,_YargsInstance_frozens,"f").pop();assertNotStrictEqual(z,void 0,__classPrivateFieldGet(this,_YargsInstance_shim,"f"));let Q;e=this,t=this,n=this,o=this,a=this,l=this,d=this,w=this,L=this,y=this,B=this,N=this,{options:{set value(H){__classPrivateFieldSet(e,_YargsInstance_options,H,"f")}}.value,configObjects:Q,exitProcess:{set value(H){__classPrivateFieldSet(t,_YargsInstance_exitProcess,H,"f")}}.value,groups:{set value(H){__classPrivateFieldSet(n,_YargsInstance_groups,H,"f")}}.value,output:{set value(H){__classPrivateFieldSet(o,_YargsInstance_output,H,"f")}}.value,exitError:{set value(H){__classPrivateFieldSet(a,_YargsInstance_exitError,H,"f")}}.value,hasOutput:{set value(H){__classPrivateFieldSet(l,_YargsInstance_hasOutput,H,"f")}}.value,parsed:this.parsed,strict:{set value(H){__classPrivateFieldSet(d,_YargsInstance_strict,H,"f")}}.value,strictCommands:{set value(H){__classPrivateFieldSet(w,_YargsInstance_strictCommands,H,"f")}}.value,strictOptions:{set value(H){__classPrivateFieldSet(L,_YargsInstance_strictOptions,H,"f")}}.value,completionCommand:{set value(H){__classPrivateFieldSet(y,_YargsInstance_completionCommand,H,"f")}}.value,parseFn:{set value(H){__classPrivateFieldSet(B,_YargsInstance_parseFn,H,"f")}}.value,parseContext:{set value(H){__classPrivateFieldSet(N,_YargsInstance_parseContext,H,"f")}}.value}=z,__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects=Q,__classPrivateFieldGet(this,_YargsInstance_usage,"f").unfreeze(),__classPrivateFieldGet(this,_YargsInstance_validation,"f").unfreeze(),__classPrivateFieldGet(this,_YargsInstance_command,"f").unfreeze(),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").unfreeze()}[kValidateAsync](e,t){return maybeAsyncResult(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[kGetCommandInstance].bind(this),getContext:this[kGetContext].bind(this),getHasOutput:this[kGetHasOutput].bind(this),getLoggerInstance:this[kGetLoggerInstance].bind(this),getParseContext:this[kGetParseContext].bind(this),getParserConfiguration:this[kGetParserConfiguration].bind(this),getUsageConfiguration:this[kGetUsageConfiguration].bind(this),getUsageInstance:this[kGetUsageInstance].bind(this),getValidationInstance:this[kGetValidationInstance].bind(this),hasParseCallback:this[kHasParseCallback].bind(this),isGlobalContext:this[kIsGlobalContext].bind(this),postProcess:this[kPostProcess].bind(this),reset:this[kReset].bind(this),runValidation:this[kRunValidation].bind(this),runYargsParserAndExecuteCommands:this[kRunYargsParserAndExecuteCommands].bind(this),setHasOutput:this[kSetHasOutput].bind(this)}}[kGetCommandInstance](){return __classPrivateFieldGet(this,_YargsInstance_command,"f")}[kGetContext](){return __classPrivateFieldGet(this,_YargsInstance_context,"f")}[kGetHasOutput](){return __classPrivateFieldGet(this,_YargsInstance_hasOutput,"f")}[kGetLoggerInstance](){return __classPrivateFieldGet(this,_YargsInstance_logger,"f")}[kGetParseContext](){return __classPrivateFieldGet(this,_YargsInstance_parseContext,"f")||{}}[kGetUsageInstance](){return __classPrivateFieldGet(this,_YargsInstance_usage,"f")}[kGetValidationInstance](){return __classPrivateFieldGet(this,_YargsInstance_validation,"f")}[kHasParseCallback](){return!!__classPrivateFieldGet(this,_YargsInstance_parseFn,"f")}[kIsGlobalContext](){return __classPrivateFieldGet(this,_YargsInstance_isGlobalContext,"f")}[kPostProcess](e,t,n,o){return n||isPromise(e)||(t||(e=this[kCopyDoubleDash](e)),(this[kGetParserConfiguration]()["parse-positional-numbers"]||this[kGetParserConfiguration]()["parse-positional-numbers"]===void 0)&&(e=this[kParsePositionalNumbers](e)),o&&(e=applyMiddleware(e,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").getMiddleware(),!1))),e}[kReset](e={}){__classPrivateFieldSet(this,_YargsInstance_options,__classPrivateFieldGet(this,_YargsInstance_options,"f")||{},"f");const t={};t.local=__classPrivateFieldGet(this,_YargsInstance_options,"f").local||[],t.configObjects=__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects||[];const n={};t.local.forEach(l=>{n[l]=!0,(e[l]||[]).forEach(d=>{n[d]=!0})}),Object.assign(__classPrivateFieldGet(this,_YargsInstance_preservedGroups,"f"),Object.keys(__classPrivateFieldGet(this,_YargsInstance_groups,"f")).reduce((l,d)=>{const w=__classPrivateFieldGet(this,_YargsInstance_groups,"f")[d].filter(L=>!(L in n));return w.length>0&&(l[d]=w),l},{})),__classPrivateFieldSet(this,_YargsInstance_groups,{},"f");const o=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],a=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return o.forEach(l=>{t[l]=(__classPrivateFieldGet(this,_YargsInstance_options,"f")[l]||[]).filter(d=>!n[d])}),a.forEach(l=>{t[l]=objFilter(__classPrivateFieldGet(this,_YargsInstance_options,"f")[l],d=>!n[d])}),t.envPrefix=__classPrivateFieldGet(this,_YargsInstance_options,"f").envPrefix,__classPrivateFieldSet(this,_YargsInstance_options,t,"f"),__classPrivateFieldSet(this,_YargsInstance_usage,__classPrivateFieldGet(this,_YargsInstance_usage,"f")?__classPrivateFieldGet(this,_YargsInstance_usage,"f").reset(n):usage(this,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),"f"),__classPrivateFieldSet(this,_YargsInstance_validation,__classPrivateFieldGet(this,_YargsInstance_validation,"f")?__classPrivateFieldGet(this,_YargsInstance_validation,"f").reset(n):validation(this,__classPrivateFieldGet(this,_YargsInstance_usage,"f"),__classPrivateFieldGet(this,_YargsInstance_shim,"f")),"f"),__classPrivateFieldSet(this,_YargsInstance_command,__classPrivateFieldGet(this,_YargsInstance_command,"f")?__classPrivateFieldGet(this,_YargsInstance_command,"f").reset():command(__classPrivateFieldGet(this,_YargsInstance_usage,"f"),__classPrivateFieldGet(this,_YargsInstance_validation,"f"),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f"),__classPrivateFieldGet(this,_YargsInstance_shim,"f")),"f"),__classPrivateFieldGet(this,_YargsInstance_completion,"f")||__classPrivateFieldSet(this,_YargsInstance_completion,completion(this,__classPrivateFieldGet(this,_YargsInstance_usage,"f"),__classPrivateFieldGet(this,_YargsInstance_command,"f"),__classPrivateFieldGet(this,_YargsInstance_shim,"f")),"f"),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").reset(),__classPrivateFieldSet(this,_YargsInstance_completionCommand,null,"f"),__classPrivateFieldSet(this,_YargsInstance_output,"","f"),__classPrivateFieldSet(this,_YargsInstance_exitError,null,"f"),__classPrivateFieldSet(this,_YargsInstance_hasOutput,!1,"f"),this.parsed=!1,this}[kRebase](e,t){return __classPrivateFieldGet(this,_YargsInstance_shim,"f").path.relative(e,t)}[kRunYargsParserAndExecuteCommands](e,t,n,o=0,a=!1){let l=!!n||a;e=e||__classPrivateFieldGet(this,_YargsInstance_processArgs,"f"),__classPrivateFieldGet(this,_YargsInstance_options,"f").__=__classPrivateFieldGet(this,_YargsInstance_shim,"f").y18n.__,__classPrivateFieldGet(this,_YargsInstance_options,"f").configuration=this[kGetParserConfiguration]();const d=!!__classPrivateFieldGet(this,_YargsInstance_options,"f").configuration["populate--"],w=Object.assign({},__classPrivateFieldGet(this,_YargsInstance_options,"f").configuration,{"populate--":!0}),L=__classPrivateFieldGet(this,_YargsInstance_shim,"f").Parser.detailed(e,Object.assign({},__classPrivateFieldGet(this,_YargsInstance_options,"f"),{configuration:{"parse-positional-numbers":!1,...w}})),y=Object.assign(L.argv,__classPrivateFieldGet(this,_YargsInstance_parseContext,"f"));let B;const N=L.aliases;let z=!1,Q=!1;Object.keys(y).forEach(H=>{H===__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")&&y[H]?z=!0:H===__classPrivateFieldGet(this,_YargsInstance_versionOpt,"f")&&y[H]&&(Q=!0)}),y.$0=this.$0,this.parsed=L,o===0&&__classPrivateFieldGet(this,_YargsInstance_usage,"f").clearCachedHelpMessage();try{if(this[kGuessLocale](),t)return this[kPostProcess](y,d,!!n,!1);__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")&&[__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")].concat(N[__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")]||[]).filter(le=>le.length>1).includes(""+y._[y._.length-1])&&(y._.pop(),z=!0),__classPrivateFieldSet(this,_YargsInstance_isGlobalContext,!1,"f");const H=__classPrivateFieldGet(this,_YargsInstance_command,"f").getCommands(),T=__classPrivateFieldGet(this,_YargsInstance_completion,"f").completionKey in y,X=z||T||a;if(y._.length){if(H.length){let ne;for(let le=o||0,ue;y._[le]!==void 0;le++)if(ue=String(y._[le]),H.includes(ue)&&ue!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")){const fe=__classPrivateFieldGet(this,_YargsInstance_command,"f").runCommand(ue,this,L,le+1,a,z||Q||a);return this[kPostProcess](fe,d,!!n,!1)}else if(!ne&&ue!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")){ne=ue;break}!__classPrivateFieldGet(this,_YargsInstance_command,"f").hasDefaultCommand()&&__classPrivateFieldGet(this,_YargsInstance_recommendCommands,"f")&&ne&&!X&&__classPrivateFieldGet(this,_YargsInstance_validation,"f").recommendCommands(ne,H)}__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")&&y._.includes(__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f"))&&!T&&(__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),this.showCompletionScript(),this.exit(0))}if(__classPrivateFieldGet(this,_YargsInstance_command,"f").hasDefaultCommand()&&!X){const ne=__classPrivateFieldGet(this,_YargsInstance_command,"f").runCommand(null,this,L,0,a,z||Q||a);return this[kPostProcess](ne,d,!!n,!1)}if(T){__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),e=[].concat(e);const ne=e.slice(e.indexOf(`--${__classPrivateFieldGet(this,_YargsInstance_completion,"f").completionKey}`)+1);return __classPrivateFieldGet(this,_YargsInstance_completion,"f").getCompletion(ne,(le,ue)=>{if(le)throw new YError(le.message);(ue||[]).forEach(fe=>{__classPrivateFieldGet(this,_YargsInstance_logger,"f").log(fe)}),this.exit(0)}),this[kPostProcess](y,!d,!!n,!1)}if(__classPrivateFieldGet(this,_YargsInstance_hasOutput,"f")||(z?(__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),l=!0,this.showHelp("log"),this.exit(0)):Q&&(__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),l=!0,__classPrivateFieldGet(this,_YargsInstance_usage,"f").showVersion("log"),this.exit(0))),!l&&__classPrivateFieldGet(this,_YargsInstance_options,"f").skipValidation.length>0&&(l=Object.keys(y).some(ne=>__classPrivateFieldGet(this,_YargsInstance_options,"f").skipValidation.indexOf(ne)>=0&&y[ne]===!0)),!l){if(L.error)throw new YError(L.error.message);if(!T){const ne=this[kRunValidation](N,{},L.error);n||(B=applyMiddleware(y,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").getMiddleware(),!0)),B=this[kValidateAsync](ne,B??y),isPromise(B)&&!n&&(B=B.then(()=>applyMiddleware(y,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").getMiddleware(),!1)))}}}catch(H){if(H instanceof YError)__classPrivateFieldGet(this,_YargsInstance_usage,"f").fail(H.message,H);else throw H}return this[kPostProcess](B??y,d,!!n,!0)}[kRunValidation](e,t,n,o){const a={...this.getDemandedOptions()};return l=>{if(n)throw new YError(n.message);__classPrivateFieldGet(this,_YargsInstance_validation,"f").nonOptionCount(l),__classPrivateFieldGet(this,_YargsInstance_validation,"f").requiredArguments(l,a);let d=!1;__classPrivateFieldGet(this,_YargsInstance_strictCommands,"f")&&(d=__classPrivateFieldGet(this,_YargsInstance_validation,"f").unknownCommands(l)),__classPrivateFieldGet(this,_YargsInstance_strict,"f")&&!d?__classPrivateFieldGet(this,_YargsInstance_validation,"f").unknownArguments(l,e,t,!!o):__classPrivateFieldGet(this,_YargsInstance_strictOptions,"f")&&__classPrivateFieldGet(this,_YargsInstance_validation,"f").unknownArguments(l,e,{},!1,!1),__classPrivateFieldGet(this,_YargsInstance_validation,"f").limitedChoices(l),__classPrivateFieldGet(this,_YargsInstance_validation,"f").implications(l),__classPrivateFieldGet(this,_YargsInstance_validation,"f").conflicting(l)}}[kSetHasOutput](){__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,"f")}[kTrackManuallySetKeys](e){if(typeof e=="string")__classPrivateFieldGet(this,_YargsInstance_options,"f").key[e]=!0;else for(const t of e)__classPrivateFieldGet(this,_YargsInstance_options,"f").key[t]=!0}}function isYargsInstance(s){return!!s&&typeof s.getInternalMethods=="function"}const Yargs=YargsFactory(shim$1),path={type:"string",desc:"<directory> with LikeC4 sources (default is current directory)",normalize:!0,default:".",coerce:path$1.resolve},useDotBin={alias:"use-dot-bin",boolean:!0,type:"boolean",desc:'use graphviz binaries ("dot" should be on PATH)',default:!1},useHashHistory={boolean:!0,type:"boolean",desc:'use hash history for navigation, e.g. "/#/view" instead of "/view"'},outdir={alias:"o",type:"string",desc:"<directory> output directory",normalize:!0,coerce:path$1.resolve},webcomponentPrefix={alias:"w",type:"string",desc:'prefix for Webcomponents, e.g "c4" generates <c4-view ../>',default:"likec4"},base={alias:["base-url"],type:"string",desc:'base url the app is being served from, e.g. "/" or "/pages/"'},useOverview={boolean:!0,type:"boolean",desc:"overview all diagrams as graph [experimental]",default:!1},toPath=s=>s instanceof URL?node_url.fileURLToPath(s):s;function findUpSync(s,{cwd:e=process__default.cwd(),type:t="file",stopAt:n}={}){let o=path__default.resolve(toPath(e)??"");const{root:a}=path__default.parse(o);for(n=path__default.resolve(o,toPath(n)??a);o&&o!==n&&o!==a;){const l=path__default.isAbsolute(s)?s:path__default.join(o,s);try{const d=fs__default.statSync(l,{throwIfNoEntry:!1});if(t==="file"&&d?.isFile()||t==="directory"&&d?.isDirectory())return l}catch{}o=path__default.dirname(o)}}function packageUpSync({cwd:s=process__default.cwd()}={}){return findUpSync("package.json",{cwd:s})}const r=path$1.dirname(node_url.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("cli/index.cjs",document.baseURI).href)),k=`
66
66
  /* prettier-ignore-start */
67
67
  /* eslint-disable */
68
68
 
@@ -87,12 +87,12 @@ ${e.join(`
87
87
  `:case"\r":throw invalidChar(read());case"\u2028":case"\u2029":separatorChar(c);break;case void 0:throw invalidChar(read())}buffer+=read()},start(){switch(c){case"{":case"[":return newToken("punctuator",read())}lexState="value"},beforePropertyName(){switch(c){case"$":case"_":buffer=read(),lexState="identifierName";return;case"\\":read(),lexState="identifierNameStartEscape";return;case"}":return newToken("punctuator",read());case'"':case"'":doubleQuote=read()==='"',lexState="string";return}if(util.isIdStartChar(c)){buffer+=read(),lexState="identifierName";return}throw invalidChar(read())},afterPropertyName(){if(c===":")return newToken("punctuator",read());throw invalidChar(read())},beforePropertyValue(){lexState="value"},afterPropertyValue(){switch(c){case",":case"}":return newToken("punctuator",read())}throw invalidChar(read())},beforeArrayValue(){if(c==="]")return newToken("punctuator",read());lexState="value"},afterArrayValue(){switch(c){case",":case"]":return newToken("punctuator",read())}throw invalidChar(read())},end(){throw invalidChar(read())}};function newToken(s,e){return{type:s,value:e,line,column}}function literal(s){for(const e of s){if(peek()!==e)throw invalidChar(read());read()}}function escape(){switch(peek()){case"b":return read(),"\b";case"f":return read(),"\f";case"n":return read(),`
88
88
  `;case"r":return read(),"\r";case"t":return read()," ";case"v":return read(),"\v";case"0":if(read(),util.isDigit(peek()))throw invalidChar(read());return"\0";case"x":return read(),hexEscape();case"u":return read(),unicodeEscape();case`
89
89
  `:case"\u2028":case"\u2029":return read(),"";case"\r":return read(),peek()===`
90
- `&&read(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw invalidChar(read());case void 0:throw invalidChar(read())}return read()}function hexEscape(){let s="",e=peek();if(!util.isHexDigit(e)||(s+=read(),e=peek(),!util.isHexDigit(e)))throw invalidChar(read());return s+=read(),String.fromCodePoint(parseInt(s,16))}function unicodeEscape(){let s="",e=4;for(;e-- >0;){const t=peek();if(!util.isHexDigit(t))throw invalidChar(read());s+=read()}return String.fromCodePoint(parseInt(s,16))}const parseStates={start(){if(token.type==="eof")throw invalidEOF();push()},beforePropertyName(){switch(token.type){case"identifier":case"string":key=token.value,parseState="afterPropertyName";return;case"punctuator":pop();return;case"eof":throw invalidEOF()}},afterPropertyName(){if(token.type==="eof")throw invalidEOF();parseState="beforePropertyValue"},beforePropertyValue(){if(token.type==="eof")throw invalidEOF();push()},beforeArrayValue(){if(token.type==="eof")throw invalidEOF();if(token.type==="punctuator"&&token.value==="]"){pop();return}push()},afterPropertyValue(){if(token.type==="eof")throw invalidEOF();switch(token.value){case",":parseState="beforePropertyName";return;case"}":pop()}},afterArrayValue(){if(token.type==="eof")throw invalidEOF();switch(token.value){case",":parseState="beforeArrayValue";return;case"]":pop()}},end(){}};function push(){let s;switch(token.type){case"punctuator":switch(token.value){case"{":s={};break;case"[":s=[];break}break;case"null":case"boolean":case"numeric":case"string":s=token.value;break}if(root===void 0)root=s;else{const e=stack[stack.length-1];Array.isArray(e)?e.push(s):Object.defineProperty(e,key,{value:s,writable:!0,enumerable:!0,configurable:!0})}if(s!==null&&typeof s=="object")stack.push(s),Array.isArray(s)?parseState="beforeArrayValue":parseState="beforePropertyName";else{const e=stack[stack.length-1];e==null?parseState="end":Array.isArray(e)?parseState="afterArrayValue":parseState="afterPropertyValue"}}function pop(){stack.pop();const s=stack[stack.length-1];s==null?parseState="end":Array.isArray(s)?parseState="afterArrayValue":parseState="afterPropertyValue"}function invalidChar(s){return syntaxError(s===void 0?`JSON5: invalid end of input at ${line}:${column}`:`JSON5: invalid character '${formatChar(s)}' at ${line}:${column}`)}function invalidEOF(){return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)}function invalidIdentifier(){return column-=5,syntaxError(`JSON5: invalid identifier character at ${line}:${column}`)}function separatorChar(s){console.warn(`JSON5: '${formatChar(s)}' in strings is not valid ECMAScript; consider escaping`)}function formatChar(s){const e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[s])return e[s];if(s<" "){const t=s.charCodeAt(0).toString(16);return"\\x"+("00"+t).substring(t.length)}return s}function syntaxError(s){const e=new SyntaxError(s);return e.lineNumber=line,e.columnNumber=column,e}var stringify=function(e,t,n){const o=[];let a="",l,d,w="",L;if(t!=null&&typeof t=="object"&&!Array.isArray(t)&&(n=t.space,L=t.quote,t=t.replacer),typeof t=="function")d=t;else if(Array.isArray(t)){l=[];for(const H of t){let T;typeof H=="string"?T=H:(typeof H=="number"||H instanceof String||H instanceof Number)&&(T=String(H)),T!==void 0&&l.indexOf(T)<0&&l.push(T)}}return n instanceof Number?n=Number(n):n instanceof String&&(n=String(n)),typeof n=="number"?n>0&&(n=Math.min(10,Math.floor(n)),w=" ".substr(0,n)):typeof n=="string"&&(w=n.substr(0,10)),y("",{"":e});function y(H,T){let X=T[H];switch(X!=null&&(typeof X.toJSON5=="function"?X=X.toJSON5(H):typeof X.toJSON=="function"&&(X=X.toJSON(H))),d&&(X=d.call(T,H,X)),X instanceof Number?X=Number(X):X instanceof String?X=String(X):X instanceof Boolean&&(X=X.valueOf()),X){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof X=="string")return B(X);if(typeof X=="number")return String(X);if(typeof X=="object")return Array.isArray(X)?Q(X):N(X)}function B(H){const T={"'":.1,'"':.2},X={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let ne="";for(let oe=0;oe<H.length;oe++){const fe=H[oe];switch(fe){case"'":case'"':T[fe]++,ne+=fe;continue;case"\0":if(util.isDigit(H[oe+1])){ne+="\\x00";continue}}if(X[fe]){ne+=X[fe];continue}if(fe<" "){let ve=fe.charCodeAt(0).toString(16);ne+="\\x"+("00"+ve).substring(ve.length);continue}ne+=fe}const le=L||Object.keys(T).reduce((oe,fe)=>T[oe]<T[fe]?oe:fe);return ne=ne.replace(new RegExp(le,"g"),X[le]),le+ne+le}function N(H){if(o.indexOf(H)>=0)throw TypeError("Converting circular structure to JSON5");o.push(H);let T=a;a=a+w;let X=l||Object.keys(H),ne=[];for(const oe of X){const fe=y(oe,H);if(fe!==void 0){let ve=z(oe)+":";w!==""&&(ve+=" "),ve+=fe,ne.push(ve)}}let le;if(ne.length===0)le="{}";else{let oe;if(w==="")oe=ne.join(","),le="{"+oe+"}";else{let fe=`,
91
- `+a;oe=ne.join(fe),le=`{
92
- `+a+oe+`,
93
- `+T+"}"}}return o.pop(),a=T,le}function z(H){if(H.length===0)return B(H);const T=String.fromCodePoint(H.codePointAt(0));if(!util.isIdStartChar(T))return B(H);for(let X=T.length;X<H.length;X++)if(!util.isIdContinueChar(String.fromCodePoint(H.codePointAt(X))))return B(H);return H}function Q(H){if(o.indexOf(H)>=0)throw TypeError("Converting circular structure to JSON5");o.push(H);let T=a;a=a+w;let X=[];for(let le=0;le<H.length;le++){const oe=y(String(le),H);X.push(oe!==void 0?oe:"null")}let ne;if(X.length===0)ne="[]";else if(w==="")ne="["+X.join(",")+"]";else{let le=`,
94
- `+a,oe=X.join(le);ne=`[
95
- `+a+oe+`,
90
+ `&&read(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw invalidChar(read());case void 0:throw invalidChar(read())}return read()}function hexEscape(){let s="",e=peek();if(!util.isHexDigit(e)||(s+=read(),e=peek(),!util.isHexDigit(e)))throw invalidChar(read());return s+=read(),String.fromCodePoint(parseInt(s,16))}function unicodeEscape(){let s="",e=4;for(;e-- >0;){const t=peek();if(!util.isHexDigit(t))throw invalidChar(read());s+=read()}return String.fromCodePoint(parseInt(s,16))}const parseStates={start(){if(token.type==="eof")throw invalidEOF();push()},beforePropertyName(){switch(token.type){case"identifier":case"string":key=token.value,parseState="afterPropertyName";return;case"punctuator":pop();return;case"eof":throw invalidEOF()}},afterPropertyName(){if(token.type==="eof")throw invalidEOF();parseState="beforePropertyValue"},beforePropertyValue(){if(token.type==="eof")throw invalidEOF();push()},beforeArrayValue(){if(token.type==="eof")throw invalidEOF();if(token.type==="punctuator"&&token.value==="]"){pop();return}push()},afterPropertyValue(){if(token.type==="eof")throw invalidEOF();switch(token.value){case",":parseState="beforePropertyName";return;case"}":pop()}},afterArrayValue(){if(token.type==="eof")throw invalidEOF();switch(token.value){case",":parseState="beforeArrayValue";return;case"]":pop()}},end(){}};function push(){let s;switch(token.type){case"punctuator":switch(token.value){case"{":s={};break;case"[":s=[];break}break;case"null":case"boolean":case"numeric":case"string":s=token.value;break}if(root===void 0)root=s;else{const e=stack[stack.length-1];Array.isArray(e)?e.push(s):Object.defineProperty(e,key,{value:s,writable:!0,enumerable:!0,configurable:!0})}if(s!==null&&typeof s=="object")stack.push(s),Array.isArray(s)?parseState="beforeArrayValue":parseState="beforePropertyName";else{const e=stack[stack.length-1];e==null?parseState="end":Array.isArray(e)?parseState="afterArrayValue":parseState="afterPropertyValue"}}function pop(){stack.pop();const s=stack[stack.length-1];s==null?parseState="end":Array.isArray(s)?parseState="afterArrayValue":parseState="afterPropertyValue"}function invalidChar(s){return syntaxError(s===void 0?`JSON5: invalid end of input at ${line}:${column}`:`JSON5: invalid character '${formatChar(s)}' at ${line}:${column}`)}function invalidEOF(){return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)}function invalidIdentifier(){return column-=5,syntaxError(`JSON5: invalid identifier character at ${line}:${column}`)}function separatorChar(s){console.warn(`JSON5: '${formatChar(s)}' in strings is not valid ECMAScript; consider escaping`)}function formatChar(s){const e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[s])return e[s];if(s<" "){const t=s.charCodeAt(0).toString(16);return"\\x"+("00"+t).substring(t.length)}return s}function syntaxError(s){const e=new SyntaxError(s);return e.lineNumber=line,e.columnNumber=column,e}var stringify=function(e,t,n){const o=[];let a="",l,d,w="",L;if(t!=null&&typeof t=="object"&&!Array.isArray(t)&&(n=t.space,L=t.quote,t=t.replacer),typeof t=="function")d=t;else if(Array.isArray(t)){l=[];for(const H of t){let T;typeof H=="string"?T=H:(typeof H=="number"||H instanceof String||H instanceof Number)&&(T=String(H)),T!==void 0&&l.indexOf(T)<0&&l.push(T)}}return n instanceof Number?n=Number(n):n instanceof String&&(n=String(n)),typeof n=="number"?n>0&&(n=Math.min(10,Math.floor(n)),w=" ".substr(0,n)):typeof n=="string"&&(w=n.substr(0,10)),y("",{"":e});function y(H,T){let X=T[H];switch(X!=null&&(typeof X.toJSON5=="function"?X=X.toJSON5(H):typeof X.toJSON=="function"&&(X=X.toJSON(H))),d&&(X=d.call(T,H,X)),X instanceof Number?X=Number(X):X instanceof String?X=String(X):X instanceof Boolean&&(X=X.valueOf()),X){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof X=="string")return B(X);if(typeof X=="number")return String(X);if(typeof X=="object")return Array.isArray(X)?Q(X):N(X)}function B(H){const T={"'":.1,'"':.2},X={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let ne="";for(let ue=0;ue<H.length;ue++){const fe=H[ue];switch(fe){case"'":case'"':T[fe]++,ne+=fe;continue;case"\0":if(util.isDigit(H[ue+1])){ne+="\\x00";continue}}if(X[fe]){ne+=X[fe];continue}if(fe<" "){let ve=fe.charCodeAt(0).toString(16);ne+="\\x"+("00"+ve).substring(ve.length);continue}ne+=fe}const le=L||Object.keys(T).reduce((ue,fe)=>T[ue]<T[fe]?ue:fe);return ne=ne.replace(new RegExp(le,"g"),X[le]),le+ne+le}function N(H){if(o.indexOf(H)>=0)throw TypeError("Converting circular structure to JSON5");o.push(H);let T=a;a=a+w;let X=l||Object.keys(H),ne=[];for(const ue of X){const fe=y(ue,H);if(fe!==void 0){let ve=z(ue)+":";w!==""&&(ve+=" "),ve+=fe,ne.push(ve)}}let le;if(ne.length===0)le="{}";else{let ue;if(w==="")ue=ne.join(","),le="{"+ue+"}";else{let fe=`,
91
+ `+a;ue=ne.join(fe),le=`{
92
+ `+a+ue+`,
93
+ `+T+"}"}}return o.pop(),a=T,le}function z(H){if(H.length===0)return B(H);const T=String.fromCodePoint(H.codePointAt(0));if(!util.isIdStartChar(T))return B(H);for(let X=T.length;X<H.length;X++)if(!util.isIdContinueChar(String.fromCodePoint(H.codePointAt(X))))return B(H);return H}function Q(H){if(o.indexOf(H)>=0)throw TypeError("Converting circular structure to JSON5");o.push(H);let T=a;a=a+w;let X=[];for(let le=0;le<H.length;le++){const ue=y(String(le),H);X.push(ue!==void 0?ue:"null")}let ne;if(X.length===0)ne="[]";else if(w==="")ne="["+X.join(",")+"]";else{let le=`,
94
+ `+a,ue=X.join(le);ne=`[
95
+ `+a+ue+`,
96
96
  `+T+"]"}return o.pop(),a=T,ne}};const JSON5={parse,stringify};var lib=JSON5;const E=s=>s.charAt(0).toLocaleUpperCase()+s.slice(1),v=s=>s.split(".").map(E).join(""),x=s=>v(s.parent?s.id.slice(s.parent.length+1):s.id),M=({autoLayout:s})=>{switch(s.direction){case"TB":return"down";case"BT":return"up";case"LR":return"right";case"RL":return"left"}},b=({shape:s})=>{switch(s){case"queue":case"cylinder":case"rectangle":case"person":return s;case"storage":return"stored_data";case"mobile":case"browser":return"rectangle"}};function P$1(s){const{nodes:e,edges:t}=s,n=new Map,o=(l,d)=>{const w=x(l),L=(d?d+".":"")+w;n.set(l.id,L);const y=JSON.stringify(l.title),B=b(l);return new CompositeGeneratorNode().append(w,": {",NL).indent({indentedChildren:N=>N.append("label: ",y,NL).appendIf(B!=="rectangle","shape: ",B,NL).appendIf(l.children.length>0,NL,joinToNode(e.filter(z=>z.parent===l.id),z=>o(z,L))),indentation:2}).append("}",NL)},a=l=>new CompositeGeneratorNode().append(n.get(l.source)," -> ",n.get(l.target)).append(d=>l.label&&d.append(": ",JSON.stringify(l.label)));return toString(new CompositeGeneratorNode().append("direction: ",M(s),NL,NL).append(joinToNode(e.filter(l=>LikeC4.n(l.parent)),l=>o(l),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,NL,joinToNode(t,l=>a(l),{appendNewLineIfNotEmpty:!0})))}const A$1=s=>s.charAt(0).toLocaleUpperCase()+s.slice(1),O$1=s=>s.split(".").map(A$1).join(""),$$1=s=>O$1(s.parent?s.id.slice(s.parent.length+1):s.id),R=({shape:s})=>{switch(s){case"queue":case"cylinder":return["[(",")]"];case"person":return["[fa:fa-user ","]"];case"storage":return["([","])"];case"mobile":case"browser":case"rectangle":return["[","]"]}};function S(s){const{nodes:e,edges:t}=s,n=new Map,o=(l,d)=>{const w=$$1(l),L=(d?d+".":"")+w;n.set(l.id,L);const y=l.title.replaceAll(`
97
97
  `,"\\n"),B=R(l),N=new CompositeGeneratorNode;return l.children.length>0?N.append("subgraph ",L,"[",JSON.stringify(l.title),"]",NL).indent({indentedChildren:[joinToNode(e.filter(z=>z.parent===l.id),z=>o(z,L),{appendNewLineIfNotEmpty:!0})],indentation:2}).append("end",NL):N.append(L,B[0],y,B[1]),N},a=l=>new CompositeGeneratorNode().append(n.get(l.source)," -.",l.label?' "'+l.label.replaceAll(`
98
98
  `,"\\n")+'" .-':"-","> ",n.get(l.target));return toString(new CompositeGeneratorNode().appendIf(s.title!==null&&s.title.length>0,"---",NL,`title: ${JSON.stringify(s.title)}`,NL,"---",NL).append("graph ",s.autoLayout.direction,NL).indent({indentedChildren:l=>{l.append(joinToNode(e.filter(d=>LikeC4.n(d.parent)),d=>o(d),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,joinToNode(t,d=>a(d),{appendNewLineIfNotEmpty:!0}))},indentation:2}))}function q(s){const e=new CompositeGeneratorNode;return e.appendTemplate`
@@ -140,8 +140,8 @@ ${e.join(`
140
140
  }
141
141
 
142
142
  /* prettier-ignore-end */
143
- `.append(NL),toString(t))}function u(s){s instanceof Set&&(s=[...s].sort(index_DafVOuVd.k));const e=s.map(t=>` | ${JSON.stringify(t)}`);return e.length===0&&e.push(" never"),e.join(`
144
- `)+";"}function Y(s){const{fqns:e,tags:t,kinds:n}=index_DafVOuVd.i([...s.elements()]).reduce((l,d)=>(l.fqns.push(d.id),l.kinds.add(d.kind),l.tags.push(...d.tags),l),{fqns:[],kinds:new Set,tags:[]}),o=index_DafVOuVd.i([...s.deployment.elements()]).map(l=>l.id),{viewIds:a}=[...s.views()].reduce((l,d)=>(l.viewIds.add(d.id),l.tags.push(...d.tags),l.tags.push(...d.includedTags),l),{viewIds:new Set,tags:t});return`
143
+ `.append(NL),toString(t))}function u(s){s instanceof Set&&(s=[...s].sort(index_KOeaSlL8.T));const e=s.map(t=>` | ${JSON.stringify(t)}`);return e.length===0&&e.push(" never"),e.join(`
144
+ `)+";"}function Y(s){const{fqns:e,tags:t,kinds:n}=index_KOeaSlL8.O([...s.elements()]).reduce((l,d)=>(l.fqns.push(d.id),l.kinds.add(d.kind),l.tags.push(...d.tags),l),{fqns:[],kinds:new Set,tags:[]}),o=index_KOeaSlL8.O([...s.deployment.elements()]).map(l=>l.id),{viewIds:a}=[...s.views()].reduce((l,d)=>(l.viewIds.add(d.id),l.tags.push(...d.tags),l.tags.push(...d.includedTags),l),{viewIds:new Set,tags:t});return`
145
145
  /* prettier-ignore-start */
146
146
  /* eslint-disable */
147
147
 
@@ -425,8 +425,8 @@ if (import.meta.hot) {
425
425
  `+"".padEnd(9," ")),LikeC4.p.dim("Network: ")+s.resolvedUrls.network.join(`
426
426
  `+"".padEnd(9," "))].join(`
427
427
  `))}class Locked extends Error{constructor(e){super(`${e} is locked`)}}const lockedPorts={old:new Set,young:new Set},releaseOldLockedPortsIntervalMs=1e3*15,minPort=1024,maxPort=65535;let timeout;const getLocalHosts=()=>{const s=os__default.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(const t of Object.values(s))for(const n of t)e.add(n.address);return e},checkAvailablePort=s=>new Promise((e,t)=>{const n=net__default.createServer();n.unref(),n.on("error",t),n.listen(s,()=>{const{port:o}=n.address();n.close(()=>{e(o)})})}),getAvailablePort=async(s,e)=>{if(s.host||s.port===0)return checkAvailablePort(s);for(const t of e)try{await checkAvailablePort({port:s.port,host:t})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return s.port},portCheckSequence=function*(s){s&&(yield*s),yield 0};async function getPorts(s){let e,t=new Set;if(s&&(s.port&&(e=typeof s.port=="number"?[s.port]:s.port),s.exclude)){const o=s.exclude;if(typeof o[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(const a of o){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}t=new Set(o)}timeout===void 0&&(timeout=setTimeout(()=>{timeout=void 0,lockedPorts.old=lockedPorts.young,lockedPorts.young=new Set},releaseOldLockedPortsIntervalMs),timeout.unref&&timeout.unref());const n=getLocalHosts();for(const o of portCheckSequence(e))try{if(t.has(o))continue;let a=await getAvailablePort({...s,port:o},n);for(;lockedPorts.old.has(a)||lockedPorts.young.has(a);){if(o!==0)throw new Locked(o);a=await getAvailablePort({...s,port:o},n)}return lockedPorts.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof Locked))throw a}throw new Error("No available ports found")}function portNumbers(s,e){if(!Number.isInteger(s)||!Number.isInteger(e))throw new TypeError("`from` and `to` must be integer numbers");if(s<minPort||s>maxPort)throw new RangeError(`'from' must be between ${minPort} and ${maxPort}`);if(e<minPort||e>maxPort)throw new RangeError(`'to' must be between ${minPort} and ${maxPort}`);if(s>e)throw new RangeError("`to` must be greater than or equal to `from`");return function*(n,o){for(let a=n;a<=o;a++)yield a}(s,e)}async function viteDev({buildWebcomponent:s=!0,hmr:e=!0,webcomponentPrefix:t="likec4",languageServices:n,likec4AssetsDir:o,openBrowser:a,...l}){o??=await fsPromises.mkdtemp(path$1.join(os.tmpdir(),".likec4-assets-"));const{isDev:d,...w}=await viteConfig({...l,languageServices:n,likec4AssetsDir:o,webcomponentPrefix:t}),L=await getPorts({port:[5173,...portNumbers(61e3,61010),...portNumbers(62002,62010)]}),y=await getPorts({port:portNumbers(24678,24690)}),B=await mkTempPublicDir();let N;if(s){const Q=await viteWebcomponentConfig({webcomponentPrefix:t,languageServices:n,outDir:B,base:w.base});N=vite.build({...Q,logLevel:"warn"}).catch(H=>(LikeC4.Y.warn("webcomponent build failed",H),LikeC4.Y.warn("Ignoring error and continuing"),Promise.resolve()))}const z=await vite.createServer({...w,define:Object.assign({},w.define,e&&{"process.env.NODE_ENV":'"development"'}),mode:e?"development":w.mode,publicDir:B,server:{host:"0.0.0.0",port:L,hmr:e&&{overlay:!0,port:y},fs:{strict:!1},open:a??!d}});return await z.listen(),N&&await N,z}async function takeScreenshot({browserContext:s,views:e,output:t,logger:n,timeout:o,maxAttempts:a,outputType:l,theme:d}){let w;const L=e.map(N=>({view:N,attempt:1})),y=[];let B;for(;B=L.shift();){const{view:N,attempt:z}=B,Q=`/export/${encodeURIComponent(N.id)}`;try{if(z>1){w&&(w.close({runBeforeUnload:!0}).catch(le=>n.error(`failed to close page: ${le}`)),w=void 0);const ne=LikeC4.u(z*200,{min:200,max:1e3});n.info(LikeC4.p.cyan(Q)+LikeC4.p.dim(` attempt ${z} of ${a} after ${ne}ms`)),await promises.setTimeout(ne)}else N.hasLayoutDrift&&n.warn(LikeC4.p.yellow("Drift detected, manual layout can not be applied, view may be invalid: ")+LikeC4.p.red(N.id)),n.info(LikeC4.p.cyan(Q));w??=await s.newPage(),await w.setViewportSize({width:N.bounds.width+20*2,height:N.bounds.height+20*2}),await w.goto(Q+`?padding=20&theme=${d}`);const H=w.getByRole("presentation");await H.waitFor(),N.nodes.some(ne=>LikeC4.d(ne.icon)&&ne.icon.toLowerCase().startsWith("http"))&&await I(w,o);let T=".";l==="relative"&&(T=N.relativePath??".",T.includes("/")?T=T.slice(0,T.lastIndexOf("/")):T=".");const X=path$1.resolve(t,T,`${N.id}.png`);await H.screenshot({path:X,omitBackground:!0}),y.push({view:N,path:X})}catch(H){w?.close({runBeforeUnload:!0}).catch(T=>n.error(`failed to close page: ${T}`)),n.error(LikeC4.p.red("failed "+Q+`
428
- `+H)),z<a&&(L.push({view:N,attempt:z+1}),n.info(LikeC4.p.dim(`retry ${Q}`))),w=void 0}}return y}async function I(s,e){let t=await s.locator("//img").all();if(!t.length)return;const n=t.map(o=>o.evaluate(a=>a.complete||new Promise((l,d)=>{a.onload=l,a.onerror=d}),{timeout:Math.max(3e4,e)}));await Promise.allSettled(n)}async function exportViewsToPNG({logger:s,serverUrl:e,theme:t="light",timeoutMs:n=15e3,views:o,output:a,outputType:l="relative",maxAttempts:d=3}){s.info(`${LikeC4.p.cyan("export output")} ${LikeC4.p.dim(a)}`),s.info(`${LikeC4.p.cyan("from server")} ${LikeC4.p.dim(e)}`);const w=playwright.chromium.executablePath();s.info(LikeC4.p.cyan("Start chromium")),s.info(LikeC4.p.dim(w));const L=await playwright.chromium.launch();s.info(LikeC4.p.cyan("Color scheme: ")+t);const y=await L.newContext({deviceScaleFactor:2,colorScheme:t,baseURL:e,ignoreHTTPSErrors:!0,reducedMotion:"reduce",isMobile:!1});y.setDefaultNavigationTimeout(n),y.setDefaultTimeout(n);try{return await takeScreenshot({browserContext:y,views:o,output:a,outputType:l,logger:s,maxAttempts:d,timeout:n,theme:t})}finally{s.info(LikeC4.p.cyan("close chromium")),await y.close(),await L.close()}}async function pngHandler({path:s,useDotBin:e,theme:t="light",output:n,outputType:o,serverUrl:a,ignore:l=!1,timeoutMs:d=1e4,maxAttempts:w=3}){const L=LikeC4.j("c4:export"),y=process$1.hrtime(),B=await LikeC4.L.fromWorkspace(s,{logger:"vite",graphviz:e?"binary":"wasm"});n??=B.workspace;const N=await B.diagrams();if(!index_DafVOuVd.Q(N,1))throw L.warn("no views found"),new Error("no views found");let z;if(!a&&(L.info(LikeC4.p.cyan("start preview server")),z=await viteDev({languageServices:B,buildWebcomponent:!1,openBrowser:!1,useOverviewGraph:!1,hmr:!1}),a=resolveServerUrl(z),!a))throw L.error("Vite server is not ready, no resolvedUrls"),new Error("Vite server is not ready, no resolvedUrls");try{const Q=await exportViewsToPNG({logger:L,serverUrl:a,theme:t,timeoutMs:d,views:N,output:n,outputType:o,maxAttempts:w}),{pretty:H}=LikeC4.q(y);if(Q.length>0&&L.info(LikeC4.p.green(`exported ${Q.length} views in ${H}`)),Q.length!==N.length&&(l&&Q.length>0?L.info(LikeC4.p.dim("ignore")+" "+LikeC4.p.red(`failed ${N.length-Q.length} out of ${N.length} views`)):L.error(LikeC4.p.red(`failed ${N.length-Q.length} out of ${N.length} views`))),Q.length!==N.length&&(Q.length===0||!l))throw new Error(`Failed ${N.length-Q.length} out of ${N.length} views`)}finally{z&&(L.info(LikeC4.p.cyan("stop server")),await z.close().catch(Q=>{L.error(Q)}))}}const{cyan:p,dim:f}=LikeC4.p;async function buildHandler({path:s,useDotBin:e,useHashHistory:t,webcomponentPrefix:n,useOverview:o=!1,output:a,base:l}){const d=LikeC4.j("c4:build"),w=await LikeC4.L.fromWorkspace(s,{graphviz:e?"binary":"wasm",logger:"vite"}),L=a??path$1.resolve(w.workspace,"dist");let y=path$1.resolve(L,"assets");if(o)try{y=path$1.resolve(L,"assets","previews"),await fsPromises.mkdir(y,{recursive:!0}),d.info(`${p("Generate previews")} ${f(y)}
429
- `),await pngHandler({path:s,useDotBin:e,output:y,outputType:"flat",ignore:!0})}catch(B){d.error(LikeC4.p.red("Failed to generate previews")),d.error(B),d.warn(LikeC4.p.yellow("Ignore previews and continue build")),fs.rmSync(y,{recursive:!0,force:!0}),o=!1}await viteBuild({base:l,useHashHistory:t,customLogger:d,useOverviewGraph:o,webcomponentPrefix:n,languageServices:w,likec4AssetsDir:y,outputDir:a}),o&&(d.info(`${p("clean previews")} ${f(y)}`),fs.rmSync(y,{recursive:!0,force:!0}))}const buildCmd={command:"build [path]",aliases:["bundle"],describe:"Build a static website",builder:s=>s.positional("path",path).option("output",{alias:"o",type:"string",desc:"output directory for production build",normalize:!0,coerce:path$1.resolve}).option("base",base).option("use-hash-history",useHashHistory).option("use-dot",useDotBin).option("webcomponent-prefix",webcomponentPrefix).option("use-overview",useOverview).example(`${LikeC4.p.green("$0 build -o ./build ./src")}`,LikeC4.p.gray("Search for likec4 files in 'src' and output static site to 'build'")),handler:async s=>{await buildHandler({path:s.path,output:s.output,base:s.base,useHashHistory:s["use-hash-history"],useDotBin:s["use-dot"],useOverview:s["use-overview"]??!1,webcomponentPrefix:s["webcomponent-prefix"]})}};async function A(s,e,t){const n=".ts";e=e??path$1.resolve(s.workspace,"likec4.generated"+n),path$1.extname(e)!==n&&(e=e+n),await fsPromises.mkdir(path$1.dirname(e),{recursive:!0});const o=await s.diagrams(),a=J([...o]);await fsPromises.writeFile(e,a),t.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),e)}`)}async function D(s,e,t){await fsPromises.mkdir(e,{recursive:!0}),t.info(`${LikeC4.p.dim("format")} ${LikeC4.p.green("dot")}`),t.info(`${LikeC4.p.dim("outdir")} ${e}`);const n=new Set,o=await s.viewsService.layoutAllViews();let a=0;for(const{diagram:l,dot:d}of o)try{const w=l.relativePath??"";w!==""&&!n.has(w)&&(await fsPromises.mkdir(path$1.resolve(e,w),{recursive:!0}),n.add(w));const L=path$1.resolve(e,w,l.id+".dot");index_DafVOuVd.u(d,`dot for ${l.id} not found`),await fsPromises.writeFile(L,d),t.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),L)}`),a++}catch(w){t.error(`error while generating ${l.id}`,{error:w})}a>0&&t.info(`${LikeC4.p.dim("total")} ${a} files`)}async function F(s,e,t,n){await fsPromises.mkdir(t,{recursive:!0}),n.info(`${LikeC4.p.dim("format")} ${LikeC4.p.green(e)}`),n.info(`${LikeC4.p.dim("outdir")} ${t}`);let o,a;switch(e){case"d2":o=".d2",a=P$1;break;case"mermaid":o=".mmd",a=S;break;default:index_DafVOuVd.l(e)}const l=new Set,d=await s.diagrams();let w=0;for(const L of d)try{let y=L.relativePath??".";y.includes("/")?y=y.slice(0,y.lastIndexOf("/")):y=".",y!==""&&!l.has(y)&&(await fsPromises.mkdir(path$1.resolve(t,y),{recursive:!0}),l.add(y));const B=path$1.resolve(t,y,L.id+o),N=a(L);await fsPromises.writeFile(B,N),n.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),B)}`),w++}catch(y){n.error(`error while generating ${L.id}`,{error:y})}w>0&&n.info(`${LikeC4.p.dim("total")} ${w} files`)}async function legacyHandler({path:s,useDotBin:e,...t}){const n=LikeC4.j("c4:codegen"),o=LikeC4.s(n),a=await LikeC4.L.fromWorkspace(s,{logger:"vite",graphviz:e?"binary":"wasm"});if((await a.viewsService.computedViews()).length===0)throw n.warn("no views found"),process.exitCode=1,new Error("no views found");switch(t.format){case"views":{await A(a,t.outfile,n);break}case"dot":{await D(a,t.outdir??s,n);break}case"d2":case"mermaid":{await F(a,t.format,t.outdir??s,n);break}default:index_DafVOuVd.l(t)}o.stopAndLog()}async function modelHandler({path:s,useDotBin:e,outfile:t}){const n=LikeC4.j("c4:codegen"),o=LikeC4.s(n),a=await LikeC4.L.fromWorkspace(s,{logger:"vite",graphviz:e?"binary":"wasm"});n.info(`${LikeC4.p.dim("format")} ${LikeC4.p.green("model")}`);const l=await a.layoutedModel();for(const B of l.views())B.$view.hasLayoutDrift&&n.warn(LikeC4.p.yellow("drift detected, manual layout can not be applied, view:")+" "+LikeC4.p.red(B.id));let d=path$1.resolve(a.workspace,"likec4-model.ts");if(t&&(d=path$1.isAbsolute(t)?t:path$1.resolve(t),fs.existsSync(t)&&(await fsPromises.stat(t)).isDirectory()))throw new Error(`output file is a directory: ${t}`);const w=path$1.basename(d);n.info(`${LikeC4.p.dim("filename")} ${w}`);const L=path$1.extname(w).toLocaleLowerCase();if(![".ts",".mts",".cts"].includes(L))throw n.error(`output file ${t} has extension "${L}"`),new Error(`output file ${t} must be a .ts, .mts or .cts file`);const y=path$1.dirname(d);n.info(`${LikeC4.p.dim("outdir")} ${y}`),await fsPromises.mkdir(y,{recursive:!0}),await fsPromises.writeFile(d,q(l),{encoding:"utf-8"}),LikeC4.Y.box({message:LikeC4.r(`
428
+ `+H)),z<a&&(L.push({view:N,attempt:z+1}),n.info(LikeC4.p.dim(`retry ${Q}`))),w=void 0}}return y}async function I(s,e){let t=await s.locator("//img").all();if(!t.length)return;const n=t.map(o=>o.evaluate(a=>a.complete||new Promise((l,d)=>{a.onload=l,a.onerror=d}),{timeout:Math.max(3e4,e)}));await Promise.allSettled(n)}async function exportViewsToPNG({logger:s,serverUrl:e,theme:t="light",timeoutMs:n=15e3,views:o,output:a,outputType:l="relative",maxAttempts:d=3}){s.info(`${LikeC4.p.cyan("export output")} ${LikeC4.p.dim(a)}`),s.info(`${LikeC4.p.cyan("from server")} ${LikeC4.p.dim(e)}`);const w=playwright.chromium.executablePath();s.info(LikeC4.p.cyan("Start chromium")),s.info(LikeC4.p.dim(w));const L=await playwright.chromium.launch();s.info(LikeC4.p.cyan("Color scheme: ")+t);const y=await L.newContext({deviceScaleFactor:2,colorScheme:t,baseURL:e,ignoreHTTPSErrors:!0,reducedMotion:"reduce",isMobile:!1});y.setDefaultNavigationTimeout(n),y.setDefaultTimeout(n);try{return await takeScreenshot({browserContext:y,views:o,output:a,outputType:l,logger:s,maxAttempts:d,timeout:n,theme:t})}finally{s.info(LikeC4.p.cyan("close chromium")),await y.close(),await L.close()}}async function pngHandler({path:s,useDotBin:e,theme:t="light",output:n,outputType:o,serverUrl:a,ignore:l=!1,timeoutMs:d=1e4,maxAttempts:w=3}){const L=LikeC4.j("c4:export"),y=process$1.hrtime(),B=await LikeC4.L.fromWorkspace(s,{logger:"vite",graphviz:e?"binary":"wasm"});n??=B.workspace;const N=await B.diagrams();if(!index_KOeaSlL8.Q(N,1))throw L.warn("no views found"),new Error("no views found");let z;if(!a&&(L.info(LikeC4.p.cyan("start preview server")),z=await viteDev({languageServices:B,buildWebcomponent:!1,openBrowser:!1,useOverviewGraph:!1,hmr:!1}),a=resolveServerUrl(z),!a))throw L.error("Vite server is not ready, no resolvedUrls"),new Error("Vite server is not ready, no resolvedUrls");try{const Q=await exportViewsToPNG({logger:L,serverUrl:a,theme:t,timeoutMs:d,views:N,output:n,outputType:o,maxAttempts:w}),{pretty:H}=LikeC4.q(y);if(Q.length>0&&L.info(LikeC4.p.green(`exported ${Q.length} views in ${H}`)),Q.length!==N.length&&(l&&Q.length>0?L.info(LikeC4.p.dim("ignore")+" "+LikeC4.p.red(`failed ${N.length-Q.length} out of ${N.length} views`)):L.error(LikeC4.p.red(`failed ${N.length-Q.length} out of ${N.length} views`))),Q.length!==N.length&&(Q.length===0||!l))throw new Error(`Failed ${N.length-Q.length} out of ${N.length} views`)}finally{z&&(L.info(LikeC4.p.cyan("stop server")),await z.close().catch(Q=>{L.error(Q)}))}}const{cyan:p,dim:f}=LikeC4.p;async function buildHandler({path:s,useDotBin:e,useHashHistory:t,webcomponentPrefix:n,useOverview:o=!1,output:a,base:l}){const d=LikeC4.j("c4:build"),w=await LikeC4.L.fromWorkspace(s,{graphviz:e?"binary":"wasm",logger:"vite"}),L=a??path$1.resolve(w.workspace,"dist");let y=path$1.resolve(L,"assets");if(o)try{y=path$1.resolve(L,"assets","previews"),await fsPromises.mkdir(y,{recursive:!0}),d.info(`${p("Generate previews")} ${f(y)}
429
+ `),await pngHandler({path:s,useDotBin:e,output:y,outputType:"flat",ignore:!0})}catch(B){d.error(LikeC4.p.red("Failed to generate previews")),d.error(B),d.warn(LikeC4.p.yellow("Ignore previews and continue build")),fs.rmSync(y,{recursive:!0,force:!0}),o=!1}await viteBuild({base:l,useHashHistory:t,customLogger:d,useOverviewGraph:o,webcomponentPrefix:n,languageServices:w,likec4AssetsDir:y,outputDir:a}),o&&(d.info(`${p("clean previews")} ${f(y)}`),fs.rmSync(y,{recursive:!0,force:!0}))}const buildCmd={command:"build [path]",aliases:["bundle"],describe:"Build a static website",builder:s=>s.positional("path",path).option("output",{alias:"o",type:"string",desc:"output directory for production build",normalize:!0,coerce:path$1.resolve}).option("base",base).option("use-hash-history",useHashHistory).option("use-dot",useDotBin).option("webcomponent-prefix",webcomponentPrefix).option("use-overview",useOverview).example(`${LikeC4.p.green("$0 build -o ./build ./src")}`,LikeC4.p.gray("Search for likec4 files in 'src' and output static site to 'build'")),handler:async s=>{await buildHandler({path:s.path,output:s.output,base:s.base,useHashHistory:s["use-hash-history"],useDotBin:s["use-dot"],useOverview:s["use-overview"]??!1,webcomponentPrefix:s["webcomponent-prefix"]})}};async function A(s,e,t){const n=".ts";e=e??path$1.resolve(s.workspace,"likec4.generated"+n),path$1.extname(e)!==n&&(e=e+n),await fsPromises.mkdir(path$1.dirname(e),{recursive:!0});const o=await s.diagrams(),a=J([...o]);await fsPromises.writeFile(e,a),t.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),e)}`)}async function D(s,e,t){await fsPromises.mkdir(e,{recursive:!0}),t.info(`${LikeC4.p.dim("format")} ${LikeC4.p.green("dot")}`),t.info(`${LikeC4.p.dim("outdir")} ${e}`);const n=new Set,o=await s.viewsService.layoutAllViews();let a=0;for(const{diagram:l,dot:d}of o)try{const w=l.relativePath??"";w!==""&&!n.has(w)&&(await fsPromises.mkdir(path$1.resolve(e,w),{recursive:!0}),n.add(w));const L=path$1.resolve(e,w,l.id+".dot");index_KOeaSlL8.o(d,`dot for ${l.id} not found`),await fsPromises.writeFile(L,d),t.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),L)}`),a++}catch(w){t.error(`error while generating ${l.id}`,{error:w})}a>0&&t.info(`${LikeC4.p.dim("total")} ${a} files`)}async function F(s,e,t,n){await fsPromises.mkdir(t,{recursive:!0}),n.info(`${LikeC4.p.dim("format")} ${LikeC4.p.green(e)}`),n.info(`${LikeC4.p.dim("outdir")} ${t}`);let o,a;switch(e){case"d2":o=".d2",a=P$1;break;case"mermaid":o=".mmd",a=S;break;default:index_KOeaSlL8.n(e)}const l=new Set,d=await s.diagrams();let w=0;for(const L of d)try{let y=L.relativePath??".";y.includes("/")?y=y.slice(0,y.lastIndexOf("/")):y=".",y!==""&&!l.has(y)&&(await fsPromises.mkdir(path$1.resolve(t,y),{recursive:!0}),l.add(y));const B=path$1.resolve(t,y,L.id+o),N=a(L);await fsPromises.writeFile(B,N),n.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),B)}`),w++}catch(y){n.error(`error while generating ${L.id}`,{error:y})}w>0&&n.info(`${LikeC4.p.dim("total")} ${w} files`)}async function legacyHandler({path:s,useDotBin:e,...t}){const n=LikeC4.j("c4:codegen"),o=LikeC4.s(n),a=await LikeC4.L.fromWorkspace(s,{logger:"vite",graphviz:e?"binary":"wasm"});if((await a.viewsService.computedViews()).length===0)throw n.warn("no views found"),process.exitCode=1,new Error("no views found");switch(t.format){case"views":{await A(a,t.outfile,n);break}case"dot":{await D(a,t.outdir??s,n);break}case"d2":case"mermaid":{await F(a,t.format,t.outdir??s,n);break}default:index_KOeaSlL8.n(t)}o.stopAndLog()}async function modelHandler({path:s,useDotBin:e,outfile:t}){const n=LikeC4.j("c4:codegen"),o=LikeC4.s(n),a=await LikeC4.L.fromWorkspace(s,{logger:"vite",graphviz:e?"binary":"wasm"});n.info(`${LikeC4.p.dim("format")} ${LikeC4.p.green("model")}`);const l=await a.layoutedModel();for(const B of l.views())B.$view.hasLayoutDrift&&n.warn(LikeC4.p.yellow("drift detected, manual layout can not be applied, view:")+" "+LikeC4.p.red(B.id));let d=path$1.resolve(a.workspace,"likec4-model.ts");if(t&&(d=path$1.isAbsolute(t)?t:path$1.resolve(t),fs.existsSync(t)&&(await fsPromises.stat(t)).isDirectory()))throw new Error(`output file is a directory: ${t}`);const w=path$1.basename(d);n.info(`${LikeC4.p.dim("filename")} ${w}`);const L=path$1.extname(w).toLocaleLowerCase();if(![".ts",".mts",".cts"].includes(L))throw n.error(`output file ${t} has extension "${L}"`),new Error(`output file ${t} must be a .ts, .mts or .cts file`);const y=path$1.dirname(d);n.info(`${LikeC4.p.dim("outdir")} ${y}`),await fsPromises.mkdir(y,{recursive:!0}),await fsPromises.writeFile(d,q(l),{encoding:"utf-8"}),LikeC4.Y.box({message:LikeC4.r(`
430
430
  ${LikeC4.p.dim("Source with LikeC4Model generated:")}
431
431
  ${path$1.relative(process$1.cwd(),d)}
432
432
 
@@ -459,7 +459,7 @@ if (import.meta.hot) {
459
459
 
460
460
  ${LikeC4.p.green("$0 export png --theme dark -o ./png src/likec4 ")}
461
461
  ${LikeC4.p.gray("Search for likec4 files in src/likec4 and output PNG with dark theme to png folder")}
462
- `),handler:async e=>{index_DafVOuVd.u(e.timeout>=1,"timeout must be >= 1"),index_DafVOuVd.u(e["max-attempts"]>=1,"max-attempts must be >= 1"),await pngHandler({path:e.path,useDotBin:e.useDotBin,output:e.output,timeoutMs:e.timeout*1e3,maxAttempts:e.maxAttempts,ignore:e.ignore===!0,outputType:e.flat?"flat":"relative",serverUrl:e.serverUrl,theme:e.theme??"light"})}}).command({command:"json [path]",describe:"export model to JSON",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> output .json file",default:"likec4.json",normalize:!0,coerce:path$1.resolve}).option("use-dot",useDotBin).epilog(`${LikeC4.p.bold("Examples:")}
462
+ `),handler:async e=>{index_KOeaSlL8.o(e.timeout>=1,"timeout must be >= 1"),index_KOeaSlL8.o(e["max-attempts"]>=1,"max-attempts must be >= 1"),await pngHandler({path:e.path,useDotBin:e.useDotBin,output:e.output,timeoutMs:e.timeout*1e3,maxAttempts:e.maxAttempts,ignore:e.ignore===!0,outputType:e.flat?"flat":"relative",serverUrl:e.serverUrl,theme:e.theme??"light"})}}).command({command:"json [path]",describe:"export model to JSON",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> output .json file",default:"likec4.json",normalize:!0,coerce:path$1.resolve}).option("use-dot",useDotBin).epilog(`${LikeC4.p.bold("Examples:")}
463
463
  ${LikeC4.p.green("$0 export json")}
464
464
  ${LikeC4.p.gray("Search for likec4 files in current directory and output JSON to likec4.json")}
465
465