likec4 1.22.0 → 1.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1782 +0,0 @@
1
- import*as cw from"node:fs";import{existsSync as UA}from"node:fs";import fi,{resolve as WA,basename as HA}from"node:path";import{fileURLToPath as KA,pathToFileURL as VA}from"node:url";import{isatty as XA}from"tty";import YA,{stripVTControlCharacters as JA}from"node:util";import QA from"util";import hi from"path";import ZA from"os";import eC from"crypto";import tC from"net";import nC from"url";import Za from"fs";import rC from"child_process";import{invariant as Ce,defaultTheme as qt,DefaultRelationshipColor as eo,nonexhaustive as Ne,hierarchyDistance as iC,DefaultThemeColor as Js,nameFromFqn as ad,nonNullable as ln,isThemeColor as uw,compareFqnHierarchically as sC,DefaultArrowType as Yi,ComputedNode as od,extractStep as aC,ComputedView as to,delay as oC,DefaultLineStyle as cC,LinkedList as Cp,AsFqn as uC,stringHash as lC,parentFqn as cd,compareNatural as lw,LikeC4Model as dw,isScopedElementView as dC,computeColorValues as fC,sortByFqnHierarchically as fw,compareRelations as hC,DeploymentElement as pC,FqnRef as no,isSameHierarchy as hw,isAncestor as Pp,FqnExpr as ro,isNonEmptyArray as qn,isAutoLayoutDirection as mC,isOrOperator as pw,isAndOperator as mw,hasAtLeast as gC}from"@likec4/core";import{ComputedNode as gw,DefaultShapeSize as yC,DefaultTextSize as vC,DefaultPaddingSize as wC}from"@likec4/core/types";import{EventEmitter as bC}from"events";import{Buffer as xp}from"buffer";import{Graphviz as Np}from"@hpcc-js/wasm-graphviz";import{resolveRulesExtendedViews as RC}from"@likec4/core/compute-view";import pi,{hrtime as yw}from"node:process";import $C from"boxen";import{spawn as kC}from"node:child_process";import{once as vw,on as TC}from"node:events";import{stat as EC}from"node:fs/promises";import{pipeline as SC}from"node:stream/promises";import _C from"node:os";import ww from"fs/promises";import{LikeC4Model as bw}from"@likec4/core/model";const AC={},Qs=CC(globalThis,AC);function CC(t,e){return new Proxy(t,{get(n,r,i){return r in e?e[r]:t[r]},set(n,r,i){return r in e&&delete e[r],t[r]=i,!0},deleteProperty(n,r){let i=!1;return r in e&&(delete e[r],i=!0),r in t&&(delete t[r],i=!0),i},ownKeys(n){const r=Reflect.ownKeys(t),i=Reflect.ownKeys(e),s=new Set(i);return[...r.filter(a=>!s.has(a)),...i]},defineProperty(n,r,i){return r in e&&delete e[r],Reflect.defineProperty(t,r,i),!0},getOwnPropertyDescriptor(n,r){return r in e?Reflect.getOwnPropertyDescriptor(e,r):Reflect.getOwnPropertyDescriptor(t,r)},has(n,r){return r in e||r in t}})}function Rw(t){return typeof t=="function"?t:PC(t)}function PC(t){if(t==null)return()=>!1;if(t==="fatal")return e=>e.level==="fatal";if(t==="error")return e=>e.level==="fatal"||e.level==="error";if(t==="warning")return e=>e.level==="fatal"||e.level==="error"||e.level==="warning";if(t==="info")return e=>e.level==="fatal"||e.level==="error"||e.level==="warning"||e.level==="info";if(t==="debug")return()=>!0;throw new TypeError(`Invalid log level: ${t}.`)}const $w=["debug","info","warning","error","fatal"];function kw(t,e){const n=$w.indexOf(t);if(n<0)throw new TypeError(`Invalid log level: ${JSON.stringify(t)}.`);const r=$w.indexOf(e);if(r<0)throw new TypeError(`Invalid log level: ${JSON.stringify(e)}.`);return n-r}function xC(t=[]){return _n.getLogger(t)}const Dp=Symbol.for("logtape.rootLogger");class _n{static getLogger(e=[]){let n=Dp in Qs?Qs[Dp]??null:null;return n==null&&(n=new _n(null,[]),Qs[Dp]=n),typeof e=="string"?n.getChild(e):e.length===0?n:n.getChild(e)}constructor(e,n){Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"children",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"category",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sinks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parentSinks",{enumerable:!0,configurable:!0,writable:!0,value:"inherit"}),Object.defineProperty(this,"filters",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lowestLevel",{enumerable:!0,configurable:!0,writable:!0,value:"debug"}),Object.defineProperty(this,"contextLocalStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.parent=e,this.children={},this.category=n,this.sinks=[],this.filters=[]}getChild(e){const n=typeof e=="string"?e:e[0],r=this.children[n];let i=r instanceof _n?r:r?.deref();return i==null&&(i=new _n(this,[...this.category,n]),this.children[n]="WeakRef"in Qs?new WeakRef(i):i),typeof e=="string"||e.length===1?i:i.getChild(e.slice(1))}reset(){for(;this.sinks.length>0;)this.sinks.shift();for(this.parentSinks="inherit";this.filters.length>0;)this.filters.shift();this.lowestLevel="debug"}resetDescendants(){for(const e of Object.values(this.children)){const n=e instanceof _n?e:e.deref();n?.resetDescendants()}this.reset()}with(e){return new nw(this,{...e})}filter(e){for(const n of this.filters)if(!n(e))return!1;return this.filters.length<1?this.parent?.filter(e)??!0:!0}*getSinks(e){if(!(this.lowestLevel===null||kw(e,this.lowestLevel)<0)){if(this.parent!=null&&this.parentSinks==="inherit")for(const n of this.parent.getSinks(e))yield n;for(const n of this.sinks)yield n}}emit(e,n){if(!(this.lowestLevel===null||kw(e.level,this.lowestLevel)<0||!this.filter(e))){for(const r of this.getSinks(e.level))if(!n?.has(r))try{r(e)}catch(i){const s=new Set(n);s.add(r),NC.log("fatal","Failed to emit a log record to sink {sink}: {error}",{sink:r,error:i,record:e},s)}}}log(e,n,r,i){const s=_n.getLogger().contextLocalStorage?.getStore()??{};let a;const o=typeof r=="function"?{category:this.category,level:e,timestamp:Date.now(),get message(){return Tw(n,this.properties)},rawMessage:n,get properties(){return a==null&&(a={...s,...r()}),a}}:{category:this.category,level:e,timestamp:Date.now(),message:Tw(n,{...s,...r}),rawMessage:n,properties:{...s,...r}};this.emit(o,i)}logLazily(e,n,r={}){const i=_n.getLogger().contextLocalStorage?.getStore()??{};let s,a;function o(){if((a==null||s==null)&&(a=n((c,...u)=>(s=c,Ew(c,u))),s==null))throw new TypeError("No log record was made.");return[a,s]}this.emit({category:this.category,level:e,get message(){return o()[0]},get rawMessage(){return o()[1]},timestamp:Date.now(),properties:{...i,...r}})}logTemplate(e,n,r,i={}){const s=_n.getLogger().contextLocalStorage?.getStore()??{};this.emit({category:this.category,level:e,message:Ew(n,r),rawMessage:n,timestamp:Date.now(),properties:{...s,...i}})}debug(e,...n){typeof e=="string"?this.log("debug",e,n[0]??{}):typeof e=="function"?this.logLazily("debug",e):this.logTemplate("debug",e,n)}info(e,...n){typeof e=="string"?this.log("info",e,n[0]??{}):typeof e=="function"?this.logLazily("info",e):this.logTemplate("info",e,n)}warn(e,...n){typeof e=="string"?this.log("warning",e,n[0]??{}):typeof e=="function"?this.logLazily("warning",e):this.logTemplate("warning",e,n)}error(e,...n){typeof e=="string"?this.log("error",e,n[0]??{}):typeof e=="function"?this.logLazily("error",e):this.logTemplate("error",e,n)}fatal(e,...n){typeof e=="string"?this.log("fatal",e,n[0]??{}):typeof e=="function"?this.logLazily("fatal",e):this.logTemplate("fatal",e,n)}}class nw{constructor(e,n){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"properties",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.logger=e,this.properties=n}get category(){return this.logger.category}get parent(){return this.logger.parent}getChild(e){return this.logger.getChild(e).with(this.properties)}with(e){return new nw(this.logger,{...this.properties,...e})}log(e,n,r,i){this.logger.log(e,n,typeof r=="function"?()=>({...this.properties,...r()}):{...this.properties,...r},i)}logLazily(e,n){this.logger.logLazily(e,n,this.properties)}logTemplate(e,n,r){this.logger.logTemplate(e,n,r,this.properties)}debug(e,...n){typeof e=="string"?this.log("debug",e,n[0]??{}):typeof e=="function"?this.logLazily("debug",e):this.logTemplate("debug",e,n)}info(e,...n){typeof e=="string"?this.log("info",e,n[0]??{}):typeof e=="function"?this.logLazily("info",e):this.logTemplate("info",e,n)}warn(e,...n){typeof e=="string"?this.log("warning",e,n[0]??{}):typeof e=="function"?this.logLazily("warning",e):this.logTemplate("warning",e,n)}error(e,...n){typeof e=="string"?this.log("error",e,n[0]??{}):typeof e=="function"?this.logLazily("error",e):this.logTemplate("error",e,n)}fatal(e,...n){typeof e=="string"?this.log("fatal",e,n[0]??{}):typeof e=="function"?this.logLazily("fatal",e):this.logTemplate("fatal",e,n)}}const NC=_n.getLogger(["logtape","meta"]);function Tw(t,e){const n=[];let r="";for(let i=0;i<t.length;i++){const s=t.charAt(i),a=t.charAt(i+1);if(s==="{"&&a==="{")r=r+s,i++;else if(s==="}"&&a==="}")r=r+s,i++;else if(s==="{")n.push(r),r="";else if(s==="}"){let o;r.match(/^\s|\s$/)?o=r in e?e[r]:e[r.trim()]:o=e[r],n.push(o),r=""}else r=r+s}return n.push(r),n}function Ew(t,e){const n=[];for(let r=0;r<t.length;r++)n.push(t[r]),r<e.length&&n.push(e[r]);return n}var DC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ir(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function IC(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}function Ip(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Op,Sw;function OC(){if(Sw)return Op;Sw=1;let t=null;if(typeof window>"u"&&("process"in globalThis&&"versions"in globalThis.process&&"node"in globalThis.process.versions&&typeof globalThis.caches>"u"&&typeof globalThis.addEventListener!="function"||"Bun"in globalThis))try{t=[Ip][0](`${["node","util"].join(":")}`)}catch{t=null}return Op=t,Op}var LC=OC();const ud=Ir(LC),Lp={debug:"DBG",info:"INF",warning:"WRN",error:"ERR",fatal:"FTL"},_w="Deno"in globalThis&&"inspect"in globalThis.Deno&&typeof globalThis.Deno.inspect=="function"?(t,e)=>globalThis.Deno.inspect(t,{strAbbreviateSize:1/0,iterableLimit:1/0,...e}):ud!=null&&"inspect"in ud&&typeof ud.inspect=="function"?(t,e)=>ud.inspect(t,{maxArrayLength:1/0,maxStringLength:1/0,...e}):t=>JSON.stringify(t);function Aw(t={}){const e=t.timestamp==null||t.timestamp==="date-time-timezone"?a=>new Date(a).toISOString().replace("T"," ").replace("Z"," +00:00"):t.timestamp==="date-time-tz"?a=>new Date(a).toISOString().replace("T"," ").replace("Z"," +00"):t.timestamp==="date-time"?a=>new Date(a).toISOString().replace("T"," ").replace("Z",""):t.timestamp==="time-timezone"?a=>new Date(a).toISOString().replace(/.*T/,"").replace("Z"," +00:00"):t.timestamp==="time-tz"?a=>new Date(a).toISOString().replace(/.*T/,"").replace("Z"," +00"):t.timestamp==="time"?a=>new Date(a).toISOString().replace(/.*T/,"").replace("Z",""):t.timestamp==="date"?a=>new Date(a).toISOString().replace(/T.*/,""):t.timestamp==="rfc3339"?a=>new Date(a).toISOString():t.timestamp,n=t.category??"\xB7",r=t.value??_w,i=t.level==null||t.level==="ABBR"?a=>Lp[a]:t.level==="abbr"?a=>Lp[a].toLowerCase():t.level==="FULL"?a=>a.toUpperCase():t.level==="full"?a=>a:t.level==="L"?a=>a.charAt(0).toUpperCase():t.level==="l"?a=>a.charAt(0):t.level,s=t.format??(({timestamp:a,level:o,category:c,message:u})=>`${a} [${o}] ${c}: ${u}`);return a=>{let o="";for(let f=0;f<a.message.length;f++)f%2===0?o+=a.message[f]:o+=r(a.message[f]);const c=e(a.timestamp),u=i(a.level),l=typeof n=="function"?n(a.category):a.category.join(n);return`${s({timestamp:c,level:u,category:l,message:o,record:a})}
2
- `}}Aw();const Mp="\x1B[0m",zp={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},Fp={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",strikethrough:"\x1B[9m"},MC={debug:"blue",info:"green",warning:"yellow",error:"red",fatal:"magenta"};function Cw(t={}){const e=t.format,n=typeof t.timestampStyle>"u"?"dim":t.timestampStyle,r=t.timestampColor??null,i=`${n==null?"":Fp[n]}${r==null?"":zp[r]}`,s=n==null&&r==null?"":Mp,a=typeof t.levelStyle>"u"?"bold":t.levelStyle,o=t.levelColors??MC,c=typeof t.categoryStyle>"u"?"dim":t.categoryStyle,u=t.categoryColor??null,l=`${c==null?"":Fp[c]}${u==null?"":zp[u]}`,d=c==null&&u==null?"":Mp;return Aw({timestamp:"date-time-tz",value(f){return _w(f,{colors:!0})},...t,format({timestamp:f,level:h,category:m,message:y,record:R}){const w=o[R.level];return f=`${i}${f}${s}`,h=`${a==null?"":Fp[a]}${w==null?"":zp[w]}${h}${a==null&&w==null?"":Mp}`,e==null?`${f} ${h} ${l}${m}:${d} ${y}`:e({timestamp:f,level:h,category:`${l}${m}${d}`,message:y,record:R})}})}Cw();const zC={debug:"background-color: gray; color: white;",info:"background-color: white; color: black;",warning:"background-color: orange; color: black;",error:"background-color: red; color: white;",fatal:"background-color: maroon; color: white;"};function FC(t){let e="";const n=[];for(let s=0;s<t.message.length;s++)s%2===0?e+=t.message[s]:(e+="%o",n.push(t.message[s]));const r=new Date(t.timestamp);return[`%c${`${r.getUTCHours().toString().padStart(2,"0")}:${r.getUTCMinutes().toString().padStart(2,"0")}:${r.getUTCSeconds().toString().padStart(2,"0")}.${r.getUTCMilliseconds().toString().padStart(3,"0")}`} %c${Lp[t.level]}%c %c${t.category.join("\xB7")} %c${e}`,"color: gray;",zC[t.level],"background-color: default;","color: gray;","color: default;",...n]}function Pw(t={}){const e=t.formatter??FC,n=t.console??globalThis.console;return r=>{const i=e(r);if(typeof i=="string"){const s=i.replace(/\r?\n$/,"");if(r.level==="debug")n.debug(s);else if(r.level==="info")n.info(s);else if(r.level==="warning")n.warn(s);else if(r.level==="error"||r.level==="fatal")n.error(s);else throw new TypeError(`Invalid log level: ${r.level}.`)}else if(r.level==="debug")n.debug(...i);else if(r.level==="info")n.info(...i);else if(r.level==="warning")n.warn(...i);else if(r.level==="error"||r.level==="fatal")n.error(...i);else throw new TypeError(`Invalid log level: ${r.level}.`)}}let qp=null;const xw=new Set,ld=new Set,dd=new Set;async function qC(t){if(qp!=null&&!t.reset)throw new Bp("Already configured; if you want to reset, turn on the reset flag.");await Gp(),qp=t;let e=!1,n=!1;for(const i of t.loggers){(i.category.length===0||i.category.length===1&&i.category[0]==="logtape"||i.category.length===2&&i.category[0]==="logtape"&&i.category[1]==="meta")&&(e=!0);const s=_n.getLogger(i.category);for(const a of i.sinks??[]){const o=t.sinks[a];if(!o)throw await Gp(),new Bp(`Sink not found: ${a}.`);s.sinks.push(o)}s.parentSinks=i.parentSinks??"inherit",i.lowestLevel!==void 0&&(s.lowestLevel=i.lowestLevel),i.level!==void 0&&(n=!0,s.filters.push(Rw(i.level)));for(const a of i.filters??[]){const o=t.filters?.[a];if(o===void 0)throw await Gp(),new Bp(`Filter not found: ${a}.`);s.filters.push(Rw(o))}xw.add(s)}_n.getLogger().contextLocalStorage=t.contextLocalStorage;for(const i of Object.values(t.sinks))Symbol.asyncDispose in i&&dd.add(i),Symbol.dispose in i&&ld.add(i);for(const i of Object.values(t.filters??{}))i==null||typeof i=="string"||(Symbol.asyncDispose in i&&dd.add(i),Symbol.dispose in i&&ld.add(i));"process"in Qs&&!("Deno"in Qs)?process.on("exit",jp):addEventListener("unload",jp);const r=_n.getLogger(["logtape","meta"]);e||r.sinks.push(Pw()),r.info("LogTape loggers are configured. Note that LogTape itself uses the meta logger, which has category {metaLoggerCategory}. The meta logger purposes to log internal errors such as sink exceptions. If you are seeing this message, the meta logger is somehow configured. It's recommended to configure the meta logger with a separate sink so that you can easily notice if logging itself fails or is misconfigured. To turn off this message, configure the meta logger with higher log levels than {dismissLevel}. See also <https://logtape.org/manual/categories#meta-logger>.",{metaLoggerCategory:["logtape","meta"],dismissLevel:"info"}),n&&r.warn("The level option is deprecated in favor of lowestLevel option. Please update your configuration. See also <https://logtape.org/manual/levels#configuring-severity-levels>.")}async function Gp(){await jp();const t=_n.getLogger([]);t.resetDescendants(),delete t.contextLocalStorage,xw.clear(),qp=null}async function jp(){for(const e of ld)e[Symbol.dispose]();ld.clear();const t=[];for(const e of dd)t.push(e[Symbol.asyncDispose]()),dd.delete(e);await Promise.all(t)}class Bp extends Error{constructor(e){super(e),this.name="ConfigureError"}}var Up,Nw;function GC(){if(Nw)return Up;Nw=1;let t=null;if(typeof window>"u"&&("process"in globalThis&&"versions"in globalThis.process&&"node"in globalThis.process.versions&&typeof globalThis.caches>"u"&&typeof globalThis.addEventListener!="function"||"Bun"in globalThis))try{t=[Ip][0](`${["node","fs"].join(":")}`)}catch{t=null}return Up=t,Up}var jC=GC();const BC=Ir(jC),UC={},Zs=BC;Zs==null||(Zs.writeSync,Zs.fsyncSync,Zs.closeSync,Zs.statSync,Zs.renameSync);const WC=t=>{Wp.forEach(e=>{HC(t,e)})},Wp=["name","message","stack","cause","errors"],HC=(t,e)=>{const n=Hp(t,e);if(n!==void 0){if(KC(n)){Or(t,e,t[e]);return}VC(n)&&Dw(t,e,n)}},Hp=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);if(n!==void 0)return n;const r=Object.getPrototypeOf(t);return r===null?void 0:Hp(r,e)},KC=({get:t,set:e})=>t!==void 0&&e===void 0,VC=({enumerable:t,writable:e})=>t||!e,Or=(t,e,n)=>{Dw(t,e,{value:n})},Dw=(t,e,n)=>{Object.defineProperty(t,e,{...n,..."get"in n||"set"in n?{}:{writable:!0},enumerable:!1,configurable:!0})},XC=(t,e)=>{if(Array.isArray(t.errors)){const n=t.errors.filter(YC).map(e).filter(Boolean);Or(t,"errors",n)}else JC(t)?Or(t,"errors",[]):t.errors!==void 0&&QC(t)},YC=t=>t!==void 0,JC=t=>"AggregateError"in globalThis&&(t.name==="AggregateError"||t instanceof AggregateError),QC=t=>{delete t.errors,t.errors!==void 0&&Or(t,"errors",[])},ZC=(t,e)=>{if(!("cause"in t))return;const n=t.cause===void 0?t.cause:e(t.cause);n===void 0?delete t.cause:Or(t,"cause",n)},eP=t=>tP(t)||nP(t),tP=t=>{try{return t instanceof Error}catch{return!1}},nP=t=>{try{return rP.has(Object.prototype.toString.call(t))}catch{return!1}},rP=new Set(["[object Error]","[object DOMException]","[object DOMError]","[object Exception]"]);function fd(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}const iP=t=>!Object.isExtensible(t)||Wp.some(e=>sP(t,e)||aP(t,e)),sP=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);return n!==void 0&&!n.configurable},aP=(t,e)=>{try{return t[e],!1}catch{return!0}},Kp=t=>{const e=oP(t.message,t.name);Or(t,"stack",e)},oP=(t="",e="Error")=>{const n=cP(e),{stack:r}=new n(t);return typeof r=="string"&&r!==""?r:`${e}: ${t}`},cP=t=>{const e={value:t,enumerable:!1,writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},"name",e);return Object.defineProperty(n.prototype,"name",e),n},uP=t=>{const e={};for(const n of lP(t))try{const r=t[n],{enumerable:i,configurable:s,writable:a=!0}=Hp(t,n);Object.defineProperty(e,n,{value:r,enumerable:i,configurable:s,writable:a})}catch{}return e},lP=t=>{const e=dP(t);for(const n of Wp)fP(t,n)&&e.push(n);return e},dP=t=>{try{return Reflect.ownKeys(t)}catch{return[]}},fP=(t,e)=>{try{return e in t&&!Object.hasOwn(t,e)}catch{return!1}},Iw=t=>{const{name:e,message:n,stack:r,cause:i,errors:s,...a}=uP(t),o=hP(n,a),c=yP(e,o);return n===o&&vP(c,a),Object.entries({name:e,stack:r,cause:i,errors:s}).forEach(([u,l])=>{wP(c,u,l)}),r===void 0&&Kp(c),c},hP=(t,e)=>typeof t=="string"&&t!==""?t:gP(pP(e)),pP=t=>{try{return JSON.stringify(t)}catch{return mP(t)}},mP=t=>{try{return String(t)}catch{return"Invalid error"}},gP=t=>t.length<Ow?t:`${t.slice(0,Ow)}...`,Ow=1e3,yP=(t,e)=>t==="AggregateError"&&"AggregateError"in globalThis?new AggregateError([],e):t in Lw?new Lw[t](e):new Error(e),Lw={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},vP=(t,e)=>{for(const n in e)n in t||(t[n]=e[n])},wP=(t,e,n)=>{n!==void 0&&Or(t,e,n)},bP=t=>{try{const e=new Error(String(t));return Kp(e),e}catch(e){return e}},{toString:RP}=Object.prototype,$P=t=>kP(t)?Iw(t):eP(t)?TP(t)?Iw(t):t:bP(t),kP=t=>{try{return fd(t)}catch{return!1}},TP=t=>EP(t)||iP(t)||SP(t),EP=t=>{try{return RP.call(t)==="[object Object]"}catch{return!0}},SP=t=>typeof t.constructor!="function"||typeof t.constructor.name!="string"||t.constructor.name===""||t.constructor.prototype!==Object.getPrototypeOf(t),hd=(t,{shallow:e=!1}={})=>Mw(t,[],e),Mw=(t,e,n)=>{if(e.includes(t))return;const r=n?_P:s=>Mw(s,[...e,t],n),i=$P(t);return AP(i,r),i},_P=t=>t,AP=(t,e)=>{CP(t),PP(t),xP(t),ZC(t,e),XC(t,e),WC(t)},CP=t=>{if(pd(t.name))return;const e=Object.getPrototypeOf(t).name,n=pd(e)?e:t.constructor.name;Or(t,"name",n)},PP=t=>{pd(t.message)||Or(t,"message","")},xP=t=>{pd(t.stack)||Kp(t)},pd=t=>typeof t=="string"&&t!=="",NP=(t,e,n=t.name)=>{if(DP(e),typeof n!="string")throw new TypeError(`currentName must be a string: ${n}`);return n},DP=t=>{if(!IP(t))throw new TypeError(`ErrorClass must be a class: ${t}`);if(!zw(t.prototype))throw new TypeError(`ErrorClass must inherit from Error: ${t}`);if(!OP(t))throw new TypeError(`ErrorClass must be have a valid constructor: ${t}`)},IP=t=>typeof t=="function"&&typeof t.prototype=="object"&&t.prototype!==null,zw=t=>t!==null&&(t.name==="Error"||zw(Object.getPrototypeOf(t))),OP=t=>typeof t.prototype.constructor=="function",Fw=(t,e,n)=>{Object.defineProperty(t,e,{value:n,enumerable:!1,writable:!0,configurable:!0})},LP=(t,e)=>{Object.getPrototypeOf(t)!==e.prototype&&(MP(t,e),jw(t,"constructor"),zP(t,e))},MP=(t,e)=>{Object.setPrototypeOf(t,e.prototype)},zP=(t,e)=>{jw(t,"name");const n=qw(e.prototype);t.name!==n&&Fw(t,"name",n)},qw=t=>FP(t)??qP(t)??qw(Object.getPrototypeOf(t)),FP=t=>Object.hasOwn(t,"name")&&Gw(t.name)?t.name:void 0,qP=t=>typeof t.constructor=="function"&&Gw(t.constructor.name)?t.constructor.name:void 0,Gw=t=>typeof t=="string"&&t!=="",jw=(t,e)=>{Object.hasOwn(t,e)&&delete t[e]},GP=(t,e)=>{if(!jP(t,e))return;const n=UP(t,e);Fw(t,"stack",n)},jP=(t,e)=>e!==t.name&&e!==""&&t.stack.includes(e)&&BP(),BP=()=>{class t extends Error{}const e={value:Bw,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(t,"name",e),Object.defineProperty(t.prototype,"name",e);const{stack:n}=new t("");return typeof n=="string"&&n.includes(Bw)},Bw="SetErrorClassError",UP=({name:t,stack:e},n)=>{if(e.startsWith(`${n}: `))return e.replace(n,t);const r=WP(n,t),[i,s]=r.find(([a])=>e.includes(a));return e.replace(i,s)},WP=(t,e)=>[[`
3
- ${t}: `,`
4
- ${e}: `],[`${t}: `,`${e}: `],[`${t} `,`${e} `],[t,e]],HP=(t,e,n)=>{const r=hd(t),i=NP(r,e,n);return LP(r,e),GP(r,i),r},KP=(t,e)=>e.configurable===!1?VP(t,e):JP(t,e),VP=(t,e)=>({...e,...XP(t,e),...YP(t,e)}),XP=(t,e)=>e.writable===!0&&t.writable===!1?{writable:!1}:{},YP=(t,e)=>t.hasValue&&"value"in e&&e.writable===!0?{value:t.value}:{},JP=(t,e)=>{const n=io(t.enumerable,e.enumerable,!0),r=io(t.writable,e.writable,!0),i=io(t.configurable,e.configurable,!0);return{...QP(t,e,r),enumerable:n,configurable:i}},QP=(t,e,n)=>t.hasValue?{value:t.value,writable:n}:!Uw(t)&&!Uw(e)?{value:e.value,writable:n}:{get:io(t.get,e.get),set:io(t.set,e.set)},Uw=({get:t,set:e})=>t!==void 0||e!==void 0,io=(t,e,n)=>t??e??n,ZP=(t,e,n)=>{if(!ex(t))throw new TypeError(`Argument must be an object: ${t}`);if(!tx(e))throw new TypeError(`Property key must be a string, a symbol or an integer: ${e}`);return nx(n)},ex=t=>typeof t=="object"&&t!==null,tx=t=>{const e=typeof t;return e==="string"||e==="symbol"||e==="number"},nx=t=>{if(!fd(t))throw new TypeError(`Descriptor must be a plain object: ${t}`);const{enumerable:e,writable:n,configurable:r,value:i,get:s,set:a,...o}=t,c="value"in t;return rx({enumerable:e,writable:n,configurable:r,get:s,set:a,unknownProps:o,hasValue:c}),{enumerable:e,writable:n,configurable:r,value:i,get:s,set:a,hasValue:c}},rx=({enumerable:t,writable:e,configurable:n,get:r,set:i,unknownProps:s,hasValue:a})=>{Ww(a,r,"get"),Ww(a,i,"set"),Vp(t,"enumerable"),Vp(e,"writable"),Vp(n,"configurable"),sx(s)},Ww=(t,e,n)=>{if(ix(e,n),t&&e!==void 0)throw new TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${e}`)},ix=(t,e)=>{if(t!==void 0&&typeof t!="function")throw new TypeError(`Descriptor property "${e}" must be a function: ${t}`)},Vp=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`Descriptor property "${e}" must be a boolean: ${t}`)},sx=t=>{const[e]=Object.keys(t);if(e!==void 0)throw new TypeError(`Unknown descriptor property "${e}": ${t[e]}`)},ax=(t,e,n)=>{const r=ZP(t,e,n),i=Hw(t,e),s=KP(r,i);return ox(t,e,s),t},Hw=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);if(n!==void 0)return n;const r=Object.getPrototypeOf(t);return r===null?{}:Hw(r,e)},ox=(t,e,n)=>{try{Object.defineProperty(t,e,n)}catch{}},cx=(t,e,n)=>{if(n!==void 0)return Kw(t,e,n);try{delete t[e]}catch{}if(t[e]!==void 0)return Kw(t,e)},Kw=(t,e,n)=>{const r=ux(e);ax(t,e,{value:n,...r})},ux=t=>typeof t=="string"&&t.startsWith("_")?{enumerable:!1}:{},lx=t=>dx(t)||fx(t),dx=t=>{try{return t instanceof Error}catch{return!1}},fx=t=>{try{return hx.has(Object.prototype.toString.call(t))}catch{return!1}},hx=new Set(["[object Error]","[object DOMException]","[object DOMError]","[object Exception]"]),px=(t,e,n={})=>{if(Vw(t,"First argument"),Vw(e,"Second argument"),!fd(n))throw new TypeError(`Options must be a plain object: ${n}`);const{soft:r=!1}=n;if(typeof r!="boolean")throw new TypeError(`Option "soft" must be a boolean: ${r}`);return{soft:r}},Vw=(t,e)=>{if(t===void 0)throw new TypeError(`${e} is required.`);if(!mx(t))throw new TypeError(`${e} must be a plain object or an error: ${t}`)},mx=t=>fd(t)||lx(t),gx=({error:t,props:e,propName:n,soft:r})=>yx(n)||!bx.call(e,n)||r&&t[n]!==void 0,yx=t=>t in vx||wx.has(t),vx=new Error("check"),wx=new Set(["prototype","errors","cause"]),{propertyIsEnumerable:bx}=Object.prototype,Rx=(t,e,n)=>{const{soft:r}=px(t,e,n);for(const i of Reflect.ownKeys(e))$x({error:t,props:e,propName:i,soft:r});return t},$x=({error:t,props:e,propName:n,soft:r})=>{gx({error:t,props:e,propName:n,soft:r})||cx(t,n,e[n])},md=(t,e,n)=>{Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!1,configurable:!0})},kx=(t,e)=>{if(t.errors===void 0)return;const n=t.errors.map(r=>e(r).error).filter(Boolean);md(t,"errors",n)},Tx=({target:t,source:e,parent:n,child:r})=>{if(!Xw(t)){Ex(t,e);return}Xw(e)&&md(t,"errors",[...r.errors,...n.errors])},Ex=(t,e)=>{e.errors!==void 0&&md(t,"errors",e.errors)},Xw=t=>t.errors!==void 0&&t.errors.length!==0,Sx=(t,e,n=t.message)=>{if(typeof e!="string")throw new TypeError(`newMessage must be a string: ${e}`);if(typeof n!="string")throw new TypeError(`currentMessage must be a string: ${n}`);return n},_x=({name:t,stack:e},n,r)=>r!==""&&e.includes(r)?Ax({name:t,stack:e,newMessage:n,currentMessage:r}):Px(t,e,n),Ax=({name:t,stack:e,newMessage:n,currentMessage:r})=>{const i=Cx(t,n,r),[s,a]=i.find(([o])=>e.includes(o));return e.replace(s,a)},Cx=(t,e,n)=>[[`${t}: ${n}`,`${t}: ${e}`],[`: ${n}`,`: ${e}`],[`
5
- ${n}`,`
6
- ${e}`],[` ${n}`,` ${e}`],[n,e]],Px=(t,e,n)=>{const r=`${t}: `,i=n.trimEnd();return e===t||e.startsWith(`${t}
7
- `)?e.replace(t,`${r}${i}`):e.startsWith(r)?e.replace(r,`${r}${i}
8
- `):`${r}${i}
9
- ${e}`},xx=(t,e,n)=>{const r=hd(t),i=Sx(r,e,n);return Jw(r,"message",e),Nx(r,e,i),r},Nx=(t,e,n)=>{if(e===n||!Dx())return;const r=_x(t,e,n);Jw(t,"stack",r)},Dx=()=>{const{stack:t}=new Error(Yw);return typeof t=="string"&&t.includes(Yw)},Yw="set-error-message test message",Jw=(t,e,n)=>{Object.defineProperty(t,e,{value:n,enumerable:!1,writable:!0,configurable:!0})},Ix=(t,e,n)=>{if(typeof e!="string")throw new TypeError(`Second argument must be a message string: ${e}`);const r=hd(t),i=Ox(e,r.message);return xx(r,i,n)},Ox=(t,e)=>{const n=t.trim(),r=e.trim();return n===""?r:r===""?n:Lx(n,r,t)},Lx=(t,e,n)=>t.endsWith(Mx)?n.endsWith(zx)?`${t}
10
- ${e}`:`${t} ${e}`:`${e}
11
- ${t}`,Mx=":",zx=`
12
- `,Fx=({parent:t,child:e,target:n,stackError:r})=>{const i=t.message;return n.message=e.message,Ix(n,i,r.message)},qx=(t,e)=>Qw(t)===e,Qw=t=>typeof t=="object"&&t!==null?t.stack:void 0,Gx=({wrap:t,target:e,source:n,childHasStack:r})=>t===r?e:(md(e,"stack",n.stack),n),jx=t=>{const{wrap:e,name:n}=t;return typeof e!="boolean"?n==="Error":(Object.hasOwn(t,"wrap")&&delete t.wrap,e)},Zw=t=>eb(t,[]).error,eb=(t,e)=>{if(e.includes(t))return{};const n=c=>eb(c,[...e,t]),r=Qw(t),i=hd(t,{shallow:!0}),s=qx(i,r);kx(i,n);const{parent:a,childHasStack:o}=Bx(i,n);return{error:a,errorHasStack:s||o}},Bx=(t,e)=>{const n=jx(t);if(t.cause===void 0)return{parent:t,childHasStack:!1};const{error:r,errorHasStack:i}=e(t.cause);return delete t.cause,{parent:Ux({parent:t,child:r,childHasStack:i,wrap:n}),childHasStack:i}},Ux=({parent:t,child:e,childHasStack:n,wrap:r})=>{if(e===void 0)return t;const[i,s]=r?[e,t]:[t,e],a=Gx({wrap:r,target:i,source:s,childHasStack:n}),o=HP(i,i.constructor,a.name),c=Fx({parent:t,child:e,target:o,stackError:a});return Tx({target:c,source:s,parent:t,child:e}),Rx(c,s,{soft:!r})};function tb(t){return function(e,n){if(typeof n?.toJSON=="function"&&(n=n.toJSON()),!(n!==null&&typeof n=="object"))return n;if(t.has(n))return"[Circular]";t.add(n);const r=Array.isArray(n)?[]:{};for(const[i,s]of Object.entries(n))r[i]=tb(t)(i,s);return t.delete(n),r}}function Wx(t,{indentation:e}={}){return JSON.stringify(t,tb(new WeakSet),e)}const nb=t=>t.split(`
13
- `).map(e=>e.trim().replace("file://",""));function Xp(t,e=2){return t=Array.isArray(t)?t:t.split(`
14
- `),t.map(n=>`${" ".repeat(e)}${n}`).join(`
15
- `)}function ea(t){if(typeof t=="string")return t;if(t instanceof Error){const e=Zw(t);if(e.stack){const n=nb(e.stack);return e.message+`
16
- `+Xp(n.slice(1))}return e.message}return Wx(t)}function Hx(t){const e=Object.values(t.properties).filter(n=>n instanceof Error).map(n=>{const r=Zw(n);return r.stack&&(r.stack=nb(r.stack).join(`
17
- `)),r});return e.length===0?null:e.length===1?e[0]:new AggregateError(e)}function Kx(t,e=!1){const n=Hx(t.record);if(n){let r=n.message;return n.stack&&(r=r+`
18
- `+Xp(n.stack.split(`
19
- `).slice(1))),e&&(r=`RED: ${Jx.red}${r}${Yx}`),{...t,message:t.message+`
20
- `+Xp(r)}}return t}const Vx={debug:"DEBUG",info:"INFO ",warning:"WARN ",error:"ERROR",fatal:"FATAL"},Xx=t=>Vx[t],Yx="\x1B[0m",Jx={red:"\x1B[31m"};function Qx(t){const e=({timestamp:n,level:r,category:i,message:s})=>`${n} ${r} ${i} ${s}`;return Cw({timestamp:"time",level:Xx,categoryStyle:"bold",categoryColor:"cyan",category:".",...t,format:n=>e(Kx(n,!0))})}function rb(t){return Pw({formatter:Qx(),...t})}const Qt=xC("likec4");function Zx(t){return Qt.getChild(t)}let ib=!1;async function sb(t){try{ib=!0;const e=t?.sinks??{};await qC({...t,sinks:{...e,console:e.console??rb()},loggers:[{category:["logtape","meta"],sinks:["console"],lowestLevel:"warning"},...t?.loggers??[{category:"likec4",sinks:["console"],lowestLevel:"debug"}]]})}catch(e){console.error(e)}}function eN(){ib||(sb(),console.warn("logger automatically configured with default settings"))}function Yp(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in t?!1:Symbol.toStringTag in t?Object.prototype.toString.call(t)==="[object Module]":!0}function Jp(t,e,n=".",r){if(!Yp(e))return Jp(t,{},n,r);const i=Object.assign({},e);for(const s in t){if(s==="__proto__"||s==="constructor")continue;const a=t[s];a!=null&&(r&&r(i,s,a,n)||(Array.isArray(a)&&Array.isArray(i[s])?i[s]=[...a,...i[s]]:Yp(a)&&Yp(i[s])?i[s]=Jp(a,i[s],(n?`${n}.`:"")+s.toString(),r):i[s]=a))}return i}function tN(t){return(...e)=>e.reduce((n,r)=>Jp(n,r,"",t),{})}const Qp=tN();function Rt(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function Gn(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function nN(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function gd(t){return typeof t=="object"&&t!==null&&Rt(t.container)&&Gn(t.reference)&&typeof t.message=="string"}class ab{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,n){return Rt(e)&&this.isSubtype(e.$type,n)}isSubtype(e,n){if(e===n)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const i=r[n];if(i!==void 0)return i;{const s=this.computeIsSubtype(e,n);return r[n]=s,s}}getAllSubTypes(e){const n=this.allSubtypes[e];if(n)return n;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function mi(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Ji(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function ob(t){return mi(t)&&typeof t.fullText=="string"}class Nt{constructor(e,n){this.startFn=e,this.nextFn=n}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let n=0,r=e.next();for(;!r.done;)n++,r=e.next();return n}toArray(){const e=[],n=this.iterator();let r;do r=n.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,n){const r=this.map(i=>[e?e(i):i,n?n(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return new Nt(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),n=>{let r;if(!n.firstDone){do if(r=this.nextFn(n.first),!r.done)return r;while(!r.done);n.firstDone=!0}do if(r=n.iterator.next(),!r.done)return r;while(!r.done);return Zt})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=rN(i.value)),s=!0;while(!i.done);return r}indexOf(e,n=0){const r=this.iterator();let i=0,s=r.next();for(;!s.done;){if(i>=n&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(!e(r.value))return!1;r=n.next()}return!0}some(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return!0;r=n.next()}return!1}forEach(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;)e(i.value,r),i=n.next(),r++}map(e){return new Nt(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?Zt:{done:!1,value:e(i)}})}filter(e){return new Nt(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return Zt})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,n){const r=this.iterator();let i=n,s=r.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=r.next();return i}reduceRight(e,n){return this.recursiveReduce(this.iterator(),e,n)}recursiveReduce(e,n,r){const i=e.next();if(i.done)return r;const s=this.recursiveReduce(e,n,r);return s===void 0?i.value:n(s,i.value)}find(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return r.value;r=n.next()}}findIndex(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;){if(e(i.value))return r;i=n.next(),r++}return-1}includes(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(r.value===e)return!0;r=n.next()}return!1}flatMap(e){return new Nt(()=>({this:this.startFn()}),n=>{do{if(n.iterator){const s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}const{done:r,value:i}=this.nextFn(n.this);if(!r){const s=e(i);if(yd(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return Zt})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new Nt(()=>({this:n.startFn()}),r=>{do{if(r.iterator){const a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}const{done:i,value:s}=n.nextFn(r.this);if(!i)if(yd(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return Zt})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new Nt(()=>{const n=this.startFn();for(let r=0;r<e;r++)if(this.nextFn(n).done)return n;return n},this.nextFn)}limit(e){return new Nt(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?Zt:this.nextFn(n.state)))}distinct(e){return new Nt(()=>({set:new Set,internalState:this.startFn()}),n=>{let r;do if(r=this.nextFn(n.internalState),!r.done){const i=e?e(r.value):r.value;if(!n.set.has(i))return n.set.add(i),r}while(!r.done);return Zt})}exclude(e,n){const r=new Set;for(const i of e){const s=n?n(i):i;r.add(s)}return this.filter(i=>{const s=n?n(i):i;return!r.has(s)})}}function rN(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function yd(t){return!!t&&typeof t[Symbol.iterator]=="function"}const ta=new Nt(()=>{},()=>Zt),Zt=Object.freeze({done:!0,value:void 0});function nt(...t){if(t.length===1){const e=t[0];if(e instanceof Nt)return e;if(yd(e))return new Nt(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new Nt(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:Zt)}return t.length>1?new Nt(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){const n=e.iterator.next();if(!n.done)return n;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<t.length){const n=t[e.collIndex++];yd(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return Zt}):ta}class na extends Nt{constructor(e,n,r){super(()=>({iterators:r?.includeRoot?[[e][Symbol.iterator]()]:[n(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){const a=i.iterators[i.iterators.length-1].next();if(a.done)i.iterators.pop();else return i.iterators.push(n(a.value)[Symbol.iterator]()),a}return Zt})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var Zp;(function(t){function e(s){return s.reduce((a,o)=>a+o,0)}t.sum=e;function n(s){return s.reduce((a,o)=>a*o,0)}t.product=n;function r(s){return s.reduce((a,o)=>Math.min(a,o))}t.min=r;function i(s){return s.reduce((a,o)=>Math.max(a,o))}t.max=i})(Zp||(Zp={}));function so(t){return new na(t,e=>mi(e)?e.content:[],{includeRoot:!0})}function cb(t){return so(t).filter(Ji)}function ub(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function vd(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function ao(t){if(!t)return;const{offset:e,end:n,range:r}=t;return{range:r,offset:e,end:n,length:n-e}}var vr;(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside",t[t.Outside=5]="Outside"})(vr||(vr={}));function lb(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<=e.start.character)return vr.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return vr.After;const n=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,r=t.end.line<e.end.line||t.end.line===e.end.line&&t.end.character<=e.end.character;return n&&r?vr.Inside:n?vr.OverlapBack:r?vr.OverlapFront:vr.Outside}function em(t,e){return lb(t,e)>vr.After}const tm=/^[\w\p{L}]$/u;function gi(t,e,n=tm){if(t){if(e>0){const r=e-t.offset,i=t.text.charAt(r);n.test(i)||e--}return rm(t,e)}}function wd(t,e){if(t){const n=fb(t,!0);if(n&&nm(n,e))return n;if(ob(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(nm(s,e))return s}}}}function nm(t,e){return Ji(t)&&e.includes(t.tokenType.name)}function rm(t,e){if(Ji(t))return t;if(mi(t)){const n=db(t,e,!1);if(n)return rm(n,e)}}function bd(t,e){if(Ji(t))return t;if(mi(t)){const n=db(t,e,!0);if(n)return bd(n,e)}}function db(t,e,n){let r=0,i=t.content.length-1,s;for(;r<=i;){const a=Math.floor((r+i)/2),o=t.content[a];if(o.offset<=e&&o.end>e)return o;o.end<=e?(s=n?o:void 0,r=a+1):i=a-1}return s}function fb(t,e=!0){for(;t.container;){const n=t.container;let r=n.content.indexOf(t);for(;r>0;){r--;const i=n.content[r];if(e||!i.hidden)return i}t=n}}function hb(t,e=!0){for(;t.container;){const n=t.container;let r=n.content.indexOf(t);const i=n.content.length-1;for(;r<i;){r++;const s=n.content[r];if(e||!s.hidden)return s}t=n}}function iN(t){if(t.range.start.character===0)return t;const e=t.range.start.line;let n=t,r;for(;t.container;){const i=t.container,s=r??i.content.indexOf(t);if(s===0?(t=i,r=void 0):(r=s-1,t=i.content[r]),t.range.start.line!==e)break;n=t}return n}function pb(t,e){const n=sN(t,e);return n?n.parent.content.slice(n.a+1,n.b):[]}function sN(t,e){const n=mb(t),r=mb(e);let i;for(let s=0;s<n.length&&s<r.length;s++){const a=n[s],o=r[s];if(a.parent===o.parent)i={parent:a.parent,a:a.index,b:o.index};else break}return i}function mb(t){const e=[];for(;t.container;){const n=t.container,r=n.content.indexOf(t);e.push({parent:n,index:r}),t=n}return e.reverse()}const aN={__proto__:null,DefaultNameRegexp:tm,get RangeComparison(){return vr},compareRange:lb,findCommentNode:wd,findDeclarationNodeAtOffset:gi,findLeafNodeAtOffset:rm,findLeafNodeBeforeOffset:bd,flattenCst:cb,getInteriorNodes:pb,getNextNode:hb,getPreviousNode:fb,getStartlineNode:iN,inRange:em,isChildNode:ub,isCommentNode:nm,streamCst:so,toDocumentSegment:ao,tokenToRange:vd};class gb extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function oo(t){throw new Error("Error! The input value was not handled.")}const Rd="AbstractRule",$d="AbstractType",im="Condition",yb="TypeDefinition",sm="ValueLiteral",co="AbstractElement";function am(t){return Ue.isInstance(t,co)}const kd="ArrayLiteral",uo="ArrayType";function oN(t){return Ue.isInstance(t,uo)}const lo="BooleanLiteral";function cN(t){return Ue.isInstance(t,lo)}const fo="Conjunction";function uN(t){return Ue.isInstance(t,fo)}const ho="Disjunction";function lN(t){return Ue.isInstance(t,ho)}const Td="Grammar",om="GrammarImport",po="InferredType";function vb(t){return Ue.isInstance(t,po)}const mo="Interface";function wb(t){return Ue.isInstance(t,mo)}const cm="NamedArgument",go="Negation";function dN(t){return Ue.isInstance(t,go)}const Ed="NumberLiteral",Sd="Parameter",yo="ParameterReference";function fN(t){return Ue.isInstance(t,yo)}const vo="ParserRule";function en(t){return Ue.isInstance(t,vo)}const wo="ReferenceType";function hN(t){return Ue.isInstance(t,wo)}const _d="ReturnType";function pN(t){return Ue.isInstance(t,_d)}const bo="SimpleType";function bb(t){return Ue.isInstance(t,bo)}const Ad="StringLiteral",ra="TerminalRule";function Lr(t){return Ue.isInstance(t,ra)}const Ro="Type";function um(t){return Ue.isInstance(t,Ro)}const lm="TypeAttribute",$o="UnionType";function mN(t){return Ue.isInstance(t,$o)}const ko="Action";function Qi(t){return Ue.isInstance(t,ko)}const To="Alternatives";function dm(t){return Ue.isInstance(t,To)}const Eo="Assignment";function wr(t){return Ue.isInstance(t,Eo)}const So="CharacterRange";function gN(t){return Ue.isInstance(t,So)}const _o="CrossReference";function Ao(t){return Ue.isInstance(t,_o)}const Co="EndOfFile";function yN(t){return Ue.isInstance(t,Co)}const Po="Group";function yi(t){return Ue.isInstance(t,Po)}const xo="Keyword";function br(t){return Ue.isInstance(t,xo)}const No="NegatedToken";function vN(t){return Ue.isInstance(t,No)}const Do="RegexToken";function wN(t){return Ue.isInstance(t,Do)}const Io="RuleCall";function Mr(t){return Ue.isInstance(t,Io)}const Oo="TerminalAlternatives";function bN(t){return Ue.isInstance(t,Oo)}const Lo="TerminalGroup";function RN(t){return Ue.isInstance(t,Lo)}const Mo="TerminalRuleCall";function Rb(t){return Ue.isInstance(t,Mo)}const zo="UnorderedGroup";function fm(t){return Ue.isInstance(t,zo)}const Fo="UntilToken";function $N(t){return Ue.isInstance(t,Fo)}const qo="Wildcard";function kN(t){return Ue.isInstance(t,qo)}class $b extends ab{getAllTypes(){return[co,Rd,$d,ko,To,kd,uo,Eo,lo,So,im,fo,_o,ho,Co,Td,om,Po,po,mo,xo,cm,No,go,Ed,Sd,yo,vo,wo,Do,_d,Io,bo,Ad,Oo,Lo,ra,Mo,Ro,lm,yb,$o,zo,Fo,sm,qo]}computeIsSubtype(e,n){switch(e){case ko:case To:case Eo:case So:case _o:case Co:case Po:case xo:case No:case Do:case Io:case Oo:case Lo:case Mo:case zo:case Fo:case qo:return this.isSubtype(co,n);case kd:case Ed:case Ad:return this.isSubtype(sm,n);case uo:case wo:case bo:case $o:return this.isSubtype(yb,n);case lo:return this.isSubtype(im,n)||this.isSubtype(sm,n);case fo:case ho:case go:case yo:return this.isSubtype(im,n);case po:case mo:case Ro:return this.isSubtype($d,n);case vo:return this.isSubtype(Rd,n)||this.isSubtype($d,n);case ra:return this.isSubtype(Rd,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return $d;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Rd;case"Grammar:usedGrammars":return Td;case"NamedArgument:parameter":case"ParameterReference:parameter":return Sd;case"TerminalRuleCall:rule":return ra;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case co:return{name:co,properties:[{name:"cardinality"},{name:"lookahead"}]};case kd:return{name:kd,properties:[{name:"elements",defaultValue:[]}]};case uo:return{name:uo,properties:[{name:"elementType"}]};case lo:return{name:lo,properties:[{name:"true",defaultValue:!1}]};case fo:return{name:fo,properties:[{name:"left"},{name:"right"}]};case ho:return{name:ho,properties:[{name:"left"},{name:"right"}]};case Td:return{name:Td,properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case om:return{name:om,properties:[{name:"path"}]};case po:return{name:po,properties:[{name:"name"}]};case mo:return{name:mo,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case cm:return{name:cm,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case go:return{name:go,properties:[{name:"value"}]};case Ed:return{name:Ed,properties:[{name:"value"}]};case Sd:return{name:Sd,properties:[{name:"name"}]};case yo:return{name:yo,properties:[{name:"parameter"}]};case vo:return{name:vo,properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case wo:return{name:wo,properties:[{name:"referenceType"}]};case _d:return{name:_d,properties:[{name:"name"}]};case bo:return{name:bo,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case Ad:return{name:Ad,properties:[{name:"value"}]};case ra:return{name:ra,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case Ro:return{name:Ro,properties:[{name:"name"},{name:"type"}]};case lm:return{name:lm,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case $o:return{name:$o,properties:[{name:"types",defaultValue:[]}]};case ko:return{name:ko,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case To:return{name:To,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Eo:return{name:Eo,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case So:return{name:So,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case _o:return{name:_o,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case Co:return{name:Co,properties:[{name:"cardinality"},{name:"lookahead"}]};case Po:return{name:Po,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case xo:return{name:xo,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case No:return{name:No,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Do:return{name:Do,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case Io:return{name:Io,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Oo:return{name:Oo,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Lo:return{name:Lo,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Mo:return{name:Mo,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case zo:return{name:zo,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Fo:return{name:Fo,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case qo:return{name:qo,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const Ue=new $b;function hm(t){for(const[e,n]of Object.entries(t))e.startsWith("$")||(Array.isArray(n)?n.forEach((r,i)=>{Rt(r)&&(r.$container=t,r.$containerProperty=e,r.$containerIndex=i)}):Rt(n)&&(n.$container=t,n.$containerProperty=e))}function tn(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function vi(t,e){let n=t;for(;n;){if(e(n))return!0;n=n.$container}return!1}function gt(t){const n=Cd(t).$document;if(!n)throw new Error("AST node has no document.");return n}function Cd(t){for(;t.$container;)t=t.$container;return t}function Go(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e?.range;return new Nt(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){const i=r.keys[r.keyIndex];if(!i.startsWith("$")){const s=t[i];if(Rt(s)){if(r.keyIndex++,pm(s,n))return{done:!1,value:s}}else if(Array.isArray(s)){for(;r.arrayIndex<s.length;){const a=r.arrayIndex++,o=s[a];if(Rt(o)&&pm(o,n))return{done:!1,value:o}}r.arrayIndex=0}}r.keyIndex++}return Zt})}function Rr(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new na(t,n=>Go(n,e))}function zr(t,e){if(t){if(e?.range&&!pm(t,e.range))return new na(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new na(t,n=>Go(n,e),{includeRoot:!0})}function pm(t,e){var n;if(!e)return!0;const r=(n=t.$cstNode)===null||n===void 0?void 0:n.range;return r?em(r,e):!1}function Pd(t){return new Nt(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){const n=e.keys[e.keyIndex];if(!n.startsWith("$")){const r=t[n];if(Gn(r))return e.keyIndex++,{done:!1,value:{reference:r,container:t,property:n}};if(Array.isArray(r)){for(;e.arrayIndex<r.length;){const i=e.arrayIndex++,s=r[i];if(Gn(s))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return Zt})}function TN(t,e=gt(t).parseResult.value){const n=[];return zr(e).forEach(r=>{Pd(r).forEach(i=>{i.reference.ref===t&&n.push(i.reference)})}),nt(n)}function mm(t,e){const n=t.getTypeMetaData(e.$type),r=e;for(const i of n.properties)i.defaultValue!==void 0&&r[i.name]===void 0&&(r[i.name]=kb(i.defaultValue))}function kb(t){return Array.isArray(t)?[...t.map(kb)]:t}function gm(t,e){const n={$type:t.$type};for(const[r,i]of Object.entries(t))if(!r.startsWith("$"))if(Rt(i))n[r]=gm(i,e);else if(Gn(i))n[r]=e(n,r,i.$refNode,i.$refText);else if(Array.isArray(i)){const s=[];for(const a of i)Rt(a)?s.push(gm(a,e)):Gn(a)?s.push(e(n,r,a.$refNode,a.$refText)):s.push(a);n[r]=s}else n[r]=i;return hm(n),n}const jo={__proto__:null,assignMandatoryProperties:mm,copyAstNode:gm,findLocalReferences:TN,findRootNode:Cd,getContainerOfType:tn,getDocument:gt,hasContainerOfType:vi,linkContentToContainer:hm,streamAllContents:Rr,streamAst:zr,streamContents:Go,streamReferences:Pd};function Se(t){return t.charCodeAt(0)}function ym(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function Bo(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function ia(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function EN(){throw Error("Internal Error - Should never get here!")}function Tb(t){return t.type==="Character"}const xd=[];for(let t=Se("0");t<=Se("9");t++)xd.push(t);const Nd=[Se("_")].concat(xd);for(let t=Se("a");t<=Se("z");t++)Nd.push(t);for(let t=Se("A");t<=Se("Z");t++)Nd.push(t);const Eb=[Se(" "),Se("\f"),Se(`
21
- `),Se("\r"),Se(" "),Se("\v"),Se(" "),Se("\xA0"),Se("\u1680"),Se("\u2000"),Se("\u2001"),Se("\u2002"),Se("\u2003"),Se("\u2004"),Se("\u2005"),Se("\u2006"),Se("\u2007"),Se("\u2008"),Se("\u2009"),Se("\u200A"),Se("\u2028"),Se("\u2029"),Se("\u202F"),Se("\u205F"),Se("\u3000"),Se("\uFEFF")],SN=/[0-9a-fA-F]/,Dd=/[0-9]/,_N=/[1-9]/;class Sb{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const n=this.disjunction();this.consumeChar("/");const r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Bo(r,"global");break;case"i":Bo(r,"ignoreCase");break;case"m":Bo(r,"multiLine");break;case"u":Bo(r,"unicode");break;case"y":Bo(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:n,loc:this.loc(0)}}disjunction(){const e=[],n=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(n)}}alternative(){const e=[],n=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(n)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break}ia(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return EN()}quantifier(e=!1){let n;const r=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),n={atLeast:i,atMost:s}):n={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&n===void 0)return;ia(n);break}if(!(e===!0&&n===void 0)&&ia(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(r),n}atom(){let e;const n=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),ia(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[Se(`
22
- `),Se("\r"),Se("\u2028"),Se("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,n=!1;switch(this.popChar()){case"d":e=xd;break;case"D":e=xd,n=!0;break;case"s":e=Eb;break;case"S":e=Eb,n=!0;break;case"w":e=Nd;break;case"W":e=Nd,n=!0;break}if(ia(e))return{type:"Set",value:e,complement:n}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=Se("\f");break;case"n":e=Se(`
23
- `);break;case"r":e=Se("\r");break;case"t":e=Se(" ");break;case"v":e=Se("\v");break}if(ia(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:Se("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:Se(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
24
- `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:Se(e)}}}characterClass(){const e=[];let n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){const r=this.classAtom();if(r.type,Tb(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,Tb(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else ym(r.value,e),e.push(Se("-")),ym(i.value,e)}else ym(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
25
- `:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:Se("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}const n=this.disjunction();this.consumeChar(")");const r={type:"Group",capturing:e,value:n};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(_N.test(e)===!1)throw Error("Expecting a positive integer");for(;Dd.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Dd.test(e)===!1)throw Error("Expecting an integer");for(;Dd.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
26
- `:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:Se(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return Dd.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
27
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}}isQuantifier(){const e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
28
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let n="";for(let i=0;i<e;i++){const s=this.popChar();if(SN.test(s)===!1)throw Error("Expecting a HexDecimal digits");n+=s}return{type:"Character",value:parseInt(n,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class Id{visitChildren(e){for(const n in e){const r=e[n];e.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const _b=/\r?\n/gm,AN=new Sb;class CN extends Id{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){const n=String.fromCharCode(e.value);if(!this.multiline&&n===`
29
- `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=Od(n);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){const n=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(n);this.multiline=!!`
30
- `.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const vm=new CN;function PN(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),vm.reset(t),vm.visit(AN.pattern(t)),vm.multiline}catch{return!1}}const xN=`\f
31
- \r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function wm(t){const e=typeof t=="string"?new RegExp(t):t;return xN.some(n=>e.test(n))}function Od(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function NN(t){return Array.prototype.map.call(t,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:Od(e)).join("")}function DN(t,e){const n=IN(t),r=e.match(n);return!!r&&r[0].length>0}function IN(t){typeof t=="string"&&(t=new RegExp(t));const e=t,n=t.source;let r=0;function i(){let s="",a;function o(u){s+=n.substr(r,u),r+=u}function c(u){s+="(?:"+n.substr(r,u)+"|$)",r+=u}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":c(3);break;case"x":c(4);break;case"u":e.unicode?n[r+2]==="{"?c(n.indexOf("}",r)-r+1):c(6):c(2);break;case"p":case"P":e.unicode?c(n.indexOf("}",r)-r+1):c(2);break;case"k":c(n.indexOf(">",r)-r+1);break;default:c(2);break}break;case"[":a=/\[(?:\\.|.)*?\]/g,a.lastIndex=r,a=a.exec(n)||[],c(a[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":a=/\{\d+,?\d*\}/g,a.lastIndex=r,a=a.exec(n),a?o(a[0].length):c(1);break;case"(":if(n[r+1]==="?")switch(n[r+2]){case":":s+="(?:",r+=3,s+=i()+"|$)";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":a=r,r+=3,i(),s+=n.substr(a,r-a);break;case"<":switch(n[r+3]){case"=":case"!":a=r,r+=4,i(),s+=n.substr(a,r-a);break;default:o(n.indexOf(">",r)-r+1),s+=i()+"|$)";break}break}else o(1),s+=i()+"|$)";break;case")":return++r,s;default:c(1);break}return s}return new RegExp(i(),t.flags)}function Ld(t){return t.rules.find(e=>en(e)&&e.entry)}function Ab(t){return t.rules.filter(e=>Lr(e)&&e.hidden)}function bm(t,e){const n=new Set,r=Ld(t);if(!r)return new Set(t.rules);const i=[r].concat(Ab(t));for(const a of i)Cb(a,n,e);const s=new Set;for(const a of t.rules)(n.has(a.name)||Lr(a)&&a.hidden)&&s.add(a);return s}function Cb(t,e,n){e.add(t.name),Rr(t).forEach(r=>{if(Mr(r)||n&&Rb(r)){const i=r.rule.ref;i&&!e.has(i.name)&&Cb(i,e,n)}})}function Rm(t){if(t.terminal)return t.terminal;if(t.type.ref){const e=Em(t.type.ref);return e?.terminal}}function Pb(t){return t.hidden&&!wm(Ho(t))}function sa(t,e){return!t||!e?[]:$m(t,e,t.astNode,!0)}function nn(t,e,n){if(!t||!e)return;const r=$m(t,e,t.astNode,!0);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function $m(t,e,n,r){if(!r){const i=tn(t.grammarSource,wr);if(i&&i.feature===e)return[t]}return mi(t)&&t.astNode===n?t.content.flatMap(i=>$m(i,e,n,!1)):[]}function km(t,e){return t?Tm(t,e,t?.astNode):[]}function Uo(t,e,n){if(!t)return;const r=Tm(t,e,t?.astNode);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function Tm(t,e,n){if(t.astNode!==n)return[];if(br(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=so(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const a=i.value;a.astNode===n?br(a.grammarSource)&&a.grammarSource.value===e&&s.push(a):r.prune()}while(!i.done);return s}function xb(t){var e;const n=t.astNode;for(;n===((e=t.container)===null||e===void 0?void 0:e.astNode);){const r=tn(t.grammarSource,wr);if(r)return r;t=t.container}}function Em(t){let e=t;return vb(e)&&(Qi(e.$container)?e=e.$container.$container:en(e.$container)?e=e.$container:oo(e.$container)),Nb(t,e,new Map)}function Nb(t,e,n){var r;function i(s,a){let o;return tn(s,wr)||(o=Nb(a,a,n)),n.set(t,o),o}if(n.has(t))return n.get(t);n.set(t,void 0);for(const s of Rr(e)){if(wr(s)&&s.feature.toLowerCase()==="name")return n.set(t,s),s;if(Mr(s)&&en(s.rule.ref))return i(s,s.rule.ref);if(bb(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function Db(t){const e=t.$container;if(yi(e)){const n=e.elements,r=n.indexOf(t);for(let i=r-1;i>=0;i--){const s=n[i];if(Qi(s))return s;{const a=Rr(n[i]).find(Qi);if(a)return a}}}if(am(e))return Db(e)}function aa(t,e){return t==="?"||t==="*"||yi(e)&&!!e.guardCondition}function Ib(t){return t==="*"||t==="+"}function ON(t){return t==="+="}function Md(t){return Ob(t,new Set)}function Ob(t,e){if(e.has(t))return!0;e.add(t);for(const n of Rr(t))if(Mr(n)){if(!n.rule.ref||en(n.rule.ref)&&!Ob(n.rule.ref,e))return!1}else{if(wr(n))return!1;if(Qi(n))return!1}return!!t.definition}function LN(t){return Sm(t.type,new Set)}function Sm(t,e){if(e.has(t))return!0;if(e.add(t),oN(t))return!1;if(hN(t))return!1;if(mN(t))return t.types.every(n=>Sm(n,e));if(bb(t)){if(t.primitiveType!==void 0)return!0;if(t.stringType!==void 0)return!0;if(t.typeRef!==void 0){const n=t.typeRef.ref;return um(n)?Sm(n.type,e):!1}else return!1}else return!1}function Zi(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){const e=t.returnType.ref;if(e){if(en(e))return e.name;if(wb(e)||um(e))return e.name}}}function Wo(t){var e;if(en(t))return Md(t)?t.name:(e=Zi(t))!==null&&e!==void 0?e:t.name;if(wb(t)||um(t)||pN(t))return t.name;if(Qi(t)){const n=Lb(t);if(n)return n}else if(vb(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function Lb(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return Wo(t.type.ref)}function MN(t){var e,n,r;return Lr(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":Md(t)?t.name:(r=Zi(t))!==null&&r!==void 0?r:t.name}function Mb(t){var e,n,r;return Lr(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":(r=Zi(t))!==null&&r!==void 0?r:t.name}function Ho(t){const e={s:!1,i:!1,u:!1},n=oa(t.definition,e),r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}const _m=/[\s\S]/.source;function oa(t,e){if(bN(t))return zN(t);if(RN(t))return FN(t);if(gN(t))return jN(t);if(Rb(t)){const n=t.rule.ref;if(!n)throw new Error("Missing rule reference.");return Fr(oa(n.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(vN(t))return GN(t);if($N(t))return qN(t);if(wN(t)){const n=t.regex.lastIndexOf("/"),r=t.regex.substring(1,n),i=t.regex.substring(n+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),Fr(r,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(kN(t))return Fr(_m,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function zN(t){return Fr(t.elements.map(e=>oa(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function FN(t){return Fr(t.elements.map(e=>oa(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function qN(t){return Fr(`${_m}*?${oa(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function GN(t){return Fr(`(?!${oa(t.terminal)})${_m}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function jN(t){return t.right?Fr(`[${Am(t.left)}-${Am(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):Fr(Am(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function Am(t){return Od(t.value)}function Fr(t,e){var n;return(e.wrap!==!1||e.lookahead)&&(t=`(${(n=e.lookahead)!==null&&n!==void 0?n:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}const zd={__proto__:null,findAssignment:xb,findNameAssignment:Em,findNodeForKeyword:Uo,findNodeForProperty:nn,findNodesForKeyword:km,findNodesForKeywordInternal:Tm,findNodesForProperty:sa,getActionAtElement:Db,getActionType:Lb,getAllReachableRules:bm,getCrossReferenceTerminal:Rm,getEntryRule:Ld,getExplicitRuleType:Zi,getHiddenRules:Ab,getRuleType:Mb,getRuleTypeName:MN,getTypeName:Wo,isArrayCardinality:Ib,isArrayOperator:ON,isCommentTerminal:Pb,isDataType:LN,isDataTypeRule:Md,isOptionalCardinality:aa,terminalRegex:Ho};function BN(t){const e=[],n=t.Grammar;for(const r of n.rules)Lr(r)&&Pb(r)&&PN(Ho(r))&&e.push(r.name);return{multilineCommentRules:e,nameRegexp:tm}}var zb=typeof global=="object"&&global&&global.Object===Object&&global,UN=typeof self=="object"&&self&&self.Object===Object&&self,$r=zb||UN||Function("return this")(),jn=$r.Symbol,Fb=Object.prototype,WN=Fb.hasOwnProperty,HN=Fb.toString,Ko=jn?jn.toStringTag:void 0;function KN(t){var e=WN.call(t,Ko),n=t[Ko];try{t[Ko]=void 0;var r=!0}catch{}var i=HN.call(t);return r&&(e?t[Ko]=n:delete t[Ko]),i}var VN=Object.prototype,XN=VN.toString;function YN(t){return XN.call(t)}var JN="[object Null]",QN="[object Undefined]",qb=jn?jn.toStringTag:void 0;function wi(t){return t==null?t===void 0?QN:JN:qb&&qb in Object(t)?KN(t):YN(t)}function tr(t){return t!=null&&typeof t=="object"}var ZN="[object Symbol]";function Vo(t){return typeof t=="symbol"||tr(t)&&wi(t)==ZN}function Fd(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var We=Array.isArray,Gb=jn?jn.prototype:void 0,jb=Gb?Gb.toString:void 0;function Bb(t){if(typeof t=="string")return t;if(We(t))return Fd(t,Bb)+"";if(Vo(t))return jb?jb.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var eD=/\s/;function tD(t){for(var e=t.length;e--&&eD.test(t.charAt(e)););return e}var nD=/^\s+/;function rD(t){return t&&t.slice(0,tD(t)+1).replace(nD,"")}function Bn(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ub=NaN,iD=/^[-+]0x[0-9a-f]+$/i,sD=/^0b[01]+$/i,aD=/^0o[0-7]+$/i,oD=parseInt;function cD(t){if(typeof t=="number")return t;if(Vo(t))return Ub;if(Bn(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Bn(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=rD(t);var n=sD.test(t);return n||aD.test(t)?oD(t.slice(2),n?2:8):iD.test(t)?Ub:+t}var uD=1/0,lD=17976931348623157e292;function dD(t){if(!t)return t===0?t:0;if(t=cD(t),t===uD||t===-1/0){var e=t<0?-1:1;return e*lD}return t===t?t:0}function qd(t){var e=dD(t),n=e%1;return e===e?n?e-n:e:0}function es(t){return t}var fD="[object AsyncFunction]",hD="[object Function]",pD="[object GeneratorFunction]",mD="[object Proxy]";function qr(t){if(!Bn(t))return!1;var e=wi(t);return e==hD||e==pD||e==fD||e==mD}var Cm=$r["__core-js_shared__"],Wb=function(){var t=/[^.]+$/.exec(Cm&&Cm.keys&&Cm.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function gD(t){return!!Wb&&Wb in t}var yD=Function.prototype,vD=yD.toString;function ts(t){if(t!=null){try{return vD.call(t)}catch{}try{return t+""}catch{}}return""}var wD=/[\\^$.*+?()[\]{}|]/g,bD=/^\[object .+?Constructor\]$/,RD=Function.prototype,$D=Object.prototype,kD=RD.toString,TD=$D.hasOwnProperty,ED=RegExp("^"+kD.call(TD).replace(wD,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function SD(t){if(!Bn(t)||gD(t))return!1;var e=qr(t)?ED:bD;return e.test(ts(t))}function _D(t,e){return t?.[e]}function ns(t,e){var n=_D(t,e);return SD(n)?n:void 0}var Pm=ns($r,"WeakMap"),Hb=Object.create,AD=function(){function t(){}return function(e){if(!Bn(e))return{};if(Hb)return Hb(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function CD(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function It(){}function PD(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var xD=800,ND=16,DD=Date.now;function ID(t){var e=0,n=0;return function(){var r=DD(),i=ND-(r-n);if(n=r,i>0){if(++e>=xD)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function OD(t){return function(){return t}}var Gd=function(){try{var t=ns(Object,"defineProperty");return t({},"",{}),t}catch{}}(),LD=Gd?function(t,e){return Gd(t,"toString",{configurable:!0,enumerable:!1,value:OD(e),writable:!0})}:es,MD=ID(LD);function Kb(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function Vb(t,e,n,r){for(var i=t.length,s=n+-1;++s<i;)if(e(t[s],s,t))return s;return-1}function zD(t){return t!==t}function FD(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function xm(t,e,n){return e===e?FD(t,e,n):Vb(t,zD,n)}function Xb(t,e){var n=t==null?0:t.length;return!!n&&xm(t,e,0)>-1}var qD=9007199254740991,GD=/^(?:0|[1-9]\d*)$/;function jd(t,e){var n=typeof t;return e=e??qD,!!e&&(n=="number"||n!="symbol"&&GD.test(t))&&t>-1&&t%1==0&&t<e}function Nm(t,e,n){e=="__proto__"&&Gd?Gd(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Xo(t,e){return t===e||t!==t&&e!==e}var jD=Object.prototype,BD=jD.hasOwnProperty;function Bd(t,e,n){var r=t[e];(!(BD.call(t,e)&&Xo(r,n))||n===void 0&&!(e in t))&&Nm(t,e,n)}function Yo(t,e,n,r){var i=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var o=e[s],c=void 0;c===void 0&&(c=t[o]),i?Nm(n,o,c):Bd(n,o,c)}return n}var Yb=Math.max;function UD(t,e,n){return e=Yb(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=Yb(r.length-e,0),a=Array(s);++i<s;)a[i]=r[e+i];i=-1;for(var o=Array(e+1);++i<e;)o[i]=r[i];return o[e]=n(a),CD(t,this,o)}}function Dm(t,e){return MD(UD(t,e,es),t+"")}var WD=9007199254740991;function Im(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=WD}function kr(t){return t!=null&&Im(t.length)&&!qr(t)}function Jb(t,e,n){if(!Bn(n))return!1;var r=typeof e;return(r=="number"?kr(n)&&jd(e,n.length):r=="string"&&e in n)?Xo(n[e],t):!1}function HD(t){return Dm(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,a&&Jb(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var o=n[r];o&&t(e,o,r,s)}return e})}var KD=Object.prototype;function Jo(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||KD;return t===n}function VD(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var XD="[object Arguments]";function Qb(t){return tr(t)&&wi(t)==XD}var Zb=Object.prototype,YD=Zb.hasOwnProperty,JD=Zb.propertyIsEnumerable,Ud=Qb(function(){return arguments}())?Qb:function(t){return tr(t)&&YD.call(t,"callee")&&!JD.call(t,"callee")};function QD(){return!1}var eR=typeof exports=="object"&&exports&&!exports.nodeType&&exports,tR=eR&&typeof module=="object"&&module&&!module.nodeType&&module,ZD=tR&&tR.exports===eR,nR=ZD?$r.Buffer:void 0,eI=nR?nR.isBuffer:void 0,Qo=eI||QD,tI="[object Arguments]",nI="[object Array]",rI="[object Boolean]",iI="[object Date]",sI="[object Error]",aI="[object Function]",oI="[object Map]",cI="[object Number]",uI="[object Object]",lI="[object RegExp]",dI="[object Set]",fI="[object String]",hI="[object WeakMap]",pI="[object ArrayBuffer]",mI="[object DataView]",gI="[object Float32Array]",yI="[object Float64Array]",vI="[object Int8Array]",wI="[object Int16Array]",bI="[object Int32Array]",RI="[object Uint8Array]",$I="[object Uint8ClampedArray]",kI="[object Uint16Array]",TI="[object Uint32Array]",pt={};pt[gI]=pt[yI]=pt[vI]=pt[wI]=pt[bI]=pt[RI]=pt[$I]=pt[kI]=pt[TI]=!0,pt[tI]=pt[nI]=pt[pI]=pt[rI]=pt[mI]=pt[iI]=pt[sI]=pt[aI]=pt[oI]=pt[cI]=pt[uI]=pt[lI]=pt[dI]=pt[fI]=pt[hI]=!1;function EI(t){return tr(t)&&Im(t.length)&&!!pt[wi(t)]}function Wd(t){return function(e){return t(e)}}var rR=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zo=rR&&typeof module=="object"&&module&&!module.nodeType&&module,SI=Zo&&Zo.exports===rR,Om=SI&&zb.process,bi=function(){try{var t=Zo&&Zo.require&&Zo.require("util").types;return t||Om&&Om.binding&&Om.binding("util")}catch{}}(),iR=bi&&bi.isTypedArray,Lm=iR?Wd(iR):EI,_I=Object.prototype,AI=_I.hasOwnProperty;function sR(t,e){var n=We(t),r=!n&&Ud(t),i=!n&&!r&&Qo(t),s=!n&&!r&&!i&&Lm(t),a=n||r||i||s,o=a?VD(t.length,String):[],c=o.length;for(var u in t)(e||AI.call(t,u))&&!(a&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||jd(u,c)))&&o.push(u);return o}function aR(t,e){return function(n){return t(e(n))}}var CI=aR(Object.keys,Object),PI=Object.prototype,xI=PI.hasOwnProperty;function oR(t){if(!Jo(t))return CI(t);var e=[];for(var n in Object(t))xI.call(t,n)&&n!="constructor"&&e.push(n);return e}function Un(t){return kr(t)?sR(t):oR(t)}var NI=Object.prototype,DI=NI.hasOwnProperty,An=HD(function(t,e){if(Jo(e)||kr(e)){Yo(e,Un(e),t);return}for(var n in e)DI.call(e,n)&&Bd(t,n,e[n])});function II(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var OI=Object.prototype,LI=OI.hasOwnProperty;function MI(t){if(!Bn(t))return II(t);var e=Jo(t),n=[];for(var r in t)r=="constructor"&&(e||!LI.call(t,r))||n.push(r);return n}function Mm(t){return kr(t)?sR(t,!0):MI(t)}var zI=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,FI=/^\w*$/;function zm(t,e){if(We(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Vo(t)?!0:FI.test(t)||!zI.test(t)||e!=null&&t in Object(e)}var ec=ns(Object,"create");function qI(){this.__data__=ec?ec(null):{},this.size=0}function GI(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var jI="__lodash_hash_undefined__",BI=Object.prototype,UI=BI.hasOwnProperty;function WI(t){var e=this.__data__;if(ec){var n=e[t];return n===jI?void 0:n}return UI.call(e,t)?e[t]:void 0}var HI=Object.prototype,KI=HI.hasOwnProperty;function VI(t){var e=this.__data__;return ec?e[t]!==void 0:KI.call(e,t)}var XI="__lodash_hash_undefined__";function YI(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ec&&e===void 0?XI:e,this}function rs(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}rs.prototype.clear=qI,rs.prototype.delete=GI,rs.prototype.get=WI,rs.prototype.has=VI,rs.prototype.set=YI;function JI(){this.__data__=[],this.size=0}function Hd(t,e){for(var n=t.length;n--;)if(Xo(t[n][0],e))return n;return-1}var QI=Array.prototype,ZI=QI.splice;function eO(t){var e=this.__data__,n=Hd(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():ZI.call(e,n,1),--this.size,!0}function tO(t){var e=this.__data__,n=Hd(e,t);return n<0?void 0:e[n][1]}function nO(t){return Hd(this.__data__,t)>-1}function rO(t,e){var n=this.__data__,r=Hd(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function Gr(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Gr.prototype.clear=JI,Gr.prototype.delete=eO,Gr.prototype.get=tO,Gr.prototype.has=nO,Gr.prototype.set=rO;var tc=ns($r,"Map");function iO(){this.size=0,this.__data__={hash:new rs,map:new(tc||Gr),string:new rs}}function sO(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Kd(t,e){var n=t.__data__;return sO(e)?n[typeof e=="string"?"string":"hash"]:n.map}function aO(t){var e=Kd(this,t).delete(t);return this.size-=e?1:0,e}function oO(t){return Kd(this,t).get(t)}function cO(t){return Kd(this,t).has(t)}function uO(t,e){var n=Kd(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function jr(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}jr.prototype.clear=iO,jr.prototype.delete=aO,jr.prototype.get=oO,jr.prototype.has=cO,jr.prototype.set=uO;var lO="Expected a function";function Fm(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(lO);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var a=t.apply(this,r);return n.cache=s.set(i,a)||s,a};return n.cache=new(Fm.Cache||jr),n}Fm.Cache=jr;var dO=500;function fO(t){var e=Fm(t,function(r){return n.size===dO&&n.clear(),r}),n=e.cache;return e}var hO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pO=/\\(\\)?/g,mO=fO(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(hO,function(n,r,i,s){e.push(i?s.replace(pO,"$1"):r||n)}),e});function gO(t){return t==null?"":Bb(t)}function Vd(t,e){return We(t)?t:zm(t,e)?[t]:mO(gO(t))}function nc(t){if(typeof t=="string"||Vo(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function qm(t,e){e=Vd(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[nc(e[n++])];return n&&n==r?t:void 0}function yO(t,e,n){var r=t==null?void 0:qm(t,e);return r===void 0?n:r}function Gm(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var cR=jn?jn.isConcatSpreadable:void 0;function vO(t){return We(t)||Ud(t)||!!(cR&&t&&t[cR])}function jm(t,e,n,r,i){var s=-1,a=t.length;for(n||(n=vO),i||(i=[]);++s<a;){var o=t[s];n(o)?Gm(i,o):r||(i[i.length]=o)}return i}function Wn(t){var e=t==null?0:t.length;return e?jm(t):[]}var uR=aR(Object.getPrototypeOf,Object);function lR(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}function wO(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}function bO(){this.__data__=new Gr,this.size=0}function RO(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function $O(t){return this.__data__.get(t)}function kO(t){return this.__data__.has(t)}var TO=200;function EO(t,e){var n=this.__data__;if(n instanceof Gr){var r=n.__data__;if(!tc||r.length<TO-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new jr(r)}return n.set(t,e),this.size=n.size,this}function Tr(t){var e=this.__data__=new Gr(t);this.size=e.size}Tr.prototype.clear=bO,Tr.prototype.delete=RO,Tr.prototype.get=$O,Tr.prototype.has=kO,Tr.prototype.set=EO;function SO(t,e){return t&&Yo(e,Un(e),t)}function _O(t,e){return t&&Yo(e,Mm(e),t)}var dR=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fR=dR&&typeof module=="object"&&module&&!module.nodeType&&module,AO=fR&&fR.exports===dR,hR=AO?$r.Buffer:void 0,pR=hR?hR.allocUnsafe:void 0;function CO(t,e){var n=t.length,r=pR?pR(n):new t.constructor(n);return t.copy(r),r}function Bm(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var a=t[n];e(a,n,t)&&(s[i++]=a)}return s}function mR(){return[]}var PO=Object.prototype,xO=PO.propertyIsEnumerable,gR=Object.getOwnPropertySymbols,Um=gR?function(t){return t==null?[]:(t=Object(t),Bm(gR(t),function(e){return xO.call(t,e)}))}:mR;function NO(t,e){return Yo(t,Um(t),e)}var DO=Object.getOwnPropertySymbols,yR=DO?function(t){for(var e=[];t;)Gm(e,Um(t)),t=uR(t);return e}:mR;function IO(t,e){return Yo(t,yR(t),e)}function vR(t,e,n){var r=e(t);return We(t)?r:Gm(r,n(t))}function Wm(t){return vR(t,Un,Um)}function OO(t){return vR(t,Mm,yR)}var Hm=ns($r,"DataView"),Km=ns($r,"Promise"),ca=ns($r,"Set"),wR="[object Map]",LO="[object Object]",bR="[object Promise]",RR="[object Set]",$R="[object WeakMap]",kR="[object DataView]",MO=ts(Hm),zO=ts(tc),FO=ts(Km),qO=ts(ca),GO=ts(Pm),Hn=wi;(Hm&&Hn(new Hm(new ArrayBuffer(1)))!=kR||tc&&Hn(new tc)!=wR||Km&&Hn(Km.resolve())!=bR||ca&&Hn(new ca)!=RR||Pm&&Hn(new Pm)!=$R)&&(Hn=function(t){var e=wi(t),n=e==LO?t.constructor:void 0,r=n?ts(n):"";if(r)switch(r){case MO:return kR;case zO:return wR;case FO:return bR;case qO:return RR;case GO:return $R}return e});var jO=Object.prototype,BO=jO.hasOwnProperty;function UO(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&BO.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Xd=$r.Uint8Array;function WO(t){var e=new t.constructor(t.byteLength);return new Xd(e).set(new Xd(t)),e}function HO(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var KO=/\w*$/;function VO(t){var e=new t.constructor(t.source,KO.exec(t));return e.lastIndex=t.lastIndex,e}var TR=jn?jn.prototype:void 0,ER=TR?TR.valueOf:void 0;function XO(t){return ER?Object(ER.call(t)):{}}function YO(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var JO="[object Boolean]",QO="[object Date]",ZO="[object Map]",e1="[object Number]",t1="[object RegExp]",n1="[object Set]",r1="[object String]",i1="[object Symbol]",s1="[object ArrayBuffer]",a1="[object DataView]",o1="[object Float32Array]",c1="[object Float64Array]",u1="[object Int8Array]",l1="[object Int16Array]",d1="[object Int32Array]",f1="[object Uint8Array]",h1="[object Uint8ClampedArray]",p1="[object Uint16Array]",m1="[object Uint32Array]";function g1(t,e,n){var r=t.constructor;switch(e){case s1:return WO(t);case JO:case QO:return new r(+t);case a1:return HO(t);case o1:case c1:case u1:case l1:case d1:case f1:case h1:case p1:case m1:return YO(t);case ZO:return new r;case e1:case r1:return new r(t);case t1:return VO(t);case n1:return new r;case i1:return XO(t)}}function y1(t){return typeof t.constructor=="function"&&!Jo(t)?AD(uR(t)):{}}var v1="[object Map]";function w1(t){return tr(t)&&Hn(t)==v1}var SR=bi&&bi.isMap,b1=SR?Wd(SR):w1,R1="[object Set]";function $1(t){return tr(t)&&Hn(t)==R1}var _R=bi&&bi.isSet,k1=_R?Wd(_R):$1,T1=2,AR="[object Arguments]",E1="[object Array]",S1="[object Boolean]",_1="[object Date]",A1="[object Error]",CR="[object Function]",C1="[object GeneratorFunction]",P1="[object Map]",x1="[object Number]",PR="[object Object]",N1="[object RegExp]",D1="[object Set]",I1="[object String]",O1="[object Symbol]",L1="[object WeakMap]",M1="[object ArrayBuffer]",z1="[object DataView]",F1="[object Float32Array]",q1="[object Float64Array]",G1="[object Int8Array]",j1="[object Int16Array]",B1="[object Int32Array]",U1="[object Uint8Array]",W1="[object Uint8ClampedArray]",H1="[object Uint16Array]",K1="[object Uint32Array]",ut={};ut[AR]=ut[E1]=ut[M1]=ut[z1]=ut[S1]=ut[_1]=ut[F1]=ut[q1]=ut[G1]=ut[j1]=ut[B1]=ut[P1]=ut[x1]=ut[PR]=ut[N1]=ut[D1]=ut[I1]=ut[O1]=ut[U1]=ut[W1]=ut[H1]=ut[K1]=!0,ut[A1]=ut[CR]=ut[L1]=!1;function Yd(t,e,n,r,i,s){var a,o=e&T1;if(a!==void 0)return a;if(!Bn(t))return t;var c=We(t);if(c)return a=UO(t),PD(t,a);var u=Hn(t),l=u==CR||u==C1;if(Qo(t))return CO(t);if(u==PR||u==AR||l&&!i)return a=l?{}:y1(t),o?IO(t,_O(a,t)):NO(t,SO(a,t));if(!ut[u])return i?t:{};a=g1(t,u),s||(s=new Tr);var d=s.get(t);if(d)return d;s.set(t,a),k1(t)?t.forEach(function(m){a.add(Yd(m,e,n,m,t,s))}):b1(t)&&t.forEach(function(m,y){a.set(y,Yd(m,e,n,y,t,s))});var f=Wm,h=c?void 0:f(t);return Kb(h||t,function(m,y){h&&(y=m,m=t[y]),Bd(a,y,Yd(m,e,n,y,t,s))}),a}var V1=4;function Ut(t){return Yd(t,V1)}function rc(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var s=t[e];s&&(i[r++]=s)}return i}var X1="__lodash_hash_undefined__";function Y1(t){return this.__data__.set(t,X1),this}function J1(t){return this.__data__.has(t)}function ua(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new jr;++e<n;)this.add(t[e])}ua.prototype.add=ua.prototype.push=Y1,ua.prototype.has=J1;function xR(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function Vm(t,e){return t.has(e)}var Q1=1,Z1=2;function NR(t,e,n,r,i,s){var a=n&Q1,o=t.length,c=e.length;if(o!=c&&!(a&&c>o))return!1;var u=s.get(t),l=s.get(e);if(u&&l)return u==e&&l==t;var d=-1,f=!0,h=n&Z1?new ua:void 0;for(s.set(t,e),s.set(e,t);++d<o;){var m=t[d],y=e[d];if(r)var R=a?r(y,m,d,e,t,s):r(m,y,d,t,e,s);if(R!==void 0){if(R)continue;f=!1;break}if(h){if(!xR(e,function(w,k){if(!Vm(h,k)&&(m===w||i(m,w,n,r,s)))return h.push(k)})){f=!1;break}}else if(!(m===y||i(m,y,n,r,s))){f=!1;break}}return s.delete(t),s.delete(e),f}function eL(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function Xm(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var tL=1,nL=2,rL="[object Boolean]",iL="[object Date]",sL="[object Error]",aL="[object Map]",oL="[object Number]",cL="[object RegExp]",uL="[object Set]",lL="[object String]",dL="[object Symbol]",fL="[object ArrayBuffer]",hL="[object DataView]",DR=jn?jn.prototype:void 0,Ym=DR?DR.valueOf:void 0;function pL(t,e,n,r,i,s,a){switch(n){case hL:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case fL:return!(t.byteLength!=e.byteLength||!s(new Xd(t),new Xd(e)));case rL:case iL:case oL:return Xo(+t,+e);case sL:return t.name==e.name&&t.message==e.message;case cL:case lL:return t==e+"";case aL:var o=eL;case uL:var c=r&tL;if(o||(o=Xm),t.size!=e.size&&!c)return!1;var u=a.get(t);if(u)return u==e;r|=nL,a.set(t,e);var l=NR(o(t),o(e),r,i,s,a);return a.delete(t),l;case dL:if(Ym)return Ym.call(t)==Ym.call(e)}return!1}var mL=1,gL=Object.prototype,yL=gL.hasOwnProperty;function vL(t,e,n,r,i,s){var a=n&mL,o=Wm(t),c=o.length,u=Wm(e),l=u.length;if(c!=l&&!a)return!1;for(var d=c;d--;){var f=o[d];if(!(a?f in e:yL.call(e,f)))return!1}var h=s.get(t),m=s.get(e);if(h&&m)return h==e&&m==t;var y=!0;s.set(t,e),s.set(e,t);for(var R=a;++d<c;){f=o[d];var w=t[f],k=e[f];if(r)var E=a?r(k,w,f,e,t,s):r(w,k,f,t,e,s);if(!(E===void 0?w===k||i(w,k,n,r,s):E)){y=!1;break}R||(R=f=="constructor")}if(y&&!R){var _=t.constructor,C=e.constructor;_!=C&&"constructor"in t&&"constructor"in e&&!(typeof _=="function"&&_ instanceof _&&typeof C=="function"&&C instanceof C)&&(y=!1)}return s.delete(t),s.delete(e),y}var wL=1,IR="[object Arguments]",OR="[object Array]",Jd="[object Object]",bL=Object.prototype,LR=bL.hasOwnProperty;function RL(t,e,n,r,i,s){var a=We(t),o=We(e),c=a?OR:Hn(t),u=o?OR:Hn(e);c=c==IR?Jd:c,u=u==IR?Jd:u;var l=c==Jd,d=u==Jd,f=c==u;if(f&&Qo(t)){if(!Qo(e))return!1;a=!0,l=!1}if(f&&!l)return s||(s=new Tr),a||Lm(t)?NR(t,e,n,r,i,s):pL(t,e,c,n,r,i,s);if(!(n&wL)){var h=l&&LR.call(t,"__wrapped__"),m=d&&LR.call(e,"__wrapped__");if(h||m){var y=h?t.value():t,R=m?e.value():e;return s||(s=new Tr),i(y,R,n,r,s)}}return f?(s||(s=new Tr),vL(t,e,n,r,i,s)):!1}function Jm(t,e,n,r,i){return t===e?!0:t==null||e==null||!tr(t)&&!tr(e)?t!==t&&e!==e:RL(t,e,n,r,Jm,i)}var $L=1,kL=2;function TL(t,e,n,r){var i=n.length,s=i;if(t==null)return!s;for(t=Object(t);i--;){var a=n[i];if(a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=n[i];var o=a[0],c=t[o],u=a[1];if(a[2]){if(c===void 0&&!(o in t))return!1}else{var l=new Tr,d;if(!(d===void 0?Jm(u,c,$L|kL,r,l):d))return!1}}return!0}function MR(t){return t===t&&!Bn(t)}function EL(t){for(var e=Un(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,MR(i)]}return e}function zR(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function SL(t){var e=EL(t);return e.length==1&&e[0][2]?zR(e[0][0],e[0][1]):function(n){return n===t||TL(n,t,e)}}function _L(t,e){return t!=null&&e in Object(t)}function FR(t,e,n){e=Vd(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var a=nc(e[r]);if(!(s=t!=null&&n(t,a)))break;t=t[a]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&Im(i)&&jd(a,i)&&(We(t)||Ud(t)))}function AL(t,e){return t!=null&&FR(t,e,_L)}var CL=1,PL=2;function xL(t,e){return zm(t)&&MR(e)?zR(nc(t),e):function(n){var r=yO(n,t);return r===void 0&&r===e?AL(n,t):Jm(e,r,CL|PL)}}function NL(t){return function(e){return e?.[t]}}function DL(t){return function(e){return qm(e,t)}}function IL(t){return zm(t)?NL(nc(t)):DL(t)}function nr(t){return typeof t=="function"?t:t==null?es:typeof t=="object"?We(t)?xL(t[0],t[1]):SL(t):IL(t)}function OL(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++i<s;){var a=t[i];e(r,a,n(a),t)}return r}function LL(t){return function(e,n,r){for(var i=-1,s=Object(e),a=r(e),o=a.length;o--;){var c=a[++i];if(n(s[c],c,s)===!1)break}return e}}var ML=LL();function zL(t,e){return t&&ML(t,e,Un)}function FL(t,e){return function(n,r){if(n==null)return n;if(!kr(n))return t(n,r);for(var i=n.length,s=-1,a=Object(n);++s<i&&r(a[s],s,a)!==!1;);return n}}var is=FL(zL);function qL(t,e,n,r){return is(t,function(i,s,a){e(r,i,n(i),a)}),r}function GL(t,e){return function(n,r){var i=We(n)?OL:qL,s=e?e():{};return i(n,t,nr(r),s)}}var qR=Object.prototype,jL=qR.hasOwnProperty,Qm=Dm(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&Jb(e[0],e[1],i)&&(r=1);++n<r;)for(var s=e[n],a=Mm(s),o=-1,c=a.length;++o<c;){var u=a[o],l=t[u];(l===void 0||Xo(l,qR[u])&&!jL.call(t,u))&&(t[u]=s[u])}return t});function GR(t){return tr(t)&&kr(t)}var BL=200;function UL(t,e,n,r){var i=-1,s=Xb,a=!0,o=t.length,c=[],u=e.length;if(!o)return c;e.length>=BL&&(s=Vm,a=!1,e=new ua(e));e:for(;++i<o;){var l=t[i],d=l;if(l=l!==0?l:0,a&&d===d){for(var f=u;f--;)if(e[f]===d)continue e;c.push(l)}else s(e,d,r)||c.push(l)}return c}var Qd=Dm(function(t,e){return GR(t)?UL(t,jm(e,1,GR,!0)):[]});function la(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function Wt(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:qd(e),lR(t,e<0?0:e,r)):[]}function ic(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:qd(e),e=r-e,lR(t,0,e<0?0:e)):[]}function WL(t){return typeof t=="function"?t:es}function ke(t,e){var n=We(t)?Kb:is;return n(t,WL(e))}function HL(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function KL(t,e){var n=!0;return is(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function rr(t,e,n){var r=We(t)?HL:KL;return r(t,nr(e))}function jR(t,e){var n=[];return is(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}function Cn(t,e){var n=We(t)?Bm:jR;return n(t,nr(e))}function VL(t){return function(e,n,r){var i=Object(e);if(!kr(e)){var s=nr(n);e=Un(e),n=function(o){return s(i[o],o,i)}}var a=t(e,n,r);return a>-1?i[s?e[a]:a]:void 0}}var XL=Math.max;function YL(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:qd(n);return i<0&&(i=XL(r+i,0)),Vb(t,nr(e),i)}var da=VL(YL);function ir(t){return t&&t.length?t[0]:void 0}function JL(t,e){var n=-1,r=kr(t)?Array(t.length):[];return is(t,function(i,s,a){r[++n]=e(i,s,a)}),r}function pe(t,e){var n=We(t)?Fd:JL;return n(t,nr(e))}function Pn(t,e){return jm(pe(t,e))}var QL=Object.prototype,ZL=QL.hasOwnProperty,eM=GL(function(t,e,n){ZL.call(t,n)?t[n].push(e):Nm(t,n,[e])}),tM=Object.prototype,nM=tM.hasOwnProperty;function rM(t,e){return t!=null&&nM.call(t,e)}function Te(t,e){return t!=null&&FR(t,e,rM)}var iM="[object String]";function Rn(t){return typeof t=="string"||!We(t)&&tr(t)&&wi(t)==iM}function sM(t,e){return Fd(e,function(n){return t[n]})}function Ot(t){return t==null?[]:sM(t,Un(t))}var aM=Math.max;function dn(t,e,n,r){t=kr(t)?t:Ot(t),n=n?qd(n):0;var i=t.length;return n<0&&(n=aM(i+n,0)),Rn(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&xm(t,e,n)>-1}function BR(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return xm(t,e,i)}var oM="[object Map]",cM="[object Set]",uM=Object.prototype,lM=uM.hasOwnProperty;function at(t){if(t==null)return!0;if(kr(t)&&(We(t)||typeof t=="string"||typeof t.splice=="function"||Qo(t)||Lm(t)||Ud(t)))return!t.length;var e=Hn(t);if(e==oM||e==cM)return!t.size;if(Jo(t))return!oR(t).length;for(var n in t)if(lM.call(t,n))return!1;return!0}var dM="[object RegExp]";function fM(t){return tr(t)&&wi(t)==dM}var UR=bi&&bi.isRegExp,Br=UR?Wd(UR):fM;function Ur(t){return t===void 0}function hM(t,e){return t<e}function pM(t,e,n){for(var r=-1,i=t.length;++r<i;){var s=t[r],a=e(s);if(a!=null&&(o===void 0?a===a&&!Vo(a):n(a,o)))var o=a,c=s}return c}function mM(t){return t&&t.length?pM(t,es,hM):void 0}var gM="Expected a function";function yM(t){if(typeof t!="function")throw new TypeError(gM);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function vM(t,e,n,r){if(!Bn(t))return t;e=Vd(e,t);for(var i=-1,s=e.length,a=s-1,o=t;o!=null&&++i<s;){var c=nc(e[i]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=a){var l=o[c];u=void 0,u===void 0&&(u=Bn(l)?l:jd(e[i+1])?[]:{})}Bd(o,c,u),o=o[c]}return t}function wM(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var a=e[r],o=qm(t,a);n(o,a)&&vM(s,Vd(a,t),o)}return s}function sr(t,e){if(t==null)return{};var n=Fd(OO(t),function(r){return[r]});return e=nr(e),wM(t,n,function(r,i){return e(r,i[0])})}function bM(t,e,n,r,i){return i(t,function(s,a,o){n=r?(r=!1,s):e(n,s,a,o)}),n}function fn(t,e,n){var r=We(t)?wO:bM,i=arguments.length<3;return r(t,nr(e),n,i,is)}function Zd(t,e){var n=We(t)?Bm:jR;return n(t,yM(nr(e)))}function RM(t,e){var n;return is(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function WR(t,e,n){var r=We(t)?xR:RM;return r(t,nr(e))}var $M=1/0,kM=ca&&1/Xm(new ca([,-0]))[1]==$M?function(t){return new ca(t)}:It,TM=200;function HR(t,e,n){var r=-1,i=Xb,s=t.length,a=!0,o=[],c=o;if(s>=TM){var u=e?null:kM(t);if(u)return Xm(u);a=!1,i=Vm,c=new ua}else c=e?[]:o;e:for(;++r<s;){var l=t[r],d=e?e(l):l;if(l=l!==0?l:0,a&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue e;e&&c.push(d),o.push(l)}else i(c,d,n)||(c!==o&&c.push(d),o.push(l))}return o}function Zm(t){return t&&t.length?HR(t):[]}function EM(t,e){return t&&t.length?HR(t,nr(e)):[]}function eg(t){console&&console.error&&console.error(`Error: ${t}`)}function KR(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function VR(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function XR(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),t}function SM(t){return _M(t)?t.LABEL:t.name}function _M(t){return Rn(t.LABEL)&&t.LABEL!==""}class Er{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),ke(this.definition,n=>{n.accept(e)})}}class hn extends Er{constructor(e){super([]),this.idx=1,An(this,sr(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class fa extends Er{constructor(e){super(e.definition),this.orgText="",An(this,sr(e,n=>n!==void 0))}}class $n extends Er{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,An(this,sr(e,n=>n!==void 0))}}class Ht extends Er{constructor(e){super(e.definition),this.idx=1,An(this,sr(e,n=>n!==void 0))}}class xn extends Er{constructor(e){super(e.definition),this.idx=1,An(this,sr(e,n=>n!==void 0))}}class Nn extends Er{constructor(e){super(e.definition),this.idx=1,An(this,sr(e,n=>n!==void 0))}}class $t extends Er{constructor(e){super(e.definition),this.idx=1,An(this,sr(e,n=>n!==void 0))}}class kn extends Er{constructor(e){super(e.definition),this.idx=1,An(this,sr(e,n=>n!==void 0))}}class Tn extends Er{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,An(this,sr(e,n=>n!==void 0))}}class mt{constructor(e){this.idx=1,An(this,sr(e,n=>n!==void 0))}accept(e){e.visit(this)}}function AM(t){return pe(t,ef)}function ef(t){function e(n){return pe(n,ef)}if(t instanceof hn){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return Rn(t.label)&&(n.label=t.label),n}else{if(t instanceof $n)return{type:"Alternative",definition:e(t.definition)};if(t instanceof Ht)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof xn)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof Nn)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:ef(new mt({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof kn)return{type:"RepetitionWithSeparator",idx:t.idx,separator:ef(new mt({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof $t)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof Tn)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof mt){const n={type:"Terminal",name:t.terminalType.name,label:SM(t.terminalType),idx:t.idx};Rn(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=Br(r)?r.source:r),n}else{if(t instanceof fa)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class ha{visit(e){const n=e;switch(n.constructor){case hn:return this.visitNonTerminal(n);case $n:return this.visitAlternative(n);case Ht:return this.visitOption(n);case xn:return this.visitRepetitionMandatory(n);case Nn:return this.visitRepetitionMandatoryWithSeparator(n);case kn:return this.visitRepetitionWithSeparator(n);case $t:return this.visitRepetition(n);case Tn:return this.visitAlternation(n);case mt:return this.visitTerminal(n);case fa:return this.visitRule(n);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function CM(t){return t instanceof $n||t instanceof Ht||t instanceof $t||t instanceof xn||t instanceof Nn||t instanceof kn||t instanceof mt||t instanceof fa}function tf(t,e=[]){return t instanceof Ht||t instanceof $t||t instanceof kn?!0:t instanceof Tn?WR(t.definition,r=>tf(r,e)):t instanceof hn&&dn(e,t)?!1:t instanceof Er?(t instanceof hn&&e.push(t),rr(t.definition,r=>tf(r,e))):!1}function PM(t){return t instanceof Tn}function Sr(t){if(t instanceof hn)return"SUBRULE";if(t instanceof Ht)return"OPTION";if(t instanceof Tn)return"OR";if(t instanceof xn)return"AT_LEAST_ONE";if(t instanceof Nn)return"AT_LEAST_ONE_SEP";if(t instanceof kn)return"MANY_SEP";if(t instanceof $t)return"MANY";if(t instanceof mt)return"CONSUME";throw Error("non exhaustive match")}class nf{walk(e,n=[]){ke(e.definition,(r,i)=>{const s=Wt(e.definition,i+1);if(r instanceof hn)this.walkProdRef(r,s,n);else if(r instanceof mt)this.walkTerminal(r,s,n);else if(r instanceof $n)this.walkFlat(r,s,n);else if(r instanceof Ht)this.walkOption(r,s,n);else if(r instanceof xn)this.walkAtLeastOne(r,s,n);else if(r instanceof Nn)this.walkAtLeastOneSep(r,s,n);else if(r instanceof kn)this.walkManySep(r,s,n);else if(r instanceof $t)this.walkMany(r,s,n);else if(r instanceof Tn)this.walkOr(r,s,n);else throw Error("non exhaustive match")})}walkTerminal(e,n,r){}walkProdRef(e,n,r){}walkFlat(e,n,r){const i=n.concat(r);this.walk(e,i)}walkOption(e,n,r){const i=n.concat(r);this.walk(e,i)}walkAtLeastOne(e,n,r){const i=[new Ht({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=YR(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new Ht({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=YR(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);ke(e.definition,s=>{const a=new $n({definition:[s]});this.walk(a,i)})}}function YR(t,e,n){return[new Ht({definition:[new mt({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function sc(t){if(t instanceof hn)return sc(t.referencedRule);if(t instanceof mt)return DM(t);if(CM(t))return xM(t);if(PM(t))return NM(t);throw Error("non exhaustive match")}function xM(t){let e=[];const n=t.definition;let r=0,i=n.length>r,s,a=!0;for(;i&&a;)s=n[r],a=tf(s),e=e.concat(sc(s)),r=r+1,i=n.length>r;return Zm(e)}function NM(t){const e=pe(t.definition,n=>sc(n));return Zm(Wn(e))}function DM(t){return[t.terminalType]}const JR="_~IN~_";class IM extends nf{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,r){}walkProdRef(e,n,r){const i=LM(e.referencedRule,e.idx)+this.topProd.name,s=n.concat(r),a=new $n({definition:s}),o=sc(a);this.follows[i]=o}}function OM(t){const e={};return ke(t,n=>{const r=new IM(n).startWalking();An(e,r)}),e}function LM(t,e){return t.name+e+JR}let rf={};const MM=new Sb;function sf(t){const e=t.toString();if(rf.hasOwnProperty(e))return rf[e];{const n=MM.pattern(e);return rf[e]=n,n}}function zM(){rf={}}const QR="Complement Sets are not supported for first char optimization",af=`Unable to use "first char" lexer optimizations:
32
- `;function FM(t,e=!1){try{const n=sf(t);return tg(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===QR)e&&KR(`${af} Unable to optimize: < ${t.toString()} >
33
- Complement Sets cannot be automatically optimized.
34
- This will disable the lexer's first char optimizations.
35
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
36
- This will disable the lexer's first char optimizations.
37
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),eg(`${af}
38
- Failed parsing: < ${t.toString()} >
39
- Using the @chevrotain/regexp-to-ast library
40
- Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function tg(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)tg(t.value[i],e,n);break;case"Alternative":const r=t.value;for(let i=0;i<r.length;i++){const s=r[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const a=s;switch(a.type){case"Character":of(a.value,e,n);break;case"Set":if(a.complement===!0)throw Error(QR);ke(a.value,c=>{if(typeof c=="number")of(c,e,n);else{const u=c;if(n===!0)for(let l=u.from;l<=u.to;l++)of(l,e,n);else{for(let l=u.from;l<=u.to&&l<oc;l++)of(l,e,n);if(u.to>=oc){const l=u.from>=oc?u.from:oc,d=u.to,f=Ri(l),h=Ri(d);for(let m=f;m<=h;m++)e[m]=m}}}});break;case"Group":tg(a.value,e,n);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&ng(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return Ot(e)}function of(t,e,n){const r=Ri(t);e[r]=r,n===!0&&qM(t,e)}function qM(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=Ri(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=Ri(i.charCodeAt(0));e[s]=s}}}function ZR(t,e){return da(t.value,n=>{if(typeof n=="number")return dn(e,n);{const r=n;return da(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function ng(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?We(t.value)?rr(t.value,ng):ng(t.value):!1}class GM extends Id{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){dn(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?ZR(e,this.targetCharCodes)===void 0&&(this.found=!0):ZR(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function rg(t,e){if(e instanceof RegExp){const n=sf(e),r=new GM(t);return r.visit(n),r.found}else return da(e,n=>dn(t,n.charCodeAt(0)))!==void 0}const ss="PATTERN",ac="defaultMode",cf="modes";let e$=typeof new RegExp("(?:)").sticky=="boolean";function jM(t,e){e=Qm(e,{useSticky:e$,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
41
- `],tracer:(k,E)=>E()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{dz()});let r;n("Reject Lexer.NA",()=>{r=Zd(t,k=>k[ss]===En.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=pe(r,k=>{const E=k[ss];if(Br(E)){const _=E.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!E.ignoreCase?_:_.length===2&&_[0]==="\\"&&!dn(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:e.useSticky?n$(E):t$(E)}else{if(qr(E))return i=!0,{exec:E};if(typeof E=="object")return i=!0,E;if(typeof E=="string"){if(E.length===1)return E;{const _=E.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),C=new RegExp(_);return e.useSticky?n$(C):t$(C)}}else throw Error("non exhaustive match")}})});let a,o,c,u,l;n("misc mapping",()=>{a=pe(r,k=>k.tokenTypeIdx),o=pe(r,k=>{const E=k.GROUP;if(E!==En.SKIPPED){if(Rn(E))return E;if(Ur(E))return!1;throw Error("non exhaustive match")}}),c=pe(r,k=>{const E=k.LONGER_ALT;if(E)return We(E)?pe(E,C=>BR(r,C)):[BR(r,E)]}),u=pe(r,k=>k.PUSH_MODE),l=pe(r,k=>Te(k,"POP_MODE"))});let d;n("Line Terminator Handling",()=>{const k=s$(e.lineTerminatorCharacters);d=pe(r,E=>!1),e.positionTracking!=="onlyOffset"&&(d=pe(r,E=>Te(E,"LINE_BREAKS")?!!E.LINE_BREAKS:i$(E,k)===!1&&rg(k,E.PATTERN)))});let f,h,m,y;n("Misc Mapping #2",()=>{f=pe(r,r$),h=pe(s,cz),m=fn(r,(k,E)=>{const _=E.GROUP;return Rn(_)&&_!==En.SKIPPED&&(k[_]=[]),k},{}),y=pe(s,(k,E)=>({pattern:s[E],longerAlt:c[E],canLineTerminator:d[E],isCustom:f[E],short:h[E],group:o[E],push:u[E],pop:l[E],tokenTypeIdx:a[E],tokenType:r[E]}))});let R=!0,w=[];return e.safeMode||n("First Char Optimization",()=>{w=fn(r,(k,E,_)=>{if(typeof E.PATTERN=="string"){const C=E.PATTERN.charCodeAt(0),I=Ri(C);ig(k,I,y[_])}else if(We(E.START_CHARS_HINT)){let C;ke(E.START_CHARS_HINT,I=>{const j=typeof I=="string"?I.charCodeAt(0):I,J=Ri(j);C!==J&&(C=J,ig(k,J,y[_]))})}else if(Br(E.PATTERN))if(E.PATTERN.unicode)R=!1,e.ensureOptimizations&&eg(`${af} Unable to analyze < ${E.PATTERN.toString()} > pattern.
42
- The regexp unicode flag is not currently supported by the regexp-to-ast library.
43
- This will disable the lexer's first char optimizations.
44
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const C=FM(E.PATTERN,e.ensureOptimizations);at(C)&&(R=!1),ke(C,I=>{ig(k,I,y[_])})}else e.ensureOptimizations&&eg(`${af} TokenType: <${E.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
45
- This will disable the lexer's first char optimizations.
46
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),R=!1;return k},[])}),{emptyGroups:m,patternIdxToConfig:y,charCodeToPatternIdxToConfig:w,hasCustom:i,canBeOptimized:R}}function BM(t,e){let n=[];const r=WM(t);n=n.concat(r.errors);const i=HM(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(UM(s)),n=n.concat(ez(s)),n=n.concat(tz(s,e)),n=n.concat(nz(s)),n}function UM(t){let e=[];const n=Cn(t,r=>Br(r[ss]));return e=e.concat(VM(n)),e=e.concat(JM(n)),e=e.concat(QM(n)),e=e.concat(ZM(n)),e=e.concat(XM(n)),e}function WM(t){const e=Cn(t,i=>!Te(i,ss)),n=pe(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:kt.MISSING_PATTERN,tokenTypes:[i]})),r=Qd(t,e);return{errors:n,valid:r}}function HM(t){const e=Cn(t,i=>{const s=i[ss];return!Br(s)&&!qr(s)&&!Te(s,"exec")&&!Rn(s)}),n=pe(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:kt.INVALID_PATTERN,tokenTypes:[i]})),r=Qd(t,e);return{errors:n,valid:r}}const KM=/[^\\][$]/;function VM(t){class e extends Id{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=Cn(t,i=>{const s=i.PATTERN;try{const a=sf(s),o=new e;return o.visit(a),o.found}catch{return KM.test(s.source)}});return pe(n,i=>({message:`Unexpected RegExp Anchor Error:
47
- Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
48
- See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:kt.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function XM(t){const e=Cn(t,r=>r.PATTERN.test(""));return pe(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:kt.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const YM=/[^\\[][\^]|^\^/;function JM(t){class e extends Id{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=Cn(t,i=>{const s=i.PATTERN;try{const a=sf(s),o=new e;return o.visit(a),o.found}catch{return YM.test(s.source)}});return pe(n,i=>({message:`Unexpected RegExp Anchor Error:
49
- Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
50
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:kt.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function QM(t){const e=Cn(t,r=>{const i=r[ss];return i instanceof RegExp&&(i.multiline||i.global)});return pe(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:kt.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function ZM(t){const e=[];let n=pe(t,s=>fn(t,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!dn(e,o)&&o.PATTERN!==En.NA&&(e.push(o),a.push(o)),a),[]));n=rc(n);const r=Cn(n,s=>s.length>1);return pe(r,s=>{const a=pe(s,c=>c.name);return{message:`The same RegExp pattern ->${ir(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:kt.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function ez(t){const e=Cn(t,r=>{if(!Te(r,"GROUP"))return!1;const i=r.GROUP;return i!==En.SKIPPED&&i!==En.NA&&!Rn(i)});return pe(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:kt.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function tz(t,e){const n=Cn(t,i=>i.PUSH_MODE!==void 0&&!dn(e,i.PUSH_MODE));return pe(n,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:kt.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function nz(t){const e=[],n=fn(t,(r,i,s)=>{const a=i.PATTERN;return a===En.NA||(Rn(a)?r.push({str:a,idx:s,tokenType:i}):Br(a)&&iz(a)&&r.push({str:a.source,idx:s,tokenType:i})),r},[]);return ke(t,(r,i)=>{ke(n,({str:s,idx:a,tokenType:o})=>{if(i<a&&rz(s,r.PATTERN)){const c=`Token: ->${o.name}<- can never be matched.
51
- Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
52
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:kt.UNREACHABLE_PATTERN,tokenTypes:[r,o]})}})}),e}function rz(t,e){if(Br(e)){const n=e.exec(t);return n!==null&&n.index===0}else{if(qr(e))return e(t,0,[],{});if(Te(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function iz(t){return da([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function t$(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function n$(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function sz(t,e,n){const r=[];return Te(t,ac)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+ac+`> property in its definition
53
- `,type:kt.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Te(t,cf)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+cf+`> property in its definition
54
- `,type:kt.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Te(t,cf)&&Te(t,ac)&&!Te(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${ac}: <${t.defaultMode}>which does not exist
55
- `,type:kt.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Te(t,cf)&&ke(t.modes,(i,s)=>{ke(i,(a,o)=>{if(Ur(a))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}>
56
- `,type:kt.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(Te(a,"LONGER_ALT")){const c=We(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];ke(c,u=>{!Ur(u)&&!dn(i,u)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${a.name}> outside of mode <${s}>
57
- `,type:kt.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function az(t,e,n){const r=[];let i=!1;const s=rc(Wn(Ot(t.modes))),a=Zd(s,c=>c[ss]===En.NA),o=s$(n);return e&&ke(a,c=>{const u=i$(c,o);if(u!==!1){const d={message:lz(c,u),type:u.issue,tokenType:c};r.push(d)}else Te(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):rg(o,c.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
58
- This Lexer has been defined to track line and column information,
59
- But none of the Token Types can be identified as matching a line terminator.
60
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
61
- for details.`,type:kt.NO_LINE_BREAKS_FLAGS}),r}function oz(t){const e={},n=Un(t);return ke(n,r=>{const i=t[r];if(We(i))e[r]=[];else throw Error("non exhaustive match")}),e}function r$(t){const e=t.PATTERN;if(Br(e))return!1;if(qr(e))return!0;if(Te(e,"exec"))return!0;if(Rn(e))return!1;throw Error("non exhaustive match")}function cz(t){return Rn(t)&&t.length===1?t.charCodeAt(0):!1}const uz={test:function(t){const e=t.length;for(let n=this.lastIndex;n<e;n++){const r=t.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function i$(t,e){if(Te(t,"LINE_BREAKS"))return!1;if(Br(t.PATTERN)){try{rg(e,t.PATTERN)}catch(n){return{issue:kt.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(Rn(t.PATTERN))return!1;if(r$(t))return{issue:kt.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function lz(t,e){if(e.issue===kt.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
62
- The problem is in the <${t.name}> Token Type
63
- Root cause: ${e.errMsg}.
64
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===kt.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
65
- The problem is in the <${t.name}> Token Type
66
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function s$(t){return pe(t,n=>Rn(n)?n.charCodeAt(0):n)}function ig(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const oc=256;let uf=[];function Ri(t){return t<oc?t:uf[t]}function dz(){if(at(uf)){uf=new Array(65536);for(let t=0;t<65536;t++)uf[t]=t>255?255+~~(t/255):t}}function cc(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function lf(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let a$=1;const o$={};function uc(t){const e=fz(t);hz(e),mz(e),pz(e),ke(e,n=>{n.isParent=n.categoryMatches.length>0})}function fz(t){let e=Ut(t),n=t,r=!0;for(;r;){n=rc(Wn(pe(n,s=>s.CATEGORIES)));const i=Qd(n,e);e=e.concat(i),at(i)?r=!1:n=i}return e}function hz(t){ke(t,e=>{u$(e)||(o$[a$]=e,e.tokenTypeIdx=a$++),l$(e)&&!We(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),l$(e)||(e.CATEGORIES=[]),gz(e)||(e.categoryMatches=[]),yz(e)||(e.categoryMatchesMap={})})}function pz(t){ke(t,e=>{e.categoryMatches=[],ke(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(o$[r].tokenTypeIdx)})})}function mz(t){ke(t,e=>{c$([],e)})}function c$(t,e){ke(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),ke(e.CATEGORIES,n=>{const r=t.concat(e);dn(r,n)||c$(r,n)})}function u$(t){return Te(t,"tokenTypeIdx")}function l$(t){return Te(t,"CATEGORIES")}function gz(t){return Te(t,"categoryMatches")}function yz(t){return Te(t,"categoryMatchesMap")}function vz(t){return Te(t,"tokenTypeIdx")}const sg={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,n,r,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`}};var kt;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(kt||(kt={}));const lc={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
67
- `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:sg,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(lc);class En{constructor(e,n=lc){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${i}>`);const{time:o,value:c}=VR(s),u=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&u(`${a}<-- <${i}> time: ${o}ms`),this.traceInitIndent--,c}else return s()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
68
- a boolean 2nd argument is no longer supported`);this.config=An({},lc,n);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===lc.lineTerminatorsPattern)this.config.lineTerminatorsPattern=uz;else if(this.config.lineTerminatorCharacters===lc.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
69
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),We(e)?i={modes:{defaultMode:Ut(e)},defaultMode:ac}:(s=!1,i=Ut(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(sz(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(az(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},ke(i.modes,(o,c)=>{i.modes[c]=Zd(o,u=>Ur(u))});const a=Un(i.modes);if(ke(i.modes,(o,c)=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(BM(o,a))}),at(this.lexerDefinitionErrors)){uc(o);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=jM(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=u.charCodeToPatternIdxToConfig,this.emptyGroups=An({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!at(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const c=pe(this.lexerDefinitionErrors,u=>u.message).join(`-----------------------
70
- `);throw new Error(`Errors detected in definition of Lexer:
71
- `+c)}ke(this.lexerDefinitionWarning,o=>{KR(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(e$?(this.chopInput=es,this.match=this.matchWithTest):(this.updateLastIndex=It,this.match=this.matchWithExec),s&&(this.handleModes=It),this.trackStartLines===!1&&(this.computeNewColumn=es),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=It),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const o=fn(this.canModeBeOptimized,(c,u,l)=>(u===!1&&c.push(l),c),[]);if(n.ensureOptimizations&&!at(o))throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized.
72
- Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
73
- Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{zM()}),this.TRACE_INIT("toFastProperties",()=>{XR(this)})})}tokenize(e,n=this.defaultMode){if(!at(this.lexerDefinitionErrors)){const i=pe(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
74
- `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
75
- `+i)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,s,a,o,c,u,l,d,f,h,m,y,R,w;const k=e,E=k.length;let _=0,C=0;const I=this.hasCustom?0:Math.floor(e.length/10),j=new Array(I),J=[];let Z=this.trackStartLines?1:void 0,oe=this.trackStartLines?1:void 0;const L=oz(this.emptyGroups),S=this.trackStartLines,$=this.config.lineTerminatorsPattern;let O=0,K=[],W=[];const H=[],$e=[];Object.freeze($e);let te;function A(){return K}function me(Oe){const ce=Ri(Oe),be=W[ce];return be===void 0?$e:be}const _e=Oe=>{if(H.length===1&&Oe.tokenType.PUSH_MODE===void 0){const ce=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(Oe);J.push({offset:Oe.startOffset,line:Oe.startLine,column:Oe.startColumn,length:Oe.image.length,message:ce})}else{H.pop();const ce=la(H);K=this.patternIdxToConfig[ce],W=this.charCodeToPatternIdxToConfig[ce],O=K.length;const be=this.canModeBeOptimized[ce]&&this.config.safeMode===!1;W&&be?te=me:te=A}};function st(Oe){H.push(Oe),W=this.charCodeToPatternIdxToConfig[Oe],K=this.patternIdxToConfig[Oe],O=K.length,O=K.length;const ce=this.canModeBeOptimized[Oe]&&this.config.safeMode===!1;W&&ce?te=me:te=A}st.call(this,n);let B;const V=this.config.recoveryEnabled;for(;_<E;){c=null;const Oe=k.charCodeAt(_),ce=te(Oe),be=ce.length;for(r=0;r<be;r++){B=ce[r];const Ae=B.pattern;u=null;const ue=B.short;if(ue!==!1?Oe===ue&&(c=Ae):B.isCustom===!0?(w=Ae.exec(k,_,j,L),w!==null?(c=w[0],w.payload!==void 0&&(u=w.payload)):c=null):(this.updateLastIndex(Ae,_),c=this.match(Ae,e,_)),c!==null){if(o=B.longerAlt,o!==void 0){const N=o.length;for(s=0;s<N;s++){const F=K[o[s]],de=F.pattern;if(l=null,F.isCustom===!0?(w=de.exec(k,_,j,L),w!==null?(a=w[0],w.payload!==void 0&&(l=w.payload)):a=null):(this.updateLastIndex(de,_),a=this.match(de,e,_)),a&&a.length>c.length){c=a,u=l,B=F;break}}}break}}if(c!==null){if(d=c.length,f=B.group,f!==void 0&&(h=B.tokenTypeIdx,m=this.createTokenInstance(c,_,h,B.tokenType,Z,oe,d),this.handlePayload(m,u),f===!1?C=this.addToken(j,C,m):L[f].push(m)),e=this.chopInput(e,d),_=_+d,oe=this.computeNewColumn(oe,d),S===!0&&B.canLineTerminator===!0){let Ae=0,ue,N;$.lastIndex=0;do ue=$.test(c),ue===!0&&(N=$.lastIndex-1,Ae++);while(ue===!0);Ae!==0&&(Z=Z+Ae,oe=d-N,this.updateTokenEndLineColumnLocation(m,f,N,Ae,Z,oe,d))}this.handleModes(B,_e,st,m)}else{const Ae=_,ue=Z,N=oe;let F=V===!1;for(;F===!1&&_<E;)for(e=this.chopInput(e,1),_++,i=0;i<O;i++){const de=K[i],q=de.pattern,le=de.short;if(le!==!1?k.charCodeAt(_)===le&&(F=!0):de.isCustom===!0?F=q.exec(k,_,j,L)!==null:(this.updateLastIndex(q,_),F=q.exec(e)!==null),F===!0)break}if(y=_-Ae,oe=this.computeNewColumn(oe,y),R=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(k,Ae,y,ue,N),J.push({offset:Ae,line:ue,column:N,length:y,message:R}),V===!1)break}}return this.hasCustom||(j.length=C),{tokens:j,groups:L,errors:J}}handleModes(e,n,r,i){if(e.pop===!0){const s=e.push;n(i),s!==void 0&&r.call(this,s)}else e.push!==void 0&&r.call(this,e.push)}chopInput(e,n){return e.substring(n)}updateLastIndex(e,n){e.lastIndex=n}updateTokenEndLineColumnLocation(e,n,r,i,s,a,o){let c,u;n!==void 0&&(c=r===o-1,u=c?-1:0,i===1&&c===!0||(e.endLine=s+u,e.endColumn=a-1+-u))}computeNewColumn(e,n){return e+n}createOffsetOnlyToken(e,n,r,i){return{image:e,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,n,r,i,s,a){return{image:e,startOffset:n,startLine:s,startColumn:a,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:n+o-1,startLine:s,endLine:s,startColumn:a,endColumn:a+o-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){return e.push(r),n}addTokenUsingMemberAccess(e,n,r){return e[n]=r,n++,n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}matchWithTest(e,n,r){return e.test(n)===!0?n.substring(r,e.lastIndex):null}matchWithExec(e,n){const r=e.exec(n);return r!==null?r[0]:null}}En.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",En.NA=/NOT_APPLICABLE/;function pa(t){return d$(t)?t.LABEL:t.name}function d$(t){return Rn(t.LABEL)&&t.LABEL!==""}const wz="parent",f$="categories",h$="label",p$="group",m$="push_mode",g$="pop_mode",y$="longer_alt",v$="line_breaks",w$="start_chars_hint";function b$(t){return bz(t)}function bz(t){const e=t.pattern,n={};if(n.name=t.name,Ur(e)||(n.PATTERN=e),Te(t,wz))throw`The parent property is no longer supported.
76
- See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Te(t,f$)&&(n.CATEGORIES=t[f$]),uc([n]),Te(t,h$)&&(n.LABEL=t[h$]),Te(t,p$)&&(n.GROUP=t[p$]),Te(t,g$)&&(n.POP_MODE=t[g$]),Te(t,m$)&&(n.PUSH_MODE=t[m$]),Te(t,y$)&&(n.LONGER_ALT=t[y$]),Te(t,v$)&&(n.LINE_BREAKS=t[v$]),Te(t,w$)&&(n.START_CHARS_HINT=t[w$]),n}const $i=b$({name:"EOF",pattern:En.NA});uc([$i]);function ag(t,e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function R$(t,e){return cc(t,e)}const ma={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${d$(t)?`--> ${pa(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",o=`
77
- but found: '`+ir(e).image+"'";if(r)return s+r+o;{const c=fn(t,(f,h)=>f.concat(h),[]),u=pe(c,f=>`[${pe(f,h=>pa(h)).join(", ")}]`),d=`one of these possible Token sequences:
78
- ${pe(u,(f,h)=>` ${h+1}. ${f}`).join(`
79
- `)}`;return s+d+o}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:r}){const i="Expecting: ",a=`
80
- but found: '`+ir(e).image+"'";if(n)return i+n+a;{const c=`expecting at least one iteration which starts with one of these possible Token sequences::
81
- <${pe(t,u=>`[${pe(u,l=>pa(l)).join(",")}]`).join(" ,")}>`;return i+c+a}}};Object.freeze(ma);const Rz={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
82
- inside top level rule: ->`+t.name+"<-"}},as={buildDuplicateFoundError(t,e){function n(l){return l instanceof mt?l.terminalType.name:l instanceof hn?l.nonTerminalName:""}const r=t.name,i=ir(e),s=i.idx,a=Sr(i),o=n(i),c=s>0;let u=`->${a}${c?s:""}<- ${o?`with argument: ->${o}<-`:""}
83
- appears more than once (${e.length} times) in the top level rule: ->${r}<-.
84
- For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
85
- `;return u=u.replace(/[ \t]+/g," "),u=u.replace(/\s\s+/g,`
86
- `),u},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
87
- The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
88
- To resolve this make sure each Terminal and Non-Terminal names are unique
89
- This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
90
- and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=pe(t.prefixPath,i=>pa(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
91
- in <OR${n}> inside <${t.topLevelRule.name}> Rule,
92
- <${e}> may appears as a prefix path in all these alternatives.
93
- See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
94
- For Further details.`},buildAlternationAmbiguityError(t){const e=pe(t.prefixPath,i=>pa(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${n}> inside <${t.topLevelRule.name}> Rule,
95
- <${e}> may appears as a prefix path in all these alternatives.
96
- `;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
97
- For Further details.`,r},buildEmptyRepetitionError(t){let e=Sr(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
98
- This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
99
- Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
100
- <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
101
- has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,n=pe(t.leftRecursionPath,s=>s.name),r=`${e} --> ${n.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
102
- rule: <${e}> can be invoked from itself (directly or indirectly)
103
- without consuming any Tokens. The grammar path that causes this is:
104
- ${r}
105
- To fix this refactor your grammar to remove the left recursion.
106
- see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof fa?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function $z(t,e){const n=new kz(t,e);return n.resolveRefs(),n.errors}class kz extends ha{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){ke(Ot(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:pn.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Tz extends nf{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=Ut(this.path.ruleStack).reverse(),this.occurrenceStack=Ut(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){at(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Ez extends Tz{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),s=new $n({definition:i});this.possibleTokTypes=sc(s),this.found=!0}}}class df extends nf{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Sz extends df{walkMany(e,n,r){if(e.idx===this.occurrence){const i=ir(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof mt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class $$ extends df{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=ir(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof mt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class _z extends df{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=ir(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof mt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class k$ extends df{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=ir(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof mt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function og(t,e,n=[]){n=Ut(n);let r=[],i=0;function s(o){return o.concat(Wt(t,i+1))}function a(o){const c=og(s(o),e,n);return r.concat(c)}for(;n.length<e&&i<t.length;){const o=t[i];if(o instanceof $n)return a(o.definition);if(o instanceof hn)return a(o.definition);if(o instanceof Ht)r=a(o.definition);else if(o instanceof xn){const c=o.definition.concat([new $t({definition:o.definition})]);return a(c)}else if(o instanceof Nn){const c=[new $n({definition:o.definition}),new $t({definition:[new mt({terminalType:o.separator})].concat(o.definition)})];return a(c)}else if(o instanceof kn){const c=o.definition.concat([new $t({definition:[new mt({terminalType:o.separator})].concat(o.definition)})]);r=a(c)}else if(o instanceof $t){const c=o.definition.concat([new $t({definition:o.definition})]);r=a(c)}else{if(o instanceof Tn)return ke(o.definition,c=>{at(c.definition)===!1&&(r=a(c.definition))}),r;if(o instanceof mt)n.push(o.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:Wt(t,i)}),r}function T$(t,e,n,r){const i="EXIT_NONE_TERMINAL",s=[i],a="EXIT_ALTERNATIVE";let o=!1;const c=e.length,u=c-r-1,l=[],d=[];for(d.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!at(d);){const f=d.pop();if(f===a){o&&la(d).idx<=u&&d.pop();continue}const h=f.def,m=f.idx,y=f.ruleStack,R=f.occurrenceStack;if(at(h))continue;const w=h[0];if(w===i){const k={idx:m,def:Wt(h),ruleStack:ic(y),occurrenceStack:ic(R)};d.push(k)}else if(w instanceof mt)if(m<c-1){const k=m+1,E=e[k];if(n(E,w.terminalType)){const _={idx:k,def:Wt(h),ruleStack:y,occurrenceStack:R};d.push(_)}}else if(m===c-1)l.push({nextTokenType:w.terminalType,nextTokenOccurrence:w.idx,ruleStack:y,occurrenceStack:R}),o=!0;else throw Error("non exhaustive match");else if(w instanceof hn){const k=Ut(y);k.push(w.nonTerminalName);const E=Ut(R);E.push(w.idx);const _={idx:m,def:w.definition.concat(s,Wt(h)),ruleStack:k,occurrenceStack:E};d.push(_)}else if(w instanceof Ht){const k={idx:m,def:Wt(h),ruleStack:y,occurrenceStack:R};d.push(k),d.push(a);const E={idx:m,def:w.definition.concat(Wt(h)),ruleStack:y,occurrenceStack:R};d.push(E)}else if(w instanceof xn){const k=new $t({definition:w.definition,idx:w.idx}),E=w.definition.concat([k],Wt(h)),_={idx:m,def:E,ruleStack:y,occurrenceStack:R};d.push(_)}else if(w instanceof Nn){const k=new mt({terminalType:w.separator}),E=new $t({definition:[k].concat(w.definition),idx:w.idx}),_=w.definition.concat([E],Wt(h)),C={idx:m,def:_,ruleStack:y,occurrenceStack:R};d.push(C)}else if(w instanceof kn){const k={idx:m,def:Wt(h),ruleStack:y,occurrenceStack:R};d.push(k),d.push(a);const E=new mt({terminalType:w.separator}),_=new $t({definition:[E].concat(w.definition),idx:w.idx}),C=w.definition.concat([_],Wt(h)),I={idx:m,def:C,ruleStack:y,occurrenceStack:R};d.push(I)}else if(w instanceof $t){const k={idx:m,def:Wt(h),ruleStack:y,occurrenceStack:R};d.push(k),d.push(a);const E=new $t({definition:w.definition,idx:w.idx}),_=w.definition.concat([E],Wt(h)),C={idx:m,def:_,ruleStack:y,occurrenceStack:R};d.push(C)}else if(w instanceof Tn)for(let k=w.definition.length-1;k>=0;k--){const E=w.definition[k],_={idx:m,def:E.definition.concat(Wt(h)),ruleStack:y,occurrenceStack:R};d.push(_),d.push(a)}else if(w instanceof $n)d.push({idx:m,def:w.definition.concat(Wt(h)),ruleStack:y,occurrenceStack:R});else if(w instanceof fa)d.push(Az(w,m,y,R));else throw Error("non exhaustive match")}return l}function Az(t,e,n,r){const i=Ut(n);i.push(t.name);const s=Ut(r);return s.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:s}}var yt;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(yt||(yt={}));function cg(t){if(t instanceof Ht||t==="Option")return yt.OPTION;if(t instanceof $t||t==="Repetition")return yt.REPETITION;if(t instanceof xn||t==="RepetitionMandatory")return yt.REPETITION_MANDATORY;if(t instanceof Nn||t==="RepetitionMandatoryWithSeparator")return yt.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof kn||t==="RepetitionWithSeparator")return yt.REPETITION_WITH_SEPARATOR;if(t instanceof Tn||t==="Alternation")return yt.ALTERNATION;throw Error("non exhaustive match")}function E$(t){const{occurrence:e,rule:n,prodType:r,maxLookahead:i}=t,s=cg(r);return s===yt.ALTERNATION?ff(e,n,i):hf(e,n,s,i)}function Cz(t,e,n,r,i,s){const a=ff(t,e,n),o=C$(a)?lf:cc;return s(a,r,o,i)}function Pz(t,e,n,r,i,s){const a=hf(t,e,i,n),o=C$(a)?lf:cc;return s(a[0],o,r)}function xz(t,e,n,r){const i=t.length,s=rr(t,a=>rr(a,o=>o.length===1));if(e)return function(a){const o=pe(a,c=>c.GATE);for(let c=0;c<i;c++){const u=t[c],l=u.length,d=o[c];if(!(d!==void 0&&d.call(this)===!1))e:for(let f=0;f<l;f++){const h=u[f],m=h.length;for(let y=0;y<m;y++){const R=this.LA(y+1);if(n(R,h[y])===!1)continue e}return c}}};if(s&&!r){const a=pe(t,c=>Wn(c)),o=fn(a,(c,u,l)=>(ke(u,d=>{Te(c,d.tokenTypeIdx)||(c[d.tokenTypeIdx]=l),ke(d.categoryMatches,f=>{Te(c,f)||(c[f]=l)})}),c),{});return function(){const c=this.LA(1);return o[c.tokenTypeIdx]}}else return function(){for(let a=0;a<i;a++){const o=t[a],c=o.length;e:for(let u=0;u<c;u++){const l=o[u],d=l.length;for(let f=0;f<d;f++){const h=this.LA(f+1);if(n(h,l[f])===!1)continue e}return a}}}}function Nz(t,e,n){const r=rr(t,s=>s.length===1),i=t.length;if(r&&!n){const s=Wn(t);if(s.length===1&&at(s[0].categoryMatches)){const o=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===o}}else{const a=fn(s,(o,c,u)=>(o[c.tokenTypeIdx]=!0,ke(c.categoryMatches,l=>{o[l]=!0}),o),[]);return function(){const o=this.LA(1);return a[o.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;s<i;s++){const a=t[s],o=a.length;for(let c=0;c<o;c++){const u=this.LA(c+1);if(e(u,a[c])===!1)continue e}return!0}return!1}}class Dz extends nf{constructor(e,n,r){super(),this.topProd=e,this.targetOccurrence=n,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,n,r,i){return e.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=r.concat(i),!0):!1}walkOption(e,n,r){this.checkIsTarget(e,yt.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,yt.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,yt.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,yt.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(e,yt.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class S$ extends ha{constructor(e,n,r){super(),this.targetOccurrence=e,this.targetProdType=n,this.targetRef=r,this.result=[]}checkIsTarget(e,n){e.idx===this.targetOccurrence&&this.targetProdType===n&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,yt.OPTION)}visitRepetition(e){this.checkIsTarget(e,yt.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,yt.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,yt.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,yt.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,yt.ALTERNATION)}}function _$(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function ug(t){let e=[""];for(let n=0;n<t.length;n++){const r=t[n],i=[];for(let s=0;s<e.length;s++){const a=e[s];i.push(a+"_"+r.tokenTypeIdx);for(let o=0;o<r.categoryMatches.length;o++){const c="_"+r.categoryMatches[o];i.push(a+c)}}e=i}return e}function Iz(t,e,n){for(let r=0;r<t.length;r++){if(r===n)continue;const i=t[r];for(let s=0;s<e.length;s++){const a=e[s];if(i[a]===!0)return!1}}return!0}function A$(t,e){const n=pe(t,a=>og([a],1)),r=_$(n.length),i=pe(n,a=>{const o={};return ke(a,c=>{const u=ug(c.partialPath);ke(u,l=>{o[l]=!0})}),o});let s=n;for(let a=1;a<=e;a++){const o=s;s=_$(o.length);for(let c=0;c<o.length;c++){const u=o[c];for(let l=0;l<u.length;l++){const d=u[l].partialPath,f=u[l].suffixDef,h=ug(d);if(Iz(i,h,c)||at(f)||d.length===e){const y=r[c];if(lg(y,d)===!1){y.push(d);for(let R=0;R<h.length;R++){const w=h[R];i[c][w]=!0}}}else{const y=og(f,a+1,d);s[c]=s[c].concat(y),ke(y,R=>{const w=ug(R.partialPath);ke(w,k=>{i[c][k]=!0})})}}}}return r}function ff(t,e,n,r){const i=new S$(t,yt.ALTERNATION,r);return e.accept(i),A$(i.result,n)}function hf(t,e,n,r){const i=new S$(t,n);e.accept(i);const s=i.result,o=new Dz(e,t,n).startWalking(),c=new $n({definition:s}),u=new $n({definition:o});return A$([c,u],r)}function lg(t,e){e:for(let n=0;n<t.length;n++){const r=t[n];if(r.length===e.length){for(let i=0;i<r.length;i++){const s=e[i],a=r[i];if((s===a||a.categoryMatchesMap[s.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function Oz(t,e){return t.length<e.length&&rr(t,(n,r)=>{const i=e[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function C$(t){return rr(t,e=>rr(e,n=>rr(n,r=>at(r.categoryMatches))))}function Lz(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return pe(e,n=>Object.assign({type:pn.CUSTOM_LOOKAHEAD_VALIDATION},n))}function Mz(t,e,n,r){const i=Pn(t,c=>zz(c,n)),s=Yz(t,e,n),a=Pn(t,c=>Hz(c,n)),o=Pn(t,c=>Gz(c,t,r,n));return i.concat(s,a,o)}function zz(t,e){const n=new qz;t.accept(n);const r=n.allProductions,i=eM(r,Fz),s=sr(i,o=>o.length>1);return pe(Ot(s),o=>{const c=ir(o),u=e.buildDuplicateFoundError(t,o),l=Sr(c),d={message:u,type:pn.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:c.idx},f=P$(c);return f&&(d.parameter=f),d})}function Fz(t){return`${Sr(t)}_#_${t.idx}_#_${P$(t)}`}function P$(t){return t instanceof mt?t.terminalType.name:t instanceof hn?t.nonTerminalName:""}class qz extends ha{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function Gz(t,e,n,r){const i=[];if(fn(e,(a,o)=>o.name===t.name?a+1:a,0)>1){const a=r.buildDuplicateRuleNameError({topLevelRule:t,grammarName:n});i.push({message:a,type:pn.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function jz(t,e,n){const r=[];let i;return dn(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:pn.INVALID_RULE_OVERRIDE,ruleName:t})),r}function x$(t,e,n,r=[]){const i=[],s=pf(e.definition);if(at(s))return[];{const a=t.name;dn(s,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:pn.LEFT_RECURSION,ruleName:a});const c=Qd(s,r.concat([t])),u=Pn(c,l=>{const d=Ut(r);return d.push(l),x$(t,l,n,d)});return i.concat(u)}}function pf(t){let e=[];if(at(t))return e;const n=ir(t);if(n instanceof hn)e.push(n.referencedRule);else if(n instanceof $n||n instanceof Ht||n instanceof xn||n instanceof Nn||n instanceof kn||n instanceof $t)e=e.concat(pf(n.definition));else if(n instanceof Tn)e=Wn(pe(n.definition,s=>pf(s.definition)));else if(!(n instanceof mt))throw Error("non exhaustive match");const r=tf(n),i=t.length>1;if(r&&i){const s=Wt(t);return e.concat(pf(s))}else return e}class dg extends ha{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Bz(t,e){const n=new dg;t.accept(n);const r=n.alternations;return Pn(r,s=>{const a=ic(s.definition);return Pn(a,(o,c)=>{const u=T$([o],[],cc,1);return at(u)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:s,emptyChoiceIdx:c}),type:pn.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:s.idx,alternative:c+1}]:[]})})}function Uz(t,e,n){const r=new dg;t.accept(r);let i=r.alternations;return i=Zd(i,a=>a.ignoreAmbiguities===!0),Pn(i,a=>{const o=a.idx,c=a.maxLookahead||e,u=ff(o,t,c,a),l=Vz(u,a,t,n),d=Xz(u,a,t,n);return l.concat(d)})}class Wz extends ha{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function Hz(t,e){const n=new dg;t.accept(n);const r=n.alternations;return Pn(r,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:s}),type:pn.TOO_MANY_ALTS,ruleName:t.name,occurrence:s.idx}]:[])}function Kz(t,e,n){const r=[];return ke(t,i=>{const s=new Wz;i.accept(s);const a=s.allProductions;ke(a,o=>{const c=cg(o),u=o.maxLookahead||e,l=o.idx,f=hf(l,i,c,u)[0];if(at(Wn(f))){const h=n.buildEmptyRepetitionError({topLevelRule:i,repetition:o});r.push({message:h,type:pn.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function Vz(t,e,n,r){const i=[],s=fn(t,(o,c,u)=>(e.definition[u].ignoreAmbiguities===!0||ke(c,l=>{const d=[u];ke(t,(f,h)=>{u!==h&&lg(f,l)&&e.definition[h].ignoreAmbiguities!==!0&&d.push(h)}),d.length>1&&!lg(i,l)&&(i.push(l),o.push({alts:d,path:l}))}),o),[]);return pe(s,o=>{const c=pe(o.alts,l=>l+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:c,prefixPath:o.path}),type:pn.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:o.alts}})}function Xz(t,e,n,r){const i=fn(t,(a,o,c)=>{const u=pe(o,l=>({idx:c,path:l}));return a.concat(u)},[]);return rc(Pn(i,a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];const c=a.idx,u=a.path,l=Cn(i,f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx<c&&Oz(f.path,u));return pe(l,f=>{const h=[f.idx+1,c+1],m=e.idx===0?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:h,prefixPath:f.path}),type:pn.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:m,alternatives:h}})}))}function Yz(t,e,n){const r=[],i=pe(e,s=>s.name);return ke(t,s=>{const a=s.name;if(dn(i,a)){const o=n.buildNamespaceConflictError(s);r.push({message:o,type:pn.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),r}function Jz(t){const e=Qm(t,{errMsgProvider:Rz}),n={};return ke(t.rules,r=>{n[r.name]=r}),$z(n,e.errMsgProvider)}function Qz(t){return t=Qm(t,{errMsgProvider:as}),Mz(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const N$="MismatchedTokenException",D$="NoViableAltException",I$="EarlyExitException",O$="NotAllInputParsedException",L$=[N$,D$,I$,O$];Object.freeze(L$);function mf(t){return dn(L$,t.name)}class gf extends Error{constructor(e,n){super(e),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class M$ extends gf{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=N$}}class Zz extends gf{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=D$}}class eF extends gf{constructor(e,n){super(e,n),this.name=O$}}class tF extends gf{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=I$}}const fg={},z$="InRuleRecoveryException";class nF extends Error{constructor(e){super(e),this.name=z$}}class rF{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=Te(e,"recoveryEnabled")?e.recoveryEnabled:Wr.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=iF)}getTokenToInsert(e){const n=ag(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,n,r,i){const s=this.findReSyncTokenType(),a=this.exportLexerState(),o=[];let c=!1;const u=this.LA(1);let l=this.LA(1);const d=()=>{const f=this.LA(0),h=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:f,ruleName:this.getCurrRuleFullName()}),m=new M$(h,u,this.LA(0));m.resyncedTokens=ic(o),this.SAVE_ERROR(m)};for(;!c;)if(this.tokenMatcher(l,i)){d();return}else if(r.call(this)){d(),e.apply(this,n);return}else this.tokenMatcher(l,s)?c=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,o));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,n,r){return!(r===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,n)))}getFollowsForInRuleRecovery(e,n){const r=this.getCurrentGrammarPath(e,n);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(e,n){if(this.canRecoverWithSingleTokenInsertion(e,n))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new nF("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||at(n))return!1;const r=this.LA(1);return da(n,s=>this.tokenMatcher(r,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const n=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(n);return dn(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),r=2;for(;;){const i=da(e,s=>R$(n,s));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return fg;const e=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return pe(e,(r,i)=>i===0?fg:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=pe(this.buildFullFollowKeyStack(),n=>this.getFollowSetFromFollowKey(n));return Wn(e)}getFollowSetFromFollowKey(e){if(e===fg)return[$i];const n=e.ruleName+e.idxInCallingRule+JR+e.inRule;return this.resyncFollows[n]}addToResyncTokens(e,n){return this.tokenMatcher(e,$i)||n.push(e),n}reSyncTo(e){const n=[];let r=this.LA(1);for(;this.tokenMatcher(r,e)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,n);return ic(n)}attemptInRepetitionRecovery(e,n,r,i,s,a,o){}getCurrentGrammarPath(e,n){const r=this.getHumanReadableRuleStack(),i=Ut(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:n}}getHumanReadableRuleStack(){return pe(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function iF(t,e,n,r,i,s,a){const o=this.getKeyForAutomaticLookahead(r,i);let c=this.firstAfterRepMap[o];if(c===void 0){const f=this.getCurrRuleFullName(),h=this.getGAstProductions()[f];c=new s(h,i).startWalking(),this.firstAfterRepMap[o]=c}let u=c.token,l=c.occurrence;const d=c.isEndOfRule;this.RULE_STACK.length===1&&d&&u===void 0&&(u=$i,l=1),!(u===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,l,a)&&this.tryInRepetitionRecovery(t,e,n,u)}const sF=4,ki=8,F$=1<<ki,q$=2<<ki,hg=3<<ki,pg=4<<ki,mg=5<<ki,yf=6<<ki;function gg(t,e,n){return n|e|t}class yg{constructor(e){var n;this.maxLookahead=(n=e?.maxLookahead)!==null&&n!==void 0?n:Wr.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(at(n)){const r=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),s=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...n,...r,...i,...s]}return n}validateNoLeftRecursion(e){return Pn(e,n=>x$(n,n,as))}validateEmptyOrAlternatives(e){return Pn(e,n=>Bz(n,as))}validateAmbiguousAlternationAlternatives(e,n){return Pn(e,r=>Uz(r,n,as))}validateSomeNonEmptyLookaheadPath(e,n){return Kz(e,n,as)}buildLookaheadForAlternation(e){return Cz(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,xz)}buildLookaheadForOptional(e){return Pz(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,cg(e.prodType),Nz)}}class aF{initLooksAhead(e){this.dynamicTokensEnabled=Te(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Wr.dynamicTokensEnabled,this.maxLookahead=Te(e,"maxLookahead")?e.maxLookahead:Wr.maxLookahead,this.lookaheadStrategy=Te(e,"lookaheadStrategy")?e.lookaheadStrategy:new yg({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){ke(e,n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{const{alternation:r,repetition:i,option:s,repetitionMandatory:a,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:c}=cF(n);ke(r,u=>{const l=u.idx===0?"":u.idx;this.TRACE_INIT(`${Sr(u)}${l}`,()=>{const d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:n,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=gg(this.fullRuleNameToShort[n.name],F$,u.idx);this.setLaFuncCache(f,d)})}),ke(i,u=>{this.computeLookaheadFunc(n,u.idx,hg,"Repetition",u.maxLookahead,Sr(u))}),ke(s,u=>{this.computeLookaheadFunc(n,u.idx,q$,"Option",u.maxLookahead,Sr(u))}),ke(a,u=>{this.computeLookaheadFunc(n,u.idx,pg,"RepetitionMandatory",u.maxLookahead,Sr(u))}),ke(o,u=>{this.computeLookaheadFunc(n,u.idx,yf,"RepetitionMandatoryWithSeparator",u.maxLookahead,Sr(u))}),ke(c,u=>{this.computeLookaheadFunc(n,u.idx,mg,"RepetitionWithSeparator",u.maxLookahead,Sr(u))})})})}computeLookaheadFunc(e,n,r,i,s,a){this.TRACE_INIT(`${a}${n===0?"":n}`,()=>{const o=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),c=gg(this.fullRuleNameToShort[e.name],r,n);this.setLaFuncCache(c,o)})}getKeyForAutomaticLookahead(e,n){const r=this.getLastExplicitRuleShortName();return gg(r,e,n)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,n){this.lookAheadFuncsCache.set(e,n)}}class oF extends ha{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}const vf=new oF;function cF(t){vf.reset(),t.accept(vf);const e=vf.dslMethods;return vf.reset(),e}function G$(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function j$(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function uF(t,e,n){t.children[n]===void 0?t.children[n]=[e]:t.children[n].push(e)}function lF(t,e,n){t.children[e]===void 0?t.children[e]=[n]:t.children[e].push(n)}const dF="name";function B$(t,e){Object.defineProperty(t,dF,{enumerable:!1,configurable:!0,writable:!1,value:e})}function fF(t,e){const n=Un(t),r=n.length;for(let i=0;i<r;i++){const s=n[i],a=t[s],o=a.length;for(let c=0;c<o;c++){const u=a[c];u.tokenTypeIdx===void 0&&this[u.name](u.children,e)}}}function hF(t,e){const n=function(){};B$(n,t+"BaseSemantics");const r={visit:function(i,s){if(We(i)&&(i=i[0]),!Ur(i))return this[i.name](i.children,s)},validateVisitor:function(){const i=mF(this,e);if(!at(i)){const s=pe(i,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
107
- ${s.join(`
108
-
109
- `).replace(/\n/g,`
110
- `)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=e,n}function pF(t,e,n){const r=function(){};B$(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return ke(e,s=>{i[s]=fF}),r.prototype=i,r.prototype.constructor=r,r}var vg;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(vg||(vg={}));function mF(t,e){return gF(t,e)}function gF(t,e){const n=Cn(e,i=>qr(t[i])===!1),r=pe(n,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:vg.MISSING_METHOD,methodName:i}));return rc(r)}class yF{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Te(e,"nodeLocationTracking")?e.nodeLocationTracking:Wr.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=It,this.cstFinallyStateUpdate=It,this.cstPostTerminal=It,this.cstPostNonTerminal=It,this.cstPostRule=It;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=j$,this.setNodeLocationFromNode=j$,this.cstPostRule=It,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=It,this.setNodeLocationFromNode=It,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=G$,this.setNodeLocationFromNode=G$,this.cstPostRule=It,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=It,this.setNodeLocationFromNode=It,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=It,this.setNodeLocationFromNode=It,this.cstPostRule=It,this.setInitialNodeLocation=It;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const n=this.LA(1);e.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const n={name:e,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?(r.endOffset=n.endOffset,r.endLine=n.endLine,r.endColumn=n.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?r.endOffset=n.endOffset:r.startOffset=NaN}cstPostTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];uF(r,n,e),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];lF(r,n,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(Ur(this.baseCstVisitorConstructor)){const e=hF(this.className,Un(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Ur(this.baseCstVisitorWithDefaultsConstructor)){const e=pF(this.className,Un(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class vF{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Rf}LA(e){const n=this.currIdx+e;return n<0||this.tokVectorLength<=n?Rf:this.tokVector[n]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class wF{ACTION(e){return e.call(this)}consume(e,n,r){return this.consumeInternal(n,e,r)}subrule(e,n,r){return this.subruleInternal(n,e,r)}option(e,n){return this.optionInternal(n,e)}or(e,n){return this.orInternal(n,e)}many(e,n){return this.manyInternal(e,n)}atLeastOne(e,n){return this.atLeastOneInternal(e,n)}CONSUME(e,n){return this.consumeInternal(e,0,n)}CONSUME1(e,n){return this.consumeInternal(e,1,n)}CONSUME2(e,n){return this.consumeInternal(e,2,n)}CONSUME3(e,n){return this.consumeInternal(e,3,n)}CONSUME4(e,n){return this.consumeInternal(e,4,n)}CONSUME5(e,n){return this.consumeInternal(e,5,n)}CONSUME6(e,n){return this.consumeInternal(e,6,n)}CONSUME7(e,n){return this.consumeInternal(e,7,n)}CONSUME8(e,n){return this.consumeInternal(e,8,n)}CONSUME9(e,n){return this.consumeInternal(e,9,n)}SUBRULE(e,n){return this.subruleInternal(e,0,n)}SUBRULE1(e,n){return this.subruleInternal(e,1,n)}SUBRULE2(e,n){return this.subruleInternal(e,2,n)}SUBRULE3(e,n){return this.subruleInternal(e,3,n)}SUBRULE4(e,n){return this.subruleInternal(e,4,n)}SUBRULE5(e,n){return this.subruleInternal(e,5,n)}SUBRULE6(e,n){return this.subruleInternal(e,6,n)}SUBRULE7(e,n){return this.subruleInternal(e,7,n)}SUBRULE8(e,n){return this.subruleInternal(e,8,n)}SUBRULE9(e,n){return this.subruleInternal(e,9,n)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,n,r=$f){if(dn(this.definedRulesNames,e)){const a={message:as.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:pn.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);const i=this.defineRule(e,n,r);return this[e]=i,i}OVERRIDE_RULE(e,n,r=$f){const i=jz(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);const s=this.defineRule(e,n,r);return this[e]=s,s}BACKTRACK(e,n){return function(){this.isBackTrackingStack.push(1);const r=this.saveRecogState();try{return e.apply(this,n),!0}catch(i){if(mf(i))return!1;throw i}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return AM(Ot(this.gastProductionsCache))}}class bF{initRecognizerEngine(e,n){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=lf,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},Te(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
111
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
112
- For Further details.`);if(We(e)){if(at(e))throw Error(`A Token Vocabulary cannot be empty.
113
- Note that the first argument for the parser constructor
114
- is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
115
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
116
- For Further details.`)}if(We(e))this.tokensMap=fn(e,(s,a)=>(s[a.name]=a,s),{});else if(Te(e,"modes")&&rr(Wn(Ot(e.modes)),vz)){const s=Wn(Ot(e.modes)),a=Zm(s);this.tokensMap=fn(a,(o,c)=>(o[c.name]=c,o),{})}else if(Bn(e))this.tokensMap=Ut(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=$i;const r=Te(e,"modes")?Wn(Ot(e.modes)):Ot(e),i=rr(r,s=>at(s.categoryMatches));this.tokenMatcher=i?lf:cc,uc(Ot(this.tokensMap))}defineRule(e,n,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
117
- Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=Te(r,"resyncEnabled")?r.resyncEnabled:$f.resyncEnabled,s=Te(r,"recoveryValueFunc")?r.recoveryValueFunc:$f.recoveryValueFunc,a=this.ruleShortNameIdx<<sF+ki;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return this.outputCst===!0?o=function(...l){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,l);const d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,i,s)}finally{this.ruleFinallyStateUpdate()}}:o=function(...l){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,l)}catch(d){return this.invokeRuleCatch(d,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:n})}invokeRuleCatch(e,n,r){const i=this.RULE_STACK.length===1,s=n&&!this.isBackTracking()&&this.recoveryEnabled;if(mf(e)){const a=e;if(s){const o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(a.resyncedTokens=this.reSyncTo(o),this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return r(e);else{if(this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,a.partialCstResult=c}throw a}}else{if(i)return this.moveToTerminatedState(),r(e);throw a}}else throw e}optionInternal(e,n){const r=this.getKeyForAutomaticLookahead(q$,n);return this.optionInternalLogic(e,n,r)}optionInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof e!="function"){s=e.DEF;const a=e.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,n){const r=this.getKeyForAutomaticLookahead(pg,e);return this.atLeastOneInternalLogic(e,n,r)}atLeastOneInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const a=n.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=n;if(i.call(this)===!0){let a=this.doSingleRepetition(s);for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,yt.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,pg,e,_z)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(yf,e);this.atLeastOneSepFirstInternalLogic(e,n,r)}atLeastOneSepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,k$],o,yf,e,k$)}else throw this.raiseEarlyExitException(e,yt.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(hg,e);return this.manyInternalLogic(e,n,r)}manyInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const o=n.GATE;if(o!==void 0){const c=i;i=()=>o.call(this)&&c.call(this)}}else s=n;let a=!0;for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],i,hg,e,Sz,a)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(mg,e);this.manySepFirstInternalLogic(e,n,r)}manySepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,$$],o,mg,e,$$)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,yf,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(F$,n),i=We(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,i);if(a!==void 0)return i[a].ALT.call(this);this.raiseNoAltException(n,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),n=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new eF(n,e))}}subruleInternal(e,n,r){let i;try{const s=r!==void 0?r.ARGS:void 0;return this.subruleIdx=n,i=e.apply(this,s),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,r,e.ruleName)}}subruleInternalError(e,n,r){throw mf(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,n!==void 0&&n.LABEL!==void 0?n.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,n,r){let i;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),i=s):this.consumeInternalError(e,s,r)}catch(s){i=this.consumeInternalRecovery(e,n,s)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:e.name,i),i}consumeInternalError(e,n,r){let i;const s=this.LA(0);throw r!==void 0&&r.ERR_MSG?i=r.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:n,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new M$(i,n,s))}consumeInternalRecovery(e,n,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){const i=this.getFollowsForInRuleRecovery(e,n);try{return this.tryInRuleRecovery(e,i)}catch(s){throw s.name===z$?r:s}}else throw r}saveRecogState(){const e=this.errors,n=Ut(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,n,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),$i)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class RF{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Te(e,"errorMessageProvider")?e.errorMessageProvider:Wr.errorMessageProvider}SAVE_ERROR(e){if(mf(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:Ut(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return Ut(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,n,r){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],o=hf(e,s,n,this.maxLookahead)[0],c=[];for(let l=1;l<=this.maxLookahead;l++)c.push(this.LA(l));const u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:o,actual:c,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new tF(u,this.LA(1),this.LA(0)))}raiseNoAltException(e,n){const r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],s=ff(e,i,this.maxLookahead),a=[];for(let u=1;u<=this.maxLookahead;u++)a.push(this.LA(u));const o=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:a,previous:o,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Zz(c,this.LA(1),o))}}class $F{initContentAssist(){}computeContentAssist(e,n){const r=this.gastProductionsCache[e];if(Ur(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return T$([r],n,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const n=ir(e.ruleStack),i=this.getGAstProductions()[n];return new Ez(i,e).startWalking()}}const wf={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(wf);const U$=!0,W$=Math.pow(2,ki)-1,H$=b$({name:"RECORDING_PHASE_TOKEN",pattern:En.NA});uc([H$]);const K$=ag(H$,`This IToken indicates the Parser is in Recording Phase
118
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(K$);const kF={name:`This CSTNode indicates the Parser is in Recording Phase
119
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class TF{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){const n=e>0?e:"";this[`CONSUME${n}`]=function(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${n}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${n}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${n}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${n}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${n}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${n}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${n}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,n,r){return this.consumeInternalRecord(n,e,r)},this.subrule=function(e,n,r){return this.subruleInternalRecord(n,e,r)},this.option=function(e,n){return this.optionInternalRecord(n,e)},this.or=function(e,n){return this.orInternalRecord(n,e)},this.many=function(e,n){this.manyInternalRecord(e,n)},this.atLeastOne=function(e,n){this.atLeastOneInternalRecord(e,n)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let n=0;n<10;n++){const r=n>0?n:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,n){return()=>!0}LA_RECORD(e){return Rf}topLevelRuleRecord(e,n){try{const r=new fa({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
120
- This error was thrown during the "grammar recording phase" For more info see:
121
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,n){return dc.call(this,Ht,e,n)}atLeastOneInternalRecord(e,n){dc.call(this,xn,n,e)}atLeastOneSepFirstInternalRecord(e,n){dc.call(this,Nn,n,e,U$)}manyInternalRecord(e,n){dc.call(this,$t,n,e)}manySepFirstInternalRecord(e,n){dc.call(this,kn,n,e,U$)}orInternalRecord(e,n){return EF.call(this,e,n)}subruleInternalRecord(e,n,r){if(bf(n),!e||Te(e,"ruleName")===!1){const o=new Error(`<SUBRULE${V$(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
122
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=la(this.recordingProdStack),s=e.ruleName,a=new hn({idx:n,nonTerminalName:s,label:r?.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?kF:wf}consumeInternalRecord(e,n,r){if(bf(n),!u$(e)){const a=new Error(`<CONSUME${V$(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
123
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const i=la(this.recordingProdStack),s=new mt({idx:n,terminalType:e,label:r?.LABEL});return i.definition.push(s),K$}}function dc(t,e,n,r=!1){bf(n);const i=la(this.recordingProdStack),s=qr(e)?e:e.DEF,a=new t({definition:[],idx:n});return r&&(a.separator=e.SEP),Te(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),wf}function EF(t,e){bf(e);const n=la(this.recordingProdStack),r=We(t)===!1,i=r===!1?t:t.DEF,s=new Tn({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});Te(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const a=WR(i,o=>qr(o.GATE));return s.hasPredicates=a,n.definition.push(s),ke(i,o=>{const c=new $n({definition:[]});s.definition.push(c),Te(o,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:Te(o,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),o.ALT.call(this),this.recordingProdStack.pop()}),wf}function V$(t){return t===0?"":`${t}`}function bf(t){if(t<0||t>W$){const e=new Error(`Invalid DSL Method idx value: <${t}>
124
- Idx value must be a none negative value smaller than ${W$+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class SF{initPerformanceTracer(e){if(Te(e,"traceInitPerf")){const n=e.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=Wr.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,n){if(this.traceInitPerf===!0){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--> <${e}>`);const{time:i,value:s}=VR(n),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return n()}}function _F(t,e){e.forEach(n=>{const r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=n.prototype[i]})})}const Rf=ag($i,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Rf);const Wr=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:ma,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),$f=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var pn;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(pn||(pn={}));function X$(t=void 0){return function(){return t}}class id{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const n=this.className;this.TRACE_INIT("toFastProps",()=>{XR(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),ke(this.definedRulesNames,i=>{const a=this[i].originalGrammarAction;let o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=Jz({rules:Ot(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(at(r)&&this.skipValidations===!1){const i=Qz({rules:Ot(this.gastProductionsCache),tokenTypes:Ot(this.tokensMap),errMsgProvider:as,grammarName:n}),s=Lz({lookaheadStrategy:this.lookaheadStrategy,rules:Ot(this.gastProductionsCache),tokenTypes:Ot(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),at(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=OM(Ot(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,s;(s=(i=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(i,{rules:Ot(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Ot(this.gastProductionsCache))})),!id.DEFER_DEFINITION_ERRORS_HANDLING&&!at(this.definitionErrors))throw e=pe(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
125
- ${e.join(`
126
- -------------------------------
127
- `)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),Te(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
128
- Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
129
- See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
130
- For further details.`);this.skipValidations=Te(n,"skipValidations")?n.skipValidations:Wr.skipValidations}}id.DEFER_DEFINITION_ERRORS_HANDLING=!1,_F(id,[rF,aF,yF,vF,bF,wF,RF,$F,TF,SF]);class AF extends id{constructor(e,n=Wr){const r=Ut(n);r.outputCst=!1,super(e,r)}}function ga(t,e,n){return`${t.name}_${e}_${n}`}const Ti=1,CF=2,Y$=4,J$=5,fc=7,PF=8,xF=9,NF=10,DF=11,Q$=12;class wg{constructor(e){this.target=e}isEpsilon(){return!1}}class bg extends wg{constructor(e,n){super(e),this.tokenType=n}}class Z$ extends wg{constructor(e){super(e)}isEpsilon(){return!0}}class Rg extends wg{constructor(e,n,r){super(e),this.rule=n,this.followState=r}isEpsilon(){return!0}}function IF(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};OF(e,t);const n=t.length;for(let r=0;r<n;r++){const i=t[r],s=os(e,i,i);s!==void 0&&HF(e,i,s)}return e}function OF(t,e){const n=e.length;for(let r=0;r<n;r++){const i=e[r],s=Gt(t,i,void 0,{type:CF}),a=Gt(t,i,void 0,{type:fc});s.stop=a,t.ruleToStartState.set(i,s),t.ruleToStopState.set(i,a)}}function ek(t,e,n){return n instanceof mt?$g(t,e,n.terminalType,n):n instanceof hn?WF(t,e,n):n instanceof Tn?qF(t,e,n):n instanceof Ht?GF(t,e,n):n instanceof $t?LF(t,e,n):n instanceof kn?MF(t,e,n):n instanceof xn?zF(t,e,n):n instanceof Nn?FF(t,e,n):os(t,e,n)}function LF(t,e,n){const r=Gt(t,e,n,{type:J$});Ei(t,r);const i=ya(t,e,r,n,os(t,e,n));return nk(t,e,n,i)}function MF(t,e,n){const r=Gt(t,e,n,{type:J$});Ei(t,r);const i=ya(t,e,r,n,os(t,e,n)),s=$g(t,e,n.separator,n);return nk(t,e,n,i,s)}function zF(t,e,n){const r=Gt(t,e,n,{type:Y$});Ei(t,r);const i=ya(t,e,r,n,os(t,e,n));return tk(t,e,n,i)}function FF(t,e,n){const r=Gt(t,e,n,{type:Y$});Ei(t,r);const i=ya(t,e,r,n,os(t,e,n)),s=$g(t,e,n.separator,n);return tk(t,e,n,i,s)}function qF(t,e,n){const r=Gt(t,e,n,{type:Ti});Ei(t,r);const i=pe(n.definition,a=>ek(t,e,a));return ya(t,e,r,n,...i)}function GF(t,e,n){const r=Gt(t,e,n,{type:Ti});Ei(t,r);const i=ya(t,e,r,n,os(t,e,n));return jF(t,e,n,i)}function os(t,e,n){const r=Cn(pe(n.definition,i=>ek(t,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:UF(t,r)}function tk(t,e,n,r,i){const s=r.left,a=r.right,o=Gt(t,e,n,{type:DF});Ei(t,o);const c=Gt(t,e,n,{type:Q$});return s.loopback=o,c.loopback=o,t.decisionMap[ga(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=o,At(a,o),i===void 0?(At(o,s),At(o,c)):(At(o,c),At(o,i.left),At(i.right,s)),{left:s,right:c}}function nk(t,e,n,r,i){const s=r.left,a=r.right,o=Gt(t,e,n,{type:NF});Ei(t,o);const c=Gt(t,e,n,{type:Q$}),u=Gt(t,e,n,{type:xF});return o.loopback=u,c.loopback=u,At(o,s),At(o,c),At(a,u),i!==void 0?(At(u,c),At(u,i.left),At(i.right,s)):At(u,o),t.decisionMap[ga(e,i?"RepetitionWithSeparator":"Repetition",n.idx)]=o,{left:o,right:c}}function jF(t,e,n,r){const i=r.left,s=r.right;return At(i,s),t.decisionMap[ga(e,"Option",n.idx)]=i,r}function Ei(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function ya(t,e,n,r,...i){const s=Gt(t,e,r,{type:PF,start:n});n.end=s;for(const o of i)o!==void 0?(At(n,o.left),At(o.right,s)):At(n,s);const a={left:n,right:s};return t.decisionMap[ga(e,BF(r),r.idx)]=n,a}function BF(t){if(t instanceof Tn)return"Alternation";if(t instanceof Ht)return"Option";if(t instanceof $t)return"Repetition";if(t instanceof kn)return"RepetitionWithSeparator";if(t instanceof xn)return"RepetitionMandatory";if(t instanceof Nn)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function UF(t,e){const n=e.length;for(let s=0;s<n-1;s++){const a=e[s];let o;a.left.transitions.length===1&&(o=a.left.transitions[0]);const c=o instanceof Rg,u=o,l=e[s+1].left;a.left.type===Ti&&a.right.type===Ti&&o!==void 0&&(c&&u.followState===a.right||o.target===a.right)?(c?u.followState=l:o.target=l,KF(t,a.right)):At(a.right,l)}const r=e[0],i=e[n-1];return{left:r.left,right:i.right}}function $g(t,e,n,r){const i=Gt(t,e,r,{type:Ti}),s=Gt(t,e,r,{type:Ti});return kg(i,new bg(s,n)),{left:i,right:s}}function WF(t,e,n){const r=n.referencedRule,i=t.ruleToStartState.get(r),s=Gt(t,e,n,{type:Ti}),a=Gt(t,e,n,{type:Ti}),o=new Rg(i,r,a);return kg(s,o),{left:s,right:a}}function HF(t,e,n){const r=t.ruleToStartState.get(e);At(r,n.left);const i=t.ruleToStopState.get(e);return At(n.right,i),{left:r,right:i}}function At(t,e){const n=new Z$(e);kg(t,n)}function Gt(t,e,n,r){const i=Object.assign({atn:t,production:n,epsilonOnlyTransitions:!1,rule:e,transitions:[],nextTokenWithinRule:[],stateNumber:t.states.length},r);return t.states.push(i),i}function kg(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function KF(t,e){t.states.splice(t.states.indexOf(e),1)}const kf={};class Tg{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const n=rk(e);n in this.map||(this.map[n]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return pe(this.configs,e=>e.alt)}get key(){let e="";for(const n in this.map)e+=n+":";return e}}function rk(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(n=>n.stateNumber.toString()).join("_")}`}function VF(t,e){const n={};return r=>{const i=r.toString();let s=n[i];return s!==void 0||(s={atnStartState:t,decision:e,states:{}},n[i]=s),s}}class ik{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,n){this.predicates[e]=n}toString(){let e="";const n=this.predicates.length;for(let r=0;r<n;r++)e+=this.predicates[r]===!0?"1":"0";return e}}const sk=new ik;class XF extends yg{constructor(e){var n;super(),this.logging=(n=e?.logging)!==null&&n!==void 0?n:r=>console.log(r)}initialize(e){this.atn=IF(e.rules),this.dfas=YF(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:s}=e,a=this.dfas,o=this.logging,c=ga(r,"Alternation",n),l=this.atn.decisionMap[c].decision,d=pe(E$({maxLookahead:1,occurrence:n,prodType:"Alternation",rule:r}),f=>pe(f,h=>h[0]));if(ak(d,!1)&&!s){const f=fn(d,(h,m,y)=>(ke(m,R=>{R&&(h[R.tokenTypeIdx]=y,ke(R.categoryMatches,w=>{h[w]=y}))}),h),{});return i?function(h){var m;const y=this.LA(1),R=f[y.tokenTypeIdx];if(h!==void 0&&R!==void 0){const w=(m=h[R])===null||m===void 0?void 0:m.GATE;if(w!==void 0&&w.call(this)===!1)return}return R}:function(){const h=this.LA(1);return f[h.tokenTypeIdx]}}else return i?function(f){const h=new ik,m=f===void 0?0:f.length;for(let R=0;R<m;R++){const w=f?.[R].GATE;h.set(R,w===void 0||w.call(this))}const y=Eg.call(this,a,l,h,o);return typeof y=="number"?y:void 0}:function(){const f=Eg.call(this,a,l,sk,o);return typeof f=="number"?f:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:n,rule:r,prodType:i,dynamicTokensEnabled:s}=e,a=this.dfas,o=this.logging,c=ga(r,i,n),l=this.atn.decisionMap[c].decision,d=pe(E$({maxLookahead:1,occurrence:n,prodType:i,rule:r}),f=>pe(f,h=>h[0]));if(ak(d)&&d[0][0]&&!s){const f=d[0],h=Wn(f);if(h.length===1&&at(h[0].categoryMatches)){const y=h[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===y}}else{const m=fn(h,(y,R)=>(R!==void 0&&(y[R.tokenTypeIdx]=!0,ke(R.categoryMatches,w=>{y[w]=!0})),y),{});return function(){const y=this.LA(1);return m[y.tokenTypeIdx]===!0}}}return function(){const f=Eg.call(this,a,l,sk,o);return typeof f=="object"?!1:f===0}}}function ak(t,e=!0){const n=new Set;for(const r of t){const i=new Set;for(const s of r){if(s===void 0){if(e)break;return!1}const a=[s.tokenTypeIdx].concat(s.categoryMatches);for(const o of a)if(n.has(o)){if(!i.has(o))return!1}else n.add(o),i.add(o)}}return!0}function YF(t){const e=t.decisionStates.length,n=Array(e);for(let r=0;r<e;r++)n[r]=VF(t.decisionStates[r],r);return n}function Eg(t,e,n,r){const i=t[e](n);let s=i.start;if(s===void 0){const o=oq(i.atnStartState);s=uk(i,ok(o)),i.start=s}return JF.apply(this,[i,s,n,r])}function JF(t,e,n,r){let i=e,s=1;const a=[];let o=this.LA(s++);for(;;){let c=rq(i,o);if(c===void 0&&(c=QF.apply(this,[t,i,o,s,n,r])),c===kf)return nq(a,i,o);if(c.isAcceptState===!0)return c.prediction;i=c,a.push(o),o=this.LA(s++)}}function QF(t,e,n,r,i,s){const a=iq(e.configs,n,i);if(a.size===0)return ck(t,e,n,kf),kf;let o=ok(a);const c=aq(a,i);if(c!==void 0)o.isAcceptState=!0,o.prediction=c,o.configs.uniqueAlt=c;else if(dq(a)){const u=mM(a.alts);o.isAcceptState=!0,o.prediction=u,o.configs.uniqueAlt=u,ZF.apply(this,[t,r,a.alts,s])}return o=ck(t,e,n,o),o}function ZF(t,e,n,r){const i=[];for(let u=1;u<=e;u++)i.push(this.LA(u).tokenType);const s=t.atnStartState,a=s.rule,o=s.production,c=eq({topLevelRule:a,ambiguityIndices:n,production:o,prefixPath:i});r(c)}function eq(t){const e=pe(t.prefixPath,i=>pa(i)).join(", "),n=t.production.idx===0?"":t.production.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${tq(t.production)}${n}> inside <${t.topLevelRule.name}> Rule,
131
- <${e}> may appears as a prefix path in all these alternatives.
132
- `;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
133
- For Further details.`,r}function tq(t){if(t instanceof hn)return"SUBRULE";if(t instanceof Ht)return"OPTION";if(t instanceof Tn)return"OR";if(t instanceof xn)return"AT_LEAST_ONE";if(t instanceof Nn)return"AT_LEAST_ONE_SEP";if(t instanceof kn)return"MANY_SEP";if(t instanceof $t)return"MANY";if(t instanceof mt)return"CONSUME";throw Error("non exhaustive match")}function nq(t,e,n){const r=Pn(e.configs.elements,s=>s.state.transitions),i=EM(r.filter(s=>s instanceof bg).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function rq(t,e){return t.edges[e.tokenTypeIdx]}function iq(t,e,n){const r=new Tg,i=[];for(const a of t.elements){if(n.is(a.alt)===!1)continue;if(a.state.type===fc){i.push(a);continue}const o=a.state.transitions.length;for(let c=0;c<o;c++){const u=a.state.transitions[c],l=sq(u,e);l!==void 0&&r.add({state:l,alt:a.alt,stack:a.stack})}}let s;if(i.length===0&&r.size===1&&(s=r),s===void 0){s=new Tg;for(const a of r.elements)Tf(a,s)}if(i.length>0&&!uq(s))for(const a of i)s.add(a);return s}function sq(t,e){if(t instanceof bg&&R$(e,t.tokenType))return t.target}function aq(t,e){let n;for(const r of t.elements)if(e.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}function ok(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function ck(t,e,n,r){return r=uk(t,r),e.edges[n.tokenTypeIdx]=r,r}function uk(t,e){if(e===kf)return e;const n=e.configs.key,r=t.states[n];return r!==void 0?r:(e.configs.finalize(),t.states[n]=e,e)}function oq(t){const e=new Tg,n=t.transitions.length;for(let r=0;r<n;r++){const s={state:t.transitions[r].target,alt:r,stack:[]};Tf(s,e)}return e}function Tf(t,e){const n=t.state;if(n.type===fc){if(t.stack.length>0){const i=[...t.stack],a={state:i.pop(),alt:t.alt,stack:i};Tf(a,e)}else e.add(t);return}n.epsilonOnlyTransitions||e.add(t);const r=n.transitions.length;for(let i=0;i<r;i++){const s=n.transitions[i],a=cq(t,s);a!==void 0&&Tf(a,e)}}function cq(t,e){if(e instanceof Z$)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof Rg){const n=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:n}}}function uq(t){for(const e of t.elements)if(e.state.type===fc)return!0;return!1}function lq(t){for(const e of t.elements)if(e.state.type!==fc)return!1;return!0}function dq(t){if(lq(t))return!0;const e=fq(t.elements);return hq(e)&&!pq(e)}function fq(t){const e=new Map;for(const n of t){const r=rk(n,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[n.alt]=!0}return e}function hq(t){for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function pq(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var lk;(function(t){function e(n){return typeof n=="string"}t.is=e})(lk||(lk={}));var Sg;(function(t){function e(n){return typeof n=="string"}t.is=e})(Sg||(Sg={}));var dk;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(dk||(dk={}));var Ef;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(Ef||(Ef={}));var et;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=Ef.MAX_VALUE),i===Number.MAX_VALUE&&(i=Ef.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return z.objectLiteral(i)&&z.uinteger(i.line)&&z.uinteger(i.character)}t.is=n})(et||(et={}));var je;(function(t){function e(r,i,s,a){if(z.uinteger(r)&&z.uinteger(i)&&z.uinteger(s)&&z.uinteger(a))return{start:et.create(r,i),end:et.create(s,a)};if(et.is(r)&&et.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${s}, ${a}]`)}t.create=e;function n(r){let i=r;return z.objectLiteral(i)&&et.is(i.start)&&et.is(i.end)}t.is=n})(je||(je={}));var Sf;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return z.objectLiteral(i)&&je.is(i.range)&&(z.string(i.uri)||z.undefined(i.uri))}t.is=n})(Sf||(Sf={}));var fk;(function(t){function e(r,i,s,a){return{targetUri:r,targetRange:i,targetSelectionRange:s,originSelectionRange:a}}t.create=e;function n(r){let i=r;return z.objectLiteral(i)&&je.is(i.targetRange)&&z.string(i.targetUri)&&je.is(i.targetSelectionRange)&&(je.is(i.originSelectionRange)||z.undefined(i.originSelectionRange))}t.is=n})(fk||(fk={}));var _g;(function(t){function e(r,i,s,a){return{red:r,green:i,blue:s,alpha:a}}t.create=e;function n(r){const i=r;return z.objectLiteral(i)&&z.numberRange(i.red,0,1)&&z.numberRange(i.green,0,1)&&z.numberRange(i.blue,0,1)&&z.numberRange(i.alpha,0,1)}t.is=n})(_g||(_g={}));var hk;(function(t){function e(r,i){return{range:r,color:i}}t.create=e;function n(r){const i=r;return z.objectLiteral(i)&&je.is(i.range)&&_g.is(i.color)}t.is=n})(hk||(hk={}));var pk;(function(t){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}t.create=e;function n(r){const i=r;return z.objectLiteral(i)&&z.string(i.label)&&(z.undefined(i.textEdit)||Sn.is(i))&&(z.undefined(i.additionalTextEdits)||z.typedArray(i.additionalTextEdits,Sn.is))}t.is=n})(pk||(pk={}));var mk;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(mk||(mk={}));var gk;(function(t){function e(r,i,s,a,o,c){const u={startLine:r,endLine:i};return z.defined(s)&&(u.startCharacter=s),z.defined(a)&&(u.endCharacter=a),z.defined(o)&&(u.kind=o),z.defined(c)&&(u.collapsedText=c),u}t.create=e;function n(r){const i=r;return z.objectLiteral(i)&&z.uinteger(i.startLine)&&z.uinteger(i.startLine)&&(z.undefined(i.startCharacter)||z.uinteger(i.startCharacter))&&(z.undefined(i.endCharacter)||z.uinteger(i.endCharacter))&&(z.undefined(i.kind)||z.string(i.kind))}t.is=n})(gk||(gk={}));var Ag;(function(t){function e(r,i){return{location:r,message:i}}t.create=e;function n(r){let i=r;return z.defined(i)&&Sf.is(i.location)&&z.string(i.message)}t.is=n})(Ag||(Ag={}));var hc;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(hc||(hc={}));var yk;(function(t){t.Unnecessary=1,t.Deprecated=2})(yk||(yk={}));var vk;(function(t){function e(n){const r=n;return z.objectLiteral(r)&&z.string(r.href)}t.is=e})(vk||(vk={}));var _f;(function(t){function e(r,i,s,a,o,c){let u={range:r,message:i};return z.defined(s)&&(u.severity=s),z.defined(a)&&(u.code=a),z.defined(o)&&(u.source=o),z.defined(c)&&(u.relatedInformation=c),u}t.create=e;function n(r){var i;let s=r;return z.defined(s)&&je.is(s.range)&&z.string(s.message)&&(z.number(s.severity)||z.undefined(s.severity))&&(z.integer(s.code)||z.string(s.code)||z.undefined(s.code))&&(z.undefined(s.codeDescription)||z.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(z.string(s.source)||z.undefined(s.source))&&(z.undefined(s.relatedInformation)||z.typedArray(s.relatedInformation,Ag.is))}t.is=n})(_f||(_f={}));var va;(function(t){function e(r,i,...s){let a={title:r,command:i};return z.defined(s)&&s.length>0&&(a.arguments=s),a}t.create=e;function n(r){let i=r;return z.defined(i)&&z.string(i.title)&&z.string(i.command)}t.is=n})(va||(va={}));var Sn;(function(t){function e(s,a){return{range:s,newText:a}}t.replace=e;function n(s,a){return{range:{start:s,end:s},newText:a}}t.insert=n;function r(s){return{range:s,newText:""}}t.del=r;function i(s){const a=s;return z.objectLiteral(a)&&z.string(a.newText)&&je.is(a.range)}t.is=i})(Sn||(Sn={}));var Cg;(function(t){function e(r,i,s){const a={label:r};return i!==void 0&&(a.needsConfirmation=i),s!==void 0&&(a.description=s),a}t.create=e;function n(r){const i=r;return z.objectLiteral(i)&&z.string(i.label)&&(z.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(z.string(i.description)||i.description===void 0)}t.is=n})(Cg||(Cg={}));var wa;(function(t){function e(n){const r=n;return z.string(r)}t.is=e})(wa||(wa={}));var wk;(function(t){function e(s,a,o){return{range:s,newText:a,annotationId:o}}t.replace=e;function n(s,a,o){return{range:{start:s,end:s},newText:a,annotationId:o}}t.insert=n;function r(s,a){return{range:s,newText:"",annotationId:a}}t.del=r;function i(s){const a=s;return Sn.is(a)&&(Cg.is(a.annotationId)||wa.is(a.annotationId))}t.is=i})(wk||(wk={}));var Pg;(function(t){function e(r,i){return{textDocument:r,edits:i}}t.create=e;function n(r){let i=r;return z.defined(i)&&Og.is(i.textDocument)&&Array.isArray(i.edits)}t.is=n})(Pg||(Pg={}));var xg;(function(t){function e(r,i,s){let a={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}t.create=e;function n(r){let i=r;return i&&i.kind==="create"&&z.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||z.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||z.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||wa.is(i.annotationId))}t.is=n})(xg||(xg={}));var Ng;(function(t){function e(r,i,s,a){let o={kind:"rename",oldUri:r,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(o.options=s),a!==void 0&&(o.annotationId=a),o}t.create=e;function n(r){let i=r;return i&&i.kind==="rename"&&z.string(i.oldUri)&&z.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||z.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||z.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||wa.is(i.annotationId))}t.is=n})(Ng||(Ng={}));var Dg;(function(t){function e(r,i,s){let a={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}t.create=e;function n(r){let i=r;return i&&i.kind==="delete"&&z.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||z.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||z.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||wa.is(i.annotationId))}t.is=n})(Dg||(Dg={}));var Ig;(function(t){function e(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(i=>z.string(i.kind)?xg.is(i)||Ng.is(i)||Dg.is(i):Pg.is(i)))}t.is=e})(Ig||(Ig={}));var bk;(function(t){function e(r){return{uri:r}}t.create=e;function n(r){let i=r;return z.defined(i)&&z.string(i.uri)}t.is=n})(bk||(bk={}));var Rk;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return z.defined(i)&&z.string(i.uri)&&z.integer(i.version)}t.is=n})(Rk||(Rk={}));var Og;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return z.defined(i)&&z.string(i.uri)&&(i.version===null||z.integer(i.version))}t.is=n})(Og||(Og={}));var $k;(function(t){function e(r,i,s,a){return{uri:r,languageId:i,version:s,text:a}}t.create=e;function n(r){let i=r;return z.defined(i)&&z.string(i.uri)&&z.string(i.languageId)&&z.integer(i.version)&&z.string(i.text)}t.is=n})($k||($k={}));var Lg;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(n){const r=n;return r===t.PlainText||r===t.Markdown}t.is=e})(Lg||(Lg={}));var pc;(function(t){function e(n){const r=n;return z.objectLiteral(n)&&Lg.is(r.kind)&&z.string(r.value)}t.is=e})(pc||(pc={}));var Ct;(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(Ct||(Ct={}));var Kn;(function(t){t.PlainText=1,t.Snippet=2})(Kn||(Kn={}));var kk;(function(t){t.Deprecated=1})(kk||(kk={}));var Tk;(function(t){function e(r,i,s){return{newText:r,insert:i,replace:s}}t.create=e;function n(r){const i=r;return i&&z.string(i.newText)&&je.is(i.insert)&&je.is(i.replace)}t.is=n})(Tk||(Tk={}));var Ek;(function(t){t.asIs=1,t.adjustIndentation=2})(Ek||(Ek={}));var Sk;(function(t){function e(n){const r=n;return r&&(z.string(r.detail)||r.detail===void 0)&&(z.string(r.description)||r.description===void 0)}t.is=e})(Sk||(Sk={}));var _k;(function(t){function e(n){return{label:n}}t.create=e})(_k||(_k={}));var Ak;(function(t){function e(n,r){return{items:n||[],isIncomplete:!!r}}t.create=e})(Ak||(Ak={}));var Af;(function(t){function e(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function n(r){const i=r;return z.string(i)||z.objectLiteral(i)&&z.string(i.language)&&z.string(i.value)}t.is=n})(Af||(Af={}));var Ck;(function(t){function e(n){let r=n;return!!r&&z.objectLiteral(r)&&(pc.is(r.contents)||Af.is(r.contents)||z.typedArray(r.contents,Af.is))&&(n.range===void 0||je.is(n.range))}t.is=e})(Ck||(Ck={}));var Pk;(function(t){function e(n,r){return r?{label:n,documentation:r}:{label:n}}t.create=e})(Pk||(Pk={}));var xk;(function(t){function e(n,r,...i){let s={label:n};return z.defined(r)&&(s.documentation=r),z.defined(i)?s.parameters=i:s.parameters=[],s}t.create=e})(xk||(xk={}));var Nk;(function(t){t.Text=1,t.Read=2,t.Write=3})(Nk||(Nk={}));var Dk;(function(t){function e(n,r){let i={range:n};return z.number(r)&&(i.kind=r),i}t.create=e})(Dk||(Dk={}));var ar;(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(ar||(ar={}));var Ik;(function(t){t.Deprecated=1})(Ik||(Ik={}));var Ok;(function(t){function e(n,r,i,s,a){let o={name:n,kind:r,location:{uri:s,range:i}};return a&&(o.containerName=a),o}t.create=e})(Ok||(Ok={}));var Lk;(function(t){function e(n,r,i,s){return s!==void 0?{name:n,kind:r,location:{uri:i,range:s}}:{name:n,kind:r,location:{uri:i}}}t.create=e})(Lk||(Lk={}));var Mk;(function(t){function e(r,i,s,a,o,c){let u={name:r,detail:i,kind:s,range:a,selectionRange:o};return c!==void 0&&(u.children=c),u}t.create=e;function n(r){let i=r;return i&&z.string(i.name)&&z.number(i.kind)&&je.is(i.range)&&je.is(i.selectionRange)&&(i.detail===void 0||z.string(i.detail))&&(i.deprecated===void 0||z.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=n})(Mk||(Mk={}));var zk;(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(zk||(zk={}));var Cf;(function(t){t.Invoked=1,t.Automatic=2})(Cf||(Cf={}));var Fk;(function(t){function e(r,i,s){let a={diagnostics:r};return i!=null&&(a.only=i),s!=null&&(a.triggerKind=s),a}t.create=e;function n(r){let i=r;return z.defined(i)&&z.typedArray(i.diagnostics,_f.is)&&(i.only===void 0||z.typedArray(i.only,z.string))&&(i.triggerKind===void 0||i.triggerKind===Cf.Invoked||i.triggerKind===Cf.Automatic)}t.is=n})(Fk||(Fk={}));var qk;(function(t){function e(r,i,s){let a={title:r},o=!0;return typeof i=="string"?(o=!1,a.kind=i):va.is(i)?a.command=i:a.edit=i,o&&s!==void 0&&(a.kind=s),a}t.create=e;function n(r){let i=r;return i&&z.string(i.title)&&(i.diagnostics===void 0||z.typedArray(i.diagnostics,_f.is))&&(i.kind===void 0||z.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||va.is(i.command))&&(i.isPreferred===void 0||z.boolean(i.isPreferred))&&(i.edit===void 0||Ig.is(i.edit))}t.is=n})(qk||(qk={}));var Gk;(function(t){function e(r,i){let s={range:r};return z.defined(i)&&(s.data=i),s}t.create=e;function n(r){let i=r;return z.defined(i)&&je.is(i.range)&&(z.undefined(i.command)||va.is(i.command))}t.is=n})(Gk||(Gk={}));var jk;(function(t){function e(r,i){return{tabSize:r,insertSpaces:i}}t.create=e;function n(r){let i=r;return z.defined(i)&&z.uinteger(i.tabSize)&&z.boolean(i.insertSpaces)}t.is=n})(jk||(jk={}));var Bk;(function(t){function e(r,i,s){return{range:r,target:i,data:s}}t.create=e;function n(r){let i=r;return z.defined(i)&&je.is(i.range)&&(z.undefined(i.target)||z.string(i.target))}t.is=n})(Bk||(Bk={}));var Uk;(function(t){function e(r,i){return{range:r,parent:i}}t.create=e;function n(r){let i=r;return z.objectLiteral(i)&&je.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=n})(Uk||(Uk={}));var De;(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(De||(De={}));var Fe;(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(Fe||(Fe={}));var Wk;(function(t){function e(n){const r=n;return z.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}t.is=e})(Wk||(Wk={}));var Hk;(function(t){function e(r,i){return{range:r,text:i}}t.create=e;function n(r){const i=r;return i!=null&&je.is(i.range)&&z.string(i.text)}t.is=n})(Hk||(Hk={}));var Kk;(function(t){function e(r,i,s){return{range:r,variableName:i,caseSensitiveLookup:s}}t.create=e;function n(r){const i=r;return i!=null&&je.is(i.range)&&z.boolean(i.caseSensitiveLookup)&&(z.string(i.variableName)||i.variableName===void 0)}t.is=n})(Kk||(Kk={}));var Vk;(function(t){function e(r,i){return{range:r,expression:i}}t.create=e;function n(r){const i=r;return i!=null&&je.is(i.range)&&(z.string(i.expression)||i.expression===void 0)}t.is=n})(Vk||(Vk={}));var Xk;(function(t){function e(r,i){return{frameId:r,stoppedLocation:i}}t.create=e;function n(r){const i=r;return z.defined(i)&&je.is(r.stoppedLocation)}t.is=n})(Xk||(Xk={}));var Mg;(function(t){t.Type=1,t.Parameter=2;function e(n){return n===1||n===2}t.is=e})(Mg||(Mg={}));var zg;(function(t){function e(r){return{value:r}}t.create=e;function n(r){const i=r;return z.objectLiteral(i)&&(i.tooltip===void 0||z.string(i.tooltip)||pc.is(i.tooltip))&&(i.location===void 0||Sf.is(i.location))&&(i.command===void 0||va.is(i.command))}t.is=n})(zg||(zg={}));var Yk;(function(t){function e(r,i,s){const a={position:r,label:i};return s!==void 0&&(a.kind=s),a}t.create=e;function n(r){const i=r;return z.objectLiteral(i)&&et.is(i.position)&&(z.string(i.label)||z.typedArray(i.label,zg.is))&&(i.kind===void 0||Mg.is(i.kind))&&i.textEdits===void 0||z.typedArray(i.textEdits,Sn.is)&&(i.tooltip===void 0||z.string(i.tooltip)||pc.is(i.tooltip))&&(i.paddingLeft===void 0||z.boolean(i.paddingLeft))&&(i.paddingRight===void 0||z.boolean(i.paddingRight))}t.is=n})(Yk||(Yk={}));var Jk;(function(t){function e(n){return{kind:"snippet",value:n}}t.createSnippet=e})(Jk||(Jk={}));var Qk;(function(t){function e(n,r,i,s){return{insertText:n,filterText:r,range:i,command:s}}t.create=e})(Qk||(Qk={}));var Zk;(function(t){function e(n){return{items:n}}t.create=e})(Zk||(Zk={}));var eT;(function(t){t.Invoked=0,t.Automatic=1})(eT||(eT={}));var tT;(function(t){function e(n,r){return{range:n,text:r}}t.create=e})(tT||(tT={}));var nT;(function(t){function e(n,r){return{triggerKind:n,selectedCompletionInfo:r}}t.create=e})(nT||(nT={}));var rT;(function(t){function e(n){const r=n;return z.objectLiteral(r)&&Sg.is(r.uri)&&z.string(r.name)}t.is=e})(rT||(rT={}));var iT;(function(t){function e(s,a,o,c){return new mq(s,a,o,c)}t.create=e;function n(s){let a=s;return!!(z.defined(a)&&z.string(a.uri)&&(z.undefined(a.languageId)||z.string(a.languageId))&&z.uinteger(a.lineCount)&&z.func(a.getText)&&z.func(a.positionAt)&&z.func(a.offsetAt))}t.is=n;function r(s,a){let o=s.getText(),c=i(a,(l,d)=>{let f=l.range.start.line-d.range.start.line;return f===0?l.range.start.character-d.range.start.character:f}),u=o.length;for(let l=c.length-1;l>=0;l--){let d=c[l],f=s.offsetAt(d.range.start),h=s.offsetAt(d.range.end);if(h<=u)o=o.substring(0,f)+d.newText+o.substring(h,o.length);else throw new Error("Overlapping edit");u=f}return o}t.applyEdits=r;function i(s,a){if(s.length<=1)return s;const o=s.length/2|0,c=s.slice(0,o),u=s.slice(o);i(c,a),i(u,a);let l=0,d=0,f=0;for(;l<c.length&&d<u.length;)a(c[l],u[d])<=0?s[f++]=c[l++]:s[f++]=u[d++];for(;l<c.length;)s[f++]=c[l++];for(;d<u.length;)s[f++]=u[d++];return s}})(iT||(iT={}));let mq=class{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){this._content=e.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],n=this._content,r=!0;for(let i=0;i<n.length;i++){r&&(e.push(i),r=!1);let s=n.charAt(i);r=s==="\r"||s===`
134
- `,s==="\r"&&i+1<n.length&&n.charAt(i+1)===`
135
- `&&i++}r&&n.length>0&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return et.create(0,e);for(;r<i;){let a=Math.floor((r+i)/2);n[a]>e?i=a:r=a+1}let s=r-1;return et.create(s,e-n[s])}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}};var z;(function(t){const e=Object.prototype.toString;function n(h){return typeof h<"u"}t.defined=n;function r(h){return typeof h>"u"}t.undefined=r;function i(h){return h===!0||h===!1}t.boolean=i;function s(h){return e.call(h)==="[object String]"}t.string=s;function a(h){return e.call(h)==="[object Number]"}t.number=a;function o(h,m,y){return e.call(h)==="[object Number]"&&m<=h&&h<=y}t.numberRange=o;function c(h){return e.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}t.integer=c;function u(h){return e.call(h)==="[object Number]"&&0<=h&&h<=2147483647}t.uinteger=u;function l(h){return e.call(h)==="[object Function]"}t.func=l;function d(h){return h!==null&&typeof h=="object"}t.objectLiteral=d;function f(h,m){return Array.isArray(h)&&h.every(m)}t.typedArray=f})(z||(z={}));class gq{constructor(){this.nodeStack=[]}get current(){var e;return(e=this.nodeStack[this.nodeStack.length-1])!==null&&e!==void 0?e:this.rootNode}buildRootNode(e){return this.rootNode=new aT(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const n=new qg;return n.grammarSource=e,n.root=this.rootNode,this.current.content.push(n),this.nodeStack.push(n),n}buildLeafNode(e,n){const r=new Fg(e.startOffset,e.image.length,vd(e),e.tokenType,!n);return r.grammarSource=n,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){const n=e.container;if(n){const r=n.content.indexOf(e);r>=0&&n.content.splice(r,1)}}addHiddenNodes(e){const n=[];for(const s of e){const a=new Fg(s.startOffset,s.image.length,vd(s),s.tokenType,!0);a.root=this.rootNode,n.push(a)}let r=this.current,i=!1;if(r.content.length>0){r.content.push(...n);return}for(;r.container;){const s=r.container.content.indexOf(r);if(s>0){r.container.content.splice(s,0,...n),i=!0;break}r=r.container}i||this.rootNode.content.unshift(...n)}construct(e){const n=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=n;const r=this.nodeStack.pop();r?.content.length===0&&this.removeNode(r)}}class sT{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,n;const r=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(n=this.container)===null||n===void 0?void 0:n.astNode;if(!r)throw new Error("This node has no associated AST element");return r}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}}class Fg extends sT{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,n,r,i,s=!1){super(),this._hidden=s,this._offset=e,this._tokenType=i,this._length=n,this._range=r}}class qg extends sT{constructor(){super(...arguments),this.content=new rw(this)}get children(){return this.content}get offset(){var e,n;return(n=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&n!==void 0?n:0}get length(){return this.end-this.offset}get end(){var e,n;return(n=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&n!==void 0?n:0}get range(){const e=this.firstNonHiddenNode,n=this.lastNonHiddenNode;if(e&&n){if(this._rangeCache===void 0){const{range:r}=e,{range:i}=n;this._rangeCache={start:r.start,end:i.end.line<r.start.line?r.start:i.end}}return this._rangeCache}else return{start:et.create(0,0),end:et.create(0,0)}}get firstNonHiddenNode(){for(const e of this.content)if(!e.hidden)return e;return this.content[0]}get lastNonHiddenNode(){for(let e=this.content.length-1;e>=0;e--){const n=this.content[e];if(!n.hidden)return n}return this.content[this.content.length-1]}}class rw extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,rw.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,n,...r){return this.addParents(r),super.splice(e,n,...r)}addParents(e){for(const n of e)n.container=this.parent}}class aT extends qg{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const Gg=Symbol("Datatype");function jg(t){return t.$type===Gg}const oT="\u200B",cT=t=>t.endsWith(oT)?t:t+oT;class uT{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;const n=this.lexer.definition,r=e.LanguageMetaData.mode==="production";this.wrapper=new Rq(n,Object.assign(Object.assign({},e.parser.ParserConfig),{skipValidations:r,errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,n){this.wrapper.wrapOr(e,n)}optional(e,n){this.wrapper.wrapOption(e,n)}many(e,n){this.wrapper.wrapMany(e,n)}atLeastOne(e,n){this.wrapper.wrapAtLeastOne(e,n)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}}class yq extends uT{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new gq,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,n){const r=this.computeRuleType(e),i=this.wrapper.DEFINE_RULE(cT(e.name),this.startImplementation(r,n).bind(this));return this.allRules.set(e.name,i),e.entry&&(this.mainRule=i),i}computeRuleType(e){if(!e.fragment){if(Md(e))return Gg;{const n=Zi(e);return n??e.name}}}parse(e,n={}){this.nodeBuilder.buildRootNode(e);const r=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=r.tokens;const i=n.rule?this.allRules.get(n.rule):this.mainRule;if(!i)throw new Error(n.rule?`No rule found with name '${n.rule}'`:"No main rule available.");const s=i.call(this.wrapper,{});return this.nodeBuilder.addHiddenNodes(r.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:s,lexerErrors:r.errors,lexerReport:r.report,parserErrors:this.wrapper.errors}}startImplementation(e,n){return r=>{const i=!this.isRecording()&&e!==void 0;if(i){const a={$type:e};this.stack.push(a),e===Gg&&(a.value="")}let s;try{s=n(r)}catch{s=void 0}return s===void 0&&i&&(s=this.construct()),s}}extractHiddenTokens(e){const n=this.lexerResult.hidden;if(!n.length)return[];const r=e.startOffset;for(let i=0;i<n.length;i++)if(n[i].startOffset>r)return n.splice(0,i);return n.splice(0,n.length)}consume(e,n,r){const i=this.wrapper.wrapConsume(e,n);if(!this.isRecording()&&this.isValidToken(i)){const s=this.extractHiddenTokens(i);this.nodeBuilder.addHiddenNodes(s);const a=this.nodeBuilder.buildLeafNode(i,r),{assignment:o,isCrossRef:c}=this.getAssignment(r),u=this.current;if(o){const l=br(r)?i.image:this.converter.convert(i.image,a);this.assign(o.operator,o.feature,l,a,c)}else if(jg(u)){let l=i.image;br(r)||(l=this.converter.convert(l,a).toString()),u.value+=l}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,n,r,i,s){let a;!this.isRecording()&&!r&&(a=this.nodeBuilder.buildCompositeNode(i));const o=this.wrapper.wrapSubrule(e,n,s);!this.isRecording()&&a&&a.length>0&&this.performSubruleAssignment(o,i,a)}performSubruleAssignment(e,n,r){const{assignment:i,isCrossRef:s}=this.getAssignment(n);if(i)this.assign(i.operator,i.feature,e,r,s);else if(!i){const a=this.current;if(jg(a))a.value+=e.toString();else if(typeof e=="object"&&e){const c=this.assignWithoutOverride(e,a);this.stack.pop(),this.stack.push(c)}}}action(e,n){if(!this.isRecording()){let r=this.current;if(n.feature&&n.operator){r=this.construct(),this.nodeBuilder.removeNode(r.$cstNode),this.nodeBuilder.buildCompositeNode(n).content.push(r.$cstNode);const s={$type:e};this.stack.push(s),this.assign(n.operator,n.feature,r,r.$cstNode,!1)}else r.$type=e}}construct(){if(this.isRecording())return;const e=this.current;return hm(e),this.nodeBuilder.construct(e),this.stack.pop(),jg(e)?this.converter.convert(e.value,e.$cstNode):(mm(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){const n=tn(e,wr);this.assignmentMap.set(e,{assignment:n,isCrossRef:n?Ao(n.terminal):!1})}return this.assignmentMap.get(e)}assign(e,n,r,i,s){const a=this.current;let o;switch(s&&typeof r=="string"?o=this.linker.buildReference(a,n,i,r):o=r,e){case"=":{a[n]=o;break}case"?=":{a[n]=!0;break}case"+=":Array.isArray(a[n])||(a[n]=[]),a[n].push(o)}}assignWithoutOverride(e,n){for(const[i,s]of Object.entries(n)){const a=e[i];a===void 0?e[i]=s:Array.isArray(a)&&Array.isArray(s)&&(s.push(...a),e[i]=s)}const r=e.$cstNode;return r&&(r.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}}class vq{buildMismatchTokenMessage(e){return ma.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return ma.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return ma.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return ma.buildEarlyExitMessage(e)}}class lT extends vq{buildMismatchTokenMessage({expected:e,actual:n}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${n.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}}class wq extends uT{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();const n=this.lexer.tokenize(e,{mode:"partial"});return this.tokens=n.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,n){const r=this.wrapper.DEFINE_RULE(cT(e.name),this.startImplementation(n).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return n=>{const r=this.keepStackSize();try{e(n)}finally{this.resetStackSize(r)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){const e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,n,r){this.wrapper.wrapConsume(e,n),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(e,n,r,i,s){this.before(i),this.wrapper.wrapSubrule(e,n,s),this.after(i)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){const n=this.elementStack.lastIndexOf(e);n>=0&&this.elementStack.splice(n)}}get currIdx(){return this.wrapper.currIdx}}const bq={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new lT};class Rq extends AF{constructor(e,n){const r=n&&"maxLookahead"in n;super(e,Object.assign(Object.assign(Object.assign({},bq),{lookaheadStrategy:r?new yg({maxLookahead:n.maxLookahead}):new XF({logging:n.skipValidations?()=>{}:void 0})}),n))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,n){return this.RULE(e,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,n){return this.consume(e,n)}wrapSubrule(e,n,r){return this.subrule(e,n,{ARGS:[r]})}wrapOr(e,n){this.or(e,n)}wrapOption(e,n){this.option(e,n)}wrapMany(e,n){this.many(e,n)}wrapAtLeastOne(e,n){this.atLeastOne(e,n)}}function dT(t,e,n){return $q({parser:e,tokens:n,ruleNames:new Map},t),e}function $q(t,e){const n=bm(e,!1),r=nt(e.rules).filter(en).filter(i=>n.has(i));for(const i of r){const s=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});t.parser.rule(i,cs(s,i.definition))}}function cs(t,e,n=!1){let r;if(br(e))r=Cq(t,e);else if(Qi(e))r=kq(t,e);else if(wr(e))r=cs(t,e.terminal);else if(Ao(e))r=fT(t,e);else if(Mr(e))r=Tq(t,e);else if(dm(e))r=Sq(t,e);else if(fm(e))r=_q(t,e);else if(yi(e))r=Aq(t,e);else if(yN(e)){const i=t.consume++;r=()=>t.parser.consume(i,$i,e)}else throw new gb(e.$cstNode,`Unexpected element type: ${e.$type}`);return hT(t,n?void 0:Pf(e),r,e.cardinality)}function kq(t,e){const n=Wo(e);return()=>t.parser.action(n,e)}function Tq(t,e){const n=e.rule.ref;if(en(n)){const r=t.subrule++,i=n.fragment,s=e.arguments.length>0?Eq(n,e.arguments):()=>({});return a=>t.parser.subrule(r,pT(t,n),i,e,s(a))}else if(Lr(n)){const r=t.consume++,i=Bg(t,n.name);return()=>t.parser.consume(r,i,e)}else if(n)oo();else throw new gb(e.$cstNode,`Undefined rule: ${e.rule.$refText}`)}function Eq(t,e){const n=e.map(r=>Hr(r.value));return r=>{const i={};for(let s=0;s<n.length;s++){const a=t.parameters[s],o=n[s];i[a.name]=o(r)}return i}}function Hr(t){if(lN(t)){const e=Hr(t.left),n=Hr(t.right);return r=>e(r)||n(r)}else if(uN(t)){const e=Hr(t.left),n=Hr(t.right);return r=>e(r)&&n(r)}else if(dN(t)){const e=Hr(t.value);return n=>!e(n)}else if(fN(t)){const e=t.parameter.ref.name;return n=>n!==void 0&&n[e]===!0}else if(cN(t)){const e=!!t.true;return()=>e}oo()}function Sq(t,e){if(e.elements.length===1)return cs(t,e.elements[0]);{const n=[];for(const i of e.elements){const s={ALT:cs(t,i,!0)},a=Pf(i);a&&(s.GATE=Hr(a)),n.push(s)}const r=t.or++;return i=>t.parser.alternatives(r,n.map(s=>{const a={ALT:()=>s.ALT(i)},o=s.GATE;return o&&(a.GATE=()=>o(i)),a}))}}function _q(t,e){if(e.elements.length===1)return cs(t,e.elements[0]);const n=[];for(const o of e.elements){const c={ALT:cs(t,o,!0)},u=Pf(o);u&&(c.GATE=Hr(u)),n.push(c)}const r=t.or++,i=(o,c)=>{const u=c.getRuleStack().join("-");return`uGroup_${o}_${u}`},s=o=>t.parser.alternatives(r,n.map((c,u)=>{const l={ALT:()=>!0},d=t.parser;l.ALT=()=>{if(c.ALT(o),!d.isRecording()){const h=i(r,d);d.unorderedGroups.get(h)||d.unorderedGroups.set(h,[]);const m=d.unorderedGroups.get(h);typeof m?.[u]>"u"&&(m[u]=!0)}};const f=c.GATE;return f?l.GATE=()=>f(o):l.GATE=()=>{const h=d.unorderedGroups.get(i(r,d));return!h?.[u]},l})),a=hT(t,Pf(e),s,"*");return o=>{a(o),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(r,t.parser))}}function Aq(t,e){const n=e.elements.map(r=>cs(t,r));return r=>n.forEach(i=>i(r))}function Pf(t){if(yi(t))return t.guardCondition}function fT(t,e,n=e.terminal){if(n)if(Mr(n)&&en(n.rule.ref)){const r=n.rule.ref,i=t.subrule++;return s=>t.parser.subrule(i,pT(t,r),!1,e,s)}else if(Mr(n)&&Lr(n.rule.ref)){const r=t.consume++,i=Bg(t,n.rule.ref.name);return()=>t.parser.consume(r,i,e)}else if(br(n)){const r=t.consume++,i=Bg(t,n.value);return()=>t.parser.consume(r,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);const r=Em(e.type.ref),i=r?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+Wo(e.type.ref));return fT(t,e,i)}}function Cq(t,e){const n=t.consume++,r=t.tokens[e.value];if(!r)throw new Error("Could not find token for keyword: "+e.value);return()=>t.parser.consume(n,r,e)}function hT(t,e,n,r){const i=e&&Hr(e);if(!r)if(i){const s=t.or++;return a=>t.parser.alternatives(s,[{ALT:()=>n(a),GATE:()=>i(a)},{ALT:X$(),GATE:()=>!i(a)}])}else return n;if(r==="*"){const s=t.many++;return a=>t.parser.many(s,{DEF:()=>n(a),GATE:i?()=>i(a):void 0})}else if(r==="+"){const s=t.many++;if(i){const a=t.or++;return o=>t.parser.alternatives(a,[{ALT:()=>t.parser.atLeastOne(s,{DEF:()=>n(o)}),GATE:()=>i(o)},{ALT:X$(),GATE:()=>!i(o)}])}else return a=>t.parser.atLeastOne(s,{DEF:()=>n(a)})}else if(r==="?"){const s=t.optional++;return a=>t.parser.optional(s,{DEF:()=>n(a),GATE:i?()=>i(a):void 0})}else oo()}function pT(t,e){const n=Pq(t,e),r=t.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function Pq(t,e){if(en(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let n=e,r=n.$container,i=e.$type;for(;!en(r);)(yi(r)||dm(r)||fm(r))&&(i=r.elements.indexOf(n).toString()+":"+i),n=r,r=r.$container;return i=r.name+":"+i,t.ruleNames.set(e,i),i}}function Bg(t,e){const n=t.tokens[e];if(!n)throw new Error(`Token "${e}" not found."`);return n}function xq(t){const e=t.Grammar,n=t.parser.Lexer,r=new wq(t);return dT(e,r,n.definition),r.finalize(),r}function Nq(t){const e=Dq(t);return e.finalize(),e}function Dq(t){const e=t.Grammar,n=t.parser.Lexer,r=new yq(t);return dT(e,r,n.definition)}class Iq{constructor(){this.diagnostics=[]}buildTokens(e,n){const r=nt(bm(e,!1)),i=this.buildTerminalTokens(r),s=this.buildKeywordTokens(r,i,n);return i.forEach(a=>{const o=a.PATTERN;typeof o=="object"&&o&&"test"in o&&wm(o)?s.unshift(a):s.push(a)}),s}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Lr).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(e){const n=Ho(e),r=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,i={name:e.name,PATTERN:r};return typeof r=="function"&&(i.LINE_BREAKS=!0),e.hidden&&(i.GROUP=wm(n)?En.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")||e.flags.includes("s")?!0:!!(e.source.includes("?<=")||e.source.includes("?<!"))}regexPatternFunction(e){const n=new RegExp(e,e.flags+"y");return(r,i)=>(n.lastIndex=i,n.exec(r))}buildKeywordTokens(e,n,r){return e.filter(en).flatMap(i=>Rr(i).filter(br)).distinct(i=>i.value).toArray().sort((i,s)=>s.value.length-i.value.length).map(i=>this.buildKeywordToken(i,n,!!r?.caseInsensitive))}buildKeywordToken(e,n,r){const i=this.buildKeywordPattern(e,r),s={name:e.value,PATTERN:i,LONGER_ALT:this.findLongerAlt(e,n)};return typeof i=="function"&&(s.LINE_BREAKS=!0),s}buildKeywordPattern(e,n){return n?new RegExp(NN(e.value)):e.value}findLongerAlt(e,n){return n.reduce((r,i)=>{const s=i?.PATTERN;return s?.source&&DN("^"+s.source+"$",e.value)&&r.push(i),r},[])}}class Oq{convert(e,n){let r=n.grammarSource;if(Ao(r)&&(r=Rm(r)),Mr(r)){const i=r.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,n)}return e}runConverter(e,n,r){var i;switch(e.name.toUpperCase()){case"INT":return Kr.convertInt(n);case"STRING":return Kr.convertString(n);case"ID":return Kr.convertID(n)}switch((i=Mb(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Kr.convertNumber(n);case"boolean":return Kr.convertBoolean(n);case"bigint":return Kr.convertBigint(n);case"date":return Kr.convertDate(n);default:return n}}}var Kr;(function(t){function e(u){let l="";for(let d=1;d<u.length-1;d++){const f=u.charAt(d);if(f==="\\"){const h=u.charAt(++d);l+=n(h)}else l+=f}return l}t.convertString=e;function n(u){switch(u){case"b":return"\b";case"f":return"\f";case"n":return`
136
- `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return u}}function r(u){return u.charAt(0)==="^"?u.substring(1):u}t.convertID=r;function i(u){return parseInt(u)}t.convertInt=i;function s(u){return BigInt(u)}t.convertBigint=s;function a(u){return new Date(u)}t.convertDate=a;function o(u){return Number(u)}t.convertNumber=o;function c(u){return u.toLowerCase()==="true"}t.convertBoolean=c})(Kr||(Kr={}));var us={},xf={},mT;function ls(){if(mT)return xf;mT=1,Object.defineProperty(xf,"__esModule",{value:!0});let t;function e(){if(t===void 0)throw new Error("No runtime abstraction layer installed");return t}return function(n){function r(i){if(i===void 0)throw new Error("No runtime abstraction layer provided");t=i}n.install=r}(e||(e={})),xf.default=e,xf}var Kt={},gT;function mc(){if(gT)return Kt;gT=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.stringArray=Kt.array=Kt.func=Kt.error=Kt.number=Kt.string=Kt.boolean=void 0;function t(o){return o===!0||o===!1}Kt.boolean=t;function e(o){return typeof o=="string"||o instanceof String}Kt.string=e;function n(o){return typeof o=="number"||o instanceof Number}Kt.number=n;function r(o){return o instanceof Error}Kt.error=r;function i(o){return typeof o=="function"}Kt.func=i;function s(o){return Array.isArray(o)}Kt.array=s;function a(o){return s(o)&&o.every(c=>e(c))}return Kt.stringArray=a,Kt}var ds={},yT;function ba(){if(yT)return ds;yT=1,Object.defineProperty(ds,"__esModule",{value:!0}),ds.Emitter=ds.Event=void 0;const t=ls();var e;(function(i){const s={dispose(){}};i.None=function(){return s}})(e||(ds.Event=e={}));class n{add(s,a=null,o){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(s),this._contexts.push(a),Array.isArray(o)&&o.push({dispose:()=>this.remove(s,a)})}remove(s,a=null){if(!this._callbacks)return;let o=!1;for(let c=0,u=this._callbacks.length;c<u;c++)if(this._callbacks[c]===s)if(this._contexts[c]===a){this._callbacks.splice(c,1),this._contexts.splice(c,1);return}else o=!0;if(o)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...s){if(!this._callbacks)return[];const a=[],o=this._callbacks.slice(0),c=this._contexts.slice(0);for(let u=0,l=o.length;u<l;u++)try{a.push(o[u].apply(c[u],s))}catch(d){(0,t.default)().console.error(d)}return a}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class r{constructor(s){this._options=s}get event(){return this._event||(this._event=(s,a,o)=>{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(s,a);const c={dispose:()=>{this._callbacks&&(this._callbacks.remove(s,a),c.dispose=r._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(o)&&o.push(c),c}),this._event}fire(s){this._callbacks&&this._callbacks.invoke.call(this._callbacks,s)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return ds.Emitter=r,r._noop=function(){},ds}var vT;function Nf(){if(vT)return us;vT=1,Object.defineProperty(us,"__esModule",{value:!0}),us.CancellationTokenSource=us.CancellationToken=void 0;const t=ls(),e=mc(),n=ba();var r;(function(o){o.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),o.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:n.Event.None});function c(u){const l=u;return l&&(l===o.None||l===o.Cancelled||e.boolean(l.isCancellationRequested)&&!!l.onCancellationRequested)}o.is=c})(r||(us.CancellationToken=r={}));const i=Object.freeze(function(o,c){const u=(0,t.default)().timer.setTimeout(o.bind(c),0);return{dispose(){u.dispose()}}});class s{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?i:(this._emitter||(this._emitter=new n.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class a{get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token.cancel():this._token=r.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=r.None}}return us.CancellationTokenSource=a,us}var ot=Nf();function Lq(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}let Df=0,Mq=10;function zq(){return Df=performance.now(),new ot.CancellationTokenSource}const If=Symbol("OperationCancelled");function Of(t){return t===If}async function Pt(t){if(t===ot.CancellationToken.None)return;const e=performance.now();if(e-Df>=Mq&&(Df=e,await Lq(),Df=performance.now()),t.isCancellationRequested)throw If}class Ug{constructor(){this.promise=new Promise((e,n)=>{this.resolve=r=>(e(r),this),this.reject=r=>(n(r),this)})}}class sd{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){const n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(let r of e)if(sd.isIncremental(r)){const i=bT(r.range),s=this.offsetAt(i.start),a=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(a,this._content.length);const o=Math.max(i.start.line,0),c=Math.max(i.end.line,0);let u=this._lineOffsets;const l=wT(r.text,!1,s);if(c-o===l.length)for(let f=0,h=l.length;f<h;f++)u[f+o+1]=l[f];else l.length<1e4?u.splice(o+1,c-o,...l):this._lineOffsets=u=u.slice(0,o+1).concat(l,u.slice(c+1));const d=r.text.length-(a-s);if(d!==0)for(let f=o+1+l.length,h=u.length;f<h;f++)u[f]=u[f]+d}else if(sd.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=wT(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return{line:0,character:e};for(;r<i;){let a=Math.floor((r+i)/2);n[a]>e?i=a:r=a+1}let s=r-1;return{line:s,character:e-n[s]}}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}}var Lf;(function(t){function e(i,s,a,o){return new sd(i,s,a,o)}t.create=e;function n(i,s,a){if(i instanceof sd)return i.update(s,a),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){let a=i.getText(),o=Wg(s.map(Fq),(l,d)=>{let f=l.range.start.line-d.range.start.line;return f===0?l.range.start.character-d.range.start.character:f}),c=0;const u=[];for(const l of o){let d=i.offsetAt(l.range.start);if(d<c)throw new Error("Overlapping edit");d>c&&u.push(a.substring(c,d)),l.newText.length&&u.push(l.newText),c=i.offsetAt(l.range.end)}return u.push(a.substr(c)),u.join("")}t.applyEdits=r})(Lf||(Lf={}));function Wg(t,e){if(t.length<=1)return t;const n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);Wg(r,e),Wg(i,e);let s=0,a=0,o=0;for(;s<r.length&&a<i.length;)e(r[s],i[a])<=0?t[o++]=r[s++]:t[o++]=i[a++];for(;s<r.length;)t[o++]=r[s++];for(;a<i.length;)t[o++]=i[a++];return t}function wT(t,e,n=0){const r=e?[n]:[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function bT(t){const e=t.start,n=t.end;return e.line>n.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function Fq(t){const e=bT(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var RT;(()=>{var t={470:i=>{function s(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}function a(c,u){for(var l,d="",f=0,h=-1,m=0,y=0;y<=c.length;++y){if(y<c.length)l=c.charCodeAt(y);else{if(l===47)break;l=47}if(l===47){if(!(h===y-1||m===1))if(h!==y-1&&m===2){if(d.length<2||f!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var R=d.lastIndexOf("/");if(R!==d.length-1){R===-1?(d="",f=0):f=(d=d.slice(0,R)).length-1-d.lastIndexOf("/"),h=y,m=0;continue}}else if(d.length===2||d.length===1){d="",f=0,h=y,m=0;continue}}u&&(d.length>0?d+="/..":d="..",f=2)}else d.length>0?d+="/"+c.slice(h+1,y):d=c.slice(h+1,y),f=y-h-1;h=y,m=0}else l===46&&m!==-1?++m:m=-1}return d}var o={resolve:function(){for(var c,u="",l=!1,d=arguments.length-1;d>=-1&&!l;d--){var f;d>=0?f=arguments[d]:(c===void 0&&(c=process.cwd()),f=c),s(f),f.length!==0&&(u=f+"/"+u,l=f.charCodeAt(0)===47)}return u=a(u,!l),l?u.length>0?"/"+u:"/":u.length>0?u:"."},normalize:function(c){if(s(c),c.length===0)return".";var u=c.charCodeAt(0)===47,l=c.charCodeAt(c.length-1)===47;return(c=a(c,!u)).length!==0||u||(c="."),c.length>0&&l&&(c+="/"),u?"/"+c:c},isAbsolute:function(c){return s(c),c.length>0&&c.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var c,u=0;u<arguments.length;++u){var l=arguments[u];s(l),l.length>0&&(c===void 0?c=l:c+="/"+l)}return c===void 0?".":o.normalize(c)},relative:function(c,u){if(s(c),s(u),c===u||(c=o.resolve(c))===(u=o.resolve(u)))return"";for(var l=1;l<c.length&&c.charCodeAt(l)===47;++l);for(var d=c.length,f=d-l,h=1;h<u.length&&u.charCodeAt(h)===47;++h);for(var m=u.length-h,y=f<m?f:m,R=-1,w=0;w<=y;++w){if(w===y){if(m>y){if(u.charCodeAt(h+w)===47)return u.slice(h+w+1);if(w===0)return u.slice(h+w)}else f>y&&(c.charCodeAt(l+w)===47?R=w:w===0&&(R=0));break}var k=c.charCodeAt(l+w);if(k!==u.charCodeAt(h+w))break;k===47&&(R=w)}var E="";for(w=l+R+1;w<=d;++w)w!==d&&c.charCodeAt(w)!==47||(E.length===0?E+="..":E+="/..");return E.length>0?E+u.slice(h+R):(h+=R,u.charCodeAt(h)===47&&++h,u.slice(h))},_makeLong:function(c){return c},dirname:function(c){if(s(c),c.length===0)return".";for(var u=c.charCodeAt(0),l=u===47,d=-1,f=!0,h=c.length-1;h>=1;--h)if((u=c.charCodeAt(h))===47){if(!f){d=h;break}}else f=!1;return d===-1?l?"/":".":l&&d===1?"//":c.slice(0,d)},basename:function(c,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');s(c);var l,d=0,f=-1,h=!0;if(u!==void 0&&u.length>0&&u.length<=c.length){if(u.length===c.length&&u===c)return"";var m=u.length-1,y=-1;for(l=c.length-1;l>=0;--l){var R=c.charCodeAt(l);if(R===47){if(!h){d=l+1;break}}else y===-1&&(h=!1,y=l+1),m>=0&&(R===u.charCodeAt(m)?--m==-1&&(f=l):(m=-1,f=y))}return d===f?f=y:f===-1&&(f=c.length),c.slice(d,f)}for(l=c.length-1;l>=0;--l)if(c.charCodeAt(l)===47){if(!h){d=l+1;break}}else f===-1&&(h=!1,f=l+1);return f===-1?"":c.slice(d,f)},extname:function(c){s(c);for(var u=-1,l=0,d=-1,f=!0,h=0,m=c.length-1;m>=0;--m){var y=c.charCodeAt(m);if(y!==47)d===-1&&(f=!1,d=m+1),y===46?u===-1?u=m:h!==1&&(h=1):u!==-1&&(h=-1);else if(!f){l=m+1;break}}return u===-1||d===-1||h===0||h===1&&u===d-1&&u===l+1?"":c.slice(u,d)},format:function(c){if(c===null||typeof c!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof c);return function(u,l){var d=l.dir||l.root,f=l.base||(l.name||"")+(l.ext||"");return d?d===l.root?d+f:d+"/"+f:f}(0,c)},parse:function(c){s(c);var u={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return u;var l,d=c.charCodeAt(0),f=d===47;f?(u.root="/",l=1):l=0;for(var h=-1,m=0,y=-1,R=!0,w=c.length-1,k=0;w>=l;--w)if((d=c.charCodeAt(w))!==47)y===-1&&(R=!1,y=w+1),d===46?h===-1?h=w:k!==1&&(k=1):h!==-1&&(k=-1);else if(!R){m=w+1;break}return h===-1||y===-1||k===0||k===1&&h===y-1&&h===m+1?y!==-1&&(u.base=u.name=m===0&&f?c.slice(1,y):c.slice(m,y)):(m===0&&f?(u.name=c.slice(1,h),u.base=c.slice(1,y)):(u.name=c.slice(m,h),u.base=c.slice(m,y)),u.ext=c.slice(h,y)),m>0?u.dir=c.slice(0,m-1):f&&(u.dir="/"),u},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,i.exports=o}},e={};function n(i){var s=e[i];if(s!==void 0)return s.exports;var a=e[i]={exports:{}};return t[i](a,a.exports,n),a.exports}n.d=(i,s)=>{for(var a in s)n.o(s,a)&&!n.o(i,a)&&Object.defineProperty(i,a,{enumerable:!0,get:s[a]})},n.o=(i,s)=>Object.prototype.hasOwnProperty.call(i,s),n.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var r={};(()=>{let i;n.r(r),n.d(r,{URI:()=>f,Utils:()=>oe}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);const s=/^\w[\w\d+.-]*$/,a=/^\//,o=/^\/\//;function c(L,S){if(!L.scheme&&S)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${L.authority}", path: "${L.path}", query: "${L.query}", fragment: "${L.fragment}"}`);if(L.scheme&&!s.test(L.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(L.path){if(L.authority){if(!a.test(L.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(o.test(L.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}const u="",l="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class f{static isUri(S){return S instanceof f||!!S&&typeof S.authority=="string"&&typeof S.fragment=="string"&&typeof S.path=="string"&&typeof S.query=="string"&&typeof S.scheme=="string"&&typeof S.fsPath=="string"&&typeof S.with=="function"&&typeof S.toString=="function"}scheme;authority;path;query;fragment;constructor(S,$,O,K,W,H=!1){typeof S=="object"?(this.scheme=S.scheme||u,this.authority=S.authority||u,this.path=S.path||u,this.query=S.query||u,this.fragment=S.fragment||u):(this.scheme=function($e,te){return $e||te?$e:"file"}(S,H),this.authority=$||u,this.path=function($e,te){switch($e){case"https":case"http":case"file":te?te[0]!==l&&(te=l+te):te=l}return te}(this.scheme,O||u),this.query=K||u,this.fragment=W||u,c(this,H))}get fsPath(){return k(this)}with(S){if(!S)return this;let{scheme:$,authority:O,path:K,query:W,fragment:H}=S;return $===void 0?$=this.scheme:$===null&&($=u),O===void 0?O=this.authority:O===null&&(O=u),K===void 0?K=this.path:K===null&&(K=u),W===void 0?W=this.query:W===null&&(W=u),H===void 0?H=this.fragment:H===null&&(H=u),$===this.scheme&&O===this.authority&&K===this.path&&W===this.query&&H===this.fragment?this:new m($,O,K,W,H)}static parse(S,$=!1){const O=d.exec(S);return O?new m(O[2]||u,I(O[4]||u),I(O[5]||u),I(O[7]||u),I(O[9]||u),$):new m(u,u,u,u,u)}static file(S){let $=u;if(i&&(S=S.replace(/\\/g,l)),S[0]===l&&S[1]===l){const O=S.indexOf(l,2);O===-1?($=S.substring(2),S=l):($=S.substring(2,O),S=S.substring(O)||l)}return new m("file",$,S,u,u)}static from(S){const $=new m(S.scheme,S.authority,S.path,S.query,S.fragment);return c($,!0),$}toString(S=!1){return E(this,S)}toJSON(){return this}static revive(S){if(S){if(S instanceof f)return S;{const $=new m(S);return $._formatted=S.external,$._fsPath=S._sep===h?S.fsPath:null,$}}return S}}const h=i?1:void 0;class m extends f{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=k(this)),this._fsPath}toString(S=!1){return S?E(this,!0):(this._formatted||(this._formatted=E(this,!1)),this._formatted)}toJSON(){const S={$mid:1};return this._fsPath&&(S.fsPath=this._fsPath,S._sep=h),this._formatted&&(S.external=this._formatted),this.path&&(S.path=this.path),this.scheme&&(S.scheme=this.scheme),this.authority&&(S.authority=this.authority),this.query&&(S.query=this.query),this.fragment&&(S.fragment=this.fragment),S}}const y={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function R(L,S,$){let O,K=-1;for(let W=0;W<L.length;W++){const H=L.charCodeAt(W);if(H>=97&&H<=122||H>=65&&H<=90||H>=48&&H<=57||H===45||H===46||H===95||H===126||S&&H===47||$&&H===91||$&&H===93||$&&H===58)K!==-1&&(O+=encodeURIComponent(L.substring(K,W)),K=-1),O!==void 0&&(O+=L.charAt(W));else{O===void 0&&(O=L.substr(0,W));const $e=y[H];$e!==void 0?(K!==-1&&(O+=encodeURIComponent(L.substring(K,W)),K=-1),O+=$e):K===-1&&(K=W)}}return K!==-1&&(O+=encodeURIComponent(L.substring(K))),O!==void 0?O:L}function w(L){let S;for(let $=0;$<L.length;$++){const O=L.charCodeAt($);O===35||O===63?(S===void 0&&(S=L.substr(0,$)),S+=y[O]):S!==void 0&&(S+=L[$])}return S!==void 0?S:L}function k(L,S){let $;return $=L.authority&&L.path.length>1&&L.scheme==="file"?`//${L.authority}${L.path}`:L.path.charCodeAt(0)===47&&(L.path.charCodeAt(1)>=65&&L.path.charCodeAt(1)<=90||L.path.charCodeAt(1)>=97&&L.path.charCodeAt(1)<=122)&&L.path.charCodeAt(2)===58?L.path[1].toLowerCase()+L.path.substr(2):L.path,i&&($=$.replace(/\//g,"\\")),$}function E(L,S){const $=S?w:R;let O="",{scheme:K,authority:W,path:H,query:$e,fragment:te}=L;if(K&&(O+=K,O+=":"),(W||K==="file")&&(O+=l,O+=l),W){let A=W.indexOf("@");if(A!==-1){const me=W.substr(0,A);W=W.substr(A+1),A=me.lastIndexOf(":"),A===-1?O+=$(me,!1,!1):(O+=$(me.substr(0,A),!1,!1),O+=":",O+=$(me.substr(A+1),!1,!0)),O+="@"}W=W.toLowerCase(),A=W.lastIndexOf(":"),A===-1?O+=$(W,!1,!0):(O+=$(W.substr(0,A),!1,!0),O+=W.substr(A))}if(H){if(H.length>=3&&H.charCodeAt(0)===47&&H.charCodeAt(2)===58){const A=H.charCodeAt(1);A>=65&&A<=90&&(H=`/${String.fromCharCode(A+32)}:${H.substr(3)}`)}else if(H.length>=2&&H.charCodeAt(1)===58){const A=H.charCodeAt(0);A>=65&&A<=90&&(H=`${String.fromCharCode(A+32)}:${H.substr(2)}`)}O+=$(H,!0,!1)}return $e&&(O+="?",O+=$($e,!1,!1)),te&&(O+="#",O+=S?te:R(te,!1,!1)),O}function _(L){try{return decodeURIComponent(L)}catch{return L.length>3?L.substr(0,3)+_(L.substr(3)):L}}const C=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function I(L){return L.match(C)?L.replace(C,S=>_(S)):L}var j=n(470);const J=j.posix||j,Z="/";var oe;(function(L){L.joinPath=function(S,...$){return S.with({path:J.join(S.path,...$)})},L.resolvePath=function(S,...$){let O=S.path,K=!1;O[0]!==Z&&(O=Z+O,K=!0);let W=J.resolve(O,...$);return K&&W[0]===Z&&!S.authority&&(W=W.substring(1)),S.with({path:W})},L.dirname=function(S){if(S.path.length===0||S.path===Z)return S;let $=J.dirname(S.path);return $.length===1&&$.charCodeAt(0)===46&&($=""),S.with({path:$})},L.basename=function(S){return J.basename(S.path)},L.extname=function(S){return J.extname(S.path)}})(oe||(oe={}))})(),RT=r})();const{URI:Vt,Utils:gc}=RT;var Tt;(function(t){t.basename=gc.basename,t.dirname=gc.dirname,t.extname=gc.extname,t.joinPath=gc.joinPath,t.resolvePath=gc.resolvePath;function e(i,s){return i?.toString()===s?.toString()}t.equals=e;function n(i,s){const a=typeof i=="string"?i:i.path,o=typeof s=="string"?s:s.path,c=a.split("/").filter(h=>h.length>0),u=o.split("/").filter(h=>h.length>0);let l=0;for(;l<c.length&&c[l]===u[l];l++);const d="../".repeat(c.length-l),f=u.slice(l).join("/");return d+f}t.relative=n;function r(i){return Vt.parse(i.toString()).toString()}t.normalize=r})(Tt||(Tt={}));var Be;(function(t){t[t.Changed=0]="Changed",t[t.Parsed=1]="Parsed",t[t.IndexedContent=2]="IndexedContent",t[t.ComputedScopes=3]="ComputedScopes",t[t.Linked=4]="Linked",t[t.IndexedReferences=5]="IndexedReferences",t[t.Validated=6]="Validated"})(Be||(Be={}));class qq{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,n=ot.CancellationToken.None){const r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,n)}fromTextDocument(e,n,r){return n=n??Vt.parse(e.uri),ot.CancellationToken.is(r)?this.createAsync(n,e,r):this.create(n,e,r)}fromString(e,n,r){return ot.CancellationToken.is(r)?this.createAsync(n,e,r):this.create(n,e,r)}fromModel(e,n){return this.create(n,{$model:e})}create(e,n,r){if(typeof n=="string"){const i=this.parse(e,n,r);return this.createLangiumDocument(i,e,void 0,n)}else if("$model"in n){const i={value:n.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,e)}else{const i=this.parse(e,n.getText(),r);return this.createLangiumDocument(i,e,n)}}async createAsync(e,n,r){if(typeof n=="string"){const i=await this.parseAsync(e,n,r);return this.createLangiumDocument(i,e,void 0,n)}else{const i=await this.parseAsync(e,n.getText(),r);return this.createLangiumDocument(i,e,n)}}createLangiumDocument(e,n,r,i){let s;if(r)s={parseResult:e,uri:n,state:Be.Parsed,references:[],textDocument:r};else{const a=this.createTextDocumentGetter(n,i);s={parseResult:e,uri:n,state:Be.Parsed,references:[],get textDocument(){return a()}}}return e.value.$document=s,s}async update(e,n){var r,i;const s=(r=e.parseResult.value.$cstNode)===null||r===void 0?void 0:r.root.fullText,a=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),o=a?a.getText():await this.fileSystemProvider.readFile(e.uri);if(a)Object.defineProperty(e,"textDocument",{value:a});else{const c=this.createTextDocumentGetter(e.uri,o);Object.defineProperty(e,"textDocument",{get:c})}return s!==o&&(e.parseResult=await this.parseAsync(e.uri,o,n),e.parseResult.value.$document=e),e.state=Be.Parsed,e}parse(e,n,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(n,r)}parseAsync(e,n,r){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(n,r)}createTextDocumentGetter(e,n){const r=this.serviceRegistry;let i;return()=>i??(i=Lf.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,n??""))}}class Gq{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return nt(this.documentMap.values())}addDocument(e){const n=e.uri.toString();if(this.documentMap.has(n))throw new Error(`A document with the URI '${n}' is already present.`);this.documentMap.set(n,e)}getDocument(e){const n=e.toString();return this.documentMap.get(n)}async getOrCreateDocument(e,n){let r=this.getDocument(e);return r||(r=await this.langiumDocumentFactory.fromUri(e,n),this.addDocument(r),r)}createDocument(e,n,r){if(r)return this.langiumDocumentFactory.fromString(n,e,r).then(i=>(this.addDocument(i),i));{const i=this.langiumDocumentFactory.fromString(n,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(this.serviceRegistry.getServices(e).references.Linker.unlink(r),r.state=Be.Changed,r.precomputedScopes=void 0,r.diagnostics=void 0),r}deleteDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(r.state=Be.Changed,this.documentMap.delete(n)),r}}const Hg=Symbol("ref_resolving");class jq{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,n=ot.CancellationToken.None){for(const r of zr(e.parseResult.value))await Pt(n),Pd(r).forEach(i=>this.doLink(i,e))}doLink(e,n){var r;const i=e.reference;if(i._ref===void 0){i._ref=Hg;try{const s=this.getCandidate(e);if(gd(s))i._ref=s;else if(i._nodeDescription=s,this.langiumDocuments().hasDocument(s.documentUri)){const a=this.loadAstNode(s);i._ref=a??this.createLinkingError(e,s)}else i._ref=void 0}catch(s){console.error(`An error occurred while resolving reference to '${i.$refText}':`,s);const a=(r=s.message)!==null&&r!==void 0?r:String(s);i._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${i.$refText}': ${a}`})}n.references.push(i)}}unlink(e){for(const n of e.references)delete n._ref,delete n._nodeDescription;e.references=[]}getCandidate(e){const r=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return r??this.createLinkingError(e)}buildReference(e,n,r,i){const s=this,a={$refNode:r,$refText:i,get ref(){var o;if(Rt(this._ref))return this._ref;if(nN(this._nodeDescription)){const c=s.loadAstNode(this._nodeDescription);this._ref=c??s.createLinkingError({reference:a,container:e,property:n},this._nodeDescription)}else if(this._ref===void 0){this._ref=Hg;const c=Cd(e).$document,u=s.getLinkedNode({reference:a,container:e,property:n});if(u.error&&c&&c.state<Be.ComputedScopes)return this._ref=void 0;this._ref=(o=u.node)!==null&&o!==void 0?o:u.error,this._nodeDescription=u.descr,c?.references.push(this)}else if(this._ref===Hg)throw new Error(`Cyclic reference resolution detected: ${s.astNodeLocator.getAstNodePath(e)}/${n} (symbol '${i}')`);return Rt(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return gd(this._ref)?this._ref:void 0}};return a}getLinkedNode(e){var n;try{const r=this.getCandidate(e);if(gd(r))return{error:r};const i=this.loadAstNode(r);return i?{node:i,descr:r}:{descr:r,error:this.createLinkingError(e,r)}}catch(r){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,r);const i=(n=r.message)!==null&&n!==void 0?n:String(r);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${i}`})}}}loadAstNode(e){if(e.node)return e.node;const n=this.langiumDocuments().getDocument(e.documentUri);if(n)return this.astNodeLocator.getAstNode(n.parseResult.value,e.path)}createLinkingError(e,n){const r=Cd(e.container).$document;r&&r.state<Be.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${r.uri}).`);const i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:n})}}function Mf(t){return typeof t.name=="string"}class $T{getName(e){if(Mf(e))return e.name}getNameNode(e){return nn(e.$cstNode,"name")}}class Bq{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const n=xb(e),r=e.astNode;if(n&&r){const i=r[n.feature];if(Gn(i))return i.ref;if(Array.isArray(i)){for(const s of i)if(Gn(s)&&s.$refNode&&s.$refNode.offset<=e.offset&&s.$refNode.end>=e.end)return s.ref}}if(r){const i=this.nameProvider.getNameNode(r);if(i&&(i===e||ub(e,i)))return r}}}findDeclarationNode(e){const n=this.findDeclaration(e);if(n?.$cstNode){const r=this.nameProvider.getNameNode(n);return r??n.$cstNode}}findReferences(e,n){const r=[];if(n.includeDeclaration){const s=this.getReferenceToSelf(e);s&&r.push(s)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return n.documentUri&&(i=i.filter(s=>Tt.equals(s.sourceUri,n.documentUri))),r.push(...i),nt(r)}getReferenceToSelf(e){const n=this.nameProvider.getNameNode(e);if(n){const r=gt(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:r.uri,sourcePath:i,targetUri:r.uri,targetPath:i,segment:ao(n),local:!0}}}}class Dn{constructor(e){if(this.map=new Map,e)for(const[n,r]of e)this.add(n,r)}get size(){return Zp.sum(nt(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,n){if(n===void 0)return this.map.delete(e);{const r=this.map.get(e);if(r){const i=r.indexOf(n);if(i>=0)return r.length===1?this.map.delete(e):r.splice(i,1),!0}return!1}}get(e){var n;return(n=this.map.get(e))!==null&&n!==void 0?n:[]}has(e,n){if(n===void 0)return this.map.has(e);{const r=this.map.get(e);return r?r.indexOf(n)>=0:!1}}add(e,n){return this.map.has(e)?this.map.get(e).push(n):this.map.set(e,[n]),this}addAll(e,n){return this.map.has(e)?this.map.get(e).push(...n):this.map.set(e,Array.from(n)),this}forEach(e){this.map.forEach((n,r)=>n.forEach(i=>e(i,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return nt(this.map.entries()).flatMap(([e,n])=>n.map(r=>[e,r]))}keys(){return nt(this.map.keys())}values(){return nt(this.map.values()).flat()}entriesGroupedByKey(){return nt(this.map.entries())}}class kT{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(const[n,r]of e)this.set(n,r)}clear(){this.map.clear(),this.inverse.clear()}set(e,n){return this.map.set(e,n),this.inverse.set(n,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){const n=this.map.get(e);return n!==void 0?(this.map.delete(e),this.inverse.delete(n),!0):!1}}class TT{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,n=ot.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,n)}async computeExportsForNode(e,n,r=Go,i=ot.CancellationToken.None){const s=[];this.exportNode(e,s,n);for(const a of r(e))await Pt(i),this.exportNode(a,s,n);return s}exportNode(e,n,r){const i=this.nameProvider.getName(e);i&&n.push(this.descriptions.createDescription(e,i,r))}async computeLocalScopes(e,n=ot.CancellationToken.None){const r=e.parseResult.value,i=new Dn;for(const s of Rr(r))await Pt(n),this.processNode(s,e,i);return i}processNode(e,n,r){const i=e.$container;if(i){const s=this.nameProvider.getName(e);s&&r.add(i,this.descriptions.createDescription(e,s,n))}}}class fs{constructor(e,n,r){var i;this.elements=e,this.outerScope=n,this.caseInsensitive=(i=r?.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){const n=this.caseInsensitive?this.elements.find(r=>r.name.toLowerCase()===e.toLowerCase()):this.elements.find(r=>r.name===e);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}}class ET{constructor(e,n,r){var i;this.elements=new Map,this.caseInsensitive=(i=r?.caseInsensitive)!==null&&i!==void 0?i:!1;for(const s of e){const a=this.caseInsensitive?s.name.toLowerCase():s.name;this.elements.set(a,s)}this.outerScope=n}getElement(e){const n=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(n);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=nt(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}const zf={getElement(){},getAllElements(){return ta}};class ST{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}}class Uq extends ST{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,n){this.throwIfDisposed(),this.cache.set(e,n)}get(e,n){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(n){const r=n();return this.cache.set(e,r),r}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class _T extends ST{constructor(e){super(),this.cache=new Map,this.converter=e??(n=>n)}has(e,n){return this.throwIfDisposed(),this.cacheForContext(e).has(n)}set(e,n,r){this.throwIfDisposed(),this.cacheForContext(e).set(n,r)}get(e,n,r){this.throwIfDisposed();const i=this.cacheForContext(e);if(i.has(n))return i.get(n);if(r){const s=r();return i.set(n,s),s}else return}delete(e,n){return this.throwIfDisposed(),this.cacheForContext(e).delete(n)}clear(e){if(this.throwIfDisposed(),e){const n=this.converter(e);this.cache.delete(n)}else this.cache.clear()}cacheForContext(e){const n=this.converter(e);let r=this.cache.get(n);return r||(r=new Map,this.cache.set(n,r)),r}}class AT extends _T{constructor(e,n){super(r=>r.toString()),n?(this.toDispose.push(e.workspace.DocumentBuilder.onDocumentPhase(n,r=>{this.clear(r.uri.toString())})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,i)=>{for(const s of i)this.clear(s)}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,i)=>{const s=r.concat(i);for(const a of s)this.clear(a)}))}}class CT extends Uq{constructor(e,n){super(),n?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(n,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,i)=>{i.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}class PT{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new CT(e.shared)}getScope(e){const n=[],r=this.reflection.getReferenceType(e),i=gt(e.container).precomputedScopes;if(i){let a=e.container;do{const o=i.get(a);o.length>0&&n.push(nt(o).filter(c=>this.reflection.isSubtype(c.type,r))),a=a.$container}while(a)}let s=this.getGlobalScope(r,e);for(let a=n.length-1;a>=0;a--)s=this.createScope(n[a],s);return s}createScope(e,n,r){return new fs(nt(e),n,r)}createScopeForNodes(e,n,r){const i=nt(e).map(s=>{const a=this.nameProvider.getName(s);if(a)return this.descriptions.createDescription(s,a)}).nonNullable();return new fs(i,n,r)}getGlobalScope(e,n){return this.globalScopeCache.get(e,()=>new ET(this.indexManager.allElements(e)))}}function Wq(t){return typeof t.$comment=="string"}function xT(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}class Hq{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,n){const r=n??{},i=n?.replacer,s=(o,c)=>this.replacer(o,c,r),a=i?(o,c)=>i(o,c,s):s;try{return this.currentDocument=gt(e),JSON.stringify(e,a,n?.space)}finally{this.currentDocument=void 0}}deserialize(e,n){const r=n??{},i=JSON.parse(e);return this.linkNode(i,i,r),i}replacer(e,n,{refText:r,sourceText:i,textRegions:s,comments:a,uriConverter:o}){var c,u,l,d;if(!this.ignoreProperties.has(e))if(Gn(n)){const f=n.ref,h=r?n.$refText:void 0;if(f){const m=gt(f);let y="";this.currentDocument&&this.currentDocument!==m&&(o?y=o(m.uri,n):y=m.uri.toString());const R=this.astNodeLocator.getAstNodePath(f);return{$ref:`${y}#${R}`,$refText:h}}else return{$error:(u=(c=n.error)===null||c===void 0?void 0:c.message)!==null&&u!==void 0?u:"Could not resolve reference",$refText:h}}else if(Rt(n)){let f;if(s&&(f=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},n)),(!e||n.$document)&&f?.$textRegion&&(f.$textRegion.documentURI=(l=this.currentDocument)===null||l===void 0?void 0:l.uri.toString())),i&&!e&&(f??(f=Object.assign({},n)),f.$sourceText=(d=n.$cstNode)===null||d===void 0?void 0:d.text),a){f??(f=Object.assign({},n));const h=this.commentProvider.getComment(n);h&&(f.$comment=h.replace(/\r/g,""))}return f??n}else return n}addAstNodeRegionWithAssignmentsTo(e){const n=r=>({offset:r.offset,end:r.end,length:r.length,range:r.range});if(e.$cstNode){const r=e.$textRegion=n(e.$cstNode),i=r.assignments={};return Object.keys(e).filter(s=>!s.startsWith("$")).forEach(s=>{const a=sa(e.$cstNode,s).map(n);a.length!==0&&(i[s]=a)}),e}}linkNode(e,n,r,i,s,a){for(const[c,u]of Object.entries(e))if(Array.isArray(u))for(let l=0;l<u.length;l++){const d=u[l];xT(d)?u[l]=this.reviveReference(e,c,n,d,r):Rt(d)&&this.linkNode(d,n,r,e,c,l)}else xT(u)?e[c]=this.reviveReference(e,c,n,u,r):Rt(u)&&this.linkNode(u,n,r,e,c);const o=e;o.$container=i,o.$containerProperty=s,o.$containerIndex=a}reviveReference(e,n,r,i,s){let a=i.$refText,o=i.$error;if(i.$ref){const c=this.getRefNode(r,i.$ref,s.uriConverter);if(Rt(c))return a||(a=this.nameProvider.getName(c)),{$refText:a??"",ref:c};o=c}if(o){const c={$refText:a??""};return c.error={container:e,property:n,message:o,reference:c},c}else return}getRefNode(e,n,r){try{const i=n.indexOf("#");if(i===0){const c=this.astNodeLocator.getAstNode(e,n.substring(1));return c||"Could not resolve path: "+n}if(i<0){const c=r?r(n):Vt.parse(n),u=this.langiumDocuments.getDocument(c);return u?u.parseResult.value:"Could not find document for URI: "+n}const s=r?r(n.substring(0,i)):Vt.parse(n.substring(0,i)),a=this.langiumDocuments.getDocument(s);if(!a)return"Could not find document for URI: "+n;if(i===n.length-1)return a.parseResult.value;const o=this.astNodeLocator.getAstNode(a.parseResult.value,n.substring(i+1));return o||"Could not resolve URI: "+n}catch(i){return String(i)}}}class Kq{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.textDocuments=e?.workspace.TextDocuments}register(e){const n=e.LanguageMetaData;for(const r of n.fileExtensions)this.fileExtensionMap.has(r)&&console.warn(`The file extension ${r} is used by multiple languages. It is now assigned to '${n.languageId}'.`),this.fileExtensionMap.set(r,e);this.languageIdMap.set(n.languageId,e),this.languageIdMap.size===1?this.singleton=e:this.singleton=void 0}getServices(e){var n,r;if(this.singleton!==void 0)return this.singleton;if(this.languageIdMap.size===0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const i=(r=(n=this.textDocuments)===null||n===void 0?void 0:n.get(e))===null||r===void 0?void 0:r.languageId;if(i!==void 0){const o=this.languageIdMap.get(i);if(o)return o}const s=Tt.extname(e),a=this.fileExtensionMap.get(s);if(!a)throw i?new Error(`The service registry contains no services for the extension '${s}' for language '${i}'.`):new Error(`The service registry contains no services for the extension '${s}'.`);return a}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}}function yc(t){return{code:t}}var Ff;(function(t){t.all=["fast","slow","built-in"]})(Ff||(Ff={}));class Vq{constructor(e){this.entries=new Dn,this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,n=this,r="fast"){if(r==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(const[i,s]of Object.entries(e)){const a=s;if(Array.isArray(a))for(const o of a){const c={check:this.wrapValidationException(o,n),category:r};this.addEntry(i,c)}else if(typeof a=="function"){const o={check:this.wrapValidationException(a,n),category:r};this.addEntry(i,o)}else oo()}}wrapValidationException(e,n){return async(r,i,s)=>{await this.handleException(()=>e.call(n,r,i,s),"An error occurred during validation",i,r)}}async handleException(e,n,r,i){try{await e()}catch(s){if(Of(s))throw s;console.error(`${n}:`,s),s instanceof Error&&s.stack&&console.error(s.stack);const a=s instanceof Error?s.message:String(s);r("error",`${n}: ${a}`,{node:i})}}addEntry(e,n){if(e==="AstNode"){this.entries.add("AstNode",n);return}for(const r of this.reflection.getAllSubTypes(e))this.entries.add(r,n)}getChecks(e,n){let r=nt(this.entries.get(e)).concat(this.entries.get("AstNode"));return n&&(r=r.filter(i=>n.includes(i.category))),r.map(i=>i.check)}registerBeforeDocument(e,n=this){this.entriesBefore.push(this.wrapPreparationException(e,"An error occurred during set-up of the validation",n))}registerAfterDocument(e,n=this){this.entriesAfter.push(this.wrapPreparationException(e,"An error occurred during tear-down of the validation",n))}wrapPreparationException(e,n,r){return async(i,s,a,o)=>{await this.handleException(()=>e.call(r,i,s,a,o),n,s,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}}class Xq{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,n={},r=ot.CancellationToken.None){const i=e.parseResult,s=[];if(await Pt(r),(!n.categories||n.categories.includes("built-in"))&&(this.processLexingErrors(i,s,n),n.stopAfterLexingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===or.LexingError})||(this.processParsingErrors(i,s,n),n.stopAfterParsingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===or.ParsingError}))||(this.processLinkingErrors(e,s,n),n.stopAfterLinkingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===or.LinkingError}))))return s;try{s.push(...await this.validateAst(i.value,n,r))}catch(a){if(Of(a))throw a;console.error("An error occurred during validation:",a)}return await Pt(r),s}processLexingErrors(e,n,r){var i,s,a;const o=[...e.lexerErrors,...(s=(i=e.lexerReport)===null||i===void 0?void 0:i.diagnostics)!==null&&s!==void 0?s:[]];for(const c of o){const u=(a=c.severity)!==null&&a!==void 0?a:"error",l={severity:Kg(u),range:{start:{line:c.line-1,character:c.column-1},end:{line:c.line-1,character:c.column+c.length-1}},message:c.message,data:Jq(u),source:this.getSource()};n.push(l)}}processParsingErrors(e,n,r){for(const i of e.parserErrors){let s;if(isNaN(i.token.startOffset)){if("previousToken"in i){const a=i.previousToken;if(isNaN(a.startOffset)){const o={line:0,character:0};s={start:o,end:o}}else{const o={line:a.endLine-1,character:a.endColumn};s={start:o,end:o}}}}else s=vd(i.token);if(s){const a={severity:Kg("error"),range:s,message:i.message,data:yc(or.ParsingError),source:this.getSource()};n.push(a)}}}processLinkingErrors(e,n,r){for(const i of e.references){const s=i.error;if(s){const a={node:s.container,property:s.property,index:s.index,data:{code:or.LinkingError,containerType:s.container.$type,property:s.property,refText:s.reference.$refText}};n.push(this.toDiagnostic("error",s.message,a))}}}async validateAst(e,n,r=ot.CancellationToken.None){const i=[],s=(a,o,c)=>{i.push(this.toDiagnostic(a,o,c))};return await this.validateAstBefore(e,n,s,r),await this.validateAstNodes(e,n,s,r),await this.validateAstAfter(e,n,s,r),i}async validateAstBefore(e,n,r,i=ot.CancellationToken.None){var s;const a=this.validationRegistry.checksBefore;for(const o of a)await Pt(i),await o(e,r,(s=n.categories)!==null&&s!==void 0?s:[],i)}async validateAstNodes(e,n,r,i=ot.CancellationToken.None){await Promise.all(zr(e).map(async s=>{await Pt(i);const a=this.validationRegistry.getChecks(s.$type,n.categories);for(const o of a)await o(s,r,i)}))}async validateAstAfter(e,n,r,i=ot.CancellationToken.None){var s;const a=this.validationRegistry.checksAfter;for(const o of a)await Pt(i),await o(e,r,(s=n.categories)!==null&&s!==void 0?s:[],i)}toDiagnostic(e,n,r){return{message:n,range:Yq(r),severity:Kg(e),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function Yq(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=nn(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=Uo(t.node.$cstNode,t.keyword,t.index)),e??(e=t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Kg(t){switch(t){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+t)}}function Jq(t){switch(t){case"error":return yc(or.LexingError);case"warning":return yc(or.LexingWarning);case"info":return yc(or.LexingInfo);case"hint":return yc(or.LexingHint);default:throw new Error("Invalid diagnostic severity: "+t)}}var or;(function(t){t.LexingError="lexing-error",t.LexingWarning="lexing-warning",t.LexingInfo="lexing-info",t.LexingHint="lexing-hint",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(or||(or={}));class Qq{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,n,r){const i=r??gt(e);n??(n=this.nameProvider.getName(e));const s=this.astNodeLocator.getAstNodePath(e);if(!n)throw new Error(`Node at path ${s} has no name.`);let a;const o=()=>{var c;return a??(a=ao((c=this.nameProvider.getNameNode(e))!==null&&c!==void 0?c:e.$cstNode))};return{node:e,name:n,get nameSegment(){return o()},selectionSegment:ao(e.$cstNode),type:e.$type,documentUri:i.uri,path:s}}}class Zq{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,n=ot.CancellationToken.None){const r=[],i=e.parseResult.value;for(const s of zr(i))await Pt(n),Pd(s).filter(a=>!gd(a)).forEach(a=>{const o=this.createDescription(a);o&&r.push(o)});return r}createDescription(e){const n=e.reference.$nodeDescription,r=e.reference.$refNode;if(!n||!r)return;const i=gt(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:n.documentUri,targetPath:n.path,segment:ao(r),local:Tt.equals(n.documentUri,i)}}}class eG{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){const n=this.getAstNodePath(e.$container),r=this.getPathSegment(e);return n+this.segmentSeparator+r}return""}getPathSegment({$containerProperty:e,$containerIndex:n}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return n!==void 0?e+this.indexSeparator+n:e}getAstNode(e,n){return n.split(this.segmentSeparator).reduce((i,s)=>{if(!i||s.length===0)return i;const a=s.indexOf(this.indexSeparator);if(a>0){const o=s.substring(0,a),c=parseInt(s.substring(a+1)),u=i[o];return u?.[c]}return i[s]},e)}}var tG=ba();class nG{constructor(e){this._ready=new Ug,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new tG.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var n,r;this.workspaceConfig=(r=(n=e.capabilities.workspace)===null||n===void 0?void 0:n.configuration)!==null&&r!==void 0?r:!1}async initialized(e){if(this.workspaceConfig){if(e.register){const n=this.serviceRegistry.all;e.register({section:n.map(r=>this.toSectionName(r.LanguageMetaData.languageId))})}if(e.fetchConfiguration){const n=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),r=await e.fetchConfiguration(n);n.forEach((i,s)=>{this.updateSectionConfiguration(i.section,r[s])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(n=>{const r=e.settings[n];this.updateSectionConfiguration(n,r),this.onConfigurationSectionUpdateEmitter.fire({section:n,configuration:r})})}updateSectionConfiguration(e,n){this.settings[e]=n}async getConfiguration(e,n){await this.ready;const r=this.toSectionName(e);if(this.settings[r])return this.settings[r][n]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}}var hs;(function(t){function e(n){return{dispose:async()=>await n()}}t.create=e})(hs||(hs={}));class rG{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Dn,this.documentPhaseListeners=new Dn,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=Be.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,n={},r=ot.CancellationToken.None){var i,s;for(const a of e){const o=a.uri.toString();if(a.state===Be.Validated){if(typeof n.validation=="boolean"&&n.validation)a.state=Be.IndexedReferences,a.diagnostics=void 0,this.buildState.delete(o);else if(typeof n.validation=="object"){const c=this.buildState.get(o),u=(i=c?.result)===null||i===void 0?void 0:i.validationChecks;if(u){const d=((s=n.validation.categories)!==null&&s!==void 0?s:Ff.all).filter(f=>!u.includes(f));d.length>0&&(this.buildState.set(o,{completed:!1,options:{validation:Object.assign(Object.assign({},n.validation),{categories:d})},result:c.result}),a.state=Be.IndexedReferences)}}}else this.buildState.delete(o)}this.currentState=Be.Changed,await this.emitUpdate(e.map(a=>a.uri),[]),await this.buildDocuments(e,n,r)}async update(e,n,r=ot.CancellationToken.None){this.currentState=Be.Changed;for(const a of n)this.langiumDocuments.deleteDocument(a),this.buildState.delete(a.toString()),this.indexManager.remove(a);for(const a of e){if(!this.langiumDocuments.invalidateDocument(a)){const c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},a);c.state=Be.Changed,this.langiumDocuments.addDocument(c)}this.buildState.delete(a.toString())}const i=nt(e).concat(n).map(a=>a.toString()).toSet();this.langiumDocuments.all.filter(a=>!i.has(a.uri.toString())&&this.shouldRelink(a,i)).forEach(a=>{this.serviceRegistry.getServices(a.uri).references.Linker.unlink(a),a.state=Math.min(a.state,Be.ComputedScopes),a.diagnostics=void 0}),await this.emitUpdate(e,n),await Pt(r);const s=this.sortDocuments(this.langiumDocuments.all.filter(a=>{var o;return a.state<Be.Linked||!(!((o=this.buildState.get(a.uri.toString()))===null||o===void 0)&&o.completed)}).toArray());await this.buildDocuments(s,this.updateBuildOptions,r)}async emitUpdate(e,n){await Promise.all(this.updateListeners.map(r=>r(e,n)))}sortDocuments(e){let n=0,r=e.length-1;for(;n<r;){for(;n<e.length&&this.hasTextDocument(e[n]);)n++;for(;r>=0&&!this.hasTextDocument(e[r]);)r--;n<r&&([e[n],e[r]]=[e[r],e[n]])}return e}hasTextDocument(e){var n;return!!(!((n=this.textDocuments)===null||n===void 0)&&n.get(e.uri))}shouldRelink(e,n){return e.references.some(r=>r.error!==void 0)?!0:this.indexManager.isAffected(e,n)}onUpdate(e){return this.updateListeners.push(e),hs.create(()=>{const n=this.updateListeners.indexOf(e);n>=0&&this.updateListeners.splice(n,1)})}async buildDocuments(e,n,r){this.prepareBuild(e,n),await this.runCancelable(e,Be.Parsed,r,s=>this.langiumDocumentFactory.update(s,r)),await this.runCancelable(e,Be.IndexedContent,r,s=>this.indexManager.updateContent(s,r)),await this.runCancelable(e,Be.ComputedScopes,r,async s=>{const a=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await a.computeLocalScopes(s,r)}),await this.runCancelable(e,Be.Linked,r,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,r)),await this.runCancelable(e,Be.IndexedReferences,r,s=>this.indexManager.updateReferences(s,r));const i=e.filter(s=>this.shouldValidate(s));await this.runCancelable(i,Be.Validated,r,s=>this.validate(s,r));for(const s of e){const a=this.buildState.get(s.uri.toString());a&&(a.completed=!0)}}prepareBuild(e,n){for(const r of e){const i=r.uri.toString(),s=this.buildState.get(i);(!s||s.completed)&&this.buildState.set(i,{completed:!1,options:n,result:s?.result})}}async runCancelable(e,n,r,i){const s=e.filter(o=>o.state<n);for(const o of s)await Pt(r),await i(o),o.state=n,await this.notifyDocumentPhase(o,n,r);const a=e.filter(o=>o.state===n);await this.notifyBuildPhase(a,n,r),this.currentState=n}onBuildPhase(e,n){return this.buildPhaseListeners.add(e,n),hs.create(()=>{this.buildPhaseListeners.delete(e,n)})}onDocumentPhase(e,n){return this.documentPhaseListeners.add(e,n),hs.create(()=>{this.documentPhaseListeners.delete(e,n)})}waitUntil(e,n,r){let i;if(n&&"path"in n?i=n:r=n,r??(r=ot.CancellationToken.None),i){const s=this.langiumDocuments.getDocument(i);if(s&&s.state>e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):r.isCancellationRequested?Promise.reject(If):new Promise((s,a)=>{const o=this.onBuildPhase(e,()=>{if(o.dispose(),c.dispose(),i){const u=this.langiumDocuments.getDocument(i);s(u?.uri)}else s(void 0)}),c=r.onCancellationRequested(()=>{o.dispose(),c.dispose(),a(If)})})}async notifyDocumentPhase(e,n,r){const s=this.documentPhaseListeners.get(n).slice();for(const a of s)try{await a(e,r)}catch(o){if(!Of(o))throw o}}async notifyBuildPhase(e,n,r){if(e.length===0)return;const s=this.buildPhaseListeners.get(n).slice();for(const a of s)await Pt(r),await a(e,r)}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,n){var r,i;const s=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,a=this.getBuildOptions(e).validation,o=typeof a=="object"?a:void 0,c=await s.validateDocument(e,o,n);e.diagnostics?e.diagnostics.push(...c):e.diagnostics=c;const u=this.buildState.get(e.uri.toString());if(u){(r=u.result)!==null&&r!==void 0||(u.result={});const l=(i=o?.categories)!==null&&i!==void 0?i:Ff.all;u.result.validationChecks?u.result.validationChecks.push(...l):u.result.validationChecks=[...l]}}getBuildOptions(e){var n,r;return(r=(n=this.buildState.get(e.uri.toString()))===null||n===void 0?void 0:n.options)!==null&&r!==void 0?r:{}}}class iG{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new _T,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,n){const r=gt(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(a=>{Tt.equals(a.targetUri,r)&&a.targetPath===n&&i.push(a)})}),nt(i)}allElements(e,n){let r=nt(this.symbolIndex.keys());return n&&(r=r.filter(i=>!n||n.has(i))),r.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,n){var r;return n?this.symbolByTypeIndex.get(e,n,()=>{var s;return((s=this.symbolIndex.get(e))!==null&&s!==void 0?s:[]).filter(o=>this.astReflection.isSubtype(o.type,n))}):(r=this.symbolIndex.get(e))!==null&&r!==void 0?r:[]}remove(e){const n=e.toString();this.symbolIndex.delete(n),this.symbolByTypeIndex.clear(n),this.referenceIndex.delete(n)}async updateContent(e,n=ot.CancellationToken.None){const i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,n),s=e.uri.toString();this.symbolIndex.set(s,i),this.symbolByTypeIndex.clear(s)}async updateReferences(e,n=ot.CancellationToken.None){const i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,n);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,n){const r=this.referenceIndex.get(e.uri.toString());return r?r.some(i=>!i.local&&n.has(i.targetUri.toString())):!1}}class NT{constructor(e){this.initialBuildOptions={},this._ready=new Ug,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(e){var n;this.folders=(n=e.workspaceFolders)!==null&&n!==void 0?n:void 0}initialized(e){return this.mutex.write(n=>{var r;return this.initializeWorkspace((r=this.folders)!==null&&r!==void 0?r:[],n)})}async initializeWorkspace(e,n=ot.CancellationToken.None){const r=await this.performStartup(e);await Pt(n),await this.documentBuilder.build(r,this.initialBuildOptions,n)}async performStartup(e){const n=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),r=[],i=s=>{r.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};return await this.loadAdditionalDocuments(e,i),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,n,i))),this._ready.resolve(),r}loadAdditionalDocuments(e,n){return Promise.resolve()}getRootFolder(e){return Vt.parse(e.uri)}async traverseFolder(e,n,r,i){const s=await this.fileSystemProvider.readDirectory(n);await Promise.all(s.map(async a=>{if(this.includeEntry(e,a,r)){if(a.isDirectory)await this.traverseFolder(e,a.uri,r,i);else if(a.isFile){const o=await this.langiumDocuments.getOrCreateDocument(a.uri);i(o)}}}))}includeEntry(e,n,r){const i=Tt.basename(n.uri);if(i.startsWith("."))return!1;if(n.isDirectory)return i!=="node_modules"&&i!=="out";if(n.isFile){const s=Tt.extname(n.uri);return r.includes(s)}return!1}}class sG{buildUnexpectedCharactersMessage(e,n,r,i,s){return sg.buildUnexpectedCharactersMessage(e,n,r,i,s)}buildUnableToPopLexerModeMessage(e){return sg.buildUnableToPopLexerModeMessage(e)}}const aG={mode:"full"};class oG{constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;const n=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(n);const r=IT(n)?Object.values(n):n,i=e.LanguageMetaData.mode==="production";this.chevrotainLexer=new En(r,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,n=aG){var r,i,s;const a=this.chevrotainLexer.tokenize(e);return{tokens:a.tokens,errors:a.errors,hidden:(r=a.groups.hidden)!==null&&r!==void 0?r:[],report:(s=(i=this.tokenBuilder).flushLexingReport)===null||s===void 0?void 0:s.call(i,e)}}toTokenTypeDictionary(e){if(IT(e))return e;const n=DT(e)?Object.values(e.modes).flat():e,r={};return n.forEach(i=>r[i.name]=i),r}}function cG(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function DT(t){return t&&"modes"in t&&"defaultMode"in t}function IT(t){return!cG(t)&&!DT(t)}function uG(t,e,n){let r,i;typeof t=="string"?(i=e,r=n):(i=t.range.start,r=e),i||(i=et.create(0,0));const s=OT(t),a=Xg(r),o=fG({lines:s,position:i,options:a});return yG({index:0,tokens:o,position:i})}function lG(t,e){const n=Xg(e),r=OT(t);if(r.length===0)return!1;const i=r[0],s=r[r.length-1],a=n.start,o=n.end;return!!a?.exec(i)&&!!o?.exec(s)}function OT(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(_b)}const LT=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,dG=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function fG(t){var e,n,r;const i=[];let s=t.position.line,a=t.position.character;for(let o=0;o<t.lines.length;o++){const c=o===0,u=o===t.lines.length-1;let l=t.lines[o],d=0;if(c&&t.options.start){const h=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);h&&(d=h.index+h[0].length)}else{const h=(n=t.options.line)===null||n===void 0?void 0:n.exec(l);h&&(d=h.index+h[0].length)}if(u){const h=(r=t.options.end)===null||r===void 0?void 0:r.exec(l);h&&(l=l.substring(0,h.index))}if(l=l.substring(0,gG(l)),Vg(l,d)>=l.length){if(i.length>0){const h=et.create(s,a);i.push({type:"break",content:"",range:je.create(h,h)})}}else{LT.lastIndex=d;const h=LT.exec(l);if(h){const m=h[0],y=h[1],R=et.create(s,a+d),w=et.create(s,a+d+m.length);i.push({type:"tag",content:y,range:je.create(R,w)}),d+=m.length,d=Vg(l,d)}if(d<l.length){const m=l.substring(d),y=Array.from(m.matchAll(dG));i.push(...hG(y,m,s,a+d))}}s++,a=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function hG(t,e,n,r){const i=[];if(t.length===0){const s=et.create(n,r),a=et.create(n,r+e.length);i.push({type:"text",content:e,range:je.create(s,a)})}else{let s=0;for(const o of t){const c=o.index,u=e.substring(s,c);u.length>0&&i.push({type:"text",content:e.substring(s,c),range:je.create(et.create(n,s+r),et.create(n,c+r))});let l=u.length+1;const d=o[1];if(i.push({type:"inline-tag",content:d,range:je.create(et.create(n,s+l+r),et.create(n,s+l+d.length+r))}),l+=d.length,o.length===4){l+=o[2].length;const f=o[3];i.push({type:"text",content:f,range:je.create(et.create(n,s+l+r),et.create(n,s+l+f.length+r))})}else i.push({type:"text",content:"",range:je.create(et.create(n,s+l+r),et.create(n,s+l+r))});s=c+o[0].length}const a=e.substring(s);a.length>0&&i.push({type:"text",content:a,range:je.create(et.create(n,s+r),et.create(n,s+r+a.length))})}return i}const pG=/\S/,mG=/\s*$/;function Vg(t,e){const n=t.substring(e).match(pG);return n?e+n.index:t.length}function gG(t){const e=t.match(mG);if(e&&typeof e.index=="number")return e.index}function yG(t){var e,n,r,i;const s=et.create(t.position.line,t.position.character);if(t.tokens.length===0)return new qT([],je.create(s,s));const a=[];for(;t.index<t.tokens.length;){const u=vG(t,a[a.length-1]);u&&a.push(u)}const o=(n=(e=a[0])===null||e===void 0?void 0:e.range.start)!==null&&n!==void 0?n:s,c=(i=(r=a[a.length-1])===null||r===void 0?void 0:r.range.end)!==null&&i!==void 0?i:s;return new qT(a,je.create(o,c))}function vG(t,e){const n=t.tokens[t.index];if(n.type==="tag")return zT(t,!1);if(n.type==="text"||n.type==="inline-tag")return MT(t);wG(n,e),t.index++}function wG(t,e){if(e){const n=new GT("",t.range);"inlines"in e?e.inlines.push(n):e.content.inlines.push(n)}}function MT(t){let e=t.tokens[t.index];const n=e;let r=e;const i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push(bG(t)),r=e,e=t.tokens[t.index];return new Qg(i,je.create(n.range.start,r.range.end))}function bG(t){return t.tokens[t.index].type==="inline-tag"?zT(t,!0):FT(t)}function zT(t,e){const n=t.tokens[t.index++],r=n.content.substring(1),i=t.tokens[t.index];if(i?.type==="text")if(e){const s=FT(t);return new Jg(r,new Qg([s],s.range),e,je.create(n.range.start,s.range.end))}else{const s=MT(t);return new Jg(r,s,e,je.create(n.range.start,s.range.end))}else{const s=n.range;return new Jg(r,new Qg([],s),e,s)}}function FT(t){const e=t.tokens[t.index++];return new GT(e.content,e.range)}function Xg(t){if(!t)return Xg({start:"/**",end:"*/",line:"*"});const{start:e,end:n,line:r}=t;return{start:Yg(e,!0),end:Yg(n,!1),line:Yg(r,!0)}}function Yg(t,e){if(typeof t=="string"||typeof t=="object"){const n=typeof t=="string"?Od(t):t.source;return e?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}else return t}class qT{constructor(e,n){this.elements=e,this.range=n}getTag(e){return this.getAllTags().find(n=>n.name===e)}getTags(e){return this.getAllTags().filter(n=>n.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(const n of this.elements)if(e.length===0)e=n.toString();else{const r=n.toString();e+=jT(e)+r}return e.trim()}toMarkdown(e){let n="";for(const r of this.elements)if(n.length===0)n=r.toMarkdown(e);else{const i=r.toMarkdown(e);n+=jT(n)+i}return n.trim()}}class Jg{constructor(e,n,r,i){this.name=e,this.content=n,this.inline=r,this.range=i}toString(){let e=`@${this.name}`;const n=this.content.toString();return this.content.inlines.length===1?e=`${e} ${n}`:this.content.inlines.length>1&&(e=`${e}
137
- ${n}`),this.inline?`{${e}}`:e}toMarkdown(e){var n,r;return(r=(n=e?.renderTag)===null||n===void 0?void 0:n.call(e,this))!==null&&r!==void 0?r:this.toMarkdownDefault(e)}toMarkdownDefault(e){const n=this.content.toMarkdown(e);if(this.inline){const s=RG(this.name,n,e??{});if(typeof s=="string")return s}let r="";e?.tag==="italic"||e?.tag===void 0?r="*":e?.tag==="bold"?r="**":e?.tag==="bold-italic"&&(r="***");let i=`${r}@${this.name}${r}`;return this.content.inlines.length===1?i=`${i} \u2014 ${n}`:this.content.inlines.length>1&&(i=`${i}
138
- ${n}`),this.inline?`{${i}}`:i}}function RG(t,e,n){var r,i;if(t==="linkplain"||t==="linkcode"||t==="link"){const s=e.indexOf(" ");let a=e;if(s>0){const c=Vg(e,s);a=e.substring(c),e=e.substring(0,s)}return(t==="linkcode"||t==="link"&&n.link==="code")&&(a=`\`${a}\``),(i=(r=n.renderLink)===null||r===void 0?void 0:r.call(n,e,a))!==null&&i!==void 0?i:$G(e,a)}}function $G(t,e){try{return Vt.parse(t,!0),`[${e}](${t})`}catch{return t}}class Qg{constructor(e,n){this.inlines=e,this.range=n}toString(){let e="";for(let n=0;n<this.inlines.length;n++){const r=this.inlines[n],i=this.inlines[n+1];e+=r.toString(),i&&i.range.start.line>r.range.start.line&&(e+=`
139
- `)}return e}toMarkdown(e){let n="";for(let r=0;r<this.inlines.length;r++){const i=this.inlines[r],s=this.inlines[r+1];n+=i.toMarkdown(e),s&&s.range.start.line>i.range.start.line&&(n+=`
140
- `)}return n}}class GT{constructor(e,n){this.text=e,this.range=n}toString(){return this.text}toMarkdown(){return this.text}}function jT(t){return t.endsWith(`
141
- `)?`
142
- `:`
143
-
144
- `}class kG{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const n=this.commentProvider.getComment(e);if(n&&lG(n))return uG(n).toMarkdown({renderLink:(i,s)=>this.documentationLinkRenderer(e,i,s),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,n,r){var i;const s=(i=this.findNameInPrecomputedScopes(e,n))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,n);if(s&&s.nameSegment){const a=s.nameSegment.range.start.line+1,o=s.nameSegment.range.start.character+1,c=s.documentUri.with({fragment:`L${a},${o}`});return`[${r}](${c.toString()})`}else return}documentationTagRenderer(e,n){}findNameInPrecomputedScopes(e,n){const i=gt(e).precomputedScopes;if(!i)return;let s=e;do{const o=i.get(s).find(c=>c.name===n);if(o)return o;s=s.$container}while(s)}findNameInGlobalScope(e,n){return this.indexManager.allElements().find(i=>i.name===n)}}class TG{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var n;return Wq(e)?e.$comment:(n=wd(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||n===void 0?void 0:n.text}}class EG{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,n){return Promise.resolve(this.syncParser.parse(e))}}class SG{constructor(){this.previousTokenSource=new ot.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const n=zq();return this.previousTokenSource=n,this.enqueue(this.writeQueue,e,n.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,n,r=ot.CancellationToken.None){const i=new Ug,s={action:n,deferred:i,cancellationToken:r};return e.push(s),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;const e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:n,deferred:r,cancellationToken:i})=>{try{const s=await Promise.resolve().then(()=>n(i));r.resolve(s)}catch(s){Of(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class _G{constructor(e){this.grammarElementIdMap=new kT,this.tokenTypeIdMap=new kT,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(n=>Object.assign(Object.assign({},n),{message:n.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){const n=new Map,r=new Map;for(const i of zr(e))n.set(i,{});if(e.$cstNode)for(const i of so(e.$cstNode))r.set(i,{});return{astNodes:n,cstNodes:r}}dehydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,n));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];r[i]=a;for(const o of s)Rt(o)?a.push(this.dehydrateAstNode(o,n)):Gn(o)?a.push(this.dehydrateReference(o,n)):a.push(o)}else Rt(s)?r[i]=this.dehydrateAstNode(s,n):Gn(s)?r[i]=this.dehydrateReference(s,n):s!==void 0&&(r[i]=s);return r}dehydrateReference(e,n){const r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=n.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,n){const r=n.cstNodes.get(e);return ob(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=n.astNodes.get(e.astNode),mi(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,n)):Ji(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){const n=e.value,r=this.createHydrationContext(n);return"$cstNode"in n&&this.hydrateCstNode(n.$cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(n,r)}}createHydrationContext(e){const n=new Map,r=new Map;for(const s of zr(e))n.set(s,{});let i;if(e.$cstNode)for(const s of so(e.$cstNode)){let a;"fullText"in s?(a=new aT(s.fullText),i=a):"content"in s?a=new qg:"tokenType"in s&&(a=this.hydrateCstLeafNode(s)),a&&(r.set(s,a),a.root=i)}return{astNodes:n,cstNodes:r}}hydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=n.cstNodes.get(e.$cstNode));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];r[i]=a;for(const o of s)Rt(o)?a.push(this.setParent(this.hydrateAstNode(o,n),r)):Gn(o)?a.push(this.hydrateReference(o,r,i,n)):a.push(o)}else Rt(s)?r[i]=this.setParent(this.hydrateAstNode(s,n),r):Gn(s)?r[i]=this.hydrateReference(s,r,i,n):s!==void 0&&(r[i]=s);return r}setParent(e,n){return e.$container=n,e}hydrateReference(e,n,r,i){return this.linker.buildReference(n,r,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,n,r=0){const i=n.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=n.astNodes.get(e.astNode),mi(i))for(const s of e.content){const a=this.hydrateCstNode(s,n,r++);i.content.push(a)}return i}hydrateCstLeafNode(e){const n=this.getTokenType(e.tokenType),r=e.offset,i=e.length,s=e.startLine,a=e.startColumn,o=e.endLine,c=e.endColumn,u=e.hidden;return new Fg(r,i,{start:{line:s,character:a},end:{line:o,character:c}},n,u)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(const n of zr(this.grammar))am(n)&&this.grammarElementIdMap.set(n,e++)}}function BT(t){return{documentation:{CommentProvider:e=>new TG(e),DocumentationProvider:e=>new kG(e)},parser:{AsyncParser:e=>new EG(e),GrammarConfig:e=>BN(e),LangiumParser:e=>Nq(e),CompletionParser:e=>xq(e),ValueConverter:()=>new Oq,TokenBuilder:()=>new Iq,Lexer:e=>new oG(e),ParserErrorMessageProvider:()=>new lT,LexerErrorMessageProvider:()=>new sG},workspace:{AstNodeLocator:()=>new eG,AstNodeDescriptionProvider:e=>new Qq(e),ReferenceDescriptionProvider:e=>new Zq(e)},references:{Linker:e=>new jq(e),NameProvider:()=>new $T,ScopeProvider:e=>new PT(e),ScopeComputation:e=>new TT(e),References:e=>new Bq(e)},serializer:{Hydrator:e=>new _G(e),JsonSerializer:e=>new Hq(e)},validation:{DocumentValidator:e=>new Xq(e),ValidationRegistry:e=>new Vq(e)},shared:()=>t.shared}}function UT(t){return{ServiceRegistry:e=>new Kq(e),workspace:{LangiumDocuments:e=>new Gq(e),LangiumDocumentFactory:e=>new qq(e),DocumentBuilder:e=>new rG(e),IndexManager:e=>new iG(e),WorkspaceManager:e=>new NT(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new SG,ConfigurationProvider:e=>new nG(e)}}}var qf;(function(t){t.merge=(e,n)=>jf(jf({},e),n)})(qf||(qf={}));function Gf(t,e,n,r,i,s,a,o,c){const u=[t,e,n,r,i,s,a,o,c].reduce(jf,{});return HT(u)}const WT=Symbol("isProxy");function Zg(t){if(t&&t[WT])for(const e of Object.values(t))Zg(e);return t}function HT(t,e){const n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(r,i)=>i===WT?!0:VT(r,i,t,e||n),getOwnPropertyDescriptor:(r,i)=>(VT(r,i,t,e||n),Object.getOwnPropertyDescriptor(r,i)),has:(r,i)=>i in t,ownKeys:()=>[...Object.getOwnPropertyNames(t)]});return n}const KT=Symbol();function VT(t,e,n,r){if(e in t){if(t[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:t[e]});if(t[e]===KT)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in n){const i=n[e];t[e]=KT;try{t[e]=typeof i=="function"?i(r):HT(i,r)}catch(s){throw t[e]=s instanceof Error?s:void 0,s}return t[e]}else return}function jf(t,e){if(e){for(const[n,r]of Object.entries(e))if(r!==void 0){const i=t[n];i!==null&&r!==null&&typeof i=="object"&&typeof r=="object"?t[n]=jf(i,r):t[n]=r}}return t}class AG{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const XT={fileSystemProvider:()=>new AG},CG={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},PG={AstReflection:()=>new $b};function xG(){const t=Gf(UT(XT),PG),e=Gf(BT({shared:t}),CG);return t.ServiceRegistry.register(e),e}function NG(t){var e;const n=xG(),r=n.serializer.JsonSerializer.deserialize(t);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,Vt.parse(`memory://${(e=r.name)!==null&&e!==void 0?e:"grammar"}.langium`)),r}var DG={done:!0,hasNext:!1},vc={done:!1,hasNext:!1},IG=()=>DG,OG=t=>({hasNext:!0,next:t,done:!1});function Je(t,...e){let n=t,r=e.map(s=>"lazy"in s?LG(s):void 0),i=0;for(;i<e.length;){if(r[i]===void 0||!MG(n)){let c=e[i];n=c(n),i+=1;continue}let s=[];for(let c=i;c<e.length;c++){let u=r[c];if(u===void 0||(s.push(u),u.isSingle))break}let a=[];for(let c of n)if(YT(c,a,s))break;let{isSingle:o}=s.at(-1);n=o?a[0]:a,i+=s.length}return n}function YT(t,e,n){if(n.length===0)return e.push(t),!1;let r=t,i=vc,s=!1;for(let[a,o]of n.entries()){let{index:c,items:u}=o;if(u.push(r),i=o(r,c,u),o.index+=1,i.hasNext){if(i.hasMany??!1){for(let l of i.next)if(YT(l,e,n.slice(a+1)))return!0;return s}r=i.next}if(!i.hasNext)break;i.done&&(s=!0)}return i.hasNext&&e.push(r),s}function LG(t){let{lazy:e,lazyArgs:n}=t,r=e(...n);return Object.assign(r,{isSingle:e.single??!1,index:0,items:[]})}function MG(t){return typeof t=="string"||typeof t=="object"&&t!==null&&Symbol.iterator in t}function JT(t,e){let n=e.length-t.length;if(n===1){let[r,...i]=e;return Je(r,{lazy:t,lazyArgs:i})}if(n===0){let r={lazy:t,lazyArgs:e};return Object.assign(i=>Je(i,r),r)}throw new Error("Wrong number of arguments")}function zG(t,e,n){let r=i=>t(i,...e);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:e})}function rt(t,e,n){let r=t.length-e.length;if(r===0)return t(...e);if(r===1)return zG(t,e,n);throw new Error("Wrong number of arguments")}function wc(...t){return rt(Object.values,t)}function bc(...t){return JT(FG,t)}function FG(){let t=new Set;return e=>t.has(e)?vc:(t.add(e),{done:!1,hasNext:!0,next:e})}function qG(...t){return rt(GG,t,jG)}var GG=(t,e)=>e<0?[]:t.slice(0,e);function jG(t){if(t<=0)return IG;let e=t;return n=>(e-=1,{done:e<=0,hasNext:!0,next:n})}function _r(...t){return rt(BG,t)}var BG=(t,e)=>t.length>=e;function UG(...t){return rt(WG,t)}function WG(t,e){return e(t),t}function QT(...t){return rt(HG,t)}function HG(t,e){let n=[...t];return n.sort(e),n}function ey(...t){return rt(KG,t)}var KG=(t,e,n)=>t.reduce(e,n);function ZT(...t){return rt(VG,t)}function VG(t){return[...t].reverse()}function Rc(...t){return rt(XG,t)}var XG=(t,e)=>t[e];function YG(...t){return rt(JG,t)}function JG(t,e){if(!_r(e,1))return{...t};if(!_r(e,2)){let{[e[0]]:r,...i}=t;return i}let n={...t};for(let r of e)delete n[r];return n}function $c(...t){return rt(QG,t)}function QG(t,e){let n={};for(let[r,i]of Object.entries(t)){let s=e(i,r,t);n[r]=s}return n}function ie(t){return!!t}function kc(...t){return rt(ZG,t)}var ZG=t=>t.at(-1);function rn(...t){return rt(ej,t,tj)}var ej=(t,e)=>t.map(e),tj=t=>(e,n,r)=>({done:!1,hasNext:!0,next:t(e,n,r)});function Ar(...t){return rt(nj,t)}function nj(t,e){let n={};for(let[r,i]of t.entries()){let[s,a]=e(i,r,t);n[s]=a}return n}function Bf(t){return typeof t=="number"&&!Number.isNaN(t)}function rj(t){return t instanceof Promise}function eE(t){return typeof t=="string"}function Lt(t){return t===void 0?!0:typeof t=="string"||Array.isArray(t)?t.length===0:Object.keys(t).length===0}function sn(t){return t!=null}function vt(t){return t==null}function ij(t){return Array.isArray(t)}function ty(t){return typeof t=="boolean"}function Xt(t){return t!==void 0}function sj(t,{triggerAt:e="end",minQuietPeriodMs:n,maxBurstDurationMs:r,minGapMs:i,reducer:s=aj}){let a,o,c,u,l=()=>{let h=c;h!==void 0&&(c=void 0,t(h),o=setTimeout(d,i))},d=()=>{clearTimeout(o),o=void 0,a===void 0&&l()},f=()=>{clearTimeout(a),a=void 0,u=void 0,o===void 0&&l()};return{call:(...h)=>{let m=a===void 0&&o===void 0;if((e!=="start"||m)&&(c=s(c,...h)),!(a===void 0&&!m)){{clearTimeout(a);let y=Date.now();u??=y;let R=Math.min(n,r-(y-u));a=setTimeout(f,R)}e!=="end"&&m&&l()}},cancel:()=>{clearTimeout(a),a=void 0,u=void 0,clearTimeout(o),o=void 0,c=void 0},flush:()=>{f(),d()},get isIdle(){return a===void 0&&o===void 0}}}var aj=()=>"";function ps(...t){return rt(oj,t)}var oj=(t,e)=>{let n={};for(let[r,i]of t.entries()){let s=e(i,r,t);if(s!==void 0){let{[s]:a}=n;a===void 0&&(a=[],n[s]=a),a.push(i)}}return n};function cj(){return uj}var uj=t=>t;function ny(...t){return rt(lj,t)}function lj(t,e){let n={};for(let[r,i]of t.entries()){let s=e(i,r,t);n[s]=i}return n}function Si(...t){return rt(dj,t,fj)}var dj=(t,e)=>t.flatMap(e),fj=t=>(e,n,r)=>{let i=t(e,n,r);return Array.isArray(i)?{done:!1,hasNext:!0,hasMany:!0,next:i}:{done:!1,hasNext:!0,next:i}};function hj(...t){return rt(pj,t,mj)}function pj(t,e){return t.forEach(e),t}var mj=t=>(e,n,r)=>(t(e,n,r),{done:!1,hasNext:!0,next:e});function Uf(...t){return rt(gj,t)}function gj(t,e){for(let[n,r]of Object.entries(t))e(r,n,t);return t}function yj(...t){return rt(Object.fromEntries,t)}function Wf(...t){return rt(Object.entries,t)}function Ge(...t){return rt(vj,t,wj)}var vj=(t,e)=>t.filter(e),wj=t=>(e,n,r)=>t(e,n,r)?{done:!1,hasNext:!0,next:e}:vc,tE=t=>Object.assign(t,{single:!0});function nE(...t){return rt(bj,t,tE(Rj))}var bj=(t,e)=>t.find(e),Rj=t=>(e,n,r)=>t(e,n,r)?{done:!0,hasNext:!0,next:e}:vc;function rE(...t){return rt($j,t)}var $j=(t,e)=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(e(r,n,t))return r}};function Ra(...t){return rt(kj,t,tE(Tj))}var kj=([t])=>t,Tj=()=>Ej,Ej=t=>({hasNext:!0,next:t,done:!0});function iE(...t){return rt(Sj,t)}var Sj=(t,e)=>[...t,...e];function _j(...t){return JT(Aj,t)}function Aj(t){if(t.length===0)return OG;let e=new Map;for(let n of t)e.set(n,(e.get(n)??0)+1);return n=>{let r=e.get(n);return r===void 0||r===0?{done:!1,hasNext:!0,next:n}:(e.set(n,r-1),vc)}}function Cj(...t){return rt(Pj,t)}var Pj=(t,e)=>e.some(n=>n(t));function xj(...t){return rt(Nj,t)}function Nj(t,e){if(e<1)throw new RangeError(`chunk: A chunk size of '${e.toString()}' would result in an infinite array`);if(t.length===0)return[];if(e>=t.length)return[[...t]];let n=Math.ceil(t.length/e),r=new Array(n);if(e===1)for(let[i,s]of t.entries())r[i]=[s];else for(let i=0;i<n;i+=1){let s=i*e;r[i]=t.slice(s,s+e)}return r}function sE(...t){return rt(Dj,t)}var Dj=(t,{min:e,max:n})=>e!==void 0&&t<e?e:n!==void 0&&t>n?n:t,Ij={reset:[0,0],bold:[1,22,"\x1B[22m\x1B[1m"],dim:[2,22,"\x1B[22m\x1B[2m"],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]},Oj=Object.entries(Ij);function ry(t){return String(t)}ry.open="",ry.close="";function Lj(t=!1){let e=typeof process<"u"?process:void 0,n=e?.env||{},r=e?.argv||[];return!("NO_COLOR"in n||r.includes("--no-color"))&&("FORCE_COLOR"in n||r.includes("--color")||e?.platform==="win32"||t&&n.TERM!=="dumb"||"CI"in n)||typeof window<"u"&&!!window.chrome}function Mj(t=!1){let e=Lj(t),n=(a,o,c,u)=>{let l="",d=0;do l+=a.substring(d,u)+c,d=u+o.length,u=a.indexOf(o,d);while(~u);return l+a.substring(d)},r=(a,o,c=a)=>{let u=l=>{let d=String(l),f=d.indexOf(o,a.length);return~f?a+n(d,o,c,f)+o:a+d+o};return u.open=a,u.close=o,u},i={isColorSupported:e},s=a=>`\x1B[${a}m`;for(let[a,o]of Oj)i[a]=e?r(s(o[0]),s(o[1]),o[2]):ry;return i}var zj=process.env.FORCE_TTY!==void 0||XA(1),lt=Mj(zj),ms={},Et={},aE;function iy(){if(aE)return Et;aE=1,Object.defineProperty(Et,"__esModule",{value:!0}),Et.thenable=Et.typedArray=Et.stringArray=Et.array=Et.func=Et.error=Et.number=Et.string=Et.boolean=void 0;function t(u){return u===!0||u===!1}Et.boolean=t;function e(u){return typeof u=="string"||u instanceof String}Et.string=e;function n(u){return typeof u=="number"||u instanceof Number}Et.number=n;function r(u){return u instanceof Error}Et.error=r;function i(u){return typeof u=="function"}Et.func=i;function s(u){return Array.isArray(u)}Et.array=s;function a(u){return s(u)&&u.every(l=>e(l))}Et.stringArray=a;function o(u,l){return Array.isArray(u)&&u.every(l)}Et.typedArray=o;function c(u){return u&&i(u.then)}return Et.thenable=c,Et}var He={},gs={},ys={},Hf={},sy={},ye={},oE;function cE(){if(oE)return ye;oE=1,Object.defineProperty(ye,"__esModule",{value:!0}),ye.Message=ye.NotificationType9=ye.NotificationType8=ye.NotificationType7=ye.NotificationType6=ye.NotificationType5=ye.NotificationType4=ye.NotificationType3=ye.NotificationType2=ye.NotificationType1=ye.NotificationType0=ye.NotificationType=ye.RequestType9=ye.RequestType8=ye.RequestType7=ye.RequestType6=ye.RequestType5=ye.RequestType4=ye.RequestType3=ye.RequestType2=ye.RequestType1=ye.RequestType=ye.RequestType0=ye.AbstractMessageSignature=ye.ParameterStructures=ye.ResponseError=ye.ErrorCodes=void 0;const t=mc();var e;(function(S){S.ParseError=-32700,S.InvalidRequest=-32600,S.MethodNotFound=-32601,S.InvalidParams=-32602,S.InternalError=-32603,S.jsonrpcReservedErrorRangeStart=-32099,S.serverErrorStart=-32099,S.MessageWriteError=-32099,S.MessageReadError=-32098,S.PendingResponseRejected=-32097,S.ConnectionInactive=-32096,S.ServerNotInitialized=-32002,S.UnknownErrorCode=-32001,S.jsonrpcReservedErrorRangeEnd=-32e3,S.serverErrorEnd=-32e3})(e||(ye.ErrorCodes=e={}));class n extends Error{constructor($,O,K){super(O),this.code=t.number($)?$:e.UnknownErrorCode,this.data=K,Object.setPrototypeOf(this,n.prototype)}toJson(){const $={code:this.code,message:this.message};return this.data!==void 0&&($.data=this.data),$}}ye.ResponseError=n;class r{constructor($){this.kind=$}static is($){return $===r.auto||$===r.byName||$===r.byPosition}toString(){return this.kind}}ye.ParameterStructures=r,r.auto=new r("auto"),r.byPosition=new r("byPosition"),r.byName=new r("byName");class i{constructor($,O){this.method=$,this.numberOfParams=O}get parameterStructures(){return r.auto}}ye.AbstractMessageSignature=i;class s extends i{constructor($){super($,0)}}ye.RequestType0=s;class a extends i{constructor($,O=r.auto){super($,1),this._parameterStructures=O}get parameterStructures(){return this._parameterStructures}}ye.RequestType=a;class o extends i{constructor($,O=r.auto){super($,1),this._parameterStructures=O}get parameterStructures(){return this._parameterStructures}}ye.RequestType1=o;class c extends i{constructor($){super($,2)}}ye.RequestType2=c;class u extends i{constructor($){super($,3)}}ye.RequestType3=u;class l extends i{constructor($){super($,4)}}ye.RequestType4=l;class d extends i{constructor($){super($,5)}}ye.RequestType5=d;class f extends i{constructor($){super($,6)}}ye.RequestType6=f;class h extends i{constructor($){super($,7)}}ye.RequestType7=h;class m extends i{constructor($){super($,8)}}ye.RequestType8=m;class y extends i{constructor($){super($,9)}}ye.RequestType9=y;class R extends i{constructor($,O=r.auto){super($,1),this._parameterStructures=O}get parameterStructures(){return this._parameterStructures}}ye.NotificationType=R;class w extends i{constructor($){super($,0)}}ye.NotificationType0=w;class k extends i{constructor($,O=r.auto){super($,1),this._parameterStructures=O}get parameterStructures(){return this._parameterStructures}}ye.NotificationType1=k;class E extends i{constructor($){super($,2)}}ye.NotificationType2=E;class _ extends i{constructor($){super($,3)}}ye.NotificationType3=_;class C extends i{constructor($){super($,4)}}ye.NotificationType4=C;class I extends i{constructor($){super($,5)}}ye.NotificationType5=I;class j extends i{constructor($){super($,6)}}ye.NotificationType6=j;class J extends i{constructor($){super($,7)}}ye.NotificationType7=J;class Z extends i{constructor($){super($,8)}}ye.NotificationType8=Z;class oe extends i{constructor($){super($,9)}}ye.NotificationType9=oe;var L;return function(S){function $(W){const H=W;return H&&t.string(H.method)&&(t.string(H.id)||t.number(H.id))}S.isRequest=$;function O(W){const H=W;return H&&t.string(H.method)&&W.id===void 0}S.isNotification=O;function K(W){const H=W;return H&&(H.result!==void 0||!!H.error)&&(t.string(H.id)||t.number(H.id)||H.id===null)}S.isResponse=K}(L||(ye.Message=L={})),ye}var Vr={},uE;function lE(){if(uE)return Vr;uE=1;var t;Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.LRUCache=Vr.LinkedMap=Vr.Touch=void 0;var e;(function(i){i.None=0,i.First=1,i.AsOld=i.First,i.Last=2,i.AsNew=i.Last})(e||(Vr.Touch=e={}));class n{constructor(){this[t]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(s){return this._map.has(s)}get(s,a=e.None){const o=this._map.get(s);if(o)return a!==e.None&&this.touch(o,a),o.value}set(s,a,o=e.None){let c=this._map.get(s);if(c)c.value=a,o!==e.None&&this.touch(c,o);else{switch(c={key:s,value:a,next:void 0,previous:void 0},o){case e.None:this.addItemLast(c);break;case e.First:this.addItemFirst(c);break;case e.Last:this.addItemLast(c);break;default:this.addItemLast(c);break}this._map.set(s,c),this._size++}return this}delete(s){return!!this.remove(s)}remove(s){const a=this._map.get(s);if(a)return this._map.delete(s),this.removeItem(a),this._size--,a.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const s=this._head;return this._map.delete(s.key),this.removeItem(s),this._size--,s.value}forEach(s,a){const o=this._state;let c=this._head;for(;c;){if(a?s.bind(a)(c.value,c.key,this):s(c.value,c.key,this),this._state!==o)throw new Error("LinkedMap got modified during iteration.");c=c.next}}keys(){const s=this._state;let a=this._head;const o={[Symbol.iterator]:()=>o,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(a){const c={value:a.key,done:!1};return a=a.next,c}else return{value:void 0,done:!0}}};return o}values(){const s=this._state;let a=this._head;const o={[Symbol.iterator]:()=>o,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(a){const c={value:a.value,done:!1};return a=a.next,c}else return{value:void 0,done:!0}}};return o}entries(){const s=this._state;let a=this._head;const o={[Symbol.iterator]:()=>o,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(a){const c={value:[a.key,a.value],done:!1};return a=a.next,c}else return{value:void 0,done:!0}}};return o}[(t=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(s){if(s>=this.size)return;if(s===0){this.clear();return}let a=this._head,o=this.size;for(;a&&o>s;)this._map.delete(a.key),a=a.next,o--;this._head=a,this._size=o,a&&(a.previous=void 0),this._state++}addItemFirst(s){if(!this._head&&!this._tail)this._tail=s;else if(this._head)s.next=this._head,this._head.previous=s;else throw new Error("Invalid list");this._head=s,this._state++}addItemLast(s){if(!this._head&&!this._tail)this._head=s;else if(this._tail)s.previous=this._tail,this._tail.next=s;else throw new Error("Invalid list");this._tail=s,this._state++}removeItem(s){if(s===this._head&&s===this._tail)this._head=void 0,this._tail=void 0;else if(s===this._head){if(!s.next)throw new Error("Invalid list");s.next.previous=void 0,this._head=s.next}else if(s===this._tail){if(!s.previous)throw new Error("Invalid list");s.previous.next=void 0,this._tail=s.previous}else{const a=s.next,o=s.previous;if(!a||!o)throw new Error("Invalid list");a.previous=o,o.next=a}s.next=void 0,s.previous=void 0,this._state++}touch(s,a){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(a!==e.First&&a!==e.Last)){if(a===e.First){if(s===this._head)return;const o=s.next,c=s.previous;s===this._tail?(c.next=void 0,this._tail=c):(o.previous=c,c.next=o),s.previous=void 0,s.next=this._head,this._head.previous=s,this._head=s,this._state++}else if(a===e.Last){if(s===this._tail)return;const o=s.next,c=s.previous;s===this._head?(o.previous=void 0,this._head=o):(o.previous=c,c.next=o),s.next=void 0,s.previous=this._tail,this._tail.next=s,this._tail=s,this._state++}}}toJSON(){const s=[];return this.forEach((a,o)=>{s.push([o,a])}),s}fromJSON(s){this.clear();for(const[a,o]of s)this.set(a,o)}}Vr.LinkedMap=n;class r extends n{constructor(s,a=1){super(),this._limit=s,this._ratio=Math.min(Math.max(0,a),1)}get limit(){return this._limit}set limit(s){this._limit=s,this.checkTrim()}get ratio(){return this._ratio}set ratio(s){this._ratio=Math.min(Math.max(0,s),1),this.checkTrim()}get(s,a=e.AsNew){return super.get(s,a)}peek(s){return super.get(s,e.None)}set(s,a){return super.set(s,a,e.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}return Vr.LRUCache=r,Vr}var Tc={},dE;function Fj(){if(dE)return Tc;dE=1,Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.Disposable=void 0;var t;return function(e){function n(r){return{dispose:r}}e.create=n}(t||(Tc.Disposable=t={})),Tc}var vs={},fE;function qj(){if(fE)return vs;fE=1,Object.defineProperty(vs,"__esModule",{value:!0}),vs.SharedArrayReceiverStrategy=vs.SharedArraySenderStrategy=void 0;const t=Nf();var e;(function(a){a.Continue=0,a.Cancelled=1})(e||(e={}));class n{constructor(){this.buffers=new Map}enableCancellation(o){if(o.id===null)return;const c=new SharedArrayBuffer(4),u=new Int32Array(c,0,1);u[0]=e.Continue,this.buffers.set(o.id,c),o.$cancellationData=c}async sendCancellation(o,c){const u=this.buffers.get(c);if(u===void 0)return;const l=new Int32Array(u,0,1);Atomics.store(l,0,e.Cancelled)}cleanup(o){this.buffers.delete(o)}dispose(){this.buffers.clear()}}vs.SharedArraySenderStrategy=n;class r{constructor(o){this.data=new Int32Array(o,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===e.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class i{constructor(o){this.token=new r(o)}cancel(){}dispose(){}}class s{constructor(){this.kind="request"}createCancellationTokenSource(o){const c=o.$cancellationData;return c===void 0?new t.CancellationTokenSource:new i(c)}}return vs.SharedArrayReceiverStrategy=s,vs}var Xr={},Ec={},hE;function pE(){if(hE)return Ec;hE=1,Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.Semaphore=void 0;const t=ls();class e{constructor(r=1){if(r<=0)throw new Error("Capacity must be greater than 0");this._capacity=r,this._active=0,this._waiting=[]}lock(r){return new Promise((i,s)=>{this._waiting.push({thunk:r,resolve:i,reject:s}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,t.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;const r=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const i=r.thunk();i instanceof Promise?i.then(s=>{this._active--,r.resolve(s),this.runNext()},s=>{this._active--,r.reject(s),this.runNext()}):(this._active--,r.resolve(i),this.runNext())}catch(i){this._active--,r.reject(i),this.runNext()}}}return Ec.Semaphore=e,Ec}var mE;function Gj(){if(mE)return Xr;mE=1,Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.ReadableStreamMessageReader=Xr.AbstractMessageReader=Xr.MessageReader=void 0;const t=ls(),e=mc(),n=ba(),r=pE();var i;(function(c){function u(l){let d=l;return d&&e.func(d.listen)&&e.func(d.dispose)&&e.func(d.onError)&&e.func(d.onClose)&&e.func(d.onPartialMessage)}c.is=u})(i||(Xr.MessageReader=i={}));class s{constructor(){this.errorEmitter=new n.Emitter,this.closeEmitter=new n.Emitter,this.partialMessageEmitter=new n.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(u){this.errorEmitter.fire(this.asError(u))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(u){this.partialMessageEmitter.fire(u)}asError(u){return u instanceof Error?u:new Error(`Reader received error. Reason: ${e.string(u.message)?u.message:"unknown"}`)}}Xr.AbstractMessageReader=s;var a;(function(c){function u(l){let d,f;const h=new Map;let m;const y=new Map;if(l===void 0||typeof l=="string")d=l??"utf-8";else{if(d=l.charset??"utf-8",l.contentDecoder!==void 0&&(f=l.contentDecoder,h.set(f.name,f)),l.contentDecoders!==void 0)for(const R of l.contentDecoders)h.set(R.name,R);if(l.contentTypeDecoder!==void 0&&(m=l.contentTypeDecoder,y.set(m.name,m)),l.contentTypeDecoders!==void 0)for(const R of l.contentTypeDecoders)y.set(R.name,R)}return m===void 0&&(m=(0,t.default)().applicationJson.decoder,y.set(m.name,m)),{charset:d,contentDecoder:f,contentDecoders:h,contentTypeDecoder:m,contentTypeDecoders:y}}c.fromOptions=u})(a||(a={}));class o extends s{constructor(u,l){super(),this.readable=u,this.options=a.fromOptions(l),this.buffer=(0,t.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new r.Semaphore(1)}set partialMessageTimeout(u){this._partialMessageTimeout=u}get partialMessageTimeout(){return this._partialMessageTimeout}listen(u){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=u;const l=this.readable.onData(d=>{this.onData(d)});return this.readable.onError(d=>this.fireError(d)),this.readable.onClose(()=>this.fireClose()),l}onData(u){try{for(this.buffer.append(u);;){if(this.nextMessageLength===-1){const d=this.buffer.tryReadHeaders(!0);if(!d)return;const f=d.get("content-length");if(!f){this.fireError(new Error(`Header must provide a Content-Length property.
145
- ${JSON.stringify(Object.fromEntries(d))}`));return}const h=parseInt(f);if(isNaN(h)){this.fireError(new Error(`Content-Length value must be a number. Got ${f}`));return}this.nextMessageLength=h}const l=this.buffer.tryReadBody(this.nextMessageLength);if(l===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const d=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(l):l,f=await this.options.contentTypeDecoder.decode(d,this.options);this.callback(f)}).catch(d=>{this.fireError(d)})}}catch(l){this.fireError(l)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((u,l)=>{this.partialMessageTimer=void 0,u===this.messageToken&&(this.firePartialMessage({messageToken:u,waitingTime:l}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}return Xr.ReadableStreamMessageReader=o,Xr}var Yr={},gE;function jj(){if(gE)return Yr;gE=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.WriteableStreamMessageWriter=Yr.AbstractMessageWriter=Yr.MessageWriter=void 0;const t=ls(),e=mc(),n=pE(),r=ba(),i="Content-Length: ",s=`\r
146
- `;var a;(function(l){function d(f){let h=f;return h&&e.func(h.dispose)&&e.func(h.onClose)&&e.func(h.onError)&&e.func(h.write)}l.is=d})(a||(Yr.MessageWriter=a={}));class o{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(d,f,h){this.errorEmitter.fire([this.asError(d),f,h])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(d){return d instanceof Error?d:new Error(`Writer received error. Reason: ${e.string(d.message)?d.message:"unknown"}`)}}Yr.AbstractMessageWriter=o;var c;(function(l){function d(f){return f===void 0||typeof f=="string"?{charset:f??"utf-8",contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:f.charset??"utf-8",contentEncoder:f.contentEncoder,contentTypeEncoder:f.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}l.fromOptions=d})(c||(c={}));class u extends o{constructor(d,f){super(),this.writable=d,this.options=c.fromOptions(f),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError(h=>this.fireError(h)),this.writable.onClose(()=>this.fireClose())}async write(d){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(d,this.options).then(h=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(h):h).then(h=>{const m=[];return m.push(i,h.byteLength.toString(),s),m.push(s),this.doWrite(d,m,h)},h=>{throw this.fireError(h),h}))}async doWrite(d,f,h){try{return await this.writable.write(f.join(""),"ascii"),this.writable.write(h)}catch(m){return this.handleError(m,d),Promise.reject(m)}}handleError(d,f){this.errorCount++,this.fireError(d,f,this.errorCount)}end(){this.writable.end()}}return Yr.WriteableStreamMessageWriter=u,Yr}var Sc={},yE;function Bj(){if(yE)return Sc;yE=1,Object.defineProperty(Sc,"__esModule",{value:!0}),Sc.AbstractMessageBuffer=void 0;const t=13,e=10,n=`\r
147
- `;class r{constructor(s="utf-8"){this._encoding=s,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(s){const a=typeof s=="string"?this.fromString(s,this._encoding):s;this._chunks.push(a),this._totalLength+=a.byteLength}tryReadHeaders(s=!1){if(this._chunks.length===0)return;let a=0,o=0,c=0,u=0;e:for(;o<this._chunks.length;){const h=this._chunks[o];for(c=0;c<h.length;){switch(h[c]){case t:switch(a){case 0:a=1;break;case 2:a=3;break;default:a=0}break;case e:switch(a){case 1:a=2;break;case 3:a=4,c++;break e;default:a=0}break;default:a=0}c++}u+=h.byteLength,o++}if(a!==4)return;const l=this._read(u+c),d=new Map,f=this.toString(l,"ascii").split(n);if(f.length<2)return d;for(let h=0;h<f.length-2;h++){const m=f[h],y=m.indexOf(":");if(y===-1)throw new Error(`Message header must separate key and value using ':'
148
- ${m}`);const R=m.substr(0,y),w=m.substr(y+1).trim();d.set(s?R.toLowerCase():R,w)}return d}tryReadBody(s){if(!(this._totalLength<s))return this._read(s)}get numberOfBytes(){return this._totalLength}_read(s){if(s===0)return this.emptyBuffer();if(s>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===s){const u=this._chunks[0];return this._chunks.shift(),this._totalLength-=s,this.asNative(u)}if(this._chunks[0].byteLength>s){const u=this._chunks[0],l=this.asNative(u,s);return this._chunks[0]=u.slice(s),this._totalLength-=s,l}const a=this.allocNative(s);let o=0,c=0;for(;s>0;){const u=this._chunks[c];if(u.byteLength>s){const l=u.slice(0,s);a.set(l,o),o+=s,this._chunks[c]=u.slice(s),this._totalLength-=s,s-=s}else a.set(u,o),o+=u.byteLength,this._chunks.shift(),this._totalLength-=u.byteLength,s-=u.byteLength}return a}}return Sc.AbstractMessageBuffer=r,Sc}var ay={},vE;function Uj(){return vE||(vE=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.ConnectionOptions=t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.RequestCancellationReceiverStrategy=t.IdCancellationReceiverStrategy=t.ConnectionStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=t.NullLogger=t.ProgressType=t.ProgressToken=void 0;const e=ls(),n=mc(),r=cE(),i=lE(),s=ba(),a=Nf();var o;(function($){$.type=new r.NotificationType("$/cancelRequest")})(o||(o={}));var c;(function($){function O(K){return typeof K=="string"||typeof K=="number"}$.is=O})(c||(t.ProgressToken=c={}));var u;(function($){$.type=new r.NotificationType("$/progress")})(u||(u={}));class l{constructor(){}}t.ProgressType=l;var d;(function($){function O(K){return n.func(K)}$.is=O})(d||(d={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var f;(function($){$[$.Off=0]="Off",$[$.Messages=1]="Messages",$[$.Compact=2]="Compact",$[$.Verbose=3]="Verbose"})(f||(t.Trace=f={}));var h;(function($){$.Off="off",$.Messages="messages",$.Compact="compact",$.Verbose="verbose"})(h||(t.TraceValues=h={})),function($){function O(W){if(!n.string(W))return $.Off;switch(W=W.toLowerCase(),W){case"off":return $.Off;case"messages":return $.Messages;case"compact":return $.Compact;case"verbose":return $.Verbose;default:return $.Off}}$.fromString=O;function K(W){switch(W){case $.Off:return"off";case $.Messages:return"messages";case $.Compact:return"compact";case $.Verbose:return"verbose";default:return"off"}}$.toString=K}(f||(t.Trace=f={}));var m;(function($){$.Text="text",$.JSON="json"})(m||(t.TraceFormat=m={})),function($){function O(K){return n.string(K)?(K=K.toLowerCase(),K==="json"?$.JSON:$.Text):$.Text}$.fromString=O}(m||(t.TraceFormat=m={}));var y;(function($){$.type=new r.NotificationType("$/setTrace")})(y||(t.SetTraceNotification=y={}));var R;(function($){$.type=new r.NotificationType("$/logTrace")})(R||(t.LogTraceNotification=R={}));var w;(function($){$[$.Closed=1]="Closed",$[$.Disposed=2]="Disposed",$[$.AlreadyListening=3]="AlreadyListening"})(w||(t.ConnectionErrors=w={}));class k extends Error{constructor(O,K){super(K),this.code=O,Object.setPrototypeOf(this,k.prototype)}}t.ConnectionError=k;var E;(function($){function O(K){const W=K;return W&&n.func(W.cancelUndispatched)}$.is=O})(E||(t.ConnectionStrategy=E={}));var _;(function($){function O(K){const W=K;return W&&(W.kind===void 0||W.kind==="id")&&n.func(W.createCancellationTokenSource)&&(W.dispose===void 0||n.func(W.dispose))}$.is=O})(_||(t.IdCancellationReceiverStrategy=_={}));var C;(function($){function O(K){const W=K;return W&&W.kind==="request"&&n.func(W.createCancellationTokenSource)&&(W.dispose===void 0||n.func(W.dispose))}$.is=O})(C||(t.RequestCancellationReceiverStrategy=C={}));var I;(function($){$.Message=Object.freeze({createCancellationTokenSource(K){return new a.CancellationTokenSource}});function O(K){return _.is(K)||C.is(K)}$.is=O})(I||(t.CancellationReceiverStrategy=I={}));var j;(function($){$.Message=Object.freeze({sendCancellation(K,W){return K.sendNotification(o.type,{id:W})},cleanup(K){}});function O(K){const W=K;return W&&n.func(W.sendCancellation)&&n.func(W.cleanup)}$.is=O})(j||(t.CancellationSenderStrategy=j={}));var J;(function($){$.Message=Object.freeze({receiver:I.Message,sender:j.Message});function O(K){const W=K;return W&&I.is(W.receiver)&&j.is(W.sender)}$.is=O})(J||(t.CancellationStrategy=J={}));var Z;(function($){function O(K){const W=K;return W&&n.func(W.handleMessage)}$.is=O})(Z||(t.MessageStrategy=Z={}));var oe;(function($){function O(K){const W=K;return W&&(J.is(W.cancellationStrategy)||E.is(W.connectionStrategy)||Z.is(W.messageStrategy))}$.is=O})(oe||(t.ConnectionOptions=oe={}));var L;(function($){$[$.New=1]="New",$[$.Listening=2]="Listening",$[$.Closed=3]="Closed",$[$.Disposed=4]="Disposed"})(L||(L={}));function S($,O,K,W){const H=K!==void 0?K:t.NullLogger;let $e=0,te=0,A=0;const me="2.0";let _e;const st=new Map;let B;const V=new Map,Oe=new Map;let ce,be=new i.LinkedMap,Ae=new Map,ue=new Set,N=new Map,F=f.Off,de=m.Text,q,le=L.New;const qe=new s.Emitter,Ze=new s.Emitter,ae=new s.Emitter,Pe=new s.Emitter,ne=new s.Emitter,Re=W&&W.cancellationStrategy?W.cancellationStrategy:J.Message;function Me(b){if(b===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+b.toString()}function ht(b){return b===null?"res-unknown-"+(++A).toString():"res-"+b.toString()}function Ve(){return"not-"+(++te).toString()}function zt(b,G){r.Message.isRequest(G)?b.set(Me(G.id),G):r.Message.isResponse(G)?b.set(ht(G.id),G):b.set(Ve(),G)}function jt(b){}function cn(){return le===L.Listening}function X(){return le===L.Closed}function Y(){return le===L.Disposed}function fe(){(le===L.New||le===L.Listening)&&(le=L.Closed,Ze.fire(void 0))}function Bt(b){qe.fire([b,void 0,void 0])}function Ft(b){qe.fire(b)}$.onClose(fe),$.onError(Bt),O.onClose(fe),O.onError(Ft);function mr(){ce||be.size===0||(ce=(0,e.default)().timer.setImmediate(()=>{ce=void 0,ji()}))}function ui(b){r.Message.isRequest(b)?Ui(b):r.Message.isNotification(b)?li(b):r.Message.isResponse(b)?Wi(b):di(b)}function ji(){if(be.size===0)return;const b=be.shift();try{const G=W?.messageStrategy;Z.is(G)?G.handleMessage(b,ui):ui(b)}finally{mr()}}const Bi=b=>{try{if(r.Message.isNotification(b)&&b.method===o.type.method){const G=b.params.id,ee=Me(G),re=be.get(ee);if(r.Message.isRequest(re)){const Le=W?.connectionStrategy,Xe=Le&&Le.cancelUndispatched?Le.cancelUndispatched(re,jt):void 0;if(Xe&&(Xe.error!==void 0||Xe.result!==void 0)){be.delete(ee),N.delete(G),Xe.id=re.id,gr(Xe,b.method,Date.now()),O.write(Xe).catch(()=>H.error("Sending response for canceled message failed."));return}}const ze=N.get(G);if(ze!==void 0){ze.cancel(),Dr(b);return}else ue.add(G)}zt(be,b)}finally{mr()}};function Ui(b){if(Y())return;function G(xe,tt,Ye){const Dt={jsonrpc:me,id:b.id};xe instanceof r.ResponseError?Dt.error=xe.toJson():Dt.result=xe===void 0?null:xe,gr(Dt,tt,Ye),O.write(Dt).catch(()=>H.error("Sending response failed."))}function ee(xe,tt,Ye){const Dt={jsonrpc:me,id:b.id,error:xe.toJson()};gr(Dt,tt,Ye),O.write(Dt).catch(()=>H.error("Sending response failed."))}function re(xe,tt,Ye){xe===void 0&&(xe=null);const Dt={jsonrpc:me,id:b.id,result:xe};gr(Dt,tt,Ye),O.write(Dt).catch(()=>H.error("Sending response failed."))}Vi(b);const ze=st.get(b.method);let Le,Xe;ze&&(Le=ze.type,Xe=ze.handler);const ge=Date.now();if(Xe||_e){const xe=b.id??String(Date.now()),tt=_.is(Re.receiver)?Re.receiver.createCancellationTokenSource(xe):Re.receiver.createCancellationTokenSource(b);b.id!==null&&ue.has(b.id)&&tt.cancel(),b.id!==null&&N.set(xe,tt);try{let Ye;if(Xe)if(b.params===void 0){if(Le!==void 0&&Le.numberOfParams!==0){ee(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${b.method} defines ${Le.numberOfParams} params but received none.`),b.method,ge);return}Ye=Xe(tt.token)}else if(Array.isArray(b.params)){if(Le!==void 0&&Le.parameterStructures===r.ParameterStructures.byName){ee(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${b.method} defines parameters by name but received parameters by position`),b.method,ge);return}Ye=Xe(...b.params,tt.token)}else{if(Le!==void 0&&Le.parameterStructures===r.ParameterStructures.byPosition){ee(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${b.method} defines parameters by position but received parameters by name`),b.method,ge);return}Ye=Xe(b.params,tt.token)}else _e&&(Ye=_e(b.method,b.params,tt.token));const Dt=Ye;Ye?Dt.then?Dt.then(un=>{N.delete(xe),G(un,b.method,ge)},un=>{N.delete(xe),un instanceof r.ResponseError?ee(un,b.method,ge):un&&n.string(un.message)?ee(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${b.method} failed with message: ${un.message}`),b.method,ge):ee(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${b.method} failed unexpectedly without providing any details.`),b.method,ge)}):(N.delete(xe),G(Ye,b.method,ge)):(N.delete(xe),re(Ye,b.method,ge))}catch(Ye){N.delete(xe),Ye instanceof r.ResponseError?G(Ye,b.method,ge):Ye&&n.string(Ye.message)?ee(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${b.method} failed with message: ${Ye.message}`),b.method,ge):ee(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${b.method} failed unexpectedly without providing any details.`),b.method,ge)}}else ee(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${b.method}`),b.method,ge)}function Wi(b){if(!Y())if(b.id===null)b.error?H.error(`Received response message without id: Error is:
149
- ${JSON.stringify(b.error,void 0,4)}`):H.error("Received response message without id. No further error information provided.");else{const G=b.id,ee=Ae.get(G);if(Xi(b,ee),ee!==void 0){Ae.delete(G);try{if(b.error){const re=b.error;ee.reject(new r.ResponseError(re.code,re.message,re.data))}else if(b.result!==void 0)ee.resolve(b.result);else throw new Error("Should never happen.")}catch(re){re.message?H.error(`Response handler '${ee.method}' failed with message: ${re.message}`):H.error(`Response handler '${ee.method}' failed unexpectedly.`)}}}}function li(b){if(Y())return;let G,ee;if(b.method===o.type.method){const re=b.params.id;ue.delete(re),Dr(b);return}else{const re=V.get(b.method);re&&(ee=re.handler,G=re.type)}if(ee||B)try{if(Dr(b),ee)if(b.params===void 0)G!==void 0&&G.numberOfParams!==0&&G.parameterStructures!==r.ParameterStructures.byName&&H.error(`Notification ${b.method} defines ${G.numberOfParams} params but received none.`),ee();else if(Array.isArray(b.params)){const re=b.params;b.method===u.type.method&&re.length===2&&c.is(re[0])?ee({token:re[0],value:re[1]}):(G!==void 0&&(G.parameterStructures===r.ParameterStructures.byName&&H.error(`Notification ${b.method} defines parameters by name but received parameters by position`),G.numberOfParams!==b.params.length&&H.error(`Notification ${b.method} defines ${G.numberOfParams} params but received ${re.length} arguments`)),ee(...re))}else G!==void 0&&G.parameterStructures===r.ParameterStructures.byPosition&&H.error(`Notification ${b.method} defines parameters by position but received parameters by name`),ee(b.params);else B&&B(b.method,b.params)}catch(re){re.message?H.error(`Notification handler '${b.method}' failed with message: ${re.message}`):H.error(`Notification handler '${b.method}' failed unexpectedly.`)}else ae.fire(b)}function di(b){if(!b){H.error("Received empty message.");return}H.error(`Received message which is neither a response nor a notification message:
150
- ${JSON.stringify(b,null,4)}`);const G=b;if(n.string(G.id)||n.number(G.id)){const ee=G.id,re=Ae.get(ee);re&&re.reject(new Error("The received response has neither a result nor an error property."))}}function bn(b){if(b!=null)switch(F){case f.Verbose:return JSON.stringify(b,null,4);case f.Compact:return JSON.stringify(b);default:return}}function Hi(b){if(!(F===f.Off||!q))if(de===m.Text){let G;(F===f.Verbose||F===f.Compact)&&b.params&&(G=`Params: ${bn(b.params)}
151
-
152
- `),q.log(`Sending request '${b.method} - (${b.id})'.`,G)}else Fn("send-request",b)}function Ki(b){if(!(F===f.Off||!q))if(de===m.Text){let G;(F===f.Verbose||F===f.Compact)&&(b.params?G=`Params: ${bn(b.params)}
153
-
154
- `:G=`No parameters provided.
155
-
156
- `),q.log(`Sending notification '${b.method}'.`,G)}else Fn("send-notification",b)}function gr(b,G,ee){if(!(F===f.Off||!q))if(de===m.Text){let re;(F===f.Verbose||F===f.Compact)&&(b.error&&b.error.data?re=`Error data: ${bn(b.error.data)}
157
-
158
- `:b.result?re=`Result: ${bn(b.result)}
159
-
160
- `:b.error===void 0&&(re=`No result returned.
161
-
162
- `)),q.log(`Sending response '${G} - (${b.id})'. Processing request took ${Date.now()-ee}ms`,re)}else Fn("send-response",b)}function Vi(b){if(!(F===f.Off||!q))if(de===m.Text){let G;(F===f.Verbose||F===f.Compact)&&b.params&&(G=`Params: ${bn(b.params)}
163
-
164
- `),q.log(`Received request '${b.method} - (${b.id})'.`,G)}else Fn("receive-request",b)}function Dr(b){if(!(F===f.Off||!q||b.method===R.type.method))if(de===m.Text){let G;(F===f.Verbose||F===f.Compact)&&(b.params?G=`Params: ${bn(b.params)}
165
-
166
- `:G=`No parameters provided.
167
-
168
- `),q.log(`Received notification '${b.method}'.`,G)}else Fn("receive-notification",b)}function Xi(b,G){if(!(F===f.Off||!q))if(de===m.Text){let ee;if((F===f.Verbose||F===f.Compact)&&(b.error&&b.error.data?ee=`Error data: ${bn(b.error.data)}
169
-
170
- `:b.result?ee=`Result: ${bn(b.result)}
171
-
172
- `:b.error===void 0&&(ee=`No result returned.
173
-
174
- `)),G){const re=b.error?` Request failed: ${b.error.message} (${b.error.code}).`:"";q.log(`Received response '${G.method} - (${b.id})' in ${Date.now()-G.timerStart}ms.${re}`,ee)}else q.log(`Received response ${b.id} without active response promise.`,ee)}else Fn("receive-response",b)}function Fn(b,G){if(!q||F===f.Off)return;const ee={isLSPMessage:!0,type:b,message:G,timestamp:Date.now()};q.log(ee)}function er(){if(X())throw new k(w.Closed,"Connection is closed.");if(Y())throw new k(w.Disposed,"Connection is disposed.")}function Ys(){if(cn())throw new k(w.AlreadyListening,"Connection is already listening")}function M(){if(!cn())throw new Error("Call listen() first.")}function v(b){return b===void 0?null:b}function P(b){if(b!==null)return b}function p(b){return b!=null&&!Array.isArray(b)&&typeof b=="object"}function T(b,G){switch(b){case r.ParameterStructures.auto:return p(G)?P(G):[v(G)];case r.ParameterStructures.byName:if(!p(G))throw new Error("Received parameters by name but param is not an object literal.");return P(G);case r.ParameterStructures.byPosition:return[v(G)];default:throw new Error(`Unknown parameter structure ${b.toString()}`)}}function g(b,G){let ee;const re=b.numberOfParams;switch(re){case 0:ee=void 0;break;case 1:ee=T(b.parameterStructures,G[0]);break;default:ee=[];for(let ze=0;ze<G.length&&ze<re;ze++)ee.push(v(G[ze]));if(G.length<re)for(let ze=G.length;ze<re;ze++)ee.push(null);break}return ee}const x={sendNotification:(b,...G)=>{er();let ee,re;if(n.string(b)){ee=b;const Le=G[0];let Xe=0,ge=r.ParameterStructures.auto;r.ParameterStructures.is(Le)&&(Xe=1,ge=Le);let xe=G.length;const tt=xe-Xe;switch(tt){case 0:re=void 0;break;case 1:re=T(ge,G[Xe]);break;default:if(ge===r.ParameterStructures.byName)throw new Error(`Received ${tt} parameters for 'by Name' notification parameter structure.`);re=G.slice(Xe,xe).map(Ye=>v(Ye));break}}else{const Le=G;ee=b.method,re=g(b,Le)}const ze={jsonrpc:me,method:ee,params:re};return Ki(ze),O.write(ze).catch(Le=>{throw H.error("Sending notification failed."),Le})},onNotification:(b,G)=>{er();let ee;return n.func(b)?B=b:G&&(n.string(b)?(ee=b,V.set(b,{type:void 0,handler:G})):(ee=b.method,V.set(b.method,{type:b,handler:G}))),{dispose:()=>{ee!==void 0?V.delete(ee):B=void 0}}},onProgress:(b,G,ee)=>{if(Oe.has(G))throw new Error(`Progress handler for token ${G} already registered`);return Oe.set(G,ee),{dispose:()=>{Oe.delete(G)}}},sendProgress:(b,G,ee)=>x.sendNotification(u.type,{token:G,value:ee}),onUnhandledProgress:Pe.event,sendRequest:(b,...G)=>{er(),M();let ee,re,ze;if(n.string(b)){ee=b;const xe=G[0],tt=G[G.length-1];let Ye=0,Dt=r.ParameterStructures.auto;r.ParameterStructures.is(xe)&&(Ye=1,Dt=xe);let un=G.length;a.CancellationToken.is(tt)&&(un=un-1,ze=tt);const yr=un-Ye;switch(yr){case 0:re=void 0;break;case 1:re=T(Dt,G[Ye]);break;default:if(Dt===r.ParameterStructures.byName)throw new Error(`Received ${yr} parameters for 'by Name' request parameter structure.`);re=G.slice(Ye,un).map(BA=>v(BA));break}}else{const xe=G;ee=b.method,re=g(b,xe);const tt=b.numberOfParams;ze=a.CancellationToken.is(xe[tt])?xe[tt]:void 0}const Le=$e++;let Xe;ze&&(Xe=ze.onCancellationRequested(()=>{const xe=Re.sender.sendCancellation(x,Le);return xe===void 0?(H.log(`Received no promise from cancellation strategy when cancelling id ${Le}`),Promise.resolve()):xe.catch(()=>{H.log(`Sending cancellation messages for id ${Le} failed`)})}));const ge={jsonrpc:me,id:Le,method:ee,params:re};return Hi(ge),typeof Re.sender.enableCancellation=="function"&&Re.sender.enableCancellation(ge),new Promise(async(xe,tt)=>{const Ye=yr=>{xe(yr),Re.sender.cleanup(Le),Xe?.dispose()},Dt=yr=>{tt(yr),Re.sender.cleanup(Le),Xe?.dispose()},un={method:ee,timerStart:Date.now(),resolve:Ye,reject:Dt};try{await O.write(ge),Ae.set(Le,un)}catch(yr){throw H.error("Sending request failed."),un.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,yr.message?yr.message:"Unknown reason")),yr}})},onRequest:(b,G)=>{er();let ee=null;return d.is(b)?(ee=void 0,_e=b):n.string(b)?(ee=null,G!==void 0&&(ee=b,st.set(b,{handler:G,type:void 0}))):G!==void 0&&(ee=b.method,st.set(b.method,{type:b,handler:G})),{dispose:()=>{ee!==null&&(ee!==void 0?st.delete(ee):_e=void 0)}}},hasPendingResponse:()=>Ae.size>0,trace:async(b,G,ee)=>{let re=!1,ze=m.Text;ee!==void 0&&(n.boolean(ee)?re=ee:(re=ee.sendNotification||!1,ze=ee.traceFormat||m.Text)),F=b,de=ze,F===f.Off?q=void 0:q=G,re&&!X()&&!Y()&&await x.sendNotification(y.type,{value:f.toString(b)})},onError:qe.event,onClose:Ze.event,onUnhandledNotification:ae.event,onDispose:ne.event,end:()=>{O.end()},dispose:()=>{if(Y())return;le=L.Disposed,ne.fire(void 0);const b=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const G of Ae.values())G.reject(b);Ae=new Map,N=new Map,ue=new Set,be=new i.LinkedMap,n.func(O.dispose)&&O.dispose(),n.func($.dispose)&&$.dispose()},listen:()=>{er(),Ys(),le=L.Listening,$.listen(Bi)},inspect:()=>{(0,e.default)().console.log("inspect")}};return x.onNotification(R.type,b=>{if(F===f.Off||!q)return;const G=F===f.Verbose||F===f.Compact;q.log(b.message,G?b.verbose:void 0)}),x.onNotification(u.type,b=>{const G=Oe.get(b.token);G?G(b.value):Pe.fire(b)}),x}t.createMessageConnection=S}(ay)),ay}var wE;function oy(){return wE||(wE=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ProgressType=t.ProgressToken=t.createMessageConnection=t.NullLogger=t.ConnectionOptions=t.ConnectionStrategy=t.AbstractMessageBuffer=t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=t.SharedArrayReceiverStrategy=t.SharedArraySenderStrategy=t.CancellationToken=t.CancellationTokenSource=t.Emitter=t.Event=t.Disposable=t.LRUCache=t.Touch=t.LinkedMap=t.ParameterStructures=t.NotificationType9=t.NotificationType8=t.NotificationType7=t.NotificationType6=t.NotificationType5=t.NotificationType4=t.NotificationType3=t.NotificationType2=t.NotificationType1=t.NotificationType0=t.NotificationType=t.ErrorCodes=t.ResponseError=t.RequestType9=t.RequestType8=t.RequestType7=t.RequestType6=t.RequestType5=t.RequestType4=t.RequestType3=t.RequestType2=t.RequestType1=t.RequestType0=t.RequestType=t.Message=t.RAL=void 0,t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=void 0;const e=cE();Object.defineProperty(t,"Message",{enumerable:!0,get:function(){return e.Message}}),Object.defineProperty(t,"RequestType",{enumerable:!0,get:function(){return e.RequestType}}),Object.defineProperty(t,"RequestType0",{enumerable:!0,get:function(){return e.RequestType0}}),Object.defineProperty(t,"RequestType1",{enumerable:!0,get:function(){return e.RequestType1}}),Object.defineProperty(t,"RequestType2",{enumerable:!0,get:function(){return e.RequestType2}}),Object.defineProperty(t,"RequestType3",{enumerable:!0,get:function(){return e.RequestType3}}),Object.defineProperty(t,"RequestType4",{enumerable:!0,get:function(){return e.RequestType4}}),Object.defineProperty(t,"RequestType5",{enumerable:!0,get:function(){return e.RequestType5}}),Object.defineProperty(t,"RequestType6",{enumerable:!0,get:function(){return e.RequestType6}}),Object.defineProperty(t,"RequestType7",{enumerable:!0,get:function(){return e.RequestType7}}),Object.defineProperty(t,"RequestType8",{enumerable:!0,get:function(){return e.RequestType8}}),Object.defineProperty(t,"RequestType9",{enumerable:!0,get:function(){return e.RequestType9}}),Object.defineProperty(t,"ResponseError",{enumerable:!0,get:function(){return e.ResponseError}}),Object.defineProperty(t,"ErrorCodes",{enumerable:!0,get:function(){return e.ErrorCodes}}),Object.defineProperty(t,"NotificationType",{enumerable:!0,get:function(){return e.NotificationType}}),Object.defineProperty(t,"NotificationType0",{enumerable:!0,get:function(){return e.NotificationType0}}),Object.defineProperty(t,"NotificationType1",{enumerable:!0,get:function(){return e.NotificationType1}}),Object.defineProperty(t,"NotificationType2",{enumerable:!0,get:function(){return e.NotificationType2}}),Object.defineProperty(t,"NotificationType3",{enumerable:!0,get:function(){return e.NotificationType3}}),Object.defineProperty(t,"NotificationType4",{enumerable:!0,get:function(){return e.NotificationType4}}),Object.defineProperty(t,"NotificationType5",{enumerable:!0,get:function(){return e.NotificationType5}}),Object.defineProperty(t,"NotificationType6",{enumerable:!0,get:function(){return e.NotificationType6}}),Object.defineProperty(t,"NotificationType7",{enumerable:!0,get:function(){return e.NotificationType7}}),Object.defineProperty(t,"NotificationType8",{enumerable:!0,get:function(){return e.NotificationType8}}),Object.defineProperty(t,"NotificationType9",{enumerable:!0,get:function(){return e.NotificationType9}}),Object.defineProperty(t,"ParameterStructures",{enumerable:!0,get:function(){return e.ParameterStructures}});const n=lE();Object.defineProperty(t,"LinkedMap",{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(t,"LRUCache",{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(t,"Touch",{enumerable:!0,get:function(){return n.Touch}});const r=Fj();Object.defineProperty(t,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const i=ba();Object.defineProperty(t,"Event",{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(t,"Emitter",{enumerable:!0,get:function(){return i.Emitter}});const s=Nf();Object.defineProperty(t,"CancellationTokenSource",{enumerable:!0,get:function(){return s.CancellationTokenSource}}),Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return s.CancellationToken}});const a=qj();Object.defineProperty(t,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return a.SharedArraySenderStrategy}}),Object.defineProperty(t,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return a.SharedArrayReceiverStrategy}});const o=Gj();Object.defineProperty(t,"MessageReader",{enumerable:!0,get:function(){return o.MessageReader}}),Object.defineProperty(t,"AbstractMessageReader",{enumerable:!0,get:function(){return o.AbstractMessageReader}}),Object.defineProperty(t,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return o.ReadableStreamMessageReader}});const c=jj();Object.defineProperty(t,"MessageWriter",{enumerable:!0,get:function(){return c.MessageWriter}}),Object.defineProperty(t,"AbstractMessageWriter",{enumerable:!0,get:function(){return c.AbstractMessageWriter}}),Object.defineProperty(t,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return c.WriteableStreamMessageWriter}});const u=Bj();Object.defineProperty(t,"AbstractMessageBuffer",{enumerable:!0,get:function(){return u.AbstractMessageBuffer}});const l=Uj();Object.defineProperty(t,"ConnectionStrategy",{enumerable:!0,get:function(){return l.ConnectionStrategy}}),Object.defineProperty(t,"ConnectionOptions",{enumerable:!0,get:function(){return l.ConnectionOptions}}),Object.defineProperty(t,"NullLogger",{enumerable:!0,get:function(){return l.NullLogger}}),Object.defineProperty(t,"createMessageConnection",{enumerable:!0,get:function(){return l.createMessageConnection}}),Object.defineProperty(t,"ProgressToken",{enumerable:!0,get:function(){return l.ProgressToken}}),Object.defineProperty(t,"ProgressType",{enumerable:!0,get:function(){return l.ProgressType}}),Object.defineProperty(t,"Trace",{enumerable:!0,get:function(){return l.Trace}}),Object.defineProperty(t,"TraceValues",{enumerable:!0,get:function(){return l.TraceValues}}),Object.defineProperty(t,"TraceFormat",{enumerable:!0,get:function(){return l.TraceFormat}}),Object.defineProperty(t,"SetTraceNotification",{enumerable:!0,get:function(){return l.SetTraceNotification}}),Object.defineProperty(t,"LogTraceNotification",{enumerable:!0,get:function(){return l.LogTraceNotification}}),Object.defineProperty(t,"ConnectionErrors",{enumerable:!0,get:function(){return l.ConnectionErrors}}),Object.defineProperty(t,"ConnectionError",{enumerable:!0,get:function(){return l.ConnectionError}}),Object.defineProperty(t,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return l.CancellationReceiverStrategy}}),Object.defineProperty(t,"CancellationSenderStrategy",{enumerable:!0,get:function(){return l.CancellationSenderStrategy}}),Object.defineProperty(t,"CancellationStrategy",{enumerable:!0,get:function(){return l.CancellationStrategy}}),Object.defineProperty(t,"MessageStrategy",{enumerable:!0,get:function(){return l.MessageStrategy}});const d=ls();t.RAL=d.default}(sy)),sy}var bE;function Wj(){if(bE)return Hf;bE=1,Object.defineProperty(Hf,"__esModule",{value:!0});const t=QA,e=oy();class n extends e.AbstractMessageBuffer{constructor(c="utf-8"){super(c)}emptyBuffer(){return n.emptyBuffer}fromString(c,u){return Buffer.from(c,u)}toString(c,u){return c instanceof Buffer?c.toString(u):new t.TextDecoder(u).decode(c)}asNative(c,u){return u===void 0?c instanceof Buffer?c:Buffer.from(c):c instanceof Buffer?c.slice(0,u):Buffer.from(c,0,u)}allocNative(c){return Buffer.allocUnsafe(c)}}n.emptyBuffer=Buffer.allocUnsafe(0);class r{constructor(c){this.stream=c}onClose(c){return this.stream.on("close",c),e.Disposable.create(()=>this.stream.off("close",c))}onError(c){return this.stream.on("error",c),e.Disposable.create(()=>this.stream.off("error",c))}onEnd(c){return this.stream.on("end",c),e.Disposable.create(()=>this.stream.off("end",c))}onData(c){return this.stream.on("data",c),e.Disposable.create(()=>this.stream.off("data",c))}}class i{constructor(c){this.stream=c}onClose(c){return this.stream.on("close",c),e.Disposable.create(()=>this.stream.off("close",c))}onError(c){return this.stream.on("error",c),e.Disposable.create(()=>this.stream.off("error",c))}onEnd(c){return this.stream.on("end",c),e.Disposable.create(()=>this.stream.off("end",c))}write(c,u){return new Promise((l,d)=>{const f=h=>{h==null?l():d(h)};typeof c=="string"?this.stream.write(c,u,f):this.stream.write(c,f)})}end(){this.stream.end()}}const s=Object.freeze({messageBuffer:Object.freeze({create:o=>new n(o)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(o,c)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(o,void 0,0),c.charset))}catch(u){return Promise.reject(u)}}}),decoder:Object.freeze({name:"application/json",decode:(o,c)=>{try{return o instanceof Buffer?Promise.resolve(JSON.parse(o.toString(c.charset))):Promise.resolve(JSON.parse(new t.TextDecoder(c.charset).decode(o)))}catch(u){return Promise.reject(u)}}})}),stream:Object.freeze({asReadableStream:o=>new r(o),asWritableStream:o=>new i(o)}),console,timer:Object.freeze({setTimeout(o,c,...u){const l=setTimeout(o,c,...u);return{dispose:()=>clearTimeout(l)}},setImmediate(o,...c){const u=setImmediate(o,...c);return{dispose:()=>clearImmediate(u)}},setInterval(o,c,...u){const l=setInterval(o,c,...u);return{dispose:()=>clearInterval(l)}}})});function a(){return s}return function(o){function c(){e.RAL.install(s)}o.install=c}(a||(a={})),Hf.default=a,Hf}var RE;function ws(){return RE||(RE=1,function(t){var e=ys&&ys.__createBinding||(Object.create?function(L,S,$,O){O===void 0&&(O=$);var K=Object.getOwnPropertyDescriptor(S,$);(!K||("get"in K?!S.__esModule:K.writable||K.configurable))&&(K={enumerable:!0,get:function(){return S[$]}}),Object.defineProperty(L,O,K)}:function(L,S,$,O){O===void 0&&(O=$),L[O]=S[$]}),n=ys&&ys.__exportStar||function(L,S){for(var $ in L)$!=="default"&&!Object.prototype.hasOwnProperty.call(S,$)&&e(S,L,$)};Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.createServerSocketTransport=t.createClientSocketTransport=t.createServerPipeTransport=t.createClientPipeTransport=t.generateRandomPipeName=t.StreamMessageWriter=t.StreamMessageReader=t.SocketMessageWriter=t.SocketMessageReader=t.PortMessageWriter=t.PortMessageReader=t.IPCMessageWriter=t.IPCMessageReader=void 0;const r=Wj();r.default.install();const i=hi,s=ZA,a=eC,o=tC,c=oy();n(oy(),t);class u extends c.AbstractMessageReader{constructor(S){super(),this.process=S;let $=this.process;$.on("error",O=>this.fireError(O)),$.on("close",()=>this.fireClose())}listen(S){return this.process.on("message",S),c.Disposable.create(()=>this.process.off("message",S))}}t.IPCMessageReader=u;class l extends c.AbstractMessageWriter{constructor(S){super(),this.process=S,this.errorCount=0;const $=this.process;$.on("error",O=>this.fireError(O)),$.on("close",()=>this.fireClose)}write(S){try{return typeof this.process.send=="function"&&this.process.send(S,void 0,void 0,$=>{$?(this.errorCount++,this.handleError($,S)):this.errorCount=0}),Promise.resolve()}catch($){return this.handleError($,S),Promise.reject($)}}handleError(S,$){this.errorCount++,this.fireError(S,$,this.errorCount)}end(){}}t.IPCMessageWriter=l;class d extends c.AbstractMessageReader{constructor(S){super(),this.onData=new c.Emitter,S.on("close",()=>this.fireClose),S.on("error",$=>this.fireError($)),S.on("message",$=>{this.onData.fire($)})}listen(S){return this.onData.event(S)}}t.PortMessageReader=d;class f extends c.AbstractMessageWriter{constructor(S){super(),this.port=S,this.errorCount=0,S.on("close",()=>this.fireClose()),S.on("error",$=>this.fireError($))}write(S){try{return this.port.postMessage(S),Promise.resolve()}catch($){return this.handleError($,S),Promise.reject($)}}handleError(S,$){this.errorCount++,this.fireError(S,$,this.errorCount)}end(){}}t.PortMessageWriter=f;class h extends c.ReadableStreamMessageReader{constructor(S,$="utf-8"){super((0,r.default)().stream.asReadableStream(S),$)}}t.SocketMessageReader=h;class m extends c.WriteableStreamMessageWriter{constructor(S,$){super((0,r.default)().stream.asWritableStream(S),$),this.socket=S}dispose(){super.dispose(),this.socket.destroy()}}t.SocketMessageWriter=m;class y extends c.ReadableStreamMessageReader{constructor(S,$){super((0,r.default)().stream.asReadableStream(S),$)}}t.StreamMessageReader=y;class R extends c.WriteableStreamMessageWriter{constructor(S,$){super((0,r.default)().stream.asWritableStream(S),$)}}t.StreamMessageWriter=R;const w=process.env.XDG_RUNTIME_DIR,k=new Map([["linux",107],["darwin",103]]);function E(){const L=(0,a.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${L}-sock`;let S;w?S=i.join(w,`vscode-ipc-${L}.sock`):S=i.join(s.tmpdir(),`vscode-${L}.sock`);const $=k.get(process.platform);return $!==void 0&&S.length>$&&(0,r.default)().console.warn(`WARNING: IPC handle "${S}" is longer than ${$} characters.`),S}t.generateRandomPipeName=E;function _(L,S="utf-8"){let $;const O=new Promise((K,W)=>{$=K});return new Promise((K,W)=>{let H=(0,o.createServer)($e=>{H.close(),$([new h($e,S),new m($e,S)])});H.on("error",W),H.listen(L,()=>{H.removeListener("error",W),K({onConnected:()=>O})})})}t.createClientPipeTransport=_;function C(L,S="utf-8"){const $=(0,o.createConnection)(L);return[new h($,S),new m($,S)]}t.createServerPipeTransport=C;function I(L,S="utf-8"){let $;const O=new Promise((K,W)=>{$=K});return new Promise((K,W)=>{const H=(0,o.createServer)($e=>{H.close(),$([new h($e,S),new m($e,S)])});H.on("error",W),H.listen(L,"127.0.0.1",()=>{H.removeListener("error",W),K({onConnected:()=>O})})})}t.createClientSocketTransport=I;function j(L,S="utf-8"){const $=(0,o.createConnection)(L,"127.0.0.1");return[new h($,S),new m($,S)]}t.createServerSocketTransport=j;function J(L){const S=L;return S.read!==void 0&&S.addListener!==void 0}function Z(L){const S=L;return S.write!==void 0&&S.addListener!==void 0}function oe(L,S,$,O){$||($=c.NullLogger);const K=J(L)?new y(L):L,W=Z(S)?new R(S):S;return c.ConnectionStrategy.is(O)&&(O={connectionStrategy:O}),(0,c.createMessageConnection)(K,W,$,O)}t.createMessageConnection=oe}(ys)),ys}var cy,$E;function kE(){return $E||($E=1,cy=ws()),cy}var bs={},Kf={exports:{}},TE;function uy(){return TE||(TE=1,function(t,e){(function(n){{var r=n(Ip,e);r!==void 0&&(t.exports=r)}})(function(n,r){Object.defineProperty(r,"__esModule",{value:!0}),r.TextDocument=r.EOL=r.WorkspaceFolder=r.InlineCompletionContext=r.SelectedCompletionInfo=r.InlineCompletionTriggerKind=r.InlineCompletionList=r.InlineCompletionItem=r.StringValue=r.InlayHint=r.InlayHintLabelPart=r.InlayHintKind=r.InlineValueContext=r.InlineValueEvaluatableExpression=r.InlineValueVariableLookup=r.InlineValueText=r.SemanticTokens=r.SemanticTokenModifiers=r.SemanticTokenTypes=r.SelectionRange=r.DocumentLink=r.FormattingOptions=r.CodeLens=r.CodeAction=r.CodeActionContext=r.CodeActionTriggerKind=r.CodeActionKind=r.DocumentSymbol=r.WorkspaceSymbol=r.SymbolInformation=r.SymbolTag=r.SymbolKind=r.DocumentHighlight=r.DocumentHighlightKind=r.SignatureInformation=r.ParameterInformation=r.Hover=r.MarkedString=r.CompletionList=r.CompletionItem=r.CompletionItemLabelDetails=r.InsertTextMode=r.InsertReplaceEdit=r.CompletionItemTag=r.InsertTextFormat=r.CompletionItemKind=r.MarkupContent=r.MarkupKind=r.TextDocumentItem=r.OptionalVersionedTextDocumentIdentifier=r.VersionedTextDocumentIdentifier=r.TextDocumentIdentifier=r.WorkspaceChange=r.WorkspaceEdit=r.DeleteFile=r.RenameFile=r.CreateFile=r.TextDocumentEdit=r.AnnotatedTextEdit=r.ChangeAnnotationIdentifier=r.ChangeAnnotation=r.TextEdit=r.Command=r.Diagnostic=r.CodeDescription=r.DiagnosticTag=r.DiagnosticSeverity=r.DiagnosticRelatedInformation=r.FoldingRange=r.FoldingRangeKind=r.ColorPresentation=r.ColorInformation=r.Color=r.LocationLink=r.Location=r.Range=r.Position=r.uinteger=r.integer=r.URI=r.DocumentUri=void 0;var i;(function(v){function P(p){return typeof p=="string"}v.is=P})(i||(r.DocumentUri=i={}));var s;(function(v){function P(p){return typeof p=="string"}v.is=P})(s||(r.URI=s={}));var a;(function(v){v.MIN_VALUE=-2147483648,v.MAX_VALUE=2147483647;function P(p){return typeof p=="number"&&v.MIN_VALUE<=p&&p<=v.MAX_VALUE}v.is=P})(a||(r.integer=a={}));var o;(function(v){v.MIN_VALUE=0,v.MAX_VALUE=2147483647;function P(p){return typeof p=="number"&&v.MIN_VALUE<=p&&p<=v.MAX_VALUE}v.is=P})(o||(r.uinteger=o={}));var c;(function(v){function P(T,g){return T===Number.MAX_VALUE&&(T=o.MAX_VALUE),g===Number.MAX_VALUE&&(g=o.MAX_VALUE),{line:T,character:g}}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&M.uinteger(g.line)&&M.uinteger(g.character)}v.is=p})(c||(r.Position=c={}));var u;(function(v){function P(T,g,x,b){if(M.uinteger(T)&&M.uinteger(g)&&M.uinteger(x)&&M.uinteger(b))return{start:c.create(T,g),end:c.create(x,b)};if(c.is(T)&&c.is(g))return{start:T,end:g};throw new Error("Range#create called with invalid arguments[".concat(T,", ").concat(g,", ").concat(x,", ").concat(b,"]"))}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&c.is(g.start)&&c.is(g.end)}v.is=p})(u||(r.Range=u={}));var l;(function(v){function P(T,g){return{uri:T,range:g}}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&u.is(g.range)&&(M.string(g.uri)||M.undefined(g.uri))}v.is=p})(l||(r.Location=l={}));var d;(function(v){function P(T,g,x,b){return{targetUri:T,targetRange:g,targetSelectionRange:x,originSelectionRange:b}}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&u.is(g.targetRange)&&M.string(g.targetUri)&&u.is(g.targetSelectionRange)&&(u.is(g.originSelectionRange)||M.undefined(g.originSelectionRange))}v.is=p})(d||(r.LocationLink=d={}));var f;(function(v){function P(T,g,x,b){return{red:T,green:g,blue:x,alpha:b}}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&M.numberRange(g.red,0,1)&&M.numberRange(g.green,0,1)&&M.numberRange(g.blue,0,1)&&M.numberRange(g.alpha,0,1)}v.is=p})(f||(r.Color=f={}));var h;(function(v){function P(T,g){return{range:T,color:g}}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&u.is(g.range)&&f.is(g.color)}v.is=p})(h||(r.ColorInformation=h={}));var m;(function(v){function P(T,g,x){return{label:T,textEdit:g,additionalTextEdits:x}}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&M.string(g.label)&&(M.undefined(g.textEdit)||j.is(g))&&(M.undefined(g.additionalTextEdits)||M.typedArray(g.additionalTextEdits,j.is))}v.is=p})(m||(r.ColorPresentation=m={}));var y;(function(v){v.Comment="comment",v.Imports="imports",v.Region="region"})(y||(r.FoldingRangeKind=y={}));var R;(function(v){function P(T,g,x,b,G,ee){var re={startLine:T,endLine:g};return M.defined(x)&&(re.startCharacter=x),M.defined(b)&&(re.endCharacter=b),M.defined(G)&&(re.kind=G),M.defined(ee)&&(re.collapsedText=ee),re}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&M.uinteger(g.startLine)&&M.uinteger(g.startLine)&&(M.undefined(g.startCharacter)||M.uinteger(g.startCharacter))&&(M.undefined(g.endCharacter)||M.uinteger(g.endCharacter))&&(M.undefined(g.kind)||M.string(g.kind))}v.is=p})(R||(r.FoldingRange=R={}));var w;(function(v){function P(T,g){return{location:T,message:g}}v.create=P;function p(T){var g=T;return M.defined(g)&&l.is(g.location)&&M.string(g.message)}v.is=p})(w||(r.DiagnosticRelatedInformation=w={}));var k;(function(v){v.Error=1,v.Warning=2,v.Information=3,v.Hint=4})(k||(r.DiagnosticSeverity=k={}));var E;(function(v){v.Unnecessary=1,v.Deprecated=2})(E||(r.DiagnosticTag=E={}));var _;(function(v){function P(p){var T=p;return M.objectLiteral(T)&&M.string(T.href)}v.is=P})(_||(r.CodeDescription=_={}));var C;(function(v){function P(T,g,x,b,G,ee){var re={range:T,message:g};return M.defined(x)&&(re.severity=x),M.defined(b)&&(re.code=b),M.defined(G)&&(re.source=G),M.defined(ee)&&(re.relatedInformation=ee),re}v.create=P;function p(T){var g,x=T;return M.defined(x)&&u.is(x.range)&&M.string(x.message)&&(M.number(x.severity)||M.undefined(x.severity))&&(M.integer(x.code)||M.string(x.code)||M.undefined(x.code))&&(M.undefined(x.codeDescription)||M.string((g=x.codeDescription)===null||g===void 0?void 0:g.href))&&(M.string(x.source)||M.undefined(x.source))&&(M.undefined(x.relatedInformation)||M.typedArray(x.relatedInformation,w.is))}v.is=p})(C||(r.Diagnostic=C={}));var I;(function(v){function P(T,g){for(var x=[],b=2;b<arguments.length;b++)x[b-2]=arguments[b];var G={title:T,command:g};return M.defined(x)&&x.length>0&&(G.arguments=x),G}v.create=P;function p(T){var g=T;return M.defined(g)&&M.string(g.title)&&M.string(g.command)}v.is=p})(I||(r.Command=I={}));var j;(function(v){function P(x,b){return{range:x,newText:b}}v.replace=P;function p(x,b){return{range:{start:x,end:x},newText:b}}v.insert=p;function T(x){return{range:x,newText:""}}v.del=T;function g(x){var b=x;return M.objectLiteral(b)&&M.string(b.newText)&&u.is(b.range)}v.is=g})(j||(r.TextEdit=j={}));var J;(function(v){function P(T,g,x){var b={label:T};return g!==void 0&&(b.needsConfirmation=g),x!==void 0&&(b.description=x),b}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&M.string(g.label)&&(M.boolean(g.needsConfirmation)||g.needsConfirmation===void 0)&&(M.string(g.description)||g.description===void 0)}v.is=p})(J||(r.ChangeAnnotation=J={}));var Z;(function(v){function P(p){var T=p;return M.string(T)}v.is=P})(Z||(r.ChangeAnnotationIdentifier=Z={}));var oe;(function(v){function P(x,b,G){return{range:x,newText:b,annotationId:G}}v.replace=P;function p(x,b,G){return{range:{start:x,end:x},newText:b,annotationId:G}}v.insert=p;function T(x,b){return{range:x,newText:"",annotationId:b}}v.del=T;function g(x){var b=x;return j.is(b)&&(J.is(b.annotationId)||Z.is(b.annotationId))}v.is=g})(oe||(r.AnnotatedTextEdit=oe={}));var L;(function(v){function P(T,g){return{textDocument:T,edits:g}}v.create=P;function p(T){var g=T;return M.defined(g)&&me.is(g.textDocument)&&Array.isArray(g.edits)}v.is=p})(L||(r.TextDocumentEdit=L={}));var S;(function(v){function P(T,g,x){var b={kind:"create",uri:T};return g!==void 0&&(g.overwrite!==void 0||g.ignoreIfExists!==void 0)&&(b.options=g),x!==void 0&&(b.annotationId=x),b}v.create=P;function p(T){var g=T;return g&&g.kind==="create"&&M.string(g.uri)&&(g.options===void 0||(g.options.overwrite===void 0||M.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||M.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||Z.is(g.annotationId))}v.is=p})(S||(r.CreateFile=S={}));var $;(function(v){function P(T,g,x,b){var G={kind:"rename",oldUri:T,newUri:g};return x!==void 0&&(x.overwrite!==void 0||x.ignoreIfExists!==void 0)&&(G.options=x),b!==void 0&&(G.annotationId=b),G}v.create=P;function p(T){var g=T;return g&&g.kind==="rename"&&M.string(g.oldUri)&&M.string(g.newUri)&&(g.options===void 0||(g.options.overwrite===void 0||M.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||M.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||Z.is(g.annotationId))}v.is=p})($||(r.RenameFile=$={}));var O;(function(v){function P(T,g,x){var b={kind:"delete",uri:T};return g!==void 0&&(g.recursive!==void 0||g.ignoreIfNotExists!==void 0)&&(b.options=g),x!==void 0&&(b.annotationId=x),b}v.create=P;function p(T){var g=T;return g&&g.kind==="delete"&&M.string(g.uri)&&(g.options===void 0||(g.options.recursive===void 0||M.boolean(g.options.recursive))&&(g.options.ignoreIfNotExists===void 0||M.boolean(g.options.ignoreIfNotExists)))&&(g.annotationId===void 0||Z.is(g.annotationId))}v.is=p})(O||(r.DeleteFile=O={}));var K;(function(v){function P(p){var T=p;return T&&(T.changes!==void 0||T.documentChanges!==void 0)&&(T.documentChanges===void 0||T.documentChanges.every(function(g){return M.string(g.kind)?S.is(g)||$.is(g)||O.is(g):L.is(g)}))}v.is=P})(K||(r.WorkspaceEdit=K={}));var W=function(){function v(P,p){this.edits=P,this.changeAnnotations=p}return v.prototype.insert=function(P,p,T){var g,x;if(T===void 0?g=j.insert(P,p):Z.is(T)?(x=T,g=oe.insert(P,p,T)):(this.assertChangeAnnotations(this.changeAnnotations),x=this.changeAnnotations.manage(T),g=oe.insert(P,p,x)),this.edits.push(g),x!==void 0)return x},v.prototype.replace=function(P,p,T){var g,x;if(T===void 0?g=j.replace(P,p):Z.is(T)?(x=T,g=oe.replace(P,p,T)):(this.assertChangeAnnotations(this.changeAnnotations),x=this.changeAnnotations.manage(T),g=oe.replace(P,p,x)),this.edits.push(g),x!==void 0)return x},v.prototype.delete=function(P,p){var T,g;if(p===void 0?T=j.del(P):Z.is(p)?(g=p,T=oe.del(P,p)):(this.assertChangeAnnotations(this.changeAnnotations),g=this.changeAnnotations.manage(p),T=oe.del(P,g)),this.edits.push(T),g!==void 0)return g},v.prototype.add=function(P){this.edits.push(P)},v.prototype.all=function(){return this.edits},v.prototype.clear=function(){this.edits.splice(0,this.edits.length)},v.prototype.assertChangeAnnotations=function(P){if(P===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},v}(),H=function(){function v(P){this._annotations=P===void 0?Object.create(null):P,this._counter=0,this._size=0}return v.prototype.all=function(){return this._annotations},Object.defineProperty(v.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),v.prototype.manage=function(P,p){var T;if(Z.is(P)?T=P:(T=this.nextId(),p=P),this._annotations[T]!==void 0)throw new Error("Id ".concat(T," is already in use."));if(p===void 0)throw new Error("No annotation provided for id ".concat(T));return this._annotations[T]=p,this._size++,T},v.prototype.nextId=function(){return this._counter++,this._counter.toString()},v}(),$e=function(){function v(P){var p=this;this._textEditChanges=Object.create(null),P!==void 0?(this._workspaceEdit=P,P.documentChanges?(this._changeAnnotations=new H(P.changeAnnotations),P.changeAnnotations=this._changeAnnotations.all(),P.documentChanges.forEach(function(T){if(L.is(T)){var g=new W(T.edits,p._changeAnnotations);p._textEditChanges[T.textDocument.uri]=g}})):P.changes&&Object.keys(P.changes).forEach(function(T){var g=new W(P.changes[T]);p._textEditChanges[T]=g})):this._workspaceEdit={}}return Object.defineProperty(v.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),v.prototype.getTextEditChange=function(P){if(me.is(P)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var p={uri:P.uri,version:P.version},T=this._textEditChanges[p.uri];if(!T){var g=[],x={textDocument:p,edits:g};this._workspaceEdit.documentChanges.push(x),T=new W(g,this._changeAnnotations),this._textEditChanges[p.uri]=T}return T}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var T=this._textEditChanges[P];if(!T){var g=[];this._workspaceEdit.changes[P]=g,T=new W(g),this._textEditChanges[P]=T}return T}},v.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new H,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},v.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},v.prototype.createFile=function(P,p,T){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;J.is(p)||Z.is(p)?g=p:T=p;var x,b;if(g===void 0?x=S.create(P,T):(b=Z.is(g)?g:this._changeAnnotations.manage(g),x=S.create(P,T,b)),this._workspaceEdit.documentChanges.push(x),b!==void 0)return b},v.prototype.renameFile=function(P,p,T,g){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var x;J.is(T)||Z.is(T)?x=T:g=T;var b,G;if(x===void 0?b=$.create(P,p,g):(G=Z.is(x)?x:this._changeAnnotations.manage(x),b=$.create(P,p,g,G)),this._workspaceEdit.documentChanges.push(b),G!==void 0)return G},v.prototype.deleteFile=function(P,p,T){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;J.is(p)||Z.is(p)?g=p:T=p;var x,b;if(g===void 0?x=O.create(P,T):(b=Z.is(g)?g:this._changeAnnotations.manage(g),x=O.create(P,T,b)),this._workspaceEdit.documentChanges.push(x),b!==void 0)return b},v}();r.WorkspaceChange=$e;var te;(function(v){function P(T){return{uri:T}}v.create=P;function p(T){var g=T;return M.defined(g)&&M.string(g.uri)}v.is=p})(te||(r.TextDocumentIdentifier=te={}));var A;(function(v){function P(T,g){return{uri:T,version:g}}v.create=P;function p(T){var g=T;return M.defined(g)&&M.string(g.uri)&&M.integer(g.version)}v.is=p})(A||(r.VersionedTextDocumentIdentifier=A={}));var me;(function(v){function P(T,g){return{uri:T,version:g}}v.create=P;function p(T){var g=T;return M.defined(g)&&M.string(g.uri)&&(g.version===null||M.integer(g.version))}v.is=p})(me||(r.OptionalVersionedTextDocumentIdentifier=me={}));var _e;(function(v){function P(T,g,x,b){return{uri:T,languageId:g,version:x,text:b}}v.create=P;function p(T){var g=T;return M.defined(g)&&M.string(g.uri)&&M.string(g.languageId)&&M.integer(g.version)&&M.string(g.text)}v.is=p})(_e||(r.TextDocumentItem=_e={}));var st;(function(v){v.PlainText="plaintext",v.Markdown="markdown";function P(p){var T=p;return T===v.PlainText||T===v.Markdown}v.is=P})(st||(r.MarkupKind=st={}));var B;(function(v){function P(p){var T=p;return M.objectLiteral(p)&&st.is(T.kind)&&M.string(T.value)}v.is=P})(B||(r.MarkupContent=B={}));var V;(function(v){v.Text=1,v.Method=2,v.Function=3,v.Constructor=4,v.Field=5,v.Variable=6,v.Class=7,v.Interface=8,v.Module=9,v.Property=10,v.Unit=11,v.Value=12,v.Enum=13,v.Keyword=14,v.Snippet=15,v.Color=16,v.File=17,v.Reference=18,v.Folder=19,v.EnumMember=20,v.Constant=21,v.Struct=22,v.Event=23,v.Operator=24,v.TypeParameter=25})(V||(r.CompletionItemKind=V={}));var Oe;(function(v){v.PlainText=1,v.Snippet=2})(Oe||(r.InsertTextFormat=Oe={}));var ce;(function(v){v.Deprecated=1})(ce||(r.CompletionItemTag=ce={}));var be;(function(v){function P(T,g,x){return{newText:T,insert:g,replace:x}}v.create=P;function p(T){var g=T;return g&&M.string(g.newText)&&u.is(g.insert)&&u.is(g.replace)}v.is=p})(be||(r.InsertReplaceEdit=be={}));var Ae;(function(v){v.asIs=1,v.adjustIndentation=2})(Ae||(r.InsertTextMode=Ae={}));var ue;(function(v){function P(p){var T=p;return T&&(M.string(T.detail)||T.detail===void 0)&&(M.string(T.description)||T.description===void 0)}v.is=P})(ue||(r.CompletionItemLabelDetails=ue={}));var N;(function(v){function P(p){return{label:p}}v.create=P})(N||(r.CompletionItem=N={}));var F;(function(v){function P(p,T){return{items:p||[],isIncomplete:!!T}}v.create=P})(F||(r.CompletionList=F={}));var de;(function(v){function P(T){return T.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}v.fromPlainText=P;function p(T){var g=T;return M.string(g)||M.objectLiteral(g)&&M.string(g.language)&&M.string(g.value)}v.is=p})(de||(r.MarkedString=de={}));var q;(function(v){function P(p){var T=p;return!!T&&M.objectLiteral(T)&&(B.is(T.contents)||de.is(T.contents)||M.typedArray(T.contents,de.is))&&(p.range===void 0||u.is(p.range))}v.is=P})(q||(r.Hover=q={}));var le;(function(v){function P(p,T){return T?{label:p,documentation:T}:{label:p}}v.create=P})(le||(r.ParameterInformation=le={}));var qe;(function(v){function P(p,T){for(var g=[],x=2;x<arguments.length;x++)g[x-2]=arguments[x];var b={label:p};return M.defined(T)&&(b.documentation=T),M.defined(g)?b.parameters=g:b.parameters=[],b}v.create=P})(qe||(r.SignatureInformation=qe={}));var Ze;(function(v){v.Text=1,v.Read=2,v.Write=3})(Ze||(r.DocumentHighlightKind=Ze={}));var ae;(function(v){function P(p,T){var g={range:p};return M.number(T)&&(g.kind=T),g}v.create=P})(ae||(r.DocumentHighlight=ae={}));var Pe;(function(v){v.File=1,v.Module=2,v.Namespace=3,v.Package=4,v.Class=5,v.Method=6,v.Property=7,v.Field=8,v.Constructor=9,v.Enum=10,v.Interface=11,v.Function=12,v.Variable=13,v.Constant=14,v.String=15,v.Number=16,v.Boolean=17,v.Array=18,v.Object=19,v.Key=20,v.Null=21,v.EnumMember=22,v.Struct=23,v.Event=24,v.Operator=25,v.TypeParameter=26})(Pe||(r.SymbolKind=Pe={}));var ne;(function(v){v.Deprecated=1})(ne||(r.SymbolTag=ne={}));var Re;(function(v){function P(p,T,g,x,b){var G={name:p,kind:T,location:{uri:x,range:g}};return b&&(G.containerName=b),G}v.create=P})(Re||(r.SymbolInformation=Re={}));var Me;(function(v){function P(p,T,g,x){return x!==void 0?{name:p,kind:T,location:{uri:g,range:x}}:{name:p,kind:T,location:{uri:g}}}v.create=P})(Me||(r.WorkspaceSymbol=Me={}));var ht;(function(v){function P(T,g,x,b,G,ee){var re={name:T,detail:g,kind:x,range:b,selectionRange:G};return ee!==void 0&&(re.children=ee),re}v.create=P;function p(T){var g=T;return g&&M.string(g.name)&&M.number(g.kind)&&u.is(g.range)&&u.is(g.selectionRange)&&(g.detail===void 0||M.string(g.detail))&&(g.deprecated===void 0||M.boolean(g.deprecated))&&(g.children===void 0||Array.isArray(g.children))&&(g.tags===void 0||Array.isArray(g.tags))}v.is=p})(ht||(r.DocumentSymbol=ht={}));var Ve;(function(v){v.Empty="",v.QuickFix="quickfix",v.Refactor="refactor",v.RefactorExtract="refactor.extract",v.RefactorInline="refactor.inline",v.RefactorRewrite="refactor.rewrite",v.Source="source",v.SourceOrganizeImports="source.organizeImports",v.SourceFixAll="source.fixAll"})(Ve||(r.CodeActionKind=Ve={}));var zt;(function(v){v.Invoked=1,v.Automatic=2})(zt||(r.CodeActionTriggerKind=zt={}));var jt;(function(v){function P(T,g,x){var b={diagnostics:T};return g!=null&&(b.only=g),x!=null&&(b.triggerKind=x),b}v.create=P;function p(T){var g=T;return M.defined(g)&&M.typedArray(g.diagnostics,C.is)&&(g.only===void 0||M.typedArray(g.only,M.string))&&(g.triggerKind===void 0||g.triggerKind===zt.Invoked||g.triggerKind===zt.Automatic)}v.is=p})(jt||(r.CodeActionContext=jt={}));var cn;(function(v){function P(T,g,x){var b={title:T},G=!0;return typeof g=="string"?(G=!1,b.kind=g):I.is(g)?b.command=g:b.edit=g,G&&x!==void 0&&(b.kind=x),b}v.create=P;function p(T){var g=T;return g&&M.string(g.title)&&(g.diagnostics===void 0||M.typedArray(g.diagnostics,C.is))&&(g.kind===void 0||M.string(g.kind))&&(g.edit!==void 0||g.command!==void 0)&&(g.command===void 0||I.is(g.command))&&(g.isPreferred===void 0||M.boolean(g.isPreferred))&&(g.edit===void 0||K.is(g.edit))}v.is=p})(cn||(r.CodeAction=cn={}));var X;(function(v){function P(T,g){var x={range:T};return M.defined(g)&&(x.data=g),x}v.create=P;function p(T){var g=T;return M.defined(g)&&u.is(g.range)&&(M.undefined(g.command)||I.is(g.command))}v.is=p})(X||(r.CodeLens=X={}));var Y;(function(v){function P(T,g){return{tabSize:T,insertSpaces:g}}v.create=P;function p(T){var g=T;return M.defined(g)&&M.uinteger(g.tabSize)&&M.boolean(g.insertSpaces)}v.is=p})(Y||(r.FormattingOptions=Y={}));var fe;(function(v){function P(T,g,x){return{range:T,target:g,data:x}}v.create=P;function p(T){var g=T;return M.defined(g)&&u.is(g.range)&&(M.undefined(g.target)||M.string(g.target))}v.is=p})(fe||(r.DocumentLink=fe={}));var Bt;(function(v){function P(T,g){return{range:T,parent:g}}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&u.is(g.range)&&(g.parent===void 0||v.is(g.parent))}v.is=p})(Bt||(r.SelectionRange=Bt={}));var Ft;(function(v){v.namespace="namespace",v.type="type",v.class="class",v.enum="enum",v.interface="interface",v.struct="struct",v.typeParameter="typeParameter",v.parameter="parameter",v.variable="variable",v.property="property",v.enumMember="enumMember",v.event="event",v.function="function",v.method="method",v.macro="macro",v.keyword="keyword",v.modifier="modifier",v.comment="comment",v.string="string",v.number="number",v.regexp="regexp",v.operator="operator",v.decorator="decorator"})(Ft||(r.SemanticTokenTypes=Ft={}));var mr;(function(v){v.declaration="declaration",v.definition="definition",v.readonly="readonly",v.static="static",v.deprecated="deprecated",v.abstract="abstract",v.async="async",v.modification="modification",v.documentation="documentation",v.defaultLibrary="defaultLibrary"})(mr||(r.SemanticTokenModifiers=mr={}));var ui;(function(v){function P(p){var T=p;return M.objectLiteral(T)&&(T.resultId===void 0||typeof T.resultId=="string")&&Array.isArray(T.data)&&(T.data.length===0||typeof T.data[0]=="number")}v.is=P})(ui||(r.SemanticTokens=ui={}));var ji;(function(v){function P(T,g){return{range:T,text:g}}v.create=P;function p(T){var g=T;return g!=null&&u.is(g.range)&&M.string(g.text)}v.is=p})(ji||(r.InlineValueText=ji={}));var Bi;(function(v){function P(T,g,x){return{range:T,variableName:g,caseSensitiveLookup:x}}v.create=P;function p(T){var g=T;return g!=null&&u.is(g.range)&&M.boolean(g.caseSensitiveLookup)&&(M.string(g.variableName)||g.variableName===void 0)}v.is=p})(Bi||(r.InlineValueVariableLookup=Bi={}));var Ui;(function(v){function P(T,g){return{range:T,expression:g}}v.create=P;function p(T){var g=T;return g!=null&&u.is(g.range)&&(M.string(g.expression)||g.expression===void 0)}v.is=p})(Ui||(r.InlineValueEvaluatableExpression=Ui={}));var Wi;(function(v){function P(T,g){return{frameId:T,stoppedLocation:g}}v.create=P;function p(T){var g=T;return M.defined(g)&&u.is(T.stoppedLocation)}v.is=p})(Wi||(r.InlineValueContext=Wi={}));var li;(function(v){v.Type=1,v.Parameter=2;function P(p){return p===1||p===2}v.is=P})(li||(r.InlayHintKind=li={}));var di;(function(v){function P(T){return{value:T}}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&(g.tooltip===void 0||M.string(g.tooltip)||B.is(g.tooltip))&&(g.location===void 0||l.is(g.location))&&(g.command===void 0||I.is(g.command))}v.is=p})(di||(r.InlayHintLabelPart=di={}));var bn;(function(v){function P(T,g,x){var b={position:T,label:g};return x!==void 0&&(b.kind=x),b}v.create=P;function p(T){var g=T;return M.objectLiteral(g)&&c.is(g.position)&&(M.string(g.label)||M.typedArray(g.label,di.is))&&(g.kind===void 0||li.is(g.kind))&&g.textEdits===void 0||M.typedArray(g.textEdits,j.is)&&(g.tooltip===void 0||M.string(g.tooltip)||B.is(g.tooltip))&&(g.paddingLeft===void 0||M.boolean(g.paddingLeft))&&(g.paddingRight===void 0||M.boolean(g.paddingRight))}v.is=p})(bn||(r.InlayHint=bn={}));var Hi;(function(v){function P(p){return{kind:"snippet",value:p}}v.createSnippet=P})(Hi||(r.StringValue=Hi={}));var Ki;(function(v){function P(p,T,g,x){return{insertText:p,filterText:T,range:g,command:x}}v.create=P})(Ki||(r.InlineCompletionItem=Ki={}));var gr;(function(v){function P(p){return{items:p}}v.create=P})(gr||(r.InlineCompletionList=gr={}));var Vi;(function(v){v.Invoked=0,v.Automatic=1})(Vi||(r.InlineCompletionTriggerKind=Vi={}));var Dr;(function(v){function P(p,T){return{range:p,text:T}}v.create=P})(Dr||(r.SelectedCompletionInfo=Dr={}));var Xi;(function(v){function P(p,T){return{triggerKind:p,selectedCompletionInfo:T}}v.create=P})(Xi||(r.InlineCompletionContext=Xi={}));var Fn;(function(v){function P(p){var T=p;return M.objectLiteral(T)&&s.is(T.uri)&&M.string(T.name)}v.is=P})(Fn||(r.WorkspaceFolder=Fn={})),r.EOL=[`
175
- `,`\r
176
- `,"\r"];var er;(function(v){function P(x,b,G,ee){return new Ys(x,b,G,ee)}v.create=P;function p(x){var b=x;return!!(M.defined(b)&&M.string(b.uri)&&(M.undefined(b.languageId)||M.string(b.languageId))&&M.uinteger(b.lineCount)&&M.func(b.getText)&&M.func(b.positionAt)&&M.func(b.offsetAt))}v.is=p;function T(x,b){for(var G=x.getText(),ee=g(b,function(xe,tt){var Ye=xe.range.start.line-tt.range.start.line;return Ye===0?xe.range.start.character-tt.range.start.character:Ye}),re=G.length,ze=ee.length-1;ze>=0;ze--){var Le=ee[ze],Xe=x.offsetAt(Le.range.start),ge=x.offsetAt(Le.range.end);if(ge<=re)G=G.substring(0,Xe)+Le.newText+G.substring(ge,G.length);else throw new Error("Overlapping edit");re=Xe}return G}v.applyEdits=T;function g(x,b){if(x.length<=1)return x;var G=x.length/2|0,ee=x.slice(0,G),re=x.slice(G);g(ee,b),g(re,b);for(var ze=0,Le=0,Xe=0;ze<ee.length&&Le<re.length;){var ge=b(ee[ze],re[Le]);ge<=0?x[Xe++]=ee[ze++]:x[Xe++]=re[Le++]}for(;ze<ee.length;)x[Xe++]=ee[ze++];for(;Le<re.length;)x[Xe++]=re[Le++];return x}})(er||(r.TextDocument=er={}));var Ys=function(){function v(P,p,T,g){this._uri=P,this._languageId=p,this._version=T,this._content=g,this._lineOffsets=void 0}return Object.defineProperty(v.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),v.prototype.getText=function(P){if(P){var p=this.offsetAt(P.start),T=this.offsetAt(P.end);return this._content.substring(p,T)}return this._content},v.prototype.update=function(P,p){this._content=P.text,this._version=p,this._lineOffsets=void 0},v.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var P=[],p=this._content,T=!0,g=0;g<p.length;g++){T&&(P.push(g),T=!1);var x=p.charAt(g);T=x==="\r"||x===`
177
- `,x==="\r"&&g+1<p.length&&p.charAt(g+1)===`
178
- `&&g++}T&&p.length>0&&P.push(p.length),this._lineOffsets=P}return this._lineOffsets},v.prototype.positionAt=function(P){P=Math.max(Math.min(P,this._content.length),0);var p=this.getLineOffsets(),T=0,g=p.length;if(g===0)return c.create(0,P);for(;T<g;){var x=Math.floor((T+g)/2);p[x]>P?g=x:T=x+1}var b=T-1;return c.create(b,P-p[b])},v.prototype.offsetAt=function(P){var p=this.getLineOffsets();if(P.line>=p.length)return this._content.length;if(P.line<0)return 0;var T=p[P.line],g=P.line+1<p.length?p[P.line+1]:this._content.length;return Math.max(Math.min(T+P.character,g),T)},Object.defineProperty(v.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),v}(),M;(function(v){var P=Object.prototype.toString;function p(ge){return typeof ge<"u"}v.defined=p;function T(ge){return typeof ge>"u"}v.undefined=T;function g(ge){return ge===!0||ge===!1}v.boolean=g;function x(ge){return P.call(ge)==="[object String]"}v.string=x;function b(ge){return P.call(ge)==="[object Number]"}v.number=b;function G(ge,xe,tt){return P.call(ge)==="[object Number]"&&xe<=ge&&ge<=tt}v.numberRange=G;function ee(ge){return P.call(ge)==="[object Number]"&&-2147483648<=ge&&ge<=2147483647}v.integer=ee;function re(ge){return P.call(ge)==="[object Number]"&&0<=ge&&ge<=2147483647}v.uinteger=re;function ze(ge){return P.call(ge)==="[object Function]"}v.func=ze;function Le(ge){return ge!==null&&typeof ge=="object"}v.objectLiteral=Le;function Xe(ge,xe){return Array.isArray(ge)&&ge.every(xe)}v.typedArray=Xe})(M||(M={}))})}(Kf,Kf.exports)),Kf.exports}var mn={},EE;function wt(){if(EE)return mn;EE=1,Object.defineProperty(mn,"__esModule",{value:!0}),mn.ProtocolNotificationType=mn.ProtocolNotificationType0=mn.ProtocolRequestType=mn.ProtocolRequestType0=mn.RegistrationType=mn.MessageDirection=void 0;const t=ws();var e;(function(o){o.clientToServer="clientToServer",o.serverToClient="serverToClient",o.both="both"})(e||(mn.MessageDirection=e={}));class n{constructor(c){this.method=c}}mn.RegistrationType=n;class r extends t.RequestType0{constructor(c){super(c)}}mn.ProtocolRequestType0=r;class i extends t.RequestType{constructor(c){super(c,t.ParameterStructures.byName)}}mn.ProtocolRequestType=i;class s extends t.NotificationType0{constructor(c){super(c)}}mn.ProtocolNotificationType0=s;class a extends t.NotificationType{constructor(c){super(c,t.ParameterStructures.byName)}}return mn.ProtocolNotificationType=a,mn}var ly={},St={},SE;function dy(){if(SE)return St;SE=1,Object.defineProperty(St,"__esModule",{value:!0}),St.objectLiteral=St.typedArray=St.stringArray=St.array=St.func=St.error=St.number=St.string=St.boolean=void 0;function t(u){return u===!0||u===!1}St.boolean=t;function e(u){return typeof u=="string"||u instanceof String}St.string=e;function n(u){return typeof u=="number"||u instanceof Number}St.number=n;function r(u){return u instanceof Error}St.error=r;function i(u){return typeof u=="function"}St.func=i;function s(u){return Array.isArray(u)}St.array=s;function a(u){return s(u)&&u.every(l=>e(l))}St.stringArray=a;function o(u,l){return Array.isArray(u)&&u.every(l)}St.typedArray=o;function c(u){return u!==null&&typeof u=="object"}return St.objectLiteral=c,St}var _c={},_E;function Hj(){if(_E)return _c;_E=1,Object.defineProperty(_c,"__esModule",{value:!0}),_c.ImplementationRequest=void 0;const t=wt();var e;return function(n){n.method="textDocument/implementation",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(_c.ImplementationRequest=e={})),_c}var Ac={},AE;function Kj(){if(AE)return Ac;AE=1,Object.defineProperty(Ac,"__esModule",{value:!0}),Ac.TypeDefinitionRequest=void 0;const t=wt();var e;return function(n){n.method="textDocument/typeDefinition",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(Ac.TypeDefinitionRequest=e={})),Ac}var Rs={},CE;function Vj(){if(CE)return Rs;CE=1,Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.DidChangeWorkspaceFoldersNotification=Rs.WorkspaceFoldersRequest=void 0;const t=wt();var e;(function(r){r.method="workspace/workspaceFolders",r.messageDirection=t.MessageDirection.serverToClient,r.type=new t.ProtocolRequestType0(r.method)})(e||(Rs.WorkspaceFoldersRequest=e={}));var n;return function(r){r.method="workspace/didChangeWorkspaceFolders",r.messageDirection=t.MessageDirection.clientToServer,r.type=new t.ProtocolNotificationType(r.method)}(n||(Rs.DidChangeWorkspaceFoldersNotification=n={})),Rs}var Cc={},PE;function Xj(){if(PE)return Cc;PE=1,Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.ConfigurationRequest=void 0;const t=wt();var e;return function(n){n.method="workspace/configuration",n.messageDirection=t.MessageDirection.serverToClient,n.type=new t.ProtocolRequestType(n.method)}(e||(Cc.ConfigurationRequest=e={})),Cc}var $s={},xE;function Yj(){if(xE)return $s;xE=1,Object.defineProperty($s,"__esModule",{value:!0}),$s.ColorPresentationRequest=$s.DocumentColorRequest=void 0;const t=wt();var e;(function(r){r.method="textDocument/documentColor",r.messageDirection=t.MessageDirection.clientToServer,r.type=new t.ProtocolRequestType(r.method)})(e||($s.DocumentColorRequest=e={}));var n;return function(r){r.method="textDocument/colorPresentation",r.messageDirection=t.MessageDirection.clientToServer,r.type=new t.ProtocolRequestType(r.method)}(n||($s.ColorPresentationRequest=n={})),$s}var ks={},NE;function Jj(){if(NE)return ks;NE=1,Object.defineProperty(ks,"__esModule",{value:!0}),ks.FoldingRangeRefreshRequest=ks.FoldingRangeRequest=void 0;const t=wt();var e;(function(r){r.method="textDocument/foldingRange",r.messageDirection=t.MessageDirection.clientToServer,r.type=new t.ProtocolRequestType(r.method)})(e||(ks.FoldingRangeRequest=e={}));var n;return function(r){r.method="workspace/foldingRange/refresh",r.messageDirection=t.MessageDirection.serverToClient,r.type=new t.ProtocolRequestType0(r.method)}(n||(ks.FoldingRangeRefreshRequest=n={})),ks}var Pc={},DE;function Qj(){if(DE)return Pc;DE=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.DeclarationRequest=void 0;const t=wt();var e;return function(n){n.method="textDocument/declaration",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(Pc.DeclarationRequest=e={})),Pc}var xc={},IE;function Zj(){if(IE)return xc;IE=1,Object.defineProperty(xc,"__esModule",{value:!0}),xc.SelectionRangeRequest=void 0;const t=wt();var e;return function(n){n.method="textDocument/selectionRange",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(xc.SelectionRangeRequest=e={})),xc}var Jr={},OE;function e2(){if(OE)return Jr;OE=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.WorkDoneProgressCancelNotification=Jr.WorkDoneProgressCreateRequest=Jr.WorkDoneProgress=void 0;const t=ws(),e=wt();var n;(function(s){s.type=new t.ProgressType;function a(o){return o===s.type}s.is=a})(n||(Jr.WorkDoneProgress=n={}));var r;(function(s){s.method="window/workDoneProgress/create",s.messageDirection=e.MessageDirection.serverToClient,s.type=new e.ProtocolRequestType(s.method)})(r||(Jr.WorkDoneProgressCreateRequest=r={}));var i;return function(s){s.method="window/workDoneProgress/cancel",s.messageDirection=e.MessageDirection.clientToServer,s.type=new e.ProtocolNotificationType(s.method)}(i||(Jr.WorkDoneProgressCancelNotification=i={})),Jr}var Qr={},LE;function t2(){if(LE)return Qr;LE=1,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.CallHierarchyOutgoingCallsRequest=Qr.CallHierarchyIncomingCallsRequest=Qr.CallHierarchyPrepareRequest=void 0;const t=wt();var e;(function(i){i.method="textDocument/prepareCallHierarchy",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(e||(Qr.CallHierarchyPrepareRequest=e={}));var n;(function(i){i.method="callHierarchy/incomingCalls",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(n||(Qr.CallHierarchyIncomingCallsRequest=n={}));var r;return function(i){i.method="callHierarchy/outgoingCalls",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)}(r||(Qr.CallHierarchyOutgoingCallsRequest=r={})),Qr}var gn={},ME;function n2(){if(ME)return gn;ME=1,Object.defineProperty(gn,"__esModule",{value:!0}),gn.SemanticTokensRefreshRequest=gn.SemanticTokensRangeRequest=gn.SemanticTokensDeltaRequest=gn.SemanticTokensRequest=gn.SemanticTokensRegistrationType=gn.TokenFormat=void 0;const t=wt();var e;(function(o){o.Relative="relative"})(e||(gn.TokenFormat=e={}));var n;(function(o){o.method="textDocument/semanticTokens",o.type=new t.RegistrationType(o.method)})(n||(gn.SemanticTokensRegistrationType=n={}));var r;(function(o){o.method="textDocument/semanticTokens/full",o.messageDirection=t.MessageDirection.clientToServer,o.type=new t.ProtocolRequestType(o.method),o.registrationMethod=n.method})(r||(gn.SemanticTokensRequest=r={}));var i;(function(o){o.method="textDocument/semanticTokens/full/delta",o.messageDirection=t.MessageDirection.clientToServer,o.type=new t.ProtocolRequestType(o.method),o.registrationMethod=n.method})(i||(gn.SemanticTokensDeltaRequest=i={}));var s;(function(o){o.method="textDocument/semanticTokens/range",o.messageDirection=t.MessageDirection.clientToServer,o.type=new t.ProtocolRequestType(o.method),o.registrationMethod=n.method})(s||(gn.SemanticTokensRangeRequest=s={}));var a;return function(o){o.method="workspace/semanticTokens/refresh",o.messageDirection=t.MessageDirection.serverToClient,o.type=new t.ProtocolRequestType0(o.method)}(a||(gn.SemanticTokensRefreshRequest=a={})),gn}var Nc={},zE;function r2(){if(zE)return Nc;zE=1,Object.defineProperty(Nc,"__esModule",{value:!0}),Nc.ShowDocumentRequest=void 0;const t=wt();var e;return function(n){n.method="window/showDocument",n.messageDirection=t.MessageDirection.serverToClient,n.type=new t.ProtocolRequestType(n.method)}(e||(Nc.ShowDocumentRequest=e={})),Nc}var Dc={},FE;function i2(){if(FE)return Dc;FE=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.LinkedEditingRangeRequest=void 0;const t=wt();var e;return function(n){n.method="textDocument/linkedEditingRange",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(Dc.LinkedEditingRangeRequest=e={})),Dc}var Yt={},qE;function s2(){if(qE)return Yt;qE=1,Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.WillDeleteFilesRequest=Yt.DidDeleteFilesNotification=Yt.DidRenameFilesNotification=Yt.WillRenameFilesRequest=Yt.DidCreateFilesNotification=Yt.WillCreateFilesRequest=Yt.FileOperationPatternKind=void 0;const t=wt();var e;(function(c){c.file="file",c.folder="folder"})(e||(Yt.FileOperationPatternKind=e={}));var n;(function(c){c.method="workspace/willCreateFiles",c.messageDirection=t.MessageDirection.clientToServer,c.type=new t.ProtocolRequestType(c.method)})(n||(Yt.WillCreateFilesRequest=n={}));var r;(function(c){c.method="workspace/didCreateFiles",c.messageDirection=t.MessageDirection.clientToServer,c.type=new t.ProtocolNotificationType(c.method)})(r||(Yt.DidCreateFilesNotification=r={}));var i;(function(c){c.method="workspace/willRenameFiles",c.messageDirection=t.MessageDirection.clientToServer,c.type=new t.ProtocolRequestType(c.method)})(i||(Yt.WillRenameFilesRequest=i={}));var s;(function(c){c.method="workspace/didRenameFiles",c.messageDirection=t.MessageDirection.clientToServer,c.type=new t.ProtocolNotificationType(c.method)})(s||(Yt.DidRenameFilesNotification=s={}));var a;(function(c){c.method="workspace/didDeleteFiles",c.messageDirection=t.MessageDirection.clientToServer,c.type=new t.ProtocolNotificationType(c.method)})(a||(Yt.DidDeleteFilesNotification=a={}));var o;return function(c){c.method="workspace/willDeleteFiles",c.messageDirection=t.MessageDirection.clientToServer,c.type=new t.ProtocolRequestType(c.method)}(o||(Yt.WillDeleteFilesRequest=o={})),Yt}var Zr={},GE;function a2(){if(GE)return Zr;GE=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.MonikerRequest=Zr.MonikerKind=Zr.UniquenessLevel=void 0;const t=wt();var e;(function(i){i.document="document",i.project="project",i.group="group",i.scheme="scheme",i.global="global"})(e||(Zr.UniquenessLevel=e={}));var n;(function(i){i.$import="import",i.$export="export",i.local="local"})(n||(Zr.MonikerKind=n={}));var r;return function(i){i.method="textDocument/moniker",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)}(r||(Zr.MonikerRequest=r={})),Zr}var ei={},jE;function o2(){if(jE)return ei;jE=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei.TypeHierarchySubtypesRequest=ei.TypeHierarchySupertypesRequest=ei.TypeHierarchyPrepareRequest=void 0;const t=wt();var e;(function(i){i.method="textDocument/prepareTypeHierarchy",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(e||(ei.TypeHierarchyPrepareRequest=e={}));var n;(function(i){i.method="typeHierarchy/supertypes",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(n||(ei.TypeHierarchySupertypesRequest=n={}));var r;return function(i){i.method="typeHierarchy/subtypes",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)}(r||(ei.TypeHierarchySubtypesRequest=r={})),ei}var Ts={},BE;function c2(){if(BE)return Ts;BE=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.InlineValueRefreshRequest=Ts.InlineValueRequest=void 0;const t=wt();var e;(function(r){r.method="textDocument/inlineValue",r.messageDirection=t.MessageDirection.clientToServer,r.type=new t.ProtocolRequestType(r.method)})(e||(Ts.InlineValueRequest=e={}));var n;return function(r){r.method="workspace/inlineValue/refresh",r.messageDirection=t.MessageDirection.serverToClient,r.type=new t.ProtocolRequestType0(r.method)}(n||(Ts.InlineValueRefreshRequest=n={})),Ts}var ti={},UE;function u2(){if(UE)return ti;UE=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.InlayHintRefreshRequest=ti.InlayHintResolveRequest=ti.InlayHintRequest=void 0;const t=wt();var e;(function(i){i.method="textDocument/inlayHint",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(e||(ti.InlayHintRequest=e={}));var n;(function(i){i.method="inlayHint/resolve",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(n||(ti.InlayHintResolveRequest=n={}));var r;return function(i){i.method="workspace/inlayHint/refresh",i.messageDirection=t.MessageDirection.serverToClient,i.type=new t.ProtocolRequestType0(i.method)}(r||(ti.InlayHintRefreshRequest=r={})),ti}var In={},WE;function l2(){if(WE)return In;WE=1,Object.defineProperty(In,"__esModule",{value:!0}),In.DiagnosticRefreshRequest=In.WorkspaceDiagnosticRequest=In.DocumentDiagnosticRequest=In.DocumentDiagnosticReportKind=In.DiagnosticServerCancellationData=void 0;const t=ws(),e=dy(),n=wt();var r;(function(c){function u(l){const d=l;return d&&e.boolean(d.retriggerRequest)}c.is=u})(r||(In.DiagnosticServerCancellationData=r={}));var i;(function(c){c.Full="full",c.Unchanged="unchanged"})(i||(In.DocumentDiagnosticReportKind=i={}));var s;(function(c){c.method="textDocument/diagnostic",c.messageDirection=n.MessageDirection.clientToServer,c.type=new n.ProtocolRequestType(c.method),c.partialResult=new t.ProgressType})(s||(In.DocumentDiagnosticRequest=s={}));var a;(function(c){c.method="workspace/diagnostic",c.messageDirection=n.MessageDirection.clientToServer,c.type=new n.ProtocolRequestType(c.method),c.partialResult=new t.ProgressType})(a||(In.WorkspaceDiagnosticRequest=a={}));var o;return function(c){c.method="workspace/diagnostic/refresh",c.messageDirection=n.MessageDirection.serverToClient,c.type=new n.ProtocolRequestType0(c.method)}(o||(In.DiagnosticRefreshRequest=o={})),In}var bt={},HE;function d2(){if(HE)return bt;HE=1,Object.defineProperty(bt,"__esModule",{value:!0}),bt.DidCloseNotebookDocumentNotification=bt.DidSaveNotebookDocumentNotification=bt.DidChangeNotebookDocumentNotification=bt.NotebookCellArrayChange=bt.DidOpenNotebookDocumentNotification=bt.NotebookDocumentSyncRegistrationType=bt.NotebookDocument=bt.NotebookCell=bt.ExecutionSummary=bt.NotebookCellKind=void 0;const t=uy(),e=dy(),n=wt();var r;(function(h){h.Markup=1,h.Code=2;function m(y){return y===1||y===2}h.is=m})(r||(bt.NotebookCellKind=r={}));var i;(function(h){function m(w,k){const E={executionOrder:w};return(k===!0||k===!1)&&(E.success=k),E}h.create=m;function y(w){const k=w;return e.objectLiteral(k)&&t.uinteger.is(k.executionOrder)&&(k.success===void 0||e.boolean(k.success))}h.is=y;function R(w,k){return w===k?!0:w==null||k===null||k===void 0?!1:w.executionOrder===k.executionOrder&&w.success===k.success}h.equals=R})(i||(bt.ExecutionSummary=i={}));var s;(function(h){function m(k,E){return{kind:k,document:E}}h.create=m;function y(k){const E=k;return e.objectLiteral(E)&&r.is(E.kind)&&t.DocumentUri.is(E.document)&&(E.metadata===void 0||e.objectLiteral(E.metadata))}h.is=y;function R(k,E){const _=new Set;return k.document!==E.document&&_.add("document"),k.kind!==E.kind&&_.add("kind"),k.executionSummary!==E.executionSummary&&_.add("executionSummary"),(k.metadata!==void 0||E.metadata!==void 0)&&!w(k.metadata,E.metadata)&&_.add("metadata"),(k.executionSummary!==void 0||E.executionSummary!==void 0)&&!i.equals(k.executionSummary,E.executionSummary)&&_.add("executionSummary"),_}h.diff=R;function w(k,E){if(k===E)return!0;if(k==null||E===null||E===void 0||typeof k!=typeof E||typeof k!="object")return!1;const _=Array.isArray(k),C=Array.isArray(E);if(_!==C)return!1;if(_&&C){if(k.length!==E.length)return!1;for(let I=0;I<k.length;I++)if(!w(k[I],E[I]))return!1}if(e.objectLiteral(k)&&e.objectLiteral(E)){const I=Object.keys(k),j=Object.keys(E);if(I.length!==j.length||(I.sort(),j.sort(),!w(I,j)))return!1;for(let J=0;J<I.length;J++){const Z=I[J];if(!w(k[Z],E[Z]))return!1}}return!0}})(s||(bt.NotebookCell=s={}));var a;(function(h){function m(R,w,k,E){return{uri:R,notebookType:w,version:k,cells:E}}h.create=m;function y(R){const w=R;return e.objectLiteral(w)&&e.string(w.uri)&&t.integer.is(w.version)&&e.typedArray(w.cells,s.is)}h.is=y})(a||(bt.NotebookDocument=a={}));var o;(function(h){h.method="notebookDocument/sync",h.messageDirection=n.MessageDirection.clientToServer,h.type=new n.RegistrationType(h.method)})(o||(bt.NotebookDocumentSyncRegistrationType=o={}));var c;(function(h){h.method="notebookDocument/didOpen",h.messageDirection=n.MessageDirection.clientToServer,h.type=new n.ProtocolNotificationType(h.method),h.registrationMethod=o.method})(c||(bt.DidOpenNotebookDocumentNotification=c={}));var u;(function(h){function m(R){const w=R;return e.objectLiteral(w)&&t.uinteger.is(w.start)&&t.uinteger.is(w.deleteCount)&&(w.cells===void 0||e.typedArray(w.cells,s.is))}h.is=m;function y(R,w,k){const E={start:R,deleteCount:w};return k!==void 0&&(E.cells=k),E}h.create=y})(u||(bt.NotebookCellArrayChange=u={}));var l;(function(h){h.method="notebookDocument/didChange",h.messageDirection=n.MessageDirection.clientToServer,h.type=new n.ProtocolNotificationType(h.method),h.registrationMethod=o.method})(l||(bt.DidChangeNotebookDocumentNotification=l={}));var d;(function(h){h.method="notebookDocument/didSave",h.messageDirection=n.MessageDirection.clientToServer,h.type=new n.ProtocolNotificationType(h.method),h.registrationMethod=o.method})(d||(bt.DidSaveNotebookDocumentNotification=d={}));var f;return function(h){h.method="notebookDocument/didClose",h.messageDirection=n.MessageDirection.clientToServer,h.type=new n.ProtocolNotificationType(h.method),h.registrationMethod=o.method}(f||(bt.DidCloseNotebookDocumentNotification=f={})),bt}var Ic={},KE;function f2(){if(KE)return Ic;KE=1,Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.InlineCompletionRequest=void 0;const t=wt();var e;return function(n){n.method="textDocument/inlineCompletion",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(Ic.InlineCompletionRequest=e={})),Ic}var VE;function h2(){return VE||(VE=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceSymbolRequest=t.CodeActionResolveRequest=t.CodeActionRequest=t.DocumentSymbolRequest=t.DocumentHighlightRequest=t.ReferencesRequest=t.DefinitionRequest=t.SignatureHelpRequest=t.SignatureHelpTriggerKind=t.HoverRequest=t.CompletionResolveRequest=t.CompletionRequest=t.CompletionTriggerKind=t.PublishDiagnosticsNotification=t.WatchKind=t.RelativePattern=t.FileChangeType=t.DidChangeWatchedFilesNotification=t.WillSaveTextDocumentWaitUntilRequest=t.WillSaveTextDocumentNotification=t.TextDocumentSaveReason=t.DidSaveTextDocumentNotification=t.DidCloseTextDocumentNotification=t.DidChangeTextDocumentNotification=t.TextDocumentContentChangeEvent=t.DidOpenTextDocumentNotification=t.TextDocumentSyncKind=t.TelemetryEventNotification=t.LogMessageNotification=t.ShowMessageRequest=t.ShowMessageNotification=t.MessageType=t.DidChangeConfigurationNotification=t.ExitNotification=t.ShutdownRequest=t.InitializedNotification=t.InitializeErrorCodes=t.InitializeRequest=t.WorkDoneProgressOptions=t.TextDocumentRegistrationOptions=t.StaticRegistrationOptions=t.PositionEncodingKind=t.FailureHandlingKind=t.ResourceOperationKind=t.UnregistrationRequest=t.RegistrationRequest=t.DocumentSelector=t.NotebookCellTextDocumentFilter=t.NotebookDocumentFilter=t.TextDocumentFilter=void 0,t.MonikerRequest=t.MonikerKind=t.UniquenessLevel=t.WillDeleteFilesRequest=t.DidDeleteFilesNotification=t.WillRenameFilesRequest=t.DidRenameFilesNotification=t.WillCreateFilesRequest=t.DidCreateFilesNotification=t.FileOperationPatternKind=t.LinkedEditingRangeRequest=t.ShowDocumentRequest=t.SemanticTokensRegistrationType=t.SemanticTokensRefreshRequest=t.SemanticTokensRangeRequest=t.SemanticTokensDeltaRequest=t.SemanticTokensRequest=t.TokenFormat=t.CallHierarchyPrepareRequest=t.CallHierarchyOutgoingCallsRequest=t.CallHierarchyIncomingCallsRequest=t.WorkDoneProgressCancelNotification=t.WorkDoneProgressCreateRequest=t.WorkDoneProgress=t.SelectionRangeRequest=t.DeclarationRequest=t.FoldingRangeRefreshRequest=t.FoldingRangeRequest=t.ColorPresentationRequest=t.DocumentColorRequest=t.ConfigurationRequest=t.DidChangeWorkspaceFoldersNotification=t.WorkspaceFoldersRequest=t.TypeDefinitionRequest=t.ImplementationRequest=t.ApplyWorkspaceEditRequest=t.ExecuteCommandRequest=t.PrepareRenameRequest=t.RenameRequest=t.PrepareSupportDefaultBehavior=t.DocumentOnTypeFormattingRequest=t.DocumentRangesFormattingRequest=t.DocumentRangeFormattingRequest=t.DocumentFormattingRequest=t.DocumentLinkResolveRequest=t.DocumentLinkRequest=t.CodeLensRefreshRequest=t.CodeLensResolveRequest=t.CodeLensRequest=t.WorkspaceSymbolResolveRequest=void 0,t.InlineCompletionRequest=t.DidCloseNotebookDocumentNotification=t.DidSaveNotebookDocumentNotification=t.DidChangeNotebookDocumentNotification=t.NotebookCellArrayChange=t.DidOpenNotebookDocumentNotification=t.NotebookDocumentSyncRegistrationType=t.NotebookDocument=t.NotebookCell=t.ExecutionSummary=t.NotebookCellKind=t.DiagnosticRefreshRequest=t.WorkspaceDiagnosticRequest=t.DocumentDiagnosticRequest=t.DocumentDiagnosticReportKind=t.DiagnosticServerCancellationData=t.InlayHintRefreshRequest=t.InlayHintResolveRequest=t.InlayHintRequest=t.InlineValueRefreshRequest=t.InlineValueRequest=t.TypeHierarchySupertypesRequest=t.TypeHierarchySubtypesRequest=t.TypeHierarchyPrepareRequest=void 0;const e=wt(),n=uy(),r=dy(),i=Hj();Object.defineProperty(t,"ImplementationRequest",{enumerable:!0,get:function(){return i.ImplementationRequest}});const s=Kj();Object.defineProperty(t,"TypeDefinitionRequest",{enumerable:!0,get:function(){return s.TypeDefinitionRequest}});const a=Vj();Object.defineProperty(t,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return a.WorkspaceFoldersRequest}}),Object.defineProperty(t,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return a.DidChangeWorkspaceFoldersNotification}});const o=Xj();Object.defineProperty(t,"ConfigurationRequest",{enumerable:!0,get:function(){return o.ConfigurationRequest}});const c=Yj();Object.defineProperty(t,"DocumentColorRequest",{enumerable:!0,get:function(){return c.DocumentColorRequest}}),Object.defineProperty(t,"ColorPresentationRequest",{enumerable:!0,get:function(){return c.ColorPresentationRequest}});const u=Jj();Object.defineProperty(t,"FoldingRangeRequest",{enumerable:!0,get:function(){return u.FoldingRangeRequest}}),Object.defineProperty(t,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return u.FoldingRangeRefreshRequest}});const l=Qj();Object.defineProperty(t,"DeclarationRequest",{enumerable:!0,get:function(){return l.DeclarationRequest}});const d=Zj();Object.defineProperty(t,"SelectionRangeRequest",{enumerable:!0,get:function(){return d.SelectionRangeRequest}});const f=e2();Object.defineProperty(t,"WorkDoneProgress",{enumerable:!0,get:function(){return f.WorkDoneProgress}}),Object.defineProperty(t,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return f.WorkDoneProgressCreateRequest}}),Object.defineProperty(t,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return f.WorkDoneProgressCancelNotification}});const h=t2();Object.defineProperty(t,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(t,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(t,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return h.CallHierarchyPrepareRequest}});const m=n2();Object.defineProperty(t,"TokenFormat",{enumerable:!0,get:function(){return m.TokenFormat}}),Object.defineProperty(t,"SemanticTokensRequest",{enumerable:!0,get:function(){return m.SemanticTokensRequest}}),Object.defineProperty(t,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return m.SemanticTokensDeltaRequest}}),Object.defineProperty(t,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return m.SemanticTokensRangeRequest}}),Object.defineProperty(t,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return m.SemanticTokensRefreshRequest}}),Object.defineProperty(t,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return m.SemanticTokensRegistrationType}});const y=r2();Object.defineProperty(t,"ShowDocumentRequest",{enumerable:!0,get:function(){return y.ShowDocumentRequest}});const R=i2();Object.defineProperty(t,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return R.LinkedEditingRangeRequest}});const w=s2();Object.defineProperty(t,"FileOperationPatternKind",{enumerable:!0,get:function(){return w.FileOperationPatternKind}}),Object.defineProperty(t,"DidCreateFilesNotification",{enumerable:!0,get:function(){return w.DidCreateFilesNotification}}),Object.defineProperty(t,"WillCreateFilesRequest",{enumerable:!0,get:function(){return w.WillCreateFilesRequest}}),Object.defineProperty(t,"DidRenameFilesNotification",{enumerable:!0,get:function(){return w.DidRenameFilesNotification}}),Object.defineProperty(t,"WillRenameFilesRequest",{enumerable:!0,get:function(){return w.WillRenameFilesRequest}}),Object.defineProperty(t,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return w.DidDeleteFilesNotification}}),Object.defineProperty(t,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return w.WillDeleteFilesRequest}});const k=a2();Object.defineProperty(t,"UniquenessLevel",{enumerable:!0,get:function(){return k.UniquenessLevel}}),Object.defineProperty(t,"MonikerKind",{enumerable:!0,get:function(){return k.MonikerKind}}),Object.defineProperty(t,"MonikerRequest",{enumerable:!0,get:function(){return k.MonikerRequest}});const E=o2();Object.defineProperty(t,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return E.TypeHierarchyPrepareRequest}}),Object.defineProperty(t,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return E.TypeHierarchySubtypesRequest}}),Object.defineProperty(t,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return E.TypeHierarchySupertypesRequest}});const _=c2();Object.defineProperty(t,"InlineValueRequest",{enumerable:!0,get:function(){return _.InlineValueRequest}}),Object.defineProperty(t,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return _.InlineValueRefreshRequest}});const C=u2();Object.defineProperty(t,"InlayHintRequest",{enumerable:!0,get:function(){return C.InlayHintRequest}}),Object.defineProperty(t,"InlayHintResolveRequest",{enumerable:!0,get:function(){return C.InlayHintResolveRequest}}),Object.defineProperty(t,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return C.InlayHintRefreshRequest}});const I=l2();Object.defineProperty(t,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return I.DiagnosticServerCancellationData}}),Object.defineProperty(t,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return I.DocumentDiagnosticReportKind}}),Object.defineProperty(t,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return I.DocumentDiagnosticRequest}}),Object.defineProperty(t,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return I.WorkspaceDiagnosticRequest}}),Object.defineProperty(t,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return I.DiagnosticRefreshRequest}});const j=d2();Object.defineProperty(t,"NotebookCellKind",{enumerable:!0,get:function(){return j.NotebookCellKind}}),Object.defineProperty(t,"ExecutionSummary",{enumerable:!0,get:function(){return j.ExecutionSummary}}),Object.defineProperty(t,"NotebookCell",{enumerable:!0,get:function(){return j.NotebookCell}}),Object.defineProperty(t,"NotebookDocument",{enumerable:!0,get:function(){return j.NotebookDocument}}),Object.defineProperty(t,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return j.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(t,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return j.DidOpenNotebookDocumentNotification}}),Object.defineProperty(t,"NotebookCellArrayChange",{enumerable:!0,get:function(){return j.NotebookCellArrayChange}}),Object.defineProperty(t,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return j.DidChangeNotebookDocumentNotification}}),Object.defineProperty(t,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return j.DidSaveNotebookDocumentNotification}}),Object.defineProperty(t,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return j.DidCloseNotebookDocumentNotification}});const J=f2();Object.defineProperty(t,"InlineCompletionRequest",{enumerable:!0,get:function(){return J.InlineCompletionRequest}});var Z;(function(p){function T(g){const x=g;return r.string(x)||r.string(x.language)||r.string(x.scheme)||r.string(x.pattern)}p.is=T})(Z||(t.TextDocumentFilter=Z={}));var oe;(function(p){function T(g){const x=g;return r.objectLiteral(x)&&(r.string(x.notebookType)||r.string(x.scheme)||r.string(x.pattern))}p.is=T})(oe||(t.NotebookDocumentFilter=oe={}));var L;(function(p){function T(g){const x=g;return r.objectLiteral(x)&&(r.string(x.notebook)||oe.is(x.notebook))&&(x.language===void 0||r.string(x.language))}p.is=T})(L||(t.NotebookCellTextDocumentFilter=L={}));var S;(function(p){function T(g){if(!Array.isArray(g))return!1;for(let x of g)if(!r.string(x)&&!Z.is(x)&&!L.is(x))return!1;return!0}p.is=T})(S||(t.DocumentSelector=S={}));var $;(function(p){p.method="client/registerCapability",p.messageDirection=e.MessageDirection.serverToClient,p.type=new e.ProtocolRequestType(p.method)})($||(t.RegistrationRequest=$={}));var O;(function(p){p.method="client/unregisterCapability",p.messageDirection=e.MessageDirection.serverToClient,p.type=new e.ProtocolRequestType(p.method)})(O||(t.UnregistrationRequest=O={}));var K;(function(p){p.Create="create",p.Rename="rename",p.Delete="delete"})(K||(t.ResourceOperationKind=K={}));var W;(function(p){p.Abort="abort",p.Transactional="transactional",p.TextOnlyTransactional="textOnlyTransactional",p.Undo="undo"})(W||(t.FailureHandlingKind=W={}));var H;(function(p){p.UTF8="utf-8",p.UTF16="utf-16",p.UTF32="utf-32"})(H||(t.PositionEncodingKind=H={}));var $e;(function(p){function T(g){const x=g;return x&&r.string(x.id)&&x.id.length>0}p.hasId=T})($e||(t.StaticRegistrationOptions=$e={}));var te;(function(p){function T(g){const x=g;return x&&(x.documentSelector===null||S.is(x.documentSelector))}p.is=T})(te||(t.TextDocumentRegistrationOptions=te={}));var A;(function(p){function T(x){const b=x;return r.objectLiteral(b)&&(b.workDoneProgress===void 0||r.boolean(b.workDoneProgress))}p.is=T;function g(x){const b=x;return b&&r.boolean(b.workDoneProgress)}p.hasWorkDoneProgress=g})(A||(t.WorkDoneProgressOptions=A={}));var me;(function(p){p.method="initialize",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(me||(t.InitializeRequest=me={}));var _e;(function(p){p.unknownProtocolVersion=1})(_e||(t.InitializeErrorCodes=_e={}));var st;(function(p){p.method="initialized",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolNotificationType(p.method)})(st||(t.InitializedNotification=st={}));var B;(function(p){p.method="shutdown",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType0(p.method)})(B||(t.ShutdownRequest=B={}));var V;(function(p){p.method="exit",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolNotificationType0(p.method)})(V||(t.ExitNotification=V={}));var Oe;(function(p){p.method="workspace/didChangeConfiguration",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolNotificationType(p.method)})(Oe||(t.DidChangeConfigurationNotification=Oe={}));var ce;(function(p){p.Error=1,p.Warning=2,p.Info=3,p.Log=4,p.Debug=5})(ce||(t.MessageType=ce={}));var be;(function(p){p.method="window/showMessage",p.messageDirection=e.MessageDirection.serverToClient,p.type=new e.ProtocolNotificationType(p.method)})(be||(t.ShowMessageNotification=be={}));var Ae;(function(p){p.method="window/showMessageRequest",p.messageDirection=e.MessageDirection.serverToClient,p.type=new e.ProtocolRequestType(p.method)})(Ae||(t.ShowMessageRequest=Ae={}));var ue;(function(p){p.method="window/logMessage",p.messageDirection=e.MessageDirection.serverToClient,p.type=new e.ProtocolNotificationType(p.method)})(ue||(t.LogMessageNotification=ue={}));var N;(function(p){p.method="telemetry/event",p.messageDirection=e.MessageDirection.serverToClient,p.type=new e.ProtocolNotificationType(p.method)})(N||(t.TelemetryEventNotification=N={}));var F;(function(p){p.None=0,p.Full=1,p.Incremental=2})(F||(t.TextDocumentSyncKind=F={}));var de;(function(p){p.method="textDocument/didOpen",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolNotificationType(p.method)})(de||(t.DidOpenTextDocumentNotification=de={}));var q;(function(p){function T(x){let b=x;return b!=null&&typeof b.text=="string"&&b.range!==void 0&&(b.rangeLength===void 0||typeof b.rangeLength=="number")}p.isIncremental=T;function g(x){let b=x;return b!=null&&typeof b.text=="string"&&b.range===void 0&&b.rangeLength===void 0}p.isFull=g})(q||(t.TextDocumentContentChangeEvent=q={}));var le;(function(p){p.method="textDocument/didChange",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolNotificationType(p.method)})(le||(t.DidChangeTextDocumentNotification=le={}));var qe;(function(p){p.method="textDocument/didClose",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolNotificationType(p.method)})(qe||(t.DidCloseTextDocumentNotification=qe={}));var Ze;(function(p){p.method="textDocument/didSave",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolNotificationType(p.method)})(Ze||(t.DidSaveTextDocumentNotification=Ze={}));var ae;(function(p){p.Manual=1,p.AfterDelay=2,p.FocusOut=3})(ae||(t.TextDocumentSaveReason=ae={}));var Pe;(function(p){p.method="textDocument/willSave",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolNotificationType(p.method)})(Pe||(t.WillSaveTextDocumentNotification=Pe={}));var ne;(function(p){p.method="textDocument/willSaveWaitUntil",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(ne||(t.WillSaveTextDocumentWaitUntilRequest=ne={}));var Re;(function(p){p.method="workspace/didChangeWatchedFiles",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolNotificationType(p.method)})(Re||(t.DidChangeWatchedFilesNotification=Re={}));var Me;(function(p){p.Created=1,p.Changed=2,p.Deleted=3})(Me||(t.FileChangeType=Me={}));var ht;(function(p){function T(g){const x=g;return r.objectLiteral(x)&&(n.URI.is(x.baseUri)||n.WorkspaceFolder.is(x.baseUri))&&r.string(x.pattern)}p.is=T})(ht||(t.RelativePattern=ht={}));var Ve;(function(p){p.Create=1,p.Change=2,p.Delete=4})(Ve||(t.WatchKind=Ve={}));var zt;(function(p){p.method="textDocument/publishDiagnostics",p.messageDirection=e.MessageDirection.serverToClient,p.type=new e.ProtocolNotificationType(p.method)})(zt||(t.PublishDiagnosticsNotification=zt={}));var jt;(function(p){p.Invoked=1,p.TriggerCharacter=2,p.TriggerForIncompleteCompletions=3})(jt||(t.CompletionTriggerKind=jt={}));var cn;(function(p){p.method="textDocument/completion",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(cn||(t.CompletionRequest=cn={}));var X;(function(p){p.method="completionItem/resolve",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(X||(t.CompletionResolveRequest=X={}));var Y;(function(p){p.method="textDocument/hover",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Y||(t.HoverRequest=Y={}));var fe;(function(p){p.Invoked=1,p.TriggerCharacter=2,p.ContentChange=3})(fe||(t.SignatureHelpTriggerKind=fe={}));var Bt;(function(p){p.method="textDocument/signatureHelp",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Bt||(t.SignatureHelpRequest=Bt={}));var Ft;(function(p){p.method="textDocument/definition",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Ft||(t.DefinitionRequest=Ft={}));var mr;(function(p){p.method="textDocument/references",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(mr||(t.ReferencesRequest=mr={}));var ui;(function(p){p.method="textDocument/documentHighlight",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(ui||(t.DocumentHighlightRequest=ui={}));var ji;(function(p){p.method="textDocument/documentSymbol",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(ji||(t.DocumentSymbolRequest=ji={}));var Bi;(function(p){p.method="textDocument/codeAction",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Bi||(t.CodeActionRequest=Bi={}));var Ui;(function(p){p.method="codeAction/resolve",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Ui||(t.CodeActionResolveRequest=Ui={}));var Wi;(function(p){p.method="workspace/symbol",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Wi||(t.WorkspaceSymbolRequest=Wi={}));var li;(function(p){p.method="workspaceSymbol/resolve",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(li||(t.WorkspaceSymbolResolveRequest=li={}));var di;(function(p){p.method="textDocument/codeLens",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(di||(t.CodeLensRequest=di={}));var bn;(function(p){p.method="codeLens/resolve",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(bn||(t.CodeLensResolveRequest=bn={}));var Hi;(function(p){p.method="workspace/codeLens/refresh",p.messageDirection=e.MessageDirection.serverToClient,p.type=new e.ProtocolRequestType0(p.method)})(Hi||(t.CodeLensRefreshRequest=Hi={}));var Ki;(function(p){p.method="textDocument/documentLink",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Ki||(t.DocumentLinkRequest=Ki={}));var gr;(function(p){p.method="documentLink/resolve",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(gr||(t.DocumentLinkResolveRequest=gr={}));var Vi;(function(p){p.method="textDocument/formatting",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Vi||(t.DocumentFormattingRequest=Vi={}));var Dr;(function(p){p.method="textDocument/rangeFormatting",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Dr||(t.DocumentRangeFormattingRequest=Dr={}));var Xi;(function(p){p.method="textDocument/rangesFormatting",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Xi||(t.DocumentRangesFormattingRequest=Xi={}));var Fn;(function(p){p.method="textDocument/onTypeFormatting",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Fn||(t.DocumentOnTypeFormattingRequest=Fn={}));var er;(function(p){p.Identifier=1})(er||(t.PrepareSupportDefaultBehavior=er={}));var Ys;(function(p){p.method="textDocument/rename",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(Ys||(t.RenameRequest=Ys={}));var M;(function(p){p.method="textDocument/prepareRename",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(M||(t.PrepareRenameRequest=M={}));var v;(function(p){p.method="workspace/executeCommand",p.messageDirection=e.MessageDirection.clientToServer,p.type=new e.ProtocolRequestType(p.method)})(v||(t.ExecuteCommandRequest=v={}));var P;(function(p){p.method="workspace/applyEdit",p.messageDirection=e.MessageDirection.serverToClient,p.type=new e.ProtocolRequestType("workspace/applyEdit")})(P||(t.ApplyWorkspaceEditRequest=P={}))}(ly)),ly}var Oc={},XE;function p2(){if(XE)return Oc;XE=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.createProtocolConnection=void 0;const t=ws();function e(n,r,i,s){return t.ConnectionStrategy.is(s)&&(s={connectionStrategy:s}),(0,t.createMessageConnection)(n,r,i,s)}return Oc.createProtocolConnection=e,Oc}var YE;function m2(){return YE||(YE=1,function(t){var e=bs&&bs.__createBinding||(Object.create?function(s,a,o,c){c===void 0&&(c=o);var u=Object.getOwnPropertyDescriptor(a,o);(!u||("get"in u?!a.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(s,c,u)}:function(s,a,o,c){c===void 0&&(c=o),s[c]=a[o]}),n=bs&&bs.__exportStar||function(s,a){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&e(a,s,o)};Object.defineProperty(t,"__esModule",{value:!0}),t.LSPErrorCodes=t.createProtocolConnection=void 0,n(ws(),t),n(uy(),t),n(wt(),t),n(h2(),t);var r=p2();Object.defineProperty(t,"createProtocolConnection",{enumerable:!0,get:function(){return r.createProtocolConnection}});var i;(function(s){s.lspReservedErrorRangeStart=-32899,s.RequestFailed=-32803,s.ServerCancelled=-32802,s.ContentModified=-32801,s.RequestCancelled=-32800,s.lspReservedErrorRangeEnd=-32800})(i||(t.LSPErrorCodes=i={}))}(bs)),bs}var JE;function _t(){return JE||(JE=1,function(t){var e=gs&&gs.__createBinding||(Object.create?function(s,a,o,c){c===void 0&&(c=o);var u=Object.getOwnPropertyDescriptor(a,o);(!u||("get"in u?!a.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(s,c,u)}:function(s,a,o,c){c===void 0&&(c=o),s[c]=a[o]}),n=gs&&gs.__exportStar||function(s,a){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&e(a,s,o)};Object.defineProperty(t,"__esModule",{value:!0}),t.createProtocolConnection=void 0;const r=kE();n(kE(),t),n(m2(),t);function i(s,a,o,c){return(0,r.createMessageConnection)(s,a,o,c)}t.createProtocolConnection=i}(gs)),gs}var On={},QE;function ZE(){if(QE)return On;QE=1,Object.defineProperty(On,"__esModule",{value:!0}),On.generateUuid=On.parse=On.isUUID=On.v4=On.empty=void 0;class t{constructor(c){this._value=c}asHex(){return this._value}equals(c){return this.asHex()===c.asHex()}}class e extends t{static _oneOf(c){return c[Math.floor(c.length*Math.random())]}static _randomHex(){return e._oneOf(e._chars)}constructor(){super([e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),"-",e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),"-","4",e._randomHex(),e._randomHex(),e._randomHex(),"-",e._oneOf(e._timeHighBits),e._randomHex(),e._randomHex(),e._randomHex(),"-",e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex()].join(""))}}e._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"],e._timeHighBits=["8","9","a","b"],On.empty=new t("00000000-0000-0000-0000-000000000000");function n(){return new e}On.v4=n;const r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function i(o){return r.test(o)}On.isUUID=i;function s(o){if(!i(o))throw new Error("invalid uuid");return new t(o)}On.parse=s;function a(){return n().asHex()}return On.generateUuid=a,On}var ni={},eS;function g2(){if(eS)return ni;eS=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.attachPartialResult=ni.ProgressFeature=ni.attachWorkDone=void 0;const t=_t(),e=ZE();class n{constructor(f,h){this._connection=f,this._token=h,n.Instances.set(this._token,this)}begin(f,h,m,y){let R={kind:"begin",title:f,percentage:h,message:m,cancellable:y};this._connection.sendProgress(t.WorkDoneProgress.type,this._token,R)}report(f,h){let m={kind:"report"};typeof f=="number"?(m.percentage=f,h!==void 0&&(m.message=h)):m.message=f,this._connection.sendProgress(t.WorkDoneProgress.type,this._token,m)}done(){n.Instances.delete(this._token),this._connection.sendProgress(t.WorkDoneProgress.type,this._token,{kind:"end"})}}n.Instances=new Map;class r extends n{constructor(f,h){super(f,h),this._source=new t.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}}class i{constructor(){}begin(){}report(){}done(){}}class s extends i{constructor(){super(),this._source=new t.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}}function a(d,f){if(f===void 0||f.workDoneToken===void 0)return new i;const h=f.workDoneToken;return delete f.workDoneToken,new n(d,h)}ni.attachWorkDone=a;const o=d=>class extends d{constructor(){super(),this._progressSupported=!1}initialize(f){super.initialize(f),f?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(t.WorkDoneProgressCancelNotification.type,h=>{let m=n.Instances.get(h.token);(m instanceof r||m instanceof s)&&m.cancel()}))}attachWorkDoneProgress(f){return f===void 0?new i:new n(this.connection,f)}createWorkDoneProgress(){if(this._progressSupported){const f=(0,e.generateUuid)();return this.connection.sendRequest(t.WorkDoneProgressCreateRequest.type,{token:f}).then(()=>new r(this.connection,f))}else return Promise.resolve(new s)}};ni.ProgressFeature=o;var c;(function(d){d.type=new t.ProgressType})(c||(c={}));class u{constructor(f,h){this._connection=f,this._token=h}report(f){this._connection.sendProgress(c.type,this._token,f)}}function l(d,f){if(f===void 0||f.partialResultToken===void 0)return;const h=f.partialResultToken;return delete f.partialResultToken,new u(d,h)}return ni.attachPartialResult=l,ni}var Lc={},tS;function y2(){if(tS)return Lc;tS=1,Object.defineProperty(Lc,"__esModule",{value:!0}),Lc.ConfigurationFeature=void 0;const t=_t(),e=iy(),n=r=>class extends r{getConfiguration(i){return i?e.string(i)?this._getConfiguration({section:i}):this._getConfiguration(i):this._getConfiguration({})}_getConfiguration(i){let s={items:Array.isArray(i)?i:[i]};return this.connection.sendRequest(t.ConfigurationRequest.type,s).then(a=>Array.isArray(a)?Array.isArray(i)?a:a[0]:Array.isArray(i)?[]:null)}};return Lc.ConfigurationFeature=n,Lc}var Mc={},nS;function v2(){if(nS)return Mc;nS=1,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.WorkspaceFoldersFeature=void 0;const t=_t(),e=n=>class extends n{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(r){super.initialize(r);let i=r.workspace;i&&i.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new t.Emitter,this.connection.onNotification(t.DidChangeWorkspaceFoldersNotification.type,s=>{this._onDidChangeWorkspaceFolders.fire(s.event)}))}fillServerCapabilities(r){super.fillServerCapabilities(r);const i=r.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=i===!0||typeof i=="string"}getWorkspaceFolders(){return this.connection.sendRequest(t.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(t.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};return Mc.WorkspaceFoldersFeature=e,Mc}var zc={},rS;function w2(){if(rS)return zc;rS=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.CallHierarchyFeature=void 0;const t=_t(),e=n=>class extends n{get callHierarchy(){return{onPrepare:r=>this.connection.onRequest(t.CallHierarchyPrepareRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i),void 0)),onIncomingCalls:r=>{const i=t.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(i,(s,a)=>r(s,a,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))},onOutgoingCalls:r=>{const i=t.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(i,(s,a)=>r(s,a,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))}}}};return zc.CallHierarchyFeature=e,zc}var ri={},iS;function sS(){if(iS)return ri;iS=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.SemanticTokensBuilder=ri.SemanticTokensDiff=ri.SemanticTokensFeature=void 0;const t=_t(),e=i=>class extends i{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(t.SemanticTokensRefreshRequest.type),on:s=>{const a=t.SemanticTokensRequest.type;return this.connection.onRequest(a,(o,c)=>s(o,c,this.attachWorkDoneProgress(o),this.attachPartialResultProgress(a,o)))},onDelta:s=>{const a=t.SemanticTokensDeltaRequest.type;return this.connection.onRequest(a,(o,c)=>s(o,c,this.attachWorkDoneProgress(o),this.attachPartialResultProgress(a,o)))},onRange:s=>{const a=t.SemanticTokensRangeRequest.type;return this.connection.onRequest(a,(o,c)=>s(o,c,this.attachWorkDoneProgress(o),this.attachPartialResultProgress(a,o)))}}}};ri.SemanticTokensFeature=e;class n{constructor(s,a){this.originalSequence=s,this.modifiedSequence=a}computeDiff(){const s=this.originalSequence.length,a=this.modifiedSequence.length;let o=0;for(;o<a&&o<s&&this.originalSequence[o]===this.modifiedSequence[o];)o++;if(o<a&&o<s){let c=s-1,u=a-1;for(;c>=o&&u>=o&&this.originalSequence[c]===this.modifiedSequence[u];)c--,u--;(c<o||u<o)&&(c++,u++);const l=c-o+1,d=this.modifiedSequence.slice(o,u+1);return d.length===1&&d[0]===this.originalSequence[c]?[{start:o,deleteCount:l-1}]:[{start:o,deleteCount:l,data:d}]}else return o<a?[{start:o,deleteCount:0,data:this.modifiedSequence.slice(o)}]:o<s?[{start:o,deleteCount:s-o}]:[]}}ri.SemanticTokensDiff=n;class r{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(s,a,o,c,u){let l=s,d=a;this._dataLen>0&&(l-=this._prevLine,l===0&&(d-=this._prevChar)),this._data[this._dataLen++]=l,this._data[this._dataLen++]=d,this._data[this._dataLen++]=o,this._data[this._dataLen++]=c,this._data[this._dataLen++]=u,this._prevLine=s,this._prevChar=a}get id(){return this._id.toString()}previousResult(s){this.id===s&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData!==void 0?{resultId:this.id,edits:new n(this._prevData,this._data).computeDiff()}:this.build()}}return ri.SemanticTokensBuilder=r,ri}var Fc={},aS;function b2(){if(aS)return Fc;aS=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.ShowDocumentFeature=void 0;const t=_t(),e=n=>class extends n{showDocument(r){return this.connection.sendRequest(t.ShowDocumentRequest.type,r)}};return Fc.ShowDocumentFeature=e,Fc}var qc={},oS;function R2(){if(oS)return qc;oS=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.FileOperationsFeature=void 0;const t=_t(),e=n=>class extends n{onDidCreateFiles(r){return this.connection.onNotification(t.DidCreateFilesNotification.type,i=>{r(i)})}onDidRenameFiles(r){return this.connection.onNotification(t.DidRenameFilesNotification.type,i=>{r(i)})}onDidDeleteFiles(r){return this.connection.onNotification(t.DidDeleteFilesNotification.type,i=>{r(i)})}onWillCreateFiles(r){return this.connection.onRequest(t.WillCreateFilesRequest.type,(i,s)=>r(i,s))}onWillRenameFiles(r){return this.connection.onRequest(t.WillRenameFilesRequest.type,(i,s)=>r(i,s))}onWillDeleteFiles(r){return this.connection.onRequest(t.WillDeleteFilesRequest.type,(i,s)=>r(i,s))}};return qc.FileOperationsFeature=e,qc}var Gc={},cS;function $2(){if(cS)return Gc;cS=1,Object.defineProperty(Gc,"__esModule",{value:!0}),Gc.LinkedEditingRangeFeature=void 0;const t=_t(),e=n=>class extends n{onLinkedEditingRange(r){return this.connection.onRequest(t.LinkedEditingRangeRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i),void 0))}};return Gc.LinkedEditingRangeFeature=e,Gc}var jc={},uS;function k2(){if(uS)return jc;uS=1,Object.defineProperty(jc,"__esModule",{value:!0}),jc.TypeHierarchyFeature=void 0;const t=_t(),e=n=>class extends n{get typeHierarchy(){return{onPrepare:r=>this.connection.onRequest(t.TypeHierarchyPrepareRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i),void 0)),onSupertypes:r=>{const i=t.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(i,(s,a)=>r(s,a,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))},onSubtypes:r=>{const i=t.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(i,(s,a)=>r(s,a,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))}}}};return jc.TypeHierarchyFeature=e,jc}var Bc={},lS;function T2(){if(lS)return Bc;lS=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.InlineValueFeature=void 0;const t=_t(),e=n=>class extends n{get inlineValue(){return{refresh:()=>this.connection.sendRequest(t.InlineValueRefreshRequest.type),on:r=>this.connection.onRequest(t.InlineValueRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i)))}}};return Bc.InlineValueFeature=e,Bc}var Uc={},dS;function E2(){if(dS)return Uc;dS=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.FoldingRangeFeature=void 0;const t=_t(),e=n=>class extends n{get foldingRange(){return{refresh:()=>this.connection.sendRequest(t.FoldingRangeRefreshRequest.type),on:r=>{const i=t.FoldingRangeRequest.type;return this.connection.onRequest(i,(s,a)=>r(s,a,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))}}}};return Uc.FoldingRangeFeature=e,Uc}var Wc={},fS;function S2(){if(fS)return Wc;fS=1,Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.InlayHintFeature=void 0;const t=_t(),e=n=>class extends n{get inlayHint(){return{refresh:()=>this.connection.sendRequest(t.InlayHintRefreshRequest.type),on:r=>this.connection.onRequest(t.InlayHintRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i))),resolve:r=>this.connection.onRequest(t.InlayHintResolveRequest.type,(i,s)=>r(i,s))}}};return Wc.InlayHintFeature=e,Wc}var Hc={},hS;function _2(){if(hS)return Hc;hS=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.DiagnosticFeature=void 0;const t=_t(),e=n=>class extends n{get diagnostics(){return{refresh:()=>this.connection.sendRequest(t.DiagnosticRefreshRequest.type),on:r=>this.connection.onRequest(t.DocumentDiagnosticRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i),this.attachPartialResultProgress(t.DocumentDiagnosticRequest.partialResult,i))),onWorkspace:r=>this.connection.onRequest(t.WorkspaceDiagnosticRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i),this.attachPartialResultProgress(t.WorkspaceDiagnosticRequest.partialResult,i)))}}};return Hc.DiagnosticFeature=e,Hc}var Es={},Kc={},pS;function mS(){if(pS)return Kc;pS=1,Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.TextDocuments=void 0;const t=_t();class e{constructor(r){this._configuration=r,this._syncedDocuments=new Map,this._onDidChangeContent=new t.Emitter,this._onDidOpen=new t.Emitter,this._onDidClose=new t.Emitter,this._onDidSave=new t.Emitter,this._onWillSave=new t.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(r){this._willSaveWaitUntil=r}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(r){return this._syncedDocuments.get(r)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(r){r.__textDocumentSync=t.TextDocumentSyncKind.Incremental;const i=[];return i.push(r.onDidOpenTextDocument(s=>{const a=s.textDocument,o=this._configuration.create(a.uri,a.languageId,a.version,a.text);this._syncedDocuments.set(a.uri,o);const c=Object.freeze({document:o});this._onDidOpen.fire(c),this._onDidChangeContent.fire(c)})),i.push(r.onDidChangeTextDocument(s=>{const a=s.textDocument,o=s.contentChanges;if(o.length===0)return;const{version:c}=a;if(c==null)throw new Error(`Received document change event for ${a.uri} without valid version identifier`);let u=this._syncedDocuments.get(a.uri);u!==void 0&&(u=this._configuration.update(u,o,c),this._syncedDocuments.set(a.uri,u),this._onDidChangeContent.fire(Object.freeze({document:u})))})),i.push(r.onDidCloseTextDocument(s=>{let a=this._syncedDocuments.get(s.textDocument.uri);a!==void 0&&(this._syncedDocuments.delete(s.textDocument.uri),this._onDidClose.fire(Object.freeze({document:a})))})),i.push(r.onWillSaveTextDocument(s=>{let a=this._syncedDocuments.get(s.textDocument.uri);a!==void 0&&this._onWillSave.fire(Object.freeze({document:a,reason:s.reason}))})),i.push(r.onWillSaveTextDocumentWaitUntil((s,a)=>{let o=this._syncedDocuments.get(s.textDocument.uri);return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:s.reason}),a):[]})),i.push(r.onDidSaveTextDocument(s=>{let a=this._syncedDocuments.get(s.textDocument.uri);a!==void 0&&this._onDidSave.fire(Object.freeze({document:a}))})),t.Disposable.create(()=>{i.forEach(s=>s.dispose())})}}return Kc.TextDocuments=e,Kc}var gS;function yS(){if(gS)return Es;gS=1,Object.defineProperty(Es,"__esModule",{value:!0}),Es.NotebookDocuments=Es.NotebookSyncFeature=void 0;const t=_t(),e=mS(),n=s=>class extends s{get synchronization(){return{onDidOpenNotebookDocument:a=>this.connection.onNotification(t.DidOpenNotebookDocumentNotification.type,o=>{a(o)}),onDidChangeNotebookDocument:a=>this.connection.onNotification(t.DidChangeNotebookDocumentNotification.type,o=>{a(o)}),onDidSaveNotebookDocument:a=>this.connection.onNotification(t.DidSaveNotebookDocumentNotification.type,o=>{a(o)}),onDidCloseNotebookDocument:a=>this.connection.onNotification(t.DidCloseNotebookDocumentNotification.type,o=>{a(o)})}}};Es.NotebookSyncFeature=n;class r{onDidOpenTextDocument(a){return this.openHandler=a,t.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(a){this.openHandler&&this.openHandler(a)}onDidChangeTextDocument(a){return this.changeHandler=a,t.Disposable.create(()=>{this.changeHandler=a})}changeTextDocument(a){this.changeHandler&&this.changeHandler(a)}onDidCloseTextDocument(a){return this.closeHandler=a,t.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(a){this.closeHandler&&this.closeHandler(a)}onWillSaveTextDocument(){return r.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return r.NULL_DISPOSE}onDidSaveTextDocument(){return r.NULL_DISPOSE}}r.NULL_DISPOSE=Object.freeze({dispose:()=>{}});class i{constructor(a){a instanceof e.TextDocuments?this._cellTextDocuments=a:this._cellTextDocuments=new e.TextDocuments(a),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new t.Emitter,this._onDidChange=new t.Emitter,this._onDidSave=new t.Emitter,this._onDidClose=new t.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(a){return this._cellTextDocuments.get(a.document)}getNotebookDocument(a){return this.notebookDocuments.get(a)}getNotebookCell(a){const o=this.notebookCellMap.get(a);return o&&o[0]}findNotebookDocumentForCell(a){const o=typeof a=="string"?a:a.document,c=this.notebookCellMap.get(o);return c&&c[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(a){const o=new r,c=[];return c.push(this.cellTextDocuments.listen(o)),c.push(a.notebooks.synchronization.onDidOpenNotebookDocument(u=>{this.notebookDocuments.set(u.notebookDocument.uri,u.notebookDocument);for(const l of u.cellTextDocuments)o.openTextDocument({textDocument:l});this.updateCellMap(u.notebookDocument),this._onDidOpen.fire(u.notebookDocument)})),c.push(a.notebooks.synchronization.onDidChangeNotebookDocument(u=>{const l=this.notebookDocuments.get(u.notebookDocument.uri);if(l===void 0)return;l.version=u.notebookDocument.version;const d=l.metadata;let f=!1;const h=u.change;h.metadata!==void 0&&(f=!0,l.metadata=h.metadata);const m=[],y=[],R=[],w=[];if(h.cells!==void 0){const I=h.cells;if(I.structure!==void 0){const j=I.structure.array;if(l.cells.splice(j.start,j.deleteCount,...j.cells!==void 0?j.cells:[]),I.structure.didOpen!==void 0)for(const J of I.structure.didOpen)o.openTextDocument({textDocument:J}),m.push(J.uri);if(I.structure.didClose)for(const J of I.structure.didClose)o.closeTextDocument({textDocument:J}),y.push(J.uri)}if(I.data!==void 0){const j=new Map(I.data.map(J=>[J.document,J]));for(let J=0;J<=l.cells.length;J++){const Z=j.get(l.cells[J].document);if(Z!==void 0){const oe=l.cells.splice(J,1,Z);if(R.push({old:oe[0],new:Z}),j.delete(Z.document),j.size===0)break}}}if(I.textContent!==void 0)for(const j of I.textContent)o.changeTextDocument({textDocument:j.document,contentChanges:j.changes}),w.push(j.document.uri)}this.updateCellMap(l);const k={notebookDocument:l};f&&(k.metadata={old:d,new:l.metadata});const E=[];for(const I of m)E.push(this.getNotebookCell(I));const _=[];for(const I of y)_.push(this.getNotebookCell(I));const C=[];for(const I of w)C.push(this.getNotebookCell(I));(E.length>0||_.length>0||R.length>0||C.length>0)&&(k.cells={added:E,removed:_,changed:{data:R,textContent:C}}),(k.metadata!==void 0||k.cells!==void 0)&&this._onDidChange.fire(k)})),c.push(a.notebooks.synchronization.onDidSaveNotebookDocument(u=>{const l=this.notebookDocuments.get(u.notebookDocument.uri);l!==void 0&&this._onDidSave.fire(l)})),c.push(a.notebooks.synchronization.onDidCloseNotebookDocument(u=>{const l=this.notebookDocuments.get(u.notebookDocument.uri);if(l!==void 0){this._onDidClose.fire(l);for(const d of u.cellTextDocuments)o.closeTextDocument({textDocument:d});this.notebookDocuments.delete(u.notebookDocument.uri);for(const d of l.cells)this.notebookCellMap.delete(d.document)}})),t.Disposable.create(()=>{c.forEach(u=>u.dispose())})}updateCellMap(a){for(const o of a.cells)this.notebookCellMap.set(o.document,[o,a])}}return Es.NotebookDocuments=i,Es}var Vc={},vS;function A2(){if(vS)return Vc;vS=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.MonikerFeature=void 0;const t=_t(),e=n=>class extends n{get moniker(){return{on:r=>{const i=t.MonikerRequest.type;return this.connection.onRequest(i,(s,a)=>r(s,a,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))}}}};return Vc.MonikerFeature=e,Vc}var wS;function bS(){if(wS)return He;wS=1,Object.defineProperty(He,"__esModule",{value:!0}),He.createConnection=He.combineFeatures=He.combineNotebooksFeatures=He.combineLanguagesFeatures=He.combineWorkspaceFeatures=He.combineWindowFeatures=He.combineClientFeatures=He.combineTracerFeatures=He.combineTelemetryFeatures=He.combineConsoleFeatures=He._NotebooksImpl=He._LanguagesImpl=He.BulkUnregistration=He.BulkRegistration=He.ErrorMessageTracker=void 0;const t=_t(),e=iy(),n=ZE(),r=g2(),i=y2(),s=v2(),a=w2(),o=sS(),c=b2(),u=R2(),l=$2(),d=k2(),f=T2(),h=E2(),m=S2(),y=_2(),R=yS(),w=A2();function k(ue){if(ue!==null)return ue}class E{constructor(){this._messages=Object.create(null)}add(N){let F=this._messages[N];F||(F=0),F++,this._messages[N]=F}sendErrors(N){Object.keys(this._messages).forEach(F=>{N.window.showErrorMessage(F)})}}He.ErrorMessageTracker=E;class _{constructor(){}rawAttach(N){this._rawConnection=N}attach(N){this._connection=N}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(N){}initialize(N){}error(N){this.send(t.MessageType.Error,N)}warn(N){this.send(t.MessageType.Warning,N)}info(N){this.send(t.MessageType.Info,N)}log(N){this.send(t.MessageType.Log,N)}debug(N){this.send(t.MessageType.Debug,N)}send(N,F){this._rawConnection&&this._rawConnection.sendNotification(t.LogMessageNotification.type,{type:N,message:F}).catch(()=>{(0,t.RAL)().console.error("Sending log message failed")})}}class C{constructor(){}attach(N){this._connection=N}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(N){}fillServerCapabilities(N){}showErrorMessage(N,...F){let de={type:t.MessageType.Error,message:N,actions:F};return this.connection.sendRequest(t.ShowMessageRequest.type,de).then(k)}showWarningMessage(N,...F){let de={type:t.MessageType.Warning,message:N,actions:F};return this.connection.sendRequest(t.ShowMessageRequest.type,de).then(k)}showInformationMessage(N,...F){let de={type:t.MessageType.Info,message:N,actions:F};return this.connection.sendRequest(t.ShowMessageRequest.type,de).then(k)}}const I=(0,c.ShowDocumentFeature)((0,r.ProgressFeature)(C));var j;(function(ue){function N(){return new J}ue.create=N})(j||(He.BulkRegistration=j={}));class J{constructor(){this._registrations=[],this._registered=new Set}add(N,F){const de=e.string(N)?N:N.method;if(this._registered.has(de))throw new Error(`${de} is already added to this registration`);const q=n.generateUuid();this._registrations.push({id:q,method:de,registerOptions:F||{}}),this._registered.add(de)}asRegistrationParams(){return{registrations:this._registrations}}}var Z;(function(ue){function N(){return new oe(void 0,[])}ue.create=N})(Z||(He.BulkUnregistration=Z={}));class oe{constructor(N,F){this._connection=N,this._unregistrations=new Map,F.forEach(de=>{this._unregistrations.set(de.method,de)})}get isAttached(){return!!this._connection}attach(N){this._connection=N}add(N){this._unregistrations.set(N.method,N)}dispose(){let N=[];for(let de of this._unregistrations.values())N.push(de);let F={unregisterations:N};this._connection.sendRequest(t.UnregistrationRequest.type,F).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(N){const F=e.string(N)?N:N.method,de=this._unregistrations.get(F);if(!de)return!1;let q={unregisterations:[de]};return this._connection.sendRequest(t.UnregistrationRequest.type,q).then(()=>{this._unregistrations.delete(F)},le=>{this._connection.console.info(`Un-registering request handler for ${de.id} failed.`)}),!0}}class L{attach(N){this._connection=N}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(N){}fillServerCapabilities(N){}register(N,F,de){return N instanceof J?this.registerMany(N):N instanceof oe?this.registerSingle1(N,F,de):this.registerSingle2(N,F)}registerSingle1(N,F,de){const q=e.string(F)?F:F.method,le=n.generateUuid();let qe={registrations:[{id:le,method:q,registerOptions:de||{}}]};return N.isAttached||N.attach(this.connection),this.connection.sendRequest(t.RegistrationRequest.type,qe).then(Ze=>(N.add({id:le,method:q}),N),Ze=>(this.connection.console.info(`Registering request handler for ${q} failed.`),Promise.reject(Ze)))}registerSingle2(N,F){const de=e.string(N)?N:N.method,q=n.generateUuid();let le={registrations:[{id:q,method:de,registerOptions:F||{}}]};return this.connection.sendRequest(t.RegistrationRequest.type,le).then(qe=>t.Disposable.create(()=>{this.unregisterSingle(q,de).catch(()=>{this.connection.console.info(`Un-registering capability with id ${q} failed.`)})}),qe=>(this.connection.console.info(`Registering request handler for ${de} failed.`),Promise.reject(qe)))}unregisterSingle(N,F){let de={unregisterations:[{id:N,method:F}]};return this.connection.sendRequest(t.UnregistrationRequest.type,de).catch(()=>{this.connection.console.info(`Un-registering request handler for ${N} failed.`)})}registerMany(N){let F=N.asRegistrationParams();return this.connection.sendRequest(t.RegistrationRequest.type,F).then(()=>new oe(this._connection,F.registrations.map(de=>({id:de.id,method:de.method}))),de=>(this.connection.console.info("Bulk registration failed."),Promise.reject(de)))}}class S{constructor(){}attach(N){this._connection=N}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(N){}fillServerCapabilities(N){}applyEdit(N){function F(q){return q&&!!q.edit}let de=F(N)?N:{edit:N};return this.connection.sendRequest(t.ApplyWorkspaceEditRequest.type,de)}}const $=(0,u.FileOperationsFeature)((0,s.WorkspaceFoldersFeature)((0,i.ConfigurationFeature)(S)));class O{constructor(){this._trace=t.Trace.Off}attach(N){this._connection=N}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(N){}fillServerCapabilities(N){}set trace(N){this._trace=N}log(N,F){this._trace!==t.Trace.Off&&this.connection.sendNotification(t.LogTraceNotification.type,{message:N,verbose:this._trace===t.Trace.Verbose?F:void 0}).catch(()=>{})}}class K{constructor(){}attach(N){this._connection=N}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(N){}fillServerCapabilities(N){}logEvent(N){this.connection.sendNotification(t.TelemetryEventNotification.type,N).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}}class W{constructor(){}attach(N){this._connection=N}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(N){}fillServerCapabilities(N){}attachWorkDoneProgress(N){return(0,r.attachWorkDone)(this.connection,N)}attachPartialResultProgress(N,F){return(0,r.attachPartialResult)(this.connection,F)}}He._LanguagesImpl=W;const H=(0,h.FoldingRangeFeature)((0,w.MonikerFeature)((0,y.DiagnosticFeature)((0,m.InlayHintFeature)((0,f.InlineValueFeature)((0,d.TypeHierarchyFeature)((0,l.LinkedEditingRangeFeature)((0,o.SemanticTokensFeature)((0,a.CallHierarchyFeature)(W)))))))));class $e{constructor(){}attach(N){this._connection=N}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(N){}fillServerCapabilities(N){}attachWorkDoneProgress(N){return(0,r.attachWorkDone)(this.connection,N)}attachPartialResultProgress(N,F){return(0,r.attachPartialResult)(this.connection,F)}}He._NotebooksImpl=$e;const te=(0,R.NotebookSyncFeature)($e);function A(ue,N){return function(F){return N(ue(F))}}He.combineConsoleFeatures=A;function me(ue,N){return function(F){return N(ue(F))}}He.combineTelemetryFeatures=me;function _e(ue,N){return function(F){return N(ue(F))}}He.combineTracerFeatures=_e;function st(ue,N){return function(F){return N(ue(F))}}He.combineClientFeatures=st;function B(ue,N){return function(F){return N(ue(F))}}He.combineWindowFeatures=B;function V(ue,N){return function(F){return N(ue(F))}}He.combineWorkspaceFeatures=V;function Oe(ue,N){return function(F){return N(ue(F))}}He.combineLanguagesFeatures=Oe;function ce(ue,N){return function(F){return N(ue(F))}}He.combineNotebooksFeatures=ce;function be(ue,N){function F(q,le,qe){return q&&le?qe(q,le):q||le}return{__brand:"features",console:F(ue.console,N.console,A),tracer:F(ue.tracer,N.tracer,_e),telemetry:F(ue.telemetry,N.telemetry,me),client:F(ue.client,N.client,st),window:F(ue.window,N.window,B),workspace:F(ue.workspace,N.workspace,V),languages:F(ue.languages,N.languages,Oe),notebooks:F(ue.notebooks,N.notebooks,ce)}}He.combineFeatures=be;function Ae(ue,N,F){const de=F&&F.console?new(F.console(_)):new _,q=ue(de);de.rawAttach(q);const le=F&&F.tracer?new(F.tracer(O)):new O,qe=F&&F.telemetry?new(F.telemetry(K)):new K,Ze=F&&F.client?new(F.client(L)):new L,ae=F&&F.window?new(F.window(I)):new I,Pe=F&&F.workspace?new(F.workspace($)):new $,ne=F&&F.languages?new(F.languages(H)):new H,Re=F&&F.notebooks?new(F.notebooks(te)):new te,Me=[de,le,qe,Ze,ae,Pe,ne,Re];function ht(X){return X instanceof Promise?X:e.thenable(X)?new Promise((Y,fe)=>{X.then(Bt=>Y(Bt),Bt=>fe(Bt))}):Promise.resolve(X)}let Ve,zt,jt,cn={listen:()=>q.listen(),sendRequest:(X,...Y)=>q.sendRequest(e.string(X)?X:X.method,...Y),onRequest:(X,Y)=>q.onRequest(X,Y),sendNotification:(X,Y)=>{const fe=e.string(X)?X:X.method;return q.sendNotification(fe,Y)},onNotification:(X,Y)=>q.onNotification(X,Y),onProgress:q.onProgress,sendProgress:q.sendProgress,onInitialize:X=>(zt=X,{dispose:()=>{zt=void 0}}),onInitialized:X=>q.onNotification(t.InitializedNotification.type,X),onShutdown:X=>(Ve=X,{dispose:()=>{Ve=void 0}}),onExit:X=>(jt=X,{dispose:()=>{jt=void 0}}),get console(){return de},get telemetry(){return qe},get tracer(){return le},get client(){return Ze},get window(){return ae},get workspace(){return Pe},get languages(){return ne},get notebooks(){return Re},onDidChangeConfiguration:X=>q.onNotification(t.DidChangeConfigurationNotification.type,X),onDidChangeWatchedFiles:X=>q.onNotification(t.DidChangeWatchedFilesNotification.type,X),__textDocumentSync:void 0,onDidOpenTextDocument:X=>q.onNotification(t.DidOpenTextDocumentNotification.type,X),onDidChangeTextDocument:X=>q.onNotification(t.DidChangeTextDocumentNotification.type,X),onDidCloseTextDocument:X=>q.onNotification(t.DidCloseTextDocumentNotification.type,X),onWillSaveTextDocument:X=>q.onNotification(t.WillSaveTextDocumentNotification.type,X),onWillSaveTextDocumentWaitUntil:X=>q.onRequest(t.WillSaveTextDocumentWaitUntilRequest.type,X),onDidSaveTextDocument:X=>q.onNotification(t.DidSaveTextDocumentNotification.type,X),sendDiagnostics:X=>q.sendNotification(t.PublishDiagnosticsNotification.type,X),onHover:X=>q.onRequest(t.HoverRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),void 0)),onCompletion:X=>q.onRequest(t.CompletionRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onCompletionResolve:X=>q.onRequest(t.CompletionResolveRequest.type,X),onSignatureHelp:X=>q.onRequest(t.SignatureHelpRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),void 0)),onDeclaration:X=>q.onRequest(t.DeclarationRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onDefinition:X=>q.onRequest(t.DefinitionRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onTypeDefinition:X=>q.onRequest(t.TypeDefinitionRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onImplementation:X=>q.onRequest(t.ImplementationRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onReferences:X=>q.onRequest(t.ReferencesRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onDocumentHighlight:X=>q.onRequest(t.DocumentHighlightRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onDocumentSymbol:X=>q.onRequest(t.DocumentSymbolRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onWorkspaceSymbol:X=>q.onRequest(t.WorkspaceSymbolRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onWorkspaceSymbolResolve:X=>q.onRequest(t.WorkspaceSymbolResolveRequest.type,X),onCodeAction:X=>q.onRequest(t.CodeActionRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onCodeActionResolve:X=>q.onRequest(t.CodeActionResolveRequest.type,(Y,fe)=>X(Y,fe)),onCodeLens:X=>q.onRequest(t.CodeLensRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onCodeLensResolve:X=>q.onRequest(t.CodeLensResolveRequest.type,(Y,fe)=>X(Y,fe)),onDocumentFormatting:X=>q.onRequest(t.DocumentFormattingRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),void 0)),onDocumentRangeFormatting:X=>q.onRequest(t.DocumentRangeFormattingRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),void 0)),onDocumentOnTypeFormatting:X=>q.onRequest(t.DocumentOnTypeFormattingRequest.type,(Y,fe)=>X(Y,fe)),onRenameRequest:X=>q.onRequest(t.RenameRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),void 0)),onPrepareRename:X=>q.onRequest(t.PrepareRenameRequest.type,(Y,fe)=>X(Y,fe)),onDocumentLinks:X=>q.onRequest(t.DocumentLinkRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onDocumentLinkResolve:X=>q.onRequest(t.DocumentLinkResolveRequest.type,(Y,fe)=>X(Y,fe)),onDocumentColor:X=>q.onRequest(t.DocumentColorRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onColorPresentation:X=>q.onRequest(t.ColorPresentationRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onFoldingRanges:X=>q.onRequest(t.FoldingRangeRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onSelectionRanges:X=>q.onRequest(t.SelectionRangeRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),(0,r.attachPartialResult)(q,Y))),onExecuteCommand:X=>q.onRequest(t.ExecuteCommandRequest.type,(Y,fe)=>X(Y,fe,(0,r.attachWorkDone)(q,Y),void 0)),dispose:()=>q.dispose()};for(let X of Me)X.attach(cn);return q.onRequest(t.InitializeRequest.type,X=>{N.initialize(X),e.string(X.trace)&&(le.trace=t.Trace.fromString(X.trace));for(let Y of Me)Y.initialize(X.capabilities);if(zt){let Y=zt(X,new t.CancellationTokenSource().token,(0,r.attachWorkDone)(q,X),void 0);return ht(Y).then(fe=>{if(fe instanceof t.ResponseError)return fe;let Bt=fe;Bt||(Bt={capabilities:{}});let Ft=Bt.capabilities;Ft||(Ft={},Bt.capabilities=Ft),Ft.textDocumentSync===void 0||Ft.textDocumentSync===null?Ft.textDocumentSync=e.number(cn.__textDocumentSync)?cn.__textDocumentSync:t.TextDocumentSyncKind.None:!e.number(Ft.textDocumentSync)&&!e.number(Ft.textDocumentSync.change)&&(Ft.textDocumentSync.change=e.number(cn.__textDocumentSync)?cn.__textDocumentSync:t.TextDocumentSyncKind.None);for(let mr of Me)mr.fillServerCapabilities(Ft);return Bt})}else{let Y={capabilities:{textDocumentSync:t.TextDocumentSyncKind.None}};for(let fe of Me)fe.fillServerCapabilities(Y.capabilities);return Y}}),q.onRequest(t.ShutdownRequest.type,()=>{if(N.shutdownReceived=!0,Ve)return Ve(new t.CancellationTokenSource().token)}),q.onNotification(t.ExitNotification.type,()=>{try{jt&&jt()}finally{N.shutdownReceived?N.exit(0):N.exit(1)}}),q.onNotification(t.SetTraceNotification.type,X=>{le.trace=t.Trace.fromString(X.value)}),cn}return He.createConnection=Ae,He}var yn={},RS;function C2(){if(RS)return yn;RS=1,Object.defineProperty(yn,"__esModule",{value:!0}),yn.resolveModulePath=yn.FileSystem=yn.resolveGlobalYarnPath=yn.resolveGlobalNodePath=yn.resolve=yn.uriToFilePath=void 0;const t=nC,e=hi,n=Za,r=rC;function i(d){let f=t.parse(d);if(f.protocol!=="file:"||!f.path)return;let h=f.path.split("/");for(var m=0,y=h.length;m<y;m++)h[m]=decodeURIComponent(h[m]);if(process.platform==="win32"&&h.length>1){let R=h[0],w=h[1];R.length===0&&w.length>1&&w[1]===":"&&h.shift()}return e.normalize(h.join("/"))}yn.uriToFilePath=i;function s(){return process.platform==="win32"}function a(d,f,h,m){const y="NODE_PATH",R=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((w,k)=>{let E=process.env,_=Object.create(null);Object.keys(E).forEach(C=>_[C]=E[C]),f&&n.existsSync(f)&&(_[y]?_[y]=f+e.delimiter+_[y]:_[y]=f,m&&m(`NODE_PATH value is: ${_[y]}`)),_.ELECTRON_RUN_AS_NODE="1";try{let C=(0,r.fork)("",[],{cwd:h,env:_,execArgv:["-e",R]});if(C.pid===void 0){k(new Error(`Starting process to resolve node module ${d} failed`));return}C.on("error",j=>{k(j)}),C.on("message",j=>{j.c==="r"&&(C.send({c:"e"}),j.s?w(j.r):k(new Error(`Failed to resolve module: ${d}`)))});let I={c:"rs",a:d};C.send(I)}catch(C){k(C)}})}yn.resolve=a;function o(d){let f="npm";const h=Object.create(null);Object.keys(process.env).forEach(R=>h[R]=process.env[R]),h.NO_UPDATE_NOTIFIER="true";const m={encoding:"utf8",env:h};s()&&(f="npm.cmd",m.shell=!0);let y=()=>{};try{process.on("SIGPIPE",y);let R=(0,r.spawnSync)(f,["config","get","prefix"],m).stdout;if(!R){d&&d("'npm config get prefix' didn't return a value.");return}let w=R.trim();return d&&d(`'npm config get prefix' value is: ${w}`),w.length>0?s()?e.join(w,"node_modules"):e.join(w,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",y)}}yn.resolveGlobalNodePath=o;function c(d){let f="yarn",h={encoding:"utf8"};s()&&(f="yarn.cmd",h.shell=!0);let m=()=>{};try{process.on("SIGPIPE",m);let y=(0,r.spawnSync)(f,["global","dir","--json"],h),R=y.stdout;if(!R){d&&(d("'yarn global dir' didn't return a value."),y.stderr&&d(y.stderr));return}let w=R.trim().split(/\r?\n/);for(let k of w)try{let E=JSON.parse(k);if(E.type==="log")return e.join(E.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",m)}}yn.resolveGlobalYarnPath=c;var u;(function(d){let f;function h(){return f!==void 0||(process.platform==="win32"?f=!1:f=!n.existsSync(__filename.toUpperCase())||!n.existsSync(__filename.toLowerCase())),f}d.isCaseSensitive=h;function m(y,R){return h()?e.normalize(R).indexOf(e.normalize(y))===0:e.normalize(R).toLowerCase().indexOf(e.normalize(y).toLowerCase())===0}d.isParent=m})(u||(yn.FileSystem=u={}));function l(d,f,h,m){return h?(e.isAbsolute(h)||(h=e.join(d,h)),a(f,h,h,m).then(y=>u.isParent(h,y)?y:Promise.reject(new Error(`Failed to load ${f} from node path location.`))).then(void 0,y=>a(f,o(m),d,m))):a(f,o(m),d,m)}return yn.resolveModulePath=l,yn}var fy,$S;function kS(){return $S||($S=1,fy=_t()),fy}var Ss={},Xc={},TS;function P2(){if(TS)return Xc;TS=1,Object.defineProperty(Xc,"__esModule",{value:!0}),Xc.InlineCompletionFeature=void 0;const t=_t(),e=n=>class extends n{get inlineCompletion(){return{on:r=>this.connection.onRequest(t.InlineCompletionRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i)))}}};return Xc.InlineCompletionFeature=e,Xc}var ES;function x2(){return ES||(ES=1,function(t){var e=Ss&&Ss.__createBinding||(Object.create?function(c,u,l,d){d===void 0&&(d=l);var f=Object.getOwnPropertyDescriptor(u,l);(!f||("get"in f?!u.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return u[l]}}),Object.defineProperty(c,d,f)}:function(c,u,l,d){d===void 0&&(d=l),c[d]=u[l]}),n=Ss&&Ss.__exportStar||function(c,u){for(var l in c)l!=="default"&&!Object.prototype.hasOwnProperty.call(u,l)&&e(u,c,l)};Object.defineProperty(t,"__esModule",{value:!0}),t.ProposedFeatures=t.NotebookDocuments=t.TextDocuments=t.SemanticTokensBuilder=void 0;const r=sS();Object.defineProperty(t,"SemanticTokensBuilder",{enumerable:!0,get:function(){return r.SemanticTokensBuilder}});const i=P2();n(_t(),t);const s=mS();Object.defineProperty(t,"TextDocuments",{enumerable:!0,get:function(){return s.TextDocuments}});const a=yS();Object.defineProperty(t,"NotebookDocuments",{enumerable:!0,get:function(){return a.NotebookDocuments}}),n(bS(),t);var o;(function(c){c.all={__brand:"features",languages:i.InlineCompletionFeature}})(o||(t.ProposedFeatures=o={}))}(Ss)),Ss}var SS;function _S(){return SS||(SS=1,function(t){var e=ms&&ms.__createBinding||(Object.create?function(w,k,E,_){_===void 0&&(_=E);var C=Object.getOwnPropertyDescriptor(k,E);(!C||("get"in C?!k.__esModule:C.writable||C.configurable))&&(C={enumerable:!0,get:function(){return k[E]}}),Object.defineProperty(w,_,C)}:function(w,k,E,_){_===void 0&&(_=E),w[_]=k[E]}),n=ms&&ms.__exportStar||function(w,k){for(var E in w)E!=="default"&&!Object.prototype.hasOwnProperty.call(k,E)&&e(k,w,E)};Object.defineProperty(t,"__esModule",{value:!0}),t.createConnection=t.Files=void 0;const r=YA,i=iy(),s=bS(),a=C2(),o=kS();n(kS(),t),n(x2(),t);var c;(function(w){w.uriToFilePath=a.uriToFilePath,w.resolveGlobalNodePath=a.resolveGlobalNodePath,w.resolveGlobalYarnPath=a.resolveGlobalYarnPath,w.resolve=a.resolve,w.resolveModulePath=a.resolveModulePath})(c||(t.Files=c={}));function u(){}let l=!1,d;function f(){const w="--clientProcessId";function k(E){try{let _=parseInt(E);isNaN(_)||(d=setInterval(()=>{try{process.kill(_,0)}catch{process.exit(l?0:1)}},3e3))}catch{}}for(let E=2;E<process.argv.length;E++){let _=process.argv[E];if(_===w&&E+1<process.argv.length){k(process.argv[E+1]);return}else{let C=_.split("=");C[0]===w&&k(C[1])}}}f();const h={initialize:w=>{const k=w.processId;i.number(k)&&d===void 0&&setInterval(()=>{try{process.kill(k,0)}catch{process.exit(l?0:1)}},3e3)},get shutdownReceived(){return l},set shutdownReceived(w){l=w},exit:w=>{process.exit(w)}};function m(w,k,E,_){let C,I,j,J;return w!==void 0&&w.__brand==="features"&&(C=w,w=k,k=E,E=_),o.ConnectionStrategy.is(w)||o.ConnectionOptions.is(w)?J=w:(I=w,j=k,J=E),y(I,j,J,C)}t.createConnection=m;function y(w,k,E,_){let C=!1;if(!w&&!k&&process.argv.length>2){let Z,oe,L=process.argv.slice(2);for(let S=0;S<L.length;S++){let $=L[S];if($==="--node-ipc"){w=new o.IPCMessageReader(process),k=new o.IPCMessageWriter(process);break}else if($==="--stdio"){C=!0,w=process.stdin,k=process.stdout;break}else if($==="--socket"){Z=parseInt(L[S+1]);break}else if($==="--pipe"){oe=L[S+1];break}else{var I=$.split("=");if(I[0]==="--socket"){Z=parseInt(I[1]);break}else if(I[0]==="--pipe"){oe=I[1];break}}}if(Z){let S=(0,o.createServerSocketTransport)(Z);w=S[0],k=S[1]}else if(oe){let S=(0,o.createServerPipeTransport)(oe);w=S[0],k=S[1]}}var j="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!w)throw new Error("Connection input stream is not set. "+j);if(!k)throw new Error("Connection output stream is not set. "+j);if(i.func(w.read)&&i.func(w.on)){let Z=w;Z.on("end",()=>{process.exit(l?0:1)}),Z.on("close",()=>{process.exit(l?0:1)})}const J=Z=>{const oe=(0,o.createProtocolConnection)(w,k,Z,E);return C&&R(Z),oe};return(0,s.createConnection)(J,h,_)}function R(w){function k(_){return _.map(C=>typeof C=="string"?C:(0,r.inspect)(C)).join(" ")}const E=new Map;console.assert=function(C,...I){if(!C)if(I.length===0)w.error("Assertion failed");else{const[j,...J]=I;w.error(`Assertion failed: ${j} ${k(J)}`)}},console.count=function(C="default"){const I=String(C);let j=E.get(I)??0;j+=1,E.set(I,j),w.log(`${I}: ${I}`)},console.countReset=function(C){C===void 0?E.clear():E.delete(String(C))},console.debug=function(...C){w.log(k(C))},console.dir=function(C,I){w.log((0,r.inspect)(C,I))},console.log=function(...C){w.log(k(C))},console.error=function(...C){w.error(k(C))},console.trace=function(...C){const I=new Error().stack.replace(/(.+\n){2}/,"");let j="Trace";C.length!==0&&(j+=`: ${k(C)}`),w.log(`${j}
179
- ${I}`)},console.warn=function(...C){w.warn(k(C))}}}(ms)),ms}var ve=_S();function AS(t,e){const n={stacks:t,tokens:e};return N2(n),n.stacks.flat().forEach(i=>{i.property=void 0}),PS(n.stacks).map(i=>i[i.length-1])}function hy(t){const{next:e,cardinalities:n,visited:r,plus:i}=t,s=[],a=e.feature;if(r.has(a))return[];yi(a)||r.add(a);let o,c=a;for(;c.$container;)if(yi(c.$container)){o=c.$container;break}else if(am(c.$container))c=c.$container;else break;if(Ib(c.cardinality)){const u=$a({next:{feature:c,type:e.type},cardinalities:n,visited:r,plus:i});for(const l of u)i.add(l.feature);s.push(...u)}if(o){const u=o.elements.indexOf(c);u!==void 0&&u<o.elements.length-1&&s.push(...CS({feature:o,type:e.type},u+1,n,r,i)),s.every(l=>aa(l.feature.cardinality,l.feature)||aa(n.get(l.feature))||i.has(l.feature))&&s.push(...hy({next:{feature:o,type:e.type},cardinalities:n,visited:r,plus:i}))}return s}function py(t){return Rt(t)&&(t={feature:t}),$a({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function $a(t){var e,n,r;const{next:i,cardinalities:s,visited:a,plus:o}=t;if(i===void 0)return[];const{feature:c,type:u}=i;if(yi(c))return a.has(c)?[]:(a.add(c),CS(i,0,s,a,o).map(l=>Vf(l,c.cardinality,s)));if(dm(c)||fm(c))return c.elements.flatMap(l=>$a({next:{feature:l,type:u,property:i.property},cardinalities:s,visited:a,plus:o})).map(l=>Vf(l,c.cardinality,s));if(wr(c)){const l={feature:c.terminal,type:u,property:(e=i.property)!==null&&e!==void 0?e:c.feature};return $a({next:l,cardinalities:s,visited:a,plus:o}).map(d=>Vf(d,c.cardinality,s))}else{if(Qi(c))return hy({next:{feature:c,type:Wo(c),property:(n=i.property)!==null&&n!==void 0?n:c.feature},cardinalities:s,visited:a,plus:o});if(Mr(c)&&en(c.rule.ref)){const l=c.rule.ref,d={feature:l.definition,type:l.fragment||l.dataType?void 0:(r=Zi(l))!==null&&r!==void 0?r:l.name,property:i.property};return $a({next:d,cardinalities:s,visited:a,plus:o}).map(f=>Vf(f,c.cardinality,s))}else return[i]}}function Vf(t,e,n){return n.set(t.feature,e),t}function CS(t,e,n,r,i){var s;const a=[];let o;for(;e<t.feature.elements.length&&(o={feature:t.feature.elements[e++],type:t.type},a.push(...$a({next:o,cardinalities:n,visited:r,plus:i})),!!aa((s=o.feature.cardinality)!==null&&s!==void 0?s:n.get(o.feature),o.feature)););return a}function N2(t){for(const e of t.tokens){const n=PS(t.stacks,e);t.stacks=n}}function PS(t,e){const n=[];for(const r of t)n.push(...D2(r,e));return n}function D2(t,e){const n=new Map,r=new Set(t.map(s=>s.feature).filter(I2)),i=[];for(;t.length>0;){const s=t.pop(),a=hy({next:s,cardinalities:n,plus:r,visited:new Set}).filter(o=>e?my(o.feature,e):!0);for(const o of a)i.push([...t,o]);if(!a.every(o=>aa(o.feature.cardinality,o.feature)||aa(n.get(o.feature))))break}return i}function I2(t){if(t.cardinality==="+")return!0;const e=tn(t,wr);return!!(e&&e.cardinality==="+")}function my(t,e){if(br(t))return t.value===e.image;if(Mr(t))return O2(t.rule.ref,e);if(Ao(t)){const n=Rm(t);if(n)return my(n,e)}return!1}function O2(t,e){return en(t)?py(t.definition).some(r=>my(r.feature,e)):Lr(t)?Ho(t).test(e.image):!1}function L2(t){const e=Array.from(new Set(t.flatMap(r=>{var i;return(i=r?.triggerCharacters)!==null&&i!==void 0?i:[]}))),n=Array.from(new Set(t.flatMap(r=>{var i;return(i=r?.allCommitCharacters)!==null&&i!==void 0?i:[]})));return{triggerCharacters:e.length>0?e:void 0,allCommitCharacters:n.length>0?n:void 0}}class xS{constructor(e){this.scopeProvider=e.references.ScopeProvider,this.grammar=e.Grammar,this.completionParser=e.parser.CompletionParser,this.nameProvider=e.references.NameProvider,this.lexer=e.parser.Lexer,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.fuzzyMatcher=e.shared.lsp.FuzzyMatcher,this.grammarConfig=e.parser.GrammarConfig,this.astReflection=e.shared.AstReflection,this.documentationProvider=e.documentation.DocumentationProvider}async getCompletion(e,n,r){const i=[],s=this.buildContexts(e,n.position),a=(u,l)=>{const d=this.fillCompletionItem(u,l);d&&i.push(d)},o=u=>br(u.feature)?u.feature.value:u.feature,c=[];for(const u of s)if(await Promise.all(nt(u.features).distinct(o).exclude(c).map(l=>this.completionFor(u,l,a))),c.push(...u.features),!this.continueCompletion(i))break;return ve.CompletionList.create(this.deduplicateItems(i),!0)}deduplicateItems(e){return nt(e).distinct(n=>`${n.kind}_${n.label}_${n.detail}`).toArray()}findFeaturesAt(e,n){const r=e.getText({start:ve.Position.create(0,0),end:e.positionAt(n)}),i=this.completionParser.parse(r),s=i.tokens;if(i.tokenIndex===0){const c=Ld(this.grammar),u=py({feature:c.definition,type:Zi(c)});return s.length>0?(s.shift(),AS(u.map(l=>[l]),s)):u}const a=[...s].splice(i.tokenIndex);return AS([i.elementStack.map(c=>({feature:c}))],a)}*buildContexts(e,n){var r,i;const s=e.parseResult.value.$cstNode;if(!s)return;const a=e.textDocument,o=a.getText(),c=a.offsetAt(n),u={document:e,textDocument:a,offset:c,position:n},l=this.findDataTypeRuleStart(s,c);if(l){const[k,E]=l,_=(r=bd(s,k))===null||r===void 0?void 0:r.astNode;yield Object.assign(Object.assign({},u),{node:_,tokenOffset:k,tokenEndOffset:E,features:this.findFeaturesAt(a,k)})}const{nextTokenStart:d,nextTokenEnd:f,previousTokenStart:h,previousTokenEnd:m}=this.backtrackToAnyToken(o,c);let y=d;c<=d&&h!==void 0&&(y=h);const R=(i=bd(s,y))===null||i===void 0?void 0:i.astNode;let w=!0;if(h!==void 0&&m!==void 0&&m===c&&(yield Object.assign(Object.assign({},u),{node:R,tokenOffset:h,tokenEndOffset:m,features:this.findFeaturesAt(a,h)}),w=this.performNextTokenCompletion(e,o.substring(h,m),h,m),w&&(yield Object.assign(Object.assign({},u),{node:R,tokenOffset:m,tokenEndOffset:m,features:this.findFeaturesAt(a,m)}))),R)w&&(yield Object.assign(Object.assign({},u),{node:R,tokenOffset:d,tokenEndOffset:f,features:this.findFeaturesAt(a,d)}));else{const k=Ld(this.grammar);if(!k)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},u),{tokenOffset:d,tokenEndOffset:f,features:py(k.definition)})}}performNextTokenCompletion(e,n,r,i){return new RegExp("\\P{L}$","u").test(n)}findDataTypeRuleStart(e,n){var r,i;let s=gi(e,n,this.grammarConfig.nameRegexp),a=!!(!((r=tn(s?.grammarSource,en))===null||r===void 0)&&r.dataType);if(a){for(;a;)s=s?.container,a=!!(!((i=tn(s?.grammarSource,en))===null||i===void 0)&&i.dataType);if(s)return[s.offset,s.end]}}continueCompletion(e){return e.length===0}backtrackToAnyToken(e,n){const r=this.lexer.tokenize(e).tokens;if(r.length===0)return{nextTokenStart:n,nextTokenEnd:n};let i;for(const s of r){if(s.startOffset>=n)return{nextTokenStart:n,nextTokenEnd:n,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};if(s.endOffset>=n)return{nextTokenStart:s.startOffset,nextTokenEnd:s.endOffset+1,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};i=s}return{nextTokenStart:n,nextTokenEnd:n,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0}}completionFor(e,n,r){if(br(n.feature))return this.completionForKeyword(e,n.feature,r);if(Ao(n.feature)&&e.node)return this.completionForCrossReference(e,n,r)}completionForCrossReference(e,n,r){const i=tn(n.feature,wr);let s=e.node;if(i&&s){n.type&&(s={$type:n.type,$container:s,$containerProperty:n.property},mm(this.astReflection,s));const a={reference:{$refText:""},container:s,property:i.feature};try{for(const o of this.getReferenceCandidates(a,e))r(e,this.createReferenceCompletionItem(o))}catch(o){console.error(o)}}}getReferenceCandidates(e,n){return this.scopeProvider.getScope(e).getAllElements()}createReferenceCompletionItem(e){const n=this.nodeKindProvider.getCompletionItemKind(e),r=this.getReferenceDocumentation(e);return{nodeDescription:e,kind:n,documentation:r,detail:e.type,sortText:"0"}}getReferenceDocumentation(e){if(!e.node)return;const n=this.documentationProvider.getDocumentation(e.node);if(n)return{kind:"markdown",value:n}}completionForKeyword(e,n,r){this.filterKeyword(e,n)&&r(e,{label:n.value,kind:this.getKeywordCompletionItemKind(n),detail:"Keyword",sortText:"1"})}getKeywordCompletionItemKind(e){return ve.CompletionItemKind.Keyword}filterKeyword(e,n){return new RegExp("\\p{L}","u").test(n.value)}fillCompletionItem(e,n){var r,i;let s;if(typeof n.label=="string")s=n.label;else if("node"in n){const u=this.nameProvider.getName(n.node);if(!u)return;s=u}else if("nodeDescription"in n)s=n.nodeDescription.name;else return;let a;typeof((r=n.textEdit)===null||r===void 0?void 0:r.newText)=="string"?a=n.textEdit.newText:typeof n.insertText=="string"?a=n.insertText:a=s;const o=(i=n.textEdit)!==null&&i!==void 0?i:this.buildCompletionTextEdit(e,s,a);return o?{additionalTextEdits:n.additionalTextEdits,command:n.command,commitCharacters:n.commitCharacters,data:n.data,detail:n.detail,documentation:n.documentation,filterText:n.filterText,insertText:n.insertText,insertTextFormat:n.insertTextFormat,insertTextMode:n.insertTextMode,kind:n.kind,labelDetails:n.labelDetails,preselect:n.preselect,sortText:n.sortText,tags:n.tags,textEditText:n.textEditText,textEdit:o,label:s}:void 0}buildCompletionTextEdit(e,n,r){const s=e.textDocument.getText().substring(e.tokenOffset,e.offset);if(this.fuzzyMatcher.match(s,n)){const a=e.textDocument.positionAt(e.tokenOffset),o=e.position;return{newText:r,range:{start:a,end:o}}}else return}}class M2{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,n,r){const i=e.parseResult.value;if(i.$cstNode){const s=i.$cstNode,a=gi(s,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(a)return this.collectLocationLinks(a,n)}}collectLocationLinks(e,n){var r;const i=this.findLink(e);if(i)return[ve.LocationLink.create(i.targetDocument.textDocument.uri,((r=i.target.astNode.$cstNode)!==null&&r!==void 0?r:i.target).range,i.target.range,i.source.range)]}findLink(e){const n=this.references.findDeclarationNode(e);if(n?.astNode){const r=gt(n.astNode);if(n&&r)return{source:e,target:n,targetDocument:r}}}}class NS{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,n,r){const i=e.parseResult.value.$cstNode;if(!i)return;const s=gi(i,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(!s)return;const a=this.references.findDeclaration(s);if(a){const o=Tt.equals(gt(a).uri,e.uri),c={documentUri:e.uri,includeDeclaration:o};return this.references.findReferences(a,c).map(l=>this.createDocumentHighlight(l)).toArray()}}createDocumentHighlight(e){return ve.DocumentHighlight.create(e.segment.range)}}class z2{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e,n,r){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,n){const r=n.$cstNode,i=this.nameProvider.getNameNode(n);if(i&&r){const s=this.nameProvider.getName(n);return[{kind:this.nodeKindProvider.getSymbolKind(n),name:s||i.text,range:r.range,selectionRange:i.range,children:this.getChildSymbols(e,n)}]}else return this.getChildSymbols(e,n)||[]}getChildSymbols(e,n){const r=[];for(const i of Go(n)){const s=this.getSymbol(e,i);r.push(...s)}if(r.length>0)return r}}class F2{constructor(e){this.workspaceManager=e.workspace.WorkspaceManager,this.documentBuilder=e.workspace.DocumentBuilder,this.workspaceLock=e.workspace.WorkspaceLock,this.serviceRegistry=e.ServiceRegistry;let n=!1;e.lsp.LanguageServer.onInitialize(r=>{var i,s;n=!!(!((s=(i=r.capabilities.workspace)===null||i===void 0?void 0:i.didChangeWatchedFiles)===null||s===void 0)&&s.dynamicRegistration)}),e.lsp.LanguageServer.onInitialized(r=>{n&&this.registerFileWatcher(e)})}registerFileWatcher(e){const n=nt(e.ServiceRegistry.all).flatMap(r=>r.LanguageMetaData.fileExtensions).map(r=>r.startsWith(".")?r.substring(1):r).distinct().toArray();if(n.length>0){const r=e.lsp.Connection,i={watchers:[{globPattern:n.length===1?`**/*.${n[0]}`:`**/*.{${n.join(",")}}`}]};r?.client.register(ve.DidChangeWatchedFilesNotification.type,i)}}fireDocumentUpdate(e,n){e=e.filter(r=>this.serviceRegistry.hasServices(r)),this.workspaceManager.ready.then(()=>{this.workspaceLock.write(r=>this.documentBuilder.update(e,n,r))}).catch(r=>{console.error("Workspace initialization failed. Could not perform document update.",r)})}didChangeContent(e){this.fireDocumentUpdate([Vt.parse(e.document.uri)],[])}didChangeWatchedFiles(e){const n=nt(e.changes).filter(i=>i.type!==ve.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>Vt.parse(i.uri)).toArray(),r=nt(e.changes).filter(i=>i.type===ve.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>Vt.parse(i.uri)).toArray();this.fireDocumentUpdate(n,r)}}class q2{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e,n,r){const i=[],s=a=>i.push(a);return this.collectFolding(e,s),i}collectFolding(e,n){var r;const i=(r=e.parseResult)===null||r===void 0?void 0:r.value;if(i){if(this.shouldProcessContent(i)){const s=Rr(i).iterator();let a;do if(a=s.next(),!a.done){const o=a.value;this.shouldProcess(o)&&this.collectObjectFolding(e,o,n),this.shouldProcessContent(o)||s.prune()}while(!a.done)}this.collectCommentFolding(e,i,n)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,n,r){const i=n.$cstNode;if(i){const s=this.toFoldingRange(e,i);s&&r(s)}}collectCommentFolding(e,n,r){const i=n.$cstNode;if(i){for(const s of cb(i))if(this.commentNames.includes(s.tokenType.name)){const a=this.toFoldingRange(e,s,ve.FoldingRangeKind.Comment);a&&r(a)}}}toFoldingRange(e,n,r){const i=n.range,s=i.start;let a=i.end;if(!(a.line-s.line<2))return this.includeLastFoldingLine(n,r)||(a=e.textDocument.positionAt(e.textDocument.offsetAt({line:a.line,character:0})-1)),ve.FoldingRange.create(s.line,a.line,s.character,a.character,r)}includeLastFoldingLine(e,n){if(n===ve.FoldingRangeKind.Comment)return!1;const r=e.text,i=r.charAt(r.length-1);return!(i==="}"||i===")"||i==="]")}}class G2{match(e,n){if(e.length===0)return!0;let r=!1,i,s=0;const a=n.length;for(let o=0;o<a;o++){const c=n.charCodeAt(o),u=e.charCodeAt(s);if((c===u||this.toUpperCharCode(c)===this.toUpperCharCode(u))&&(r||(r=i===void 0||this.isWordTransition(i,c)),r&&s++,s===e.length))return!0;i=c}return!1}isWordTransition(e,n){return DS<=e&&e<=IS&&j2<=n&&n<=B2||e===OS&&n!==OS}toUpperCharCode(e){return DS<=e&&e<=IS?e-32:e}}const DS=97,IS=122,j2=65,B2=90,OS=95;class LS{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,n){var r,i;const s=(i=(r=e.parseResult)===null||r===void 0?void 0:r.value)===null||i===void 0?void 0:i.$cstNode;if(s){const a=e.textDocument.offsetAt(n.position),o=gi(s,a,this.grammarConfig.nameRegexp);if(o&&o.offset+o.length>a){const c=this.references.findDeclaration(o);if(c)return this.getAstNodeHoverContent(c)}}}}class U2 extends LS{constructor(e){super(e),this.documentationProvider=e.documentation.DocumentationProvider}getAstNodeHoverContent(e){const n=this.documentationProvider.getDocumentation(e);if(n)return{contents:{kind:"markdown",value:n}}}}var Xf=_t();const W2={[ve.SemanticTokenTypes.class]:0,[ve.SemanticTokenTypes.comment]:1,[ve.SemanticTokenTypes.enum]:2,[ve.SemanticTokenTypes.enumMember]:3,[ve.SemanticTokenTypes.event]:4,[ve.SemanticTokenTypes.function]:5,[ve.SemanticTokenTypes.interface]:6,[ve.SemanticTokenTypes.keyword]:7,[ve.SemanticTokenTypes.macro]:8,[ve.SemanticTokenTypes.method]:9,[ve.SemanticTokenTypes.modifier]:10,[ve.SemanticTokenTypes.namespace]:11,[ve.SemanticTokenTypes.number]:12,[ve.SemanticTokenTypes.operator]:13,[ve.SemanticTokenTypes.parameter]:14,[ve.SemanticTokenTypes.property]:15,[ve.SemanticTokenTypes.regexp]:16,[ve.SemanticTokenTypes.string]:17,[ve.SemanticTokenTypes.struct]:18,[ve.SemanticTokenTypes.type]:19,[ve.SemanticTokenTypes.typeParameter]:20,[ve.SemanticTokenTypes.variable]:21,[ve.SemanticTokenTypes.decorator]:22},H2={[ve.SemanticTokenModifiers.abstract]:1,[ve.SemanticTokenModifiers.async]:2,[ve.SemanticTokenModifiers.declaration]:4,[ve.SemanticTokenModifiers.defaultLibrary]:8,[ve.SemanticTokenModifiers.definition]:16,[ve.SemanticTokenModifiers.deprecated]:32,[ve.SemanticTokenModifiers.documentation]:64,[ve.SemanticTokenModifiers.modification]:128,[ve.SemanticTokenModifiers.readonly]:256,[ve.SemanticTokenModifiers.static]:512};function K2(t){const e=[],n=[];let r=!0,i=!0,s=!0;for(const a of t)a&&(a.legend.tokenTypes.forEach((o,c)=>{const u=e[c];if(u&&u!==o)throw new Error(`Cannot merge '${u}' and '${o}' token types. They use the same index ${c}.`);e[c]=o}),a.legend.tokenModifiers.forEach((o,c)=>{const u=n[c];if(u&&u!==o)throw new Error(`Cannot merge '${u}' and '${o}' token modifier. They use the same index ${c}.`);n[c]=o}),a.full?typeof a.full=="object"&&!a.full.delta&&(i=!1):r=!1,a.range||(s=!1));return{legend:{tokenTypes:e,tokenModifiers:n},full:r&&{delta:i},range:s}}class V2 extends ve.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(e,n,r,i,s){this._tokens.push({line:e,char:n,length:r,tokenType:i,tokenModifiers:s})}build(){return this.applyTokens(),super.build()}buildEdits(){return this.applyTokens(),super.buildEdits()}flush(){this.previousResult(this.id)}applyTokens(){for(const e of this._tokens.sort(this.compareTokens))super.push(e.line,e.char,e.length,e.tokenType,e.tokenModifiers);this._tokens=[]}compareTokens(e,n){return e.line===n.line?e.char-n.char:e.line-n.line}}class X2{constructor(e){this.tokensBuilders=new Map,e.shared.workspace.TextDocuments.onDidClose(n=>{this.tokensBuilders.delete(n.document.uri)}),e.shared.lsp.LanguageServer.onInitialize(n=>{var r;this.initialize((r=n.capabilities.textDocument)===null||r===void 0?void 0:r.semanticTokens)})}initialize(e){this.clientCapabilities=e}get tokenTypes(){return W2}get tokenModifiers(){return H2}get semanticTokensOptions(){return{legend:{tokenTypes:Object.keys(this.tokenTypes),tokenModifiers:Object.keys(this.tokenModifiers)},full:{delta:!0},range:!0}}async semanticHighlight(e,n,r=ot.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),r),this.currentTokensBuilder.build()}async semanticHighlightRange(e,n,r=ot.CancellationToken.None){return this.currentRange=n.range,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),r),this.currentTokensBuilder.build()}async semanticHighlightDelta(e,n,r=ot.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.previousResult(n.previousResultId),await this.computeHighlighting(e,this.createAcceptor(),r),this.currentTokensBuilder.buildEdits()}createAcceptor(){return n=>{"line"in n?this.highlightToken({range:{start:{line:n.line,character:n.char},end:{line:n.line,character:n.char+n.length}},type:n.type,modifier:n.modifier}):"range"in n?this.highlightToken(n):"keyword"in n?this.highlightKeyword(n):"property"in n?this.highlightProperty(n):this.highlightNode({node:n.cst,type:n.type,modifier:n.modifier})}}getDocumentTokensBuilder(e){const n=this.tokensBuilders.get(e.uri.toString());if(n)return n;const r=new V2;return this.tokensBuilders.set(e.uri.toString(),r),r}async computeHighlighting(e,n,r){const i=e.parseResult.value,s=zr(i,{range:this.currentRange}).iterator();let a;do if(a=s.next(),!a.done){await Pt(r);const o=a.value;this.highlightElement(o,n)==="prune"&&s.prune()}while(!a.done)}highlightToken(e){var n;const{range:r,type:i}=e;let s=e.modifier;if(this.currentRange&&!em(r,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;const a=this.tokenTypes[i];let o=0;if(s!==void 0){typeof s=="string"&&(s=[s]);for(const l of s){const d=this.tokenModifiers[l];o|=d}}const c=r.start.line,u=r.end.line;if(c===u){const l=r.start.character,d=r.end.character-l;this.currentTokensBuilder.push(c,l,d,a,o)}else if(!((n=this.clientCapabilities)===null||n===void 0)&&n.multilineTokenSupport){const l=r.start.character,d=this.currentDocument.textDocument.offsetAt(r.start),f=this.currentDocument.textDocument.offsetAt(r.end);this.currentTokensBuilder.push(c,l,f-d,a,o)}else{const l=r.start;let d=this.currentDocument.textDocument.offsetAt({line:c+1,character:0});this.currentTokensBuilder.push(l.line,l.character,d-l.character-1,a,o);for(let f=c+1;f<u;f++){const h=d;d=this.currentDocument.textDocument.offsetAt({line:f+1,character:0}),this.currentTokensBuilder.push(f,0,d-h-1,a,o)}this.currentTokensBuilder.push(u,0,r.end.character,a,o)}}highlightProperty(e){const n=[];if(typeof e.index=="number"){const s=nn(e.node.$cstNode,e.property,e.index);s&&n.push(s)}else n.push(...sa(e.node.$cstNode,e.property));const{type:r,modifier:i}=e;for(const s of n)this.highlightNode({node:s,type:r,modifier:i})}highlightKeyword(e){const{node:n,keyword:r,type:i,index:s,modifier:a}=e,o=[];if(typeof s=="number"){const c=Uo(n.$cstNode,r,s);c&&o.push(c)}else o.push(...km(n.$cstNode,r));for(const c of o)this.highlightNode({node:c,type:i,modifier:a})}highlightNode(e){const{node:n,type:r,modifier:i}=e,s=n.range;this.highlightToken({range:s,type:r,modifier:i})}}var MS;(function(t){function e(r,i,s){const a=new Map;Object.entries(i).forEach(([u,l])=>a.set(l,u));let o=0,c=0;return n(r.data,5).map(u=>{o+=u[0],u[0]!==0&&(c=0),c+=u[1];const l=u[2];return{offset:s.textDocument.offsetAt({line:o,character:c}),tokenType:a.get(u[3]),tokenModifiers:u[4],text:s.textDocument.getText({start:{line:o,character:c},end:{line:o,character:c+l}})}})}t.decode=e;function n(r,i){const s=[];for(let a=0;a<r.length;a+=i){const o=r.slice(a,a+i);s.push(o)}return s}})(MS||(MS={}));function Y2(t){const e=[],n=[];t.forEach(i=>{i?.triggerCharacters&&e.push(...i.triggerCharacters),i?.retriggerCharacters&&n.push(...i.retriggerCharacters)});const r={triggerCharacters:e.length>0?Array.from(new Set(e)).sort():void 0,retriggerCharacters:n.length>0?Array.from(new Set(n)).sort():void 0};return r.triggerCharacters?r:void 0}class J2{constructor(e){this.onInitializeEmitter=new Xf.Emitter,this.onInitializedEmitter=new Xf.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.fireInitializeOnDefaultServices(e),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){Zg(this.services),this.services.ServiceRegistry.all.forEach(e=>Zg(e))}hasService(e){return this.services.ServiceRegistry.all.some(r=>e(r)!==void 0)}buildInitializeResult(e){var n,r,i,s;const a=this.services.lsp.DocumentUpdateHandler,o=(n=this.services.lsp.FileOperationHandler)===null||n===void 0?void 0:n.fileOperationOptions,c=this.services.ServiceRegistry.all,u=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.Formatter}),l=c.map(te=>{var A,me;return(me=(A=te.lsp)===null||A===void 0?void 0:A.Formatter)===null||me===void 0?void 0:me.formatOnTypeOptions}).find(te=>!!te),d=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.CodeActionProvider}),f=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.SemanticTokenProvider}),h=K2(c.map(te=>{var A,me;return(me=(A=te.lsp)===null||A===void 0?void 0:A.SemanticTokenProvider)===null||me===void 0?void 0:me.semanticTokensOptions})),m=(i=(r=this.services.lsp)===null||r===void 0?void 0:r.ExecuteCommandHandler)===null||i===void 0?void 0:i.commands,y=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.DocumentLinkProvider}),R=Y2(c.map(te=>{var A,me;return(me=(A=te.lsp)===null||A===void 0?void 0:A.SignatureHelp)===null||me===void 0?void 0:me.signatureHelpOptions})),w=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.TypeProvider}),k=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.ImplementationProvider}),E=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.CompletionProvider}),_=L2(c.map(te=>{var A,me;return(me=(A=te.lsp)===null||A===void 0?void 0:A.CompletionProvider)===null||me===void 0?void 0:me.completionOptions})),C=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.ReferencesProvider}),I=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.DocumentSymbolProvider}),j=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.DefinitionProvider}),J=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.DocumentHighlightProvider}),Z=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.FoldingRangeProvider}),oe=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.HoverProvider}),L=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.RenameProvider}),S=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.CallHierarchyProvider}),$=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.TypeHierarchyProvider}),O=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.CodeLensProvider}),K=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.DeclarationProvider}),W=this.hasService(te=>{var A;return(A=te.lsp)===null||A===void 0?void 0:A.InlayHintProvider}),H=(s=this.services.lsp)===null||s===void 0?void 0:s.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:o},executeCommandProvider:m&&{commands:m},textDocumentSync:{change:Xf.TextDocumentSyncKind.Incremental,openClose:!0,save:!!a.didSaveDocument,willSave:!!a.willSaveDocument,willSaveWaitUntil:!!a.willSaveDocumentWaitUntil},completionProvider:E?_:void 0,referencesProvider:C,documentSymbolProvider:I,definitionProvider:j,typeDefinitionProvider:w,documentHighlightProvider:J,codeActionProvider:d,documentFormattingProvider:u,documentRangeFormattingProvider:u,documentOnTypeFormattingProvider:l,foldingRangeProvider:Z,hoverProvider:oe,renameProvider:L?{prepareProvider:!0}:void 0,semanticTokensProvider:f?h:void 0,signatureHelpProvider:R,implementationProvider:k,callHierarchyProvider:S?{}:void 0,typeHierarchyProvider:$?{}:void 0,documentLinkProvider:y?{resolveProvider:!1}:void 0,codeLensProvider:O?{resolveProvider:!1}:void 0,declarationProvider:K,inlayHintProvider:W?{resolveProvider:!1}:void 0,workspaceSymbolProvider:H?{resolveProvider:!!H.resolveSymbol}:void 0}}}initialized(e){this.fireInitializedOnDefaultServices(e),this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}fireInitializeOnDefaultServices(e){this.services.workspace.ConfigurationProvider.initialize(e),this.services.workspace.WorkspaceManager.initialize(e)}fireInitializedOnDefaultServices(e){const n=this.services.lsp.Connection,r=n?Object.assign(Object.assign({},e),{register:i=>n.client.register(Xf.DidChangeConfigurationNotification.type,i),fetchConfiguration:i=>n.workspace.getConfiguration(i)}):e;this.services.workspace.ConfigurationProvider.initialized(r).catch(i=>console.error("Error in ConfigurationProvider initialization:",i)),this.services.workspace.WorkspaceManager.initialized(e).catch(i=>console.error("Error in WorkspaceManager initialization:",i))}}class Q2{getSymbolKind(e){return ve.SymbolKind.Field}getCompletionItemKind(e){return ve.CompletionItemKind.Reference}}class Z2{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,n,r){const i=e.parseResult.value.$cstNode;if(!i)return[];const s=gi(i,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);return s?this.getReferences(s,n,e):[]}getReferences(e,n,r){const i=[],s=this.references.findDeclaration(e);if(s){const a={includeDeclaration:n.context.includeDeclaration};this.references.findReferences(s,a).forEach(o=>{i.push(ve.Location.create(o.sourceUri.toString(),o.segment.range))})}return i}}class eB{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,n,r){const i={},s=e.parseResult.value.$cstNode;if(!s)return;const a=e.textDocument.offsetAt(n.position),o=gi(s,a,this.grammarConfig.nameRegexp);if(!o)return;const c=this.references.findDeclaration(o);if(!c)return;const u={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(c,u).forEach(d=>{const f=Sn.replace(d.segment.range,n.newName),h=d.sourceUri.toString();i[h]?i[h].push(f):i[h]=[f]}),{changes:i}}prepareRename(e,n,r){return this.renameNodeRange(e,n.position)}renameNodeRange(e,n){const r=e.parseResult.value.$cstNode,i=e.textDocument.offsetAt(n);if(r&&i){const s=gi(r,i,this.grammarConfig.nameRegexp);if(!s)return;if(this.references.findDeclaration(s)||this.isNameNode(s))return s.range}}isNameNode(e){return e?.astNode&&Mf(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}}class zS{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,n=ot.CancellationToken.None){const r=[],i=e.query.toLowerCase();for(const s of this.indexManager.allElements())if(await Pt(n),this.fuzzyMatcher.match(i,s.name)){const a=this.getWorkspaceSymbol(s);a&&r.push(a)}return r}getWorkspaceSymbol(e){const n=e.nameSegment;if(n)return{kind:this.nodeKindProvider.getSymbolKind(e),name:e.name,location:{range:n.range,uri:e.documentUri.toString()}}}}class tB{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new ve.Emitter,this._onDidOpen=new ve.Emitter,this._onDidClose=new ve.Emitter,this._onDidSave=new ve.Emitter,this._onWillSave=new ve.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(Tt.normalize(e))}set(e){const n=Tt.normalize(e.uri);let r=!0;this._syncedDocuments.has(n)&&(r=!1),this._syncedDocuments.set(n,e);const i=Object.freeze({document:e});return this._onDidOpen.fire(i),this._onDidChangeContent.fire(i),r}delete(e){const n=Tt.normalize(typeof e=="object"&&"uri"in e?e.uri:e),r=this._syncedDocuments.get(n);r!==void 0&&(this._syncedDocuments.delete(n),this._onDidClose.fire(Object.freeze({document:r})))}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=ve.TextDocumentSyncKind.Incremental;const n=[];return n.push(e.onDidOpenTextDocument(r=>{const i=r.textDocument,s=Tt.normalize(i.uri),a=this._configuration.create(s,i.languageId,i.version,i.text);this._syncedDocuments.set(s,a);const o=Object.freeze({document:a});this._onDidOpen.fire(o),this._onDidChangeContent.fire(o)})),n.push(e.onDidChangeTextDocument(r=>{const i=r.textDocument,s=r.contentChanges;if(s.length===0)return;const{version:a}=i;if(a==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);const o=Tt.normalize(i.uri);let c=this._syncedDocuments.get(o);c!==void 0&&(c=this._configuration.update(c,s,a),this._syncedDocuments.set(o,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),n.push(e.onDidCloseTextDocument(r=>{const i=Tt.normalize(r.textDocument.uri),s=this._syncedDocuments.get(i);s!==void 0&&(this._syncedDocuments.delete(i),this._onDidClose.fire(Object.freeze({document:s})))})),n.push(e.onWillSaveTextDocument(r=>{const i=this._syncedDocuments.get(Tt.normalize(r.textDocument.uri));i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:r.reason}))})),n.push(e.onWillSaveTextDocumentWaitUntil((r,i)=>{const s=this._syncedDocuments.get(Tt.normalize(r.textDocument.uri));return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:r.reason}),i):[]})),n.push(e.onDidSaveTextDocument(r=>{const i=this._syncedDocuments.get(Tt.normalize(r.textDocument.uri));i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),ve.Disposable.create(()=>{n.forEach(r=>r.dispose())})}}function nB(t){return qf.merge(BT(t),rB(t))}function rB(t){return{lsp:{CompletionProvider:e=>new xS(e),DocumentSymbolProvider:e=>new z2(e),HoverProvider:e=>new U2(e),FoldingRangeProvider:e=>new q2(e),ReferencesProvider:e=>new Z2(e),DefinitionProvider:e=>new M2(e),DocumentHighlightProvider:e=>new NS(e),RenameProvider:e=>new eB(e)},shared:()=>t.shared}}function iB(t){return qf.merge(UT(t),sB(t))}function sB(t){return{lsp:{Connection:()=>t.connection,LanguageServer:e=>new J2(e),DocumentUpdateHandler:e=>new F2(e),WorkspaceSymbolProvider:e=>new zS(e),NodeKindProvider:()=>new Q2,FuzzyMatcher:()=>new G2},workspace:{TextDocuments:()=>new tB(Lf)}}}class aB{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new oB(e,this.collector)}formatDocument(e,n){const r=e.parseResult;return r.lexerErrors.length===0&&r.parserErrors.length===0?this.doDocumentFormat(e,n.options):[]}isFormatRangeErrorFree(e,n){const r=e.parseResult;return r.lexerErrors.length||r.parserErrors.length?Math.min(...r.lexerErrors.map(s=>{var a;return(a=s.line)!==null&&a!==void 0?a:Number.MAX_VALUE}),...r.parserErrors.map(s=>{var a;return(a=s.token.startLine)!==null&&a!==void 0?a:Number.MAX_VALUE}))>n.end.line:!0}formatDocumentRange(e,n){return this.isFormatRangeErrorFree(e,n.range)?this.doDocumentFormat(e,n.options,n.range):[]}formatDocumentOnType(e,n){const r={start:{character:0,line:n.position.line},end:n.position};return this.isFormatRangeErrorFree(e,r)?this.doDocumentFormat(e,n.options,r):[]}get formatOnTypeOptions(){}doDocumentFormat(e,n,r){const i=new Map,s=(o,c,u)=>{var l,d;const f=this.nodeModeToKey(o,c),h=i.get(f),m=(l=u.options.priority)!==null&&l!==void 0?l:0,y=(d=h?.options.priority)!==null&&d!==void 0?d:0;(!h||y<=m)&&i.set(f,u)};this.collector=s,this.iterateAstFormatting(e,r);const a=this.iterateCstFormatting(e,i,n,r);return this.avoidOverlappingEdits(e.textDocument,a)}avoidOverlappingEdits(e,n){const r=[];for(const i of n){let s=r[r.length-1];for(;s;){const a=e.offsetAt(i.range.start),o=e.offsetAt(s.range.end);if(a<o)r.pop(),s=r[r.length-1];else break}r.push(i)}return r.filter(i=>this.isNecessary(i,e))}iterateAstFormatting(e,n){const r=e.parseResult.value;this.format(r);const i=Rr(r).iterator();let s;do if(s=i.next(),!s.done){const a=s.value;this.insideRange(a.$cstNode.range,n)?this.format(a):i.prune()}while(!s.done)}nodeModeToKey(e,n){return`${e.offset}:${e.end}:${n}`}insideRange(e,n){return!n||e.start.line<=n.start.line&&e.end.line>=n.end.line||e.start.line>=n.start.line&&e.end.line<=n.end.line||e.start.line<=n.end.line&&e.end.line>=n.end.line}isNecessary(e,n){return e.newText!==n.getText(e.range).replace(/\r/g,"")}iterateCstFormatting(e,n,r,i){const s={indentation:0,options:r,document:e.textDocument},a=[],c=this.iterateCstTree(e,s).iterator();let u,l;do if(l=c.next(),!l.done){const d=l.value,f=Ji(d),h=this.nodeModeToKey(d,"prepend"),m=n.get(h);if(n.delete(h),m){const w=this.createTextEdit(u,d,m,s);for(const k of w)k&&this.insideRange(k.range,i)&&a.push(k)}const y=this.nodeModeToKey(d,"append"),R=n.get(y);if(n.delete(y),R){const w=hb(d);if(w){const k=this.createTextEdit(d,w,R,s);for(const E of k)E&&this.insideRange(E.range,i)&&a.push(E)}}if(!m&&d.hidden){const w=this.createHiddenTextEdits(u,d,void 0,s);for(const k of w)k&&this.insideRange(k.range,i)&&a.push(k)}f&&(u=d)}while(!l.done);return a}createHiddenTextEdits(e,n,r,i){var s;const a=n.range.start.line;if(e&&e.range.end.line===a)return[];const o=[],c={start:{character:0,line:a},end:n.range.start},u=i.document.getText(c),l=this.findFittingMove(c,(s=r?.moves)!==null&&s!==void 0?s:[],i),d=this.getExistingIndentationCharacterCount(u,i),h=this.getIndentationCharacterCount(i,l)-d;if(h===0)return[];let m="";h>0&&(m=(i.options.insertSpaces?" ":" ").repeat(h));const y=n.text.split(`
180
- `);y[0]=u+y[0];for(let R=0;R<y.length;R++){const w=a+R,k={character:0,line:w};if(h>0)o.push({newText:m,range:{start:k,end:k}});else{const E=y[R];let _=0;for(;_<E.length;_++){const C=E.charAt(_);if(C!==" "&&C!==" ")break}o.push({newText:"",range:{start:k,end:{line:w,character:Math.min(_,Math.abs(h))}}})}}return o}getExistingIndentationCharacterCount(e,n){const r=" ".repeat(n.options.tabSize);return(n.options.insertSpaces?e.replaceAll(" ",r):e.replaceAll(r," ")).length}getIndentationCharacterCount(e,n){let r=e.indentation;return n&&n.tabs&&(r+=n.tabs),(e.options.insertSpaces?e.options.tabSize:1)*r}createTextEdit(e,n,r,i){var s;if(n.hidden)return this.createHiddenTextEdits(e,n,r,i);if(e&&(e.range.end.line>n.range.start.line||e.range.end.line===n.range.start.line&&e.range.end.character>n.range.start.character))return[];const a={start:(s=e?.range.end)!==null&&s!==void 0?s:{character:0,line:0},end:n.range.start},o=this.findFittingMove(a,r.moves,i);if(!o)return[];const c=o.characters,u=o.lines,l=o.tabs,d=i.indentation;i.indentation+=l??0;const f=[];return c!==void 0?e?.hidden||f.push(this.createSpaceTextEdit(a,c,r.options)):u!==void 0?f.push(this.createLineTextEdit(a,u,i,r.options)):l!==void 0&&f.push(this.createTabTextEdit(a,!!e,i)),Ji(n)&&(i.indentation=d),f}createSpaceTextEdit(e,n,r){if(e.start.line===e.end.line){const s=e.end.character-e.start.character;n=this.fitIntoOptions(n,s,r)}return{newText:" ".repeat(n),range:e}}createLineTextEdit(e,n,r,i){const s=e.end.line-e.start.line;n=this.fitIntoOptions(n,s,i);const o=(r.options.insertSpaces?" ".repeat(r.options.tabSize):" ").repeat(r.indentation);return{newText:`${`
181
- `.repeat(n)}${o}`,range:e}}createTabTextEdit(e,n,r){const s=(r.options.insertSpaces?" ".repeat(r.options.tabSize):" ").repeat(r.indentation),a=n?1:0,o=Math.max(e.end.line-e.start.line,a);return{newText:`${`
182
- `.repeat(o)}${s}`,range:e}}fitIntoOptions(e,n,r){return r.allowMore?e=Math.max(n,e):r.allowLess&&(e=Math.min(n,e)),e}findFittingMove(e,n,r){if(n.length===0)return;if(n.length===1)return n[0];const i=e.end.line-e.start.line;for(const s of n){if(s.lines!==void 0&&i<=s.lines)return s;if(s.lines===void 0&&i===0)return s}return n[n.length-1]}iterateCstTree(e,n){const i=e.parseResult.value.$cstNode;return i?new na(i,s=>this.iterateCst(s,n)):ta}iterateCst(e,n){if(!mi(e))return ta;const r=n.indentation;return new Nt(()=>({index:0}),i=>i.index<e.content.length?{done:!1,value:e.content[i.index++]}:(n.indentation=r,Zt))}}class oB{constructor(e,n){this.astNode=e,this.collector=n}node(e){return new pr(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){const n=[];for(const r of e)r.$cstNode&&n.push(r.$cstNode);return new pr(n,this.collector)}property(e,n){const r=nn(this.astNode.$cstNode,e,n);return new pr(r?[r]:[],this.collector)}properties(...e){const n=[];for(const r of e){const i=sa(this.astNode.$cstNode,r);n.push(...i)}return new pr(n,this.collector)}keyword(e,n){const r=Uo(this.astNode.$cstNode,e,n);return new pr(r?[r]:[],this.collector)}keywords(...e){const n=[];for(const r of e){const i=km(this.astNode.$cstNode,r);n.push(...i)}return new pr(n,this.collector)}cst(e){return new pr([...e],this.collector)}interior(e,n){const r=e.nodes,i=n.nodes;if(r.length!==1||i.length!==1)return new pr([],this.collector);let s=r[0],a=i[0];if(s.offset>a.offset){const o=s;s=a,a=o}return new pr(pb(s,a),this.collector)}}class pr{constructor(e,n){this.nodes=e,this.collector=n}prepend(e){for(const n of this.nodes)this.collector(n,"prepend",e);return this}append(e){for(const n of this.nodes)this.collector(n,"append",e);return this}surround(e){for(const n of this.nodes)this.collector(n,"prepend",e),this.collector(n,"append",e);return this}slice(e,n){return new pr(this.nodes.slice(e,n),this.collector)}}var _i;(function(t){function e(...l){return{options:{},moves:l.flatMap(d=>d.moves).sort(u)}}t.fit=e;function n(l){return i(0,l)}t.noSpace=n;function r(l){return i(1,l)}t.oneSpace=r;function i(l,d){return{options:d??{},moves:[{characters:l}]}}t.spaces=i;function s(l){return a(1,l)}t.newLine=s;function a(l,d){return{options:d??{},moves:[{lines:l}]}}t.newLines=a;function o(l){return{options:l??{},moves:[{tabs:1,lines:1}]}}t.indent=o;function c(l){return{options:l??{},moves:[{tabs:0}]}}t.noIndent=c;function u(l,d){var f,h,m,y,R,w;const k=(f=l.lines)!==null&&f!==void 0?f:0,E=(h=d.lines)!==null&&h!==void 0?h:0,_=(m=l.tabs)!==null&&m!==void 0?m:0,C=(y=d.tabs)!==null&&y!==void 0?y:0,I=(R=l.characters)!==null&&R!==void 0?R:0,j=(w=d.characters)!==null&&w!==void 0?w:0;return k<E?-1:k>E?1:_<C?-1:_>C?1:I<j?-1:I>j?1:0}})(_i||(_i={}));var gy,FS;function cB(){return FS||(FS=1,gy=_S()),gy}cB();var _s={},Yc={},Jc={},As={},cr={},ii={},qS;function GS(){if(qS)return ii;qS=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.normalizePath=ii.convertSlashes=ii.cleanPath=void 0;const t=hi;function e(s){let a=(0,t.normalize)(s);return a.length>1&&a[a.length-1]===t.sep&&(a=a.substring(0,a.length-1)),a}ii.cleanPath=e;const n=/[\\/]/g;function r(s,a){return s.replace(n,a)}ii.convertSlashes=r;function i(s,a){const{resolvePaths:o,normalizePath:c,pathSeparator:u}=a,l=process.platform==="win32"&&s.includes("/")||s.startsWith(".");if(o&&(s=(0,t.resolve)(s)),(c||l)&&(s=e(s)),s===".")return"";const d=s[s.length-1]!==u;return r(d?s+u:s,u)}return ii.normalizePath=i,ii}var si={},jS;function uB(){if(jS)return si;jS=1,Object.defineProperty(si,"__esModule",{value:!0}),si.build=si.joinDirectoryPath=si.joinPathWithBasePath=void 0;const t=hi,e=GS();function n(o,c){return c+o}si.joinPathWithBasePath=n;function r(o,c){return function(u,l){return l.startsWith(o)?l.replace(o,"")+u:(0,e.convertSlashes)((0,t.relative)(o,l),c.pathSeparator)+c.pathSeparator+u}}function i(o){return o}function s(o,c,u){return c+o+u}si.joinDirectoryPath=s;function a(o,c){const{relativePaths:u,includeBasePath:l}=c;return u&&o?r(o,c):l?n:i}return si.build=a,si}var Qc={},BS;function lB(){if(BS)return Qc;BS=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.build=void 0;function t(a){return function(o,c){c.push(o.substring(a.length)||".")}}function e(a){return function(o,c,u){const l=o.substring(a.length)||".";u.every(d=>d(l,!0))&&c.push(l)}}const n=(a,o)=>{o.push(a||".")},r=(a,o,c)=>{const u=a||".";c.every(l=>l(u,!0))&&o.push(u)},i=()=>{};function s(a,o){const{includeDirs:c,filters:u,relativePaths:l}=o;return c?l?u&&u.length?e(a):t(a):u&&u.length?r:n:i}return Qc.build=s,Qc}var Zc={},US;function dB(){if(US)return Zc;US=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.build=void 0;const t=(a,o,c,u)=>{u.every(l=>l(a,!1))&&c.files++},e=(a,o,c,u)=>{u.every(l=>l(a,!1))&&o.push(a)},n=(a,o,c,u)=>{c.files++},r=(a,o)=>{o.push(a)},i=()=>{};function s(a){const{excludeFiles:o,filters:c,onlyCounts:u}=a;return o?i:c&&c.length?u?t:e:u?n:r}return Zc.build=s,Zc}var eu={},WS;function fB(){if(WS)return eu;WS=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.build=void 0;const t=r=>r,e=()=>[""].slice(0,0);function n(r){return r.group?e:t}return eu.build=n,eu}var tu={},HS;function hB(){if(HS)return tu;HS=1,Object.defineProperty(tu,"__esModule",{value:!0}),tu.build=void 0;const t=(r,i,s)=>{r.push({directory:i,files:s,dir:i})},e=()=>{};function n(r){return r.group?t:e}return tu.build=n,tu}var Cs={},KS;function pB(){if(KS)return Cs;KS=1;var t=Cs&&Cs.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.build=void 0;const e=t(Za),n=hi,r=function(c,u,l){const{queue:d,options:{suppressErrors:f}}=u;d.enqueue(),e.default.realpath(c,(h,m)=>{if(h)return d.dequeue(f?null:h,u);e.default.stat(m,(y,R)=>{if(y)return d.dequeue(f?null:y,u);if(R.isDirectory()&&a(c,m,u))return d.dequeue(null,u);l(R,m),d.dequeue(null,u)})})},i=function(c,u,l){const{queue:d,options:{suppressErrors:f}}=u;d.enqueue();try{const h=e.default.realpathSync(c),m=e.default.statSync(h);if(m.isDirectory()&&a(c,h,u))return;l(m,h)}catch(h){if(!f)throw h}};function s(c,u){return!c.resolveSymlinks||c.excludeSymlinks?null:u?i:r}Cs.build=s;function a(c,u,l){if(l.options.useRealPaths)return o(u,l);let d=(0,n.dirname)(c),f=1;for(;d!==l.root&&f<2;){const h=l.symlinks.get(d);!!h&&(h===u||h.startsWith(u)||u.startsWith(h))?f++:d=(0,n.dirname)(d)}return l.symlinks.set(c,u),f>1}function o(c,u){return u.visited.includes(c+u.options.pathSeparator)}return Cs}var nu={},VS;function mB(){if(VS)return nu;VS=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.build=void 0;const t=l=>l.counts,e=l=>l.groups,n=l=>l.paths,r=l=>l.paths.slice(0,l.options.maxFiles),i=(l,d,f)=>(c(d,f,l.counts,l.options.suppressErrors),null),s=(l,d,f)=>(c(d,f,l.paths,l.options.suppressErrors),null),a=(l,d,f)=>(c(d,f,l.paths.slice(0,l.options.maxFiles),l.options.suppressErrors),null),o=(l,d,f)=>(c(d,f,l.groups,l.options.suppressErrors),null);function c(l,d,f,h){d(l&&!h?l:null,f)}function u(l,d){const{onlyCounts:f,group:h,maxFiles:m}=l;return f?d?t:i:h?d?e:o:m?d?r:a:d?n:s}return nu.build=u,nu}var Ps={},XS;function gB(){if(XS)return Ps;XS=1;var t=Ps&&Ps.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.build=void 0;const e=t(Za),n={withFileTypes:!0},r=(a,o,c,u,l)=>{if(u<0)return a.queue.dequeue(null,a);a.visited.push(o),a.counts.directories++,a.queue.enqueue(),e.default.readdir(o||".",n,(d,f=[])=>{l(f,c,u),a.queue.dequeue(a.options.suppressErrors?null:d,a)})},i=(a,o,c,u,l)=>{if(u<0)return;a.visited.push(o),a.counts.directories++;let d=[];try{d=e.default.readdirSync(o||".",n)}catch(f){if(!a.options.suppressErrors)throw f}l(d,c,u)};function s(a){return a?i:r}return Ps.build=s,Ps}var ru={},YS;function yB(){if(YS)return ru;YS=1,Object.defineProperty(ru,"__esModule",{value:!0}),ru.Queue=void 0;class t{onQueueEmpty;count=0;constructor(n){this.onQueueEmpty=n}enqueue(){this.count++}dequeue(n,r){(--this.count<=0||n)&&this.onQueueEmpty(n,r)}}return ru.Queue=t,ru}var iu={},JS;function vB(){if(JS)return iu;JS=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.Counter=void 0;class t{_files=0;_directories=0;set files(n){this._files=n}get files(){return this._files}set directories(n){this._directories=n}get directories(){return this._directories}get dirs(){return this._directories}}return iu.Counter=t,iu}var QS;function ZS(){if(QS)return cr;QS=1;var t=cr&&cr.__createBinding||(Object.create?function(R,w,k,E){E===void 0&&(E=k);var _=Object.getOwnPropertyDescriptor(w,k);(!_||("get"in _?!w.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return w[k]}}),Object.defineProperty(R,E,_)}:function(R,w,k,E){E===void 0&&(E=k),R[E]=w[k]}),e=cr&&cr.__setModuleDefault||(Object.create?function(R,w){Object.defineProperty(R,"default",{enumerable:!0,value:w})}:function(R,w){R.default=w}),n=cr&&cr.__importStar||function(R){if(R&&R.__esModule)return R;var w={};if(R!=null)for(var k in R)k!=="default"&&Object.prototype.hasOwnProperty.call(R,k)&&t(w,R,k);return e(w,R),w};Object.defineProperty(cr,"__esModule",{value:!0}),cr.Walker=void 0;const r=hi,i=GS(),s=n(uB()),a=n(lB()),o=n(dB()),c=n(fB()),u=n(hB()),l=n(pB()),d=n(mB()),f=n(gB()),h=yB(),m=vB();class y{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(w,k,E){this.isSynchronous=!E,this.callbackInvoker=d.build(k,this.isSynchronous),this.root=(0,i.normalizePath)(w,k),this.state={root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new m.Counter,options:k,queue:new h.Queue((_,C)=>this.callbackInvoker(C,_,E)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=s.build(this.root,k),this.pushDirectory=a.build(this.root,k),this.pushFile=o.build(k),this.getArray=c.build(k),this.groupFiles=u.build(k),this.resolveSymlink=l.build(k,this.isSynchronous),this.walkDirectory=f.build(this.isSynchronous)}start(){return this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(w,k,E)=>{const{paths:_,options:{filters:C,resolveSymlinks:I,excludeSymlinks:j,exclude:J,maxFiles:Z,signal:oe,useRealPaths:L,pathSeparator:S}}=this.state;if(oe&&oe.aborted||Z&&_.length>Z)return;this.pushDirectory(k,_,C);const $=this.getArray(this.state.paths);for(let O=0;O<w.length;++O){const K=w[O];if(K.isFile()||K.isSymbolicLink()&&!I&&!j){const W=this.joinPath(K.name,k);this.pushFile(W,$,this.state.counts,C)}else if(K.isDirectory()){let W=s.joinDirectoryPath(K.name,k,this.state.options.pathSeparator);if(J&&J(K.name,W))continue;this.walkDirectory(this.state,W,W,E-1,this.walk)}else if(K.isSymbolicLink()&&this.resolveSymlink){let W=s.joinPathWithBasePath(K.name,k);this.resolveSymlink(W,this.state,(H,$e)=>{if(H.isDirectory()){if($e=(0,i.normalizePath)($e,this.state.options),J&&J(K.name,L?$e:W+S))return;this.walkDirectory(this.state,$e,L?$e:W+S,E-1,this.walk)}else{$e=L?$e:W;const te=(0,r.basename)($e),A=(0,i.normalizePath)((0,r.dirname)($e),this.state.options);$e=this.joinPath(te,A),this.pushFile($e,$,this.state.counts,C)}})}}this.groupFiles(this.state.groups,k,$)}}return cr.Walker=y,cr}var e0;function wB(){if(e0)return As;e0=1,Object.defineProperty(As,"__esModule",{value:!0}),As.callback=As.promise=void 0;const t=ZS();function e(r,i){return new Promise((s,a)=>{n(r,i,(o,c)=>{if(o)return a(o);s(c)})})}As.promise=e;function n(r,i,s){new t.Walker(r,i,s).start()}return As.callback=n,As}var su={},t0;function bB(){if(t0)return su;t0=1,Object.defineProperty(su,"__esModule",{value:!0}),su.sync=void 0;const t=ZS();function e(n,r){return new t.Walker(n,r).start()}return su.sync=e,su}var n0;function RB(){if(n0)return Jc;n0=1,Object.defineProperty(Jc,"__esModule",{value:!0}),Jc.APIBuilder=void 0;const t=wB(),e=bB();class n{root;options;constructor(i,s){this.root=i,this.options=s}withPromise(){return(0,t.promise)(this.root,this.options)}withCallback(i){(0,t.callback)(this.root,this.options,i)}sync(){return(0,e.sync)(this.root,this.options)}}return Jc.APIBuilder=n,Jc}var yy={},vy,r0;function Yf(){if(r0)return vy;r0=1;const t="\\\\/",e=`[^${t}]`,n="\\.",r="\\+",i="\\?",s="\\/",a="(?=.)",o="[^/]",c=`(?:${s}|$)`,u=`(?:^|${s})`,l=`${n}{1,2}${c}`,d=`(?!${n})`,f=`(?!${u}${l})`,h=`(?!${n}{0,1}${c})`,m=`(?!${l})`,y=`[^.${s}]`,R=`${o}*?`,k={DOT_LITERAL:n,PLUS_LITERAL:r,QMARK_LITERAL:i,SLASH_LITERAL:s,ONE_CHAR:a,QMARK:o,END_ANCHOR:c,DOTS_SLASH:l,NO_DOT:d,NO_DOTS:f,NO_DOT_SLASH:h,NO_DOTS_SLASH:m,QMARK_NO_DOT:y,STAR:R,START_ANCHOR:u,SEP:"/"},E={...k,SLASH_LITERAL:`[${t}]`,QMARK:e,STAR:`${e}*?`,DOTS_SLASH:`${n}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${n})`,NO_DOTS:`(?!(?:^|[${t}])${n}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${n}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`,SEP:"\\"},_={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 vy={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:_,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,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,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,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,extglobChars(C){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${C.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(C){return C===!0?E:k}},vy}var i0;function Jf(){return i0||(i0=1,function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=Yf();t.isObject=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),t.hasRegexChars=s=>r.test(s),t.isRegexChar=s=>s.length===1&&t.hasRegexChars(s),t.escapeRegex=s=>s.replace(i,"\\$1"),t.toPosixSlashes=s=>s.replace(e,"/"),t.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const s=navigator.platform.toLowerCase();return s==="win32"||s==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},t.removeBackslashes=s=>s.replace(n,a=>a==="\\"?"":a),t.escapeLast=(s,a,o)=>{const c=s.lastIndexOf(a,o);return c===-1?s:s[c-1]==="\\"?t.escapeLast(s,a,c-1):`${s.slice(0,c)}\\${s.slice(c)}`},t.removePrefix=(s,a={})=>{let o=s;return o.startsWith("./")&&(o=o.slice(2),a.prefix="./"),o},t.wrapOutput=(s,a={},o={})=>{const c=o.contains?"":"^",u=o.contains?"":"$";let l=`${c}(?:${s})${u}`;return a.negated===!0&&(l=`(?:^(?!${l}).*$)`),l},t.basename=(s,{windows:a}={})=>{const o=s.split(a?/[\\/]/:"/"),c=o[o.length-1];return c===""?o[o.length-2]:c}}(yy)),yy}var wy,s0;function $B(){if(s0)return wy;s0=1;const t=Jf(),{CHAR_ASTERISK:e,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:i,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:o,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:u,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:d,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:m,CHAR_RIGHT_SQUARE_BRACKET:y}=Yf(),R=E=>E===o||E===r,w=E=>{E.isPrefix!==!0&&(E.depth=E.isGlobstar?1/0:1)};return wy=(E,_)=>{const C=_||{},I=E.length-1,j=C.parts===!0||C.scanToEnd===!0,J=[],Z=[],oe=[];let L=E,S=-1,$=0,O=0,K=!1,W=!1,H=!1,$e=!1,te=!1,A=!1,me=!1,_e=!1,st=!1,B=!1,V=0,Oe,ce,be={value:"",depth:0,isGlob:!1};const Ae=()=>S>=I,ue=()=>L.charCodeAt(S+1),N=()=>(Oe=ce,L.charCodeAt(++S));for(;S<I;){ce=N();let qe;if(ce===r){me=be.backslashes=!0,ce=N(),ce===c&&(A=!0);continue}if(A===!0||ce===c){for(V++;Ae()!==!0&&(ce=N());){if(ce===r){me=be.backslashes=!0,N();continue}if(ce===c){V++;continue}if(A!==!0&&ce===s&&(ce=N())===s){if(K=be.isBrace=!0,H=be.isGlob=!0,B=!0,j===!0)continue;break}if(A!==!0&&ce===i){if(K=be.isBrace=!0,H=be.isGlob=!0,B=!0,j===!0)continue;break}if(ce===h&&(V--,V===0)){A=!1,K=be.isBrace=!0,B=!0;break}}if(j===!0)continue;break}if(ce===o){if(J.push(S),Z.push(be),be={value:"",depth:0,isGlob:!1},B===!0)continue;if(Oe===s&&S===$+1){$+=2;continue}O=S+1;continue}if(C.noext!==!0&&(ce===d||ce===n||ce===e||ce===f||ce===a)===!0&&ue()===u){if(H=be.isGlob=!0,$e=be.isExtglob=!0,B=!0,ce===a&&S===$&&(st=!0),j===!0){for(;Ae()!==!0&&(ce=N());){if(ce===r){me=be.backslashes=!0,ce=N();continue}if(ce===m){H=be.isGlob=!0,B=!0;break}}continue}break}if(ce===e){if(Oe===e&&(te=be.isGlobstar=!0),H=be.isGlob=!0,B=!0,j===!0)continue;break}if(ce===f){if(H=be.isGlob=!0,B=!0,j===!0)continue;break}if(ce===l){for(;Ae()!==!0&&(qe=N());){if(qe===r){me=be.backslashes=!0,N();continue}if(qe===y){W=be.isBracket=!0,H=be.isGlob=!0,B=!0;break}}if(j===!0)continue;break}if(C.nonegate!==!0&&ce===a&&S===$){_e=be.negated=!0,$++;continue}if(C.noparen!==!0&&ce===u){if(H=be.isGlob=!0,j===!0){for(;Ae()!==!0&&(ce=N());){if(ce===u){me=be.backslashes=!0,ce=N();continue}if(ce===m){B=!0;break}}continue}break}if(H===!0){if(B=!0,j===!0)continue;break}}C.noext===!0&&($e=!1,H=!1);let F=L,de="",q="";$>0&&(de=L.slice(0,$),L=L.slice($),O-=$),F&&H===!0&&O>0?(F=L.slice(0,O),q=L.slice(O)):H===!0?(F="",q=L):F=L,F&&F!==""&&F!=="/"&&F!==L&&R(F.charCodeAt(F.length-1))&&(F=F.slice(0,-1)),C.unescape===!0&&(q&&(q=t.removeBackslashes(q)),F&&me===!0&&(F=t.removeBackslashes(F)));const le={prefix:de,input:E,start:$,base:F,glob:q,isBrace:K,isBracket:W,isGlob:H,isExtglob:$e,isGlobstar:te,negated:_e,negatedExtglob:st};if(C.tokens===!0&&(le.maxDepth=0,R(ce)||Z.push(be),le.tokens=Z),C.parts===!0||C.tokens===!0){let qe;for(let Ze=0;Ze<J.length;Ze++){const ae=qe?qe+1:$,Pe=J[Ze],ne=E.slice(ae,Pe);C.tokens&&(Ze===0&&$!==0?(Z[Ze].isPrefix=!0,Z[Ze].value=de):Z[Ze].value=ne,w(Z[Ze]),le.maxDepth+=Z[Ze].depth),(Ze!==0||ne!=="")&&oe.push(ne),qe=Pe}if(qe&&qe+1<E.length){const Ze=E.slice(qe+1);oe.push(Ze),C.tokens&&(Z[Z.length-1].value=Ze,w(Z[Z.length-1]),le.maxDepth+=Z[Z.length-1].depth)}le.slashes=J,le.parts=oe}return le},wy}var by,a0;function kB(){if(a0)return by;a0=1;const t=Yf(),e=Jf(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=t,o=(l,d)=>{if(typeof d.expandRange=="function")return d.expandRange(...l,d);l.sort();const f=`[${l.join("-")}]`;try{new RegExp(f)}catch{return l.map(m=>e.escapeRegex(m)).join("..")}return f},c=(l,d)=>`Missing ${l}: "${d}" - use "\\\\${d}" to match literal characters`,u=(l,d)=>{if(typeof l!="string")throw new TypeError("Expected a string");l=a[l]||l;const f={...d},h=typeof f.maxLength=="number"?Math.min(n,f.maxLength):n;let m=l.length;if(m>h)throw new SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${h}`);const y={type:"bos",value:"",output:f.prepend||""},R=[y],w=f.capture?"":"?:",k=t.globChars(f.windows),E=t.extglobChars(k),{DOT_LITERAL:_,PLUS_LITERAL:C,SLASH_LITERAL:I,ONE_CHAR:j,DOTS_SLASH:J,NO_DOT:Z,NO_DOT_SLASH:oe,NO_DOTS_SLASH:L,QMARK:S,QMARK_NO_DOT:$,STAR:O,START_ANCHOR:K}=k,W=ae=>`(${w}(?:(?!${K}${ae.dot?J:_}).)*?)`,H=f.dot?"":Z,$e=f.dot?S:$;let te=f.bash===!0?W(f):O;f.capture&&(te=`(${te})`),typeof f.noext=="boolean"&&(f.noextglob=f.noext);const A={input:l,index:-1,start:0,dot:f.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:R};l=e.removePrefix(l,A),m=l.length;const me=[],_e=[],st=[];let B=y,V;const Oe=()=>A.index===m-1,ce=A.peek=(ae=1)=>l[A.index+ae],be=A.advance=()=>l[++A.index]||"",Ae=()=>l.slice(A.index+1),ue=(ae="",Pe=0)=>{A.consumed+=ae,A.index+=Pe},N=ae=>{A.output+=ae.output!=null?ae.output:ae.value,ue(ae.value)},F=()=>{let ae=1;for(;ce()==="!"&&(ce(2)!=="("||ce(3)==="?");)be(),A.start++,ae++;return ae%2===0?!1:(A.negated=!0,A.start++,!0)},de=ae=>{A[ae]++,st.push(ae)},q=ae=>{A[ae]--,st.pop()},le=ae=>{if(B.type==="globstar"){const Pe=A.braces>0&&(ae.type==="comma"||ae.type==="brace"),ne=ae.extglob===!0||me.length&&(ae.type==="pipe"||ae.type==="paren");ae.type!=="slash"&&ae.type!=="paren"&&!Pe&&!ne&&(A.output=A.output.slice(0,-B.output.length),B.type="star",B.value="*",B.output=te,A.output+=B.output)}if(me.length&&ae.type!=="paren"&&(me[me.length-1].inner+=ae.value),(ae.value||ae.output)&&N(ae),B&&B.type==="text"&&ae.type==="text"){B.output=(B.output||B.value)+ae.value,B.value+=ae.value;return}ae.prev=B,R.push(ae),B=ae},qe=(ae,Pe)=>{const ne={...E[Pe],conditions:1,inner:""};ne.prev=B,ne.parens=A.parens,ne.output=A.output;const Re=(f.capture?"(":"")+ne.open;de("parens"),le({type:ae,value:Pe,output:A.output?"":j}),le({type:"paren",extglob:!0,value:be(),output:Re}),me.push(ne)},Ze=ae=>{let Pe=ae.close+(f.capture?")":""),ne;if(ae.type==="negate"){let Re=te;if(ae.inner&&ae.inner.length>1&&ae.inner.includes("/")&&(Re=W(f)),(Re!==te||Oe()||/^\)+$/.test(Ae()))&&(Pe=ae.close=`)$))${Re}`),ae.inner.includes("*")&&(ne=Ae())&&/^\.[^\\/.]+$/.test(ne)){const Me=u(ne,{...d,fastpaths:!1}).output;Pe=ae.close=`)${Me})${Re})`}ae.prev.type==="bos"&&(A.negatedExtglob=!0)}le({type:"paren",extglob:!0,value:V,output:Pe}),q("parens")};if(f.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(l)){let ae=!1,Pe=l.replace(s,(ne,Re,Me,ht,Ve,zt)=>ht==="\\"?(ae=!0,ne):ht==="?"?Re?Re+ht+(Ve?S.repeat(Ve.length):""):zt===0?$e+(Ve?S.repeat(Ve.length):""):S.repeat(Me.length):ht==="."?_.repeat(Me.length):ht==="*"?Re?Re+ht+(Ve?te:""):te:Re?ne:`\\${ne}`);return ae===!0&&(f.unescape===!0?Pe=Pe.replace(/\\/g,""):Pe=Pe.replace(/\\+/g,ne=>ne.length%2===0?"\\\\":ne?"\\":"")),Pe===l&&f.contains===!0?(A.output=l,A):(A.output=e.wrapOutput(Pe,A,d),A)}for(;!Oe();){if(V=be(),V==="\0")continue;if(V==="\\"){const ne=ce();if(ne==="/"&&f.bash!==!0||ne==="."||ne===";")continue;if(!ne){V+="\\",le({type:"text",value:V});continue}const Re=/^\\+/.exec(Ae());let Me=0;if(Re&&Re[0].length>2&&(Me=Re[0].length,A.index+=Me,Me%2!==0&&(V+="\\")),f.unescape===!0?V=be():V+=be(),A.brackets===0){le({type:"text",value:V});continue}}if(A.brackets>0&&(V!=="]"||B.value==="["||B.value==="[^")){if(f.posix!==!1&&V===":"){const ne=B.value.slice(1);if(ne.includes("[")&&(B.posix=!0,ne.includes(":"))){const Re=B.value.lastIndexOf("["),Me=B.value.slice(0,Re),ht=B.value.slice(Re+2),Ve=r[ht];if(Ve){B.value=Me+Ve,A.backtrack=!0,be(),!y.output&&R.indexOf(B)===1&&(y.output=j);continue}}}(V==="["&&ce()!==":"||V==="-"&&ce()==="]")&&(V=`\\${V}`),V==="]"&&(B.value==="["||B.value==="[^")&&(V=`\\${V}`),f.posix===!0&&V==="!"&&B.value==="["&&(V="^"),B.value+=V,N({value:V});continue}if(A.quotes===1&&V!=='"'){V=e.escapeRegex(V),B.value+=V,N({value:V});continue}if(V==='"'){A.quotes=A.quotes===1?0:1,f.keepQuotes===!0&&le({type:"text",value:V});continue}if(V==="("){de("parens"),le({type:"paren",value:V});continue}if(V===")"){if(A.parens===0&&f.strictBrackets===!0)throw new SyntaxError(c("opening","("));const ne=me[me.length-1];if(ne&&A.parens===ne.parens+1){Ze(me.pop());continue}le({type:"paren",value:V,output:A.parens?")":"\\)"}),q("parens");continue}if(V==="["){if(f.nobracket===!0||!Ae().includes("]")){if(f.nobracket!==!0&&f.strictBrackets===!0)throw new SyntaxError(c("closing","]"));V=`\\${V}`}else de("brackets");le({type:"bracket",value:V});continue}if(V==="]"){if(f.nobracket===!0||B&&B.type==="bracket"&&B.value.length===1){le({type:"text",value:V,output:`\\${V}`});continue}if(A.brackets===0){if(f.strictBrackets===!0)throw new SyntaxError(c("opening","["));le({type:"text",value:V,output:`\\${V}`});continue}q("brackets");const ne=B.value.slice(1);if(B.posix!==!0&&ne[0]==="^"&&!ne.includes("/")&&(V=`/${V}`),B.value+=V,N({value:V}),f.literalBrackets===!1||e.hasRegexChars(ne))continue;const Re=e.escapeRegex(B.value);if(A.output=A.output.slice(0,-B.value.length),f.literalBrackets===!0){A.output+=Re,B.value=Re;continue}B.value=`(${w}${Re}|${B.value})`,A.output+=B.value;continue}if(V==="{"&&f.nobrace!==!0){de("braces");const ne={type:"brace",value:V,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};_e.push(ne),le(ne);continue}if(V==="}"){const ne=_e[_e.length-1];if(f.nobrace===!0||!ne){le({type:"text",value:V,output:V});continue}let Re=")";if(ne.dots===!0){const Me=R.slice(),ht=[];for(let Ve=Me.length-1;Ve>=0&&(R.pop(),Me[Ve].type!=="brace");Ve--)Me[Ve].type!=="dots"&&ht.unshift(Me[Ve].value);Re=o(ht,f),A.backtrack=!0}if(ne.comma!==!0&&ne.dots!==!0){const Me=A.output.slice(0,ne.outputIndex),ht=A.tokens.slice(ne.tokensIndex);ne.value=ne.output="\\{",V=Re="\\}",A.output=Me;for(const Ve of ht)A.output+=Ve.output||Ve.value}le({type:"brace",value:V,output:Re}),q("braces"),_e.pop();continue}if(V==="|"){me.length>0&&me[me.length-1].conditions++,le({type:"text",value:V});continue}if(V===","){let ne=V;const Re=_e[_e.length-1];Re&&st[st.length-1]==="braces"&&(Re.comma=!0,ne="|"),le({type:"comma",value:V,output:ne});continue}if(V==="/"){if(B.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",R.pop(),B=y;continue}le({type:"slash",value:V,output:I});continue}if(V==="."){if(A.braces>0&&B.type==="dot"){B.value==="."&&(B.output=_);const ne=_e[_e.length-1];B.type="dots",B.output+=V,B.value+=V,ne.dots=!0;continue}if(A.braces+A.parens===0&&B.type!=="bos"&&B.type!=="slash"){le({type:"text",value:V,output:_});continue}le({type:"dot",value:V,output:_});continue}if(V==="?"){if(!(B&&B.value==="(")&&f.noextglob!==!0&&ce()==="("&&ce(2)!=="?"){qe("qmark",V);continue}if(B&&B.type==="paren"){const Re=ce();let Me=V;(B.value==="("&&!/[!=<:]/.test(Re)||Re==="<"&&!/<([!=]|\w+>)/.test(Ae()))&&(Me=`\\${V}`),le({type:"text",value:V,output:Me});continue}if(f.dot!==!0&&(B.type==="slash"||B.type==="bos")){le({type:"qmark",value:V,output:$});continue}le({type:"qmark",value:V,output:S});continue}if(V==="!"){if(f.noextglob!==!0&&ce()==="("&&(ce(2)!=="?"||!/[!=<:]/.test(ce(3)))){qe("negate",V);continue}if(f.nonegate!==!0&&A.index===0){F();continue}}if(V==="+"){if(f.noextglob!==!0&&ce()==="("&&ce(2)!=="?"){qe("plus",V);continue}if(B&&B.value==="("||f.regex===!1){le({type:"plus",value:V,output:C});continue}if(B&&(B.type==="bracket"||B.type==="paren"||B.type==="brace")||A.parens>0){le({type:"plus",value:V});continue}le({type:"plus",value:C});continue}if(V==="@"){if(f.noextglob!==!0&&ce()==="("&&ce(2)!=="?"){le({type:"at",extglob:!0,value:V,output:""});continue}le({type:"text",value:V});continue}if(V!=="*"){(V==="$"||V==="^")&&(V=`\\${V}`);const ne=i.exec(Ae());ne&&(V+=ne[0],A.index+=ne[0].length),le({type:"text",value:V});continue}if(B&&(B.type==="globstar"||B.star===!0)){B.type="star",B.star=!0,B.value+=V,B.output=te,A.backtrack=!0,A.globstar=!0,ue(V);continue}let ae=Ae();if(f.noextglob!==!0&&/^\([^?]/.test(ae)){qe("star",V);continue}if(B.type==="star"){if(f.noglobstar===!0){ue(V);continue}const ne=B.prev,Re=ne.prev,Me=ne.type==="slash"||ne.type==="bos",ht=Re&&(Re.type==="star"||Re.type==="globstar");if(f.bash===!0&&(!Me||ae[0]&&ae[0]!=="/")){le({type:"star",value:V,output:""});continue}const Ve=A.braces>0&&(ne.type==="comma"||ne.type==="brace"),zt=me.length&&(ne.type==="pipe"||ne.type==="paren");if(!Me&&ne.type!=="paren"&&!Ve&&!zt){le({type:"star",value:V,output:""});continue}for(;ae.slice(0,3)==="/**";){const jt=l[A.index+4];if(jt&&jt!=="/")break;ae=ae.slice(3),ue("/**",3)}if(ne.type==="bos"&&Oe()){B.type="globstar",B.value+=V,B.output=W(f),A.output=B.output,A.globstar=!0,ue(V);continue}if(ne.type==="slash"&&ne.prev.type!=="bos"&&!ht&&Oe()){A.output=A.output.slice(0,-(ne.output+B.output).length),ne.output=`(?:${ne.output}`,B.type="globstar",B.output=W(f)+(f.strictSlashes?")":"|$)"),B.value+=V,A.globstar=!0,A.output+=ne.output+B.output,ue(V);continue}if(ne.type==="slash"&&ne.prev.type!=="bos"&&ae[0]==="/"){const jt=ae[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(ne.output+B.output).length),ne.output=`(?:${ne.output}`,B.type="globstar",B.output=`${W(f)}${I}|${I}${jt})`,B.value+=V,A.output+=ne.output+B.output,A.globstar=!0,ue(V+be()),le({type:"slash",value:"/",output:""});continue}if(ne.type==="bos"&&ae[0]==="/"){B.type="globstar",B.value+=V,B.output=`(?:^|${I}|${W(f)}${I})`,A.output=B.output,A.globstar=!0,ue(V+be()),le({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-B.output.length),B.type="globstar",B.output=W(f),B.value+=V,A.output+=B.output,A.globstar=!0,ue(V);continue}const Pe={type:"star",value:V,output:te};if(f.bash===!0){Pe.output=".*?",(B.type==="bos"||B.type==="slash")&&(Pe.output=H+Pe.output),le(Pe);continue}if(B&&(B.type==="bracket"||B.type==="paren")&&f.regex===!0){Pe.output=V,le(Pe);continue}(A.index===A.start||B.type==="slash"||B.type==="dot")&&(B.type==="dot"?(A.output+=oe,B.output+=oe):f.dot===!0?(A.output+=L,B.output+=L):(A.output+=H,B.output+=H),ce()!=="*"&&(A.output+=j,B.output+=j)),le(Pe)}for(;A.brackets>0;){if(f.strictBrackets===!0)throw new SyntaxError(c("closing","]"));A.output=e.escapeLast(A.output,"["),q("brackets")}for(;A.parens>0;){if(f.strictBrackets===!0)throw new SyntaxError(c("closing",")"));A.output=e.escapeLast(A.output,"("),q("parens")}for(;A.braces>0;){if(f.strictBrackets===!0)throw new SyntaxError(c("closing","}"));A.output=e.escapeLast(A.output,"{"),q("braces")}if(f.strictSlashes!==!0&&(B.type==="star"||B.type==="bracket")&&le({type:"maybe_slash",value:"",output:`${I}?`}),A.backtrack===!0){A.output="";for(const ae of A.tokens)A.output+=ae.output!=null?ae.output:ae.value,ae.suffix&&(A.output+=ae.suffix)}return A};return u.fastpaths=(l,d)=>{const f={...d},h=typeof f.maxLength=="number"?Math.min(n,f.maxLength):n,m=l.length;if(m>h)throw new SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${h}`);l=a[l]||l;const{DOT_LITERAL:y,SLASH_LITERAL:R,ONE_CHAR:w,DOTS_SLASH:k,NO_DOT:E,NO_DOTS:_,NO_DOTS_SLASH:C,STAR:I,START_ANCHOR:j}=t.globChars(f.windows),J=f.dot?_:E,Z=f.dot?C:E,oe=f.capture?"":"?:",L={negated:!1,prefix:""};let S=f.bash===!0?".*?":I;f.capture&&(S=`(${S})`);const $=H=>H.noglobstar===!0?S:`(${oe}(?:(?!${j}${H.dot?k:y}).)*?)`,O=H=>{switch(H){case"*":return`${J}${w}${S}`;case".*":return`${y}${w}${S}`;case"*.*":return`${J}${S}${y}${w}${S}`;case"*/*":return`${J}${S}${R}${w}${Z}${S}`;case"**":return J+$(f);case"**/*":return`(?:${J}${$(f)}${R})?${Z}${w}${S}`;case"**/*.*":return`(?:${J}${$(f)}${R})?${Z}${S}${y}${w}${S}`;case"**/.*":return`(?:${J}${$(f)}${R})?${y}${w}${S}`;default:{const $e=/^(.*?)\.(\w+)$/.exec(H);if(!$e)return;const te=O($e[1]);return te?te+y+$e[2]:void 0}}},K=e.removePrefix(l,L);let W=O(K);return W&&f.strictSlashes!==!0&&(W+=`${R}?`),W},by=u,by}var Ry,o0;function TB(){if(o0)return Ry;o0=1;const t=$B(),e=kB(),n=Jf(),r=Yf(),i=a=>a&&typeof a=="object"&&!Array.isArray(a),s=(a,o,c=!1)=>{if(Array.isArray(a)){const R=a.map(k=>s(k,o,c));return k=>{for(const E of R){const _=E(k);if(_)return _}return!1}}const u=i(a)&&a.tokens&&a.input;if(a===""||typeof a!="string"&&!u)throw new TypeError("Expected pattern to be a non-empty string");const l=o||{},d=l.windows,f=u?s.compileRe(a,o):s.makeRe(a,o,!1,!0),h=f.state;delete f.state;let m=()=>!1;if(l.ignore){const R={...o,ignore:null,onMatch:null,onResult:null};m=s(l.ignore,R,c)}const y=(R,w=!1)=>{const{isMatch:k,match:E,output:_}=s.test(R,f,o,{glob:a,posix:d}),C={glob:a,state:h,regex:f,posix:d,input:R,output:_,match:E,isMatch:k};return typeof l.onResult=="function"&&l.onResult(C),k===!1?(C.isMatch=!1,w?C:!1):m(R)?(typeof l.onIgnore=="function"&&l.onIgnore(C),C.isMatch=!1,w?C:!1):(typeof l.onMatch=="function"&&l.onMatch(C),w?C:!0)};return c&&(y.state=h),y};return s.test=(a,o,c,{glob:u,posix:l}={})=>{if(typeof a!="string")throw new TypeError("Expected input to be a string");if(a==="")return{isMatch:!1,output:""};const d=c||{},f=d.format||(l?n.toPosixSlashes:null);let h=a===u,m=h&&f?f(a):a;return h===!1&&(m=f?f(a):a,h=m===u),(h===!1||d.capture===!0)&&(d.matchBase===!0||d.basename===!0?h=s.matchBase(a,o,c,l):h=o.exec(m)),{isMatch:!!h,match:h,output:m}},s.matchBase=(a,o,c)=>(o instanceof RegExp?o:s.makeRe(o,c)).test(n.basename(a)),s.isMatch=(a,o,c)=>s(o,c)(a),s.parse=(a,o)=>Array.isArray(a)?a.map(c=>s.parse(c,o)):e(a,{...o,fastpaths:!1}),s.scan=(a,o)=>t(a,o),s.compileRe=(a,o,c=!1,u=!1)=>{if(c===!0)return a.output;const l=o||{},d=l.contains?"":"^",f=l.contains?"":"$";let h=`${d}(?:${a.output})${f}`;a&&a.negated===!0&&(h=`^(?!${h}).*$`);const m=s.toRegex(h,o);return u===!0&&(m.state=a),m},s.makeRe=(a,o={},c=!1,u=!1)=>{if(!a||typeof a!="string")throw new TypeError("Expected a non-empty string");let l={negated:!1,fastpaths:!0};return o.fastpaths!==!1&&(a[0]==="."||a[0]==="*")&&(l.output=e.fastpaths(a,o)),l.output||(l=e(a,o)),s.compileRe(l,o,c,u)},s.toRegex=(a,o)=>{try{const c=o||{};return new RegExp(a,c.flags||(c.nocase?"i":""))}catch(c){if(o&&o.debug===!0)throw c;return/$^/}},s.constants=r,Ry=s,Ry}var $y,c0;function EB(){if(c0)return $y;c0=1;const t=TB(),e=Jf();function n(r,i,s=!1){return i&&(i.windows===null||i.windows===void 0)&&(i={...i,windows:e.isWindows()}),t(r,i,s)}return Object.assign(n,t),$y=n,$y}var u0;function SB(){if(u0)return Yc;u0=1,Object.defineProperty(Yc,"__esModule",{value:!0}),Yc.Builder=void 0;const t=hi,e=RB();var n=null;try{require.resolve("picomatch"),n=EB()}catch{}class r{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:t.sep,filters:[]};globFunction;constructor(s){this.options={...this.options,...s},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(s){return this.options.pathSeparator=s,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(s){return this.options.maxDepth=s,this}withMaxFiles(s){return this.options.maxFiles=s,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:s=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=s,this.withFullPaths()}withAbortSignal(s){return this.options.signal=s,this}normalize(){return this.options.normalizePath=!0,this}filter(s){return this.options.filters.push(s),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(s){return this.options.exclude=s,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(s){return new e.APIBuilder(s||".",this.options)}withGlobFunction(s){return this.globFunction=s,this}crawlWithOptions(s,a){return this.options={...this.options,...a},new e.APIBuilder(s||".",this.options)}glob(...s){return this.globFunction?this.globWithOptions(s):this.globWithOptions(s,{dot:!0})}globWithOptions(s,...a){const o=this.globFunction||n;if(!o)throw new Error("Please specify a glob function to use glob matching.");var c=this.globCache[s.join("\0")];return c||(c=o(s,...a),this.globCache[s.join("\0")]=c),this.options.filters.push(u=>c(u)),this}}return Yc.Builder=r,Yc}var ky={},l0;function _B(){return l0||(l0=1,Object.defineProperty(ky,"__esModule",{value:!0})),ky}var d0;function AB(){return d0||(d0=1,function(t){var e=_s&&_s.__createBinding||(Object.create?function(i,s,a,o){o===void 0&&(o=a);var c=Object.getOwnPropertyDescriptor(s,a);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[a]}}),Object.defineProperty(i,o,c)}:function(i,s,a,o){o===void 0&&(o=a),i[o]=s[a]}),n=_s&&_s.__exportStar||function(i,s){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(s,a)&&e(s,i,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.fdir=void 0;const r=SB();Object.defineProperty(t,"fdir",{enumerable:!0,get:function(){return r.Builder}}),n(_B(),t)}(_s)),_s}var CB=AB();class PB{constructor(){this.encoding="utf-8"}readFile(e){return cw.promises.readFile(e.fsPath,this.encoding)}async readDirectory(e){return(await cw.promises.readdir(e.fsPath,{withFileTypes:!0})).map(r=>({dirent:r,isFile:r.isFile(),isDirectory:r.isDirectory(),uri:Tt.joinPath(e,r.name)}))}}const Ty="DeploymentElement";function f0(t){return U.isInstance(t,Ty)}const Ey="DeploymentNodeOrElementKind",Qf="DeploymentViewRule";function xB(t){return U.isInstance(t,Qf)}const au="DynamicViewRule";function Zf(t){return U.isInstance(t,au)}const ou="ElementExpression";function Sy(t){return U.isInstance(t,ou)}const eh="ElementPredicate";function NB(t){return U.isInstance(t,eh)}const th="ElementPredicateOrWhere";function DB(t){return U.isInstance(t,th)}const nh="ElementPredicateOrWhereV2";function IB(t){return U.isInstance(t,nh)}const xs="ElementProperty";function OB(t){return U.isInstance(t,xs)}const _y="ExpressionV2";function LB(t){return U.isInstance(t,_y)}const Ay="ExtendElementProperty",cu="FqnExpr";function MB(t){return U.isInstance(t,cu)}const Cy="FqnReferenceable",Ns="LikeC4View";function Py(t){return U.isInstance(t,Ns)}const rh="MetadataProperty";function Ds(t){return U.isInstance(t,rh)}const xy="Predicate";function zB(t){return U.isInstance(t,xy)}const uu="Referenceable",ih="RelationExpr";function h0(t){return U.isInstance(t,ih)}const sh="RelationExpression";function Ny(t){return U.isInstance(t,sh)}const ah="RelationPredicate";function FB(t){return U.isInstance(t,ah)}const oh="RelationPredicateOrWhere";function qB(t){return U.isInstance(t,oh)}const ch="RelationPredicateOrWhereV2";function GB(t){return U.isInstance(t,ch)}const lu="RelationProperty",uh="RelationshipStyleProperty";function p0(t){return U.isInstance(t,uh)}const Dy="SizeProperty";function jB(t){return U.isInstance(t,Dy)}const ka="StringProperty";function m0(t){return U.isInstance(t,ka)}const Ta="StyleProperty";function Iy(t){return U.isInstance(t,Ta)}const lh="ViewProperty";function BB(t){return U.isInstance(t,lh)}const du="ViewRule";function UB(t){return U.isInstance(t,du)}const dh="ViewRulePredicate";function fh(t){return U.isInstance(t,dh)}const hh="ViewRuleStyleOrGlobalRef";function Oy(t){return U.isInstance(t,hh)}const fu="WhereElement";function g0(t){return U.isInstance(t,fu)}const hu="WhereElementExpression";function WB(t){return U.isInstance(t,hu)}const y0="WhereExpression",ph="WhereKindEqual";function HB(t){return U.isInstance(t,ph)}const pu="WhereRelation";function v0(t){return U.isInstance(t,pu)}const mu="WhereRelationExpression";function KB(t){return U.isInstance(t,mu)}const mh="WhereTagEqual";function VB(t){return U.isInstance(t,mh)}const gu="ArrowProperty";function yu(t){return U.isInstance(t,gu)}const vu="BorderProperty";function gh(t){return U.isInstance(t,vu)}const wu="ColorProperty";function Is(t){return U.isInstance(t,wu)}const Os="CustomColor",yh="CustomElementProperties";function XB(t){return U.isInstance(t,yh)}const vh="CustomRelationProperties";function YB(t){return U.isInstance(t,vh)}const Ai="DeployedInstance";function ur(t){return U.isInstance(t,Ai)}const wh="DeployedInstanceBody";function JB(t){return U.isInstance(t,wh)}const Ci="DeploymentNode";function vn(t){return U.isInstance(t,Ci)}const bh="DeploymentNodeBody";function QB(t){return U.isInstance(t,bh)}const Pi="DeploymentNodeKind",Rh="DeploymentRelation";function xi(t){return U.isInstance(t,Rh)}const $h="DeploymentRelationBody";function ZB(t){return U.isInstance(t,$h)}const bu="DeploymentView";function Ly(t){return U.isInstance(t,bu)}const kh="DeploymentViewBody";function eU(t){return U.isInstance(t,kh)}const Ru="DeploymentViewRulePredicate";function Ea(t){return U.isInstance(t,Ru)}const Th="DeploymentViewRulePredicateExpression";function tU(t){return U.isInstance(t,Th)}const $u="DeploymentViewRuleStyle";function w0(t){return U.isInstance(t,$u)}const ku="DirectedRelationExpr";function My(t){return U.isInstance(t,ku)}const Tu="DirectedRelationExpression";function zy(t){return U.isInstance(t,Tu)}const Sa="DynamicView";function b0(t){return U.isInstance(t,Sa)}const Eh="DynamicViewBody";function nU(t){return U.isInstance(t,Eh)}const Eu="DynamicViewGlobalPredicateRef";function R0(t){return U.isInstance(t,Eu)}const Su="DynamicViewIncludePredicate";function rU(t){return U.isInstance(t,Su)}const Sh="DynamicViewParallelSteps";function Fy(t){return U.isInstance(t,Sh)}const _h="DynamicViewPredicateIterator";function $0(t){return U.isInstance(t,_h)}const qy="DynamicViewRef",Ah="DynamicViewStep";function Gy(t){return U.isInstance(t,Ah)}const Vn="Element";function Ln(t){return U.isInstance(t,Vn)}const Ch="ElementBody";function _u(t){return U.isInstance(t,Ch)}const Au="ElementDescedantsExpression";function jy(t){return U.isInstance(t,Au)}const Ph="ElementExpressionsIterator";function iU(t){return U.isInstance(t,Ph)}const ai="ElementKind";function sU(t){return U.isInstance(t,ai)}const Cu="ElementKindExpression";function xh(t){return U.isInstance(t,Cu)}const Pu="ElementPredicateWhere";function By(t){return U.isInstance(t,Pu)}const xu="ElementPredicateWhereV2";function aU(t){return U.isInstance(t,xu)}const Nu="ElementPredicateWith";function Nh(t){return U.isInstance(t,Nu)}const Du="ElementRef";function Iu(t){return U.isInstance(t,Du)}const Ou="ElementStringProperty";function Lu(t){return U.isInstance(t,Ou)}const Mu="ElementStyleProperty";function Ni(t){return U.isInstance(t,Mu)}const zu="ElementTagExpression";function Dh(t){return U.isInstance(t,zu)}const _a="ElementView";function Ih(t){return U.isInstance(t,_a)}const Oh="ElementViewBody";function k0(t){return U.isInstance(t,Oh)}const Uy="ElementViewRef",Fu="ExcludePredicate";function qu(t){return U.isInstance(t,Fu)}const Gu="ExpandElementExpression";function T0(t){return U.isInstance(t,Gu)}const Ls="ExtendElement";function Aa(t){return U.isInstance(t,Ls)}const Lh="ExtendElementBody";function E0(t){return U.isInstance(t,Lh)}const Mh="FqnExpressions";function oU(t){return U.isInstance(t,Mh)}const zh="FqnRef";function S0(t){return U.isInstance(t,zh)}const ju="FqnRefExpr";function Wy(t){return U.isInstance(t,ju)}const Ca="GlobalDynamicPredicateGroup";function Bu(t){return U.isInstance(t,Ca)}const Pa="GlobalPredicateGroup";function Uu(t){return U.isInstance(t,Pa)}const xa="Globals";function Hy(t){return U.isInstance(t,xa)}const Fh="GlobalStyle";function Na(t){return U.isInstance(t,Fh)}const qh="GlobalStyleGroup";function Ms(t){return U.isInstance(t,qh)}const Wu="GlobalStyleId",Hu="IconProperty";function Cr(t){return U.isInstance(t,Hu)}const Ku="IncludePredicate";function Gh(t){return U.isInstance(t,Ku)}const Vu="IncomingRelationExpr";function Ky(t){return U.isInstance(t,Vu)}const Xu="IncomingRelationExpression";function _0(t){return U.isInstance(t,Xu)}const Yu="InOutRelationExpr";function A0(t){return U.isInstance(t,Yu)}const Ju="InOutRelationExpression";function Vy(t){return U.isInstance(t,Ju)}const zs="LibIcon";function cU(t){return U.isInstance(t,zs)}const jh="LikeC4Grammar";function uU(t){return U.isInstance(t,jh)}const Bh="LikeC4Lib";function C0(t){return U.isInstance(t,Bh)}const Qu="LineProperty";function Zu(t){return U.isInstance(t,Qu)}const el="LinkProperty";function Uh(t){return U.isInstance(t,el)}const tl="MetadataAttribute";function lU(t){return U.isInstance(t,tl)}const nl="MetadataBody";function dU(t){return U.isInstance(t,nl)}const Da="Model";function P0(t){return U.isInstance(t,Da)}const Ia="ModelDeployments";function x0(t){return U.isInstance(t,Ia)}const Oa="ModelViews";function rl(t){return U.isInstance(t,Oa)}const il="MultipleProperty";function Xy(t){return U.isInstance(t,il)}const Wh="NavigateToProperty";function Hh(t){return U.isInstance(t,Wh)}const sl="NotationProperty";function La(t){return U.isInstance(t,sl)}const al="NotesProperty";function N0(t){return U.isInstance(t,al)}const ol="OpacityProperty";function Kh(t){return U.isInstance(t,ol)}const cl="OutgoingRelationExpr";function Yy(t){return U.isInstance(t,cl)}const ul="OutgoingRelationExpression";function Jy(t){return U.isInstance(t,ul)}const ll="PaddingSizeProperty";function Qy(t){return U.isInstance(t,ll)}const Vh="Predicates";function D0(t){return U.isInstance(t,Vh)}const Xh="Relation";function Pr(t){return U.isInstance(t,Xh)}const Yh="RelationBody";function fU(t){return U.isInstance(t,Yh)}const dl="RelationNavigateToProperty";function fl(t){return U.isInstance(t,dl)}const hl="RelationPredicateWhere";function Zy(t){return U.isInstance(t,hl)}const pl="RelationPredicateWhereV2";function hU(t){return U.isInstance(t,pl)}const ml="RelationPredicateWith";function ev(t){return U.isInstance(t,ml)}const Di="RelationshipKind";function pU(t){return U.isInstance(t,Di)}const gl="RelationStringProperty";function yl(t){return U.isInstance(t,gl)}const vl="RelationStyleProperty";function Jh(t){return U.isInstance(t,vl)}const wl="ShapeProperty";function Qh(t){return U.isInstance(t,wl)}const bl="ShapeSizeProperty";function tv(t){return U.isInstance(t,bl)}const Zh="SpecificationColor";function ep(t){return U.isInstance(t,Zh)}const Ma="SpecificationDeploymentNodeKind";function za(t){return U.isInstance(t,Ma)}const Fa="SpecificationElementKind";function qa(t){return U.isInstance(t,Fa)}const Rl="SpecificationElementStringProperty";function nv(t){return U.isInstance(t,Rl)}const Ga="SpecificationRelationshipKind";function ja(t){return U.isInstance(t,Ga)}const $l="SpecificationRelationshipStringProperty";function I0(t){return U.isInstance(t,$l)}const Ba="SpecificationRule";function rv(t){return U.isInstance(t,Ba)}const Ua="SpecificationTag";function tp(t){return U.isInstance(t,Ua)}const np="StrictFqnElementRef";function O0(t){return U.isInstance(t,np)}const Ii="Tag";function L0(t){return U.isInstance(t,Ii)}const rp="Tags";function iv(t){return U.isInstance(t,rp)}const kl="TextSizeProperty";function sv(t){return U.isInstance(t,kl)}const av="ViewRef",Tl="ViewRuleAutoLayout";function El(t){return U.isInstance(t,Tl)}const Sl="ViewRuleGlobalPredicateRef";function ov(t){return U.isInstance(t,Sl)}const _l="ViewRuleGlobalStyle";function cv(t){return U.isInstance(t,_l)}const Al="ViewRuleGroup";function ip(t){return U.isInstance(t,Al)}const Cl="ViewRuleStyle";function Pl(t){return U.isInstance(t,Cl)}const xl="ViewStringProperty";function mU(t){return U.isInstance(t,xl)}const Nl="WhereBinaryExpression";function gU(t){return U.isInstance(t,Nl)}const Dl="WhereElementKind";function yU(t){return U.isInstance(t,Dl)}const Il="WhereElementNegation";function M0(t){return U.isInstance(t,Il)}const Ol="WhereElementTag";function vU(t){return U.isInstance(t,Ol)}const Ll="WhereRelationKind";function z0(t){return U.isInstance(t,Ll)}const Ml="WhereRelationNegation";function F0(t){return U.isInstance(t,Ml)}const zl="WhereRelationParticipantKind";function q0(t){return U.isInstance(t,zl)}const Fl="WhereRelationParticipantTag";function G0(t){return U.isInstance(t,Fl)}const ql="WhereRelationTag";function wU(t){return U.isInstance(t,ql)}const Gl="WildcardExpression";function Fs(t){return U.isInstance(t,Gl)}class j0 extends ab{getAllTypes(){return[gu,vu,wu,Os,yh,vh,Ai,wh,Ty,Ci,bh,Pi,Ey,Rh,$h,bu,kh,Qf,Ru,Th,$u,ku,Tu,Sa,Eh,Eu,Su,Sh,_h,qy,au,Ah,Vn,Ch,Au,ou,Ph,ai,Cu,eh,th,nh,Pu,xu,Nu,xs,Du,Ou,Mu,zu,_a,Oh,Uy,Fu,Gu,_y,Ls,Lh,Ay,cu,Mh,zh,ju,Cy,Ca,Pa,Fh,qh,Wu,xa,Hu,Yu,Ju,Ku,Vu,Xu,zs,jh,Bh,Ns,Qu,el,tl,nl,rh,Da,Ia,Oa,il,Wh,sl,al,ol,cl,ul,ll,xy,Vh,uu,Xh,Yh,ih,sh,dl,ah,oh,ch,hl,pl,ml,lu,gl,vl,Di,uh,wl,bl,Dy,Zh,Ma,Fa,Rl,Ga,$l,Ba,Ua,np,ka,Ta,Ii,rp,kl,lh,av,du,Tl,Sl,_l,Al,dh,Cl,hh,xl,Nl,fu,hu,Dl,Il,Ol,y0,ph,pu,mu,Ll,Ml,zl,Fl,ql,mh,Gl]}computeIsSubtype(e,n){switch(e){case gu:case Qu:return this.isSubtype(uh,n);case vu:case il:case ol:case wl:return this.isSubtype(Ta,n);case wu:return this.isSubtype(uh,n)||this.isSubtype(Ta,n);case Ai:case Ci:return this.isSubtype(Ty,n)||this.isSubtype(uu,n);case Pi:case ai:return this.isSubtype(Ey,n);case bu:case Sa:case _a:return this.isSubtype(Ns,n);case Ru:case $u:return this.isSubtype(Qf,n);case ku:case Vu:case Yu:case cl:return this.isSubtype(ih,n);case Tu:case Xu:case Ju:case ul:return this.isSubtype(sh,n);case Eu:case Su:return this.isSubtype(au,n);case Vn:return this.isSubtype(Cy,n)||this.isSubtype(uu,n);case Au:case Cu:case Du:case zu:case Gu:return this.isSubtype(ou,n);case ou:case Pu:return this.isSubtype(th,n);case eh:case ah:return this.isSubtype(xy,n);case th:case Nu:return this.isSubtype(eh,n);case nh:case ch:return this.isSubtype(_y,n);case xu:case cu:return this.isSubtype(nh,n);case Ou:return this.isSubtype(xs,n)||this.isSubtype(ka,n);case Mu:return this.isSubtype(xs,n);case Fu:case Ku:return this.isSubtype(dh,n);case Ls:case uu:return this.isSubtype(Cy,n);case ju:return this.isSubtype(cu,n);case Hu:return this.isSubtype(xs,n)||this.isSubtype(Ta,n);case el:return this.isSubtype(xs,n)||this.isSubtype(Ay,n)||this.isSubtype(lu,n)||this.isSubtype(lh,n);case tl:case sl:case al:case Rl:case $l:return this.isSubtype(ka,n);case nl:return this.isSubtype(rh,n);case rh:return this.isSubtype(xs,n)||this.isSubtype(Ay,n)||this.isSubtype(lu,n);case ll:case bl:case kl:return this.isSubtype(Dy,n)||this.isSubtype(Ta,n);case ih:case pl:return this.isSubtype(ch,n);case sh:case hl:return this.isSubtype(oh,n);case dl:case vl:return this.isSubtype(lu,n);case oh:case ml:return this.isSubtype(ah,n);case gl:return this.isSubtype(lu,n)||this.isSubtype(ka,n);case Tl:return this.isSubtype(Qf,n)||this.isSubtype(au,n)||this.isSubtype(du,n);case Sl:case Al:case dh:return this.isSubtype(du,n);case _l:case Cl:return this.isSubtype(hh,n);case hh:return this.isSubtype(au,n)||this.isSubtype(du,n);case xl:return this.isSubtype(ka,n)||this.isSubtype(lh,n);case Nl:return this.isSubtype(hu,n)||this.isSubtype(mu,n);case fu:case Il:return this.isSubtype(hu,n);case hu:case mu:return this.isSubtype(y0,n);case Dl:return this.isSubtype(fu,n)||this.isSubtype(ph,n);case Ol:return this.isSubtype(fu,n)||this.isSubtype(mh,n);case pu:case Ml:return this.isSubtype(mu,n);case Ll:case zl:return this.isSubtype(ph,n)||this.isSubtype(pu,n);case Fl:case ql:return this.isSubtype(pu,n)||this.isSubtype(mh,n);case Gl:return this.isSubtype(ou,n)||this.isSubtype(cu,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"ColorProperty:customColor":return Os;case"DeploymentNode:kind":return Pi;case"DeploymentRelation:kind":case"DynamicViewStep:kind":case"OutgoingRelationExpr:kind":case"OutgoingRelationExpression:kind":case"Relation:kind":case"WhereRelationKind:value":return Di;case"DynamicViewGlobalPredicateRef:predicate":return Ca;case"DynamicViewRef:view":return Sa;case"Element:kind":case"ElementKindExpression:kind":return ai;case"ElementRef:el":case"StrictFqnElementRef:el":return Vn;case"ElementTagExpression:tag":case"Tags:values":case"WhereElementTag:value":case"WhereRelationParticipantTag:value":case"WhereRelationTag:value":return Ii;case"ElementViewRef:view":return _a;case"FqnRef:value":return uu;case"IconProperty:libicon":return zs;case"ViewRef:view":return Ns;case"ViewRuleGlobalPredicateRef:predicate":return Pa;case"ViewRuleGlobalStyle:style":return Wu;case"WhereElementKind:value":case"WhereRelationParticipantKind:value":return Ey;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case gu:return{name:gu,properties:[{name:"key"},{name:"value"}]};case vu:return{name:vu,properties:[{name:"key"},{name:"value"}]};case wu:return{name:wu,properties:[{name:"customColor"},{name:"key"},{name:"themeColor"}]};case Os:return{name:Os,properties:[{name:"name"}]};case yh:return{name:yh,properties:[{name:"props",defaultValue:[]}]};case vh:return{name:vh,properties:[{name:"props",defaultValue:[]}]};case Ai:return{name:Ai,properties:[{name:"body"},{name:"element"},{name:"name"},{name:"title"}]};case wh:return{name:wh,properties:[{name:"props",defaultValue:[]},{name:"tags"}]};case Ci:return{name:Ci,properties:[{name:"body"},{name:"kind"},{name:"name"},{name:"title"}]};case bh:return{name:bh,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case Pi:return{name:Pi,properties:[{name:"name"}]};case Rh:return{name:Rh,properties:[{name:"body"},{name:"kind"},{name:"source"},{name:"tags"},{name:"target"},{name:"technology"},{name:"title"}]};case $h:return{name:$h,properties:[{name:"props",defaultValue:[]},{name:"tags"}]};case bu:return{name:bu,properties:[{name:"body"},{name:"name"}]};case kh:return{name:kh,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"tags"}]};case Ru:return{name:Ru,properties:[{name:"expr"},{name:"isInclude",defaultValue:!1}]};case Th:return{name:Th,properties:[{name:"prev"},{name:"value"}]};case $u:return{name:$u,properties:[{name:"props",defaultValue:[]},{name:"targets"}]};case ku:return{name:ku,properties:[{name:"source"},{name:"target"}]};case Tu:return{name:Tu,properties:[{name:"source"},{name:"target"}]};case Sa:return{name:Sa,properties:[{name:"body"},{name:"name"}]};case Eh:return{name:Eh,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"steps",defaultValue:[]},{name:"tags"}]};case Eu:return{name:Eu,properties:[{name:"predicate"}]};case Su:return{name:Su,properties:[{name:"predicates"}]};case Sh:return{name:Sh,properties:[{name:"steps",defaultValue:[]}]};case _h:return{name:_h,properties:[{name:"prev"},{name:"value"}]};case qy:return{name:qy,properties:[{name:"view"}]};case Ah:return{name:Ah,properties:[{name:"custom"},{name:"isBackward",defaultValue:!1},{name:"kind"},{name:"source"},{name:"target"},{name:"title"}]};case Vn:return{name:Vn,properties:[{name:"body"},{name:"kind"},{name:"name"},{name:"props",defaultValue:[]}]};case Ch:return{name:Ch,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case Au:return{name:Au,properties:[{name:"parent"},{name:"suffix"}]};case Ph:return{name:Ph,properties:[{name:"prev"},{name:"value"}]};case ai:return{name:ai,properties:[{name:"name"}]};case Cu:return{name:Cu,properties:[{name:"isEqual",defaultValue:!1},{name:"kind"}]};case Pu:return{name:Pu,properties:[{name:"subject"},{name:"where"}]};case xu:return{name:xu,properties:[{name:"subject"},{name:"where"}]};case Nu:return{name:Nu,properties:[{name:"custom"},{name:"subject"}]};case Du:return{name:Du,properties:[{name:"el"},{name:"parent"}]};case Ou:return{name:Ou,properties:[{name:"key"},{name:"value"}]};case Mu:return{name:Mu,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case zu:return{name:zu,properties:[{name:"isEqual",defaultValue:!1},{name:"tag"}]};case _a:return{name:_a,properties:[{name:"body"},{name:"extends"},{name:"name"},{name:"viewOf"}]};case Oh:return{name:Oh,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"tags"}]};case Uy:return{name:Uy,properties:[{name:"view"}]};case Fu:return{name:Fu,properties:[{name:"predicates"}]};case Gu:return{name:Gu,properties:[{name:"expand"}]};case Ls:return{name:Ls,properties:[{name:"body"},{name:"element"}]};case Lh:return{name:Lh,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case Mh:return{name:Mh,properties:[{name:"prev"},{name:"value"}]};case zh:return{name:zh,properties:[{name:"parent"},{name:"value"}]};case ju:return{name:ju,properties:[{name:"ref"},{name:"selector"}]};case Ca:return{name:Ca,properties:[{name:"name"},{name:"predicates",defaultValue:[]}]};case Pa:return{name:Pa,properties:[{name:"name"},{name:"predicates",defaultValue:[]}]};case xa:return{name:xa,properties:[{name:"name"},{name:"predicates",defaultValue:[]},{name:"styles",defaultValue:[]}]};case Fh:return{name:Fh,properties:[{name:"id"},{name:"props",defaultValue:[]},{name:"target"}]};case qh:return{name:qh,properties:[{name:"id"},{name:"styles",defaultValue:[]}]};case Wu:return{name:Wu,properties:[{name:"name"}]};case Hu:return{name:Hu,properties:[{name:"key"},{name:"libicon"},{name:"value"}]};case Ku:return{name:Ku,properties:[{name:"predicates"}]};case Vu:return{name:Vu,properties:[{name:"to"}]};case Xu:return{name:Xu,properties:[{name:"to"}]};case Yu:return{name:Yu,properties:[{name:"inout"}]};case Ju:return{name:Ju,properties:[{name:"inout"}]};case zs:return{name:zs,properties:[{name:"name"}]};case jh:return{name:jh,properties:[{name:"deployments",defaultValue:[]},{name:"globals",defaultValue:[]},{name:"likec4lib",defaultValue:[]},{name:"models",defaultValue:[]},{name:"specifications",defaultValue:[]},{name:"views",defaultValue:[]}]};case Bh:return{name:Bh,properties:[{name:"icons",defaultValue:[]}]};case Qu:return{name:Qu,properties:[{name:"key"},{name:"value"}]};case el:return{name:el,properties:[{name:"key"},{name:"title"},{name:"value"}]};case tl:return{name:tl,properties:[{name:"key"},{name:"value"}]};case nl:return{name:nl,properties:[{name:"props",defaultValue:[]}]};case Da:return{name:Da,properties:[{name:"elements",defaultValue:[]},{name:"name"}]};case Ia:return{name:Ia,properties:[{name:"elements",defaultValue:[]},{name:"name"}]};case Oa:return{name:Oa,properties:[{name:"name"},{name:"styles",defaultValue:[]},{name:"views",defaultValue:[]}]};case il:return{name:il,properties:[{name:"key"},{name:"value"}]};case Wh:return{name:Wh,properties:[{name:"key"},{name:"value"}]};case sl:return{name:sl,properties:[{name:"key"},{name:"value"}]};case al:return{name:al,properties:[{name:"key"},{name:"value"}]};case ol:return{name:ol,properties:[{name:"key"},{name:"value"}]};case cl:return{name:cl,properties:[{name:"from"},{name:"isBidirectional",defaultValue:!1},{name:"kind"}]};case ul:return{name:ul,properties:[{name:"from"},{name:"isBidirectional",defaultValue:!1},{name:"kind"}]};case ll:return{name:ll,properties:[{name:"key"},{name:"value"}]};case Vh:return{name:Vh,properties:[{name:"prev"},{name:"value"}]};case Xh:return{name:Xh,properties:[{name:"body"},{name:"kind"},{name:"source"},{name:"tags"},{name:"target"},{name:"technology"},{name:"title"}]};case Yh:return{name:Yh,properties:[{name:"props",defaultValue:[]},{name:"tags"}]};case dl:return{name:dl,properties:[{name:"key"},{name:"value"}]};case hl:return{name:hl,properties:[{name:"subject"},{name:"where"}]};case pl:return{name:pl,properties:[{name:"subject"},{name:"where"}]};case ml:return{name:ml,properties:[{name:"custom"},{name:"subject"}]};case Di:return{name:Di,properties:[{name:"name"}]};case gl:return{name:gl,properties:[{name:"key"},{name:"value"}]};case vl:return{name:vl,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case wl:return{name:wl,properties:[{name:"key"},{name:"value"}]};case bl:return{name:bl,properties:[{name:"key"},{name:"value"}]};case Zh:return{name:Zh,properties:[{name:"color"},{name:"name"}]};case Ma:return{name:Ma,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case Fa:return{name:Fa,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case Rl:return{name:Rl,properties:[{name:"key"},{name:"value"}]};case Ga:return{name:Ga,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case $l:return{name:$l,properties:[{name:"key"},{name:"value"}]};case Ba:return{name:Ba,properties:[{name:"colors",defaultValue:[]},{name:"deploymentNodes",defaultValue:[]},{name:"elements",defaultValue:[]},{name:"name"},{name:"relationships",defaultValue:[]},{name:"tags",defaultValue:[]}]};case Ua:return{name:Ua,properties:[{name:"tag"}]};case np:return{name:np,properties:[{name:"el"},{name:"parent"}]};case Ii:return{name:Ii,properties:[{name:"name"}]};case rp:return{name:rp,properties:[{name:"prev"},{name:"values",defaultValue:[]}]};case kl:return{name:kl,properties:[{name:"key"},{name:"value"}]};case av:return{name:av,properties:[{name:"view"}]};case Tl:return{name:Tl,properties:[{name:"direction"},{name:"nodeSep"},{name:"rankSep"}]};case Sl:return{name:Sl,properties:[{name:"predicate"}]};case _l:return{name:_l,properties:[{name:"style"}]};case Al:return{name:Al,properties:[{name:"groupRules",defaultValue:[]},{name:"props",defaultValue:[]},{name:"title"}]};case Cl:return{name:Cl,properties:[{name:"props",defaultValue:[]},{name:"target"}]};case xl:return{name:xl,properties:[{name:"key"},{name:"value"}]};case Nl:return{name:Nl,properties:[{name:"left"},{name:"operator"},{name:"right"}]};case Dl:return{name:Dl,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Il:return{name:Il,properties:[{name:"value"}]};case Ol:return{name:Ol,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Ll:return{name:Ll,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Ml:return{name:Ml,properties:[{name:"value"}]};case zl:return{name:zl,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"participant"},{name:"value"}]};case Fl:return{name:Fl,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"participant"},{name:"value"}]};case ql:return{name:ql,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Gl:return{name:Gl,properties:[{name:"isWildcard",defaultValue:!1}]};default:return{name:e,properties:[]}}}}const U=new j0;let B0;const bU=()=>B0??(B0=NG(`{"$type":"Grammar","isDeclared":true,"name":"LikeC4","rules":[{"$type":"ParserRule","entry":true,"name":"LikeC4Grammar","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"specifications","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"models","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"views","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]}},{"$type":"Assignment","feature":"globals","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@121"},"arguments":[]}},{"$type":"Assignment","feature":"deployments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@96"},"arguments":[]}},{"$type":"Assignment","feature":"likec4lib","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LikeC4Lib","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"likec4lib"},{"$type":"Keyword","value":"{"},{"$type":"Keyword","value":"icons"},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"icons","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"+"},{"$type":"Keyword","value":"}"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LibIcon","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@151"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementKind","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Tag","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationshipKind","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomColor","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@155"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentNodeKind","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationRule","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"specification"}},{"$type":"Keyword","value":"{"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"relationships","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"colors","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"deploymentNodes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationElementKind","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"element"},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@140"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationElementStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"notation"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationDeploymentNodeKind","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"deploymentNode"},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@140"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationTag","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"tag"},{"$type":"Assignment","feature":"tag","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationColor","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"color"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"color","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationRelationshipKind","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"relationship"},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@143"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationRelationshipStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"notation"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Model","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"model"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":true},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Element","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@172"},"arguments":[]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"deprecatedSyntax":false}}]}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}],"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":false},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@140"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@127"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@131"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"title"},{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"description"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ExtendElement","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"extend"},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ExtendElementBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":true},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ExtendElementProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@127"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"StrictFqnElementRef","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@17"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"StrictFqnElementRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@169"},"arguments":[]},{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@17"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementRef","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@17"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@169"},"arguments":[]},{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@17"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Tags","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"values","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@153"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"+"},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Tags"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"values","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@153"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"*"}],"cardinality":"*"},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Relation","parameters":[{"$type":"Parameter","name":"isExplicit"}],"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","guardCondition":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@27/parameters@0"}},"elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]}}]},{"$type":"Group","guardCondition":{"$type":"Negation","value":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@27/parameters@0"}}},"elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"}]}]},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@154"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Keyword","value":"->"}]},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Assignment","feature":"technology","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"wildcard":false},{"$type":"ParserRule","name":"RelationBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@95"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@127"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"title"},{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"description"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationStyleProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"style"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@143"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"MetadataProperty","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"metadata"},{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"MetadataBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"MetadataAttribute","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@175"},"arguments":[]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ModelViews","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"views"}},{"$type":"Keyword","value":"{"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"views","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]}},{"$type":"Assignment","feature":"styles","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LikeC4ViewRule","returnType":{"$ref":"#/types@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@104"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementView","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"view"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"extends"},{"$type":"Assignment","feature":"extends","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@40"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"of"},{"$type":"Assignment","feature":"viewOf","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]}}]}],"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicView","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"dynamic"},{"$type":"Keyword","value":"view"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@43"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRef","definition":{"$type":"Assignment","feature":"view","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"deprecatedSyntax":false}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementViewRef","definition":{"$type":"Assignment","feature":"view","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@37"},"deprecatedSyntax":false}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewRef","definition":{"$type":"Assignment","feature":"view","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@38"},"deprecatedSyntax":false}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementViewBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@47"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]},"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"steps","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]}]}},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@49"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@127"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"title"},{"$type":"Keyword","value":"description"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewLayoutDirection","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"TopBottom"},{"$type":"Keyword","value":"LeftRight"},{"$type":"Keyword","value":"BottomTop"},{"$type":"Keyword","value":"RightLeft"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@55"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@89"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleGroup","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]},"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@134"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@129"},"arguments":[]}]},"cardinality":"*"},{"$type":"Assignment","feature":"groupRules","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@83"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@84"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@89"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewParallelSteps","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"parallel"},{"$type":"Keyword","value":"par"}]},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"steps","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewStep","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isBackward","operator":"?=","terminal":{"$type":"Keyword","value":"<-"}},{"$type":"Keyword","value":"->"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@154"},"arguments":[]},"deprecatedSyntax":false}}]},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"custom","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@93"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRulePredicate","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"IncludePredicate"}},{"$type":"Keyword","value":"include"},{"$type":"Assignment","feature":"predicates","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@53"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ExcludePredicate"}},{"$type":"Keyword","value":"exclude"},{"$type":"Assignment","feature":"predicates","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@53"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Predicates","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@54"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Predicates"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@54"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Predicate","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@68"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@56"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleGlobalPredicateRef","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"global"},{"$type":"Keyword","value":"predicate"},{"$type":"Assignment","feature":"predicate","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@122"},"deprecatedSyntax":false}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicate","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@57"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicates","inferredType":{"$type":"InferredType","name":"ElementPredicate"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@58"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementPredicateWith"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"with"},{"$type":"Assignment","feature":"custom","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@92"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicateOrWhere","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@65"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementPredicateWhere"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"where"},{"$type":"Assignment","feature":"where","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementExpression","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementOr","inferredType":{"$type":"InferredType","name":"WhereElementExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"or"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementAnd","inferredType":{"$type":"InferredType","name":"WhereElementExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@62"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"and"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@62"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementPrimary","inferredType":{"$type":"InferredType","name":"WhereElementExpression"},"definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@63"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@64"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementNegation","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"not"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElement","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereElementTag"}},{"$type":"Keyword","value":"tag"},{"$type":"RuleCall","rule":{"$ref":"#/rules@157"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@153"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereElementKind"}},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@157"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@2"},"deprecatedSyntax":false},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementExpression","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@66"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@67"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementSelectorExpression","inferredType":{"$type":"InferredType","name":"ElementExpression"},"definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WildcardExpression"}},{"$type":"Assignment","feature":"isWildcard","operator":"?=","terminal":{"$type":"Keyword","value":"*"}}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementTagExpression"}},{"$type":"Keyword","value":"element.tag"},{"$type":"RuleCall","rule":{"$ref":"#/rules@158"},"arguments":[]},{"$type":"Assignment","feature":"tag","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@153"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementKindExpression"}},{"$type":"Keyword","value":"element.kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@158"},"arguments":[]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"deprecatedSyntax":false},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementDescedantsExpression","inferredType":{"$type":"InferredType","name":"ElementExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ExpandElementExpression"},"feature":"expand","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@166"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementDescedantsExpression"},"feature":"parent","operator":"="},{"$type":"Assignment","feature":"suffix","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@167"},"arguments":[]}}]}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicate","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@69"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicates","inferredType":{"$type":"InferredType","name":"RelationPredicate"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@70"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"RelationPredicateWith"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"with"},{"$type":"Assignment","feature":"custom","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@93"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicateOrWhere","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@77"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"RelationPredicateWhere"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"where"},{"$type":"Assignment","feature":"where","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@71"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationExpression","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@72"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationOr","inferredType":{"$type":"InferredType","name":"WhereRelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@73"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"or"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@73"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationAnd","inferredType":{"$type":"InferredType","name":"WhereRelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@74"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"and"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@74"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationPrimary","inferredType":{"$type":"InferredType","name":"WhereRelationExpression"},"definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@71"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@75"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@76"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationNegation","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"not"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@71"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelation","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationTag"}},{"$type":"Keyword","value":"tag"},{"$type":"RuleCall","rule":{"$ref":"#/rules@157"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@153"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationKind"}},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@157"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationParticipantTag"}},{"$type":"Assignment","feature":"participant","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@149"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@169"},"arguments":[]},{"$type":"Keyword","value":"tag"},{"$type":"RuleCall","rule":{"$ref":"#/rules@157"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@153"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationParticipantKind"}},{"$type":"Assignment","feature":"participant","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@149"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@169"},"arguments":[]},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@157"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationExpression","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@78"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@80"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"InOutRelationExpressions","inferredType":{"$type":"InferredType","name":"RelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@79"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"InOutRelationExpression"},"feature":"inout","operator":"="},{"$type":"Keyword","value":"->"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IncomingRelationExpression","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"->"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@65"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DirectedRelationExpressions","inferredType":{"$type":"InferredType","name":"RelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@81"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"DirectedRelationExpression"},"feature":"source","operator":"="},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@65"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"OutgoingRelationExpression","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@65"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isBidirectional","operator":"?=","terminal":{"$type":"Keyword","value":"<->"}},{"$type":"Keyword","value":"->"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@154"},"arguments":[]},"deprecatedSyntax":false}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementExpressionsIterator","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@65"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementExpressionsIterator"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@65"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewIncludePredicate","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"include"},{"$type":"Assignment","feature":"predicates","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@85"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewGlobalPredicateRef","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"global"},{"$type":"Keyword","value":"predicate"},{"$type":"Assignment","feature":"predicate","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@123"},"deprecatedSyntax":false}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewPredicateIterator","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@56"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"DynamicViewPredicateIterator"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@56"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleStyle","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"style"},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@139"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@90"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleGlobalStyle","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"global"},{"$type":"Keyword","value":"style"},{"$type":"Assignment","feature":"style","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@124"},"deprecatedSyntax":false}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleStyleOrGlobalRef","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@86"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@87"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleAutoLayout","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"autoLayout"},{"$type":"Assignment","feature":"direction","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"rankSep","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@176"},"arguments":[]}},{"$type":"Assignment","feature":"nodeSep","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@176"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NotationProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"notation"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NotesProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"notes"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomElementProperties","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@94"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@90"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@139"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomRelationProperties","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@95"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@90"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@91"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@143"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NavigateToProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"navigateTo"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationNavigateToProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"navigateTo"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ModelDeployments","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"deployment"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@97"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@102"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentNode","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@7"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@172"},"arguments":[]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@7"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false}}]}]},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@98"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentNodeBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@99"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@102"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@97"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeployedInstance","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@172"},"arguments":[]}],"cardinality":"?"},{"$type":"Keyword","value":"instanceOf"},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"arguments":[]},"cardinality":"?"},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeployedInstanceBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FqnRef","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@7"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"FqnRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@169"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@7"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentRelation","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"->"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@154"},"arguments":[]},"deprecatedSyntax":false}}]},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]}},{"$type":"Assignment","feature":"technology","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@103"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentRelationBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentView","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"deployment"},{"$type":"Keyword","value":"view"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@105"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentViewBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@106"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentViewRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@108"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@89"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentViewRuleStyle","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"style"},{"$type":"Assignment","feature":"targets","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@120"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@139"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@90"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentViewRulePredicate","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isInclude","operator":"?=","terminal":{"$type":"Keyword","value":"include"}},{"$type":"Keyword","value":"exclude"}]},{"$type":"Assignment","feature":"expr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@109"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentViewRulePredicateExpression","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"DeploymentViewRulePredicateExpression"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ExpressionV2","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@112"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicateOrWhereV2","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@113"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementPredicateWhereV2"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"where"},{"$type":"Assignment","feature":"where","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicateOrWhereV2","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@115"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"RelationPredicateWhereV2"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"where"},{"$type":"Assignment","feature":"where","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@71"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FqnExpr","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WildcardExpression"}},{"$type":"Assignment","feature":"isWildcard","operator":"?=","terminal":{"$type":"Keyword","value":"*"}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@114"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FqnRefExpr","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"ref","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]}},{"$type":"Assignment","feature":"selector","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@166"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@167"},"arguments":[]}]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationExpr","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@116"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@118"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"InOutRelationExpr","inferredType":{"$type":"InferredType","name":"RelationExpr"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@117"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"InOutRelationExpr"},"feature":"inout","operator":"="},{"$type":"Keyword","value":"->"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IncomingRelationExpr","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"->"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@113"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DirectedRelationExpr","inferredType":{"$type":"InferredType","name":"RelationExpr"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@119"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"DirectedRelationExpr"},"feature":"source","operator":"="},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@113"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"OutgoingRelationExpr","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@113"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isBidirectional","operator":"?=","terminal":{"$type":"Keyword","value":"<->"}},{"$type":"Keyword","value":"->"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@154"},"arguments":[]},"deprecatedSyntax":false}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FqnExpressions","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@113"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"FqnExpressions"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@113"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Globals","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"global"}},{"$type":"Keyword","value":"{"},{"$type":"Group","elements":[{"$type":"Assignment","feature":"predicates","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@122"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@123"},"arguments":[]}]},"cardinality":"*"},{"$type":"Assignment","feature":"styles","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@125"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"arguments":[]}]},"cardinality":"*"}],"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GlobalPredicateGroup","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"predicateGroup"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@175"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"predicates","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GlobalDynamicPredicateGroup","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"dynamicPredicateGroup"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@175"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"predicates","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@83"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GlobalStyleId","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@175"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GlobalStyle","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"style"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@124"},"arguments":[]}},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@139"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@90"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GlobalStyleGroup","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"styleGroup"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@124"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"styles","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@86"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LinkProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"link"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@152"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@174"},"arguments":[]},"cardinality":"?"},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ColorProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"color"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"themeColor","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@147"},"arguments":[]}},{"$type":"Assignment","feature":"customColor","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@6"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@155"},"arguments":[]},"deprecatedSyntax":false}}]},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"OpacityProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"opacity"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@173"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"MultipleProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"multiple"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@144"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IconProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"icon"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"libicon","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@151"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"none"},{"$type":"RuleCall","rule":{"$ref":"#/rules@152"},"arguments":[]}]}}]},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ShapeProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"shape"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@148"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"BorderStyleValue","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@145"},"arguments":[]},{"$type":"Keyword","value":"none"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"BorderProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"border"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@133"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SizeValue","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"xs"},{"$type":"Keyword","value":"sm"},{"$type":"Keyword","value":"md"},{"$type":"Keyword","value":"lg"},{"$type":"Keyword","value":"xl"},{"$type":"Keyword","value":"xsmall"},{"$type":"Keyword","value":"small"},{"$type":"Keyword","value":"medium"},{"$type":"Keyword","value":"large"},{"$type":"Keyword","value":"xlarge"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ShapeSizeProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"size"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@135"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PaddingSizeProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"padding"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@135"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TextSizeProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"textSize"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@135"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"StyleProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@132"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@134"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@129"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@131"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@130"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@136"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@137"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@138"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementStyleProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"style"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@139"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LineProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"line"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@145"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ArrowProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"head"},{"$type":"Keyword","value":"tail"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@146"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationshipStyleProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@141"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@142"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Boolean","dataType":"boolean","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"true"},{"$type":"Keyword","value":"false"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LineOptions","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"solid"},{"$type":"Keyword","value":"dashed"},{"$type":"Keyword","value":"dotted"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ArrowType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"none"},{"$type":"Keyword","value":"normal"},{"$type":"Keyword","value":"onormal"},{"$type":"Keyword","value":"dot"},{"$type":"Keyword","value":"odot"},{"$type":"Keyword","value":"diamond"},{"$type":"Keyword","value":"odiamond"},{"$type":"Keyword","value":"crow"},{"$type":"Keyword","value":"open"},{"$type":"Keyword","value":"vee"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ThemeColor","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"primary"},{"$type":"Keyword","value":"secondary"},{"$type":"Keyword","value":"muted"},{"$type":"Keyword","value":"slate"},{"$type":"Keyword","value":"blue"},{"$type":"Keyword","value":"indigo"},{"$type":"Keyword","value":"sky"},{"$type":"Keyword","value":"red"},{"$type":"Keyword","value":"gray"},{"$type":"Keyword","value":"green"},{"$type":"Keyword","value":"amber"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementShape","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"rectangle"},{"$type":"Keyword","value":"person"},{"$type":"Keyword","value":"browser"},{"$type":"Keyword","value":"mobile"},{"$type":"Keyword","value":"cylinder"},{"$type":"Keyword","value":"storage"},{"$type":"Keyword","value":"queue"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Participant","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"source"},{"$type":"Keyword","value":"target"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomColorValue","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@177"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@176"},"arguments":[]}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IconId","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@163"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Uri","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@164"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@165"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TagId","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DotId","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@170"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@156"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomColorId","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@175"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@148"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@146"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@145"},"arguments":[]},{"$type":"Keyword","value":"element"},{"$type":"Keyword","value":"model"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Id","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@175"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@148"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@147"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@146"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@145"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@149"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@135"},"arguments":[]},{"$type":"Keyword","value":"element"},{"$type":"Keyword","value":"model"},{"$type":"Keyword","value":"group"},{"$type":"Keyword","value":"node"},{"$type":"Keyword","value":"deployment"},{"$type":"Keyword","value":"instance"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EqOperator","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@172"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@171"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"is"}},{"$type":"Assignment","feature":"not","operator":"?=","terminal":{"$type":"Keyword","value":"not"},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"IsEqual","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isEqual","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@172"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@171"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","hidden":true,"name":"BLOCK_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\/[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/[\\\\r\\\\n]+/"},"fragment":false},{"$type":"TerminalRule","name":"LIB_ICON","definition":{"$type":"RegexToken","regex":"/(aws|azure|gcp|tech):[-\\\\w]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"URI_WITH_SCHEMA","definition":{"$type":"RegexToken","regex":"/\\\\w+:\\\\/\\\\/\\\\S+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"URI_RELATIVE","definition":{"$type":"RegexToken","regex":"/\\\\.{0,2}\\\\/[^\\\\/]\\\\S+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"DotUnderscore","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\._(?![_a-zA-Z])/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"DotWildcard","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\.\\\\*{1,2}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Hash","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"#"}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"StickyDot","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\./"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Dot","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"."}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NotEqual","definition":{"$type":"RegexToken","regex":"/\\\\!\\\\={1,2}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Eq","definition":{"$type":"RegexToken","regex":"/\\\\={1,2}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Percent","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\d+%/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"String","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"IdTerminal","definition":{"$type":"RegexToken","regex":"/[_]*[a-zA-Z][-\\\\w]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Number","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/\\\\b\\\\d+\\\\b/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Hex","definition":{"$type":"RegexToken","regex":"/\\\\b[a-zA-Z0-9]+\\\\b/"},"fragment":false,"hidden":false}],"types":[{"$type":"Type","name":"LikeC4View","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@37"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@38"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@104"}}]}},{"$type":"Type","name":"StringProperty","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@20"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@45"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@30"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@34"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@10"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@15"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@90"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@91"}}]}},{"$type":"Type","name":"DeploymentNodeOrElementKind","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@3"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@7"}}]}},{"$type":"Type","name":"WhereTagEqual","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@64/definition/elements@0/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@76/definition/elements@0/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@76/definition/elements@2/elements@0/inferredType"}}]}},{"$type":"Type","name":"WhereKindEqual","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@64/definition/elements@1/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@76/definition/elements@1/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@76/definition/elements@3/elements@0/inferredType"}}]}},{"$type":"Type","name":"WhereExpression","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@59"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@71"}}]}},{"$type":"Type","name":"DeploymentElement","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@97"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@99"}}]}},{"$type":"Type","name":"Referenceable","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@97"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@99"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@17"}}]}},{"$type":"Type","name":"FqnReferenceable","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/types@7"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@17"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@21"}}]}},{"$type":"Type","name":"SizeProperty","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@136"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@137"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@138"}}]}}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"interfaces":[],"usedGrammars":[]}`)),uv={languageId:"likec4",fileExtensions:[".c4",".likec4",".like-c4"],caseInsensitive:!1,mode:"production"},RU={skipValidations:!0,recoveryEnabled:!0,nodeLocationTracking:"full"},$U={AstReflection:()=>new j0},kU={Grammar:()=>bU(),LanguageMetaData:()=>uv,parser:{ParserConfig:()=>RU}},Ke=Qt.getChild("server");function lv(t){Ke.error(ea(t))}function we(t){Ke.warn(ea(t))}const TU={fileSystemProvider:()=>new SU},EU=t=>uv.fileExtensions.some(e=>t.endsWith(e));class SU extends PB{async readDirectory(e){const n=[];try{const r=await new CB.fdir().withSymlinks().withFullPaths().filter(EU).crawl(e.fsPath).withPromise();for(const i of r)n.push({isFile:!0,isDirectory:!1,uri:Vt.file(i)})}catch(r){lv(r)}return n}}var _U=Object.getOwnPropertyNames,AU=Object.getOwnPropertySymbols,CU=Object.prototype.hasOwnProperty;function U0(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function sp(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);var s=i.cache,a=s.get(n),o=s.get(r);if(a&&o)return a===r&&o===n;s.set(n,r),s.set(r,n);var c=t(n,r,i);return s.delete(n),s.delete(r),c}}function W0(t){return _U(t).concat(AU(t))}var PU=Object.hasOwn||function(t,e){return CU.call(t,e)};function qs(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var xU="__v",NU="__o",DU="_owner",H0=Object.getOwnPropertyDescriptor,K0=Object.keys;function IU(t,e,n){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function OU(t,e){return qs(t.getTime(),e.getTime())}function LU(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function MU(t,e){return t===e}function V0(t,e,n){var r=t.size;if(r!==e.size)return!1;if(!r)return!0;for(var i=new Array(r),s=t.entries(),a,o,c=0;(a=s.next())&&!a.done;){for(var u=e.entries(),l=!1,d=0;(o=u.next())&&!o.done;){if(i[d]){d++;continue}var f=a.value,h=o.value;if(n.equals(f[0],h[0],c,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){l=i[d]=!0;break}d++}if(!l)return!1;c++}return!0}var zU=qs;function FU(t,e,n){var r=K0(t),i=r.length;if(K0(e).length!==i)return!1;for(;i-- >0;)if(!Y0(t,e,n,r[i]))return!1;return!0}function jl(t,e,n){var r=W0(t),i=r.length;if(W0(e).length!==i)return!1;for(var s,a,o;i-- >0;)if(s=r[i],!Y0(t,e,n,s)||(a=H0(t,s),o=H0(e,s),(a||o)&&(!a||!o||a.configurable!==o.configurable||a.enumerable!==o.enumerable||a.writable!==o.writable)))return!1;return!0}function qU(t,e){return qs(t.valueOf(),e.valueOf())}function GU(t,e){return t.source===e.source&&t.flags===e.flags}function X0(t,e,n){var r=t.size;if(r!==e.size)return!1;if(!r)return!0;for(var i=new Array(r),s=t.values(),a,o;(a=s.next())&&!a.done;){for(var c=e.values(),u=!1,l=0;(o=c.next())&&!o.done;){if(!i[l]&&n.equals(a.value,o.value,a.value,o.value,t,e,n)){u=i[l]=!0;break}l++}if(!u)return!1}return!0}function jU(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function BU(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Y0(t,e,n,r){return(r===DU||r===NU||r===xU)&&(t.$$typeof||e.$$typeof)?!0:PU(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}var UU="[object Arguments]",WU="[object Boolean]",HU="[object Date]",KU="[object Error]",VU="[object Map]",XU="[object Number]",YU="[object Object]",JU="[object RegExp]",QU="[object Set]",ZU="[object String]",eW="[object URL]",tW=Array.isArray,J0=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Q0=Object.assign,nW=Object.prototype.toString.call.bind(Object.prototype.toString);function rW(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areErrorsEqual,i=t.areFunctionsEqual,s=t.areMapsEqual,a=t.areNumbersEqual,o=t.areObjectsEqual,c=t.arePrimitiveWrappersEqual,u=t.areRegExpsEqual,l=t.areSetsEqual,d=t.areTypedArraysEqual,f=t.areUrlsEqual;return function(m,y,R){if(m===y)return!0;if(m==null||y==null)return!1;var w=typeof m;if(w!==typeof y)return!1;if(w!=="object")return w==="number"?a(m,y,R):w==="function"?i(m,y,R):!1;var k=m.constructor;if(k!==y.constructor)return!1;if(k===Object)return o(m,y,R);if(tW(m))return e(m,y,R);if(J0!=null&&J0(m))return d(m,y,R);if(k===Date)return n(m,y,R);if(k===RegExp)return u(m,y,R);if(k===Map)return s(m,y,R);if(k===Set)return l(m,y,R);var E=nW(m);return E===HU?n(m,y,R):E===JU?u(m,y,R):E===VU?s(m,y,R):E===QU?l(m,y,R):E===YU?typeof m.then!="function"&&typeof y.then!="function"&&o(m,y,R):E===eW?f(m,y,R):E===KU?r(m,y,R):E===UU?o(m,y,R):E===WU||E===XU||E===ZU?c(m,y,R):!1}}function iW(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?jl:IU,areDatesEqual:OU,areErrorsEqual:LU,areFunctionsEqual:MU,areMapsEqual:r?U0(V0,jl):V0,areNumbersEqual:zU,areObjectsEqual:r?jl:FU,arePrimitiveWrappersEqual:qU,areRegExpsEqual:GU,areSetsEqual:r?U0(X0,jl):X0,areTypedArraysEqual:r?jl:jU,areUrlsEqual:BU};if(n&&(i=Q0({},i,n(i))),e){var s=sp(i.areArraysEqual),a=sp(i.areMapsEqual),o=sp(i.areObjectsEqual),c=sp(i.areSetsEqual);i=Q0({},i,{areArraysEqual:s,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:c})}return i}function sW(t){return function(e,n,r,i,s,a,o){return t(e,n,o)}}function aW(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,s=t.strict;if(r)return function(c,u){var l=r(),d=l.cache,f=d===void 0?e?new WeakMap:void 0:d,h=l.meta;return n(c,u,{cache:f,equals:i,meta:h,strict:s})};if(e)return function(c,u){return n(c,u,{cache:new WeakMap,equals:i,meta:void 0,strict:s})};var a={cache:void 0,equals:i,meta:void 0,strict:s};return function(c,u){return n(c,u,a)}}var dv=Oi();Oi({strict:!0}),Oi({circular:!0}),Oi({circular:!0,strict:!0}),Oi({createInternalComparator:function(){return qs}}),Oi({strict:!0,createInternalComparator:function(){return qs}}),Oi({circular:!0,createInternalComparator:function(){return qs}}),Oi({circular:!0,createInternalComparator:function(){return qs},strict:!0});function Oi(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,s=t.strict,a=s===void 0?!1:s,o=iW(t),c=rW(o),u=r?r(c):sW(c);return aW({circular:n,comparator:c,createState:i,equals:u,strict:a})}function Z0(t,e){const n=t.nodes.map(i=>{const s=e.nodes[i.id];if(!s)return i;const{x:a,y:o,width:c,height:u}=s;return{...i,width:c,height:u,position:[a,o]}}),r=t.edges.map(i=>{const s=e.edges[i.id];return s?{...i,...s}:i});return{...t,bounds:{x:e.x,y:e.y,width:e.width,height:e.height},nodes:n,edges:r}}const e_=(t,e)=>t.width>e.width+10||t.height>e.height+10;function oW(t,e){if(t.hash===e.hash)return{diagram:Z0(t,e)};if(dv(t.autoLayout,e.autoLayout)&&t.nodes.every(r=>{const i=e.nodes[r.id];return!!i&&(r.children.length>0&&i.isCompound||r.children.length===0&&!i.isCompound)&&(i.isCompound||e_(r,i)===!1)})&&t.edges.every(r=>{const i=e.edges[r.id];return!!i&&(!r.labelBBox&&!i.labelBBox||!!r.labelBBox&&!!i.labelBBox&&r.labelBBox.width<=i.labelBBox.width&&r.labelBBox.height<=i.labelBBox.height)}))return{diagram:Z0(t,e)};const n=t.nodes.reduce((r,i)=>{const s=e.nodes[i.id];if(i.children.length>0||!s)return r;const a={id:i.id,center:{x:Math.round(s.x+s.width/2),y:Math.round(s.y+s.height/2)}};return s.isCompound||e_(i,s)||(a.fixedsize={width:s.width,height:s.height}),r.push(a),r},[]);return{relayout:{x:e.x,y:e.y,height:e.height,nodes:n,edges:Wf(e.edges).flatMap(([r,i])=>i.dotpos?{id:r,dotpos:i.dotpos}:[])}}}function t_(t){return typeof t=="object"&&t!==null&&typeof t.id=="string"}function fv(t){return typeof t=="object"&&t!==null&&t.$$type==="Node"&&typeof t.id=="string"}function n_(t){return fv(t)||t_(t)}function Bl(t){return typeof t=="string"||n_(t)}function cW(t){return Array.isArray(t)&&t.every(Bl)}function uW(t){return["n","ne","e","se","s","sw","w","nw","c"].includes(t)}function r_(t){if(n_(t))return t;const[e,n,r]=t.split(":");return uW(r)?{id:e,port:n,compass:r}:{id:e,port:n}}function lW(t){if(t.length<2&&(Bl(t[0])&&Bl(t[1]))===!1)throw Error("EdgeTargets must have at least 2 elements.");return t.map(e=>r_(e))}const ap=Object.seal({Graph:null,Digraph:null,Subgraph:null,Node:null,Edge:null});function dW(t){return Object.assign(Object.seal(Object.assign({},ap)),t)}function fW(...t){const[e,...n]=t;return(...r)=>n.reduce((i,s)=>s(i),e(...r))}function Xn(t,...e){return fW(t,...e)}const hW=t=>(...e)=>n=>t(n,...e),pW=t=>({[Symbol.iterator]:t}),lr=hW((t,e)=>Array.from(pW(function*(){for(const n of t)yield e(n)})));class i_{options;getLocation(){return this.options?.locationFunction?.()??null}constructor(e){this.options=e}createElement(e,n,r=[]){return{location:this.getLocation(),...n,type:e,children:r}}}const Qe=i_.prototype.createElement.bind(new i_),mW=/\r?\n/;function dr(t){return e=>e.join(t)}function gW(t){return e=>t+e+t}function Li(t,e){return n=>t+n+e}function op(t){return e=>t+e}const s_=t=>t.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/"/g,'\\"'),cp=t=>t.split(mW),Ul=(t,e,n)=>Xn(cp,lr(op(t==="space"?" ".repeat(e):`
183
- `)),dr(n)),Gs=t=>{switch(t){case"crlf":return`\r
184
- `;case"lf":return`
185
- `}},yW={match(t){return t.type==="AttributeList"},print(t,e){if(e.children.length===0)return`${e.kind.toLocaleLowerCase()} [];`;const n=Gs(t.endOfLine);return Xn(lr(t.print),dr(n),Ul(t.indentStyle,t.indentSize,n),Li(`${e.kind.toLocaleLowerCase()} [${n}`,`${n}];`))(e.children)}},vW={match(t){return t.type==="Attribute"},print(t,e){return`${t.print(e.key)} = ${t.print(e.value)};`}},wW={match(t){return t.type==="Comment"},print(t,e){const n=Gs(t.endOfLine);switch(e.kind){case"Block":return Xn(cp,lr(op(" * ")),dr(n),Li(`/**${n}`,`${n} */`))(e.value);case"Macro":return Xn(cp,lr(op("# ")),dr(n))(e.value);case"Slash":default:return Xn(cp,lr(op("// ")),dr(n))(e.value)}}},bW={match(t){return t.type==="Dot"},print(t,e){return e.children.map(t.print).join(Gs(t.endOfLine))}},RW={match(t){return t.type==="Edge"},print(t,e){const n=Xn(lr(t.print),dr(t.directed?" -> ":" -- "))(e.targets);if(e.children.length===0)return`${n};`;const r=Gs(t.endOfLine),i=Xn(lr(t.print),dr(r),Ul(t.indentStyle,t.indentSize,r),Li(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},$W={match(t){return t.type==="Graph"},print(t,e){t.directed=e.directed;const n=[];if(e.strict&&n.push("strict"),n.push(e.directed?"digraph":"graph"),e.id&&n.push(t.print(e.id)),e.children.length===0)return`${n.join(" ")} {}`;const r=Gs(t.endOfLine),i=Xn(lr(t.print),dr(r),Ul(t.indentStyle,t.indentSize,r),Li(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},kW=Xn(s_,gW('"')),TW=Li("<",">"),EW={match(t){return t.type==="Literal"},print(t,e){switch(e.quoted){case"html":return TW(e.value);case!0:return kW(e.value);case!1:default:return s_(e.value)}}},SW={match(t){return t.type==="Node"},print(t,e){const n=t.print(e.id);if(e.children.length===0)return`${n};`;const r=Gs(t.endOfLine),i=Xn(lr(t.print),dr(r),Ul(t.indentStyle,t.indentSize,r),Li(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},_W={match(t){return t.type==="NodeRefGroup"},print(t,e){return Xn(lr(t.print),dr(" "),Li("{","}"))(e.children)}},AW={match(t){return t.type==="NodeRef"},print(t,e){const n=[t.print(e.id)];return e.port&&n.push(t.print(e.port)),e.compass&&n.push(t.print(e.compass)),n.join(":")}},CW={match(t){return t.type==="Subgraph"},print(t,e){const n=["subgraph"];if(e.id&&n.push(t.print(e.id)),e.children.length===0)return`${n.join(" ")} {}`;const r=Gs(t.endOfLine),i=Xn(lr(t.print),dr(r),Ul(t.indentStyle,t.indentSize,r),Li(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},PW=[yW,vW,wW,bW,RW,$W,EW,SW,_W,AW,CW];class xW{options;#e=[...PW];constructor(e={}){this.options=e}print(e){const n=[...this.#e],{indentSize:r=2,indentStyle:i="space",endOfLine:s="lf"}=this.options,a={directed:!0,indentSize:r,indentStyle:i,endOfLine:s,print(o){for(const c of n)if(c.match(o))return c.print(a,o);throw Error()}};return a.print(e)}}function NW(t,e){const n=new xW(e).print(t);if(!n)throw new Error;return n}function up(t,e){if(typeof e=="string"){const n=e.trim();return/^<.+>$/ms.test(n)?Qe("Attribute",{key:Qe("Literal",{value:t,quoted:!1},[]),value:Qe("Literal",{value:n.slice(1,n.length-1),quoted:"html"},[])},[]):Qe("Attribute",{key:Qe("Literal",{value:t,quoted:!1},[]),value:Qe("Literal",{value:e,quoted:!0},[])},[])}return Qe("Attribute",{key:Qe("Literal",{value:t,quoted:!1},[]),value:Qe("Literal",{value:String(e),quoted:!1},[])},[])}function js(t,e){return Qe("Comment",{kind:e,value:t},[])}function a_(t,e){return Array.from(function*(){for(const[n,r]of e.values)yield up(n,r);for(const n of Object.values(e.attributes))n.size>0&&(n.comment&&(yield js(n.comment,t.commentKind)),yield t.convert(n));for(const n of e.nodes)n.comment&&(yield js(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.subgraphs)n.comment&&(yield js(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.edges)n.comment&&(yield js(n.comment,t.commentKind)),yield t.convert(n)}())}const DW={match(t){return t.$$type==="AttributeList"},convert(t,e){return Qe("AttributeList",{kind:e.$$kind},e.values.map(([n,r])=>up(n,r)))}},IW={match(t){return t.$$type==="Edge"},convert(t,e){return Qe("Edge",{targets:e.targets.map(n=>fv(n)?Qe("NodeRef",{id:Qe("Literal",{value:n.id,quoted:!0},[])},[]):t_(n)?Qe("NodeRef",{id:Qe("Literal",{value:n.id,quoted:!0},[]),port:n.port?Qe("Literal",{value:n.port,quoted:!0},[]):void 0,compass:n.compass?Qe("Literal",{value:n.compass,quoted:!0},[]):void 0},[]):Qe("NodeRefGroup",{},n.map(r=>fv(r)?Qe("NodeRef",{id:Qe("Literal",{value:r.id,quoted:!0},[])},[]):Qe("NodeRef",{id:Qe("Literal",{value:r.id,quoted:!0},[]),port:r.port?Qe("Literal",{value:r.port,quoted:!0},[]):void 0,compass:r.compass?Qe("Literal",{value:r.compass,quoted:!0},[]):void 0},[]))))},[...e.attributes.comment?[js(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>up(n,r))])}},OW={match(t){return t.$$type==="Graph"},convert(t,e){return Qe("Dot",{},[...e.comment?[js(e.comment,t.commentKind)]:[],Qe("Graph",{directed:e.directed,strict:e.strict,id:e.id?Qe("Literal",{value:e.id,quoted:!0},[]):void 0},a_(t,e))])}},LW={match(t){return t.$$type==="Node"},convert(t,e){return Qe("Node",{id:Qe("Literal",{value:e.id,quoted:!0},[])},[...e.attributes.comment?[js(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>up(n,r))])}},MW={match(t){return t.$$type==="Subgraph"},convert(t,e){return Qe("Subgraph",{id:e.id?Qe("Literal",{value:e.id,quoted:!0},[]):void 0},a_(t,e))}},zW=[DW,IW,LW,OW,MW];class FW{options;#e=[...zW];constructor(e={}){this.options=e}convert(e){const n=[...this.#e],{commentKind:r="Slash"}=this.options,i={commentKind:r,convert(s){for(const a of n)if(a.match(s))return a.convert(i,s);throw Error()}};return i.convert(e)}}function qW(t,e){return new FW(e).convert(t)}const D=new Proxy(Object.freeze({}),{get:(t,e)=>e});class hv{}class pv extends hv{#e=new Map;constructor(e){super(),e!==void 0&&this.apply(e)}get values(){return Array.from(this.#e.entries())}get size(){return this.#e.size}get(e){return this.#e.get(e)}set(e,n){n!=null&&this.#e.set(e,n)}delete(e){this.#e.delete(e)}apply(e){const n=Array.isArray(e)?e:Object.entries(e);for(const[r,i]of n)this.set(r,i)}clear(){this.#e.clear()}}class mv extends pv{$$kind;get $$type(){return"AttributeList"}comment;constructor(e,n){super(n),this.$$kind=e}}class o_ extends pv{#e=ap;id;comment;attributes=Object.freeze({graph:new mv("Graph"),edge:new mv("Edge"),node:new mv("Node")});get nodes(){return Array.from(this.#t.nodes.values())}get edges(){return Array.from(this.#t.edges.values())}get subgraphs(){return Array.from(this.#t.subgraphs.values())}#t={nodes:new Map,edges:new Set,subgraphs:new Set};with(e){this.#e=dW(e)}addNode(e){this.#t.nodes.set(e.id,e)}addEdge(e){this.#t.edges.add(e)}addSubgraph(e){this.#t.subgraphs.add(e)}existNode(e){return this.#t.nodes.has(e)}existEdge(e){return this.#t.edges.has(e)}existSubgraph(e){return this.#t.subgraphs.has(e)}createSubgraph(...e){const n=new this.#e.Subgraph(...e);return n.with(this.#e),this.addSubgraph(n),n}removeNode(e){this.#t.nodes.delete(typeof e=="string"?e:e.id)}removeEdge(e){this.#t.edges.delete(e)}removeSubgraph(e){this.#t.subgraphs.delete(e)}createNode(e,n){const r=new this.#e.Node(e,n);return this.addNode(r),r}getSubgraph(e){return Array.from(this.#t.subgraphs.values()).find(n=>n.id===e)}getNode(e){return this.#t.nodes.get(e)}createEdge(e,n){const r=e.map(s=>cW(s)?lW(s):r_(s)),i=new this.#e.Edge(r,n);return this.addEdge(i),i}subgraph(...e){const n=e.find(a=>typeof a=="string"),r=e.find(a=>typeof a=="object"&&a!==null),i=e.find(a=>typeof a=="function"),s=n?this.getSubgraph(n)??this.createSubgraph(n):this.createSubgraph();return r!==void 0&&s.apply(r),i!==void 0&&i(s),s}node(e,...n){if(typeof e=="string"){const r=e,i=n.find(o=>typeof o=="object"&&o!==null),s=n.find(o=>typeof o=="function"),a=this.getNode(r)??this.createNode(r);return i!==void 0&&a.attributes.apply(i),s!==void 0&&s(a),a}typeof e=="object"&&e!==null&&this.attributes.node.apply(e)}edge(e,...n){if(Array.isArray(e)){const r=e,i=n.find(o=>typeof o=="object"),s=n.find(o=>typeof o=="function"),a=this.createEdge(r,i);return s!==void 0&&s(a),a}typeof e=="object"&&e!==null&&this.attributes.edge.apply(e)}graph(e){this.attributes.graph.apply(e)}}class c_ extends o_{get $$type(){return"Graph"}id;strict;constructor(...e){super(),this.id=e.find(r=>typeof r=="string"),this.strict=e.find(r=>typeof r=="boolean")??!1;const n=e.find(r=>typeof r=="object"&&r!==null);n!==void 0&&this.apply(n)}}class GW extends c_{get directed(){return!0}}let jW=class extends c_{get directed(){return!1}};class BW extends o_{get $$type(){return"Subgraph"}id;constructor(...e){super(),this.id=e.find(r=>typeof r=="string");const n=e.find(r=>typeof r=="object"&&r!==null);n!==void 0&&this.apply(n)}isSubgraphCluster(){return typeof this.id=="string"?this.id.startsWith("cluster"):!1}}class u_ extends pv{comment}let UW=class extends hv{id;get $$type(){return"Node"}comment;attributes;constructor(e,n){super(),this.id=e,this.attributes=new u_(n)}port(e){return typeof e=="string"?{id:this.id,port:e}:{id:this.id,...e}}};class WW extends hv{targets;get $$type(){return"Edge"}comment;attributes;constructor(e,n){if(super(),this.targets=e,e.length<2&&(Bl(e[0])&&Bl(e[1]))===!1)throw Error("The element of Edge target is missing or not satisfied as Edge target.");this.attributes=new u_(n)}}Object.assign(ap,{Graph:jW,Digraph:GW,Subgraph:BW,Node:UW,Edge:WW});function l_(t,e){return(...n)=>{const r=t?this.Digraph:this.Graph,i=n.find(c=>typeof c=="string"),s=n.find(c=>typeof c=="object"),a=n.find(c=>typeof c=="function"),o=new r(i,e,s);return o.with(this),typeof a=="function"&&a(o),o}}function d_(t,e=ap){return Object.freeze({digraph:l_.call(e,!0,t),graph:l_.call(e,!1,t)})}const f_=d_(!1),HW=f_.digraph;f_.graph;const KW=d_(!0);function h_(t,e){const n=qW(t,e?.convert);return NW(n,e?.print)}var gv,p_;function VW(){if(p_)return gv;p_=1;function t(r){let i=r.length-1,s=r[i];for(;s===" "||s===" ";)s=r[--i];return r.substring(0,i+1)}function e(r){return r.split(`
186
- `).map(a=>t(a)).join(`
187
- `)}gv=function(r,i){if(i=i||{},r==null)return r;var s=i.width||50,a=typeof i.indent=="string"?i.indent:" ",o=i.newline||`
188
- `+a,c=typeof i.escape=="function"?i.escape:n,u=".{1,"+s+"}";i.cut!==!0&&(u+="([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)");var l=new RegExp(u,"g"),d=r.match(l)||[],f=a+d.map(function(h){return h.slice(-1)===`
189
- `&&(h=h.slice(0,h.length-1)),c(h)}).join(o);return i.trim===!0&&(f=e(f)),f};function n(r){return r}return gv}var XW=VW();const YW=Ir(XW),lp={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},r)=>{if(!e)return n*2.55;t/=360,e/=100,n/=100;const i=n<.5?n*(1+e):n+e-n*e,s=2*n-i;switch(r){case"r":return lp.hue2rgb(s,i,t+1/3)*255;case"g":return lp.hue2rgb(s,i,t)*255;case"b":return lp.hue2rgb(s,i,t-1/3)*255}},rgb2hsl:({r:t,g:e,b:n},r)=>{t/=255,e/=255,n/=255;const i=Math.max(t,e,n),s=Math.min(t,e,n),a=(i+s)/2;if(r==="l")return a*100;if(i===s)return 0;const o=i-s,c=a>.5?o/(2-i-s):o/(i+s);if(r==="s")return c*100;switch(i){case t:return((e-n)/o+(e<n?6:0))*60;case e:return((n-t)/o+2)*60;case n:return((t-e)/o+4)*60;default:return-1}}},JW={clamp:(t,e,n)=>e>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},QW={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Ie={channel:lp,lang:JW,unit:QW},Mi={};for(let t=0;t<=255;t++)Mi[t]=Ie.unit.dec2hex(t);const an={ALL:0,RGB:1,HSL:2};class ZW{constructor(){this.type=an.ALL}get(){return this.type}set(e){if(this.type&&this.type!==e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=an.ALL}is(e){return this.type===e}}class eH{constructor(e,n){this.color=n,this.changed=!1,this.data=e,this.type=new ZW}set(e,n){return this.color=n,this.changed=!1,this.data=e,this.type.type=an.ALL,this}_ensureHSL(){const e=this.data,{h:n,s:r,l:i}=e;n===void 0&&(e.h=Ie.channel.rgb2hsl(e,"h")),r===void 0&&(e.s=Ie.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=Ie.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r:n,g:r,b:i}=e;n===void 0&&(e.r=Ie.channel.hsl2rgb(e,"r")),r===void 0&&(e.g=Ie.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=Ie.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,n=e.r;return!this.type.is(an.HSL)&&n!==void 0?n:(this._ensureHSL(),Ie.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,n=e.g;return!this.type.is(an.HSL)&&n!==void 0?n:(this._ensureHSL(),Ie.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,n=e.b;return!this.type.is(an.HSL)&&n!==void 0?n:(this._ensureHSL(),Ie.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,n=e.h;return!this.type.is(an.RGB)&&n!==void 0?n:(this._ensureRGB(),Ie.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,n=e.s;return!this.type.is(an.RGB)&&n!==void 0?n:(this._ensureRGB(),Ie.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,n=e.l;return!this.type.is(an.RGB)&&n!==void 0?n:(this._ensureRGB(),Ie.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(an.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(an.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(an.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(an.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(an.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(an.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const yv=new eH({r:0,g:0,b:0,a:0},"transparent"),Wa={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(Wa.re);if(!e)return;const n=e[1],r=parseInt(n,16),i=n.length,s=i%4===0,a=i>4,o=a?1:17,c=a?8:4,u=s?0:-1,l=a?255:15;return yv.set({r:(r>>c*(u+3)&l)*o,g:(r>>c*(u+2)&l)*o,b:(r>>c*(u+1)&l)*o,a:s?(r&l)*o/255:1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`#${Mi[Math.round(e)]}${Mi[Math.round(n)]}${Mi[Math.round(r)]}${Mi[Math.round(i*255)]}`:`#${Mi[Math.round(e)]}${Mi[Math.round(n)]}${Mi[Math.round(r)]}`}},Bs={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(Bs.hueRe);if(e){const[,n,r]=e;switch(r){case"grad":return Ie.channel.clamp.h(parseFloat(n)*.9);case"rad":return Ie.channel.clamp.h(parseFloat(n)*180/Math.PI);case"turn":return Ie.channel.clamp.h(parseFloat(n)*360)}}return Ie.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const n=t.match(Bs.re);if(!n)return;const[,r,i,s,a,o]=n;return yv.set({h:Bs._hue2deg(r),s:Ie.channel.clamp.s(parseFloat(i)),l:Ie.channel.clamp.l(parseFloat(s)),a:a?Ie.channel.clamp.a(o?parseFloat(a)/100:parseFloat(a)):1},t)},stringify:t=>{const{h:e,s:n,l:r,a:i}=t;return i<1?`hsla(${Ie.lang.round(e)}, ${Ie.lang.round(n)}%, ${Ie.lang.round(r)}%, ${i})`:`hsl(${Ie.lang.round(e)}, ${Ie.lang.round(n)}%, ${Ie.lang.round(r)}%)`}},Wl={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=Wl.colors[t];if(e)return Wa.parse(e)},stringify:t=>{const e=Wa.stringify(t);for(const n in Wl.colors)if(Wl.colors[n]===e)return n}},Hl={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(e!==114&&e!==82)return;const n=t.match(Hl.re);if(!n)return;const[,r,i,s,a,o,c,u,l]=n;return yv.set({r:Ie.channel.clamp.r(i?parseFloat(r)*2.55:parseFloat(r)),g:Ie.channel.clamp.g(a?parseFloat(s)*2.55:parseFloat(s)),b:Ie.channel.clamp.b(c?parseFloat(o)*2.55:parseFloat(o)),a:u?Ie.channel.clamp.a(l?parseFloat(u)/100:parseFloat(u)):1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`rgba(${Ie.lang.round(e)}, ${Ie.lang.round(n)}, ${Ie.lang.round(r)}, ${Ie.lang.round(i)})`:`rgb(${Ie.lang.round(e)}, ${Ie.lang.round(n)}, ${Ie.lang.round(r)})`}},zi={format:{keyword:Wl,hex:Wa,rgb:Hl,rgba:Hl,hsl:Bs,hsla:Bs},parse:t=>{if(typeof t!="string")return t;const e=Wa.parse(t)||Hl.parse(t)||Bs.parse(t)||Wl.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(an.HSL)||t.data.r===void 0?Bs.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?Hl.stringify(t):Wa.stringify(t)},tH=(t,e)=>{const n=zi.parse(t);for(const r in e)n[r]=Ie.channel.clamp[r](e[r]);return zi.stringify(n)},m_=t=>zi.format.hex.stringify(zi.parse(t)),nH=(t,e,n)=>{const r=zi.parse(t),i=r[e],s=Ie.channel.clamp[e](i+n);return i!==s&&(r[e]=s),zi.stringify(r)},rH=(t,e)=>nH(t,"a",-.3),iH=(t,e)=>{const n=zi.parse(t),r={};for(const i in e)e[i]&&(r[i]=n[i]+e[i]);return tH(t,r)},sH=(t,e)=>{const n=zi.parse(t),r={},i=(s,a,o)=>a>0?(o-s)*a/100:s*a/100;for(const s in e)r[s]=i(n[s],e[s],Ie.channel.max[s]);return iH(t,r)};function Mn(t){return t.children.length>0}function on(t){switch(t){case"open":return"vee";default:return t}}function xr(t){return Array.isArray(t)?[xr(t[0]),xr(t[1])]:(Ce(isFinite(t),`Invalid not finite point value ${t}`),Math.round(t))}const g_=t=>(Ce(isFinite(t),`Invalid not finite inch value ${t}`),Math.floor(t*72)),dt=t=>Math.ceil(t/72*1e3)/1e3,Yn=t=>Math.ceil(t);Yn(40).toString();function y_(t,e){return m_(sH(t,{l:-35-5*e,s:-15-5*e}))}function aH(t){return m_(rH(t))}function oH(t){return t.trim().replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function v_(t,{maxchars:e,maxLines:n,sanitize:r=cj()}){let i=YW(t,{width:e,indent:"",escape:r}).split(`
190
- `);return Xt(n)&&n>0&&i.length>n&&(i=i.slice(0,n-1)),i}function Us({text:t,maxchars:e,fontsize:n,maxLines:r,bold:i,color:s}){let a=v_(t,{maxchars:e,maxLines:r,sanitize:oH}).join("<BR/>");i&&(a=`<B>${a}</B>`);const o=s?` COLOR="${s}"`:"";return`<FONT POINT-SIZE="${Yn(n)}"${o}>${a}</FONT>`}function vv(t){return qt.textSizes[t]}function cH(t){switch(t){case"xs":case"sm":return 25;case"md":return 35;case"lg":case"xl":return 45;default:Ne(t)}}function uH(t,e,n){const r=["sm","xs"].includes(n.shape),i=ie(t.icon),s=[Us({text:t.title,fontsize:vv(n.text),maxchars:cH(n.shape),maxLines:r?1:3})];if(n.shape!=="xs"&&(ie(t.technology?.trim())&&s.push(Us({text:t.technology,fontsize:Math.ceil(vv(n.text)*.65),maxchars:i?35:45,maxLines:1,color:e.loContrast})),ie(t.description?.trim())&&s.push(Us({text:t.description,fontsize:Math.ceil(vv(n.text)*.75),maxchars:i?35:45,maxLines:r?3:5,color:e.loContrast}))),s.length===1&&!i)return`<${s[0]}>`;const a=i?(o,c,u)=>{let l=`<TD ALIGN="TEXT" BALIGN="LEFT">${o}</TD>`;if(c===0){const d=u.length>1?` ROWSPAN="${u.length}"`:"";let f=76;["xs","sm"].includes(n.shape)&&(f=16),(t.shape==="queue"||t.shape==="mobile")&&(f+=20),l=`<TD${d} WIDTH="${f}"> </TD>${l}`,l=`${l}<TD${d} WIDTH="16"> </TD>`}return`<TR>${l}</TR>`}:o=>`<TR><TD>${o}</TD></TR>`;return`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="4">${s.map(a).join("")}</TABLE>>`}function lH(t,e){const n=Us({text:t.title.toUpperCase(),maxchars:50,fontsize:11,maxLines:1,bold:!0,color:e});return n.includes("<BR/>")?`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="TEXT" BALIGN="LEFT">${n}</TD></TR></TABLE>>`:`<${n}>`}const dp=40,w_=5,wv=`BGCOLOR="${qt.relationships[eo].labelBgColor}A0"`;function b_({label:t,technology:e}){const n=[];if(ie(t?.trim())&&n.push(Us({text:t,maxchars:dp,fontsize:14,maxLines:w_,bold:t==="[...]"})),ie(e?.trim())&&n.push(Us({text:`[ ${e} ]`,fontsize:12,maxLines:1,maxchars:dp})),n.length===0)return null;const r=n.map(i=>`<TR><TD ALIGN="TEXT" BALIGN="LEFT">${i}</TD></TR>`).join("");return`<<TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0" ${wv}>${r}</TABLE>>`}function dH(t,e){const n=`<TABLE BORDER="0" CELLPADDING="6" ${wv}><TR><TD WIDTH="20" HEIGHT="20"><FONT POINT-SIZE="${Yn(14)}"><B>${t}</B></FONT></TD></TR></TABLE>`;return ie(e?.trim())?`<${['<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">',"<TR>",`<TD>${n}</TD>`,`<TD ${wv} CELLPADDING="3">`,Us({text:e,maxchars:dp,fontsize:14,maxLines:5}),"</TD>","</TR>","</TABLE>"].join("")}>`:`<${n}>`}var bv,R_;function Rv(){if(R_)return bv;R_=1;function t(e){if(typeof e!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=e}return typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=function(){return this}),t.of=function(){var e=arguments,n=e.length,r=0;return new t(function(){return r>=n?{done:!0}:{done:!1,value:e[r++]}})},t.empty=function(){var e=new t(function(){return{done:!0}});return e},t.fromSequence=function(e){var n=0,r=e.length;return new t(function(){return n>=r?{done:!0}:{done:!1,value:e[n++]}})},t.is=function(e){return e instanceof t?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},bv=t,bv}var fH=Rv();const Jn=Ir(fH);var fp={},$_;function hH(){return $_||($_=1,fp.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",fp.SYMBOL_SUPPORT=typeof Symbol<"u"),fp}var $v,k_;function T_(){if(k_)return $v;k_=1;var t=Rv(),e=hH(),n=e.ARRAY_BUFFER_SUPPORT,r=e.SYMBOL_SUPPORT;function i(s){return typeof s=="string"||Array.isArray(s)||n&&ArrayBuffer.isView(s)?t.fromSequence(s):typeof s!="object"||s===null?null:r&&typeof s[Symbol.iterator]=="function"?s[Symbol.iterator]():typeof s.next=="function"?s:null}return $v=function(a){var o=i(a);if(!o)throw new Error("obliterator: target is not iterable nor a valid iterator.");return o},$v}var kv,E_;function pH(){if(E_)return kv;E_=1;var t=T_();return kv=function(n,r){for(var i=arguments.length>1?r:1/0,s=i!==1/0?new Array(i):[],a,o=0,c=t(n);;){if(o===i)return s;if(a=c.next(),a.done)return o!==r&&(s.length=o),s;s[o++]=a.value}},kv}var mH=pH();const S_=Ir(mH);var Tv,__;function gH(){if(__)return Tv;__=1;var t=Rv(),e=T_();return Tv=function(){var r=arguments,i=null,s=-1;return new t(function(){var o=null;do{if(i===null){if(s++,s>=r.length)return{done:!0};i=e(r[s])}if(o=i.next(),o.done===!0){i=null;continue}break}while(!0);return o})},Tv}var yH=gH();const oi=Ir(yH);function vH(){const t=arguments[0];for(let e=1,n=arguments.length;e<n;e++)if(arguments[e])for(const r in arguments[e])t[r]=arguments[e][r];return t}let Mt=vH;typeof Object.assign=="function"&&(Mt=Object.assign);function Qn(t,e,n,r){const i=t._nodes.get(e);let s=null;return i&&(r==="mixed"?s=i.out&&i.out[n]||i.undirected&&i.undirected[n]:r==="directed"?s=i.out&&i.out[n]:s=i.undirected&&i.undirected[n]),s}function Jt(t){return typeof t=="object"&&t!==null}function A_(t){let e;for(e in t)return!1;return!0}function Zn(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function fr(t,e,n){const r={enumerable:!0,configurable:!0};typeof n=="function"?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(t,e,r)}function C_(t){return!(!Jt(t)||t.attributes&&!Array.isArray(t.attributes))}function wH(){let t=Math.floor(Math.random()*256)&255;return()=>t++}class Ev extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class he extends Ev{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,he.prototype.constructor)}}class se extends Ev{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,se.prototype.constructor)}}class Ee extends Ev{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Ee.prototype.constructor)}}function P_(t,e){this.key=t,this.attributes=e,this.clear()}P_.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function x_(t,e){this.key=t,this.attributes=e,this.clear()}x_.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function N_(t,e){this.key=t,this.attributes=e,this.clear()}N_.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ha(t,e,n,r,i){this.key=e,this.attributes=i,this.undirected=t,this.source=n,this.target=r}Ha.prototype.attach=function(){let t="out",e="in";this.undirected&&(t=e="undirected");const n=this.source.key,r=this.target.key;this.source[t][r]=this,!(this.undirected&&n===r)&&(this.target[e][n]=this)},Ha.prototype.attachMulti=function(){let t="out",e="in";const n=this.source.key,r=this.target.key;this.undirected&&(t=e="undirected");const i=this.source[t],s=i[r];if(typeof s>"u"){i[r]=this,this.undirected&&n===r||(this.target[e][n]=this);return}s.previous=this,this.next=s,i[r]=this,this.target[e][n]=this},Ha.prototype.detach=function(){const t=this.source.key,e=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][e],delete this.target[r][t]},Ha.prototype.detachMulti=function(){const t=this.source.key,e=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[n][e],delete this.target[r][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[r][t]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const D_=0,I_=1,bH=2,O_=3;function ci(t,e,n,r,i,s,a){let o,c,u,l;if(r=""+r,n===D_){if(o=t._nodes.get(r),!o)throw new se(`Graph.${e}: could not find the "${r}" node in the graph.`);u=i,l=s}else if(n===O_){if(i=""+i,c=t._edges.get(i),!c)throw new se(`Graph.${e}: could not find the "${i}" edge in the graph.`);const d=c.source.key,f=c.target.key;if(r===d)o=c.target;else if(r===f)o=c.source;else throw new se(`Graph.${e}: the "${r}" node is not attached to the "${i}" edge (${d}, ${f}).`);u=s,l=a}else{if(c=t._edges.get(r),!c)throw new se(`Graph.${e}: could not find the "${r}" edge in the graph.`);n===I_?o=c.source:o=c.target,u=i,l=s}return[o,u,l]}function RH(t,e,n){t.prototype[e]=function(r,i,s){const[a,o]=ci(this,e,n,r,i,s);return a.attributes[o]}}function $H(t,e,n){t.prototype[e]=function(r,i){const[s]=ci(this,e,n,r,i);return s.attributes}}function kH(t,e,n){t.prototype[e]=function(r,i,s){const[a,o]=ci(this,e,n,r,i,s);return a.attributes.hasOwnProperty(o)}}function TH(t,e,n){t.prototype[e]=function(r,i,s,a){const[o,c,u]=ci(this,e,n,r,i,s,a);return o.attributes[c]=u,this.emit("nodeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:c}),this}}function EH(t,e,n){t.prototype[e]=function(r,i,s,a){const[o,c,u]=ci(this,e,n,r,i,s,a);if(typeof u!="function")throw new he(`Graph.${e}: updater should be a function.`);const l=o.attributes,d=u(l[c]);return l[c]=d,this.emit("nodeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:c}),this}}function SH(t,e,n){t.prototype[e]=function(r,i,s){const[a,o]=ci(this,e,n,r,i,s);return delete a.attributes[o],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:o}),this}}function _H(t,e,n){t.prototype[e]=function(r,i,s){const[a,o]=ci(this,e,n,r,i,s);if(!Jt(o))throw new he(`Graph.${e}: provided attributes are not a plain object.`);return a.attributes=o,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function AH(t,e,n){t.prototype[e]=function(r,i,s){const[a,o]=ci(this,e,n,r,i,s);if(!Jt(o))throw new he(`Graph.${e}: provided attributes are not a plain object.`);return Mt(a.attributes,o),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:o}),this}}function CH(t,e,n){t.prototype[e]=function(r,i,s){const[a,o]=ci(this,e,n,r,i,s);if(typeof o!="function")throw new he(`Graph.${e}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const PH=[{name:t=>`get${t}Attribute`,attacher:RH},{name:t=>`get${t}Attributes`,attacher:$H},{name:t=>`has${t}Attribute`,attacher:kH},{name:t=>`set${t}Attribute`,attacher:TH},{name:t=>`update${t}Attribute`,attacher:EH},{name:t=>`remove${t}Attribute`,attacher:SH},{name:t=>`replace${t}Attributes`,attacher:_H},{name:t=>`merge${t}Attributes`,attacher:AH},{name:t=>`update${t}Attributes`,attacher:CH}];function xH(t){PH.forEach(function({name:e,attacher:n}){n(t,e("Node"),D_),n(t,e("Source"),I_),n(t,e("Target"),bH),n(t,e("Opposite"),O_)})}function NH(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ee(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ee(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+r,o=""+i;if(i=arguments[2],s=Qn(this,a,o,n),!s)throw new se(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!=="mixed")throw new Ee(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new se(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return s.attributes[i]}}function DH(t,e,n){t.prototype[e]=function(r){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ee(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new Ee(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+r,a=""+arguments[1];if(i=Qn(this,s,a,n),!i)throw new se(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new Ee(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new se(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return i.attributes}}function IH(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ee(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ee(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+r,o=""+i;if(i=arguments[2],s=Qn(this,a,o,n),!s)throw new se(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!=="mixed")throw new Ee(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new se(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return s.attributes.hasOwnProperty(i)}}function OH(t,e,n){t.prototype[e]=function(r,i,s){let a;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ee(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Ee(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+r,c=""+i;if(i=arguments[2],s=arguments[3],a=Qn(this,o,c,n),!a)throw new se(`Graph.${e}: could not find an edge for the given path ("${o}" - "${c}").`)}else{if(n!=="mixed")throw new Ee(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,a=this._edges.get(r),!a)throw new se(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return a.attributes[i]=s,this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:i}),this}}function LH(t,e,n){t.prototype[e]=function(r,i,s){let a;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ee(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Ee(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+r,c=""+i;if(i=arguments[2],s=arguments[3],a=Qn(this,o,c,n),!a)throw new se(`Graph.${e}: could not find an edge for the given path ("${o}" - "${c}").`)}else{if(n!=="mixed")throw new Ee(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,a=this._edges.get(r),!a)throw new se(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(typeof s!="function")throw new he(`Graph.${e}: updater should be a function.`);return a.attributes[i]=s(a.attributes[i]),this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:i}),this}}function MH(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ee(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ee(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+r,o=""+i;if(i=arguments[2],s=Qn(this,a,o,n),!s)throw new se(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!=="mixed")throw new Ee(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new se(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return delete s.attributes[i],this.emit("edgeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:i}),this}}function zH(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ee(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ee(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+r,o=""+i;if(i=arguments[2],s=Qn(this,a,o,n),!s)throw new se(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!=="mixed")throw new Ee(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new se(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(!Jt(i))throw new he(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function FH(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ee(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ee(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+r,o=""+i;if(i=arguments[2],s=Qn(this,a,o,n),!s)throw new se(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!=="mixed")throw new Ee(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new se(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(!Jt(i))throw new he(`Graph.${e}: provided attributes are not a plain object.`);return Mt(s.attributes,i),this.emit("edgeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:i}),this}}function qH(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ee(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ee(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+r,o=""+i;if(i=arguments[2],s=Qn(this,a,o,n),!s)throw new se(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!=="mixed")throw new Ee(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new se(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(typeof i!="function")throw new he(`Graph.${e}: provided updater is not a function.`);return s.attributes=i(s.attributes),this.emit("edgeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const GH=[{name:t=>`get${t}Attribute`,attacher:NH},{name:t=>`get${t}Attributes`,attacher:DH},{name:t=>`has${t}Attribute`,attacher:IH},{name:t=>`set${t}Attribute`,attacher:OH},{name:t=>`update${t}Attribute`,attacher:LH},{name:t=>`remove${t}Attribute`,attacher:MH},{name:t=>`replace${t}Attributes`,attacher:zH},{name:t=>`merge${t}Attributes`,attacher:FH},{name:t=>`update${t}Attributes`,attacher:qH}];function jH(t){GH.forEach(function({name:e,attacher:n}){n(t,e("Edge"),"mixed"),n(t,e("DirectedEdge"),"directed"),n(t,e("UndirectedEdge"),"undirected")})}const BH=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function UH(t,e,n,r){let i=!1;for(const s in e){if(s===r)continue;const a=e[s];if(i=n(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),t&&i)return a.key}}function WH(t,e,n,r){let i,s,a,o=!1;for(const c in e)if(c!==r){i=e[c];do{if(s=i.source,a=i.target,o=n(i.key,i.attributes,s.key,a.key,s.attributes,a.attributes,i.undirected),t&&o)return i.key;i=i.next}while(i!==void 0)}}function Sv(t,e){const n=Object.keys(t),r=n.length;let i,s=0;return new Jn(function(){do if(i)i=i.next;else{if(s>=r)return{done:!0};const o=n[s++];if(o===e){i=void 0;continue}i=t[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}})}function HH(t,e,n,r){const i=e[n];if(!i)return;const s=i.source,a=i.target;if(r(i.key,i.attributes,s.key,a.key,s.attributes,a.attributes,i.undirected)&&t)return i.key}function KH(t,e,n,r){let i=e[n];if(!i)return;let s=!1;do{if(s=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),t&&s)return i.key;i=i.next}while(i!==void 0)}function _v(t,e){let n=t[e];return n.next!==void 0?new Jn(function(){if(!n)return{done:!0};const r={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:r}}):Jn.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function VH(t,e){if(t.size===0)return[];if(e==="mixed"||e===t.type)return typeof Array.from=="function"?Array.from(t._edges.keys()):S_(t._edges.keys(),t._edges.size);const n=e==="undirected"?t.undirectedSize:t.directedSize,r=new Array(n),i=e==="undirected",s=t._edges.values();let a=0,o,c;for(;o=s.next(),o.done!==!0;)c=o.value,c.undirected===i&&(r[a++]=c.key);return r}function L_(t,e,n,r){if(e.size===0)return;const i=n!=="mixed"&&n!==e.type,s=n==="undirected";let a,o,c=!1;const u=e._edges.values();for(;a=u.next(),a.done!==!0;){if(o=a.value,i&&o.undirected!==s)continue;const{key:l,attributes:d,source:f,target:h}=o;if(c=r(l,d,f.key,h.key,f.attributes,h.attributes,o.undirected),t&&c)return l}}function XH(t,e){if(t.size===0)return Jn.empty();const n=e!=="mixed"&&e!==t.type,r=e==="undirected",i=t._edges.values();return new Jn(function(){let a,o;for(;;){if(a=i.next(),a.done)return a;if(o=a.value,!(n&&o.undirected!==r))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}})}function Av(t,e,n,r,i,s){const a=e?WH:UH;let o;if(n!=="undirected"&&(r!=="out"&&(o=a(t,i.in,s),t&&o)||r!=="in"&&(o=a(t,i.out,s,r?void 0:i.key),t&&o))||n!=="directed"&&(o=a(t,i.undirected,s),t&&o))return o}function YH(t,e,n,r){const i=[];return Av(!1,t,e,n,r,function(s){i.push(s)}),i}function JH(t,e,n){let r=Jn.empty();return t!=="undirected"&&(e!=="out"&&typeof n.in<"u"&&(r=oi(r,Sv(n.in))),e!=="in"&&typeof n.out<"u"&&(r=oi(r,Sv(n.out,e?void 0:n.key)))),t!=="directed"&&typeof n.undirected<"u"&&(r=oi(r,Sv(n.undirected))),r}function Cv(t,e,n,r,i,s,a){const o=n?KH:HH;let c;if(e!=="undirected"&&(typeof i.in<"u"&&r!=="out"&&(c=o(t,i.in,s,a),t&&c)||typeof i.out<"u"&&r!=="in"&&(r||i.key!==s)&&(c=o(t,i.out,s,a),t&&c))||e!=="directed"&&typeof i.undirected<"u"&&(c=o(t,i.undirected,s,a),t&&c))return c}function QH(t,e,n,r,i){const s=[];return Cv(!1,t,e,n,r,i,function(a){s.push(a)}),s}function ZH(t,e,n,r){let i=Jn.empty();return t!=="undirected"&&(typeof n.in<"u"&&e!=="out"&&r in n.in&&(i=oi(i,_v(n.in,r))),typeof n.out<"u"&&e!=="in"&&r in n.out&&(e||n.key!==r)&&(i=oi(i,_v(n.out,r)))),t!=="directed"&&typeof n.undirected<"u"&&r in n.undirected&&(i=oi(i,_v(n.undirected,r))),i}function e4(t,e){const{name:n,type:r,direction:i}=e;t.prototype[n]=function(s,a){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];if(!arguments.length)return VH(this,r);if(arguments.length===1){s=""+s;const o=this._nodes.get(s);if(typeof o>"u")throw new se(`Graph.${n}: could not find the "${s}" node in the graph.`);return YH(this.multi,r==="mixed"?this.type:r,i,o)}if(arguments.length===2){s=""+s,a=""+a;const o=this._nodes.get(s);if(!o)throw new se(`Graph.${n}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(a))throw new se(`Graph.${n}: could not find the "${a}" target node in the graph.`);return QH(r,this.multi,i,o,a)}throw new he(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function t4(t,e){const{name:n,type:r,direction:i}=e,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(u,l,d){if(!(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)){if(arguments.length===1)return d=u,L_(!1,this,r,d);if(arguments.length===2){u=""+u,d=l;const f=this._nodes.get(u);if(typeof f>"u")throw new se(`Graph.${s}: could not find the "${u}" node in the graph.`);return Av(!1,this.multi,r==="mixed"?this.type:r,i,f,d)}if(arguments.length===3){u=""+u,l=""+l;const f=this._nodes.get(u);if(!f)throw new se(`Graph.${s}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(l))throw new se(`Graph.${s}: could not find the "${l}" target node in the graph.`);return Cv(!1,r,this.multi,i,f,l,d)}throw new he(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const a="map"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(){const u=Array.prototype.slice.call(arguments),l=u.pop();let d;if(u.length===0){let f=0;r!=="directed"&&(f+=this.undirectedSize),r!=="undirected"&&(f+=this.directedSize),d=new Array(f);let h=0;u.push((m,y,R,w,k,E,_)=>{d[h++]=l(m,y,R,w,k,E,_)})}else d=[],u.push((f,h,m,y,R,w,k)=>{d.push(l(f,h,m,y,R,w,k))});return this[s].apply(this,u),d};const o="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),l=u.pop(),d=[];return u.push((f,h,m,y,R,w,k)=>{l(f,h,m,y,R,w,k)&&d.push(f)}),this[s].apply(this,u),d};const c="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[c]=function(){let u=Array.prototype.slice.call(arguments);if(u.length<2||u.length>4)throw new he(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${u.length}).`);if(typeof u[u.length-1]=="function"&&typeof u[u.length-2]!="function")throw new he(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let l,d;u.length===2?(l=u[0],d=u[1],u=[]):u.length===3?(l=u[1],d=u[2],u=[u[0]]):u.length===4&&(l=u[2],d=u[3],u=[u[0],u[1]]);let f=d;return u.push((h,m,y,R,w,k,E)=>{f=l(f,h,m,y,R,w,k,E)}),this[s].apply(this,u),f}}function n4(t,e){const{name:n,type:r,direction:i}=e,s="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(c,u,l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return!1;if(arguments.length===1)return l=c,L_(!0,this,r,l);if(arguments.length===2){c=""+c,l=u;const d=this._nodes.get(c);if(typeof d>"u")throw new se(`Graph.${s}: could not find the "${c}" node in the graph.`);return Av(!0,this.multi,r==="mixed"?this.type:r,i,d,l)}if(arguments.length===3){c=""+c,u=""+u;const d=this._nodes.get(c);if(!d)throw new se(`Graph.${s}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(u))throw new se(`Graph.${s}: could not find the "${u}" target node in the graph.`);return Cv(!0,r,this.multi,i,d,u,l)}throw new he(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const a="some"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),u=c.pop();return c.push((d,f,h,m,y,R,w)=>u(d,f,h,m,y,R,w)),!!this[s].apply(this,c)};const o="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(){const c=Array.prototype.slice.call(arguments),u=c.pop();return c.push((d,f,h,m,y,R,w)=>!u(d,f,h,m,y,R,w)),!this[s].apply(this,c)}}function r4(t,e){const{name:n,type:r,direction:i}=e,s=n.slice(0,-1)+"Entries";t.prototype[s]=function(a,o){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Jn.empty();if(!arguments.length)return XH(this,r);if(arguments.length===1){a=""+a;const c=this._nodes.get(a);if(!c)throw new se(`Graph.${s}: could not find the "${a}" node in the graph.`);return JH(r,i,c)}if(arguments.length===2){a=""+a,o=""+o;const c=this._nodes.get(a);if(!c)throw new se(`Graph.${s}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new se(`Graph.${s}: could not find the "${o}" target node in the graph.`);return ZH(r,i,c,o)}throw new he(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function i4(t){BH.forEach(e=>{e4(t,e),t4(t,e),n4(t,e),r4(t,e)})}const s4=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function hp(){this.A=null,this.B=null}hp.prototype.wrap=function(t){this.A===null?this.A=t:this.B===null&&(this.B=t)},hp.prototype.has=function(t){return this.A!==null&&t in this.A||this.B!==null&&t in this.B};function Kl(t,e,n,r,i){for(const s in r){const a=r[s],o=a.source,c=a.target,u=o===n?c:o;if(e&&e.has(u.key))continue;const l=i(u.key,u.attributes);if(t&&l)return u.key}}function Pv(t,e,n,r,i){if(e!=="mixed"){if(e==="undirected")return Kl(t,null,r,r.undirected,i);if(typeof n=="string")return Kl(t,null,r,r[n],i)}const s=new hp;let a;if(e!=="undirected"){if(n!=="out"){if(a=Kl(t,null,r,r.in,i),t&&a)return a;s.wrap(r.in)}if(n!=="in"){if(a=Kl(t,s,r,r.out,i),t&&a)return a;s.wrap(r.out)}}if(e!=="directed"&&(a=Kl(t,s,r,r.undirected,i),t&&a))return a}function a4(t,e,n){if(t!=="mixed"){if(t==="undirected")return Object.keys(n.undirected);if(typeof e=="string")return Object.keys(n[e])}const r=[];return Pv(!1,t,e,n,function(i){r.push(i)}),r}function Vl(t,e,n){const r=Object.keys(n),i=r.length;let s=0;return new Jn(function(){let o=null;do{if(s>=i)return t&&t.wrap(n),{done:!0};const c=n[r[s++]],u=c.source,l=c.target;if(o=u===e?l:u,t&&t.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}})}function o4(t,e,n){if(t!=="mixed"){if(t==="undirected")return Vl(null,n,n.undirected);if(typeof e=="string")return Vl(null,n,n[e])}let r=Jn.empty();const i=new hp;return t!=="undirected"&&(e!=="out"&&(r=oi(r,Vl(i,n,n.in))),e!=="in"&&(r=oi(r,Vl(i,n,n.out)))),t!=="directed"&&(r=oi(r,Vl(i,n,n.undirected))),r}function c4(t,e){const{name:n,type:r,direction:i}=e;t.prototype[n]=function(s){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];s=""+s;const a=this._nodes.get(s);if(typeof a>"u")throw new se(`Graph.${n}: could not find the "${s}" node in the graph.`);return a4(r==="mixed"?this.type:r,i,a)}}function u4(t,e){const{name:n,type:r,direction:i}=e,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(u,l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;u=""+u;const d=this._nodes.get(u);if(typeof d>"u")throw new se(`Graph.${s}: could not find the "${u}" node in the graph.`);Pv(!1,r==="mixed"?this.type:r,i,d,l)};const a="map"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(u,l){const d=[];return this[s](u,(f,h)=>{d.push(l(f,h))}),d};const o="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[o]=function(u,l){const d=[];return this[s](u,(f,h)=>{l(f,h)&&d.push(f)}),d};const c="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[c]=function(u,l,d){if(arguments.length<3)throw new he(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let f=d;return this[s](u,(h,m)=>{f=l(f,h,m)}),f}}function l4(t,e){const{name:n,type:r,direction:i}=e,s=n[0].toUpperCase()+n.slice(1,-1),a="find"+s;t.prototype[a]=function(u,l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;u=""+u;const d=this._nodes.get(u);if(typeof d>"u")throw new se(`Graph.${a}: could not find the "${u}" node in the graph.`);return Pv(!0,r==="mixed"?this.type:r,i,d,l)};const o="some"+s;t.prototype[o]=function(u,l){return!!this[a](u,l)};const c="every"+s;t.prototype[c]=function(u,l){return!this[a](u,(f,h)=>!l(f,h))}}function d4(t,e){const{name:n,type:r,direction:i}=e,s=n.slice(0,-1)+"Entries";t.prototype[s]=function(a){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Jn.empty();a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new se(`Graph.${s}: could not find the "${a}" node in the graph.`);return o4(r==="mixed"?this.type:r,i,o)}}function f4(t){s4.forEach(e=>{c4(t,e),u4(t,e),l4(t,e),d4(t,e)})}function pp(t,e,n,r,i){const s=r._nodes.values(),a=r.type;let o,c,u,l,d,f;for(;o=s.next(),o.done!==!0;){let h=!1;if(c=o.value,a!=="undirected"){l=c.out;for(u in l){d=l[u];do f=d.target,h=!0,i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}if(a!=="directed"){l=c.undirected;for(u in l)if(!(e&&c.key>u)){d=l[u];do f=d.target,f.key!==u&&(f=d.source),h=!0,i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}n&&!h&&i(c.key,null,c.attributes,null,null,null,null)}}function h4(t,e){const n={key:t};return A_(e.attributes)||(n.attributes=Mt({},e.attributes)),n}function p4(t,e,n){const r={key:e,source:n.source.key,target:n.target.key};return A_(n.attributes)||(r.attributes=Mt({},n.attributes)),t==="mixed"&&n.undirected&&(r.undirected=!0),r}function m4(t){if(!Jt(t))throw new he('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new he("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!Jt(t.attributes)||t.attributes===null))throw new he("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function g4(t){if(!Jt(t))throw new he('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new he("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new he("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!Jt(t.attributes)||t.attributes===null))throw new he("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&typeof t.undirected!="boolean")throw new he("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const y4=wH(),v4=new Set(["directed","undirected","mixed"]),M_=new Set(["domain","_events","_eventsCount","_maxListeners"]),w4=[{name:t=>`${t}Edge`,generateKey:!0},{name:t=>`${t}DirectedEdge`,generateKey:!0,type:"directed"},{name:t=>`${t}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:t=>`${t}EdgeWithKey`},{name:t=>`${t}DirectedEdgeWithKey`,type:"directed"},{name:t=>`${t}UndirectedEdgeWithKey`,type:"undirected"}],b4={allowSelfLoops:!0,multi:!1,type:"mixed"};function R4(t,e,n){if(n&&!Jt(n))throw new he(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(e=""+e,n=n||{},t._nodes.has(e))throw new Ee(`Graph.addNode: the "${e}" node already exist in the graph.`);const r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}function z_(t,e,n){const r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}function F_(t,e,n,r,i,s,a,o){if(!r&&t.type==="undirected")throw new Ee(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&t.type==="directed")throw new Ee(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(o&&!Jt(o))throw new he(`Graph.${e}: invalid attributes. Expecting an object but got "${o}"`);if(s=""+s,a=""+a,o=o||{},!t.allowSelfLoops&&s===a)throw new Ee(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const c=t._nodes.get(s),u=t._nodes.get(a);if(!c)throw new se(`Graph.${e}: source node "${s}" not found.`);if(!u)throw new se(`Graph.${e}: target node "${a}" not found.`);const l={key:null,undirected:r,source:s,target:a,attributes:o};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new Ee(`Graph.${e}: the "${i}" edge already exists in the graph.`);if(!t.multi&&(r?typeof c.undirected[a]<"u":typeof c.out[a]<"u"))throw new Ee(`Graph.${e}: an edge linking "${s}" to "${a}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const d=new Ha(r,i,c,u,o);t._edges.set(i,d);const f=s===a;return r?(c.undirectedDegree++,u.undirectedDegree++,f&&(c.undirectedLoops++,t._undirectedSelfLoopCount++)):(c.outDegree++,u.inDegree++,f&&(c.directedLoops++,t._directedSelfLoopCount++)),t.multi?d.attachMulti():d.attach(),r?t._undirectedSize++:t._directedSize++,l.key=i,t.emit("edgeAdded",l),i}function $4(t,e,n,r,i,s,a,o,c){if(!r&&t.type==="undirected")throw new Ee(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&t.type==="directed")throw new Ee(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(o){if(c){if(typeof o!="function")throw new he(`Graph.${e}: invalid updater function. Expecting a function but got "${o}"`)}else if(!Jt(o))throw new he(`Graph.${e}: invalid attributes. Expecting an object but got "${o}"`)}s=""+s,a=""+a;let u;if(c&&(u=o,o=void 0),!t.allowSelfLoops&&s===a)throw new Ee(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let l=t._nodes.get(s),d=t._nodes.get(a),f,h;if(!n&&(f=t._edges.get(i),f)){if((f.source.key!==s||f.target.key!==a)&&(!r||f.source.key!==a||f.target.key!==s))throw new Ee(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${s}" source & "${a}" target vs. ("${f.source.key}", "${f.target.key}").`);h=f}if(!h&&!t.multi&&l&&(h=r?l.undirected[a]:l.out[a]),h){const k=[h.key,!1,!1,!1];if(c?!u:!o)return k;if(c){const E=h.attributes;h.attributes=u(E),t.emit("edgeAttributesUpdated",{type:"replace",key:h.key,attributes:h.attributes})}else Mt(h.attributes,o),t.emit("edgeAttributesUpdated",{type:"merge",key:h.key,attributes:h.attributes,data:o});return k}o=o||{},c&&u&&(o=u(o));const m={key:null,undirected:r,source:s,target:a,attributes:o};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new Ee(`Graph.${e}: the "${i}" edge already exists in the graph.`);let y=!1,R=!1;l||(l=z_(t,s,{}),y=!0,s===a&&(d=l,R=!0)),d||(d=z_(t,a,{}),R=!0),f=new Ha(r,i,l,d,o),t._edges.set(i,f);const w=s===a;return r?(l.undirectedDegree++,d.undirectedDegree++,w&&(l.undirectedLoops++,t._undirectedSelfLoopCount++)):(l.outDegree++,d.inDegree++,w&&(l.directedLoops++,t._directedSelfLoopCount++)),t.multi?f.attachMulti():f.attach(),r?t._undirectedSize++:t._directedSize++,m.key=i,t.emit("edgeAdded",m),[i,!0,y,R]}function Ka(t,e){t._edges.delete(e.key);const{source:n,target:r,attributes:i}=e,s=e.undirected,a=n===r;s?(n.undirectedDegree--,r.undirectedDegree--,a&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,a&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),s?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:i,source:n.key,target:r.key,undirected:s})}class it extends bC{constructor(e){if(super(),e=Mt({},b4,e),typeof e.multi!="boolean")throw new he(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!v4.has(e.type))throw new he(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new he(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const n=e.type==="mixed"?P_:e.type==="directed"?x_:N_;Zn(this,"NodeDataClass",n);const r="geid_"+y4()+"_";let i=0;const s=()=>{let a;do a=r+i++;while(this._edges.has(a));return a};Zn(this,"_attributes",{}),Zn(this,"_nodes",new Map),Zn(this,"_edges",new Map),Zn(this,"_directedSize",0),Zn(this,"_undirectedSize",0),Zn(this,"_directedSelfLoopCount",0),Zn(this,"_undirectedSelfLoopCount",0),Zn(this,"_edgeKeyGenerator",s),Zn(this,"_options",e),M_.forEach(a=>Zn(this,a,this[a])),fr(this,"order",()=>this._nodes.size),fr(this,"size",()=>this._edges.size),fr(this,"directedSize",()=>this._directedSize),fr(this,"undirectedSize",()=>this._undirectedSize),fr(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),fr(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),fr(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),fr(this,"multi",this._options.multi),fr(this,"type",this._options.type),fr(this,"allowSelfLoops",this._options.allowSelfLoops),fr(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,n){if(this.type==="undirected")return!1;if(arguments.length===1){const r=""+e,i=this._edges.get(r);return!!i&&!i.undirected}else if(arguments.length===2){e=""+e,n=""+n;const r=this._nodes.get(e);return r?r.out.hasOwnProperty(n):!1}throw new he(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,n){if(this.type==="directed")return!1;if(arguments.length===1){const r=""+e,i=this._edges.get(r);return!!i&&i.undirected}else if(arguments.length===2){e=""+e,n=""+n;const r=this._nodes.get(e);return r?r.undirected.hasOwnProperty(n):!1}throw new he(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,n){if(arguments.length===1){const r=""+e;return this._edges.has(r)}else if(arguments.length===2){e=""+e,n=""+n;const r=this._nodes.get(e);return r?typeof r.out<"u"&&r.out.hasOwnProperty(n)||typeof r.undirected<"u"&&r.undirected.hasOwnProperty(n):!1}throw new he(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,n){if(this.type==="undirected")return;if(e=""+e,n=""+n,this.multi)throw new Ee("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const r=this._nodes.get(e);if(!r)throw new se(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(n))throw new se(`Graph.directedEdge: could not find the "${n}" target node in the graph.`);const i=r.out&&r.out[n]||void 0;if(i)return i.key}undirectedEdge(e,n){if(this.type==="directed")return;if(e=""+e,n=""+n,this.multi)throw new Ee("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const r=this._nodes.get(e);if(!r)throw new se(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(n))throw new se(`Graph.undirectedEdge: could not find the "${n}" target node in the graph.`);const i=r.undirected&&r.undirected[n]||void 0;if(i)return i.key}edge(e,n){if(this.multi)throw new Ee("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new se(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(n))throw new se(`Graph.edge: could not find the "${n}" target node in the graph.`);const i=r.out&&r.out[n]||r.undirected&&r.undirected[n]||void 0;if(i)return i.key}areDirectedNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new se(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:n in r.in||n in r.out}areOutNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new se(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:n in r.out}areInNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new se(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:n in r.in}areUndirectedNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new se(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:n in r.undirected}areNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new se(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(n in r.in||n in r.out)||this.type!=="directed"&&n in r.undirected}areInboundNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new se(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&n in r.in||this.type!=="directed"&&n in r.undirected}areOutboundNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new se(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&n in r.out||this.type!=="directed"&&n in r.undirected}inDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.inDegree}outDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.outDegree}directedDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.inDegree+n.outDegree}undirectedDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:n.undirectedDegree}inboundDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.inDegree),r}outboundDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.outDegree),r}degree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.degree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.inDegree+n.outDegree),r}inDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.inDegree-n.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.outDegree-n.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.inDegree+n.outDegree-n.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:n.undirectedDegree-n.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=n.undirectedDegree,i+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.inDegree,i+=n.directedLoops),r-i}outboundDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=n.undirectedDegree,i+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.outDegree,i+=n.directedLoops),r-i}degreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=n.undirectedDegree,i+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.inDegree+n.outDegree,i+=n.directedLoops*2),r-i}source(e){e=""+e;const n=this._edges.get(e);if(!n)throw new se(`Graph.source: could not find the "${e}" edge in the graph.`);return n.source.key}target(e){e=""+e;const n=this._edges.get(e);if(!n)throw new se(`Graph.target: could not find the "${e}" edge in the graph.`);return n.target.key}extremities(e){e=""+e;const n=this._edges.get(e);if(!n)throw new se(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[n.source.key,n.target.key]}opposite(e,n){e=""+e,n=""+n;const r=this._edges.get(n);if(!r)throw new se(`Graph.opposite: could not find the "${n}" edge in the graph.`);const i=r.source.key,s=r.target.key;if(e===i)return s;if(e===s)return i;throw new se(`Graph.opposite: the "${e}" node is not attached to the "${n}" edge (${i}, ${s}).`)}hasExtremity(e,n){e=""+e,n=""+n;const r=this._edges.get(e);if(!r)throw new se(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return r.source.key===n||r.target.key===n}isUndirected(e){e=""+e;const n=this._edges.get(e);if(!n)throw new se(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return n.undirected}isDirected(e){e=""+e;const n=this._edges.get(e);if(!n)throw new se(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!n.undirected}isSelfLoop(e){e=""+e;const n=this._edges.get(e);if(!n)throw new se(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return n.source===n.target}addNode(e,n){return R4(this,e,n).key}mergeNode(e,n){if(n&&!Jt(n))throw new he(`Graph.mergeNode: invalid attributes. Expecting an object but got "${n}"`);e=""+e,n=n||{};let r=this._nodes.get(e);return r?(n&&(Mt(r.attributes,n),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:r.attributes,data:n})),[e,!1]):(r=new this.NodeDataClass(e,n),this._nodes.set(e,r),this.emit("nodeAdded",{key:e,attributes:n}),[e,!0])}updateNode(e,n){if(n&&typeof n!="function")throw new he(`Graph.updateNode: invalid updater function. Expecting a function but got "${n}"`);e=""+e;let r=this._nodes.get(e);if(r){if(n){const s=r.attributes;r.attributes=n(s),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:r.attributes})}return[e,!1]}const i=n?n({}):{};return r=new this.NodeDataClass(e,i),this._nodes.set(e,r),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]}dropNode(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new se(`Graph.dropNode: could not find the "${e}" node in the graph.`);let r;if(this.type!=="undirected"){for(const i in n.out){r=n.out[i];do Ka(this,r),r=r.next;while(r)}for(const i in n.in){r=n.in[i];do Ka(this,r),r=r.next;while(r)}}if(this.type!=="directed")for(const i in n.undirected){r=n.undirected[i];do Ka(this,r),r=r.next;while(r)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:n.attributes})}dropEdge(e){let n;if(arguments.length>1){const r=""+arguments[0],i=""+arguments[1];if(n=Qn(this,r,i,this.type),!n)throw new se(`Graph.dropEdge: could not find the "${r}" -> "${i}" edge in the graph.`)}else if(e=""+e,n=this._edges.get(e),!n)throw new se(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return Ka(this,n),this}dropDirectedEdge(e,n){if(arguments.length<2)throw new Ee("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new Ee("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,n=""+n;const r=Qn(this,e,n,"directed");if(!r)throw new se(`Graph.dropDirectedEdge: could not find a "${e}" -> "${n}" edge in the graph.`);return Ka(this,r),this}dropUndirectedEdge(e,n){if(arguments.length<2)throw new Ee("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new Ee("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const r=Qn(this,e,n,"undirected");if(!r)throw new se(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${n}" edge in the graph.`);return Ka(this,r),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let n;for(;n=e.next(),n.done!==!0;)n.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,n){return this._attributes[e]=n,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,n){if(typeof n!="function")throw new he("Graph.updateAttribute: updater should be a function.");const r=this._attributes[e];return this._attributes[e]=n(r),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!Jt(e))throw new he("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!Jt(e))throw new he("Graph.mergeAttributes: provided attributes are not a plain object.");return Mt(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new he("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,n){if(typeof e!="function")throw new he("Graph.updateEachNodeAttributes: expecting an updater function.");if(n&&!C_(n))throw new he("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._nodes.values();let i,s;for(;i=r.next(),i.done!==!0;)s=i.value,s.attributes=e(s.key,s.attributes);this.emit("eachNodeAttributesUpdated",{hints:n||null})}updateEachEdgeAttributes(e,n){if(typeof e!="function")throw new he("Graph.updateEachEdgeAttributes: expecting an updater function.");if(n&&!C_(n))throw new he("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._edges.values();let i,s,a,o;for(;i=r.next(),i.done!==!0;)s=i.value,a=s.source,o=s.target,s.attributes=e(s.key,s.attributes,a.key,o.key,a.attributes,o.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:n||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new he("Graph.forEachAdjacencyEntry: expecting a callback.");pp(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new he("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");pp(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new he("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");pp(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new he("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");pp(!1,!0,!0,this,e)}nodes(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):S_(this._nodes.keys(),this._nodes.size)}forEachNode(e){if(typeof e!="function")throw new he("Graph.forEachNode: expecting a callback.");const n=this._nodes.values();let r,i;for(;r=n.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)}findNode(e){if(typeof e!="function")throw new he("Graph.findNode: expecting a callback.");const n=this._nodes.values();let r,i;for(;r=n.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return i.key}mapNodes(e){if(typeof e!="function")throw new he("Graph.mapNode: expecting a callback.");const n=this._nodes.values();let r,i;const s=new Array(this.order);let a=0;for(;r=n.next(),r.done!==!0;)i=r.value,s[a++]=e(i.key,i.attributes);return s}someNode(e){if(typeof e!="function")throw new he("Graph.someNode: expecting a callback.");const n=this._nodes.values();let r,i;for(;r=n.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new he("Graph.everyNode: expecting a callback.");const n=this._nodes.values();let r,i;for(;r=n.next(),r.done!==!0;)if(i=r.value,!e(i.key,i.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new he("Graph.filterNodes: expecting a callback.");const n=this._nodes.values();let r,i;const s=[];for(;r=n.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)&&s.push(i.key);return s}reduceNodes(e,n){if(typeof e!="function")throw new he("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new he("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let r=n;const i=this._nodes.values();let s,a;for(;s=i.next(),s.done!==!0;)a=s.value,r=e(r,a.key,a.attributes);return r}nodeEntries(){const e=this._nodes.values();return new Jn(()=>{const n=e.next();if(n.done)return n;const r=n.value;return{value:{node:r.key,attributes:r.attributes},done:!1}})}export(){const e=new Array(this._nodes.size);let n=0;this._nodes.forEach((i,s)=>{e[n++]=h4(s,i)});const r=new Array(this._edges.size);return n=0,this._edges.forEach((i,s)=>{r[n++]=p4(this.type,s,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:r}}import(e,n=!1){if(e instanceof it)return e.forEachNode((c,u)=>{n?this.mergeNode(c,u):this.addNode(c,u)}),e.forEachEdge((c,u,l,d,f,h,m)=>{n?m?this.mergeUndirectedEdgeWithKey(c,l,d,u):this.mergeDirectedEdgeWithKey(c,l,d,u):m?this.addUndirectedEdgeWithKey(c,l,d,u):this.addDirectedEdgeWithKey(c,l,d,u)}),this;if(!Jt(e))throw new he("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!Jt(e.attributes))throw new he("Graph.import: invalid attributes. Expecting a plain object.");n?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let r,i,s,a,o;if(e.nodes){if(s=e.nodes,!Array.isArray(s))throw new he("Graph.import: invalid nodes. Expecting an array.");for(r=0,i=s.length;r<i;r++){a=s[r],m4(a);const{key:c,attributes:u}=a;n?this.mergeNode(c,u):this.addNode(c,u)}}if(e.edges){let c=!1;if(this.type==="undirected"&&(c=!0),s=e.edges,!Array.isArray(s))throw new he("Graph.import: invalid edges. Expecting an array.");for(r=0,i=s.length;r<i;r++){o=s[r],g4(o);const{source:u,target:l,attributes:d,undirected:f=c}=o;let h;"key"in o?(h=n?f?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:f?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,h.call(this,o.key,u,l,d)):(h=n?f?this.mergeUndirectedEdge:this.mergeDirectedEdge:f?this.addUndirectedEdge:this.addDirectedEdge,h.call(this,u,l,d))}}return this}nullCopy(e){const n=new it(Mt({},this._options,e));return n.replaceAttributes(Mt({},this.getAttributes())),n}emptyCopy(e){const n=this.nullCopy(e);return this._nodes.forEach((r,i)=>{const s=Mt({},r.attributes);r=new n.NodeDataClass(i,s),n._nodes.set(i,r)}),n}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new Ee(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new Ee("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new Ee("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const n=this.emptyCopy(e),r=this._edges.values();let i,s;for(;i=r.next(),i.done!==!0;)s=i.value,F_(n,"copy",!1,s.undirected,s.key,s.source.key,s.target.key,Mt({},s.attributes));return n}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((s,a)=>{e[a]=s.attributes});const n={},r={};this._edges.forEach((s,a)=>{const o=s.undirected?"--":"->";let c="",u=s.source.key,l=s.target.key,d;s.undirected&&u>l&&(d=u,u=l,l=d);const f=`(${u})${o}(${l})`;a.startsWith("geid_")?this.multi&&(typeof r[f]>"u"?r[f]=0:r[f]++,c+=`${r[f]}. `):c+=`[${a}]: `,c+=f,n[c]=s.attributes});const i={};for(const s in this)this.hasOwnProperty(s)&&!M_.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(i[s]=this[s]);return i.attributes=this._attributes,i.nodes=e,i.edges=n,Zn(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(it.prototype[Symbol.for("nodejs.util.inspect.custom")]=it.prototype.inspect),w4.forEach(t=>{["add","merge","update"].forEach(e=>{const n=t.name(e),r=e==="add"?F_:$4;t.generateKey?it.prototype[n]=function(i,s,a){return r(this,n,!0,(t.type||this.type)==="undirected",null,i,s,a,e==="update")}:it.prototype[n]=function(i,s,a,o){return r(this,n,!1,(t.type||this.type)==="undirected",i,s,a,o,e==="update")}})}),xH(it),jH(it),i4(it),f4(it);class q_ extends it{constructor(e){const n=Mt({type:"directed"},e);if("multi"in n&&n.multi!==!1)throw new he("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(n.type!=="directed")throw new he('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class G_ extends it{constructor(e){const n=Mt({type:"undirected"},e);if("multi"in n&&n.multi!==!1)throw new he("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(n.type!=="undirected")throw new he('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class j_ extends it{constructor(e){const n=Mt({multi:!0},e);if("multi"in n&&n.multi!==!0)throw new he("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(n)}}class B_ extends it{constructor(e){const n=Mt({type:"directed",multi:!0},e);if("multi"in n&&n.multi!==!0)throw new he("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(n.type!=="directed")throw new he('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class U_ extends it{constructor(e){const n=Mt({type:"undirected",multi:!0},e);if("multi"in n&&n.multi!==!0)throw new he("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(n.type!=="undirected")throw new he('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}function Va(t){t.from=function(e,n){const r=Mt({},e.options,n),i=new t(r);return i.import(e),i}}Va(it),Va(q_),Va(G_),Va(j_),Va(B_),Va(U_),it.Graph=it,it.DirectedGraph=q_,it.UndirectedGraph=G_,it.MultiGraph=j_,it.MultiDirectedGraph=B_,it.MultiUndirectedGraph=U_,it.InvalidArgumentsGraphError=he,it.NotFoundGraphError=se,it.UsageGraphError=Ee;const xv="dashed",Nv=qt.font,W_=Zx("dot");class Dv{constructor(e){this.view=e,this.compoundIds=new Set(e.nodes.filter(Mn).map(r=>r.id)),this.edgesWithCompounds=new Set(this.compoundIds.size>0?e.edges.filter(r=>this.compoundIds.has(r.source)||this.compoundIds.has(r.target)).map(r=>r.id):[]);for(const r of e.nodes)this.graphology.addNode(r.id,{origin:r,level:r.level,depth:r.depth??0,modelRef:gw.modelRef(r),deploymentRef:gw.deploymentRef(r),maxConnectedHierarchyDistance:0});for(const r of e.edges){let i=this.graphology.getNodeAttribute(r.source,"deploymentRef"),s=this.graphology.getNodeAttribute(r.target,"deploymentRef");(i===null||s===null)&&(i=this.graphology.getNodeAttribute(r.source,"modelRef"),s=this.graphology.getNodeAttribute(r.target,"modelRef"));let a=-1;i!==null&&s!==null?a=iC(i,s):W_.warn(`Edge ${r.id} of view ${e.id} is invalid, sourceFqn: ${i}, targetFqn: ${s}`),this.graphology.addEdgeWithKey(r.id,r.source,r.target,{origin:r,hierarchyDistance:a,weight:1}),a>this.graphology.getNodeAttribute(r.source,"maxConnectedHierarchyDistance")&&this.graphology.mergeNodeAttributes(r.source,{maxConnectedHierarchyDistance:a}),a>this.graphology.getNodeAttribute(r.target,"maxConnectedHierarchyDistance")&&this.graphology.mergeNodeAttributes(r.target,{maxConnectedHierarchyDistance:a})}this.graphology.forEachEdge((r,{hierarchyDistance:i},s,a,o,c)=>{const u=Math.max(o.maxConnectedHierarchyDistance,c.maxConnectedHierarchyDistance);if(u>i)this.graphology.mergeEdgeAttributes(r,{weight:u-i+1});else{const l=this.graphology.directedDegree(s),d=this.graphology.directedDegree(a);l===1&&d===1&&i>1&&this.graphology.mergeEdgeAttributes(r,{weight:i})}});const n=this.graphvizModel=this.createGraph();this.applyNodeAttributes(n.attributes.node),this.applyEdgeAttributes(n.attributes.edge)}ids=new Set;subgraphs=new Map;nodes=new Map;edges=new Map;compoundIds;edgesWithCompounds;graphology=new it({allowSelfLoops:!0,multi:!0,type:"directed"});graphvizModel;get hasEdgesWithCompounds(){return this.edgesWithCompounds.size>0}postBuild(e){}build(e){const n=(i,s)=>{const a=this.generateGraphvizId(i),o=this.elementToSubgraph(i,s.subgraph(a));this.subgraphs.set(i.id,o);for(const c of i.children){const u=this.computedNode(c);if(Mn(u))n(u,o);else{const l=ln(this.getGraphNode(u.id),`Graphviz Node not found for ${u.id}`);o.node(l.id)}}},r=[];for(const i of this.view.nodes)if(Mn(i))vt(i.parent)&&r.push(i);else{const s=this.generateGraphvizId(i),a=this.elementToNode(i,e.node(s));this.nodes.set(i.id,a)}for(const i of r)n(i,e);for(const i of this.view.edges){const s=this.addEdge(i,e);s&&this.edges.set(i.id,s)}}print(){const e=this.graphvizModel;return this.build(e),this.postBuild(e),h_(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}createGraph(){const e=this.view.autoLayout,n=HW({[D.bgcolor]:"transparent",[D.layout]:"dot",[D.compound]:!0,[D.rankdir]:e.direction,[D.TBbalance]:"min",[D.splines]:"spline",[D.outputorder]:"nodesfirst",[D.nodesep]:dt(e.nodeSep??110),[D.ranksep]:dt(e.rankSep??120),[D.pad]:dt(15),[D.fontname]:Nv});return n.attributes.graph.apply({[D.fontsize]:Yn(15),[D.labeljust]:e.direction==="RL"?"r":"l",[D.labelloc]:e.direction==="BT"?"b":"t",[D.margin]:50.1}),n}applyNodeAttributes(e){e.apply({[D.fontname]:Nv,[D.shape]:"rect",[D.fillcolor]:qt.elements[Js].fill,[D.fontcolor]:qt.elements[Js].hiContrast,[D.color]:qt.elements[Js].stroke,[D.style]:"filled",[D.penwidth]:0})}applyEdgeAttributes(e){e.apply({[D.arrowsize]:.75,[D.fontname]:Nv,[D.fontsize]:Yn(14),[D.penwidth]:Yn(2),[D.color]:qt.relationships[eo].lineColor,[D.fontcolor]:qt.relationships[eo].labelColor})}checkNodeId(e,n=!1){return n?e="cluster_"+e:e.toLowerCase().startsWith("cluster")&&(e="nd_"+e),this.ids.has(e)?null:(this.ids.add(e),e)}generateGraphvizId(e){const n=Mn(e);let r=ad(e.id).toLowerCase(),i=this.checkNodeId(r,n);if(i!==null)return i;r=ad(e.id).toLowerCase();let s=1;do i=this.checkNodeId(r+"_"+s++,n);while(i===null);return i}elementToSubgraph(e,n){Ce(Mn(e),"node should be compound"),Ce(Bf(e.depth),"node.depth should be defined");const r=this.getElementColorValues(e.color),i=aH(r.loContrast);return n.apply({[D.likec4_id]:e.id,[D.likec4_level]:e.level,[D.likec4_depth]:e.depth,[D.fillcolor]:y_(r.fill,e.depth),[D.color]:y_(r.stroke,e.depth),[D.style]:"filled",[D.margin]:Yn(e.children.length>1?40:32)}),Lt(e.title.trim())||n.set(D.label,lH(e,i)),n}elementToNode(e,n){Ce(!Mn(e),"node should not be compound");const r=ie(e.icon),i=this.getElementColorValues(e.color);let s=e.style.size,a=e.style.textSize,o=e.style.padding;!s&&a&&(s=a),!a&&s&&(a=s),!o&&s&&(o=s),s??=yC,a??=vC,o??=wC;const c=qt.spacing[o];switch(n.attributes.apply({[D.likec4_id]:e.id,[D.likec4_level]:e.level,[D.label]:uH(e,i,{shape:s,text:a}),[D.margin]:`${dt(r?8:c)},${dt(c)}`}),n.attributes.set(D.width,dt(qt.sizes[s].width)),n.attributes.set(D.height,dt(qt.sizes[s].height)),e.color!==Js&&n.attributes.apply({[D.fillcolor]:i.fill,[D.fontcolor]:i.hiContrast,[D.color]:i.stroke}),e.shape){case"cylinder":case"storage":{n.attributes.apply({[D.margin]:`${dt(r?8:c)},${dt(0)}`,[D.penwidth]:Yn(2),[D.shape]:"cylinder"});break}case"browser":{n.attributes.apply({[D.margin]:`${dt(r?8:c+4)},${dt(c+6)}`});break}case"mobile":{n.attributes.apply({[D.margin]:`${dt(r?8:c+4)},${dt(c)}`});break}case"queue":{n.attributes.apply({[D.width]:dt(qt.sizes[s].width),[D.height]:dt(qt.sizes[s].height-8),[D.margin]:`${dt(r?8:c+4)},${dt(c)}`});break}}return n}leafElements(e){return e===null?this.view.nodes.filter(n=>!Mn(n)):this.computedNode(e).children.flatMap(n=>{const r=this.computedNode(n);return Mn(r)?this.leafElements(r.id):r})}descendants(e){return e===null?this.view.nodes.slice():this.computedNode(e).children.flatMap(n=>{const r=this.computedNode(n);return[r,...this.descendants(r.id)]})}computedNode(e){return ln(this.view.nodes.find(n=>n.id===e),`Node ${e} not found`)}getGraphNode(e){return this.nodes.get(e)??null}getSubgraph(e){return this.subgraphs.get(e)??null}edgeEndpoint(e,n){let r=this.computedNode(e),i=this.getGraphNode(e),s;return i||(Ce(Mn(r),"endpoint node should be compound"),s=this.getSubgraph(e)?.id,Ce(s,`subgraph ${e} not found`),r=ln(n(this.leafElements(e)),`leaf element in ${e} not found`),i=ln(this.getGraphNode(r.id),`source graphviz node ${r.id} not found`)),[r,i,s]}findInternalEdges(e){if(e===null)return this.view.edges.slice();const n=this.computedNode(e);return Je(this.descendants(e),Si(r=>iE(r.inEdges,r.outEdges)),bc(),_j(iE(n.inEdges,n.outEdges)),rn(r=>this.view.edges.find(i=>i.id===r)),Ge(ie))}withoutCompoundEdges(e){return this.edgesWithCompounds.size===0?e:{...e,inEdges:e.inEdges.filter(n=>!this.edgesWithCompounds.has(n)),outEdges:e.outEdges.filter(n=>!this.edgesWithCompounds.has(n))}}assignGroups(){const e=Je(this.view.nodes,Ge(Mn),rn(r=>r.id),QT(sC),ZT(),rn(r=>{const i=this.findInternalEdges(r).filter(s=>s.source!==s.target&&!this.compoundIds.has(s.source)&&!this.compoundIds.has(s.target));return{id:r,edges:i}}),Ge(({edges:r})=>r.length>1&&r.length<8),qG(4)),n=new Set;for(const r of e){const i=r.edges.filter(s=>!n.has(s.source)&&!n.has(s.target));for(const s of i)try{const a=ln(this.getGraphNode(s.source),`Graphviz Node not found for ${s.source}`),o=ln(this.getGraphNode(s.target),`Graphviz Node not found for ${s.target}`);n.add(s.source),n.add(s.target),a.attributes.set(D.group,r.id),o.attributes.set(D.group,r.id)}catch(a){W_.error(`Failed to assign group to edge ${s.id}`,{error:a})}}}applyManualLayout({height:e,...n}){const r=n.x<0?-n.x:0,i=n.y<0?-n.y:0,s=r>0||i>0;for(const{id:a,...o}of n.nodes){const c=this.getGraphNode(a);if(!c)continue;const u=dt(o.center.x)+r,l=dt(e-o.center.y);o.fixedsize?c.attributes.apply({[D.pos]:`${u},${l}!`,[D.pin]:!0,[D.width]:dt(o.fixedsize.width),[D.height]:dt(o.fixedsize.height),[D.fixedsize]:!0}):c.attributes.set(D.pos,`${u},${l}`)}for(const[a,o]of this.edges.entries()){o.attributes.delete(D.weight),o.attributes.delete(D.minlen),o.attributes.delete(D.constraint);const c=n.edges.find(u=>u.id===a)?.dotpos;c&&!s&&o.attributes.set(D.pos,c)}return this.graphvizModel.apply({[D.layout]:"fdp",[D.overlap]:"vpsc",[D.sep]:"+50,50",[D.esep]:"+10,10",[D.start]:"random2",[D.splines]:"compound"}),this.graphvizModel.delete(D.compound),this.graphvizModel.delete(D.rankdir),this.graphvizModel.delete(D.nodesep),this.graphvizModel.delete(D.ranksep),this.graphvizModel.delete(D.pack),this.graphvizModel.delete(D.pad),this.graphvizModel.delete(D.packmode),this.graphvizModel.attributes.graph.delete(D.margin),this}getRelationshipColorValues(e){return uw(e)?qt.relationships[e]:this.view.customColorDefinitions[e]?.relationships??qt.relationships[Js]}getElementColorValues(e){return uw(e)?qt.elements[e]:this.view.customColorDefinitions[e]?.elements??qt.elements[Js]}}class k4 extends Dv{createGraph(){const e=super.createGraph(),n=this.view.autoLayout;return e.delete(D.TBbalance),e.apply({[D.nodesep]:dt(n.nodeSep??130),[D.ranksep]:dt(n.rankSep??130)}),e}postBuild(e){Je(this.view.nodes,rn(n=>({node:n,graphvizNode:this.getGraphNode(n.id)})),ps(({node:n,graphvizNode:r})=>{if(r!=null)return od.modelRef(n)??void 0}),wc(),Ge(_r(2)),hj(n=>{e.subgraph({[D.rank]:"same"},r=>{for(const{graphvizNode:i}of n)r.node(ln(i).id)})}),UG(()=>{e.set(D.newrank,!0),e.set(D.clusterrank,"global"),e.delete(D.pack),e.delete(D.packmode)}))}elementToSubgraph(e,n){const r=super.elementToSubgraph(e,n);return e.children.length>1&&r.set(D.margin,Yn(50)),r}addEdge(e,n){const[r,i]=[e.source,e.target],[s,a,o]=this.edgeEndpoint(r,w=>kc(w)),[c,u,l]=this.edgeEndpoint(i,Ra),d=sn(l)||sn(o),f=n.edge([a,u],{[D.likec4_id]:e.id,[D.style]:e.line??xv});l&&f.attributes.set(D.lhead,l),o&&f.attributes.set(D.ltail,o);const h=this.graphology.getEdgeAttribute(e.id,"weight");h>1&&!this.graphology.hasDirectedEdge(e.target,e.source)&&f.attributes.set(D.weight,h);const m=b_(e);if(m&&f.attributes.set(d?D.xlabel:D.label,m),e.color){const w=this.getRelationshipColorValues(e.color);f.attributes.apply({[D.color]:w.lineColor,[D.fontcolor]:w.labelColor})}let[y,R]=[e.head??Yi,e.tail??"none"];return y==="none"&&R==="none"?(f.attributes.apply({[D.arrowtail]:"none",[D.arrowhead]:"none",[D.dir]:"none"}),f):e.dir==="both"?(f.attributes.apply({[D.arrowhead]:on(y),[D.arrowtail]:on(e.tail??y),[D.dir]:"both"}),!d&&od.modelRef(s)!==od.modelRef(c)&&f.attributes.set(D.constraint,!1),f):(y!==Yi&&f.attributes.set(D.arrowhead,on(y)),R!=="none"&&f.attributes.set(D.arrowtail,on(R)),f)}}class iw extends Dv{static toDot(e){return new iw(e).print()}postBuild(e){e.set(D.TBbalance,"max")}addEdge(e,n){const{nodes:r}=this.view,[i,s]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[a,o,c]=this.edgeEndpoint(i,_=>kc(_)),[u,l,d]=this.edgeEndpoint(s,Ra),f=n.edge([o,l],{[D.likec4_id]:e.id,[D.style]:e.line??xv});if(d&&f.attributes.set(D.lhead,d),c&&f.attributes.set(D.ltail,c),e.color&&e.color!==eo){const _=this.getRelationshipColorValues(e.color);f.attributes.apply({[D.color]:_.lineColor,[D.fontcolor]:_.labelColor})}const h=[e.label?.trim(),e.technology?.trim()].filter(ie).join(`
191
- `),m=aC(e.id),y=dH(m,h);f.attributes.set(D.label,y);const R=this.graphology.getEdgeAttribute(e.id,"weight");e.source!==e.target&&R>1&&f.attributes.set(D.weight,R);const w=r.findIndex(_=>_.id===i);r.findIndex(_=>_.id===s)<w&&e.dir!=="back"&&f.attributes.apply({[D.constraint]:!1});let[k,E]=[e.head??Yi,e.tail??"none"];return e.dir==="back"?(f.attributes.apply({[D.arrowtail]:on(k),[D.minlen]:0,[D.dir]:"back"}),E!=="none"&&f.attributes.apply({[D.arrowhead]:on(E),[D.dir]:"both"}),f):k==="none"&&E==="none"||k!=="none"&&E!=="none"?(f.attributes.apply({[D.arrowhead]:on(k),[D.arrowtail]:on(E),[D.dir]:"both"}),f):k==="none"?(f.attributes.delete(D.arrowhead),f.attributes.apply({[D.arrowtail]:on(E),[D.minlen]:0,[D.dir]:"back"}),f):(k!==Yi&&f.attributes.set(D.arrowhead,on(k)),f)}}class T4 extends Dv{postBuild(e){this.assignGroups();const n=new Set,r=this.view.nodes.reduce((s,a)=>(Mn(a)&&(n.add(a.id),s.push(a)),s),[]);let i=!1;for(const s of r){const a=Je(s.children,Ge(l=>!this.compoundIds.has(l)),rn(l=>this.computedNode(l)),Ge(l=>l.inEdges.length===0&&l.outEdges.length===0));if(a.length<=2)continue;let o=2;switch(!0){case a.length>11:o=4;break;case a.length>4:o=3;break}const c=ln(this.getSubgraph(s.id),`Subgraph not found for ${s.id}`);let u=null;xj(a,o).forEach(l=>{const d=l.length>1?c.createSubgraph({[D.rank]:"same"}):null;l.forEach((f,h)=>{const m=this.getGraphNode(f.id);m&&(d?.node(m.id),h===0&&(u&&c.edge([u,m],{[D.style]:"invis"}),u=m))}),i=i||!!d})}i&&(e.set(D.newrank,!0),e.set(D.clusterrank,"global"))}addEdge(e,n){const[r,i]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[s,a,o]=this.edgeEndpoint(r,E=>kc(E)),[c,u,l]=this.edgeEndpoint(i,Ra),d=e.parent,f=this.graphology.getEdgeAttributes(e.id),h=n.edge([a,u],{[D.likec4_id]:e.id,[D.style]:e.line??xv});l&&h.attributes.set(D.lhead,l),o&&h.attributes.set(D.ltail,o);const m=sn(l)||sn(o);!this.graphology.hasDirectedEdge(e.target,e.source)&&f.weight>1&&h.attributes.set(D.weight,f.weight);const y=b_(e);if(y&&h.attributes.set(m?D.xlabel:D.label,y),e.color){const E=this.getRelationshipColorValues(e.color);h.attributes.apply({[D.color]:E.lineColor,[D.fontcolor]:E.labelColor})}let[R,w]=[e.head??Yi,e.tail??"none"];if(e.dir==="back")return h.attributes.apply({[D.arrowtail]:on(R),[D.dir]:"back"}),w!=="none"&&h.attributes.apply({[D.arrowhead]:on(w),[D.dir]:"both",[D.minlen]:0}),h;if(R==="none"&&w==="none")return h.attributes.apply({[D.arrowtail]:"none",[D.arrowhead]:"none",[D.dir]:"none",[D.minlen]:0,[D.constraint]:!1}),h;if(R!=="none"&&w!=="none")return h.attributes.apply({[D.arrowhead]:on(R),[D.arrowtail]:on(w),[D.dir]:"both",[D.minlen]:0}),h;if(R!==Yi&&h.attributes.set(D.arrowhead,on(R)),w!=="none"&&h.attributes.set(D.arrowtail,on(w)),this.view.edges.length===1)return h;let k;return d===null&&s.parent==null&&c.parent==null?k=this.view.edges.filter(E=>{if(E.id===e.id||E.parent!==null||E.source===e.source&&E.target===e.target||E.source===e.target&&E.target===e.source)return!1;const _=this.computedNode(E.source),C=this.computedNode(E.target);return Mn(_)||Mn(C)?!1:_.parent==null&&C.parent==null}):k=this.findInternalEdges(d).filter(E=>!(E.id===e.id||E.source===e.source&&E.target===e.target||E.source===e.target&&E.target===e.source)),k.length===0&&(d===null||this.leafElements(d).length<=3)&&h.attributes.set(D.minlen,0),h}}function mp(t){const[e,n,r,i]=t?t.split(",").map(o=>xr(+o)):[0,0,0,0],s=Math.round(r-e),a=Math.round(n-i);return{x:Math.round(e),y:Math.round(i),width:s,height:a}}function E4(t){try{const[e,n]=t.split(",");return{x:xr(parseFloat(e)),y:xr(parseFloat(n))}}catch(e){throw new Error(`Failed on parsing pos: ${t}`,{cause:e})}}function H_(t){const{x:e,y:n}=E4(t.pos),r=g_(parseFloat(t.width)),i=g_(parseFloat(t.height));return{x:e-Math.round(r/2),y:n-Math.round(i/2),width:r,height:i}}function K_(t,[e,n]=[0,0]){if(!t||t.length===0)return null;let r=1/0,i=1/0,s=-1/0,a=-1/0,o=13;try{for(const u of t){if(u.op==="F"){o=xr(u.size);continue}if(u.op==="T"){let l=xr(u.pt[0])-e,d=xr(u.width);switch(u.align){case"r":l-=d;break;case"c":l-=Math.round(d/2);break}r=Math.min(r,l),s=Math.max(s,l+d);let f=xr(u.pt[1])-n;i=Math.min(i,Math.round(f-o)),a=Math.max(a,f)}}}catch(u){return Qt.warn(`Failed on parsing label draw ops:
192
- {labelDrawOps}`,{e:u,labelDrawOps:t}),null}if(r===1/0)return null;const c=2;return{x:r-c,y:i-c,width:s-r+2*c,height:a-i+2*c}}function V_({_draw_:t,likec4_id:e="???"},n="<unknown view>"){try{const r=t.filter(s=>s.op.toLowerCase()==="b");Ce(_r(r,1),`view ${n} edge ${e} should have at least one bezier draw op`),r.length>1&&Qt.warn(`view ${n} edge ${e} has more than one bezier draw op, using the first one only`);const i=r[0].points.map(s=>xr(s));return Ce(_r(i,2),`view ${n} edge ${e} should have at least two points`),i}catch(r){throw new Error(`failed on parsing view ${n} edge ${e} _draw_:
193
- ${JSON.stringify(t,null,2)}`,{cause:r})}}function S4(t,{id:e,source:n,target:r,dir:i,label:s,description:a,...o},c){const u=K_(t._ldraw_??t._tldraw_??t._hldraw_),l=t.dir==="back"||i==="back";return s=s&&u?v_(s,{maxchars:dp,maxLines:w_}).join(`
194
- `):null,{id:e,source:n,target:r,label:s,...ie(a)&&{description:a},...ie(t.pos)&&{dotpos:t.pos},points:V_(t,c),labelBBox:u,...l?{dir:"back"}:{},...o}}function X_(t,e){const n=mp(t.bb),{nodes:r,edges:i,manualLayout:s,...a}=e,o={...a,bounds:n,nodes:[],edges:[]},c=t.objects??[];for(const l of r){const d=c.find(f=>f.likec4_id===l.id);Ce(d,`View ${a.id} node ${l.id} not found in graphviz output`);try{const{x:f,y:h,width:m,height:y}="bb"in d?mp(d.bb):H_(d),R=[f,h];o.nodes.push({...l,position:R,width:m,height:y,labelBBox:K_(d._ldraw_,R)??{x:f,y:h,width:m,height:y}})}catch(f){throw new Error(`Failed on parsing node ${l.id}:
195
- ${JSON.stringify(d,null,2)}`,{cause:f})}}const u=t.edges??[];for(const l of i){const d=u.find(f=>f.likec4_id===l.id);if(!d){Qt.warn`View ${a.id} edge ${l.id} not found in graphviz output, skipping`;continue}o.edges.push(S4(d,l,a.id))}return o}const gp=t=>String(t+1).padStart(2,"0");function _4(t){const e=mp(t.bb),n={nodes:[],edges:[],bounds:e},r=new Map,i=t.objects??[];for(const s of i){if(!s.likec4_type)continue;const a=gp(s._gvid),o=s.likec4_path??"",c=r.get(s._gvid),{x:u,y:l,width:d,height:f}="bb"in s?mp(s.bb):H_(s),h={x:u,y:l};if(s.likec4_type==="view")Ce(s.likec4_id,`View ${s} has no likec4_id`),n.nodes.push({id:a,type:"view",parentId:c?.id??null,height:f,width:d,position:h,label:s.label??"",viewId:s.likec4_id});else{const m={id:a,type:s.likec4_type,parentId:c?.id??null,height:f,width:d,position:h,path:o,label:s.label??""},y=[..."subgraphs"in s?s.subgraphs:[],..."nodes"in s?s.nodes:[]];for(const R of y)r.set(R,m);n.nodes.push(m)}}for(const s of t.edges??[])try{const a=gp(s.tail),o=gp(s.head);n.edges.push({id:`link${gp(s._gvid)}`,source:a,target:o,points:V_(s)})}catch(a){Qt.warn(`Failed on parsing edge:
196
- {edge}`,{error:a,edge:s})}return n}const Y_=qt.font,yp="/";class sw{static toDot(e){return new sw(e).print()}subgraphs=new Map;graphvizModel;constructor(e){const n=this.graphvizModel=KW.graph({[D.layout]:"osage",[D.pack]:Yn(100),[D.packmode]:"array_ltc",[D.pad]:dt(15),[D.fontname]:Y_,[D.splines]:"polyline",[D.esep]:"+20"});n.attributes.graph.apply({[D.fontsize]:Yn(20),[D.labeljust]:"l",[D.labelloc]:"t"}),n.attributes.node.apply({[D.fontname]:Y_,[D.shape]:"rect",[D.width]:dt(400),[D.height]:dt(300),[D.fixedsize]:!0,[D.fontsize]:10}),n.attributes.edge.apply({[D.penwidth]:Yn(2)});const r=new Set(e.map(c=>c.relativePath??""));let i=0,s=[...e];const a=r.size>1;a&&s.sort((c,u)=>{const l=c.relativePath?.split(yp)??[""],d=u.relativePath?.split(yp)??[""];l.push(c.title??"Untitled"),d.push(u.title??"Untitled");const f=l.length,h=d.length;switch(i=Math.max(i,f,h),!0){case f>h:return-1;case f<h:return 1;default:{for(let m=0;m<f;m++){const y=l[m].localeCompare(d[m]);if(y!==0)return y}return 0}}});const o=new Map;s.forEach((c,u)=>{this.addView(a?c:{...c,relativePath:""},u+i);const l=c.nodes.reduce((d,f)=>(f.navigateTo&&d.add(f.navigateTo),d),new Set);l.size>0&&o.set(c.id,l)});for(const[c,u]of o)for(const l of u)n.edge([c,l])}getParentForPath(e){if(e==="")return this.graphvizModel;const n=e.toLowerCase();let r=this.subgraphs.get(n);if(!r){const i=n.endsWith(".c4")||n.endsWith(".likec4"),s=e.includes(yp)?e.slice(0,e.lastIndexOf(yp)):"";r=this.getParentForPath(s).subgraph("cluster"+String(this.subgraphs.size+1),{[D.likec4_type]:i?"file":"folder",[D.likec4_path]:e,[D.sortv]:this.subgraphs.size,[D.label]:ie(s)?e.slice(s.length+1):e}),this.subgraphs.set(n,r)}return r}addView(e,n=0){return this.getParentForPath(e.relativePath??"").node(e.id,{[D.likec4_type]:"view",[D.likec4_id]:e.id,[D.sortv]:n,[D.label]:e.title||"Untitled"})}print(){return h_(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}}const J_=t=>{switch(!0){case to.isDynamic(t):return new iw(t);case to.isDeployment(t):return new k4(t);case to.isElement(t):return new T4(t);default:Ne(t)}},Xa=Qt.getChild("graphviz-layouter");class Q_{constructor(e){this.graphviz=e}get port(){return this.graphviz}changePort(e){this.graphviz=e}async dotToJson(e){let n;try{n=await this.graphviz.layoutJson(e)}catch(r){throw Xa.error(ea(r)),Xa.error`Failed to convert DOT to JSON:\n${e}`,r}try{return JSON.parse(n)}catch(r){throw Xa.error(ea(r)),Xa.error`Failed to parse JSON:\n${n}\n. Generated from DOT:\n${e}`,r}}async layout(e){try{let n=await this.dot(e);const r=await this.dotToJson(n);let i=X_(r,e);if(e.manualLayout){const s=oW(i,e.manualLayout);if(s.diagram)i=s.diagram;else{if(s.relayout.nodes.length>0){const a=J_(e);if(a.hasEdgesWithCompounds)Xa.warn(`Manual layout for view ${e.id} is ignored, as edges with compounds are not supported`);else{a.applyManualLayout(s.relayout);const o=await this.dotToJson(a.print());i=X_(o,e)}}i.hasLayoutDrift=!0}}return n=n.split(`
197
- `).filter(s=>!(s.includes("margin")&&s.includes("50.1"))).join(`
198
- `),{dot:n,diagram:i}}catch(n){throw new Error(`Error during layout: ${e.id}`,{cause:n})}}async svg(e){let n=await this.dot(e);return n=n.split(`
199
- `).filter(r=>!(r.includes("margin")&&r.includes("50.1"))).join(`
200
- `),{svg:await this.graphviz.svg(n),dot:n}}async dot(e){let n=J_(e).print();if(!to.isElement(e))return n;try{return await this.graphviz.unflatten(n)}catch(r){return Xa.warn(`Error during unflatten: ${e.id}`,{error:r}),n}}async layoutOverviewGraph(e){if(e.length===0)return Promise.resolve({nodes:[],edges:[],bounds:{x:0,y:0,width:10,height:10}});const n=sw.toDot(e),r=await this.dotToJson(n);return _4(r)}}class A4{value;next;constructor(e){this.value=e}}class C4{#e;#t;#n;constructor(){this.clear()}enqueue(e){const n=new A4(e);this.#e?(this.#t.next=n,this.#t=n):(this.#e=n,this.#t=n),this.#n++}dequeue(){const e=this.#e;if(e)return this.#e=this.#e.next,this.#n--,e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=void 0,this.#n=0}get size(){return this.#n}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}}function Iv(t){Z_(t);const e=new C4;let n=0;const r=()=>{n<t&&e.size>0&&(e.dequeue()(),n++)},i=()=>{n--,r()},s=async(c,u,l)=>{const d=(async()=>c(...l))();u(d);try{await d}catch{}i()},a=(c,u,l)=>{new Promise(d=>{e.enqueue(d)}).then(s.bind(void 0,c,u,l)),(async()=>(await Promise.resolve(),n<t&&r()))()},o=(c,...u)=>new Promise(l=>{a(c,l,u)});return Object.defineProperties(o,{activeCount:{get:()=>n},pendingCount:{get:()=>e.size},clearQueue:{value(){e.clear()}},concurrency:{get:()=>t,set(c){Z_(c),t=c,queueMicrotask(()=>{for(;n<t&&e.size>0;)r()})}}}),o}function Z_(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}const P4=Iv(1);class Qa{static _graphviz=null;graphviz(){return Promise.resolve().then(()=>Qa._graphviz??=Np.load())}async attempt(e,n,r){return await P4(async()=>{const i=Qt.getChild("graphviz-wasm");try{return await r()}catch(s){i.error(`FAILED GraphvizWasm.${e}`,{error:s}),i.warn(`FAILED DOT:
201
- ${n}`),Np.unload(),Qa._graphviz=null}i.warn("Retrying..."),await oC(50,300);try{return await r()}finally{Np.unload(),Qa._graphviz=null}})}async unflatten(e){return await this.attempt("unflatten",e,async()=>(await this.graphviz()).unflatten(e,1,!1,3).replaceAll(/\t\[/g," [").replaceAll(/\t/g," "))}async acyclic(e){return await this.attempt("acyclic",e,async()=>{const n=(await this.graphviz()).acyclic(e,!0);return n.acyclic&&n.outFile||e})}async layoutJson(e){return await this.attempt("layout",e,async()=>(await this.graphviz()).layout(e,"json",void 0,{yInvert:!0}))}async svg(e){return await this.attempt("svg",e,async()=>(await this.graphviz()).layout(e,"svg"))}}function wn(t){return t.el.ref}function vp(t){const e=[t.el.$refText];let n=t.parent;for(;n;)e.push(n.el.$refText),n=n.parent;return e.length===1?e[0]:e.reverse().join(".")}const Xl=Symbol.for("idattr"),wp={writeId(t,e){return t[Xl]=e,t},readId(t){return t[Xl]}},Yl={writeId(t,e){return vt(e)?t[Xl]=void 0:t[Xl]=e,t},readId(t){return t[Xl]}};function Jl(t){return t.textDocument.languageId===uv.languageId}function Ov(t){return Jl(t)&&t.state>=Be.IndexedContent&&!!t.c4fqnIndex}function Ya(t){return Jl(t)&&t.state==Be.Validated&&!!t.c4Specification&&!!t.c4Elements&&!!t.c4ExtendElements&&!!t.c4Relations&&!!t.c4Views&&!!t.c4fqnIndex&&!!t.c4Deployments&&!!t.c4DeploymentRelations}function*x4(t){const e=Cp.from(t.parseResult.value.models.flatMap(i=>i.elements)),n=[];let r;for(;r=e.shift();){if(Pr(r)){n.push(r);continue}if(r.body&&r.body.elements&&r.body.elements.length>0)for(const i of r.body.elements)e.push(i);yield r}yield*n}function*N4(t){const e=Cp.from(t.parseResult.value.deployments.flatMap(i=>i.elements)),n=[];let r;for(;r=e.shift();){if(xi(r)){n.push(r);continue}if(vn(r)&&r.body&&r.body.elements.length>0)for(const i of r.body.elements)e.push(i);yield r}yield*n}function D4(t){const e=wn(t.target);if(!e)throw new Error("RelationRefError: Invalid reference to target");if(Xt(t.source)){const n=wn(t.source);if(!n)throw new Error("RelationRefError: Invalid reference to source");return{source:n,target:e}}if(!_u(t.$container))throw new Error("RelationRefError: Invalid container for sourceless relation");return{source:t.$container.$container,target:e}}function eA({value:t}){const e=parseFloat(t);return isNaN(e)?100:sE(e,{min:0,max:100})}function Ja({value:t}){switch(t){case"xs":case"sm":case"md":case"lg":case"xl":return t;case"xsmall":return"xs";case"small":return"sm";case"medium":return"md";case"large":return"lg";case"xlarge":return"xl";default:Ne(t)}}function Fi(t,e){const n={};if(!t||t.length===0)return n;for(const r of t)if(e(r))switch(!0){case gh(r):{ie(r.value)&&(n.border=r.value);break}case Is(r):{const i=Ql(r);ie(i)&&(n.color=i);break}case Qh(r):{ie(r.value)&&(n.shape=r.value);break}case Cr(r):{const i=r.libicon?.ref?.name??r.value;ie(i)&&(n.icon=i);break}case Kh(r):{n.opacity=eA(r);break}case Xy(r):{n.multiple=ty(r.value)?r.value:!1;break}case tv(r):{ie(r.value)&&(n.size=Ja(r));break}case Qy(r):{ie(r.value)&&(n.padding=Ja(r));break}case sv(r):{ie(r.value)&&(n.textSize=Ja(r));break}default:Ne(r)}return n}function I4(t,e){const n={};if(!t||t.length===0)return n;for(const r of t)if(e(r))switch(!0){case Is(r):{const i=Ql(r);ie(i)&&(n.color=i);break}case Zu(r):{n.line=r.value;break}case yu(r):{switch(r.key){case"head":{n.head=r.value;break}case"tail":{n.tail=r.value;break}default:Ne(r)}break}default:Ne(r)}return n}function Lv(t,e){const{color:n,line:r,head:i,tail:s}=I4(t?.filter(p0),e);return{...n&&n!==eo?{color:n}:{},...r&&r!==cC?{line:r}:{},...i&&i!==Yi?{head:i}:{},...s?{tail:s}:{}}}function Ql(t){return t?.themeColor??t?.customColor?.$refText}function Mv(t){const e=t.rankSep,n=t.nodeSep;let r;switch(t.direction){case"TopBottom":{r="TB";break}case"BottomTop":{r="BT";break}case"LeftRight":{r="LR";break}case"RightLeft":{r="RL";break}default:Ne(t.direction)}return{direction:r,...n&&{nodeSep:n},...e&&{rankSep:e}}}function O4(t){switch(t){case"TB":return"TopBottom";case"BT":return"BottomTop";case"LR":return"LeftRight";case"RL":return"RightLeft";default:Ne(t)}}function tA(t){if(Sy(t))return t;if(By(t))return t.subject;if(Nh(t))return tA(t.subject);Ne(t)}class L4{parser;locator;constructor(e){this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator}getDocumentation(e){try{if(vn(e)){const n=gt(e),r=this.parser.forDocument(n).parseDeploymentNode(e),i=[r.id];return r.title!==e.name&&i.push(" ",`**${r.title}**`),i.join(`
202
- `)}if(ur(e)){const n=gt(e),r=this.parser.forDocument(n).parseDeployedInstance(e),i=this.locator.getParsedElement(r.element),s=[r.id,`_instance of_ ${r.element}`];return i&&s.push(" ",`**${i.title}**`),s.join(`
203
- `)}if(Ln(e)){const n=gt(e),r=this.parser.forDocument(n).parseElement(e);return r?[r.id," ",`**${r.title}**`].join(`
204
- `):void 0}}catch(n){we(n)}}}function M4(t,e){return[t,e]=zv(t,e)>0?[e,t]:[t,e],z4(t.range,e.range.start)}function zv(t,e){const n=t.range.start.line-e.range.start.line;return n!==0?n:t.range.start.character-e.range.start.character}function z4(t,e){return!(e.line<t.start.line||e.line>t.end.line||e.line==t.start.line&&e.character<t.start.character||e.line==t.end.line&&e.character>t.end.character)}function bp(t){return t.range.start.line!=t.range.end.line}const Q={newLine:_i.newLine({allowMore:!0}),oneSpace:_i.oneSpace(),noSpace:_i.noSpace(),indent:_i.indent({allowMore:!0}),noIndent:_i.noIndent()};class F4 extends aB{format(e){this.removeIndentFromTopLevelStatements(e),this.indentContentInBraces(e),this.formatSpecificationRule(e),this.formatGlobals(e),this.formatElementDeclaration(e),this.formatRelation(e),this.formatMetadataProperty(e),this.formatDeploymentNodeDeclaration(e),this.formatDeployedInstance(e),this.formatDeploymentRelation(e),this.formatView(e),this.formatViewRuleGroup(e),this.formatViewRuleGlobalStyle(e),this.formatViewRuleGlobalPredicate(e),this.formatIncludeExcludeExpressions(e),this.formatDeploymentViewRulePredicateExpressions(e),this.formatWhereExpression(e),this.formatWhereExpressionV2(e),this.formatWhereRelationExpression(e),this.formatWhereElementExpression(e),this.formatRelationExpression(e),this.formatAutolayoutProperty(e),this.formatWithPredicate(e),this.formatViewRuleStyle(e),this.formatLeafProperty(e),this.formatLinkProperty(e),this.formatNavigateToProperty(e),this.formatTags(e)}formatTags(e){this.on(e,iv,(n,r)=>{r.cst(sa(n.$cstNode,"values").slice(1)).prepend(Q.oneSpace),r.keywords(",").prepend(Q.noSpace).append(Q.oneSpace)})}formatDeploymentRelation(e){this.on(e,xi,(n,r)=>{const i=n?.source?.$cstNode?[n?.source?.$cstNode]:[];r.cst(i).append(Q.oneSpace),r.keywords("]->").prepend(Q.noSpace),r.keywords("-[").append(Q.noSpace),r.nodes(...Ge([n.target,n.tags],ie)).prepend(Q.oneSpace),r.properties("title","technology").prepend(Q.oneSpace)})}formatRelation(e){this.on(e,Pr,(n,r)=>{const i=n?.source?.$cstNode?[n?.source?.$cstNode]:[];r.cst(i).append(Q.oneSpace),r.keywords("]->").prepend(Q.noSpace),r.keywords("-[").append(Q.noSpace),r.nodes(...Ge([n.target,n.tags],ie)).prepend(Q.oneSpace),r.properties("title","technology").prepend(Q.oneSpace)}),this.on(e,Gy,(n,r)=>{r.keywords("->","<-").surround(Q.oneSpace);const i=r.property("kind");i.nodes[0]?.text.startsWith(".")&&i.surround(Q.oneSpace),r.keywords("]->").prepend(Q.noSpace).append(Q.oneSpace),r.keywords("-[").prepend(Q.oneSpace).append(Q.noSpace),r.properties("title").prepend(Q.oneSpace)}),this.on(e,zy)?.property("target").prepend(Q.oneSpace),this.on(e,Jy,(n,r)=>{r.property("from").append(Q.oneSpace),r.keywords("]->").prepend(Q.noSpace),r.keywords("-[").append(Q.noSpace)}),this.on(e,_0)?.keywords("->").append(Q.oneSpace),this.on(e,Vy)?.keyword("->").prepend(Q.oneSpace)}removeIndentFromTopLevelStatements(e){(P0(e)||rv(e)||rl(e)||C0(e)||Hy(e)||x0(e))&&this.getNodeFormatter(e).keywords("specification","model","views","likec4lib","global","deployments").prepend(Q.noIndent)}indentContentInBraces(e){if(C0(e)||rv(e)||qa(e)||ja(e)||za(e)||Hy(e)||Na(e)||Ms(e)||Uu(e)||Bu(e)||Ms(e)||P0(e)||_u(e)||E0(e)||fU(e)||Jh(e)||dU(e)||rl(e)||k0(e)||nU(e)||eU(e)||Pl(e)||ip(e)||XB(e)||YB(e)||Ni(e)||Fy(e)||x0(e)||QB(e)||ZB(e)||JB(e)){const n=this.getNodeFormatter(e),r=n.keywords("{"),i=n.keywords("}"),s=n.interior(r,i);let a=null;for(const o of s.nodes)(!a||!M4(a,o))&&n.cst([o]).prepend(Q.indent),a=o;r.prepend(Q.noIndent).prepend(Q.oneSpace),i.prepend(Q.noIndent).prepend(_i.newLine({allowMore:!0}))}}appendKeywordsWithSpace(e){this.on(e,sU)?.keywords("element").append(Q.oneSpace)}formatView(e){this.on(e,Ih,(n,r)=>{(n.extends||n.viewOf||n.name)&&r.keywords("view").append(Q.oneSpace),r.keywords("of","extends").surround(Q.oneSpace)}),this.on(e,b0)?.keywords("dynamic","view").append(Q.oneSpace),this.on(e,Ly)?.keywords("deployment","view").append(Q.oneSpace)}formatLeafProperty(e){if(Lu(e)||yl(e)||mU(e)||La(e)||nv(e)||I0(e)||Is(e)||Zu(e)||yu(e)||Cr(e)||Qh(e)||gh(e)||Kh(e)||Xy(e)||tv(e)||Qy(e)||sv(e)){const n=this.getNodeFormatter(e),r=n.keyword(":"),i=n.keywords("title","description","technology","notation","color","line","head","tail","icon","shape","border","opacity","multiple","size","padding","textSize");r.nodes.length===0?i.append(Q.oneSpace):r.prepend(Q.noSpace).append(Q.oneSpace),n.keyword(";").prepend(Q.noSpace).append(Q.newLine)}}formatLinkProperty(e){this.on(e,Uh,(n,r)=>{r.keyword("link").append(Q.oneSpace),r.property("value").append(Q.oneSpace),r.keyword(":").prepend(Q.noSpace).append(Q.oneSpace),r.keyword(";").prepend(Q.noSpace).append(Q.newLine)})}formatNavigateToProperty(e){this.on(e,Hh)?.property("key").append(Q.oneSpace)}formatAutolayoutProperty(e){this.on(e,El,(n,r)=>{r.keyword("autoLayout").append(Q.oneSpace),r.property("rankSep").prepend(Q.oneSpace),r.property("nodeSep").prepend(Q.oneSpace)})}formatMetadataProperty(e){this.on(e,lU,(n,r)=>{r.property("key").append(Q.oneSpace),r.keyword(":").prepend(Q.noSpace).append(Q.oneSpace),r.keyword(";").prepend(Q.noSpace).append(Q.newLine)})}formatElementDeclaration(e){this.on(e,Ln,(n,r)=>{const i=nn(n.$cstNode,"kind"),s=nn(n.$cstNode,"name");s&&i&&(zv(s,i)>0?r.cst([i]).append(Q.oneSpace):(r.cst([s]).append(Q.oneSpace),r.cst([i]).prepend(Q.oneSpace))),r.properties("props").prepend(Q.oneSpace)})}formatGlobals(e){this.on(e,Na,(n,r)=>{r.keyword("style").append(Q.oneSpace),r.property("id").append(Q.oneSpace)}),this.on(e,Ms,(n,r)=>{r.keyword("styleGroup").append(Q.oneSpace)}),this.on(e,Uu,(n,r)=>{r.keyword("predicateGroup").append(Q.oneSpace)}),this.on(e,Bu,(n,r)=>{r.keyword("dynamicPredicateGroup").append(Q.oneSpace)})}formatSpecificationRule(e){if((qa(e)||ja(e)||tp(e)||za(e))&&this.getNodeFormatter(e).keywords("element","relationship","tag","deploymentNode").append(Q.oneSpace),ep(e)){const n=this.getNodeFormatter(e);n.keyword("color").append(Q.oneSpace),n.property("name").append(Q.oneSpace)}}formatWithPredicate(e){const n=this.getNodeFormatter(e);(Nh(e)||ev(e))&&n.keyword("with").prepend(Q.oneSpace)}formatDeploymentNodeDeclaration(e){this.on(e,vn,(n,r)=>{const i=nn(n.$cstNode,"kind"),s=nn(n.$cstNode,"name");s&&i&&(zv(s,i)>0?r.cst([i]).append(Q.oneSpace):(r.cst([s]).append(Q.oneSpace),r.cst([i]).prepend(Q.oneSpace))),r.properties("title").prepend(Q.oneSpace)})}formatDeployedInstance(e){this.on(e,ur,(n,r)=>{const i=n.$cstNode?.content.find(s=>s.text==="=");i&&r.cst([i]).surround(Q.oneSpace),r.keyword("instanceOf").append(Q.oneSpace),r.property("title").prepend(Q.oneSpace)})}formatViewRuleGlobalStyle(e){this.on(e,cv,(n,r)=>{r.keywords("global","style").append(Q.oneSpace)})}formatViewRuleGlobalPredicate(e){const n=this.getNodeFormatter(e);(ov(e)||R0(e))&&n.keywords("global","predicate").append(Q.oneSpace)}formatViewRuleGroup(e){this.on(e,ip,(n,r)=>{r.keyword("group").append(Q.oneSpace)})}formatViewRuleStyle(e){this.on(e,Pl)?.keyword("style").append(Q.oneSpace),this.on(e,w0)?.keyword("style").append(Q.oneSpace),this.on(e,iU)?.keyword(",").prepend(Q.noSpace).append(Q.oneSpace),this.on(e,oU)?.keyword(",").prepend(Q.noSpace).append(Q.oneSpace)}formatWhereExpression(e){(qB(e)||DB(e))&&this.getNodeFormatter(e).keyword("where").append(Q.oneSpace)}formatWhereExpressionV2(e){(GB(e)||IB(e))&&this.getNodeFormatter(e).keyword("where").append(Q.oneSpace)}formatWhereRelationExpression(e){if(this.on(e,KB,(n,r)=>{r.property("operator").surround(Q.oneSpace)}),this.on(e,F0,(n,r)=>{r.keyword("not").append(Q.oneSpace)}),v0(e)||wU(e)||z0(e)){const n=this.getNodeFormatter(e);n.property("operator").surround(Q.oneSpace),n.property("not").surround(Q.oneSpace)}}formatWhereElementExpression(e){if(this.on(e,WB,(n,r)=>{r.property("operator").surround(Q.oneSpace)}),this.on(e,M0,(n,r)=>{r.keyword("not").append(Q.oneSpace)}),g0(e)||vU(e)||yU(e)){const n=this.getNodeFormatter(e);n.property("operator").surround(Q.oneSpace),n.property("not").surround(Q.oneSpace)}}formatIncludeExcludeExpressions(e){if(Zf(e)||Gh(e)||qu(e)||Ea(e)){const n=this.getNodeFormatter(e);(!e.$cstNode||!bp(e.$cstNode))&&n.keywords("include","exclude").append(Q.oneSpace)}if($0(e)||D0(e)||D0(e)){const n=this.getNodeFormatter(e),r=this.findPredicateExpressionRoot(e),i=r?.$cstNode&&bp(r?.$cstNode);i&&n.property("value").prepend(Q.indent),n.keyword(",").prepend(Q.noSpace).append(i?Q.newLine:Q.oneSpace)}}formatRelationExpression(e){this.on(e,Ky,(n,r)=>{r.keyword("->").append(Q.oneSpace)}),this.on(e,A0,(n,r)=>{r.keyword("->").prepend(Q.oneSpace)}),this.on(e,Yy,(n,r)=>{r.keywords("->","<->").prepend(Q.oneSpace),r.keywords("-[").prepend(Q.oneSpace).append(Q.noSpace),r.keywords("]->").prepend(Q.noSpace).append(Q.oneSpace);const i=r.property("kind");i.nodes[0]?.text.startsWith(".")&&i.surround(Q.oneSpace)}),this.on(e,My,(n,r)=>{r.property("target").prepend(Q.oneSpace)})}formatDeploymentViewRulePredicateExpressions(e){if(Zf(e)||Gh(e)||qu(e)||Ea(e)){const n=this.getNodeFormatter(e);(!e.$cstNode||!bp(e.$cstNode))&&n.keywords("include","exclude").append(Q.oneSpace)}if(tU(e)){const n=this.getNodeFormatter(e),r=this.findPredicateExpressionRoot(e),i=r?.$cstNode&&bp(r?.$cstNode);i&&n.property("value").prepend(Q.indent),n.keyword(",").prepend(Q.noSpace).append(i?Q.newLine:Q.oneSpace)}}findPredicateExpressionRoot(e){let n=e.$container;for(;;){if(!n||Zf(n)||Gh(n)||qu(n)||Ea(n))return n;n=n.$container}}on(e,n,r){const i=n(e)?this.getNodeFormatter(e):void 0;return r&&i&&r(e,i),i}}class q4{constructor(e){this.services=e}async provideCodeLens(e,n,r){return e.state!==Be.Validated&&(Ke.debug(`Waiting for document ${e.uri.path} to be validated`),await this.services.shared.workspace.DocumentBuilder.waitUntil(Be.Validated,e.uri,r),Ke.debug(`Document ${e.uri.path} is validated`)),Ya(e)?e.parseResult.value.views.flatMap(i=>i.views).flatMap(i=>{const s=wp.readId(i),a=i.$cstNode?.range;return!a||!s?[]:{range:{start:a.start,end:{line:a.start.line,character:a.start.character+4}},command:{command:"likec4.open-preview",arguments:[s],title:"open preview"}}}):void 0}}const Fv=["color","shape","icon","border","opacity","multiple","size"].join(",");class G4 extends xS{completionOptions={triggerCharacters:["."]};completionForKeyword(e,n,r){if(this.filterKeyword(e,n)){if(n.value==="deployment"&&vi(e.node,rl))return r(e,{label:n.value,detail:"Insert deployment view",kind:Ct.Class,insertTextFormat:Kn.Snippet,insertText:["deployment view ${1:view_${TM_FILENAME_BASE}_${CURRENT_SECOND}} {"," title '${2:Untitled}'"," "," include $0","}"].join(`
205
- `)});if(["title","description","technology"].includes(n.value))return r(e,{label:n.value,kind:Ct.Property,insertTextFormat:Kn.Snippet,insertText:`${n.value} '\${0}'`});if(["views","specification","model","deployment","with"].includes(n.value))return r(e,{label:n.value,detail:`Insert ${n.value} block`,kind:Ct.Module,insertTextFormat:Kn.Snippet,insertText:`${n.value} {
206
- $0
207
- }`});if(n.value==="group")return r(e,{label:n.value,detail:"Insert group block",kind:Ct.Class,insertTextFormat:Kn.Snippet,insertText:["group '${1:Title}' {"," $0","}"].join(`
208
- `)});if(n.value==="dynamic"&&vi(e.node,rl))return r(e,{label:n.value,detail:"Insert dynamic view",kind:Ct.Class,insertTextFormat:Kn.Snippet,insertText:["dynamic view ${1:view_${TM_FILENAME_BASE}_${CURRENT_SECOND}} {"," title '${2:Untitled}'"," "," $0","}"].join(`
209
- `)});if(n.value==="style"&&e.node)return vi(e.node,Na)?r(e,{label:n.value,detail:`Insert ${n.value} block`,kind:Ct.Module,insertTextFormat:Kn.Snippet,insertText:`${n.value} \${1:name} \${2:*} {
210
- \${3|${Fv}|} $0
211
- }`}):vi(e.node,Cj([rl,Ms]))?r(e,{label:n.value,detail:`Insert ${n.value} block`,kind:Ct.Module,insertTextFormat:Kn.Snippet,insertText:`${n.value} \${1:*} {
212
- \${2|${Fv}|} $0
213
- }`}):r(e,{label:n.value,detail:`Insert ${n.value} block`,kind:Ct.Module,insertTextFormat:Kn.Snippet,insertText:`${n.value} {
214
- \${1|${Fv}|} $0
215
- }`});if(n.value==="extend")return r(e,{label:n.value,detail:"Extend another view",kind:Ct.Class,insertTextFormat:Kn.Snippet,insertText:`extend \${1:element} {
216
- $0
217
- }`});if(n.value==="autoLayout")return r(e,{label:n.value,kind:Ct.Class,insertTextFormat:Kn.Snippet,insertText:"autoLayout ${1|TopBottom,BottomTop,LeftRight,RightLeft|}$0"});r(e,{label:n.value,kind:this.getKeywordCompletionItemKind(n),detail:"Keyword",sortText:"1"})}}}class j4 extends NS{createDocumentHighlight(e){return ve.DocumentHighlight.create(e.segment.range,ve.DocumentHighlightKind.Read)}}const B4=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,U4=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,W4=/^([/\\]\s*){2,}[^/\\]/;function nA(t){return["./","../"].some(e=>t.startsWith(e))}function qv(t,e={}){return typeof e=="boolean"&&(e={acceptRelative:e}),e.strict?B4.test(t):U4.test(t)||(e.acceptRelative?W4.test(t):!1)}function H4(t="",e){return t.endsWith("/")}function K4(t="",e){return(H4(t)?t.slice(0,-1):t)||"/"}function V4(t="",e){return t.endsWith("/")?t:t+"/"}function Rp(t=""){return t.startsWith("/")}function rA(t=""){return(Rp(t)?t.slice(1):t)||"/"}function X4(t=""){return Rp(t)?t:"/"+t}function Y4(t,e){if(J4(e))return t;const n=K4(e);if(!t.startsWith(n))return t;const r=t.slice(n.length);return r[0]==="/"?r:"/"+r}function J4(t){return!t||t==="/"}function $p(t=""){const[e="",n="",r=""]=(t.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:e,search:n,hash:r}}class Q4{constructor(e){this.services=e}getDocumentLinks(e,n){return Ya(e)?Rr(e.parseResult.value).filter(Uh).map(r=>{try{const i=nn(r.$cstNode,"value")?.range,s=this.resolveLink(e,r.value);if(i&&qv(s))return{range:i,target:s}}catch(i){we(i)}return null}).nonNullable().toArray():[]}resolveLink(e,n){if(qv(n)||Rp(n))return n;const r=nA(n)?new URL(e.uri.toString(!0)):this.services.shared.workspace.WorkspaceManager.workspaceURL;return new URL(n,r).toString()}relativeLink(e,n){if(Rp(n))return rA(n);if(nA(n)){const r=new URL(e.uri.toString(!0)),i=new URL(n,r).toString();return rA(Y4(i,this.services.shared.workspace.WorkspaceManager.workspaceURL.toString()))}return null}}class Z4{constructor(e){this.services=e,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator,this.nameProvider=e.references.NameProvider}nodeKindProvider;nameProvider;parser;locator;getSymbols({parseResult:{value:{specifications:e,models:n,deployments:r,views:i,likec4lib:s}}}){return[...s.map(a=>()=>this.getLikec4LibSymbol(a)),...e.map(a=>()=>this.getSpecSymbol(a)),...n.map(a=>()=>this.getModelSymbol(a)),...r.map(a=>()=>this.getDeploymentModelSymbol(a)),...i.map(a=>()=>this.getModelViewsSymbol(a))].flatMap(a=>{try{return a()??[]}catch(o){return we(o),[]}})}getLikec4LibSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=e.icons.map(i=>this.getLibIconSymbol(i)).filter(ie);return r.length===0?[]:[{kind:ar.Namespace,name:"icons",range:n.range,selectionRange:Uo(n,"icons")?.range??n.range,children:r}]}getSpecSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=nn(n,"name");if(!r)return[];const i=Je([...e.elements,...e.tags,...e.relationships],rn(s=>{try{if(qa(s)||ja(s)||za(s))return this.getKindSymbol(s);if(tp(s))return this.getTagSymbol(s)}catch(a){return we(a),null}Ne(s)}),Ge(ie));return i.length===0?[]:[{kind:ar.Namespace,name:e.name,range:n.range,selectionRange:r.range,children:i}]}getModelSymbol(e){const n=e.$cstNode;if(!n)return[];const r=nn(n,"name");return r?[{kind:this.symbolKind(e),name:e.name,range:n.range,selectionRange:r.range,children:e.elements.flatMap(i=>this.getElementsSymbol(i))}]:[]}getDeploymentModelSymbol(e){const n=e.$cstNode;if(!n)return[];const r=nn(n,"name");return r?[{kind:this.symbolKind(e),name:e.name,range:n.range,selectionRange:r.range,children:e.elements.flatMap(i=>this.getDeploymentElementSymbol(i))}]:[]}getElementsSymbol(e){try{if(Aa(e))return this.getExtendElementSymbol(e);if(Ln(e))return this.getElementSymbol(e)}catch(n){we(n)}return[]}getExtendElementSymbol(e){const n=e.$cstNode,r=e.element.$cstNode,i=e.body;return!n||!r?[]:[{kind:this.symbolKind(e),name:vp(e.element),range:n.range,selectionRange:r.range,children:i.elements.flatMap(s=>this.getElementsSymbol(s))}]}getElementSymbol(e){const n=e.$cstNode,r=nn(n,"name");if(!r||!n)return[];const i=e.name,s=e.kind.$refText;return[{kind:this.symbolKind(e),name:i,range:n.range,selectionRange:r.range,detail:s,children:e.body?.elements.flatMap(a=>this.getElementsSymbol(a))??[]}]}getModelViewsSymbol(e){const n=e.$cstNode,r=nn(n,"name");return!r||!n?[]:[{kind:this.symbolKind(e),name:e.name,range:n.range,selectionRange:r.range,children:e.views.flatMap(i=>this.getViewSymbol(i))}]}getKindSymbol(e){return!e.$cstNode||!e.kind.$cstNode||Lt(e.kind.name)?null:{kind:this.symbolKind(e),name:e.kind.name,range:e.$cstNode.range,selectionRange:e.kind.$cstNode.range}}getTagSymbol(e){return!e.$cstNode||!e.tag.$cstNode||Lt(e.tag.name)?null:{kind:this.symbolKind(e),name:"#"+e.tag.name,range:e.$cstNode.range,selectionRange:e.tag.$cstNode.range}}getLibIconSymbol(e){return!e.$cstNode||Lt(e.name)?null:{kind:this.symbolKind(e),name:e.name,range:e.$cstNode.range,selectionRange:e.$cstNode.range}}getViewSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=e.name?nn(n,"name"):null;return r?[{kind:this.symbolKind(e),name:r.text,range:n.range,selectionRange:r.range,children:[]}]:[]}getDeploymentElementSymbol(e){try{if(vn(e))return this.getDeploymentNodeSymbol(e);if(ur(e))return this.getDeployedInstanceSymbol(e)}catch(n){we(n)}return[]}getDeploymentNodeSymbol(e){const n=e.$cstNode,r=this.nameProvider.getNameNode(e);if(!r||!n)return[];const i=this.nameProvider.getNameStrict(e),s=e.kind.$refText;return[{kind:this.symbolKind(e),name:i,range:n.range,selectionRange:r.range,detail:s,children:e.body?.elements.flatMap(a=>this.getDeploymentElementSymbol(a))??[]}]}getDeployedInstanceSymbol(e){const n=e.$cstNode,r=this.nameProvider.getNameNode(e);if(!r||!n)return[];const i=gt(e),s=this.parser.forDocument(i).parseDeployedInstance(e),a=this.nameProvider.getNameStrict(e),o="instance of "+s.element;return[{kind:this.symbolKind(e),name:a,range:n.range,selectionRange:r.range,detail:o,children:[]}]}symbolKind(e){return this.nodeKindProvider.getSymbolKind(e)}}var Gv,iA;function eK(){return iA||(iA=1,Gv=t=>{const e=t.match(/^[ \t]*(?=\S)/gm);return e?e.reduce((n,r)=>Math.min(n,r.length),1/0):0}),Gv}var tK=eK();const nK=Ir(tK);function jv(t){const e=nK(t);if(e===0)return t;const n=new RegExp(`^[ \\t]{${e}}`,"gm");return t.replace(n,"")}class rK extends LS{parser;locator;constructor(e){super(e),this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator}getAstNodeHoverContent(e){if(L0(e))return{contents:{kind:"markdown",value:jv(`
218
- tag: \`${e.name}\`
219
- `)}};if(vn(e)){const n=gt(e),r=this.parser.forDocument(n).parseDeploymentNode(e),i=[r.id+" "];return r.title!==e.name&&i.push(`### ${r.title}`),i.push("Deployment: `"+r.kind+"` "),{contents:{kind:"markdown",value:i.join(`
220
- `)}}}if(ur(e)){const n=gt(e),r=this.parser.forDocument(n).parseDeployedInstance(e),i=this.locator.getParsedElement(r.element),s=[r.id+" ",`instance of \`${r.element}\``];return i&&s.push(`### ${i.title}`,"Element: `"+i.kind+"` "),{contents:{kind:"markdown",value:s.join(`
221
- `)}}}if(Ln(e)){const n=this.locator.getParsedElement(e);return n?{contents:{kind:"markdown",value:[n.id,`### ${n.title}`,"Element: `"+n.kind+"` "].join(`
222
- `)}}:void 0}}}class iK extends X2{highlightElement(e,n){if(Ln(e)||vn(e))return this.highlightNameAndKind(e,n);if(ur(e)){"name"in e&&n({node:e,property:"name",type:De.variable,modifier:[Fe.definition,Fe.readonly]});return}if(Py(e))return this.highlightView(e,n);if(pU(e))return n({node:e,property:"name",type:De.function});if(cU(e))return n({node:e,property:"name",type:De.type,modifier:[Fe.definition]}),"prune";if(Jy(e)&&"kind"in e){n({node:e,property:"kind",type:De.function});return}if(Pr(e)&&"kind"in e&&n({node:e,property:"kind",type:De.function}),Hh(e)||fl(e))return n({node:e,property:"key",type:De.property}),n({node:e,property:"value",type:De.variable,modifier:[Fe.definition,Fe.readonly]}),"prune";if((jy(e)||Fs(e))&&e.$cstNode)return n({cst:e.$cstNode,type:De.variable,modifier:[Fe.definition,Fe.readonly]}),"prune";if(Wy(e)){e.selector&&n({node:e,property:"selector",type:De.variable,modifier:[Fe.definition,Fe.readonly]});return}if(z0(e)&&ie(e.value)){n({node:e,property:"value",type:De.function});return}if((g0(e)||v0(e))&&ie(e.value)){n({node:e,property:"value",type:De.type,modifier:[Fe.definition,Fe.readonly]});return}if((q0(e)||G0(e))&&n({node:e,property:"participant",type:De.keyword}),xh(e)&&ie(e.kind))return n({node:e,property:"kind",type:De.type,modifier:[Fe.definition]}),"prune";if(Ms(e)||Na(e)){n({node:e,property:"id",type:De.variable,modifier:[Fe.definition,Fe.readonly]});return}if(cv(e)){n({node:e,property:"style",type:De.variable,modifier:[Fe.definition,Fe.readonly]});return}if(Uu(e)||Bu(e)){n({node:e,property:"name",type:De.variable,modifier:[Fe.definition,Fe.readonly]});return}if(ov(e)){n({node:e,property:"predicate",type:De.variable,modifier:[Fe.definition,Fe.readonly]});return}if(Dh(e)&&ie(e.tag))return n({node:e,property:"tag",type:De.type,modifier:[Fe.definition]}),"prune";if(S0(e))return n({node:e,property:"value",type:e.parent?De.property:De.variable,modifier:[Fe.definition,Fe.readonly]}),e.parent?void 0:"prune";if(Iu(e)||O0(e))return n({node:e,property:"el",type:e.parent?De.property:De.variable,modifier:[Fe.definition,Fe.readonly]}),e.parent?void 0:"prune";if(ep(e)){n({node:e,keyword:"color",type:De.keyword}),n({node:e,property:"name",type:De.type,modifier:[Fe.declaration,Fe.readonly]});return}if((qa(e)||ja(e)||za(e))&&n({node:e,property:"kind",type:De.type,modifier:[Fe.declaration,Fe.readonly]}),iv(e))return n({node:e,property:"values",type:De.interface});if(L0(e))return n({node:e,property:"name",type:De.type,modifier:[Fe.definition]});if((Jh(e)||Ni(e)&&_u(e.$container))&&n({node:e,property:"key",type:De.property}),Kh(e))return n({node:e,property:"key",type:De.property}),n({node:e,property:"value",type:De.number}),"prune";if(Uh(e)||Cr(e)||m0(e))return n({node:e,property:"key",type:De.property}),Cr(e)&&(e.libicon||e.value==="none")?(n({node:e,property:e.libicon?"libicon":"value",type:De.enum,modifier:[Fe.defaultLibrary]}),"prune"):("value"in e&&e.value&&n({node:e,property:"value",type:De.string}),"prune");if(Is(e)||Qh(e)||yu(e)||Zu(e)||gh(e)||jB(e))return n({node:e,property:"key",type:De.property}),"value"in e&&n({node:e,property:"value",type:De.enum}),"prune"}highlightNameAndKind(e,n){n({node:e,property:"name",type:De.variable,modifier:[Fe.declaration,Fe.readonly]}),n({node:e,property:"kind",type:De.keyword,modifier:[]})}highlightView(e,n){e.name&&n({node:e,property:"name",type:De.variable,modifier:[Fe.declaration,Fe.readonly,"local"]})}}class sK{constructor(e){this.services=e,this.Names=e.references.NameProvider,this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.documentCache=e.DocumentCache}Names;langiumDocuments;documentCache;documents(){return this.langiumDocuments.all.filter(e=>Jl(e)&&e.state>=Be.IndexedContent)}get(e){return e.state<Be.IndexedContent&&we(`Document ${e.uri.path} is not indexed`),this.documentCache.get(e.uri,"DeploymentsIndex",()=>this.createDocumentIndex(e))}nested(e){const n=this.getFqn(e);return this.documents().flatMap(r=>this.get(r).nested(n))}byFqn(e){return this.documents().flatMap(n=>this.get(n).byFqn(e))}getFqn(e){let n=Yl.readId(e);if(ie(n))return n;const r=[this.Names.getNameStrict(e)];let i=e,s;for(;s=tn(i.$container,vn);)r.push(this.Names.getNameStrict(s)),i=s;return n=r.reduceRight((a,o)=>`${a}.${o}`),Yl.writeId(e,n),n}createDocumentIndex(e){const n=e.parseResult.value.deployments.flatMap(l=>l.elements);if(n.length===0)return Ap.EMPTY;const r=new Array,i=new Dn,s=new Dn,a=this.Names,o=this.services.workspace.AstNodeDescriptionProvider,c=l=>{const d={...o.createDescription(l.node,l.name,e),fqn:l.fqn};return Yl.writeId(l.node,l.fqn),s.add(l.fqn,d),d},u=(l,d)=>{const f=[],h=l.body?.elements;if(!h||h.length===0)return[];const m=new Set;for(const y of h)if(!xi(y))try{const R=a.getName(y);if(ie(R)){const w=`${d}.${R}`,k=c({node:y,name:R,fqn:w});i.add(d,k),m.add(k.name),vn(y)&&y.body&&f.push(...u(y,w))}}catch(R){we(R)}return f.length>0&&Je(f,ps(Rc("name")),Uf((y,R)=>{y.length>1||m.has(R)||i.add(d,y[0])})),i.get(d)};for(const l of n)try{if(xi(l))continue;const d=a.getName(l);ie(d)&&(r.push(c({node:l,name:d,fqn:d})),u(l,d))}catch(d){we(d)}return new Ap(r,i,s)}}class Ap{constructor(e,n,r){this._rootNodes=e,this._nested=n,this._byfqn=r}static EMPTY=new Ap([],new Dn,new Dn);rootNodes(){return this._rootNodes}byFqn(e){return this._byfqn.get(e)}nested(e){return this._nested.get(e)}unique(){const e=[];return Je([...this._byfqn.values()],ps(Rc("name")),Uf(n=>{n.length===1&&e.push(n[0])})),e}}const{findNodeForProperty:aK}=zd,{toDocumentSegment:sA}=aN;function oK(t,e,n){const r=aK(e.$cstNode,"name");return{documentUri:n.uri,name:e.name,...e.$cstNode&&{selectionSegment:sA(e.$cstNode)},...r&&{nameSegment:sA(r)},path:t.getAstNodePath(e),type:Vn}}function cK(t,e){const n=t.c4fqnIndex=new Dn,r=t.parseResult.value.models.flatMap(o=>o.elements);if(r.length===0)return;const i=e.workspace.AstNodeLocator,s=Cp.from(r.map(o=>[o,null]));let a;for(;a=s.shift();)try{const[o,c]=a;if(Pr(o))continue;if(Aa(o)){if(Xt(o.body)&&!Lt(o.body.elements)){const u=vp(o.element);for(const l of o.body.elements)Pr(l)||s.push([l,u])}continue}if(Ln(o)){const u=uC(o.name,c);if(n.add(u,{...oK(i,o,t),fqn:u}),Yl.writeId(o,u),Xt(o.body)&&!Lt(o.body.elements))for(const l of o.body.elements)Pr(l)||s.push([l,u]);continue}Ne(o)}catch(o){we(o)}}class Bv{toDispose=[];isDisposed=!1;onDispose(...e){this.toDispose.push(...e)}dispose(){this.throwIfDisposed(),this.isDisposed=!0;let e;for(;e=this.toDispose.pop();)try{e.dispose()}catch(n){lv(n)}}throwIfDisposed(){if(this.isDisposed)throw new Error("This has already been disposed")}}function Zl(...t){var e=t.length>1?t.join(":::"):t[0];return lC(e)}class uK extends Bv{constructor(e){super(),this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.onDispose(e.shared.workspace.DocumentBuilder.onBuildPhase(Be.IndexedContent,async(n,r)=>{for(const i of n)if(Jl(i)){delete i.c4fqnIndex,delete i.c4Elements,delete i.c4Specification,delete i.c4Relations,delete i.c4Deployments,delete i.c4DeploymentRelations,delete i.c4Globals,delete i.c4Views;try{cK(i,e)}catch(s){we(s)}}return await Promise.resolve()})),Ke.debug("[FqnIndex] Created")}langiumDocuments;get documents(){return this.langiumDocuments.all.filter(Ov)}entries(e){return this.documents.flatMap(n=>n.c4fqnIndex.keys().filter(e).flatMap(r=>n.c4fqnIndex.get(r)))}getFqn(e){return Yl.readId(e)??null}byFqn(e){return this.documents.flatMap(n=>n.c4fqnIndex.get(e))}directChildrenOf(e){return nt([e]).flatMap(n=>{const r=this.entries(i=>cd(i)===n).map(i=>[i.name,i]).toArray();return r.length===0?[]:new Dn(r).entriesGroupedByKey().flatMap(([i,s])=>s.length===1?s:[]).iterator()})}uniqueDescedants(e){return new Nt(()=>{const n=`${e}.`,r=new Set,i=[],s=new Dn;if(this.entries(a=>a.startsWith(n)).forEach(a=>{const o=ad(a.fqn),c={...a,name:o};cd(a.fqn)===e?(r.add(o),s.add(o,c)):i.push(c)}),s.size+i.length===0)return null;for(const a of i)r.has(a.name)||s.add(a.name,a);return s.entriesGroupedByKey().flatMap(([a,o])=>o.length===1?o:[]).iterator()},n=>n?n.next():Zt)}}function lK(t){const e=new Map;for(const n of t)if(to.isElement(n)&&n.viewOf&&vt(n.extends)){const r=e.get(n.viewOf)??[];r.push(n.id),e.set(n.viewOf,r)}for(const{id:n,nodes:r}of t)for(const i of r){const s=od.modelRef(i);if(i.navigateTo||!s)continue;const a=nE(e.get(s)??[],o=>o!==n);a&&(i.navigateTo=a)}return t}function dK(t,e="/"){const n=Je(t,rn(c=>c.docUri),Ge(ie),bc());if(n.length===0)return"";if(n.length===1){const c=$p(n[0]).pathname.split(e);return c.length<=1?e:(c.pop(),c.join(e)+e)}Ce(_r(n,2),"Expected at least 2 unique URIs");const[r,...i]=n,s=$p(r).pathname.split(e);let a=s.length;for(const c of i){if(c===r)continue;const u=$p(c).pathname.split(e);for(let l=0;l<a;l++)u[l]!==s[l]&&(a=l);if(a===0)return""}const o=s.slice(0,a).join(e);return o.endsWith(e)?o:o+e}function fK(t){const e="/",n=dK(t,e);return t.map(r=>{if(!r.docUri)return{view:r,parts:[]};let i=$p(r.docUri).pathname;return n.length>0?(Ce(i.startsWith(n),`Expect path "${i}" to start with common prefix: "${n}"`),i=i.slice(n.length)):i=i.includes(e)?i.slice(i.lastIndexOf(e)+1):i,{view:r,parts:i.split(e)}}).sort((r,i)=>{if(r.parts.length!==i.parts.length)return r.parts.length-i.parts.length;for(let s=0;s<r.parts.length;s++){const a=lw(r.parts[s],i.parts[s]);if(a!==0)return a}return lw(r.view.title??r.view.id,i.view.title??i.view.id)}).map(({parts:r,view:i})=>({...i,relativePath:r.join(e)}))}function hK(t,e){const n={tags:new Set,deployments:{},elements:{},relationships:{},colors:{}},r={predicates:{},dynamicPredicates:{},styles:{}};for(const _ of e){const{c4Specification:C,c4Globals:I}=_;C.tags.forEach(j=>n.tags.add(j)),Object.assign(n.elements,C.elements),Object.assign(n.relationships,C.relationships),Object.assign(n.colors,C.colors),Object.assign(n.deployments,C.deployments),Object.assign(r.predicates,I.predicates),Object.assign(r.dynamicPredicates,I.dynamicPredicates),Object.assign(r.styles,I.styles)}function i(_,C){return rn(C,I=>{try{const j=t.lsp.DocumentLinkProvider.relativeLink(_,I.url);if(j&&j!==I.url)return{...I,relative:j}}catch(j){we(j)}return I})}const s=$c(n.colors,_=>fC(_.color));function a(_){return({tags:C,links:I,style:{color:j,shape:J,icon:Z,opacity:oe,border:L,size:S,multiple:$,padding:O,textSize:K},id:W,kind:H,title:$e,description:te,technology:A,metadata:me})=>{try{const _e=n.elements[H];if(!_e)return Ke.warn`No kind '${H}' found for ${W}`,null;const st=I?i(_,I):null;return j??=_e.style.color,J??=_e.style.shape,Z??=_e.style.icon,oe??=_e.style.opacity,L??=_e.style.border,A??=_e.technology,$??=_e.style.multiple,S??=_e.style.size,O??=_e.style.padding,K??=_e.style.textSize,{...j&&{color:j},...J&&{shape:J},...Z&&{icon:Z},...me&&!Lt(me)&&{metadata:me},..._e.notation&&{notation:_e.notation},style:{...L&&{border:L},...S&&{size:S},...O&&{padding:O},...K&&{textSize:K},...ty($)&&{multiple:$},...Bf(oe)&&{opacity:oe}},links:st,tags:C??null,technology:A??null,description:te??null,title:$e,kind:H,id:W}}catch(_e){we(_e)}return null}}const o=new Map;function c(_){for(const C of _.c4ExtendElements){let I=C.links?i(_,C.links):null;const j=o.get(C.id);if(j){I=j.links?[...j.links,...I??[]]:I;let J=[...j.tags??[],...C.tags??[]];_r(J,1)||(J=null),o.set(C.id,{tags:J,links:I,metadata:{...j.metadata,...C.metadata}})}else o.set(C.id,{tags:C.tags??null,links:I,metadata:{...C.metadata}})}}function u(_){const C=o.get(_.id);if(C){const I=[..._.links??[],...C.links??[]],j=bc([..._.tags??[],...C.tags??[]]),J={..._.metadata,...C.metadata};return{..._,tags:_r(j,1)?j:null,links:_r(I,1)?I:null,...!Lt(J)&&{metadata:J}}}return _}const l=Je(e,Si(_=>(c(_),rn(_.c4Elements,a(_)))),Ge(ie),fw,ey((_,C)=>{const I=cd(C.id);return I&&vt(_[I])?(Ke.debug`No parent found for ${C.id}`,_):(_[C.id]=u(C),_)},{}));function d(_){return({astPath:C,source:I,target:j,kind:J,links:Z,id:oe,...L})=>{if(vt(l[I])||vt(l[j]))return Ke.debug`Invalid relation ${oe}
223
- source: ${I} resolved: ${!!l[I]}
224
- target: ${j} resolved: ${!!l[j]}
225
- at ${_.uri.path}\n`,null;const S=Z?i(_,Z):null;return sn(J)&&J in n.relationships?{...n.relationships[J],...L,...S&&{links:S},source:I,target:j,kind:J,id:oe}:{...S&&{links:S},...L,source:I,target:j,id:oe}}}const f=Je(e,Si(_=>rn(_.c4Relations,d(_))),Ge(ie),QT(hC),ZT(),ny(Rc("id")));function h(_){return C=>{if(!pC.isDeploymentNode(C)){if(!C.links||C.links.length===0)return C;const I=i(_,C.links);return{...C,links:I}}try{const I=n.deployments[C.kind];if(!I)return Ke.warn`No kind ${C.kind} found for ${C.id}`,null;let{technology:j=I.technology,notation:J=I.notation,links:Z,style:oe}=C;return{...C,...J&&{notation:J},...j&&{technology:j},style:{border:"dashed",opacity:10,...I.style,...oe},links:Z?i(_,Z):null}}catch(I){we(I)}return null}}const m=Je(e,Si(_=>rn(_.c4Deployments,h(_))),Ge(ie),fw,ey((_,C)=>{const I=cd(C.id);return I&&vt(_[I])?(Ke.debug`No parent found for deployment element ${C.id}`,_):(_[C.id]=C,_)},{}));function y(_){return({astPath:C,source:I,target:j,kind:J,links:Z,id:oe,...L})=>{if(vt(m[I.id])||vt(m[j.id]))return Ke.warn`Invalid deployment relation ${oe} at ${_.uri.path} ${C}, source: ${I.id}(${!!m[I.id]}), target: ${j.id}(${!!m[j.id]})`,null;const S=Z?i(_,Z):null;return sn(J)&&J in n.relationships?{...n.relationships[J],...L,...S&&{links:S},source:I,target:j,kind:J,id:oe}:{...S&&{links:S},...L,source:I,target:j,id:oe}}}const R=Je(e,Si(_=>rn(_.c4DeploymentRelations,y(_))),Ge(ie),ey((_,C)=>Xt(_[C.id])?(Ke.debug`Duplicate deployment relation ${C.id}`,_):(_[C.id]=C,_),{}));function w(_){const C=_.uri.toString();return I=>{let{id:j,title:J,description:Z,tags:oe,links:L,astPath:S,...$}=I;I.__==="element"&&vt(J)&&"viewOf"in I&&(J=l[I.viewOf]?.title??null),vt(J)&&j==="index"&&(J="Landscape view");const O=L?i(_,L):null;return{...$,customColorDefinitions:s,tags:oe,links:O,docUri:C,description:Z,title:J,id:j}}}const k=Je(e,Si(_=>rn(_.c4Views,w(_))),fK);k.some(_=>_.id==="index")||k.unshift({__:"element",id:"index",title:"Landscape view",description:null,tags:null,links:null,customColorDefinitions:s,rules:[{include:[{wildcard:!0}]}]});const E=Je(k,ny(Rc("id")),RC);return{specification:{tags:Array.from(n.tags),elements:n.elements,relationships:n.relationships,deployments:n.deployments},elements:l,relations:f,globals:r,views:E,deployments:{elements:m,relations:R}}}const aA="ParsedLikeC4Model",Uv="ComputedLikeC4Model";class pK extends Bv{constructor(e){super(),this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments;const n=e.likec4.ModelParser;this.onDispose(e.shared.workspace.DocumentBuilder.onUpdate((r,i)=>{i.length>0&&this.notifyListeners(i)})),this.onDispose(e.shared.workspace.DocumentBuilder.onBuildPhase(Be.Validated,async(r,i)=>{let s=[];Ke.debug`[ModelBuilder] onValidated (${r.length} docs)`;for(const a of r)try{s.push(n.parse(a).uri)}catch(o){we(o)}await Pt(i),s.length>0&&this.notifyListeners(s)})),Ke.debug`[ModelBuilder] Created`}langiumDocuments;listeners=[];unsafeSyncBuildModel(){const e=this.documents();return e.length===0?(Ke.debug("[ModelBuilder] No documents to build model from"),null):this.services.WorkspaceCache.get(aA,()=>(Ke.debug`[ModelBuilder] buildModel (${e.length} docs)`,hK(this.services,e)))}async buildModel(e){return this.services.WorkspaceCache.get(aA)||await this.services.shared.workspace.WorkspaceLock.read(async()=>(e&&await Pt(e),this.unsafeSyncBuildModel()))}previousViews={};unsafeSyncBuildComputedModel(e){const n=this.services.WorkspaceCache,r=this.services.WorkspaceCache;return n.get(Uv,()=>{const i=dw.makeCompute(e),s=[];for(const o of wc(e.views)){const c=i(o);if(!c.isSuccess){we(c.error);continue}s.push(c.view)}lK(s);const a=Ar(s,o=>{const c=this.previousViews[o.id],u=c&&dv(o,c)?c:o;return r.set(oA(o.id),u),[o.id,u]});return this.previousViews={...a},{...YG(e,["views"]),views:a}})}async buildComputedModel(e){const n=this.services.WorkspaceCache;return n.has(Uv)?n.get(Uv):await this.services.shared.workspace.WorkspaceLock.read(async()=>{e&&await Pt(e);const r=this.unsafeSyncBuildModel();return r?this.unsafeSyncBuildComputedModel(r):null})}async computeView(e,n){const r=this.services.WorkspaceCache,i=oA(e);return r.has(i)?r.get(i):await this.services.shared.workspace.WorkspaceLock.read(async()=>(n&&await Pt(n),r.get(i,()=>{const s=this.unsafeSyncBuildModel(),a=s?.views[e];if(!a)return Ke.warn(`[ModelBuilder] Cannot find view ${e}`),null;const o=dw.makeCompute(s)(a);if(!o.isSuccess)return we(o.error),null;let c=o.view;const u=Je(s.views,wc(),Ge(dC),Ge(d=>d.id!==e),ps(d=>d.viewOf));for(const d of c.nodes)if(!d.navigateTo){const f=u[d.id];f&&(d.navigateTo=f[0].id)}const l=this.previousViews[e];return l&&dv(c,l)?c=l:this.previousViews[e]=c,c})))}onModelParsed(e){return this.listeners.push(e),hs.create(()=>{const n=this.listeners.indexOf(e);n>=0&&this.listeners.splice(n,1)})}documents(){return this.langiumDocuments.all.filter(Ya).toArray()}notifyListeners(e){for(const n of this.listeners)try{n(e)}catch(r){we(r)}}}function oA(t){return`computed-view-${t}`}const{findNodeForKeyword:mK,findNodeForProperty:kp}=zd,{getDocument:gK}=jo;class yK{constructor(e){this.services=e,this.fqnIndex=e.likec4.FqnIndex,this.deploymentsIndex=e.likec4.DeploymentsIndex,this.langiumDocuments=e.shared.workspace.LangiumDocuments}fqnIndex;deploymentsIndex;langiumDocuments;documents(){return this.langiumDocuments.all.filter(Ya)}getParsedElement(e){if(eE(e)){const i=e,s=this.fqnIndex.byFqn(e).head();if(!s)return null;const a=this.langiumDocuments.getDocument(s.documentUri);return!a||!Ya(a)?null:a.c4Elements.find(o=>o.id===i)??null}const n=this.fqnIndex.getFqn(e);if(!n)return null;const r=gK(e);return Ya(r)?r.c4Elements.find(i=>i.id===n)??null:null}locateElement(e,n){const r=this.fqnIndex.byFqn(e).head(),i=r?.nameSegment??r?.selectionSegment;return!r||!i?null:{uri:r.documentUri.toString(),range:i.range}}locateDeploymentElement(e,n){const r=this.deploymentsIndex.byFqn(e).head(),i=r?.nameSegment??r?.selectionSegment;return!r||!i?null:{uri:r.documentUri.toString(),range:i.range}}locateRelation(e){for(const n of this.documents()){const r=n.c4Relations.find(a=>a.id===e)??n.c4DeploymentRelations.find(a=>a.id===e);if(!r)continue;const i=this.services.workspace.AstNodeLocator.getAstNode(n.parseResult.value,r.astPath);if(!Pr(i)&&!xi(i))continue;let s=i.title?kp(i.$cstNode,"title"):void 0;if(s??=i.kind?kp(i.$cstNode,"kind"):void 0,s??=kp(i.$cstNode,"target"),s??=i.$cstNode,!!s)return{uri:n.uri.toString(),range:s.range}}return null}locateViewAst(e){for(const n of this.documents()){const r=n.c4Views.find(s=>s.id===e);if(!r)continue;const i=this.services.workspace.AstNodeLocator.getAstNode(n.parseResult.value,r.astPath);if(Py(i))return{doc:n,view:r,viewAst:i}}return null}locateView(e){const n=this.locateViewAst(e);if(!n)return null;const r=n.viewAst;let i=r.name?kp(r.$cstNode,"name"):void 0;return i??=mK(r.$cstNode,"view"),i??=r.$cstNode,i?{uri:n.doc.uri.toString(),range:i.range}:null}}const Ws=["this","it","self","super","likec4lib","global"];function ft(t){return async function(e,n,r){try{const i=t(e,n,r);rj(i)&&await i;return}catch(i){const s=i instanceof Error?i.message:String(i);n("error",`Validation failed: ${s}`,{node:e}),we(i)}}}const{getDocument:vK}=jo,wK=t=>{const e=t.likec4.DeploymentsIndex,n=t.references.NameProvider;return ft((r,i)=>{const s=n.getName(r);if(!s){i("error","DeploymentNode must be named",{node:r});return}const a=ln(n.getNameNode(r),"name CstNode not found").range;Ws.includes(s)&&i("error",`Reserved word: ${s}`,{node:r,range:a});const o=e.getFqn(r);e.byFqn(o).limit(2).toArray().length>1&&i("error",`Duplicate node name "${o}"`,{node:r,range:a})})},bK=t=>{const e=t.likec4.DeploymentsIndex,n=t.references.NameProvider;return ft((r,i)=>{const s=n.getName(r);if(!s){i("error","Deployed instance must be named, unique inside node",{node:r});return}const a=ln(n.getNameNode(r),"name CstNode not found").range;Ws.includes(s)&&i("error",`Reserved word: ${s}`,{node:r,range:a});const o=e.getFqn(r);e.byFqn(o).limit(2).toArray().length>1&&i("error",`Duplicate instance name "${o}"`,{node:r,range:a})})},RK=t=>{const e=t.likec4.ModelParser;return ft((n,r)=>{if(!n.source?.value?.ref){let c=n.source?.$cstNode?.text??"";r("error",`DeploymentRelation source '${c}' not resolved`,{node:n,property:"source"});return}if(!n.target?.value?.ref){let c=n.target?.$cstNode?.text??"";r("error",`DeploymentRelation target '${c}' not resolved`,{node:n,property:"target"});return}const i=vK(n),s=e.forDocument(i),a=s.parseFqnRef(n.source);if(no.isModelRef(a)){r("error","DeploymentRelation must refer deployment element",{node:n,property:"source"});return}const o=s.parseFqnRef(n.target);if(no.isModelRef(o)){r("error","DeploymentRelation must refer deployment element",{node:n,property:"target"});return}hw(a.deployment,o.deployment)&&r("error","Invalid parent-child relationship",{node:n})})},$K=t=>ft((e,n)=>{const r=tA(e.value);switch(!0){case xh(r):case Dh(r):case Fs(r):{n("warning","Predicate is ignored, as not supported in dynamic views",{node:e});return}}}),kK=t=>{const e=t.likec4.FqnIndex;return ft((n,r)=>{const i=wn(n.source),s=i&&e.getFqn(i);s||r("error","Source not found (not parsed/indexed yet)",{node:n,property:"source"});const a=wn(n.target),o=a&&e.getFqn(a);o||r("error","Target not found (not parsed/indexed yet)",{node:n,property:"target"}),s&&o&&(Pp(s,o)||Pp(o,s))&&r("error","Invalid parent-child relationship",{node:n})})},{getDocument:TK}=jo,EK=t=>{const e=t.likec4.FqnIndex,n=t.workspace.AstNodeLocator;return ft((r,i)=>{const s=e.getFqn(r);if(!s){i("error","Not indexed element",{node:r,property:"name"});return}Ws.includes(r.name)&&i("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const a=TK(r).uri,o=n.getAstNodePath(r),c=e.byFqn(s).filter(u=>u.documentUri!==a||u.path!==o).head();if(c){const u=c.documentUri!==a;i("error",`Duplicate element name ${r.name!==s?r.name+" ("+s+")":r.name}`,{node:r,property:"name",...u&&{relatedInformation:[{location:{range:c.nameSegment?.range??c.selectionSegment?.range,uri:c.documentUri.toString()},message:"conflicting element"}]}})}})},SK=t=>ft((e,n)=>{const r=parseFloat(e.value);(isNaN(r)||r<0||r>100)&&n("warning","Value ignored, must be between 0% and 100%",{node:e,property:"value"})}),_K=t=>(e,n)=>{const r=e.$container;r.props.some(i=>Cr(i)&&i!==e)&&n("error","Icon must be defined once",{node:e}),Ni(r)&&_u(r.$container)&&r.$container.props.some(i=>Cr(i))&&n("warning","Redundant as icon defined on element",{node:e})},AK=t=>(e,n)=>{vi(e,Gy)||n("error","Notes can be defined only inside dynamic view",{node:e})},CK=t=>{const e=t.likec4.FqnIndex;return ft((n,r)=>{const i=wn(n.target),s=i&&e.getFqn(i);s||r("error","Target not resolved",{node:n,property:"target"});let a;if(Xt(n.source)){if(a=wn(n.source),!a)return r("error","Source not resolved",{node:n,property:"source"})}else{if(!_u(n.$container))return r("error","Sourceless relation must be nested",{node:n});a=n.$container.$container}const o=e.getFqn(a);o||r("error","Source not resolved",{node:n}),o&&s&&hw(o,s)&&r("error","Invalid parent-child relationship",{node:n})})},PK=t=>ft((e,n)=>{e.$container.tags?.values&&e.tags?.values&&n("error","Relation cannot have tags in both header and body",{node:e.tags})}),xK=t=>ft((e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one specification per document",{node:e,property:"name"})}),NK=t=>ft((e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one model per document",{node:e,property:"name"})}),DK=t=>ft((e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one global block per document",{node:e,property:"name"})}),IK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{Ws.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=e.allElements(ai).filter(s=>s.name===n.name&&s.node!==n).head();if(i){const s=i.documentUri!==gt(n).uri;r("error",`Duplicate element kind '${n.name}'`,{node:n,property:"name",...s&&{relatedInformation:[{location:{range:i.nameSegment.range,uri:i.documentUri.toString()},message:"conflicting definition"}]}})}})},OK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{Ws.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=e.allElements(Pi).filter(s=>s.name===n.name&&s.node!==n).head();if(i){const s=i.documentUri!==gt(n).uri;r("error",`Duplicate deploymentNode kind '${n.name}'`,{node:n,property:"name",...s&&{relatedInformation:[{location:{range:i.nameSegment.range,uri:i.documentUri.toString()},message:"conflicting definition"}]}})}})},LK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{const i="#"+n.name,s=e.allElements(Ii).filter(a=>a.name===i&&a.node!==n).head();if(s){const a=s.documentUri!==gt(n).uri;r("error",`Duplicate tag '${n.name}'`,{node:n,property:"name",...a&&{relatedInformation:[{location:{range:s.nameSegment.range,uri:s.documentUri.toString()},message:"conflicting definition"}]}})}})},MK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{Ws.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"}),e.allElements(Di).filter(i=>i.name===n.name).limit(2).count()>1&&r("error",`Duplicate RelationshipKind '${n.name}'`,{node:n,property:"name"})})},cA=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{const i=e.allElements(Pa),s=e.allElements(Ca);i.concat(s).filter(a=>a.name===n.name).limit(2).count()>1&&r("error",`Duplicate GlobalPredicateGroup or GlobalDynamicPredicateGroup name '${n.name}'`,{node:n,property:"name"})})},zK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{e.allElements(Wu).filter(i=>i.name===n.name).limit(2).count()>1&&r("error",`Duplicate GlobalStyleId name '${n.name}'`,{node:n,property:"name"})})},FK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{n.name&&(Ws.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"}),e.allElements(Ns).filter(i=>i.name===n.name).limit(2).count()>1&&r("error",`Duplicate view '${n.name}'`,{node:n,property:"name"}))})},qK=t=>ft((e,n)=>{const r=tn(e,fh);qu(r)&&n("error",'Invalid usage inside "exclude"',{node:e});const i=By(e.subject)?e.subject.subject:e.subject;switch(!0){case Iu(i):case jy(i):case T0(i):case Fs(i):return;case xh(i):case Dh(i):n("error","Invalid target (expect reference to specific element)",{node:e,property:"subject"});return;default:Ne(i)}}),GK=t=>ft((e,n)=>{vi(e,Ny)&&n("warning","Redundant usage, expand predicate resolves parent element only when used in relations",{node:e})}),jK=t=>{const e=t.likec4.ModelParser;return ft((n,r)=>{if(n.$container.$type!=="DeploymentViewRulePredicateExpression")return;const i=tn(n,Ea);if(!i||i.isInclude!==!0)return;const s=gt(n),a=e.forDocument(s),o="Model reference is allowed in exclude predicate only";if(My(n)){ro.isModelRef(a.parseFqnExpr(n.source.from))&&r("error",o,{node:n.source,property:"from"}),ro.isModelRef(a.parseFqnExpr(n.target))&&r("error",o,{node:n,property:"target"});return}let c;if(Ky(n)?c=n.to:Yy(n)?c=n.from:c=n.inout.to,ro.isModelRef(a.parseFqnExpr(c))){r("error",o,{node:n});return}})},BK=t=>{const e=t.likec4.ModelParser;return ft((n,r)=>{const i=n.ref.value.ref;if(vt(i)){r("error","Invalid empty reference",{node:n});return}const s=gt(n),a=e.forDocument(s).parseFqnRefExpr(n);if(n.$container.$type==="DeploymentViewRulePredicateExpression"){if(ro.isModelRef(a)){r("error","Deployment view predicate must reference deployment model",{node:n});return}if(ro.isDeploymentRef(a)&&no.isInsideInstanceRef(a.ref)){r("error","Must reference deployment nodes or instances, but not internals",{node:n});return}}!vn(i)&&sn(n.selector)&&r("warning",`Selector '${n.selector}' applies to deployment nodes only, ignored here`,{node:n,property:"selector"})})},UK=t=>ft((e,n)=>{if(Fs(e.to)&&!Vy(e.$container)){const r=tn(e,Ih);vt(r?.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}}),WK=t=>ft((e,n)=>{if(Fs(e.from)&&!zy(e.$container)){const r=tn(e,Ih);vt(r?.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}}),HK=t=>ft((e,n)=>{const r=tn(e,fh);qu(r)&&n("error",'Invalid usage inside "exclude"',{node:e})});function KK(t){return e=>t.some(n=>n(e))}const VK=KK([Hy,Uu,Bu,Na,Ms,$0,Nh,ev,Sy,Ny,Fy,Gy,xB,Ea,LB,h0,Wy,BB,Iy,zB,iv,UB,Zf,Py,Oy,ur,vn,xi,p0,Ds,Pr,OB,m0,Hh,Ln,Aa,qa,ja,za,tp,ep,rv]),XK=t=>{let e=t;for(;e&&!uU(e);){if(VK(e))return e;e=e.$container}};function YK(t){const e=t.state>=Be.Validated?t.diagnostics?.filter(r=>r.severity===hc.Error)??[]:[],n=new WeakSet;for(const{node:r}of e){if(vt(r)||n.has(r))continue;n.add(r);const i=XK(r);i&&n.add(i)}return{isValid:r=>!n.has(r),invalidNodes:n}}function JK(t){Ke.debug("registerValidationChecks"),t.validation.ValidationRegistry.register({DeployedInstance:bK(t),DeploymentNodeKind:OK(t),DeploymentNode:wK(t),DeploymentRelation:RK(t),FqnRefExpr:BK(t),RelationExpr:jK(t),NotesProperty:AK(),OpacityProperty:SK(),IconProperty:_K(),SpecificationRule:xK(),Model:NK(),Globals:DK(),GlobalPredicateGroup:cA(t),GlobalDynamicPredicateGroup:cA(t),GlobalStyleId:zK(t),DynamicViewStep:kK(t),LikeC4View:FK(t),Element:EK(t),ElementKind:IK(t),Relation:CK(t),RelationBody:PK(),Tag:LK(t),DynamicViewPredicateIterator:$K(),ElementPredicateWith:qK(),RelationPredicateWith:HK(),ExpandElementExpression:GK(),RelationshipKind:MK(t),IncomingRelationExpression:UK(),OutgoingRelationExpression:WK()});const e=t.shared.lsp.Connection;e&&t.shared.workspace.DocumentBuilder.onUpdate((n,r)=>{for(const i of r)Ke.debug(`clear diagnostics for deleted ${i.path}`),e.sendDiagnostics({uri:i.toString(),diagnostics:[]})})}function Nr(t){return sn(t)?ct(t).split(`
226
- `).join(" "):void 0}function ct(t){return sn(t)?jv(t).trim():void 0}class QK{constructor(e,n){this.services=e,this.doc=n,this.isValid=YK(n).isValid}isValid;resolveFqn(e){if(f0(e))return this.services.likec4.DeploymentsIndex.getFqn(e);if(Aa(e))return vp(e.element);const n=this.services.likec4.FqnIndex.getFqn(e);return Ce(n,`Not indexed element: ${this.getAstNodePath(e)}`),n}getAstNodePath(e){return this.services.workspace.AstNodeLocator.getAstNodePath(e)}getMetadata(e){if(!e||!this.isValid(e)||Lt(e.props))return;const n=Je(e.props,rn(r=>[r.key,ct(r.value)]),Ge(([r,i])=>ie(i)),yj());return Lt(n)?void 0:n}convertTags(e){return this.parseTags(e)}parseTags(e){let n=e?.tags;if(!n)return null;let r=[];for(;n;){try{if(this.isValid(n)){const i=n.values.map(s=>s.ref?.name).filter(ie);i.length>0&&r.push(...i)}}catch{}n=n.prev}return r=bc(r.reverse()),qn(r)?r:null}convertLinks(e){return this.parseLinks(e)}parseLinks(e){if(!(!e?.props||e.props.length===0))return Je(e.props,Ge(Uh),Si(n=>{if(!this.isValid(n))return[];const r=n.value;if(ie(r)){const i=ie(n.title)?Nr(n.title):void 0;return i?{url:r,title:i}:{url:r}}return[]}))}}function ZK(t){return class extends t{parseDeployment(){const e=this.doc;for(const n of N4(e))try{switch(!0){case xi(n):{this.isValid(n)&&e.c4DeploymentRelations.push(this.parseDeploymentRelation(n));break}case ur(n):e.c4Deployments.push(this.parseDeployedInstance(n));break;case vn(n):{e.c4Deployments.push(this.parseDeploymentNode(n));break}default:Ne(n)}}catch(r){we(r)}}parseDeploymentNode(e){const n=this.isValid,r=this.resolveFqn(e),i=ln(e.kind.ref,"DeploymentKind not resolved").name,s=this.convertTags(e.body),a=e.body?.props.find(Ni)?.props,o=Fi(a,n),c=this.getMetadata(e.body?.props.find(Ds)),u=Je(e.body?.props??[],Ge(n),Ge(Lu),Ar(y=>[y.key,y.value||void 0])),l=ct(e.title??u.title),d=ct(u.description),f=Nr(u.technology),h=this.convertLinks(e.body),m=e.body?.props.find(Cr);if(m&&n(m)){const y=m.libicon?.ref?.name??m.value;ie(y)&&(o.icon=y)}return{id:r,kind:i,title:l??ad(r),...c&&{metadata:c},...s&&{tags:s},...h&&qn(h)&&{links:h},...ie(f)&&{technology:f},...ie(d)&&{description:d},style:o}}parseDeployedInstance(e){const n=this.isValid,r=this.resolveFqn(e),i=this.resolveFqn(ln(wn(e.element),"DeployedInstance element not found")),s=this.convertTags(e.body),a=e.body?.props.find(Ni)?.props,o=Fi(a,n),c=this.getMetadata(e.body?.props.find(Ds)),u=Je(e.body?.props??[],Ge(n),Ge(Lu),Ar(y=>[y.key,y.value||void 0])),l=ct(e.title??u.title),d=ct(u.description),f=Nr(u.technology),h=this.convertLinks(e.body),m=e.body?.props.find(Cr);if(m&&n(m)){const y=m.libicon?.ref?.name??m.value;ie(y)&&(o.icon=y)}return{id:r,element:i,...c&&{metadata:c},...l&&{title:l},...s&&{tags:s},...h&&qn(h)&&{links:h},...ie(f)&&{technology:f},...ie(d)&&{description:d},style:o}}parseDeploymentRelation(e){const n=this.isValid,r=this.getAstNodePath(e),i=no.toDeploymentRef(this.parseFqnRef(e.source)),s=no.toDeploymentRef(this.parseFqnRef(e.target)),a=this.convertTags(e)??this.convertTags(e.body),o=this.convertLinks(e.body),c=e.kind?.ref?.name,u=this.getMetadata(e.body?.props.find(Ds)),l=Ar(e.body?.props.filter(yl)??[],R=>[R.key,R.value]),d=Je(e.body?.props??[],Ge(fl),rn(R=>R.value.view.ref?.name),Ge(ie),Ra()),f=ct(e.title??l.title),h=ct(l.description),m=Nr(e.technology)??ct(l.technology),y=e.body?.props.find(Jh);return{id:Zl("deployment",r,i.id,s.id),source:i,target:s,...f&&{title:f},...u&&{metadata:u},...ie(m)&&{technology:m},...ie(h)&&{description:h},...c&&{kind:c},...a&&{tags:a},...qn(o)&&{links:o},...Lv(y?.props,n),...d&&{navigateTo:d},astPath:r}}}}function eV(t){const e=t.length;let n=0,r=0;for(;r<e;){let i=t.charCodeAt(r++);if(i&4294967168)if(!(i&4294965248))n+=2;else{if(i>=55296&&i<=56319&&r<e){const s=t.charCodeAt(r);(s&64512)===56320&&(++r,i=((i&1023)<<10)+(s&1023)+65536)}i&4294901760?n+=4:n+=3}else{n++;continue}}return n}function tV(t,e,n){const r=t.length;let i=n,s=0;for(;s<r;){let a=t.charCodeAt(s++);if(a&4294967168)if(!(a&4294965248))e[i++]=a>>6&31|192;else{if(a>=55296&&a<=56319&&s<r){const o=t.charCodeAt(s);(o&64512)===56320&&(++s,a=((a&1023)<<10)+(o&1023)+65536)}a&4294901760?(e[i++]=a>>18&7|240,e[i++]=a>>12&63|128,e[i++]=a>>6&63|128):(e[i++]=a>>12&15|224,e[i++]=a>>6&63|128)}else{e[i++]=a;continue}e[i++]=a&63|128}}const nV=new TextEncoder,rV=50;function iV(t,e,n){nV.encodeInto(t,e.subarray(n))}function sV(t,e,n){t.length>rV?iV(t,e,n):tV(t,e,n)}const aV=4096;function uA(t,e,n){let r=e;const i=r+n,s=[];let a="";for(;r<i;){const o=t[r++];if(!(o&128))s.push(o);else if((o&224)===192){const c=t[r++]&63;s.push((o&31)<<6|c)}else if((o&240)===224){const c=t[r++]&63,u=t[r++]&63;s.push((o&31)<<12|c<<6|u)}else if((o&248)===240){const c=t[r++]&63,u=t[r++]&63,l=t[r++]&63;let d=(o&7)<<18|c<<12|u<<6|l;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(o);s.length>=aV&&(a+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(a+=String.fromCharCode(...s)),a}const oV=new TextDecoder,cV=200;function uV(t,e,n){const r=t.subarray(e,e+n);return oV.decode(r)}function lV(t,e,n){return n>cV?uV(t,e,n):uA(t,e,n)}class Tp{constructor(e,n){this.type=e,this.data=n}}class zn extends Error{constructor(e){super(e);const n=Object.create(zn.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:zn.name})}}const ed=4294967295;function dV(t,e,n){const r=n/4294967296,i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function lA(t,e,n){const r=Math.floor(n/4294967296),i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function dA(t,e){const n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}function fV(t,e){const n=t.getUint32(e),r=t.getUint32(e+4);return n*4294967296+r}const hV=-1,pV=4294967296-1,mV=17179869184-1;function gV({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=mV)if(e===0&&t<=pV){const n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t),n}else{const n=t/4294967296,r=t&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,e<<2|n&3),s.setUint32(4,r),i}else{const n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,e),lA(r,4,t),n}}function yV(t){const e=t.getTime(),n=Math.floor(e/1e3),r=(e-n*1e3)*1e6,i=Math.floor(r/1e9);return{sec:n+i,nsec:r-i*1e9}}function vV(t){if(t instanceof Date){const e=yV(t);return gV(e)}else return null}function wV(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const n=e.getUint32(0),r=e.getUint32(4),i=(n&3)*4294967296+r,s=n>>>2;return{sec:i,nsec:s}}case 12:{const n=dA(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new zn(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function bV(t){const e=wV(t);return new Date(e.sec*1e3+e.nsec/1e6)}const RV={type:hV,encode:vV,decode:bV};class Ep{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(RV)}register({type:e,encode:n,decode:r}){if(e>=0)this.encoders[e]=n,this.decoders[e]=r;else{const i=-1-e;this.builtInEncoders[i]=n,this.builtInDecoders[i]=r}}tryToEncode(e,n){for(let r=0;r<this.builtInEncoders.length;r++){const i=this.builtInEncoders[r];if(i!=null){const s=i(e,n);if(s!=null){const a=-1-r;return new Tp(a,s)}}}for(let r=0;r<this.encoders.length;r++){const i=this.encoders[r];if(i!=null){const s=i(e,n);if(s!=null){const a=r;return new Tp(a,s)}}}return e instanceof Tp?e:null}decode(e,n,r){const i=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return i?i(e,n,r):new Tp(n,e)}}Ep.defaultCodec=new Ep;function $V(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function Wv(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):$V(t)?new Uint8Array(t):Uint8Array.from(t)}var fA=function(t,e,n){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],n&&(i=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");i&&(r=function(){try{i.call(this)}catch(s){return Promise.reject(s)}}),t.stack.push({value:e,dispose:r,async:n})}else n&&t.stack.push({async:!0});return e},hA=function(t){return function(e){function n(a){e.error=e.hasError?new t(a,e.error,"An error was suppressed during disposal."):a,e.hasError=!0}var r,i=0;function s(){for(;r=e.stack.pop();)try{if(!r.async&&i===1)return i=0,e.stack.push(r),Promise.resolve().then(s);if(r.dispose){var a=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(a).then(s,function(o){return n(o),s()})}else i|=1}catch(o){n(o)}if(i===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return s()}}(typeof SuppressedError=="function"?SuppressedError:function(t,e,n){var r=new Error(n);return r.name="SuppressedError",r.error=t,r.suppressed=e,r});const kV=100,TV=2048;class aw{constructor(e){this.entered=!1,this.extensionCodec=e?.extensionCodec??Ep.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??kV,this.initialBufferSize=e?.initialBufferSize??TV,this.sortKeys=e?.sortKeys??!1,this.forceFloat32=e?.forceFloat32??!1,this.ignoreUndefined=e?.ignoreUndefined??!1,this.forceIntegerToFloat=e?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new aw({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}enteringGuard(){return this.entered=!0,{[Symbol.dispose]:()=>{this.entered=!1}}}encodeSharedRef(e){const n={stack:[],error:void 0,hasError:!1};try{if(this.entered)return this.clone().encodeSharedRef(e);const r=fA(n,this.enteringGuard(),!1);return this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}catch(r){n.error=r,n.hasError=!0}finally{hA(n)}}encode(e){const n={stack:[],error:void 0,hasError:!1};try{if(this.entered)return this.clone().encode(e);const r=fA(n,this.enteringGuard(),!1);return this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}catch(r){n.error=r,n.hasError=!0}finally{hA(n)}}doEncode(e,n){if(n>this.maxDepth)throw new Error(`Too deep objects in depth ${n}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,n)}ensureBufferSizeToWrite(e){const n=this.pos+e;this.view.byteLength<n&&this.resizeBuffer(n*2)}resizeBuffer(e){const n=new ArrayBuffer(e),r=new Uint8Array(n),i=new DataView(n);r.set(this.bytes),this.view=i,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){const r=eV(e);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),sV(e,this.bytes,this.pos),this.pos+=r}encodeObject(e,n){const r=this.extensionCodec.tryToEncode(e,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,n);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,n);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){const n=e.byteLength;if(n<256)this.writeU8(196),this.writeU8(n);else if(n<65536)this.writeU8(197),this.writeU16(n);else if(n<4294967296)this.writeU8(198),this.writeU32(n);else throw new Error(`Too large binary: ${n}`);const r=Wv(e);this.writeU8a(r)}encodeArray(e,n){const r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const i of e)this.doEncode(i,n+1)}countWithoutUndefined(e,n){let r=0;for(const i of n)e[i]!==void 0&&r++;return r}encodeMap(e,n){const r=Object.keys(e);this.sortKeys&&r.sort();const i=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(`Too large map object: ${i}`);for(const s of r){const a=e[s];this.ignoreUndefined&&a===void 0||(this.encodeString(s),this.doEncode(a,n+1))}}encodeExtension(e){if(typeof e.data=="function"){const r=e.data(this.pos+6),i=r.length;if(i>=4294967296)throw new Error(`Too large extension object: ${i}`);this.writeU8(201),this.writeU32(i),this.writeI8(e.type),this.writeU8a(r);return}const n=e.data.length;if(n===1)this.writeU8(212);else if(n===2)this.writeU8(213);else if(n===4)this.writeU8(214);else if(n===8)this.writeU8(215);else if(n===16)this.writeU8(216);else if(n<256)this.writeU8(199),this.writeU8(n);else if(n<65536)this.writeU8(200),this.writeU16(n);else if(n<4294967296)this.writeU8(201),this.writeU32(n);else throw new Error(`Too large extension object: ${n}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const n=e.length;this.ensureBufferSizeToWrite(n),this.bytes.set(e,this.pos),this.pos+=n}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),dV(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),lA(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}}function EV(t,e){return new aw(e).encodeSharedRef(t)}function Hv(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}const SV=16,_V=16;class AV{constructor(e=SV,n=_V){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=n,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,n,r){const i=this.caches[r-1];e:for(const s of i){const a=s.bytes;for(let o=0;o<r;o++)if(a[o]!==e[n+o])continue e;return s.str}return null}store(e,n){const r=this.caches[e.length-1],i={bytes:e,str:n};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=i:r.push(i)}decode(e,n,r){const i=this.find(e,n,r);if(i!=null)return this.hit++,i;this.miss++;const s=uA(e,n,r),a=Uint8Array.prototype.slice.call(e,n,n+r);return this.store(a,s),s}}var Sp=function(t,e,n){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],n&&(i=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");i&&(r=function(){try{i.call(this)}catch(s){return Promise.reject(s)}}),t.stack.push({value:e,dispose:r,async:n})}else n&&t.stack.push({async:!0});return e},_p=function(t){return function(e){function n(a){e.error=e.hasError?new t(a,e.error,"An error was suppressed during disposal."):a,e.hasError=!0}var r,i=0;function s(){for(;r=e.stack.pop();)try{if(!r.async&&i===1)return i=0,e.stack.push(r),Promise.resolve().then(s);if(r.dispose){var a=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(a).then(s,function(o){return n(o),s()})}else i|=1}catch(o){n(o)}if(i===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return s()}}(typeof SuppressedError=="function"?SuppressedError:function(t,e,n){var r=new Error(n);return r.name="SuppressedError",r.error=t,r.suppressed=e,r});const Kv="array",td="map_key",pA="map_value",CV=t=>typeof t=="string"||typeof t=="number";class PV{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const n=this.getUninitializedStateFromPool();n.type=Kv,n.position=0,n.size=e,n.array=new Array(e)}pushMapState(e){const n=this.getUninitializedStateFromPool();n.type=td,n.readCount=0,n.size=e,n.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===Kv){const r=e;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(e.type===td||e.type===pA){const r=e;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const nd=-1,Vv=new DataView(new ArrayBuffer(0)),xV=new Uint8Array(Vv.buffer);try{Vv.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const mA=new RangeError("Insufficient data"),NV=new AV;class ow{constructor(e){this.totalPos=0,this.pos=0,this.view=Vv,this.bytes=xV,this.headByte=nd,this.stack=new PV,this.entered=!1,this.extensionCodec=e?.extensionCodec??Ep.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??ed,this.maxBinLength=e?.maxBinLength??ed,this.maxArrayLength=e?.maxArrayLength??ed,this.maxMapLength=e?.maxMapLength??ed,this.maxExtLength=e?.maxExtLength??ed,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:NV}clone(){return new ow({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=nd,this.stack.reset()}setBuffer(e){const n=Wv(e);this.bytes=n,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===nd&&!this.hasRemaining(1))this.setBuffer(e);else{const n=this.bytes.subarray(this.pos),r=Wv(e),i=new Uint8Array(n.length+r.length);i.set(n),i.set(r,n.length),this.setBuffer(i)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:n,pos:r}=this;return new RangeError(`Extra ${n.byteLength-r} of ${n.byteLength} byte(s) found at buffer[${e}]`)}enteringGuard(){return this.entered=!0,{[Symbol.dispose]:()=>{this.entered=!1}}}decode(e){const n={stack:[],error:void 0,hasError:!1};try{if(this.entered)return this.clone().decode(e);const r=Sp(n,this.enteringGuard(),!1);this.reinitializeState(),this.setBuffer(e);const i=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return i}catch(r){n.error=r,n.hasError=!0}finally{_p(n)}}*decodeMulti(e){const n={stack:[],error:void 0,hasError:!1};try{if(this.entered){yield*this.clone().decodeMulti(e);return}const r=Sp(n,this.enteringGuard(),!1);for(this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}catch(r){n.error=r,n.hasError=!0}finally{_p(n)}}async decodeAsync(e){const n={stack:[],error:void 0,hasError:!1};try{if(this.entered)return this.clone().decodeAsync(e);const r=Sp(n,this.enteringGuard(),!1);let i=!1,s;for await(const u of e){if(i)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(u);try{s=this.doDecodeSync(),i=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return s}const{headByte:a,pos:o,totalPos:c}=this;throw new RangeError(`Insufficient data in parsing ${Hv(a)} at ${c} (${o} in the current buffer)`)}catch(r){n.error=r,n.hasError=!0}finally{_p(n)}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,n){const r={stack:[],error:void 0,hasError:!1};try{if(this.entered){yield*this.clone().decodeMultiAsync(e,n);return}const i=Sp(r,this.enteringGuard(),!1);let s=n,a=-1;for await(const o of e){if(n&&a===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),s&&(a=this.readArraySize(),s=!1,this.complete());try{for(;yield this.doDecodeSync(),--a!==0;);}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}}catch(i){r.error=i,r.hasError=!0}finally{_p(r)}}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let n;if(e>=224)n=e-256;else if(e<192)if(e<128)n=e;else if(e<144){const i=e-128;if(i!==0){this.pushMapState(i),this.complete();continue e}else n={}}else if(e<160){const i=e-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else n=[]}else{const i=e-160;n=this.decodeString(i,0)}else if(e===192)n=null;else if(e===194)n=!1;else if(e===195)n=!0;else if(e===202)n=this.readF32();else if(e===203)n=this.readF64();else if(e===204)n=this.readU8();else if(e===205)n=this.readU16();else if(e===206)n=this.readU32();else if(e===207)this.useBigInt64?n=this.readU64AsBigInt():n=this.readU64();else if(e===208)n=this.readI8();else if(e===209)n=this.readI16();else if(e===210)n=this.readI32();else if(e===211)this.useBigInt64?n=this.readI64AsBigInt():n=this.readI64();else if(e===217){const i=this.lookU8();n=this.decodeString(i,1)}else if(e===218){const i=this.lookU16();n=this.decodeString(i,2)}else if(e===219){const i=this.lookU32();n=this.decodeString(i,4)}else if(e===220){const i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else n=[]}else if(e===221){const i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue e}else n=[]}else if(e===222){const i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else n={}}else if(e===223){const i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else n={}}else if(e===196){const i=this.lookU8();n=this.decodeBinary(i,1)}else if(e===197){const i=this.lookU16();n=this.decodeBinary(i,2)}else if(e===198){const i=this.lookU32();n=this.decodeBinary(i,4)}else if(e===212)n=this.decodeExtension(1,0);else if(e===213)n=this.decodeExtension(2,0);else if(e===214)n=this.decodeExtension(4,0);else if(e===215)n=this.decodeExtension(8,0);else if(e===216)n=this.decodeExtension(16,0);else if(e===199){const i=this.lookU8();n=this.decodeExtension(i,1)}else if(e===200){const i=this.lookU16();n=this.decodeExtension(i,2)}else if(e===201){const i=this.lookU32();n=this.decodeExtension(i,4)}else throw new zn(`Unrecognized type byte: ${Hv(e)}`);this.complete();const r=this.stack;for(;r.length>0;){const i=r.top();if(i.type===Kv)if(i.array[i.position]=n,i.position++,i.position===i.size)n=i.array,r.release(i);else continue e;else if(i.type===td){if(!CV(n))throw new zn("The type of key must be string or number but "+typeof n);if(n==="__proto__")throw new zn("The key __proto__ is not allowed");i.key=n,i.type=pA;continue e}else if(i.map[i.key]=n,i.readCount++,i.readCount===i.size)n=i.map,r.release(i);else{i.key=null,i.type=td;continue e}}return n}}readHeadByte(){return this.headByte===nd&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=nd}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new zn(`Unrecognized array type byte: ${Hv(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new zn(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new zn(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,n){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,n):this.decodeBinary(e,n)}decodeUtf8String(e,n){if(e>this.maxStrLength)throw new zn(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+n+e)throw mA;const r=this.pos+n;let i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?i=this.keyDecoder.decode(this.bytes,r,e):i=lV(this.bytes,r,e),this.pos+=n+e,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===td:!1}decodeBinary(e,n){if(e>this.maxBinLength)throw new zn(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+n))throw mA;const r=this.pos+n,i=this.bytes.subarray(r,r+e);return this.pos+=n+e,i}decodeExtension(e,n){if(e>this.maxExtLength)throw new zn(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+n),i=this.decodeBinary(e,n+1);return this.extensionCodec.decode(i,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=fV(this.view,this.pos);return this.pos+=8,e}readI64(){const e=dA(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}}function DV(t,e){return new ow(e).decode(t)}const IV=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]",OV=(t,e=0,n=t.byteLength-e)=>{if(!IV(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return xp.from(t,e,n)},gA=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?xp.from(t,e):xp.from(t)},LV=/^[A-Za-z0-9+/]*={0,2}$/,MV=t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!LV.exec(t))throw new TypeError("Invalid base64 string.");const e=gA(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},zV=t=>{const e=gA(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},FV=t=>{let e;if(typeof t=="string"?e=zV(t):e=t,typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return OV(e.buffer,e.byteOffset,e.byteLength).toString("base64")},{getDocument:qV}=jo;function GV({nodes:t,edges:e,...n}){return{...n,nodes:$c(t,({x:r,y:i,width:s,height:a,isCompound:o,...c})=>({...c,b:[r,i,s,a],c:o})),edges:$c(e,({points:r,controlPoints:i,labelBBox:s,dotpos:a,...o})=>({...!!i&&{cp:i},...!!s&&{l:s},...!!a&&{dp:a},...o,p:r}))}}function jV({nodes:t,edges:e,autoLayout:n,...r}){return{...r,autoLayout:mC(n)?{direction:n}:n,nodes:$c(t,({b:i,c:s,...a})=>({x:i[0],y:i[1],width:i[2],height:i[3],isCompound:s,...a})),edges:$c(e,({p:i,cp:s,l:a,dp:o,...c})=>({...!!s&&{controlPoints:s},...!!a&&{labelBBox:a},...!!o&&{dotpos:o},...c,points:i}))}}const yA=500;function BV(t){const e=EV(GV(t)),n=FV(e),r=[];let i=0;for(;i<n.length;)r.push(" * "+n.slice(i,Math.min(i+yA,n.length))),i+=yA;return r.unshift("/**"," * @likec4-generated(v1)"),r.push(" */"),r.join(`
227
- `)}function vA(t){return t.includes("@likec4-generated")}function UV(t){if(!vA(t))throw new Error(`Not a likec4-generated comment: ${t}`);const e=t.trim().split(`
228
- `).filter(r=>!r.includes("**")&&!r.includes("@likec4-")&&!r.includes("*/")).map(r=>r.replaceAll("*","").trim()).join(""),n=MV(e);return jV(DV(n))}function Xv(t){const e=wd(t.$cstNode,["BLOCK_COMMENT"]);if(!(!e||!vA(e.text)))try{return UV(e.text)}catch(n){const r=qV(t);we(n),Ke.warn(`Ignoring manual layout of "${t.name??"unnamed"}" at ${r.uri.fsPath}:${1+(e.range.start.line||0)}`);return}}function WV(t){return class extends t{parseDeploymentView(e){const n=e.body;Ce(n,"DynamicElementView body is not defined");const r=n.props.filter(this.isValid),i=this.getAstNodePath(e);let s=e.name;s||(s="deployment_"+Zl(this.doc.uri.toString(),i));const a=Nr(r.find(d=>d.key==="title")?.value)??null,o=ct(r.find(d=>d.key==="description")?.value)??null,c=this.convertTags(n),u=this.convertLinks(n);wp.writeId(e,s);const l=Xv(e);return{__:"deployment",id:s,astPath:i,title:a,description:o,tags:c,links:qn(u)?u:null,rules:n.rules.flatMap(d=>{try{return this.isValid(d)?this.parseDeploymentViewRule(d):[]}catch(f){return we(f),[]}}),...l&&{manualLayout:l}}}parseDeploymentViewRule(e){if(Ea(e))return this.parseDeploymentViewRulePredicate(e);if(El(e))return Mv(e);if(w0(e))return this.parseDeploymentViewRuleStyle(e);Ne(e)}parseDeploymentViewRulePredicate(e){const n=[];let r=e.expr;for(;r;){try{const i=r.value;if(sn(i)&&this.isValid(i))switch(!0){case MB(i):n.unshift(this.parseFqnExpr(i));break;case aU(i):n.unshift(this.parseElementWhereExpr(i));break;case h0(i):n.unshift(this.parseRelationExpr(i));break;case hU(i):n.unshift(this.parseRelationWhereExpr(i));break;default:Ne(i)}}catch(i){we(i)}r=r.prev}return e.isInclude?{include:n}:{exclude:n}}parseDeploymentViewRuleStyle(e){const n=e.props.filter(Iy),r=e.props.find(La),i=ct(r?.value);return{targets:this.parseFqnExpressions(e.targets),...i&&{notation:i},style:{...Fi(n,this.isValid)}}}}}function HV(t){let e;for(;e=t.value?.ref;){if(vn(e))return null;if(ur(e))return e;if(vt(t.parent))return null;t=t.parent}return null}const wA=({operator:t,not:e},n)=>t.startsWith("!=")?{neq:n}:t.startsWith("=")?{eq:n}:e?{neq:n}:{eq:n};function bA(t){return!q0(t)&&!G0(t)?null:t.participant}function Hs(t){switch(!0){case VB(t):{const e=t.value?.ref?.name,n=bA(t);Ce(e,"Expected tag name");const r={tag:wA(t,e)};return n?{participant:n,operator:r}:r}case HB(t):{const e=t.value?.ref?.name,n=bA(t);Ce(e,"Expected kind name");const r={kind:wA(t,e)};return n?{participant:n,operator:r}:r}case(M0(t)||F0(t)):return{not:Hs(t.value)};case gU(t):{const e=Hs(t.left),n=Hs(t.right),r=t.operator.toLowerCase();switch(r){case"and":{const i=[mw(e)?e.and:e,mw(n)?n.and:n].flat();return Ce(qn(i),"Expected non-empty array"),{and:i}}case"or":{const i=[pw(e)?e.or:e,pw(n)?n.or:n].flat();return Ce(qn(i),"Expected non-empty array"),{or:i}}default:Ne(r)}}default:Ne(t)}}function KV(t){return class extends t{parseFqnRef(e){const n=ln(e.value.ref,`FqnRef is empty ${e.$cstNode?.range.start.line}:${e.$cstNode?.range.start.character}`);if(Ln(n)){const r=HV(e);if(!r)return{model:this.resolveFqn(n)};const i=this.resolveFqn(r),s=this.resolveFqn(n);return{deployment:i,element:s}}if(f0(n))return{deployment:this.resolveFqn(n)};Ne(n)}parseFqnExpr(e){if(Fs(e))return{wildcard:!0};if(Wy(e))return this.parseFqnRefExpr(e);Ne(e)}parseFqnRefExpr(e){const n=this.parseFqnRef(e.ref);switch(!0){case e.selector==="._":return{ref:n,selector:"expanded"};case e.selector===".**":return{ref:n,selector:"descendants"};case e.selector===".*":return{ref:n,selector:"children"};default:return{ref:n}}}parseElementWhereExpr(e){return{where:{expr:this.parseFqnExpr(e.subject),condition:e.where?Hs(e.where):{kind:{neq:"--always-true--"}}}}}parseFqnExpressions(e){const n=[];let r=e;for(;r;){try{sn(r.value)&&this.isValid(r.value)&&n.push(this.parseFqnExpr(r.value))}catch(i){we(i)}r=r.prev}return n.reverse()}parseRelationWhereExpr(e){return{where:{expr:this.parseRelationExpr(e.subject),condition:e.where?Hs(e.where):{kind:{neq:"--always-true--"}}}}}parseRelationExpr(e){if(Zy(e),My(e))return{source:this.parseFqnExpr(e.source.from),target:this.parseFqnExpr(e.target),isBidirectional:e.source.isBidirectional};if(A0(e))return{inout:this.parseFqnExpr(e.inout.to)};if(Yy(e))return{outgoing:this.parseFqnExpr(e.from)};if(Ky(e))return{incoming:this.parseFqnExpr(e.to)};Ne(e)}}}function VV(t){return class extends t{parseGlobals(){const{parseResult:e,c4Globals:n}=this.doc,r=this.isValid,i=e.value.globals.filter(r),s=i.flatMap(o=>o.predicates.filter(r));for(const o of s)try{const c=o.name;if(!ie(c))continue;if(c in n.predicates){Ke.warn(`Global predicate named "${c}" is already defined`);continue}this.parseAndStoreGlobalPredicateGroupOrDynamic(o,c,n)}catch(c){we(c)}const a=i.flatMap(o=>o.styles.filter(r));for(const o of a)try{const c=o.id.name;if(!ie(c))continue;if(c in n.styles){Ke.warn(`Global style named "${c}" is already defined`);continue}const u=this.parseGlobalStyleOrGroup(o);u.length>0&&(n.styles[c]=u)}catch(c){we(c)}}parseAndStoreGlobalPredicateGroupOrDynamic(e,n,r){if(Uu(e)){const i=this.parseGlobalPredicateGroup(e);i.length>0&&(r.predicates[n]=i);return}if(Bu(e)){const i=this.parseGlobalDynamicPredicateGroup(e);i.length>0&&(r.dynamicPredicates[n]=i);return}Ne(e)}parseGlobalPredicateGroup(e){return e.predicates.map(n=>this.parseViewRulePredicate(n))}parseGlobalDynamicPredicateGroup(e){return e.predicates.map(n=>this.parseDynamicViewIncludePredicate(n))}parseGlobalStyleOrGroup(e){if(Na(e))return[this.parseViewRuleStyle(e)];if(Ms(e))return e.styles.map(n=>this.parseViewRuleStyle(n));Ne(e)}}}function XV(t){return class extends t{parseModel(){const e=this.doc;for(const n of x4(e))try{if(Ln(n)){e.c4Elements.push(this.parseElement(n));continue}if(Pr(n)){this.isValid(n)&&e.c4Relations.push(this.parseRelation(n));continue}if(Aa(n)){const r=this.parseExtendElement(n);r&&e.c4ExtendElements.push(r);continue}Ne(n)}catch(r){we(r)}}parseElement(e){const n=this.isValid,r=this.resolveFqn(e),i=ln(e.kind.ref,"Element kind is not resolved").name,s=this.parseTags(e.body),a=e.body?.props.find(Ni)?.props,o=Fi(a,n),c=this.getMetadata(e.body?.props.find(Ds)),u=this.getAstNodePath(e);let[l,d,f]=e.props??[];const h=Je(e.body?.props??[],Ge(n),Ge(Lu),Ar(R=>[R.key,R.value||void 0]));l=ct(l??h.title),d=ct(h.description??d),f=Nr(h.technology??f);const m=this.parseLinks(e.body),y=e.body?.props.find(Cr);if(y&&n(y)){const R=y.libicon?.ref?.name??y.value;ie(R)&&(o.icon=R)}return{id:r,kind:i,astPath:u,title:l??e.name,...c&&{metadata:c},...s&&{tags:s},...m&&qn(m)&&{links:m},...ie(f)&&{technology:f},...ie(d)&&{description:d},style:o}}parseExtendElement(e){this.isValid;const n=this.resolveFqn(e),r=this.parseTags(e.body),i=this.getMetadata(e.body?.props.find(Ds)),s=this.getAstNodePath(e),a=this.parseLinks(e.body)??[];return!r&&Lt(i??{})&&Lt(a)?null:{id:n,astPath:s,...i&&{metadata:i},...r&&{tags:r},...a&&qn(a)&&{links:a}}}parseRelation(e){const n=this.isValid,r=D4(e),i=this.resolveFqn(r.target),s=this.resolveFqn(r.source),a=this.parseTags(e)??this.parseTags(e.body),o=this.parseLinks(e.body),c=e.kind?.ref?.name,u=this.getMetadata(e.body?.props.find(Ds)),l=this.getAstNodePath(e),d=Ar(e.body?.props.filter(yl).filter(w=>sn(w.value))??[],w=>[w.key,w.value]),f=Je(e.body?.props??[],Ge(fl),rn(w=>w.value.view.ref?.name),Ge(ie),Ra()),h=ct(e.title??d.title)??"",m=ct(d.description),y=Nr(e.technology)??ct(d.technology),R=e.body?.props.find(Jh);return{id:Zl(l,s,i),astPath:l,source:s,target:i,title:h,...u&&{metadata:u},...ie(y)&&{technology:y},...ie(m)&&{description:m},...c&&{kind:c},...a&&{tags:a},...qn(o)&&{links:o},...Lv(R?.props,n),...f&&{navigateTo:f}}}}}function YV(t){return class extends t{parsePredicate(e){if(NB(e))return this.parseElementPredicate(e);if(FB(e))return this.parseRelationPredicate(e);Ne(e)}parseElementPredicate(e){if(Nh(e))return this.parseElementPredicateWith(e);if(By(e))return this.parseElementPredicateWhere(e);if(Sy(e))return this.parseElementExpression(e);Ne(e)}parseElementExpressionsIterator(e){const n=[];let r=e;for(;r;){try{r.value&&n.unshift(this.parseElementExpression(r.value))}catch(i){we(i)}r=r.prev}return n}parseElementExpression(e){if(Fs(e))return{wildcard:!0};if(xh(e))return Ce(e.kind?.ref,"ElementKindExpr kind is not resolved: "+e.$cstNode?.text),{elementKind:e.kind.ref.name,isEqual:e.isEqual};if(Dh(e)){Ce(e.tag?.ref,"ElementTagExpr tag is not resolved: "+e.$cstNode?.text);let n=e.tag.$refText;return n.startsWith("#")&&(n=n.slice(1)),{elementTag:n,isEqual:e.isEqual}}if(T0(e)){const n=wn(e.expand);return Ce(n,"Element not found "+e.expand.$cstNode?.text),{expanded:this.resolveFqn(n)}}if(jy(e)){const n=wn(e.parent);return Ce(n,"Element not found "+e.parent.$cstNode?.text),{element:this.resolveFqn(n),isChildren:e.suffix===".*",isDescendants:e.suffix===".**"}}if(Iu(e)){const n=wn(e);return Ce(n,"Element not found "+e.$cstNode?.text),{element:this.resolveFqn(n)}}Ne(e)}parseElementPredicateWhere(e){return{where:{expr:this.parseElementExpression(e.subject),condition:e.where?Hs(e.where):{kind:{neq:"--always-true--"}}}}}parseElementPredicateWith(e){const n=this.parseElementPredicate(e.subject);return(e.custom?.props??[]).reduce((r,i)=>{if(!this.isValid(i))return r;if(Hh(i)){const s=i.value.view.$refText;return ie(s)&&(r.custom.navigateTo=s),r}if(Lu(i))return Xt(i.value)&&(r.custom[i.key]=ct(i.value)||""),r;if(Cr(i)){const s=i.libicon?.ref?.name??i.value;return Xt(s)&&(r.custom[i.key]=s),r}if(Is(i)){const s=Ql(i);return Xt(s)&&(r.custom[i.key]=s),r}if(Qh(i)||gh(i))return Xt(i.value)&&(r.custom[i.key]=i.value),r;if(Kh(i))return Xt(i.value)&&(r.custom[i.key]=eA(i)),r;if(La(i))return ie(i.value)&&(r.custom[i.key]=ct(i.value)),r;if(Xy(i))return ty(i.value)&&(r.custom[i.key]=i.value),r;if(tv(i)||sv(i)||Qy(i))return ie(i.value)&&(r.custom[i.key]=Ja(i)),r;Ne(i)},{custom:{expr:n}})}parseRelationPredicate(e){if(ev(e)){let n=Zy(e.subject)?this.parseRelationPredicateWhere(e.subject):this.parseRelationExpression(e.subject);return this.parseRelationPredicateWith(e,n)}if(Zy(e))return this.parseRelationPredicateWhere(e);if(Ny(e))return this.parseRelationExpression(e);Ne(e)}parseRelationPredicateWhere(e){return{where:{expr:this.parseRelationExpression(e.subject),condition:e.where?Hs(e.where):{kind:{neq:"--always-true--"}}}}}parseRelationPredicateWith(e,n){return(e.custom?.props??[]).reduce((r,i)=>{if(yl(i)||La(i)||N0(i))return Xt(i.value)&&(r.customRelation[i.key]=ct(i.value)??""),r;if(yu(i))return ie(i.value)&&(r.customRelation[i.key]=i.value),r;if(Is(i)){const s=Ql(i);return ie(s)&&(r.customRelation[i.key]=s),r}if(Zu(i))return ie(i.value)&&(r.customRelation[i.key]=i.value),r;if(fl(i)){const s=i.value.view.ref?.name;return ie(s)&&(r.customRelation.navigateTo=s),r}Ne(i)},{customRelation:{relation:n}})}parseRelationExpression(e){if(zy(e))return{source:this.parseElementExpression(e.source.from),target:this.parseElementExpression(e.target),isBidirectional:e.source.isBidirectional};if(Vy(e))return{inout:this.parseElementExpression(e.inout.to)};if(Jy(e))return{outgoing:this.parseElementExpression(e.from)};if(_0(e))return{incoming:this.parseElementExpression(e.to)};Ne(e)}}}function JV(t){return class extends t{parseSpecification(){const{parseResult:{value:{specifications:e}},c4Specification:n}=this.doc,r=this.isValid,i=e.flatMap(u=>u.elements.filter(this.isValid));for(const{kind:u,props:l}of i)try{const d=u.name;if(!ie(d))continue;if(d in n.elements){Ke.warn(`Element kind "${d}" is already defined`);continue}const f=l.find(Ni),h=Je(l.filter(nv)??[],Ge(m=>this.isValid(m)&&sn(m.value)),Ar(m=>[m.key,ct(m.value)]));n.elements[d]={...h,style:{...Fi(f?.props,this.isValid)}}}catch(d){we(d)}const s=e.flatMap(u=>u.relationships.filter(this.isValid));for(const{kind:u,props:l}of s)try{const d=u.name;if(!ie(d))continue;if(d in n.relationships){Ke.warn(`Relationship kind "${d}" is already defined`);continue}const f=Je(l.filter(I0)??[],Ge(h=>this.isValid(h)&&sn(h.value)),Ar(h=>[h.key,ct(h.value)]));n.relationships[d]={...f,...Lv(l,this.isValid)}}catch(d){we(d)}const a=e.flatMap(u=>u.tags.filter(this.isValid));for(const u of a){const l=u.tag.name;ie(l)&&n.tags.add(l)}const o=e.flatMap(u=>u.deploymentNodes.filter(r));for(const u of o)try{Object.assign(n.deployments,this.parseSpecificationDeploymentNodeKind(u))}catch(l){we(l)}const c=e.flatMap(u=>u.colors.filter(r));for(const{name:u,color:l}of c)try{const d=u.name;if(d in n.colors){Ke.warn(`Custom color "${d}" is already defined`);continue}n.colors[d]={color:l}}catch(d){we(d)}}parseSpecificationDeploymentNodeKind({kind:e,props:n}){const r=e.name;if(!ie(r))throw new Error("DeploymentNodeKind name is not resolved");const i=n.find(Ni),s=Je(n.filter(nv)??[],Ge(a=>this.isValid(a)&&sn(a.value)),Ar(a=>[a.key,ct(a.value)]));return{[r]:{...s,style:{...Fi(i?.props,this.isValid)}}}}}}function QV(t){return class extends t{parseViews(){const e=this.isValid;for(const n of this.doc.parseResult.value.views){const r=n.styles.flatMap(i=>{try{return e(i)?this.parseViewRuleStyleOrGlobalRef(i):[]}catch(s){return we(s),[]}});for(const i of n.views)try{if(!e(i))continue;switch(!0){case Ih(i):this.doc.c4Views.push(this.parseElementView(i,r));break;case b0(i):this.doc.c4Views.push(this.parseDynamicElementView(i,r));break;case Ly(i):this.doc.c4Views.push(this.parseDeploymentView(i));break;default:Ne(i)}}catch(s){we(s)}}}parseElementView(e,n){const r=e.body;Ce(r,"ElementView body is not defined");const i=this.getAstNodePath(e);let s=null;if("viewOf"in e){const h=wn(e.viewOf),m=h&&this.resolveFqn(h);m?s=m:Ke.warn("viewOf is not resolved: "+e.$cstNode?.text)}let a=e.name;a||(a="view_"+Zl(this.doc.uri.toString(),i,s??""));const o=Nr(r.props.find(h=>h.key==="title")?.value)??null,c=ct(r.props.find(h=>h.key==="description")?.value)??null,u=this.convertTags(r),l=this.convertLinks(r),d=Xv(e),f={__:"element",id:a,astPath:i,title:o,description:c,tags:u,links:qn(l)?l:null,rules:[...n,...r.rules.flatMap(h=>{try{return this.isValid(h)?this.parseViewRule(h):[]}catch(m){return we(m),[]}})],...s&&{viewOf:s},...d&&{manualLayout:d}};if(wp.writeId(e,f.id),"extends"in e){const h=e.extends.view.ref;return Ce(h?.name,"view extends is not resolved: "+e.$cstNode?.text),Object.assign(f,{extends:h.name})}return f}parseViewRule(e){if(fh(e))return this.parseViewRulePredicate(e);if(ov(e))return this.parseViewRuleGlobalPredicateRef(e);if(Oy(e))return this.parseViewRuleStyleOrGlobalRef(e);if(El(e))return Mv(e);if(ip(e))return this.parseViewRuleGroup(e);Ne(e)}parseViewRulePredicate(e){const n=[];let r=e.predicates;for(;r;){const{value:i,prev:s}=r;try{ie(i)&&this.isValid(i)&&n.unshift(this.parsePredicate(i))}catch(a){we(a)}if(!s)break;r=s}return Gh(e)?{include:n}:{exclude:n}}parseViewRuleGlobalPredicateRef(e){return{predicateId:e.predicate.$refText}}parseViewRuleStyleOrGlobalRef(e){if(Pl(e))return this.parseViewRuleStyle(e);if(cv(e))return this.parseViewRuleGlobalStyle(e);Ne(e)}parseViewRuleGroup(e){const n=[];for(const r of e.groupRules)try{if(!this.isValid(r))continue;if(fh(r)){n.push(this.parseViewRulePredicate(r));continue}if(ip(r)){n.push(this.parseViewRuleGroup(r));continue}Ne(r)}catch(i){we(i)}return{title:Nr(e.title)??null,groupRules:n,...Fi(e.props,this.isValid)}}parseViewRuleStyle(e){const n=e.props.filter(Iy),r=e.target,i=e.props.find(La);return this.parseRuleStyle(n,r,i)}parseRuleStyle(e,n,r){const i=Fi(e,this.isValid),s=ct(r?.value);return{targets:this.parseElementExpressionsIterator(n),...s&&{notation:s},style:{...i}}}parseViewRuleGlobalStyle(e){return{styleId:e.style.$refText}}parseDynamicElementView(e,n){const r=e.body;Ce(r,"DynamicElementView body is not defined");const i=this.isValid,s=r.props.filter(i),a=this.getAstNodePath(e);let o=e.name;o||(o="dynamic_"+Zl(this.doc.uri.toString(),a));const c=Nr(s.find(h=>h.key==="title")?.value)??null,u=ct(s.find(h=>h.key==="description")?.value)??null,l=this.convertTags(r),d=this.convertLinks(r);wp.writeId(e,o);const f=Xv(e);return{__:"dynamic",id:o,astPath:a,title:c,description:u,tags:l,links:qn(d)?d:null,rules:[...n,...r.rules.flatMap(h=>{try{return i(h)?this.parseDynamicViewRule(h):[]}catch(m){return we(m),[]}},[])],steps:r.steps.reduce((h,m)=>{try{i(m)&&(Fy(m)?h.push(this.parseDynamicParallelSteps(m)):h.push(this.parseDynamicStep(m)))}catch(y){we(y)}return h},[]),...f&&{manualLayout:f}}}parseDynamicViewRule(e){if(rU(e))return this.parseDynamicViewIncludePredicate(e);if(R0(e))return this.parseViewRuleGlobalPredicateRef(e);if(Oy(e))return this.parseViewRuleStyleOrGlobalRef(e);if(El(e))return Mv(e);Ne(e)}parseDynamicViewIncludePredicate(e){const n=[];let r=e.predicates;for(;r;){try{if(sn(r.value)&&this.isValid(r.value)){const i=this.parseElementPredicate(r.value);n.unshift(i)}}catch(i){we(i)}r=r.prev}return{include:n}}parseDynamicParallelSteps(e){return{__parallel:e.steps.map(n=>this.parseDynamicStep(n))}}parseDynamicStep(e){const n=wn(e.source);if(!n)throw new Error("Invalid reference to source");const r=wn(e.target);if(!r)throw new Error("Invalid reference to target");let i=this.resolveFqn(n),s=this.resolveFqn(r);const a=ct(e.title)??null;let o={source:i,target:s,title:a};if(e.isBackward&&(o={source:s,target:i,title:a,isBackward:!0}),!ij(e.custom?.props))return o;for(const c of e.custom.props)try{switch(!0){case fl(c):{const u=c.value.view.ref?.name;ie(u)&&(o.navigateTo=u);break}case yl(c):case La(c):case N0(c):{Xt(c.value)&&(o[c.key]=ct(c.value)??"");break}case yu(c):{Xt(c.value)&&(o[c.key]=c.value);break}case Is(c):{const u=Ql(c);Xt(u)&&(o[c.key]=u);break}case Zu(c):{Xt(c.value)&&(o[c.key]=c.value);break}default:Ne(c)}}catch(u){we(u)}return o}}}const ZV=Je(QK,KV,XV,ZK,WV,YV,JV,QV,VV);class e3 extends ZV{}class t3{constructor(e){this.services=e,this.cachedParsers=new AT(e.shared,Be.Validated)}cachedParsers;parse(e){Ce(Ov(e),`Not a FqnIndexedDocument: ${e.uri.toString(!0)}`);try{e=Object.assign(e,{c4Specification:{tags:new Set,elements:{},relationships:{},colors:{},deployments:{}},c4Elements:[],c4ExtendElements:[],c4Relations:[],c4Deployments:[],c4DeploymentRelations:[],c4Globals:{predicates:{},dynamicPredicates:{},styles:{}},c4Views:[]});const n=this.forDocument(e);return n.parseSpecification(),n.parseModel(),n.parseGlobals(),n.parseDeployment(),n.parseViews(),n.doc}catch(n){throw new Error(`Error parsing document ${e.uri.toString()}`,{cause:n})}}forDocument(e){return Ce(Ov(e),`Not a FqnIndexedDocument: ${e.uri.toString(!0)}`),this.cachedParsers.get(e.uri,"DocumentParser",()=>new e3(this.services,e))}}const{findNodeForKeyword:n3}=zd,r3=(t,e,n=0)=>{const r=n>0?" ".repeat(n):"";return[r+`style ${t} {`,...Wf(e).map(([i,s])=>r+` ${i} ${i==="opacity"?s.toString()+"%":s}`),r+"}"]},i3=(t,e)=>n=>{if(!Pl(n))return!1;const r=n.target.value;if(!r||ie(n.target.prev)||!Iu(r))return!1;const i=r.el.ref;return(i?e.getFqn(i):null)===t};function s3(t,{view:e,viewAst:n,targets:r,style:i}){Ce(n.body,`View ${e.id} has no body`);const s=n.$cstNode;Ce(s,"viewCstNode");const a=kc(n.body.rules)?.$cstNode?.range.end??n.body.$cstNode?.range.end;Ce(a,"insertPos is not defined");const o=s.range.start.character+2,c=t.likec4.FqnIndex,u=Ge(n.body.rules,Pl),l=e.__==="element"?e.viewOf:null,d=[],f=[];r.forEach(R=>{const w=rE(u,i3(R,c)),k=l&&Pp(l,R)?R.substring(l.length+1):R;w?d.push({fqn:k,rule:w}):f.push({fqn:k})});const h={start:a,end:a},m=R=>{R.start.line<=h.start.line&&(R.start.line==h.start.line?h.start.character=Math.min(R.start.character,h.start.character):h.start=R.start),R.end.line>=h.end.line&&(R.end.line==h.end.line?h.end.character=Math.max(R.end.character,h.end.character):h.end=R.end)},y=[];if(f.length>0){const R=f.flatMap(({fqn:w})=>r3(w,i,o));y.push(Sn.insert(a,`
229
- `+R.join(`
230
- `))),h.start={line:a.line+1,character:o},h.end={line:a.line+R.length,character:kc(R)?.length??0}}if(d.length>0)for(const{rule:R}of d){const w=R.$cstNode;Ce(w,"RuleCstNode not found");for(const[k,E]of Wf(i)){const _=k==="opacity"?E.toString()+"%":E,C=R.props.find(Z=>Z.key===k);if(C&&C.$cstNode){const{range:{start:Z,end:oe}}=C.$cstNode;m({start:Z,end:oe}),y.push(Sn.replace({start:Z,end:oe},k+" "+_));continue}const I=n3(w,"{")?.range.end;Ce(I,"Opening brace not found");const j=" ".repeat(2+w.range.start.character),J=j+k+" "+_;y.push(Sn.insert(I,`
231
- `+J)),m({start:{line:I.line+1,character:j.length},end:{line:I.line+1,character:J.length}})}}return{modifiedRange:h,edits:y}}const{findNodeForKeyword:a3}=zd;function o3(t,{view:e,viewAst:n,layout:r}){Ce(n.body,`View ${e.id} has no body`);const i=n.$cstNode;Ce(i,"viewCstNode");const s=O4(r.direction),a=rE(n.body.rules,El);let o=`autoLayout ${s}`;if(Bf(r.rankSep)&&(o+=` ${r.rankSep}`,Bf(r.nodeSep)&&(o+=` ${r.nodeSep}`)),a&&a.$cstNode)return Sn.replace(a.$cstNode.range,o);const c=a3(n.body.$cstNode,"}")?.range.start;Ce(c,"Closing brace not found");const u=` ${o}
232
- `;return Sn.insert(c,u)}function c3(t,e=1,n={}){const{indent:r=" ",includeEmptyLines:i=!1}=n;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(e<0)throw new RangeError(`Expected \`count\` to be at least 0, got \`${e}\``);if(typeof r!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(e===0)return t;const s=i?/^/gm:/^(?!\s*$)/gm;return t.replace(s,r.repeat(e))}function u3(t,{viewAst:e,layout:n}){Ce(e.$cstNode,"invalid view.$cstNode");const r=wd(e.$cstNode,["BLOCK_COMMENT"]);let i=BV(n);return e.$cstNode.range.start.character>0&&(i=c3(i,e.$cstNode.range.start.character)),r?Sn.replace(r.range,i.trimStart()):Sn.insert({line:e.$cstNode.range.start.line,character:0},i+`
233
- `)}class l3{constructor(e){this.services=e,this.locator=e.likec4.ModelLocator}locator;async applyChange(e){const n=this.services.shared.lsp.Connection;Ce(n,"LSP Connection not available");let r=null;try{await this.services.shared.workspace.WorkspaceLock.write(async()=>{const{doc:i,edits:s,modifiedRange:a}=this.convertToTextEdit(e),o={uri:i.textDocument.uri,version:i.textDocument.version};if(!s.length)return;const c=await n.workspace.applyEdit({label:`LikeC4 - change view ${e.viewId}`,edit:{changes:{[o.uri]:s}}});if(!c.applied){n.window.showErrorMessage(`Failed to apply changes ${c.failureReason}`);return}r={uri:o.uri,range:a}})}catch(i){Qt.error(`Failed to apply change ${e.change.op} ${e.viewId}`,{error:i})}return r}convertToTextEdit({viewId:e,change:n}){const r=this.locator.locateViewAst(e);if(!r)throw new Error(`LikeC4ModelChanges: view not found: ${e}`);switch(n.op){case"change-element-style":return{doc:r.doc,...s3(this.services,{...r,targets:n.targets,style:n.style})};case"change-autolayout":{const s=o3(this.services,{...r,layout:n.layout});return{doc:r.doc,modifiedRange:s.range,edits:[s]}}case"save-manual-layout":const i=u3(this.services,{...r,layout:n.layout});return{doc:r.doc,modifiedRange:i.range,edits:[i]};default:Ne(n)}}}class d3 extends $T{constructor(e){super(),this.services=e}getNameStrict(e){return ln(this.getName(e),`Failed getName for ${this.services.workspace.AstNodeLocator.getAstNodePath(e)}`)}getName(e){if(Mf(e))return e.name;if(ur(e))return e.element.el.$refText}getNameNode(e){if(Mf(e))return super.getNameNode(e);if(ur(e))return e.element.el.$refNode}}function f3(t){return Je(t,ps(e=>`${e.type}.${e.name}`),Wf(),Si(([e,n])=>n.length===1?n:[]))}class h3 extends TT{constructor(e){super(e)}async computeExports(e,n){const r=[];try{const{specifications:i,models:s,views:a,globals:o,likec4lib:c,deployments:u}=e.parseResult.value;this.exportLibrary(c,r,e),this.exportSpecification(i,r,e),this.exportModel(s,r,e),this.exportViews(a,r,e),this.exportGlobals(o,r,e),this.exportDeployments(u,r,e)}catch(i){we(i)}return r}exportViews(e,n,r){const i=e?.flatMap(s=>s.views);if(!(vt(i)||i.length===0))for(const s of i)try{ie(s.name)&&n.push(this.descriptions.createDescription(s,s.name,r))}catch(a){we(a)}}exportGlobals(e,n,r){if(!(vt(e)||e.length===0)){for(const i of e.flatMap(s=>s.predicates))try{const s=i;ie(s.name)&&n.push(this.descriptions.createDescription(s,s.name,r))}catch(s){we(s)}for(const i of e.flatMap(s=>s.styles))try{const s=i.id;ie(s.name)&&n.push(this.descriptions.createDescription(s,s.name,r))}catch(s){we(s)}}}exportModel(e,n,r){if(!(vt(e)||e.length===0))for(const i of e.flatMap(s=>s.elements))try{Ln(i)&&ie(i.name)&&n.push(this.descriptions.createDescription(i,i.name,r))}catch(s){we(s)}}exportLibrary(e,n,r){if(!vt(e))try{for(const i of e.flatMap(s=>s.icons))n.push(this.descriptions.createDescription(i,i.name,r))}catch(i){we(i)}}exportSpecification(e,n,r){if(!(vt(e)||e.length===0))for(const i of e.flatMap(s=>[...s.elements,...s.relationships,...s.deploymentNodes,...s.tags,...s.colors]))try{switch(!0){case za(i):case qa(i):{ie(i.kind.name)&&n.push(this.descriptions.createDescription(i.kind,i.kind.name,r));continue}case tp(i):{ie(i.tag.name)&&n.push(this.descriptions.createDescription(i.tag,"#"+i.tag.name,r));continue}case ja(i):{ie(i.kind.name)&&n.push(this.descriptions.createDescription(i.kind,i.kind.name,r),this.descriptions.createDescription(i.kind,"."+i.kind.name,r));continue}case ep(i):{ie(i.name.name)&&n.push(this.descriptions.createDescription(i.name,i.name.name,r));continue}default:Ne(i)}}catch(s){we(s)}}exportDeployments(e,n,r){const i=e?.flatMap(s=>s.elements);if(!(vt(i)||i.length===0))for(const s of i)try{vn(s)&&ie(s.name)&&n.push(this.descriptions.createDescription(s,s.name,r))}catch(a){we(a)}}computeLocalScopes(e,n){return new Promise(r=>{const i=e.parseResult.value,s=[],a=new Dn;for(const o of i.models)try{s.push(...this.processContainer(o,a,e))}catch(c){we(c)}for(const o of i.deployments)try{s.push(...this.processDeployments(o,a,e))}catch(c){we(c)}f3(s).forEach(o=>{a.add(i,o)}),r(a)})}processContainer(e,n,r){const i=new Dn,s=[];for(const o of e.elements){if(Pr(o))continue;let c;if(Ln(o)?(ie(o.name)&&i.add(o.name,this.descriptions.createDescription(o,o.name,r)),c=o.body):Aa(o)&&(c=o.body),c&&c.elements.length>0)try{s.push(...this.processContainer(c,n,r))}catch(u){we(u)}}s.length&&Je(s,Ge(o=>!i.has(o.name)),ps(o=>o.name),Uf((o,c)=>{o.length===1&&i.add(c,o[0])}));const a=[...i.values()];return n.addAll(e,a),a}processDeployments(e,n,r){const i=new Set,s=[];for(const a of e.elements){if(xi(a))continue;let o=this.nameProvider.getName(a);if(ie(o)){const c=this.descriptions.createDescription(a,o,r);n.add(e,c),i.add(c.name)}if(vn(a)&&a.body)try{s.push(...this.processDeployments(a.body,n,r))}catch(c){we(c)}}return s.length>0&&Je(s,Ge(a=>!i.has(a.name)),ps(a=>a.name),Uf((a,o)=>{a.length===1&&n.add(e,a[0])})),[...n.get(e).values()]}}const{getDocument:p3}=jo;class m3 extends PT{deploymentsIndex;fqnIndex;constructor(e){super(e),this.fqnIndex=e.likec4.FqnIndex,this.deploymentsIndex=e.likec4.DeploymentsIndex}directChildrenOf(e){return this.fqnIndex.directChildrenOf(e)}uniqueDescedants(e){return new Nt(()=>{const n=e(),r=n&&this.fqnIndex.getFqn(n);return r?this.fqnIndex.uniqueDescedants(r).iterator():null},n=>n?n.next():Zt)}scopeElementRef(e){return this.uniqueDescedants(()=>e.el.ref)}scopeExtendElement({element:e}){return nt([e.el.$nodeDescription]).nonNullable().concat(this.uniqueDescedants(()=>wn(e)))}scopeElementView({viewOf:e,extends:n}){return e?nt([e.el.$nodeDescription]).nonNullable().concat(this.uniqueDescedants(()=>wn(e))):n?nt([n]).flatMap(r=>{const i=r.view.ref;return i?this.scopeElementView(i):ta}):ta}getScope(e){try{const n=this.reflection.getReferenceType(e);try{const r=e.container;if(S0(r))return this.getScopeForFqnRef(r,e);if(n!==Vn)return this.getGlobalScope(n,e);if(O0(r)&&e.property==="el"){const i=r.parent;return i?new fs(this.directChildrenOf(vp(i))):this.getGlobalScope(n,e)}if(Iu(r)&&e.property==="el"){const i=r.parent;if(i)return new fs(this.scopeElementRef(i));if(e.reference.$refText==="this"||e.reference.$refText==="it"){const s=tn(r,Ln);return s?new ET([this.descriptions.createDescription(s,e.reference.$refText)]):zf}}return this.computeScope(e)}catch(r){return we(r),this.getGlobalScope(n,e)}}catch(n){return we(n),zf}}getScopeForFqnRef(e,n){const r=e.parent;if(!r)return this.createScope(this.computeScope(n,Ci).getAllElements(),this.createScope(this.computeScope(n,Ai).getAllElements(),vi(e,Ly)?this.computeScope(n,Vn):zf));const i=r.value.ref;return i?vn(i)?new fs(this.deploymentsIndex.nested(i)):ur(i)?new fs(this.scopeElementRef(i.element)):Ln(i)?new fs(this.uniqueDescedants(()=>i)):Ne(i):zf}computeScope(e,n=this.reflection.getReferenceType(e)){const r=this.reflection.isSubtype(n,Vn),i=[],s=p3(e.container).precomputedScopes;if(!s)return this.getGlobalScope(n,e);const a=c=>this.reflection.isSubtype(c.type,n);let o=e.container;for(;o;){const c=s.get(o).filter(a);c.length>0&&i.push(nt(c)),r&&E0(o)&&i.push(this.scopeExtendElement(o.$container)),r&&k0(o)&&i.push(this.scopeElementView(o.$container)),o=o.$container}return i.reduceRight((c,u)=>this.createScope(u,c),this.getGlobalScope(n,e))}}const g3=`likec4lib { icons {
234
- aws:activate
235
- aws:alexa-for-business
236
- aws:amplify
237
- aws:apache-mxnet-on-aws
238
- aws:api-gateway
239
- aws:app-config
240
- aws:app-flow
241
- aws:app-mesh
242
- aws:app-runner
243
- aws:app-stream
244
- aws:app-sync
245
- aws:application-auto-scaling
246
- aws:application-composer
247
- aws:application-cost-profiler
248
- aws:application-discovery-service
249
- aws:application-migration-service
250
- aws:artifact
251
- aws:athena
252
- aws:audit-manager
253
- aws:augmented-ai-a2i
254
- aws:aurora
255
- aws:auto-scaling
256
- aws:backint-agent
257
- aws:backup
258
- aws:batch
259
- aws:billing-conductor
260
- aws:bottlerocket
261
- aws:braket
262
- aws:budgets
263
- aws:certificate-manager
264
- aws:chatbot
265
- aws:chime
266
- aws:chime-sdk
267
- aws:chime-voice-connector
268
- aws:clean-rooms
269
- aws:client-vpn
270
- aws:cloud-control-api
271
- aws:cloud-development-kit
272
- aws:cloud-directory
273
- aws:cloud-formation
274
- aws:cloud-front
275
- aws:cloud-hsm
276
- aws:cloud-map
277
- aws:cloud-search
278
- aws:cloud-shell
279
- aws:cloud-trail
280
- aws:cloud-wan
281
- aws:cloud-watch
282
- aws:cloud9
283
- aws:code-artifact
284
- aws:code-build
285
- aws:code-catalyst
286
- aws:code-commit
287
- aws:code-deploy
288
- aws:code-guru
289
- aws:code-pipeline
290
- aws:code-star
291
- aws:code-whisperer
292
- aws:cognito
293
- aws:command-line-interface
294
- aws:comprehend
295
- aws:comprehend-medical
296
- aws:compute-optimizer
297
- aws:config
298
- aws:connect
299
- aws:console-mobile-application
300
- aws:control-tower
301
- aws:corretto
302
- aws:cost-and-usage-report
303
- aws:cost-explorer
304
- aws:data-exchange
305
- aws:data-pipeline
306
- aws:data-sync
307
- aws:data-zone
308
- aws:database-migration-service
309
- aws:deep-composer
310
- aws:deep-learning-amis
311
- aws:deep-learning-containers
312
- aws:deep-lens
313
- aws:deep-racer
314
- aws:detective
315
- aws:dev-ops-guru
316
- aws:device-farm
317
- aws:direct-connect
318
- aws:directory-service
319
- aws:distro-for-open-telemetry
320
- aws:document-db
321
- aws:dynamo-db
322
- aws:ec2
323
- aws:ec2-auto-scaling
324
- aws:ec2-image-builder
325
- aws:ecs-anywhere
326
- aws:efs
327
- aws:eks-anywhere
328
- aws:eks-cloud
329
- aws:eks-distro
330
- aws:elasti-cache
331
- aws:elastic-beanstalk
332
- aws:elastic-block-store
333
- aws:elastic-container-registry
334
- aws:elastic-container-service
335
- aws:elastic-disaster-recovery
336
- aws:elastic-fabric-adapter
337
- aws:elastic-inference
338
- aws:elastic-kubernetes-service
339
- aws:elastic-load-balancing
340
- aws:elastic-transcoder
341
- aws:elemental-appliances-software
342
- aws:elemental-conductor
343
- aws:elemental-delta
344
- aws:elemental-link
345
- aws:elemental-live
346
- aws:elemental-media-connect
347
- aws:elemental-media-convert
348
- aws:elemental-media-live
349
- aws:elemental-media-package
350
- aws:elemental-media-store
351
- aws:elemental-media-tailor
352
- aws:elemental-server
353
- aws:emr
354
- aws:event-bridge
355
- aws:express-workflows
356
- aws:fargate
357
- aws:fault-injection-simulator
358
- aws:file-cache
359
- aws:fin-space
360
- aws:firewall-manager
361
- aws:forecast
362
- aws:fraud-detector
363
- aws:free-rtos
364
- aws:fsx
365
- aws:fsx-for-lustre
366
- aws:fsx-for-net-app-ontap
367
- aws:fsx-for-open-zfs
368
- aws:fsx-for-wfs
369
- aws:game-kit
370
- aws:game-lift
371
- aws:game-sparks
372
- aws:genomics-cli
373
- aws:global-accelerator
374
- aws:glue
375
- aws:glue-data-brew
376
- aws:glue-elastic-views
377
- aws:ground-station
378
- aws:guard-duty
379
- aws:health-lake
380
- aws:honeycode
381
- aws:iam-identity-center
382
- aws:identity-and-access-management
383
- aws:inspector
384
- aws:interactive-video-service
385
- aws:io-t-1-click
386
- aws:io-t-analytics
387
- aws:io-t-button
388
- aws:io-t-core
389
- aws:io-t-device-defender
390
- aws:io-t-device-management
391
- aws:io-t-edu-kit
392
- aws:io-t-events
393
- aws:io-t-express-link
394
- aws:io-t-fleet-wise
395
- aws:io-t-greengrass
396
- aws:io-t-robo-runner
397
- aws:io-t-site-wise
398
- aws:io-t-things-graph
399
- aws:io-t-twin-maker
400
- aws:iq
401
- aws:kendra
402
- aws:key-management-service
403
- aws:keyspaces
404
- aws:kinesis
405
- aws:kinesis-data-analytics
406
- aws:kinesis-data-streams
407
- aws:kinesis-firehose
408
- aws:kinesis-video-streams
409
- aws:lake-formation
410
- aws:lambda
411
- aws:launch-wizard
412
- aws:lex
413
- aws:license-manager
414
- aws:lightsail
415
- aws:local-zones
416
- aws:location-service
417
- aws:lookout-for-equipment
418
- aws:lookout-for-metrics
419
- aws:lookout-for-vision
420
- aws:lumberyard
421
- aws:macie
422
- aws:mainframe-modernization
423
- aws:managed-blockchain
424
- aws:managed-grafana
425
- aws:managed-service-for-prometheus
426
- aws:managed-services
427
- aws:managed-streaming-for-apache-kafka
428
- aws:managed-workflows-for-apache-airflow
429
- aws:management-console
430
- aws:marketplace-dark
431
- aws:marketplace-light
432
- aws:memory-db-for-redis
433
- aws:migration-evaluator
434
- aws:migration-hub
435
- aws:monitron
436
- aws:mq
437
- aws:neptune
438
- aws:network-firewall
439
- aws:neuron
440
- aws:nice-dcv
441
- aws:nice-engin-frame
442
- aws:nimble-studio
443
- aws:nitro-enclaves
444
- aws:omics
445
- aws:open-3d-engine
446
- aws:open-search-service
447
- aws:ops-works
448
- aws:organizations
449
- aws:outposts-family
450
- aws:outposts-rack
451
- aws:outposts-servers
452
- aws:panorama
453
- aws:parallel-cluster
454
- aws:personal-health-dashboard
455
- aws:personalize
456
- aws:pinpoint
457
- aws:pinpoint-apis
458
- aws:polly
459
- aws:private-5g
460
- aws:private-certificate-authority
461
- aws:private-link
462
- aws:professional-services
463
- aws:proton
464
- aws:quantum-ledger-database
465
- aws:quick-sight
466
- aws:rds
467
- aws:rds-on-vmware
468
- aws:re-post
469
- aws:red-hat-open-shift-service-on-aws
470
- aws:redshift
471
- aws:rekognition
472
- aws:reserved-instance-reporting
473
- aws:resilience-hub
474
- aws:resource-access-manager
475
- aws:resource-explorer
476
- aws:robo-maker
477
- aws:route-53
478
- aws:s3-on-outposts
479
- aws:sage-maker
480
- aws:sage-maker-ground-truth
481
- aws:sage-maker-studio-lab
482
- aws:savings-plans
483
- aws:secrets-manager
484
- aws:security-hub
485
- aws:security-lake
486
- aws:server-migration-service
487
- aws:serverless-application-repository
488
- aws:service-catalog
489
- aws:service-management-connector
490
- aws:shield
491
- aws:signer
492
- aws:sim-space-weaver
493
- aws:simple-email-service
494
- aws:simple-notification-service
495
- aws:simple-queue-service
496
- aws:simple-storage-service
497
- aws:simple-storage-service-glacier
498
- aws:site-to-site-vpn
499
- aws:snowball
500
- aws:snowball-edge
501
- aws:snowcone
502
- aws:snowmobile
503
- aws:step-functions
504
- aws:storage-gateway
505
- aws:sumerian
506
- aws:supply-chain
507
- aws:support
508
- aws:systems-manager
509
- aws:tensor-flow-on-aws
510
- aws:textract
511
- aws:thinkbox-deadline
512
- aws:thinkbox-frost
513
- aws:thinkbox-krakatoa
514
- aws:thinkbox-sequoia
515
- aws:thinkbox-stoke
516
- aws:thinkbox-xmesh
517
- aws:timestream
518
- aws:tools-and-sdks
519
- aws:torch-serve
520
- aws:training-certification
521
- aws:transcribe
522
- aws:transfer-family
523
- aws:transit-gateway
524
- aws:translate
525
- aws:trusted-advisor
526
- aws:verified-access
527
- aws:verified-permissions
528
- aws:virtual-private-cloud
529
- aws:vmware-cloud-on-aws
530
- aws:vpc-lattice
531
- aws:waf
532
- aws:wavelength
533
- aws:well-architected-tool
534
- aws:wickr
535
- aws:work-docs
536
- aws:work-docs-sdk
537
- aws:work-link
538
- aws:work-mail
539
- aws:work-spaces-family
540
- aws:x-ray
541
- azure:abs-member
542
- azure:active-directory-connect-health
543
- azure:activity-log
544
- azure:administrative-units
545
- azure:advisor
546
- azure:ai-studio
547
- azure:aks-automatic
548
- azure:aks-istio
549
- azure:alerts
550
- azure:all-resources
551
- azure:analysis-services
552
- azure:anomaly-detector
553
- azure:api-center
554
- azure:api-connections
555
- azure:api-management-services
556
- azure:api-proxy
557
- azure:app-compliance-automation
558
- azure:app-configuration
559
- azure:app-registrations
560
- azure:app-service-certificates
561
- azure:app-service-domains
562
- azure:app-service-environments
563
- azure:app-service-plans
564
- azure:app-services
565
- azure:app-space
566
- azure:app-space-component
567
- azure:applens
568
- azure:application-gateway-containers
569
- azure:application-gateways
570
- azure:application-group
571
- azure:application-insights
572
- azure:application-security-groups
573
- azure:aquila
574
- azure:arc-data-services
575
- azure:arc-kubernetes
576
- azure:arc-machines
577
- azure:arc-postgre-sql
578
- azure:arc-sql-managed-instance
579
- azure:arc-sql-server
580
- azure:atm-multistack
581
- azure:auto-scale
582
- azure:automanaged-vm
583
- azure:automation-accounts
584
- azure:availability-sets
585
- azure:avs-vm
586
- azure:azure-a
587
- azure:azure-ad-b2c
588
- azure:azure-api-for-fhir
589
- azure:azure-applied-ai-services
590
- azure:azure-arc
591
- azure:azure-attestation
592
- azure:azure-backup-center
593
- azure:azure-blockchain-service
594
- azure:azure-center-for-sap
595
- azure:azure-chaos-studio
596
- azure:azure-cloud-shell
597
- azure:azure-communication-services
598
- azure:azure-communications-gateway
599
- azure:azure-compute-galleries
600
- azure:azure-cosmos-db
601
- azure:azure-data-catalog
602
- azure:azure-data-explorer-clusters
603
- azure:azure-database-maria-db-server
604
- azure:azure-database-migration-services
605
- azure:azure-database-my-sql-server
606
- azure:azure-database-postgre-sql-server
607
- azure:azure-database-postgre-sql-server-group
608
- azure:azure-databox-gateway
609
- azure:azure-databricks
610
- azure:azure-deployment-environments
611
- azure:azure-dev-ops
612
- azure:azure-dev-tunnels
613
- azure:azure-edge-hardware-center
614
- azure:azure-experimentation-studio
615
- azure:azure-fileshares
616
- azure:azure-firewall-manager
617
- azure:azure-firewall-policy
618
- azure:azure-hcp-cache
619
- azure:azure-hpc-workbenches
620
- azure:azure-hybrid-center
621
- azure:azure-information-protection
622
- azure:azure-io-t-operations
623
- azure:azure-lighthouse
624
- azure:azure-load-testing
625
- azure:azure-managed-grafana
626
- azure:azure-maps-accounts
627
- azure:azure-media-service
628
- azure:azure-migrate
629
- azure:azure-monitor-dashboard
630
- azure:azure-monitor-pipeline
631
- azure:azure-monitors-for-sap-solutions
632
- azure:azure-net-app-files
633
- azure:azure-network-function-manager
634
- azure:azure-network-function-manager-functions
635
- azure:azure-object-understanding
636
- azure:azure-open-ai
637
- azure:azure-operator-5g-core
638
- azure:azure-operator-insights
639
- azure:azure-operator-nexus
640
- azure:azure-operator-service-manager
641
- azure:azure-orbital
642
- azure:azure-programmable-connectivity
643
- azure:azure-purview-accounts
644
- azure:azure-quotas
645
- azure:azure-red-hat-open-shift
646
- azure:azure-sentinel
647
- azure:azure-service-bus
648
- azure:azure-sphere
649
- azure:azure-spring-apps
650
- azure:azure-sql
651
- azure:azure-sql-edge
652
- azure:azure-sql-server-stretch-databases
653
- azure:azure-sql-vm
654
- azure:azure-stack
655
- azure:azure-stack-edge
656
- azure:azure-stack-hci-sizer
657
- azure:azure-storage-mover
658
- azure:azure-support-center-blue
659
- azure:azure-sustainability
660
- azure:azure-synapse-analytics
661
- azure:azure-token-service
662
- azure:azure-video-indexer
663
- azure:azure-virtual-desktop
664
- azure:azure-vmware-solution
665
- azure:azure-workbooks
666
- azure:azurite
667
- azure:backlog
668
- azure:backup-vault
669
- azure:bare-metal-infrastructure
670
- azure:bastions
671
- azure:batch-accounts
672
- azure:batch-ai
673
- azure:biz-talk
674
- azure:blob-block
675
- azure:blob-page
676
- azure:blockchain-applications
677
- azure:blueprints
678
- azure:bonsai
679
- azure:bot-services
680
- azure:branch
681
- azure:browser
682
- azure:bug
683
- azure:builds
684
- azure:business-process-tracking
685
- azure:cache
686
- azure:cache-redis
687
- azure:capacity
688
- azure:capacity-reservation-groups
689
- azure:cdn-profiles
690
- azure:central-service-instance-for-sap
691
- azure:ceres
692
- azure:change-analysis
693
- azure:client-apps
694
- azure:cloud-services-classic
695
- azure:cloud-services-extended-support
696
- azure:cloud-test
697
- azure:code
698
- azure:code-optimization
699
- azure:cognitive-search
700
- azure:cognitive-services
701
- azure:cognitive-services-decisions
702
- azure:collaborative-service
703
- azure:commit
704
- azure:community-images
705
- azure:compliance
706
- azure:compliance-center
707
- azure:compute-fleet
708
- azure:computer-vision
709
- azure:conditional-access
710
- azure:confidential-ledgers
711
- azure:connected-cache
712
- azure:connected-vehicle-platform
713
- azure:connections
714
- azure:consortium
715
- azure:container-apps-environments
716
- azure:container-instances
717
- azure:container-registries
718
- azure:container-services-deprecated
719
- azure:content-moderators
720
- azure:content-safety
721
- azure:controls
722
- azure:controls-horizontal
723
- azure:cost-alerts
724
- azure:cost-analysis
725
- azure:cost-budgets
726
- azure:cost-export
727
- azure:cost-management
728
- azure:cost-management-and-billing
729
- azure:counter
730
- azure:cubes
731
- azure:custom-ip-prefix
732
- azure:custom-vision
733
- azure:customer-lockbox-for-microsoft-azure
734
- azure:dashboard
735
- azure:dashboard-hub
736
- azure:data-box
737
- azure:data-collection-rules
738
- azure:data-factories
739
- azure:data-lake-analytics
740
- azure:data-lake-storage-gen1
741
- azure:data-lake-store-gen1
742
- azure:data-share-invitations
743
- azure:data-shares
744
- azure:database-instance-for-sap
745
- azure:ddo-s-protection-plans
746
- azure:dedicated-hsm
747
- azure:defender-cm-local-manager
748
- azure:defender-dcs-controller
749
- azure:defender-distributer-control-system
750
- azure:defender-engineering-station
751
- azure:defender-external-management
752
- azure:defender-freezer-monitor
753
- azure:defender-historian
754
- azure:defender-hmi
755
- azure:defender-industrial-packaging-system
756
- azure:defender-industrial-printer
757
- azure:defender-industrial-robot
758
- azure:defender-industrial-scale-system
759
- azure:defender-marquee
760
- azure:defender-meter
761
- azure:defender-plc
762
- azure:defender-pneumatic-device
763
- azure:defender-programable-board
764
- azure:defender-relay
765
- azure:defender-robot-controller
766
- azure:defender-rtu
767
- azure:defender-sensor
768
- azure:defender-slot
769
- azure:defender-web-guiding-system
770
- azure:detonation
771
- azure:dev-console
772
- azure:dev-ops-starter
773
- azure:dev-test-labs
774
- azure:device-compliance
775
- azure:device-configuration
776
- azure:device-enrollment
777
- azure:device-provisioning-services
778
- azure:device-security-apple
779
- azure:device-security-google
780
- azure:device-security-windows
781
- azure:device-update-io-t-hub
782
- azure:devices
783
- azure:diagnostics-settings
784
- azure:digital-twins
785
- azure:disk-encryption-sets
786
- azure:disk-pool
787
- azure:disks
788
- azure:disks-classic
789
- azure:disks-snapshots
790
- azure:dns-multistack
791
- azure:dns-private-resolver
792
- azure:dns-security-policy
793
- azure:dns-zones
794
- azure:download
795
- azure:e-books
796
- azure:edge-management
797
- azure:education
798
- azure:elastic-job-agents
799
- azure:elastic-san
800
- azure:endpoint-analytics
801
- azure:enterprise-applications
802
- azure:entra-connect
803
- azure:entra-connect-health
804
- azure:entra-connect-sync
805
- azure:entra-domain-services
806
- azure:entra-global-secure-access
807
- azure:entra-id-protection
808
- azure:entra-identity-custom-roles
809
- azure:entra-identity-licenses
810
- azure:entra-identity-risky-signins
811
- azure:entra-identity-risky-users
812
- azure:entra-identity-roles-and-administrators
813
- azure:entra-internet-access
814
- azure:entra-managed-identities
815
- azure:entra-private-access
816
- azure:entra-privleged-identity-management
817
- azure:entra-verified-id
818
- azure:error
819
- azure:event-grid-domains
820
- azure:event-grid-subscriptions
821
- azure:event-grid-topics
822
- azure:event-hub-clusters
823
- azure:event-hubs
824
- azure:exchange-access
825
- azure:exchange-on-premises-access
826
- azure:express-route-circuits
827
- azure:express-route-direct
828
- azure:express-route-traffic-collector
829
- azure:extended-security-updates
830
- azure:extensions
831
- azure:external-identities
832
- azure:face-apis
833
- azure:feature-previews
834
- azure:fhir-service
835
- azure:fiji
836
- azure:file
837
- azure:files
838
- azure:firewalls
839
- azure:folder-blank
840
- azure:folder-website
841
- azure:form-recognizers
842
- azure:free-services
843
- azure:front-door-and-cdn-profiles
844
- azure:ftp
845
- azure:function-apps
846
- azure:gear
847
- azure:genomics
848
- azure:genomics-accounts
849
- azure:globe-error
850
- azure:globe-success
851
- azure:globe-warning
852
- azure:groups
853
- azure:guide
854
- azure:hd-insight-clusters
855
- azure:hdi-aks-cluster
856
- azure:heart
857
- azure:help-and-support
858
- azure:host-groups
859
- azure:host-pools
860
- azure:hosts
861
- azure:ic-m-troubleshooting
862
- azure:identity-governance
863
- azure:identity-multi-factor-authentication
864
- azure:identity-secure-score
865
- azure:image
866
- azure:image-definitions
867
- azure:image-templates
868
- azure:image-versions
869
- azure:images
870
- azure:immersive-readers
871
- azure:import-export-jobs
872
- azure:industrial-io-t
873
- azure:information
874
- azure:infrastructure-backup
875
- azure:input-output
876
- azure:instance-pools
877
- azure:integration-accounts
878
- azure:integration-environments
879
- azure:integration-service-environments
880
- azure:internet-analyzer-profiles
881
- azure:intune
882
- azure:intune-app-protection
883
- azure:intune-for-education
884
- azure:intune-trends
885
- azure:io-t-central-applications
886
- azure:io-t-edge
887
- azure:io-t-hub
888
- azure:ip-address-manager
889
- azure:ip-groups
890
- azure:journey-hub
891
- azure:key-vaults
892
- azure:keys
893
- azure:kubernetes-fleet-manager
894
- azure:kubernetes-services
895
- azure:lab-accounts
896
- azure:lab-services
897
- azure:language
898
- azure:language-understanding
899
- azure:launch-portal
900
- azure:learn
901
- azure:load-balancer-hub
902
- azure:load-balancers
903
- azure:load-test
904
- azure:load-testing
905
- azure:local-network-gateways
906
- azure:location
907
- azure:log-analytics-query-pack
908
- azure:log-analytics-workspaces
909
- azure:log-streaming
910
- azure:logic-apps
911
- azure:logic-apps-custom-connector
912
- azure:machine-learning
913
- azure:machine-learning-studio-classic-web-services
914
- azure:machine-learning-studio-web-service-plans
915
- azure:machine-learning-studio-workspaces
916
- azure:machines-azure-arc
917
- azure:maintenance-configuration
918
- azure:managed-applications-center
919
- azure:managed-database
920
- azure:managed-desktop
921
- azure:managed-dev-ops-pools
922
- azure:managed-file-shares
923
- azure:managed-identities
924
- azure:managed-instance-apache-cassandra
925
- azure:managed-service-fabric
926
- azure:management-groups
927
- azure:management-portal
928
- azure:marketplace
929
- azure:marketplace-management
930
- azure:med-tech-service
931
- azure:media
932
- azure:media-file
933
- azure:mesh-applications
934
- azure:metrics
935
- azure:metrics-advisor
936
- azure:microsoft-defender-easm
937
- azure:microsoft-defender-for-cloud
938
- azure:microsoft-defender-for-io-t
939
- azure:microsoft-dev-box
940
- azure:mindaro
941
- azure:mission-landing-zone
942
- azure:mobile
943
- azure:mobile-engagement
944
- azure:mobile-networks
945
- azure:modular-data-center
946
- azure:module
947
- azure:monitor
948
- azure:monitor-health-models
949
- azure:multi-tenancy
950
- azure:multifactor-authentication
951
- azure:my-customers
952
- azure:nat
953
- azure:network-interfaces
954
- azure:network-managers
955
- azure:network-security-groups
956
- azure:network-security-perimeters
957
- azure:network-watcher
958
- azure:notification-hub-namespaces
959
- azure:notification-hubs
960
- azure:offers
961
- azure:on-premises-data-gateways
962
- azure:open-supply-chain-platform
963
- azure:operation-log-classic
964
- azure:oracle-database
965
- azure:os-images-classic
966
- azure:osconfig
967
- azure:outbound-connection
968
- azure:partner-namespace
969
- azure:partner-registration
970
- azure:partner-topic
971
- azure:peering-service
972
- azure:peerings
973
- azure:personalizers
974
- azure:plans
975
- azure:policy
976
- azure:power
977
- azure:power-bi-embedded
978
- azure:power-platform
979
- azure:power-up
980
- azure:powershell
981
- azure:preview-features
982
- azure:private-endpoints
983
- azure:private-link
984
- azure:private-link-service
985
- azure:private-link-services
986
- azure:process-explorer
987
- azure:production-ready-database
988
- azure:proximity-placement-groups
989
- azure:public-ip-addresses
990
- azure:public-ip-addresses-classic
991
- azure:public-ip-prefixes
992
- azure:qn-a-makers
993
- azure:quickstart-center
994
- azure:recent
995
- azure:recovery-services-vaults
996
- azure:region-management
997
- azure:relays
998
- azure:remote-rendering
999
- azure:reservations
1000
- azure:reserved-capacity
1001
- azure:reserved-ip-addresses-classic
1002
- azure:resource-explorer
1003
- azure:resource-graph-explorer
1004
- azure:resource-group-list
1005
- azure:resource-groups
1006
- azure:resource-guard
1007
- azure:resource-linked
1008
- azure:resource-management-private-link
1009
- azure:resource-mover
1010
- azure:resources-provider
1011
- azure:restore-points
1012
- azure:restore-points-collections
1013
- azure:route-filters
1014
- azure:route-tables
1015
- azure:rtos
1016
- azure:savings-plans
1017
- azure:scheduler
1018
- azure:scheduler-job-collections
1019
- azure:scvmm-management-servers
1020
- azure:search
1021
- azure:search-grid
1022
- azure:security
1023
- azure:security-baselines
1024
- azure:send-grid-accounts
1025
- azure:server-farm
1026
- azure:serverless-search
1027
- azure:service-catalog-mad
1028
- azure:service-endpoint-policies
1029
- azure:service-fabric-clusters
1030
- azure:service-health
1031
- azure:service-providers
1032
- azure:shared-image-galleries
1033
- azure:signal-r
1034
- azure:software-as-a-service
1035
- azure:software-updates
1036
- azure:solutions
1037
- azure:sonic-dash
1038
- azure:spatial-anchor-accounts
1039
- azure:speech-services
1040
- azure:spot-vm
1041
- azure:spot-vmss
1042
- azure:sql-data-warehouses
1043
- azure:sql-database
1044
- azure:sql-elastic-pools
1045
- azure:sql-managed-instance
1046
- azure:sql-server
1047
- azure:sql-server-registries
1048
- azure:ssd
1049
- azure:ssh-keys
1050
- azure:ssis-lift-and-shift-ir
1051
- azure:stack-hci-premium
1052
- azure:static-apps
1053
- azure:stor-simple-data-managers
1054
- azure:stor-simple-device-managers
1055
- azure:storage-accounts
1056
- azure:storage-accounts-classic
1057
- azure:storage-actions
1058
- azure:storage-azure-files
1059
- azure:storage-container
1060
- azure:storage-explorer
1061
- azure:storage-functions
1062
- azure:storage-queue
1063
- azure:storage-sync-services
1064
- azure:stream-analytics-jobs
1065
- azure:subnet
1066
- azure:subscriptions
1067
- azure:system-topic
1068
- azure:table
1069
- azure:tag
1070
- azure:tags
1071
- azure:targets-management
1072
- azure:template-specs
1073
- azure:templates
1074
- azure:tenant-properties
1075
- azure:tenant-status
1076
- azure:test-base
1077
- azure:tfs-vc-repository
1078
- azure:time-series-data-sets
1079
- azure:time-series-insights-access-policies
1080
- azure:time-series-insights-environments
1081
- azure:time-series-insights-event-sources
1082
- azure:toolbox
1083
- azure:traffic-manager-profiles
1084
- azure:translator-text
1085
- azure:troubleshoot
1086
- azure:universal-print
1087
- azure:update-management-center
1088
- azure:updates
1089
- azure:user-privacy
1090
- azure:user-settings
1091
- azure:user-subscriptions
1092
- azure:users
1093
- azure:verifiable-credentials
1094
- azure:verification-as-a-service
1095
- azure:versions
1096
- azure:video-analyzers
1097
- azure:virtual-clusters
1098
- azure:virtual-enclaves
1099
- azure:virtual-instance-for-sap
1100
- azure:virtual-machine
1101
- azure:virtual-machines-classic
1102
- azure:virtual-network-gateways
1103
- azure:virtual-networks
1104
- azure:virtual-networks-classic
1105
- azure:virtual-router
1106
- azure:virtual-visits-builder
1107
- azure:virtual-wan-hub
1108
- azure:virtual-wans
1109
- azure:vm-app-definitions
1110
- azure:vm-app-versions
1111
- azure:vm-image-version
1112
- azure:vm-images-classic
1113
- azure:vm-scale-sets
1114
- azure:wac
1115
- azure:wac-installer
1116
- azure:web-app-database
1117
- azure:web-application-firewall-policies-waf
1118
- azure:web-jobs
1119
- azure:web-slots
1120
- azure:web-test
1121
- azure:website-power
1122
- azure:website-staging
1123
- azure:windows-notification-services
1124
- azure:windows10-core-services
1125
- azure:workbooks
1126
- azure:worker-container-app
1127
- azure:workflow
1128
- azure:workspace-gateway
1129
- azure:workspaces
1130
- gcp:access-context-manager
1131
- gcp:administration
1132
- gcp:advanced-agent-modeling
1133
- gcp:advanced-solutions-lab
1134
- gcp:agent-assist
1135
- gcp:ai-hub
1136
- gcp:ai-platform
1137
- gcp:ai-platform-unified
1138
- gcp:analytics-hub
1139
- gcp:anthos
1140
- gcp:anthos-config-management
1141
- gcp:anthos-service-mesh
1142
- gcp:api
1143
- gcp:api-analytics
1144
- gcp:api-monetization
1145
- gcp:apigee-api-platform
1146
- gcp:apigee-sense
1147
- gcp:app-engine
1148
- gcp:artifact-registry
1149
- gcp:asset-inventory
1150
- gcp:assured-workloads
1151
- gcp:auto-ml
1152
- gcp:auto-ml-natural-language
1153
- gcp:auto-ml-tables
1154
- gcp:auto-ml-translation
1155
- gcp:auto-ml-video-intelligence
1156
- gcp:auto-ml-vision
1157
- gcp:bare-metal-solutions
1158
- gcp:batch
1159
- gcp:beyondcorp
1160
- gcp:big-query
1161
- gcp:bigtable
1162
- gcp:billing
1163
- gcp:binary-authorization
1164
- gcp:catalog
1165
- gcp:certificate-authority-service
1166
- gcp:certificate-manager
1167
- gcp:cloud-api-gateway
1168
- gcp:cloud-apis
1169
- gcp:cloud-armor
1170
- gcp:cloud-asset-inventory
1171
- gcp:cloud-audit-logs
1172
- gcp:cloud-build
1173
- gcp:cloud-cdn
1174
- gcp:cloud-code
1175
- gcp:cloud-composer
1176
- gcp:cloud-data-fusion
1177
- gcp:cloud-deploy
1178
- gcp:cloud-deployment-manager
1179
- gcp:cloud-dns
1180
- gcp:cloud-domains
1181
- gcp:cloud-ekm
1182
- gcp:cloud-endpoints
1183
- gcp:cloud-external-ip-addresses
1184
- gcp:cloud-firewall-rules
1185
- gcp:cloud-for-marketing
1186
- gcp:cloud-functions
1187
- gcp:cloud-generic
1188
- gcp:cloud-gpu
1189
- gcp:cloud-healthcare-api
1190
- gcp:cloud-healthcare-marketplace
1191
- gcp:cloud-hsm
1192
- gcp:cloud-ids
1193
- gcp:cloud-inference-api
1194
- gcp:cloud-interconnect
1195
- gcp:cloud-jobs-api
1196
- gcp:cloud-load-balancing
1197
- gcp:cloud-logging
1198
- gcp:cloud-media-edge
1199
- gcp:cloud-monitoring
1200
- gcp:cloud-nat
1201
- gcp:cloud-natural-language-api
1202
- gcp:cloud-network
1203
- gcp:cloud-ops
1204
- gcp:cloud-optimization-ai
1205
- gcp:cloud-optimization-ai-fleet-routing-api
1206
- gcp:cloud-router
1207
- gcp:cloud-routes
1208
- gcp:cloud-run
1209
- gcp:cloud-run-for-anthos
1210
- gcp:cloud-scheduler
1211
- gcp:cloud-security-scanner
1212
- gcp:cloud-shell
1213
- gcp:cloud-spanner
1214
- gcp:cloud-sql
1215
- gcp:cloud-storage
1216
- gcp:cloud-tasks
1217
- gcp:cloud-test-lab
1218
- gcp:cloud-tpu
1219
- gcp:cloud-translation-api
1220
- gcp:cloud-vision-api
1221
- gcp:cloud-vpn
1222
- gcp:compute-engine
1223
- gcp:configuration-management
1224
- gcp:connectivity-test
1225
- gcp:connectors
1226
- gcp:contact-center-ai
1227
- gcp:container-optimized-os
1228
- gcp:container-registry
1229
- gcp:data-catalog
1230
- gcp:data-labeling
1231
- gcp:data-layers
1232
- gcp:data-loss-prevention-api
1233
- gcp:data-qn-a
1234
- gcp:data-studio
1235
- gcp:data-transfer
1236
- gcp:database-migration-service
1237
- gcp:dataflow
1238
- gcp:datalab
1239
- gcp:dataplex
1240
- gcp:datapol
1241
- gcp:dataprep
1242
- gcp:dataproc
1243
- gcp:dataproc-metastore
1244
- gcp:datashare
1245
- gcp:datastore
1246
- gcp:datastream
1247
- gcp:debugger
1248
- gcp:developer-portal
1249
- gcp:dialogflow
1250
- gcp:dialogflow-cx
1251
- gcp:dialogflow-insights
1252
- gcp:document-ai
1253
- gcp:early-access-center
1254
- gcp:error-reporting
1255
- gcp:eventarc
1256
- gcp:filestore
1257
- gcp:financial-services-marketplace
1258
- gcp:firestore
1259
- gcp:fleet-engine
1260
- gcp:free-trial
1261
- gcp:game-servers
1262
- gcp:gce-systems-management
1263
- gcp:genomics
1264
- gcp:gke-on-prem
1265
- gcp:google-cloud-marketplace
1266
- gcp:google-kubernetes-engine
1267
- gcp:google-maps-platform
1268
- gcp:healthcare-nlp-api
1269
- gcp:home
1270
- gcp:identity-and-access-management
1271
- gcp:identity-aware-proxy
1272
- gcp:identity-platform
1273
- gcp:iot-core
1274
- gcp:iot-edge
1275
- gcp:key-access-justifications
1276
- gcp:key-management-service
1277
- gcp:kuberun
1278
- gcp:launcher
1279
- gcp:local-ssd
1280
- gcp:looker
1281
- gcp:managed-service-for-microsoft-active-directory
1282
- gcp:media-translation-api
1283
- gcp:memorystore
1284
- gcp:migrate-for-anthos
1285
- gcp:migrate-for-compute-engine
1286
- gcp:my-cloud
1287
- gcp:network-connectivity-center
1288
- gcp:network-intelligence-center
1289
- gcp:network-security
1290
- gcp:network-tiers
1291
- gcp:network-topology
1292
- gcp:onboarding
1293
- gcp:os-configuration-management
1294
- gcp:os-inventory-management
1295
- gcp:os-patch-management
1296
- gcp:partner-interconnect
1297
- gcp:partner-portal
1298
- gcp:performance-dashboard
1299
- gcp:permissions
1300
- gcp:persistent-disk
1301
- gcp:phishing-protection
1302
- gcp:policy-analyzer
1303
- gcp:premium-network-tier
1304
- gcp:private-connectivity
1305
- gcp:private-service-connect
1306
- gcp:producer-portal
1307
- gcp:profiler
1308
- gcp:project
1309
- gcp:pub-sub
1310
- gcp:quantum-engine
1311
- gcp:quotas
1312
- gcp:real-world-insights
1313
- gcp:recommendations-ai
1314
- gcp:release-notes
1315
- gcp:retail-api
1316
- gcp:risk-manager
1317
- gcp:runtime-config
1318
- gcp:secret-manager
1319
- gcp:security
1320
- gcp:security-command-center
1321
- gcp:security-health-advisor
1322
- gcp:security-key-enforcement
1323
- gcp:service-discovery
1324
- gcp:speech-to-text
1325
- gcp:stackdriver
1326
- gcp:standard-network-tier
1327
- gcp:stream-suite
1328
- gcp:support
1329
- gcp:tensorflow-enterprise
1330
- gcp:text-to-speech
1331
- gcp:tools-for-powershell
1332
- gcp:trace
1333
- gcp:traffic-director
1334
- gcp:transfer
1335
- gcp:transfer-appliance
1336
- gcp:user-preferences
1337
- gcp:vertex-ai
1338
- gcp:video-intelligence-api
1339
- gcp:virtual-private-cloud
1340
- gcp:visual-inspection
1341
- gcp:vmware-engine
1342
- gcp:web-risk
1343
- gcp:web-security-scanner
1344
- gcp:workflows
1345
- gcp:workload-identity-pool
1346
- tech:aarch64
1347
- tech:adobe-illustrator
1348
- tech:adobe-photoshop
1349
- tech:adobe-premiere-pro
1350
- tech:adobe-xd
1351
- tech:adonis-js
1352
- tech:after-effects
1353
- tech:airflow
1354
- tech:akka
1355
- tech:algolia
1356
- tech:alpine-js
1357
- tech:amazon-web-services
1358
- tech:anaconda
1359
- tech:android
1360
- tech:android-studio
1361
- tech:angular
1362
- tech:angular-js
1363
- tech:ansible
1364
- tech:ant-design
1365
- tech:apache
1366
- tech:apl
1367
- tech:appcelerator
1368
- tech:apple
1369
- tech:apple-safari
1370
- tech:appwrite
1371
- tech:arch-linux
1372
- tech:arduino
1373
- tech:argo-cd
1374
- tech:astro
1375
- tech:atom
1376
- tech:autodesk-maya
1377
- tech:autodesk-shot-grid
1378
- tech:awk
1379
- tech:azios
1380
- tech:azure
1381
- tech:azure-devops
1382
- tech:azure-sql-database
1383
- tech:babel
1384
- tech:backbone-js
1385
- tech:ballerina
1386
- tech:bamboo
1387
- tech:bash
1388
- tech:behance
1389
- tech:bitbucket
1390
- tech:blender
1391
- tech:bootstrap
1392
- tech:bower
1393
- tech:browserstack
1394
- tech:bulma
1395
- tech:bun
1396
- tech:c
1397
- tech:cairo-graphics
1398
- tech:cake-php
1399
- tech:canva
1400
- tech:capacitor
1401
- tech:cassandra
1402
- tech:cent-os
1403
- tech:chrome
1404
- tech:circle-ci
1405
- tech:clarity
1406
- tech:clion
1407
- tech:clojure
1408
- tech:clojure-script
1409
- tech:cloudflare
1410
- tech:cloudflare-workers
1411
- tech:cmake
1412
- tech:code-igniter
1413
- tech:code-pen
1414
- tech:codeac
1415
- tech:codecov
1416
- tech:coffee-script
1417
- tech:composer
1418
- tech:confluence
1419
- tech:consul
1420
- tech:contao
1421
- tech:corejs
1422
- tech:cosmosdb
1423
- tech:couchdb
1424
- tech:cplusplus
1425
- tech:crystal
1426
- tech:csharp
1427
- tech:css3
1428
- tech:cucumber
1429
- tech:cypress
1430
- tech:d3js
1431
- tech:dart
1432
- tech:data-grip
1433
- tech:data-spell
1434
- tech:dbeaver
1435
- tech:debian
1436
- tech:deno
1437
- tech:devicon
1438
- tech:digital-ocean
1439
- tech:discord-js
1440
- tech:django
1441
- tech:django-rest
1442
- tech:docker
1443
- tech:doctrine
1444
- tech:dropwizard
1445
- tech:drupal
1446
- tech:eclipse-ceylon
1447
- tech:eclipse-ide
1448
- tech:eclipse-vert-x
1449
- tech:elasticbeats
1450
- tech:elasticsearch
1451
- tech:electron
1452
- tech:eleventy-11ty
1453
- tech:elixir
1454
- tech:elm
1455
- tech:embedded-c
1456
- tech:ember-js
1457
- tech:envoy
1458
- tech:erlang
1459
- tech:eslint
1460
- tech:express
1461
- tech:facebook
1462
- tech:fast-api
1463
- tech:fastify
1464
- tech:fauna
1465
- tech:feathers
1466
- tech:fedora
1467
- tech:figma
1468
- tech:file-zilla
1469
- tech:firebase
1470
- tech:firefox
1471
- tech:flask
1472
- tech:flutter
1473
- tech:fortran
1474
- tech:foundation
1475
- tech:fsharp
1476
- tech:gatling
1477
- tech:gatsby
1478
- tech:gazebo
1479
- tech:gcc
1480
- tech:gentoo
1481
- tech:ghost
1482
- tech:gimp
1483
- tech:git
1484
- tech:gitbook
1485
- tech:github
1486
- tech:github-actions
1487
- tech:github-codespaces
1488
- tech:gitlab
1489
- tech:gitpod
1490
- tech:gitter
1491
- tech:gnu-emacs
1492
- tech:go
1493
- tech:go-land
1494
- tech:godot-engine
1495
- tech:google
1496
- tech:google-cloud
1497
- tech:gradle
1498
- tech:grafana
1499
- tech:grails
1500
- tech:graphql
1501
- tech:groovy
1502
- tech:grunt-js
1503
- tech:gulp-js
1504
- tech:hadoop
1505
- tech:handlebars
1506
- tech:hardhat
1507
- tech:harvester
1508
- tech:hashicorp-vault
1509
- tech:haskell
1510
- tech:haxe
1511
- tech:helm
1512
- tech:heroku
1513
- tech:hibernate
1514
- tech:homebrew
1515
- tech:html5
1516
- tech:hugo
1517
- tech:ibm-spss-statistics
1518
- tech:ie10
1519
- tech:ifttt
1520
- tech:influxdb
1521
- tech:inkscape
1522
- tech:insomnia
1523
- tech:intellij-idea
1524
- tech:ionic
1525
- tech:jaeger
1526
- tech:jamstack
1527
- tech:jasmine
1528
- tech:java
1529
- tech:javascript
1530
- tech:jeet
1531
- tech:jekyll
1532
- tech:jenkins
1533
- tech:jest
1534
- tech:jetbrains
1535
- tech:jira
1536
- tech:jira-align
1537
- tech:jquery
1538
- tech:json
1539
- tech:jule
1540
- tech:julia
1541
- tech:junit
1542
- tech:jupyter
1543
- tech:k3os
1544
- tech:k3s
1545
- tech:kafka
1546
- tech:kaggle
1547
- tech:karate
1548
- tech:karma
1549
- tech:keras
1550
- tech:kibana
1551
- tech:knex-js
1552
- tech:knockout
1553
- tech:kotlin
1554
- tech:krakenjs
1555
- tech:ktor
1556
- tech:kubernetes
1557
- tech:labview
1558
- tech:laravel
1559
- tech:latex
1560
- tech:less-js
1561
- tech:linkedin
1562
- tech:linux
1563
- tech:liquibase
1564
- tech:livewire
1565
- tech:llvm
1566
- tech:logstash
1567
- tech:lua
1568
- tech:lumen
1569
- tech:magento
1570
- tech:markdown
1571
- tech:material-ui
1572
- tech:materialize
1573
- tech:matlab
1574
- tech:matplotlib
1575
- tech:maven
1576
- tech:meteor-js
1577
- tech:microsoft-sql-server
1578
- tech:minitab
1579
- tech:mob-x
1580
- tech:mocha
1581
- tech:modx
1582
- tech:moleculer
1583
- tech:mongodb
1584
- tech:mongoose-js
1585
- tech:moodle
1586
- tech:ms-dos
1587
- tech:mysql
1588
- tech:nano
1589
- tech:nerog
1590
- tech:nestjs
1591
- tech:net
1592
- tech:net-core
1593
- tech:network-x
1594
- tech:new4j
1595
- tech:nextjs
1596
- tech:nginx
1597
- tech:nhibernate
1598
- tech:nim
1599
- tech:nimble
1600
- tech:nix
1601
- tech:nodejs
1602
- tech:nodemon
1603
- tech:nodewebkit
1604
- tech:npm
1605
- tech:nuget
1606
- tech:num-py
1607
- tech:nuxt-js
1608
- tech:objective-c
1609
- tech:ocaml
1610
- tech:oh-my-zsh
1611
- tech:okta
1612
- tech:open-al
1613
- tech:open-api
1614
- tech:open-cl
1615
- tech:open-cv
1616
- tech:open-gl
1617
- tech:open-stack
1618
- tech:open-suse
1619
- tech:open-telemetry
1620
- tech:opera
1621
- tech:oracle
1622
- tech:p5js
1623
- tech:packer
1624
- tech:pandas
1625
- tech:perl
1626
- tech:pf-sense
1627
- tech:phalcon
1628
- tech:phoenix-framework
1629
- tech:photon-engine
1630
- tech:php
1631
- tech:php-storm
1632
- tech:playwrite
1633
- tech:ploty
1634
- tech:podman
1635
- tech:polygon
1636
- tech:portainer
1637
- tech:postcss
1638
- tech:postgresql
1639
- tech:postman
1640
- tech:powershell
1641
- tech:processing
1642
- tech:prometheus
1643
- tech:protractor
1644
- tech:purescript
1645
- tech:putty
1646
- tech:pycharm
1647
- tech:pyscript
1648
- tech:pytest
1649
- tech:python
1650
- tech:python-poetry
1651
- tech:pytorch
1652
- tech:qodana
1653
- tech:qt
1654
- tech:quarkus
1655
- tech:quasar
1656
- tech:qwik
1657
- tech:r
1658
- tech:rabbitmq
1659
- tech:rancher
1660
- tech:raspberrypi
1661
- tech:reach
1662
- tech:react
1663
- tech:react-bootstrap
1664
- tech:realm
1665
- tech:red-cube-s-epic-compiler-thingy-programming-re-ct
1666
- tech:redhat
1667
- tech:redis
1668
- tech:redux
1669
- tech:ren-py
1670
- tech:rider
1671
- tech:robot-operating-system-ros
1672
- tech:rocksdb
1673
- tech:rollup-js
1674
- tech:rspec
1675
- tech:rstudio
1676
- tech:ruby
1677
- tech:ruby-mine
1678
- tech:ruby-on-rails
1679
- tech:rust
1680
- tech:salesforce
1681
- tech:sanity
1682
- tech:sass
1683
- tech:scala
1684
- tech:scalingo
1685
- tech:sdl
1686
- tech:selenium
1687
- tech:sema-software
1688
- tech:sequelize
1689
- tech:shopware
1690
- tech:sketch
1691
- tech:slack
1692
- tech:socket-io
1693
- tech:solid-js
1694
- tech:solidity
1695
- tech:sonarqube
1696
- tech:sourcetree
1697
- tech:spark
1698
- tech:splunk
1699
- tech:spring
1700
- tech:sql-developer
1701
- tech:sqlalchemy
1702
- tech:sqlite
1703
- tech:ssh
1704
- tech:stackoverflow
1705
- tech:stata
1706
- tech:storybook
1707
- tech:streamlit
1708
- tech:stylus
1709
- tech:subversion
1710
- tech:svelte
1711
- tech:swagger
1712
- tech:swift
1713
- tech:symfony
1714
- tech:tailwind-css
1715
- tech:tauri
1716
- tech:tensorflow
1717
- tech:terraform
1718
- tech:tex
1719
- tech:the-algorithms
1720
- tech:three-js
1721
- tech:titanium-sdk
1722
- tech:tomcat
1723
- tech:tortoise-git
1724
- tech:tower
1725
- tech:traefik-mesh
1726
- tech:traefik-proxy
1727
- tech:travis-ci
1728
- tech:trello
1729
- tech:twitter
1730
- tech:typescript
1731
- tech:typo3
1732
- tech:ubuntu
1733
- tech:uml
1734
- tech:unity
1735
- tech:unix
1736
- tech:unreal-engine
1737
- tech:uwsgi
1738
- tech:v8
1739
- tech:vagrant
1740
- tech:vala
1741
- tech:vercel
1742
- tech:veutify
1743
- tech:vim
1744
- tech:visualstudio
1745
- tech:vite
1746
- tech:vitejs
1747
- tech:vscode
1748
- tech:vsphere
1749
- tech:vue
1750
- tech:vue-storefront
1751
- tech:vyper
1752
- tech:webassembly
1753
- tech:webflow
1754
- tech:weblate
1755
- tech:webpack
1756
- tech:webstorm
1757
- tech:windows8
1758
- tech:windows11
1759
- tech:woo-commerce
1760
- tech:wordpress
1761
- tech:xamarin
1762
- tech:xcode
1763
- tech:xml
1764
- tech:yaml
1765
- tech:yarn
1766
- tech:yii-framework
1767
- tech:yuno-host
1768
- tech:zend-framework
1769
- tech:zig
1770
- }}`,RA="likec4builtin",y3=`${RA}:///likec4/lib/icons.c4`;var qi=ws();const v3=new qi.NotificationType("likec4/onDidChangeModel"),w3=new qi.RequestType0("likec4/fetchModel"),b3=new qi.RequestType("likec4/fetchComputedModel"),R3=new qi.RequestType("likec4/computeView"),$3=new qi.RequestType("likec4/layout-view"),k3=new qi.RequestType("likec4/build"),T3=new qi.RequestType("likec4/locate"),E3=new qi.RequestType("likec4/change-view");class S3 extends Bv{constructor(e){super(),this.services=e}init(){const e=this.services.likec4.ModelBuilder,n=this.services.likec4.ModelLocator,r=this.services.likec4.ModelChanges,i=this.services.likec4.Views,s=this.services.shared.lsp.Connection;if(!s){Ke.info("[ServerRpc] no connection, not initializing");return}Ke.info("[ServerRpc] init");const a=this.services.shared.workspace.LangiumDocuments,o=this.services.shared.workspace.DocumentBuilder,c=sj(()=>{s.sendNotification(v3,"").catch(l=>(Ke.warn(`[ServerRpc] error sending onDidChangeModel: ${l}`),Promise.resolve()))},{minQuietPeriodMs:250,maxBurstDurationMs:1e3,minGapMs:200});let u=!0;this.onDispose(e.onModelParsed(()=>c.call()),s.onRequest(b3,async({cleanCaches:l},d)=>(l&&(this.services.WorkspaceCache.clear(),this.services.DocumentCache.clear()),{model:await e.buildComputedModel(d)})),s.onRequest(w3,async l=>({model:await e.buildModel(l)})),s.onRequest(R3,async({viewId:l},d)=>({view:await e.computeView(l,d)})),s.onRequest($3,async({viewId:l},d)=>({result:await i.layoutView(l,d)})),s.onRequest(k3,async({docs:l},d)=>{const f=l.map(y=>Vt.parse(y)),h=y=>f.every(R=>!Tt.equals(R,y)),m=a.all.filter(y=>Jl(y)&&h(y.uri)&&y.uri.scheme!==RA).map(y=>y.uri).toArray();Ke.debug(`[ServerRpc] received request to build:
1771
- changed (total ${f.length}):${l.map(y=>`
1772
- - `+y).join("")}
1773
- deleted (total ${m.length}):${m.map(y=>`
1774
- - `+y.toString()).join(`
1775
- `)}`),!u&&f.length+m.length>0&&await Promise.allSettled([...f,...m].map(async y=>{const R=y.toString();Ke.debug(`clear diagnostics for ${R}`);try{await s.sendDiagnostics({uri:R,diagnostics:[]})}catch(w){Ke.warn(`error clearing diagnostics for ${R}: ${w}`)}})),u=!1,await Pt(d),await o.update(f,m,d)}),s.onRequest(T3,l=>{switch(!0){case"element"in l:return n.locateElement(l.element,l.property??"name");case"relation"in l:return n.locateRelation(l.relation);case"view"in l:return n.locateView(l.view);case"deployment"in l:return n.locateDeploymentElement(l.deployment,l.property??"name");default:Ne(l)}}),s.onRequest(E3,async(l,d)=>await r.applyChange(l)),hs.create(()=>{c.cancel()}))}}class _3{constructor(e){this.services=e}getSymbolKind(e){const n=Rt(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(n,s));switch(!0){case r(Vn,Ls,Ci,Ai):return ar.Constructor;case r(Da,Oa,Ia,xa,Ba):return ar.Namespace;case r(Ns):return ar.Class;case r(Ii,zs,Os,Ua):return ar.EnumMember;case r(Di,Ga):return ar.Event;case r(ai,Pi,Fa,Ma):return ar.TypeParameter}return ar.Field}getCompletionItemKind(e){const n=Rt(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(n,s));switch(!0){case r(Os):return Ct.Color;case r(Vn,Ci,Ai,Ls):return Ct.Constructor;case r(Da,Oa,Ia,xa,Ba):return Ct.Module;case r(Ns):return Ct.Class;case r(Ii,zs,Os,Ua):return Ct.EnumMember;case r(Di,Ga):return Ct.Event;case r(ai,Fa,Pi,Ma):return Ct.TypeParameter;default:return Ct.Reference}}}class A3 extends NT{documentFactory;constructor(e){super(e),this.documentFactory=e.workspace.LangiumDocumentFactory}async loadAdditionalDocuments(e,n){n(this.documentFactory.fromString(g3,Vt.parse(y3))),await super.loadAdditionalDocuments(e,n)}workspace(){return this.folders&&gC(this.folders,1)?this.folders[0]:null}get workspaceUri(){const e=this.workspace();return Ce(e,"Workspace not initialized"),Vt.parse(e.uri)}get workspaceURL(){const e=this.workspace();return Ce(e,"Workspace not initialized"),new URL(e.uri)}}class C3 extends zS{}class P3{constructor(e){this.services=e}cache=new WeakMap;viewsWithReportedErrors=new Set;get layouter(){return this.services.likec4.Layouter}async computedViews(e){const n=await this.services.likec4.ModelBuilder.buildComputedModel(e);return n?wc(n.views):[]}async layoutAllViews(e){const n=await this.computedViews(e);if(n.length===0)return[];const r=[],i=[];for(const s of n)this.viewsWithReportedErrors.delete(s.id),i.push(this.layouter.layout(s).then(a=>(this.cache.set(s,a),a)).catch(a=>(this.cache.delete(s),we(a),Promise.reject(a))));for(const s of await Promise.allSettled(i))s.status==="fulfilled"&&r.push(s.value);return r}async layoutView(e,n){const r=await this.services.likec4.ModelBuilder.buildComputedModel(n);if(!r)return null;const i=r.views[e];if(!i)return null;let s=this.cache.get(i);if(s)return s;try{const a=await this.layouter.layout(i);return this.viewsWithReportedErrors.delete(e),this.cache.set(i,a),a}catch(a){if(!this.viewsWithReportedErrors.has(e)){const o=a instanceof Error?a.message:""+a;this.services.shared.lsp.Connection?.window.showErrorMessage(`LikeC4: ${o}`),this.viewsWithReportedErrors.add(e)}return lv(a),Promise.reject(a)}}async diagrams(){return(await this.layoutAllViews()).map(e=>e.diagram)}async viewsAsGraphvizOut(){const e="All-LayoutedViews-DotWithSvg",n=this.services.WorkspaceCache;if(n.has(e))return await Promise.resolve(n.get(e));const r=(await this.computedViews()).map(async a=>{const{dot:o,svg:c}=await this.layouter.svg(a);return{id:a.id,dot:o,svg:c}}),i=[],s=await Promise.allSettled(r);for(const a of s)a.status==="fulfilled"?i.push(a.value):we(a.reason);return n.set(e,i),i}async overviewGraph(){const e="OverviewGraph",n=this.services.WorkspaceCache;if(n.has(e))return await Promise.resolve(n.get(e));const r=await this.computedViews(),i=await this.layouter.layoutOverviewGraph(r);return n.set(e,i),i}}const x3={lsp:{NodeKindProvider:t=>new _3(t),WorkspaceSymbolProvider:t=>new C3(t)},workspace:{WorkspaceManager:t=>new A3(t)}};function xt(t){return e=>new t(e)}const N3={documentation:{DocumentationProvider:xt(L4)},WorkspaceCache:t=>new CT(t.shared),DocumentCache:t=>new AT(t.shared),Rpc:xt(S3),likec4:{Layouter:t=>(Ke.debug("Creating GraphvizLayouter with GraphvizWasmAdapter"),new Q_(new Qa)),Views:xt(P3),DeploymentsIndex:xt(sK),ModelChanges:xt(l3),FqnIndex:xt(uK),ModelParser:xt(t3),ModelBuilder:xt(pK),ModelLocator:xt(yK)},lsp:{CompletionProvider:xt(G4),DocumentHighlightProvider:xt(j4),DocumentSymbolProvider:xt(Z4),SemanticTokenProvider:xt(iK),HoverProvider:xt(rK),CodeLensProvider:xt(q4),DocumentLinkProvider:xt(Q4),Formatter:xt(F4)},references:{NameProvider:xt(d3),ScopeComputation:xt(h3),ScopeProvider:xt(m3)}};function D3(t,e,n,r){const i=I3(t),s=[nB({shared:i}),kU,N3,e,n,r].reduce($A,{}),a=Gf(s);return i.ServiceRegistry.register(a),JK(a),t.connection?a.Rpc.init():i.workspace.ConfigurationProvider.initialized({}),{shared:i,likec4:a}}function I3(t={}){const e={...XT,...t};return Gf(iB(e),$U,x3)}function $A(t,e){if(e){for(const[n,r]of Object.entries(e))if(r!==void 0){const i=t[n];i!==null&&r!==null&&typeof i=="object"&&typeof r=="object"?t[n]=$A(i,r):t[n]=r}}return t}const O3=t=>({start:pi.hrtime.bigint(),command:t.map(e=>L3(JA(e))).join(" "),state:{stdout:"",stderr:"",output:""}}),L3=t=>/[^\w./-]/.test(t)?`'${t.replaceAll("'","'\\''")}'`:t,M3=({stdin:t,stdout:e,stderr:n,stdio:r=[t,e,n],env:i,preferLocal:s,cwd:a=".",...o})=>{const c=a instanceof URL?KA(a):fi.resolve(a),u=i?{...pi.env,...i}:void 0,l=r[0]?.string;return{...o,input:l,stdio:l===void 0?r:["pipe",...r.slice(1)],env:s?z3(u??pi.env,c):u,cwd:c}},z3=({Path:t="",PATH:e=t,...n},r)=>{const i=e.split(fi.delimiter),s=kA([],fi.resolve(r)).map(a=>fi.join(a,"node_modules/.bin")).filter(a=>!i.includes(a));return{...n,PATH:[...s,e].filter(Boolean).join(fi.delimiter)}},kA=(t,e)=>t.at(-1)===e?t:kA([...t,e],fi.resolve(e,"..")),F3=async(t,e,n)=>await q3(t,n)?[Yv(t),e.map(r=>U3(r)),{...n,shell:!0}]:[t,e,n],q3=async(t,{shell:e,cwd:n,env:r=pi.env})=>pi.platform==="win32"&&!e&&!await G3(t,n,r),G3=async(t,e,{Path:n="",PATH:r=n})=>TA.some(i=>t.toLowerCase().endsWith(i))||(j3[`${t}\0${e}\0${r}`]??=await B3(t,e,r)),j3={},B3=async(t,e,n)=>{const r=n.split(fi.delimiter).filter(Boolean).map(i=>i.replace(/^"(.*)"$/,"$1"));try{await Promise.all(TA.flatMap(i=>[e,...r].map(s=>`${fi.resolve(s,t)}${i}`)).map(async i=>{try{await EC(i)}catch{return}throw 0}))}catch{return!0}return!1},TA=[".exe",".com"],U3=t=>Yv(Yv(`"${t.replaceAll(/(\\*)"/g,'$1$1\\"').replace(/(\\*)$/,"$1$1")}"`)),Yv=t=>t.replaceAll(/([()\][%!^"`<>&|;, *?])/g,"^$1"),W3=async(t,{input:e},n)=>{const r=await t;e!==void 0&&r.stdin.end(e);const i=vw(r,"close");try{return await Promise.race([i,...r.stdio.filter(Boolean).map(s=>H3(s))]),K3(n,SA(r)),_A(n)}catch(s){throw await Promise.allSettled([i]),EA(s,r,n)}},H3=async t=>{for await(const[e]of TC(t,"error"))if(!["ERR_STREAM_PREMATURE_CLOSE","EPIPE"].includes(e?.code))throw e},K3=({command:t},{exitCode:e,signalName:n})=>{if(n!==void 0)throw new Ks(`Command was terminated with ${n}: ${t}`);if(e!==void 0)throw new Ks(`Command failed with exit code ${e}: ${t}`)},EA=(t,e,n)=>Object.assign(V3(t,n),SA(e),_A(n)),V3=(t,{command:e})=>t instanceof Ks?t:new Ks(`Command failed: ${e}`,{cause:t});class Ks extends Error{name="SubprocessError"}const SA=({exitCode:t,signalCode:e})=>({...t<1?{}:{exitCode:t},...e===null?{}:{signalName:e}}),_A=({state:{stdout:t,stderr:e,output:n},command:r,start:i})=>({stdout:Jv(t),stderr:Jv(e),output:Jv(n),command:r,durationMs:Number(pi.hrtime.bigint()-i)/1e6}),Jv=t=>t.at(-1)===`
1776
- `?t.slice(0,t.at(-2)==="\r"?-2:-1):t,X3=async(t,e,n,r)=>{try{[t,e]=["node","node.exe"].includes(t.toLowerCase())?[pi.execPath,[...pi.execArgv.filter(s=>!s.startsWith("--inspect")),...e]]:[t,e];const i=kC(...await F3(t,e,n));return AA(i.stdout,r,"stdout"),AA(i.stderr,r,"stderr"),i.once("error",()=>{}),await vw(i,"spawn"),i}catch(i){throw EA(i,{},r)}},AA=(t,{state:e},n)=>{t&&(t.setEncoding("utf8"),e.isIterating||(e.isIterating=!1,t.on("data",r=>{e[n]+=r,e.output+=r})))},Y3=async t=>{const[[e,n]]=await Promise.all([Promise.allSettled(t),J3(t)]);if(n.reason)throw n.reason.pipedFrom=e.reason??e.value,n.reason;if(e.reason)throw e.reason;return{...n.value,pipedFrom:e.value}},J3=async t=>{try{const[{stdout:e},{stdin:n}]=await Promise.all(t.map(({nodeChildProcess:r})=>r));if(n===null)throw new Error('The "stdin" option must be set on the first "spawn()" call in the pipeline.');if(e===null)throw new Error('The "stdout" option must be set on the last "spawn()" call in the pipeline.');SC(e,n).catch(()=>{})}catch(e){throw await Promise.allSettled(t.map(({nodeChildProcess:n})=>Q3(n))),e}},Q3=async t=>{const{stdin:e}=await t;e.end()},CA=async function*(t,{state:e},n){if(e.isIterating===!1)throw new Error(`The subprocess must be iterated right away, for example:
1777
- for await (const line of spawn(...)) { ... }`);e.isIterating=!0;try{const{[n]:r}=await t.nodeChildProcess;if(!r)return;let i="";for await(const s of r.iterator({destroyOnReturn:!1})){const a=`${i}${s}`.split(/\r?\n/);i=a.pop(),yield*a}i&&(yield i)}finally{await t}},Z3=async function*(...t){try{let e=[];for(;t.length>0;){e=t.map((a,o)=>e[o]??e6(a));const[{value:n,done:r},i]=await Promise.race(e.map((a,o)=>Promise.all([a,o]))),[s]=t.splice(i,1);e.splice(i,1),r||(t.push(s),yield n)}}finally{await Promise.all(t.map(e=>e.return()))}},e6=async t=>{try{return await t.next()}catch(e){await t.throw(e)}};function rd(t,e,n,r){const[i=[],s={}]=Array.isArray(e)?[e,n]:[[],e],a=O3([t,...i]),o=M3(s),c=X3(t,i,o,a);let u=W3(c,o,a);Object.assign(u,{nodeChildProcess:c}),u=r?Y3([r,u]):u;const l=CA(u,a,"stdout"),d=CA(u,a,"stderr");return Object.assign(u,{nodeChildProcess:c,stdout:l,stderr:d,[Symbol.asyncIterator]:()=>Z3(l,d),pipe:(f,h,m)=>rd(f,h,m,u)})}var hr={},Vs={},PA;function t6(){if(PA)return Vs;PA=1,Object.defineProperty(Vs,"__esModule",{value:!0}),Vs.sync=Vs.isexe=void 0;const t=Za,e=ww,n=async(a,o={})=>{const{ignoreErrors:c=!1}=o;try{return i(await(0,e.stat)(a),o)}catch(u){const l=u;if(c||l.code==="EACCES")return!1;throw l}};Vs.isexe=n;const r=(a,o={})=>{const{ignoreErrors:c=!1}=o;try{return i((0,t.statSync)(a),o)}catch(u){const l=u;if(c||l.code==="EACCES")return!1;throw l}};Vs.sync=r;const i=(a,o)=>a.isFile()&&s(a,o),s=(a,o)=>{const c=o.uid??process.getuid?.(),u=o.groups??process.getgroups?.()??[],l=o.gid??process.getgid?.()??u[0];if(c===void 0||l===void 0)throw new Error("cannot get uid or gid");const d=new Set([l,...u]),f=a.mode,h=a.uid,m=a.gid,y=parseInt("100",8),R=parseInt("010",8),w=parseInt("001",8),k=y|R;return!!(f&w||f&R&&d.has(m)||f&y&&h===c||f&k&&c===0)};return Vs}var Xs={},xA;function n6(){if(xA)return Xs;xA=1,Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.sync=Xs.isexe=void 0;const t=Za,e=ww,n=async(a,o={})=>{const{ignoreErrors:c=!1}=o;try{return s(await(0,e.stat)(a),a,o)}catch(u){const l=u;if(c||l.code==="EACCES")return!1;throw l}};Xs.isexe=n;const r=(a,o={})=>{const{ignoreErrors:c=!1}=o;try{return s((0,t.statSync)(a),a,o)}catch(u){const l=u;if(c||l.code==="EACCES")return!1;throw l}};Xs.sync=r;const i=(a,o)=>{const{pathExt:c=process.env.PATHEXT||""}=o,u=c.split(";");if(u.indexOf("")!==-1)return!0;for(let l=0;l<u.length;l++){const d=u[l].toLowerCase(),f=a.substring(a.length-d.length).toLowerCase();if(d&&f===d)return!0}return!1},s=(a,o,c)=>a.isFile()&&i(o,c);return Xs}var Qv={},NA;function r6(){return NA||(NA=1,Object.defineProperty(Qv,"__esModule",{value:!0})),Qv}var DA;function i6(){return DA||(DA=1,function(t){var e=hr&&hr.__createBinding||(Object.create?function(u,l,d,f){f===void 0&&(f=d);var h=Object.getOwnPropertyDescriptor(l,d);(!h||("get"in h?!l.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return l[d]}}),Object.defineProperty(u,f,h)}:function(u,l,d,f){f===void 0&&(f=d),u[f]=l[d]}),n=hr&&hr.__setModuleDefault||(Object.create?function(u,l){Object.defineProperty(u,"default",{enumerable:!0,value:l})}:function(u,l){u.default=l}),r=hr&&hr.__importStar||function(u){if(u&&u.__esModule)return u;var l={};if(u!=null)for(var d in u)d!=="default"&&Object.prototype.hasOwnProperty.call(u,d)&&e(l,u,d);return n(l,u),l},i=hr&&hr.__exportStar||function(u,l){for(var d in u)d!=="default"&&!Object.prototype.hasOwnProperty.call(l,d)&&e(l,u,d)};Object.defineProperty(t,"__esModule",{value:!0}),t.sync=t.isexe=t.posix=t.win32=void 0;const s=r(t6());t.posix=s;const a=r(n6());t.win32=a,i(r6(),t);const c=(process.env._ISEXE_TEST_PLATFORM_||process.platform)==="win32"?a:s;t.isexe=c.isexe,t.sync=c.sync}(hr)),hr}var Zv,IA;function s6(){if(IA)return Zv;IA=1;const{isexe:t,sync:e}=i6(),{join:n,delimiter:r,sep:i,posix:s}=hi,a=process.platform==="win32",o=new RegExp(`[${s.sep}${i===s.sep?"":i}]`.replace(/(\\)/g,"\\$1")),c=new RegExp(`^\\.${o.source}`),u=m=>Object.assign(new Error(`not found: ${m}`),{code:"ENOENT"}),l=(m,{path:y=process.env.PATH,pathExt:R=process.env.PATHEXT,delimiter:w=r})=>{const k=m.match(o)?[""]:[...a?[process.cwd()]:[],...(y||"").split(w)];if(a){const E=R||[".EXE",".CMD",".BAT",".COM"].join(w),_=E.split(w).flatMap(C=>[C,C.toLowerCase()]);return m.includes(".")&&_[0]!==""&&_.unshift(""),{pathEnv:k,pathExt:_,pathExtExe:E}}return{pathEnv:k,pathExt:[""]}},d=(m,y)=>{const R=/^".*"$/.test(m)?m.slice(1,-1):m;return(!R&&c.test(y)?y.slice(0,2):"")+n(R,y)},f=async(m,y={})=>{const{pathEnv:R,pathExt:w,pathExtExe:k}=l(m,y),E=[];for(const _ of R){const C=d(_,m);for(const I of w){const j=C+I;if(await t(j,{pathExt:k,ignoreErrors:!0})){if(!y.all)return j;E.push(j)}}}if(y.all&&E.length)return E;if(y.nothrow)return null;throw u(m)},h=(m,y={})=>{const{pathEnv:R,pathExt:w,pathExtExe:k}=l(m,y),E=[];for(const _ of R){const C=d(_,m);for(const I of w){const j=C+I;if(e(j,{pathExt:k,ignoreErrors:!0})){if(!y.all)return j;E.push(j)}}}if(y.all&&E.length)return E;if(y.nothrow)return null;throw u(m)};return Zv=f,f.sync=h,Zv}var a6=s6();const OA=Ir(a6),ew=Iv(Math.max(1,_C.cpus().length));class o6{dotpath;unflattenpath;constructor(e){this.dotpath=e||OA.sync("dot"),this.unflattenpath=OA.sync("unflatten")}async unflatten(e){return await ew(async()=>{const n=Qt.getChild("graphviz-binary");let r;try{const i=await rd(this.unflattenpath,["-l 1","-c 3"],{timeout:1e4,stdin:{string:e}});r=i.stdout,Lt(i.stderr)||n.warn`Command ${i.command} has stderr:\n${i.stderr}`}catch(i){n.error("FAILED GraphvizBinaryAdapter.unflatten",{error:i}),i instanceof Ks&&!Lt(i.stdout)&&(n.warn`Command: '${i.command}' returned result but also failed (exitcode ${i.exitCode}): "${i.stderr}"`,r=i.stdout)}return r&&(e=r.replaceAll(/\t\[/g," [").replaceAll(/\t/g," ")),e})}async layoutJson(e){return await ew(async()=>{const n=Qt.getChild("graphviz-binary");let r;try{const i=await rd(this.dotpath,["-Tjson","-y"],{timeout:1e4,stdin:{string:e}});r=i.stdout,Lt(i.stderr)||n.warn`Command ${i.command} has stderr:\n${i.stderr}`}catch(i){if(n.error("FAILED GraphvizBinaryAdapter.layoutJson",{error:i}),n.warn`FAILED DOT:\n${e}`,i instanceof Ks&&!Lt(i.stdout))n.warn(`Command: '${i.command}' returned result but also failed (exitcode ${i.exitCode}): "${i.stderr}"`),r=i.stdout;else throw i}return r})}async acyclic(e){return Promise.reject(new Error("Method not implemented."))}async svg(e){return await ew(async()=>{const n=Qt.getChild("graphviz-binary");let r;try{const i=await rd(this.dotpath,["-Tsvg","-y"],{timeout:1e4,stdin:{string:e}});r=i.stdout,Lt(i.stderr)||n.warn`Command ${i.command} has stderr:\n${i.stderr}`}catch(i){if(n.error("FAILED GraphvizBinaryAdapter.svg",{error:i}),n.warn`FAILED DOT:\n${e}`,i instanceof Ks&&!Lt(i.stdout))n.warn`Command: '${i.command}' returned result but also failed (exitcode ${i.exitCode}): "${i.stderr}"`,r=i.stdout;else throw i}return r})}}const c6="likec4",LA="1.22.0",MA=t=>Number.isFinite(t)?t:0;function u6(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(MA(t*1e3)%1e3),nanoseconds:Math.trunc(MA(t*1e6)%1e3)}}function l6(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function d6(t){switch(typeof t){case"number":{if(Number.isFinite(t))return u6(t);break}case"bigint":return l6(t)}throw new TypeError("Expected a finite number or bigint")}const f6=t=>t===0||t===0n,h6=(t,e)=>e===1||e===1n?t:`${t}s`,p6=1e-7,m6=24n*60n*60n*1000n;function g6(t,e){const n=typeof t=="bigint";if(!n&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};const r=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[];const s=(l,d)=>{const f=Math.floor(l*10**d+p6);return(Math.round(f)/10**d).toFixed(d)},a=(l,d,f,h)=>{if(!((i.length===0||!e.colonNotation)&&f6(l)&&!(e.colonNotation&&f==="m"))){if(h??=String(l),e.colonNotation){const m=h.includes(".")?h.split(".")[0].length:h.length,y=i.length>0?2:1;h="0".repeat(Math.max(0,y-m))+h}else h+=e.verbose?" "+h6(d,l):f;i.push(h)}},o=d6(t),c=BigInt(o.days);if(e.hideYearAndDays?a(BigInt(c)*24n+BigInt(o.hours),"hour","h"):(e.hideYear?a(c,"day","d"):(a(c/365n,"year","y"),a(c%365n,"day","d")),a(Number(o.hours),"hour","h")),a(Number(o.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3){const l=Number(o.seconds),d=Number(o.milliseconds),f=Number(o.microseconds),h=Number(o.nanoseconds);if(a(l,"second","s"),e.formatSubMilliseconds)a(d,"millisecond","ms"),a(f,"microsecond","\xB5s"),a(h,"nanosecond","ns");else{const m=d+f/1e3+h/1e6,y=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,R=m>=1?Math.round(m):Math.ceil(m),w=y?m.toFixed(y):R;a(Number.parseFloat(w),"millisecond","ms",w)}}else{const l=(n?Number(t%m6):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=s(l,d),h=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");a(Number.parseFloat(h),"second","s",h)}if(i.length===0)return r+"0"+(e.verbose?" milliseconds":"ms");const u=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),r+i.join(u)}const zA=Qt.getChild("cli");lt.bold(lt.bgRed(lt.white("ERROR"))),lt.bold(lt.yellow("WARN")),lt.bold(lt.green("INFO"));function FA(t){const e=Qt.getChild(t);return{info(n){e.info(n)},warn(n){if(n instanceof Error){e.warn(`${lt.red(n.name+" "+n.message)}`,{msg:n});return}if(typeof n=="string"){e.warn(n);return}e.warn`${n}`},warnOnce(n){e.warn(n)},error(n,r){let i=r?.error??n;if(i instanceof Error){if(n===i){e.error(`${lt.red(i.name+" "+i.message)}`,{error:i});return}e.error(`${n}`,{error:i});return}if(typeof n=="string"){e.error(`${lt.red(n)}`);return}e.error`${n}`},clearScreen:function(n){},hasErrorLogged:function(n){throw new Error("Function not implemented.")},hasWarned:!1}}const tw=()=>{},y6={info:tw,warn:tw,error:tw},v6=1e6;function qA(t){const[e,n]=yw(t),r=e*1e3+n/v6;return{ms:r,pretty:g6(r)}}function w6(t){const e=yw();return{stopAndLog(n="done in "){n=lt.green(`${n}${qA(e).pretty}`),(t||zA).info(n)}}}function b6(t,e){console.log($C(t,{padding:1,margin:1,dimBorder:!0,...e}))}class R6{constructor(e){this.services=e}isInitialized=!1;async initWorkspace(e){if(this.isInitialized)throw new Error("Workspace already initialized");const n=this.services.logger,r=this.services.shared.workspace.WorkspaceManager;n.info(`${lt.dim("workspace:")} ${e.uri}`),r.initialize({capabilities:{},processId:null,rootUri:null,workspaceFolders:[e]}),await r.initializeWorkspace([e])}async init(){if(this.isInitialized)throw new Error("Workspace already initialized");this.isInitialized=!0;const e=this.services.logger,n=this.services.likec4.ModelBuilder,r=this.services.shared.workspace.LangiumDocuments,i=this.services.shared.workspace.DocumentBuilder,s=r.all.toArray();if(s.length===0)throw e.error("no LikeC4 sources found"),new Error("no LikeC4 sources found");e.info(`${lt.dim("workspace:")} found ${s.length} source files`),await i.build(s,{validation:!0});const a=await n.buildComputedModel(),o=wc(a?.views??{}).length;if(o===0){e.warn(`${lt.dim("workspace:")} no views found`);return}e.info(`${lt.dim("workspace:")} ${lt.green(`\u2713 computed ${o} views`)}`);const c=await this.services.likec4.Views.diagrams();c.length===o?e.info(`${lt.dim("workspace:")} ${lt.green("\u2713 all views layouted")}`):e.warn(`${lt.dim("workspace:")} ${lt.yellow(`\u2717 layouted ${c.length} views`)}`)}}function $6(t){return e=>new t(e)}const k6={logger:()=>{throw new Error("Logger must be provided")},likec4:{Layouter:()=>{throw new Error("Layouter must be provided")}},cli:{Workspace:$6(R6)}};function GA(t){eN();const e=Qp(t,{useFileSystem:!0,logger:"default",graphviz:"wasm"});let n;switch(e.logger){case!1:n=y6;break;case"vite":n=FA("lang");break;case"default":n=Qt.getChild("lang");break;default:n=e.logger}const r=e.graphviz==="binary";n.info(`${lt.dim("version")} ${LA}`),n.info(`${lt.dim("layout")} ${r?"binary":"wasm"}`);const i={logger:()=>n,likec4:{Layouter:()=>new Q_(r===!0?new o6:new Qa)}};return D3(e.useFileSystem?TU:{},k6,i).likec4}const jA=t=>new Error(`Invalid model:
1778
- ${t.getErrors().map(e=>` ${e.sourceFsPath}:${e.line} ${e.message.slice(0,200)}`).join(`
1779
- `)}`);class Gi{constructor(e,n,r){this.workspace=e,this.langium=n,this.isPrintErrorEnabled=r,this.logger=n.logger,this.isPrintErrorEnabled&&this.printErrors()}static async fromSource(e,n){const r=GA(Qp(n,{useFileSystem:!1,logger:!1,graphviz:"wasm"})),i=Vt.from({scheme:"virtual",path:"/workspace"});await r.cli.Workspace.initWorkspace({uri:i.toString(),name:"virtual"});const s=Tt.joinPath(i,"source.likec4");r.shared.workspace.LangiumDocuments.createDocument(s,e),await r.cli.Workspace.init();const a=new Gi(i.path,r,n?.printErrors??!0);return n?.throwIfInvalid===!0&&a.hasErrors()?(a.dispose(),Promise.reject(jA(a))):a}static likec4Instances=new Map;static async fromWorkspace(e="",n){const r=WA(e);if(!UA(r))throw new Error(`Workspace not found: ${r}`);let i=Gi.likec4Instances.get(r);if(!i){const s=GA(Qp(n,{useFileSystem:!0,logger:"default",graphviz:"wasm"}));await s.cli.Workspace.initWorkspace({uri:VA(r).toString(),name:HA(r)}),await s.cli.Workspace.init(),i=new Gi(r,s,n?.printErrors??!0),Gi.likec4Instances.set(r,i)}return n?.throwIfInvalid===!0&&i.hasErrors()?(i.dispose(),Promise.reject(jA(i))):i}modelComputedRef;modelLayoutedRef;logger;get viewsService(){return this.langium.likec4.Views}get LangiumDocuments(){return this.langium.shared.workspace.LangiumDocuments}async diagrams(){return await this.langium.likec4.Views.diagrams()}computedModel(){let e=this.modelComputedRef?.deref();if(!e){const n=this.langium.likec4.ModelBuilder.unsafeSyncBuildModel();if(!n)throw new Error("Failed to build model");const r=this.langium.likec4.ModelBuilder.unsafeSyncBuildComputedModel(n);e=bw.create(r),this.modelComputedRef=new WeakRef(e)}return e}async layoutedModel(){let e=this.modelLayoutedRef?.deref();if(!e){const n=await this.langium.likec4.ModelBuilder.buildComputedModel();if(!n)throw new Error("Failed to build model");const r=await this.viewsService.diagrams();e=bw.create({...n,__:"layouted",views:ny(r,Rc("id"))}),this.modelLayoutedRef=new WeakRef(e)}return e}getErrors(){return this.LangiumDocuments.all.toArray().flatMap(e=>(e.diagnostics??[]).filter(n=>n.severity===hc.Error).map(({message:n,range:r})=>({message:n,line:r.start.line,range:r,sourceFsPath:e.uri.fsPath})))}hasErrors(){return this.LangiumDocuments.all.some(e=>e.diagnostics?.some(n=>n.severity===hc.Error)??!1)}printErrors(){let e=!1;for(const n of this.LangiumDocuments.all){const r=n.diagnostics?.filter(i=>i.severity===1);if(r&&r.length>0){e=!0;const i=r.flatMap(s=>{const a=s.range.start.line,o=s.message.split(`
1780
- `);return o.length>10&&(o.length=10,o.push("...")),o.map((c,u)=>u===0?" "+lt.dim(`Line ${a}: `)+lt.red(c):" ".repeat(10)+lt.red(c))}).join(`
1781
- `);this.logger.error(`Invalid ${n.uri.fsPath}
1782
- ${i}`)}}return e}async notifyUpdate({changed:e,removed:n}){this.modelLayoutedRef=void 0,this.modelComputedRef=void 0;const r=this.langium.shared.workspace.WorkspaceLock;try{let i=!1;return await r.write(async s=>{await this.langium.shared.workspace.DocumentBuilder.update(e?[Vt.file(e)]:[],n?[Vt.file(n)]:[],s),i=!s.isCancellationRequested}),i}catch(i){return this.logger.error(ea(i)),!1}}onModelUpdate(e){const n=this.langium.likec4.ModelBuilder.onModelParsed(()=>e());return()=>{n.dispose()}}dispose(){for(const[e,n]of Gi.likec4Instances)n===this&&Gi.likec4Instances.delete(e)}}export{rd as A,LA as B,Je as C,zA as D,ea as E,w6 as F,jv as G,_r as H,Gi as L,_b as N,na as T,sb as Y,rb as Z,sa as a,gt as b,FA as c,bc as d,Ge as e,nE as f,Ir as g,ie as h,Rt as i,qv as j,X4 as k,Ar as l,Qt as m,vt as n,b6 as o,Iv as p,Ra as q,sE as r,qA as s,eE as t,lt as u,IC as v,V4 as w,DC as x,c6 as y,Lt as z};