mirror of
https://github.com/distribution/distribution.git
synced 2025-08-14 13:04:11 +00:00
1 line
293 KiB
JavaScript
1 line
293 KiB
JavaScript
"use strict";(self.webpackChunkgeekdoc=self.webpackChunkgeekdoc||[]).push([[731],{9850:(e,t,n)=>{t.Qi=t.XO=void 0;const r=n(9590),i=n(8585),s=n(2676);var a;!function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:s.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:s.Event.None}),e.is=function(t){const n=t;return n&&(n===e.None||n===e.Cancelled||i.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}}(a||(t.XO=a={}));const o=Object.freeze((function(e,t){const n=(0,r.default)().timer.setTimeout(e.bind(t),0);return{dispose(){n.dispose()}}}));class c{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?o:(this._emitter||(this._emitter=new s.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}t.Qi=class{get token(){return this._token||(this._token=new c),this._token}cancel(){this._token?this._token.cancel():this._token=a.Cancelled}dispose(){this._token?this._token instanceof c&&this._token.dispose():this._token=a.None}}},2676:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=t.Event=void 0;const r=n(9590);var i;!function(e){const t={dispose(){}};e.None=function(){return t}}(i||(t.Event=i={}));class s{add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let r=0,i=this._callbacks.length;r<i;r++)if(this._callbacks[r]===e){if(this._contexts[r]===t)return this._callbacks.splice(r,1),void this._contexts.splice(r,1);n=!0}if(n)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 t=[],n=this._callbacks.slice(0),i=this._contexts.slice(0);for(let s=0,a=n.length;s<a;s++)try{t.push(n[s].apply(i[s],e))}catch(e){(0,r.default)().console.error(e)}return t}isEmpty(){return!this._callbacks||0===this._callbacks.length}dispose(){this._callbacks=void 0,this._contexts=void 0}}class a{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,n)=>{this._callbacks||(this._callbacks=new s),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);const r={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),r.dispose=a._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(r),r}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}t.Emitter=a,a._noop=function(){}},8585:(e,t)=>{function n(e){return"string"==typeof e||e instanceof String}function r(e){return Array.isArray(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.stringArray=t.array=t.func=t.error=t.number=t.string=t.boolean=void 0,t.boolean=function(e){return!0===e||!1===e},t.string=n,t.number=function(e){return"number"==typeof e||e instanceof Number},t.error=function(e){return e instanceof Error},t.func=function(e){return"function"==typeof e},t.array=r,t.stringArray=function(e){return r(e)&&e.every((e=>n(e)))}},9590:(e,t)=>{let n;function r(){if(void 0===n)throw new Error("No runtime abstraction layer installed");return n}Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.install=function(e){if(void 0===e)throw new Error("No runtime abstraction layer provided");n=e}}(r||(r={})),t.default=r},7021:(e,t,n)=>{n.d(t,{v:()=>o});var r=n(9369),i=n(3707),s=class extends r.mR{static{(0,r.K2)(this,"InfoTokenBuilder")}constructor(){super(["info","showInfo"])}},a={parser:{TokenBuilder:(0,r.K2)((()=>new s),"TokenBuilder"),ValueConverter:(0,r.K2)((()=>new r.Tm),"ValueConverter")}};function o(e=i.DD){const t=(0,i.WQ)((0,i.uM)(e),r.sr),n=(0,i.WQ)((0,i.tG)({shared:t}),r.e5,a);return t.ServiceRegistry.register(n),{shared:t,Info:n}}(0,r.K2)(o,"createInfoServices")},8685:(e,t,n)=>{n.d(t,{f:()=>c});var r=n(9369),i=n(3707),s=class extends r.mR{static{(0,r.K2)(this,"PieTokenBuilder")}constructor(){super(["pie","showData"])}},a=class extends r.dg{static{(0,r.K2)(this,"PieValueConverter")}runCustomConverter(e,t,n){if("PIE_SECTION_LABEL"===e.name)return t.replace(/"/g,"").trim()}},o={parser:{TokenBuilder:(0,r.K2)((()=>new s),"TokenBuilder"),ValueConverter:(0,r.K2)((()=>new a),"ValueConverter")}};function c(e=i.DD){const t=(0,i.WQ)((0,i.uM)(e),r.sr),n=(0,i.WQ)((0,i.tG)({shared:t}),r.KX,o);return t.ServiceRegistry.register(n),{shared:t,Pie:n}}(0,r.K2)(c,"createPieServices")},1609:(e,t,n)=>{n.d(t,{$:()=>o});var r=n(9369),i=n(3707),s=class extends r.mR{static{(0,r.K2)(this,"PacketTokenBuilder")}constructor(){super(["packet-beta"])}},a={parser:{TokenBuilder:(0,r.K2)((()=>new s),"TokenBuilder"),ValueConverter:(0,r.K2)((()=>new r.Tm),"ValueConverter")}};function o(e=i.DD){const t=(0,i.WQ)((0,i.uM)(e),r.sr),n=(0,i.WQ)((0,i.tG)({shared:t}),r.AM,a);return t.ServiceRegistry.register(n),{shared:t,Packet:n}}(0,r.K2)(o,"createPacketServices")},9936:(e,t,n)=>{n.d(t,{S:()=>c});var r=n(9369),i=n(3707),s=class extends r.mR{static{(0,r.K2)(this,"ArchitectureTokenBuilder")}constructor(){super(["architecture"])}},a=class extends r.dg{static{(0,r.K2)(this,"ArchitectureValueConverter")}runCustomConverter(e,t,n){return"ARCH_ICON"===e.name?t.replace(/[()]/g,"").trim():"ARCH_TEXT_ICON"===e.name?t.replace(/["()]/g,""):"ARCH_TITLE"===e.name?t.replace(/[[\]]/g,"").trim():void 0}},o={parser:{TokenBuilder:(0,r.K2)((()=>new s),"TokenBuilder"),ValueConverter:(0,r.K2)((()=>new a),"ValueConverter")}};function c(e=i.DD){const t=(0,i.WQ)((0,i.uM)(e),r.sr),n=(0,i.WQ)((0,i.tG)({shared:t}),r.jE,o);return t.ServiceRegistry.register(n),{shared:t,Architecture:n}}(0,r.K2)(c,"createArchitectureServices")},2785:(e,t,n)=>{n.d(t,{b:()=>o});var r=n(9369),i=n(3707),s=class extends r.mR{static{(0,r.K2)(this,"GitGraphTokenBuilder")}constructor(){super(["gitGraph"])}},a={parser:{TokenBuilder:(0,r.K2)((()=>new s),"TokenBuilder"),ValueConverter:(0,r.K2)((()=>new r.Tm),"ValueConverter")}};function o(e=i.DD){const t=(0,i.WQ)((0,i.uM)(e),r.sr),n=(0,i.WQ)((0,i.tG)({shared:t}),r.eZ,a);return t.ServiceRegistry.register(n),{shared:t,GitGraph:n}}(0,r.K2)(o,"createGitGraphServices")},9369:(e,t,n)=>{n.d(t,{AM:()=>$,K2:()=>s,KX:()=>w,Tm:()=>P,dg:()=>_,e5:()=>C,eZ:()=>O,jE:()=>L,mR:()=>M,sr:()=>N});var r=n(3707),i=Object.defineProperty,s=(e,t)=>i(e,"name",{value:t,configurable:!0});s((function(e){return g.isInstance(e,"Architecture")}),"isArchitecture");var a="Branch";s((function(e){return g.isInstance(e,a)}),"isBranch");var o="Commit";s((function(e){return g.isInstance(e,o)}),"isCommit"),s((function(e){return g.isInstance(e,"Common")}),"isCommon");var c="GitGraph";s((function(e){return g.isInstance(e,c)}),"isGitGraph"),s((function(e){return g.isInstance(e,"Info")}),"isInfo");var l="Merge";s((function(e){return g.isInstance(e,l)}),"isMerge"),s((function(e){return g.isInstance(e,"Packet")}),"isPacket"),s((function(e){return g.isInstance(e,"PacketBlock")}),"isPacketBlock"),s((function(e){return g.isInstance(e,"Pie")}),"isPie"),s((function(e){return g.isInstance(e,"PieSection")}),"isPieSection");var u,d,h,f,p,m=class extends r.kD{static{s(this,"MermaidAstReflection")}getAllTypes(){return["Architecture","Branch","Checkout","CherryPicking","Commit","Common","Direction","Edge","GitGraph","Group","Info","Junction","Merge","Packet","PacketBlock","Pie","PieSection","Service","Statement"]}computeIsSubtype(e,t){switch(e){case a:case"Checkout":case"CherryPicking":case o:case l:return this.isSubtype("Statement",t);case"Direction":return this.isSubtype(c,t);default:return!1}}getReferenceType(e){const t=`${e.container.$type}:${e.property}`;throw new Error(`${t} is not a valid reference id.`)}getTypeMetaData(e){switch(e){case"Architecture":return{name:"Architecture",properties:[{name:"accDescr"},{name:"accTitle"},{name:"edges",defaultValue:[]},{name:"groups",defaultValue:[]},{name:"junctions",defaultValue:[]},{name:"services",defaultValue:[]},{name:"title"}]};case"Branch":return{name:"Branch",properties:[{name:"name"},{name:"order"}]};case"Checkout":return{name:"Checkout",properties:[{name:"branch"}]};case"CherryPicking":return{name:"CherryPicking",properties:[{name:"id"},{name:"parent"},{name:"tags",defaultValue:[]}]};case"Commit":return{name:"Commit",properties:[{name:"id"},{name:"message"},{name:"tags",defaultValue:[]},{name:"type"}]};case"Common":return{name:"Common",properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case"Edge":return{name:"Edge",properties:[{name:"lhsDir"},{name:"lhsGroup",defaultValue:!1},{name:"lhsId"},{name:"lhsInto",defaultValue:!1},{name:"rhsDir"},{name:"rhsGroup",defaultValue:!1},{name:"rhsId"},{name:"rhsInto",defaultValue:!1},{name:"title"}]};case"GitGraph":return{name:"GitGraph",properties:[{name:"accDescr"},{name:"accTitle"},{name:"statements",defaultValue:[]},{name:"title"}]};case"Group":return{name:"Group",properties:[{name:"icon"},{name:"id"},{name:"in"},{name:"title"}]};case"Info":return{name:"Info",properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case"Junction":return{name:"Junction",properties:[{name:"id"},{name:"in"}]};case"Merge":return{name:"Merge",properties:[{name:"branch"},{name:"id"},{name:"tags",defaultValue:[]},{name:"type"}]};case"Packet":return{name:"Packet",properties:[{name:"accDescr"},{name:"accTitle"},{name:"blocks",defaultValue:[]},{name:"title"}]};case"PacketBlock":return{name:"PacketBlock",properties:[{name:"end"},{name:"label"},{name:"start"}]};case"Pie":return{name:"Pie",properties:[{name:"accDescr"},{name:"accTitle"},{name:"sections",defaultValue:[]},{name:"showData",defaultValue:!1},{name:"title"}]};case"PieSection":return{name:"PieSection",properties:[{name:"label"},{name:"value"}]};case"Service":return{name:"Service",properties:[{name:"icon"},{name:"iconText"},{name:"id"},{name:"in"},{name:"title"}]};case"Direction":return{name:"Direction",properties:[{name:"accDescr"},{name:"accTitle"},{name:"dir"},{name:"statements",defaultValue:[]},{name:"title"}]};default:return{name:e,properties:[]}}}},g=new m,y=s((()=>u??(u=(0,r.y0)('{"$type":"Grammar","isDeclared":true,"name":"Info","imports":[],"rules":[{"$type":"ParserRule","name":"Info","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"InfoGrammar"),A=s((()=>d??(d=(0,r.y0)('{"$type":"Grammar","isDeclared":true,"name":"Packet","imports":[],"rules":[{"$type":"ParserRule","name":"Packet","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"packet-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"PacketGrammar"),T=s((()=>h??(h=(0,r.y0)('{"$type":"Grammar","isDeclared":true,"name":"Pie","imports":[],"rules":[{"$type":"ParserRule","name":"Pie","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"PIE_SECTION_LABEL","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]+\\"/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PIE_SECTION_VALUE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(0|[1-9][0-9]*)(\\\\.[0-9]+)?/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"PieGrammar"),v=s((()=>f??(f=(0,r.y0)('{"$type":"Grammar","isDeclared":true,"name":"Architecture","imports":[],"rules":[{"$type":"ParserRule","name":"Architecture","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","fragment":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LeftPort","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RightPort","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Arrow","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ID","definition":{"$type":"RegexToken","regex":"/[\\\\w]+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TEXT_ICON","definition":{"$type":"RegexToken","regex":"/\\\\(\\"[^\\"]+\\"\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[[\\\\w ]+\\\\]/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"ArchitectureGrammar"),R=s((()=>p??(p=(0,r.y0)('{"$type":"Grammar","isDeclared":true,"name":"GitGraph","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"ParserRule","name":"GitGraph","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+(?=\\\\s)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[]}'))),"GitGraphGrammar"),E={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},k={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},x={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},I={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},S={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},N={AstReflection:s((()=>new m),"AstReflection")},C={Grammar:s((()=>y()),"Grammar"),LanguageMetaData:s((()=>E),"LanguageMetaData"),parser:{}},$={Grammar:s((()=>A()),"Grammar"),LanguageMetaData:s((()=>k),"LanguageMetaData"),parser:{}},w={Grammar:s((()=>T()),"Grammar"),LanguageMetaData:s((()=>x),"LanguageMetaData"),parser:{}},L={Grammar:s((()=>v()),"Grammar"),LanguageMetaData:s((()=>I),"LanguageMetaData"),parser:{}},O={Grammar:s((()=>R()),"Grammar"),LanguageMetaData:s((()=>S),"LanguageMetaData"),parser:{}},b={ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/accTitle[\t ]*:([^\n\r]*)/,TITLE:/title([\t ][^\n\r]*|)/},_=class extends r.dM{static{s(this,"AbstractMermaidValueConverter")}runConverter(e,t,n){let r=this.runCommonConverter(e,t,n);return void 0===r&&(r=this.runCustomConverter(e,t,n)),void 0===r?super.runConverter(e,t,n):r}runCommonConverter(e,t,n){const r=b[e.name];if(void 0===r)return;const i=r.exec(t);return null!==i?void 0!==i[1]?i[1].trim().replace(/[\t ]{2,}/gm," "):void 0!==i[2]?i[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,"\n"):void 0:void 0}},P=class extends _{static{s(this,"CommonValueConverter")}runCustomConverter(e,t,n){}},M=class extends r.QU{static{s(this,"AbstractMermaidTokenBuilder")}constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,n){const r=super.buildKeywordTokens(e,t,n);return r.forEach((e=>{this.keywords.has(e.name)&&void 0!==e.PATTERN&&(e.PATTERN=new RegExp(e.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))})),r}};(class extends M{static{s(this,"CommonTokenBuilder")}})},8731:(e,t,n)=>{n.d(t,{qg:()=>a}),n(2785),n(7021),n(1609),n(8685),n(9936);var r=n(9369),i={},s={info:(0,r.K2)((async()=>{const{createInfoServices:e}=await n.e(890).then(n.bind(n,890)),t=e().Info.parser.LangiumParser;i.info=t}),"info"),packet:(0,r.K2)((async()=>{const{createPacketServices:e}=await n.e(452).then(n.bind(n,4071)),t=e().Packet.parser.LangiumParser;i.packet=t}),"packet"),pie:(0,r.K2)((async()=>{const{createPieServices:e}=await n.e(723).then(n.bind(n,7723)),t=e().Pie.parser.LangiumParser;i.pie=t}),"pie"),architecture:(0,r.K2)((async()=>{const{createArchitectureServices:e}=await n.e(720).then(n.bind(n,9720)),t=e().Architecture.parser.LangiumParser;i.architecture=t}),"architecture"),gitGraph:(0,r.K2)((async()=>{const{createGitGraphServices:e}=await n.e(387).then(n.bind(n,2387)),t=e().GitGraph.parser.LangiumParser;i.gitGraph=t}),"gitGraph")};async function a(e,t){const n=s[e];if(!n)throw new Error(`Unknown diagram type: ${e}`);i[e]||await n();const r=i[e].parse(t);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new o(r);return r.value}(0,r.K2)(a,"parse");var o=class extends Error{constructor(e){super(`Parsing failed: ${e.lexerErrors.map((e=>e.message)).join("\n")} ${e.parserErrors.map((e=>e.message)).join("\n")}`),this.result=e}static{(0,r.K2)(this,"MermaidParseError")}}},3707:(e,t,n)=>{function r(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$type}function i(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$refText}function s(e){return"object"==typeof e&&null!==e&&r(e.container)&&i(e.reference)&&"string"==typeof e.message}n.d(t,{kD:()=>a,QU:()=>pc,dM:()=>mc,DD:()=>Jl,tG:()=>jl,uM:()=>Vl,WQ:()=>Hl,y0:()=>tu});class a{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,t){return r(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let n=this.subtypes[e];n||(n=this.subtypes[e]={});const r=n[t];if(void 0!==r)return r;{const r=this.computeIsSubtype(e,t);return n[t]=r,r}}getAllSubTypes(e){const t=this.allSubtypes[e];if(t)return t;{const t=this.getAllTypes(),n=[];for(const r of t)this.isSubtype(r,e)&&n.push(r);return this.allSubtypes[e]=n,n}}}function o(e){return"object"==typeof e&&null!==e&&Array.isArray(e.content)}function c(e){return"object"==typeof e&&null!==e&&"object"==typeof e.tokenType}function l(e){return o(e)&&"string"==typeof e.fullText}class u{constructor(e,t){this.startFn=e,this.nextFn=t}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){const e=this.iterator();return Boolean(e.next().done)}count(){const e=this.iterator();let t=0,n=e.next();for(;!n.done;)t++,n=e.next();return t}toArray(){const e=[],t=this.iterator();let n;do{n=t.next(),void 0!==n.value&&e.push(n.value)}while(!n.done);return e}toSet(){return new Set(this)}toMap(e,t){const n=this.map((n=>[e?e(n):n,t?t(n):n]));return new Map(n)}toString(){return this.join()}concat(e){const t=e[Symbol.iterator]();return new u((()=>({first:this.startFn(),firstDone:!1})),(e=>{let n;if(!e.firstDone){do{if(n=this.nextFn(e.first),!n.done)return n}while(!n.done);e.firstDone=!0}do{if(n=t.next(),!n.done)return n}while(!n.done);return f}))}join(e=","){const t=this.iterator();let n,r="",i=!1;do{n=t.next(),n.done||(i&&(r+=e),r+="string"==typeof(s=n.value)?s:void 0===s?"undefined":"function"==typeof s.toString?s.toString():Object.prototype.toString.call(s)),i=!0}while(!n.done);var s;return r}indexOf(e,t=0){const n=this.iterator();let r=0,i=n.next();for(;!i.done;){if(r>=t&&i.value===e)return r;i=n.next(),r++}return-1}every(e){const t=this.iterator();let n=t.next();for(;!n.done;){if(!e(n.value))return!1;n=t.next()}return!0}some(e){const t=this.iterator();let n=t.next();for(;!n.done;){if(e(n.value))return!0;n=t.next()}return!1}forEach(e){const t=this.iterator();let n=0,r=t.next();for(;!r.done;)e(r.value,n),r=t.next(),n++}map(e){return new u(this.startFn,(t=>{const{done:n,value:r}=this.nextFn(t);return n?f:{done:!1,value:e(r)}}))}filter(e){return new u(this.startFn,(t=>{let n;do{if(n=this.nextFn(t),!n.done&&e(n.value))return n}while(!n.done);return f}))}nonNullable(){return this.filter((e=>null!=e))}reduce(e,t){const n=this.iterator();let r=t,i=n.next();for(;!i.done;)r=void 0===r?i.value:e(r,i.value),i=n.next();return r}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,n){const r=e.next();if(r.done)return n;const i=this.recursiveReduce(e,t,n);return void 0===i?r.value:t(i,r.value)}find(e){const t=this.iterator();let n=t.next();for(;!n.done;){if(e(n.value))return n.value;n=t.next()}}findIndex(e){const t=this.iterator();let n=0,r=t.next();for(;!r.done;){if(e(r.value))return n;r=t.next(),n++}return-1}includes(e){const t=this.iterator();let n=t.next();for(;!n.done;){if(n.value===e)return!0;n=t.next()}return!1}flatMap(e){return new u((()=>({this:this.startFn()})),(t=>{do{if(t.iterator){const e=t.iterator.next();if(!e.done)return e;t.iterator=void 0}const{done:n,value:r}=this.nextFn(t.this);if(!n){const n=e(r);if(!d(n))return{done:!1,value:n};t.iterator=n[Symbol.iterator]()}}while(t.iterator);return f}))}flat(e){if(void 0===e&&(e=1),e<=0)return this;const t=e>1?this.flat(e-1):this;return new u((()=>({this:t.startFn()})),(e=>{do{if(e.iterator){const t=e.iterator.next();if(!t.done)return t;e.iterator=void 0}const{done:n,value:r}=t.nextFn(e.this);if(!n){if(!d(r))return{done:!1,value:r};e.iterator=r[Symbol.iterator]()}}while(e.iterator);return f}))}head(){const e=this.iterator().next();if(!e.done)return e.value}tail(e=1){return new u((()=>{const t=this.startFn();for(let n=0;n<e;n++)if(this.nextFn(t).done)return t;return t}),this.nextFn)}limit(e){return new u((()=>({size:0,state:this.startFn()})),(t=>(t.size++,t.size>e?f:this.nextFn(t.state))))}distinct(e){const t=new Set;return this.filter((n=>{const r=e?e(n):n;return!t.has(r)&&(t.add(r),!0)}))}exclude(e,t){const n=new Set;for(const r of e){const e=t?t(r):r;n.add(e)}return this.filter((e=>{const r=t?t(e):e;return!n.has(r)}))}}function d(e){return!!e&&"function"==typeof e[Symbol.iterator]}const h=new u((()=>{}),(()=>f)),f=Object.freeze({done:!0,value:void 0});function p(...e){if(1===e.length){const t=e[0];if(t instanceof u)return t;if(d(t))return new u((()=>t[Symbol.iterator]()),(e=>e.next()));if("number"==typeof t.length)return new u((()=>({index:0})),(e=>e.index<t.length?{done:!1,value:t[e.index++]}:f))}return e.length>1?new u((()=>({collIndex:0,arrIndex:0})),(t=>{do{if(t.iterator){const e=t.iterator.next();if(!e.done)return e;t.iterator=void 0}if(t.array){if(t.arrIndex<t.array.length)return{done:!1,value:t.array[t.arrIndex++]};t.array=void 0,t.arrIndex=0}if(t.collIndex<e.length){const n=e[t.collIndex++];d(n)?t.iterator=n[Symbol.iterator]():n&&"number"==typeof n.length&&(t.array=n)}}while(t.iterator||t.array||t.collIndex<e.length);return f})):h}class m extends u{constructor(e,t,n){super((()=>({iterators:(null==n?void 0:n.includeRoot)?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1})),(e=>{for(e.pruned&&(e.iterators.pop(),e.pruned=!1);e.iterators.length>0;){const n=e.iterators[e.iterators.length-1].next();if(!n.done)return e.iterators.push(t(n.value)[Symbol.iterator]()),n;e.iterators.pop()}return f}))}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var g,y;function A(e){return new m(e,(e=>o(e)?e.content:[]),{includeRoot:!0})}function T(e){return{start:{character:e.startColumn-1,line:e.startLine-1},end:{character:e.endColumn,line:e.endLine-1}}}function v(e){if(!e)return;const{offset:t,end:n,range:r}=e;return{range:r,offset:t,end:n,length:n-t}}!function(e){e.sum=function(e){return e.reduce(((e,t)=>e+t),0)},e.product=function(e){return e.reduce(((e,t)=>e*t),0)},e.min=function(e){return e.reduce(((e,t)=>Math.min(e,t)))},e.max=function(e){return e.reduce(((e,t)=>Math.max(e,t)))}}(g||(g={})),function(e){e[e.Before=0]="Before",e[e.After=1]="After",e[e.OverlapFront=2]="OverlapFront",e[e.OverlapBack=3]="OverlapBack",e[e.Inside=4]="Inside"}(y||(y={}));const R=/^[\w\p{L}]$/u;function E(e,t){return c(e)&&t.includes(e.tokenType.name)}class k extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}}function x(e){throw new Error("Error! The input value was not handled.")}const I="AbstractRule",S="AbstractType",N="Condition",C="ValueLiteral",$="AbstractElement",w="BooleanLiteral",L="Conjunction",O="Disjunction",b="InferredType";function _(e){return ve.isInstance(e,b)}const P="Interface";function M(e){return ve.isInstance(e,P)}const D="Negation",U="ParameterReference",F="ParserRule";function G(e){return ve.isInstance(e,F)}const K="ReturnType",B="SimpleType",j="TerminalRule";function V(e){return ve.isInstance(e,j)}const H="Type";function W(e){return ve.isInstance(e,H)}const z="Action";function Y(e){return ve.isInstance(e,z)}const X="Alternatives";function q(e){return ve.isInstance(e,X)}const Q="Assignment";function J(e){return ve.isInstance(e,Q)}const Z="CharacterRange",ee="CrossReference";function te(e){return ve.isInstance(e,ee)}const ne="EndOfFile",re="Group";function ie(e){return ve.isInstance(e,re)}const se="Keyword";function ae(e){return ve.isInstance(e,se)}const oe="NegatedToken",ce="RegexToken",le="RuleCall";function ue(e){return ve.isInstance(e,le)}const de="TerminalAlternatives",he="TerminalGroup",fe="TerminalRuleCall";function pe(e){return ve.isInstance(e,fe)}const me="UnorderedGroup";function ge(e){return ve.isInstance(e,me)}const ye="UntilToken",Ae="Wildcard";class Te extends a{getAllTypes(){return["AbstractElement","AbstractRule","AbstractType","Action","Alternatives","ArrayLiteral","ArrayType","Assignment","BooleanLiteral","CharacterRange","Condition","Conjunction","CrossReference","Disjunction","EndOfFile","Grammar","GrammarImport","Group","InferredType","Interface","Keyword","NamedArgument","NegatedToken","Negation","NumberLiteral","Parameter","ParameterReference","ParserRule","ReferenceType","RegexToken","ReturnType","RuleCall","SimpleType","StringLiteral","TerminalAlternatives","TerminalGroup","TerminalRule","TerminalRuleCall","Type","TypeAttribute","TypeDefinition","UnionType","UnorderedGroup","UntilToken","ValueLiteral","Wildcard"]}computeIsSubtype(e,t){switch(e){case z:case X:case Q:case Z:case ee:case ne:case re:case se:case oe:case ce:case le:case de:case he:case fe:case me:case ye:case Ae:return this.isSubtype($,t);case"ArrayLiteral":case"NumberLiteral":case"StringLiteral":return this.isSubtype(C,t);case"ArrayType":case"ReferenceType":case B:case"UnionType":return this.isSubtype("TypeDefinition",t);case w:return this.isSubtype(N,t)||this.isSubtype(C,t);case L:case O:case D:case U:return this.isSubtype(N,t);case b:case P:case H:return this.isSubtype(S,t);case F:return this.isSubtype(I,t)||this.isSubtype(S,t);case j:return this.isSubtype(I,t);default:return!1}}getReferenceType(e){const t=`${e.container.$type}:${e.property}`;switch(t){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return S;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return I;case"Grammar:usedGrammars":return"Grammar";case"NamedArgument:parameter":case"ParameterReference:parameter":return"Parameter";case"TerminalRuleCall:rule":return j;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"AbstractElement":return{name:"AbstractElement",properties:[{name:"cardinality"},{name:"lookahead"}]};case"ArrayLiteral":return{name:"ArrayLiteral",properties:[{name:"elements",defaultValue:[]}]};case"ArrayType":return{name:"ArrayType",properties:[{name:"elementType"}]};case"BooleanLiteral":return{name:"BooleanLiteral",properties:[{name:"true",defaultValue:!1}]};case"Conjunction":return{name:"Conjunction",properties:[{name:"left"},{name:"right"}]};case"Disjunction":return{name:"Disjunction",properties:[{name:"left"},{name:"right"}]};case"Grammar":return{name:"Grammar",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"GrammarImport":return{name:"GrammarImport",properties:[{name:"path"}]};case"InferredType":return{name:"InferredType",properties:[{name:"name"}]};case"Interface":return{name:"Interface",properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case"NamedArgument":return{name:"NamedArgument",properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case"Negation":return{name:"Negation",properties:[{name:"value"}]};case"NumberLiteral":return{name:"NumberLiteral",properties:[{name:"value"}]};case"Parameter":return{name:"Parameter",properties:[{name:"name"}]};case"ParameterReference":return{name:"ParameterReference",properties:[{name:"parameter"}]};case"ParserRule":return{name:"ParserRule",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"ReferenceType":return{name:"ReferenceType",properties:[{name:"referenceType"}]};case"ReturnType":return{name:"ReturnType",properties:[{name:"name"}]};case"SimpleType":return{name:"SimpleType",properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case"StringLiteral":return{name:"StringLiteral",properties:[{name:"value"}]};case"TerminalRule":return{name:"TerminalRule",properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case"Type":return{name:"Type",properties:[{name:"name"},{name:"type"}]};case"TypeAttribute":return{name:"TypeAttribute",properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case"UnionType":return{name:"UnionType",properties:[{name:"types",defaultValue:[]}]};case"Action":return{name:"Action",properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case"Alternatives":return{name:"Alternatives",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"Assignment":return{name:"Assignment",properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case"CharacterRange":return{name:"CharacterRange",properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case"CrossReference":return{name:"CrossReference",properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case"EndOfFile":return{name:"EndOfFile",properties:[{name:"cardinality"},{name:"lookahead"}]};case"Group":return{name:"Group",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case"Keyword":return{name:"Keyword",properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case"NegatedToken":return{name:"NegatedToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case"RegexToken":return{name:"RegexToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case"RuleCall":return{name:"RuleCall",properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case"TerminalAlternatives":return{name:"TerminalAlternatives",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"TerminalGroup":return{name:"TerminalGroup",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"TerminalRuleCall":return{name:"TerminalRuleCall",properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case"UnorderedGroup":return{name:"UnorderedGroup",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"UntilToken":return{name:"UntilToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case"Wildcard":return{name:"Wildcard",properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const ve=new Te;function Re(e,t){let n=e;for(;n;){if(t(n))return n;n=n.$container}}function Ee(e){const t=function(e){for(;e.$container;)e=e.$container;return e}(e),n=t.$document;if(!n)throw new Error("AST node has no document.");return n}function ke(e,t){if(!e)throw new Error("Node must be an AstNode.");const n=null==t?void 0:t.range;return new u((()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0})),(t=>{for(;t.keyIndex<t.keys.length;){const i=t.keys[t.keyIndex];if(!i.startsWith("$")){const s=e[i];if(r(s)){if(t.keyIndex++,Se(s,n))return{done:!1,value:s}}else if(Array.isArray(s)){for(;t.arrayIndex<s.length;){const e=s[t.arrayIndex++];if(r(e)&&Se(e,n))return{done:!1,value:e}}t.arrayIndex=0}}t.keyIndex++}return f}))}function xe(e,t){if(!e)throw new Error("Root node must be an AstNode.");return new m(e,(e=>ke(e,t)))}function Ie(e,t){if(!e)throw new Error("Root node must be an AstNode.");return(null==t?void 0:t.range)&&!Se(e,t.range)?new m(e,(()=>[])):new m(e,(e=>ke(e,t)),{includeRoot:!0})}function Se(e,t){var n;if(!t)return!0;const r=null===(n=e.$cstNode)||void 0===n?void 0:n.range;return!!r&&function(e,t){const n=function(e,t){if(e.end.line<t.start.line||e.end.line===t.start.line&&e.end.character<e.start.character)return y.Before;if(e.start.line>t.end.line||e.start.line===t.end.line&&e.start.character>t.end.character)return y.After;const n=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,r=e.end.line<t.end.line||e.end.line===t.end.line&&e.end.character<=t.end.character;return n&&r?y.Inside:n?y.OverlapBack:y.OverlapFront}(e,t);return n>y.After}(r,t)}function Ne(e){return new u((()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0})),(t=>{for(;t.keyIndex<t.keys.length;){const n=t.keys[t.keyIndex];if(!n.startsWith("$")){const r=e[n];if(i(r))return t.keyIndex++,{done:!1,value:{reference:r,container:e,property:n}};if(Array.isArray(r)){for(;t.arrayIndex<r.length;){const s=t.arrayIndex++,a=r[s];if(i(a))return{done:!1,value:{reference:a,container:e,property:n,index:s}}}t.arrayIndex=0}}t.keyIndex++}return f}))}function Ce(e){return Array.isArray(e)?[...e.map(Ce)]:e}function $e(e){return e.charCodeAt(0)}function we(e,t){Array.isArray(e)?e.forEach((function(e){t.push(e)})):t.push(e)}function Le(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t],e[t]=!0}function Oe(e){if(void 0===e)throw Error("Internal Error - Should never get here!");return!0}function be(){throw Error("Internal Error - Should never get here!")}function _e(e){return"Character"===e.type}const Pe=[];for(let e=$e("0");e<=$e("9");e++)Pe.push(e);const Me=[$e("_")].concat(Pe);for(let e=$e("a");e<=$e("z");e++)Me.push(e);for(let e=$e("A");e<=$e("Z");e++)Me.push(e);const De=[$e(" "),$e("\f"),$e("\n"),$e("\r"),$e("\t"),$e("\v"),$e("\t"),$e(" "),$e(" "),$e(" "),$e(" "),$e(" "),$e(" "),$e(" "),$e(" "),$e(" "),$e(" "),$e(" "),$e(" "),$e(" "),$e("\u2028"),$e("\u2029"),$e(" "),$e(" "),$e(" "),$e("\ufeff")],Ue=/[0-9a-fA-F]/,Fe=/[0-9]/,Ge=/[1-9]/;class Ke{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 t=this.disjunction();this.consumeChar("/");const n={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":Le(n,"global");break;case"i":Le(n,"ignoreCase");break;case"m":Le(n,"multiLine");break;case"u":Le(n,"unicode");break;case"y":Le(n,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:t,loc:this.loc(0)}}disjunction(){const e=[],t=this.idx;for(e.push(this.alternative());"|"===this.peekChar();)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){const e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}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"(":let t;switch(this.consumeChar("?"),this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead"}Oe(t);const n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}return be()}quantifier(e=!1){let t;const n=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":const n=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:n,atMost:n};break;case",":let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;Oe(t)}if(!0!==e||void 0!==t)return Oe(t)?("?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(n),t):void 0}atom(){let e;const t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group()}return void 0===e&&this.isPatternCharacter()&&(e=this.patternCharacter()),Oe(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):be()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[$e("\n"),$e("\r"),$e("\u2028"),$e("\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,t=!1;switch(this.popChar()){case"d":e=Pe;break;case"D":e=Pe,t=!0;break;case"s":e=De;break;case"S":e=De,t=!0;break;case"w":e=Me;break;case"W":e=Me,t=!0}return Oe(e)?{type:"Set",value:e,complement:t}:be()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=$e("\f");break;case"n":e=$e("\n");break;case"r":e=$e("\r");break;case"t":e=$e("\t");break;case"v":e=$e("\v")}return Oe(e)?{type:"Character",value:e}:be()}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:$e("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:$e(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:$e(this.popChar())}}}characterClass(){const e=[];let t=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),t=!0);this.isClassAtom();){const t=this.classAtom();if(t.type,_e(t)&&this.isRangeDash()){this.consumeChar("-");const n=this.classAtom();if(n.type,_e(n)){if(n.value<t.value)throw Error("Range out of order in character class");e.push({from:t.value,to:n.value})}else we(t.value,e),e.push($e("-")),we(n.value,e)}else we(t.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case"\n":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:$e("\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;this.consumeChar("("),"?"===this.peekChar(0)?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;const t=this.disjunction();this.consumeChar(")");const n={type:"Group",capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(!1===Ge.test(e))throw Error("Expecting a positive integer");for(;Fe.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===Fe.test(e))throw Error("Expecting an integer");for(;Fe.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case"\n":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:$e(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 Fe.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case"\n":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 void 0!==this.quantifier(!0)}catch(e){return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let n=0;n<e;n++){const e=this.popChar();if(!1===Ue.test(e))throw Error("Expecting a HexDecimal digits");t+=e}return{type:"Character",value:parseInt(t,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(void 0!==e&&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 Be{visitChildren(e){for(const t in e){const n=e[t];e.hasOwnProperty(t)&&(void 0!==n.type?this.visit(n):Array.isArray(n)&&n.forEach((e=>{this.visit(e)}),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)}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 je=/\r?\n/gm,Ve=new Ke,He=new class extends Be{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 t=String.fromCharCode(e.value);if(this.multiline||"\n"!==t||(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const e=Ye(t);this.endRegexpStack.push(e),this.isStarting&&(this.startRegexp+=e)}}visitSet(e){if(!this.multiline){const t=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(t);this.multiline=Boolean("\n".match(n))}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(t),this.isStarting&&(this.startRegexp+=t)}}visitChildren(e){"Group"===e.type&&e.quantifier||super.visitChildren(e)}};function We(e){try{return"string"==typeof e&&(e=new RegExp(e)),e=e.toString(),He.reset(e),He.visit(Ve.pattern(e)),He.multiline}catch(e){return!1}}function ze(e){return("string"==typeof e?new RegExp(e):e).test(" ")}function Ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xe(e,t){const n=new Set,r=function(e){return e.rules.find((e=>G(e)&&e.entry))}(e);if(!r)return new Set(e.rules);const i=[r].concat(function(e){return e.rules.filter((e=>V(e)&&e.hidden))}(e));for(const e of i)qe(e,n,t);const s=new Set;for(const t of e.rules)(n.has(t.name)||V(t)&&t.hidden)&&s.add(t);return s}function qe(e,t,n){t.add(e.name),xe(e).forEach((e=>{if(ue(e)||n&&pe(e)){const r=e.rule.ref;r&&!t.has(r.name)&&qe(r,t,n)}}))}function Qe(e,t,n){if(!e||!t)return;const r=Je(e,t,e.astNode,!0);return 0!==r.length?r[n=void 0!==n?Math.max(0,Math.min(n,r.length-1)):0]:void 0}function Je(e,t,n,r){if(!r){const n=Re(e.grammarSource,J);if(n&&n.feature===t)return[e]}return o(e)&&e.astNode===n?e.content.flatMap((e=>Je(e,t,n,!1))):[]}function Ze(e){let t=e;return _(t)&&(Y(t.$container)?t=t.$container.$container:G(t.$container)?t=t.$container:x(t.$container)),et(e,t,new Map)}function et(e,t,n){var r,i;function s(t,r){let i;return Re(t,J)||(i=et(r,r,n)),n.set(e,i),i}if(n.has(e))return n.get(e);n.set(e,void 0);for(const a of xe(t)){if(J(a)&&"name"===a.feature.toLowerCase())return n.set(e,a),a;if(ue(a)&&G(a.rule.ref))return s(a,a.rule.ref);if(i=a,ve.isInstance(i,B)&&(null===(r=a.typeRef)||void 0===r?void 0:r.ref))return s(a,a.typeRef.ref)}}function tt(e){return nt(e,new Set)}function nt(e,t){if(t.has(e))return!0;t.add(e);for(const n of xe(e))if(ue(n)){if(!n.rule.ref)return!1;if(G(n.rule.ref)&&!nt(n.rule.ref,t))return!1}else{if(J(n))return!1;if(Y(n))return!1}return Boolean(e.definition)}function rt(e){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){const t=e.returnType.ref;if(t){if(G(t))return t.name;if(M(t)||W(t))return t.name}}}function it(e){var t,n;if(G(e))return tt(e)?e.name:null!==(t=rt(e))&&void 0!==t?t:e.name;if(M(e)||W(e)||(n=e,ve.isInstance(n,K)))return e.name;if(Y(e)){const t=function(e){var t;return e.inferredType?e.inferredType.name:(null===(t=e.type)||void 0===t?void 0:t.ref)?it(e.type.ref):void 0}(e);if(t)return t}else if(_(e))return e.name;throw new Error("Cannot get name of Unknown Type")}function st(e){const t={s:!1,i:!1,u:!1},n=ot(e.definition,t),r=Object.entries(t).filter((([,e])=>e)).map((([e])=>e)).join("");return new RegExp(n,r)}const at=/[\s\S]/.source;function ot(e,t){if(o=e,ve.isInstance(o,de))return lt((a=e).elements.map((e=>ot(e))).join("|"),{cardinality:a.cardinality,lookahead:a.lookahead});if(function(e){return ve.isInstance(e,he)}(e))return lt((s=e).elements.map((e=>ot(e))).join(""),{cardinality:s.cardinality,lookahead:s.lookahead});if(function(e){return ve.isInstance(e,Z)}(e))return(n=e).right?lt(`[${ct(n.left)}-${ct(n.right)}]`,{cardinality:n.cardinality,lookahead:n.lookahead,wrap:!1}):lt(ct(n.left),{cardinality:n.cardinality,lookahead:n.lookahead,wrap:!1});var n,r,i,s,a,o;if(pe(e)){const t=e.rule.ref;if(!t)throw new Error("Missing rule reference.");return lt(ot(t.definition),{cardinality:e.cardinality,lookahead:e.lookahead})}if(function(e){return ve.isInstance(e,oe)}(e))return lt(`(?!${ot((r=e).terminal)})${at}*?`,{cardinality:r.cardinality,lookahead:r.lookahead});if(function(e){return ve.isInstance(e,ye)}(e))return lt(`${at}*?${ot((i=e).terminal)}`,{cardinality:i.cardinality,lookahead:i.lookahead});if(function(e){return ve.isInstance(e,ce)}(e)){const n=e.regex.lastIndexOf("/"),r=e.regex.substring(1,n),i=e.regex.substring(n+1);return t&&(t.i=i.includes("i"),t.s=i.includes("s"),t.u=i.includes("u")),lt(r,{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1})}if(function(e){return ve.isInstance(e,Ae)}(e))return lt(at,{cardinality:e.cardinality,lookahead:e.lookahead});throw new Error(`Invalid terminal element: ${null==e?void 0:e.$type}`)}function ct(e){return Ye(e.value)}function lt(e,t){var n;return(!1!==t.wrap||t.lookahead)&&(e=`(${null!==(n=t.lookahead)&&void 0!==n?n:""}${e})`),t.cardinality?`${e}${t.cardinality}`:e}var ut=n(8058),dt=n(2866),ht=n(6401),ft=n(4722),pt=n(9622),mt=n(53);function gt(e){function t(){}t.prototype=e;const n=new t;function r(){return typeof n.bar}return r(),r(),e}const yt=function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s};var At=n(8593);const Tt=function(e,t,n){var r=null==e?0:e.length;return r?(t=n||void 0===t?1:(0,At.A)(t),yt(e,t<0?0:t,r)):[]};var vt=n(9703),Rt=n(2851),Et=n(2031),kt=n(3767),xt=n(8446),It=n(7271),St=n(5041),Nt=Object.prototype.hasOwnProperty;const Ct=(0,kt.A)((function(e,t){if((0,It.A)(t)||(0,xt.A)(t))(0,Et.A)(t,(0,St.A)(t),e);else for(var n in t)Nt.call(t,n)&&(0,Rt.A)(e,n,t[n])}));var $t=n(5572),wt=n(6307),Lt=n(5507),Ot=n(3973);const bt=function(e,t){if(null==e)return{};var n=(0,$t.A)((0,Ot.A)(e),(function(e){return[e]}));return t=(0,wt.A)(t),(0,Lt.A)(e,n,(function(e,n){return t(e,n[0])}))};var _t=n(2383),Pt=n(3098);var Mt=n(2789),Dt=n(4841),Ut=Dt.A&&Dt.A.isRegExp;const Ft=Ut?(0,Mt.A)(Ut):function(e){return(0,Pt.A)(e)&&"[object RegExp]"==(0,_t.A)(e)};class Gt{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),(0,ut.A)(this.definition,(t=>{t.accept(e)}))}}class Kt extends Gt{constructor(e){super([]),this.idx=1,Ct(this,bt(e,(e=>void 0!==e)))}set definition(e){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Bt extends Gt{constructor(e){super(e.definition),this.orgText="",Ct(this,bt(e,(e=>void 0!==e)))}}class jt extends Gt{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Ct(this,bt(e,(e=>void 0!==e)))}}class Vt extends Gt{constructor(e){super(e.definition),this.idx=1,Ct(this,bt(e,(e=>void 0!==e)))}}class Ht extends Gt{constructor(e){super(e.definition),this.idx=1,Ct(this,bt(e,(e=>void 0!==e)))}}class Wt extends Gt{constructor(e){super(e.definition),this.idx=1,Ct(this,bt(e,(e=>void 0!==e)))}}class zt extends Gt{constructor(e){super(e.definition),this.idx=1,Ct(this,bt(e,(e=>void 0!==e)))}}class Yt extends Gt{constructor(e){super(e.definition),this.idx=1,Ct(this,bt(e,(e=>void 0!==e)))}}class Xt extends Gt{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,Ct(this,bt(e,(e=>void 0!==e)))}}class qt{constructor(e){this.idx=1,Ct(this,bt(e,(e=>void 0!==e)))}accept(e){e.visit(this)}}function Qt(e){function t(e){return(0,ft.A)(e,Qt)}if(e instanceof Kt){const t={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};return(0,vt.A)(e.label)&&(t.label=e.label),t}if(e instanceof jt)return{type:"Alternative",definition:t(e.definition)};if(e instanceof Vt)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof Ht)return{type:"RepetitionMandatory",idx:e.idx,definition:t(e.definition)};if(e instanceof Wt)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:Qt(new qt({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof Yt)return{type:"RepetitionWithSeparator",idx:e.idx,separator:Qt(new qt({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof zt)return{type:"Repetition",idx:e.idx,definition:t(e.definition)};if(e instanceof Xt)return{type:"Alternation",idx:e.idx,definition:t(e.definition)};if(e instanceof qt){const t={type:"Terminal",name:e.terminalType.name,label:(n=e.terminalType,r=n,(0,vt.A)(r.LABEL)&&""!==r.LABEL?n.LABEL:n.name),idx:e.idx};(0,vt.A)(e.label)&&(t.terminalLabel=e.label);const i=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=Ft(i)?i.source:i),t}var n,r;if(e instanceof Bt)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error("non exhaustive match")}class Jt{visit(e){const t=e;switch(t.constructor){case Kt:return this.visitNonTerminal(t);case jt:return this.visitAlternative(t);case Vt:return this.visitOption(t);case Ht:return this.visitRepetitionMandatory(t);case Wt:return this.visitRepetitionMandatoryWithSeparator(t);case Yt:return this.visitRepetitionWithSeparator(t);case zt:return this.visitRepetition(t);case Xt:return this.visitAlternation(t);case qt:return this.visitTerminal(t);case Bt:return this.visitRule(t);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){}}var Zt=n(3736),en=n(4288);const tn=function(e,t){var n;return(0,en.A)(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n};var nn=n(2049),rn=n(6832);const sn=function(e,t,n){var r=(0,nn.A)(e)?Zt.A:tn;return n&&(0,rn.A)(e,t,n)&&(t=void 0),r(e,(0,wt.A)(t,3))};var an=n(5205),on=Math.max;const cn=function(e,t,n,r){e=(0,xt.A)(e)?e:(0,dt.A)(e),n=n&&!r?(0,At.A)(n):0;var i=e.length;return n<0&&(n=on(i+n,0)),(0,vt.A)(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&(0,an.A)(e,t,n)>-1},ln=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0},un=function(e,t){var n=!0;return(0,en.A)(e,(function(e,r,i){return n=!!t(e,r,i)})),n},dn=function(e,t,n){var r=(0,nn.A)(e)?ln:un;return n&&(0,rn.A)(e,t,n)&&(t=void 0),r(e,(0,wt.A)(t,3))};function hn(e,t=[]){return!!(e instanceof Vt||e instanceof zt||e instanceof Yt)||(e instanceof Xt?sn(e.definition,(e=>hn(e,t))):!(e instanceof Kt&&cn(t,e))&&e instanceof Gt&&(e instanceof Kt&&t.push(e),dn(e.definition,(e=>hn(e,t)))))}function fn(e){if(e instanceof Kt)return"SUBRULE";if(e instanceof Vt)return"OPTION";if(e instanceof Xt)return"OR";if(e instanceof Ht)return"AT_LEAST_ONE";if(e instanceof Wt)return"AT_LEAST_ONE_SEP";if(e instanceof Yt)return"MANY_SEP";if(e instanceof zt)return"MANY";if(e instanceof qt)return"CONSUME";throw Error("non exhaustive match")}class pn{walk(e,t=[]){(0,ut.A)(e.definition,((n,r)=>{const i=Tt(e.definition,r+1);if(n instanceof Kt)this.walkProdRef(n,i,t);else if(n instanceof qt)this.walkTerminal(n,i,t);else if(n instanceof jt)this.walkFlat(n,i,t);else if(n instanceof Vt)this.walkOption(n,i,t);else if(n instanceof Ht)this.walkAtLeastOne(n,i,t);else if(n instanceof Wt)this.walkAtLeastOneSep(n,i,t);else if(n instanceof Yt)this.walkManySep(n,i,t);else if(n instanceof zt)this.walkMany(n,i,t);else{if(!(n instanceof Xt))throw Error("non exhaustive match");this.walkOr(n,i,t)}}))}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){const r=t.concat(n);this.walk(e,r)}walkOption(e,t,n){const r=t.concat(n);this.walk(e,r)}walkAtLeastOne(e,t,n){const r=[new Vt({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){const r=mn(e,t,n);this.walk(e,r)}walkMany(e,t,n){const r=[new Vt({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){const r=mn(e,t,n);this.walk(e,r)}walkOr(e,t,n){const r=t.concat(n);(0,ut.A)(e.definition,(e=>{const t=new jt({definition:[e]});this.walk(t,r)}))}}function mn(e,t,n){return[new Vt({definition:[new qt({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}var gn=n(7371);const yn=function(e){return e&&e.length?(0,gn.A)(e):[]};var An=n(4098);function Tn(e){if(e instanceof Kt)return Tn(e.referencedRule);if(e instanceof qt)return[e.terminalType];if(function(e){return e instanceof jt||e instanceof Vt||e instanceof zt||e instanceof Ht||e instanceof Wt||e instanceof Yt||e instanceof qt||e instanceof Bt}(e))return function(e){let t=[];const n=e.definition;let r,i=0,s=n.length>i,a=!0;for(;s&&a;)r=n[i],a=hn(r),t=t.concat(Tn(r)),i+=1,s=n.length>i;return yn(t)}(e);if(function(e){return e instanceof Xt}(e))return function(e){const t=(0,ft.A)(e.definition,(e=>Tn(e)));return yn((0,An.A)(t))}(e);throw Error("non exhaustive match")}const vn="_~IN~_";class Rn extends pn{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){const r=(i=e.referencedRule,s=e.idx,i.name+s+vn+this.topProd.name);var i,s;const a=t.concat(n),o=Tn(new jt({definition:a}));this.follows[r]=o}}var En=n(9592),kn=n(3068),xn=n(2634),In=n(1790);const Sn=function(e,t){return((0,nn.A)(e)?xn.A:In.A)(e,function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}((0,wt.A)(t,3)))};var Nn=n(9610),Cn=Math.max;const $n=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:(0,At.A)(n);return i<0&&(i=Cn(r+i,0)),(0,an.A)(e,t,i)};var wn=n(3130),Ln=n(4092),On=n(8300),bn=n(5530),_n=n(7809),Pn=n(4099);var Mn=n(7671),Dn=n(4326),Un=n(3533);const Fn=(0,Dn.A)((function(e,t){return(0,Un.A)(e)?function(e,t,n,r){var i=-1,s=bn.A,a=!0,o=e.length,c=[],l=t.length;if(!o)return c;n&&(t=(0,$t.A)(t,(0,Mt.A)(n))),r?(s=_n.A,a=!1):t.length>=200&&(s=Pn.A,a=!1,t=new On.A(t));e:for(;++i<o;){var u=e[i],d=null==n?u:n(u);if(u=r||0!==u?u:0,a&&d==d){for(var h=l;h--;)if(t[h]===d)continue e;c.push(u)}else s(t,d,r)||c.push(u)}return c}(e,(0,Mn.A)(t,1,Un.A,!0)):[]})),Gn=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var s=e[t];s&&(i[r++]=s)}return i},Kn=function(e){return e&&e.length?e[0]:void 0};var Bn=n(473);function jn(e){console&&console.error&&console.error(`Error: ${e}`)}function Vn(e){console&&console.warn&&console.warn(`Warning: ${e}`)}let Hn={};const Wn=new Ke;function zn(e){const t=e.toString();if(Hn.hasOwnProperty(t))return Hn[t];{const e=Wn.pattern(t);return Hn[t]=e,e}}const Yn="Complement Sets are not supported for first char optimization",Xn='Unable to use "first char" lexer optimizations:\n';function qn(e,t=!1){try{const t=zn(e);return Qn(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===Yn)t&&Vn(`${Xn}\tUnable to optimize: < ${e.toString()} >\n\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";t&&(n="\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),jn(`${Xn}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Qn(e,t,n){switch(e.type){case"Disjunction":for(let r=0;r<e.value.length;r++)Qn(e.value[r],t,n);break;case"Alternative":const r=e.value;for(let e=0;e<r.length;e++){const i=r[e];switch(i.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const s=i;switch(s.type){case"Character":Jn(s.value,t,n);break;case"Set":if(!0===s.complement)throw Error(Yn);(0,ut.A)(s.value,(e=>{if("number"==typeof e)Jn(e,t,n);else{const r=e;if(!0===n)for(let e=r.from;e<=r.to;e++)Jn(e,t,n);else{for(let e=r.from;e<=r.to&&e<yr;e++)Jn(e,t,n);if(r.to>=yr){const e=r.from>=yr?r.from:yr,n=r.to,i=Tr(e),s=Tr(n);for(let e=i;e<=s;e++)t[e]=e}}}}));break;case"Group":Qn(s.value,t,n);break;default:throw Error("Non Exhaustive Match")}const a=void 0!==s.quantifier&&0===s.quantifier.atLeast;if("Group"===s.type&&!1===er(s)||"Group"!==s.type&&!1===a)break}break;default:throw Error("non exhaustive match!")}return(0,dt.A)(t)}function Jn(e,t,n){const r=Tr(e);t[r]=r,!0===n&&function(e,t){const n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){const e=Tr(r.charCodeAt(0));t[e]=e}else{const e=n.toLowerCase();if(e!==n){const n=Tr(e.charCodeAt(0));t[n]=n}}}(e,t)}function Zn(e,t){return(0,Bn.A)(e.value,(e=>{if("number"==typeof e)return cn(t,e);{const n=e;return void 0!==(0,Bn.A)(t,(e=>n.from<=e&&e<=n.to))}}))}function er(e){const t=e.quantifier;return!(!t||0!==t.atLeast)||!!e.value&&((0,nn.A)(e.value)?dn(e.value,er):er(e.value))}class tr extends Be{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){switch(e.type){case"Lookahead":return void this.visitLookahead(e);case"NegativeLookahead":return void this.visitNegativeLookahead(e)}super.visitChildren(e)}}visitCharacter(e){cn(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?void 0===Zn(e,this.targetCharCodes)&&(this.found=!0):void 0!==Zn(e,this.targetCharCodes)&&(this.found=!0)}}function nr(e,t){if(t instanceof RegExp){const n=zn(t),r=new tr(e);return r.visit(n),r.found}return void 0!==(0,Bn.A)(t,(t=>cn(e,t.charCodeAt(0))))}const rr="PATTERN",ir="defaultMode",sr="modes";let ar="boolean"==typeof new RegExp("(?:)").sticky;const or=/[^\\][$]/,cr=/[^\\[][\^]|^\^/;function lr(e){const t=e.ignoreCase?"i":"";return new RegExp(`^(?:${e.source})`,t)}function ur(e){const t=e.ignoreCase?"iy":"y";return new RegExp(`${e.source}`,t)}function dr(e){const t=e.PATTERN;if(Ft(t))return!1;if((0,Nn.A)(t))return!0;if((0,pt.A)(t,"exec"))return!0;if((0,vt.A)(t))return!1;throw Error("non exhaustive match")}function hr(e){return!(!(0,vt.A)(e)||1!==e.length)&&e.charCodeAt(0)}const fr={test:function(e){const t=e.length;for(let n=this.lastIndex;n<t;n++){const t=e.charCodeAt(n);if(10===t)return this.lastIndex=n+1,!0;if(13===t)return 10===e.charCodeAt(n+1)?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function pr(e,t){if((0,pt.A)(e,"LINE_BREAKS"))return!1;if(Ft(e.PATTERN)){try{nr(t,e.PATTERN)}catch(e){return{issue:br.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if((0,vt.A)(e.PATTERN))return!1;if(dr(e))return{issue:br.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function mr(e){return(0,ft.A)(e,(e=>(0,vt.A)(e)?e.charCodeAt(0):e))}function gr(e,t,n){void 0===e[t]?e[t]=[n]:e[t].push(n)}const yr=256;let Ar=[];function Tr(e){return e<yr?e:Ar[e]}var vr=n(9008),Rr=n(2302),Er=n(6666);function kr(e){const t=(new Date).getTime(),n=e();return{time:(new Date).getTime()-t,value:n}}function xr(e,t){const n=e.tokenTypeIdx;return n===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[n]}function Ir(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}let Sr=1;const Nr={};function Cr(e){const t=function(e){let t=(0,mt.A)(e),n=e,r=!0;for(;r;){n=Gn((0,An.A)((0,ft.A)(n,(e=>e.CATEGORIES))));const e=Fn(n,t);t=t.concat(e),(0,ht.A)(e)?r=!1:n=e}return t}(e);!function(e){(0,ut.A)(e,(e=>{var t;wr(e)||(Nr[Sr]=e,e.tokenTypeIdx=Sr++),Lr(e)&&!(0,nn.A)(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Lr(e)||(e.CATEGORIES=[]),t=e,(0,pt.A)(t,"categoryMatches")||(e.categoryMatches=[]),function(e){return(0,pt.A)(e,"categoryMatchesMap")}(e)||(e.categoryMatchesMap={})}))}(t),function(e){(0,ut.A)(e,(e=>{$r([],e)}))}(t),function(e){(0,ut.A)(e,(e=>{e.categoryMatches=[],(0,ut.A)(e.categoryMatchesMap,((t,n)=>{e.categoryMatches.push(Nr[n].tokenTypeIdx)}))}))}(t),(0,ut.A)(t,(e=>{e.isParent=e.categoryMatches.length>0}))}function $r(e,t){(0,ut.A)(e,(e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0})),(0,ut.A)(t.CATEGORIES,(n=>{const r=e.concat(t);cn(r,n)||$r(r,n)}))}function wr(e){return(0,pt.A)(e,"tokenTypeIdx")}function Lr(e){return(0,pt.A)(e,"CATEGORIES")}function Or(e){return(0,pt.A)(e,"tokenTypeIdx")}var br;!function(e){e[e.MISSING_PATTERN=0]="MISSING_PATTERN",e[e.INVALID_PATTERN=1]="INVALID_PATTERN",e[e.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",e[e.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",e[e.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",e[e.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",e[e.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",e[e.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",e[e.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",e[e.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",e[e.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",e[e.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",e[e.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"}(br||(br={}));const _r={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:{buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,n,r,i)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`},traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(_r);class Pr{constructor(e,t=_r){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=(e,t)=>{if(!0===this.traceInitPerf){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);const{time:r,value:i}=kr(t),s=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()},"boolean"==typeof t)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=Ct({},_r,t);const n=this.config.traceInitPerf;!0===n?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof n&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",(()=>{let n,r=!0;this.TRACE_INIT("Lexer Config handling",(()=>{if(this.config.lineTerminatorsPattern===_r.lineTerminatorsPattern)this.config.lineTerminatorsPattern=fr;else if(this.config.lineTerminatorCharacters===_r.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");if(t.safeMode&&t.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),(0,nn.A)(e)?n={modes:{defaultMode:(0,mt.A)(e)},defaultMode:ir}:(r=!1,n=(0,mt.A)(e))})),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",(()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e){const t=[];return(0,pt.A)(e,ir)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+ir+"> property in its definition\n",type:br.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),(0,pt.A)(e,sr)||t.push({message:"A MultiMode Lexer cannot be initialized without a <modes> property in its definition\n",type:br.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),(0,pt.A)(e,sr)&&(0,pt.A)(e,ir)&&!(0,pt.A)(e.modes,e.defaultMode)&&t.push({message:`A MultiMode Lexer cannot be initialized with a ${ir}: <${e.defaultMode}>which does not exist\n`,type:br.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),(0,pt.A)(e,sr)&&(0,ut.A)(e.modes,((e,n)=>{(0,ut.A)(e,((r,i)=>{if((0,En.A)(r))t.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${n}> at index: <${i}>\n`,type:br.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if((0,pt.A)(r,"LONGER_ALT")){const i=(0,nn.A)(r.LONGER_ALT)?r.LONGER_ALT:[r.LONGER_ALT];(0,ut.A)(i,(i=>{(0,En.A)(i)||cn(e,i)||t.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${r.name}> outside of mode <${n}>\n`,type:br.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})}))}}))})),t}(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),this.TRACE_INIT("performWarningRuntimeChecks",(()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(function(e,t,n){const r=[];let i=!1;const s=Gn((0,An.A)((0,dt.A)(e.modes))),a=Sn(s,(e=>e[rr]===Pr.NA)),o=mr(n);return t&&(0,ut.A)(a,(e=>{const t=pr(e,o);if(!1!==t){const n=function(e,t){if(t.issue===br.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${t.errMsg}.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===br.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <${e.name}> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}(e,t),i={message:n,type:t.issue,tokenType:e};r.push(i)}else(0,pt.A)(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(i=!0):nr(o,e.PATTERN)&&(i=!0)})),t&&!i&&r.push({message:"Warning: No LINE_BREAKS Found.\n\tThis Lexer has been defined to track line and column information,\n\tBut none of the Token Types can be identified as matching a line terminator.\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n\tfor details.",type:br.NO_LINE_BREAKS_FLAGS}),r}(n,this.trackStartLines,this.config.lineTerminatorCharacters))}))),n.modes=n.modes?n.modes:{},(0,ut.A)(n.modes,((e,t)=>{n.modes[t]=Sn(e,(e=>(0,En.A)(e)))}));const i=(0,St.A)(n.modes);if((0,ut.A)(n.modes,((e,n)=>{this.TRACE_INIT(`Mode: <${n}> processing`,(()=>{if(this.modes.push(n),!1===this.config.skipValidations&&this.TRACE_INIT("validatePatterns",(()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e,t){let n=[];const r=function(e){const t=(0,Ln.A)(e,(e=>!(0,pt.A)(e,rr)));return{errors:(0,ft.A)(t,(e=>({message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:br.MISSING_PATTERN,tokenTypes:[e]}))),valid:Fn(e,t)}}(e);n=n.concat(r.errors);const i=function(e){const t=(0,Ln.A)(e,(e=>{const t=e[rr];return!(Ft(t)||(0,Nn.A)(t)||(0,pt.A)(t,"exec")||(0,vt.A)(t))}));return{errors:(0,ft.A)(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:br.INVALID_PATTERN,tokenTypes:[e]}))),valid:Fn(e,t)}}(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(function(e){let t=[];const n=(0,Ln.A)(e,(e=>Ft(e[rr])));return t=t.concat(function(e){class t extends Be{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}const n=(0,Ln.A)(e,(e=>{const n=e.PATTERN;try{const e=zn(n),r=new t;return r.visit(e),r.found}catch(e){return or.test(n.source)}}));return(0,ft.A)(n,(e=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:br.EOI_ANCHOR_FOUND,tokenTypes:[e]})))}(n)),t=t.concat(function(e){class t extends Be{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}const n=(0,Ln.A)(e,(e=>{const n=e.PATTERN;try{const e=zn(n),r=new t;return r.visit(e),r.found}catch(e){return cr.test(n.source)}}));return(0,ft.A)(n,(e=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:br.SOI_ANCHOR_FOUND,tokenTypes:[e]})))}(n)),t=t.concat(function(e){const t=(0,Ln.A)(e,(e=>{const t=e[rr];return t instanceof RegExp&&(t.multiline||t.global)}));return(0,ft.A)(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:br.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]})))}(n)),t=t.concat(function(e){const t=[];let n=(0,ft.A)(e,(n=>(0,wn.A)(e,((e,r)=>(n.PATTERN.source!==r.PATTERN.source||cn(t,r)||r.PATTERN===Pr.NA||(t.push(r),e.push(r)),e)),[])));n=Gn(n);const r=(0,Ln.A)(n,(e=>e.length>1));return(0,ft.A)(r,(e=>{const t=(0,ft.A)(e,(e=>e.name));return{message:`The same RegExp pattern ->${Kn(e).PATTERN}<-has been used in all of the following Token Types: ${t.join(", ")} <-`,type:br.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}}))}(n)),t=t.concat(function(e){const t=(0,Ln.A)(e,(e=>e.PATTERN.test("")));return(0,ft.A)(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:br.EMPTY_MATCH_PATTERN,tokenTypes:[e]})))}(n)),t}(s)),n=n.concat(function(e){const t=(0,Ln.A)(e,(e=>{if(!(0,pt.A)(e,"GROUP"))return!1;const t=e.GROUP;return t!==Pr.SKIPPED&&t!==Pr.NA&&!(0,vt.A)(t)}));return(0,ft.A)(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:br.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]})))}(s)),n=n.concat(function(e,t){const n=(0,Ln.A)(e,(e=>void 0!==e.PUSH_MODE&&!cn(t,e.PUSH_MODE)));return(0,ft.A)(n,(e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:br.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]})))}(s,t)),n=n.concat(function(e){const t=[],n=(0,wn.A)(e,((e,t,n)=>{const r=t.PATTERN;return r===Pr.NA||((0,vt.A)(r)?e.push({str:r,idx:n,tokenType:t}):Ft(r)&&(i=r,void 0===(0,Bn.A)([".","\\","[","]","|","^","$","(",")","?","*","+","{"],(e=>-1!==i.source.indexOf(e))))&&e.push({str:r.source,idx:n,tokenType:t})),e;var i}),[]);return(0,ut.A)(e,((e,r)=>{(0,ut.A)(n,(({str:n,idx:i,tokenType:s})=>{if(r<i&&function(e,t){if(Ft(t)){const n=t.exec(e);return null!==n&&0===n.index}if((0,Nn.A)(t))return t(e,0,[],{});if((0,pt.A)(t,"exec"))return t.exec(e,0,[],{});if("string"==typeof t)return t===e;throw Error("non exhaustive match")}(n,e.PATTERN)){const n=`Token: ->${s.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:n,type:br.UNREACHABLE_PATTERN,tokenTypes:[e,s]})}}))})),t}(s)),n}(e,i))})),(0,ht.A)(this.lexerDefinitionErrors)){let r;Cr(e),this.TRACE_INIT("analyzeTokenTypes",(()=>{r=function(e,t){const n=(t=(0,kn.A)(t,{useSticky:ar,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:(e,t)=>t()})).tracer;let r;n("initCharCodeToOptimizedIndexMap",(()=>{!function(){if((0,ht.A)(Ar)){Ar=new Array(65536);for(let e=0;e<65536;e++)Ar[e]=e>255?255+~~(e/255):e}}()})),n("Reject Lexer.NA",(()=>{r=Sn(e,(e=>e[rr]===Pr.NA))}));let i,s,a,o,c,l,u,d,h,f,p,m=!1;n("Transform Patterns",(()=>{m=!1,i=(0,ft.A)(r,(e=>{const n=e[rr];if(Ft(n)){const e=n.source;return 1!==e.length||"^"===e||"$"===e||"."===e||n.ignoreCase?2!==e.length||"\\"!==e[0]||cn(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],e[1])?t.useSticky?ur(n):lr(n):e[1]:e}if((0,Nn.A)(n))return m=!0,{exec:n};if("object"==typeof n)return m=!0,n;if("string"==typeof n){if(1===n.length)return n;{const e=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),r=new RegExp(e);return t.useSticky?ur(r):lr(r)}}throw Error("non exhaustive match")}))})),n("misc mapping",(()=>{s=(0,ft.A)(r,(e=>e.tokenTypeIdx)),a=(0,ft.A)(r,(e=>{const t=e.GROUP;if(t!==Pr.SKIPPED){if((0,vt.A)(t))return t;if((0,En.A)(t))return!1;throw Error("non exhaustive match")}})),o=(0,ft.A)(r,(e=>{const t=e.LONGER_ALT;if(t)return(0,nn.A)(t)?(0,ft.A)(t,(e=>$n(r,e))):[$n(r,t)]})),c=(0,ft.A)(r,(e=>e.PUSH_MODE)),l=(0,ft.A)(r,(e=>(0,pt.A)(e,"POP_MODE")))})),n("Line Terminator Handling",(()=>{const e=mr(t.lineTerminatorCharacters);u=(0,ft.A)(r,(e=>!1)),"onlyOffset"!==t.positionTracking&&(u=(0,ft.A)(r,(t=>(0,pt.A)(t,"LINE_BREAKS")?!!t.LINE_BREAKS:!1===pr(t,e)&&nr(e,t.PATTERN))))})),n("Misc Mapping #2",(()=>{d=(0,ft.A)(r,dr),h=(0,ft.A)(i,hr),f=(0,wn.A)(r,((e,t)=>{const n=t.GROUP;return(0,vt.A)(n)&&n!==Pr.SKIPPED&&(e[n]=[]),e}),{}),p=(0,ft.A)(i,((e,t)=>({pattern:i[t],longerAlt:o[t],canLineTerminator:u[t],isCustom:d[t],short:h[t],group:a[t],push:c[t],pop:l[t],tokenTypeIdx:s[t],tokenType:r[t]})))}));let g=!0,y=[];return t.safeMode||n("First Char Optimization",(()=>{y=(0,wn.A)(r,((e,n,r)=>{if("string"==typeof n.PATTERN){const t=Tr(n.PATTERN.charCodeAt(0));gr(e,t,p[r])}else if((0,nn.A)(n.START_CHARS_HINT)){let t;(0,ut.A)(n.START_CHARS_HINT,(n=>{const i=Tr("string"==typeof n?n.charCodeAt(0):n);t!==i&&(t=i,gr(e,i,p[r]))}))}else if(Ft(n.PATTERN))if(n.PATTERN.unicode)g=!1,t.ensureOptimizations&&jn(`${Xn}\tUnable to analyze < ${n.PATTERN.toString()} > pattern.\n\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const i=qn(n.PATTERN,t.ensureOptimizations);(0,ht.A)(i)&&(g=!1),(0,ut.A)(i,(t=>{gr(e,t,p[r])}))}else t.ensureOptimizations&&jn(`${Xn}\tTokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),g=!1;return e}),[])})),{emptyGroups:f,patternIdxToConfig:p,charCodeToPatternIdxToConfig:y,hasCustom:m,canBeOptimized:g}}(e,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})})),this.patternIdxToConfig[n]=r.patternIdxToConfig,this.charCodeToPatternIdxToConfig[n]=r.charCodeToPatternIdxToConfig,this.emptyGroups=Ct({},this.emptyGroups,r.emptyGroups),this.hasCustom=r.hasCustom||this.hasCustom,this.canModeBeOptimized[n]=r.canBeOptimized}}))})),this.defaultMode=n.defaultMode,!(0,ht.A)(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const e=(0,ft.A)(this.lexerDefinitionErrors,(e=>e.message)).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+e)}(0,ut.A)(this.lexerDefinitionWarning,(e=>{Vn(e.message)})),this.TRACE_INIT("Choosing sub-methods implementations",(()=>{if(ar?(this.chopInput=vr.A,this.match=this.matchWithTest):(this.updateLastIndex=Rr.A,this.match=this.matchWithExec),r&&(this.handleModes=Rr.A),!1===this.trackStartLines&&(this.computeNewColumn=vr.A),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=Rr.A),/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))throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.createTokenInstance=this.createOffsetOnlyToken}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 e=(0,wn.A)(this.canModeBeOptimized,((e,t,n)=>(!1===t&&e.push(n),e)),[]);if(t.ensureOptimizations&&!(0,ht.A)(e))throw Error(`Lexer Modes: < ${e.join(", ")} > cannot be optimized.\n\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.`)})),this.TRACE_INIT("clearRegExpParserCache",(()=>{Hn={}})),this.TRACE_INIT("toFastProperties",(()=>{gt(this)}))}))}tokenize(e,t=this.defaultMode){if(!(0,ht.A)(this.lexerDefinitionErrors)){const e=(0,ft.A)(this.lexerDefinitionErrors,(e=>e.message)).join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,s,a,o,c,l,u,d,h,f,p,m,g;const y=e,A=y.length;let T=0,v=0;const R=this.hasCustom?0:Math.floor(e.length/10),E=new Array(R),k=[];let x=this.trackStartLines?1:void 0,I=this.trackStartLines?1:void 0;const S=function(e){const t={},n=(0,St.A)(e);return(0,ut.A)(n,(n=>{const r=e[n];if(!(0,nn.A)(r))throw Error("non exhaustive match");t[n]=[]})),t}(this.emptyGroups),N=this.trackStartLines,C=this.config.lineTerminatorsPattern;let $=0,w=[],L=[];const O=[],b=[];let _;function P(){return w}function M(e){const t=Tr(e),n=L[t];return void 0===n?b:n}Object.freeze(b);const D=e=>{if(1===O.length&&void 0===e.tokenType.PUSH_MODE){const t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);k.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{O.pop();const e=(0,Er.A)(O);w=this.patternIdxToConfig[e],L=this.charCodeToPatternIdxToConfig[e],$=w.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;_=L&&t?M:P}};function U(e){O.push(e),L=this.charCodeToPatternIdxToConfig[e],w=this.patternIdxToConfig[e],$=w.length,$=w.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;_=L&&t?M:P}let F;U.call(this,t);const G=this.config.recoveryEnabled;for(;T<A;){o=null;const t=y.charCodeAt(T),R=_(t),L=R.length;for(n=0;n<L;n++){F=R[n];const r=F.pattern;c=null;const u=F.short;if(!1!==u?t===u&&(o=r):!0===F.isCustom?(g=r.exec(y,T,E,S),null!==g?(o=g[0],void 0!==g.payload&&(c=g.payload)):o=null):(this.updateLastIndex(r,T),o=this.match(r,e,T)),null!==o){if(a=F.longerAlt,void 0!==a){const t=a.length;for(i=0;i<t;i++){const t=w[a[i]],n=t.pattern;if(l=null,!0===t.isCustom?(g=n.exec(y,T,E,S),null!==g?(s=g[0],void 0!==g.payload&&(l=g.payload)):s=null):(this.updateLastIndex(n,T),s=this.match(n,e,T)),s&&s.length>o.length){o=s,c=l,F=t;break}}}break}}if(null!==o){if(u=o.length,d=F.group,void 0!==d&&(h=F.tokenTypeIdx,f=this.createTokenInstance(o,T,h,F.tokenType,x,I,u),this.handlePayload(f,c),!1===d?v=this.addToken(E,v,f):S[d].push(f)),e=this.chopInput(e,u),T+=u,I=this.computeNewColumn(I,u),!0===N&&!0===F.canLineTerminator){let e,t,n=0;C.lastIndex=0;do{e=C.test(o),!0===e&&(t=C.lastIndex-1,n++)}while(!0===e);0!==n&&(x+=n,I=u-t,this.updateTokenEndLineColumnLocation(f,d,t,n,x,I,u))}this.handleModes(F,D,U,f)}else{const t=T,n=x,i=I;let s=!1===G;for(;!1===s&&T<A;)for(e=this.chopInput(e,1),T++,r=0;r<$;r++){const t=w[r],n=t.pattern,i=t.short;if(!1!==i?y.charCodeAt(T)===i&&(s=!0):!0===t.isCustom?s=null!==n.exec(y,T,E,S):(this.updateLastIndex(n,T),s=null!==n.exec(e)),!0===s)break}if(p=T-t,I=this.computeNewColumn(I,p),m=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(y,t,p,n,i),k.push({offset:t,line:n,column:i,length:p,message:m}),!1===G)break}}return this.hasCustom||(E.length=v),{tokens:E,groups:S,errors:k}}handleModes(e,t,n,r){if(!0===e.pop){const i=e.push;t(r),void 0!==i&&n.call(this,i)}else void 0!==e.push&&n.call(this,e.push)}chopInput(e,t){return e.substring(t)}updateLastIndex(e,t){e.lastIndex=t}updateTokenEndLineColumnLocation(e,t,n,r,i,s,a){let o,c;void 0!==t&&(o=n===a-1,c=o?-1:0,1===r&&!0===o||(e.endLine=i+c,e.endColumn=s-1-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,s){return{image:e,startOffset:t,startLine:i,startColumn:s,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,s,a){return{image:e,startOffset:t,endOffset:t+a-1,startLine:i,endLine:i,startColumn:s,endColumn:s+a-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){null!==t&&(e.payload=t)}matchWithTest(e,t,n){return!0===e.test(t)?t.substring(n,e.lastIndex):null}matchWithExec(e,t){const n=e.exec(t);return null!==n?n[0]:null}}function Mr(e){return Dr(e)?e.LABEL:e.name}function Dr(e){return(0,vt.A)(e.LABEL)&&""!==e.LABEL}Pr.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.",Pr.NA=/NOT_APPLICABLE/;const Ur="categories",Fr="label",Gr="group",Kr="push_mode",Br="pop_mode",jr="longer_alt",Vr="line_breaks",Hr="start_chars_hint";function Wr(e){return function(e){const t=e.pattern,n={};if(n.name=e.name,(0,En.A)(t)||(n.PATTERN=t),(0,pt.A)(e,"parent"))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";return(0,pt.A)(e,Ur)&&(n.CATEGORIES=e[Ur]),Cr([n]),(0,pt.A)(e,Fr)&&(n.LABEL=e[Fr]),(0,pt.A)(e,Gr)&&(n.GROUP=e[Gr]),(0,pt.A)(e,Br)&&(n.POP_MODE=e[Br]),(0,pt.A)(e,Kr)&&(n.PUSH_MODE=e[Kr]),(0,pt.A)(e,jr)&&(n.LONGER_ALT=e[jr]),(0,pt.A)(e,Vr)&&(n.LINE_BREAKS=e[Vr]),(0,pt.A)(e,Hr)&&(n.START_CHARS_HINT=e[Hr]),n}(e)}const zr=Wr({name:"EOF",pattern:Pr.NA});function Yr(e,t,n,r,i,s,a,o){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function Xr(e,t){return xr(e,t)}Cr([zr]);const qr={buildMismatchTokenMessage:({expected:e,actual:t,previous:n,ruleName:r})=>`Expecting ${Dr(e)?`--\x3e ${Mr(e)} <--`:`token of type --\x3e ${e.name} <--`} but found --\x3e '${t.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:e,ruleName:t})=>"Redundant input, expecting EOF but found: "+e.image,buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",a="\nbut found: '"+Kn(t).image+"'";if(r)return s+r+a;{const t=(0,wn.A)(e,((e,t)=>e.concat(t)),[]),n=(0,ft.A)(t,(e=>`[${(0,ft.A)(e,(e=>Mr(e))).join(", ")}]`));return s+`one of these possible Token sequences:\n${(0,ft.A)(n,((e,t)=>` ${t+1}. ${e}`)).join("\n")}`+a}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){const i="Expecting: ",s="\nbut found: '"+Kn(t).image+"'";return n?i+n+s:i+`expecting at least one iteration which starts with one of these possible Token sequences::\n <${(0,ft.A)(e,(e=>`[${(0,ft.A)(e,(e=>Mr(e))).join(",")}]`)).join(" ,")}>`+s}};Object.freeze(qr);const Qr={buildRuleNotFoundError:(e,t)=>"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"},Jr={buildDuplicateFoundError(e,t){const n=e.name,r=Kn(t),i=r.idx,s=fn(r),a=(o=r)instanceof qt?o.terminalType.name:o instanceof Kt?o.nonTerminalName:"";var o;let c=`->${s}${i>0?i:""}<- ${a?`with argument: ->${a}<-`:""}\n appears more than once (${t.length} times) in the top level rule: ->${n}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,"\n"),c},buildNamespaceConflictError:e=>`Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter.`,buildAlternationPrefixAmbiguityError(e){const t=(0,ft.A)(e.prefixPath,(e=>Mr(e))).join(", "),n=0===e.alternation.idx?"":e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(" ,")}> due to common lookahead prefix\nin <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details.`},buildAlternationAmbiguityError(e){const t=(0,ft.A)(e.prefixPath,(e=>Mr(e))).join(", "),n=0===e.alternation.idx?"":e.alternation.idx;let r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(" ,")}> in <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\n`;return r+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",r},buildEmptyRepetitionError(e){let t=fn(e.repetition);return 0!==e.repetition.idx&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError:e=>"deprecated",buildEmptyAlternationError:e=>`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\nOnly the last alternative may be an empty alternative.`,buildTooManyAlternativesError:e=>`An Alternation cannot have more than 256 alternatives:\n<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\n has ${e.alternation.definition.length+1} alternatives.`,buildLeftRecursionError(e){const t=e.topLevelRule.name;return`Left Recursion found in grammar.\nrule: <${t}> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n ${t} --\x3e ${(0,ft.A)(e.leftRecursionPath,(e=>e.name)).concat([t]).join(" --\x3e ")}\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:e=>"deprecated",buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof Bt?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};class Zr extends Jt{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){(0,ut.A)((0,dt.A)(this.nameToTopRule),(e=>{this.currTopLevel=e,e.accept(this)}))}visitNonTerminal(e){const t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{const t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:Ns.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}const ei=function(e,t){return(0,Mn.A)((0,ft.A)(e,t),1)};var ti=n(2528);const ni=function(e,t,n,r){for(var i=-1,s=null==e?0:e.length;++i<s;){var a=e[i];t(r,a,n(a),e)}return r},ri=function(e,t,n,r){return(0,en.A)(e,(function(e,i,s){t(r,e,n(e),s)})),r};var ii=Object.prototype.hasOwnProperty;const si=(ai=function(e,t,n){ii.call(e,n)?e[n].push(t):(0,ti.A)(e,n,[t])},function(e,t){var n=(0,nn.A)(e)?ni:ri,r=oi?oi():{};return n(e,ai,(0,wt.A)(t,2),r)});var ai,oi;const ci=function(e,t,n){var r=null==e?0:e.length;return r?(t=n||void 0===t?1:(0,At.A)(t),yt(e,0,(t=r-t)<0?0:t)):[]};class li extends pn{constructor(e,t){super(),this.topProd=e,this.path=t,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=(0,mt.A)(this.path.ruleStack).reverse(),this.occurrenceStack=(0,mt.A)(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){(0,ht.A)(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class ui extends li{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const e=t.concat(n),r=new jt({definition:e});this.possibleTokTypes=Tn(r),this.found=!0}}}class di extends pn{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class hi extends di{walkMany(e,t,n){if(e.idx===this.occurrence){const e=Kn(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof qt&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,n)}}class fi extends di{walkManySep(e,t,n){if(e.idx===this.occurrence){const e=Kn(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof qt&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,n)}}class pi extends di{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){const e=Kn(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof qt&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,n)}}class mi extends di{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){const e=Kn(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof qt&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,n)}}function gi(e,t,n=[]){n=(0,mt.A)(n);let r=[],i=0;function s(s){const a=gi(s.concat(Tt(e,i+1)),t,n);return r.concat(a)}for(;n.length<t&&i<e.length;){const t=e[i];if(t instanceof jt)return s(t.definition);if(t instanceof Kt)return s(t.definition);if(t instanceof Vt)r=s(t.definition);else{if(t instanceof Ht)return s(t.definition.concat([new zt({definition:t.definition})]));if(t instanceof Wt)return s([new jt({definition:t.definition}),new zt({definition:[new qt({terminalType:t.separator})].concat(t.definition)})]);if(t instanceof Yt){const e=t.definition.concat([new zt({definition:[new qt({terminalType:t.separator})].concat(t.definition)})]);r=s(e)}else if(t instanceof zt){const e=t.definition.concat([new zt({definition:t.definition})]);r=s(e)}else{if(t instanceof Xt)return(0,ut.A)(t.definition,(e=>{!1===(0,ht.A)(e.definition)&&(r=s(e.definition))})),r;if(!(t instanceof qt))throw Error("non exhaustive match");n.push(t.terminalType)}}i++}return r.push({partialPath:n,suffixDef:Tt(e,i)}),r}function yi(e,t,n,r){const i="EXIT_NONE_TERMINAL",s=[i],a="EXIT_ALTERNATIVE";let o=!1;const c=t.length,l=c-r-1,u=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!(0,ht.A)(d);){const e=d.pop();if(e===a){o&&(0,Er.A)(d).idx<=l&&d.pop();continue}const r=e.def,h=e.idx,f=e.ruleStack,p=e.occurrenceStack;if((0,ht.A)(r))continue;const m=r[0];if(m===i){const e={idx:h,def:Tt(r),ruleStack:ci(f),occurrenceStack:ci(p)};d.push(e)}else if(m instanceof qt)if(h<c-1){const e=h+1;if(n(t[e],m.terminalType)){const t={idx:e,def:Tt(r),ruleStack:f,occurrenceStack:p};d.push(t)}}else{if(h!==c-1)throw Error("non exhaustive match");u.push({nextTokenType:m.terminalType,nextTokenOccurrence:m.idx,ruleStack:f,occurrenceStack:p}),o=!0}else if(m instanceof Kt){const e=(0,mt.A)(f);e.push(m.nonTerminalName);const t=(0,mt.A)(p);t.push(m.idx);const n={idx:h,def:m.definition.concat(s,Tt(r)),ruleStack:e,occurrenceStack:t};d.push(n)}else if(m instanceof Vt){const e={idx:h,def:Tt(r),ruleStack:f,occurrenceStack:p};d.push(e),d.push(a);const t={idx:h,def:m.definition.concat(Tt(r)),ruleStack:f,occurrenceStack:p};d.push(t)}else if(m instanceof Ht){const e=new zt({definition:m.definition,idx:m.idx}),t={idx:h,def:m.definition.concat([e],Tt(r)),ruleStack:f,occurrenceStack:p};d.push(t)}else if(m instanceof Wt){const e=new qt({terminalType:m.separator}),t=new zt({definition:[e].concat(m.definition),idx:m.idx}),n={idx:h,def:m.definition.concat([t],Tt(r)),ruleStack:f,occurrenceStack:p};d.push(n)}else if(m instanceof Yt){const e={idx:h,def:Tt(r),ruleStack:f,occurrenceStack:p};d.push(e),d.push(a);const t=new qt({terminalType:m.separator}),n=new zt({definition:[t].concat(m.definition),idx:m.idx}),i={idx:h,def:m.definition.concat([n],Tt(r)),ruleStack:f,occurrenceStack:p};d.push(i)}else if(m instanceof zt){const e={idx:h,def:Tt(r),ruleStack:f,occurrenceStack:p};d.push(e),d.push(a);const t=new zt({definition:m.definition,idx:m.idx}),n={idx:h,def:m.definition.concat([t],Tt(r)),ruleStack:f,occurrenceStack:p};d.push(n)}else if(m instanceof Xt)for(let e=m.definition.length-1;e>=0;e--){const t={idx:h,def:m.definition[e].definition.concat(Tt(r)),ruleStack:f,occurrenceStack:p};d.push(t),d.push(a)}else if(m instanceof jt)d.push({idx:h,def:m.definition.concat(Tt(r)),ruleStack:f,occurrenceStack:p});else{if(!(m instanceof Bt))throw Error("non exhaustive match");d.push(Ai(m,h,f,p))}}return u}function Ai(e,t,n,r){const i=(0,mt.A)(n);i.push(e.name);const s=(0,mt.A)(r);return s.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:s}}var Ti;function vi(e){if(e instanceof Vt||"Option"===e)return Ti.OPTION;if(e instanceof zt||"Repetition"===e)return Ti.REPETITION;if(e instanceof Ht||"RepetitionMandatory"===e)return Ti.REPETITION_MANDATORY;if(e instanceof Wt||"RepetitionMandatoryWithSeparator"===e)return Ti.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof Yt||"RepetitionWithSeparator"===e)return Ti.REPETITION_WITH_SEPARATOR;if(e instanceof Xt||"Alternation"===e)return Ti.ALTERNATION;throw Error("non exhaustive match")}function Ri(e){const{occurrence:t,rule:n,prodType:r,maxLookahead:i}=e,s=vi(r);return s===Ti.ALTERNATION?wi(t,n,i):Li(t,n,s,i)}function Ei(e,t,n,r){const i=e.length,s=dn(e,(e=>dn(e,(e=>1===e.length))));if(t)return function(t){const r=(0,ft.A)(t,(e=>e.GATE));for(let t=0;t<i;t++){const i=e[t],s=i.length,a=r[t];if(void 0===a||!1!==a.call(this))e:for(let e=0;e<s;e++){const r=i[e],s=r.length;for(let e=0;e<s;e++){const t=this.LA(e+1);if(!1===n(t,r[e]))continue e}return t}}};if(s&&!r){const t=(0,ft.A)(e,(e=>(0,An.A)(e))),n=(0,wn.A)(t,((e,t,n)=>((0,ut.A)(t,(t=>{(0,pt.A)(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=n),(0,ut.A)(t.categoryMatches,(t=>{(0,pt.A)(e,t)||(e[t]=n)}))})),e)),{});return function(){const e=this.LA(1);return n[e.tokenTypeIdx]}}return function(){for(let t=0;t<i;t++){const r=e[t],i=r.length;e:for(let e=0;e<i;e++){const i=r[e],s=i.length;for(let e=0;e<s;e++){const t=this.LA(e+1);if(!1===n(t,i[e]))continue e}return t}}}}function ki(e,t,n){const r=dn(e,(e=>1===e.length)),i=e.length;if(r&&!n){const t=(0,An.A)(e);if(1===t.length&&(0,ht.A)(t[0].categoryMatches)){const e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{const e=(0,wn.A)(t,((e,t,n)=>(e[t.tokenTypeIdx]=!0,(0,ut.A)(t.categoryMatches,(t=>{e[t]=!0})),e)),[]);return function(){const t=this.LA(1);return!0===e[t.tokenTypeIdx]}}}return function(){e:for(let n=0;n<i;n++){const r=e[n],i=r.length;for(let e=0;e<i;e++){const n=this.LA(e+1);if(!1===t(n,r[e]))continue e}return!0}return!1}}!function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"}(Ti||(Ti={}));class xi extends pn{constructor(e,t,n){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,n,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)}walkOption(e,t,n){this.checkIsTarget(e,Ti.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,Ti.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,Ti.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,Ti.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,Ti.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}}class Ii extends Jt{constructor(e,t,n){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=n,this.result=[]}checkIsTarget(e,t){e.idx!==this.targetOccurrence||this.targetProdType!==t||void 0!==this.targetRef&&e!==this.targetRef||(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,Ti.OPTION)}visitRepetition(e){this.checkIsTarget(e,Ti.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Ti.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Ti.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Ti.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Ti.ALTERNATION)}}function Si(e){const t=new Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function Ni(e){let t=[""];for(let n=0;n<e.length;n++){const r=e[n],i=[];for(let e=0;e<t.length;e++){const n=t[e];i.push(n+"_"+r.tokenTypeIdx);for(let e=0;e<r.categoryMatches.length;e++){const t="_"+r.categoryMatches[e];i.push(n+t)}}t=i}return t}function Ci(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;const i=e[r];for(let e=0;e<t.length;e++)if(!0===i[t[e]])return!1}return!0}function $i(e,t){const n=(0,ft.A)(e,(e=>gi([e],1))),r=Si(n.length),i=(0,ft.A)(n,(e=>{const t={};return(0,ut.A)(e,(e=>{const n=Ni(e.partialPath);(0,ut.A)(n,(e=>{t[e]=!0}))})),t}));let s=n;for(let e=1;e<=t;e++){const n=s;s=Si(n.length);for(let a=0;a<n.length;a++){const o=n[a];for(let n=0;n<o.length;n++){const c=o[n].partialPath,l=o[n].suffixDef,u=Ni(c);if(Ci(i,u,a)||(0,ht.A)(l)||c.length===t){const e=r[a];if(!1===Oi(e,c)){e.push(c);for(let e=0;e<u.length;e++){const t=u[e];i[a][t]=!0}}}else{const t=gi(l,e+1,c);s[a]=s[a].concat(t),(0,ut.A)(t,(e=>{const t=Ni(e.partialPath);(0,ut.A)(t,(e=>{i[a][e]=!0}))}))}}}}return r}function wi(e,t,n,r){const i=new Ii(e,Ti.ALTERNATION,r);return t.accept(i),$i(i.result,n)}function Li(e,t,n,r){const i=new Ii(e,n);t.accept(i);const s=i.result,a=new xi(t,e,n).startWalking();return $i([new jt({definition:s}),new jt({definition:a})],r)}function Oi(e,t){e:for(let n=0;n<e.length;n++){const r=e[n];if(r.length===t.length){for(let e=0;e<r.length;e++){const n=t[e],i=r[e];if(!1==(n===i||void 0!==i.categoryMatchesMap[n.tokenTypeIdx]))continue e}return!0}}return!1}function bi(e){return dn(e,(e=>dn(e,(e=>dn(e,(e=>(0,ht.A)(e.categoryMatches)))))))}function _i(e){return`${fn(e)}_#_${e.idx}_#_${Pi(e)}`}function Pi(e){return e instanceof qt?e.terminalType.name:e instanceof Kt?e.nonTerminalName:""}class Mi extends Jt{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 Di(e,t,n,r=[]){const i=[],s=Ui(t.definition);if((0,ht.A)(s))return[];{const t=e.name;cn(s,e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:Ns.LEFT_RECURSION,ruleName:t});const a=Fn(s,r.concat([e])),o=ei(a,(t=>{const i=(0,mt.A)(r);return i.push(t),Di(e,t,n,i)}));return i.concat(o)}}function Ui(e){let t=[];if((0,ht.A)(e))return t;const n=Kn(e);if(n instanceof Kt)t.push(n.referencedRule);else if(n instanceof jt||n instanceof Vt||n instanceof Ht||n instanceof Wt||n instanceof Yt||n instanceof zt)t=t.concat(Ui(n.definition));else if(n instanceof Xt)t=(0,An.A)((0,ft.A)(n.definition,(e=>Ui(e.definition))));else if(!(n instanceof qt))throw Error("non exhaustive match");const r=hn(n),i=e.length>1;if(r&&i){const n=Tt(e);return t.concat(Ui(n))}return t}class Fi extends Jt{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}class Gi extends Jt{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)}}const Ki="MismatchedTokenException",Bi="NoViableAltException",ji="EarlyExitException",Vi="NotAllInputParsedException",Hi=[Ki,Bi,ji,Vi];function Wi(e){return cn(Hi,e.name)}Object.freeze(Hi);class zi extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class Yi extends zi{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Ki}}class Xi extends zi{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Bi}}class qi extends zi{constructor(e,t){super(e,t),this.name=Vi}}class Qi extends zi{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=ji}}const Ji={},Zi="InRuleRecoveryException";class es extends Error{constructor(e){super(e),this.name=Zi}}function ts(e,t,n,r,i,s,a){const o=this.getKeyForAutomaticLookahead(r,i);let c=this.firstAfterRepMap[o];if(void 0===c){const e=this.getCurrRuleFullName();c=new s(this.getGAstProductions()[e],i).startWalking(),this.firstAfterRepMap[o]=c}let l=c.token,u=c.occurrence;const d=c.isEndOfRule;1===this.RULE_STACK.length&&d&&void 0===l&&(l=zr,u=1),void 0!==l&&void 0!==u&&this.shouldInRepetitionRecoveryBeTried(l,u,a)&&this.tryInRepetitionRecovery(e,t,n,l)}const ns=1024,rs=1280,is=1536;function ss(e,t,n){return n|t|e}class as{constructor(e){var t;this.maxLookahead=null!==(t=null==e?void 0:e.maxLookahead)&&void 0!==t?t:Is.maxLookahead}validate(e){const t=this.validateNoLeftRecursion(e.rules);if((0,ht.A)(t)){const n=this.validateEmptyOrAlternatives(e.rules),r=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...r,...i]}return t}validateNoLeftRecursion(e){return ei(e,(e=>Di(e,e,Jr)))}validateEmptyOrAlternatives(e){return ei(e,(e=>function(e,t){const n=new Fi;e.accept(n);const r=n.alternations;return ei(r,(n=>{const r=ci(n.definition);return ei(r,((r,i)=>{const s=yi([r],[],xr,1);return(0,ht.A)(s)?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:n,emptyChoiceIdx:i}),type:Ns.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:n.idx,alternative:i+1}]:[]}))}))}(e,Jr)))}validateAmbiguousAlternationAlternatives(e,t){return ei(e,(e=>function(e,t,n){const r=new Fi;e.accept(r);let i=r.alternations;i=Sn(i,(e=>!0===e.ignoreAmbiguities));return ei(i,(r=>{const i=r.idx,s=r.maxLookahead||t,a=wi(i,e,s,r),o=function(e,t,n,r){const i=[],s=(0,wn.A)(e,((n,r,s)=>(!0===t.definition[s].ignoreAmbiguities||(0,ut.A)(r,(r=>{const a=[s];(0,ut.A)(e,((e,n)=>{s!==n&&Oi(e,r)&&!0!==t.definition[n].ignoreAmbiguities&&a.push(n)})),a.length>1&&!Oi(i,r)&&(i.push(r),n.push({alts:a,path:r}))})),n)),[]);return(0,ft.A)(s,(e=>{const i=(0,ft.A)(e.alts,(e=>e+1));return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Ns.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:e.alts}}))}(a,r,e,n),c=function(e,t,n,r){const i=(0,wn.A)(e,((e,t,n)=>{const r=(0,ft.A)(t,(e=>({idx:n,path:e})));return e.concat(r)}),[]);return Gn(ei(i,(e=>{if(!0===t.definition[e.idx].ignoreAmbiguities)return[];const s=e.idx,a=e.path,o=(0,Ln.A)(i,(e=>{return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<s&&(n=e.path,r=a,n.length<r.length&&dn(n,((e,t)=>{const n=r[t];return e===n||n.categoryMatchesMap[e.tokenTypeIdx]})));var n,r}));return(0,ft.A)(o,(e=>{const i=[e.idx+1,s+1],a=0===t.idx?"":t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Ns.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:a,alternatives:i}}))})))}(a,r,e,n);return o.concat(c)}))}(e,t,Jr)))}validateSomeNonEmptyLookaheadPath(e,t){return function(e,t,n){const r=[];return(0,ut.A)(e,(e=>{const i=new Gi;e.accept(i);const s=i.allProductions;(0,ut.A)(s,(i=>{const s=vi(i),a=i.maxLookahead||t,o=Li(i.idx,e,s,a)[0];if((0,ht.A)((0,An.A)(o))){const t=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:t,type:Ns.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}}))})),r}(e,t,Jr)}buildLookaheadForAlternation(e){return function(e,t,n,r,i,s){const a=wi(e,t,n);return s(a,r,bi(a)?Ir:xr,i)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Ei)}buildLookaheadForOptional(e){return function(e,t,n,r,i,s){const a=Li(e,t,i,n),o=bi(a)?Ir:xr;return s(a[0],o,r)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,vi(e.prodType),ki)}}const os=new class extends Jt{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)}};function cs(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==1&&(e.endOffset=t.endOffset)}function ls(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==1&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function us(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function ds(e,t){const n=(0,St.A)(e),r=n.length;for(let i=0;i<r;i++){const r=e[n[i]],s=r.length;for(let e=0;e<s;e++){const n=r[e];void 0===n.tokenTypeIdx&&this[n.name](n.children,t)}}}var hs;!function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"}(hs||(hs={}));var fs=n(3149);const ps={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(ps);const ms=!0,gs=Math.pow(2,8)-1,ys=Wr({name:"RECORDING_PHASE_TOKEN",pattern:Pr.NA});Cr([ys]);const As=Yr(ys,"This IToken indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(As);const Ts={name:"This CSTNode indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}};function vs(e,t,n,r=!1){ks(n);const i=(0,Er.A)(this.recordingProdStack),s=(0,Nn.A)(t)?t:t.DEF,a=new e({definition:[],idx:n});return r&&(a.separator=t.SEP),(0,pt.A)(t,"MAX_LOOKAHEAD")&&(a.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),ps}function Rs(e,t){ks(t);const n=(0,Er.A)(this.recordingProdStack),r=!1===(0,nn.A)(e),i=!1===r?e:e.DEF,s=new Xt({definition:[],idx:t,ignoreAmbiguities:r&&!0===e.IGNORE_AMBIGUITIES});(0,pt.A)(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD);const a=sn(i,(e=>(0,Nn.A)(e.GATE)));return s.hasPredicates=a,n.definition.push(s),(0,ut.A)(i,(e=>{const t=new jt({definition:[]});s.definition.push(t),(0,pt.A)(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:(0,pt.A)(e,"GATE")&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()})),ps}function Es(e){return 0===e?"":`${e}`}function ks(e){if(e<0||e>gs){const t=new Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than ${gs+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}const xs=Yr(zr,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(xs);const Is=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:qr,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Ss=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Ns,Cs,$s;function ws(e=void 0){return function(){return e}}!function(e){e[e.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",e[e.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",e[e.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",e[e.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",e[e.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",e[e.LEFT_RECURSION=5]="LEFT_RECURSION",e[e.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",e[e.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",e[e.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",e[e.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",e[e.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",e[e.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"}(Ns||(Ns={}));class Ls{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",(()=>{let e;this.selfAnalysisDone=!0;const t=this.className;this.TRACE_INIT("toFastProps",(()=>{gt(this)})),this.TRACE_INIT("Grammar Recording",(()=>{try{this.enableRecording(),(0,ut.A)(this.definedRulesNames,(e=>{const t=this[e].originalGrammarAction;let n;this.TRACE_INIT(`${e} Rule`,(()=>{n=this.topLevelRuleRecord(e,t)})),this.gastProductionsCache[e]=n}))}finally{this.disableRecording()}}));let n=[];if(this.TRACE_INIT("Grammar Resolving",(()=>{n=function(e){const t=(0,kn.A)(e,{errMsgProvider:Qr}),n={};return(0,ut.A)(e.rules,(e=>{n[e.name]=e})),function(e,t){const n=new Zr(e,t);return n.resolveRefs(),n.errors}(n,t.errMsgProvider)}({rules:(0,dt.A)(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)})),this.TRACE_INIT("Grammar Validations",(()=>{if((0,ht.A)(n)&&!1===this.skipValidations){const n=(e={rules:(0,dt.A)(this.gastProductionsCache),tokenTypes:(0,dt.A)(this.tokensMap),errMsgProvider:Jr,grammarName:t},function(e,t,n,r){const i=ei(e,(e=>function(e,t){const n=new Mi;e.accept(n);const r=n.allProductions,i=si(r,_i),s=bt(i,(e=>e.length>1));return(0,ft.A)((0,dt.A)(s),(n=>{const r=Kn(n),i=t.buildDuplicateFoundError(e,n),s=fn(r),a={message:i,type:Ns.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:s,occurrence:r.idx},o=Pi(r);return o&&(a.parameter=o),a}))}(e,n))),s=function(e,t,n){const r=[],i=(0,ft.A)(t,(e=>e.name));return(0,ut.A)(e,(e=>{const t=e.name;if(cn(i,t)){const i=n.buildNamespaceConflictError(e);r.push({message:i,type:Ns.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}})),r}(e,t,n),a=ei(e,(e=>function(e,t){const n=new Fi;e.accept(n);const r=n.alternations;return ei(r,(n=>n.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:n}),type:Ns.TOO_MANY_ALTS,ruleName:e.name,occurrence:n.idx}]:[]))}(e,n))),o=ei(e,(t=>function(e,t,n,r){const i=[],s=(0,wn.A)(t,((t,n)=>n.name===e.name?t+1:t),0);if(s>1){const t=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:t,type:Ns.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}(t,e,r,n)));return i.concat(s,a,o)}((e=(0,kn.A)(e,{errMsgProvider:Jr})).rules,e.tokenTypes,e.errMsgProvider,e.grammarName)),r=function(e){const t=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return(0,ft.A)(t,(e=>Object.assign({type:Ns.CUSTOM_LOOKAHEAD_VALIDATION},e)))}({lookaheadStrategy:this.lookaheadStrategy,rules:(0,dt.A)(this.gastProductionsCache),tokenTypes:(0,dt.A)(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(n,r)}var e})),(0,ht.A)(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",(()=>{const e=function(e){const t={};return(0,ut.A)(e,(e=>{const n=new Rn(e).startWalking();Ct(t,n)})),t}((0,dt.A)(this.gastProductionsCache));this.resyncFollows=e})),this.TRACE_INIT("ComputeLookaheadFunctions",(()=>{var e,t;null===(t=(e=this.lookaheadStrategy).initialize)||void 0===t||t.call(e,{rules:(0,dt.A)(this.gastProductionsCache)}),this.preComputeLookaheadFunctions((0,dt.A)(this.gastProductionsCache))}))),!Ls.DEFER_DEFINITION_ERRORS_HANDLING&&!(0,ht.A)(this.definitionErrors))throw e=(0,ft.A)(this.definitionErrors,(e=>e.message)),new Error(`Parser Definition Errors detected:\n ${e.join("\n-------------------------------\n")}`)}))}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;const n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(e,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initContentAssist(),n.initGastRecorder(t),n.initPerformanceTracer(t),(0,pt.A)(t,"ignoredIssues"))throw new Error("The <ignoredIssues> IParserConfig property has been deprecated.\n\tPlease use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n\tSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n\tFor further details.");this.skipValidations=(0,pt.A)(t,"skipValidations")?t.skipValidations:Is.skipValidations}}Ls.DEFER_DEFINITION_ERRORS_HANDLING=!1,Cs=Ls,$s=[class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=(0,pt.A)(e,"recoveryEnabled")?e.recoveryEnabled:Is.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=ts)}getTokenToInsert(e){const t=Yr(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,r){const i=this.findReSyncTokenType(),s=this.exportLexerState(),a=[];let o=!1;const c=this.LA(1);let l=this.LA(1);const u=()=>{const e=this.LA(0),t=this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:e,ruleName:this.getCurrRuleFullName()}),n=new Yi(t,c,this.LA(0));n.resyncedTokens=ci(a),this.SAVE_ERROR(n)};for(;!o;){if(this.tokenMatcher(l,r))return void u();if(n.call(this))return u(),void e.apply(this,t);this.tokenMatcher(l,i)?o=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,a))}this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(e,t,n){return!1!==n&&!this.tokenMatcher(this.LA(1),e)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t))}getFollowsForInRuleRecovery(e,t){const n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new es("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if((0,ht.A)(t))return!1;const n=this.LA(1);return void 0!==(0,Bn.A)(t,(e=>this.tokenMatcher(n,e)))}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){const t=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(t);return cn(n,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let t=this.LA(1),n=2;for(;;){const r=(0,Bn.A)(e,(e=>Xr(t,e)));if(void 0!==r)return r;t=this.LA(n),n++}}getCurrFollowKey(){if(1===this.RULE_STACK.length)return Ji;const e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return(0,ft.A)(e,((n,r)=>0===r?Ji:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:t[r],inRule:this.shortRuleNameToFullName(e[r-1])}))}flattenFollowSet(){const e=(0,ft.A)(this.buildFullFollowKeyStack(),(e=>this.getFollowSetFromFollowKey(e)));return(0,An.A)(e)}getFollowSetFromFollowKey(e){if(e===Ji)return[zr];const t=e.ruleName+e.idxInCallingRule+vn+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,zr)||t.push(e),t}reSyncTo(e){const t=[];let n=this.LA(1);for(;!1===this.tokenMatcher(n,e);)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return ci(t)}attemptInRepetitionRecovery(e,t,n,r,i,s,a){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:(0,mt.A)(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return(0,ft.A)(this.RULE_STACK,(e=>this.shortRuleNameToFullName(e)))}},class{initLooksAhead(e){this.dynamicTokensEnabled=(0,pt.A)(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Is.dynamicTokensEnabled,this.maxLookahead=(0,pt.A)(e,"maxLookahead")?e.maxLookahead:Is.maxLookahead,this.lookaheadStrategy=(0,pt.A)(e,"lookaheadStrategy")?e.lookaheadStrategy:new as({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){(0,ut.A)(e,(e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,(()=>{const{alternation:t,repetition:n,option:r,repetitionMandatory:i,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:a}=function(e){os.reset(),e.accept(os);const t=os.dslMethods;return os.reset(),t}(e);(0,ut.A)(t,(t=>{const n=0===t.idx?"":t.idx;this.TRACE_INIT(`${fn(t)}${n}`,(()=>{const n=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),r=ss(this.fullRuleNameToShort[e.name],256,t.idx);this.setLaFuncCache(r,n)}))})),(0,ut.A)(n,(t=>{this.computeLookaheadFunc(e,t.idx,768,"Repetition",t.maxLookahead,fn(t))})),(0,ut.A)(r,(t=>{this.computeLookaheadFunc(e,t.idx,512,"Option",t.maxLookahead,fn(t))})),(0,ut.A)(i,(t=>{this.computeLookaheadFunc(e,t.idx,ns,"RepetitionMandatory",t.maxLookahead,fn(t))})),(0,ut.A)(s,(t=>{this.computeLookaheadFunc(e,t.idx,is,"RepetitionMandatoryWithSeparator",t.maxLookahead,fn(t))})),(0,ut.A)(a,(t=>{this.computeLookaheadFunc(e,t.idx,rs,"RepetitionWithSeparator",t.maxLookahead,fn(t))}))}))}))}computeLookaheadFunc(e,t,n,r,i,s){this.TRACE_INIT(`${s}${0===t?"":t}`,(()=>{const s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r}),a=ss(this.fullRuleNameToShort[e.name],n,t);this.setLaFuncCache(a,s)}))}getKeyForAutomaticLookahead(e,t){return ss(this.getLastExplicitRuleShortName(),e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}},class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=(0,pt.A)(e,"nodeLocationTracking")?e.nodeLocationTracking:Is.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ls,this.setNodeLocationFromNode=ls,this.cstPostRule=Rr.A,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Rr.A,this.setNodeLocationFromNode=Rr.A,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=cs,this.setNodeLocationFromNode=cs,this.cstPostRule=Rr.A,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Rr.A,this.setNodeLocationFromNode=Rr.A,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);this.setNodeLocationFromToken=Rr.A,this.setNodeLocationFromNode=Rr.A,this.cstPostRule=Rr.A,this.setInitialNodeLocation=Rr.A}else this.cstInvocationStateUpdate=Rr.A,this.cstFinallyStateUpdate=Rr.A,this.cstPostTerminal=Rr.A,this.cstPostNonTerminal=Rr.A,this.cstPostRule=Rr.A}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 t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const t=this.LA(0),n=e.location;n.startOffset<=t.startOffset==1?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){const t=this.LA(0),n=e.location;n.startOffset<=t.startOffset==1?n.endOffset=t.endOffset:n.startOffset=NaN}cstPostTerminal(e,t){const n=this.CST_STACK[this.CST_STACK.length-1];var r,i,s;i=t,s=e,void 0===(r=n).children[s]?r.children[s]=[i]:r.children[s].push(i),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){const n=this.CST_STACK[this.CST_STACK.length-1];!function(e,t,n){void 0===e.children[t]?e.children[t]=[n]:e.children[t].push(n)}(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if((0,En.A)(this.baseCstVisitorConstructor)){const e=function(e,t){const n=function(){};us(n,e+"BaseSemantics");const r={visit:function(e,t){if((0,nn.A)(e)&&(e=e[0]),!(0,En.A)(e))return this[e.name](e.children,t)},validateVisitor:function(){const e=function(e,t){const n=function(e,t){const n=(0,Ln.A)(t,(t=>!1===(0,Nn.A)(e[t]))),r=(0,ft.A)(n,(t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:hs.MISSING_METHOD,methodName:t})));return Gn(r)}(e,t);return n}(this,t);if(!(0,ht.A)(e)){const t=(0,ft.A)(e,(e=>e.msg));throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${t.join("\n\n").replace(/\n/g,"\n\t")}`)}}};return(n.prototype=r).constructor=n,n._RULE_NAMES=t,n}(this.className,(0,St.A)(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if((0,En.A)(this.baseCstVisitorWithDefaultsConstructor)){const e=function(e,t,n){const r=function(){};us(r,e+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return(0,ut.A)(t,(e=>{i[e]=ds})),(r.prototype=i).constructor=r,r}(this.className,(0,St.A)(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{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(!0!==this.selfAnalysisDone)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)):xs}LA(e){const t=this.currIdx+e;return t<0||this.tokVectorLength<=t?xs:this.tokVector[t]}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{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Ir,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},(0,pt.A)(t,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n\tFor Further details.");if((0,nn.A)(e)){if((0,ht.A)(e))throw Error("A Token Vocabulary cannot be empty.\n\tNote that the first argument for the parser constructor\n\tis no longer a Token vector (since v4.0).");if("number"==typeof e[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n\tFor Further details.")}if((0,nn.A)(e))this.tokensMap=(0,wn.A)(e,((e,t)=>(e[t.name]=t,e)),{});else if((0,pt.A)(e,"modes")&&dn((0,An.A)((0,dt.A)(e.modes)),Or)){const t=(0,An.A)((0,dt.A)(e.modes)),n=yn(t);this.tokensMap=(0,wn.A)(n,((e,t)=>(e[t.name]=t,e)),{})}else{if(!(0,fs.A)(e))throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=(0,mt.A)(e)}this.tokensMap.EOF=zr;const n=(0,pt.A)(e,"modes")?(0,An.A)((0,dt.A)(e.modes)):(0,dt.A)(e),r=dn(n,(e=>(0,ht.A)(e.categoryMatches)));this.tokenMatcher=r?Ir:xr,Cr((0,dt.A)(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const r=(0,pt.A)(n,"resyncEnabled")?n.resyncEnabled:Ss.resyncEnabled,i=(0,pt.A)(n,"recoveryValueFunc")?n.recoveryValueFunc:Ss.recoveryValueFunc,s=this.ruleShortNameIdx<<12;let a;return this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s,a=!0===this.outputCst?function(...n){try{this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,n);const r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...n){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(a,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,n){const r=1===this.RULE_STACK.length,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(Wi(e)){const t=e;if(i){const r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r)){if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){const e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return n(e)}if(this.outputCst){const e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(r)return this.moveToTerminatedState(),n(e);throw t}throw e}optionInternal(e,t){const n=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof e){r=e.DEF;const t=e.GATE;if(void 0!==t){const e=i;i=()=>t.call(this)&&e.call(this)}}else r=e;if(!0===i.call(this))return r.call(this)}atLeastOneInternal(e,t){const n=this.getKeyForAutomaticLookahead(ns,e);return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof t){r=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,Ti.REPETITION_MANDATORY,t.ERR_MSG);{let e=this.doSingleRepetition(r);for(;!0===i.call(this)&&!0===e;)e=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,ns,e,pi)}atLeastOneSepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(is,e);this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){const r=t.DEF,i=t.SEP;if(!0!==this.getLaFuncFromCache(n).call(this))throw this.raiseEarlyExitException(e,Ti.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{r.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,mi],t,is,e,mi)}}manyInternal(e,t){const n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof t){r=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;let s=!0;for(;!0===i.call(this)&&!0===s;)s=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,hi,s)}manySepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(rs,e);this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){const r=t.DEF,i=t.SEP;if(!0===this.getLaFuncFromCache(n).call(this)){r.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,fi],t,rs,e,fi)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,is,e,i)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const n=this.getKeyForAutomaticLookahead(256,t),r=(0,nn.A)(e)?e:e.DEF,i=this.getLaFuncFromCache(n).call(this,r);if(void 0!==i)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){const e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new qi(t,e))}}subruleInternal(e,t,n){let r;try{const i=void 0!==n?n.ARGS:void 0;return this.subruleIdx=t,r=e.apply(this,i),this.cstPostNonTerminal(r,void 0!==n&&void 0!==n.LABEL?n.LABEL:e.ruleName),r}catch(t){throw this.subruleInternalError(t,n,e.ruleName)}}subruleInternalError(e,t,n){throw Wi(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{const t=this.LA(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),r=t):this.consumeInternalError(e,t,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(void 0!==n&&void 0!==n.LABEL?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r;const i=this.LA(0);throw r=void 0!==n&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Yi(r,t,i))}consumeInternalRecovery(e,t,n){if(!this.recoveryEnabled||"MismatchedTokenException"!==n.name||this.isBackTracking())throw n;{const r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===Zi?n:e}}}saveRecogState(){const e=this.errors,t=(0,mt.A)(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)}isBackTracking(){return 0!==this.isBackTrackingStack.length}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),zr)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},class{ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}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,t,n=Ss){if(cn(this.definedRulesNames,e)){const t={message:Jr.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Ns.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);const r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=Ss){const r=function(e,t,n){const r=[];let i;return cn(t,e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:Ns.INVALID_RULE_OVERRIDE,ruleName:e})),r}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);const i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);const n=this.saveRecogState();try{return e.apply(this,t),!0}catch(e){if(Wi(e))return!1;throw e}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return e=(0,dt.A)(this.gastProductionsCache),(0,ft.A)(e,Qt);var e}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=(0,pt.A)(e,"errorMessageProvider")?e.errorMessageProvider:Is.errorMessageProvider}SAVE_ERROR(e){if(Wi(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,mt.A)(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return(0,mt.A)(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){const r=this.getCurrRuleFullName(),i=Li(e,this.getGAstProductions()[r],t,this.maxLookahead)[0],s=[];for(let e=1;e<=this.maxLookahead;e++)s.push(this.LA(e));const a=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:s,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new Qi(a,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){const n=this.getCurrRuleFullName(),r=wi(e,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let e=1;e<=this.maxLookahead;e++)i.push(this.LA(e));const s=this.LA(0),a=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:s,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Xi(a,this.LA(1),s))}},class{initContentAssist(){}computeContentAssist(e,t){const n=this.gastProductionsCache[e];if((0,En.A)(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return yi([n],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const t=Kn(e.ruleStack),n=this.getGAstProductions()[t];return new ui(n,e).startWalking()}},class{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 t=e>0?e:"";this[`CONSUME${t}`]=function(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},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 t=0;t<10;t++){const n=t>0?t:"";delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}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,t){return()=>!0}LA_RECORD(e){return xs}topLevelRuleRecord(e,t){try{const n=new Bt({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message=e.message+'\n\t This error was thrown during the "grammar recording phase" For more info see:\n\thttps://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(t){throw e}throw e}}optionInternalRecord(e,t){return vs.call(this,Vt,e,t)}atLeastOneInternalRecord(e,t){vs.call(this,Ht,t,e)}atLeastOneSepFirstInternalRecord(e,t){vs.call(this,Wt,t,e,ms)}manyInternalRecord(e,t){vs.call(this,zt,t,e)}manySepFirstInternalRecord(e,t){vs.call(this,Yt,t,e,ms)}orInternalRecord(e,t){return Rs.call(this,e,t)}subruleInternalRecord(e,t,n){if(ks(t),!e||!1===(0,pt.A)(e,"ruleName")){const n=new Error(`<SUBRULE${Es(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}const r=(0,Er.A)(this.recordingProdStack),i=e.ruleName,s=new Kt({idx:t,nonTerminalName:i,label:null==n?void 0:n.LABEL,referencedRule:void 0});return r.definition.push(s),this.outputCst?Ts:ps}consumeInternalRecord(e,t,n){if(ks(t),!wr(e)){const n=new Error(`<CONSUME${Es(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}const r=(0,Er.A)(this.recordingProdStack),i=new qt({idx:t,terminalType:e,label:null==n?void 0:n.LABEL});return r.definition.push(i),As}},class{initPerformanceTracer(e){if((0,pt.A)(e,"traceInitPerf")){const t=e.traceInitPerf,n="number"==typeof t;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=Is.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);const{time:r,value:i}=kr(t),s=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}}],$s.forEach((e=>{const t=e.prototype;Object.getOwnPropertyNames(t).forEach((n=>{if("constructor"===n)return;const r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(Cs.prototype,n,r):Cs.prototype[n]=e.prototype[n]}))}));class Os extends Ls{constructor(e,t=Is){const n=(0,mt.A)(t);n.outputCst=!1,super(e,n)}}function bs(e,t,n){return`${e.name}_${t}_${n}`}class _s{constructor(e){this.target=e}isEpsilon(){return!1}}class Ps extends _s{constructor(e,t){super(e),this.tokenType=t}}class Ms extends _s{constructor(e){super(e)}isEpsilon(){return!0}}class Ds extends _s{constructor(e,t,n){super(e),this.rule=t,this.followState=n}isEpsilon(){return!0}}function Us(e,t,n){return n instanceof qt?Vs(e,t,n.terminalType,n):n instanceof Kt?function(e,t,n){const r=n.referencedRule,i=e.ruleToStartState.get(r),s=zs(e,t,n,{type:1}),a=zs(e,t,n,{type:1});return Ys(s,new Ds(i,r,a)),{left:s,right:a}}(e,t,n):n instanceof Xt?function(e,t,n){const r=zs(e,t,n,{type:1});Bs(e,r);const i=(0,ft.A)(n.definition,(n=>Us(e,t,n)));return js(e,t,r,n,...i)}(e,t,n):n instanceof Vt?function(e,t,n){const r=zs(e,t,n,{type:1});Bs(e,r);return function(e,t,n,r){const i=r.left;return Ws(i,r.right),e.decisionMap[bs(t,"Option",n.idx)]=i,r}(e,t,n,js(e,t,r,n,Fs(e,t,n)))}(e,t,n):n instanceof zt?function(e,t,n){const r=zs(e,t,n,{type:5});Bs(e,r);return Ks(e,t,n,js(e,t,r,n,Fs(e,t,n)))}(e,t,n):n instanceof Yt?function(e,t,n){const r=zs(e,t,n,{type:5});Bs(e,r);return Ks(e,t,n,js(e,t,r,n,Fs(e,t,n)),Vs(e,t,n.separator,n))}(e,t,n):n instanceof Ht?function(e,t,n){const r=zs(e,t,n,{type:4});Bs(e,r);return Gs(e,t,n,js(e,t,r,n,Fs(e,t,n)))}(e,t,n):n instanceof Wt?function(e,t,n){const r=zs(e,t,n,{type:4});Bs(e,r);return Gs(e,t,n,js(e,t,r,n,Fs(e,t,n)),Vs(e,t,n.separator,n))}(e,t,n):Fs(e,t,n)}function Fs(e,t,n){const r=(0,Ln.A)((0,ft.A)(n.definition,(n=>Us(e,t,n))),(e=>void 0!==e));return 1===r.length?r[0]:0===r.length?void 0:function(e,t){const n=t.length;for(let r=0;r<n-1;r++){const n=t[r];let i;1===n.left.transitions.length&&(i=n.left.transitions[0]);const s=i instanceof Ds,a=i,o=t[r+1].left;1===n.left.type&&1===n.right.type&&void 0!==i&&(s&&a.followState===n.right||i.target===n.right)?(s?a.followState=o:i.target=o,Xs(e,n.right)):Ws(n.right,o)}const r=t[0],i=t[n-1];return{left:r.left,right:i.right}}(e,r)}function Gs(e,t,n,r,i){const s=r.left,a=r.right,o=zs(e,t,n,{type:11});Bs(e,o);const c=zs(e,t,n,{type:12});return s.loopback=o,c.loopback=o,e.decisionMap[bs(t,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=o,Ws(a,o),void 0===i?(Ws(o,s),Ws(o,c)):(Ws(o,c),Ws(o,i.left),Ws(i.right,s)),{left:s,right:c}}function Ks(e,t,n,r,i){const s=r.left,a=r.right,o=zs(e,t,n,{type:10});Bs(e,o);const c=zs(e,t,n,{type:12}),l=zs(e,t,n,{type:9});return o.loopback=l,c.loopback=l,Ws(o,s),Ws(o,c),Ws(a,l),void 0!==i?(Ws(l,c),Ws(l,i.left),Ws(i.right,s)):Ws(l,o),e.decisionMap[bs(t,i?"RepetitionWithSeparator":"Repetition",n.idx)]=o,{left:o,right:c}}function Bs(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function js(e,t,n,r,...i){const s=zs(e,t,r,{type:8,start:n});n.end=s;for(const e of i)void 0!==e?(Ws(n,e.left),Ws(e.right,s)):Ws(n,s);const a={left:n,right:s};return e.decisionMap[bs(t,function(e){if(e instanceof Xt)return"Alternation";if(e instanceof Vt)return"Option";if(e instanceof zt)return"Repetition";if(e instanceof Yt)return"RepetitionWithSeparator";if(e instanceof Ht)return"RepetitionMandatory";if(e instanceof Wt)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}(r),r.idx)]=n,a}function Vs(e,t,n,r){const i=zs(e,t,r,{type:1}),s=zs(e,t,r,{type:1});return Ys(i,new Ps(s,n)),{left:i,right:s}}function Hs(e,t,n){const r=e.ruleToStartState.get(t);Ws(r,n.left);const i=e.ruleToStopState.get(t);return Ws(n.right,i),{left:r,right:i}}function Ws(e,t){Ys(e,new Ms(t))}function zs(e,t,n,r){const i=Object.assign({atn:e,production:n,epsilonOnlyTransitions:!1,rule:t,transitions:[],nextTokenWithinRule:[],stateNumber:e.states.length},r);return e.states.push(i),i}function Ys(e,t){0===e.transitions.length&&(e.epsilonOnlyTransitions=t.isEpsilon()),e.transitions.push(t)}function Xs(e,t){e.states.splice(e.states.indexOf(t),1)}const qs={};class Qs{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const t=Js(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return(0,ft.A)(this.configs,(e=>e.alt))}get key(){let e="";for(const t in this.map)e+=t+":";return e}}function Js(e,t=!0){return`${t?`a${e.alt}`:""}s${e.state.stateNumber}:${e.stack.map((e=>e.stateNumber.toString())).join("_")}`}var Zs=n(6452);function ea(e,t){const n={};return r=>{const i=r.toString();let s=n[i];return void 0!==s||(s={atnStartState:e,decision:t,states:{}},n[i]=s),s}}class ta{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,t){this.predicates[e]=t}toString(){let e="";const t=this.predicates.length;for(let n=0;n<t;n++)e+=!0===this.predicates[n]?"1":"0";return e}}const na=new ta;class ra extends as{constructor(e){var t;super(),this.logging=null!==(t=null==e?void 0:e.logging)&&void 0!==t?t:e=>console.log(e)}initialize(e){this.atn=function(e){const t={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};!function(e,t){const n=t.length;for(let r=0;r<n;r++){const n=t[r],i=zs(e,n,void 0,{type:2}),s=zs(e,n,void 0,{type:7});i.stop=s,e.ruleToStartState.set(n,i),e.ruleToStopState.set(n,s)}}(t,e);const n=e.length;for(let r=0;r<n;r++){const n=e[r],i=Fs(t,n,n);void 0!==i&&Hs(t,n,i)}return t}(e.rules),this.dfas=function(e){const t=e.decisionStates.length,n=Array(t);for(let r=0;r<t;r++)n[r]=ea(e.decisionStates[r],r);return n}(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:t,rule:n,hasPredicates:r,dynamicTokensEnabled:i}=e,s=this.dfas,a=this.logging,o=bs(n,"Alternation",t),c=this.atn.decisionMap[o].decision,l=(0,ft.A)(Ri({maxLookahead:1,occurrence:t,prodType:"Alternation",rule:n}),(e=>(0,ft.A)(e,(e=>e[0]))));if(ia(l,!1)&&!i){const e=(0,wn.A)(l,((e,t,n)=>((0,ut.A)(t,(t=>{t&&(e[t.tokenTypeIdx]=n,(0,ut.A)(t.categoryMatches,(t=>{e[t]=n})))})),e)),{});return r?function(t){var n;const r=this.LA(1),i=e[r.tokenTypeIdx];if(void 0!==t&&void 0!==i){const e=null===(n=t[i])||void 0===n?void 0:n.GATE;if(void 0!==e&&!1===e.call(this))return}return i}:function(){const t=this.LA(1);return e[t.tokenTypeIdx]}}return r?function(e){const t=new ta,n=void 0===e?0:e.length;for(let r=0;r<n;r++){const n=null==e?void 0:e[r].GATE;t.set(r,void 0===n||n.call(this))}const r=sa.call(this,s,c,t,a);return"number"==typeof r?r:void 0}:function(){const e=sa.call(this,s,c,na,a);return"number"==typeof e?e:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:t,rule:n,prodType:r,dynamicTokensEnabled:i}=e,s=this.dfas,a=this.logging,o=bs(n,r,t),c=this.atn.decisionMap[o].decision,l=(0,ft.A)(Ri({maxLookahead:1,occurrence:t,prodType:r,rule:n}),(e=>(0,ft.A)(e,(e=>e[0]))));if(ia(l)&&l[0][0]&&!i){const e=l[0],t=(0,An.A)(e);if(1===t.length&&(0,ht.A)(t[0].categoryMatches)){const e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{const e=(0,wn.A)(t,((e,t)=>(void 0!==t&&(e[t.tokenTypeIdx]=!0,(0,ut.A)(t.categoryMatches,(t=>{e[t]=!0}))),e)),{});return function(){const t=this.LA(1);return!0===e[t.tokenTypeIdx]}}}return function(){const e=sa.call(this,s,c,na,a);return"object"!=typeof e&&0===e}}}function ia(e,t=!0){const n=new Set;for(const r of e){const e=new Set;for(const i of r){if(void 0===i){if(t)break;return!1}const r=[i.tokenTypeIdx].concat(i.categoryMatches);for(const t of r)if(n.has(t)){if(!e.has(t))return!1}else n.add(t),e.add(t)}}return!0}function sa(e,t,n,r){const i=e[t](n);let s=i.start;return void 0===s&&(s=fa(i,da(function(e){const t=new Qs,n=e.transitions.length;for(let r=0;r<n;r++)pa({state:e.transitions[r].target,alt:r,stack:[]},t);return t}(i.atnStartState))),i.start=s),aa.apply(this,[i,s,n,r])}function aa(e,t,n,r){let i=t,s=1;const a=[];let o=this.LA(s++);for(;;){let t=(c=o,i.edges[c.tokenTypeIdx]);if(void 0===t&&(t=oa.apply(this,[e,i,o,s,n,r])),t===qs)return la(a,i,o);if(!0===t.isAcceptState)return t.prediction;i=t,a.push(o),o=this.LA(s++)}var c}function oa(e,t,n,r,i,s){const a=function(e,t,n){const r=new Qs,i=[];for(const s of e.elements){if(!1===n.is(s.alt))continue;if(7===s.state.type){i.push(s);continue}const e=s.state.transitions.length;for(let n=0;n<e;n++){const e=ua(s.state.transitions[n],t);void 0!==e&&r.add({state:e,alt:s.alt,stack:s.stack})}}let s;if(0===i.length&&1===r.size&&(s=r),void 0===s){s=new Qs;for(const e of r.elements)pa(e,s)}if(i.length>0&&!function(e){for(const t of e.elements)if(7===t.state.type)return!0;return!1}(s))for(const e of i)s.add(e);return s}(t.configs,n,i);if(0===a.size)return ha(e,t,n,qs),qs;let o=da(a);const c=function(e,t){let n;for(const r of e.elements)if(!0===t.is(r.alt))if(void 0===n)n=r.alt;else if(n!==r.alt)return;return n}(a,i);if(void 0!==c)o.isAcceptState=!0,o.prediction=c,o.configs.uniqueAlt=c;else if(function(e){if(function(e){for(const t of e.elements)if(7!==t.state.type)return!1;return!0}(e))return!0;const t=function(e){const t=new Map;for(const n of e){const e=Js(n,!1);let r=t.get(e);void 0===r&&(r={},t.set(e,r)),r[n.alt]=!0}return t}(e.elements);return function(e){for(const t of Array.from(e.values()))if(Object.keys(t).length>1)return!0;return!1}(t)&&!function(e){for(const t of Array.from(e.values()))if(1===Object.keys(t).length)return!0;return!1}(t)}(a)){const t=(0,Zs.A)(a.alts);o.isAcceptState=!0,o.prediction=t,o.configs.uniqueAlt=t,ca.apply(this,[e,r,a.alts,s])}return o=ha(e,t,n,o),o}function ca(e,t,n,r){const i=[];for(let e=1;e<=t;e++)i.push(this.LA(e).tokenType);const s=e.atnStartState;r(function(e){const t=(0,ft.A)(e.prefixPath,(e=>Mr(e))).join(", "),n=0===e.production.idx?"":e.production.idx;let r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(", ")}> in <${function(e){if(e instanceof Kt)return"SUBRULE";if(e instanceof Vt)return"OPTION";if(e instanceof Xt)return"OR";if(e instanceof Ht)return"AT_LEAST_ONE";if(e instanceof Wt)return"AT_LEAST_ONE_SEP";if(e instanceof Yt)return"MANY_SEP";if(e instanceof zt)return"MANY";if(e instanceof qt)return"CONSUME";throw Error("non exhaustive match")}(e.production)}${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\n`;return r+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",r}({topLevelRule:s.rule,ambiguityIndices:n,production:s.production,prefixPath:i}))}function la(e,t,n){const r=ei(t.configs.elements,(e=>e.state.transitions));return{actualToken:n,possibleTokenTypes:(i=r.filter((e=>e instanceof Ps)).map((e=>e.tokenType)),s=e=>e.tokenTypeIdx,i&&i.length?(0,gn.A)(i,(0,wt.A)(s,2)):[]),tokenPath:e};var i,s}function ua(e,t){if(e instanceof Ps&&Xr(t,e.tokenType))return e.target}function da(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function ha(e,t,n,r){return r=fa(e,r),t.edges[n.tokenTypeIdx]=r,r}function fa(e,t){if(t===qs)return t;const n=t.configs.key,r=e.states[n];return void 0!==r?r:(t.configs.finalize(),e.states[n]=t,t)}function pa(e,t){const n=e.state;if(7===n.type){if(e.stack.length>0){const n=[...e.stack];pa({state:n.pop(),alt:e.alt,stack:n},t)}else t.add(e);return}n.epsilonOnlyTransitions||t.add(e);const r=n.transitions.length;for(let i=0;i<r;i++){const r=ma(e,n.transitions[i]);void 0!==r&&pa(r,t)}}function ma(e,t){if(t instanceof Ms)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof Ds){const n=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:n}}}var ga,ya,Aa,Ta,va,Ra,Ea,ka,xa,Ia,Sa,Na,Ca,$a,wa,La,Oa,ba,_a,Pa,Ma,Da,Ua,Fa,Ga,Ka,Ba,ja,Va,Ha,Wa,za,Ya,Xa,qa,Qa,Ja,Za,eo,to,no,ro,io,so,ao,oo,co,lo,uo,ho,fo,po,mo,go,yo,Ao,To,vo,Ro,Eo,ko,xo,Io,So,No,Co,$o,wo,Lo,Oo,bo,_o,Po,Mo,Do,Uo,Fo,Go,Ko,Bo;!function(e){e.is=function(e){return"string"==typeof e}}(ga||(ga={})),function(e){e.is=function(e){return"string"==typeof e}}(ya||(ya={})),function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647,e.is=function(t){return"number"==typeof t&&e.MIN_VALUE<=t&&t<=e.MAX_VALUE}}(Aa||(Aa={})),function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647,e.is=function(t){return"number"==typeof t&&e.MIN_VALUE<=t&&t<=e.MAX_VALUE}}(Ta||(Ta={})),function(e){e.create=function(e,t){return e===Number.MAX_VALUE&&(e=Ta.MAX_VALUE),t===Number.MAX_VALUE&&(t=Ta.MAX_VALUE),{line:e,character:t}},e.is=function(e){let t=e;return Bo.objectLiteral(t)&&Bo.uinteger(t.line)&&Bo.uinteger(t.character)}}(va||(va={})),function(e){e.create=function(e,t,n,r){if(Bo.uinteger(e)&&Bo.uinteger(t)&&Bo.uinteger(n)&&Bo.uinteger(r))return{start:va.create(e,t),end:va.create(n,r)};if(va.is(e)&&va.is(t))return{start:e,end:t};throw new Error(`Range#create called with invalid arguments[${e}, ${t}, ${n}, ${r}]`)},e.is=function(e){let t=e;return Bo.objectLiteral(t)&&va.is(t.start)&&va.is(t.end)}}(Ra||(Ra={})),function(e){e.create=function(e,t){return{uri:e,range:t}},e.is=function(e){let t=e;return Bo.objectLiteral(t)&&Ra.is(t.range)&&(Bo.string(t.uri)||Bo.undefined(t.uri))}}(Ea||(Ea={})),function(e){e.create=function(e,t,n,r){return{targetUri:e,targetRange:t,targetSelectionRange:n,originSelectionRange:r}},e.is=function(e){let t=e;return Bo.objectLiteral(t)&&Ra.is(t.targetRange)&&Bo.string(t.targetUri)&&Ra.is(t.targetSelectionRange)&&(Ra.is(t.originSelectionRange)||Bo.undefined(t.originSelectionRange))}}(ka||(ka={})),function(e){e.create=function(e,t,n,r){return{red:e,green:t,blue:n,alpha:r}},e.is=function(e){const t=e;return Bo.objectLiteral(t)&&Bo.numberRange(t.red,0,1)&&Bo.numberRange(t.green,0,1)&&Bo.numberRange(t.blue,0,1)&&Bo.numberRange(t.alpha,0,1)}}(xa||(xa={})),function(e){e.create=function(e,t){return{range:e,color:t}},e.is=function(e){const t=e;return Bo.objectLiteral(t)&&Ra.is(t.range)&&xa.is(t.color)}}(Ia||(Ia={})),function(e){e.create=function(e,t,n){return{label:e,textEdit:t,additionalTextEdits:n}},e.is=function(e){const t=e;return Bo.objectLiteral(t)&&Bo.string(t.label)&&(Bo.undefined(t.textEdit)||Pa.is(t))&&(Bo.undefined(t.additionalTextEdits)||Bo.typedArray(t.additionalTextEdits,Pa.is))}}(Sa||(Sa={})),function(e){e.Comment="comment",e.Imports="imports",e.Region="region"}(Na||(Na={})),function(e){e.create=function(e,t,n,r,i,s){const a={startLine:e,endLine:t};return Bo.defined(n)&&(a.startCharacter=n),Bo.defined(r)&&(a.endCharacter=r),Bo.defined(i)&&(a.kind=i),Bo.defined(s)&&(a.collapsedText=s),a},e.is=function(e){const t=e;return Bo.objectLiteral(t)&&Bo.uinteger(t.startLine)&&Bo.uinteger(t.startLine)&&(Bo.undefined(t.startCharacter)||Bo.uinteger(t.startCharacter))&&(Bo.undefined(t.endCharacter)||Bo.uinteger(t.endCharacter))&&(Bo.undefined(t.kind)||Bo.string(t.kind))}}(Ca||(Ca={})),function(e){e.create=function(e,t){return{location:e,message:t}},e.is=function(e){let t=e;return Bo.defined(t)&&Ea.is(t.location)&&Bo.string(t.message)}}($a||($a={})),function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4}(wa||(wa={})),function(e){e.Unnecessary=1,e.Deprecated=2}(La||(La={})),function(e){e.is=function(e){const t=e;return Bo.objectLiteral(t)&&Bo.string(t.href)}}(Oa||(Oa={})),function(e){e.create=function(e,t,n,r,i,s){let a={range:e,message:t};return Bo.defined(n)&&(a.severity=n),Bo.defined(r)&&(a.code=r),Bo.defined(i)&&(a.source=i),Bo.defined(s)&&(a.relatedInformation=s),a},e.is=function(e){var t;let n=e;return Bo.defined(n)&&Ra.is(n.range)&&Bo.string(n.message)&&(Bo.number(n.severity)||Bo.undefined(n.severity))&&(Bo.integer(n.code)||Bo.string(n.code)||Bo.undefined(n.code))&&(Bo.undefined(n.codeDescription)||Bo.string(null===(t=n.codeDescription)||void 0===t?void 0:t.href))&&(Bo.string(n.source)||Bo.undefined(n.source))&&(Bo.undefined(n.relatedInformation)||Bo.typedArray(n.relatedInformation,$a.is))}}(ba||(ba={})),function(e){e.create=function(e,t,...n){let r={title:e,command:t};return Bo.defined(n)&&n.length>0&&(r.arguments=n),r},e.is=function(e){let t=e;return Bo.defined(t)&&Bo.string(t.title)&&Bo.string(t.command)}}(_a||(_a={})),function(e){e.replace=function(e,t){return{range:e,newText:t}},e.insert=function(e,t){return{range:{start:e,end:e},newText:t}},e.del=function(e){return{range:e,newText:""}},e.is=function(e){const t=e;return Bo.objectLiteral(t)&&Bo.string(t.newText)&&Ra.is(t.range)}}(Pa||(Pa={})),function(e){e.create=function(e,t,n){const r={label:e};return void 0!==t&&(r.needsConfirmation=t),void 0!==n&&(r.description=n),r},e.is=function(e){const t=e;return Bo.objectLiteral(t)&&Bo.string(t.label)&&(Bo.boolean(t.needsConfirmation)||void 0===t.needsConfirmation)&&(Bo.string(t.description)||void 0===t.description)}}(Ma||(Ma={})),function(e){e.is=function(e){const t=e;return Bo.string(t)}}(Da||(Da={})),function(e){e.replace=function(e,t,n){return{range:e,newText:t,annotationId:n}},e.insert=function(e,t,n){return{range:{start:e,end:e},newText:t,annotationId:n}},e.del=function(e,t){return{range:e,newText:"",annotationId:t}},e.is=function(e){const t=e;return Pa.is(t)&&(Ma.is(t.annotationId)||Da.is(t.annotationId))}}(Ua||(Ua={})),function(e){e.create=function(e,t){return{textDocument:e,edits:t}},e.is=function(e){let t=e;return Bo.defined(t)&&Wa.is(t.textDocument)&&Array.isArray(t.edits)}}(Fa||(Fa={})),function(e){e.create=function(e,t,n){let r={kind:"create",uri:e};return void 0===t||void 0===t.overwrite&&void 0===t.ignoreIfExists||(r.options=t),void 0!==n&&(r.annotationId=n),r},e.is=function(e){let t=e;return t&&"create"===t.kind&&Bo.string(t.uri)&&(void 0===t.options||(void 0===t.options.overwrite||Bo.boolean(t.options.overwrite))&&(void 0===t.options.ignoreIfExists||Bo.boolean(t.options.ignoreIfExists)))&&(void 0===t.annotationId||Da.is(t.annotationId))}}(Ga||(Ga={})),function(e){e.create=function(e,t,n,r){let i={kind:"rename",oldUri:e,newUri:t};return void 0===n||void 0===n.overwrite&&void 0===n.ignoreIfExists||(i.options=n),void 0!==r&&(i.annotationId=r),i},e.is=function(e){let t=e;return t&&"rename"===t.kind&&Bo.string(t.oldUri)&&Bo.string(t.newUri)&&(void 0===t.options||(void 0===t.options.overwrite||Bo.boolean(t.options.overwrite))&&(void 0===t.options.ignoreIfExists||Bo.boolean(t.options.ignoreIfExists)))&&(void 0===t.annotationId||Da.is(t.annotationId))}}(Ka||(Ka={})),function(e){e.create=function(e,t,n){let r={kind:"delete",uri:e};return void 0===t||void 0===t.recursive&&void 0===t.ignoreIfNotExists||(r.options=t),void 0!==n&&(r.annotationId=n),r},e.is=function(e){let t=e;return t&&"delete"===t.kind&&Bo.string(t.uri)&&(void 0===t.options||(void 0===t.options.recursive||Bo.boolean(t.options.recursive))&&(void 0===t.options.ignoreIfNotExists||Bo.boolean(t.options.ignoreIfNotExists)))&&(void 0===t.annotationId||Da.is(t.annotationId))}}(Ba||(Ba={})),function(e){e.is=function(e){let t=e;return t&&(void 0!==t.changes||void 0!==t.documentChanges)&&(void 0===t.documentChanges||t.documentChanges.every((e=>Bo.string(e.kind)?Ga.is(e)||Ka.is(e)||Ba.is(e):Fa.is(e))))}}(ja||(ja={})),function(e){e.create=function(e){return{uri:e}},e.is=function(e){let t=e;return Bo.defined(t)&&Bo.string(t.uri)}}(Va||(Va={})),function(e){e.create=function(e,t){return{uri:e,version:t}},e.is=function(e){let t=e;return Bo.defined(t)&&Bo.string(t.uri)&&Bo.integer(t.version)}}(Ha||(Ha={})),function(e){e.create=function(e,t){return{uri:e,version:t}},e.is=function(e){let t=e;return Bo.defined(t)&&Bo.string(t.uri)&&(null===t.version||Bo.integer(t.version))}}(Wa||(Wa={})),function(e){e.create=function(e,t,n,r){return{uri:e,languageId:t,version:n,text:r}},e.is=function(e){let t=e;return Bo.defined(t)&&Bo.string(t.uri)&&Bo.string(t.languageId)&&Bo.integer(t.version)&&Bo.string(t.text)}}(za||(za={})),function(e){e.PlainText="plaintext",e.Markdown="markdown",e.is=function(t){const n=t;return n===e.PlainText||n===e.Markdown}}(Ya||(Ya={})),function(e){e.is=function(e){const t=e;return Bo.objectLiteral(e)&&Ya.is(t.kind)&&Bo.string(t.value)}}(Xa||(Xa={})),function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25}(qa||(qa={})),function(e){e.PlainText=1,e.Snippet=2}(Qa||(Qa={})),function(e){e.Deprecated=1}(Ja||(Ja={})),function(e){e.create=function(e,t,n){return{newText:e,insert:t,replace:n}},e.is=function(e){const t=e;return t&&Bo.string(t.newText)&&Ra.is(t.insert)&&Ra.is(t.replace)}}(Za||(Za={})),function(e){e.asIs=1,e.adjustIndentation=2}(eo||(eo={})),function(e){e.is=function(e){const t=e;return t&&(Bo.string(t.detail)||void 0===t.detail)&&(Bo.string(t.description)||void 0===t.description)}}(to||(to={})),function(e){e.create=function(e){return{label:e}}}(no||(no={})),function(e){e.create=function(e,t){return{items:e||[],isIncomplete:!!t}}}(ro||(ro={})),function(e){e.fromPlainText=function(e){return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")},e.is=function(e){const t=e;return Bo.string(t)||Bo.objectLiteral(t)&&Bo.string(t.language)&&Bo.string(t.value)}}(io||(io={})),function(e){e.is=function(e){let t=e;return!!t&&Bo.objectLiteral(t)&&(Xa.is(t.contents)||io.is(t.contents)||Bo.typedArray(t.contents,io.is))&&(void 0===e.range||Ra.is(e.range))}}(so||(so={})),function(e){e.create=function(e,t){return t?{label:e,documentation:t}:{label:e}}}(ao||(ao={})),function(e){e.create=function(e,t,...n){let r={label:e};return Bo.defined(t)&&(r.documentation=t),Bo.defined(n)?r.parameters=n:r.parameters=[],r}}(oo||(oo={})),function(e){e.Text=1,e.Read=2,e.Write=3}(co||(co={})),function(e){e.create=function(e,t){let n={range:e};return Bo.number(t)&&(n.kind=t),n}}(lo||(lo={})),function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26}(uo||(uo={})),function(e){e.Deprecated=1}(ho||(ho={})),function(e){e.create=function(e,t,n,r,i){let s={name:e,kind:t,location:{uri:r,range:n}};return i&&(s.containerName=i),s}}(fo||(fo={})),function(e){e.create=function(e,t,n,r){return void 0!==r?{name:e,kind:t,location:{uri:n,range:r}}:{name:e,kind:t,location:{uri:n}}}}(po||(po={})),function(e){e.create=function(e,t,n,r,i,s){let a={name:e,detail:t,kind:n,range:r,selectionRange:i};return void 0!==s&&(a.children=s),a},e.is=function(e){let t=e;return t&&Bo.string(t.name)&&Bo.number(t.kind)&&Ra.is(t.range)&&Ra.is(t.selectionRange)&&(void 0===t.detail||Bo.string(t.detail))&&(void 0===t.deprecated||Bo.boolean(t.deprecated))&&(void 0===t.children||Array.isArray(t.children))&&(void 0===t.tags||Array.isArray(t.tags))}}(mo||(mo={})),function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll"}(go||(go={})),function(e){e.Invoked=1,e.Automatic=2}(yo||(yo={})),function(e){e.create=function(e,t,n){let r={diagnostics:e};return null!=t&&(r.only=t),null!=n&&(r.triggerKind=n),r},e.is=function(e){let t=e;return Bo.defined(t)&&Bo.typedArray(t.diagnostics,ba.is)&&(void 0===t.only||Bo.typedArray(t.only,Bo.string))&&(void 0===t.triggerKind||t.triggerKind===yo.Invoked||t.triggerKind===yo.Automatic)}}(Ao||(Ao={})),function(e){e.create=function(e,t,n){let r={title:e},i=!0;return"string"==typeof t?(i=!1,r.kind=t):_a.is(t)?r.command=t:r.edit=t,i&&void 0!==n&&(r.kind=n),r},e.is=function(e){let t=e;return t&&Bo.string(t.title)&&(void 0===t.diagnostics||Bo.typedArray(t.diagnostics,ba.is))&&(void 0===t.kind||Bo.string(t.kind))&&(void 0!==t.edit||void 0!==t.command)&&(void 0===t.command||_a.is(t.command))&&(void 0===t.isPreferred||Bo.boolean(t.isPreferred))&&(void 0===t.edit||ja.is(t.edit))}}(To||(To={})),function(e){e.create=function(e,t){let n={range:e};return Bo.defined(t)&&(n.data=t),n},e.is=function(e){let t=e;return Bo.defined(t)&&Ra.is(t.range)&&(Bo.undefined(t.command)||_a.is(t.command))}}(vo||(vo={})),function(e){e.create=function(e,t){return{tabSize:e,insertSpaces:t}},e.is=function(e){let t=e;return Bo.defined(t)&&Bo.uinteger(t.tabSize)&&Bo.boolean(t.insertSpaces)}}(Ro||(Ro={})),function(e){e.create=function(e,t,n){return{range:e,target:t,data:n}},e.is=function(e){let t=e;return Bo.defined(t)&&Ra.is(t.range)&&(Bo.undefined(t.target)||Bo.string(t.target))}}(Eo||(Eo={})),function(e){e.create=function(e,t){return{range:e,parent:t}},e.is=function(t){let n=t;return Bo.objectLiteral(n)&&Ra.is(n.range)&&(void 0===n.parent||e.is(n.parent))}}(ko||(ko={})),function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator"}(xo||(xo={})),function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"}(Io||(Io={})),function(e){e.is=function(e){const t=e;return Bo.objectLiteral(t)&&(void 0===t.resultId||"string"==typeof t.resultId)&&Array.isArray(t.data)&&(0===t.data.length||"number"==typeof t.data[0])}}(So||(So={})),function(e){e.create=function(e,t){return{range:e,text:t}},e.is=function(e){const t=e;return null!=t&&Ra.is(t.range)&&Bo.string(t.text)}}(No||(No={})),function(e){e.create=function(e,t,n){return{range:e,variableName:t,caseSensitiveLookup:n}},e.is=function(e){const t=e;return null!=t&&Ra.is(t.range)&&Bo.boolean(t.caseSensitiveLookup)&&(Bo.string(t.variableName)||void 0===t.variableName)}}(Co||(Co={})),function(e){e.create=function(e,t){return{range:e,expression:t}},e.is=function(e){const t=e;return null!=t&&Ra.is(t.range)&&(Bo.string(t.expression)||void 0===t.expression)}}($o||($o={})),function(e){e.create=function(e,t){return{frameId:e,stoppedLocation:t}},e.is=function(e){const t=e;return Bo.defined(t)&&Ra.is(e.stoppedLocation)}}(wo||(wo={})),function(e){e.Type=1,e.Parameter=2,e.is=function(e){return 1===e||2===e}}(Lo||(Lo={})),function(e){e.create=function(e){return{value:e}},e.is=function(e){const t=e;return Bo.objectLiteral(t)&&(void 0===t.tooltip||Bo.string(t.tooltip)||Xa.is(t.tooltip))&&(void 0===t.location||Ea.is(t.location))&&(void 0===t.command||_a.is(t.command))}}(Oo||(Oo={})),function(e){e.create=function(e,t,n){const r={position:e,label:t};return void 0!==n&&(r.kind=n),r},e.is=function(e){const t=e;return Bo.objectLiteral(t)&&va.is(t.position)&&(Bo.string(t.label)||Bo.typedArray(t.label,Oo.is))&&(void 0===t.kind||Lo.is(t.kind))&&void 0===t.textEdits||Bo.typedArray(t.textEdits,Pa.is)&&(void 0===t.tooltip||Bo.string(t.tooltip)||Xa.is(t.tooltip))&&(void 0===t.paddingLeft||Bo.boolean(t.paddingLeft))&&(void 0===t.paddingRight||Bo.boolean(t.paddingRight))}}(bo||(bo={})),function(e){e.createSnippet=function(e){return{kind:"snippet",value:e}}}(_o||(_o={})),function(e){e.create=function(e,t,n,r){return{insertText:e,filterText:t,range:n,command:r}}}(Po||(Po={})),function(e){e.create=function(e){return{items:e}}}(Mo||(Mo={})),function(e){e.Invoked=0,e.Automatic=1}(Do||(Do={})),function(e){e.create=function(e,t){return{range:e,text:t}}}(Uo||(Uo={})),function(e){e.create=function(e,t){return{triggerKind:e,selectedCompletionInfo:t}}}(Fo||(Fo={})),function(e){e.is=function(e){const t=e;return Bo.objectLiteral(t)&&ya.is(t.uri)&&Bo.string(t.name)}}(Go||(Go={})),function(e){function t(e,n){if(e.length<=1)return e;const r=e.length/2|0,i=e.slice(0,r),s=e.slice(r);t(i,n),t(s,n);let a=0,o=0,c=0;for(;a<i.length&&o<s.length;){let t=n(i[a],s[o]);e[c++]=t<=0?i[a++]:s[o++]}for(;a<i.length;)e[c++]=i[a++];for(;o<s.length;)e[c++]=s[o++];return e}e.create=function(e,t,n,r){return new jo(e,t,n,r)},e.is=function(e){let t=e;return!!(Bo.defined(t)&&Bo.string(t.uri)&&(Bo.undefined(t.languageId)||Bo.string(t.languageId))&&Bo.uinteger(t.lineCount)&&Bo.func(t.getText)&&Bo.func(t.positionAt)&&Bo.func(t.offsetAt))},e.applyEdits=function(e,n){let r=e.getText(),i=t(n,((e,t)=>{let n=e.range.start.line-t.range.start.line;return 0===n?e.range.start.character-t.range.start.character:n})),s=r.length;for(let t=i.length-1;t>=0;t--){let n=i[t],a=e.offsetAt(n.range.start),o=e.offsetAt(n.range.end);if(!(o<=s))throw new Error("Overlapping edit");r=r.substring(0,a)+n.newText+r.substring(o,r.length),s=a}return r}}(Ko||(Ko={}));class jo{constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0}getLineOffsets(){if(void 0===this._lineOffsets){let e=[],t=this._content,n=!0;for(let r=0;r<t.length;r++){n&&(e.push(r),n=!1);let i=t.charAt(r);n="\r"===i||"\n"===i,"\r"===i&&r+1<t.length&&"\n"===t.charAt(r+1)&&r++}n&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,r=t.length;if(0===r)return va.create(0,e);for(;n<r;){let i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}let i=n-1;return va.create(i,e-t[i])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line],r=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,r),n)}get lineCount(){return this.getLineOffsets().length}}!function(e){const t=Object.prototype.toString;e.defined=function(e){return void 0!==e},e.undefined=function(e){return void 0===e},e.boolean=function(e){return!0===e||!1===e},e.string=function(e){return"[object String]"===t.call(e)},e.number=function(e){return"[object Number]"===t.call(e)},e.numberRange=function(e,n,r){return"[object Number]"===t.call(e)&&n<=e&&e<=r},e.integer=function(e){return"[object Number]"===t.call(e)&&-2147483648<=e&&e<=2147483647},e.uinteger=function(e){return"[object Number]"===t.call(e)&&0<=e&&e<=2147483647},e.func=function(e){return"[object Function]"===t.call(e)},e.objectLiteral=function(e){return null!==e&&"object"==typeof e},e.typedArray=function(e,t){return Array.isArray(e)&&e.every(t)}}(Bo||(Bo={}));class Vo{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new Xo(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const t=new zo;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){const n=new Wo(e.startOffset,e.image.length,T(e),e.tokenType,!1);return n.grammarSource=t,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){const t=e.container;if(t){const n=t.content.indexOf(e);n>=0&&t.content.splice(n,1)}}construct(e){const t=this.current;"string"==typeof e.$type&&(this.current.astNode=e),e.$cstNode=t;const n=this.nodeStack.pop();0===(null==n?void 0:n.content.length)&&this.removeNode(n)}addHiddenTokens(e){for(const t of e){const e=new Wo(t.startOffset,t.image.length,T(t),t.tokenType,!0);e.root=this.rootNode,this.addHiddenToken(this.rootNode,e)}}addHiddenToken(e,t){const{offset:n,end:r}=t;for(let i=0;i<e.content.length;i++){const s=e.content[i],{offset:a,end:c}=s;if(o(s)&&n>a&&r<c)return void this.addHiddenToken(s,t);if(r<=a)return void e.content.splice(i,0,t)}e.content.push(t)}}class Ho{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,t;const n="string"==typeof(null===(e=this._astNode)||void 0===e?void 0:e.$type)?this._astNode:null===(t=this.container)||void 0===t?void 0:t.astNode;if(!n)throw new Error("This node has no associated AST element");return n}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}}class Wo extends Ho{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,t,n,r,i=!1){super(),this._hidden=i,this._offset=e,this._tokenType=r,this._length=t,this._range=n}}class zo extends Ho{constructor(){super(...arguments),this.content=new Yo(this)}get children(){return this.content}get offset(){var e,t;return null!==(t=null===(e=this.firstNonHiddenNode)||void 0===e?void 0:e.offset)&&void 0!==t?t:0}get length(){return this.end-this.offset}get end(){var e,t;return null!==(t=null===(e=this.lastNonHiddenNode)||void 0===e?void 0:e.end)&&void 0!==t?t:0}get range(){const e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(void 0===this._rangeCache){const{range:n}=e,{range:r}=t;this._rangeCache={start:n.start,end:r.end.line<n.start.line?n.start:r.end}}return this._rangeCache}return{start:va.create(0,0),end:va.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 t=this.content[e];if(!t.hidden)return t}return this.content[this.content.length-1]}}class Yo extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,Yo.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,t,...n){return this.addParents(n),super.splice(e,t,...n)}addParents(e){for(const t of e)t.container=this.parent}}class Xo extends zo{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=null!=e?e:""}}const qo=Symbol("Datatype");function Qo(e){return e.$type===qo}const Jo=e=>e.endsWith("")?e:e+"";class Zo{constructor(e){this._unorderedGroups=new Map,this.lexer=e.parser.Lexer;const t=this.lexer.definition;this.wrapper=new sc(t,Object.assign(Object.assign({},e.parser.ParserConfig),{errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,t){this.wrapper.wrapOr(e,t)}optional(e,t){this.wrapper.wrapOption(e,t)}many(e,t){this.wrapper.wrapMany(e,t)}atLeastOne(e,t){this.wrapper.wrapAtLeastOne(e,t)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}}class ec extends Zo{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Vo,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,t){const n=e.fragment?void 0:tt(e)?qo:it(e),r=this.wrapper.DEFINE_RULE(Jo(e.name),this.startImplementation(n,t).bind(this));return e.entry&&(this.mainRule=r),r}parse(e){this.nodeBuilder.buildRootNode(e);const t=this.lexer.tokenize(e);this.wrapper.input=t.tokens;const n=this.mainRule.call(this.wrapper,{});return this.nodeBuilder.addHiddenTokens(t.hidden),this.unorderedGroups.clear(),{value:n,lexerErrors:t.errors,parserErrors:this.wrapper.errors}}startImplementation(e,t){return n=>{if(!this.isRecording()){const t={$type:e};this.stack.push(t),e===qo&&(t.value="")}let r;try{r=t(n)}catch(e){r=void 0}return this.isRecording()||void 0!==r||(r=this.construct()),r}}consume(e,t,n){const r=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(r)){const e=this.nodeBuilder.buildLeafNode(r,n),{assignment:t,isCrossRef:i}=this.getAssignment(n),s=this.current;if(t){const s=ae(n)?r.image:this.converter.convert(r.image,e);this.assign(t.operator,t.feature,s,e,i)}else if(Qo(s)){let t=r.image;ae(n)||(t=this.converter.convert(t,e).toString()),s.value+=t}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&"number"==typeof e.endOffset&&!isNaN(e.endOffset)}subrule(e,t,n,r){let i;this.isRecording()||(i=this.nodeBuilder.buildCompositeNode(n));const s=this.wrapper.wrapSubrule(e,t,r);!this.isRecording()&&i&&i.length>0&&this.performSubruleAssignment(s,n,i)}performSubruleAssignment(e,t,n){const{assignment:r,isCrossRef:i}=this.getAssignment(t);if(r)this.assign(r.operator,r.feature,e,n,i);else if(!r){const t=this.current;if(Qo(t))t.value+=e.toString();else if("object"==typeof e&&e){const n=e.$type,r=this.assignWithoutOverride(e,t);n&&(r.$type=n);const i=r;this.stack.pop(),this.stack.push(i)}}}action(e,t){if(!this.isRecording()){let n=this.current;if(!n.$cstNode&&t.feature&&t.operator){n=this.construct(!1);const e=n.$cstNode.feature;this.nodeBuilder.buildCompositeNode(e)}const r={$type:e};this.stack.pop(),this.stack.push(r),t.feature&&t.operator&&this.assign(t.operator,t.feature,n,n.$cstNode,!1)}}construct(e=!0){if(this.isRecording())return;const t=this.current;return function(e){for(const[t,n]of Object.entries(e))t.startsWith("$")||(Array.isArray(n)?n.forEach(((n,i)=>{r(n)&&(n.$container=e,n.$containerProperty=t,n.$containerIndex=i)})):r(n)&&(n.$container=e,n.$containerProperty=t))}(t),this.nodeBuilder.construct(t),e&&this.stack.pop(),Qo(t)?this.converter.convert(t.value,t.$cstNode):(function(e,t){const n=e.getTypeMetaData(t.$type),r=t;for(const e of n.properties)void 0!==e.defaultValue&&void 0===r[e.name]&&(r[e.name]=Ce(e.defaultValue))}(this.astReflection,t),t)}getAssignment(e){if(!this.assignmentMap.has(e)){const t=Re(e,J);this.assignmentMap.set(e,{assignment:t,isCrossRef:!!t&&te(t.terminal)})}return this.assignmentMap.get(e)}assign(e,t,n,r,i){const s=this.current;let a;switch(a=i&&"string"==typeof n?this.linker.buildReference(s,t,r,n):n,e){case"=":s[t]=a;break;case"?=":s[t]=!0;break;case"+=":Array.isArray(s[t])||(s[t]=[]),s[t].push(a)}}assignWithoutOverride(e,t){for(const[n,r]of Object.entries(t)){const t=e[n];void 0===t?e[n]=r:Array.isArray(t)&&Array.isArray(r)&&(r.push(...t),e[n]=r)}return e}get definitionErrors(){return this.wrapper.definitionErrors}}class tc{buildMismatchTokenMessage(e){return qr.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return qr.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return qr.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return qr.buildEarlyExitMessage(e)}}class nc extends tc{buildMismatchTokenMessage({expected:e,actual:t}){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 \`${t.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}}class rc extends Zo{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();const t=this.lexer.tokenize(e);return this.tokens=t.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,t){const n=this.wrapper.DEFINE_RULE(Jo(e.name),this.startImplementation(t).bind(this));return e.entry&&(this.mainRule=n),n}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{const n=this.keepStackSize();try{e(t)}finally{this.resetStackSize(n)}}}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,t,n){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,n,r){this.before(n),this.wrapper.wrapSubrule(e,t,r),this.after(n)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){const t=this.elementStack.lastIndexOf(e);t>=0&&this.elementStack.splice(t)}}get currIdx(){return this.wrapper.currIdx}}const ic={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new nc};class sc extends Os{constructor(e,t){const n=t&&"maxLookahead"in t;super(e,Object.assign(Object.assign(Object.assign({},ic),{lookaheadStrategy:n?new as({maxLookahead:t.maxLookahead}):new ra}),t))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t){return this.RULE(e,t)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t)}wrapSubrule(e,t,n){return this.subrule(e,t,{ARGS:[n]})}wrapOr(e,t){this.or(e,t)}wrapOption(e,t){this.option(e,t)}wrapMany(e,t){this.many(e,t)}wrapAtLeastOne(e,t){this.atLeastOne(e,t)}}function ac(e,t,n){return function(e,t){const n=Xe(t,!1),r=p(t.rules).filter(G).filter((e=>n.has(e)));for(const t of r){const n=Object.assign(Object.assign({},e),{consume:1,optional:1,subrule:1,many:1,or:1});n.rules.set(t.name,e.parser.rule(t,oc(n,t.definition)))}}({parser:t,tokens:n,rules:new Map,ruleNames:new Map},e),t}function oc(e,t,n=!1){let r;if(ae(t))r=function(e,t){const n=e.consume++,r=e.tokens[t.value];if(!r)throw new Error("Could not find token for keyword: "+t.value);return()=>e.parser.consume(n,r,t)}(e,t);else if(Y(t))r=function(e,t){const n=it(t);return()=>e.parser.action(n,t)}(e,t);else if(J(t))r=oc(e,t.terminal);else if(te(t))r=uc(e,t);else if(ue(t))r=function(e,t){const n=t.rule.ref;if(G(n)){const r=e.subrule++,i=t.arguments.length>0?function(e,t){const n=t.map((e=>cc(e.value)));return t=>{const r={};for(let i=0;i<n.length;i++){const s=e.parameters[i],a=n[i];r[s.name]=a(t)}return r}}(n,t.arguments):()=>({});return s=>e.parser.subrule(r,hc(e,n),t,i(s))}if(V(n)){const r=e.consume++,i=fc(e,n.name);return()=>e.parser.consume(r,i,t)}if(!n)throw new k(t.$cstNode,`Undefined rule type: ${t.$type}`);x()}(e,t);else if(q(t))r=function(e,t){if(1===t.elements.length)return oc(e,t.elements[0]);{const n=[];for(const r of t.elements){const t={ALT:oc(e,r,!0)},i=lc(r);i&&(t.GATE=cc(i)),n.push(t)}const r=e.or++;return t=>e.parser.alternatives(r,n.map((e=>{const n={ALT:()=>e.ALT(t)},r=e.GATE;return r&&(n.GATE=()=>r(t)),n})))}}(e,t);else if(ge(t))r=function(e,t){if(1===t.elements.length)return oc(e,t.elements[0]);const n=[];for(const r of t.elements){const t={ALT:oc(e,r,!0)},i=lc(r);i&&(t.GATE=cc(i)),n.push(t)}const r=e.or++,i=(e,t)=>`uGroup_${e}_${t.getRuleStack().join("-")}`,s=dc(e,lc(t),(t=>e.parser.alternatives(r,n.map(((n,s)=>{const a={ALT:()=>!0},o=e.parser;a.ALT=()=>{if(n.ALT(t),!o.isRecording()){const e=i(r,o);o.unorderedGroups.get(e)||o.unorderedGroups.set(e,[]);const t=o.unorderedGroups.get(e);void 0===(null==t?void 0:t[s])&&(t[s]=!0)}};const c=n.GATE;return a.GATE=c?()=>c(t):()=>{const e=o.unorderedGroups.get(i(r,o));return!(null==e?void 0:e[s])},a})))),"*");return t=>{s(t),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(r,e.parser))}}(e,t);else if(ie(t))r=function(e,t){const n=t.elements.map((t=>oc(e,t)));return e=>n.forEach((t=>t(e)))}(e,t);else{if(i=t,!ve.isInstance(i,ne))throw new k(t.$cstNode,`Unexpected element type: ${t.$type}`);{const n=e.consume++;r=()=>e.parser.consume(n,zr,t)}}var i;return dc(e,n?void 0:lc(t),r,t.cardinality)}function cc(e){if(t=e,ve.isInstance(t,O)){const t=cc(e.left),n=cc(e.right);return e=>t(e)||n(e)}if(function(e){return ve.isInstance(e,L)}(e)){const t=cc(e.left),n=cc(e.right);return e=>t(e)&&n(e)}if(function(e){return ve.isInstance(e,D)}(e)){const t=cc(e.value);return e=>!t(e)}if(function(e){return ve.isInstance(e,U)}(e)){const t=e.parameter.ref.name;return e=>void 0!==e&&!0===e[t]}if(function(e){return ve.isInstance(e,w)}(e)){const t=Boolean(e.true);return()=>t}var t;x()}function lc(e){if(ie(e))return e.guardCondition}function uc(e,t,n=t.terminal){if(n){if(ue(n)&&G(n.rule.ref)){const r=e.subrule++;return i=>e.parser.subrule(r,hc(e,n.rule.ref),t,i)}if(ue(n)&&V(n.rule.ref)){const r=e.consume++,i=fc(e,n.rule.ref.name);return()=>e.parser.consume(r,i,t)}if(ae(n)){const r=e.consume++,i=fc(e,n.value);return()=>e.parser.consume(r,i,t)}throw new Error("Could not build cross reference parser")}{if(!t.type.ref)throw new Error("Could not resolve reference to type: "+t.type.$refText);const n=Ze(t.type.ref),r=null==n?void 0:n.terminal;if(!r)throw new Error("Could not find name assignment for type: "+it(t.type.ref));return uc(e,t,r)}}function dc(e,t,n,r){const i=t&&cc(t);if(!r){if(i){const t=e.or++;return r=>e.parser.alternatives(t,[{ALT:()=>n(r),GATE:()=>i(r)},{ALT:ws(),GATE:()=>!i(r)}])}return n}if("*"===r){const t=e.many++;return r=>e.parser.many(t,{DEF:()=>n(r),GATE:i?()=>i(r):void 0})}if("+"===r){const t=e.many++;if(i){const r=e.or++;return s=>e.parser.alternatives(r,[{ALT:()=>e.parser.atLeastOne(t,{DEF:()=>n(s)}),GATE:()=>i(s)},{ALT:ws(),GATE:()=>!i(s)}])}return r=>e.parser.atLeastOne(t,{DEF:()=>n(r)})}if("?"===r){const t=e.optional++;return r=>e.parser.optional(t,{DEF:()=>n(r),GATE:i?()=>i(r):void 0})}x()}function hc(e,t){const n=function(e,t){if(G(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let n=t,r=n.$container,i=t.$type;for(;!G(r);)(ie(r)||q(r)||ge(r))&&(i=r.elements.indexOf(n).toString()+":"+i),n=r,r=r.$container;return i=r.name+":"+i,e.ruleNames.set(t,i),i}}(e,t),r=e.rules.get(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function fc(e,t){const n=e.tokens[t];if(!n)throw new Error(`Token "${t}" not found."`);return n}class pc{buildTokens(e,t){const n=p(Xe(e,!1)),r=this.buildTerminalTokens(n),i=this.buildKeywordTokens(n,r,t);return r.forEach((e=>{const t=e.PATTERN;"object"==typeof t&&t&&"test"in t&&ze(t)?i.unshift(e):i.push(e)})),i}buildTerminalTokens(e){return e.filter(V).filter((e=>!e.fragment)).map((e=>this.buildTerminalToken(e))).toArray()}buildTerminalToken(e){const t=st(e),n=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,r={name:e.name,PATTERN:n,LINE_BREAKS:!0};return e.hidden&&(r.GROUP=ze(t)?Pr.SKIPPED:"hidden"),r}requiresCustomPattern(e){return!!e.flags.includes("u")||!(!e.source.includes("?<=")&&!e.source.includes("?<!"))}regexPatternFunction(e){const t=new RegExp(e,e.flags+"y");return(e,n)=>(t.lastIndex=n,t.exec(e))}buildKeywordTokens(e,t,n){return e.filter(G).flatMap((e=>xe(e).filter(ae))).distinct((e=>e.value)).toArray().sort(((e,t)=>t.value.length-e.value.length)).map((e=>this.buildKeywordToken(e,t,Boolean(null==n?void 0:n.caseInsensitive))))}buildKeywordToken(e,t,n){return{name:e.value,PATTERN:this.buildKeywordPattern(e,n),LONGER_ALT:this.findLongerAlt(e,t)}}buildKeywordPattern(e,t){return t?new RegExp(function(e){return Array.prototype.map.call(e,(e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:Ye(e))).join("")}(e.value)):e.value}findLongerAlt(e,t){return t.reduce(((t,n)=>{const r=null==n?void 0:n.PATTERN;return(null==r?void 0:r.source)&&function(e,t){const n=function(e){"string"==typeof e&&(e=new RegExp(e));const t=e,n=e.source;let r=0;return new RegExp(function e(){let i,s="";function a(e){s+=n.substr(r,e),r+=e}function o(e){s+="(?:"+n.substr(r,e)+"|$)",r+=e}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":o(3);break;case"x":o(4);break;case"u":t.unicode?"{"===n[r+2]?o(n.indexOf("}",r)-r+1):o(6):o(2);break;case"p":case"P":t.unicode?o(n.indexOf("}",r)-r+1):o(2);break;case"k":o(n.indexOf(">",r)-r+1);break;default:o(2)}break;case"[":i=/\[(?:\\.|.)*?\]/g,i.lastIndex=r,i=i.exec(n)||[],o(i[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":i=/\{\d+,?\d*\}/g,i.lastIndex=r,i=i.exec(n),i?a(i[0].length):o(1);break;case"(":if("?"===n[r+1])switch(n[r+2]){case":":s+="(?:",r+=3,s+=e()+"|$)";break;case"=":s+="(?=",r+=3,s+=e()+")";break;case"!":i=r,r+=3,e(),s+=n.substr(i,r-i);break;case"<":switch(n[r+3]){case"=":case"!":i=r,r+=4,e(),s+=n.substr(i,r-i);break;default:a(n.indexOf(">",r)-r+1),s+=e()+"|$)"}}else a(1),s+=e()+"|$)";break;case")":return++r,s;default:o(1)}return s}(),e.flags)}(e),r=t.match(n);return!!r&&r[0].length>0}("^"+r.source+"$",e.value)&&t.push(n),t}),[])}}class mc{convert(e,t){let n=t.grammarSource;if(te(n)&&(n=function(e){if(e.terminal)return e.terminal;if(e.type.ref){const t=Ze(e.type.ref);return null==t?void 0:t.terminal}}(n)),ue(n)){const r=n.rule.ref;if(!r)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(r,e,t)}return e}runConverter(e,t,n){var r;switch(e.name.toUpperCase()){case"INT":return gc.convertInt(t);case"STRING":return gc.convertString(t);case"ID":return gc.convertID(t)}switch(null===(r=function(e){var t,n,r;return V(e)?null!==(n=null===(t=e.type)||void 0===t?void 0:t.name)&&void 0!==n?n:"string":tt(e)?e.name:null!==(r=rt(e))&&void 0!==r?r:e.name}(e))||void 0===r?void 0:r.toLowerCase()){case"number":return gc.convertNumber(t);case"boolean":return gc.convertBoolean(t);case"bigint":return gc.convertBigint(t);case"date":return gc.convertDate(t);default:return t}}}var gc;!function(e){function t(e){switch(e){case"b":return"\b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";case"v":return"\v";case"0":return"\0";default:return e}}e.convertString=function(e){let n="";for(let r=1;r<e.length-1;r++){const i=e.charAt(r);n+="\\"===i?t(e.charAt(++r)):i}return n},e.convertID=function(e){return"^"===e.charAt(0)?e.substring(1):e},e.convertInt=function(e){return parseInt(e)},e.convertBigint=function(e){return BigInt(e)},e.convertDate=function(e){return new Date(e)},e.convertNumber=function(e){return Number(e)},e.convertBoolean=function(e){return"true"===e.toLowerCase()}}(gc||(gc={}));var yc=n(9850);let Ac=0;const Tc=Symbol("OperationCancelled");function vc(e){return e===Tc}async function Rc(e){if(e===yc.XO.None)return;const t=Date.now();if(t-Ac>=10&&(Ac=t,await new Promise((e=>{"undefined"==typeof setImmediate?setTimeout(e,0):setImmediate(e)}))),e.isCancellationRequested)throw Tc}class Ec{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=t=>(e(t),this),this.reject=e=>(t(e),this)}))}}class kc{constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){const t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){for(const t of e)if(kc.isIncremental(t)){const e=$c(t.range),n=this.offsetAt(e.start),r=this.offsetAt(e.end);this._content=this._content.substring(0,n)+t.text+this._content.substring(r,this._content.length);const i=Math.max(e.start.line,0),s=Math.max(e.end.line,0);let a=this._lineOffsets;const o=Nc(t.text,!1,n);if(s-i===o.length)for(let e=0,t=o.length;e<t;e++)a[e+i+1]=o[e];else o.length<1e4?a.splice(i+1,s-i,...o):this._lineOffsets=a=a.slice(0,i+1).concat(o,a.slice(s+1));const c=t.text.length-(r-n);if(0!==c)for(let e=i+1+o.length,t=a.length;e<t;e++)a[e]=a[e]+c}else{if(!kc.isFull(t))throw new Error("Unknown change event received");this._content=t.text,this._lineOffsets=void 0}this._version=t}getLineOffsets(){return void 0===this._lineOffsets&&(this._lineOffsets=Nc(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);const t=this.getLineOffsets();let n=0,r=t.length;if(0===r)return{line:0,character:e};for(;n<r;){const i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}const i=n-1;return{line:i,character:(e=this.ensureBeforeEOL(e,t[i]))-t[i]}}offsetAt(e){const t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;const n=t[e.line];if(e.character<=0)return n;const r=e.line+1<t.length?t[e.line+1]:this._content.length,i=Math.min(n+e.character,r);return this.ensureBeforeEOL(i,n)}ensureBeforeEOL(e,t){for(;e>t&&Cc(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){const t=e;return null!=t&&"string"==typeof t.text&&void 0!==t.range&&(void 0===t.rangeLength||"number"==typeof t.rangeLength)}static isFull(e){const t=e;return null!=t&&"string"==typeof t.text&&void 0===t.range&&void 0===t.rangeLength}}var xc,Ic;function Sc(e,t){if(e.length<=1)return e;const n=e.length/2|0,r=e.slice(0,n),i=e.slice(n);Sc(r,t),Sc(i,t);let s=0,a=0,o=0;for(;s<r.length&&a<i.length;){const n=t(r[s],i[a]);e[o++]=n<=0?r[s++]:i[a++]}for(;s<r.length;)e[o++]=r[s++];for(;a<i.length;)e[o++]=i[a++];return e}function Nc(e,t,n=0){const r=t?[n]:[];for(let t=0;t<e.length;t++){const i=e.charCodeAt(t);Cc(i)&&(13===i&&t+1<e.length&&10===e.charCodeAt(t+1)&&t++,r.push(n+t+1))}return r}function Cc(e){return 13===e||10===e}function $c(e){const t=e.start,n=e.end;return t.line>n.line||t.line===n.line&&t.character>n.character?{start:n,end:t}:e}function wc(e){const t=$c(e.range);return t!==e.range?{newText:e.newText,range:t}:e}!function(e){e.create=function(e,t,n,r){return new kc(e,t,n,r)},e.update=function(e,t,n){if(e instanceof kc)return e.update(t,n),e;throw new Error("TextDocument.update: document must be created by TextDocument.create")},e.applyEdits=function(e,t){const n=e.getText(),r=Sc(t.map(wc),((e,t)=>{const n=e.range.start.line-t.range.start.line;return 0===n?e.range.start.character-t.range.start.character:n}));let i=0;const s=[];for(const t of r){const r=e.offsetAt(t.range.start);if(r<i)throw new Error("Overlapping edit");r>i&&s.push(n.substring(i,r)),t.newText.length&&s.push(t.newText),i=e.offsetAt(t.range.end)}return s.push(n.substr(i)),s.join("")}}(xc||(xc={})),(()=>{var e={470:e=>{function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var n,r="",i=0,s=-1,a=0,o=0;o<=e.length;++o){if(o<e.length)n=e.charCodeAt(o);else{if(47===n)break;n=47}if(47===n){if(s===o-1||1===a);else if(s!==o-1&&2===a){if(r.length<2||2!==i||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){var c=r.lastIndexOf("/");if(c!==r.length-1){-1===c?(r="",i=0):i=(r=r.slice(0,c)).length-1-r.lastIndexOf("/"),s=o,a=0;continue}}else if(2===r.length||1===r.length){r="",i=0,s=o,a=0;continue}t&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+e.slice(s+1,o):r=e.slice(s+1,o),i=o-s-1;s=o,a=0}else 46===n&&-1!==a?++a:a=-1}return r}var r={resolve:function(){for(var e,r="",i=!1,s=arguments.length-1;s>=-1&&!i;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=process.cwd()),a=e),t(a),0!==a.length&&(r=a+"/"+r,i=47===a.charCodeAt(0))}return r=n(r,!i),i?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(e){if(t(e),0===e.length)return".";var r=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!r)).length||r||(e="."),e.length>0&&i&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,n=0;n<arguments.length;++n){var i=arguments[n];t(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":r.normalize(e)},relative:function(e,n){if(t(e),t(n),e===n)return"";if((e=r.resolve(e))===(n=r.resolve(n)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var s=e.length,a=s-i,o=1;o<n.length&&47===n.charCodeAt(o);++o);for(var c=n.length-o,l=a<c?a:c,u=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(47===n.charCodeAt(o+d))return n.slice(o+d+1);if(0===d)return n.slice(o+d)}else a>l&&(47===e.charCodeAt(i+d)?u=d:0===d&&(u=0));break}var h=e.charCodeAt(i+d);if(h!==n.charCodeAt(o+d))break;47===h&&(u=d)}var f="";for(d=i+u+1;d<=s;++d)d!==s&&47!==e.charCodeAt(d)||(0===f.length?f+="..":f+="/..");return f.length>0?f+n.slice(o+u):(o+=u,47===n.charCodeAt(o)&&++o,n.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var n=e.charCodeAt(0),r=47===n,i=-1,s=!0,a=e.length-1;a>=1;--a)if(47===(n=e.charCodeAt(a))){if(!s){i=a;break}}else s=!1;return-1===i?r?"/":".":r&&1===i?"//":e.slice(0,i)},basename:function(e,n){if(void 0!==n&&"string"!=typeof n)throw new TypeError('"ext" argument must be a string');t(e);var r,i=0,s=-1,a=!0;if(void 0!==n&&n.length>0&&n.length<=e.length){if(n.length===e.length&&n===e)return"";var o=n.length-1,c=-1;for(r=e.length-1;r>=0;--r){var l=e.charCodeAt(r);if(47===l){if(!a){i=r+1;break}}else-1===c&&(a=!1,c=r+1),o>=0&&(l===n.charCodeAt(o)?-1==--o&&(s=r):(o=-1,s=c))}return i===s?s=c:-1===s&&(s=e.length),e.slice(i,s)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!a){i=r+1;break}}else-1===s&&(a=!1,s=r+1);return-1===s?"":e.slice(i,s)},extname:function(e){t(e);for(var n=-1,r=0,i=-1,s=!0,a=0,o=e.length-1;o>=0;--o){var c=e.charCodeAt(o);if(47!==c)-1===i&&(s=!1,i=o+1),46===c?-1===n?n=o:1!==a&&(a=1):-1!==n&&(a=-1);else if(!s){r=o+1;break}}return-1===n||-1===i||0===a||1===a&&n===i-1&&n===r+1?"":e.slice(n,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+r:n+"/"+r:r}(0,e)},parse:function(e){t(e);var n={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return n;var r,i=e.charCodeAt(0),s=47===i;s?(n.root="/",r=1):r=0;for(var a=-1,o=0,c=-1,l=!0,u=e.length-1,d=0;u>=r;--u)if(47!==(i=e.charCodeAt(u)))-1===c&&(l=!1,c=u+1),46===i?-1===a?a=u:1!==d&&(d=1):-1!==a&&(d=-1);else if(!l){o=u+1;break}return-1===a||-1===c||0===d||1===d&&a===c-1&&a===o+1?-1!==c&&(n.base=n.name=0===o&&s?e.slice(1,c):e.slice(o,c)):(0===o&&s?(n.name=e.slice(1,a),n.base=e.slice(1,c)):(n.name=e.slice(o,a),n.base=e.slice(o,c)),n.ext=e.slice(a,c)),o>0?n.dir=e.slice(0,o-1):s&&(n.dir="/"),n},sep:"/",delimiter:":",win32:null,posix:null};r.posix=r,e.exports=r}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{let e;if(n.r(r),n.d(r,{URI:()=>u,Utils:()=>x}),"object"==typeof process)e="win32"===process.platform;else if("object"==typeof navigator){let t=navigator.userAgent;e=t.indexOf("Windows")>=0}const t=/^\w[\w\d+.-]*$/,i=/^\//,s=/^\/\//;function a(e,n){if(!e.scheme&&n)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${e.authority}", path: "${e.path}", query: "${e.query}", fragment: "${e.fragment}"}`);if(e.scheme&&!t.test(e.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(e.path)if(e.authority){if(!i.test(e.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(s.test(e.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}const o="",c="/",l=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class u{static isUri(e){return e instanceof u||!!e&&"string"==typeof e.authority&&"string"==typeof e.fragment&&"string"==typeof e.path&&"string"==typeof e.query&&"string"==typeof e.scheme&&"string"==typeof e.fsPath&&"function"==typeof e.with&&"function"==typeof e.toString}scheme;authority;path;query;fragment;constructor(e,t,n,r,i,s=!1){"object"==typeof e?(this.scheme=e.scheme||o,this.authority=e.authority||o,this.path=e.path||o,this.query=e.query||o,this.fragment=e.fragment||o):(this.scheme=function(e,t){return e||t?e:"file"}(e,s),this.authority=t||o,this.path=function(e,t){switch(e){case"https":case"http":case"file":t?t[0]!==c&&(t=c+t):t=c}return t}(this.scheme,n||o),this.query=r||o,this.fragment=i||o,a(this,s))}get fsPath(){return g(this,!1)}with(e){if(!e)return this;let{scheme:t,authority:n,path:r,query:i,fragment:s}=e;return void 0===t?t=this.scheme:null===t&&(t=o),void 0===n?n=this.authority:null===n&&(n=o),void 0===r?r=this.path:null===r&&(r=o),void 0===i?i=this.query:null===i&&(i=o),void 0===s?s=this.fragment:null===s&&(s=o),t===this.scheme&&n===this.authority&&r===this.path&&i===this.query&&s===this.fragment?this:new h(t,n,r,i,s)}static parse(e,t=!1){const n=l.exec(e);return n?new h(n[2]||o,v(n[4]||o),v(n[5]||o),v(n[7]||o),v(n[9]||o),t):new h(o,o,o,o,o)}static file(t){let n=o;if(e&&(t=t.replace(/\\/g,c)),t[0]===c&&t[1]===c){const e=t.indexOf(c,2);-1===e?(n=t.substring(2),t=c):(n=t.substring(2,e),t=t.substring(e)||c)}return new h("file",n,t,o,o)}static from(e){const t=new h(e.scheme,e.authority,e.path,e.query,e.fragment);return a(t,!0),t}toString(e=!1){return y(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof u)return e;{const t=new h(e);return t._formatted=e.external,t._fsPath=e._sep===d?e.fsPath:null,t}}return e}}const d=e?1:void 0;class h extends u{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=g(this,!1)),this._fsPath}toString(e=!1){return e?y(this,!0):(this._formatted||(this._formatted=y(this,!1)),this._formatted)}toJSON(){const e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=d),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}}const f={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 p(e,t,n){let r,i=-1;for(let s=0;s<e.length;s++){const a=e.charCodeAt(s);if(a>=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57||45===a||46===a||95===a||126===a||t&&47===a||n&&91===a||n&&93===a||n&&58===a)-1!==i&&(r+=encodeURIComponent(e.substring(i,s)),i=-1),void 0!==r&&(r+=e.charAt(s));else{void 0===r&&(r=e.substr(0,s));const t=f[a];void 0!==t?(-1!==i&&(r+=encodeURIComponent(e.substring(i,s)),i=-1),r+=t):-1===i&&(i=s)}}return-1!==i&&(r+=encodeURIComponent(e.substring(i))),void 0!==r?r:e}function m(e){let t;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);35===r||63===r?(void 0===t&&(t=e.substr(0,n)),t+=f[r]):void 0!==t&&(t+=e[n])}return void 0!==t?t:e}function g(t,n){let r;return r=t.authority&&t.path.length>1&&"file"===t.scheme?`//${t.authority}${t.path}`:47===t.path.charCodeAt(0)&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&58===t.path.charCodeAt(2)?n?t.path.substr(1):t.path[1].toLowerCase()+t.path.substr(2):t.path,e&&(r=r.replace(/\//g,"\\")),r}function y(e,t){const n=t?m:p;let r="",{scheme:i,authority:s,path:a,query:o,fragment:l}=e;if(i&&(r+=i,r+=":"),(s||"file"===i)&&(r+=c,r+=c),s){let e=s.indexOf("@");if(-1!==e){const t=s.substr(0,e);s=s.substr(e+1),e=t.lastIndexOf(":"),-1===e?r+=n(t,!1,!1):(r+=n(t.substr(0,e),!1,!1),r+=":",r+=n(t.substr(e+1),!1,!0)),r+="@"}s=s.toLowerCase(),e=s.lastIndexOf(":"),-1===e?r+=n(s,!1,!0):(r+=n(s.substr(0,e),!1,!0),r+=s.substr(e))}if(a){if(a.length>=3&&47===a.charCodeAt(0)&&58===a.charCodeAt(2)){const e=a.charCodeAt(1);e>=65&&e<=90&&(a=`/${String.fromCharCode(e+32)}:${a.substr(3)}`)}else if(a.length>=2&&58===a.charCodeAt(1)){const e=a.charCodeAt(0);e>=65&&e<=90&&(a=`${String.fromCharCode(e+32)}:${a.substr(2)}`)}r+=n(a,!0,!1)}return o&&(r+="?",r+=n(o,!1,!1)),l&&(r+="#",r+=t?l:p(l,!1,!1)),r}function A(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substr(0,3)+A(e.substr(3)):e}}const T=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function v(e){return e.match(T)?e.replace(T,(e=>A(e))):e}var R=n(470);const E=R.posix||R,k="/";var x;!function(e){e.joinPath=function(e,...t){return e.with({path:E.join(e.path,...t)})},e.resolvePath=function(e,...t){let n=e.path,r=!1;n[0]!==k&&(n=k+n,r=!0);let i=E.resolve(n,...t);return r&&i[0]===k&&!e.authority&&(i=i.substring(1)),e.with({path:i})},e.dirname=function(e){if(0===e.path.length||e.path===k)return e;let t=E.dirname(e.path);return 1===t.length&&46===t.charCodeAt(0)&&(t=""),e.with({path:t})},e.basename=function(e){return E.basename(e.path)},e.extname=function(e){return E.extname(e.path)}}(x||(x={}))})(),Ic=r})();const{URI:Lc,Utils:Oc}=Ic;var bc,_c,Pc,Mc,Dc;!function(e){e.basename=Oc.basename,e.dirname=Oc.dirname,e.extname=Oc.extname,e.joinPath=Oc.joinPath,e.resolvePath=Oc.resolvePath,e.equals=function(e,t){return(null==e?void 0:e.toString())===(null==t?void 0:t.toString())},e.relative=function(e,t){const n="string"==typeof e?e:e.path,r="string"==typeof t?t:t.path,i=n.split("/").filter((e=>e.length>0)),s=r.split("/").filter((e=>e.length>0));let a=0;for(;a<i.length&&i[a]===s[a];a++);return"../".repeat(i.length-a)+s.slice(a).join("/")}}(bc||(bc={})),function(e){e[e.Changed=0]="Changed",e[e.Parsed=1]="Parsed",e[e.IndexedContent=2]="IndexedContent",e[e.ComputedScopes=3]="ComputedScopes",e[e.Linked=4]="Linked",e[e.IndexedReferences=5]="IndexedReferences",e[e.Validated=6]="Validated"}(_c||(_c={}));class Uc{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=yc.XO.None){const n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,t)}fromTextDocument(e,t,n){return t=null!=t?t:Lc.parse(e.uri),n?this.createAsync(t,e,n):this.create(t,e)}fromString(e,t,n){return n?this.createAsync(t,e,n):this.create(t,e)}fromModel(e,t){return this.create(t,{$model:e})}create(e,t){if("string"==typeof t){const n=this.parse(e,t);return this.createLangiumDocument(n,e,void 0,t)}if("$model"in t){const n={value:t.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}{const n=this.parse(e,t.getText());return this.createLangiumDocument(n,e,t)}}async createAsync(e,t,n){if("string"==typeof t){const r=await this.parseAsync(e,t,n);return this.createLangiumDocument(r,e,void 0,t)}{const r=await this.parseAsync(e,t.getText(),n);return this.createLangiumDocument(r,e,t)}}createLangiumDocument(e,t,n,r){let i;if(n)i={parseResult:e,uri:t,state:_c.Parsed,references:[],textDocument:n};else{const n=this.createTextDocumentGetter(t,r);i={parseResult:e,uri:t,state:_c.Parsed,references:[],get textDocument(){return n()}}}return e.value.$document=i,i}async update(e,t){var n,r;const i=null===(n=e.parseResult.value.$cstNode)||void 0===n?void 0:n.root.fullText,s=null===(r=this.textDocuments)||void 0===r?void 0:r.get(e.uri.toString()),a=s?s.getText():await this.fileSystemProvider.readFile(e.uri);if(s)Object.defineProperty(e,"textDocument",{value:s});else{const t=this.createTextDocumentGetter(e.uri,a);Object.defineProperty(e,"textDocument",{get:t})}return i!==a&&(e.parseResult=await this.parseAsync(e.uri,a,t),e.parseResult.value.$document=e),e.state=_c.Parsed,e}parse(e,t){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(t)}parseAsync(e,t,n){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(t,n)}createTextDocumentGetter(e,t){const n=this.serviceRegistry;let r;return()=>null!=r?r:r=xc.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,null!=t?t:"")}}class Fc{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory}get all(){return p(this.documentMap.values())}addDocument(e){const t=e.uri.toString();if(this.documentMap.has(t))throw new Error(`A document with the URI '${t}' is already present.`);this.documentMap.set(t,e)}getDocument(e){const t=e.toString();return this.documentMap.get(t)}async getOrCreateDocument(e,t){let n=this.getDocument(e);return n||(n=await this.langiumDocumentFactory.fromUri(e,t),this.addDocument(n),n)}createDocument(e,t,n){if(n)return this.langiumDocumentFactory.fromString(t,e,n).then((e=>(this.addDocument(e),e)));{const n=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(n),n}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){const t=e.toString(),n=this.documentMap.get(t);return n&&(n.state=_c.Changed,n.precomputedScopes=void 0,n.references=[],n.diagnostics=void 0),n}deleteDocument(e){const t=e.toString(),n=this.documentMap.get(t);return n&&(n.state=_c.Changed,this.documentMap.delete(t)),n}}class Gc{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,t=yc.XO.None){for(const n of Ie(e.parseResult.value))await Rc(t),Ne(n).forEach((t=>this.doLink(t,e)))}doLink(e,t){const n=e.reference;if(void 0===n._ref)try{const t=this.getCandidate(e);if(s(t))n._ref=t;else if(n._nodeDescription=t,this.langiumDocuments().hasDocument(t.documentUri)){const r=this.loadAstNode(t);n._ref=null!=r?r:this.createLinkingError(e,t)}}catch(t){n._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${n.$refText}': ${t}`})}t.references.push(n)}unlink(e){for(const t of e.references)delete t._ref,delete t._nodeDescription;e.references=[]}getCandidate(e){const t=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return null!=t?t:this.createLinkingError(e)}buildReference(e,t,n,i){const a=this,o={$refNode:n,$refText:i,get ref(){var n,i;if(r(this._ref))return this._ref;if("object"==typeof(i=this._nodeDescription)&&null!==i&&"string"==typeof i.name&&"string"==typeof i.type&&"string"==typeof i.path){const n=a.loadAstNode(this._nodeDescription);this._ref=null!=n?n:a.createLinkingError({reference:o,container:e,property:t},this._nodeDescription)}else if(void 0===this._ref){const r=a.getLinkedNode({reference:o,container:e,property:t});if(r.error&&Ee(e).state<_c.ComputedScopes)return;this._ref=null!==(n=r.node)&&void 0!==n?n:r.error,this._nodeDescription=r.descr}return r(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return s(this._ref)?this._ref:void 0}};return o}getLinkedNode(e){try{const t=this.getCandidate(e);if(s(t))return{error:t};const n=this.loadAstNode(t);return n?{node:n,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(t){return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${t}`})}}}loadAstNode(e){if(e.node)return e.node;const t=this.langiumDocuments().getDocument(e.documentUri);return t?this.astNodeLocator.getAstNode(t.parseResult.value,e.path):void 0}createLinkingError(e,t){const n=Ee(e.container);n.state<_c.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);const r=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${r} named '${e.reference.$refText}'.`,targetDescription:t})}}class Kc{getName(e){if(function(e){return"string"==typeof e.name}(e))return e.name}getNameNode(e){return Qe(e.$cstNode,"name")}}class Bc{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const t=function(e){var t;const n=e.astNode;for(;n===(null===(t=e.container)||void 0===t?void 0:t.astNode);){const t=Re(e.grammarSource,J);if(t)return t;e=e.container}}(e),n=e.astNode;if(t&&n){const r=n[t.feature];if(i(r))return r.ref;if(Array.isArray(r))for(const t of r)if(i(t)&&t.$refNode&&t.$refNode.offset<=e.offset&&t.$refNode.end>=e.end)return t.ref}if(n){const t=this.nameProvider.getNameNode(n);if(t&&(t===e||function(e,t){for(;e.container;)if((e=e.container)===t)return!0;return!1}(e,t)))return n}}}findDeclarationNode(e){const t=this.findDeclaration(e);if(null==t?void 0:t.$cstNode){const e=this.nameProvider.getNameNode(t);return null!=e?e:t.$cstNode}}findReferences(e,t){const n=[];if(t.includeDeclaration){const t=this.getReferenceToSelf(e);t&&n.push(t)}let r=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(r=r.filter((e=>bc.equals(e.sourceUri,t.documentUri)))),n.push(...r),p(n)}getReferenceToSelf(e){const t=this.nameProvider.getNameNode(e);if(t){const n=Ee(e),r=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:r,targetUri:n.uri,targetPath:r,segment:v(t),local:!0}}}}class jc{constructor(e){if(this.map=new Map,e)for(const[t,n]of e)this.add(t,n)}get size(){return g.sum(p(this.map.values()).map((e=>e.length)))}clear(){this.map.clear()}delete(e,t){if(void 0===t)return this.map.delete(e);{const n=this.map.get(e);if(n){const r=n.indexOf(t);if(r>=0)return 1===n.length?this.map.delete(e):n.splice(r,1),!0}return!1}}get(e){var t;return null!==(t=this.map.get(e))&&void 0!==t?t:[]}has(e,t){if(void 0===t)return this.map.has(e);{const n=this.map.get(e);return!!n&&n.indexOf(t)>=0}}add(e,t){return this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t]),this}addAll(e,t){return this.map.has(e)?this.map.get(e).push(...t):this.map.set(e,Array.from(t)),this}forEach(e){this.map.forEach(((t,n)=>t.forEach((t=>e(t,n,this)))))}[Symbol.iterator](){return this.entries().iterator()}entries(){return p(this.map.entries()).flatMap((([e,t])=>t.map((t=>[e,t]))))}keys(){return p(this.map.keys())}values(){return p(this.map.values()).flat()}entriesGroupedByKey(){return p(this.map.entries())}}class Vc{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(const[t,n]of e)this.set(t,n)}clear(){this.map.clear(),this.inverse.clear()}set(e,t){return this.map.set(e,t),this.inverse.set(t,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){const t=this.map.get(e);return void 0!==t&&(this.map.delete(e),this.inverse.delete(t),!0)}}class Hc{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,t=yc.XO.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,t)}async computeExportsForNode(e,t,n=ke,r=yc.XO.None){const i=[];this.exportNode(e,i,t);for(const s of n(e))await Rc(r),this.exportNode(s,i,t);return i}exportNode(e,t,n){const r=this.nameProvider.getName(e);r&&t.push(this.descriptions.createDescription(e,r,n))}async computeLocalScopes(e,t=yc.XO.None){const n=e.parseResult.value,r=new jc;for(const i of xe(n))await Rc(t),this.processNode(i,e,r);return r}processNode(e,t,n){const r=e.$container;if(r){const i=this.nameProvider.getName(e);i&&n.add(r,this.descriptions.createDescription(e,i,t))}}}class Wc{constructor(e,t,n){var r;this.elements=e,this.outerScope=t,this.caseInsensitive=null!==(r=null==n?void 0:n.caseInsensitive)&&void 0!==r&&r}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){return(this.caseInsensitive?this.elements.find((t=>t.name.toLowerCase()===e.toLowerCase())):this.elements.find((t=>t.name===e)))||(this.outerScope?this.outerScope.getElement(e):void 0)}}class zc{constructor(e,t,n){var r;this.elements=new Map,this.caseInsensitive=null!==(r=null==n?void 0:n.caseInsensitive)&&void 0!==r&&r;for(const t of e){const e=this.caseInsensitive?t.name.toLowerCase():t.name;this.elements.set(e,t)}this.outerScope=t}getElement(e){const t=this.caseInsensitive?e.toLowerCase():e;return this.elements.get(t)||(this.outerScope?this.outerScope.getElement(e):void 0)}getAllElements(){let e=p(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}class Yc{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 Xc extends Yc{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,t){this.throwIfDisposed(),this.cache.set(e,t)}get(e,t){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(t){const n=t();return this.cache.set(e,n),n}}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class qc extends Yc{constructor(e){super(),this.cache=new Map,this.converter=null!=e?e:e=>e}has(e,t){return this.throwIfDisposed(),this.cacheForContext(e).has(t)}set(e,t,n){this.throwIfDisposed(),this.cacheForContext(e).set(t,n)}get(e,t,n){this.throwIfDisposed();const r=this.cacheForContext(e);if(r.has(t))return r.get(t);if(n){const e=n();return r.set(t,e),e}}delete(e,t){return this.throwIfDisposed(),this.cacheForContext(e).delete(t)}clear(e){if(this.throwIfDisposed(),e){const t=this.converter(e);this.cache.delete(t)}else this.cache.clear()}cacheForContext(e){const t=this.converter(e);let n=this.cache.get(t);return n||(n=new Map,this.cache.set(t,n)),n}}class Qc extends Xc{constructor(e){super(),this.onDispose(e.workspace.DocumentBuilder.onUpdate((()=>{this.clear()})))}}class Jc{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 Qc(e.shared)}getScope(e){const t=[],n=this.reflection.getReferenceType(e),r=Ee(e.container).precomputedScopes;if(r){let i=e.container;do{const e=r.get(i);e.length>0&&t.push(p(e).filter((e=>this.reflection.isSubtype(e.type,n)))),i=i.$container}while(i)}let i=this.getGlobalScope(n,e);for(let e=t.length-1;e>=0;e--)i=this.createScope(t[e],i);return i}createScope(e,t,n){return new Wc(p(e),t,n)}createScopeForNodes(e,t,n){const r=p(e).map((e=>{const t=this.nameProvider.getName(e);if(t)return this.descriptions.createDescription(e,t)})).nonNullable();return new Wc(r,t,n)}getGlobalScope(e,t){return this.globalScopeCache.get(e,(()=>new zc(this.indexManager.allElements(e))))}}function Zc(e){return"object"==typeof e&&!!e&&("$ref"in e||"$error"in e)}class el{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,t={}){const n=null==t?void 0:t.replacer,r=(e,n)=>this.replacer(e,n,t),i=n?(e,t)=>n(e,t,r):r;try{return this.currentDocument=Ee(e),JSON.stringify(e,i,null==t?void 0:t.space)}finally{this.currentDocument=void 0}}deserialize(e,t={}){const n=JSON.parse(e);return this.linkNode(n,n,t),n}replacer(e,t,{refText:n,sourceText:s,textRegions:a,comments:o,uriConverter:c}){var l,u,d,h;if(!this.ignoreProperties.has(e)){if(i(t)){const e=t.ref,r=n?t.$refText:void 0;if(e){const n=Ee(e);let i="";return this.currentDocument&&this.currentDocument!==n&&(i=c?c(n.uri,t):n.uri.toString()),{$ref:`${i}#${this.astNodeLocator.getAstNodePath(e)}`,$refText:r}}return{$error:null!==(u=null===(l=t.error)||void 0===l?void 0:l.message)&&void 0!==u?u:"Could not resolve reference",$refText:r}}if(r(t)){let n;if(a&&(n=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},t)),e&&!t.$document||!(null==n?void 0:n.$textRegion)||(n.$textRegion.documentURI=null===(d=this.currentDocument)||void 0===d?void 0:d.uri.toString())),s&&!e&&(null!=n||(n=Object.assign({},t)),n.$sourceText=null===(h=t.$cstNode)||void 0===h?void 0:h.text),o){null!=n||(n=Object.assign({},t));const e=this.commentProvider.getComment(t);e&&(n.$comment=e.replace(/\r/g,""))}return null!=n?n:t}return t}}addAstNodeRegionWithAssignmentsTo(e){const t=e=>({offset:e.offset,end:e.end,length:e.length,range:e.range});if(e.$cstNode){const n=(e.$textRegion=t(e.$cstNode)).assignments={};return Object.keys(e).filter((e=>!e.startsWith("$"))).forEach((r=>{const i=function(e,t){return e&&t?Je(e,t,e.astNode,!0):[]}(e.$cstNode,r).map(t);0!==i.length&&(n[r]=i)})),e}}linkNode(e,t,n,i,s,a){for(const[i,s]of Object.entries(e))if(Array.isArray(s))for(let a=0;a<s.length;a++){const o=s[a];Zc(o)?s[a]=this.reviveReference(e,i,t,o,n):r(o)&&this.linkNode(o,t,n,e,i,a)}else Zc(s)?e[i]=this.reviveReference(e,i,t,s,n):r(s)&&this.linkNode(s,t,n,e,i);const o=e;o.$container=i,o.$containerProperty=s,o.$containerIndex=a}reviveReference(e,t,n,i,s){let a=i.$refText,o=i.$error;if(i.$ref){const e=this.getRefNode(n,i.$ref,s.uriConverter);if(r(e))return a||(a=this.nameProvider.getName(e)),{$refText:null!=a?a:"",ref:e};o=e}if(o){const n={$refText:null!=a?a:""};return n.error={container:e,property:t,message:o,reference:n},n}}getRefNode(e,t,n){try{const r=t.indexOf("#");if(0===r){return this.astNodeLocator.getAstNode(e,t.substring(1))||"Could not resolve path: "+t}if(r<0){const e=n?n(t):Lc.parse(t),r=this.langiumDocuments.getDocument(e);return r?r.parseResult.value:"Could not find document for URI: "+t}const i=n?n(t.substring(0,r)):Lc.parse(t.substring(0,r)),s=this.langiumDocuments.getDocument(i);if(!s)return"Could not find document for URI: "+t;if(r===t.length-1)return s.parseResult.value;return this.astNodeLocator.getAstNode(s.parseResult.value,t.substring(r+1))||"Could not resolve URI: "+t}catch(e){return String(e)}}}class tl{register(e){if(this.singleton||this.map){if(!this.map&&(this.map={},this.singleton)){for(const e of this.singleton.LanguageMetaData.fileExtensions)this.map[e]=this.singleton;this.singleton=void 0}for(const t of e.LanguageMetaData.fileExtensions)void 0!==this.map[t]&&this.map[t]!==e&&console.warn(`The file extension ${t} is used by multiple languages. It is now assigned to '${e.LanguageMetaData.languageId}'.`),this.map[t]=e}else this.singleton=e}getServices(e){if(void 0!==this.singleton)return this.singleton;if(void 0===this.map)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const t=bc.extname(e),n=this.map[t];if(!n)throw new Error(`The service registry contains no services for the extension '${t}'.`);return n}get all(){return void 0!==this.singleton?[this.singleton]:void 0!==this.map?Object.values(this.map):[]}}function nl(e){return{code:e}}!function(e){e.all=["fast","slow","built-in"]}(Pc||(Pc={}));class rl{constructor(e){this.entries=new jc,this.reflection=e.shared.AstReflection}register(e,t=this,n="fast"){if("built-in"===n)throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(const[r,i]of Object.entries(e)){const e=i;if(Array.isArray(e))for(const i of e){const e={check:this.wrapValidationException(i,t),category:n};this.addEntry(r,e)}else if("function"==typeof e){const i={check:this.wrapValidationException(e,t),category:n};this.addEntry(r,i)}}}wrapValidationException(e,t){return async(n,r,i)=>{try{await e.call(t,n,r,i)}catch(e){if(vc(e))throw e;console.error("An error occurred during validation:",e);const t=e instanceof Error?e.message:String(e);e instanceof Error&&e.stack&&console.error(e.stack),r("error","An error occurred during validation: "+t,{node:n})}}}addEntry(e,t){if("AstNode"!==e)for(const n of this.reflection.getAllSubTypes(e))this.entries.add(n,t);else this.entries.add("AstNode",t)}getChecks(e,t){let n=p(this.entries.get(e)).concat(this.entries.get("AstNode"));return t&&(n=n.filter((e=>t.includes(e.category)))),n.map((e=>e.check))}}class il{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,t={},n=yc.XO.None){const r=e.parseResult,i=[];if(await Rc(n),!t.categories||t.categories.includes("built-in")){if(this.processLexingErrors(r,i,t),t.stopAfterLexingErrors&&i.some((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.code)===Mc.LexingError})))return i;if(this.processParsingErrors(r,i,t),t.stopAfterParsingErrors&&i.some((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.code)===Mc.ParsingError})))return i;if(this.processLinkingErrors(e,i,t),t.stopAfterLinkingErrors&&i.some((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.code)===Mc.LinkingError})))return i}try{i.push(...await this.validateAst(r.value,t,n))}catch(e){if(vc(e))throw e;console.error("An error occurred during validation:",e)}return await Rc(n),i}processLexingErrors(e,t,n){for(const n of e.lexerErrors){const e={severity:al("error"),range:{start:{line:n.line-1,character:n.column-1},end:{line:n.line-1,character:n.column+n.length-1}},message:n.message,data:nl(Mc.LexingError),source:this.getSource()};t.push(e)}}processParsingErrors(e,t,n){for(const n of e.parserErrors){let e;if(isNaN(n.token.startOffset)){if("previousToken"in n){const t=n.previousToken;if(isNaN(t.startOffset)){const t={line:0,character:0};e={start:t,end:t}}else{const n={line:t.endLine-1,character:t.endColumn};e={start:n,end:n}}}}else e=T(n.token);if(e){const r={severity:al("error"),range:e,message:n.message,data:nl(Mc.ParsingError),source:this.getSource()};t.push(r)}}}processLinkingErrors(e,t,n){for(const n of e.references){const e=n.error;if(e){const n={node:e.container,property:e.property,index:e.index,data:{code:Mc.LinkingError,containerType:e.container.$type,property:e.property,refText:e.reference.$refText}};t.push(this.toDiagnostic("error",e.message,n))}}}async validateAst(e,t,n=yc.XO.None){const r=[],i=(e,t,n)=>{r.push(this.toDiagnostic(e,t,n))};return await Promise.all(Ie(e).map((async e=>{await Rc(n);const r=this.validationRegistry.getChecks(e.$type,t.categories);for(const t of r)await t(e,i,n)}))),r}toDiagnostic(e,t,n){return{message:t,range:sl(n),severity:al(e),code:n.code,codeDescription:n.codeDescription,tags:n.tags,relatedInformation:n.relatedInformation,data:n.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function sl(e){if(e.range)return e.range;let t;return"string"==typeof e.property?t=Qe(e.node.$cstNode,e.property,e.index):"string"==typeof e.keyword&&(t=function(e,t,n){if(!e)return;const r=function(e,t,n){if(e.astNode!==n)return[];if(ae(e.grammarSource)&&e.grammarSource.value===t)return[e];const r=A(e).iterator();let i;const s=[];do{if(i=r.next(),!i.done){const e=i.value;e.astNode===n?ae(e.grammarSource)&&e.grammarSource.value===t&&s.push(e):r.prune()}}while(!i.done);return s}(e,t,null==e?void 0:e.astNode);return 0!==r.length?r[n=void 0!==n?Math.max(0,Math.min(n,r.length-1)):0]:void 0}(e.node.$cstNode,e.keyword,e.index)),null!=t||(t=e.node.$cstNode),t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function al(e){switch(e){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+e)}}!function(e){e.LexingError="lexing-error",e.ParsingError="parsing-error",e.LinkingError="linking-error"}(Mc||(Mc={}));class ol{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,n=Ee(e)){null!=t||(t=this.nameProvider.getName(e));const r=this.astNodeLocator.getAstNodePath(e);if(!t)throw new Error(`Node at path ${r} has no name.`);let i;const s=()=>{var t;return null!=i?i:i=v(null!==(t=this.nameProvider.getNameNode(e))&&void 0!==t?t:e.$cstNode)};return{node:e,name:t,get nameSegment(){return s()},selectionSegment:v(e.$cstNode),type:e.$type,documentUri:n.uri,path:r}}}class cl{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=yc.XO.None){const n=[],r=e.parseResult.value;for(const e of Ie(r))await Rc(t),Ne(e).filter((e=>!s(e))).forEach((e=>{const t=this.createDescription(e);t&&n.push(t)}));return n}createDescription(e){const t=e.reference.$nodeDescription,n=e.reference.$refNode;if(!t||!n)return;const r=Ee(e.container).uri;return{sourceUri:r,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:t.documentUri,targetPath:t.path,segment:v(n),local:bc.equals(t.documentUri,r)}}}class ll{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){const t=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return t+this.segmentSeparator+n}return""}getPathSegment({$containerProperty:e,$containerIndex:t}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return void 0!==t?e+this.indexSeparator+t:e}getAstNode(e,t){return t.split(this.segmentSeparator).reduce(((e,t)=>{if(!e||0===t.length)return e;const n=t.indexOf(this.indexSeparator);if(n>0){const r=t.substring(0,n),i=parseInt(t.substring(n+1)),s=e[r];return null==s?void 0:s[i]}return e[t]}),e)}}class ul{constructor(e){this._ready=new Ec,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var t,n;this.workspaceConfig=null!==(n=null===(t=e.capabilities.workspace)||void 0===t?void 0:t.configuration)&&void 0!==n&&n}async initialized(e){if(this.workspaceConfig){if(e.register){const t=this.serviceRegistry.all;e.register({section:t.map((e=>this.toSectionName(e.LanguageMetaData.languageId)))})}if(e.fetchConfiguration){const t=this.serviceRegistry.all.map((e=>({section:this.toSectionName(e.LanguageMetaData.languageId)}))),n=await e.fetchConfiguration(t);t.forEach(((e,t)=>{this.updateSectionConfiguration(e.section,n[t])}))}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach((t=>{this.updateSectionConfiguration(t,e.settings[t])}))}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){await this.ready;const n=this.toSectionName(e);if(this.settings[n])return this.settings[n][t]}toSectionName(e){return`${e}`}}!function(e){e.create=function(e){return{dispose:async()=>await e()}}}(Dc||(Dc={}));class dl{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new jc,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=_c.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},n=yc.XO.None){var r,i;for(const n of e){const e=n.uri.toString();if(n.state===_c.Validated){if("boolean"==typeof t.validation&&t.validation)n.state=_c.IndexedReferences,n.diagnostics=void 0,this.buildState.delete(e);else if("object"==typeof t.validation){const s=this.buildState.get(e),a=null===(r=null==s?void 0:s.result)||void 0===r?void 0:r.validationChecks;if(a){const r=(null!==(i=t.validation.categories)&&void 0!==i?i:Pc.all).filter((e=>!a.includes(e)));r.length>0&&(this.buildState.set(e,{completed:!1,options:{validation:Object.assign(Object.assign({},t.validation),{categories:r})},result:s.result}),n.state=_c.IndexedReferences)}}}else this.buildState.delete(e)}this.currentState=_c.Changed,await this.emitUpdate(e.map((e=>e.uri)),[]),await this.buildDocuments(e,t,n)}async update(e,t,n=yc.XO.None){this.currentState=_c.Changed;for(const e of t)this.langiumDocuments.deleteDocument(e),this.buildState.delete(e.toString()),this.indexManager.remove(e);for(const t of e){if(!this.langiumDocuments.invalidateDocument(t)){const e=this.langiumDocumentFactory.fromModel({$type:"INVALID"},t);e.state=_c.Changed,this.langiumDocuments.addDocument(e)}this.buildState.delete(t.toString())}const r=p(e).concat(t).map((e=>e.toString())).toSet();this.langiumDocuments.all.filter((e=>!r.has(e.uri.toString())&&this.shouldRelink(e,r))).forEach((e=>{this.serviceRegistry.getServices(e.uri).references.Linker.unlink(e),e.state=Math.min(e.state,_c.ComputedScopes),e.diagnostics=void 0})),await this.emitUpdate(e,t),await Rc(n);const i=this.langiumDocuments.all.filter((e=>{var t;return e.state<_c.Linked||!(null===(t=this.buildState.get(e.uri.toString()))||void 0===t?void 0:t.completed)})).toArray();await this.buildDocuments(i,this.updateBuildOptions,n)}async emitUpdate(e,t){await Promise.all(this.updateListeners.map((n=>n(e,t))))}shouldRelink(e,t){return!!e.references.some((e=>void 0!==e.error))||this.indexManager.isAffected(e,t)}onUpdate(e){return this.updateListeners.push(e),Dc.create((()=>{const t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)}))}async buildDocuments(e,t,n){this.prepareBuild(e,t),await this.runCancelable(e,_c.Parsed,n,(e=>this.langiumDocumentFactory.update(e,n))),await this.runCancelable(e,_c.IndexedContent,n,(e=>this.indexManager.updateContent(e,n))),await this.runCancelable(e,_c.ComputedScopes,n,(async e=>{const t=this.serviceRegistry.getServices(e.uri).references.ScopeComputation;e.precomputedScopes=await t.computeLocalScopes(e,n)})),await this.runCancelable(e,_c.Linked,n,(e=>this.serviceRegistry.getServices(e.uri).references.Linker.link(e,n))),await this.runCancelable(e,_c.IndexedReferences,n,(e=>this.indexManager.updateReferences(e,n)));const r=e.filter((e=>this.shouldValidate(e)));await this.runCancelable(r,_c.Validated,n,(e=>this.validate(e,n)));for(const t of e){const e=this.buildState.get(t.uri.toString());e&&(e.completed=!0)}}prepareBuild(e,t){for(const n of e){const e=n.uri.toString(),r=this.buildState.get(e);r&&!r.completed||this.buildState.set(e,{completed:!1,options:t,result:null==r?void 0:r.result})}}async runCancelable(e,t,n,r){const i=e.filter((e=>e.state<t));for(const e of i)await Rc(n),await r(e),e.state=t;await this.notifyBuildPhase(i,t,n),this.currentState=t}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),Dc.create((()=>{this.buildPhaseListeners.delete(e,t)}))}waitUntil(e,t,n){let r;if(t&&"path"in t?r=t:n=t,null!=n||(n=yc.XO.None),r){const t=this.langiumDocuments.getDocument(r);if(t&&t.state>e)return Promise.resolve(r)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(Tc):new Promise(((t,i)=>{const s=this.onBuildPhase(e,(()=>{if(s.dispose(),a.dispose(),r){const e=this.langiumDocuments.getDocument(r);t(null==e?void 0:e.uri)}else t(void 0)})),a=n.onCancellationRequested((()=>{s.dispose(),a.dispose(),i(Tc)}))}))}async notifyBuildPhase(e,t,n){if(0===e.length)return;const r=this.buildPhaseListeners.get(t);for(const t of r)await Rc(n),await t(e,n)}shouldValidate(e){return Boolean(this.getBuildOptions(e).validation)}async validate(e,t){var n,r;const i=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,s=this.getBuildOptions(e).validation,a="object"==typeof s?s:void 0,o=await i.validateDocument(e,a,t);e.diagnostics?e.diagnostics.push(...o):e.diagnostics=o;const c=this.buildState.get(e.uri.toString());if(c){null!==(n=c.result)&&void 0!==n||(c.result={});const e=null!==(r=null==a?void 0:a.categories)&&void 0!==r?r:Pc.all;c.result.validationChecks?c.result.validationChecks.push(...e):c.result.validationChecks=[...e]}}getBuildOptions(e){var t,n;return null!==(n=null===(t=this.buildState.get(e.uri.toString()))||void 0===t?void 0:t.options)&&void 0!==n?n:{}}}class hl{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new qc,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){const n=Ee(e).uri,r=[];return this.referenceIndex.forEach((e=>{e.forEach((e=>{bc.equals(e.targetUri,n)&&e.targetPath===t&&r.push(e)}))})),p(r)}allElements(e,t){let n=p(this.symbolIndex.keys());return t&&(n=n.filter((e=>!t||t.has(e)))),n.map((t=>this.getFileDescriptions(t,e))).flat()}getFileDescriptions(e,t){var n;if(!t)return null!==(n=this.symbolIndex.get(e))&&void 0!==n?n:[];const r=this.symbolByTypeIndex.get(e,t,(()=>{var n;return(null!==(n=this.symbolIndex.get(e))&&void 0!==n?n:[]).filter((e=>this.astReflection.isSubtype(e.type,t)))}));return r}remove(e){const t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t),this.referenceIndex.delete(t)}async updateContent(e,t=yc.XO.None){const n=this.serviceRegistry.getServices(e.uri),r=await n.references.ScopeComputation.computeExports(e,t),i=e.uri.toString();this.symbolIndex.set(i,r),this.symbolByTypeIndex.clear(i)}async updateReferences(e,t=yc.XO.None){const n=this.serviceRegistry.getServices(e.uri),r=await n.workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),r)}isAffected(e,t){const n=this.referenceIndex.get(e.uri.toString());return!!n&&n.some((e=>!e.local&&t.has(e.targetUri.toString())))}}class fl{constructor(e){this.initialBuildOptions={},this._ready=new Ec,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 t;this.folders=null!==(t=e.workspaceFolders)&&void 0!==t?t:void 0}initialized(e){return this.mutex.write((e=>{var t;return this.initializeWorkspace(null!==(t=this.folders)&&void 0!==t?t:[],e)}))}async initializeWorkspace(e,t=yc.XO.None){const n=await this.performStartup(e);await Rc(t),await this.documentBuilder.build(n,this.initialBuildOptions,t)}async performStartup(e){const t=this.serviceRegistry.all.flatMap((e=>e.LanguageMetaData.fileExtensions)),n=[],r=e=>{n.push(e),this.langiumDocuments.hasDocument(e.uri)||this.langiumDocuments.addDocument(e)};return await this.loadAdditionalDocuments(e,r),await Promise.all(e.map((e=>[e,this.getRootFolder(e)])).map((async e=>this.traverseFolder(...e,t,r)))),this._ready.resolve(),n}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return Lc.parse(e.uri)}async traverseFolder(e,t,n,r){const i=await this.fileSystemProvider.readDirectory(t);await Promise.all(i.map((async t=>{if(this.includeEntry(e,t,n))if(t.isDirectory)await this.traverseFolder(e,t.uri,n,r);else if(t.isFile){const e=await this.langiumDocuments.getOrCreateDocument(t.uri);r(e)}})))}includeEntry(e,t,n){const r=bc.basename(t.uri);if(r.startsWith("."))return!1;if(t.isDirectory)return"node_modules"!==r&&"out"!==r;if(t.isFile){const e=bc.extname(t.uri);return n.includes(e)}return!1}}class pl{constructor(e){const t=e.parser.TokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(t);const n=gl(t)?Object.values(t):t;this.chevrotainLexer=new Pr(n,{positionTracking:"full"})}get definition(){return this.tokenTypes}tokenize(e){var t;const n=this.chevrotainLexer.tokenize(e);return{tokens:n.tokens,errors:n.errors,hidden:null!==(t=n.groups.hidden)&&void 0!==t?t:[]}}toTokenTypeDictionary(e){if(gl(e))return e;const t=ml(e)?Object.values(e.modes).flat():e,n={};return t.forEach((e=>n[e.name]=e)),n}}function ml(e){return e&&"modes"in e&&"defaultMode"in e}function gl(e){return!function(e){return Array.isArray(e)&&(0===e.length||"name"in e[0])}(e)&&!ml(e)}function yl(e){let t="";return t="string"==typeof e?e:e.text,t.split(je)}const Al=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,Tl=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function vl(e,t,n,r){const i=[];if(0===e.length){const e=va.create(n,r),s=va.create(n,r+t.length);i.push({type:"text",content:t,range:Ra.create(e,s)})}else{let s=0;for(const a of e){const e=a.index,o=t.substring(s,e);o.length>0&&i.push({type:"text",content:t.substring(s,e),range:Ra.create(va.create(n,s+r),va.create(n,e+r))});let c=o.length+1;const l=a[1];if(i.push({type:"inline-tag",content:l,range:Ra.create(va.create(n,s+c+r),va.create(n,s+c+l.length+r))}),c+=l.length,4===a.length){c+=a[2].length;const e=a[3];i.push({type:"text",content:e,range:Ra.create(va.create(n,s+c+r),va.create(n,s+c+e.length+r))})}else i.push({type:"text",content:"",range:Ra.create(va.create(n,s+c+r),va.create(n,s+c+r))});s=e+a[0].length}const a=t.substring(s);a.length>0&&i.push({type:"text",content:a,range:Ra.create(va.create(n,s+r),va.create(n,s+r+a.length))})}return i}const Rl=/\S/,El=/\s*$/;function kl(e,t){const n=e.substring(t).match(Rl);return n?t+n.index:e.length}function xl(e){const t=e.match(El);if(t&&"number"==typeof t.index)return t.index}function Il(e,t){const n=e.tokens[e.index];return"tag"===n.type?Cl(e,!1):"text"===n.type||"inline-tag"===n.type?Sl(e):(function(e,t){if(t){const n=new Pl("",e.range);"inlines"in t?t.inlines.push(n):t.content.inlines.push(n)}}(n,t),void e.index++)}function Sl(e){let t=e.tokens[e.index];const n=t;let r=t;const i=[];for(;t&&"break"!==t.type&&"tag"!==t.type;)i.push(Nl(e)),r=t,t=e.tokens[e.index];return new _l(i,Ra.create(n.range.start,r.range.end))}function Nl(e){return"inline-tag"===e.tokens[e.index].type?Cl(e,!0):$l(e)}function Cl(e,t){const n=e.tokens[e.index++],r=n.content.substring(1),i=e.tokens[e.index];if("text"===(null==i?void 0:i.type)){if(t){const i=$l(e);return new bl(r,new _l([i],i.range),t,Ra.create(n.range.start,i.range.end))}{const i=Sl(e);return new bl(r,i,t,Ra.create(n.range.start,i.range.end))}}{const e=n.range;return new bl(r,new _l([],e),t,e)}}function $l(e){const t=e.tokens[e.index++];return new Pl(t.content,t.range)}function wl(e){if(!e)return wl({start:"/**",end:"*/",line:"*"});const{start:t,end:n,line:r}=e;return{start:Ll(t,!0),end:Ll(n,!1),line:Ll(r,!0)}}function Ll(e,t){if("string"==typeof e||"object"==typeof e){const n="string"==typeof e?Ye(e):e.source;return t?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}return e}class Ol{constructor(e,t){this.elements=e,this.range=t}getTag(e){return this.getAllTags().find((t=>t.name===e))}getTags(e){return this.getAllTags().filter((t=>t.name===e))}getAllTags(){return this.elements.filter((e=>"name"in e))}toString(){let e="";for(const t of this.elements)if(0===e.length)e=t.toString();else{const n=t.toString();e+=Ml(e)+n}return e.trim()}toMarkdown(e){let t="";for(const n of this.elements)if(0===t.length)t=n.toMarkdown(e);else{const r=n.toMarkdown(e);t+=Ml(t)+r}return t.trim()}}class bl{constructor(e,t,n,r){this.name=e,this.content=t,this.inline=n,this.range=r}toString(){let e=`@${this.name}`;const t=this.content.toString();return 1===this.content.inlines.length?e=`${e} ${t}`:this.content.inlines.length>1&&(e=`${e}\n${t}`),this.inline?`{${e}}`:e}toMarkdown(e){var t,n;return null!==(n=null===(t=null==e?void 0:e.renderTag)||void 0===t?void 0:t.call(e,this))&&void 0!==n?n:this.toMarkdownDefault(e)}toMarkdownDefault(e){const t=this.content.toMarkdown(e);if(this.inline){const n=function(e,t,n){var r,i;if("linkplain"===e||"linkcode"===e||"link"===e){const s=t.indexOf(" ");let a=t;if(s>0){const e=kl(t,s);a=t.substring(e),t=t.substring(0,s)}("linkcode"===e||"link"===e&&"code"===n.link)&&(a=`\`${a}\``);const o=null!==(i=null===(r=n.renderLink)||void 0===r?void 0:r.call(n,t,a))&&void 0!==i?i:function(e,t){try{return Lc.parse(e,!0),`[${t}](${e})`}catch(t){return e}}(t,a);return o}}(this.name,t,null!=e?e:{});if("string"==typeof n)return n}let n="";"italic"===(null==e?void 0:e.tag)||void 0===(null==e?void 0:e.tag)?n="*":"bold"===(null==e?void 0:e.tag)?n="**":"bold-italic"===(null==e?void 0:e.tag)&&(n="***");let r=`${n}@${this.name}${n}`;return 1===this.content.inlines.length?r=`${r} — ${t}`:this.content.inlines.length>1&&(r=`${r}\n${t}`),this.inline?`{${r}}`:r}}class _l{constructor(e,t){this.inlines=e,this.range=t}toString(){let e="";for(let t=0;t<this.inlines.length;t++){const n=this.inlines[t],r=this.inlines[t+1];e+=n.toString(),r&&r.range.start.line>n.range.start.line&&(e+="\n")}return e}toMarkdown(e){let t="";for(let n=0;n<this.inlines.length;n++){const r=this.inlines[n],i=this.inlines[n+1];t+=r.toMarkdown(e),i&&i.range.start.line>r.range.start.line&&(t+="\n")}return t}}class Pl{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}}function Ml(e){return e.endsWith("\n")?"\n":"\n\n"}class Dl{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const t=this.commentProvider.getComment(e);if(t&&function(e){const t=wl(void 0),n=yl(e);if(0===n.length)return!1;const r=n[0],i=n[n.length-1],s=t.start,a=t.end;return Boolean(null==s?void 0:s.exec(r))&&Boolean(null==a?void 0:a.exec(i))}(t))return function(e,t,n){let r,i;"string"==typeof e?(i=t,r=n):(i=e.range.start,r=t),i||(i=va.create(0,0));const s=function(e){var t,n,r;const i=[];let s=e.position.line,a=e.position.character;for(let o=0;o<e.lines.length;o++){const c=0===o,l=o===e.lines.length-1;let u=e.lines[o],d=0;if(c&&e.options.start){const n=null===(t=e.options.start)||void 0===t?void 0:t.exec(u);n&&(d=n.index+n[0].length)}else{const t=null===(n=e.options.line)||void 0===n?void 0:n.exec(u);t&&(d=t.index+t[0].length)}if(l){const t=null===(r=e.options.end)||void 0===r?void 0:r.exec(u);t&&(u=u.substring(0,t.index))}if(u=u.substring(0,xl(u)),kl(u,d)>=u.length){if(i.length>0){const e=va.create(s,a);i.push({type:"break",content:"",range:Ra.create(e,e)})}}else{Al.lastIndex=d;const e=Al.exec(u);if(e){const t=e[0],n=e[1],r=va.create(s,a+d),o=va.create(s,a+d+t.length);i.push({type:"tag",content:n,range:Ra.create(r,o)}),d+=t.length,d=kl(u,d)}if(d<u.length){const e=u.substring(d),t=Array.from(e.matchAll(Tl));i.push(...vl(t,e,s,a+d))}}s++,a=0}return i.length>0&&"break"===i[i.length-1].type?i.slice(0,-1):i}({lines:yl(e),position:i,options:wl(r)});return function(e){var t,n,r,i;const s=va.create(e.position.line,e.position.character);if(0===e.tokens.length)return new Ol([],Ra.create(s,s));const a=[];for(;e.index<e.tokens.length;){const t=Il(e,a[a.length-1]);t&&a.push(t)}const o=null!==(n=null===(t=a[0])||void 0===t?void 0:t.range.start)&&void 0!==n?n:s,c=null!==(i=null===(r=a[a.length-1])||void 0===r?void 0:r.range.end)&&void 0!==i?i:s;return new Ol(a,Ra.create(o,c))}({index:0,tokens:s,position:i})}(t).toMarkdown({renderLink:(t,n)=>this.documentationLinkRenderer(e,t,n),renderTag:t=>this.documentationTagRenderer(e,t)})}documentationLinkRenderer(e,t,n){var r;const i=null!==(r=this.findNameInPrecomputedScopes(e,t))&&void 0!==r?r:this.findNameInGlobalScope(e,t);if(i&&i.nameSegment){const e=i.nameSegment.range.start.line+1,t=i.nameSegment.range.start.character+1;return`[${n}](${i.documentUri.with({fragment:`L${e},${t}`}).toString()})`}}documentationTagRenderer(e,t){}findNameInPrecomputedScopes(e,t){const n=Ee(e).precomputedScopes;if(!n)return;let r=e;do{const e=n.get(r).find((e=>e.name===t));if(e)return e;r=r.$container}while(r)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find((e=>e.name===t))}}class Ul{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var t;return function(e){return"string"==typeof e.$comment}(e)?e.$comment:null===(t=function(e,t){if(e){const n=function(e,t=!0){for(;e.container;){const n=e.container;let r=n.content.indexOf(e);for(;r>0;){r--;const e=n.content[r];if(t||!e.hidden)return e}e=n}}(e,!0);if(n&&E(n,t))return n;if(l(e))for(let n=e.content.findIndex((e=>!e.hidden))-1;n>=0;n--){const r=e.content[n];if(E(r,t))return r}}}(e.$cstNode,this.grammarConfig().multilineCommentRules))||void 0===t?void 0:t.text}}var Fl;n(2676);class Gl{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e){return Promise.resolve(this.syncParser.parse(e))}}class Kl{constructor(){this.previousTokenSource=new yc.Qi,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const t=new yc.Qi;return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,n){const r=new Ec,i={action:t,deferred:r,cancellationToken:null!=n?n:yc.XO.None};return e.push(i),this.performNextOperation(),r.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))return;e.push(...this.readQueue.splice(0,this.readQueue.length))}this.done=!1,await Promise.all(e.map((async({action:e,deferred:t,cancellationToken:n})=>{try{const r=await Promise.resolve().then((()=>e(n)));t.resolve(r)}catch(e){vc(e)?t.resolve(void 0):t.reject(e)}}))),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class Bl{constructor(e){this.grammarElementIdMap=new Vc,this.tokenTypeIdMap=new Vc,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors.map((e=>Object.assign({},e))),parserErrors:e.parserErrors.map((e=>Object.assign({},e))),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}createDehyrationContext(e){const t=new Map,n=new Map;for(const n of Ie(e))t.set(n,{});if(e.$cstNode)for(const t of A(e.$cstNode))n.set(t,{});return{astNodes:t,cstNodes:n}}dehydrateAstNode(e,t){const n=t.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,void 0!==e.$cstNode&&(n.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(const[s,a]of Object.entries(e))if(!s.startsWith("$"))if(Array.isArray(a)){const e=[];n[s]=e;for(const n of a)r(n)?e.push(this.dehydrateAstNode(n,t)):i(n)?e.push(this.dehydrateReference(n,t)):e.push(n)}else r(a)?n[s]=this.dehydrateAstNode(a,t):i(a)?n[s]=this.dehydrateReference(a,t):void 0!==a&&(n[s]=a);return n}dehydrateReference(e,t){const n={};return n.$refText=e.$refText,e.$refNode&&(n.$refNode=t.cstNodes.get(e.$refNode)),n}dehydrateCstNode(e,t){const n=t.cstNodes.get(e);return l(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=t.astNodes.get(e.astNode),o(e)?n.content=e.content.map((e=>this.dehydrateCstNode(e,t))):c(e)&&(n.tokenType=e.tokenType.name,n.offset=e.offset,n.length=e.length,n.startLine=e.range.start.line,n.startColumn=e.range.start.character,n.endLine=e.range.end.line,n.endColumn=e.range.end.character),n}hydrate(e){const t=e.value,n=this.createHydrationContext(t);return"$cstNode"in t&&this.hydrateCstNode(t.$cstNode,n),{lexerErrors:e.lexerErrors,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,n)}}createHydrationContext(e){const t=new Map,n=new Map;for(const n of Ie(e))t.set(n,{});let r;if(e.$cstNode)for(const t of A(e.$cstNode)){let e;"fullText"in t?(e=new Xo(t.fullText),r=e):"content"in t?e=new zo:"tokenType"in t&&(e=this.hydrateCstLeafNode(t)),e&&(n.set(t,e),e.root=r)}return{astNodes:t,cstNodes:n}}hydrateAstNode(e,t){const n=t.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode&&(n.$cstNode=t.cstNodes.get(e.$cstNode));for(const[s,a]of Object.entries(e))if(!s.startsWith("$"))if(Array.isArray(a)){const e=[];n[s]=e;for(const o of a)r(o)?e.push(this.setParent(this.hydrateAstNode(o,t),n)):i(o)?e.push(this.hydrateReference(o,n,s,t)):e.push(o)}else r(a)?n[s]=this.setParent(this.hydrateAstNode(a,t),n):i(a)?n[s]=this.hydrateReference(a,n,s,t):void 0!==a&&(n[s]=a);return n}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,n,r){return this.linker.buildReference(t,n,r.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,n=0){const r=t.cstNodes.get(e);if("number"==typeof e.grammarSource&&(r.grammarSource=this.getGrammarElement(e.grammarSource)),r.astNode=t.astNodes.get(e.astNode),o(r))for(const i of e.content){const e=this.hydrateCstNode(i,t,n++);r.content.push(e)}return r}hydrateCstLeafNode(e){const t=this.getTokenType(e.tokenType),n=e.offset,r=e.length,i=e.startLine,s=e.startColumn,a=e.endLine,o=e.endColumn,c=e.hidden;return new Wo(n,r,{start:{line:i,character:s},end:{line:a,character:o}},t,c)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){return 0===this.grammarElementIdMap.size&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){0===this.grammarElementIdMap.size&&this.createGrammarElementIdMap();const t=this.grammarElementIdMap.getKey(e);if(t)return t;throw new Error("Invalid grammar element id: "+e)}createGrammarElementIdMap(){let e=0;for(const n of Ie(this.grammar))t=n,ve.isInstance(t,$)&&this.grammarElementIdMap.set(n,e++);var t}}function jl(e){return{documentation:{CommentProvider:e=>new Ul(e),DocumentationProvider:e=>new Dl(e)},parser:{AsyncParser:e=>new Gl(e),GrammarConfig:e=>function(e){const t=[],n=e.Grammar;for(const e of n.rules)V(e)&&(r=e).hidden&&!st(r).test(" ")&&We(st(e))&&t.push(e.name);var r;return{multilineCommentRules:t,nameRegexp:R}}(e),LangiumParser:e=>function(e){const t=function(e){const t=e.Grammar,n=e.parser.Lexer;return ac(t,new ec(e),n.definition)}(e);return t.finalize(),t}(e),CompletionParser:e=>function(e){const t=e.Grammar,n=e.parser.Lexer,r=new rc(e);return ac(t,r,n.definition),r.finalize(),r}(e),ValueConverter:()=>new mc,TokenBuilder:()=>new pc,Lexer:e=>new pl(e),ParserErrorMessageProvider:()=>new nc},workspace:{AstNodeLocator:()=>new ll,AstNodeDescriptionProvider:e=>new ol(e),ReferenceDescriptionProvider:e=>new cl(e)},references:{Linker:e=>new Gc(e),NameProvider:()=>new Kc,ScopeProvider:e=>new Jc(e),ScopeComputation:e=>new Hc(e),References:e=>new Bc(e)},serializer:{Hydrator:e=>new Bl(e),JsonSerializer:e=>new el(e)},validation:{DocumentValidator:e=>new il(e),ValidationRegistry:e=>new rl(e)},shared:()=>e.shared}}function Vl(e){return{ServiceRegistry:()=>new tl,workspace:{LangiumDocuments:e=>new Fc(e),LangiumDocumentFactory:e=>new Uc(e),DocumentBuilder:e=>new dl(e),IndexManager:e=>new hl(e),WorkspaceManager:e=>new fl(e),FileSystemProvider:t=>e.fileSystemProvider(t),WorkspaceLock:()=>new Kl,ConfigurationProvider:e=>new ul(e)}}}function Hl(e,t,n,r,i,s,a,o,c){return zl([e,t,n,r,i,s,a,o,c].reduce(ql,{}))}!function(e){e.merge=(e,t)=>ql(ql({},e),t)}(Fl||(Fl={}));const Wl=Symbol("isProxy");function zl(e,t){const n=new Proxy({},{deleteProperty:()=>!1,get:(r,i)=>Xl(r,i,e,t||n),getOwnPropertyDescriptor:(r,i)=>(Xl(r,i,e,t||n),Object.getOwnPropertyDescriptor(r,i)),has:(t,n)=>n in e,ownKeys:()=>[...Reflect.ownKeys(e),Wl]});return n[Wl]=!0,n}const Yl=Symbol();function Xl(e,t,n,r){if(t in e){if(e[t]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:e[t]});if(e[t]===Yl)throw new Error('Cycle detected. Please make "'+String(t)+'" lazy. See https://langium.org/docs/configuration-services/#resolving-cyclic-dependencies');return e[t]}if(t in n){const i=n[t];e[t]=Yl;try{e[t]="function"==typeof i?i(r):zl(i,r)}catch(n){throw e[t]=n instanceof Error?n:void 0,n}return e[t]}}function ql(e,t){if(t)for(const[n,r]of Object.entries(t))if(void 0!==r){const t=e[n];e[n]=null!==t&&null!==r&&"object"==typeof t&&"object"==typeof r?ql(t,r):r}return e}class Ql{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const Jl={fileSystemProvider:()=>new Ql},Zl={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},eu={AstReflection:()=>new Te};function tu(e){var t;const n=function(){const e=Hl(Vl(Jl),eu),t=Hl(jl({shared:e}),Zl);return e.ServiceRegistry.register(t),t}(),r=n.serializer.JsonSerializer.deserialize(e);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,Lc.parse(`memory://${null!==(t=r.name)&&void 0!==t?t:"grammar"}.langium`)),r}},2559:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(9501);const i=function(e,t,n){for(var i=-1,s=e.length;++i<s;){var a=e[i],o=t(a);if(null!=o&&(void 0===c?o==o&&!(0,r.A)(o):n(o,c)))var c=o,l=a}return l}},6224:(e,t,n)=>{n.d(t,{A:()=>r});const r=function(e,t){return e<t}},2568:(e,t,n)=>{n.d(t,{A:()=>s});var r=n(4288),i=n(8446);const s=function(e,t){var n=-1,s=(0,i.A)(e)?Array(e.length):[];return(0,r.A)(e,(function(e,r,i){s[++n]=t(e,r,i)})),s}},5507:(e,t,n)=>{n.d(t,{A:()=>u});var r=n(6318),i=n(2851),s=n(1521),a=n(5353),o=n(3149),c=n(901);const l=function(e,t,n,r){if(!(0,o.A)(e))return e;for(var l=-1,u=(t=(0,s.A)(t,e)).length,d=u-1,h=e;null!=h&&++l<u;){var f=(0,c.A)(t[l]),p=n;if("__proto__"===f||"constructor"===f||"prototype"===f)return e;if(l!=d){var m=h[f];void 0===(p=r?r(m,f,h):void 0)&&(p=(0,o.A)(m)?m:(0,a.A)(t[l+1])?[]:{})}(0,i.A)(h,f,p),h=h[f]}return e},u=function(e,t,n){for(var i=-1,a=t.length,o={};++i<a;){var c=t[i],u=(0,r.A)(e,c);n(u,c)&&l(o,(0,s.A)(c,e),u)}return o}},53:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(4507);const i=function(e){return(0,r.A)(e,4)}},3068:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(4326),i=n(6984),s=n(6832),a=n(9999),o=Object.prototype,c=o.hasOwnProperty;const l=(0,r.A)((function(e,t){e=Object(e);var n=-1,r=t.length,l=r>2?t[2]:void 0;for(l&&(0,s.A)(t[0],t[1],l)&&(r=1);++n<r;)for(var u=t[n],d=(0,a.A)(u),h=-1,f=d.length;++h<f;){var p=d[h],m=e[p];(void 0===m||(0,i.A)(m,o[p])&&!c.call(e,p))&&(e[p]=u[p])}return e}))},473:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(6307),i=n(8446),s=n(5041);var a=n(5707),o=n(8593),c=Math.max;const l=(u=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var s=null==n?0:(0,o.A)(n);return s<0&&(s=c(i+s,0)),(0,a.A)(e,(0,r.A)(t,3),s)},function(e,t,n){var a=Object(e);if(!(0,i.A)(e)){var o=(0,r.A)(t,3);e=(0,s.A)(e),t=function(e){return o(a[e],e,a)}}var c=u(e,t,n);return c>-1?a[o?e[c]:c]:void 0});var u},4098:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(7671);const i=function(e){return null!=e&&e.length?(0,r.A)(e,1):[]}},9622:(e,t,n)=>{n.d(t,{A:()=>a});var r=Object.prototype.hasOwnProperty;const i=function(e,t){return null!=e&&r.call(e,t)};var s=n(5054);const a=function(e,t){return null!=e&&(0,s.A)(e,t,i)}},9703:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(2383),i=n(2049),s=n(3098);const a=function(e){return"string"==typeof e||!(0,i.A)(e)&&(0,s.A)(e)&&"[object String]"==(0,r.A)(e)}},6666:(e,t,n)=>{n.d(t,{A:()=>r});const r=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},4722:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(5572),i=n(6307),s=n(2568),a=n(2049);const o=function(e,t){return((0,a.A)(e)?r.A:s.A)(e,(0,i.A)(t,3))}},6452:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(2559),i=n(6224),s=n(9008);const a=function(e){return e&&e.length?(0,r.A)(e,s.A,i.A):void 0}},3631:(e,t,n)=>{n.d(t,{A:()=>f});var r=/\s/;var i=/^\s+/;const s=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&r.test(e.charAt(t)););return t}(e)+1).replace(i,""):e};var a=n(3149),o=n(9501),c=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,d=parseInt;var h=1/0;const f=function(e){return e?(e=function(e){if("number"==typeof e)return e;if((0,o.A)(e))return NaN;if((0,a.A)(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=(0,a.A)(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=s(e);var n=l.test(e);return n||u.test(e)?d(e.slice(2),n?2:8):c.test(e)?NaN:+e}(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},8593:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(3631);const i=function(e){var t=(0,r.A)(e),n=t%1;return t==t?n?t-n:t:0}}}]); |