likec4 1.9.0 → 1.10.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.
@@ -0,0 +1,1221 @@
1
+ import*as Mb from"node:fs";import{writeFileSync as Fb,statSync as _N,readFileSync as Bp,appendFileSync as CN,createReadStream as jb,createWriteStream as Ub,existsSync as AN}from"node:fs";import Br,{sep as IN,resolve as xN,basename as PN}from"node:path";import{fileURLToPath as qp,pathToFileURL as NN}from"node:url";import{isatty as DN}from"tty";import ON,{formatWithOptions as LN,debuglog as MN,stripVTControlCharacters as FN,inspect as Bb,promisify as jN,callbackify as co,aborted as UN}from"node:util";import{ChildProcess as qb,spawnSync as BN,spawn as qN}from"node:child_process";import{StringDecoder as Wb}from"node:string_decoder";import Ke,{platform as WN,hrtime as Au,execPath as GN,execArgv as zN}from"node:process";import Gb from"node:tty";import zb from"child_process";import Pa from"path";import Iu from"fs";import{setTimeout as Hb,scheduler as Kb,setImmediate as HN}from"node:timers/promises";import{constants as Rs}from"node:os";import{once as on,addAbortListener as Vb,EventEmitter as KN,on as xu,setMaxListeners as VN}from"node:events";import{serialize as YN}from"node:v8";import{Transform as XN,getDefaultHighWaterMark as Pu,PassThrough as Yb,Readable as Ss,Writable as Wp,Duplex as Gp}from"node:stream";import{Buffer as zp}from"node:buffer";import{finished as ki}from"node:stream/promises";import{createLogger as JN}from"vite";import{Buffer as Hp}from"buffer";import QN from"util";import ZN from"os";import Xb from"crypto";import eD from"net";import tD from"url";import{Graphviz as Kp}from"@hpcc-js/wasm-graphviz";function at(t,e){if(typeof t>"u"||t==null)throw new Error(e??`Expected defined value, but received ${t}`);return t}function ce(t,e){if(!t)throw new Error(e??"Invariant failed")}function Se(t){throw new Error(`NonExhaustive value: ${t}`)}function nD(t,e,n){let r=i=>t(i,...e);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:e})}function Nu(t,e,n){let r=t.length-e.length;if(r===0)return t(...e);if(r===1)return nD(t,e,n);throw new Error("Wrong number of arguments")}function rD(t){return e=>!t(e)}function Na(t){return t==null}function iD(t){return Array.isArray(t)}function sD(...t){return Nu(oD,t)}var oD=(t,e)=>e.every(n=>n(t));function aD(...t){return Nu(cD,t)}var cD=(t,e)=>e.some(n=>n(t));function lD(t,e){return e?e+"."+t:t}const uD=["solid","dashed","dotted","none"],dD=["rectangle","person","browser","mobile","cylinder","storage","queue"],Du="primary",Jb="rectangle";function Qb(t){return"element"in t}function Zb(t){return"expanded"in t}function e0(t){return"custom"in t&&(Ou(t.custom.expr)||Vp(t.custom.expr))}function t0(t){return"wildcard"in t}function n0(t){return"elementKind"in t&&"isEqual"in t}function r0(t){return"elementTag"in t&&"isEqual"in t}function Ou(t){return Qb(t)||t0(t)||n0(t)||r0(t)||Zb(t)}function Vp(t){return"where"in t&&Ou(t.where.expr)}function fD(t){return Ou(t)||Vp(t)||e0(t)}function i0(t){return"source"in t&&"target"in t}function s0(t){return"inout"in t}function o0(t){return"incoming"in t}function a0(t){return"outgoing"in t}function Yp(t){return i0(t)||s0(t)||o0(t)||a0(t)}function c0(t){return"where"in t&&Yp(t.where.expr)}function l0(t){return"customRelation"in t}function hD(t){return Yp(t)||c0(t)||l0(t)}const ie={__proto__:null,isCustomElement:e0,isCustomRelationExpr:l0,isElement:Ou,isElementKindExpr:n0,isElementPredicateExpr:fD,isElementRef:Qb,isElementTagExpr:r0,isElementWhere:Vp,isExpandedElementExpr:Zb,isInOut:s0,isIncoming:o0,isOutgoing:a0,isRelation:i0,isRelationExpression:Yp,isRelationPredicateExpr:hD,isRelationWhere:c0,isWildcard:t0},pD=t=>"tag"in t,gD=t=>"kind"in t,mD=t=>"not"in t,Xp=t=>"and"in t,Jp=t=>"or"in t;function lo(t){switch(!0){case pD(t):{if("eq"in t.tag){const n=t.tag.eq;return r=>Array.isArray(r.tags)&&r.tags.includes(n)}const e=t.tag.neq;return n=>!Array.isArray(n.tags)||!n.tags.includes(e)}case gD(t):{if("eq"in t.kind){const n=t.kind.eq;return r=>r.kind===n}const e=t.kind.neq;return n=>Na(n.kind)||n.kind!==e}case mD(t):{const e=lo(t.not);return rD(e)}case Xp(t):{const e=t.and.map(lo);return sD(e)}case Jp(t):{const e=t.or.map(lo);return aD(e)}default:Se(t)}}const u0="dashed",uo="normal",fo="gray",yD=["amber","blue","gray","slate","green","indigo","muted","primary","red","secondary","sky"];function d0(t){return t in yD}function vD(t){return"include"in t&&Array.isArray(t.include)||"exclude"in t&&Array.isArray(t.exclude)}function wD(t){return"style"in t&&"targets"in t}function f0(t){return"autoLayout"in t}function bD(t){return"include"in t&&Array.isArray(t.include)}function TD(t){return"__parallel"in t&&iD(t.__parallel)}function Lu(t){return Na(t.__)||t.__==="element"}function h0(t){return Lu(t)&&"extends"in t}function p0(t){return Lu(t)&&"viewOf"in t}function g0(t,e){const n=`step-${String(t).padStart(2,"0")}`;return e?`${n}.${e}`:n}function m0(t){return t.startsWith("step-")}function y0(t){if(!m0(t))throw new Error(`Invalid step edge id: ${t}`);return parseFloat(t.slice(5))}function Qp(t){return t.__==="dynamic"}function ED(t){return Na(t.__)||t.__==="element"}const{min:RD,max:SD}=Math,$s=(t,e=0,n=1)=>RD(SD(e,t),n),Zp=t=>{t._clipped=!1,t._unclipped=t.slice(0);for(let e=0;e<=3;e++)e<3?((t[e]<0||t[e]>255)&&(t._clipped=!0),t[e]=$s(t[e],0,255)):e===3&&(t[e]=$s(t[e],0,1));return t},v0={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])v0[`[object ${t}]`]=t.toLowerCase();function ye(t){return v0[Object.prototype.toString.call(t)]||"object"}const de=(t,e=null)=>t.length>=3?Array.prototype.slice.call(t):ye(t[0])=="object"&&e?e.split("").filter(n=>t[0][n]!==void 0).map(n=>t[0][n]):t[0].slice(0),ho=t=>{if(t.length<2)return null;const e=t.length-1;return ye(t[e])=="string"?t[e].toLowerCase():null},{PI:Mu,min:w0,max:b0}=Math,In=t=>Math.round(t*100)/100,eg=t=>Math.round(t*100)/100,qr=Mu*2,tg=Mu/3,$D=Mu/180,kD=180/Mu,ue={format:{},autodetect:[]};let V=class{constructor(...e){const n=this;if(ye(e[0])==="object"&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];let r=ho(e),i=!1;if(!r){i=!0,ue.sorted||(ue.autodetect=ue.autodetect.sort((s,o)=>o.p-s.p),ue.sorted=!0);for(let s of ue.autodetect)if(r=s.test(...e),r)break}if(ue.format[r]){const s=ue.format[r].apply(null,i?e:e.slice(0,-1));n._rgb=Zp(s)}else throw new Error("unknown format: "+e);n._rgb.length===3&&n._rgb.push(1)}toString(){return ye(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}};const _D="3.1.1",be=(...t)=>new V(...t);be.version=_D;const po={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",cyan:"#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",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",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",maroon2:"#7f0000",maroon3:"#b03060",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",purple2:"#7f007f",purple3:"#a020f0",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",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},CD=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,AD=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,T0=t=>{if(t.match(CD)){(t.length===4||t.length===7)&&(t=t.substr(1)),t.length===3&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const e=parseInt(t,16),n=e>>16,r=e>>8&255,i=e&255;return[n,r,i,1]}if(t.match(AD)){(t.length===5||t.length===9)&&(t=t.substr(1)),t.length===4&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const e=parseInt(t,16),n=e>>24&255,r=e>>16&255,i=e>>8&255,s=Math.round((e&255)/255*100)/100;return[n,r,i,s]}throw new Error(`unknown hex color: ${t}`)},{round:Fu}=Math,E0=(...t)=>{let[e,n,r,i]=de(t,"rgba"),s=ho(t)||"auto";i===void 0&&(i=1),s==="auto"&&(s=i<1?"rgba":"rgb"),e=Fu(e),n=Fu(n),r=Fu(r);let o="000000"+(e<<16|n<<8|r).toString(16);o=o.substr(o.length-6);let a="0"+Fu(i*255).toString(16);switch(a=a.substr(a.length-2),s.toLowerCase()){case"rgba":return`#${o}${a}`;case"argb":return`#${a}${o}`;default:return`#${o}`}};V.prototype.name=function(){const t=E0(this._rgb,"rgb");for(let e of Object.keys(po))if(po[e]===t)return e.toLowerCase();return t},ue.format.named=t=>{if(t=t.toLowerCase(),po[t])return T0(po[t]);throw new Error("unknown color name: "+t)},ue.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&ye(t)==="string"&&po[t.toLowerCase()])return"named"}}),V.prototype.alpha=function(t,e=!1){return t!==void 0&&ye(t)==="number"?e?(this._rgb[3]=t,this):new V([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]},V.prototype.clipped=function(){return this._rgb._clipped||!1};const pr={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},ID=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function Wr(t){const e=ID.get(String(t).toLowerCase());if(!e)throw new Error("unknown Lab illuminant "+t);pr.labWhitePoint=t,pr.Xn=e[0],pr.Zn=e[1]}function Da(){return pr.labWhitePoint}const ng=(...t)=>{t=de(t,"lab");const[e,n,r]=t,[i,s,o]=xD(e,n,r),[a,c,l]=R0(i,s,o);return[a,c,l,t.length>3?t[3]:1]},xD=(t,e,n)=>{const{kE:r,kK:i,kKE:s,Xn:o,Yn:a,Zn:c}=pr,l=(t+16)/116,u=.002*e+l,d=l-.005*n,f=u*u*u,h=d*d*d,p=f>r?f:(116*u-16)/i,y=t>s?Math.pow((t+16)/116,3):t/i,R=h>r?h:(116*d-16)/i,b=p*o,v=y*a,T=R*c;return[b,v,T]},rg=t=>{const e=Math.sign(t);return t=Math.abs(t),(t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055)*e},R0=(t,e,n)=>{const{MtxAdaptMa:r,MtxAdaptMaI:i,MtxXYZ2RGB:s,RefWhiteRGB:o,Xn:a,Yn:c,Zn:l}=pr,u=a*r.m00+c*r.m10+l*r.m20,d=a*r.m01+c*r.m11+l*r.m21,f=a*r.m02+c*r.m12+l*r.m22,h=o.X*r.m00+o.Y*r.m10+o.Z*r.m20,p=o.X*r.m01+o.Y*r.m11+o.Z*r.m21,y=o.X*r.m02+o.Y*r.m12+o.Z*r.m22,R=(t*r.m00+e*r.m10+n*r.m20)*(h/u),b=(t*r.m01+e*r.m11+n*r.m21)*(p/d),v=(t*r.m02+e*r.m12+n*r.m22)*(y/f),T=R*i.m00+b*i.m10+v*i.m20,_=R*i.m01+b*i.m11+v*i.m21,N=R*i.m02+b*i.m12+v*i.m22,F=rg(T*s.m00+_*s.m10+N*s.m20),x=rg(T*s.m01+_*s.m11+N*s.m21),G=rg(T*s.m02+_*s.m12+N*s.m22);return[F*255,x*255,G*255]},ig=(...t)=>{const[e,n,r,...i]=de(t,"rgb"),[s,o,a]=S0(e,n,r),[c,l,u]=PD(s,o,a);return[c,l,u,...i.length>0&&i[0]<1?[i[0]]:[]]};function PD(t,e,n){const{Xn:r,Yn:i,Zn:s,kE:o,kK:a}=pr,c=t/r,l=e/i,u=n/s,d=c>o?Math.pow(c,1/3):(a*c+16)/116,f=l>o?Math.pow(l,1/3):(a*l+16)/116,h=u>o?Math.pow(u,1/3):(a*u+16)/116;return[116*f-16,500*(d-f),200*(f-h)]}function sg(t){const e=Math.sign(t);return t=Math.abs(t),(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))*e}const S0=(t,e,n)=>{t=sg(t/255),e=sg(e/255),n=sg(n/255);const{MtxRGB2XYZ:r,MtxAdaptMa:i,MtxAdaptMaI:s,Xn:o,Yn:a,Zn:c,As:l,Bs:u,Cs:d}=pr;let f=t*r.m00+e*r.m10+n*r.m20,h=t*r.m01+e*r.m11+n*r.m21,p=t*r.m02+e*r.m12+n*r.m22;const y=o*i.m00+a*i.m10+c*i.m20,R=o*i.m01+a*i.m11+c*i.m21,b=o*i.m02+a*i.m12+c*i.m22;let v=f*i.m00+h*i.m10+p*i.m20,T=f*i.m01+h*i.m11+p*i.m21,_=f*i.m02+h*i.m12+p*i.m22;return v*=y/l,T*=R/u,_*=b/d,f=v*s.m00+T*s.m10+_*s.m20,h=v*s.m01+T*s.m11+_*s.m21,p=v*s.m02+T*s.m12+_*s.m22,[f,h,p]};V.prototype.lab=function(){return ig(this._rgb)};const ND=(...t)=>new V(...t,"lab");Object.assign(be,{lab:ND,getLabWhitePoint:Da,setLabWhitePoint:Wr}),ue.format.lab=ng,ue.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"lab"),ye(t)==="array"&&t.length===3)return"lab"}}),V.prototype.darken=function(t=1){const e=this,n=e.lab();return n[0]-=pr.Kn*t,new V(n,"lab").alpha(e.alpha(),!0)},V.prototype.brighten=function(t=1){return this.darken(-t)},V.prototype.darker=V.prototype.darken,V.prototype.brighter=V.prototype.brighten,V.prototype.get=function(t){const[e,n]=t.split("."),r=this[e]();if(n){const i=e.indexOf(n)-(e.substr(0,2)==="ok"?2:0);if(i>-1)return r[i];throw new Error(`unknown channel ${n} in mode ${e}`)}else return r};const{pow:DD}=Math,OD=1e-7,LD=20;V.prototype.luminance=function(t,e="rgb"){if(t!==void 0&&ye(t)==="number"){if(t===0)return new V([0,0,0,this._rgb[3]],"rgb");if(t===1)return new V([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),r=LD;const i=(o,a)=>{const c=o.interpolate(a,.5,e),l=c.luminance();return Math.abs(t-l)<OD||!r--?c:l>t?i(o,c):i(c,a)},s=(n>t?i(new V([0,0,0]),this):i(this,new V([255,255,255]))).rgb();return new V([...s,this._rgb[3]])}return MD(...this._rgb.slice(0,3))};const MD=(t,e,n)=>(t=og(t),e=og(e),n=og(n),.2126*t+.7152*e+.0722*n),og=t=>(t/=255,t<=.03928?t/12.92:DD((t+.055)/1.055,2.4)),jt={},go=(t,e,n=.5,...r)=>{let i=r[0]||"lrgb";if(!jt[i]&&!r.length&&(i=Object.keys(jt)[0]),!jt[i])throw new Error(`interpolation mode ${i} is not defined`);return ye(t)!=="object"&&(t=new V(t)),ye(e)!=="object"&&(e=new V(e)),jt[i](t,e,n).alpha(t.alpha()+n*(e.alpha()-t.alpha()))};V.prototype.mix=V.prototype.interpolate=function(t,e=.5,...n){return go(this,t,e,...n)},V.prototype.premultiply=function(t=!1){const e=this._rgb,n=e[3];return t?(this._rgb=[e[0]*n,e[1]*n,e[2]*n,n],this):new V([e[0]*n,e[1]*n,e[2]*n,n],"rgb")};const{sin:FD,cos:jD}=Math,$0=(...t)=>{let[e,n,r]=de(t,"lch");return isNaN(r)&&(r=0),r=r*$D,[e,jD(r)*n,FD(r)*n]},ag=(...t)=>{t=de(t,"lch");const[e,n,r]=t,[i,s,o]=$0(e,n,r),[a,c,l]=ng(i,s,o);return[a,c,l,t.length>3?t[3]:1]},UD=(...t)=>{const e=de(t,"hcl").reverse();return ag(...e)},{sqrt:BD,atan2:qD,round:WD}=Math,k0=(...t)=>{const[e,n,r]=de(t,"lab"),i=BD(n*n+r*r);let s=(qD(r,n)*kD+360)%360;return WD(i*1e4)===0&&(s=Number.NaN),[e,i,s]},cg=(...t)=>{const[e,n,r,...i]=de(t,"rgb"),[s,o,a]=ig(e,n,r),[c,l,u]=k0(s,o,a);return[c,l,u,...i.length>0&&i[0]<1?[i[0]]:[]]};V.prototype.lch=function(){return cg(this._rgb)},V.prototype.hcl=function(){return cg(this._rgb).reverse()};const GD=(...t)=>new V(...t,"lch"),zD=(...t)=>new V(...t,"hcl");Object.assign(be,{lch:GD,hcl:zD}),ue.format.lch=ag,ue.format.hcl=UD,["lch","hcl"].forEach(t=>ue.autodetect.push({p:2,test:(...e)=>{if(e=de(e,t),ye(e)==="array"&&e.length===3)return t}})),V.prototype.saturate=function(t=1){const e=this,n=e.lch();return n[1]+=pr.Kn*t,n[1]<0&&(n[1]=0),new V(n,"lch").alpha(e.alpha(),!0)},V.prototype.desaturate=function(t=1){return this.saturate(-t)},V.prototype.set=function(t,e,n=!1){const[r,i]=t.split("."),s=this[r]();if(i){const o=r.indexOf(i)-(r.substr(0,2)==="ok"?2:0);if(o>-1){if(ye(e)=="string")switch(e.charAt(0)){case"+":s[o]+=+e;break;case"-":s[o]+=+e;break;case"*":s[o]*=+e.substr(1);break;case"/":s[o]/=+e.substr(1);break;default:s[o]=+e}else if(ye(e)==="number")s[o]=e;else throw new Error("unsupported value for Color.set");const a=new V(s,r);return n?(this._rgb=a._rgb,this):a}throw new Error(`unknown channel ${i} in mode ${r}`)}else return s},V.prototype.tint=function(t=.5,...e){return go(this,"white",t,...e)},V.prototype.shade=function(t=.5,...e){return go(this,"black",t,...e)};const HD=(t,e,n)=>{const r=t._rgb,i=e._rgb;return new V(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),"rgb")};jt.rgb=HD;const{sqrt:lg,pow:mo}=Math,KD=(t,e,n)=>{const[r,i,s]=t._rgb,[o,a,c]=e._rgb;return new V(lg(mo(r,2)*(1-n)+mo(o,2)*n),lg(mo(i,2)*(1-n)+mo(a,2)*n),lg(mo(s,2)*(1-n)+mo(c,2)*n),"rgb")};jt.lrgb=KD;const VD=(t,e,n)=>{const r=t.lab(),i=e.lab();return new V(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),"lab")};jt.lab=VD;const yo=(t,e,n,r)=>{let i,s;r==="hsl"?(i=t.hsl(),s=e.hsl()):r==="hsv"?(i=t.hsv(),s=e.hsv()):r==="hcg"?(i=t.hcg(),s=e.hcg()):r==="hsi"?(i=t.hsi(),s=e.hsi()):r==="lch"||r==="hcl"?(r="hcl",i=t.hcl(),s=e.hcl()):r==="oklch"&&(i=t.oklch().reverse(),s=e.oklch().reverse());let o,a,c,l,u,d;(r.substr(0,1)==="h"||r==="oklch")&&([o,c,u]=i,[a,l,d]=s);let f,h,p,y;return!isNaN(o)&&!isNaN(a)?(a>o&&a-o>180?y=a-(o+360):a<o&&o-a>180?y=a+360-o:y=a-o,h=o+n*y):isNaN(o)?isNaN(a)?h=Number.NaN:(h=a,(u==1||u==0)&&r!="hsv"&&(f=l)):(h=o,(d==1||d==0)&&r!="hsv"&&(f=c)),f===void 0&&(f=c+n*(l-c)),p=u+n*(d-u),r==="oklch"?new V([p,f,h],r):new V([h,f,p],r)},_0=(t,e,n)=>yo(t,e,n,"lch");jt.lch=_0,jt.hcl=_0;const YD=t=>{if(ye(t)=="number"&&t>=0&&t<=16777215){const e=t>>16,n=t>>8&255,r=t&255;return[e,n,r,1]}throw new Error("unknown num color: "+t)},XD=(...t)=>{const[e,n,r]=de(t,"rgb");return(e<<16)+(n<<8)+r};V.prototype.num=function(){return XD(this._rgb)};const JD=(...t)=>new V(...t,"num");Object.assign(be,{num:JD}),ue.format.num=YD,ue.autodetect.push({p:5,test:(...t)=>{if(t.length===1&&ye(t[0])==="number"&&t[0]>=0&&t[0]<=16777215)return"num"}});const QD=(t,e,n)=>{const r=t.num(),i=e.num();return new V(r+n*(i-r),"num")};jt.num=QD;const{floor:ZD}=Math,eO=(...t)=>{t=de(t,"hcg");let[e,n,r]=t,i,s,o;r=r*255;const a=n*255;if(n===0)i=s=o=r;else{e===360&&(e=0),e>360&&(e-=360),e<0&&(e+=360),e/=60;const c=ZD(e),l=e-c,u=r*(1-n),d=u+a*(1-l),f=u+a*l,h=u+a;switch(c){case 0:[i,s,o]=[h,f,u];break;case 1:[i,s,o]=[d,h,u];break;case 2:[i,s,o]=[u,h,f];break;case 3:[i,s,o]=[u,d,h];break;case 4:[i,s,o]=[f,u,h];break;case 5:[i,s,o]=[h,u,d];break}}return[i,s,o,t.length>3?t[3]:1]},tO=(...t)=>{const[e,n,r]=de(t,"rgb"),i=w0(e,n,r),s=b0(e,n,r),o=s-i,a=o*100/255,c=i/(255-o)*100;let l;return o===0?l=Number.NaN:(e===s&&(l=(n-r)/o),n===s&&(l=2+(r-e)/o),r===s&&(l=4+(e-n)/o),l*=60,l<0&&(l+=360)),[l,a,c]};V.prototype.hcg=function(){return tO(this._rgb)};const nO=(...t)=>new V(...t,"hcg");be.hcg=nO,ue.format.hcg=eO,ue.autodetect.push({p:1,test:(...t)=>{if(t=de(t,"hcg"),ye(t)==="array"&&t.length===3)return"hcg"}});const rO=(t,e,n)=>yo(t,e,n,"hcg");jt.hcg=rO;const{cos:vo}=Math,iO=(...t)=>{t=de(t,"hsi");let[e,n,r]=t,i,s,o;return isNaN(e)&&(e=0),isNaN(n)&&(n=0),e>360&&(e-=360),e<0&&(e+=360),e/=360,e<1/3?(o=(1-n)/3,i=(1+n*vo(qr*e)/vo(tg-qr*e))/3,s=1-(o+i)):e<2/3?(e-=1/3,i=(1-n)/3,s=(1+n*vo(qr*e)/vo(tg-qr*e))/3,o=1-(i+s)):(e-=2/3,s=(1-n)/3,o=(1+n*vo(qr*e)/vo(tg-qr*e))/3,i=1-(s+o)),i=$s(r*i*3),s=$s(r*s*3),o=$s(r*o*3),[i*255,s*255,o*255,t.length>3?t[3]:1]},{min:sO,sqrt:oO,acos:aO}=Math,cO=(...t)=>{let[e,n,r]=de(t,"rgb");e/=255,n/=255,r/=255;let i;const s=sO(e,n,r),o=(e+n+r)/3,a=o>0?1-s/o:0;return a===0?i=NaN:(i=(e-n+(e-r))/2,i/=oO((e-n)*(e-n)+(e-r)*(n-r)),i=aO(i),r>n&&(i=qr-i),i/=qr),[i*360,a,o]};V.prototype.hsi=function(){return cO(this._rgb)};const lO=(...t)=>new V(...t,"hsi");be.hsi=lO,ue.format.hsi=iO,ue.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"hsi"),ye(t)==="array"&&t.length===3)return"hsi"}});const uO=(t,e,n)=>yo(t,e,n,"hsi");jt.hsi=uO;const ug=(...t)=>{t=de(t,"hsl");const[e,n,r]=t;let i,s,o;if(n===0)i=s=o=r*255;else{const a=[0,0,0],c=[0,0,0],l=r<.5?r*(1+n):r+n-r*n,u=2*r-l,d=e/360;a[0]=d+1/3,a[1]=d,a[2]=d-1/3;for(let f=0;f<3;f++)a[f]<0&&(a[f]+=1),a[f]>1&&(a[f]-=1),6*a[f]<1?c[f]=u+(l-u)*6*a[f]:2*a[f]<1?c[f]=l:3*a[f]<2?c[f]=u+(l-u)*(2/3-a[f])*6:c[f]=u;[i,s,o]=[c[0]*255,c[1]*255,c[2]*255]}return t.length>3?[i,s,o,t[3]]:[i,s,o,1]},C0=(...t)=>{t=de(t,"rgba");let[e,n,r]=t;e/=255,n/=255,r/=255;const i=w0(e,n,r),s=b0(e,n,r),o=(s+i)/2;let a,c;return s===i?(a=0,c=Number.NaN):a=o<.5?(s-i)/(s+i):(s-i)/(2-s-i),e==s?c=(n-r)/(s-i):n==s?c=2+(r-e)/(s-i):r==s&&(c=4+(e-n)/(s-i)),c*=60,c<0&&(c+=360),t.length>3&&t[3]!==void 0?[c,a,o,t[3]]:[c,a,o]};V.prototype.hsl=function(){return C0(this._rgb)};const dO=(...t)=>new V(...t,"hsl");be.hsl=dO,ue.format.hsl=ug,ue.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"hsl"),ye(t)==="array"&&t.length===3)return"hsl"}});const fO=(t,e,n)=>yo(t,e,n,"hsl");jt.hsl=fO;const{floor:hO}=Math,pO=(...t)=>{t=de(t,"hsv");let[e,n,r]=t,i,s,o;if(r*=255,n===0)i=s=o=r;else{e===360&&(e=0),e>360&&(e-=360),e<0&&(e+=360),e/=60;const a=hO(e),c=e-a,l=r*(1-n),u=r*(1-n*c),d=r*(1-n*(1-c));switch(a){case 0:[i,s,o]=[r,d,l];break;case 1:[i,s,o]=[u,r,l];break;case 2:[i,s,o]=[l,r,d];break;case 3:[i,s,o]=[l,u,r];break;case 4:[i,s,o]=[d,l,r];break;case 5:[i,s,o]=[r,l,u];break}}return[i,s,o,t.length>3?t[3]:1]},{min:gO,max:mO}=Math,yO=(...t)=>{t=de(t,"rgb");let[e,n,r]=t;const i=gO(e,n,r),s=mO(e,n,r),o=s-i;let a,c,l;return l=s/255,s===0?(a=Number.NaN,c=0):(c=o/s,e===s&&(a=(n-r)/o),n===s&&(a=2+(r-e)/o),r===s&&(a=4+(e-n)/o),a*=60,a<0&&(a+=360)),[a,c,l]};V.prototype.hsv=function(){return yO(this._rgb)};const vO=(...t)=>new V(...t,"hsv");be.hsv=vO,ue.format.hsv=pO,ue.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"hsv"),ye(t)==="array"&&t.length===3)return"hsv"}});const wO=(t,e,n)=>yo(t,e,n,"hsv");jt.hsv=wO;function ju(t,e){let n=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(e[0])||(e=e.map(o=>[o]));let r=e[0].length,i=e[0].map((o,a)=>e.map(c=>c[a])),s=t.map(o=>i.map(a=>Array.isArray(o)?o.reduce((c,l,u)=>c+l*(a[u]||0),0):a.reduce((c,l)=>c+l*o,0)));return n===1&&(s=s[0]),r===1?s.map(o=>o[0]):s}const dg=(...t)=>{t=de(t,"lab");const[e,n,r,...i]=t,[s,o,a]=bO([e,n,r]),[c,l,u]=R0(s,o,a);return[c,l,u,...i.length>0&&i[0]<1?[i[0]]:[]]};function bO(t){var e=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],n=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],r=ju(n,t);return ju(e,r.map(i=>i**3))}const fg=(...t)=>{const[e,n,r,...i]=de(t,"rgb"),s=S0(e,n,r);return[...TO(s),...i.length>0&&i[0]<1?[i[0]]:[]]};function TO(t){const e=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],n=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],r=ju(e,t);return ju(n,r.map(i=>Math.cbrt(i)))}V.prototype.oklab=function(){return fg(this._rgb)};const EO=(...t)=>new V(...t,"oklab");Object.assign(be,{oklab:EO}),ue.format.oklab=dg,ue.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"oklab"),ye(t)==="array"&&t.length===3)return"oklab"}});const RO=(t,e,n)=>{const r=t.oklab(),i=e.oklab();return new V(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),"oklab")};jt.oklab=RO;const SO=(t,e,n)=>yo(t,e,n,"oklch");jt.oklch=SO;const{pow:hg,sqrt:pg,PI:gg,cos:A0,sin:I0,atan2:$O}=Math,kO=(t,e="lrgb",n=null)=>{const r=t.length;n||(n=Array.from(new Array(r)).map(()=>1));const i=r/n.reduce(function(d,f){return d+f});if(n.forEach((d,f)=>{n[f]*=i}),t=t.map(d=>new V(d)),e==="lrgb")return _O(t,n);const s=t.shift(),o=s.get(e),a=[];let c=0,l=0;for(let d=0;d<o.length;d++)if(o[d]=(o[d]||0)*n[0],a.push(isNaN(o[d])?0:n[0]),e.charAt(d)==="h"&&!isNaN(o[d])){const f=o[d]/180*gg;c+=A0(f)*n[0],l+=I0(f)*n[0]}let u=s.alpha()*n[0];t.forEach((d,f)=>{const h=d.get(e);u+=d.alpha()*n[f+1];for(let p=0;p<o.length;p++)if(!isNaN(h[p]))if(a[p]+=n[f+1],e.charAt(p)==="h"){const y=h[p]/180*gg;c+=A0(y)*n[f+1],l+=I0(y)*n[f+1]}else o[p]+=h[p]*n[f+1]});for(let d=0;d<o.length;d++)if(e.charAt(d)==="h"){let f=$O(l/a[d],c/a[d])/gg*180;for(;f<0;)f+=360;for(;f>=360;)f-=360;o[d]=f}else o[d]=o[d]/a[d];return u/=r,new V(o,e).alpha(u>.99999?1:u,!0)},_O=(t,e)=>{const n=t.length,r=[0,0,0,0];for(let i=0;i<t.length;i++){const s=t[i],o=e[i]/n,a=s._rgb;r[0]+=hg(a[0],2)*o,r[1]+=hg(a[1],2)*o,r[2]+=hg(a[2],2)*o,r[3]+=a[3]*o}return r[0]=pg(r[0]),r[1]=pg(r[1]),r[2]=pg(r[2]),r[3]>.9999999&&(r[3]=1),new V(Zp(r))},{pow:CO}=Math;function Uu(t){let e="rgb",n=be("#ccc"),r=0,i=[0,1],s=[],o=[0,0],a=!1,c=[],l=!1,u=0,d=1,f=!1,h={},p=!0,y=1;const R=function(x){if(x=x||["#fff","#000"],x&&ye(x)==="string"&&be.brewer&&be.brewer[x.toLowerCase()]&&(x=be.brewer[x.toLowerCase()]),ye(x)==="array"){x.length===1&&(x=[x[0],x[0]]),x=x.slice(0);for(let G=0;G<x.length;G++)x[G]=be(x[G]);s.length=0;for(let G=0;G<x.length;G++)s.push(G/(x.length-1))}return N(),c=x},b=function(x){if(a!=null){const G=a.length-1;let B=0;for(;B<G&&x>=a[B];)B++;return B-1}return 0};let v=x=>x,T=x=>x;const _=function(x,G){let B,W;if(G==null&&(G=!1),isNaN(x)||x===null)return n;G?W=x:a&&a.length>2?W=b(x)/(a.length-2):d!==u?W=(x-u)/(d-u):W=1,W=T(W),G||(W=v(W)),y!==1&&(W=CO(W,y)),W=o[0]+W*(1-o[0]-o[1]),W=$s(W,0,1);const I=Math.floor(W*1e4);if(p&&h[I])B=h[I];else{if(ye(c)==="array")for(let k=0;k<s.length;k++){const S=s[k];if(W<=S){B=c[k];break}if(W>=S&&k===s.length-1){B=c[k];break}if(W>S&&W<s[k+1]){W=(W-S)/(s[k+1]-S),B=be.interpolate(c[k],c[k+1],W,e);break}}else ye(c)==="function"&&(B=c(W));p&&(h[I]=B)}return B};var N=()=>h={};R(t);const F=function(x){const G=be(_(x));return l&&G[l]?G[l]():G};return F.classes=function(x){if(x!=null){if(ye(x)==="array")a=x,i=[x[0],x[x.length-1]];else{const G=be.analyze(i);x===0?a=[G.min,G.max]:a=be.limits(G,"e",x)}return F}return a},F.domain=function(x){if(!arguments.length)return i;u=x[0],d=x[x.length-1],s=[];const G=c.length;if(x.length===G&&u!==d)for(let B of Array.from(x))s.push((B-u)/(d-u));else{for(let B=0;B<G;B++)s.push(B/(G-1));if(x.length>2){const B=x.map((I,k)=>k/(x.length-1)),W=x.map(I=>(I-u)/(d-u));W.every((I,k)=>B[k]===I)||(T=I=>{if(I<=0||I>=1)return I;let k=0;for(;I>=W[k+1];)k++;const S=(I-W[k])/(W[k+1]-W[k]);return B[k]+S*(B[k+1]-B[k])})}}return i=[u,d],F},F.mode=function(x){return arguments.length?(e=x,N(),F):e},F.range=function(x,G){return R(x),F},F.out=function(x){return l=x,F},F.spread=function(x){return arguments.length?(r=x,F):r},F.correctLightness=function(x){return x==null&&(x=!0),f=x,N(),f?v=function(G){const B=_(0,!0).lab()[0],W=_(1,!0).lab()[0],I=B>W;let k=_(G,!0).lab()[0];const S=B+(W-B)*G;let M=k-S,q=0,U=1,z=20;for(;Math.abs(M)>.01&&z-- >0;)(function(){return I&&(M*=-1),M<0?(q=G,G+=(U-G)*.5):(U=G,G+=(q-G)*.5),k=_(G,!0).lab()[0],M=k-S})();return G}:v=G=>G,F},F.padding=function(x){return x!=null?(ye(x)==="number"&&(x=[x,x]),o=x,F):o},F.colors=function(x,G){arguments.length<2&&(G="hex");let B=[];if(arguments.length===0)B=c.slice(0);else if(x===1)B=[F(.5)];else if(x>1){const W=i[0],I=i[1]-W;B=AO(0,x).map(k=>F(W+k/(x-1)*I))}else{t=[];let W=[];if(a&&a.length>2)for(let I=1,k=a.length,S=1<=k;S?I<k:I>k;S?I++:I--)W.push((a[I-1]+a[I])*.5);else W=i;B=W.map(I=>F(I))}return be[G]&&(B=B.map(W=>W[G]())),B},F.cache=function(x){return x!=null?(p=x,F):p},F.gamma=function(x){return x!=null?(y=x,F):y},F.nodata=function(x){return x!=null?(n=be(x),F):n},F}function AO(t,e,n){let r=[],i=t<e,s=e;for(let o=t;i?o<s:o>s;i?o++:o--)r.push(o);return r}const IO=function(t){let e=[1,1];for(let n=1;n<t;n++){let r=[1];for(let i=1;i<=e.length;i++)r[i]=(e[i]||0)+e[i-1];e=r}return e},xO=function(t){let e,n,r,i;if(t=t.map(s=>new V(s)),t.length===2)[n,r]=t.map(s=>s.lab()),e=function(s){const o=[0,1,2].map(a=>n[a]+s*(r[a]-n[a]));return new V(o,"lab")};else if(t.length===3)[n,r,i]=t.map(s=>s.lab()),e=function(s){const o=[0,1,2].map(a=>(1-s)*(1-s)*n[a]+2*(1-s)*s*r[a]+s*s*i[a]);return new V(o,"lab")};else if(t.length===4){let s;[n,r,i,s]=t.map(o=>o.lab()),e=function(o){const a=[0,1,2].map(c=>(1-o)*(1-o)*(1-o)*n[c]+3*(1-o)*(1-o)*o*r[c]+3*(1-o)*o*o*i[c]+o*o*o*s[c]);return new V(a,"lab")}}else if(t.length>=5){let s,o,a;s=t.map(c=>c.lab()),a=t.length-1,o=IO(a),e=function(c){const l=1-c,u=[0,1,2].map(d=>s.reduce((f,h,p)=>f+o[p]*l**(a-p)*c**p*h[d],0));return new V(u,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return e},PO=t=>{const e=xO(t);return e.scale=()=>Uu(e),e},{round:x0}=Math;V.prototype.rgb=function(t=!0){return t===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(x0)},V.prototype.rgba=function(t=!0){return this._rgb.slice(0,4).map((e,n)=>n<3?t===!1?e:x0(e):e)};const NO=(...t)=>new V(...t,"rgb");Object.assign(be,{rgb:NO}),ue.format.rgb=(...t)=>{const e=de(t,"rgba");return e[3]===void 0&&(e[3]=1),e},ue.autodetect.push({p:3,test:(...t)=>{if(t=de(t,"rgba"),ye(t)==="array"&&(t.length===3||t.length===4&&ye(t[3])=="number"&&t[3]>=0&&t[3]<=1))return"rgb"}});const Vn=(t,e,n)=>{if(!Vn[n])throw new Error("unknown blend mode "+n);return Vn[n](t,e)},_i=t=>(e,n)=>{const r=be(n).rgb(),i=be(e).rgb();return be.rgb(t(r,i))},Ci=t=>(e,n)=>{const r=[];return r[0]=t(e[0],n[0]),r[1]=t(e[1],n[1]),r[2]=t(e[2],n[2]),r},DO=t=>t,OO=(t,e)=>t*e/255,LO=(t,e)=>t>e?e:t,MO=(t,e)=>t>e?t:e,FO=(t,e)=>255*(1-(1-t/255)*(1-e/255)),jO=(t,e)=>e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255)),UO=(t,e)=>255*(1-(1-e/255)/(t/255)),BO=(t,e)=>t===255?255:(t=255*(e/255)/(1-t/255),t>255?255:t);Vn.normal=_i(Ci(DO)),Vn.multiply=_i(Ci(OO)),Vn.screen=_i(Ci(FO)),Vn.overlay=_i(Ci(jO)),Vn.darken=_i(Ci(LO)),Vn.lighten=_i(Ci(MO)),Vn.dodge=_i(Ci(BO)),Vn.burn=_i(Ci(UO));const{pow:qO,sin:WO,cos:GO}=Math;function zO(t=300,e=-1.5,n=1,r=1,i=[0,1]){let s=0,o;ye(i)==="array"?o=i[1]-i[0]:(o=0,i=[i,i]);const a=function(c){const l=qr*((t+120)/360+e*c),u=qO(i[0]+o*c,r),d=(s!==0?n[0]+c*s:n)*u*(1-u)/2,f=GO(l),h=WO(l),p=u+d*(-.14861*f+1.78277*h),y=u+d*(-.29227*f-.90649*h),R=u+d*(1.97294*f);return be(Zp([p*255,y*255,R*255,1]))};return a.start=function(c){return c==null?t:(t=c,a)},a.rotations=function(c){return c==null?e:(e=c,a)},a.gamma=function(c){return c==null?r:(r=c,a)},a.hue=function(c){return c==null?n:(n=c,ye(n)==="array"?(s=n[1]-n[0],s===0&&(n=n[1])):s=0,a)},a.lightness=function(c){return c==null?i:(ye(c)==="array"?(i=c,o=c[1]-c[0]):(i=[c,c],o=0),a)},a.scale=()=>be.scale(a),a.hue(n),a}const HO="0123456789abcdef",{floor:KO,random:VO}=Math,YO=()=>{let t="#";for(let e=0;e<6;e++)t+=HO.charAt(KO(VO()*16));return new V(t,"hex")},{log:P0,pow:XO,floor:JO,abs:QO}=Math;function N0(t,e=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return ye(t)==="object"&&(t=Object.values(t)),t.forEach(r=>{e&&ye(r)==="object"&&(r=r[e]),r!=null&&!isNaN(r)&&(n.values.push(r),n.sum+=r,r<n.min&&(n.min=r),r>n.max&&(n.max=r),n.count+=1)}),n.domain=[n.min,n.max],n.limits=(r,i)=>D0(n,r,i),n}function D0(t,e="equal",n=7){ye(t)=="array"&&(t=N0(t));const{min:r,max:i}=t,s=t.values.sort((a,c)=>a-c);if(n===1)return[r,i];const o=[];if(e.substr(0,1)==="c"&&(o.push(r),o.push(i)),e.substr(0,1)==="e"){o.push(r);for(let a=1;a<n;a++)o.push(r+a/n*(i-r));o.push(i)}else if(e.substr(0,1)==="l"){if(r<=0)throw new Error("Logarithmic scales are only possible for values > 0");const a=Math.LOG10E*P0(r),c=Math.LOG10E*P0(i);o.push(r);for(let l=1;l<n;l++)o.push(XO(10,a+l/n*(c-a)));o.push(i)}else if(e.substr(0,1)==="q"){o.push(r);for(let a=1;a<n;a++){const c=(s.length-1)*a/n,l=JO(c);if(l===c)o.push(s[l]);else{const u=c-l;o.push(s[l]*(1-u)+s[l+1]*u)}}o.push(i)}else if(e.substr(0,1)==="k"){let a;const c=s.length,l=new Array(c),u=new Array(n);let d=!0,f=0,h=null;h=[],h.push(r);for(let R=1;R<n;R++)h.push(r+R/n*(i-r));for(h.push(i);d;){for(let b=0;b<n;b++)u[b]=0;for(let b=0;b<c;b++){const v=s[b];let T=Number.MAX_VALUE,_;for(let N=0;N<n;N++){const F=QO(h[N]-v);F<T&&(T=F,_=N),u[_]++,l[b]=_}}const R=new Array(n);for(let b=0;b<n;b++)R[b]=null;for(let b=0;b<c;b++)a=l[b],R[a]===null?R[a]=s[b]:R[a]+=s[b];for(let b=0;b<n;b++)R[b]*=1/u[b];d=!1;for(let b=0;b<n;b++)if(R[b]!==h[b]){d=!0;break}h=R,f++,f>200&&(d=!1)}const p={};for(let R=0;R<n;R++)p[R]=[];for(let R=0;R<c;R++)a=l[R],p[a].push(s[R]);let y=[];for(let R=0;R<n;R++)y.push(p[R][0]),y.push(p[R][p[R].length-1]);y=y.sort((R,b)=>R-b),o.push(y[0]);for(let R=1;R<y.length;R+=2){const b=y[R];!isNaN(b)&&o.indexOf(b)===-1&&o.push(b)}}return o}const ZO=(t,e)=>{t=new V(t),e=new V(e);const n=t.luminance(),r=e.luminance();return n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)},O0=.027,eL=5e-4,tL=.1,L0=1.14,Bu=.022,M0=1.414,nL=(t,e)=>{t=new V(t),e=new V(e),t.alpha()<1&&(t=go(e,t,t.alpha(),"rgb"));const n=F0(...t.rgb()),r=F0(...e.rgb()),i=n>=Bu?n:n+Math.pow(Bu-n,M0),s=r>=Bu?r:r+Math.pow(Bu-r,M0),o=Math.pow(s,.56)-Math.pow(i,.57),a=Math.pow(s,.65)-Math.pow(i,.62),c=Math.abs(s-i)<eL?0:i<s?o*L0:a*L0;return(Math.abs(c)<tL?0:c>0?c-O0:c+O0)*100};function F0(t,e,n){return .2126729*Math.pow(t/255,2.4)+.7151522*Math.pow(e/255,2.4)+.072175*Math.pow(n/255,2.4)}const{sqrt:Gr,pow:bt,min:rL,max:iL,atan2:j0,abs:U0,cos:qu,sin:B0,exp:sL,PI:q0}=Math;function oL(t,e,n=1,r=1,i=1){var s=function(Nt){return 360*Nt/(2*q0)},o=function(Nt){return 2*q0*Nt/360};t=new V(t),e=new V(e);const[a,c,l]=Array.from(t.lab()),[u,d,f]=Array.from(e.lab()),h=(a+u)/2,p=Gr(bt(c,2)+bt(l,2)),y=Gr(bt(d,2)+bt(f,2)),R=(p+y)/2,b=.5*(1-Gr(bt(R,7)/(bt(R,7)+bt(25,7)))),v=c*(1+b),T=d*(1+b),_=Gr(bt(v,2)+bt(l,2)),N=Gr(bt(T,2)+bt(f,2)),F=(_+N)/2,x=s(j0(l,v)),G=s(j0(f,T)),B=x>=0?x:x+360,W=G>=0?G:G+360,I=U0(B-W)>180?(B+W+360)/2:(B+W)/2,k=1-.17*qu(o(I-30))+.24*qu(o(2*I))+.32*qu(o(3*I+6))-.2*qu(o(4*I-63));let S=W-B;S=U0(S)<=180?S:W<=B?S+360:S-360,S=2*Gr(_*N)*B0(o(S)/2);const M=u-a,q=N-_,U=1+.015*bt(h-50,2)/Gr(20+bt(h-50,2)),z=1+.045*F,Pe=1+.015*F*k,J=30*sL(-bt((I-275)/25,2)),j=-(2*Gr(bt(F,7)/(bt(F,7)+bt(25,7))))*B0(2*o(J)),ge=Gr(bt(M/(n*U),2)+bt(q/(r*z),2)+bt(S/(i*Pe),2)+j*(q/(r*z))*(S/(i*Pe)));return iL(0,rL(100,ge))}function aL(t,e,n="lab"){t=new V(t),e=new V(e);const r=t.get(n),i=e.get(n);let s=0;for(let o in r){const a=(r[o]||0)-(i[o]||0);s+=a*a}return Math.sqrt(s)}const cL=(...t)=>{try{return new V(...t),!0}catch{return!1}},lL={cool(){return Uu([be.hsl(180,1,.9),be.hsl(250,.7,.4)])},hot(){return Uu(["#000","#f00","#ff0","#fff"]).mode("rgb")}},mg={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},W0=Object.keys(mg),G0=new Map(W0.map(t=>[t.toLowerCase(),t])),uL=typeof Proxy=="function"?new Proxy(mg,{get(t,e){const n=e.toLowerCase();if(G0.has(n))return t[G0.get(n)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(W0)}}):mg,dL=(...t)=>{t=de(t,"cmyk");const[e,n,r,i]=t,s=t.length>4?t[4]:1;return i===1?[0,0,0,s]:[e>=1?0:255*(1-e)*(1-i),n>=1?0:255*(1-n)*(1-i),r>=1?0:255*(1-r)*(1-i),s]},{max:z0}=Math,fL=(...t)=>{let[e,n,r]=de(t,"rgb");e=e/255,n=n/255,r=r/255;const i=1-z0(e,z0(n,r)),s=i<1?1/(1-i):0,o=(1-e-i)*s,a=(1-n-i)*s,c=(1-r-i)*s;return[o,a,c,i]};V.prototype.cmyk=function(){return fL(this._rgb)};const hL=(...t)=>new V(...t,"cmyk");Object.assign(be,{cmyk:hL}),ue.format.cmyk=dL,ue.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"cmyk"),ye(t)==="array"&&t.length===4)return"cmyk"}});const pL=(...t)=>{const e=de(t,"hsla");let n=ho(t)||"lsa";return e[0]=In(e[0]||0)+"deg",e[1]=In(e[1]*100)+"%",e[2]=In(e[2]*100)+"%",n==="hsla"||e.length>3&&e[3]<1?(e[3]="/ "+(e.length>3?e[3]:1),n="hsla"):e.length=3,`${n.substr(0,3)}(${e.join(" ")})`},gL=(...t)=>{const e=de(t,"lab");let n=ho(t)||"lab";return e[0]=In(e[0])+"%",e[1]=In(e[1]),e[2]=In(e[2]),n==="laba"||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lab(${e.join(" ")})`},mL=(...t)=>{const e=de(t,"lch");let n=ho(t)||"lab";return e[0]=In(e[0])+"%",e[1]=In(e[1]),e[2]=isNaN(e[2])?"none":In(e[2])+"deg",n==="lcha"||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lch(${e.join(" ")})`},yL=(...t)=>{const e=de(t,"lab");return e[0]=In(e[0]*100)+"%",e[1]=eg(e[1]),e[2]=eg(e[2]),e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklab(${e.join(" ")})`},H0=(...t)=>{const[e,n,r,...i]=de(t,"rgb"),[s,o,a]=fg(e,n,r),[c,l,u]=k0(s,o,a);return[c,l,u,...i.length>0&&i[0]<1?[i[0]]:[]]},vL=(...t)=>{const e=de(t,"lch");return e[0]=In(e[0]*100)+"%",e[1]=eg(e[1]),e[2]=isNaN(e[2])?"none":In(e[2])+"deg",e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklch(${e.join(" ")})`},{round:yg}=Math,wL=(...t)=>{const e=de(t,"rgba");let n=ho(t)||"rgb";if(n.substr(0,3)==="hsl")return pL(C0(e),n);if(n.substr(0,3)==="lab"){const r=Da();Wr("d50");const i=gL(ig(e),n);return Wr(r),i}if(n.substr(0,3)==="lch"){const r=Da();Wr("d50");const i=mL(cg(e),n);return Wr(r),i}return n.substr(0,5)==="oklab"?yL(fg(e)):n.substr(0,5)==="oklch"?vL(H0(e)):(e[0]=yg(e[0]),e[1]=yg(e[1]),e[2]=yg(e[2]),(n==="rgba"||e.length>3&&e[3]<1)&&(e[3]="/ "+(e.length>3?e[3]:1),n="rgba"),`${n.substr(0,3)}(${e.slice(0,n==="rgb"?3:4).join(" ")})`)},K0=(...t)=>{t=de(t,"lch");const[e,n,r,...i]=t,[s,o,a]=$0(e,n,r),[c,l,u]=dg(s,o,a);return[c,l,u,...i.length>0&&i[0]<1?[i[0]]:[]]},zr=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,Yn=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,Wu=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,xn=/\s*/.source,wo=/\s+/.source,vg=/\s*,\s*/.source,Gu=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,bo=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,V0=new RegExp("^rgba?\\("+xn+[zr,zr,zr].join(wo)+bo+"\\)$"),Y0=new RegExp("^rgb\\("+xn+[zr,zr,zr].join(vg)+xn+"\\)$"),X0=new RegExp("^rgba\\("+xn+[zr,zr,zr,Yn].join(vg)+xn+"\\)$"),J0=new RegExp("^hsla?\\("+xn+[Gu,Wu,Wu].join(wo)+bo+"\\)$"),Q0=new RegExp("^hsl?\\("+xn+[Gu,Wu,Wu].join(vg)+xn+"\\)$"),Z0=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,eT=new RegExp("^lab\\("+xn+[Yn,Yn,Yn].join(wo)+bo+"\\)$"),tT=new RegExp("^lch\\("+xn+[Yn,Yn,Gu].join(wo)+bo+"\\)$"),nT=new RegExp("^oklab\\("+xn+[Yn,Yn,Yn].join(wo)+bo+"\\)$"),rT=new RegExp("^oklch\\("+xn+[Yn,Yn,Gu].join(wo)+bo+"\\)$"),{round:iT}=Math,To=t=>t.map((e,n)=>n<=2?$s(iT(e),0,255):e),Tt=(t,e=0,n=100,r=!1)=>(typeof t=="string"&&t.endsWith("%")&&(t=parseFloat(t.substring(0,t.length-1))/100,r?t=e+(t+1)*.5*(n-e):t=e+t*(n-e)),+t),Vt=(t,e)=>t==="none"?e:t,wg=t=>{if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e;if(ue.format.named)try{return ue.format.named(t)}catch{}if((e=t.match(V0))||(e=t.match(Y0))){let n=e.slice(1,4);for(let i=0;i<3;i++)n[i]=+Tt(Vt(n[i],0),0,255);n=To(n);const r=e[4]!==void 0?+Tt(e[4],0,1):1;return n[3]=r,n}if(e=t.match(X0)){const n=e.slice(1,5);for(let r=0;r<4;r++)n[r]=+Tt(n[r],0,255);return n}if((e=t.match(J0))||(e=t.match(Q0))){const n=e.slice(1,4);n[0]=+Vt(n[0].replace("deg",""),0),n[1]=+Tt(Vt(n[1],0),0,100)*.01,n[2]=+Tt(Vt(n[2],0),0,100)*.01;const r=To(ug(n)),i=e[4]!==void 0?+Tt(e[4],0,1):1;return r[3]=i,r}if(e=t.match(Z0)){const n=e.slice(1,4);n[1]*=.01,n[2]*=.01;const r=ug(n);for(let i=0;i<3;i++)r[i]=iT(r[i]);return r[3]=+e[4],r}if(e=t.match(eT)){const n=e.slice(1,4);n[0]=Tt(Vt(n[0],0),0,100),n[1]=Tt(Vt(n[1],0),-125,125,!0),n[2]=Tt(Vt(n[2],0),-125,125,!0);const r=Da();Wr("d50");const i=To(ng(n));Wr(r);const s=e[4]!==void 0?+Tt(e[4],0,1):1;return i[3]=s,i}if(e=t.match(tT)){const n=e.slice(1,4);n[0]=Tt(n[0],0,100),n[1]=Tt(Vt(n[1],0),0,150,!1),n[2]=+Vt(n[2].replace("deg",""),0);const r=Da();Wr("d50");const i=To(ag(n));Wr(r);const s=e[4]!==void 0?+Tt(e[4],0,1):1;return i[3]=s,i}if(e=t.match(nT)){const n=e.slice(1,4);n[0]=Tt(Vt(n[0],0),0,1),n[1]=Tt(Vt(n[1],0),-.4,.4,!0),n[2]=Tt(Vt(n[2],0),-.4,.4,!0);const r=To(dg(n)),i=e[4]!==void 0?+Tt(e[4],0,1):1;return r[3]=i,r}if(e=t.match(rT)){const n=e.slice(1,4);n[0]=Tt(Vt(n[0],0),0,1),n[1]=Tt(Vt(n[1],0),0,.4,!1),n[2]=+Vt(n[2].replace("deg",""),0);const r=To(K0(n)),i=e[4]!==void 0?+Tt(e[4],0,1):1;return r[3]=i,r}};wg.test=t=>V0.test(t)||J0.test(t)||eT.test(t)||tT.test(t)||nT.test(t)||rT.test(t)||Y0.test(t)||X0.test(t)||Q0.test(t)||Z0.test(t)||t==="transparent",V.prototype.css=function(t){return wL(this._rgb,t)};const bL=(...t)=>new V(...t,"css");be.css=bL,ue.format.css=wg,ue.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&ye(t)==="string"&&wg.test(t))return"css"}}),ue.format.gl=(...t)=>{const e=de(t,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e};const TL=(...t)=>new V(...t,"gl");be.gl=TL,V.prototype.gl=function(){const t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]},V.prototype.hex=function(t){return E0(this._rgb,t)};const EL=(...t)=>new V(...t,"hex");be.hex=EL,ue.format.hex=T0,ue.autodetect.push({p:4,test:(t,...e)=>{if(!e.length&&ye(t)==="string"&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});const{log:zu}=Math,sT=t=>{const e=t/100;let n,r,i;return e<66?(n=255,r=e<6?0:-155.25485562709179-.44596950469579133*(r=e-2)+104.49216199393888*zu(r),i=e<20?0:-254.76935184120902+.8274096064007395*(i=e-10)+115.67994401066147*zu(i)):(n=351.97690566805693+.114206453784165*(n=e-55)-40.25366309332127*zu(n),r=325.4494125711974+.07943456536662342*(r=e-50)-28.0852963507957*zu(r),i=255),[n,r,i,1]},{round:RL}=Math,SL=(...t)=>{const e=de(t,"rgb"),n=e[0],r=e[2];let i=1e3,s=4e4;const o=.4;let a;for(;s-i>o;){a=(s+i)*.5;const c=sT(a);c[2]/c[0]>=r/n?s=a:i=a}return RL(a)};V.prototype.temp=V.prototype.kelvin=V.prototype.temperature=function(){return SL(this._rgb)};const bg=(...t)=>new V(...t,"temp");Object.assign(be,{temp:bg,kelvin:bg,temperature:bg}),ue.format.temp=ue.format.kelvin=ue.format.temperature=sT,V.prototype.oklch=function(){return H0(this._rgb)};const $L=(...t)=>new V(...t,"oklch");Object.assign(be,{oklch:$L}),ue.format.oklch=K0,ue.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"oklch"),ye(t)==="array"&&t.length===3)return"oklch"}}),Object.assign(be,{analyze:N0,average:kO,bezier:PO,blend:Vn,brewer:uL,Color:V,colors:po,contrast:ZO,contrastAPCA:nL,cubehelix:zO,deltaE:oL,distance:aL,input:ue,interpolate:go,limits:D0,mix:go,random:YO,scale:Uu,scales:lL,valid:cL});const Tg=[.96,.907,.805,.697,.605,.547,.518,.445,.395,.34],oT=[.32,.16,.08,.04,0,0,.04,.08,.16,.32];function kL(t){const e=t.get("hsl.l");return Tg.reduce((n,r)=>Math.abs(r-e)<Math.abs(n-e)?r:n)}function _L(t){const e=be(t),n=kL(e),r=Tg.findIndex(s=>s===n),i=Tg.map(s=>e.set("hsl.l",s)).map(s=>be(s)).map((s,o)=>{const a=oT[o]-oT[r];return a>=0?s.saturate(a):s.desaturate(a*-1)});return{baseColorIndex:r,colors:i}}function CL(t){return _L(t).colors.map(e=>e.hex())}const aT={fill:"#3b82f6",stroke:"#2563eb",hiContrast:"#eff6ff",loContrast:"#bfdbfe"},cT={fill:"#0284c7",stroke:"#0369a1",hiContrast:"#f0f9ff",loContrast:"#B6ECF7"},lT={fill:"#64748b",stroke:"#475569",hiContrast:"#f8fafc",loContrast:"#cbd5e1"},uT={primary:aT,blue:aT,secondary:cT,sky:cT,muted:lT,slate:lT,gray:{fill:"#737373",stroke:"#525252",hiContrast:"#fafafa",loContrast:"#d4d4d4"},red:{fill:"#AC4D39",stroke:"#853A2D",hiContrast:"#FBD3CB",loContrast:"#f5b2a3"},green:{fill:"#428a4f",stroke:"#2d5d39",hiContrast:"#f8fafc",loContrast:"#c2f0c2"},amber:{fill:"#A35829",stroke:"#7E451D",hiContrast:"#FFE0C2",loContrast:"#f9b27c"},indigo:{fill:"#6366f1",stroke:"#4f46e5",hiContrast:"#eef2ff",loContrast:"#c7d2fe"}},AL={lineColor:"#6E6E6E",labelBgColor:"#18191b",labelColor:"#C6C6C6"},dT={lineColor:"#64748b",labelBgColor:"#0f172a",labelColor:"#cbd5e1"},fT={lineColor:"#3b82f6",labelBgColor:"#172554",labelColor:"#60a5fa"},hT={lineColor:"#0ea5e9",labelBgColor:"#082f49",labelColor:"#38bdf8"},pT={amber:{lineColor:"#b45309",labelBgColor:"#78350f",labelColor:"#FFE0C2"},blue:fT,gray:AL,green:{lineColor:"#15803d",labelBgColor:"#052e16",labelColor:"#22c55e"},indigo:{lineColor:"#6366f1",labelBgColor:"#1e1b4b",labelColor:"#818cf8"},muted:dT,primary:fT,red:{lineColor:"#AC4D39",labelBgColor:"#b91c1c",labelColor:"#f5b2a3"},secondary:hT,sky:hT,slate:dT},Pn={elements:uT,relationships:pT,font:"Arial",shadow:"#0a0a0a"};function IL(t){if(t.match(/^#([0-9a-f]{3}){1,2}$/i)){const e=CL(t);return{elements:{fill:e[6],stroke:e[7],hiContrast:e[0],loContrast:e[1]},relationships:{lineColor:e[4],labelColor:e[3],labelBgColor:e[9]}}}else return{elements:Pn.elements.primary,relationships:Pn.relationships.primary}}function Eg(...t){return Nu(Object.values,t)}function Rg(...t){return Nu(xL,t)}var xL=(t,e)=>t.length>=e;function pt(t){return typeof t=="string"}function gT(t){return!!t}function PL(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mT={exports:{}},yT=function(t,e){var n,r,i=1,s=0,o=0,a=String.alphabet;function c(l,u,d){if(d){for(n=u;d=c(l,n),d<76&&d>65;)++n;return+l.slice(u-1,n)}return d=a&&a.indexOf(l.charAt(u)),d>-1?d+76:(d=l.charCodeAt(u)||0,d<45||d>127?d:d<46?65:d<48?d-1:d<58?d+18:d<65?d-11:d<91?d+11:d<97?d-37:d<123?d+5:d-63)}if((t+="")!=(e+="")){for(;i;)if(r=c(t,s++),i=c(e,o++),r<76&&i<76&&r>66&&i>66&&(r=c(t,s,s),i=c(e,o,s=n),o=n),r!=i)return r<i?-1:1}return 0};try{mT.exports=yT}catch{String.naturalCompare=yT}var NL=mT.exports;const DL=PL(NL);function Hu(t,e){return t===e?0:pt(t)?pt(e)?DL(t,e):1:pt(e)?-1:0}function Ku(t){return t!=null&&typeof t=="string"}function ks(t){return!!t&&Array.isArray(t)&&t.length>0}function Oa(t){const e=t.lastIndexOf(".");return e>0?t.slice(e+1):t}function gr(...t){const e=Ku(t[0])?t[0]:t[0].id;return(Ku(t[1])?t[1]:t[1].id).startsWith(e+".")}function Vu(t,e){const n=Ku(t)?t:t.id,r=Ku(e)?e:e.id;return n===r||r.startsWith(n+".")||n.startsWith(r+".")}function vT(t){const e=t.flatMap(n=>[r=>r.id===n.id,r=>gr(n,r)]);return n=>e.some(r=>r(n))}function OL(t){const e=vT(t);return n=>!e(n)}function _s(t,e){const n=Et(t),r=Et(e);if(n===r)return n;if(!n||!r)return null;const i=t.split("."),s=e.split(".");let o=null;for(;i.length>1&&s.length>1&&i[0]&&i[0]===s[0];)o=o?`${o}.${i[0]}`:i[0],i.shift(),s.shift();return o}function Et(t){const e=t.lastIndexOf(".");return e>0?t.slice(0,e):null}function wT(t){const e=t+".";return n=>!!n.parent&&(n.parent===t||n.parent.startsWith(e))}function Xn(t){const e=t.split(".");return e.pop(),e.length===0?[]:e.reduce((n,r,i)=>i===0?(n.push(r),n):(n.unshift(`${n[0]}.${r}`),n),[])}function Eo(t,e){const n=t.split(".").length,r=e.split(".").length;switch(!0){case n>r:return 1;case n<r:return-1;default:return 0}}function Sg(t,e){return Eo(t.id,e.id)}function LL(t){return t.map(e=>({item:e,fqn:e.id.split(".")})).sort((e,n)=>e.fqn.length-n.fqn.length).map(({item:e})=>e)}let Yu=class Pb{constructor(e,n){this.view=e,this.model=n;for(const r of e.nodes){const i=new Pb.Element(r,this);this.#t.set(r.id,i),Na(r.parent)&&this.#e.add(i)}this.#n=new Map(e.edges.map(r=>[r.id,new Pb.Connection(r,this)]))}#e=new Set;#t=new Map;#n;get id(){return this.view.id}get title(){return this.view.title}get viewOf(){return this.view.__!=="dynamic"&&this.view.viewOf?this.model.element(this.view.viewOf):null}get tags(){return this.view.tags??[]}roots(){return[...this.#e]}elements(){return[...this.#t.values()]}element(e){return at(this.#t.get(e),`LikeC4ViewModel.Element ${e} in view ${this.view.id} not found`)}hasElement(e){return this.#t.has(e)}connections(){return[...this.#n.values()]}connection(e){return at(this.#n.get(e),`Connection ${e} in view ${this.view.id} not found`)}findConnections(e,n,r="direct"){const i=pt(e)?e:e.id,s=pt(n)?n:n.id;return this.connections().filter(o=>o.source.id===i&&o.target.id===s||r==="both"&&o.source.id===s&&o.target.id===i)}parent(e){const n=this.element(pt(e)?e:e.id);return n.node.parent?this.element(n.node.parent):null}children(e){return this.element(pt(e)?e:e.id).node.children.map(n=>this.element(n))}siblings(e){const n=pt(e)?e:e.id,r=this.parent(n);return(r?this.children(r):this.roots()).filter(i=>i.id!==n)}ancestors(e){let n=pt(e)?e:e.id;const r=[];let i;for(;i=this.parent(n);)r.push(i),n=i.id;return r}descendants(e){return this.children(e).flatMap(n=>[n,...this.descendants(n.id)])}incoming(e,n="all"){const r=this.element(pt(e)?e:e.id),i=r.node.inEdges.map(s=>at(this.#n.get(s),`Edge ${s} not found`));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.target.id===r.id:s.target.id!==r.id)}incomers(e,n="all"){return this.incoming(e,n).map(r=>r.source)}outgoing(e,n="all"){const r=this.element(pt(e)?e:e.id),i=r.node.outEdges.map(s=>at(this.#n.get(s),`Edge ${s} not found`));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.source.id===r.id:s.source.id!==r.id)}outgoers(e,n="all"){return this.outgoing(e,n).map(r=>r.target)}};(t=>{class e{constructor(i,s){this.node=i,this.viewmodel=s}get id(){return this.node.id}get title(){return this.node.title}get kind(){return this.node.kind}get isRoot(){return Na(this.node.parent)}get hasNested(){return this.node.children.length>0}get shape(){return this.node.shape}get color(){return this.node.color}get tags(){return this.node.tags??[]}model(){return this.viewmodel.model.element(this.id)}parent(){return this.node.parent?this.viewmodel.element(this.node.parent):null}metadata(i,s){return this.model().metadata(i)??s}hasMetadata(i){return this.model().hasMetadata(i)}ancestors(){return this.viewmodel.ancestors(this)}siblings(){return this.viewmodel.siblings(this)}descendants(){return this.viewmodel.descendants(this)}children(){return this.viewmodel.children(this)}incoming(i="all"){return this.viewmodel.incoming(this,i)}incomers(i="all"){return this.viewmodel.incomers(this,i)}outgoing(i="all"){return this.viewmodel.outgoing(this,i)}outgoers(i="all"){return this.viewmodel.outgoers(this,i)}connectionsTo(i){return this.viewmodel.findConnections(this,i)}}t.Element=e;class n{constructor(i,s){this.edge=i,this.viewmodel=s}get id(){return this.edge.id}get source(){return this.viewmodel.element(this.edge.source)}get target(){return this.viewmodel.element(this.edge.target)}get tags(){return this.edge.tags??[]}relationships(){return this.edge.relations.map(i=>at(this.viewmodel.model.relationship(i)))}}t.Connection=n})(Yu||(Yu={}));const $g=Set,kg=Map;let Xu=class Fp{constructor(e){this.computed=e;for(const n of Eg(e.elements))this.addElement(n);for(const n of Eg(e.relations))this.addRelation(n);this.#l=new Map(Eg(e.views).map(n=>[n.id,new Yu(n,this)]))}#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=new Map;#s=new kg;#o=new kg;#a=new kg;#c=new Map;#l;static from(e){return new Fp(e)}roots(){return[...this.#r]}elements(){return[...this.#e.values()]}element(e){return at(this.#e.get(e),`Element ${e} not found`)}relationships(){return[...this.#i.values()]}relationship(e){return at(this.#i.get(e),`Relation ${e} not found`)}views(){return[...this.#l.values()]}view(e){return at(this.#l.get(e),`View ${e} not found`)}parent(e){const n=pt(e)?e:e.id;return this.#t.get(n)||null}children(e){const n=pt(e)?e:e.id;return this._childrenOf(n)}siblings(e){const n=pt(e)?e:e.id,r=this.#t.get(n);return(r?this._childrenOf(r.id):this.roots()).filter(i=>i.id!==n)}ancestors(e){let n=pt(e)?e:e.id;const r=[];let i;for(;i=this.#t.get(n);)r.push(i),n=i.id;return r}descendants(e){const n=pt(e)?e:e.id;return this._childrenOf(n).flatMap(r=>[r,...this.descendants(r.id)])}incoming(e,n="all"){const r=pt(e)?e:e.id,i=Array.from(this._incomingTo(r));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.target.id===r:s.target.id!==r)}incomers(e,n="all"){return this.incoming(e,n).map(r=>r.source)}outgoing(e,n="all"){const r=pt(e)?e:e.id,i=Array.from(this._outgoingFrom(r));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.source.id===r:s.source.id!==r)}outgoers(e,n="all"){return this.outgoing(e,n).map(r=>r.target)}internal(e){const n=pt(e)?e:e.id;return Array.from(this._internalOf(n))}ascendingSiblings(e){const n=pt(e)?e:e.id;let r=this.#c.get(n);return r||(r=[...this.siblings(n),...this.ancestors(n).flatMap(i=>this.siblings(i.id))],this.#c.set(n,r)),r.slice()}viewsWithElement(e){const n=pt(e)?e:e.id;return[...this.#l.values()].filter(r=>r.hasElement(n))}addElement(e){if(this.#e.has(e.id))throw new Error(`Element ${e.id} already exists`);const n=new Fp.Element(e,this);this.#e.set(n.id,n);const r=Et(n.id);r?(this.#t.set(n.id,this.element(r)),this._childrenOf(r).push(n)):this.#r.add(n)}addRelation(e){if(this.#i.has(e.id))throw new Error(`Relation ${e.id} already exists`);const n=new Fp.Relationship(e,this);this.#i.set(n.id,n),this._incomingTo(e.target).add(n),this._outgoingFrom(e.source).add(n);const r=_s(e.source,e.target);if(r)for(const i of[r,...Xn(r)])this._internalOf(i).add(n);for(const i of Xn(e.source)){if(i===r)break;this._outgoingFrom(i).add(n)}for(const i of Xn(e.target)){if(i===r)break;this._incomingTo(i).add(n)}}_childrenOf(e){let n=this.#n.get(e);return n||(n=[],this.#n.set(e,n)),n}_incomingTo(e){let n=this.#s.get(e);return n||(n=new $g,this.#s.set(e,n)),n}_outgoingFrom(e){let n=this.#o.get(e);return n||(n=new $g,this.#o.set(e,n)),n}_internalOf(e){let n=this.#a.get(e);return n||(n=new $g,this.#a.set(e,n)),n}};(t=>{class e{constructor(i,s){this.element=i,this.model=s}get id(){return this.element.id}get title(){return this.element.title}get kind(){return this.element.kind}get isRoot(){return Et(this.element.id)===null}get hasNested(){return this.model.children(this).length>0}get shape(){return this.element.shape??Jb}get color(){return this.element.color??Du}get tags(){return this.element.tags??[]}parent(){return this.model.parent(this)}metadata(i,s){return this.element.metadata?.[i]??s}hasMetadata(i){return gT(this.element.metadata?.[i])}ancestors(){return this.model.ancestors(this)}siblings(){return this.model.siblings(this)}descendants(){return this.model.descendants(this)}children(){return this.model.children(this)}views(){return this.model.viewsWithElement(this)}incoming(i){return this.model.incoming(this,i)}incomers(i){return this.model.incomers(this,i)}outgoing(i){return this.model.outgoing(this,i)}outgoers(i){return this.model.outgoers(this,i)}internal(){return this.model.internal(this)}}t.Element=e;class n{constructor(i,s){this.relationship=i,this.model=s}get id(){return this.relationship.id}get title(){return this.relationship.title}get kind(){return this.relationship.kind??null}get tags(){return this.relationship.tags??[]}get source(){return this.model.element(this.relationship.source)}get target(){return this.model.element(this.relationship.target)}metadata(i,s){return this.relationship.metadata?.[i]??s}hasMetadata(i){return gT(this.relationship.metadata?.[i])}}t.Relationship=n})(Xu||(Xu={}));const ML="LIKEC4_DELAY";function bT(t=100){return new Promise(e=>{setTimeout(()=>{e(ML)},t)})}const La=(t,e)=>{const n=_s(t.source,t.target),r=_s(e.source,e.target);if(n&&!r)return 1;if(!n&&r)return-1;const i=n&&r?Eo(n,r):0;if(i!==0)return i;const s=Eo(t.source,e.source);return s!==0?s:Eo(t.target,e.target)};function ct(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function Nn(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function FL(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function Ju(t){return typeof t=="object"&&t!==null&&ct(t.container)&&Nn(t.reference)&&typeof t.message=="string"}class TT{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,n){return ct(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 Hr(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Cs(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function ET(t){return Hr(t)&&typeof t.fullText=="string"}class kt{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 kt(()=>({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 Ut})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=jL(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 kt(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?Ut:{done:!1,value:e(i)}})}filter(e){return new kt(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return Ut})}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 kt(()=>({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(Qu(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return Ut})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new kt(()=>({this:n.startFn()}),r=>{do{if(r.iterator){const o=r.iterator.next();if(o.done)r.iterator=void 0;else return o}const{done:i,value:s}=n.nextFn(r.this);if(!i)if(Qu(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return Ut})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new kt(()=>{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 kt(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?Ut:this.nextFn(n.state)))}distinct(e){return new kt(()=>({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 Ut})}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 jL(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function Qu(t){return!!t&&typeof t[Symbol.iterator]=="function"}const Ro=new kt(()=>{},()=>Ut),Ut=Object.freeze({done:!0,value:void 0});function Me(...t){if(t.length===1){const e=t[0];if(e instanceof kt)return e;if(Qu(e))return new kt(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new kt(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:Ut)}return t.length>1?new kt(()=>({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++];Qu(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return Ut}):Ro}class So extends kt{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 o=i.iterators[i.iterators.length-1].next();if(o.done)i.iterators.pop();else return i.iterators.push(n(o.value)[Symbol.iterator]()),o}return Ut})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var _g;(function(t){function e(s){return s.reduce((o,a)=>o+a,0)}t.sum=e;function n(s){return s.reduce((o,a)=>o*a,0)}t.product=n;function r(s){return s.reduce((o,a)=>Math.min(o,a))}t.min=r;function i(s){return s.reduce((o,a)=>Math.max(o,a))}t.max=i})(_g||(_g={}));function Ma(t){return new So(t,e=>Hr(e)?e.content:[],{includeRoot:!0})}function RT(t){return Ma(t).filter(Cs)}function ST(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function Zu(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function Fa(t){if(!t)return;const{offset:e,end:n,range:r}=t;return{range:r,offset:e,end:n,length:n-e}}var mr;(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"})(mr||(mr={}));function $T(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<=e.start.character)return mr.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return mr.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?mr.Inside:n?mr.OverlapBack:r?mr.OverlapFront:mr.Outside}function Cg(t,e){return $T(t,e)>mr.After}const Ag=/^[\w\p{L}]$/u;function Ai(t,e,n=Ag){if(t){if(e>0){const r=e-t.offset,i=t.text.charAt(r);n.test(i)||e--}return xg(t,e)}}function ed(t,e){if(t){const n=_T(t,!0);if(n&&Ig(n,e))return n;if(ET(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(Ig(s,e))return s}}}}function Ig(t,e){return Cs(t)&&e.includes(t.tokenType.name)}function xg(t,e){if(Cs(t))return t;if(Hr(t)){const n=kT(t,e,!1);if(n)return xg(n,e)}}function td(t,e){if(Cs(t))return t;if(Hr(t)){const n=kT(t,e,!0);if(n)return td(n,e)}}function kT(t,e,n){let r=0,i=t.content.length-1,s;for(;r<=i;){const o=Math.floor((r+i)/2),a=t.content[o];if(a.offset<=e&&a.end>e)return a;a.end<=e?(s=n?a:void 0,r=o+1):i=o-1}return s}function _T(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 CT(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 UL(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 AT(t,e){const n=BL(t,e);return n?n.parent.content.slice(n.a+1,n.b):[]}function BL(t,e){const n=IT(t),r=IT(e);let i;for(let s=0;s<n.length&&s<r.length;s++){const o=n[s],a=r[s];if(o.parent===a.parent)i={parent:o.parent,a:o.index,b:a.index};else break}return i}function IT(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 qL={__proto__:null,DefaultNameRegexp:Ag,get RangeComparison(){return mr},compareRange:$T,findCommentNode:ed,findDeclarationNodeAtOffset:Ai,findLeafNodeAtOffset:xg,findLeafNodeBeforeOffset:td,flattenCst:RT,getInteriorNodes:AT,getNextNode:CT,getPreviousNode:_T,getStartlineNode:UL,inRange:Cg,isChildNode:ST,isCommentNode:Ig,streamCst:Ma,toDocumentSegment:Fa,tokenToRange:Zu};class xT extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function nd(t){throw new Error("Error! The input value was not handled.")}const rd="AbstractRule",id="AbstractType",Pg="Condition",PT="TypeDefinition",Ng="ValueLiteral",ja="AbstractElement";function Dg(t){return $e.isInstance(t,ja)}const sd="ArrayLiteral",Ua="ArrayType";function WL(t){return $e.isInstance(t,Ua)}const Ba="BooleanLiteral";function GL(t){return $e.isInstance(t,Ba)}const qa="Conjunction";function zL(t){return $e.isInstance(t,qa)}const Wa="Disjunction";function HL(t){return $e.isInstance(t,Wa)}const od="Grammar",Og="GrammarImport",Ga="InferredType";function NT(t){return $e.isInstance(t,Ga)}const za="Interface";function DT(t){return $e.isInstance(t,za)}const Lg="NamedArgument",Ha="Negation";function KL(t){return $e.isInstance(t,Ha)}const ad="NumberLiteral",cd="Parameter",Ka="ParameterReference";function VL(t){return $e.isInstance(t,Ka)}const Va="ParserRule";function Bt(t){return $e.isInstance(t,Va)}const Ya="ReferenceType";function YL(t){return $e.isInstance(t,Ya)}const ld="ReturnType";function XL(t){return $e.isInstance(t,ld)}const Xa="SimpleType";function OT(t){return $e.isInstance(t,Xa)}const ud="StringLiteral",$o="TerminalRule";function Kr(t){return $e.isInstance(t,$o)}const Ja="Type";function Mg(t){return $e.isInstance(t,Ja)}const Fg="TypeAttribute",Qa="UnionType";function JL(t){return $e.isInstance(t,Qa)}const Za="Action";function As(t){return $e.isInstance(t,Za)}const ec="Alternatives";function jg(t){return $e.isInstance(t,ec)}const tc="Assignment";function yr(t){return $e.isInstance(t,tc)}const nc="CharacterRange";function QL(t){return $e.isInstance(t,nc)}const rc="CrossReference";function ic(t){return $e.isInstance(t,rc)}const sc="EndOfFile";function ZL(t){return $e.isInstance(t,sc)}const oc="Group";function Ii(t){return $e.isInstance(t,oc)}const ac="Keyword";function vr(t){return $e.isInstance(t,ac)}const cc="NegatedToken";function eM(t){return $e.isInstance(t,cc)}const lc="RegexToken";function tM(t){return $e.isInstance(t,lc)}const uc="RuleCall";function Vr(t){return $e.isInstance(t,uc)}const dc="TerminalAlternatives";function nM(t){return $e.isInstance(t,dc)}const fc="TerminalGroup";function rM(t){return $e.isInstance(t,fc)}const hc="TerminalRuleCall";function LT(t){return $e.isInstance(t,hc)}const pc="UnorderedGroup";function Ug(t){return $e.isInstance(t,pc)}const gc="UntilToken";function iM(t){return $e.isInstance(t,gc)}const mc="Wildcard";function sM(t){return $e.isInstance(t,mc)}class MT extends TT{getAllTypes(){return[ja,rd,id,Za,ec,sd,Ua,tc,Ba,nc,Pg,qa,rc,Wa,sc,od,Og,oc,Ga,za,ac,Lg,cc,Ha,ad,cd,Ka,Va,Ya,lc,ld,uc,Xa,ud,dc,fc,$o,hc,Ja,Fg,PT,Qa,pc,gc,Ng,mc]}computeIsSubtype(e,n){switch(e){case Za:case ec:case tc:case nc:case rc:case sc:case oc:case ac:case cc:case lc:case uc:case dc:case fc:case hc:case pc:case gc:case mc:return this.isSubtype(ja,n);case sd:case ad:case ud:return this.isSubtype(Ng,n);case Ua:case Ya:case Xa:case Qa:return this.isSubtype(PT,n);case Ba:return this.isSubtype(Pg,n)||this.isSubtype(Ng,n);case qa:case Wa:case Ha:case Ka:return this.isSubtype(Pg,n);case Ga:case za:case Ja:return this.isSubtype(id,n);case Va:return this.isSubtype(rd,n)||this.isSubtype(id,n);case $o: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 id;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return rd;case"Grammar:usedGrammars":return od;case"NamedArgument:parameter":case"ParameterReference:parameter":return cd;case"TerminalRuleCall:rule":return $o;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case ja:return{name:ja,properties:[{name:"cardinality"},{name:"lookahead"}]};case sd:return{name:sd,properties:[{name:"elements",defaultValue:[]}]};case Ua:return{name:Ua,properties:[{name:"elementType"}]};case Ba:return{name:Ba,properties:[{name:"true",defaultValue:!1}]};case qa:return{name:qa,properties:[{name:"left"},{name:"right"}]};case Wa:return{name:Wa,properties:[{name:"left"},{name:"right"}]};case od:return{name:od,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 Og:return{name:Og,properties:[{name:"path"}]};case Ga:return{name:Ga,properties:[{name:"name"}]};case za:return{name:za,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case Lg:return{name:Lg,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case Ha:return{name:Ha,properties:[{name:"value"}]};case ad:return{name:ad,properties:[{name:"value"}]};case cd:return{name:cd,properties:[{name:"name"}]};case Ka:return{name:Ka,properties:[{name:"parameter"}]};case Va:return{name:Va,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 Ya:return{name:Ya,properties:[{name:"referenceType"}]};case ld:return{name:ld,properties:[{name:"name"}]};case Xa:return{name:Xa,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case ud:return{name:ud,properties:[{name:"value"}]};case $o:return{name:$o,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case Ja:return{name:Ja,properties:[{name:"name"},{name:"type"}]};case Fg:return{name:Fg,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case Qa:return{name:Qa,properties:[{name:"types",defaultValue:[]}]};case Za:return{name:Za,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case ec:return{name:ec,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case tc:return{name:tc,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case nc:return{name:nc,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case rc:return{name:rc,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case sc:return{name:sc,properties:[{name:"cardinality"},{name:"lookahead"}]};case oc:return{name:oc,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case ac:return{name:ac,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case cc:return{name:cc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case lc:return{name:lc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case uc:return{name:uc,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case dc:return{name:dc,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case fc:return{name:fc,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case hc:return{name:hc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case pc:return{name:pc,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case gc:return{name:gc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case mc:return{name:mc,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const $e=new MT;function Bg(t){for(const[e,n]of Object.entries(t))e.startsWith("$")||(Array.isArray(n)?n.forEach((r,i)=>{ct(r)&&(r.$container=t,r.$containerProperty=e,r.$containerIndex=i)}):ct(n)&&(n.$container=t,n.$containerProperty=e))}function an(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function qg(t,e){let n=t;for(;n;){if(e(n))return!0;n=n.$container}return!1}function Yt(t){const n=dd(t).$document;if(!n)throw new Error("AST node has no document.");return n}function dd(t){for(;t.$container;)t=t.$container;return t}function yc(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e?.range;return new kt(()=>({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(ct(s)){if(r.keyIndex++,Wg(s,n))return{done:!1,value:s}}else if(Array.isArray(s)){for(;r.arrayIndex<s.length;){const o=r.arrayIndex++,a=s[o];if(ct(a)&&Wg(a,n))return{done:!1,value:a}}r.arrayIndex=0}}r.keyIndex++}return Ut})}function wr(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new So(t,n=>yc(n,e))}function Yr(t,e){if(t){if(e?.range&&!Wg(t,e.range))return new So(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new So(t,n=>yc(n,e),{includeRoot:!0})}function Wg(t,e){var n;if(!e)return!0;const r=(n=t.$cstNode)===null||n===void 0?void 0:n.range;return r?Cg(r,e):!1}function fd(t){return new kt(()=>({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(Nn(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(Nn(s))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return Ut})}function oM(t,e=Yt(t).parseResult.value){const n=[];return Yr(e).forEach(r=>{fd(r).forEach(i=>{i.reference.ref===t&&n.push(i.reference)})}),Me(n)}function Gg(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]=FT(i.defaultValue))}function FT(t){return Array.isArray(t)?[...t.map(FT)]:t}function zg(t,e){const n={$type:t.$type};for(const[r,i]of Object.entries(t))if(!r.startsWith("$"))if(ct(i))n[r]=zg(i,e);else if(Nn(i))n[r]=e(n,r,i.$refNode,i.$refText);else if(Array.isArray(i)){const s=[];for(const o of i)ct(o)?s.push(zg(o,e)):Nn(o)?s.push(e(n,r,o.$refNode,o.$refText)):s.push(o);n[r]=s}else n[r]=i;return Bg(n),n}const hd={__proto__:null,assignMandatoryProperties:Gg,copyAstNode:zg,findLocalReferences:oM,findRootNode:dd,getContainerOfType:an,getDocument:Yt,hasContainerOfType:qg,linkContentToContainer:Bg,streamAllContents:wr,streamAst:Yr,streamContents:yc,streamReferences:fd};function ae(t){return t.charCodeAt(0)}function Hg(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function vc(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function ko(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function aM(){throw Error("Internal Error - Should never get here!")}function jT(t){return t.type==="Character"}const pd=[];for(let t=ae("0");t<=ae("9");t++)pd.push(t);const gd=[ae("_")].concat(pd);for(let t=ae("a");t<=ae("z");t++)gd.push(t);for(let t=ae("A");t<=ae("Z");t++)gd.push(t);const UT=[ae(" "),ae("\f"),ae(`
2
+ `),ae("\r"),ae(" "),ae("\v"),ae(" "),ae("\xA0"),ae("\u1680"),ae("\u2000"),ae("\u2001"),ae("\u2002"),ae("\u2003"),ae("\u2004"),ae("\u2005"),ae("\u2006"),ae("\u2007"),ae("\u2008"),ae("\u2009"),ae("\u200A"),ae("\u2028"),ae("\u2029"),ae("\u202F"),ae("\u205F"),ae("\u3000"),ae("\uFEFF")],cM=/[0-9a-fA-F]/,md=/[0-9]/,lM=/[1-9]/;class BT{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":vc(r,"global");break;case"i":vc(r,"ignoreCase");break;case"m":vc(r,"multiLine");break;case"u":vc(r,"unicode");break;case"y":vc(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}ko(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return aM()}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;ko(n);break}if(!(e===!0&&n===void 0)&&ko(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()),ko(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[ae(`
3
+ `),ae("\r"),ae("\u2028"),ae("\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=pd;break;case"D":e=pd,n=!0;break;case"s":e=UT;break;case"S":e=UT,n=!0;break;case"w":e=gd;break;case"W":e=gd,n=!0;break}if(ko(e))return{type:"Set",value:e,complement:n}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=ae("\f");break;case"n":e=ae(`
4
+ `);break;case"r":e=ae("\r");break;case"t":e=ae(" ");break;case"v":e=ae("\v");break}if(ko(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:ae("\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:ae(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
5
+ `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:ae(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,jT(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,jT(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else Hg(r.value,e),e.push(ae("-")),Hg(i.value,e)}else Hg(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
6
+ `: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:ae("\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(lM.test(e)===!1)throw Error("Expecting a positive integer");for(;md.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(md.test(e)===!1)throw Error("Expecting an integer");for(;md.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
7
+ `: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:ae(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 md.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
8
+ `: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`
9
+ `: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(cM.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 yd{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 qT=/\r?\n/gm,uM=new BT;class dM extends yd{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===`
10
+ `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=vd(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=!!`
11
+ `.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 Kg=new dM;function fM(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Kg.reset(t),Kg.visit(uM.pattern(t)),Kg.multiline}catch{return!1}}const hM=`\f
12
+ \r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function Vg(t){const e=typeof t=="string"?new RegExp(t):t;return hM.some(n=>e.test(n))}function vd(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pM(t){return Array.prototype.map.call(t,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:vd(e)).join("")}function gM(t,e){const n=mM(t),r=e.match(n);return!!r&&r[0].length>0}function mM(t){typeof t=="string"&&(t=new RegExp(t));const e=t,n=t.source;let r=0;function i(){let s="",o;function a(l){s+=n.substr(r,l),r+=l}function c(l){s+="(?:"+n.substr(r,l)+"|$)",r+=l}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"[":o=/\[(?:\\.|.)*?\]/g,o.lastIndex=r,o=o.exec(n)||[],c(o[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":o=/\{\d+,?\d*\}/g,o.lastIndex=r,o=o.exec(n),o?a(o[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"!":o=r,r+=3,i(),s+=n.substr(o,r-o);break;case"<":switch(n[r+3]){case"=":case"!":o=r,r+=4,i(),s+=n.substr(o,r-o);break;default:a(n.indexOf(">",r)-r+1),s+=i()+"|$)";break}break}else a(1),s+=i()+"|$)";break;case")":return++r,s;default:c(1);break}return s}return new RegExp(i(),t.flags)}function wd(t){return t.rules.find(e=>Bt(e)&&e.entry)}function WT(t){return t.rules.filter(e=>Kr(e)&&e.hidden)}function Yg(t,e){const n=new Set,r=wd(t);if(!r)return new Set(t.rules);const i=[r].concat(WT(t));for(const o of i)GT(o,n,e);const s=new Set;for(const o of t.rules)(n.has(o.name)||Kr(o)&&o.hidden)&&s.add(o);return s}function GT(t,e,n){e.add(t.name),wr(t).forEach(r=>{if(Vr(r)||n&&LT(r)){const i=r.rule.ref;i&&!e.has(i.name)&&GT(i,e,n)}})}function Xg(t){if(t.terminal)return t.terminal;if(t.type.ref){const e=em(t.type.ref);return e?.terminal}}function zT(t){return t.hidden&&!Vg(Tc(t))}function _o(t,e){return!t||!e?[]:Jg(t,e,t.astNode,!0)}function bn(t,e,n){if(!t||!e)return;const r=Jg(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 Jg(t,e,n,r){if(!r){const i=an(t.grammarSource,yr);if(i&&i.feature===e)return[t]}return Hr(t)&&t.astNode===n?t.content.flatMap(i=>Jg(i,e,n,!1)):[]}function Qg(t,e){return t?Zg(t,e,t?.astNode):[]}function wc(t,e,n){if(!t)return;const r=Zg(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 Zg(t,e,n){if(t.astNode!==n)return[];if(vr(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=Ma(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const o=i.value;o.astNode===n?vr(o.grammarSource)&&o.grammarSource.value===e&&s.push(o):r.prune()}while(!i.done);return s}function HT(t){var e;const n=t.astNode;for(;n===((e=t.container)===null||e===void 0?void 0:e.astNode);){const r=an(t.grammarSource,yr);if(r)return r;t=t.container}}function em(t){let e=t;return NT(e)&&(As(e.$container)?e=e.$container.$container:Bt(e.$container)?e=e.$container:nd(e.$container)),KT(t,e,new Map)}function KT(t,e,n){var r;function i(s,o){let a;return an(s,yr)||(a=KT(o,o,n)),n.set(t,a),a}if(n.has(t))return n.get(t);n.set(t,void 0);for(const s of wr(e)){if(yr(s)&&s.feature.toLowerCase()==="name")return n.set(t,s),s;if(Vr(s)&&Bt(s.rule.ref))return i(s,s.rule.ref);if(OT(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function VT(t){const e=t.$container;if(Ii(e)){const n=e.elements,r=n.indexOf(t);for(let i=r-1;i>=0;i--){const s=n[i];if(As(s))return s;{const o=wr(n[i]).find(As);if(o)return o}}}if(Dg(e))return VT(e)}function Co(t,e){return t==="?"||t==="*"||Ii(e)&&!!e.guardCondition}function YT(t){return t==="*"||t==="+"}function yM(t){return t==="+="}function bd(t){return XT(t,new Set)}function XT(t,e){if(e.has(t))return!0;e.add(t);for(const n of wr(t))if(Vr(n)){if(!n.rule.ref||Bt(n.rule.ref)&&!XT(n.rule.ref,e))return!1}else{if(yr(n))return!1;if(As(n))return!1}return!!t.definition}function vM(t){return tm(t.type,new Set)}function tm(t,e){if(e.has(t))return!0;if(e.add(t),WL(t))return!1;if(YL(t))return!1;if(JL(t))return t.types.every(n=>tm(n,e));if(OT(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 Mg(n)?tm(n.type,e):!1}else return!1}else return!1}function Is(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(Bt(e))return e.name;if(DT(e)||Mg(e))return e.name}}}function bc(t){var e;if(Bt(t))return bd(t)?t.name:(e=Is(t))!==null&&e!==void 0?e:t.name;if(DT(t)||Mg(t)||XL(t))return t.name;if(As(t)){const n=JT(t);if(n)return n}else if(NT(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function JT(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return bc(t.type.ref)}function wM(t){var e,n,r;return Kr(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":bd(t)?t.name:(r=Is(t))!==null&&r!==void 0?r:t.name}function QT(t){var e,n,r;return Kr(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":(r=Is(t))!==null&&r!==void 0?r:t.name}function Tc(t){const e={s:!1,i:!1,u:!1},n=Ao(t.definition,e),r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}const nm=/[\s\S]/.source;function Ao(t,e){if(nM(t))return bM(t);if(rM(t))return TM(t);if(QL(t))return SM(t);if(LT(t)){const n=t.rule.ref;if(!n)throw new Error("Missing rule reference.");return Xr(Ao(n.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(eM(t))return RM(t);if(iM(t))return EM(t);if(tM(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")),Xr(r,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(sM(t))return Xr(nm,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function bM(t){return Xr(t.elements.map(e=>Ao(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function TM(t){return Xr(t.elements.map(e=>Ao(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function EM(t){return Xr(`${nm}*?${Ao(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function RM(t){return Xr(`(?!${Ao(t.terminal)})${nm}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function SM(t){return t.right?Xr(`[${rm(t.left)}-${rm(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):Xr(rm(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function rm(t){return vd(t.value)}function Xr(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 Td={__proto__:null,findAssignment:HT,findNameAssignment:em,findNodeForKeyword:wc,findNodeForProperty:bn,findNodesForKeyword:Qg,findNodesForKeywordInternal:Zg,findNodesForProperty:_o,getActionAtElement:VT,getActionType:JT,getAllReachableRules:Yg,getCrossReferenceTerminal:Xg,getEntryRule:wd,getExplicitRuleType:Is,getHiddenRules:WT,getRuleType:QT,getRuleTypeName:wM,getTypeName:bc,isArrayCardinality:YT,isArrayOperator:yM,isCommentTerminal:zT,isDataType:vM,isDataTypeRule:bd,isOptionalCardinality:Co,terminalRegex:Tc};function $M(t){const e=[],n=t.Grammar;for(const r of n.rules)Kr(r)&&zT(r)&&fM(Tc(r))&&e.push(r.name);return{multilineCommentRules:e,nameRegexp:Ag}}var ZT=typeof global=="object"&&global&&global.Object===Object&&global,kM=typeof self=="object"&&self&&self.Object===Object&&self,br=ZT||kM||Function("return this")(),Dn=br.Symbol,eE=Object.prototype,_M=eE.hasOwnProperty,CM=eE.toString,Ec=Dn?Dn.toStringTag:void 0;function AM(t){var e=_M.call(t,Ec),n=t[Ec];try{t[Ec]=void 0;var r=!0}catch{}var i=CM.call(t);return r&&(e?t[Ec]=n:delete t[Ec]),i}var IM=Object.prototype,xM=IM.toString;function PM(t){return xM.call(t)}var NM="[object Null]",DM="[object Undefined]",tE=Dn?Dn.toStringTag:void 0;function xi(t){return t==null?t===void 0?DM:NM:tE&&tE in Object(t)?AM(t):PM(t)}function Jn(t){return t!=null&&typeof t=="object"}var OM="[object Symbol]";function Rc(t){return typeof t=="symbol"||Jn(t)&&xi(t)==OM}function Ed(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 ke=Array.isArray,LM=1/0,nE=Dn?Dn.prototype:void 0,rE=nE?nE.toString:void 0;function iE(t){if(typeof t=="string")return t;if(ke(t))return Ed(t,iE)+"";if(Rc(t))return rE?rE.call(t):"";var e=t+"";return e=="0"&&1/t==-LM?"-0":e}var MM=/\s/;function FM(t){for(var e=t.length;e--&&MM.test(t.charAt(e)););return e}var jM=/^\s+/;function UM(t){return t&&t.slice(0,FM(t)+1).replace(jM,"")}function On(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var sE=NaN,BM=/^[-+]0x[0-9a-f]+$/i,qM=/^0b[01]+$/i,WM=/^0o[0-7]+$/i,GM=parseInt;function zM(t){if(typeof t=="number")return t;if(Rc(t))return sE;if(On(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=On(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=UM(t);var n=qM.test(t);return n||WM.test(t)?GM(t.slice(2),n?2:8):BM.test(t)?sE:+t}var oE=1/0,HM=17976931348623157e292;function KM(t){if(!t)return t===0?t:0;if(t=zM(t),t===oE||t===-oE){var e=t<0?-1:1;return e*HM}return t===t?t:0}function Rd(t){var e=KM(t),n=e%1;return e===e?n?e-n:e:0}function xs(t){return t}var VM="[object AsyncFunction]",YM="[object Function]",XM="[object GeneratorFunction]",JM="[object Proxy]";function Jr(t){if(!On(t))return!1;var e=xi(t);return e==YM||e==XM||e==VM||e==JM}var im=br["__core-js_shared__"],aE=function(){var t=/[^.]+$/.exec(im&&im.keys&&im.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function QM(t){return!!aE&&aE in t}var ZM=Function.prototype,e2=ZM.toString;function Ps(t){if(t!=null){try{return e2.call(t)}catch{}try{return t+""}catch{}}return""}var t2=/[\\^$.*+?()[\]{}|]/g,n2=/^\[object .+?Constructor\]$/,r2=Function.prototype,i2=Object.prototype,s2=r2.toString,o2=i2.hasOwnProperty,a2=RegExp("^"+s2.call(o2).replace(t2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function c2(t){if(!On(t)||QM(t))return!1;var e=Jr(t)?a2:n2;return e.test(Ps(t))}function l2(t,e){return t?.[e]}function Ns(t,e){var n=l2(t,e);return c2(n)?n:void 0}var sm=Ns(br,"WeakMap"),cE=Object.create,u2=function(){function t(){}return function(e){if(!On(e))return{};if(cE)return cE(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function d2(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 Ct(){}function f2(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var h2=800,p2=16,g2=Date.now;function m2(t){var e=0,n=0;return function(){var r=g2(),i=p2-(r-n);if(n=r,i>0){if(++e>=h2)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function y2(t){return function(){return t}}var Sd=function(){try{var t=Ns(Object,"defineProperty");return t({},"",{}),t}catch{}}(),v2=Sd?function(t,e){return Sd(t,"toString",{configurable:!0,enumerable:!1,value:y2(e),writable:!0})}:xs,w2=m2(v2);function lE(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function uE(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 b2(t){return t!==t}function T2(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function om(t,e,n){return e===e?T2(t,e,n):uE(t,b2,n)}function dE(t,e){var n=t==null?0:t.length;return!!n&&om(t,e,0)>-1}var E2=9007199254740991,R2=/^(?:0|[1-9]\d*)$/;function $d(t,e){var n=typeof t;return e=e??E2,!!e&&(n=="number"||n!="symbol"&&R2.test(t))&&t>-1&&t%1==0&&t<e}function am(t,e,n){e=="__proto__"&&Sd?Sd(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Sc(t,e){return t===e||t!==t&&e!==e}var S2=Object.prototype,$2=S2.hasOwnProperty;function kd(t,e,n){var r=t[e];(!($2.call(t,e)&&Sc(r,n))||n===void 0&&!(e in t))&&am(t,e,n)}function cm(t,e,n,r){var i=!n;n||(n={});for(var s=-1,o=e.length;++s<o;){var a=e[s],c=void 0;c===void 0&&(c=t[a]),i?am(n,a,c):kd(n,a,c)}return n}var fE=Math.max;function k2(t,e,n){return e=fE(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=fE(r.length-e,0),o=Array(s);++i<s;)o[i]=r[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=r[i];return a[e]=n(o),d2(t,this,a)}}function lm(t,e){return w2(k2(t,e,xs),t+"")}var _2=9007199254740991;function um(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=_2}function Tr(t){return t!=null&&um(t.length)&&!Jr(t)}function hE(t,e,n){if(!On(n))return!1;var r=typeof e;return(r=="number"?Tr(n)&&$d(e,n.length):r=="string"&&e in n)?Sc(n[e],t):!1}function C2(t){return lm(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,o&&hE(n[0],n[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var a=n[r];a&&t(e,a,r,s)}return e})}var A2=Object.prototype;function $c(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||A2;return t===n}function I2(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var x2="[object Arguments]";function pE(t){return Jn(t)&&xi(t)==x2}var gE=Object.prototype,P2=gE.hasOwnProperty,N2=gE.propertyIsEnumerable,_d=pE(function(){return arguments}())?pE:function(t){return Jn(t)&&P2.call(t,"callee")&&!N2.call(t,"callee")},gt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Io(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function D2(){return!1}var mE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yE=mE&&typeof module=="object"&&module&&!module.nodeType&&module,O2=yE&&yE.exports===mE,vE=O2?br.Buffer:void 0,L2=vE?vE.isBuffer:void 0,kc=L2||D2,M2="[object Arguments]",F2="[object Array]",j2="[object Boolean]",U2="[object Date]",B2="[object Error]",q2="[object Function]",W2="[object Map]",G2="[object Number]",z2="[object Object]",H2="[object RegExp]",K2="[object Set]",V2="[object String]",Y2="[object WeakMap]",X2="[object ArrayBuffer]",J2="[object DataView]",Q2="[object Float32Array]",Z2="[object Float64Array]",eF="[object Int8Array]",tF="[object Int16Array]",nF="[object Int32Array]",rF="[object Uint8Array]",iF="[object Uint8ClampedArray]",sF="[object Uint16Array]",oF="[object Uint32Array]",Ve={};Ve[Q2]=Ve[Z2]=Ve[eF]=Ve[tF]=Ve[nF]=Ve[rF]=Ve[iF]=Ve[sF]=Ve[oF]=!0,Ve[M2]=Ve[F2]=Ve[X2]=Ve[j2]=Ve[J2]=Ve[U2]=Ve[B2]=Ve[q2]=Ve[W2]=Ve[G2]=Ve[z2]=Ve[H2]=Ve[K2]=Ve[V2]=Ve[Y2]=!1;function aF(t){return Jn(t)&&um(t.length)&&!!Ve[xi(t)]}function Cd(t){return function(e){return t(e)}}var wE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_c=wE&&typeof module=="object"&&module&&!module.nodeType&&module,cF=_c&&_c.exports===wE,dm=cF&&ZT.process,Pi=function(){try{var t=_c&&_c.require&&_c.require("util").types;return t||dm&&dm.binding&&dm.binding("util")}catch{}}(),bE=Pi&&Pi.isTypedArray,fm=bE?Cd(bE):aF,lF=Object.prototype,uF=lF.hasOwnProperty;function TE(t,e){var n=ke(t),r=!n&&_d(t),i=!n&&!r&&kc(t),s=!n&&!r&&!i&&fm(t),o=n||r||i||s,a=o?I2(t.length,String):[],c=a.length;for(var l in t)(e||uF.call(t,l))&&!(o&&(l=="length"||i&&(l=="offset"||l=="parent")||s&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||$d(l,c)))&&a.push(l);return a}function EE(t,e){return function(n){return t(e(n))}}var dF=EE(Object.keys,Object),fF=Object.prototype,hF=fF.hasOwnProperty;function RE(t){if(!$c(t))return dF(t);var e=[];for(var n in Object(t))hF.call(t,n)&&n!="constructor"&&e.push(n);return e}function Ln(t){return Tr(t)?TE(t):RE(t)}var pF=Object.prototype,gF=pF.hasOwnProperty,Tn=C2(function(t,e){if($c(e)||Tr(e)){cm(e,Ln(e),t);return}for(var n in e)gF.call(e,n)&&kd(t,n,e[n])});function mF(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var yF=Object.prototype,vF=yF.hasOwnProperty;function wF(t){if(!On(t))return mF(t);var e=$c(t),n=[];for(var r in t)r=="constructor"&&(e||!vF.call(t,r))||n.push(r);return n}function SE(t){return Tr(t)?TE(t,!0):wF(t)}var bF=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,TF=/^\w*$/;function hm(t,e){if(ke(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Rc(t)?!0:TF.test(t)||!bF.test(t)||e!=null&&t in Object(e)}var Cc=Ns(Object,"create");function EF(){this.__data__=Cc?Cc(null):{},this.size=0}function RF(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var SF="__lodash_hash_undefined__",$F=Object.prototype,kF=$F.hasOwnProperty;function _F(t){var e=this.__data__;if(Cc){var n=e[t];return n===SF?void 0:n}return kF.call(e,t)?e[t]:void 0}var CF=Object.prototype,AF=CF.hasOwnProperty;function IF(t){var e=this.__data__;return Cc?e[t]!==void 0:AF.call(e,t)}var xF="__lodash_hash_undefined__";function PF(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Cc&&e===void 0?xF:e,this}function Ds(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])}}Ds.prototype.clear=EF,Ds.prototype.delete=RF,Ds.prototype.get=_F,Ds.prototype.has=IF,Ds.prototype.set=PF;function NF(){this.__data__=[],this.size=0}function Ad(t,e){for(var n=t.length;n--;)if(Sc(t[n][0],e))return n;return-1}var DF=Array.prototype,OF=DF.splice;function LF(t){var e=this.__data__,n=Ad(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():OF.call(e,n,1),--this.size,!0}function MF(t){var e=this.__data__,n=Ad(e,t);return n<0?void 0:e[n][1]}function FF(t){return Ad(this.__data__,t)>-1}function jF(t,e){var n=this.__data__,r=Ad(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function Qr(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])}}Qr.prototype.clear=NF,Qr.prototype.delete=LF,Qr.prototype.get=MF,Qr.prototype.has=FF,Qr.prototype.set=jF;var Ac=Ns(br,"Map");function UF(){this.size=0,this.__data__={hash:new Ds,map:new(Ac||Qr),string:new Ds}}function BF(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Id(t,e){var n=t.__data__;return BF(e)?n[typeof e=="string"?"string":"hash"]:n.map}function qF(t){var e=Id(this,t).delete(t);return this.size-=e?1:0,e}function WF(t){return Id(this,t).get(t)}function GF(t){return Id(this,t).has(t)}function zF(t,e){var n=Id(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function Zr(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])}}Zr.prototype.clear=UF,Zr.prototype.delete=qF,Zr.prototype.get=WF,Zr.prototype.has=GF,Zr.prototype.set=zF;var HF="Expected a function";function pm(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(HF);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 o=t.apply(this,r);return n.cache=s.set(i,o)||s,o};return n.cache=new(pm.Cache||Zr),n}pm.Cache=Zr;var KF=500;function VF(t){var e=pm(t,function(r){return n.size===KF&&n.clear(),r}),n=e.cache;return e}var YF=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,XF=/\\(\\)?/g,JF=VF(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(YF,function(n,r,i,s){e.push(i?s.replace(XF,"$1"):r||n)}),e});function QF(t){return t==null?"":iE(t)}function xd(t,e){return ke(t)?t:hm(t,e)?[t]:JF(QF(t))}var ZF=1/0;function Ic(t){if(typeof t=="string"||Rc(t))return t;var e=t+"";return e=="0"&&1/t==-ZF?"-0":e}function gm(t,e){e=xd(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Ic(e[n++])];return n&&n==r?t:void 0}function ej(t,e,n){var r=t==null?void 0:gm(t,e);return r===void 0?n:r}function mm(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var $E=Dn?Dn.isConcatSpreadable:void 0;function tj(t){return ke(t)||_d(t)||!!($E&&t&&t[$E])}function ym(t,e,n,r,i){var s=-1,o=t.length;for(n||(n=tj),i||(i=[]);++s<o;){var a=t[s];n(a)?mm(i,a):r||(i[i.length]=a)}return i}function Mn(t){var e=t==null?0:t.length;return e?ym(t):[]}var kE=EE(Object.getPrototypeOf,Object);function _E(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 nj(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 rj(){this.__data__=new Qr,this.size=0}function ij(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function sj(t){return this.__data__.get(t)}function oj(t){return this.__data__.has(t)}var aj=200;function cj(t,e){var n=this.__data__;if(n instanceof Qr){var r=n.__data__;if(!Ac||r.length<aj-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Zr(r)}return n.set(t,e),this.size=n.size,this}function Er(t){var e=this.__data__=new Qr(t);this.size=e.size}Er.prototype.clear=rj,Er.prototype.delete=ij,Er.prototype.get=sj,Er.prototype.has=oj,Er.prototype.set=cj;function lj(t,e){return t&&cm(e,Ln(e),t)}var CE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,AE=CE&&typeof module=="object"&&module&&!module.nodeType&&module,uj=AE&&AE.exports===CE,IE=uj?br.Buffer:void 0,xE=IE?IE.allocUnsafe:void 0;function dj(t,e){var n=t.length,r=xE?xE(n):new t.constructor(n);return t.copy(r),r}function vm(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}function PE(){return[]}var fj=Object.prototype,hj=fj.propertyIsEnumerable,NE=Object.getOwnPropertySymbols,wm=NE?function(t){return t==null?[]:(t=Object(t),vm(NE(t),function(e){return hj.call(t,e)}))}:PE;function pj(t,e){return cm(t,wm(t),e)}var gj=Object.getOwnPropertySymbols,mj=gj?function(t){for(var e=[];t;)mm(e,wm(t)),t=kE(t);return e}:PE;function DE(t,e,n){var r=e(t);return ke(t)?r:mm(r,n(t))}function bm(t){return DE(t,Ln,wm)}function yj(t){return DE(t,SE,mj)}var Tm=Ns(br,"DataView"),Em=Ns(br,"Promise"),xo=Ns(br,"Set"),OE="[object Map]",vj="[object Object]",LE="[object Promise]",ME="[object Set]",FE="[object WeakMap]",jE="[object DataView]",wj=Ps(Tm),bj=Ps(Ac),Tj=Ps(Em),Ej=Ps(xo),Rj=Ps(sm),Fn=xi;(Tm&&Fn(new Tm(new ArrayBuffer(1)))!=jE||Ac&&Fn(new Ac)!=OE||Em&&Fn(Em.resolve())!=LE||xo&&Fn(new xo)!=ME||sm&&Fn(new sm)!=FE)&&(Fn=function(t){var e=xi(t),n=e==vj?t.constructor:void 0,r=n?Ps(n):"";if(r)switch(r){case wj:return jE;case bj:return OE;case Tj:return LE;case Ej:return ME;case Rj:return FE}return e});var Sj=Object.prototype,$j=Sj.hasOwnProperty;function kj(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&$j.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Pd=br.Uint8Array;function _j(t){var e=new t.constructor(t.byteLength);return new Pd(e).set(new Pd(t)),e}function Cj(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var Aj=/\w*$/;function Ij(t){var e=new t.constructor(t.source,Aj.exec(t));return e.lastIndex=t.lastIndex,e}var UE=Dn?Dn.prototype:void 0,BE=UE?UE.valueOf:void 0;function xj(t){return BE?Object(BE.call(t)):{}}function Pj(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var Nj="[object Boolean]",Dj="[object Date]",Oj="[object Map]",Lj="[object Number]",Mj="[object RegExp]",Fj="[object Set]",jj="[object String]",Uj="[object Symbol]",Bj="[object ArrayBuffer]",qj="[object DataView]",Wj="[object Float32Array]",Gj="[object Float64Array]",zj="[object Int8Array]",Hj="[object Int16Array]",Kj="[object Int32Array]",Vj="[object Uint8Array]",Yj="[object Uint8ClampedArray]",Xj="[object Uint16Array]",Jj="[object Uint32Array]";function Qj(t,e,n){var r=t.constructor;switch(e){case Bj:return _j(t);case Nj:case Dj:return new r(+t);case qj:return Cj(t);case Wj:case Gj:case zj:case Hj:case Kj:case Vj:case Yj:case Xj:case Jj:return Pj(t);case Oj:return new r;case Lj:case jj:return new r(t);case Mj:return Ij(t);case Fj:return new r;case Uj:return xj(t)}}function Zj(t){return typeof t.constructor=="function"&&!$c(t)?u2(kE(t)):{}}var e3="[object Map]";function t3(t){return Jn(t)&&Fn(t)==e3}var qE=Pi&&Pi.isMap,n3=qE?Cd(qE):t3,r3="[object Set]";function i3(t){return Jn(t)&&Fn(t)==r3}var WE=Pi&&Pi.isSet,s3=WE?Cd(WE):i3,GE="[object Arguments]",o3="[object Array]",a3="[object Boolean]",c3="[object Date]",l3="[object Error]",zE="[object Function]",u3="[object GeneratorFunction]",d3="[object Map]",f3="[object Number]",HE="[object Object]",h3="[object RegExp]",p3="[object Set]",g3="[object String]",m3="[object Symbol]",y3="[object WeakMap]",v3="[object ArrayBuffer]",w3="[object DataView]",b3="[object Float32Array]",T3="[object Float64Array]",E3="[object Int8Array]",R3="[object Int16Array]",S3="[object Int32Array]",$3="[object Uint8Array]",k3="[object Uint8ClampedArray]",_3="[object Uint16Array]",C3="[object Uint32Array]",ze={};ze[GE]=ze[o3]=ze[v3]=ze[w3]=ze[a3]=ze[c3]=ze[b3]=ze[T3]=ze[E3]=ze[R3]=ze[S3]=ze[d3]=ze[f3]=ze[HE]=ze[h3]=ze[p3]=ze[g3]=ze[m3]=ze[$3]=ze[k3]=ze[_3]=ze[C3]=!0,ze[l3]=ze[zE]=ze[y3]=!1;function Nd(t,e,n,r,i,s){var o;if(o!==void 0)return o;if(!On(t))return t;var a=ke(t);if(a)return o=kj(t),f2(t,o);var c=Fn(t),l=c==zE||c==u3;if(kc(t))return dj(t);if(c==HE||c==GE||l&&!i)return o=l?{}:Zj(t),pj(t,lj(o,t));if(!ze[c])return i?t:{};o=Qj(t,c),s||(s=new Er);var u=s.get(t);if(u)return u;s.set(t,o),s3(t)?t.forEach(function(h){o.add(Nd(h,e,n,h,t,s))}):n3(t)&&t.forEach(function(h,p){o.set(p,Nd(h,e,n,p,t,s))});var d=bm,f=a?void 0:d(t);return lE(f||t,function(h,p){f&&(p=h,h=t[p]),kd(o,p,Nd(h,e,n,p,t,s))}),o}var A3=4;function Ot(t){return Nd(t,A3)}function xc(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 I3="__lodash_hash_undefined__";function x3(t){return this.__data__.set(t,I3),this}function P3(t){return this.__data__.has(t)}function Po(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Zr;++e<n;)this.add(t[e])}Po.prototype.add=Po.prototype.push=x3,Po.prototype.has=P3;function KE(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 Rm(t,e){return t.has(e)}var N3=1,D3=2;function VE(t,e,n,r,i,s){var o=n&N3,a=t.length,c=e.length;if(a!=c&&!(o&&c>a))return!1;var l=s.get(t),u=s.get(e);if(l&&u)return l==e&&u==t;var d=-1,f=!0,h=n&D3?new Po:void 0;for(s.set(t,e),s.set(e,t);++d<a;){var p=t[d],y=e[d];if(r)var R=o?r(y,p,d,e,t,s):r(p,y,d,t,e,s);if(R!==void 0){if(R)continue;f=!1;break}if(h){if(!KE(e,function(b,v){if(!Rm(h,v)&&(p===b||i(p,b,n,r,s)))return h.push(v)})){f=!1;break}}else if(!(p===y||i(p,y,n,r,s))){f=!1;break}}return s.delete(t),s.delete(e),f}function O3(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function Sm(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var L3=1,M3=2,F3="[object Boolean]",j3="[object Date]",U3="[object Error]",B3="[object Map]",q3="[object Number]",W3="[object RegExp]",G3="[object Set]",z3="[object String]",H3="[object Symbol]",K3="[object ArrayBuffer]",V3="[object DataView]",YE=Dn?Dn.prototype:void 0,$m=YE?YE.valueOf:void 0;function Y3(t,e,n,r,i,s,o){switch(n){case V3:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case K3:return!(t.byteLength!=e.byteLength||!s(new Pd(t),new Pd(e)));case F3:case j3:case q3:return Sc(+t,+e);case U3:return t.name==e.name&&t.message==e.message;case W3:case z3:return t==e+"";case B3:var a=O3;case G3:var c=r&L3;if(a||(a=Sm),t.size!=e.size&&!c)return!1;var l=o.get(t);if(l)return l==e;r|=M3,o.set(t,e);var u=VE(a(t),a(e),r,i,s,o);return o.delete(t),u;case H3:if($m)return $m.call(t)==$m.call(e)}return!1}var X3=1,J3=Object.prototype,Q3=J3.hasOwnProperty;function Z3(t,e,n,r,i,s){var o=n&X3,a=bm(t),c=a.length,l=bm(e),u=l.length;if(c!=u&&!o)return!1;for(var d=c;d--;){var f=a[d];if(!(o?f in e:Q3.call(e,f)))return!1}var h=s.get(t),p=s.get(e);if(h&&p)return h==e&&p==t;var y=!0;s.set(t,e),s.set(e,t);for(var R=o;++d<c;){f=a[d];var b=t[f],v=e[f];if(r)var T=o?r(v,b,f,e,t,s):r(b,v,f,t,e,s);if(!(T===void 0?b===v||i(b,v,n,r,s):T)){y=!1;break}R||(R=f=="constructor")}if(y&&!R){var _=t.constructor,N=e.constructor;_!=N&&"constructor"in t&&"constructor"in e&&!(typeof _=="function"&&_ instanceof _&&typeof N=="function"&&N instanceof N)&&(y=!1)}return s.delete(t),s.delete(e),y}var eU=1,XE="[object Arguments]",JE="[object Array]",Dd="[object Object]",tU=Object.prototype,QE=tU.hasOwnProperty;function nU(t,e,n,r,i,s){var o=ke(t),a=ke(e),c=o?JE:Fn(t),l=a?JE:Fn(e);c=c==XE?Dd:c,l=l==XE?Dd:l;var u=c==Dd,d=l==Dd,f=c==l;if(f&&kc(t)){if(!kc(e))return!1;o=!0,u=!1}if(f&&!u)return s||(s=new Er),o||fm(t)?VE(t,e,n,r,i,s):Y3(t,e,c,n,r,i,s);if(!(n&eU)){var h=u&&QE.call(t,"__wrapped__"),p=d&&QE.call(e,"__wrapped__");if(h||p){var y=h?t.value():t,R=p?e.value():e;return s||(s=new Er),i(y,R,n,r,s)}}return f?(s||(s=new Er),Z3(t,e,n,r,i,s)):!1}function km(t,e,n,r,i){return t===e?!0:t==null||e==null||!Jn(t)&&!Jn(e)?t!==t&&e!==e:nU(t,e,n,r,km,i)}var rU=1,iU=2;function sU(t,e,n,r){var i=n.length,s=i;if(t==null)return!s;for(t=Object(t);i--;){var o=n[i];if(o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++i<s;){o=n[i];var a=o[0],c=t[a],l=o[1];if(o[2]){if(c===void 0&&!(a in t))return!1}else{var u=new Er,d;if(!(d===void 0?km(l,c,rU|iU,r,u):d))return!1}}return!0}function ZE(t){return t===t&&!On(t)}function oU(t){for(var e=Ln(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,ZE(i)]}return e}function eR(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function aU(t){var e=oU(t);return e.length==1&&e[0][2]?eR(e[0][0],e[0][1]):function(n){return n===t||sU(n,t,e)}}function cU(t,e){return t!=null&&e in Object(t)}function tR(t,e,n){e=xd(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var o=Ic(e[r]);if(!(s=t!=null&&n(t,o)))break;t=t[o]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&um(i)&&$d(o,i)&&(ke(t)||_d(t)))}function lU(t,e){return t!=null&&tR(t,e,cU)}var uU=1,dU=2;function fU(t,e){return hm(t)&&ZE(e)?eR(Ic(t),e):function(n){var r=ej(n,t);return r===void 0&&r===e?lU(n,t):km(e,r,uU|dU)}}function hU(t){return function(e){return e?.[t]}}function pU(t){return function(e){return gm(e,t)}}function gU(t){return hm(t)?hU(Ic(t)):pU(t)}function Qn(t){return typeof t=="function"?t:t==null?xs:typeof t=="object"?ke(t)?fU(t[0],t[1]):aU(t):gU(t)}function mU(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++i<s;){var o=t[i];e(r,o,n(o),t)}return r}function yU(t){return function(e,n,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var c=o[++i];if(n(s[c],c,s)===!1)break}return e}}var vU=yU();function wU(t,e){return t&&vU(t,e,Ln)}function bU(t,e){return function(n,r){if(n==null)return n;if(!Tr(n))return t(n,r);for(var i=n.length,s=-1,o=Object(n);++s<i&&r(o[s],s,o)!==!1;);return n}}var Os=bU(wU);function TU(t,e,n,r){return Os(t,function(i,s,o){e(r,i,n(i),o)}),r}function EU(t,e){return function(n,r){var i=ke(n)?mU:TU,s=e?e():{};return i(n,t,Qn(r),s)}}var nR=Object.prototype,RU=nR.hasOwnProperty,_m=lm(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&hE(e[0],e[1],i)&&(r=1);++n<r;)for(var s=e[n],o=SE(s),a=-1,c=o.length;++a<c;){var l=o[a],u=t[l];(u===void 0||Sc(u,nR[l])&&!RU.call(t,l))&&(t[l]=s[l])}return t});function rR(t){return Jn(t)&&Tr(t)}var SU=200;function $U(t,e,n,r){var i=-1,s=dE,o=!0,a=t.length,c=[],l=e.length;if(!a)return c;e.length>=SU&&(s=Rm,o=!1,e=new Po(e));e:for(;++i<a;){var u=t[i],d=u;if(u=u!==0?u:0,o&&d===d){for(var f=l;f--;)if(e[f]===d)continue e;c.push(u)}else s(e,d,r)||c.push(u)}return c}var Od=lm(function(t,e){return rR(t)?$U(t,ym(e,1,rR,!0)):[]});function No(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function Lt(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:Rd(e),_E(t,e<0?0:e,r)):[]}function Pc(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:Rd(e),e=r-e,_E(t,0,e<0?0:e)):[]}function kU(t){return typeof t=="function"?t:xs}function se(t,e){var n=ke(t)?lE:Os;return n(t,kU(e))}function _U(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 CU(t,e){var n=!0;return Os(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function Zn(t,e,n){var r=ke(t)?_U:CU;return r(t,Qn(e))}function iR(t,e){var n=[];return Os(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}function En(t,e){var n=ke(t)?vm:iR;return n(t,Qn(e))}function AU(t){return function(e,n,r){var i=Object(e);if(!Tr(e)){var s=Qn(n);e=Ln(e),n=function(a){return s(i[a],a,i)}}var o=t(e,n,r);return o>-1?i[s?e[o]:o]:void 0}}var IU=Math.max;function xU(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:Rd(n);return i<0&&(i=IU(r+i,0)),uE(t,Qn(e),i)}var Do=AU(xU);function er(t){return t&&t.length?t[0]:void 0}function PU(t,e){var n=-1,r=Tr(t)?Array(t.length):[];return Os(t,function(i,s,o){r[++n]=e(i,s,o)}),r}function Z(t,e){var n=ke(t)?Ed:PU;return n(t,Qn(e))}function Rn(t,e){return ym(Z(t,e))}var NU=Object.prototype,DU=NU.hasOwnProperty,OU=EU(function(t,e,n){DU.call(t,n)?t[n].push(e):am(t,n,[e])}),LU=Object.prototype,MU=LU.hasOwnProperty;function FU(t,e){return t!=null&&MU.call(t,e)}function oe(t,e){return t!=null&&tR(t,e,FU)}var jU="[object String]";function cn(t){return typeof t=="string"||!ke(t)&&Jn(t)&&xi(t)==jU}function UU(t,e){return Ed(e,function(n){return t[n]})}function At(t){return t==null?[]:UU(t,Ln(t))}var BU=Math.max;function Xt(t,e,n,r){t=Tr(t)?t:At(t),n=n&&!r?Rd(n):0;var i=t.length;return n<0&&(n=BU(i+n,0)),cn(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&om(t,e,n)>-1}function sR(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return om(t,e,i)}var qU="[object Map]",WU="[object Set]",GU=Object.prototype,zU=GU.hasOwnProperty;function qe(t){if(t==null)return!0;if(Tr(t)&&(ke(t)||typeof t=="string"||typeof t.splice=="function"||kc(t)||fm(t)||_d(t)))return!t.length;var e=Fn(t);if(e==qU||e==WU)return!t.size;if($c(t))return!RE(t).length;for(var n in t)if(zU.call(t,n))return!1;return!0}var HU="[object RegExp]";function KU(t){return Jn(t)&&xi(t)==HU}var oR=Pi&&Pi.isRegExp,ei=oR?Cd(oR):KU;function ti(t){return t===void 0}function VU(t,e){return t<e}function YU(t,e,n){for(var r=-1,i=t.length;++r<i;){var s=t[r],o=e(s);if(o!=null&&(a===void 0?o===o&&!Rc(o):n(o,a)))var a=o,c=s}return c}function XU(t){return t&&t.length?YU(t,xs,VU):void 0}var JU="Expected a function";function QU(t){if(typeof t!="function")throw new TypeError(JU);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 ZU(t,e,n,r){if(!On(t))return t;e=xd(e,t);for(var i=-1,s=e.length,o=s-1,a=t;a!=null&&++i<s;){var c=Ic(e[i]),l=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=o){var u=a[c];l=void 0,l===void 0&&(l=On(u)?u:$d(e[i+1])?[]:{})}kd(a,c,l),a=a[c]}return t}function eB(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var o=e[r],a=gm(t,o);n(a,o)&&ZU(s,xd(o,t),a)}return s}function tr(t,e){if(t==null)return{};var n=Ed(yj(t),function(r){return[r]});return e=Qn(e),eB(t,n,function(r,i){return e(r,i[0])})}function tB(t,e,n,r,i){return i(t,function(s,o,a){n=r?(r=!1,s):e(n,s,o,a)}),n}function Jt(t,e,n){var r=ke(t)?nj:tB,i=arguments.length<3;return r(t,Qn(e),n,i,Os)}function Ld(t,e){var n=ke(t)?vm:iR;return n(t,QU(Qn(e)))}function nB(t,e){var n;return Os(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function aR(t,e,n){var r=ke(t)?KE:nB;return r(t,Qn(e))}var rB=1/0,iB=xo&&1/Sm(new xo([,-0]))[1]==rB?function(t){return new xo(t)}:Ct,sB=200;function cR(t,e,n){var r=-1,i=dE,s=t.length,o=!0,a=[],c=a;if(s>=sB){var l=e?null:iB(t);if(l)return Sm(l);o=!1,i=Rm,c=new Po}else c=e?[]:a;e:for(;++r<s;){var u=t[r],d=e?e(u):u;if(u=u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue e;e&&c.push(d),a.push(u)}else i(c,d,n)||(c!==a&&c.push(d),a.push(u))}return a}function Cm(t){return t&&t.length?cR(t):[]}function oB(t,e){return t&&t.length?cR(t,Qn(e)):[]}function Am(t){console&&console.error&&console.error(`Error: ${t}`)}function lR(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function uR(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function dR(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),t}function aB(t){return cB(t)?t.LABEL:t.name}function cB(t){return cn(t.LABEL)&&t.LABEL!==""}class Rr{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),se(this.definition,n=>{n.accept(e)})}}class Qt extends Rr{constructor(e){super([]),this.idx=1,Tn(this,tr(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Oo extends Rr{constructor(e){super(e.definition),this.orgText="",Tn(this,tr(e,n=>n!==void 0))}}class ln extends Rr{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Tn(this,tr(e,n=>n!==void 0))}}class Mt extends Rr{constructor(e){super(e.definition),this.idx=1,Tn(this,tr(e,n=>n!==void 0))}}class Sn extends Rr{constructor(e){super(e.definition),this.idx=1,Tn(this,tr(e,n=>n!==void 0))}}class $n extends Rr{constructor(e){super(e.definition),this.idx=1,Tn(this,tr(e,n=>n!==void 0))}}class lt extends Rr{constructor(e){super(e.definition),this.idx=1,Tn(this,tr(e,n=>n!==void 0))}}class un extends Rr{constructor(e){super(e.definition),this.idx=1,Tn(this,tr(e,n=>n!==void 0))}}class dn extends Rr{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,Tn(this,tr(e,n=>n!==void 0))}}class Ye{constructor(e){this.idx=1,Tn(this,tr(e,n=>n!==void 0))}accept(e){e.visit(this)}}function lB(t){return Z(t,Md)}function Md(t){function e(n){return Z(n,Md)}if(t instanceof Qt){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return cn(t.label)&&(n.label=t.label),n}else{if(t instanceof ln)return{type:"Alternative",definition:e(t.definition)};if(t instanceof Mt)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Sn)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof $n)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Md(new Ye({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof un)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Md(new Ye({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof lt)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof dn)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof Ye){const n={type:"Terminal",name:t.terminalType.name,label:aB(t.terminalType),idx:t.idx};cn(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=ei(r)?r.source:r),n}else{if(t instanceof Oo)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class Lo{visit(e){const n=e;switch(n.constructor){case Qt:return this.visitNonTerminal(n);case ln:return this.visitAlternative(n);case Mt:return this.visitOption(n);case Sn:return this.visitRepetitionMandatory(n);case $n:return this.visitRepetitionMandatoryWithSeparator(n);case un:return this.visitRepetitionWithSeparator(n);case lt:return this.visitRepetition(n);case dn:return this.visitAlternation(n);case Ye:return this.visitTerminal(n);case Oo: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 uB(t){return t instanceof ln||t instanceof Mt||t instanceof lt||t instanceof Sn||t instanceof $n||t instanceof un||t instanceof Ye||t instanceof Oo}function Fd(t,e=[]){return t instanceof Mt||t instanceof lt||t instanceof un?!0:t instanceof dn?aR(t.definition,r=>Fd(r,e)):t instanceof Qt&&Xt(e,t)?!1:t instanceof Rr?(t instanceof Qt&&e.push(t),Zn(t.definition,r=>Fd(r,e))):!1}function dB(t){return t instanceof dn}function Sr(t){if(t instanceof Qt)return"SUBRULE";if(t instanceof Mt)return"OPTION";if(t instanceof dn)return"OR";if(t instanceof Sn)return"AT_LEAST_ONE";if(t instanceof $n)return"AT_LEAST_ONE_SEP";if(t instanceof un)return"MANY_SEP";if(t instanceof lt)return"MANY";if(t instanceof Ye)return"CONSUME";throw Error("non exhaustive match")}class jd{walk(e,n=[]){se(e.definition,(r,i)=>{const s=Lt(e.definition,i+1);if(r instanceof Qt)this.walkProdRef(r,s,n);else if(r instanceof Ye)this.walkTerminal(r,s,n);else if(r instanceof ln)this.walkFlat(r,s,n);else if(r instanceof Mt)this.walkOption(r,s,n);else if(r instanceof Sn)this.walkAtLeastOne(r,s,n);else if(r instanceof $n)this.walkAtLeastOneSep(r,s,n);else if(r instanceof un)this.walkManySep(r,s,n);else if(r instanceof lt)this.walkMany(r,s,n);else if(r instanceof dn)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 Mt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=fR(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new Mt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=fR(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);se(e.definition,s=>{const o=new ln({definition:[s]});this.walk(o,i)})}}function fR(t,e,n){return[new Mt({definition:[new Ye({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function Nc(t){if(t instanceof Qt)return Nc(t.referencedRule);if(t instanceof Ye)return pB(t);if(uB(t))return fB(t);if(dB(t))return hB(t);throw Error("non exhaustive match")}function fB(t){let e=[];const n=t.definition;let r=0,i=n.length>r,s,o=!0;for(;i&&o;)s=n[r],o=Fd(s),e=e.concat(Nc(s)),r=r+1,i=n.length>r;return Cm(e)}function hB(t){const e=Z(t.definition,n=>Nc(n));return Cm(Mn(e))}function pB(t){return[t.terminalType]}const hR="_~IN~_";class gB extends jd{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=yB(e.referencedRule,e.idx)+this.topProd.name,s=n.concat(r),o=new ln({definition:s}),a=Nc(o);this.follows[i]=a}}function mB(t){const e={};return se(t,n=>{const r=new gB(n).startWalking();Tn(e,r)}),e}function yB(t,e){return t.name+e+hR}let Ud={};const vB=new BT;function Bd(t){const e=t.toString();if(Ud.hasOwnProperty(e))return Ud[e];{const n=vB.pattern(e);return Ud[e]=n,n}}function wB(){Ud={}}const pR="Complement Sets are not supported for first char optimization",qd=`Unable to use "first char" lexer optimizations:
13
+ `;function bB(t,e=!1){try{const n=Bd(t);return Im(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===pR)e&&lR(`${qd} Unable to optimize: < ${t.toString()} >
14
+ Complement Sets cannot be automatically optimized.
15
+ This will disable the lexer's first char optimizations.
16
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
17
+ This will disable the lexer's first char optimizations.
18
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Am(`${qd}
19
+ Failed parsing: < ${t.toString()} >
20
+ Using the @chevrotain/regexp-to-ast library
21
+ Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function Im(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Im(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 o=s;switch(o.type){case"Character":Wd(o.value,e,n);break;case"Set":if(o.complement===!0)throw Error(pR);se(o.value,c=>{if(typeof c=="number")Wd(c,e,n);else{const l=c;if(n===!0)for(let u=l.from;u<=l.to;u++)Wd(u,e,n);else{for(let u=l.from;u<=l.to&&u<Oc;u++)Wd(u,e,n);if(l.to>=Oc){const u=l.from>=Oc?l.from:Oc,d=l.to,f=Ni(u),h=Ni(d);for(let p=f;p<=h;p++)e[p]=p}}}});break;case"Group":Im(o.value,e,n);break;default:throw Error("Non Exhaustive Match")}const a=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type==="Group"&&xm(o)===!1||o.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return At(e)}function Wd(t,e,n){const r=Ni(t);e[r]=r,n===!0&&TB(t,e)}function TB(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=Ni(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=Ni(i.charCodeAt(0));e[s]=s}}}function gR(t,e){return Do(t.value,n=>{if(typeof n=="number")return Xt(e,n);{const r=n;return Do(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function xm(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?ke(t.value)?Zn(t.value,xm):xm(t.value):!1}class EB extends yd{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){Xt(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?gR(e,this.targetCharCodes)===void 0&&(this.found=!0):gR(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function Pm(t,e){if(e instanceof RegExp){const n=Bd(e),r=new EB(t);return r.visit(n),r.found}else return Do(e,n=>Xt(t,n.charCodeAt(0)))!==void 0}const Ls="PATTERN",Dc="defaultMode",Gd="modes";let mR=typeof new RegExp("(?:)").sticky=="boolean";function RB(t,e){e=_m(e,{useSticky:mR,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
22
+ `],tracer:(v,T)=>T()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{HB()});let r;n("Reject Lexer.NA",()=>{r=Ld(t,v=>v[Ls]===fn.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=Z(r,v=>{const T=v[Ls];if(ei(T)){const _=T.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!T.ignoreCase?_:_.length===2&&_[0]==="\\"&&!Xt(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:e.useSticky?vR(T):yR(T)}else{if(Jr(T))return i=!0,{exec:T};if(typeof T=="object")return i=!0,T;if(typeof T=="string"){if(T.length===1)return T;{const _=T.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),N=new RegExp(_);return e.useSticky?vR(N):yR(N)}}else throw Error("non exhaustive match")}})});let o,a,c,l,u;n("misc mapping",()=>{o=Z(r,v=>v.tokenTypeIdx),a=Z(r,v=>{const T=v.GROUP;if(T!==fn.SKIPPED){if(cn(T))return T;if(ti(T))return!1;throw Error("non exhaustive match")}}),c=Z(r,v=>{const T=v.LONGER_ALT;if(T)return ke(T)?Z(T,N=>sR(r,N)):[sR(r,T)]}),l=Z(r,v=>v.PUSH_MODE),u=Z(r,v=>oe(v,"POP_MODE"))});let d;n("Line Terminator Handling",()=>{const v=TR(e.lineTerminatorCharacters);d=Z(r,T=>!1),e.positionTracking!=="onlyOffset"&&(d=Z(r,T=>oe(T,"LINE_BREAKS")?!!T.LINE_BREAKS:bR(T,v)===!1&&Pm(v,T.PATTERN)))});let f,h,p,y;n("Misc Mapping #2",()=>{f=Z(r,wR),h=Z(s,WB),p=Jt(r,(v,T)=>{const _=T.GROUP;return cn(_)&&_!==fn.SKIPPED&&(v[_]=[]),v},{}),y=Z(s,(v,T)=>({pattern:s[T],longerAlt:c[T],canLineTerminator:d[T],isCustom:f[T],short:h[T],group:a[T],push:l[T],pop:u[T],tokenTypeIdx:o[T],tokenType:r[T]}))});let R=!0,b=[];return e.safeMode||n("First Char Optimization",()=>{b=Jt(r,(v,T,_)=>{if(typeof T.PATTERN=="string"){const N=T.PATTERN.charCodeAt(0),F=Ni(N);Nm(v,F,y[_])}else if(ke(T.START_CHARS_HINT)){let N;se(T.START_CHARS_HINT,F=>{const x=typeof F=="string"?F.charCodeAt(0):F,G=Ni(x);N!==G&&(N=G,Nm(v,G,y[_]))})}else if(ei(T.PATTERN))if(T.PATTERN.unicode)R=!1,e.ensureOptimizations&&Am(`${qd} Unable to analyze < ${T.PATTERN.toString()} > pattern.
23
+ The regexp unicode flag is not currently supported by the regexp-to-ast library.
24
+ This will disable the lexer's first char optimizations.
25
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const N=bB(T.PATTERN,e.ensureOptimizations);qe(N)&&(R=!1),se(N,F=>{Nm(v,F,y[_])})}else e.ensureOptimizations&&Am(`${qd} TokenType: <${T.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
26
+ This will disable the lexer's first char optimizations.
27
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),R=!1;return v},[])}),{emptyGroups:p,patternIdxToConfig:y,charCodeToPatternIdxToConfig:b,hasCustom:i,canBeOptimized:R}}function SB(t,e){let n=[];const r=kB(t);n=n.concat(r.errors);const i=_B(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat($B(s)),n=n.concat(OB(s)),n=n.concat(LB(s,e)),n=n.concat(MB(s)),n}function $B(t){let e=[];const n=En(t,r=>ei(r[Ls]));return e=e.concat(AB(n)),e=e.concat(PB(n)),e=e.concat(NB(n)),e=e.concat(DB(n)),e=e.concat(IB(n)),e}function kB(t){const e=En(t,i=>!oe(i,Ls)),n=Z(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:ut.MISSING_PATTERN,tokenTypes:[i]})),r=Od(t,e);return{errors:n,valid:r}}function _B(t){const e=En(t,i=>{const s=i[Ls];return!ei(s)&&!Jr(s)&&!oe(s,"exec")&&!cn(s)}),n=Z(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:ut.INVALID_PATTERN,tokenTypes:[i]})),r=Od(t,e);return{errors:n,valid:r}}const CB=/[^\\][$]/;function AB(t){class e extends yd{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=En(t,i=>{const s=i.PATTERN;try{const o=Bd(s),a=new e;return a.visit(o),a.found}catch{return CB.test(s.source)}});return Z(n,i=>({message:`Unexpected RegExp Anchor Error:
28
+ Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
29
+ See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ut.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function IB(t){const e=En(t,r=>r.PATTERN.test(""));return Z(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:ut.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const xB=/[^\\[][\^]|^\^/;function PB(t){class e extends yd{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=En(t,i=>{const s=i.PATTERN;try{const o=Bd(s),a=new e;return a.visit(o),a.found}catch{return xB.test(s.source)}});return Z(n,i=>({message:`Unexpected RegExp Anchor Error:
30
+ Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
31
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ut.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function NB(t){const e=En(t,r=>{const i=r[Ls];return i instanceof RegExp&&(i.multiline||i.global)});return Z(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:ut.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function DB(t){const e=[];let n=Z(t,s=>Jt(t,(o,a)=>(s.PATTERN.source===a.PATTERN.source&&!Xt(e,a)&&a.PATTERN!==fn.NA&&(e.push(a),o.push(a)),o),[]));n=xc(n);const r=En(n,s=>s.length>1);return Z(r,s=>{const o=Z(s,c=>c.name);return{message:`The same RegExp pattern ->${er(s).PATTERN}<-has been used in all of the following Token Types: ${o.join(", ")} <-`,type:ut.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function OB(t){const e=En(t,r=>{if(!oe(r,"GROUP"))return!1;const i=r.GROUP;return i!==fn.SKIPPED&&i!==fn.NA&&!cn(i)});return Z(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:ut.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function LB(t,e){const n=En(t,i=>i.PUSH_MODE!==void 0&&!Xt(e,i.PUSH_MODE));return Z(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:ut.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function MB(t){const e=[],n=Jt(t,(r,i,s)=>{const o=i.PATTERN;return o===fn.NA||(cn(o)?r.push({str:o,idx:s,tokenType:i}):ei(o)&&jB(o)&&r.push({str:o.source,idx:s,tokenType:i})),r},[]);return se(t,(r,i)=>{se(n,({str:s,idx:o,tokenType:a})=>{if(i<o&&FB(s,r.PATTERN)){const c=`Token: ->${a.name}<- can never be matched.
32
+ Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
33
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:ut.UNREACHABLE_PATTERN,tokenTypes:[r,a]})}})}),e}function FB(t,e){if(ei(e)){const n=e.exec(t);return n!==null&&n.index===0}else{if(Jr(e))return e(t,0,[],{});if(oe(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function jB(t){return Do([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function yR(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function vR(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function UB(t,e,n){const r=[];return oe(t,Dc)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Dc+`> property in its definition
34
+ `,type:ut.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),oe(t,Gd)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Gd+`> property in its definition
35
+ `,type:ut.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),oe(t,Gd)&&oe(t,Dc)&&!oe(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Dc}: <${t.defaultMode}>which does not exist
36
+ `,type:ut.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),oe(t,Gd)&&se(t.modes,(i,s)=>{se(i,(o,a)=>{if(ti(o))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${a}>
37
+ `,type:ut.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(oe(o,"LONGER_ALT")){const c=ke(o.LONGER_ALT)?o.LONGER_ALT:[o.LONGER_ALT];se(c,l=>{!ti(l)&&!Xt(i,l)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${l.name}> on token <${o.name}> outside of mode <${s}>
38
+ `,type:ut.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function BB(t,e,n){const r=[];let i=!1;const s=xc(Mn(At(t.modes))),o=Ld(s,c=>c[Ls]===fn.NA),a=TR(n);return e&&se(o,c=>{const l=bR(c,a);if(l!==!1){const d={message:zB(c,l),type:l.issue,tokenType:c};r.push(d)}else oe(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):Pm(a,c.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
39
+ This Lexer has been defined to track line and column information,
40
+ But none of the Token Types can be identified as matching a line terminator.
41
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
42
+ for details.`,type:ut.NO_LINE_BREAKS_FLAGS}),r}function qB(t){const e={},n=Ln(t);return se(n,r=>{const i=t[r];if(ke(i))e[r]=[];else throw Error("non exhaustive match")}),e}function wR(t){const e=t.PATTERN;if(ei(e))return!1;if(Jr(e))return!0;if(oe(e,"exec"))return!0;if(cn(e))return!1;throw Error("non exhaustive match")}function WB(t){return cn(t)&&t.length===1?t.charCodeAt(0):!1}const GB={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 bR(t,e){if(oe(t,"LINE_BREAKS"))return!1;if(ei(t.PATTERN)){try{Pm(e,t.PATTERN)}catch(n){return{issue:ut.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(cn(t.PATTERN))return!1;if(wR(t))return{issue:ut.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function zB(t,e){if(e.issue===ut.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
43
+ The problem is in the <${t.name}> Token Type
44
+ Root cause: ${e.errMsg}.
45
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===ut.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
46
+ The problem is in the <${t.name}> Token Type
47
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function TR(t){return Z(t,n=>cn(n)?n.charCodeAt(0):n)}function Nm(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const Oc=256;let zd=[];function Ni(t){return t<Oc?t:zd[t]}function HB(){if(qe(zd)){zd=new Array(65536);for(let t=0;t<65536;t++)zd[t]=t>255?255+~~(t/255):t}}function Lc(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function Hd(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let ER=1;const RR={};function Mc(t){const e=KB(t);VB(e),XB(e),YB(e),se(e,n=>{n.isParent=n.categoryMatches.length>0})}function KB(t){let e=Ot(t),n=t,r=!0;for(;r;){n=xc(Mn(Z(n,s=>s.CATEGORIES)));const i=Od(n,e);e=e.concat(i),qe(i)?r=!1:n=i}return e}function VB(t){se(t,e=>{$R(e)||(RR[ER]=e,e.tokenTypeIdx=ER++),kR(e)&&!ke(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),kR(e)||(e.CATEGORIES=[]),JB(e)||(e.categoryMatches=[]),QB(e)||(e.categoryMatchesMap={})})}function YB(t){se(t,e=>{e.categoryMatches=[],se(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(RR[r].tokenTypeIdx)})})}function XB(t){se(t,e=>{SR([],e)})}function SR(t,e){se(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),se(e.CATEGORIES,n=>{const r=t.concat(e);Xt(r,n)||SR(r,n)})}function $R(t){return oe(t,"tokenTypeIdx")}function kR(t){return oe(t,"CATEGORIES")}function JB(t){return oe(t,"categoryMatches")}function QB(t){return oe(t,"categoryMatchesMap")}function ZB(t){return oe(t,"tokenTypeIdx")}const e4={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 ut;(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"})(ut||(ut={}));const Fc={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
48
+ `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:e4,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Fc);class fn{constructor(e,n=Fc){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 o=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${o}--> <${i}>`);const{time:a,value:c}=uR(s),l=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&l(`${o}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,c}else return s()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
49
+ a boolean 2nd argument is no longer supported`);this.config=Tn({},Fc,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===Fc.lineTerminatorsPattern)this.config.lineTerminatorsPattern=GB;else if(this.config.lineTerminatorCharacters===Fc.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
50
+ 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),ke(e)?i={modes:{defaultMode:Ot(e)},defaultMode:Dc}:(s=!1,i=Ot(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(UB(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(BB(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},se(i.modes,(a,c)=>{i.modes[c]=Ld(a,l=>ti(l))});const o=Ln(i.modes);if(se(i.modes,(a,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(SB(a,o))}),qe(this.lexerDefinitionErrors)){Mc(a);let l;this.TRACE_INIT("analyzeTokenTypes",()=>{l=RB(a,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=l.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=l.charCodeToPatternIdxToConfig,this.emptyGroups=Tn({},this.emptyGroups,l.emptyGroups),this.hasCustom=l.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=l.canBeOptimized}})}),this.defaultMode=i.defaultMode,!qe(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const c=Z(this.lexerDefinitionErrors,l=>l.message).join(`-----------------------
51
+ `);throw new Error(`Errors detected in definition of Lexer:
52
+ `+c)}se(this.lexerDefinitionWarning,a=>{lR(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(mR?(this.chopInput=xs,this.match=this.matchWithTest):(this.updateLastIndex=Ct,this.match=this.matchWithExec),s&&(this.handleModes=Ct),this.trackStartLines===!1&&(this.computeNewColumn=xs),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Ct),/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 a=Jt(this.canModeBeOptimized,(c,l,u)=>(l===!1&&c.push(u),c),[]);if(n.ensureOptimizations&&!qe(a))throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
53
+ Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
54
+ Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{wB()}),this.TRACE_INIT("toFastProperties",()=>{dR(this)})})}tokenize(e,n=this.defaultMode){if(!qe(this.lexerDefinitionErrors)){const i=Z(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
55
+ `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
56
+ `+i)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,s,o,a,c,l,u,d,f,h,p,y,R,b;const v=e,T=v.length;let _=0,N=0;const F=this.hasCustom?0:Math.floor(e.length/10),x=new Array(F),G=[];let B=this.trackStartLines?1:void 0,W=this.trackStartLines?1:void 0;const I=qB(this.emptyGroups),k=this.trackStartLines,S=this.config.lineTerminatorsPattern;let M=0,q=[],U=[];const z=[],Pe=[];Object.freeze(Pe);let J;function j(){return q}function ge(Ue){const ot=Ni(Ue),vt=U[ot];return vt===void 0?Pe:vt}const Nt=Ue=>{if(z.length===1&&Ue.tokenType.PUSH_MODE===void 0){const ot=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(Ue);G.push({offset:Ue.startOffset,line:Ue.startLine,column:Ue.startColumn,length:Ue.image.length,message:ot})}else{z.pop();const ot=No(z);q=this.patternIdxToConfig[ot],U=this.charCodeToPatternIdxToConfig[ot],M=q.length;const vt=this.canModeBeOptimized[ot]&&this.config.safeMode===!1;U&&vt?J=ge:J=j}};function nn(Ue){z.push(Ue),U=this.charCodeToPatternIdxToConfig[Ue],q=this.patternIdxToConfig[Ue],M=q.length,M=q.length;const ot=this.canModeBeOptimized[Ue]&&this.config.safeMode===!1;U&&ot?J=ge:J=j}nn.call(this,n);let Ge;const wn=this.config.recoveryEnabled;for(;_<T;){c=null;const Ue=v.charCodeAt(_),ot=J(Ue),vt=ot.length;for(r=0;r<vt;r++){Ge=ot[r];const Be=Ge.pattern;l=null;const wt=Ge.short;if(wt!==!1?Ue===wt&&(c=Be):Ge.isCustom===!0?(b=Be.exec(v,_,x,I),b!==null?(c=b[0],b.payload!==void 0&&(l=b.payload)):c=null):(this.updateLastIndex(Be,_),c=this.match(Be,e,_)),c!==null){if(a=Ge.longerAlt,a!==void 0){const Qe=a.length;for(s=0;s<Qe;s++){const fe=q[a[s]],nt=fe.pattern;if(u=null,fe.isCustom===!0?(b=nt.exec(v,_,x,I),b!==null?(o=b[0],b.payload!==void 0&&(u=b.payload)):o=null):(this.updateLastIndex(nt,_),o=this.match(nt,e,_)),o&&o.length>c.length){c=o,l=u,Ge=fe;break}}}break}}if(c!==null){if(d=c.length,f=Ge.group,f!==void 0&&(h=Ge.tokenTypeIdx,p=this.createTokenInstance(c,_,h,Ge.tokenType,B,W,d),this.handlePayload(p,l),f===!1?N=this.addToken(x,N,p):I[f].push(p)),e=this.chopInput(e,d),_=_+d,W=this.computeNewColumn(W,d),k===!0&&Ge.canLineTerminator===!0){let Be=0,wt,Qe;S.lastIndex=0;do wt=S.test(c),wt===!0&&(Qe=S.lastIndex-1,Be++);while(wt===!0);Be!==0&&(B=B+Be,W=d-Qe,this.updateTokenEndLineColumnLocation(p,f,Qe,Be,B,W,d))}this.handleModes(Ge,Nt,nn,p)}else{const Be=_,wt=B,Qe=W;let fe=wn===!1;for(;fe===!1&&_<T;)for(e=this.chopInput(e,1),_++,i=0;i<M;i++){const nt=q[i],Oe=nt.pattern,Dt=nt.short;if(Dt!==!1?v.charCodeAt(_)===Dt&&(fe=!0):nt.isCustom===!0?fe=Oe.exec(v,_,x,I)!==null:(this.updateLastIndex(Oe,_),fe=Oe.exec(e)!==null),fe===!0)break}if(y=_-Be,W=this.computeNewColumn(W,y),R=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(v,Be,y,wt,Qe),G.push({offset:Be,line:wt,column:Qe,length:y,message:R}),wn===!1)break}}return this.hasCustom||(x.length=N),{tokens:x,groups:I,errors:G}}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,o,a){let c,l;n!==void 0&&(c=r===a-1,l=c?-1:0,i===1&&c===!0||(e.endLine=s+l,e.endColumn=o-1+-l))}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,o){return{image:e,startOffset:n,startLine:s,startColumn:o,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,s,o,a){return{image:e,startOffset:n,endOffset:n+a-1,startLine:s,endLine:s,startColumn:o,endColumn:o+a-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}}fn.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.",fn.NA=/NOT_APPLICABLE/;function Mo(t){return _R(t)?t.LABEL:t.name}function _R(t){return cn(t.LABEL)&&t.LABEL!==""}const t4="parent",CR="categories",AR="label",IR="group",xR="push_mode",PR="pop_mode",NR="longer_alt",DR="line_breaks",OR="start_chars_hint";function LR(t){return n4(t)}function n4(t){const e=t.pattern,n={};if(n.name=t.name,ti(e)||(n.PATTERN=e),oe(t,t4))throw`The parent property is no longer supported.
57
+ See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return oe(t,CR)&&(n.CATEGORIES=t[CR]),Mc([n]),oe(t,AR)&&(n.LABEL=t[AR]),oe(t,IR)&&(n.GROUP=t[IR]),oe(t,PR)&&(n.POP_MODE=t[PR]),oe(t,xR)&&(n.PUSH_MODE=t[xR]),oe(t,NR)&&(n.LONGER_ALT=t[NR]),oe(t,DR)&&(n.LINE_BREAKS=t[DR]),oe(t,OR)&&(n.START_CHARS_HINT=t[OR]),n}const Di=LR({name:"EOF",pattern:fn.NA});Mc([Di]);function Dm(t,e,n,r,i,s,o,a){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:o,endColumn:a,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function MR(t,e){return Lc(t,e)}const Fo={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${_R(t)?`--> ${Mo(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: ",a=`
58
+ but found: '`+er(e).image+"'";if(r)return s+r+a;{const c=Jt(t,(f,h)=>f.concat(h),[]),l=Z(c,f=>`[${Z(f,h=>Mo(h)).join(", ")}]`),d=`one of these possible Token sequences:
59
+ ${Z(l,(f,h)=>` ${h+1}. ${f}`).join(`
60
+ `)}`;return s+d+a}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:r}){const i="Expecting: ",o=`
61
+ but found: '`+er(e).image+"'";if(n)return i+n+o;{const c=`expecting at least one iteration which starts with one of these possible Token sequences::
62
+ <${Z(t,l=>`[${Z(l,u=>Mo(u)).join(",")}]`).join(" ,")}>`;return i+c+o}}};Object.freeze(Fo);const r4={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
63
+ inside top level rule: ->`+t.name+"<-"}},Ms={buildDuplicateFoundError(t,e){function n(u){return u instanceof Ye?u.terminalType.name:u instanceof Qt?u.nonTerminalName:""}const r=t.name,i=er(e),s=i.idx,o=Sr(i),a=n(i),c=s>0;let l=`->${o}${c?s:""}<- ${a?`with argument: ->${a}<-`:""}
64
+ appears more than once (${e.length} times) in the top level rule: ->${r}<-.
65
+ For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
66
+ `;return l=l.replace(/[ \t]+/g," "),l=l.replace(/\s\s+/g,`
67
+ `),l},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
68
+ The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
69
+ To resolve this make sure each Terminal and Non-Terminal names are unique
70
+ This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
71
+ and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=Z(t.prefixPath,i=>Mo(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
72
+ in <OR${n}> inside <${t.topLevelRule.name}> Rule,
73
+ <${e}> may appears as a prefix path in all these alternatives.
74
+ See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
75
+ For Further details.`},buildAlternationAmbiguityError(t){const e=Z(t.prefixPath,i=>Mo(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,
76
+ <${e}> may appears as a prefix path in all these alternatives.
77
+ `;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
78
+ 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.
79
+ 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.
80
+ Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
81
+ <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
82
+ has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,n=Z(t.leftRecursionPath,s=>s.name),r=`${e} --> ${n.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
83
+ rule: <${e}> can be invoked from itself (directly or indirectly)
84
+ without consuming any Tokens. The grammar path that causes this is:
85
+ ${r}
86
+ To fix this refactor your grammar to remove the left recursion.
87
+ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof Oo?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function i4(t,e){const n=new s4(t,e);return n.resolveRefs(),n.errors}class s4 extends Lo{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){se(At(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:Zt.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class o4 extends jd{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=Ot(this.path.ruleStack).reverse(),this.occurrenceStack=Ot(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(){qe(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class a4 extends o4{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 ln({definition:i});this.possibleTokTypes=Nc(s),this.found=!0}}}class Kd extends jd{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 c4 extends Kd{walkMany(e,n,r){if(e.idx===this.occurrence){const i=er(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Ye&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class FR extends Kd{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=er(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Ye&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class l4 extends Kd{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=er(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Ye&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class jR extends Kd{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=er(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Ye&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function Om(t,e,n=[]){n=Ot(n);let r=[],i=0;function s(a){return a.concat(Lt(t,i+1))}function o(a){const c=Om(s(a),e,n);return r.concat(c)}for(;n.length<e&&i<t.length;){const a=t[i];if(a instanceof ln)return o(a.definition);if(a instanceof Qt)return o(a.definition);if(a instanceof Mt)r=o(a.definition);else if(a instanceof Sn){const c=a.definition.concat([new lt({definition:a.definition})]);return o(c)}else if(a instanceof $n){const c=[new ln({definition:a.definition}),new lt({definition:[new Ye({terminalType:a.separator})].concat(a.definition)})];return o(c)}else if(a instanceof un){const c=a.definition.concat([new lt({definition:[new Ye({terminalType:a.separator})].concat(a.definition)})]);r=o(c)}else if(a instanceof lt){const c=a.definition.concat([new lt({definition:a.definition})]);r=o(c)}else{if(a instanceof dn)return se(a.definition,c=>{qe(c.definition)===!1&&(r=o(c.definition))}),r;if(a instanceof Ye)n.push(a.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:Lt(t,i)}),r}function UR(t,e,n,r){const i="EXIT_NONE_TERMINAL",s=[i],o="EXIT_ALTERNATIVE";let a=!1;const c=e.length,l=c-r-1,u=[],d=[];for(d.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!qe(d);){const f=d.pop();if(f===o){a&&No(d).idx<=l&&d.pop();continue}const h=f.def,p=f.idx,y=f.ruleStack,R=f.occurrenceStack;if(qe(h))continue;const b=h[0];if(b===i){const v={idx:p,def:Lt(h),ruleStack:Pc(y),occurrenceStack:Pc(R)};d.push(v)}else if(b instanceof Ye)if(p<c-1){const v=p+1,T=e[v];if(n(T,b.terminalType)){const _={idx:v,def:Lt(h),ruleStack:y,occurrenceStack:R};d.push(_)}}else if(p===c-1)u.push({nextTokenType:b.terminalType,nextTokenOccurrence:b.idx,ruleStack:y,occurrenceStack:R}),a=!0;else throw Error("non exhaustive match");else if(b instanceof Qt){const v=Ot(y);v.push(b.nonTerminalName);const T=Ot(R);T.push(b.idx);const _={idx:p,def:b.definition.concat(s,Lt(h)),ruleStack:v,occurrenceStack:T};d.push(_)}else if(b instanceof Mt){const v={idx:p,def:Lt(h),ruleStack:y,occurrenceStack:R};d.push(v),d.push(o);const T={idx:p,def:b.definition.concat(Lt(h)),ruleStack:y,occurrenceStack:R};d.push(T)}else if(b instanceof Sn){const v=new lt({definition:b.definition,idx:b.idx}),T=b.definition.concat([v],Lt(h)),_={idx:p,def:T,ruleStack:y,occurrenceStack:R};d.push(_)}else if(b instanceof $n){const v=new Ye({terminalType:b.separator}),T=new lt({definition:[v].concat(b.definition),idx:b.idx}),_=b.definition.concat([T],Lt(h)),N={idx:p,def:_,ruleStack:y,occurrenceStack:R};d.push(N)}else if(b instanceof un){const v={idx:p,def:Lt(h),ruleStack:y,occurrenceStack:R};d.push(v),d.push(o);const T=new Ye({terminalType:b.separator}),_=new lt({definition:[T].concat(b.definition),idx:b.idx}),N=b.definition.concat([_],Lt(h)),F={idx:p,def:N,ruleStack:y,occurrenceStack:R};d.push(F)}else if(b instanceof lt){const v={idx:p,def:Lt(h),ruleStack:y,occurrenceStack:R};d.push(v),d.push(o);const T=new lt({definition:b.definition,idx:b.idx}),_=b.definition.concat([T],Lt(h)),N={idx:p,def:_,ruleStack:y,occurrenceStack:R};d.push(N)}else if(b instanceof dn)for(let v=b.definition.length-1;v>=0;v--){const T=b.definition[v],_={idx:p,def:T.definition.concat(Lt(h)),ruleStack:y,occurrenceStack:R};d.push(_),d.push(o)}else if(b instanceof ln)d.push({idx:p,def:b.definition.concat(Lt(h)),ruleStack:y,occurrenceStack:R});else if(b instanceof Oo)d.push(u4(b,p,y,R));else throw Error("non exhaustive match")}return u}function u4(t,e,n,r){const i=Ot(n);i.push(t.name);const s=Ot(r);return s.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:s}}var rt;(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"})(rt||(rt={}));function Lm(t){if(t instanceof Mt||t==="Option")return rt.OPTION;if(t instanceof lt||t==="Repetition")return rt.REPETITION;if(t instanceof Sn||t==="RepetitionMandatory")return rt.REPETITION_MANDATORY;if(t instanceof $n||t==="RepetitionMandatoryWithSeparator")return rt.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof un||t==="RepetitionWithSeparator")return rt.REPETITION_WITH_SEPARATOR;if(t instanceof dn||t==="Alternation")return rt.ALTERNATION;throw Error("non exhaustive match")}function BR(t){const{occurrence:e,rule:n,prodType:r,maxLookahead:i}=t,s=Lm(r);return s===rt.ALTERNATION?Vd(e,n,i):Yd(e,n,s,i)}function d4(t,e,n,r,i,s){const o=Vd(t,e,n),a=zR(o)?Hd:Lc;return s(o,r,a,i)}function f4(t,e,n,r,i,s){const o=Yd(t,e,i,n),a=zR(o)?Hd:Lc;return s(o[0],a,r)}function h4(t,e,n,r){const i=t.length,s=Zn(t,o=>Zn(o,a=>a.length===1));if(e)return function(o){const a=Z(o,c=>c.GATE);for(let c=0;c<i;c++){const l=t[c],u=l.length,d=a[c];if(!(d!==void 0&&d.call(this)===!1))e:for(let f=0;f<u;f++){const h=l[f],p=h.length;for(let y=0;y<p;y++){const R=this.LA(y+1);if(n(R,h[y])===!1)continue e}return c}}};if(s&&!r){const o=Z(t,c=>Mn(c)),a=Jt(o,(c,l,u)=>(se(l,d=>{oe(c,d.tokenTypeIdx)||(c[d.tokenTypeIdx]=u),se(d.categoryMatches,f=>{oe(c,f)||(c[f]=u)})}),c),{});return function(){const c=this.LA(1);return a[c.tokenTypeIdx]}}else return function(){for(let o=0;o<i;o++){const a=t[o],c=a.length;e:for(let l=0;l<c;l++){const u=a[l],d=u.length;for(let f=0;f<d;f++){const h=this.LA(f+1);if(n(h,u[f])===!1)continue e}return o}}}}function p4(t,e,n){const r=Zn(t,s=>s.length===1),i=t.length;if(r&&!n){const s=Mn(t);if(s.length===1&&qe(s[0].categoryMatches)){const a=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{const o=Jt(s,(a,c,l)=>(a[c.tokenTypeIdx]=!0,se(c.categoryMatches,u=>{a[u]=!0}),a),[]);return function(){const a=this.LA(1);return o[a.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;s<i;s++){const o=t[s],a=o.length;for(let c=0;c<a;c++){const l=this.LA(c+1);if(e(l,o[c])===!1)continue e}return!0}return!1}}class g4 extends jd{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,rt.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,rt.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,rt.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,rt.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(e,rt.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class qR extends Lo{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,rt.OPTION)}visitRepetition(e){this.checkIsTarget(e,rt.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,rt.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,rt.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,rt.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,rt.ALTERNATION)}}function WR(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function Mm(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 o=e[s];i.push(o+"_"+r.tokenTypeIdx);for(let a=0;a<r.categoryMatches.length;a++){const c="_"+r.categoryMatches[a];i.push(o+c)}}e=i}return e}function m4(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 o=e[s];if(i[o]===!0)return!1}}return!0}function GR(t,e){const n=Z(t,o=>Om([o],1)),r=WR(n.length),i=Z(n,o=>{const a={};return se(o,c=>{const l=Mm(c.partialPath);se(l,u=>{a[u]=!0})}),a});let s=n;for(let o=1;o<=e;o++){const a=s;s=WR(a.length);for(let c=0;c<a.length;c++){const l=a[c];for(let u=0;u<l.length;u++){const d=l[u].partialPath,f=l[u].suffixDef,h=Mm(d);if(m4(i,h,c)||qe(f)||d.length===e){const y=r[c];if(Fm(y,d)===!1){y.push(d);for(let R=0;R<h.length;R++){const b=h[R];i[c][b]=!0}}}else{const y=Om(f,o+1,d);s[c]=s[c].concat(y),se(y,R=>{const b=Mm(R.partialPath);se(b,v=>{i[c][v]=!0})})}}}}return r}function Vd(t,e,n,r){const i=new qR(t,rt.ALTERNATION,r);return e.accept(i),GR(i.result,n)}function Yd(t,e,n,r){const i=new qR(t,n);e.accept(i);const s=i.result,a=new g4(e,t,n).startWalking(),c=new ln({definition:s}),l=new ln({definition:a});return GR([c,l],r)}function Fm(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],o=r[i];if((s===o||o.categoryMatchesMap[s.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function y4(t,e){return t.length<e.length&&Zn(t,(n,r)=>{const i=e[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function zR(t){return Zn(t,e=>Zn(e,n=>Zn(n,r=>qe(r.categoryMatches))))}function v4(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return Z(e,n=>Object.assign({type:Zt.CUSTOM_LOOKAHEAD_VALIDATION},n))}function w4(t,e,n,r){const i=Rn(t,c=>b4(c,n)),s=P4(t,e,n),o=Rn(t,c=>C4(c,n)),a=Rn(t,c=>R4(c,t,r,n));return i.concat(s,o,a)}function b4(t,e){const n=new E4;t.accept(n);const r=n.allProductions,i=OU(r,T4),s=tr(i,a=>a.length>1);return Z(At(s),a=>{const c=er(a),l=e.buildDuplicateFoundError(t,a),u=Sr(c),d={message:l,type:Zt.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:u,occurrence:c.idx},f=HR(c);return f&&(d.parameter=f),d})}function T4(t){return`${Sr(t)}_#_${t.idx}_#_${HR(t)}`}function HR(t){return t instanceof Ye?t.terminalType.name:t instanceof Qt?t.nonTerminalName:""}class E4 extends Lo{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 R4(t,e,n,r){const i=[];if(Jt(e,(o,a)=>a.name===t.name?o+1:o,0)>1){const o=r.buildDuplicateRuleNameError({topLevelRule:t,grammarName:n});i.push({message:o,type:Zt.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function S4(t,e,n){const r=[];let i;return Xt(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:Zt.INVALID_RULE_OVERRIDE,ruleName:t})),r}function KR(t,e,n,r=[]){const i=[],s=Xd(e.definition);if(qe(s))return[];{const o=t.name;Xt(s,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:Zt.LEFT_RECURSION,ruleName:o});const c=Od(s,r.concat([t])),l=Rn(c,u=>{const d=Ot(r);return d.push(u),KR(t,u,n,d)});return i.concat(l)}}function Xd(t){let e=[];if(qe(t))return e;const n=er(t);if(n instanceof Qt)e.push(n.referencedRule);else if(n instanceof ln||n instanceof Mt||n instanceof Sn||n instanceof $n||n instanceof un||n instanceof lt)e=e.concat(Xd(n.definition));else if(n instanceof dn)e=Mn(Z(n.definition,s=>Xd(s.definition)));else if(!(n instanceof Ye))throw Error("non exhaustive match");const r=Fd(n),i=t.length>1;if(r&&i){const s=Lt(t);return e.concat(Xd(s))}else return e}class jm extends Lo{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function $4(t,e){const n=new jm;t.accept(n);const r=n.alternations;return Rn(r,s=>{const o=Pc(s.definition);return Rn(o,(a,c)=>{const l=UR([a],[],Lc,1);return qe(l)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:s,emptyChoiceIdx:c}),type:Zt.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:s.idx,alternative:c+1}]:[]})})}function k4(t,e,n){const r=new jm;t.accept(r);let i=r.alternations;return i=Ld(i,o=>o.ignoreAmbiguities===!0),Rn(i,o=>{const a=o.idx,c=o.maxLookahead||e,l=Vd(a,t,c,o),u=I4(l,o,t,n),d=x4(l,o,t,n);return u.concat(d)})}class _4 extends Lo{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 C4(t,e){const n=new jm;t.accept(n);const r=n.alternations;return Rn(r,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:s}),type:Zt.TOO_MANY_ALTS,ruleName:t.name,occurrence:s.idx}]:[])}function A4(t,e,n){const r=[];return se(t,i=>{const s=new _4;i.accept(s);const o=s.allProductions;se(o,a=>{const c=Lm(a),l=a.maxLookahead||e,u=a.idx,f=Yd(u,i,c,l)[0];if(qe(Mn(f))){const h=n.buildEmptyRepetitionError({topLevelRule:i,repetition:a});r.push({message:h,type:Zt.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function I4(t,e,n,r){const i=[],s=Jt(t,(a,c,l)=>(e.definition[l].ignoreAmbiguities===!0||se(c,u=>{const d=[l];se(t,(f,h)=>{l!==h&&Fm(f,u)&&e.definition[h].ignoreAmbiguities!==!0&&d.push(h)}),d.length>1&&!Fm(i,u)&&(i.push(u),a.push({alts:d,path:u}))}),a),[]);return Z(s,a=>{const c=Z(a.alts,u=>u+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:c,prefixPath:a.path}),type:Zt.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:a.alts}})}function x4(t,e,n,r){const i=Jt(t,(o,a,c)=>{const l=Z(a,u=>({idx:c,path:u}));return o.concat(l)},[]);return xc(Rn(i,o=>{if(e.definition[o.idx].ignoreAmbiguities===!0)return[];const c=o.idx,l=o.path,u=En(i,f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx<c&&y4(f.path,l));return Z(u,f=>{const h=[f.idx+1,c+1],p=e.idx===0?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:h,prefixPath:f.path}),type:Zt.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:p,alternatives:h}})}))}function P4(t,e,n){const r=[],i=Z(e,s=>s.name);return se(t,s=>{const o=s.name;if(Xt(i,o)){const a=n.buildNamespaceConflictError(s);r.push({message:a,type:Zt.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:o})}}),r}function N4(t){const e=_m(t,{errMsgProvider:r4}),n={};return se(t.rules,r=>{n[r.name]=r}),i4(n,e.errMsgProvider)}function D4(t){return t=_m(t,{errMsgProvider:Ms}),w4(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const VR="MismatchedTokenException",YR="NoViableAltException",XR="EarlyExitException",JR="NotAllInputParsedException",QR=[VR,YR,XR,JR];Object.freeze(QR);function Jd(t){return Xt(QR,t.name)}class Qd 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 ZR extends Qd{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=VR}}class O4 extends Qd{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=YR}}class L4 extends Qd{constructor(e,n){super(e,n),this.name=JR}}class M4 extends Qd{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=XR}}const Um={},eS="InRuleRecoveryException";class F4 extends Error{constructor(e){super(e),this.name=eS}}class j4{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=oe(e,"recoveryEnabled")?e.recoveryEnabled:ni.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=U4)}getTokenToInsert(e){const n=Dm(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(),o=this.exportLexerState(),a=[];let c=!1;const l=this.LA(1);let u=this.LA(1);const d=()=>{const f=this.LA(0),h=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:l,previous:f,ruleName:this.getCurrRuleFullName()}),p=new ZR(h,l,this.LA(0));p.resyncedTokens=Pc(a),this.SAVE_ERROR(p)};for(;!c;)if(this.tokenMatcher(u,i)){d();return}else if(r.call(this)){d(),e.apply(this,n);return}else this.tokenMatcher(u,s)?c=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,a));this.importLexerState(o)}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 F4("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||qe(n))return!1;const r=this.LA(1);return Do(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 Xt(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),r=2;for(;;){const i=Do(e,s=>MR(n,s));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Um;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 Z(e,(r,i)=>i===0?Um:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=Z(this.buildFullFollowKeyStack(),n=>this.getFollowSetFromFollowKey(n));return Mn(e)}getFollowSetFromFollowKey(e){if(e===Um)return[Di];const n=e.ruleName+e.idxInCallingRule+hR+e.inRule;return this.resyncFollows[n]}addToResyncTokens(e,n){return this.tokenMatcher(e,Di)||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 Pc(n)}attemptInRepetitionRecovery(e,n,r,i,s,o,a){}getCurrentGrammarPath(e,n){const r=this.getHumanReadableRuleStack(),i=Ot(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:n}}getHumanReadableRuleStack(){return Z(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function U4(t,e,n,r,i,s,o){const a=this.getKeyForAutomaticLookahead(r,i);let c=this.firstAfterRepMap[a];if(c===void 0){const f=this.getCurrRuleFullName(),h=this.getGAstProductions()[f];c=new s(h,i).startWalking(),this.firstAfterRepMap[a]=c}let l=c.token,u=c.occurrence;const d=c.isEndOfRule;this.RULE_STACK.length===1&&d&&l===void 0&&(l=Di,u=1),!(l===void 0||u===void 0)&&this.shouldInRepetitionRecoveryBeTried(l,u,o)&&this.tryInRepetitionRecovery(t,e,n,l)}const B4=4,Oi=8,tS=1<<Oi,nS=2<<Oi,Bm=3<<Oi,qm=4<<Oi,Wm=5<<Oi,Zd=6<<Oi;function Gm(t,e,n){return n|e|t}class zm{constructor(e){var n;this.maxLookahead=(n=e?.maxLookahead)!==null&&n!==void 0?n:ni.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(qe(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 Rn(e,n=>KR(n,n,Ms))}validateEmptyOrAlternatives(e){return Rn(e,n=>$4(n,Ms))}validateAmbiguousAlternationAlternatives(e,n){return Rn(e,r=>k4(r,n,Ms))}validateSomeNonEmptyLookaheadPath(e,n){return A4(e,n,Ms)}buildLookaheadForAlternation(e){return d4(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,h4)}buildLookaheadForOptional(e){return f4(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Lm(e.prodType),p4)}}class q4{initLooksAhead(e){this.dynamicTokensEnabled=oe(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:ni.dynamicTokensEnabled,this.maxLookahead=oe(e,"maxLookahead")?e.maxLookahead:ni.maxLookahead,this.lookaheadStrategy=oe(e,"lookaheadStrategy")?e.lookaheadStrategy:new zm({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){se(e,n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{const{alternation:r,repetition:i,option:s,repetitionMandatory:o,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:c}=G4(n);se(r,l=>{const u=l.idx===0?"":l.idx;this.TRACE_INIT(`${Sr(l)}${u}`,()=>{const d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:l.idx,rule:n,maxLookahead:l.maxLookahead||this.maxLookahead,hasPredicates:l.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=Gm(this.fullRuleNameToShort[n.name],tS,l.idx);this.setLaFuncCache(f,d)})}),se(i,l=>{this.computeLookaheadFunc(n,l.idx,Bm,"Repetition",l.maxLookahead,Sr(l))}),se(s,l=>{this.computeLookaheadFunc(n,l.idx,nS,"Option",l.maxLookahead,Sr(l))}),se(o,l=>{this.computeLookaheadFunc(n,l.idx,qm,"RepetitionMandatory",l.maxLookahead,Sr(l))}),se(a,l=>{this.computeLookaheadFunc(n,l.idx,Zd,"RepetitionMandatoryWithSeparator",l.maxLookahead,Sr(l))}),se(c,l=>{this.computeLookaheadFunc(n,l.idx,Wm,"RepetitionWithSeparator",l.maxLookahead,Sr(l))})})})}computeLookaheadFunc(e,n,r,i,s,o){this.TRACE_INIT(`${o}${n===0?"":n}`,()=>{const a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),c=Gm(this.fullRuleNameToShort[e.name],r,n);this.setLaFuncCache(c,a)})}getKeyForAutomaticLookahead(e,n){const r=this.getLastExplicitRuleShortName();return Gm(r,e,n)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,n){this.lookAheadFuncsCache.set(e,n)}}class W4 extends Lo{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 ef=new W4;function G4(t){ef.reset(),t.accept(ef);const e=ef.dslMethods;return ef.reset(),e}function rS(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function iS(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 z4(t,e,n){t.children[n]===void 0?t.children[n]=[e]:t.children[n].push(e)}function H4(t,e,n){t.children[e]===void 0?t.children[e]=[n]:t.children[e].push(n)}const K4="name";function sS(t,e){Object.defineProperty(t,K4,{enumerable:!1,configurable:!0,writable:!1,value:e})}function V4(t,e){const n=Ln(t),r=n.length;for(let i=0;i<r;i++){const s=n[i],o=t[s],a=o.length;for(let c=0;c<a;c++){const l=o[c];l.tokenTypeIdx===void 0&&this[l.name](l.children,e)}}}function Y4(t,e){const n=function(){};sS(n,t+"BaseSemantics");const r={visit:function(i,s){if(ke(i)&&(i=i[0]),!ti(i))return this[i.name](i.children,s)},validateVisitor:function(){const i=J4(this,e);if(!qe(i)){const s=Z(i,o=>o.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
88
+ ${s.join(`
89
+
90
+ `).replace(/\n/g,`
91
+ `)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=e,n}function X4(t,e,n){const r=function(){};sS(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return se(e,s=>{i[s]=V4}),r.prototype=i,r.prototype.constructor=r,r}var Hm;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(Hm||(Hm={}));function J4(t,e){return Q4(t,e)}function Q4(t,e){const n=En(e,i=>Jr(t[i])===!1),r=Z(n,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:Hm.MISSING_METHOD,methodName:i}));return xc(r)}class Z4{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=oe(e,"nodeLocationTracking")?e.nodeLocationTracking:ni.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Ct,this.cstFinallyStateUpdate=Ct,this.cstPostTerminal=Ct,this.cstPostNonTerminal=Ct,this.cstPostRule=Ct;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=iS,this.setNodeLocationFromNode=iS,this.cstPostRule=Ct,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Ct,this.setNodeLocationFromNode=Ct,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=rS,this.setNodeLocationFromNode=rS,this.cstPostRule=Ct,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Ct,this.setNodeLocationFromNode=Ct,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Ct,this.setNodeLocationFromNode=Ct,this.cstPostRule=Ct,this.setInitialNodeLocation=Ct;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];z4(r,n,e),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];H4(r,n,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(ti(this.baseCstVisitorConstructor)){const e=Y4(this.className,Ln(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(ti(this.baseCstVisitorWithDefaultsConstructor)){const e=X4(this.className,Ln(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 e5{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 t5{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=sf){if(Xt(this.definedRulesNames,e)){const o={message:Ms.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Zt.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(o)}this.definedRulesNames.push(e);const i=this.defineRule(e,n,r);return this[e]=i,i}OVERRIDE_RULE(e,n,r=sf){const i=S4(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(Jd(i))return!1;throw i}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return lB(At(this.gastProductionsCache))}}class n5{initRecognizerEngine(e,n){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Hd,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},oe(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
92
+ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
93
+ For Further details.`);if(ke(e)){if(qe(e))throw Error(`A Token Vocabulary cannot be empty.
94
+ Note that the first argument for the parser constructor
95
+ 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.
96
+ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
97
+ For Further details.`)}if(ke(e))this.tokensMap=Jt(e,(s,o)=>(s[o.name]=o,s),{});else if(oe(e,"modes")&&Zn(Mn(At(e.modes)),ZB)){const s=Mn(At(e.modes)),o=Cm(s);this.tokensMap=Jt(o,(a,c)=>(a[c.name]=c,a),{})}else if(On(e))this.tokensMap=Ot(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=Di;const r=oe(e,"modes")?Mn(At(e.modes)):At(e),i=Zn(r,s=>qe(s.categoryMatches));this.tokenMatcher=i?Hd:Lc,Mc(At(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'
98
+ Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=oe(r,"resyncEnabled")?r.resyncEnabled:sf.resyncEnabled,s=oe(r,"recoveryValueFunc")?r.recoveryValueFunc:sf.recoveryValueFunc,o=this.ruleShortNameIdx<<B4+Oi;this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;let a;return this.outputCst===!0?a=function(...u){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),n.apply(this,u);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()}}:a=function(...u){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),n.apply(this,u)}catch(d){return this.invokeRuleCatch(d,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(a,{ruleName:e,originalGrammarAction:n})}invokeRuleCatch(e,n,r){const i=this.RULE_STACK.length===1,s=n&&!this.isBackTracking()&&this.recoveryEnabled;if(Jd(e)){const o=e;if(s){const a=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(a))if(o.resyncedTokens=this.reSyncTo(a),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,o.partialCstResult=c}throw o}}else{if(i)return this.moveToTerminatedState(),r(e);throw o}}else throw e}optionInternal(e,n){const r=this.getKeyForAutomaticLookahead(nS,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 o=e.GATE;if(o!==void 0){const a=i;i=()=>o.call(this)&&a.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,n){const r=this.getKeyForAutomaticLookahead(qm,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 o=n.GATE;if(o!==void 0){const a=i;i=()=>o.call(this)&&a.call(this)}}else s=n;if(i.call(this)===!0){let o=this.doSingleRepetition(s);for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,rt.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,qm,e,l4)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Zd,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 a=()=>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,a,i,jR],a,Zd,e,jR)}else throw this.raiseEarlyExitException(e,rt.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(Bm,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 a=n.GATE;if(a!==void 0){const c=i;i=()=>a.call(this)&&c.call(this)}}else s=n;let o=!0;for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],i,Bm,e,c4,o)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Wm,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 a=()=>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,a,i,FR],a,Wm,e,FR)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,Zd,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(tS,n),i=ke(e)?e:e.DEF,o=this.getLaFuncFromCache(r).call(this,i);if(o!==void 0)return i[o].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 L4(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 Jd(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 ZR(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===eS?r:s}}else throw r}saveRecogState(){const e=this.errors,n=Ot(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),Di)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class r5{initErrorHandler(e){this._errors=[],this.errorMessageProvider=oe(e,"errorMessageProvider")?e.errorMessageProvider:ni.errorMessageProvider}SAVE_ERROR(e){if(Jd(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:Ot(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return Ot(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,n,r){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],a=Yd(e,s,n,this.maxLookahead)[0],c=[];for(let u=1;u<=this.maxLookahead;u++)c.push(this.LA(u));const l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:c,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new M4(l,this.LA(1),this.LA(0)))}raiseNoAltException(e,n){const r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],s=Vd(e,i,this.maxLookahead),o=[];for(let l=1;l<=this.maxLookahead;l++)o.push(this.LA(l));const a=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:o,previous:a,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new O4(c,this.LA(1),a))}}class i5{initContentAssist(){}computeContentAssist(e,n){const r=this.gastProductionsCache[e];if(ti(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return UR([r],n,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const n=er(e.ruleStack),i=this.getGAstProductions()[n];return new a4(i,e).startWalking()}}const tf={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(tf);const oS=!0,aS=Math.pow(2,Oi)-1,cS=LR({name:"RECORDING_PHASE_TOKEN",pattern:fn.NA});Mc([cS]);const lS=Dm(cS,`This IToken indicates the Parser is in Recording Phase
99
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(lS);const s5={name:`This CSTNode indicates the Parser is in Recording Phase
100
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class o5{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 Oo({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+`
101
+ This error was thrown during the "grammar recording phase" For more info see:
102
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,n){return jc.call(this,Mt,e,n)}atLeastOneInternalRecord(e,n){jc.call(this,Sn,n,e)}atLeastOneSepFirstInternalRecord(e,n){jc.call(this,$n,n,e,oS)}manyInternalRecord(e,n){jc.call(this,lt,n,e)}manySepFirstInternalRecord(e,n){jc.call(this,un,n,e,oS)}orInternalRecord(e,n){return a5.call(this,e,n)}subruleInternalRecord(e,n,r){if(nf(n),!e||oe(e,"ruleName")===!1){const a=new Error(`<SUBRULE${uS(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
103
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const i=No(this.recordingProdStack),s=e.ruleName,o=new Qt({idx:n,nonTerminalName:s,label:r?.LABEL,referencedRule:void 0});return i.definition.push(o),this.outputCst?s5:tf}consumeInternalRecord(e,n,r){if(nf(n),!$R(e)){const o=new Error(`<CONSUME${uS(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
104
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=No(this.recordingProdStack),s=new Ye({idx:n,terminalType:e,label:r?.LABEL});return i.definition.push(s),lS}}function jc(t,e,n,r=!1){nf(n);const i=No(this.recordingProdStack),s=Jr(e)?e:e.DEF,o=new t({definition:[],idx:n});return r&&(o.separator=e.SEP),oe(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),i.definition.push(o),this.recordingProdStack.pop(),tf}function a5(t,e){nf(e);const n=No(this.recordingProdStack),r=ke(t)===!1,i=r===!1?t:t.DEF,s=new dn({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});oe(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const o=aR(i,a=>Jr(a.GATE));return s.hasPredicates=o,n.definition.push(s),se(i,a=>{const c=new ln({definition:[]});s.definition.push(c),oe(a,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:oe(a,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),a.ALT.call(this),this.recordingProdStack.pop()}),tf}function uS(t){return t===0?"":`${t}`}function nf(t){if(t<0||t>aS){const e=new Error(`Invalid DSL Method idx value: <${t}>
105
+ Idx value must be a none negative value smaller than ${aS+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class c5{initPerformanceTracer(e){if(oe(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=ni.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}=uR(n),o=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return n()}}function l5(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=Dm(Di,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(rf);const ni=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Fo,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),sf=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Zt;(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"})(Zt||(Zt={}));function dS(t=void 0){return function(){return t}}class _u{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",()=>{dR(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),se(this.definedRulesNames,i=>{const o=this[i].originalGrammarAction;let a;this.TRACE_INIT(`${i} Rule`,()=>{a=this.topLevelRuleRecord(i,o)}),this.gastProductionsCache[i]=a})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=N4({rules:At(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(qe(r)&&this.skipValidations===!1){const i=D4({rules:At(this.gastProductionsCache),tokenTypes:At(this.tokensMap),errMsgProvider:Ms,grammarName:n}),s=v4({lookaheadStrategy:this.lookaheadStrategy,rules:At(this.gastProductionsCache),tokenTypes:At(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),qe(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=mB(At(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:At(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(At(this.gastProductionsCache))})),!_u.DEFER_DEFINITION_ERRORS_HANDLING&&!qe(this.definitionErrors))throw e=Z(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
106
+ ${e.join(`
107
+ -------------------------------
108
+ `)}`)})}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),oe(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
109
+ Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
110
+ See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
111
+ For further details.`);this.skipValidations=oe(n,"skipValidations")?n.skipValidations:ni.skipValidations}}_u.DEFER_DEFINITION_ERRORS_HANDLING=!1,l5(_u,[j4,q4,Z4,e5,n5,t5,r5,i5,o5,c5]);class u5 extends _u{constructor(e,n=ni){const r=Ot(n);r.outputCst=!1,super(e,r)}}function jo(t,e,n){return`${t.name}_${e}_${n}`}const Li=1,d5=2,fS=4,hS=5,Uc=7,f5=8,h5=9,p5=10,g5=11,pS=12;class Km{constructor(e){this.target=e}isEpsilon(){return!1}}class Vm extends Km{constructor(e,n){super(e),this.tokenType=n}}class gS extends Km{constructor(e){super(e)}isEpsilon(){return!0}}class Ym extends Km{constructor(e,n,r){super(e),this.rule=n,this.followState=r}isEpsilon(){return!0}}function m5(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};y5(e,t);const n=t.length;for(let r=0;r<n;r++){const i=t[r],s=Fs(e,i,i);s!==void 0&&C5(e,i,s)}return e}function y5(t,e){const n=e.length;for(let r=0;r<n;r++){const i=e[r],s=xt(t,i,void 0,{type:d5}),o=xt(t,i,void 0,{type:Uc});s.stop=o,t.ruleToStartState.set(i,s),t.ruleToStopState.set(i,o)}}function mS(t,e,n){return n instanceof Ye?Xm(t,e,n.terminalType,n):n instanceof Qt?_5(t,e,n):n instanceof dn?E5(t,e,n):n instanceof Mt?R5(t,e,n):n instanceof lt?v5(t,e,n):n instanceof un?w5(t,e,n):n instanceof Sn?b5(t,e,n):n instanceof $n?T5(t,e,n):Fs(t,e,n)}function v5(t,e,n){const r=xt(t,e,n,{type:hS});Mi(t,r);const i=Uo(t,e,r,n,Fs(t,e,n));return vS(t,e,n,i)}function w5(t,e,n){const r=xt(t,e,n,{type:hS});Mi(t,r);const i=Uo(t,e,r,n,Fs(t,e,n)),s=Xm(t,e,n.separator,n);return vS(t,e,n,i,s)}function b5(t,e,n){const r=xt(t,e,n,{type:fS});Mi(t,r);const i=Uo(t,e,r,n,Fs(t,e,n));return yS(t,e,n,i)}function T5(t,e,n){const r=xt(t,e,n,{type:fS});Mi(t,r);const i=Uo(t,e,r,n,Fs(t,e,n)),s=Xm(t,e,n.separator,n);return yS(t,e,n,i,s)}function E5(t,e,n){const r=xt(t,e,n,{type:Li});Mi(t,r);const i=Z(n.definition,o=>mS(t,e,o));return Uo(t,e,r,n,...i)}function R5(t,e,n){const r=xt(t,e,n,{type:Li});Mi(t,r);const i=Uo(t,e,r,n,Fs(t,e,n));return S5(t,e,n,i)}function Fs(t,e,n){const r=En(Z(n.definition,i=>mS(t,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:k5(t,r)}function yS(t,e,n,r,i){const s=r.left,o=r.right,a=xt(t,e,n,{type:g5});Mi(t,a);const c=xt(t,e,n,{type:pS});return s.loopback=a,c.loopback=a,t.decisionMap[jo(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=a,Rt(o,a),i===void 0?(Rt(a,s),Rt(a,c)):(Rt(a,c),Rt(a,i.left),Rt(i.right,s)),{left:s,right:c}}function vS(t,e,n,r,i){const s=r.left,o=r.right,a=xt(t,e,n,{type:p5});Mi(t,a);const c=xt(t,e,n,{type:pS}),l=xt(t,e,n,{type:h5});return a.loopback=l,c.loopback=l,Rt(a,s),Rt(a,c),Rt(o,l),i!==void 0?(Rt(l,c),Rt(l,i.left),Rt(i.right,s)):Rt(l,a),t.decisionMap[jo(e,i?"RepetitionWithSeparator":"Repetition",n.idx)]=a,{left:a,right:c}}function S5(t,e,n,r){const i=r.left,s=r.right;return Rt(i,s),t.decisionMap[jo(e,"Option",n.idx)]=i,r}function Mi(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function Uo(t,e,n,r,...i){const s=xt(t,e,r,{type:f5,start:n});n.end=s;for(const a of i)a!==void 0?(Rt(n,a.left),Rt(a.right,s)):Rt(n,s);const o={left:n,right:s};return t.decisionMap[jo(e,$5(r),r.idx)]=n,o}function $5(t){if(t instanceof dn)return"Alternation";if(t instanceof Mt)return"Option";if(t instanceof lt)return"Repetition";if(t instanceof un)return"RepetitionWithSeparator";if(t instanceof Sn)return"RepetitionMandatory";if(t instanceof $n)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function k5(t,e){const n=e.length;for(let s=0;s<n-1;s++){const o=e[s];let a;o.left.transitions.length===1&&(a=o.left.transitions[0]);const c=a instanceof Ym,l=a,u=e[s+1].left;o.left.type===Li&&o.right.type===Li&&a!==void 0&&(c&&l.followState===o.right||a.target===o.right)?(c?l.followState=u:a.target=u,A5(t,o.right)):Rt(o.right,u)}const r=e[0],i=e[n-1];return{left:r.left,right:i.right}}function Xm(t,e,n,r){const i=xt(t,e,r,{type:Li}),s=xt(t,e,r,{type:Li});return Jm(i,new Vm(s,n)),{left:i,right:s}}function _5(t,e,n){const r=n.referencedRule,i=t.ruleToStartState.get(r),s=xt(t,e,n,{type:Li}),o=xt(t,e,n,{type:Li}),a=new Ym(i,r,o);return Jm(s,a),{left:s,right:o}}function C5(t,e,n){const r=t.ruleToStartState.get(e);Rt(r,n.left);const i=t.ruleToStopState.get(e);return Rt(n.right,i),{left:r,right:i}}function Rt(t,e){const n=new gS(e);Jm(t,n)}function xt(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 Jm(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function A5(t,e){t.states.splice(t.states.indexOf(e),1)}const of={};class Qm{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const n=wS(e);n in this.map||(this.map[n]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return Z(this.configs,e=>e.alt)}get key(){let e="";for(const n in this.map)e+=n+":";return e}}function wS(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(n=>n.stateNumber.toString()).join("_")}`}function I5(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 bS{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 TS=new bS;class x5 extends zm{constructor(e){var n;super(),this.logging=(n=e?.logging)!==null&&n!==void 0?n:r=>console.log(r)}initialize(e){this.atn=m5(e.rules),this.dfas=P5(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:s}=e,o=this.dfas,a=this.logging,c=jo(r,"Alternation",n),u=this.atn.decisionMap[c].decision,d=Z(BR({maxLookahead:1,occurrence:n,prodType:"Alternation",rule:r}),f=>Z(f,h=>h[0]));if(ES(d,!1)&&!s){const f=Jt(d,(h,p,y)=>(se(p,R=>{R&&(h[R.tokenTypeIdx]=y,se(R.categoryMatches,b=>{h[b]=y}))}),h),{});return i?function(h){var p;const y=this.LA(1),R=f[y.tokenTypeIdx];if(h!==void 0&&R!==void 0){const b=(p=h[R])===null||p===void 0?void 0:p.GATE;if(b!==void 0&&b.call(this)===!1)return}return R}:function(){const h=this.LA(1);return f[h.tokenTypeIdx]}}else return i?function(f){const h=new bS,p=f===void 0?0:f.length;for(let R=0;R<p;R++){const b=f?.[R].GATE;h.set(R,b===void 0||b.call(this))}const y=Zm.call(this,o,u,h,a);return typeof y=="number"?y:void 0}:function(){const f=Zm.call(this,o,u,TS,a);return typeof f=="number"?f:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:n,rule:r,prodType:i,dynamicTokensEnabled:s}=e,o=this.dfas,a=this.logging,c=jo(r,i,n),u=this.atn.decisionMap[c].decision,d=Z(BR({maxLookahead:1,occurrence:n,prodType:i,rule:r}),f=>Z(f,h=>h[0]));if(ES(d)&&d[0][0]&&!s){const f=d[0],h=Mn(f);if(h.length===1&&qe(h[0].categoryMatches)){const y=h[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===y}}else{const p=Jt(h,(y,R)=>(R!==void 0&&(y[R.tokenTypeIdx]=!0,se(R.categoryMatches,b=>{y[b]=!0})),y),{});return function(){const y=this.LA(1);return p[y.tokenTypeIdx]===!0}}}return function(){const f=Zm.call(this,o,u,TS,a);return typeof f=="object"?!1:f===0}}}function ES(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 o=[s.tokenTypeIdx].concat(s.categoryMatches);for(const a of o)if(n.has(a)){if(!i.has(a))return!1}else n.add(a),i.add(a)}}return!0}function P5(t){const e=t.decisionStates.length,n=Array(e);for(let r=0;r<e;r++)n[r]=I5(t.decisionStates[r],r);return n}function Zm(t,e,n,r){const i=t[e](n);let s=i.start;if(s===void 0){const a=W5(i.atnStartState);s=$S(i,RS(a)),i.start=s}return N5.apply(this,[i,s,n,r])}function N5(t,e,n,r){let i=e,s=1;const o=[];let a=this.LA(s++);for(;;){let c=j5(i,a);if(c===void 0&&(c=D5.apply(this,[t,i,a,s,n,r])),c===of)return F5(o,i,a);if(c.isAcceptState===!0)return c.prediction;i=c,o.push(a),a=this.LA(s++)}}function D5(t,e,n,r,i,s){const o=U5(e.configs,n,i);if(o.size===0)return SS(t,e,n,of),of;let a=RS(o);const c=q5(o,i);if(c!==void 0)a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c;else if(K5(o)){const l=XU(o.alts);a.isAcceptState=!0,a.prediction=l,a.configs.uniqueAlt=l,O5.apply(this,[t,r,o.alts,s])}return a=SS(t,e,n,a),a}function O5(t,e,n,r){const i=[];for(let l=1;l<=e;l++)i.push(this.LA(l).tokenType);const s=t.atnStartState,o=s.rule,a=s.production,c=L5({topLevelRule:o,ambiguityIndices:n,production:a,prefixPath:i});r(c)}function L5(t){const e=Z(t.prefixPath,i=>Mo(i)).join(", "),n=t.production.idx===0?"":t.production.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${M5(t.production)}${n}> inside <${t.topLevelRule.name}> Rule,
112
+ <${e}> may appears as a prefix path in all these alternatives.
113
+ `;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
114
+ For Further details.`,r}function M5(t){if(t instanceof Qt)return"SUBRULE";if(t instanceof Mt)return"OPTION";if(t instanceof dn)return"OR";if(t instanceof Sn)return"AT_LEAST_ONE";if(t instanceof $n)return"AT_LEAST_ONE_SEP";if(t instanceof un)return"MANY_SEP";if(t instanceof lt)return"MANY";if(t instanceof Ye)return"CONSUME";throw Error("non exhaustive match")}function F5(t,e,n){const r=Rn(e.configs.elements,s=>s.state.transitions),i=oB(r.filter(s=>s instanceof Vm).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function j5(t,e){return t.edges[e.tokenTypeIdx]}function U5(t,e,n){const r=new Qm,i=[];for(const o of t.elements){if(n.is(o.alt)===!1)continue;if(o.state.type===Uc){i.push(o);continue}const a=o.state.transitions.length;for(let c=0;c<a;c++){const l=o.state.transitions[c],u=B5(l,e);u!==void 0&&r.add({state:u,alt:o.alt,stack:o.stack})}}let s;if(i.length===0&&r.size===1&&(s=r),s===void 0){s=new Qm;for(const o of r.elements)af(o,s)}if(i.length>0&&!z5(s))for(const o of i)s.add(o);return s}function B5(t,e){if(t instanceof Vm&&MR(e,t.tokenType))return t.target}function q5(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 RS(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function SS(t,e,n,r){return r=$S(t,r),e.edges[n.tokenTypeIdx]=r,r}function $S(t,e){if(e===of)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 W5(t){const e=new Qm,n=t.transitions.length;for(let r=0;r<n;r++){const s={state:t.transitions[r].target,alt:r,stack:[]};af(s,e)}return e}function af(t,e){const n=t.state;if(n.type===Uc){if(t.stack.length>0){const i=[...t.stack],o={state:i.pop(),alt:t.alt,stack:i};af(o,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],o=G5(t,s);o!==void 0&&af(o,e)}}function G5(t,e){if(e instanceof gS)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof Ym){const n=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:n}}}function z5(t){for(const e of t.elements)if(e.state.type===Uc)return!0;return!1}function H5(t){for(const e of t.elements)if(e.state.type!==Uc)return!1;return!0}function K5(t){if(H5(t))return!0;const e=V5(t.elements);return Y5(e)&&!X5(e)}function V5(t){const e=new Map;for(const n of t){const r=wS(n,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[n.alt]=!0}return e}function Y5(t){for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function X5(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var kS;(function(t){function e(n){return typeof n=="string"}t.is=e})(kS||(kS={}));var ey;(function(t){function e(n){return typeof n=="string"}t.is=e})(ey||(ey={}));var _S;(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})(_S||(_S={}));var cf;(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})(cf||(cf={}));var Ne;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=cf.MAX_VALUE),i===Number.MAX_VALUE&&(i=cf.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return D.objectLiteral(i)&&D.uinteger(i.line)&&D.uinteger(i.character)}t.is=n})(Ne||(Ne={}));var Ee;(function(t){function e(r,i,s,o){if(D.uinteger(r)&&D.uinteger(i)&&D.uinteger(s)&&D.uinteger(o))return{start:Ne.create(r,i),end:Ne.create(s,o)};if(Ne.is(r)&&Ne.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${s}, ${o}]`)}t.create=e;function n(r){let i=r;return D.objectLiteral(i)&&Ne.is(i.start)&&Ne.is(i.end)}t.is=n})(Ee||(Ee={}));var lf;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return D.objectLiteral(i)&&Ee.is(i.range)&&(D.string(i.uri)||D.undefined(i.uri))}t.is=n})(lf||(lf={}));var CS;(function(t){function e(r,i,s,o){return{targetUri:r,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}t.create=e;function n(r){let i=r;return D.objectLiteral(i)&&Ee.is(i.targetRange)&&D.string(i.targetUri)&&Ee.is(i.targetSelectionRange)&&(Ee.is(i.originSelectionRange)||D.undefined(i.originSelectionRange))}t.is=n})(CS||(CS={}));var ty;(function(t){function e(r,i,s,o){return{red:r,green:i,blue:s,alpha:o}}t.create=e;function n(r){const i=r;return D.objectLiteral(i)&&D.numberRange(i.red,0,1)&&D.numberRange(i.green,0,1)&&D.numberRange(i.blue,0,1)&&D.numberRange(i.alpha,0,1)}t.is=n})(ty||(ty={}));var AS;(function(t){function e(r,i){return{range:r,color:i}}t.create=e;function n(r){const i=r;return D.objectLiteral(i)&&Ee.is(i.range)&&ty.is(i.color)}t.is=n})(AS||(AS={}));var IS;(function(t){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}t.create=e;function n(r){const i=r;return D.objectLiteral(i)&&D.string(i.label)&&(D.undefined(i.textEdit)||en.is(i))&&(D.undefined(i.additionalTextEdits)||D.typedArray(i.additionalTextEdits,en.is))}t.is=n})(IS||(IS={}));var xS;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(xS||(xS={}));var PS;(function(t){function e(r,i,s,o,a,c){const l={startLine:r,endLine:i};return D.defined(s)&&(l.startCharacter=s),D.defined(o)&&(l.endCharacter=o),D.defined(a)&&(l.kind=a),D.defined(c)&&(l.collapsedText=c),l}t.create=e;function n(r){const i=r;return D.objectLiteral(i)&&D.uinteger(i.startLine)&&D.uinteger(i.startLine)&&(D.undefined(i.startCharacter)||D.uinteger(i.startCharacter))&&(D.undefined(i.endCharacter)||D.uinteger(i.endCharacter))&&(D.undefined(i.kind)||D.string(i.kind))}t.is=n})(PS||(PS={}));var ny;(function(t){function e(r,i){return{location:r,message:i}}t.create=e;function n(r){let i=r;return D.defined(i)&&lf.is(i.location)&&D.string(i.message)}t.is=n})(ny||(ny={}));var Bc;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Bc||(Bc={}));var NS;(function(t){t.Unnecessary=1,t.Deprecated=2})(NS||(NS={}));var DS;(function(t){function e(n){const r=n;return D.objectLiteral(r)&&D.string(r.href)}t.is=e})(DS||(DS={}));var uf;(function(t){function e(r,i,s,o,a,c){let l={range:r,message:i};return D.defined(s)&&(l.severity=s),D.defined(o)&&(l.code=o),D.defined(a)&&(l.source=a),D.defined(c)&&(l.relatedInformation=c),l}t.create=e;function n(r){var i;let s=r;return D.defined(s)&&Ee.is(s.range)&&D.string(s.message)&&(D.number(s.severity)||D.undefined(s.severity))&&(D.integer(s.code)||D.string(s.code)||D.undefined(s.code))&&(D.undefined(s.codeDescription)||D.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(D.string(s.source)||D.undefined(s.source))&&(D.undefined(s.relatedInformation)||D.typedArray(s.relatedInformation,ny.is))}t.is=n})(uf||(uf={}));var Bo;(function(t){function e(r,i,...s){let o={title:r,command:i};return D.defined(s)&&s.length>0&&(o.arguments=s),o}t.create=e;function n(r){let i=r;return D.defined(i)&&D.string(i.title)&&D.string(i.command)}t.is=n})(Bo||(Bo={}));var en;(function(t){function e(s,o){return{range:s,newText:o}}t.replace=e;function n(s,o){return{range:{start:s,end:s},newText:o}}t.insert=n;function r(s){return{range:s,newText:""}}t.del=r;function i(s){const o=s;return D.objectLiteral(o)&&D.string(o.newText)&&Ee.is(o.range)}t.is=i})(en||(en={}));var ry;(function(t){function e(r,i,s){const o={label:r};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}t.create=e;function n(r){const i=r;return D.objectLiteral(i)&&D.string(i.label)&&(D.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(D.string(i.description)||i.description===void 0)}t.is=n})(ry||(ry={}));var qo;(function(t){function e(n){const r=n;return D.string(r)}t.is=e})(qo||(qo={}));var OS;(function(t){function e(s,o,a){return{range:s,newText:o,annotationId:a}}t.replace=e;function n(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}t.insert=n;function r(s,o){return{range:s,newText:"",annotationId:o}}t.del=r;function i(s){const o=s;return en.is(o)&&(ry.is(o.annotationId)||qo.is(o.annotationId))}t.is=i})(OS||(OS={}));var iy;(function(t){function e(r,i){return{textDocument:r,edits:i}}t.create=e;function n(r){let i=r;return D.defined(i)&&ly.is(i.textDocument)&&Array.isArray(i.edits)}t.is=n})(iy||(iy={}));var sy;(function(t){function e(r,i,s){let o={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function n(r){let i=r;return i&&i.kind==="create"&&D.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||D.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||D.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||qo.is(i.annotationId))}t.is=n})(sy||(sy={}));var oy;(function(t){function e(r,i,s,o){let a={kind:"rename",oldUri:r,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}t.create=e;function n(r){let i=r;return i&&i.kind==="rename"&&D.string(i.oldUri)&&D.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||D.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||D.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||qo.is(i.annotationId))}t.is=n})(oy||(oy={}));var ay;(function(t){function e(r,i,s){let o={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function n(r){let i=r;return i&&i.kind==="delete"&&D.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||D.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||D.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||qo.is(i.annotationId))}t.is=n})(ay||(ay={}));var cy;(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=>D.string(i.kind)?sy.is(i)||oy.is(i)||ay.is(i):iy.is(i)))}t.is=e})(cy||(cy={}));var LS;(function(t){function e(r){return{uri:r}}t.create=e;function n(r){let i=r;return D.defined(i)&&D.string(i.uri)}t.is=n})(LS||(LS={}));var MS;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return D.defined(i)&&D.string(i.uri)&&D.integer(i.version)}t.is=n})(MS||(MS={}));var ly;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return D.defined(i)&&D.string(i.uri)&&(i.version===null||D.integer(i.version))}t.is=n})(ly||(ly={}));var FS;(function(t){function e(r,i,s,o){return{uri:r,languageId:i,version:s,text:o}}t.create=e;function n(r){let i=r;return D.defined(i)&&D.string(i.uri)&&D.string(i.languageId)&&D.integer(i.version)&&D.string(i.text)}t.is=n})(FS||(FS={}));var uy;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(n){const r=n;return r===t.PlainText||r===t.Markdown}t.is=e})(uy||(uy={}));var qc;(function(t){function e(n){const r=n;return D.objectLiteral(n)&&uy.is(r.kind)&&D.string(r.value)}t.is=e})(qc||(qc={}));var $r;(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})($r||($r={}));var jS;(function(t){t.PlainText=1,t.Snippet=2})(jS||(jS={}));var US;(function(t){t.Deprecated=1})(US||(US={}));var BS;(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&&D.string(i.newText)&&Ee.is(i.insert)&&Ee.is(i.replace)}t.is=n})(BS||(BS={}));var qS;(function(t){t.asIs=1,t.adjustIndentation=2})(qS||(qS={}));var WS;(function(t){function e(n){const r=n;return r&&(D.string(r.detail)||r.detail===void 0)&&(D.string(r.description)||r.description===void 0)}t.is=e})(WS||(WS={}));var GS;(function(t){function e(n){return{label:n}}t.create=e})(GS||(GS={}));var zS;(function(t){function e(n,r){return{items:n||[],isIncomplete:!!r}}t.create=e})(zS||(zS={}));var df;(function(t){function e(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function n(r){const i=r;return D.string(i)||D.objectLiteral(i)&&D.string(i.language)&&D.string(i.value)}t.is=n})(df||(df={}));var HS;(function(t){function e(n){let r=n;return!!r&&D.objectLiteral(r)&&(qc.is(r.contents)||df.is(r.contents)||D.typedArray(r.contents,df.is))&&(n.range===void 0||Ee.is(n.range))}t.is=e})(HS||(HS={}));var KS;(function(t){function e(n,r){return r?{label:n,documentation:r}:{label:n}}t.create=e})(KS||(KS={}));var VS;(function(t){function e(n,r,...i){let s={label:n};return D.defined(r)&&(s.documentation=r),D.defined(i)?s.parameters=i:s.parameters=[],s}t.create=e})(VS||(VS={}));var YS;(function(t){t.Text=1,t.Read=2,t.Write=3})(YS||(YS={}));var XS;(function(t){function e(n,r){let i={range:n};return D.number(r)&&(i.kind=r),i}t.create=e})(XS||(XS={}));var nr;(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})(nr||(nr={}));var JS;(function(t){t.Deprecated=1})(JS||(JS={}));var QS;(function(t){function e(n,r,i,s,o){let a={name:n,kind:r,location:{uri:s,range:i}};return o&&(a.containerName=o),a}t.create=e})(QS||(QS={}));var ZS;(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})(ZS||(ZS={}));var e$;(function(t){function e(r,i,s,o,a,c){let l={name:r,detail:i,kind:s,range:o,selectionRange:a};return c!==void 0&&(l.children=c),l}t.create=e;function n(r){let i=r;return i&&D.string(i.name)&&D.number(i.kind)&&Ee.is(i.range)&&Ee.is(i.selectionRange)&&(i.detail===void 0||D.string(i.detail))&&(i.deprecated===void 0||D.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=n})(e$||(e$={}));var t$;(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"})(t$||(t$={}));var ff;(function(t){t.Invoked=1,t.Automatic=2})(ff||(ff={}));var n$;(function(t){function e(r,i,s){let o={diagnostics:r};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}t.create=e;function n(r){let i=r;return D.defined(i)&&D.typedArray(i.diagnostics,uf.is)&&(i.only===void 0||D.typedArray(i.only,D.string))&&(i.triggerKind===void 0||i.triggerKind===ff.Invoked||i.triggerKind===ff.Automatic)}t.is=n})(n$||(n$={}));var r$;(function(t){function e(r,i,s){let o={title:r},a=!0;return typeof i=="string"?(a=!1,o.kind=i):Bo.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}t.create=e;function n(r){let i=r;return i&&D.string(i.title)&&(i.diagnostics===void 0||D.typedArray(i.diagnostics,uf.is))&&(i.kind===void 0||D.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Bo.is(i.command))&&(i.isPreferred===void 0||D.boolean(i.isPreferred))&&(i.edit===void 0||cy.is(i.edit))}t.is=n})(r$||(r$={}));var i$;(function(t){function e(r,i){let s={range:r};return D.defined(i)&&(s.data=i),s}t.create=e;function n(r){let i=r;return D.defined(i)&&Ee.is(i.range)&&(D.undefined(i.command)||Bo.is(i.command))}t.is=n})(i$||(i$={}));var s$;(function(t){function e(r,i){return{tabSize:r,insertSpaces:i}}t.create=e;function n(r){let i=r;return D.defined(i)&&D.uinteger(i.tabSize)&&D.boolean(i.insertSpaces)}t.is=n})(s$||(s$={}));var o$;(function(t){function e(r,i,s){return{range:r,target:i,data:s}}t.create=e;function n(r){let i=r;return D.defined(i)&&Ee.is(i.range)&&(D.undefined(i.target)||D.string(i.target))}t.is=n})(o$||(o$={}));var a$;(function(t){function e(r,i){return{range:r,parent:i}}t.create=e;function n(r){let i=r;return D.objectLiteral(i)&&Ee.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=n})(a$||(a$={}));var xe;(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"})(xe||(xe={}));var it;(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"})(it||(it={}));var c$;(function(t){function e(n){const r=n;return D.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})(c$||(c$={}));var l$;(function(t){function e(r,i){return{range:r,text:i}}t.create=e;function n(r){const i=r;return i!=null&&Ee.is(i.range)&&D.string(i.text)}t.is=n})(l$||(l$={}));var u$;(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&&Ee.is(i.range)&&D.boolean(i.caseSensitiveLookup)&&(D.string(i.variableName)||i.variableName===void 0)}t.is=n})(u$||(u$={}));var d$;(function(t){function e(r,i){return{range:r,expression:i}}t.create=e;function n(r){const i=r;return i!=null&&Ee.is(i.range)&&(D.string(i.expression)||i.expression===void 0)}t.is=n})(d$||(d$={}));var f$;(function(t){function e(r,i){return{frameId:r,stoppedLocation:i}}t.create=e;function n(r){const i=r;return D.defined(i)&&Ee.is(r.stoppedLocation)}t.is=n})(f$||(f$={}));var dy;(function(t){t.Type=1,t.Parameter=2;function e(n){return n===1||n===2}t.is=e})(dy||(dy={}));var fy;(function(t){function e(r){return{value:r}}t.create=e;function n(r){const i=r;return D.objectLiteral(i)&&(i.tooltip===void 0||D.string(i.tooltip)||qc.is(i.tooltip))&&(i.location===void 0||lf.is(i.location))&&(i.command===void 0||Bo.is(i.command))}t.is=n})(fy||(fy={}));var h$;(function(t){function e(r,i,s){const o={position:r,label:i};return s!==void 0&&(o.kind=s),o}t.create=e;function n(r){const i=r;return D.objectLiteral(i)&&Ne.is(i.position)&&(D.string(i.label)||D.typedArray(i.label,fy.is))&&(i.kind===void 0||dy.is(i.kind))&&i.textEdits===void 0||D.typedArray(i.textEdits,en.is)&&(i.tooltip===void 0||D.string(i.tooltip)||qc.is(i.tooltip))&&(i.paddingLeft===void 0||D.boolean(i.paddingLeft))&&(i.paddingRight===void 0||D.boolean(i.paddingRight))}t.is=n})(h$||(h$={}));var p$;(function(t){function e(n){return{kind:"snippet",value:n}}t.createSnippet=e})(p$||(p$={}));var g$;(function(t){function e(n,r,i,s){return{insertText:n,filterText:r,range:i,command:s}}t.create=e})(g$||(g$={}));var m$;(function(t){function e(n){return{items:n}}t.create=e})(m$||(m$={}));var y$;(function(t){t.Invoked=0,t.Automatic=1})(y$||(y$={}));var v$;(function(t){function e(n,r){return{range:n,text:r}}t.create=e})(v$||(v$={}));var w$;(function(t){function e(n,r){return{triggerKind:n,selectedCompletionInfo:r}}t.create=e})(w$||(w$={}));var b$;(function(t){function e(n){const r=n;return D.objectLiteral(r)&&ey.is(r.uri)&&D.string(r.name)}t.is=e})(b$||(b$={}));var T$;(function(t){function e(s,o,a,c){return new J5(s,o,a,c)}t.create=e;function n(s){let o=s;return!!(D.defined(o)&&D.string(o.uri)&&(D.undefined(o.languageId)||D.string(o.languageId))&&D.uinteger(o.lineCount)&&D.func(o.getText)&&D.func(o.positionAt)&&D.func(o.offsetAt))}t.is=n;function r(s,o){let a=s.getText(),c=i(o,(u,d)=>{let f=u.range.start.line-d.range.start.line;return f===0?u.range.start.character-d.range.start.character:f}),l=a.length;for(let u=c.length-1;u>=0;u--){let d=c[u],f=s.offsetAt(d.range.start),h=s.offsetAt(d.range.end);if(h<=l)a=a.substring(0,f)+d.newText+a.substring(h,a.length);else throw new Error("Overlapping edit");l=f}return a}t.applyEdits=r;function i(s,o){if(s.length<=1)return s;const a=s.length/2|0,c=s.slice(0,a),l=s.slice(a);i(c,o),i(l,o);let u=0,d=0,f=0;for(;u<c.length&&d<l.length;)o(c[u],l[d])<=0?s[f++]=c[u++]:s[f++]=l[d++];for(;u<c.length;)s[f++]=c[u++];for(;d<l.length;)s[f++]=l[d++];return s}})(T$||(T$={}));let J5=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===`
115
+ `,s==="\r"&&i+1<n.length&&n.charAt(i+1)===`
116
+ `&&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 Ne.create(0,e);for(;r<i;){let o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+1}let s=r-1;return Ne.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 D;(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 o(h){return e.call(h)==="[object Number]"}t.number=o;function a(h,p,y){return e.call(h)==="[object Number]"&&p<=h&&h<=y}t.numberRange=a;function c(h){return e.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}t.integer=c;function l(h){return e.call(h)==="[object Number]"&&0<=h&&h<=2147483647}t.uinteger=l;function u(h){return e.call(h)==="[object Function]"}t.func=u;function d(h){return h!==null&&typeof h=="object"}t.objectLiteral=d;function f(h,p){return Array.isArray(h)&&h.every(p)}t.typedArray=f})(D||(D={}));class Q5{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new R$(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const n=new py;return n.grammarSource=e,n.root=this.rootNode,this.current.content.push(n),this.nodeStack.push(n),n}buildLeafNode(e,n){const r=new hy(e.startOffset,e.image.length,Zu(e),e.tokenType,!1);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)}}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)}addHiddenTokens(e){for(const n of e){const r=new hy(n.startOffset,n.image.length,Zu(n),n.tokenType,!0);r.root=this.rootNode,this.addHiddenToken(this.rootNode,r)}}addHiddenToken(e,n){const{offset:r,end:i}=n;for(let s=0;s<e.content.length;s++){const o=e.content[s],{offset:a,end:c}=o;if(Hr(o)&&r>a&&i<c){this.addHiddenToken(o,n);return}else if(i<=a){e.content.splice(s,0,n);return}}e.content.push(n)}}class E${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 hy extends E${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 py extends E${constructor(){super(...arguments),this.content=new Nb(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:Ne.create(0,0),end:Ne.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 Nb extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,Nb.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 R$ extends py{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const gy=Symbol("Datatype");function my(t){return t.$type===gy}const S$="\u200B",$$=t=>t.endsWith(S$)?t:t+S$;class k${constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;const n=this.lexer.definition;this.wrapper=new rq(n,Object.assign(Object.assign({},e.parser.ParserConfig),{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 Z5 extends k${get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Q5,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($$(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(bd(e))return gy;{const n=Is(e);return n??e.name}}}parse(e,n={}){this.nodeBuilder.buildRootNode(e);const r=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.addHiddenTokens(r.hidden),this.unorderedGroups.clear(),{value:s,lexerErrors:r.errors,lexerReport:r.report,parserErrors:this.wrapper.errors}}startImplementation(e,n){return r=>{if(!this.isRecording()){const s={$type:e};this.stack.push(s),e===gy&&(s.value="")}let i;try{i=n(r)}catch{i=void 0}return!this.isRecording()&&i===void 0&&(i=this.construct()),i}}consume(e,n,r){const i=this.wrapper.wrapConsume(e,n);if(!this.isRecording()&&this.isValidToken(i)){const s=this.nodeBuilder.buildLeafNode(i,r),{assignment:o,isCrossRef:a}=this.getAssignment(r),c=this.current;if(o){const l=vr(r)?i.image:this.converter.convert(i.image,s);this.assign(o.operator,o.feature,l,s,a)}else if(my(c)){let l=i.image;vr(r)||(l=this.converter.convert(l,s).toString()),c.value+=l}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,n,r,i){let s;this.isRecording()||(s=this.nodeBuilder.buildCompositeNode(r));const o=this.wrapper.wrapSubrule(e,n,i);!this.isRecording()&&s&&s.length>0&&this.performSubruleAssignment(o,r,s)}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 o=this.current;if(my(o))o.value+=e.toString();else if(typeof e=="object"&&e){const a=e.$type,c=this.assignWithoutOverride(e,o);a&&(c.$type=a);const l=c;this.stack.pop(),this.stack.push(l)}}}action(e,n){if(!this.isRecording()){let r=this.current;if(n.feature&&n.operator){r=this.construct(),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 Bg(e),this.nodeBuilder.construct(e),this.stack.pop(),my(e)?this.converter.convert(e.value,e.$cstNode):(Gg(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){const n=an(e,yr);this.assignmentMap.set(e,{assignment:n,isCrossRef:n?ic(n.terminal):!1})}return this.assignmentMap.get(e)}assign(e,n,r,i,s){const o=this.current;let a;switch(s&&typeof r=="string"?a=this.linker.buildReference(o,n,i,r):a=r,e){case"=":{o[n]=a;break}case"?=":{o[n]=!0;break}case"+=":Array.isArray(o[n])||(o[n]=[]),o[n].push(a)}}assignWithoutOverride(e,n){for(const[i,s]of Object.entries(n)){const o=e[i];o===void 0?e[i]=s:Array.isArray(o)&&Array.isArray(s)&&(s.push(...o),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 eq{buildMismatchTokenMessage(e){return Fo.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Fo.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Fo.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Fo.buildEarlyExitMessage(e)}}class _$ extends eq{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 tq extends k${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($$(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){this.before(r),this.wrapper.wrapSubrule(e,n,i),this.after(r)}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 nq={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new _$};class rq extends u5{constructor(e,n){const r=n&&"maxLookahead"in n;super(e,Object.assign(Object.assign(Object.assign({},nq),{lookaheadStrategy:r?new zm({maxLookahead:n.maxLookahead}):new x5}),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 C$(t,e,n){return iq({parser:e,tokens:n,ruleNames:new Map},t),e}function iq(t,e){const n=Yg(e,!1),r=Me(e.rules).filter(Bt).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,js(s,i.definition))}}function js(t,e,n=!1){let r;if(vr(e))r=dq(t,e);else if(As(e))r=sq(t,e);else if(yr(e))r=js(t,e.terminal);else if(ic(e))r=A$(t,e);else if(Vr(e))r=oq(t,e);else if(jg(e))r=cq(t,e);else if(Ug(e))r=lq(t,e);else if(Ii(e))r=uq(t,e);else if(ZL(e)){const i=t.consume++;r=()=>t.parser.consume(i,Di,e)}else throw new xT(e.$cstNode,`Unexpected element type: ${e.$type}`);return I$(t,n?void 0:hf(e),r,e.cardinality)}function sq(t,e){const n=bc(e);return()=>t.parser.action(n,e)}function oq(t,e){const n=e.rule.ref;if(Bt(n)){const r=t.subrule++,i=e.arguments.length>0?aq(n,e.arguments):()=>({});return s=>t.parser.subrule(r,x$(t,n),e,i(s))}else if(Kr(n)){const r=t.consume++,i=yy(t,n.name);return()=>t.parser.consume(r,i,e)}else if(n)nd();else throw new xT(e.$cstNode,`Undefined rule type: ${e.$type}`)}function aq(t,e){const n=e.map(r=>ri(r.value));return r=>{const i={};for(let s=0;s<n.length;s++){const o=t.parameters[s],a=n[s];i[o.name]=a(r)}return i}}function ri(t){if(HL(t)){const e=ri(t.left),n=ri(t.right);return r=>e(r)||n(r)}else if(zL(t)){const e=ri(t.left),n=ri(t.right);return r=>e(r)&&n(r)}else if(KL(t)){const e=ri(t.value);return n=>!e(n)}else if(VL(t)){const e=t.parameter.ref.name;return n=>n!==void 0&&n[e]===!0}else if(GL(t)){const e=!!t.true;return()=>e}nd()}function cq(t,e){if(e.elements.length===1)return js(t,e.elements[0]);{const n=[];for(const i of e.elements){const s={ALT:js(t,i,!0)},o=hf(i);o&&(s.GATE=ri(o)),n.push(s)}const r=t.or++;return i=>t.parser.alternatives(r,n.map(s=>{const o={ALT:()=>s.ALT(i)},a=s.GATE;return a&&(o.GATE=()=>a(i)),o}))}}function lq(t,e){if(e.elements.length===1)return js(t,e.elements[0]);const n=[];for(const a of e.elements){const c={ALT:js(t,a,!0)},l=hf(a);l&&(c.GATE=ri(l)),n.push(c)}const r=t.or++,i=(a,c)=>{const l=c.getRuleStack().join("-");return`uGroup_${a}_${l}`},s=a=>t.parser.alternatives(r,n.map((c,l)=>{const u={ALT:()=>!0},d=t.parser;u.ALT=()=>{if(c.ALT(a),!d.isRecording()){const h=i(r,d);d.unorderedGroups.get(h)||d.unorderedGroups.set(h,[]);const p=d.unorderedGroups.get(h);typeof p?.[l]>"u"&&(p[l]=!0)}};const f=c.GATE;return f?u.GATE=()=>f(a):u.GATE=()=>{const h=d.unorderedGroups.get(i(r,d));return!h?.[l]},u})),o=I$(t,hf(e),s,"*");return a=>{o(a),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(r,t.parser))}}function uq(t,e){const n=e.elements.map(r=>js(t,r));return r=>n.forEach(i=>i(r))}function hf(t){if(Ii(t))return t.guardCondition}function A$(t,e,n=e.terminal){if(n)if(Vr(n)&&Bt(n.rule.ref)){const r=t.subrule++;return i=>t.parser.subrule(r,x$(t,n.rule.ref),e,i)}else if(Vr(n)&&Kr(n.rule.ref)){const r=t.consume++,i=yy(t,n.rule.ref.name);return()=>t.parser.consume(r,i,e)}else if(vr(n)){const r=t.consume++,i=yy(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: "+bc(e.type.ref));return A$(t,e,i)}}function dq(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 I$(t,e,n,r){const i=e&&ri(e);if(!r)if(i){const s=t.or++;return o=>t.parser.alternatives(s,[{ALT:()=>n(o),GATE:()=>i(o)},{ALT:dS(),GATE:()=>!i(o)}])}else return n;if(r==="*"){const s=t.many++;return o=>t.parser.many(s,{DEF:()=>n(o),GATE:i?()=>i(o):void 0})}else if(r==="+"){const s=t.many++;if(i){const o=t.or++;return a=>t.parser.alternatives(o,[{ALT:()=>t.parser.atLeastOne(s,{DEF:()=>n(a)}),GATE:()=>i(a)},{ALT:dS(),GATE:()=>!i(a)}])}else return o=>t.parser.atLeastOne(s,{DEF:()=>n(o)})}else if(r==="?"){const s=t.optional++;return o=>t.parser.optional(s,{DEF:()=>n(o),GATE:i?()=>i(o):void 0})}else nd()}function x$(t,e){const n=fq(t,e),r=t.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function fq(t,e){if(Bt(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let n=e,r=n.$container,i=e.$type;for(;!Bt(r);)(Ii(r)||jg(r)||Ug(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 yy(t,e){const n=t.tokens[e];if(!n)throw new Error(`Token "${e}" not found."`);return n}function hq(t){const e=t.Grammar,n=t.parser.Lexer,r=new tq(t);return C$(e,r,n.definition),r.finalize(),r}function pq(t){const e=gq(t);return e.finalize(),e}function gq(t){const e=t.Grammar,n=t.parser.Lexer,r=new Z5(t);return C$(e,r,n.definition)}class mq{constructor(){this.diagnostics=[]}buildTokens(e,n){const r=Me(Yg(e,!1)),i=this.buildTerminalTokens(r),s=this.buildKeywordTokens(r,i,n);return i.forEach(o=>{const a=o.PATTERN;typeof a=="object"&&a&&"test"in a&&Vg(a)?s.unshift(o):s.push(o)}),s}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Kr).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(e){const n=Tc(e),r=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,i={name:e.name,PATTERN:r,LINE_BREAKS:!0};return e.hidden&&(i.GROUP=Vg(n)?fn.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(Bt).flatMap(i=>wr(i).filter(vr)).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){return{name:e.value,PATTERN:this.buildKeywordPattern(e,r),LONGER_ALT:this.findLongerAlt(e,n)}}buildKeywordPattern(e,n){return n?new RegExp(pM(e.value)):e.value}findLongerAlt(e,n){return n.reduce((r,i)=>{const s=i?.PATTERN;return s?.source&&gM("^"+s.source+"$",e.value)&&r.push(i),r},[])}}class yq{convert(e,n){let r=n.grammarSource;if(ic(r)&&(r=Xg(r)),Vr(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 ii.convertInt(n);case"STRING":return ii.convertString(n);case"ID":return ii.convertID(n)}switch((i=QT(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return ii.convertNumber(n);case"boolean":return ii.convertBoolean(n);case"bigint":return ii.convertBigint(n);case"date":return ii.convertDate(n);default:return n}}}var ii;(function(t){function e(l){let u="";for(let d=1;d<l.length-1;d++){const f=l.charAt(d);if(f==="\\"){const h=l.charAt(++d);u+=n(h)}else u+=f}return u}t.convertString=e;function n(l){switch(l){case"b":return"\b";case"f":return"\f";case"n":return`
117
+ `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return l}}function r(l){return l.charAt(0)==="^"?l.substring(1):l}t.convertID=r;function i(l){return parseInt(l)}t.convertInt=i;function s(l){return BigInt(l)}t.convertBigint=s;function o(l){return new Date(l)}t.convertDate=o;function a(l){return Number(l)}t.convertNumber=a;function c(l){return l.toLowerCase()==="true"}t.convertBoolean=c})(ii||(ii={}));var Fi={},si={};Object.defineProperty(si,"__esModule",{value:!0});let vy;function wy(){if(vy===void 0)throw new Error("No runtime abstraction layer installed");return vy}(function(t){function e(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");vy=n}t.install=e})(wy||(wy={})),si.default=wy;var St={};Object.defineProperty(St,"__esModule",{value:!0}),St.stringArray=St.array=St.func=St.error=St.number=St.string=St.boolean=void 0;function vq(t){return t===!0||t===!1}St.boolean=vq;function P$(t){return typeof t=="string"||t instanceof String}St.string=P$;function wq(t){return typeof t=="number"||t instanceof Number}St.number=wq;function bq(t){return t instanceof Error}St.error=bq;function Tq(t){return typeof t=="function"}St.func=Tq;function N$(t){return Array.isArray(t)}St.array=N$;function Eq(t){return N$(t)&&t.every(e=>P$(e))}St.stringArray=Eq;var kr={};Object.defineProperty(kr,"__esModule",{value:!0});var D$=kr.Emitter=kr.Event=void 0;const Rq=si;var O$;(function(t){const e={dispose(){}};t.None=function(){return e}})(O$||(kr.Event=O$={}));class Sq{add(e,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,n)})}remove(e,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,s=this._callbacks.length;i<s;i++)if(this._callbacks[i]===e)if(this._contexts[i]===n){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];const n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let s=0,o=r.length;s<o;s++)try{n.push(r[s].apply(i[s],e))}catch(a){(0,Rq.default)().console.error(a)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}let L$=class EN{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,n,r)=>{this._callbacks||(this._callbacks=new Sq),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,n);const i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,n),i.dispose=EN._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};D$=kr.Emitter=L$,L$._noop=function(){};var Ze;Object.defineProperty(Fi,"__esModule",{value:!0});var by=Fi.CancellationTokenSource=Ze=Fi.CancellationToken=void 0;const $q=si,kq=St,Ty=kr;var pf;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ty.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ty.Event.None});function e(n){const r=n;return r&&(r===t.None||r===t.Cancelled||kq.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}t.is=e})(pf||(Ze=Fi.CancellationToken=pf={}));const _q=Object.freeze(function(t,e){const n=(0,$q.default)().timer.setTimeout(t.bind(e),0);return{dispose(){n.dispose()}}});class M${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?_q:(this._emitter||(this._emitter=new Ty.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class Cq{get token(){return this._token||(this._token=new M$),this._token}cancel(){this._token?this._token.cancel():this._token=pf.Cancelled}dispose(){this._token?this._token instanceof M$&&this._token.dispose():this._token=pf.None}}by=Fi.CancellationTokenSource=Cq;function Aq(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}let F$=0,Iq=10;const gf=Symbol("OperationCancelled");function mf(t){return t===gf}async function Pt(t){if(t===Ze.None)return;const e=Date.now();if(e-F$>=Iq&&(F$=e,await Aq()),t.isCancellationRequested)throw gf}class Ey{constructor(){this.promise=new Promise((e,n)=>{this.resolve=r=>(e(r),this),this.reject=r=>(n(r),this)})}}class Cu{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(Cu.isIncremental(r)){const i=U$(r.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(o,this._content.length);const a=Math.max(i.start.line,0),c=Math.max(i.end.line,0);let l=this._lineOffsets;const u=j$(r.text,!1,s);if(c-a===u.length)for(let f=0,h=u.length;f<h;f++)l[f+a+1]=u[f];else u.length<1e4?l.splice(a+1,c-a,...u):this._lineOffsets=l=l.slice(0,a+1).concat(u,l.slice(c+1));const d=r.text.length-(o-s);if(d!==0)for(let f=a+1+u.length,h=l.length;f<h;f++)l[f]=l[f]+d}else if(Cu.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=j$(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 o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+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 yf;(function(t){function e(i,s,o,a){return new Cu(i,s,o,a)}t.create=e;function n(i,s,o){if(i instanceof Cu)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){let o=i.getText(),a=Ry(s.map(xq),(u,d)=>{let f=u.range.start.line-d.range.start.line;return f===0?u.range.start.character-d.range.start.character:f}),c=0;const l=[];for(const u of a){let d=i.offsetAt(u.range.start);if(d<c)throw new Error("Overlapping edit");d>c&&l.push(o.substring(c,d)),u.newText.length&&l.push(u.newText),c=i.offsetAt(u.range.end)}return l.push(o.substr(c)),l.join("")}t.applyEdits=r})(yf||(yf={}));function Ry(t,e){if(t.length<=1)return t;const n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);Ry(r,e),Ry(i,e);let s=0,o=0,a=0;for(;s<r.length&&o<i.length;)e(r[s],i[o])<=0?t[a++]=r[s++]:t[a++]=i[o++];for(;s<r.length;)t[a++]=r[s++];for(;o<i.length;)t[a++]=i[o++];return t}function j$(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 U$(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 xq(t){const e=U$(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var B$;(()=>{var t={470:i=>{function s(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}function o(c,l){for(var u,d="",f=0,h=-1,p=0,y=0;y<=c.length;++y){if(y<c.length)u=c.charCodeAt(y);else{if(u===47)break;u=47}if(u===47){if(!(h===y-1||p===1))if(h!==y-1&&p===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,p=0;continue}}else if(d.length===2||d.length===1){d="",f=0,h=y,p=0;continue}}l&&(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,p=0}else u===46&&p!==-1?++p:p=-1}return d}var a={resolve:function(){for(var c,l="",u=!1,d=arguments.length-1;d>=-1&&!u;d--){var f;d>=0?f=arguments[d]:(c===void 0&&(c=process.cwd()),f=c),s(f),f.length!==0&&(l=f+"/"+l,u=f.charCodeAt(0)===47)}return l=o(l,!u),u?l.length>0?"/"+l:"/":l.length>0?l:"."},normalize:function(c){if(s(c),c.length===0)return".";var l=c.charCodeAt(0)===47,u=c.charCodeAt(c.length-1)===47;return(c=o(c,!l)).length!==0||l||(c="."),c.length>0&&u&&(c+="/"),l?"/"+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,l=0;l<arguments.length;++l){var u=arguments[l];s(u),u.length>0&&(c===void 0?c=u:c+="/"+u)}return c===void 0?".":a.normalize(c)},relative:function(c,l){if(s(c),s(l),c===l||(c=a.resolve(c))===(l=a.resolve(l)))return"";for(var u=1;u<c.length&&c.charCodeAt(u)===47;++u);for(var d=c.length,f=d-u,h=1;h<l.length&&l.charCodeAt(h)===47;++h);for(var p=l.length-h,y=f<p?f:p,R=-1,b=0;b<=y;++b){if(b===y){if(p>y){if(l.charCodeAt(h+b)===47)return l.slice(h+b+1);if(b===0)return l.slice(h+b)}else f>y&&(c.charCodeAt(u+b)===47?R=b:b===0&&(R=0));break}var v=c.charCodeAt(u+b);if(v!==l.charCodeAt(h+b))break;v===47&&(R=b)}var T="";for(b=u+R+1;b<=d;++b)b!==d&&c.charCodeAt(b)!==47||(T.length===0?T+="..":T+="/..");return T.length>0?T+l.slice(h+R):(h+=R,l.charCodeAt(h)===47&&++h,l.slice(h))},_makeLong:function(c){return c},dirname:function(c){if(s(c),c.length===0)return".";for(var l=c.charCodeAt(0),u=l===47,d=-1,f=!0,h=c.length-1;h>=1;--h)if((l=c.charCodeAt(h))===47){if(!f){d=h;break}}else f=!1;return d===-1?u?"/":".":u&&d===1?"//":c.slice(0,d)},basename:function(c,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');s(c);var u,d=0,f=-1,h=!0;if(l!==void 0&&l.length>0&&l.length<=c.length){if(l.length===c.length&&l===c)return"";var p=l.length-1,y=-1;for(u=c.length-1;u>=0;--u){var R=c.charCodeAt(u);if(R===47){if(!h){d=u+1;break}}else y===-1&&(h=!1,y=u+1),p>=0&&(R===l.charCodeAt(p)?--p==-1&&(f=u):(p=-1,f=y))}return d===f?f=y:f===-1&&(f=c.length),c.slice(d,f)}for(u=c.length-1;u>=0;--u)if(c.charCodeAt(u)===47){if(!h){d=u+1;break}}else f===-1&&(h=!1,f=u+1);return f===-1?"":c.slice(d,f)},extname:function(c){s(c);for(var l=-1,u=0,d=-1,f=!0,h=0,p=c.length-1;p>=0;--p){var y=c.charCodeAt(p);if(y!==47)d===-1&&(f=!1,d=p+1),y===46?l===-1?l=p:h!==1&&(h=1):l!==-1&&(h=-1);else if(!f){u=p+1;break}}return l===-1||d===-1||h===0||h===1&&l===d-1&&l===u+1?"":c.slice(l,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(l,u){var d=u.dir||u.root,f=u.base||(u.name||"")+(u.ext||"");return d?d===u.root?d+f:d+"/"+f:f}(0,c)},parse:function(c){s(c);var l={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return l;var u,d=c.charCodeAt(0),f=d===47;f?(l.root="/",u=1):u=0;for(var h=-1,p=0,y=-1,R=!0,b=c.length-1,v=0;b>=u;--b)if((d=c.charCodeAt(b))!==47)y===-1&&(R=!1,y=b+1),d===46?h===-1?h=b:v!==1&&(v=1):h!==-1&&(v=-1);else if(!R){p=b+1;break}return h===-1||y===-1||v===0||v===1&&h===y-1&&h===p+1?y!==-1&&(l.base=l.name=p===0&&f?c.slice(1,y):c.slice(p,y)):(p===0&&f?(l.name=c.slice(1,h),l.base=c.slice(1,y)):(l.name=c.slice(p,h),l.base=c.slice(p,y)),l.ext=c.slice(h,y)),p>0?l.dir=c.slice(0,p-1):f&&(l.dir="/"),l},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,i.exports=a}},e={};function n(i){var s=e[i];if(s!==void 0)return s.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,n),o.exports}n.d=(i,s)=>{for(var o in s)n.o(s,o)&&!n.o(i,o)&&Object.defineProperty(i,o,{enumerable:!0,get:s[o]})},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:()=>W}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);const s=/^\w[\w\d+.-]*$/,o=/^\//,a=/^\/\//;function c(I,k){if(!I.scheme&&k)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${I.authority}", path: "${I.path}", query: "${I.query}", fragment: "${I.fragment}"}`);if(I.scheme&&!s.test(I.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(I.path){if(I.authority){if(!o.test(I.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(a.test(I.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}const l="",u="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class f{static isUri(k){return k instanceof f||!!k&&typeof k.authority=="string"&&typeof k.fragment=="string"&&typeof k.path=="string"&&typeof k.query=="string"&&typeof k.scheme=="string"&&typeof k.fsPath=="string"&&typeof k.with=="function"&&typeof k.toString=="function"}scheme;authority;path;query;fragment;constructor(k,S,M,q,U,z=!1){typeof k=="object"?(this.scheme=k.scheme||l,this.authority=k.authority||l,this.path=k.path||l,this.query=k.query||l,this.fragment=k.fragment||l):(this.scheme=function(Pe,J){return Pe||J?Pe:"file"}(k,z),this.authority=S||l,this.path=function(Pe,J){switch(Pe){case"https":case"http":case"file":J?J[0]!==u&&(J=u+J):J=u}return J}(this.scheme,M||l),this.query=q||l,this.fragment=U||l,c(this,z))}get fsPath(){return v(this)}with(k){if(!k)return this;let{scheme:S,authority:M,path:q,query:U,fragment:z}=k;return S===void 0?S=this.scheme:S===null&&(S=l),M===void 0?M=this.authority:M===null&&(M=l),q===void 0?q=this.path:q===null&&(q=l),U===void 0?U=this.query:U===null&&(U=l),z===void 0?z=this.fragment:z===null&&(z=l),S===this.scheme&&M===this.authority&&q===this.path&&U===this.query&&z===this.fragment?this:new p(S,M,q,U,z)}static parse(k,S=!1){const M=d.exec(k);return M?new p(M[2]||l,F(M[4]||l),F(M[5]||l),F(M[7]||l),F(M[9]||l),S):new p(l,l,l,l,l)}static file(k){let S=l;if(i&&(k=k.replace(/\\/g,u)),k[0]===u&&k[1]===u){const M=k.indexOf(u,2);M===-1?(S=k.substring(2),k=u):(S=k.substring(2,M),k=k.substring(M)||u)}return new p("file",S,k,l,l)}static from(k){const S=new p(k.scheme,k.authority,k.path,k.query,k.fragment);return c(S,!0),S}toString(k=!1){return T(this,k)}toJSON(){return this}static revive(k){if(k){if(k instanceof f)return k;{const S=new p(k);return S._formatted=k.external,S._fsPath=k._sep===h?k.fsPath:null,S}}return k}}const h=i?1:void 0;class p extends f{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=v(this)),this._fsPath}toString(k=!1){return k?T(this,!0):(this._formatted||(this._formatted=T(this,!1)),this._formatted)}toJSON(){const k={$mid:1};return this._fsPath&&(k.fsPath=this._fsPath,k._sep=h),this._formatted&&(k.external=this._formatted),this.path&&(k.path=this.path),this.scheme&&(k.scheme=this.scheme),this.authority&&(k.authority=this.authority),this.query&&(k.query=this.query),this.fragment&&(k.fragment=this.fragment),k}}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(I,k,S){let M,q=-1;for(let U=0;U<I.length;U++){const z=I.charCodeAt(U);if(z>=97&&z<=122||z>=65&&z<=90||z>=48&&z<=57||z===45||z===46||z===95||z===126||k&&z===47||S&&z===91||S&&z===93||S&&z===58)q!==-1&&(M+=encodeURIComponent(I.substring(q,U)),q=-1),M!==void 0&&(M+=I.charAt(U));else{M===void 0&&(M=I.substr(0,U));const Pe=y[z];Pe!==void 0?(q!==-1&&(M+=encodeURIComponent(I.substring(q,U)),q=-1),M+=Pe):q===-1&&(q=U)}}return q!==-1&&(M+=encodeURIComponent(I.substring(q))),M!==void 0?M:I}function b(I){let k;for(let S=0;S<I.length;S++){const M=I.charCodeAt(S);M===35||M===63?(k===void 0&&(k=I.substr(0,S)),k+=y[M]):k!==void 0&&(k+=I[S])}return k!==void 0?k:I}function v(I,k){let S;return S=I.authority&&I.path.length>1&&I.scheme==="file"?`//${I.authority}${I.path}`:I.path.charCodeAt(0)===47&&(I.path.charCodeAt(1)>=65&&I.path.charCodeAt(1)<=90||I.path.charCodeAt(1)>=97&&I.path.charCodeAt(1)<=122)&&I.path.charCodeAt(2)===58?I.path[1].toLowerCase()+I.path.substr(2):I.path,i&&(S=S.replace(/\//g,"\\")),S}function T(I,k){const S=k?b:R;let M="",{scheme:q,authority:U,path:z,query:Pe,fragment:J}=I;if(q&&(M+=q,M+=":"),(U||q==="file")&&(M+=u,M+=u),U){let j=U.indexOf("@");if(j!==-1){const ge=U.substr(0,j);U=U.substr(j+1),j=ge.lastIndexOf(":"),j===-1?M+=S(ge,!1,!1):(M+=S(ge.substr(0,j),!1,!1),M+=":",M+=S(ge.substr(j+1),!1,!0)),M+="@"}U=U.toLowerCase(),j=U.lastIndexOf(":"),j===-1?M+=S(U,!1,!0):(M+=S(U.substr(0,j),!1,!0),M+=U.substr(j))}if(z){if(z.length>=3&&z.charCodeAt(0)===47&&z.charCodeAt(2)===58){const j=z.charCodeAt(1);j>=65&&j<=90&&(z=`/${String.fromCharCode(j+32)}:${z.substr(3)}`)}else if(z.length>=2&&z.charCodeAt(1)===58){const j=z.charCodeAt(0);j>=65&&j<=90&&(z=`${String.fromCharCode(j+32)}:${z.substr(2)}`)}M+=S(z,!0,!1)}return Pe&&(M+="?",M+=S(Pe,!1,!1)),J&&(M+="#",M+=k?J:R(J,!1,!1)),M}function _(I){try{return decodeURIComponent(I)}catch{return I.length>3?I.substr(0,3)+_(I.substr(3)):I}}const N=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function F(I){return I.match(N)?I.replace(N,k=>_(k)):I}var x=n(470);const G=x.posix||x,B="/";var W;(function(I){I.joinPath=function(k,...S){return k.with({path:G.join(k.path,...S)})},I.resolvePath=function(k,...S){let M=k.path,q=!1;M[0]!==B&&(M=B+M,q=!0);let U=G.resolve(M,...S);return q&&U[0]===B&&!k.authority&&(U=U.substring(1)),k.with({path:U})},I.dirname=function(k){if(k.path.length===0||k.path===B)return k;let S=G.dirname(k.path);return S.length===1&&S.charCodeAt(0)===46&&(S=""),k.with({path:S})},I.basename=function(k){return G.basename(k.path)},I.extname=function(k){return G.extname(k.path)}})(W||(W={}))})(),B$=r})();const{URI:qt,Utils:Wc}=B$;var mt;(function(t){t.basename=Wc.basename,t.dirname=Wc.dirname,t.extname=Wc.extname,t.joinPath=Wc.joinPath,t.resolvePath=Wc.resolvePath;function e(i,s){return i?.toString()===s?.toString()}t.equals=e;function n(i,s){const o=typeof i=="string"?i:i.path,a=typeof s=="string"?s:s.path,c=o.split("/").filter(h=>h.length>0),l=a.split("/").filter(h=>h.length>0);let u=0;for(;u<c.length&&c[u]===l[u];u++);const d="../".repeat(c.length-u),f=l.slice(u).join("/");return d+f}t.relative=n;function r(i){return qt.parse(i.toString()).toString()}t.normalize=r})(mt||(mt={}));var De;(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"})(De||(De={}));class Pq{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,n=Ze.None){const r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,n)}fromTextDocument(e,n,r){return n=n??qt.parse(e.uri),Ze.is(r)?this.createAsync(n,e,r):this.create(n,e,r)}fromString(e,n,r){return Ze.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:De.Parsed,references:[],textDocument:r};else{const o=this.createTextDocumentGetter(n,i);s={parseResult:e,uri:n,state:De.Parsed,references:[],get textDocument(){return o()}}}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,o=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),a=o?o.getText():await this.fileSystemProvider.readFile(e.uri);if(o)Object.defineProperty(e,"textDocument",{value:o});else{const c=this.createTextDocumentGetter(e.uri,a);Object.defineProperty(e,"textDocument",{get:c})}return s!==a&&(e.parseResult=await this.parseAsync(e.uri,a,n),e.parseResult.value.$document=e),e.state=De.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=yf.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,n??""))}}class Nq{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return Me(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=De.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=De.Changed,this.documentMap.delete(n)),r}}const Sy=Symbol("ref_resolving");class Dq{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=Ze.None){for(const r of Yr(e.parseResult.value))await Pt(n),fd(r).forEach(i=>this.doLink(i,e))}doLink(e,n){var r;const i=e.reference;if(i._ref===void 0){i._ref=Sy;try{const s=this.getCandidate(e);if(Ju(s))i._ref=s;else if(i._nodeDescription=s,this.langiumDocuments().hasDocument(s.documentUri)){const o=this.loadAstNode(s);i._ref=o??this.createLinkingError(e,s)}else i._ref=void 0}catch(s){console.error(`An error occurred while resolving reference to '${i.$refText}':`,s);const o=(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}': ${o}`})}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,o={$refNode:r,$refText:i,get ref(){var a;if(ct(this._ref))return this._ref;if(FL(this._nodeDescription)){const c=s.loadAstNode(this._nodeDescription);this._ref=c??s.createLinkingError({reference:o,container:e,property:n},this._nodeDescription)}else if(this._ref===void 0){this._ref=Sy;const c=dd(e).$document,l=s.getLinkedNode({reference:o,container:e,property:n});if(l.error&&c&&c.state<De.ComputedScopes)return this._ref=void 0;this._ref=(a=l.node)!==null&&a!==void 0?a:l.error,this._nodeDescription=l.descr,c?.references.push(this)}else if(this._ref===Sy)throw new Error(`Cyclic reference resolution detected: ${s.astNodeLocator.getAstNodePath(e)}/${n} (symbol '${i}')`);return ct(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return Ju(this._ref)?this._ref:void 0}};return o}getLinkedNode(e){var n;try{const r=this.getCandidate(e);if(Ju(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=dd(e.container).$document;r&&r.state<De.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 q$(t){return typeof t.name=="string"}class Oq{getName(e){if(q$(e))return e.name}getNameNode(e){return bn(e.$cstNode,"name")}}class Lq{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const n=HT(e),r=e.astNode;if(n&&r){const i=r[n.feature];if(Nn(i))return i.ref;if(Array.isArray(i)){for(const s of i)if(Nn(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||ST(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=>mt.equals(s.sourceUri,n.documentUri))),r.push(...i),Me(r)}getReferenceToSelf(e){const n=this.nameProvider.getNameNode(e);if(n){const r=Yt(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:r.uri,sourcePath:i,targetUri:r.uri,targetPath:i,segment:Fa(n),local:!0}}}}class _r{constructor(e){if(this.map=new Map,e)for(const[n,r]of e)this.add(n,r)}get size(){return _g.sum(Me(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 Me(this.map.entries()).flatMap(([e,n])=>n.map(r=>[e,r]))}keys(){return Me(this.map.keys())}values(){return Me(this.map.values()).flat()}entriesGroupedByKey(){return Me(this.map.entries())}}class W${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 G${constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,n=Ze.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,n)}async computeExportsForNode(e,n,r=yc,i=Ze.None){const s=[];this.exportNode(e,s,n);for(const o of r(e))await Pt(i),this.exportNode(o,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=Ze.None){const r=e.parseResult.value,i=new _r;for(const s of wr(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 Gc{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 z${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 o=this.caseInsensitive?s.name.toLowerCase():s.name;this.elements.set(o,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=Me(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}const H$={getElement(){},getAllElements(){return Ro}};class K${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 Mq extends K${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 Fq extends K${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 V$ extends Mq{constructor(e){super(),this.onDispose(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}class Y${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 V$(e.shared)}getScope(e){const n=[],r=this.reflection.getReferenceType(e),i=Yt(e.container).precomputedScopes;if(i){let o=e.container;do{const a=i.get(o);a.length>0&&n.push(Me(a).filter(c=>this.reflection.isSubtype(c.type,r))),o=o.$container}while(o)}let s=this.getGlobalScope(r,e);for(let o=n.length-1;o>=0;o--)s=this.createScope(n[o],s);return s}createScope(e,n,r){return new Gc(Me(e),n,r)}createScopeForNodes(e,n,r){const i=Me(e).map(s=>{const o=this.nameProvider.getName(s);if(o)return this.descriptions.createDescription(s,o)}).nonNullable();return new Gc(i,n,r)}getGlobalScope(e,n){return this.globalScopeCache.get(e,()=>new z$(this.indexManager.allElements(e)))}}function jq(t){return typeof t.$comment=="string"}function X$(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}class Uq{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=(a,c)=>this.replacer(a,c,r),o=i?(a,c)=>i(a,c,s):s;try{return this.currentDocument=Yt(e),JSON.stringify(e,o,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:o,uriConverter:a}){var c,l,u,d;if(!this.ignoreProperties.has(e))if(Nn(n)){const f=n.ref,h=r?n.$refText:void 0;if(f){const p=Yt(f);let y="";this.currentDocument&&this.currentDocument!==p&&(a?y=a(p.uri,n):y=p.uri.toString());const R=this.astNodeLocator.getAstNodePath(f);return{$ref:`${y}#${R}`,$refText:h}}else return{$error:(l=(c=n.error)===null||c===void 0?void 0:c.message)!==null&&l!==void 0?l:"Could not resolve reference",$refText:h}}else if(ct(n)){let f;if(s&&(f=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},n)),(!e||n.$document)&&f?.$textRegion&&(f.$textRegion.documentURI=(u=this.currentDocument)===null||u===void 0?void 0:u.uri.toString())),i&&!e&&(f??(f=Object.assign({},n)),f.$sourceText=(d=n.$cstNode)===null||d===void 0?void 0:d.text),o){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 o=_o(e.$cstNode,s).map(n);o.length!==0&&(i[s]=o)}),e}}linkNode(e,n,r,i,s,o){for(const[c,l]of Object.entries(e))if(Array.isArray(l))for(let u=0;u<l.length;u++){const d=l[u];X$(d)?l[u]=this.reviveReference(e,c,n,d,r):ct(d)&&this.linkNode(d,n,r,e,c,u)}else X$(l)?e[c]=this.reviveReference(e,c,n,l,r):ct(l)&&this.linkNode(l,n,r,e,c);const a=e;a.$container=i,a.$containerProperty=s,a.$containerIndex=o}reviveReference(e,n,r,i,s){let o=i.$refText,a=i.$error;if(i.$ref){const c=this.getRefNode(r,i.$ref,s.uriConverter);if(ct(c))return o||(o=this.nameProvider.getName(c)),{$refText:o??"",ref:c};a=c}if(a){const c={$refText:o??""};return c.error={container:e,property:n,message:a,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):qt.parse(n),l=this.langiumDocuments.getDocument(c);return l?l.parseResult.value:"Could not find document for URI: "+n}const s=r?r(n.substring(0,i)):qt.parse(n.substring(0,i)),o=this.langiumDocuments.getDocument(s);if(!o)return"Could not find document for URI: "+n;if(i===n.length-1)return o.parseResult.value;const a=this.astNodeLocator.getAstNode(o.parseResult.value,n.substring(i+1));return a||"Could not resolve URI: "+n}catch(i){return String(i)}}}class Bq{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 a=this.languageIdMap.get(i);if(a)return a}const s=mt.extname(e),o=this.fileExtensionMap.get(s);if(!o)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 o}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}}function zc(t){return{code:t}}var vf;(function(t){t.all=["fast","slow","built-in"]})(vf||(vf={}));class qq{constructor(e){this.entries=new _r,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 o=s;if(Array.isArray(o))for(const a of o){const c={check:this.wrapValidationException(a,n),category:r};this.addEntry(i,c)}else if(typeof o=="function"){const a={check:this.wrapValidationException(o,n),category:r};this.addEntry(i,a)}}}wrapValidationException(e,n){return async(r,i,s)=>{try{await e.call(n,r,i,s)}catch(o){if(mf(o))throw o;console.error("An error occurred during validation:",o);const a=o instanceof Error?o.message:String(o);o instanceof Error&&o.stack&&console.error(o.stack),i("error","An error occurred during validation: "+a,{node:r})}}}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=Me(this.entries.get(e)).concat(this.entries.get("AstNode"));return n&&(r=r.filter(i=>n.includes(i.category))),r.map(i=>i.check)}}class Wq{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,n={},r=Ze.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(o=>{var a;return((a=o.data)===null||a===void 0?void 0:a.code)===rr.LexingError})||(this.processParsingErrors(i,s,n),n.stopAfterParsingErrors&&s.some(o=>{var a;return((a=o.data)===null||a===void 0?void 0:a.code)===rr.ParsingError}))||(this.processLinkingErrors(e,s,n),n.stopAfterLinkingErrors&&s.some(o=>{var a;return((a=o.data)===null||a===void 0?void 0:a.code)===rr.LinkingError}))))return s;try{s.push(...await this.validateAst(i.value,n,r))}catch(o){if(mf(o))throw o;console.error("An error occurred during validation:",o)}return await Pt(r),s}processLexingErrors(e,n,r){var i,s,o;const a=[...e.lexerErrors,...(s=(i=e.lexerReport)===null||i===void 0?void 0:i.diagnostics)!==null&&s!==void 0?s:[]];for(const c of a){const l=(o=c.severity)!==null&&o!==void 0?o:"error",u={severity:$y(l),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:zq(l),source:this.getSource()};n.push(u)}}processParsingErrors(e,n,r){for(const i of e.parserErrors){let s;if(isNaN(i.token.startOffset)){if("previousToken"in i){const o=i.previousToken;if(isNaN(o.startOffset)){const a={line:0,character:0};s={start:a,end:a}}else{const a={line:o.endLine-1,character:o.endColumn};s={start:a,end:a}}}}else s=Zu(i.token);if(s){const o={severity:$y("error"),range:s,message:i.message,data:zc(rr.ParsingError),source:this.getSource()};n.push(o)}}}processLinkingErrors(e,n,r){for(const i of e.references){const s=i.error;if(s){const o={node:s.container,property:s.property,index:s.index,data:{code:rr.LinkingError,containerType:s.container.$type,property:s.property,refText:s.reference.$refText}};n.push(this.toDiagnostic("error",s.message,o))}}}async validateAst(e,n,r=Ze.None){const i=[],s=(o,a,c)=>{i.push(this.toDiagnostic(o,a,c))};return await Promise.all(Yr(e).map(async o=>{await Pt(r);const a=this.validationRegistry.getChecks(o.$type,n.categories);for(const c of a)await c(o,s,r)})),i}toDiagnostic(e,n,r){return{message:n,range:Gq(r),severity:$y(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 Gq(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=bn(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=wc(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 $y(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 zq(t){switch(t){case"error":return zc(rr.LexingError);case"warning":return zc(rr.LexingWarning);case"info":return zc(rr.LexingInfo);case"hint":return zc(rr.LexingHint);default:throw new Error("Invalid diagnostic severity: "+t)}}var rr;(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"})(rr||(rr={}));class Hq{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,n,r){const i=r??Yt(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 o;const a=()=>{var c;return o??(o=Fa((c=this.nameProvider.getNameNode(e))!==null&&c!==void 0?c:e.$cstNode))};return{node:e,name:n,get nameSegment(){return a()},selectionSegment:Fa(e.$cstNode),type:e.$type,documentUri:i.uri,path:s}}}class Kq{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,n=Ze.None){const r=[],i=e.parseResult.value;for(const s of Yr(i))await Pt(n),fd(s).filter(o=>!Ju(o)).forEach(o=>{const a=this.createDescription(o);a&&r.push(a)});return r}createDescription(e){const n=e.reference.$nodeDescription,r=e.reference.$refNode;if(!n||!r)return;const i=Yt(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:n.documentUri,targetPath:n.path,segment:Fa(r),local:mt.equals(n.documentUri,i)}}}class Vq{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 o=s.indexOf(this.indexSeparator);if(o>0){const a=s.substring(0,o),c=parseInt(s.substring(o+1)),l=i[a];return l?.[c]}return i[s]},e)}}class Yq{constructor(e){this._ready=new Ey,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new D$,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 Us;(function(t){function e(n){return{dispose:async()=>await n()}}t.create=e})(Us||(Us={}));class Xq{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new _r,this.documentPhaseListeners=new _r,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=De.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=Ze.None){var i,s;for(const o of e){const a=o.uri.toString();if(o.state===De.Validated){if(typeof n.validation=="boolean"&&n.validation)o.state=De.IndexedReferences,o.diagnostics=void 0,this.buildState.delete(a);else if(typeof n.validation=="object"){const c=this.buildState.get(a),l=(i=c?.result)===null||i===void 0?void 0:i.validationChecks;if(l){const d=((s=n.validation.categories)!==null&&s!==void 0?s:vf.all).filter(f=>!l.includes(f));d.length>0&&(this.buildState.set(a,{completed:!1,options:{validation:Object.assign(Object.assign({},n.validation),{categories:d})},result:c.result}),o.state=De.IndexedReferences)}}}else this.buildState.delete(a)}this.currentState=De.Changed,await this.emitUpdate(e.map(o=>o.uri),[]),await this.buildDocuments(e,n,r)}async update(e,n,r=Ze.None){this.currentState=De.Changed;for(const o of n)this.langiumDocuments.deleteDocument(o),this.buildState.delete(o.toString()),this.indexManager.remove(o);for(const o of e){if(!this.langiumDocuments.invalidateDocument(o)){const c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},o);c.state=De.Changed,this.langiumDocuments.addDocument(c)}this.buildState.delete(o.toString())}const i=Me(e).concat(n).map(o=>o.toString()).toSet();this.langiumDocuments.all.filter(o=>!i.has(o.uri.toString())&&this.shouldRelink(o,i)).forEach(o=>{this.serviceRegistry.getServices(o.uri).references.Linker.unlink(o),o.state=Math.min(o.state,De.ComputedScopes),o.diagnostics=void 0}),await this.emitUpdate(e,n),await Pt(r);const s=this.sortDocuments(this.langiumDocuments.all.filter(o=>{var a;return o.state<De.Linked||!(!((a=this.buildState.get(o.uri.toString()))===null||a===void 0)&&a.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),Us.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,De.Parsed,r,s=>this.langiumDocumentFactory.update(s,r)),await this.runCancelable(e,De.IndexedContent,r,s=>this.indexManager.updateContent(s,r)),await this.runCancelable(e,De.ComputedScopes,r,async s=>{const o=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await o.computeLocalScopes(s,r)}),await this.runCancelable(e,De.Linked,r,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,r)),await this.runCancelable(e,De.IndexedReferences,r,s=>this.indexManager.updateReferences(s,r));const i=e.filter(s=>this.shouldValidate(s));await this.runCancelable(i,De.Validated,r,s=>this.validate(s,r));for(const s of e){const o=this.buildState.get(s.uri.toString());o&&(o.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(a=>a.state<n);for(const a of s)await Pt(r),await i(a),a.state=n,await this.notifyDocumentPhase(a,n,r);const o=e.filter(a=>a.state===n);await this.notifyBuildPhase(o,n,r),this.currentState=n}onBuildPhase(e,n){return this.buildPhaseListeners.add(e,n),Us.create(()=>{this.buildPhaseListeners.delete(e,n)})}onDocumentPhase(e,n){return this.documentPhaseListeners.add(e,n),Us.create(()=>{this.documentPhaseListeners.delete(e,n)})}waitUntil(e,n,r){let i;if(n&&"path"in n?i=n:r=n,r??(r=Ze.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(gf):new Promise((s,o)=>{const a=this.onBuildPhase(e,()=>{if(a.dispose(),c.dispose(),i){const l=this.langiumDocuments.getDocument(i);s(l?.uri)}else s(void 0)}),c=r.onCancellationRequested(()=>{a.dispose(),c.dispose(),o(gf)})})}async notifyDocumentPhase(e,n,r){const i=this.documentPhaseListeners.get(n);for(const s of i)try{await s(e,r)}catch(o){if(!mf(o))throw o}}async notifyBuildPhase(e,n,r){if(e.length===0)return;const i=this.buildPhaseListeners.get(n);for(const s of i)await Pt(r),await s(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,o=this.getBuildOptions(e).validation,a=typeof o=="object"?o:void 0,c=await s.validateDocument(e,a,n);e.diagnostics?e.diagnostics.push(...c):e.diagnostics=c;const l=this.buildState.get(e.uri.toString());if(l){(r=l.result)!==null&&r!==void 0||(l.result={});const u=(i=a?.categories)!==null&&i!==void 0?i:vf.all;l.result.validationChecks?l.result.validationChecks.push(...u):l.result.validationChecks=[...u]}}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 Jq{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new Fq,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,n){const r=Yt(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(o=>{mt.equals(o.targetUri,r)&&o.targetPath===n&&i.push(o)})}),Me(i)}allElements(e,n){let r=Me(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(a=>this.astReflection.isSubtype(a.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=Ze.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=Ze.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 J${constructor(e){this.initialBuildOptions={},this._ready=new Ey,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}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=Ze.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 qt.parse(e.uri)}async traverseFolder(e,n,r,i){const s=await this.fileSystemProvider.readDirectory(n);await Promise.all(s.map(async o=>{if(this.includeEntry(e,o,r)){if(o.isDirectory)await this.traverseFolder(e,o.uri,r,i);else if(o.isFile){const a=await this.langiumDocuments.getOrCreateDocument(o.uri);i(a)}}}))}includeEntry(e,n,r){const i=mt.basename(n.uri);if(i.startsWith("."))return!1;if(n.isDirectory)return i!=="node_modules"&&i!=="out";if(n.isFile){const s=mt.extname(n.uri);return r.includes(s)}return!1}}const Qq={mode:"full"};class Zq{constructor(e){this.tokenBuilder=e.parser.TokenBuilder;const n=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(n);const r=Z$(n)?Object.values(n):n;this.chevrotainLexer=new fn(r,{positionTracking:"full"})}get definition(){return this.tokenTypes}tokenize(e,n=Qq){var r,i,s;const o=this.chevrotainLexer.tokenize(e);return{tokens:o.tokens,errors:o.errors,hidden:(r=o.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(Z$(e))return e;const n=Q$(e)?Object.values(e.modes).flat():e,r={};return n.forEach(i=>r[i.name]=i),r}}function e8(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function Q$(t){return t&&"modes"in t&&"defaultMode"in t}function Z$(t){return!e8(t)&&!Q$(t)}function t8(t,e,n){let r,i;typeof t=="string"?(i=e,r=n):(i=t.range.start,r=e),i||(i=Ne.create(0,0));const s=ek(t),o=_y(r),a=i8({lines:s,position:i,options:o});return l8({index:0,tokens:a,position:i})}function n8(t,e){const n=_y(e),r=ek(t);if(r.length===0)return!1;const i=r[0],s=r[r.length-1],o=n.start,a=n.end;return!!o?.exec(i)&&!!a?.exec(s)}function ek(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(qT)}const tk=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,r8=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function i8(t){var e,n,r;const i=[];let s=t.position.line,o=t.position.character;for(let a=0;a<t.lines.length;a++){const c=a===0,l=a===t.lines.length-1;let u=t.lines[a],d=0;if(c&&t.options.start){const h=(e=t.options.start)===null||e===void 0?void 0:e.exec(u);h&&(d=h.index+h[0].length)}else{const h=(n=t.options.line)===null||n===void 0?void 0:n.exec(u);h&&(d=h.index+h[0].length)}if(l){const h=(r=t.options.end)===null||r===void 0?void 0:r.exec(u);h&&(u=u.substring(0,h.index))}if(u=u.substring(0,c8(u)),ky(u,d)>=u.length){if(i.length>0){const h=Ne.create(s,o);i.push({type:"break",content:"",range:Ee.create(h,h)})}}else{tk.lastIndex=d;const h=tk.exec(u);if(h){const p=h[0],y=h[1],R=Ne.create(s,o+d),b=Ne.create(s,o+d+p.length);i.push({type:"tag",content:y,range:Ee.create(R,b)}),d+=p.length,d=ky(u,d)}if(d<u.length){const p=u.substring(d),y=Array.from(p.matchAll(r8));i.push(...s8(y,p,s,o+d))}}s++,o=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function s8(t,e,n,r){const i=[];if(t.length===0){const s=Ne.create(n,r),o=Ne.create(n,r+e.length);i.push({type:"text",content:e,range:Ee.create(s,o)})}else{let s=0;for(const a of t){const c=a.index,l=e.substring(s,c);l.length>0&&i.push({type:"text",content:e.substring(s,c),range:Ee.create(Ne.create(n,s+r),Ne.create(n,c+r))});let u=l.length+1;const d=a[1];if(i.push({type:"inline-tag",content:d,range:Ee.create(Ne.create(n,s+u+r),Ne.create(n,s+u+d.length+r))}),u+=d.length,a.length===4){u+=a[2].length;const f=a[3];i.push({type:"text",content:f,range:Ee.create(Ne.create(n,s+u+r),Ne.create(n,s+u+f.length+r))})}else i.push({type:"text",content:"",range:Ee.create(Ne.create(n,s+u+r),Ne.create(n,s+u+r))});s=c+a[0].length}const o=e.substring(s);o.length>0&&i.push({type:"text",content:o,range:Ee.create(Ne.create(n,s+r),Ne.create(n,s+r+o.length))})}return i}const o8=/\S/,a8=/\s*$/;function ky(t,e){const n=t.substring(e).match(o8);return n?e+n.index:t.length}function c8(t){const e=t.match(a8);if(e&&typeof e.index=="number")return e.index}function l8(t){var e,n,r,i;const s=Ne.create(t.position.line,t.position.character);if(t.tokens.length===0)return new sk([],Ee.create(s,s));const o=[];for(;t.index<t.tokens.length;){const l=u8(t,o[o.length-1]);l&&o.push(l)}const a=(n=(e=o[0])===null||e===void 0?void 0:e.range.start)!==null&&n!==void 0?n:s,c=(i=(r=o[o.length-1])===null||r===void 0?void 0:r.range.end)!==null&&i!==void 0?i:s;return new sk(o,Ee.create(a,c))}function u8(t,e){const n=t.tokens[t.index];if(n.type==="tag")return rk(t,!1);if(n.type==="text"||n.type==="inline-tag")return nk(t);d8(n,e),t.index++}function d8(t,e){if(e){const n=new ok("",t.range);"inlines"in e?e.inlines.push(n):e.content.inlines.push(n)}}function nk(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(f8(t)),r=e,e=t.tokens[t.index];return new Iy(i,Ee.create(n.range.start,r.range.end))}function f8(t){return t.tokens[t.index].type==="inline-tag"?rk(t,!0):ik(t)}function rk(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=ik(t);return new Ay(r,new Iy([s],s.range),e,Ee.create(n.range.start,s.range.end))}else{const s=nk(t);return new Ay(r,s,e,Ee.create(n.range.start,s.range.end))}else{const s=n.range;return new Ay(r,new Iy([],s),e,s)}}function ik(t){const e=t.tokens[t.index++];return new ok(e.content,e.range)}function _y(t){if(!t)return _y({start:"/**",end:"*/",line:"*"});const{start:e,end:n,line:r}=t;return{start:Cy(e,!0),end:Cy(n,!1),line:Cy(r,!0)}}function Cy(t,e){if(typeof t=="string"||typeof t=="object"){const n=typeof t=="string"?vd(t):t.source;return e?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}else return t}class sk{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+=ak(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+=ak(n)+i}return n.trim()}}class Ay{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}
118
+ ${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=h8(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}
119
+ ${n}`),this.inline?`{${i}}`:i}}function h8(t,e,n){var r,i;if(t==="linkplain"||t==="linkcode"||t==="link"){const s=e.indexOf(" ");let o=e;if(s>0){const c=ky(e,s);o=e.substring(c),e=e.substring(0,s)}return(t==="linkcode"||t==="link"&&n.link==="code")&&(o=`\`${o}\``),(i=(r=n.renderLink)===null||r===void 0?void 0:r.call(n,e,o))!==null&&i!==void 0?i:p8(e,o)}}function p8(t,e){try{return qt.parse(t,!0),`[${e}](${t})`}catch{return t}}class Iy{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+=`
120
+ `)}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+=`
121
+ `)}return n}}class ok{constructor(e,n){this.text=e,this.range=n}toString(){return this.text}toMarkdown(){return this.text}}function ak(t){return t.endsWith(`
122
+ `)?`
123
+ `:`
124
+
125
+ `}class g8{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const n=this.commentProvider.getComment(e);if(n&&n8(n))return t8(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 o=s.nameSegment.range.start.line+1,a=s.nameSegment.range.start.character+1,c=s.documentUri.with({fragment:`L${o},${a}`});return`[${r}](${c.toString()})`}else return}documentationTagRenderer(e,n){}findNameInPrecomputedScopes(e,n){const i=Yt(e).precomputedScopes;if(!i)return;let s=e;do{const a=i.get(s).find(c=>c.name===n);if(a)return a;s=s.$container}while(s)}findNameInGlobalScope(e,n){return this.indexManager.allElements().find(i=>i.name===n)}}class m8{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var n;return jq(e)?e.$comment:(n=ed(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||n===void 0?void 0:n.text}}class y8{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,n){return Promise.resolve(this.syncParser.parse(e))}}class v8{constructor(){this.previousTokenSource=new by,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const n=new by;return this.previousTokenSource=n,this.enqueue(this.writeQueue,e,n.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,n,r=Ze.None){const i=new Ey,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){mf(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class w8{constructor(e){this.grammarElementIdMap=new W$,this.tokenTypeIdMap=new W$,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 Yr(e))n.set(i,{});if(e.$cstNode)for(const i of Ma(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 o=[];r[i]=o;for(const a of s)ct(a)?o.push(this.dehydrateAstNode(a,n)):Nn(a)?o.push(this.dehydrateReference(a,n)):o.push(a)}else ct(s)?r[i]=this.dehydrateAstNode(s,n):Nn(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 ET(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=n.astNodes.get(e.astNode),Hr(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,n)):Cs(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 Yr(e))n.set(s,{});let i;if(e.$cstNode)for(const s of Ma(e.$cstNode)){let o;"fullText"in s?(o=new R$(s.fullText),i=o):"content"in s?o=new py:"tokenType"in s&&(o=this.hydrateCstLeafNode(s)),o&&(r.set(s,o),o.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 o=[];r[i]=o;for(const a of s)ct(a)?o.push(this.setParent(this.hydrateAstNode(a,n),r)):Nn(a)?o.push(this.hydrateReference(a,r,i,n)):o.push(a)}else ct(s)?r[i]=this.setParent(this.hydrateAstNode(s,n),r):Nn(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),Hr(i))for(const s of e.content){const o=this.hydrateCstNode(s,n,r++);i.content.push(o)}return i}hydrateCstLeafNode(e){const n=this.getTokenType(e.tokenType),r=e.offset,i=e.length,s=e.startLine,o=e.startColumn,a=e.endLine,c=e.endColumn,l=e.hidden;return new hy(r,i,{start:{line:s,character:o},end:{line:a,character:c}},n,l)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap();const n=this.grammarElementIdMap.getKey(e);if(n)return n;throw new Error("Invalid grammar element id: "+e)}createGrammarElementIdMap(){let e=0;for(const n of Yr(this.grammar))Dg(n)&&this.grammarElementIdMap.set(n,e++)}}function ck(t){return{documentation:{CommentProvider:e=>new m8(e),DocumentationProvider:e=>new g8(e)},parser:{AsyncParser:e=>new y8(e),GrammarConfig:e=>$M(e),LangiumParser:e=>pq(e),CompletionParser:e=>hq(e),ValueConverter:()=>new yq,TokenBuilder:()=>new mq,Lexer:e=>new Zq(e),ParserErrorMessageProvider:()=>new _$},workspace:{AstNodeLocator:()=>new Vq,AstNodeDescriptionProvider:e=>new Hq(e),ReferenceDescriptionProvider:e=>new Kq(e)},references:{Linker:e=>new Dq(e),NameProvider:()=>new Oq,ScopeProvider:e=>new Y$(e),ScopeComputation:e=>new G$(e),References:e=>new Lq(e)},serializer:{Hydrator:e=>new w8(e),JsonSerializer:e=>new Uq(e)},validation:{DocumentValidator:e=>new Wq(e),ValidationRegistry:e=>new qq(e)},shared:()=>t.shared}}function lk(t){return{ServiceRegistry:e=>new Bq(e),workspace:{LangiumDocuments:e=>new Nq(e),LangiumDocumentFactory:e=>new Pq(e),DocumentBuilder:e=>new Xq(e),IndexManager:e=>new Jq(e),WorkspaceManager:e=>new J$(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new v8,ConfigurationProvider:e=>new Yq(e)}}}var wf;(function(t){t.merge=(e,n)=>Tf(Tf({},e),n)})(wf||(wf={}));function bf(t,e,n,r,i,s,o,a,c){const l=[t,e,n,r,i,s,o,a,c].reduce(Tf,{});return dk(l)}const uk=Symbol("isProxy");function xy(t){if(t&&t[uk])for(const e of Object.values(t))xy(e);return t}function dk(t,e){const n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(r,i)=>i===uk?!0:hk(r,i,t,e||n),getOwnPropertyDescriptor:(r,i)=>(hk(r,i,t,e||n),Object.getOwnPropertyDescriptor(r,i)),has:(r,i)=>i in t,ownKeys:()=>[...Object.getOwnPropertyNames(t)]});return n}const fk=Symbol();function hk(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]===fk)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]=fk;try{t[e]=typeof i=="function"?i(r):dk(i,r)}catch(s){throw t[e]=s instanceof Error?s:void 0,s}return t[e]}else return}function Tf(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]=Tf(i,r):t[n]=r}}return t}class b8{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const pk={fileSystemProvider:()=>new b8},T8={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},E8={AstReflection:()=>new MT};function R8(){const t=bf(lk(pk),E8),e=bf(ck({shared:t}),T8);return t.ServiceRegistry.register(e),e}function S8(t){var e;const n=R8(),r=n.serializer.JsonSerializer.deserialize(t);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,qt.parse(`memory://${(e=r.name)!==null&&e!==void 0?e:"grammar"}.langium`)),r}var $8={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]},k8=Object.entries($8);function Py(t){return String(t)}Py.open="",Py.close="";function _8(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 C8(t=!1){let e=_8(t),n=(o,a,c,l)=>{let u="",d=0;do u+=o.substring(d,l)+c,d=l+a.length,l=o.indexOf(a,d);while(~l);return u+o.substring(d)},r=(o,a,c=o)=>{let l=u=>{let d=String(u),f=d.indexOf(a,o.length);return~f?o+n(d,a,c,f)+a:o+d+a};return l.open=o,l.close=a,l},i={isColorSupported:e},s=o=>`\x1B[${o}m`;for(let[o,a]of k8)i[o]=e?r(s(a[0]),s(a[1]),a[2]):Py;return i}var et=C8(DN(1)),te={},dt={};Object.defineProperty(dt,"__esModule",{value:!0}),dt.thenable=dt.typedArray=dt.stringArray=dt.array=dt.func=dt.error=dt.number=dt.string=dt.boolean=void 0;function A8(t){return t===!0||t===!1}dt.boolean=A8;function gk(t){return typeof t=="string"||t instanceof String}dt.string=gk;function I8(t){return typeof t=="number"||t instanceof Number}dt.number=I8;function x8(t){return t instanceof Error}dt.error=x8;function mk(t){return typeof t=="function"}dt.func=mk;function yk(t){return Array.isArray(t)}dt.array=yk;function P8(t){return yk(t)&&t.every(e=>gk(e))}dt.stringArray=P8;function N8(t,e){return Array.isArray(t)&&t.every(e)}dt.typedArray=N8;function D8(t){return t&&mk(t.then)}dt.thenable=D8;var _e={},Xe={},hn={},Ny={},Dy={},re={},vk;function wk(){if(vk)return re;vk=1,Object.defineProperty(re,"__esModule",{value:!0}),re.Message=re.NotificationType9=re.NotificationType8=re.NotificationType7=re.NotificationType6=re.NotificationType5=re.NotificationType4=re.NotificationType3=re.NotificationType2=re.NotificationType1=re.NotificationType0=re.NotificationType=re.RequestType9=re.RequestType8=re.RequestType7=re.RequestType6=re.RequestType5=re.RequestType4=re.RequestType3=re.RequestType2=re.RequestType1=re.RequestType=re.RequestType0=re.AbstractMessageSignature=re.ParameterStructures=re.ResponseError=re.ErrorCodes=void 0;const t=St;var e;(function(k){k.ParseError=-32700,k.InvalidRequest=-32600,k.MethodNotFound=-32601,k.InvalidParams=-32602,k.InternalError=-32603,k.jsonrpcReservedErrorRangeStart=-32099,k.serverErrorStart=-32099,k.MessageWriteError=-32099,k.MessageReadError=-32098,k.PendingResponseRejected=-32097,k.ConnectionInactive=-32096,k.ServerNotInitialized=-32002,k.UnknownErrorCode=-32001,k.jsonrpcReservedErrorRangeEnd=-32e3,k.serverErrorEnd=-32e3})(e||(re.ErrorCodes=e={}));class n extends Error{constructor(S,M,q){super(M),this.code=t.number(S)?S:e.UnknownErrorCode,this.data=q,Object.setPrototypeOf(this,n.prototype)}toJson(){const S={code:this.code,message:this.message};return this.data!==void 0&&(S.data=this.data),S}}re.ResponseError=n;class r{constructor(S){this.kind=S}static is(S){return S===r.auto||S===r.byName||S===r.byPosition}toString(){return this.kind}}re.ParameterStructures=r,r.auto=new r("auto"),r.byPosition=new r("byPosition"),r.byName=new r("byName");class i{constructor(S,M){this.method=S,this.numberOfParams=M}get parameterStructures(){return r.auto}}re.AbstractMessageSignature=i;class s extends i{constructor(S){super(S,0)}}re.RequestType0=s;class o extends i{constructor(S,M=r.auto){super(S,1),this._parameterStructures=M}get parameterStructures(){return this._parameterStructures}}re.RequestType=o;class a extends i{constructor(S,M=r.auto){super(S,1),this._parameterStructures=M}get parameterStructures(){return this._parameterStructures}}re.RequestType1=a;class c extends i{constructor(S){super(S,2)}}re.RequestType2=c;class l extends i{constructor(S){super(S,3)}}re.RequestType3=l;class u extends i{constructor(S){super(S,4)}}re.RequestType4=u;class d extends i{constructor(S){super(S,5)}}re.RequestType5=d;class f extends i{constructor(S){super(S,6)}}re.RequestType6=f;class h extends i{constructor(S){super(S,7)}}re.RequestType7=h;class p extends i{constructor(S){super(S,8)}}re.RequestType8=p;class y extends i{constructor(S){super(S,9)}}re.RequestType9=y;class R extends i{constructor(S,M=r.auto){super(S,1),this._parameterStructures=M}get parameterStructures(){return this._parameterStructures}}re.NotificationType=R;class b extends i{constructor(S){super(S,0)}}re.NotificationType0=b;class v extends i{constructor(S,M=r.auto){super(S,1),this._parameterStructures=M}get parameterStructures(){return this._parameterStructures}}re.NotificationType1=v;class T extends i{constructor(S){super(S,2)}}re.NotificationType2=T;class _ extends i{constructor(S){super(S,3)}}re.NotificationType3=_;class N extends i{constructor(S){super(S,4)}}re.NotificationType4=N;class F extends i{constructor(S){super(S,5)}}re.NotificationType5=F;class x extends i{constructor(S){super(S,6)}}re.NotificationType6=x;class G extends i{constructor(S){super(S,7)}}re.NotificationType7=G;class B extends i{constructor(S){super(S,8)}}re.NotificationType8=B;class W extends i{constructor(S){super(S,9)}}re.NotificationType9=W;var I;return function(k){function S(U){const z=U;return z&&t.string(z.method)&&(t.string(z.id)||t.number(z.id))}k.isRequest=S;function M(U){const z=U;return z&&t.string(z.method)&&U.id===void 0}k.isNotification=M;function q(U){const z=U;return z&&(z.result!==void 0||!!z.error)&&(t.string(z.id)||t.number(z.id)||z.id===null)}k.isResponse=q}(I||(re.Message=I={})),re}var oi={},bk;function Tk(){if(bk)return oi;bk=1;var t;Object.defineProperty(oi,"__esModule",{value:!0}),oi.LRUCache=oi.LinkedMap=oi.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||(oi.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,o=e.None){const a=this._map.get(s);if(a)return o!==e.None&&this.touch(a,o),a.value}set(s,o,a=e.None){let c=this._map.get(s);if(c)c.value=o,a!==e.None&&this.touch(c,a);else{switch(c={key:s,value:o,next:void 0,previous:void 0},a){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 o=this._map.get(s);if(o)return this._map.delete(s),this.removeItem(o),this._size--,o.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,o){const a=this._state;let c=this._head;for(;c;){if(o?s.bind(o)(c.value,c.key,this):s(c.value,c.key,this),this._state!==a)throw new Error("LinkedMap got modified during iteration.");c=c.next}}keys(){const s=this._state;let o=this._head;const a={[Symbol.iterator]:()=>a,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(o){const c={value:o.key,done:!1};return o=o.next,c}else return{value:void 0,done:!0}}};return a}values(){const s=this._state;let o=this._head;const a={[Symbol.iterator]:()=>a,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(o){const c={value:o.value,done:!1};return o=o.next,c}else return{value:void 0,done:!0}}};return a}entries(){const s=this._state;let o=this._head;const a={[Symbol.iterator]:()=>a,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(o){const c={value:[o.key,o.value],done:!1};return o=o.next,c}else return{value:void 0,done:!0}}};return a}[(t=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(s){if(s>=this.size)return;if(s===0){this.clear();return}let o=this._head,a=this.size;for(;o&&a>s;)this._map.delete(o.key),o=o.next,a--;this._head=o,this._size=a,o&&(o.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 o=s.next,a=s.previous;if(!o||!a)throw new Error("Invalid list");o.previous=a,a.next=o}s.next=void 0,s.previous=void 0,this._state++}touch(s,o){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(o!==e.First&&o!==e.Last)){if(o===e.First){if(s===this._head)return;const a=s.next,c=s.previous;s===this._tail?(c.next=void 0,this._tail=c):(a.previous=c,c.next=a),s.previous=void 0,s.next=this._head,this._head.previous=s,this._head=s,this._state++}else if(o===e.Last){if(s===this._tail)return;const a=s.next,c=s.previous;s===this._head?(a.previous=void 0,this._head=a):(a.previous=c,c.next=a),s.next=void 0,s.previous=this._tail,this._tail.next=s,this._tail=s,this._state++}}}toJSON(){const s=[];return this.forEach((o,a)=>{s.push([a,o])}),s}fromJSON(s){this.clear();for(const[o,a]of s)this.set(o,a)}}oi.LinkedMap=n;class r extends n{constructor(s,o=1){super(),this._limit=s,this._ratio=Math.min(Math.max(0,o),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,o=e.AsNew){return super.get(s,o)}peek(s){return super.get(s,e.None)}set(s,o){return super.set(s,o,e.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}return oi.LRUCache=r,oi}var Hc={},Ek;function O8(){if(Ek)return Hc;Ek=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.Disposable=void 0;var t;return function(e){function n(r){return{dispose:r}}e.create=n}(t||(Hc.Disposable=t={})),Hc}var Bs={},Rk;function L8(){if(Rk)return Bs;Rk=1,Object.defineProperty(Bs,"__esModule",{value:!0}),Bs.SharedArrayReceiverStrategy=Bs.SharedArraySenderStrategy=void 0;const t=Fi;var e;(function(o){o.Continue=0,o.Cancelled=1})(e||(e={}));class n{constructor(){this.buffers=new Map}enableCancellation(a){if(a.id===null)return;const c=new SharedArrayBuffer(4),l=new Int32Array(c,0,1);l[0]=e.Continue,this.buffers.set(a.id,c),a.$cancellationData=c}async sendCancellation(a,c){const l=this.buffers.get(c);if(l===void 0)return;const u=new Int32Array(l,0,1);Atomics.store(u,0,e.Cancelled)}cleanup(a){this.buffers.delete(a)}dispose(){this.buffers.clear()}}Bs.SharedArraySenderStrategy=n;class r{constructor(a){this.data=new Int32Array(a,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(a){this.token=new r(a)}cancel(){}dispose(){}}class s{constructor(){this.kind="request"}createCancellationTokenSource(a){const c=a.$cancellationData;return c===void 0?new t.CancellationTokenSource:new i(c)}}return Bs.SharedArrayReceiverStrategy=s,Bs}var ai={},Kc={},Sk;function $k(){if(Sk)return Kc;Sk=1,Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.Semaphore=void 0;const t=si;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 Kc.Semaphore=e,Kc}var kk;function M8(){if(kk)return ai;kk=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.ReadableStreamMessageReader=ai.AbstractMessageReader=ai.MessageReader=void 0;const t=si,e=St,n=kr,r=$k();var i;(function(c){function l(u){let d=u;return d&&e.func(d.listen)&&e.func(d.dispose)&&e.func(d.onError)&&e.func(d.onClose)&&e.func(d.onPartialMessage)}c.is=l})(i||(ai.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(l){this.errorEmitter.fire(this.asError(l))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(l){this.partialMessageEmitter.fire(l)}asError(l){return l instanceof Error?l:new Error(`Reader received error. Reason: ${e.string(l.message)?l.message:"unknown"}`)}}ai.AbstractMessageReader=s;var o;(function(c){function l(u){let d,f;const h=new Map;let p;const y=new Map;if(u===void 0||typeof u=="string")d=u??"utf-8";else{if(d=u.charset??"utf-8",u.contentDecoder!==void 0&&(f=u.contentDecoder,h.set(f.name,f)),u.contentDecoders!==void 0)for(const R of u.contentDecoders)h.set(R.name,R);if(u.contentTypeDecoder!==void 0&&(p=u.contentTypeDecoder,y.set(p.name,p)),u.contentTypeDecoders!==void 0)for(const R of u.contentTypeDecoders)y.set(R.name,R)}return p===void 0&&(p=(0,t.default)().applicationJson.decoder,y.set(p.name,p)),{charset:d,contentDecoder:f,contentDecoders:h,contentTypeDecoder:p,contentTypeDecoders:y}}c.fromOptions=l})(o||(o={}));class a extends s{constructor(l,u){super(),this.readable=l,this.options=o.fromOptions(u),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(l){this._partialMessageTimeout=l}get partialMessageTimeout(){return this._partialMessageTimeout}listen(l){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=l;const u=this.readable.onData(d=>{this.onData(d)});return this.readable.onError(d=>this.fireError(d)),this.readable.onClose(()=>this.fireClose()),u}onData(l){try{for(this.buffer.append(l);;){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.
126
+ ${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 u=this.buffer.tryReadBody(this.nextMessageLength);if(u===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(u):u,f=await this.options.contentTypeDecoder.decode(d,this.options);this.callback(f)}).catch(d=>{this.fireError(d)})}}catch(u){this.fireError(u)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((l,u)=>{this.partialMessageTimer=void 0,l===this.messageToken&&(this.firePartialMessage({messageToken:l,waitingTime:u}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}return ai.ReadableStreamMessageReader=a,ai}var ci={},_k;function F8(){if(_k)return ci;_k=1,Object.defineProperty(ci,"__esModule",{value:!0}),ci.WriteableStreamMessageWriter=ci.AbstractMessageWriter=ci.MessageWriter=void 0;const t=si,e=St,n=$k(),r=kr,i="Content-Length: ",s=`\r
127
+ `;var o;(function(u){function d(f){let h=f;return h&&e.func(h.dispose)&&e.func(h.onClose)&&e.func(h.onError)&&e.func(h.write)}u.is=d})(o||(ci.MessageWriter=o={}));class a{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"}`)}}ci.AbstractMessageWriter=a;var c;(function(u){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}}u.fromOptions=d})(c||(c={}));class l extends a{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 p=[];return p.push(i,h.byteLength.toString(),s),p.push(s),this.doWrite(d,p,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(p){return this.handleError(p,d),Promise.reject(p)}}handleError(d,f){this.errorCount++,this.fireError(d,f,this.errorCount)}end(){this.writable.end()}}return ci.WriteableStreamMessageWriter=l,ci}var Vc={},Ck;function j8(){if(Ck)return Vc;Ck=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.AbstractMessageBuffer=void 0;const t=13,e=10,n=`\r
128
+ `;class r{constructor(s="utf-8"){this._encoding=s,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(s){const o=typeof s=="string"?this.fromString(s,this._encoding):s;this._chunks.push(o),this._totalLength+=o.byteLength}tryReadHeaders(s=!1){if(this._chunks.length===0)return;let o=0,a=0,c=0,l=0;e:for(;a<this._chunks.length;){const h=this._chunks[a];for(c=0;c<h.length;){switch(h[c]){case t:switch(o){case 0:o=1;break;case 2:o=3;break;default:o=0}break;case e:switch(o){case 1:o=2;break;case 3:o=4,c++;break e;default:o=0}break;default:o=0}c++}l+=h.byteLength,a++}if(o!==4)return;const u=this._read(l+c),d=new Map,f=this.toString(u,"ascii").split(n);if(f.length<2)return d;for(let h=0;h<f.length-2;h++){const p=f[h],y=p.indexOf(":");if(y===-1)throw new Error(`Message header must separate key and value using ':'
129
+ ${p}`);const R=p.substr(0,y),b=p.substr(y+1).trim();d.set(s?R.toLowerCase():R,b)}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 l=this._chunks[0];return this._chunks.shift(),this._totalLength-=s,this.asNative(l)}if(this._chunks[0].byteLength>s){const l=this._chunks[0],u=this.asNative(l,s);return this._chunks[0]=l.slice(s),this._totalLength-=s,u}const o=this.allocNative(s);let a=0,c=0;for(;s>0;){const l=this._chunks[c];if(l.byteLength>s){const u=l.slice(0,s);o.set(u,a),a+=s,this._chunks[c]=l.slice(s),this._totalLength-=s,s-=s}else o.set(l,a),a+=l.byteLength,this._chunks.shift(),this._totalLength-=l.byteLength,s-=l.byteLength}return o}}return Vc.AbstractMessageBuffer=r,Vc}var Oy={},Ak;function U8(){return Ak||(Ak=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=si,n=St,r=wk(),i=Tk(),s=kr,o=Fi;var a;(function(S){S.type=new r.NotificationType("$/cancelRequest")})(a||(a={}));var c;(function(S){function M(q){return typeof q=="string"||typeof q=="number"}S.is=M})(c||(t.ProgressToken=c={}));var l;(function(S){S.type=new r.NotificationType("$/progress")})(l||(l={}));class u{constructor(){}}t.ProgressType=u;var d;(function(S){function M(q){return n.func(q)}S.is=M})(d||(d={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var f;(function(S){S[S.Off=0]="Off",S[S.Messages=1]="Messages",S[S.Compact=2]="Compact",S[S.Verbose=3]="Verbose"})(f||(t.Trace=f={}));var h;(function(S){S.Off="off",S.Messages="messages",S.Compact="compact",S.Verbose="verbose"})(h||(t.TraceValues=h={})),function(S){function M(U){if(!n.string(U))return S.Off;switch(U=U.toLowerCase(),U){case"off":return S.Off;case"messages":return S.Messages;case"compact":return S.Compact;case"verbose":return S.Verbose;default:return S.Off}}S.fromString=M;function q(U){switch(U){case S.Off:return"off";case S.Messages:return"messages";case S.Compact:return"compact";case S.Verbose:return"verbose";default:return"off"}}S.toString=q}(f||(t.Trace=f={}));var p;(function(S){S.Text="text",S.JSON="json"})(p||(t.TraceFormat=p={})),function(S){function M(q){return n.string(q)?(q=q.toLowerCase(),q==="json"?S.JSON:S.Text):S.Text}S.fromString=M}(p||(t.TraceFormat=p={}));var y;(function(S){S.type=new r.NotificationType("$/setTrace")})(y||(t.SetTraceNotification=y={}));var R;(function(S){S.type=new r.NotificationType("$/logTrace")})(R||(t.LogTraceNotification=R={}));var b;(function(S){S[S.Closed=1]="Closed",S[S.Disposed=2]="Disposed",S[S.AlreadyListening=3]="AlreadyListening"})(b||(t.ConnectionErrors=b={}));class v extends Error{constructor(M,q){super(q),this.code=M,Object.setPrototypeOf(this,v.prototype)}}t.ConnectionError=v;var T;(function(S){function M(q){const U=q;return U&&n.func(U.cancelUndispatched)}S.is=M})(T||(t.ConnectionStrategy=T={}));var _;(function(S){function M(q){const U=q;return U&&(U.kind===void 0||U.kind==="id")&&n.func(U.createCancellationTokenSource)&&(U.dispose===void 0||n.func(U.dispose))}S.is=M})(_||(t.IdCancellationReceiverStrategy=_={}));var N;(function(S){function M(q){const U=q;return U&&U.kind==="request"&&n.func(U.createCancellationTokenSource)&&(U.dispose===void 0||n.func(U.dispose))}S.is=M})(N||(t.RequestCancellationReceiverStrategy=N={}));var F;(function(S){S.Message=Object.freeze({createCancellationTokenSource(q){return new o.CancellationTokenSource}});function M(q){return _.is(q)||N.is(q)}S.is=M})(F||(t.CancellationReceiverStrategy=F={}));var x;(function(S){S.Message=Object.freeze({sendCancellation(q,U){return q.sendNotification(a.type,{id:U})},cleanup(q){}});function M(q){const U=q;return U&&n.func(U.sendCancellation)&&n.func(U.cleanup)}S.is=M})(x||(t.CancellationSenderStrategy=x={}));var G;(function(S){S.Message=Object.freeze({receiver:F.Message,sender:x.Message});function M(q){const U=q;return U&&F.is(U.receiver)&&x.is(U.sender)}S.is=M})(G||(t.CancellationStrategy=G={}));var B;(function(S){function M(q){const U=q;return U&&n.func(U.handleMessage)}S.is=M})(B||(t.MessageStrategy=B={}));var W;(function(S){function M(q){const U=q;return U&&(G.is(U.cancellationStrategy)||T.is(U.connectionStrategy)||B.is(U.messageStrategy))}S.is=M})(W||(t.ConnectionOptions=W={}));var I;(function(S){S[S.New=1]="New",S[S.Listening=2]="Listening",S[S.Closed=3]="Closed",S[S.Disposed=4]="Disposed"})(I||(I={}));function k(S,M,q,U){const z=q!==void 0?q:t.NullLogger;let Pe=0,J=0,j=0;const ge="2.0";let Nt;const nn=new Map;let Ge;const wn=new Map,Ue=new Map;let ot,vt=new i.LinkedMap,Be=new Map,wt=new Set,Qe=new Map,fe=f.Off,nt=p.Text,Oe,Dt=I.New;const Fr=new s.Emitter,pi=new s.Emitter,gi=new s.Emitter,mi=new s.Emitter,yi=new s.Emitter,rn=U&&U.cancellationStrategy?U.cancellationStrategy:G.Message;function vi(E){if(E===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+E.toString()}function us(E){return E===null?"res-unknown-"+(++j).toString():"res-"+E.toString()}function ds(){return"not-"+(++J).toString()}function jr(E,L){r.Message.isRequest(L)?E.set(vi(L.id),L):r.Message.isResponse(L)?E.set(us(L.id),L):E.set(ds(),L)}function fs(E){}function wi(){return Dt===I.Listening}function bi(){return Dt===I.Closed}function Cn(){return Dt===I.Disposed}function Ti(){(Dt===I.New||Dt===I.Listening)&&(Dt=I.Closed,pi.fire(void 0))}function hs(E){Fr.fire([E,void 0,void 0])}function ps(E){Fr.fire(E)}S.onClose(Ti),S.onError(hs),M.onClose(Ti),M.onError(ps);function Ei(){ot||vt.size===0||(ot=(0,e.default)().timer.setImmediate(()=>{ot=void 0,gs()}))}function Ri(E){r.Message.isRequest(E)?ys(E):r.Message.isNotification(E)?Si(E):r.Message.isResponse(E)?vs(E):$i(E)}function gs(){if(vt.size===0)return;const E=vt.shift();try{const L=U?.messageStrategy;B.is(L)?L.handleMessage(E,Ri):Ri(E)}finally{Ei()}}const ms=E=>{try{if(r.Message.isNotification(E)&&E.method===a.type.method){const L=E.params.id,H=vi(L),Y=vt.get(H);if(r.Message.isRequest(Y)){const me=U?.connectionStrategy,Ce=me&&me.cancelUndispatched?me.cancelUndispatched(Y,fs):void 0;if(Ce&&(Ce.error!==void 0||Ce.result!==void 0)){vt.delete(H),Qe.delete(L),Ce.id=Y.id,fr(Ce,E.method,Date.now()),M.write(Ce).catch(()=>z.error("Sending response for canceled message failed."));return}}const we=Qe.get(L);if(we!==void 0){we.cancel(),Ur(E);return}else wt.add(L)}jr(vt,E)}finally{Ei()}};function ys(E){if(Cn())return;function L(he,Le,Ae){const _t={jsonrpc:ge,id:E.id};he instanceof r.ResponseError?_t.error=he.toJson():_t.result=he===void 0?null:he,fr(_t,Le,Ae),M.write(_t).catch(()=>z.error("Sending response failed."))}function H(he,Le,Ae){const _t={jsonrpc:ge,id:E.id,error:he.toJson()};fr(_t,Le,Ae),M.write(_t).catch(()=>z.error("Sending response failed."))}function Y(he,Le,Ae){he===void 0&&(he=null);const _t={jsonrpc:ge,id:E.id,result:he};fr(_t,Le,Ae),M.write(_t).catch(()=>z.error("Sending response failed."))}Ts(E);const we=nn.get(E.method);let me,Ce;we&&(me=we.type,Ce=we.handler);const ne=Date.now();if(Ce||Nt){const he=E.id??String(Date.now()),Le=_.is(rn.receiver)?rn.receiver.createCancellationTokenSource(he):rn.receiver.createCancellationTokenSource(E);E.id!==null&&wt.has(E.id)&&Le.cancel(),E.id!==null&&Qe.set(he,Le);try{let Ae;if(Ce)if(E.params===void 0){if(me!==void 0&&me.numberOfParams!==0){H(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${E.method} defines ${me.numberOfParams} params but received none.`),E.method,ne);return}Ae=Ce(Le.token)}else if(Array.isArray(E.params)){if(me!==void 0&&me.parameterStructures===r.ParameterStructures.byName){H(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${E.method} defines parameters by name but received parameters by position`),E.method,ne);return}Ae=Ce(...E.params,Le.token)}else{if(me!==void 0&&me.parameterStructures===r.ParameterStructures.byPosition){H(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${E.method} defines parameters by position but received parameters by name`),E.method,ne);return}Ae=Ce(E.params,Le.token)}else Nt&&(Ae=Nt(E.method,E.params,Le.token));const _t=Ae;Ae?_t.then?_t.then(Kt=>{Qe.delete(he),L(Kt,E.method,ne)},Kt=>{Qe.delete(he),Kt instanceof r.ResponseError?H(Kt,E.method,ne):Kt&&n.string(Kt.message)?H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed with message: ${Kt.message}`),E.method,ne):H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed unexpectedly without providing any details.`),E.method,ne)}):(Qe.delete(he),L(Ae,E.method,ne)):(Qe.delete(he),Y(Ae,E.method,ne))}catch(Ae){Qe.delete(he),Ae instanceof r.ResponseError?L(Ae,E.method,ne):Ae&&n.string(Ae.message)?H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed with message: ${Ae.message}`),E.method,ne):H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed unexpectedly without providing any details.`),E.method,ne)}}else H(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${E.method}`),E.method,ne)}function vs(E){if(!Cn())if(E.id===null)E.error?z.error(`Received response message without id: Error is:
130
+ ${JSON.stringify(E.error,void 0,4)}`):z.error("Received response message without id. No further error information provided.");else{const L=E.id,H=Be.get(L);if(Es(E,H),H!==void 0){Be.delete(L);try{if(E.error){const Y=E.error;H.reject(new r.ResponseError(Y.code,Y.message,Y.data))}else if(E.result!==void 0)H.resolve(E.result);else throw new Error("Should never happen.")}catch(Y){Y.message?z.error(`Response handler '${H.method}' failed with message: ${Y.message}`):z.error(`Response handler '${H.method}' failed unexpectedly.`)}}}}function Si(E){if(Cn())return;let L,H;if(E.method===a.type.method){const Y=E.params.id;wt.delete(Y),Ur(E);return}else{const Y=wn.get(E.method);Y&&(H=Y.handler,L=Y.type)}if(H||Ge)try{if(Ur(E),H)if(E.params===void 0)L!==void 0&&L.numberOfParams!==0&&L.parameterStructures!==r.ParameterStructures.byName&&z.error(`Notification ${E.method} defines ${L.numberOfParams} params but received none.`),H();else if(Array.isArray(E.params)){const Y=E.params;E.method===l.type.method&&Y.length===2&&c.is(Y[0])?H({token:Y[0],value:Y[1]}):(L!==void 0&&(L.parameterStructures===r.ParameterStructures.byName&&z.error(`Notification ${E.method} defines parameters by name but received parameters by position`),L.numberOfParams!==E.params.length&&z.error(`Notification ${E.method} defines ${L.numberOfParams} params but received ${Y.length} arguments`)),H(...Y))}else L!==void 0&&L.parameterStructures===r.ParameterStructures.byPosition&&z.error(`Notification ${E.method} defines parameters by position but received parameters by name`),H(E.params);else Ge&&Ge(E.method,E.params)}catch(Y){Y.message?z.error(`Notification handler '${E.method}' failed with message: ${Y.message}`):z.error(`Notification handler '${E.method}' failed unexpectedly.`)}else gi.fire(E)}function $i(E){if(!E){z.error("Received empty message.");return}z.error(`Received message which is neither a response nor a notification message:
131
+ ${JSON.stringify(E,null,4)}`);const L=E;if(n.string(L.id)||n.number(L.id)){const H=L.id,Y=Be.get(H);Y&&Y.reject(new Error("The received response has neither a result nor an error property."))}}function sn(E){if(E!=null)switch(fe){case f.Verbose:return JSON.stringify(E,null,4);case f.Compact:return JSON.stringify(E);default:return}}function ws(E){if(!(fe===f.Off||!Oe))if(nt===p.Text){let L;(fe===f.Verbose||fe===f.Compact)&&E.params&&(L=`Params: ${sn(E.params)}
132
+
133
+ `),Oe.log(`Sending request '${E.method} - (${E.id})'.`,L)}else An("send-request",E)}function bs(E){if(!(fe===f.Off||!Oe))if(nt===p.Text){let L;(fe===f.Verbose||fe===f.Compact)&&(E.params?L=`Params: ${sn(E.params)}
134
+
135
+ `:L=`No parameters provided.
136
+
137
+ `),Oe.log(`Sending notification '${E.method}'.`,L)}else An("send-notification",E)}function fr(E,L,H){if(!(fe===f.Off||!Oe))if(nt===p.Text){let Y;(fe===f.Verbose||fe===f.Compact)&&(E.error&&E.error.data?Y=`Error data: ${sn(E.error.data)}
138
+
139
+ `:E.result?Y=`Result: ${sn(E.result)}
140
+
141
+ `:E.error===void 0&&(Y=`No result returned.
142
+
143
+ `)),Oe.log(`Sending response '${L} - (${E.id})'. Processing request took ${Date.now()-H}ms`,Y)}else An("send-response",E)}function Ts(E){if(!(fe===f.Off||!Oe))if(nt===p.Text){let L;(fe===f.Verbose||fe===f.Compact)&&E.params&&(L=`Params: ${sn(E.params)}
144
+
145
+ `),Oe.log(`Received request '${E.method} - (${E.id})'.`,L)}else An("receive-request",E)}function Ur(E){if(!(fe===f.Off||!Oe||E.method===R.type.method))if(nt===p.Text){let L;(fe===f.Verbose||fe===f.Compact)&&(E.params?L=`Params: ${sn(E.params)}
146
+
147
+ `:L=`No parameters provided.
148
+
149
+ `),Oe.log(`Received notification '${E.method}'.`,L)}else An("receive-notification",E)}function Es(E,L){if(!(fe===f.Off||!Oe))if(nt===p.Text){let H;if((fe===f.Verbose||fe===f.Compact)&&(E.error&&E.error.data?H=`Error data: ${sn(E.error.data)}
150
+
151
+ `:E.result?H=`Result: ${sn(E.result)}
152
+
153
+ `:E.error===void 0&&(H=`No result returned.
154
+
155
+ `)),L){const Y=E.error?` Request failed: ${E.error.message} (${E.error.code}).`:"";Oe.log(`Received response '${L.method} - (${E.id})' in ${Date.now()-L.timerStart}ms.${Y}`,H)}else Oe.log(`Received response ${E.id} without active response promise.`,H)}else An("receive-response",E)}function An(E,L){if(!Oe||fe===f.Off)return;const H={isLSPMessage:!0,type:E,message:L,timestamp:Date.now()};Oe.log(H)}function Kn(){if(bi())throw new v(b.Closed,"Connection is closed.");if(Cn())throw new v(b.Disposed,"Connection is disposed.")}function ao(){if(wi())throw new v(b.AlreadyListening,"Connection is already listening")}function P(){if(!wi())throw new Error("Call listen() first.")}function w(E){return E===void 0?null:E}function C(E){if(E!==null)return E}function g(E){return E!=null&&!Array.isArray(E)&&typeof E=="object"}function $(E,L){switch(E){case r.ParameterStructures.auto:return g(L)?C(L):[w(L)];case r.ParameterStructures.byName:if(!g(L))throw new Error("Received parameters by name but param is not an object literal.");return C(L);case r.ParameterStructures.byPosition:return[w(L)];default:throw new Error(`Unknown parameter structure ${E.toString()}`)}}function m(E,L){let H;const Y=E.numberOfParams;switch(Y){case 0:H=void 0;break;case 1:H=$(E.parameterStructures,L[0]);break;default:H=[];for(let we=0;we<L.length&&we<Y;we++)H.push(w(L[we]));if(L.length<Y)for(let we=L.length;we<Y;we++)H.push(null);break}return H}const A={sendNotification:(E,...L)=>{Kn();let H,Y;if(n.string(E)){H=E;const me=L[0];let Ce=0,ne=r.ParameterStructures.auto;r.ParameterStructures.is(me)&&(Ce=1,ne=me);let he=L.length;const Le=he-Ce;switch(Le){case 0:Y=void 0;break;case 1:Y=$(ne,L[Ce]);break;default:if(ne===r.ParameterStructures.byName)throw new Error(`Received ${Le} parameters for 'by Name' notification parameter structure.`);Y=L.slice(Ce,he).map(Ae=>w(Ae));break}}else{const me=L;H=E.method,Y=m(E,me)}const we={jsonrpc:ge,method:H,params:Y};return bs(we),M.write(we).catch(me=>{throw z.error("Sending notification failed."),me})},onNotification:(E,L)=>{Kn();let H;return n.func(E)?Ge=E:L&&(n.string(E)?(H=E,wn.set(E,{type:void 0,handler:L})):(H=E.method,wn.set(E.method,{type:E,handler:L}))),{dispose:()=>{H!==void 0?wn.delete(H):Ge=void 0}}},onProgress:(E,L,H)=>{if(Ue.has(L))throw new Error(`Progress handler for token ${L} already registered`);return Ue.set(L,H),{dispose:()=>{Ue.delete(L)}}},sendProgress:(E,L,H)=>A.sendNotification(l.type,{token:L,value:H}),onUnhandledProgress:mi.event,sendRequest:(E,...L)=>{Kn(),P();let H,Y,we;if(n.string(E)){H=E;const he=L[0],Le=L[L.length-1];let Ae=0,_t=r.ParameterStructures.auto;r.ParameterStructures.is(he)&&(Ae=1,_t=he);let Kt=L.length;o.CancellationToken.is(Le)&&(Kt=Kt-1,we=Le);const hr=Kt-Ae;switch(hr){case 0:Y=void 0;break;case 1:Y=$(_t,L[Ae]);break;default:if(_t===r.ParameterStructures.byName)throw new Error(`Received ${hr} parameters for 'by Name' request parameter structure.`);Y=L.slice(Ae,Kt).map(kN=>w(kN));break}}else{const he=L;H=E.method,Y=m(E,he);const Le=E.numberOfParams;we=o.CancellationToken.is(he[Le])?he[Le]:void 0}const me=Pe++;let Ce;we&&(Ce=we.onCancellationRequested(()=>{const he=rn.sender.sendCancellation(A,me);return he===void 0?(z.log(`Received no promise from cancellation strategy when cancelling id ${me}`),Promise.resolve()):he.catch(()=>{z.log(`Sending cancellation messages for id ${me} failed`)})}));const ne={jsonrpc:ge,id:me,method:H,params:Y};return ws(ne),typeof rn.sender.enableCancellation=="function"&&rn.sender.enableCancellation(ne),new Promise(async(he,Le)=>{const Ae=hr=>{he(hr),rn.sender.cleanup(me),Ce?.dispose()},_t=hr=>{Le(hr),rn.sender.cleanup(me),Ce?.dispose()},Kt={method:H,timerStart:Date.now(),resolve:Ae,reject:_t};try{await M.write(ne),Be.set(me,Kt)}catch(hr){throw z.error("Sending request failed."),Kt.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,hr.message?hr.message:"Unknown reason")),hr}})},onRequest:(E,L)=>{Kn();let H=null;return d.is(E)?(H=void 0,Nt=E):n.string(E)?(H=null,L!==void 0&&(H=E,nn.set(E,{handler:L,type:void 0}))):L!==void 0&&(H=E.method,nn.set(E.method,{type:E,handler:L})),{dispose:()=>{H!==null&&(H!==void 0?nn.delete(H):Nt=void 0)}}},hasPendingResponse:()=>Be.size>0,trace:async(E,L,H)=>{let Y=!1,we=p.Text;H!==void 0&&(n.boolean(H)?Y=H:(Y=H.sendNotification||!1,we=H.traceFormat||p.Text)),fe=E,nt=we,fe===f.Off?Oe=void 0:Oe=L,Y&&!bi()&&!Cn()&&await A.sendNotification(y.type,{value:f.toString(E)})},onError:Fr.event,onClose:pi.event,onUnhandledNotification:gi.event,onDispose:yi.event,end:()=>{M.end()},dispose:()=>{if(Cn())return;Dt=I.Disposed,yi.fire(void 0);const E=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const L of Be.values())L.reject(E);Be=new Map,Qe=new Map,wt=new Set,vt=new i.LinkedMap,n.func(M.dispose)&&M.dispose(),n.func(S.dispose)&&S.dispose()},listen:()=>{Kn(),ao(),Dt=I.Listening,S.listen(ms)},inspect:()=>{(0,e.default)().console.log("inspect")}};return A.onNotification(R.type,E=>{if(fe===f.Off||!Oe)return;const L=fe===f.Verbose||fe===f.Compact;Oe.log(E.message,L?E.verbose:void 0)}),A.onNotification(l.type,E=>{const L=Ue.get(E.token);L?L(E.value):mi.fire(E)}),A}t.createMessageConnection=k}(Oy)),Oy}var Ik;function Ly(){return Ik||(Ik=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=wk();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=Tk();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=O8();Object.defineProperty(t,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const i=kr;Object.defineProperty(t,"Event",{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(t,"Emitter",{enumerable:!0,get:function(){return i.Emitter}});const s=Fi;Object.defineProperty(t,"CancellationTokenSource",{enumerable:!0,get:function(){return s.CancellationTokenSource}}),Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return s.CancellationToken}});const o=L8();Object.defineProperty(t,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return o.SharedArraySenderStrategy}}),Object.defineProperty(t,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return o.SharedArrayReceiverStrategy}});const a=M8();Object.defineProperty(t,"MessageReader",{enumerable:!0,get:function(){return a.MessageReader}}),Object.defineProperty(t,"AbstractMessageReader",{enumerable:!0,get:function(){return a.AbstractMessageReader}}),Object.defineProperty(t,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return a.ReadableStreamMessageReader}});const c=F8();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 l=j8();Object.defineProperty(t,"AbstractMessageBuffer",{enumerable:!0,get:function(){return l.AbstractMessageBuffer}});const u=U8();Object.defineProperty(t,"ConnectionStrategy",{enumerable:!0,get:function(){return u.ConnectionStrategy}}),Object.defineProperty(t,"ConnectionOptions",{enumerable:!0,get:function(){return u.ConnectionOptions}}),Object.defineProperty(t,"NullLogger",{enumerable:!0,get:function(){return u.NullLogger}}),Object.defineProperty(t,"createMessageConnection",{enumerable:!0,get:function(){return u.createMessageConnection}}),Object.defineProperty(t,"ProgressToken",{enumerable:!0,get:function(){return u.ProgressToken}}),Object.defineProperty(t,"ProgressType",{enumerable:!0,get:function(){return u.ProgressType}}),Object.defineProperty(t,"Trace",{enumerable:!0,get:function(){return u.Trace}}),Object.defineProperty(t,"TraceValues",{enumerable:!0,get:function(){return u.TraceValues}}),Object.defineProperty(t,"TraceFormat",{enumerable:!0,get:function(){return u.TraceFormat}}),Object.defineProperty(t,"SetTraceNotification",{enumerable:!0,get:function(){return u.SetTraceNotification}}),Object.defineProperty(t,"LogTraceNotification",{enumerable:!0,get:function(){return u.LogTraceNotification}}),Object.defineProperty(t,"ConnectionErrors",{enumerable:!0,get:function(){return u.ConnectionErrors}}),Object.defineProperty(t,"ConnectionError",{enumerable:!0,get:function(){return u.ConnectionError}}),Object.defineProperty(t,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return u.CancellationReceiverStrategy}}),Object.defineProperty(t,"CancellationSenderStrategy",{enumerable:!0,get:function(){return u.CancellationSenderStrategy}}),Object.defineProperty(t,"CancellationStrategy",{enumerable:!0,get:function(){return u.CancellationStrategy}}),Object.defineProperty(t,"MessageStrategy",{enumerable:!0,get:function(){return u.MessageStrategy}});const d=si;t.RAL=d.default}(Dy)),Dy}Object.defineProperty(Ny,"__esModule",{value:!0});const xk=QN,li=Ly();class Up extends li.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return Up.emptyBuffer}fromString(e,n){return Buffer.from(e,n)}toString(e,n){return e instanceof Buffer?e.toString(n):new xk.TextDecoder(n).decode(e)}asNative(e,n){return n===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,n):Buffer.from(e,0,n)}allocNative(e){return Buffer.allocUnsafe(e)}}Up.emptyBuffer=Buffer.allocUnsafe(0);class B8{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),li.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),li.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),li.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),li.Disposable.create(()=>this.stream.off("data",e))}}class q8{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),li.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),li.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),li.Disposable.create(()=>this.stream.off("end",e))}write(e,n){return new Promise((r,i)=>{const s=o=>{o==null?r():i(o)};typeof e=="string"?this.stream.write(e,n,s):this.stream.write(e,s)})}end(){this.stream.end()}}const Pk=Object.freeze({messageBuffer:Object.freeze({create:t=>new Up(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(t,void 0,0),e.charset))}catch(n){return Promise.reject(n)}}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{try{return t instanceof Buffer?Promise.resolve(JSON.parse(t.toString(e.charset))):Promise.resolve(JSON.parse(new xk.TextDecoder(e.charset).decode(t)))}catch(n){return Promise.reject(n)}}})}),stream:Object.freeze({asReadableStream:t=>new B8(t),asWritableStream:t=>new q8(t)}),console,timer:Object.freeze({setTimeout(t,e,...n){const r=setTimeout(t,e,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(t,...e){const n=setImmediate(t,...e);return{dispose:()=>clearImmediate(n)}},setInterval(t,e,...n){const r=setInterval(t,e,...n);return{dispose:()=>clearInterval(r)}}})});function My(){return Pk}(function(t){function e(){li.RAL.install(Pk)}t.install=e})(My||(My={})),Ny.default=My,function(t){var e=gt&&gt.__createBinding||(Object.create?function(I,k,S,M){M===void 0&&(M=S);var q=Object.getOwnPropertyDescriptor(k,S);(!q||("get"in q?!k.__esModule:q.writable||q.configurable))&&(q={enumerable:!0,get:function(){return k[S]}}),Object.defineProperty(I,M,q)}:function(I,k,S,M){M===void 0&&(M=S),I[M]=k[S]}),n=gt&&gt.__exportStar||function(I,k){for(var S in I)S!=="default"&&!Object.prototype.hasOwnProperty.call(k,S)&&e(k,I,S)};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=Ny;r.default.install();const i=Pa,s=ZN,o=Xb,a=eD,c=Ly();n(Ly(),t);class l extends c.AbstractMessageReader{constructor(k){super(),this.process=k;let S=this.process;S.on("error",M=>this.fireError(M)),S.on("close",()=>this.fireClose())}listen(k){return this.process.on("message",k),c.Disposable.create(()=>this.process.off("message",k))}}t.IPCMessageReader=l;class u extends c.AbstractMessageWriter{constructor(k){super(),this.process=k,this.errorCount=0;const S=this.process;S.on("error",M=>this.fireError(M)),S.on("close",()=>this.fireClose)}write(k){try{return typeof this.process.send=="function"&&this.process.send(k,void 0,void 0,S=>{S?(this.errorCount++,this.handleError(S,k)):this.errorCount=0}),Promise.resolve()}catch(S){return this.handleError(S,k),Promise.reject(S)}}handleError(k,S){this.errorCount++,this.fireError(k,S,this.errorCount)}end(){}}t.IPCMessageWriter=u;class d extends c.AbstractMessageReader{constructor(k){super(),this.onData=new c.Emitter,k.on("close",()=>this.fireClose),k.on("error",S=>this.fireError(S)),k.on("message",S=>{this.onData.fire(S)})}listen(k){return this.onData.event(k)}}t.PortMessageReader=d;class f extends c.AbstractMessageWriter{constructor(k){super(),this.port=k,this.errorCount=0,k.on("close",()=>this.fireClose()),k.on("error",S=>this.fireError(S))}write(k){try{return this.port.postMessage(k),Promise.resolve()}catch(S){return this.handleError(S,k),Promise.reject(S)}}handleError(k,S){this.errorCount++,this.fireError(k,S,this.errorCount)}end(){}}t.PortMessageWriter=f;class h extends c.ReadableStreamMessageReader{constructor(k,S="utf-8"){super((0,r.default)().stream.asReadableStream(k),S)}}t.SocketMessageReader=h;class p extends c.WriteableStreamMessageWriter{constructor(k,S){super((0,r.default)().stream.asWritableStream(k),S),this.socket=k}dispose(){super.dispose(),this.socket.destroy()}}t.SocketMessageWriter=p;class y extends c.ReadableStreamMessageReader{constructor(k,S){super((0,r.default)().stream.asReadableStream(k),S)}}t.StreamMessageReader=y;class R extends c.WriteableStreamMessageWriter{constructor(k,S){super((0,r.default)().stream.asWritableStream(k),S)}}t.StreamMessageWriter=R;const b=process.env.XDG_RUNTIME_DIR,v=new Map([["linux",107],["darwin",103]]);function T(){const I=(0,o.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${I}-sock`;let k;b?k=i.join(b,`vscode-ipc-${I}.sock`):k=i.join(s.tmpdir(),`vscode-${I}.sock`);const S=v.get(process.platform);return S!==void 0&&k.length>S&&(0,r.default)().console.warn(`WARNING: IPC handle "${k}" is longer than ${S} characters.`),k}t.generateRandomPipeName=T;function _(I,k="utf-8"){let S;const M=new Promise((q,U)=>{S=q});return new Promise((q,U)=>{let z=(0,a.createServer)(Pe=>{z.close(),S([new h(Pe,k),new p(Pe,k)])});z.on("error",U),z.listen(I,()=>{z.removeListener("error",U),q({onConnected:()=>M})})})}t.createClientPipeTransport=_;function N(I,k="utf-8"){const S=(0,a.createConnection)(I);return[new h(S,k),new p(S,k)]}t.createServerPipeTransport=N;function F(I,k="utf-8"){let S;const M=new Promise((q,U)=>{S=q});return new Promise((q,U)=>{const z=(0,a.createServer)(Pe=>{z.close(),S([new h(Pe,k),new p(Pe,k)])});z.on("error",U),z.listen(I,"127.0.0.1",()=>{z.removeListener("error",U),q({onConnected:()=>M})})})}t.createClientSocketTransport=F;function x(I,k="utf-8"){const S=(0,a.createConnection)(I,"127.0.0.1");return[new h(S,k),new p(S,k)]}t.createServerSocketTransport=x;function G(I){const k=I;return k.read!==void 0&&k.addListener!==void 0}function B(I){const k=I;return k.write!==void 0&&k.addListener!==void 0}function W(I,k,S,M){S||(S=c.NullLogger);const q=G(I)?new y(I):I,U=B(k)?new R(k):k;return c.ConnectionStrategy.is(M)&&(M={connectionStrategy:M}),(0,c.createMessageConnection)(q,U,S,M)}t.createMessageConnection=W}(hn);var Nk=hn,Dk={};function W8(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 Fy={exports:{}};(function(t,e){(function(n){{var r=n(W8,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(w){function C(g){return typeof g=="string"}w.is=C})(i||(r.DocumentUri=i={}));var s;(function(w){function C(g){return typeof g=="string"}w.is=C})(s||(r.URI=s={}));var o;(function(w){w.MIN_VALUE=-2147483648,w.MAX_VALUE=2147483647;function C(g){return typeof g=="number"&&w.MIN_VALUE<=g&&g<=w.MAX_VALUE}w.is=C})(o||(r.integer=o={}));var a;(function(w){w.MIN_VALUE=0,w.MAX_VALUE=2147483647;function C(g){return typeof g=="number"&&w.MIN_VALUE<=g&&g<=w.MAX_VALUE}w.is=C})(a||(r.uinteger=a={}));var c;(function(w){function C($,m){return $===Number.MAX_VALUE&&($=a.MAX_VALUE),m===Number.MAX_VALUE&&(m=a.MAX_VALUE),{line:$,character:m}}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&P.uinteger(m.line)&&P.uinteger(m.character)}w.is=g})(c||(r.Position=c={}));var l;(function(w){function C($,m,A,E){if(P.uinteger($)&&P.uinteger(m)&&P.uinteger(A)&&P.uinteger(E))return{start:c.create($,m),end:c.create(A,E)};if(c.is($)&&c.is(m))return{start:$,end:m};throw new Error("Range#create called with invalid arguments[".concat($,", ").concat(m,", ").concat(A,", ").concat(E,"]"))}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&c.is(m.start)&&c.is(m.end)}w.is=g})(l||(r.Range=l={}));var u;(function(w){function C($,m){return{uri:$,range:m}}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&l.is(m.range)&&(P.string(m.uri)||P.undefined(m.uri))}w.is=g})(u||(r.Location=u={}));var d;(function(w){function C($,m,A,E){return{targetUri:$,targetRange:m,targetSelectionRange:A,originSelectionRange:E}}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&l.is(m.targetRange)&&P.string(m.targetUri)&&l.is(m.targetSelectionRange)&&(l.is(m.originSelectionRange)||P.undefined(m.originSelectionRange))}w.is=g})(d||(r.LocationLink=d={}));var f;(function(w){function C($,m,A,E){return{red:$,green:m,blue:A,alpha:E}}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&P.numberRange(m.red,0,1)&&P.numberRange(m.green,0,1)&&P.numberRange(m.blue,0,1)&&P.numberRange(m.alpha,0,1)}w.is=g})(f||(r.Color=f={}));var h;(function(w){function C($,m){return{range:$,color:m}}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&l.is(m.range)&&f.is(m.color)}w.is=g})(h||(r.ColorInformation=h={}));var p;(function(w){function C($,m,A){return{label:$,textEdit:m,additionalTextEdits:A}}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&P.string(m.label)&&(P.undefined(m.textEdit)||x.is(m))&&(P.undefined(m.additionalTextEdits)||P.typedArray(m.additionalTextEdits,x.is))}w.is=g})(p||(r.ColorPresentation=p={}));var y;(function(w){w.Comment="comment",w.Imports="imports",w.Region="region"})(y||(r.FoldingRangeKind=y={}));var R;(function(w){function C($,m,A,E,L,H){var Y={startLine:$,endLine:m};return P.defined(A)&&(Y.startCharacter=A),P.defined(E)&&(Y.endCharacter=E),P.defined(L)&&(Y.kind=L),P.defined(H)&&(Y.collapsedText=H),Y}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&P.uinteger(m.startLine)&&P.uinteger(m.startLine)&&(P.undefined(m.startCharacter)||P.uinteger(m.startCharacter))&&(P.undefined(m.endCharacter)||P.uinteger(m.endCharacter))&&(P.undefined(m.kind)||P.string(m.kind))}w.is=g})(R||(r.FoldingRange=R={}));var b;(function(w){function C($,m){return{location:$,message:m}}w.create=C;function g($){var m=$;return P.defined(m)&&u.is(m.location)&&P.string(m.message)}w.is=g})(b||(r.DiagnosticRelatedInformation=b={}));var v;(function(w){w.Error=1,w.Warning=2,w.Information=3,w.Hint=4})(v||(r.DiagnosticSeverity=v={}));var T;(function(w){w.Unnecessary=1,w.Deprecated=2})(T||(r.DiagnosticTag=T={}));var _;(function(w){function C(g){var $=g;return P.objectLiteral($)&&P.string($.href)}w.is=C})(_||(r.CodeDescription=_={}));var N;(function(w){function C($,m,A,E,L,H){var Y={range:$,message:m};return P.defined(A)&&(Y.severity=A),P.defined(E)&&(Y.code=E),P.defined(L)&&(Y.source=L),P.defined(H)&&(Y.relatedInformation=H),Y}w.create=C;function g($){var m,A=$;return P.defined(A)&&l.is(A.range)&&P.string(A.message)&&(P.number(A.severity)||P.undefined(A.severity))&&(P.integer(A.code)||P.string(A.code)||P.undefined(A.code))&&(P.undefined(A.codeDescription)||P.string((m=A.codeDescription)===null||m===void 0?void 0:m.href))&&(P.string(A.source)||P.undefined(A.source))&&(P.undefined(A.relatedInformation)||P.typedArray(A.relatedInformation,b.is))}w.is=g})(N||(r.Diagnostic=N={}));var F;(function(w){function C($,m){for(var A=[],E=2;E<arguments.length;E++)A[E-2]=arguments[E];var L={title:$,command:m};return P.defined(A)&&A.length>0&&(L.arguments=A),L}w.create=C;function g($){var m=$;return P.defined(m)&&P.string(m.title)&&P.string(m.command)}w.is=g})(F||(r.Command=F={}));var x;(function(w){function C(A,E){return{range:A,newText:E}}w.replace=C;function g(A,E){return{range:{start:A,end:A},newText:E}}w.insert=g;function $(A){return{range:A,newText:""}}w.del=$;function m(A){var E=A;return P.objectLiteral(E)&&P.string(E.newText)&&l.is(E.range)}w.is=m})(x||(r.TextEdit=x={}));var G;(function(w){function C($,m,A){var E={label:$};return m!==void 0&&(E.needsConfirmation=m),A!==void 0&&(E.description=A),E}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&P.string(m.label)&&(P.boolean(m.needsConfirmation)||m.needsConfirmation===void 0)&&(P.string(m.description)||m.description===void 0)}w.is=g})(G||(r.ChangeAnnotation=G={}));var B;(function(w){function C(g){var $=g;return P.string($)}w.is=C})(B||(r.ChangeAnnotationIdentifier=B={}));var W;(function(w){function C(A,E,L){return{range:A,newText:E,annotationId:L}}w.replace=C;function g(A,E,L){return{range:{start:A,end:A},newText:E,annotationId:L}}w.insert=g;function $(A,E){return{range:A,newText:"",annotationId:E}}w.del=$;function m(A){var E=A;return x.is(E)&&(G.is(E.annotationId)||B.is(E.annotationId))}w.is=m})(W||(r.AnnotatedTextEdit=W={}));var I;(function(w){function C($,m){return{textDocument:$,edits:m}}w.create=C;function g($){var m=$;return P.defined(m)&&ge.is(m.textDocument)&&Array.isArray(m.edits)}w.is=g})(I||(r.TextDocumentEdit=I={}));var k;(function(w){function C($,m,A){var E={kind:"create",uri:$};return m!==void 0&&(m.overwrite!==void 0||m.ignoreIfExists!==void 0)&&(E.options=m),A!==void 0&&(E.annotationId=A),E}w.create=C;function g($){var m=$;return m&&m.kind==="create"&&P.string(m.uri)&&(m.options===void 0||(m.options.overwrite===void 0||P.boolean(m.options.overwrite))&&(m.options.ignoreIfExists===void 0||P.boolean(m.options.ignoreIfExists)))&&(m.annotationId===void 0||B.is(m.annotationId))}w.is=g})(k||(r.CreateFile=k={}));var S;(function(w){function C($,m,A,E){var L={kind:"rename",oldUri:$,newUri:m};return A!==void 0&&(A.overwrite!==void 0||A.ignoreIfExists!==void 0)&&(L.options=A),E!==void 0&&(L.annotationId=E),L}w.create=C;function g($){var m=$;return m&&m.kind==="rename"&&P.string(m.oldUri)&&P.string(m.newUri)&&(m.options===void 0||(m.options.overwrite===void 0||P.boolean(m.options.overwrite))&&(m.options.ignoreIfExists===void 0||P.boolean(m.options.ignoreIfExists)))&&(m.annotationId===void 0||B.is(m.annotationId))}w.is=g})(S||(r.RenameFile=S={}));var M;(function(w){function C($,m,A){var E={kind:"delete",uri:$};return m!==void 0&&(m.recursive!==void 0||m.ignoreIfNotExists!==void 0)&&(E.options=m),A!==void 0&&(E.annotationId=A),E}w.create=C;function g($){var m=$;return m&&m.kind==="delete"&&P.string(m.uri)&&(m.options===void 0||(m.options.recursive===void 0||P.boolean(m.options.recursive))&&(m.options.ignoreIfNotExists===void 0||P.boolean(m.options.ignoreIfNotExists)))&&(m.annotationId===void 0||B.is(m.annotationId))}w.is=g})(M||(r.DeleteFile=M={}));var q;(function(w){function C(g){var $=g;return $&&($.changes!==void 0||$.documentChanges!==void 0)&&($.documentChanges===void 0||$.documentChanges.every(function(m){return P.string(m.kind)?k.is(m)||S.is(m)||M.is(m):I.is(m)}))}w.is=C})(q||(r.WorkspaceEdit=q={}));var U=function(){function w(C,g){this.edits=C,this.changeAnnotations=g}return w.prototype.insert=function(C,g,$){var m,A;if($===void 0?m=x.insert(C,g):B.is($)?(A=$,m=W.insert(C,g,$)):(this.assertChangeAnnotations(this.changeAnnotations),A=this.changeAnnotations.manage($),m=W.insert(C,g,A)),this.edits.push(m),A!==void 0)return A},w.prototype.replace=function(C,g,$){var m,A;if($===void 0?m=x.replace(C,g):B.is($)?(A=$,m=W.replace(C,g,$)):(this.assertChangeAnnotations(this.changeAnnotations),A=this.changeAnnotations.manage($),m=W.replace(C,g,A)),this.edits.push(m),A!==void 0)return A},w.prototype.delete=function(C,g){var $,m;if(g===void 0?$=x.del(C):B.is(g)?(m=g,$=W.del(C,g)):(this.assertChangeAnnotations(this.changeAnnotations),m=this.changeAnnotations.manage(g),$=W.del(C,m)),this.edits.push($),m!==void 0)return m},w.prototype.add=function(C){this.edits.push(C)},w.prototype.all=function(){return this.edits},w.prototype.clear=function(){this.edits.splice(0,this.edits.length)},w.prototype.assertChangeAnnotations=function(C){if(C===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},w}(),z=function(){function w(C){this._annotations=C===void 0?Object.create(null):C,this._counter=0,this._size=0}return w.prototype.all=function(){return this._annotations},Object.defineProperty(w.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),w.prototype.manage=function(C,g){var $;if(B.is(C)?$=C:($=this.nextId(),g=C),this._annotations[$]!==void 0)throw new Error("Id ".concat($," is already in use."));if(g===void 0)throw new Error("No annotation provided for id ".concat($));return this._annotations[$]=g,this._size++,$},w.prototype.nextId=function(){return this._counter++,this._counter.toString()},w}(),Pe=function(){function w(C){var g=this;this._textEditChanges=Object.create(null),C!==void 0?(this._workspaceEdit=C,C.documentChanges?(this._changeAnnotations=new z(C.changeAnnotations),C.changeAnnotations=this._changeAnnotations.all(),C.documentChanges.forEach(function($){if(I.is($)){var m=new U($.edits,g._changeAnnotations);g._textEditChanges[$.textDocument.uri]=m}})):C.changes&&Object.keys(C.changes).forEach(function($){var m=new U(C.changes[$]);g._textEditChanges[$]=m})):this._workspaceEdit={}}return Object.defineProperty(w.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}),w.prototype.getTextEditChange=function(C){if(ge.is(C)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g={uri:C.uri,version:C.version},$=this._textEditChanges[g.uri];if(!$){var m=[],A={textDocument:g,edits:m};this._workspaceEdit.documentChanges.push(A),$=new U(m,this._changeAnnotations),this._textEditChanges[g.uri]=$}return $}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var $=this._textEditChanges[C];if(!$){var m=[];this._workspaceEdit.changes[C]=m,$=new U(m),this._textEditChanges[C]=$}return $}},w.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new z,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},w.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},w.prototype.createFile=function(C,g,$){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var m;G.is(g)||B.is(g)?m=g:$=g;var A,E;if(m===void 0?A=k.create(C,$):(E=B.is(m)?m:this._changeAnnotations.manage(m),A=k.create(C,$,E)),this._workspaceEdit.documentChanges.push(A),E!==void 0)return E},w.prototype.renameFile=function(C,g,$,m){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var A;G.is($)||B.is($)?A=$:m=$;var E,L;if(A===void 0?E=S.create(C,g,m):(L=B.is(A)?A:this._changeAnnotations.manage(A),E=S.create(C,g,m,L)),this._workspaceEdit.documentChanges.push(E),L!==void 0)return L},w.prototype.deleteFile=function(C,g,$){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var m;G.is(g)||B.is(g)?m=g:$=g;var A,E;if(m===void 0?A=M.create(C,$):(E=B.is(m)?m:this._changeAnnotations.manage(m),A=M.create(C,$,E)),this._workspaceEdit.documentChanges.push(A),E!==void 0)return E},w}();r.WorkspaceChange=Pe;var J;(function(w){function C($){return{uri:$}}w.create=C;function g($){var m=$;return P.defined(m)&&P.string(m.uri)}w.is=g})(J||(r.TextDocumentIdentifier=J={}));var j;(function(w){function C($,m){return{uri:$,version:m}}w.create=C;function g($){var m=$;return P.defined(m)&&P.string(m.uri)&&P.integer(m.version)}w.is=g})(j||(r.VersionedTextDocumentIdentifier=j={}));var ge;(function(w){function C($,m){return{uri:$,version:m}}w.create=C;function g($){var m=$;return P.defined(m)&&P.string(m.uri)&&(m.version===null||P.integer(m.version))}w.is=g})(ge||(r.OptionalVersionedTextDocumentIdentifier=ge={}));var Nt;(function(w){function C($,m,A,E){return{uri:$,languageId:m,version:A,text:E}}w.create=C;function g($){var m=$;return P.defined(m)&&P.string(m.uri)&&P.string(m.languageId)&&P.integer(m.version)&&P.string(m.text)}w.is=g})(Nt||(r.TextDocumentItem=Nt={}));var nn;(function(w){w.PlainText="plaintext",w.Markdown="markdown";function C(g){var $=g;return $===w.PlainText||$===w.Markdown}w.is=C})(nn||(r.MarkupKind=nn={}));var Ge;(function(w){function C(g){var $=g;return P.objectLiteral(g)&&nn.is($.kind)&&P.string($.value)}w.is=C})(Ge||(r.MarkupContent=Ge={}));var wn;(function(w){w.Text=1,w.Method=2,w.Function=3,w.Constructor=4,w.Field=5,w.Variable=6,w.Class=7,w.Interface=8,w.Module=9,w.Property=10,w.Unit=11,w.Value=12,w.Enum=13,w.Keyword=14,w.Snippet=15,w.Color=16,w.File=17,w.Reference=18,w.Folder=19,w.EnumMember=20,w.Constant=21,w.Struct=22,w.Event=23,w.Operator=24,w.TypeParameter=25})(wn||(r.CompletionItemKind=wn={}));var Ue;(function(w){w.PlainText=1,w.Snippet=2})(Ue||(r.InsertTextFormat=Ue={}));var ot;(function(w){w.Deprecated=1})(ot||(r.CompletionItemTag=ot={}));var vt;(function(w){function C($,m,A){return{newText:$,insert:m,replace:A}}w.create=C;function g($){var m=$;return m&&P.string(m.newText)&&l.is(m.insert)&&l.is(m.replace)}w.is=g})(vt||(r.InsertReplaceEdit=vt={}));var Be;(function(w){w.asIs=1,w.adjustIndentation=2})(Be||(r.InsertTextMode=Be={}));var wt;(function(w){function C(g){var $=g;return $&&(P.string($.detail)||$.detail===void 0)&&(P.string($.description)||$.description===void 0)}w.is=C})(wt||(r.CompletionItemLabelDetails=wt={}));var Qe;(function(w){function C(g){return{label:g}}w.create=C})(Qe||(r.CompletionItem=Qe={}));var fe;(function(w){function C(g,$){return{items:g||[],isIncomplete:!!$}}w.create=C})(fe||(r.CompletionList=fe={}));var nt;(function(w){function C($){return $.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}w.fromPlainText=C;function g($){var m=$;return P.string(m)||P.objectLiteral(m)&&P.string(m.language)&&P.string(m.value)}w.is=g})(nt||(r.MarkedString=nt={}));var Oe;(function(w){function C(g){var $=g;return!!$&&P.objectLiteral($)&&(Ge.is($.contents)||nt.is($.contents)||P.typedArray($.contents,nt.is))&&(g.range===void 0||l.is(g.range))}w.is=C})(Oe||(r.Hover=Oe={}));var Dt;(function(w){function C(g,$){return $?{label:g,documentation:$}:{label:g}}w.create=C})(Dt||(r.ParameterInformation=Dt={}));var Fr;(function(w){function C(g,$){for(var m=[],A=2;A<arguments.length;A++)m[A-2]=arguments[A];var E={label:g};return P.defined($)&&(E.documentation=$),P.defined(m)?E.parameters=m:E.parameters=[],E}w.create=C})(Fr||(r.SignatureInformation=Fr={}));var pi;(function(w){w.Text=1,w.Read=2,w.Write=3})(pi||(r.DocumentHighlightKind=pi={}));var gi;(function(w){function C(g,$){var m={range:g};return P.number($)&&(m.kind=$),m}w.create=C})(gi||(r.DocumentHighlight=gi={}));var mi;(function(w){w.File=1,w.Module=2,w.Namespace=3,w.Package=4,w.Class=5,w.Method=6,w.Property=7,w.Field=8,w.Constructor=9,w.Enum=10,w.Interface=11,w.Function=12,w.Variable=13,w.Constant=14,w.String=15,w.Number=16,w.Boolean=17,w.Array=18,w.Object=19,w.Key=20,w.Null=21,w.EnumMember=22,w.Struct=23,w.Event=24,w.Operator=25,w.TypeParameter=26})(mi||(r.SymbolKind=mi={}));var yi;(function(w){w.Deprecated=1})(yi||(r.SymbolTag=yi={}));var rn;(function(w){function C(g,$,m,A,E){var L={name:g,kind:$,location:{uri:A,range:m}};return E&&(L.containerName=E),L}w.create=C})(rn||(r.SymbolInformation=rn={}));var vi;(function(w){function C(g,$,m,A){return A!==void 0?{name:g,kind:$,location:{uri:m,range:A}}:{name:g,kind:$,location:{uri:m}}}w.create=C})(vi||(r.WorkspaceSymbol=vi={}));var us;(function(w){function C($,m,A,E,L,H){var Y={name:$,detail:m,kind:A,range:E,selectionRange:L};return H!==void 0&&(Y.children=H),Y}w.create=C;function g($){var m=$;return m&&P.string(m.name)&&P.number(m.kind)&&l.is(m.range)&&l.is(m.selectionRange)&&(m.detail===void 0||P.string(m.detail))&&(m.deprecated===void 0||P.boolean(m.deprecated))&&(m.children===void 0||Array.isArray(m.children))&&(m.tags===void 0||Array.isArray(m.tags))}w.is=g})(us||(r.DocumentSymbol=us={}));var ds;(function(w){w.Empty="",w.QuickFix="quickfix",w.Refactor="refactor",w.RefactorExtract="refactor.extract",w.RefactorInline="refactor.inline",w.RefactorRewrite="refactor.rewrite",w.Source="source",w.SourceOrganizeImports="source.organizeImports",w.SourceFixAll="source.fixAll"})(ds||(r.CodeActionKind=ds={}));var jr;(function(w){w.Invoked=1,w.Automatic=2})(jr||(r.CodeActionTriggerKind=jr={}));var fs;(function(w){function C($,m,A){var E={diagnostics:$};return m!=null&&(E.only=m),A!=null&&(E.triggerKind=A),E}w.create=C;function g($){var m=$;return P.defined(m)&&P.typedArray(m.diagnostics,N.is)&&(m.only===void 0||P.typedArray(m.only,P.string))&&(m.triggerKind===void 0||m.triggerKind===jr.Invoked||m.triggerKind===jr.Automatic)}w.is=g})(fs||(r.CodeActionContext=fs={}));var wi;(function(w){function C($,m,A){var E={title:$},L=!0;return typeof m=="string"?(L=!1,E.kind=m):F.is(m)?E.command=m:E.edit=m,L&&A!==void 0&&(E.kind=A),E}w.create=C;function g($){var m=$;return m&&P.string(m.title)&&(m.diagnostics===void 0||P.typedArray(m.diagnostics,N.is))&&(m.kind===void 0||P.string(m.kind))&&(m.edit!==void 0||m.command!==void 0)&&(m.command===void 0||F.is(m.command))&&(m.isPreferred===void 0||P.boolean(m.isPreferred))&&(m.edit===void 0||q.is(m.edit))}w.is=g})(wi||(r.CodeAction=wi={}));var bi;(function(w){function C($,m){var A={range:$};return P.defined(m)&&(A.data=m),A}w.create=C;function g($){var m=$;return P.defined(m)&&l.is(m.range)&&(P.undefined(m.command)||F.is(m.command))}w.is=g})(bi||(r.CodeLens=bi={}));var Cn;(function(w){function C($,m){return{tabSize:$,insertSpaces:m}}w.create=C;function g($){var m=$;return P.defined(m)&&P.uinteger(m.tabSize)&&P.boolean(m.insertSpaces)}w.is=g})(Cn||(r.FormattingOptions=Cn={}));var Ti;(function(w){function C($,m,A){return{range:$,target:m,data:A}}w.create=C;function g($){var m=$;return P.defined(m)&&l.is(m.range)&&(P.undefined(m.target)||P.string(m.target))}w.is=g})(Ti||(r.DocumentLink=Ti={}));var hs;(function(w){function C($,m){return{range:$,parent:m}}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&l.is(m.range)&&(m.parent===void 0||w.is(m.parent))}w.is=g})(hs||(r.SelectionRange=hs={}));var ps;(function(w){w.namespace="namespace",w.type="type",w.class="class",w.enum="enum",w.interface="interface",w.struct="struct",w.typeParameter="typeParameter",w.parameter="parameter",w.variable="variable",w.property="property",w.enumMember="enumMember",w.event="event",w.function="function",w.method="method",w.macro="macro",w.keyword="keyword",w.modifier="modifier",w.comment="comment",w.string="string",w.number="number",w.regexp="regexp",w.operator="operator",w.decorator="decorator"})(ps||(r.SemanticTokenTypes=ps={}));var Ei;(function(w){w.declaration="declaration",w.definition="definition",w.readonly="readonly",w.static="static",w.deprecated="deprecated",w.abstract="abstract",w.async="async",w.modification="modification",w.documentation="documentation",w.defaultLibrary="defaultLibrary"})(Ei||(r.SemanticTokenModifiers=Ei={}));var Ri;(function(w){function C(g){var $=g;return P.objectLiteral($)&&($.resultId===void 0||typeof $.resultId=="string")&&Array.isArray($.data)&&($.data.length===0||typeof $.data[0]=="number")}w.is=C})(Ri||(r.SemanticTokens=Ri={}));var gs;(function(w){function C($,m){return{range:$,text:m}}w.create=C;function g($){var m=$;return m!=null&&l.is(m.range)&&P.string(m.text)}w.is=g})(gs||(r.InlineValueText=gs={}));var ms;(function(w){function C($,m,A){return{range:$,variableName:m,caseSensitiveLookup:A}}w.create=C;function g($){var m=$;return m!=null&&l.is(m.range)&&P.boolean(m.caseSensitiveLookup)&&(P.string(m.variableName)||m.variableName===void 0)}w.is=g})(ms||(r.InlineValueVariableLookup=ms={}));var ys;(function(w){function C($,m){return{range:$,expression:m}}w.create=C;function g($){var m=$;return m!=null&&l.is(m.range)&&(P.string(m.expression)||m.expression===void 0)}w.is=g})(ys||(r.InlineValueEvaluatableExpression=ys={}));var vs;(function(w){function C($,m){return{frameId:$,stoppedLocation:m}}w.create=C;function g($){var m=$;return P.defined(m)&&l.is($.stoppedLocation)}w.is=g})(vs||(r.InlineValueContext=vs={}));var Si;(function(w){w.Type=1,w.Parameter=2;function C(g){return g===1||g===2}w.is=C})(Si||(r.InlayHintKind=Si={}));var $i;(function(w){function C($){return{value:$}}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&(m.tooltip===void 0||P.string(m.tooltip)||Ge.is(m.tooltip))&&(m.location===void 0||u.is(m.location))&&(m.command===void 0||F.is(m.command))}w.is=g})($i||(r.InlayHintLabelPart=$i={}));var sn;(function(w){function C($,m,A){var E={position:$,label:m};return A!==void 0&&(E.kind=A),E}w.create=C;function g($){var m=$;return P.objectLiteral(m)&&c.is(m.position)&&(P.string(m.label)||P.typedArray(m.label,$i.is))&&(m.kind===void 0||Si.is(m.kind))&&m.textEdits===void 0||P.typedArray(m.textEdits,x.is)&&(m.tooltip===void 0||P.string(m.tooltip)||Ge.is(m.tooltip))&&(m.paddingLeft===void 0||P.boolean(m.paddingLeft))&&(m.paddingRight===void 0||P.boolean(m.paddingRight))}w.is=g})(sn||(r.InlayHint=sn={}));var ws;(function(w){function C(g){return{kind:"snippet",value:g}}w.createSnippet=C})(ws||(r.StringValue=ws={}));var bs;(function(w){function C(g,$,m,A){return{insertText:g,filterText:$,range:m,command:A}}w.create=C})(bs||(r.InlineCompletionItem=bs={}));var fr;(function(w){function C(g){return{items:g}}w.create=C})(fr||(r.InlineCompletionList=fr={}));var Ts;(function(w){w.Invoked=0,w.Automatic=1})(Ts||(r.InlineCompletionTriggerKind=Ts={}));var Ur;(function(w){function C(g,$){return{range:g,text:$}}w.create=C})(Ur||(r.SelectedCompletionInfo=Ur={}));var Es;(function(w){function C(g,$){return{triggerKind:g,selectedCompletionInfo:$}}w.create=C})(Es||(r.InlineCompletionContext=Es={}));var An;(function(w){function C(g){var $=g;return P.objectLiteral($)&&s.is($.uri)&&P.string($.name)}w.is=C})(An||(r.WorkspaceFolder=An={})),r.EOL=[`
156
+ `,`\r
157
+ `,"\r"];var Kn;(function(w){function C(A,E,L,H){return new ao(A,E,L,H)}w.create=C;function g(A){var E=A;return!!(P.defined(E)&&P.string(E.uri)&&(P.undefined(E.languageId)||P.string(E.languageId))&&P.uinteger(E.lineCount)&&P.func(E.getText)&&P.func(E.positionAt)&&P.func(E.offsetAt))}w.is=g;function $(A,E){for(var L=A.getText(),H=m(E,function(he,Le){var Ae=he.range.start.line-Le.range.start.line;return Ae===0?he.range.start.character-Le.range.start.character:Ae}),Y=L.length,we=H.length-1;we>=0;we--){var me=H[we],Ce=A.offsetAt(me.range.start),ne=A.offsetAt(me.range.end);if(ne<=Y)L=L.substring(0,Ce)+me.newText+L.substring(ne,L.length);else throw new Error("Overlapping edit");Y=Ce}return L}w.applyEdits=$;function m(A,E){if(A.length<=1)return A;var L=A.length/2|0,H=A.slice(0,L),Y=A.slice(L);m(H,E),m(Y,E);for(var we=0,me=0,Ce=0;we<H.length&&me<Y.length;){var ne=E(H[we],Y[me]);ne<=0?A[Ce++]=H[we++]:A[Ce++]=Y[me++]}for(;we<H.length;)A[Ce++]=H[we++];for(;me<Y.length;)A[Ce++]=Y[me++];return A}})(Kn||(r.TextDocument=Kn={}));var ao=function(){function w(C,g,$,m){this._uri=C,this._languageId=g,this._version=$,this._content=m,this._lineOffsets=void 0}return Object.defineProperty(w.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),w.prototype.getText=function(C){if(C){var g=this.offsetAt(C.start),$=this.offsetAt(C.end);return this._content.substring(g,$)}return this._content},w.prototype.update=function(C,g){this._content=C.text,this._version=g,this._lineOffsets=void 0},w.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var C=[],g=this._content,$=!0,m=0;m<g.length;m++){$&&(C.push(m),$=!1);var A=g.charAt(m);$=A==="\r"||A===`
158
+ `,A==="\r"&&m+1<g.length&&g.charAt(m+1)===`
159
+ `&&m++}$&&g.length>0&&C.push(g.length),this._lineOffsets=C}return this._lineOffsets},w.prototype.positionAt=function(C){C=Math.max(Math.min(C,this._content.length),0);var g=this.getLineOffsets(),$=0,m=g.length;if(m===0)return c.create(0,C);for(;$<m;){var A=Math.floor(($+m)/2);g[A]>C?m=A:$=A+1}var E=$-1;return c.create(E,C-g[E])},w.prototype.offsetAt=function(C){var g=this.getLineOffsets();if(C.line>=g.length)return this._content.length;if(C.line<0)return 0;var $=g[C.line],m=C.line+1<g.length?g[C.line+1]:this._content.length;return Math.max(Math.min($+C.character,m),$)},Object.defineProperty(w.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),w}(),P;(function(w){var C=Object.prototype.toString;function g(ne){return typeof ne<"u"}w.defined=g;function $(ne){return typeof ne>"u"}w.undefined=$;function m(ne){return ne===!0||ne===!1}w.boolean=m;function A(ne){return C.call(ne)==="[object String]"}w.string=A;function E(ne){return C.call(ne)==="[object Number]"}w.number=E;function L(ne,he,Le){return C.call(ne)==="[object Number]"&&he<=ne&&ne<=Le}w.numberRange=L;function H(ne){return C.call(ne)==="[object Number]"&&-2147483648<=ne&&ne<=2147483647}w.integer=H;function Y(ne){return C.call(ne)==="[object Number]"&&0<=ne&&ne<=2147483647}w.uinteger=Y;function we(ne){return C.call(ne)==="[object Function]"}w.func=we;function me(ne){return ne!==null&&typeof ne=="object"}w.objectLiteral=me;function Ce(ne,he){return Array.isArray(ne)&&ne.every(he)}w.typedArray=Ce})(P||(P={}))})})(Fy,Fy.exports);var jy=Fy.exports,Te={};Object.defineProperty(Te,"__esModule",{value:!0}),Te.ProtocolNotificationType=Te.ProtocolNotificationType0=Te.ProtocolRequestType=Te.ProtocolRequestType0=Te.RegistrationType=Te.MessageDirection=void 0;const Wo=hn;var Ok;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(Ok||(Te.MessageDirection=Ok={}));class G8{constructor(e){this.method=e}}Te.RegistrationType=G8;class z8 extends Wo.RequestType0{constructor(e){super(e)}}Te.ProtocolRequestType0=z8;class H8 extends Wo.RequestType{constructor(e){super(e,Wo.ParameterStructures.byName)}}Te.ProtocolRequestType=H8;class K8 extends Wo.NotificationType0{constructor(e){super(e)}}Te.ProtocolNotificationType0=K8;class V8 extends Wo.NotificationType{constructor(e){super(e,Wo.ParameterStructures.byName)}}Te.ProtocolNotificationType=V8;var Lk={},ft={};Object.defineProperty(ft,"__esModule",{value:!0}),ft.objectLiteral=ft.typedArray=ft.stringArray=ft.array=ft.func=ft.error=ft.number=ft.string=ft.boolean=void 0;function Y8(t){return t===!0||t===!1}ft.boolean=Y8;function Mk(t){return typeof t=="string"||t instanceof String}ft.string=Mk;function X8(t){return typeof t=="number"||t instanceof Number}ft.number=X8;function J8(t){return t instanceof Error}ft.error=J8;function Q8(t){return typeof t=="function"}ft.func=Q8;function Fk(t){return Array.isArray(t)}ft.array=Fk;function Z8(t){return Fk(t)&&t.every(e=>Mk(e))}ft.stringArray=Z8;function e6(t,e){return Array.isArray(t)&&t.every(e)}ft.typedArray=e6;function t6(t){return t!==null&&typeof t=="object"}ft.objectLiteral=t6;var Ef={};Object.defineProperty(Ef,"__esModule",{value:!0}),Ef.ImplementationRequest=void 0;const jk=Te;var Uk;(function(t){t.method="textDocument/implementation",t.messageDirection=jk.MessageDirection.clientToServer,t.type=new jk.ProtocolRequestType(t.method)})(Uk||(Ef.ImplementationRequest=Uk={}));var Rf={};Object.defineProperty(Rf,"__esModule",{value:!0}),Rf.TypeDefinitionRequest=void 0;const Bk=Te;var qk;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=Bk.MessageDirection.clientToServer,t.type=new Bk.ProtocolRequestType(t.method)})(qk||(Rf.TypeDefinitionRequest=qk={}));var Go={};Object.defineProperty(Go,"__esModule",{value:!0}),Go.DidChangeWorkspaceFoldersNotification=Go.WorkspaceFoldersRequest=void 0;const Sf=Te;var Wk;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=Sf.MessageDirection.serverToClient,t.type=new Sf.ProtocolRequestType0(t.method)})(Wk||(Go.WorkspaceFoldersRequest=Wk={}));var Gk;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=Sf.MessageDirection.clientToServer,t.type=new Sf.ProtocolNotificationType(t.method)})(Gk||(Go.DidChangeWorkspaceFoldersNotification=Gk={}));var $f={};Object.defineProperty($f,"__esModule",{value:!0}),$f.ConfigurationRequest=void 0;const zk=Te;var Hk;(function(t){t.method="workspace/configuration",t.messageDirection=zk.MessageDirection.serverToClient,t.type=new zk.ProtocolRequestType(t.method)})(Hk||($f.ConfigurationRequest=Hk={}));var zo={};Object.defineProperty(zo,"__esModule",{value:!0}),zo.ColorPresentationRequest=zo.DocumentColorRequest=void 0;const kf=Te;var Kk;(function(t){t.method="textDocument/documentColor",t.messageDirection=kf.MessageDirection.clientToServer,t.type=new kf.ProtocolRequestType(t.method)})(Kk||(zo.DocumentColorRequest=Kk={}));var Vk;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=kf.MessageDirection.clientToServer,t.type=new kf.ProtocolRequestType(t.method)})(Vk||(zo.ColorPresentationRequest=Vk={}));var Ho={};Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.FoldingRangeRefreshRequest=Ho.FoldingRangeRequest=void 0;const _f=Te;var Yk;(function(t){t.method="textDocument/foldingRange",t.messageDirection=_f.MessageDirection.clientToServer,t.type=new _f.ProtocolRequestType(t.method)})(Yk||(Ho.FoldingRangeRequest=Yk={}));var Xk;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=_f.MessageDirection.serverToClient,t.type=new _f.ProtocolRequestType0(t.method)})(Xk||(Ho.FoldingRangeRefreshRequest=Xk={}));var Cf={};Object.defineProperty(Cf,"__esModule",{value:!0}),Cf.DeclarationRequest=void 0;const Jk=Te;var Qk;(function(t){t.method="textDocument/declaration",t.messageDirection=Jk.MessageDirection.clientToServer,t.type=new Jk.ProtocolRequestType(t.method)})(Qk||(Cf.DeclarationRequest=Qk={}));var Af={};Object.defineProperty(Af,"__esModule",{value:!0}),Af.SelectionRangeRequest=void 0;const Zk=Te;var e1;(function(t){t.method="textDocument/selectionRange",t.messageDirection=Zk.MessageDirection.clientToServer,t.type=new Zk.ProtocolRequestType(t.method)})(e1||(Af.SelectionRangeRequest=e1={}));var ji={};Object.defineProperty(ji,"__esModule",{value:!0}),ji.WorkDoneProgressCancelNotification=ji.WorkDoneProgressCreateRequest=ji.WorkDoneProgress=void 0;const n6=hn,If=Te;var t1;(function(t){t.type=new n6.ProgressType;function e(n){return n===t.type}t.is=e})(t1||(ji.WorkDoneProgress=t1={}));var n1;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=If.MessageDirection.serverToClient,t.type=new If.ProtocolRequestType(t.method)})(n1||(ji.WorkDoneProgressCreateRequest=n1={}));var r1;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=If.MessageDirection.clientToServer,t.type=new If.ProtocolNotificationType(t.method)})(r1||(ji.WorkDoneProgressCancelNotification=r1={}));var Ui={};Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.CallHierarchyOutgoingCallsRequest=Ui.CallHierarchyIncomingCallsRequest=Ui.CallHierarchyPrepareRequest=void 0;const Ko=Te;var i1;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=Ko.MessageDirection.clientToServer,t.type=new Ko.ProtocolRequestType(t.method)})(i1||(Ui.CallHierarchyPrepareRequest=i1={}));var s1;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=Ko.MessageDirection.clientToServer,t.type=new Ko.ProtocolRequestType(t.method)})(s1||(Ui.CallHierarchyIncomingCallsRequest=s1={}));var o1;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=Ko.MessageDirection.clientToServer,t.type=new Ko.ProtocolRequestType(t.method)})(o1||(Ui.CallHierarchyOutgoingCallsRequest=o1={}));var pn={};Object.defineProperty(pn,"__esModule",{value:!0}),pn.SemanticTokensRefreshRequest=pn.SemanticTokensRangeRequest=pn.SemanticTokensDeltaRequest=pn.SemanticTokensRequest=pn.SemanticTokensRegistrationType=pn.TokenFormat=void 0;const ui=Te;var a1;(function(t){t.Relative="relative"})(a1||(pn.TokenFormat=a1={}));var Yc;(function(t){t.method="textDocument/semanticTokens",t.type=new ui.RegistrationType(t.method)})(Yc||(pn.SemanticTokensRegistrationType=Yc={}));var c1;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=ui.MessageDirection.clientToServer,t.type=new ui.ProtocolRequestType(t.method),t.registrationMethod=Yc.method})(c1||(pn.SemanticTokensRequest=c1={}));var l1;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=ui.MessageDirection.clientToServer,t.type=new ui.ProtocolRequestType(t.method),t.registrationMethod=Yc.method})(l1||(pn.SemanticTokensDeltaRequest=l1={}));var u1;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=ui.MessageDirection.clientToServer,t.type=new ui.ProtocolRequestType(t.method),t.registrationMethod=Yc.method})(u1||(pn.SemanticTokensRangeRequest=u1={}));var d1;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=ui.MessageDirection.serverToClient,t.type=new ui.ProtocolRequestType0(t.method)})(d1||(pn.SemanticTokensRefreshRequest=d1={}));var xf={};Object.defineProperty(xf,"__esModule",{value:!0}),xf.ShowDocumentRequest=void 0;const f1=Te;var h1;(function(t){t.method="window/showDocument",t.messageDirection=f1.MessageDirection.serverToClient,t.type=new f1.ProtocolRequestType(t.method)})(h1||(xf.ShowDocumentRequest=h1={}));var Pf={};Object.defineProperty(Pf,"__esModule",{value:!0}),Pf.LinkedEditingRangeRequest=void 0;const p1=Te;var g1;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=p1.MessageDirection.clientToServer,t.type=new p1.ProtocolRequestType(t.method)})(g1||(Pf.LinkedEditingRangeRequest=g1={}));var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.WillDeleteFilesRequest=Wt.DidDeleteFilesNotification=Wt.DidRenameFilesNotification=Wt.WillRenameFilesRequest=Wt.DidCreateFilesNotification=Wt.WillCreateFilesRequest=Wt.FileOperationPatternKind=void 0;const jn=Te;var m1;(function(t){t.file="file",t.folder="folder"})(m1||(Wt.FileOperationPatternKind=m1={}));var y1;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=jn.MessageDirection.clientToServer,t.type=new jn.ProtocolRequestType(t.method)})(y1||(Wt.WillCreateFilesRequest=y1={}));var v1;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=jn.MessageDirection.clientToServer,t.type=new jn.ProtocolNotificationType(t.method)})(v1||(Wt.DidCreateFilesNotification=v1={}));var w1;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=jn.MessageDirection.clientToServer,t.type=new jn.ProtocolRequestType(t.method)})(w1||(Wt.WillRenameFilesRequest=w1={}));var b1;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=jn.MessageDirection.clientToServer,t.type=new jn.ProtocolNotificationType(t.method)})(b1||(Wt.DidRenameFilesNotification=b1={}));var T1;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=jn.MessageDirection.clientToServer,t.type=new jn.ProtocolNotificationType(t.method)})(T1||(Wt.DidDeleteFilesNotification=T1={}));var E1;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=jn.MessageDirection.clientToServer,t.type=new jn.ProtocolRequestType(t.method)})(E1||(Wt.WillDeleteFilesRequest=E1={}));var Bi={};Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.MonikerRequest=Bi.MonikerKind=Bi.UniquenessLevel=void 0;const R1=Te;var S1;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(S1||(Bi.UniquenessLevel=S1={}));var $1;(function(t){t.$import="import",t.$export="export",t.local="local"})($1||(Bi.MonikerKind=$1={}));var k1;(function(t){t.method="textDocument/moniker",t.messageDirection=R1.MessageDirection.clientToServer,t.type=new R1.ProtocolRequestType(t.method)})(k1||(Bi.MonikerRequest=k1={}));var qi={};Object.defineProperty(qi,"__esModule",{value:!0}),qi.TypeHierarchySubtypesRequest=qi.TypeHierarchySupertypesRequest=qi.TypeHierarchyPrepareRequest=void 0;const Vo=Te;var _1;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=Vo.MessageDirection.clientToServer,t.type=new Vo.ProtocolRequestType(t.method)})(_1||(qi.TypeHierarchyPrepareRequest=_1={}));var C1;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=Vo.MessageDirection.clientToServer,t.type=new Vo.ProtocolRequestType(t.method)})(C1||(qi.TypeHierarchySupertypesRequest=C1={}));var A1;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=Vo.MessageDirection.clientToServer,t.type=new Vo.ProtocolRequestType(t.method)})(A1||(qi.TypeHierarchySubtypesRequest=A1={}));var Yo={};Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.InlineValueRefreshRequest=Yo.InlineValueRequest=void 0;const Nf=Te;var I1;(function(t){t.method="textDocument/inlineValue",t.messageDirection=Nf.MessageDirection.clientToServer,t.type=new Nf.ProtocolRequestType(t.method)})(I1||(Yo.InlineValueRequest=I1={}));var x1;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=Nf.MessageDirection.serverToClient,t.type=new Nf.ProtocolRequestType0(t.method)})(x1||(Yo.InlineValueRefreshRequest=x1={}));var Wi={};Object.defineProperty(Wi,"__esModule",{value:!0}),Wi.InlayHintRefreshRequest=Wi.InlayHintResolveRequest=Wi.InlayHintRequest=void 0;const Xo=Te;var P1;(function(t){t.method="textDocument/inlayHint",t.messageDirection=Xo.MessageDirection.clientToServer,t.type=new Xo.ProtocolRequestType(t.method)})(P1||(Wi.InlayHintRequest=P1={}));var N1;(function(t){t.method="inlayHint/resolve",t.messageDirection=Xo.MessageDirection.clientToServer,t.type=new Xo.ProtocolRequestType(t.method)})(N1||(Wi.InlayHintResolveRequest=N1={}));var D1;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=Xo.MessageDirection.serverToClient,t.type=new Xo.ProtocolRequestType0(t.method)})(D1||(Wi.InlayHintRefreshRequest=D1={}));var Un={};Object.defineProperty(Un,"__esModule",{value:!0}),Un.DiagnosticRefreshRequest=Un.WorkspaceDiagnosticRequest=Un.DocumentDiagnosticRequest=Un.DocumentDiagnosticReportKind=Un.DiagnosticServerCancellationData=void 0;const O1=hn,r6=ft,Jo=Te;var L1;(function(t){function e(n){const r=n;return r&&r6.boolean(r.retriggerRequest)}t.is=e})(L1||(Un.DiagnosticServerCancellationData=L1={}));var M1;(function(t){t.Full="full",t.Unchanged="unchanged"})(M1||(Un.DocumentDiagnosticReportKind=M1={}));var F1;(function(t){t.method="textDocument/diagnostic",t.messageDirection=Jo.MessageDirection.clientToServer,t.type=new Jo.ProtocolRequestType(t.method),t.partialResult=new O1.ProgressType})(F1||(Un.DocumentDiagnosticRequest=F1={}));var j1;(function(t){t.method="workspace/diagnostic",t.messageDirection=Jo.MessageDirection.clientToServer,t.type=new Jo.ProtocolRequestType(t.method),t.partialResult=new O1.ProgressType})(j1||(Un.WorkspaceDiagnosticRequest=j1={}));var U1;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=Jo.MessageDirection.serverToClient,t.type=new Jo.ProtocolRequestType0(t.method)})(U1||(Un.DiagnosticRefreshRequest=U1={}));var ht={};Object.defineProperty(ht,"__esModule",{value:!0}),ht.DidCloseNotebookDocumentNotification=ht.DidSaveNotebookDocumentNotification=ht.DidChangeNotebookDocumentNotification=ht.NotebookCellArrayChange=ht.DidOpenNotebookDocumentNotification=ht.NotebookDocumentSyncRegistrationType=ht.NotebookDocument=ht.NotebookCell=ht.ExecutionSummary=ht.NotebookCellKind=void 0;const Xc=jy,ir=ft,Cr=Te;var Uy;(function(t){t.Markup=1,t.Code=2;function e(n){return n===1||n===2}t.is=e})(Uy||(ht.NotebookCellKind=Uy={}));var By;(function(t){function e(i,s){const o={executionOrder:i};return(s===!0||s===!1)&&(o.success=s),o}t.create=e;function n(i){const s=i;return ir.objectLiteral(s)&&Xc.uinteger.is(s.executionOrder)&&(s.success===void 0||ir.boolean(s.success))}t.is=n;function r(i,s){return i===s?!0:i==null||s===null||s===void 0?!1:i.executionOrder===s.executionOrder&&i.success===s.success}t.equals=r})(By||(ht.ExecutionSummary=By={}));var Df;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function n(s){const o=s;return ir.objectLiteral(o)&&Uy.is(o.kind)&&Xc.DocumentUri.is(o.document)&&(o.metadata===void 0||ir.objectLiteral(o.metadata))}t.is=n;function r(s,o){const a=new Set;return s.document!==o.document&&a.add("document"),s.kind!==o.kind&&a.add("kind"),s.executionSummary!==o.executionSummary&&a.add("executionSummary"),(s.metadata!==void 0||o.metadata!==void 0)&&!i(s.metadata,o.metadata)&&a.add("metadata"),(s.executionSummary!==void 0||o.executionSummary!==void 0)&&!By.equals(s.executionSummary,o.executionSummary)&&a.add("executionSummary"),a}t.diff=r;function i(s,o){if(s===o)return!0;if(s==null||o===null||o===void 0||typeof s!=typeof o||typeof s!="object")return!1;const a=Array.isArray(s),c=Array.isArray(o);if(a!==c)return!1;if(a&&c){if(s.length!==o.length)return!1;for(let l=0;l<s.length;l++)if(!i(s[l],o[l]))return!1}if(ir.objectLiteral(s)&&ir.objectLiteral(o)){const l=Object.keys(s),u=Object.keys(o);if(l.length!==u.length||(l.sort(),u.sort(),!i(l,u)))return!1;for(let d=0;d<l.length;d++){const f=l[d];if(!i(s[f],o[f]))return!1}}return!0}})(Df||(ht.NotebookCell=Df={}));var B1;(function(t){function e(r,i,s,o){return{uri:r,notebookType:i,version:s,cells:o}}t.create=e;function n(r){const i=r;return ir.objectLiteral(i)&&ir.string(i.uri)&&Xc.integer.is(i.version)&&ir.typedArray(i.cells,Df.is)}t.is=n})(B1||(ht.NotebookDocument=B1={}));var Qo;(function(t){t.method="notebookDocument/sync",t.messageDirection=Cr.MessageDirection.clientToServer,t.type=new Cr.RegistrationType(t.method)})(Qo||(ht.NotebookDocumentSyncRegistrationType=Qo={}));var q1;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=Cr.MessageDirection.clientToServer,t.type=new Cr.ProtocolNotificationType(t.method),t.registrationMethod=Qo.method})(q1||(ht.DidOpenNotebookDocumentNotification=q1={}));var W1;(function(t){function e(r){const i=r;return ir.objectLiteral(i)&&Xc.uinteger.is(i.start)&&Xc.uinteger.is(i.deleteCount)&&(i.cells===void 0||ir.typedArray(i.cells,Df.is))}t.is=e;function n(r,i,s){const o={start:r,deleteCount:i};return s!==void 0&&(o.cells=s),o}t.create=n})(W1||(ht.NotebookCellArrayChange=W1={}));var G1;(function(t){t.method="notebookDocument/didChange",t.messageDirection=Cr.MessageDirection.clientToServer,t.type=new Cr.ProtocolNotificationType(t.method),t.registrationMethod=Qo.method})(G1||(ht.DidChangeNotebookDocumentNotification=G1={}));var z1;(function(t){t.method="notebookDocument/didSave",t.messageDirection=Cr.MessageDirection.clientToServer,t.type=new Cr.ProtocolNotificationType(t.method),t.registrationMethod=Qo.method})(z1||(ht.DidSaveNotebookDocumentNotification=z1={}));var H1;(function(t){t.method="notebookDocument/didClose",t.messageDirection=Cr.MessageDirection.clientToServer,t.type=new Cr.ProtocolNotificationType(t.method),t.registrationMethod=Qo.method})(H1||(ht.DidCloseNotebookDocumentNotification=H1={}));var Of={};Object.defineProperty(Of,"__esModule",{value:!0}),Of.InlineCompletionRequest=void 0;const K1=Te;var V1;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=K1.MessageDirection.clientToServer,t.type=new K1.ProtocolRequestType(t.method)})(V1||(Of.InlineCompletionRequest=V1={})),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=Te,n=jy,r=ft,i=Ef;Object.defineProperty(t,"ImplementationRequest",{enumerable:!0,get:function(){return i.ImplementationRequest}});const s=Rf;Object.defineProperty(t,"TypeDefinitionRequest",{enumerable:!0,get:function(){return s.TypeDefinitionRequest}});const o=Go;Object.defineProperty(t,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return o.WorkspaceFoldersRequest}}),Object.defineProperty(t,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return o.DidChangeWorkspaceFoldersNotification}});const a=$f;Object.defineProperty(t,"ConfigurationRequest",{enumerable:!0,get:function(){return a.ConfigurationRequest}});const c=zo;Object.defineProperty(t,"DocumentColorRequest",{enumerable:!0,get:function(){return c.DocumentColorRequest}}),Object.defineProperty(t,"ColorPresentationRequest",{enumerable:!0,get:function(){return c.ColorPresentationRequest}});const l=Ho;Object.defineProperty(t,"FoldingRangeRequest",{enumerable:!0,get:function(){return l.FoldingRangeRequest}}),Object.defineProperty(t,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return l.FoldingRangeRefreshRequest}});const u=Cf;Object.defineProperty(t,"DeclarationRequest",{enumerable:!0,get:function(){return u.DeclarationRequest}});const d=Af;Object.defineProperty(t,"SelectionRangeRequest",{enumerable:!0,get:function(){return d.SelectionRangeRequest}});const f=ji;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=Ui;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 p=pn;Object.defineProperty(t,"TokenFormat",{enumerable:!0,get:function(){return p.TokenFormat}}),Object.defineProperty(t,"SemanticTokensRequest",{enumerable:!0,get:function(){return p.SemanticTokensRequest}}),Object.defineProperty(t,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return p.SemanticTokensDeltaRequest}}),Object.defineProperty(t,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return p.SemanticTokensRangeRequest}}),Object.defineProperty(t,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return p.SemanticTokensRefreshRequest}}),Object.defineProperty(t,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return p.SemanticTokensRegistrationType}});const y=xf;Object.defineProperty(t,"ShowDocumentRequest",{enumerable:!0,get:function(){return y.ShowDocumentRequest}});const R=Pf;Object.defineProperty(t,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return R.LinkedEditingRangeRequest}});const b=Wt;Object.defineProperty(t,"FileOperationPatternKind",{enumerable:!0,get:function(){return b.FileOperationPatternKind}}),Object.defineProperty(t,"DidCreateFilesNotification",{enumerable:!0,get:function(){return b.DidCreateFilesNotification}}),Object.defineProperty(t,"WillCreateFilesRequest",{enumerable:!0,get:function(){return b.WillCreateFilesRequest}}),Object.defineProperty(t,"DidRenameFilesNotification",{enumerable:!0,get:function(){return b.DidRenameFilesNotification}}),Object.defineProperty(t,"WillRenameFilesRequest",{enumerable:!0,get:function(){return b.WillRenameFilesRequest}}),Object.defineProperty(t,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return b.DidDeleteFilesNotification}}),Object.defineProperty(t,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return b.WillDeleteFilesRequest}});const v=Bi;Object.defineProperty(t,"UniquenessLevel",{enumerable:!0,get:function(){return v.UniquenessLevel}}),Object.defineProperty(t,"MonikerKind",{enumerable:!0,get:function(){return v.MonikerKind}}),Object.defineProperty(t,"MonikerRequest",{enumerable:!0,get:function(){return v.MonikerRequest}});const T=qi;Object.defineProperty(t,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return T.TypeHierarchyPrepareRequest}}),Object.defineProperty(t,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return T.TypeHierarchySubtypesRequest}}),Object.defineProperty(t,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return T.TypeHierarchySupertypesRequest}});const _=Yo;Object.defineProperty(t,"InlineValueRequest",{enumerable:!0,get:function(){return _.InlineValueRequest}}),Object.defineProperty(t,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return _.InlineValueRefreshRequest}});const N=Wi;Object.defineProperty(t,"InlayHintRequest",{enumerable:!0,get:function(){return N.InlayHintRequest}}),Object.defineProperty(t,"InlayHintResolveRequest",{enumerable:!0,get:function(){return N.InlayHintResolveRequest}}),Object.defineProperty(t,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return N.InlayHintRefreshRequest}});const F=Un;Object.defineProperty(t,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return F.DiagnosticServerCancellationData}}),Object.defineProperty(t,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return F.DocumentDiagnosticReportKind}}),Object.defineProperty(t,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return F.DocumentDiagnosticRequest}}),Object.defineProperty(t,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return F.WorkspaceDiagnosticRequest}}),Object.defineProperty(t,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return F.DiagnosticRefreshRequest}});const x=ht;Object.defineProperty(t,"NotebookCellKind",{enumerable:!0,get:function(){return x.NotebookCellKind}}),Object.defineProperty(t,"ExecutionSummary",{enumerable:!0,get:function(){return x.ExecutionSummary}}),Object.defineProperty(t,"NotebookCell",{enumerable:!0,get:function(){return x.NotebookCell}}),Object.defineProperty(t,"NotebookDocument",{enumerable:!0,get:function(){return x.NotebookDocument}}),Object.defineProperty(t,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return x.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(t,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return x.DidOpenNotebookDocumentNotification}}),Object.defineProperty(t,"NotebookCellArrayChange",{enumerable:!0,get:function(){return x.NotebookCellArrayChange}}),Object.defineProperty(t,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return x.DidChangeNotebookDocumentNotification}}),Object.defineProperty(t,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return x.DidSaveNotebookDocumentNotification}}),Object.defineProperty(t,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return x.DidCloseNotebookDocumentNotification}});const G=Of;Object.defineProperty(t,"InlineCompletionRequest",{enumerable:!0,get:function(){return G.InlineCompletionRequest}});var B;(function(g){function $(m){const A=m;return r.string(A)||r.string(A.language)||r.string(A.scheme)||r.string(A.pattern)}g.is=$})(B||(t.TextDocumentFilter=B={}));var W;(function(g){function $(m){const A=m;return r.objectLiteral(A)&&(r.string(A.notebookType)||r.string(A.scheme)||r.string(A.pattern))}g.is=$})(W||(t.NotebookDocumentFilter=W={}));var I;(function(g){function $(m){const A=m;return r.objectLiteral(A)&&(r.string(A.notebook)||W.is(A.notebook))&&(A.language===void 0||r.string(A.language))}g.is=$})(I||(t.NotebookCellTextDocumentFilter=I={}));var k;(function(g){function $(m){if(!Array.isArray(m))return!1;for(let A of m)if(!r.string(A)&&!B.is(A)&&!I.is(A))return!1;return!0}g.is=$})(k||(t.DocumentSelector=k={}));var S;(function(g){g.method="client/registerCapability",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType(g.method)})(S||(t.RegistrationRequest=S={}));var M;(function(g){g.method="client/unregisterCapability",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType(g.method)})(M||(t.UnregistrationRequest=M={}));var q;(function(g){g.Create="create",g.Rename="rename",g.Delete="delete"})(q||(t.ResourceOperationKind=q={}));var U;(function(g){g.Abort="abort",g.Transactional="transactional",g.TextOnlyTransactional="textOnlyTransactional",g.Undo="undo"})(U||(t.FailureHandlingKind=U={}));var z;(function(g){g.UTF8="utf-8",g.UTF16="utf-16",g.UTF32="utf-32"})(z||(t.PositionEncodingKind=z={}));var Pe;(function(g){function $(m){const A=m;return A&&r.string(A.id)&&A.id.length>0}g.hasId=$})(Pe||(t.StaticRegistrationOptions=Pe={}));var J;(function(g){function $(m){const A=m;return A&&(A.documentSelector===null||k.is(A.documentSelector))}g.is=$})(J||(t.TextDocumentRegistrationOptions=J={}));var j;(function(g){function $(A){const E=A;return r.objectLiteral(E)&&(E.workDoneProgress===void 0||r.boolean(E.workDoneProgress))}g.is=$;function m(A){const E=A;return E&&r.boolean(E.workDoneProgress)}g.hasWorkDoneProgress=m})(j||(t.WorkDoneProgressOptions=j={}));var ge;(function(g){g.method="initialize",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ge||(t.InitializeRequest=ge={}));var Nt;(function(g){g.unknownProtocolVersion=1})(Nt||(t.InitializeErrorCodes=Nt={}));var nn;(function(g){g.method="initialized",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(nn||(t.InitializedNotification=nn={}));var Ge;(function(g){g.method="shutdown",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType0(g.method)})(Ge||(t.ShutdownRequest=Ge={}));var wn;(function(g){g.method="exit",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType0(g.method)})(wn||(t.ExitNotification=wn={}));var Ue;(function(g){g.method="workspace/didChangeConfiguration",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(Ue||(t.DidChangeConfigurationNotification=Ue={}));var ot;(function(g){g.Error=1,g.Warning=2,g.Info=3,g.Log=4,g.Debug=5})(ot||(t.MessageType=ot={}));var vt;(function(g){g.method="window/showMessage",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(vt||(t.ShowMessageNotification=vt={}));var Be;(function(g){g.method="window/showMessageRequest",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType(g.method)})(Be||(t.ShowMessageRequest=Be={}));var wt;(function(g){g.method="window/logMessage",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(wt||(t.LogMessageNotification=wt={}));var Qe;(function(g){g.method="telemetry/event",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(Qe||(t.TelemetryEventNotification=Qe={}));var fe;(function(g){g.None=0,g.Full=1,g.Incremental=2})(fe||(t.TextDocumentSyncKind=fe={}));var nt;(function(g){g.method="textDocument/didOpen",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(nt||(t.DidOpenTextDocumentNotification=nt={}));var Oe;(function(g){function $(A){let E=A;return E!=null&&typeof E.text=="string"&&E.range!==void 0&&(E.rangeLength===void 0||typeof E.rangeLength=="number")}g.isIncremental=$;function m(A){let E=A;return E!=null&&typeof E.text=="string"&&E.range===void 0&&E.rangeLength===void 0}g.isFull=m})(Oe||(t.TextDocumentContentChangeEvent=Oe={}));var Dt;(function(g){g.method="textDocument/didChange",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(Dt||(t.DidChangeTextDocumentNotification=Dt={}));var Fr;(function(g){g.method="textDocument/didClose",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(Fr||(t.DidCloseTextDocumentNotification=Fr={}));var pi;(function(g){g.method="textDocument/didSave",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(pi||(t.DidSaveTextDocumentNotification=pi={}));var gi;(function(g){g.Manual=1,g.AfterDelay=2,g.FocusOut=3})(gi||(t.TextDocumentSaveReason=gi={}));var mi;(function(g){g.method="textDocument/willSave",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(mi||(t.WillSaveTextDocumentNotification=mi={}));var yi;(function(g){g.method="textDocument/willSaveWaitUntil",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(yi||(t.WillSaveTextDocumentWaitUntilRequest=yi={}));var rn;(function(g){g.method="workspace/didChangeWatchedFiles",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(rn||(t.DidChangeWatchedFilesNotification=rn={}));var vi;(function(g){g.Created=1,g.Changed=2,g.Deleted=3})(vi||(t.FileChangeType=vi={}));var us;(function(g){function $(m){const A=m;return r.objectLiteral(A)&&(n.URI.is(A.baseUri)||n.WorkspaceFolder.is(A.baseUri))&&r.string(A.pattern)}g.is=$})(us||(t.RelativePattern=us={}));var ds;(function(g){g.Create=1,g.Change=2,g.Delete=4})(ds||(t.WatchKind=ds={}));var jr;(function(g){g.method="textDocument/publishDiagnostics",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(jr||(t.PublishDiagnosticsNotification=jr={}));var fs;(function(g){g.Invoked=1,g.TriggerCharacter=2,g.TriggerForIncompleteCompletions=3})(fs||(t.CompletionTriggerKind=fs={}));var wi;(function(g){g.method="textDocument/completion",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(wi||(t.CompletionRequest=wi={}));var bi;(function(g){g.method="completionItem/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(bi||(t.CompletionResolveRequest=bi={}));var Cn;(function(g){g.method="textDocument/hover",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Cn||(t.HoverRequest=Cn={}));var Ti;(function(g){g.Invoked=1,g.TriggerCharacter=2,g.ContentChange=3})(Ti||(t.SignatureHelpTriggerKind=Ti={}));var hs;(function(g){g.method="textDocument/signatureHelp",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(hs||(t.SignatureHelpRequest=hs={}));var ps;(function(g){g.method="textDocument/definition",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ps||(t.DefinitionRequest=ps={}));var Ei;(function(g){g.method="textDocument/references",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Ei||(t.ReferencesRequest=Ei={}));var Ri;(function(g){g.method="textDocument/documentHighlight",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Ri||(t.DocumentHighlightRequest=Ri={}));var gs;(function(g){g.method="textDocument/documentSymbol",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(gs||(t.DocumentSymbolRequest=gs={}));var ms;(function(g){g.method="textDocument/codeAction",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ms||(t.CodeActionRequest=ms={}));var ys;(function(g){g.method="codeAction/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ys||(t.CodeActionResolveRequest=ys={}));var vs;(function(g){g.method="workspace/symbol",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(vs||(t.WorkspaceSymbolRequest=vs={}));var Si;(function(g){g.method="workspaceSymbol/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Si||(t.WorkspaceSymbolResolveRequest=Si={}));var $i;(function(g){g.method="textDocument/codeLens",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})($i||(t.CodeLensRequest=$i={}));var sn;(function(g){g.method="codeLens/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(sn||(t.CodeLensResolveRequest=sn={}));var ws;(function(g){g.method="workspace/codeLens/refresh",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType0(g.method)})(ws||(t.CodeLensRefreshRequest=ws={}));var bs;(function(g){g.method="textDocument/documentLink",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(bs||(t.DocumentLinkRequest=bs={}));var fr;(function(g){g.method="documentLink/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(fr||(t.DocumentLinkResolveRequest=fr={}));var Ts;(function(g){g.method="textDocument/formatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Ts||(t.DocumentFormattingRequest=Ts={}));var Ur;(function(g){g.method="textDocument/rangeFormatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Ur||(t.DocumentRangeFormattingRequest=Ur={}));var Es;(function(g){g.method="textDocument/rangesFormatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Es||(t.DocumentRangesFormattingRequest=Es={}));var An;(function(g){g.method="textDocument/onTypeFormatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(An||(t.DocumentOnTypeFormattingRequest=An={}));var Kn;(function(g){g.Identifier=1})(Kn||(t.PrepareSupportDefaultBehavior=Kn={}));var ao;(function(g){g.method="textDocument/rename",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ao||(t.RenameRequest=ao={}));var P;(function(g){g.method="textDocument/prepareRename",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(P||(t.PrepareRenameRequest=P={}));var w;(function(g){g.method="workspace/executeCommand",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(w||(t.ExecuteCommandRequest=w={}));var C;(function(g){g.method="workspace/applyEdit",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType("workspace/applyEdit")})(C||(t.ApplyWorkspaceEditRequest=C={}))}(Lk);var Lf={};Object.defineProperty(Lf,"__esModule",{value:!0}),Lf.createProtocolConnection=void 0;const Y1=hn;function i6(t,e,n,r){return Y1.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,Y1.createMessageConnection)(t,e,n,r)}Lf.createProtocolConnection=i6,function(t){var e=gt&&gt.__createBinding||(Object.create?function(s,o,a,c){c===void 0&&(c=a);var l=Object.getOwnPropertyDescriptor(o,a);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,c,l)}:function(s,o,a,c){c===void 0&&(c=a),s[c]=o[a]}),n=gt&&gt.__exportStar||function(s,o){for(var a in s)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,s,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.LSPErrorCodes=t.createProtocolConnection=void 0,n(hn,t),n(jy,t),n(Te,t),n(Lk,t);var r=Lf;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={}))}(Dk),function(t){var e=gt&&gt.__createBinding||(Object.create?function(s,o,a,c){c===void 0&&(c=a);var l=Object.getOwnPropertyDescriptor(o,a);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,c,l)}:function(s,o,a,c){c===void 0&&(c=a),s[c]=o[a]}),n=gt&&gt.__exportStar||function(s,o){for(var a in s)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,s,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.createProtocolConnection=void 0;const r=Nk;n(Nk,t),n(Dk,t);function i(s,o,a,c){return(0,r.createMessageConnection)(s,o,a,c)}t.createProtocolConnection=i}(Xe);var kn={};Object.defineProperty(kn,"__esModule",{value:!0}),kn.generateUuid=kn.parse=kn.isUUID=kn.v4=kn.empty=void 0;class qy{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}}class ve extends qy{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return ve._oneOf(ve._chars)}constructor(){super([ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),"-",ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),"-","4",ve._randomHex(),ve._randomHex(),ve._randomHex(),"-",ve._oneOf(ve._timeHighBits),ve._randomHex(),ve._randomHex(),ve._randomHex(),"-",ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex()].join(""))}}ve._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"],ve._timeHighBits=["8","9","a","b"],kn.empty=new qy("00000000-0000-0000-0000-000000000000");function X1(){return new ve}kn.v4=X1;const s6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function J1(t){return s6.test(t)}kn.isUUID=J1;function o6(t){if(!J1(t))throw new Error("invalid uuid");return new qy(t)}kn.parse=o6;function a6(){return X1().asHex()}kn.generateUuid=a6;var Gi={};Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.attachPartialResult=Gi.ProgressFeature=Gi.attachWorkDone=void 0;const zi=Xe,c6=kn;class ls{constructor(e,n){this._connection=e,this._token=n,ls.Instances.set(this._token,this)}begin(e,n,r,i){let s={kind:"begin",title:e,percentage:n,message:r,cancellable:i};this._connection.sendProgress(zi.WorkDoneProgress.type,this._token,s)}report(e,n){let r={kind:"report"};typeof e=="number"?(r.percentage=e,n!==void 0&&(r.message=n)):r.message=e,this._connection.sendProgress(zi.WorkDoneProgress.type,this._token,r)}done(){ls.Instances.delete(this._token),this._connection.sendProgress(zi.WorkDoneProgress.type,this._token,{kind:"end"})}}ls.Instances=new Map;class Q1 extends ls{constructor(e,n){super(e,n),this._source=new zi.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}}class Wy{constructor(){}begin(){}report(){}done(){}}class Z1 extends Wy{constructor(){super(),this._source=new zi.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}}function l6(t,e){if(e===void 0||e.workDoneToken===void 0)return new Wy;const n=e.workDoneToken;return delete e.workDoneToken,new ls(t,n)}Gi.attachWorkDone=l6;const u6=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(zi.WorkDoneProgressCancelNotification.type,n=>{let r=ls.Instances.get(n.token);(r instanceof Q1||r instanceof Z1)&&r.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Wy:new ls(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){const e=(0,c6.generateUuid)();return this.connection.sendRequest(zi.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new Q1(this.connection,e))}else return Promise.resolve(new Z1)}};Gi.ProgressFeature=u6;var Gy;(function(t){t.type=new zi.ProgressType})(Gy||(Gy={}));class d6{constructor(e,n){this._connection=e,this._token=n}report(e){this._connection.sendProgress(Gy.type,this._token,e)}}function f6(t,e){if(e===void 0||e.partialResultToken===void 0)return;const n=e.partialResultToken;return delete e.partialResultToken,new d6(t,n)}Gi.attachPartialResult=f6;var Mf={};Object.defineProperty(Mf,"__esModule",{value:!0}),Mf.ConfigurationFeature=void 0;const h6=Xe,p6=dt,g6=t=>class extends t{getConfiguration(e){return e?p6.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let n={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(h6.ConfigurationRequest.type,n).then(r=>Array.isArray(r)?Array.isArray(e)?r:r[0]:Array.isArray(e)?[]:null)}};Mf.ConfigurationFeature=g6;var Ff={};Object.defineProperty(Ff,"__esModule",{value:!0}),Ff.WorkspaceFoldersFeature=void 0;const jf=Xe,m6=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let n=e.workspace;n&&n.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new jf.Emitter,this.connection.onNotification(jf.DidChangeWorkspaceFoldersNotification.type,r=>{this._onDidChangeWorkspaceFolders.fire(r.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);const n=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=n===!0||typeof n=="string"}getWorkspaceFolders(){return this.connection.sendRequest(jf.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(jf.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Ff.WorkspaceFoldersFeature=m6;var Uf={};Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.CallHierarchyFeature=void 0;const zy=Xe,y6=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(zy.CallHierarchyPrepareRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0)),onIncomingCalls:e=>{const n=zy.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onOutgoingCalls:e=>{const n=zy.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Uf.CallHierarchyFeature=y6;var di={};Object.defineProperty(di,"__esModule",{value:!0}),di.SemanticTokensBuilder=di.SemanticTokensDiff=di.SemanticTokensFeature=void 0;const Bf=Xe,v6=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Bf.SemanticTokensRefreshRequest.type),on:e=>{const n=Bf.SemanticTokensRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onDelta:e=>{const n=Bf.SemanticTokensDeltaRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onRange:e=>{const n=Bf.SemanticTokensRangeRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};di.SemanticTokensFeature=v6;class e_{constructor(e,n){this.originalSequence=e,this.modifiedSequence=n}computeDiff(){const e=this.originalSequence.length,n=this.modifiedSequence.length;let r=0;for(;r<n&&r<e&&this.originalSequence[r]===this.modifiedSequence[r];)r++;if(r<n&&r<e){let i=e-1,s=n-1;for(;i>=r&&s>=r&&this.originalSequence[i]===this.modifiedSequence[s];)i--,s--;(i<r||s<r)&&(i++,s++);const o=i-r+1,a=this.modifiedSequence.slice(r,s+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:r,deleteCount:o-1}]:[{start:r,deleteCount:o,data:a}]}else return r<n?[{start:r,deleteCount:0,data:this.modifiedSequence.slice(r)}]:r<e?[{start:r,deleteCount:e-r}]:[]}}di.SemanticTokensDiff=e_;let w6=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(e,n,r,i,s){let o=e,a=n;this._dataLen>0&&(o-=this._prevLine,o===0&&(a-=this._prevChar)),this._data[this._dataLen++]=o,this._data[this._dataLen++]=a,this._data[this._dataLen++]=r,this._data[this._dataLen++]=i,this._data[this._dataLen++]=s,this._prevLine=e,this._prevChar=n}get id(){return this._id.toString()}previousResult(e){this.id===e&&(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 e_(this._prevData,this._data).computeDiff()}:this.build()}};di.SemanticTokensBuilder=w6;var qf={};Object.defineProperty(qf,"__esModule",{value:!0}),qf.ShowDocumentFeature=void 0;const b6=Xe,T6=t=>class extends t{showDocument(e){return this.connection.sendRequest(b6.ShowDocumentRequest.type,e)}};qf.ShowDocumentFeature=T6;var Wf={};Object.defineProperty(Wf,"__esModule",{value:!0}),Wf.FileOperationsFeature=void 0;const Zo=Xe,E6=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(Zo.DidCreateFilesNotification.type,n=>{e(n)})}onDidRenameFiles(e){return this.connection.onNotification(Zo.DidRenameFilesNotification.type,n=>{e(n)})}onDidDeleteFiles(e){return this.connection.onNotification(Zo.DidDeleteFilesNotification.type,n=>{e(n)})}onWillCreateFiles(e){return this.connection.onRequest(Zo.WillCreateFilesRequest.type,(n,r)=>e(n,r))}onWillRenameFiles(e){return this.connection.onRequest(Zo.WillRenameFilesRequest.type,(n,r)=>e(n,r))}onWillDeleteFiles(e){return this.connection.onRequest(Zo.WillDeleteFilesRequest.type,(n,r)=>e(n,r))}};Wf.FileOperationsFeature=E6;var Gf={};Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.LinkedEditingRangeFeature=void 0;const R6=Xe,S6=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(R6.LinkedEditingRangeRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0))}};Gf.LinkedEditingRangeFeature=S6;var zf={};Object.defineProperty(zf,"__esModule",{value:!0}),zf.TypeHierarchyFeature=void 0;const Hy=Xe,$6=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(Hy.TypeHierarchyPrepareRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0)),onSupertypes:e=>{const n=Hy.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onSubtypes:e=>{const n=Hy.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};zf.TypeHierarchyFeature=$6;var Hf={};Object.defineProperty(Hf,"__esModule",{value:!0}),Hf.InlineValueFeature=void 0;const t_=Xe,k6=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(t_.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(t_.InlineValueRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n)))}}};Hf.InlineValueFeature=k6;var Kf={};Object.defineProperty(Kf,"__esModule",{value:!0}),Kf.FoldingRangeFeature=void 0;const n_=Xe,_6=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(n_.FoldingRangeRefreshRequest.type),on:e=>{const n=n_.FoldingRangeRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Kf.FoldingRangeFeature=_6;var Vf={};Object.defineProperty(Vf,"__esModule",{value:!0}),Vf.InlayHintFeature=void 0;const Ky=Xe,C6=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Ky.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Ky.InlayHintRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n))),resolve:e=>this.connection.onRequest(Ky.InlayHintResolveRequest.type,(n,r)=>e(n,r))}}};Vf.InlayHintFeature=C6;var Yf={};Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.DiagnosticFeature=void 0;const Jc=Xe,A6=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Jc.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Jc.DocumentDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(Jc.DocumentDiagnosticRequest.partialResult,n))),onWorkspace:e=>this.connection.onRequest(Jc.WorkspaceDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(Jc.WorkspaceDiagnosticRequest.partialResult,n)))}}};Yf.DiagnosticFeature=A6;var qs={},Qc={};Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.TextDocuments=void 0;const Ws=Xe;class I6{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Ws.Emitter,this._onDidOpen=new Ws.Emitter,this._onDidClose=new Ws.Emitter,this._onDidSave=new Ws.Emitter,this._onWillSave=new Ws.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(e)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=Ws.TextDocumentSyncKind.Incremental;const n=[];return n.push(e.onDidOpenTextDocument(r=>{const i=r.textDocument,s=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,s);const o=Object.freeze({document:s});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:o}=i;if(o==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=this._syncedDocuments.get(i.uri);a!==void 0&&(a=this._configuration.update(a,s,o),this._syncedDocuments.set(i.uri,a),this._onDidChangeContent.fire(Object.freeze({document:a})))})),n.push(e.onDidCloseTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(r.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),n.push(e.onWillSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:r.reason}))})),n.push(e.onWillSaveTextDocumentWaitUntil((r,i)=>{let s=this._syncedDocuments.get(r.textDocument.uri);return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:r.reason}),i):[]})),n.push(e.onDidSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),Ws.Disposable.create(()=>{n.forEach(r=>r.dispose())})}}Qc.TextDocuments=I6,Object.defineProperty(qs,"__esModule",{value:!0}),qs.NotebookDocuments=qs.NotebookSyncFeature=void 0;const Bn=Xe,r_=Qc,x6=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(Bn.DidOpenNotebookDocumentNotification.type,n=>{e(n)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(Bn.DidChangeNotebookDocumentNotification.type,n=>{e(n)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(Bn.DidSaveNotebookDocumentNotification.type,n=>{e(n)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(Bn.DidCloseNotebookDocumentNotification.type,n=>{e(n)})}}};qs.NotebookSyncFeature=x6;class xa{onDidOpenTextDocument(e){return this.openHandler=e,Bn.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,Bn.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,Bn.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return xa.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return xa.NULL_DISPOSE}onDidSaveTextDocument(){return xa.NULL_DISPOSE}}xa.NULL_DISPOSE=Object.freeze({dispose:()=>{}});class P6{constructor(e){e instanceof r_.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new r_.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new Bn.Emitter,this._onDidChange=new Bn.Emitter,this._onDidSave=new Bn.Emitter,this._onDidClose=new Bn.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){const n=this.notebookCellMap.get(e);return n&&n[0]}findNotebookDocumentForCell(e){const n=typeof e=="string"?e:e.document,r=this.notebookCellMap.get(n);return r&&r[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(e){const n=new xa,r=[];return r.push(this.cellTextDocuments.listen(n)),r.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(const s of i.cellTextDocuments)n.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),r.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{const s=this.notebookDocuments.get(i.notebookDocument.uri);if(s===void 0)return;s.version=i.notebookDocument.version;const o=s.metadata;let a=!1;const c=i.change;c.metadata!==void 0&&(a=!0,s.metadata=c.metadata);const l=[],u=[],d=[],f=[];if(c.cells!==void 0){const b=c.cells;if(b.structure!==void 0){const v=b.structure.array;if(s.cells.splice(v.start,v.deleteCount,...v.cells!==void 0?v.cells:[]),b.structure.didOpen!==void 0)for(const T of b.structure.didOpen)n.openTextDocument({textDocument:T}),l.push(T.uri);if(b.structure.didClose)for(const T of b.structure.didClose)n.closeTextDocument({textDocument:T}),u.push(T.uri)}if(b.data!==void 0){const v=new Map(b.data.map(T=>[T.document,T]));for(let T=0;T<=s.cells.length;T++){const _=v.get(s.cells[T].document);if(_!==void 0){const N=s.cells.splice(T,1,_);if(d.push({old:N[0],new:_}),v.delete(_.document),v.size===0)break}}}if(b.textContent!==void 0)for(const v of b.textContent)n.changeTextDocument({textDocument:v.document,contentChanges:v.changes}),f.push(v.document.uri)}this.updateCellMap(s);const h={notebookDocument:s};a&&(h.metadata={old:o,new:s.metadata});const p=[];for(const b of l)p.push(this.getNotebookCell(b));const y=[];for(const b of u)y.push(this.getNotebookCell(b));const R=[];for(const b of f)R.push(this.getNotebookCell(b));(p.length>0||y.length>0||d.length>0||R.length>0)&&(h.cells={added:p,removed:y,changed:{data:d,textContent:R}}),(h.metadata!==void 0||h.cells!==void 0)&&this._onDidChange.fire(h)})),r.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{const s=this.notebookDocuments.get(i.notebookDocument.uri);s!==void 0&&this._onDidSave.fire(s)})),r.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{const s=this.notebookDocuments.get(i.notebookDocument.uri);if(s!==void 0){this._onDidClose.fire(s);for(const o of i.cellTextDocuments)n.closeTextDocument({textDocument:o});this.notebookDocuments.delete(i.notebookDocument.uri);for(const o of s.cells)this.notebookCellMap.delete(o.document)}})),Bn.Disposable.create(()=>{r.forEach(i=>i.dispose())})}updateCellMap(e){for(const n of e.cells)this.notebookCellMap.set(n.document,[n,e])}}qs.NotebookDocuments=P6;var Xf={};Object.defineProperty(Xf,"__esModule",{value:!0}),Xf.MonikerFeature=void 0;const N6=Xe,D6=t=>class extends t{get moniker(){return{on:e=>{const n=N6.MonikerRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Xf.MonikerFeature=D6,Object.defineProperty(_e,"__esModule",{value:!0}),_e.createConnection=_e.combineFeatures=_e.combineNotebooksFeatures=_e.combineLanguagesFeatures=_e.combineWorkspaceFeatures=_e.combineWindowFeatures=_e.combineClientFeatures=_e.combineTracerFeatures=_e.combineTelemetryFeatures=_e.combineConsoleFeatures=_e._NotebooksImpl=_e._LanguagesImpl=_e.BulkUnregistration=_e.BulkRegistration=_e.ErrorMessageTracker=void 0;const X=Xe,qn=dt,Vy=kn,le=Gi,O6=Mf,L6=Ff,M6=Uf,F6=di,j6=qf,U6=Wf,B6=Gf,q6=zf,W6=Hf,G6=Kf,z6=Vf,H6=Yf,K6=qs,V6=Xf;function Yy(t){if(t!==null)return t}class Y6{constructor(){this._messages=Object.create(null)}add(e){let n=this._messages[e];n||(n=0),n++,this._messages[e]=n}sendErrors(e){Object.keys(this._messages).forEach(n=>{e.window.showErrorMessage(n)})}}_e.ErrorMessageTracker=Y6;class i_{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(X.MessageType.Error,e)}warn(e){this.send(X.MessageType.Warning,e)}info(e){this.send(X.MessageType.Info,e)}log(e){this.send(X.MessageType.Log,e)}debug(e){this.send(X.MessageType.Debug,e)}send(e,n){this._rawConnection&&this._rawConnection.sendNotification(X.LogMessageNotification.type,{type:e,message:n}).catch(()=>{(0,X.RAL)().console.error("Sending log message failed")})}}class X6{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...n){let r={type:X.MessageType.Error,message:e,actions:n};return this.connection.sendRequest(X.ShowMessageRequest.type,r).then(Yy)}showWarningMessage(e,...n){let r={type:X.MessageType.Warning,message:e,actions:n};return this.connection.sendRequest(X.ShowMessageRequest.type,r).then(Yy)}showInformationMessage(e,...n){let r={type:X.MessageType.Info,message:e,actions:n};return this.connection.sendRequest(X.ShowMessageRequest.type,r).then(Yy)}}const s_=(0,j6.ShowDocumentFeature)((0,le.ProgressFeature)(X6));var o_;(function(t){function e(){return new a_}t.create=e})(o_||(_e.BulkRegistration=o_={}));class a_{constructor(){this._registrations=[],this._registered=new Set}add(e,n){const r=qn.string(e)?e:e.method;if(this._registered.has(r))throw new Error(`${r} is already added to this registration`);const i=Vy.generateUuid();this._registrations.push({id:i,method:r,registerOptions:n||{}}),this._registered.add(r)}asRegistrationParams(){return{registrations:this._registrations}}}var c_;(function(t){function e(){return new Xy(void 0,[])}t.create=e})(c_||(_e.BulkUnregistration=c_={}));class Xy{constructor(e,n){this._connection=e,this._unregistrations=new Map,n.forEach(r=>{this._unregistrations.set(r.method,r)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let r of this._unregistrations.values())e.push(r);let n={unregisterations:e};this._connection.sendRequest(X.UnregistrationRequest.type,n).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){const n=qn.string(e)?e:e.method,r=this._unregistrations.get(n);if(!r)return!1;let i={unregisterations:[r]};return this._connection.sendRequest(X.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(n)},s=>{this._connection.console.info(`Un-registering request handler for ${r.id} failed.`)}),!0}}class l_{attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,n,r){return e instanceof a_?this.registerMany(e):e instanceof Xy?this.registerSingle1(e,n,r):this.registerSingle2(e,n)}registerSingle1(e,n,r){const i=qn.string(n)?n:n.method,s=Vy.generateUuid();let o={registrations:[{id:s,method:i,registerOptions:r||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(X.RegistrationRequest.type,o).then(a=>(e.add({id:s,method:i}),e),a=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(a)))}registerSingle2(e,n){const r=qn.string(e)?e:e.method,i=Vy.generateUuid();let s={registrations:[{id:i,method:r,registerOptions:n||{}}]};return this.connection.sendRequest(X.RegistrationRequest.type,s).then(o=>X.Disposable.create(()=>{this.unregisterSingle(i,r).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),o=>(this.connection.console.info(`Registering request handler for ${r} failed.`),Promise.reject(o)))}unregisterSingle(e,n){let r={unregisterations:[{id:e,method:n}]};return this.connection.sendRequest(X.UnregistrationRequest.type,r).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let n=e.asRegistrationParams();return this.connection.sendRequest(X.RegistrationRequest.type,n).then(()=>new Xy(this._connection,n.registrations.map(r=>({id:r.id,method:r.method}))),r=>(this.connection.console.info("Bulk registration failed."),Promise.reject(r)))}}class J6{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function n(i){return i&&!!i.edit}let r=n(e)?e:{edit:e};return this.connection.sendRequest(X.ApplyWorkspaceEditRequest.type,r)}}const u_=(0,U6.FileOperationsFeature)((0,L6.WorkspaceFoldersFeature)((0,O6.ConfigurationFeature)(J6)));class d_{constructor(){this._trace=X.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,n){this._trace!==X.Trace.Off&&this.connection.sendNotification(X.LogTraceNotification.type,{message:e,verbose:this._trace===X.Trace.Verbose?n:void 0}).catch(()=>{})}}class f_{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(X.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}}class h_{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,le.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,n){return(0,le.attachPartialResult)(this.connection,n)}}_e._LanguagesImpl=h_;const p_=(0,G6.FoldingRangeFeature)((0,V6.MonikerFeature)((0,H6.DiagnosticFeature)((0,z6.InlayHintFeature)((0,W6.InlineValueFeature)((0,q6.TypeHierarchyFeature)((0,B6.LinkedEditingRangeFeature)((0,F6.SemanticTokensFeature)((0,M6.CallHierarchyFeature)(h_)))))))));class g_{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,le.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,n){return(0,le.attachPartialResult)(this.connection,n)}}_e._NotebooksImpl=g_;const m_=(0,K6.NotebookSyncFeature)(g_);function y_(t,e){return function(n){return e(t(n))}}_e.combineConsoleFeatures=y_;function v_(t,e){return function(n){return e(t(n))}}_e.combineTelemetryFeatures=v_;function w_(t,e){return function(n){return e(t(n))}}_e.combineTracerFeatures=w_;function b_(t,e){return function(n){return e(t(n))}}_e.combineClientFeatures=b_;function T_(t,e){return function(n){return e(t(n))}}_e.combineWindowFeatures=T_;function E_(t,e){return function(n){return e(t(n))}}_e.combineWorkspaceFeatures=E_;function R_(t,e){return function(n){return e(t(n))}}_e.combineLanguagesFeatures=R_;function S_(t,e){return function(n){return e(t(n))}}_e.combineNotebooksFeatures=S_;function Q6(t,e){function n(i,s,o){return i&&s?o(i,s):i||s}return{__brand:"features",console:n(t.console,e.console,y_),tracer:n(t.tracer,e.tracer,w_),telemetry:n(t.telemetry,e.telemetry,v_),client:n(t.client,e.client,b_),window:n(t.window,e.window,T_),workspace:n(t.workspace,e.workspace,E_),languages:n(t.languages,e.languages,R_),notebooks:n(t.notebooks,e.notebooks,S_)}}_e.combineFeatures=Q6;function Z6(t,e,n){const r=n&&n.console?new(n.console(i_)):new i_,i=t(r);r.rawAttach(i);const s=n&&n.tracer?new(n.tracer(d_)):new d_,o=n&&n.telemetry?new(n.telemetry(f_)):new f_,a=n&&n.client?new(n.client(l_)):new l_,c=n&&n.window?new(n.window(s_)):new s_,l=n&&n.workspace?new(n.workspace(u_)):new u_,u=n&&n.languages?new(n.languages(p_)):new p_,d=n&&n.notebooks?new(n.notebooks(m_)):new m_,f=[r,s,o,a,c,l,u,d];function h(v){return v instanceof Promise?v:qn.thenable(v)?new Promise((T,_)=>{v.then(N=>T(N),N=>_(N))}):Promise.resolve(v)}let p,y,R,b={listen:()=>i.listen(),sendRequest:(v,...T)=>i.sendRequest(qn.string(v)?v:v.method,...T),onRequest:(v,T)=>i.onRequest(v,T),sendNotification:(v,T)=>{const _=qn.string(v)?v:v.method;return i.sendNotification(_,T)},onNotification:(v,T)=>i.onNotification(v,T),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:v=>(y=v,{dispose:()=>{y=void 0}}),onInitialized:v=>i.onNotification(X.InitializedNotification.type,v),onShutdown:v=>(p=v,{dispose:()=>{p=void 0}}),onExit:v=>(R=v,{dispose:()=>{R=void 0}}),get console(){return r},get telemetry(){return o},get tracer(){return s},get client(){return a},get window(){return c},get workspace(){return l},get languages(){return u},get notebooks(){return d},onDidChangeConfiguration:v=>i.onNotification(X.DidChangeConfigurationNotification.type,v),onDidChangeWatchedFiles:v=>i.onNotification(X.DidChangeWatchedFilesNotification.type,v),__textDocumentSync:void 0,onDidOpenTextDocument:v=>i.onNotification(X.DidOpenTextDocumentNotification.type,v),onDidChangeTextDocument:v=>i.onNotification(X.DidChangeTextDocumentNotification.type,v),onDidCloseTextDocument:v=>i.onNotification(X.DidCloseTextDocumentNotification.type,v),onWillSaveTextDocument:v=>i.onNotification(X.WillSaveTextDocumentNotification.type,v),onWillSaveTextDocumentWaitUntil:v=>i.onRequest(X.WillSaveTextDocumentWaitUntilRequest.type,v),onDidSaveTextDocument:v=>i.onNotification(X.DidSaveTextDocumentNotification.type,v),sendDiagnostics:v=>i.sendNotification(X.PublishDiagnosticsNotification.type,v),onHover:v=>i.onRequest(X.HoverRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),void 0)),onCompletion:v=>i.onRequest(X.CompletionRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onCompletionResolve:v=>i.onRequest(X.CompletionResolveRequest.type,v),onSignatureHelp:v=>i.onRequest(X.SignatureHelpRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),void 0)),onDeclaration:v=>i.onRequest(X.DeclarationRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onDefinition:v=>i.onRequest(X.DefinitionRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onTypeDefinition:v=>i.onRequest(X.TypeDefinitionRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onImplementation:v=>i.onRequest(X.ImplementationRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onReferences:v=>i.onRequest(X.ReferencesRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onDocumentHighlight:v=>i.onRequest(X.DocumentHighlightRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onDocumentSymbol:v=>i.onRequest(X.DocumentSymbolRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onWorkspaceSymbol:v=>i.onRequest(X.WorkspaceSymbolRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onWorkspaceSymbolResolve:v=>i.onRequest(X.WorkspaceSymbolResolveRequest.type,v),onCodeAction:v=>i.onRequest(X.CodeActionRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onCodeActionResolve:v=>i.onRequest(X.CodeActionResolveRequest.type,(T,_)=>v(T,_)),onCodeLens:v=>i.onRequest(X.CodeLensRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onCodeLensResolve:v=>i.onRequest(X.CodeLensResolveRequest.type,(T,_)=>v(T,_)),onDocumentFormatting:v=>i.onRequest(X.DocumentFormattingRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),void 0)),onDocumentRangeFormatting:v=>i.onRequest(X.DocumentRangeFormattingRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),void 0)),onDocumentOnTypeFormatting:v=>i.onRequest(X.DocumentOnTypeFormattingRequest.type,(T,_)=>v(T,_)),onRenameRequest:v=>i.onRequest(X.RenameRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),void 0)),onPrepareRename:v=>i.onRequest(X.PrepareRenameRequest.type,(T,_)=>v(T,_)),onDocumentLinks:v=>i.onRequest(X.DocumentLinkRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onDocumentLinkResolve:v=>i.onRequest(X.DocumentLinkResolveRequest.type,(T,_)=>v(T,_)),onDocumentColor:v=>i.onRequest(X.DocumentColorRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onColorPresentation:v=>i.onRequest(X.ColorPresentationRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onFoldingRanges:v=>i.onRequest(X.FoldingRangeRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onSelectionRanges:v=>i.onRequest(X.SelectionRangeRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),(0,le.attachPartialResult)(i,T))),onExecuteCommand:v=>i.onRequest(X.ExecuteCommandRequest.type,(T,_)=>v(T,_,(0,le.attachWorkDone)(i,T),void 0)),dispose:()=>i.dispose()};for(let v of f)v.attach(b);return i.onRequest(X.InitializeRequest.type,v=>{e.initialize(v),qn.string(v.trace)&&(s.trace=X.Trace.fromString(v.trace));for(let T of f)T.initialize(v.capabilities);if(y){let T=y(v,new X.CancellationTokenSource().token,(0,le.attachWorkDone)(i,v),void 0);return h(T).then(_=>{if(_ instanceof X.ResponseError)return _;let N=_;N||(N={capabilities:{}});let F=N.capabilities;F||(F={},N.capabilities=F),F.textDocumentSync===void 0||F.textDocumentSync===null?F.textDocumentSync=qn.number(b.__textDocumentSync)?b.__textDocumentSync:X.TextDocumentSyncKind.None:!qn.number(F.textDocumentSync)&&!qn.number(F.textDocumentSync.change)&&(F.textDocumentSync.change=qn.number(b.__textDocumentSync)?b.__textDocumentSync:X.TextDocumentSyncKind.None);for(let x of f)x.fillServerCapabilities(F);return N})}else{let T={capabilities:{textDocumentSync:X.TextDocumentSyncKind.None}};for(let _ of f)_.fillServerCapabilities(T.capabilities);return T}}),i.onRequest(X.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,p)return p(new X.CancellationTokenSource().token)}),i.onNotification(X.ExitNotification.type,()=>{try{R&&R()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(X.SetTraceNotification.type,v=>{s.trace=X.Trace.fromString(v.value)}),b}_e.createConnection=Z6;var gn={};Object.defineProperty(gn,"__esModule",{value:!0}),gn.resolveModulePath=gn.FileSystem=gn.resolveGlobalYarnPath=gn.resolveGlobalNodePath=gn.resolve=gn.uriToFilePath=void 0;const eW=tD,sr=Pa,Jy=Iu,Qy=zb;function tW(t){let e=eW.parse(t);if(e.protocol!=="file:"||!e.path)return;let n=e.path.split("/");for(var r=0,i=n.length;r<i;r++)n[r]=decodeURIComponent(n[r]);if(process.platform==="win32"&&n.length>1){let s=n[0],o=n[1];s.length===0&&o.length>1&&o[1]===":"&&n.shift()}return sr.normalize(n.join("/"))}gn.uriToFilePath=tW;function Zy(){return process.platform==="win32"}function Jf(t,e,n,r){const i="NODE_PATH",s=["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((o,a)=>{let c=process.env,l=Object.create(null);Object.keys(c).forEach(u=>l[u]=c[u]),e&&Jy.existsSync(e)&&(l[i]?l[i]=e+sr.delimiter+l[i]:l[i]=e,r&&r(`NODE_PATH value is: ${l[i]}`)),l.ELECTRON_RUN_AS_NODE="1";try{let u=(0,Qy.fork)("",[],{cwd:n,env:l,execArgv:["-e",s]});if(u.pid===void 0){a(new Error(`Starting process to resolve node module ${t} failed`));return}u.on("error",f=>{a(f)}),u.on("message",f=>{f.c==="r"&&(u.send({c:"e"}),f.s?o(f.r):a(new Error(`Failed to resolve module: ${t}`)))});let d={c:"rs",a:t};u.send(d)}catch(u){a(u)}})}gn.resolve=Jf;function ev(t){let e="npm";const n=Object.create(null);Object.keys(process.env).forEach(s=>n[s]=process.env[s]),n.NO_UPDATE_NOTIFIER="true";const r={encoding:"utf8",env:n};Zy()&&(e="npm.cmd",r.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let s=(0,Qy.spawnSync)(e,["config","get","prefix"],r).stdout;if(!s){t&&t("'npm config get prefix' didn't return a value.");return}let o=s.trim();return t&&t(`'npm config get prefix' value is: ${o}`),o.length>0?Zy()?sr.join(o,"node_modules"):sr.join(o,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}gn.resolveGlobalNodePath=ev;function nW(t){let e="yarn",n={encoding:"utf8"};Zy()&&(e="yarn.cmd",n.shell=!0);let r=()=>{};try{process.on("SIGPIPE",r);let i=(0,Qy.spawnSync)(e,["global","dir","--json"],n),s=i.stdout;if(!s){t&&(t("'yarn global dir' didn't return a value."),i.stderr&&t(i.stderr));return}let o=s.trim().split(/\r?\n/);for(let a of o)try{let c=JSON.parse(a);if(c.type==="log")return sr.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",r)}}gn.resolveGlobalYarnPath=nW;var tv;(function(t){let e;function n(){return e!==void 0||(process.platform==="win32"?e=!1:e=!Jy.existsSync(__filename.toUpperCase())||!Jy.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=n;function r(i,s){return n()?sr.normalize(s).indexOf(sr.normalize(i))===0:sr.normalize(s).toLowerCase().indexOf(sr.normalize(i).toLowerCase())===0}t.isParent=r})(tv||(gn.FileSystem=tv={}));function rW(t,e,n,r){return n?(sr.isAbsolute(n)||(n=sr.join(t,n)),Jf(e,n,n,r).then(i=>tv.isParent(n,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>Jf(e,ev(r),t,r))):Jf(e,ev(r),t,r)}gn.resolveModulePath=rW;var $_=Xe,k_={},Qf={};Object.defineProperty(Qf,"__esModule",{value:!0}),Qf.InlineCompletionFeature=void 0;const iW=Xe,sW=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(iW.InlineCompletionRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n)))}}};Qf.InlineCompletionFeature=sW,function(t){var e=gt&&gt.__createBinding||(Object.create?function(c,l,u,d){d===void 0&&(d=u);var f=Object.getOwnPropertyDescriptor(l,u);(!f||("get"in f?!l.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(c,d,f)}:function(c,l,u,d){d===void 0&&(d=u),c[d]=l[u]}),n=gt&&gt.__exportStar||function(c,l){for(var u in c)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&e(l,c,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.ProposedFeatures=t.NotebookDocuments=t.TextDocuments=t.SemanticTokensBuilder=void 0;const r=di;Object.defineProperty(t,"SemanticTokensBuilder",{enumerable:!0,get:function(){return r.SemanticTokensBuilder}});const i=Qf;n(Xe,t);const s=Qc;Object.defineProperty(t,"TextDocuments",{enumerable:!0,get:function(){return s.TextDocuments}});const o=qs;Object.defineProperty(t,"NotebookDocuments",{enumerable:!0,get:function(){return o.NotebookDocuments}}),n(_e,t);var a;(function(c){c.all={__brand:"features",languages:i.InlineCompletionFeature}})(a||(t.ProposedFeatures=a={}))}(k_),function(t){var e=gt&&gt.__createBinding||(Object.create?function(b,v,T,_){_===void 0&&(_=T);var N=Object.getOwnPropertyDescriptor(v,T);(!N||("get"in N?!v.__esModule:N.writable||N.configurable))&&(N={enumerable:!0,get:function(){return v[T]}}),Object.defineProperty(b,_,N)}:function(b,v,T,_){_===void 0&&(_=T),b[_]=v[T]}),n=gt&&gt.__exportStar||function(b,v){for(var T in b)T!=="default"&&!Object.prototype.hasOwnProperty.call(v,T)&&e(v,b,T)};Object.defineProperty(t,"__esModule",{value:!0}),t.createConnection=t.Files=void 0;const r=ON,i=dt,s=_e,o=gn,a=$_;n($_,t),n(k_,t);var c;(function(b){b.uriToFilePath=o.uriToFilePath,b.resolveGlobalNodePath=o.resolveGlobalNodePath,b.resolveGlobalYarnPath=o.resolveGlobalYarnPath,b.resolve=o.resolve,b.resolveModulePath=o.resolveModulePath})(c||(t.Files=c={}));function l(){}let u=!1,d;function f(){const b="--clientProcessId";function v(T){try{let _=parseInt(T);isNaN(_)||(d=setInterval(()=>{try{process.kill(_,0)}catch{process.exit(u?0:1)}},3e3))}catch{}}for(let T=2;T<process.argv.length;T++){let _=process.argv[T];if(_===b&&T+1<process.argv.length){v(process.argv[T+1]);return}else{let N=_.split("=");N[0]===b&&v(N[1])}}}f();const h={initialize:b=>{const v=b.processId;i.number(v)&&d===void 0&&setInterval(()=>{try{process.kill(v,0)}catch{process.exit(u?0:1)}},3e3)},get shutdownReceived(){return u},set shutdownReceived(b){u=b},exit:b=>{process.exit(b)}};function p(b,v,T,_){let N,F,x,G;return b!==void 0&&b.__brand==="features"&&(N=b,b=v,v=T,T=_),a.ConnectionStrategy.is(b)||a.ConnectionOptions.is(b)?G=b:(F=b,x=v,G=T),y(F,x,G,N)}t.createConnection=p;function y(b,v,T,_){let N=!1;if(!b&&!v&&process.argv.length>2){let B,W,I=process.argv.slice(2);for(let k=0;k<I.length;k++){let S=I[k];if(S==="--node-ipc"){b=new a.IPCMessageReader(process),v=new a.IPCMessageWriter(process);break}else if(S==="--stdio"){N=!0,b=process.stdin,v=process.stdout;break}else if(S==="--socket"){B=parseInt(I[k+1]);break}else if(S==="--pipe"){W=I[k+1];break}else{var F=S.split("=");if(F[0]==="--socket"){B=parseInt(F[1]);break}else if(F[0]==="--pipe"){W=F[1];break}}}if(B){let k=(0,a.createServerSocketTransport)(B);b=k[0],v=k[1]}else if(W){let k=(0,a.createServerPipeTransport)(W);b=k[0],v=k[1]}}var x="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!b)throw new Error("Connection input stream is not set. "+x);if(!v)throw new Error("Connection output stream is not set. "+x);if(i.func(b.read)&&i.func(b.on)){let B=b;B.on("end",()=>{process.exit(u?0:1)}),B.on("close",()=>{process.exit(u?0:1)})}const G=B=>{const W=(0,a.createProtocolConnection)(b,v,B,T);return N&&R(B),W};return(0,s.createConnection)(G,h,_)}function R(b){function v(_){return _.map(N=>typeof N=="string"?N:(0,r.inspect)(N)).join(" ")}const T=new Map;console.assert=function(N,...F){if(!N)if(F.length===0)b.error("Assertion failed");else{const[x,...G]=F;b.error(`Assertion failed: ${x} ${v(G)}`)}},console.count=function(N="default"){const F=String(N);let x=T.get(F)??0;x+=1,T.set(F,x),b.log(`${F}: ${F}`)},console.countReset=function(N){N===void 0?T.clear():T.delete(String(N))},console.debug=function(...N){b.log(v(N))},console.dir=function(N,F){b.log((0,r.inspect)(N,F))},console.log=function(...N){b.log(v(N))},console.error=function(...N){b.error(v(N))},console.trace=function(...N){const F=new Error().stack.replace(/(.+\n){2}/,"");let x="Trace";N.length!==0&&(x+=`: ${v(N)}`),b.log(`${x}
160
+ ${F}`)},console.warn=function(...N){b.warn(v(N))}}}(te);function __(t,e){const n={stacks:t,tokens:e};return oW(n),n.stacks.flat().forEach(i=>{i.property=void 0}),A_(n.stacks).map(i=>i[i.length-1])}function nv(t){const{next:e,cardinalities:n,visited:r,plus:i}=t,s=[],o=e.feature;if(r.has(o))return[];r.add(o);let a,c=o;for(;c.$container;)if(Ii(c.$container)){a=c.$container;break}else if(Dg(c.$container))c=c.$container;else break;if(YT(c.cardinality)){const l=ea({next:{feature:c,type:e.type},cardinalities:n,visited:r,plus:i});for(const u of l)i.add(u.feature);s.push(...l)}if(a){const l=a.elements.indexOf(c);l!==void 0&&l<a.elements.length-1&&s.push(...C_({feature:a,type:e.type},l+1,n,r,i)),s.every(u=>Co(u.feature.cardinality,u.feature)||Co(n.get(u.feature))||i.has(u.feature))&&s.push(...nv({next:{feature:a,type:e.type},cardinalities:n,visited:r,plus:i}))}return s}function rv(t){return ct(t)&&(t={feature:t}),ea({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function ea(t){var e,n,r;const{next:i,cardinalities:s,visited:o,plus:a}=t;if(i===void 0)return[];const{feature:c,type:l}=i;if(Ii(c)){if(o.has(c))return[];o.add(c)}if(Ii(c))return C_(i,0,s,o,a).map(u=>Zf(u,c.cardinality,s));if(jg(c)||Ug(c))return c.elements.flatMap(u=>ea({next:{feature:u,type:l,property:i.property},cardinalities:s,visited:o,plus:a})).map(u=>Zf(u,c.cardinality,s));if(yr(c)){const u={feature:c.terminal,type:l,property:(e=i.property)!==null&&e!==void 0?e:c.feature};return ea({next:u,cardinalities:s,visited:o,plus:a}).map(d=>Zf(d,c.cardinality,s))}else{if(As(c))return nv({next:{feature:c,type:bc(c),property:(n=i.property)!==null&&n!==void 0?n:c.feature},cardinalities:s,visited:o,plus:a});if(Vr(c)&&Bt(c.rule.ref)){const u=c.rule.ref,d={feature:u.definition,type:u.fragment||u.dataType?void 0:(r=Is(u))!==null&&r!==void 0?r:u.name,property:i.property};return ea({next:d,cardinalities:s,visited:o,plus:a}).map(f=>Zf(f,c.cardinality,s))}else return[i]}}function Zf(t,e,n){return n.set(t.feature,e),t}function C_(t,e,n,r,i){var s;const o=[];let a;for(;e<t.feature.elements.length&&(a={feature:t.feature.elements[e++],type:t.type},o.push(...ea({next:a,cardinalities:n,visited:r,plus:i})),!!Co((s=a.feature.cardinality)!==null&&s!==void 0?s:n.get(a.feature),a.feature)););return o}function oW(t){for(const e of t.tokens){const n=A_(t.stacks,e);t.stacks=n}}function A_(t,e){const n=[];for(const r of t)n.push(...aW(r,e));return n}function aW(t,e){const n=new Map,r=new Set(t.map(s=>s.feature).filter(cW)),i=[];for(;t.length>0;){const s=t.pop(),o=nv({next:s,cardinalities:n,plus:r,visited:new Set}).filter(a=>e?iv(a.feature,e):!0);for(const a of o)i.push([...t,a]);if(!o.every(a=>Co(a.feature.cardinality,a.feature)||Co(n.get(a.feature))))break}return i}function cW(t){if(t.cardinality==="+")return!0;const e=an(t,yr);return!!(e&&e.cardinality==="+")}function iv(t,e){if(vr(t))return t.value===e.image;if(Vr(t))return lW(t.rule.ref,e);if(ic(t)){const n=Xg(t);if(n)return iv(n,e)}return!1}function lW(t,e){return Bt(t)?rv(t.definition).some(r=>iv(r.feature,e)):Kr(t)?Tc(t).test(e.image):!1}function uW(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 I_{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),o=(l,u)=>{const d=this.fillCompletionItem(l,u);d&&i.push(d)},a=l=>vr(l.feature)?l.feature.value:l.feature,c=[];for(const l of s)if(await Promise.all(Me(l.features).distinct(a).exclude(c).map(u=>this.completionFor(l,u,o))),c.push(...l.features),!this.continueCompletion(i))break;return te.CompletionList.create(this.deduplicateItems(i),!0)}deduplicateItems(e){return Me(e).distinct(n=>`${n.kind}_${n.label}_${n.detail}`).toArray()}findFeaturesAt(e,n){const r=e.getText({start:te.Position.create(0,0),end:e.positionAt(n)}),i=this.completionParser.parse(r),s=i.tokens;if(i.tokenIndex===0){const c=wd(this.grammar),l=rv({feature:c.definition,type:Is(c)});return s.length>0?(s.shift(),__(l.map(u=>[u]),s)):l}const o=[...s].splice(i.tokenIndex);return __([i.elementStack.map(c=>({feature:c}))],o)}*buildContexts(e,n){var r,i;const s=e.parseResult.value.$cstNode;if(!s)return;const o=e.textDocument,a=o.getText(),c=o.offsetAt(n),l={document:e,textDocument:o,offset:c,position:n},u=this.findDataTypeRuleStart(s,c);if(u){const[v,T]=u,_=(r=td(s,v))===null||r===void 0?void 0:r.astNode;yield Object.assign(Object.assign({},l),{node:_,tokenOffset:v,tokenEndOffset:T,features:this.findFeaturesAt(o,v)})}const{nextTokenStart:d,nextTokenEnd:f,previousTokenStart:h,previousTokenEnd:p}=this.backtrackToAnyToken(a,c);let y=d;c<=d&&h!==void 0&&(y=h);const R=(i=td(s,y))===null||i===void 0?void 0:i.astNode;let b=!0;if(h!==void 0&&p!==void 0&&p===c&&(yield Object.assign(Object.assign({},l),{node:R,tokenOffset:h,tokenEndOffset:p,features:this.findFeaturesAt(o,h)}),b=this.performNextTokenCompletion(e,a.substring(h,p),h,p),b&&(yield Object.assign(Object.assign({},l),{node:R,tokenOffset:p,tokenEndOffset:p,features:this.findFeaturesAt(o,p)}))),R)b&&(yield Object.assign(Object.assign({},l),{node:R,tokenOffset:d,tokenEndOffset:f,features:this.findFeaturesAt(o,d)}));else{const v=wd(this.grammar);if(!v)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},l),{tokenOffset:d,tokenEndOffset:f,features:rv(v.definition)})}}performNextTokenCompletion(e,n,r,i){return/\P{L}$/u.test(n)}findDataTypeRuleStart(e,n){var r,i;let s=Ai(e,n,this.grammarConfig.nameRegexp),o=!!(!((r=an(s?.grammarSource,Bt))===null||r===void 0)&&r.dataType);if(o){for(;o;)s=s?.container,o=!!(!((i=an(s?.grammarSource,Bt))===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(vr(n.feature))return this.completionForKeyword(e,n.feature,r);if(ic(n.feature)&&e.node)return this.completionForCrossReference(e,n,r)}completionForCrossReference(e,n,r){const i=an(n.feature,yr);let s=e.node;if(i&&s){n.type&&(s={$type:n.type,$container:s,$containerProperty:n.property},Gg(this.astReflection,s));const o={reference:{$refText:""},container:s,property:i.feature};try{for(const a of this.getReferenceCandidates(o,e))r(e,this.createReferenceCompletionItem(a))}catch(a){console.error(a)}}}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 te.CompletionItemKind.Keyword}filterKeyword(e,n){return/\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 l=this.nameProvider.getName(n.node);if(!l)return;s=l}else if("nodeDescription"in n)s=n.nodeDescription.name;else return;let o;typeof((r=n.textEdit)===null||r===void 0?void 0:r.newText)=="string"?o=n.textEdit.newText:typeof n.insertText=="string"?o=n.insertText:o=s;const a=(i=n.textEdit)!==null&&i!==void 0?i:this.buildCompletionTextEdit(e,s,o);return a?{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:a,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 o=e.textDocument.positionAt(e.tokenOffset),a=e.position;return{newText:r,range:{start:o,end:a}}}else return}}class dW{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,o=Ai(s,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(o)return this.collectLocationLinks(o,n)}}collectLocationLinks(e,n){var r;const i=this.findLink(e);if(i)return[te.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=Yt(n.astNode);if(n&&r)return{source:e,target:n,targetDocument:r}}}}class x_{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=Ai(i,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(!s)return;const o=this.references.findDeclaration(s);if(o){const a=mt.equals(Yt(o).uri,e.uri),c={documentUri:e.uri,includeDeclaration:a};return this.references.findReferences(o,c).map(u=>this.createDocumentHighlight(u)).toArray()}}createDocumentHighlight(e){return te.DocumentHighlight.create(e.segment.range)}}class fW{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 yc(n)){const s=this.getSymbol(e,i);r.push(...s)}if(r.length>0)return r}}class hW{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=Me(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(te.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([qt.parse(e.document.uri)],[])}didChangeWatchedFiles(e){const n=Me(e.changes).filter(i=>i.type!==te.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>qt.parse(i.uri)).toArray(),r=Me(e.changes).filter(i=>i.type===te.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>qt.parse(i.uri)).toArray();this.fireDocumentUpdate(n,r)}}class pW{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e,n,r){const i=[],s=o=>i.push(o);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=wr(i).iterator();let o;do if(o=s.next(),!o.done){const a=o.value;this.shouldProcess(a)&&this.collectObjectFolding(e,a,n),this.shouldProcessContent(a)||s.prune()}while(!o.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 RT(i))if(this.commentNames.includes(s.tokenType.name)){const o=this.toFoldingRange(e,s,te.FoldingRangeKind.Comment);o&&r(o)}}}toFoldingRange(e,n,r){const i=n.range,s=i.start;let o=i.end;if(!(o.line-s.line<2))return this.includeLastFoldingLine(n,r)||(o=e.textDocument.positionAt(e.textDocument.offsetAt({line:o.line,character:0})-1)),te.FoldingRange.create(s.line,o.line,s.character,o.character,r)}includeLastFoldingLine(e,n){if(n===te.FoldingRangeKind.Comment)return!1;const r=e.text,i=r.charAt(r.length-1);return!(i==="}"||i===")"||i==="]")}}class gW{match(e,n){if(e.length===0)return!0;let r=!1,i,s=0;const o=n.length;for(let a=0;a<o;a++){const c=n.charCodeAt(a),l=e.charCodeAt(s);if((c===l||this.toUpperCharCode(c)===this.toUpperCharCode(l))&&(r||(r=i===void 0||this.isWordTransition(i,c)),r&&s++,s===e.length))return!0;i=c}return!1}isWordTransition(e,n){return P_<=e&&e<=N_&&mW<=n&&n<=yW||e===D_&&n!==D_}toUpperCharCode(e){return P_<=e&&e<=N_?e-32:e}}const P_=97,N_=122,mW=65,yW=90,D_=95;class O_{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 o=e.textDocument.offsetAt(n.position),a=Ai(s,o,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>o){const c=this.references.findDeclaration(a);if(c)return this.getAstNodeHoverContent(c)}}}}class vW extends O_{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}}}}const wW={[te.SemanticTokenTypes.class]:0,[te.SemanticTokenTypes.comment]:1,[te.SemanticTokenTypes.enum]:2,[te.SemanticTokenTypes.enumMember]:3,[te.SemanticTokenTypes.event]:4,[te.SemanticTokenTypes.function]:5,[te.SemanticTokenTypes.interface]:6,[te.SemanticTokenTypes.keyword]:7,[te.SemanticTokenTypes.macro]:8,[te.SemanticTokenTypes.method]:9,[te.SemanticTokenTypes.modifier]:10,[te.SemanticTokenTypes.namespace]:11,[te.SemanticTokenTypes.number]:12,[te.SemanticTokenTypes.operator]:13,[te.SemanticTokenTypes.parameter]:14,[te.SemanticTokenTypes.property]:15,[te.SemanticTokenTypes.regexp]:16,[te.SemanticTokenTypes.string]:17,[te.SemanticTokenTypes.struct]:18,[te.SemanticTokenTypes.type]:19,[te.SemanticTokenTypes.typeParameter]:20,[te.SemanticTokenTypes.variable]:21,[te.SemanticTokenTypes.decorator]:22},bW={[te.SemanticTokenModifiers.abstract]:1,[te.SemanticTokenModifiers.async]:2,[te.SemanticTokenModifiers.declaration]:4,[te.SemanticTokenModifiers.defaultLibrary]:8,[te.SemanticTokenModifiers.definition]:16,[te.SemanticTokenModifiers.deprecated]:32,[te.SemanticTokenModifiers.documentation]:64,[te.SemanticTokenModifiers.modification]:128,[te.SemanticTokenModifiers.readonly]:256,[te.SemanticTokenModifiers.static]:512};function TW(t){const e=[],n=[];let r=!0,i=!0,s=!0;for(const o of t)o&&(o.legend.tokenTypes.forEach((a,c)=>{const l=e[c];if(l&&l!==a)throw new Error(`Cannot merge '${l}' and '${a}' token types. They use the same index ${c}.`);e[c]=a}),o.legend.tokenModifiers.forEach((a,c)=>{const l=n[c];if(l&&l!==a)throw new Error(`Cannot merge '${l}' and '${a}' token modifier. They use the same index ${c}.`);n[c]=a}),o.full?typeof o.full=="object"&&!o.full.delta&&(i=!1):r=!1,o.range||(s=!1));return{legend:{tokenTypes:e,tokenModifiers:n},full:r&&{delta:i},range:s}}class EW extends te.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 RW{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 wW}get tokenModifiers(){return bW}get semanticTokensOptions(){return{legend:{tokenTypes:Object.keys(this.tokenTypes),tokenModifiers:Object.keys(this.tokenModifiers)},full:{delta:!0},range:!0}}async semanticHighlight(e,n,r=Ze.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=Ze.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=Ze.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 EW;return this.tokensBuilders.set(e.uri.toString(),r),r}async computeHighlighting(e,n,r){const i=e.parseResult.value,s=Yr(i,{range:this.currentRange}).iterator();let o;do if(o=s.next(),!o.done){await Pt(r);const a=o.value;this.highlightElement(a,n)==="prune"&&s.prune()}while(!o.done)}highlightToken(e){var n;const{range:r,type:i}=e;let s=e.modifier;if(this.currentRange&&!Cg(r,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;const o=this.tokenTypes[i];let a=0;if(s!==void 0){typeof s=="string"&&(s=[s]);for(const u of s){const d=this.tokenModifiers[u];a|=d}}const c=r.start.line,l=r.end.line;if(c===l){const u=r.start.character,d=r.end.character-u;this.currentTokensBuilder.push(c,u,d,o,a)}else if(!((n=this.clientCapabilities)===null||n===void 0)&&n.multilineTokenSupport){const u=r.start.character,d=this.currentDocument.textDocument.offsetAt(r.start),f=this.currentDocument.textDocument.offsetAt(r.end);this.currentTokensBuilder.push(c,u,f-d,o,a)}else{const u=r.start;let d=this.currentDocument.textDocument.offsetAt({line:c+1,character:0});this.currentTokensBuilder.push(u.line,u.character,d-u.character-1,o,a);for(let f=c+1;f<l;f++){const h=d;d=this.currentDocument.textDocument.offsetAt({line:f+1,character:0}),this.currentTokensBuilder.push(f,0,d-h-1,o,a)}this.currentTokensBuilder.push(l,0,r.end.character,o,a)}}highlightProperty(e){const n=[];if(typeof e.index=="number"){const s=bn(e.node.$cstNode,e.property,e.index);s&&n.push(s)}else n.push(..._o(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:o}=e,a=[];if(typeof s=="number"){const c=wc(n.$cstNode,r,s);c&&a.push(c)}else a.push(...Qg(n.$cstNode,r));for(const c of a)this.highlightNode({node:c,type:i,modifier:o})}highlightNode(e){const{node:n,type:r,modifier:i}=e,s=n.range;this.highlightToken({range:s,type:r,modifier:i})}}var L_;(function(t){function e(r,i,s){const o=new Map;Object.entries(i).forEach(([l,u])=>o.set(u,l));let a=0,c=0;return n(r.data,5).map(l=>{a+=l[0],l[0]!==0&&(c=0),c+=l[1];const u=l[2];return{offset:s.textDocument.offsetAt({line:a,character:c}),tokenType:o.get(l[3]),tokenModifiers:l[4],text:s.textDocument.getText({start:{line:a,character:c},end:{line:a,character:c+u}})}})}t.decode=e;function n(r,i){const s=[];for(let o=0;o<r.length;o+=i){const a=r.slice(o,o+i);s.push(a)}return s}})(L_||(L_={}));function SW(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 $W{constructor(e){this.onInitializeEmitter=new Xe.Emitter,this.onInitializedEmitter=new Xe.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(){xy(this.services),this.services.ServiceRegistry.all.forEach(e=>xy(e))}hasService(e){return this.services.ServiceRegistry.all.some(r=>e(r)!==void 0)}buildInitializeResult(e){var n,r,i,s;const o=this.services.lsp.DocumentUpdateHandler,a=(n=this.services.lsp.FileOperationHandler)===null||n===void 0?void 0:n.fileOperationOptions,c=this.services.ServiceRegistry.all,l=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.Formatter}),u=c.map(J=>{var j,ge;return(ge=(j=J.lsp)===null||j===void 0?void 0:j.Formatter)===null||ge===void 0?void 0:ge.formatOnTypeOptions}).find(J=>!!J),d=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.CodeActionProvider}),f=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.SemanticTokenProvider}),h=TW(c.map(J=>{var j,ge;return(ge=(j=J.lsp)===null||j===void 0?void 0:j.SemanticTokenProvider)===null||ge===void 0?void 0:ge.semanticTokensOptions})),p=(i=(r=this.services.lsp)===null||r===void 0?void 0:r.ExecuteCommandHandler)===null||i===void 0?void 0:i.commands,y=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.DocumentLinkProvider}),R=SW(c.map(J=>{var j,ge;return(ge=(j=J.lsp)===null||j===void 0?void 0:j.SignatureHelp)===null||ge===void 0?void 0:ge.signatureHelpOptions})),b=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.TypeProvider}),v=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.ImplementationProvider}),T=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.CompletionProvider}),_=uW(c.map(J=>{var j,ge;return(ge=(j=J.lsp)===null||j===void 0?void 0:j.CompletionProvider)===null||ge===void 0?void 0:ge.completionOptions})),N=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.ReferencesProvider}),F=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.DocumentSymbolProvider}),x=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.DefinitionProvider}),G=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.DocumentHighlightProvider}),B=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.FoldingRangeProvider}),W=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.HoverProvider}),I=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.RenameProvider}),k=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.CallHierarchyProvider}),S=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.TypeHierarchyProvider}),M=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.CodeLensProvider}),q=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.DeclarationProvider}),U=this.hasService(J=>{var j;return(j=J.lsp)===null||j===void 0?void 0:j.InlayHintProvider}),z=(s=this.services.lsp)===null||s===void 0?void 0:s.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:a},executeCommandProvider:p&&{commands:p},textDocumentSync:{change:Xe.TextDocumentSyncKind.Incremental,openClose:!0,save:!!o.didSaveDocument,willSave:!!o.willSaveDocument,willSaveWaitUntil:!!o.willSaveDocumentWaitUntil},completionProvider:T?_:void 0,referencesProvider:N,documentSymbolProvider:F,definitionProvider:x,typeDefinitionProvider:b,documentHighlightProvider:G,codeActionProvider:d,documentFormattingProvider:l,documentRangeFormattingProvider:l,documentOnTypeFormattingProvider:u,foldingRangeProvider:B,hoverProvider:W,renameProvider:I?{prepareProvider:!0}:void 0,semanticTokensProvider:f?h:void 0,signatureHelpProvider:R,implementationProvider:v,callHierarchyProvider:k?{}:void 0,typeHierarchyProvider:S?{}:void 0,documentLinkProvider:y?{resolveProvider:!1}:void 0,codeLensProvider:M?{resolveProvider:!1}:void 0,declarationProvider:q,inlayHintProvider:U?{resolveProvider:!1}:void 0,workspaceSymbolProvider:z?{resolveProvider:!!z.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(Xe.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 kW{getSymbolKind(e){return te.SymbolKind.Field}getCompletionItemKind(e){return te.CompletionItemKind.Reference}}class _W{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=Ai(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 o={includeDeclaration:n.context.includeDeclaration};this.references.findReferences(s,o).forEach(a=>{i.push(te.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}}class CW{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 o=e.textDocument.offsetAt(n.position),a=Ai(s,o,this.grammarConfig.nameRegexp);if(!a)return;const c=this.references.findDeclaration(a);if(!c)return;const l={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(c,l).forEach(d=>{const f=en.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=Ai(r,i,this.grammarConfig.nameRegexp);if(!s)return;if(this.references.findDeclaration(s)||this.isNameNode(s))return s.range}}isNameNode(e){return e?.astNode&&q$(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}}class M_{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,n=Ze.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 o=this.getWorkspaceSymbol(s);o&&r.push(o)}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 AW{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new te.Emitter,this._onDidOpen=new te.Emitter,this._onDidClose=new te.Emitter,this._onDidSave=new te.Emitter,this._onWillSave=new te.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(mt.normalize(e))}set(e){const n=mt.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=mt.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=te.TextDocumentSyncKind.Incremental;const n=[];return n.push(e.onDidOpenTextDocument(r=>{const i=r.textDocument,s=mt.normalize(i.uri),o=this._configuration.create(s,i.languageId,i.version,i.text);this._syncedDocuments.set(s,o);const a=Object.freeze({document:o});this._onDidOpen.fire(a),this._onDidChangeContent.fire(a)})),n.push(e.onDidChangeTextDocument(r=>{const i=r.textDocument,s=r.contentChanges;if(s.length===0)return;const{version:o}=i;if(o==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);const a=mt.normalize(i.uri);let c=this._syncedDocuments.get(a);c!==void 0&&(c=this._configuration.update(c,s,o),this._syncedDocuments.set(a,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),n.push(e.onDidCloseTextDocument(r=>{const i=mt.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(mt.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(mt.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(mt.normalize(r.textDocument.uri));i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),te.Disposable.create(()=>{n.forEach(r=>r.dispose())})}}function IW(t){return wf.merge(ck(t),xW(t))}function xW(t){return{lsp:{CompletionProvider:e=>new I_(e),DocumentSymbolProvider:e=>new fW(e),HoverProvider:e=>new vW(e),FoldingRangeProvider:e=>new pW(e),ReferencesProvider:e=>new _W(e),DefinitionProvider:e=>new dW(e),DocumentHighlightProvider:e=>new x_(e),RenameProvider:e=>new CW(e)},shared:()=>t.shared}}function PW(t){return wf.merge(lk(t),NW(t))}function NW(t){return{lsp:{Connection:()=>t.connection,LanguageServer:e=>new $W(e),DocumentUpdateHandler:e=>new hW(e),WorkspaceSymbolProvider:e=>new M_(e),NodeKindProvider:()=>new kW,FuzzyMatcher:()=>new gW},workspace:{TextDocuments:()=>new AW(yf)}}}class DW{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new OW(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 o;return(o=s.line)!==null&&o!==void 0?o:Number.MAX_VALUE}),...r.parserErrors.map(s=>{var o;return(o=s.token.startLine)!==null&&o!==void 0?o: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=(a,c,l)=>{var u,d;const f=this.nodeModeToKey(a,c),h=i.get(f),p=(u=l.options.priority)!==null&&u!==void 0?u:0,y=(d=h?.options.priority)!==null&&d!==void 0?d:0;(!h||y<=p)&&i.set(f,l)};this.collector=s,this.iterateAstFormatting(e,r);const o=this.iterateCstFormatting(e,i,n,r);return this.avoidOverlappingEdits(e.textDocument,o)}avoidOverlappingEdits(e,n){const r=[];for(const i of n){let s=r[r.length-1];for(;s;){const o=e.offsetAt(i.range.start),a=e.offsetAt(s.range.end);if(o<a)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=wr(r).iterator();let s;do if(s=i.next(),!s.done){const o=s.value;this.insideRange(o.$cstNode.range,n)?this.format(o):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},o=[],c=this.iterateCstTree(e,s).iterator();let l,u;do if(u=c.next(),!u.done){const d=u.value,f=Cs(d),h=this.nodeModeToKey(d,"prepend"),p=n.get(h);if(n.delete(h),p){const b=this.createTextEdit(l,d,p,s);for(const v of b)v&&this.insideRange(v.range,i)&&o.push(v)}const y=this.nodeModeToKey(d,"append"),R=n.get(y);if(n.delete(y),R){const b=CT(d);if(b){const v=this.createTextEdit(d,b,R,s);for(const T of v)T&&this.insideRange(T.range,i)&&o.push(T)}}if(!p&&d.hidden){const b=this.createHiddenTextEdits(l,d,void 0,s);for(const v of b)v&&this.insideRange(v.range,i)&&o.push(v)}f&&(l=d)}while(!u.done);return o}createHiddenTextEdits(e,n,r,i){var s;const o=n.range.start.line;if(e&&e.range.end.line===o)return[];const a=[],c={start:{character:0,line:o},end:n.range.start},l=i.document.getText(c),u=this.findFittingMove(c,(s=r?.moves)!==null&&s!==void 0?s:[],i),d=this.getExistingIndentationCharacterCount(l,i),h=this.getIndentationCharacterCount(i,u)-d;if(h===0)return[];let p="";h>0&&(p=(i.options.insertSpaces?" ":" ").repeat(h));const y=n.text.split(`
161
+ `);y[0]=l+y[0];for(let R=0;R<y.length;R++){const b=o+R,v={character:0,line:b};if(h>0)a.push({newText:p,range:{start:v,end:v}});else{const T=y[R];let _=0;for(;_<T.length;_++){const N=T.charAt(_);if(N!==" "&&N!==" ")break}a.push({newText:"",range:{start:v,end:{line:b,character:Math.min(_,Math.abs(h))}}})}}return a}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 o={start:(s=e?.range.end)!==null&&s!==void 0?s:{character:0,line:0},end:n.range.start},a=this.findFittingMove(o,r.moves,i);if(!a)return[];const c=a.characters,l=a.lines,u=a.tabs,d=i.indentation;i.indentation+=u??0;const f=[];return c!==void 0?e?.hidden||f.push(this.createSpaceTextEdit(o,c,r.options)):l!==void 0?f.push(this.createLineTextEdit(o,l,i,r.options)):u!==void 0&&f.push(this.createTabTextEdit(o,!!e,i)),Cs(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 a=(r.options.insertSpaces?" ".repeat(r.options.tabSize):" ").repeat(r.indentation);return{newText:`${`
162
+ `.repeat(n)}${a}`,range:e}}createTabTextEdit(e,n,r){const s=(r.options.insertSpaces?" ".repeat(r.options.tabSize):" ").repeat(r.indentation),o=n?1:0,a=Math.max(e.end.line-e.start.line,o);return{newText:`${`
163
+ `.repeat(a)}${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 So(i,s=>this.iterateCst(s,n)):Ro}iterateCst(e,n){if(!Hr(e))return Ro;const r=n.indentation;return new kt(()=>({index:0}),i=>i.index<e.content.length?{done:!1,value:e.content[i.index++]}:(n.indentation=r,Ut))}}class OW{constructor(e,n){this.astNode=e,this.collector=n}node(e){return new dr(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){const n=[];for(const r of e)r.$cstNode&&n.push(r.$cstNode);return new dr(n,this.collector)}property(e,n){const r=bn(this.astNode.$cstNode,e,n);return new dr(r?[r]:[],this.collector)}properties(...e){const n=[];for(const r of e){const i=_o(this.astNode.$cstNode,r);n.push(...i)}return new dr(n,this.collector)}keyword(e,n){const r=wc(this.astNode.$cstNode,e,n);return new dr(r?[r]:[],this.collector)}keywords(...e){const n=[];for(const r of e){const i=Qg(this.astNode.$cstNode,r);n.push(...i)}return new dr(n,this.collector)}cst(e){return new dr([...e],this.collector)}interior(e,n){const r=e.nodes,i=n.nodes;if(r.length!==1||i.length!==1)return new dr([],this.collector);let s=r[0],o=i[0];if(s.offset>o.offset){const a=s;s=o,o=a}return new dr(AT(s,o),this.collector)}}class dr{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 dr(this.nodes.slice(e,n),this.collector)}}var Hi;(function(t){function e(...u){return{options:{},moves:u.flatMap(d=>d.moves).sort(l)}}t.fit=e;function n(u){return i(0,u)}t.noSpace=n;function r(u){return i(1,u)}t.oneSpace=r;function i(u,d){return{options:d??{},moves:[{characters:u}]}}t.spaces=i;function s(u){return o(1,u)}t.newLine=s;function o(u,d){return{options:d??{},moves:[{lines:u}]}}t.newLines=o;function a(u){return{options:u??{},moves:[{tabs:1,lines:1}]}}t.indent=a;function c(u){return{options:u??{},moves:[{tabs:0}]}}t.noIndent=c;function l(u,d){var f,h,p,y,R,b;const v=(f=u.lines)!==null&&f!==void 0?f:0,T=(h=d.lines)!==null&&h!==void 0?h:0,_=(p=u.tabs)!==null&&p!==void 0?p:0,N=(y=d.tabs)!==null&&y!==void 0?y:0,F=(R=u.characters)!==null&&R!==void 0?R:0,x=(b=d.characters)!==null&&b!==void 0?b:0;return v<T?-1:v>T?1:_<N?-1:_>N?1:F<x?-1:F>x?1:0}})(Hi||(Hi={}));const Je={silent:Number.NEGATIVE_INFINITY,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},F_={silent:{level:-1},fatal:{level:Je.fatal},error:{level:Je.error},warn:{level:Je.warn},log:{level:Je.log},info:{level:Je.info},success:{level:Je.success},fail:{level:Je.fail},ready:{level:Je.info},start:{level:Je.info},box:{level:Je.info},debug:{level:Je.debug},trace:{level:Je.trace},verbose:{level:Je.verbose}};function sv(t){return t!==null&&typeof t=="object"}function ov(t,e,n=".",r){if(!sv(e))return ov(t,{},n);const i=Object.assign({},e);for(const s in t){if(s==="__proto__"||s==="constructor")continue;const o=t[s];o!=null&&(Array.isArray(o)&&Array.isArray(i[s])?i[s]=[...o,...i[s]]:sv(o)&&sv(i[s])?i[s]=ov(o,i[s],(n?`${n}.`:"")+s.toString()):i[s]=o)}return i}function LW(t){return(...e)=>e.reduce((n,r)=>ov(n,r,""),{})}const MW=LW();function FW(t){return Object.prototype.toString.call(t)==="[object Object]"}function jW(t){return!(!FW(t)||!t.message&&!t.args||t.stack)}let av=!1;const j_=[];let tn=class RN{constructor(e={}){const n=e.types||F_;this.options=MW({...e,defaults:{...e.defaults},level:cv(e.level,n),reporters:[...e.reporters||[]]},{types:F_,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(const r in n){const i={type:r,...this.options.defaults,...n[r]};this[r]=this._wrapLogFn(i),this[r].raw=this._wrapLogFn(i,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=cv(e,this.options.types,this.options.level)}prompt(e,n){if(!this.options.prompt)throw new Error("prompt is not supported!");return this.options.prompt(e,n)}create(e){const n=new RN({...this.options,...e});return this._mockFn&&n.mockTypes(this._mockFn),n}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){const n=this.options.reporters.indexOf(e);if(n>=0)return this.options.reporters.splice(n,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(const e in this.options.types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(const e in this.options.types)console["__"+e]&&(console[e]=console["__"+e],delete console["__"+e])}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(e,n){e&&(e.__write||(e.__write=e.write),e.write=r=>{this[n].raw(String(r).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){av=!0}resumeLogs(){av=!1;const e=j_.splice(0);for(const n of e)n[0]._logFn(n[1],n[2])}mockTypes(e){const n=e||this.options.mockFn;if(this._mockFn=n,typeof n=="function")for(const r in this.options.types)this[r]=n(r,this.options.types[r])||this[r],this[r].raw=this[r]}_wrapLogFn(e,n){return(...r)=>{if(av){j_.push([this,e,r,n]);return}return this._logFn(e,r,n)}}_logFn(e,n,r){if((e.level||0)>this.level)return!1;const i={date:new Date,args:[],...e,level:cv(e.level,this.options.types)};!r&&n.length===1&&jW(n[0])?Object.assign(i,n[0]):i.args=[...n],i.message&&(i.args.unshift(i.message),delete i.message),i.additional&&(Array.isArray(i.additional)||(i.additional=i.additional.split(`
164
+ `)),i.args.push(`
165
+ `+i.additional.join(`
166
+ `)),delete i.additional),i.type=typeof i.type=="string"?i.type.toLowerCase():"log",i.tag=typeof i.tag=="string"?i.tag:"";const s=(a=!1)=>{const c=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&c>0){const l=[...this._lastLog.object.args];c>1&&l.push(`(repeated ${c} times)`),this._log({...this._lastLog.object,args:l}),this._lastLog.count=1}a&&(this._lastLog.object=i,this._log(i))};clearTimeout(this._lastLog.timeout);const o=this._lastLog.time&&i.date?i.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=i.date,o<this.options.throttle)try{const a=JSON.stringify([i.type,i.tag,i.args]),c=this._lastLog.serialized===a;if(this._lastLog.serialized=a,c&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(s,this.options.throttle);return}}catch{}s(!0)}_log(e){for(const n of this.options.reporters)n.log(e,{options:this.options})}};function cv(t,e={},n=3){return t===void 0?n:typeof t=="number"?t:e[t]&&e[t].level!==void 0?e[t].level:n}tn.prototype.add=tn.prototype.addReporter,tn.prototype.remove=tn.prototype.removeReporter,tn.prototype.clear=tn.prototype.removeReporter,tn.prototype.withScope=tn.prototype.withTag,tn.prototype.mock=tn.prototype.mockTypes,tn.prototype.pause=tn.prototype.pauseLogs,tn.prototype.resume=tn.prototype.resumeLogs;function UW(t={}){return new tn(t)}function BW(t){const e=process.cwd()+IN;return t.split(`
167
+ `).splice(1).map(n=>n.trim().replace("file://","").replace(e,""))}function qW(t,e){return(e.__write||e.write).call(e,t)}const lv=t=>t?`[${t}]`:"";let WW=class{formatStack(e,n){return" "+BW(e).join(`
168
+ `)}formatArgs(e,n){const r=e.map(i=>i&&typeof i.stack=="string"?i.message+`
169
+ `+this.formatStack(i.stack,n):i);return LN(n,...r)}formatDate(e,n){return n.date?e.toLocaleTimeString():""}filterAndJoin(e){return e.filter(Boolean).join(" ")}formatLogObj(e,n){const r=this.formatArgs(e.args,n);return e.type==="box"?`
170
+ `+[lv(e.tag),e.title&&e.title,...r.split(`
171
+ `)].filter(Boolean).map(i=>" > "+i).join(`
172
+ `)+`
173
+ `:this.filterAndJoin([lv(e.type),lv(e.tag),r])}log(e,n){const r=this.formatLogObj(e,{columns:n.options.stdout.columns||0,...n.options.formatOptions});return qW(r+`
174
+ `,e.level<2?n.options.stderr||process.stderr:n.options.stdout||process.stdout)}};function U_(t={}){let e=Je.info;return process.env.CONSOLA_LEVEL&&(e=Number.parseInt(process.env.CONSOLA_LEVEL)??e),UW({level:e,defaults:{level:e},stdout:process.stdout,stderr:process.stderr,reporters:t.reporters||[new WW],...t})}U_();const Fe=U_({level:Je.debug,formatOptions:{colors:!0,date:!1}});var GW={done:!0,hasNext:!1},ta={done:!1,hasNext:!1},B_=()=>GW,zW=t=>({hasNext:!0,next:t,done:!1});function We(t,...e){let n=t,r=e.map(s=>"lazy"in s?HW(s):void 0),i=0;for(;i<e.length;){if(r[i]===void 0||!KW(n)){let c=e[i];n=c(n),i+=1;continue}let s=[];for(let c=i;c<e.length;c++){let l=r[c];if(l===void 0||(s.push(l),l.isSingle))break}let o=[];for(let c of n)if(q_(c,o,s))break;let{isSingle:a}=s.at(-1);n=a?o[0]:o,i+=s.length}return n}function q_(t,e,n){if(n.length===0)return e.push(t),!1;let r=t,i=ta,s=!1;for(let[o,a]of n.entries()){let{index:c,items:l}=a;if(l.push(r),i=a(r,c,l),a.index+=1,i.hasNext){if(i.hasMany??!1){for(let u of i.next)if(q_(u,e,n.slice(o+1)))return!0;return s}r=i.next}if(!i.hasNext)break;i.done&&(s=!0)}return i.hasNext&&e.push(r),s}function HW(t){let{lazy:e,lazyArgs:n}=t,r=e(...n);return Object.assign(r,{isSingle:e.single??!1,index:0,items:[]})}function KW(t){return typeof t=="string"||typeof t=="object"&&t!==null&&Symbol.iterator in t}function uv(t,e){let n=e.length-t.length;if(n===1){let[r,...i]=e;return We(r,{lazy:t,lazyArgs:i})}if(n===0){let r={lazy:t,lazyArgs:e};return Object.assign(i=>We(i,r),r)}throw new Error("Wrong number of arguments")}function VW(t,e,n){let r=i=>t(i,...e);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:e})}function je(t,e,n){let r=t.length-e.length;if(r===0)return t(...e);if(r===1)return VW(t,e,n);throw new Error("Wrong number of arguments")}function eh(...t){return je(Object.values,t)}function Ar(...t){return uv(YW,t)}function YW(){let t=new Set;return e=>t.has(e)?ta:(t.add(e),{done:!1,hasNext:!0,next:e})}function XW(...t){return je(JW,t,QW)}var JW=(t,e)=>e<0?[]:t.slice(0,e);function QW(t){if(t<=0)return B_;let e=t;return n=>(e-=1,{done:e<=0,hasNext:!0,next:n})}function Ir(...t){return je(ZW,t)}var ZW=(t,e)=>t.length>=e,W_={asc:(t,e)=>t>e,desc:(t,e)=>t<e};function eG(t,e){let[n,...r]=e;if(!tG(n)){let s=dv(...r);return t(n,s)}let i=dv(n,...r);return s=>t(s,i)}function dv(t,e,...n){let r=typeof t=="function"?t:t[0],i=typeof t=="function"?"asc":t[1],{[i]:s}=W_,o=e===void 0?void 0:dv(e,...n);return(a,c)=>{let l=r(a),u=r(c);return s(l,u)?1:s(u,l)?-1:o?.(a,c)??0}}function tG(t){if(G_(t))return!0;if(typeof t!="object"||!Array.isArray(t))return!1;let[e,n,...r]=t;return G_(e)&&typeof n=="string"&&n in W_&&r.length===0}var G_=t=>typeof t=="function"&&t.length===1;function Zc(...t){return je(nG,t)}function nG(t,e){let n=[...t];return n.sort(e),n}function rG(...t){return eG(iG,t)}var iG=(t,e)=>[...t].sort(e);function z_(...t){return je(sG,t)}var sG=(t,e,n)=>t.reduce(e,n);function H_(...t){return je(oG,t)}function oG(t){return[...t].reverse()}function fv(...t){return e=>We(e,...t)}function fi(...t){return je(aG,t)}var aG=(t,e)=>t[e];function K_(...t){return je(cG,t)}function cG(t,e){let n={...t};for(let[r,i]of Object.entries(n))e(i,r,t)&&delete n[r];return n}function mn(...t){return je(lG,t)}var lG=t=>t.length===1?t[0]:void 0;function V_(...t){return je(uG,t)}function uG(t,e){let n={};for(let r of e)r in t&&(n[r]=t[r]);return n}function Y_(...t){return je(dG,t)}function dG(t,e){if(!Ir(e,1))return{...t};if(!Ir(e,2)){let{[e[0]]:r,...i}=t;return i}let n={...t};for(let r of e)delete n[r];return n}function el(...t){return je(fG,t)}var fG=t=>t.at(-1);function st(...t){return je(hG,t,pG)}var hG=(t,e)=>t.map(e),pG=t=>(e,n,r)=>({done:!1,hasNext:!0,next:t(e,n,r)});function hi(...t){return je(gG,t)}function gG(t,e){let n={};for(let[r,i]of t.entries()){let[s,o]=e(i,r,t);n[s]=o}return n}function Ki(...t){return je(mG,t)}function mG(t,e){let n={};for(let[r,i]of Object.entries(t)){let s=e(i,r,t);n[r]=s}return n}function Vi(t){return typeof t=="string"}function Q(t){return!!t}function yG(t){return t!==null}function xr(t){return t!=null}function $t(t){return t==null}function X_(t){return typeof t=="number"&&!Number.isNaN(t)}function J_(t){return Array.isArray(t)}function It(t){return t!==void 0}function Yi(t){return t===void 0?!0:typeof t=="string"||Array.isArray(t)?t.length===0:Object.keys(t).length===0}function Q_(...t){return je(vG,t)}function vG(t,e){let n={};for(let[r,i]of t.entries()){let s=e(i,r,t);n[s]=i}return n}function wG(...t){return uv(bG,t)}function bG(t){if(t.length===0)return B_;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?ta:(r===1?e.delete(n):e.set(n,r-1),{hasNext:!0,next:n,done:e.size===0})}}function Xi(...t){return je(TG,t,EG)}var TG=(t,e)=>t.flatMap(e),EG=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 RG(...t){return je(SG,t,$G)}function SG(t,e){return t.forEach(e),t}var $G=t=>(e,n,r)=>(t(e,n,r),{done:!1,hasNext:!0,next:e});function th(...t){return je(kG,t)}var kG=(t,e)=>{let n={};for(let[r,i]of t.entries()){let s=e(i,r,t);if(s!==void 0){let{[s]:o}=n;o===void 0&&(o=[],n[s]=o),o.push(i)}}return n};function He(...t){return je(_G,t,CG)}var _G=(t,e)=>t.filter(e),CG=t=>(e,n,r)=>t(e,n,r)?{done:!1,hasNext:!0,next:e}:ta,Z_=t=>Object.assign(t,{single:!0});function eC(...t){return je(AG,t,Z_(IG))}var AG=(t,e)=>t.find(e),IG=t=>(e,n,r)=>t(e,n,r)?{done:!0,hasNext:!0,next:e}:ta;function xG(...t){return je(PG,t)}var PG=(t,e)=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(e(r,n,t))return r}};function tl(...t){return je(NG,t,Z_(DG))}var NG=([t])=>t,DG=()=>OG,OG=t=>({hasNext:!0,next:t,done:!0});function na(...t){return je(Object.entries,t)}function LG(t,{waitMs:e,timing:n="trailing",maxWaitMs:r}){if(r!==void 0&&e!==void 0&&r<e)throw new Error(`debounce: maxWaitMs (${r}) cannot be less than waitMs (${e})`);let i,s,o,a,c=()=>{if(s!==void 0){let f=s;s=void 0,clearTimeout(f)}if(o===void 0)throw new Error("REMEDA[debounce]: latestCallArgs was unexpectedly undefined.");let d=o;o=void 0,a=t(...d)},l=()=>{if(i===void 0)return;let d=i;i=void 0,clearTimeout(d),o!==void 0&&c()},u=d=>{o=d,r!==void 0&&s===void 0&&(s=setTimeout(c,r))};return{call:(...d)=>{if(i===void 0)n==="trailing"?u(d):a=t(...d);else{n!=="leading"&&u(d);let f=i;i=void 0,clearTimeout(f)}return i=setTimeout(l,e??r??0),a},cancel:()=>{if(i!==void 0){let d=i;i=void 0,clearTimeout(d)}if(s!==void 0){let d=s;s=void 0,clearTimeout(d)}o=void 0},flush:()=>(l(),a),get isPending(){return i!==void 0},get cachedValue(){return a}}}function MG(...t){return uv(FG,t)}function FG(t){if(t.length===0)return zW;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),ta)}}function tC(...t){return je(jG,t)}var jG=(t,e)=>e.every(n=>n(t));function UG(...t){return je(BG,t)}var BG=(t,e)=>e.some(n=>n(t));function qG(...t){return je(WG,t)}function WG(t,e){if(e<1)throw new RangeError(`chunk: A chunk size of '${e}' 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 nC(...t){return je(GG,t)}var GG=(t,{min:e,max:n})=>e!==void 0&&t<e?e:n!==void 0&&t>n?n:t;function zG(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 HG(t){for(var e=t.length,n=0,r=0;r<e;){var i=t.charCodeAt(r++);if(i&4294967168)if(!(i&4294965248))n+=2;else{if(i>=55296&&i<=56319&&r<e){var 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 KG(t,e,n){for(var r=t.length,i=n,s=0;s<r;){var o=t.charCodeAt(s++);if(o&4294967168)if(!(o&4294965248))e[i++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<r){var a=t.charCodeAt(s);(a&64512)===56320&&(++s,o=((o&1023)<<10)+(a&1023)+65536)}o&4294901760?(e[i++]=o>>18&7|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128):(e[i++]=o>>12&15|224,e[i++]=o>>6&63|128)}else{e[i++]=o;continue}e[i++]=o&63|128}}var VG=new TextEncoder,YG=50;function XG(t,e,n){VG.encodeInto(t,e.subarray(n))}function JG(t,e,n){t.length>YG?XG(t,e,n):KG(t,e,n)}var QG=4096;function rC(t,e,n){for(var r=e,i=r+n,s=[],o="";r<i;){var a=t[r++];if(!(a&128))s.push(a);else if((a&224)===192){var c=t[r++]&63;s.push((a&31)<<6|c)}else if((a&240)===224){var c=t[r++]&63,l=t[r++]&63;s.push((a&31)<<12|c<<6|l)}else if((a&248)===240){var c=t[r++]&63,l=t[r++]&63,u=t[r++]&63,d=(a&7)<<18|c<<12|l<<6|u;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(a);s.length>=QG&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(o+=String.fromCharCode.apply(String,s)),o}var ZG=new TextDecoder,ez=200;function tz(t,e,n){var r=t.subarray(e,e+n);return ZG.decode(r)}function nz(t,e,n){return n>ez?tz(t,e,n):rC(t,e,n)}var nh=function(){function t(e,n){this.type=e,this.data=n}return t}(),rz=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Pr=function(t){rz(e,t);function e(n){var r=t.call(this,n)||this,i=Object.create(e.prototype);return Object.setPrototypeOf(r,i),Object.defineProperty(r,"name",{configurable:!0,enumerable:!1,value:e.name}),r}return e}(Error),nl=4294967295;function iz(t,e,n){var r=n/4294967296,i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function iC(t,e,n){var r=Math.floor(n/4294967296),i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function sC(t,e){var n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}function sz(t,e){var n=t.getUint32(e),r=t.getUint32(e+4);return n*4294967296+r}var oz=-1,az=4294967296-1,cz=17179869184-1;function lz(t){var e=t.sec,n=t.nsec;if(e>=0&&n>=0&&e<=cz)if(n===0&&e<=az){var r=new Uint8Array(4),i=new DataView(r.buffer);return i.setUint32(0,e),r}else{var s=e/4294967296,o=e&4294967295,r=new Uint8Array(8),i=new DataView(r.buffer);return i.setUint32(0,n<<2|s&3),i.setUint32(4,o),r}else{var r=new Uint8Array(12),i=new DataView(r.buffer);return i.setUint32(0,n),iC(i,4,e),r}}function uz(t){var 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 dz(t){if(t instanceof Date){var e=uz(t);return lz(e)}else return null}function fz(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:{var n=e.getUint32(0),r=0;return{sec:n,nsec:r}}case 8:{var i=e.getUint32(0),s=e.getUint32(4),n=(i&3)*4294967296+s,r=i>>>2;return{sec:n,nsec:r}}case 12:{var n=sC(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new Pr("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(t.length))}}function hz(t){var e=fz(t);return new Date(e.sec*1e3+e.nsec/1e6)}var pz={type:oz,encode:dz,decode:hz},oC=function(){function t(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(pz)}return t.prototype.register=function(e){var n=e.type,r=e.encode,i=e.decode;if(n>=0)this.encoders[n]=r,this.decoders[n]=i;else{var s=1+n;this.builtInEncoders[s]=r,this.builtInDecoders[s]=i}},t.prototype.tryToEncode=function(e,n){for(var r=0;r<this.builtInEncoders.length;r++){var i=this.builtInEncoders[r];if(i!=null){var s=i(e,n);if(s!=null){var o=-1-r;return new nh(o,s)}}}for(var r=0;r<this.encoders.length;r++){var i=this.encoders[r];if(i!=null){var s=i(e,n);if(s!=null){var o=r;return new nh(o,s)}}}return e instanceof nh?e:null},t.prototype.decode=function(e,n,r){var i=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return i?i(e,n,r):new nh(n,e)},t.defaultCodec=new t,t}();function rh(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):Uint8Array.from(t)}function gz(t){if(t instanceof ArrayBuffer)return new DataView(t);var e=rh(t);return new DataView(e.buffer,e.byteOffset,e.byteLength)}var mz=100,yz=2048,vz=function(){function t(e){var n,r,i,s,o,a,c,l;this.extensionCodec=(n=e?.extensionCodec)!==null&&n!==void 0?n:oC.defaultCodec,this.context=e?.context,this.useBigInt64=(r=e?.useBigInt64)!==null&&r!==void 0?r:!1,this.maxDepth=(i=e?.maxDepth)!==null&&i!==void 0?i:mz,this.initialBufferSize=(s=e?.initialBufferSize)!==null&&s!==void 0?s:yz,this.sortKeys=(o=e?.sortKeys)!==null&&o!==void 0?o:!1,this.forceFloat32=(a=e?.forceFloat32)!==null&&a!==void 0?a:!1,this.ignoreUndefined=(c=e?.ignoreUndefined)!==null&&c!==void 0?c:!1,this.forceIntegerToFloat=(l=e?.forceIntegerToFloat)!==null&&l!==void 0?l:!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return t.prototype.reinitializeState=function(){this.pos=0},t.prototype.encodeSharedRef=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)},t.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)},t.prototype.doEncode=function(e,n){if(n>this.maxDepth)throw new Error("Too deep objects in depth ".concat(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)},t.prototype.ensureBufferSizeToWrite=function(e){var n=this.pos+e;this.view.byteLength<n&&this.resizeBuffer(n*2)},t.prototype.resizeBuffer=function(e){var n=new ArrayBuffer(e),r=new Uint8Array(n),i=new DataView(n);r.set(this.bytes),this.view=i,this.bytes=r},t.prototype.encodeNil=function(){this.writeU8(192)},t.prototype.encodeBoolean=function(e){e===!1?this.writeU8(194):this.writeU8(195)},t.prototype.encodeNumber=function(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)},t.prototype.encodeNumberAsFloat=function(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},t.prototype.encodeBigInt64=function(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))},t.prototype.writeStringHeader=function(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: ".concat(e," bytes in UTF-8"))},t.prototype.encodeString=function(e){var n=5,r=HG(e);this.ensureBufferSizeToWrite(n+r),this.writeStringHeader(r),JG(e,this.bytes,this.pos),this.pos+=r},t.prototype.encodeObject=function(e,n){var 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: ".concat(Object.prototype.toString.apply(e)))},t.prototype.encodeBinary=function(e){var 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: ".concat(n));var r=rh(e);this.writeU8a(r)},t.prototype.encodeArray=function(e,n){var 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: ".concat(r));for(var i=0,s=e;i<s.length;i++){var o=s[i];this.doEncode(o,n+1)}},t.prototype.countWithoutUndefined=function(e,n){for(var r=0,i=0,s=n;i<s.length;i++){var o=s[i];e[o]!==void 0&&r++}return r},t.prototype.encodeMap=function(e,n){var r=Object.keys(e);this.sortKeys&&r.sort();var 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: ".concat(i));for(var s=0,o=r;s<o.length;s++){var a=o[s],c=e[a];this.ignoreUndefined&&c===void 0||(this.encodeString(a),this.doEncode(c,n+1))}},t.prototype.encodeExtension=function(e){var 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: ".concat(n));this.writeI8(e.type),this.writeU8a(e.data)},t.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},t.prototype.writeU8a=function(e){var n=e.length;this.ensureBufferSizeToWrite(n),this.bytes.set(e,this.pos),this.pos+=n},t.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},t.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},t.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},t.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},t.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},t.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},t.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},t.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),iz(this.view,this.pos,e),this.pos+=8},t.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),iC(this.view,this.pos,e),this.pos+=8},t.prototype.writeBigUint64=function(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8},t.prototype.writeBigInt64=function(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8},t}();function wz(t,e){var n=new vz(e);return n.encodeSharedRef(t)}function hv(t){return"".concat(t<0?"-":"","0x").concat(Math.abs(t).toString(16).padStart(2,"0"))}var bz=16,Tz=16,Ez=function(){function t(e,n){e===void 0&&(e=bz),n===void 0&&(n=Tz),this.maxKeyLength=e,this.maxLengthPerKey=n,this.hit=0,this.miss=0,this.caches=[];for(var r=0;r<this.maxKeyLength;r++)this.caches.push([])}return t.prototype.canBeCached=function(e){return e>0&&e<=this.maxKeyLength},t.prototype.find=function(e,n,r){var i=this.caches[r-1];e:for(var s=0,o=i;s<o.length;s++){for(var a=o[s],c=a.bytes,l=0;l<r;l++)if(c[l]!==e[n+l])continue e;return a.str}return null},t.prototype.store=function(e,n){var 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)},t.prototype.decode=function(e,n,r){var i=this.find(e,n,r);if(i!=null)return this.hit++,i;this.miss++;var s=rC(e,n,r),o=Uint8Array.prototype.slice.call(e,n,n+r);return this.store(o,s),s},t}(),Rz=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(u){try{l(r.next(u))}catch(d){o(d)}}function c(u){try{l(r.throw(u))}catch(d){o(d)}}function l(u){u.done?s(u.value):i(u.value).then(a,c)}l((r=r.apply(t,e||[])).next())})},pv=function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(n=0)),n;)try{if(r=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}s[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(u){l=[6,u],i=0}finally{r=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},aC=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}},ra=function(t){return this instanceof ra?(this.v=t,this):new ra(t)},Sz=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(f){r[f]&&(i[f]=function(h){return new Promise(function(p,y){s.push([f,h,p,y])>1||a(f,h)})})}function a(f,h){try{c(r[f](h))}catch(p){d(s[0][3],p)}}function c(f){f.value instanceof ra?Promise.resolve(f.value.v).then(l,u):d(s[0][2],f)}function l(f){a("next",f)}function u(f){a("throw",f)}function d(f,h){f(h),s.shift(),s.length&&a(s[0][0],s[0][1])}},cC="array",ih="map_key",$z="map_value",kz=function(t){return typeof t=="string"||typeof t=="number"},rl=-1,gv=new DataView(new ArrayBuffer(0)),_z=new Uint8Array(gv.buffer);try{gv.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")}var mv=RangeError,lC=new mv("Insufficient data"),Cz=new Ez,Az=function(){function t(e){var n,r,i,s,o,a,c;this.totalPos=0,this.pos=0,this.view=gv,this.bytes=_z,this.headByte=rl,this.stack=[],this.extensionCodec=(n=e?.extensionCodec)!==null&&n!==void 0?n:oC.defaultCodec,this.context=e?.context,this.useBigInt64=(r=e?.useBigInt64)!==null&&r!==void 0?r:!1,this.maxStrLength=(i=e?.maxStrLength)!==null&&i!==void 0?i:nl,this.maxBinLength=(s=e?.maxBinLength)!==null&&s!==void 0?s:nl,this.maxArrayLength=(o=e?.maxArrayLength)!==null&&o!==void 0?o:nl,this.maxMapLength=(a=e?.maxMapLength)!==null&&a!==void 0?a:nl,this.maxExtLength=(c=e?.maxExtLength)!==null&&c!==void 0?c:nl,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:Cz}return t.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=rl,this.stack.length=0},t.prototype.setBuffer=function(e){this.bytes=rh(e),this.view=gz(this.bytes),this.pos=0},t.prototype.appendBuffer=function(e){if(this.headByte===rl&&!this.hasRemaining(1))this.setBuffer(e);else{var n=this.bytes.subarray(this.pos),r=rh(e),i=new Uint8Array(n.length+r.length);i.set(n),i.set(r,n.length),this.setBuffer(i)}},t.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},t.prototype.createExtraByteError=function(e){var n=this,r=n.view,i=n.pos;return new RangeError("Extra ".concat(r.byteLength-i," of ").concat(r.byteLength," byte(s) found at buffer[").concat(e,"]"))},t.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var n=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return n},t.prototype.decodeMulti=function(e){return pv(this,function(n){switch(n.label){case 0:this.reinitializeState(),this.setBuffer(e),n.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return n.sent(),[3,1];case 3:return[2]}})},t.prototype.decodeAsync=function(e){var n,r,i,s,o,a,c;return Rz(this,void 0,void 0,function(){var l,u,d,f,h,p,y,R;return pv(this,function(b){switch(b.label){case 0:l=!1,b.label=1;case 1:b.trys.push([1,6,7,12]),n=!0,r=aC(e),b.label=2;case 2:return[4,r.next()];case 3:if(i=b.sent(),s=i.done,!!s)return[3,5];c=i.value,n=!1;try{if(d=c,l)throw this.createExtraByteError(this.totalPos);this.appendBuffer(d);try{u=this.doDecodeSync(),l=!0}catch(v){if(!(v instanceof mv))throw v}this.totalPos+=this.pos}finally{n=!0}b.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return f=b.sent(),o={error:f},[3,12];case 7:return b.trys.push([7,,10,11]),!n&&!s&&(a=r.return)?[4,a.call(r)]:[3,9];case 8:b.sent(),b.label=9;case 9:return[3,11];case 10:if(o)throw o.error;return[7];case 11:return[7];case 12:if(l){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,u]}throw h=this,p=h.headByte,y=h.pos,R=h.totalPos,new RangeError("Insufficient data in parsing ".concat(hv(p)," at ").concat(R," (").concat(y," in the current buffer)"))}})})},t.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},t.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},t.prototype.decodeMultiAsync=function(e,n){return Sz(this,arguments,function(){var i,s,o,a,c,l,u,d,f,h,p,y;return pv(this,function(R){switch(R.label){case 0:i=n,s=-1,R.label=1;case 1:R.trys.push([1,15,16,21]),o=!0,a=aC(e),R.label=2;case 2:return[4,ra(a.next())];case 3:if(c=R.sent(),f=c.done,!!f)return[3,14];y=c.value,o=!1,R.label=4;case 4:if(R.trys.push([4,,12,13]),l=y,n&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(l),i&&(s=this.readArraySize(),i=!1,this.complete()),R.label=5;case 5:R.trys.push([5,10,,11]),R.label=6;case 6:return[4,ra(this.doDecodeSync())];case 7:return[4,R.sent()];case 8:return R.sent(),--s===0?[3,9]:[3,6];case 9:return[3,11];case 10:if(u=R.sent(),!(u instanceof mv))throw u;return[3,11];case 11:return this.totalPos+=this.pos,[3,13];case 12:return o=!0,[7];case 13:return[3,2];case 14:return[3,21];case 15:return d=R.sent(),h={error:d},[3,21];case 16:return R.trys.push([16,,19,20]),!o&&!f&&(p=a.return)?[4,ra(p.call(a))]:[3,18];case 17:R.sent(),R.label=18;case 18:return[3,20];case 19:if(h)throw h.error;return[7];case 20:return[7];case 21:return[2]}})})},t.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),n=void 0;if(e>=224)n=e-256;else if(e<192)if(e<128)n=e;else if(e<144){var r=e-128;if(r!==0){this.pushMapState(r),this.complete();continue e}else n={}}else if(e<160){var r=e-144;if(r!==0){this.pushArrayState(r),this.complete();continue e}else n=[]}else{var i=e-160;n=this.decodeUtf8String(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){var i=this.lookU8();n=this.decodeUtf8String(i,1)}else if(e===218){var i=this.lookU16();n=this.decodeUtf8String(i,2)}else if(e===219){var i=this.lookU32();n=this.decodeUtf8String(i,4)}else if(e===220){var r=this.readU16();if(r!==0){this.pushArrayState(r),this.complete();continue e}else n=[]}else if(e===221){var r=this.readU32();if(r!==0){this.pushArrayState(r),this.complete();continue e}else n=[]}else if(e===222){var r=this.readU16();if(r!==0){this.pushMapState(r),this.complete();continue e}else n={}}else if(e===223){var r=this.readU32();if(r!==0){this.pushMapState(r),this.complete();continue e}else n={}}else if(e===196){var r=this.lookU8();n=this.decodeBinary(r,1)}else if(e===197){var r=this.lookU16();n=this.decodeBinary(r,2)}else if(e===198){var r=this.lookU32();n=this.decodeBinary(r,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){var r=this.lookU8();n=this.decodeExtension(r,1)}else if(e===200){var r=this.lookU16();n=this.decodeExtension(r,2)}else if(e===201){var r=this.lookU32();n=this.decodeExtension(r,4)}else throw new Pr("Unrecognized type byte: ".concat(hv(e)));this.complete();for(var s=this.stack;s.length>0;){var o=s[s.length-1];if(o.type===cC)if(o.array[o.position]=n,o.position++,o.position===o.size)s.pop(),n=o.array;else continue e;else if(o.type===ih){if(!kz(n))throw new Pr("The type of key must be string or number but "+typeof n);if(n==="__proto__")throw new Pr("The key __proto__ is not allowed");o.key=n,o.type=$z;continue e}else if(o.map[o.key]=n,o.readCount++,o.readCount===o.size)s.pop(),n=o.map;else{o.key=null,o.type=ih;continue e}}return n}},t.prototype.readHeadByte=function(){return this.headByte===rl&&(this.headByte=this.readU8()),this.headByte},t.prototype.complete=function(){this.headByte=rl},t.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new Pr("Unrecognized array type byte: ".concat(hv(e)))}}},t.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Pr("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:ih,size:e,key:null,readCount:0,map:{}})},t.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new Pr("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:cC,size:e,array:new Array(e),position:0})},t.prototype.decodeUtf8String=function(e,n){var r;if(e>this.maxStrLength)throw new Pr("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLength<this.pos+n+e)throw lC;var i=this.pos+n,s;return this.stateIsMapKey()&&(!((r=this.keyDecoder)===null||r===void 0)&&r.canBeCached(e))?s=this.keyDecoder.decode(this.bytes,i,e):s=nz(this.bytes,i,e),this.pos+=n+e,s},t.prototype.stateIsMapKey=function(){if(this.stack.length>0){var e=this.stack[this.stack.length-1];return e.type===ih}return!1},t.prototype.decodeBinary=function(e,n){if(e>this.maxBinLength)throw new Pr("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+n))throw lC;var r=this.pos+n,i=this.bytes.subarray(r,r+e);return this.pos+=n+e,i},t.prototype.decodeExtension=function(e,n){if(e>this.maxExtLength)throw new Pr("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var r=this.view.getInt8(this.pos+n),i=this.decodeBinary(e,n+1);return this.extensionCodec.decode(i,r,this.context)},t.prototype.lookU8=function(){return this.view.getUint8(this.pos)},t.prototype.lookU16=function(){return this.view.getUint16(this.pos)},t.prototype.lookU32=function(){return this.view.getUint32(this.pos)},t.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},t.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},t.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},t.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},t.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},t.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},t.prototype.readU64=function(){var e=sz(this.view,this.pos);return this.pos+=8,e},t.prototype.readI64=function(){var e=sC(this.view,this.pos);return this.pos+=8,e},t.prototype.readU64AsBigInt=function(){var e=this.view.getBigUint64(this.pos);return this.pos+=8,e},t.prototype.readI64AsBigInt=function(){var e=this.view.getBigInt64(this.pos);return this.pos+=8,e},t.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},t.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},t}();function Iz(t,e){var n=new Az(e);return n.decode(t)}const xz=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]",Pz=(t,e=0,n=t.byteLength-e)=>{if(!xz(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return Hp.from(t,e,n)},uC=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?Hp.from(t,e):Hp.from(t)},Nz=/^[A-Za-z0-9+/]*={0,2}$/,Dz=t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!Nz.exec(t))throw new TypeError("Invalid base64 string.");const e=uC(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},Oz=t=>{const e=uC(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},Lz=t=>{let e;if(typeof t=="string"?e=Oz(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 Pz(e.buffer,e.byteOffset,e.byteLength).toString("base64")},Mz=`likec4lib {
175
+ icons {
176
+ aws:activate
177
+ aws:alexa-for-business
178
+ aws:amplify
179
+ aws:apache-mxnet-on-aws
180
+ aws:api-gateway
181
+ aws:app-config
182
+ aws:app-flow
183
+ aws:app-mesh
184
+ aws:app-runner
185
+ aws:app-stream
186
+ aws:app-sync
187
+ aws:application-auto-scaling
188
+ aws:application-composer
189
+ aws:application-cost-profiler
190
+ aws:application-discovery-service
191
+ aws:application-migration-service
192
+ aws:artifact
193
+ aws:athena
194
+ aws:audit-manager
195
+ aws:augmented-ai-a2i
196
+ aws:aurora
197
+ aws:auto-scaling
198
+ aws:backint-agent
199
+ aws:backup
200
+ aws:batch
201
+ aws:billing-conductor
202
+ aws:bottlerocket
203
+ aws:braket
204
+ aws:budgets
205
+ aws:certificate-manager
206
+ aws:chatbot
207
+ aws:chime
208
+ aws:chime-sdk
209
+ aws:chime-voice-connector
210
+ aws:clean-rooms
211
+ aws:client-vpn
212
+ aws:cloud-control-api
213
+ aws:cloud-development-kit
214
+ aws:cloud-directory
215
+ aws:cloud-formation
216
+ aws:cloud-front
217
+ aws:cloud-hsm
218
+ aws:cloud-map
219
+ aws:cloud-search
220
+ aws:cloud-shell
221
+ aws:cloud-trail
222
+ aws:cloud-wan
223
+ aws:cloud-watch
224
+ aws:cloud9
225
+ aws:code-artifact
226
+ aws:code-build
227
+ aws:code-catalyst
228
+ aws:code-commit
229
+ aws:code-deploy
230
+ aws:code-guru
231
+ aws:code-pipeline
232
+ aws:code-star
233
+ aws:code-whisperer
234
+ aws:cognito
235
+ aws:command-line-interface
236
+ aws:comprehend
237
+ aws:comprehend-medical
238
+ aws:compute-optimizer
239
+ aws:config
240
+ aws:connect
241
+ aws:console-mobile-application
242
+ aws:control-tower
243
+ aws:corretto
244
+ aws:cost-and-usage-report
245
+ aws:cost-explorer
246
+ aws:data-exchange
247
+ aws:data-pipeline
248
+ aws:data-sync
249
+ aws:data-zone
250
+ aws:database-migration-service
251
+ aws:deep-composer
252
+ aws:deep-learning-amis
253
+ aws:deep-learning-containers
254
+ aws:deep-lens
255
+ aws:deep-racer
256
+ aws:detective
257
+ aws:dev-ops-guru
258
+ aws:device-farm
259
+ aws:direct-connect
260
+ aws:directory-service
261
+ aws:distro-for-open-telemetry
262
+ aws:document-db
263
+ aws:dynamo-db
264
+ aws:ec2
265
+ aws:ec2-auto-scaling
266
+ aws:ec2-image-builder
267
+ aws:ecs-anywhere
268
+ aws:efs
269
+ aws:eks-anywhere
270
+ aws:eks-cloud
271
+ aws:eks-distro
272
+ aws:elasti-cache
273
+ aws:elastic-beanstalk
274
+ aws:elastic-block-store
275
+ aws:elastic-container-registry
276
+ aws:elastic-container-service
277
+ aws:elastic-disaster-recovery
278
+ aws:elastic-fabric-adapter
279
+ aws:elastic-inference
280
+ aws:elastic-kubernetes-service
281
+ aws:elastic-load-balancing
282
+ aws:elastic-transcoder
283
+ aws:elemental-appliances-software
284
+ aws:elemental-conductor
285
+ aws:elemental-delta
286
+ aws:elemental-link
287
+ aws:elemental-live
288
+ aws:elemental-media-connect
289
+ aws:elemental-media-convert
290
+ aws:elemental-media-live
291
+ aws:elemental-media-package
292
+ aws:elemental-media-store
293
+ aws:elemental-media-tailor
294
+ aws:elemental-server
295
+ aws:emr
296
+ aws:event-bridge
297
+ aws:express-workflows
298
+ aws:fargate
299
+ aws:fault-injection-simulator
300
+ aws:file-cache
301
+ aws:fin-space
302
+ aws:firewall-manager
303
+ aws:forecast
304
+ aws:fraud-detector
305
+ aws:free-rtos
306
+ aws:fsx
307
+ aws:fsx-for-lustre
308
+ aws:fsx-for-net-app-ontap
309
+ aws:fsx-for-open-zfs
310
+ aws:fsx-for-wfs
311
+ aws:game-kit
312
+ aws:game-lift
313
+ aws:game-sparks
314
+ aws:genomics-cli
315
+ aws:global-accelerator
316
+ aws:glue
317
+ aws:glue-data-brew
318
+ aws:glue-elastic-views
319
+ aws:ground-station
320
+ aws:guard-duty
321
+ aws:health-lake
322
+ aws:honeycode
323
+ aws:iam-identity-center
324
+ aws:identity-and-access-management
325
+ aws:inspector
326
+ aws:interactive-video-service
327
+ aws:io-t-1-click
328
+ aws:io-t-analytics
329
+ aws:io-t-button
330
+ aws:io-t-core
331
+ aws:io-t-device-defender
332
+ aws:io-t-device-management
333
+ aws:io-t-edu-kit
334
+ aws:io-t-events
335
+ aws:io-t-express-link
336
+ aws:io-t-fleet-wise
337
+ aws:io-t-greengrass
338
+ aws:io-t-robo-runner
339
+ aws:io-t-site-wise
340
+ aws:io-t-things-graph
341
+ aws:io-t-twin-maker
342
+ aws:iq
343
+ aws:kendra
344
+ aws:key-management-service
345
+ aws:keyspaces
346
+ aws:kinesis
347
+ aws:kinesis-data-analytics
348
+ aws:kinesis-data-streams
349
+ aws:kinesis-firehose
350
+ aws:kinesis-video-streams
351
+ aws:lake-formation
352
+ aws:lambda
353
+ aws:launch-wizard
354
+ aws:lex
355
+ aws:license-manager
356
+ aws:lightsail
357
+ aws:local-zones
358
+ aws:location-service
359
+ aws:lookout-for-equipment
360
+ aws:lookout-for-metrics
361
+ aws:lookout-for-vision
362
+ aws:lumberyard
363
+ aws:macie
364
+ aws:mainframe-modernization
365
+ aws:managed-blockchain
366
+ aws:managed-grafana
367
+ aws:managed-service-for-prometheus
368
+ aws:managed-services
369
+ aws:managed-streaming-for-apache-kafka
370
+ aws:managed-workflows-for-apache-airflow
371
+ aws:management-console
372
+ aws:marketplace-dark
373
+ aws:marketplace-light
374
+ aws:memory-db-for-redis
375
+ aws:migration-evaluator
376
+ aws:migration-hub
377
+ aws:monitron
378
+ aws:mq
379
+ aws:neptune
380
+ aws:network-firewall
381
+ aws:neuron
382
+ aws:nice-dcv
383
+ aws:nice-engin-frame
384
+ aws:nimble-studio
385
+ aws:nitro-enclaves
386
+ aws:omics
387
+ aws:open-3d-engine
388
+ aws:open-search-service
389
+ aws:ops-works
390
+ aws:organizations
391
+ aws:outposts-family
392
+ aws:outposts-rack
393
+ aws:outposts-servers
394
+ aws:panorama
395
+ aws:parallel-cluster
396
+ aws:personal-health-dashboard
397
+ aws:personalize
398
+ aws:pinpoint
399
+ aws:pinpoint-apis
400
+ aws:polly
401
+ aws:private-5g
402
+ aws:private-certificate-authority
403
+ aws:private-link
404
+ aws:professional-services
405
+ aws:proton
406
+ aws:quantum-ledger-database
407
+ aws:quick-sight
408
+ aws:rds
409
+ aws:rds-on-vmware
410
+ aws:re-post
411
+ aws:red-hat-open-shift-service-on-aws
412
+ aws:redshift
413
+ aws:rekognition
414
+ aws:reserved-instance-reporting
415
+ aws:resilience-hub
416
+ aws:resource-access-manager
417
+ aws:resource-explorer
418
+ aws:robo-maker
419
+ aws:route-53
420
+ aws:s3-on-outposts
421
+ aws:sage-maker
422
+ aws:sage-maker-ground-truth
423
+ aws:sage-maker-studio-lab
424
+ aws:savings-plans
425
+ aws:secrets-manager
426
+ aws:security-hub
427
+ aws:security-lake
428
+ aws:server-migration-service
429
+ aws:serverless-application-repository
430
+ aws:service-catalog
431
+ aws:service-management-connector
432
+ aws:shield
433
+ aws:signer
434
+ aws:sim-space-weaver
435
+ aws:simple-email-service
436
+ aws:simple-notification-service
437
+ aws:simple-queue-service
438
+ aws:simple-storage-service
439
+ aws:simple-storage-service-glacier
440
+ aws:site-to-site-vpn
441
+ aws:snowball
442
+ aws:snowball-edge
443
+ aws:snowcone
444
+ aws:snowmobile
445
+ aws:step-functions
446
+ aws:storage-gateway
447
+ aws:sumerian
448
+ aws:supply-chain
449
+ aws:support
450
+ aws:systems-manager
451
+ aws:tensor-flow-on-aws
452
+ aws:textract
453
+ aws:thinkbox-deadline
454
+ aws:thinkbox-frost
455
+ aws:thinkbox-krakatoa
456
+ aws:thinkbox-sequoia
457
+ aws:thinkbox-stoke
458
+ aws:thinkbox-xmesh
459
+ aws:timestream
460
+ aws:tools-and-sdks
461
+ aws:torch-serve
462
+ aws:training-certification
463
+ aws:transcribe
464
+ aws:transfer-family
465
+ aws:transit-gateway
466
+ aws:translate
467
+ aws:trusted-advisor
468
+ aws:verified-access
469
+ aws:verified-permissions
470
+ aws:virtual-private-cloud
471
+ aws:vmware-cloud-on-aws
472
+ aws:vpc-lattice
473
+ aws:waf
474
+ aws:wavelength
475
+ aws:well-architected-tool
476
+ aws:wickr
477
+ aws:work-docs
478
+ aws:work-docs-sdk
479
+ aws:work-link
480
+ aws:work-mail
481
+ aws:work-spaces-family
482
+ aws:x-ray
483
+ gcp:access-context-manager
484
+ gcp:administration
485
+ gcp:advanced-agent-modeling
486
+ gcp:advanced-solutions-lab
487
+ gcp:agent-assist
488
+ gcp:ai-hub
489
+ gcp:ai-platform
490
+ gcp:ai-platform-unified
491
+ gcp:analytics-hub
492
+ gcp:anthos
493
+ gcp:anthos-config-management
494
+ gcp:anthos-service-mesh
495
+ gcp:api
496
+ gcp:api-analytics
497
+ gcp:api-monetization
498
+ gcp:apigee-api-platform
499
+ gcp:apigee-sense
500
+ gcp:app-engine
501
+ gcp:artifact-registry
502
+ gcp:asset-inventory
503
+ gcp:assured-workloads
504
+ gcp:auto-ml
505
+ gcp:auto-ml-natural-language
506
+ gcp:auto-ml-tables
507
+ gcp:auto-ml-translation
508
+ gcp:auto-ml-video-intelligence
509
+ gcp:auto-ml-vision
510
+ gcp:bare-metal-solutions
511
+ gcp:batch
512
+ gcp:beyondcorp
513
+ gcp:big-query
514
+ gcp:bigtable
515
+ gcp:billing
516
+ gcp:binary-authorization
517
+ gcp:catalog
518
+ gcp:certificate-authority-service
519
+ gcp:certificate-manager
520
+ gcp:cloud-api-gateway
521
+ gcp:cloud-apis
522
+ gcp:cloud-armor
523
+ gcp:cloud-asset-inventory
524
+ gcp:cloud-audit-logs
525
+ gcp:cloud-build
526
+ gcp:cloud-cdn
527
+ gcp:cloud-code
528
+ gcp:cloud-composer
529
+ gcp:cloud-data-fusion
530
+ gcp:cloud-deploy
531
+ gcp:cloud-deployment-manager
532
+ gcp:cloud-dns
533
+ gcp:cloud-domains
534
+ gcp:cloud-ekm
535
+ gcp:cloud-endpoints
536
+ gcp:cloud-external-ip-addresses
537
+ gcp:cloud-firewall-rules
538
+ gcp:cloud-for-marketing
539
+ gcp:cloud-functions
540
+ gcp:cloud-generic
541
+ gcp:cloud-gpu
542
+ gcp:cloud-healthcare-api
543
+ gcp:cloud-healthcare-marketplace
544
+ gcp:cloud-hsm
545
+ gcp:cloud-ids
546
+ gcp:cloud-inference-api
547
+ gcp:cloud-interconnect
548
+ gcp:cloud-jobs-api
549
+ gcp:cloud-load-balancing
550
+ gcp:cloud-logging
551
+ gcp:cloud-media-edge
552
+ gcp:cloud-monitoring
553
+ gcp:cloud-nat
554
+ gcp:cloud-natural-language-api
555
+ gcp:cloud-network
556
+ gcp:cloud-ops
557
+ gcp:cloud-optimization-ai
558
+ gcp:cloud-optimization-ai-fleet-routing-api
559
+ gcp:cloud-router
560
+ gcp:cloud-routes
561
+ gcp:cloud-run
562
+ gcp:cloud-run-for-anthos
563
+ gcp:cloud-scheduler
564
+ gcp:cloud-security-scanner
565
+ gcp:cloud-shell
566
+ gcp:cloud-spanner
567
+ gcp:cloud-sql
568
+ gcp:cloud-storage
569
+ gcp:cloud-tasks
570
+ gcp:cloud-test-lab
571
+ gcp:cloud-tpu
572
+ gcp:cloud-translation-api
573
+ gcp:cloud-vision-api
574
+ gcp:cloud-vpn
575
+ gcp:compute-engine
576
+ gcp:configuration-management
577
+ gcp:connectivity-test
578
+ gcp:connectors
579
+ gcp:contact-center-ai
580
+ gcp:container-optimized-os
581
+ gcp:container-registry
582
+ gcp:data-catalog
583
+ gcp:data-labeling
584
+ gcp:data-layers
585
+ gcp:data-loss-prevention-api
586
+ gcp:data-qn-a
587
+ gcp:data-studio
588
+ gcp:data-transfer
589
+ gcp:database-migration-service
590
+ gcp:dataflow
591
+ gcp:datalab
592
+ gcp:dataplex
593
+ gcp:datapol
594
+ gcp:dataprep
595
+ gcp:dataproc
596
+ gcp:dataproc-metastore
597
+ gcp:datashare
598
+ gcp:datastore
599
+ gcp:datastream
600
+ gcp:debugger
601
+ gcp:developer-portal
602
+ gcp:dialogflow
603
+ gcp:dialogflow-cx
604
+ gcp:dialogflow-insights
605
+ gcp:document-ai
606
+ gcp:early-access-center
607
+ gcp:error-reporting
608
+ gcp:eventarc
609
+ gcp:filestore
610
+ gcp:financial-services-marketplace
611
+ gcp:firestore
612
+ gcp:fleet-engine
613
+ gcp:free-trial
614
+ gcp:game-servers
615
+ gcp:gce-systems-management
616
+ gcp:genomics
617
+ gcp:gke-on-prem
618
+ gcp:google-cloud-marketplace
619
+ gcp:google-kubernetes-engine
620
+ gcp:google-maps-platform
621
+ gcp:healthcare-nlp-api
622
+ gcp:home
623
+ gcp:identity-and-access-management
624
+ gcp:identity-aware-proxy
625
+ gcp:identity-platform
626
+ gcp:iot-core
627
+ gcp:iot-edge
628
+ gcp:key-access-justifications
629
+ gcp:key-management-service
630
+ gcp:kuberun
631
+ gcp:launcher
632
+ gcp:local-ssd
633
+ gcp:looker
634
+ gcp:managed-service-for-microsoft-active-directory
635
+ gcp:media-translation-api
636
+ gcp:memorystore
637
+ gcp:migrate-for-anthos
638
+ gcp:migrate-for-compute-engine
639
+ gcp:my-cloud
640
+ gcp:network-connectivity-center
641
+ gcp:network-intelligence-center
642
+ gcp:network-security
643
+ gcp:network-tiers
644
+ gcp:network-topology
645
+ gcp:onboarding
646
+ gcp:os-configuration-management
647
+ gcp:os-inventory-management
648
+ gcp:os-patch-management
649
+ gcp:partner-interconnect
650
+ gcp:partner-portal
651
+ gcp:performance-dashboard
652
+ gcp:permissions
653
+ gcp:persistent-disk
654
+ gcp:phishing-protection
655
+ gcp:policy-analyzer
656
+ gcp:premium-network-tier
657
+ gcp:private-connectivity
658
+ gcp:private-service-connect
659
+ gcp:producer-portal
660
+ gcp:profiler
661
+ gcp:project
662
+ gcp:pub-sub
663
+ gcp:quantum-engine
664
+ gcp:quotas
665
+ gcp:real-world-insights
666
+ gcp:recommendations-ai
667
+ gcp:release-notes
668
+ gcp:retail-api
669
+ gcp:risk-manager
670
+ gcp:runtime-config
671
+ gcp:secret-manager
672
+ gcp:security
673
+ gcp:security-command-center
674
+ gcp:security-health-advisor
675
+ gcp:security-key-enforcement
676
+ gcp:service-discovery
677
+ gcp:speech-to-text
678
+ gcp:stackdriver
679
+ gcp:standard-network-tier
680
+ gcp:stream-suite
681
+ gcp:support
682
+ gcp:tensorflow-enterprise
683
+ gcp:text-to-speech
684
+ gcp:tools-for-powershell
685
+ gcp:trace
686
+ gcp:traffic-director
687
+ gcp:transfer
688
+ gcp:transfer-appliance
689
+ gcp:user-preferences
690
+ gcp:vertex-ai
691
+ gcp:video-intelligence-api
692
+ gcp:virtual-private-cloud
693
+ gcp:visual-inspection
694
+ gcp:vmware-engine
695
+ gcp:web-risk
696
+ gcp:web-security-scanner
697
+ gcp:workflows
698
+ gcp:workload-identity-pool
699
+ tech:aarch64
700
+ tech:adobe-illustrator
701
+ tech:adobe-photoshop
702
+ tech:adobe-premiere-pro
703
+ tech:adobe-xd
704
+ tech:adonis-js
705
+ tech:after-effects
706
+ tech:airflow
707
+ tech:akka
708
+ tech:algolia
709
+ tech:alpine-js
710
+ tech:amazon-web-services
711
+ tech:anaconda
712
+ tech:android
713
+ tech:android-studio
714
+ tech:angular
715
+ tech:angular-js
716
+ tech:ansible
717
+ tech:ant-design
718
+ tech:apache
719
+ tech:apl
720
+ tech:appcelerator
721
+ tech:apple
722
+ tech:apple-safari
723
+ tech:appwrite
724
+ tech:arch-linux
725
+ tech:arduino
726
+ tech:argo-cd
727
+ tech:astro
728
+ tech:atom
729
+ tech:autodesk-maya
730
+ tech:autodesk-shot-grid
731
+ tech:awk
732
+ tech:azios
733
+ tech:azure
734
+ tech:azure-devops
735
+ tech:azure-sql-database
736
+ tech:babel
737
+ tech:backbone-js
738
+ tech:ballerina
739
+ tech:bamboo
740
+ tech:bash
741
+ tech:behance
742
+ tech:bitbucket
743
+ tech:blender
744
+ tech:bootstrap
745
+ tech:bower
746
+ tech:browserstack
747
+ tech:bulma
748
+ tech:bun
749
+ tech:c
750
+ tech:cairo-graphics
751
+ tech:cake-php
752
+ tech:canva
753
+ tech:capacitor
754
+ tech:cassandra
755
+ tech:cent-os
756
+ tech:chrome
757
+ tech:circle-ci
758
+ tech:clarity
759
+ tech:clion
760
+ tech:clojure
761
+ tech:clojure-script
762
+ tech:cloudflare
763
+ tech:cloudflare-workers
764
+ tech:cmake
765
+ tech:code-igniter
766
+ tech:code-pen
767
+ tech:codeac
768
+ tech:codecov
769
+ tech:coffee-script
770
+ tech:composer
771
+ tech:confluence
772
+ tech:consul
773
+ tech:contao
774
+ tech:corejs
775
+ tech:cosmosdb
776
+ tech:couchdb
777
+ tech:cplusplus
778
+ tech:crystal
779
+ tech:csharp
780
+ tech:css3
781
+ tech:cucumber
782
+ tech:cypress
783
+ tech:d3js
784
+ tech:dart
785
+ tech:data-grip
786
+ tech:data-spell
787
+ tech:dbeaver
788
+ tech:debian
789
+ tech:deno
790
+ tech:devicon
791
+ tech:digital-ocean
792
+ tech:discord-js
793
+ tech:django
794
+ tech:django-rest
795
+ tech:docker
796
+ tech:doctrine
797
+ tech:dropwizard
798
+ tech:drupal
799
+ tech:eclipse-ceylon
800
+ tech:eclipse-ide
801
+ tech:eclipse-vert-x
802
+ tech:elasticbeats
803
+ tech:elasticsearch
804
+ tech:electron
805
+ tech:eleventy-11ty
806
+ tech:elixir
807
+ tech:elm
808
+ tech:embedded-c
809
+ tech:ember-js
810
+ tech:envoy
811
+ tech:erlang
812
+ tech:eslint
813
+ tech:express
814
+ tech:facebook
815
+ tech:fast-api
816
+ tech:fastify
817
+ tech:fauna
818
+ tech:feathers
819
+ tech:fedora
820
+ tech:figma
821
+ tech:file-zilla
822
+ tech:firebase
823
+ tech:firefox
824
+ tech:flask
825
+ tech:flutter
826
+ tech:fortran
827
+ tech:foundation
828
+ tech:fsharp
829
+ tech:gatling
830
+ tech:gatsby
831
+ tech:gazebo
832
+ tech:gcc
833
+ tech:gentoo
834
+ tech:ghost
835
+ tech:gimp
836
+ tech:git
837
+ tech:gitbook
838
+ tech:github
839
+ tech:github-actions
840
+ tech:github-codespaces
841
+ tech:gitlab
842
+ tech:gitpod
843
+ tech:gitter
844
+ tech:gnu-emacs
845
+ tech:go
846
+ tech:go-land
847
+ tech:godot-engine
848
+ tech:google
849
+ tech:google-cloud
850
+ tech:gradle
851
+ tech:grafana
852
+ tech:grails
853
+ tech:graphql
854
+ tech:groovy
855
+ tech:grunt-js
856
+ tech:gulp-js
857
+ tech:hadoop
858
+ tech:handlebars
859
+ tech:hardhat
860
+ tech:harvester
861
+ tech:hashicorp-vault
862
+ tech:haskell
863
+ tech:haxe
864
+ tech:helm
865
+ tech:heroku
866
+ tech:hibernate
867
+ tech:homebrew
868
+ tech:html5
869
+ tech:hugo
870
+ tech:ibm-spss-statistics
871
+ tech:ie10
872
+ tech:ifttt
873
+ tech:influxdb
874
+ tech:inkscape
875
+ tech:insomnia
876
+ tech:intellij-idea
877
+ tech:ionic
878
+ tech:jaeger
879
+ tech:jamstack
880
+ tech:jasmine
881
+ tech:java
882
+ tech:javascript
883
+ tech:jeet
884
+ tech:jekyll
885
+ tech:jenkins
886
+ tech:jest
887
+ tech:jetbrains
888
+ tech:jira
889
+ tech:jira-align
890
+ tech:jquery
891
+ tech:json
892
+ tech:jule
893
+ tech:julia
894
+ tech:junit
895
+ tech:jupyter
896
+ tech:k3os
897
+ tech:k3s
898
+ tech:kafka
899
+ tech:kaggle
900
+ tech:karate
901
+ tech:karma
902
+ tech:keras
903
+ tech:kibana
904
+ tech:knex-js
905
+ tech:knockout
906
+ tech:kotlin
907
+ tech:krakenjs
908
+ tech:ktor
909
+ tech:kubernetes
910
+ tech:labview
911
+ tech:laravel
912
+ tech:latex
913
+ tech:less-js
914
+ tech:linkedin
915
+ tech:linux
916
+ tech:liquibase
917
+ tech:livewire
918
+ tech:llvm
919
+ tech:logstash
920
+ tech:lua
921
+ tech:lumen
922
+ tech:magento
923
+ tech:markdown
924
+ tech:material-ui
925
+ tech:materialize
926
+ tech:matlab
927
+ tech:matplotlib
928
+ tech:maven
929
+ tech:meteor-js
930
+ tech:microsoft-sql-server
931
+ tech:minitab
932
+ tech:mob-x
933
+ tech:mocha
934
+ tech:modx
935
+ tech:moleculer
936
+ tech:mongodb
937
+ tech:mongoose-js
938
+ tech:moodle
939
+ tech:ms-dos
940
+ tech:mysql
941
+ tech:nano
942
+ tech:nerog
943
+ tech:nestjs
944
+ tech:net
945
+ tech:net-core
946
+ tech:network-x
947
+ tech:new4j
948
+ tech:nextjs
949
+ tech:nginx
950
+ tech:nhibernate
951
+ tech:nim
952
+ tech:nimble
953
+ tech:nix
954
+ tech:nodejs
955
+ tech:nodemon
956
+ tech:nodewebkit
957
+ tech:npm
958
+ tech:nuget
959
+ tech:num-py
960
+ tech:nuxt-js
961
+ tech:objective-c
962
+ tech:ocaml
963
+ tech:oh-my-zsh
964
+ tech:okta
965
+ tech:open-al
966
+ tech:open-api
967
+ tech:open-cl
968
+ tech:open-cv
969
+ tech:open-gl
970
+ tech:open-stack
971
+ tech:open-suse
972
+ tech:open-telemetry
973
+ tech:opera
974
+ tech:oracle
975
+ tech:p5js
976
+ tech:packer
977
+ tech:pandas
978
+ tech:perl
979
+ tech:pf-sense
980
+ tech:phalcon
981
+ tech:phoenix-framework
982
+ tech:photon-engine
983
+ tech:php
984
+ tech:php-storm
985
+ tech:playwrite
986
+ tech:ploty
987
+ tech:podman
988
+ tech:polygon
989
+ tech:portainer
990
+ tech:postcss
991
+ tech:postgresql
992
+ tech:postman
993
+ tech:powershell
994
+ tech:processing
995
+ tech:prometheus
996
+ tech:protractor
997
+ tech:purescript
998
+ tech:putty
999
+ tech:pycharm
1000
+ tech:pyscript
1001
+ tech:pytest
1002
+ tech:python
1003
+ tech:python-poetry
1004
+ tech:pytorch
1005
+ tech:qodana
1006
+ tech:qt
1007
+ tech:quarkus
1008
+ tech:quasar
1009
+ tech:qwik
1010
+ tech:r
1011
+ tech:rabbitmq
1012
+ tech:rancher
1013
+ tech:raspberrypi
1014
+ tech:reach
1015
+ tech:react
1016
+ tech:react-bootstrap
1017
+ tech:realm
1018
+ tech:red-cube-s-epic-compiler-thingy-programming-re-ct
1019
+ tech:redhat
1020
+ tech:redis
1021
+ tech:redux
1022
+ tech:ren-py
1023
+ tech:rider
1024
+ tech:robot-operating-system-ros
1025
+ tech:rocksdb
1026
+ tech:rollup-js
1027
+ tech:rspec
1028
+ tech:rstudio
1029
+ tech:ruby
1030
+ tech:ruby-mine
1031
+ tech:ruby-on-rails
1032
+ tech:rust
1033
+ tech:salesforce
1034
+ tech:sanity
1035
+ tech:sass
1036
+ tech:scala
1037
+ tech:scalingo
1038
+ tech:sdl
1039
+ tech:selenium
1040
+ tech:sema-software
1041
+ tech:sequelize
1042
+ tech:shopware
1043
+ tech:sketch
1044
+ tech:slack
1045
+ tech:socket-io
1046
+ tech:solid-js
1047
+ tech:solidity
1048
+ tech:sonarqube
1049
+ tech:sourcetree
1050
+ tech:spark
1051
+ tech:splunk
1052
+ tech:spring
1053
+ tech:sql-developer
1054
+ tech:sqlalchemy
1055
+ tech:sqlite
1056
+ tech:ssh
1057
+ tech:stackoverflow
1058
+ tech:stata
1059
+ tech:storybook
1060
+ tech:streamlit
1061
+ tech:stylus
1062
+ tech:subversion
1063
+ tech:svelte
1064
+ tech:swagger
1065
+ tech:swift
1066
+ tech:symfony
1067
+ tech:tailwind-css
1068
+ tech:tauri
1069
+ tech:tensorflow
1070
+ tech:terraform
1071
+ tech:tex
1072
+ tech:the-algorithms
1073
+ tech:three-js
1074
+ tech:titanium-sdk
1075
+ tech:tomcat
1076
+ tech:tortoise-git
1077
+ tech:tower
1078
+ tech:traefik-mesh
1079
+ tech:traefik-proxy
1080
+ tech:travis-ci
1081
+ tech:trello
1082
+ tech:twitter
1083
+ tech:typescript
1084
+ tech:typo3
1085
+ tech:ubuntu
1086
+ tech:uml
1087
+ tech:unity
1088
+ tech:unix
1089
+ tech:unreal-engine
1090
+ tech:uwsgi
1091
+ tech:v8
1092
+ tech:vagrant
1093
+ tech:vala
1094
+ tech:vercel
1095
+ tech:veutify
1096
+ tech:vim
1097
+ tech:visualstudio
1098
+ tech:vite
1099
+ tech:vitejs
1100
+ tech:vscode
1101
+ tech:vsphere
1102
+ tech:vue
1103
+ tech:vue-storefront
1104
+ tech:vyper
1105
+ tech:webassembly
1106
+ tech:webflow
1107
+ tech:weblate
1108
+ tech:webpack
1109
+ tech:webstorm
1110
+ tech:windows11
1111
+ tech:windows8
1112
+ tech:woo-commerce
1113
+ tech:wordpress
1114
+ tech:xamarin
1115
+ tech:xcode
1116
+ tech:xml
1117
+ tech:yaml
1118
+ tech:yarn
1119
+ tech:yii-framework
1120
+ tech:yuno-host
1121
+ tech:zend-framework
1122
+ tech:zig
1123
+ }
1124
+ }
1125
+ `,dC="likec4builtin",Fz=`${dC}:///likec4/lib/icons.c4`,jz=new hn.NotificationType("likec4/onDidChangeModel"),Uz=new hn.RequestType0("likec4/fetchModel"),Bz=new hn.RequestType0("likec4/fetchComputedModel"),qz=new hn.RequestType("likec4/computeView"),Wz=new hn.RequestType("likec4/build"),Gz=new hn.RequestType("likec4/locate"),zz=new hn.RequestType("likec4/change-view");var Hz=t=>{const e=t.match(/^[ \t]*(?=\S)/gm);return e?e.reduce((n,r)=>Math.min(n,r.length),1/0):0};const Kz=Io(Hz);function yv(t){const e=Kz(t);if(e===0)return t;const n=new RegExp(`^[ \\t]{${e}}`,"gm");return t.replace(n,"")}function Vz(t){for(var e=5381,n=t.length;n;)e=e*33^t.charCodeAt(--n);return e>>>0}var Yz=Vz;const Xz=Io(Yz);var Jz=Object.getOwnPropertyNames,Qz=Object.getOwnPropertySymbols,Zz=Object.prototype.hasOwnProperty;function fC(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function sh(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);var s=i.cache,o=s.get(n),a=s.get(r);if(o&&a)return o===r&&a===n;s.set(n,r),s.set(r,n);var c=t(n,r,i);return s.delete(n),s.delete(r),c}}function hC(t){return Jz(t).concat(Qz(t))}var pC=Object.hasOwn||function(t,e){return Zz.call(t,e)};function ia(t,e){return t||e?t===e:t===e||t!==t&&e!==e}var gC="_owner",mC=Object.getOwnPropertyDescriptor,yC=Object.keys;function e9(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 t9(t,e){return ia(t.getTime(),e.getTime())}function vC(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),s=0,o,a;(o=i.next())&&!o.done;){for(var c=e.entries(),l=!1,u=0;(a=c.next())&&!a.done;){var d=o.value,f=d[0],h=d[1],p=a.value,y=p[0],R=p[1];!l&&!r[u]&&(l=n.equals(f,y,s,u,t,e,n)&&n.equals(h,R,f,y,t,e,n))&&(r[u]=!0),u++}if(!l)return!1;s++}return!0}function n9(t,e,n){var r=yC(t),i=r.length;if(yC(e).length!==i)return!1;for(var s;i-- >0;)if(s=r[i],s===gC&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!pC(e,s)||!n.equals(t[s],e[s],s,s,t,e,n))return!1;return!0}function il(t,e,n){var r=hC(t),i=r.length;if(hC(e).length!==i)return!1;for(var s,o,a;i-- >0;)if(s=r[i],s===gC&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!pC(e,s)||!n.equals(t[s],e[s],s,s,t,e,n)||(o=mC(t,s),a=mC(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function r9(t,e){return ia(t.valueOf(),e.valueOf())}function i9(t,e){return t.source===e.source&&t.flags===e.flags}function wC(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),s,o;(s=i.next())&&!s.done;){for(var a=e.values(),c=!1,l=0;(o=a.next())&&!o.done;)!c&&!r[l]&&(c=n.equals(s.value,o.value,s.value,o.value,t,e,n))&&(r[l]=!0),l++;if(!c)return!1}return!0}function s9(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var o9="[object Arguments]",a9="[object Boolean]",c9="[object Date]",l9="[object Map]",u9="[object Number]",d9="[object Object]",f9="[object RegExp]",h9="[object Set]",p9="[object String]",g9=Array.isArray,bC=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,TC=Object.assign,m9=Object.prototype.toString.call.bind(Object.prototype.toString);function y9(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,s=t.arePrimitiveWrappersEqual,o=t.areRegExpsEqual,a=t.areSetsEqual,c=t.areTypedArraysEqual;return function(u,d,f){if(u===d)return!0;if(u==null||d==null||typeof u!="object"||typeof d!="object")return u!==u&&d!==d;var h=u.constructor;if(h!==d.constructor)return!1;if(h===Object)return i(u,d,f);if(g9(u))return e(u,d,f);if(bC!=null&&bC(u))return c(u,d,f);if(h===Date)return n(u,d,f);if(h===RegExp)return o(u,d,f);if(h===Map)return r(u,d,f);if(h===Set)return a(u,d,f);var p=m9(u);return p===c9?n(u,d,f):p===f9?o(u,d,f):p===l9?r(u,d,f):p===h9?a(u,d,f):p===d9?typeof u.then!="function"&&typeof d.then!="function"&&i(u,d,f):p===o9?i(u,d,f):p===a9||p===u9||p===p9?s(u,d,f):!1}}function v9(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?il:e9,areDatesEqual:t9,areMapsEqual:r?fC(vC,il):vC,areObjectsEqual:r?il:n9,arePrimitiveWrappersEqual:r9,areRegExpsEqual:i9,areSetsEqual:r?fC(wC,il):wC,areTypedArraysEqual:r?il:s9};if(n&&(i=TC({},i,n(i))),e){var s=sh(i.areArraysEqual),o=sh(i.areMapsEqual),a=sh(i.areObjectsEqual),c=sh(i.areSetsEqual);i=TC({},i,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:c})}return i}function w9(t){return function(e,n,r,i,s,o,a){return t(e,n,a)}}function b9(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,s=t.strict;if(r)return function(c,l){var u=r(),d=u.cache,f=d===void 0?e?new WeakMap:void 0:d,h=u.meta;return n(c,l,{cache:f,equals:i,meta:h,strict:s})};if(e)return function(c,l){return n(c,l,{cache:new WeakMap,equals:i,meta:void 0,strict:s})};var o={cache:void 0,equals:i,meta:void 0,strict:s};return function(c,l){return n(c,l,o)}}var EC=Ji();Ji({strict:!0}),Ji({circular:!0}),Ji({circular:!0,strict:!0}),Ji({createInternalComparator:function(){return ia}}),Ji({strict:!0,createInternalComparator:function(){return ia}}),Ji({circular:!0,createInternalComparator:function(){return ia}}),Ji({circular:!0,createInternalComparator:function(){return ia},strict:!0});function Ji(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,s=t.strict,o=s===void 0?!1:s,a=v9(t),c=y9(a),l=r?r(c):w9(c);return b9({circular:n,comparator:c,createState:i,equals:l,strict:o})}var T9="\0",Gs="\0",RC="";let E9=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(e){e&&(this._isDirected=Object.hasOwn(e,"directed")?e.directed:!0,this._isMultigraph=Object.hasOwn(e,"multigraph")?e.multigraph:!1,this._isCompound=Object.hasOwn(e,"compound")?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[Gs]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!="function"&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(n=>Object.keys(e._in[n]).length===0)}sinks(){var e=this;return this.nodes().filter(n=>Object.keys(e._out[n]).length===0)}setNodes(e,n){var r=arguments,i=this;return e.forEach(function(s){r.length>1?i.setNode(s,n):i.setNode(s)}),this}setNode(e,n){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=n),this):(this._nodes[e]=arguments.length>1?n:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=Gs,this._children[e]={},this._children[Gs][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var n=this;if(Object.hasOwn(this._nodes,e)){var r=i=>n.removeEdge(n._edgeObjs[i]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(i){n.setParent(i)}),delete this._children[e]),Object.keys(this._in[e]).forEach(r),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=Gs;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===e)throw new Error("Setting "+n+" as parent of "+e+" would create a cycle");this.setNode(n)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=n,this._children[n][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var n=this._parent[e];if(n!==Gs)return n}}children(e=Gs){if(this._isCompound){var n=this._children[e];if(n)return Object.keys(n)}else{if(e===Gs)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var n=this._preds[e];if(n)return Object.keys(n)}successors(e){var n=this._sucs[e];if(n)return Object.keys(n)}neighbors(e){var n=this.predecessors(e);if(n){const i=new Set(n);for(var r of this.successors(e))i.add(r);return Array.from(i.values())}}isLeaf(e){var n;return this.isDirected()?n=this.successors(e):n=this.neighbors(e),n.length===0}filterNodes(e){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([o,a]){e(o)&&n.setNode(o,a)}),Object.values(this._edgeObjs).forEach(function(o){n.hasNode(o.v)&&n.hasNode(o.w)&&n.setEdge(o,r.edge(o))});var i={};function s(o){var a=r.parent(o);return a===void 0||n.hasNode(a)?(i[o]=a,a):a in i?i[a]:s(a)}return this._isCompound&&n.nodes().forEach(o=>n.setParent(o,s(o))),n}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!="function"&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,n){var r=this,i=arguments;return e.reduce(function(s,o){return i.length>1?r.setEdge(s,o,n):r.setEdge(s,o),o}),this}setEdge(){var e,n,r,i,s=!1,o=arguments[0];typeof o=="object"&&o!==null&&"v"in o?(e=o.v,n=o.w,r=o.name,arguments.length===2&&(i=arguments[1],s=!0)):(e=o,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],s=!0)),e=""+e,n=""+n,r!==void 0&&(r=""+r);var a=sl(this._isDirected,e,n,r);if(Object.hasOwn(this._edgeLabels,a))return s&&(this._edgeLabels[a]=i),this;if(r!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(n),this._edgeLabels[a]=s?i:this._defaultEdgeLabelFn(e,n,r);var c=R9(this._isDirected,e,n,r);return e=c.v,n=c.w,Object.freeze(c),this._edgeObjs[a]=c,SC(this._preds[n],e),SC(this._sucs[e],n),this._in[n][a]=c,this._out[e][a]=c,this._edgeCount++,this}edge(e,n,r){var i=arguments.length===1?vv(this._isDirected,arguments[0]):sl(this._isDirected,e,n,r);return this._edgeLabels[i]}edgeAsObj(){const e=this.edge(...arguments);return typeof e!="object"?{label:e}:e}hasEdge(e,n,r){var i=arguments.length===1?vv(this._isDirected,arguments[0]):sl(this._isDirected,e,n,r);return Object.hasOwn(this._edgeLabels,i)}removeEdge(e,n,r){var i=arguments.length===1?vv(this._isDirected,arguments[0]):sl(this._isDirected,e,n,r),s=this._edgeObjs[i];return s&&(e=s.v,n=s.w,delete this._edgeLabels[i],delete this._edgeObjs[i],$C(this._preds[n],e),$C(this._sucs[e],n),delete this._in[n][i],delete this._out[e][i],this._edgeCount--),this}inEdges(e,n){var r=this._in[e];if(r){var i=Object.values(r);return n?i.filter(s=>s.v===n):i}}outEdges(e,n){var r=this._out[e];if(r){var i=Object.values(r);return n?i.filter(s=>s.w===n):i}}nodeEdges(e,n){var r=this.inEdges(e,n);if(r)return r.concat(this.outEdges(e,n))}};function SC(t,e){t[e]?t[e]++:t[e]=1}function $C(t,e){--t[e]||delete t[e]}function sl(t,e,n,r){var i=""+e,s=""+n;if(!t&&i>s){var o=i;i=s,s=o}return i+RC+s+RC+(r===void 0?T9:r)}function R9(t,e,n,r){var i=""+e,s=""+n;if(!t&&i>s){var o=i;i=s,s=o}var a={v:i,w:s};return r&&(a.name=r),a}function vv(t,e){return sl(t,e.v,e.w,e.name)}var wv=E9,S9="2.2.4",$9={Graph:wv,version:S9},k9=wv,_9={write:C9,read:x9};function C9(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:A9(t),edges:I9(t)};return t.graph()!==void 0&&(e.value=structuredClone(t.graph())),e}function A9(t){return t.nodes().map(function(e){var n=t.node(e),r=t.parent(e),i={v:e};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function I9(t){return t.edges().map(function(e){var n=t.edge(e),r={v:e.v,w:e.w};return e.name!==void 0&&(r.name=e.name),n!==void 0&&(r.value=n),r})}function x9(t){var e=new k9(t.options).setGraph(t.value);return t.nodes.forEach(function(n){e.setNode(n.v,n.value),n.parent&&e.setParent(n.v,n.parent)}),t.edges.forEach(function(n){e.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),e}var P9=N9;function N9(t){var e={},n=[],r;function i(s){Object.hasOwn(e,s)||(e[s]=!0,r.push(s),t.successors(s).forEach(i),t.predecessors(s).forEach(i))}return t.nodes().forEach(function(s){r=[],i(s),r.length&&n.push(r)}),n}let D9=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var n=this._keyIndices[e];if(n!==void 0)return this._arr[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,n){var r=this._keyIndices;if(e=String(e),!Object.hasOwn(r,e)){var i=this._arr,s=i.length;return r[e]=s,i.push({key:e,priority:n}),this._decrease(s),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,n){var r=this._keyIndices[e];if(n>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+n);this._arr[r].priority=n,this._decrease(r)}_heapify(e){var n=this._arr,r=2*e,i=r+1,s=e;r<n.length&&(s=n[r].priority<n[s].priority?r:s,i<n.length&&(s=n[i].priority<n[s].priority?i:s),s!==e&&(this._swap(e,s),this._heapify(s)))}_decrease(e){for(var n=this._arr,r=n[e].priority,i;e!==0&&(i=e>>1,!(n[i].priority<r));)this._swap(e,i),e=i}_swap(e,n){var r=this._arr,i=this._keyIndices,s=r[e],o=r[n];r[e]=o,r[n]=s,i[o.key]=e,i[s.key]=n}};var kC=D9,O9=kC,_C=M9,L9=()=>1;function M9(t,e,n,r){return F9(t,String(e),n||L9,r||function(i){return t.outEdges(i)})}function F9(t,e,n,r){var i={},s=new O9,o,a,c=function(l){var u=l.v!==o?l.v:l.w,d=i[u],f=n(l),h=a.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+l+" Weight: "+f);h<d.distance&&(d.distance=h,d.predecessor=o,s.decrease(u,h))};for(t.nodes().forEach(function(l){var u=l===e?0:Number.POSITIVE_INFINITY;i[l]={distance:u},s.add(l,u)});s.size()>0&&(o=s.removeMin(),a=i[o],a.distance!==Number.POSITIVE_INFINITY);)r(o).forEach(c);return i}var j9=_C,U9=B9;function B9(t,e,n){return t.nodes().reduce(function(r,i){return r[i]=j9(t,i,e,n),r},{})}var CC=q9;function q9(t){var e=0,n=[],r={},i=[];function s(o){var a=r[o]={onStack:!0,lowlink:e,index:e++};if(n.push(o),t.successors(o).forEach(function(u){Object.hasOwn(r,u)?r[u].onStack&&(a.lowlink=Math.min(a.lowlink,r[u].index)):(s(u),a.lowlink=Math.min(a.lowlink,r[u].lowlink))}),a.lowlink===a.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return t.nodes().forEach(function(o){Object.hasOwn(r,o)||s(o)}),i}var W9=CC,G9=z9;function z9(t){return W9(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})}var H9=V9,K9=()=>1;function V9(t,e,n){return Y9(t,e||K9,n||function(r){return t.outEdges(r)})}function Y9(t,e,n){var r={},i=t.nodes();return i.forEach(function(s){r[s]={},r[s][s]={distance:0},i.forEach(function(o){s!==o&&(r[s][o]={distance:Number.POSITIVE_INFINITY})}),n(s).forEach(function(o){var a=o.v===s?o.w:o.v,c=e(o);r[s][a]={distance:c,predecessor:s}})}),i.forEach(function(s){var o=r[s];i.forEach(function(a){var c=r[a];i.forEach(function(l){var u=c[s],d=o[l],f=c[l],h=u.distance+d.distance;h<f.distance&&(f.distance=h,f.predecessor=d.predecessor)})})}),r}function AC(t){var e={},n={},r=[];function i(s){if(Object.hasOwn(n,s))throw new bv;Object.hasOwn(e,s)||(n[s]=!0,e[s]=!0,t.predecessors(s).forEach(i),delete n[s],r.push(s))}if(t.sinks().forEach(i),Object.keys(e).length!==t.nodeCount())throw new bv;return r}class bv extends Error{constructor(){super(...arguments)}}var IC=AC;AC.CycleException=bv;var xC=IC,X9=J9;function J9(t){try{xC(t)}catch(e){if(e instanceof xC.CycleException)return!1;throw e}return!0}var PC=Q9;function Q9(t,e,n){Array.isArray(e)||(e=[e]);var r=t.isDirected()?a=>t.successors(a):a=>t.neighbors(a),i=n==="post"?Z9:eH,s=[],o={};return e.forEach(a=>{if(!t.hasNode(a))throw new Error("Graph does not have node: "+a);i(a,r,o,s)}),s}function Z9(t,e,n,r){for(var i=[[t,!1]];i.length>0;){var s=i.pop();s[1]?r.push(s[0]):Object.hasOwn(n,s[0])||(n[s[0]]=!0,i.push([s[0],!0]),NC(e(s[0]),o=>i.push([o,!1])))}}function eH(t,e,n,r){for(var i=[t];i.length>0;){var s=i.pop();Object.hasOwn(n,s)||(n[s]=!0,r.push(s),NC(e(s),o=>i.push(o)))}}function NC(t,e){for(var n=t.length;n--;)e(t[n],n,t);return t}var tH=PC,nH=rH;function rH(t,e){return tH(t,e,"post")}var iH=PC,sH=oH;function oH(t,e){return iH(t,e,"pre")}var aH=wv,cH=kC,lH=uH;function uH(t,e){var n=new aH,r={},i=new cH,s;function o(c){var l=c.v===s?c.w:c.v,u=i.priority(l);if(u!==void 0){var d=e(c);d<u&&(r[l]=s,i.decrease(l,d))}}if(t.nodeCount()===0)return n;t.nodes().forEach(function(c){i.add(c,Number.POSITIVE_INFINITY),n.setNode(c)}),i.decrease(t.nodes()[0],0);for(var a=!1;i.size()>0;){if(s=i.removeMin(),Object.hasOwn(r,s))n.setEdge(s,r[s]);else{if(a)throw new Error("Input graph is not connected: "+t);a=!0}t.nodeEdges(s).forEach(o)}return n}var dH={components:P9,dijkstra:_C,dijkstraAll:U9,findCycles:G9,floydWarshall:H9,isAcyclic:X9,postorder:nH,preorder:sH,prim:lH,tarjan:CC,topsort:IC},DC=$9,Tv={Graph:DC.Graph,json:_9,alg:dH,version:DC.version};const Ev=Io(Tv);var Rv={exports:{}};(function(t,e){var n=Xb;e=t.exports=r;function r(d,f){return f=o(d,f),c(d,f)}e.sha1=function(d){return r(d)},e.keys=function(d){return r(d,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},e.MD5=function(d){return r(d,{algorithm:"md5",encoding:"hex"})},e.keysMD5=function(d){return r(d,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var i=n.getHashes?n.getHashes().slice():["sha1","md5"];i.push("passthrough");var s=["buffer","hex","binary","base64"];function o(d,f){f=f||{};var h={};if(h.algorithm=f.algorithm||"sha1",h.encoding=f.encoding||"hex",h.excludeValues=!!f.excludeValues,h.algorithm=h.algorithm.toLowerCase(),h.encoding=h.encoding.toLowerCase(),h.ignoreUnknown=f.ignoreUnknown===!0,h.respectType=f.respectType!==!1,h.respectFunctionNames=f.respectFunctionNames!==!1,h.respectFunctionProperties=f.respectFunctionProperties!==!1,h.unorderedArrays=f.unorderedArrays===!0,h.unorderedSets=f.unorderedSets!==!1,h.unorderedObjects=f.unorderedObjects!==!1,h.replacer=f.replacer||void 0,h.excludeKeys=f.excludeKeys||void 0,typeof d>"u")throw new Error("Object argument required.");for(var p=0;p<i.length;++p)i[p].toLowerCase()===h.algorithm.toLowerCase()&&(h.algorithm=i[p]);if(i.indexOf(h.algorithm)===-1)throw new Error('Algorithm "'+h.algorithm+'" not supported. supported values: '+i.join(", "));if(s.indexOf(h.encoding)===-1&&h.algorithm!=="passthrough")throw new Error('Encoding "'+h.encoding+'" not supported. supported values: '+s.join(", "));return h}function a(d){if(typeof d!="function")return!1;var f=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;return f.exec(Function.prototype.toString.call(d))!=null}function c(d,f){var h;f.algorithm!=="passthrough"?h=n.createHash(f.algorithm):h=new u,typeof h.write>"u"&&(h.write=h.update,h.end=h.update);var p=l(f,h);if(p.dispatch(d),h.update||h.end(""),h.digest)return h.digest(f.encoding==="buffer"?void 0:f.encoding);var y=h.read();return f.encoding==="buffer"?y:y.toString(f.encoding)}e.writeToStream=function(d,f,h){return typeof h>"u"&&(h=f,f={}),f=o(d,f),l(f,h).dispatch(d)};function l(d,f,h){h=h||[];var p=function(y){return f.update?f.update(y,"utf8"):f.write(y,"utf8")};return{dispatch:function(y){d.replacer&&(y=d.replacer(y));var R=typeof y;return y===null&&(R="null"),this["_"+R](y)},_object:function(y){var R=/\[object (.*)\]/i,b=Object.prototype.toString.call(y),v=R.exec(b);v?v=v[1]:v="unknown:["+b+"]",v=v.toLowerCase();var T=null;if((T=h.indexOf(y))>=0)return this.dispatch("[CIRCULAR:"+T+"]");if(h.push(y),typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(y))return p("buffer:"),p(y);if(v!=="object"&&v!=="function"&&v!=="asyncfunction")if(this["_"+v])this["_"+v](y);else{if(d.ignoreUnknown)return p("["+v+"]");throw new Error('Unknown object type "'+v+'"')}else{var _=Object.keys(y);d.unorderedObjects&&(_=_.sort()),d.respectType!==!1&&!a(y)&&_.splice(0,0,"prototype","__proto__","constructor"),d.excludeKeys&&(_=_.filter(function(F){return!d.excludeKeys(F)})),p("object:"+_.length+":");var N=this;return _.forEach(function(F){N.dispatch(F),p(":"),d.excludeValues||N.dispatch(y[F]),p(",")})}},_array:function(y,R){R=typeof R<"u"?R:d.unorderedArrays!==!1;var b=this;if(p("array:"+y.length+":"),!R||y.length<=1)return y.forEach(function(_){return b.dispatch(_)});var v=[],T=y.map(function(_){var N=new u,F=h.slice(),x=l(d,N,F);return x.dispatch(_),v=v.concat(F.slice(h.length)),N.read().toString()});return h=h.concat(v),T.sort(),this._array(T,!1)},_date:function(y){return p("date:"+y.toJSON())},_symbol:function(y){return p("symbol:"+y.toString())},_error:function(y){return p("error:"+y.toString())},_boolean:function(y){return p("bool:"+y.toString())},_string:function(y){p("string:"+y.length+":"),p(y.toString())},_function:function(y){p("fn:"),a(y)?this.dispatch("[native]"):this.dispatch(y.toString()),d.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(y.name)),d.respectFunctionProperties&&this._object(y)},_number:function(y){return p("number:"+y.toString())},_xml:function(y){return p("xml:"+y.toString())},_null:function(){return p("Null")},_undefined:function(){return p("Undefined")},_regexp:function(y){return p("regex:"+y.toString())},_uint8array:function(y){return p("uint8array:"),this.dispatch(Array.prototype.slice.call(y))},_uint8clampedarray:function(y){return p("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(y))},_int8array:function(y){return p("int8array:"),this.dispatch(Array.prototype.slice.call(y))},_uint16array:function(y){return p("uint16array:"),this.dispatch(Array.prototype.slice.call(y))},_int16array:function(y){return p("int16array:"),this.dispatch(Array.prototype.slice.call(y))},_uint32array:function(y){return p("uint32array:"),this.dispatch(Array.prototype.slice.call(y))},_int32array:function(y){return p("int32array:"),this.dispatch(Array.prototype.slice.call(y))},_float32array:function(y){return p("float32array:"),this.dispatch(Array.prototype.slice.call(y))},_float64array:function(y){return p("float64array:"),this.dispatch(Array.prototype.slice.call(y))},_arraybuffer:function(y){return p("arraybuffer:"),this.dispatch(new Uint8Array(y))},_url:function(y){return p("url:"+y.toString())},_map:function(y){p("map:");var R=Array.from(y);return this._array(R,d.unorderedSets!==!1)},_set:function(y){p("set:");var R=Array.from(y);return this._array(R,d.unorderedSets!==!1)},_file:function(y){return p("file:"),this.dispatch([y.name,y.size,y.type,y.lastModfied])},_blob:function(){if(d.ignoreUnknown)return p("[blob]");throw Error(`Hashing Blob objects is currently not supported
1126
+ (see https://github.com/puleos/object-hash/issues/26)
1127
+ Use "options.replacer" or "options.ignoreUnknown"
1128
+ `)},_domwindow:function(){return p("domwindow")},_bigint:function(y){return p("bigint:"+y.toString())},_process:function(){return p("process")},_timer:function(){return p("timer")},_pipe:function(){return p("pipe")},_tcp:function(){return p("tcp")},_udp:function(){return p("udp")},_tty:function(){return p("tty")},_statwatcher:function(){return p("statwatcher")},_securecontext:function(){return p("securecontext")},_connection:function(){return p("connection")},_zlib:function(){return p("zlib")},_context:function(){return p("context")},_nodescript:function(){return p("nodescript")},_httpparser:function(){return p("httpparser")},_dataview:function(){return p("dataview")},_signal:function(){return p("signal")},_fsevent:function(){return p("fsevent")},_tlswrap:function(){return p("tlswrap")}}}function u(){return{buf:"",write:function(d){this.buf+=d},end:function(d){this.buf+=d},read:function(){return this.buf}}}})(Rv,Rv.exports);var fH=Rv.exports;const hH=Io(fH);function OC(t){const e={id:t.id,__:t.__??"element",autoLayout:t.autoLayout,nodes:We(t.nodes,st(V_(["id","title","description","technology","shape","icon","children"])),hi(({id:n,icon:r,...i})=>[n,{...i,icon:Q(r)?"Y":"N"}])),edges:We(t.edges,st(V_(["source","target","label","description","technology","dir","head","tail","line"])),hi(({source:n,target:r,...i})=>[`${n}:${r}`,i]))};return t.hash=hH(e,{ignoreUnknown:!0,respectType:!1}),t}function yn(t){if(ie.isElementWhere(t)){const e=yn(t.where.expr),n=lo(t.where.condition);return r=>e(r)&&n(r)}if(ie.isWildcard(t))return()=>!0;if(ie.isElementKindExpr(t))return t.isEqual?e=>e.kind===t.elementKind:e=>e.kind!==t.elementKind;if(ie.isElementTagExpr(t))return t.isEqual?({tags:e})=>!!e&&e.includes(t.elementTag):({tags:e})=>$t(e)||!e.includes(t.elementTag);if(ie.isExpandedElementExpr(t))return e=>e.id===t.expanded||Et(e.id)===t.expanded;if(ie.isElementRef(t)){const{element:e,isDescedants:n}=t;return n?r=>r.id.startsWith(e+"."):r=>r.id===e}if(ie.isCustomElement(t))return yn(t.custom.expr);Se(t)}function LC(t,e){const n=t.flatMap(i=>"include"in i?i.include.filter(ie.isCustomElement):[]);if(n.length===0)return e;const r=[...e];for(const{custom:{expr:i,...s}}of n){const{border:o,opacity:a,...c}=K_(s,$t),l=!Yi(c),u=yn(i);r.forEach((d,f)=>{if(!u(d))return;l&&(d={...d,isCustomized:!0,...c});let h;o!==void 0&&(h={border:o}),a!==void 0&&(h={...h,opacity:a}),h&&(d={...d,isCustomized:!0,style:{...d.style,...h}}),r[f]=d})}return r}function MC(t){switch(!0){case ie.isRelationWhere(t):return MC(t.where.expr);case ie.isRelation(t):{const e=yn(t.source),n=yn(t.target);return r=>e(r.source)&&n(r.target)||!!t.isBidirectional&&e(r.target)&&n(r.source)}case ie.isInOut(t):{const e=yn(t.inout);return n=>e(n.source)||e(n.target)}case ie.isIncoming(t):{const e=yn(t.incoming);return n=>e(n.target)}case ie.isOutgoing(t):{const e=yn(t.outgoing);return n=>e(n.source)}default:Se(t)}}function pH(t,e,n){const r=t.flatMap(s=>"include"in s?s.include.filter(ie.isCustomRelationExpr):[]),i=Array.from(n);if(r.length===0||i.length===0)return i;for(const{customRelation:{relation:s,title:o,...a}}of r){const c=K_(a,$t),l=MC(s);i.forEach((u,d)=>{const f=e.find(p=>p.id===u.source),h=e.find(p=>p.id===u.target);!f||!h||l({source:f,target:h})&&(i[d]={...u,label:o??u.label,isCustomized:!0,...c})})}return i}function FC(t,e){const n=t.filter(wD);if(n.length===0)return e;for(const r of n){const i=[];for(const s of r.targets){if(ie.isWildcard(s)){i.push(()=>!0);break}i.push(yn(s))}He(e,UG(i)).forEach(s=>{s.shape=r.style.shape??s.shape,s.color=r.style.color??s.color,It(r.style.icon)&&(s.icon=r.style.icon),It(r.notation)&&(s.notation=r.notation);let o;It(r.style.border)&&(o={border:r.style.border}),It(r.style.opacity)&&(o={...o,opacity:r.style.opacity}),o&&(s.style={...s.style,...o})})}return e}function gH(t,e){let n;for(;t.parent&&(n=e.get(t.parent));){const r=n.depth??1;if(n.depth=Math.max(r,(t.depth??0)+1),n.depth===r)break;t=n}}function jC(t){return Array.from(t).sort(Sg).reduce((e,{id:n,color:r,shape:i,style:s,...o})=>{let a=Et(n),c=0;for(;a;){const u=e.get(a);if(u){u.children.length==0&&(u.depth=1,gH(u,e)),u.children.push(n),c=u.level+1;break}a=Et(a)}const l={...o,id:n,parent:a,level:c,color:r??Du,shape:i??Jb,children:[],inEdges:[],outEdges:[],style:{...s}};return e.set(n,l),e},new Map)}function UC(t){return We(t,th(fi("notation")),Ki(fv(th(fi("shape")),Ki(fv(th(fi("color")),Ki(fv(st(fi("kind")),Ar())),na(),st(([e,n])=>({kinds:n,color:e})))),na(),Xi(([e,n])=>n.map(({color:r,kinds:i})=>({shape:e,color:r,kinds:i}))))),na(),Xi(([e,n])=>n.map(({shape:r,color:i,kinds:s})=>({title:e,shape:r,color:i,kinds:s}))),rG(fi("shape"),fi("title"),[e=>e.kinds.length,"desc"]))}const BC=Ev.alg.postorder,mH=Ev.alg.findCycles,yH=Ev.alg.isAcyclic;function vH(t){t.forEach(e=>{e.children.length>0&&(e.children=t.flatMap(n=>n.parent===e.id?n.id:[]))})}function wH({nodes:t,edges:e}){if(e.length===0)return t;const n=new Tv.Graph({compound:!1,directed:!0,multigraph:!1}),r=a=>at(t.find(c=>c.id===a),"Edge not found"),i=a=>at(e.find(c=>c.id===a),"Edge not found");for(const a of[...e].sort(La))n.setEdge(a.source,a.target);for(const a of t)n.setNode(a.id),a.children.length>0&&a.inEdges.forEach(c=>{const l=i(c);l.target!==a.id&&r(l.source).children.length===0&&n.setEdge(l.source,a.id)}),a.parent&&n.setEdge(a.parent,a.id);let s=n.sources();s.length===0&&(s=We(t,Zc(Sg),He(a=>a.inEdges.length===0||a.parent===null),st(a=>a.id)));const o=BC(n,s).reverse().map(r);if(o.length<t.length){const a=MG(t,o);o.push(...a)}return ce(o.length===t.length,"Not all nodes were processed by graphlib"),vH(o),o}function bH(t){const e=We(t,Xi(n=>n.tags??[]),Ar(),Zc(Hu));return Rg(e,1)?e:null}const or=()=>!0,Sv=t=>t,$v=t=>t===or?Sv:He(t),TH=t=>t===or?Sv:e=>t(e)?e:null;function EH(t,e=or){const n=[...this.resolvedElements],r=$v(e)(t.isDescedants===!0?this.graph.childrenOrElement(t.element):[this.graph.element(t.element)]);if(r.length!==0&&(this.addElement(...r),r.length>1&&this.addEdges(this.graph.edgesWithin(r)),n.length>0&&r.length>0))for(const i of r)this.addEdges(this.graph.anyEdgesBetween(i,n))}function RH(t,e=or){const n=[...this.resolvedElements].filter(tC([yn(t),e]));this.excludeElement(...n)}function SH(t,e=or){const n=this.root;if(!n){const l=this.graph.rootElements.filter(e);if(l.length<=0)return;const u=[...this.resolvedElements];if(this.addElement(...l),this.addEdges(this.graph.edgesWithin(l)),u.length>0)for(const d of l)this.addEdges(this.graph.anyEdgesBetween(d,u));return}const r=[...this.resolvedElements],i=TH(e)(this.graph.element(n));i&&this.addElement(i);const s=$v(e),o=s(this.graph.children(n)),a=o.length>0;a?(this.addElement(...o),this.addEdges(this.graph.edgesWithin(o))):i&&o.push(i);const c=[...r,...s([...this.graph.siblings(n),...this.graph.ancestors(n).flatMap(l=>this.graph.siblings(l.id))])];for(const l of o)this.addEdges(this.graph.anyEdgesBetween(l,c));if(!a&&i&&this.graph.anyEdgesBetween(i,this.graph.siblings(n)).length===0){const l=Et(n),u=l&&this.graph.element(l);u&&e(u)&&this.addElement(u)}}function $H(t,e=or){if(e!==or){const r=[...this.resolvedElements].filter(e);this.excludeElement(...r);return}const n=this.root;n?(this.excludeElement(this.graph.element(n),...this.graph.children(n)),this.excludeRelation(...this.graph.connectedRelations(n))):this.reset()}function kH(t,e=or){const n=$v(e),r=[...this.resolvedElements],i=this.graph.element(t.expanded);if(e(i)){this.addElement(i);const o=this.graph.anyEdgesBetween(i,r);this.addEdges(o)}const s=[];for(const o of n(this.graph.children(t.expanded))){this.addImplicit(o);const a=this.graph.anyEdgesBetween(o,r);a.length>0&&(this.addEdges(a),s.push(o))}s.length>1&&this.addEdges(this.graph.edgesWithin(s))}function _H(t,e=or){const n=[...this.resolvedElements].filter(tC([yn(t),e]));this.excludeElement(...n)}const qC=t=>t.isEqual?ie.isElementKindExpr(t)?e=>e.kind===t.elementKind:({tags:e})=>!!e&&e.includes(t.elementTag):ie.isElementKindExpr(t)?e=>e.kind!==t.elementKind:({tags:e})=>$t(e)||e.length===0||!e.includes(t.elementTag);function CH(t,e=or){const n=this.graph.elements.filter(qC(t)).filter(e);if(n.length>0){const r=[...this.resolvedElements];this.addElement(...n),this.addEdges(this.graph.edgesWithin(n));for(const i of n)this.addEdges(this.graph.anyEdgesBetween(i,r))}}function AH(t,e=or){const n=[...this.resolvedElements].filter(qC(t)).filter(e);n.length>0&&this.excludeElement(...n)}function ol(t){return ie.isElementRef(t)?this.graph.ascendingSiblings(t.element):this.root?this.graph.ascendingSiblings(this.root):this.graph.rootElements}function oh(t){return ie.isWildcard(t)?this.root?[...this.graph.children(this.root),this.graph.element(this.root)]:this.graph.rootElements:ie.isElementKindExpr(t)?this.graph.elements.filter(e=>t.isEqual?e.kind===t.elementKind:e.kind!==t.elementKind):ie.isElementTagExpr(t)?this.graph.elements.filter(e=>{const n=e.tags;return t.isEqual?!!n&&n.includes(t.elementTag):$t(n)||n.length===0||!n.includes(t.elementTag)}):ie.isExpandedElementExpr(t)?[this.graph.element(t.expanded)]:ie.isElementRef(t)?this.root===t.element&&t.isDescedants!==!0?[...this.graph.children(this.root),this.graph.element(this.root)]:t.isDescedants?this.graph.childrenOrElement(t.element):[this.graph.element(t.element)]:Se(t)}function WC(t){if(ie.isWildcard(t)){if(!this.root)return[];const r=this.graph.ascendingSiblings(this.root),i=[...this.graph.children(this.root),this.graph.element(this.root)];return this.graph.edgesBetween(r,i)}const e=oh.call(this,t);if(e.length===0)return[];let n=[...this.resolvedElements];if(ie.isElementRef(t)||ie.isExpandedElementExpr(t)){const r=t.element??t.expanded,i=t.isDescedants??!1;n=n.filter(s=>!gr(r,s.id)||i&&Et(s.id)===r)}return n.length===0&&(n=ol.call(this,t)),this.graph.edgesBetween(n,e)}const al=(t,e)=>e?We(t,st(n=>({...n,relations:n.relations.filter(e)})),He(n=>n.relations.length>0)):t,kv=(t,e)=>We(t,Xi(n=>n.relations),e?He(e):Sv,Ar());function IH(t,e){const n=al(WC.call(this,t.incoming),e);n.length!==0&&(this.addEdges(n),this.addImplicit(...n.map(r=>r.target)))}function xH(t,e){let n=kv(WC.call(this,t.incoming),e);this.excludeRelation(...n)}function GC(t){if(ie.isWildcard(t)){if(!this.root)return[];const r=this.graph.ascendingSiblings(this.root),i=[...this.graph.children(this.root),this.graph.element(this.root)];return this.graph.edgesBetween(i,r)}const e=oh.call(this,t);if(e.length===0)return[];let n=[...this.resolvedElements];if(ie.isElementRef(t)||ie.isExpandedElementExpr(t)){const r=t.element??t.expanded,i=t.isDescedants??!1;n=n.filter(s=>!gr(r,s.id)||i&&Et(s.id)===r)}return n.length===0&&(n=ol.call(this,t)),this.graph.edgesBetween(e,n)}function PH(t,e){const n=al(GC.call(this,t.outgoing),e);n.length!==0&&(this.addEdges(n),this.addImplicit(...n.map(r=>r.source)))}function NH(t,e){const n=kv(GC.call(this,t.outgoing),e);this.excludeRelation(...n)}var ah;(t=>{t.Empty={implicits:[],edges:[]}})(ah||(ah={}));function zC({inout:t},e){if(ie.isWildcard(t)){if(!this.root)return ah.Empty;const i=this.graph.ascendingSiblings(this.root);return{edges:al(this.graph.anyEdgesBetween(this.graph.element(this.root),i),e),implicits:[]}}const n=oh.call(this,t);if(n.length===0)return ah.Empty;let r=[...this.resolvedElements];if(ie.isElementRef(t)||ie.isExpandedElementExpr(t)){const i=t.element??t.expanded,s=t.isDescedants??!1;r=r.filter(o=>!gr(i,o.id)||s&&Et(o.id)===i)}return r.length===0&&(r=ol.call(this,t)),n.reduce((i,s)=>{const o=al(this.graph.anyEdgesBetween(s,r),e);return o.length>0&&(i.implicits.push(s),i.edges.push(...o)),i},{implicits:[],edges:[]})}function DH(t,e){const{implicits:n,edges:r}=zC.call(this,t,e);this.addEdges(r),this.addImplicit(...n)}function OH(t,e){const{edges:n}=zC.call(this,t,e);this.excludeRelation(...n.flatMap(r=>r.relations))}function ch(t){return ie.isElementRef(t)&&this.root===t.element&&t.isDescedants!==!0?[...this.graph.children(t.element),this.graph.element(t.element)]:ie.isExpandedElementExpr(t)&&this.root===t.expanded?[...this.graph.children(t.expanded),this.graph.element(t.expanded)]:oh.call(this,t)}function LH(t,e){let n,r;ie.isWildcard(t.source)&&!ie.isWildcard(t.target)?(n=ol.call(this,t.target),r=ch.call(this,t.target)):!ie.isWildcard(t.source)&&ie.isWildcard(t.target)?(n=ch.call(this,t.source),r=ol.call(this,t.source)):(n=ch.call(this,t.source),r=ch.call(this,t.target));const i=this.graph.edgesBetween(n,r);t.isBidirectional===!0&&i.push(...this.graph.edgesBetween(r,n)),this.addEdges(al(i,e))}function MH(t,e){const n=yn(t.source),r=yn(t.target),i=a=>{let c=n(a.source)&&r(a.target);return!c&&t.isBidirectional&&(c=n(a.target)&&r(a.source)),c},s=this.edges.filter(i),o=kv(s,e);this.excludeRelation(...o)}function FH(t,e){return La({source:t.source.id,target:t.target.id},{source:e.source.id,target:e.target.id})}let jH=class SN{constructor(e,n){this.view=e,this.graph=n}explicits=new Set;implicits=new Set;ctxEdges=[];static elementView(e,n){return new SN(e,n).compute()}compute(){this.reset();const{docUri:e,rules:n,...r}=this.view,i=n.filter(vD);this.root&&i.length==0&&this.addElement(this.graph.element(this.root)),this.processPredicates(i),this.removeRedundantImplicitEdges();const s=[...this.includedElements],o=jC(s),a=new Map,c=this.computeEdges();for(const p of c){a.set(p.id,p);const y=o.get(p.source),R=o.get(p.target);for(ce(y,`Source node ${p.source} not found`),ce(R,`Target node ${p.target} not found`);p.parent&&!o.has(p.parent);)p.parent=Et(p.parent);y.outEdges.push(p.id),R.inEdges.push(p.id);for(const b of Xn(p.source)){if(b===p.parent)break;o.get(b)?.outEdges.push(p.id)}for(const b of Xn(p.target)){if(b===p.parent)break;o.get(b)?.inEdges.push(p.id)}}const l=s.flatMap(p=>o.get(p.id)??[]),u=LC(n,FC(n,wH({nodes:l,edges:c}))),d=new Set([...u.flatMap(p=>p.children.length===0?p.outEdges.flatMap(y=>a.get(y)??[]):[]),...c]),f=this.view.rules.findLast(f0),h=UC(u);return OC({...r,autoLayout:f?.autoLayout??"TB",nodes:st(u,Y_(["notation"])),edges:pH(n,u,d),...h.length>0&&{notation:{elements:h}}})}get root(){return p0(this.view)?this.view.viewOf:null}computeEdges(){return this.ctxEdges.map(e=>{ce(Ir(e.relations,1),"Edge must have at least one relation");const n=Zc(e.relations,La),r=e.source.id,i=e.target.id,s={id:`${r}:${i}`,parent:_s(r,i),source:r,target:i,label:null,relations:n.map(c=>c.id)};let o;if(o=mn(n)??We(n,He(c=>c.source===r&&c.target===i),mn()),!o){const c=We(n,z_((l,u)=>(Q(u.title)&&!l.title.includes(u.title)&&l.title.push(u.title),Q(u.description)&&!l.description.includes(u.description)&&l.description.push(u.description),Q(u.technology)&&!l.technology.includes(u.technology)&&l.technology.push(u.technology),Q(u.kind)&&!l.kind.includes(u.kind)&&l.kind.push(u.kind),Q(u.color)&&!l.color.includes(u.color)&&l.color.push(u.color),Q(u.line)&&!l.line.includes(u.line)&&l.line.push(u.line),Q(u.head)&&!l.head.includes(u.head)&&l.head.push(u.head),Q(u.tail)&&!l.tail.includes(u.tail)&&l.tail.push(u.tail),Q(u.navigateTo)&&!l.navigateTo.includes(u.navigateTo)&&l.navigateTo.push(u.navigateTo),l),{title:[],description:[],technology:[],kind:[],head:[],tail:[],color:[],line:[],navigateTo:[]}));o={title:mn(c.title)??"[...]",description:mn(c.description),technology:mn(c.technology),kind:mn(c.kind),head:mn(c.head),tail:mn(c.tail),color:mn(c.color),line:mn(c.line),navigateTo:mn(c.navigateTo)}}const a=bH(n);return Object.assign(s,this.getEdgeLabel(o),Q(o.description)&&{description:o.description},Q(o.technology)&&{technology:o.technology},Q(o.kind)&&{kind:o.kind},o.color&&{color:o.color},o.line&&{line:o.line},o.head&&{head:o.head},o.tail&&{tail:o.tail},o.navigateTo&&{navigateTo:o.navigateTo},a&&{tags:a})})}get includedElements(){return new Set([...this.explicits,...this.ctxEdges.flatMap(e=>[e.source,e.target])])}get resolvedElements(){return new Set([...this.explicits,...this.implicits,...this.ctxEdges.flatMap(e=>[e.source,e.target])])}get edges(){return this.ctxEdges}addEdges(e){for(const n of e){if(!Ir(n.relations,1))continue;const r=this.ctxEdges.find(i=>i.source.id===n.source.id&&i.target.id===n.target.id);if(r){r.relations=Ar([...r.relations,...n.relations]);continue}this.ctxEdges.push(n)}}addElement(...e){for(const n of e)this.explicits.add(n),this.implicits.add(n)}addImplicit(...e){for(const n of e)this.implicits.add(n)}excludeElement(...e){for(const n of e)this.ctxEdges=this.ctxEdges.filter(r=>r.source.id!==n.id&&r.target.id!==n.id),this.explicits.delete(n),this.implicits.delete(n)}excludeRelation(...e){if(e.length===0)return;const n=new Set,r=We(this.ctxEdges,st(s=>{const o=s.relations.filter(a=>!e.includes(a));return o.length===0?(n.add(s.source),n.add(s.target),null):o.length!==s.relations.length?{...s,relations:o}:s}),He(yG));if(n.size===0)return;this.ctxEdges=r;const i=this.includedElements;if(i.size===0){this.implicits.clear();return}for(const s of n)i.has(s)||this.implicits.delete(s)}reset(){this.explicits.clear(),this.implicits.clear(),this.ctxEdges=[]}removeRedundantImplicitEdges(){const e=new Set,n=s=>s.reduce((o,a)=>(e.has(a)||(o.push(a),e.add(a)),o),[]),r=s=>{const{source:o,target:a}=s;return c=>{const l=o.id===c.source.id,u=a.id===c.target.id;if(l&&u)return!0;const d=gr(o.id,c.source.id),f=gr(a.id,c.target.id);return d&&f||l&&f||u&&d}},i=[...this.ctxEdges].sort(FH).reverse();this.ctxEdges=i.reduce((s,o)=>{const a=n(o.relations);return a.length===0||s.length>0&&s.some(r(o))||s.push({source:o.source,target:o.target,relations:a}),s},[])}processPredicates(e){for(const n of e){const r="include"in n,i=n.include??n.exclude;for(const s of i){if(ie.isElementPredicateExpr(s)){this.processElementPredicate(s,r);continue}if(ie.isRelationPredicateExpr(s)){this.processRelationPredicate(s,r);continue}Se(s)}}return this}processElementPredicate(e,n,r){if(ie.isCustomElement(e))return n&&this.processElementPredicate(e.custom.expr,n),this;if(ie.isElementWhere(e)){const i=lo(e.where.condition);return this.processElementPredicate(e.where.expr,n,i),this}if(ie.isExpandedElementExpr(e))return n?kH.call(this,e,r):_H.call(this,e,r),this;if(ie.isElementKindExpr(e)||ie.isElementTagExpr(e))return n?CH.call(this,e,r):AH.call(this,e,r),this;if(ie.isElementRef(e))return n?EH.call(this,e,r):RH.call(this,e,r),this;if(ie.isWildcard(e))return n?SH.call(this,e,r):$H.call(this,e,r),this;Se(e)}processRelationPredicate(e,n,r){if(ie.isCustomRelationExpr(e))return n&&this.processRelationPredicate(e.customRelation.relation,n),this;if(ie.isRelationWhere(e)){const i=lo(e.where.condition);return this.processRelationPredicate(e.where.expr,n,i),this}if(ie.isIncoming(e))return n?IH.call(this,e,r):xH.call(this,e,r),this;if(ie.isOutgoing(e))return n?PH.call(this,e,r):NH.call(this,e,r),this;if(ie.isInOut(e))return n?DH.call(this,e,r):OH.call(this,e,r),this;if(ie.isRelation(e))return n?LH.call(this,e,r):MH.call(this,e,r),this;Se(e)}getEdgeLabel(e){const n=[];return Q(e.title)&&n.push(e.title),Q(e.technology)&&n.push(`[${e.technology}]`),n.length>0?{label:n.join(`
1129
+ `)}:{}}};function UH(t,e){return jH.elementView(t,e)}function HC(t,e){try{return{isSuccess:!0,view:UH(t,e)}}catch(n){return{isSuccess:!1,error:n instanceof Error?n:new Error(`Unknown error: ${n}`),view:void 0}}}let BH=class $N{constructor(e,n){this.view=e,this.graph=n}explicits=new Set;steps=[];static compute(e,n){return new $N(e,n).compute()}addStep({source:e,target:n,title:r,isBackward:i,navigateTo:s,...o},a,c){const l=c?g0(c,a):g0(a),u=this.graph.element(e),d=this.graph.element(n);this.explicits.add(u),this.explicits.add(d);const{title:f,relations:h,tags:p,navigateTo:y}=this.findRelations(u,d),R=Q(s)&&s!==this.view.id?s:y;this.steps.push({id:l,...o,source:u,target:d,title:r??f,relations:h??[],isBackward:i??!1,...R?{navigateTo:R}:{},...p?{tags:p}:{}})}compute(){const{docUri:e,rules:n,steps:r,...i}=this.view;let s=1;for(const f of r){if(TD(f)){if(f.__parallel.length===0)continue;f.__parallel.length===1?this.addStep(f.__parallel[0],s):f.__parallel.forEach((h,p)=>this.addStep(h,p+1,s))}else this.addStep(f,s);s++}for(const f of n)if(bD(f))for(const h of f.include){const p=yn(h);this.graph.elements.filter(p).forEach(y=>this.explicits.add(y))}const o=[...this.explicits],a=jC(o),c=this.steps.map(({source:f,target:h,relations:p,title:y,isBackward:R,...b})=>{const v=at(a.get(f.id),`Source node ${f.id} not found`),T=at(a.get(h.id),`Target node ${h.id} not found`),_={parent:_s(f.id,h.id),source:f.id,target:h.id,label:y,relations:p,color:fo,line:u0,head:uo,...b};for(R&&(_.dir="back");_.parent&&!a.has(_.parent);)_.parent=Et(_.parent);v.outEdges.push(_.id),T.inEdges.push(_.id);for(const N of Xn(_.source)){if(N===_.parent)break;a.get(N)?.outEdges.push(_.id)}for(const N of Xn(_.target)){if(N===_.parent)break;a.get(N)?.inEdges.push(_.id)}return _}),l=LC(n,FC(n,o.map(f=>at(a.get(f.id))))),u=n.findLast(f0),d=UC(l);return OC({...i,autoLayout:u?.autoLayout??"LR",nodes:st(l,Y_(["notation"])),edges:c,...d.length>0&&{notation:{elements:d}}})}findRelations(e,n){const r=Ar(this.graph.edgesBetween(e,n).flatMap(u=>u.relations));if(r.length===0)return{title:null,tags:null,relations:null,navigateTo:null};const i=We(r,Xi(u=>u.tags),He(Q),Ar()),s=Ir(i,1)?i:null,o=Ir(r,1)?st(r,u=>u.id):null,a=mn(r)||r.find(u=>u.source===e.id&&u.target===n.id),c=Q(a?.title)?a.title:We(r,st(u=>u.title),He(Q),Ar(),mn()),l=a?.navigateTo&&a.navigateTo!==this.view.id?a.navigateTo:We(r,st(u=>u.navigateTo),He(Q),He(u=>u!==this.view.id),Ar(),mn());return{title:c??null,tags:s,relations:o,navigateTo:l??null}}};function KC(t,e){try{return{isSuccess:!0,view:BH.compute(t,e)}}catch(n){return{isSuccess:!1,error:n instanceof Error?n:new Error(`Unknown error: ${n}`),view:void 0}}}const _v=Set,Cv=Map;function Av(t,e){return t.size===0||e.size===0?new Set:new Set([...t].filter(n=>e.has(n)))}let VC=class{#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=new Map;#s=new Cv;#o=new Cv;#a=new Cv;#c=new Map;constructor({elements:e,relations:n}){for(const r of Object.values(e))this.addElement(r);for(const r of Object.values(n))this.addRelation(r)}get rootElements(){return[...this.#r]}get elements(){return[...this.#e.values()]}element(e){const n=this.#e.get(e);return ce(n,`Element ${e} not found`),n}connectedRelations(e){return[...this._incomingTo(e),...this._outgoingFrom(e),...this._internalOf(e)]}children(e){return this._childrenOf(e).slice()}childrenOrElement(e){const n=this.children(e);return n.length>0?n:[this.element(e)]}siblings(e){const n=Vi(e)?e:e.id,r=Et(n);return(r?this._childrenOf(r):this.rootElements).filter(i=>i.id!==n)}ancestors(e){let n=Vi(e)?e:e.id;const r=[];let i;for(;i=this.#t.get(n);)r.push(i),n=i.id;return r}ascendingSiblings(e){const n=Vi(e)?e:e.id;let r=this.#c.get(n);return r||(r=[...this.siblings(n),...this.ancestors(n).flatMap(i=>this.siblings(i.id))],this.#c.set(n,r)),r.slice()}anyEdgesBetween(e,n){if(n.length===0)return[];const r=Vi(e)?this.element(e):e,i=this._incomingTo(r.id),s=this._outgoingFrom(r.id);if(i.size===0&&s.size===0)return[];const o=[];for(const a of n){const c=Vi(a)?this.element(a):a;if(!Vu(r,c)){if(s.size>0){const l=Av(this._incomingTo(c.id),s);l.size>0&&o.push({source:r,target:c,relations:[...l]})}if(i.size>0){const l=Av(this._outgoingFrom(c.id),i);l.size>0&&o.push({source:c,target:r,relations:[...l]})}}}return o}edgesWithin(e){return e.length<2?[]:e.reduce((n,r,i,s)=>(i===s.length-1||n.push(...this.anyEdgesBetween(r,s.slice(i+1))),n),[])}edgesBetween(e,n){const r=J_(e)?e:[e],i=J_(n)?n:[n];if(r.length===0||i.length===0)return[];const s=[];for(const o of r){const a=Vi(o)?this.element(o):o,c=this._outgoingFrom(a.id);if(c.size!==0)for(const l of i){const u=Vi(l)?this.element(l):l;if(Vu(a,u))continue;const d=this._incomingTo(u.id),f=Av(c,d);f.size>0&&s.push({source:a,target:u,relations:[...f]})}}return s}addElement(e){if(this.#e.has(e.id))throw new Error(`Element ${e.id} already exists`);this.#e.set(e.id,e);const n=Et(e.id);n?(this.#t.set(e.id,this.element(n)),this._childrenOf(n).push(e)):this.#r.add(e)}addRelation(e){if(this.#i.has(e.id))throw new Error(`Relation ${e.id} already exists`);this.#i.set(e.id,e),this._incomingTo(e.target).add(e),this._outgoingFrom(e.source).add(e);const n=_s(e.source,e.target);if(n)for(const r of[n,...Xn(n)])this._internalOf(r).add(e);for(const r of Xn(e.source)){if(r===n)break;this._outgoingFrom(r).add(e)}for(const r of Xn(e.target)){if(r===n)break;this._incomingTo(r).add(e)}}_childrenOf(e){let n=this.#n.get(e);return n||(n=[],this.#n.set(e,n)),n}_incomingTo(e){let n=this.#s.get(e);return n||(n=new _v,this.#s.set(e,n)),n}_outgoingFrom(e){let n=this.#o.get(e);return n||(n=new _v,this.#o.set(e,n)),n}_internalOf(e){let n=this.#a.get(e);return n||(n=new _v,this.#a.set(e,n)),n}};const qH=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,WH=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,GH=/^([/\\]\s*){2,}[^/\\]/;function YC(t){return["./","../"].some(e=>t.startsWith(e))}function Iv(t,e={}){return typeof e=="boolean"&&(e={acceptRelative:e}),e.strict?qH.test(t):WH.test(t)||(e.acceptRelative?GH.test(t):!1)}function zH(t="",e){return t.endsWith("/")}function HH(t="",e){return(zH(t)?t.slice(0,-1):t)||"/"}function KH(t="",e){return t.endsWith("/")?t:t+"/"}function lh(t=""){return t.startsWith("/")}function XC(t=""){return(lh(t)?t.slice(1):t)||"/"}function VH(t=""){return lh(t)?t:"/"+t}function YH(t,e){if(XH(e))return t;const n=HH(e);if(!t.startsWith(n))return t;const r=t.slice(n.length);return r[0]==="/"?r:"/"+r}function XH(t){return!t||t==="/"}function uh(t=""){const[e="",n="",r=""]=(t.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:e,search:n,hash:r}}const Re=Fe.withTag("lsp");function Gt(t){Re.error(t)}function yt(t){if(t instanceof Error){Re.warn(t.stack??t.message);return}Re.warn(t)}function JH(t){Re.level=Je[t]}function QH(t){const e={log:({level:n,...r},i)=>{if(n!==Je.error&&n!==Je.fatal)return;const s=r.tag||"",o=r.args.map(c=>c&&typeof c.stack=="string"?c.message+`
1130
+ `+c.stack:typeof c=="string"?c:String(c));s&&o.unshift(`[${s}]`);const a=o.join(" ");t.telemetry.logEvent({eventName:"error",error:a})}};Fe.addReporter(e),Re.setReporters(Fe.options.reporters)}function ZH(t){const e={log:({level:n,...r},i)=>{const s=r.tag||"",o=r.args.map(c=>c&&typeof c.stack=="string"?c.message+`
1131
+ `+c.stack:typeof c=="string"?c:String(c));s&&o.unshift(`[${s}]`);const a=o.join(" ");switch(!0){case n>=Je.trace:{t.tracer.log(a);break}case n>=Je.debug:{t.console.debug(a);break}case n>=Je.info:{t.console.info(a);break}case n>=Je.log:{t.console.log(a);break}case n>=Je.warn:{t.console.warn(a);break}case n>=Je.fatal:{t.console.error(a);break}}}};Fe.addReporter(e),Re.setReporters(Fe.options.reporters)}const dh="DynamicViewRule";function xv(t){return K.isInstance(t,dh)}const fh="ElementExpression";function Pv(t){return K.isInstance(t,fh)}const hh="ElementPredicate";function e7(t){return K.isInstance(t,hh)}const ph="ElementPredicateOrWhere";function t7(t){return K.isInstance(t,ph)}const zs="ElementProperty";function n7(t){return K.isInstance(t,zs)}const Hs="LikeC4View";function Nv(t){return K.isInstance(t,Hs)}const gh="MetadataProperty";function JC(t){return K.isInstance(t,gh)}const QC="Predicate",mh="RelationExpression";function Dv(t){return K.isInstance(t,mh)}const yh="RelationPredicate";function r7(t){return K.isInstance(t,yh)}const vh="RelationPredicateOrWhere";function i7(t){return K.isInstance(t,vh)}const sa="RelationProperty";function s7(t){return K.isInstance(t,sa)}const wh="RelationshipStyleProperty";function o7(t){return K.isInstance(t,wh)}const oa="StringProperty";function a7(t){return K.isInstance(t,oa)}const cl="StyleProperty";function Ov(t){return K.isInstance(t,cl)}const bh="ViewProperty";function c7(t){return K.isInstance(t,bh)}const Th="ViewRule";function l7(t){return K.isInstance(t,Th)}const Eh="ViewRulePredicate";function Lv(t){return K.isInstance(t,Eh)}const ll="WhereElement";function ZC(t){return K.isInstance(t,ll)}const ul="WhereElementExpression";function u7(t){return K.isInstance(t,ul)}const eA="WhereExpression",Rh="WhereKindEqual";function d7(t){return K.isInstance(t,Rh)}const dl="WhereRelation";function tA(t){return K.isInstance(t,dl)}const fl="WhereRelationExpression";function f7(t){return K.isInstance(t,fl)}const Sh="WhereTagEqual";function h7(t){return K.isInstance(t,Sh)}const hl="ArrowProperty";function pl(t){return K.isInstance(t,hl)}const gl="BorderProperty";function $h(t){return K.isInstance(t,gl)}const ml="ColorProperty";function Ks(t){return K.isInstance(t,ml)}const Vs="CustomColor",kh="CustomElementProperties";function p7(t){return K.isInstance(t,kh)}const _h="CustomRelationProperties";function g7(t){return K.isInstance(t,_h)}const yl="DirectedRelationExpression";function Mv(t){return K.isInstance(t,yl)}const aa="DynamicView";function m7(t){return K.isInstance(t,aa)}const Ch="DynamicViewBody";function nA(t){return K.isInstance(t,Ch)}const vl="DynamicViewIncludePredicate";function y7(t){return K.isInstance(t,vl)}const Ah="DynamicViewParallelSteps";function rA(t){return K.isInstance(t,Ah)}const Ih="DynamicViewPredicateIterator";function iA(t){return K.isInstance(t,Ih)}const Fv="DynamicViewRef",xh="DynamicViewStep";function jv(t){return K.isInstance(t,xh)}const Nr="Element";function Dr(t){return K.isInstance(t,Nr)}const Ph="ElementBody";function ca(t){return K.isInstance(t,Ph)}const wl="ElementDescedantsExpression";function Uv(t){return K.isInstance(t,wl)}const Nh="ElementExpressionsIterator";function v7(t){return K.isInstance(t,Nh)}const Qi="ElementKind";function w7(t){return K.isInstance(t,Qi)}const bl="ElementKindExpression";function Dh(t){return K.isInstance(t,bl)}const Tl="ElementPredicateWhere";function Bv(t){return K.isInstance(t,Tl)}const El="ElementPredicateWith";function Oh(t){return K.isInstance(t,El)}const Rl="ElementRef";function Sl(t){return K.isInstance(t,Rl)}const $l="ElementStringProperty";function qv(t){return K.isInstance(t,$l)}const kl="ElementStyleProperty";function _l(t){return K.isInstance(t,kl)}const Cl="ElementTagExpression";function Lh(t){return K.isInstance(t,Cl)}const la="ElementView";function Mh(t){return K.isInstance(t,la)}const Fh="ElementViewBody";function Wv(t){return K.isInstance(t,Fh)}const Gv="ElementViewRef",Al="ExcludePredicate";function jh(t){return K.isInstance(t,Al)}const Il="ExpandElementExpression";function sA(t){return K.isInstance(t,Il)}const ua="ExtendElement";function da(t){return K.isInstance(t,ua)}const Uh="ExtendElementBody";function zv(t){return K.isInstance(t,Uh)}const Bh="FqnElementRef";function oA(t){return K.isInstance(t,Bh)}const xl="IconProperty";function Zi(t){return K.isInstance(t,xl)}const Pl="IncludePredicate";function Hv(t){return K.isInstance(t,Pl)}const Nl="IncomingRelationExpression";function aA(t){return K.isInstance(t,Nl)}const Dl="InOutRelationExpression";function Kv(t){return K.isInstance(t,Dl)}const Ys="LibIcon";function b7(t){return K.isInstance(t,Ys)}const Vv="LikeC4Grammar",qh="LikeC4Lib";function cA(t){return K.isInstance(t,qh)}const Ol="LineProperty";function Ll(t){return K.isInstance(t,Ol)}const Ml="LinkProperty";function Wh(t){return K.isInstance(t,Ml)}const Fl="MetadataAttribute";function T7(t){return K.isInstance(t,Fl)}const jl="MetadataBody";function E7(t){return K.isInstance(t,jl)}const fa="Model";function Yv(t){return K.isInstance(t,fa)}const ha="ModelViews";function Xv(t){return K.isInstance(t,ha)}const Gh="NavigateToProperty";function Jv(t){return K.isInstance(t,Gh)}const Ul="NotationProperty";function pa(t){return K.isInstance(t,Ul)}const Bl="NotesProperty";function lA(t){return K.isInstance(t,Bl)}const ql="OpacityProperty";function zh(t){return K.isInstance(t,ql)}const Wl="OutgoingRelationExpression";function Qv(t){return K.isInstance(t,Wl)}const Hh="Predicates";function uA(t){return K.isInstance(t,Hh)}const Kh="Relation";function es(t){return K.isInstance(t,Kh)}const Vh="RelationBody";function dA(t){return K.isInstance(t,Vh)}const Gl="RelationNavigateToProperty";function Yh(t){return K.isInstance(t,Gl)}const zl="RelationPredicateWhere";function fA(t){return K.isInstance(t,zl)}const Hl="RelationPredicateWith";function Zv(t){return K.isInstance(t,Hl)}const ts="RelationshipKind";function R7(t){return K.isInstance(t,ts)}const Kl="RelationStringProperty";function Xh(t){return K.isInstance(t,Kl)}const Vl="RelationStyleProperty";function ew(t){return K.isInstance(t,Vl)}const Yl="ShapeProperty";function Jh(t){return K.isInstance(t,Yl)}const Qh="SpecificationColor";function Zh(t){return K.isInstance(t,Qh)}const ga="SpecificationElementKind";function ma(t){return K.isInstance(t,ga)}const Xl="SpecificationElementStringProperty";function hA(t){return K.isInstance(t,Xl)}const ya="SpecificationRelationshipKind";function va(t){return K.isInstance(t,ya)}const Jl="SpecificationRelationshipStringProperty";function pA(t){return K.isInstance(t,Jl)}const wa="SpecificationRule";function tw(t){return K.isInstance(t,wa)}const ba="SpecificationTag";function ep(t){return K.isInstance(t,ba)}const ns="Tag";function gA(t){return K.isInstance(t,ns)}const tp="Tags";function nw(t){return K.isInstance(t,tp)}const rw="ViewRef",Ql="ViewRuleAutoLayout";function np(t){return K.isInstance(t,Ql)}const Zl="ViewRuleStyle";function Ta(t){return K.isInstance(t,Zl)}const eu="ViewStringProperty";function S7(t){return K.isInstance(t,eu)}const tu="WhereBinaryExpression";function $7(t){return K.isInstance(t,tu)}const nu="WhereElementKind";function k7(t){return K.isInstance(t,nu)}const ru="WhereElementNegation";function mA(t){return K.isInstance(t,ru)}const iu="WhereElementTag";function _7(t){return K.isInstance(t,iu)}const su="WhereRelationKind";function yA(t){return K.isInstance(t,su)}const ou="WhereRelationNegation";function vA(t){return K.isInstance(t,ou)}const au="WhereRelationTag";function C7(t){return K.isInstance(t,au)}const cu="WildcardExpression";function Ea(t){return K.isInstance(t,cu)}class wA extends TT{getAllTypes(){return[hl,gl,ml,Vs,kh,_h,yl,aa,Ch,vl,Ah,Ih,Fv,dh,xh,Nr,Ph,wl,fh,Nh,Qi,bl,hh,ph,Tl,El,zs,Rl,$l,kl,Cl,la,Fh,Gv,Al,Il,ua,Uh,Bh,xl,Dl,Pl,Nl,Ys,Vv,qh,Hs,Ol,Ml,Fl,jl,gh,fa,ha,Gh,Ul,Bl,ql,Wl,QC,Hh,Kh,Vh,mh,Gl,yh,vh,zl,Hl,sa,Kl,Vl,ts,wh,Yl,Qh,ga,Xl,ya,Jl,wa,ba,oa,cl,ns,tp,bh,rw,Th,Ql,Eh,Zl,eu,tu,ll,ul,nu,ru,iu,eA,Rh,dl,fl,su,ou,au,Sh,cu]}computeIsSubtype(e,n){switch(e){case hl:case Ol:return this.isSubtype(wh,n);case gl:case ql:case Yl:return this.isSubtype(cl,n);case ml:return this.isSubtype(wh,n)||this.isSubtype(cl,n);case yl:case Nl:case Dl:case Wl:return this.isSubtype(mh,n);case aa:case la:return this.isSubtype(Hs,n);case vl:return this.isSubtype(dh,n);case wl:case bl:case Rl:case Cl:case Il:case cu:return this.isSubtype(fh,n);case fh:case Tl:return this.isSubtype(ph,n);case hh:case yh:return this.isSubtype(QC,n);case ph:case El:return this.isSubtype(hh,n);case $l:return this.isSubtype(zs,n)||this.isSubtype(oa,n);case kl:return this.isSubtype(zs,n);case Al:case Pl:return this.isSubtype(Eh,n);case xl:return this.isSubtype(zs,n)||this.isSubtype(cl,n);case Ml:return this.isSubtype(zs,n)||this.isSubtype(sa,n)||this.isSubtype(bh,n);case Fl:case Ul:case Bl:case Xl:case Jl:return this.isSubtype(oa,n);case jl:return this.isSubtype(gh,n);case gh:return this.isSubtype(zs,n)||this.isSubtype(sa,n);case mh:case zl:return this.isSubtype(vh,n);case Gl:case Vl:return this.isSubtype(sa,n);case vh:case Hl:return this.isSubtype(yh,n);case Kl:return this.isSubtype(sa,n)||this.isSubtype(oa,n);case Ql:case Zl:return this.isSubtype(dh,n)||this.isSubtype(Th,n);case Eh:return this.isSubtype(Th,n);case eu:return this.isSubtype(oa,n)||this.isSubtype(bh,n);case tu:return this.isSubtype(ul,n)||this.isSubtype(fl,n);case ll:case ru:return this.isSubtype(ul,n);case ul:case fl:return this.isSubtype(eA,n);case nu:return this.isSubtype(ll,n)||this.isSubtype(Rh,n);case iu:return this.isSubtype(ll,n)||this.isSubtype(Sh,n);case dl:case ou:return this.isSubtype(fl,n);case su:return this.isSubtype(Rh,n)||this.isSubtype(dl,n);case au:return this.isSubtype(dl,n)||this.isSubtype(Sh,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"ColorProperty:customColor":return Vs;case"DynamicViewRef:view":return aa;case"DynamicViewStep:kind":case"OutgoingRelationExpression:kind":case"Relation:kind":case"WhereRelationKind:value":return ts;case"Element:kind":case"ElementKindExpression:kind":case"WhereElementKind:value":return Qi;case"ElementRef:el":case"FqnElementRef:el":return Nr;case"ElementTagExpression:tag":case"Tags:values":case"WhereElementTag:value":case"WhereRelationTag:value":return ns;case"ElementViewRef:view":return la;case"IconProperty:libicon":return Ys;case"ViewRef:view":return Hs;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case hl:return{name:hl,properties:[{name:"key"},{name:"value"}]};case gl:return{name:gl,properties:[{name:"key"},{name:"value"}]};case ml:return{name:ml,properties:[{name:"customColor"},{name:"key"},{name:"themeColor"}]};case Vs:return{name:Vs,properties:[{name:"name"}]};case kh:return{name:kh,properties:[{name:"props",defaultValue:[]}]};case _h:return{name:_h,properties:[{name:"props",defaultValue:[]}]};case yl:return{name:yl,properties:[{name:"source"},{name:"target"}]};case aa:return{name:aa,properties:[{name:"body"},{name:"name"}]};case Ch:return{name:Ch,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"steps",defaultValue:[]},{name:"tags"}]};case vl:return{name:vl,properties:[{name:"predicates"}]};case Ah:return{name:Ah,properties:[{name:"steps",defaultValue:[]}]};case Ih:return{name:Ih,properties:[{name:"prev"},{name:"value"}]};case Fv:return{name:Fv,properties:[{name:"view"}]};case xh:return{name:xh,properties:[{name:"custom"},{name:"isBackward",defaultValue:!1},{name:"kind"},{name:"source"},{name:"target"},{name:"title"}]};case Nr:return{name:Nr,properties:[{name:"body"},{name:"kind"},{name:"name"},{name:"props",defaultValue:[]}]};case Ph:return{name:Ph,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case wl:return{name:wl,properties:[{name:"parent"}]};case Nh:return{name:Nh,properties:[{name:"prev"},{name:"value"}]};case Qi:return{name:Qi,properties:[{name:"name"}]};case bl:return{name:bl,properties:[{name:"isEqual",defaultValue:!1},{name:"kind"}]};case Tl:return{name:Tl,properties:[{name:"subject"},{name:"where"}]};case El:return{name:El,properties:[{name:"custom"},{name:"subject"}]};case Rl:return{name:Rl,properties:[{name:"el"},{name:"parent"}]};case $l:return{name:$l,properties:[{name:"key"},{name:"value"}]};case kl:return{name:kl,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case Cl:return{name:Cl,properties:[{name:"isEqual",defaultValue:!1},{name:"tag"}]};case la:return{name:la,properties:[{name:"body"},{name:"extends"},{name:"name"},{name:"viewOf"}]};case Fh:return{name:Fh,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"tags"}]};case Gv:return{name:Gv,properties:[{name:"view"}]};case Al:return{name:Al,properties:[{name:"predicates"}]};case Il:return{name:Il,properties:[{name:"expand"}]};case ua:return{name:ua,properties:[{name:"body"},{name:"element"}]};case Uh:return{name:Uh,properties:[{name:"elements",defaultValue:[]}]};case Bh:return{name:Bh,properties:[{name:"el"},{name:"parent"}]};case xl:return{name:xl,properties:[{name:"key"},{name:"libicon"},{name:"value"}]};case Pl:return{name:Pl,properties:[{name:"predicates"}]};case Nl:return{name:Nl,properties:[{name:"to"}]};case Dl:return{name:Dl,properties:[{name:"inout"}]};case Ys:return{name:Ys,properties:[{name:"name"}]};case Vv:return{name:Vv,properties:[{name:"likec4lib",defaultValue:[]},{name:"models",defaultValue:[]},{name:"specifications",defaultValue:[]},{name:"views",defaultValue:[]}]};case qh:return{name:qh,properties:[{name:"icons",defaultValue:[]}]};case Ol:return{name:Ol,properties:[{name:"key"},{name:"value"}]};case Ml:return{name:Ml,properties:[{name:"key"},{name:"title"},{name:"value"}]};case Fl:return{name:Fl,properties:[{name:"key"},{name:"value"}]};case jl:return{name:jl,properties:[{name:"props",defaultValue:[]}]};case fa:return{name:fa,properties:[{name:"elements",defaultValue:[]},{name:"name"}]};case ha:return{name:ha,properties:[{name:"name"},{name:"views",defaultValue:[]}]};case Gh:return{name:Gh,properties:[{name:"key"},{name:"value"}]};case Ul:return{name:Ul,properties:[{name:"key"},{name:"value"}]};case Bl:return{name:Bl,properties:[{name:"key"},{name:"value"}]};case ql:return{name:ql,properties:[{name:"key"},{name:"value"}]};case Wl:return{name:Wl,properties:[{name:"from"},{name:"isBidirectional",defaultValue:!1},{name:"kind"}]};case Hh:return{name:Hh,properties:[{name:"prev"},{name:"value"}]};case Kh:return{name:Kh,properties:[{name:"body"},{name:"kind"},{name:"source"},{name:"tags"},{name:"target"},{name:"technology"},{name:"title"}]};case Vh:return{name:Vh,properties:[{name:"props",defaultValue:[]},{name:"tags"}]};case Gl:return{name:Gl,properties:[{name:"key"},{name:"value"}]};case zl:return{name:zl,properties:[{name:"subject"},{name:"where"}]};case Hl:return{name:Hl,properties:[{name:"custom"},{name:"subject"}]};case ts:return{name:ts,properties:[{name:"name"}]};case Kl:return{name:Kl,properties:[{name:"key"},{name:"value"}]};case Vl:return{name:Vl,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case Yl:return{name:Yl,properties:[{name:"key"},{name:"value"}]};case Qh:return{name:Qh,properties:[{name:"color"},{name:"name"}]};case ga:return{name:ga,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case Xl:return{name:Xl,properties:[{name:"key"},{name:"value"}]};case ya:return{name:ya,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case Jl:return{name:Jl,properties:[{name:"key"},{name:"value"}]};case wa:return{name:wa,properties:[{name:"colors",defaultValue:[]},{name:"elements",defaultValue:[]},{name:"name"},{name:"relationships",defaultValue:[]},{name:"tags",defaultValue:[]}]};case ba:return{name:ba,properties:[{name:"tag"}]};case ns:return{name:ns,properties:[{name:"name"}]};case tp:return{name:tp,properties:[{name:"prev"},{name:"values",defaultValue:[]}]};case rw:return{name:rw,properties:[{name:"view"}]};case Ql:return{name:Ql,properties:[{name:"direction"}]};case Zl:return{name:Zl,properties:[{name:"props",defaultValue:[]},{name:"target"}]};case eu:return{name:eu,properties:[{name:"key"},{name:"value"}]};case tu:return{name:tu,properties:[{name:"left"},{name:"operator"},{name:"right"}]};case nu:return{name:nu,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case ru:return{name:ru,properties:[{name:"value"}]};case iu:return{name:iu,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case su:return{name:su,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case ou:return{name:ou,properties:[{name:"value"}]};case au:return{name:au,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case cu:return{name:cu,properties:[{name:"isWildcard",defaultValue:!1}]};default:return{name:e,properties:[]}}}}const K=new wA;let bA;const A7=()=>bA??(bA=S8(`{"$type":"Grammar","isDeclared":true,"name":"LikeC4","rules":[{"$type":"ParserRule","name":"LikeC4Grammar","entry":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"specifications","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"models","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"views","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"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@105"},"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@110"},"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@110"},"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@110"},"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@109"},"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@8"},"arguments":[]}},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"relationships","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"colors","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@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@96"},"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@128"},"arguments":[]}},{"$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@104"},"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@99"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"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@128"},"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@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":true},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"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@110"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"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@128"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}],"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"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@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":false},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"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@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@96"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@91"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"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@128"},"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@21"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"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":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":true},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FqnElementRef","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"FqnElementRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@123"},"arguments":[]},{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"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@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@123"},"arguments":[]},{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"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@107"},"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@107"},"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@24/parameters@0"}},"elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}]},{"$type":"Group","guardCondition":{"$type":"Negation","value":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@24/parameters@0"}}},"elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},"cardinality":"?"}]}]},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@108"},"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@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Assignment","feature":"technology","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"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@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"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@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@87"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"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@128"},"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@99"},"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@30"},"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@31"},"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@129"},"arguments":[]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"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":"Assignment","feature":"views","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"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@34"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"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@110"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"extends"},{"$type":"Assignment","feature":"extends","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"of"},{"$type":"Assignment","feature":"viewOf","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}]}],"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"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@110"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@40"},"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@34"},"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@35"},"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@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"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@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]},"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"steps","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@47"},"arguments":[]}]}},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"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@42"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"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@128"},"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@48"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@80"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@81"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@78"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@80"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@81"},"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@47"},"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@22"},"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@108"},"arguments":[]},"deprecatedSyntax":false}}]},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"custom","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@85"},"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@49"},"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@49"},"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@50"},"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@50"},"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@63"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicate","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"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@53"},"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@84"},"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@60"},"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@54"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementExpression","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@55"},"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@56"},"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@56"},"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@57"},"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@57"},"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@54"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@58"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"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@54"},"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@111"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereElementKind"}},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"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@61"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@62"},"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@112"},"arguments":[]},{"$type":"Assignment","feature":"tag","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementKindExpression"}},{"$type":"Keyword","value":"element.kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@112"},"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@22"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ExpandElementExpression"},"feature":"expand","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@120"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementDescedantsExpression"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@121"},"arguments":[]}]}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicate","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@64"},"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@65"},"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@85"},"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@72"},"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@66"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationExpression","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@67"},"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@68"},"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@68"},"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@69"},"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@69"},"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@66"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@70"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@71"},"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@66"},"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@111"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationKind"}},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"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@73"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@75"},"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@74"},"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@60"},"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@76"},"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@60"},"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@60"},"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"},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@108"},"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@60"},"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@60"},"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@79"},"arguments":[]}}]},"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@51"},"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@51"},"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@77"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@95"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"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@43"},"arguments":[]}}]},"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@128"},"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@128"},"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@86"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@95"},"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@87"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@83"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@99"},"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@36"},"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@38"},"arguments":[]}}]},"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@106"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"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@102"},"arguments":[]}},{"$type":"Assignment","feature":"customColor","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@6"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@109"},"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@127"},"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@105"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@106"},"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@103"},"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@100"},"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@93"},"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@89"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@92"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@94"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@90"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@91"},"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@95"},"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@100"},"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@101"},"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@89"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@97"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@98"},"arguments":[]}]},"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":"CustomColorValue","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@122"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@130"},"arguments":[]}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IconId","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@117"},"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@118"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@119"},"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@122"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"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@124"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"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@129"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@103"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"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@129"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@103"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@102"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"arguments":[]},{"$type":"Keyword","value":"element"},{"$type":"Keyword","value":"model"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EqOperator","fragment":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@125"},"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","name":"IsEqual","fragment":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isEqual","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@125"},"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|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\\\\._/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"DotWildcard","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\.\\\\*/"},"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":"Hex","definition":{"$type":"RegexToken","regex":"/[a-zA-Z0-9]+/"},"fragment":false,"hidden":false}],"types":[{"$type":"Type","name":"LikeC4View","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@34"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@35"}}]}},{"$type":"Type","name":"StringProperty","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@18"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@42"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@27"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@31"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@9"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@13"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@82"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@83"}}]}},{"$type":"Type","name":"WhereTagEqual","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@59/definition/elements@0/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@71/definition/elements@0/elements@0/inferredType"}}]}},{"$type":"Type","name":"WhereKindEqual","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@59/definition/elements@1/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@71/definition/elements@1/elements@0/inferredType"}}]}},{"$type":"Type","name":"WhereExpression","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@54"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@66"}}]}}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"interfaces":[],"usedGrammars":[]}`)),TA={languageId:"likec4",fileExtensions:[".c4",".likec4",".like-c4"],caseInsensitive:!1},I7={skipValidations:!0,recoveryEnabled:!0,nodeLocationTracking:"full"},x7={AstReflection:()=>new wA},P7={Grammar:()=>A7(),LanguageMetaData:()=>TA,parser:{ParserConfig:()=>I7}};function vn(t){return t.el.ref}function rp(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 lu=Symbol.for("idattr"),iw={writeId(t,e){return t[lu]=e,t},readId(t){return t[lu]}},EA={writeId(t,e){return $t(e)?t[lu]=void 0:t[lu]=e,t},readId(t){return t[lu]}};function N7(t){return Object.assign(t,{c4Specification:{tags:new Set,elements:{},relationships:{},colors:{}},c4Elements:[],c4Relations:[],c4Views:[]})}function ip(t){return t.textDocument.languageId===TA.languageId}function RA(t){return ip(t)&&t.state>=De.IndexedContent&&!!t.c4fqnIndex}function uu(t){return ip(t)&&t.state==De.Validated&&!!t.c4Specification&&!!t.c4Elements&&!!t.c4Relations&&!!t.c4Views&&!!t.c4fqnIndex}function D7(t){return e=>t.some(n=>n(e))}const O7=D7([iA,Oh,Zv,Pv,Dv,rA,jv,c7,Ov,nw,l7,xv,Wv,nA,Nv,s7,dA,es,n7,ca,Dr,zv,da,ma,va,ep,Zh,tw,Xv,Yv]),L7=t=>{let e=t;for(;e;){if(O7(e))return e;e=e.$container}};function M7(t){const e=t.diagnostics?.filter(r=>r.severity===Bc.Error)??[],n=new WeakSet(e.flatMap(r=>L7(r.node)??[]));return{isValid:r=>!n.has(r),invalidNodes:n}}function*F7(t,e){const n=t.parseResult.value.models.flatMap(s=>e(s)?s.elements:[]),r=[];let i;for(;i=n.shift();)if(e(i)){if(es(i)){r.push(i);continue}if(da(i)){i.body&&i.body.elements.length>0&&n.push(...i.body.elements);continue}i.body&&i.body.elements.length>0&&n.push(...i.body.elements),yield i}for(const s of r)yield s}function j7(t){const e=vn(t.target);if(!e)throw new Error("RelationRefError: Invalid reference to target");if(It(t.source)){const n=vn(t.source);if(!n)throw new Error("RelationRefError: Invalid reference to source");return{source:n,target:e}}if(!ca(t.$container))throw new Error("RelationRefError: Invalid container for sourceless relation");return{source:t.$container.$container,target:e}}function SA({value:t}){const e=parseFloat(t);return isNaN(e)?100:nC(e,{min:0,max:100})}function sp(t,e){const n={};if(!t||t.length===0)return n;for(const r of t)if(e(r))switch(!0){case $h(r):{Q(r.value)&&(n.border=r.value);break}case Ks(r):{const i=du(r);Q(i)&&(n.color=i);break}case Jh(r):{Q(r.value)&&(n.shape=r.value);break}case Zi(r):{const i=r.libicon?.ref?.name??r.value;Q(i)&&(n.icon=i);break}case zh(r):{n.opacity=SA(r);break}default:Se(r.$type)}return n}function U7(t){const e={};if(!t||t.length===0)return e;for(const n of t){if(Ks(n)){const r=du(n);Q(r)&&(e.color=r);continue}if(Ll(n)){e.line=n.value;continue}if(pl(n)){switch(n.key){case"head":{e.head=n.value;break}case"tail":{e.tail=n.value;break}default:Se(n)}continue}Se(n)}return e}function $A(t){const{color:e,line:n,head:r,tail:i}=U7(t?.filter(o7));return{...e&&e!==fo?{color:e}:{},...n&&n!==u0?{line:n}:{},...r&&r!==uo?{head:r}:{},...i?{tail:i}:{}}}function du(t){return t?.themeColor??t?.customColor?.$refText}function kA(t){switch(t){case"TopBottom":return"TB";case"BottomTop":return"BT";case"LeftRight":return"LR";case"RightLeft":return"RL";default:Se(t)}}function B7(t){switch(t){case"TB":return"TopBottom";case"BT":return"BottomTop";case"LR":return"LeftRight";case"RL":return"RightLeft";default:Se(t)}}function _A(t){if(Pv(t))return t;if(Bv(t))return t.subject;if(Oh(t))return _A(t.subject);Se(t)}class q7{constructor(e){this.services=e}async provideCodeLens(e,n,r){return e.state!==De.Validated&&(Re.debug(`Waiting for document ${e.uri.path} to be validated`),await this.services.shared.workspace.DocumentBuilder.waitUntil(De.Validated,e.uri,r),Re.debug(`Document ${e.uri.path} is validated`)),uu(e)?e.parseResult.value.views.flatMap(i=>i.views).flatMap(i=>{const s=iw.readId(i),o=i.$cstNode?.range;return!o||!s?[]:{range:{start:o.start,end:{line:o.start.line,character:o.start.character+4}},command:{command:"likec4.open-preview",arguments:[s],title:"open preview"}}}):void 0}}class W7 extends I_{completionOptions={triggerCharacters:["."]}}class G7 extends x_{createDocumentHighlight(e){return te.DocumentHighlight.create(e.segment.range,te.DocumentHighlightKind.Read)}}class z7{constructor(e){this.services=e}getDocumentLinks(e,n){return uu(e)?wr(e.parseResult.value).filter(Wh).map(r=>{try{const i=bn(r.$cstNode,"value")?.range,s=this.resolveLink(e,r.value);if(i&&Iv(s))return{range:i,target:s}}catch(i){yt(i)}return null}).nonNullable().toArray():[]}resolveLink(e,n){if(Iv(n)||lh(n))return n;const r=YC(n)?new URL(e.uri.toString(!0)):this.services.shared.workspace.WorkspaceManager.workspaceURL;return new URL(n,r).toString()}relativeLink(e,n){if(lh(n))return XC(n);if(YC(n)){const r=new URL(e.uri.toString(!0)),i=new URL(n,r).toString();return XC(YH(i,this.services.shared.workspace.WorkspaceManager.workspaceURL.toString()))}return null}}class H7{constructor(e){this.services=e,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}nodeKindProvider;getSymbols({parseResult:{value:{specifications:e,models:n,views:r,likec4lib:i}}}){return[...i.map(s=>()=>this.getLikec4LibSymbol(s)),...e.map(s=>()=>this.getSpecSymbol(s)),...n.map(s=>()=>this.getModelSymbol(s)),...r.map(s=>()=>this.getModelViewsSymbol(s))].flatMap(s=>{try{return s()??[]}catch(o){return Gt(o),[]}})}getLikec4LibSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=e.icons.map(i=>this.getLibIconSymbol(i)).filter(Q);return r.length===0?[]:[{kind:nr.Namespace,name:"icons",range:n.range,selectionRange:wc(n,"icons")?.range??n.range,children:r}]}getSpecSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=bn(n,"name");if(!r)return[];const i=We([...e.elements,...e.tags,...e.relationships],st(s=>{try{if(ma(s)||va(s))return this.getKindSymbol(s);if(ep(s))return this.getTagSymbol(s)}catch(o){return Gt(o),null}Se(s)}),He(Q));return i.length===0?[]:[{kind:nr.Namespace,name:e.name,range:n.range,selectionRange:r.range,children:i}]}getModelSymbol(e){const n=e.$cstNode;if(!n)return[];const r=bn(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))}]:[]}getElementsSymbol(e){try{if(da(e))return this.getExtendElementSymbol(e);if(Dr(e))return this.getElementSymbol(e)}catch(n){Gt(n)}return[]}getExtendElementSymbol(e){const n=e.$cstNode,r=e.element.$cstNode,i=e.body;return!n||!r?[]:[{kind:this.symbolKind(e),name:rp(e.element),range:n.range,selectionRange:r.range,children:i.elements.flatMap(s=>this.getElementsSymbol(s))}]}getElementSymbol(e){const n=e.$cstNode,r=bn(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(o=>this.getElementsSymbol(o))??[]}]}getModelViewsSymbol(e){const n=e.$cstNode,r=bn(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||Yi(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||Yi(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||Yi(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?bn(n,"name"):null;return r?[{kind:this.symbolKind(e),name:r.text,range:n.range,selectionRange:r.range,children:[]}]:[]}symbolKind(e){return this.nodeKindProvider.getSymbolKind(e)}}class K7 extends O_{locator;constructor(e){super(e),this.locator=e.likec4.ModelLocator}getAstNodeHoverContent(e){if(gA(e))return{contents:{kind:"markdown",value:yv(`
1132
+ tag: \`${e.name}\`
1133
+ `)}};if(Dr(e)){const n=this.locator.getParsedElement(e);return n?{contents:{kind:"markdown",value:[n.id,`### ${n.title}`,"`"+n.kind+"` "].join(`
1134
+ `)}}:void 0}}}class V7 extends RW{highlightElement(e,n){if(R7(e))return n({node:e,property:"name",type:xe.function});if(b7(e))return n({node:e,property:"name",type:xe.type,modifier:[it.definition]}),"prune";if(Qv(e)&&"kind"in e){n({node:e,property:"kind",type:xe.function});return}if(es(e)&&"kind"in e&&n({node:e,property:"kind",type:xe.function}),Jv(e)||Yh(e))return n({node:e,property:"key",type:xe.property}),n({node:e,property:"value",type:xe.variable,modifier:[it.definition,it.readonly]}),"prune";if((Uv(e)||Ea(e))&&e.$cstNode){n({cst:e.$cstNode,type:xe.variable,modifier:[it.definition,it.readonly]});return}if(yA(e)&&Q(e.value)){n({node:e,property:"value",type:xe.function});return}if((ZC(e)||tA(e))&&Q(e.value)){n({node:e,property:"value",type:xe.type,modifier:[it.definition,it.readonly]});return}if(Dh(e)&&Q(e.kind)&&n({node:e,property:"kind",type:xe.type,modifier:[it.definition]}),Lh(e)&&Q(e.tag)&&n({node:e,property:"tag",type:xe.type,modifier:[it.definition]}),Sl(e)||oA(e))return n({node:e,property:"el",type:e.parent?xe.property:xe.variable,modifier:[it.definition,it.readonly]}),e.parent?void 0:"prune";if(Zh(e)){n({node:e,keyword:"color",type:xe.keyword}),n({node:e,property:"name",type:xe.type,modifier:[it.declaration,it.readonly]});return}if((ma(e)||va(e))&&n({node:e,property:"kind",type:xe.type,modifier:[it.declaration,it.readonly]}),nw(e))return n({node:e,property:"values",type:xe.interface});if(gA(e))return n({node:e,property:"name",type:xe.type,modifier:[it.definition]});if((ew(e)||_l(e)&&ca(e.$container))&&n({node:e,property:"key",type:xe.property}),zh(e))return n({node:e,property:"key",type:xe.property}),n({node:e,property:"value",type:xe.number}),"prune";if(Wh(e)||Zi(e)||a7(e))return n({node:e,property:"key",type:xe.property}),"value"in e&&e.value&&n({node:e,property:"value",type:xe.string}),Zi(e)&&e.libicon&&n({node:e,property:"libicon",type:xe.enum,modifier:[it.defaultLibrary]}),"prune";if(Ks(e)||Jh(e)||pl(e)||Ll(e)||$h(e))return n({node:e,property:"key",type:xe.property}),"value"in e&&n({node:e,property:"value",type:xe.enum}),"prune";if(Dr(e))return this.highlightAstElement(e,n);if(Nv(e))return this.highlightView(e,n)}highlightAstElement(e,n){n({node:e,property:"name",type:xe.variable,modifier:[it.declaration,it.readonly]}),n({node:e,property:"kind",type:xe.keyword,modifier:[]})}highlightView(e,n){e.name&&n({node:e,property:"name",type:xe.variable,modifier:[it.declaration,it.readonly,"local"]})}}const{findNodeForProperty:Y7}=Td,{toDocumentSegment:CA}=qL;function X7(t,e,n){const r=Y7(e.$cstNode,"name");return{documentUri:n.uri,name:e.name,...e.$cstNode&&{selectionSegment:CA(e.$cstNode)},...r&&{nameSegment:CA(r)},path:t.getAstNodePath(e),type:Nr}}function J7(t,e){const n=t.c4fqnIndex=new _r,r=t.parseResult.value.models.flatMap(a=>a.elements);if(r.length===0)return;const i=e.workspace.AstNodeLocator,s=r.map(a=>[a,null]);let o;for(;o=s.shift();)try{const[a,c]=o;if(es(a))continue;if(da(a)){if(It(a.body)&&!Yi(a.body.elements)){const l=rp(a.element);for(const u of a.body.elements)s.push([u,l])}continue}if(Dr(a)){const l=lD(a.name,c);if(n.add(l,{...X7(i,a,t),fqn:l}),EA.writeId(a,l),It(a.body)&&!Yi(a.body.elements))for(const u of a.body.elements)s.push([u,l]);continue}Se(a)}catch(a){Gt(a)}}class Q7{constructor(e){this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments,e.shared.workspace.DocumentBuilder.onBuildPhase(De.IndexedContent,async(n,r)=>{for(const i of n)if(ip(i)){delete i.c4fqnIndex,delete i.c4Elements,delete i.c4Specification,delete i.c4Relations,delete i.c4Views;try{J7(i,e)}catch(s){yt(s)}}return await Promise.resolve()}),Re.debug("[FqnIndex] Created")}langiumDocuments;get documents(){return this.langiumDocuments.all.filter(RA)}entries(e){return this.documents.flatMap(n=>n.c4fqnIndex.keys().filter(e).flatMap(r=>n.c4fqnIndex.get(r)))}getFqn(e){return EA.readId(e)??null}byFqn(e){return this.documents.flatMap(n=>n.c4fqnIndex.get(e))}directChildrenOf(e){return Me([e]).flatMap(n=>{const r=this.entries(i=>Et(i)===n).map(i=>[i.name,i]).toArray();return r.length===0?[]:new _r(r).entriesGroupedByKey().flatMap(([i,s])=>s.length===1?s:[]).iterator()})}uniqueDescedants(e){return new kt(()=>{const n=`${e}.`,r=new Set,i=[],s=new _r;if(this.entries(o=>o.startsWith(n)).forEach(o=>{const a=Oa(o.fqn),c={...o,name:a};Et(o.fqn)===e?(r.add(a),s.add(a,c)):i.push(c)}),s.size+i.length===0)return null;for(const o of i)r.has(o.name)||s.add(o.name,o);return s.entriesGroupedByKey().flatMap(([o,a])=>a.length===1?a:[]).iterator()},n=>n?n.next():Ut)}}const AA=t=>t.map(e=>" - "+e.uri.toString(!0)).join(`
1135
+ `);function Z7(t){const e=new Map;for(const n of t)if(ED(n)&&n.viewOf&&$t(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){if(i.navigateTo)continue;const s=eC(e.get(i.id)??[],o=>o!==n);s&&(i.navigateTo=s)}return t}function eK(t){const e=new Tv.Graph({directed:!0,multigraph:!1,compound:!1});for(const n of eh(t))e.setNode(n.id),h0(n)&&e.setEdge(n.id,n.extends);if(e.edgeCount()===0)return t;for(;!yH(e);){const n=tl(mH(e));if(!n)break;const r=el(n);if(!r)break;e.removeNode(r)}return BC(e,e.sources()).reduce((n,r)=>{const i=t[r];if(!i)return n;if(h0(i)){const s=n[i.extends];return s?Object.assign(n,{[i.id]:{...s,...i,rules:[...s.rules,...i.rules]}}):(Fe.debug(`View "${i.id}" extends from "${i.extends}" which does not exist`),n)}return Object.assign(n,{[i.id]:i})},{})}function tK(t,e="/"){const n=We(t,st(c=>c.docUri),He(Q),Ar());if(n.length===0)return"";if(n.length===1){const c=uh(n[0]).pathname.split(e);return c.length<=1?e:(c.pop(),c.join(e)+e)}ce(Ir(n,2),"Expected at least 2 unique URIs");const[r,...i]=n,s=uh(r).pathname.split(e);let o=s.length;for(const c of i){if(c===r)continue;const l=uh(c).pathname.split(e);for(let u=0;u<o;u++)l[u]!==s[u]&&(o=u);if(o===0)return""}const a=s.slice(0,o).join(e);return a.endsWith(e)?a:a+e}function nK(t){const e="/",n=tK(t,e);return t.map(r=>{if(!r.docUri)return{view:r,parts:[]};let i=uh(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 o=Hu(r.parts[s],i.parts[s]);if(o!==0)return o}return Hu(r.view.title??r.view.id,i.view.title??i.view.id)}).map(({parts:r,view:i})=>({...i,relativePath:r.join(e)}))}function rK(t,e){const n={tags:new Set,elements:{},relationships:{},colors:{}};RG(st(e,fi("c4Specification")),f=>{f.tags.forEach(h=>n.tags.add(h)),Object.assign(n.elements,f.elements),Object.assign(n.relationships,f.relationships),Object.assign(n.colors,f.colors)});function r(f,h){return st(h,p=>{try{const y=t.lsp.DocumentLinkProvider.relativeLink(f,p.url);if(y&&y!==p.url)return{...p,relative:y}}catch(y){yt(y)}return p})}const i=Ki(n.colors,f=>IL(f.color));function s(f){return({tags:h,links:p,style:{color:y,shape:R,icon:b,opacity:v,border:T},id:_,kind:N,title:F,description:x,technology:G,metadata:B})=>{try{const W=n.elements[N];if(!W)return Re.warn(`No kind '${N}' found for ${_}`),null;const I=p?r(f,p):null;return y??=W.style.color,R??=W.style.shape,b??=W.style.icon,v??=W.style.opacity,T??=W.style.border,G??=W.technology,{...y&&{color:y},...R&&{shape:R},...b&&{icon:b},...B&&!Yi(B)&&{metadata:B},...W.notation&&{notation:W.notation},style:{...T&&{border:T},...X_(v)&&{opacity:v}},links:I,tags:h??null,technology:G??null,description:x??null,title:F,kind:N,id:_}}catch(W){yt(W)}return null}}const o=We(e,Xi(f=>st(f.c4Elements,s(f))),He(Q),LL,z_((f,h)=>{const p=Et(h.id);return p&&$t(f[p])?(yt(`No parent found for ${h.id}`),f):(f[h.id]=h,f)},{}));function a(f){return({astPath:h,source:p,target:y,kind:R,links:b,id:v,...T})=>{if($t(o[p])||$t(o[y]))return Re.warn(`Invalid relation ${v}, source: ${p}(${!!o[p]}), target: ${y}(${!!o[y]})`),null;const _=b?r(f,b):null;return xr(R)&&R in n.relationships?{...n.relationships[R],...T,..._&&{links:_},source:p,target:y,kind:R,id:v}:{..._&&{links:_},...T,source:p,target:y,id:v}}}const c=We(e,Xi(f=>st(f.c4Relations,a(f))),He(Q),Zc(La),H_(),Q_(fi("id")));function l(f){const h=f.uri.toString();return p=>{let{id:y,title:R,description:b,tags:v,links:T,astPath:_,...N}=p;p.__==="element"&&$t(R)&&"viewOf"in p&&(R=o[p.viewOf]?.title??null),$t(R)&&y==="index"&&(R="Landscape view");const F=T?r(f,T):null;return{...N,tags:v,links:F,docUri:h,description:b,title:R,id:y,customColorDefinitions:i}}}const u=e.flatMap(f=>st(f.c4Views,l(f)));u.some(f=>f.id==="index")||u.unshift({__:"element",id:"index",title:"Landscape view",description:null,tags:null,links:null,customColorDefinitions:i,rules:[{include:[{wildcard:!0}]}]});const d=We(u,nK,Q_(fi("id")),eK);return{specification:{tags:Array.from(n.tags),elements:n.elements,relationships:n.relationships},elements:o,relations:c,views:d}}const sw="ParsedLikeC4Model",ow="ComputedLikeC4Model";class iK{constructor(e){this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments;const n=e.likec4.ModelParser;e.shared.workspace.DocumentBuilder.onUpdate((r,i)=>{i.length>0&&this.notifyListeners(i)}),e.shared.workspace.DocumentBuilder.onBuildPhase(De.Validated,async(r,i)=>{let s=[];try{Re.debug(`[ModelBuilder] onValidated (${r.length} docs)
1136
+ ${AA(r)}`);for(const o of n.parse(r))s.push(o.uri)}catch(o){yt(o)}return s.length>0&&this.notifyListeners(s),await Promise.resolve()}),Re.debug("[ModelBuilder] Created")}langiumDocuments;listeners=[];unsafeSyncBuildModel(){return this.services.WorkspaceCache.get(sw,()=>{const e=this.documents();return e.length===0?(Re.debug("[ModelBuilder] No documents to build model from"),null):(Re.debug(`[ModelBuilder] buildModel from ${e.length} docs:
1137
+ ${AA(e)}`),rK(this.services,e))})}async buildModel(e){const n=this.services.WorkspaceCache;return n.has(sw)?n.get(sw):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(ow,()=>{const i=new VC(e),s=[];for(const a of eh(e.views)){const c=Lu(a)?HC(a,i):KC(a,i);if(!c.isSuccess){yt(c.error);continue}s.push(c.view)}Z7(s);const o=hi(s,a=>{const c=this.previousViews[a.id],l=c&&EC(a,c)?c:a;return r.set(IA(a.id),l),[a.id,l]});return this.previousViews={...o},{specification:e.specification,elements:e.elements,relations:e.relations,views:o}})}async buildComputedModel(e){const n=this.services.WorkspaceCache;if(n.has(ow))return n.get(ow);const r=await this.buildModel(e);return r?await this.services.shared.workspace.WorkspaceLock.read(async()=>(e&&await Pt(e),this.unsafeSyncBuildComputedModel(r))):null}async computeView(e,n){const r=this.services.WorkspaceCache,i=IA(e);if(r.has(i))return r.get(i);const s=await this.buildModel(n),o=s?.views[e];return o?await this.services.shared.workspace.WorkspaceLock.read(async()=>(n&&await Pt(n),r.get(i,()=>{const a=new VC(s),c=Lu(o)?HC(o,a):KC(o,a);if(!c.isSuccess)return Gt(c.error),null;let l=c.view;const u=We(s.views,eh(),He(p0),He(f=>f.id!==e),th(f=>f.viewOf));for(const f of l.nodes)if(!f.navigateTo){const h=u[f.id];h&&(f.navigateTo=h[0].id)}const d=this.previousViews[e];return l=d&&EC(l,d)?d:l,this.previousViews[e]=l,l}))):(Re.warn(`[ModelBuilder] Cannot find view ${e}`),null)}onModelParsed(e){return this.listeners.push(e),Us.create(()=>{const n=this.listeners.indexOf(e);n>=0&&this.listeners.splice(n,1)})}documents(){return this.langiumDocuments.all.filter(uu).toArray()}notifyListeners(e){for(const n of this.listeners)try{n(e)}catch(r){Gt(r)}}}function IA(t){return`computed-view-${t}`}const{findNodeForKeyword:sK,findNodeForProperty:op}=Td,{getDocument:oK}=hd;class aK{constructor(e){this.services=e,this.fqnIndex=e.likec4.FqnIndex,this.langiumDocuments=e.shared.workspace.LangiumDocuments}fqnIndex;langiumDocuments;documents(){return this.langiumDocuments.all.filter(uu)}getParsedElement(e){const n=this.fqnIndex.getFqn(e);if(!n)return null;const r=oK(e);return uu(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}}locateRelation(e){for(const n of this.documents()){const r=n.c4Relations.find(o=>o.id===e);if(!r)continue;const i=this.services.workspace.AstNodeLocator.getAstNode(n.parseResult.value,r.astPath);if(!es(i))continue;let s=i.title?op(i.$cstNode,"title"):void 0;if(s??=i.kind?op(i.$cstNode,"kind"):void 0,s??=op(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(Nv(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?op(r.$cstNode,"name"):void 0;return i??=sK(r.$cstNode,"view"),i??=r.$cstNode,i?{uri:n.doc.uri.toString(),range:i.range}:null}}function aw(...t){var e=t.length>1?t.join(":::"):t[0];return Xz(e).toString(36)}function cK({nodes:t,edges:e,...n}){return{...n,nodes:Ki(t,({x:r,y:i,width:s,height:o,isCompound:a,...c})=>({...c,b:[r,i,s,o],c:a})),edges:Ki(e,({points:r,controlPoints:i,labelBBox:s,dotpos:o,...a})=>({...!!i&&{cp:i},...!!s&&{l:s},...!!o&&{dp:o},...a,p:r}))}}function lK({nodes:t,edges:e,...n}){return{...n,nodes:Ki(t,({b:r,c:i,...s})=>({x:r[0],y:r[1],width:r[2],height:r[3],isCompound:i,...s})),edges:Ki(e,({p:r,cp:i,l:s,dp:o,...a})=>({...!!i&&{controlPoints:i},...!!s&&{labelBBox:s},...!!o&&{dotpos:o},...a,points:r}))}}function uK(t){const e=wz(cK(t)),n=Lz(e),r=[];let i=0;const s=200;for(;i<n.length;)r.push(" * "+n.slice(i,Math.min(i+s,n.length))),i+=s;return r.unshift("/**"," * @likec4-generated(v1)"),r.push(" */"),r.join(`
1138
+ `)}function xA(t){return t.includes("@likec4-generated")}function dK(t){if(!xA(t))throw new Error(`Not a likec4-generated comment: ${t}`);const e=t.trim().split(`
1139
+ `).filter(r=>!r.includes("**")&&!r.includes("@likec4-")&&!r.includes("*/")).map(r=>r.replaceAll("*","").trim()).join(""),n=Dz(e);return lK(Iz(n))}const PA=({operator:t,not:e},n)=>t.startsWith("!=")?{neq:n}:t.startsWith("=")?{eq:n}:e?{neq:n}:{eq:n};function fu(t){switch(!0){case h7(t):{const e=t.value?.ref?.name;return ce(e,"Expected tag name"),{tag:PA(t,e)}}case d7(t):{const e=t.value?.ref?.name;return ce(e,"Expected kind name"),{kind:PA(t,e)}}case(mA(t)||vA(t)):return{not:fu(t.value)};case $7(t):{const e=fu(t.left),n=fu(t.right),r=t.operator.toLowerCase();switch(r){case"and":{const i=[Xp(e)?e.and:e,Xp(n)?n.and:n].flat();return ce(ks(i),"Expected non-empty array"),{and:i}}case"or":{const i=[Jp(e)?e.or:e,Jp(n)?n.or:n].flat();return ce(ks(i),"Expected non-empty array"),{or:i}}default:Se(r)}}default:Se(t)}}const{getDocument:cw}=hd;function Xs(t){return xr(t)?Ft(t).split(`
1140
+ `).join(" "):void 0}function Ft(t){return xr(t)?yv(t).trim():void 0}class fK{constructor(e){this.services=e,this.fqnIndex=e.likec4.FqnIndex,Re.debug("[ModelParser] Created")}fqnIndex;parse(e){const n=Array.isArray(e)?e:[e],r=[];for(const i of n){if(!RA(i)){Re.warn(`Not a FqnIndexedDocument: ${i.uri.toString(!0)}`);continue}try{r.push(this.parseLikeC4Document(i))}catch(s){Gt(new Error(`Error parsing document ${i.uri.toString()}`,{cause:s}))}}return r}parseLikeC4Document(e){const n=N7(e),{isValid:r}=M7(n);return this.parseSpecification(n,r),this.parseModel(n,r),this.parseViews(n,r),n}parseSpecification(e,n){const{parseResult:r,c4Specification:i}=e,s=r.value.specifications.filter(n),o=s.flatMap(u=>u.elements.filter(n));for(const{kind:u,props:d}of o)try{const f=u.name;if(!Q(f))continue;if(f in i.elements){Re.warn(`Element kind "${f}" is already defined`);continue}const h=d.find(_l),p=hi(d.filter(hA).filter(y=>xr(y.value))??[],y=>[y.key,Ft(y.value)]);i.elements[f]={...p,style:{...sp(h?.props,n)}}}catch(f){yt(f)}const a=s.flatMap(u=>u.relationships.filter(n));for(const{kind:u,props:d}of a)try{const f=u.name;if(!Q(f))continue;if(f in i.relationships){Re.warn(`Relationship kind "${f}" is already defined`);continue}const h=hi(d.filter(pA).filter(p=>xr(p.value))??[],p=>[p.key,Ft(p.value)]);i.relationships[f]={...h,...$A(d)}}catch(f){yt(f)}const c=s.flatMap(u=>u.tags.filter(n));for(const u of c){const d=u.tag.name;Q(d)&&i.tags.add(d)}const l=s.flatMap(u=>u.colors.filter(n));for(const{name:u,color:d}of l)try{const f=u.name;if(f in i.colors){Re.warn(`Custom color "${f}" is already defined`);continue}i.colors[f]={color:d}}catch(f){yt(f)}}parseModel(e,n){for(const r of F7(e,n)){if(Dr(r)){try{e.c4Elements.push(this.parseElement(r,n))}catch(i){yt(i)}continue}if(es(r)){try{e.c4Relations.push(this.parseRelation(r))}catch(i){yt(i)}continue}Se(r)}}parseElement(e,n){const r=this.resolveFqn(e),i=e.kind.$refText,s=this.convertTags(e.body),o=e.body?.props.find(_l)?.props,a=sp(o,n),c=this.getMetadata(e.body?.props.find(JC)),l=this.getAstNodePath(e);let[u,d,f]=e.props??[];const h=hi(e.body?.props.filter(qv)??[],R=>[R.key,R.value||void 0]);u=Xs(u??h.title),d=Ft(h.description??d),f=Xs(h.technology??f);const p=this.convertLinks(e.body),y=e.body?.props.find(Zi);if(y){const R=y.libicon?.ref?.name??y.value;Q(R)&&(a.icon=R)}return{id:r,kind:i,astPath:l,title:u??e.name,...c&&{metadata:c},...s&&{tags:s},...p&&ks(p)&&{links:p},...Q(f)&&{technology:f},...Q(d)&&{description:d},style:a}}parseRelation(e){const n=j7(e),r=this.resolveFqn(n.target),i=this.resolveFqn(n.source),s=this.convertTags(e)??this.convertTags(e.body),o=this.convertLinks(e.body),a=e.kind?.ref?.name,c=this.getMetadata(e.body?.props.find(JC)),l=this.getAstNodePath(e),u=hi(e.body?.props.filter(Xh).filter(R=>xr(R.value))??[],R=>[R.key,R.value]),d=We(e.body?.props??[],He(Yh),st(R=>R.value.view.ref?.name),He(Q),tl()),f=Ft(e.title??u.title)??"",h=Ft(u.description),p=Ft(e.technology)??Xs(u.technology),y=e.body?.props.find(ew);return{id:aw(l,i,r),astPath:l,source:i,target:r,title:f,...c&&{metadata:c},...Q(p)&&{technology:p},...Q(h)&&{description:h},...a&&{kind:a},...s&&{tags:s},...ks(o)&&{links:o},...$A(y?.props),...d&&{navigateTo:d}}}parseViews(e,n){const r=e.parseResult.value.views.flatMap(i=>n(i)?i.views:[]);for(const i of r)try{if(!n(i))continue;e.c4Views.push(Mh(i)?this.parseElementView(i,n):this.parseDynamicElementView(i,n))}catch(s){yt(s)}}parseViewRulePredicate(e,n){const r=[];let i=e.predicates;for(;i;){try{Q(i.value)&&n(i.value)&&r.unshift(this.parsePredicate(i.value,n))}catch(s){yt(s)}i=i.prev}return Hv(e)?{include:r}:{exclude:r}}parsePredicate(e,n){if(e7(e))return this.parseElementPredicate(e,n);if(r7(e))return this.parseRelationPredicate(e,n);Se(e)}parseElementExpressionsIterator(e){const n=[];let r=e;for(;r;){try{n.unshift(this.parseElementExpr(r.value))}catch(i){yt(i)}r=r.prev}return n}parseElementPredicate(e,n){if(Oh(e))return this.parseElementPredicateWith(e,n);if(Bv(e))return this.parseElementPredicateWhere(e);if(Pv(e))return this.parseElementExpr(e);Se(e)}parseElementExpr(e){if(Ea(e))return{wildcard:!0};if(Dh(e))return ce(e.kind,"ElementKindExpr kind is not resolved: "+e.$cstNode?.text),{elementKind:e.kind.$refText,isEqual:e.isEqual};if(Lh(e)){ce(e.tag,"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(sA(e)){const n=vn(e.expand);return ce(n,"Element not found "+e.expand.$cstNode?.text),{expanded:this.resolveFqn(n)}}if(Uv(e)){const n=vn(e.parent);return ce(n,"Element not found "+e.parent.$cstNode?.text),{element:this.resolveFqn(n),isDescedants:!0}}if(Sl(e)){const n=vn(e);return ce(n,"Element not found "+e.$cstNode?.text),{element:this.resolveFqn(n)}}Se(e)}parseElementPredicateWith(e,n){const r=this.parseElementPredicate(e.subject,n);return(e.custom?.props??[]).reduce((i,s)=>{if(Jv(s)){const o=s.value.view.$refText;return Q(o)&&(i.custom.navigateTo=o),i}if(qv(s)){if(It(s.value)){let o=s.key==="description"?Ft(s.value):Xs(s.value);i.custom[s.key]=o||""}return i}if(Zi(s)){const o=s.libicon?.ref?.name??s.value;return It(o)&&(i.custom[s.key]=o),i}if(Ks(s)){const o=du(s);return It(o)&&(i.custom[s.key]=o),i}if(Jh(s)||$h(s))return It(s.value)&&(i.custom[s.key]=s.value),i;if(zh(s))return It(s.value)&&(i.custom[s.key]=SA(s)),i;if(pa(s))return Q(s.value)&&(i.custom[s.key]=Ft(s.value)),i;Se(s)},{custom:{expr:r}})}parseElementPredicateWhere(e){return{where:{expr:this.parseElementExpr(e.subject),condition:e.where?fu(e.where):{kind:{neq:"--always-true--"}}}}}parseRelationPredicate(e,n){if(Zv(e)){const r=fA(e.subject)?e.subject.subject:e.subject;return this.parseRelationPredicateWith(e,r)}if(fA(e))return this.parseRelationPredicateWhere(e);if(Dv(e))return this.parseRelationExpr(e);Se(e)}parseRelationPredicateWhere(e){return{where:{expr:this.parseRelationExpr(e.subject),condition:e.where?fu(e.where):{kind:{neq:"--always-true--"}}}}}parseRelationPredicateWith(e,n){const r=this.parseRelationExpr(n);return(e.custom?.props??[]).reduce((i,s)=>{if(Xh(s)||pa(s)||lA(s))return It(s.value)&&(i.customRelation[s.key]=Ft(s.value)??""),i;if(pl(s))return Q(s.value)&&(i.customRelation[s.key]=s.value),i;if(Ks(s)){const o=du(s);return Q(o)&&(i.customRelation[s.key]=o),i}if(Ll(s))return Q(s.value)&&(i.customRelation[s.key]=s.value),i;if(Yh(s)){const o=s.value.view.ref?.name;return Q(o)&&(i.customRelation.navigateTo=o),i}Se(s)},{customRelation:{relation:r}})}parseRelationExpr(e){if(Mv(e))return{source:this.parseElementExpr(e.source.from),target:this.parseElementExpr(e.target),isBidirectional:e.source.isBidirectional};if(Kv(e))return{inout:this.parseElementExpr(e.inout.to)};if(Qv(e))return{outgoing:this.parseElementExpr(e.from)};if(aA(e))return{incoming:this.parseElementExpr(e.to)};Se(e)}parseViewRule(e,n){if(Lv(e))return this.parseViewRulePredicate(e,n);if(Ta(e)){const r=sp(e.props.filter(Ov),n),i=Ft(e.props.find(pa)?.value);return{targets:this.parseElementExpressionsIterator(e.target),...i&&{notation:i},style:{...r}}}if(np(e))return{autoLayout:kA(e.direction)};Se(e)}parseViewManualLaout(e){const n=ed(e.$cstNode,["BLOCK_COMMENT"]);if(!(!n||!xA(n.text)))try{return dK(n.text)}catch(r){const i=cw(e);Re.warn(r),Re.warn(`Ignoring manual layout of "${e.name??"unnamed"}" at ${i.uri.fsPath}:${1+(n.range.start.line||0)}`);return}}parseDynamicParallelSteps(e){return{__parallel:e.steps.map(n=>this.parseDynamicStep(n))}}parseDynamicStep(e){const n=vn(e.source);if(!n)throw new Error("Invalid reference to source");const r=vn(e.target);if(!r)throw new Error("Invalid reference to target");let i=this.resolveFqn(n),s=this.resolveFqn(r);const o=Ft(e.title)??null;let a={source:i,target:s,title:o};if(e.isBackward&&(a={source:s,target:i,title:o,isBackward:!0}),Array.isArray(e.custom?.props))for(const c of e.custom.props)try{if(Xh(c)||pa(c)||lA(c)){It(c.value)&&(a[c.key]=Ft(c.value)??"");continue}if(pl(c)){It(c.value)&&(a[c.key]=c.value);continue}if(Ks(c)){const l=du(c);It(l)&&(a[c.key]=l);continue}if(Ll(c)){It(c.value)&&(a[c.key]=c.value);continue}if(Yh(c)){const l=c.value.view.ref?.name;Q(l)&&(a.navigateTo=l);continue}Se(c)}catch(l){yt(l)}return a}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=vn(e.viewOf),p=h&&this.resolveFqn(h);p?s=p:Re.warn("viewOf is not resolved: "+e.$cstNode?.text)}let o=e.name;o||(o="view_"+aw(cw(e).uri.toString(),i,s??""));const a=Xs(r.props.find(h=>h.key==="title")?.value)??null,c=Ft(r.props.find(h=>h.key==="description")?.value)??null,l=this.convertTags(r),u=this.convertLinks(r),d=this.parseViewManualLaout(e),f={__:"element",id:o,astPath:i,title:a,description:c,tags:l,links:ks(u)?u:null,rules:r.rules.flatMap(h=>{try{return n(h)?this.parseViewRule(h,n):[]}catch(p){return yt(p),[]}}),...s&&{viewOf:s},...d&&{manualLayout:d}};if(iw.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}parseDynamicElementView(e,n){const r=e.body;ce(r,"DynamicElementView body is not defined");const i=r.props.filter(n),s=this.getAstNodePath(e);let o=e.name;o||(o="dynamic_"+aw(cw(e).uri.toString(),s));const a=Xs(i.find(f=>f.key==="title")?.value)??null,c=Ft(i.find(f=>f.key==="description")?.value)??null,l=this.convertTags(r),u=this.convertLinks(r);iw.writeId(e,o);const d=this.parseViewManualLaout(e);return{__:"dynamic",id:o,astPath:s,title:a,description:c,tags:l,links:ks(u)?u:null,rules:r.rules.reduce((f,h)=>{if(!n(h))return f;try{if(y7(h)){const p=[];let y=h.predicates;for(;y;){try{if(n(y.value)){const R=this.parseElementPredicate(y.value,n);p.unshift(R)}}catch(R){yt(R)}y=y.prev}return p.length>0&&f.push({include:p}),f}if(Ta(h)){const p=sp(h.props.filter(Ov),n),y=Ft(h.props.find(pa)?.value),R=this.parseElementExpressionsIterator(h.target);return R.length>0&&f.push({targets:R,...y&&{notation:y},style:{...p}}),f}if(np(h))return f.push({autoLayout:kA(h.direction)}),f;Se(h)}catch(p){return yt(p),f}},[]),steps:r.steps.reduce((f,h)=>{try{n(h)&&(rA(h)?f.push(this.parseDynamicParallelSteps(h)):f.push(this.parseDynamicStep(h)))}catch(p){yt(p)}return f},[]),...d&&{manualLayout:d}}}resolveFqn(e){if(da(e))return rp(e.element);const n=this.fqnIndex.getFqn(e);return ce(n,`Not indexed element: ${this.getAstNodePath(e)}`),n}getAstNodePath(e){return this.services.workspace.AstNodeLocator.getAstNodePath(e)}getMetadata(e){return e?.props!=null?hi(e.props,n=>[n.key,Ft(n.value)]):void 0}convertTags(e){let n=e?.tags;if(!n)return null;const r=[];for(;n;){try{const i=n.values.map(s=>s.ref?.name).filter(Q);i.length>0&&r.unshift(...i)}catch{}n=n.prev}return ks(r)?r:null}convertLinks(e){if(!(!e?.props||e.props.length===0))return We(e.props,He(Wh),Xi(n=>{const r=n.value;if(Q(r)){const i=Q(n.title)?Xs(n.title):void 0;return i?{url:r,title:i}:{url:r}}return[]}))}}const{findNodeForKeyword:hK,findNodeForProperty:Ise}=Td,pK=(t,e,n=0)=>{const r=n>0?" ".repeat(n):"";return[r+`style ${t} {`,...na(e).map(([i,s])=>r+` ${i} ${i==="opacity"?s.toString()+"%":s}`),r+"}"]},gK=(t,e)=>n=>{if(!Ta(n))return!1;const r=n.target.value;if(!r||Q(n.target.prev)||!Sl(r))return!1;const i=r.el.ref;return(i?e.getFqn(i):null)===t};function mK(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 o=el(n.body.rules)?.$cstNode?.range.end??n.body.$cstNode?.range.end;ce(o,"insertPos is not defined");const a=s.range.start.character+2,c=t.likec4.FqnIndex,l=He(n.body.rules,Ta),u=e.__==="element"?e.viewOf:null,d=[],f=[];r.forEach(R=>{const b=xG(l,gK(R,c)),v=u&&gr(u,R)?R.substring(u.length+1):R;b?d.push({fqn:v,rule:b}):f.push({fqn:v})});const h={start:o,end:o},p=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:b})=>pK(b,i,a));y.push(en.insert(o,`
1141
+ `+R.join(`
1142
+ `))),h.start={line:o.line+1,character:a},h.end={line:o.line+R.length,character:el(R)?.length??0}}if(d.length>0)for(const{rule:R}of d){const b=R.$cstNode;ce(b,"RuleCstNode not found");for(const[v,T]of na(i)){const _=v==="opacity"?T.toString()+"%":T,N=R.props.find(B=>B.key===v);if(N&&N.$cstNode){const{range:{start:B,end:W}}=N.$cstNode;p({start:B,end:W}),y.push(en.replace({start:B,end:W},v+" "+_));continue}const F=hK(b,"{")?.range.end;ce(F,"Opening brace not found");const x=" ".repeat(2+b.range.start.character),G=x+v+" "+_;y.push(en.insert(F,`
1143
+ `+G)),p({start:{line:F.line+1,character:x.length},end:{line:F.line+1,character:G.length}})}}return{modifiedRange:h,edits:y}}const{findNodeForProperty:yK,findNodeForKeyword:vK}=Td;function wK(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=B7(r),o=n.body.rules.findLast(np);if(o&&o.$cstNode){const l=yK(o.$cstNode,"direction");return l?en.replace(l.range,s):en.replace(o.$cstNode.range,`autoLayout ${s}`)}const a=vK(n.body.$cstNode,"}")?.range.start;ce(a,"Closing brace not found");const c=` autoLayout ${s}
1144
+ `+" ".repeat(a.character);return en.insert(a,c)}function bK(t,{viewAst:e,layout:n}){ce(e.$cstNode,"invalid view.$cstNode");const r=ed(e.$cstNode,["BLOCK_COMMENT"]);let i=uK(n);return e.$cstNode.range.start.character>0&&(i=zG(i,e.$cstNode.range.start.character)),r?en.replace(r.range,i.trimStart()):en.insert({line:e.$cstNode.range.start.line,character:0},i+`
1145
+ `)}class TK{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:o}=this.convertToTextEdit(e),a={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:{[a.uri]:s}}});if(!c.applied){n.window.showErrorMessage(`Failed to apply changes ${c.failureReason}`);return}r={uri:a.uri,range:o}})}catch(i){Fe.error(`Failed to apply change ${e.change.op} ${e.viewId}`,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,...mK(this.services,{...r,targets:n.targets,style:n.style})};case"change-autolayout":{const s=wK(this.services,{...r,layout:n.layout});return{doc:r.doc,modifiedRange:s.range,edits:[s]}}case"save-manual-layout":const i=bK(this.services,{...r,layout:n.layout});return{doc:r.doc,modifiedRange:i.range,edits:[i]};default:Se(n)}}}class EK extends G${async computeExports(e,n){const r=[];try{const{specifications:i,models:s,views:o,likec4lib:a}=e.parseResult.value;this.exportLibrary(a,r,e),this.exportSpecification(i,r,e),this.exportModel(s,r,e),this.exportViews(o,r,e)}catch(i){Gt(i)}return r}exportViews(e,n,r){if(!($t(e)||e.length===0))for(const i of e.flatMap(s=>s.views))try{Q(i.name)&&n.push(this.descriptions.createDescription(i,i.name,r))}catch(s){Gt(s)}}exportModel(e,n,r){if(!($t(e)||e.length===0))for(const i of e.flatMap(s=>s.elements))try{Dr(i)&&Q(i.name)&&n.push(this.descriptions.createDescription(i,i.name,r))}catch(s){Gt(s)}}exportLibrary(e,n,r){if(!$t(e))try{for(const i of e.flatMap(s=>s.icons))n.push(this.descriptions.createDescription(i,i.name,r))}catch(i){Gt(i)}}exportSpecification(e,n,r){if(!($t(e)||e.length===0))for(const i of e.flatMap(s=>[...s.elements,...s.relationships,...s.tags,...s.colors]))try{switch(!0){case ma(i):{Q(i.kind.name)&&n.push(this.descriptions.createDescription(i.kind,i.kind.name,r));continue}case ep(i):{Q(i.tag.name)&&n.push(this.descriptions.createDescription(i.tag,"#"+i.tag.name,r));continue}case va(i):{Q(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 Zh(i):{Q(i.name.name)&&n.push(this.descriptions.createDescription(i.name,i.name.name,r));continue}default:Se(i)}}catch(s){Gt(s)}}computeLocalScopes(e,n){return new Promise(r=>{const i=e.parseResult.value,s=new _r;for(const o of i.models)try{const a=this.processContainer(o,s,e);s.addAll(i,a.values())}catch(a){Gt(a)}r(s)})}processContainer(e,n,r){const i=new _r,s=new _r;for(const o of e.elements){if(es(o))continue;let a;if(Dr(o)?(Q(o.name)&&i.add(o.name,this.descriptions.createDescription(o,o.name,r)),a=o.body):da(o)&&(a=o.body),a&&a.elements.length>0)try{const c=this.processContainer(a,n,r);for(const[l,u]of c)s.add(l,u)}catch(c){Gt(c)}}if(s.size>0)for(const[o,a]of s.entriesGroupedByKey())!i.has(o)&&a.length===1&&i.add(o,a[0]);return n.addAll(e,i.values()),i}}const{getDocument:RK}=hd;class SK extends Y${fqnIndex;constructor(e){super(e),this.fqnIndex=e.likec4.FqnIndex}directChildrenOf(e){return this.fqnIndex.directChildrenOf(e)}uniqueDescedants(e){return new kt(()=>{const n=e(),r=n&&this.fqnIndex.getFqn(n);return r?this.fqnIndex.uniqueDescedants(r).iterator():null},n=>n?n.next():Ut)}scopeElementRef(e){return this.uniqueDescedants(()=>e.el.ref)}scopeExtendElement({element:e}){return Me([e.el.$nodeDescription]).nonNullable().concat(this.uniqueDescedants(()=>vn(e)))}scopeElementView({viewOf:e,extends:n}){return e?Me([e.el.$nodeDescription]).nonNullable().concat(this.uniqueDescedants(()=>vn(e))):n?Me([n]).flatMap(r=>{const i=r.view.ref;return i?this.scopeElementView(i):Ro}):Ro}getScope(e){try{const n=this.reflection.getReferenceType(e);if(n!==Nr)return this.getGlobalScope(n);try{const r=e.container;if(oA(r)&&e.property==="el"){const i=r.parent;return i?new Gc(this.directChildrenOf(rp(i))):this.getGlobalScope(n)}if(Sl(r)&&e.property==="el"){const i=r.parent;if(i)return new Gc(this.scopeElementRef(i));if(e.reference.$refText==="this"||e.reference.$refText==="it"){const s=an(r,Dr);return s?new z$([this.descriptions.createDescription(s,e.reference.$refText)]):H$}}return this.computeScope(e)}catch(r){return Re.warn(r),this.getGlobalScope(n)}}catch(n){return Re.warn(n),H$}}computeScope(e){const n=this.reflection.getReferenceType(e);ce(n===Nr,"Invalid reference type");const r=[],i=RK(e.container).precomputedScopes;if(i){const s=a=>this.reflection.isSubtype(a.type,n);let o=e.container;for(;o;){const a=i.get(o).filter(s);a.length>0&&r.push(Me(a)),zv(o)&&r.push(this.scopeExtendElement(o.$container)),Wv(o)&&r.push(this.scopeElementView(o.$container)),o=o.$container}}return r.reduceRight((s,o)=>this.createScope(o,s),this.getGlobalScope(n))}getGlobalScope(e){return new Gc(this.indexManager.allElements(e))}}class $K{constructor(e){this.services=e}disposables=[];init(){const e=this.services.likec4.ModelBuilder,n=this.services.likec4.ModelLocator,r=this.services.likec4.ModelChanges,i=this.services.shared.lsp.Connection;if(!i){Re.info("[ServerRpc] no connection, not initializing");return}Re.info("[ServerRpc] init");const s=this.services.shared.workspace.LangiumDocuments,o=this.services.shared.workspace.DocumentBuilder,a=LG(()=>void i.sendNotification(jz,"").catch(l=>(Re.error(`[ServerRpc] error sending onDidChangeModel: ${l}`),Promise.resolve())),{timing:"both",waitMs:350,maxWaitMs:1e3});let c=!0;this.disposables.push(Us.create(()=>{a.cancel()}),e.onModelParsed(()=>a.call()),i.onRequest(Bz,async l=>({model:await e.buildComputedModel(l)})),i.onRequest(Uz,async l=>({model:await e.buildModel(l)})),i.onRequest(qz,async({viewId:l},u)=>({view:await e.computeView(l,u)})),i.onRequest(Wz,async({docs:l},u)=>{const d=l.map(p=>qt.parse(p)),f=p=>d.every(y=>!mt.equals(y,p)),h=s.all.filter(p=>ip(p)&&f(p.uri)&&p.uri.scheme!==dC).map(p=>p.uri).toArray();Re.debug(`[ServerRpc] received request to build:
1146
+ changed (total ${d.length}):${l.map(p=>`
1147
+ - `+p).join("")}
1148
+ deleted (total ${h.length}):${h.map(p=>`
1149
+ - `+p.toString()).join(`
1150
+ `)}`),!c&&d.length+h.length>0&&(await Promise.allSettled([...d,...h].map(async p=>{const y=p.toString();Re.debug(`clear diagnostics for ${y}`);try{await i.sendDiagnostics({uri:y,diagnostics:[]})}catch(R){Re.warn(`error clearing diagnostics for ${y}: ${R}`)}})),await Pt(u)),c=!1,await o.update(d,h,u)}),i.onRequest(Gz,l=>{if("element"in l)return n.locateElement(l.element,l.property??"name");if("relation"in l)return n.locateRelation(l.relation);if("view"in l)return n.locateView(l.view);Se(l)}),i.onRequest(zz,async(l,u)=>await r.applyChange(l)))}dispose(){let e;for(;e=this.disposables.pop();)try{e.dispose()}catch(n){Gt(n)}}}class kK{constructor(e){this.services=e}getSymbolKind(e){const n=ct(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(n,s));switch(!0){case r(Nr,ua):return nr.Constructor;case r(fa,ha,wa):return nr.Namespace;case r(Hs):return nr.Class;case r(ns,Ys,Vs,ba):return nr.EnumMember;case r(ts,ya):return nr.Event;case r(Qi,ga):return nr.TypeParameter}return nr.Field}getCompletionItemKind(e){const n=ct(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(n,s));switch(!0){case r(Vs):return $r.Color;case r(Nr,ua):return $r.Constructor;case r(fa,ha,wa):return $r.Module;case r(Hs):return $r.Class;case r(ns,Ys,Vs,ba):return $r.EnumMember;case r(ts,ya):return $r.Event;case r(Qi,ga):return $r.TypeParameter;default:return $r.Reference}}}class _K extends J${documentFactory;constructor(e){super(e),this.documentFactory=e.workspace.LangiumDocumentFactory}async loadAdditionalDocuments(e,n){await super.loadAdditionalDocuments(e,n),n(this.documentFactory.fromString(Mz,qt.parse(Fz)))}workspace(){return this.folders&&Rg(this.folders,1)?this.folders[0]:null}get workspaceUri(){const e=this.workspace();return ce(e,"Workspace not initialized"),qt.parse(e.uri)}get workspaceURL(){const e=this.workspace();return ce(e,"Workspace not initialized"),new URL(e.uri)}}class CK extends M_{}const AK=t=>(e,n)=>{const r=_A(e.value);switch(!0){case Dh(r):case Lh(r):case Ea(r):{n("warning","Predicate is ignored, as not supported in dynamic views",{node:e});return}}},IK=t=>{const e=t.likec4.FqnIndex;return(n,r)=>{try{const i=vn(n.source),s=i&&e.getFqn(i);s||r("error","Source not found (not parsed/indexed yet)",{node:n,property:"source"});const o=vn(n.target),a=o&&e.getFqn(o);a||r("error","Target not found (not parsed/indexed yet)",{node:n,property:"target"}),s&&a&&(gr(s,a)||gr(a,s))&&r("error","Invalid parent-child relationship",{node:n})}catch(i){Gt(i)}}},ap=["this","it","self","super","likec4lib"];function cp(t){return async(e,n,r)=>{r&&await Pt(r);try{await t(e,n,r)}catch(i){yt(i)}}}const{getDocument:xK}=hd,PK=t=>{const e=t.likec4.FqnIndex,n=t.workspace.AstNodeLocator;return cp((r,i)=>{const s=e.getFqn(r);if(!s){i("error","Not indexed element",{node:r,property:"name"});return}ap.includes(r.name)&&i("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const o=xK(r).uri,a=n.getAstNodePath(r),c=e.byFqn(s).filter(l=>l.documentUri!==o||l.path!==a).head();if(c){const l=c.documentUri!==o;i("error",`Duplicate element name ${r.name!==s?r.name+" ("+s+")":r.name}`,{node:r,property:"name",...l&&{relatedInformation:[{location:{range:c.nameSegment?.range??c.selectionSegment?.range,uri:c.documentUri.toString()},message:"conflicting element"}]}})}})},NK=t=>(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"})},DK=t=>(e,n)=>{const r=e.$container;r.props.some(i=>Zi(i)&&i!==e)&&n("error","Icon must be defined once",{node:e}),_l(r)&&ca(r.$container)&&r.$container.props.some(i=>Zi(i))&&n("warning","Redundant as icon defined on element",{node:e})},OK=t=>(e,n)=>{qg(e,jv)||n("error","Notes can be defined only inside dynamic view",{node:e})},LK=t=>{const e=t.likec4.FqnIndex;return cp((n,r)=>{const i=vn(n.target),s=i&&e.getFqn(i);s||r("error","Target not resolved",{node:n,property:"target"});let o;if(It(n.source)){if(o=vn(n.source),!o)return r("error","Source not resolved",{node:n,property:"source"})}else{if(!ca(n.$container))return r("error","Sourceless relation must be nested",{node:n});o=n.$container.$container}const a=e.getFqn(o);a||r("error","Source not resolved",{node:n}),a&&s&&Vu(a,s)&&r("error","Invalid parent-child relationship",{node:n})})},MK=t=>cp((e,n)=>{e.$container.tags?.values&&e.tags?.values&&n("error","Relation cannot have tags in both header and body",{node:e.tags})}),FK=t=>(e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one specification per document",{node:e,property:"name"})},jK=t=>(e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one model per document",{node:e,property:"name"})},UK=t=>(e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one views block per document",{node:e,property:"name"})},BK=t=>{const e=t.shared.workspace.IndexManager;return cp((n,r)=>{ap.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=e.allElements(Qi).filter(s=>s.name===n.name&&s.node!==n).head();if(i){const s=i.documentUri!==Yt(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"}]}})}})},qK=t=>{const e=t.shared.workspace.IndexManager;return(n,r)=>{const i="#"+n.name,s=e.allElements(ns).filter(o=>o.name===i&&o.node!==n).head();if(s){const o=s.documentUri!==Yt(n).uri;r("error",`Duplicate tag '${n.name}'`,{node:n,property:"name",...o&&{relatedInformation:[{location:{range:s.nameSegment.range,uri:s.documentUri.toString()},message:"conflicting definition"}]}})}}},WK=t=>{const e=t.shared.workspace.IndexManager;return(n,r)=>{ap.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"}),e.allElements(ts).filter(i=>i.name===n.name).limit(2).count()>1&&r("error",`Duplicate RelationshipKind '${n.name}'`,{node:n,property:"name"})}},GK=t=>{const e=t.shared.workspace.IndexManager;return(n,r)=>{n.name&&(ap.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"}),e.allElements(Hs).filter(i=>i.name===n.name).limit(2).count()>1&&r("error",`Duplicate view '${n.name}'`,{node:n,property:"name"}))}},zK=t=>(e,n)=>{const r=an(e,Lv);jh(r)&&n("error",'Invalid usage inside "exclude"',{node:e});const i=Bv(e.subject)?e.subject.subject:e.subject;switch(!0){case Sl(i):case Uv(i):case sA(i):case Ea(i):return;case Dh(i):case Lh(i):n("error","Invalid target (expect reference to specific element)",{node:e,property:"subject"});return;default:Se(i)}},HK=t=>(e,n)=>{qg(e,Dv)&&n("warning","Redundant usage, expand predicate resolves parent element only when used in relations",{node:e})},KK=t=>(e,n)=>{if(Ea(e.to)&&!Kv(e.$container)){const r=an(e,Mh);$t(r?.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}},VK=t=>(e,n)=>{if(Ea(e.from)&&!Mv(e.$container)){const r=an(e,Mh);$t(r?.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}},YK=t=>(e,n)=>{const r=an(e,Lv);jh(r)&&n("error",'Invalid usage inside "exclude"',{node:e})};function XK(t){Re.info("registerValidationChecks"),t.validation.ValidationRegistry.register({NotesProperty:OK(),OpacityProperty:NK(),IconProperty:DK(),SpecificationRule:FK(),Model:jK(),ModelViews:UK(),DynamicViewStep:IK(t),LikeC4View:GK(t),Element:PK(t),ElementKind:BK(t),Relation:LK(t),RelationBody:MK(),Tag:qK(t),DynamicViewPredicateIterator:AK(),ElementPredicateWith:zK(),RelationPredicateWith:YK(),ExpandElementExpression:HK(),RelationshipKind:WK(t),IncomingRelationExpression:KK(),OutgoingRelationExpression:VK()});const e=t.shared.lsp.Connection;e&&t.shared.workspace.DocumentBuilder.onUpdate((n,r)=>{for(const i of r)Re.debug(`clear diagnostics for deleted ${i.path}`),e.sendDiagnostics({uri:i.toString(),diagnostics:[]})})}function JK(t,e){return[t,e]=NA(t,e)>0?[e,t]:[t,e],QK(t.range,e.range.start)}function NA(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 QK(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 DA(t){return t.range.start.line!=t.range.end.line}const ee={newLine:Hi.newLine({allowMore:!0}),oneSpace:Hi.oneSpace(),noSpace:Hi.noSpace(),indent:Hi.indent({allowMore:!0}),noIndent:Hi.noIndent()};class ZK extends DW{format(e){this.removeIndentFromTopLevelStatements(e),this.indentContentInBraces(e),this.formatSpecificationRule(e),this.formatElementDeclaration(e),this.formatRelation(e),this.formatView(e),this.formatViewRuleStyle(e),this.formatIncludeExcludeExpressions(e),this.formatWhereExpression(e),this.formatWithPredicate(e),this.formatLeafProperty(e),this.formatMetadataProperty(e),this.formatAutolayoutProperty(e),this.formatLinkProperty(e),this.formatNavigateToProperty(e),this.formatTags(e)}formatTags(e){this.on(e,nw,(n,r)=>{r.cst(_o(n.$cstNode,"values").slice(1)).prepend(ee.oneSpace),r.keywords(",").prepend(ee.noSpace).append(ee.oneSpace)})}formatRelation(e){this.on(e,es,(n,r)=>{const i=n?.source?.$cstNode?[n?.source?.$cstNode]:[];r.cst(i).append(ee.oneSpace),r.keywords("]->").prepend(ee.noSpace),r.keywords("-[").append(ee.noSpace),r.properties("target","title","technology","tags").prepend(ee.oneSpace)}),this.on(e,jv,(n,r)=>{r.properties("source").append(ee.oneSpace),r.keywords("]->").prepend(ee.noSpace),r.keywords("-[").append(ee.noSpace),r.properties("target","title").prepend(ee.oneSpace)}),this.on(e,Mv)?.property("target").prepend(ee.oneSpace),this.on(e,Qv,(n,r)=>{r.property("from").append(ee.oneSpace),r.keywords("]->").prepend(ee.noSpace),r.keywords("-[").append(ee.noSpace)}),this.on(e,aA)?.keywords("->").append(ee.oneSpace),this.on(e,Kv)?.keyword("->").prepend(ee.oneSpace)}removeIndentFromTopLevelStatements(e){(Yv(e)||tw(e)||Xv(e)||cA(e))&&this.getNodeFormatter(e).keywords("specification","model","views","likec4lib").prepend(ee.noIndent)}indentContentInBraces(e){if(cA(e)||tw(e)||ma(e)||va(e)||Yv(e)||ca(e)||zv(e)||dA(e)||ew(e)||E7(e)||Xv(e)||Wv(e)||nA(e)||Ta(e)||p7(e)||g7(e)||_l(e)){const n=this.getNodeFormatter(e),r=n.keywords("{"),i=n.keywords("}"),s=n.interior(r,i);let o=null;for(const a of s.nodes)(!o||!JK(o,a))&&n.cst([a]).prepend(ee.indent),o=a;r.prepend(ee.noIndent).prepend(ee.oneSpace),i.prepend(ee.noIndent).prepend(Hi.newLine({allowMore:!0}))}}appendKeywordsWithSpace(e){this.on(e,w7)?.keywords("element").append(ee.oneSpace)}formatView(e){this.on(e,Mh,(n,r)=>{(n.extends||n.viewOf||n.name)&&r.keywords("view").append(ee.oneSpace),r.keywords("of","extends").surround(ee.oneSpace)}),this.on(e,m7)?.keywords("dynamic","view").append(ee.oneSpace)}formatLeafProperty(e){if(qv(e)||Xh(e)||S7(e)||pa(e)||hA(e)||pA(e)||Ks(e)||Ll(e)||pl(e)||Zi(e)||Jh(e)||$h(e)||zh(e)){const n=this.getNodeFormatter(e);n.keywords("title","description","technology","notation","color","line","head","tail","icon","shape","border","opacity").append(ee.oneSpace),n.keyword(":").prepend(ee.noSpace).append(ee.oneSpace),n.keyword(";").prepend(ee.noSpace).append(ee.newLine)}}formatLinkProperty(e){this.on(e,Wh,(n,r)=>{r.keyword("link").append(ee.oneSpace),r.property("value").append(ee.oneSpace),r.keyword(":").prepend(ee.noSpace).append(ee.oneSpace),r.keyword(";").prepend(ee.noSpace).append(ee.newLine)})}formatNavigateToProperty(e){this.on(e,Jv)?.property("key").append(ee.oneSpace)}formatAutolayoutProperty(e){this.on(e,np)?.keyword("autoLayout").append(ee.oneSpace)}formatMetadataProperty(e){this.on(e,T7,(n,r)=>{r.property("key").append(ee.oneSpace),r.keyword(":").prepend(ee.noSpace).append(ee.oneSpace),r.keyword(";").prepend(ee.noSpace).append(ee.newLine)})}formatElementDeclaration(e){this.on(e,Dr,(n,r)=>{const i=bn(n.$cstNode,"kind"),s=bn(n.$cstNode,"name");s&&i&&(NA(s,i)>0?r.cst([i]).append(ee.oneSpace):(r.cst([s]).append(ee.oneSpace),r.cst([i]).prepend(ee.oneSpace))),r.properties("props").prepend(ee.oneSpace)})}formatSpecificationRule(e){if((ma(e)||va(e)||ep(e))&&this.getNodeFormatter(e).keywords("element","relationship","tag").append(ee.oneSpace),Zh(e)){const n=this.getNodeFormatter(e);n.keyword("color").append(ee.oneSpace),n.property("name").append(ee.oneSpace)}}formatWithPredicate(e){const n=this.getNodeFormatter(e);(Oh(e)||Zv(e))&&n.keyword("with").prepend(ee.oneSpace)}formatViewRuleStyle(e){this.on(e,Ta)?.keyword("style").append(ee.oneSpace),this.on(e,v7)?.keyword(",").prepend(ee.noSpace).append(ee.oneSpace)}formatWhereExpression(e){if((i7(e)||t7(e))&&this.getNodeFormatter(e).keyword("where").append(ee.oneSpace),(f7(e)||u7(e))&&this.getNodeFormatter(e).property("operator").surround(ee.oneSpace),(mA(e)||vA(e))&&this.getNodeFormatter(e).keyword("not").append(ee.oneSpace),ZC(e)||_7(e)||k7(e)||tA(e)||C7(e)||yA(e)){const n=this.getNodeFormatter(e);n.property("operator").surround(ee.oneSpace),n.property("not").surround(ee.oneSpace)}}formatIncludeExcludeExpressions(e){if(xv(e)||Hv(e)||jh(e)){const n=this.getNodeFormatter(e);(!e.$cstNode||!DA(e.$cstNode))&&n.keywords("include","exclude").append(ee.oneSpace)}if(iA(e)||uA(e)||uA(e)){const n=this.getNodeFormatter(e),r=this.findPredicateExpressionRoot(e),i=r?.$cstNode&&DA(r?.$cstNode);i&&n.property("value").prepend(ee.indent),n.keyword(",").prepend(ee.noSpace).append(i?ee.newLine:ee.oneSpace)}}findPredicateExpressionRoot(e){let n=e.$container;for(;;){if(!n||xv(n)||Hv(n)||jh(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}}const eV={lsp:{NodeKindProvider:t=>new kK(t),WorkspaceSymbolProvider:t=>new CK(t)},workspace:{WorkspaceManager:t=>new _K(t)}};function zt(t){return e=>new t(e)}const tV={WorkspaceCache:t=>new V$(t.shared),Rpc:zt($K),likec4:{ModelChanges:zt(TK),FqnIndex:zt(Q7),ModelParser:zt(fK),ModelBuilder:zt(iK),ModelLocator:zt(aK)},lsp:{CompletionProvider:zt(W7),DocumentHighlightProvider:zt(G7),DocumentSymbolProvider:zt(H7),SemanticTokenProvider:zt(V7),HoverProvider:zt(K7),CodeLensProvider:zt(q7),DocumentLinkProvider:zt(z7),Formatter:zt(ZK)},references:{ScopeComputation:zt(EK),ScopeProvider:zt(SK)}};function nV(t,e,n,r){const i=rV(t),s=[IW({shared:i}),P7,tV,e,n,r].reduce(OA,{}),o=bf(s);return i.ServiceRegistry.register(o),XK(o),t.connection?o.Rpc.init():i.workspace.ConfigurationProvider.initialized({}),{shared:i,likec4:o}}function rV(t={}){const e={...pk,...t};return t.connection&&(ZH(t.connection),QH(t.connection)),bf(PW(e),x7,eV)}function OA(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]=OA(i,r):t[n]=r}}return t}function LA(t){return typeof t=="object"&&t!==null&&typeof t.id=="string"}function lw(t){return typeof t=="object"&&t!==null&&t.$$type==="Node"&&typeof t.id=="string"}function MA(t){return lw(t)||LA(t)}function hu(t){return typeof t=="string"||MA(t)}function iV(t){return Array.isArray(t)&&t.every(hu)}function sV(t){return["n","ne","e","se","s","sw","w","nw","c"].includes(t)}function FA(t){if(MA(t))return t;const[e,n,r]=t.split(":");return sV(r)?{id:e,port:n,compass:r}:{id:e,port:n}}function oV(t){if(t.length<2&&(hu(t[0])&&hu(t[1]))===!1)throw Error("EdgeTargets must have at least 2 elements.");return t.map(e=>FA(e))}const lp=Object.seal({Graph:null,Digraph:null,Subgraph:null,Node:null,Edge:null});function aV(t){return Object.assign(Object.seal(Object.assign({},lp)),t)}function cV(...t){const[e,...n]=t;return(...r)=>n.reduce((i,s)=>s(i),e(...r))}function Wn(t,...e){return cV(t,...e)}const lV=t=>(...e)=>n=>t(n,...e),uV=t=>({[Symbol.iterator]:t}),ar=lV((t,e)=>Array.from(uV(function*(){for(const n of t)yield e(n)})));class jA{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 Ie=jA.prototype.createElement.bind(new jA),dV=/\r?\n/;function cr(t){return e=>e.join(t)}function fV(t){return e=>t+e+t}function rs(t,e){return n=>t+n+e}function up(t){return e=>t+e}const UA=t=>t.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/"/g,'\\"'),dp=t=>t.split(dV),pu=(t,e,n)=>Wn(dp,ar(up(t==="space"?" ".repeat(e):`
1151
+ `)),cr(n)),Js=t=>{switch(t){case"crlf":return`\r
1152
+ `;case"lf":return`
1153
+ `}},hV={match(t){return t.type==="AttributeList"},print(t,e){if(e.children.length===0)return`${e.kind.toLocaleLowerCase()} [];`;const n=Js(t.endOfLine);return Wn(ar(t.print),cr(n),pu(t.indentStyle,t.indentSize,n),rs(`${e.kind.toLocaleLowerCase()} [${n}`,`${n}];`))(e.children)}},pV={match(t){return t.type==="Attribute"},print(t,e){return`${t.print(e.key)} = ${t.print(e.value)};`}},gV={match(t){return t.type==="Comment"},print(t,e){const n=Js(t.endOfLine);switch(e.kind){case"Block":return Wn(dp,ar(up(" * ")),cr(n),rs(`/**${n}`,`${n} */`))(e.value);case"Macro":return Wn(dp,ar(up("# ")),cr(n))(e.value);case"Slash":default:return Wn(dp,ar(up("// ")),cr(n))(e.value)}}},mV={match(t){return t.type==="Dot"},print(t,e){return e.children.map(t.print).join(Js(t.endOfLine))}},yV={match(t){return t.type==="Edge"},print(t,e){const n=Wn(ar(t.print),cr(t.directed?" -> ":" -- "))(e.targets);if(e.children.length===0)return`${n};`;const r=Js(t.endOfLine),i=Wn(ar(t.print),cr(r),pu(t.indentStyle,t.indentSize,r),rs(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},vV={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=Js(t.endOfLine),i=Wn(ar(t.print),cr(r),pu(t.indentStyle,t.indentSize,r),rs(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},wV=Wn(UA,fV('"')),bV=rs("<",">"),TV={match(t){return t.type==="Literal"},print(t,e){switch(e.quoted){case"html":return bV(e.value);case!0:return wV(e.value);case!1:default:return UA(e.value)}}},EV={match(t){return t.type==="Node"},print(t,e){const n=t.print(e.id);if(e.children.length===0)return`${n};`;const r=Js(t.endOfLine),i=Wn(ar(t.print),cr(r),pu(t.indentStyle,t.indentSize,r),rs(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},RV={match(t){return t.type==="NodeRefGroup"},print(t,e){return Wn(ar(t.print),cr(" "),rs("{","}"))(e.children)}},SV={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(":")}},$V={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=Js(t.endOfLine),i=Wn(ar(t.print),cr(r),pu(t.indentStyle,t.indentSize,r),rs(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},kV=[hV,pV,gV,mV,yV,vV,TV,EV,RV,SV,$V];class _V{options;#e=[...kV];constructor(e={}){this.options=e}print(e){const n=[...this.#e],{indentSize:r=2,indentStyle:i="space",endOfLine:s="lf"}=this.options,o={directed:!0,indentSize:r,indentStyle:i,endOfLine:s,print(a){for(const c of n)if(c.match(a))return c.print(o,a);throw Error()}};return o.print(e)}}function CV(t,e){const n=new _V(e).print(t);if(!n)throw new Error;return n}function fp(t,e){if(typeof e=="string"){const n=e.trim();return/^<.+>$/ms.test(n)?Ie("Attribute",{key:Ie("Literal",{value:t,quoted:!1},[]),value:Ie("Literal",{value:n.slice(1,n.length-1),quoted:"html"},[])},[]):Ie("Attribute",{key:Ie("Literal",{value:t,quoted:!1},[]),value:Ie("Literal",{value:e,quoted:!0},[])},[])}return Ie("Attribute",{key:Ie("Literal",{value:t,quoted:!1},[]),value:Ie("Literal",{value:String(e),quoted:!1},[])},[])}function Qs(t,e){return Ie("Comment",{kind:e,value:t},[])}function BA(t,e){return Array.from(function*(){for(const[n,r]of e.values)yield fp(n,r);for(const n of Object.values(e.attributes))n.size>0&&(n.comment&&(yield Qs(n.comment,t.commentKind)),yield t.convert(n));for(const n of e.nodes)n.comment&&(yield Qs(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.subgraphs)n.comment&&(yield Qs(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.edges)n.comment&&(yield Qs(n.comment,t.commentKind)),yield t.convert(n)}())}const AV={match(t){return t.$$type==="AttributeList"},convert(t,e){return Ie("AttributeList",{kind:e.$$kind},e.values.map(([n,r])=>fp(n,r)))}},IV={match(t){return t.$$type==="Edge"},convert(t,e){return Ie("Edge",{targets:e.targets.map(n=>lw(n)?Ie("NodeRef",{id:Ie("Literal",{value:n.id,quoted:!0},[])},[]):LA(n)?Ie("NodeRef",{id:Ie("Literal",{value:n.id,quoted:!0},[]),port:n.port?Ie("Literal",{value:n.port,quoted:!0},[]):void 0,compass:n.compass?Ie("Literal",{value:n.compass,quoted:!0},[]):void 0},[]):Ie("NodeRefGroup",{},n.map(r=>lw(r)?Ie("NodeRef",{id:Ie("Literal",{value:r.id,quoted:!0},[])},[]):Ie("NodeRef",{id:Ie("Literal",{value:r.id,quoted:!0},[]),port:r.port?Ie("Literal",{value:r.port,quoted:!0},[]):void 0,compass:r.compass?Ie("Literal",{value:r.compass,quoted:!0},[]):void 0},[]))))},[...e.attributes.comment?[Qs(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>fp(n,r))])}},xV={match(t){return t.$$type==="Graph"},convert(t,e){return Ie("Dot",{},[...e.comment?[Qs(e.comment,t.commentKind)]:[],Ie("Graph",{directed:e.directed,strict:e.strict,id:e.id?Ie("Literal",{value:e.id,quoted:!0},[]):void 0},BA(t,e))])}},PV={match(t){return t.$$type==="Node"},convert(t,e){return Ie("Node",{id:Ie("Literal",{value:e.id,quoted:!0},[])},[...e.attributes.comment?[Qs(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>fp(n,r))])}},NV={match(t){return t.$$type==="Subgraph"},convert(t,e){return Ie("Subgraph",{id:e.id?Ie("Literal",{value:e.id,quoted:!0},[]):void 0},BA(t,e))}},DV=[AV,IV,PV,xV,NV];class OV{options;#e=[...DV];constructor(e={}){this.options=e}convert(e){const n=[...this.#e],{commentKind:r="Slash"}=this.options,i={commentKind:r,convert(s){for(const o of n)if(o.match(s))return o.convert(i,s);throw Error()}};return i.convert(e)}}function LV(t,e){return new OV(e).convert(t)}const O=new Proxy(Object.freeze({}),{get:(t,e)=>e});class uw{}class dw extends uw{#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 fw extends dw{$$kind;get $$type(){return"AttributeList"}comment;constructor(e,n){super(n),this.$$kind=e}}class qA extends dw{#e=lp;id;comment;attributes=Object.freeze({graph:new fw("Graph"),edge:new fw("Edge"),node:new fw("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=aV(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=>iV(s)?oV(s):FA(s)),i=new this.#e.Edge(r,n);return this.addEdge(i),i}subgraph(...e){const n=e.find(o=>typeof o=="string"),r=e.find(o=>typeof o=="object"&&o!==null),i=e.find(o=>typeof o=="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(a=>typeof a=="object"&&a!==null),s=n.find(a=>typeof a=="function"),o=this.getNode(r)??this.createNode(r);return i!==void 0&&o.attributes.apply(i),s!==void 0&&s(o),o}typeof e=="object"&&e!==null&&this.attributes.node.apply(e)}edge(e,...n){if(Array.isArray(e)){const r=e,i=n.find(a=>typeof a=="object"),s=n.find(a=>typeof a=="function"),o=this.createEdge(r,i);return s!==void 0&&s(o),o}typeof e=="object"&&e!==null&&this.attributes.edge.apply(e)}graph(e){this.attributes.graph.apply(e)}}class WA extends qA{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 MV extends WA{get directed(){return!0}}class FV extends WA{get directed(){return!1}}class jV extends qA{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 GA extends dw{comment}let UV=class extends uw{id;get $$type(){return"Node"}comment;attributes;constructor(e,n){super(),this.id=e,this.attributes=new GA(n)}port(e){return typeof e=="string"?{id:this.id,port:e}:{id:this.id,...e}}};class BV extends uw{targets;get $$type(){return"Edge"}comment;attributes;constructor(e,n){if(super(),this.targets=e,e.length<2&&(hu(e[0])&&hu(e[1]))===!1)throw Error("The element of Edge target is missing or not satisfied as Edge target.");this.attributes=new GA(n)}}Object.assign(lp,{Graph:FV,Digraph:MV,Subgraph:jV,Node:UV,Edge:BV});function zA(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"),o=n.find(c=>typeof c=="function"),a=new r(i,e,s);return a.with(this),typeof o=="function"&&o(a),a}}function HA(t,e=lp){return Object.freeze({digraph:zA.call(e,!0,t),graph:zA.call(e,!1,t)})}const KA=HA(!1),qV=KA.digraph;KA.graph;const WV=HA(!0);function VA(t,e){const n=LV(t,e?.convert);return CV(n,e?.print)}function GV(t){let e=t.length-1,n=t[e];for(;n===" "||n===" ";)n=t[--e];return t.substring(0,e+1)}function zV(t){return t.split(`
1154
+ `).map(r=>GV(r)).join(`
1155
+ `)}var HV=function(t,e){if(e=e||{},t==null)return t;var n=e.width||50,r=typeof e.indent=="string"?e.indent:" ",i=e.newline||`
1156
+ `+r,s=typeof e.escape=="function"?e.escape:KV,o=".{1,"+n+"}";e.cut!==!0&&(o+="([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)");var a=new RegExp(o,"g"),c=t.match(a)||[],l=r+c.map(function(u){return u.slice(-1)===`
1157
+ `&&(u=u.slice(0,u.length-1)),s(u)}).join(i);return e.trim===!0&&(l=zV(l)),l};function KV(t){return t}const VV=Io(HV),hp={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 hp.hue2rgb(s,i,t+1/3)*255;case"g":return hp.hue2rgb(s,i,t)*255;case"b":return hp.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),o=(i+s)/2;if(r==="l")return o*100;if(i===s)return 0;const a=i-s,c=o>.5?a/(2-i-s):a/(i+s);if(r==="s")return c*100;switch(i){case t:return((e-n)/a+(e<n?6:0))*60;case e:return((n-t)/a+2)*60;case n:return((t-e)/a+4)*60;default:return-1}}},YV={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},XV={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},pe={channel:hp,lang:YV,unit:XV},is={};for(let t=0;t<=255;t++)is[t]=pe.unit.dec2hex(t);const Ht={ALL:0,RGB:1,HSL:2};class JV{constructor(){this.type=Ht.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=Ht.ALL}is(e){return this.type===e}}class QV{constructor(e,n){this.color=n,this.changed=!1,this.data=e,this.type=new JV}set(e,n){return this.color=n,this.changed=!1,this.data=e,this.type.type=Ht.ALL,this}_ensureHSL(){const e=this.data,{h:n,s:r,l:i}=e;n===void 0&&(e.h=pe.channel.rgb2hsl(e,"h")),r===void 0&&(e.s=pe.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=pe.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r:n,g:r,b:i}=e;n===void 0&&(e.r=pe.channel.hsl2rgb(e,"r")),r===void 0&&(e.g=pe.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=pe.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,n=e.r;return!this.type.is(Ht.HSL)&&n!==void 0?n:(this._ensureHSL(),pe.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,n=e.g;return!this.type.is(Ht.HSL)&&n!==void 0?n:(this._ensureHSL(),pe.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,n=e.b;return!this.type.is(Ht.HSL)&&n!==void 0?n:(this._ensureHSL(),pe.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,n=e.h;return!this.type.is(Ht.RGB)&&n!==void 0?n:(this._ensureRGB(),pe.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,n=e.s;return!this.type.is(Ht.RGB)&&n!==void 0?n:(this._ensureRGB(),pe.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,n=e.l;return!this.type.is(Ht.RGB)&&n!==void 0?n:(this._ensureRGB(),pe.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(Ht.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(Ht.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(Ht.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(Ht.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(Ht.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(Ht.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const hw=new QV({r:0,g:0,b:0,a:0},"transparent"),Ra={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(Ra.re);if(!e)return;const n=e[1],r=parseInt(n,16),i=n.length,s=i%4===0,o=i>4,a=o?1:17,c=o?8:4,l=s?0:-1,u=o?255:15;return hw.set({r:(r>>c*(l+3)&u)*a,g:(r>>c*(l+2)&u)*a,b:(r>>c*(l+1)&u)*a,a:s?(r&u)*a/255:1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`#${is[Math.round(e)]}${is[Math.round(n)]}${is[Math.round(r)]}${is[Math.round(i*255)]}`:`#${is[Math.round(e)]}${is[Math.round(n)]}${is[Math.round(r)]}`}},Zs={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(Zs.hueRe);if(e){const[,n,r]=e;switch(r){case"grad":return pe.channel.clamp.h(parseFloat(n)*.9);case"rad":return pe.channel.clamp.h(parseFloat(n)*180/Math.PI);case"turn":return pe.channel.clamp.h(parseFloat(n)*360)}}return pe.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const n=t.match(Zs.re);if(!n)return;const[,r,i,s,o,a]=n;return hw.set({h:Zs._hue2deg(r),s:pe.channel.clamp.s(parseFloat(i)),l:pe.channel.clamp.l(parseFloat(s)),a:o?pe.channel.clamp.a(a?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:n,l:r,a:i}=t;return i<1?`hsla(${pe.lang.round(e)}, ${pe.lang.round(n)}%, ${pe.lang.round(r)}%, ${i})`:`hsl(${pe.lang.round(e)}, ${pe.lang.round(n)}%, ${pe.lang.round(r)}%)`}},gu={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=gu.colors[t];if(e)return Ra.parse(e)},stringify:t=>{const e=Ra.stringify(t);for(const n in gu.colors)if(gu.colors[n]===e)return n}},mu={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(mu.re);if(!n)return;const[,r,i,s,o,a,c,l,u]=n;return hw.set({r:pe.channel.clamp.r(i?parseFloat(r)*2.55:parseFloat(r)),g:pe.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:pe.channel.clamp.b(c?parseFloat(a)*2.55:parseFloat(a)),a:l?pe.channel.clamp.a(u?parseFloat(l)/100:parseFloat(l)):1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`rgba(${pe.lang.round(e)}, ${pe.lang.round(n)}, ${pe.lang.round(r)}, ${pe.lang.round(i)})`:`rgb(${pe.lang.round(e)}, ${pe.lang.round(n)}, ${pe.lang.round(r)})`}},ss={format:{keyword:gu,hex:Ra,rgb:mu,rgba:mu,hsl:Zs,hsla:Zs},parse:t=>{if(typeof t!="string")return t;const e=Ra.parse(t)||mu.parse(t)||Zs.parse(t)||gu.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(Ht.HSL)||t.data.r===void 0?Zs.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?mu.stringify(t):Ra.stringify(t)},ZV=(t,e)=>{const n=ss.parse(t);for(const r in e)n[r]=pe.channel.clamp[r](e[r]);return ss.stringify(n)},YA=t=>ss.format.hex.stringify(ss.parse(t)),eY=(t,e,n)=>{const r=ss.parse(t),i=r[e],s=pe.channel.clamp[e](i+n);return i!==s&&(r[e]=s),ss.stringify(r)},tY=(t,e)=>eY(t,"a",-e),nY=(t,e)=>{const n=ss.parse(t),r={};for(const i in e)e[i]&&(r[i]=n[i]+e[i]);return ZV(t,r)},rY=(t,e)=>{const n=ss.parse(t),r={},i=(s,o,a)=>o>0?(a-s)*o/100:s*o/100;for(const s in e)r[s]=i(n[s],e[s],pe.channel.max[s]);return nY(t,r)};class iY{value;next;constructor(e){this.value=e}}class sY{#e;#t;#n;constructor(){this.clear()}enqueue(e){const n=new iY(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 pp(t){XA(t);const e=new sY;let n=0;const r=()=>{n<t&&e.size>0&&(e.dequeue()(),n++)},i=()=>{n--,r()},s=async(c,l,u)=>{const d=(async()=>c(...u))();l(d);try{await d}catch{}i()},o=(c,l,u)=>{new Promise(d=>{e.enqueue(d)}).then(s.bind(void 0,c,l,u)),(async()=>(await Promise.resolve(),n<t&&r()))()},a=(c,...l)=>new Promise(u=>{o(c,u,l)});return Object.defineProperties(a,{activeCount:{get:()=>n},pendingCount:{get:()=>e.size},clearQueue:{value(){e.clear()}},concurrency:{get:()=>t,set(c){XA(c),t=c,queueMicrotask(()=>{for(;n<t&&e.size>0;)r()})}}}),a}function XA(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 oY=pp(1);let aY=class jp{static _graphviz=null;graphviz(){return Promise.resolve().then(()=>jp._graphviz??=Kp.load())}async attempt(e,n){return await oY(async()=>{try{return await n()}catch(r){Fe.error(r),Fe.error(`FAILED GraphvizWasmAdapter: ${e}`),Kp.unload(),jp._graphviz=null}Fe.warn("Retrying..."),await bT(50);try{return await n()}finally{Kp.unload(),jp._graphviz=null}})}async unflatten(e){return await this.attempt(`unflatten
1158
+ ${e}`,async()=>(await this.graphviz()).unflatten(e,1,!1,3).replaceAll(/\t\[/g," [").replaceAll(/\t/g," "))}async acyclic(e){return await this.attempt(`acyclic
1159
+ ${e}`,async()=>{const n=(await this.graphviz()).acyclic(e,!0);return n.acyclic&&n.outFile||e})}async layoutJson(e){return await this.attempt(`dot
1160
+ ${e}`,async()=>(await this.graphviz()).layout(e,"json",void 0,{yInvert:!0}))}async svg(e){return await this.attempt(`svg
1161
+ ${e}`,async()=>(await this.graphviz()).layout(e,"svg"))}};function JA(t,e){const n=t.nodes.map(i=>{const s=e.nodes[i.id];if(!s)return i;const{x:o,y:a,width:c,height:l}=s;return{...i,width:c,height:l,position:[o,a]}}),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 QA=(t,e)=>t.width>e.width+10||t.height>e.height+10;function cY(t,e){if(t.hash===e.hash)return{diagram:JA(t,e)};if(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||QA(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:JA(t,e)};const n=t.nodes.reduce((r,i)=>{const s=e.nodes[i.id];if(i.children.length>0||!s)return r;const o={id:i.id,center:{x:Math.round(s.x+s.width/2),y:Math.round(s.y+s.height/2)}};return s.isCompound||QA(i,s)||(o.fixedsize={width:s.width,height:s.height}),r.push(o),r},[]);return{relayout:{x:e.x,y:e.y,height:e.height,nodes:n,edges:na(e.edges).flatMap(([r,i])=>i.dotpos?{id:r,dotpos:i.dotpos}:[])}}}function _n(t){return t.children.length>0}function Gn(t){switch(t){case"open":return"vee";default:return t}}function Or(t){return Array.isArray(t)?[Or(t[0]),Or(t[1])]:(ce(isFinite(t),`Invalid not finite point value ${t}`),Math.round(t))}const ZA=t=>(ce(isFinite(t),`Invalid not finite inch value ${t}`),Math.floor(t*72)),tt=t=>Math.ceil(t/72*1e3)/1e3,zn=t=>Math.ceil(t);zn(40).toString();function eI(t,e){return YA(rY(t,{l:-35-5*e,s:-15-5*e}))}function lY(t){return YA(tY(t,.3))}function uY(t){return t.trim().replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function pw(t,e){return VV(t,{width:e,indent:"",escape:uY}).split(`
1162
+ `)}function os({text:t,maxchars:e,fontsize:n,bold:r,color:i}){let s=pw(t,e).map(a=>Yi(a)?" ":a).join("<BR/>");r&&(s=`<B>${s}</B>`);const o=i?` COLOR="${i}"`:"";return`<FONT POINT-SIZE="${zn(n)}"${o}>${s}</FONT>`}function dY(t,e){const n=Q(t.icon),r=[os({text:t.title,fontsize:19,maxchars:35})];if(Q(t.technology)&&r.push(os({text:t.technology,fontsize:12,maxchars:n?35:45,color:e.loContrast})),Q(t.description)&&r.push(os({text:t.description,fontsize:14,maxchars:n?35:45,color:e.loContrast})),r.length===1&&!n)return`<${r[0]}>`;const i=n?(s,o,a)=>{let c=`<TD ALIGN="TEXT" BALIGN="LEFT">${s}</TD>`;if(o===0){const l=a.length>1?` ROWSPAN="${a.length}"`:"";let u=76;(t.shape==="queue"||t.shape==="mobile")&&(u+=20),c=`<TD${l} WIDTH="${u}" FIXEDSIZE="TRUE"> </TD>${c}`,c=`${c}<TD${l} WIDTH="16" FIXEDSIZE="TRUE"> </TD>`}return`<TR>${c}</TR>`}:s=>`<TR><TD>${s}</TD></TR>`;return`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="6">${r.map(i).join("")}</TABLE>>`}function fY(t,e){const n=os({text:t.title.toUpperCase(),maxchars:50,fontsize:11,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 Sa=35;function hY({label:t,description:e,technology:n}){const r=[];if(Q(t)&&r.push(os({text:t,maxchars:Sa,fontsize:14,bold:t==="[...]"})),Q(e)&&r.push(os({text:e,maxchars:Sa,fontsize:14})),Q(n)&&r.push(os({text:n,fontsize:12,maxchars:Sa})),r.length===0)return null;const i=r.map(s=>`<TR><TD ALIGN="TEXT" BALIGN="LEFT">${s}</TD></TR>`).join("");return`<<TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0" ${gw}>${i}</TABLE>>`}const gw=`BGCOLOR="${Pn.relationships[fo].labelBgColor}A0"`;function pY(t,e){const n=`<TABLE FIXEDSIZE="TRUE" BORDER="0" CELLPADDING="6" ${gw}><TR><TD WIDTH="20" HEIGHT="20"><FONT POINT-SIZE="${zn(14)}"><B>${t}</B></FONT></TD></TR></TABLE>`;return Q(e)?`<${['<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">',"<TR>",`<TD>${n}</TD>`,`<TD ${gw} CELLPADDING="2">`,os({text:e,maxchars:Sa,fontsize:14}),"</TD>","</TR>","</TABLE>"].join("")}>`:`<${n}>`}const tI="dashed",mw=Pn.font;class nI{constructor(e){this.view=e,this.compoundIds=new Set(e.nodes.filter(_n).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):[]);const n=this.graphvizModel=this.createGraph();this.applyNodeAttributes(n.attributes.node),this.applyEdgeAttributes(n.attributes.edge),this.buildGraphvizModel(n)}ids=new Set;subgraphs=new Map;nodes=new Map;edges=new Map;compoundIds;edgesWithCompounds;graphvizModel;get hasEdgesWithCompounds(){return this.edgesWithCompounds.size>0}buildGraphvizModel(e){const n=(i,s)=>{const o=this.nodeId(i),a=this.elementToSubgraph(i,s.subgraph(o));this.subgraphs.set(i.id,a);for(const c of this.view.nodes.filter(l=>_n(l)&&l.parent===i.id))n(c,a)},r=[];for(const i of this.view.nodes)_n(i)?$t(i.parent)&&n(i,e):r.push(i);for(const i of r){const s=i.parent?this.getSubgraph(i.parent):e;ce(s,"parent graph should be defined");const o=this.nodeId(i),a=this.elementToNode(i,s.node(o));this.nodes.set(i.id,a)}for(const i of this.view.edges){const s=this.addEdge(i,e);s&&this.edges.set(i.id,s)}}print(){return VA(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}createGraph(){this.view.autoLayout==="TB"||this.view.autoLayout;const e=qV({[O.bgcolor]:"transparent",[O.layout]:"dot",[O.compound]:!0,[O.rankdir]:this.view.autoLayout,[O.TBbalance]:"min",[O.splines]:"spline",[O.outputorder]:"nodesfirst",[O.nodesep]:tt(110),[O.ranksep]:tt(120),[O.pack]:zn(120),[O.packmode]:"array_3",[O.pad]:tt(15),[O.forcelabels]:!0,[O.fontname]:mw});return e.attributes.graph.apply({[O.fontsize]:zn(15),[O.labeljust]:this.view.autoLayout==="RL"?"r":"l",[O.labelloc]:this.view.autoLayout==="BT"?"b":"t",[O.margin]:50.1}),e}applyNodeAttributes(e){e.apply({[O.fontname]:mw,[O.nojustify]:!0,[O.shape]:"rect",[O.width]:tt(320),[O.height]:tt(180),[O.style]:"filled",[O.penwidth]:0})}applyEdgeAttributes(e){e.apply({[O.nojustify]:!0,[O.arrowsize]:.75,[O.fontname]:mw,[O.fontsize]:zn(14),[O.penwidth]:zn(2),[O.color]:Pn.relationships[fo].lineColor,[O.fontcolor]:Pn.relationships[fo].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)}nodeId(e){const n=_n(e);let r=Oa(e.id).toLowerCase(),i=this.checkNodeId(r,n);if(i!==null)return i;let s=e.id,o;for(;o=Et(s);){if(r=Oa(o).toLowerCase()+"_"+r,i=this.checkNodeId(r,n),i!==null)return i;s=o}r=Oa(e.id).toLowerCase();let a=1;do i=this.checkNodeId(r+"_"+a++,n);while(i===null);return i}elementToSubgraph(e,n){ce(_n(e),"node should be compound"),ce(X_(e.depth),"node.depth should be defined");const r=this.getElementColorValues(e.color),i=lY(r.loContrast);return n.apply({[O.likec4_id]:e.id,[O.likec4_level]:e.level,[O.likec4_depth]:e.depth,[O.fillcolor]:eI(r.fill,e.depth),[O.color]:eI(r.stroke,e.depth),[O.style]:"filled",[O.margin]:zn(e.children.length>1?40:32),[O.label]:fY(e,i)}),n}elementToNode(e,n){ce(!_n(e),"node should not be compound");const r=Q(e.icon),i=this.getElementColorValues(e.color);switch(n.attributes.apply({[O.likec4_id]:e.id,[O.likec4_level]:e.level,[O.fillcolor]:i.fill,[O.fontcolor]:i.hiContrast,[O.color]:i.stroke,[O.margin]:`${tt(r?10:26)},${tt(26)}`}),e.shape){case"cylinder":case"storage":{n.attributes.apply({[O.margin]:`${tt(r?10:26)},${tt(0)}`,[O.penwidth]:zn(2),[O.shape]:"cylinder"});break}case"browser":{n.attributes.apply({[O.margin]:`${tt(r?10:30)},${tt(32)}`});break}case"mobile":{n.attributes.apply({[O.margin]:`${tt(r?10:30)},${tt(26)}`});break}case"queue":{n.attributes.apply({[O.width]:tt(320),[O.height]:tt(165),[O.margin]:`${tt(r?10:30)},${tt(26)}`});break}}return n.attributes.set(O.label,dY(e,i)),n}leafElements(e){if(e===null)return this.view.nodes.filter(r=>!_n(r));const n=e+".";return this.view.nodes.filter(r=>!_n(r)&&r.id.startsWith(n))}viewElement(e){return at(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.viewElement(e),i=this.getGraphNode(e),s;return i||(ce(_n(r),"endpoint node should be compound"),s=this.getSubgraph(e)?.id,ce(s,`subgraph ${e} not found`),r=at(n(this.leafElements(e)),`leaf element in ${e} not found`),i=at(this.getGraphNode(r.id),`source graphviz node ${r.id} not found`)),[r,i,s]}hasInternalEdges(e){return e===null?this.view.edges.length>0:this.view.edges.some(wT(e))}findInternalEdges(e){return e===null?this.view.edges.slice():this.view.edges.filter(wT(e))}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=We(this.view.nodes,He(_n),st(r=>r.id),Zc(Eo),H_(),st(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}}),He(({edges:r})=>r.length>1&&r.length<8),XW(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 o=at(this.getGraphNode(s.source),`Graphviz Node not found for ${s.source}`),a=at(this.getGraphNode(s.target),`Graphviz Node not found for ${s.target}`);n.add(s.source),n.add(s.target),o.attributes.set(O.group,r.id),a.attributes.set(O.group,r.id)}catch(o){Fe.error(o)}}}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:o,...a}of n.nodes){const c=this.getGraphNode(o);if(!c)continue;const l=tt(a.center.x)+r,u=tt(e-a.center.y);a.fixedsize?c.attributes.apply({[O.pos]:`${l},${u}!`,[O.pin]:!0,[O.width]:tt(a.fixedsize.width),[O.height]:tt(a.fixedsize.height),[O.fixedsize]:!0}):c.attributes.set(O.pos,`${l},${u}`)}for(const[o,a]of this.edges.entries()){a.attributes.delete(O.weight),a.attributes.delete(O.minlen),a.attributes.delete(O.constraint);const c=n.edges.find(l=>l.id===o)?.dotpos;c&&!s&&a.attributes.set(O.pos,c)}return this.graphvizModel.apply({[O.layout]:"fdp",[O.overlap]:"vpsc",[O.sep]:"+50,50",[O.esep]:"+10,10",[O.start]:"random2",[O.splines]:"compound"}),this.graphvizModel.delete(O.compound),this.graphvizModel.delete(O.rankdir),this.graphvizModel.delete(O.nodesep),this.graphvizModel.delete(O.ranksep),this.graphvizModel.delete(O.pack),this.graphvizModel.delete(O.pad),this.graphvizModel.delete(O.packmode),this.graphvizModel.attributes.graph.delete(O.margin),this}getRelationshipColorValues(e){return d0(e)?Pn.relationships[e]:this.view.customColorDefinitions[e]?.relationships??Pn.relationships[Du]}getElementColorValues(e){return d0(e)?Pn.elements[e]:this.view.customColorDefinitions[e]?.elements??Pn.elements[Du]}}class Db extends nI{static toDot(e){return new Db(e).print()}createGraph(){const e=super.createGraph();return e.set(O.TBbalance,"max"),e}addEdge(e,n){const{nodes:r}=this.view,[i,s]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[o,a,c]=this.edgeEndpoint(i,T=>el(T)),[l,u,d]=this.edgeEndpoint(s,tl),f=n.edge([a,u],{[O.likec4_id]:e.id,[O.style]:e.line??tI});if(d&&f.attributes.set(O.lhead,d),c&&f.attributes.set(O.ltail,c),e.color&&e.color!==fo){const T=this.getRelationshipColorValues(e.color);f.attributes.apply({[O.color]:T.lineColor,[O.fontcolor]:T.labelColor})}const h=xr(d)||xr(c),p=y0(e.id),y=pY(p,e.label?.trim());if(f.attributes.set(O.label,y),!h){const T=new Set([...o.outEdges,...l.inEdges,...wG(l.outEdges,o.inEdges)].filter(_=>!this.edgesWithCompounds.has(_)));f.attributes.set(O.weight,T.size)}const R=r.findIndex(T=>T.id===i);r.findIndex(T=>T.id===s)<R&&e.dir!=="back"&&f.attributes.apply({[O.constraint]:!1});let[b,v]=[e.head??uo,e.tail??"none"];return e.dir==="back"?(f.attributes.apply({[O.arrowtail]:Gn(b),[O.minlen]:0,[O.dir]:"back"}),v!=="none"&&f.attributes.apply({[O.arrowhead]:Gn(v),[O.dir]:"both"}),f):b==="none"&&v==="none"||b!=="none"&&v!=="none"?(f.attributes.apply({[O.arrowhead]:Gn(b),[O.arrowtail]:Gn(v),[O.dir]:"both"}),f):b==="none"?(f.attributes.delete(O.arrowhead),f.attributes.apply({[O.arrowtail]:Gn(v),[O.minlen]:0,[O.dir]:"back"}),f):(b!==uo&&f.attributes.set(O.arrowhead,Gn(b)),f)}}class Ob extends nI{static toDot(e){return new Ob(e).print()}buildGraphvizModel(e){super.buildGraphvizModel(e),this.assignGroups();const n=new Set,r=this.view.nodes.reduce((i,s)=>(_n(s)&&(n.add(s.id),i.push(s)),i),[]);for(const i of r){const s=We(i.children,He(l=>!this.compoundIds.has(l)),st(l=>this.viewElement(l)),He(l=>l.inEdges.length===0&&l.outEdges.length===0));if(s.length<=2)continue;let o=2;switch(!0){case s.length>11:o=4;break;case s.length>4:o=3;break}const a=at(this.getSubgraph(i.id),`Subgraph not found for ${i.id}`);let c=null;qG(s,o).forEach(l=>{const u=l.length>1?a.createSubgraph({[O.rank]:"same"}):null;l.forEach((d,f)=>{const h=this.getGraphNode(d.id);h&&(u?.node(h.id),f===0&&(c&&a.edge([c,h],{[O.style]:"invis"}),c=h))})})}}addEdge(e,n){const r=this.view.edges,[i,s]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[o,a,c]=this.edgeEndpoint(i,T=>el(T)),[l,u,d]=this.edgeEndpoint(s,tl),f=e.parent,h=(f===null?n:at(this.getSubgraph(f),`Parent not found for edge ${e.id}`)).edge([a,u],{[O.likec4_id]:e.id,[O.style]:e.line??tI});d&&h.attributes.set(O.lhead,d),c&&h.attributes.set(O.ltail,c);const p=xr(d)||xr(c);if(!p){const T=new Set([...o.inEdges,...o.outEdges,...l.inEdges,...l.outEdges].filter(_=>!this.edgesWithCompounds.has(_)));h.attributes.set(O.weight,T.size)}const y=hY(e);if(y&&(p?h.attributes.set(O.xlabel,y):h.attributes.set(O.label,y)),e.color){const T=this.getRelationshipColorValues(e.color);h.attributes.apply({[O.color]:T.lineColor,[O.fontcolor]:T.labelColor})}let[R,b]=[e.head??uo,e.tail??"none"];if(e.dir==="back")return h.attributes.apply({[O.arrowtail]:Gn(R),[O.dir]:"back"}),b!=="none"&&h.attributes.apply({[O.arrowhead]:Gn(b),[O.dir]:"both",[O.minlen]:0}),h;if(R==="none"&&b==="none")return h.attributes.apply({[O.arrowtail]:"none",[O.arrowhead]:"none",[O.dir]:"none",[O.minlen]:0,[O.constraint]:!1}),h;if(R!=="none"&&b!=="none")return h.attributes.apply({[O.arrowhead]:Gn(R),[O.arrowtail]:Gn(b),[O.dir]:"both",[O.minlen]:0}),h;if(R!==uo&&h.attributes.set(O.arrowhead,Gn(R)),b!=="none"&&h.attributes.set(O.arrowtail,Gn(b)),r.length===1)return h;let v;return f===null&&o.parent==null&&l.parent==null?v=r.filter(T=>{if(T.id===e.id||T.parent!==null||T.source===e.source&&T.target===e.target||T.source===e.target&&T.target===e.source)return!1;const _=this.viewElement(T.source),N=this.viewElement(T.target);return _n(_)||_n(N)?!1:_.parent==null&&N.parent==null}):v=this.findInternalEdges(f).filter(T=>!(T.id===e.id||T.source===e.source&&T.target===e.target||T.source===e.target&&T.target===e.source)),v.length===0&&(f===null||this.leafElements(f).length<=3)&&h.attributes.set(O.minlen,0),h}}function gp(t){const[e,n,r,i]=t?t.split(",").map(a=>Or(+a)):[0,0,0,0],s=Math.round(r-e),o=Math.round(n-i);return{x:Math.round(e),y:Math.round(i),width:s,height:o}}function gY(t){try{const[e,n]=t.split(",");return{x:Or(parseFloat(e)),y:Or(parseFloat(n))}}catch(e){throw Fe.error(`failed on parsing pos: ${t}`,e),e}}function rI({pos:t,width:e,height:n}){const{x:r,y:i}=gY(t),s=ZA(+e),o=ZA(+n);return{x:r-Math.round(s/2),y:i-Math.round(o/2),width:s,height:o}}function iI(t,[e,n]=[0,0]){if(!t||t.length===0)return null;let r=1/0,i=1/0,s=-1/0,o=-1/0,a=13;try{for(const l of t){if(l.op==="F"){a=Or(l.size);continue}if(l.op==="T"){let u=Or(l.pt[0])-e,d=Or(l.width);switch(l.align){case"r":u-=d;break;case"c":u-=Math.round(d/2);break}r=Math.min(r,u),s=Math.max(s,u+d);let f=Or(l.pt[1])-n;i=Math.min(i,Math.round(f-a)),o=Math.max(o,f)}}}catch(l){return Fe.error(`Failed on parsing label draw ops: ${l}
1163
+ ${JSON.stringify(t,null,2)}`),null}if(r===1/0)return null;const c=2;return{x:r-c,y:i-c,width:s-r+2*c,height:o-i+2*c}}function sI({_draw_:t,likec4_id:e="???"},n="<unknown view>"){try{const r=t.filter(s=>s.op.toLowerCase()==="b");ce(Ir(r,1),`view ${n} edge ${e} should have at least one bezier draw op`),r.length>1&&Fe.warn(`view ${n} edge ${e} has more than one bezier draw op, using the first one only`);const i=r[0].points.map(s=>Or(s));return ce(Ir(i,2),`view ${n} edge ${e} should have at least two points`),i}catch(r){throw Fe.error(`failed on parsing view ${n} edge ${e} _draw_:
1164
+ ${JSON.stringify(t,null,2)}`),r}}function mY(t,{id:e,source:n,target:r,dir:i,label:s,description:o,...a},c){const l=iI(t._ldraw_??t._tldraw_??t._hldraw_),u=t.dir==="back"||i==="back";return s=s?pw(s,Sa).join(`
1165
+ `):null,o=o?pw(o,Sa).join(`
1166
+ `):void 0,{id:e,source:n,target:r,label:s,...Q(o)&&{description:o},...Q(t.pos)&&{dotpos:t.pos},points:sI(t,c),labelBBox:l,...u?{dir:"back"}:{},...a}}function oI(t,e){const n=JSON.parse(t),r=gp(n.bb),{nodes:i,edges:s,manualLayout:o,...a}=e,c={...a,bounds:r,nodes:[],edges:[]},l=n.objects??[];for(const d of i){const f=l.find(v=>v.likec4_id===d.id);ce(f,`View ${a.id} element ${d.id} not found in graphviz output`);const{x:h,y:p,width:y,height:R}="bb"in f?gp(f.bb):rI(f),b=[h,p];c.nodes.push({...d,position:b,width:y,height:R,labelBBox:at(iI(f._ldraw_,b),`View ${a.id} Node ${d.id} label bbox not found`)})}const u=n.edges??[];for(const d of s){const f=u.find(h=>h.likec4_id===d.id);if(!f){Fe.warn(`View ${a.id} edge ${d.id} not found in graphviz output, skipping`);continue}c.edges.push(mY(f,d,a.id))}return c}const mp=t=>String(t+1).padStart(2,"0");function yY(t){const e=JSON.parse(t),n=gp(e.bb),r={nodes:[],edges:[],bounds:n},i=new Map,s=e.objects??[];for(const o of s){if(!o.likec4_type)continue;const a=mp(o._gvid),c=o.likec4_path??"",l=i.get(o._gvid),{x:u,y:d,width:f,height:h}="bb"in o?gp(o.bb):rI(o),p={x:u,y:d};if(o.likec4_type==="view")ce(o.likec4_id,`View ${o} has no likec4_id`),r.nodes.push({id:a,type:"view",parentId:l?.id??null,height:h,width:f,position:p,label:o.label??"",viewId:o.likec4_id});else{const y={id:a,type:o.likec4_type,parentId:l?.id??null,height:h,width:f,position:p,path:c,label:o.label??""},R=[..."subgraphs"in o?o.subgraphs:[],..."nodes"in o?o.nodes:[]];for(const b of R)i.set(b,y);r.nodes.push(y)}}for(const o of e.edges??[])try{const a=mp(o.tail),c=mp(o.head);r.edges.push({id:`link${mp(o._gvid)}`,source:a,target:c,points:sI(o)})}catch(a){Fe.warn(a)}return r}const aI=Pn.font,yp="/";class Lb{static toDot(e){return new Lb(e).print()}subgraphs=new Map;graphvizModel;constructor(e){const n=this.graphvizModel=WV.graph({[O.layout]:"osage",[O.pack]:zn(100),[O.packmode]:"array_ltc",[O.pad]:tt(15),[O.fontname]:aI,[O.splines]:"polyline",[O.esep]:"+20"});n.attributes.graph.apply({[O.fontsize]:zn(20),[O.labeljust]:"l",[O.labelloc]:"t"}),n.attributes.node.apply({[O.fontname]:aI,[O.shape]:"rect",[O.width]:tt(400),[O.height]:tt(300),[O.fixedsize]:!0,[O.fontsize]:10}),n.attributes.edge.apply({[O.penwidth]:zn(2)});const r=new Set(e.map(c=>c.relativePath??""));let i=0,s=[...e];const o=r.size>1;o&&s.sort((c,l)=>{const u=c.relativePath?.split(yp)??[""],d=l.relativePath?.split(yp)??[""];u.push(c.title??"Untitled"),d.push(l.title??"Untitled");const f=u.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 p=0;p<f;p++){const y=u[p].localeCompare(d[p]);if(y!==0)return y}return 0}}});const a=new Map;s.forEach((c,l)=>{this.addView(o?c:{...c,relativePath:""},l+i);const u=c.nodes.reduce((d,f)=>(f.navigateTo&&d.add(f.navigateTo),d),new Set);u.size>0&&a.set(c.id,u)});for(const[c,l]of a)for(const u of l)n.edge([c,u])}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),{[O.likec4_type]:i?"file":"folder",[O.likec4_path]:e,[O.sortv]:this.subgraphs.size,[O.label]:Q(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,{[O.likec4_type]:"view",[O.likec4_id]:e.id,[O.sortv]:n,[O.label]:e.title||"Untitled"})}print(){return VA(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}}const cI=t=>Qp(t)?new Db(t):new Ob(t);class vY{constructor(e){this.graphviz=e}get port(){return this.graphviz}changePort(e){this.graphviz=e}async layout(e){let n=await this.dot(e);const r=await this.graphviz.layoutJson(n);let i=oI(r,e);if(e.manualLayout){const s=cY(i,e.manualLayout);if(s.diagram)i=s.diagram;else{if(s.relayout.nodes.length>0){const o=cI(e);if(o.hasEdgesWithCompounds)Fe.warn(`Manual layout for view ${e.id} is ignored, as edges with compounds are not supported`);else{o.applyManualLayout(s.relayout);const a=await this.graphviz.layoutJson(o.print());i=oI(a,e)}}i.hasLayoutDrift=!0}}return n=n.split(`
1167
+ `).filter(s=>!(s.includes("margin")&&s.includes("50.1"))).join(`
1168
+ `),{dot:n,diagram:i}}async svg(e){let n=await this.dot(e);return n=n.split(`
1169
+ `).filter(r=>!(r.includes("margin")&&r.includes("50.1"))).join(`
1170
+ `),{svg:await this.graphviz.svg(n),dot:n}}async dot(e){let n=cI(e).print();if(Qp(e))return n;try{return await this.graphviz.unflatten(n)}catch(r){return Fe.warn(`Error during unflatten: ${e.id}`,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=Lb.toDot(e),r=await this.graphviz.layoutJson(n);return yY(r)}}function Hn(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 yw=(t,e)=>{const n=lI(t);if(typeof n!="string")throw new TypeError(`${e} must be a string or a file URL: ${n}.`);return n},lI=t=>t instanceof URL?qp(t):t,uI=(t,e=[],n={})=>{const r=yw(t,"First argument"),[i,s]=Hn(e)?[[],e]:[e,n];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);const o=i.map(String),a=o.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Hn(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[r,o,s]},{toString:dI}=Object.prototype,wY=t=>dI.call(t)==="[object ArrayBuffer]",lr=t=>dI.call(t)==="[object Uint8Array]",yu=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),bY=new TextEncoder,fI=t=>bY.encode(t),TY=new TextDecoder,hI=t=>TY.decode(t),EY=(t,e)=>RY(t,e).join(""),RY=(t,e)=>{if(e==="utf8"&&t.every(s=>typeof s=="string"))return t;const n=new Wb(e),r=t.map(s=>typeof s=="string"?fI(s):s).map(s=>n.write(s)),i=n.end();return i===""?r:[...r,i]},vw=t=>t.length===1&&lr(t[0])?t[0]:pI(SY(t)),SY=t=>t.map(e=>typeof e=="string"?fI(e):e),pI=t=>{const e=new Uint8Array($Y(t));let n=0;for(const r of t)e.set(r,n),n+=r.length;return e},$Y=t=>{let e=0;for(const n of t)e+=n.length;return e},kY=t=>Array.isArray(t)&&Array.isArray(t.raw),_Y=(t,e)=>{let n=[];for(const[s,o]of t.entries())n=CY({templates:t,expressions:e,tokens:n,index:s,template:o});if(n.length===0)throw new TypeError("Template script must not be empty");const[r,...i]=n;return[r,i,{}]},CY=({templates:t,expressions:e,tokens:n,index:r,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[r]}`);const{nextTokens:s,leadingWhitespaces:o,trailingWhitespaces:a}=AY(i,t.raw[r]),c=mI(n,s,o);if(r===e.length)return c;const l=e[r],u=Array.isArray(l)?l.map(d=>yI(d)):[yI(l)];return mI(c,u,a)},AY=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};const n=[];let r=0;const i=gI.has(e[0]);for(let o=0,a=0;o<t.length;o+=1,a+=1){const c=e[a];if(gI.has(c))r!==o&&n.push(t.slice(r,o)),r=o+1;else if(c==="\\"){const l=e[a+1];l==="u"&&e[a+2]==="{"?a=e.indexOf("}",a+3):a+=IY[l]??1}}const s=r===t.length;return s||n.push(t.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:s}},gI=new Set([" "," ","\r",`
1171
+ `]),IY={x:3,u:5},mI=(t,e,n)=>n||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],yI=t=>{const e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Hn(t)&&("stdout"in t||"isMaxBuffer"in t))return xY(t);throw t instanceof qb||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},xY=({stdout:t})=>{if(typeof t=="string")return t;if(lr(t))return hI(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)},eo=t=>ww.includes(t),ww=[Ke.stdin,Ke.stdout,Ke.stderr],Lr=["stdin","stdout","stderr"],vI=t=>Lr[t]??`stdio[${t}]`,PY=t=>{const e={...t};for(const n of EI)e[n]=wI(t,n);return e},wI=(t,e)=>{const n=Array.from({length:NY(t)+1}),r=DY(t[e],n,e);return jY(r,e)},NY=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Lr.length):Lr.length,DY=(t,e,n)=>Hn(t)?OY(t,e,n):e.fill(t),OY=(t,e,n)=>{for(const r of Object.keys(t).sort(LY))for(const i of MY(r,n,e))e[i]=t[r];return e},LY=(t,e)=>bI(t)<bI(e)?1:-1,bI=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,MY=(t,e,n)=>{if(t==="ipc")return[n.length-1];const r=TI(t);if(r===void 0||r===0)throw new TypeError(`"${e}.${t}" is invalid.
1172
+ It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(r>=n.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist.
1173
+ Please set the "stdio" option to ensure that file descriptor exists.`);return r==="all"?[1,2]:[r]},TI=t=>{if(t==="all")return t;if(Lr.includes(t))return Lr.indexOf(t);const e=FY.exec(t);if(e!==null)return Number(e[1])},FY=/^fd(\d+)$/,jY=(t,e)=>t.map(n=>n===void 0?BY[e]:n),UY=MN("execa").enabled?"full":"none",BY={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:UY,stripFinalNewline:!0},EI=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],vu=(t,e)=>e==="ipc"?t.at(-1):t[e],bw=({verbose:t},e)=>Ew(t,e)!=="none",Tw=({verbose:t},e)=>!["none","short"].includes(Ew(t,e)),qY=({verbose:t},e)=>{const n=Ew(t,e);return Rw(n)?n:void 0},Ew=(t,e)=>e===void 0?WY(t):vu(t,e),WY=t=>t.find(e=>Rw(e))??Sw.findLast(e=>t.includes(e)),Rw=t=>typeof t=="function",Sw=["none","short","full"],GY=(t,e)=>{const n=[t,...e],r=n.join(" "),i=n.map(s=>XY(RI(s))).join(" ");return{command:r,escapedCommand:i}},$w=t=>FN(t).split(`
1174
+ `).map(e=>RI(e)).join(`
1175
+ `),RI=t=>t.replaceAll(KY,e=>zY(e)),zY=t=>{const e=VY[t];if(e!==void 0)return e;const n=t.codePointAt(0),r=n.toString(16);return n<=YY?`\\u${r.padStart(4,"0")}`:`\\U${r}`},HY=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},KY=HY(),VY={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},YY=65535,XY=t=>JY.test(t)?t:WN==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,JY=/^[\w./-]+$/;function QY(){return Ke.platform!=="win32"?Ke.env.TERM!=="linux":!!Ke.env.WT_SESSION||!!Ke.env.TERMINUS_SUBLIME||Ke.env.ConEmuTask==="{cmd::Cmder}"||Ke.env.TERM_PROGRAM==="Terminus-Sublime"||Ke.env.TERM_PROGRAM==="vscode"||Ke.env.TERM==="xterm-256color"||Ke.env.TERM==="alacritty"||Ke.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const SI={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},ZY={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},eX={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},tX={...SI,...ZY},nX={...SI,...eX},rX=QY(),kw=rX?tX:nX,iX=Gb.WriteStream.prototype.hasColors(),vp=(t,e)=>{if(!iX)return i=>i;const n=`\x1B[${t}m`,r=`\x1B[${e}m`;return i=>{const s=i+"";let o=s.indexOf(r);if(o===-1)return n+s+r;let a=n,c=0;for(;o!==-1;)a+=s.slice(c,o)+n,c=o+r.length,o=s.indexOf(r,c);return a+=s.slice(c)+r,a}},sX=vp(1,22),_w=vp(90,39),oX=vp(91,39),aX=vp(93,39),cX=({type:t,message:e,timestamp:n,piped:r,commandId:i,result:{failed:s=!1}={},options:{reject:o=!0}})=>{const a=lX(n),c=uX[t]({failed:s,reject:o,piped:r}),l=dX[t]({reject:o});return`${_w(`[${a}]`)} ${_w(`[${i}]`)} ${l(c)} ${l(e)}`},lX=t=>`${wp(t.getHours(),2)}:${wp(t.getMinutes(),2)}:${wp(t.getSeconds(),2)}.${wp(t.getMilliseconds(),3)}`,wp=(t,e)=>String(t).padStart(e,"0"),$I=({failed:t,reject:e})=>t?e?kw.cross:kw.warning:kw.tick,uX={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:$I,duration:$I},kI=t=>t,dX={command:()=>sX,output:()=>kI,ipc:()=>kI,error:({reject:t})=>t?oX:aX,duration:()=>_w},fX=(t,e,n)=>{const r=qY(e,n);return t.map(({verboseLine:i,verboseObject:s})=>hX(i,s,r)).filter(i=>i!==void 0).map(i=>pX(i)).join("")},hX=(t,e,n)=>{if(n===void 0)return t;const r=n(t,e);if(typeof r=="string")return r},pX=t=>t.endsWith(`
1176
+ `)?t:`${t}
1177
+ `,wu=({type:t,verboseMessage:e,fdNumber:n,verboseInfo:r,result:i})=>{const s=gX({type:t,result:i,verboseInfo:r}),o=mX(e,s),a=fX(o,r,n);Fb(vX,a)},gX=({type:t,result:e,verboseInfo:{escapedCommand:n,commandId:r,rawOptions:{piped:i=!1,...s}}})=>({type:t,escapedCommand:n,commandId:`${r}`,timestamp:new Date,piped:i,result:e,options:s}),mX=(t,e)=>t.split(`
1178
+ `).map(n=>yX({...e,message:n})),yX=t=>({verboseLine:cX(t),verboseObject:t}),vX=2,_I=t=>{const e=typeof t=="string"?t:Bb(t);return $w(e).replaceAll(" "," ".repeat(wX))},wX=2,bX=(t,e)=>{bw(e)&&wu({type:"command",verboseMessage:t,verboseInfo:e})},TX=(t,e,n)=>{SX(t);const r=EX(t);return{verbose:t,escapedCommand:e,commandId:r,rawOptions:n}},EX=t=>bw({verbose:t})?RX++:void 0;let RX=0n;const SX=t=>{for(const e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Sw.includes(e)&&!Rw(e)){const n=Sw.map(r=>`'${r}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${n} or a function.`)}}},CI=()=>Au.bigint(),AI=t=>Number(Au.bigint()-t)/1e6,II=(t,e,n)=>{const r=CI(),{command:i,escapedCommand:s}=GY(t,e),o=wI(n,"verbose"),a=TX(o,s,{...n});return bX(s,a),{command:i,escapedCommand:s,startTime:r,verboseInfo:a}};var $a={exports:{}},Cw,xI;function $X(){if(xI)return Cw;xI=1,Cw=r,r.sync=i;var t=Iu;function e(s,o){var a=o.pathExt!==void 0?o.pathExt:process.env.PATHEXT;if(!a||(a=a.split(";"),a.indexOf("")!==-1))return!0;for(var c=0;c<a.length;c++){var l=a[c].toLowerCase();if(l&&s.substr(-l.length).toLowerCase()===l)return!0}return!1}function n(s,o,a){return!s.isSymbolicLink()&&!s.isFile()?!1:e(o,a)}function r(s,o,a){t.stat(s,function(c,l){a(c,c?!1:n(l,s,o))})}function i(s,o){return n(t.statSync(s),s,o)}return Cw}var Aw,PI;function kX(){if(PI)return Aw;PI=1,Aw=e,e.sync=n;var t=Iu;function e(s,o,a){t.stat(s,function(c,l){a(c,c?!1:r(l,o))})}function n(s,o){return r(t.statSync(s),o)}function r(s,o){return s.isFile()&&i(s,o)}function i(s,o){var a=s.mode,c=s.uid,l=s.gid,u=o.uid!==void 0?o.uid:process.getuid&&process.getuid(),d=o.gid!==void 0?o.gid:process.getgid&&process.getgid(),f=parseInt("100",8),h=parseInt("010",8),p=parseInt("001",8),y=f|h,R=a&p||a&h&&l===d||a&f&&c===u||a&y&&u===0;return R}return Aw}var bp;process.platform==="win32"||gt.TESTING_WINDOWS?bp=$X():bp=kX();var _X=Iw;Iw.sync=CX;function Iw(t,e,n){if(typeof e=="function"&&(n=e,e={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,i){Iw(t,e||{},function(s,o){s?i(s):r(o)})})}bp(t,e||{},function(r,i){r&&(r.code==="EACCES"||e&&e.ignoreErrors)&&(r=null,i=!1),n(r,i)})}function CX(t,e){try{return bp.sync(t,e||{})}catch(n){if(e&&e.ignoreErrors||n.code==="EACCES")return!1;throw n}}const ka=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",NI=Pa,AX=ka?";":":",DI=_X,OI=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),LI=(t,e)=>{const n=e.colon||AX,r=t.match(/\//)||ka&&t.match(/\\/)?[""]:[...ka?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(n)],i=ka?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=ka?i.split(n):[""];return ka&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:r,pathExt:s,pathExtExe:i}},MI=(t,e,n)=>{typeof e=="function"&&(n=e,e={}),e||(e={});const{pathEnv:r,pathExt:i,pathExtExe:s}=LI(t,e),o=[],a=l=>new Promise((u,d)=>{if(l===r.length)return e.all&&o.length?u(o):d(OI(t));const f=r[l],h=/^".*"$/.test(f)?f.slice(1,-1):f,p=NI.join(h,t),y=!h&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;u(c(y,l,0))}),c=(l,u,d)=>new Promise((f,h)=>{if(d===i.length)return f(a(u+1));const p=i[d];DI(l+p,{pathExt:s},(y,R)=>{if(!y&&R)if(e.all)o.push(l+p);else return f(l+p);return f(c(l,u,d+1))})});return n?a(0).then(l=>n(null,l),n):a(0)},IX=(t,e)=>{e=e||{};const{pathEnv:n,pathExt:r,pathExtExe:i}=LI(t,e),s=[];for(let o=0;o<n.length;o++){const a=n[o],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=NI.join(c,t),u=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+l:l;for(let d=0;d<r.length;d++){const f=u+r[d];try{if(DI.sync(f,{pathExt:i}))if(e.all)s.push(f);else return f}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw OI(t)};var xX=MI;MI.sync=IX;var xw={exports:{}};const FI=(t={})=>{const e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};xw.exports=FI,xw.exports.default=FI;var PX=xw.exports;const jI=Pa,NX=xX,DX=PX;function UI(t,e){const n=t.options.env||process.env,r=process.cwd(),i=t.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let o;try{o=NX.sync(t.command,{path:n[DX({env:n})],pathExt:e?jI.delimiter:void 0})}catch{}finally{s&&process.chdir(r)}return o&&(o=jI.resolve(i?t.options.cwd:"",o)),o}function OX(t){return UI(t)||UI(t,!0)}var LX=OX,Pw={};const Nw=/([()\][%!^"`<>&|;, *?])/g;function MX(t){return t=t.replace(Nw,"^$1"),t}function FX(t,e){return t=`${t}`,t=t.replace(/(\\*)"/g,'$1$1\\"'),t=t.replace(/(\\*)$/,"$1$1"),t=`"${t}"`,t=t.replace(Nw,"^$1"),e&&(t=t.replace(Nw,"^$1")),t}Pw.command=MX,Pw.argument=FX;var jX=/^#!(.*)/;const UX=jX;var BX=(t="")=>{const e=t.match(UX);if(!e)return null;const[n,r]=e[0].replace(/#! ?/,"").split(" "),i=n.split("/").pop();return i==="env"?r:r?`${i} ${r}`:i};const Dw=Iu,qX=BX;function WX(t){const n=Buffer.alloc(150);let r;try{r=Dw.openSync(t,"r"),Dw.readSync(r,n,0,150,0),Dw.closeSync(r)}catch{}return qX(n.toString())}var GX=WX;const zX=Pa,BI=LX,qI=Pw,HX=GX,KX=process.platform==="win32",VX=/\.(?:com|exe)$/i,YX=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function XX(t){t.file=BI(t);const e=t.file&&HX(t.file);return e?(t.args.unshift(t.file),t.command=e,BI(t)):t.file}function JX(t){if(!KX)return t;const e=XX(t),n=!VX.test(e);if(t.options.forceShell||n){const r=YX.test(e);t.command=zX.normalize(t.command),t.command=qI.command(t.command),t.args=t.args.map(s=>qI.argument(s,r));const i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function QX(t,e,n){e&&!Array.isArray(e)&&(n=e,e=null),e=e?e.slice(0):[],n=Object.assign({},n);const r={command:t,args:e,options:n,file:void 0,original:{command:t,args:e}};return n.shell?r:JX(r)}var ZX=QX;const Ow=process.platform==="win32";function Lw(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function eJ(t,e){if(!Ow)return;const n=t.emit;t.emit=function(r,i){if(r==="exit"){const s=WI(i,e);if(s)return n.call(t,"error",s)}return n.apply(t,arguments)}}function WI(t,e){return Ow&&t===1&&!e.file?Lw(e.original,"spawn"):null}function tJ(t,e){return Ow&&t===1&&!e.file?Lw(e.original,"spawnSync"):null}var nJ={hookChildProcess:eJ,verifyENOENT:WI,verifyENOENTSync:tJ,notFoundError:Lw};const GI=zb,Mw=ZX,Fw=nJ;function zI(t,e,n){const r=Mw(t,e,n),i=GI.spawn(r.command,r.args,r.options);return Fw.hookChildProcess(i,r),i}function rJ(t,e,n){const r=Mw(t,e,n),i=GI.spawnSync(r.command,r.args,r.options);return i.error=i.error||Fw.verifyENOENTSync(i.status,r),i}$a.exports=zI,$a.exports.spawn=zI,$a.exports.sync=rJ,$a.exports._parse=Mw,$a.exports._enoent=Fw;var iJ=$a.exports;const sJ=Io(iJ);function HI(t={}){const{env:e=process.env,platform:n=process.platform}=t;return n!=="win32"?"PATH":Object.keys(e).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"}const oJ=({cwd:t=Ke.cwd(),path:e=Ke.env[HI()],preferLocal:n=!0,execPath:r=Ke.execPath,addExecPath:i=!0}={})=>{const s=t instanceof URL?qp(t):t,o=Br.resolve(s),a=[];return n&&aJ(a,o),i&&cJ(a,r,o),[...a,e].join(Br.delimiter)},aJ=(t,e)=>{let n;for(;n!==e;)t.push(Br.join(e,"node_modules/.bin")),n=e,e=Br.resolve(e,"..")},cJ=(t,e,n)=>{const r=e instanceof URL?qp(e):e;t.push(Br.resolve(n,r,".."))},lJ=({env:t=Ke.env,...e}={})=>{t={...t};const n=HI({env:t});return e.path=t[n],t[n]=oJ(e),t},uJ=(t,e,n)=>{const r=n?Bw:Uw,i=t instanceof bu?{}:{cause:t};return new r(e,i)};class bu extends Error{}const KI=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,VI,{value:!0,writable:!1,enumerable:!1,configurable:!1})},dJ=t=>jw(t)&&VI in t,VI=Symbol("isExecaError"),jw=t=>Object.prototype.toString.call(t)==="[object Error]";class Uw extends Error{}KI(Uw,Uw.name);class Bw extends Error{}KI(Bw,Bw.name);const fJ=()=>{const t=XI-YI+1;return Array.from({length:t},hJ)},hJ=(t,e)=>({name:`SIGRT${e+1}`,number:YI+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),YI=34,XI=64,pJ=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}],JI=()=>{const t=fJ();return[...pJ,...t].map(gJ)},gJ=({name:t,number:e,description:n,action:r,forced:i=!1,standard:s})=>{const{signals:{[t]:o}}=Rs,a=o!==void 0;return{name:t,number:a?o:e,description:n,supported:a,action:r,forced:i,standard:s}},mJ=()=>{const t=JI();return Object.fromEntries(t.map(yJ))},yJ=({name:t,number:e,description:n,supported:r,action:i,forced:s,standard:o})=>[t,{name:t,number:e,description:n,supported:r,action:i,forced:s,standard:o}],vJ=mJ(),wJ=()=>{const t=JI(),e=XI+1,n=Array.from({length:e},(r,i)=>bJ(i,t));return Object.assign({},...n)},bJ=(t,e)=>{const n=TJ(t,e);if(n===void 0)return{};const{name:r,description:i,supported:s,action:o,forced:a,standard:c}=n;return{[t]:{name:r,number:t,description:i,supported:s,action:o,forced:a,standard:c}}},TJ=(t,e)=>{const n=e.find(({name:r})=>Rs.signals[r]===t);return n!==void 0?n:e.find(r=>r.number===t)};wJ();const EJ=t=>{const e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return QI(t,e)},RJ=t=>t===0?t:QI(t,"`subprocess.kill()`'s argument"),QI=(t,e)=>{if(Number.isInteger(t))return SJ(t,e);if(typeof t=="string")return kJ(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer.
1179
+ ${qw()}`)},SJ=(t,e)=>{if(ZI.has(t))return ZI.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist.
1180
+ ${qw()}`)},$J=()=>new Map(Object.entries(Rs.signals).reverse().map(([t,e])=>[e,t])),ZI=$J(),kJ=(t,e)=>{if(t in Rs.signals)return t;throw t.toUpperCase()in Rs.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist.
1181
+ ${qw()}`)},qw=()=>`Available signal names: ${_J()}.
1182
+ Available signal numbers: ${CJ()}.`,_J=()=>Object.keys(Rs.signals).sort().map(t=>`'${t}'`).join(", "),CJ=()=>[...new Set(Object.values(Rs.signals).sort((t,e)=>t-e))].join(", "),ex=t=>vJ[t].description,AJ=t=>{if(t===!1)return t;if(t===!0)return IJ;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},IJ=1e3*5,xJ=({kill:t,options:{forceKillAfterDelay:e,killSignal:n},onInternalError:r,context:i,controller:s},o,a)=>{const{signal:c,error:l}=PJ(o,a,n);NJ(l,r);const u=t(c);return DJ({kill:t,signal:c,forceKillAfterDelay:e,killSignal:n,killResult:u,context:i,controller:s}),u},PJ=(t,e,n)=>{const[r=n,i]=jw(t)?[void 0,t]:[t,e];if(typeof r!="string"&&!Number.isInteger(r))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(r)}`);if(i!==void 0&&!jw(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:RJ(r),error:i}},NJ=(t,e)=>{t!==void 0&&e.reject(t)},DJ=async({kill:t,signal:e,forceKillAfterDelay:n,killSignal:r,killResult:i,context:s,controller:o})=>{e===r&&i&&tx({kill:t,forceKillAfterDelay:n,context:s,controllerSignal:o.signal})},tx=async({kill:t,forceKillAfterDelay:e,context:n,controllerSignal:r})=>{if(e!==!1)try{await Hb(e,void 0,{signal:r}),t("SIGKILL")&&(n.isForcefullyTerminated??=!0)}catch{}},nx=async(t,e)=>{t.aborted||await on(t,"abort",{signal:e})},OJ=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},LJ=({subprocess:t,cancelSignal:e,gracefulCancel:n,context:r,controller:i})=>e===void 0||n?[]:[MJ(t,e,r,i)],MJ=async(t,e,n,{signal:r})=>{throw await nx(e,r),n.terminationReason??="cancel",t.kill(),e.reason},Ww=({methodName:t,isSubprocess:e,ipc:n,isConnected:r})=>{FJ(t,e,n),rx(t,e,r)},FJ=(t,e,n)=>{if(!n)throw new Error(`${ur(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},rx=(t,e,n)=>{if(!n)throw new Error(`${ur(t,e)} cannot be used: the ${as(e)} has already exited or disconnected.`)},jJ=t=>{throw new Error(`${ur("getOneMessage",t)} could not complete: the ${as(t)} exited or disconnected.`)},UJ=t=>{throw new Error(`${ur("sendMessage",t)} failed: the ${as(t)} is sending a message too, instead of listening to incoming messages.
1183
+ This can be fixed by both sending a message and listening to incoming messages at the same time:
1184
+
1185
+ const [receivedMessage] = await Promise.all([
1186
+ ${ur("getOneMessage",t)},
1187
+ ${ur("sendMessage",t,"message, {strict: true}")},
1188
+ ]);`)},ix=(t,e)=>new Error(`${ur("sendMessage",e)} failed when sending an acknowledgment response to the ${as(e)}.`,{cause:t}),BJ=t=>{throw new Error(`${ur("sendMessage",t)} failed: the ${as(t)} is not listening to incoming messages.`)},qJ=t=>{throw new Error(`${ur("sendMessage",t)} failed: the ${as(t)} exited without listening to incoming messages.`)},WJ=()=>new Error(`\`cancelSignal\` aborted: the ${as(!0)} disconnected.`),GJ=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},zJ=({error:t,methodName:e,isSubprocess:n})=>{if(t.code==="EPIPE")throw new Error(`${ur(e,n)} cannot be used: the ${as(n)} is disconnecting.`,{cause:t})},HJ=({error:t,methodName:e,isSubprocess:n,message:r})=>{if(KJ(t))throw new Error(`${ur(e,n)}'s argument type is invalid: the message cannot be serialized: ${String(r)}.`,{cause:t})},KJ=({code:t,message:e})=>VJ.has(t)||YJ.some(n=>e.includes(n)),VJ=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),YJ=["could not be cloned","circular structure","call stack size exceeded"],ur=(t,e,n="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${XJ(e)}${t}(${n})`,XJ=t=>t?"":"subprocess.",as=t=>t?"parent process":"subprocess",Gw=t=>{t.connected&&t.disconnect()},Tu=()=>{const t={},e=new Promise((n,r)=>{Object.assign(t,{resolve:n,reject:r})});return Object.assign(e,t)},sx=(t,e="stdin")=>{const{options:r,fileDescriptors:i}=to.get(t),s=ox(i,e,!0),o=t.stdio[s];if(o===null)throw new TypeError(ax(s,e,r,!0));return o},zw=(t,e="stdout")=>{const{options:r,fileDescriptors:i}=to.get(t),s=ox(i,e,!1),o=s==="all"?t.all:t.stdio[s];if(o==null)throw new TypeError(ax(s,e,r,!1));return o},to=new WeakMap,ox=(t,e,n)=>{const r=JJ(e,n);return QJ(r,e,n,t),r},JJ=(t,e)=>{const n=TI(t);if(n!==void 0)return n;const{validOptions:r,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Eu(e)}" must not be "${t}".
1189
+ It must be ${r} or "fd3", "fd4" (and so on).
1190
+ It is optional and defaults to "${i}".`)},QJ=(t,e,n,r)=>{const i=r[cx(t)];if(i===void 0)throw new TypeError(`"${Eu(n)}" must not be ${e}. That file descriptor does not exist.
1191
+ Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!n)throw new TypeError(`"${Eu(n)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&n)throw new TypeError(`"${Eu(n)}" must not be ${e}. It must be a writable stream, not readable.`)},ax=(t,e,n,r)=>{if(t==="all"&&!n.all)return`The "all" option must be true to use "from: 'all'".`;const{optionName:i,optionValue:s}=ZJ(t,n);return`The "${i}: ${Hw(s)}" option is incompatible with using "${Eu(r)}: ${Hw(e)}".
1192
+ Please set this option with "pipe" instead.`},ZJ=(t,{stdin:e,stdout:n,stderr:r,stdio:i})=>{const s=cx(t);return s===0&&e!==void 0?{optionName:"stdin",optionValue:e}:s===1&&n!==void 0?{optionName:"stdout",optionValue:n}:s===2&&r!==void 0?{optionName:"stderr",optionValue:r}:{optionName:`stdio[${s}]`,optionValue:i[s]}},cx=t=>t==="all"?1:t,Eu=t=>t?"to":"from",Hw=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream",Tp=(t,e,n)=>{const r=t.getMaxListeners();r===0||r===Number.POSITIVE_INFINITY||(t.setMaxListeners(r+e),Vb(n,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))},lx=(t,e)=>{e&&Kw(t)},Kw=t=>{t.refCounted()},ux=(t,e)=>{e&&Vw(t)},Vw=t=>{t.unrefCounted()},eQ=(t,e)=>{e&&(Vw(t),Vw(t))},tQ=(t,e)=>{e&&(Kw(t),Kw(t))},nQ=async({anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r},i)=>{if(lQ(i)||TQ(i))return;Ep.has(t)||Ep.set(t,[]);const s=Ep.get(t);if(s.push(i),!(s.length>1))for(;s.length>0;){await pQ(t,r,i),await Kb.yield();const o=await cQ({wrappedMessage:s[0],anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r});s.shift(),r.emit("message",o),r.emit("message:done")}},rQ=async({anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{yx();const s=Ep.get(t);for(;s?.length>0;)await on(r,"message:done");t.removeListener("message",i),tQ(e,n),r.connected=!1,r.emit("disconnect")},Ep=new WeakMap,Rp=(t,e,n)=>{if(Sp.has(t))return Sp.get(t);const r=new KN;return r.connected=!0,Sp.set(t,r),iQ({ipcEmitter:r,anyProcess:t,channel:e,isSubprocess:n}),r},Sp=new WeakMap,iQ=({ipcEmitter:t,anyProcess:e,channel:n,isSubprocess:r})=>{const i=nQ.bind(void 0,{anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:t});e.on("message",i),e.once("disconnect",rQ.bind(void 0,{anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:t,boundOnMessage:i})),eQ(n,r)},dx=t=>{const e=Sp.get(t);return e===void 0?t.channel!==null:e.connected},sQ=({anyProcess:t,channel:e,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;const s=Rp(t,e,n),o=Yw(t,s);return{id:oQ++,type:kp,message:r,hasListeners:o}};let oQ=0n;const aQ=(t,e)=>{if(!(e?.type!==kp||e.hasListeners))for(const{id:n}of t)n!==void 0&&$p[n].resolve({isDeadlock:!0,hasListeners:!1})},cQ=async({wrappedMessage:t,anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(t?.type!==kp||!e.connected)return t;const{id:s,message:o}=t,a={id:s,type:fx,message:Yw(e,i)};try{await hx({anyProcess:e,channel:n,isSubprocess:r,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return o},lQ=t=>{if(t?.type!==fx)return!1;const{id:e,message:n}=t;return $p[e]?.resolve({isDeadlock:!1,hasListeners:n}),!0},uQ=async(t,e,n)=>{if(t?.type!==kp)return;const r=Tu();$p[t.id]=r;const i=new AbortController;try{const{isDeadlock:s,hasListeners:o}=await Promise.race([r,dQ(e,n,i)]);s&&UJ(n),o||BJ(n)}finally{i.abort(),delete $p[t.id]}},$p={},dQ=async(t,e,{signal:n})=>{Tp(t,1,n),await on(t,"disconnect",{signal:n}),qJ(e)},kp="execa:ipc:request",fx="execa:ipc:response",fQ=(t,e,n)=>{Ru.has(t)||Ru.set(t,new Set);const r=Ru.get(t),i=Tu(),s=n?e.id:void 0,o={onMessageSent:i,id:s};return r.add(o),{outgoingMessages:r,outgoingMessage:o}},hQ=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},pQ=async(t,e,n)=>{for(;!Yw(t,e)&&Ru.get(t)?.size>0;){const r=[...Ru.get(t)];aQ(r,n),await Promise.all(r.map(({onMessageSent:i})=>i))}},Ru=new WeakMap,Yw=(t,e)=>e.listenerCount("message")>gQ(t),gQ=t=>to.has(t)&&!vu(to.get(t).options.buffer,"ipc")?1:0,hx=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},i,{strict:s=!1}={})=>{const o="sendMessage";return Ww({methodName:o,isSubprocess:n,ipc:r,isConnected:t.connected}),mQ({anyProcess:t,channel:e,methodName:o,isSubprocess:n,message:i,strict:s})},mQ=async({anyProcess:t,channel:e,methodName:n,isSubprocess:r,message:i,strict:s})=>{const o=sQ({anyProcess:t,channel:e,isSubprocess:r,message:i,strict:s}),a=fQ(t,o,s);try{await px({anyProcess:t,methodName:n,isSubprocess:r,wrappedMessage:o,message:i})}catch(c){throw Gw(t),c}finally{hQ(a)}},px=async({anyProcess:t,methodName:e,isSubprocess:n,wrappedMessage:r,message:i})=>{const s=yQ(t);try{await Promise.all([uQ(r,t,n),s(r)])}catch(o){throw zJ({error:o,methodName:e,isSubprocess:n}),HJ({error:o,methodName:e,isSubprocess:n,message:i}),o}},yQ=t=>{if(Xw.has(t))return Xw.get(t);const e=jN(t.send.bind(t));return Xw.set(t,e),e},Xw=new WeakMap,vQ=(t,e)=>{const n="cancelSignal";return rx(n,!1,t.connected),px({anyProcess:t,methodName:n,isSubprocess:!1,wrappedMessage:{type:mx,message:e},message:e})},wQ=async({anyProcess:t,channel:e,isSubprocess:n,ipc:r})=>(await bQ({anyProcess:t,channel:e,isSubprocess:n,ipc:r}),Jw.signal),bQ=async({anyProcess:t,channel:e,isSubprocess:n,ipc:r})=>{if(!gx){if(gx=!0,!r){GJ();return}if(e===null){yx();return}Rp(t,e,n),await Kb.yield()}};let gx=!1;const TQ=t=>t?.type!==mx?!1:(Jw.abort(t.message),!0),mx="execa:ipc:cancel",yx=()=>{Jw.abort(WJ())},Jw=new AbortController,EQ=({gracefulCancel:t,cancelSignal:e,ipc:n,serialization:r})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!n)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(r==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},RQ=({subprocess:t,cancelSignal:e,gracefulCancel:n,forceKillAfterDelay:r,context:i,controller:s})=>n?[SQ({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:i,controller:s})]:[],SQ=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:r,controller:{signal:i}})=>{await nx(e,i);const s=$Q(e);throw await vQ(t,s),tx({kill:t.kill,forceKillAfterDelay:n,context:r,controllerSignal:i}),r.terminationReason??="gracefulCancel",e.reason},$Q=({reason:t})=>{if(!(t instanceof DOMException))return t;const e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e},kQ=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},_Q=(t,e,n,r)=>e===0||e===void 0?[]:[CQ(t,e,n,r)],CQ=async(t,e,n,{signal:r})=>{throw await Hb(e,void 0,{signal:r}),n.terminationReason??="timeout",t.kill(),new bu},AQ=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},IQ=(t,e,{node:n=!1,nodePath:r=GN,nodeOptions:i=zN.filter(c=>!c.startsWith("--inspect")),cwd:s,execPath:o,...a})=>{if(o!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');const c=yw(r,'The "nodePath" option'),l=Br.resolve(s,c),u={...a,nodePath:l,node:n,cwd:s};if(!n)return[t,e,u];if(Br.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]},xQ=({ipcInput:t,ipc:e,serialization:n})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");DQ[n](t)}},PQ=t=>{try{YN(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},NQ=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},DQ={advanced:PQ,json:NQ},OQ=async(t,e)=>{e!==void 0&&await t.sendMessage(e)},LQ=({encoding:t})=>{if(Qw.has(t))return;const e=FQ(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${_p(t)}\`.
1193
+ Please rename it to ${_p(e)}.`);const n=[...Qw].map(r=>_p(r)).join(", ");throw new TypeError(`Invalid option \`encoding: ${_p(t)}\`.
1194
+ Please rename it to one of: ${n}.`)},MQ=new Set(["utf8","utf16le"]),no=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),Qw=new Set([...MQ,...no]),FQ=t=>{if(t===null)return"buffer";if(typeof t!="string")return;const e=t.toLowerCase();if(e in vx)return vx[e];if(Qw.has(e))return e},vx={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},_p=t=>typeof t=="string"?`"${t}"`:String(t),jQ=(t=wx())=>{const e=yw(t,'The "cwd" option');return Br.resolve(e)},wx=()=>{try{return Ke.cwd()}catch(t){throw t.message=`The current directory does not exist.
1195
+ ${t.message}`,t}},UQ=(t,e)=>{if(e===wx())return t;let n;try{n=_N(e)}catch(r){return`The "cwd" option is invalid: ${e}.
1196
+ ${r.message}
1197
+ ${t}`}return n.isDirectory()?t:`The "cwd" option is not a directory: ${e}.
1198
+ ${t}`},bx=(t,e,n)=>{n.cwd=jQ(n.cwd);const[r,i,s]=IQ(t,e,n),{command:o,args:a,options:c}=sJ._parse(r,i,s),l=PY(c),u=BQ(l);return kQ(u),LQ(u),xQ(u),OJ(u),EQ(u),u.shell=lI(u.shell),u.env=qQ(u),u.killSignal=EJ(u.killSignal),u.forceKillAfterDelay=AJ(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!no.has(u.encoding)&&u.buffer[f]),Ke.platform==="win32"&&Br.basename(o,".exe")==="cmd"&&a.unshift("/q"),{file:o,commandArguments:a,options:u}},BQ=({extendEnv:t=!0,preferLocal:e=!1,cwd:n,localDir:r=n,encoding:i="utf8",reject:s=!0,cleanup:o=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:h=f!==void 0||d,serialization:p="advanced",...y})=>({...y,extendEnv:t,preferLocal:e,cwd:n,localDirectory:r,encoding:i,reject:s,cleanup:o,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:h,serialization:p}),qQ=({env:t,extendEnv:e,preferLocal:n,node:r,localDirectory:i,nodePath:s})=>{const o=e?{...Ke.env,...t}:t;return n||r?lJ({env:o,cwd:i,execPath:s,preferLocal:n,addExecPath:r}):o};function Zw(t){if(typeof t=="string")return WQ(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return GQ(t)}const WQ=t=>t.at(-1)===Tx?t.slice(0,t.at(-2)===Ex?-2:-1):t,GQ=t=>t.at(-1)===zQ?t.subarray(0,t.at(-2)===HQ?-2:-1):t,Tx=`
1199
+ `,zQ=Tx.codePointAt(0),Ex="\r",HQ=Ex.codePointAt(0);function ro(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function Rx(t,{checkOpen:e=!0}={}){return ro(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Cp(t,{checkOpen:e=!0}={}){return ro(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Sx(t,e){return Rx(t,e)&&Cp(t,e)}const KQ=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class VQ{#e;#t;#n=!1;#r=void 0;constructor(e,n){this.#e=e,this.#t=n}next(){const e=()=>this.#i();return this.#r=this.#r?this.#r.then(e,e):e(),this.#r}return(e){const n=()=>this.#s(e);return this.#r?this.#r.then(n,n):n()}async#i(){if(this.#n)return{done:!0,value:void 0};let e;try{e=await this.#e.read()}catch(n){throw this.#r=void 0,this.#n=!0,this.#e.releaseLock(),n}return e.done&&(this.#r=void 0,this.#n=!0,this.#e.releaseLock()),e}async#s(e){if(this.#n)return{done:!0,value:e};if(this.#n=!0,!this.#t){const n=this.#e.cancel(e);return this.#e.releaseLock(),await n,{done:!0,value:e}}return this.#e.releaseLock(),{done:!0,value:e}}}const eb=Symbol();function $x(){return this[eb].next()}Object.defineProperty($x,"name",{value:"next"});function kx(t){return this[eb].return(t)}Object.defineProperty(kx,"name",{value:"return"});const YQ=Object.create(KQ,{next:{enumerable:!0,configurable:!0,writable:!0,value:$x},return:{enumerable:!0,configurable:!0,writable:!0,value:kx}});function XQ({preventCancel:t=!1}={}){const e=this.getReader(),n=new VQ(e,t),r=Object.create(YQ);return r[eb]=n,r}const JQ=t=>{if(Cp(t,{checkOpen:!1})&&tb.on!==void 0)return ZQ(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(QQ.call(t)==="[object ReadableStream]")return XQ.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:QQ}=Object.prototype,ZQ=async function*(t){const e=new AbortController,n={};eZ(t,e,n);try{for await(const[r]of tb.on(t,"data",{signal:e.signal}))yield r}catch(r){if(n.error!==void 0)throw n.error;if(!e.signal.aborted)throw r}finally{t.destroy()}},eZ=async(t,e,n)=>{try{await tb.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(r){n.error=r}finally{e.abort()}},tb={},nb=async(t,{init:e,convertChunk:n,getSize:r,truncateChunk:i,addChunk:s,getFinalChunk:o,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{const l=JQ(t),u=e();u.length=0;try{for await(const d of l){const f=nZ(d),h=n[f](d,u);_x({convertedChunk:h,state:u,getSize:r,truncateChunk:i,addChunk:s,maxBuffer:c})}return tZ({state:u,convertChunk:n,getSize:r,truncateChunk:i,addChunk:s,getFinalChunk:o,maxBuffer:c}),a(u)}catch(d){const f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},tZ=({state:t,getSize:e,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:s})=>{const o=i(t);o!==void 0&&_x({convertedChunk:o,state:t,getSize:e,truncateChunk:n,addChunk:r,maxBuffer:s})},_x=({convertedChunk:t,state:e,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:s})=>{const o=n(t),a=e.length+o;if(a<=s){Cx(t,e,i,a);return}const c=r(t,s-e.length);throw c!==void 0&&Cx(c,e,i,s),new Ap},Cx=(t,e,n,r)=>{e.contents=n(t,e,r),e.length=r},nZ=t=>{const e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";const n=Ax.call(t);return n==="[object ArrayBuffer]"?"arrayBuffer":n==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&Ax.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Ax}=Object.prototype;class Ap extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}const io=t=>t,rb=()=>{},Ix=({contents:t})=>t,xx=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Px=t=>t.length;async function rZ(t,e){return nb(t,aZ,e)}const iZ=()=>({contents:[]}),sZ=()=>1,oZ=(t,{contents:e})=>(e.push(t),e),aZ={init:iZ,convertChunk:{string:io,buffer:io,arrayBuffer:io,dataView:io,typedArray:io,others:io},getSize:sZ,truncateChunk:rb,addChunk:oZ,getFinalChunk:rb,finalize:Ix};async function cZ(t,e){return nb(t,yZ,e)}const lZ=()=>({contents:new ArrayBuffer(0)}),uZ=t=>dZ.encode(t),dZ=new TextEncoder,Nx=t=>new Uint8Array(t),Dx=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),fZ=(t,e)=>t.slice(0,e),hZ=(t,{contents:e,length:n},r)=>{const i=Mx()?gZ(e,r):pZ(e,r);return new Uint8Array(i).set(t,n),i},pZ=(t,e)=>{if(e<=t.byteLength)return t;const n=new ArrayBuffer(Ox(e));return new Uint8Array(n).set(new Uint8Array(t),0),n},gZ=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;const n=new ArrayBuffer(e,{maxByteLength:Ox(e)});return new Uint8Array(n).set(new Uint8Array(t),0),n},Ox=t=>Lx**Math.ceil(Math.log(t)/Math.log(Lx)),Lx=2,mZ=({contents:t,length:e})=>Mx()?t:t.slice(0,e),Mx=()=>"resize"in ArrayBuffer.prototype,yZ={init:lZ,convertChunk:{string:uZ,buffer:Nx,arrayBuffer:Nx,dataView:Dx,typedArray:Dx,others:xx},getSize:Px,truncateChunk:fZ,addChunk:hZ,getFinalChunk:rb,finalize:mZ};async function vZ(t,e){return nb(t,RZ,e)}const wZ=()=>({contents:"",textDecoder:new TextDecoder}),Ip=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),bZ=(t,{contents:e})=>e+t,TZ=(t,e)=>t.slice(0,e),EZ=({textDecoder:t})=>{const e=t.decode();return e===""?void 0:e},RZ={init:wZ,convertChunk:{string:io,buffer:Ip,arrayBuffer:Ip,dataView:Ip,typedArray:Ip,others:xx},getSize:Px,truncateChunk:TZ,addChunk:bZ,getFinalChunk:EZ,finalize:Ix},SZ=({error:t,stream:e,readableObjectMode:n,lines:r,encoding:i,fdNumber:s})=>{if(!(t instanceof Ap))throw t;if(s==="all")return t;const o=$Z(n,r,i);throw t.maxBufferInfo={fdNumber:s,unit:o},e.destroy(),t},$Z=(t,e,n)=>t?"objects":e?"lines":n==="buffer"?"bytes":"characters",kZ=(t,e,n)=>{if(e.length!==n)return;const r=new Ap;throw r.maxBufferInfo={fdNumber:"ipc"},r},_Z=(t,e)=>{const{streamName:n,threshold:r,unit:i}=CZ(t,e);return`Command's ${n} was larger than ${r} ${i}`},CZ=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};const{maxBufferInfo:{fdNumber:n,unit:r}}=t;delete t.maxBufferInfo;const i=vu(e,n);return n==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:vI(n),threshold:i,unit:r}},AZ=(t,e,n)=>t?.code==="ENOBUFS"&&e!==null&&e.some(r=>r!==null&&r.length>ib(n)),IZ=(t,e,n)=>{if(!e)return t;const r=ib(n);return t.length>r?t.slice(0,r):t},ib=([,t])=>t,xZ=({stdio:t,all:e,ipcOutput:n,originalError:r,signal:i,signalDescription:s,exitCode:o,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:h,killSignal:p,maxBuffer:y,timeout:R,cwd:b})=>{const v=r?.code,T=PZ({originalError:r,timedOut:c,timeout:R,isMaxBuffer:d,maxBuffer:y,errorCode:v,signal:i,signalDescription:s,exitCode:o,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:h,killSignal:p}),_=DZ(r,b),N=_===void 0?"":`
1200
+ ${_}`,F=`${T}: ${a}${N}`,x=e===void 0?[t[2],t[1]]:[e],G=[F,...x,...t.slice(3),n.map(B=>OZ(B)).join(`
1201
+ `)].map(B=>$w(Zw(LZ(B)))).filter(Boolean).join(`
1202
+
1203
+ `);return{originalMessage:_,shortMessage:F,message:G}},PZ=({originalError:t,timedOut:e,timeout:n,isMaxBuffer:r,maxBuffer:i,errorCode:s,signal:o,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:h})=>{const p=NZ(d,f);return e?`Command timed out after ${n} milliseconds${p}`:u?o===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${p}`:`Command was gracefully canceled with ${o} (${a})`:l?`Command was canceled${p}`:r?`${_Z(t,i)}${p}`:s!==void 0?`Command failed with ${s}${p}`:d?`Command was killed with ${h} (${ex(h)})${p}`:o!==void 0?`Command was killed with ${o} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},NZ=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",DZ=(t,e)=>{if(t instanceof bu)return;const n=dJ(t)?t.originalMessage:String(t?.message??t),r=$w(UQ(n,e));return r===""?void 0:r},OZ=t=>typeof t=="string"?t:Bb(t),LZ=t=>Array.isArray(t)?t.map(e=>Zw(Fx(e))).filter(Boolean).join(`
1204
+ `):Fx(t),Fx=t=>typeof t=="string"?t:lr(t)?hI(t):"",jx=({command:t,escapedCommand:e,stdio:n,all:r,ipcOutput:i,options:{cwd:s},startTime:o})=>Ux({command:t,escapedCommand:e,cwd:s,durationMs:AI(o),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:n[1],stderr:n[2],all:r,stdio:n,ipcOutput:i,pipedFrom:[]}),sb=({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,isSync:o})=>ob({error:t,command:e,escapedCommand:n,startTime:s,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:r.length}),ipcOutput:[],options:i,isSync:o}),ob=({error:t,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:h,options:{timeoutDuration:p,timeout:y=p,forceKillAfterDelay:R,killSignal:b,cwd:v,maxBuffer:T},isSync:_})=>{const{exitCode:N,signal:F,signalDescription:x}=FZ(l,u),{originalMessage:G,shortMessage:B,message:W}=xZ({stdio:d,all:f,ipcOutput:h,originalError:t,signal:F,signalDescription:x,exitCode:N,escapedCommand:n,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:R,killSignal:b,maxBuffer:T,timeout:y,cwd:v}),I=uJ(t,W,_);return Object.assign(I,MZ({error:I,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:N,signal:F,signalDescription:x,stdio:d,all:f,ipcOutput:h,cwd:v,originalMessage:G,shortMessage:B})),I},MZ=({error:t,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:h,ipcOutput:p,cwd:y,originalMessage:R,shortMessage:b})=>Ux({shortMessage:b,originalMessage:R,command:e,escapedCommand:n,cwd:y,durationMs:AI(r),failed:!0,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:h,stdio:f,ipcOutput:p,pipedFrom:[]}),Ux=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),FZ=(t,e)=>{const n=t===null?void 0:t,r=e===null?void 0:e,i=r===void 0?void 0:ex(e);return{exitCode:n,signal:r,signalDescription:i}},Bx=t=>Number.isFinite(t)?t:0;function jZ(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(Bx(t*1e3)%1e3),nanoseconds:Math.trunc(Bx(t*1e6)%1e3)}}function UZ(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 BZ(t){switch(typeof t){case"number":{if(Number.isFinite(t))return jZ(t);break}case"bigint":return UZ(t)}throw new TypeError("Expected a finite number or bigint")}const qZ=t=>t===0||t===0n,WZ=(t,e)=>e===1||e===1n?t:`${t}s`,GZ=1e-7,zZ=24n*60n*60n*1000n;function qx(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=(u,d)=>{const f=Math.floor(u*10**d+GZ);return(Math.round(f)/10**d).toFixed(d)},o=(u,d,f,h)=>{if(!((i.length===0||!e.colonNotation)&&qZ(u)&&!(e.colonNotation&&f==="m"))){if(h??=String(u),e.colonNotation){const p=h.includes(".")?h.split(".")[0].length:h.length,y=i.length>0?2:1;h="0".repeat(Math.max(0,y-p))+h}else h+=e.verbose?" "+WZ(d,u):f;i.push(h)}},a=BZ(t),c=BigInt(a.days);if(o(c/365n,"year","y"),o(c%365n,"day","d"),o(Number(a.hours),"hour","h"),o(Number(a.minutes),"minute","m"),e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3){const u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),h=Number(a.nanoseconds);if(o(u,"second","s"),e.formatSubMilliseconds)o(d,"millisecond","ms"),o(f,"microsecond","\xB5s"),o(h,"nanosecond","ns");else{const p=d+f/1e3+h/1e6,y=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,R=p>=1?Math.round(p):Math.ceil(p),b=y?p.toFixed(y):R;o(Number.parseFloat(b),"millisecond","ms",b)}}else{const u=(n?Number(t%zZ):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=s(u,d),h=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");o(Number.parseFloat(h),"second","s",h)}if(i.length===0)return r+"0"+(e.verbose?" milliseconds":"ms");const l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),r+i.join(l)}const HZ=(t,e)=>{t.failed&&wu({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})},KZ=(t,e)=>{bw(e)&&(HZ(t,e),VZ(t,e))},VZ=(t,e)=>{const n=`(done in ${qx(t.durationMs)})`;wu({type:"duration",verboseMessage:n,verboseInfo:e,result:t})},ab=(t,e,{reject:n})=>{if(KZ(t,e),t.failed&&n)throw t;return t},YZ=(t,e)=>_a(t)?"asyncGenerator":Kx(t)?"generator":lb(t)?"fileUrl":tee(t)?"filePath":iee(t)?"webStream":ro(t,{checkOpen:!1})?"native":lr(t)?"uint8Array":see(t)?"asyncIterable":oee(t)?"iterable":db(t)?Wx({transform:t},e):ZZ(t)?XZ(t,e):"native",XZ=(t,e)=>Sx(t.transform,{checkOpen:!1})?JZ(t,e):db(t.transform)?Wx(t,e):QZ(t,e),JZ=(t,e)=>(Gx(t,e,"Duplex stream"),"duplex"),Wx=(t,e)=>(Gx(t,e,"web TransformStream"),"webTransform"),Gx=({final:t,binary:e,objectMode:n},r,i)=>{zx(t,`${r}.final`,i),zx(e,`${r}.binary`,i),cb(n,`${r}.objectMode`)},zx=(t,e,n)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${n}.`)},QZ=({transform:t,final:e,binary:n,objectMode:r},i)=>{if(t!==void 0&&!Hx(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(Sx(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(db(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!Hx(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return cb(n,`${i}.binary`),cb(r,`${i}.objectMode`),_a(t)||_a(e)?"asyncGenerator":"generator"},cb=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},Hx=t=>_a(t)||Kx(t),_a=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",Kx=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",ZZ=t=>Hn(t)&&(t.transform!==void 0||t.final!==void 0),lb=t=>Object.prototype.toString.call(t)==="[object URL]",eee=t=>lb(t)&&t.protocol!=="file:",tee=t=>Hn(t)&&Object.keys(t).length===1&&Vx(t.file),Vx=t=>typeof t=="string",nee=(t,e)=>t==="native"&&typeof e=="string"&&!ree.has(e),ree=new Set(["ipc","ignore","inherit","overlapped","pipe"]),Yx=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",ub=t=>Object.prototype.toString.call(t)==="[object WritableStream]",iee=t=>Yx(t)||ub(t),db=t=>Yx(t?.readable)&&ub(t?.writable),see=t=>Xx(t)&&typeof t[Symbol.asyncIterator]=="function",oee=t=>Xx(t)&&typeof t[Symbol.iterator]=="function",Xx=t=>typeof t=="object"&&t!==null,so=new Set(["generator","asyncGenerator","duplex","webTransform"]),Jx=new Set(["fileUrl","filePath","fileNumber"]),Qx=new Set(["fileUrl","filePath"]),aee=new Set([...Qx,"webStream","nodeStream"]),cee=new Set(["webTransform","duplex"]),xp={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"},Zx=(t,e,n,r)=>r==="output"?lee(t,e,n):uee(t,e,n),lee=(t,e,n)=>{const r=e!==0&&n[e-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:t??r}},uee=(t,e,n)=>{const r=e===0?t===!0:n[e-1].value.readableObjectMode,i=e!==n.length-1&&(t??r);return{writableObjectMode:r,readableObjectMode:i}},dee=(t,e)=>{const n=t.findLast(({type:r})=>so.has(r));return n===void 0?!1:e==="input"?n.value.writableObjectMode:n.value.readableObjectMode},fee=(t,e,n,r)=>[...t.filter(({type:i})=>!so.has(i)),...hee(t,e,n,r)],hee=(t,e,n,{encoding:r})=>{const i=t.filter(({type:o})=>so.has(o)),s=Array.from({length:i.length});for(const[o,a]of Object.entries(i))s[o]=pee({stdioItem:a,index:Number(o),newTransforms:s,optionName:e,direction:n,encoding:r});return vee(s,n)},pee=({stdioItem:t,stdioItem:{type:e},index:n,newTransforms:r,optionName:i,direction:s,encoding:o})=>e==="duplex"?gee({stdioItem:t,optionName:i}):e==="webTransform"?mee({stdioItem:t,index:n,newTransforms:r,direction:s}):yee({stdioItem:t,index:n,newTransforms:r,direction:s,encoding:o}),gee=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:n,readableObjectMode:r},objectMode:i=r}},optionName:s})=>{if(i&&!r)throw new TypeError(`The \`${s}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&r)throw new TypeError(`The \`${s}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:n,readableObjectMode:r}}},mee=({stdioItem:t,stdioItem:{value:e},index:n,newTransforms:r,direction:i})=>{const{transform:s,objectMode:o}=Hn(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=Zx(o,n,r,i);return{...t,value:{transform:s,writableObjectMode:a,readableObjectMode:c}}},yee=({stdioItem:t,stdioItem:{value:e},index:n,newTransforms:r,direction:i,encoding:s})=>{const{transform:o,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Hn(e)?e:{transform:e},d=c||no.has(s),{writableObjectMode:f,readableObjectMode:h}=Zx(u,n,r,i);return{...t,value:{transform:o,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:h}}},vee=(t,e)=>e==="input"?t.reverse():t,wee=(t,e,n)=>{const r=t.map(i=>bee(i,e));if(r.includes("input")&&r.includes("output"))throw new TypeError(`The \`${n}\` option must not be an array of both readable and writable values.`);return r.find(Boolean)??Ree},bee=({type:t,value:e},n)=>Tee[n]??eP[t](e),Tee=["input","output","output"],Ca=()=>{},fb=()=>"input",eP={generator:Ca,asyncGenerator:Ca,fileUrl:Ca,filePath:Ca,iterable:fb,asyncIterable:fb,uint8Array:fb,webStream:t=>ub(t)?"output":"input",nodeStream(t){return Cp(t,{checkOpen:!1})?Rx(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ca,duplex:Ca,native(t){const e=Eee(t);if(e!==void 0)return e;if(ro(t,{checkOpen:!1}))return eP.nodeStream(t)}},Eee=t=>{if([0,Ke.stdin].includes(t))return"input";if([1,2,Ke.stdout,Ke.stderr].includes(t))return"output"},Ree="output",See=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t,$ee=({stdio:t,ipc:e,buffer:n,...r},i,s)=>{const o=kee(t,r).map((a,c)=>tP(a,c));return s?Cee(o,n,i):See(o,e)},kee=(t,e)=>{if(t===void 0)return Lr.map(r=>e[r]);if(_ee(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Lr.map(r=>`\`${r}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);const n=Math.max(t.length,Lr.length);return Array.from({length:n},(r,i)=>t[i])},_ee=t=>Lr.some(e=>t[e]!==void 0),tP=(t,e)=>Array.isArray(t)?t.map(n=>tP(n,e)):t??(e>=Lr.length?"ignore":"pipe"),Cee=(t,e,n)=>t.map((r,i)=>!e[i]&&i!==0&&!Tw(n,i)&&Aee(r)?"ignore":r),Aee=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe"),Iee=({stdioItem:t,stdioItem:{type:e},isStdioArray:n,fdNumber:r,direction:i,isSync:s})=>!n||e!=="native"?t:s?xee({stdioItem:t,fdNumber:r,direction:i}):Dee({stdioItem:t,fdNumber:r}),xee=({stdioItem:t,stdioItem:{value:e,optionName:n},fdNumber:r,direction:i})=>{const s=Pee({value:e,optionName:n,fdNumber:r,direction:i});if(s!==void 0)return s;if(ro(e,{checkOpen:!1}))throw new TypeError(`The \`${n}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Pee=({value:t,optionName:e,fdNumber:n,direction:r})=>{const i=Nee(t,n);if(i!==void 0){if(r==="output")return{type:"fileNumber",value:i,optionName:e};if(Gb.isatty(i))throw new TypeError(`The \`${e}: ${Hw(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:yu(Bp(i)),optionName:e}}},Nee=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;const n=ww.indexOf(t);if(n!==-1)return n},Dee=({stdioItem:t,stdioItem:{value:e,optionName:n},fdNumber:r})=>e==="inherit"?{type:"nodeStream",value:nP(r,e,n),optionName:n}:typeof e=="number"?{type:"nodeStream",value:nP(e,e,n),optionName:n}:ro(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:n}:t,nP=(t,e,n)=>{const r=ww[t];if(r===void 0)throw new TypeError(`The \`${n}: ${e}\` option is invalid: no such standard stream.`);return r},Oee=({input:t,inputFile:e},n)=>n===0?[...Lee(t),...Fee(e)]:[],Lee=t=>t===void 0?[]:[{type:Mee(t),value:t,optionName:"input"}],Mee=t=>{if(Cp(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(lr(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Fee=t=>t===void 0?[]:[{...jee(t),optionName:"inputFile"}],jee=t=>{if(lb(t))return{type:"fileUrl",value:t};if(Vx(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")},Uee=t=>t.filter((e,n)=>t.every((r,i)=>e.value!==r.value||n>=i||e.type==="generator"||e.type==="asyncGenerator")),Bee=({stdioItem:{type:t,value:e,optionName:n},direction:r,fileDescriptors:i,isSync:s})=>{const o=qee(i,t);if(o.length!==0){if(s){Wee({otherStdioItems:o,type:t,value:e,optionName:n,direction:r});return}if(aee.has(t))return rP({otherStdioItems:o,type:t,value:e,optionName:n,direction:r});cee.has(t)&&zee({otherStdioItems:o,type:t,value:e,optionName:n})}},qee=(t,e)=>t.flatMap(({direction:n,stdioItems:r})=>r.filter(i=>i.type===e).map(i=>({...i,direction:n}))),Wee=({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})=>{Qx.has(e)&&rP({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})},rP=({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})=>{const s=t.filter(a=>Gee(a,n));if(s.length===0)return;const o=s.find(a=>a.direction!==i);return iP(o,r,e),i==="output"?s[0].stream:void 0},Gee=({type:t,value:e},n)=>t==="filePath"?e.file===n.file:t==="fileUrl"?e.href===n.href:e===n,zee=({otherStdioItems:t,type:e,value:n,optionName:r})=>{const i=t.find(({value:{transform:s}})=>s===n.transform);iP(i,r,e)},iP=(t,e,n)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${xp[n]} that is the same.`)},sP=(t,e,n,r)=>{const s=$ee(e,n,r).map((a,c)=>Hee({stdioOption:a,fdNumber:c,options:e,isSync:r})),o=ete({initialFileDescriptors:s,addProperties:t,options:e,isSync:r});return e.stdio=o.map(({stdioItems:a})=>rte(a)),o},Hee=({stdioOption:t,fdNumber:e,options:n,isSync:r})=>{const i=vI(e),{stdioItems:s,isStdioArray:o}=Kee({stdioOption:t,fdNumber:e,options:n,optionName:i}),a=wee(s,e,i),c=s.map(d=>Iee({stdioItem:d,isStdioArray:o,fdNumber:e,direction:a,isSync:r})),l=fee(c,i,a,n),u=dee(l,a);return Zee(l,u),{direction:a,objectMode:u,stdioItems:l}},Kee=({stdioOption:t,fdNumber:e,options:n,optionName:r})=>{const s=[...(Array.isArray(t)?t:[t]).map(c=>Vee(c,r)),...Oee(n,e)],o=Uee(s),a=o.length>1;return Yee(o,a,r),Jee(o),{stdioItems:o,isStdioArray:a}},Vee=(t,e)=>({type:YZ(t,e),value:t,optionName:e}),Yee=(t,e,n)=>{if(t.length===0)throw new TypeError(`The \`${n}\` option must not be an empty array.`);if(e){for(const{value:r,optionName:i}of t)if(Xee.has(r))throw new Error(`The \`${i}\` option must not include \`${r}\`.`)}},Xee=new Set(["ignore","ipc"]),Jee=t=>{for(const e of t)Qee(e)},Qee=({type:t,value:e,optionName:n})=>{if(eee(e))throw new TypeError(`The \`${n}: URL\` option must use the \`file:\` scheme.
1205
+ For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(nee(t,e))throw new TypeError(`The \`${n}: { file: '...' }\` option must be used instead of \`${n}: '...'\`.`)},Zee=(t,e)=>{if(!e)return;const n=t.find(({type:r})=>Jx.has(r));if(n!==void 0)throw new TypeError(`The \`${n.optionName}\` option cannot use both files and transforms in objectMode.`)},ete=({initialFileDescriptors:t,addProperties:e,options:n,isSync:r})=>{const i=[];try{for(const s of t)i.push(tte({fileDescriptor:s,fileDescriptors:i,addProperties:e,options:n,isSync:r}));return i}catch(s){throw oP(i),s}},tte=({fileDescriptor:{direction:t,objectMode:e,stdioItems:n},fileDescriptors:r,addProperties:i,options:s,isSync:o})=>{const a=n.map(c=>nte({stdioItem:c,addProperties:i,direction:t,options:s,fileDescriptors:r,isSync:o}));return{direction:t,objectMode:e,stdioItems:a}},nte=({stdioItem:t,addProperties:e,direction:n,options:r,fileDescriptors:i,isSync:s})=>{const o=Bee({stdioItem:t,direction:n,fileDescriptors:i,isSync:s});return o!==void 0?{...t,stream:o}:{...t,...e[n][t.type](t,r)}},oP=t=>{for(const{stdioItems:e}of t)for(const{stream:n}of e)n!==void 0&&!eo(n)&&n.destroy()},rte=t=>{if(t.length>1)return t.some(({value:r})=>r==="overlapped")?"overlapped":"pipe";const[{type:e,value:n}]=t;return e==="native"?n:"pipe"},ite=(t,e)=>sP(ote,t,e,!0),Mr=({type:t,optionName:e})=>{aP(e,xp[t])},ste=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&aP(t,`"${e}"`),{}),aP=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},cP={generator(){},asyncGenerator:Mr,webStream:Mr,nodeStream:Mr,webTransform:Mr,duplex:Mr,asyncIterable:Mr,native:ste},ote={input:{...cP,fileUrl:({value:t})=>({contents:[yu(Bp(t))]}),filePath:({value:{file:t}})=>({contents:[yu(Bp(t))]}),fileNumber:Mr,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...cP,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t}})=>({path:t}),fileNumber:({value:t})=>({path:t}),iterable:Mr,string:Mr,uint8Array:Mr}},Aa=(t,{stripFinalNewline:e},n)=>lP(e,n)&&t!==void 0&&!Array.isArray(t)?Zw(t):t,lP=(t,e)=>e==="all"?t[1]||t[2]:t[e],uP=(t,e,n,r)=>t||n?void 0:hP(e,r),dP=(t,e,n)=>n?t.flatMap(r=>fP(r,e)):fP(t,e),fP=(t,e)=>{const{transform:n,final:r}=hP(e,{});return[...n(t),...r()]},hP=(t,e)=>(e.previousChunks="",{transform:ate.bind(void 0,e,t),final:lte.bind(void 0,e)}),ate=function*(t,e,n){if(typeof n!="string"){yield n;return}let{previousChunks:r}=t,i=-1;for(let s=0;s<n.length;s+=1)if(n[s]===`
1206
+ `){const o=cte(n,s,e,t);let a=n.slice(i+1,s+1-o);r.length>0&&(a=hb(r,a),r=""),yield a,i=s}i!==n.length-1&&(r=hb(r,n.slice(i+1))),t.previousChunks=r},cte=(t,e,n,r)=>n?0:(r.isWindowsNewline=e!==0&&t[e-1]==="\r",r.isWindowsNewline?2:1),lte=function*({previousChunks:t}){t.length>0&&(yield t)},ute=({binary:t,preserveNewlines:e,readableObjectMode:n,state:r})=>t||e||n?void 0:{transform:dte.bind(void 0,r)},dte=function*({isWindowsNewline:t=!1},e){const{unixNewline:n,windowsNewline:r,LF:i,concatBytes:s}=typeof e=="string"?fte:pte;if(e.at(-1)===i){yield e;return}yield s(e,t?r:n)},hb=(t,e)=>`${t}${e}`,fte={windowsNewline:`\r
1207
+ `,unixNewline:`
1208
+ `,LF:`
1209
+ `,concatBytes:hb},hte=(t,e)=>{const n=new Uint8Array(t.length+e.length);return n.set(t,0),n.set(e,t.length),n},pte={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:hte},gte=(t,e)=>t?void 0:mte.bind(void 0,e),mte=function*(t,e){if(typeof e!="string"&&!lr(e)&&!zp.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},yte=(t,e)=>t?vte.bind(void 0,e):wte.bind(void 0,e),vte=function*(t,e){pP(t,e),yield e},wte=function*(t,e){if(pP(t,e),typeof e!="string"&&!lr(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},pP=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
1210
+ Instead, \`yield\` should either be called with a value, or not be called at all. For example:
1211
+ if (condition) { yield value; }`)},gP=(t,e,n)=>{if(n)return;if(t)return{transform:bte.bind(void 0,new TextEncoder)};const r=new Wb(e);return{transform:Tte.bind(void 0,r),final:Ete.bind(void 0,r)}},bte=function*(t,e){zp.isBuffer(e)?yield yu(e):typeof e=="string"?yield t.encode(e):yield e},Tte=function*(t,e){yield lr(e)?t.write(e):e},Ete=function*(t){const e=t.end();e!==""&&(yield e)},mP=co(async(t,e,n,r)=>{e.currentIterable=t(...n);try{for await(const i of e.currentIterable)r.push(i)}finally{delete e.currentIterable}}),pb=async function*(t,e,n){if(n===e.length){yield t;return}const{transform:r=kte}=e[n];for await(const i of r(t))yield*pb(i,e,n+1)},Rte=async function*(t){for(const[e,{final:n}]of Object.entries(t))yield*Ste(n,Number(e),t)},Ste=async function*(t,e,n){if(t!==void 0)for await(const r of t())yield*pb(r,n,e+1)},$te=co(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),kte=function*(t){yield t},yP=(t,e,n,r)=>{try{for(const i of t(...e))n.push(i);r()}catch(i){r(i)}},_te=(t,e)=>[...e.flatMap(n=>[...Su(n,t,0)]),...gb(t)],Su=function*(t,e,n){if(n===e.length){yield t;return}const{transform:r=Ate}=e[n];for(const i of r(t))yield*Su(i,e,n+1)},gb=function*(t){for(const[e,{final:n}]of Object.entries(t))yield*Cte(n,Number(e),t)},Cte=function*(t,e,n){if(t!==void 0)for(const r of t())yield*Su(r,n,e+1)},Ate=function*(t){yield t},vP=({value:t,value:{transform:e,final:n,writableObjectMode:r,readableObjectMode:i},optionName:s},{encoding:o})=>{const a={},c=bP(t,o,s),l=_a(e),u=_a(n),d=l?mP.bind(void 0,pb,a):yP.bind(void 0,Su),f=l||u?mP.bind(void 0,Rte,a):yP.bind(void 0,gb),h=l||u?$te.bind(void 0,a):void 0;return{stream:new XN({writableObjectMode:r,writableHighWaterMark:Pu(r),readableObjectMode:i,readableHighWaterMark:Pu(i),transform(y,R,b){d([y,c,0],this,b)},flush(y){f([c],this,y)},destroy:h})}},wP=(t,e,n,r)=>{const i=e.filter(({type:o})=>o==="generator"),s=r?i.reverse():i;for(const{value:o,optionName:a}of s){const c=bP(o,n,a);t=_te(c,t)}return t},bP=({transform:t,final:e,binary:n,writableObjectMode:r,readableObjectMode:i,preserveNewlines:s},o,a)=>{const c={};return[{transform:gte(r,a)},gP(n,o,r),uP(n,s,r,c),{transform:t,final:e},{transform:yte(i,a)},ute({binary:n,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)},Ite=(t,e)=>{for(const n of xte(t))Pte(t,n,e)},xte=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Pte=(t,e,n)=>{const{stdioItems:r}=t[e],i=r.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){const[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${xp[a]} with synchronous methods.`)}const o=i.map(({contents:a})=>a).map(a=>Nte(a,r));n.input=vw(o)},Nte=(t,e)=>{const n=wP(t,e,"utf8",!0);return Dte(n),vw(n)},Dte=t=>{const e=t.find(n=>typeof n!="string"&&!lr(n));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)},TP=({stdioItems:t,encoding:e,verboseInfo:n,fdNumber:r})=>r!=="all"&&Tw(n,r)&&!no.has(e)&&Ote(r)&&(t.some(({type:i,value:s})=>i==="native"&&Lte.has(s))||t.every(({type:i})=>so.has(i))),Ote=t=>t===1||t===2,Lte=new Set(["pipe","overlapped"]),Mte=async(t,e,n,r)=>{for await(const i of t)jte(e)||EP(i,n,r)},Fte=(t,e,n)=>{for(const r of t)EP(r,e,n)},jte=t=>t._readableState.pipes.length>0,EP=(t,e,n)=>{const r=_I(t);wu({type:"output",verboseMessage:r,fdNumber:e,verboseInfo:n})},Ute=({fileDescriptors:t,syncResult:{output:e},options:n,isMaxBuffer:r,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};const s={},o=new Set([]);return{output:e.map((c,l)=>Bte({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:r,verboseInfo:i},n)),...s}},Bte=({result:t,fileDescriptors:e,fdNumber:n,state:r,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;const f=IZ(t,s,d),h=yu(f),{stdioItems:p,objectMode:y}=e[n],R=qte([h],p,c,r),{serializedResult:b,finalResult:v=b}=Wte({chunks:R,objectMode:y,encoding:c,lines:l,stripFinalNewline:u,fdNumber:n});Gte({serializedResult:b,fdNumber:n,state:r,verboseInfo:o,encoding:c,stdioItems:p,objectMode:y});const T=a[n]?v:void 0;try{return r.error===void 0&&zte(b,p,i),T}catch(_){return r.error=_,T}},qte=(t,e,n,r)=>{try{return wP(t,e,n,!1)}catch(i){return r.error=i,t}},Wte=({chunks:t,objectMode:e,encoding:n,lines:r,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(n==="buffer")return{serializedResult:vw(t)};const o=EY(t,n);return r[s]?{serializedResult:o,finalResult:dP(o,!i[s],e)}:{serializedResult:o}},Gte=({serializedResult:t,fdNumber:e,state:n,verboseInfo:r,encoding:i,stdioItems:s,objectMode:o})=>{if(!TP({stdioItems:s,encoding:i,verboseInfo:r,fdNumber:e}))return;const a=dP(t,!1,o);try{Fte(a,e,r)}catch(c){n.error??=c}},zte=(t,e,n)=>{for(const{path:r}of e.filter(({type:i})=>Jx.has(i))){const i=typeof r=="string"?r:r.toString();n.has(i)?CN(r,t):(n.add(i),Fb(r,t))}},Hte=([,t,e],n)=>{if(n.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Aa(e,n,"all")]:Array.isArray(e)?[Aa(t,n,"all"),...e]:lr(t)&&lr(e)?pI([t,e]):`${t}${e}`},Kte=async(t,e)=>{const[n,r]=await Vte(t);return e.isForcefullyTerminated??=!1,[n,r]},Vte=async t=>{const[e,n]=await Promise.allSettled([on(t,"spawn"),on(t,"exit")]);return e.status==="rejected"?[]:n.status==="rejected"?RP(t):n.value},RP=async t=>{try{return await on(t,"exit")}catch{return RP(t)}},Yte=async t=>{const[e,n]=await t;if(!Xte(e,n)&&SP(e,n))throw new bu;return[e,n]},Xte=(t,e)=>t===void 0&&e===void 0,SP=(t,e)=>t!==0||e!==null,Jte=({error:t,status:e,signal:n,output:r},{maxBuffer:i})=>{const s=Qte(t,e,n),o=s?.code==="ETIMEDOUT",a=AZ(s,r,i);return{resultError:s,exitCode:e,signal:n,timedOut:o,isMaxBuffer:a}},Qte=(t,e,n)=>t!==void 0?t:SP(e,n)?new bu:void 0,Zte=(t,e,n)=>{const{file:r,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=ene(t,e,n),d=rne({file:r,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return ab(d,c,l)},ene=(t,e,n)=>{const{command:r,escapedCommand:i,startTime:s,verboseInfo:o}=II(t,e,n),a=tne(n),{file:c,commandArguments:l,options:u}=bx(t,e,a);nne(u);const d=ite(u,o);return{file:c,commandArguments:l,command:r,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},tne=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,nne=({ipc:t,ipcInput:e,detached:n,cancelSignal:r})=>{e&&Pp("ipcInput"),t&&Pp("ipc: true"),n&&Pp("detached: true"),r&&Pp("cancelSignal")},Pp=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},rne=({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{const c=ine({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;const{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:h}=Jte(c,n),{output:p,error:y=l}=Ute({fileDescriptors:o,syncResult:c,options:n,isMaxBuffer:h,verboseInfo:s}),R=p.map((v,T)=>Aa(v,n,T)),b=Aa(Hte(p,n),n,"all");return one({error:y,exitCode:u,signal:d,timedOut:f,isMaxBuffer:h,stdio:R,all:b,options:n,command:r,escapedCommand:i,startTime:a})},ine=({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{Ite(s,n);const a=sne(n);return BN(t,e,a)}catch(a){return sb({error:a,command:r,escapedCommand:i,fileDescriptors:s,options:n,startTime:o,isSync:!0})}},sne=({encoding:t,maxBuffer:e,...n})=>({...n,encoding:"buffer",maxBuffer:ib(e)}),one=({error:t,exitCode:e,signal:n,timedOut:r,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?jx({command:c,escapedCommand:l,stdio:s,all:o,ipcOutput:[],options:a,startTime:u}):ob({error:t,command:c,escapedCommand:l,timedOut:r,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:n,stdio:s,all:o,ipcOutput:[],options:a,startTime:u,isSync:!0}),ane=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},{reference:i=!0,filter:s}={})=>(Ww({methodName:"getOneMessage",isSubprocess:n,ipc:r,isConnected:dx(t)}),cne({anyProcess:t,channel:e,isSubprocess:n,filter:s,reference:i})),cne=async({anyProcess:t,channel:e,isSubprocess:n,filter:r,reference:i})=>{lx(e,i);const s=Rp(t,e,n),o=new AbortController;try{return await Promise.race([lne(s,r,o),une(s,n,o),dne(s,n,o)])}catch(a){throw Gw(t),a}finally{o.abort(),ux(e,i)}},lne=async(t,e,{signal:n})=>{if(e===void 0){const[r]=await on(t,"message",{signal:n});return r}for await(const[r]of xu(t,"message",{signal:n}))if(e(r))return r},une=async(t,e,{signal:n})=>{await on(t,"disconnect",{signal:n}),jJ(e)},dne=async(t,e,{signal:n})=>{const[r]=await on(t,"strict:error",{signal:n});throw ix(r,e)},fne=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},{reference:i=!0}={})=>$P({anyProcess:t,channel:e,isSubprocess:n,ipc:r,shouldAwait:!n,reference:i}),$P=({anyProcess:t,channel:e,isSubprocess:n,ipc:r,shouldAwait:i,reference:s})=>{Ww({methodName:"getEachMessage",isSubprocess:n,ipc:r,isConnected:dx(t)}),lx(e,s);const o=Rp(t,e,n),a=new AbortController,c={};return hne(t,o,a),pne({ipcEmitter:o,isSubprocess:n,controller:a,state:c}),gne({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:n,shouldAwait:i,controller:a,state:c,reference:s})},hne=async(t,e,n)=>{try{await on(e,"disconnect",{signal:n.signal}),n.abort()}catch{}},pne=async({ipcEmitter:t,isSubprocess:e,controller:n,state:r})=>{try{const[i]=await on(t,"strict:error",{signal:n.signal});r.error=ix(i,e),n.abort()}catch{}},gne=async function*({anyProcess:t,channel:e,ipcEmitter:n,isSubprocess:r,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(const[c]of xu(n,"message",{signal:s.signal}))kP(o),yield c}catch{kP(o)}finally{s.abort(),ux(e,a),r||Gw(t),i&&await t}},kP=({error:t})=>{if(t)throw t},mne=(t,{ipc:e})=>{Object.assign(t,_P(t,!1,e))},yne=()=>{const t=Ke,e=!0,n=Ke.channel!==void 0;return{..._P(t,e,n),getCancelSignal:wQ.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n})}},_P=(t,e,n)=>({sendMessage:hx.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n}),getOneMessage:ane.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n}),getEachMessage:fne.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n})}),vne=({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,verboseInfo:o})=>{oP(r);const a=new qb;wne(a,r),Object.assign(a,{readable:bne,writable:Tne,duplex:Ene});const c=sb({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,isSync:!1}),l=Rne(c,o,i);return{subprocess:a,promise:l}},wne=(t,e)=>{const n=$u(),r=$u(),i=$u(),s=Array.from({length:e.length-3},$u),o=$u(),a=[n,r,i,...s];Object.assign(t,{stdin:n,stdout:r,stderr:i,all:o,stdio:a})},$u=()=>{const t=new Yb;return t.end(),t},bne=()=>new Ss({read(){}}),Tne=()=>new Wp({write(){}}),Ene=()=>new Gp({read(){},write(){}}),Rne=async(t,e,n)=>ab(t,e,n),Sne=(t,e)=>sP($ne,t,e,!1),ku=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${xp[t]}.`)},CP={fileNumber:ku,generator:vP,asyncGenerator:vP,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:n}}){const r=e||n;return{stream:Gp.fromWeb(t,{objectMode:r})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},$ne={input:{...CP,fileUrl:({value:t})=>({stream:jb(t)}),filePath:({value:{file:t}})=>({stream:jb(t)}),webStream:({value:t})=>({stream:Ss.fromWeb(t)}),iterable:({value:t})=>({stream:Ss.from(t)}),asyncIterable:({value:t})=>({stream:Ss.from(t)}),string:({value:t})=>({stream:Ss.from(t)}),uint8Array:({value:t})=>({stream:Ss.from(zp.from(t))})},output:{...CP,fileUrl:({value:t})=>({stream:Ub(t)}),filePath:({value:{file:t}})=>({stream:Ub(t)}),webStream:({value:t})=>({stream:Wp.fromWeb(t)}),iterable:ku,asyncIterable:ku,string:ku,uint8Array:ku}};function mb(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(const i of t)yb(i);const e=t.some(({readableObjectMode:i})=>i),n=kne(t,e),r=new _ne({objectMode:e,writableHighWaterMark:n,readableHighWaterMark:n});for(const i of t)r.add(i);return r}const kne=(t,e)=>{if(t.length===0)return Pu(e);const n=t.filter(({readableObjectMode:r})=>r===e).map(({readableHighWaterMark:r})=>r);return Math.max(...n)};class _ne extends Yb{#e=new Set([]);#t=new Set([]);#n=new Set([]);#r;#i=Symbol("unpipe");#s=new WeakMap;add(e){if(yb(e),this.#e.has(e))return;this.#e.add(e),this.#r??=Cne(this,this.#e,this.#i);const n=xne({passThroughStream:this,stream:e,streams:this.#e,ended:this.#t,aborted:this.#n,onFinished:this.#r,unpipeEvent:this.#i});this.#s.set(e,n),e.pipe(this,{end:!1})}async remove(e){if(yb(e),!this.#e.has(e))return!1;const n=this.#s.get(e);return n===void 0?!1:(this.#s.delete(e),e.unpipe(this),await n,!0)}}const Cne=async(t,e,n)=>{Np(t,PP);const r=new AbortController;try{await Promise.race([Ane(t,r),Ine(t,e,n,r)])}finally{r.abort(),Np(t,-PP)}},Ane=async(t,{signal:e})=>{try{await ki(t,{signal:e,cleanup:!0})}catch(n){throw AP(t,n),n}},Ine=async(t,e,n,{signal:r})=>{for await(const[i]of xu(t,"unpipe",{signal:r}))e.has(i)&&i.emit(n)},yb=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},xne=async({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,onFinished:s,unpipeEvent:o})=>{Np(t,NP);const a=new AbortController;try{await Promise.race([Pne(s,e,a),Nne({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,controller:a}),Dne({stream:e,streams:n,ended:r,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),Np(t,-NP)}n.size>0&&n.size===r.size+i.size&&(r.size===0&&i.size>0?vb(t):One(t))},Pne=async(t,e,{signal:n})=>{try{await t,n.aborted||vb(e)}catch(r){n.aborted||AP(e,r)}},Nne=async({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,controller:{signal:s}})=>{try{await ki(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),n.has(e)&&r.add(e)}catch(o){if(s.aborted||!n.has(e))return;IP(o)?i.add(e):xP(t,o)}},Dne=async({stream:t,streams:e,ended:n,aborted:r,unpipeEvent:i,controller:{signal:s}})=>{if(await on(t,i,{signal:s}),!t.readable)return on(s,"abort",{signal:s});e.delete(t),n.delete(t),r.delete(t)},One=t=>{t.writable&&t.end()},AP=(t,e)=>{IP(e)?vb(t):xP(t,e)},IP=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",vb=t=>{(t.readable||t.writable)&&t.destroy()},xP=(t,e)=>{t.destroyed||(t.once("error",Lne),t.destroy(e))},Lne=()=>{},Np=(t,e)=>{const n=t.getMaxListeners();n!==0&&n!==Number.POSITIVE_INFINITY&&t.setMaxListeners(n+e)},PP=2,NP=1,Dp=(t,e)=>{t.pipe(e),Mne(t,e),Fne(t,e)},Mne=async(t,e)=>{if(!(eo(t)||eo(e))){try{await ki(t,{cleanup:!0,readable:!0,writable:!1})}catch{}DP(e)}},DP=t=>{t.writable&&t.end()},Fne=async(t,e)=>{if(!(eo(t)||eo(e))){try{await ki(e,{cleanup:!0,readable:!1,writable:!0})}catch{}OP(t)}},OP=t=>{t.readable&&t.destroy()},jne=(t,e,n)=>{const r=new Map;for(const[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(const{stream:a}of s.filter(({type:c})=>so.has(c)))Une(t,a,o,i);for(const{stream:a}of s.filter(({type:c})=>!so.has(c)))qne({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:r,controller:n})}for(const[i,s]of r.entries()){const o=s.length===1?s[0]:mb(s);Dp(o,i)}},Une=(t,e,n,r)=>{n==="output"?Dp(t.stdio[r],e):Dp(e,t.stdio[r]);const i=Bne[r];i!==void 0&&(t[i]=e),t.stdio[r]=e},Bne=["stdin","stdout","stderr"],qne=({subprocess:t,stream:e,direction:n,fdNumber:r,pipeGroups:i,controller:s})=>{if(e===void 0)return;Wne(e,s);const[o,a]=n==="output"?[e,t.stdio[r]]:[t.stdio[r],e],c=i.get(o)??[];i.set(o,[...c,a])},Wne=(t,{signal:e})=>{eo(t)&&Tp(t,Gne,e)},Gne=2,Ia=[];Ia.push("SIGHUP","SIGINT","SIGTERM"),process.platform!=="win32"&&Ia.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&Ia.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");const Op=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",wb=Symbol.for("signal-exit emitter"),bb=globalThis,zne=Object.defineProperty.bind(Object);class Hne{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(bb[wb])return bb[wb];zne(bb,wb,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,n){this.listeners[e].push(n)}removeListener(e,n){const r=this.listeners[e],i=r.indexOf(n);i!==-1&&(i===0&&r.length===1?r.length=0:r.splice(i,1))}emit(e,n,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(const s of this.listeners[e])i=s(n,r)===!0||i;return e==="exit"&&(i=this.emit("afterExit",n,r)||i),i}}class LP{}const Kne=t=>({onExit(e,n){return t.onExit(e,n)},load(){return t.load()},unload(){return t.unload()}});class Vne extends LP{onExit(){return()=>{}}load(){}unload(){}}class Yne extends LP{#e=Tb.platform==="win32"?"SIGINT":"SIGHUP";#t=new Hne;#n;#r;#i;#s={};#o=!1;constructor(e){super(),this.#n=e,this.#s={};for(const n of Ia)this.#s[n]=()=>{const r=this.#n.listeners(n);let{count:i}=this.#t;const s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),r.length===i){this.unload();const o=this.#t.emit("exit",null,n),a=n==="SIGHUP"?this.#e:n;o||e.kill(e.pid,a)}};this.#i=e.reallyExit,this.#r=e.emit}onExit(e,n){if(!Op(this.#n))return()=>{};this.#o===!1&&this.load();const r=n?.alwaysLast?"afterExit":"exit";return this.#t.on(r,e),()=>{this.#t.removeListener(r,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(const e of Ia)try{const n=this.#s[e];n&&this.#n.on(e,n)}catch{}this.#n.emit=(e,...n)=>this.#c(e,...n),this.#n.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,Ia.forEach(e=>{const n=this.#s[e];if(!n)throw new Error("Listener not defined for signal: "+e);try{this.#n.removeListener(e,n)}catch{}}),this.#n.emit=this.#r,this.#n.reallyExit=this.#i,this.#t.count-=1)}#a(e){return Op(this.#n)?(this.#n.exitCode=e||0,this.#t.emit("exit",this.#n.exitCode,null),this.#i.call(this.#n,this.#n.exitCode)):0}#c(e,...n){const r=this.#r;if(e==="exit"&&Op(this.#n)){typeof n[0]=="number"&&(this.#n.exitCode=n[0]);const i=r.call(this.#n,e,...n);return this.#t.emit("exit",this.#n.exitCode,null),i}else return r.call(this.#n,e,...n)}}const Tb=globalThis.process,{onExit:Xne,load:Pse,unload:Nse}=Kne(Op(Tb)?new Yne(Tb):new Vne),Jne=(t,{cleanup:e,detached:n},{signal:r})=>{if(!e||n)return;const i=Xne(()=>{t.kill()});Vb(r,()=>{i()})},Qne=({source:t,sourcePromise:e,boundOptions:n,createNested:r},...i)=>{const s=CI(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=Zne(n,r,i),{sourceStream:d,sourceError:f}=tre(t,l),{options:h,fileDescriptors:p}=to.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:h,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:p,startTime:s}},Zne=(t,e,n)=>{try{const{destination:r,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=ere(t,e,...n),a=sx(r,s);return{destination:r,destinationStream:a,from:i,unpipeSignal:o}}catch(r){return{destinationError:r}}},ere=(t,e,n,...r)=>{if(Array.isArray(n))return{destination:e(MP,t)(n,...r),pipeOptions:t};if(typeof n=="string"||n instanceof URL){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');const[i,s,o]=uI(n,...r);return{destination:e(MP)(i,s,o),pipeOptions:o}}if(to.has(n)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:n,pipeOptions:r[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${n}`)},MP=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),tre=(t,e)=>{try{return{sourceStream:zw(t,e)}}catch(n){return{sourceError:n}}},nre=({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r,fileDescriptors:i,sourceOptions:s,startTime:o})=>{const a=rre({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r});if(a!==void 0)throw FP({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},rre=({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r})=>{if(e!==void 0&&r!==void 0)return r;if(r!==void 0)return OP(t),r;if(e!==void 0)return DP(n),e},FP=({error:t,fileDescriptors:e,sourceOptions:n,startTime:r})=>sb({error:t,command:jP,escapedCommand:jP,fileDescriptors:e,options:n,startTime:r,isSync:!1}),jP="source.pipe(destination)",ire=async t=>{const[{status:e,reason:n,value:r=n},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(r)||o.pipedFrom.push(r),i==="rejected")throw o;if(e==="rejected")throw r;return o},sre=(t,e,n)=>{const r=Lp.has(e)?are(t,e):ore(t,e);return Tp(t,lre,n.signal),Tp(e,ure,n.signal),cre(e),r},ore=(t,e)=>{const n=mb([t]);return Dp(n,e),Lp.set(e,n),n},are=(t,e)=>{const n=Lp.get(e);return n.add(t),n},cre=async t=>{try{await ki(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Lp.delete(t)},Lp=new WeakMap,lre=2,ure=1,dre=(t,e)=>t===void 0?[]:[fre(t,e)],fre=async(t,{sourceStream:e,mergedStream:n,fileDescriptors:r,sourceOptions:i,startTime:s})=>{await UN(t,e),await n.remove(e);const o=new Error("Pipe canceled by `unpipeSignal` option.");throw FP({error:o,fileDescriptors:r,sourceOptions:i,startTime:s})},Eb=(t,...e)=>{if(Hn(e[0]))return Eb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});const{destination:n,...r}=Qne(t,...e),i=hre({...r,destination:n});return i.pipe=Eb.bind(void 0,{...t,source:n,sourcePromise:i,boundOptions:{}}),i},hre=async({sourcePromise:t,sourceStream:e,sourceOptions:n,sourceError:r,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{const u=pre(t,i);nre({sourceStream:e,sourceError:r,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:n,startTime:l});const d=new AbortController;try{const f=sre(e,s,d);return await Promise.race([ire(u),...dre(a,{sourceStream:e,mergedStream:f,sourceOptions:n,fileDescriptors:c,startTime:l})])}finally{d.abort()}},pre=(t,e)=>Promise.allSettled([t,e]),UP=({subprocessStdout:t,subprocess:e,binary:n,shouldEncode:r,encoding:i,preserveNewlines:s})=>{const o=new AbortController;return gre(e,o),qP({stream:t,controller:o,binary:n,shouldEncode:!t.readableObjectMode&&r,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},gre=async(t,e)=>{try{await t}catch{}finally{e.abort()}},BP=({stream:t,onStreamEnd:e,lines:n,encoding:r,stripFinalNewline:i,allMixed:s})=>{const o=new AbortController;mre(e,o,t);const a=t.readableObjectMode&&!s;return qP({stream:t,controller:o,binary:r==="buffer",shouldEncode:!a,encoding:r,shouldSplit:!a&&n,preserveNewlines:!i})},mre=async(t,e,n)=>{try{await t}catch{n.destroy()}finally{e.abort()}},qP=({stream:t,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o})=>{const a=xu(t,"data",{signal:e.signal,highWaterMark:GP,highWatermark:GP});return yre({onStdoutChunk:a,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o})},WP=Pu(!0),GP=WP,yre=async function*({onStdoutChunk:t,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o}){const a=vre({binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(const[c]of t)yield*Su(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*gb(a)}},vre=({binary:t,shouldEncode:e,encoding:n,shouldSplit:r,preserveNewlines:i})=>[gP(t,n,!e),uP(t,i,!r,{})].filter(Boolean),wre=async({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{const d=bre({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Tre(t),d]);return}const f=lP(c,n),h=BP({stream:t,onStreamEnd:e,lines:o,encoding:r,stripFinalNewline:f,allMixed:a}),[p]=await Promise.all([Ere({stream:t,iterable:h,fdNumber:n,encoding:r,maxBuffer:s,lines:o}),d]);return p},bre=async({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!TP({stdioItems:o[n]?.stdioItems,encoding:r,verboseInfo:s,fdNumber:n}))return;const a=BP({stream:t,onStreamEnd:e,lines:!0,encoding:r,stripFinalNewline:!0,allMixed:i});await Mte(a,t,n,s)},Tre=async t=>{await HN(),t.readableFlowing===null&&t.resume()},Ere=async({stream:t,stream:{readableObjectMode:e},iterable:n,fdNumber:r,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await rZ(n,{maxBuffer:s}):i==="buffer"?new Uint8Array(await cZ(n,{maxBuffer:s})):await vZ(n,{maxBuffer:s})}catch(a){return HP(SZ({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:r}))}},zP=async t=>{try{return await t}catch(e){return HP(e)}},HP=({bufferedData:t})=>wY(t)?new Uint8Array(t):t,Rb=async(t,e,n,{isSameDirection:r,stopOnExit:i=!1}={})=>{const s=Rre(t,n),o=new AbortController;try{await Promise.race([...i?[n.exitPromise]:[],ki(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||kre(a,e,n,r)}finally{o.abort()}},Rre=(t,{originalStreams:[e],subprocess:n})=>{const r={stdinCleanedUp:!1};return t===e&&Sre(t,n,r),r},Sre=(t,e,n)=>{const{_destroy:r}=t;t._destroy=(...i)=>{$re(e,n),r.call(t,...i)}},$re=({exitCode:t,signalCode:e},n)=>{(t!==null||e!==null)&&(n.stdinCleanedUp=!0)},kre=(t,e,n,r)=>{if(!_re(t,e,n,r))throw t},_re=(t,e,n,r=!0)=>n.propagating?VP(t)||Sb(t):(n.propagating=!0,KP(n,e)===r?VP(t):Sb(t)),KP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Sb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",VP=t=>t?.code==="EPIPE",Cre=({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>YP({stream:c,fdNumber:l,encoding:e,buffer:n[l],maxBuffer:r[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),YP=async({stream:t,fdNumber:e,encoding:n,buffer:r,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;const u=Rb(t,e,l);if(KP(l,e)){await u;return}const[d]=await Promise.all([wre({stream:t,onStreamEnd:u,fdNumber:e,encoding:n,buffer:r,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d},Are=({stdout:t,stderr:e},{all:n})=>n&&(t||e)?mb([t,e].filter(Boolean)):void 0,Ire=({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>YP({...xre(t,n),fdNumber:"all",encoding:e,maxBuffer:r[1]+r[2],lines:i[1]||i[2],allMixed:Pre(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),xre=({stdout:t,stderr:e,all:n},[,r,i])=>{const s=r||i;return s?r?i?{stream:n,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:n,buffer:s}},Pre=({all:t,stdout:e,stderr:n})=>t&&e&&n&&e.readableObjectMode!==n.readableObjectMode,Nre=t=>Tw(t,"ipc"),Dre=(t,e)=>{const n=_I(t);wu({type:"ipc",verboseMessage:n,fdNumber:"ipc",verboseInfo:e})},Ore=async({subprocess:t,buffer:e,maxBuffer:n,ipc:r,ipcOutput:i,verboseInfo:s})=>{if(!r)return i;const o=Nre(s),a=vu(e,"ipc"),c=vu(n,"ipc");for await(const l of $P({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:r,shouldAwait:!1,reference:!0}))a&&(kZ(t,i,c),i.push(l)),o&&Dre(l,s);return i},Lre=async(t,e)=>(await Promise.allSettled([t]),e),Mre=async({subprocess:t,options:{encoding:e,buffer:n,maxBuffer:r,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:h,fileDescriptors:p,originalStreams:y,onInternalError:R,controller:b})=>{const v=Kte(t,f),T={originalStreams:y,fileDescriptors:p,subprocess:t,exitPromise:v,propagating:!1},_=Cre({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:h,streamInfo:T}),N=Ire({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:h,streamInfo:T}),F=[],x=Ore({subprocess:t,buffer:n,maxBuffer:r,ipc:u,ipcOutput:F,verboseInfo:h}),G=Fre(y,t,T),B=jre(p,T);try{return await Promise.race([Promise.all([{},Yte(v),Promise.all(_),N,x,OQ(t,d),...G,...B]),R,Ure(t,b),..._Q(t,s,f,b),...LJ({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:b}),...RQ({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(W){return f.terminationReason??="other",Promise.all([{error:W},v,Promise.all(_.map(I=>zP(I))),zP(N),Lre(x,F),Promise.allSettled(G),Promise.allSettled(B)])}},Fre=(t,e,n)=>t.map((r,i)=>r===e.stdio[i]?void 0:Rb(r,i,n)),jre=(t,e)=>t.flatMap(({stdioItems:n},r)=>n.filter(({value:i,stream:s=i})=>ro(s,{checkOpen:!1})&&!eo(s)).map(({type:i,value:s,stream:o=s})=>Rb(o,r,e,{isSameDirection:so.has(i),stopOnExit:i==="native"}))),Ure=async(t,{signal:e})=>{const[n]=await on(t,"error",{signal:e});throw n},Bre=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),$b=(t,e,n)=>{const r=t[n];r.has(e)||r.set(e,[]);const i=r.get(e),s=Tu();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},Mp=async({resolve:t,promises:e},n)=>{t();const[r]=await Promise.race([Promise.allSettled([!0,n]),Promise.all([!1,...e])]);return!r},XP=async t=>{if(t!==void 0)try{await JP(t)}catch{}},qre=async t=>{if(t!==void 0)try{await QP(t)}catch{}},JP=async t=>{await ki(t,{cleanup:!0,readable:!1,writable:!0})},QP=async t=>{await ki(t,{cleanup:!0,readable:!0,writable:!1})},ZP=async(t,e)=>{if(await t,e)throw e},eN=(t,e,n)=>{n&&!Sb(n)?t.destroy(n):e&&t.destroy()},Wre=({subprocess:t,concurrentStreams:e,encoding:n},{from:r,binary:i=!0,preserveNewlines:s=!0}={})=>{const o=i||no.has(n),{subprocessStdout:a,waitReadableDestroy:c}=tN(t,r,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=nN(a,o),{read:f,onStdoutDataDone:h}=rN({subprocessStdout:a,subprocess:t,binary:o,encoding:n,preserveNewlines:s}),p=new Ss({read:f,destroy:co(sN.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return iN({subprocessStdout:a,onStdoutDataDone:h,readable:p,subprocess:t}),p},tN=(t,e,n)=>{const r=zw(t,e),i=$b(n,r,"readableDestroy");return{subprocessStdout:r,waitReadableDestroy:i}},nN=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:n},r)=>r?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:n}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:WP},rN=({subprocessStdout:t,subprocess:e,binary:n,encoding:r,preserveNewlines:i})=>{const s=Tu(),o=UP({subprocessStdout:t,subprocess:e,binary:n,shouldEncode:!n,encoding:r,preserveNewlines:i});return{read(){Gre(this,o,s)},onStdoutDataDone:s}},Gre=async(t,e,n)=>{try{const{value:r,done:i}=await e.next();i?n.resolve():t.push(r)}catch{}},iN=async({subprocessStdout:t,onStdoutDataDone:e,readable:n,subprocess:r,subprocessStdin:i})=>{try{await QP(t),await r,await XP(i),await e,n.readable&&n.push(null)}catch(s){await XP(i),oN(n,s)}},sN=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:n},r)=>{await Mp(n,e)&&(oN(t,r),await ZP(e,r))},oN=(t,e)=>{eN(t,t.readable,e)},zre=({subprocess:t,concurrentStreams:e},{to:n}={})=>{const{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:s}=aN(t,n,e),o=new Wp({...cN(r,t,i),destroy:co(uN.bind(void 0,{subprocessStdin:r,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:r.writableHighWaterMark,objectMode:r.writableObjectMode});return lN(r,o),o},aN=(t,e,n)=>{const r=sx(t,e),i=$b(n,r,"writableFinal"),s=$b(n,r,"writableDestroy");return{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:s}},cN=(t,e,n)=>({write:Hre.bind(void 0,t),final:co(Kre.bind(void 0,t,e,n))}),Hre=(t,e,n,r)=>{t.write(e,n)?r():t.once("drain",r)},Kre=async(t,e,n)=>{await Mp(n,e)&&(t.writable&&t.end(),await e)},lN=async(t,e,n)=>{try{await JP(t),e.writable&&e.end()}catch(r){await qre(n),dN(e,r)}},uN=async({subprocessStdin:t,subprocess:e,waitWritableFinal:n,waitWritableDestroy:r},i)=>{await Mp(n,e),await Mp(r,e)&&(dN(t,i),await ZP(e,i))},dN=(t,e)=>{eN(t,t.writable,e)},Vre=({subprocess:t,concurrentStreams:e,encoding:n},{from:r,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{const a=s||no.has(n),{subprocessStdout:c,waitReadableDestroy:l}=tN(t,r,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=aN(t,i,e),{readableEncoding:h,readableObjectMode:p,readableHighWaterMark:y}=nN(c,a),{read:R,onStdoutDataDone:b}=rN({subprocessStdout:c,subprocess:t,binary:a,encoding:n,preserveNewlines:o}),v=new Gp({read:R,...cN(u,t,d),destroy:co(Yre.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:y,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:p,writableObjectMode:u.writableObjectMode,encoding:h});return iN({subprocessStdout:c,onStdoutDataDone:b,readable:v,subprocess:t,subprocessStdin:u}),lN(u,v,c),v},Yre=async({subprocessStdout:t,subprocessStdin:e,subprocess:n,waitReadableDestroy:r,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([sN({subprocessStdout:t,subprocess:n,waitReadableDestroy:r},o),uN({subprocessStdin:e,subprocess:n,waitWritableFinal:i,waitWritableDestroy:s},o)])},fN=(t,e,{from:n,binary:r=!1,preserveNewlines:i=!1}={})=>{const s=r||no.has(e),o=zw(t,n),a=UP({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return Xre(a,o,t)},Xre=async function*(t,e,n){try{yield*t}finally{e.readable&&e.destroy(),await n}},Jre=(t,{encoding:e})=>{const n=Bre();t.readable=Wre.bind(void 0,{subprocess:t,concurrentStreams:n,encoding:e}),t.writable=zre.bind(void 0,{subprocess:t,concurrentStreams:n}),t.duplex=Vre.bind(void 0,{subprocess:t,concurrentStreams:n,encoding:e}),t.iterable=fN.bind(void 0,t,e),t[Symbol.asyncIterator]=fN.bind(void 0,t,e,{})},Qre=(t,e)=>{for(const[n,r]of eie){const i=r.value.bind(e);Reflect.defineProperty(t,n,{...r,value:i})}},Zre=(async()=>{})().constructor.prototype,eie=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Zre,t)]),tie=(t,e,n,r)=>{const{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=nie(t,e,n),{subprocess:f,promise:h}=iie({file:i,commandArguments:s,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=Eb.bind(void 0,{source:f,sourcePromise:h,boundOptions:{},createNested:r}),Qre(f,h),to.set(f,{options:u,fileDescriptors:d}),f},nie=(t,e,n)=>{const{command:r,escapedCommand:i,startTime:s,verboseInfo:o}=II(t,e,n),{file:a,commandArguments:c,options:l}=bx(t,e,n),u=rie(l),d=Sne(u,o);return{file:a,commandArguments:c,command:r,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},rie=({timeout:t,signal:e,...n})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...n,timeoutDuration:t}},iie=({file:t,commandArguments:e,options:n,startTime:r,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=qN(t,e,n)}catch(p){return vne({error:p,command:s,escapedCommand:o,fileDescriptors:a,options:n,startTime:r,verboseInfo:i})}const l=new AbortController;VN(Number.POSITIVE_INFINITY,l.signal);const u=[...c.stdio];jne(c,a,l),Jne(c,n,l);const d={},f=Tu();c.kill=xJ.bind(void 0,{kill:c.kill.bind(c),options:n,onInternalError:f,context:d,controller:l}),c.all=Are(c,n),Jre(c,n),mne(c,n);const h=sie({subprocess:c,options:n,startTime:r,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:s,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:h}},sie=async({subprocess:t,options:e,startTime:n,verboseInfo:r,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{const[d,[f,h],p,y,R]=await Mre({subprocess:t,options:e,context:c,verboseInfo:r,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:u});u.abort(),l.resolve();const b=p.map((_,N)=>Aa(_,e,N)),v=Aa(y,e,"all"),T=oie({errorInfo:d,exitCode:f,signal:h,stdio:b,all:v,ipcOutput:R,context:c,options:e,command:o,escapedCommand:a,startTime:n});return ab(T,r,e)},oie=({errorInfo:t,exitCode:e,signal:n,stdio:r,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?ob({error:t.error,command:c,escapedCommand:l,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Ap,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:n,stdio:r,all:i,ipcOutput:s,options:a,startTime:u,isSync:!1}):jx({command:c,escapedCommand:l,stdio:r,all:i,ipcOutput:s,options:a,startTime:u}),kb=(t,e)=>{const n=Object.fromEntries(Object.entries(e).map(([r,i])=>[r,aie(r,t[r],i)]));return{...t,...n}},aie=(t,e,n)=>cie.has(t)&&Hn(e)&&Hn(n)?{...e,...n}:n,cie=new Set(["env",...EI]),oo=(t,e,n,r)=>{const i=(o,a,c)=>oo(o,a,n,c),s=(...o)=>lie({mapArguments:t,deepOptions:n,boundOptions:e,setBoundExeca:r,createNested:i},...o);return r!==void 0&&r(s,i,e),s},lie=({mapArguments:t,deepOptions:e={},boundOptions:n={},setBoundExeca:r,createNested:i},s,...o)=>{if(Hn(s))return i(t,kb(n,s),r);const{file:a,commandArguments:c,options:l,isSync:u}=uie({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:n});return u?Zte(a,c,l):tie(a,c,l,i)},uie=({mapArguments:t,firstArgument:e,nextArguments:n,deepOptions:r,boundOptions:i})=>{const s=kY(e)?_Y(e,n):[e,...n],[o,a,c]=uI(...s),l=kb(kb(r,i),c),{file:u=o,commandArguments:d=a,options:f=l,isSync:h=!1}=t({file:o,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:h}},die=({file:t,commandArguments:e})=>hN(t,e),fie=({file:t,commandArguments:e})=>({...hN(t,e),isSync:!0}),hN=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);const[n,...r]=hie(t);return{file:n,commandArguments:r}},hie=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);const e=t.trim();if(e==="")return[];const n=[];for(const r of e.split(pie)){const i=n.at(-1);i&&i.endsWith("\\")?n[n.length-1]=`${i.slice(0,-1)} ${r}`:n.push(r)}return n},pie=/ +/g,gie=(t,e,n)=>{t.sync=e(yie,n),t.s=t.sync},mie=({options:t})=>pN(t),yie=({options:t})=>({...pN(t),isSync:!0}),pN=t=>({options:{...vie(t),...t}}),vie=({input:t,inputFile:e,stdio:n})=>t===void 0&&e===void 0&&n===void 0?{stdin:"inherit"}:{},wie={preferLocal:!0},_b=oo(()=>({}));oo(()=>({isSync:!0})),oo(die),oo(fie),oo(AQ),oo(mie,{},wie,gie),yne();const Cb=pp(2);class bie{constructor(e="dot"){this.path=e}async unflatten(e){return await Cb(async()=>{const n=await _b("unflatten",["-l 1","-c 3"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});return n instanceof Error&&(n.stdout?Fe.warn(`[BinaryGraphvizLayouter.layout] '${n.command}' failed: ${n.stderr}
1212
+
1213
+ but returned
1214
+ ${n.stdout}`):Fe.error(`[BinaryGraphvizLayouter.layout] '${n.command}' failed: ${n.stderr}
1215
+
1216
+ nothing returned, ignoring...`)),n.stdout&&(e=n.stdout.replaceAll(/\t\[/g," [").replaceAll(/\t/g," ")),e})}async layoutJson(e){return await Cb(async()=>{const n=await _b(this.path,["-Tjson","-y"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});if(n instanceof Error){if(!n.stdout)throw Fe.error(`[BinaryGraphvizLayouter.layout] '${n.command}' nothing returned and failed: "${n.stderr}"`),n;Fe.warn(`[BinaryGraphvizLayouter.layout] '${n.command}' returned result but also failed "${n.stderr}"`)}return n.stdout})}async acyclic(e){return Promise.reject(new Error("Method not implemented."))}async svg(e){return await Cb(async()=>{const n=await _b(this.path,["-Tsvg","-y"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});if(n instanceof Error){if(!n.stdout)throw Fe.error(`[BinaryGraphvizLayouter.layout] '${n.command}' nothing returned and failed: ${n.stderr}`),n;Fe.warn(`[BinaryGraphvizLayouter.layout] '${n.command}' returned result but also failed ${n.stderr}`)}return n.stdout})}}function Ab(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 Ib(t,e,n=".",r){if(!Ab(e))return Ib(t,{},n,r);const i=Object.assign({},e);for(const s in t){if(s==="__proto__"||s==="constructor")continue;const o=t[s];o!=null&&(r&&r(i,s,o,n)||(Array.isArray(o)&&Array.isArray(i[s])?i[s]=[...o,...i[s]]:Ab(o)&&Ab(i[s])?i[s]=Ib(o,i[s],(n?`${n}.`:"")+s.toString(),r):i[s]=o))}return i}function Tie(t){return(...e)=>e.reduce((n,r)=>Ib(n,r,"",t),{})}const Eie=Tie();class Rie{constructor(){this.encoding="utf-8"}readFile(e){return Mb.promises.readFile(e.fsPath,this.encoding)}async readDirectory(e){return(await Mb.promises.readdir(e.fsPath,{withFileTypes:!0})).map(r=>({dirent:r,isFile:r.isFile(),isDirectory:r.isDirectory(),uri:mt.joinPath(e,r.name)}))}}const Sie={fileSystemProvider:()=>new Rie},$ie="likec4",kie="1.10.1",_ie="MIT",Cie="https://likec4.dev",Aie="Denis Davydkov <denis@davydkov.com>",Iie={url:"https://github.com/sponsors/davydkov"},xie={type:"git",url:"https://github.com/likec4/likec4.git",directory:"packages/likec4"},Pie={node:">=20.0.0"},Nie="https://github.com/likec4/likec4/issues",Die="module",Oie="./bin/likec4.mjs",Lie={".":"./src/index.ts","./react":{types:"./app/react/components/index.ts",default:"./react/index.mjs"},"./react/style.css":"./react/style.css","./icons/all":{types:"./icons/all.d.ts",default:"./icons/all.js"},"./icons/*":{types:"./icons/icon.d.ts",default:"./icons/*"}},Mie={registry:"https://registry.npmjs.org",access:"public",exports:{".":{types:"./dist/index.d.mts",default:"./dist/index.mjs"},"./react":{types:"./react/index.d.ts",default:"./react/index.mjs"},"./react/style.css":"./react/style.css","./icons/all":{types:"./icons/all.d.ts",default:"./icons/all.js"},"./icons/*":{types:"./icons/icon.d.ts",default:"./icons/*"}}},Fie={"turbo-build":"turbo run build --log-prefix=none --log-order=grouped","typecheck:app":"tsc --noEmit -p ./app/tsconfig.json","typecheck:cli":"tsc --noEmit -p ./tsconfig.cli.json",typecheck:"run-p --print-label 'typecheck:*'",prebuild:"tsx scripts/prebuild.ts","build:cli":"unbuild","build:app":"tsx scripts/bundle-app.ts","build:react":"tsx scripts/bundle-react.ts","build:react-dts":"tsx scripts/dts-react.ts","build:webcomponent":"tsx scripts/bundle-webcomponent.ts",build:"run prebuild && run-p --print-label 'build:*'",generate:"tsx scripts/generate.ts",prepack:"tsx scripts/prepack.ts",lint:"run -T eslint src/ --fix",clean:"run -T rimraf dist app/dist dev/.export dev/dist node_modules/.vite",dev:"tsx watch src/cli/index.ts serve dev","dev:docs:bigbank":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/bigbank","dev:docs:dynamic-view":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/dynamic-view","dev:docs:index-page":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/index-page","dev:docs:theme":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/likec4-theme","dev:template":"tsx watch src/cli/index.ts serve ../create-likec4/template","dev:example-cloud":"tsx watch src/cli/index.ts serve ../../examples/cloud-system","dev:failed":"tsx watch src/cli/index.ts serve ../../examples/failed","dev:example-dev":"tsx watch src/cli/index.ts serve ../../examples/diagrams-dev/likec4",cli:"tsx src/cli/index.ts","cli:serve":"tsx watch src/cli/index.ts serve dev","cli:build":"tsx src/cli/index.ts build -o dev/dist dev","cli:preview":"tsx src/cli/index.ts preview -o dev/dist dev","cli:export":"tsx src/cli/index.ts export png -o dev/export dev","cli:export:json":"tsx src/cli/index.ts export json -o dev/export/likec4.json dev",test:"vitest run --no-isolate","vitest:ui":"vitest --no-isolate --ui","test:watch":"vitest"},jie={"@hpcc-js/wasm-graphviz":"1.3.0","@nanostores/react":"0.7.3","@vitejs/plugin-react":"4.3.1","esm-env":"^1.0.0",nanostores:"0.11.3",playwright:"1.46.1",react:"^18.3.1","react-dom":"^18.3.1",vite:"5.3.4",yargs:"17.7.2"},Uie={"@fontsource/ibm-plex-sans":"^5.0.22","@likec4/core":"workspace:*","@likec4/diagram":"workspace:*","@likec4/generators":"workspace:*","@likec4/icons":"workspace:*","@likec4/language-server":"workspace:*","@likec4/layouts":"workspace:*","@likec4/log":"workspace:*","@likec4/tsconfig":"workspace:*","@mantine/core":"7.12.2","@mantine/hooks":"7.12.2","@mantine/vanilla-extract":"7.12.2","@react-hookz/web":"^24.0.4","@tabler/icons-react":"^3.16.0","@tanstack/react-router":"1.45.13","@tanstack/router-cli":"1.45.13","@tanstack/router-vite-plugin":"1.45.13","@types/node":"^20.16.1","@types/prop-types":"^15.7.11","@types/react":"18.3.4","@types/react-dom":"18.3.0","@types/string-hash":"^1.1.3","@types/yargs":"^17.0.33","@vanilla-extract/css":"^1.15.5","@vanilla-extract/dynamic":"^2.1.2","@vanilla-extract/vite-plugin":"^4.0.15","@xyflow/react":"12.3.0","@xyflow/system":"0.0.42",autoprefixer:"^10.4.20","ci-info":"^3.9.0",classnames:"^2.5.1",clsx:"^2.1.1",defu:"^6.1.4","dts-bundle-generator":"^9.5.1",esbuild:"^0.23.1","esbuild-node-externals":"^1.14.0",execa:"^9.3.1","fast-equals":"^5.0.1","framer-motion":"^11.5.4","get-port":"^7.1.0",glob:"^11.0.0","html-to-image":"^1.11.11",json5:"^2.2.3",langium:"3.2.0",mkdirp:"^3.0.1","npm-run-all2":"^6.2.2","p-limit":"^6.1.0","package-up":"^5.0.0",postcss:"^8.4.41","postcss-preset-mantine":"^1.17.0","pretty-ms":"^9.1.0","react-error-boundary":"^4.0.13","react-resizable-panels":"^2.1.2","react-shadow":"^20.5.0",remeda:"^2.11.0","string-hash":"^1.1.3","strip-indent":"^4.0.0",terser:"^5.31.6",tinyrainbow:"^1.2.0",tsx:"~4.9.3",turbo:"^2.1.1","type-fest":"^4.26.1",typescript:"^5.6.2",ufo:"^1.5.4",unbuild:"^3.0.0-rc.7","vite-plugin-css-injected-by-js":"^3.5.1","vite-plugin-shadow-style":"^1.1.1",vitest:"^2.1.0"},Bie="yarn@4.4.1",gN={name:$ie,version:kie,license:_ie,homepage:Cie,author:Aie,sponsor:Iie,repository:xie,engines:Pie,bugs:Nie,type:Die,bin:Oie,exports:Lie,publishConfig:Mie,scripts:Fie,dependencies:jie,devDependencies:Uie,packageManager:Bie};var xb={},qie=[{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}];(function(t){const e=qie,n=process.env;Object.defineProperty(t,"_vendors",{value:e.map(function(i){return i.constant})}),t.name=null,t.isPR=null,e.forEach(function(i){const o=(Array.isArray(i.env)?i.env:[i.env]).every(function(a){return r(a)});if(t[i.constant]=o,!!o)switch(t.name=i.name,typeof i.pr){case"string":t.isPR=!!n[i.pr];break;case"object":"env"in i.pr?t.isPR=i.pr.env in n&&n[i.pr.env]!==i.pr.ne:"any"in i.pr?t.isPR=i.pr.any.some(function(a){return!!n[a]}):t.isPR=r(i.pr);break;default:t.isPR=null}}),t.isCI=!!(n.CI!=="false"&&(n.BUILD_ID||n.BUILD_NUMBER||n.CI||n.CI_APP_ID||n.CI_BUILD_ID||n.CI_BUILD_NUMBER||n.CI_NAME||n.CONTINUOUS_INTEGRATION||n.RUN_ID||t.name));function r(i){return typeof i=="string"?!!n[i]:"env"in i?n[i.env]&&n[i.env].includes(i.includes):"any"in i?i.any.some(function(s){return!!n[s]}):Object.keys(i).every(function(s){return n[s]===i[s]})}})(xb);const mN=et.bold(et.bgRed(et.white("ERROR"))),Wie=et.bold(et.yellow("WARN")),Gie=et.bold(et.green("INFO"));function yN(t){const e=JN("info",{prefix:t,allowClearScreen:!xb.isCI}),n=!xb.isCI;return{...e,info(r,i){e.info(`${Gie} ${r}`,{timestamp:n,...i})},warn(r,i){e.warn(`${Wie} ${r}`,{timestamp:n,...i})},error(r,i){if(r instanceof Error){e.error(`${mN} ${et.red(r.stack??r.name+" "+r.message)}`,{timestamp:n,error:r,...i});return}e.error(`${mN} ${r}`,{timestamp:n,...i})}}}const zie=1e6;function vN(t){const[e,n]=Au(t),r=e*1e3+n/zie;return{ms:r,pretty:qx(r)}}function Hie(t){const e=Au();return{stopAndLog(n="done in "){n=et.green(`${n}${vN(e).pretty}`),t?t.info(n):Fe.success(n)}}}class Kie{constructor(e){this.services=e,this.layouter=e.likec4.Layouter}cache=new WeakMap;layouter;previousAction=Promise.resolve();limit=pp(2);inflightRequest;async computedViews(){try{this.inflightRequest??=Promise.resolve().then(async()=>await this.services.likec4.ModelBuilder.buildComputedModel());const e=await Promise.resolve(this.inflightRequest);return Object.values(e?.views??{})}finally{this.inflightRequest=void 0}}async layoutViews(){const e=this.services.logger,n=this.previousAction.then(async()=>{const r=(await this.computedViews()).map(i=>this.limit(async()=>{try{let s=this.cache.get(i);return s||(s=await this.layouter.layout(i),this.cache.set(i,s)),s}catch(s){return e.error(s),null}}));return(await Promise.all(r)).filter(Q)});return this.previousAction=n.catch(r=>(e.error(r),Promise.resolve([]))),await n}async diagrams(){return(await this.layoutViews()).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(s=>this.limit(async()=>{const{dot:o,svg:a}=await this.layouter.svg(s);return{id:s.id,dot:o,svg:a}})),i=await Promise.all(r);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}}class Vie{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(`${et.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(`${et.dim("workspace:")} found ${s.length} source files`),await i.build(s,{validation:!0});const o=await n.buildComputedModel(),a=eh(o?.views??{}).length;if(a===0){e.warn(`${et.dim("workspace:")} no views found`);return}e.info(`${et.dim("workspace:")} ${et.green(`\u2713 computed ${a} views`)}`);const c=await this.services.likec4.Views.diagrams();c.length===a?e.info(`${et.dim("workspace:")} ${et.green("\u2713 all views layouted")}`):e.warn(`${et.dim("workspace:")} ${et.yellow(`\u2717 layouted ${c.length} views`)}`)}}function wN(t){return e=>new t(e)}const Yie={logger:()=>{throw new Error("Logger must be provided")},likec4:{Layouter:()=>{throw new Error("Layouter must be provided")},Views:wN(Kie)},cli:{Workspace:wN(Vie)}};function bN(t){const e=Eie(t,{useFileSystem:!0,logger:"default",graphviz:"wasm"});let n;switch(e.logger){case"vite":n=yN("c4:lsp ");break;case"default":n=Fe;break;default:n=e.logger}const r=e.graphviz==="binary";n.info(`${et.dim("version")} ${gN.version}`),n.info(`${et.dim("layout")} ${r?"binary":"wasm"}`);const i={logger:()=>n,likec4:{Layouter:()=>new vY(r===!0?new bie:new aY)}};return JH("warn"),nV(e.useFileSystem?Sie:{},Yie,i).likec4}const TN=t=>new Error(`Invalid model:
1217
+ ${t.getErrors().map(e=>` ${e.sourceFsPath}:${e.line} ${e.message.slice(0,200)}`).join(`
1218
+ `)}`);class cs{constructor(e,n,r){this.workspace=e,this.langium=n,this.isPrintErrorEnabled=r,this.logger=n.logger,this.langiumDocuments=n.shared.workspace.LangiumDocuments,this.views=n.likec4.Views,this.isPrintErrorEnabled&&this.printErrors()}static async fromSource(e,n){const r=bN({useFileSystem:!1,...n}),i=qt.from({scheme:"virtual",path:"/workspace"});await r.cli.Workspace.initWorkspace({uri:i.toString(),name:"virtual"});const s=mt.joinPath(i,"source.likec4");r.shared.workspace.LangiumDocuments.createDocument(s,e),await r.cli.Workspace.init();const o=new cs(i.path,r,n?.printErrors??!0);return n?.throwIfInvalid===!0&&o.hasErrors()?Promise.reject(TN(o)):o}static likec4Instances=new Map;static async fromWorkspace(e,n){const r=xN(e);if(!AN(r))throw new Error(`Workspace not found: ${r}`);let i=cs.likec4Instances.get(r);if(!i){const s=bN({useFileSystem:!0,...n});await s.cli.Workspace.initWorkspace({uri:NN(r).toString(),name:PN(r)}),await s.cli.Workspace.init(),i=new cs(r,s,n?.printErrors??!0),cs.likec4Instances.set(r,i)}return n?.throwIfInvalid===!0&&i.hasErrors()?Promise.reject(TN(i)):i}cachedModel;logger;langiumDocuments;views;async computed(){return await this.langium.likec4.ModelBuilder.buildComputedModel()}model(){if(!this.cachedModel){const e=this.langium.likec4.ModelBuilder.unsafeSyncBuildModel();if(!e)throw new Error("Failed to build model");const n=this.langium.likec4.ModelBuilder.unsafeSyncBuildComputedModel(e);this.cachedModel=Xu.from(n)}return this.cachedModel}async diagrams(){return await this.views.diagrams()}getErrors(){return this.langiumDocuments.all.toArray().flatMap(e=>(e.diagnostics??[]).filter(n=>n.severity===Bc.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===Bc.Error))}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 o=s.range.start.line,a=s.message.split(`
1219
+ `);return a.length>10&&(a.length=10,a.push("...")),a.map((c,l)=>l===0?" "+et.dim(`Line ${o}: `)+et.red(c):" ".repeat(10)+et.red(c))}).join(`
1220
+ `);this.logger.error(`Invalid ${n.uri.fsPath}
1221
+ ${i}`)}}return e}async notifyUpdate({changed:e,removed:n}){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?[qt.file(e)]:[],n?[qt.file(n)]:[],s),i=!s.isCancellationRequested}),i}catch(i){return this.logger.error(i),!1}}onModelUpdate(e){const n=this.langium.likec4.ModelBuilder.onModelParsed(()=>e());return()=>{n.dispose()}}dispose(){for(const[e,n]of cs.likec4Instances)n===this&&cs.likec4Instances.delete(e)}}export{bT as $,Q as A,Sg as B,Rg as C,Vi as D,et as E,uD as F,pp as G,hi as H,eC as I,yN as J,KH as K,Vu as L,Iv as M,OL as N,VH as O,tl as P,Pn as Q,Oa as R,nC as S,ce as T,vN as U,Hie as V,yv as W,Hu as X,La as Y,Ir as Z,Fe as _,m0 as a,Je as a0,gN as a1,Yu as b,y0 as c,Qp as d,Xu as e,gr as f,Eo as g,at as h,Et as i,dD as j,cs as k,Yt as l,_o as m,So as n,qT as o,ct as p,Se as q,$t as r,pT as s,uT as t,vT as u,Xn as v,We as w,_s as x,Ar as y,He as z};