likec4 1.18.0 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/LICENSE +1 -1
  2. package/__app__/index.html +0 -1
  3. package/__app__/react/likec4.tsx +11 -8
  4. package/__app__/src/chunks/-index-overview-C9eO_hFX.js +309 -0
  5. package/__app__/src/chunks/-view-lazy-data-CI4xD57c.js +9 -0
  6. package/__app__/src/chunks/index-KI-kE60c.js +465 -0
  7. package/__app__/src/chunks/likec4-CusAw_j6.js +6106 -0
  8. package/__app__/src/chunks/main-DY2KbFcO.js +24136 -0
  9. package/__app__/src/chunks/mantine-B_6mKFFA.js +13671 -0
  10. package/__app__/src/chunks/tanstack-router-BBWuTKWO.js +2373 -0
  11. package/__app__/src/icons.js +6 -6
  12. package/__app__/src/main.js +1 -1
  13. package/__app__/src/style.css +1 -1
  14. package/__app__/webcomponent/webcomponent.js +21699 -21851
  15. package/dist/chunks/prompt.mjs +35 -35
  16. package/dist/cli/index.mjs +91 -88
  17. package/dist/index.d.mts +410 -2388
  18. package/dist/index.d.ts +410 -2388
  19. package/dist/index.mjs +1 -1
  20. package/dist/model/index.d.mts +258 -0
  21. package/dist/model/index.d.ts +258 -0
  22. package/dist/model/index.mjs +1 -0
  23. package/dist/shared/likec4.CbSUX9bc.mjs +1853 -0
  24. package/dist/shared/likec4.DCwaTTuF.d.mts +1625 -0
  25. package/dist/shared/likec4.DCwaTTuF.d.ts +1625 -0
  26. package/dist/shared/likec4.LktBLTET.mjs +9 -0
  27. package/package.json +65 -62
  28. package/react/index.d.ts +150 -918
  29. package/react/index.js +39830 -0
  30. package/react/style.css +1 -1
  31. package/__app__/src/chunks/-index-overview-CBnvpD1d.js +0 -309
  32. package/__app__/src/chunks/-view-lazy-data-WZmbIsHq.js +0 -9
  33. package/__app__/src/chunks/index-CIsxIzOH.js +0 -465
  34. package/__app__/src/chunks/likec4-DslTxitT.js +0 -6109
  35. package/__app__/src/chunks/main-ByUdz_Be.js +0 -24285
  36. package/__app__/src/chunks/mantine-oFa3ZrEq.js +0 -13658
  37. package/__app__/src/chunks/tanstack-router-BWjXKr0n.js +0 -2373
  38. package/dist/shared/likec4.lgHXhASw.mjs +0 -1832
  39. package/react/index.mjs +0 -41515
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import{k as Qt,m as Di,n as Hr,T as Gr,N as Ci,o as Yr,p as wi,q as Ai,V as qr,x as Jr,r as Kr,s as Ei,u as bi,w as Qr,A,C as Xr,W as me,I as Zr,J as es,K as Le,M as ts,Q as ns,S as is,X as Fi,a0 as yi,L as ze,z as rs,a1 as ss,a2 as St,h as vi,E as Bn,a3 as On,a4 as Bi,a5 as Oi,a6 as _i,a7 as us}from"../shared/likec4.lgHXhASw.mjs";import"node:util";import{resolve as Q,dirname as bt,join as It,extname as $t,relative as ut,isAbsolute as _n,basename as Xt}from"node:path";import{hrtime as os,cwd as Sn,stdout as as,exit as cs,argv as ls}from"node:process";import"node:tty";import{notStrictEqual as fs,strictEqual as ds}from"assert";import{resolve as ve,dirname as In,normalize as hs,basename as ps,extname as ms,relative as gs}from"path";import{statSync as Si,readdirSync as Ds,readFileSync as $n,writeFile as Cs}from"fs";import{format as Ii,inspect as ws}from"util";import{fileURLToPath as As}from"url";import{existsSync as Ke,copyFileSync as $i,rmSync as xi}from"node:fs";import{mkdtemp as Zt,writeFile as ot,mkdir as He,stat as xn,copyFile as Es,rm as bs}from"node:fs/promises";import Fs,{tmpdir as en}from"node:os";import{fileURLToPath as ys}from"node:url";import{build as xt,createServer as vs,preview as Bs}from"vite";import{chromium as ji}from"playwright";import Os from"node:net";import{setTimeout as _s}from"node:timers/promises";import Ss from"@vitejs/plugin-react-swc";import"tty";import"os";import"crypto";import"net";import"child_process";import"@hpcc-js/wasm-graphviz";import"node:child_process";import"node:string_decoder";import"node:events";import"node:v8";import"node:stream";import"node:buffer";import"node:stream/promises";import"buffer";const Is={right:Ns,center:Ms},$s=0,tn=1,xs=2,nn=3;class js{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(r=>r.split(" "));let n=0;return t.forEach(r=>{r.length>1&&Ee.stringWidth(r[0])>n&&(n=Math.min(Math.floor(this.width*.5),Ee.stringWidth(r[0])))}),t.forEach(r=>{this.div(...r.map((s,u)=>({text:s.trim(),padding:this.measurePadding(s),width:u===0&&r.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){const t=Ee.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,r)=>{let s="";n.forEach((u,a)=>{const{width:c}=e[a],h=this.negatePadding(e[a]);let l=u;if(h>Ee.stringWidth(u)&&(l+=" ".repeat(h-Ee.stringWidth(u))),e[a].align&&e[a].align!=="left"&&this.wrap){const p=Is[e[a].align];l=p(l,h),Ee.stringWidth(l)<h&&(l+=" ".repeat((c||0)-Ee.stringWidth(l)-1))}const f=e[a].padding||[0,0,0,0];f[nn]&&(s+=" ".repeat(f[nn])),s+=Li(e[a],l,"| "),s+=l,s+=Li(e[a],l," |"),f[tn]&&(s+=" ".repeat(f[tn])),r===0&&t.length>0&&(s=this.renderInline(s,t[t.length-1]))}),t.push({text:s.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){const n=e.match(/^ */),r=n?n[0].length:0,s=t.text,u=Ee.stringWidth(s.trimRight());return t.span?this.wrap?r<u?e:(t.hidden=!0,s.trimRight()+" ".repeat(r-u)+e.trimLeft()):(t.hidden=!0,s+e):e}rasterize(e){const t=[],n=this.columnWidths(e);let r;return e.forEach((s,u)=>{s.width=n[u],this.wrap?r=Ee.wrap(s.text,this.negatePadding(s),{hard:!0}).split(`
2
+ import{f as Jr,Y as De,g as Di,a as Kr,T as Qr,N as Ci,i as Xr,n as wi,x as Zr,b as es,c as Ai,d as Ei,t as ts,p as A,e as ns,h as is,j as Le,w as rs,k as ss,m as os,o as bi,u as Fi,L as ze,q as us,s as $t,r as On,v as yi,y as vi,z as as,A as cs}from"../shared/likec4.CbSUX9bc.mjs";import"node:util";import Ft,{resolve as J,dirname as ot,join as It,extname as xt,relative as ut,isAbsolute as _n,basename as Xt}from"node:path";import Bi,{hrtime as ls,cwd as Sn,stdout as fs,exit as ds,argv as hs}from"node:process";import"node:tty";import{notStrictEqual as ps,strictEqual as ms}from"assert";import{resolve as ve,dirname as $n,normalize as gs,basename as Ds,extname as Cs,relative as ws}from"path";import{statSync as Oi,readdirSync as As,readFileSync as In,writeFile as Es}from"fs";import{format as _i,inspect as bs}from"util";import{fileURLToPath as Fs}from"url";import ys,{existsSync as Ke,copyFileSync as Si,rmSync as $i}from"node:fs";import{mkdtemp as Zt,writeFile as at,mkdir as He,stat as xn,copyFile as vs,rm as Bs}from"node:fs/promises";import Os,{tmpdir as en}from"node:os";import{fileURLToPath as Ii}from"node:url";import{i as xi,k as _s,Q as Ss,l as ji,u as jn}from"../shared/likec4.LktBLTET.mjs";import{build as jt,createServer as $s,preview as Is}from"vite";import{chromium as Li}from"playwright";import xs from"node:net";import{setTimeout as js}from"node:timers/promises";import Ls from"@vitejs/plugin-react-swc";import"tty";import"os";import"crypto";import"net";import"child_process";import"buffer";import"@hpcc-js/wasm-graphviz";import"node:child_process";import"node:string_decoder";import"node:events";import"node:v8";import"node:stream";import"node:buffer";import"node:stream/promises";const Ps=!1,Ns={right:Ws,center:Vs},ks=0,tn=1,Ms=2,nn=3;class Ts{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(r=>r.split(" "));let n=0;return t.forEach(r=>{r.length>1&&Ee.stringWidth(r[0])>n&&(n=Math.min(Math.floor(this.width*.5),Ee.stringWidth(r[0])))}),t.forEach(r=>{this.div(...r.map((s,o)=>({text:s.trim(),padding:this.measurePadding(s),width:o===0&&r.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){const t=Ee.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,r)=>{let s="";n.forEach((o,a)=>{const{width:c}=e[a],h=this.negatePadding(e[a]);let l=o;if(h>Ee.stringWidth(o)&&(l+=" ".repeat(h-Ee.stringWidth(o))),e[a].align&&e[a].align!=="left"&&this.wrap){const p=Ns[e[a].align];l=p(l,h),Ee.stringWidth(l)<h&&(l+=" ".repeat((c||0)-Ee.stringWidth(l)-1))}const f=e[a].padding||[0,0,0,0];f[nn]&&(s+=" ".repeat(f[nn])),s+=Pi(e[a],l,"| "),s+=l,s+=Pi(e[a],l," |"),f[tn]&&(s+=" ".repeat(f[tn])),r===0&&t.length>0&&(s=this.renderInline(s,t[t.length-1]))}),t.push({text:s.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){const n=e.match(/^ */),r=n?n[0].length:0,s=t.text,o=Ee.stringWidth(s.trimRight());return t.span?this.wrap?r<o?e:(t.hidden=!0,s.trimRight()+" ".repeat(r-o)+e.trimLeft()):(t.hidden=!0,s+e):e}rasterize(e){const t=[],n=this.columnWidths(e);let r;return e.forEach((s,o)=>{s.width=n[o],this.wrap?r=Ee.wrap(s.text,this.negatePadding(s),{hard:!0}).split(`
5
5
  `):r=s.text.split(`
6
- `),s.border&&(r.unshift("."+"-".repeat(this.negatePadding(s)+2)+"."),r.push("'"+"-".repeat(this.negatePadding(s)+2)+"'")),s.padding&&(r.unshift(...new Array(s.padding[$s]||0).fill("")),r.push(...new Array(s.padding[xs]||0).fill(""))),r.forEach((a,c)=>{t[c]||t.push([]);const h=t[c];for(let l=0;l<u;l++)h[l]===void 0&&h.push("");h.push(a)})}),t}negatePadding(e){let t=e.width||0;return e.padding&&(t-=(e.padding[nn]||0)+(e.padding[tn]||0)),e.border&&(t-=4),t}columnWidths(e){if(!this.wrap)return e.map(u=>u.width||Ee.stringWidth(u.text));let t=e.length,n=this.width;const r=e.map(u=>{if(u.width)return t--,n-=u.width,u.width}),s=t?Math.floor(n/t):0;return r.map((u,a)=>u===void 0?Math.max(s,Ls(e[a])):u)}}function Li(i,e,t){return i.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function Ls(i){const e=i.padding||[],t=1+(e[nn]||0)+(e[tn]||0);return i.border?t+4:t}function Ps(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Ns(i,e){i=i.trim();const t=Ee.stringWidth(i);return t<e?" ".repeat(e-t)+i:i}function Ms(i,e){i=i.trim();const t=Ee.stringWidth(i);return t>=e?i:" ".repeat(e-t>>1)+i}let Ee;function ks(i,e){return Ee=e,new js({width:i?.width||Ps(),wrap:i?.wrap})}const Pi=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function Ni(i){return i.replace(Pi,"")}function Ts(i,e){const[t,n]=i.match(Pi)||["",""];i=Ni(i);let r="";for(let s=0;s<i.length;s++)s!==0&&s%e===0&&(r+=`
7
- `),r+=i.charAt(s);return t&&n&&(r=`${t}${r}${n}`),r}function Rs(i){return ks(i,{stringWidth:e=>[...e].length,stripAnsi:Ni,wrap:Ts})}function Ws(i,e){let t=ve(".",i),n;for(Si(t).isDirectory()||(t=In(t));;){if(n=e(t,Ds(t)),n)return ve(t,n);if(t=In(n=t),n===t)break}}function jt(i){if(i!==i.toLowerCase()&&i!==i.toUpperCase()||(i=i.toLowerCase()),i.indexOf("-")===-1&&i.indexOf("_")===-1)return i;{let t="",n=!1;const r=i.match(/^-+/);for(let s=r?r[0].length:0;s<i.length;s++){let u=i.charAt(s);n&&(n=!1,u=u.toUpperCase()),s!==0&&(u==="-"||u==="_")?n=!0:u!=="-"&&u!=="_"&&(t+=u)}return t}}function Mi(i,e){const t=i.toLowerCase();e=e||"-";let n="";for(let r=0;r<i.length;r++){const s=t.charAt(r),u=i.charAt(r);s!==u&&r>0?n+=`${e}${t.charAt(r)}`:n+=u}return n}function ki(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 Us(i){if(Array.isArray(i))return i.map(u=>typeof u!="string"?u+"":u);i=i.trim();let e=0,t=null,n=null,r=null;const s=[];for(let u=0;u<i.length;u++){if(t=n,n=i.charAt(u),n===" "&&!r){t!==" "&&e++;continue}n===r?r=null:(n==="'"||n==='"')&&!r&&(r=n),s[e]||(s[e]=""),s[e]+=n}return s}var Pe;(function(i){i.BOOLEAN="boolean",i.STRING="string",i.NUMBER="number",i.ARRAY="array"})(Pe||(Pe={}));let Ge;class Vs{constructor(e){Ge=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),r=Us(e),s=typeof e=="string",u=zs(Object.assign(Object.create(null),n.alias)),a=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),c=Object.assign(Object.create(null),n.default),h=n.configObjects||[],l=n.envPrefix,f=a["populate--"],p=f?"--":"_",C=Object.create(null),F=Object.create(null),w=n.__||Ge.format,m={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},y=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,S=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(d){const D=typeof d=="object"?d.key:d,v=Object.keys(d).map(function(E){return{boolean:"bools",string:"strings",number:"numbers"}[E]}).filter(Boolean).pop();v&&(m[v][D]=!0),m.arrays[D]=!0,m.keys.push(D)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(d){m.bools[d]=!0,m.keys.push(d)}),[].concat(n.string||[]).filter(Boolean).forEach(function(d){m.strings[d]=!0,m.keys.push(d)}),[].concat(n.number||[]).filter(Boolean).forEach(function(d){m.numbers[d]=!0,m.keys.push(d)}),[].concat(n.count||[]).filter(Boolean).forEach(function(d){m.counts[d]=!0,m.keys.push(d)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(d){m.normalize[d]=!0,m.keys.push(d)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([d,D])=>{typeof D=="number"&&(m.nargs[d]=D,m.keys.push(d))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([d,D])=>{typeof D=="function"&&(m.coercions[d]=D,m.keys.push(d))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(d){m.configs[d]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([d,D])=>{(typeof D=="boolean"||typeof D=="function")&&(m.configs[d]=D)})),st(n.key,u,n.default,m.arrays),Object.keys(c).forEach(function(d){(m.aliases[d]||[]).forEach(function(D){c[D]=c[d]})});let R=null;Kt();let N=[];const U=Object.assign(Object.create(null),{_:[]}),Ce={};for(let d=0;d<r.length;d++){const D=r[d],v=D.replace(/^-{3,}/,"---");let E,g,x,O,P,pe;if(D!=="--"&&/^-/.test(D)&&ie(D))$e(D);else if(v.match(/^---+(=|$)/)){$e(D);continue}else if(D.match(/^--.+=/)||!a["short-option-groups"]&&D.match(/^-.+=/))O=D.match(/^--?([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&(k(O[1],m.arrays)?d=it(d,O[1],r,O[2]):k(O[1],m.nargs)!==!1?d=Et(d,O[1],r,O[2]):X(O[1],O[2],!0));else if(D.match(S)&&a["boolean-negation"])O=D.match(S),O!==null&&Array.isArray(O)&&O.length>=2&&(g=O[1],X(g,k(g,m.arrays)?[!1]:!1));else if(D.match(/^--.+/)||!a["short-option-groups"]&&D.match(/^-[^-]+/))O=D.match(/^--?(.+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(g=O[1],k(g,m.arrays)?d=it(d,g,r):k(g,m.nargs)!==!1?d=Et(d,g,r):(P=r[d+1],P!==void 0&&(!P.match(/^-/)||P.match(y))&&!k(g,m.bools)&&!k(g,m.counts)||/^(true|false)$/.test(P)?(X(g,P),d++):X(g,re(g))));else if(D.match(/^-.\..+=/))O=D.match(/^-([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&X(O[1],O[2]);else if(D.match(/^-.\..+/)&&!D.match(y))P=r[d+1],O=D.match(/^-(.\..+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(g=O[1],P!==void 0&&!P.match(/^-/)&&!k(g,m.bools)&&!k(g,m.counts)?(X(g,P),d++):X(g,re(g)));else if(D.match(/^-[^-]+/)&&!D.match(y)){x=D.slice(1,-1).split(""),E=!1;for(let we=0;we<x.length;we++){if(P=D.slice(we+2),x[we+1]&&x[we+1]==="="){pe=D.slice(we+3),g=x[we],k(g,m.arrays)?d=it(d,g,r,pe):k(g,m.nargs)!==!1?d=Et(d,g,r,pe):X(g,pe),E=!0;break}if(P==="-"){X(x[we],P);continue}if(/[A-Za-z]/.test(x[we])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(P)&&k(P,m.bools)===!1){X(x[we],P),E=!0;break}if(x[we+1]&&x[we+1].match(/\W/)){X(x[we],P),E=!0;break}else X(x[we],re(x[we]))}g=D.slice(-1)[0],!E&&g!=="-"&&(k(g,m.arrays)?d=it(d,g,r):k(g,m.nargs)!==!1?d=Et(d,g,r):(P=r[d+1],P!==void 0&&(!/^(-|--)[^-]/.test(P)||P.match(y))&&!k(g,m.bools)&&!k(g,m.counts)||/^(true|false)$/.test(P)?(X(g,P),d++):X(g,re(g))))}else if(D.match(/^-[0-9]$/)&&D.match(y)&&k(D.slice(1),m.bools))g=D.slice(1),X(g,re(g));else if(D==="--"){N=r.slice(d+1);break}else if(a["halt-at-non-option"]){N=r.slice(d);break}else $e(D)}J(U,!0),J(U,!1),V(U),de(),ne(U,m.aliases,c,!0),he(U),a["set-placeholder-key"]&&rt(U),Object.keys(m.counts).forEach(function(d){Ue(U,d.split("."))||X(d,0)}),f&&N.length&&(U[p]=[]),N.forEach(function(d){U[p].push(d)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(U).filter(d=>d!=="--"&&d.includes("-")).forEach(d=>{delete U[d]}),a["strip-aliased"]&&[].concat(...Object.keys(u).map(d=>u[d])).forEach(d=>{a["camel-case-expansion"]&&d.includes("-")&&delete U[d.split(".").map(D=>jt(D)).join(".")],delete U[d]});function $e(d){const D=I("_",d);(typeof D=="string"||typeof D=="number")&&U._.push(D)}function Et(d,D,v,E){let g,x=k(D,m.nargs);if(x=typeof x!="number"||isNaN(x)?1:x,x===0)return je(E)||(R=Error(w("Argument unexpected for: %s",D))),X(D,re(D)),d;let O=je(E)?0:1;if(a["nargs-eats-options"])v.length-(d+1)+O<x&&(R=Error(w("Not enough arguments following: %s",D))),O=x;else{for(g=d+1;g<v.length&&(!v[g].match(/^-[^0-9]/)||v[g].match(y)||ie(v[g]));g++)O++;O<x&&(R=Error(w("Not enough arguments following: %s",D)))}let P=Math.min(O,x);for(!je(E)&&P>0&&(X(D,E),P--),g=d+1;g<P+d+1;g++)X(D,v[g]);return d+P}function it(d,D,v,E){let g=[],x=E||v[d+1];const O=k(D,m.nargs);if(k(D,m.bools)&&!/^(true|false)$/.test(x))g.push(!0);else if(je(x)||je(E)&&/^-/.test(x)&&!y.test(x)&&!ie(x)){if(c[D]!==void 0){const P=c[D];g=Array.isArray(P)?P:[P]}}else{je(E)||g.push(B(D,E,!0));for(let P=d+1;P<v.length&&!(!a["greedy-arrays"]&&g.length>0||O&&typeof O=="number"&&g.length>=O||(x=v[P],/^-/.test(x)&&!y.test(x)&&!ie(x)));P++)d=P,g.push(B(D,x,s))}return typeof O=="number"&&(O&&g.length<O||isNaN(O)&&g.length===0)&&(R=Error(w("Not enough arguments following: %s",D))),X(D,g),d}function X(d,D,v=s){if(/-/.test(d)&&a["camel-case-expansion"]){const x=d.split(".").map(function(O){return jt(O)}).join(".");j(d,x)}const E=B(d,D,v),g=d.split(".");Ve(U,g,E),m.aliases[d]&&m.aliases[d].forEach(function(x){const O=x.split(".");Ve(U,O,E)}),g.length>1&&a["dot-notation"]&&(m.aliases[g[0]]||[]).forEach(function(x){let O=x.split(".");const P=[].concat(g);P.shift(),O=O.concat(P),(m.aliases[d]||[]).includes(O.join("."))||Ve(U,O,E)}),k(d,m.normalize)&&!k(d,m.arrays)&&[d].concat(m.aliases[d]||[]).forEach(function(O){Object.defineProperty(Ce,O,{enumerable:!0,get(){return D},set(P){D=typeof P=="string"?Ge.normalize(P):P}})})}function j(d,D){m.aliases[d]&&m.aliases[d].length||(m.aliases[d]=[D],C[D]=!0),m.aliases[D]&&m.aliases[D].length||j(D,d)}function B(d,D,v){v&&(D=Hs(D)),(k(d,m.bools)||k(d,m.counts))&&typeof D=="string"&&(D=D==="true");let E=Array.isArray(D)?D.map(function(g){return I(d,g)}):I(d,D);return k(d,m.counts)&&(je(E)||typeof E=="boolean")&&(E=jn()),k(d,m.normalize)&&k(d,m.arrays)&&(Array.isArray(D)?E=D.map(g=>Ge.normalize(g)):E=Ge.normalize(D)),E}function I(d,D){return!a["parse-positional-numbers"]&&d==="_"||!k(d,m.strings)&&!k(d,m.bools)&&!Array.isArray(D)&&(ki(D)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${D}`)))||!je(D)&&k(d,m.numbers))&&(D=Number(D)),D}function V(d){const D=Object.create(null);ne(D,m.aliases,c),Object.keys(m.configs).forEach(function(v){const E=d[v]||D[v];if(E)try{let g=null;const x=Ge.resolve(Ge.cwd(),E),O=m.configs[v];if(typeof O=="function"){try{g=O(x)}catch(P){g=P}if(g instanceof Error){R=g;return}}else g=Ge.require(x);K(g)}catch(g){g.name==="PermissionDenied"?R=g:d[v]&&(R=Error(w("Invalid JSON config file: %s",E)))}})}function K(d,D){Object.keys(d).forEach(function(v){const E=d[v],g=D?D+"."+v:v;typeof E=="object"&&E!==null&&!Array.isArray(E)&&a["dot-notation"]?K(E,g):(!Ue(U,g.split("."))||k(g,m.arrays)&&a["combine-arrays"])&&X(g,E)})}function de(){typeof h<"u"&&h.forEach(function(d){K(d)})}function J(d,D){if(typeof l>"u")return;const v=typeof l=="string"?l:"",E=Ge.env();Object.keys(E).forEach(function(g){if(v===""||g.lastIndexOf(v,0)===0){const x=g.split("__").map(function(O,P){return P===0&&(O=O.substring(v.length)),jt(O)});(D&&m.configs[x.join(".")]||!D)&&!Ue(d,x)&&X(x.join("."),E[g])}})}function he(d){let D;const v=new Set;Object.keys(d).forEach(function(E){if(!v.has(E)&&(D=k(E,m.coercions),typeof D=="function"))try{const g=I(E,D(d[E]));[].concat(m.aliases[E]||[],E).forEach(x=>{v.add(x),d[x]=g})}catch(g){R=g}})}function rt(d){return m.keys.forEach(D=>{~D.indexOf(".")||typeof d[D]>"u"&&(d[D]=void 0)}),d}function ne(d,D,v,E=!1){Object.keys(v).forEach(function(g){Ue(d,g.split("."))||(Ve(d,g.split("."),v[g]),E&&(F[g]=!0),(D[g]||[]).forEach(function(x){Ue(d,x.split("."))||Ve(d,x.split("."),v[g])}))})}function Ue(d,D){let v=d;a["dot-notation"]||(D=[D.join(".")]),D.slice(0,-1).forEach(function(g){v=v[g]||{}});const E=D[D.length-1];return typeof v!="object"?!1:E in v}function Ve(d,D,v){let E=d;a["dot-notation"]||(D=[D.join(".")]),D.slice(0,-1).forEach(function(pe){pe=Ti(pe),typeof E=="object"&&E[pe]===void 0&&(E[pe]={}),typeof E[pe]!="object"||Array.isArray(E[pe])?(Array.isArray(E[pe])?E[pe].push({}):E[pe]=[E[pe],{}],E=E[pe][E[pe].length-1]):E=E[pe]});const g=Ti(D[D.length-1]),x=k(D.join("."),m.arrays),O=Array.isArray(v);let P=a["duplicate-arguments-array"];!P&&k(g,m.nargs)&&(P=!0,(!je(E[g])&&m.nargs[g]===1||Array.isArray(E[g])&&E[g].length===m.nargs[g])&&(E[g]=void 0)),v===jn()?E[g]=jn(E[g]):Array.isArray(E[g])?P&&x&&O?E[g]=a["flatten-duplicate-arrays"]?E[g].concat(v):(Array.isArray(E[g][0])?E[g]:[E[g]]).concat([v]):!P&&!!x==!!O?E[g]=v:E[g]=E[g].concat([v]):E[g]===void 0&&x?E[g]=O?v:[v]:P&&!(E[g]===void 0||k(g,m.counts)||k(g,m.bools))?E[g]=[E[g],v]:E[g]=v}function st(...d){d.forEach(function(D){Object.keys(D||{}).forEach(function(v){m.aliases[v]||(m.aliases[v]=[].concat(u[v]||[]),m.aliases[v].concat(v).forEach(function(E){if(/-/.test(E)&&a["camel-case-expansion"]){const g=jt(E);g!==v&&m.aliases[v].indexOf(g)===-1&&(m.aliases[v].push(g),C[g]=!0)}}),m.aliases[v].concat(v).forEach(function(E){if(E.length>1&&/[A-Z]/.test(E)&&a["camel-case-expansion"]){const g=Mi(E,"-");g!==v&&m.aliases[v].indexOf(g)===-1&&(m.aliases[v].push(g),C[g]=!0)}}),m.aliases[v].forEach(function(E){m.aliases[E]=[v].concat(m.aliases[v].filter(function(g){return E!==g}))}))})})}function k(d,D){const v=[].concat(m.aliases[d]||[],d),E=Object.keys(D),g=v.find(x=>E.includes(x));return g?D[g]:!1}function vn(d){const D=Object.keys(m);return[].concat(D.map(E=>m[E])).some(function(E){return Array.isArray(E)?E.includes(d):E[d]})}function M(d,...D){return[].concat(...D).some(function(E){const g=d.match(E);return g&&vn(g[1])})}function te(d){if(d.match(y)||!d.match(/^-[^-]+/))return!1;let D=!0,v;const E=d.slice(1).split("");for(let g=0;g<E.length;g++){if(v=d.slice(g+2),!vn(E[g])){D=!1;break}if(E[g+1]&&E[g+1]==="="||v==="-"||/[A-Za-z]/.test(E[g])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(v)||E[g+1]&&E[g+1].match(/\W/))break}return D}function ie(d){return a["unknown-options-as-args"]&&q(d)}function q(d){return d=d.replace(/^-{3,}/,"--"),d.match(y)||te(d)?!1:!M(d,/^-+([^=]+?)=[\s\S]*$/,S,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function re(d){return!k(d,m.bools)&&!k(d,m.counts)&&`${d}`in c?c[d]:ue(xe(d))}function ue(d){return{[Pe.BOOLEAN]:!0,[Pe.STRING]:"",[Pe.NUMBER]:void 0,[Pe.ARRAY]:[]}[d]}function xe(d){let D=Pe.BOOLEAN;return k(d,m.strings)?D=Pe.STRING:k(d,m.numbers)?D=Pe.NUMBER:k(d,m.bools)?D=Pe.BOOLEAN:k(d,m.arrays)&&(D=Pe.ARRAY),D}function je(d){return d===void 0}function Kt(){Object.keys(m.counts).find(d=>k(d,m.arrays)?(R=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",d)),!0):k(d,m.nargs)?(R=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",d)),!0):!1)}return{aliases:Object.assign({},m.aliases),argv:Object.assign(Ce,U),configuration:a,defaulted:Object.assign({},F),error:R,newAliases:Object.assign({},C)}}}function zs(i){const e=[],t=Object.create(null);let n=!0;for(Object.keys(i).forEach(function(r){e.push([].concat(i[r],r))});n;){n=!1;for(let r=0;r<e.length;r++)for(let s=r+1;s<e.length;s++)if(e[r].filter(function(a){return e[s].indexOf(a)!==-1}).length){e[r]=e[r].concat(e[s]),e.splice(s,1),n=!0;break}}return e.forEach(function(r){r=r.filter(function(u,a,c){return c.indexOf(u)===a});const s=r.pop();s!==void 0&&typeof s=="string"&&(t[s]=r)}),t}function jn(i){return i!==void 0?i+1:1}function Ti(i){return i==="__proto__"?"___proto___":i}function Hs(i){return typeof i=="string"&&(i[0]==="'"||i[0]==='"')&&i[i.length-1]===i[0]?i.substring(1,i.length-1):i}var Ln,Pn,Nn;const Ri=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Wi=(Pn=(Ln=process==null?void 0:process.versions)===null||Ln===void 0?void 0:Ln.node)!==null&&Pn!==void 0?Pn:(Nn=process==null?void 0:process.version)===null||Nn===void 0?void 0:Nn.slice(1);if(Wi&&Number(Wi.match(/^([^.]+)/)[1])<Ri)throw Error(`yargs parser supports a minimum Node.js version of ${Ri}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Gs=process?process.env:{},Ui=new Vs({cwd:process.cwd,env:()=>Gs,format:Ii,normalize:hs,resolve:ve,require:i=>{if(typeof Qt<"u")return Qt(i);if(i.match(/\.json$/))return JSON.parse($n(i,"utf8"));throw Error("only .json config files are supported in ESM")}}),Lt=function(e,t){return Ui.parse(e.slice(),t).argv};Lt.detailed=function(i,e){return Ui.parse(i.slice(),e)},Lt.camelCase=jt,Lt.decamelize=Mi,Lt.looksLikeNumber=ki;function Vi(){return Ys()?0:1}function Ys(){return qs()&&!process.defaultApp}function qs(){return!!process.versions.electron}function Js(i){return i.slice(Vi()+1)}function Ks(){return process.argv[Vi()]}class fe extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,fe)}}const Qs={fs:{readFileSync:$n,writeFile:Cs},format:Ii,resolve:ve,exists:i=>{try{return Si(i).isFile()}catch{return!1}}};let Ne;class Xs{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(),Ne.format.apply(Ne.format,[this.cache[this.locale][t]||t].concat(e))}__n(){const e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),r=e.shift();let s=function(){};typeof e[e.length-1]=="function"&&(s=e.pop()),this.cache[this.locale]||this._readLocaleFile();let u=r===1?t:n;this.cache[this.locale][t]&&(u=this.cache[this.locale][t][r===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:s})):s();const a=[u];return~u.indexOf("%d")&&a.push(r),Ne.format.apply(Ne.format,a.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(r,s){const u=t[s+1];n+=r,typeof u<"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,r=t.locale,s=t.cb,u=this._resolveLocaleFile(n,r),a=JSON.stringify(this.cache[r],null,2);Ne.fs.writeFile(u,a,"utf-8",function(c){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),s(c)})}_readLocaleFile(){let e={};const t=this._resolveLocaleFile(this.directory,this.locale);try{Ne.fs.readFileSync&&(e=JSON.parse(Ne.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=Ne.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){const r=Ne.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(r)&&(n=r)}return n}_fileExistsSync(e){return Ne.exists(e)}}function Zs(i,e){Ne=e;const t=new Xs(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 eu=i=>Zs(i,Qs),tu="require is not supported by ESM",zi="loading a directory of commands is not supported yet for ESM";let Pt;try{Pt=As(import.meta.url)}catch{Pt=process.cwd()}const nu=Pt.substring(0,Pt.lastIndexOf("node_modules")),iu={assert:{notStrictEqual:fs,strictEqual:ds},cliui:Rs,findUp:Ws,getEnv:i=>process.env[i],inspect:ws,getCallerFile:()=>{throw new fe(zi)},getProcessArgvBin:Ks,mainFilename:nu||process.cwd(),Parser:Lt,path:{basename:ps,dirname:In,extname:ms,relative:gs,resolve:ve},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:$n,require:()=>{throw new fe(tu)},requireDirectory:()=>{throw new fe(zi)},stringWidth:i=>[...i].length,y18n:eu({directory:ve(Pt,"../../../locales"),updateFiles:!1})};function Me(i,e,t,n){t.assert.notStrictEqual(i,e,n)}function Hi(i,e){e.assert.strictEqual(typeof i,"string")}function rn(i){return Object.keys(i)}function le(i){return!!i&&!!i.then&&typeof i.then=="function"}function Nt(i){const t=i.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,r=t.shift();if(!r)throw new Error(`No command found in: ${i}`);const s={cmd:r.replace(n,""),demanded:[],optional:[]};return t.forEach((u,a)=>{let c=!1;u=u.replace(/\s/g,""),/\.+[\]>]/.test(u)&&a===t.length-1&&(c=!0),/^\[/.test(u)?s.optional.push({cmd:u.replace(n,"").split("|"),variadic:c}):s.demanded.push({cmd:u.replace(n,"").split("|"),variadic:c})}),s}const ru=["first","second","third","fourth","fifth","sixth"];function $(i,e,t){function n(){return typeof i=="object"?[{demanded:[],optional:[]},i,e]:[Nt(`cmd ${i}`),e,t]}try{let r=0;const[s,u,a]=n(),c=[].slice.call(u);for(;c.length&&c[c.length-1]===void 0;)c.pop();const h=a||c.length;if(h<s.demanded.length)throw new fe(`Not enough arguments provided. Expected ${s.demanded.length} but received ${c.length}.`);const l=s.demanded.length+s.optional.length;if(h>l)throw new fe(`Too many arguments provided. Expected max ${l} but received ${h}.`);s.demanded.forEach(f=>{const p=c.shift(),C=Gi(p);f.cmd.filter(w=>w===C||w==="*").length===0&&Yi(C,f.cmd,r),r+=1}),s.optional.forEach(f=>{if(c.length===0)return;const p=c.shift(),C=Gi(p);f.cmd.filter(w=>w===C||w==="*").length===0&&Yi(C,f.cmd,r),r+=1})}catch(r){console.warn(r.stack)}}function Gi(i){return Array.isArray(i)?"array":i===null?"null":typeof i}function Yi(i,e,t){throw new fe(`Invalid ${ru[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${i}.`)}class su{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,r=!1){if($("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let s=0;s<e.length;s++){if(typeof e[s]!="function")throw Error("middleware must be a function");const u=e[s];u.applyBeforeValidation=t,u.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){const s=e;s.applyBeforeValidation=t,s.global=n,s.mutates=r,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){const n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(r=>{const s=[...n[t]||[],t];return r.option?!s.includes(r.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 uu(i){return i?i.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Mt(i,e,t,n){return t.reduce((r,s)=>{if(s.applyBeforeValidation!==n)return r;if(s.mutates){if(s.applied)return r;s.applied=!0}if(le(r))return r.then(u=>Promise.all([u,s(u,e)])).then(([u,a])=>Object.assign(u,a));{const u=s(r,e);return le(u)?u.then(a=>Object.assign(r,a)):Object.assign(r,u)}},i)}function kt(i,e,t=n=>{throw n}){try{const n=ou(i)?i():i;return le(n)?n.then(r=>e(r)):e(n)}catch(n){return t(n)}}function ou(i){return typeof i=="function"}function au(i){if(typeof Qt>"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 Ft=/(^\*)|(^\$0)/;class cu{constructor(e,t,n,r){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=r,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,r){r=r||{},typeof r.recurse!="boolean"&&(r.recurse=!1),Array.isArray(r.extensions)||(r.extensions=["js"]);const s=typeof r.visit=="function"?r.visit:u=>u;r.visit=(u,a,c)=>{const h=s(u,a,c);if(h){if(this.requireCache.has(a))return h;this.requireCache.add(a),this.addHandler(h)}return h},this.shim.requireDirectory({require:t,filename:n},e,r)}addHandler(e,t,n,r,s,u){let a=[];const c=uu(s);if(r=r||(()=>{}),Array.isArray(e))if(fu(e))[e,...a]=e;else for(const h of e)this.addHandler(h);else if(hu(e)){let h=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(h=[].concat(h).concat(e.aliases)),this.addHandler(h,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(qi(n)){this.addHandler([e].concat(a),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){const h=Nt(e);a=a.map(p=>Nt(p).cmd);let l=!1;const f=[h.cmd].concat(a).filter(p=>Ft.test(p)?(l=!0,!1):!0);f.length===0&&l&&f.push("$0"),l&&(h.cmd=f[0],a=f.slice(1),e=e.replace(Ft,h.cmd)),a.forEach(p=>{this.aliasMap[p]=h.cmd}),t!==!1&&this.usage.command(e,t,l,a,u),this.handlers[h.cmd]={original:e,description:t,handler:r,builder:n||{},middlewares:c,deprecated:u,demanded:h.demanded,optional:h.optional},l&&(this.defaultCommand=this.handlers[h.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,r,s,u){const a=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,c=t.getInternalMethods().getContext(),h=c.commands.slice(),l=!e;e&&(c.commands.push(e),c.fullCommands.push(a.original));const f=this.applyBuilderUpdateUsageAndParse(l,a,t,n.aliases,h,r,s,u);return le(f)?f.then(p=>this.applyMiddlewareAndGetResult(l,a,p.innerArgv,c,s,p.aliases,t)):this.applyMiddlewareAndGetResult(l,a,f.innerArgv,c,s,f.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,r,s,u,a,c){const h=t.builder;let l=n;if(Mn(h)){n.getInternalMethods().getUsageInstance().freeze();const f=h(n.getInternalMethods().reset(r),c);if(le(f))return f.then(p=>(l=Su(p)?p:n,this.parseAndUpdateUsage(e,t,l,s,u,a)))}else du(h)&&(n.getInternalMethods().getUsageInstance().freeze(),l=n.getInternalMethods().reset(r),Object.keys(t.builder).forEach(f=>{l.option(f,h[f])}));return this.parseAndUpdateUsage(e,t,l,s,u,a)}parseAndUpdateUsage(e,t,n,r,s,u){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(r,t),t.description);const a=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,s,u);return le(a)?a.then(c=>({aliases:n.parsed.aliases,innerArgv:c})):{aliases:n.parsed.aliases,innerArgv:a}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){const n=Ft.test(t.original)?t.original.replace(Ft,"").trim():t.original,r=e.filter(s=>!Ft.test(s));return r.push(n),`$0 ${r.join(" ")}`}handleValidationAndGetResult(e,t,n,r,s,u,a,c){if(!u.getInternalMethods().getHasOutput()){const h=u.getInternalMethods().runValidation(s,c,u.parsed.error,e);n=kt(n,l=>(h(l),l))}if(t.handler&&!u.getInternalMethods().getHasOutput()){u.getInternalMethods().setHasOutput();const h=!!u.getOptions().configuration["populate--"];u.getInternalMethods().postProcess(n,h,!1,!1),n=Mt(n,u,a,!1),n=kt(n,l=>{const f=t.handler(l);return le(f)?f.then(()=>l):l}),e||u.getInternalMethods().getUsageInstance().cacheHelpMessage(),le(n)&&!u.getInternalMethods().hasParseCallback()&&n.catch(l=>{try{u.getInternalMethods().getUsageInstance().fail(null,l)}catch{}})}return e||(r.commands.pop(),r.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,r,s,u,a){let c={};if(s)return n;a.getInternalMethods().getHasOutput()||(c=this.populatePositionals(t,n,r,a));const h=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),l=Mt(n,a,h,!0);return le(l)?l.then(f=>this.handleValidationAndGetResult(e,t,f,r,u,a,h,c)):this.handleValidationAndGetResult(e,t,l,r,u,a,h,c)}populatePositionals(e,t,n,r){t._=t._.slice(n.commands.length);const s=e.demanded.slice(0),u=e.optional.slice(0),a={};for(this.validation.positionalCount(s.length,t._.length);s.length;){const c=s.shift();this.populatePositional(c,t,a)}for(;u.length;){const c=u.shift();this.populatePositional(c,t,a)}return t._=n.commands.concat(t._.map(c=>""+c)),this.postProcessPositionals(t,a,this.cmdToParseOptions(e.original),r),a}populatePositional(e,t,n){const r=e.cmd[0];e.variadic?n[r]=t._.splice(0).map(String):t._.length&&(n[r]=[String(t._.shift())])}cmdToParseOptions(e){const t={array:[],default:{},alias:{},demand:{}},n=Nt(e);return n.demanded.forEach(r=>{const[s,...u]=r.cmd;r.variadic&&(t.array.push(s),t.default[s]=[]),t.alias[s]=u,t.demand[s]=!0}),n.optional.forEach(r=>{const[s,...u]=r.cmd;r.variadic&&(t.array.push(s),t.default[s]=[]),t.alias[s]=u}),t}postProcessPositionals(e,t,n,r){const s=Object.assign({},r.getOptions());s.default=Object.assign(n.default,s.default);for(const h of Object.keys(n.alias))s.alias[h]=(s.alias[h]||[]).concat(n.alias[h]);s.array=s.array.concat(n.array),s.config={};const u=[];if(Object.keys(t).forEach(h=>{t[h].map(l=>{s.configuration["unknown-options-as-args"]&&(s.key[h]=!0),u.push(`--${h}`),u.push(l)})}),!u.length)return;const a=Object.assign({},s.configuration,{"populate--":!1}),c=this.shim.Parser.detailed(u,Object.assign({},s,{configuration:a}));if(c.error)r.getInternalMethods().getUsageInstance().fail(c.error.message,c.error);else{const h=Object.keys(t);Object.keys(t).forEach(l=>{h.push(...c.aliases[l])}),Object.keys(c.argv).forEach(l=>{h.includes(l)&&(t[l]||(t[l]=c.argv[l]),!this.isInConfigs(r,l)&&!this.isDefaulted(r,l)&&Object.prototype.hasOwnProperty.call(e,l)&&Object.prototype.hasOwnProperty.call(c.argv,l)&&(Array.isArray(e[l])||Array.isArray(c.argv[l]))?e[l]=[].concat(e[l],c.argv[l]):e[l]=c.argv[l])})}}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(r=>Object.prototype.hasOwnProperty.call(r,t))||n.some(r=>Object.prototype.hasOwnProperty.call(r,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){const n=Ft.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(Mn(t))return t(e,!0);qi(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){const t=au(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 r of[e,t,n]){if(typeof r=="string"||r===!1)return r;Me(r,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const e=this.frozens.pop();Me(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 lu(i,e,t,n){return new cu(i,e,t,n)}function qi(i){return typeof i=="object"&&!!i.builder&&typeof i.handler=="function"}function fu(i){return i.every(e=>typeof e=="string")}function Mn(i){return typeof i=="function"}function du(i){return typeof i=="object"}function hu(i){return typeof i=="object"&&!Array.isArray(i)}function Tt(i={},e=()=>!0){const t={};return rn(i).forEach(n=>{e(n,i[n])&&(t[n]=i[n])}),t}function Rt(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 pu(i){return typeof i=="boolean"}function mu(i,e){const t=e.y18n.__,n={},r=[];n.failFn=function(B){r.push(B)};let s=null,u=null,a=!0;n.showHelpOnFail=function(B=!0,I){const[V,K]=typeof B=="string"?[!0,B]:[B,I];return i.getInternalMethods().isGlobalContext()&&(u=K),s=K,a=V,n};let c=!1;n.fail=function(B,I){const V=i.getInternalMethods().getLoggerInstance();if(r.length)for(let K=r.length-1;K>=0;--K){const de=r[K];if(pu(de)){if(I)throw I;if(B)throw Error(B)}else de(B,I,n)}else{if(i.getExitProcess()&&Rt(!0),!c){c=!0,a&&(i.showHelp("error"),V.error()),(B||I)&&V.error(B||I);const K=s||u;K&&((B||I)&&V.error(""),V.error(K))}if(I=I||new fe(B),i.getExitProcess())return i.exit(1);if(i.getInternalMethods().hasParseCallback())return i.exit(1,I);throw I}};let h=[],l=!1;n.usage=(j,B)=>j===null?(l=!0,h=[],n):(l=!1,h.push([j,B||""]),n),n.getUsage=()=>h,n.getUsageDisabled=()=>l,n.getPositionalGroupName=()=>t("Positionals:");let f=[];n.example=(j,B)=>{f.push([j,B||""])};let p=[];n.command=function(B,I,V,K,de=!1){V&&(p=p.map(J=>(J[2]=!1,J))),p.push([B,I||"",V,K,de])},n.getCommands=()=>p;let C={};n.describe=function(B,I){Array.isArray(B)?B.forEach(V=>{n.describe(V,I)}):typeof B=="object"?Object.keys(B).forEach(V=>{n.describe(V,B[V])}):C[B]=I},n.getDescriptions=()=>C;let F=[];n.epilog=j=>{F.push(j)};let w=!1,m;n.wrap=j=>{w=!0,m=j},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(w||(m=Et(),w=!0),m);const y="__yargsString__:";n.deferY18nLookup=j=>y+j,n.help=function(){if(N)return N;R();const B=i.customScriptName?i.$0:e.path.basename(i.$0),I=i.getDemandedOptions(),V=i.getDemandedCommands(),K=i.getDeprecatedOptions(),de=i.getGroups(),J=i.getOptions();let he=[];he=he.concat(Object.keys(C)),he=he.concat(Object.keys(I)),he=he.concat(Object.keys(V)),he=he.concat(Object.keys(J.default)),he=he.filter(Ce),he=Object.keys(he.reduce((M,te)=>(te!=="_"&&(M[te]=!0),M),{}));const rt=n.getWrap(),ne=e.cliui({width:rt,wrap:!!rt});if(!l){if(h.length)h.forEach(M=>{ne.div({text:`${M[0].replace(/\$0/g,B)}`}),M[1]&&ne.div({text:`${M[1]}`,padding:[1,0,0,0]})}),ne.div();else if(p.length){let M=null;V._?M=`${B} <${t("command")}>
8
- `:M=`${B} [${t("command")}]
9
- `,ne.div(`${M}`)}}if(p.length>1||p.length===1&&!p[0][2]){ne.div(t("Commands:"));const M=i.getInternalMethods().getContext(),te=M.commands.length?`${M.commands.join(" ")} `:"";i.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(p=p.sort((q,re)=>q[0].localeCompare(re[0])));const ie=B?`${B} `:"";p.forEach(q=>{const re=`${ie}${te}${q[0].replace(/^\$0 ?/,"")}`;ne.span({text:re,padding:[0,2,0,2],width:S(p,rt,`${B}${te}`)+4},{text:q[1]});const ue=[];q[2]&&ue.push(`[${t("default")}]`),q[3]&&q[3].length&&ue.push(`[${t("aliases:")} ${q[3].join(", ")}]`),q[4]&&(typeof q[4]=="string"?ue.push(`[${t("deprecated: %s",q[4])}]`):ue.push(`[${t("deprecated")}]`)),ue.length?ne.div({text:ue.join(" "),padding:[0,0,0,2],align:"right"}):ne.div()}),ne.div()}const Ue=(Object.keys(J.alias)||[]).concat(Object.keys(i.parsed.newAliases)||[]);he=he.filter(M=>!i.parsed.newAliases[M]&&Ue.every(te=>(J.alias[te]||[]).indexOf(M)===-1));const Ve=t("Options:");de[Ve]||(de[Ve]=[]),U(he,J.alias,de,Ve);const st=M=>/^--/.test(sn(M)),k=Object.keys(de).filter(M=>de[M].length>0).map(M=>{const te=de[M].filter(Ce).map(ie=>{if(Ue.includes(ie))return ie;for(let q=0,re;(re=Ue[q])!==void 0;q++)if((J.alias[re]||[]).includes(ie))return re;return ie});return{groupName:M,normalizedKeys:te}}).filter(({normalizedKeys:M})=>M.length>0).map(({groupName:M,normalizedKeys:te})=>{const ie=te.reduce((q,re)=>(q[re]=[re].concat(J.alias[re]||[]).map(ue=>M===n.getPositionalGroupName()?ue:(/^[0-9]$/.test(ue)?J.boolean.includes(re)?"-":"--":ue.length>1?"--":"-")+ue).sort((ue,xe)=>st(ue)===st(xe)?0:st(ue)?1:-1).join(", "),q),{});return{groupName:M,normalizedKeys:te,switches:ie}});if(k.filter(({groupName:M})=>M!==n.getPositionalGroupName()).some(({normalizedKeys:M,switches:te})=>!M.every(ie=>st(te[ie])))&&k.filter(({groupName:M})=>M!==n.getPositionalGroupName()).forEach(({normalizedKeys:M,switches:te})=>{M.forEach(ie=>{st(te[ie])&&(te[ie]=gu(te[ie],4))})}),k.forEach(({groupName:M,normalizedKeys:te,switches:ie})=>{ne.div(M),te.forEach(q=>{const re=ie[q];let ue=C[q]||"",xe=null;ue.includes(y)&&(ue=t(ue.substring(y.length))),J.boolean.includes(q)&&(xe=`[${t("boolean")}]`),J.count.includes(q)&&(xe=`[${t("count")}]`),J.string.includes(q)&&(xe=`[${t("string")}]`),J.normalize.includes(q)&&(xe=`[${t("string")}]`),J.array.includes(q)&&(xe=`[${t("array")}]`),J.number.includes(q)&&(xe=`[${t("number")}]`);const je=D=>typeof D=="string"?`[${t("deprecated: %s",D)}]`:`[${t("deprecated")}]`,Kt=[q in K?je(K[q]):null,xe,q in I?`[${t("required")}]`:null,J.choices&&J.choices[q]?`[${t("choices:")} ${n.stringifiedValues(J.choices[q])}]`:null,$e(J.default[q],J.defaultDescription[q])].filter(Boolean).join(" ");ne.span({text:sn(re),padding:[0,2,0,2+Ji(re)],width:S(ie,rt)+4},ue);const d=i.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;Kt&&!d?ne.div({text:Kt,padding:[0,0,0,2],align:"right"}):ne.div()}),ne.div()}),f.length&&(ne.div(t("Examples:")),f.forEach(M=>{M[0]=M[0].replace(/\$0/g,B)}),f.forEach(M=>{M[1]===""?ne.div({text:M[0],padding:[0,2,0,2]}):ne.div({text:M[0],padding:[0,2,0,2],width:S(f,rt)+4},{text:M[1]})}),ne.div()),F.length>0){const M=F.map(te=>te.replace(/\$0/g,B)).join(`
10
- `);ne.div(`${M}
11
- `)}return ne.toString().replace(/\s*$/,"")};function S(j,B,I){let V=0;return Array.isArray(j)||(j=Object.values(j).map(K=>[K])),j.forEach(K=>{V=Math.max(e.stringWidth(I?`${I} ${sn(K[0])}`:sn(K[0]))+Ji(K[0]),V)}),B&&(V=Math.min(V,parseInt((B*.5).toString(),10))),V}function R(){const j=i.getDemandedOptions(),B=i.getOptions();(Object.keys(B.alias)||[]).forEach(I=>{B.alias[I].forEach(V=>{C[V]&&n.describe(I,C[V]),V in j&&i.demandOption(I,j[V]),B.boolean.includes(V)&&i.boolean(I),B.count.includes(V)&&i.count(I),B.string.includes(V)&&i.string(I),B.normalize.includes(V)&&i.normalize(I),B.array.includes(V)&&i.array(I),B.number.includes(V)&&i.number(I)})})}let N;n.cacheHelpMessage=function(){N=this.help()},n.clearCachedHelpMessage=function(){N=void 0},n.hasCachedHelpMessage=function(){return!!N};function U(j,B,I,V){let K=[],de=null;return Object.keys(I).forEach(J=>{K=K.concat(I[J])}),j.forEach(J=>{de=[J].concat(B[J]),de.some(he=>K.indexOf(he)!==-1)||I[V].push(J)}),K}function Ce(j){return i.getOptions().hiddenOptions.indexOf(j)<0||i.parsed.argv[i.getOptions().showHiddenOpt]}n.showHelp=j=>{const B=i.getInternalMethods().getLoggerInstance();j||(j="error"),(typeof j=="function"?j:B[j])(n.help())},n.functionDescription=j=>["(",j.name?e.Parser.decamelize(j.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(B,I){let V="";const K=I||", ",de=[].concat(B);return!B||!de.length||de.forEach(J=>{V.length&&(V+=K),V+=JSON.stringify(J)}),V};function $e(j,B){let I=`[${t("default:")} `;if(j===void 0&&!B)return null;if(B)I+=B;else switch(typeof j){case"string":I+=`"${j}"`;break;case"object":I+=JSON.stringify(j);break;default:I+=j}return`${I}]`}function Et(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let it=null;n.version=j=>{it=j},n.showVersion=j=>{const B=i.getInternalMethods().getLoggerInstance();j||(j="error"),(typeof j=="function"?j:B[j])(it)},n.reset=function(B){return s=null,c=!1,h=[],l=!1,F=[],f=[],p=[],C=Tt(C,I=>!B[I]),n};const X=[];return n.freeze=function(){X.push({failMessage:s,failureOutput:c,usages:h,usageDisabled:l,epilogs:F,examples:f,commands:p,descriptions:C})},n.unfreeze=function(B=!1){const I=X.pop();I&&(B?(C={...I.descriptions,...C},p=[...I.commands,...p],h=[...I.usages,...h],f=[...I.examples,...f],F=[...I.epilogs,...F]):{failMessage:s,failureOutput:c,usages:h,usageDisabled:l,epilogs:F,examples:f,commands:p,descriptions:C}=I)},n}function kn(i){return typeof i=="object"}function gu(i,e){return kn(i)?{text:i.text,indentation:i.indentation+e}:{text:i,indentation:e}}function Ji(i){return kn(i)?i.indentation:0}function sn(i){return kn(i)?i.text:i}const Du=`###-begin-{{app_name}}-completions-###
6
+ `),s.border&&(r.unshift("."+"-".repeat(this.negatePadding(s)+2)+"."),r.push("'"+"-".repeat(this.negatePadding(s)+2)+"'")),s.padding&&(r.unshift(...new Array(s.padding[ks]||0).fill("")),r.push(...new Array(s.padding[Ms]||0).fill(""))),r.forEach((a,c)=>{t[c]||t.push([]);const h=t[c];for(let l=0;l<o;l++)h[l]===void 0&&h.push("");h.push(a)})}),t}negatePadding(e){let t=e.width||0;return e.padding&&(t-=(e.padding[nn]||0)+(e.padding[tn]||0)),e.border&&(t-=4),t}columnWidths(e){if(!this.wrap)return e.map(o=>o.width||Ee.stringWidth(o.text));let t=e.length,n=this.width;const r=e.map(o=>{if(o.width)return t--,n-=o.width,o.width}),s=t?Math.floor(n/t):0;return r.map((o,a)=>o===void 0?Math.max(s,Rs(e[a])):o)}}function Pi(i,e,t){return i.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function Rs(i){const e=i.padding||[],t=1+(e[nn]||0)+(e[tn]||0);return i.border?t+4:t}function Us(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Ws(i,e){i=i.trim();const t=Ee.stringWidth(i);return t<e?" ".repeat(e-t)+i:i}function Vs(i,e){i=i.trim();const t=Ee.stringWidth(i);return t>=e?i:" ".repeat(e-t>>1)+i}let Ee;function zs(i,e){return Ee=e,new Ts({width:i?.width||Us(),wrap:i?.wrap})}const Ni=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function ki(i){return i.replace(Ni,"")}function Hs(i,e){const[t,n]=i.match(Ni)||["",""];i=ki(i);let r="";for(let s=0;s<i.length;s++)s!==0&&s%e===0&&(r+=`
7
+ `),r+=i.charAt(s);return t&&n&&(r=`${t}${r}${n}`),r}function Gs(i){return zs(i,{stringWidth:e=>[...e].length,stripAnsi:ki,wrap:Hs})}function Ys(i,e){let t=ve(".",i),n;for(Oi(t).isDirectory()||(t=$n(t));;){if(n=e(t,As(t)),n)return ve(t,n);if(t=$n(n=t),n===t)break}}function Lt(i){if(i!==i.toLowerCase()&&i!==i.toUpperCase()||(i=i.toLowerCase()),i.indexOf("-")===-1&&i.indexOf("_")===-1)return i;{let t="",n=!1;const r=i.match(/^-+/);for(let s=r?r[0].length:0;s<i.length;s++){let o=i.charAt(s);n&&(n=!1,o=o.toUpperCase()),s!==0&&(o==="-"||o==="_")?n=!0:o!=="-"&&o!=="_"&&(t+=o)}return t}}function Mi(i,e){const t=i.toLowerCase();e=e||"-";let n="";for(let r=0;r<i.length;r++){const s=t.charAt(r),o=i.charAt(r);s!==o&&r>0?n+=`${e}${t.charAt(r)}`:n+=o}return n}function Ti(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 qs(i){if(Array.isArray(i))return i.map(o=>typeof o!="string"?o+"":o);i=i.trim();let e=0,t=null,n=null,r=null;const s=[];for(let o=0;o<i.length;o++){if(t=n,n=i.charAt(o),n===" "&&!r){t!==" "&&e++;continue}n===r?r=null:(n==="'"||n==='"')&&!r&&(r=n),s[e]||(s[e]=""),s[e]+=n}return s}var Pe;(function(i){i.BOOLEAN="boolean",i.STRING="string",i.NUMBER="number",i.ARRAY="array"})(Pe||(Pe={}));let Ge;class Js{constructor(e){Ge=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),r=qs(e),s=typeof e=="string",o=Ks(Object.assign(Object.create(null),n.alias)),a=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),c=Object.assign(Object.create(null),n.default),h=n.configObjects||[],l=n.envPrefix,f=a["populate--"],p=f?"--":"_",C=Object.create(null),F=Object.create(null),w=n.__||Ge.format,m={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},y=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,S=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(d){const D=typeof d=="object"?d.key:d,v=Object.keys(d).map(function(E){return{boolean:"bools",string:"strings",number:"numbers"}[E]}).filter(Boolean).pop();v&&(m[v][D]=!0),m.arrays[D]=!0,m.keys.push(D)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(d){m.bools[d]=!0,m.keys.push(d)}),[].concat(n.string||[]).filter(Boolean).forEach(function(d){m.strings[d]=!0,m.keys.push(d)}),[].concat(n.number||[]).filter(Boolean).forEach(function(d){m.numbers[d]=!0,m.keys.push(d)}),[].concat(n.count||[]).filter(Boolean).forEach(function(d){m.counts[d]=!0,m.keys.push(d)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(d){m.normalize[d]=!0,m.keys.push(d)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([d,D])=>{typeof D=="number"&&(m.nargs[d]=D,m.keys.push(d))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([d,D])=>{typeof D=="function"&&(m.coercions[d]=D,m.keys.push(d))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(d){m.configs[d]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([d,D])=>{(typeof D=="boolean"||typeof D=="function")&&(m.configs[d]=D)})),st(n.key,o,n.default,m.arrays),Object.keys(c).forEach(function(d){(m.aliases[d]||[]).forEach(function(D){c[D]=c[d]})});let R=null;Qt();let N=[];const W=Object.assign(Object.create(null),{_:[]}),Ce={};for(let d=0;d<r.length;d++){const D=r[d],v=D.replace(/^-{3,}/,"---");let E,g,x,O,P,pe;if(D!=="--"&&/^-/.test(D)&&ie(D))Ie(D);else if(v.match(/^---+(=|$)/)){Ie(D);continue}else if(D.match(/^--.+=/)||!a["short-option-groups"]&&D.match(/^-.+=/))O=D.match(/^--?([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&(M(O[1],m.arrays)?d=it(d,O[1],r,O[2]):M(O[1],m.nargs)!==!1?d=bt(d,O[1],r,O[2]):X(O[1],O[2],!0));else if(D.match(S)&&a["boolean-negation"])O=D.match(S),O!==null&&Array.isArray(O)&&O.length>=2&&(g=O[1],X(g,M(g,m.arrays)?[!1]:!1));else if(D.match(/^--.+/)||!a["short-option-groups"]&&D.match(/^-[^-]+/))O=D.match(/^--?(.+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(g=O[1],M(g,m.arrays)?d=it(d,g,r):M(g,m.nargs)!==!1?d=bt(d,g,r):(P=r[d+1],P!==void 0&&(!P.match(/^-/)||P.match(y))&&!M(g,m.bools)&&!M(g,m.counts)||/^(true|false)$/.test(P)?(X(g,P),d++):X(g,re(g))));else if(D.match(/^-.\..+=/))O=D.match(/^-([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&X(O[1],O[2]);else if(D.match(/^-.\..+/)&&!D.match(y))P=r[d+1],O=D.match(/^-(.\..+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(g=O[1],P!==void 0&&!P.match(/^-/)&&!M(g,m.bools)&&!M(g,m.counts)?(X(g,P),d++):X(g,re(g)));else if(D.match(/^-[^-]+/)&&!D.match(y)){x=D.slice(1,-1).split(""),E=!1;for(let we=0;we<x.length;we++){if(P=D.slice(we+2),x[we+1]&&x[we+1]==="="){pe=D.slice(we+3),g=x[we],M(g,m.arrays)?d=it(d,g,r,pe):M(g,m.nargs)!==!1?d=bt(d,g,r,pe):X(g,pe),E=!0;break}if(P==="-"){X(x[we],P);continue}if(/[A-Za-z]/.test(x[we])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(P)&&M(P,m.bools)===!1){X(x[we],P),E=!0;break}if(x[we+1]&&x[we+1].match(/\W/)){X(x[we],P),E=!0;break}else X(x[we],re(x[we]))}g=D.slice(-1)[0],!E&&g!=="-"&&(M(g,m.arrays)?d=it(d,g,r):M(g,m.nargs)!==!1?d=bt(d,g,r):(P=r[d+1],P!==void 0&&(!/^(-|--)[^-]/.test(P)||P.match(y))&&!M(g,m.bools)&&!M(g,m.counts)||/^(true|false)$/.test(P)?(X(g,P),d++):X(g,re(g))))}else if(D.match(/^-[0-9]$/)&&D.match(y)&&M(D.slice(1),m.bools))g=D.slice(1),X(g,re(g));else if(D==="--"){N=r.slice(d+1);break}else if(a["halt-at-non-option"]){N=r.slice(d);break}else Ie(D)}K(W,!0),K(W,!1),V(W),de(),ne(W,m.aliases,c,!0),he(W),a["set-placeholder-key"]&&rt(W),Object.keys(m.counts).forEach(function(d){We(W,d.split("."))||X(d,0)}),f&&N.length&&(W[p]=[]),N.forEach(function(d){W[p].push(d)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(W).filter(d=>d!=="--"&&d.includes("-")).forEach(d=>{delete W[d]}),a["strip-aliased"]&&[].concat(...Object.keys(o).map(d=>o[d])).forEach(d=>{a["camel-case-expansion"]&&d.includes("-")&&delete W[d.split(".").map(D=>Lt(D)).join(".")],delete W[d]});function Ie(d){const D=$("_",d);(typeof D=="string"||typeof D=="number")&&W._.push(D)}function bt(d,D,v,E){let g,x=M(D,m.nargs);if(x=typeof x!="number"||isNaN(x)?1:x,x===0)return je(E)||(R=Error(w("Argument unexpected for: %s",D))),X(D,re(D)),d;let O=je(E)?0:1;if(a["nargs-eats-options"])v.length-(d+1)+O<x&&(R=Error(w("Not enough arguments following: %s",D))),O=x;else{for(g=d+1;g<v.length&&(!v[g].match(/^-[^0-9]/)||v[g].match(y)||ie(v[g]));g++)O++;O<x&&(R=Error(w("Not enough arguments following: %s",D)))}let P=Math.min(O,x);for(!je(E)&&P>0&&(X(D,E),P--),g=d+1;g<P+d+1;g++)X(D,v[g]);return d+P}function it(d,D,v,E){let g=[],x=E||v[d+1];const O=M(D,m.nargs);if(M(D,m.bools)&&!/^(true|false)$/.test(x))g.push(!0);else if(je(x)||je(E)&&/^-/.test(x)&&!y.test(x)&&!ie(x)){if(c[D]!==void 0){const P=c[D];g=Array.isArray(P)?P:[P]}}else{je(E)||g.push(B(D,E,!0));for(let P=d+1;P<v.length&&!(!a["greedy-arrays"]&&g.length>0||O&&typeof O=="number"&&g.length>=O||(x=v[P],/^-/.test(x)&&!y.test(x)&&!ie(x)));P++)d=P,g.push(B(D,x,s))}return typeof O=="number"&&(O&&g.length<O||isNaN(O)&&g.length===0)&&(R=Error(w("Not enough arguments following: %s",D))),X(D,g),d}function X(d,D,v=s){if(/-/.test(d)&&a["camel-case-expansion"]){const x=d.split(".").map(function(O){return Lt(O)}).join(".");j(d,x)}const E=B(d,D,v),g=d.split(".");Ve(W,g,E),m.aliases[d]&&m.aliases[d].forEach(function(x){const O=x.split(".");Ve(W,O,E)}),g.length>1&&a["dot-notation"]&&(m.aliases[g[0]]||[]).forEach(function(x){let O=x.split(".");const P=[].concat(g);P.shift(),O=O.concat(P),(m.aliases[d]||[]).includes(O.join("."))||Ve(W,O,E)}),M(d,m.normalize)&&!M(d,m.arrays)&&[d].concat(m.aliases[d]||[]).forEach(function(O){Object.defineProperty(Ce,O,{enumerable:!0,get(){return D},set(P){D=typeof P=="string"?Ge.normalize(P):P}})})}function j(d,D){m.aliases[d]&&m.aliases[d].length||(m.aliases[d]=[D],C[D]=!0),m.aliases[D]&&m.aliases[D].length||j(D,d)}function B(d,D,v){v&&(D=Qs(D)),(M(d,m.bools)||M(d,m.counts))&&typeof D=="string"&&(D=D==="true");let E=Array.isArray(D)?D.map(function(g){return $(d,g)}):$(d,D);return M(d,m.counts)&&(je(E)||typeof E=="boolean")&&(E=Ln()),M(d,m.normalize)&&M(d,m.arrays)&&(Array.isArray(D)?E=D.map(g=>Ge.normalize(g)):E=Ge.normalize(D)),E}function $(d,D){return!a["parse-positional-numbers"]&&d==="_"||!M(d,m.strings)&&!M(d,m.bools)&&!Array.isArray(D)&&(Ti(D)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${D}`)))||!je(D)&&M(d,m.numbers))&&(D=Number(D)),D}function V(d){const D=Object.create(null);ne(D,m.aliases,c),Object.keys(m.configs).forEach(function(v){const E=d[v]||D[v];if(E)try{let g=null;const x=Ge.resolve(Ge.cwd(),E),O=m.configs[v];if(typeof O=="function"){try{g=O(x)}catch(P){g=P}if(g instanceof Error){R=g;return}}else g=Ge.require(x);Q(g)}catch(g){g.name==="PermissionDenied"?R=g:d[v]&&(R=Error(w("Invalid JSON config file: %s",E)))}})}function Q(d,D){Object.keys(d).forEach(function(v){const E=d[v],g=D?D+"."+v:v;typeof E=="object"&&E!==null&&!Array.isArray(E)&&a["dot-notation"]?Q(E,g):(!We(W,g.split("."))||M(g,m.arrays)&&a["combine-arrays"])&&X(g,E)})}function de(){typeof h<"u"&&h.forEach(function(d){Q(d)})}function K(d,D){if(typeof l>"u")return;const v=typeof l=="string"?l:"",E=Ge.env();Object.keys(E).forEach(function(g){if(v===""||g.lastIndexOf(v,0)===0){const x=g.split("__").map(function(O,P){return P===0&&(O=O.substring(v.length)),Lt(O)});(D&&m.configs[x.join(".")]||!D)&&!We(d,x)&&X(x.join("."),E[g])}})}function he(d){let D;const v=new Set;Object.keys(d).forEach(function(E){if(!v.has(E)&&(D=M(E,m.coercions),typeof D=="function"))try{const g=$(E,D(d[E]));[].concat(m.aliases[E]||[],E).forEach(x=>{v.add(x),d[x]=g})}catch(g){R=g}})}function rt(d){return m.keys.forEach(D=>{~D.indexOf(".")||typeof d[D]>"u"&&(d[D]=void 0)}),d}function ne(d,D,v,E=!1){Object.keys(v).forEach(function(g){We(d,g.split("."))||(Ve(d,g.split("."),v[g]),E&&(F[g]=!0),(D[g]||[]).forEach(function(x){We(d,x.split("."))||Ve(d,x.split("."),v[g])}))})}function We(d,D){let v=d;a["dot-notation"]||(D=[D.join(".")]),D.slice(0,-1).forEach(function(g){v=v[g]||{}});const E=D[D.length-1];return typeof v!="object"?!1:E in v}function Ve(d,D,v){let E=d;a["dot-notation"]||(D=[D.join(".")]),D.slice(0,-1).forEach(function(pe){pe=Ri(pe),typeof E=="object"&&E[pe]===void 0&&(E[pe]={}),typeof E[pe]!="object"||Array.isArray(E[pe])?(Array.isArray(E[pe])?E[pe].push({}):E[pe]=[E[pe],{}],E=E[pe][E[pe].length-1]):E=E[pe]});const g=Ri(D[D.length-1]),x=M(D.join("."),m.arrays),O=Array.isArray(v);let P=a["duplicate-arguments-array"];!P&&M(g,m.nargs)&&(P=!0,(!je(E[g])&&m.nargs[g]===1||Array.isArray(E[g])&&E[g].length===m.nargs[g])&&(E[g]=void 0)),v===Ln()?E[g]=Ln(E[g]):Array.isArray(E[g])?P&&x&&O?E[g]=a["flatten-duplicate-arrays"]?E[g].concat(v):(Array.isArray(E[g][0])?E[g]:[E[g]]).concat([v]):!P&&!!x==!!O?E[g]=v:E[g]=E[g].concat([v]):E[g]===void 0&&x?E[g]=O?v:[v]:P&&!(E[g]===void 0||M(g,m.counts)||M(g,m.bools))?E[g]=[E[g],v]:E[g]=v}function st(...d){d.forEach(function(D){Object.keys(D||{}).forEach(function(v){m.aliases[v]||(m.aliases[v]=[].concat(o[v]||[]),m.aliases[v].concat(v).forEach(function(E){if(/-/.test(E)&&a["camel-case-expansion"]){const g=Lt(E);g!==v&&m.aliases[v].indexOf(g)===-1&&(m.aliases[v].push(g),C[g]=!0)}}),m.aliases[v].concat(v).forEach(function(E){if(E.length>1&&/[A-Z]/.test(E)&&a["camel-case-expansion"]){const g=Mi(E,"-");g!==v&&m.aliases[v].indexOf(g)===-1&&(m.aliases[v].push(g),C[g]=!0)}}),m.aliases[v].forEach(function(E){m.aliases[E]=[v].concat(m.aliases[v].filter(function(g){return E!==g}))}))})})}function M(d,D){const v=[].concat(m.aliases[d]||[],d),E=Object.keys(D),g=v.find(x=>E.includes(x));return g?D[g]:!1}function Bn(d){const D=Object.keys(m);return[].concat(D.map(E=>m[E])).some(function(E){return Array.isArray(E)?E.includes(d):E[d]})}function k(d,...D){return[].concat(...D).some(function(E){const g=d.match(E);return g&&Bn(g[1])})}function te(d){if(d.match(y)||!d.match(/^-[^-]+/))return!1;let D=!0,v;const E=d.slice(1).split("");for(let g=0;g<E.length;g++){if(v=d.slice(g+2),!Bn(E[g])){D=!1;break}if(E[g+1]&&E[g+1]==="="||v==="-"||/[A-Za-z]/.test(E[g])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(v)||E[g+1]&&E[g+1].match(/\W/))break}return D}function ie(d){return a["unknown-options-as-args"]&&q(d)}function q(d){return d=d.replace(/^-{3,}/,"--"),d.match(y)||te(d)?!1:!k(d,/^-+([^=]+?)=[\s\S]*$/,S,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function re(d){return!M(d,m.bools)&&!M(d,m.counts)&&`${d}`in c?c[d]:oe(xe(d))}function oe(d){return{[Pe.BOOLEAN]:!0,[Pe.STRING]:"",[Pe.NUMBER]:void 0,[Pe.ARRAY]:[]}[d]}function xe(d){let D=Pe.BOOLEAN;return M(d,m.strings)?D=Pe.STRING:M(d,m.numbers)?D=Pe.NUMBER:M(d,m.bools)?D=Pe.BOOLEAN:M(d,m.arrays)&&(D=Pe.ARRAY),D}function je(d){return d===void 0}function Qt(){Object.keys(m.counts).find(d=>M(d,m.arrays)?(R=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",d)),!0):M(d,m.nargs)?(R=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",d)),!0):!1)}return{aliases:Object.assign({},m.aliases),argv:Object.assign(Ce,W),configuration:a,defaulted:Object.assign({},F),error:R,newAliases:Object.assign({},C)}}}function Ks(i){const e=[],t=Object.create(null);let n=!0;for(Object.keys(i).forEach(function(r){e.push([].concat(i[r],r))});n;){n=!1;for(let r=0;r<e.length;r++)for(let s=r+1;s<e.length;s++)if(e[r].filter(function(a){return e[s].indexOf(a)!==-1}).length){e[r]=e[r].concat(e[s]),e.splice(s,1),n=!0;break}}return e.forEach(function(r){r=r.filter(function(o,a,c){return c.indexOf(o)===a});const s=r.pop();s!==void 0&&typeof s=="string"&&(t[s]=r)}),t}function Ln(i){return i!==void 0?i+1:1}function Ri(i){return i==="__proto__"?"___proto___":i}function Qs(i){return typeof i=="string"&&(i[0]==="'"||i[0]==='"')&&i[i.length-1]===i[0]?i.substring(1,i.length-1):i}var Pn,Nn,kn;const Ui=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Wi=(Nn=(Pn=process==null?void 0:process.versions)===null||Pn===void 0?void 0:Pn.node)!==null&&Nn!==void 0?Nn:(kn=process==null?void 0:process.version)===null||kn===void 0?void 0:kn.slice(1);if(Wi&&Number(Wi.match(/^([^.]+)/)[1])<Ui)throw Error(`yargs parser supports a minimum Node.js version of ${Ui}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Xs=process?process.env:{},Vi=new Js({cwd:process.cwd,env:()=>Xs,format:_i,normalize:gs,resolve:ve,require:i=>{if(typeof require<"u")return require(i);if(i.match(/\.json$/))return JSON.parse(In(i,"utf8"));throw Error("only .json config files are supported in ESM")}}),Pt=function(e,t){return Vi.parse(e.slice(),t).argv};Pt.detailed=function(i,e){return Vi.parse(i.slice(),e)},Pt.camelCase=Lt,Pt.decamelize=Mi,Pt.looksLikeNumber=Ti;function zi(){return Zs()?0:1}function Zs(){return eo()&&!process.defaultApp}function eo(){return!!process.versions.electron}function to(i){return i.slice(zi()+1)}function no(){return process.argv[zi()]}class fe extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,fe)}}const io={fs:{readFileSync:In,writeFile:Es},format:_i,resolve:ve,exists:i=>{try{return Oi(i).isFile()}catch{return!1}}};let Ne;class ro{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(),Ne.format.apply(Ne.format,[this.cache[this.locale][t]||t].concat(e))}__n(){const e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),r=e.shift();let s=function(){};typeof e[e.length-1]=="function"&&(s=e.pop()),this.cache[this.locale]||this._readLocaleFile();let o=r===1?t:n;this.cache[this.locale][t]&&(o=this.cache[this.locale][t][r===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:s})):s();const a=[o];return~o.indexOf("%d")&&a.push(r),Ne.format.apply(Ne.format,a.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(r,s){const o=t[s+1];n+=r,typeof o<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(t,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const e=this,t=this.writeQueue[0],n=t.directory,r=t.locale,s=t.cb,o=this._resolveLocaleFile(n,r),a=JSON.stringify(this.cache[r],null,2);Ne.fs.writeFile(o,a,"utf-8",function(c){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),s(c)})}_readLocaleFile(){let e={};const t=this._resolveLocaleFile(this.directory,this.locale);try{Ne.fs.readFileSync&&(e=JSON.parse(Ne.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=Ne.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){const r=Ne.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(r)&&(n=r)}return n}_fileExistsSync(e){return Ne.exists(e)}}function so(i,e){Ne=e;const t=new ro(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 oo=i=>so(i,io),uo="require is not supported by ESM",Hi="loading a directory of commands is not supported yet for ESM";let Nt;try{Nt=Fs(import.meta.url)}catch{Nt=process.cwd()}const ao=Nt.substring(0,Nt.lastIndexOf("node_modules")),co={assert:{notStrictEqual:ps,strictEqual:ms},cliui:Gs,findUp:Ys,getEnv:i=>process.env[i],inspect:bs,getCallerFile:()=>{throw new fe(Hi)},getProcessArgvBin:no,mainFilename:ao||process.cwd(),Parser:Pt,path:{basename:Ds,dirname:$n,extname:Cs,relative:ws,resolve:ve},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:In,require:()=>{throw new fe(uo)},requireDirectory:()=>{throw new fe(Hi)},stringWidth:i=>[...i].length,y18n:oo({directory:ve(Nt,"../../../locales"),updateFiles:!1})};function ke(i,e,t,n){t.assert.notStrictEqual(i,e,n)}function Gi(i,e){e.assert.strictEqual(typeof i,"string")}function rn(i){return Object.keys(i)}function le(i){return!!i&&!!i.then&&typeof i.then=="function"}function kt(i){const t=i.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,r=t.shift();if(!r)throw new Error(`No command found in: ${i}`);const s={cmd:r.replace(n,""),demanded:[],optional:[]};return t.forEach((o,a)=>{let c=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&a===t.length-1&&(c=!0),/^\[/.test(o)?s.optional.push({cmd:o.replace(n,"").split("|"),variadic:c}):s.demanded.push({cmd:o.replace(n,"").split("|"),variadic:c})}),s}const lo=["first","second","third","fourth","fifth","sixth"];function I(i,e,t){function n(){return typeof i=="object"?[{demanded:[],optional:[]},i,e]:[kt(`cmd ${i}`),e,t]}try{let r=0;const[s,o,a]=n(),c=[].slice.call(o);for(;c.length&&c[c.length-1]===void 0;)c.pop();const h=a||c.length;if(h<s.demanded.length)throw new fe(`Not enough arguments provided. Expected ${s.demanded.length} but received ${c.length}.`);const l=s.demanded.length+s.optional.length;if(h>l)throw new fe(`Too many arguments provided. Expected max ${l} but received ${h}.`);s.demanded.forEach(f=>{const p=c.shift(),C=Yi(p);f.cmd.filter(w=>w===C||w==="*").length===0&&qi(C,f.cmd,r),r+=1}),s.optional.forEach(f=>{if(c.length===0)return;const p=c.shift(),C=Yi(p);f.cmd.filter(w=>w===C||w==="*").length===0&&qi(C,f.cmd,r),r+=1})}catch(r){console.warn(r.stack)}}function Yi(i){return Array.isArray(i)?"array":i===null?"null":typeof i}function qi(i,e,t){throw new fe(`Invalid ${lo[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${i}.`)}class fo{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,r=!1){if(I("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let s=0;s<e.length;s++){if(typeof e[s]!="function")throw Error("middleware must be a function");const o=e[s];o.applyBeforeValidation=t,o.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){const s=e;s.applyBeforeValidation=t,s.global=n,s.mutates=r,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){const n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(r=>{const s=[...n[t]||[],t];return r.option?!s.includes(r.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 ho(i){return i?i.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Mt(i,e,t,n){return t.reduce((r,s)=>{if(s.applyBeforeValidation!==n)return r;if(s.mutates){if(s.applied)return r;s.applied=!0}if(le(r))return r.then(o=>Promise.all([o,s(o,e)])).then(([o,a])=>Object.assign(o,a));{const o=s(r,e);return le(o)?o.then(a=>Object.assign(r,a)):Object.assign(r,o)}},i)}function Tt(i,e,t=n=>{throw n}){try{const n=po(i)?i():i;return le(n)?n.then(r=>e(r)):e(n)}catch(n){return t(n)}}function po(i){return typeof i=="function"}function mo(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 yt=/(^\*)|(^\$0)/;class go{constructor(e,t,n,r){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=r,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,r){r=r||{},typeof r.recurse!="boolean"&&(r.recurse=!1),Array.isArray(r.extensions)||(r.extensions=["js"]);const s=typeof r.visit=="function"?r.visit:o=>o;r.visit=(o,a,c)=>{const h=s(o,a,c);if(h){if(this.requireCache.has(a))return h;this.requireCache.add(a),this.addHandler(h)}return h},this.shim.requireDirectory({require:t,filename:n},e,r)}addHandler(e,t,n,r,s,o){let a=[];const c=ho(s);if(r=r||(()=>{}),Array.isArray(e))if(Co(e))[e,...a]=e;else for(const h of e)this.addHandler(h);else if(Ao(e)){let h=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(h=[].concat(h).concat(e.aliases)),this.addHandler(h,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(Ji(n)){this.addHandler([e].concat(a),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){const h=kt(e);a=a.map(p=>kt(p).cmd);let l=!1;const f=[h.cmd].concat(a).filter(p=>yt.test(p)?(l=!0,!1):!0);f.length===0&&l&&f.push("$0"),l&&(h.cmd=f[0],a=f.slice(1),e=e.replace(yt,h.cmd)),a.forEach(p=>{this.aliasMap[p]=h.cmd}),t!==!1&&this.usage.command(e,t,l,a,o),this.handlers[h.cmd]={original:e,description:t,handler:r,builder:n||{},middlewares:c,deprecated:o,demanded:h.demanded,optional:h.optional},l&&(this.defaultCommand=this.handlers[h.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,r,s,o){const a=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,c=t.getInternalMethods().getContext(),h=c.commands.slice(),l=!e;e&&(c.commands.push(e),c.fullCommands.push(a.original));const f=this.applyBuilderUpdateUsageAndParse(l,a,t,n.aliases,h,r,s,o);return le(f)?f.then(p=>this.applyMiddlewareAndGetResult(l,a,p.innerArgv,c,s,p.aliases,t)):this.applyMiddlewareAndGetResult(l,a,f.innerArgv,c,s,f.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,r,s,o,a,c){const h=t.builder;let l=n;if(Mn(h)){n.getInternalMethods().getUsageInstance().freeze();const f=h(n.getInternalMethods().reset(r),c);if(le(f))return f.then(p=>(l=No(p)?p:n,this.parseAndUpdateUsage(e,t,l,s,o,a)))}else wo(h)&&(n.getInternalMethods().getUsageInstance().freeze(),l=n.getInternalMethods().reset(r),Object.keys(t.builder).forEach(f=>{l.option(f,h[f])}));return this.parseAndUpdateUsage(e,t,l,s,o,a)}parseAndUpdateUsage(e,t,n,r,s,o){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(r,t),t.description);const a=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,s,o);return le(a)?a.then(c=>({aliases:n.parsed.aliases,innerArgv:c})):{aliases:n.parsed.aliases,innerArgv:a}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){const n=yt.test(t.original)?t.original.replace(yt,"").trim():t.original,r=e.filter(s=>!yt.test(s));return r.push(n),`$0 ${r.join(" ")}`}handleValidationAndGetResult(e,t,n,r,s,o,a,c){if(!o.getInternalMethods().getHasOutput()){const h=o.getInternalMethods().runValidation(s,c,o.parsed.error,e);n=Tt(n,l=>(h(l),l))}if(t.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();const h=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(n,h,!1,!1),n=Mt(n,o,a,!1),n=Tt(n,l=>{const f=t.handler(l);return le(f)?f.then(()=>l):l}),e||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),le(n)&&!o.getInternalMethods().hasParseCallback()&&n.catch(l=>{try{o.getInternalMethods().getUsageInstance().fail(null,l)}catch{}})}return e||(r.commands.pop(),r.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,r,s,o,a){let c={};if(s)return n;a.getInternalMethods().getHasOutput()||(c=this.populatePositionals(t,n,r,a));const h=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),l=Mt(n,a,h,!0);return le(l)?l.then(f=>this.handleValidationAndGetResult(e,t,f,r,o,a,h,c)):this.handleValidationAndGetResult(e,t,l,r,o,a,h,c)}populatePositionals(e,t,n,r){t._=t._.slice(n.commands.length);const s=e.demanded.slice(0),o=e.optional.slice(0),a={};for(this.validation.positionalCount(s.length,t._.length);s.length;){const c=s.shift();this.populatePositional(c,t,a)}for(;o.length;){const c=o.shift();this.populatePositional(c,t,a)}return t._=n.commands.concat(t._.map(c=>""+c)),this.postProcessPositionals(t,a,this.cmdToParseOptions(e.original),r),a}populatePositional(e,t,n){const r=e.cmd[0];e.variadic?n[r]=t._.splice(0).map(String):t._.length&&(n[r]=[String(t._.shift())])}cmdToParseOptions(e){const t={array:[],default:{},alias:{},demand:{}},n=kt(e);return n.demanded.forEach(r=>{const[s,...o]=r.cmd;r.variadic&&(t.array.push(s),t.default[s]=[]),t.alias[s]=o,t.demand[s]=!0}),n.optional.forEach(r=>{const[s,...o]=r.cmd;r.variadic&&(t.array.push(s),t.default[s]=[]),t.alias[s]=o}),t}postProcessPositionals(e,t,n,r){const s=Object.assign({},r.getOptions());s.default=Object.assign(n.default,s.default);for(const h of Object.keys(n.alias))s.alias[h]=(s.alias[h]||[]).concat(n.alias[h]);s.array=s.array.concat(n.array),s.config={};const o=[];if(Object.keys(t).forEach(h=>{t[h].map(l=>{s.configuration["unknown-options-as-args"]&&(s.key[h]=!0),o.push(`--${h}`),o.push(l)})}),!o.length)return;const a=Object.assign({},s.configuration,{"populate--":!1}),c=this.shim.Parser.detailed(o,Object.assign({},s,{configuration:a}));if(c.error)r.getInternalMethods().getUsageInstance().fail(c.error.message,c.error);else{const h=Object.keys(t);Object.keys(t).forEach(l=>{h.push(...c.aliases[l])}),Object.keys(c.argv).forEach(l=>{h.includes(l)&&(t[l]||(t[l]=c.argv[l]),!this.isInConfigs(r,l)&&!this.isDefaulted(r,l)&&Object.prototype.hasOwnProperty.call(e,l)&&Object.prototype.hasOwnProperty.call(c.argv,l)&&(Array.isArray(e[l])||Array.isArray(c.argv[l]))?e[l]=[].concat(e[l],c.argv[l]):e[l]=c.argv[l])})}}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(r=>Object.prototype.hasOwnProperty.call(r,t))||n.some(r=>Object.prototype.hasOwnProperty.call(r,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){const n=yt.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(Mn(t))return t(e,!0);Ji(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){const t=mo(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 r of[e,t,n]){if(typeof r=="string"||r===!1)return r;ke(r,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const e=this.frozens.pop();ke(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 Do(i,e,t,n){return new go(i,e,t,n)}function Ji(i){return typeof i=="object"&&!!i.builder&&typeof i.handler=="function"}function Co(i){return i.every(e=>typeof e=="string")}function Mn(i){return typeof i=="function"}function wo(i){return typeof i=="object"}function Ao(i){return typeof i=="object"&&!Array.isArray(i)}function Rt(i={},e=()=>!0){const t={};return rn(i).forEach(n=>{e(n,i[n])&&(t[n]=i[n])}),t}function Ut(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 Eo(i){return typeof i=="boolean"}function bo(i,e){const t=e.y18n.__,n={},r=[];n.failFn=function(B){r.push(B)};let s=null,o=null,a=!0;n.showHelpOnFail=function(B=!0,$){const[V,Q]=typeof B=="string"?[!0,B]:[B,$];return i.getInternalMethods().isGlobalContext()&&(o=Q),s=Q,a=V,n};let c=!1;n.fail=function(B,$){const V=i.getInternalMethods().getLoggerInstance();if(r.length)for(let Q=r.length-1;Q>=0;--Q){const de=r[Q];if(Eo(de)){if($)throw $;if(B)throw Error(B)}else de(B,$,n)}else{if(i.getExitProcess()&&Ut(!0),!c){c=!0,a&&(i.showHelp("error"),V.error()),(B||$)&&V.error(B||$);const Q=s||o;Q&&((B||$)&&V.error(""),V.error(Q))}if($=$||new fe(B),i.getExitProcess())return i.exit(1);if(i.getInternalMethods().hasParseCallback())return i.exit(1,$);throw $}};let h=[],l=!1;n.usage=(j,B)=>j===null?(l=!0,h=[],n):(l=!1,h.push([j,B||""]),n),n.getUsage=()=>h,n.getUsageDisabled=()=>l,n.getPositionalGroupName=()=>t("Positionals:");let f=[];n.example=(j,B)=>{f.push([j,B||""])};let p=[];n.command=function(B,$,V,Q,de=!1){V&&(p=p.map(K=>(K[2]=!1,K))),p.push([B,$||"",V,Q,de])},n.getCommands=()=>p;let C={};n.describe=function(B,$){Array.isArray(B)?B.forEach(V=>{n.describe(V,$)}):typeof B=="object"?Object.keys(B).forEach(V=>{n.describe(V,B[V])}):C[B]=$},n.getDescriptions=()=>C;let F=[];n.epilog=j=>{F.push(j)};let w=!1,m;n.wrap=j=>{w=!0,m=j},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(w||(m=bt(),w=!0),m);const y="__yargsString__:";n.deferY18nLookup=j=>y+j,n.help=function(){if(N)return N;R();const B=i.customScriptName?i.$0:e.path.basename(i.$0),$=i.getDemandedOptions(),V=i.getDemandedCommands(),Q=i.getDeprecatedOptions(),de=i.getGroups(),K=i.getOptions();let he=[];he=he.concat(Object.keys(C)),he=he.concat(Object.keys($)),he=he.concat(Object.keys(V)),he=he.concat(Object.keys(K.default)),he=he.filter(Ce),he=Object.keys(he.reduce((k,te)=>(te!=="_"&&(k[te]=!0),k),{}));const rt=n.getWrap(),ne=e.cliui({width:rt,wrap:!!rt});if(!l){if(h.length)h.forEach(k=>{ne.div({text:`${k[0].replace(/\$0/g,B)}`}),k[1]&&ne.div({text:`${k[1]}`,padding:[1,0,0,0]})}),ne.div();else if(p.length){let k=null;V._?k=`${B} <${t("command")}>
8
+ `:k=`${B} [${t("command")}]
9
+ `,ne.div(`${k}`)}}if(p.length>1||p.length===1&&!p[0][2]){ne.div(t("Commands:"));const k=i.getInternalMethods().getContext(),te=k.commands.length?`${k.commands.join(" ")} `:"";i.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(p=p.sort((q,re)=>q[0].localeCompare(re[0])));const ie=B?`${B} `:"";p.forEach(q=>{const re=`${ie}${te}${q[0].replace(/^\$0 ?/,"")}`;ne.span({text:re,padding:[0,2,0,2],width:S(p,rt,`${B}${te}`)+4},{text:q[1]});const oe=[];q[2]&&oe.push(`[${t("default")}]`),q[3]&&q[3].length&&oe.push(`[${t("aliases:")} ${q[3].join(", ")}]`),q[4]&&(typeof q[4]=="string"?oe.push(`[${t("deprecated: %s",q[4])}]`):oe.push(`[${t("deprecated")}]`)),oe.length?ne.div({text:oe.join(" "),padding:[0,0,0,2],align:"right"}):ne.div()}),ne.div()}const We=(Object.keys(K.alias)||[]).concat(Object.keys(i.parsed.newAliases)||[]);he=he.filter(k=>!i.parsed.newAliases[k]&&We.every(te=>(K.alias[te]||[]).indexOf(k)===-1));const Ve=t("Options:");de[Ve]||(de[Ve]=[]),W(he,K.alias,de,Ve);const st=k=>/^--/.test(sn(k)),M=Object.keys(de).filter(k=>de[k].length>0).map(k=>{const te=de[k].filter(Ce).map(ie=>{if(We.includes(ie))return ie;for(let q=0,re;(re=We[q])!==void 0;q++)if((K.alias[re]||[]).includes(ie))return re;return ie});return{groupName:k,normalizedKeys:te}}).filter(({normalizedKeys:k})=>k.length>0).map(({groupName:k,normalizedKeys:te})=>{const ie=te.reduce((q,re)=>(q[re]=[re].concat(K.alias[re]||[]).map(oe=>k===n.getPositionalGroupName()?oe:(/^[0-9]$/.test(oe)?K.boolean.includes(re)?"-":"--":oe.length>1?"--":"-")+oe).sort((oe,xe)=>st(oe)===st(xe)?0:st(oe)?1:-1).join(", "),q),{});return{groupName:k,normalizedKeys:te,switches:ie}});if(M.filter(({groupName:k})=>k!==n.getPositionalGroupName()).some(({normalizedKeys:k,switches:te})=>!k.every(ie=>st(te[ie])))&&M.filter(({groupName:k})=>k!==n.getPositionalGroupName()).forEach(({normalizedKeys:k,switches:te})=>{k.forEach(ie=>{st(te[ie])&&(te[ie]=Fo(te[ie],4))})}),M.forEach(({groupName:k,normalizedKeys:te,switches:ie})=>{ne.div(k),te.forEach(q=>{const re=ie[q];let oe=C[q]||"",xe=null;oe.includes(y)&&(oe=t(oe.substring(y.length))),K.boolean.includes(q)&&(xe=`[${t("boolean")}]`),K.count.includes(q)&&(xe=`[${t("count")}]`),K.string.includes(q)&&(xe=`[${t("string")}]`),K.normalize.includes(q)&&(xe=`[${t("string")}]`),K.array.includes(q)&&(xe=`[${t("array")}]`),K.number.includes(q)&&(xe=`[${t("number")}]`);const je=D=>typeof D=="string"?`[${t("deprecated: %s",D)}]`:`[${t("deprecated")}]`,Qt=[q in Q?je(Q[q]):null,xe,q in $?`[${t("required")}]`:null,K.choices&&K.choices[q]?`[${t("choices:")} ${n.stringifiedValues(K.choices[q])}]`:null,Ie(K.default[q],K.defaultDescription[q])].filter(Boolean).join(" ");ne.span({text:sn(re),padding:[0,2,0,2+Ki(re)],width:S(ie,rt)+4},oe);const d=i.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;Qt&&!d?ne.div({text:Qt,padding:[0,0,0,2],align:"right"}):ne.div()}),ne.div()}),f.length&&(ne.div(t("Examples:")),f.forEach(k=>{k[0]=k[0].replace(/\$0/g,B)}),f.forEach(k=>{k[1]===""?ne.div({text:k[0],padding:[0,2,0,2]}):ne.div({text:k[0],padding:[0,2,0,2],width:S(f,rt)+4},{text:k[1]})}),ne.div()),F.length>0){const k=F.map(te=>te.replace(/\$0/g,B)).join(`
10
+ `);ne.div(`${k}
11
+ `)}return ne.toString().replace(/\s*$/,"")};function S(j,B,$){let V=0;return Array.isArray(j)||(j=Object.values(j).map(Q=>[Q])),j.forEach(Q=>{V=Math.max(e.stringWidth($?`${$} ${sn(Q[0])}`:sn(Q[0]))+Ki(Q[0]),V)}),B&&(V=Math.min(V,parseInt((B*.5).toString(),10))),V}function R(){const j=i.getDemandedOptions(),B=i.getOptions();(Object.keys(B.alias)||[]).forEach($=>{B.alias[$].forEach(V=>{C[V]&&n.describe($,C[V]),V in j&&i.demandOption($,j[V]),B.boolean.includes(V)&&i.boolean($),B.count.includes(V)&&i.count($),B.string.includes(V)&&i.string($),B.normalize.includes(V)&&i.normalize($),B.array.includes(V)&&i.array($),B.number.includes(V)&&i.number($)})})}let N;n.cacheHelpMessage=function(){N=this.help()},n.clearCachedHelpMessage=function(){N=void 0},n.hasCachedHelpMessage=function(){return!!N};function W(j,B,$,V){let Q=[],de=null;return Object.keys($).forEach(K=>{Q=Q.concat($[K])}),j.forEach(K=>{de=[K].concat(B[K]),de.some(he=>Q.indexOf(he)!==-1)||$[V].push(K)}),Q}function Ce(j){return i.getOptions().hiddenOptions.indexOf(j)<0||i.parsed.argv[i.getOptions().showHiddenOpt]}n.showHelp=j=>{const B=i.getInternalMethods().getLoggerInstance();j||(j="error"),(typeof j=="function"?j:B[j])(n.help())},n.functionDescription=j=>["(",j.name?e.Parser.decamelize(j.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(B,$){let V="";const Q=$||", ",de=[].concat(B);return!B||!de.length||de.forEach(K=>{V.length&&(V+=Q),V+=JSON.stringify(K)}),V};function Ie(j,B){let $=`[${t("default:")} `;if(j===void 0&&!B)return null;if(B)$+=B;else switch(typeof j){case"string":$+=`"${j}"`;break;case"object":$+=JSON.stringify(j);break;default:$+=j}return`${$}]`}function bt(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let it=null;n.version=j=>{it=j},n.showVersion=j=>{const B=i.getInternalMethods().getLoggerInstance();j||(j="error"),(typeof j=="function"?j:B[j])(it)},n.reset=function(B){return s=null,c=!1,h=[],l=!1,F=[],f=[],p=[],C=Rt(C,$=>!B[$]),n};const X=[];return n.freeze=function(){X.push({failMessage:s,failureOutput:c,usages:h,usageDisabled:l,epilogs:F,examples:f,commands:p,descriptions:C})},n.unfreeze=function(B=!1){const $=X.pop();$&&(B?(C={...$.descriptions,...C},p=[...$.commands,...p],h=[...$.usages,...h],f=[...$.examples,...f],F=[...$.epilogs,...F]):{failMessage:s,failureOutput:c,usages:h,usageDisabled:l,epilogs:F,examples:f,commands:p,descriptions:C}=$)},n}function Tn(i){return typeof i=="object"}function Fo(i,e){return Tn(i)?{text:i.text,indentation:i.indentation+e}:{text:i,indentation:e}}function Ki(i){return Tn(i)?i.indentation:0}function sn(i){return Tn(i)?i.text:i}const yo=`###-begin-{{app_name}}-completions-###
12
12
  #
13
13
  # yargs command completion script
14
14
  #
@@ -36,7 +36,7 @@ _{{app_name}}_yargs_completions()
36
36
  }
37
37
  complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
38
38
  ###-end-{{app_name}}-completions-###
39
- `,Cu=`#compdef {{app_name}}
39
+ `,vo=`#compdef {{app_name}}
40
40
  ###-begin-{{app_name}}-completions-###
41
41
  #
42
42
  # yargs command completion script
@@ -55,32 +55,47 @@ _{{app_name}}_yargs_completions()
55
55
  }
56
56
  compdef _{{app_name}}_yargs_completions {{app_name}}
57
57
  ###-end-{{app_name}}-completions-###
58
- `;class wu{constructor(e,t,n,r){var s,u,a;this.yargs=e,this.usage=t,this.command=n,this.shim=r,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(a=((s=this.shim.getEnv("SHELL"))===null||s===void 0?void 0:s.includes("zsh"))||((u=this.shim.getEnv("ZSH_NAME"))===null||u===void 0?void 0:u.includes("zsh")))!==null&&a!==void 0?a:!1}defaultCompletion(e,t,n,r){const s=this.command.getCommandHandlers();for(let a=0,c=e.length;a<c;++a)if(s[e[a]]&&s[e[a]].builder){const h=s[e[a]].builder;if(Mn(h)){this.indexAfterLastReset=a+1;const l=this.yargs.getInternalMethods().reset();return h(l,!0),l.argv}}const u=[];this.commandCompletions(u,e,n),this.optionCompletions(u,e,t,n),this.choicesFromOptionsCompletions(u,e,t,n),this.choicesFromPositionalsCompletions(u,e,t,n),r(null,u)}commandCompletions(e,t,n){const r=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&r[r.length-1]!==n&&!this.previousArgHasChoices(t)&&this.usage.getCommands().forEach(s=>{const u=Nt(s[0]).cmd;if(t.indexOf(u)===-1)if(!this.zshShell)e.push(u);else{const a=s[1]||"";e.push(u.replace(/:/g,"\\:")+":"+a)}})}optionCompletions(e,t,n,r){if((r.match(/^-/)||r===""&&e.length===0)&&!this.previousArgHasChoices(t)){const s=this.yargs.getOptions(),u=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach(a=>{const c=!!s.configuration["boolean-negation"]&&s.boolean.includes(a);!u.includes(a)&&!s.hiddenOptions.includes(a)&&!this.argsContainKey(t,a,c)&&this.completeOptionKey(a,e,r,c&&!!s.default[a])})}}choicesFromOptionsCompletions(e,t,n,r){if(this.previousArgHasChoices(t)){const s=this.getPreviousArgChoices(t);s&&s.length>0&&e.push(...s.map(u=>u.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,t,n,r){if(r===""&&e.length>0&&this.previousArgHasChoices(t))return;const s=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],u=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),a=s[n._.length-u-1];if(!a)return;const c=this.yargs.getOptions().choices[a]||[];for(const h of c)h.startsWith(r)&&e.push(h.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 r=t.replace(/^-+/,""),s=this.yargs.getOptions(),u=[r,...this.yargs.getAliases()[r]||[]];let a;for(const c of u)if(Object.prototype.hasOwnProperty.call(s.key,c)&&Array.isArray(s.choices[c])){a=s.choices[c];break}if(a)return a.filter(c=>!n||c.startsWith(n))}previousArgHasChoices(e){const t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){const r=s=>e.indexOf((/^[^0-9]$/.test(s)?"-":"--")+s)!==-1;if(r(t)||n&&r(`no-${t}`))return!0;if(this.aliases){for(const s of this.aliases[t])if(r(s))return!0}return!1}completeOptionKey(e,t,n,r){var s,u,a,c;let h=e;if(this.zshShell){const C=this.usage.getDescriptions(),F=(u=(s=this===null||this===void 0?void 0:this.aliases)===null||s===void 0?void 0:s[e])===null||u===void 0?void 0:u.find(y=>{const S=C[y];return typeof S=="string"&&S.length>0}),w=F?C[F]:void 0,m=(c=(a=C[e])!==null&&a!==void 0?a:w)!==null&&c!==void 0?c:"";h=`${e.replace(/:/g,"\\:")}:${m.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const l=C=>/^--/.test(C),f=C=>/^[^0-9]$/.test(C),p=!l(n)&&f(e)?"-":"--";t.push(p+h),r&&t.push(p+"no-"+h)}customCompletion(e,t,n,r){if(Me(this.customCompletionFunction,null,this.shim),Eu(this.customCompletionFunction)){const s=this.customCompletionFunction(n,t);return le(s)?s.then(u=>{this.shim.process.nextTick(()=>{r(null,u)})}).catch(u=>{this.shim.process.nextTick(()=>{r(u,void 0)})}):r(null,s)}else return bu(this.customCompletionFunction)?this.customCompletionFunction(n,t,(s=r)=>this.defaultCompletion(e,t,n,s),s=>{r(null,s)}):this.customCompletionFunction(n,t,s=>{r(null,s)})}getCompletion(e,t){const n=e.length?e[e.length-1]:"",r=this.yargs.parse(e,!0),s=this.customCompletionFunction?u=>this.customCompletion(e,u,n,t):u=>this.defaultCompletion(e,u,n,t);return le(r)?r.then(s):s(r)}generateCompletionScript(e,t){let n=this.zshShell?Cu:Du;const r=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,r),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 Au(i,e,t,n){return new wu(i,e,t,n)}function Eu(i){return i.length<3}function bu(i){return i.length>3}function Fu(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 r;for(r=0;r<=i.length;r++)t[0][r]=r;for(n=1;n<=e.length;n++)for(r=1;r<=i.length;r++)e.charAt(n-1)===i.charAt(r-1)?t[n][r]=t[n-1][r-1]:n>1&&r>1&&e.charAt(n-2)===i.charAt(r-1)&&e.charAt(n-1)===i.charAt(r-2)?t[n][r]=t[n-2][r-2]+1:t[n][r]=Math.min(t[n-1][r-1]+1,Math.min(t[n][r-1]+1,t[n-1][r]+1));return t[e.length][i.length]}const Ki=["$0","--","_"];function yu(i,e,t){const n=t.y18n.__,r=t.y18n.__n,s={};s.nonOptionCount=function(f){const p=i.getDemandedCommands(),F=f._.length+(f["--"]?f["--"].length:0)-i.getInternalMethods().getContext().commands.length;p._&&(F<p._.min||F>p._.max)&&(F<p._.min?p._.minMsg!==void 0?e.fail(p._.minMsg?p._.minMsg.replace(/\$0/g,F.toString()).replace(/\$1/,p._.min.toString()):null):e.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",F,F.toString(),p._.min.toString())):F>p._.max&&(p._.maxMsg!==void 0?e.fail(p._.maxMsg?p._.maxMsg.replace(/\$0/g,F.toString()).replace(/\$1/,p._.max.toString()):null):e.fail(r("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",F,F.toString(),p._.max.toString()))))},s.positionalCount=function(f,p){p<f&&e.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",p,p+"",f+""))},s.requiredArguments=function(f,p){let C=null;for(const F of Object.keys(p))(!Object.prototype.hasOwnProperty.call(f,F)||typeof f[F]>"u")&&(C=C||{},C[F]=p[F]);if(C){const F=[];for(const m of Object.keys(C)){const y=C[m];y&&F.indexOf(y)<0&&F.push(y)}const w=F.length?`
58
+ `;class Bo{constructor(e,t,n,r){var s,o,a;this.yargs=e,this.usage=t,this.command=n,this.shim=r,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(a=((s=this.shim.getEnv("SHELL"))===null||s===void 0?void 0:s.includes("zsh"))||((o=this.shim.getEnv("ZSH_NAME"))===null||o===void 0?void 0:o.includes("zsh")))!==null&&a!==void 0?a:!1}defaultCompletion(e,t,n,r){const s=this.command.getCommandHandlers();for(let a=0,c=e.length;a<c;++a)if(s[e[a]]&&s[e[a]].builder){const h=s[e[a]].builder;if(Mn(h)){this.indexAfterLastReset=a+1;const l=this.yargs.getInternalMethods().reset();return h(l,!0),l.argv}}const o=[];this.commandCompletions(o,e,n),this.optionCompletions(o,e,t,n),this.choicesFromOptionsCompletions(o,e,t,n),this.choicesFromPositionalsCompletions(o,e,t,n),r(null,o)}commandCompletions(e,t,n){const r=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&r[r.length-1]!==n&&!this.previousArgHasChoices(t)&&this.usage.getCommands().forEach(s=>{const o=kt(s[0]).cmd;if(t.indexOf(o)===-1)if(!this.zshShell)e.push(o);else{const a=s[1]||"";e.push(o.replace(/:/g,"\\:")+":"+a)}})}optionCompletions(e,t,n,r){if((r.match(/^-/)||r===""&&e.length===0)&&!this.previousArgHasChoices(t)){const s=this.yargs.getOptions(),o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach(a=>{const c=!!s.configuration["boolean-negation"]&&s.boolean.includes(a);!o.includes(a)&&!s.hiddenOptions.includes(a)&&!this.argsContainKey(t,a,c)&&this.completeOptionKey(a,e,r,c&&!!s.default[a])})}}choicesFromOptionsCompletions(e,t,n,r){if(this.previousArgHasChoices(t)){const s=this.getPreviousArgChoices(t);s&&s.length>0&&e.push(...s.map(o=>o.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,t,n,r){if(r===""&&e.length>0&&this.previousArgHasChoices(t))return;const s=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],o=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),a=s[n._.length-o-1];if(!a)return;const c=this.yargs.getOptions().choices[a]||[];for(const h of c)h.startsWith(r)&&e.push(h.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 r=t.replace(/^-+/,""),s=this.yargs.getOptions(),o=[r,...this.yargs.getAliases()[r]||[]];let a;for(const c of o)if(Object.prototype.hasOwnProperty.call(s.key,c)&&Array.isArray(s.choices[c])){a=s.choices[c];break}if(a)return a.filter(c=>!n||c.startsWith(n))}previousArgHasChoices(e){const t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){const r=s=>e.indexOf((/^[^0-9]$/.test(s)?"-":"--")+s)!==-1;if(r(t)||n&&r(`no-${t}`))return!0;if(this.aliases){for(const s of this.aliases[t])if(r(s))return!0}return!1}completeOptionKey(e,t,n,r){var s,o,a,c;let h=e;if(this.zshShell){const C=this.usage.getDescriptions(),F=(o=(s=this===null||this===void 0?void 0:this.aliases)===null||s===void 0?void 0:s[e])===null||o===void 0?void 0:o.find(y=>{const S=C[y];return typeof S=="string"&&S.length>0}),w=F?C[F]:void 0,m=(c=(a=C[e])!==null&&a!==void 0?a:w)!==null&&c!==void 0?c:"";h=`${e.replace(/:/g,"\\:")}:${m.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const l=C=>/^--/.test(C),f=C=>/^[^0-9]$/.test(C),p=!l(n)&&f(e)?"-":"--";t.push(p+h),r&&t.push(p+"no-"+h)}customCompletion(e,t,n,r){if(ke(this.customCompletionFunction,null,this.shim),_o(this.customCompletionFunction)){const s=this.customCompletionFunction(n,t);return le(s)?s.then(o=>{this.shim.process.nextTick(()=>{r(null,o)})}).catch(o=>{this.shim.process.nextTick(()=>{r(o,void 0)})}):r(null,s)}else return So(this.customCompletionFunction)?this.customCompletionFunction(n,t,(s=r)=>this.defaultCompletion(e,t,n,s),s=>{r(null,s)}):this.customCompletionFunction(n,t,s=>{r(null,s)})}getCompletion(e,t){const n=e.length?e[e.length-1]:"",r=this.yargs.parse(e,!0),s=this.customCompletionFunction?o=>this.customCompletion(e,o,n,t):o=>this.defaultCompletion(e,o,n,t);return le(r)?r.then(s):s(r)}generateCompletionScript(e,t){let n=this.zshShell?vo:yo;const r=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,r),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 Oo(i,e,t,n){return new Bo(i,e,t,n)}function _o(i){return i.length<3}function So(i){return i.length>3}function $o(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 r;for(r=0;r<=i.length;r++)t[0][r]=r;for(n=1;n<=e.length;n++)for(r=1;r<=i.length;r++)e.charAt(n-1)===i.charAt(r-1)?t[n][r]=t[n-1][r-1]:n>1&&r>1&&e.charAt(n-2)===i.charAt(r-1)&&e.charAt(n-1)===i.charAt(r-2)?t[n][r]=t[n-2][r-2]+1:t[n][r]=Math.min(t[n-1][r-1]+1,Math.min(t[n][r-1]+1,t[n-1][r]+1));return t[e.length][i.length]}const Qi=["$0","--","_"];function Io(i,e,t){const n=t.y18n.__,r=t.y18n.__n,s={};s.nonOptionCount=function(f){const p=i.getDemandedCommands(),F=f._.length+(f["--"]?f["--"].length:0)-i.getInternalMethods().getContext().commands.length;p._&&(F<p._.min||F>p._.max)&&(F<p._.min?p._.minMsg!==void 0?e.fail(p._.minMsg?p._.minMsg.replace(/\$0/g,F.toString()).replace(/\$1/,p._.min.toString()):null):e.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",F,F.toString(),p._.min.toString())):F>p._.max&&(p._.maxMsg!==void 0?e.fail(p._.maxMsg?p._.maxMsg.replace(/\$0/g,F.toString()).replace(/\$1/,p._.max.toString()):null):e.fail(r("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",F,F.toString(),p._.max.toString()))))},s.positionalCount=function(f,p){p<f&&e.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",p,p+"",f+""))},s.requiredArguments=function(f,p){let C=null;for(const F of Object.keys(p))(!Object.prototype.hasOwnProperty.call(f,F)||typeof f[F]>"u")&&(C=C||{},C[F]=p[F]);if(C){const F=[];for(const m of Object.keys(C)){const y=C[m];y&&F.indexOf(y)<0&&F.push(y)}const w=F.length?`
59
59
  ${F.join(`
60
- `)}`:"";e.fail(r("Missing required argument: %s","Missing required arguments: %s",Object.keys(C).length,Object.keys(C).join(", ")+w))}},s.unknownArguments=function(f,p,C,F,w=!0){var m;const y=i.getInternalMethods().getCommandInstance().getCommands(),S=[],R=i.getInternalMethods().getContext();if(Object.keys(f).forEach(N=>{!Ki.includes(N)&&!Object.prototype.hasOwnProperty.call(C,N)&&!Object.prototype.hasOwnProperty.call(i.getInternalMethods().getParseContext(),N)&&!s.isValidAndSomeAliasIsNotNew(N,p)&&S.push(N)}),w&&(R.commands.length>0||y.length>0||F)&&f._.slice(R.commands.length).forEach(N=>{y.includes(""+N)||S.push(""+N)}),w){const U=((m=i.getDemandedCommands()._)===null||m===void 0?void 0:m.max)||0,Ce=R.commands.length+U;Ce<f._.length&&f._.slice(Ce).forEach($e=>{$e=String($e),!R.commands.includes($e)&&!S.includes($e)&&S.push($e)})}S.length&&e.fail(r("Unknown argument: %s","Unknown arguments: %s",S.length,S.map(N=>N.trim()?N:`"${N}"`).join(", ")))},s.unknownCommands=function(f){const p=i.getInternalMethods().getCommandInstance().getCommands(),C=[],F=i.getInternalMethods().getContext();return(F.commands.length>0||p.length>0)&&f._.slice(F.commands.length).forEach(w=>{p.includes(""+w)||C.push(""+w)}),C.length>0?(e.fail(r("Unknown command: %s","Unknown commands: %s",C.length,C.join(", "))),!0):!1},s.isValidAndSomeAliasIsNotNew=function(f,p){if(!Object.prototype.hasOwnProperty.call(p,f))return!1;const C=i.parsed.newAliases;return[f,...p[f]].some(F=>!Object.prototype.hasOwnProperty.call(C,F)||!C[f])},s.limitedChoices=function(f){const p=i.getOptions(),C={};if(!Object.keys(p.choices).length)return;Object.keys(f).forEach(m=>{Ki.indexOf(m)===-1&&Object.prototype.hasOwnProperty.call(p.choices,m)&&[].concat(f[m]).forEach(y=>{p.choices[m].indexOf(y)===-1&&y!==void 0&&(C[m]=(C[m]||[]).concat(y))})});const F=Object.keys(C);if(!F.length)return;let w=n("Invalid values:");F.forEach(m=>{w+=`
61
- ${n("Argument: %s, Given: %s, Choices: %s",m,e.stringifiedValues(C[m]),e.stringifiedValues(p.choices[m]))}`}),e.fail(w)};let u={};s.implies=function(f,p){$("<string|object> [array|number|string]",[f,p],arguments.length),typeof f=="object"?Object.keys(f).forEach(C=>{s.implies(C,f[C])}):(i.global(f),u[f]||(u[f]=[]),Array.isArray(p)?p.forEach(C=>s.implies(f,C)):(Me(p,void 0,t),u[f].push(p)))},s.getImplied=function(){return u};function a(l,f){const p=Number(f);return f=isNaN(p)?f:p,typeof f=="number"?f=l._.length>=f:f.match(/^--no-.+/)?(f=f.match(/^--no-(.+)/)[1],f=!Object.prototype.hasOwnProperty.call(l,f)):f=Object.prototype.hasOwnProperty.call(l,f),f}s.implications=function(f){const p=[];if(Object.keys(u).forEach(C=>{const F=C;(u[C]||[]).forEach(w=>{let m=F;const y=w;m=a(f,m),w=a(f,w),m&&!w&&p.push(` ${F} -> ${y}`)})}),p.length){let C=`${n("Implications failed:")}
62
- `;p.forEach(F=>{C+=F}),e.fail(C)}};let c={};s.conflicts=function(f,p){$("<string|object> [array|string]",[f,p],arguments.length),typeof f=="object"?Object.keys(f).forEach(C=>{s.conflicts(C,f[C])}):(i.global(f),c[f]||(c[f]=[]),Array.isArray(p)?p.forEach(C=>s.conflicts(f,C)):c[f].push(p))},s.getConflicting=()=>c,s.conflicting=function(f){Object.keys(f).forEach(p=>{c[p]&&c[p].forEach(C=>{C&&f[p]!==void 0&&f[C]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",p,C))})}),i.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(c).forEach(p=>{c[p].forEach(C=>{C&&f[t.Parser.camelCase(p)]!==void 0&&f[t.Parser.camelCase(C)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",p,C))})})},s.recommendCommands=function(f,p){p=p.sort((m,y)=>y.length-m.length);let F=null,w=1/0;for(let m=0,y;(y=p[m])!==void 0;m++){const S=Fu(f,y);S<=3&&S<w&&(w=S,F=y)}F&&e.fail(n("Did you mean %s?",F))},s.reset=function(f){return u=Tt(u,p=>!f[p]),c=Tt(c,p=>!f[p]),s};const h=[];return s.freeze=function(){h.push({implied:u,conflicting:c})},s.unfreeze=function(){const f=h.pop();Me(f,void 0,t),{implied:u,conflicting:c}=f},s}let Tn=[],Wt;function Rn(i,e,t,n){Wt=n;let r={};if(Object.prototype.hasOwnProperty.call(i,"extends")){if(typeof i.extends!="string")return r;const s=/\.json|\..*rc$/.test(i.extends);let u=null;if(s)u=Bu(e,i.extends);else try{u=require.resolve(i.extends)}catch{return i}vu(u),Tn.push(u),r=s?JSON.parse(Wt.readFileSync(u,"utf8")):Qt(i.extends),delete i.extends,r=Rn(r,Wt.path.dirname(u),t,Wt)}return Tn=[],t?Qi(r,i):Object.assign({},r,i)}function vu(i){if(Tn.indexOf(i)>-1)throw new fe(`Circular extended configurations: '${i}'.`)}function Bu(i,e){return Wt.path.resolve(i,e)}function Qi(i,e){const t={};function n(r){return r&&typeof r=="object"&&!Array.isArray(r)}Object.assign(t,i);for(const r of Object.keys(e))n(e[r])&&n(t[r])?t[r]=Qi(i[r],e[r]):t[r]=e[r];return t}var _=function(i,e,t,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(i,t):r?r.value=t:e.set(i,t),t},o=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)},oe,at,Ut,Be,be,un,Qe,ct,on,Oe,an,_e,Re,Fe,Se,cn,yt,ge,L,ln,fn,ye,lt,vt,ft,Xe,dn,T,dt,ht,pt,W,hn,We,se;function Ou(i){return(e=[],t=i.process.cwd(),n)=>{const r=new _u(e,t,n,i);return Object.defineProperty(r,"argv",{get:()=>r.parse(),enumerable:!0}),r.help(),r.version(),r}}const Xi=Symbol("copyDoubleDash"),Zi=Symbol("copyDoubleDash"),Wn=Symbol("deleteFromParserHintObject"),er=Symbol("emitWarning"),tr=Symbol("freeze"),nr=Symbol("getDollarZero"),mt=Symbol("getParserConfiguration"),ir=Symbol("getUsageConfiguration"),Un=Symbol("guessLocale"),rr=Symbol("guessVersion"),sr=Symbol("parsePositionalNumbers"),Vn=Symbol("pkgUp"),Ze=Symbol("populateParserHintArray"),Bt=Symbol("populateParserHintSingleValueDictionary"),zn=Symbol("populateParserHintArrayDictionary"),Hn=Symbol("populateParserHintDictionary"),Gn=Symbol("sanitizeKey"),Yn=Symbol("setKey"),qn=Symbol("unfreeze"),ur=Symbol("validateAsync"),or=Symbol("getCommandInstance"),ar=Symbol("getContext"),cr=Symbol("getHasOutput"),lr=Symbol("getLoggerInstance"),fr=Symbol("getParseContext"),dr=Symbol("getUsageInstance"),hr=Symbol("getValidationInstance"),pn=Symbol("hasParseCallback"),pr=Symbol("isGlobalContext"),gt=Symbol("postProcess"),mr=Symbol("rebase"),Jn=Symbol("reset"),Vt=Symbol("runYargsParserAndExecuteCommands"),Kn=Symbol("runValidation"),gr=Symbol("setHasOutput"),Dt=Symbol("kTrackManuallySetKeys");class _u{constructor(e=[],t,n,r){this.customScriptName=!1,this.parsed=!1,oe.set(this,void 0),at.set(this,void 0),Ut.set(this,{commands:[],fullCommands:[]}),Be.set(this,null),be.set(this,null),un.set(this,"show-hidden"),Qe.set(this,null),ct.set(this,!0),on.set(this,{}),Oe.set(this,!0),an.set(this,[]),_e.set(this,void 0),Re.set(this,{}),Fe.set(this,!1),Se.set(this,null),cn.set(this,!0),yt.set(this,void 0),ge.set(this,""),L.set(this,void 0),ln.set(this,void 0),fn.set(this,{}),ye.set(this,null),lt.set(this,null),vt.set(this,{}),ft.set(this,{}),Xe.set(this,void 0),dn.set(this,!1),T.set(this,void 0),dt.set(this,!1),ht.set(this,!1),pt.set(this,!1),W.set(this,void 0),hn.set(this,{}),We.set(this,null),se.set(this,void 0),_(this,T,r,"f"),_(this,Xe,e,"f"),_(this,at,t,"f"),_(this,ln,n,"f"),_(this,_e,new su(this),"f"),this.$0=this[nr](),this[Jn](),_(this,oe,o(this,oe,"f"),"f"),_(this,W,o(this,W,"f"),"f"),_(this,se,o(this,se,"f"),"f"),_(this,L,o(this,L,"f"),"f"),o(this,L,"f").showHiddenOpt=o(this,un,"f"),_(this,yt,this[Zi](),"f")}addHelpOpt(e,t){const n="help";return $("[string|boolean] [string]",[e,t],arguments.length),o(this,Se,"f")&&(this[Wn](o(this,Se,"f")),_(this,Se,null,"f")),e===!1&&t===void 0?this:(_(this,Se,typeof e=="string"?e:n,"f"),this.boolean(o(this,Se,"f")),this.describe(o(this,Se,"f"),t||o(this,W,"f").deferY18nLookup("Show help")),this)}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if($("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;const n=typeof e=="string"?e:o(this,un,"f");return this.boolean(n),this.describe(n,t||o(this,W,"f").deferY18nLookup("Show hidden options")),o(this,L,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return $("<object|string|array> [string|array]",[e,t],arguments.length),this[zn](this.alias.bind(this),"alias",e,t),this}array(e){return $("<array|string>",[e],arguments.length),this[Ze]("array",e),this[Dt](e),this}boolean(e){return $("<array|string>",[e],arguments.length),this[Ze]("boolean",e),this[Dt](e),this}check(e,t){return $("<function> [boolean]",[e,t],arguments.length),this.middleware((n,r)=>kt(()=>e(n,r.getOptions()),s=>(s?(typeof s=="string"||s instanceof Error)&&o(this,W,"f").fail(s.toString(),s):o(this,W,"f").fail(o(this,T,"f").y18n.__("Argument check failed: %s",e.toString())),n),s=>(o(this,W,"f").fail(s.message?s.message:s.toString(),s),n)),!1,t),this}choices(e,t){return $("<object|string|array> [string|array]",[e,t],arguments.length),this[zn](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if($("<object|string|array> [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new fe("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 fe("coerce callback must be provided");return o(this,L,"f").key[e]=!0,o(this,_e,"f").addCoerceMiddleware((n,r)=>{let s;return Object.prototype.hasOwnProperty.call(n,e)?kt(()=>(s=r.getAliases(),t(n[e])),a=>{n[e]=a;const c=r.getInternalMethods().getParserConfiguration()["strip-aliased"];if(s[e]&&c!==!0)for(const h of s[e])n[h]=a;return n},a=>{throw new fe(a.message)}):n},e),this}conflicts(e,t){return $("<string|object> [string|array]",[e,t],arguments.length),o(this,se,"f").conflicts(e,t),this}config(e="config",t,n){return $("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=Rn(e,o(this,at,"f"),this[mt]()["deep-merge-config"]||!1,o(this,T,"f")),o(this,L,"f").configObjects=(o(this,L,"f").configObjects||[]).concat(e),this):(typeof t=="function"&&(n=t,t=void 0),this.describe(e,t||o(this,W,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(r=>{o(this,L,"f").config[r]=n||!0}),this)}completion(e,t,n){return $("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t=="function"&&(n=t,t=void 0),_(this,be,e||o(this,be,"f")||"completion","f"),!t&&t!==!1&&(t="generate completion script"),this.command(o(this,be,"f"),t),n&&o(this,Be,"f").registerFunction(n),this}command(e,t,n,r,s,u){return $("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,r,s,u],arguments.length),o(this,oe,"f").addHandler(e,t,n,r,s,u),this}commands(e,t,n,r,s,u){return this.command(e,t,n,r,s,u)}commandDir(e,t){$("<string> [object]",[e,t],arguments.length);const n=o(this,ln,"f")||o(this,T,"f").require;return o(this,oe,"f").addDirectory(e,n,o(this,T,"f").getCallerFile(),t),this}count(e){return $("<array|string>",[e],arguments.length),this[Ze]("count",e),this[Dt](e),this}default(e,t,n){return $("<object|string|array> [*] [string]",[e,t,n],arguments.length),n&&(Hi(e,o(this,T,"f")),o(this,L,"f").defaultDescription[e]=n),typeof t=="function"&&(Hi(e,o(this,T,"f")),o(this,L,"f").defaultDescription[e]||(o(this,L,"f").defaultDescription[e]=o(this,W,"f").functionDescription(t)),t=t.call()),this[Bt](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,r){return $("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,r],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),o(this,L,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:r},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(r=>{Me(n,!0,o(this,T,"f")),this.demandOption(r,n)}),t=1/0):typeof t!="number"&&(n=t,t=1/0),typeof e=="number"?(Me(n,!0,o(this,T,"f")),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(r=>{Me(n,!0,o(this,T,"f")),this.demandOption(r,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return $("<object|string|array> [string]",[e,t],arguments.length),this[Bt](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return $("<string> [string|boolean]",[e,t],arguments.length),o(this,L,"f").deprecatedOptions[e]=t,this}describe(e,t){return $("<object|string|array> [string]",[e,t],arguments.length),this[Yn](e,!0),o(this,W,"f").describe(e,t),this}detectLocale(e){return $("<boolean>",[e],arguments.length),_(this,ct,e,"f"),this}env(e){return $("[string|boolean]",[e],arguments.length),e===!1?delete o(this,L,"f").envPrefix:o(this,L,"f").envPrefix=e||"",this}epilogue(e){return $("<string>",[e],arguments.length),o(this,W,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return $("<string|array> [string]",[e,t],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):o(this,W,"f").example(e,t),this}exit(e,t){_(this,Fe,!0,"f"),_(this,Qe,t,"f"),o(this,Oe,"f")&&o(this,T,"f").process.exit(e)}exitProcess(e=!0){return $("[boolean]",[e],arguments.length),_(this,Oe,e,"f"),this}fail(e){if($("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new fe("Invalid first argument. Expected function or boolean 'false'");return o(this,W,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return $("<array> [function]",[e,t],arguments.length),t?o(this,Be,"f").getCompletion(e,t):new Promise((n,r)=>{o(this,Be,"f").getCompletion(e,(s,u)=>{s?r(s):n(u)})})}getDemandedOptions(){return $([],0),o(this,L,"f").demandedOptions}getDemandedCommands(){return $([],0),o(this,L,"f").demandedCommands}getDeprecatedOptions(){return $([],0),o(this,L,"f").deprecatedOptions}getDetectLocale(){return o(this,ct,"f")}getExitProcess(){return o(this,Oe,"f")}getGroups(){return Object.assign({},o(this,Re,"f"),o(this,ft,"f"))}getHelp(){if(_(this,Fe,!0,"f"),!o(this,W,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[Vt](o(this,Xe,"f"),void 0,void 0,0,!0);if(le(t))return t.then(()=>o(this,W,"f").help())}const e=o(this,oe,"f").runDefaultBuilderOn(this);if(le(e))return e.then(()=>o(this,W,"f").help())}return Promise.resolve(o(this,W,"f").help())}getOptions(){return o(this,L,"f")}getStrict(){return o(this,dt,"f")}getStrictCommands(){return o(this,ht,"f")}getStrictOptions(){return o(this,pt,"f")}global(e,t){return $("<string|array> [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1?o(this,L,"f").local=o(this,L,"f").local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{o(this,L,"f").local.includes(n)||o(this,L,"f").local.push(n)}),this}group(e,t){$("<string|array> <string>",[e,t],arguments.length);const n=o(this,ft,"f")[t]||o(this,Re,"f")[t];o(this,ft,"f")[t]&&delete o(this,ft,"f")[t];const r={};return o(this,Re,"f")[t]=(n||[]).concat(e).filter(s=>r[s]?!1:r[s]=!0),this}hide(e){return $("<string>",[e],arguments.length),o(this,L,"f").hiddenOptions.push(e),this}implies(e,t){return $("<string|object> [number|string|array]",[e,t],arguments.length),o(this,se,"f").implies(e,t),this}locale(e){return $("[string]",[e],arguments.length),e===void 0?(this[Un](),o(this,T,"f").y18n.getLocale()):(_(this,ct,!1,"f"),o(this,T,"f").y18n.setLocale(e),this)}middleware(e,t,n){return o(this,_e,"f").addMiddleware(e,!!t,n)}nargs(e,t){return $("<string|object|array> [number]",[e,t],arguments.length),this[Bt](this.nargs.bind(this),"narg",e,t),this}normalize(e){return $("<array|string>",[e],arguments.length),this[Ze]("normalize",e),this}number(e){return $("<array|string>",[e],arguments.length),this[Ze]("number",e),this[Dt](e),this}option(e,t){if($("<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[Dt](e),o(this,We,"f")&&(e==="version"||t?.alias==="version")&&this[er](['"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"),o(this,L,"f").key[e]=!0,t.alias&&this.alias(e,t.alias);const n=t.deprecate||t.deprecated;n&&this.deprecateOption(e,n);const r=t.demand||t.required||t.require;r&&this.demand(e,r),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&&(o(this,L,"f").defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);const s=t.describe||t.description||t.desc,u=o(this,W,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(u,e)||typeof s=="string")&&this.describe(e,s),t.hidden&&this.hide(e),t.requiresArg&&this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){$("[string|array] [function|boolean|object] [function]",[e,t,n],arguments.length),this[tr](),typeof e>"u"&&(e=o(this,Xe,"f")),typeof t=="object"&&(_(this,lt,t,"f"),t=n),typeof t=="function"&&(_(this,ye,t,"f"),t=!1),t||_(this,Xe,e,"f"),o(this,ye,"f")&&_(this,Oe,!1,"f");const r=this[Vt](e,!!t),s=this.parsed;return o(this,Be,"f").setParsed(this.parsed),le(r)?r.then(u=>(o(this,ye,"f")&&o(this,ye,"f").call(this,o(this,Qe,"f"),u,o(this,ge,"f")),u)).catch(u=>{throw o(this,ye,"f")&&o(this,ye,"f")(u,this.parsed.argv,o(this,ge,"f")),u}).finally(()=>{this[qn](),this.parsed=s}):(o(this,ye,"f")&&o(this,ye,"f").call(this,o(this,Qe,"f"),r,o(this,ge,"f")),this[qn](),this.parsed=s,r)}parseAsync(e,t,n){const r=this.parse(e,t,n);return le(r)?r:Promise.resolve(r)}parseSync(e,t,n){const r=this.parse(e,t,n);if(le(r))throw new fe(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return r}parserConfiguration(e){return $("<object>",[e],arguments.length),_(this,fn,e,"f"),this}pkgConf(e,t){$("<string> [string]",[e,t],arguments.length);let n=null;const r=this[Vn](t||o(this,at,"f"));return r[e]&&typeof r[e]=="object"&&(n=Rn(r[e],t||o(this,at,"f"),this[mt]()["deep-merge-config"]||!1,o(this,T,"f")),o(this,L,"f").configObjects=(o(this,L,"f").configObjects||[]).concat(n)),this}positional(e,t){$("<string> <object>",[e,t],arguments.length);const n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=Tt(t,(u,a)=>u==="type"&&!["string","number","boolean"].includes(a)?!1:n.includes(u));const r=o(this,Ut,"f").fullCommands[o(this,Ut,"f").fullCommands.length-1],s=r?o(this,oe,"f").cmdToParseOptions(r):{array:[],alias:{},default:{},demand:{}};return rn(s).forEach(u=>{const a=s[u];Array.isArray(a)?a.indexOf(e)!==-1&&(t[u]=!0):a[e]&&!(u in t)&&(t[u]=a[e])}),this.group(e,o(this,W,"f").getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return $("[boolean]",[e],arguments.length),_(this,dn,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 $("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&o(this,L,"f").narg[e]?this:(this[Bt](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,t){return $("[string] [string]",[e,t],arguments.length),e=e||this.$0,o(this,yt,"f").log(o(this,Be,"f").generateCompletionScript(e,t||o(this,be,"f")||"completion")),this}showHelp(e){if($("[string|function]",[e],arguments.length),_(this,Fe,!0,"f"),!o(this,W,"f").hasCachedHelpMessage()){if(!this.parsed){const n=this[Vt](o(this,Xe,"f"),void 0,void 0,0,!0);if(le(n))return n.then(()=>{o(this,W,"f").showHelp(e)}),this}const t=o(this,oe,"f").runDefaultBuilderOn(this);if(le(t))return t.then(()=>{o(this,W,"f").showHelp(e)}),this}return o(this,W,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return $("[boolean|string] [string]",[e,t],arguments.length),o(this,W,"f").showHelpOnFail(e,t),this}showVersion(e){return $("[string|function]",[e],arguments.length),o(this,W,"f").showVersion(e),this}skipValidation(e){return $("<array|string>",[e],arguments.length),this[Ze]("skipValidation",e),this}strict(e){return $("[boolean]",[e],arguments.length),_(this,dt,e!==!1,"f"),this}strictCommands(e){return $("[boolean]",[e],arguments.length),_(this,ht,e!==!1,"f"),this}strictOptions(e){return $("[boolean]",[e],arguments.length),_(this,pt,e!==!1,"f"),this}string(e){return $("<array|string>",[e],arguments.length),this[Ze]("string",e),this[Dt](e),this}terminalWidth(){return $([],0),o(this,T,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return $("<object>",[e],arguments.length),_(this,ct,!1,"f"),o(this,T,"f").y18n.updateLocale(e),this}usage(e,t,n,r){if($("<string|null|undefined> [string|boolean] [function|object] [function]",[e,t,n,r],arguments.length),t!==void 0){if(Me(e,null,o(this,T,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,r);throw new fe(".usage() description must start with $0 if being used as alias for .command()")}else return o(this,W,"f").usage(e),this}usageConfiguration(e){return $("<object>",[e],arguments.length),_(this,hn,e,"f"),this}version(e,t,n){const r="version";if($("[boolean|string] [string] [string]",[e,t,n],arguments.length),o(this,We,"f")&&(this[Wn](o(this,We,"f")),o(this,W,"f").version(void 0),_(this,We,null,"f")),arguments.length===0)n=this[rr](),e=r;else if(arguments.length===1){if(e===!1)return this;n=e,e=r}else arguments.length===2&&(n=t,t=void 0);return _(this,We,typeof e=="string"?e:r,"f"),t=t||o(this,W,"f").deferY18nLookup("Show version number"),o(this,W,"f").version(n||void 0),this.boolean(o(this,We,"f")),this.describe(o(this,We,"f"),t),this}wrap(e){return $("<number|null|undefined>",[e],arguments.length),o(this,W,"f").wrap(e),this}[(oe=new WeakMap,at=new WeakMap,Ut=new WeakMap,Be=new WeakMap,be=new WeakMap,un=new WeakMap,Qe=new WeakMap,ct=new WeakMap,on=new WeakMap,Oe=new WeakMap,an=new WeakMap,_e=new WeakMap,Re=new WeakMap,Fe=new WeakMap,Se=new WeakMap,cn=new WeakMap,yt=new WeakMap,ge=new WeakMap,L=new WeakMap,ln=new WeakMap,fn=new WeakMap,ye=new WeakMap,lt=new WeakMap,vt=new WeakMap,ft=new WeakMap,Xe=new WeakMap,dn=new WeakMap,T=new WeakMap,dt=new WeakMap,ht=new WeakMap,pt=new WeakMap,W=new WeakMap,hn=new WeakMap,We=new WeakMap,se=new WeakMap,Xi)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[Zi](){return{log:(...e)=>{this[pn]()||console.log(...e),_(this,Fe,!0,"f"),o(this,ge,"f").length&&_(this,ge,o(this,ge,"f")+`
64
- `,"f"),_(this,ge,o(this,ge,"f")+e.join(" "),"f")},error:(...e)=>{this[pn]()||console.error(...e),_(this,Fe,!0,"f"),o(this,ge,"f").length&&_(this,ge,o(this,ge,"f")+`
65
- `,"f"),_(this,ge,o(this,ge,"f")+e.join(" "),"f")}}}[Wn](e){rn(o(this,L,"f")).forEach(t=>{if((r=>r==="configObjects")(t))return;const n=o(this,L,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete o(this,W,"f").getDescriptions()[e]}[er](e,t,n){o(this,on,"f")[n]||(o(this,T,"f").process.emitWarning(e,t),o(this,on,"f")[n]=!0)}[tr](){o(this,an,"f").push({options:o(this,L,"f"),configObjects:o(this,L,"f").configObjects.slice(0),exitProcess:o(this,Oe,"f"),groups:o(this,Re,"f"),strict:o(this,dt,"f"),strictCommands:o(this,ht,"f"),strictOptions:o(this,pt,"f"),completionCommand:o(this,be,"f"),output:o(this,ge,"f"),exitError:o(this,Qe,"f"),hasOutput:o(this,Fe,"f"),parsed:this.parsed,parseFn:o(this,ye,"f"),parseContext:o(this,lt,"f")}),o(this,W,"f").freeze(),o(this,se,"f").freeze(),o(this,oe,"f").freeze(),o(this,_e,"f").freeze()}[nr](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(o(this,T,"f").process.argv()[0])?t=o(this,T,"f").process.argv().slice(1,2):t=o(this,T,"f").process.argv().slice(0,1),e=t.map(n=>{const r=this[mr](o(this,at,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&r.length<n.length?r:n}).join(" ").trim(),o(this,T,"f").getEnv("_")&&o(this,T,"f").getProcessArgvBin()===o(this,T,"f").getEnv("_")&&(e=o(this,T,"f").getEnv("_").replace(`${o(this,T,"f").path.dirname(o(this,T,"f").process.execPath())}/`,"")),e}[mt](){return o(this,fn,"f")}[ir](){return o(this,hn,"f")}[Un](){if(!o(this,ct,"f"))return;const e=o(this,T,"f").getEnv("LC_ALL")||o(this,T,"f").getEnv("LC_MESSAGES")||o(this,T,"f").getEnv("LANG")||o(this,T,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[rr](){return this[Vn]().version||"unknown"}[sr](e){const t=e["--"]?e["--"]:e._;for(let n=0,r;(r=t[n])!==void 0;n++)o(this,T,"f").Parser.looksLikeNumber(r)&&Number.isSafeInteger(Math.floor(parseFloat(`${r}`)))&&(t[n]=Number(r));return e}[Vn](e){const t=e||"*";if(o(this,vt,"f")[t])return o(this,vt,"f")[t];let n={};try{let r=e||o(this,T,"f").mainFilename;!e&&o(this,T,"f").path.extname(r)&&(r=o(this,T,"f").path.dirname(r));const s=o(this,T,"f").findUp(r,(u,a)=>{if(a.includes("package.json"))return"package.json"});Me(s,void 0,o(this,T,"f")),n=JSON.parse(o(this,T,"f").readFileSync(s,"utf8"))}catch{}return o(this,vt,"f")[t]=n||{},o(this,vt,"f")[t]}[Ze](e,t){t=[].concat(t),t.forEach(n=>{n=this[Gn](n),o(this,L,"f")[e].push(n)})}[Bt](e,t,n,r){this[Hn](e,t,n,r,(s,u,a)=>{o(this,L,"f")[s][u]=a})}[zn](e,t,n,r){this[Hn](e,t,n,r,(s,u,a)=>{o(this,L,"f")[s][u]=(o(this,L,"f")[s][u]||[]).concat(a)})}[Hn](e,t,n,r,s){if(Array.isArray(n))n.forEach(u=>{e(u,r)});else if((u=>typeof u=="object")(n))for(const u of rn(n))e(u,n[u]);else s(t,this[Gn](n),r)}[Gn](e){return e==="__proto__"?"___proto___":e}[Yn](e,t){return this[Bt](this[Yn].bind(this),"key",e,t),this}[qn](){var e,t,n,r,s,u,a,c,h,l,f,p;const C=o(this,an,"f").pop();Me(C,void 0,o(this,T,"f"));let F;e=this,t=this,n=this,r=this,s=this,u=this,a=this,c=this,h=this,l=this,f=this,p=this,{options:{set value(w){_(e,L,w,"f")}}.value,configObjects:F,exitProcess:{set value(w){_(t,Oe,w,"f")}}.value,groups:{set value(w){_(n,Re,w,"f")}}.value,output:{set value(w){_(r,ge,w,"f")}}.value,exitError:{set value(w){_(s,Qe,w,"f")}}.value,hasOutput:{set value(w){_(u,Fe,w,"f")}}.value,parsed:this.parsed,strict:{set value(w){_(a,dt,w,"f")}}.value,strictCommands:{set value(w){_(c,ht,w,"f")}}.value,strictOptions:{set value(w){_(h,pt,w,"f")}}.value,completionCommand:{set value(w){_(l,be,w,"f")}}.value,parseFn:{set value(w){_(f,ye,w,"f")}}.value,parseContext:{set value(w){_(p,lt,w,"f")}}.value}=C,o(this,L,"f").configObjects=F,o(this,W,"f").unfreeze(),o(this,se,"f").unfreeze(),o(this,oe,"f").unfreeze(),o(this,_e,"f").unfreeze()}[ur](e,t){return kt(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[or].bind(this),getContext:this[ar].bind(this),getHasOutput:this[cr].bind(this),getLoggerInstance:this[lr].bind(this),getParseContext:this[fr].bind(this),getParserConfiguration:this[mt].bind(this),getUsageConfiguration:this[ir].bind(this),getUsageInstance:this[dr].bind(this),getValidationInstance:this[hr].bind(this),hasParseCallback:this[pn].bind(this),isGlobalContext:this[pr].bind(this),postProcess:this[gt].bind(this),reset:this[Jn].bind(this),runValidation:this[Kn].bind(this),runYargsParserAndExecuteCommands:this[Vt].bind(this),setHasOutput:this[gr].bind(this)}}[or](){return o(this,oe,"f")}[ar](){return o(this,Ut,"f")}[cr](){return o(this,Fe,"f")}[lr](){return o(this,yt,"f")}[fr](){return o(this,lt,"f")||{}}[dr](){return o(this,W,"f")}[hr](){return o(this,se,"f")}[pn](){return!!o(this,ye,"f")}[pr](){return o(this,cn,"f")}[gt](e,t,n,r){return n||le(e)||(t||(e=this[Xi](e)),(this[mt]()["parse-positional-numbers"]||this[mt]()["parse-positional-numbers"]===void 0)&&(e=this[sr](e)),r&&(e=Mt(e,this,o(this,_e,"f").getMiddleware(),!1))),e}[Jn](e={}){_(this,L,o(this,L,"f")||{},"f");const t={};t.local=o(this,L,"f").local||[],t.configObjects=o(this,L,"f").configObjects||[];const n={};t.local.forEach(u=>{n[u]=!0,(e[u]||[]).forEach(a=>{n[a]=!0})}),Object.assign(o(this,ft,"f"),Object.keys(o(this,Re,"f")).reduce((u,a)=>{const c=o(this,Re,"f")[a].filter(h=>!(h in n));return c.length>0&&(u[a]=c),u},{})),_(this,Re,{},"f");const r=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return r.forEach(u=>{t[u]=(o(this,L,"f")[u]||[]).filter(a=>!n[a])}),s.forEach(u=>{t[u]=Tt(o(this,L,"f")[u],a=>!n[a])}),t.envPrefix=o(this,L,"f").envPrefix,_(this,L,t,"f"),_(this,W,o(this,W,"f")?o(this,W,"f").reset(n):mu(this,o(this,T,"f")),"f"),_(this,se,o(this,se,"f")?o(this,se,"f").reset(n):yu(this,o(this,W,"f"),o(this,T,"f")),"f"),_(this,oe,o(this,oe,"f")?o(this,oe,"f").reset():lu(o(this,W,"f"),o(this,se,"f"),o(this,_e,"f"),o(this,T,"f")),"f"),o(this,Be,"f")||_(this,Be,Au(this,o(this,W,"f"),o(this,oe,"f"),o(this,T,"f")),"f"),o(this,_e,"f").reset(),_(this,be,null,"f"),_(this,ge,"","f"),_(this,Qe,null,"f"),_(this,Fe,!1,"f"),this.parsed=!1,this}[mr](e,t){return o(this,T,"f").path.relative(e,t)}[Vt](e,t,n,r=0,s=!1){let u=!!n||s;e=e||o(this,Xe,"f"),o(this,L,"f").__=o(this,T,"f").y18n.__,o(this,L,"f").configuration=this[mt]();const a=!!o(this,L,"f").configuration["populate--"],c=Object.assign({},o(this,L,"f").configuration,{"populate--":!0}),h=o(this,T,"f").Parser.detailed(e,Object.assign({},o(this,L,"f"),{configuration:{"parse-positional-numbers":!1,...c}})),l=Object.assign(h.argv,o(this,lt,"f"));let f;const p=h.aliases;let C=!1,F=!1;Object.keys(l).forEach(w=>{w===o(this,Se,"f")&&l[w]?C=!0:w===o(this,We,"f")&&l[w]&&(F=!0)}),l.$0=this.$0,this.parsed=h,r===0&&o(this,W,"f").clearCachedHelpMessage();try{if(this[Un](),t)return this[gt](l,a,!!n,!1);o(this,Se,"f")&&[o(this,Se,"f")].concat(p[o(this,Se,"f")]||[]).filter(R=>R.length>1).includes(""+l._[l._.length-1])&&(l._.pop(),C=!0),_(this,cn,!1,"f");const w=o(this,oe,"f").getCommands(),m=o(this,Be,"f").completionKey in l,y=C||m||s;if(l._.length){if(w.length){let S;for(let R=r||0,N;l._[R]!==void 0;R++)if(N=String(l._[R]),w.includes(N)&&N!==o(this,be,"f")){const U=o(this,oe,"f").runCommand(N,this,h,R+1,s,C||F||s);return this[gt](U,a,!!n,!1)}else if(!S&&N!==o(this,be,"f")){S=N;break}!o(this,oe,"f").hasDefaultCommand()&&o(this,dn,"f")&&S&&!y&&o(this,se,"f").recommendCommands(S,w)}o(this,be,"f")&&l._.includes(o(this,be,"f"))&&!m&&(o(this,Oe,"f")&&Rt(!0),this.showCompletionScript(),this.exit(0))}if(o(this,oe,"f").hasDefaultCommand()&&!y){const S=o(this,oe,"f").runCommand(null,this,h,0,s,C||F||s);return this[gt](S,a,!!n,!1)}if(m){o(this,Oe,"f")&&Rt(!0),e=[].concat(e);const S=e.slice(e.indexOf(`--${o(this,Be,"f").completionKey}`)+1);return o(this,Be,"f").getCompletion(S,(R,N)=>{if(R)throw new fe(R.message);(N||[]).forEach(U=>{o(this,yt,"f").log(U)}),this.exit(0)}),this[gt](l,!a,!!n,!1)}if(o(this,Fe,"f")||(C?(o(this,Oe,"f")&&Rt(!0),u=!0,this.showHelp("log"),this.exit(0)):F&&(o(this,Oe,"f")&&Rt(!0),u=!0,o(this,W,"f").showVersion("log"),this.exit(0))),!u&&o(this,L,"f").skipValidation.length>0&&(u=Object.keys(l).some(S=>o(this,L,"f").skipValidation.indexOf(S)>=0&&l[S]===!0)),!u){if(h.error)throw new fe(h.error.message);if(!m){const S=this[Kn](p,{},h.error);n||(f=Mt(l,this,o(this,_e,"f").getMiddleware(),!0)),f=this[ur](S,f??l),le(f)&&!n&&(f=f.then(()=>Mt(l,this,o(this,_e,"f").getMiddleware(),!1)))}}}catch(w){if(w instanceof fe)o(this,W,"f").fail(w.message,w);else throw w}return this[gt](f??l,a,!!n,!0)}[Kn](e,t,n,r){const s={...this.getDemandedOptions()};return u=>{if(n)throw new fe(n.message);o(this,se,"f").nonOptionCount(u),o(this,se,"f").requiredArguments(u,s);let a=!1;o(this,ht,"f")&&(a=o(this,se,"f").unknownCommands(u)),o(this,dt,"f")&&!a?o(this,se,"f").unknownArguments(u,e,t,!!r):o(this,pt,"f")&&o(this,se,"f").unknownArguments(u,e,{},!1,!1),o(this,se,"f").limitedChoices(u),o(this,se,"f").implications(u),o(this,se,"f").conflicting(u)}}[gr](){_(this,Fe,!0,"f")}[Dt](e){if(typeof e=="string")o(this,L,"f").key[e]=!0;else for(const t of e)o(this,L,"f").key[t]=!0}}function Su(i){return!!i&&typeof i.getInternalMethods=="function"}const Iu=Ou(iu),mn={type:"string",desc:"<directory> with LikeC4 sources (default is current directory)",normalize:!0,default:".",coerce:Q},ke={alias:"use-dot-bin",boolean:!0,type:"boolean",desc:'use graphviz binaries ("dot" should be on PATH)',default:!1},Dr={boolean:!0,type:"boolean",desc:'use hash history for navigation, e.g. "/#/view" instead of "/view"'},gn={alias:"o",type:"string",desc:"<directory> output directory",normalize:!0,coerce:Q},Qn={alias:"w",type:"string",desc:'prefix for Webcomponents, e.g "c4" generates <c4-view ../>',default:"likec4"},Cr={alias:["base-url"],type:"string",desc:'base url the app is being served from, e.g. "/" or "/pages/"'},wr={boolean:!0,type:"boolean",desc:"overview all diagrams as graph [experimental]",default:!1};function $u(i){var e,t;if(i){if("astNode"in i)return Lu(i);if(Array.isArray(i))return i.reduce(Ar,void 0);{const n=i,r=xu(n)?ju((t=(e=n?.root)===null||e===void 0?void 0:e.astNode)!==null&&t!==void 0?t:n?.astNode):void 0;return Ot(n,r)}}else return}function xu(i){return typeof i<"u"&&"element"in i&&"text"in i}function ju(i){try{return Di(i).uri.toString()}catch{return}}function Lu(i){var e,t;const{astNode:n,property:r,index:s}=i??{},u=(e=n?.$cstNode)!==null&&e!==void 0?e:n?.$textRegion;if(!(n===void 0||u===void 0)){if(r===void 0)return Ot(u,Xn(n));{const a=c=>s!==void 0&&s>-1&&Array.isArray(n[r])?s<c.length?c[s]:void 0:c.reduce(Ar,void 0);if(!((t=u.assignments)===null||t===void 0)&&t[r]){const c=a(u.assignments[r]);return c&&Ot(c,Xn(n))}else if(n.$cstNode){const c=a(Hr(n.$cstNode,r));return c&&Ot(c,Xn(n))}else return}}}function Xn(i){var e,t,n,r;return i.$cstNode?(t=(e=Di(i))===null||e===void 0?void 0:e.uri)===null||t===void 0?void 0:t.toString():i.$textRegion?i.$textRegion.documentURI||((r=(n=new Gr(i,s=>s.$container?[s.$container]:[]).find(s=>{var u;return(u=s.$textRegion)===null||u===void 0?void 0:u.documentURI}))===null||n===void 0?void 0:n.$textRegion)===null||r===void 0?void 0:r.documentURI):void 0}function Ot(i,e){var t,n;const r={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&&(r.range=i.range),e??(e=i.fileURI),e&&(r.fileURI=e),r}function Ar(i,e){var t,n;if(i){if(!e)return i&&Ot(i)}else return e&&Ot(e);const r=(t=i.end)!==null&&t!==void 0?t:i.offset+i.length,s=(n=e.end)!==null&&n!==void 0?n:e.offset+e.length,u=Math.min(i.offset,e.offset),a=Math.max(r,s),c=a-u,h={offset:u,end:a,length:c};if(i.range&&e.range&&(h.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 l=i.fileURI,f=e.fileURI,p=l&&f&&l!==f?`<unmergable text regions of ${l}, ${f}>`:l??f;h.fileURI=p}return h}class Pu{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=Nu(e,this.currentPosition,n=>{var r,s;return(s=(r=this.traceData[this.traceData.length-1])===null||r===void 0?void 0:r.children)===null||s===void 0?void 0:s.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 Nu(i,e,t){const n={sourceRegion:i,targetRegion:void 0,children:[],targetStart:e,complete:r=>{var s,u;return n.targetRegion={offset:n.targetStart.offset,end:r.offset,length:r.offset-n.targetStart.offset,range:{start:{line:n.targetStart.line,character:n.targetStart.character},end:{line:r.line,character:r.character}}},delete n.targetStart,((s=n.children)===null||s===void 0?void 0:s.length)===0&&delete n.children,!((u=n.targetRegion)===null||u===void 0)&&u.length&&t(n),delete n.complete,n}};return n}function Mu(i,e){const t=new Pu(e),n=t.pushTraceRegion(void 0);Er(i,t),t.popTraceRegion(n),n.complete&&n.complete(t.currentPosition);const r=n.children&&n.children.length===1?n.children[0]:void 0,s=r?.targetRegion,u=n.targetRegion;return s&&r.sourceRegion&&s.offset===u.offset&&s.length===u.length?{text:t.content,trace:r}:{text:t.content,trace:n}}function Er(i,e){typeof i=="string"?ku(i,e):i instanceof ei?Tu(i,e):i instanceof ce?yr(i,e):i instanceof Ht&&Ru(i,e)}function br(i,e){return typeof i=="string"?i.length!==0:i instanceof ce?i.contents.some(t=>br(t,e)):i instanceof Ht?!(i.ifNotEmpty&&e.currentLineContent.length===0):!1}function ku(i,e){i&&(e.pendingIndent&&Fr(e,!1),e.append(i))}function Fr(i,e){var t;let n="";for(const r of i.relevantIndents.filter(s=>s.indentEmptyLines||!e))n+=(t=r.indentation)!==null&&t!==void 0?t:i.defaultIndentation;i.append(n,!0),i.pendingIndent=!1}function yr(i,e){let t;const n=$u(i.tracedSource);n&&(t=e.pushTraceRegion(n));for(const r of i.contents)Er(r,e);if(t){e.popTraceRegion(t);const r=e.getParentTraceSourceFileURI();r&&n?.fileURI===r&&delete n.fileURI,t.complete&&t.complete(e.currentPosition)}}function Tu(i,e){var t;if(br(i,e)){i.indentImmediately&&!e.pendingIndent&&e.append((t=i.indentation)!==null&&t!==void 0?t:e.defaultIndentation,!0);try{e.increaseIndent(i),yr(i,e)}finally{e.decreaseIndent()}}}function Ru(i,e){i.ifNotEmpty&&!Wu(e.currentLineContent)?e.resetCurrentLine():(e.pendingIndent&&Fr(e,!0),e.append(i.lineDelimiter),e.addNewLine())}function Wu(i){return i.trimStart()!==""}Object.freeze("__\xABSKIP^NEW^LINE^IF^EMPTY\xBB__");const Uu=/\S|$/;function Vu(i){const e=i.filter(n=>n.length>0).map(n=>n.search(Uu)),t=e.length===0?0:Math.min(...e);return Math.max(0,t)}function et(i,...e){const t=Hu(i),n=Gu(i,e,t);return qu(n)}function zu(i,e,t){return(n,...r)=>Ku(i,e,t)(et(n,...r))}function Hu(i){const e=i.join("_").split(Ci),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 r=t?e.slice(1):e;r=n?r.slice(0,r.length-1):r,r=r.filter(u=>u.length!==0);const s=Vu(r);return{indentation:s,omitFirstLine:t,omitLastLine:n&&(e[e.length-1].length<s||!e[e.length-1].startsWith(r[0].substring(0,s)))}}}function Gu(i,e,{indentation:t,omitFirstLine:n,omitLastLine:r,trimLastLine:s}){const u=[];i.forEach((h,l)=>{u.push(...h.split(Ci).map((f,p)=>p===0||f.length<t?f:f.substring(t)).reduce(l===0?(f,p,C)=>C===0?n?[]:[p]:C===1&&f.length===0?[p]:f.concat(Dn,p):(f,p,C)=>C===0?[p]:f.concat(Dn,p),[]).filter(f=>!(typeof f=="string"&&f.length===0)).concat(zt(e[l])?e[l]:e[l]!==void 0?{content:String(e[l])}:l<e.length?vr:[]))});const a=u.length,c=a!==0?u[a-1]:void 0;return(r||s)&&typeof c=="string"&&c.trim().length===0?n&&a!==1&&u[a-2]===Dn?u.slice(0,a-2):u.slice(0,a-1):u}const Dn={isNewLine:!0},vr={isUndefinedSegment:!0},Br=i=>i===Dn,Zn=i=>i===vr,Yu=i=>i.content!==void 0;function qu(i){return i.reduce((t,n,r)=>Zn(n)?t:Br(n)?{node:r!==0&&(Zn(i[r-1])||zt(i[r-1]))||r>1&&typeof i[r-1]=="string"&&(Zn(i[r-2])||zt(i[r-2]))?t.node.appendNewLineIfNotEmpty():t.node.appendNewLine()}:(()=>{var s;const u=(r===0||Br(i[r-1]))&&typeof n=="string"&&n.length!==0?"".padStart(n.length-n.trimStart().length):"",a=Yu(n)?n.content:n;let c;return{node:t.indented?t.node:u.length!==0?t.node.indent({indentation:u,indentImmediately:!1,indentedChildren:h=>c=h.append(a)}):t.node.append(a),indented:c??((s=t.indented)===null||s===void 0?void 0:s.append(a))}})(),{node:new ce}).node}const Ju=typeof process>"u"?`
60
+ `)}`:"";e.fail(r("Missing required argument: %s","Missing required arguments: %s",Object.keys(C).length,Object.keys(C).join(", ")+w))}},s.unknownArguments=function(f,p,C,F,w=!0){var m;const y=i.getInternalMethods().getCommandInstance().getCommands(),S=[],R=i.getInternalMethods().getContext();if(Object.keys(f).forEach(N=>{!Qi.includes(N)&&!Object.prototype.hasOwnProperty.call(C,N)&&!Object.prototype.hasOwnProperty.call(i.getInternalMethods().getParseContext(),N)&&!s.isValidAndSomeAliasIsNotNew(N,p)&&S.push(N)}),w&&(R.commands.length>0||y.length>0||F)&&f._.slice(R.commands.length).forEach(N=>{y.includes(""+N)||S.push(""+N)}),w){const W=((m=i.getDemandedCommands()._)===null||m===void 0?void 0:m.max)||0,Ce=R.commands.length+W;Ce<f._.length&&f._.slice(Ce).forEach(Ie=>{Ie=String(Ie),!R.commands.includes(Ie)&&!S.includes(Ie)&&S.push(Ie)})}S.length&&e.fail(r("Unknown argument: %s","Unknown arguments: %s",S.length,S.map(N=>N.trim()?N:`"${N}"`).join(", ")))},s.unknownCommands=function(f){const p=i.getInternalMethods().getCommandInstance().getCommands(),C=[],F=i.getInternalMethods().getContext();return(F.commands.length>0||p.length>0)&&f._.slice(F.commands.length).forEach(w=>{p.includes(""+w)||C.push(""+w)}),C.length>0?(e.fail(r("Unknown command: %s","Unknown commands: %s",C.length,C.join(", "))),!0):!1},s.isValidAndSomeAliasIsNotNew=function(f,p){if(!Object.prototype.hasOwnProperty.call(p,f))return!1;const C=i.parsed.newAliases;return[f,...p[f]].some(F=>!Object.prototype.hasOwnProperty.call(C,F)||!C[f])},s.limitedChoices=function(f){const p=i.getOptions(),C={};if(!Object.keys(p.choices).length)return;Object.keys(f).forEach(m=>{Qi.indexOf(m)===-1&&Object.prototype.hasOwnProperty.call(p.choices,m)&&[].concat(f[m]).forEach(y=>{p.choices[m].indexOf(y)===-1&&y!==void 0&&(C[m]=(C[m]||[]).concat(y))})});const F=Object.keys(C);if(!F.length)return;let w=n("Invalid values:");F.forEach(m=>{w+=`
61
+ ${n("Argument: %s, Given: %s, Choices: %s",m,e.stringifiedValues(C[m]),e.stringifiedValues(p.choices[m]))}`}),e.fail(w)};let o={};s.implies=function(f,p){I("<string|object> [array|number|string]",[f,p],arguments.length),typeof f=="object"?Object.keys(f).forEach(C=>{s.implies(C,f[C])}):(i.global(f),o[f]||(o[f]=[]),Array.isArray(p)?p.forEach(C=>s.implies(f,C)):(ke(p,void 0,t),o[f].push(p)))},s.getImplied=function(){return o};function a(l,f){const p=Number(f);return f=isNaN(p)?f:p,typeof f=="number"?f=l._.length>=f:f.match(/^--no-.+/)?(f=f.match(/^--no-(.+)/)[1],f=!Object.prototype.hasOwnProperty.call(l,f)):f=Object.prototype.hasOwnProperty.call(l,f),f}s.implications=function(f){const p=[];if(Object.keys(o).forEach(C=>{const F=C;(o[C]||[]).forEach(w=>{let m=F;const y=w;m=a(f,m),w=a(f,w),m&&!w&&p.push(` ${F} -> ${y}`)})}),p.length){let C=`${n("Implications failed:")}
62
+ `;p.forEach(F=>{C+=F}),e.fail(C)}};let c={};s.conflicts=function(f,p){I("<string|object> [array|string]",[f,p],arguments.length),typeof f=="object"?Object.keys(f).forEach(C=>{s.conflicts(C,f[C])}):(i.global(f),c[f]||(c[f]=[]),Array.isArray(p)?p.forEach(C=>s.conflicts(f,C)):c[f].push(p))},s.getConflicting=()=>c,s.conflicting=function(f){Object.keys(f).forEach(p=>{c[p]&&c[p].forEach(C=>{C&&f[p]!==void 0&&f[C]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",p,C))})}),i.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(c).forEach(p=>{c[p].forEach(C=>{C&&f[t.Parser.camelCase(p)]!==void 0&&f[t.Parser.camelCase(C)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",p,C))})})},s.recommendCommands=function(f,p){p=p.sort((m,y)=>y.length-m.length);let F=null,w=1/0;for(let m=0,y;(y=p[m])!==void 0;m++){const S=$o(f,y);S<=3&&S<w&&(w=S,F=y)}F&&e.fail(n("Did you mean %s?",F))},s.reset=function(f){return o=Rt(o,p=>!f[p]),c=Rt(c,p=>!f[p]),s};const h=[];return s.freeze=function(){h.push({implied:o,conflicting:c})},s.unfreeze=function(){const f=h.pop();ke(f,void 0,t),{implied:o,conflicting:c}=f},s}let Rn=[],Wt;function Un(i,e,t,n){Wt=n;let r={};if(Object.prototype.hasOwnProperty.call(i,"extends")){if(typeof i.extends!="string")return r;const s=/\.json|\..*rc$/.test(i.extends);let o=null;if(s)o=jo(e,i.extends);else try{o=require.resolve(i.extends)}catch{return i}xo(o),Rn.push(o),r=s?JSON.parse(Wt.readFileSync(o,"utf8")):require(i.extends),delete i.extends,r=Un(r,Wt.path.dirname(o),t,Wt)}return Rn=[],t?Xi(r,i):Object.assign({},r,i)}function xo(i){if(Rn.indexOf(i)>-1)throw new fe(`Circular extended configurations: '${i}'.`)}function jo(i,e){return Wt.path.resolve(i,e)}function Xi(i,e){const t={};function n(r){return r&&typeof r=="object"&&!Array.isArray(r)}Object.assign(t,i);for(const r of Object.keys(e))n(e[r])&&n(t[r])?t[r]=Xi(i[r],e[r]):t[r]=e[r];return t}var _=function(i,e,t,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(i,t):r?r.value=t:e.set(i,t),t},u=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)},ue,ct,Vt,Be,be,on,Qe,lt,un,Oe,an,_e,Re,Fe,Se,cn,vt,me,L,ln,fn,ye,ft,Bt,dt,Xe,dn,T,ht,pt,mt,U,hn,Ue,se;function Lo(i){return(e=[],t=i.process.cwd(),n)=>{const r=new Po(e,t,n,i);return Object.defineProperty(r,"argv",{get:()=>r.parse(),enumerable:!0}),r.help(),r.version(),r}}const Zi=Symbol("copyDoubleDash"),er=Symbol("copyDoubleDash"),Wn=Symbol("deleteFromParserHintObject"),tr=Symbol("emitWarning"),nr=Symbol("freeze"),ir=Symbol("getDollarZero"),gt=Symbol("getParserConfiguration"),rr=Symbol("getUsageConfiguration"),Vn=Symbol("guessLocale"),sr=Symbol("guessVersion"),or=Symbol("parsePositionalNumbers"),zn=Symbol("pkgUp"),Ze=Symbol("populateParserHintArray"),Ot=Symbol("populateParserHintSingleValueDictionary"),Hn=Symbol("populateParserHintArrayDictionary"),Gn=Symbol("populateParserHintDictionary"),Yn=Symbol("sanitizeKey"),qn=Symbol("setKey"),Jn=Symbol("unfreeze"),ur=Symbol("validateAsync"),ar=Symbol("getCommandInstance"),cr=Symbol("getContext"),lr=Symbol("getHasOutput"),fr=Symbol("getLoggerInstance"),dr=Symbol("getParseContext"),hr=Symbol("getUsageInstance"),pr=Symbol("getValidationInstance"),pn=Symbol("hasParseCallback"),mr=Symbol("isGlobalContext"),Dt=Symbol("postProcess"),gr=Symbol("rebase"),Kn=Symbol("reset"),zt=Symbol("runYargsParserAndExecuteCommands"),Qn=Symbol("runValidation"),Dr=Symbol("setHasOutput"),Ct=Symbol("kTrackManuallySetKeys");class Po{constructor(e=[],t,n,r){this.customScriptName=!1,this.parsed=!1,ue.set(this,void 0),ct.set(this,void 0),Vt.set(this,{commands:[],fullCommands:[]}),Be.set(this,null),be.set(this,null),on.set(this,"show-hidden"),Qe.set(this,null),lt.set(this,!0),un.set(this,{}),Oe.set(this,!0),an.set(this,[]),_e.set(this,void 0),Re.set(this,{}),Fe.set(this,!1),Se.set(this,null),cn.set(this,!0),vt.set(this,void 0),me.set(this,""),L.set(this,void 0),ln.set(this,void 0),fn.set(this,{}),ye.set(this,null),ft.set(this,null),Bt.set(this,{}),dt.set(this,{}),Xe.set(this,void 0),dn.set(this,!1),T.set(this,void 0),ht.set(this,!1),pt.set(this,!1),mt.set(this,!1),U.set(this,void 0),hn.set(this,{}),Ue.set(this,null),se.set(this,void 0),_(this,T,r,"f"),_(this,Xe,e,"f"),_(this,ct,t,"f"),_(this,ln,n,"f"),_(this,_e,new fo(this),"f"),this.$0=this[ir](),this[Kn](),_(this,ue,u(this,ue,"f"),"f"),_(this,U,u(this,U,"f"),"f"),_(this,se,u(this,se,"f"),"f"),_(this,L,u(this,L,"f"),"f"),u(this,L,"f").showHiddenOpt=u(this,on,"f"),_(this,vt,this[er](),"f")}addHelpOpt(e,t){const n="help";return I("[string|boolean] [string]",[e,t],arguments.length),u(this,Se,"f")&&(this[Wn](u(this,Se,"f")),_(this,Se,null,"f")),e===!1&&t===void 0?this:(_(this,Se,typeof e=="string"?e:n,"f"),this.boolean(u(this,Se,"f")),this.describe(u(this,Se,"f"),t||u(this,U,"f").deferY18nLookup("Show help")),this)}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if(I("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;const n=typeof e=="string"?e:u(this,on,"f");return this.boolean(n),this.describe(n,t||u(this,U,"f").deferY18nLookup("Show hidden options")),u(this,L,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return I("<object|string|array> [string|array]",[e,t],arguments.length),this[Hn](this.alias.bind(this),"alias",e,t),this}array(e){return I("<array|string>",[e],arguments.length),this[Ze]("array",e),this[Ct](e),this}boolean(e){return I("<array|string>",[e],arguments.length),this[Ze]("boolean",e),this[Ct](e),this}check(e,t){return I("<function> [boolean]",[e,t],arguments.length),this.middleware((n,r)=>Tt(()=>e(n,r.getOptions()),s=>(s?(typeof s=="string"||s instanceof Error)&&u(this,U,"f").fail(s.toString(),s):u(this,U,"f").fail(u(this,T,"f").y18n.__("Argument check failed: %s",e.toString())),n),s=>(u(this,U,"f").fail(s.message?s.message:s.toString(),s),n)),!1,t),this}choices(e,t){return I("<object|string|array> [string|array]",[e,t],arguments.length),this[Hn](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if(I("<object|string|array> [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new fe("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 fe("coerce callback must be provided");return u(this,L,"f").key[e]=!0,u(this,_e,"f").addCoerceMiddleware((n,r)=>{let s;return Object.prototype.hasOwnProperty.call(n,e)?Tt(()=>(s=r.getAliases(),t(n[e])),a=>{n[e]=a;const c=r.getInternalMethods().getParserConfiguration()["strip-aliased"];if(s[e]&&c!==!0)for(const h of s[e])n[h]=a;return n},a=>{throw new fe(a.message)}):n},e),this}conflicts(e,t){return I("<string|object> [string|array]",[e,t],arguments.length),u(this,se,"f").conflicts(e,t),this}config(e="config",t,n){return I("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=Un(e,u(this,ct,"f"),this[gt]()["deep-merge-config"]||!1,u(this,T,"f")),u(this,L,"f").configObjects=(u(this,L,"f").configObjects||[]).concat(e),this):(typeof t=="function"&&(n=t,t=void 0),this.describe(e,t||u(this,U,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(r=>{u(this,L,"f").config[r]=n||!0}),this)}completion(e,t,n){return I("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t=="function"&&(n=t,t=void 0),_(this,be,e||u(this,be,"f")||"completion","f"),!t&&t!==!1&&(t="generate completion script"),this.command(u(this,be,"f"),t),n&&u(this,Be,"f").registerFunction(n),this}command(e,t,n,r,s,o){return I("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,r,s,o],arguments.length),u(this,ue,"f").addHandler(e,t,n,r,s,o),this}commands(e,t,n,r,s,o){return this.command(e,t,n,r,s,o)}commandDir(e,t){I("<string> [object]",[e,t],arguments.length);const n=u(this,ln,"f")||u(this,T,"f").require;return u(this,ue,"f").addDirectory(e,n,u(this,T,"f").getCallerFile(),t),this}count(e){return I("<array|string>",[e],arguments.length),this[Ze]("count",e),this[Ct](e),this}default(e,t,n){return I("<object|string|array> [*] [string]",[e,t,n],arguments.length),n&&(Gi(e,u(this,T,"f")),u(this,L,"f").defaultDescription[e]=n),typeof t=="function"&&(Gi(e,u(this,T,"f")),u(this,L,"f").defaultDescription[e]||(u(this,L,"f").defaultDescription[e]=u(this,U,"f").functionDescription(t)),t=t.call()),this[Ot](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,r){return I("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,r],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),u(this,L,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:r},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(r=>{ke(n,!0,u(this,T,"f")),this.demandOption(r,n)}),t=1/0):typeof t!="number"&&(n=t,t=1/0),typeof e=="number"?(ke(n,!0,u(this,T,"f")),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(r=>{ke(n,!0,u(this,T,"f")),this.demandOption(r,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return I("<object|string|array> [string]",[e,t],arguments.length),this[Ot](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return I("<string> [string|boolean]",[e,t],arguments.length),u(this,L,"f").deprecatedOptions[e]=t,this}describe(e,t){return I("<object|string|array> [string]",[e,t],arguments.length),this[qn](e,!0),u(this,U,"f").describe(e,t),this}detectLocale(e){return I("<boolean>",[e],arguments.length),_(this,lt,e,"f"),this}env(e){return I("[string|boolean]",[e],arguments.length),e===!1?delete u(this,L,"f").envPrefix:u(this,L,"f").envPrefix=e||"",this}epilogue(e){return I("<string>",[e],arguments.length),u(this,U,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return I("<string|array> [string]",[e,t],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):u(this,U,"f").example(e,t),this}exit(e,t){_(this,Fe,!0,"f"),_(this,Qe,t,"f"),u(this,Oe,"f")&&u(this,T,"f").process.exit(e)}exitProcess(e=!0){return I("[boolean]",[e],arguments.length),_(this,Oe,e,"f"),this}fail(e){if(I("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new fe("Invalid first argument. Expected function or boolean 'false'");return u(this,U,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return I("<array> [function]",[e,t],arguments.length),t?u(this,Be,"f").getCompletion(e,t):new Promise((n,r)=>{u(this,Be,"f").getCompletion(e,(s,o)=>{s?r(s):n(o)})})}getDemandedOptions(){return I([],0),u(this,L,"f").demandedOptions}getDemandedCommands(){return I([],0),u(this,L,"f").demandedCommands}getDeprecatedOptions(){return I([],0),u(this,L,"f").deprecatedOptions}getDetectLocale(){return u(this,lt,"f")}getExitProcess(){return u(this,Oe,"f")}getGroups(){return Object.assign({},u(this,Re,"f"),u(this,dt,"f"))}getHelp(){if(_(this,Fe,!0,"f"),!u(this,U,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[zt](u(this,Xe,"f"),void 0,void 0,0,!0);if(le(t))return t.then(()=>u(this,U,"f").help())}const e=u(this,ue,"f").runDefaultBuilderOn(this);if(le(e))return e.then(()=>u(this,U,"f").help())}return Promise.resolve(u(this,U,"f").help())}getOptions(){return u(this,L,"f")}getStrict(){return u(this,ht,"f")}getStrictCommands(){return u(this,pt,"f")}getStrictOptions(){return u(this,mt,"f")}global(e,t){return I("<string|array> [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1?u(this,L,"f").local=u(this,L,"f").local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{u(this,L,"f").local.includes(n)||u(this,L,"f").local.push(n)}),this}group(e,t){I("<string|array> <string>",[e,t],arguments.length);const n=u(this,dt,"f")[t]||u(this,Re,"f")[t];u(this,dt,"f")[t]&&delete u(this,dt,"f")[t];const r={};return u(this,Re,"f")[t]=(n||[]).concat(e).filter(s=>r[s]?!1:r[s]=!0),this}hide(e){return I("<string>",[e],arguments.length),u(this,L,"f").hiddenOptions.push(e),this}implies(e,t){return I("<string|object> [number|string|array]",[e,t],arguments.length),u(this,se,"f").implies(e,t),this}locale(e){return I("[string]",[e],arguments.length),e===void 0?(this[Vn](),u(this,T,"f").y18n.getLocale()):(_(this,lt,!1,"f"),u(this,T,"f").y18n.setLocale(e),this)}middleware(e,t,n){return u(this,_e,"f").addMiddleware(e,!!t,n)}nargs(e,t){return I("<string|object|array> [number]",[e,t],arguments.length),this[Ot](this.nargs.bind(this),"narg",e,t),this}normalize(e){return I("<array|string>",[e],arguments.length),this[Ze]("normalize",e),this}number(e){return I("<array|string>",[e],arguments.length),this[Ze]("number",e),this[Ct](e),this}option(e,t){if(I("<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[Ct](e),u(this,Ue,"f")&&(e==="version"||t?.alias==="version")&&this[tr](['"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"),u(this,L,"f").key[e]=!0,t.alias&&this.alias(e,t.alias);const n=t.deprecate||t.deprecated;n&&this.deprecateOption(e,n);const r=t.demand||t.required||t.require;r&&this.demand(e,r),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&&(u(this,L,"f").defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);const s=t.describe||t.description||t.desc,o=u(this,U,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(o,e)||typeof s=="string")&&this.describe(e,s),t.hidden&&this.hide(e),t.requiresArg&&this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){I("[string|array] [function|boolean|object] [function]",[e,t,n],arguments.length),this[nr](),typeof e>"u"&&(e=u(this,Xe,"f")),typeof t=="object"&&(_(this,ft,t,"f"),t=n),typeof t=="function"&&(_(this,ye,t,"f"),t=!1),t||_(this,Xe,e,"f"),u(this,ye,"f")&&_(this,Oe,!1,"f");const r=this[zt](e,!!t),s=this.parsed;return u(this,Be,"f").setParsed(this.parsed),le(r)?r.then(o=>(u(this,ye,"f")&&u(this,ye,"f").call(this,u(this,Qe,"f"),o,u(this,me,"f")),o)).catch(o=>{throw u(this,ye,"f")&&u(this,ye,"f")(o,this.parsed.argv,u(this,me,"f")),o}).finally(()=>{this[Jn](),this.parsed=s}):(u(this,ye,"f")&&u(this,ye,"f").call(this,u(this,Qe,"f"),r,u(this,me,"f")),this[Jn](),this.parsed=s,r)}parseAsync(e,t,n){const r=this.parse(e,t,n);return le(r)?r:Promise.resolve(r)}parseSync(e,t,n){const r=this.parse(e,t,n);if(le(r))throw new fe(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return r}parserConfiguration(e){return I("<object>",[e],arguments.length),_(this,fn,e,"f"),this}pkgConf(e,t){I("<string> [string]",[e,t],arguments.length);let n=null;const r=this[zn](t||u(this,ct,"f"));return r[e]&&typeof r[e]=="object"&&(n=Un(r[e],t||u(this,ct,"f"),this[gt]()["deep-merge-config"]||!1,u(this,T,"f")),u(this,L,"f").configObjects=(u(this,L,"f").configObjects||[]).concat(n)),this}positional(e,t){I("<string> <object>",[e,t],arguments.length);const n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=Rt(t,(o,a)=>o==="type"&&!["string","number","boolean"].includes(a)?!1:n.includes(o));const r=u(this,Vt,"f").fullCommands[u(this,Vt,"f").fullCommands.length-1],s=r?u(this,ue,"f").cmdToParseOptions(r):{array:[],alias:{},default:{},demand:{}};return rn(s).forEach(o=>{const a=s[o];Array.isArray(a)?a.indexOf(e)!==-1&&(t[o]=!0):a[e]&&!(o in t)&&(t[o]=a[e])}),this.group(e,u(this,U,"f").getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return I("[boolean]",[e],arguments.length),_(this,dn,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 I("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&u(this,L,"f").narg[e]?this:(this[Ot](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,t){return I("[string] [string]",[e,t],arguments.length),e=e||this.$0,u(this,vt,"f").log(u(this,Be,"f").generateCompletionScript(e,t||u(this,be,"f")||"completion")),this}showHelp(e){if(I("[string|function]",[e],arguments.length),_(this,Fe,!0,"f"),!u(this,U,"f").hasCachedHelpMessage()){if(!this.parsed){const n=this[zt](u(this,Xe,"f"),void 0,void 0,0,!0);if(le(n))return n.then(()=>{u(this,U,"f").showHelp(e)}),this}const t=u(this,ue,"f").runDefaultBuilderOn(this);if(le(t))return t.then(()=>{u(this,U,"f").showHelp(e)}),this}return u(this,U,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return I("[boolean|string] [string]",[e,t],arguments.length),u(this,U,"f").showHelpOnFail(e,t),this}showVersion(e){return I("[string|function]",[e],arguments.length),u(this,U,"f").showVersion(e),this}skipValidation(e){return I("<array|string>",[e],arguments.length),this[Ze]("skipValidation",e),this}strict(e){return I("[boolean]",[e],arguments.length),_(this,ht,e!==!1,"f"),this}strictCommands(e){return I("[boolean]",[e],arguments.length),_(this,pt,e!==!1,"f"),this}strictOptions(e){return I("[boolean]",[e],arguments.length),_(this,mt,e!==!1,"f"),this}string(e){return I("<array|string>",[e],arguments.length),this[Ze]("string",e),this[Ct](e),this}terminalWidth(){return I([],0),u(this,T,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return I("<object>",[e],arguments.length),_(this,lt,!1,"f"),u(this,T,"f").y18n.updateLocale(e),this}usage(e,t,n,r){if(I("<string|null|undefined> [string|boolean] [function|object] [function]",[e,t,n,r],arguments.length),t!==void 0){if(ke(e,null,u(this,T,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,r);throw new fe(".usage() description must start with $0 if being used as alias for .command()")}else return u(this,U,"f").usage(e),this}usageConfiguration(e){return I("<object>",[e],arguments.length),_(this,hn,e,"f"),this}version(e,t,n){const r="version";if(I("[boolean|string] [string] [string]",[e,t,n],arguments.length),u(this,Ue,"f")&&(this[Wn](u(this,Ue,"f")),u(this,U,"f").version(void 0),_(this,Ue,null,"f")),arguments.length===0)n=this[sr](),e=r;else if(arguments.length===1){if(e===!1)return this;n=e,e=r}else arguments.length===2&&(n=t,t=void 0);return _(this,Ue,typeof e=="string"?e:r,"f"),t=t||u(this,U,"f").deferY18nLookup("Show version number"),u(this,U,"f").version(n||void 0),this.boolean(u(this,Ue,"f")),this.describe(u(this,Ue,"f"),t),this}wrap(e){return I("<number|null|undefined>",[e],arguments.length),u(this,U,"f").wrap(e),this}[(ue=new WeakMap,ct=new WeakMap,Vt=new WeakMap,Be=new WeakMap,be=new WeakMap,on=new WeakMap,Qe=new WeakMap,lt=new WeakMap,un=new WeakMap,Oe=new WeakMap,an=new WeakMap,_e=new WeakMap,Re=new WeakMap,Fe=new WeakMap,Se=new WeakMap,cn=new WeakMap,vt=new WeakMap,me=new WeakMap,L=new WeakMap,ln=new WeakMap,fn=new WeakMap,ye=new WeakMap,ft=new WeakMap,Bt=new WeakMap,dt=new WeakMap,Xe=new WeakMap,dn=new WeakMap,T=new WeakMap,ht=new WeakMap,pt=new WeakMap,mt=new WeakMap,U=new WeakMap,hn=new WeakMap,Ue=new WeakMap,se=new WeakMap,Zi)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[er](){return{log:(...e)=>{this[pn]()||console.log(...e),_(this,Fe,!0,"f"),u(this,me,"f").length&&_(this,me,u(this,me,"f")+`
64
+ `,"f"),_(this,me,u(this,me,"f")+e.join(" "),"f")},error:(...e)=>{this[pn]()||console.error(...e),_(this,Fe,!0,"f"),u(this,me,"f").length&&_(this,me,u(this,me,"f")+`
65
+ `,"f"),_(this,me,u(this,me,"f")+e.join(" "),"f")}}}[Wn](e){rn(u(this,L,"f")).forEach(t=>{if((r=>r==="configObjects")(t))return;const n=u(this,L,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete u(this,U,"f").getDescriptions()[e]}[tr](e,t,n){u(this,un,"f")[n]||(u(this,T,"f").process.emitWarning(e,t),u(this,un,"f")[n]=!0)}[nr](){u(this,an,"f").push({options:u(this,L,"f"),configObjects:u(this,L,"f").configObjects.slice(0),exitProcess:u(this,Oe,"f"),groups:u(this,Re,"f"),strict:u(this,ht,"f"),strictCommands:u(this,pt,"f"),strictOptions:u(this,mt,"f"),completionCommand:u(this,be,"f"),output:u(this,me,"f"),exitError:u(this,Qe,"f"),hasOutput:u(this,Fe,"f"),parsed:this.parsed,parseFn:u(this,ye,"f"),parseContext:u(this,ft,"f")}),u(this,U,"f").freeze(),u(this,se,"f").freeze(),u(this,ue,"f").freeze(),u(this,_e,"f").freeze()}[ir](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(u(this,T,"f").process.argv()[0])?t=u(this,T,"f").process.argv().slice(1,2):t=u(this,T,"f").process.argv().slice(0,1),e=t.map(n=>{const r=this[gr](u(this,ct,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&r.length<n.length?r:n}).join(" ").trim(),u(this,T,"f").getEnv("_")&&u(this,T,"f").getProcessArgvBin()===u(this,T,"f").getEnv("_")&&(e=u(this,T,"f").getEnv("_").replace(`${u(this,T,"f").path.dirname(u(this,T,"f").process.execPath())}/`,"")),e}[gt](){return u(this,fn,"f")}[rr](){return u(this,hn,"f")}[Vn](){if(!u(this,lt,"f"))return;const e=u(this,T,"f").getEnv("LC_ALL")||u(this,T,"f").getEnv("LC_MESSAGES")||u(this,T,"f").getEnv("LANG")||u(this,T,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[sr](){return this[zn]().version||"unknown"}[or](e){const t=e["--"]?e["--"]:e._;for(let n=0,r;(r=t[n])!==void 0;n++)u(this,T,"f").Parser.looksLikeNumber(r)&&Number.isSafeInteger(Math.floor(parseFloat(`${r}`)))&&(t[n]=Number(r));return e}[zn](e){const t=e||"*";if(u(this,Bt,"f")[t])return u(this,Bt,"f")[t];let n={};try{let r=e||u(this,T,"f").mainFilename;!e&&u(this,T,"f").path.extname(r)&&(r=u(this,T,"f").path.dirname(r));const s=u(this,T,"f").findUp(r,(o,a)=>{if(a.includes("package.json"))return"package.json"});ke(s,void 0,u(this,T,"f")),n=JSON.parse(u(this,T,"f").readFileSync(s,"utf8"))}catch{}return u(this,Bt,"f")[t]=n||{},u(this,Bt,"f")[t]}[Ze](e,t){t=[].concat(t),t.forEach(n=>{n=this[Yn](n),u(this,L,"f")[e].push(n)})}[Ot](e,t,n,r){this[Gn](e,t,n,r,(s,o,a)=>{u(this,L,"f")[s][o]=a})}[Hn](e,t,n,r){this[Gn](e,t,n,r,(s,o,a)=>{u(this,L,"f")[s][o]=(u(this,L,"f")[s][o]||[]).concat(a)})}[Gn](e,t,n,r,s){if(Array.isArray(n))n.forEach(o=>{e(o,r)});else if((o=>typeof o=="object")(n))for(const o of rn(n))e(o,n[o]);else s(t,this[Yn](n),r)}[Yn](e){return e==="__proto__"?"___proto___":e}[qn](e,t){return this[Ot](this[qn].bind(this),"key",e,t),this}[Jn](){var e,t,n,r,s,o,a,c,h,l,f,p;const C=u(this,an,"f").pop();ke(C,void 0,u(this,T,"f"));let F;e=this,t=this,n=this,r=this,s=this,o=this,a=this,c=this,h=this,l=this,f=this,p=this,{options:{set value(w){_(e,L,w,"f")}}.value,configObjects:F,exitProcess:{set value(w){_(t,Oe,w,"f")}}.value,groups:{set value(w){_(n,Re,w,"f")}}.value,output:{set value(w){_(r,me,w,"f")}}.value,exitError:{set value(w){_(s,Qe,w,"f")}}.value,hasOutput:{set value(w){_(o,Fe,w,"f")}}.value,parsed:this.parsed,strict:{set value(w){_(a,ht,w,"f")}}.value,strictCommands:{set value(w){_(c,pt,w,"f")}}.value,strictOptions:{set value(w){_(h,mt,w,"f")}}.value,completionCommand:{set value(w){_(l,be,w,"f")}}.value,parseFn:{set value(w){_(f,ye,w,"f")}}.value,parseContext:{set value(w){_(p,ft,w,"f")}}.value}=C,u(this,L,"f").configObjects=F,u(this,U,"f").unfreeze(),u(this,se,"f").unfreeze(),u(this,ue,"f").unfreeze(),u(this,_e,"f").unfreeze()}[ur](e,t){return Tt(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[ar].bind(this),getContext:this[cr].bind(this),getHasOutput:this[lr].bind(this),getLoggerInstance:this[fr].bind(this),getParseContext:this[dr].bind(this),getParserConfiguration:this[gt].bind(this),getUsageConfiguration:this[rr].bind(this),getUsageInstance:this[hr].bind(this),getValidationInstance:this[pr].bind(this),hasParseCallback:this[pn].bind(this),isGlobalContext:this[mr].bind(this),postProcess:this[Dt].bind(this),reset:this[Kn].bind(this),runValidation:this[Qn].bind(this),runYargsParserAndExecuteCommands:this[zt].bind(this),setHasOutput:this[Dr].bind(this)}}[ar](){return u(this,ue,"f")}[cr](){return u(this,Vt,"f")}[lr](){return u(this,Fe,"f")}[fr](){return u(this,vt,"f")}[dr](){return u(this,ft,"f")||{}}[hr](){return u(this,U,"f")}[pr](){return u(this,se,"f")}[pn](){return!!u(this,ye,"f")}[mr](){return u(this,cn,"f")}[Dt](e,t,n,r){return n||le(e)||(t||(e=this[Zi](e)),(this[gt]()["parse-positional-numbers"]||this[gt]()["parse-positional-numbers"]===void 0)&&(e=this[or](e)),r&&(e=Mt(e,this,u(this,_e,"f").getMiddleware(),!1))),e}[Kn](e={}){_(this,L,u(this,L,"f")||{},"f");const t={};t.local=u(this,L,"f").local||[],t.configObjects=u(this,L,"f").configObjects||[];const n={};t.local.forEach(o=>{n[o]=!0,(e[o]||[]).forEach(a=>{n[a]=!0})}),Object.assign(u(this,dt,"f"),Object.keys(u(this,Re,"f")).reduce((o,a)=>{const c=u(this,Re,"f")[a].filter(h=>!(h in n));return c.length>0&&(o[a]=c),o},{})),_(this,Re,{},"f");const r=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return r.forEach(o=>{t[o]=(u(this,L,"f")[o]||[]).filter(a=>!n[a])}),s.forEach(o=>{t[o]=Rt(u(this,L,"f")[o],a=>!n[a])}),t.envPrefix=u(this,L,"f").envPrefix,_(this,L,t,"f"),_(this,U,u(this,U,"f")?u(this,U,"f").reset(n):bo(this,u(this,T,"f")),"f"),_(this,se,u(this,se,"f")?u(this,se,"f").reset(n):Io(this,u(this,U,"f"),u(this,T,"f")),"f"),_(this,ue,u(this,ue,"f")?u(this,ue,"f").reset():Do(u(this,U,"f"),u(this,se,"f"),u(this,_e,"f"),u(this,T,"f")),"f"),u(this,Be,"f")||_(this,Be,Oo(this,u(this,U,"f"),u(this,ue,"f"),u(this,T,"f")),"f"),u(this,_e,"f").reset(),_(this,be,null,"f"),_(this,me,"","f"),_(this,Qe,null,"f"),_(this,Fe,!1,"f"),this.parsed=!1,this}[gr](e,t){return u(this,T,"f").path.relative(e,t)}[zt](e,t,n,r=0,s=!1){let o=!!n||s;e=e||u(this,Xe,"f"),u(this,L,"f").__=u(this,T,"f").y18n.__,u(this,L,"f").configuration=this[gt]();const a=!!u(this,L,"f").configuration["populate--"],c=Object.assign({},u(this,L,"f").configuration,{"populate--":!0}),h=u(this,T,"f").Parser.detailed(e,Object.assign({},u(this,L,"f"),{configuration:{"parse-positional-numbers":!1,...c}})),l=Object.assign(h.argv,u(this,ft,"f"));let f;const p=h.aliases;let C=!1,F=!1;Object.keys(l).forEach(w=>{w===u(this,Se,"f")&&l[w]?C=!0:w===u(this,Ue,"f")&&l[w]&&(F=!0)}),l.$0=this.$0,this.parsed=h,r===0&&u(this,U,"f").clearCachedHelpMessage();try{if(this[Vn](),t)return this[Dt](l,a,!!n,!1);u(this,Se,"f")&&[u(this,Se,"f")].concat(p[u(this,Se,"f")]||[]).filter(R=>R.length>1).includes(""+l._[l._.length-1])&&(l._.pop(),C=!0),_(this,cn,!1,"f");const w=u(this,ue,"f").getCommands(),m=u(this,Be,"f").completionKey in l,y=C||m||s;if(l._.length){if(w.length){let S;for(let R=r||0,N;l._[R]!==void 0;R++)if(N=String(l._[R]),w.includes(N)&&N!==u(this,be,"f")){const W=u(this,ue,"f").runCommand(N,this,h,R+1,s,C||F||s);return this[Dt](W,a,!!n,!1)}else if(!S&&N!==u(this,be,"f")){S=N;break}!u(this,ue,"f").hasDefaultCommand()&&u(this,dn,"f")&&S&&!y&&u(this,se,"f").recommendCommands(S,w)}u(this,be,"f")&&l._.includes(u(this,be,"f"))&&!m&&(u(this,Oe,"f")&&Ut(!0),this.showCompletionScript(),this.exit(0))}if(u(this,ue,"f").hasDefaultCommand()&&!y){const S=u(this,ue,"f").runCommand(null,this,h,0,s,C||F||s);return this[Dt](S,a,!!n,!1)}if(m){u(this,Oe,"f")&&Ut(!0),e=[].concat(e);const S=e.slice(e.indexOf(`--${u(this,Be,"f").completionKey}`)+1);return u(this,Be,"f").getCompletion(S,(R,N)=>{if(R)throw new fe(R.message);(N||[]).forEach(W=>{u(this,vt,"f").log(W)}),this.exit(0)}),this[Dt](l,!a,!!n,!1)}if(u(this,Fe,"f")||(C?(u(this,Oe,"f")&&Ut(!0),o=!0,this.showHelp("log"),this.exit(0)):F&&(u(this,Oe,"f")&&Ut(!0),o=!0,u(this,U,"f").showVersion("log"),this.exit(0))),!o&&u(this,L,"f").skipValidation.length>0&&(o=Object.keys(l).some(S=>u(this,L,"f").skipValidation.indexOf(S)>=0&&l[S]===!0)),!o){if(h.error)throw new fe(h.error.message);if(!m){const S=this[Qn](p,{},h.error);n||(f=Mt(l,this,u(this,_e,"f").getMiddleware(),!0)),f=this[ur](S,f??l),le(f)&&!n&&(f=f.then(()=>Mt(l,this,u(this,_e,"f").getMiddleware(),!1)))}}}catch(w){if(w instanceof fe)u(this,U,"f").fail(w.message,w);else throw w}return this[Dt](f??l,a,!!n,!0)}[Qn](e,t,n,r){const s={...this.getDemandedOptions()};return o=>{if(n)throw new fe(n.message);u(this,se,"f").nonOptionCount(o),u(this,se,"f").requiredArguments(o,s);let a=!1;u(this,pt,"f")&&(a=u(this,se,"f").unknownCommands(o)),u(this,ht,"f")&&!a?u(this,se,"f").unknownArguments(o,e,t,!!r):u(this,mt,"f")&&u(this,se,"f").unknownArguments(o,e,{},!1,!1),u(this,se,"f").limitedChoices(o),u(this,se,"f").implications(o),u(this,se,"f").conflicting(o)}}[Dr](){_(this,Fe,!0,"f")}[Ct](e){if(typeof e=="string")u(this,L,"f").key[e]=!0;else for(const t of e)u(this,L,"f").key[t]=!0}}function No(i){return!!i&&typeof i.getInternalMethods=="function"}const ko=Lo(co),mn={type:"string",desc:"<directory> with LikeC4 sources (default is current directory)",normalize:!0,default:".",coerce:J},Me={alias:"use-dot-bin",boolean:!0,type:"boolean",desc:'use graphviz binaries ("dot" should be on PATH)',default:!1},Cr={boolean:!0,type:"boolean",desc:'use hash history for navigation, e.g. "/#/view" instead of "/view"'},gn={alias:"o",type:"string",desc:"<directory> output directory",normalize:!0,coerce:J},Xn={alias:"w",type:"string",desc:'prefix for Webcomponents, e.g "c4" generates <c4-view ../>',default:"likec4"},wr={alias:["base-url"],type:"string",desc:'base url the app is being served from, e.g. "/" or "/pages/"'},Ar={boolean:!0,type:"boolean",desc:"overview all diagrams as graph [experimental]",default:!1},Er=i=>i instanceof URL?Ii(i):i;function Mo(i,{cwd:e=Bi.cwd(),type:t="file",stopAt:n}={}){let r=Ft.resolve(Er(e)??"");const{root:s}=Ft.parse(r);for(n=Ft.resolve(r,Er(n)??s);r&&r!==n&&r!==s;){const o=Ft.isAbsolute(i)?i:Ft.join(r,i);try{const a=ys.statSync(o,{throwIfNoEntry:!1});if(t==="file"&&a?.isFile()||t==="directory"&&a?.isDirectory())return o}catch{}r=Ft.dirname(r)}}function To({cwd:i=Bi.cwd()}={}){return Mo("package.json",{cwd:i})}const Dn=ot(Ii(import.meta.url)),Ro=`
66
+ /* prettier-ignore-start */
67
+ /* eslint-disable */
68
+
69
+ /******************************************************************************
70
+ * This file was generated
71
+ * DO NOT EDIT MANUALLY!
72
+ ******************************************************************************/
73
+
74
+ `.trimStart(),Uo=`
75
+
76
+ /* prettier-ignore-end */
77
+ `,Zn={banner:Ro,footer:Uo};function br(){const i=To({cwd:Dn});if(!i)throw new Error("likec4 package folder not found");return ot(i)}function ei(){const i=br(),e=[J(i,"__app__"),J(Dn,"../__app__"),J(Dn,"../../__app__"),J(Dn,"../../dist/__app__")],t=Jr(e,Ke);if(!t)throw De.error(`likec4 app root does not exist, tried:
78
+ ${e.join(`
79
+ `)}`),new Error("likec4 app root does not exist");return t}async function ti(){const i=await Zt(It(en(),".likec4-public-"));return await at(It(i,"likec4-views.js"),`// generated by likec4
80
+ `),i}const ni=1e4;function Fr(){const i=br();return{"likec4/icons":J(i,"icons"),"likec4/react":J(i,"react"),"likec4/model":J(i,"dist/model")}}function Wo(i){var e,t;if(i){if("astNode"in i)return Ho(i);if(Array.isArray(i))return i.reduce(yr,void 0);{const n=i,r=Vo(n)?zo((t=(e=n?.root)===null||e===void 0?void 0:e.astNode)!==null&&t!==void 0?t:n?.astNode):void 0;return _t(n,r)}}else return}function Vo(i){return typeof i<"u"&&"element"in i&&"text"in i}function zo(i){try{return Di(i).uri.toString()}catch{return}}function Ho(i){var e,t;const{astNode:n,property:r,index:s}=i??{},o=(e=n?.$cstNode)!==null&&e!==void 0?e:n?.$textRegion;if(!(n===void 0||o===void 0)){if(r===void 0)return _t(o,ii(n));{const a=c=>s!==void 0&&s>-1&&Array.isArray(n[r])?s<c.length?c[s]:void 0:c.reduce(yr,void 0);if(!((t=o.assignments)===null||t===void 0)&&t[r]){const c=a(o.assignments[r]);return c&&_t(c,ii(n))}else if(n.$cstNode){const c=a(Kr(n.$cstNode,r));return c&&_t(c,ii(n))}else return}}}function ii(i){var e,t,n,r;return i.$cstNode?(t=(e=Di(i))===null||e===void 0?void 0:e.uri)===null||t===void 0?void 0:t.toString():i.$textRegion?i.$textRegion.documentURI||((r=(n=new Qr(i,s=>s.$container?[s.$container]:[]).find(s=>{var o;return(o=s.$textRegion)===null||o===void 0?void 0:o.documentURI}))===null||n===void 0?void 0:n.$textRegion)===null||r===void 0?void 0:r.documentURI):void 0}function _t(i,e){var t,n;const r={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&&(r.range=i.range),e??(e=i.fileURI),e&&(r.fileURI=e),r}function yr(i,e){var t,n;if(i){if(!e)return i&&_t(i)}else return e&&_t(e);const r=(t=i.end)!==null&&t!==void 0?t:i.offset+i.length,s=(n=e.end)!==null&&n!==void 0?n:e.offset+e.length,o=Math.min(i.offset,e.offset),a=Math.max(r,s),c=a-o,h={offset:o,end:a,length:c};if(i.range&&e.range&&(h.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 l=i.fileURI,f=e.fileURI,p=l&&f&&l!==f?`<unmergable text regions of ${l}, ${f}>`:l??f;h.fileURI=p}return h}class Go{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=Yo(e,this.currentPosition,n=>{var r,s;return(s=(r=this.traceData[this.traceData.length-1])===null||r===void 0?void 0:r.children)===null||s===void 0?void 0:s.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 Yo(i,e,t){const n={sourceRegion:i,targetRegion:void 0,children:[],targetStart:e,complete:r=>{var s,o;return n.targetRegion={offset:n.targetStart.offset,end:r.offset,length:r.offset-n.targetStart.offset,range:{start:{line:n.targetStart.line,character:n.targetStart.character},end:{line:r.line,character:r.character}}},delete n.targetStart,((s=n.children)===null||s===void 0?void 0:s.length)===0&&delete n.children,!((o=n.targetRegion)===null||o===void 0)&&o.length&&t(n),delete n.complete,n}};return n}function qo(i,e){const t=new Go(e),n=t.pushTraceRegion(void 0);vr(i,t),t.popTraceRegion(n),n.complete&&n.complete(t.currentPosition);const r=n.children&&n.children.length===1?n.children[0]:void 0,s=r?.targetRegion,o=n.targetRegion;return s&&r.sourceRegion&&s.offset===o.offset&&s.length===o.length?{text:t.content,trace:r}:{text:t.content,trace:n}}function vr(i,e){typeof i=="string"?Jo(i,e):i instanceof si?Ko(i,e):i instanceof ce?_r(i,e):i instanceof Gt&&Qo(i,e)}function Br(i,e){return typeof i=="string"?i.length!==0:i instanceof ce?i.contents.some(t=>Br(t,e)):i instanceof Gt?!(i.ifNotEmpty&&e.currentLineContent.length===0):!1}function Jo(i,e){i&&(e.pendingIndent&&Or(e,!1),e.append(i))}function Or(i,e){var t;let n="";for(const r of i.relevantIndents.filter(s=>s.indentEmptyLines||!e))n+=(t=r.indentation)!==null&&t!==void 0?t:i.defaultIndentation;i.append(n,!0),i.pendingIndent=!1}function _r(i,e){let t;const n=Wo(i.tracedSource);n&&(t=e.pushTraceRegion(n));for(const r of i.contents)vr(r,e);if(t){e.popTraceRegion(t);const r=e.getParentTraceSourceFileURI();r&&n?.fileURI===r&&delete n.fileURI,t.complete&&t.complete(e.currentPosition)}}function Ko(i,e){var t;if(Br(i,e)){i.indentImmediately&&!e.pendingIndent&&e.append((t=i.indentation)!==null&&t!==void 0?t:e.defaultIndentation,!0);try{e.increaseIndent(i),_r(i,e)}finally{e.decreaseIndent()}}}function Qo(i,e){i.ifNotEmpty&&!Xo(e.currentLineContent)?e.resetCurrentLine():(e.pendingIndent&&Or(e,!0),e.append(i.lineDelimiter),e.addNewLine())}function Xo(i){return i.trimStart()!==""}Object.freeze("__\xABSKIP^NEW^LINE^IF^EMPTY\xBB__");const Zo=/\S|$/;function eu(i){const e=i.filter(n=>n.length>0).map(n=>n.search(Zo)),t=e.length===0?0:Math.min(...e);return Math.max(0,t)}function et(i,...e){const t=nu(i),n=iu(i,e,t);return su(n)}function tu(i,e,t){return(n,...r)=>uu(i,e,t)(et(n,...r))}function nu(i){const e=i.join("_").split(Ci),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 r=t?e.slice(1):e;r=n?r.slice(0,r.length-1):r,r=r.filter(o=>o.length!==0);const s=eu(r);return{indentation:s,omitFirstLine:t,omitLastLine:n&&(e[e.length-1].length<s||!e[e.length-1].startsWith(r[0].substring(0,s)))}}}function iu(i,e,{indentation:t,omitFirstLine:n,omitLastLine:r,trimLastLine:s}){const o=[];i.forEach((h,l)=>{o.push(...h.split(Ci).map((f,p)=>p===0||f.length<t?f:f.substring(t)).reduce(l===0?(f,p,C)=>C===0?n?[]:[p]:C===1&&f.length===0?[p]:f.concat(Cn,p):(f,p,C)=>C===0?[p]:f.concat(Cn,p),[]).filter(f=>!(typeof f=="string"&&f.length===0)).concat(Ht(e[l])?e[l]:e[l]!==void 0?{content:String(e[l])}:l<e.length?Sr:[]))});const a=o.length,c=a!==0?o[a-1]:void 0;return(r||s)&&typeof c=="string"&&c.trim().length===0?n&&a!==1&&o[a-2]===Cn?o.slice(0,a-2):o.slice(0,a-1):o}const Cn={isNewLine:!0},Sr={isUndefinedSegment:!0},$r=i=>i===Cn,ri=i=>i===Sr,ru=i=>i.content!==void 0;function su(i){return i.reduce((t,n,r)=>ri(n)?t:$r(n)?{node:r!==0&&(ri(i[r-1])||Ht(i[r-1]))||r>1&&typeof i[r-1]=="string"&&(ri(i[r-2])||Ht(i[r-2]))?t.node.appendNewLineIfNotEmpty():t.node.appendNewLine()}:(()=>{var s;const o=(r===0||$r(i[r-1]))&&typeof n=="string"&&n.length!==0?"".padStart(n.length-n.trimStart().length):"",a=ru(n)?n.content:n;let c;return{node:t.indented?t.node:o.length!==0?t.node.indent({indentation:o,indentImmediately:!1,indentedChildren:h=>c=h.append(a)}):t.node.append(a),indented:c??((s=t.indented)===null||s===void 0?void 0:s.append(a))}})(),{node:new ce}).node}const ou=typeof process>"u"?`
66
81
  `:process.platform==="win32"?`\r
67
82
  `:`
68
- `;function zt(i){return i instanceof ce||i instanceof ei||i instanceof Ht}function tt(i,e){return zt(i)?Mu(i,e).text:String(i)}class ce{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,t,n){if(Yr(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(G)}appendNewLineIf(e){return e?this.append(G):this}appendNewLineIfNotEmpty(){return this.append(Qu)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...t){return this.append(et(e,...t))}appendTemplateIf(e){return e?(t,...n)=>this.appendTemplate(t,...n):()=>this}indent(e){const{indentedChildren:t,indentation:n,indentEmptyLines:r,indentImmediately:s}=Array.isArray(e)||typeof e=="function"?{indentedChildren:e}:typeof e=="object"?e:{},u=new ei(n,s,r);return this.contents.push(u),Array.isArray(t)?u.append(...t):t&&u.append(t),this}appendTraced(e,t,n){return r=>this.append(new ce().trace(e,t,n).append(r))}appendTracedIf(e,t,n,r){return e?this.appendTraced(typeof t=="function"?t():t,n,r):()=>this}appendTracedTemplate(e,t,n){return(r,...s)=>this.append(zu(e,t,n)(r,...s))}appendTracedTemplateIf(e,t,n,r){return e?this.appendTracedTemplate(typeof t=="function"?t():t,n,r):()=>this}}function Ku(i,e,t){return n=>n instanceof ce&&n.tracedSource===void 0?n.trace(i,e,t):new ce().trace(i,e,t).append(n)}class ei extends ce{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 Ht{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??Ju,this.ifNotEmpty=t}}const G=new Ht,Qu=new Ht(void 0,!0),Or=i=>i===void 0||typeof i=="string"||zt(i)?i:String(i);function Ie(i,e=Or,t={}){const n=typeof e=="function"?e:Or,{filter:r,prefix:s,suffix:u,separator:a,appendNewLineIfNotEmpty:c,skipNewLineAfterLastItem:h}=typeof e=="object"?e:t,l=typeof s=="function"?s:()=>s,f=typeof u=="function"?u:()=>u;return Xu(i,(p,C,F,w)=>{if(r&&!r(C,F,w))return p;const m=n(C,F,w);return m===void 0?p:(p??(p=new ce)).append(l(C,F,w)).append(m).append(f(C,F,w)).appendIf(!w,a).appendNewLineIfNotEmptyIf(!p.isEmpty()&&!!c&&(!w||!h))})}function Xu(i,e,t){const n=i[Symbol.iterator]();let r=n.next(),s=0,u=t;for(;!r.done;){const a=n.next();u=e(u,r.value,s,!!a.done),r=a,s++}return u}const Zu=i=>i.charAt(0).toLocaleUpperCase()+i.slice(1),eo=i=>i.split(".").map(Zu).join(""),to=i=>eo(i.parent?i.id.slice(i.parent.length+1):i.id),no=({autoLayout:i})=>{switch(i.direction){case"TB":return"down";case"BT":return"up";case"LR":return"right";case"RL":return"left"}},io=({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 _r(i){const{nodes:e,edges:t}=i,n=new Map,r=(u,a)=>{const c=to(u),h=(a?a+".":"")+c;n.set(u.id,h);const l=JSON.stringify(u.title),f=io(u);return new ce().append(c,": {",G).indent({indentedChildren:p=>p.append("label: ",l,G).appendIf(f!=="rectangle","shape: ",f,G).appendIf(u.children.length>0,G,Ie(e.filter(C=>C.parent===u.id),C=>r(C,h))),indentation:2}).append("}",G)},s=u=>new ce().append(n.get(u.source)," -> ",n.get(u.target)).append(a=>u.label&&a.append(": ",JSON.stringify(u.label)));return tt(new ce().append("direction: ",no(i),G,G).append(Ie(e.filter(u=>wi(u.parent)),u=>r(u),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,G,Ie(t,u=>s(u),{appendNewLineIfNotEmpty:!0})))}const ro=i=>i.charAt(0).toLocaleUpperCase()+i.slice(1),so=i=>i.split(".").map(ro).join(""),uo=i=>so(i.parent?i.id.slice(i.parent.length+1):i.id),oo=({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 Sr(i){const{nodes:e,edges:t}=i,n=new Map,r=(u,a)=>{const c=uo(u),h=(a?a+".":"")+c;n.set(u.id,h);const l=u.title.replaceAll(`
69
- `,"\\n"),f=oo(u),p=new ce;return u.children.length>0?p.append("subgraph ",h,"[",JSON.stringify(u.title),"]",G).indent({indentedChildren:[Ie(e.filter(C=>C.parent===u.id),C=>r(C,h),{appendNewLineIfNotEmpty:!0})],indentation:2}).append("end",G):p.append(h,f[0],l,f[1]),p},s=u=>new ce().append(n.get(u.source)," -.",u.label?' "'+u.label.replaceAll(`
70
- `,"\\n")+'" .-':"-","> ",n.get(u.target));return tt(new ce().appendIf(i.title!==null&&i.title.length>0,"---",G,`title: ${JSON.stringify(i.title)}`,G,"---",G).append("graph ",i.autoLayout.direction,G).indent({indentedChildren:u=>{u.append(Ie(e.filter(a=>wi(a.parent)),a=>r(a),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,Ie(t,a=>s(a),{appendNewLineIfNotEmpty:!0}))},indentation:2}))}var ao=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,co=/[\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]/,lo=/[\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]/,ti={Space_Separator:ao,ID_Start:co,ID_Continue:lo},ae={isSpaceSeparator(i){return typeof i=="string"&&ti.Space_Separator.test(i)},isIdStartChar(i){return typeof i=="string"&&(i>="a"&&i<="z"||i>="A"&&i<="Z"||i==="$"||i==="_"||ti.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"||ti.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 ni,Ae,Ye,Cn,nt,Te,De,ii,Gt;var fo=function(e,t){ni=String(e),Ae="start",Ye=[],Cn=0,nt=1,Te=0,De=void 0,ii=void 0,Gt=void 0;do De=ho(),go[Ae]();while(De.type!=="eof");return typeof t=="function"?ri({"":Gt},"",t):Gt};function ri(i,e,t){const n=i[e];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let r=0;r<n.length;r++){const s=String(r),u=ri(n,s,t);u===void 0?delete n[s]:Object.defineProperty(n,s,{value:u,writable:!0,enumerable:!0,configurable:!0})}else for(const r in n){const s=ri(n,r,t);s===void 0?delete n[r]:Object.defineProperty(n,r,{value:s,writable:!0,enumerable:!0,configurable:!0})}return t.call(i,e,n)}let H,z,Yt,qe,Y;function ho(){for(H="default",z="",Yt=!1,qe=1;;){Y=Je();const i=Ir[H]();if(i)return i}}function Je(){if(ni[Cn])return String.fromCodePoint(ni.codePointAt(Cn))}function b(){const i=Je();return i===`
71
- `?(nt++,Te=0):i?Te+=i.length:Te++,i&&(Cn+=i.length),i}const Ir={default(){switch(Y){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
72
- `:case"\r":case"\u2028":case"\u2029":b();return;case"/":b(),H="comment";return;case void 0:return b(),Z("eof")}if(ae.isSpaceSeparator(Y)){b();return}return Ir[Ae]()},comment(){switch(Y){case"*":b(),H="multiLineComment";return;case"/":b(),H="singleLineComment";return}throw ee(b())},multiLineComment(){switch(Y){case"*":b(),H="multiLineCommentAsterisk";return;case void 0:throw ee(b())}b()},multiLineCommentAsterisk(){switch(Y){case"*":b();return;case"/":b(),H="default";return;case void 0:throw ee(b())}b(),H="multiLineComment"},singleLineComment(){switch(Y){case`
73
- `:case"\r":case"\u2028":case"\u2029":b(),H="default";return;case void 0:return b(),Z("eof")}b()},value(){switch(Y){case"{":case"[":return Z("punctuator",b());case"n":return b(),Ct("ull"),Z("null",null);case"t":return b(),Ct("rue"),Z("boolean",!0);case"f":return b(),Ct("alse"),Z("boolean",!1);case"-":case"+":b()==="-"&&(qe=-1),H="sign";return;case".":z=b(),H="decimalPointLeading";return;case"0":z=b(),H="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":z=b(),H="decimalInteger";return;case"I":return b(),Ct("nfinity"),Z("numeric",1/0);case"N":return b(),Ct("aN"),Z("numeric",NaN);case'"':case"'":Yt=b()==='"',z="",H="string";return}throw ee(b())},identifierNameStartEscape(){if(Y!=="u")throw ee(b());b();const i=si();switch(i){case"$":case"_":break;default:if(!ae.isIdStartChar(i))throw $r();break}z+=i,H="identifierName"},identifierName(){switch(Y){case"$":case"_":case"\u200C":case"\u200D":z+=b();return;case"\\":b(),H="identifierNameEscape";return}if(ae.isIdContinueChar(Y)){z+=b();return}return Z("identifier",z)},identifierNameEscape(){if(Y!=="u")throw ee(b());b();const i=si();switch(i){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!ae.isIdContinueChar(i))throw $r();break}z+=i,H="identifierName"},sign(){switch(Y){case".":z=b(),H="decimalPointLeading";return;case"0":z=b(),H="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":z=b(),H="decimalInteger";return;case"I":return b(),Ct("nfinity"),Z("numeric",qe*(1/0));case"N":return b(),Ct("aN"),Z("numeric",NaN)}throw ee(b())},zero(){switch(Y){case".":z+=b(),H="decimalPoint";return;case"e":case"E":z+=b(),H="decimalExponent";return;case"x":case"X":z+=b(),H="hexadecimal";return}return Z("numeric",qe*0)},decimalInteger(){switch(Y){case".":z+=b(),H="decimalPoint";return;case"e":case"E":z+=b(),H="decimalExponent";return}if(ae.isDigit(Y)){z+=b();return}return Z("numeric",qe*Number(z))},decimalPointLeading(){if(ae.isDigit(Y)){z+=b(),H="decimalFraction";return}throw ee(b())},decimalPoint(){switch(Y){case"e":case"E":z+=b(),H="decimalExponent";return}if(ae.isDigit(Y)){z+=b(),H="decimalFraction";return}return Z("numeric",qe*Number(z))},decimalFraction(){switch(Y){case"e":case"E":z+=b(),H="decimalExponent";return}if(ae.isDigit(Y)){z+=b();return}return Z("numeric",qe*Number(z))},decimalExponent(){switch(Y){case"+":case"-":z+=b(),H="decimalExponentSign";return}if(ae.isDigit(Y)){z+=b(),H="decimalExponentInteger";return}throw ee(b())},decimalExponentSign(){if(ae.isDigit(Y)){z+=b(),H="decimalExponentInteger";return}throw ee(b())},decimalExponentInteger(){if(ae.isDigit(Y)){z+=b();return}return Z("numeric",qe*Number(z))},hexadecimal(){if(ae.isHexDigit(Y)){z+=b(),H="hexadecimalInteger";return}throw ee(b())},hexadecimalInteger(){if(ae.isHexDigit(Y)){z+=b();return}return Z("numeric",qe*Number(z))},string(){switch(Y){case"\\":b(),z+=po();return;case'"':if(Yt)return b(),Z("string",z);z+=b();return;case"'":if(!Yt)return b(),Z("string",z);z+=b();return;case`
74
- `:case"\r":throw ee(b());case"\u2028":case"\u2029":Do(Y);break;case void 0:throw ee(b())}z+=b()},start(){switch(Y){case"{":case"[":return Z("punctuator",b())}H="value"},beforePropertyName(){switch(Y){case"$":case"_":z=b(),H="identifierName";return;case"\\":b(),H="identifierNameStartEscape";return;case"}":return Z("punctuator",b());case'"':case"'":Yt=b()==='"',H="string";return}if(ae.isIdStartChar(Y)){z+=b(),H="identifierName";return}throw ee(b())},afterPropertyName(){if(Y===":")return Z("punctuator",b());throw ee(b())},beforePropertyValue(){H="value"},afterPropertyValue(){switch(Y){case",":case"}":return Z("punctuator",b())}throw ee(b())},beforeArrayValue(){if(Y==="]")return Z("punctuator",b());H="value"},afterArrayValue(){switch(Y){case",":case"]":return Z("punctuator",b())}throw ee(b())},end(){throw ee(b())}};function Z(i,e){return{type:i,value:e,line:nt,column:Te}}function Ct(i){for(const e of i){if(Je()!==e)throw ee(b());b()}}function po(){switch(Je()){case"b":return b(),"\b";case"f":return b(),"\f";case"n":return b(),`
75
- `;case"r":return b(),"\r";case"t":return b()," ";case"v":return b(),"\v";case"0":if(b(),ae.isDigit(Je()))throw ee(b());return"\0";case"x":return b(),mo();case"u":return b(),si();case`
83
+ `;function Ht(i){return i instanceof ce||i instanceof si||i instanceof Gt}function tt(i,e){return Ht(i)?qo(i,e).text:String(i)}class ce{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,t,n){if(Xr(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(G)}appendNewLineIf(e){return e?this.append(G):this}appendNewLineIfNotEmpty(){return this.append(au)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...t){return this.append(et(e,...t))}appendTemplateIf(e){return e?(t,...n)=>this.appendTemplate(t,...n):()=>this}indent(e){const{indentedChildren:t,indentation:n,indentEmptyLines:r,indentImmediately:s}=Array.isArray(e)||typeof e=="function"?{indentedChildren:e}:typeof e=="object"?e:{},o=new si(n,s,r);return this.contents.push(o),Array.isArray(t)?o.append(...t):t&&o.append(t),this}appendTraced(e,t,n){return r=>this.append(new ce().trace(e,t,n).append(r))}appendTracedIf(e,t,n,r){return e?this.appendTraced(typeof t=="function"?t():t,n,r):()=>this}appendTracedTemplate(e,t,n){return(r,...s)=>this.append(tu(e,t,n)(r,...s))}appendTracedTemplateIf(e,t,n,r){return e?this.appendTracedTemplate(typeof t=="function"?t():t,n,r):()=>this}}function uu(i,e,t){return n=>n instanceof ce&&n.tracedSource===void 0?n.trace(i,e,t):new ce().trace(i,e,t).append(n)}class si extends ce{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 Gt{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??ou,this.ifNotEmpty=t}}const G=new Gt,au=new Gt(void 0,!0),Ir=i=>i===void 0||typeof i=="string"||Ht(i)?i:String(i);function $e(i,e=Ir,t={}){const n=typeof e=="function"?e:Ir,{filter:r,prefix:s,suffix:o,separator:a,appendNewLineIfNotEmpty:c,skipNewLineAfterLastItem:h}=typeof e=="object"?e:t,l=typeof s=="function"?s:()=>s,f=typeof o=="function"?o:()=>o;return cu(i,(p,C,F,w)=>{if(r&&!r(C,F,w))return p;const m=n(C,F,w);return m===void 0?p:(p??(p=new ce)).append(l(C,F,w)).append(m).append(f(C,F,w)).appendIf(!w,a).appendNewLineIfNotEmptyIf(!p.isEmpty()&&!!c&&(!w||!h))})}function cu(i,e,t){const n=i[Symbol.iterator]();let r=n.next(),s=0,o=t;for(;!r.done;){const a=n.next();o=e(o,r.value,s,!!a.done),r=a,s++}return o}var lu=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,fu=/[\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]/,du=/[\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]/,oi={Space_Separator:lu,ID_Start:fu,ID_Continue:du},ae={isSpaceSeparator(i){return typeof i=="string"&&oi.Space_Separator.test(i)},isIdStartChar(i){return typeof i=="string"&&(i>="a"&&i<="z"||i>="A"&&i<="Z"||i==="$"||i==="_"||oi.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"||oi.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 ui,Ae,Ye,wn,nt,Te,ge,ai,Yt;var hu=function(e,t){ui=String(e),Ae="start",Ye=[],wn=0,nt=1,Te=0,ge=void 0,ai=void 0,Yt=void 0;do ge=pu(),Du[Ae]();while(ge.type!=="eof");return typeof t=="function"?ci({"":Yt},"",t):Yt};function ci(i,e,t){const n=i[e];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let r=0;r<n.length;r++){const s=String(r),o=ci(n,s,t);o===void 0?delete n[s]:Object.defineProperty(n,s,{value:o,writable:!0,enumerable:!0,configurable:!0})}else for(const r in n){const s=ci(n,r,t);s===void 0?delete n[r]:Object.defineProperty(n,r,{value:s,writable:!0,enumerable:!0,configurable:!0})}return t.call(i,e,n)}let H,z,qt,qe,Y;function pu(){for(H="default",z="",qt=!1,qe=1;;){Y=Je();const i=xr[H]();if(i)return i}}function Je(){if(ui[wn])return String.fromCodePoint(ui.codePointAt(wn))}function b(){const i=Je();return i===`
84
+ `?(nt++,Te=0):i?Te+=i.length:Te++,i&&(wn+=i.length),i}const xr={default(){switch(Y){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
85
+ `:case"\r":case"\u2028":case"\u2029":b();return;case"/":b(),H="comment";return;case void 0:return b(),Z("eof")}if(ae.isSpaceSeparator(Y)){b();return}return xr[Ae]()},comment(){switch(Y){case"*":b(),H="multiLineComment";return;case"/":b(),H="singleLineComment";return}throw ee(b())},multiLineComment(){switch(Y){case"*":b(),H="multiLineCommentAsterisk";return;case void 0:throw ee(b())}b()},multiLineCommentAsterisk(){switch(Y){case"*":b();return;case"/":b(),H="default";return;case void 0:throw ee(b())}b(),H="multiLineComment"},singleLineComment(){switch(Y){case`
86
+ `:case"\r":case"\u2028":case"\u2029":b(),H="default";return;case void 0:return b(),Z("eof")}b()},value(){switch(Y){case"{":case"[":return Z("punctuator",b());case"n":return b(),wt("ull"),Z("null",null);case"t":return b(),wt("rue"),Z("boolean",!0);case"f":return b(),wt("alse"),Z("boolean",!1);case"-":case"+":b()==="-"&&(qe=-1),H="sign";return;case".":z=b(),H="decimalPointLeading";return;case"0":z=b(),H="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":z=b(),H="decimalInteger";return;case"I":return b(),wt("nfinity"),Z("numeric",1/0);case"N":return b(),wt("aN"),Z("numeric",NaN);case'"':case"'":qt=b()==='"',z="",H="string";return}throw ee(b())},identifierNameStartEscape(){if(Y!=="u")throw ee(b());b();const i=li();switch(i){case"$":case"_":break;default:if(!ae.isIdStartChar(i))throw jr();break}z+=i,H="identifierName"},identifierName(){switch(Y){case"$":case"_":case"\u200C":case"\u200D":z+=b();return;case"\\":b(),H="identifierNameEscape";return}if(ae.isIdContinueChar(Y)){z+=b();return}return Z("identifier",z)},identifierNameEscape(){if(Y!=="u")throw ee(b());b();const i=li();switch(i){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!ae.isIdContinueChar(i))throw jr();break}z+=i,H="identifierName"},sign(){switch(Y){case".":z=b(),H="decimalPointLeading";return;case"0":z=b(),H="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":z=b(),H="decimalInteger";return;case"I":return b(),wt("nfinity"),Z("numeric",qe*(1/0));case"N":return b(),wt("aN"),Z("numeric",NaN)}throw ee(b())},zero(){switch(Y){case".":z+=b(),H="decimalPoint";return;case"e":case"E":z+=b(),H="decimalExponent";return;case"x":case"X":z+=b(),H="hexadecimal";return}return Z("numeric",qe*0)},decimalInteger(){switch(Y){case".":z+=b(),H="decimalPoint";return;case"e":case"E":z+=b(),H="decimalExponent";return}if(ae.isDigit(Y)){z+=b();return}return Z("numeric",qe*Number(z))},decimalPointLeading(){if(ae.isDigit(Y)){z+=b(),H="decimalFraction";return}throw ee(b())},decimalPoint(){switch(Y){case"e":case"E":z+=b(),H="decimalExponent";return}if(ae.isDigit(Y)){z+=b(),H="decimalFraction";return}return Z("numeric",qe*Number(z))},decimalFraction(){switch(Y){case"e":case"E":z+=b(),H="decimalExponent";return}if(ae.isDigit(Y)){z+=b();return}return Z("numeric",qe*Number(z))},decimalExponent(){switch(Y){case"+":case"-":z+=b(),H="decimalExponentSign";return}if(ae.isDigit(Y)){z+=b(),H="decimalExponentInteger";return}throw ee(b())},decimalExponentSign(){if(ae.isDigit(Y)){z+=b(),H="decimalExponentInteger";return}throw ee(b())},decimalExponentInteger(){if(ae.isDigit(Y)){z+=b();return}return Z("numeric",qe*Number(z))},hexadecimal(){if(ae.isHexDigit(Y)){z+=b(),H="hexadecimalInteger";return}throw ee(b())},hexadecimalInteger(){if(ae.isHexDigit(Y)){z+=b();return}return Z("numeric",qe*Number(z))},string(){switch(Y){case"\\":b(),z+=mu();return;case'"':if(qt)return b(),Z("string",z);z+=b();return;case"'":if(!qt)return b(),Z("string",z);z+=b();return;case`
87
+ `:case"\r":throw ee(b());case"\u2028":case"\u2029":Cu(Y);break;case void 0:throw ee(b())}z+=b()},start(){switch(Y){case"{":case"[":return Z("punctuator",b())}H="value"},beforePropertyName(){switch(Y){case"$":case"_":z=b(),H="identifierName";return;case"\\":b(),H="identifierNameStartEscape";return;case"}":return Z("punctuator",b());case'"':case"'":qt=b()==='"',H="string";return}if(ae.isIdStartChar(Y)){z+=b(),H="identifierName";return}throw ee(b())},afterPropertyName(){if(Y===":")return Z("punctuator",b());throw ee(b())},beforePropertyValue(){H="value"},afterPropertyValue(){switch(Y){case",":case"}":return Z("punctuator",b())}throw ee(b())},beforeArrayValue(){if(Y==="]")return Z("punctuator",b());H="value"},afterArrayValue(){switch(Y){case",":case"]":return Z("punctuator",b())}throw ee(b())},end(){throw ee(b())}};function Z(i,e){return{type:i,value:e,line:nt,column:Te}}function wt(i){for(const e of i){if(Je()!==e)throw ee(b());b()}}function mu(){switch(Je()){case"b":return b(),"\b";case"f":return b(),"\f";case"n":return b(),`
88
+ `;case"r":return b(),"\r";case"t":return b()," ";case"v":return b(),"\v";case"0":if(b(),ae.isDigit(Je()))throw ee(b());return"\0";case"x":return b(),gu();case"u":return b(),li();case`
76
89
  `:case"\u2028":case"\u2029":return b(),"";case"\r":return b(),Je()===`
77
- `&&b(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw ee(b());case void 0:throw ee(b())}return b()}function mo(){let i="",e=Je();if(!ae.isHexDigit(e)||(i+=b(),e=Je(),!ae.isHexDigit(e)))throw ee(b());return i+=b(),String.fromCodePoint(parseInt(i,16))}function si(){let i="",e=4;for(;e-- >0;){const t=Je();if(!ae.isHexDigit(t))throw ee(b());i+=b()}return String.fromCodePoint(parseInt(i,16))}const go={start(){if(De.type==="eof")throw wt();ui()},beforePropertyName(){switch(De.type){case"identifier":case"string":ii=De.value,Ae="afterPropertyName";return;case"punctuator":wn();return;case"eof":throw wt()}},afterPropertyName(){if(De.type==="eof")throw wt();Ae="beforePropertyValue"},beforePropertyValue(){if(De.type==="eof")throw wt();ui()},beforeArrayValue(){if(De.type==="eof")throw wt();if(De.type==="punctuator"&&De.value==="]"){wn();return}ui()},afterPropertyValue(){if(De.type==="eof")throw wt();switch(De.value){case",":Ae="beforePropertyName";return;case"}":wn()}},afterArrayValue(){if(De.type==="eof")throw wt();switch(De.value){case",":Ae="beforeArrayValue";return;case"]":wn()}},end(){}};function ui(){let i;switch(De.type){case"punctuator":switch(De.value){case"{":i={};break;case"[":i=[];break}break;case"null":case"boolean":case"numeric":case"string":i=De.value;break}if(Gt===void 0)Gt=i;else{const e=Ye[Ye.length-1];Array.isArray(e)?e.push(i):Object.defineProperty(e,ii,{value:i,writable:!0,enumerable:!0,configurable:!0})}if(i!==null&&typeof i=="object")Ye.push(i),Array.isArray(i)?Ae="beforeArrayValue":Ae="beforePropertyName";else{const e=Ye[Ye.length-1];e==null?Ae="end":Array.isArray(e)?Ae="afterArrayValue":Ae="afterPropertyValue"}}function wn(){Ye.pop();const i=Ye[Ye.length-1];i==null?Ae="end":Array.isArray(i)?Ae="afterArrayValue":Ae="afterPropertyValue"}function ee(i){return An(i===void 0?`JSON5: invalid end of input at ${nt}:${Te}`:`JSON5: invalid character '${xr(i)}' at ${nt}:${Te}`)}function wt(){return An(`JSON5: invalid end of input at ${nt}:${Te}`)}function $r(){return Te-=5,An(`JSON5: invalid identifier character at ${nt}:${Te}`)}function Do(i){console.warn(`JSON5: '${xr(i)}' in strings is not valid ECMAScript; consider escaping`)}function xr(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 An(i){const e=new SyntaxError(i);return e.lineNumber=nt,e.columnNumber=Te,e}var Co=function(e,t,n){const r=[];let s="",u,a,c="",h;if(t!=null&&typeof t=="object"&&!Array.isArray(t)&&(n=t.space,h=t.quote,t=t.replacer),typeof t=="function")a=t;else if(Array.isArray(t)){u=[];for(const w of t){let m;typeof w=="string"?m=w:(typeof w=="number"||w instanceof String||w instanceof Number)&&(m=String(w)),m!==void 0&&u.indexOf(m)<0&&u.push(m)}}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)),c=" ".substr(0,n)):typeof n=="string"&&(c=n.substr(0,10)),l("",{"":e});function l(w,m){let y=m[w];switch(y!=null&&(typeof y.toJSON5=="function"?y=y.toJSON5(w):typeof y.toJSON=="function"&&(y=y.toJSON(w))),a&&(y=a.call(m,w,y)),y instanceof Number?y=Number(y):y instanceof String?y=String(y):y instanceof Boolean&&(y=y.valueOf()),y){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof y=="string")return f(y);if(typeof y=="number")return String(y);if(typeof y=="object")return Array.isArray(y)?F(y):p(y)}function f(w){const m={"'":.1,'"':.2},y={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let S="";for(let N=0;N<w.length;N++){const U=w[N];switch(U){case"'":case'"':m[U]++,S+=U;continue;case"\0":if(ae.isDigit(w[N+1])){S+="\\x00";continue}}if(y[U]){S+=y[U];continue}if(U<" "){let Ce=U.charCodeAt(0).toString(16);S+="\\x"+("00"+Ce).substring(Ce.length);continue}S+=U}const R=h||Object.keys(m).reduce((N,U)=>m[N]<m[U]?N:U);return S=S.replace(new RegExp(R,"g"),y[R]),R+S+R}function p(w){if(r.indexOf(w)>=0)throw TypeError("Converting circular structure to JSON5");r.push(w);let m=s;s=s+c;let y=u||Object.keys(w),S=[];for(const N of y){const U=l(N,w);if(U!==void 0){let Ce=C(N)+":";c!==""&&(Ce+=" "),Ce+=U,S.push(Ce)}}let R;if(S.length===0)R="{}";else{let N;if(c==="")N=S.join(","),R="{"+N+"}";else{let U=`,
78
- `+s;N=S.join(U),R=`{
90
+ `&&b(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw ee(b());case void 0:throw ee(b())}return b()}function gu(){let i="",e=Je();if(!ae.isHexDigit(e)||(i+=b(),e=Je(),!ae.isHexDigit(e)))throw ee(b());return i+=b(),String.fromCodePoint(parseInt(i,16))}function li(){let i="",e=4;for(;e-- >0;){const t=Je();if(!ae.isHexDigit(t))throw ee(b());i+=b()}return String.fromCodePoint(parseInt(i,16))}const Du={start(){if(ge.type==="eof")throw At();fi()},beforePropertyName(){switch(ge.type){case"identifier":case"string":ai=ge.value,Ae="afterPropertyName";return;case"punctuator":An();return;case"eof":throw At()}},afterPropertyName(){if(ge.type==="eof")throw At();Ae="beforePropertyValue"},beforePropertyValue(){if(ge.type==="eof")throw At();fi()},beforeArrayValue(){if(ge.type==="eof")throw At();if(ge.type==="punctuator"&&ge.value==="]"){An();return}fi()},afterPropertyValue(){if(ge.type==="eof")throw At();switch(ge.value){case",":Ae="beforePropertyName";return;case"}":An()}},afterArrayValue(){if(ge.type==="eof")throw At();switch(ge.value){case",":Ae="beforeArrayValue";return;case"]":An()}},end(){}};function fi(){let i;switch(ge.type){case"punctuator":switch(ge.value){case"{":i={};break;case"[":i=[];break}break;case"null":case"boolean":case"numeric":case"string":i=ge.value;break}if(Yt===void 0)Yt=i;else{const e=Ye[Ye.length-1];Array.isArray(e)?e.push(i):Object.defineProperty(e,ai,{value:i,writable:!0,enumerable:!0,configurable:!0})}if(i!==null&&typeof i=="object")Ye.push(i),Array.isArray(i)?Ae="beforeArrayValue":Ae="beforePropertyName";else{const e=Ye[Ye.length-1];e==null?Ae="end":Array.isArray(e)?Ae="afterArrayValue":Ae="afterPropertyValue"}}function An(){Ye.pop();const i=Ye[Ye.length-1];i==null?Ae="end":Array.isArray(i)?Ae="afterArrayValue":Ae="afterPropertyValue"}function ee(i){return En(i===void 0?`JSON5: invalid end of input at ${nt}:${Te}`:`JSON5: invalid character '${Lr(i)}' at ${nt}:${Te}`)}function At(){return En(`JSON5: invalid end of input at ${nt}:${Te}`)}function jr(){return Te-=5,En(`JSON5: invalid identifier character at ${nt}:${Te}`)}function Cu(i){console.warn(`JSON5: '${Lr(i)}' in strings is not valid ECMAScript; consider escaping`)}function Lr(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 En(i){const e=new SyntaxError(i);return e.lineNumber=nt,e.columnNumber=Te,e}var wu=function(e,t,n){const r=[];let s="",o,a,c="",h;if(t!=null&&typeof t=="object"&&!Array.isArray(t)&&(n=t.space,h=t.quote,t=t.replacer),typeof t=="function")a=t;else if(Array.isArray(t)){o=[];for(const w of t){let m;typeof w=="string"?m=w:(typeof w=="number"||w instanceof String||w instanceof Number)&&(m=String(w)),m!==void 0&&o.indexOf(m)<0&&o.push(m)}}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)),c=" ".substr(0,n)):typeof n=="string"&&(c=n.substr(0,10)),l("",{"":e});function l(w,m){let y=m[w];switch(y!=null&&(typeof y.toJSON5=="function"?y=y.toJSON5(w):typeof y.toJSON=="function"&&(y=y.toJSON(w))),a&&(y=a.call(m,w,y)),y instanceof Number?y=Number(y):y instanceof String?y=String(y):y instanceof Boolean&&(y=y.valueOf()),y){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof y=="string")return f(y);if(typeof y=="number")return String(y);if(typeof y=="object")return Array.isArray(y)?F(y):p(y)}function f(w){const m={"'":.1,'"':.2},y={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let S="";for(let N=0;N<w.length;N++){const W=w[N];switch(W){case"'":case'"':m[W]++,S+=W;continue;case"\0":if(ae.isDigit(w[N+1])){S+="\\x00";continue}}if(y[W]){S+=y[W];continue}if(W<" "){let Ce=W.charCodeAt(0).toString(16);S+="\\x"+("00"+Ce).substring(Ce.length);continue}S+=W}const R=h||Object.keys(m).reduce((N,W)=>m[N]<m[W]?N:W);return S=S.replace(new RegExp(R,"g"),y[R]),R+S+R}function p(w){if(r.indexOf(w)>=0)throw TypeError("Converting circular structure to JSON5");r.push(w);let m=s;s=s+c;let y=o||Object.keys(w),S=[];for(const N of y){const W=l(N,w);if(W!==void 0){let Ce=C(N)+":";c!==""&&(Ce+=" "),Ce+=W,S.push(Ce)}}let R;if(S.length===0)R="{}";else{let N;if(c==="")N=S.join(","),R="{"+N+"}";else{let W=`,
91
+ `+s;N=S.join(W),R=`{
79
92
  `+s+N+`,
80
93
  `+m+"}"}}return r.pop(),s=m,R}function C(w){if(w.length===0)return f(w);const m=String.fromCodePoint(w.codePointAt(0));if(!ae.isIdStartChar(m))return f(w);for(let y=m.length;y<w.length;y++)if(!ae.isIdContinueChar(String.fromCodePoint(w.codePointAt(y))))return f(w);return w}function F(w){if(r.indexOf(w)>=0)throw TypeError("Converting circular structure to JSON5");r.push(w);let m=s;s=s+c;let y=[];for(let R=0;R<w.length;R++){const N=l(String(R),w);y.push(N!==void 0?N:"null")}let S;if(y.length===0)S="[]";else if(c==="")S="["+y.join(",")+"]";else{let R=`,
81
94
  `+s,N=y.join(R);S=`[
82
95
  `+s+N+`,
83
- `+m+"]"}return r.pop(),s=m,S}};const wo={parse:fo,stringify:Co};var At=wo;function Ao(i){const e=new ce;return e.appendTemplate`
96
+ `+m+"]"}return r.pop(),s=m,S}};const Au={parse:hu,stringify:wu};var Et=Au;const Eu=i=>i.charAt(0).toLocaleUpperCase()+i.slice(1),bu=i=>i.split(".").map(Eu).join(""),Fu=i=>bu(i.parent?i.id.slice(i.parent.length+1):i.id),yu=({autoLayout:i})=>{switch(i.direction){case"TB":return"down";case"BT":return"up";case"LR":return"right";case"RL":return"left"}},vu=({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 Pr(i){const{nodes:e,edges:t}=i,n=new Map,r=(o,a)=>{const c=Fu(o),h=(a?a+".":"")+c;n.set(o.id,h);const l=JSON.stringify(o.title),f=vu(o);return new ce().append(c,": {",G).indent({indentedChildren:p=>p.append("label: ",l,G).appendIf(f!=="rectangle","shape: ",f,G).appendIf(o.children.length>0,G,$e(e.filter(C=>C.parent===o.id),C=>r(C,h))),indentation:2}).append("}",G)},s=o=>new ce().append(n.get(o.source)," -> ",n.get(o.target)).append(a=>o.label&&a.append(": ",JSON.stringify(o.label)));return tt(new ce().append("direction: ",yu(i),G,G).append($e(e.filter(o=>wi(o.parent)),o=>r(o),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,G,$e(t,o=>s(o),{appendNewLineIfNotEmpty:!0})))}const Bu=i=>i.charAt(0).toLocaleUpperCase()+i.slice(1),Ou=i=>i.split(".").map(Bu).join(""),_u=i=>Ou(i.parent?i.id.slice(i.parent.length+1):i.id),Su=({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 Nr(i){const{nodes:e,edges:t}=i,n=new Map,r=(o,a)=>{const c=_u(o),h=(a?a+".":"")+c;n.set(o.id,h);const l=o.title.replaceAll(`
97
+ `,"\\n"),f=Su(o),p=new ce;return o.children.length>0?p.append("subgraph ",h,"[",JSON.stringify(o.title),"]",G).indent({indentedChildren:[$e(e.filter(C=>C.parent===o.id),C=>r(C,h),{appendNewLineIfNotEmpty:!0})],indentation:2}).append("end",G):p.append(h,f[0],l,f[1]),p},s=o=>new ce().append(n.get(o.source)," -.",o.label?' "'+o.label.replaceAll(`
98
+ `,"\\n")+'" .-':"-","> ",n.get(o.target));return tt(new ce().appendIf(i.title!==null&&i.title.length>0,"---",G,`title: ${JSON.stringify(i.title)}`,G,"---",G).append("graph ",i.autoLayout.direction,G).indent({indentedChildren:o=>{o.append($e(e.filter(a=>wi(a.parent)),a=>r(a),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,$e(t,a=>s(a),{appendNewLineIfNotEmpty:!0}))},indentation:2}))}function $u(i){const e=new ce;return e.appendTemplate`
84
99
  /* prettier-ignore-start */
85
100
  /* eslint-disable */
86
101
 
@@ -89,9 +104,9 @@ ${F.join(`
89
104
  * DO NOT EDIT MANUALLY!
90
105
  ******************************************************************************/
91
106
 
92
- import { LikeC4Model } from 'likec4'
107
+ import { LikeC4Model } from 'likec4/model'
93
108
 
94
- export const likeC4Model = LikeC4Model.fromDump(${At.stringify(i.$model,{space:2,quote:"'"})})
109
+ export const likeC4Model = LikeC4Model.fromDump(${Et.stringify(i.$model,{space:2,quote:"'"})})
95
110
 
96
111
  export type LikeC4ModelTypes = typeof likeC4Model.Aux
97
112
  export type LikeC4ElementId = LikeC4ModelTypes['Fqn']
@@ -99,7 +114,7 @@ ${F.join(`
99
114
  export type LikeC4ViewId = LikeC4ModelTypes['ViewId']
100
115
 
101
116
  /* prettier-ignore-end */
102
- `,tt(e)}function Eo(i){return Ie(i,e=>et`${At.stringify(e.id)}`,{separator:" | "})}function bo(i){const e=Array.from(i),t=new ce;return t.appendTemplate`
117
+ `,tt(e)}function Iu(i){return $e(i,e=>et`${Et.stringify(e.id)}`,{separator:" | "})}function xu(i){const e=Array.from(i),t=new ce;return t.appendTemplate`
103
118
  /******************************************************************************
104
119
  * This file was generated
105
120
  * DO NOT EDIT MANUALLY!
@@ -111,9 +126,9 @@ ${F.join(`
111
126
 
112
127
  import type { DiagramView } from 'likec4'
113
128
  `.append(G,G),e.length===0?(t.append("export {}",G),tt(t)):(t.appendTemplate`
114
- export type LikeC4ViewId = ${Eo(e)};
129
+ export type LikeC4ViewId = ${Iu(e)};
115
130
  export const LikeC4Views = {
116
- `.indent({indentation:2,indentedChildren(n){n.appendNewLineIf(e.length>1).append(Ie(e,r=>et`${At.stringify(r.id)}: (${At.stringify(r)} as unknown) as DiagramView`,{separator:",",appendNewLineIfNotEmpty:!0}))}}).append("} as const satisfies Record<LikeC4ViewId, DiagramView>",G,G).appendTemplate`
131
+ `.indent({indentation:2,indentedChildren(n){n.appendNewLineIf(e.length>1).append($e(e,r=>et`${Et.stringify(r.id)}: (${Et.stringify(r)} as unknown) as DiagramView`,{separator:",",appendNewLineIfNotEmpty:!0}))}}).append("} as const satisfies Record<LikeC4ViewId, DiagramView>",G,G).appendTemplate`
117
132
  export type LikeC4Views = typeof LikeC4Views
118
133
 
119
134
  export function isLikeC4ViewId(value: unknown): value is LikeC4ViewId {
@@ -125,8 +140,8 @@ ${F.join(`
125
140
  }
126
141
 
127
142
  /* prettier-ignore-end */
128
- `.append(G),tt(t))}function qt(i){i instanceof Set&&(i=[...i].sort(qr));const e=i.map(t=>` | ${JSON.stringify(t)}`);return e.length===0&&e.push(" never"),e.join(`
129
- `)+";"}function Fo(i){const{fqns:e,tags:t,kinds:n}=Ai([...i.elements()]).reduce((u,a)=>(u.fqns.push(a.id),u.kinds.add(a.kind),u.tags.push(...a.tags),u),{fqns:[],kinds:new Set,tags:[]}),r=Ai([...i.deployment.elements()]).map(u=>u.id),{viewIds:s}=[...i.views()].reduce((u,a)=>(u.viewIds.add(a.id),u.tags.push(...a.tags),u.tags.push(...a.includedTags),u),{viewIds:new Set,tags:t});return`
143
+ `.append(G),tt(t))}function Jt(i){i instanceof Set&&(i=[...i].sort(_s));const e=i.map(t=>` | ${JSON.stringify(t)}`);return e.length===0&&e.push(" never"),e.join(`
144
+ `)+";"}function ju(i){const{fqns:e,tags:t,kinds:n}=xi([...i.elements()]).reduce((o,a)=>(o.fqns.push(a.id),o.kinds.add(a.kind),o.tags.push(...a.tags),o),{fqns:[],kinds:new Set,tags:[]}),r=xi([...i.deployment.elements()]).map(o=>o.id),{viewIds:s}=[...i.views()].reduce((o,a)=>(o.viewIds.add(a.id),o.tags.push(...a.tags),o.tags.push(...a.includedTags),o),{viewIds:new Set,tags:t});return`
130
145
  /* prettier-ignore-start */
131
146
  /* eslint-disable */
132
147
 
@@ -137,29 +152,31 @@ ${F.join(`
137
152
 
138
153
  import type { PropsWithChildren } from 'react'
139
154
  import type { JSX } from 'react/jsx-runtime'
155
+ import type {
156
+ LikeC4Model as GenericLikeC4Model,
157
+ } from 'likec4/model'
140
158
  import type {
141
159
  LikeC4ViewProps as GenericLikeC4ViewProps,
142
160
  ViewData,
143
- LikeC4Model as GenericLikeC4Model,
144
161
  ReactLikeC4Props as GenericReactLikeC4Props
145
162
  } from 'likec4/react'
146
163
 
147
164
  type LikeC4ElementId =
148
- ${qt(e)}
165
+ ${Jt(e)}
149
166
 
150
167
  type LikeC4DeploymentId =
151
- ${qt(r)}
168
+ ${Jt(r)}
152
169
 
153
170
  type LikeC4ViewId =
154
- ${qt(s)}
171
+ ${Jt(s)}
155
172
 
156
173
  type LikeC4ElementKind =
157
- ${qt(n)}
174
+ ${Jt(n)}
158
175
 
159
176
  type LikeC4Tag =
160
- ${qt(new Set(t))}
177
+ ${Jt(new Set(t))}
161
178
 
162
- type LikeC4ViewData = ViewData<LikeC4ViewId>
179
+ type LikeC4ViewData = ViewData<LikeC4ViewId, LikeC4Tag>
163
180
 
164
181
  declare const LikeC4Views: {
165
182
  readonly [K in LikeC4ViewId]: LikeC4ViewData
@@ -218,7 +235,7 @@ export {
218
235
  ReactLikeC4
219
236
  }
220
237
  /* prettier-ignore-end */
221
- `.trimStart()}function yo(i){const e=new ce;return e.appendTemplate`
238
+ `.trimStart()}function Lu(i){const e=new ce;return e.appendTemplate`
222
239
  /******************************************************************************
223
240
  * This file was generated
224
241
  * DO NOT EDIT MANUALLY!
@@ -227,9 +244,9 @@ export {
227
244
 
228
245
  export function d2Source(viewId) {
229
246
  switch (viewId) {
230
- `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(Ie(i,n=>et`
247
+ `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append($e(i,n=>et`
231
248
  case ${JSON.stringify(n.id)}: {
232
- return ${JSON.stringify(_r(n))}
249
+ return ${JSON.stringify(Pr(n))}
233
250
  }
234
251
  `,{appendNewLineIfNotEmpty:!0})).appendTemplate`
235
252
  default: {
@@ -237,7 +254,7 @@ export {
237
254
  }
238
255
  `}}).append(G," }",G).appendTemplate`
239
256
  }
240
- `.append(G,G),tt(e)}function vo(i){const e=new ce;return e.appendTemplate`
257
+ `.append(G,G),tt(e)}function Pu(i){const e=new ce;return e.appendTemplate`
241
258
  /******************************************************************************
242
259
  * This file was generated
243
260
  * DO NOT EDIT MANUALLY!
@@ -246,7 +263,7 @@ export {
246
263
 
247
264
  export function dotSource(viewId) {
248
265
  switch (viewId) {
249
- `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(Ie(Object.keys(i),n=>et`
266
+ `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append($e(Object.keys(i),n=>et`
250
267
  case ${JSON.stringify(n)}: {
251
268
  return ${JSON.stringify(i[n].dot)}
252
269
  }
@@ -259,7 +276,7 @@ export {
259
276
 
260
277
  export function svgSource(viewId) {
261
278
  switch (viewId) {
262
- `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(Ie(Object.keys(i),n=>et`
279
+ `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append($e(Object.keys(i),n=>et`
263
280
  case ${JSON.stringify(n)}: {
264
281
  return ${JSON.stringify(i[n].svg)}
265
282
  }
@@ -267,7 +284,7 @@ export {
267
284
  default: {
268
285
  throw new Error('Unknown viewId: ' + viewId)
269
286
  }
270
- `}}).append(G," }",G,"}",G,G),tt(e)}function Bo(i){const e=Jr(i.flatMap(r=>r.nodes.map(s=>s.icon)),Ei(Qr),Ei(r=>bi(r)&&!r.toLowerCase().startsWith("http")),Kr()).sort(),{imports:t,cases:n}=e.reduce((r,s,u)=>{const[a,c]=s.split(":"),h="Icon"+u.toString().padStart(2,"0");return r.imports.push(`import ${h} from 'likec4/icons/${a}/${c}'`),r.cases.push(` '${a}:${c}': ${h}`),r},{imports:[],cases:[]});return`
287
+ `}}).append(G," }",G,"}",G,G),tt(e)}function Nu(i){const e=Zr(i.flatMap(r=>r.nodes.map(s=>s.icon)),Ai(ts),Ai(r=>Ei(r)&&!r.toLowerCase().startsWith("http")),es()).sort(),{imports:t,cases:n}=e.reduce((r,s,o)=>{const[a,c]=s.split(":"),h="Icon"+o.toString().padStart(2,"0");return r.imports.push(`import ${h} from 'likec4/icons/${a}/${c}'`),r.cases.push(` '${a}:${c}': ${h}`),r},{imports:[],cases:[]});return`
271
288
  ${t.join(`
272
289
  `)}
273
290
 
@@ -289,18 +306,19 @@ if (import.meta.hot) {
289
306
  }
290
307
  })
291
308
  }
292
- `}function Oo(i){const{views:e,...t}=i.$model;return`
293
- import { nano, createLikeC4Model } from 'likec4/react'
309
+ `}function ku(i){const{views:e,...t}=i.$model;return`
310
+ import { createLikeC4Model } from 'likec4/model'
311
+ import { nano } from 'likec4/react'
294
312
 
295
313
  // This is needed for better tree shaking
296
- export let LikeC4Views = ${At.stringify(e)}
314
+ export const LikeC4Views = ${Et.stringify(e)}
297
315
 
298
- export let likeC4Model = /* @__PURE__ */ createLikeC4Model(Object.assign(
299
- ${At.stringify(t)},
316
+ export const likeC4Model = /* @__PURE__ */ createLikeC4Model(Object.assign(
317
+ ${Et.stringify(t)},
300
318
  {views: LikeC4Views}
301
319
  ))
302
320
 
303
- export let $likec4model = /* @__PURE__ */ nano.atom(likeC4Model)
321
+ export const $likec4model = /* @__PURE__ */ nano.atom(likeC4Model)
304
322
 
305
323
  export function useLikeC4Model() {
306
324
  return nano.useStore($likec4model)
@@ -319,7 +337,7 @@ if (import.meta.hot) {
319
337
  }
320
338
  })
321
339
  }
322
- `}function _o(i){const e=new ce;return e.appendTemplate`
340
+ `}function Mu(i){const e=new ce;return e.appendTemplate`
323
341
  /******************************************************************************
324
342
  * This file was generated
325
343
  * DO NOT EDIT MANUALLY!
@@ -328,9 +346,9 @@ if (import.meta.hot) {
328
346
 
329
347
  export function mmdSource(viewId) {
330
348
  switch (viewId) {
331
- `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(Ie(i,n=>et`
349
+ `.appendNewLine().indent({indentation:4,indentedChildren(t){t.append($e(i,n=>et`
332
350
  case ${JSON.stringify(n.id)}: {
333
- return ${JSON.stringify(Sr(n))}
351
+ return ${JSON.stringify(Nr(n))}
334
352
  }
335
353
  `,{appendNewLineIfNotEmpty:!0})).appendTemplate`
336
354
  default: {
@@ -339,10 +357,10 @@ if (import.meta.hot) {
339
357
  `}}).append(G," }",G).appendTemplate`
340
358
  }
341
359
 
342
- `.append(G,G),tt(e)}function jr(i){return`
360
+ `.append(G,G),tt(e)}function kr(i){return`
343
361
  import { nano } from 'likec4/react'
344
362
 
345
- export const $graph = nano.atom(${At.stringify(i,null,2)})
363
+ export const $graph = nano.atom(${Et.stringify(i,null,2)})
346
364
 
347
365
  export const useOverviewGraph = () => {
348
366
  return nano.useStore($graph)
@@ -361,7 +379,7 @@ if (import.meta.hot) {
361
379
  }
362
380
  })
363
381
  }
364
- `}function So(i,e){const{imports:t,cases:n}=i.reduce((r,{id:s},u)=>{const a=Q(e,`${s}.png`);if(!Ke(a))return r;const c="Png"+u.toString().padStart(2,"0");return r.imports.push(`import ${c} from 'likec4/previews/${s}.png'`),r.cases.push(` ${JSON.stringify(s)}: ${c}`),r},{imports:[],cases:[]});return`
382
+ `}function Tu(i,e){const{imports:t,cases:n}=i.reduce((r,{id:s},o)=>{const a=J(e,`${s}.png`);if(!Ke(a))return r;const c="Png"+o.toString().padStart(2,"0");return r.imports.push(`import ${c} from 'likec4/previews/${s}.png'`),r.cases.push(` ${JSON.stringify(s)}: ${c}`),r},{imports:[],cases:[]});return`
365
383
  import { nano } from 'likec4/react'
366
384
  // assets dir: ${e}
367
385
 
@@ -403,46 +421,31 @@ if (import.meta.hot) {
403
421
  }
404
422
  })
405
423
  }
406
- `}const Io={id:"virtual:likec4/dot-sources",virtualId:"\0likec4-plugin/dot-sources.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/dot-sources"));const t=await i.viewsService.viewsAsGraphvizOut(),n=Zr(t,({id:r,svg:s,dot:u})=>[r,{dot:u,svg:s}]);return vo(n)}},$o={id:"virtual:likec4/d2-sources",virtualId:"\0likec4-plugin/d2-sources.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/d2-sources"));const t=await i.viewsService.computedViews();return yo(t)}},xo={id:"virtual:likec4/mmd-sources",virtualId:"\0likec4-plugin/mmd-sources.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/mmd-sources"));const t=await i.viewsService.computedViews();return _o(t)}},jo={id:"virtual:likec4/icons",virtualId:"\0likec4-plugin/icons.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/icons"));const t=await i.viewsService.computedViews();return Bo(t)}},Lo={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(A.dim("generating virtual:likec4/overview-graph"));const n=await i.viewsService.overviewGraph();return jr(n)}catch(n){e.error(n)}return e.info(A.dim("generating empty virtual:likec4/overview-graph")),jr({nodes:[],edges:[],bounds:{x:0,y:0,width:10,height:10}})}},Lr={id:"virtual:likec4/previews",virtualId:"\0likec4-plugin/previews.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(A.dim("generating virtual:likec4/previews"));const n=await i.viewsService.computedViews();return So(n,t)}},Po={id:"virtual:likec4/model",virtualId:"\0likec4-plugin/model.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(A.dim("generating virtual:likec4/model"));const n=await i.layoutedModel();return Oo(n)}},oi=[jo,Io,$o,xo,Lo,Lr,Po],No=i=>{const e=i.toLowerCase();return e.endsWith(".c4")||e.endsWith(".likec4")||e.endsWith(".like-c4")};function ai({useOverviewGraph:i=!1,languageServices:e}){let t,n=e.workspace;return{name:"vite-plugin-likec4",configResolved(r){if(t=r.logger,i){const s=r.resolve.alias.find(u=>u.find==="likec4/previews")?.replacement;s?(n=s,t.info(A.dim("likec4/previews alias")+" "+A.dim(n))):t.warn("likec4/previews alias not found")}},resolveId(r){const s=oi.find(u=>u.id===r);return s?s.virtualId:null},async load(r){const s=oi.find(u=>u.virtualId===r);return s?await s.load({logger:t,likec4:e,assetsDir:n,useOverviewGraph:i}):null},configureServer(r){const s=Xr(1),u=()=>{s.clearQueue(),s(async()=>{const[h]=e.getErrors();if(h){r.ws.send({type:"error",err:{name:"LikeC4ValidationError",message:"Validation error: "+h.message.slice(0,500),stack:"",plugin:"vite-plugin-likec4",loc:{file:h.sourceFsPath,line:h.range.start.line+1,column:h.range.start.character+1}}});return}for(const l of oi){const f=r.moduleGraph.getModuleById(l.virtualId);if(f&&f.importers.size>0){t.info(`${A.green("trigger hmr")} ${A.dim(f.url)}`);try{await r.reloadModule(f)}catch(p){t.error(p)}}}})},a=e.workspace;t.info(`${A.dim("watch")} ${a}`);const c=h=>l=>{No(l)&&e.notifyUpdate({[h]:l})};if(r.watcher.add(a).on("add",c("changed")).on("change",c("changed")).on("unlink",c("removed")),i&&!n.startsWith(e.workspace)){t.info(`${A.dim("watch")} ${n}`);const h=()=>{const l=r.moduleGraph.getModuleById(Lr.virtualId);l&&l.importers.size>0&&r.reloadModule(l)};r.watcher.add(n).on("add",h).on("change",h).on("unlink",h)}e.onModelUpdate(()=>{me.debug("likec4 model update"),u()})}}}const ci=bt(ys(import.meta.url)),Mo=`
407
- /* prettier-ignore-start */
408
- /* eslint-disable */
409
-
410
- /******************************************************************************
411
- * This file was generated
412
- * DO NOT EDIT MANUALLY!
413
- ******************************************************************************/
414
-
415
- `.trimStart(),ko=`
416
-
417
- /* prettier-ignore-end */
418
- `,li={banner:Mo,footer:ko};function fi(){const i=[Q(ci,"../__app__"),Q(ci,"../../__app__"),Q(ci,"../../dist/__app__")],e=es(i,Ke);if(!e)throw me.error(`likec4 app root does not exist, tried:
419
- ${i.join(`
420
- `)}`),new Error("likec4 app root does not exist");return e}async function di(){const i=await Zt(It(en(),".likec4-public-"));return await ot(It(i,"likec4-views.js"),`// generated by likec4
421
- `),i}const hi=1e4,pi=async({languageServices:i,likec4AssetsDir:e,...t})=>{const n=t.customLogger??Le("c4:vite"),r=fi(),s=t?.useOverviewGraph===!0;n.info(`${A.cyan("likec4 app root")} ${A.dim(r)}`);const u=t.outputDir??Q(i.workspace,"dist");n.info(A.cyan("output")+" "+A.dim(u));let a="/";t.base&&(a=ts(t.base),!ns(a)&&a!=="./"&&(a=is(a))),a!=="/"&&n.info(`${A.green("app base url")} ${A.dim(a)}`);const c=t.webcomponentPrefix??"likec4";return{isDev:!1,likec4AssetsDir:e,webcomponentPrefix:c,root:r,languageServices:i,clearScreen:!1,base:a,resolve:{alias:{"likec4/previews":e}},configFile:!1,mode:"production",optimizeDeps:{include:["likec4/react","react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client"],force:!0},define:{WEBCOMPONENT_PREFIX:JSON.stringify(c),__USE_STYLE_BUNDLE__:"false",__USE_OVERVIEW_GRAPH__:s?"true":"false",__USE_HASH_HISTORY__:t?.useHashHistory===!0?"true":"false","process.env.NODE_ENV":'"production"'},build:{outDir:u,modulePreload:!1,emptyOutDir:!1,cssCodeSplit:!1,sourcemap:!1,cssMinify:!0,minify:!0,copyPublicDir:!0,chunkSizeWarningLimit:hi,commonjsOptions:{defaultIsModuleExports:h=>h.includes("react")?!0:"auto"},rollupOptions:{treeshake:{preset:"recommended"},output:{hoistTransitiveImports:!1,compact:!0}}},customLogger:n,plugins:[ai({languageServices:i,useOverviewGraph:s})]}};async function mi({languageServices:i,outDir:e,base:t,webcomponentPrefix:n="likec4",filename:r="likec4-views.js"}){const s=Le("c4:lib"),u=fi();return s.info(A.cyan("outDir")+" "+A.dim(e)),{root:u,clearScreen:!1,base:t,configFile:!1,publicDir:!1,mode:"production",define:{WEBCOMPONENT_PREFIX:JSON.stringify(n),"process.env.NODE_ENV":'"production"'},esbuild:{...li},build:{outDir:e,emptyOutDir:!1,sourcemap:!1,minify:!0,assetsInlineLimit:100*1024,chunkSizeWarningLimit:hi,lib:{entry:"webcomponent/webcomponent.js",fileName(a,c){return r},formats:["iife"],name:"LikeC4Views"},commonjsOptions:{defaultIsModuleExports:a=>a.includes("react")?!0:"auto",requireReturnsDefault:"auto"},rollupOptions:{treeshake:{preset:"recommended"},output:{format:"iife",hoistTransitiveImports:!1,compact:!0}}},customLogger:s,plugins:[ai({languageServices:i,useOverviewGraph:!1})]}}const To=["favicon.ico","robots.txt"],Ro=async({buildWebcomponent:i=!0,webcomponentPrefix:e="likec4",languageServices:t,likec4AssetsDir:n,...r})=>{n??=await Zt(It(en(),".likec4-assets-"));const{isDev:s,...u}=await pi({...r,languageServices:t,likec4AssetsDir:n,webcomponentPrefix:e}),a=await di();for(const l of To){const f=Q(u.root,l);Ke(f)&&$i(f,Q(a,l))}const c=await t.diagrams();if(c.length===0)throw process.exitCode=1,new Error("no views found");if(c.forEach(l=>{l.hasLayoutDrift&&u.customLogger.warn(A.yellow("drift detected, manual layout can not be applied, view:")+" "+A.red(l.id))}),i){const l=await mi({webcomponentPrefix:e,languageServices:t,outDir:a,base:u.base});await xt(l)}await xt({...u,publicDir:a,mode:"production"});const h=Q(u.build.outDir,"index.html");Ke(h)&&$i(h,Q(u.build.outDir,"404.html"))};function Pr(i){if(i.resolvedUrls)return Fi(i.resolvedUrls.network)??Fi(i.resolvedUrls.local)}function Nr(i){if(!i.resolvedUrls)throw new Error("Vite server is not ready, no resolvedUrls");me.box([A.green("LikeC4 served at:"),"",A.dim("Local: ")+i.resolvedUrls.local.join(`
424
+ `}const Ru={id:"virtual:likec4/dot-sources",virtualId:"\0likec4-plugin/dot-sources.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/dot-sources"));const t=await i.viewsService.viewsAsGraphvizOut(),n=is(t,({id:r,svg:s,dot:o})=>[r,{dot:o,svg:s}]);return Pu(n)}},Uu={id:"virtual:likec4/d2-sources",virtualId:"\0likec4-plugin/d2-sources.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/d2-sources"));const t=await i.viewsService.computedViews();return Lu(t)}},Wu={id:"virtual:likec4/mmd-sources",virtualId:"\0likec4-plugin/mmd-sources.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/mmd-sources"));const t=await i.viewsService.computedViews();return Mu(t)}},Vu={id:"virtual:likec4/icons",virtualId:"\0likec4-plugin/icons.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/icons"));const t=await i.viewsService.computedViews();return Nu(t)}},zu={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(A.dim("generating virtual:likec4/overview-graph"));const n=await i.viewsService.overviewGraph();return kr(n)}catch(n){e.error(n)}return e.info(A.dim("generating empty virtual:likec4/overview-graph")),kr({nodes:[],edges:[],bounds:{x:0,y:0,width:10,height:10}})}},Mr={id:"virtual:likec4/previews",virtualId:"\0likec4-plugin/previews.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(A.dim("generating virtual:likec4/previews"));const n=await i.viewsService.computedViews();return Tu(n,t)}},Hu={id:"virtual:likec4/model",virtualId:"\0likec4-plugin/model.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(A.dim("generating virtual:likec4/model"));const n=await i.layoutedModel();return ku(n)}},di=[Vu,Ru,Uu,Wu,zu,Mr,Hu],Gu=i=>{const e=i.toLowerCase();return e.endsWith(".c4")||e.endsWith(".likec4")||e.endsWith(".like-c4")};function hi({useOverviewGraph:i=!1,languageServices:e}){let t,n=e.workspace;return{name:"vite-plugin-likec4",configResolved(r){if(t=r.logger,i){const s=r.resolve.alias.find(o=>o.find==="likec4/previews")?.replacement;s?(n=s,t.info(A.dim("likec4/previews alias")+" "+A.dim(n))):t.warn("likec4/previews alias not found")}},resolveId(r){const s=di.find(o=>o.id===r);return s?s.virtualId:null},async load(r){const s=di.find(o=>o.virtualId===r);return s?await s.load({logger:t,likec4:e,assetsDir:n,useOverviewGraph:i}):null},configureServer(r){const s=ns(1),o=()=>{s.clearQueue(),s(async()=>{const[h]=e.getErrors();if(h){r.ws.send({type:"error",err:{name:"LikeC4ValidationError",message:"Validation error: "+h.message.slice(0,500),stack:"",plugin:"vite-plugin-likec4",loc:{file:h.sourceFsPath,line:h.range.start.line+1,column:h.range.start.character+1}}});return}for(const l of di){const f=r.moduleGraph.getModuleById(l.virtualId);if(f&&f.importers.size>0){t.info(`${A.green("trigger hmr")} ${A.dim(f.url)}`);try{await r.reloadModule(f)}catch(p){t.error(p)}}}})},a=e.workspace;t.info(`${A.dim("watch")} ${a}`);const c=h=>l=>{Gu(l)&&e.notifyUpdate({[h]:l})};if(r.watcher.add(a).on("add",c("changed")).on("change",c("changed")).on("unlink",c("removed")),i&&!n.startsWith(e.workspace)){t.info(`${A.dim("watch")} ${n}`);const h=()=>{const l=r.moduleGraph.getModuleById(Mr.virtualId);l&&l.importers.size>0&&r.reloadModule(l)};r.watcher.add(n).on("add",h).on("change",h).on("unlink",h)}e.onModelUpdate(()=>{De.debug("likec4 model update"),o()})}}}const pi=async({languageServices:i,likec4AssetsDir:e,...t})=>{const n=t.customLogger??Le("c4:vite"),r=ei(),s=t?.useOverviewGraph===!0;n.info(`${A.cyan("likec4 app root")} ${A.dim(r)}`);const o=t.outputDir??J(i.workspace,"dist");n.info(A.cyan("output")+" "+A.dim(o));let a="/";t.base&&(a=rs(t.base),!ss(a)&&a!=="./"&&(a=os(a))),a!=="/"&&n.info(`${A.green("app base url")} ${A.dim(a)}`);const c=t.webcomponentPrefix??"likec4";return{isDev:!1,likec4AssetsDir:e,webcomponentPrefix:c,root:r,languageServices:i,clearScreen:!1,base:a,resolve:{alias:{...Fr(),"likec4/previews":e}},configFile:!1,mode:"production",optimizeDeps:{include:["likec4/model","likec4/react","react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client"],force:!0},define:{WEBCOMPONENT_PREFIX:JSON.stringify(c),__USE_STYLE_BUNDLE__:"false",__USE_OVERVIEW_GRAPH__:s?"true":"false",__USE_HASH_HISTORY__:t?.useHashHistory===!0?"true":"false","process.env.NODE_ENV":'"production"'},build:{outDir:o,modulePreload:!1,emptyOutDir:!1,cssCodeSplit:!1,sourcemap:!1,cssMinify:!0,minify:!0,copyPublicDir:!0,chunkSizeWarningLimit:ni,commonjsOptions:{defaultIsModuleExports:h=>h.includes("react")?!0:"auto"},rollupOptions:{treeshake:{preset:"recommended"},output:{hoistTransitiveImports:!1,compact:!0}}},customLogger:n,plugins:[hi({languageServices:i,useOverviewGraph:s})]}};async function mi({languageServices:i,outDir:e,base:t,webcomponentPrefix:n="likec4",filename:r="likec4-views.js"}){const s=Le("c4:lib"),o=ei();return s.info(A.cyan("outDir")+" "+A.dim(e)),{root:o,clearScreen:!1,base:t,configFile:!1,publicDir:!1,mode:"production",define:{WEBCOMPONENT_PREFIX:JSON.stringify(n),"process.env.NODE_ENV":'"production"'},esbuild:{...Zn},build:{outDir:e,emptyOutDir:!1,sourcemap:!1,minify:!0,assetsInlineLimit:100*1024,chunkSizeWarningLimit:ni,lib:{entry:"webcomponent/webcomponent.js",fileName(a,c){return r},formats:["iife"],name:"LikeC4Views"},commonjsOptions:{defaultIsModuleExports:a=>a.includes("react")?!0:"auto",requireReturnsDefault:"auto"},rollupOptions:{treeshake:{preset:"recommended"},output:{format:"iife",hoistTransitiveImports:!1,compact:!0}}},customLogger:s,plugins:[hi({languageServices:i,useOverviewGraph:!1})]}}const Yu=["favicon.ico","robots.txt"],qu=async({buildWebcomponent:i=!0,webcomponentPrefix:e="likec4",languageServices:t,likec4AssetsDir:n,...r})=>{n??=await Zt(It(en(),".likec4-assets-"));const{isDev:s,...o}=await pi({...r,languageServices:t,likec4AssetsDir:n,webcomponentPrefix:e}),a=await ti();for(const l of Yu){const f=J(o.root,l);Ke(f)&&Si(f,J(a,l))}const c=await t.diagrams();if(c.length===0)throw process.exitCode=1,new Error("no views found");if(c.forEach(l=>{l.hasLayoutDrift&&o.customLogger.warn(A.yellow("drift detected, manual layout can not be applied, view:")+" "+A.red(l.id))}),i){const l=await mi({webcomponentPrefix:e,languageServices:t,outDir:a,base:o.base});await jt(l)}await jt({...o,publicDir:a,mode:"production"});const h=J(o.build.outDir,"index.html");Ke(h)&&Si(h,J(o.build.outDir,"404.html"))};function Tr(i){if(i.resolvedUrls)return bi(i.resolvedUrls.network)??bi(i.resolvedUrls.local)}function Rr(i){if(!i.resolvedUrls)throw new Error("Vite server is not ready, no resolvedUrls");De.box([A.green("LikeC4 served at:"),"",A.dim("Local: ")+i.resolvedUrls.local.join(`
422
425
  `+"".padEnd(9," ")),A.dim("Network: ")+i.resolvedUrls.network.join(`
423
426
  `+"".padEnd(9," "))].join(`
424
- `))}class Mr extends Error{constructor(e){super(`${e} is locked`)}}const _t={old:new Set,young:new Set},Wo=1e3*15,En=1024,bn=65535;let Jt;const Uo=()=>{const i=Fs.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},kr=i=>new Promise((e,t)=>{const n=Os.createServer();n.unref(),n.on("error",t),n.listen(i,()=>{const{port:r}=n.address();n.close(()=>{e(r)})})}),Tr=async(i,e)=>{if(i.host||i.port===0)return kr(i);for(const t of e)try{await kr({port:i.port,host:t})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return i.port},Vo=function*(i){i&&(yield*i),yield 0};async function gi(i){let e,t=new Set;if(i&&(i.port&&(e=typeof i.port=="number"?[i.port]:i.port),i.exclude)){const r=i.exclude;if(typeof r[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(const s of r){if(typeof s!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(s))throw new TypeError(`Number ${s} in the exclude option is not a safe integer and can't be used`)}t=new Set(r)}Jt===void 0&&(Jt=setTimeout(()=>{Jt=void 0,_t.old=_t.young,_t.young=new Set},Wo),Jt.unref&&Jt.unref());const n=Uo();for(const r of Vo(e))try{if(t.has(r))continue;let s=await Tr({...i,port:r},n);for(;_t.old.has(s)||_t.young.has(s);){if(r!==0)throw new Mr(r);s=await Tr({...i,port:r},n)}return _t.young.add(s),s}catch(s){if(!["EADDRINUSE","EACCES"].includes(s.code)&&!(s instanceof Mr))throw s}throw new Error("No available ports found")}function Fn(i,e){if(!Number.isInteger(i)||!Number.isInteger(e))throw new TypeError("`from` and `to` must be integer numbers");if(i<En||i>bn)throw new RangeError(`'from' must be between ${En} and ${bn}`);if(e<En||e>bn)throw new RangeError(`'to' must be between ${En} and ${bn}`);if(i>e)throw new RangeError("`to` must be greater than or equal to `from`");return function*(n,r){for(let s=n;s<=r;s++)yield s}(i,e)}async function Rr({buildWebcomponent:i=!0,hmr:e=!0,webcomponentPrefix:t="likec4",languageServices:n,likec4AssetsDir:r,openBrowser:s,...u}){r??=await Zt(It(en(),".likec4-assets-"));const{isDev:a,...c}=await pi({...u,languageServices:n,likec4AssetsDir:r,webcomponentPrefix:t}),h=await gi({port:[5173,...Fn(61e3,61010),...Fn(62002,62010)]}),l=await gi({port:Fn(24678,24690)}),f=await di();let p;if(i){const F=await mi({webcomponentPrefix:t,languageServices:n,outDir:f,base:c.base});p=xt({...F,logLevel:"warn"}).catch(w=>(me.warn("webcomponent build failed",w),me.warn("Ignoring error and continuing"),Promise.resolve()))}const C=await vs({...c,define:Object.assign({},c.define,e&&{"process.env.NODE_ENV":'"development"'}),mode:e?"development":c.mode,publicDir:f,server:{host:"0.0.0.0",port:h,hmr:e&&{overlay:!0,port:l},fs:{strict:!1},open:s??!a}});return await C.listen(),p&&await p,C}async function zo({browserContext:i,views:e,output:t,logger:n,timeout:r,maxAttempts:s,outputType:u,theme:a}){let c;const h=e.map(p=>({view:p,attempt:1})),l=[];let f;for(;f=h.shift();){const{view:p,attempt:C}=f,F=`/export/${encodeURIComponent(p.id)}`;try{if(C>1){c&&(c.close({runBeforeUnload:!0}).catch(R=>n.error(`failed to close page: ${R}`)),c=void 0);const S=yi(C*200,{min:200,max:1e3});n.info(A.cyan(F)+A.dim(` attempt ${C} of ${s} after ${S}ms`)),await _s(S)}else p.hasLayoutDrift&&n.warn(A.yellow("Drift detected, manual layout can not be applied, view may be invalid: ")+A.red(p.id)),n.info(A.cyan(F));c??=await i.newPage(),await c.setViewportSize({width:p.bounds.width+20*2,height:p.bounds.height+20*2}),await c.goto(F+`?padding=20&theme=${a}`);const w=c.getByRole("presentation");await w.waitFor(),p.nodes.some(S=>bi(S.icon)&&S.icon.toLowerCase().startsWith("http"))&&await Ho(c,r);let m=".";u==="relative"&&(m=p.relativePath??".",m.includes("/")?m=m.slice(0,m.lastIndexOf("/")):m=".");const y=Q(t,m,`${p.id}.png`);await w.screenshot({path:y,omitBackground:!0}),l.push({view:p,path:y})}catch(w){c?.close({runBeforeUnload:!0}).catch(m=>n.error(`failed to close page: ${m}`)),n.error(A.red("failed "+F+`
425
- `+w)),C<s&&(h.push({view:p,attempt:C+1}),n.info(A.dim(`retry ${F}`))),c=void 0}}return l}async function Ho(i,e){let t=await i.locator("//img").all();if(!t.length)return;const n=t.map(r=>r.evaluate(s=>s.complete||new Promise((u,a)=>{s.onload=u,s.onerror=a}),{timeout:Math.max(3e4,e)}));await Promise.allSettled(n)}async function Wr({logger:i,serverUrl:e,theme:t="light",timeoutMs:n=15e3,views:r,output:s,outputType:u="relative",maxAttempts:a=3}){i.info(`${A.cyan("export output")} ${A.dim(s)}`),i.info(`${A.cyan("from server")} ${A.dim(e)}`);const c=ji.executablePath();i.info(A.cyan("Start chromium")),i.info(A.dim(c));const h=await ji.launch();i.info(A.cyan("Color scheme: ")+t);const l=await h.newContext({deviceScaleFactor:2,colorScheme:t,baseURL:e,ignoreHTTPSErrors:!0,reducedMotion:"reduce",isMobile:!1});l.setDefaultNavigationTimeout(n),l.setDefaultTimeout(n);try{return await zo({browserContext:l,views:r,output:s,outputType:u,logger:i,maxAttempts:a,timeout:n,theme:t})}finally{i.info(A.cyan("close chromium")),await l.close(),await h.close()}}async function Ur({path:i,useDotBin:e,theme:t="light",output:n,outputType:r,serverUrl:s,ignore:u=!1,timeoutMs:a=1e4,maxAttempts:c=3}){const h=Le("c4:export"),l=os(),f=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n??=f.workspace;const p=await f.diagrams();if(!rs(p,1))throw h.warn("no views found"),new Error("no views found");let C;if(!s&&(h.info(A.cyan("start preview server")),C=await Rr({languageServices:f,buildWebcomponent:!1,openBrowser:!1,useOverviewGraph:!1,hmr:!1}),s=Pr(C),!s))throw h.error("Vite server is not ready, no resolvedUrls"),new Error("Vite server is not ready, no resolvedUrls");try{const F=await Wr({logger:h,serverUrl:s,theme:t,timeoutMs:a,views:p,output:n,outputType:r,maxAttempts:c}),{pretty:w}=ss(l);if(F.length>0&&h.info(A.green(`exported ${F.length} views in ${w}`)),F.length!==p.length&&(u&&F.length>0?h.info(A.dim("ignore")+" "+A.red(`failed ${p.length-F.length} out of ${p.length} views`)):h.error(A.red(`failed ${p.length-F.length} out of ${p.length} views`))),F.length!==p.length&&(F.length===0||!u))throw new Error(`Failed ${p.length-F.length} out of ${p.length} views`)}finally{C&&(h.info(A.cyan("stop server")),await C.close().catch(F=>{h.error(F)}))}}const{cyan:Vr,dim:zr}=A;async function Go({path:i,useDotBin:e,useHashHistory:t,webcomponentPrefix:n,useOverview:r=!1,output:s,base:u}){const a=Le("c4:build"),c=await ze.fromWorkspace(i,{graphviz:e?"binary":"wasm",logger:"vite"}),h=s??Q(c.workspace,"dist");let l=Q(h,"assets");if(r)try{l=Q(h,"assets","previews"),await He(l,{recursive:!0}),a.info(`${Vr("Generate previews")} ${zr(l)}
426
- `),await Ur({path:i,useDotBin:e,output:l,outputType:"flat",ignore:!0})}catch(f){a.error(A.red("Failed to generate previews")),a.error(f),a.warn(A.yellow("Ignore previews and continue build")),xi(l,{recursive:!0,force:!0}),r=!1}await Ro({base:u,useHashHistory:t,customLogger:a,useOverviewGraph:r,webcomponentPrefix:n,languageServices:c,likec4AssetsDir:l,outputDir:s}),r&&(a.info(`${Vr("clean previews")} ${zr(l)}`),xi(l,{recursive:!0,force:!0}))}const Yo={command:"build [path]",aliases:["bundle"],describe:"Build a static website",builder:i=>i.positional("path",mn).option("output",{alias:"o",type:"string",desc:"output directory for production build",normalize:!0,coerce:Q}).option("base",Cr).option("use-hash-history",Dr).option("use-dot",ke).option("webcomponent-prefix",Qn).option("use-overview",wr).example(`${A.green("$0 build -o ./build ./src")}`,A.gray("Search for likec4 files in 'src' and output static site to 'build'")),handler:async i=>{await Go({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 qo(i,e,t){const n=".ts";e=e??Q(i.workspace,"likec4.generated"+n),$t(e)!==n&&(e=e+n),await He(bt(e),{recursive:!0});const r=await i.diagrams(),s=bo([...r]);await ot(e,s),t.info(`${A.dim("generated")} ${ut(process.cwd(),e)}`)}async function Jo(i,e,t){await He(e,{recursive:!0}),t.info(`${A.dim("format")} ${A.green("dot")}`),t.info(`${A.dim("outdir")} ${e}`);const n=new Set,r=await i.viewsService.layoutViews();let s=0;for(const{diagram:u,dot:a}of r)try{const c=u.relativePath??"";c!==""&&!n.has(c)&&(await He(Q(e,c),{recursive:!0}),n.add(c));const h=Q(e,c,u.id+".dot");Bn(a,`dot for ${u.id} not found`),await ot(h,a),t.info(`${A.dim("generated")} ${ut(process.cwd(),h)}`),s++}catch(c){t.error(`error while generating ${u.id}`,{error:c})}s>0&&t.info(`${A.dim("total")} ${s} files`)}async function Ko(i,e,t,n){await He(t,{recursive:!0}),n.info(`${A.dim("format")} ${A.green(e)}`),n.info(`${A.dim("outdir")} ${t}`);let r,s;switch(e){case"d2":r=".d2",s=_r;break;case"mermaid":r=".mmd",s=Sr;break;default:vi(e)}const u=new Set,a=await i.diagrams();let c=0;for(const h of a)try{let l=h.relativePath??".";l.includes("/")?l=l.slice(0,l.lastIndexOf("/")):l=".",l!==""&&!u.has(l)&&(await He(Q(t,l),{recursive:!0}),u.add(l));const f=Q(t,l,h.id+r),p=s(h);await ot(f,p),n.info(`${A.dim("generated")} ${ut(process.cwd(),f)}`),c++}catch(l){n.error(`error while generating ${h.id}`,{error:l})}c>0&&n.info(`${A.dim("total")} ${c} files`)}async function yn({path:i,useDotBin:e,...t}){const n=Le("c4:codegen"),r=St(n),s=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});if((await s.viewsService.computedViews()).length===0)throw n.warn("no views found"),process.exitCode=1,new Error("no views found");switch(t.format){case"views":{await qo(s,t.outfile,n);break}case"dot":{await Jo(s,t.outdir??i,n);break}case"d2":case"mermaid":{await Ko(s,t.format,t.outdir??i,n);break}default:vi(t)}r.stopAndLog()}async function Qo({path:i,useDotBin:e,outfile:t}){const n=Le("c4:codegen"),r=St(n),s=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n.info(`${A.dim("format")} ${A.green("model")}`);const u=await s.layoutedModel();for(const f of u.views())f.$view.hasLayoutDrift&&n.warn(A.yellow("drift detected, manual layout can not be applied, view:")+" "+A.red(f.id));let a=Q(s.workspace,"likec4-model.ts");if(t&&(a=_n(t)?t:Q(t),Ke(t)&&(await xn(t)).isDirectory()))throw new Error(`output file is a directory: ${t}`);const c=Xt(a);n.info(`${A.dim("filename")} ${c}`);const h=$t(c).toLocaleLowerCase();if(![".ts",".mts",".cts"].includes(h))throw n.error(`output file ${t} has extension "${h}"`),new Error(`output file ${t} must be a .ts, .mts or .cts file`);const l=bt(a);n.info(`${A.dim("outdir")} ${l}`),await He(l,{recursive:!0}),await ot(a,Ao(u),{encoding:"utf-8"}),me.box({message:On(`
427
+ `))}class Ur extends Error{constructor(e){super(`${e} is locked`)}}const St={old:new Set,young:new Set},Ju=1e3*15,bn=1024,Fn=65535;let Kt;const Ku=()=>{const i=Os.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},Wr=i=>new Promise((e,t)=>{const n=xs.createServer();n.unref(),n.on("error",t),n.listen(i,()=>{const{port:r}=n.address();n.close(()=>{e(r)})})}),Vr=async(i,e)=>{if(i.host||i.port===0)return Wr(i);for(const t of e)try{await Wr({port:i.port,host:t})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return i.port},Qu=function*(i){i&&(yield*i),yield 0};async function gi(i){let e,t=new Set;if(i&&(i.port&&(e=typeof i.port=="number"?[i.port]:i.port),i.exclude)){const r=i.exclude;if(typeof r[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(const s of r){if(typeof s!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(s))throw new TypeError(`Number ${s} in the exclude option is not a safe integer and can't be used`)}t=new Set(r)}Kt===void 0&&(Kt=setTimeout(()=>{Kt=void 0,St.old=St.young,St.young=new Set},Ju),Kt.unref&&Kt.unref());const n=Ku();for(const r of Qu(e))try{if(t.has(r))continue;let s=await Vr({...i,port:r},n);for(;St.old.has(s)||St.young.has(s);){if(r!==0)throw new Ur(r);s=await Vr({...i,port:r},n)}return St.young.add(s),s}catch(s){if(!["EADDRINUSE","EACCES"].includes(s.code)&&!(s instanceof Ur))throw s}throw new Error("No available ports found")}function yn(i,e){if(!Number.isInteger(i)||!Number.isInteger(e))throw new TypeError("`from` and `to` must be integer numbers");if(i<bn||i>Fn)throw new RangeError(`'from' must be between ${bn} and ${Fn}`);if(e<bn||e>Fn)throw new RangeError(`'to' must be between ${bn} and ${Fn}`);if(i>e)throw new RangeError("`to` must be greater than or equal to `from`");return function*(n,r){for(let s=n;s<=r;s++)yield s}(i,e)}async function zr({buildWebcomponent:i=!0,hmr:e=!0,webcomponentPrefix:t="likec4",languageServices:n,likec4AssetsDir:r,openBrowser:s,...o}){r??=await Zt(It(en(),".likec4-assets-"));const{isDev:a,...c}=await pi({...o,languageServices:n,likec4AssetsDir:r,webcomponentPrefix:t}),h=await gi({port:[5173,...yn(61e3,61010),...yn(62002,62010)]}),l=await gi({port:yn(24678,24690)}),f=await ti();let p;if(i){const F=await mi({webcomponentPrefix:t,languageServices:n,outDir:f,base:c.base});p=jt({...F,logLevel:"warn"}).catch(w=>(De.warn("webcomponent build failed",w),De.warn("Ignoring error and continuing"),Promise.resolve()))}const C=await $s({...c,define:Object.assign({},c.define,e&&{"process.env.NODE_ENV":'"development"'}),mode:e?"development":c.mode,publicDir:f,server:{host:"0.0.0.0",port:h,hmr:e&&{overlay:!0,port:l},fs:{strict:!1},open:s??!a}});return await C.listen(),p&&await p,C}async function Xu({browserContext:i,views:e,output:t,logger:n,timeout:r,maxAttempts:s,outputType:o,theme:a}){let c;const h=e.map(p=>({view:p,attempt:1})),l=[];let f;for(;f=h.shift();){const{view:p,attempt:C}=f,F=`/export/${encodeURIComponent(p.id)}`;try{if(C>1){c&&(c.close({runBeforeUnload:!0}).catch(R=>n.error(`failed to close page: ${R}`)),c=void 0);const S=Fi(C*200,{min:200,max:1e3});n.info(A.cyan(F)+A.dim(` attempt ${C} of ${s} after ${S}ms`)),await js(S)}else p.hasLayoutDrift&&n.warn(A.yellow("Drift detected, manual layout can not be applied, view may be invalid: ")+A.red(p.id)),n.info(A.cyan(F));c??=await i.newPage(),await c.setViewportSize({width:p.bounds.width+20*2,height:p.bounds.height+20*2}),await c.goto(F+`?padding=20&theme=${a}`);const w=c.getByRole("presentation");await w.waitFor(),p.nodes.some(S=>Ei(S.icon)&&S.icon.toLowerCase().startsWith("http"))&&await Zu(c,r);let m=".";o==="relative"&&(m=p.relativePath??".",m.includes("/")?m=m.slice(0,m.lastIndexOf("/")):m=".");const y=J(t,m,`${p.id}.png`);await w.screenshot({path:y,omitBackground:!0}),l.push({view:p,path:y})}catch(w){c?.close({runBeforeUnload:!0}).catch(m=>n.error(`failed to close page: ${m}`)),n.error(A.red("failed "+F+`
428
+ `+w)),C<s&&(h.push({view:p,attempt:C+1}),n.info(A.dim(`retry ${F}`))),c=void 0}}return l}async function Zu(i,e){let t=await i.locator("//img").all();if(!t.length)return;const n=t.map(r=>r.evaluate(s=>s.complete||new Promise((o,a)=>{s.onload=o,s.onerror=a}),{timeout:Math.max(3e4,e)}));await Promise.allSettled(n)}async function Hr({logger:i,serverUrl:e,theme:t="light",timeoutMs:n=15e3,views:r,output:s,outputType:o="relative",maxAttempts:a=3}){i.info(`${A.cyan("export output")} ${A.dim(s)}`),i.info(`${A.cyan("from server")} ${A.dim(e)}`);const c=Li.executablePath();i.info(A.cyan("Start chromium")),i.info(A.dim(c));const h=await Li.launch();i.info(A.cyan("Color scheme: ")+t);const l=await h.newContext({deviceScaleFactor:2,colorScheme:t,baseURL:e,ignoreHTTPSErrors:!0,reducedMotion:"reduce",isMobile:!1});l.setDefaultNavigationTimeout(n),l.setDefaultTimeout(n);try{return await Xu({browserContext:l,views:r,output:s,outputType:o,logger:i,maxAttempts:a,timeout:n,theme:t})}finally{i.info(A.cyan("close chromium")),await l.close(),await h.close()}}async function Gr({path:i,useDotBin:e,theme:t="light",output:n,outputType:r,serverUrl:s,ignore:o=!1,timeoutMs:a=1e4,maxAttempts:c=3}){const h=Le("c4:export"),l=ls(),f=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n??=f.workspace;const p=await f.diagrams();if(!Ss(p,1))throw h.warn("no views found"),new Error("no views found");let C;if(!s&&(h.info(A.cyan("start preview server")),C=await zr({languageServices:f,buildWebcomponent:!1,openBrowser:!1,useOverviewGraph:!1,hmr:!1}),s=Tr(C),!s))throw h.error("Vite server is not ready, no resolvedUrls"),new Error("Vite server is not ready, no resolvedUrls");try{const F=await Hr({logger:h,serverUrl:s,theme:t,timeoutMs:a,views:p,output:n,outputType:r,maxAttempts:c}),{pretty:w}=us(l);if(F.length>0&&h.info(A.green(`exported ${F.length} views in ${w}`)),F.length!==p.length&&(o&&F.length>0?h.info(A.dim("ignore")+" "+A.red(`failed ${p.length-F.length} out of ${p.length} views`)):h.error(A.red(`failed ${p.length-F.length} out of ${p.length} views`))),F.length!==p.length&&(F.length===0||!o))throw new Error(`Failed ${p.length-F.length} out of ${p.length} views`)}finally{C&&(h.info(A.cyan("stop server")),await C.close().catch(F=>{h.error(F)}))}}const{cyan:Yr,dim:qr}=A;async function ea({path:i,useDotBin:e,useHashHistory:t,webcomponentPrefix:n,useOverview:r=!1,output:s,base:o}){const a=Le("c4:build"),c=await ze.fromWorkspace(i,{graphviz:e?"binary":"wasm",logger:"vite"}),h=s??J(c.workspace,"dist");let l=J(h,"assets");if(r)try{l=J(h,"assets","previews"),await He(l,{recursive:!0}),a.info(`${Yr("Generate previews")} ${qr(l)}
429
+ `),await Gr({path:i,useDotBin:e,output:l,outputType:"flat",ignore:!0})}catch(f){a.error(A.red("Failed to generate previews")),a.error(f),a.warn(A.yellow("Ignore previews and continue build")),$i(l,{recursive:!0,force:!0}),r=!1}await qu({base:o,useHashHistory:t,customLogger:a,useOverviewGraph:r,webcomponentPrefix:n,languageServices:c,likec4AssetsDir:l,outputDir:s}),r&&(a.info(`${Yr("clean previews")} ${qr(l)}`),$i(l,{recursive:!0,force:!0}))}const ta={command:"build [path]",aliases:["bundle"],describe:"Build a static website",builder:i=>i.positional("path",mn).option("output",{alias:"o",type:"string",desc:"output directory for production build",normalize:!0,coerce:J}).option("base",wr).option("use-hash-history",Cr).option("use-dot",Me).option("webcomponent-prefix",Xn).option("use-overview",Ar).example(`${A.green("$0 build -o ./build ./src")}`,A.gray("Search for likec4 files in 'src' and output static site to 'build'")),handler:async i=>{await ea({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 na(i,e,t){const n=".ts";e=e??J(i.workspace,"likec4.generated"+n),xt(e)!==n&&(e=e+n),await He(ot(e),{recursive:!0});const r=await i.diagrams(),s=xu([...r]);await at(e,s),t.info(`${A.dim("generated")} ${ut(process.cwd(),e)}`)}async function ia(i,e,t){await He(e,{recursive:!0}),t.info(`${A.dim("format")} ${A.green("dot")}`),t.info(`${A.dim("outdir")} ${e}`);const n=new Set,r=await i.viewsService.layoutViews();let s=0;for(const{diagram:o,dot:a}of r)try{const c=o.relativePath??"";c!==""&&!n.has(c)&&(await He(J(e,c),{recursive:!0}),n.add(c));const h=J(e,c,o.id+".dot");jn(a,`dot for ${o.id} not found`),await at(h,a),t.info(`${A.dim("generated")} ${ut(process.cwd(),h)}`),s++}catch(c){t.error(`error while generating ${o.id}`,{error:c})}s>0&&t.info(`${A.dim("total")} ${s} files`)}async function ra(i,e,t,n){await He(t,{recursive:!0}),n.info(`${A.dim("format")} ${A.green(e)}`),n.info(`${A.dim("outdir")} ${t}`);let r,s;switch(e){case"d2":r=".d2",s=Pr;break;case"mermaid":r=".mmd",s=Nr;break;default:ji(e)}const o=new Set,a=await i.diagrams();let c=0;for(const h of a)try{let l=h.relativePath??".";l.includes("/")?l=l.slice(0,l.lastIndexOf("/")):l=".",l!==""&&!o.has(l)&&(await He(J(t,l),{recursive:!0}),o.add(l));const f=J(t,l,h.id+r),p=s(h);await at(f,p),n.info(`${A.dim("generated")} ${ut(process.cwd(),f)}`),c++}catch(l){n.error(`error while generating ${h.id}`,{error:l})}c>0&&n.info(`${A.dim("total")} ${c} files`)}async function vn({path:i,useDotBin:e,...t}){const n=Le("c4:codegen"),r=$t(n),s=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});if((await s.viewsService.computedViews()).length===0)throw n.warn("no views found"),process.exitCode=1,new Error("no views found");switch(t.format){case"views":{await na(s,t.outfile,n);break}case"dot":{await ia(s,t.outdir??i,n);break}case"d2":case"mermaid":{await ra(s,t.format,t.outdir??i,n);break}default:ji(t)}r.stopAndLog()}async function sa({path:i,useDotBin:e,outfile:t}){const n=Le("c4:codegen"),r=$t(n),s=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n.info(`${A.dim("format")} ${A.green("model")}`);const o=await s.layoutedModel();for(const f of o.views())f.$view.hasLayoutDrift&&n.warn(A.yellow("drift detected, manual layout can not be applied, view:")+" "+A.red(f.id));let a=J(s.workspace,"likec4-model.ts");if(t&&(a=_n(t)?t:J(t),Ke(t)&&(await xn(t)).isDirectory()))throw new Error(`output file is a directory: ${t}`);const c=Xt(a);n.info(`${A.dim("filename")} ${c}`);const h=xt(c).toLocaleLowerCase();if(![".ts",".mts",".cts"].includes(h))throw n.error(`output file ${t} has extension "${h}"`),new Error(`output file ${t} must be a .ts, .mts or .cts file`);const l=ot(a);n.info(`${A.dim("outdir")} ${l}`),await He(l,{recursive:!0}),await at(a,$u(o),{encoding:"utf-8"}),De.box({message:On(`
427
430
  ${A.dim("Source with LikeC4Model generated:")}
428
431
  ${ut(Sn(),a)}
429
432
 
430
433
  ${A.dim("How to use:")}
431
434
  ${A.underline("https://likec4.dev/tooling/code-generation/model/")}
432
- `).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),r.stopAndLog()}async function Xo({languageServices:i,outDir:e,filename:t="likec4-react.mjs"}){const n=Le("c4:react"),r=fi();return n.info(`${A.cyan("likec4 app root")} ${A.dim(r)}`),n.info(A.cyan("outDir")+" "+A.dim(e)),{customLogger:n,root:r,configFile:!1,clearScreen:!1,publicDir:!1,mode:"production",esbuild:{banner:`'use client'
433
- `+li.banner,footer:li.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:hi,lib:{entry:"react/likec4.tsx",fileName(s,u){return t},formats:["es"]},rollupOptions:{output:{compact:!1,exports:"named"},external:["likec4/react","react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client",/likec4\/icons\/.*/],onwarn(s,u){s.code!=="SOURCEMAP_ERROR"&&u(s)}}},plugins:[Ss({}),ai({languageServices:i,useOverviewGraph:!1})]}}async function Zo({path:i,useDotBin:e,outfile:t}){const n=Le("c4:codegen"),r=St(n),s=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n.info(`${A.dim("format")} ${A.green("react")}`);const u=await s.diagrams();if(u.length===0)throw process.exitCode=1,new Error("no views found");u.forEach(C=>{C.hasLayoutDrift&&n.warn(A.yellow("drift detected, manual layout can not be applied, view:")+" "+A.red(C.id))});let a=Q(s.workspace,"likec4-views.js");if(t&&(a=_n(t)?t:Q(t),Ke(t)&&(await xn(t)).isDirectory()))throw new Error(`output file is a directory: ${t}`);const c=bt(a);n.info(`${A.dim("outdir")} ${c}`);const h=Xt(a);n.info(`${A.dim("filename")} ${h}`);const l=$t(h).toLocaleLowerCase();if(![".js",".mjs",".jsx"].includes(l))throw n.error(`output file ${t} has extension "${l}"`),new Error(`output file ${t} must be a .js, .jsx or .mjs`);const f=await Xo({languageServices:s,outDir:c,filename:h});await xt({...f,logLevel:"warn"});const p=await s.layoutedModel();await ot(Q(c,Xt(a,l)+(l===".mjs"?".d.mts":".d.ts")),Fo(p)),me.box({message:On(`
435
+ `).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),r.stopAndLog()}async function oa({languageServices:i,outDir:e,filename:t="likec4-react.mjs"}){const n=Le("c4:react"),r=ei();return n.info(`${A.cyan("likec4 app root")} ${A.dim(r)}`),n.info(A.cyan("outDir")+" "+A.dim(e)),{customLogger:n,root:r,configFile:!1,clearScreen:!1,publicDir:!1,mode:"production",resolve:{conditions:["production"],alias:Fr()},esbuild:{banner:`'use client'
436
+ `+Zn.banner,footer:Zn.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:ni,lib:{entry:"react/likec4.tsx",fileName(s,o){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(s,o){s.code!=="SOURCEMAP_ERROR"&&o(s)}}},plugins:[Ls({}),hi({languageServices:i,useOverviewGraph:!1})]}}async function ua({path:i,useDotBin:e,outfile:t}){const n=Le("c4:codegen"),r=$t(n),s=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n.info(`${A.dim("format")} ${A.green("react")}`);const o=await s.diagrams();if(o.length===0)throw process.exitCode=1,new Error("no views found");o.forEach(C=>{C.hasLayoutDrift&&n.warn(A.yellow("drift detected, manual layout can not be applied, view:")+" "+A.red(C.id))});let a=J(s.workspace,"likec4-views.js");if(t&&(a=_n(t)?t:J(t),Ke(t)&&(await xn(t)).isDirectory()))throw new Error(`output file is a directory: ${t}`);const c=ot(a);n.info(`${A.dim("outdir")} ${c}`);const h=Xt(a);n.info(`${A.dim("filename")} ${h}`);const l=xt(h).toLocaleLowerCase();if(![".js",".mjs",".jsx"].includes(l))throw n.error(`output file ${t} has extension "${l}"`),new Error(`output file ${t} must be a .js, .jsx or .mjs`);const f=await oa({languageServices:s,outDir:c,filename:h});await jt({...f,logLevel:"warn"});const p=await s.layoutedModel();await at(J(c,Xt(a,l)+(l===".mjs"?".d.mts":".d.ts")),ju(p)),De.box({message:On(`
434
437
  ${A.dim("Source generated:")}
435
438
  ${ut(Sn(),a)}
436
439
 
437
440
  ${A.dim("How to use:")}
438
441
  ${A.underline("https://likec4.dev/tooling/code-generation/react/")}
439
- `).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),r.stopAndLog()}async function ea({path:i,useDotBin:e,webcomponentPrefix:t="likec4",outfile:n}){const r=Le("c4:codegen"),s=St(r),u=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});r.info(`${A.dim("format")} ${A.green("webcomponent")}`);const a=await u.diagrams();if(!Bi(a,1))throw r.warn("no views found"),process.exitCode=1,new Error("no views found");a.forEach(F=>{F.hasLayoutDrift&&r.warn(A.yellow("drift detected, manual layout can not be applied, view:")+" "+A.red(F.id))});let c=Q(u.workspace,"likec4-views.js");if(n&&(c=_n(n)?n:Q(n),Ke(n)&&(await xn(n)).isDirectory()))throw new Error(`output file is a directory: ${n}`);me.debug(`${A.dim("outfilepath")} ${c}`);const h=Xt(c);me.debug(`${A.dim("filename")} ${h}`);const l=$t(h).toLocaleLowerCase();if(l!==".js"&&l!==".mjs")throw me.warn(`output file ${n} has extension "${l}"`),new Error(`output file ${n} must be a .js or .mjs`);const f=await di();me.debug(`${A.dim("created temp public")} ${f}`);const p=await mi({languageServices:u,outDir:f,filename:h,webcomponentPrefix:t,base:"/"});me.debug(`${A.dim("vite build webcomponent")}`),await xt({...p,logLevel:"warn"});const C=Q(f,h);if(!Ke(C))throw new Error(`output file not found: ${C}`);await He(bt(c),{recursive:!0}),await Es(C,c),r.info(`${A.dim("generated")} ${c}`),me.debug(`${A.dim("remove temp public")}`),await bs(f,{recursive:!0,force:!0}),me.box(On(`
442
+ `).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),r.stopAndLog()}async function aa({path:i,useDotBin:e,webcomponentPrefix:t="likec4",outfile:n}){const r=Le("c4:codegen"),s=$t(r),o=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});r.info(`${A.dim("format")} ${A.green("webcomponent")}`);const a=await o.diagrams();if(!yi(a,1))throw r.warn("no views found"),process.exitCode=1,new Error("no views found");a.forEach(F=>{F.hasLayoutDrift&&r.warn(A.yellow("drift detected, manual layout can not be applied, view:")+" "+A.red(F.id))});let c=J(o.workspace,"likec4-views.js");if(n&&(c=_n(n)?n:J(n),Ke(n)&&(await xn(n)).isDirectory()))throw new Error(`output file is a directory: ${n}`);De.debug(`${A.dim("outfilepath")} ${c}`);const h=Xt(c);De.debug(`${A.dim("filename")} ${h}`);const l=xt(h).toLocaleLowerCase();if(l!==".js"&&l!==".mjs")throw De.warn(`output file ${n} has extension "${l}"`),new Error(`output file ${n} must be a .js or .mjs`);const f=await ti();De.debug(`${A.dim("created temp public")} ${f}`);const p=await mi({languageServices:o,outDir:f,filename:h,webcomponentPrefix:t,base:"/"});De.debug(`${A.dim("vite build webcomponent")}`),await jt({...p,logLevel:"warn"});const C=J(f,h);if(!Ke(C))throw new Error(`output file not found: ${C}`);await He(ot(c),{recursive:!0}),await vs(C,c),r.info(`${A.dim("generated")} ${c}`),De.debug(`${A.dim("remove temp public")}`),await Bs(f,{recursive:!0,force:!0}),De.box(On(`
440
443
  ${A.dim("Webcomponents generated to:")}
441
444
  ${ut(Sn(),c)}
442
445
 
443
446
  ${A.dim("Setup and usage instructions:")}
444
447
  ${A.blue("https://likec4.dev/tooling/code-generation/webcomponent/")}
445
- `)),s.stopAndLog()}const ta={command:"codegen <command> [path]",aliases:["generate","gen"],describe:"Generate various artifacts from LikeC4 sources",builder:i=>i.positional("path",mn).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:ve}).option("use-dot",ke),async e=>{await Zo({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:ve}).option("webcomponent-prefix",Qn).option("use-dot",ke),handler:async e=>{await ea({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:ve}).option("use-dot",ke),handler:async e=>{await Qo({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:ve}).option("use-dot",ke),handler:async e=>{await yn({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",gn).option("use-dot",ke),handler:async e=>{await yn({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",gn).option("use-dot",ke),handler:async e=>{await yn({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",gn).option("use-dot",ke),handler:async e=>{await yn({format:"mermaid",useDotBin:e.useDotBin,path:e.path,outdir:e.outdir})}}).epilog(`${A.bold("Examples:")}
448
+ `)),s.stopAndLog()}const ca={command:"codegen <command> [path]",aliases:["generate","gen"],describe:"Generate various artifacts from LikeC4 sources",builder:i=>i.positional("path",mn).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:ve}).option("use-dot",Me),async e=>{await ua({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:ve}).option("webcomponent-prefix",Xn).option("use-dot",Me),handler:async e=>{await aa({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:ve}).option("use-dot",Me),handler:async e=>{await sa({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:ve}).option("use-dot",Me),handler:async e=>{await vn({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",gn).option("use-dot",Me),handler:async e=>{await vn({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",gn).option("use-dot",Me),handler:async e=>{await vn({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",gn).option("use-dot",Me),handler:async e=>{await vn({format:"mermaid",useDotBin:e.useDotBin,path:e.path,outdir:e.outdir})}}).epilog(`${A.bold("Examples:")}
446
449
  likec4 gen react -o dist/likec4-views.mjs ./src/likec4
447
450
  likec4 gen model -o likec4-model.ts
448
451
  likec4 gen webcomponent -o likec4.js --webcomponent-prefix c4 --use-dot-bin ./src
@@ -450,17 +453,17 @@ ${i.join(`
450
453
  likec4 gen ts --outfile ../likec4.ts
451
454
  likec4 gen mmd --outdir assets/
452
455
  likec4 gen dot -o out .
453
- `),handler:()=>{}};async function na({path:i,useDotBin:e,outfile:t}){const n=Le("c4:export"),r=St(n),s=await(await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"})).layoutedModel();$t(t)!==".json"&&(t=t+".json"),await He(bt(t),{recursive:!0});const u=JSON.stringify(s.$model,null,2);await ot(t,u),n.info(`${A.dim("generated")} ${ut(process.cwd(),t)}`),r.stopAndLog("\u2713 export in ")}const ia={command:"export <format> [path]",describe:"Export to images or JSON",builder:i=>i.usage(`${A.bold("Usage:")} $0 export <format> [path]`).positional("path",mn).command({command:"png [path]",describe:"export views to PNG",builder:e=>e.option("output",gn).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",ke).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(`${A.bold("Examples:")}
456
+ `),handler:()=>{}};async function la({path:i,useDotBin:e,outfile:t}){const n=Le("c4:export"),r=$t(n),s=await(await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"})).layoutedModel();xt(t)!==".json"&&(t=t+".json"),await He(ot(t),{recursive:!0});const o=JSON.stringify(s.$model,null,2);await at(t,o),n.info(`${A.dim("generated")} ${ut(process.cwd(),t)}`),r.stopAndLog("\u2713 export in ")}const fa={command:"export <format> [path]",describe:"Export to images or JSON",builder:i=>i.usage(`${A.bold("Usage:")} $0 export <format> [path]`).positional("path",mn).command({command:"png [path]",describe:"export views to PNG",builder:e=>e.option("output",gn).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",Me).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(`${A.bold("Examples:")}
454
457
  ${A.green("$0 export png")}
455
458
  ${A.gray("Search for likec4 files in current directory and output PNG next to sources")}
456
459
 
457
460
  ${A.green("$0 export png --theme dark -o ./png src/likec4 ")}
458
461
  ${A.gray("Search for likec4 files in src/likec4 and output PNG with dark theme to png folder")}
459
- `),handler:async e=>{Bn(e.timeout>=1,"timeout must be >= 1"),Bn(e["max-attempts"]>=1,"max-attempts must be >= 1"),await Ur({path:e.path,useDotBin:e.useDotBin,output:e.output,timeoutMs:e.timeout*1e3,maxAttempts:e.maxAttempts,ignore:e.ignore===!0,outputType:e.flat?"flat":"relative",serverUrl:e.serverUrl,theme:e.theme??"light"})}}).command({command:"json [path]",describe:"export model to JSON",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> output .json file",default:"likec4.json",normalize:!0,coerce:Q}).option("use-dot",ke).epilog(`${A.bold("Examples:")}
462
+ `),handler:async e=>{jn(e.timeout>=1,"timeout must be >= 1"),jn(e["max-attempts"]>=1,"max-attempts must be >= 1"),await Gr({path:e.path,useDotBin:e.useDotBin,output:e.output,timeoutMs:e.timeout*1e3,maxAttempts:e.maxAttempts,ignore:e.ignore===!0,outputType:e.flat?"flat":"relative",serverUrl:e.serverUrl,theme:e.theme??"light"})}}).command({command:"json [path]",describe:"export model to JSON",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> output .json file",default:"likec4.json",normalize:!0,coerce:J}).option("use-dot",Me).epilog(`${A.bold("Examples:")}
460
463
  ${A.green("$0 export json")}
461
464
  ${A.gray("Search for likec4 files in current directory and output JSON to likec4.json")}
462
465
 
463
466
  ${A.green("$0 export json -o ./generated/likec4.json src/likec4 ")}
464
467
  ${A.gray("Search for likec4 files in src/likec4 and output JSON to generated/likec4.json")}
465
- `),handler:async e=>{await na({path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).updateStrings({"Commands:":A.bold("Formats:")}),handler:()=>{}};async function ra(i){const{isDev:e,...t}=await pi({...i,likec4AssetsDir:"",webcomponentPrefix:void 0}),n=await gi({port:Fn(62001,62010)}),r=i?.open??!1;return await Bs({...t,mode:"production",preview:{host:"0.0.0.0",port:n,open:r}})}async function sa({path:i,output:e,base:t}){const n=await ze.fromWorkspace(i,{logger:"vite"}),r=await ra({base:t,languageServices:n,outputDir:e,open:!0});Nr(r)}const ua={command:"preview [path]",describe:"Start local server to preview production build",builder:i=>i.positional("path",{type:"string",desc:`Directory with LikeC4 source files
466
- 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"],ve).default("path",ve("."),"."),async handler(i){await sa(i)}};async function oa({path:i,useDotBin:e,webcomponentPrefix:t,useHashHistory:n,useOverview:r=!1,base:s}){const u=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"}),a=await Zt(It(en(),".likec4-assets-")),c=await Rr({buildWebcomponent:!1,hmr:!0,base:s,webcomponentPrefix:t,languageServices:u,useHashHistory:n,useOverviewGraph:r,likec4AssetsDir:a});if(c.config.logger.clearScreen("info"),Nr(c),!r)return;const h=await u.diagrams();if(Bi(h,1)){const l=Le("c4:export"),f=Pr(c);if(!f){l.error("no preview server url");return}l.info(A.cyan("wait 5sec before generating previews")),await Oi(5e3);try{await Wr({serverUrl:f,logger:l,views:h,theme:"light",output:a,outputType:"flat"}),await Oi(1e3),l.info(A.yellow("Note: changes in sources do not trigger preview updates, restart is required"))}catch(p){l.error(A.red("Failed to generate previews")),l.error(p)}}else c.config.logger.warn("no views found, no previews generated")}const aa={command:"start [path]",aliases:["serve","dev"],describe:"Start local dev server to preview LikeC4 views",builder:i=>i.positional("path",mn).option("base",Cr).option("webcomponent-prefix",Qn).option("use-hash-history",Dr).option("use-overview",wr).option("use-dot",ke),handler:async i=>{await oa({path:i.path,useDotBin:i["use-dot"],base:i.base,useOverview:i["use-overview"]??!1,webcomponentPrefix:i["webcomponent-prefix"],useHashHistory:i["use-hash-history"]})}};me.level=_i.debug,process.env.NODE_ENV==="development"&&(me.level=_i.trace,me.warn("running cli in dev mode"));const ca=Iu(Js(ls)).scriptName("likec4").usage("Usage: $0 <command>").command(aa).command(Yo).command(ta).command(ia).command(ua).help("help").version(us.version).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:":A.bold("Options:"),"Positionals:":A.bold("Arguments:"),"Commands:":A.bold("Commands:"),"Examples:":A.bold("Examples:")}).wrap(yi(as.columns-20,{min:80,max:120})).parseAsync();ca.catch(()=>cs(1)),process.on("unhandledRejection",i=>{me.error(i)});
468
+ `),handler:async e=>{await la({path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).updateStrings({"Commands:":A.bold("Formats:")}),handler:()=>{}};async function da(i){const{isDev:e,...t}=await pi({...i,likec4AssetsDir:"",webcomponentPrefix:void 0}),n=await gi({port:yn(62001,62010)}),r=i?.open??!1;return await Is({...t,mode:"production",preview:{host:"0.0.0.0",port:n,open:r}})}async function ha({path:i,output:e,base:t}){const n=await ze.fromWorkspace(i,{logger:"vite"}),r=await da({base:t,languageServices:n,outputDir:e,open:!0});Rr(r)}const pa={command:"preview [path]",describe:"Start local server to preview production build",builder:i=>i.positional("path",{type:"string",desc:`Directory with LikeC4 source files
469
+ 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"],ve).default("path",ve("."),"."),async handler(i){await ha(i)}};async function ma({path:i,useDotBin:e,webcomponentPrefix:t,useHashHistory:n,useOverview:r=!1,base:s}){const o=await ze.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"}),a=await Zt(It(en(),".likec4-assets-")),c=await zr({buildWebcomponent:!Ps,hmr:!0,base:s,webcomponentPrefix:t,languageServices:o,useHashHistory:n,useOverviewGraph:r,likec4AssetsDir:a});if(c.config.logger.clearScreen("info"),Rr(c),!r)return;const h=await o.diagrams();if(yi(h,1)){const l=Le("c4:export"),f=Tr(c);if(!f){l.error("no preview server url");return}l.info(A.cyan("wait 5sec before generating previews")),await vi(5e3);try{await Hr({serverUrl:f,logger:l,views:h,theme:"light",output:a,outputType:"flat"}),await vi(1e3),l.info(A.yellow("Note: changes in sources do not trigger preview updates, restart is required"))}catch(p){l.error(A.red("Failed to generate previews")),l.error(p)}}else c.config.logger.warn("no views found, no previews generated")}const ga={command:"start [path]",aliases:["serve","dev"],describe:"Start local dev server to preview LikeC4 views",builder:i=>i.positional("path",mn).option("base",wr).option("webcomponent-prefix",Xn).option("use-hash-history",Cr).option("use-overview",Ar).option("use-dot",Me),handler:async i=>{await ma({path:i.path,useDotBin:i["use-dot"],base:i.base,useOverview:i["use-overview"]??!1,webcomponentPrefix:i["webcomponent-prefix"],useHashHistory:i["use-hash-history"]})}};De.level=as.debug;const Da=ko(to(hs)).scriptName("likec4").usage("Usage: $0 <command>").command(ga).command(ta).command(ca).command(fa).command(pa).help("help").version(cs).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:":A.bold("Options:"),"Positionals:":A.bold("Arguments:"),"Commands:":A.bold("Commands:"),"Examples:":A.bold("Examples:")}).wrap(Fi(fs.columns-20,{min:80,max:120})).parseAsync();Da.catch(()=>ds(1)),process.on("unhandledRejection",i=>{De.error(i)});