likec4 1.46.2 → 1.46.3
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.
- package/__app__/src/style.css +1 -1
- package/__app__/src/vendors.js +88 -65
- package/dist/cli/index.mjs +349 -342
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{likec4.Ds1BAAT3.mjs → likec4.4c1Hb6hc.mjs} +2465 -2455
- package/dist/shared/{likec4.Dawj4DWo.mjs → likec4.fwpDnke2.mjs} +35 -28
- package/dist/shared/{likec4.LnxAaQKk.d.mts → likec4.iyEJ8QdJ.d.mts} +19 -8
- package/dist/vite-plugin/index.d.mts +1 -1
- package/dist/vite-plugin/index.mjs +1 -1
- package/package.json +18 -18
- package/react/index.js +88 -65
package/dist/cli/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{h as ve,r as
|
|
3
|
-
rmSync as
|
|
4
|
-
writeFile as
|
|
5
|
-
import{invariant as
|
|
6
|
-
function
|
|
7
|
-
use-dot-bin",boolean:!0,type:"boolean",desc:
|
|
8
|
-
4" generates <c4-view ../>',default:"likec4",nargs:1},
|
|
9
|
-
ip address of the network interface to listen on"},nargs:1},
|
|
10
|
-
join(
|
|
2
|
+
import{h as ve,r as _c,k as He,l as cs,m as rt,u as y,w as us,o as Cc,p as xc,q as ge,s as ls,v as yt,x as Te,y as Tc,d as fs,z as ps,A as Ic,c as Oc,L as ye,B as Lc,j as ds,C as kc,D as nt,E as sr,F as Nc,G as hs,H as wt,I as ms,J as Pc,K as jc,M as Dc,O as qc,P as Hc,Q as Ie,R as Mc,S as Uc,U as Fc,V as Gc,W as Bc,X as Vc,Y as zc,Z as Wc,e as Xc,_ as Ge,$ as ir,a0 as Be,a1 as or,a2 as ar,a3 as gs,a4 as ys}from"../shared/likec4.4c1Hb6hc.mjs";import B,{existsSync as _e,copyFileSync as ws,readdirSync as Kc,
|
|
3
|
+
rmSync as cr,statSync as Yc}from"node:fs";import re,{hrtime as Jc,cwd as vt,exit as vs,argv as Qc,stdout as Zc}from"node:process";import{b as $s,t as bs,a as eu,d as st}from"../shared/likec4.CB2-Uaub.mjs";import{env as Es,isMinimal as tu,nodeENV as ru,isDevelopment as nu}from"std-env";import su from"yargs";import{hideBin as iu}from"yargs/helpers";import W,{resolve as z,dirname as Re,join as it,relative as Ce,sep as Rs,extname as ot,isAbsolute as ur,basename as $t}from"node:path";import Ss,{mkdtemp as bt,
|
|
4
|
+
writeFile as Oe,mkdir as Se,stat as lr,copyFile as ou,rm as au}from"node:fs/promises";import at,{tmpdir as Et}from"node:os";import{fileURLToPath as As}from"node:url";import fr from"@vitejs/plugin-react";import _s from"util";import pr,{resolve as Ve}from"path";import{j as Cs,e as xs,C as cu,t as Ts,N as ze,L as dr,g as uu,a as lu,b as fu}from"../shared/likec4.fwpDnke2.mjs";import{build as ct,createServer as pu,preview as du}from"vite";import hu from"node:module";import mu from"node:net";import{setTimeout as gu}from"node:timers/promises";
|
|
5
|
+
import{invariant as hr,nonexhaustive as mr}from"@likec4/core";import{promisify as ae,isDeepStrictEqual as Is}from"node:util";import Me from"node:crypto";import Os from"node:assert";import{a as We}from"../shared/likec4.DASl7M77.mjs";import{isDeploymentRelationModel as yu,isRelationModel as wu,isDeploymentElementModel as vu,isLikeC4ViewModel as $u,isElementModel as bu}from"@likec4/core/model";import{compareNatural as Eu,sortNaturalByFqn as Ru,invariant as Su,delay as Ls}from"@likec4/core/utils";let gr;
|
|
6
|
+
function Au(){try{return B.statSync("/.dockerenv"),!0}catch{return!1}}function _u(){try{return B.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Cu(){return gr===void 0&&(gr=Au()||_u()),gr}let yr;const xu=()=>{try{return B.statSync("/run/.containerenv"),!0}catch{return!1}};function Le(){return yr===void 0&&(yr=xu()||Cu()),yr}const pe={type:"string",desc:"<directory> with LikeC4 sources (default is current directory)",normalize:!0,default:".",coerce:z},he={alias:"\
|
|
7
|
+
use-dot-bin",boolean:!0,type:"boolean",desc:Le()?"enabled in container, disable by --no-use-dot":'use graphviz binaries ("dot" should be on PATH)',default:Le()},ks={boolean:!0,type:"boolean",desc:"use `@likec4/core` package in types",default:!1},Ns={boolean:!0,type:"boolean",desc:'use hash history for navigation, e.g. "/#/view" instead of "/view"'},Rt={alias:"o",type:"string",desc:"output directory",normalize:!0,nargs:1,coerce:z},wr={alias:"w",type:"string",desc:'prefix for Webcomponents, e.g "c\
|
|
8
|
+
4" generates <c4-view ../>',default:"likec4",nargs:1},Ps={alias:"t",type:"string",desc:'base title of the app pages (default is "LikeC4")',default:"LikeC4",nargs:1},js={alias:["base-url"],type:"string",desc:'base url the app is being served from, e.g. "/" or "/pages/"',nargs:1},Tu={boolean:!0,type:"boolean",desc:"outputs a single self-contained HTML file with all required resources inlined"},Iu={alias:"l",type:"string",...Le()?{desc:"listen 0.0.0.0 by default in container",default:"0.0.0.0"}:{desc:"\
|
|
9
|
+
ip address of the network interface to listen on"},nargs:1},Ou={type:"number",desc:"port number for the dev server (default is 5173, or PORT environment variable)",nargs:1},ut={alias:"p",type:"string",desc:'LikeC4 project, name eg. "my-project" or path to the project folder',nargs:1},Ds=t=>t instanceof URL?As(t):t;function Lu(t,{cwd:e=re.cwd(),type:r="file",stopAt:n}={}){let i=W.resolve(Ds(e)??"");const{root:a}=W.parse(i);for(n=W.resolve(i,Ds(n)??a);i&&i!==n&&i!==a;){const s=W.isAbsolute(t)?t:W.
|
|
10
|
+
join(i,t);try{const o=B.statSync(s,{throwIfNoEntry:!1});if(r==="file"&&o?.isFile()||r==="directory"&&o?.isDirectory())return s}catch{}i=W.dirname(i)}}function ku({cwd:t=re.cwd()}={}){return Lu("package.json",{cwd:t})}const Nu=ve("vite"),St=Re(As(import.meta.url)),Pu=`
|
|
11
11
|
/* prettier-ignore-start */
|
|
12
12
|
/* eslint-disable */
|
|
13
13
|
|
|
@@ -16,118 +16,118 @@ join(o,t);try{const i=V.statSync(s,{throwIfNoEntry:!1});if(r==="file"&&i?.isFile
|
|
|
16
16
|
* DO NOT EDIT MANUALLY!
|
|
17
17
|
******************************************************************************/
|
|
18
18
|
|
|
19
|
-
`.trimStart(),
|
|
19
|
+
`.trimStart(),ju=`
|
|
20
20
|
|
|
21
21
|
/* prettier-ignore-end */
|
|
22
|
-
`,
|
|
22
|
+
`,vr={banner:Pu,footer:ju};function qs(){const t=ku({cwd:St});if(!t)throw new Error("likec4 package folder not found");return Re(t)}function $r(){const t=qs(),e=[z(t,"__app__"),z(St,"../__app__"),z(St,"../../__app__"),z(St,"../../dist/__app__")],r=_c(e,_e);if(!r)throw He.error(`likec4 app root does not exist, tried:
|
|
23
23
|
${e.join(`
|
|
24
|
-
`)}`),new Error("likec4 app root does not exist");return r}async function
|
|
25
|
-
`),t}const
|
|
26
|
-
isInteger(r)?!1:(Number(r)-Number(e))/Number(n)>=
|
|
27
|
-
e.close===!0,t.reduce=e=>e.reduce((r,n)=>(n.type==="text"&&r.push(n.value),n.type==="range"&&(n.type="text"),r),[]),t.flatten=(...e)=>{const r=[],n=
|
|
28
|
-
t.isOpenOrClose(
|
|
29
|
-
m);if(t(g)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let d={relaxZeros:!0,...T};typeof d.strictZeros=="boolean"&&(d.relaxZeros=d.strictZeros===!1);let S=String(d.relaxZeros),E=String(d.shorthand),A=String(d.capture),b=String(d.wrap),x=m+":"+g+"="+S+E+A+b;if(e.cache.hasOwnProperty(x))return e.cache[x].result;let q=Math.min(m,g),M=Math.max(m,g);if(Math.abs(q-M)===1){let C=m+"|"+g;return d.capture?`(${C})`:d.wrap===!1?C:`(?:${C})`}let
|
|
30
|
-
max:g,a:q,b:M},
|
|
31
|
-
[g]);for(;m<=S&&S<=g;)E.add(S),T+=1,S=l(m,T);for(S=f(g+1,d)-1;m<S&&S<=g;)E.add(S),d+=1,S=f(g+1,d)-1;return E=[...E],E.sort(c),E}function
|
|
32
|
-
b&&b.pattern===M.pattern){b.count.length>1&&b.count.pop(),b.count.push(M.count[0]),b.string=b.pattern+p(b.count),A=q+1;continue}T.isPadded&&(
|
|
24
|
+
`)}`),new Error("likec4 app root does not exist");return r}async function br(){const t=await bt(it(Et(),".likec4-public-"));return await Oe(it(t,"likec4-views.js"),`// generated by likec4
|
|
25
|
+
`),t}const Er=1e4;function Rr(){const t=qs();return{"likec4/icons":z(t,"icons"),"likec4/react":z(t,"react/index.js"),"likec4/model":z(t,"dist/model/index.mjs"),"likec4/vite-plugin/internal":z(t,"dist/vite-plugin/internal.mjs")}}var Sr={},Hs;function Ar(){return Hs||(Hs=1,(function(t){t.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1,t.find=(e,r)=>e.nodes.find(n=>n.type===r),t.exceedsLimit=(e,r,n=1,i)=>i===!1||!t.isInteger(e)||!t.
|
|
26
|
+
isInteger(r)?!1:(Number(r)-Number(e))/Number(n)>=i,t.escapeNode=(e,r=0,n)=>{const i=e.nodes[r];i&&(n&&i.type===n||i.type==="open"||i.type==="close")&&i.escaped!==!0&&(i.value="\\"+i.value,i.escaped=!0)},t.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1,t.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1,t.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||
|
|
27
|
+
e.close===!0,t.reduce=e=>e.reduce((r,n)=>(n.type==="text"&&r.push(n.value),n.type==="range"&&(n.type="text"),r),[]),t.flatten=(...e)=>{const r=[],n=i=>{for(let a=0;a<i.length;a++){const s=i[a];if(Array.isArray(s)){n(s);continue}s!==void 0&&r.push(s)}return r};return n(e),r}})(Sr)),Sr}var _r,Ms;function Cr(){if(Ms)return _r;Ms=1;const t=Ar();return _r=(e,r={})=>{const n=(i,a={})=>{const s=r.escapeInvalid&&t.isInvalidBrace(a),o=i.invalid===!0&&r.escapeInvalid===!0;let c="";if(i.value)return(s||o)&&
|
|
28
|
+
t.isOpenOrClose(i)?"\\"+i.value:i.value;if(i.value)return i.value;if(i.nodes)for(const u of i.nodes)c+=n(u);return c};return n(e)},_r}var xr,Us;function Du(){return Us||(Us=1,xr=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}),xr}var Tr,Fs;function qu(){if(Fs)return Tr;Fs=1;const t=Du(),e=(m,g,T)=>{if(t(m)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(g===void 0||m===g)return String(
|
|
29
|
+
m);if(t(g)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let d={relaxZeros:!0,...T};typeof d.strictZeros=="boolean"&&(d.relaxZeros=d.strictZeros===!1);let S=String(d.relaxZeros),E=String(d.shorthand),A=String(d.capture),b=String(d.wrap),x=m+":"+g+"="+S+E+A+b;if(e.cache.hasOwnProperty(x))return e.cache[x].result;let q=Math.min(m,g),M=Math.max(m,g);if(Math.abs(q-M)===1){let C=m+"|"+g;return d.capture?`(${C})`:d.wrap===!1?C:`(?:${C})`}let V=v(m)||v(g),F={min:m,
|
|
30
|
+
max:g,a:q,b:M},L=[],I=[];if(V&&(F.isPadded=V,F.maxLen=String(F.max).length),q<0){let C=M<0?Math.abs(M):1;I=a(C,Math.abs(q),F,d),q=F.a=0}return M>=0&&(L=a(q,M,F,d)),F.negatives=I,F.positives=L,F.result=r(I,L),d.capture===!0?F.result=`(${F.result})`:d.wrap!==!1&&L.length+I.length>1&&(F.result=`(?:${F.result})`),e.cache[x]=F,F.result};function r(m,g,T){let d=s(m,g,"-",!1)||[],S=s(g,m,"",!1)||[],E=s(m,g,"-?",!0)||[];return d.concat(E).concat(S).join("|")}function n(m,g){let T=1,d=1,S=l(m,T),E=new Set(
|
|
31
|
+
[g]);for(;m<=S&&S<=g;)E.add(S),T+=1,S=l(m,T);for(S=f(g+1,d)-1;m<S&&S<=g;)E.add(S),d+=1,S=f(g+1,d)-1;return E=[...E],E.sort(c),E}function i(m,g,T){if(m===g)return{pattern:m,count:[],digits:0};let d=o(m,g),S=d.length,E="",A=0;for(let b=0;b<S;b++){let[x,q]=d[b];x===q?E+=x:x!=="0"||q!=="9"?E+=h(x,q):A++}return A&&(E+=T.shorthand===!0?"\\d":"[0-9]"),{pattern:E,count:[A],digits:S}}function a(m,g,T,d){let S=n(m,g),E=[],A=m,b;for(let x=0;x<S.length;x++){let q=S[x],M=i(String(A),String(q),d),V="";if(!T.isPadded&&
|
|
32
|
+
b&&b.pattern===M.pattern){b.count.length>1&&b.count.pop(),b.count.push(M.count[0]),b.string=b.pattern+p(b.count),A=q+1;continue}T.isPadded&&(V=w(q,T,d)),M.string=V+M.pattern+p(M.count),E.push(M),A=q+1,b=M}return E}function s(m,g,T,d,S){let E=[];for(let A of m){let{string:b}=A;!d&&!u(g,"string",b)&&E.push(T+b),d&&u(g,"string",b)&&E.push(T+b)}return E}function o(m,g){let T=[];for(let d=0;d<m.length;d++)T.push([m[d],g[d]]);return T}function c(m,g){return m>g?1:g>m?-1:0}function u(m,g,T){return m.some(
|
|
33
33
|
d=>d[g]===T)}function l(m,g){return Number(String(m).slice(0,-g)+"9".repeat(g))}function f(m,g){return m-m%Math.pow(10,g)}function p(m){let[g=0,T=""]=m;return T||g>1?`{${g+(T?","+T:"")}}`:""}function h(m,g,T){return`[${m}${g-m===1?"":"-"}${g}]`}function v(m){return/^-?(0+)\d/.test(m)}function w(m,g,T){if(!g.isPadded)return m;let d=Math.abs(g.maxLen-String(m).length),S=T.relaxZeros!==!1;switch(d){case 0:return"";case 1:return S?"0?":"0";case 2:return S?"0{0,2}":"00";default:return S?`0{0,${d}}`:`\
|
|
34
|
-
0{${d}}`}}return e.cache={},e.clearCache=()=>e.cache={},
|
|
35
|
-
-"?"-":"";A&&(d=d.slice(1)),d=A+d.padStart(A?S-1:S,"0")}return E===!1?String(d):d},
|
|
34
|
+
0{${d}}`}}return e.cache={},e.clearCache=()=>e.cache={},Tr=e,Tr}var Ir,Gs;function Bs(){if(Gs)return Ir;Gs=1;const t=_s,e=qu(),r=d=>d!==null&&typeof d=="object"&&!Array.isArray(d),n=d=>S=>d===!0?Number(S):String(S),i=d=>typeof d=="number"||typeof d=="string"&&d!=="",a=d=>Number.isInteger(+d),s=d=>{let S=`${d}`,E=-1;if(S[0]==="-"&&(S=S.slice(1)),S==="0")return!1;for(;S[++E]==="0";);return E>0},o=(d,S,E)=>typeof d=="string"||typeof S=="string"?!0:E.stringify===!0,c=(d,S,E)=>{if(S>0){let A=d[0]==="\
|
|
35
|
+
-"?"-":"";A&&(d=d.slice(1)),d=A+d.padStart(A?S-1:S,"0")}return E===!1?String(d):d},u=(d,S)=>{let E=d[0]==="-"?"-":"";for(E&&(d=d.slice(1),S--);d.length<S;)d="0"+d;return E?"-"+d:d},l=(d,S,E)=>{d.negatives.sort((M,V)=>M<V?-1:M>V?1:0),d.positives.sort((M,V)=>M<V?-1:M>V?1:0);let A=S.capture?"":"?:",b="",x="",q;return d.positives.length&&(b=d.positives.map(M=>u(String(M),E)).join("|")),d.negatives.length&&(x=`-(${A}${d.negatives.map(M=>u(String(M),E)).join("|")})`),b&&x?q=`${b}|${x}`:q=b||x,S.wrap?`\
|
|
36
36
|
(${A}${q})`:q},f=(d,S,E,A)=>{if(E)return e(d,S,{wrap:!1,...A});let b=String.fromCharCode(d);if(d===S)return b;let x=String.fromCharCode(S);return`[${b}-${x}]`},p=(d,S,E)=>{if(Array.isArray(d)){let A=E.wrap===!0,b=E.capture?"":"?:";return A?`(${b}${d.join("|")})`:d.join("|")}return e(d,S,E)},h=(...d)=>new RangeError("Invalid range arguments: "+t.inspect(...d)),v=(d,S,E)=>{if(E.strictRanges===!0)throw h([d,S]);return[]},w=(d,S)=>{if(S.strictRanges===!0)throw new TypeError(`Expected step "${d}" to \
|
|
37
|
-
be a number`);return[]},m=(d,S,E=1,A={})=>{let b=Number(d),x=Number(S);if(!Number.isInteger(b)||!Number.isInteger(x)){if(A.strictRanges===!0)throw h([d,S]);return[]}b===0&&(b=0),x===0&&(x=0);let q=b>x,M=String(d),
|
|
38
|
-
abs($)),D=[],H=0;for(;q?b>=x:b<=x;)A.toRegex===!0&&E>1?
|
|
39
|
-
wrap:!1,options:A}):
|
|
40
|
-
|
|
41
|
-
length>1?`(${v})`:v}if(s.nodes)for(const h of s.nodes)p+=
|
|
42
|
-
(
|
|
43
|
-
or disable the limit.");let g=t(...m,s);g.length===0&&(g=e(
|
|
44
|
-
flatten(c(
|
|
37
|
+
be a number`);return[]},m=(d,S,E=1,A={})=>{let b=Number(d),x=Number(S);if(!Number.isInteger(b)||!Number.isInteger(x)){if(A.strictRanges===!0)throw h([d,S]);return[]}b===0&&(b=0),x===0&&(x=0);let q=b>x,M=String(d),V=String(S),F=String(E);E=Math.max(Math.abs(E),1);let L=s(M)||s(V)||s(F),I=L?Math.max(M.length,V.length,F.length):0,C=L===!1&&o(d,S,A)===!1,k=A.transform||n(C);if(A.toRegex&&E===1)return f(u(d,I),u(S,I),!0,A);let O={negatives:[],positives:[]},P=$=>O[$<0?"negatives":"positives"].push(Math.
|
|
38
|
+
abs($)),D=[],H=0;for(;q?b>=x:b<=x;)A.toRegex===!0&&E>1?P(b):D.push(c(k(b,H),I,C)),b=q?b-E:b+E,H++;return A.toRegex===!0?E>1?l(O,A,I):p(D,null,{wrap:!1,...A}):D},g=(d,S,E=1,A={})=>{if(!a(d)&&d.length>1||!a(S)&&S.length>1)return v(d,S,A);let b=A.transform||(C=>String.fromCharCode(C)),x=`${d}`.charCodeAt(0),q=`${S}`.charCodeAt(0),M=x>q,V=Math.min(x,q),F=Math.max(x,q);if(A.toRegex&&E===1)return f(V,F,!1,A);let L=[],I=0;for(;M?x>=q:x<=q;)L.push(b(x,I)),x=M?x-E:x+E,I++;return A.toRegex===!0?p(L,null,{
|
|
39
|
+
wrap:!1,options:A}):L},T=(d,S,E,A={})=>{if(S==null&&i(d))return[d];if(!i(d)||!i(S))return v(d,S,A);if(typeof E=="function")return T(d,S,1,{transform:E});if(r(E))return T(d,S,0,E);let b={...A};return b.capture===!0&&(b.wrap=!0),E=E||b.step||1,a(E)?a(d)&&a(S)?m(d,S,E,b):g(d,S,Math.max(Math.abs(E),1),b):E!=null&&!r(E)?w(E,b):T(d,S,1,E)};return Ir=T,Ir}var Or,Vs;function Hu(){if(Vs)return Or;Vs=1;const t=Bs(),e=Ar();return Or=(n,i={})=>{const a=(s,o={})=>{const c=e.isInvalidBrace(o),u=s.invalid===!0&&
|
|
40
|
+
i.escapeInvalid===!0,l=c===!0||u===!0,f=i.escapeInvalid===!0?"\\":"";let p="";if(s.isOpen===!0)return f+s.value;if(s.isClose===!0)return console.log("node.isClose",f,s.value),f+s.value;if(s.type==="open")return l?f+s.value:"(";if(s.type==="close")return l?f+s.value:")";if(s.type==="comma")return s.prev.type==="comma"?"":l?s.value:"|";if(s.value)return s.value;if(s.nodes&&s.ranges>0){const h=e.reduce(s.nodes),v=t(...h,{...i,wrap:!1,toRegex:!0,strictZeros:!0});if(v.length!==0)return h.length>1&&v.
|
|
41
|
+
length>1?`(${v})`:v}if(s.nodes)for(const h of s.nodes)p+=a(h,s);return p};return a(n)},Or}var Lr,zs;function Mu(){if(zs)return Lr;zs=1;const t=Bs(),e=Cr(),r=Ar(),n=(a="",s="",o=!1)=>{const c=[];if(a=[].concat(a),s=[].concat(s),!s.length)return a;if(!a.length)return o?r.flatten(s).map(u=>`{${u}}`):s;for(const u of a)if(Array.isArray(u))for(const l of u)c.push(n(l,s,o));else for(let l of s)o===!0&&typeof l=="string"&&(l=`{${l}}`),c.push(Array.isArray(l)?n(u,l,o):u+l);return r.flatten(c)};return Lr=
|
|
42
|
+
(a,s={})=>{const o=s.rangeLimit===void 0?1e3:s.rangeLimit,c=(u,l={})=>{u.queue=[];let f=l,p=l.queue;for(;f.type!=="brace"&&f.type!=="root"&&f.parent;)f=f.parent,p=f.queue;if(u.invalid||u.dollar){p.push(n(p.pop(),e(u,s)));return}if(u.type==="brace"&&u.invalid!==!0&&u.nodes.length===2){p.push(n(p.pop(),["{}"]));return}if(u.nodes&&u.ranges>0){const m=r.reduce(u.nodes);if(r.exceedsLimit(...m,s.step,o))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase\
|
|
43
|
+
or disable the limit.");let g=t(...m,s);g.length===0&&(g=e(u,s)),p.push(n(p.pop(),g)),u.nodes=[];return}const h=r.encloseBrace(u);let v=u.queue,w=u;for(;w.type!=="brace"&&w.type!=="root"&&w.parent;)w=w.parent,v=w.queue;for(let m=0;m<u.nodes.length;m++){const g=u.nodes[m];if(g.type==="comma"&&u.type==="brace"){m===1&&v.push(""),v.push("");continue}if(g.type==="close"){p.push(n(p.pop(),v,h));continue}if(g.value&&g.type!=="open"){v.push(n(v.pop(),g.value));continue}g.nodes&&c(g,u)}return v};return r.
|
|
44
|
+
flatten(c(a))},Lr}var kr,Ws;function Uu(){return Ws||(Ws=1,kr={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\
|
|
45
45
|
\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
46
|
-
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}),
|
|
47
|
-
CHAR_LEFT_CURLY_BRACE:c,CHAR_RIGHT_CURLY_BRACE:
|
|
48
|
-
let b=E,x=E,q=0;const M=g.length;let
|
|
49
|
-
|
|
50
|
-
type:"brace",open:!0,close:!1,dollar:x.value&&x.value.slice(-1)==="$"||b.dollar===!0,depth:F,commas:0,ranges:0,nodes:[]};b=C(
|
|
51
|
-
const
|
|
52
|
-
"close"&&(
|
|
53
|
-
|
|
54
|
-
=.)",c="[^/]",
|
|
55
|
-
NO_DOT_SLASH:`(?!${n}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`},S={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return
|
|
46
|
+
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}),kr}var Nr,Xs;function Fu(){if(Xs)return Nr;Xs=1;const t=Cr(),{MAX_LENGTH:e,CHAR_BACKSLASH:r,CHAR_BACKTICK:n,CHAR_COMMA:i,CHAR_DOT:a,CHAR_LEFT_PARENTHESES:s,CHAR_RIGHT_PARENTHESES:o,
|
|
47
|
+
CHAR_LEFT_CURLY_BRACE:c,CHAR_RIGHT_CURLY_BRACE:u,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:f,CHAR_DOUBLE_QUOTE:p,CHAR_SINGLE_QUOTE:h,CHAR_NO_BREAK_SPACE:v,CHAR_ZERO_WIDTH_NOBREAK_SPACE:w}=Uu();return Nr=(g,T={})=>{if(typeof g!="string")throw new TypeError("Expected a string");const d=T||{},S=typeof d.maxLength=="number"?Math.min(e,d.maxLength):e;if(g.length>S)throw new SyntaxError(`Input length (${g.length}), exceeds max characters (${S})`);const E={type:"root",input:g,nodes:[]},A=[E];
|
|
48
|
+
let b=E,x=E,q=0;const M=g.length;let V=0,F=0,L;const I=()=>g[V++],C=k=>{if(k.type==="text"&&x.type==="dot"&&(x.type="text"),x&&x.type==="text"&&k.type==="text"){x.value+=k.value;return}return b.nodes.push(k),k.parent=b,k.prev=x,x=k,k};for(C({type:"bos"});V<M;)if(b=A[A.length-1],L=I(),!(L===w||L===v)){if(L===r){C({type:"text",value:(T.keepEscaping?L:"")+I()});continue}if(L===f){C({type:"text",value:"\\"+L});continue}if(L===l){q++;let k;for(;V<M&&(k=I());){if(L+=k,k===l){q++;continue}if(k===r){L+=
|
|
49
|
+
I();continue}if(k===f&&(q--,q===0))break}C({type:"text",value:L});continue}if(L===s){b=C({type:"paren",nodes:[]}),A.push(b),C({type:"text",value:L});continue}if(L===o){if(b.type!=="paren"){C({type:"text",value:L});continue}b=A.pop(),C({type:"text",value:L}),b=A[A.length-1];continue}if(L===p||L===h||L===n){const k=L;let O;for(T.keepQuotes!==!0&&(L="");V<M&&(O=I());){if(O===r){L+=O+I();continue}if(O===k){T.keepQuotes===!0&&(L+=O);break}L+=O}C({type:"text",value:L});continue}if(L===c){F++;const O={
|
|
50
|
+
type:"brace",open:!0,close:!1,dollar:x.value&&x.value.slice(-1)==="$"||b.dollar===!0,depth:F,commas:0,ranges:0,nodes:[]};b=C(O),A.push(b),C({type:"open",value:L});continue}if(L===u){if(b.type!=="brace"){C({type:"text",value:L});continue}const k="close";b=A.pop(),b.close=!0,C({type:k,value:L}),F--,b=A[A.length-1];continue}if(L===i&&F>0){if(b.ranges>0){b.ranges=0;const k=b.nodes.shift();b.nodes=[k,{type:"text",value:t(b)}]}C({type:"comma",value:L}),b.commas++;continue}if(L===a&&F>0&&b.commas===0){
|
|
51
|
+
const k=b.nodes;if(F===0||k.length===0){C({type:"text",value:L});continue}if(x.type==="dot"){if(b.range=[],x.value+=L,x.type="range",b.nodes.length!==3&&b.nodes.length!==5){b.invalid=!0,b.ranges=0,x.type="text";continue}b.ranges++,b.args=[];continue}if(x.type==="range"){k.pop();const O=k[k.length-1];O.value+=x.value+L,x=O,b.ranges--;continue}C({type:"dot",value:L});continue}C({type:"text",value:L})}do if(b=A.pop(),b.type!=="root"){b.nodes.forEach(P=>{P.nodes||(P.type==="open"&&(P.isOpen=!0),P.type===
|
|
52
|
+
"close"&&(P.isClose=!0),P.nodes||(P.type="text"),P.invalid=!0)});const k=A[A.length-1],O=k.nodes.indexOf(b);k.nodes.splice(O,1,...b.nodes)}while(A.length>0);return C({type:"eos"}),E},Nr}var Pr,Ks;function Gu(){if(Ks)return Pr;Ks=1;const t=Cr(),e=Hu(),r=Mu(),n=Fu(),i=(a,s={})=>{let o=[];if(Array.isArray(a))for(const c of a){const u=i.create(c,s);Array.isArray(u)?o.push(...u):o.push(u)}else o=[].concat(i.create(a,s));return s&&s.expand===!0&&s.nodupes===!0&&(o=[...new Set(o)]),o};return i.parse=(a,s={})=>n(
|
|
53
|
+
a,s),i.stringify=(a,s={})=>t(typeof a=="string"?i.parse(a,s):a,s),i.compile=(a,s={})=>(typeof a=="string"&&(a=i.parse(a,s)),e(a,s)),i.expand=(a,s={})=>{typeof a=="string"&&(a=i.parse(a,s));let o=r(a,s);return s.noempty===!0&&(o=o.filter(Boolean)),s.nodupes===!0&&(o=[...new Set(o)]),o},i.create=(a,s={})=>a===""||a.length<3?[a]:s.expand!==!0?i.compile(a,s):i.expand(a,s),Pr=i,Pr}var jr={},Dr,Ys;function At(){if(Ys)return Dr;Ys=1;const t=pr,e="\\\\/",r=`[^${e}]`,n="\\.",i="\\+",a="\\?",s="\\/",o="(?\
|
|
54
|
+
=.)",c="[^/]",u=`(?:${s}|$)`,l=`(?:^|${s})`,f=`${n}{1,2}${u}`,p=`(?!${n})`,h=`(?!${l}${f})`,v=`(?!${n}{0,1}${u})`,w=`(?!${f})`,m=`[^.${s}]`,g=`${c}*?`,T={DOT_LITERAL:n,PLUS_LITERAL:i,QMARK_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:o,QMARK:c,END_ANCHOR:u,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:h,NO_DOT_SLASH:v,NO_DOTS_SLASH:w,QMARK_NO_DOT:m,STAR:g,START_ANCHOR:l},d={...T,SLASH_LITERAL:`[${e}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${n}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${n})`,NO_DOTS:`(?!(?:^|[${e}])${n}{1,2}(?:[${e}]|$))`,
|
|
55
|
+
NO_DOT_SLASH:`(?!${n}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`},S={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return Dr={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:S,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,
|
|
56
56
|
REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,
|
|
57
57
|
CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,
|
|
58
|
-
CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:t.sep,extglobChars(E){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${E.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(E){return E===!0?d:T}},
|
|
59
|
-
platform==="win32",{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:
|
|
60
|
-
|
|
61
|
-
if(
|
|
62
|
-
M=[];let
|
|
63
|
-
|
|
64
|
-
break}}continue}break}if(K===e){if(_===e&&(D=
|
|
65
|
-
if(K===v){Q=!0;break}}continue}break}if(
|
|
66
|
-
isGlobstar:D,negated:U,negatedExtglob:
|
|
67
|
-
x,le.parts=M}return le},
|
|
68
|
-
throw new TypeError("Expected a string");l=s[l]||l;const p={...f},h=typeof p.maxLength=="number"?Math.min(r,p.maxLength):r;let v=l.length;if(v>h)throw new SyntaxError(`Input length: ${v}, exceeds maximum allowed length: ${h}`);const w={type:"bos",value:"",output:p.prepend||""},m=[w],g=p.capture?"":"?:",T=e.isWindows(f),d=t.globChars(T),S=t.extglobChars(d),{DOT_LITERAL:E,PLUS_LITERAL:A,SLASH_LITERAL:b,ONE_CHAR:x,DOTS_SLASH:q,NO_DOT:M,NO_DOT_SLASH:
|
|
69
|
-
|
|
70
|
-
1),
|
|
71
|
-
-R.output.length),R.type="star",R.value="*",R.output=H,$.output+=R.output)}if(U.length&&j.type!=="paren"&&(U[U.length-1].inner+=j.value),(j.value||j.output)&&
|
|
72
|
-
output:
|
|
73
|
-
Z=l.replace(
|
|
74
|
-
."||
|
|
75
|
-
if(
|
|
76
|
-
continue}if(_===")"){if($.parens===0&&p.strictBrackets===!0)throw new SyntaxError(c("opening","("));const
|
|
77
|
-
cket"&&R.value.length===1){G({type:"text",value:_,output:`\\${_}`});continue}if($.brackets===0){if(p.strictBrackets===!0)throw new SyntaxError(c("opening","["));G({type:"text",value:_,output:`\\${_}`});continue}le("brackets");const
|
|
78
|
-
R.value=
|
|
79
|
-
|
|
80
|
-
if(_==="/"){if(R.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",m.pop(),R=w;continue}G({type:"slash",value:_,output:b});continue}if(_==="."){if($.braces>0&&R.type==="dot"){R.value==="."&&(R.output=E);const
|
|
81
|
-
!0&&
|
|
82
|
-
!0&&
|
|
83
|
-
value:_,output:""});continue}G({type:"text",value:_});continue}if(_!=="*"){(_==="$"||_==="^")&&(_=`\\${_}`);const
|
|
84
|
-
h"||
|
|
85
|
-
$.output=R.output,$.globstar=!0,
|
|
86
|
-
`${
|
|
87
|
-
!0){Z.output=".*?",(R.type==="bos"||R.type==="slash")&&(Z.output=
|
|
58
|
+
CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:t.sep,extglobChars(E){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${E.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(E){return E===!0?d:T}},Dr}var Js;function _t(){return Js||(Js=1,(function(t){const e=pr,r=process.
|
|
59
|
+
platform==="win32",{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:i,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:s}=At();t.isObject=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),t.hasRegexChars=o=>a.test(o),t.isRegexChar=o=>o.length===1&&t.hasRegexChars(o),t.escapeRegex=o=>o.replace(s,"\\$1"),t.toPosixSlashes=o=>o.replace(n,"/"),t.removeBackslashes=o=>o.replace(i,c=>c==="\\"?"":c),t.supportsLookbehinds=()=>{const o=process.version.slice(1).split(".").map(Number);return o.length===3&&o[0]>=9||
|
|
60
|
+
o[0]===8&&o[1]>=10},t.isWindows=o=>o&&typeof o.windows=="boolean"?o.windows:r===!0||e.sep==="\\",t.escapeLast=(o,c,u)=>{const l=o.lastIndexOf(c,u);return l===-1?o:o[l-1]==="\\"?t.escapeLast(o,c,l-1):`${o.slice(0,l)}\\${o.slice(l)}`},t.removePrefix=(o,c={})=>{let u=o;return u.startsWith("./")&&(u=u.slice(2),c.prefix="./"),u},t.wrapOutput=(o,c={},u={})=>{const l=u.contains?"":"^",f=u.contains?"":"$";let p=`${l}(?:${o})${f}`;return c.negated===!0&&(p=`(?:^(?!${p}).*$)`),p}})(jr)),jr}var qr,Qs;function Bu(){
|
|
61
|
+
if(Qs)return qr;Qs=1;const t=_t(),{CHAR_ASTERISK:e,CHAR_AT:r,CHAR_BACKWARD_SLASH:n,CHAR_COMMA:i,CHAR_DOT:a,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:o,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:u,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:f,CHAR_QUESTION_MARK:p,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:v,CHAR_RIGHT_SQUARE_BRACKET:w}=At(),m=d=>d===o||d===n,g=d=>{d.isPrefix!==!0&&(d.depth=d.isGlobstar?1/0:1)};return qr=(d,S)=>{const E=S||{},A=d.length-1,b=E.parts===!0||E.scanToEnd===!0,x=[],q=[],
|
|
62
|
+
M=[];let V=d,F=-1,L=0,I=0,C=!1,k=!1,O=!1,P=!1,D=!1,H=!1,$=!1,U=!1,J=!1,Q=!1,R=0,_,K,X={value:"",depth:0,isGlob:!1};const me=()=>F>=A,Ae=()=>V.charCodeAt(F+1),ne=()=>(_=K,V.charCodeAt(++F));for(;F<A;){K=ne();let G;if(K===n){$=X.backslashes=!0,K=ne(),K===c&&(H=!0);continue}if(H===!0||K===c){for(R++;me()!==!0&&(K=ne());){if(K===n){$=X.backslashes=!0,ne();continue}if(K===c){R++;continue}if(H!==!0&&K===a&&(K=ne())===a){if(C=X.isBrace=!0,O=X.isGlob=!0,Q=!0,b===!0)continue;break}if(H!==!0&&K===i){if(C=
|
|
63
|
+
X.isBrace=!0,O=X.isGlob=!0,Q=!0,b===!0)continue;break}if(K===h&&(R--,R===0)){H=!1,C=X.isBrace=!0,Q=!0;break}}if(b===!0)continue;break}if(K===o){if(x.push(F),q.push(X),X={value:"",depth:0,isGlob:!1},Q===!0)continue;if(_===a&&F===L+1){L+=2;continue}I=F+1;continue}if(E.noext!==!0&&(K===f||K===r||K===e||K===p||K===s)===!0&&Ae()===u){if(O=X.isGlob=!0,P=X.isExtglob=!0,Q=!0,K===s&&F===L&&(J=!0),b===!0){for(;me()!==!0&&(K=ne());){if(K===n){$=X.backslashes=!0,K=ne();continue}if(K===v){O=X.isGlob=!0,Q=!0;
|
|
64
|
+
break}}continue}break}if(K===e){if(_===e&&(D=X.isGlobstar=!0),O=X.isGlob=!0,Q=!0,b===!0)continue;break}if(K===p){if(O=X.isGlob=!0,Q=!0,b===!0)continue;break}if(K===l){for(;me()!==!0&&(G=ne());){if(G===n){$=X.backslashes=!0,ne();continue}if(G===w){k=X.isBracket=!0,O=X.isGlob=!0,Q=!0;break}}if(b===!0)continue;break}if(E.nonegate!==!0&&K===s&&F===L){U=X.negated=!0,L++;continue}if(E.noparen!==!0&&K===u){if(O=X.isGlob=!0,b===!0){for(;me()!==!0&&(K=ne());){if(K===u){$=X.backslashes=!0,K=ne();continue}
|
|
65
|
+
if(K===v){Q=!0;break}}continue}break}if(O===!0){if(Q=!0,b===!0)continue;break}}E.noext===!0&&(P=!1,O=!1);let se=V,tt="",$e="";L>0&&(tt=V.slice(0,L),V=V.slice(L),I-=L),se&&O===!0&&I>0?(se=V.slice(0,I),$e=V.slice(I)):O===!0?(se="",$e=V):se=V,se&&se!==""&&se!=="/"&&se!==V&&m(se.charCodeAt(se.length-1))&&(se=se.slice(0,-1)),E.unescape===!0&&($e&&($e=t.removeBackslashes($e)),se&&$===!0&&(se=t.removeBackslashes(se)));const le={prefix:tt,input:d,start:L,base:se,glob:$e,isBrace:C,isBracket:k,isGlob:O,isExtglob:P,
|
|
66
|
+
isGlobstar:D,negated:U,negatedExtglob:J};if(E.tokens===!0&&(le.maxDepth=0,m(K)||q.push(X),le.tokens=q),E.parts===!0||E.tokens===!0){let G;for(let ie=0;ie<x.length;ie++){const rr=G?G+1:L,j=x[ie],Z=d.slice(rr,j);E.tokens&&(ie===0&&L!==0?(q[ie].isPrefix=!0,q[ie].value=tt):q[ie].value=Z,g(q[ie]),le.maxDepth+=q[ie].depth),(ie!==0||Z!=="")&&M.push(Z),G=j}if(G&&G+1<d.length){const ie=d.slice(G+1);M.push(ie),E.tokens&&(q[q.length-1].value=ie,g(q[q.length-1]),le.maxDepth+=q[q.length-1].depth)}le.slashes=
|
|
67
|
+
x,le.parts=M}return le},qr}var Hr,Zs;function Vu(){if(Zs)return Hr;Zs=1;const t=At(),e=_t(),{MAX_LENGTH:r,POSIX_REGEX_SOURCE:n,REGEX_NON_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_BACKREF:a,REPLACEMENTS:s}=t,o=(l,f)=>{if(typeof f.expandRange=="function")return f.expandRange(...l,f);l.sort();const p=`[${l.join("-")}]`;try{new RegExp(p)}catch{return l.map(v=>e.escapeRegex(v)).join("..")}return p},c=(l,f)=>`Missing ${l}: "${f}" - use "\\\\${f}" to match literal characters`,u=(l,f)=>{if(typeof l!="string")
|
|
68
|
+
throw new TypeError("Expected a string");l=s[l]||l;const p={...f},h=typeof p.maxLength=="number"?Math.min(r,p.maxLength):r;let v=l.length;if(v>h)throw new SyntaxError(`Input length: ${v}, exceeds maximum allowed length: ${h}`);const w={type:"bos",value:"",output:p.prepend||""},m=[w],g=p.capture?"":"?:",T=e.isWindows(f),d=t.globChars(T),S=t.extglobChars(d),{DOT_LITERAL:E,PLUS_LITERAL:A,SLASH_LITERAL:b,ONE_CHAR:x,DOTS_SLASH:q,NO_DOT:M,NO_DOT_SLASH:V,NO_DOTS_SLASH:F,QMARK:L,QMARK_NO_DOT:I,STAR:C,START_ANCHOR:k}=d,
|
|
69
|
+
O=j=>`(${g}(?:(?!${k}${j.dot?q:E}).)*?)`,P=p.dot?"":M,D=p.dot?L:I;let H=p.bash===!0?O(p):C;p.capture&&(H=`(${H})`),typeof p.noext=="boolean"&&(p.noextglob=p.noext);const $={input:l,index:-1,start:0,dot:p.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:m};l=e.removePrefix(l,$),v=l.length;const U=[],J=[],Q=[];let R=w,_;const K=()=>$.index===v-1,X=$.peek=(j=1)=>l[$.index+j],me=$.advance=()=>l[++$.index]||"",Ae=()=>l.slice($.index+
|
|
70
|
+
1),ne=(j="",Z=0)=>{$.consumed+=j,$.index+=Z},se=j=>{$.output+=j.output!=null?j.output:j.value,ne(j.value)},tt=()=>{let j=1;for(;X()==="!"&&(X(2)!=="("||X(3)==="?");)me(),$.start++,j++;return j%2===0?!1:($.negated=!0,$.start++,!0)},$e=j=>{$[j]++,Q.push(j)},le=j=>{$[j]--,Q.pop()},G=j=>{if(R.type==="globstar"){const Z=$.braces>0&&(j.type==="comma"||j.type==="brace"),N=j.extglob===!0||U.length&&(j.type==="pipe"||j.type==="paren");j.type!=="slash"&&j.type!=="paren"&&!Z&&!N&&($.output=$.output.slice(0,
|
|
71
|
+
-R.output.length),R.type="star",R.value="*",R.output=H,$.output+=R.output)}if(U.length&&j.type!=="paren"&&(U[U.length-1].inner+=j.value),(j.value||j.output)&&se(j),R&&R.type==="text"&&j.type==="text"){R.value+=j.value,R.output=(R.output||"")+j.value;return}j.prev=R,m.push(j),R=j},ie=(j,Z)=>{const N={...S[Z],conditions:1,inner:""};N.prev=R,N.parens=$.parens,N.output=$.output;const Y=(p.capture?"(":"")+N.open;$e("parens"),G({type:j,value:Z,output:$.output?"":x}),G({type:"paren",extglob:!0,value:me(),
|
|
72
|
+
output:Y}),U.push(N)},rr=j=>{let Z=j.close+(p.capture?")":""),N;if(j.type==="negate"){let Y=H;if(j.inner&&j.inner.length>1&&j.inner.includes("/")&&(Y=O(p)),(Y!==H||K()||/^\)+$/.test(Ae()))&&(Z=j.close=`)$))${Y}`),j.inner.includes("*")&&(N=Ae())&&/^\.[^\\/.]+$/.test(N)){const te=u(N,{...f,fastpaths:!1}).output;Z=j.close=`)${te})${Y})`}j.prev.type==="bos"&&($.negatedExtglob=!0)}G({type:"paren",extglob:!0,value:_,output:Z}),le("parens")};if(p.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(l)){let j=!1,
|
|
73
|
+
Z=l.replace(a,(N,Y,te,fe,oe,nr)=>fe==="\\"?(j=!0,N):fe==="?"?Y?Y+fe+(oe?L.repeat(oe.length):""):nr===0?D+(oe?L.repeat(oe.length):""):L.repeat(te.length):fe==="."?E.repeat(te.length):fe==="*"?Y?Y+fe+(oe?H:""):H:Y?N:`\\${N}`);return j===!0&&(p.unescape===!0?Z=Z.replace(/\\/g,""):Z=Z.replace(/\\+/g,N=>N.length%2===0?"\\\\":N?"\\":"")),Z===l&&p.contains===!0?($.output=l,$):($.output=e.wrapOutput(Z,$,f),$)}for(;!K();){if(_=me(),_==="\0")continue;if(_==="\\"){const N=X();if(N==="/"&&p.bash!==!0||N==="\
|
|
74
|
+
."||N===";")continue;if(!N){_+="\\",G({type:"text",value:_});continue}const Y=/^\\+/.exec(Ae());let te=0;if(Y&&Y[0].length>2&&(te=Y[0].length,$.index+=te,te%2!==0&&(_+="\\")),p.unescape===!0?_=me():_+=me(),$.brackets===0){G({type:"text",value:_});continue}}if($.brackets>0&&(_!=="]"||R.value==="["||R.value==="[^")){if(p.posix!==!1&&_===":"){const N=R.value.slice(1);if(N.includes("[")&&(R.posix=!0,N.includes(":"))){const Y=R.value.lastIndexOf("["),te=R.value.slice(0,Y),fe=R.value.slice(Y+2),oe=n[fe];
|
|
75
|
+
if(oe){R.value=te+oe,$.backtrack=!0,me(),!w.output&&m.indexOf(R)===1&&(w.output=x);continue}}}(_==="["&&X()!==":"||_==="-"&&X()==="]")&&(_=`\\${_}`),_==="]"&&(R.value==="["||R.value==="[^")&&(_=`\\${_}`),p.posix===!0&&_==="!"&&R.value==="["&&(_="^"),R.value+=_,se({value:_});continue}if($.quotes===1&&_!=='"'){_=e.escapeRegex(_),R.value+=_,se({value:_});continue}if(_==='"'){$.quotes=$.quotes===1?0:1,p.keepQuotes===!0&&G({type:"text",value:_});continue}if(_==="("){$e("parens"),G({type:"paren",value:_});
|
|
76
|
+
continue}if(_===")"){if($.parens===0&&p.strictBrackets===!0)throw new SyntaxError(c("opening","("));const N=U[U.length-1];if(N&&$.parens===N.parens+1){rr(U.pop());continue}G({type:"paren",value:_,output:$.parens?")":"\\)"}),le("parens");continue}if(_==="["){if(p.nobracket===!0||!Ae().includes("]")){if(p.nobracket!==!0&&p.strictBrackets===!0)throw new SyntaxError(c("closing","]"));_=`\\${_}`}else $e("brackets");G({type:"bracket",value:_});continue}if(_==="]"){if(p.nobracket===!0||R&&R.type==="bra\
|
|
77
|
+
cket"&&R.value.length===1){G({type:"text",value:_,output:`\\${_}`});continue}if($.brackets===0){if(p.strictBrackets===!0)throw new SyntaxError(c("opening","["));G({type:"text",value:_,output:`\\${_}`});continue}le("brackets");const N=R.value.slice(1);if(R.posix!==!0&&N[0]==="^"&&!N.includes("/")&&(_=`/${_}`),R.value+=_,se({value:_}),p.literalBrackets===!1||e.hasRegexChars(N))continue;const Y=e.escapeRegex(R.value);if($.output=$.output.slice(0,-R.value.length),p.literalBrackets===!0){$.output+=Y,
|
|
78
|
+
R.value=Y;continue}R.value=`(${g}${Y}|${R.value})`,$.output+=R.value;continue}if(_==="{"&&p.nobrace!==!0){$e("braces");const N={type:"brace",value:_,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};J.push(N),G(N);continue}if(_==="}"){const N=J[J.length-1];if(p.nobrace===!0||!N){G({type:"text",value:_,output:_});continue}let Y=")";if(N.dots===!0){const te=m.slice(),fe=[];for(let oe=te.length-1;oe>=0&&(m.pop(),te[oe].type!=="brace");oe--)te[oe].type!=="dots"&&fe.unshift(te[oe].value);
|
|
79
|
+
Y=o(fe,p),$.backtrack=!0}if(N.comma!==!0&&N.dots!==!0){const te=$.output.slice(0,N.outputIndex),fe=$.tokens.slice(N.tokensIndex);N.value=N.output="\\{",_=Y="\\}",$.output=te;for(const oe of fe)$.output+=oe.output||oe.value}G({type:"brace",value:_,output:Y}),le("braces"),J.pop();continue}if(_==="|"){U.length>0&&U[U.length-1].conditions++,G({type:"text",value:_});continue}if(_===","){let N=_;const Y=J[J.length-1];Y&&Q[Q.length-1]==="braces"&&(Y.comma=!0,N="|"),G({type:"comma",value:_,output:N});continue}
|
|
80
|
+
if(_==="/"){if(R.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",m.pop(),R=w;continue}G({type:"slash",value:_,output:b});continue}if(_==="."){if($.braces>0&&R.type==="dot"){R.value==="."&&(R.output=E);const N=J[J.length-1];R.type="dots",R.output+=_,R.value+=_,N.dots=!0;continue}if($.braces+$.parens===0&&R.type!=="bos"&&R.type!=="slash"){G({type:"text",value:_,output:E});continue}G({type:"dot",value:_,output:E});continue}if(_==="?"){if(!(R&&R.value==="(")&&p.noextglob!==
|
|
81
|
+
!0&&X()==="("&&X(2)!=="?"){ie("qmark",_);continue}if(R&&R.type==="paren"){const Y=X();let te=_;if(Y==="<"&&!e.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(R.value==="("&&!/[!=<:]/.test(Y)||Y==="<"&&!/<([!=]|\w+>)/.test(Ae()))&&(te=`\\${_}`),G({type:"text",value:_,output:te});continue}if(p.dot!==!0&&(R.type==="slash"||R.type==="bos")){G({type:"qmark",value:_,output:I});continue}G({type:"qmark",value:_,output:L});continue}if(_==="!"){if(p.noextglob!==
|
|
82
|
+
!0&&X()==="("&&(X(2)!=="?"||!/[!=<:]/.test(X(3)))){ie("negate",_);continue}if(p.nonegate!==!0&&$.index===0){tt();continue}}if(_==="+"){if(p.noextglob!==!0&&X()==="("&&X(2)!=="?"){ie("plus",_);continue}if(R&&R.value==="("||p.regex===!1){G({type:"plus",value:_,output:A});continue}if(R&&(R.type==="bracket"||R.type==="paren"||R.type==="brace")||$.parens>0){G({type:"plus",value:_});continue}G({type:"plus",value:A});continue}if(_==="@"){if(p.noextglob!==!0&&X()==="("&&X(2)!=="?"){G({type:"at",extglob:!0,
|
|
83
|
+
value:_,output:""});continue}G({type:"text",value:_});continue}if(_!=="*"){(_==="$"||_==="^")&&(_=`\\${_}`);const N=i.exec(Ae());N&&(_+=N[0],$.index+=N[0].length),G({type:"text",value:_});continue}if(R&&(R.type==="globstar"||R.star===!0)){R.type="star",R.star=!0,R.value+=_,R.output=H,$.backtrack=!0,$.globstar=!0,ne(_);continue}let j=Ae();if(p.noextglob!==!0&&/^\([^?]/.test(j)){ie("star",_);continue}if(R.type==="star"){if(p.noglobstar===!0){ne(_);continue}const N=R.prev,Y=N.prev,te=N.type==="slas\
|
|
84
|
+
h"||N.type==="bos",fe=Y&&(Y.type==="star"||Y.type==="globstar");if(p.bash===!0&&(!te||j[0]&&j[0]!=="/")){G({type:"star",value:_,output:""});continue}const oe=$.braces>0&&(N.type==="comma"||N.type==="brace"),nr=U.length&&(N.type==="pipe"||N.type==="paren");if(!te&&N.type!=="paren"&&!oe&&!nr){G({type:"star",value:_,output:""});continue}for(;j.slice(0,3)==="/**";){const gt=l[$.index+4];if(gt&>!=="/")break;j=j.slice(3),ne("/**",3)}if(N.type==="bos"&&K()){R.type="globstar",R.value+=_,R.output=O(p),
|
|
85
|
+
$.output=R.output,$.globstar=!0,ne(_);continue}if(N.type==="slash"&&N.prev.type!=="bos"&&!fe&&K()){$.output=$.output.slice(0,-(N.output+R.output).length),N.output=`(?:${N.output}`,R.type="globstar",R.output=O(p)+(p.strictSlashes?")":"|$)"),R.value+=_,$.globstar=!0,$.output+=N.output+R.output,ne(_);continue}if(N.type==="slash"&&N.prev.type!=="bos"&&j[0]==="/"){const gt=j[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(N.output+R.output).length),N.output=`(?:${N.output}`,R.type="globstar",R.output=
|
|
86
|
+
`${O(p)}${b}|${b}${gt})`,R.value+=_,$.output+=N.output+R.output,$.globstar=!0,ne(_+me()),G({type:"slash",value:"/",output:""});continue}if(N.type==="bos"&&j[0]==="/"){R.type="globstar",R.value+=_,R.output=`(?:^|${b}|${O(p)}${b})`,$.output=R.output,$.globstar=!0,ne(_+me()),G({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-R.output.length),R.type="globstar",R.output=O(p),R.value+=_,$.output+=R.output,$.globstar=!0,ne(_);continue}const Z={type:"star",value:_,output:H};if(p.bash===
|
|
87
|
+
!0){Z.output=".*?",(R.type==="bos"||R.type==="slash")&&(Z.output=P+Z.output),G(Z);continue}if(R&&(R.type==="bracket"||R.type==="paren")&&p.regex===!0){Z.output=_,G(Z);continue}($.index===$.start||R.type==="slash"||R.type==="dot")&&(R.type==="dot"?($.output+=V,R.output+=V):p.dot===!0?($.output+=F,R.output+=F):($.output+=P,R.output+=P),X()!=="*"&&($.output+=x,R.output+=x)),G(Z)}for(;$.brackets>0;){if(p.strictBrackets===!0)throw new SyntaxError(c("closing","]"));$.output=e.escapeLast($.output,"["),
|
|
88
88
|
le("brackets")}for(;$.parens>0;){if(p.strictBrackets===!0)throw new SyntaxError(c("closing",")"));$.output=e.escapeLast($.output,"("),le("parens")}for(;$.braces>0;){if(p.strictBrackets===!0)throw new SyntaxError(c("closing","}"));$.output=e.escapeLast($.output,"{"),le("braces")}if(p.strictSlashes!==!0&&(R.type==="star"||R.type==="bracket")&&G({type:"maybe_slash",value:"",output:`${b}?`}),$.backtrack===!0){$.output="";for(const j of $.tokens)$.output+=j.output!=null?j.output:j.value,j.suffix&&($.
|
|
89
|
-
output+=j.suffix)}return $};return
|
|
90
|
-
)`);const
|
|
91
|
-
m+D[2]:void 0}}},
|
|
92
|
-
{},p=n.isWindows(c),h=l?s.compileRe(
|
|
93
|
-
onMatch=="function"&&f.onMatch(A),T?A:!0)};return
|
|
94
|
-
|
|
95
|
-
"Expected a non-empty string");let f={negated:!1,fastpaths:!0};return c.fastpaths!==!1&&(
|
|
96
|
-
indexOf("{");return c>-1&&
|
|
97
|
-
!0)throw new Error(`No matches found for "${c.join(", ")}"`);if(
|
|
98
|
-
`Expected a string: "${t.inspect(
|
|
99
|
-
f),
|
|
100
|
-
(...
|
|
101
|
-
function
|
|
102
|
-
</style>`)}const
|
|
103
|
-
const
|
|
104
|
-
`);const
|
|
105
|
-
v),h=
|
|
106
|
-
`).trimStart()}function
|
|
107
|
-
`).trimStart()}function
|
|
89
|
+
output+=j.suffix)}return $};return u.fastpaths=(l,f)=>{const p={...f},h=typeof p.maxLength=="number"?Math.min(r,p.maxLength):r,v=l.length;if(v>h)throw new SyntaxError(`Input length: ${v}, exceeds maximum allowed length: ${h}`);l=s[l]||l;const w=e.isWindows(f),{DOT_LITERAL:m,SLASH_LITERAL:g,ONE_CHAR:T,DOTS_SLASH:d,NO_DOT:S,NO_DOTS:E,NO_DOTS_SLASH:A,STAR:b,START_ANCHOR:x}=t.globChars(w),q=p.dot?E:S,M=p.dot?A:S,V=p.capture?"":"?:",F={negated:!1,prefix:""};let L=p.bash===!0?".*?":b;p.capture&&(L=`(${L}\
|
|
90
|
+
)`);const I=P=>P.noglobstar===!0?L:`(${V}(?:(?!${x}${P.dot?d:m}).)*?)`,C=P=>{switch(P){case"*":return`${q}${T}${L}`;case".*":return`${m}${T}${L}`;case"*.*":return`${q}${L}${m}${T}${L}`;case"*/*":return`${q}${L}${g}${T}${M}${L}`;case"**":return q+I(p);case"**/*":return`(?:${q}${I(p)}${g})?${M}${T}${L}`;case"**/*.*":return`(?:${q}${I(p)}${g})?${M}${L}${m}${T}${L}`;case"**/.*":return`(?:${q}${I(p)}${g})?${m}${T}${L}`;default:{const D=/^(.*?)\.(\w+)$/.exec(P);if(!D)return;const H=C(D[1]);return H?H+
|
|
91
|
+
m+D[2]:void 0}}},k=e.removePrefix(l,F);let O=C(k);return O&&p.strictSlashes!==!0&&(O+=`${g}?`),O},Hr=u,Hr}var Mr,ei;function zu(){if(ei)return Mr;ei=1;const t=pr,e=Bu(),r=Vu(),n=_t(),i=At(),a=o=>o&&typeof o=="object"&&!Array.isArray(o),s=(o,c,u=!1)=>{if(Array.isArray(o)){const g=o.map(d=>s(d,c,u));return d=>{for(const S of g){const E=S(d);if(E)return E}return!1}}const l=a(o)&&o.tokens&&o.input;if(o===""||typeof o!="string"&&!l)throw new TypeError("Expected pattern to be a non-empty string");const f=c||
|
|
92
|
+
{},p=n.isWindows(c),h=l?s.compileRe(o,c):s.makeRe(o,c,!1,!0),v=h.state;delete h.state;let w=()=>!1;if(f.ignore){const g={...c,ignore:null,onMatch:null,onResult:null};w=s(f.ignore,g,u)}const m=(g,T=!1)=>{const{isMatch:d,match:S,output:E}=s.test(g,h,c,{glob:o,posix:p}),A={glob:o,state:v,regex:h,posix:p,input:g,output:E,match:S,isMatch:d};return typeof f.onResult=="function"&&f.onResult(A),d===!1?(A.isMatch=!1,T?A:!1):w(g)?(typeof f.onIgnore=="function"&&f.onIgnore(A),A.isMatch=!1,T?A:!1):(typeof f.
|
|
93
|
+
onMatch=="function"&&f.onMatch(A),T?A:!0)};return u&&(m.state=v),m};return s.test=(o,c,u,{glob:l,posix:f}={})=>{if(typeof o!="string")throw new TypeError("Expected input to be a string");if(o==="")return{isMatch:!1,output:""};const p=u||{},h=p.format||(f?n.toPosixSlashes:null);let v=o===l,w=v&&h?h(o):o;return v===!1&&(w=h?h(o):o,v=w===l),(v===!1||p.capture===!0)&&(p.matchBase===!0||p.basename===!0?v=s.matchBase(o,c,u,f):v=c.exec(w)),{isMatch:!!v,match:v,output:w}},s.matchBase=(o,c,u,l=n.isWindows(
|
|
94
|
+
u))=>(c instanceof RegExp?c:s.makeRe(c,u)).test(t.basename(o)),s.isMatch=(o,c,u)=>s(c,u)(o),s.parse=(o,c)=>Array.isArray(o)?o.map(u=>s.parse(u,c)):r(o,{...c,fastpaths:!1}),s.scan=(o,c)=>e(o,c),s.compileRe=(o,c,u=!1,l=!1)=>{if(u===!0)return o.output;const f=c||{},p=f.contains?"":"^",h=f.contains?"":"$";let v=`${p}(?:${o.output})${h}`;o&&o.negated===!0&&(v=`^(?!${v}).*$`);const w=s.toRegex(v,c);return l===!0&&(w.state=o),w},s.makeRe=(o,c={},u=!1,l=!1)=>{if(!o||typeof o!="string")throw new TypeError(
|
|
95
|
+
"Expected a non-empty string");let f={negated:!1,fastpaths:!0};return c.fastpaths!==!1&&(o[0]==="."||o[0]==="*")&&(f.output=r.fastpaths(o,c)),f.output||(f=r(o,c)),s.compileRe(f,c,u,l)},s.toRegex=(o,c)=>{try{const u=c||{};return new RegExp(o,u.flags||(u.nocase?"i":""))}catch(u){if(c&&c.debug===!0)throw u;return/$^/}},s.constants=i,Mr=s,Mr}var Ur,ti;function Wu(){return ti||(ti=1,Ur=zu()),Ur}var Fr,ri;function Xu(){if(ri)return Fr;ri=1;const t=_s,e=Gu(),r=Wu(),n=_t(),i=o=>o===""||o==="./",a=o=>{const c=o.
|
|
96
|
+
indexOf("{");return c>-1&&o.indexOf("}",c)>-1},s=(o,c,u)=>{c=[].concat(c),o=[].concat(o);let l=new Set,f=new Set,p=new Set,h=0,v=g=>{p.add(g.output),u&&u.onResult&&u.onResult(g)};for(let g=0;g<c.length;g++){let T=r(String(c[g]),{...u,onResult:v},!0),d=T.state.negated||T.state.negatedExtglob;d&&h++;for(let S of o){let E=T(S,!0);(d?!E.isMatch:E.isMatch)&&(d?l.add(E.output):(l.delete(E.output),f.add(E.output)))}}let m=(h===c.length?[...p]:[...f]).filter(g=>!l.has(g));if(u&&m.length===0){if(u.failglob===
|
|
97
|
+
!0)throw new Error(`No matches found for "${c.join(", ")}"`);if(u.nonull===!0||u.nullglob===!0)return u.unescape?c.map(g=>g.replace(/\\/g,"")):c}return m};return s.match=s,s.matcher=(o,c)=>r(o,c),s.isMatch=(o,c,u)=>r(c,u)(o),s.any=s.isMatch,s.not=(o,c,u={})=>{c=[].concat(c).map(String);let l=new Set,f=[],p=v=>{u.onResult&&u.onResult(v),f.push(v.output)},h=new Set(s(o,c,{...u,onResult:p}));for(let v of f)h.has(v)||l.add(v);return[...l]},s.contains=(o,c,u)=>{if(typeof o!="string")throw new TypeError(
|
|
98
|
+
`Expected a string: "${t.inspect(o)}"`);if(Array.isArray(c))return c.some(l=>s.contains(o,l,u));if(typeof c=="string"){if(i(o)||i(c))return!1;if(o.includes(c)||o.startsWith("./")&&o.slice(2).includes(c))return!0}return s.isMatch(o,c,{...u,contains:!0})},s.matchKeys=(o,c,u)=>{if(!n.isObject(o))throw new TypeError("Expected the first argument to be an object");let l=s(Object.keys(o),c,u),f={};for(let p of l)f[p]=o[p];return f},s.some=(o,c,u)=>{let l=[].concat(o);for(let f of[].concat(c)){let p=r(String(
|
|
99
|
+
f),u);if(l.some(h=>p(h)))return!0}return!1},s.every=(o,c,u)=>{let l=[].concat(o);for(let f of[].concat(c)){let p=r(String(f),u);if(!l.every(h=>p(h)))return!1}return!0},s.all=(o,c,u)=>{if(typeof o!="string")throw new TypeError(`Expected a string: "${t.inspect(o)}"`);return[].concat(c).every(l=>r(l,u)(o))},s.capture=(o,c,u)=>{let l=n.isWindows(u),p=r.makeRe(String(o),{...u,capture:!0}).exec(l?n.toPosixSlashes(c):c);if(p)return p.slice(1).map(h=>h===void 0?"":h)},s.makeRe=(...o)=>r.makeRe(...o),s.scan=
|
|
100
|
+
(...o)=>r.scan(...o),s.parse=(o,c)=>{let u=[];for(let l of[].concat(o||[]))for(let f of e(String(l),c))u.push(r.parse(f,c));return u},s.braces=(o,c)=>{if(typeof o!="string")throw new TypeError("Expected a string");return c&&c.nobrace===!0||!a(o)?[o]:e(o,c)},s.braceExpand=(o,c)=>{if(typeof o!="string")throw new TypeError("Expected a string");return s.braces(o,{...c,expand:!0})},s.hasBraces=a,Fr=s,Fr}var Ku=Xu();const ni=cs(Ku),Yu={useRecommendedBuildConfig:!0,removeViteModuleLoader:!1,deleteInlinedFiles:!0};
|
|
101
|
+
function Ju(t,e,r,n=!1){const i=e.replaceAll(".","\\."),a=new RegExp(`<script([^>]*?) src="(?:[^"]*?/)?${i}"([^>]*)></script>`),s=/"?__VITE_PRELOAD__"?/g,o=r.replace(s,"void 0").replace(/<(\/script>|!--)/g,"\\x3C$1"),c=t.replace(a,(u,l,f)=>`<script${l}${f}>${o.trim()}</script>`);return n?nl(c):c}function Qu(t,e,r){const n=e.replaceAll(".","\\."),i=new RegExp(`<link([^>]*?) href="(?:[^"]*?/)?${n}"([^>]*)>`),a=r.replace('@charset "UTF-8";',"");return t.replace(i,(o,c,u)=>`<style${c}${u}>${a.trim()}\
|
|
102
|
+
</style>`)}const Zu=/\.[mc]?js$/,el=/\.css$/,tl=/\.html?$/;function rl({useRecommendedBuildConfig:t=!0,removeViteModuleLoader:e=!1,inlinePattern:r=[],deleteInlinedFiles:n=!0,overrideConfig:i={}}=Yu){return{name:"vite:singlefile",config:t?s=>{s.build||(s.build={}),s.build.assetsInlineLimit=()=>!0,s.build.chunkSizeWarningLimit=1e8,s.build.cssCodeSplit=!1,s.base="./",s.build.assetsDir="",s.build.rollupOptions||(s.build.rollupOptions={}),s.build.rollupOptions.output||(s.build.rollupOptions.output={});
|
|
103
|
+
const o=c=>{c.inlineDynamicImports=!0};if(Array.isArray(s.build.rollupOptions.output))for(const c of s.build.rollupOptions.output)o(c);else o(s.build.rollupOptions.output);Object.assign(s,i)}:void 0,enforce:"post",generateBundle(s,o){const c=f=>this.info(`NOTE: asset not inlined: ${f}`);this.info(`
|
|
104
|
+
`);const u={html:[],css:[],js:[],other:[]};for(const f of Object.keys(o))tl.test(f)?u.html.push(f):el.test(f)?u.css.push(f):Zu.test(f)?u.js.push(f):u.other.push(f);const l=[];for(const f of u.html){const p=o[f];let h=p.source;for(const v of u.js){if(r.length&&!ni.isMatch(v,r)){c(v);continue}const w=o[v];w.code!=null&&(this.info(`Inlining: ${v}`),l.push(v),h=Ju(h,w.fileName,w.code,e))}for(const v of u.css){if(r.length&&!ni.isMatch(v,r)){c(v);continue}const w=o[v];this.info(`Inlining: ${v}`),l.push(
|
|
105
|
+
v),h=Qu(h,w.fileName,w.source)}p.source=h}if(n)for(const f of l)delete o[f];for(const f of u.other)c(f)}}}const nl=t=>t.replace(/(<script type="module" crossorigin>\s*)\(function(?: polyfill)?\(\)\s*\{[\s\S]*?\}\)\(\);/,'<script type="module">');function Xe(t){return t.length===0?"never":t.sort(Eu).map(e=>` | ${JSON.stringify(e)}`).join(`
|
|
106
|
+
`).trimStart()}function si(t){const e=$s(t);return e.length===0?"never":bs(e,Ru,eu(r=>` | ${JSON.stringify(r.id)}`)).join(`
|
|
107
|
+
`).trimStart()}function ii(t,e={}){const{useCorePackage:r=!1}=e;return`
|
|
108
108
|
import type { Aux, SpecAux } from '${r?"@likec4/core/types":"likec4/model"}';
|
|
109
109
|
|
|
110
110
|
export type $Specs = SpecAux<
|
|
111
111
|
// Element kinds
|
|
112
|
-
${
|
|
112
|
+
${Xe(rt(t.specification.elements))},
|
|
113
113
|
// Deployment kinds
|
|
114
|
-
${
|
|
114
|
+
${Xe(rt(t.specification.deployments??{}))},
|
|
115
115
|
// Relationship kinds
|
|
116
|
-
${
|
|
116
|
+
${Xe(rt(t.specification.relationships??{}))},
|
|
117
117
|
// Tags
|
|
118
|
-
${
|
|
118
|
+
${Xe(rt(t.specification.tags??{}))},
|
|
119
119
|
// Metadata keys
|
|
120
|
-
${
|
|
120
|
+
${Xe(t.specification.metadataKeys??[])}
|
|
121
121
|
>
|
|
122
122
|
|
|
123
123
|
export type $Aux = Aux<
|
|
124
124
|
${JSON.stringify(t.stage)},
|
|
125
125
|
// Elements
|
|
126
|
-
${
|
|
126
|
+
${si(t.$data.elements)},
|
|
127
127
|
// Deployments
|
|
128
|
-
${
|
|
128
|
+
${si(t.$data.deployments.elements)},
|
|
129
129
|
// Views
|
|
130
|
-
${
|
|
130
|
+
${Xe(rt(t.$data.views))},
|
|
131
131
|
// Project ID
|
|
132
132
|
${JSON.stringify(t.projectId)},
|
|
133
133
|
$Specs
|
|
@@ -143,7 +143,7 @@ export type $DeploymentKind = $Aux['DeploymentKind']
|
|
|
143
143
|
export type $Tag = $Aux['Tag']
|
|
144
144
|
export type $Tags = readonly $Aux['Tag'][]
|
|
145
145
|
export type $MetadataKey = $Aux['MetadataKey']
|
|
146
|
-
`.trimStart()}function
|
|
146
|
+
`.trimStart()}function sl(t,e={}){const r=ii(t,e),{useCorePackage:n=!1}=e;return`
|
|
147
147
|
/* prettier-ignore-start */
|
|
148
148
|
/* eslint-disable */
|
|
149
149
|
|
|
@@ -155,10 +155,10 @@ export type $MetadataKey = $Aux['MetadataKey']
|
|
|
155
155
|
import { LikeC4Model } from '${n?"@likec4/core":"likec4"}/model'
|
|
156
156
|
${r}
|
|
157
157
|
|
|
158
|
-
export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(${
|
|
158
|
+
export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(${We.stringify(t.$data,{space:2,quote:"'"})} as any) as any
|
|
159
159
|
|
|
160
160
|
/* prettier-ignore-end */
|
|
161
|
-
`.trimStart()}function
|
|
161
|
+
`.trimStart()}function il(t){return Cs(t,e=>xs`${We.stringify(e.id)}`,{separator:" | "})}function ol(t){const e=Array.from(t),r=new cu;return r.appendTemplate`
|
|
162
162
|
/******************************************************************************
|
|
163
163
|
* This file was generated
|
|
164
164
|
* DO NOT EDIT MANUALLY!
|
|
@@ -169,10 +169,10 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(${Be.stringify(t.$
|
|
|
169
169
|
// @ts-nocheck
|
|
170
170
|
|
|
171
171
|
import type { DiagramView } from 'likec4'
|
|
172
|
-
`.append(
|
|
173
|
-
export type LikeC4ViewId = ${
|
|
172
|
+
`.append(ze,ze),e.length===0?(r.append("export {}",ze),Ts(r)):(r.appendTemplate`
|
|
173
|
+
export type LikeC4ViewId = ${il(e)};
|
|
174
174
|
export const LikeC4Views = {
|
|
175
|
-
`.indent({indentation:2,indentedChildren(n){n.appendNewLineIf(e.length>1).append(
|
|
175
|
+
`.indent({indentation:2,indentedChildren(n){n.appendNewLineIf(e.length>1).append(Cs(e,i=>xs`${We.stringify(i.id)}: (${We.stringify(i)} as unknown) as DiagramView`,{separator:",",appendNewLineIfNotEmpty:!0}))}}).append("} as const satisfies Record<LikeC4ViewId, DiagramView>",ze,ze).appendTemplate`
|
|
176
176
|
export type LikeC4Views = typeof LikeC4Views
|
|
177
177
|
|
|
178
178
|
export function isLikeC4ViewId(value: unknown): value is LikeC4ViewId {
|
|
@@ -184,7 +184,7 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(${Be.stringify(t.$
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
/* prettier-ignore-end */
|
|
187
|
-
`.append(
|
|
187
|
+
`.append(ze),Ts(r))}function al(t,e={}){const{useCorePackage:r=!1}=e;Su(!t.isParsed(),"can not generate react types for parsed model");const n=ii(t,e);return`
|
|
188
188
|
/* prettier-ignore-start */
|
|
189
189
|
/* eslint-disable */
|
|
190
190
|
|
|
@@ -240,254 +240,261 @@ export {
|
|
|
240
240
|
ReactLikeC4
|
|
241
241
|
}
|
|
242
242
|
/* prettier-ignore-end */
|
|
243
|
-
`.trimStart()}const
|
|
244
|
-
webcomponentPrefix:c,title:
|
|
245
|
-
tils","@likec4/core","likec4/model","likec4/react","likec4/vite-plugin/internal"],noDiscovery:!0},esbuild:{tsconfigRaw:{compilerOptions:{target:"ESNext",jsx:"react-jsx"}}},define:{WEBCOMPONENT_PREFIX:JSON.stringify(c),PAGE_TITLE:JSON.stringify(
|
|
246
|
-
treeshake:{preset:"recommended"},...!l&&{input:[
|
|
247
|
-
{languageServices:t.languageServices,useOverviewGraph:
|
|
248
|
-
ient"]},define:{WEBCOMPONENT_PREFIX:JSON.stringify(n),"process.env.NODE_ENV":'"production"'},esbuild:{...
|
|
249
|
-
|
|
250
|
-
if(
|
|
251
|
-
t of date, layout drift detected"))})}else for(const l of
|
|
252
|
-
ex.html"))
|
|
253
|
-
"npx",0],"execute-local":["npx",0],uninstall:["npm","uninstall",0],global_uninstall:["npm","uninstall","-g",0]},
|
|
254
|
-
move",0]},
|
|
255
|
-
"update","-i",0],dedupe:["pnpm","dedupe",0],execute:["pnpm","dlx",0],"execute-local":["pnpm","exec",0],uninstall:["pnpm","remove",0],global_uninstall:["pnpm","remove","--global",0]},
|
|
256
|
-
remove",0],global_uninstall:["bun","remove","-g",0]},
|
|
257
|
-
"pnpm@6":{...
|
|
258
|
-
npm"},
|
|
259
|
-
!await
|
|
260
|
-
eld":{const s=await
|
|
261
|
-
packageManager?.name=="string")return{name:t.devEngines.packageManager.name,ver:e(t.devEngines.packageManager.version)}}async function
|
|
262
|
-
{name:s,agent:
|
|
263
|
-
process.exit(1));const e=
|
|
243
|
+
`.trimStart()}const Gr=async({languageServices:t,likec4AssetsDir:e,...r})=>{const n=r.customLogger??Nu,i=$r(),a=r?.useOverviewGraph===!0;n.info(`${y.cyan("likec4 app root")} ${y.dim(i)}`);const s=r.outputDir??z(t.workspace,"dist");n.info(y.cyan("outDir")+" "+y.dim(s));let o="/";r.base&&(o=us(r.base),!Cc(o)&&o!=="./"&&(o=xc(o))),o!=="/"&&n.info(`${y.green("app base url")} ${y.dim(o)}`);const c=r.webcomponentPrefix??"likec4",u=r.title??"LikeC4",l=r.outputSingleFile??!1;return{isDev:!1,likec4AssetsDir:e,
|
|
244
|
+
webcomponentPrefix:c,title:u,root:i,languageServices:t,clearScreen:!1,base:o,resolve:{conditions:["production"],dedupe:["react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client"],alias:{...Rr(),"likec4/previews":e}},configFile:!1,mode:"production",optimizeDeps:{include:["react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client","@likec4/core/types","@likec4/core/model","@likec4/core/styles","@likec4/core/compute-view/relationships","@likec4/core/u\
|
|
245
|
+
tils","@likec4/core","likec4/model","likec4/react","likec4/vite-plugin/internal"],noDiscovery:!0},esbuild:{tsconfigRaw:{compilerOptions:{target:"ESNext",jsx:"react-jsx"}}},define:{WEBCOMPONENT_PREFIX:JSON.stringify(c),PAGE_TITLE:JSON.stringify(u),__USE_OVERVIEW_GRAPH__:a?"true":"false",__USE_HASH_HISTORY__:r?.useHashHistory===!0?"true":"false","process.env.NODE_ENV":'"production"'},build:{outDir:s,emptyOutDir:!1,sourcemap:!1,cssMinify:!1,minify:!0,copyPublicDir:!0,chunkSizeWarningLimit:Er,rollupOptions:{
|
|
246
|
+
treeshake:{preset:"recommended"},...!l&&{input:[z(i,"index.html"),z(i,"src","main.js"),z(i,"src","fonts.css"),z(i,"src","style.css")],output:{manualChunks:f=>{if(!(f.endsWith(".css")||f.endsWith(".html")||f.includes("likec4/icons"))){if(f.includes("__app__")){let p=f.match(/__app__\/src\/([\w]+)\.js/)?.[1];return p?p[1]:void 0}if(f.includes("node_modules/likec4")||f.includes("node_modules/@likec4"))return"likec4";if(f.includes("node_modules"))return"vendors"}}}}}},customLogger:n,plugins:[fr(),dr(
|
|
247
|
+
{languageServices:t.languageServices,useOverviewGraph:a}),l?rl():void 0].filter(Boolean)}};async function Br({languageServices:t,outDir:e,base:r,webcomponentPrefix:n="likec4",filename:i="likec4-views.js"}){const a=ve(["vite","webcomponent"]),s=$r();return a.info(y.cyan("outDir")+" "+y.dim(e)),{root:s,clearScreen:!1,base:r,configFile:!1,publicDir:!1,mode:"production",resolve:{conditions:["production"],alias:Rr(),dedupe:["react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/cl\
|
|
248
|
+
ient"]},define:{WEBCOMPONENT_PREFIX:JSON.stringify(n),"process.env.NODE_ENV":'"production"'},esbuild:{...vr,tsconfigRaw:{compilerOptions:{target:"ESNext",jsx:"react-jsx"}}},build:{outDir:e,emptyOutDir:!1,sourcemap:!1,minify:!0,assetsInlineLimit:100*1024,chunkSizeWarningLimit:Er,lib:{entry:"src/webcomponent.js",fileName(o,c){return i},formats:["iife"],name:"LikeC4Views"},rollupOptions:{treeshake:{preset:"recommended"},output:{format:"iife",hoistTransitiveImports:!1,compact:!0}}},customLogger:a,plugins:[
|
|
249
|
+
fr(),dr({languageServices:t.languageServices,useOverviewGraph:!1})]}}const cl=["favicon.ico","robots.txt"],ul=async({buildWebcomponent:t=!0,webcomponentPrefix:e="likec4",title:r,languageServices:n,likec4AssetsDir:i,outputSingleFile:a,...s})=>{i??=await bt(it(Et(),".likec4-assets-"));const o=await Gr({...s,languageServices:n,likec4AssetsDir:i,webcomponentPrefix:e,title:r,outputSingleFile:a}),c=await br();for(const l of cl){const f=z(o.root,l);_e(f)&&ws(f,z(c,l))}const u=n.languageServices.projects();
|
|
250
|
+
if(u.length===1){const l=await n.viewsService.computedViews(),f=await n.diagrams();if(f.length===0)throw process.exitCode=1,new Error("no views found");f.length===l.length?o.customLogger.info(`${y.dim("workspace:")} ${y.green("\u2713 all views layouted")}`):o.customLogger.warn(`${y.dim("workspace:")} ${y.yellow(`\u2717 layouted ${f.length} of ${l.length} views`)}`),f.forEach(p=>{(p.hasLayoutDrift||p.drifts&&p.drifts.length>0)&&o.customLogger.warn(y.dim("view")+" "+y.red(p.id)+" "+y.yellow("is ou\
|
|
251
|
+
t of date, layout drift detected"))})}else for(const l of u){const f=await n.viewsService.computedViews(l.id);f.length===0?o.customLogger.warn(`${y.dim("project:")} ${l.id} ${y.yellow("\u2717 no views found")}`):o.customLogger.info(`${y.dim("project:")} ${l.id} ${y.green(`${f.length} views`)}`)}if(t){const l=await Br({webcomponentPrefix:e,languageServices:n,outDir:c,base:o.base});await ct(l)}if(await ct({...o,publicDir:c,mode:"production"}),a)for(let l of Kc(z(o.build.outDir)).filter(f=>f!=="ind\
|
|
252
|
+
ex.html"))cr(z(o.build.outDir,l),{recursive:!0});else{const l=z(o.build.outDir,"index.html");_e(l)&&ws(l,z(o.build.outDir,"404.html"))}};function Vr(t,e){return r=>r.length>1?[t,e,r[0],"--",...r.slice(1)]:[t,e,r[0]]}function ll(){return t=>["deno","run",`npm:${t[0]}`,...t.slice(1)]}const fl={agent:["npm",0],run:Vr("npm","run"),install:["npm","i",0],frozen:["npm","ci",0],global:["npm","i","-g",0],add:["npm","i",0],upgrade:["npm","update",0],"upgrade-interactive":null,dedupe:["npm","dedupe",0],execute:[
|
|
253
|
+
"npx",0],"execute-local":["npx",0],uninstall:["npm","uninstall",0],global_uninstall:["npm","uninstall","-g",0]},oi={agent:["yarn",0],run:["yarn","run",0],install:["yarn","install",0],frozen:["yarn","install","--frozen-lockfile",0],global:["yarn","global","add",0],add:["yarn","add",0],upgrade:["yarn","upgrade",0],"upgrade-interactive":["yarn","upgrade-interactive",0],dedupe:null,execute:["npx",0],"execute-local":Vr("yarn","exec"),uninstall:["yarn","remove",0],global_uninstall:["yarn","global","re\
|
|
254
|
+
move",0]},pl={...oi,frozen:["yarn","install","--immutable",0],upgrade:["yarn","up",0],"upgrade-interactive":["yarn","up","-i",0],dedupe:["yarn","dedupe",0],execute:["yarn","dlx",0],"execute-local":["yarn","exec",0],global:["npm","i","-g",0],global_uninstall:["npm","uninstall","-g",0]},ai={agent:["pnpm",0],run:["pnpm","run",0],install:["pnpm","i",0],frozen:["pnpm","i","--frozen-lockfile",0],global:["pnpm","add","-g",0],add:["pnpm","add",0],upgrade:["pnpm","update",0],"upgrade-interactive":["pnpm",
|
|
255
|
+
"update","-i",0],dedupe:["pnpm","dedupe",0],execute:["pnpm","dlx",0],"execute-local":["pnpm","exec",0],uninstall:["pnpm","remove",0],global_uninstall:["pnpm","remove","--global",0]},dl={agent:["bun",0],run:["bun","run",0],install:["bun","install",0],frozen:["bun","install","--frozen-lockfile",0],global:["bun","add","-g",0],add:["bun","add",0],upgrade:["bun","update",0],"upgrade-interactive":["bun","update","-i",0],dedupe:null,execute:["bun","x",0],"execute-local":["bun","x",0],uninstall:["bun","\
|
|
256
|
+
remove",0],global_uninstall:["bun","remove","-g",0]},hl={agent:["deno",0],run:["deno","task",0],install:["deno","install",0],frozen:["deno","install","--frozen",0],global:["deno","install","-g",0],add:["deno","add",0],upgrade:["deno","outdated","--update",0],"upgrade-interactive":["deno","outdated","--update",0],dedupe:null,execute:ll(),"execute-local":["deno","task","--eval",0],uninstall:["deno","remove",0],global_uninstall:["deno","uninstall","-g",0]},ml={npm:fl,yarn:oi,"yarn@berry":pl,pnpm:ai,
|
|
257
|
+
"pnpm@6":{...ai,run:Vr("pnpm","run")},bun:dl,deno:hl};function gl(t,e,r){const n=ml[t][e];return yl(n,r)}function yl(t,e){if(t==null)return null;const r=typeof t=="function"?t(e):t.flatMap(n=>typeof n=="number"?e:[n]);return{command:r[0],args:r.slice(1)}}const wl=["npm","yarn","yarn@berry","pnpm","pnpm@6","bun","deno"],ci={"bun.lock":"bun","bun.lockb":"bun","deno.lock":"deno","pnpm-lock.yaml":"pnpm","pnpm-workspace.yaml":"pnpm","yarn.lock":"yarn","package-lock.json":"npm","npm-shrinkwrap.json":"\
|
|
258
|
+
npm"},ui={"node_modules/.deno/":"deno","node_modules/.pnpm/":"pnpm","node_modules/.yarn-state.yml":"yarn","node_modules/.yarn_integrity":"yarn","node_modules/.package-lock.json":"npm",".pnp.cjs":"yarn",".pnp.js":"yarn","bun.lock":"bun","bun.lockb":"bun"};async function zr(t,e){try{const r=await Ss.stat(t);return e==="file"?r.isFile():r.isDirectory()}catch{return!1}}function*vl(t=re.cwd()){let e=W.resolve(t);const{root:r}=W.parse(e);for(;e&&e!==r;)yield e,e=W.dirname(e)}async function li(t,e){return!t||
|
|
259
|
+
!await zr(t,"file")?null:await El(t,e)}async function $l(t={}){const{cwd:e,strategies:r=["lockfile","packageManager-field","devEngines-field"]}=t;let n;if(typeof t.stopDir=="string"){const i=W.resolve(t.stopDir);n=a=>a===i}else n=t.stopDir;for(const i of vl(e)){for(const a of r)switch(a){case"lockfile":{for(const s of Object.keys(ci))if(await zr(W.join(i,s),"file")){const o=ci[s],c=await li(W.join(i,"package.json"),t);return c||{name:o,agent:o}}break}case"packageManager-field":case"devEngines-fi\
|
|
260
|
+
eld":{const s=await li(W.join(i,"package.json"),t);if(s)return s;break}case"install-metadata":{for(const s of Object.keys(ui)){const o=s.endsWith("/")?"dir":"file";if(await zr(W.join(i,s),o)){const c=ui[s],u=c==="yarn"?Rl(s)?"yarn":"yarn@berry":c;return{name:c,agent:u}}}break}}if(n?.(i))break}return null}function bl(t){const e=r=>r?.match(/\d+(\.\d+){0,2}/)?.[0]??r;if(typeof t.packageManager=="string"){const[r,n]=t.packageManager.replace(/^\^/,"").split("@");return{name:r,ver:e(n)}}if(typeof t.devEngines?.
|
|
261
|
+
packageManager?.name=="string")return{name:t.devEngines.packageManager.name,ver:e(t.devEngines.packageManager.version)}}async function El(t,e){try{const r=await Ss.readFile(t,"utf8"),n=e.packageJsonParser?await e.packageJsonParser(r,t):JSON.parse(r);let i;const a=bl(n);if(a){const s=a.name,o=a.ver;let c=o;return s==="yarn"&&o&&Number.parseInt(o)>1?(i="yarn@berry",c="berry",{name:s,agent:i,version:c}):s==="pnpm"&&o&&Number.parseInt(o)<7?(i="pnpm@6",{name:s,agent:i,version:c}):wl.includes(s)?(i=s,
|
|
262
|
+
{name:s,agent:i,version:c}):e.onUnknown?.(n.packageManager)??null}}catch{}return null}function Rl(t){return t.endsWith(".yarn_integrity")}function fi(t){try{return!!hu.createRequire(import.meta.url).resolve(t)}catch(e){return ge.debug(yt(e)),!1}}async function lt(){if(fi("react")&&fi("react-dom")){ge.debug("react already installed");return}ge.debug("react not installed");const t=await $l();t||(ge.error`Package manager not detected, please install dependencies manually: ${"react"} ${"react-dom"}`,
|
|
263
|
+
process.exit(1));const e=gl(t.agent,"add",["react","react-dom"]);e||(ge.error`Please install dependencies manually: ${"react"} ${"react-dom"}`,process.exit(1));try{await ls(e.command,e.args,{stdio:"inherit"})}catch(r){ge.debug(yt(r)),ge.error`Please install dependencies manually: ${"react"} ${"react-dom"}`,process.exit(1)}}function pi(t){if(t.resolvedUrls)return fs(t.resolvedUrls.network)??fs(t.resolvedUrls.local)}function di(t){if(!t.resolvedUrls)throw new Error("Vite server is not ready, no re\
|
|
264
264
|
solvedUrls");Te([y.green("LikeC4 served at:"),"",y.dim("Local: ")+t.resolvedUrls.local.join(`
|
|
265
265
|
`+"".padEnd(9," ")),t.resolvedUrls.network.length?y.dim("Network: ")+t.resolvedUrls.network.join(`
|
|
266
|
-
`+"".padEnd(9," ")):void 0].filter(e=>
|
|
267
|
-
`))}class
|
|
268
|
-
try{await
|
|
269
|
-
responding to the port you want excluded.");if(!Number.isSafeInteger(
|
|
270
|
-
if(!["EADDRINUSE","EACCES"].includes(
|
|
271
|
-
|
|
272
|
-
w=
|
|
273
|
-
base:f.base}).then(g=>
|
|
274
|
-
catch(E=>n.error(`failed to close page: ${E}`)),
|
|
275
|
-
(T=h.sequenceLayout.bounds);const d=20;await
|
|
266
|
+
`+"".padEnd(9," ")):void 0].filter(e=>Tc(e)).join(`
|
|
267
|
+
`))}class hi extends Error{constructor(e){super(`${e} is locked`)}}const Ke={old:new Set,young:new Set},Sl=1e3*15,Ct=1024,xt=65535;let ft;const Al=()=>{const t=at.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(const r of Object.values(t))for(const n of r)e.add(n.address);return e},mi=t=>new Promise((e,r)=>{const n=mu.createServer();n.unref(),n.on("error",r),n.listen(t,()=>{const{port:i}=n.address();n.close(()=>{e(i)})})}),gi=async(t,e)=>{if(t.host||t.port===0)return mi(t);for(const r of e)
|
|
268
|
+
try{await mi({port:t.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return t.port},_l=function*(t){t&&(yield*t),yield 0};async function Wr(t){let e,r=new Set;if(t&&(t.port&&(e=typeof t.port=="number"?[t.port]:t.port),t.exclude)){const i=t.exclude;if(typeof i[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(const a of i){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number cor\
|
|
269
|
+
responding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}r=new Set(i)}ft===void 0&&(ft=setTimeout(()=>{ft=void 0,Ke.old=Ke.young,Ke.young=new Set},Sl),ft.unref&&ft.unref());const n=Al();for(const i of _l(e))try{if(r.has(i))continue;let a=await gi({...t,port:i},n);for(;Ke.old.has(a)||Ke.young.has(a);){if(i!==0)throw new hi(i);a=await gi({...t,port:i},n)}return Ke.young.add(a),a}catch(a){
|
|
270
|
+
if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof hi))throw a}throw new Error("No available ports found")}function Tt(t,e){if(!Number.isInteger(t)||!Number.isInteger(e))throw new TypeError("`from` and `to` must be integer numbers");if(t<Ct||t>xt)throw new RangeError(`'from' must be between ${Ct} and ${xt}`);if(e<Ct||e>xt)throw new RangeError(`'to' must be between ${Ct} and ${xt}`);if(t>e)throw new RangeError("`to` must be greater than or equal to `from`");return function*(n,i){for(let a=n;a<=
|
|
271
|
+
i;a++)yield a}(t,e)}async function yi({buildWebcomponent:t=!0,hmr:e=!0,webcomponentPrefix:r="likec4",title:n,languageServices:i,likec4AssetsDir:a,openBrowser:s,listen:o,port:c,...u}){a??=await bt(it(Et(),".likec4-assets-"));const{isDev:l,...f}=await Gr({...u,languageServices:i,likec4AssetsDir:a,webcomponentPrefix:r,title:n}),p=f.customLogger;c??=Es.PORT?parseInt(Es.PORT,10):void 0,c||(c=await Wr({port:[5173,5174,...Tt(61e3,61010),...Tt(62002,62010)]}));const h=await Wr({port:Tt(24678,24690)}),v=await br(),
|
|
272
|
+
w=o??(Le()?"0.0.0.0":"localhost");e?(p.info(`Enabling HMR: localhost:${h}`),Le()&&p.info(y.yellow(`ensure port ${h} is published from container`))):p.info("Disabling HMR");const m=await pu({...f,define:e?{...f.define,"process.env.NODE_ENV":'"development"'}:f.define,mode:e?"development":f.mode,publicDir:v,server:{host:w,allowedHosts:!0,port:c,hmr:e&&{overlay:!0,port:h},fs:{strict:!1},open:s??(!l&&!Le())}});return t?(p.info("Building webcomponent"),Br({webcomponentPrefix:r,languageServices:i,outDir:v,
|
|
273
|
+
base:f.base}).then(g=>ct({...g,logLevel:"warn"})).catch(g=>{p.warn(yt(g)),p.warn("webcomponent build failed, ignoring error and continue")})):p.info("Skip webcomponent build"),await m.listen(),m}async function Cl({browserContext:t,views:e,output:r,logger:n,timeout:i,maxAttempts:a,dynamicVariant:s,outputType:o,theme:c}){let u;const l=e.map(h=>({view:h,attempt:1})),f=[];let p;for(;p=l.shift();){const{view:h,attempt:v}=p,w=`export/${encodeURIComponent(h.id)}/`;try{if(v>1){u&&(u.close({runBeforeUnload:!0}).
|
|
274
|
+
catch(E=>n.error(`failed to close page: ${E}`)),u=void 0);const S=ps(v*200,{min:200,max:1e3});n.info(y.cyan(w)+y.dim(` attempt ${v} of ${a} after ${S}ms`)),await gu(S)}else h.hasLayoutDrift&&n.warn(y.yellow("Drift detected, manual layout can not be applied, view may be invalid: ")+y.red(h.id));let m=".";o==="relative"&&(m=h.sourcePath??".",m.includes("/")?m=m.slice(0,m.lastIndexOf("/")):m=".");const g=z(r,m,`${h.id}.png`);u??=await t.newPage();let T=h.bounds;s==="sequence"&&h._type==="dynamic"&&
|
|
275
|
+
(T=h.sequenceLayout.bounds);const d=20;await u.setViewportSize({width:T.width+40+d,height:T.height+40+d}),await u.goto(Ic(w,{padding:20,theme:c,dynamic:s})),n.info(y.cyan(w)+y.dim(` -> ${Ce(r,g)}`)),await u.waitForSelector(".react-flow.initialized"),h.nodes.some(S=>Oc(S.icon)&&S.icon.toLowerCase().startsWith("http"))&&await xl(u,i),await u.getByTestId("export-page").screenshot({animations:"disabled",path:g,omitBackground:!0}),f.push({view:h,path:g})}catch(m){u?.close({runBeforeUnload:!0}).catch(
|
|
276
276
|
g=>n.error(`failed to close page: ${g}`)),n.error(y.red("failed "+w+`
|
|
277
|
-
`+m)),v<
|
|
278
|
-
cDispose")],n===void 0&&(n=e[
|
|
279
|
-
return Promise.resolve(
|
|
277
|
+
`+m)),v<a&&(l.push({view:h,attempt:v+1}),n.info(y.dim(`retry ${w}`))),u=void 0}}return f}async function xl(t,e){let r=await t.locator("//img").all();if(!r.length)return;const n=r.map(i=>i.evaluate(a=>a.complete||new Promise(s=>{a.onload=s,a.onerror=s}),{timeout:Math.max(15e3,e)}));await Promise.allSettled(n)}var wi=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),vi=t=>{throw TypeError(t)},Tl=(t,e,r)=>{if(e!=null){typeof e!="object"&&typeof e!="function"&&vi("Object expected");var n,i;n=e[wi("asyn\
|
|
278
|
+
cDispose")],n===void 0&&(n=e[wi("dispose")],i=n),typeof n!="function"&&vi("Object not disposable"),i&&(n=function(){try{i.call(this)}catch(a){return Promise.reject(a)}}),t.push([r,n,e])}else t.push([r]);return e},Il=(t,e,r)=>{var n=typeof SuppressedError=="function"?SuppressedError:function(s,o,c,u){return u=Error(c),u.name="SuppressedError",u.error=s,u.suppressed=o,u},i=s=>e=r?new n(s,e,"An error was suppressed during disposal"):(r=!0,s),a=s=>{for(;s=t.pop();)try{var o=s[1]&&s[1].call(s[2]);if(s[0])
|
|
279
|
+
return Promise.resolve(o).then(a,c=>(i(c),a()))}catch(c){i(c)}if(r)throw e};return a()};async function $i({logger:t,serverUrl:e,theme:r="light",timeoutMs:n=15e3,views:i,output:a,outputType:s="relative",maxAttempts:o=3,chromiumSandbox:c=!1,sequence:u=!1}){t.info(`${y.dim("output")} ${a}`),t.info(`${y.dim("base url")} ${e}
|
|
280
280
|
`);const{chromium:l}=await import("playwright"),f=l.executablePath();t.info(y.cyan("Start chromium")+" "+y.dim(f));const p=await l.launch({chromiumSandbox:c,headless:!0});t.info(y.cyan("Color scheme: ")+r+`
|
|
281
|
-
`);const h=await p.newContext({deviceScaleFactor:2,colorScheme:r,baseURL:e,bypassCSP:!0,ignoreHTTPSErrors:!0,isMobile:!1});h.setDefaultNavigationTimeout(n),h.setDefaultTimeout(n);try{return await
|
|
282
|
-
ignore:
|
|
283
|
-
hmr:!1}),s=
|
|
284
|
-
!0):(g.info(`${y.gray("skip")} ${y.dim(
|
|
285
|
-
`),M.length!==b.length&&(
|
|
286
|
-
throw TypeError(t)},
|
|
287
|
-
|
|
288
|
-
te",watch:!1}),!0),w=s??
|
|
289
|
-
`),await
|
|
290
|
-
f=!0}finally{var p=
|
|
291
|
-
ch for likec4 files in 'src' and output static site to 'build'")),handler:async e=>{await
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
function af(){if(
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
/
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
281
|
+
`);const h=await p.newContext({deviceScaleFactor:2,colorScheme:r,baseURL:e,bypassCSP:!0,ignoreHTTPSErrors:!0,isMobile:!1});h.setDefaultNavigationTimeout(n),h.setDefaultTimeout(n);try{return await Cl({browserContext:h,views:i,output:a,outputType:s,logger:t,maxAttempts:o,dynamicVariant:u?"sequence":"diagram",timeout:n,theme:r})}finally{t.info(y.cyan("close chromium")),await h.close(),await p.close()}}async function bi({path:t,useDotBin:e,project:r,theme:n="light",output:i,outputType:a,serverUrl:s,
|
|
282
|
+
ignore:o=!1,timeoutMs:c=1e4,maxAttempts:u=3,filter:l,sequence:f=!1,chromiumSandbox:p=!1}){var h=[];try{const g=ve("export"),T=Jc(),d=Tl(h,await ye.fromWorkspace(t,{logger:"vite",graphviz:e?"binary":"wasm",watch:!1}),!0);i??=d.workspace;let S,E=[...d.languageServices.projects()];if(r&&!E.some(A=>A.id===r))throw g.error(`project not found: ${r}`),new Error(`project not found: ${r}`);if(!s&&(g.info(y.cyan("start preview server")),S=await yi({languageServices:d,buildWebcomponent:!1,openBrowser:!1,useOverviewGraph:!1,
|
|
283
|
+
hmr:!1}),s=pi(S),!s))throw g.error("Vite server is not ready, no resolvedUrls"),new Error("Vite server is not ready, no resolvedUrls");for(const A of E){if(r&&A.id!==r)continue;E.length>1&&(g.info(y.dim("---------")),g.info(`${y.dim("project:")} ${A.id}`),g.info(`${y.dim("folder:")} ${A.folder.fsPath}`));let b=await d.diagrams(A.id);if(l&&st(l,1)&&st(b,1)){const F=Lc(l);g.info(`${y.cyan("filter")} ${y.dim(JSON.stringify(l))}`),b=b.filter(L=>F(L.id)?(g.info(`${y.green("include")} ${L.id} \u2705`),
|
|
284
|
+
!0):(g.info(`${y.gray("skip")} ${y.dim(L.id)}`),!1))}if(!st(b,1)){g.warn("no views found");continue}let x=E.length>1?us(ds(s,"project",A.id)):s,q=E.length>1?ds(i,A.id):i;const M=await $i({logger:g,serverUrl:x,theme:n,timeoutMs:c,views:b,output:q,outputType:a,maxAttempts:u,sequence:f,chromiumSandbox:p}),{pretty:V}=kc(T);if(M.length>0&&g.info(y.green(`exported ${M.length} views in ${V}`)+`
|
|
285
|
+
`),M.length!==b.length&&(o&&M.length>0?g.info(y.dim("ignore")+" "+y.red(`failed ${b.length-M.length} out of ${b.length} views`)):g.error(y.red(`failed ${b.length-M.length} out of ${b.length} views`))),M.length!==b.length&&(M.length===0||!o))throw new Error(`Failed ${b.length-M.length} out of ${b.length} views`)}S&&(g.info(y.cyan("stop server")),await S.close().catch(A=>{g.error(A)}))}catch(g){var v=g,w=!0}finally{var m=Il(h,v,w);m&&await m}}var Ei=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ri=t=>{
|
|
286
|
+
throw TypeError(t)},Ol=(t,e,r)=>{if(e!=null){typeof e!="object"&&typeof e!="function"&&Ri("Object expected");var n,i;n=e[Ei("asyncDispose")],n===void 0&&(n=e[Ei("dispose")],i=n),typeof n!="function"&&Ri("Object not disposable"),i&&(n=function(){try{i.call(this)}catch(a){return Promise.reject(a)}}),t.push([r,n,e])}else t.push([r]);return e},Ll=(t,e,r)=>{var n=typeof SuppressedError=="function"?SuppressedError:function(s,o,c,u){return u=Error(c),u.name="SuppressedError",u.error=s,u.suppressed=o,u},
|
|
287
|
+
i=s=>e=r?new n(s,e,"An error was suppressed during disposal"):(r=!0,s),a=s=>{for(;s=t.pop();)try{var o=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(o).then(a,c=>(i(c),a()))}catch(c){i(c)}if(r)throw e};return a()};const{cyan:Si,dim:Ai}=y;async function kl({path:t,useDotBin:e,useHashHistory:r,webcomponentPrefix:n,title:i,useOverview:a=!1,output:s,outputSingleFile:o,base:c}){var u=[];try{await lt();const h=ve("c4:build"),v=Ol(u,await ye.fromWorkspace(t,{graphviz:e?"binary":"wasm",logger:"vi\
|
|
288
|
+
te",watch:!1}),!0),w=s??z(v.workspace,"dist");let m=z(w,"assets");if(a)try{m=z(w,"assets","previews"),await Se(m,{recursive:!0}),h.info(`${Si("Generate previews")} ${Ai(m)}
|
|
289
|
+
`),await bi({path:t,useDotBin:e,project:void 0,output:m,outputType:"flat",ignore:!0})}catch(g){h.error(y.red("Failed to generate previews")),h.error(g),h.warn(y.yellow("Ignore previews and continue build")),cr(m,{recursive:!0,force:!0}),a=!1}await ul({base:c,useHashHistory:o||r,customLogger:h,useOverviewGraph:a,webcomponentPrefix:n,title:i,languageServices:v,likec4AssetsDir:m,outputDir:s,outputSingleFile:o}),a&&(h.info(`${Si("clean previews")} ${Ai(m)}`),cr(m,{recursive:!0,force:!0}))}catch(h){var l=h,
|
|
290
|
+
f=!0}finally{var p=Ll(u,l,f);p&&await p}}const Nl=t=>t.command({command:"build [path]",aliases:["bundle"],describe:"Build a static website",builder:e=>e.positional("path",pe).option("output",{alias:"o",type:"string",desc:"output directory for production build",normalize:!0,coerce:z}).option("base",js).option("use-hash-history",Ns).option("use-dot",he).option("webcomponent-prefix",wr).option("title",Ps).option("output-single-file",Tu).example(`${y.green("$0 build -o ./build ./src")}`,y.gray("Sear\
|
|
291
|
+
ch for likec4 files in 'src' and output static site to 'build'")),handler:async e=>{await kl({path:e.path,output:e.output,base:e.base,useHashHistory:e["use-hash-history"],useDotBin:e["use-dot"],webcomponentPrefix:e["webcomponent-prefix"],title:e.title,outputSingleFile:e["output-single-file"]??!1})}}),Ue=t=>{const e=typeof t;return t!==null&&(e==="object"||e==="function")},_i=new Set(["__proto__","prototype","constructor"]),Ci=1e6,Pl=t=>t>="0"&&t<="9";function xi(t){if(t==="0")return!0;if(/^[1-9]\d*$/.
|
|
292
|
+
test(t)){const e=Number.parseInt(t,10);return e<=Number.MAX_SAFE_INTEGER&&e<=Ci}return!1}function Xr(t,e){return _i.has(t)?!1:(t&&xi(t)?e.push(Number.parseInt(t,10)):e.push(t),!0)}function jl(t){if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);const e=[];let r="",n="start",i=!1,a=0;for(const s of t){if(a++,i){r+=s,i=!1;continue}if(s==="\\"){if(n==="index")throw new Error(`Invalid character '${s}' in an index at position ${a}`);if(n==="indexEnd")throw new Error(`Inv\
|
|
293
|
+
alid character '${s}' after an index at position ${a}`);i=!0,n=n==="start"?"property":n;continue}switch(s){case".":{if(n==="index")throw new Error(`Invalid character '${s}' in an index at position ${a}`);if(n==="indexEnd"){n="property";break}if(!Xr(r,e))return[];r="",n="property";break}case"[":{if(n==="index")throw new Error(`Invalid character '${s}' in an index at position ${a}`);if(n==="indexEnd"){n="index";break}if(n==="property"||n==="start"){if((r||n==="property")&&!Xr(r,e))return[];r=""}n=
|
|
294
|
+
"index";break}case"]":{if(n==="index"){if(r==="")r=(e.pop()||"")+"[]",n="property";else{const o=Number.parseInt(r,10);!Number.isNaN(o)&&Number.isFinite(o)&&o>=0&&o<=Number.MAX_SAFE_INTEGER&&o<=Ci&&r===String(o)?e.push(o):e.push(r),r="",n="indexEnd"}break}if(n==="indexEnd")throw new Error(`Invalid character '${s}' after an index at position ${a}`);r+=s;break}default:{if(n==="index"&&!Pl(s))throw new Error(`Invalid character '${s}' in an index at position ${a}`);if(n==="indexEnd")throw new Error(`\
|
|
295
|
+
Invalid character '${s}' after an index at position ${a}`);n==="start"&&(n="property"),r+=s}}}switch(i&&(r+="\\"),n){case"property":{if(!Xr(r,e))return[];break}case"index":throw new Error("Index was not closed");case"start":{e.push("");break}}return e}function It(t){if(typeof t=="string")return jl(t);if(Array.isArray(t)){const e=[];for(const[r,n]of t.entries()){if(typeof n!="string"&&typeof n!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof n}`);
|
|
296
|
+
if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`Path segment at index ${r} must be a finite number, got ${n}`);if(_i.has(n))return[];typeof n=="string"&&xi(n)?e.push(Number.parseInt(n,10)):e.push(n)}return e}return[]}function Ti(t,e,r){if(!Ue(t)||typeof e!="string"&&!Array.isArray(e))return r===void 0?t:r;const n=It(e);if(n.length===0)return r;for(let i=0;i<n.length;i++){const a=n[i];if(t=t[a],t==null){if(i!==n.length-1)return r;break}}return t===void 0?r:t}function Ot(t,e,r){if(!Ue(
|
|
297
|
+
t)||typeof e!="string"&&!Array.isArray(e))return t;const n=t,i=It(e);if(i.length===0)return t;for(let a=0;a<i.length;a++){const s=i[a];if(a===i.length-1)t[s]=r;else if(!Ue(t[s])){const c=typeof i[a+1]=="number";t[s]=c?[]:{}}t=t[s]}return n}function Dl(t,e){if(!Ue(t)||typeof e!="string"&&!Array.isArray(e))return!1;const r=It(e);if(r.length===0)return!1;for(let n=0;n<r.length;n++){const i=r[n];if(n===r.length-1)return Object.hasOwn(t,i)?(delete t[i],!0):!1;if(t=t[i],!Ue(t))return!1}}function Kr(t,e){
|
|
298
|
+
if(!Ue(t)||typeof e!="string"&&!Array.isArray(e))return!1;const r=It(e);if(r.length===0)return!1;for(const n of r){if(!Ue(t)||!(n in t))return!1;t=t[n]}return!0}const ke=at.homedir(),Yr=at.tmpdir(),{env:Ye}=re,ql=t=>{const e=W.join(ke,"Library");return{data:W.join(e,"Application Support",t),config:W.join(e,"Preferences",t),cache:W.join(e,"Caches",t),log:W.join(e,"Logs",t),temp:W.join(Yr,t)}},Hl=t=>{const e=Ye.APPDATA||W.join(ke,"AppData","Roaming"),r=Ye.LOCALAPPDATA||W.join(ke,"AppData","Local");
|
|
299
|
+
return{data:W.join(r,t,"Data"),config:W.join(e,t,"Config"),cache:W.join(r,t,"Cache"),log:W.join(r,t,"Log"),temp:W.join(Yr,t)}},Ml=t=>{const e=W.basename(ke);return{data:W.join(Ye.XDG_DATA_HOME||W.join(ke,".local","share"),t),config:W.join(Ye.XDG_CONFIG_HOME||W.join(ke,".config"),t),cache:W.join(Ye.XDG_CACHE_HOME||W.join(ke,".cache"),t),log:W.join(Ye.XDG_STATE_HOME||W.join(ke,".local","state"),t),temp:W.join(Yr,e,t)}};function Ul(t,{suffix:e="nodejs"}={}){if(typeof t!="string")throw new TypeError(
|
|
300
|
+
`Expected a string, got ${typeof t}`);return e&&(t+=`-${e}`),re.platform==="darwin"?ql(t):re.platform==="win32"?Hl(t):Ml(t)}const Ne=(t,e)=>function(...n){return t.apply(void 0,n).catch(e)},xe=(t,e)=>function(...n){try{return t.apply(void 0,n)}catch(i){return e(i)}},Fl=re.getuid?!re.getuid():!1,Gl=1e4,we=()=>{},ee={isChangeErrorOk:t=>{if(!ee.isNodeError(t))return!1;const{code:e}=t;return e==="ENOSYS"||!Fl&&(e==="EINVAL"||e==="EPERM")},isNodeError:t=>t instanceof Error,isRetriableError:t=>{if(!ee.
|
|
301
|
+
isNodeError(t))return!1;const{code:e}=t;return e==="EMFILE"||e==="ENFILE"||e==="EAGAIN"||e==="EBUSY"||e==="EACCESS"||e==="EACCES"||e==="EACCS"||e==="EPERM"},onChangeError:t=>{if(!ee.isNodeError(t))throw t;if(!ee.isChangeErrorOk(t))throw t}};class Bl{constructor(){this.interval=25,this.intervalId=void 0,this.limit=Gl,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(
|
|
302
|
+
this.intervalId),delete this.intervalId)},this.add=e=>{this.queueWaiting.add(e),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=e=>{this.queueWaiting.delete(e),this.queueActive.delete(e)},this.schedule=()=>new Promise(e=>{const r=()=>this.remove(n),n=()=>e(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(const e of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(
|
|
303
|
+
e),this.queueActive.add(e),e()}}}}}const Vl=new Bl,Pe=(t,e)=>function(n){return function i(...a){return Vl.schedule().then(s=>{const o=u=>(s(),u),c=u=>{if(s(),Date.now()>=n)throw u;if(e(u)){const l=Math.round(100*Math.random());return new Promise(p=>setTimeout(p,l)).then(()=>i.apply(void 0,a))}throw u};return t.apply(void 0,a).then(o,c)})}},je=(t,e)=>function(n){return function i(...a){try{return t.apply(void 0,a)}catch(s){if(Date.now()>n)throw s;if(e(s))return i.apply(void 0,a);throw s}}},ce={attempt:{
|
|
304
|
+
chmod:Ne(ae(B.chmod),ee.onChangeError),chown:Ne(ae(B.chown),ee.onChangeError),close:Ne(ae(B.close),we),fsync:Ne(ae(B.fsync),we),mkdir:Ne(ae(B.mkdir),we),realpath:Ne(ae(B.realpath),we),stat:Ne(ae(B.stat),we),unlink:Ne(ae(B.unlink),we),chmodSync:xe(B.chmodSync,ee.onChangeError),chownSync:xe(B.chownSync,ee.onChangeError),closeSync:xe(B.closeSync,we),existsSync:xe(B.existsSync,we),fsyncSync:xe(B.fsync,we),mkdirSync:xe(B.mkdirSync,we),realpathSync:xe(B.realpathSync,we),statSync:xe(B.statSync,we),unlinkSync:xe(
|
|
305
|
+
B.unlinkSync,we)},retry:{close:Pe(ae(B.close),ee.isRetriableError),fsync:Pe(ae(B.fsync),ee.isRetriableError),open:Pe(ae(B.open),ee.isRetriableError),readFile:Pe(ae(B.readFile),ee.isRetriableError),rename:Pe(ae(B.rename),ee.isRetriableError),stat:Pe(ae(B.stat),ee.isRetriableError),write:Pe(ae(B.write),ee.isRetriableError),writeFile:Pe(ae(B.writeFile),ee.isRetriableError),closeSync:je(B.closeSync,ee.isRetriableError),fsyncSync:je(B.fsyncSync,ee.isRetriableError),openSync:je(B.openSync,ee.isRetriableError),
|
|
306
|
+
readFileSync:je(B.readFileSync,ee.isRetriableError),renameSync:je(B.renameSync,ee.isRetriableError),statSync:je(B.statSync,ee.isRetriableError),writeSync:je(B.writeSync,ee.isRetriableError),writeFileSync:je(B.writeFileSync,ee.isRetriableError)}},zl="utf8",Ii=438,Wl=511,Xl={},Kl=at.userInfo().uid,Yl=at.userInfo().gid,Jl=1e3,Ql=!!re.getuid;re.getuid&&re.getuid();const Oi=128,Zl=t=>t instanceof Error&&"code"in t,Li=t=>typeof t=="string",Jr=t=>t===void 0,ef=re.platform==="linux",ki=re.platform==="wi\
|
|
307
|
+
n32",Qr=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];ki||Qr.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),ef&&Qr.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED");class tf{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=e=>{if(!this.exited){this.exited=!0;for(const r of this.callbacks)r();e&&(ki&&e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"?re.kill(re.pid,"SIGTERM"):re.kill(re.pid,e))}},this.hook=()=>{re.once("exit",()=>this.exit());
|
|
308
|
+
for(const e of Qr)try{re.once(e,()=>this.exit(e))}catch{}},this.register=e=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}const rf=new tf,nf=rf.register,ue={store:{},create:t=>{const e=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),i=`.tmp-${Date.now().toString().slice(-10)}${e}`;return`${t}${i}`},get:(t,e,r=!0)=>{const n=ue.truncate(e(t));return n in ue.store?ue.get(t,e,r):(ue.store[n]=r,[n,()=>delete ue.store[n]])},purge:t=>{ue.store[t]&&(delete ue.store[t],
|
|
309
|
+
ce.attempt.unlink(t))},purgeSync:t=>{ue.store[t]&&(delete ue.store[t],ce.attempt.unlinkSync(t))},purgeSyncAll:()=>{for(const t in ue.store)ue.purgeSync(t)},truncate:t=>{const e=W.basename(t);if(e.length<=Oi)return t;const r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(e);if(!r)return t;const n=e.length-Oi;return`${t.slice(0,-e.length)}${r[1]}${r[2].slice(0,-n)}${r[3]}`}};nf(ue.purgeSyncAll);function Ni(t,e,r=Xl){if(Li(r))return Ni(t,e,{encoding:r});const n=Date.now()+((r.timeout??
|
|
310
|
+
Jl)||-1);let i=null,a=null,s=null;try{const o=ce.attempt.realpathSync(t),c=!!o;t=o||t,[a,i]=ue.get(t,r.tmpCreate||ue.create,r.tmpPurge!==!1);const u=Ql&&Jr(r.chown),l=Jr(r.mode);if(c&&(u||l)){const f=ce.attempt.statSync(t);f&&(r={...r},u&&(r.chown={uid:f.uid,gid:f.gid}),l&&(r.mode=f.mode))}if(!c){const f=W.dirname(t);ce.attempt.mkdirSync(f,{mode:Wl,recursive:!0})}s=ce.retry.openSync(n)(a,"w",r.mode||Ii),r.tmpCreated&&r.tmpCreated(a),Li(e)?ce.retry.writeSync(n)(s,e,0,r.encoding||zl):Jr(e)||ce.retry.
|
|
311
|
+
writeSync(n)(s,e,0,e.length,0),r.fsync!==!1&&(r.fsyncWait!==!1?ce.retry.fsyncSync(n)(s):ce.attempt.fsync(s)),ce.retry.closeSync(n)(s),s=null,r.chown&&(r.chown.uid!==Kl||r.chown.gid!==Yl)&&ce.attempt.chownSync(a,r.chown.uid,r.chown.gid),r.mode&&r.mode!==Ii&&ce.attempt.chmodSync(a,r.mode);try{ce.retry.renameSync(n)(a,t)}catch(f){if(!Zl(f)||f.code!=="ENAMETOOLONG")throw f;ce.retry.renameSync(n)(a,ue.truncate(t))}i(),a=null}finally{s&&ce.attempt.closeSync(s),a&&ue.purge(a)}}var Lt={exports:{}},kt={},
|
|
312
|
+
Nt={},Je={},Pi;function ji(){if(Pi)return Je;Pi=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.dynamicAnchor=void 0;const t=nt(),e=sr(),r=Nc(),n=hs(),i={keyword:"$dynamicAnchor",schemaType:"string",code:o=>a(o,o.schema)};function a(o,c){const{gen:u,it:l}=o;l.schemaEnv.root.dynamicAnchors[c]=!0;const f=(0,t._)`${e.default.dynamicAnchors}${(0,t.getProperty)(c)}`,p=l.errSchemaPath==="#"?l.validateName:s(o);u.if((0,t._)`!${f}`,()=>u.assign(f,p))}Je.dynamicAnchor=a;function s(o){const{schemaEnv:c,
|
|
313
|
+
schema:u,self:l}=o.it,{root:f,baseId:p,localRefs:h,meta:v}=c.root,{schemaId:w}=l.opts,m=new r.SchemaEnv({schema:u,schemaId:w,root:f,baseId:p,localRefs:h,meta:v});return r.compileSchema.call(l,m),(0,n.getValidate)(o,m)}return Je.default=i,Je}var Qe={},Di;function qi(){if(Di)return Qe;Di=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.dynamicRef=void 0;const t=nt(),e=sr(),r=hs(),n={keyword:"$dynamicRef",schemaType:"string",code:a=>i(a,a.schema)};function i(a,s){const{gen:o,keyword:c,it:u}=a;
|
|
314
|
+
if(s[0]!=="#")throw new Error(`"${c}" only supports hash fragment reference`);const l=s.slice(1);if(u.allErrors)f();else{const h=o.let("valid",!1);f(h),a.ok(h)}function f(h){if(u.schemaEnv.root.dynamicAnchors[l]){const v=o.let("_v",(0,t._)`${e.default.dynamicAnchors}${(0,t.getProperty)(l)}`);o.if(v,p(v,h),p(u.validateName,h))}else p(u.validateName,h)()}function p(h,v){return v?()=>o.block(()=>{(0,r.callRef)(a,h),o.let(v,!0)}):()=>(0,r.callRef)(a,h)}}return Qe.dynamicRef=i,Qe.default=n,Qe}var Pt={},
|
|
315
|
+
Hi;function sf(){if(Hi)return Pt;Hi=1,Object.defineProperty(Pt,"__esModule",{value:!0});const t=ji(),e=wt(),r={keyword:"$recursiveAnchor",schemaType:"boolean",code(n){n.schema?(0,t.dynamicAnchor)(n,""):(0,e.checkStrictMode)(n.it,"$recursiveAnchor: false is ignored")}};return Pt.default=r,Pt}var jt={},Mi;function of(){if(Mi)return jt;Mi=1,Object.defineProperty(jt,"__esModule",{value:!0});const t=qi(),e={keyword:"$recursiveRef",schemaType:"string",code:r=>(0,t.dynamicRef)(r,r.schema)};return jt.default=
|
|
316
|
+
e,jt}var Ui;function af(){if(Ui)return Nt;Ui=1,Object.defineProperty(Nt,"__esModule",{value:!0});const t=ji(),e=qi(),r=sf(),n=of(),i=[t.default,e.default,r.default,n.default];return Nt.default=i,Nt}var Dt={},qt={},Fi;function cf(){if(Fi)return qt;Fi=1,Object.defineProperty(qt,"__esModule",{value:!0});const t=ms(),e={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:r=>(0,t.validatePropertyDeps)(r)};return qt.default=e,qt}var Ht={},Gi;function uf(){if(Gi)return Ht;Gi=
|
|
317
|
+
1,Object.defineProperty(Ht,"__esModule",{value:!0});const t=ms(),e={keyword:"dependentSchemas",type:"object",schemaType:"object",code:r=>(0,t.validateSchemaDeps)(r)};return Ht.default=e,Ht}var Mt={},Bi;function lf(){if(Bi)return Mt;Bi=1,Object.defineProperty(Mt,"__esModule",{value:!0});const t=wt(),e={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:r,parentSchema:n,it:i}){n.contains===void 0&&(0,t.checkStrictMode)(i,`"${r}" without "contains" is ignored`)}};return Mt.
|
|
318
|
+
default=e,Mt}var Vi;function ff(){if(Vi)return Dt;Vi=1,Object.defineProperty(Dt,"__esModule",{value:!0});const t=cf(),e=uf(),r=lf(),n=[t.default,e.default,r.default];return Dt.default=n,Dt}var Ut={},Ft={},zi;function pf(){if(zi)return Ft;zi=1,Object.defineProperty(Ft,"__esModule",{value:!0});const t=nt(),e=wt(),r=sr(),i={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:a})=>(0,t._)`{unevaluatedProperty: ${a.
|
|
319
|
+
unevaluatedProperty}}`},code(a){const{gen:s,schema:o,data:c,errsCount:u,it:l}=a;if(!u)throw new Error("ajv implementation error");const{allErrors:f,props:p}=l;p instanceof t.Name?s.if((0,t._)`${p} !== true`,()=>s.forIn("key",c,m=>s.if(v(p,m),()=>h(m)))):p!==!0&&s.forIn("key",c,m=>p===void 0?h(m):s.if(w(p,m),()=>h(m))),l.props=!0,a.ok((0,t._)`${u} === ${r.default.errors}`);function h(m){if(o===!1){a.setParams({unevaluatedProperty:m}),a.error(),f||s.break();return}if(!(0,e.alwaysValidSchema)(l,o)){
|
|
320
|
+
const g=s.name("valid");a.subschema({keyword:"unevaluatedProperties",dataProp:m,dataPropType:e.Type.Str},g),f||s.if((0,t.not)(g),()=>s.break())}}function v(m,g){return(0,t._)`!${m} || !${m}[${g}]`}function w(m,g){const T=[];for(const d in m)m[d]===!0&&T.push((0,t._)`${g} !== ${d}`);return(0,t.and)(...T)}}};return Ft.default=i,Ft}var Gt={},Wi;function df(){if(Wi)return Gt;Wi=1,Object.defineProperty(Gt,"__esModule",{value:!0});const t=nt(),e=wt(),n={keyword:"unevaluatedItems",type:"array",schemaType:[
|
|
321
|
+
"boolean","object"],error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){const{gen:a,schema:s,data:o,it:c}=i,u=c.items||0;if(u===!0)return;const l=a.const("len",(0,t._)`${o}.length`);if(s===!1)i.setParams({len:u}),i.fail((0,t._)`${l} > ${u}`);else if(typeof s=="object"&&!(0,e.alwaysValidSchema)(c,s)){const p=a.var("valid",(0,t._)`${l} <= ${u}`);a.if((0,t.not)(p),()=>f(p,u)),i.ok(p)}c.items=!0;function f(p,h){a.
|
|
322
|
+
forRange("i",h,l,v=>{i.subschema({keyword:"unevaluatedItems",dataProp:v,dataPropType:e.Type.Num},p),c.allErrors||a.if((0,t.not)(p),()=>a.break())})}}};return Gt.default=n,Gt}var Xi;function hf(){if(Xi)return Ut;Xi=1,Object.defineProperty(Ut,"__esModule",{value:!0});const t=pf(),e=df(),r=[t.default,e.default];return Ut.default=r,Ut}var Ki;function mf(){if(Ki)return kt;Ki=1,Object.defineProperty(kt,"__esModule",{value:!0});const t=Pc(),e=jc(),r=Dc(),n=af(),i=ff(),a=hf(),s=qc(),o=Hc(),c=[n.default,
|
|
323
|
+
t.default,e.default,(0,r.default)(!0),s.default,o.metadataVocabulary,o.contentVocabulary,i.default,a.default];return kt.default=c,kt}var Bt={};const Yi="https://json-schema.org/draft/2020-12/schema",Ji="https://json-schema.org/draft/2020-12/schema",Qi={"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://jso\
|
|
324
|
+
n-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},Zi="meta",eo="Core and Validation specifications meta-schema",to=[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],ro=["object","boolean"],no="This meta-schema also defines keywords that have appeared in\
|
|
325
|
+
previous drafts in order to prevent incompatible extensions as they remain in common use.",so={definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs\
|
|
326
|
+
/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}},gf={$schema:Yi,$id:Ji,$vocabulary:Qi,$dynamicAnchor:Zi,title:eo,allOf:to,type:ro,$comment:no,properties:so},yf={__proto__:null,$comment:no,$dynamicAnchor:Zi,$id:Ji,$schema:Yi,$vocabulary:Qi,
|
|
327
|
+
allOf:to,default:gf,properties:so,title:eo,type:ro},wf=Ie(yf),io="https://json-schema.org/draft/2020-12/schema",oo="https://json-schema.org/draft/2020-12/meta/applicator",ao={"https://json-schema.org/draft/2020-12/vocab/applicator":!0},co="meta",uo="Applicator vocabulary meta-schema",lo=["object","boolean"],fo={prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{
|
|
328
|
+
$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},po={schemaArray:{
|
|
329
|
+
type:"array",minItems:1,items:{$dynamicRef:"#meta"}}},vf={$schema:io,$id:oo,$vocabulary:ao,$dynamicAnchor:co,title:uo,type:lo,properties:fo,$defs:po},$f={__proto__:null,$defs:po,$dynamicAnchor:co,$id:oo,$schema:io,$vocabulary:ao,default:vf,properties:fo,title:uo,type:lo},bf=Ie($f),ho="https://json-schema.org/draft/2020-12/schema",mo="https://json-schema.org/draft/2020-12/meta/unevaluated",go={"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},yo="meta",wo="Unevaluated applicator vocab\
|
|
330
|
+
ulary meta-schema",vo=["object","boolean"],$o={unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}},Ef={$schema:ho,$id:mo,$vocabulary:go,$dynamicAnchor:yo,title:wo,type:vo,properties:$o},Rf={__proto__:null,$dynamicAnchor:yo,$id:mo,$schema:ho,$vocabulary:go,default:Ef,properties:$o,title:wo,type:vo},Sf=Ie(Rf),bo="https://json-schema.org/draft/2020-12/schema",Eo="https://json-schema.org/draft/2020-12/meta/content",Ro={"https://json-schema.org/draft/2020-12/vocab/cont\
|
|
331
|
+
ent":!0},So="meta",Ao="Content vocabulary meta-schema",_o=["object","boolean"],Co={contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}},Af={$schema:bo,$id:Eo,$vocabulary:Ro,$dynamicAnchor:So,title:Ao,type:_o,properties:Co},_f={__proto__:null,$dynamicAnchor:So,$id:Eo,$schema:bo,$vocabulary:Ro,default:Af,properties:Co,title:Ao,type:_o},Cf=Ie(_f),xo="https://json-schema.org/draft/2020-12/schema",To="https://json-schema.org/draft/2020-12/meta/core",Io={
|
|
332
|
+
"https://json-schema.org/draft/2020-12/vocab/core":!0},Oo="meta",Lo="Core vocabulary meta-schema",ko=["object","boolean"],No={$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriStri\
|
|
333
|
+
ng"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},Po={anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}},xf={$schema:xo,$id:To,$vocabulary:Io,$dynamicAnchor:Oo,title:Lo,type:ko,properties:No,$defs:Po},Tf={__proto__:null,$defs:Po,$dynamicAnchor:Oo,$id:To,$schema:xo,$vocabulary:Io,default:xf,properties:No,
|
|
334
|
+
title:Lo,type:ko},If=Ie(Tf),jo="https://json-schema.org/draft/2020-12/schema",Do="https://json-schema.org/draft/2020-12/meta/format-annotation",qo={"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},Ho="meta",Mo="Format vocabulary meta-schema for annotation results",Uo=["object","boolean"],Fo={format:{type:"string"}},Of={$schema:jo,$id:Do,$vocabulary:qo,$dynamicAnchor:Ho,title:Mo,type:Uo,properties:Fo},Lf={__proto__:null,$dynamicAnchor:Ho,$id:Do,$schema:jo,$vocabulary:qo,default:Of,
|
|
335
|
+
properties:Fo,title:Mo,type:Uo},kf=Ie(Lf),Go="https://json-schema.org/draft/2020-12/schema",Bo="https://json-schema.org/draft/2020-12/meta/meta-data",Vo={"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},zo="meta",Wo="Meta-data vocabulary meta-schema",Xo=["object","boolean"],Ko={title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}},Nf={
|
|
336
|
+
$schema:Go,$id:Bo,$vocabulary:Vo,$dynamicAnchor:zo,title:Wo,type:Xo,properties:Ko},Pf={__proto__:null,$dynamicAnchor:zo,$id:Bo,$schema:Go,$vocabulary:Vo,default:Nf,properties:Ko,title:Wo,type:Xo},jf=Ie(Pf),Yo="https://json-schema.org/draft/2020-12/schema",Jo="https://json-schema.org/draft/2020-12/meta/validation",Qo={"https://json-schema.org/draft/2020-12/vocab/validation":!0},Zo="meta",ea="Validation vocabulary meta-schema",ta=["object","boolean"],ra={type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{
|
|
335
337
|
type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntege\
|
|
336
|
-
rDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},
|
|
337
|
-
default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},
|
|
338
|
-
e=
|
|
339
|
-
org/draft/2020-12/schema";class
|
|
340
|
-
s)?s:void 0)}}e.Ajv2020=
|
|
341
|
-
enumerable:!0,get:function(){return
|
|
342
|
-
totype"||r==="arguments"||r==="caller")return;const
|
|
343
|
-
${e}`,
|
|
344
|
-
e,
|
|
345
|
-
void 0),
|
|
346
|
-
MAX_SAFE_BUILD_LENGTH:
|
|
347
|
-
MAX_LENGTH:
|
|
338
|
+
rDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},na={nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",
|
|
339
|
+
default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},Df={$schema:Yo,$id:Jo,$vocabulary:Qo,$dynamicAnchor:Zo,title:ea,type:ta,properties:ra,$defs:na},qf={__proto__:null,$defs:na,$dynamicAnchor:Zo,$id:Jo,$schema:Yo,$vocabulary:Qo,default:Df,properties:ra,title:ea,type:ta},Hf=Ie(qf);var sa;function Mf(){if(sa)return Bt;sa=1,Object.defineProperty(Bt,"__esModule",{value:!0});const t=wf,
|
|
340
|
+
e=bf,r=Sf,n=Cf,i=If,a=kf,s=jf,o=Hf,c=["/properties"];function u(l){return[t,e,r,n,i,f(this,a),s,f(this,o)].forEach(p=>this.addMetaSchema(p,void 0,!1)),this;function f(p,h){return l?p.$dataMetaSchema(h,c):h}}return Bt.default=u,Bt}var ia;function Uf(){return ia||(ia=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;const r=Mc(),n=mf(),i=Uc(),a=Mf(),s="https://json-schema.\
|
|
341
|
+
org/draft/2020-12/schema";class o extends r.default{constructor(h={}){super({...h,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),n.default.forEach(h=>this.addVocabulary(h)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:h,meta:v}=this.opts;v&&(a.default.call(this,h),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(
|
|
342
|
+
s)?s:void 0)}}e.Ajv2020=o,t.exports=e=o,t.exports.Ajv2020=o,Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var c=Fc();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=nt();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{
|
|
343
|
+
enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var l=Gc();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return l.default}});var f=Bc();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(Lt,Lt.exports)),Lt.exports}var Ff=Uf();const Gf=(t,e,r,n)=>{if(r==="length"||r==="pro\
|
|
344
|
+
totype"||r==="arguments"||r==="caller")return;const i=Object.getOwnPropertyDescriptor(t,r),a=Object.getOwnPropertyDescriptor(e,r);!Bf(i,a)&&n||Object.defineProperty(t,r,a)},Bf=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},Vf=(t,e)=>{const r=Object.getPrototypeOf(e);r!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,r)},zf=(t,e)=>`/* Wrapped ${t}*/
|
|
345
|
+
${e}`,Wf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Xf=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Kf=(t,e,r)=>{const n=r===""?"":`with ${r.trim()}() `,i=zf.bind(null,n,e.toString());Object.defineProperty(i,"name",Xf);const{writable:a,enumerable:s,configurable:o}=Wf;Object.defineProperty(t,"toString",{value:i,writable:a,enumerable:s,configurable:o})};function Yf(t,e,{ignoreNonConfigurable:r=!1}={}){const{name:n}=t;for(const i of Reflect.ownKeys(e))Gf(t,
|
|
346
|
+
e,i,r);return Vf(t,e),Kf(t,e,n),t}const oa=(t,e={})=>{if(typeof t!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``);const{wait:r=0,maxWait:n=Number.POSITIVE_INFINITY,before:i=!1,after:a=!0}=e;if(r<0||n<0)throw new RangeError("`wait` and `maxWait` must not be negative.");if(!i&&!a)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let s,o,c;const u=function(...l){const f=this,p=()=>{s=void 0,o&&(clearTimeout(o),o=
|
|
347
|
+
void 0),a&&(c=t.apply(f,l))},h=()=>{o=void 0,s&&(clearTimeout(s),s=void 0),a&&(c=t.apply(f,l))},v=i&&!s;return clearTimeout(s),s=setTimeout(p,r),n>0&&n!==Number.POSITIVE_INFINITY&&!o&&(o=setTimeout(h,n)),v&&(c=t.apply(f,l)),c};return Yf(u,t),u.cancel=()=>{s&&(clearTimeout(s),s=void 0),o&&(clearTimeout(o),o=void 0)},u};var Vt={exports:{}},Zr,aa;function zt(){if(aa)return Zr;aa=1;const t="2.0.0",e=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,i=e-6;return Zr={MAX_LENGTH:e,MAX_SAFE_COMPONENT_LENGTH:n,
|
|
348
|
+
MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Zr}var en,ca;function Wt(){return ca||(ca=1,en=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}),en}var ua;function pt(){return ua||(ua=1,(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,
|
|
349
|
+
MAX_LENGTH:i}=zt(),a=Wt();e=t.exports={};const s=e.re=[],o=e.safeRe=[],c=e.src=[],u=e.safeSrc=[],l=e.t={};let f=0;const p="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",i],[p,n]],v=m=>{for(const[g,T]of h)m=m.split(`${g}*`).join(`${g}{0,${T}}`).split(`${g}+`).join(`${g}{1,${T}}`);return m},w=(m,g,T)=>{const d=v(g),S=f++;a(m,S,g),l[m]=S,c[S]=g,u[S]=d,s[S]=new RegExp(g,T?"g":void 0),o[S]=new RegExp(d,T?"g":void 0)};w("NUMERICIDENTIFIER","0|[1-9]\\d*"),w("NUMERICIDENTIFIERLOOSE","\\d+"),w("NONNUMERICIDENTIFIER",
|
|
348
350
|
`\\d*[a-zA-Z-]${p}*`),w("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),w("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),w("PRERELEASEIDENTIFIER",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIER]})`),w("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIERLOOSE]})`),w("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.
|
|
349
351
|
PRERELEASEIDENTIFIER]})*))`),w("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),w("BUILDIDENTIFIER",`${p}+`),w("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),w("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),w("FULL",`^${c[l.FULLPLAIN]}$`),w("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),w("LOOSE",`^${c[l.LOOSEPLAIN]}$`),w("GTLT","((?:<|>)?=?)"),w("XRAN\
|
|
350
352
|
GEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),w("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),w("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),w("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),w("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}\
|
|
351
353
|
$`),w("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),w("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),w("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`),w("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?(?:${c[l.BUILD]})?(?:$|[^\\d])`),w("COERCERTL",c[l.COERCE],!0),w("COERCERTLFULL",c[l.COERCEFULL],!0),w("LONETILDE","(?:~>?)"),w("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",w("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}\
|
|
352
354
|
$`),w("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),w("LONECARET","(?:\\^)"),w("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",w("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),w("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),w("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),w("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),w("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=
|
|
353
|
-
"$1$2$3",w("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),w("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),w("STAR","(<|>)?=?\\s*\\*"),w("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),w("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(
|
|
354
|
-
|
|
355
|
-
!!l.includePrerelease)return
|
|
355
|
+
"$1$2$3",w("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),w("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),w("STAR","(<|>)?=?\\s*\\*"),w("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),w("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Vt,Vt.exports)),Vt.exports}var tn,la;function rn(){if(la)return tn;la=1;const t=Object.freeze({loose:!0}),e=Object.freeze({});return tn=n=>n?typeof n!="object"?t:n:e,tn}var nn,fa;function pa(){if(fa)return nn;
|
|
356
|
+
fa=1;const t=/^[0-9]+$/,e=(n,i)=>{if(typeof n=="number"&&typeof i=="number")return n===i?0:n<i?-1:1;const a=t.test(n),s=t.test(i);return a&&s&&(n=+n,i=+i),n===i?0:a&&!s?-1:s&&!a?1:n<i?-1:1};return nn={compareIdentifiers:e,rcompareIdentifiers:(n,i)=>e(i,n)},nn}var sn,da;function de(){if(da)return sn;da=1;const t=Wt(),{MAX_LENGTH:e,MAX_SAFE_INTEGER:r}=zt(),{safeRe:n,t:i}=pt(),a=rn(),{compareIdentifiers:s}=pa();class o{constructor(u,l){if(l=a(l),u instanceof o){if(u.loose===!!l.loose&&u.includePrerelease===
|
|
357
|
+
!!l.includePrerelease)return u;u=u.version}else if(typeof u!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof u}".`);if(u.length>e)throw new TypeError(`version is longer than ${e} characters`);t("SemVer",u,l),this.options=l,this.loose=!!l.loose,this.includePrerelease=!!l.includePrerelease;const f=u.trim().match(l.loose?n[i.LOOSE]:n[i.FULL]);if(!f)throw new TypeError(`Invalid Version: ${u}`);if(this.raw=u,this.major=+f[1],this.minor=+f[2],this.patch=+f[3],this.major>
|
|
356
358
|
r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");f[4]?this.prerelease=f[4].split(".").map(p=>{if(/^[0-9]+$/.test(p)){const h=+p;if(h>=0&&h<r)return h}return p}):this.prerelease=[],this.build=f[5]?f[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=
|
|
357
|
-
`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(
|
|
358
|
-
if(
|
|
359
|
-
build[l],p=
|
|
359
|
+
`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(u){if(t("SemVer.compare",this.version,this.options,u),!(u instanceof o)){if(typeof u=="string"&&u===this.version)return 0;u=new o(u,this.options)}return u.version===this.version?0:this.compareMain(u)||this.comparePre(u)}compareMain(u){return u instanceof o||(u=new o(u,this.options)),this.major<u.major?-1:this.major>u.major?1:this.minor<u.minor?-1:this.minor>u.minor?1:this.patch<u.patch?-1:this.patch>u.patch?1:0}comparePre(u){
|
|
360
|
+
if(u instanceof o||(u=new o(u,this.options)),this.prerelease.length&&!u.prerelease.length)return-1;if(!this.prerelease.length&&u.prerelease.length)return 1;if(!this.prerelease.length&&!u.prerelease.length)return 0;let l=0;do{const f=this.prerelease[l],p=u.prerelease[l];if(t("prerelease compare",l,f,p),f===void 0&&p===void 0)return 0;if(p===void 0)return 1;if(f===void 0)return-1;if(f===p)continue;return s(f,p)}while(++l)}compareBuild(u){u instanceof o||(u=new o(u,this.options));let l=0;do{const f=this.
|
|
361
|
+
build[l],p=u.build[l];if(t("build compare",l,f,p),f===void 0&&p===void 0)return 0;if(p===void 0)return 1;if(f===void 0)return-1;if(f===p)continue;return s(f,p)}while(++l)}inc(u,l,f){if(u.startsWith("pre")){if(!l&&f===!1)throw new Error("invalid increment argument: identifier is empty");if(l){const p=`-${l}`.match(this.options.loose?n[i.PRERELEASELOOSE]:n[i.PRERELEASE]);if(!p||p[1]!==l)throw new Error(`invalid identifier: ${l}`)}}switch(u){case"premajor":this.prerelease.length=0,this.patch=0,this.
|
|
360
362
|
minor=0,this.major++,this.inc("pre",l,f);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",l,f);break;case"prepatch":this.prerelease.length=0,this.inc("patch",l,f),this.inc("pre",l,f);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",l,f),this.inc("pre",l,f);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.
|
|
361
363
|
prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const p=Number(f)?1:0;if(this.prerelease.length===0)this.prerelease=[p];else{let h=this.prerelease.length;for(;--h>=0;)typeof this.prerelease[h]=="number"&&(this.prerelease[h]++,h=-2);if(h===-1){if(l===this.prerelease.
|
|
362
|
-
join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(p)}}if(l){let h=[l,p];f===!1&&(h=[l]),s(this.prerelease[0],l)===0?isNaN(this.prerelease[1])&&(this.prerelease=h):this.prerelease=h}break}default:throw new Error(`invalid increment argument: ${
|
|
363
|
-
t)return r;try{return new t(r,n)}catch(
|
|
364
|
-
r,
|
|
365
|
-
|
|
366
|
-
r,
|
|
367
|
-
|
|
368
|
-
r,n,
|
|
369
|
-
>=":return n(
|
|
370
|
-
|
|
371
|
-
delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const
|
|
372
|
-
void 0,this;if(this.options=
|
|
373
|
-
this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let C=0;C<this.set.length;C++){C>0&&(this.formatted+="||");const
|
|
374
|
-
c[
|
|
375
|
-
if(w(R))return[R];U.set(R.value,R)}U.size>1&&U.has("")&&U.delete("");const Q=[...U.values()];return n.set(
|
|
376
|
-
s=
|
|
377
|
-
trim().split(/\s+/).map(
|
|
378
|
-
c[
|
|
379
|
-
`>=${D}.${H}.${$}${
|
|
380
|
-
0)):
|
|
381
|
-
d(Q)?U=`<${+
|
|
382
|
-
|
|
383
|
-
p[1]!==void 0?p[1]:"",this.operator==="="&&(this.operator=""),p[2]?this.semver=new
|
|
384
|
-
test(this.value):l.operator===""?l.value===""?!0:new c(this.value,f).test(l.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||l.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||l.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&l.operator.startsWith(">")||this.operator.startsWith("<")&&l.operator.startsWith("<")||this.semver.version===l.semver.version&&this.operator.includes("=")&&l.operator.includes("=")||
|
|
385
|
-
operator.startsWith(">")&&l.operator.startsWith("<")||
|
|
386
|
-
var
|
|
387
|
-
1;const t=de(),e=Ee(),r=
|
|
388
|
-
return s&&
|
|
389
|
-
l,f,h))return!1;for(let d=0;d<f.set.length;++d){const S=f.set[d];let E=null,A=null;if(S.forEach(b=>{b.semver===r&&(b=new e(">=0.0.0")),E=E||b,A=A||b,v(b.semver,E.semver,h)?E=b:m(b.semver,A.semver,h)&&(A=b)}),E.operator===g||E.operator===T||(!A.operator||A.operator===g)&&w(l,A.semver))return!1;if(A.operator===T&&m(l,A.semver))return!1}return!0},
|
|
390
|
-
return
|
|
391
|
-
|
|
392
|
-
f[0].semver===r){if(p.length===1&&p[0].semver===r)return!0;h.includePrerelease?f=s:f=
|
|
364
|
+
join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(p)}}if(l){let h=[l,p];f===!1&&(h=[l]),s(this.prerelease[0],l)===0?isNaN(this.prerelease[1])&&(this.prerelease=h):this.prerelease=h}break}default:throw new Error(`invalid increment argument: ${u}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return sn=o,sn}var on,ha;function Ze(){if(ha)return on;ha=1;const t=de();return on=(r,n,i=!1)=>{if(r instanceof
|
|
365
|
+
t)return r;try{return new t(r,n)}catch(a){if(!i)return null;throw a}},on}var an,ma;function Jf(){if(ma)return an;ma=1;const t=Ze();return an=(r,n)=>{const i=t(r,n);return i?i.version:null},an}var cn,ga;function Qf(){if(ga)return cn;ga=1;const t=Ze();return cn=(r,n)=>{const i=t(r.trim().replace(/^[=v]+/,""),n);return i?i.version:null},cn}var un,ya;function Zf(){if(ya)return un;ya=1;const t=de();return un=(r,n,i,a,s)=>{typeof i=="string"&&(s=a,a=i,i=void 0);try{return new t(r instanceof t?r.version:
|
|
366
|
+
r,i).inc(n,a,s).version}catch{return null}},un}var ln,wa;function ep(){if(wa)return ln;wa=1;const t=Ze();return ln=(r,n)=>{const i=t(r,null,!0),a=t(n,null,!0),s=i.compare(a);if(s===0)return null;const o=s>0,c=o?i:a,u=o?a:i,l=!!c.prerelease.length;if(!!u.prerelease.length&&!l){if(!u.patch&&!u.minor)return"major";if(u.compareMain(c)===0)return u.minor&&!u.patch?"minor":"patch"}const p=l?"pre":"";return i.major!==a.major?p+"major":i.minor!==a.minor?p+"minor":i.patch!==a.patch?p+"patch":"prerelease"},
|
|
367
|
+
ln}var fn,va;function tp(){if(va)return fn;va=1;const t=de();return fn=(r,n)=>new t(r,n).major,fn}var pn,$a;function rp(){if($a)return pn;$a=1;const t=de();return pn=(r,n)=>new t(r,n).minor,pn}var dn,ba;function np(){if(ba)return dn;ba=1;const t=de();return dn=(r,n)=>new t(r,n).patch,dn}var hn,Ea;function sp(){if(Ea)return hn;Ea=1;const t=Ze();return hn=(r,n)=>{const i=t(r,n);return i&&i.prerelease.length?i.prerelease:null},hn}var mn,Ra;function be(){if(Ra)return mn;Ra=1;const t=de();return mn=(r,n,i)=>new t(
|
|
368
|
+
r,i).compare(new t(n,i)),mn}var gn,Sa;function ip(){if(Sa)return gn;Sa=1;const t=be();return gn=(r,n,i)=>t(n,r,i),gn}var yn,Aa;function op(){if(Aa)return yn;Aa=1;const t=be();return yn=(r,n)=>t(r,n,!0),yn}var wn,_a;function vn(){if(_a)return wn;_a=1;const t=de();return wn=(r,n,i)=>{const a=new t(r,i),s=new t(n,i);return a.compare(s)||a.compareBuild(s)},wn}var $n,Ca;function ap(){if(Ca)return $n;Ca=1;const t=vn();return $n=(r,n)=>r.sort((i,a)=>t(i,a,n)),$n}var bn,xa;function cp(){if(xa)return bn;
|
|
369
|
+
xa=1;const t=vn();return bn=(r,n)=>r.sort((i,a)=>t(a,i,n)),bn}var En,Ta;function Xt(){if(Ta)return En;Ta=1;const t=be();return En=(r,n,i)=>t(r,n,i)>0,En}var Rn,Ia;function Sn(){if(Ia)return Rn;Ia=1;const t=be();return Rn=(r,n,i)=>t(r,n,i)<0,Rn}var An,Oa;function La(){if(Oa)return An;Oa=1;const t=be();return An=(r,n,i)=>t(r,n,i)===0,An}var _n,ka;function Na(){if(ka)return _n;ka=1;const t=be();return _n=(r,n,i)=>t(r,n,i)!==0,_n}var Cn,Pa;function xn(){if(Pa)return Cn;Pa=1;const t=be();return Cn=(r,n,i)=>t(
|
|
370
|
+
r,n,i)>=0,Cn}var Tn,ja;function In(){if(ja)return Tn;ja=1;const t=be();return Tn=(r,n,i)=>t(r,n,i)<=0,Tn}var On,Da;function qa(){if(Da)return On;Da=1;const t=La(),e=Na(),r=Xt(),n=xn(),i=Sn(),a=In();return On=(o,c,u,l)=>{switch(c){case"===":return typeof o=="object"&&(o=o.version),typeof u=="object"&&(u=u.version),o===u;case"!==":return typeof o=="object"&&(o=o.version),typeof u=="object"&&(u=u.version),o!==u;case"":case"=":case"==":return t(o,u,l);case"!=":return e(o,u,l);case">":return r(o,u,l);case"\
|
|
371
|
+
>=":return n(o,u,l);case"<":return i(o,u,l);case"<=":return a(o,u,l);default:throw new TypeError(`Invalid operator: ${c}`)}},On}var Ln,Ha;function up(){if(Ha)return Ln;Ha=1;const t=de(),e=Ze(),{safeRe:r,t:n}=pt();return Ln=(a,s)=>{if(a instanceof t)return a;if(typeof a=="number"&&(a=String(a)),typeof a!="string")return null;s=s||{};let o=null;if(!s.rtl)o=a.match(s.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const h=s.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let v;for(;(v=h.exec(
|
|
372
|
+
a))&&(!o||o.index+o[0].length!==a.length);)(!o||v.index+v[0].length!==o.index+o[0].length)&&(o=v),h.lastIndex=v.index+v[1].length+v[2].length;h.lastIndex=-1}if(o===null)return null;const c=o[2],u=o[3]||"0",l=o[4]||"0",f=s.includePrerelease&&o[5]?`-${o[5]}`:"",p=s.includePrerelease&&o[6]?`+${o[6]}`:"";return e(`${c}.${u}.${l}${f}${p}`,s)},Ln}var kn,Ma;function lp(){if(Ma)return kn;Ma=1;class t{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.
|
|
373
|
+
delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const a=this.map.keys().next().value;this.delete(a)}this.map.set(r,n)}return this}}return kn=t,kn}var Nn,Ua;function Ee(){if(Ua)return Nn;Ua=1;const t=/\s+/g;class e{constructor(C,k){if(k=i(k),C instanceof e)return C.loose===!!k.loose&&C.includePrerelease===!!k.includePrerelease?C:new e(C.raw,k);if(C instanceof a)return this.raw=C.value,this.set=[[C]],this.formatted=
|
|
374
|
+
void 0,this;if(this.options=k,this.loose=!!k.loose,this.includePrerelease=!!k.includePrerelease,this.raw=C.trim().replace(t," "),this.set=this.raw.split("||").map(O=>this.parseRange(O.trim())).filter(O=>O.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const O=this.set[0];if(this.set=this.set.filter(P=>!w(P[0])),this.set.length===0)this.set=[O];else if(this.set.length>1){for(const P of this.set)if(P.length===1&&m(P[0])){this.set=[P];break}}}
|
|
375
|
+
this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let C=0;C<this.set.length;C++){C>0&&(this.formatted+="||");const k=this.set[C];for(let O=0;O<k.length;O++)O>0&&(this.formatted+=" "),this.formatted+=k[O].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(C){const O=((this.options.includePrerelease&&h)|(this.options.loose&&v))+":"+C,P=n.get(O);if(P)return P;const D=this.options.loose,H=D?c[u.HYPHENRANGELOOSE]:
|
|
376
|
+
c[u.HYPHENRANGE];C=C.replace(H,F(this.options.includePrerelease)),s("hyphen replace",C),C=C.replace(c[u.COMPARATORTRIM],l),s("comparator trim",C),C=C.replace(c[u.TILDETRIM],f),s("tilde trim",C),C=C.replace(c[u.CARETTRIM],p),s("caret trim",C);let $=C.split(" ").map(R=>T(R,this.options)).join(" ").split(/\s+/).map(R=>V(R,this.options));D&&($=$.filter(R=>(s("loose invalid filter",R,this.options),!!R.match(c[u.COMPARATORLOOSE])))),s("range list",$);const U=new Map,J=$.map(R=>new a(R,this.options));for(const R of J){
|
|
377
|
+
if(w(R))return[R];U.set(R.value,R)}U.size>1&&U.has("")&&U.delete("");const Q=[...U.values()];return n.set(O,Q),Q}intersects(C,k){if(!(C instanceof e))throw new TypeError("a Range is required");return this.set.some(O=>g(O,k)&&C.set.some(P=>g(P,k)&&O.every(D=>P.every(H=>D.intersects(H,k)))))}test(C){if(!C)return!1;if(typeof C=="string")try{C=new o(C,this.options)}catch{return!1}for(let k=0;k<this.set.length;k++)if(L(this.set[k],C,this.options))return!0;return!1}}Nn=e;const r=lp(),n=new r,i=rn(),a=Kt(),
|
|
378
|
+
s=Wt(),o=de(),{safeRe:c,t:u,comparatorTrimReplace:l,tildeTrimReplace:f,caretTrimReplace:p}=pt(),{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:v}=zt(),w=I=>I.value==="<0.0.0-0",m=I=>I.value==="",g=(I,C)=>{let k=!0;const O=I.slice();let P=O.pop();for(;k&&O.length;)k=O.every(D=>P.intersects(D,C)),P=O.pop();return k},T=(I,C)=>(I=I.replace(c[u.BUILD],""),s("comp",I,C),I=A(I,C),s("caret",I),I=S(I,C),s("tildes",I),I=x(I,C),s("xrange",I),I=M(I,C),s("stars",I),I),d=I=>!I||I.toLowerCase()==="x"||I==="*",S=(I,C)=>I.
|
|
379
|
+
trim().split(/\s+/).map(k=>E(k,C)).join(" "),E=(I,C)=>{const k=C.loose?c[u.TILDELOOSE]:c[u.TILDE];return I.replace(k,(O,P,D,H,$)=>{s("tilde",I,O,P,D,H,$);let U;return d(P)?U="":d(D)?U=`>=${P}.0.0 <${+P+1}.0.0-0`:d(H)?U=`>=${P}.${D}.0 <${P}.${+D+1}.0-0`:$?(s("replaceTilde pr",$),U=`>=${P}.${D}.${H}-${$} <${P}.${+D+1}.0-0`):U=`>=${P}.${D}.${H} <${P}.${+D+1}.0-0`,s("tilde return",U),U})},A=(I,C)=>I.trim().split(/\s+/).map(k=>b(k,C)).join(" "),b=(I,C)=>{s("caret",I,C);const k=C.loose?c[u.CARETLOOSE]:
|
|
380
|
+
c[u.CARET],O=C.includePrerelease?"-0":"";return I.replace(k,(P,D,H,$,U)=>{s("caret",I,P,D,H,$,U);let J;return d(D)?J="":d(H)?J=`>=${D}.0.0${O} <${+D+1}.0.0-0`:d($)?D==="0"?J=`>=${D}.${H}.0${O} <${D}.${+H+1}.0-0`:J=`>=${D}.${H}.0${O} <${+D+1}.0.0-0`:U?(s("replaceCaret pr",U),D==="0"?H==="0"?J=`>=${D}.${H}.${$}-${U} <${D}.${H}.${+$+1}-0`:J=`>=${D}.${H}.${$}-${U} <${D}.${+H+1}.0-0`:J=`>=${D}.${H}.${$}-${U} <${+D+1}.0.0-0`):(s("no pr"),D==="0"?H==="0"?J=`>=${D}.${H}.${$}${O} <${D}.${H}.${+$+1}-0`:J=
|
|
381
|
+
`>=${D}.${H}.${$}${O} <${D}.${+H+1}.0-0`:J=`>=${D}.${H}.${$} <${+D+1}.0.0-0`),s("caret return",J),J})},x=(I,C)=>(s("replaceXRanges",I,C),I.split(/\s+/).map(k=>q(k,C)).join(" ")),q=(I,C)=>{I=I.trim();const k=C.loose?c[u.XRANGELOOSE]:c[u.XRANGE];return I.replace(k,(O,P,D,H,$,U)=>{s("xRange",I,O,P,D,H,$,U);const J=d(D),Q=J||d(H),R=Q||d($),_=R;return P==="="&&_&&(P=""),U=C.includePrerelease?"-0":"",J?P===">"||P==="<"?O="<0.0.0-0":O="*":P&&_?(Q&&(H=0),$=0,P===">"?(P=">=",Q?(D=+D+1,H=0,$=0):(H=+H+1,$=
|
|
382
|
+
0)):P==="<="&&(P="<",Q?D=+D+1:H=+H+1),P==="<"&&(U="-0"),O=`${P+D}.${H}.${$}${U}`):Q?O=`>=${D}.0.0${U} <${+D+1}.0.0-0`:R&&(O=`>=${D}.${H}.0${U} <${D}.${+H+1}.0-0`),s("xRange return",O),O})},M=(I,C)=>(s("replaceStars",I,C),I.trim().replace(c[u.STAR],"")),V=(I,C)=>(s("replaceGTE0",I,C),I.trim().replace(c[C.includePrerelease?u.GTE0PRE:u.GTE0],"")),F=I=>(C,k,O,P,D,H,$,U,J,Q,R,_)=>(d(O)?k="":d(P)?k=`>=${O}.0.0${I?"-0":""}`:d(D)?k=`>=${O}.${P}.0${I?"-0":""}`:H?k=`>=${k}`:k=`>=${k}${I?"-0":""}`,d(J)?U="":
|
|
383
|
+
d(Q)?U=`<${+J+1}.0.0-0`:d(R)?U=`<${J}.${+Q+1}.0-0`:_?U=`<=${J}.${Q}.${R}-${_}`:I?U=`<${J}.${Q}.${+R+1}-0`:U=`<=${U}`,`${k} ${U}`.trim()),L=(I,C,k)=>{for(let O=0;O<I.length;O++)if(!I[O].test(C))return!1;if(C.prerelease.length&&!k.includePrerelease){for(let O=0;O<I.length;O++)if(s(I[O].semver),I[O].semver!==a.ANY&&I[O].semver.prerelease.length>0){const P=I[O].semver;if(P.major===C.major&&P.minor===C.minor&&P.patch===C.patch)return!0}return!1}return!0};return Nn}var Pn,Fa;function Kt(){if(Fa)return Pn;
|
|
384
|
+
Fa=1;const t=Symbol("SemVer ANY");class e{static get ANY(){return t}constructor(l,f){if(f=r(f),l instanceof e){if(l.loose===!!f.loose)return l;l=l.value}l=l.trim().split(/\s+/).join(" "),s("comparator",l,f),this.options=f,this.loose=!!f.loose,this.parse(l),this.semver===t?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(l){const f=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],p=l.match(f);if(!p)throw new TypeError(`Invalid comparator: ${l}`);this.operator=
|
|
385
|
+
p[1]!==void 0?p[1]:"",this.operator==="="&&(this.operator=""),p[2]?this.semver=new o(p[2],this.options.loose):this.semver=t}toString(){return this.value}test(l){if(s("Comparator.test",l,this.options.loose),this.semver===t||l===t)return!0;if(typeof l=="string")try{l=new o(l,this.options)}catch{return!1}return a(l,this.operator,this.semver,this.options)}intersects(l,f){if(!(l instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(l.value,f).
|
|
386
|
+
test(this.value):l.operator===""?l.value===""?!0:new c(this.value,f).test(l.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||l.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||l.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&l.operator.startsWith(">")||this.operator.startsWith("<")&&l.operator.startsWith("<")||this.semver.version===l.semver.version&&this.operator.includes("=")&&l.operator.includes("=")||a(this.semver,"<",l.semver,f)&&this.
|
|
387
|
+
operator.startsWith(">")&&l.operator.startsWith("<")||a(this.semver,">",l.semver,f)&&this.operator.startsWith("<")&&l.operator.startsWith(">")))}}Pn=e;const r=rn(),{safeRe:n,t:i}=pt(),a=qa(),s=Wt(),o=de(),c=Ee();return Pn}var jn,Ga;function Yt(){if(Ga)return jn;Ga=1;const t=Ee();return jn=(r,n,i)=>{try{n=new t(n,i)}catch{return!1}return n.test(r)},jn}var Dn,Ba;function fp(){if(Ba)return Dn;Ba=1;const t=Ee();return Dn=(r,n)=>new t(r,n).set.map(i=>i.map(a=>a.value).join(" ").trim().split(" ")),Dn}
|
|
388
|
+
var qn,Va;function pp(){if(Va)return qn;Va=1;const t=de(),e=Ee();return qn=(n,i,a)=>{let s=null,o=null,c=null;try{c=new e(i,a)}catch{return null}return n.forEach(u=>{c.test(u)&&(!s||o.compare(u)===-1)&&(s=u,o=new t(s,a))}),s},qn}var Hn,za;function dp(){if(za)return Hn;za=1;const t=de(),e=Ee();return Hn=(n,i,a)=>{let s=null,o=null,c=null;try{c=new e(i,a)}catch{return null}return n.forEach(u=>{c.test(u)&&(!s||o.compare(u)===1)&&(s=u,o=new t(s,a))}),s},Hn}var Mn,Wa;function hp(){if(Wa)return Mn;Wa=
|
|
389
|
+
1;const t=de(),e=Ee(),r=Xt();return Mn=(i,a)=>{i=new e(i,a);let s=new t("0.0.0");if(i.test(s)||(s=new t("0.0.0-0"),i.test(s)))return s;s=null;for(let o=0;o<i.set.length;++o){const c=i.set[o];let u=null;c.forEach(l=>{const f=new t(l.semver.version);switch(l.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!u||r(f,u))&&(u=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${l.operator}`)}}),u&&(!s||r(s,u))&&(s=u)}
|
|
390
|
+
return s&&i.test(s)?s:null},Mn}var Un,Xa;function mp(){if(Xa)return Un;Xa=1;const t=Ee();return Un=(r,n)=>{try{return new t(r,n).range||"*"}catch{return null}},Un}var Fn,Ka;function Gn(){if(Ka)return Fn;Ka=1;const t=de(),e=Kt(),{ANY:r}=e,n=Ee(),i=Yt(),a=Xt(),s=Sn(),o=In(),c=xn();return Fn=(l,f,p,h)=>{l=new t(l,h),f=new n(f,h);let v,w,m,g,T;switch(p){case">":v=a,w=o,m=s,g=">",T=">=";break;case"<":v=s,w=c,m=a,g="<",T="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i(
|
|
391
|
+
l,f,h))return!1;for(let d=0;d<f.set.length;++d){const S=f.set[d];let E=null,A=null;if(S.forEach(b=>{b.semver===r&&(b=new e(">=0.0.0")),E=E||b,A=A||b,v(b.semver,E.semver,h)?E=b:m(b.semver,A.semver,h)&&(A=b)}),E.operator===g||E.operator===T||(!A.operator||A.operator===g)&&w(l,A.semver))return!1;if(A.operator===T&&m(l,A.semver))return!1}return!0},Fn}var Bn,Ya;function gp(){if(Ya)return Bn;Ya=1;const t=Gn();return Bn=(r,n,i)=>t(r,n,">",i),Bn}var Vn,Ja;function yp(){if(Ja)return Vn;Ja=1;const t=Gn();
|
|
392
|
+
return Vn=(r,n,i)=>t(r,n,"<",i),Vn}var zn,Qa;function wp(){if(Qa)return zn;Qa=1;const t=Ee();return zn=(r,n,i)=>(r=new t(r,i),n=new t(n,i),r.intersects(n,i)),zn}var Wn,Za;function vp(){if(Za)return Wn;Za=1;const t=Yt(),e=be();return Wn=(r,n,i)=>{const a=[];let s=null,o=null;const c=r.sort((p,h)=>e(p,h,i));for(const p of c)t(p,n,i)?(o=p,s||(s=p)):(o&&a.push([s,o]),o=null,s=null);s&&a.push([s,null]);const u=[];for(const[p,h]of a)p===h?u.push(p):!h&&p===c[0]?u.push("*"):h?p===c[0]?u.push(`<=${h}`):
|
|
393
|
+
u.push(`${p} - ${h}`):u.push(`>=${p}`);const l=u.join(" || "),f=typeof n.raw=="string"?n.raw:String(n);return l.length<f.length?l:n},Wn}var Xn,ec;function $p(){if(ec)return Xn;ec=1;const t=Ee(),e=Kt(),{ANY:r}=e,n=Yt(),i=be(),a=(f,p,h={})=>{if(f===p)return!0;f=new t(f,h),p=new t(p,h);let v=!1;e:for(const w of f.set){for(const m of p.set){const g=c(w,m,h);if(v=v||g!==null,g)continue e}if(v)return!1}return!0},s=[new e(">=0.0.0-0")],o=[new e(">=0.0.0")],c=(f,p,h)=>{if(f===p)return!0;if(f.length===1&&
|
|
394
|
+
f[0].semver===r){if(p.length===1&&p[0].semver===r)return!0;h.includePrerelease?f=s:f=o}if(p.length===1&&p[0].semver===r){if(h.includePrerelease)return!0;p=o}const v=new Set;let w,m;for(const x of f)x.operator===">"||x.operator===">="?w=u(w,x,h):x.operator==="<"||x.operator==="<="?m=l(m,x,h):v.add(x.semver);if(v.size>1)return null;let g;if(w&&m){if(g=i(w.semver,m.semver,h),g>0)return null;if(g===0&&(w.operator!==">="||m.operator!=="<="))return null}for(const x of v){if(w&&!n(x,String(w),h)||m&&!n(
|
|
393
395
|
x,String(m),h))return null;for(const q of p)if(!n(x,String(q),h))return!1;return!0}let T,d,S,E,A=m&&!h.includePrerelease&&m.semver.prerelease.length?m.semver:!1,b=w&&!h.includePrerelease&&w.semver.prerelease.length?w.semver:!1;A&&A.prerelease.length===1&&m.operator==="<"&&A.prerelease[0]===0&&(A=!1);for(const x of p){if(E=E||x.operator===">"||x.operator===">=",S=S||x.operator==="<"||x.operator==="<=",w){if(b&&x.semver.prerelease&&x.semver.prerelease.length&&x.semver.major===b.major&&x.semver.minor===
|
|
394
|
-
b.minor&&x.semver.patch===b.patch&&(b=!1),x.operator===">"||x.operator===">="){if(T=
|
|
395
|
-
S&&!m&&g!==0||m&&E&&!w&&g!==0||b||A)},
|
|
396
|
-
x=
|
|
397
|
-
src:t.src,tokens:t.t,SEMVER_SPEC_VERSION:e.SEMVER_SPEC_VERSION,RELEASE_TYPES:e.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},
|
|
398
|
-
`Expected \`Uint8Array\`, got \`${typeof t}\``)}function
|
|
399
|
-
"string")throw new TypeError(`Expected \`string\`, got \`${typeof t}\``)}const
|
|
400
|
-
|
|
401
|
-
"
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
if(
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
instancePath:
|
|
409
|
-
if(n?.code==="EXDEV"){
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
for(const
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
s
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
"
|
|
396
|
+
b.minor&&x.semver.patch===b.patch&&(b=!1),x.operator===">"||x.operator===">="){if(T=u(w,x,h),T===x&&T!==w)return!1}else if(w.operator===">="&&!n(w.semver,String(x),h))return!1}if(m){if(A&&x.semver.prerelease&&x.semver.prerelease.length&&x.semver.major===A.major&&x.semver.minor===A.minor&&x.semver.patch===A.patch&&(A=!1),x.operator==="<"||x.operator==="<="){if(d=l(m,x,h),d===x&&d!==m)return!1}else if(m.operator==="<="&&!n(m.semver,String(x),h))return!1}if(!x.operator&&(m||w)&&g!==0)return!1}return!(w&&
|
|
397
|
+
S&&!m&&g!==0||m&&E&&!w&&g!==0||b||A)},u=(f,p,h)=>{if(!f)return p;const v=i(f.semver,p.semver,h);return v>0?f:v<0||p.operator===">"&&f.operator===">="?p:f},l=(f,p,h)=>{if(!f)return p;const v=i(f.semver,p.semver,h);return v<0?f:v>0||p.operator==="<"&&f.operator==="<="?p:f};return Xn=a,Xn}var Kn,tc;function bp(){if(tc)return Kn;tc=1;const t=pt(),e=zt(),r=de(),n=pa(),i=Ze(),a=Jf(),s=Qf(),o=Zf(),c=ep(),u=tp(),l=rp(),f=np(),p=sp(),h=be(),v=ip(),w=op(),m=vn(),g=ap(),T=cp(),d=Xt(),S=Sn(),E=La(),A=Na(),b=xn(),
|
|
398
|
+
x=In(),q=qa(),M=up(),V=Kt(),F=Ee(),L=Yt(),I=fp(),C=pp(),k=dp(),O=hp(),P=mp(),D=Gn(),H=gp(),$=yp(),U=wp(),J=vp(),Q=$p();return Kn={parse:i,valid:a,clean:s,inc:o,diff:c,major:u,minor:l,patch:f,prerelease:p,compare:h,rcompare:v,compareLoose:w,compareBuild:m,sort:g,rsort:T,gt:d,lt:S,eq:E,neq:A,gte:b,lte:x,cmp:q,coerce:M,Comparator:V,Range:F,satisfies:L,toComparators:I,maxSatisfying:C,minSatisfying:k,minVersion:O,validRange:P,outside:D,gtr:H,ltr:$,intersects:U,simplifyRange:J,subset:Q,SemVer:r,re:t.re,
|
|
399
|
+
src:t.src,tokens:t.t,SEMVER_SPEC_VERSION:e.SEMVER_SPEC_VERSION,RELEASE_TYPES:e.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},Kn}var Yn=bp();const et=cs(Yn),Ep=Object.prototype.toString,Rp="[object Uint8Array]",Sp="[object ArrayBuffer]";function rc(t,e,r){return t?t.constructor===e?!0:Ep.call(t)===r:!1}function nc(t){return rc(t,Uint8Array,Rp)}function Ap(t){return rc(t,ArrayBuffer,Sp)}function _p(t){return nc(t)||Ap(t)}function Cp(t){if(!nc(t))throw new TypeError(
|
|
400
|
+
`Expected \`Uint8Array\`, got \`${typeof t}\``)}function xp(t){if(!_p(t))throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``)}function Jn(t,e){if(t.length===0)return new Uint8Array(0);e??=t.reduce((i,a)=>i+a.length,0);const r=new Uint8Array(e);let n=0;for(const i of t)Cp(i),r.set(i,n),n+=i.length;return r}const sc={utf8:new globalThis.TextDecoder("utf8")};function Jt(t,e="utf8"){return xp(t),sc[e]??=new globalThis.TextDecoder(e),sc[e].decode(t)}function Tp(t){if(typeof t!=
|
|
401
|
+
"string")throw new TypeError(`Expected \`string\`, got \`${typeof t}\``)}const Ip=new globalThis.TextEncoder;function Qt(t){return Tp(t),Ip.encode(t)}Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));const Qn="aes-256-cbc",De=()=>Object.create(null),ic=t=>t!==void 0,Zn=(t,e)=>{const r=new Set(["undefined","symbol","function"]),n=typeof e;if(r.has(n))throw new TypeError(`Setting a value of type \`${n}\` for key \`${t}\` is not allowed as it's not supported by JSON`)},qe="__internal__",
|
|
402
|
+
es=`${qe}.migrations.version`;class Op{path;events;#a;#n;#r;#t={};#e=!1;#o;#i;#s;constructor(e={}){const r=this.#u(e);this.#r=r,this.#h(r),this.#p(r),this.#m(r),this.events=new EventTarget,this.#n=r.encryptionKey,this.path=this.#c(r),this.#l(r),r.watch&&this._watch()}get(e,r){if(this.#r.accessPropertiesByDotNotation)return this._get(e,r);const{store:n}=this;return e in n?n[e]:r}set(e,r){if(typeof e!="string"&&typeof e!="object")throw new TypeError(`Expected \`key\` to be of type \`string\` or \`objec\
|
|
403
|
+
t\`, got ${typeof e}`);if(typeof e!="object"&&r===void 0)throw new TypeError("Use `delete()` to clear values");if(this._containsReservedKey(e))throw new TypeError(`Please don't use the ${qe} key, as it's used to manage this module internal operations.`);const{store:n}=this,i=(a,s)=>{if(Zn(a,s),this.#r.accessPropertiesByDotNotation)Ot(n,a,s);else{if(a==="__proto__"||a==="constructor"||a==="prototype")return;n[a]=s}};if(typeof e=="object"){const a=e;for(const[s,o]of Object.entries(a))i(s,o)}else i(
|
|
404
|
+
e,r);this.store=n}has(e){return this.#r.accessPropertiesByDotNotation?Kr(this.store,e):e in this.store}appendToArray(e,r){Zn(e,r);const n=this.#r.accessPropertiesByDotNotation?this._get(e,[]):e in this.store?this.store[e]:[];if(!Array.isArray(n))throw new TypeError(`The key \`${e}\` is already set to a non-array value`);this.set(e,[...n,r])}reset(...e){for(const r of e)ic(this.#t[r])&&this.set(r,this.#t[r])}delete(e){const{store:r}=this;this.#r.accessPropertiesByDotNotation?Dl(r,e):delete r[e],this.
|
|
405
|
+
store=r}clear(){const e=De();for(const r of Object.keys(this.#t))ic(this.#t[r])&&(Zn(r,this.#t[r]),this.#r.accessPropertiesByDotNotation?Ot(e,r,this.#t[r]):e[r]=this.#t[r]);this.store=e}onDidChange(e,r){if(typeof e!="string")throw new TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof e}`);if(typeof r!="function")throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof r}`);return this._handleValueChange(()=>this.get(e),r)}onDidAnyChange(e){if(typeof e!=
|
|
406
|
+
"function")throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof e}`);return this._handleStoreChange(e)}get size(){return Object.keys(this.store).filter(r=>!this._isReservedKeyPath(r)).length}get store(){try{const e=B.readFileSync(this.path,this.#n?null:"utf8"),r=this._decryptData(e),n=this._deserialize(r);return this.#e||this._validate(n),Object.assign(De(),n)}catch(e){if(e?.code==="ENOENT")return this._ensureDirectory(),De();if(this.#r.clearInvalidConfig){const r=e;
|
|
407
|
+
if(r.name==="SyntaxError"||r.message?.startsWith("Config schema violation:"))return De()}throw e}}set store(e){if(this._ensureDirectory(),!Kr(e,qe))try{const r=B.readFileSync(this.path,this.#n?null:"utf8"),n=this._decryptData(r),i=this._deserialize(n);Kr(i,qe)&&Ot(e,qe,Ti(i,qe))}catch{}this.#e||this._validate(e),this._write(e),this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(const[e,r]of Object.entries(this.store))this._isReservedKeyPath(e)||(yield[e,r])}_closeWatcher(){this.#o&&
|
|
408
|
+
(this.#o.close(),this.#o=void 0),this.#i&&(B.unwatchFile(this.path),this.#i=!1),this.#s=void 0}_decryptData(e){if(!this.#n)return typeof e=="string"?e:Jt(e);try{const r=e.slice(0,16),n=Me.pbkdf2Sync(this.#n,r,1e4,32,"sha512"),i=Me.createDecipheriv(Qn,n,r),a=e.slice(17),s=typeof a=="string"?Qt(a):a;return Jt(Jn([i.update(s),i.final()]))}catch{try{const r=e.slice(0,16),n=Me.pbkdf2Sync(this.#n,r.toString(),1e4,32,"sha512"),i=Me.createDecipheriv(Qn,n,r),a=e.slice(17),s=typeof a=="string"?Qt(a):a;return Jt(
|
|
409
|
+
Jn([i.update(s),i.final()]))}catch{}}return typeof e=="string"?e:Jt(e)}_handleStoreChange(e){let r=this.store;const n=()=>{const i=r,a=this.store;Is(a,i)||(r=a,e.call(this,a,i))};return this.events.addEventListener("change",n),()=>{this.events.removeEventListener("change",n)}}_handleValueChange(e,r){let n=e();const i=()=>{const a=n,s=e();Is(s,a)||(n=s,r.call(this,s,a))};return this.events.addEventListener("change",i),()=>{this.events.removeEventListener("change",i)}}_deserialize=e=>JSON.parse(e);_serialize=e=>JSON.
|
|
410
|
+
stringify(e,void 0," ");_validate(e){if(!this.#a||this.#a(e)||!this.#a.errors)return;const n=this.#a.errors.map(({instancePath:i,message:a=""})=>`\`${i.slice(1)}\` ${a}`);throw new Error("Config schema violation: "+n.join("; "))}_ensureDirectory(){B.mkdirSync(W.dirname(this.path),{recursive:!0})}_write(e){let r=this._serialize(e);if(this.#n){const n=Me.randomBytes(16),i=Me.pbkdf2Sync(this.#n,n,1e4,32,"sha512"),a=Me.createCipheriv(Qn,i,n);r=Jn([n,Qt(":"),a.update(Qt(r)),a.final()])}if(re.env.SNAP)
|
|
411
|
+
B.writeFileSync(this.path,r,{mode:this.#r.configFileMode});else try{Ni(this.path,r,{mode:this.#r.configFileMode})}catch(n){if(n?.code==="EXDEV"){B.writeFileSync(this.path,r,{mode:this.#r.configFileMode});return}throw n}}_watch(){if(this._ensureDirectory(),B.existsSync(this.path)||this._write(De()),re.platform==="win32"||re.platform==="darwin"){this.#s??=oa(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100});const e=W.dirname(this.path),r=W.basename(this.path);this.#o=B.watch(e,{persistent:!1,
|
|
412
|
+
encoding:"utf8"},(n,i)=>{i&&i!==r||typeof this.#s=="function"&&this.#s()})}else this.#s??=oa(()=>{this.events.dispatchEvent(new Event("change"))},{wait:1e3}),B.watchFile(this.path,{persistent:!1},(e,r)=>{typeof this.#s=="function"&&this.#s()}),this.#i=!0}_migrate(e,r,n){let i=this._get(es,"0.0.0");const a=Object.keys(e).filter(o=>this._shouldPerformMigration(o,i,r));let s=structuredClone(this.store);for(const o of a)try{n&&n(this,{fromVersion:i,toVersion:o,finalVersion:r,versions:a});const c=e[o];
|
|
413
|
+
c?.(this),this._set(es,o),i=o,s=structuredClone(this.store)}catch(c){this.store=s;try{this._write(s)}catch{}const u=c instanceof Error?c.message:String(c);throw new Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${u}`)}(this._isVersionInRangeFormat(i)||!et.eq(i,r))&&this._set(es,r)}_containsReservedKey(e){return typeof e=="string"?this._isReservedKeyPath(e):!e||typeof e!="object"?!1:this._objectContainsReservedKey(e)}_objectContainsReservedKey(e){
|
|
414
|
+
if(!e||typeof e!="object")return!1;for(const[r,n]of Object.entries(e))if(this._isReservedKeyPath(r)||this._objectContainsReservedKey(n))return!0;return!1}_isReservedKeyPath(e){return e===qe||e.startsWith(`${qe}.`)}_isVersionInRangeFormat(e){return et.clean(e)===null}_shouldPerformMigration(e,r,n){return this._isVersionInRangeFormat(e)?r!=="0.0.0"&&et.satisfies(r,e)?!1:et.satisfies(n,e):!(et.lte(e,r)||et.gt(e,n))}_get(e,r){return Ti(this.store,e,r)}_set(e,r){const{store:n}=this;Ot(n,e,r),this.store=
|
|
415
|
+
n}#u(e){const r={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...e};if(!r.cwd){if(!r.projectName)throw new Error("Please specify the `projectName` option.");r.cwd=Ul(r.projectName,{suffix:r.projectSuffix}).config}return typeof r.fileExtension=="string"&&(r.fileExtension=r.fileExtension.replace(/^\.+/,"")),r}#h(e){if(!(e.schema??e.ajvOptions??e.rootSchema))return;if(e.schema&&typeof e.schema!="object")throw new TypeError(
|
|
416
|
+
"The `schema` option must be an object.");const r=Vc.default,n=new Ff.Ajv2020({allErrors:!0,useDefaults:!0,...e.ajvOptions});r(n);const i={...e.rootSchema,type:"object",properties:e.schema};this.#a=n.compile(i),this.#f(e.schema)}#f(e){const r=Object.entries(e??{});for(const[n,i]of r){if(!i||typeof i!="object"||!Object.hasOwn(i,"default"))continue;const{default:a}=i;a!==void 0&&(this.#t[n]=a)}}#p(e){e.defaults&&Object.assign(this.#t,e.defaults)}#m(e){e.serialize&&(this._serialize=e.serialize),e.deserialize&&
|
|
417
|
+
(this._deserialize=e.deserialize)}#c(e){const r=typeof e.fileExtension=="string"?e.fileExtension:void 0,n=r?`.${r}`:"";return W.resolve(e.cwd,`${e.configName??"config"}${n}`)}#l(e){if(e.migrations){this.#d(e),this._validate(this.store);return}const r=this.store,n=Object.assign(De(),e.defaults??{},r);this._validate(n);try{Os.deepEqual(r,n)}catch{this.store=n}}#d(e){const{migrations:r,projectVersion:n}=e;if(r){if(!n)throw new Error("Please specify the `projectVersion` option.");this.#e=!0;try{const i=this.
|
|
418
|
+
store,a=Object.assign(De(),e.defaults??{},i);try{Os.deepEqual(i,a)}catch{this._write(a)}this._migrate(r,n,e.beforeEachMigration)}finally{this.#e=!1}}}}class ts extends Error{response;request;options;constructor(e,r,n){const i=e.status||e.status===0?e.status:"",a=e.statusText??"",s=`${i} ${a}`.trim(),o=s?`status code ${s}`:"an unknown error";super(`Request failed with ${o}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=e,this.request=r,this.options=n}}class oc extends Error{name="Non\
|
|
419
|
+
Error";value;constructor(e){let r="Non-error value was thrown";try{typeof e=="string"?r=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(r=e.message)}catch{}super(r),this.value=e}}class rs extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const r=e?.cause?e.cause instanceof Error?e.cause:new oc(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",r?{cause:r}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=
|
|
420
|
+
e?.request}}const ac=(()=>{let t=!1,e=!1;const r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return t&&!e})(),Lp=typeof globalThis.AbortController=="function",cc=typeof globalThis.AbortSignal=="fu\
|
|
421
|
+
nction"&&typeof globalThis.AbortSignal.any=="function",kp=typeof globalThis.ReadableStream=="function",Np=typeof globalThis.FormData=="function",uc=["get","post","put","patch","head","delete"],Pp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},ns=2147483647,jp=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,lc=Symbol("stop");class fc{options;constructor(e){this.options=e}}const Dp=t=>new fc(t),qp={json:!0,
|
|
422
|
+
parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},Hp={next:!0},Mp={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},Up=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(const[r,n]of t)e+=jp,e+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).
|
|
423
|
+
length,e+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return e}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength;if(typeof t=="string")return new TextEncoder().encode(t).length;if(t instanceof URLSearchParams)return new TextEncoder().encode(t.toString()).length;if("byteLength"in t)return t.byteLength;if(typeof t=="object"&&t!==null)try{const e=JSON.stringify(t);return new TextEncoder().encode(e).length}catch{return 0}return 0},pc=(t,e,r)=>{let n,
|
|
424
|
+
i=0;return t.pipeThrough(new TransformStream({transform(a,s){if(s.enqueue(a),n){i+=n.byteLength;let o=e===0?0:i/e;o>=1&&(o=1-Number.EPSILON),r?.({percent:o,totalBytes:Math.max(e,i),transferredBytes:i},n)}n=a},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(e,i),transferredBytes:i},n))}}))},Fp=(t,e)=>{if(!t.body)return t;if(t.status===204)return new Response(null,{status:t.status,statusText:t.statusText,headers:t.headers});const r=Math.max(0,Number(t.headers.get("content-length"))||
|
|
425
|
+
0);return new Response(pc(t.body,r,e),{status:t.status,statusText:t.statusText,headers:t.headers})},Gp=(t,e,r)=>{if(!t.body)return t;const n=Up(r??t.body);return new Request(t,{duplex:"half",body:pc(t.body,n,e)})},Fe=t=>t!==null&&typeof t=="object",Zt=(...t)=>{for(const e of t)if((!Fe(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return ss({},...t)},dc=(t={},e={})=>{const r=new globalThis.Headers(t),n=e instanceof globalThis.Headers,i=new globalThis.
|
|
426
|
+
Headers(e);for(const[a,s]of i.entries())n&&s==="undefined"||s===void 0?r.delete(a):r.set(a,s);return r};function er(t,e,r){return Object.hasOwn(e,r)&&e[r]===void 0?[]:ss(t[r]??[],e[r]??[])}const hc=(t={},e={})=>({beforeRequest:er(t,e,"beforeRequest"),beforeRetry:er(t,e,"beforeRetry"),afterResponse:er(t,e,"afterResponse"),beforeError:er(t,e,"beforeError")}),Bp=(t,e)=>{const r=new URLSearchParams;for(const n of[t,e])if(n!==void 0)if(n instanceof URLSearchParams)for(const[i,a]of n.entries())r.append(
|
|
427
|
+
i,a);else if(Array.isArray(n))for(const i of n){if(!Array.isArray(i)||i.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");r.append(String(i[0]),String(i[1]))}else if(Fe(n))for(const[i,a]of Object.entries(n))a!==void 0&&r.append(i,String(a));else{const i=new URLSearchParams(n);for(const[a,s]of i.entries())r.append(a,s)}return r},ss=(...t)=>{let e={},r={},n={},i;const a=[];for(const s of t)if(Array.isArray(s))Array.isArray(e)||(e=[]),e=[...e,...s];else if(Fe(
|
|
428
|
+
s)){for(let[o,c]of Object.entries(s)){if(o==="signal"&&c instanceof globalThis.AbortSignal){a.push(c);continue}if(o==="context"){if(c!=null&&(!Fe(c)||Array.isArray(c)))throw new TypeError("The `context` option must be an object");e={...e,context:c==null?{}:{...e.context,...c}};continue}if(o==="searchParams"){c==null?i=void 0:i=i===void 0?c:Bp(i,c);continue}Fe(c)&&o in e&&(c=ss(e[o],c)),e={...e,[o]:c}}Fe(s.hooks)&&(n=hc(n,s.hooks),e.hooks=n),Fe(s.headers)&&(r=dc(r,s.headers),e.headers=r)}return i!==
|
|
429
|
+
void 0&&(e.searchParams=i),a.length>0&&(a.length===1?e.signal=a[0]:cc?e.signal=AbortSignal.any(a):e.signal=a.at(-1)),e.context===void 0&&(e.context={}),e},Vp=t=>uc.includes(t)?t.toUpperCase():t,zp=["get","put","head","delete","options","trace"],Wp=[408,413,429,500,502,503,504],Xp=[413,429,503],mc={limit:2,methods:zp,statusCodes:Wp,afterStatusCodes:Xp,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3,jitter:void 0,retryOnTimeout:!1},Kp=(t={})=>{
|
|
430
|
+
if(typeof t=="number")return{...mc,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");const e=Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0));return{...mc,...e}};class is extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}async function Yp(t,e,r,n){return new Promise(
|
|
431
|
+
(i,a)=>{const s=setTimeout(()=>{r&&r.abort(),a(new is(t))},n.timeout);n.fetch(t,e).then(i).catch(a).then(()=>{clearTimeout(s)})})}async function Jp(t,{signal:e}){return new Promise((r,n)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(e.reason)}const a=setTimeout(()=>{e?.removeEventListener("abort",i),r()},t)})}const Qp=(t,e)=>{const r={};for(const n in e)Object.hasOwn(e,n)&&!(n in Mp)&&!(n in qp)&&(!(n in t)||n in Hp)&&(r[n]=e[n]);return r},Zp=t=>t===
|
|
432
|
+
void 0?!1:Array.isArray(t)?t.length>0:t instanceof URLSearchParams?t.size>0:typeof t=="object"?Object.keys(t).length>0:typeof t=="string"?t.trim().length>0:!!t;function ed(t){return t instanceof ts||t?.name===ts.name}function td(t){return t instanceof is||t?.name===is.name}class mt{static create(e,r){const n=new mt(e,r),i=async()=>{if(typeof n.#e.timeout=="number"&&n.#e.timeout>ns)throw new RangeError(`The \`timeout\` option cannot be greater than ${ns}`);await Promise.resolve();let s=await n.#m();
|
|
433
|
+
for(const o of n.#e.hooks.afterResponse){const c=n.#f(s.clone()),u=await o(n.request,n.#c(),c,{retryCount:n.#r});if(u instanceof globalThis.Response&&(s=u),u instanceof fc)throw await Promise.all([c.body?.cancel(),s.body?.cancel()]),new rs(u.options)}if(n.#f(s),!s.ok&&(typeof n.#e.throwHttpErrors=="function"?n.#e.throwHttpErrors(s.status):n.#e.throwHttpErrors)){let o=new ts(s,n.request,n.#c());for(const c of n.#e.hooks.beforeError)o=await c(o,{retryCount:n.#r});throw o}if(n.#e.onDownloadProgress){
|
|
434
|
+
if(typeof n.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!kp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return Fp(s.clone(),n.#e.onDownloadProgress)}return s},a=n.#p(i).finally(async()=>{const s=n.#o,o=[];s&&!s.bodyUsed&&o.push(s.body?.cancel()),n.request.bodyUsed||o.push(n.request.body?.cancel()),await Promise.all(o)});for(const[s,o]of Object.entries(Pp))s==="bytes"&&typeof globalThis.
|
|
435
|
+
Response?.prototype?.bytes!="function"||(a[s]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||o);const c=await a;if(s==="json"){if(c.status===204)return"";const u=await c.text();return u===""?"":r.parseJson?r.parseJson(u):JSON.parse(u)}return c[s]()});return a}static#a(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0)):e}request;#n;#r=0;#t;#e;#o;#i;#s;constructor(e,r={}){if(this.#t=
|
|
436
|
+
e,this.#e={...r,headers:dc(this.#t.headers,r.headers),hooks:hc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Vp(r.method??this.#t.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:Kp(r.retry),throwHttpErrors:r.throwHttpErrors??!0,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis),context:r.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a stri\
|
|
437
|
+
ng, URL, or Request");if(this.#e.prefixUrl&&typeof this.#t=="string"){if(this.#t.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#e.prefixUrl.endsWith("/")||(this.#e.prefixUrl+="/"),this.#t=this.#e.prefixUrl+this.#t}Lp&&cc&&(this.#i=this.#e.signal??this.#t.signal,this.#n=new globalThis.AbortController,this.#e.signal=this.#i?AbortSignal.any([this.#i,this.#n.signal]):this.#n.signal),ac&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=
|
|
438
|
+
this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));const n=r.headers&&new globalThis.Headers(r.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(Np&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!n&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),Zp(this.#e.searchParams)){const a="?"+
|
|
439
|
+
(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(mt.#a(this.#e.searchParams)).toString()),s=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,a);this.request=new globalThis.Request(s,this.#e)}if(this.#e.onUploadProgress){if(typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!ac)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is \
|
|
440
|
+
not available.");this.request=this.#d(this.request,this.#e.body??void 0)}}#u(){const e=this.#e.retry.delay(this.#r);let r=e;this.#e.retry.jitter===!0?r=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(r=this.#e.retry.jitter(e),(!Number.isFinite(r)||r<0)&&(r=e));const n=this.#e.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(n,r)}async#h(e){if(this.#r++,this.#r>this.#e.retry.limit)throw e;const r=e instanceof Error?e:new oc(e);if(r instanceof rs)return r.customDelay??this.#u();
|
|
441
|
+
if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){const n=await this.#e.retry.shouldRetry({error:r,retryCount:this.#r});if(n===!1)throw e;if(n===!0)return this.#u()}if(td(e)&&!this.#e.retry.retryOnTimeout)throw e;if(ed(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;const n=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.
|
|
442
|
+
headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(n&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());const a=this.#e.retry.maxRetryAfter??i;return i<a?i:a}if(e.response.status===413)throw e}return this.#u()}#f(e){return this.#e.parseJson&&(e.json=async()=>this.#e.parseJson(await e.text())),e}async#p(e){try{return await e()}catch(r){const n=Math.min(
|
|
443
|
+
await this.#h(r),ns);if(this.#r<1)throw r;if(await Jp(n,this.#i?{signal:this.#i}:{}),r instanceof rs&&r.customRequest){const i=this.#e.signal?new globalThis.Request(r.customRequest,{signal:this.#e.signal}):new globalThis.Request(r.customRequest);this.#l(i)}for(const i of this.#e.hooks.beforeRetry){const a=await i({request:this.request,options:this.#c(),error:r,retryCount:this.#r});if(a instanceof globalThis.Request){this.#l(a);break}if(a instanceof globalThis.Response)return a;if(a===lc)return}return this.#p(
|
|
444
|
+
e)}}async#m(){this.#n?.signal.aborted&&(this.#n=new globalThis.AbortController,this.#e.signal=this.#i?AbortSignal.any([this.#i,this.#n.signal]):this.#n.signal,this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));for(const r of this.#e.hooks.beforeRequest){const n=await r(this.request,this.#c(),{retryCount:this.#r});if(n instanceof Response)return n;if(n instanceof globalThis.Request){this.#l(n);break}}const e=Qp(this.request,this.#e);return this.#o=this.request,this.request=
|
|
445
|
+
this.#o.clone(),this.#e.timeout===!1?this.#e.fetch(this.#o,e):Yp(this.#o,e,this.#n,this.#e)}#c(){if(!this.#s){const{hooks:e,...r}=this.#e;this.#s=Object.freeze(r)}return this.#s}#l(e){this.#s=void 0,this.request=this.#d(e)}#d(e,r){return!this.#e.onUploadProgress||!e.body?e:Gp(e,this.#e.onUploadProgress,r??this.#e.body??void 0)}}const os=t=>{const e=(r,n)=>mt.create(r,Zt(t,n));for(const r of uc)e[r]=(n,i)=>mt.create(n,Zt(t,i,{method:r}));return e.create=r=>os(Zt(r)),e.extend=r=>(typeof r=="functi\
|
|
446
|
+
on"&&(r=r(t??{})),os(Zt(t,r))),e.stop=lc,e.retry=Dp,e},rd=os(),as=new Op({projectName:zc,serialize:t=>We.stringify(t,null,2),deserialize:t=>We.parse(t)}),nd=1e3*60*60*24,gc="check-update";function sd(){if(tu||ru===gc)return;const t=as.get("lastUpdateCheck"),e=as.get("latestVersion");if(Wc(e)||Xc(t)||t+nd<Date.now())try{ls("likec4",["check-update"],{stdio:"ignore",preferLocal:!0,detached:!0,env:{NODE_ENV:gc}}).catch(()=>{})}catch{}e&&Yn.gt(e,Ge)&&Te(["Update available: ",y.dim(Ge),y.reset(" \u2192 "),
|
|
447
|
+
y.green(e)].join(""))}async function id(){try{const t=await od();hr(t,"No version found in latest npm"),as.set({lastUpdateCheck:Date.now(),latestVersion:t}),Yn.gt(t,Ge)?Te(["Update available: ",y.dim(Ge),y.reset(" \u2192 "),y.green(t)].join("")):Te(y.dim("Up to date: ")+" "+y.green(Ge))}catch(t){ge.error(yt(t))}}async function od(){return(await rd("https://registry.npmjs.org/likec4/latest",{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"},keepalive:!0}).
|
|
448
|
+
json()).version}const ad=t=>t.command({command:"check-update",describe:"Check for updates",handler:async()=>{await id()}});function cd(t,e){if(!e)return t.languageServices.projectsManager.ensureProjectId();const r=z(e);if(r===t.workspace)return t.languageServices.projectsManager.ensureProjectId();if(_e(r)&&Yc(r).isDirectory()){ge.debug`Project path exists: ${r}`;const n=ir.file(r.endsWith(Rs)?r:r+Rs),i=t.languageServices.projects().find(a=>a.folder.fsPath===n.fsPath);if(i)return ge.debug`Found project ${i.
|
|
449
|
+
id} at path: ${r}`,i.id;ge.debug`No project registered at path: ${r}`}return t.languageServices.projectsManager.ensureProjectId(e)}function tr(t,e){const r=cd(t,e),n=t.languageServices.projectsManager.getProject(r);return t.languageServices.projectsManager.defaultProjectId=r,{projectId:r,projectFolder:n.folderUri.fsPath,config:n.config}}var yc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),wc=t=>{throw TypeError(t)},ud=(t,e,r)=>{if(e!=null){typeof e!="object"&&typeof e!="function"&&wc("Object ex\
|
|
450
|
+
pected");var n,i;n=e[yc("asyncDispose")],n===void 0&&(n=e[yc("dispose")],i=n),typeof n!="function"&&wc("Object not disposable"),i&&(n=function(){try{i.call(this)}catch(a){return Promise.reject(a)}}),t.push([r,n,e])}else t.push([r]);return e},ld=(t,e,r)=>{var n=typeof SuppressedError=="function"?SuppressedError:function(s,o,c,u){return u=Error(c),u.name="SuppressedError",u.error=s,u.suppressed=o,u},i=s=>e=r?new n(s,e,"An error was suppressed during disposal"):(r=!0,s),a=s=>{for(;s=t.pop();)try{var o=s[1]&&
|
|
451
|
+
s[1].call(s[2]);if(s[0])return Promise.resolve(o).then(a,c=>(i(c),a()))}catch(c){i(c)}if(r)throw e};return a()};const dt=ge.getChild("generator");async function vc({name:t,path:e,useDotBin:r,project:n}){var i=[];try{const c=Be(dt),u=ud(i,await ye.fromWorkspace(e,{logger:"vite",graphviz:r?"binary":"wasm",watch:!1}),!0),{projectId:l,config:f}=tr(u,n);n&&dt.info(`${y.dim("project")} ${y.green(l)}`);const p=f.generators?.[t];if(!p)throw dt.error(y.red(`generator ${t} does not exist in project config`)),
|
|
452
|
+
new Error(`generator ${t} does not exist in project config`);dt.info(`${y.dim("generator")} ${y.green(t)}`);const h=await u.layoutedModel(l);await fd({likec4:u,model:h,generator:p,logger:dt.getChild(t)}),c.stopAndLog()}catch(c){var a=c,s=!0}finally{var o=ld(i,a,s);o&&await o}}async function fd({likec4:t,model:e,generator:r,logger:n}){const i=t.languageServices,a=new Set,s=i.project(e.project.id),o=e.project.id;n.debug(`${y.dim("runnig for project:")} ${y.green(s.id)}`),await Promise.resolve().then(
|
|
453
|
+
()=>r({likec4model:e,ctx:{workspace:t.languageServices.workspaceUri,project:s,locate:c=>{let u=null;switch(!0){case bu(c):u=i.locate({element:c.id,projectId:o});break;case $u(c):u=i.locate({view:c.id,projectId:o});break;case vu(c):u=i.locate({deployment:c.id,projectId:o});break;case wu(c):case yu(c):u=i.locate({relation:c.id,projectId:o});break;default:mr(c)}if(!u)throw n.error(`Cannot locate ${c.id}`,{target:c}),new Error(`Cannot locate ${c.id}`);const l=ir.parse(u.uri);return{range:u.range,document:l,
|
|
454
|
+
relativePath:or.relative(s.folder,l),folder:or.dirname(l).fsPath,filename:or.basename(l)}},write:async({path:c,content:u})=>{let l;ir.isUri(c)?l=c.fsPath:l=z(s.folder.fsPath,...Array.isArray(c)?c:[c]);const f=Re(l);a.has(f)||(_e(f)||(n.debug(`${y.dim("create directory")} ${f}`),await Se(f,{recursive:!0})),a.add(f)),n.debug(`${y.dim("write")} ${l}`),await Oe(l,u)},abort:c=>{throw n.error(c||"Generator aborted"),new Error(c||"Generator aborted")}}}))}async function pd(t,e,r){e=e??z(t.workspace,"li\
|
|
455
|
+
kec4.generated.ts"),ot(e)!==".ts"&&(e=e+".ts"),await Se(Re(e),{recursive:!0});const n=await t.diagrams(),i=ol([...n]);await Oe(e,i),r.info(`${y.dim("generated")} ${Ce(process.cwd(),e)}`)}async function dd(t,e,r){await Se(e,{recursive:!0}),r.info(`${y.dim("format")} ${y.green("dot")}`),r.info(`${y.dim("outdir")} ${e}`);const n=new Set,i=t.computedModel(),a=$s(i.$data.views);let s=0;for(const o of a)try{const c=await t.viewsService.layouter.dot({view:o,styles:i.$styles});let u=".";o.sourcePath&&(u=
|
|
456
|
+
Re(o.sourcePath)),u=z(e,u),n.has(u)||(await Se(u,{recursive:!0}),n.add(u));const l=z(u,o.id+".dot");await Oe(l,c),r.info(`${y.dim("generated")} ${Ce(process.cwd(),l)}`),s++}catch(c){ge.error(`error while generating ${o.id}`,{error:c})}s>0&&r.info(`${y.dim("total")} ${s} files`)}async function hd(t,e,r,n){await Se(r,{recursive:!0}),n.info(`${y.dim("format")} ${y.green(e)}`),n.info(`${y.dim("outdir")} ${r}`);let i,a;switch(e){case"d2":i=".d2",a=fu;break;case"mermaid":i=".mmd",a=lu;break;case"plant\
|
|
457
|
+
uml":i=".puml",a=uu;break;default:mr(e)}const s=new Set,o=await t.layoutedModel();let c=0;for(const u of o.views()){const l=u.$view;try{let f=".";l.sourcePath&&(f=Re(l.sourcePath)),f=z(r,f),s.has(f)||(await Se(f,{recursive:!0}),s.add(f));const p=z(f,l.id+i),h=a(u);await Oe(p,h),n.info(`${y.dim("generated")} ${Ce(process.cwd(),p)}`),c++}catch(f){n.error(`error while generating ${l.id}`,{error:f})}}c>0&&n.info(`${y.dim("total")} ${c} files`)}async function ht({path:t,useDotBin:e,...r}){const n=ve(
|
|
458
|
+
"c4:codegen"),i=Be(n),a=await ye.fromWorkspace(t,{logger:"vite",graphviz:e?"binary":"wasm"});if(a.ensureSingleProject(),(await a.viewsService.computedViews()).length===0)throw n.warn("no views found"),process.exitCode=1,new Error("no views found");switch(r.format){case"views":{await pd(a,r.outfile,n);break}case"dot":{await dd(a,r.outdir??t,n);break}case"d2":case"mermaid":case"plantuml":{await hd(a,r.format,r.outdir??t,n);break}default:mr(r)}i.stopAndLog()}var $c=(t,e)=>(e=Symbol[t])?e:Symbol.for(
|
|
459
|
+
"Symbol."+t),bc=t=>{throw TypeError(t)},md=(t,e,r)=>{if(e!=null){typeof e!="object"&&typeof e!="function"&&bc("Object expected");var n,i;n=e[$c("asyncDispose")],n===void 0&&(n=e[$c("dispose")],i=n),typeof n!="function"&&bc("Object not disposable"),i&&(n=function(){try{i.call(this)}catch(a){return Promise.reject(a)}}),t.push([r,n,e])}else t.push([r]);return e},gd=(t,e,r)=>{var n=typeof SuppressedError=="function"?SuppressedError:function(s,o,c,u){return u=Error(c),u.name="SuppressedError",u.error=
|
|
460
|
+
s,u.suppressed=o,u},i=s=>e=r?new n(s,e,"An error was suppressed during disposal"):(r=!0,s),a=s=>{for(;s=t.pop();)try{var o=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(o).then(a,c=>(i(c),a()))}catch(c){i(c)}if(r)throw e};return a()};async function yd({path:t,useDotBin:e,useCorePackage:r,outfile:n,project:i}){var a=[];try{const u=ve("c4:codegen"),l=Be(u),f=md(a,await ye.fromWorkspace(t,{logger:"vite",graphviz:e?"binary":"wasm",watch:!1}),!0),{projectId:p,projectFolder:h}=tr(f,i);i&&u.info(
|
|
461
|
+
`${y.dim("project")} ${y.green(p)}`),u.info(`${y.dim("format")} ${y.green("model")}`);const v=await f.layoutedModel(p);for(const d of v.views())d.hasLayoutDrifts&&u.warn(y.yellow("layout drift detected, view:")+" "+y.red(d.id));let w=z(f.projectsManager.hasMultipleProjects()?h:f.workspace,"likec4-model.ts");if(n&&(w=ur(n)?n:z(n),_e(n)&&(await lr(n)).isDirectory()))throw new Error(`output file is a directory: ${n}`);const m=$t(w);u.info(`${y.dim("filename")} ${m}`);const g=ot(m).toLocaleLowerCase();
|
|
462
|
+
if(![".ts",".mts",".cts"].includes(g))throw u.error(`output file ${n} has extension "${g}"`),new Error(`output file ${n} must be a .ts, .mts or .cts file`);const T=Re(w);u.info(`${y.dim("outdir")} ${T}`),await Se(T,{recursive:!0}),await Oe(w,sl(v,{useCorePackage:r}),{encoding:"utf-8"}),l.stopAndLog(),Te(ar(`
|
|
456
463
|
${y.dim("Source generated:")}
|
|
457
|
-
${Ce(
|
|
464
|
+
${Ce(vt(),w)}
|
|
458
465
|
|
|
459
466
|
${y.dim("How to use:")}
|
|
460
467
|
${y.underline("https://likec4.dev/tooling/code-generation/model/")}
|
|
461
|
-
`).trim(),{padding:1,borderColor:"green",borderStyle:"round"})}catch(
|
|
462
|
-
`+
|
|
463
|
-
l","react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client",/likec4\/icons\/.*/,/@likec4\/core.*/],onwarn(
|
|
464
|
-
"function"&&
|
|
465
|
-
|
|
466
|
-
drifts&&A.drifts.length>0){
|
|
467
|
-
${g}`);const T=
|
|
468
|
+
`).trim(),{padding:1,borderColor:"green",borderStyle:"round"})}catch(u){var s=u,o=!0}finally{var c=gd(a,s,o);c&&await c}}async function wd({languageServices:t,outDir:e,filename:r="likec4-react.mjs"}){const n=ve(["vite","react"]),i=$r();return n.info(`${y.cyan("likec4 app root")} ${y.dim(i)}`),n.info(y.cyan("outDir")+" "+y.dim(e)),{customLogger:n,root:i,configFile:!1,clearScreen:!1,publicDir:!1,mode:"production",resolve:{conditions:["production"],alias:Rr()},esbuild:{banner:`'use client'
|
|
469
|
+
`+vr.banner,footer:vr.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,copyPublicDir:!1,chunkSizeWarningLimit:Er,lib:{entry:"react/likec4.tsx",fileName(a,s){return r},formats:["es"]},rollupOptions:{output:{compact:!1,exports:"named"},external:["likec4/react","likec4/mode\
|
|
470
|
+
l","react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client",/likec4\/icons\/.*/,/@likec4\/core.*/],onwarn(a,s){a.code!=="SOURCEMAP_ERROR"&&s(a)}}},plugins:[fr({}),dr({languageServices:t.languageServices,useOverviewGraph:!1})]}}var Ec=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Rc=t=>{throw TypeError(t)},vd=(t,e,r)=>{if(e!=null){typeof e!="object"&&typeof e!="function"&&Rc("Object expected");var n,i;n=e[Ec("asyncDispose")],n===void 0&&(n=e[Ec("dispose")],i=n),typeof n!=
|
|
471
|
+
"function"&&Rc("Object not disposable"),i&&(n=function(){try{i.call(this)}catch(a){return Promise.reject(a)}}),t.push([r,n,e])}else t.push([r]);return e},$d=(t,e,r)=>{var n=typeof SuppressedError=="function"?SuppressedError:function(s,o,c,u){return u=Error(c),u.name="SuppressedError",u.error=s,u.suppressed=o,u},i=s=>e=r?new n(s,e,"An error was suppressed during disposal"):(r=!0,s),a=s=>{for(;s=t.pop();)try{var o=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(o).then(a,c=>(i(c),a()))}catch(c){
|
|
472
|
+
i(c)}if(r)throw e};return a()};async function bd({path:t,useDotBin:e,useCorePackage:r,outfile:n,project:i}){var a=[];try{await lt();const u=ve("c4:codegen"),l=Be(u),f=vd(a,await ye.fromWorkspace(t,{logger:"vite",graphviz:e?"binary":"wasm",watch:!1}),!0),{projectId:p,projectFolder:h}=tr(f,i);i&&u.info(`${y.dim("project")} ${y.green(p)}`),u.info(`${y.dim("format")} ${y.green("react")}`);const v=await f.diagrams(p);if(v.length===0)throw process.exitCode=1,new Error("no views found");v.forEach(A=>{if(A.
|
|
473
|
+
drifts&&A.drifts.length>0){u.info(y.yellow("layout drift detected, view:")+" "+y.red(A.id));return}if(A.hasLayoutDrift){u.warn(y.yellow("drift detected, manual layout can not be applied, view:")+" "+y.red(A.id));return}});let w=z(f.projectsManager.hasMultipleProjects()?h:f.workspace,"likec4-views.js");if(n&&(w=ur(n)?n:z(n),_e(n)&&(await lr(n)).isDirectory()))throw new Error(`output file is a directory: ${n}`);const m=Re(w);u.info(`${y.dim("outdir")} ${m}`);const g=$t(w);u.info(`${y.dim("filename")}\
|
|
474
|
+
${g}`);const T=ot(g).toLocaleLowerCase();if(![".js",".mjs",".jsx"].includes(T))throw u.error(`output file ${n} has extension "${T}"`),new Error(`output file ${n} must be a .js, .jsx or .mjs`);const d=await wd({languageServices:f,outDir:m,filename:g});await ct({...d,logLevel:"warn"});const S=await f.layoutedModel(p),E=z(m,$t(w,T)+(T===".mjs"?".d.mts":".d.ts"));await Oe(E,al(S,{useCorePackage:r})),l.stopAndLog(),Te(ar(`
|
|
468
475
|
${y.dim("Sources generated:")}
|
|
469
|
-
${Ce(
|
|
470
|
-
${Ce(
|
|
476
|
+
${Ce(vt(),w)}
|
|
477
|
+
${Ce(vt(),E)}
|
|
471
478
|
|
|
472
479
|
${y.dim("How to use:")}
|
|
473
480
|
${y.underline("https://likec4.dev/tooling/code-generation/react/")}
|
|
474
|
-
`),{padding:1,borderColor:"green",borderStyle:"round"})}catch(
|
|
475
|
-
[r]);return e},
|
|
476
|
-
const
|
|
477
|
-
id))});let w=
|
|
478
|
-
ed temp public")} ${T}`);const d=await
|
|
481
|
+
`),{padding:1,borderColor:"green",borderStyle:"round"})}catch(u){var s=u,o=!0}finally{var c=$d(a,s,o);c&&await c}}var Sc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ac=t=>{throw TypeError(t)},Ed=(t,e,r)=>{if(e!=null){typeof e!="object"&&typeof e!="function"&&Ac("Object expected");var n,i;n=e[Sc("asyncDispose")],n===void 0&&(n=e[Sc("dispose")],i=n),typeof n!="function"&&Ac("Object not disposable"),i&&(n=function(){try{i.call(this)}catch(a){return Promise.reject(a)}}),t.push([r,n,e])}else t.push(
|
|
482
|
+
[r]);return e},Rd=(t,e,r)=>{var n=typeof SuppressedError=="function"?SuppressedError:function(s,o,c,u){return u=Error(c),u.name="SuppressedError",u.error=s,u.suppressed=o,u},i=s=>e=r?new n(s,e,"An error was suppressed during disposal"):(r=!0,s),a=s=>{for(;s=t.pop();)try{var o=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(o).then(a,c=>(i(c),a()))}catch(c){i(c)}if(r)throw e};return a()};async function Sd({project:t,path:e,useDotBin:r,webcomponentPrefix:n="likec4",outfile:i}){var a=[];try{await lt();
|
|
483
|
+
const u=ve("c4:codegen"),l=Be(u),f=Ed(a,await ye.fromWorkspace(e,{logger:"vite",graphviz:r?"binary":"wasm",watch:!1}),!0),{projectId:p,projectFolder:h}=tr(f,t);t&&u.info(`${y.dim("project")} ${y.green(p)}`),u.info(`${y.dim("format")} ${y.green("webcomponent")}`);const v=await f.diagrams(p);if(!st(v,1))throw u.warn("no views found"),process.exitCode=1,new Error("no views found");v.forEach(E=>{E.hasLayoutDrift&&u.warn(y.yellow("drift detected, manual layout can not be applied, view:")+" "+y.red(E.
|
|
484
|
+
id))});let w=z(f.projectsManager.hasMultipleProjects()?h:f.workspace,"likec4-views.js");if(i&&(w=ur(i)?i:z(i),_e(i)&&(await lr(i)).isDirectory()))throw new Error(`output file is a directory: ${i}`);He.debug(`${y.dim("outfilepath")} ${w}`);const m=$t(w);He.debug(`${y.dim("filename")} ${m}`);const g=ot(m).toLocaleLowerCase();if(g!==".js"&&g!==".mjs")throw He.warn(`output file ${i} has extension "${g}"`),new Error(`output file ${i} must be a .js or .mjs`);const T=await br();He.debug(`${y.dim("creat\
|
|
485
|
+
ed temp public")} ${T}`);const d=await Br({languageServices:f,outDir:T,filename:m,webcomponentPrefix:n,base:"/"});He.debug(`${y.dim("vite build webcomponent")}`),await ct({...d,logLevel:"warn"});const S=z(T,m);if(!_e(S))throw new Error(`output file not found: ${S}`);await Se(Re(w),{recursive:!0}),await ou(S,w),u.info(`${y.dim("generated")} ${w}`),He.debug(`${y.dim("remove temp public")}`),await au(T,{recursive:!0,force:!0}),l.stopAndLog(),Te(ar(`
|
|
479
486
|
${y.dim("Webcomponents generated to:")}
|
|
480
|
-
${Ce(
|
|
487
|
+
${Ce(vt(),w)}
|
|
481
488
|
|
|
482
489
|
${y.dim("Setup and usage instructions:")}
|
|
483
490
|
${y.blue("https://likec4.dev/tooling/code-generation/webcomponent/")}
|
|
484
|
-
`))}catch(
|
|
485
|
-
he).option("use-core-package",
|
|
486
|
-
await
|
|
487
|
-
useCorePackage,outfile:r.outfile,project:r.project})}}).command({command:"views-data [path]",aliases:["views"],describe:"{deprecated} use codegen model",deprecated:!0,builder:r=>r.positional("path",pe).option("outfile",{alias:"o",type:"string",desc:"<file> output .ts file",normalize:!0,coerce:
|
|
488
|
-
positional("path",pe).option("outdir",
|
|
489
|
-
"path",pe).option("outdir",
|
|
490
|
-
4 config",builder:r=>r.positional("path",pe).option("project",
|
|
491
|
+
`))}catch(u){var s=u,o=!0}finally{var c=Rd(a,s,o);c&&await c}}const Ad=t=>t.command({command:"gen <command> [path]",aliases:["generate","codegen"],describe:"Generate various artifacts from LikeC4 sources",builder:e=>e.positional("path",pe).command("react [path]","generate react component to render likec4 view",r=>r.positional("path",pe).option("project",ut).option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.jsx, .mjs or .js)",normalize:!0,coerce:Ve}).option("use-dot",
|
|
492
|
+
he).option("use-core-package",ks),async r=>{await bd({project:r.project,useDotBin:r.useDotBin,path:r.path,outfile:r.outfile,useCorePackage:r.useCorePackage})}).command({command:"webcomponent [path]",aliases:["wc","webcomp"],describe:"generate js with webcomponents",builder:r=>r.positional("path",pe).option("project",ut).option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.mjs or .js)",normalize:!0,coerce:Ve}).option("webcomponent-prefix",wr).option("use-dot",he),handler:async r=>{
|
|
493
|
+
await Sd({project:r.project,useDotBin:r.useDotBin,path:r.path,outfile:r.outfile,webcomponentPrefix:r.webcomponentPrefix})}}).command({command:"model [path]",aliases:["ts"],describe:"generate LikeC4Model (.ts)",builder:r=>r.positional("path",pe).option("project",ut).option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.ts)",normalize:!0,coerce:Ve}).option("use-dot",he).option("use-core-package",ks),handler:async r=>{await yd({path:r.path,useDotBin:r.useDotBin,useCorePackage:r.
|
|
494
|
+
useCorePackage,outfile:r.outfile,project:r.project})}}).command({command:"views-data [path]",aliases:["views"],describe:"{deprecated} use codegen model",deprecated:!0,builder:r=>r.positional("path",pe).option("outfile",{alias:"o",type:"string",desc:"<file> output .ts file",normalize:!0,coerce:Ve}).option("use-dot",he),handler:async r=>{await ht({format:"views",path:r.path,useDotBin:r.useDotBin,outfile:r.outfile})}}).command({command:"dot [path]",describe:"generate graphviz files (.dot)",builder:r=>r.
|
|
495
|
+
positional("path",pe).option("outdir",Rt).option("use-dot",he),handler:async r=>{await ht({format:"dot",path:r.path,useDotBin:r.useDotBin,outdir:r.outdir})}}).command({command:"d2 [path]",describe:"generate D2 files (.d2)",builder:r=>r.positional("path",pe).option("outdir",Rt).option("use-dot",he),handler:async r=>{await ht({format:"d2",path:r.path,useDotBin:r.useDotBin,outdir:r.outdir})}}).command({command:"mermaid [path]",aliases:["mmd"],describe:"generate Mermaid files (.mmd)",builder:r=>r.positional(
|
|
496
|
+
"path",pe).option("outdir",Rt).option("use-dot",he),handler:async r=>{await ht({format:"mermaid",useDotBin:r.useDotBin,path:r.path,outdir:r.outdir})}}).command({command:"plantuml [path]",aliases:["puml"],describe:"generate PlantUML files (.puml)",builder:r=>r.positional("path",pe).option("outdir",Rt).option("use-dot",he),handler:async r=>{await ht({format:"plantuml",useDotBin:r.useDotBin,path:r.path,outdir:r.outdir})}}).command({command:"<custom> [path]",describe:"run custom generator from likec\
|
|
497
|
+
4 config",builder:r=>r.positional("path",pe).option("project",ut).option("use-dot",he),handler:async r=>{await vc({name:"custom",path:r.path,project:r.project,useDotBin:r.useDotBin})}}).epilog(`${y.bold("Examples:")}
|
|
491
498
|
likec4 gen react -o dist/likec4-views.mjs ./src/likec4
|
|
492
499
|
likec4 gen model -o likec4-model.ts
|
|
493
500
|
likec4 gen ts --outfile likec4-model.ts
|
|
@@ -495,8 +502,8 @@ positional("path",pe).option("outdir",Et).option("use-dot",he),handler:async r=>
|
|
|
495
502
|
likec4 gen mmd --outdir assets/
|
|
496
503
|
likec4 gen plantuml --outdir assets/
|
|
497
504
|
likec4 gen dot -o out .
|
|
498
|
-
`),handler:async e=>{await
|
|
499
|
-
"\u2713 export in ")}const
|
|
505
|
+
`),handler:async e=>{await vc({name:e.command,path:e.path,project:e.project,useDotBin:e.useDotBin})}});async function _d({path:t,useDotBin:e,outfile:r}){const n=ve("c4:export"),i=Be(n),a=await ye.fromWorkspace(t,{logger:"vite",graphviz:e?"binary":"wasm",watch:!1});a.ensureSingleProject();const s=await a.layoutedModel();ot(r)!==".json"&&(r=r+".json"),await Se(Re(r),{recursive:!0});const o=JSON.stringify(s.$data,null,2);await Oe(r,o),n.info(`${y.dim("generated")} ${Ce(process.cwd(),r)}`),i.stopAndLog(
|
|
506
|
+
"\u2713 export in ")}const Cd=t=>t.command({command:"export <format> [path]",describe:"Export to images or JSON",builder:e=>e.usage(`${y.bold("Usage:")} $0 export <format> [path]`).positional("path",pe).command({command:"png [path]",describe:"export views to PNG",builder:r=>r.options({output:{alias:["o","outdir"],type:"string",desc:"output directory, if not specified, images are saved next to sources",normalize:!0,nargs:1,coerce:z},project:ut,theme:{choices:["light","dark"],desc:"color-scheme to\
|
|
500
507
|
use, defaults to light",conflicts:["dark","light"],nargs:1},dark:{type:"boolean",desc:"use dark theme, shortcut for --theme=dark",conflicts:["theme","light"]},light:{type:"boolean",desc:"use light theme, shortcut for --theme=light",conflicts:["theme","dark"]},"use-dot":he,seq:{boolean:!0,alias:["sequence"],type:"boolean",desc:"use sequence layout for dynamic views"},flat:{alias:["flatten"],boolean:!0,type:"boolean",desc:"flatten all images in output directory ignoring sources structure"},filter:{
|
|
501
508
|
alias:"f",array:!0,string:!0,desc:`include views with ids matching given patterns
|
|
502
509
|
multiple patterns are combined with OR`},ignore:{boolean:!0,alias:"i",desc:"continue if export fails for some views"},timeout:{type:"number",alias:"t",desc:"timeout for playwright (in seconds)",default:15,nargs:1},"max-attempts":{type:"number",desc:"max attempts to export failing view, 1 means no retry",default:3,nargs:1},"server-url":{type:"string",desc:"use this url instead of starting new likec4 server",nargs:1},"chromium-sandbox":{boolean:!0,desc:"enable chromium sandbox (see Playwright docs\
|
|
@@ -512,14 +519,14 @@ multiple patterns are combined with OR`},ignore:{boolean:!0,alias:"i",desc:"cont
|
|
|
512
519
|
|
|
513
520
|
${y.green('$0 export png -f "use-case*" --sequence src/likec4')}
|
|
514
521
|
${y.gray("Export views matching use-case* using sequence layout")}
|
|
515
|
-
`),handler:async r=>{
|
|
516
|
-
ort model to JSON",builder:r=>r.option("outfile",{alias:"o",type:"string",desc:"<file> output .json file",default:"likec4.json",normalize:!0,coerce:
|
|
522
|
+
`),handler:async r=>{hr(r.timeout>=1,"timeout must be >= 1"),hr(r["max-attempts"]>=1,"max-attempts must be >= 1"),await lt();const n=r.theme??(r.dark?"dark":"light");await bi({path:r.path,useDotBin:r["use-dot"],output:r.output,project:r.project,timeoutMs:r.timeout*1e3,maxAttempts:r.maxAttempts,ignore:r.ignore===!0,outputType:r.flat?"flat":"relative",serverUrl:r.serverUrl,theme:n,filter:r.filter,sequence:r.seq,chromiumSandbox:r["chromium-sandbox"]})}}).command({command:"json [path]",describe:"exp\
|
|
523
|
+
ort model to JSON",builder:r=>r.option("outfile",{alias:"o",type:"string",desc:"<file> output .json file",default:"likec4.json",normalize:!0,coerce:z}).option("use-dot",he).epilog(`${y.bold("Examples:")}
|
|
517
524
|
${y.green("$0 export json")}
|
|
518
525
|
${y.gray("Search for likec4 files in current directory and output JSON to likec4.json")}
|
|
519
526
|
|
|
520
527
|
${y.green("$0 export json -o ./generated/likec4.json src/likec4 ")}
|
|
521
528
|
${y.gray("Search for likec4 files in src/likec4 and output JSON to generated/likec4.json")}
|
|
522
|
-
`),handler:async r=>{await
|
|
529
|
+
`),handler:async r=>{await _d({path:r.path,useDotBin:r.useDotBin,outfile:r.outfile})}}).updateStrings({"Commands:":y.bold("Formats:")}),handler:()=>{}}),xd=t=>t.command({command:"mcp [path]",aliases:[],describe:"Start MCP server",builder:e=>e.usage(`${y.bold("Usage:")} $0 mcp [path]`).positional("path",pe).option("stdio",{boolean:!0,description:"use stdio transport",conflicts:["http","port"]}).option("http",{boolean:!0,description:"use streamable http transport (use 33335 port by default)",conflicts:"\
|
|
523
530
|
stdio"}).option("port",{alias:"p",number:!0,description:"enables http transport and sets the port",conflicts:"stdio"}).option("use-dot",he).epilog(`${y.bold("Examples:")}
|
|
524
531
|
${y.green("$0 mcp")}
|
|
525
532
|
${y.gray("Start MCP with default stdio transport")}
|
|
@@ -527,7 +534,7 @@ ${y.green("$0 mcp --http ./src")}
|
|
|
527
534
|
${y.gray("Start MCP with streamable http transport on port 33335 at ./src folder")}
|
|
528
535
|
${y.green("$0 mcp -p 1234")}
|
|
529
536
|
${y.gray("Start MCP with streamable http transport on port 1234")}
|
|
530
|
-
`),handler:async e=>{e.http||e.port?await
|
|
537
|
+
`),handler:async e=>{e.http||e.port?await Td(e.path,e.useDot,e.port):await Id(e.path,e.useDot)}});async function Td(t,e,r=33335){await ye.fromWorkspace(t,{mcp:{port:r},watch:!0,graphviz:e?"binary":"wasm"}),Te([y.green("LikeC4 MCP served at:"),`
|
|
531
538
|
{
|
|
532
539
|
"mcpServers": {
|
|
533
540
|
"likec4": {
|
|
@@ -539,14 +546,14 @@ ${y.green("$0 mcp -p 1234")}
|
|
|
539
546
|
${y.dim("Documentation:")}
|
|
540
547
|
${y.underline("https://likec4.dev/tooling/mcp/#using-extension")}
|
|
541
548
|
`].join(`
|
|
542
|
-
`))}async function
|
|
543
|
-
outputDir:e,open:!
|
|
544
|
-
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"},listen:{alias:"l",type:"string",desc:"ip address of the network interface to listen on"}}).coerce(["path","output"],
|
|
545
|
-
title:n,useHashHistory:
|
|
546
|
-
if(
|
|
547
|
-
command({command:"start [path]",aliases:["serve","dev"],describe:"Start local dev server to preview LikeC4 views",builder:e=>e.positional("path",pe).option("base",
|
|
548
|
-
await
|
|
549
|
-
const
|
|
550
|
-
nore-layout"]})}});
|
|
551
|
-
global:!0}).demandCommand(1,"Please run with valid command").recommendCommands().showHelpOnFail(!0).updateStrings({"Options:":y.bold("Options:"),"Positionals:":y.bold("Arguments:"),"Commands:":y.bold("Commands:"),"Examples:":y.bold("Examples:")}).wrap(
|
|
549
|
+
`))}async function Id(t,e){await ye.fromWorkspace(t,{mcp:"stdio",watch:!0,graphviz:e?"binary":"wasm"})}async function Od(t){const e=await Gr({...t,likec4AssetsDir:"",webcomponentPrefix:void 0}),r=await Wr({port:Tt(62001,62010)}),n=t?.open??!1;return await du({...e,mode:"production",preview:{host:t.listen??"127.0.0.1",allowedHosts:!0,port:r,open:n}})}async function Ld({path:t,output:e,base:r,listen:n}){const i=await ye.fromWorkspace(t,{logger:"vite",watch:!1}),a=await Od({base:r,languageServices:i,
|
|
550
|
+
outputDir:e,open:!Le(),listen:n});di(a)}const kd=t=>t.command({command:"preview [path]",describe:"Start local server to preview production build",builder:e=>e.positional("path",{type:"string",desc:`Directory with LikeC4 source files
|
|
551
|
+
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"},listen:{alias:"l",type:"string",desc:"ip address of the network interface to listen on"}}).coerce(["path","output"],Ve).default("path",Ve("."),".").default("listen","127.0.0.1","localhost"),handler:async e=>{await Ld(e)}});async function Nd({path:t,useDotBin:e,webcomponentPrefix:r,
|
|
552
|
+
title:n,useHashHistory:i,useOverview:a=!1,enableWebcomponent:s=!0,enableHMR:o=!0,base:c,listen:u,port:l}){o&&(process.env.NODE_ENV="development");const f=await ye.fromWorkspace(t,{graphviz:e?"binary":"wasm",watch:o}),p=await bt(it(Et(),".likec4-assets-")),h=await yi({buildWebcomponent:s,hmr:o,base:c,webcomponentPrefix:r,title:n,languageServices:f,useHashHistory:i,useOverviewGraph:a,likec4AssetsDir:p,listen:u,port:l});if(h.config.logger.clearScreen("info"),di(h),!a)return;const v=await f.diagrams();
|
|
553
|
+
if(st(v,1)){const w=ve("c4:export"),m=pi(h);if(!m){w.error("no preview server url");return}w.info(y.cyan("wait 5sec before generating previews")),await Ls(5e3);try{await $i({serverUrl:m,logger:w,views:v,theme:"light",output:p,outputType:"flat"}),await Ls(1e3),w.info(y.yellow("Note: changes in sources do not trigger preview updates, restart is required"))}catch(g){w.error(y.red("Failed to generate previews")),w.error(g)}}else h.config.logger.warn("no views found, no previews generated")}const Pd=t=>t.
|
|
554
|
+
command({command:"start [path]",aliases:["serve","dev"],describe:"Start local dev server to preview LikeC4 views",builder:e=>e.positional("path",pe).option("base",js).option("webcomponent-prefix",wr).option("title",Ps).option("use-hash-history",Ns).option("use-dot",he).option("listen",Iu).option("port",Ou).options({"react-hmr":{type:"boolean",default:!0,describe:"Enable/Disable React HMR"},"build-webcomponent":{type:"boolean",default:!0,describe:"Enable/Disable Webcomponent build"}}),handler:async e=>{
|
|
555
|
+
await lt(),await Nd({path:e.path,useDotBin:e["use-dot"],base:e.base,webcomponentPrefix:e["webcomponent-prefix"],title:e.title,useHashHistory:e["use-hash-history"],listen:e.listen,port:e.port,enableHMR:e["react-hmr"],enableWebcomponent:e["build-webcomponent"]})}});async function jd({path:t,ignoreLayout:e}){const r=await ye.fromWorkspace(t,{logger:"vite",watch:!1}),n=ve("c4:views");let i=a(r);return i=i&&(e||await s(r,n)),i?0:vs(1);function a(o){return o.getErrors().length===0}async function s(o,c){
|
|
556
|
+
const u=await o.diagrams();let l=!1;for(const f of u)f.hasLayoutDrift===!0&&(l=!0,c.error(y.red(`Layout drift detected on view '${f.id}' at ${z(t,f.sourcePath??".")}`)));return!l}}const Dd=t=>t.command({command:"validate [path]",aliases:[],describe:"Validate model syntax and manual layout",builder:e=>e.positional("path",pe).option("ignore-layout",{alias:["skip-layout"],boolean:!0,default:!1,description:"do not validate layout of views"}),handler:async e=>{await jd({path:e.path,ignoreLayout:e["ig\
|
|
557
|
+
nore-layout"]})}});gs({sinks:{console:ys()},loggers:[{category:"likec4",sinks:["console"],lowestLevel:nu?"debug":"info"}]});async function qd(){!Le()&&sd(),await bs(su(iu(Qc)),Pd,Nl,Ad,Cd,kd,Dd,xd,ad,t=>t.command({command:"completion",describe:"Generate completion script",handler:()=>{t.showCompletionScript()}})).scriptName("likec4").usage("Usage: $0 <command>").version(Ge).alias("v","version").alias("h","help").help("help").option("verbose",{type:"boolean",default:!1,describe:"verbose logging",
|
|
558
|
+
global:!0}).demandCommand(1,"Please run with valid command").recommendCommands().showHelpOnFail(!0).updateStrings({"Options:":y.bold("Options:"),"Positionals:":y.bold("Arguments:"),"Commands:":y.bold("Commands:"),"Examples:":y.bold("Examples:")}).wrap(ps(Zc.columns-10,{min:80,max:150})).middleware(t=>{t.verbose&&gs({sinks:{console:ys()},loggers:[{category:"likec4",sinks:["console"],lowestLevel:"debug"}]})}).parseAsync()}qd().catch(()=>{vs(1)}),process.on("unhandledRejection",t=>{console.error("U\
|
|
552
559
|
nhandled rejection",t)});
|