likec4 1.20.0 → 1.20.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.DBfW7tKq.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"),core=require("@likec4/core"),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("@likec4/core/compute-view"),require("node:child_process"),require("node:string_decoder"),require("node:events"),require("node:v8"),require("node:stream"),require("node:buffer"),require("node:stream/promises"),require("@likec4/core/model");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
- `).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
- `)}rowToString(e,t){return this.rasterize(e).forEach((n,o)=>{let a="";n.forEach((l,d)=>{const{width:w}=e[d],_=this.negatePadding(e[d]);let E=l;if(_>mixin$1.stringWidth(l)&&(E+=" ".repeat(_-mixin$1.stringWidth(l))),e[d].align&&e[d].align!=="left"&&this.wrap){const L=align[e[d].align];E=L(E,_),mixin$1.stringWidth(E)<_&&(E+=" ".repeat((w||0)-mixin$1.stringWidth(E)-1))}const y=e[d].padding||[0,0,0,0];y[left]&&(a+=" ".repeat(y[left])),a+=addBorder(e[d],E,"| "),a+=E,a+=addBorder(e[d],E," |"),y[right]&&(a+=" ".repeat(y[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
- `):o=a.text.split(`
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 _=t[w];for(let E=0;E<l;E++)_[E]===void 0&&_.push("");_.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),_=n.configObjects||[],E=n.envPrefix,y=d["populate--"],L=y?"--":"_",W=Object.create(null),K=Object.create(null),z=n.__||mixin.format,N={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:[]},Q=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,te=new RegExp("^--"+d["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(B){const U=typeof B=="object"?B.key:B,X=Object.keys(B).map(function(H){return{boolean:"bools",string:"strings",number:"numbers"}[H]}).filter(Boolean).pop();X&&(N[X][U]=!0),N.arrays[U]=!0,N.keys.push(U)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(B){N.bools[B]=!0,N.keys.push(B)}),[].concat(n.string||[]).filter(Boolean).forEach(function(B){N.strings[B]=!0,N.keys.push(B)}),[].concat(n.number||[]).filter(Boolean).forEach(function(B){N.numbers[B]=!0,N.keys.push(B)}),[].concat(n.count||[]).filter(Boolean).forEach(function(B){N.counts[B]=!0,N.keys.push(B)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(B){N.normalize[B]=!0,N.keys.push(B)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([B,U])=>{typeof U=="number"&&(N.nargs[B]=U,N.keys.push(B))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([B,U])=>{typeof U=="function"&&(N.coercions[B]=U,N.keys.push(B))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(B){N.configs[B]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([B,U])=>{(typeof U=="boolean"||typeof U=="function")&&(N.configs[B]=U)})),je(n.key,l,n.default,N.arrays),Object.keys(w).forEach(function(B){(N.aliases[B]||[]).forEach(function(U){w[U]=w[B]})});let ce=null;Pe();let oe=[];const le=Object.assign(Object.create(null),{_:[]}),ye={};for(let B=0;B<o.length;B++){const U=o[B],X=U.replace(/^-{3,}/,"---");let H,T,ie,ee,se,Fe;if(U!=="--"&&/^-/.test(U)&&Ce(U))Be(U);else if(X.match(/^---+(=|$)/)){Be(U);continue}else if(U.match(/^--.+=/)||!d["short-option-groups"]&&U.match(/^-.+=/))ee=U.match(/^--?([^=]+)=([\s\S]*)$/),ee!==null&&Array.isArray(ee)&&ee.length>=3&&(ae(ee[1],N.arrays)?B=$e(B,ee[1],o,ee[2]):ae(ee[1],N.nargs)!==!1?B=Le(B,ee[1],o,ee[2]):me(ee[1],ee[2],!0));else if(U.match(te)&&d["boolean-negation"])ee=U.match(te),ee!==null&&Array.isArray(ee)&&ee.length>=2&&(T=ee[1],me(T,ae(T,N.arrays)?[!1]:!1));else if(U.match(/^--.+/)||!d["short-option-groups"]&&U.match(/^-[^-]+/))ee=U.match(/^--?(.+)/),ee!==null&&Array.isArray(ee)&&ee.length>=2&&(T=ee[1],ae(T,N.arrays)?B=$e(B,T,o):ae(T,N.nargs)!==!1?B=Le(B,T,o):(se=o[B+1],se!==void 0&&(!se.match(/^-/)||se.match(Q))&&!ae(T,N.bools)&&!ae(T,N.counts)||/^(true|false)$/.test(se)?(me(T,se),B++):me(T,we(T))));else if(U.match(/^-.\..+=/))ee=U.match(/^-([^=]+)=([\s\S]*)$/),ee!==null&&Array.isArray(ee)&&ee.length>=3&&me(ee[1],ee[2]);else if(U.match(/^-.\..+/)&&!U.match(Q))se=o[B+1],ee=U.match(/^-(.\..+)/),ee!==null&&Array.isArray(ee)&&ee.length>=2&&(T=ee[1],se!==void 0&&!se.match(/^-/)&&!ae(T,N.bools)&&!ae(T,N.counts)?(me(T,se),B++):me(T,we(T)));else if(U.match(/^-[^-]+/)&&!U.match(Q)){ie=U.slice(1,-1).split(""),H=!1;for(let ve=0;ve<ie.length;ve++){if(se=U.slice(ve+2),ie[ve+1]&&ie[ve+1]==="="){Fe=U.slice(ve+3),T=ie[ve],ae(T,N.arrays)?B=$e(B,T,o,Fe):ae(T,N.nargs)!==!1?B=Le(B,T,o,Fe):me(T,Fe),H=!0;break}if(se==="-"){me(ie[ve],se);continue}if(/[A-Za-z]/.test(ie[ve])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(se)&&ae(se,N.bools)===!1){me(ie[ve],se),H=!0;break}if(ie[ve+1]&&ie[ve+1].match(/\W/)){me(ie[ve],se),H=!0;break}else me(ie[ve],we(ie[ve]))}T=U.slice(-1)[0],!H&&T!=="-"&&(ae(T,N.arrays)?B=$e(B,T,o):ae(T,N.nargs)!==!1?B=Le(B,T,o):(se=o[B+1],se!==void 0&&(!/^(-|--)[^-]/.test(se)||se.match(Q))&&!ae(T,N.bools)&&!ae(T,N.counts)||/^(true|false)$/.test(se)?(me(T,se),B++):me(T,we(T))))}else if(U.match(/^-[0-9]$/)&&U.match(Q)&&ae(U.slice(1),N.bools))T=U.slice(1),me(T,we(T));else if(U==="--"){oe=o.slice(B+1);break}else if(d["halt-at-non-option"]){oe=o.slice(B);break}else Be(U)}he(le,!0),he(le,!1),fe(le),Ee(),De(le,N.aliases,w,!0),be(le),d["set-placeholder-key"]&&Ie(le),Object.keys(N.counts).forEach(function(B){Se(le,B.split("."))||me(B,0)}),y&&oe.length&&(le[L]=[]),oe.forEach(function(B){le[L].push(B)}),d["camel-case-expansion"]&&d["strip-dashed"]&&Object.keys(le).filter(B=>B!=="--"&&B.includes("-")).forEach(B=>{delete le[B]}),d["strip-aliased"]&&[].concat(...Object.keys(l).map(B=>l[B])).forEach(B=>{d["camel-case-expansion"]&&B.includes("-")&&delete le[B.split(".").map(U=>camelCase(U)).join(".")],delete le[B]});function Be(B){const U=ne("_",B);(typeof U=="string"||typeof U=="number")&&le._.push(U)}function Le(B,U,X,H){let T,ie=ae(U,N.nargs);if(ie=typeof ie!="number"||isNaN(ie)?1:ie,ie===0)return Oe(H)||(ce=Error(z("Argument unexpected for: %s",U))),me(U,we(U)),B;let ee=Oe(H)?0:1;if(d["nargs-eats-options"])X.length-(B+1)+ee<ie&&(ce=Error(z("Not enough arguments following: %s",U))),ee=ie;else{for(T=B+1;T<X.length&&(!X[T].match(/^-[^0-9]/)||X[T].match(Q)||Ce(X[T]));T++)ee++;ee<ie&&(ce=Error(z("Not enough arguments following: %s",U)))}let se=Math.min(ee,ie);for(!Oe(H)&&se>0&&(me(U,H),se--),T=B+1;T<se+B+1;T++)me(U,X[T]);return B+se}function $e(B,U,X,H){let T=[],ie=H||X[B+1];const ee=ae(U,N.nargs);if(ae(U,N.bools)&&!/^(true|false)$/.test(ie))T.push(!0);else if(Oe(ie)||Oe(H)&&/^-/.test(ie)&&!Q.test(ie)&&!Ce(ie)){if(w[U]!==void 0){const se=w[U];T=Array.isArray(se)?se:[se]}}else{Oe(H)||T.push(Z(U,H,!0));for(let se=B+1;se<X.length&&!(!d["greedy-arrays"]&&T.length>0||ee&&typeof ee=="number"&&T.length>=ee||(ie=X[se],/^-/.test(ie)&&!Q.test(ie)&&!Ce(ie)));se++)B=se,T.push(Z(U,ie,a))}return typeof ee=="number"&&(ee&&T.length<ee||isNaN(ee)&&T.length===0)&&(ce=Error(z("Not enough arguments following: %s",U))),me(U,T),B}function me(B,U,X=a){if(/-/.test(B)&&d["camel-case-expansion"]){const ie=B.split(".").map(function(ee){return camelCase(ee)}).join(".");re(B,ie)}const H=Z(B,U,X),T=B.split(".");xe(le,T,H),N.aliases[B]&&N.aliases[B].forEach(function(ie){const ee=ie.split(".");xe(le,ee,H)}),T.length>1&&d["dot-notation"]&&(N.aliases[T[0]]||[]).forEach(function(ie){let ee=ie.split(".");const se=[].concat(T);se.shift(),ee=ee.concat(se),(N.aliases[B]||[]).includes(ee.join("."))||xe(le,ee,H)}),ae(B,N.normalize)&&!ae(B,N.arrays)&&[B].concat(N.aliases[B]||[]).forEach(function(ee){Object.defineProperty(ye,ee,{enumerable:!0,get(){return U},set(se){U=typeof se=="string"?mixin.normalize(se):se}})})}function re(B,U){N.aliases[B]&&N.aliases[B].length||(N.aliases[B]=[U],W[U]=!0),N.aliases[U]&&N.aliases[U].length||re(U,B)}function Z(B,U,X){X&&(U=stripQuotes(U)),(ae(B,N.bools)||ae(B,N.counts))&&typeof U=="string"&&(U=U==="true");let H=Array.isArray(U)?U.map(function(T){return ne(B,T)}):ne(B,U);return ae(B,N.counts)&&(Oe(H)||typeof H=="boolean")&&(H=increment()),ae(B,N.normalize)&&ae(B,N.arrays)&&(Array.isArray(U)?H=U.map(T=>mixin.normalize(T)):H=mixin.normalize(U)),H}function ne(B,U){return!d["parse-positional-numbers"]&&B==="_"||!ae(B,N.strings)&&!ae(B,N.bools)&&!Array.isArray(U)&&(looksLikeNumber(U)&&d["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${U}`)))||!Oe(U)&&ae(B,N.numbers))&&(U=Number(U)),U}function fe(B){const U=Object.create(null);De(U,N.aliases,w),Object.keys(N.configs).forEach(function(X){const H=B[X]||U[X];if(H)try{let T=null;const ie=mixin.resolve(mixin.cwd(),H),ee=N.configs[X];if(typeof ee=="function"){try{T=ee(ie)}catch(se){T=se}if(T instanceof Error){ce=T;return}}else T=mixin.require(ie);pe(T)}catch(T){T.name==="PermissionDenied"?ce=T:B[X]&&(ce=Error(z("Invalid JSON config file: %s",H)))}})}function pe(B,U){Object.keys(B).forEach(function(X){const H=B[X],T=U?U+"."+X:X;typeof H=="object"&&H!==null&&!Array.isArray(H)&&d["dot-notation"]?pe(H,T):(!Se(le,T.split("."))||ae(T,N.arrays)&&d["combine-arrays"])&&me(T,H)})}function Ee(){typeof _<"u"&&_.forEach(function(B){pe(B)})}function he(B,U){if(typeof E>"u")return;const X=typeof E=="string"?E:"",H=mixin.env();Object.keys(H).forEach(function(T){if(X===""||T.lastIndexOf(X,0)===0){const ie=T.split("__").map(function(ee,se){return se===0&&(ee=ee.substring(X.length)),camelCase(ee)});(U&&N.configs[ie.join(".")]||!U)&&!Se(B,ie)&&me(ie.join("."),H[T])}})}function be(B){let U;const X=new Set;Object.keys(B).forEach(function(H){if(!X.has(H)&&(U=ae(H,N.coercions),typeof U=="function"))try{const T=ne(H,U(B[H]));[].concat(N.aliases[H]||[],H).forEach(ie=>{X.add(ie),B[ie]=T})}catch(T){ce=T}})}function Ie(B){return N.keys.forEach(U=>{~U.indexOf(".")||typeof B[U]>"u"&&(B[U]=void 0)}),B}function De(B,U,X,H=!1){Object.keys(X).forEach(function(T){Se(B,T.split("."))||(xe(B,T.split("."),X[T]),H&&(K[T]=!0),(U[T]||[]).forEach(function(ie){Se(B,ie.split("."))||xe(B,ie.split("."),X[T])}))})}function Se(B,U){let X=B;d["dot-notation"]||(U=[U.join(".")]),U.slice(0,-1).forEach(function(T){X=X[T]||{}});const H=U[U.length-1];return typeof X!="object"?!1:H in X}function xe(B,U,X){let H=B;d["dot-notation"]||(U=[U.join(".")]),U.slice(0,-1).forEach(function(Fe){Fe=sanitizeKey(Fe),typeof H=="object"&&H[Fe]===void 0&&(H[Fe]={}),typeof H[Fe]!="object"||Array.isArray(H[Fe])?(Array.isArray(H[Fe])?H[Fe].push({}):H[Fe]=[H[Fe],{}],H=H[Fe][H[Fe].length-1]):H=H[Fe]});const T=sanitizeKey(U[U.length-1]),ie=ae(U.join("."),N.arrays),ee=Array.isArray(X);let se=d["duplicate-arguments-array"];!se&&ae(T,N.nargs)&&(se=!0,(!Oe(H[T])&&N.nargs[T]===1||Array.isArray(H[T])&&H[T].length===N.nargs[T])&&(H[T]=void 0)),X===increment()?H[T]=increment(H[T]):Array.isArray(H[T])?se&&ie&&ee?H[T]=d["flatten-duplicate-arrays"]?H[T].concat(X):(Array.isArray(H[T][0])?H[T]:[H[T]]).concat([X]):!se&&!!ie==!!ee?H[T]=X:H[T]=H[T].concat([X]):H[T]===void 0&&ie?H[T]=ee?X:[X]:se&&!(H[T]===void 0||ae(T,N.counts)||ae(T,N.bools))?H[T]=[H[T],X]:H[T]=X}function je(...B){B.forEach(function(U){Object.keys(U||{}).forEach(function(X){N.aliases[X]||(N.aliases[X]=[].concat(l[X]||[]),N.aliases[X].concat(X).forEach(function(H){if(/-/.test(H)&&d["camel-case-expansion"]){const T=camelCase(H);T!==X&&N.aliases[X].indexOf(T)===-1&&(N.aliases[X].push(T),W[T]=!0)}}),N.aliases[X].concat(X).forEach(function(H){if(H.length>1&&/[A-Z]/.test(H)&&d["camel-case-expansion"]){const T=decamelize(H,"-");T!==X&&N.aliases[X].indexOf(T)===-1&&(N.aliases[X].push(T),W[T]=!0)}}),N.aliases[X].forEach(function(H){N.aliases[H]=[X].concat(N.aliases[X].filter(function(T){return H!==T}))}))})})}function ae(B,U){const X=[].concat(N.aliases[B]||[],B),H=Object.keys(U),T=X.find(ie=>H.includes(ie));return T?U[T]:!1}function Ne(B){const U=Object.keys(N);return[].concat(U.map(H=>N[H])).some(function(H){return Array.isArray(H)?H.includes(B):H[B]})}function ue(B,...U){return[].concat(...U).some(function(H){const T=B.match(H);return T&&Ne(T[1])})}function ge(B){if(B.match(Q)||!B.match(/^-[^-]+/))return!1;let U=!0,X;const H=B.slice(1).split("");for(let T=0;T<H.length;T++){if(X=B.slice(T+2),!Ne(H[T])){U=!1;break}if(H[T+1]&&H[T+1]==="="||X==="-"||/[A-Za-z]/.test(H[T])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(X)||H[T+1]&&H[T+1].match(/\W/))break}return U}function Ce(B){return d["unknown-options-as-args"]&&de(B)}function de(B){return B=B.replace(/^-{3,}/,"--"),B.match(Q)||ge(B)?!1:!ue(B,/^-+([^=]+?)=[\s\S]*$/,te,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function we(B){return!ae(B,N.bools)&&!ae(B,N.counts)&&`${B}`in w?w[B]:Ae(_e(B))}function Ae(B){return{[DefaultValuesForTypeKey.BOOLEAN]:!0,[DefaultValuesForTypeKey.STRING]:"",[DefaultValuesForTypeKey.NUMBER]:void 0,[DefaultValuesForTypeKey.ARRAY]:[]}[B]}function _e(B){let U=DefaultValuesForTypeKey.BOOLEAN;return ae(B,N.strings)?U=DefaultValuesForTypeKey.STRING:ae(B,N.numbers)?U=DefaultValuesForTypeKey.NUMBER:ae(B,N.bools)?U=DefaultValuesForTypeKey.BOOLEAN:ae(B,N.arrays)&&(U=DefaultValuesForTypeKey.ARRAY),U}function Oe(B){return B===void 0}function Pe(){Object.keys(N.counts).find(B=>ae(B,N.arrays)?(ce=Error(z("Invalid configuration: %s, opts.count excludes opts.array.",B)),!0):ae(B,N.nargs)?(ce=Error(z("Invalid configuration: %s, opts.count excludes opts.narg.",B)),!0):!1)}return{aliases:Object.assign({},N.aliases),argv:Object.assign(ye,le),configuration:d,defaulted:Object.assign({},K),error:ce,newAliases:Object.assign({},W)}}}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 _=d||w.length;if(_<a.demanded.length)throw new YError(`Not enough arguments provided. Expected ${a.demanded.length} but received ${w.length}.`);const E=a.demanded.length+a.optional.length;if(_>E)throw new YError(`Too many arguments provided. Expected max ${E} but received ${_}.`);a.demanded.forEach(y=>{const L=w.shift(),W=guessType(L);y.cmd.filter(z=>z===W||z==="*").length===0&&argumentTypeError(W,y.cmd,o),o+=1}),a.optional.forEach(y=>{if(w.length===0)return;const L=w.shift(),W=guessType(L);y.cmd.filter(z=>z===W||z==="*").length===0&&argumentTypeError(W,y.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 _=a(l,d,w);if(_){if(this.requireCache.has(d))return _;this.requireCache.add(d),this.addHandler(_)}return _},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 _ of e)this.addHandler(_);else if(isCommandHandlerDefinition(e)){let _=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(_=[].concat(_).concat(e.aliases)),this.addHandler(_,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 _=parseCommand(e);d=d.map(L=>parseCommand(L).cmd);let E=!1;const y=[_.cmd].concat(d).filter(L=>DEFAULT_MARKER.test(L)?(E=!0,!1):!0);y.length===0&&E&&y.push("$0"),E&&(_.cmd=y[0],d=y.slice(1),e=e.replace(DEFAULT_MARKER,_.cmd)),d.forEach(L=>{this.aliasMap[L]=_.cmd}),t!==!1&&this.usage.command(e,t,E,d,l),this.handlers[_.cmd]={original:e,description:t,handler:o,builder:n||{},middlewares:w,deprecated:l,demanded:_.demanded,optional:_.optional},E&&(this.defaultCommand=this.handlers[_.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(),_=w.commands.slice(),E=!e;e&&(w.commands.push(e),w.fullCommands.push(d.original));const y=this.applyBuilderUpdateUsageAndParse(E,d,t,n.aliases,_,o,a,l);return isPromise(y)?y.then(L=>this.applyMiddlewareAndGetResult(E,d,L.innerArgv,w,a,L.aliases,t)):this.applyMiddlewareAndGetResult(E,d,y.innerArgv,w,a,y.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,o,a,l,d,w){const _=t.builder;let E=n;if(isCommandBuilderCallback(_)){n.getInternalMethods().getUsageInstance().freeze();const y=_(n.getInternalMethods().reset(o),w);if(isPromise(y))return y.then(L=>(E=isYargsInstance(L)?L:n,this.parseAndUpdateUsage(e,t,E,a,l,d)))}else isCommandBuilderOptionDefinitions(_)&&(n.getInternalMethods().getUsageInstance().freeze(),E=n.getInternalMethods().reset(o),Object.keys(t.builder).forEach(y=>{E.option(y,_[y])}));return this.parseAndUpdateUsage(e,t,E,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.getInternalMethods().runValidation(a,w,l.parsed.error,e);n=maybeAsyncResult(n,E=>(_(E),E))}if(t.handler&&!l.getInternalMethods().getHasOutput()){l.getInternalMethods().setHasOutput();const _=!!l.getOptions().configuration["populate--"];l.getInternalMethods().postProcess(n,_,!1,!1),n=applyMiddleware(n,l,d,!1),n=maybeAsyncResult(n,E=>{const y=t.handler(E);return isPromise(y)?y.then(()=>E):E}),e||l.getInternalMethods().getUsageInstance().cacheHelpMessage(),isPromise(n)&&!l.getInternalMethods().hasParseCallback()&&n.catch(E=>{try{l.getInternalMethods().getUsageInstance().fail(null,E)}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 _=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),E=applyMiddleware(n,d,_,!0);return isPromise(E)?E.then(y=>this.handleValidationAndGetResult(e,t,y,o,l,d,_,w)):this.handleValidationAndGetResult(e,t,E,o,l,d,_,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 _ of Object.keys(n.alias))a.alias[_]=(a.alias[_]||[]).concat(n.alias[_]);a.array=a.array.concat(n.array),a.config={};const l=[];if(Object.keys(t).forEach(_=>{t[_].map(E=>{a.configuration["unknown-options-as-args"]&&(a.key[_]=!0),l.push(`--${_}`),l.push(E)})}),!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 _=Object.keys(t);Object.keys(t).forEach(E=>{_.push(...w.aliases[E])}),Object.keys(w.argv).forEach(E=>{_.includes(E)&&(t[E]||(t[E]=w.argv[E]),!this.isInConfigs(o,E)&&!this.isDefaulted(o,E)&&Object.prototype.hasOwnProperty.call(e,E)&&Object.prototype.hasOwnProperty.call(w.argv,E)&&(Array.isArray(e[E])||Array.isArray(w.argv[E]))?e[E]=[].concat(e[E],w.argv[E]):e[E]=w.argv[E])})}}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(Z){o.push(Z)};let a=null,l=null,d=!0;n.showHelpOnFail=function(Z=!0,ne){const[fe,pe]=typeof Z=="string"?[!0,Z]:[Z,ne];return s.getInternalMethods().isGlobalContext()&&(l=pe),a=pe,d=fe,n};let w=!1;n.fail=function(Z,ne){const fe=s.getInternalMethods().getLoggerInstance();if(o.length)for(let pe=o.length-1;pe>=0;--pe){const Ee=o[pe];if(isBoolean(Ee)){if(ne)throw ne;if(Z)throw Error(Z)}else Ee(Z,ne,n)}else{if(s.getExitProcess()&&setBlocking(!0),!w){w=!0,d&&(s.showHelp("error"),fe.error()),(Z||ne)&&fe.error(Z||ne);const pe=a||l;pe&&((Z||ne)&&fe.error(""),fe.error(pe))}if(ne=ne||new YError(Z),s.getExitProcess())return s.exit(1);if(s.getInternalMethods().hasParseCallback())return s.exit(1,ne);throw ne}};let _=[],E=!1;n.usage=(re,Z)=>re===null?(E=!0,_=[],n):(E=!1,_.push([re,Z||""]),n),n.getUsage=()=>_,n.getUsageDisabled=()=>E,n.getPositionalGroupName=()=>t("Positionals:");let y=[];n.example=(re,Z)=>{y.push([re,Z||""])};let L=[];n.command=function(Z,ne,fe,pe,Ee=!1){fe&&(L=L.map(he=>(he[2]=!1,he))),L.push([Z,ne||"",fe,pe,Ee])},n.getCommands=()=>L;let W={};n.describe=function(Z,ne){Array.isArray(Z)?Z.forEach(fe=>{n.describe(fe,ne)}):typeof Z=="object"?Object.keys(Z).forEach(fe=>{n.describe(fe,Z[fe])}):W[Z]=ne},n.getDescriptions=()=>W;let K=[];n.epilog=re=>{K.push(re)};let z=!1,N;n.wrap=re=>{z=!0,N=re},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(z||(N=Le(),z=!0),N);const Q="__yargsString__:";n.deferY18nLookup=re=>Q+re,n.help=function(){if(oe)return oe;ce();const Z=s.customScriptName?s.$0:e.path.basename(s.$0),ne=s.getDemandedOptions(),fe=s.getDemandedCommands(),pe=s.getDeprecatedOptions(),Ee=s.getGroups(),he=s.getOptions();let be=[];be=be.concat(Object.keys(W)),be=be.concat(Object.keys(ne)),be=be.concat(Object.keys(fe)),be=be.concat(Object.keys(he.default)),be=be.filter(ye),be=Object.keys(be.reduce((ue,ge)=>(ge!=="_"&&(ue[ge]=!0),ue),{}));const Ie=n.getWrap(),De=e.cliui({width:Ie,wrap:!!Ie});if(!E){if(_.length)_.forEach(ue=>{De.div({text:`${ue[0].replace(/\$0/g,Z)}`}),ue[1]&&De.div({text:`${ue[1]}`,padding:[1,0,0,0]})}),De.div();else if(L.length){let ue=null;fe._?ue=`${Z} <${t("command")}>
8
- `:ue=`${Z} [${t("command")}]
9
- `,De.div(`${ue}`)}}if(L.length>1||L.length===1&&!L[0][2]){De.div(t("Commands:"));const ue=s.getInternalMethods().getContext(),ge=ue.commands.length?`${ue.commands.join(" ")} `:"";s.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(L=L.sort((de,we)=>de[0].localeCompare(we[0])));const Ce=Z?`${Z} `:"";L.forEach(de=>{const we=`${Ce}${ge}${de[0].replace(/^\$0 ?/,"")}`;De.span({text:we,padding:[0,2,0,2],width:te(L,Ie,`${Z}${ge}`)+4},{text:de[1]});const Ae=[];de[2]&&Ae.push(`[${t("default")}]`),de[3]&&de[3].length&&Ae.push(`[${t("aliases:")} ${de[3].join(", ")}]`),de[4]&&(typeof de[4]=="string"?Ae.push(`[${t("deprecated: %s",de[4])}]`):Ae.push(`[${t("deprecated")}]`)),Ae.length?De.div({text:Ae.join(" "),padding:[0,0,0,2],align:"right"}):De.div()}),De.div()}const Se=(Object.keys(he.alias)||[]).concat(Object.keys(s.parsed.newAliases)||[]);be=be.filter(ue=>!s.parsed.newAliases[ue]&&Se.every(ge=>(he.alias[ge]||[]).indexOf(ue)===-1));const xe=t("Options:");Ee[xe]||(Ee[xe]=[]),le(be,he.alias,Ee,xe);const je=ue=>/^--/.test(getText(ue)),ae=Object.keys(Ee).filter(ue=>Ee[ue].length>0).map(ue=>{const ge=Ee[ue].filter(ye).map(Ce=>{if(Se.includes(Ce))return Ce;for(let de=0,we;(we=Se[de])!==void 0;de++)if((he.alias[we]||[]).includes(Ce))return we;return Ce});return{groupName:ue,normalizedKeys:ge}}).filter(({normalizedKeys:ue})=>ue.length>0).map(({groupName:ue,normalizedKeys:ge})=>{const Ce=ge.reduce((de,we)=>(de[we]=[we].concat(he.alias[we]||[]).map(Ae=>ue===n.getPositionalGroupName()?Ae:(/^[0-9]$/.test(Ae)?he.boolean.includes(we)?"-":"--":Ae.length>1?"--":"-")+Ae).sort((Ae,_e)=>je(Ae)===je(_e)?0:je(Ae)?1:-1).join(", "),de),{});return{groupName:ue,normalizedKeys:ge,switches:Ce}});if(ae.filter(({groupName:ue})=>ue!==n.getPositionalGroupName()).some(({normalizedKeys:ue,switches:ge})=>!ue.every(Ce=>je(ge[Ce])))&&ae.filter(({groupName:ue})=>ue!==n.getPositionalGroupName()).forEach(({normalizedKeys:ue,switches:ge})=>{ue.forEach(Ce=>{je(ge[Ce])&&(ge[Ce]=addIndentation(ge[Ce],4))})}),ae.forEach(({groupName:ue,normalizedKeys:ge,switches:Ce})=>{De.div(ue),ge.forEach(de=>{const we=Ce[de];let Ae=W[de]||"",_e=null;Ae.includes(Q)&&(Ae=t(Ae.substring(Q.length))),he.boolean.includes(de)&&(_e=`[${t("boolean")}]`),he.count.includes(de)&&(_e=`[${t("count")}]`),he.string.includes(de)&&(_e=`[${t("string")}]`),he.normalize.includes(de)&&(_e=`[${t("string")}]`),he.array.includes(de)&&(_e=`[${t("array")}]`),he.number.includes(de)&&(_e=`[${t("number")}]`);const Oe=U=>typeof U=="string"?`[${t("deprecated: %s",U)}]`:`[${t("deprecated")}]`,Pe=[de in pe?Oe(pe[de]):null,_e,de in ne?`[${t("required")}]`:null,he.choices&&he.choices[de]?`[${t("choices:")} ${n.stringifiedValues(he.choices[de])}]`:null,Be(he.default[de],he.defaultDescription[de])].filter(Boolean).join(" ");De.span({text:getText(we),padding:[0,2,0,2+getIndentation(we)],width:te(Ce,Ie)+4},Ae);const B=s.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;Pe&&!B?De.div({text:Pe,padding:[0,0,0,2],align:"right"}):De.div()}),De.div()}),y.length&&(De.div(t("Examples:")),y.forEach(ue=>{ue[0]=ue[0].replace(/\$0/g,Z)}),y.forEach(ue=>{ue[1]===""?De.div({text:ue[0],padding:[0,2,0,2]}):De.div({text:ue[0],padding:[0,2,0,2],width:te(y,Ie)+4},{text:ue[1]})}),De.div()),K.length>0){const ue=K.map(ge=>ge.replace(/\$0/g,Z)).join(`
10
- `);De.div(`${ue}
11
- `)}return De.toString().replace(/\s*$/,"")};function te(re,Z,ne){let fe=0;return Array.isArray(re)||(re=Object.values(re).map(pe=>[pe])),re.forEach(pe=>{fe=Math.max(e.stringWidth(ne?`${ne} ${getText(pe[0])}`:getText(pe[0]))+getIndentation(pe[0]),fe)}),Z&&(fe=Math.min(fe,parseInt((Z*.5).toString(),10))),fe}function ce(){const re=s.getDemandedOptions(),Z=s.getOptions();(Object.keys(Z.alias)||[]).forEach(ne=>{Z.alias[ne].forEach(fe=>{W[fe]&&n.describe(ne,W[fe]),fe in re&&s.demandOption(ne,re[fe]),Z.boolean.includes(fe)&&s.boolean(ne),Z.count.includes(fe)&&s.count(ne),Z.string.includes(fe)&&s.string(ne),Z.normalize.includes(fe)&&s.normalize(ne),Z.array.includes(fe)&&s.array(ne),Z.number.includes(fe)&&s.number(ne)})})}let oe;n.cacheHelpMessage=function(){oe=this.help()},n.clearCachedHelpMessage=function(){oe=void 0},n.hasCachedHelpMessage=function(){return!!oe};function le(re,Z,ne,fe){let pe=[],Ee=null;return Object.keys(ne).forEach(he=>{pe=pe.concat(ne[he])}),re.forEach(he=>{Ee=[he].concat(Z[he]),Ee.some(be=>pe.indexOf(be)!==-1)||ne[fe].push(he)}),pe}function ye(re){return s.getOptions().hiddenOptions.indexOf(re)<0||s.parsed.argv[s.getOptions().showHiddenOpt]}n.showHelp=re=>{const Z=s.getInternalMethods().getLoggerInstance();re||(re="error"),(typeof re=="function"?re:Z[re])(n.help())},n.functionDescription=re=>["(",re.name?e.Parser.decamelize(re.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(Z,ne){let fe="";const pe=ne||", ",Ee=[].concat(Z);return!Z||!Ee.length||Ee.forEach(he=>{fe.length&&(fe+=pe),fe+=JSON.stringify(he)}),fe};function Be(re,Z){let ne=`[${t("default:")} `;if(re===void 0&&!Z)return null;if(Z)ne+=Z;else switch(typeof re){case"string":ne+=`"${re}"`;break;case"object":ne+=JSON.stringify(re);break;default:ne+=re}return`${ne}]`}function Le(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let $e=null;n.version=re=>{$e=re},n.showVersion=re=>{const Z=s.getInternalMethods().getLoggerInstance();re||(re="error"),(typeof re=="function"?re:Z[re])($e)},n.reset=function(Z){return a=null,w=!1,_=[],E=!1,K=[],y=[],L=[],W=objFilter(W,ne=>!Z[ne]),n};const me=[];return n.freeze=function(){me.push({failMessage:a,failureOutput:w,usages:_,usageDisabled:E,epilogs:K,examples:y,commands:L,descriptions:W})},n.unfreeze=function(Z=!1){const ne=me.pop();ne&&(Z?(W={...ne.descriptions,...W},L=[...ne.commands,...L],_=[...ne.usages,..._],y=[...ne.examples,...y],K=[...ne.epilogs,...K]):{failMessage:a,failureOutput:w,usages:_,usageDisabled:E,epilogs:K,examples:y,commands:L,descriptions:W}=ne)},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-###
2
+ "use strict";const LikeC4=require("../shared/likec4.DpEZnw1B.cjs"),process$1=require("node:process"),assert=require("assert"),require$$0=require("path"),require$$0$1=require("fs"),require$$0$2=require("util"),require$$0$3=require("url"),path$1=require("node:path"),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"),core=require("@likec4/core"),vite=require("vite"),playwright=require("playwright"),net=require("node:net"),promises=require("node:timers/promises");require("tty"),require("node:util"),require("os"),require("crypto"),require("net"),require("child_process"),require("node:tty"),require("@hpcc-js/wasm-graphviz"),require("buffer"),require("@likec4/core/compute-view"),require("node:child_process"),require("node:string_decoder"),require("node:events"),require("node:v8"),require("node:stream"),require("node:buffer"),require("node:stream/promises"),require("@likec4/core/model");var _documentCurrentScript=typeof document<"u"?document.currentScript:null;function _interopDefaultCompat(i){return i&&typeof i=="object"&&"default"in i?i.default:i}const process__default=_interopDefaultCompat(process$1),path__default=_interopDefaultCompat(path$1),fs__default=_interopDefaultCompat(fs),os__default=_interopDefaultCompat(os),c__default=_interopDefaultCompat(c$1),net__default=_interopDefaultCompat(net),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
+ `).map(s=>s.split(" "));let n=0;return t.forEach(s=>{s.length>1&&mixin$1.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),mixin$1.stringWidth(s[0])))}),t.forEach(s=>{this.div(...s.map((o,a)=>({text:o.trim(),padding:this.measurePadding(o),width:a===0&&s.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
+ `)}rowToString(e,t){return this.rasterize(e).forEach((n,s)=>{let o="";n.forEach((a,l)=>{const{width:d}=e[l],B=this.negatePadding(e[l]);let w=a;if(B>mixin$1.stringWidth(a)&&(w+=" ".repeat(B-mixin$1.stringWidth(a))),e[l].align&&e[l].align!=="left"&&this.wrap){const _=align[e[l].align];w=_(w,B),mixin$1.stringWidth(w)<B&&(w+=" ".repeat((d||0)-mixin$1.stringWidth(w)-1))}const E=e[l].padding||[0,0,0,0];E[left]&&(o+=" ".repeat(E[left])),o+=addBorder(e[l],w,"| "),o+=w,o+=addBorder(e[l],w," |"),E[right]&&(o+=" ".repeat(E[right])),s===0&&t.length>0&&(o=this.renderInline(o,t[t.length-1]))}),t.push({text:o.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){const n=e.match(/^ */),s=n?n[0].length:0,o=t.text,a=mixin$1.stringWidth(o.trimRight());return t.span?this.wrap?s<a?e:(t.hidden=!0,o.trimRight()+" ".repeat(s-a)+e.trimLeft()):(t.hidden=!0,o+e):e}rasterize(e){const t=[],n=this.columnWidths(e);let s;return e.forEach((o,a)=>{o.width=n[a],this.wrap?s=mixin$1.wrap(o.text,this.negatePadding(o),{hard:!0}).split(`
5
+ `):s=o.text.split(`
6
+ `),o.border&&(s.unshift("."+"-".repeat(this.negatePadding(o)+2)+"."),s.push("'"+"-".repeat(this.negatePadding(o)+2)+"'")),o.padding&&(s.unshift(...new Array(o.padding[top]||0).fill("")),s.push(...new Array(o.padding[bottom]||0).fill(""))),s.forEach((l,d)=>{t[d]||t.push([]);const B=t[d];for(let w=0;w<a;w++)B[w]===void 0&&B.push("");B.push(l)})}),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(a=>a.width||mixin$1.stringWidth(a.text));let t=e.length,n=this.width;const s=e.map(a=>{if(a.width)return t--,n-=a.width,a.width}),o=t?Math.floor(n/t):0;return s.map((a,l)=>a===void 0?Math.max(o,_minWidth(e[l])):a)}}function addBorder(i,e,t){return i.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function _minWidth(i){const e=i.padding||[],t=1+(e[left]||0)+(e[right]||0);return i.border?t+4:t}function getWindowWidth(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function alignRight(i,e){i=i.trim();const t=mixin$1.stringWidth(i);return t<e?" ".repeat(e-t)+i:i}function alignCenter(i,e){i=i.trim();const t=mixin$1.stringWidth(i);return t>=e?i:" ".repeat(e-t>>1)+i}let mixin$1;function cliui(i,e){return mixin$1=e,new UI({width:i?.width||getWindowWidth(),wrap:i?.wrap})}const ansi=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function stripAnsi(i){return i.replace(ansi,"")}function wrap(i,e){const[t,n]=i.match(ansi)||["",""];i=stripAnsi(i);let s="";for(let o=0;o<i.length;o++)o!==0&&o%e===0&&(s+=`
7
+ `),s+=i.charAt(o);return t&&n&&(s=`${t}${s}${n}`),s}function ui(i){return cliui(i,{stringWidth:e=>[...e].length,stripAnsi,wrap})}function escalade(i,e){let t=require$$0.resolve(".",i),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(i){if(i!==i.toLowerCase()&&i!==i.toUpperCase()||(i=i.toLowerCase()),i.indexOf("-")===-1&&i.indexOf("_")===-1)return i;{let t="",n=!1;const s=i.match(/^-+/);for(let o=s?s[0].length:0;o<i.length;o++){let a=i.charAt(o);n&&(n=!1,a=a.toUpperCase()),o!==0&&(a==="-"||a==="_")?n=!0:a!=="-"&&a!=="_"&&(t+=a)}return t}}function decamelize(i,e){const t=i.toLowerCase();e=e||"-";let n="";for(let s=0;s<i.length;s++){const o=t.charAt(s),a=i.charAt(s);o!==a&&s>0?n+=`${e}${t.charAt(s)}`:n+=a}return n}function looksLikeNumber(i){return i==null?!1:typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^0[^.]/.test(i)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function tokenizeArgString(i){if(Array.isArray(i))return i.map(a=>typeof a!="string"?a+"":a);i=i.trim();let e=0,t=null,n=null,s=null;const o=[];for(let a=0;a<i.length;a++){if(t=n,n=i.charAt(a),n===" "&&!s){t!==" "&&e++;continue}n===s?s=null:(n==="'"||n==='"')&&!s&&(s=n),o[e]||(o[e]=""),o[e]+=n}return o}var DefaultValuesForTypeKey;(function(i){i.BOOLEAN="boolean",i.STRING="string",i.NUMBER="number",i.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),s=tokenizeArgString(e),o=typeof e=="string",a=combineAliases(Object.assign(Object.create(null),n.alias)),l=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),d=Object.assign(Object.create(null),n.default),B=n.configObjects||[],w=n.envPrefix,E=l["populate--"],_=E?"--":"_",U=Object.create(null),H=Object.create(null),W=n.__||mixin.format,L={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:[]},K=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,ee=new RegExp("^--"+l["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(y){const T=typeof y=="object"?y.key:y,Q=Object.keys(y).map(function(z){return{boolean:"bools",string:"strings",number:"numbers"}[z]}).filter(Boolean).pop();Q&&(L[Q][T]=!0),L.arrays[T]=!0,L.keys.push(T)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(y){L.bools[y]=!0,L.keys.push(y)}),[].concat(n.string||[]).filter(Boolean).forEach(function(y){L.strings[y]=!0,L.keys.push(y)}),[].concat(n.number||[]).filter(Boolean).forEach(function(y){L.numbers[y]=!0,L.keys.push(y)}),[].concat(n.count||[]).filter(Boolean).forEach(function(y){L.counts[y]=!0,L.keys.push(y)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(y){L.normalize[y]=!0,L.keys.push(y)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([y,T])=>{typeof T=="number"&&(L.nargs[y]=T,L.keys.push(y))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([y,T])=>{typeof T=="function"&&(L.coercions[y]=T,L.keys.push(y))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(y){L.configs[y]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([y,T])=>{(typeof T=="boolean"||typeof T=="function")&&(L.configs[y]=T)})),Ie(n.key,a,n.default,L.arrays),Object.keys(d).forEach(function(y){(L.aliases[y]||[]).forEach(function(T){d[T]=d[y]})});let ae=null;Le();let se=[];const ce=Object.assign(Object.create(null),{_:[]}),Fe={};for(let y=0;y<s.length;y++){const T=s[y],Q=T.replace(/^-{3,}/,"---");let z,N,ne,Z,re,be;if(T!=="--"&&/^-/.test(T)&&De(T))ve(T);else if(Q.match(/^---+(=|$)/)){ve(T);continue}else if(T.match(/^--.+=/)||!l["short-option-groups"]&&T.match(/^-.+=/))Z=T.match(/^--?([^=]+)=([\s\S]*)$/),Z!==null&&Array.isArray(Z)&&Z.length>=3&&(oe(Z[1],L.arrays)?y=xe(y,Z[1],s,Z[2]):oe(Z[1],L.nargs)!==!1?y=je(y,Z[1],s,Z[2]):pe(Z[1],Z[2],!0));else if(T.match(ee)&&l["boolean-negation"])Z=T.match(ee),Z!==null&&Array.isArray(Z)&&Z.length>=2&&(N=Z[1],pe(N,oe(N,L.arrays)?[!1]:!1));else if(T.match(/^--.+/)||!l["short-option-groups"]&&T.match(/^-[^-]+/))Z=T.match(/^--?(.+)/),Z!==null&&Array.isArray(Z)&&Z.length>=2&&(N=Z[1],oe(N,L.arrays)?y=xe(y,N,s):oe(N,L.nargs)!==!1?y=je(y,N,s):(re=s[y+1],re!==void 0&&(!re.match(/^-/)||re.match(K))&&!oe(N,L.bools)&&!oe(N,L.counts)||/^(true|false)$/.test(re)?(pe(N,re),y++):pe(N,Ce(N))));else if(T.match(/^-.\..+=/))Z=T.match(/^-([^=]+)=([\s\S]*)$/),Z!==null&&Array.isArray(Z)&&Z.length>=3&&pe(Z[1],Z[2]);else if(T.match(/^-.\..+/)&&!T.match(K))re=s[y+1],Z=T.match(/^-(.\..+)/),Z!==null&&Array.isArray(Z)&&Z.length>=2&&(N=Z[1],re!==void 0&&!re.match(/^-/)&&!oe(N,L.bools)&&!oe(N,L.counts)?(pe(N,re),y++):pe(N,Ce(N)));else if(T.match(/^-[^-]+/)&&!T.match(K)){ne=T.slice(1,-1).split(""),z=!1;for(let ye=0;ye<ne.length;ye++){if(re=T.slice(ye+2),ne[ye+1]&&ne[ye+1]==="="){be=T.slice(ye+3),N=ne[ye],oe(N,L.arrays)?y=xe(y,N,s,be):oe(N,L.nargs)!==!1?y=je(y,N,s,be):pe(N,be),z=!0;break}if(re==="-"){pe(ne[ye],re);continue}if(/[A-Za-z]/.test(ne[ye])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(re)&&oe(re,L.bools)===!1){pe(ne[ye],re),z=!0;break}if(ne[ye+1]&&ne[ye+1].match(/\W/)){pe(ne[ye],re),z=!0;break}else pe(ne[ye],Ce(ne[ye]))}N=T.slice(-1)[0],!z&&N!=="-"&&(oe(N,L.arrays)?y=xe(y,N,s):oe(N,L.nargs)!==!1?y=je(y,N,s):(re=s[y+1],re!==void 0&&(!/^(-|--)[^-]/.test(re)||re.match(K))&&!oe(N,L.bools)&&!oe(N,L.counts)||/^(true|false)$/.test(re)?(pe(N,re),y++):pe(N,Ce(N))))}else if(T.match(/^-[0-9]$/)&&T.match(K)&&oe(T.slice(1),L.bools))N=T.slice(1),pe(N,Ce(N));else if(T==="--"){se=s.slice(y+1);break}else if(l["halt-at-non-option"]){se=s.slice(y);break}else ve(T)}de(ce,!0),de(ce,!1),le(ce),Ae(),ge(ce,L.aliases,d,!0),Ee(ce),l["set-placeholder-key"]&&$e(ce),Object.keys(L.counts).forEach(function(y){Oe(ce,y.split("."))||pe(y,0)}),E&&se.length&&(ce[_]=[]),se.forEach(function(y){ce[_].push(y)}),l["camel-case-expansion"]&&l["strip-dashed"]&&Object.keys(ce).filter(y=>y!=="--"&&y.includes("-")).forEach(y=>{delete ce[y]}),l["strip-aliased"]&&[].concat(...Object.keys(a).map(y=>a[y])).forEach(y=>{l["camel-case-expansion"]&&y.includes("-")&&delete ce[y.split(".").map(T=>camelCase(T)).join(".")],delete ce[y]});function ve(y){const T=te("_",y);(typeof T=="string"||typeof T=="number")&&ce._.push(T)}function je(y,T,Q,z){let N,ne=oe(T,L.nargs);if(ne=typeof ne!="number"||isNaN(ne)?1:ne,ne===0)return _e(z)||(ae=Error(W("Argument unexpected for: %s",T))),pe(T,Ce(T)),y;let Z=_e(z)?0:1;if(l["nargs-eats-options"])Q.length-(y+1)+Z<ne&&(ae=Error(W("Not enough arguments following: %s",T))),Z=ne;else{for(N=y+1;N<Q.length&&(!Q[N].match(/^-[^0-9]/)||Q[N].match(K)||De(Q[N]));N++)Z++;Z<ne&&(ae=Error(W("Not enough arguments following: %s",T)))}let re=Math.min(Z,ne);for(!_e(z)&&re>0&&(pe(T,z),re--),N=y+1;N<re+y+1;N++)pe(T,Q[N]);return y+re}function xe(y,T,Q,z){let N=[],ne=z||Q[y+1];const Z=oe(T,L.nargs);if(oe(T,L.bools)&&!/^(true|false)$/.test(ne))N.push(!0);else if(_e(ne)||_e(z)&&/^-/.test(ne)&&!K.test(ne)&&!De(ne)){if(d[T]!==void 0){const re=d[T];N=Array.isArray(re)?re:[re]}}else{_e(z)||N.push(X(T,z,!0));for(let re=y+1;re<Q.length&&!(!l["greedy-arrays"]&&N.length>0||Z&&typeof Z=="number"&&N.length>=Z||(ne=Q[re],/^-/.test(ne)&&!K.test(ne)&&!De(ne)));re++)y=re,N.push(X(T,ne,o))}return typeof Z=="number"&&(Z&&N.length<Z||isNaN(Z)&&N.length===0)&&(ae=Error(W("Not enough arguments following: %s",T))),pe(T,N),y}function pe(y,T,Q=o){if(/-/.test(y)&&l["camel-case-expansion"]){const ne=y.split(".").map(function(Z){return camelCase(Z)}).join(".");ie(y,ne)}const z=X(y,T,Q),N=y.split(".");Se(ce,N,z),L.aliases[y]&&L.aliases[y].forEach(function(ne){const Z=ne.split(".");Se(ce,Z,z)}),N.length>1&&l["dot-notation"]&&(L.aliases[N[0]]||[]).forEach(function(ne){let Z=ne.split(".");const re=[].concat(N);re.shift(),Z=Z.concat(re),(L.aliases[y]||[]).includes(Z.join("."))||Se(ce,Z,z)}),oe(y,L.normalize)&&!oe(y,L.arrays)&&[y].concat(L.aliases[y]||[]).forEach(function(Z){Object.defineProperty(Fe,Z,{enumerable:!0,get(){return T},set(re){T=typeof re=="string"?mixin.normalize(re):re}})})}function ie(y,T){L.aliases[y]&&L.aliases[y].length||(L.aliases[y]=[T],U[T]=!0),L.aliases[T]&&L.aliases[T].length||ie(T,y)}function X(y,T,Q){Q&&(T=stripQuotes(T)),(oe(y,L.bools)||oe(y,L.counts))&&typeof T=="string"&&(T=T==="true");let z=Array.isArray(T)?T.map(function(N){return te(y,N)}):te(y,T);return oe(y,L.counts)&&(_e(z)||typeof z=="boolean")&&(z=increment()),oe(y,L.normalize)&&oe(y,L.arrays)&&(Array.isArray(T)?z=T.map(N=>mixin.normalize(N)):z=mixin.normalize(T)),z}function te(y,T){return!l["parse-positional-numbers"]&&y==="_"||!oe(y,L.strings)&&!oe(y,L.bools)&&!Array.isArray(T)&&(looksLikeNumber(T)&&l["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${T}`)))||!_e(T)&&oe(y,L.numbers))&&(T=Number(T)),T}function le(y){const T=Object.create(null);ge(T,L.aliases,d),Object.keys(L.configs).forEach(function(Q){const z=y[Q]||T[Q];if(z)try{let N=null;const ne=mixin.resolve(mixin.cwd(),z),Z=L.configs[Q];if(typeof Z=="function"){try{N=Z(ne)}catch(re){N=re}if(N instanceof Error){ae=N;return}}else N=mixin.require(ne);he(N)}catch(N){N.name==="PermissionDenied"?ae=N:y[Q]&&(ae=Error(W("Invalid JSON config file: %s",z)))}})}function he(y,T){Object.keys(y).forEach(function(Q){const z=y[Q],N=T?T+"."+Q:Q;typeof z=="object"&&z!==null&&!Array.isArray(z)&&l["dot-notation"]?he(z,N):(!Oe(ce,N.split("."))||oe(N,L.arrays)&&l["combine-arrays"])&&pe(N,z)})}function Ae(){typeof B<"u"&&B.forEach(function(y){he(y)})}function de(y,T){if(typeof w>"u")return;const Q=typeof w=="string"?w:"",z=mixin.env();Object.keys(z).forEach(function(N){if(Q===""||N.lastIndexOf(Q,0)===0){const ne=N.split("__").map(function(Z,re){return re===0&&(Z=Z.substring(Q.length)),camelCase(Z)});(T&&L.configs[ne.join(".")]||!T)&&!Oe(y,ne)&&pe(ne.join("."),z[N])}})}function Ee(y){let T;const Q=new Set;Object.keys(y).forEach(function(z){if(!Q.has(z)&&(T=oe(z,L.coercions),typeof T=="function"))try{const N=te(z,T(y[z]));[].concat(L.aliases[z]||[],z).forEach(ne=>{Q.add(ne),y[ne]=N})}catch(N){ae=N}})}function $e(y){return L.keys.forEach(T=>{~T.indexOf(".")||typeof y[T]>"u"&&(y[T]=void 0)}),y}function ge(y,T,Q,z=!1){Object.keys(Q).forEach(function(N){Oe(y,N.split("."))||(Se(y,N.split("."),Q[N]),z&&(H[N]=!0),(T[N]||[]).forEach(function(ne){Oe(y,ne.split("."))||Se(y,ne.split("."),Q[N])}))})}function Oe(y,T){let Q=y;l["dot-notation"]||(T=[T.join(".")]),T.slice(0,-1).forEach(function(N){Q=Q[N]||{}});const z=T[T.length-1];return typeof Q!="object"?!1:z in Q}function Se(y,T,Q){let z=y;l["dot-notation"]||(T=[T.join(".")]),T.slice(0,-1).forEach(function(be){be=sanitizeKey(be),typeof z=="object"&&z[be]===void 0&&(z[be]={}),typeof z[be]!="object"||Array.isArray(z[be])?(Array.isArray(z[be])?z[be].push({}):z[be]=[z[be],{}],z=z[be][z[be].length-1]):z=z[be]});const N=sanitizeKey(T[T.length-1]),ne=oe(T.join("."),L.arrays),Z=Array.isArray(Q);let re=l["duplicate-arguments-array"];!re&&oe(N,L.nargs)&&(re=!0,(!_e(z[N])&&L.nargs[N]===1||Array.isArray(z[N])&&z[N].length===L.nargs[N])&&(z[N]=void 0)),Q===increment()?z[N]=increment(z[N]):Array.isArray(z[N])?re&&ne&&Z?z[N]=l["flatten-duplicate-arrays"]?z[N].concat(Q):(Array.isArray(z[N][0])?z[N]:[z[N]]).concat([Q]):!re&&!!ne==!!Z?z[N]=Q:z[N]=z[N].concat([Q]):z[N]===void 0&&ne?z[N]=Z?Q:[Q]:re&&!(z[N]===void 0||oe(N,L.counts)||oe(N,L.bools))?z[N]=[z[N],Q]:z[N]=Q}function Ie(...y){y.forEach(function(T){Object.keys(T||{}).forEach(function(Q){L.aliases[Q]||(L.aliases[Q]=[].concat(a[Q]||[]),L.aliases[Q].concat(Q).forEach(function(z){if(/-/.test(z)&&l["camel-case-expansion"]){const N=camelCase(z);N!==Q&&L.aliases[Q].indexOf(N)===-1&&(L.aliases[Q].push(N),U[N]=!0)}}),L.aliases[Q].concat(Q).forEach(function(z){if(z.length>1&&/[A-Z]/.test(z)&&l["camel-case-expansion"]){const N=decamelize(z,"-");N!==Q&&L.aliases[Q].indexOf(N)===-1&&(L.aliases[Q].push(N),U[N]=!0)}}),L.aliases[Q].forEach(function(z){L.aliases[z]=[Q].concat(L.aliases[Q].filter(function(N){return z!==N}))}))})})}function oe(y,T){const Q=[].concat(L.aliases[y]||[],y),z=Object.keys(T),N=Q.find(ne=>z.includes(ne));return N?T[N]:!1}function Pe(y){const T=Object.keys(L);return[].concat(T.map(z=>L[z])).some(function(z){return Array.isArray(z)?z.includes(y):z[y]})}function ue(y,...T){return[].concat(...T).some(function(z){const N=y.match(z);return N&&Pe(N[1])})}function me(y){if(y.match(K)||!y.match(/^-[^-]+/))return!1;let T=!0,Q;const z=y.slice(1).split("");for(let N=0;N<z.length;N++){if(Q=y.slice(N+2),!Pe(z[N])){T=!1;break}if(z[N+1]&&z[N+1]==="="||Q==="-"||/[A-Za-z]/.test(z[N])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(Q)||z[N+1]&&z[N+1].match(/\W/))break}return T}function De(y){return l["unknown-options-as-args"]&&fe(y)}function fe(y){return y=y.replace(/^-{3,}/,"--"),y.match(K)||me(y)?!1:!ue(y,/^-+([^=]+?)=[\s\S]*$/,ee,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function Ce(y){return!oe(y,L.bools)&&!oe(y,L.counts)&&`${y}`in d?d[y]:we(Be(y))}function we(y){return{[DefaultValuesForTypeKey.BOOLEAN]:!0,[DefaultValuesForTypeKey.STRING]:"",[DefaultValuesForTypeKey.NUMBER]:void 0,[DefaultValuesForTypeKey.ARRAY]:[]}[y]}function Be(y){let T=DefaultValuesForTypeKey.BOOLEAN;return oe(y,L.strings)?T=DefaultValuesForTypeKey.STRING:oe(y,L.numbers)?T=DefaultValuesForTypeKey.NUMBER:oe(y,L.bools)?T=DefaultValuesForTypeKey.BOOLEAN:oe(y,L.arrays)&&(T=DefaultValuesForTypeKey.ARRAY),T}function _e(y){return y===void 0}function Le(){Object.keys(L.counts).find(y=>oe(y,L.arrays)?(ae=Error(W("Invalid configuration: %s, opts.count excludes opts.array.",y)),!0):oe(y,L.nargs)?(ae=Error(W("Invalid configuration: %s, opts.count excludes opts.narg.",y)),!0):!1)}return{aliases:Object.assign({},L.aliases),argv:Object.assign(Fe,ce),configuration:l,defaulted:Object.assign({},H),error:ae,newAliases:Object.assign({},U)}}}function combineAliases(i){const e=[],t=Object.create(null);let n=!0;for(Object.keys(i).forEach(function(s){e.push([].concat(i[s],s))});n;){n=!1;for(let s=0;s<e.length;s++)for(let o=s+1;o<e.length;o++)if(e[s].filter(function(l){return e[o].indexOf(l)!==-1}).length){e[s]=e[s].concat(e[o]),e.splice(o,1),n=!0;break}}return e.forEach(function(s){s=s.filter(function(a,l,d){return d.indexOf(a)===l});const o=s.pop();o!==void 0&&typeof o=="string"&&(t[o]=s)}),t}function increment(i){return i!==void 0?i+1:1}function sanitizeKey(i){return i==="__proto__"?"___proto___":i}function stripQuotes(i){return typeof i=="string"&&(i[0]==="'"||i[0]==='"')&&i[i.length-1]===i[0]?i.substring(1,i.length-1):i}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:i=>{if(typeof require<"u")return require(i);if(i.match(/\.json$/))return JSON.parse(require$$0$1.readFileSync(i,"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(i,e){return parser.parse(i.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(i){return i.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:i=>{try{return require$$0$1.statSync(i).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(),s=e.shift();let o=function(){};typeof e[e.length-1]=="function"&&(o=e.pop()),this.cache[this.locale]||this._readLocaleFile();let a=s===1?t:n;this.cache[this.locale][t]&&(a=this.cache[this.locale][t][s===1?"one":"other"]),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]={one:t,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:o})):o();const l=[a];return~a.indexOf("%d")&&l.push(s),shim$2.format.apply(shim$2.format,l.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(s,o){const a=t[o+1];n+=s,typeof a<"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,s=t.locale,o=t.cb,a=this._resolveLocaleFile(n,s),l=JSON.stringify(this.cache[s],null,2);shim$2.fs.writeFile(a,l,"utf-8",function(d){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),o(d)})}_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 s=shim$2.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(e){return shim$2.exists(e)}}function y18n$1(i,e){shim$2=e;const t=new Y18N(i);return{__:t.__.bind(t),__n:t.__n.bind(t),setLocale:t.setLocale.bind(t),getLocale:t.getLocale.bind(t),updateLocale:t.updateLocale.bind(t),locale:t.locale}}const y18n=i=>y18n$1(i,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:i=>process.env[i],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:(i,e)=>process.emitWarning(i,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:require$$0$1.readFileSync,require:()=>{throw new YError(REQUIRE_ERROR)},requireDirectory:()=>{throw new YError(REQUIRE_DIRECTORY_ERROR)},stringWidth:i=>[...i].length,y18n:y18n({directory:require$$0.resolve(__dirname$1,"../../../locales"),updateFiles:!1})};function assertNotStrictEqual(i,e,t,n){t.assert.notStrictEqual(i,e,n)}function assertSingleKey(i,e){e.assert.strictEqual(typeof i,"string")}function objectKeys(i){return Object.keys(i)}function isPromise(i){return!!i&&!!i.then&&typeof i.then=="function"}function parseCommand(i){const t=i.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=t.shift();if(!s)throw new Error(`No command found in: ${i}`);const o={cmd:s.replace(n,""),demanded:[],optional:[]};return t.forEach((a,l)=>{let d=!1;a=a.replace(/\s/g,""),/\.+[\]>]/.test(a)&&l===t.length-1&&(d=!0),/^\[/.test(a)?o.optional.push({cmd:a.replace(n,"").split("|"),variadic:d}):o.demanded.push({cmd:a.replace(n,"").split("|"),variadic:d})}),o}const positionName=["first","second","third","fourth","fifth","sixth"];function argsert(i,e,t){function n(){return typeof i=="object"?[{demanded:[],optional:[]},i,e]:[parseCommand(`cmd ${i}`),e,t]}try{let s=0;const[o,a,l]=n(),d=[].slice.call(a);for(;d.length&&d[d.length-1]===void 0;)d.pop();const B=l||d.length;if(B<o.demanded.length)throw new YError(`Not enough arguments provided. Expected ${o.demanded.length} but received ${d.length}.`);const w=o.demanded.length+o.optional.length;if(B>w)throw new YError(`Too many arguments provided. Expected max ${w} but received ${B}.`);o.demanded.forEach(E=>{const _=d.shift(),U=guessType(_);E.cmd.filter(W=>W===U||W==="*").length===0&&argumentTypeError(U,E.cmd,s),s+=1}),o.optional.forEach(E=>{if(d.length===0)return;const _=d.shift(),U=guessType(_);E.cmd.filter(W=>W===U||W==="*").length===0&&argumentTypeError(U,E.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function guessType(i){return Array.isArray(i)?"array":i===null?"null":typeof i}function argumentTypeError(i,e,t){throw new YError(`Invalid ${positionName[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${i}.`)}class GlobalMiddleware{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,s=!1){if(argsert("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let o=0;o<e.length;o++){if(typeof e[o]!="function")throw Error("middleware must be a function");const a=e[o];a.applyBeforeValidation=t,a.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){const o=e;o.applyBeforeValidation=t,o.global=n,o.mutates=s,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){const n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(s=>{const o=[...n[t]||[],t];return s.option?!o.includes(s.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(i){return i?i.map(e=>(e.applyBeforeValidation=!1,e)):[]}function applyMiddleware(i,e,t,n){return t.reduce((s,o)=>{if(o.applyBeforeValidation!==n)return s;if(o.mutates){if(o.applied)return s;o.applied=!0}if(isPromise(s))return s.then(a=>Promise.all([a,o(a,e)])).then(([a,l])=>Object.assign(a,l));{const a=o(s,e);return isPromise(a)?a.then(l=>Object.assign(s,l)):Object.assign(s,a)}},i)}function maybeAsyncResult(i,e,t=n=>{throw n}){try{const n=isFunction(i)?i():i;return isPromise(n)?n.then(s=>e(s)):e(n)}catch(n){return t(n)}}function isFunction(i){return typeof i=="function"}function whichModule(i){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===i)return n;return null}const DEFAULT_MARKER=/(^\*)|(^\$0)/;class CommandInstance{constructor(e,t,n,s){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=s,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,s){s=s||{},typeof s.recurse!="boolean"&&(s.recurse=!1),Array.isArray(s.extensions)||(s.extensions=["js"]);const o=typeof s.visit=="function"?s.visit:a=>a;s.visit=(a,l,d)=>{const B=o(a,l,d);if(B){if(this.requireCache.has(l))return B;this.requireCache.add(l),this.addHandler(B)}return B},this.shim.requireDirectory({require:t,filename:n},e,s)}addHandler(e,t,n,s,o,a){let l=[];const d=commandMiddlewareFactory(o);if(s=s||(()=>{}),Array.isArray(e))if(isCommandAndAliases(e))[e,...l]=e;else for(const B of e)this.addHandler(B);else if(isCommandHandlerDefinition(e)){let B=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(B=[].concat(B).concat(e.aliases)),this.addHandler(B,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(isCommandBuilderDefinition(n)){this.addHandler([e].concat(l),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){const B=parseCommand(e);l=l.map(_=>parseCommand(_).cmd);let w=!1;const E=[B.cmd].concat(l).filter(_=>DEFAULT_MARKER.test(_)?(w=!0,!1):!0);E.length===0&&w&&E.push("$0"),w&&(B.cmd=E[0],l=E.slice(1),e=e.replace(DEFAULT_MARKER,B.cmd)),l.forEach(_=>{this.aliasMap[_]=B.cmd}),t!==!1&&this.usage.command(e,t,w,l,a),this.handlers[B.cmd]={original:e,description:t,handler:s,builder:n||{},middlewares:d,deprecated:a,demanded:B.demanded,optional:B.optional},w&&(this.defaultCommand=this.handlers[B.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,s,o,a){const l=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,d=t.getInternalMethods().getContext(),B=d.commands.slice(),w=!e;e&&(d.commands.push(e),d.fullCommands.push(l.original));const E=this.applyBuilderUpdateUsageAndParse(w,l,t,n.aliases,B,s,o,a);return isPromise(E)?E.then(_=>this.applyMiddlewareAndGetResult(w,l,_.innerArgv,d,o,_.aliases,t)):this.applyMiddlewareAndGetResult(w,l,E.innerArgv,d,o,E.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,s,o,a,l,d){const B=t.builder;let w=n;if(isCommandBuilderCallback(B)){n.getInternalMethods().getUsageInstance().freeze();const E=B(n.getInternalMethods().reset(s),d);if(isPromise(E))return E.then(_=>(w=isYargsInstance(_)?_:n,this.parseAndUpdateUsage(e,t,w,o,a,l)))}else isCommandBuilderOptionDefinitions(B)&&(n.getInternalMethods().getUsageInstance().freeze(),w=n.getInternalMethods().reset(s),Object.keys(t.builder).forEach(E=>{w.option(E,B[E])}));return this.parseAndUpdateUsage(e,t,w,o,a,l)}parseAndUpdateUsage(e,t,n,s,o,a){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(s,t),t.description);const l=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,o,a);return isPromise(l)?l.then(d=>({aliases:n.parsed.aliases,innerArgv:d})):{aliases:n.parsed.aliases,innerArgv:l}}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,s=e.filter(o=>!DEFAULT_MARKER.test(o));return s.push(n),`$0 ${s.join(" ")}`}handleValidationAndGetResult(e,t,n,s,o,a,l,d){if(!a.getInternalMethods().getHasOutput()){const B=a.getInternalMethods().runValidation(o,d,a.parsed.error,e);n=maybeAsyncResult(n,w=>(B(w),w))}if(t.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();const B=!!a.getOptions().configuration["populate--"];a.getInternalMethods().postProcess(n,B,!1,!1),n=applyMiddleware(n,a,l,!1),n=maybeAsyncResult(n,w=>{const E=t.handler(w);return isPromise(E)?E.then(()=>w):w}),e||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),isPromise(n)&&!a.getInternalMethods().hasParseCallback()&&n.catch(w=>{try{a.getInternalMethods().getUsageInstance().fail(null,w)}catch{}})}return e||(s.commands.pop(),s.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,s,o,a,l){let d={};if(o)return n;l.getInternalMethods().getHasOutput()||(d=this.populatePositionals(t,n,s,l));const B=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),w=applyMiddleware(n,l,B,!0);return isPromise(w)?w.then(E=>this.handleValidationAndGetResult(e,t,E,s,a,l,B,d)):this.handleValidationAndGetResult(e,t,w,s,a,l,B,d)}populatePositionals(e,t,n,s){t._=t._.slice(n.commands.length);const o=e.demanded.slice(0),a=e.optional.slice(0),l={};for(this.validation.positionalCount(o.length,t._.length);o.length;){const d=o.shift();this.populatePositional(d,t,l)}for(;a.length;){const d=a.shift();this.populatePositional(d,t,l)}return t._=n.commands.concat(t._.map(d=>""+d)),this.postProcessPositionals(t,l,this.cmdToParseOptions(e.original),s),l}populatePositional(e,t,n){const s=e.cmd[0];e.variadic?n[s]=t._.splice(0).map(String):t._.length&&(n[s]=[String(t._.shift())])}cmdToParseOptions(e){const t={array:[],default:{},alias:{},demand:{}},n=parseCommand(e);return n.demanded.forEach(s=>{const[o,...a]=s.cmd;s.variadic&&(t.array.push(o),t.default[o]=[]),t.alias[o]=a,t.demand[o]=!0}),n.optional.forEach(s=>{const[o,...a]=s.cmd;s.variadic&&(t.array.push(o),t.default[o]=[]),t.alias[o]=a}),t}postProcessPositionals(e,t,n,s){const o=Object.assign({},s.getOptions());o.default=Object.assign(n.default,o.default);for(const B of Object.keys(n.alias))o.alias[B]=(o.alias[B]||[]).concat(n.alias[B]);o.array=o.array.concat(n.array),o.config={};const a=[];if(Object.keys(t).forEach(B=>{t[B].map(w=>{o.configuration["unknown-options-as-args"]&&(o.key[B]=!0),a.push(`--${B}`),a.push(w)})}),!a.length)return;const l=Object.assign({},o.configuration,{"populate--":!1}),d=this.shim.Parser.detailed(a,Object.assign({},o,{configuration:l}));if(d.error)s.getInternalMethods().getUsageInstance().fail(d.error.message,d.error);else{const B=Object.keys(t);Object.keys(t).forEach(w=>{B.push(...d.aliases[w])}),Object.keys(d.argv).forEach(w=>{B.includes(w)&&(t[w]||(t[w]=d.argv[w]),!this.isInConfigs(s,w)&&!this.isDefaulted(s,w)&&Object.prototype.hasOwnProperty.call(e,w)&&Object.prototype.hasOwnProperty.call(d.argv,w)&&(Array.isArray(e[w])||Array.isArray(d.argv[w]))?e[w]=[].concat(e[w],d.argv[w]):e[w]=d.argv[w])})}}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(s=>Object.prototype.hasOwnProperty.call(s,t))||n.some(s=>Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){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 s of[e,t,n]){if(typeof s=="string"||s===!1)return s;assertNotStrictEqual(s,!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(i,e,t,n){return new CommandInstance(i,e,t,n)}function isCommandBuilderDefinition(i){return typeof i=="object"&&!!i.builder&&typeof i.handler=="function"}function isCommandAndAliases(i){return i.every(e=>typeof e=="string")}function isCommandBuilderCallback(i){return typeof i=="function"}function isCommandBuilderOptionDefinitions(i){return typeof i=="object"}function isCommandHandlerDefinition(i){return typeof i=="object"&&!Array.isArray(i)}function objFilter(i={},e=()=>!0){const t={};return objectKeys(i).forEach(n=>{e(n,i[n])&&(t[n]=i[n])}),t}function setBlocking(i){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{const t=e;t._handle&&t.isTTY&&typeof t._handle.setBlocking=="function"&&t._handle.setBlocking(i)})}function isBoolean(i){return typeof i=="boolean"}function usage(i,e){const t=e.y18n.__,n={},s=[];n.failFn=function(X){s.push(X)};let o=null,a=null,l=!0;n.showHelpOnFail=function(X=!0,te){const[le,he]=typeof X=="string"?[!0,X]:[X,te];return i.getInternalMethods().isGlobalContext()&&(a=he),o=he,l=le,n};let d=!1;n.fail=function(X,te){const le=i.getInternalMethods().getLoggerInstance();if(s.length)for(let he=s.length-1;he>=0;--he){const Ae=s[he];if(isBoolean(Ae)){if(te)throw te;if(X)throw Error(X)}else Ae(X,te,n)}else{if(i.getExitProcess()&&setBlocking(!0),!d){d=!0,l&&(i.showHelp("error"),le.error()),(X||te)&&le.error(X||te);const he=o||a;he&&((X||te)&&le.error(""),le.error(he))}if(te=te||new YError(X),i.getExitProcess())return i.exit(1);if(i.getInternalMethods().hasParseCallback())return i.exit(1,te);throw te}};let B=[],w=!1;n.usage=(ie,X)=>ie===null?(w=!0,B=[],n):(w=!1,B.push([ie,X||""]),n),n.getUsage=()=>B,n.getUsageDisabled=()=>w,n.getPositionalGroupName=()=>t("Positionals:");let E=[];n.example=(ie,X)=>{E.push([ie,X||""])};let _=[];n.command=function(X,te,le,he,Ae=!1){le&&(_=_.map(de=>(de[2]=!1,de))),_.push([X,te||"",le,he,Ae])},n.getCommands=()=>_;let U={};n.describe=function(X,te){Array.isArray(X)?X.forEach(le=>{n.describe(le,te)}):typeof X=="object"?Object.keys(X).forEach(le=>{n.describe(le,X[le])}):U[X]=te},n.getDescriptions=()=>U;let H=[];n.epilog=ie=>{H.push(ie)};let W=!1,L;n.wrap=ie=>{W=!0,L=ie},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(W||(L=je(),W=!0),L);const K="__yargsString__:";n.deferY18nLookup=ie=>K+ie,n.help=function(){if(se)return se;ae();const X=i.customScriptName?i.$0:e.path.basename(i.$0),te=i.getDemandedOptions(),le=i.getDemandedCommands(),he=i.getDeprecatedOptions(),Ae=i.getGroups(),de=i.getOptions();let Ee=[];Ee=Ee.concat(Object.keys(U)),Ee=Ee.concat(Object.keys(te)),Ee=Ee.concat(Object.keys(le)),Ee=Ee.concat(Object.keys(de.default)),Ee=Ee.filter(Fe),Ee=Object.keys(Ee.reduce((ue,me)=>(me!=="_"&&(ue[me]=!0),ue),{}));const $e=n.getWrap(),ge=e.cliui({width:$e,wrap:!!$e});if(!w){if(B.length)B.forEach(ue=>{ge.div({text:`${ue[0].replace(/\$0/g,X)}`}),ue[1]&&ge.div({text:`${ue[1]}`,padding:[1,0,0,0]})}),ge.div();else if(_.length){let ue=null;le._?ue=`${X} <${t("command")}>
8
+ `:ue=`${X} [${t("command")}]
9
+ `,ge.div(`${ue}`)}}if(_.length>1||_.length===1&&!_[0][2]){ge.div(t("Commands:"));const ue=i.getInternalMethods().getContext(),me=ue.commands.length?`${ue.commands.join(" ")} `:"";i.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(_=_.sort((fe,Ce)=>fe[0].localeCompare(Ce[0])));const De=X?`${X} `:"";_.forEach(fe=>{const Ce=`${De}${me}${fe[0].replace(/^\$0 ?/,"")}`;ge.span({text:Ce,padding:[0,2,0,2],width:ee(_,$e,`${X}${me}`)+4},{text:fe[1]});const we=[];fe[2]&&we.push(`[${t("default")}]`),fe[3]&&fe[3].length&&we.push(`[${t("aliases:")} ${fe[3].join(", ")}]`),fe[4]&&(typeof fe[4]=="string"?we.push(`[${t("deprecated: %s",fe[4])}]`):we.push(`[${t("deprecated")}]`)),we.length?ge.div({text:we.join(" "),padding:[0,0,0,2],align:"right"}):ge.div()}),ge.div()}const Oe=(Object.keys(de.alias)||[]).concat(Object.keys(i.parsed.newAliases)||[]);Ee=Ee.filter(ue=>!i.parsed.newAliases[ue]&&Oe.every(me=>(de.alias[me]||[]).indexOf(ue)===-1));const Se=t("Options:");Ae[Se]||(Ae[Se]=[]),ce(Ee,de.alias,Ae,Se);const Ie=ue=>/^--/.test(getText(ue)),oe=Object.keys(Ae).filter(ue=>Ae[ue].length>0).map(ue=>{const me=Ae[ue].filter(Fe).map(De=>{if(Oe.includes(De))return De;for(let fe=0,Ce;(Ce=Oe[fe])!==void 0;fe++)if((de.alias[Ce]||[]).includes(De))return Ce;return De});return{groupName:ue,normalizedKeys:me}}).filter(({normalizedKeys:ue})=>ue.length>0).map(({groupName:ue,normalizedKeys:me})=>{const De=me.reduce((fe,Ce)=>(fe[Ce]=[Ce].concat(de.alias[Ce]||[]).map(we=>ue===n.getPositionalGroupName()?we:(/^[0-9]$/.test(we)?de.boolean.includes(Ce)?"-":"--":we.length>1?"--":"-")+we).sort((we,Be)=>Ie(we)===Ie(Be)?0:Ie(we)?1:-1).join(", "),fe),{});return{groupName:ue,normalizedKeys:me,switches:De}});if(oe.filter(({groupName:ue})=>ue!==n.getPositionalGroupName()).some(({normalizedKeys:ue,switches:me})=>!ue.every(De=>Ie(me[De])))&&oe.filter(({groupName:ue})=>ue!==n.getPositionalGroupName()).forEach(({normalizedKeys:ue,switches:me})=>{ue.forEach(De=>{Ie(me[De])&&(me[De]=addIndentation(me[De],4))})}),oe.forEach(({groupName:ue,normalizedKeys:me,switches:De})=>{ge.div(ue),me.forEach(fe=>{const Ce=De[fe];let we=U[fe]||"",Be=null;we.includes(K)&&(we=t(we.substring(K.length))),de.boolean.includes(fe)&&(Be=`[${t("boolean")}]`),de.count.includes(fe)&&(Be=`[${t("count")}]`),de.string.includes(fe)&&(Be=`[${t("string")}]`),de.normalize.includes(fe)&&(Be=`[${t("string")}]`),de.array.includes(fe)&&(Be=`[${t("array")}]`),de.number.includes(fe)&&(Be=`[${t("number")}]`);const _e=T=>typeof T=="string"?`[${t("deprecated: %s",T)}]`:`[${t("deprecated")}]`,Le=[fe in he?_e(he[fe]):null,Be,fe in te?`[${t("required")}]`:null,de.choices&&de.choices[fe]?`[${t("choices:")} ${n.stringifiedValues(de.choices[fe])}]`:null,ve(de.default[fe],de.defaultDescription[fe])].filter(Boolean).join(" ");ge.span({text:getText(Ce),padding:[0,2,0,2+getIndentation(Ce)],width:ee(De,$e)+4},we);const y=i.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;Le&&!y?ge.div({text:Le,padding:[0,0,0,2],align:"right"}):ge.div()}),ge.div()}),E.length&&(ge.div(t("Examples:")),E.forEach(ue=>{ue[0]=ue[0].replace(/\$0/g,X)}),E.forEach(ue=>{ue[1]===""?ge.div({text:ue[0],padding:[0,2,0,2]}):ge.div({text:ue[0],padding:[0,2,0,2],width:ee(E,$e)+4},{text:ue[1]})}),ge.div()),H.length>0){const ue=H.map(me=>me.replace(/\$0/g,X)).join(`
10
+ `);ge.div(`${ue}
11
+ `)}return ge.toString().replace(/\s*$/,"")};function ee(ie,X,te){let le=0;return Array.isArray(ie)||(ie=Object.values(ie).map(he=>[he])),ie.forEach(he=>{le=Math.max(e.stringWidth(te?`${te} ${getText(he[0])}`:getText(he[0]))+getIndentation(he[0]),le)}),X&&(le=Math.min(le,parseInt((X*.5).toString(),10))),le}function ae(){const ie=i.getDemandedOptions(),X=i.getOptions();(Object.keys(X.alias)||[]).forEach(te=>{X.alias[te].forEach(le=>{U[le]&&n.describe(te,U[le]),le in ie&&i.demandOption(te,ie[le]),X.boolean.includes(le)&&i.boolean(te),X.count.includes(le)&&i.count(te),X.string.includes(le)&&i.string(te),X.normalize.includes(le)&&i.normalize(te),X.array.includes(le)&&i.array(te),X.number.includes(le)&&i.number(te)})})}let se;n.cacheHelpMessage=function(){se=this.help()},n.clearCachedHelpMessage=function(){se=void 0},n.hasCachedHelpMessage=function(){return!!se};function ce(ie,X,te,le){let he=[],Ae=null;return Object.keys(te).forEach(de=>{he=he.concat(te[de])}),ie.forEach(de=>{Ae=[de].concat(X[de]),Ae.some(Ee=>he.indexOf(Ee)!==-1)||te[le].push(de)}),he}function Fe(ie){return i.getOptions().hiddenOptions.indexOf(ie)<0||i.parsed.argv[i.getOptions().showHiddenOpt]}n.showHelp=ie=>{const X=i.getInternalMethods().getLoggerInstance();ie||(ie="error"),(typeof ie=="function"?ie:X[ie])(n.help())},n.functionDescription=ie=>["(",ie.name?e.Parser.decamelize(ie.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(X,te){let le="";const he=te||", ",Ae=[].concat(X);return!X||!Ae.length||Ae.forEach(de=>{le.length&&(le+=he),le+=JSON.stringify(de)}),le};function ve(ie,X){let te=`[${t("default:")} `;if(ie===void 0&&!X)return null;if(X)te+=X;else switch(typeof ie){case"string":te+=`"${ie}"`;break;case"object":te+=JSON.stringify(ie);break;default:te+=ie}return`${te}]`}function je(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let xe=null;n.version=ie=>{xe=ie},n.showVersion=ie=>{const X=i.getInternalMethods().getLoggerInstance();ie||(ie="error"),(typeof ie=="function"?ie:X[ie])(xe)},n.reset=function(X){return o=null,d=!1,B=[],w=!1,H=[],E=[],_=[],U=objFilter(U,te=>!X[te]),n};const pe=[];return n.freeze=function(){pe.push({failMessage:o,failureOutput:d,usages:B,usageDisabled:w,epilogs:H,examples:E,commands:_,descriptions:U})},n.unfreeze=function(X=!1){const te=pe.pop();te&&(X?(U={...te.descriptions,...U},_=[...te.commands,..._],B=[...te.usages,...B],E=[...te.examples,...E],H=[...te.epilogs,...H]):{failMessage:o,failureOutput:d,usages:B,usageDisabled:w,epilogs:H,examples:E,commands:_,descriptions:U}=te)},n}function isIndentedText(i){return typeof i=="object"}function addIndentation(i,e){return isIndentedText(i)?{text:i.text,indentation:i.indentation+e}:{text:i,indentation:e}}function getIndentation(i){return isIndentedText(i)?i.indentation:0}function getText(i){return isIndentedText(i)?i.text:i}const completionShTemplate=`###-begin-{{app_name}}-completions-###
12
12
  #
13
13
  # yargs command completion script
14
14
  #
@@ -55,14 +55,14 @@ _{{app_name}}_yargs_completions()
55
55
  }
56
56
  compdef _{{app_name}}_yargs_completions {{app_name}}
57
57
  ###-end-{{app_name}}-completions-###
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 _=a[e[d]].builder;if(isCommandBuilderCallback(_)){this.indexAfterLastReset=d+1;const E=this.yargs.getInternalMethods().reset();return _(E,!0),E.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 _ of w)_.startsWith(o)&&e.push(_.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 _=e;if(this.zshShell){const W=this.usage.getDescriptions(),K=(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(Q=>{const te=W[Q];return typeof te=="string"&&te.length>0}),z=K?W[K]:void 0,N=(w=(d=W[e])!==null&&d!==void 0?d:z)!==null&&w!==void 0?w:"";_=`${e.replace(/:/g,"\\:")}:${N.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const E=W=>/^--/.test(W),y=W=>/^[^0-9]$/.test(W),L=!E(n)&&y(e)?"-":"--";t.push(L+_),o&&t.push(L+"no-"+_)}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(y){const L=s.getDemandedCommands(),K=y._.length+(y["--"]?y["--"].length:0)-s.getInternalMethods().getContext().commands.length;L._&&(K<L._.min||K>L._.max)&&(K<L._.min?L._.minMsg!==void 0?e.fail(L._.minMsg?L._.minMsg.replace(/\$0/g,K.toString()).replace(/\$1/,L._.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",K,K.toString(),L._.min.toString())):K>L._.max&&(L._.maxMsg!==void 0?e.fail(L._.maxMsg?L._.maxMsg.replace(/\$0/g,K.toString()).replace(/\$1/,L._.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",K,K.toString(),L._.max.toString()))))},a.positionalCount=function(y,L){L<y&&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",L,L+"",y+""))},a.requiredArguments=function(y,L){let W=null;for(const K of Object.keys(L))(!Object.prototype.hasOwnProperty.call(y,K)||typeof y[K]>"u")&&(W=W||{},W[K]=L[K]);if(W){const K=[];for(const N of Object.keys(W)){const Q=W[N];Q&&K.indexOf(Q)<0&&K.push(Q)}const z=K.length?`
59
- ${K.join(`
60
- `)}`:"";e.fail(o("Missing required argument: %s","Missing required arguments: %s",Object.keys(W).length,Object.keys(W).join(", ")+z))}},a.unknownArguments=function(y,L,W,K,z=!0){var N;const Q=s.getInternalMethods().getCommandInstance().getCommands(),te=[],ce=s.getInternalMethods().getContext();if(Object.keys(y).forEach(oe=>{!specialKeys.includes(oe)&&!Object.prototype.hasOwnProperty.call(W,oe)&&!Object.prototype.hasOwnProperty.call(s.getInternalMethods().getParseContext(),oe)&&!a.isValidAndSomeAliasIsNotNew(oe,L)&&te.push(oe)}),z&&(ce.commands.length>0||Q.length>0||K)&&y._.slice(ce.commands.length).forEach(oe=>{Q.includes(""+oe)||te.push(""+oe)}),z){const le=((N=s.getDemandedCommands()._)===null||N===void 0?void 0:N.max)||0,ye=ce.commands.length+le;ye<y._.length&&y._.slice(ye).forEach(Be=>{Be=String(Be),!ce.commands.includes(Be)&&!te.includes(Be)&&te.push(Be)})}te.length&&e.fail(o("Unknown argument: %s","Unknown arguments: %s",te.length,te.map(oe=>oe.trim()?oe:`"${oe}"`).join(", ")))},a.unknownCommands=function(y){const L=s.getInternalMethods().getCommandInstance().getCommands(),W=[],K=s.getInternalMethods().getContext();return(K.commands.length>0||L.length>0)&&y._.slice(K.commands.length).forEach(z=>{L.includes(""+z)||W.push(""+z)}),W.length>0?(e.fail(o("Unknown command: %s","Unknown commands: %s",W.length,W.join(", "))),!0):!1},a.isValidAndSomeAliasIsNotNew=function(y,L){if(!Object.prototype.hasOwnProperty.call(L,y))return!1;const W=s.parsed.newAliases;return[y,...L[y]].some(K=>!Object.prototype.hasOwnProperty.call(W,K)||!W[y])},a.limitedChoices=function(y){const L=s.getOptions(),W={};if(!Object.keys(L.choices).length)return;Object.keys(y).forEach(N=>{specialKeys.indexOf(N)===-1&&Object.prototype.hasOwnProperty.call(L.choices,N)&&[].concat(y[N]).forEach(Q=>{L.choices[N].indexOf(Q)===-1&&Q!==void 0&&(W[N]=(W[N]||[]).concat(Q))})});const K=Object.keys(W);if(!K.length)return;let z=n("Invalid values:");K.forEach(N=>{z+=`
61
- ${n("Argument: %s, Given: %s, Choices: %s",N,e.stringifiedValues(W[N]),e.stringifiedValues(L.choices[N]))}`}),e.fail(z)};let l={};a.implies=function(y,L){argsert("<string|object> [array|number|string]",[y,L],arguments.length),typeof y=="object"?Object.keys(y).forEach(W=>{a.implies(W,y[W])}):(s.global(y),l[y]||(l[y]=[]),Array.isArray(L)?L.forEach(W=>a.implies(y,W)):(assertNotStrictEqual(L,void 0,t),l[y].push(L)))},a.getImplied=function(){return l};function d(E,y){const L=Number(y);return y=isNaN(L)?y:L,typeof y=="number"?y=E._.length>=y:y.match(/^--no-.+/)?(y=y.match(/^--no-(.+)/)[1],y=!Object.prototype.hasOwnProperty.call(E,y)):y=Object.prototype.hasOwnProperty.call(E,y),y}a.implications=function(y){const L=[];if(Object.keys(l).forEach(W=>{const K=W;(l[W]||[]).forEach(z=>{let N=K;const Q=z;N=d(y,N),z=d(y,z),N&&!z&&L.push(` ${K} -> ${Q}`)})}),L.length){let W=`${n("Implications failed:")}
62
- `;L.forEach(K=>{W+=K}),e.fail(W)}};let w={};a.conflicts=function(y,L){argsert("<string|object> [array|string]",[y,L],arguments.length),typeof y=="object"?Object.keys(y).forEach(W=>{a.conflicts(W,y[W])}):(s.global(y),w[y]||(w[y]=[]),Array.isArray(L)?L.forEach(W=>a.conflicts(y,W)):w[y].push(L))},a.getConflicting=()=>w,a.conflicting=function(y){Object.keys(y).forEach(L=>{w[L]&&w[L].forEach(W=>{W&&y[L]!==void 0&&y[W]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",L,W))})}),s.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(w).forEach(L=>{w[L].forEach(W=>{W&&y[t.Parser.camelCase(L)]!==void 0&&y[t.Parser.camelCase(W)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",L,W))})})},a.recommendCommands=function(y,L){L=L.sort((N,Q)=>Q.length-N.length);let K=null,z=1/0;for(let N=0,Q;(Q=L[N])!==void 0;N++){const te=levenshtein(y,Q);te<=3&&te<z&&(z=te,K=Q)}K&&e.fail(n("Did you mean %s?",K))},a.reset=function(y){return l=objFilter(l,L=>!y[L]),w=objFilter(w,L=>!y[L]),a};const _=[];return a.freeze=function(){_.push({implied:l,conflicting:w})},a.unfreeze=function(){const y=_.pop();assertNotStrictEqual(y,void 0,t),{implied:l,conflicting:w}=y},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 _ of a[e])n[_]=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
- `),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")+`
58
+ `;class Completion{constructor(e,t,n,s){var o,a,l;this.yargs=e,this.usage=t,this.command=n,this.shim=s,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(l=((o=this.shim.getEnv("SHELL"))===null||o===void 0?void 0:o.includes("zsh"))||((a=this.shim.getEnv("ZSH_NAME"))===null||a===void 0?void 0:a.includes("zsh")))!==null&&l!==void 0?l:!1}defaultCompletion(e,t,n,s){const o=this.command.getCommandHandlers();for(let l=0,d=e.length;l<d;++l)if(o[e[l]]&&o[e[l]].builder){const B=o[e[l]].builder;if(isCommandBuilderCallback(B)){this.indexAfterLastReset=l+1;const w=this.yargs.getInternalMethods().reset();return B(w,!0),w.argv}}const a=[];this.commandCompletions(a,e,n),this.optionCompletions(a,e,t,n),this.choicesFromOptionsCompletions(a,e,t,n),this.choicesFromPositionalsCompletions(a,e,t,n),s(null,a)}commandCompletions(e,t,n){const s=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&s[s.length-1]!==n&&!this.previousArgHasChoices(t)&&this.usage.getCommands().forEach(o=>{const a=parseCommand(o[0]).cmd;if(t.indexOf(a)===-1)if(!this.zshShell)e.push(a);else{const l=o[1]||"";e.push(a.replace(/:/g,"\\:")+":"+l)}})}optionCompletions(e,t,n,s){if((s.match(/^-/)||s===""&&e.length===0)&&!this.previousArgHasChoices(t)){const o=this.yargs.getOptions(),a=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(o.key).forEach(l=>{const d=!!o.configuration["boolean-negation"]&&o.boolean.includes(l);!a.includes(l)&&!o.hiddenOptions.includes(l)&&!this.argsContainKey(t,l,d)&&this.completeOptionKey(l,e,s,d&&!!o.default[l])})}}choicesFromOptionsCompletions(e,t,n,s){if(this.previousArgHasChoices(t)){const o=this.getPreviousArgChoices(t);o&&o.length>0&&e.push(...o.map(a=>a.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,t,n,s){if(s===""&&e.length>0&&this.previousArgHasChoices(t))return;const o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],a=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),l=o[n._.length-a-1];if(!l)return;const d=this.yargs.getOptions().choices[l]||[];for(const B of d)B.startsWith(s)&&e.push(B.replace(/:/g,"\\:"))}getPreviousArgChoices(e){if(e.length<1)return;let t=e[e.length-1],n="";if(!t.startsWith("-")&&e.length>1&&(n=t,t=e[e.length-2]),!t.startsWith("-"))return;const s=t.replace(/^-+/,""),o=this.yargs.getOptions(),a=[s,...this.yargs.getAliases()[s]||[]];let l;for(const d of a)if(Object.prototype.hasOwnProperty.call(o.key,d)&&Array.isArray(o.choices[d])){l=o.choices[d];break}if(l)return l.filter(d=>!n||d.startsWith(n))}previousArgHasChoices(e){const t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){const s=o=>e.indexOf((/^[^0-9]$/.test(o)?"-":"--")+o)!==-1;if(s(t)||n&&s(`no-${t}`))return!0;if(this.aliases){for(const o of this.aliases[t])if(s(o))return!0}return!1}completeOptionKey(e,t,n,s){var o,a,l,d;let B=e;if(this.zshShell){const U=this.usage.getDescriptions(),H=(a=(o=this===null||this===void 0?void 0:this.aliases)===null||o===void 0?void 0:o[e])===null||a===void 0?void 0:a.find(K=>{const ee=U[K];return typeof ee=="string"&&ee.length>0}),W=H?U[H]:void 0,L=(d=(l=U[e])!==null&&l!==void 0?l:W)!==null&&d!==void 0?d:"";B=`${e.replace(/:/g,"\\:")}:${L.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const w=U=>/^--/.test(U),E=U=>/^[^0-9]$/.test(U),_=!w(n)&&E(e)?"-":"--";t.push(_+B),s&&t.push(_+"no-"+B)}customCompletion(e,t,n,s){if(assertNotStrictEqual(this.customCompletionFunction,null,this.shim),isSyncCompletionFunction(this.customCompletionFunction)){const o=this.customCompletionFunction(n,t);return isPromise(o)?o.then(a=>{this.shim.process.nextTick(()=>{s(null,a)})}).catch(a=>{this.shim.process.nextTick(()=>{s(a,void 0)})}):s(null,o)}else return isFallbackCompletionFunction(this.customCompletionFunction)?this.customCompletionFunction(n,t,(o=s)=>this.defaultCompletion(e,t,n,o),o=>{s(null,o)}):this.customCompletionFunction(n,t,o=>{s(null,o)})}getCompletion(e,t){const n=e.length?e[e.length-1]:"",s=this.yargs.parse(e,!0),o=this.customCompletionFunction?a=>this.customCompletion(e,a,n,t):a=>this.defaultCompletion(e,a,n,t);return isPromise(s)?s.then(o):o(s)}generateCompletionScript(e,t){let n=this.zshShell?completionZshTemplate:completionShTemplate;const s=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,s),n=n.replace(/{{completion_command}}/g,t),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}}function completion(i,e,t,n){return new Completion(i,e,t,n)}function isSyncCompletionFunction(i){return i.length<3}function isFallbackCompletionFunction(i){return i.length>3}function levenshtein(i,e){if(i.length===0)return e.length;if(e.length===0)return i.length;const t=[];let n;for(n=0;n<=e.length;n++)t[n]=[n];let s;for(s=0;s<=i.length;s++)t[0][s]=s;for(n=1;n<=e.length;n++)for(s=1;s<=i.length;s++)e.charAt(n-1)===i.charAt(s-1)?t[n][s]=t[n-1][s-1]:n>1&&s>1&&e.charAt(n-2)===i.charAt(s-1)&&e.charAt(n-1)===i.charAt(s-2)?t[n][s]=t[n-2][s-2]+1:t[n][s]=Math.min(t[n-1][s-1]+1,Math.min(t[n][s-1]+1,t[n-1][s]+1));return t[e.length][i.length]}const specialKeys=["$0","--","_"];function validation(i,e,t){const n=t.y18n.__,s=t.y18n.__n,o={};o.nonOptionCount=function(E){const _=i.getDemandedCommands(),H=E._.length+(E["--"]?E["--"].length:0)-i.getInternalMethods().getContext().commands.length;_._&&(H<_._.min||H>_._.max)&&(H<_._.min?_._.minMsg!==void 0?e.fail(_._.minMsg?_._.minMsg.replace(/\$0/g,H.toString()).replace(/\$1/,_._.min.toString()):null):e.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",H,H.toString(),_._.min.toString())):H>_._.max&&(_._.maxMsg!==void 0?e.fail(_._.maxMsg?_._.maxMsg.replace(/\$0/g,H.toString()).replace(/\$1/,_._.max.toString()):null):e.fail(s("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",H,H.toString(),_._.max.toString()))))},o.positionalCount=function(E,_){_<E&&e.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",_,_+"",E+""))},o.requiredArguments=function(E,_){let U=null;for(const H of Object.keys(_))(!Object.prototype.hasOwnProperty.call(E,H)||typeof E[H]>"u")&&(U=U||{},U[H]=_[H]);if(U){const H=[];for(const L of Object.keys(U)){const K=U[L];K&&H.indexOf(K)<0&&H.push(K)}const W=H.length?`
59
+ ${H.join(`
60
+ `)}`:"";e.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(U).length,Object.keys(U).join(", ")+W))}},o.unknownArguments=function(E,_,U,H,W=!0){var L;const K=i.getInternalMethods().getCommandInstance().getCommands(),ee=[],ae=i.getInternalMethods().getContext();if(Object.keys(E).forEach(se=>{!specialKeys.includes(se)&&!Object.prototype.hasOwnProperty.call(U,se)&&!Object.prototype.hasOwnProperty.call(i.getInternalMethods().getParseContext(),se)&&!o.isValidAndSomeAliasIsNotNew(se,_)&&ee.push(se)}),W&&(ae.commands.length>0||K.length>0||H)&&E._.slice(ae.commands.length).forEach(se=>{K.includes(""+se)||ee.push(""+se)}),W){const ce=((L=i.getDemandedCommands()._)===null||L===void 0?void 0:L.max)||0,Fe=ae.commands.length+ce;Fe<E._.length&&E._.slice(Fe).forEach(ve=>{ve=String(ve),!ae.commands.includes(ve)&&!ee.includes(ve)&&ee.push(ve)})}ee.length&&e.fail(s("Unknown argument: %s","Unknown arguments: %s",ee.length,ee.map(se=>se.trim()?se:`"${se}"`).join(", ")))},o.unknownCommands=function(E){const _=i.getInternalMethods().getCommandInstance().getCommands(),U=[],H=i.getInternalMethods().getContext();return(H.commands.length>0||_.length>0)&&E._.slice(H.commands.length).forEach(W=>{_.includes(""+W)||U.push(""+W)}),U.length>0?(e.fail(s("Unknown command: %s","Unknown commands: %s",U.length,U.join(", "))),!0):!1},o.isValidAndSomeAliasIsNotNew=function(E,_){if(!Object.prototype.hasOwnProperty.call(_,E))return!1;const U=i.parsed.newAliases;return[E,..._[E]].some(H=>!Object.prototype.hasOwnProperty.call(U,H)||!U[E])},o.limitedChoices=function(E){const _=i.getOptions(),U={};if(!Object.keys(_.choices).length)return;Object.keys(E).forEach(L=>{specialKeys.indexOf(L)===-1&&Object.prototype.hasOwnProperty.call(_.choices,L)&&[].concat(E[L]).forEach(K=>{_.choices[L].indexOf(K)===-1&&K!==void 0&&(U[L]=(U[L]||[]).concat(K))})});const H=Object.keys(U);if(!H.length)return;let W=n("Invalid values:");H.forEach(L=>{W+=`
61
+ ${n("Argument: %s, Given: %s, Choices: %s",L,e.stringifiedValues(U[L]),e.stringifiedValues(_.choices[L]))}`}),e.fail(W)};let a={};o.implies=function(E,_){argsert("<string|object> [array|number|string]",[E,_],arguments.length),typeof E=="object"?Object.keys(E).forEach(U=>{o.implies(U,E[U])}):(i.global(E),a[E]||(a[E]=[]),Array.isArray(_)?_.forEach(U=>o.implies(E,U)):(assertNotStrictEqual(_,void 0,t),a[E].push(_)))},o.getImplied=function(){return a};function l(w,E){const _=Number(E);return E=isNaN(_)?E:_,typeof E=="number"?E=w._.length>=E:E.match(/^--no-.+/)?(E=E.match(/^--no-(.+)/)[1],E=!Object.prototype.hasOwnProperty.call(w,E)):E=Object.prototype.hasOwnProperty.call(w,E),E}o.implications=function(E){const _=[];if(Object.keys(a).forEach(U=>{const H=U;(a[U]||[]).forEach(W=>{let L=H;const K=W;L=l(E,L),W=l(E,W),L&&!W&&_.push(` ${H} -> ${K}`)})}),_.length){let U=`${n("Implications failed:")}
62
+ `;_.forEach(H=>{U+=H}),e.fail(U)}};let d={};o.conflicts=function(E,_){argsert("<string|object> [array|string]",[E,_],arguments.length),typeof E=="object"?Object.keys(E).forEach(U=>{o.conflicts(U,E[U])}):(i.global(E),d[E]||(d[E]=[]),Array.isArray(_)?_.forEach(U=>o.conflicts(E,U)):d[E].push(_))},o.getConflicting=()=>d,o.conflicting=function(E){Object.keys(E).forEach(_=>{d[_]&&d[_].forEach(U=>{U&&E[_]!==void 0&&E[U]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",_,U))})}),i.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(d).forEach(_=>{d[_].forEach(U=>{U&&E[t.Parser.camelCase(_)]!==void 0&&E[t.Parser.camelCase(U)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",_,U))})})},o.recommendCommands=function(E,_){_=_.sort((L,K)=>K.length-L.length);let H=null,W=1/0;for(let L=0,K;(K=_[L])!==void 0;L++){const ee=levenshtein(E,K);ee<=3&&ee<W&&(W=ee,H=K)}H&&e.fail(n("Did you mean %s?",H))},o.reset=function(E){return a=objFilter(a,_=>!E[_]),d=objFilter(d,_=>!E[_]),o};const B=[];return o.freeze=function(){B.push({implied:a,conflicting:d})},o.unfreeze=function(){const E=B.pop();assertNotStrictEqual(E,void 0,t),{implied:a,conflicting:d}=E},o}let previouslyVisitedConfigs=[],shim;function applyExtends(i,e,t,n){shim=n;let s={};if(Object.prototype.hasOwnProperty.call(i,"extends")){if(typeof i.extends!="string")return s;const o=/\.json|\..*rc$/.test(i.extends);let a=null;if(o)a=getPathToDefaultConfig(e,i.extends);else try{a=require.resolve(i.extends)}catch{return i}checkForCircularExtends(a),previouslyVisitedConfigs.push(a),s=o?JSON.parse(shim.readFileSync(a,"utf8")):require(i.extends),delete i.extends,s=applyExtends(s,shim.path.dirname(a),t,shim)}return previouslyVisitedConfigs=[],t?mergeDeep(s,i):Object.assign({},s,i)}function checkForCircularExtends(i){if(previouslyVisitedConfigs.indexOf(i)>-1)throw new YError(`Circular extended configurations: '${i}'.`)}function getPathToDefaultConfig(i,e){return shim.path.resolve(i,e)}function mergeDeep(i,e){const t={};function n(s){return s&&typeof s=="object"&&!Array.isArray(s)}Object.assign(t,i);for(const s of Object.keys(e))n(e[s])&&n(t[s])?t[s]=mergeDeep(i[s],e[s]):t[s]=e[s];return t}var __classPrivateFieldSet=function(i,e,t,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!s:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(i,t):s?s.value=t:e.set(i,t),t},__classPrivateFieldGet=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},_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(i){return(e=[],t=i.process.cwd(),n)=>{const s=new YargsInstance(e,t,n,i);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}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,s){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,s,"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,s)=>maybeAsyncResult(()=>e(n,s.getOptions()),o=>(o?(typeof o=="string"||o instanceof Error)&&__classPrivateFieldGet(this,_YargsInstance_usage,"f").fail(o.toString(),o):__classPrivateFieldGet(this,_YargsInstance_usage,"f").fail(__classPrivateFieldGet(this,_YargsInstance_shim,"f").y18n.__("Argument check failed: %s",e.toString())),n),o=>(__classPrivateFieldGet(this,_YargsInstance_usage,"f").fail(o.message?o.message:o.toString(),o),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,s)=>{let o;return Object.prototype.hasOwnProperty.call(n,e)?maybeAsyncResult(()=>(o=s.getAliases(),t(n[e])),l=>{n[e]=l;const d=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(o[e]&&d!==!0)for(const B of o[e])n[B]=l;return n},l=>{throw new YError(l.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(s=>{__classPrivateFieldGet(this,_YargsInstance_options,"f").config[s]=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,s,o,a){return argsert("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,s,o,a],arguments.length),__classPrivateFieldGet(this,_YargsInstance_command,"f").addHandler(e,t,n,s,o,a),this}commands(e,t,n,s,o,a){return this.command(e,t,n,s,o,a)}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,s){return argsert("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,s],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),__classPrivateFieldGet(this,_YargsInstance_options,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:s},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(s=>{assertNotStrictEqual(n,!0,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),this.demandOption(s,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(s=>{assertNotStrictEqual(n,!0,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),this.demandOption(s,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return 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,s)=>{__classPrivateFieldGet(this,_YargsInstance_completion,"f").getCompletion(e,(o,a)=>{o?s(o):n(a)})})}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 s={};return __classPrivateFieldGet(this,_YargsInstance_groups,"f")[t]=(n||[]).concat(e).filter(o=>s[o]?!1:s[o]=!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
+ `),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 s=t.demand||t.required||t.require;s&&this.demand(e,s),t.demandOption&&this.demandOption(e,typeof t.demandOption=="string"?t.demandOption:void 0),t.conflicts&&this.conflicts(e,t.conflicts),"default"in t&&this.default(e,t.default),t.implies!==void 0&&this.implies(e,t.implies),t.nargs!==void 0&&this.nargs(e,t.nargs),t.config&&this.config(e,t.configParser),t.normalize&&this.normalize(e),t.choices&&this.choices(e,t.choices),t.coerce&&this.coerce(e,t.coerce),t.group&&this.group(e,t.group),(t.boolean||t.type==="boolean")&&(this.boolean(e),t.alias&&this.boolean(t.alias)),(t.array||t.type==="array")&&(this.array(e),t.alias&&this.array(t.alias)),(t.number||t.type==="number")&&(this.number(e),t.alias&&this.number(t.alias)),(t.string||t.type==="string")&&(this.string(e),t.alias&&this.string(t.alias)),(t.count||t.type==="count")&&this.count(e),typeof t.global=="boolean"&&this.global(e,t.global),t.defaultDescription&&(__classPrivateFieldGet(this,_YargsInstance_options,"f").defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);const o=t.describe||t.description||t.desc,a=__classPrivateFieldGet(this,_YargsInstance_usage,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(a,e)||typeof o=="string")&&this.describe(e,o),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 s=this[kRunYargsParserAndExecuteCommands](e,!!t),o=this.parsed;return __classPrivateFieldGet(this,_YargsInstance_completion,"f").setParsed(this.parsed),isPromise(s)?s.then(a=>(__classPrivateFieldGet(this,_YargsInstance_parseFn,"f")&&__classPrivateFieldGet(this,_YargsInstance_parseFn,"f").call(this,__classPrivateFieldGet(this,_YargsInstance_exitError,"f"),a,__classPrivateFieldGet(this,_YargsInstance_output,"f")),a)).catch(a=>{throw __classPrivateFieldGet(this,_YargsInstance_parseFn,"f")&&__classPrivateFieldGet(this,_YargsInstance_parseFn,"f")(a,this.parsed.argv,__classPrivateFieldGet(this,_YargsInstance_output,"f")),a}).finally(()=>{this[kUnfreeze](),this.parsed=o}):(__classPrivateFieldGet(this,_YargsInstance_parseFn,"f")&&__classPrivateFieldGet(this,_YargsInstance_parseFn,"f").call(this,__classPrivateFieldGet(this,_YargsInstance_exitError,"f"),s,__classPrivateFieldGet(this,_YargsInstance_output,"f")),this[kUnfreeze](),this.parsed=o,s)}parseAsync(e,t,n){const s=this.parse(e,t,n);return isPromise(s)?s:Promise.resolve(s)}parseSync(e,t,n){const s=this.parse(e,t,n);if(isPromise(s))throw new YError(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}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 s=this[kPkgUp](t||__classPrivateFieldGet(this,_YargsInstance_cwd,"f"));return s[e]&&typeof s[e]=="object"&&(n=applyExtends(s[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,(a,l)=>a==="type"&&!["string","number","boolean"].includes(l)?!1:n.includes(a));const s=__classPrivateFieldGet(this,_YargsInstance_context,"f").fullCommands[__classPrivateFieldGet(this,_YargsInstance_context,"f").fullCommands.length-1],o=s?__classPrivateFieldGet(this,_YargsInstance_command,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return objectKeys(o).forEach(a=>{const l=o[a];Array.isArray(l)?l.indexOf(e)!==-1&&(t[a]=!0):l[e]&&!(a in t)&&(t[a]=l[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,s){if(argsert("<string|null|undefined> [string|boolean] [function|object] [function]",[e,t,n,s],arguments.length),t!==void 0){if(assertNotStrictEqual(e,null,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,s);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 s="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=s;else if(arguments.length===1){if(e===!1)return this;n=e,e=s}else arguments.length===2&&(n=t,t=void 0);return __classPrivateFieldSet(this,_YargsInstance_versionOpt,typeof e=="string"?e:s,"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,_,E,y,L;const W=__classPrivateFieldGet(this,_YargsInstance_frozens,"f").pop();assertNotStrictEqual(W,void 0,__classPrivateFieldGet(this,_YargsInstance_shim,"f"));let K;e=this,t=this,n=this,o=this,a=this,l=this,d=this,w=this,_=this,E=this,y=this,L=this,{options:{set value(z){__classPrivateFieldSet(e,_YargsInstance_options,z,"f")}}.value,configObjects:K,exitProcess:{set value(z){__classPrivateFieldSet(t,_YargsInstance_exitProcess,z,"f")}}.value,groups:{set value(z){__classPrivateFieldSet(n,_YargsInstance_groups,z,"f")}}.value,output:{set value(z){__classPrivateFieldSet(o,_YargsInstance_output,z,"f")}}.value,exitError:{set value(z){__classPrivateFieldSet(a,_YargsInstance_exitError,z,"f")}}.value,hasOutput:{set value(z){__classPrivateFieldSet(l,_YargsInstance_hasOutput,z,"f")}}.value,parsed:this.parsed,strict:{set value(z){__classPrivateFieldSet(d,_YargsInstance_strict,z,"f")}}.value,strictCommands:{set value(z){__classPrivateFieldSet(w,_YargsInstance_strictCommands,z,"f")}}.value,strictOptions:{set value(z){__classPrivateFieldSet(_,_YargsInstance_strictOptions,z,"f")}}.value,completionCommand:{set value(z){__classPrivateFieldSet(E,_YargsInstance_completionCommand,z,"f")}}.value,parseFn:{set value(z){__classPrivateFieldSet(y,_YargsInstance_parseFn,z,"f")}}.value,parseContext:{set value(z){__classPrivateFieldSet(L,_YargsInstance_parseContext,z,"f")}}.value}=W,__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects=K,__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(_=>!(_ 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}),_=__classPrivateFieldGet(this,_YargsInstance_shim,"f").Parser.detailed(e,Object.assign({},__classPrivateFieldGet(this,_YargsInstance_options,"f"),{configuration:{"parse-positional-numbers":!1,...w}})),E=Object.assign(_.argv,__classPrivateFieldGet(this,_YargsInstance_parseContext,"f"));let y;const L=_.aliases;let W=!1,K=!1;Object.keys(E).forEach(z=>{z===__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")&&E[z]?W=!0:z===__classPrivateFieldGet(this,_YargsInstance_versionOpt,"f")&&E[z]&&(K=!0)}),E.$0=this.$0,this.parsed=_,o===0&&__classPrivateFieldGet(this,_YargsInstance_usage,"f").clearCachedHelpMessage();try{if(this[kGuessLocale](),t)return this[kPostProcess](E,d,!!n,!1);__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")&&[__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")].concat(L[__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")]||[]).filter(ce=>ce.length>1).includes(""+E._[E._.length-1])&&(E._.pop(),W=!0),__classPrivateFieldSet(this,_YargsInstance_isGlobalContext,!1,"f");const z=__classPrivateFieldGet(this,_YargsInstance_command,"f").getCommands(),N=__classPrivateFieldGet(this,_YargsInstance_completion,"f").completionKey in E,Q=W||N||a;if(E._.length){if(z.length){let te;for(let ce=o||0,oe;E._[ce]!==void 0;ce++)if(oe=String(E._[ce]),z.includes(oe)&&oe!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")){const le=__classPrivateFieldGet(this,_YargsInstance_command,"f").runCommand(oe,this,_,ce+1,a,W||K||a);return this[kPostProcess](le,d,!!n,!1)}else if(!te&&oe!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")){te=oe;break}!__classPrivateFieldGet(this,_YargsInstance_command,"f").hasDefaultCommand()&&__classPrivateFieldGet(this,_YargsInstance_recommendCommands,"f")&&te&&!Q&&__classPrivateFieldGet(this,_YargsInstance_validation,"f").recommendCommands(te,z)}__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")&&E._.includes(__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f"))&&!N&&(__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),this.showCompletionScript(),this.exit(0))}if(__classPrivateFieldGet(this,_YargsInstance_command,"f").hasDefaultCommand()&&!Q){const te=__classPrivateFieldGet(this,_YargsInstance_command,"f").runCommand(null,this,_,0,a,W||K||a);return this[kPostProcess](te,d,!!n,!1)}if(N){__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),e=[].concat(e);const te=e.slice(e.indexOf(`--${__classPrivateFieldGet(this,_YargsInstance_completion,"f").completionKey}`)+1);return __classPrivateFieldGet(this,_YargsInstance_completion,"f").getCompletion(te,(ce,oe)=>{if(ce)throw new YError(ce.message);(oe||[]).forEach(le=>{__classPrivateFieldGet(this,_YargsInstance_logger,"f").log(le)}),this.exit(0)}),this[kPostProcess](E,!d,!!n,!1)}if(__classPrivateFieldGet(this,_YargsInstance_hasOutput,"f")||(W?(__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),l=!0,this.showHelp("log"),this.exit(0)):K&&(__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(E).some(te=>__classPrivateFieldGet(this,_YargsInstance_options,"f").skipValidation.indexOf(te)>=0&&E[te]===!0)),!l){if(_.error)throw new YError(_.error.message);if(!N){const te=this[kRunValidation](L,{},_.error);n||(y=applyMiddleware(E,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").getMiddleware(),!0)),y=this[kValidateAsync](te,y??E),isPromise(y)&&!n&&(y=y.then(()=>applyMiddleware(E,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").getMiddleware(),!1)))}}}catch(z){if(z instanceof YError)__classPrivateFieldGet(this,_YargsInstance_usage,"f").fail(z.message,z);else throw z}return this[kPostProcess](y??E,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((s=>s==="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 s=this[kRebase](__classPrivateFieldGet(this,_YargsInstance_cwd,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<n.length?s: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,s;(s=t[n])!==void 0;n++)__classPrivateFieldGet(this,_YargsInstance_shim,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(t[n]=Number(s));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 s=e||__classPrivateFieldGet(this,_YargsInstance_shim,"f").mainFilename;!e&&__classPrivateFieldGet(this,_YargsInstance_shim,"f").path.extname(s)&&(s=__classPrivateFieldGet(this,_YargsInstance_shim,"f").path.dirname(s));const o=__classPrivateFieldGet(this,_YargsInstance_shim,"f").findUp(s,(a,l)=>{if(l.includes("package.json"))return"package.json"});assertNotStrictEqual(o,void 0,__classPrivateFieldGet(this,_YargsInstance_shim,"f")),n=JSON.parse(__classPrivateFieldGet(this,_YargsInstance_shim,"f").readFileSync(o,"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,s){this[kPopulateParserHintDictionary](e,t,n,s,(o,a,l)=>{__classPrivateFieldGet(this,_YargsInstance_options,"f")[o][a]=l})}[kPopulateParserHintArrayDictionary](e,t,n,s){this[kPopulateParserHintDictionary](e,t,n,s,(o,a,l)=>{__classPrivateFieldGet(this,_YargsInstance_options,"f")[o][a]=(__classPrivateFieldGet(this,_YargsInstance_options,"f")[o][a]||[]).concat(l)})}[kPopulateParserHintDictionary](e,t,n,s,o){if(Array.isArray(n))n.forEach(a=>{e(a,s)});else if((a=>typeof a=="object")(n))for(const a of objectKeys(n))e(a,n[a]);else o(t,this[kSanitizeKey](n),s)}[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,s,o,a,l,d,B,w,E,_;const U=__classPrivateFieldGet(this,_YargsInstance_frozens,"f").pop();assertNotStrictEqual(U,void 0,__classPrivateFieldGet(this,_YargsInstance_shim,"f"));let H;e=this,t=this,n=this,s=this,o=this,a=this,l=this,d=this,B=this,w=this,E=this,_=this,{options:{set value(W){__classPrivateFieldSet(e,_YargsInstance_options,W,"f")}}.value,configObjects:H,exitProcess:{set value(W){__classPrivateFieldSet(t,_YargsInstance_exitProcess,W,"f")}}.value,groups:{set value(W){__classPrivateFieldSet(n,_YargsInstance_groups,W,"f")}}.value,output:{set value(W){__classPrivateFieldSet(s,_YargsInstance_output,W,"f")}}.value,exitError:{set value(W){__classPrivateFieldSet(o,_YargsInstance_exitError,W,"f")}}.value,hasOutput:{set value(W){__classPrivateFieldSet(a,_YargsInstance_hasOutput,W,"f")}}.value,parsed:this.parsed,strict:{set value(W){__classPrivateFieldSet(l,_YargsInstance_strict,W,"f")}}.value,strictCommands:{set value(W){__classPrivateFieldSet(d,_YargsInstance_strictCommands,W,"f")}}.value,strictOptions:{set value(W){__classPrivateFieldSet(B,_YargsInstance_strictOptions,W,"f")}}.value,completionCommand:{set value(W){__classPrivateFieldSet(w,_YargsInstance_completionCommand,W,"f")}}.value,parseFn:{set value(W){__classPrivateFieldSet(E,_YargsInstance_parseFn,W,"f")}}.value,parseContext:{set value(W){__classPrivateFieldSet(_,_YargsInstance_parseContext,W,"f")}}.value}=U,__classPrivateFieldGet(this,_YargsInstance_options,"f").configObjects=H,__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,s){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)),s&&(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(a=>{n[a]=!0,(e[a]||[]).forEach(l=>{n[l]=!0})}),Object.assign(__classPrivateFieldGet(this,_YargsInstance_preservedGroups,"f"),Object.keys(__classPrivateFieldGet(this,_YargsInstance_groups,"f")).reduce((a,l)=>{const d=__classPrivateFieldGet(this,_YargsInstance_groups,"f")[l].filter(B=>!(B in n));return d.length>0&&(a[l]=d),a},{})),__classPrivateFieldSet(this,_YargsInstance_groups,{},"f");const s=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],o=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return s.forEach(a=>{t[a]=(__classPrivateFieldGet(this,_YargsInstance_options,"f")[a]||[]).filter(l=>!n[l])}),o.forEach(a=>{t[a]=objFilter(__classPrivateFieldGet(this,_YargsInstance_options,"f")[a],l=>!n[l])}),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,s=0,o=!1){let a=!!n||o;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 l=!!__classPrivateFieldGet(this,_YargsInstance_options,"f").configuration["populate--"],d=Object.assign({},__classPrivateFieldGet(this,_YargsInstance_options,"f").configuration,{"populate--":!0}),B=__classPrivateFieldGet(this,_YargsInstance_shim,"f").Parser.detailed(e,Object.assign({},__classPrivateFieldGet(this,_YargsInstance_options,"f"),{configuration:{"parse-positional-numbers":!1,...d}})),w=Object.assign(B.argv,__classPrivateFieldGet(this,_YargsInstance_parseContext,"f"));let E;const _=B.aliases;let U=!1,H=!1;Object.keys(w).forEach(W=>{W===__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")&&w[W]?U=!0:W===__classPrivateFieldGet(this,_YargsInstance_versionOpt,"f")&&w[W]&&(H=!0)}),w.$0=this.$0,this.parsed=B,s===0&&__classPrivateFieldGet(this,_YargsInstance_usage,"f").clearCachedHelpMessage();try{if(this[kGuessLocale](),t)return this[kPostProcess](w,l,!!n,!1);__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")&&[__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")].concat(_[__classPrivateFieldGet(this,_YargsInstance_helpOpt,"f")]||[]).filter(ae=>ae.length>1).includes(""+w._[w._.length-1])&&(w._.pop(),U=!0),__classPrivateFieldSet(this,_YargsInstance_isGlobalContext,!1,"f");const W=__classPrivateFieldGet(this,_YargsInstance_command,"f").getCommands(),L=__classPrivateFieldGet(this,_YargsInstance_completion,"f").completionKey in w,K=U||L||o;if(w._.length){if(W.length){let ee;for(let ae=s||0,se;w._[ae]!==void 0;ae++)if(se=String(w._[ae]),W.includes(se)&&se!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")){const ce=__classPrivateFieldGet(this,_YargsInstance_command,"f").runCommand(se,this,B,ae+1,o,U||H||o);return this[kPostProcess](ce,l,!!n,!1)}else if(!ee&&se!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")){ee=se;break}!__classPrivateFieldGet(this,_YargsInstance_command,"f").hasDefaultCommand()&&__classPrivateFieldGet(this,_YargsInstance_recommendCommands,"f")&&ee&&!K&&__classPrivateFieldGet(this,_YargsInstance_validation,"f").recommendCommands(ee,W)}__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f")&&w._.includes(__classPrivateFieldGet(this,_YargsInstance_completionCommand,"f"))&&!L&&(__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),this.showCompletionScript(),this.exit(0))}if(__classPrivateFieldGet(this,_YargsInstance_command,"f").hasDefaultCommand()&&!K){const ee=__classPrivateFieldGet(this,_YargsInstance_command,"f").runCommand(null,this,B,0,o,U||H||o);return this[kPostProcess](ee,l,!!n,!1)}if(L){__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),e=[].concat(e);const ee=e.slice(e.indexOf(`--${__classPrivateFieldGet(this,_YargsInstance_completion,"f").completionKey}`)+1);return __classPrivateFieldGet(this,_YargsInstance_completion,"f").getCompletion(ee,(ae,se)=>{if(ae)throw new YError(ae.message);(se||[]).forEach(ce=>{__classPrivateFieldGet(this,_YargsInstance_logger,"f").log(ce)}),this.exit(0)}),this[kPostProcess](w,!l,!!n,!1)}if(__classPrivateFieldGet(this,_YargsInstance_hasOutput,"f")||(U?(__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),a=!0,this.showHelp("log"),this.exit(0)):H&&(__classPrivateFieldGet(this,_YargsInstance_exitProcess,"f")&&setBlocking(!0),a=!0,__classPrivateFieldGet(this,_YargsInstance_usage,"f").showVersion("log"),this.exit(0))),!a&&__classPrivateFieldGet(this,_YargsInstance_options,"f").skipValidation.length>0&&(a=Object.keys(w).some(ee=>__classPrivateFieldGet(this,_YargsInstance_options,"f").skipValidation.indexOf(ee)>=0&&w[ee]===!0)),!a){if(B.error)throw new YError(B.error.message);if(!L){const ee=this[kRunValidation](_,{},B.error);n||(E=applyMiddleware(w,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").getMiddleware(),!0)),E=this[kValidateAsync](ee,E??w),isPromise(E)&&!n&&(E=E.then(()=>applyMiddleware(w,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,"f").getMiddleware(),!1)))}}}catch(W){if(W instanceof YError)__classPrivateFieldGet(this,_YargsInstance_usage,"f").fail(W.message,W);else throw W}return this[kPostProcess](E??w,l,!!n,!0)}[kRunValidation](e,t,n,s){const o={...this.getDemandedOptions()};return a=>{if(n)throw new YError(n.message);__classPrivateFieldGet(this,_YargsInstance_validation,"f").nonOptionCount(a),__classPrivateFieldGet(this,_YargsInstance_validation,"f").requiredArguments(a,o);let l=!1;__classPrivateFieldGet(this,_YargsInstance_strictCommands,"f")&&(l=__classPrivateFieldGet(this,_YargsInstance_validation,"f").unknownCommands(a)),__classPrivateFieldGet(this,_YargsInstance_strict,"f")&&!l?__classPrivateFieldGet(this,_YargsInstance_validation,"f").unknownArguments(a,e,t,!!s):__classPrivateFieldGet(this,_YargsInstance_strictOptions,"f")&&__classPrivateFieldGet(this,_YargsInstance_validation,"f").unknownArguments(a,e,{},!1,!1),__classPrivateFieldGet(this,_YargsInstance_validation,"f").limitedChoices(a),__classPrivateFieldGet(this,_YargsInstance_validation,"f").implications(a),__classPrivateFieldGet(this,_YargsInstance_validation,"f").conflicting(a)}}[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(i){return!!i&&typeof i.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=i=>i instanceof URL?node_url.fileURLToPath(i):i;function findUpSync(i,{cwd:e=process__default.cwd(),type:t="file",stopAt:n}={}){let s=path__default.resolve(toPath(e)??"");const{root:o}=path__default.parse(s);for(n=path__default.resolve(s,toPath(n)??o);s&&s!==n&&s!==o;){const a=path__default.isAbsolute(i)?i:path__default.join(s,i);try{const l=fs__default.statSync(a,{throwIfNoEntry:!1});if(t==="file"&&l?.isFile()||t==="directory"&&l?.isDirectory())return a}catch{}s=path__default.dirname(s)}}function packageUpSync({cwd:i=process__default.cwd()}={}){return findUpSync("package.json",{cwd:i})}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
 
@@ -74,28 +74,28 @@ ${K.join(`
74
74
  `.trimStart(),u=`
75
75
 
76
76
  /* prettier-ignore-end */
77
- `,JsBanners={banner:k,footer:u};function findPkgRoot(){const s=packageUpSync({cwd:r});if(!s)throw new Error("likec4 package folder not found");return path$1.dirname(s)}function viteAppRoot(){const s=findPkgRoot(),e=[path$1.resolve(s,"__app__"),path$1.resolve(r,"../__app__"),path$1.resolve(r,"../../__app__"),path$1.resolve(r,"../../dist/__app__")],t=LikeC4.f(e,fs.existsSync);if(!t)throw LikeC4.Y.error(`likec4 app root does not exist, tried:
77
+ `,JsBanners={banner:k,footer:u};function findPkgRoot(){const i=packageUpSync({cwd:r});if(!i)throw new Error("likec4 package folder not found");return path$1.dirname(i)}function viteAppRoot(){const i=findPkgRoot(),e=[path$1.resolve(i,"__app__"),path$1.resolve(r,"../__app__"),path$1.resolve(r,"../../__app__"),path$1.resolve(r,"../../dist/__app__")],t=LikeC4.f(e,fs.existsSync);if(!t)throw LikeC4.H.error(`likec4 app root does not exist, tried:
78
78
  ${e.join(`
79
- `)}`),new Error("likec4 app root does not exist");return t}async function mkTempPublicDir(){const s=await fsPromises.mkdtemp(path$1.join(os.tmpdir(),".likec4-public-"));return await fsPromises.writeFile(path$1.join(s,"likec4-views.js"),`// generated by likec4
80
- `),s}const chunkSizeWarningLimit=1e4;function viteAliases(){const s=findPkgRoot();return{"likec4/icons":path$1.resolve(s,"icons"),"likec4/react":path$1.resolve(s,"react"),"likec4/model":path$1.resolve(s,"dist/model")}}function getSourceRegion(s){var e,t;if(s){if("astNode"in s)return getSourceRegionOfAstNode(s);if(Array.isArray(s))return s.reduce(mergeDocumentSegment,void 0);{const n=s,o=isCstNode(n)?getDocumentURIOrUndefined((t=(e=n?.root)===null||e===void 0?void 0:e.astNode)!==null&&t!==void 0?t:n?.astNode):void 0;return copyDocumentSegment(n,o)}}else return}function isCstNode(s){return typeof s<"u"&&"element"in s&&"text"in s}function getDocumentURIOrUndefined(s){try{return LikeC4.g(s).uri.toString()}catch{return}}function getSourceRegionOfAstNode(s){var e,t;const{astNode:n,property:o,index:a}=s??{},l=(e=n?.$cstNode)!==null&&e!==void 0?e:n?.$textRegion;if(!(n===void 0||l===void 0)){if(o===void 0)return copyDocumentSegment(l,getDocumentURI(n));{const d=w=>a!==void 0&&a>-1&&Array.isArray(n[o])?a<w.length?w[a]:void 0:w.reduce(mergeDocumentSegment,void 0);if(!((t=l.assignments)===null||t===void 0)&&t[o]){const w=d(l.assignments[o]);return w&&copyDocumentSegment(w,getDocumentURI(n))}else if(n.$cstNode){const w=d(LikeC4.a(n.$cstNode,o));return w&&copyDocumentSegment(w,getDocumentURI(n))}else return}}}function getDocumentURI(s){var e,t,n,o;return s.$cstNode?(t=(e=LikeC4.g(s))===null||e===void 0?void 0:e.uri)===null||t===void 0?void 0:t.toString():s.$textRegion?s.$textRegion.documentURI||((o=(n=new LikeC4.T(s,a=>a.$container?[a.$container]:[]).find(a=>{var l;return(l=a.$textRegion)===null||l===void 0?void 0:l.documentURI}))===null||n===void 0?void 0:n.$textRegion)===null||o===void 0?void 0:o.documentURI):void 0}function copyDocumentSegment(s,e){var t,n;const o={offset:s.offset,end:(t=s.end)!==null&&t!==void 0?t:s.offset+s.length,length:(n=s.length)!==null&&n!==void 0?n:s.end-s.offset};return s.range&&(o.range=s.range),e??(e=s.fileURI),e&&(o.fileURI=e),o}function mergeDocumentSegment(s,e){var t,n;if(s){if(!e)return s&&copyDocumentSegment(s)}else return e&&copyDocumentSegment(e);const o=(t=s.end)!==null&&t!==void 0?t:s.offset+s.length,a=(n=e.end)!==null&&n!==void 0?n:e.offset+e.length,l=Math.min(s.offset,e.offset),d=Math.max(o,a),w=d-l,_={offset:l,end:d,length:w};if(s.range&&e.range&&(_.range={start:e.range.start.line<s.range.start.line||e.range.start.line===s.range.start.line&&e.range.start.character<s.range.start.character?e.range.start:s.range.start,end:e.range.end.line>s.range.end.line||e.range.end.line===s.range.end.line&&e.range.end.character>s.range.end.character?e.range.end:s.range.end}),s.fileURI||e.fileURI){const E=s.fileURI,y=e.fileURI,L=E&&y&&E!==y?`<unmergable text regions of ${E}, ${y}>`:E??y;_.fileURI=L}return _}class Context{constructor(e){this.defaultIndentation=" ",this.pendingIndent=!0,this.currentIndents=[],this.recentNonImmediateIndents=[],this.traceData=[],this.lines=[[]],this.length=0,typeof e=="string"?this.defaultIndentation=e:typeof e=="number"&&(this.defaultIndentation="".padStart(e))}get content(){return this.lines.map(e=>e.join("")).join("")}get contentLength(){return this.length}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join("")}get currentPosition(){return{offset:this.contentLength,line:this.currentLineNumber,character:this.currentLineContent.length}}append(e,t){if(e.length>0){const n=t&&this.currentPosition;this.lines[this.currentLineNumber].push(e),this.length+=e.length,n&&this.indentPendingTraceRegions(n)}}indentPendingTraceRegions(e){for(let t=this.traceData.length-1;t>=0;t--){const n=this.traceData[t];n.targetStart&&n.targetStart.offset===e.offset&&(n.targetStart=this.currentPosition)}}increaseIndent(e){this.currentIndents.push(e),e.indentImmediately||this.recentNonImmediateIndents.push(e)}decreaseIndent(){this.currentIndents.pop()}get relevantIndents(){return this.currentIndents.filter(e=>!this.recentNonImmediateIndents.includes(e))}resetCurrentLine(){this.length-=this.lines[this.currentLineNumber].join("").length,this.lines[this.currentLineNumber]=[],this.pendingIndent=!0}addNewLine(){this.pendingIndent=!0,this.lines.push([]),this.recentNonImmediateIndents.length=0}pushTraceRegion(e){const t=createTraceRegion(e,this.currentPosition,n=>{var o,a;return(a=(o=this.traceData[this.traceData.length-1])===null||o===void 0?void 0:o.children)===null||a===void 0?void 0:a.push(n)});return this.traceData.push(t),t}popTraceRegion(e){const t=this.traceData.pop();return this.assertTrue(t===e,"Trace region mismatch!"),t}getParentTraceSourceFileURI(){var e;for(let t=this.traceData.length-1;t>-1;t--){const n=(e=this.traceData[t].sourceRegion)===null||e===void 0?void 0:e.fileURI;if(n)return n}}assertTrue(e,t){if(!e)throw new Error(t)}}function createTraceRegion(s,e,t){const n={sourceRegion:s,targetRegion:void 0,children:[],targetStart:e,complete:o=>{var a,l;return n.targetRegion={offset:n.targetStart.offset,end:o.offset,length:o.offset-n.targetStart.offset,range:{start:{line:n.targetStart.line,character:n.targetStart.character},end:{line:o.line,character:o.character}}},delete n.targetStart,((a=n.children)===null||a===void 0?void 0:a.length)===0&&delete n.children,!((l=n.targetRegion)===null||l===void 0)&&l.length&&t(n),delete n.complete,n}};return n}function processGeneratorNode(s,e){const t=new Context(e),n=t.pushTraceRegion(void 0);processNodeInternal(s,t),t.popTraceRegion(n),n.complete&&n.complete(t.currentPosition);const o=n.children&&n.children.length===1?n.children[0]:void 0,a=o?.targetRegion,l=n.targetRegion;return a&&o.sourceRegion&&a.offset===l.offset&&a.length===l.length?{text:t.content,trace:o}:{text:t.content,trace:n}}function processNodeInternal(s,e){typeof s=="string"?processStringNode(s,e):s instanceof IndentNode?processIndentNode(s,e):s instanceof CompositeGeneratorNode?processCompositeNode(s,e):s instanceof NewLineNode&&processNewLineNode(s,e)}function hasContent(s,e){return typeof s=="string"?s.length!==0:s instanceof CompositeGeneratorNode?s.contents.some(t=>hasContent(t,e)):s instanceof NewLineNode?!(s.ifNotEmpty&&e.currentLineContent.length===0):!1}function processStringNode(s,e){s&&(e.pendingIndent&&handlePendingIndent(e,!1),e.append(s))}function handlePendingIndent(s,e){var t;let n="";for(const o of s.relevantIndents.filter(a=>a.indentEmptyLines||!e))n+=(t=o.indentation)!==null&&t!==void 0?t:s.defaultIndentation;s.append(n,!0),s.pendingIndent=!1}function processCompositeNode(s,e){let t;const n=getSourceRegion(s.tracedSource);n&&(t=e.pushTraceRegion(n));for(const o of s.contents)processNodeInternal(o,e);if(t){e.popTraceRegion(t);const o=e.getParentTraceSourceFileURI();o&&n?.fileURI===o&&delete n.fileURI,t.complete&&t.complete(e.currentPosition)}}function processIndentNode(s,e){var t;if(hasContent(s,e)){s.indentImmediately&&!e.pendingIndent&&e.append((t=s.indentation)!==null&&t!==void 0?t:e.defaultIndentation,!0);try{e.increaseIndent(s),processCompositeNode(s,e)}finally{e.decreaseIndent()}}}function processNewLineNode(s,e){s.ifNotEmpty&&!hasNonWhitespace(e.currentLineContent)?e.resetCurrentLine():(e.pendingIndent&&handlePendingIndent(e,!0),e.append(s.lineDelimiter),e.addNewLine())}function hasNonWhitespace(s){return s.trimStart()!==""}Object.freeze("__\xABSKIP^NEW^LINE^IF^EMPTY\xBB__");const nonWhitespace=/\S|$/;function findIndentation(s){const e=s.filter(n=>n.length>0).map(n=>n.search(nonWhitespace)),t=e.length===0?0:Math.min(...e);return Math.max(0,t)}function expandToNode(s,...e){const t=findIndentationAndTemplateStructure(s),n=splitTemplateLinesAndMergeWithSubstitutions(s,e,t);return composeFinalGeneratorNode(n)}function expandTracedToNode(s,e,t){return(n,...o)=>traceToNode(s,e,t)(expandToNode(n,...o))}function findIndentationAndTemplateStructure(s){const e=s.join("_").split(LikeC4.N),t=e.length>1&&e[0].trim().length===0,n=t&&e.length>1&&e[e.length-1].trim().length===0;if(e.length===1||e.length!==0&&e[0].trim().length!==0||e.length===2&&e[1].trim().length===0)return{indentation:0,omitFirstLine:t,omitLastLine:n,trimLastLine:e.length!==1&&e[e.length-1].trim().length===0};{let o=t?e.slice(1):e;o=n?o.slice(0,o.length-1):o,o=o.filter(l=>l.length!==0);const a=findIndentation(o);return{indentation:a,omitFirstLine:t,omitLastLine:n&&(e[e.length-1].length<a||!e[e.length-1].startsWith(o[0].substring(0,a)))}}}function splitTemplateLinesAndMergeWithSubstitutions(s,e,{indentation:t,omitFirstLine:n,omitLastLine:o,trimLastLine:a}){const l=[];s.forEach((_,E)=>{l.push(..._.split(LikeC4.N).map((y,L)=>L===0||y.length<t?y:y.substring(t)).reduce(E===0?(y,L,W)=>W===0?n?[]:[L]:W===1&&y.length===0?[L]:y.concat(NEWLINE,L):(y,L,W)=>W===0?[L]:y.concat(NEWLINE,L),[]).filter(y=>!(typeof y=="string"&&y.length===0)).concat(isGeneratorNode(e[E])?e[E]:e[E]!==void 0?{content:String(e[E])}:E<e.length?UNDEFINED_SEGMENT:[]))});const d=l.length,w=d!==0?l[d-1]:void 0;return(o||a)&&typeof w=="string"&&w.trim().length===0?n&&d!==1&&l[d-2]===NEWLINE?l.slice(0,d-2):l.slice(0,d-1):l}const NEWLINE={isNewLine:!0},UNDEFINED_SEGMENT={isUndefinedSegment:!0},isNewLineMarker=s=>s===NEWLINE,isUndefinedSegmentMarker=s=>s===UNDEFINED_SEGMENT,isSubstitutionWrapper=s=>s.content!==void 0;function composeFinalGeneratorNode(s){return s.reduce((t,n,o)=>isUndefinedSegmentMarker(n)?t:isNewLineMarker(n)?{node:o!==0&&(isUndefinedSegmentMarker(s[o-1])||isGeneratorNode(s[o-1]))||o>1&&typeof s[o-1]=="string"&&(isUndefinedSegmentMarker(s[o-2])||isGeneratorNode(s[o-2]))?t.node.appendNewLineIfNotEmpty():t.node.appendNewLine()}:(()=>{var a;const l=(o===0||isNewLineMarker(s[o-1]))&&typeof n=="string"&&n.length!==0?"".padStart(n.length-n.trimStart().length):"",d=isSubstitutionWrapper(n)?n.content:n;let w;return{node:t.indented?t.node:l.length!==0?t.node.indent({indentation:l,indentImmediately:!1,indentedChildren:_=>w=_.append(d)}):t.node.append(d),indented:w??((a=t.indented)===null||a===void 0?void 0:a.append(d))}})(),{node:new CompositeGeneratorNode}).node}const EOL=typeof process>"u"?`
79
+ `)}`),new Error("likec4 app root does not exist");return t}async function mkTempPublicDir(){const i=await fsPromises.mkdtemp(path$1.join(os.tmpdir(),".likec4-public-"));return await fsPromises.writeFile(path$1.join(i,"likec4-views.js"),`// generated by likec4
80
+ `),i}const chunkSizeWarningLimit=1e4;function viteAliases(){const i=findPkgRoot();return{"likec4/icons":path$1.resolve(i,"icons"),"likec4/react":path$1.resolve(i,"react"),"likec4/model":path$1.resolve(i,"dist/model")}}function getSourceRegion(i){var e,t;if(i){if("astNode"in i)return getSourceRegionOfAstNode(i);if(Array.isArray(i))return i.reduce(mergeDocumentSegment,void 0);{const n=i,s=isCstNode(n)?getDocumentURIOrUndefined((t=(e=n?.root)===null||e===void 0?void 0:e.astNode)!==null&&t!==void 0?t:n?.astNode):void 0;return copyDocumentSegment(n,s)}}else return}function isCstNode(i){return typeof i<"u"&&"element"in i&&"text"in i}function getDocumentURIOrUndefined(i){try{return LikeC4.g(i).uri.toString()}catch{return}}function getSourceRegionOfAstNode(i){var e,t;const{astNode:n,property:s,index:o}=i??{},a=(e=n?.$cstNode)!==null&&e!==void 0?e:n?.$textRegion;if(!(n===void 0||a===void 0)){if(s===void 0)return copyDocumentSegment(a,getDocumentURI(n));{const l=d=>o!==void 0&&o>-1&&Array.isArray(n[s])?o<d.length?d[o]:void 0:d.reduce(mergeDocumentSegment,void 0);if(!((t=a.assignments)===null||t===void 0)&&t[s]){const d=l(a.assignments[s]);return d&&copyDocumentSegment(d,getDocumentURI(n))}else if(n.$cstNode){const d=l(LikeC4.a(n.$cstNode,s));return d&&copyDocumentSegment(d,getDocumentURI(n))}else return}}}function getDocumentURI(i){var e,t,n,s;return i.$cstNode?(t=(e=LikeC4.g(i))===null||e===void 0?void 0:e.uri)===null||t===void 0?void 0:t.toString():i.$textRegion?i.$textRegion.documentURI||((s=(n=new LikeC4.T(i,o=>o.$container?[o.$container]:[]).find(o=>{var a;return(a=o.$textRegion)===null||a===void 0?void 0:a.documentURI}))===null||n===void 0?void 0:n.$textRegion)===null||s===void 0?void 0:s.documentURI):void 0}function copyDocumentSegment(i,e){var t,n;const s={offset:i.offset,end:(t=i.end)!==null&&t!==void 0?t:i.offset+i.length,length:(n=i.length)!==null&&n!==void 0?n:i.end-i.offset};return i.range&&(s.range=i.range),e??(e=i.fileURI),e&&(s.fileURI=e),s}function mergeDocumentSegment(i,e){var t,n;if(i){if(!e)return i&&copyDocumentSegment(i)}else return e&&copyDocumentSegment(e);const s=(t=i.end)!==null&&t!==void 0?t:i.offset+i.length,o=(n=e.end)!==null&&n!==void 0?n:e.offset+e.length,a=Math.min(i.offset,e.offset),l=Math.max(s,o),d=l-a,B={offset:a,end:l,length:d};if(i.range&&e.range&&(B.range={start:e.range.start.line<i.range.start.line||e.range.start.line===i.range.start.line&&e.range.start.character<i.range.start.character?e.range.start:i.range.start,end:e.range.end.line>i.range.end.line||e.range.end.line===i.range.end.line&&e.range.end.character>i.range.end.character?e.range.end:i.range.end}),i.fileURI||e.fileURI){const w=i.fileURI,E=e.fileURI,_=w&&E&&w!==E?`<unmergable text regions of ${w}, ${E}>`:w??E;B.fileURI=_}return B}class Context{constructor(e){this.defaultIndentation=" ",this.pendingIndent=!0,this.currentIndents=[],this.recentNonImmediateIndents=[],this.traceData=[],this.lines=[[]],this.length=0,typeof e=="string"?this.defaultIndentation=e:typeof e=="number"&&(this.defaultIndentation="".padStart(e))}get content(){return this.lines.map(e=>e.join("")).join("")}get contentLength(){return this.length}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join("")}get currentPosition(){return{offset:this.contentLength,line:this.currentLineNumber,character:this.currentLineContent.length}}append(e,t){if(e.length>0){const n=t&&this.currentPosition;this.lines[this.currentLineNumber].push(e),this.length+=e.length,n&&this.indentPendingTraceRegions(n)}}indentPendingTraceRegions(e){for(let t=this.traceData.length-1;t>=0;t--){const n=this.traceData[t];n.targetStart&&n.targetStart.offset===e.offset&&(n.targetStart=this.currentPosition)}}increaseIndent(e){this.currentIndents.push(e),e.indentImmediately||this.recentNonImmediateIndents.push(e)}decreaseIndent(){this.currentIndents.pop()}get relevantIndents(){return this.currentIndents.filter(e=>!this.recentNonImmediateIndents.includes(e))}resetCurrentLine(){this.length-=this.lines[this.currentLineNumber].join("").length,this.lines[this.currentLineNumber]=[],this.pendingIndent=!0}addNewLine(){this.pendingIndent=!0,this.lines.push([]),this.recentNonImmediateIndents.length=0}pushTraceRegion(e){const t=createTraceRegion(e,this.currentPosition,n=>{var s,o;return(o=(s=this.traceData[this.traceData.length-1])===null||s===void 0?void 0:s.children)===null||o===void 0?void 0:o.push(n)});return this.traceData.push(t),t}popTraceRegion(e){const t=this.traceData.pop();return this.assertTrue(t===e,"Trace region mismatch!"),t}getParentTraceSourceFileURI(){var e;for(let t=this.traceData.length-1;t>-1;t--){const n=(e=this.traceData[t].sourceRegion)===null||e===void 0?void 0:e.fileURI;if(n)return n}}assertTrue(e,t){if(!e)throw new Error(t)}}function createTraceRegion(i,e,t){const n={sourceRegion:i,targetRegion:void 0,children:[],targetStart:e,complete:s=>{var o,a;return n.targetRegion={offset:n.targetStart.offset,end:s.offset,length:s.offset-n.targetStart.offset,range:{start:{line:n.targetStart.line,character:n.targetStart.character},end:{line:s.line,character:s.character}}},delete n.targetStart,((o=n.children)===null||o===void 0?void 0:o.length)===0&&delete n.children,!((a=n.targetRegion)===null||a===void 0)&&a.length&&t(n),delete n.complete,n}};return n}function processGeneratorNode(i,e){const t=new Context(e),n=t.pushTraceRegion(void 0);processNodeInternal(i,t),t.popTraceRegion(n),n.complete&&n.complete(t.currentPosition);const s=n.children&&n.children.length===1?n.children[0]:void 0,o=s?.targetRegion,a=n.targetRegion;return o&&s.sourceRegion&&o.offset===a.offset&&o.length===a.length?{text:t.content,trace:s}:{text:t.content,trace:n}}function processNodeInternal(i,e){typeof i=="string"?processStringNode(i,e):i instanceof IndentNode?processIndentNode(i,e):i instanceof CompositeGeneratorNode?processCompositeNode(i,e):i instanceof NewLineNode&&processNewLineNode(i,e)}function hasContent(i,e){return typeof i=="string"?i.length!==0:i instanceof CompositeGeneratorNode?i.contents.some(t=>hasContent(t,e)):i instanceof NewLineNode?!(i.ifNotEmpty&&e.currentLineContent.length===0):!1}function processStringNode(i,e){i&&(e.pendingIndent&&handlePendingIndent(e,!1),e.append(i))}function handlePendingIndent(i,e){var t;let n="";for(const s of i.relevantIndents.filter(o=>o.indentEmptyLines||!e))n+=(t=s.indentation)!==null&&t!==void 0?t:i.defaultIndentation;i.append(n,!0),i.pendingIndent=!1}function processCompositeNode(i,e){let t;const n=getSourceRegion(i.tracedSource);n&&(t=e.pushTraceRegion(n));for(const s of i.contents)processNodeInternal(s,e);if(t){e.popTraceRegion(t);const s=e.getParentTraceSourceFileURI();s&&n?.fileURI===s&&delete n.fileURI,t.complete&&t.complete(e.currentPosition)}}function processIndentNode(i,e){var t;if(hasContent(i,e)){i.indentImmediately&&!e.pendingIndent&&e.append((t=i.indentation)!==null&&t!==void 0?t:e.defaultIndentation,!0);try{e.increaseIndent(i),processCompositeNode(i,e)}finally{e.decreaseIndent()}}}function processNewLineNode(i,e){i.ifNotEmpty&&!hasNonWhitespace(e.currentLineContent)?e.resetCurrentLine():(e.pendingIndent&&handlePendingIndent(e,!0),e.append(i.lineDelimiter),e.addNewLine())}function hasNonWhitespace(i){return i.trimStart()!==""}Object.freeze("__\xABSKIP^NEW^LINE^IF^EMPTY\xBB__");const nonWhitespace=/\S|$/;function findIndentation(i){const e=i.filter(n=>n.length>0).map(n=>n.search(nonWhitespace)),t=e.length===0?0:Math.min(...e);return Math.max(0,t)}function expandToNode(i,...e){const t=findIndentationAndTemplateStructure(i),n=splitTemplateLinesAndMergeWithSubstitutions(i,e,t);return composeFinalGeneratorNode(n)}function expandTracedToNode(i,e,t){return(n,...s)=>traceToNode(i,e,t)(expandToNode(n,...s))}function findIndentationAndTemplateStructure(i){const e=i.join("_").split(LikeC4.N),t=e.length>1&&e[0].trim().length===0,n=t&&e.length>1&&e[e.length-1].trim().length===0;if(e.length===1||e.length!==0&&e[0].trim().length!==0||e.length===2&&e[1].trim().length===0)return{indentation:0,omitFirstLine:t,omitLastLine:n,trimLastLine:e.length!==1&&e[e.length-1].trim().length===0};{let s=t?e.slice(1):e;s=n?s.slice(0,s.length-1):s,s=s.filter(a=>a.length!==0);const o=findIndentation(s);return{indentation:o,omitFirstLine:t,omitLastLine:n&&(e[e.length-1].length<o||!e[e.length-1].startsWith(s[0].substring(0,o)))}}}function splitTemplateLinesAndMergeWithSubstitutions(i,e,{indentation:t,omitFirstLine:n,omitLastLine:s,trimLastLine:o}){const a=[];i.forEach((B,w)=>{a.push(...B.split(LikeC4.N).map((E,_)=>_===0||E.length<t?E:E.substring(t)).reduce(w===0?(E,_,U)=>U===0?n?[]:[_]:U===1&&E.length===0?[_]:E.concat(NEWLINE,_):(E,_,U)=>U===0?[_]:E.concat(NEWLINE,_),[]).filter(E=>!(typeof E=="string"&&E.length===0)).concat(isGeneratorNode(e[w])?e[w]:e[w]!==void 0?{content:String(e[w])}:w<e.length?UNDEFINED_SEGMENT:[]))});const l=a.length,d=l!==0?a[l-1]:void 0;return(s||o)&&typeof d=="string"&&d.trim().length===0?n&&l!==1&&a[l-2]===NEWLINE?a.slice(0,l-2):a.slice(0,l-1):a}const NEWLINE={isNewLine:!0},UNDEFINED_SEGMENT={isUndefinedSegment:!0},isNewLineMarker=i=>i===NEWLINE,isUndefinedSegmentMarker=i=>i===UNDEFINED_SEGMENT,isSubstitutionWrapper=i=>i.content!==void 0;function composeFinalGeneratorNode(i){return i.reduce((t,n,s)=>isUndefinedSegmentMarker(n)?t:isNewLineMarker(n)?{node:s!==0&&(isUndefinedSegmentMarker(i[s-1])||isGeneratorNode(i[s-1]))||s>1&&typeof i[s-1]=="string"&&(isUndefinedSegmentMarker(i[s-2])||isGeneratorNode(i[s-2]))?t.node.appendNewLineIfNotEmpty():t.node.appendNewLine()}:(()=>{var o;const a=(s===0||isNewLineMarker(i[s-1]))&&typeof n=="string"&&n.length!==0?"".padStart(n.length-n.trimStart().length):"",l=isSubstitutionWrapper(n)?n.content:n;let d;return{node:t.indented?t.node:a.length!==0?t.node.indent({indentation:a,indentImmediately:!1,indentedChildren:B=>d=B.append(l)}):t.node.append(l),indented:d??((o=t.indented)===null||o===void 0?void 0:o.append(l))}})(),{node:new CompositeGeneratorNode}).node}const EOL=typeof process>"u"?`
81
81
  `:process.platform==="win32"?`\r
82
82
  `:`
83
- `;function isGeneratorNode(s){return s instanceof CompositeGeneratorNode||s instanceof IndentNode||s instanceof NewLineNode}function toString(s,e){return isGeneratorNode(s)?processGeneratorNode(s,e).text:String(s)}class CompositeGeneratorNode{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,t,n){if(LikeC4.i(e)){if(this.tracedSource={astNode:e,property:t,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw new Error("Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.")}else this.tracedSource=e;return this}append(...e){for(const t of e)typeof t=="function"?t(this):t&&this.contents.push(t);return this}appendIf(e,...t){return e?this.append(...t):this}appendNewLine(){return this.append(NL)}appendNewLineIf(e){return e?this.append(NL):this}appendNewLineIfNotEmpty(){return this.append(NLEmpty)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...t){return this.append(expandToNode(e,...t))}appendTemplateIf(e){return e?(t,...n)=>this.appendTemplate(t,...n):()=>this}indent(e){const{indentedChildren:t,indentation:n,indentEmptyLines:o,indentImmediately:a}=Array.isArray(e)||typeof e=="function"?{indentedChildren:e}:typeof e=="object"?e:{},l=new IndentNode(n,a,o);return this.contents.push(l),Array.isArray(t)?l.append(...t):t&&l.append(t),this}appendTraced(e,t,n){return o=>this.append(new CompositeGeneratorNode().trace(e,t,n).append(o))}appendTracedIf(e,t,n,o){return e?this.appendTraced(typeof t=="function"?t():t,n,o):()=>this}appendTracedTemplate(e,t,n){return(o,...a)=>this.append(expandTracedToNode(e,t,n)(o,...a))}appendTracedTemplateIf(e,t,n,o){return e?this.appendTracedTemplate(typeof t=="function"?t():t,n,o):()=>this}}function traceToNode(s,e,t){return n=>n instanceof CompositeGeneratorNode&&n.tracedSource===void 0?n.trace(s,e,t):new CompositeGeneratorNode().trace(s,e,t).append(n)}class IndentNode extends CompositeGeneratorNode{constructor(e,t=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e=="string"?this.indentation=e:typeof e=="number"&&(this.indentation="".padStart(e)),this.indentImmediately=t,this.indentEmptyLines=n}}class NewLineNode{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??EOL,this.ifNotEmpty=t}}const NL=new NewLineNode,NLEmpty=new NewLineNode(void 0,!0),defaultToGenerated=s=>s===void 0||typeof s=="string"||isGeneratorNode(s)?s:String(s);function joinToNode(s,e=defaultToGenerated,t={}){const n=typeof e=="function"?e:defaultToGenerated,{filter:o,prefix:a,suffix:l,separator:d,appendNewLineIfNotEmpty:w,skipNewLineAfterLastItem:_}=typeof e=="object"?e:t,E=typeof a=="function"?a:()=>a,y=typeof l=="function"?l:()=>l;return reduceWithIsLast(s,(L,W,K,z)=>{if(o&&!o(W,K,z))return L;const N=n(W,K,z);return N===void 0?L:(L??(L=new CompositeGeneratorNode)).append(E(W,K,z)).append(N).append(y(W,K,z)).appendIf(!z,d).appendNewLineIfNotEmptyIf(!L.isEmpty()&&!!w&&(!z||!_))})}function reduceWithIsLast(s,e,t){const n=s[Symbol.iterator]();let o=n.next(),a=0,l=t;for(;!o.done;){const d=n.next();l=e(l,o.value,a,!!d.done),o=d,a++}return l}var Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,unicode={Space_Separator,ID_Start,ID_Continue},util={isSpaceSeparator(s){return typeof s=="string"&&unicode.Space_Separator.test(s)},isIdStartChar(s){return typeof s=="string"&&(s>="a"&&s<="z"||s>="A"&&s<="Z"||s==="$"||s==="_"||unicode.ID_Start.test(s))},isIdContinueChar(s){return typeof s=="string"&&(s>="a"&&s<="z"||s>="A"&&s<="Z"||s>="0"&&s<="9"||s==="$"||s==="_"||s==="\u200C"||s==="\u200D"||unicode.ID_Continue.test(s))},isDigit(s){return typeof s=="string"&&/[0-9]/.test(s)},isHexDigit(s){return typeof s=="string"&&/[0-9A-Fa-f]/.test(s)}};let source,parseState,stack,pos,line,column,token,key,root;var parse=function(e,t){source=String(e),parseState="start",stack=[],pos=0,line=1,column=0,token=void 0,key=void 0,root=void 0;do token=lex(),parseStates[parseState]();while(token.type!=="eof");return typeof t=="function"?internalize({"":root},"",t):root};function internalize(s,e,t){const n=s[e];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let o=0;o<n.length;o++){const a=String(o),l=internalize(n,a,t);l===void 0?delete n[a]:Object.defineProperty(n,a,{value:l,writable:!0,enumerable:!0,configurable:!0})}else for(const o in n){const a=internalize(n,o,t);a===void 0?delete n[o]:Object.defineProperty(n,o,{value:a,writable:!0,enumerable:!0,configurable:!0})}return t.call(s,e,n)}let lexState,buffer,doubleQuote,sign,c;function lex(){for(lexState="default",buffer="",doubleQuote=!1,sign=1;;){c=peek();const s=lexStates[lexState]();if(s)return s}}function peek(){if(source[pos])return String.fromCodePoint(source.codePointAt(pos))}function read(){const s=peek();return s===`
84
- `?(line++,column=0):s?column+=s.length:column++,s&&(pos+=s.length),s}const lexStates={default(){switch(c){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
83
+ `;function isGeneratorNode(i){return i instanceof CompositeGeneratorNode||i instanceof IndentNode||i instanceof NewLineNode}function toString(i,e){return isGeneratorNode(i)?processGeneratorNode(i,e).text:String(i)}class CompositeGeneratorNode{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,t,n){if(LikeC4.i(e)){if(this.tracedSource={astNode:e,property:t,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw new Error("Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.")}else this.tracedSource=e;return this}append(...e){for(const t of e)typeof t=="function"?t(this):t&&this.contents.push(t);return this}appendIf(e,...t){return e?this.append(...t):this}appendNewLine(){return this.append(NL)}appendNewLineIf(e){return e?this.append(NL):this}appendNewLineIfNotEmpty(){return this.append(NLEmpty)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...t){return this.append(expandToNode(e,...t))}appendTemplateIf(e){return e?(t,...n)=>this.appendTemplate(t,...n):()=>this}indent(e){const{indentedChildren:t,indentation:n,indentEmptyLines:s,indentImmediately:o}=Array.isArray(e)||typeof e=="function"?{indentedChildren:e}:typeof e=="object"?e:{},a=new IndentNode(n,o,s);return this.contents.push(a),Array.isArray(t)?a.append(...t):t&&a.append(t),this}appendTraced(e,t,n){return s=>this.append(new CompositeGeneratorNode().trace(e,t,n).append(s))}appendTracedIf(e,t,n,s){return e?this.appendTraced(typeof t=="function"?t():t,n,s):()=>this}appendTracedTemplate(e,t,n){return(s,...o)=>this.append(expandTracedToNode(e,t,n)(s,...o))}appendTracedTemplateIf(e,t,n,s){return e?this.appendTracedTemplate(typeof t=="function"?t():t,n,s):()=>this}}function traceToNode(i,e,t){return n=>n instanceof CompositeGeneratorNode&&n.tracedSource===void 0?n.trace(i,e,t):new CompositeGeneratorNode().trace(i,e,t).append(n)}class IndentNode extends CompositeGeneratorNode{constructor(e,t=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e=="string"?this.indentation=e:typeof e=="number"&&(this.indentation="".padStart(e)),this.indentImmediately=t,this.indentEmptyLines=n}}class NewLineNode{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??EOL,this.ifNotEmpty=t}}const NL=new NewLineNode,NLEmpty=new NewLineNode(void 0,!0),defaultToGenerated=i=>i===void 0||typeof i=="string"||isGeneratorNode(i)?i:String(i);function joinToNode(i,e=defaultToGenerated,t={}){const n=typeof e=="function"?e:defaultToGenerated,{filter:s,prefix:o,suffix:a,separator:l,appendNewLineIfNotEmpty:d,skipNewLineAfterLastItem:B}=typeof e=="object"?e:t,w=typeof o=="function"?o:()=>o,E=typeof a=="function"?a:()=>a;return reduceWithIsLast(i,(_,U,H,W)=>{if(s&&!s(U,H,W))return _;const L=n(U,H,W);return L===void 0?_:(_??(_=new CompositeGeneratorNode)).append(w(U,H,W)).append(L).append(E(U,H,W)).appendIf(!W,l).appendNewLineIfNotEmptyIf(!_.isEmpty()&&!!d&&(!W||!B))})}function reduceWithIsLast(i,e,t){const n=i[Symbol.iterator]();let s=n.next(),o=0,a=t;for(;!s.done;){const l=n.next();a=e(a,s.value,o,!!l.done),s=l,o++}return a}var Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,unicode={Space_Separator,ID_Start,ID_Continue},util={isSpaceSeparator(i){return typeof i=="string"&&unicode.Space_Separator.test(i)},isIdStartChar(i){return typeof i=="string"&&(i>="a"&&i<="z"||i>="A"&&i<="Z"||i==="$"||i==="_"||unicode.ID_Start.test(i))},isIdContinueChar(i){return typeof i=="string"&&(i>="a"&&i<="z"||i>="A"&&i<="Z"||i>="0"&&i<="9"||i==="$"||i==="_"||i==="\u200C"||i==="\u200D"||unicode.ID_Continue.test(i))},isDigit(i){return typeof i=="string"&&/[0-9]/.test(i)},isHexDigit(i){return typeof i=="string"&&/[0-9A-Fa-f]/.test(i)}};let source,parseState,stack,pos,line,column,token,key,root;var parse=function(e,t){source=String(e),parseState="start",stack=[],pos=0,line=1,column=0,token=void 0,key=void 0,root=void 0;do token=lex(),parseStates[parseState]();while(token.type!=="eof");return typeof t=="function"?internalize({"":root},"",t):root};function internalize(i,e,t){const n=i[e];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let s=0;s<n.length;s++){const o=String(s),a=internalize(n,o,t);a===void 0?delete n[o]:Object.defineProperty(n,o,{value:a,writable:!0,enumerable:!0,configurable:!0})}else for(const s in n){const o=internalize(n,s,t);o===void 0?delete n[s]:Object.defineProperty(n,s,{value:o,writable:!0,enumerable:!0,configurable:!0})}return t.call(i,e,n)}let lexState,buffer,doubleQuote,sign,c;function lex(){for(lexState="default",buffer="",doubleQuote=!1,sign=1;;){c=peek();const i=lexStates[lexState]();if(i)return i}}function peek(){if(source[pos])return String.fromCodePoint(source.codePointAt(pos))}function read(){const i=peek();return i===`
84
+ `?(line++,column=0):i?column+=i.length:column++,i&&(pos+=i.length),i}const lexStates={default(){switch(c){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
85
85
  `:case"\r":case"\u2028":case"\u2029":read();return;case"/":read(),lexState="comment";return;case void 0:return read(),newToken("eof")}if(util.isSpaceSeparator(c)){read();return}return lexStates[parseState]()},comment(){switch(c){case"*":read(),lexState="multiLineComment";return;case"/":read(),lexState="singleLineComment";return}throw invalidChar(read())},multiLineComment(){switch(c){case"*":read(),lexState="multiLineCommentAsterisk";return;case void 0:throw invalidChar(read())}read()},multiLineCommentAsterisk(){switch(c){case"*":read();return;case"/":read(),lexState="default";return;case void 0:throw invalidChar(read())}read(),lexState="multiLineComment"},singleLineComment(){switch(c){case`
86
- `:case"\r":case"\u2028":case"\u2029":read(),lexState="default";return;case void 0:return read(),newToken("eof")}read()},value(){switch(c){case"{":case"[":return newToken("punctuator",read());case"n":return read(),literal("ull"),newToken("null",null);case"t":return read(),literal("rue"),newToken("boolean",!0);case"f":return read(),literal("alse"),newToken("boolean",!1);case"-":case"+":read()==="-"&&(sign=-1),lexState="sign";return;case".":buffer=read(),lexState="decimalPointLeading";return;case"0":buffer=read(),lexState="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":buffer=read(),lexState="decimalInteger";return;case"I":return read(),literal("nfinity"),newToken("numeric",1/0);case"N":return read(),literal("aN"),newToken("numeric",NaN);case'"':case"'":doubleQuote=read()==='"',buffer="",lexState="string";return}throw invalidChar(read())},identifierNameStartEscape(){if(c!=="u")throw invalidChar(read());read();const s=unicodeEscape();switch(s){case"$":case"_":break;default:if(!util.isIdStartChar(s))throw invalidIdentifier();break}buffer+=s,lexState="identifierName"},identifierName(){switch(c){case"$":case"_":case"\u200C":case"\u200D":buffer+=read();return;case"\\":read(),lexState="identifierNameEscape";return}if(util.isIdContinueChar(c)){buffer+=read();return}return newToken("identifier",buffer)},identifierNameEscape(){if(c!=="u")throw invalidChar(read());read();const s=unicodeEscape();switch(s){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!util.isIdContinueChar(s))throw invalidIdentifier();break}buffer+=s,lexState="identifierName"},sign(){switch(c){case".":buffer=read(),lexState="decimalPointLeading";return;case"0":buffer=read(),lexState="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":buffer=read(),lexState="decimalInteger";return;case"I":return read(),literal("nfinity"),newToken("numeric",sign*(1/0));case"N":return read(),literal("aN"),newToken("numeric",NaN)}throw invalidChar(read())},zero(){switch(c){case".":buffer+=read(),lexState="decimalPoint";return;case"e":case"E":buffer+=read(),lexState="decimalExponent";return;case"x":case"X":buffer+=read(),lexState="hexadecimal";return}return newToken("numeric",sign*0)},decimalInteger(){switch(c){case".":buffer+=read(),lexState="decimalPoint";return;case"e":case"E":buffer+=read(),lexState="decimalExponent";return}if(util.isDigit(c)){buffer+=read();return}return newToken("numeric",sign*Number(buffer))},decimalPointLeading(){if(util.isDigit(c)){buffer+=read(),lexState="decimalFraction";return}throw invalidChar(read())},decimalPoint(){switch(c){case"e":case"E":buffer+=read(),lexState="decimalExponent";return}if(util.isDigit(c)){buffer+=read(),lexState="decimalFraction";return}return newToken("numeric",sign*Number(buffer))},decimalFraction(){switch(c){case"e":case"E":buffer+=read(),lexState="decimalExponent";return}if(util.isDigit(c)){buffer+=read();return}return newToken("numeric",sign*Number(buffer))},decimalExponent(){switch(c){case"+":case"-":buffer+=read(),lexState="decimalExponentSign";return}if(util.isDigit(c)){buffer+=read(),lexState="decimalExponentInteger";return}throw invalidChar(read())},decimalExponentSign(){if(util.isDigit(c)){buffer+=read(),lexState="decimalExponentInteger";return}throw invalidChar(read())},decimalExponentInteger(){if(util.isDigit(c)){buffer+=read();return}return newToken("numeric",sign*Number(buffer))},hexadecimal(){if(util.isHexDigit(c)){buffer+=read(),lexState="hexadecimalInteger";return}throw invalidChar(read())},hexadecimalInteger(){if(util.isHexDigit(c)){buffer+=read();return}return newToken("numeric",sign*Number(buffer))},string(){switch(c){case"\\":read(),buffer+=escape();return;case'"':if(doubleQuote)return read(),newToken("string",buffer);buffer+=read();return;case"'":if(!doubleQuote)return read(),newToken("string",buffer);buffer+=read();return;case`
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(),`
86
+ `:case"\r":case"\u2028":case"\u2029":read(),lexState="default";return;case void 0:return read(),newToken("eof")}read()},value(){switch(c){case"{":case"[":return newToken("punctuator",read());case"n":return read(),literal("ull"),newToken("null",null);case"t":return read(),literal("rue"),newToken("boolean",!0);case"f":return read(),literal("alse"),newToken("boolean",!1);case"-":case"+":read()==="-"&&(sign=-1),lexState="sign";return;case".":buffer=read(),lexState="decimalPointLeading";return;case"0":buffer=read(),lexState="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":buffer=read(),lexState="decimalInteger";return;case"I":return read(),literal("nfinity"),newToken("numeric",1/0);case"N":return read(),literal("aN"),newToken("numeric",NaN);case'"':case"'":doubleQuote=read()==='"',buffer="",lexState="string";return}throw invalidChar(read())},identifierNameStartEscape(){if(c!=="u")throw invalidChar(read());read();const i=unicodeEscape();switch(i){case"$":case"_":break;default:if(!util.isIdStartChar(i))throw invalidIdentifier();break}buffer+=i,lexState="identifierName"},identifierName(){switch(c){case"$":case"_":case"\u200C":case"\u200D":buffer+=read();return;case"\\":read(),lexState="identifierNameEscape";return}if(util.isIdContinueChar(c)){buffer+=read();return}return newToken("identifier",buffer)},identifierNameEscape(){if(c!=="u")throw invalidChar(read());read();const i=unicodeEscape();switch(i){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!util.isIdContinueChar(i))throw invalidIdentifier();break}buffer+=i,lexState="identifierName"},sign(){switch(c){case".":buffer=read(),lexState="decimalPointLeading";return;case"0":buffer=read(),lexState="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":buffer=read(),lexState="decimalInteger";return;case"I":return read(),literal("nfinity"),newToken("numeric",sign*(1/0));case"N":return read(),literal("aN"),newToken("numeric",NaN)}throw invalidChar(read())},zero(){switch(c){case".":buffer+=read(),lexState="decimalPoint";return;case"e":case"E":buffer+=read(),lexState="decimalExponent";return;case"x":case"X":buffer+=read(),lexState="hexadecimal";return}return newToken("numeric",sign*0)},decimalInteger(){switch(c){case".":buffer+=read(),lexState="decimalPoint";return;case"e":case"E":buffer+=read(),lexState="decimalExponent";return}if(util.isDigit(c)){buffer+=read();return}return newToken("numeric",sign*Number(buffer))},decimalPointLeading(){if(util.isDigit(c)){buffer+=read(),lexState="decimalFraction";return}throw invalidChar(read())},decimalPoint(){switch(c){case"e":case"E":buffer+=read(),lexState="decimalExponent";return}if(util.isDigit(c)){buffer+=read(),lexState="decimalFraction";return}return newToken("numeric",sign*Number(buffer))},decimalFraction(){switch(c){case"e":case"E":buffer+=read(),lexState="decimalExponent";return}if(util.isDigit(c)){buffer+=read();return}return newToken("numeric",sign*Number(buffer))},decimalExponent(){switch(c){case"+":case"-":buffer+=read(),lexState="decimalExponentSign";return}if(util.isDigit(c)){buffer+=read(),lexState="decimalExponentInteger";return}throw invalidChar(read())},decimalExponentSign(){if(util.isDigit(c)){buffer+=read(),lexState="decimalExponentInteger";return}throw invalidChar(read())},decimalExponentInteger(){if(util.isDigit(c)){buffer+=read();return}return newToken("numeric",sign*Number(buffer))},hexadecimal(){if(util.isHexDigit(c)){buffer+=read(),lexState="hexadecimalInteger";return}throw invalidChar(read())},hexadecimalInteger(){if(util.isHexDigit(c)){buffer+=read();return}return newToken("numeric",sign*Number(buffer))},string(){switch(c){case"\\":read(),buffer+=escape();return;case'"':if(doubleQuote)return read(),newToken("string",buffer);buffer+=read();return;case"'":if(!doubleQuote)return read(),newToken("string",buffer);buffer+=read();return;case`
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(i,e){return{type:i,value:e,line,column}}function literal(i){for(const e of i){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="",_;if(t!=null&&typeof t=="object"&&!Array.isArray(t)&&(n=t.space,_=t.quote,t=t.replacer),typeof t=="function")d=t;else if(Array.isArray(t)){l=[];for(const z of t){let N;typeof z=="string"?N=z:(typeof z=="number"||z instanceof String||z instanceof Number)&&(N=String(z)),N!==void 0&&l.indexOf(N)<0&&l.push(N)}}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)),E("",{"":e});function E(z,N){let Q=N[z];switch(Q!=null&&(typeof Q.toJSON5=="function"?Q=Q.toJSON5(z):typeof Q.toJSON=="function"&&(Q=Q.toJSON(z))),d&&(Q=d.call(N,z,Q)),Q instanceof Number?Q=Number(Q):Q instanceof String?Q=String(Q):Q instanceof Boolean&&(Q=Q.valueOf()),Q){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof Q=="string")return y(Q);if(typeof Q=="number")return String(Q);if(typeof Q=="object")return Array.isArray(Q)?K(Q):L(Q)}function y(z){const N={"'":.1,'"':.2},Q={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let te="";for(let oe=0;oe<z.length;oe++){const le=z[oe];switch(le){case"'":case'"':N[le]++,te+=le;continue;case"\0":if(util.isDigit(z[oe+1])){te+="\\x00";continue}}if(Q[le]){te+=Q[le];continue}if(le<" "){let ye=le.charCodeAt(0).toString(16);te+="\\x"+("00"+ye).substring(ye.length);continue}te+=le}const ce=_||Object.keys(N).reduce((oe,le)=>N[oe]<N[le]?oe:le);return te=te.replace(new RegExp(ce,"g"),Q[ce]),ce+te+ce}function L(z){if(o.indexOf(z)>=0)throw TypeError("Converting circular structure to JSON5");o.push(z);let N=a;a=a+w;let Q=l||Object.keys(z),te=[];for(const oe of Q){const le=E(oe,z);if(le!==void 0){let ye=W(oe)+":";w!==""&&(ye+=" "),ye+=le,te.push(ye)}}let ce;if(te.length===0)ce="{}";else{let oe;if(w==="")oe=te.join(","),ce="{"+oe+"}";else{let le=`,
91
- `+a;oe=te.join(le),ce=`{
92
- `+a+oe+`,
93
- `+N+"}"}}return o.pop(),a=N,ce}function W(z){if(z.length===0)return y(z);const N=String.fromCodePoint(z.codePointAt(0));if(!util.isIdStartChar(N))return y(z);for(let Q=N.length;Q<z.length;Q++)if(!util.isIdContinueChar(String.fromCodePoint(z.codePointAt(Q))))return y(z);return z}function K(z){if(o.indexOf(z)>=0)throw TypeError("Converting circular structure to JSON5");o.push(z);let N=a;a=a+w;let Q=[];for(let ce=0;ce<z.length;ce++){const oe=E(String(ce),z);Q.push(oe!==void 0?oe:"null")}let te;if(Q.length===0)te="[]";else if(w==="")te="["+Q.join(",")+"]";else{let ce=`,
94
- `+a,oe=Q.join(ce);te=`[
95
- `+a+oe+`,
96
- `+N+"]"}return o.pop(),a=N,te}};const JSON5={parse,stringify};var lib=JSON5;const D$1=s=>s.charAt(0).toLocaleUpperCase()+s.slice(1),v=s=>s.split(".").map(D$1).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),_=(d?d+".":"")+w;n.set(l.id,_);const E=JSON.stringify(l.title),y=b(l);return new CompositeGeneratorNode().append(w,": {",NL).indent({indentedChildren:L=>L.append("label: ",E,NL).appendIf(y!=="rectangle","shape: ",y,NL).appendIf(l.children.length>0,NL,joinToNode(e.filter(W=>W.parent===l.id),W=>o(W,_))),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),_=(d?d+".":"")+w;n.set(l.id,_);const E=l.title.replaceAll(`
97
- `,"\\n"),y=R(l),L=new CompositeGeneratorNode;return l.children.length>0?L.append("subgraph ",_,"[",JSON.stringify(l.title),"]",NL).indent({indentedChildren:[joinToNode(e.filter(W=>W.parent===l.id),W=>o(W,_),{appendNewLineIfNotEmpty:!0})],indentation:2}).append("end",NL):L.append(_,y[0],E,y[1]),L},a=l=>new CompositeGeneratorNode().append(n.get(l.source)," -.",l.label?' "'+l.label.replaceAll(`
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`
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 i="",e=peek();if(!util.isHexDigit(e)||(i+=read(),e=peek(),!util.isHexDigit(e)))throw invalidChar(read());return i+=read(),String.fromCodePoint(parseInt(i,16))}function unicodeEscape(){let i="",e=4;for(;e-- >0;){const t=peek();if(!util.isHexDigit(t))throw invalidChar(read());i+=read()}return String.fromCodePoint(parseInt(i,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 i;switch(token.type){case"punctuator":switch(token.value){case"{":i={};break;case"[":i=[];break}break;case"null":case"boolean":case"numeric":case"string":i=token.value;break}if(root===void 0)root=i;else{const e=stack[stack.length-1];Array.isArray(e)?e.push(i):Object.defineProperty(e,key,{value:i,writable:!0,enumerable:!0,configurable:!0})}if(i!==null&&typeof i=="object")stack.push(i),Array.isArray(i)?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 i=stack[stack.length-1];i==null?parseState="end":Array.isArray(i)?parseState="afterArrayValue":parseState="afterPropertyValue"}function invalidChar(i){return syntaxError(i===void 0?`JSON5: invalid end of input at ${line}:${column}`:`JSON5: invalid character '${formatChar(i)}' 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(i){console.warn(`JSON5: '${formatChar(i)}' in strings is not valid ECMAScript; consider escaping`)}function formatChar(i){const e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[i])return e[i];if(i<" "){const t=i.charCodeAt(0).toString(16);return"\\x"+("00"+t).substring(t.length)}return i}function syntaxError(i){const e=new SyntaxError(i);return e.lineNumber=line,e.columnNumber=column,e}var stringify=function(e,t,n){const s=[];let o="",a,l,d="",B;if(t!=null&&typeof t=="object"&&!Array.isArray(t)&&(n=t.space,B=t.quote,t=t.replacer),typeof t=="function")l=t;else if(Array.isArray(t)){a=[];for(const W of t){let L;typeof W=="string"?L=W:(typeof W=="number"||W instanceof String||W instanceof Number)&&(L=String(W)),L!==void 0&&a.indexOf(L)<0&&a.push(L)}}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)),d=" ".substr(0,n)):typeof n=="string"&&(d=n.substr(0,10)),w("",{"":e});function w(W,L){let K=L[W];switch(K!=null&&(typeof K.toJSON5=="function"?K=K.toJSON5(W):typeof K.toJSON=="function"&&(K=K.toJSON(W))),l&&(K=l.call(L,W,K)),K instanceof Number?K=Number(K):K instanceof String?K=String(K):K instanceof Boolean&&(K=K.valueOf()),K){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof K=="string")return E(K);if(typeof K=="number")return String(K);if(typeof K=="object")return Array.isArray(K)?H(K):_(K)}function E(W){const L={"'":.1,'"':.2},K={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let ee="";for(let se=0;se<W.length;se++){const ce=W[se];switch(ce){case"'":case'"':L[ce]++,ee+=ce;continue;case"\0":if(util.isDigit(W[se+1])){ee+="\\x00";continue}}if(K[ce]){ee+=K[ce];continue}if(ce<" "){let Fe=ce.charCodeAt(0).toString(16);ee+="\\x"+("00"+Fe).substring(Fe.length);continue}ee+=ce}const ae=B||Object.keys(L).reduce((se,ce)=>L[se]<L[ce]?se:ce);return ee=ee.replace(new RegExp(ae,"g"),K[ae]),ae+ee+ae}function _(W){if(s.indexOf(W)>=0)throw TypeError("Converting circular structure to JSON5");s.push(W);let L=o;o=o+d;let K=a||Object.keys(W),ee=[];for(const se of K){const ce=w(se,W);if(ce!==void 0){let Fe=U(se)+":";d!==""&&(Fe+=" "),Fe+=ce,ee.push(Fe)}}let ae;if(ee.length===0)ae="{}";else{let se;if(d==="")se=ee.join(","),ae="{"+se+"}";else{let ce=`,
91
+ `+o;se=ee.join(ce),ae=`{
92
+ `+o+se+`,
93
+ `+L+"}"}}return s.pop(),o=L,ae}function U(W){if(W.length===0)return E(W);const L=String.fromCodePoint(W.codePointAt(0));if(!util.isIdStartChar(L))return E(W);for(let K=L.length;K<W.length;K++)if(!util.isIdContinueChar(String.fromCodePoint(W.codePointAt(K))))return E(W);return W}function H(W){if(s.indexOf(W)>=0)throw TypeError("Converting circular structure to JSON5");s.push(W);let L=o;o=o+d;let K=[];for(let ae=0;ae<W.length;ae++){const se=w(String(ae),W);K.push(se!==void 0?se:"null")}let ee;if(K.length===0)ee="[]";else if(d==="")ee="["+K.join(",")+"]";else{let ae=`,
94
+ `+o,se=K.join(ae);ee=`[
95
+ `+o+se+`,
96
+ `+L+"]"}return s.pop(),o=L,ee}};const JSON5={parse,stringify};var lib=JSON5;const D$1=i=>i.charAt(0).toLocaleUpperCase()+i.slice(1),v=i=>i.split(".").map(D$1).join(""),x=i=>v(i.parent?i.id.slice(i.parent.length+1):i.id),M=({autoLayout:i})=>{switch(i.direction){case"TB":return"down";case"BT":return"up";case"LR":return"right";case"RL":return"left"}},b=({shape:i})=>{switch(i){case"queue":case"cylinder":case"rectangle":case"person":return i;case"storage":return"stored_data";case"mobile":case"browser":return"rectangle"}};function P$1(i){const{nodes:e,edges:t}=i,n=new Map,s=(a,l)=>{const d=x(a),B=(l?l+".":"")+d;n.set(a.id,B);const w=JSON.stringify(a.title),E=b(a);return new CompositeGeneratorNode().append(d,": {",NL).indent({indentedChildren:_=>_.append("label: ",w,NL).appendIf(E!=="rectangle","shape: ",E,NL).appendIf(a.children.length>0,NL,joinToNode(e.filter(U=>U.parent===a.id),U=>s(U,B))),indentation:2}).append("}",NL)},o=a=>new CompositeGeneratorNode().append(n.get(a.source)," -> ",n.get(a.target)).append(l=>a.label&&l.append(": ",JSON.stringify(a.label)));return toString(new CompositeGeneratorNode().append("direction: ",M(i),NL,NL).append(joinToNode(e.filter(a=>LikeC4.n(a.parent)),a=>s(a),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,NL,joinToNode(t,a=>o(a),{appendNewLineIfNotEmpty:!0})))}const A$1=i=>i.charAt(0).toLocaleUpperCase()+i.slice(1),O$1=i=>i.split(".").map(A$1).join(""),$$1=i=>O$1(i.parent?i.id.slice(i.parent.length+1):i.id),R=({shape:i})=>{switch(i){case"queue":case"cylinder":return["[(",")]"];case"person":return["[fa:fa-user ","]"];case"storage":return["([","])"];case"mobile":case"browser":case"rectangle":return["[","]"]}};function S(i){const{nodes:e,edges:t}=i,n=new Map,s=(a,l)=>{const d=$$1(a),B=(l?l+".":"")+d;n.set(a.id,B);const w=a.title.replaceAll(`
97
+ `,"\\n"),E=R(a),_=new CompositeGeneratorNode;return a.children.length>0?_.append("subgraph ",B,"[",JSON.stringify(a.title),"]",NL).indent({indentedChildren:[joinToNode(e.filter(U=>U.parent===a.id),U=>s(U,B),{appendNewLineIfNotEmpty:!0})],indentation:2}).append("end",NL):_.append(B,E[0],w,E[1]),_},o=a=>new CompositeGeneratorNode().append(n.get(a.source)," -.",a.label?' "'+a.label.replaceAll(`
98
+ `,"\\n")+'" .-':"-","> ",n.get(a.target));return toString(new CompositeGeneratorNode().appendIf(i.title!==null&&i.title.length>0,"---",NL,`title: ${JSON.stringify(i.title)}`,NL,"---",NL).append("graph ",i.autoLayout.direction,NL).indent({indentedChildren:a=>{a.append(joinToNode(e.filter(l=>LikeC4.n(l.parent)),l=>s(l),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,joinToNode(t,l=>o(l),{appendNewLineIfNotEmpty:!0}))},indentation:2}))}function q(i){const e=new CompositeGeneratorNode;return e.appendTemplate`
99
99
  /* prettier-ignore-start */
100
100
  /* eslint-disable */
101
101
 
@@ -106,7 +106,7 @@ ${e.join(`
106
106
 
107
107
  import { LikeC4Model } from 'likec4/model'
108
108
 
109
- export const likeC4Model = LikeC4Model.fromDump(${lib.stringify(s.$model,{space:2,quote:"'"})})
109
+ export const likeC4Model = LikeC4Model.fromDump(${lib.stringify(i.$model,{space:2,quote:"'"})})
110
110
 
111
111
  export type LikeC4ModelTypes = typeof likeC4Model.Aux
112
112
  export type LikeC4ElementId = LikeC4ModelTypes['Fqn']
@@ -114,7 +114,7 @@ ${e.join(`
114
114
  export type LikeC4ViewId = LikeC4ModelTypes['ViewId']
115
115
 
116
116
  /* prettier-ignore-end */
117
- `,toString(e)}function h(s){return joinToNode(s,e=>expandToNode`${lib.stringify(e.id)}`,{separator:" | "})}function J(s){const e=Array.from(s),t=new CompositeGeneratorNode;return t.appendTemplate`
117
+ `,toString(e)}function h(i){return joinToNode(i,e=>expandToNode`${lib.stringify(e.id)}`,{separator:" | "})}function J(i){const e=Array.from(i),t=new CompositeGeneratorNode;return t.appendTemplate`
118
118
  /******************************************************************************
119
119
  * This file was generated
120
120
  * DO NOT EDIT MANUALLY!
@@ -128,7 +128,7 @@ ${e.join(`
128
128
  `.append(NL,NL),e.length===0?(t.append("export {}",NL),toString(t)):(t.appendTemplate`
129
129
  export type LikeC4ViewId = ${h(e)};
130
130
  export const LikeC4Views = {
131
- `.indent({indentation:2,indentedChildren(n){n.appendNewLineIf(e.length>1).append(joinToNode(e,o=>expandToNode`${lib.stringify(o.id)}: (${lib.stringify(o)} as unknown) as DiagramView`,{separator:",",appendNewLineIfNotEmpty:!0}))}}).append("} as const satisfies Record<LikeC4ViewId, DiagramView>",NL,NL).appendTemplate`
131
+ `.indent({indentation:2,indentedChildren(n){n.appendNewLineIf(e.length>1).append(joinToNode(e,s=>expandToNode`${lib.stringify(s.id)}: (${lib.stringify(s)} as unknown) as DiagramView`,{separator:",",appendNewLineIfNotEmpty:!0}))}}).append("} as const satisfies Record<LikeC4ViewId, DiagramView>",NL,NL).appendTemplate`
132
132
  export type LikeC4Views = typeof LikeC4Views
133
133
 
134
134
  export function isLikeC4ViewId(value: unknown): value is LikeC4ViewId {
@@ -140,8 +140,8 @@ ${e.join(`
140
140
  }
141
141
 
142
142
  /* prettier-ignore-end */
143
- `.append(NL),toString(t))}function C$1(s){s instanceof Set&&(s=[...s].sort(core.compareNatural));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}=core.sortNaturalByFqn([...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=core.sortNaturalByFqn([...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 C$1(i){i instanceof Set&&(i=[...i].sort(core.compareNatural));const e=i.map(t=>` | ${JSON.stringify(t)}`);return e.length===0&&e.push(" never"),e.join(`
144
+ `)+";"}function Y(i){const{fqns:e,tags:t,kinds:n}=core.sortNaturalByFqn([...i.elements()]).reduce((a,l)=>(a.fqns.push(l.id),a.kinds.add(l.kind),a.tags.push(...l.tags),a),{fqns:[],kinds:new Set,tags:[]}),s=core.sortNaturalByFqn([...i.deployment.elements()]).map(a=>a.id),{viewIds:o}=[...i.views()].reduce((a,l)=>(a.viewIds.add(l.id),a.tags.push(...l.tags),a.tags.push(...l.includedTags),a),{viewIds:new Set,tags:t});return`
145
145
  /* prettier-ignore-start */
146
146
  /* eslint-disable */
147
147
 
@@ -165,10 +165,10 @@ type LikeC4ElementId =
165
165
  ${C$1(e)}
166
166
 
167
167
  type LikeC4DeploymentId =
168
- ${C$1(o)}
168
+ ${C$1(s)}
169
169
 
170
170
  type LikeC4ViewId =
171
- ${C$1(a)}
171
+ ${C$1(o)}
172
172
 
173
173
  type LikeC4ElementKind =
174
174
  ${C$1(n)}
@@ -224,7 +224,7 @@ export {
224
224
  ReactLikeC4
225
225
  }
226
226
  /* prettier-ignore-end */
227
- `.trimStart()}function generateD2Sources(s){const e=new CompositeGeneratorNode;return e.appendTemplate`
227
+ `.trimStart()}function generateD2Sources(i){const e=new CompositeGeneratorNode;return e.appendTemplate`
228
228
  /******************************************************************************
229
229
  * This file was generated
230
230
  * DO NOT EDIT MANUALLY!
@@ -233,7 +233,7 @@ export {
233
233
 
234
234
  export function d2Source(viewId) {
235
235
  switch (viewId) {
236
- `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(joinToNode(s,n=>expandToNode`
236
+ `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(joinToNode(i,n=>expandToNode`
237
237
  case ${JSON.stringify(n.id)}: {
238
238
  return ${JSON.stringify(P$1(n))}
239
239
  }
@@ -243,7 +243,7 @@ export {
243
243
  }
244
244
  `}}).append(NL," }",NL).appendTemplate`
245
245
  }
246
- `.append(NL,NL),toString(e)}function generateDotSources(s){const e=new CompositeGeneratorNode;return e.appendTemplate`
246
+ `.append(NL,NL),toString(e)}function generateDotSources(i){const e=new CompositeGeneratorNode;return e.appendTemplate`
247
247
  /******************************************************************************
248
248
  * This file was generated
249
249
  * DO NOT EDIT MANUALLY!
@@ -252,9 +252,9 @@ export {
252
252
 
253
253
  export function dotSource(viewId) {
254
254
  switch (viewId) {
255
- `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(joinToNode(Object.keys(s),n=>expandToNode`
255
+ `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(joinToNode(Object.keys(i),n=>expandToNode`
256
256
  case ${JSON.stringify(n)}: {
257
- return ${JSON.stringify(s[n].dot)}
257
+ return ${JSON.stringify(i[n].dot)}
258
258
  }
259
259
  `,{appendNewLineIfNotEmpty:!0})).appendTemplate`
260
260
  default: {
@@ -265,15 +265,15 @@ export {
265
265
 
266
266
  export function svgSource(viewId) {
267
267
  switch (viewId) {
268
- `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(joinToNode(Object.keys(s),n=>expandToNode`
268
+ `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(joinToNode(Object.keys(i),n=>expandToNode`
269
269
  case ${JSON.stringify(n)}: {
270
- return ${JSON.stringify(s[n].svg)}
270
+ return ${JSON.stringify(i[n].svg)}
271
271
  }
272
272
  `,{appendNewLineIfNotEmpty:!0})).appendTemplate`
273
273
  default: {
274
274
  throw new Error('Unknown viewId: ' + viewId)
275
275
  }
276
- `}}).append(NL," }",NL,"}",NL,NL),toString(e)}function generateIconRendererSource(s){const e=LikeC4.x(s.flatMap(o=>o.nodes.map(a=>a.icon)),LikeC4.c(LikeC4.t),LikeC4.c(o=>LikeC4.d(o)&&!o.toLowerCase().startsWith("http")),LikeC4.b()).sort(),{imports:t,cases:n}=e.reduce((o,a,l)=>{const[d,w]=a.split(":"),_="Icon"+l.toString().padStart(2,"0");return o.imports.push(`import ${_} from 'likec4/icons/${d}/${w}'`),o.cases.push(` '${d}:${w}': ${_}`),o},{imports:[],cases:[]});return`
276
+ `}}).append(NL," }",NL,"}",NL,NL),toString(e)}function generateIconRendererSource(i){const e=LikeC4.x(i.flatMap(s=>s.nodes.map(o=>o.icon)),LikeC4.c(LikeC4.t),LikeC4.c(s=>LikeC4.d(s)&&!s.toLowerCase().startsWith("http")),LikeC4.b()).sort(),{imports:t,cases:n}=e.reduce((s,o,a)=>{const[l,d]=o.split(":"),B="Icon"+a.toString().padStart(2,"0");return s.imports.push(`import ${B} from 'likec4/icons/${l}/${d}'`),s.cases.push(` '${l}:${d}': ${B}`),s},{imports:[],cases:[]});return`
277
277
  ${t.join(`
278
278
  `)}
279
279
 
@@ -295,7 +295,7 @@ if (import.meta.hot) {
295
295
  }
296
296
  })
297
297
  }
298
- `}function likec4ModelSources(s){const{views:e,...t}=s.$model;return`
298
+ `}function likec4ModelSources(i){const{views:e,...t}=i.$model;return`
299
299
  import { createLikeC4Model } from 'likec4/model'
300
300
  import { nano } from 'likec4/react'
301
301
 
@@ -326,7 +326,7 @@ if (import.meta.hot) {
326
326
  }
327
327
  })
328
328
  }
329
- `}function generateMmdSources(s){const e=new CompositeGeneratorNode;return e.appendTemplate`
329
+ `}function generateMmdSources(i){const e=new CompositeGeneratorNode;return e.appendTemplate`
330
330
  /******************************************************************************
331
331
  * This file was generated
332
332
  * DO NOT EDIT MANUALLY!
@@ -335,7 +335,7 @@ if (import.meta.hot) {
335
335
 
336
336
  export function mmdSource(viewId) {
337
337
  switch (viewId) {
338
- `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(joinToNode(s,n=>expandToNode`
338
+ `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(joinToNode(i,n=>expandToNode`
339
339
  case ${JSON.stringify(n.id)}: {
340
340
  return ${JSON.stringify(S(n))}
341
341
  }
@@ -346,10 +346,10 @@ if (import.meta.hot) {
346
346
  `}}).append(NL," }",NL).appendTemplate`
347
347
  }
348
348
 
349
- `.append(NL,NL),toString(e)}function generateOverviewGraphSource(s){return`
349
+ `.append(NL,NL),toString(e)}function generateOverviewGraphSource(i){return`
350
350
  import { nano } from 'likec4/react'
351
351
 
352
- export const $graph = nano.atom(${lib.stringify(s,null,2)})
352
+ export const $graph = nano.atom(${lib.stringify(i,null,2)})
353
353
 
354
354
  export const useOverviewGraph = () => {
355
355
  return nano.useStore($graph)
@@ -368,7 +368,7 @@ if (import.meta.hot) {
368
368
  }
369
369
  })
370
370
  }
371
- `}function diagramPreviewsSources(s,e){const{imports:t,cases:n}=s.reduce((o,{id:a},l)=>{const d=path$1.resolve(e,`${a}.png`);if(!fs.existsSync(d))return o;const w="Png"+l.toString().padStart(2,"0");return o.imports.push(`import ${w} from 'likec4/previews/${a}.png'`),o.cases.push(` ${JSON.stringify(a)}: ${w}`),o},{imports:[],cases:[]});return`
371
+ `}function diagramPreviewsSources(i,e){const{imports:t,cases:n}=i.reduce((s,{id:o},a)=>{const l=path$1.resolve(e,`${o}.png`);if(!fs.existsSync(l))return s;const d="Png"+a.toString().padStart(2,"0");return s.imports.push(`import ${d} from 'likec4/previews/${o}.png'`),s.cases.push(` ${JSON.stringify(o)}: ${d}`),s},{imports:[],cases:[]});return`
372
372
  import { nano } from 'likec4/react'
373
373
  // assets dir: ${e}
374
374
 
@@ -410,31 +410,31 @@ if (import.meta.hot) {
410
410
  }
411
411
  })
412
412
  }
413
- `}const P={id:"virtual:likec4/dot-sources",virtualId:"\0likec4-plugin/dot-sources.js",async load({likec4:s,logger:e}){e.info(LikeC4.p.dim("generating virtual:likec4/dot-sources"));const t=await s.viewsService.viewsAsGraphvizOut(),n=LikeC4.h(t,({id:o,svg:a,dot:l})=>[o,{dot:l,svg:a}]);return generateDotSources(n)}},V={id:"virtual:likec4/d2-sources",virtualId:"\0likec4-plugin/d2-sources.js",async load({likec4:s,logger:e}){e.info(LikeC4.p.dim("generating virtual:likec4/d2-sources"));const t=await s.viewsService.computedViews();return generateD2Sources(t)}},j={id:"virtual:likec4/mmd-sources",virtualId:"\0likec4-plugin/mmd-sources.js",async load({likec4:s,logger:e}){e.info(LikeC4.p.dim("generating virtual:likec4/mmd-sources"));const t=await s.viewsService.computedViews();return generateMmdSources(t)}},C={id:"virtual:likec4/icons",virtualId:"\0likec4-plugin/icons.js",async load({likec4:s,logger:e}){e.info(LikeC4.p.dim("generating virtual:likec4/icons"));const t=await s.viewsService.computedViews();return generateIconRendererSource(t)}},O={id:"virtual:likec4/overview-graph",virtualId:"\0likec4-plugin/overview-graph.js",async load({likec4:s,logger:e,useOverviewGraph:t}){if(t===!0)try{e.info(LikeC4.p.dim("generating virtual:likec4/overview-graph"));const n=await s.viewsService.overviewGraph();return generateOverviewGraphSource(n)}catch(n){e.error(n)}return e.info(LikeC4.p.dim("generating empty virtual:likec4/overview-graph")),generateOverviewGraphSource({nodes:[],edges:[],bounds:{x:0,y:0,width:10,height:10}})}},m={id:"virtual:likec4/previews",virtualId:"\0likec4-plugin/previews.js",async load({likec4:s,logger:e,assetsDir:t}){e.info(LikeC4.p.dim("generating virtual:likec4/previews"));const n=await s.viewsService.computedViews();return diagramPreviewsSources(n,t)}},G={id:"virtual:likec4/model",virtualId:"\0likec4-plugin/model.js",async load({likec4:s,logger:e,assetsDir:t}){e.info(LikeC4.p.dim("generating virtual:likec4/model"));const n=await s.layoutedModel();return likec4ModelSources(n)}},modules=[C,P,V,j,O,m,G],$=s=>{const e=s.toLowerCase();return e.endsWith(".c4")||e.endsWith(".likec4")||e.endsWith(".like-c4")};function likec4Plugin({useOverviewGraph:s=!1,languageServices:e}){let t,n=e.workspace;return{name:"vite-plugin-likec4",configResolved(o){if(t=o.logger,s){const a=o.resolve.alias.find(l=>l.find==="likec4/previews")?.replacement;a?(n=a,t.info(LikeC4.p.dim("likec4/previews alias")+" "+LikeC4.p.dim(n))):t.warn("likec4/previews alias not found")}},resolveId(o){const a=modules.find(l=>l.id===o);return a?a.virtualId:null},async load(o){const a=modules.find(l=>l.virtualId===o);return a?await a.load({logger:t,likec4:e,assetsDir:n,useOverviewGraph:s}):null},configureServer(o){const a=LikeC4.e(1),l=()=>{a.clearQueue(),a(async()=>{const[_]=e.getErrors();if(_){o.ws.send({type:"error",err:{name:"LikeC4ValidationError",message:"Validation error: "+_.message.slice(0,500),stack:"",plugin:"vite-plugin-likec4",loc:{file:_.sourceFsPath,line:_.range.start.line+1,column:_.range.start.character+1}}});return}for(const E of modules){const y=o.moduleGraph.getModuleById(E.virtualId);if(y&&y.importers.size>0){t.info(`${LikeC4.p.green("trigger hmr")} ${LikeC4.p.dim(y.url)}`);try{await o.reloadModule(y)}catch(L){t.error(L)}}}})},d=e.workspace;t.info(`${LikeC4.p.dim("watch")} ${d}`);const w=_=>E=>{$(E)&&e.notifyUpdate({[_]:E})};if(o.watcher.add(d).on("add",w("changed")).on("change",w("changed")).on("unlink",w("removed")),s&&!n.startsWith(e.workspace)){t.info(`${LikeC4.p.dim("watch")} ${n}`);const _=()=>{const E=o.moduleGraph.getModuleById(m.virtualId);E&&E.importers.size>0&&o.reloadModule(E)};o.watcher.add(n).on("add",_).on("change",_).on("unlink",_)}e.onModelUpdate(()=>{LikeC4.Y.debug("likec4 model update"),l()})}}}const viteConfig=async({languageServices:s,likec4AssetsDir:e,...t})=>{const n=t.customLogger??LikeC4.j("c4:vite"),o=viteAppRoot(),a=t?.useOverviewGraph===!0;n.info(`${LikeC4.p.cyan("likec4 app root")} ${LikeC4.p.dim(o)}`);const l=t.outputDir??path$1.resolve(s.workspace,"dist");n.info(LikeC4.p.cyan("output")+" "+LikeC4.p.dim(l));let d="/";t.base&&(d=LikeC4.w(t.base),!LikeC4.k(d)&&d!=="./"&&(d=LikeC4.m(d))),d!=="/"&&n.info(`${LikeC4.p.green("app base url")} ${LikeC4.p.dim(d)}`);const w=t.webcomponentPrefix??"likec4";return{isDev:!1,likec4AssetsDir:e,webcomponentPrefix:w,root:o,languageServices:s,clearScreen:!1,base:d,resolve:{conditions:["production"],dedupe:["react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client"],alias:{...viteAliases(),"likec4/previews":e}},configFile:!1,mode:"production",optimizeDeps:{force:!0,include:["react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react/jsx-dev-runtime","react-dom/client"]},define:{WEBCOMPONENT_PREFIX:JSON.stringify(w),__USE_STYLE_BUNDLE__:"false",__USE_OVERVIEW_GRAPH__:a?"true":"false",__USE_HASH_HISTORY__:t?.useHashHistory===!0?"true":"false","process.env.NODE_ENV":'"production"'},build:{outDir:l,modulePreload:!1,emptyOutDir:!1,cssCodeSplit:!1,sourcemap:!1,cssMinify:!0,minify:!0,copyPublicDir:!0,chunkSizeWarningLimit,rollupOptions:{treeshake:{preset:"recommended"},output:{hoistTransitiveImports:!1,compact:!0}}},customLogger:n,plugins:[c__default(),likec4Plugin({languageServices:s,useOverviewGraph:a})]}};async function viteWebcomponentConfig({languageServices:s,outDir:e,base:t,webcomponentPrefix:n="likec4",filename:o="likec4-views.js"}){const a=LikeC4.j("c4:lib"),l=viteAppRoot();return a.info(LikeC4.p.cyan("outDir")+" "+LikeC4.p.dim(e)),{root:l,clearScreen:!1,base:t,configFile:!1,publicDir:!1,mode:"production",resolve:{conditions:["production"]},define:{WEBCOMPONENT_PREFIX:JSON.stringify(n),"process.env.NODE_ENV":'"production"'},esbuild:{...JsBanners},build:{outDir:e,emptyOutDir:!1,sourcemap:!1,minify:!0,assetsInlineLimit:100*1024,chunkSizeWarningLimit,lib:{entry:"webcomponent/webcomponent.js",fileName(d,w){return o},formats:["iife"],name:"LikeC4Views"},commonjsOptions:{defaultIsModuleExports:d=>d.includes("react")?!0:"auto",requireReturnsDefault:"auto"},rollupOptions:{treeshake:{preset:"recommended"},output:{format:"iife",hoistTransitiveImports:!1,compact:!0}}},customLogger:a,plugins:[likec4Plugin({languageServices:s,useOverviewGraph:!1})]}}const Assets=["favicon.ico","robots.txt"],viteBuild=async({buildWebcomponent:s=!0,webcomponentPrefix:e="likec4",languageServices:t,likec4AssetsDir:n,...o})=>{n??=await fsPromises.mkdtemp(path$1.join(os.tmpdir(),".likec4-assets-"));const{isDev:a,...l}=await viteConfig({...o,languageServices:t,likec4AssetsDir:n,webcomponentPrefix:e}),d=await mkTempPublicDir();for(const E of Assets){const y=path$1.resolve(l.root,E);fs.existsSync(y)&&fs.copyFileSync(y,path$1.resolve(d,E))}const w=await t.diagrams();if(w.length===0)throw process.exitCode=1,new Error("no views found");if(w.forEach(E=>{E.hasLayoutDrift&&l.customLogger.warn(LikeC4.p.yellow("drift detected, manual layout can not be applied, view:")+" "+LikeC4.p.red(E.id))}),s){const E=await viteWebcomponentConfig({webcomponentPrefix:e,languageServices:t,outDir:d,base:l.base});await vite.build(E)}await vite.build({...l,publicDir:d,mode:"production"});const _=path$1.resolve(l.build.outDir,"index.html");fs.existsSync(_)&&fs.copyFileSync(_,path$1.resolve(l.build.outDir,"404.html"))};function resolveServerUrl(s){if(s.resolvedUrls)return LikeC4.o(s.resolvedUrls.network)??LikeC4.o(s.resolvedUrls.local)}function printServerUrls(s){if(!s.resolvedUrls)throw new Error("Vite server is not ready, no resolvedUrls");LikeC4.Y.box([LikeC4.p.green("LikeC4 served at:"),"",LikeC4.p.dim("Local: ")+s.resolvedUrls.local.join(`
414
- `+"".padEnd(9," ")),LikeC4.p.dim("Network: ")+s.resolvedUrls.network.join(`
413
+ `}const P={id:"virtual:likec4/dot-sources",virtualId:"\0likec4-plugin/dot-sources.js",async load({likec4:i,logger:e}){e.info(LikeC4.p.dim("generating virtual:likec4/dot-sources"));const t=await i.viewsService.viewsAsGraphvizOut(),n=LikeC4.l(t,({id:s,svg:o,dot:a})=>[s,{dot:a,svg:o}]);return generateDotSources(n)}},V={id:"virtual:likec4/d2-sources",virtualId:"\0likec4-plugin/d2-sources.js",async load({likec4:i,logger:e}){e.info(LikeC4.p.dim("generating virtual:likec4/d2-sources"));const t=await i.viewsService.computedViews();return generateD2Sources(t)}},j={id:"virtual:likec4/mmd-sources",virtualId:"\0likec4-plugin/mmd-sources.js",async load({likec4:i,logger:e}){e.info(LikeC4.p.dim("generating virtual:likec4/mmd-sources"));const t=await i.viewsService.computedViews();return generateMmdSources(t)}},C={id:"virtual:likec4/icons",virtualId:"\0likec4-plugin/icons.js",async load({likec4:i,logger:e}){e.info(LikeC4.p.dim("generating virtual:likec4/icons"));const t=await i.viewsService.computedViews();return generateIconRendererSource(t)}},O={id:"virtual:likec4/overview-graph",virtualId:"\0likec4-plugin/overview-graph.js",async load({likec4:i,logger:e,useOverviewGraph:t}){if(t===!0)try{e.info(LikeC4.p.dim("generating virtual:likec4/overview-graph"));const n=await i.viewsService.overviewGraph();return generateOverviewGraphSource(n)}catch(n){e.error(n)}return e.info(LikeC4.p.dim("generating empty virtual:likec4/overview-graph")),generateOverviewGraphSource({nodes:[],edges:[],bounds:{x:0,y:0,width:10,height:10}})}},m={id:"virtual:likec4/previews",virtualId:"\0likec4-plugin/previews.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(LikeC4.p.dim("generating virtual:likec4/previews"));const n=await i.viewsService.computedViews();return diagramPreviewsSources(n,t)}},G={id:"virtual:likec4/model",virtualId:"\0likec4-plugin/model.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(LikeC4.p.dim("generating virtual:likec4/model"));const n=await i.layoutedModel();return likec4ModelSources(n)}},modules=[C,P,V,j,O,m,G],$=i=>{const e=i.toLowerCase();return e.endsWith(".c4")||e.endsWith(".likec4")||e.endsWith(".like-c4")};function likec4Plugin({useOverviewGraph:i=!1,languageServices:e}){let t,n=e.workspace;return{name:"vite-plugin-likec4",configResolved(s){if(t=s.logger,i){const o=s.resolve.alias.find(a=>a.find==="likec4/previews")?.replacement;o?(n=o,t.info(LikeC4.p.dim("likec4/previews alias")+" "+LikeC4.p.dim(n))):t.warn("likec4/previews alias not found")}},resolveId(s){const o=modules.find(a=>a.id===s);return o?o.virtualId:null},async load(s){const o=modules.find(a=>a.virtualId===s);return o?await o.load({logger:t,likec4:e,assetsDir:n,useOverviewGraph:i}):null},configureServer(s){const o=LikeC4.e(1),a=()=>{o.clearQueue(),o(async()=>{const[B]=e.getErrors();if(B){s.ws.send({type:"error",err:{name:"LikeC4ValidationError",message:"Validation error: "+B.message.slice(0,500),stack:"",plugin:"vite-plugin-likec4",loc:{file:B.sourceFsPath,line:B.range.start.line+1,column:B.range.start.character+1}}});return}for(const w of modules){const E=s.moduleGraph.getModuleById(w.virtualId);if(E&&E.importers.size>0){t.info(`${LikeC4.p.green("trigger hmr")} ${LikeC4.p.dim(E.url)}`);try{await s.reloadModule(E)}catch(_){t.error(_)}}}})},l=e.workspace;t.info(`${LikeC4.p.dim("watch")} ${l}`);const d=B=>w=>{$(w)&&e.notifyUpdate({[B]:w})};if(s.watcher.add(l).on("add",d("changed")).on("change",d("changed")).on("unlink",d("removed")),i&&!n.startsWith(e.workspace)){t.info(`${LikeC4.p.dim("watch")} ${n}`);const B=()=>{const w=s.moduleGraph.getModuleById(m.virtualId);w&&w.importers.size>0&&s.reloadModule(w)};s.watcher.add(n).on("add",B).on("change",B).on("unlink",B)}e.onModelUpdate(()=>{LikeC4.H.debug("likec4 model update"),a()})}}}const viteConfig=async({languageServices:i,likec4AssetsDir:e,...t})=>{const n=t.customLogger??LikeC4.h("c4:vite"),s=viteAppRoot(),o=t?.useOverviewGraph===!0;n.info(`${LikeC4.p.cyan("likec4 app root")} ${LikeC4.p.dim(s)}`);const a=t.outputDir??path$1.resolve(i.workspace,"dist");n.info(LikeC4.p.cyan("output")+" "+LikeC4.p.dim(a));let l="/";t.base&&(l=LikeC4.w(t.base),!LikeC4.j(l)&&l!=="./"&&(l=LikeC4.k(l))),l!=="/"&&n.info(`${LikeC4.p.green("app base url")} ${LikeC4.p.dim(l)}`);const d=t.webcomponentPrefix??"likec4";return{isDev:!1,likec4AssetsDir:e,webcomponentPrefix:d,root:s,languageServices:i,clearScreen:!1,base:l,resolve:{conditions:["production"],dedupe:["react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client"],alias:{...viteAliases(),"likec4/previews":e}},configFile:!1,mode:"production",optimizeDeps:{force:!0,include:["react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react/jsx-dev-runtime","react-dom/client"]},define:{WEBCOMPONENT_PREFIX:JSON.stringify(d),__USE_STYLE_BUNDLE__:"false",__USE_OVERVIEW_GRAPH__:o?"true":"false",__USE_HASH_HISTORY__:t?.useHashHistory===!0?"true":"false","process.env.NODE_ENV":'"production"'},build:{outDir:a,modulePreload:!1,emptyOutDir:!1,cssCodeSplit:!1,sourcemap:!1,cssMinify:!0,minify:!0,copyPublicDir:!0,chunkSizeWarningLimit,rollupOptions:{treeshake:{preset:"recommended"},output:{hoistTransitiveImports:!1,compact:!0}}},customLogger:n,plugins:[c__default(),likec4Plugin({languageServices:i,useOverviewGraph:o})]}};async function viteWebcomponentConfig({languageServices:i,outDir:e,base:t,webcomponentPrefix:n="likec4",filename:s="likec4-views.js"}){const o=LikeC4.h("c4:lib"),a=viteAppRoot();return o.info(LikeC4.p.cyan("outDir")+" "+LikeC4.p.dim(e)),{root:a,clearScreen:!1,base:t,configFile:!1,publicDir:!1,mode:"production",resolve:{conditions:["production"]},define:{WEBCOMPONENT_PREFIX:JSON.stringify(n),"process.env.NODE_ENV":'"production"'},esbuild:{...JsBanners},build:{outDir:e,emptyOutDir:!1,sourcemap:!1,minify:!0,assetsInlineLimit:100*1024,chunkSizeWarningLimit,lib:{entry:"webcomponent/webcomponent.js",fileName(l,d){return s},formats:["iife"],name:"LikeC4Views"},commonjsOptions:{defaultIsModuleExports:l=>l.includes("react")?!0:"auto",requireReturnsDefault:"auto"},rollupOptions:{treeshake:{preset:"recommended"},output:{format:"iife",hoistTransitiveImports:!1,compact:!0}}},customLogger:o,plugins:[likec4Plugin({languageServices:i,useOverviewGraph:!1})]}}const Assets=["favicon.ico","robots.txt"],viteBuild=async({buildWebcomponent:i=!0,webcomponentPrefix:e="likec4",languageServices:t,likec4AssetsDir:n,...s})=>{n??=await fsPromises.mkdtemp(path$1.join(os.tmpdir(),".likec4-assets-"));const{isDev:o,...a}=await viteConfig({...s,languageServices:t,likec4AssetsDir:n,webcomponentPrefix:e}),l=await mkTempPublicDir();for(const w of Assets){const E=path$1.resolve(a.root,w);fs.existsSync(E)&&fs.copyFileSync(E,path$1.resolve(l,w))}const d=await t.diagrams();if(d.length===0)throw process.exitCode=1,new Error("no views found");if(d.forEach(w=>{w.hasLayoutDrift&&a.customLogger.warn(LikeC4.p.yellow("drift detected, manual layout can not be applied, view:")+" "+LikeC4.p.red(w.id))}),i){const w=await viteWebcomponentConfig({webcomponentPrefix:e,languageServices:t,outDir:l,base:a.base});await vite.build(w)}await vite.build({...a,publicDir:l,mode:"production"});const B=path$1.resolve(a.build.outDir,"index.html");fs.existsSync(B)&&fs.copyFileSync(B,path$1.resolve(a.build.outDir,"404.html"))};function resolveServerUrl(i){if(i.resolvedUrls)return LikeC4.m(i.resolvedUrls.network)??LikeC4.m(i.resolvedUrls.local)}function printServerUrls(i){if(!i.resolvedUrls)throw new Error("Vite server is not ready, no resolvedUrls");LikeC4.H.box([LikeC4.p.green("LikeC4 served at:"),"",LikeC4.p.dim("Local: ")+i.resolvedUrls.local.join(`
414
+ `+"".padEnd(9," ")),LikeC4.p.dim("Network: ")+i.resolvedUrls.network.join(`
415
415
  `+"".padEnd(9," "))].join(`
416
- `))}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}),_=await getPorts({port:[5173,...portNumbers(61e3,61010),...portNumbers(62002,62010)]}),E=await getPorts({port:portNumbers(24678,24690)}),y=await mkTempPublicDir();let L;if(s){const K=await viteWebcomponentConfig({webcomponentPrefix:t,languageServices:n,outDir:y,base:w.base});L=vite.build({...K,logLevel:"warn"}).catch(z=>(LikeC4.Y.warn("webcomponent build failed",z),LikeC4.Y.warn("Ignoring error and continuing"),Promise.resolve()))}const W=await vite.createServer({...w,define:Object.assign({},w.define,e&&{"process.env.NODE_ENV":'"development"'}),mode:e?"development":w.mode,publicDir:y,server:{host:"0.0.0.0",port:_,hmr:e&&{overlay:!0,port:E},fs:{strict:!1},open:a??!d}});return await W.listen(),L&&await L,W}async function takeScreenshot({browserContext:s,views:e,output:t,logger:n,timeout:o,maxAttempts:a,outputType:l,theme:d}){let w;const _=e.map(L=>({view:L,attempt:1})),E=[];let y;for(;y=_.shift();){const{view:L,attempt:W}=y,K=`/export/${encodeURIComponent(L.id)}`;try{if(W>1){w&&(w.close({runBeforeUnload:!0}).catch(ce=>n.error(`failed to close page: ${ce}`)),w=void 0);const te=LikeC4.u(W*200,{min:200,max:1e3});n.info(LikeC4.p.cyan(K)+LikeC4.p.dim(` attempt ${W} of ${a} after ${te}ms`)),await promises.setTimeout(te)}else L.hasLayoutDrift&&n.warn(LikeC4.p.yellow("Drift detected, manual layout can not be applied, view may be invalid: ")+LikeC4.p.red(L.id)),n.info(LikeC4.p.cyan(K));w??=await s.newPage(),await w.setViewportSize({width:L.bounds.width+20*2,height:L.bounds.height+20*2}),await w.goto(K+`?padding=20&theme=${d}`);const z=w.getByRole("presentation");await z.waitFor(),L.nodes.some(te=>LikeC4.d(te.icon)&&te.icon.toLowerCase().startsWith("http"))&&await I(w,o);let N=".";l==="relative"&&(N=L.relativePath??".",N.includes("/")?N=N.slice(0,N.lastIndexOf("/")):N=".");const Q=path$1.resolve(t,N,`${L.id}.png`);await z.screenshot({path:Q,omitBackground:!0}),E.push({view:L,path:Q})}catch(z){w?.close({runBeforeUnload:!0}).catch(N=>n.error(`failed to close page: ${N}`)),n.error(LikeC4.p.red("failed "+K+`
417
- `+z)),W<a&&(_.push({view:L,attempt:W+1}),n.info(LikeC4.p.dim(`retry ${K}`))),w=void 0}}return E}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 _=await playwright.chromium.launch();s.info(LikeC4.p.cyan("Color scheme: ")+t);const E=await _.newContext({deviceScaleFactor:2,colorScheme:t,baseURL:e,ignoreHTTPSErrors:!0,reducedMotion:"reduce",isMobile:!1});E.setDefaultNavigationTimeout(n),E.setDefaultTimeout(n);try{return await takeScreenshot({browserContext:E,views:o,output:a,outputType:l,logger:s,maxAttempts:d,timeout:n,theme:t})}finally{s.info(LikeC4.p.cyan("close chromium")),await E.close(),await _.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 _=LikeC4.j("c4:export"),E=process$1.hrtime(),y=await LikeC4.L.fromWorkspace(s,{logger:"vite",graphviz:e?"binary":"wasm"});n??=y.workspace;const L=await y.diagrams();if(!core.hasAtLeast(L,1))throw _.warn("no views found"),new Error("no views found");let W;if(!a&&(_.info(LikeC4.p.cyan("start preview server")),W=await viteDev({languageServices:y,buildWebcomponent:!1,openBrowser:!1,useOverviewGraph:!1,hmr:!1}),a=resolveServerUrl(W),!a))throw _.error("Vite server is not ready, no resolvedUrls"),new Error("Vite server is not ready, no resolvedUrls");try{const K=await exportViewsToPNG({logger:_,serverUrl:a,theme:t,timeoutMs:d,views:L,output:n,outputType:o,maxAttempts:w}),{pretty:z}=LikeC4.q(E);if(K.length>0&&_.info(LikeC4.p.green(`exported ${K.length} views in ${z}`)),K.length!==L.length&&(l&&K.length>0?_.info(LikeC4.p.dim("ignore")+" "+LikeC4.p.red(`failed ${L.length-K.length} out of ${L.length} views`)):_.error(LikeC4.p.red(`failed ${L.length-K.length} out of ${L.length} views`))),K.length!==L.length&&(K.length===0||!l))throw new Error(`Failed ${L.length-K.length} out of ${L.length} views`)}finally{W&&(_.info(LikeC4.p.cyan("stop server")),await W.close().catch(K=>{_.error(K)}))}}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"}),_=a??path$1.resolve(w.workspace,"dist");let E=path$1.resolve(_,"assets");if(o)try{E=path$1.resolve(_,"assets","previews"),await fsPromises.mkdir(E,{recursive:!0}),d.info(`${p("Generate previews")} ${f(E)}
418
- `),await pngHandler({path:s,useDotBin:e,output:E,outputType:"flat",ignore:!0})}catch(y){d.error(LikeC4.p.red("Failed to generate previews")),d.error(y),d.warn(LikeC4.p.yellow("Ignore previews and continue build")),fs.rmSync(E,{recursive:!0,force:!0}),o=!1}await viteBuild({base:l,useHashHistory:t,customLogger:d,useOverviewGraph:o,webcomponentPrefix:n,languageServices:w,likec4AssetsDir:E,outputDir:a}),o&&(d.info(`${p("clean previews")} ${f(E)}`),fs.rmSync(E,{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 _=path$1.resolve(e,w,l.id+".dot");core.invariant(d,`dot for ${l.id} not found`),await fsPromises.writeFile(_,d),t.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),_)}`),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:core.nonexhaustive(e)}const l=new Set,d=await s.diagrams();let w=0;for(const _ of d)try{let E=_.relativePath??".";E.includes("/")?E=E.slice(0,E.lastIndexOf("/")):E=".",E!==""&&!l.has(E)&&(await fsPromises.mkdir(path$1.resolve(t,E),{recursive:!0}),l.add(E));const y=path$1.resolve(t,E,_.id+o),L=a(_);await fsPromises.writeFile(y,L),n.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),y)}`),w++}catch(E){n.error(`error while generating ${_.id}`,{error:E})}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:core.nonexhaustive(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 y of l.views())y.$view.hasLayoutDrift&&n.warn(LikeC4.p.yellow("drift detected, manual layout can not be applied, view:")+" "+LikeC4.p.red(y.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 _=path$1.extname(w).toLocaleLowerCase();if(![".ts",".mts",".cts"].includes(_))throw n.error(`output file ${t} has extension "${_}"`),new Error(`output file ${t} must be a .ts, .mts or .cts file`);const E=path$1.dirname(d);n.info(`${LikeC4.p.dim("outdir")} ${E}`),await fsPromises.mkdir(E,{recursive:!0}),await fsPromises.writeFile(d,q(l),{encoding:"utf-8"}),LikeC4.Y.box({message:LikeC4.r(`
416
+ `))}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 i=os__default.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(const t of Object.values(i))for(const n of t)e.add(n.address);return e},checkAvailablePort=i=>new Promise((e,t)=>{const n=net__default.createServer();n.unref(),n.on("error",t),n.listen(i,()=>{const{port:s}=n.address();n.close(()=>{e(s)})})}),getAvailablePort=async(i,e)=>{if(i.host||i.port===0)return checkAvailablePort(i);for(const t of e)try{await checkAvailablePort({port:i.port,host:t})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return i.port},portCheckSequence=function*(i){i&&(yield*i),yield 0};async function getPorts(i){let e,t=new Set;if(i&&(i.port&&(e=typeof i.port=="number"?[i.port]:i.port),i.exclude)){const s=i.exclude;if(typeof s[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(const o of s){if(typeof o!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(o))throw new TypeError(`Number ${o} in the exclude option is not a safe integer and can't be used`)}t=new Set(s)}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 s of portCheckSequence(e))try{if(t.has(s))continue;let o=await getAvailablePort({...i,port:s},n);for(;lockedPorts.old.has(o)||lockedPorts.young.has(o);){if(s!==0)throw new Locked(s);o=await getAvailablePort({...i,port:s},n)}return lockedPorts.young.add(o),o}catch(o){if(!["EADDRINUSE","EACCES"].includes(o.code)&&!(o instanceof Locked))throw o}throw new Error("No available ports found")}function portNumbers(i,e){if(!Number.isInteger(i)||!Number.isInteger(e))throw new TypeError("`from` and `to` must be integer numbers");if(i<minPort||i>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(i>e)throw new RangeError("`to` must be greater than or equal to `from`");return function*(n,s){for(let o=n;o<=s;o++)yield o}(i,e)}async function viteDev({buildWebcomponent:i=!0,hmr:e=!0,webcomponentPrefix:t="likec4",languageServices:n,likec4AssetsDir:s,openBrowser:o,...a}){s??=await fsPromises.mkdtemp(path$1.join(os.tmpdir(),".likec4-assets-"));const{isDev:l,...d}=await viteConfig({...a,languageServices:n,likec4AssetsDir:s,webcomponentPrefix:t}),B=await getPorts({port:[5173,...portNumbers(61e3,61010),...portNumbers(62002,62010)]}),w=await getPorts({port:portNumbers(24678,24690)}),E=await mkTempPublicDir();let _;if(i){const H=await viteWebcomponentConfig({webcomponentPrefix:t,languageServices:n,outDir:E,base:d.base});_=vite.build({...H,logLevel:"warn"}).catch(W=>(LikeC4.H.warn("webcomponent build failed",W),LikeC4.H.warn("Ignoring error and continuing"),Promise.resolve()))}const U=await vite.createServer({...d,define:Object.assign({},d.define,e&&{"process.env.NODE_ENV":'"development"'}),mode:e?"development":d.mode,publicDir:E,server:{host:"0.0.0.0",port:B,hmr:e&&{overlay:!0,port:w},fs:{strict:!1},open:o??!l}});return await U.listen(),_&&await _,U}async function takeScreenshot({browserContext:i,views:e,output:t,logger:n,timeout:s,maxAttempts:o,outputType:a,theme:l}){let d;const B=e.map(_=>({view:_,attempt:1})),w=[];let E;for(;E=B.shift();){const{view:_,attempt:U}=E,H=`/export/${encodeURIComponent(_.id)}`;try{if(U>1){d&&(d.close({runBeforeUnload:!0}).catch(ae=>n.error(`failed to close page: ${ae}`)),d=void 0);const ee=LikeC4.u(U*200,{min:200,max:1e3});n.info(LikeC4.p.cyan(H)+LikeC4.p.dim(` attempt ${U} of ${o} after ${ee}ms`)),await promises.setTimeout(ee)}else _.hasLayoutDrift&&n.warn(LikeC4.p.yellow("Drift detected, manual layout can not be applied, view may be invalid: ")+LikeC4.p.red(_.id)),n.info(LikeC4.p.cyan(H));d??=await i.newPage(),await d.setViewportSize({width:_.bounds.width+20*2,height:_.bounds.height+20*2}),await d.goto(H+`?padding=20&theme=${l}`);const W=d.getByRole("presentation");await W.waitFor(),_.nodes.some(ee=>LikeC4.d(ee.icon)&&ee.icon.toLowerCase().startsWith("http"))&&await I(d,s);let L=".";a==="relative"&&(L=_.relativePath??".",L.includes("/")?L=L.slice(0,L.lastIndexOf("/")):L=".");const K=path$1.resolve(t,L,`${_.id}.png`);await W.screenshot({path:K,omitBackground:!0}),w.push({view:_,path:K})}catch(W){d?.close({runBeforeUnload:!0}).catch(L=>n.error(`failed to close page: ${L}`)),n.error(LikeC4.p.red("failed "+H+`
417
+ `+W)),U<o&&(B.push({view:_,attempt:U+1}),n.info(LikeC4.p.dim(`retry ${H}`))),d=void 0}}return w}async function I(i,e){let t=await i.locator("//img").all();if(!t.length)return;const n=t.map(s=>s.evaluate(o=>o.complete||new Promise((a,l)=>{o.onload=a,o.onerror=l}),{timeout:Math.max(3e4,e)}));await Promise.allSettled(n)}async function exportViewsToPNG({logger:i,serverUrl:e,theme:t="light",timeoutMs:n=15e3,views:s,output:o,outputType:a="relative",maxAttempts:l=3}){i.info(`${LikeC4.p.cyan("export output")} ${LikeC4.p.dim(o)}`),i.info(`${LikeC4.p.cyan("from server")} ${LikeC4.p.dim(e)}`);const d=playwright.chromium.executablePath();i.info(LikeC4.p.cyan("Start chromium")),i.info(LikeC4.p.dim(d));const B=await playwright.chromium.launch();i.info(LikeC4.p.cyan("Color scheme: ")+t);const w=await B.newContext({deviceScaleFactor:2,colorScheme:t,baseURL:e,ignoreHTTPSErrors:!0,reducedMotion:"reduce",isMobile:!1});w.setDefaultNavigationTimeout(n),w.setDefaultTimeout(n);try{return await takeScreenshot({browserContext:w,views:s,output:o,outputType:a,logger:i,maxAttempts:l,timeout:n,theme:t})}finally{i.info(LikeC4.p.cyan("close chromium")),await w.close(),await B.close()}}async function pngHandler({path:i,useDotBin:e,theme:t="light",output:n,outputType:s,serverUrl:o,ignore:a=!1,timeoutMs:l=1e4,maxAttempts:d=3}){const B=LikeC4.h("c4:export"),w=process$1.hrtime(),E=await LikeC4.L.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n??=E.workspace;const _=await E.diagrams();if(!core.hasAtLeast(_,1))throw B.warn("no views found"),new Error("no views found");let U;if(!o&&(B.info(LikeC4.p.cyan("start preview server")),U=await viteDev({languageServices:E,buildWebcomponent:!1,openBrowser:!1,useOverviewGraph:!1,hmr:!1}),o=resolveServerUrl(U),!o))throw B.error("Vite server is not ready, no resolvedUrls"),new Error("Vite server is not ready, no resolvedUrls");try{const H=await exportViewsToPNG({logger:B,serverUrl:o,theme:t,timeoutMs:l,views:_,output:n,outputType:s,maxAttempts:d}),{pretty:W}=LikeC4.o(w);if(H.length>0&&B.info(LikeC4.p.green(`exported ${H.length} views in ${W}`)),H.length!==_.length&&(a&&H.length>0?B.info(LikeC4.p.dim("ignore")+" "+LikeC4.p.red(`failed ${_.length-H.length} out of ${_.length} views`)):B.error(LikeC4.p.red(`failed ${_.length-H.length} out of ${_.length} views`))),H.length!==_.length&&(H.length===0||!a))throw new Error(`Failed ${_.length-H.length} out of ${_.length} views`)}finally{U&&(B.info(LikeC4.p.cyan("stop server")),await U.close().catch(H=>{B.error(H)}))}}const{cyan:p,dim:f}=LikeC4.p;async function buildHandler({path:i,useDotBin:e,useHashHistory:t,webcomponentPrefix:n,useOverview:s=!1,output:o,base:a}){const l=LikeC4.h("c4:build"),d=await LikeC4.L.fromWorkspace(i,{graphviz:e?"binary":"wasm",logger:"vite"}),B=o??path$1.resolve(d.workspace,"dist");let w=path$1.resolve(B,"assets");if(s)try{w=path$1.resolve(B,"assets","previews"),await fsPromises.mkdir(w,{recursive:!0}),l.info(`${p("Generate previews")} ${f(w)}
418
+ `),await pngHandler({path:i,useDotBin:e,output:w,outputType:"flat",ignore:!0})}catch(E){l.error(LikeC4.p.red("Failed to generate previews")),l.error(E),l.warn(LikeC4.p.yellow("Ignore previews and continue build")),fs.rmSync(w,{recursive:!0,force:!0}),s=!1}await viteBuild({base:a,useHashHistory:t,customLogger:l,useOverviewGraph:s,webcomponentPrefix:n,languageServices:d,likec4AssetsDir:w,outputDir:o}),s&&(l.info(`${p("clean previews")} ${f(w)}`),fs.rmSync(w,{recursive:!0,force:!0}))}const buildCmd={command:"build [path]",aliases:["bundle"],describe:"Build a static website",builder:i=>i.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 i=>{await buildHandler({path:i.path,output:i.output,base:i.base,useHashHistory:i["use-hash-history"],useDotBin:i["use-dot"],useOverview:i["use-overview"]??!1,webcomponentPrefix:i["webcomponent-prefix"]})}};async function A(i,e,t){const n=".ts";e=e??path$1.resolve(i.workspace,"likec4.generated"+n),path$1.extname(e)!==n&&(e=e+n),await fsPromises.mkdir(path$1.dirname(e),{recursive:!0});const s=await i.diagrams(),o=J([...s]);await fsPromises.writeFile(e,o),t.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),e)}`)}async function D(i,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,s=await i.viewsService.layoutAllViews();let o=0;for(const{diagram:a,dot:l}of s)try{const d=a.relativePath??"";d!==""&&!n.has(d)&&(await fsPromises.mkdir(path$1.resolve(e,d),{recursive:!0}),n.add(d));const B=path$1.resolve(e,d,a.id+".dot");core.invariant(l,`dot for ${a.id} not found`),await fsPromises.writeFile(B,l),t.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),B)}`),o++}catch(d){t.error(`error while generating ${a.id}`,{error:d})}o>0&&t.info(`${LikeC4.p.dim("total")} ${o} files`)}async function F(i,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 s,o;switch(e){case"d2":s=".d2",o=P$1;break;case"mermaid":s=".mmd",o=S;break;default:core.nonexhaustive(e)}const a=new Set,l=await i.diagrams();let d=0;for(const B of l)try{let w=B.relativePath??".";w.includes("/")?w=w.slice(0,w.lastIndexOf("/")):w=".",w!==""&&!a.has(w)&&(await fsPromises.mkdir(path$1.resolve(t,w),{recursive:!0}),a.add(w));const E=path$1.resolve(t,w,B.id+s),_=o(B);await fsPromises.writeFile(E,_),n.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),E)}`),d++}catch(w){n.error(`error while generating ${B.id}`,{error:w})}d>0&&n.info(`${LikeC4.p.dim("total")} ${d} files`)}async function legacyHandler({path:i,useDotBin:e,...t}){const n=LikeC4.h("c4:codegen"),s=LikeC4.s(n),o=await LikeC4.L.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});if((await o.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(o,t.outfile,n);break}case"dot":{await D(o,t.outdir??i,n);break}case"d2":case"mermaid":{await F(o,t.format,t.outdir??i,n);break}default:core.nonexhaustive(t)}s.stopAndLog()}async function modelHandler({path:i,useDotBin:e,outfile:t}){const n=LikeC4.h("c4:codegen"),s=LikeC4.s(n),o=await LikeC4.L.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n.info(`${LikeC4.p.dim("format")} ${LikeC4.p.green("model")}`);const a=await o.layoutedModel();for(const E of a.views())E.$view.hasLayoutDrift&&n.warn(LikeC4.p.yellow("drift detected, manual layout can not be applied, view:")+" "+LikeC4.p.red(E.id));let l=path$1.resolve(o.workspace,"likec4-model.ts");if(t&&(l=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 d=path$1.basename(l);n.info(`${LikeC4.p.dim("filename")} ${d}`);const B=path$1.extname(d).toLocaleLowerCase();if(![".ts",".mts",".cts"].includes(B))throw n.error(`output file ${t} has extension "${B}"`),new Error(`output file ${t} must be a .ts, .mts or .cts file`);const w=path$1.dirname(l);n.info(`${LikeC4.p.dim("outdir")} ${w}`),await fsPromises.mkdir(w,{recursive:!0}),await fsPromises.writeFile(l,q(a),{encoding:"utf-8"}),LikeC4.H.box({message:LikeC4.q(`
419
419
  ${LikeC4.p.dim("Source with LikeC4Model generated:")}
420
- ${path$1.relative(process$1.cwd(),d)}
420
+ ${path$1.relative(process$1.cwd(),l)}
421
421
 
422
422
  ${LikeC4.p.dim("How to use:")}
423
423
  ${LikeC4.p.underline("https://likec4.dev/tooling/code-generation/model/")}
424
- `).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),o.stopAndLog()}async function viteReactConfig({languageServices:s,outDir:e,filename:t="likec4-react.mjs"}){const n=LikeC4.j("c4:react"),o=viteAppRoot();return n.info(`${LikeC4.p.cyan("likec4 app root")} ${LikeC4.p.dim(o)}`),n.info(LikeC4.p.cyan("outDir")+" "+LikeC4.p.dim(e)),{customLogger:n,root:o,configFile:!1,clearScreen:!1,publicDir:!1,mode:"production",resolve:{conditions:["production"],alias:viteAliases()},esbuild:{banner:`'use client'
425
- `+JsBanners.banner,footer:JsBanners.footer,jsx:"transform",jsxDev:!1,jsxSideEffects:!1,minifyIdentifiers:!1,minifySyntax:!1,minifyWhitespace:!1,tsconfigRaw:{compilerOptions:{target:"ES2022",useDefineForClassFields:!0,verbatimModuleSyntax:!0,jsx:"react-jsx"}}},build:{outDir:e,emptyOutDir:!1,sourcemap:!1,minify:!1,target:"es2022",copyPublicDir:!1,chunkSizeWarningLimit,lib:{entry:"react/likec4.tsx",fileName(a,l){return t},formats:["es"]},rollupOptions:{output:{compact:!1,exports:"named"},external:["likec4/react","likec4/model","react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client",/likec4\/icons\/.*/],onwarn(a,l){a.code!=="SOURCEMAP_ERROR"&&l(a)}}},plugins:[c__default({}),likec4Plugin({languageServices:s,useOverviewGraph:!1})]}}async function reactHandler({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("react")}`);const l=await a.diagrams();if(l.length===0)throw process.exitCode=1,new Error("no views found");l.forEach(W=>{W.hasLayoutDrift&&n.warn(LikeC4.p.yellow("drift detected, manual layout can not be applied, view:")+" "+LikeC4.p.red(W.id))});let d=path$1.resolve(a.workspace,"likec4-views.js");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.dirname(d);n.info(`${LikeC4.p.dim("outdir")} ${w}`);const _=path$1.basename(d);n.info(`${LikeC4.p.dim("filename")} ${_}`);const E=path$1.extname(_).toLocaleLowerCase();if(![".js",".mjs",".jsx"].includes(E))throw n.error(`output file ${t} has extension "${E}"`),new Error(`output file ${t} must be a .js, .jsx or .mjs`);const y=await viteReactConfig({languageServices:a,outDir:w,filename:_});await vite.build({...y,logLevel:"warn"});const L=await a.layoutedModel();await fsPromises.writeFile(path$1.resolve(w,path$1.basename(d,E)+(E===".mjs"?".d.mts":".d.ts")),Y(L)),LikeC4.Y.box({message:LikeC4.r(`
424
+ `).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),s.stopAndLog()}async function viteReactConfig({languageServices:i,outDir:e,filename:t="likec4-react.mjs"}){const n=LikeC4.h("c4:react"),s=viteAppRoot();return n.info(`${LikeC4.p.cyan("likec4 app root")} ${LikeC4.p.dim(s)}`),n.info(LikeC4.p.cyan("outDir")+" "+LikeC4.p.dim(e)),{customLogger:n,root:s,configFile:!1,clearScreen:!1,publicDir:!1,mode:"production",resolve:{conditions:["production"],alias:viteAliases()},esbuild:{banner:`'use client'
425
+ `+JsBanners.banner,footer:JsBanners.footer,jsx:"transform",jsxDev:!1,jsxSideEffects:!1,minifyIdentifiers:!1,minifySyntax:!1,minifyWhitespace:!1,tsconfigRaw:{compilerOptions:{target:"ES2022",useDefineForClassFields:!0,verbatimModuleSyntax:!0,jsx:"react-jsx"}}},build:{outDir:e,emptyOutDir:!1,sourcemap:!1,minify:!1,target:"es2022",copyPublicDir:!1,chunkSizeWarningLimit,lib:{entry:"react/likec4.tsx",fileName(o,a){return t},formats:["es"]},rollupOptions:{output:{compact:!1,exports:"named"},external:["likec4/react","likec4/model","react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client",/likec4\/icons\/.*/],onwarn(o,a){o.code!=="SOURCEMAP_ERROR"&&a(o)}}},plugins:[c__default({}),likec4Plugin({languageServices:i,useOverviewGraph:!1})]}}async function reactHandler({path:i,useDotBin:e,outfile:t}){const n=LikeC4.h("c4:codegen"),s=LikeC4.s(n),o=await LikeC4.L.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n.info(`${LikeC4.p.dim("format")} ${LikeC4.p.green("react")}`);const a=await o.diagrams();if(a.length===0)throw process.exitCode=1,new Error("no views found");a.forEach(U=>{U.hasLayoutDrift&&n.warn(LikeC4.p.yellow("drift detected, manual layout can not be applied, view:")+" "+LikeC4.p.red(U.id))});let l=path$1.resolve(o.workspace,"likec4-views.js");if(t&&(l=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 d=path$1.dirname(l);n.info(`${LikeC4.p.dim("outdir")} ${d}`);const B=path$1.basename(l);n.info(`${LikeC4.p.dim("filename")} ${B}`);const w=path$1.extname(B).toLocaleLowerCase();if(![".js",".mjs",".jsx"].includes(w))throw n.error(`output file ${t} has extension "${w}"`),new Error(`output file ${t} must be a .js, .jsx or .mjs`);const E=await viteReactConfig({languageServices:o,outDir:d,filename:B});await vite.build({...E,logLevel:"warn"});const _=await o.layoutedModel();await fsPromises.writeFile(path$1.resolve(d,path$1.basename(l,w)+(w===".mjs"?".d.mts":".d.ts")),Y(_)),LikeC4.H.box({message:LikeC4.q(`
426
426
  ${LikeC4.p.dim("Source generated:")}
427
- ${path$1.relative(process$1.cwd(),d)}
427
+ ${path$1.relative(process$1.cwd(),l)}
428
428
 
429
429
  ${LikeC4.p.dim("How to use:")}
430
430
  ${LikeC4.p.underline("https://likec4.dev/tooling/code-generation/react/")}
431
- `).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),o.stopAndLog()}async function webcomponentHandler({path:s,useDotBin:e,webcomponentPrefix:t="likec4",outfile:n}){const o=LikeC4.j("c4:codegen"),a=LikeC4.s(o),l=await LikeC4.L.fromWorkspace(s,{logger:"vite",graphviz:e?"binary":"wasm"});o.info(`${LikeC4.p.dim("format")} ${LikeC4.p.green("webcomponent")}`);const d=await l.diagrams();if(!LikeC4.v(d,1))throw o.warn("no views found"),process.exitCode=1,new Error("no views found");d.forEach(K=>{K.hasLayoutDrift&&o.warn(LikeC4.p.yellow("drift detected, manual layout can not be applied, view:")+" "+LikeC4.p.red(K.id))});let w=path$1.resolve(l.workspace,"likec4-views.js");if(n&&(w=path$1.isAbsolute(n)?n:path$1.resolve(n),fs.existsSync(n)&&(await fsPromises.stat(n)).isDirectory()))throw new Error(`output file is a directory: ${n}`);LikeC4.Y.debug(`${LikeC4.p.dim("outfilepath")} ${w}`);const _=path$1.basename(w);LikeC4.Y.debug(`${LikeC4.p.dim("filename")} ${_}`);const E=path$1.extname(_).toLocaleLowerCase();if(E!==".js"&&E!==".mjs")throw LikeC4.Y.warn(`output file ${n} has extension "${E}"`),new Error(`output file ${n} must be a .js or .mjs`);const y=await mkTempPublicDir();LikeC4.Y.debug(`${LikeC4.p.dim("created temp public")} ${y}`);const L=await viteWebcomponentConfig({languageServices:l,outDir:y,filename:_,webcomponentPrefix:t,base:"/"});LikeC4.Y.debug(`${LikeC4.p.dim("vite build webcomponent")}`),await vite.build({...L,logLevel:"warn"});const W=path$1.resolve(y,_);if(!fs.existsSync(W))throw new Error(`output file not found: ${W}`);await fsPromises.mkdir(path$1.dirname(w),{recursive:!0}),await fsPromises.copyFile(W,w),o.info(`${LikeC4.p.dim("generated")} ${w}`),LikeC4.Y.debug(`${LikeC4.p.dim("remove temp public")}`),await fsPromises.rm(y,{recursive:!0,force:!0}),LikeC4.Y.box(LikeC4.r(`
431
+ `).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),s.stopAndLog()}async function webcomponentHandler({path:i,useDotBin:e,webcomponentPrefix:t="likec4",outfile:n}){const s=LikeC4.h("c4:codegen"),o=LikeC4.s(s),a=await LikeC4.L.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});s.info(`${LikeC4.p.dim("format")} ${LikeC4.p.green("webcomponent")}`);const l=await a.diagrams();if(!LikeC4.r(l,1))throw s.warn("no views found"),process.exitCode=1,new Error("no views found");l.forEach(H=>{H.hasLayoutDrift&&s.warn(LikeC4.p.yellow("drift detected, manual layout can not be applied, view:")+" "+LikeC4.p.red(H.id))});let d=path$1.resolve(a.workspace,"likec4-views.js");if(n&&(d=path$1.isAbsolute(n)?n:path$1.resolve(n),fs.existsSync(n)&&(await fsPromises.stat(n)).isDirectory()))throw new Error(`output file is a directory: ${n}`);LikeC4.H.debug(`${LikeC4.p.dim("outfilepath")} ${d}`);const B=path$1.basename(d);LikeC4.H.debug(`${LikeC4.p.dim("filename")} ${B}`);const w=path$1.extname(B).toLocaleLowerCase();if(w!==".js"&&w!==".mjs")throw LikeC4.H.warn(`output file ${n} has extension "${w}"`),new Error(`output file ${n} must be a .js or .mjs`);const E=await mkTempPublicDir();LikeC4.H.debug(`${LikeC4.p.dim("created temp public")} ${E}`);const _=await viteWebcomponentConfig({languageServices:a,outDir:E,filename:B,webcomponentPrefix:t,base:"/"});LikeC4.H.debug(`${LikeC4.p.dim("vite build webcomponent")}`),await vite.build({..._,logLevel:"warn"});const U=path$1.resolve(E,B);if(!fs.existsSync(U))throw new Error(`output file not found: ${U}`);await fsPromises.mkdir(path$1.dirname(d),{recursive:!0}),await fsPromises.copyFile(U,d),s.info(`${LikeC4.p.dim("generated")} ${d}`),LikeC4.H.debug(`${LikeC4.p.dim("remove temp public")}`),await fsPromises.rm(E,{recursive:!0,force:!0}),LikeC4.H.box(LikeC4.q(`
432
432
  ${LikeC4.p.dim("Webcomponents generated to:")}
433
- ${path$1.relative(process$1.cwd(),w)}
433
+ ${path$1.relative(process$1.cwd(),d)}
434
434
 
435
435
  ${LikeC4.p.dim("Setup and usage instructions:")}
436
436
  ${LikeC4.p.blue("https://likec4.dev/tooling/code-generation/webcomponent/")}
437
- `)),a.stopAndLog()}const codegenCmd={command:"codegen <command> [path]",aliases:["generate","gen"],describe:"Generate various artifacts from LikeC4 sources",builder:s=>s.positional("path",path).command("react [path]","generate react component to render likec4 view",e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.jsx, .mjs or .js)",normalize:!0,coerce:require$$0.resolve}).option("use-dot",useDotBin),async e=>{await reactHandler({useDotBin:e.useDotBin,path:e.path,outfile:e.outfile})}).command({command:"webcomponent [path]",aliases:["wc","webcomp"],describe:"generate js with webcomponents",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.mjs or .js)",normalize:!0,coerce:require$$0.resolve}).option("webcomponent-prefix",webcomponentPrefix).option("use-dot",useDotBin),handler:async e=>{await webcomponentHandler({useDotBin:e.useDotBin,path:e.path,outfile:e.outfile,webcomponentPrefix:e.webcomponentPrefix})}}).command({command:"model [path]",aliases:["ts"],describe:"generate LikeC4Model (.ts)",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.ts)",normalize:!0,coerce:require$$0.resolve}).option("use-dot",useDotBin),handler:async e=>{await modelHandler({path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).command({command:"views-data [path]",aliases:["views"],describe:"generate likec4 views data (.ts)",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> output .ts file",normalize:!0,coerce:require$$0.resolve}).option("use-dot",useDotBin),handler:async e=>{await legacyHandler({format:"views",path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).command({command:"dot [path]",describe:"generate graphviz files (.dot)",builder:e=>e.option("outdir",outdir).option("use-dot",useDotBin),handler:async e=>{await legacyHandler({format:"dot",path:e.path,useDotBin:e.useDotBin,outdir:e.outdir})}}).command({command:"d2 [path]",describe:"generate D2 files (.d2)",builder:e=>e.option("outdir",outdir).option("use-dot",useDotBin),handler:async e=>{await legacyHandler({format:"d2",path:e.path,useDotBin:e.useDotBin,outdir:e.outdir})}}).command({command:"mermaid [path]",aliases:["mmd"],describe:"generate Mermaid files (.mmd)",builder:e=>e.option("outdir",outdir).option("use-dot",useDotBin),handler:async e=>{await legacyHandler({format:"mermaid",useDotBin:e.useDotBin,path:e.path,outdir:e.outdir})}}).epilog(`${LikeC4.p.bold("Examples:")}
437
+ `)),o.stopAndLog()}const codegenCmd={command:"codegen <command> [path]",aliases:["generate","gen"],describe:"Generate various artifacts from LikeC4 sources",builder:i=>i.positional("path",path).command("react [path]","generate react component to render likec4 view",e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.jsx, .mjs or .js)",normalize:!0,coerce:require$$0.resolve}).option("use-dot",useDotBin),async e=>{await reactHandler({useDotBin:e.useDotBin,path:e.path,outfile:e.outfile})}).command({command:"webcomponent [path]",aliases:["wc","webcomp"],describe:"generate js with webcomponents",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.mjs or .js)",normalize:!0,coerce:require$$0.resolve}).option("webcomponent-prefix",webcomponentPrefix).option("use-dot",useDotBin),handler:async e=>{await webcomponentHandler({useDotBin:e.useDotBin,path:e.path,outfile:e.outfile,webcomponentPrefix:e.webcomponentPrefix})}}).command({command:"model [path]",aliases:["ts"],describe:"generate LikeC4Model (.ts)",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.ts)",normalize:!0,coerce:require$$0.resolve}).option("use-dot",useDotBin),handler:async e=>{await modelHandler({path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).command({command:"views-data [path]",aliases:["views"],describe:"generate likec4 views data (.ts)",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> output .ts file",normalize:!0,coerce:require$$0.resolve}).option("use-dot",useDotBin),handler:async e=>{await legacyHandler({format:"views",path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).command({command:"dot [path]",describe:"generate graphviz files (.dot)",builder:e=>e.option("outdir",outdir).option("use-dot",useDotBin),handler:async e=>{await legacyHandler({format:"dot",path:e.path,useDotBin:e.useDotBin,outdir:e.outdir})}}).command({command:"d2 [path]",describe:"generate D2 files (.d2)",builder:e=>e.option("outdir",outdir).option("use-dot",useDotBin),handler:async e=>{await legacyHandler({format:"d2",path:e.path,useDotBin:e.useDotBin,outdir:e.outdir})}}).command({command:"mermaid [path]",aliases:["mmd"],describe:"generate Mermaid files (.mmd)",builder:e=>e.option("outdir",outdir).option("use-dot",useDotBin),handler:async e=>{await legacyHandler({format:"mermaid",useDotBin:e.useDotBin,path:e.path,outdir:e.outdir})}}).epilog(`${LikeC4.p.bold("Examples:")}
438
438
  likec4 gen react -o dist/likec4-views.mjs ./src/likec4
439
439
  likec4 gen model -o likec4-model.ts
440
440
  likec4 gen webcomponent -o likec4.js --webcomponent-prefix c4 --use-dot-bin ./src
@@ -442,7 +442,7 @@ if (import.meta.hot) {
442
442
  likec4 gen ts --outfile ../likec4.ts
443
443
  likec4 gen mmd --outdir assets/
444
444
  likec4 gen dot -o out .
445
- `),handler:()=>{}};async function handler$2({path:s,useDotBin:e,outfile:t}){const n=LikeC4.j("c4:export"),o=LikeC4.s(n),a=await(await LikeC4.L.fromWorkspace(s,{logger:"vite",graphviz:e?"binary":"wasm"})).layoutedModel();path$1.extname(t)!==".json"&&(t=t+".json"),await fsPromises.mkdir(path$1.dirname(t),{recursive:!0});const l=JSON.stringify(a.$model,null,2);await fsPromises.writeFile(t,l),n.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),t)}`),o.stopAndLog("\u2713 export in ")}const exportCmd={command:"export <format> [path]",describe:"Export to images or JSON",builder:s=>s.usage(`${LikeC4.p.bold("Usage:")} $0 export <format> [path]`).positional("path",path).command({command:"png [path]",describe:"export views to PNG",builder:e=>e.option("output",outdir).option("theme",{choices:["light","dark"],desc:"color-scheme to use, default is light"}).option("flat",{boolean:!0,type:"boolean",desc:"ignore sources structure and export all PNGs in output directory"}).option("use-dot",useDotBin).options({ignore:{boolean:!0,alias:"i",desc:"continue if some views failed to export"},timeout:{type:"number",alias:"t",desc:"(sec) timeout for playwright ",default:10},"max-attempts":{type:"number",describe:"",desc:"(number) max attempts to export failing view",default:3},"server-url":{type:"string",desc:"use this url instead of starting new likec4 server"}}).epilog(`${LikeC4.p.bold("Examples:")}
445
+ `),handler:()=>{}};async function handler$2({path:i,useDotBin:e,outfile:t}){const n=LikeC4.h("c4:export"),s=LikeC4.s(n),o=await(await LikeC4.L.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"})).layoutedModel();path$1.extname(t)!==".json"&&(t=t+".json"),await fsPromises.mkdir(path$1.dirname(t),{recursive:!0});const a=JSON.stringify(o.$model,null,2);await fsPromises.writeFile(t,a),n.info(`${LikeC4.p.dim("generated")} ${path$1.relative(process.cwd(),t)}`),s.stopAndLog("\u2713 export in ")}const exportCmd={command:"export <format> [path]",describe:"Export to images or JSON",builder:i=>i.usage(`${LikeC4.p.bold("Usage:")} $0 export <format> [path]`).positional("path",path).command({command:"png [path]",describe:"export views to PNG",builder:e=>e.option("output",outdir).option("theme",{choices:["light","dark"],desc:"color-scheme to use, default is light"}).option("flat",{boolean:!0,type:"boolean",desc:"ignore sources structure and export all PNGs in output directory"}).option("use-dot",useDotBin).options({ignore:{boolean:!0,alias:"i",desc:"continue if some views failed to export"},timeout:{type:"number",alias:"t",desc:"(sec) timeout for playwright ",default:10},"max-attempts":{type:"number",describe:"",desc:"(number) max attempts to export failing view",default:3},"server-url":{type:"string",desc:"use this url instead of starting new likec4 server"}}).epilog(`${LikeC4.p.bold("Examples:")}
446
446
  ${LikeC4.p.green("$0 export png")}
447
447
  ${LikeC4.p.gray("Search for likec4 files in current directory and output PNG next to sources")}
448
448
 
@@ -454,5 +454,5 @@ if (import.meta.hot) {
454
454
 
455
455
  ${LikeC4.p.green("$0 export json -o ./generated/likec4.json src/likec4 ")}
456
456
  ${LikeC4.p.gray("Search for likec4 files in src/likec4 and output JSON to generated/likec4.json")}
457
- `),handler:async e=>{await handler$2({path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).updateStrings({"Commands:":LikeC4.p.bold("Formats:")}),handler:()=>{}};async function vitePreview(s){const{isDev:e,...t}=await viteConfig({...s,likec4AssetsDir:"",webcomponentPrefix:void 0}),n=await getPorts({port:portNumbers(62001,62010)}),o=s?.open??!1;return await vite.preview({...t,mode:"production",preview:{host:"0.0.0.0",port:n,open:o}})}async function handler$1({path:s,output:e,base:t}){const n=await LikeC4.L.fromWorkspace(s,{logger:"vite"}),o=await vitePreview({base:t,languageServices:n,outputDir:e,open:!0});printServerUrls(o)}const previewCmd={command:"preview [path]",describe:"Start local server to preview production build",builder:s=>s.positional("path",{type:"string",desc:`Directory with LikeC4 source files
458
- if not specified search in current directory`,normalize:!0}).options({output:{alias:"o",type:"string",desc:"output directory from production build",normalize:!0},base:{type:"string",desc:"base url the app is being served from"}}).coerce(["path","output"],require$$0.resolve).default("path",require$$0.resolve("."),"."),async handler(s){await handler$1(s)}};async function handler({path:s,useDotBin:e,webcomponentPrefix:t,useHashHistory:n,useOverview:o=!1,base:a}){const l=await LikeC4.L.fromWorkspace(s,{logger:"vite",graphviz:e?"binary":"wasm"}),d=await fsPromises.mkdtemp(path$1.join(os.tmpdir(),".likec4-assets-")),w=await viteDev({buildWebcomponent:!i,hmr:!0,base:a,webcomponentPrefix:t,languageServices:l,useHashHistory:n,useOverviewGraph:o,likec4AssetsDir:d});if(w.config.logger.clearScreen("info"),printServerUrls(w),!o)return;const _=await l.diagrams();if(LikeC4.v(_,1)){const E=LikeC4.j("c4:export"),y=resolveServerUrl(w);if(!y){E.error("no preview server url");return}E.info(LikeC4.p.cyan("wait 5sec before generating previews")),await core.delay(5e3);try{await exportViewsToPNG({serverUrl:y,logger:E,views:_,theme:"light",output:d,outputType:"flat"}),await core.delay(1e3),E.info(LikeC4.p.yellow("Note: changes in sources do not trigger preview updates, restart is required"))}catch(L){E.error(LikeC4.p.red("Failed to generate previews")),E.error(L)}}else w.config.logger.warn("no views found, no previews generated")}const serveCmd={command:"start [path]",aliases:["serve","dev"],describe:"Start local dev server to preview LikeC4 views",builder:s=>s.positional("path",path).option("base",base).option("webcomponent-prefix",webcomponentPrefix).option("use-hash-history",useHashHistory).option("use-overview",useOverview).option("use-dot",useDotBin),handler:async s=>{await handler({path:s.path,useDotBin:s["use-dot"],base:s.base,useOverview:s["use-overview"]??!1,webcomponentPrefix:s["webcomponent-prefix"],useHashHistory:s["use-hash-history"]})}};LikeC4.Y.level=LikeC4.y.debug;const g=Yargs(hideBin(process$1.argv)).scriptName("likec4").usage("Usage: $0 <command>").command(serveCmd).command(buildCmd).command(codegenCmd).command(exportCmd).command(previewCmd).help("help").version(LikeC4.z).alias("v","version").alias("h","help").demandCommand(1,"Please run with valid command").strict().recommendCommands().showHelpOnFail(!0,"Something is wrong, run with --help").updateStrings({"Options:":LikeC4.p.bold("Options:"),"Positionals:":LikeC4.p.bold("Arguments:"),"Commands:":LikeC4.p.bold("Commands:"),"Examples:":LikeC4.p.bold("Examples:")}).wrap(LikeC4.u(process$1.stdout.columns-20,{min:80,max:120})).parseAsync();g.catch(()=>process$1.exit(1)),process.on("unhandledRejection",s=>{LikeC4.Y.error(s)});
457
+ `),handler:async e=>{await handler$2({path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).updateStrings({"Commands:":LikeC4.p.bold("Formats:")}),handler:()=>{}};async function vitePreview(i){const{isDev:e,...t}=await viteConfig({...i,likec4AssetsDir:"",webcomponentPrefix:void 0}),n=await getPorts({port:portNumbers(62001,62010)}),s=i?.open??!1;return await vite.preview({...t,mode:"production",preview:{host:"0.0.0.0",port:n,open:s}})}async function handler$1({path:i,output:e,base:t}){const n=await LikeC4.L.fromWorkspace(i,{logger:"vite"}),s=await vitePreview({base:t,languageServices:n,outputDir:e,open:!0});printServerUrls(s)}const previewCmd={command:"preview [path]",describe:"Start local server to preview production build",builder:i=>i.positional("path",{type:"string",desc:`Directory with LikeC4 source files
458
+ if not specified search in current directory`,normalize:!0}).options({output:{alias:"o",type:"string",desc:"output directory from production build",normalize:!0},base:{type:"string",desc:"base url the app is being served from"}}).coerce(["path","output"],require$$0.resolve).default("path",require$$0.resolve("."),"."),async handler(i){await handler$1(i)}};async function handler({path:i,useDotBin:e,webcomponentPrefix:t,useHashHistory:n,useOverview:s=!1,base:o}){const a=await LikeC4.L.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"}),l=await fsPromises.mkdtemp(path$1.join(os.tmpdir(),".likec4-assets-")),d=await viteDev({buildWebcomponent:!0,hmr:!0,base:o,webcomponentPrefix:t,languageServices:a,useHashHistory:n,useOverviewGraph:s,likec4AssetsDir:l});if(d.config.logger.clearScreen("info"),printServerUrls(d),!s)return;const B=await a.diagrams();if(LikeC4.r(B,1)){const w=LikeC4.h("c4:export"),E=resolveServerUrl(d);if(!E){w.error("no preview server url");return}w.info(LikeC4.p.cyan("wait 5sec before generating previews")),await core.delay(5e3);try{await exportViewsToPNG({serverUrl:E,logger:w,views:B,theme:"light",output:l,outputType:"flat"}),await core.delay(1e3),w.info(LikeC4.p.yellow("Note: changes in sources do not trigger preview updates, restart is required"))}catch(_){w.error(LikeC4.p.red("Failed to generate previews")),w.error(_)}}else d.config.logger.warn("no views found, no previews generated")}const serveCmd={command:"start [path]",aliases:["serve","dev"],describe:"Start local dev server to preview LikeC4 views",builder:i=>i.positional("path",path).option("base",base).option("webcomponent-prefix",webcomponentPrefix).option("use-hash-history",useHashHistory).option("use-overview",useOverview).option("use-dot",useDotBin),handler:async i=>{await handler({path:i.path,useDotBin:i["use-dot"],base:i.base,useOverview:i["use-overview"]??!1,webcomponentPrefix:i["webcomponent-prefix"],useHashHistory:i["use-hash-history"]})}};LikeC4.H.level=LikeC4.v.debug,LikeC4.H.wrapConsole();const g=Yargs(hideBin(process$1.argv)).scriptName("likec4").usage("Usage: $0 <command>").command(serveCmd).command(buildCmd).command(codegenCmd).command(exportCmd).command(previewCmd).help("help").version(LikeC4.y).alias("v","version").alias("h","help").demandCommand(1,"Please run with valid command").strict().recommendCommands().showHelpOnFail(!0,"Something is wrong, run with --help").updateStrings({"Options:":LikeC4.p.bold("Options:"),"Positionals:":LikeC4.p.bold("Arguments:"),"Commands:":LikeC4.p.bold("Commands:"),"Examples:":LikeC4.p.bold("Examples:")}).wrap(LikeC4.u(process$1.stdout.columns-20,{min:80,max:120})).parseAsync();g.catch(()=>process$1.exit(1)),process.on("unhandledRejection",i=>{LikeC4.H.error(i)});