cc-viewer 1.6.260 → 1.6.261

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/assets/App-Co-5BI9q.js +1 -0
  2. package/dist/assets/{MdxEditorPanel-Cvd3ipsr.js → MdxEditorPanel-DFNyQW6b.js} +1 -1
  3. package/dist/assets/Mobile-DwYIskc6.js +1 -0
  4. package/dist/assets/{_baseUniq-DXjKWfhk.js → _baseUniq-DGKwdzTD.js} +1 -1
  5. package/dist/assets/{arc-DsQxkW5T.js → arc-nTLBi2ib.js} +1 -1
  6. package/dist/assets/{architectureDiagram-Q4EWVU46-D24v83bq.js → architectureDiagram-Q4EWVU46-pWWvthzV.js} +1 -1
  7. package/dist/assets/{blockDiagram-DXYQGD6D-D5ezdfnY.js → blockDiagram-DXYQGD6D-CpU6v2gv.js} +1 -1
  8. package/dist/assets/{c4Diagram-AHTNJAMY-g5VhpI4X.js → c4Diagram-AHTNJAMY-zdTsx1jJ.js} +1 -1
  9. package/dist/assets/{channel-Bohj9Wcp.js → channel-Cq1UANGu.js} +1 -1
  10. package/dist/assets/{chunk-4BX2VUAB-5LFKrDPS.js → chunk-4BX2VUAB-D6w9m5kB.js} +1 -1
  11. package/dist/assets/{chunk-4TB4RGXK-B7I8vecx.js → chunk-4TB4RGXK-DjZZc11c.js} +1 -1
  12. package/dist/assets/{chunk-55IACEB6-BBIiUctL.js → chunk-55IACEB6-Cw2U09Tu.js} +1 -1
  13. package/dist/assets/{chunk-EDXVE4YY-BYpcDSKa.js → chunk-EDXVE4YY-Cv-G70H7.js} +1 -1
  14. package/dist/assets/{chunk-FMBD7UC4-Dpw6TUJP.js → chunk-FMBD7UC4-Dykxux6b.js} +1 -1
  15. package/dist/assets/{chunk-OYMX7WX6-1R1GcGjy.js → chunk-OYMX7WX6-Cn9oAaEC.js} +1 -1
  16. package/dist/assets/{chunk-QZHKN3VN-B43hQ2vS.js → chunk-QZHKN3VN-CA1IccbG.js} +1 -1
  17. package/dist/assets/{chunk-YZCP3GAM-1IZth8n2.js → chunk-YZCP3GAM-CbReBNg5.js} +1 -1
  18. package/dist/assets/classDiagram-6PBFFD2Q-PgwmelQQ.js +1 -0
  19. package/dist/assets/classDiagram-v2-HSJHXN6E-PgwmelQQ.js +1 -0
  20. package/dist/assets/clone-Dnu1HdEX.js +1 -0
  21. package/dist/assets/{cose-bilkent-S5V4N54A-D05nug0R.js → cose-bilkent-S5V4N54A-TwxpCIwM.js} +1 -1
  22. package/dist/assets/{dagre-KV5264BT-DZ9d_ZUE.js → dagre-KV5264BT-CxuHKd9a.js} +1 -1
  23. package/dist/assets/{diagram-5BDNPKRD-DdyX_gXl.js → diagram-5BDNPKRD-BzR9Peib.js} +1 -1
  24. package/dist/assets/{diagram-G4DWMVQ6-cjq8tNSZ.js → diagram-G4DWMVQ6-PWFXrQqF.js} +1 -1
  25. package/dist/assets/{diagram-MMDJMWI5-NiKFms6e.js → diagram-MMDJMWI5-CqnrwtNB.js} +1 -1
  26. package/dist/assets/{diagram-TYMM5635-Dpig5X9-.js → diagram-TYMM5635-Do2MhBCf.js} +1 -1
  27. package/dist/assets/{erDiagram-SMLLAGMA-D2sWo3Zv.js → erDiagram-SMLLAGMA-CklZI6kO.js} +1 -1
  28. package/dist/assets/{flowDiagram-DWJPFMVM-D85Dj_yq.js → flowDiagram-DWJPFMVM-C_SKJN0d.js} +1 -1
  29. package/dist/assets/{ganttDiagram-T4ZO3ILL-DxAjpfgn.js → ganttDiagram-T4ZO3ILL-ChhhqFiR.js} +1 -1
  30. package/dist/assets/{gitGraphDiagram-UUTBAWPF-BO9g8cL0.js → gitGraphDiagram-UUTBAWPF-HarEJVSI.js} +1 -1
  31. package/dist/assets/{graph-BfcDIvNk.js → graph-BTcI3kpi.js} +1 -1
  32. package/dist/assets/{index-PkTBRWSU.js → index-B0NtFDg2.js} +1 -1
  33. package/dist/assets/{index-Bxmjxqf5.js → index-B7-pqPyp.js} +1 -1
  34. package/dist/assets/{index-CGqcaIdp.js → index-BG6Hzhck.js} +1 -1
  35. package/dist/assets/{index-BEpSzlsR.js → index-Bzp41aRh.js} +1 -1
  36. package/dist/assets/index-C6MrFmhs.js +2 -0
  37. package/dist/assets/{index-BJjKgolB.js → index-CF0YP7s8.js} +1 -1
  38. package/dist/assets/{index-9sv7BDJr.js → index-CQ579eP2.js} +1 -1
  39. package/dist/assets/{index-sVTuiL15.css → index-Dzkxj8m_.css} +1 -1
  40. package/dist/assets/{index-7d_JTozZ.js → index-NNx0667m.js} +1 -1
  41. package/dist/assets/{infoDiagram-42DDH7IO-BnOW3PpN.js → infoDiagram-42DDH7IO-DOcCtSEj.js} +1 -1
  42. package/dist/assets/{ishikawaDiagram-UXIWVN3A-BdRWHTx5.js → ishikawaDiagram-UXIWVN3A-Crb_pmG4.js} +1 -1
  43. package/dist/assets/{journeyDiagram-VCZTEJTY-6-pOxb-c.js → journeyDiagram-VCZTEJTY-BUv2Exj_.js} +1 -1
  44. package/dist/assets/{jszip.min-DKP-m-LG.js → jszip.min-BuZCDHia.js} +1 -1
  45. package/dist/assets/{kanban-definition-6JOO6SKY-BBX4NlcN.js → kanban-definition-6JOO6SKY-DwSHz9oV.js} +1 -1
  46. package/dist/assets/{layout-DtQNOuH0.js → layout-Dp3N3WRT.js} +1 -1
  47. package/dist/assets/{linear-6Y3OZ7u2.js → linear-JU5ltHCp.js} +1 -1
  48. package/dist/assets/{mermaid.core-CAsnLdlL.js → mermaid.core-f1mZHh7u.js} +2 -2
  49. package/dist/assets/{min-BRPZJLHh.js → min-CDzial6q.js} +1 -1
  50. package/dist/assets/{mindmap-definition-QFDTVHPH-BkmfcnFE.js → mindmap-definition-QFDTVHPH-DnhPHplB.js} +1 -1
  51. package/dist/assets/{pieDiagram-DEJITSTG-D4a_1EvH.js → pieDiagram-DEJITSTG-dMhPj5wG.js} +1 -1
  52. package/dist/assets/{quadrantDiagram-34T5L4WZ-kKniISLU.js → quadrantDiagram-34T5L4WZ-GCi1_zHo.js} +1 -1
  53. package/dist/assets/{requirementDiagram-MS252O5E-DPikXO53.js → requirementDiagram-MS252O5E-WeErs64x.js} +1 -1
  54. package/dist/assets/{sankeyDiagram-XADWPNL6--rY8uDK7.js → sankeyDiagram-XADWPNL6-BKpP6-8Q.js} +1 -1
  55. package/dist/assets/seqResourceLoaders-80G7f5Kr.js +2 -0
  56. package/dist/assets/seqResourceLoaders-B8CyM6Ul.css +41 -0
  57. package/dist/assets/{sequenceDiagram-FGHM5R23-C57z6bd_.js → sequenceDiagram-FGHM5R23-CAC5BKbx.js} +1 -1
  58. package/dist/assets/{stateDiagram-FHFEXIEX-D7q_cBTL.js → stateDiagram-FHFEXIEX-Cxrg604Z.js} +1 -1
  59. package/dist/assets/{stateDiagram-v2-QKLJ7IA2-Co3EU6Nf.js → stateDiagram-v2-QKLJ7IA2-DaUpf340.js} +1 -1
  60. package/dist/assets/{timeline-definition-GMOUNBTQ-DBV-lv69.js → timeline-definition-GMOUNBTQ-DbvXGDTU.js} +1 -1
  61. package/dist/assets/{vendor-antd-BeN8xqGk.js → vendor-antd-jGWxgt_-.js} +1 -1
  62. package/dist/assets/{vendor-codemirror-2nbmPewy.js → vendor-codemirror-9gysGjWj.js} +1 -1
  63. package/dist/assets/{vendor-mdxeditor-C7DYEBoH.js → vendor-mdxeditor-BFiCaYAL.js} +2 -2
  64. package/dist/assets/{vendor-qrcode-BFV_3WPO.js → vendor-qrcode-DjZ-VpGR.js} +1 -1
  65. package/dist/assets/{vendor-virtuoso-COKXGpsa.js → vendor-virtuoso-DB1J9xKG.js} +1 -1
  66. package/dist/assets/{vennDiagram-DHZGUBPP-ngWDn_ip.js → vennDiagram-DHZGUBPP-BoIw-nWl.js} +1 -1
  67. package/dist/assets/{wardley-RL74JXVD-BhMXVlU_.js → wardley-RL74JXVD-4PjirsHP.js} +1 -1
  68. package/dist/assets/{wardleyDiagram-NUSXRM2D-lpdygHK-.js → wardleyDiagram-NUSXRM2D-C8RzJmfU.js} +1 -1
  69. package/dist/assets/{xychartDiagram-5P7HB3ND-DVafENtB.js → xychartDiagram-5P7HB3ND-Ct6fDXwq.js} +1 -1
  70. package/dist/index.html +5 -5
  71. package/package.json +1 -1
  72. package/dist/assets/App-xdyZgq1g.js +0 -1
  73. package/dist/assets/Mobile-CGyoUWJ6.js +0 -1
  74. package/dist/assets/ProxyModal-Dj1EpOBQ.js +0 -2
  75. package/dist/assets/ProxyModal-DzTu4uGE.css +0 -41
  76. package/dist/assets/classDiagram-6PBFFD2Q-BBoAxatM.js +0 -1
  77. package/dist/assets/classDiagram-v2-HSJHXN6E-BBoAxatM.js +0 -1
  78. package/dist/assets/clone-Cc7ofJ6W.js +0 -1
  79. package/dist/assets/index-CPyk72gd.js +0 -2
@@ -1 +1 @@
1
- var _a,_b,_c,_d,_f,_g,_h,_i,_j,_k,_l,_m,_n,_o,_p,_q,_r,_s,_t,__defProp=Object.defineProperty,__publicField=(obj,key,value)=>((obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value)(obj,"symbol"!=typeof key?key+"":key,value);import{_ as __vitePreload}from"./vendor-mdxeditor-C7DYEBoH.js";import{m as map,f as flatten,d as min}from"./min-BRPZJLHh.js";import{b as baseFlatten,l as baseUniq,c as baseIteratee,m as filter,r as reduce,n as forEach}from"./_baseUniq-DXjKWfhk.js";import{b9 as isEmpty}from"./mermaid.core-CAsnLdlL.js";import{a9 as getAugmentedNamespace}from"./vendor-antd-BeN8xqGk.js";function isAstNode(obj){return"object"==typeof obj&&null!==obj&&"string"==typeof obj.$type}function isReference(obj){return"object"==typeof obj&&null!==obj&&"string"==typeof obj.$refText&&"ref"in obj}function isMultiReference(obj){return"object"==typeof obj&&null!==obj&&"string"==typeof obj.$refText&&"items"in obj}function isLinkingError(obj){return"object"==typeof obj&&null!==obj&&"object"==typeof obj.info&&"string"==typeof obj.message}class AbstractAstReflection{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(refInfo){var _a2;const metaData=this.types[refInfo.container.$type];if(!metaData)throw new Error(`Type ${refInfo.container.$type||"undefined"} not found.`);const referenceType=null==(_a2=metaData.properties[refInfo.property])?void 0:_a2.referenceType;if(!referenceType)throw new Error(`Property ${refInfo.property||"undefined"} of type ${refInfo.container.$type} is not a reference.`);return referenceType}getTypeMetaData(type){const result=this.types[type];return result||{name:type,properties:{},superTypes:[]}}isInstance(node,type){return isAstNode(node)&&this.isSubtype(node.$type,type)}isSubtype(subtype,supertype){if(subtype===supertype)return!0;let nested=this.subtypes[subtype];nested||(nested=this.subtypes[subtype]={});const existing=nested[supertype];if(void 0!==existing)return existing;{const metaData=this.types[subtype],result=!!metaData&&metaData.superTypes.some(s=>this.isSubtype(s,supertype));return nested[supertype]=result,result}}getAllSubTypes(type){const existing=this.allSubtypes[type];if(existing)return existing;{const allTypes=this.getAllTypes(),types=[];for(const possibleSubType of allTypes)this.isSubtype(possibleSubType,type)&&types.push(possibleSubType);return this.allSubtypes[type]=types,types}}}function isCompositeCstNode(node){return"object"==typeof node&&null!==node&&Array.isArray(node.content)}function isLeafCstNode(node){return"object"==typeof node&&null!==node&&"object"==typeof node.tokenType}function isRootCstNode(node){return isCompositeCstNode(node)&&"string"==typeof node.fullText}class StreamImpl{constructor(startFn,nextFn){this.startFn=startFn,this.nextFn=nextFn}iterator(){const iterator={state:this.startFn(),next:()=>this.nextFn(iterator.state),[Symbol.iterator]:()=>iterator};return iterator}[Symbol.iterator](){return this.iterator()}isEmpty(){const iterator=this.iterator();return Boolean(iterator.next().done)}count(){const iterator=this.iterator();let count=0,next=iterator.next();for(;!next.done;)count++,next=iterator.next();return count}toArray(){const result=[],iterator=this.iterator();let next;do{next=iterator.next(),void 0!==next.value&&result.push(next.value)}while(!next.done);return result}toSet(){return new Set(this)}toMap(keyFn,valueFn){const entryStream=this.map(element=>[keyFn?keyFn(element):element,valueFn?valueFn(element):element]);return new Map(entryStream)}toString(){return this.join()}concat(other){return new StreamImpl(()=>({first:this.startFn(),firstDone:!1,iterator:other[Symbol.iterator]()}),state=>{let result;if(!state.firstDone){do{if(result=this.nextFn(state.first),!result.done)return result}while(!result.done);state.firstDone=!0}do{if(result=state.iterator.next(),!result.done)return result}while(!result.done);return DONE_RESULT})}join(separator=","){const iterator=this.iterator();let result,value="",addSeparator=!1;do{result=iterator.next(),result.done||(addSeparator&&(value+=separator),value+=toString(result.value)),addSeparator=!0}while(!result.done);return value}indexOf(searchElement,fromIndex=0){const iterator=this.iterator();let index=0,next=iterator.next();for(;!next.done;){if(index>=fromIndex&&next.value===searchElement)return index;next=iterator.next(),index++}return-1}every(predicate){const iterator=this.iterator();let next=iterator.next();for(;!next.done;){if(!predicate(next.value))return!1;next=iterator.next()}return!0}some(predicate){const iterator=this.iterator();let next=iterator.next();for(;!next.done;){if(predicate(next.value))return!0;next=iterator.next()}return!1}forEach(callbackfn){const iterator=this.iterator();let index=0,next=iterator.next();for(;!next.done;)callbackfn(next.value,index),next=iterator.next(),index++}map(callbackfn){return new StreamImpl(this.startFn,state=>{const{done:done,value:value}=this.nextFn(state);return done?DONE_RESULT:{done:!1,value:callbackfn(value)}})}filter(predicate){return new StreamImpl(this.startFn,state=>{let result;do{if(result=this.nextFn(state),!result.done&&predicate(result.value))return result}while(!result.done);return DONE_RESULT})}nonNullable(){return this.filter(e=>null!=e)}reduce(callbackfn,initialValue){const iterator=this.iterator();let previousValue=initialValue,next=iterator.next();for(;!next.done;)previousValue=void 0===previousValue?next.value:callbackfn(previousValue,next.value),next=iterator.next();return previousValue}reduceRight(callbackfn,initialValue){return this.recursiveReduce(this.iterator(),callbackfn,initialValue)}recursiveReduce(iterator,callbackfn,initialValue){const next=iterator.next();if(next.done)return initialValue;const previousValue=this.recursiveReduce(iterator,callbackfn,initialValue);return void 0===previousValue?next.value:callbackfn(previousValue,next.value)}find(predicate){const iterator=this.iterator();let next=iterator.next();for(;!next.done;){if(predicate(next.value))return next.value;next=iterator.next()}}findIndex(predicate){const iterator=this.iterator();let index=0,next=iterator.next();for(;!next.done;){if(predicate(next.value))return index;next=iterator.next(),index++}return-1}includes(searchElement){const iterator=this.iterator();let next=iterator.next();for(;!next.done;){if(next.value===searchElement)return!0;next=iterator.next()}return!1}flatMap(callbackfn){return new StreamImpl(()=>({this:this.startFn()}),state=>{do{if(state.iterator){const next=state.iterator.next();if(!next.done)return next;state.iterator=void 0}const{done:done,value:value}=this.nextFn(state.this);if(!done){const mapped=callbackfn(value);if(!isIterable(mapped))return{done:!1,value:mapped};state.iterator=mapped[Symbol.iterator]()}}while(state.iterator);return DONE_RESULT})}flat(depth){if(void 0===depth&&(depth=1),depth<=0)return this;const stream2=depth>1?this.flat(depth-1):this;return new StreamImpl(()=>({this:stream2.startFn()}),state=>{do{if(state.iterator){const next=state.iterator.next();if(!next.done)return next;state.iterator=void 0}const{done:done,value:value}=stream2.nextFn(state.this);if(!done){if(!isIterable(value))return{done:!1,value:value};state.iterator=value[Symbol.iterator]()}}while(state.iterator);return DONE_RESULT})}head(){const result=this.iterator().next();if(!result.done)return result.value}tail(skipCount=1){return new StreamImpl(()=>{const state=this.startFn();for(let i=0;i<skipCount;i++){if(this.nextFn(state).done)return state}return state},this.nextFn)}limit(maxSize){return new StreamImpl(()=>({size:0,state:this.startFn()}),state=>(state.size++,state.size>maxSize?DONE_RESULT:this.nextFn(state.state)))}distinct(by){return new StreamImpl(()=>({set:new Set,internalState:this.startFn()}),state=>{let result;do{if(result=this.nextFn(state.internalState),!result.done){const value=by?by(result.value):result.value;if(!state.set.has(value))return state.set.add(value),result}}while(!result.done);return DONE_RESULT})}exclude(other,key){const otherKeySet=new Set;for(const item of other){const value=key?key(item):item;otherKeySet.add(value)}return this.filter(e=>{const ownKey=key?key(e):e;return!otherKeySet.has(ownKey)})}}function toString(item){return"string"==typeof item?item:void 0===item?"undefined":"function"==typeof item.toString?item.toString():Object.prototype.toString.call(item)}function isIterable(obj){return!!obj&&"function"==typeof obj[Symbol.iterator]}const EMPTY_STREAM=new StreamImpl(()=>{},()=>DONE_RESULT),DONE_RESULT=Object.freeze({done:!0,value:void 0});function stream(...collections){if(1===collections.length){const collection=collections[0];if(collection instanceof StreamImpl)return collection;if(isIterable(collection))return new StreamImpl(()=>collection[Symbol.iterator](),iterator=>iterator.next());if("number"==typeof collection.length)return new StreamImpl(()=>({index:0}),state=>state.index<collection.length?{done:!1,value:collection[state.index++]}:DONE_RESULT)}return collections.length>1?new StreamImpl(()=>({collIndex:0,arrIndex:0}),state=>{do{if(state.iterator){const next=state.iterator.next();if(!next.done)return next;state.iterator=void 0}if(state.array){if(state.arrIndex<state.array.length)return{done:!1,value:state.array[state.arrIndex++]};state.array=void 0,state.arrIndex=0}if(state.collIndex<collections.length){const collection=collections[state.collIndex++];isIterable(collection)?state.iterator=collection[Symbol.iterator]():collection&&"number"==typeof collection.length&&(state.array=collection)}}while(state.iterator||state.array||state.collIndex<collections.length);return DONE_RESULT}):EMPTY_STREAM}class TreeStreamImpl extends StreamImpl{constructor(root,children,options){super(()=>({iterators:(null==options?void 0:options.includeRoot)?[[root][Symbol.iterator]()]:[children(root)[Symbol.iterator]()],pruned:!1}),state=>{for(state.pruned&&(state.iterators.pop(),state.pruned=!1);state.iterators.length>0;){const next=state.iterators[state.iterators.length-1].next();if(!next.done)return state.iterators.push(children(next.value)[Symbol.iterator]()),next;state.iterators.pop()}return DONE_RESULT})}iterator(){const iterator={state:this.startFn(),next:()=>this.nextFn(iterator.state),prune:()=>{iterator.state.pruned=!0},[Symbol.iterator]:()=>iterator};return iterator}}var Reduction,Reduction2;function linkContentToContainer(node,options={}){for(const[name,value]of Object.entries(node))name.startsWith("$")||(Array.isArray(value)?value.forEach((item,index)=>{isAstNode(item)&&(item.$container=node,item.$containerProperty=name,item.$containerIndex=index,options.deep&&linkContentToContainer(item,options))}):isAstNode(value)&&(value.$container=node,value.$containerProperty=name,options.deep&&linkContentToContainer(value,options)))}function getContainerOfType(node,typePredicate){let item=node;for(;item;){if(typePredicate(item))return item;item=item.$container}}function getDocument(node){const result=findRootNode(node).$document;if(!result)throw new Error("AST node has no document.");return result}function findRootNode(node){for(;node.$container;)node=node.$container;return node}function getReferenceNodes(reference){return isReference(reference)?reference.ref?[reference.ref]:[]:isMultiReference(reference)?reference.items.map(item=>item.ref):[]}function streamContents(node,options){if(!node)throw new Error("Node must be an AstNode.");const range=null==options?void 0:options.range;return new StreamImpl(()=>({keys:Object.keys(node),keyIndex:0,arrayIndex:0}),state=>{for(;state.keyIndex<state.keys.length;){const property=state.keys[state.keyIndex];if(!property.startsWith("$")){const value=node[property];if(isAstNode(value)){if(state.keyIndex++,isAstNodeInRange(value,range))return{done:!1,value:value}}else if(Array.isArray(value)){for(;state.arrayIndex<value.length;){const element=value[state.arrayIndex++];if(isAstNode(element)&&isAstNodeInRange(element,range))return{done:!1,value:element}}state.arrayIndex=0}}state.keyIndex++}return DONE_RESULT})}function streamAllContents(root,options){if(!root)throw new Error("Root node must be an AstNode.");return new TreeStreamImpl(root,node=>streamContents(node,options))}function streamAst(root,options){if(!root)throw new Error("Root node must be an AstNode.");return new TreeStreamImpl(root,node=>streamContents(node,options),{includeRoot:!0})}function isAstNodeInRange(astNode,range){var _a2;if(!range)return!0;const nodeRange=null==(_a2=astNode.$cstNode)?void 0:_a2.range;return!!nodeRange&&function(range,to){const comparison=function(range,to){if(range.end.line<to.start.line||range.end.line===to.start.line&&range.end.character<=to.start.character)return RangeComparison.Before;if(range.start.line>to.end.line||range.start.line===to.end.line&&range.start.character>=to.end.character)return RangeComparison.After;const startInside=range.start.line>to.start.line||range.start.line===to.start.line&&range.start.character>=to.start.character,endInside=range.end.line<to.end.line||range.end.line===to.end.line&&range.end.character<=to.end.character;return startInside&&endInside?RangeComparison.Inside:startInside?RangeComparison.OverlapBack:endInside?RangeComparison.OverlapFront:RangeComparison.Outside}(range,to);return comparison>RangeComparison.After}(nodeRange,range)}function streamReferences(node){return new StreamImpl(()=>({keys:Object.keys(node),keyIndex:0,arrayIndex:0}),state=>{for(;state.keyIndex<state.keys.length;){const property=state.keys[state.keyIndex];if(!property.startsWith("$")){const value=node[property];if(isReference(value)||isMultiReference(value))return state.keyIndex++,{done:!1,value:{reference:value,container:node,property:property}};if(Array.isArray(value)){for(;state.arrayIndex<value.length;){const index=state.arrayIndex++,element=value[index];if(isReference(element)||isMultiReference(value))return{done:!1,value:{reference:element,container:node,property:property,index:index}}}state.arrayIndex=0}}state.keyIndex++}return DONE_RESULT})}function copyDefaultValue(propertyType){return Array.isArray(propertyType)?[...propertyType.map(copyDefaultValue)]:propertyType}(Reduction2=Reduction||(Reduction={})).sum=function(stream2){return stream2.reduce((a,b)=>a+b,0)},Reduction2.product=function(stream2){return stream2.reduce((a,b)=>a*b,0)},Reduction2.min=function(stream2){return stream2.reduce((a,b)=>Math.min(a,b))},Reduction2.max=function(stream2){return stream2.reduce((a,b)=>Math.max(a,b))};const AbstractElement_$type="AbstractElement",AbstractElement_cardinality="cardinality";function isAbstractElement(item){return reflection$1.isInstance(item,AbstractElement_$type)}const AbstractParserRule_$type="AbstractParserRule";function isAbstractParserRule(item){return reflection$1.isInstance(item,AbstractParserRule_$type)}const AbstractRule_$type="AbstractRule",AbstractType_$type="AbstractType",Action_$type="Action",Action_cardinality="cardinality",Action_feature="feature",Action_inferredType="inferredType",Action_operator="operator",Action_type="type";function isAction(item){return reflection$1.isInstance(item,Action_$type)}const Alternatives_$type="Alternatives",Alternatives_cardinality="cardinality",Alternatives_elements="elements";function isAlternatives(item){return reflection$1.isInstance(item,Alternatives_$type)}const ArrayLiteral_$type="ArrayLiteral",ArrayLiteral_elements="elements",ArrayType_$type="ArrayType",ArrayType_elementType="elementType",Assignment_$type="Assignment",Assignment_cardinality="cardinality",Assignment_feature="feature",Assignment_operator="operator",Assignment_predicate="predicate",Assignment_terminal="terminal";function isAssignment(item){return reflection$1.isInstance(item,Assignment_$type)}const BooleanLiteral_$type="BooleanLiteral",BooleanLiteral_true="true";const CharacterRange_$type="CharacterRange",CharacterRange_cardinality="cardinality",CharacterRange_left="left",CharacterRange_lookahead="lookahead",CharacterRange_parenthesized="parenthesized",CharacterRange_right="right";const Condition_$type="Condition",Conjunction_$type="Conjunction",Conjunction_left="left",Conjunction_right="right";const CrossReference_$type="CrossReference",CrossReference_cardinality="cardinality",CrossReference_deprecatedSyntax="deprecatedSyntax",CrossReference_isMulti="isMulti",CrossReference_terminal="terminal",CrossReference_type="type";function isCrossReference(item){return reflection$1.isInstance(item,CrossReference_$type)}const Disjunction_$type="Disjunction",Disjunction_left="left",Disjunction_right="right";const EndOfFile_$type="EndOfFile",EndOfFile_cardinality="cardinality";const Grammar_$type="Grammar",Grammar_imports="imports",Grammar_interfaces="interfaces",Grammar_isDeclared="isDeclared",Grammar_name="name",Grammar_rules="rules",Grammar_types="types",GrammarImport_$type="GrammarImport",GrammarImport_path="path",Group$1_$type="Group",Group$1_cardinality="cardinality",Group$1_elements="elements",Group$1_guardCondition="guardCondition",Group$1_predicate="predicate";function isGroup(item){return reflection$1.isInstance(item,Group$1_$type)}const InferredType_$type="InferredType",InferredType_name="name";function isInferredType(item){return reflection$1.isInstance(item,InferredType_$type)}const InfixRule_$type="InfixRule",InfixRule_call="call",InfixRule_dataType="dataType",InfixRule_inferredType="inferredType",InfixRule_name="name",InfixRule_operators="operators",InfixRule_parameters="parameters",InfixRule_returnType="returnType";function isInfixRule(item){return reflection$1.isInstance(item,InfixRule_$type)}const InfixRuleOperatorList_$type="InfixRuleOperatorList",InfixRuleOperatorList_associativity="associativity",InfixRuleOperatorList_operators="operators",InfixRuleOperators_$type="InfixRuleOperators",InfixRuleOperators_precedences="precedences",Interface_$type="Interface",Interface_attributes="attributes",Interface_name="name",Interface_superTypes="superTypes";const Keyword_$type="Keyword",Keyword_cardinality="cardinality",Keyword_predicate="predicate",Keyword_value="value";function isKeyword(item){return reflection$1.isInstance(item,Keyword_$type)}const NamedArgument_$type="NamedArgument",NamedArgument_calledByName="calledByName",NamedArgument_parameter="parameter",NamedArgument_value="value",NegatedToken_$type="NegatedToken",NegatedToken_cardinality="cardinality",NegatedToken_lookahead="lookahead",NegatedToken_parenthesized="parenthesized",NegatedToken_terminal="terminal";const Negation_$type="Negation",Negation_value="value";const NumberLiteral_$type="NumberLiteral",NumberLiteral_value="value",Parameter_$type="Parameter",Parameter_name="name",ParameterReference_$type="ParameterReference",ParameterReference_parameter="parameter";const ParserRule_$type="ParserRule",ParserRule_dataType="dataType",ParserRule_definition="definition",ParserRule_entry="entry",ParserRule_fragment="fragment",ParserRule_inferredType="inferredType",ParserRule_name="name",ParserRule_parameters="parameters",ParserRule_returnType="returnType";function isParserRule(item){return reflection$1.isInstance(item,ParserRule_$type)}const ReferenceType_$type="ReferenceType",ReferenceType_isMulti="isMulti",ReferenceType_referenceType="referenceType",RegexToken_$type="RegexToken",RegexToken_cardinality="cardinality",RegexToken_lookahead="lookahead",RegexToken_parenthesized="parenthesized",RegexToken_regex="regex";const ReturnType_$type="ReturnType",ReturnType_name="name";const RuleCall_$type="RuleCall",RuleCall_arguments="arguments",RuleCall_cardinality="cardinality",RuleCall_predicate="predicate",RuleCall_rule="rule";function isRuleCall(item){return reflection$1.isInstance(item,RuleCall_$type)}const SimpleType_$type="SimpleType",SimpleType_primitiveType="primitiveType",SimpleType_stringType="stringType",SimpleType_typeRef="typeRef";function isSimpleType(item){return reflection$1.isInstance(item,SimpleType_$type)}const StringLiteral_$type="StringLiteral",StringLiteral_value="value",TerminalAlternatives_$type="TerminalAlternatives",TerminalAlternatives_cardinality="cardinality",TerminalAlternatives_elements="elements",TerminalAlternatives_lookahead="lookahead",TerminalAlternatives_parenthesized="parenthesized";const TerminalElement_$type="TerminalElement",TerminalElement_cardinality="cardinality",TerminalElement_lookahead="lookahead",TerminalElement_parenthesized="parenthesized",TerminalGroup_$type="TerminalGroup",TerminalGroup_cardinality="cardinality",TerminalGroup_elements="elements",TerminalGroup_lookahead="lookahead",TerminalGroup_parenthesized="parenthesized";const TerminalRule_$type="TerminalRule",TerminalRule_definition="definition",TerminalRule_fragment="fragment",TerminalRule_hidden="hidden",TerminalRule_name="name",TerminalRule_type="type";function isTerminalRule(item){return reflection$1.isInstance(item,TerminalRule_$type)}const TerminalRuleCall_$type="TerminalRuleCall",TerminalRuleCall_cardinality="cardinality",TerminalRuleCall_lookahead="lookahead",TerminalRuleCall_parenthesized="parenthesized",TerminalRuleCall_rule="rule";const Type_$type="Type",Type_name="name",Type_type="type";const TypeAttribute_$type="TypeAttribute",TypeAttribute_defaultValue="defaultValue",TypeAttribute_isOptional="isOptional",TypeAttribute_name="name",TypeAttribute_type="type",TypeDefinition_$type="TypeDefinition",UnionType_$type="UnionType",UnionType_types="types",UnorderedGroup_$type="UnorderedGroup",UnorderedGroup_cardinality="cardinality",UnorderedGroup_elements="elements";function isUnorderedGroup(item){return reflection$1.isInstance(item,UnorderedGroup_$type)}const UntilToken_$type="UntilToken",UntilToken_cardinality="cardinality",UntilToken_lookahead="lookahead",UntilToken_parenthesized="parenthesized",UntilToken_terminal="terminal";const ValueLiteral_$type="ValueLiteral",Wildcard_$type="Wildcard",Wildcard_cardinality="cardinality",Wildcard_lookahead="lookahead",Wildcard_parenthesized="parenthesized";class LangiumGrammarAstReflection extends AbstractAstReflection{constructor(){super(...arguments),this.types={AbstractElement:{name:AbstractElement_$type,properties:{cardinality:{name:AbstractElement_cardinality}},superTypes:[]},AbstractParserRule:{name:AbstractParserRule_$type,properties:{},superTypes:[AbstractRule_$type,AbstractType_$type]},AbstractRule:{name:AbstractRule_$type,properties:{},superTypes:[]},AbstractType:{name:AbstractType_$type,properties:{},superTypes:[]},Action:{name:Action_$type,properties:{cardinality:{name:Action_cardinality},feature:{name:Action_feature},inferredType:{name:Action_inferredType},operator:{name:Action_operator},type:{name:Action_type,referenceType:AbstractType_$type}},superTypes:[AbstractElement_$type]},Alternatives:{name:Alternatives_$type,properties:{cardinality:{name:Alternatives_cardinality},elements:{name:Alternatives_elements,defaultValue:[]}},superTypes:[AbstractElement_$type]},ArrayLiteral:{name:ArrayLiteral_$type,properties:{elements:{name:ArrayLiteral_elements,defaultValue:[]}},superTypes:[ValueLiteral_$type]},ArrayType:{name:ArrayType_$type,properties:{elementType:{name:ArrayType_elementType}},superTypes:[TypeDefinition_$type]},Assignment:{name:Assignment_$type,properties:{cardinality:{name:Assignment_cardinality},feature:{name:Assignment_feature},operator:{name:Assignment_operator},predicate:{name:Assignment_predicate},terminal:{name:Assignment_terminal}},superTypes:[AbstractElement_$type]},BooleanLiteral:{name:BooleanLiteral_$type,properties:{true:{name:BooleanLiteral_true,defaultValue:!1}},superTypes:[Condition_$type,ValueLiteral_$type]},CharacterRange:{name:CharacterRange_$type,properties:{cardinality:{name:CharacterRange_cardinality},left:{name:CharacterRange_left},lookahead:{name:CharacterRange_lookahead},parenthesized:{name:CharacterRange_parenthesized,defaultValue:!1},right:{name:CharacterRange_right}},superTypes:[TerminalElement_$type]},Condition:{name:Condition_$type,properties:{},superTypes:[]},Conjunction:{name:Conjunction_$type,properties:{left:{name:Conjunction_left},right:{name:Conjunction_right}},superTypes:[Condition_$type]},CrossReference:{name:CrossReference_$type,properties:{cardinality:{name:CrossReference_cardinality},deprecatedSyntax:{name:CrossReference_deprecatedSyntax,defaultValue:!1},isMulti:{name:CrossReference_isMulti,defaultValue:!1},terminal:{name:CrossReference_terminal},type:{name:CrossReference_type,referenceType:AbstractType_$type}},superTypes:[AbstractElement_$type]},Disjunction:{name:Disjunction_$type,properties:{left:{name:Disjunction_left},right:{name:Disjunction_right}},superTypes:[Condition_$type]},EndOfFile:{name:EndOfFile_$type,properties:{cardinality:{name:EndOfFile_cardinality}},superTypes:[AbstractElement_$type]},Grammar:{name:Grammar_$type,properties:{imports:{name:Grammar_imports,defaultValue:[]},interfaces:{name:Grammar_interfaces,defaultValue:[]},isDeclared:{name:Grammar_isDeclared,defaultValue:!1},name:{name:Grammar_name},rules:{name:Grammar_rules,defaultValue:[]},types:{name:Grammar_types,defaultValue:[]}},superTypes:[]},GrammarImport:{name:GrammarImport_$type,properties:{path:{name:GrammarImport_path}},superTypes:[]},Group:{name:Group$1_$type,properties:{cardinality:{name:Group$1_cardinality},elements:{name:Group$1_elements,defaultValue:[]},guardCondition:{name:Group$1_guardCondition},predicate:{name:Group$1_predicate}},superTypes:[AbstractElement_$type]},InferredType:{name:InferredType_$type,properties:{name:{name:InferredType_name}},superTypes:[AbstractType_$type]},InfixRule:{name:InfixRule_$type,properties:{call:{name:InfixRule_call},dataType:{name:InfixRule_dataType},inferredType:{name:InfixRule_inferredType},name:{name:InfixRule_name},operators:{name:InfixRule_operators},parameters:{name:InfixRule_parameters,defaultValue:[]},returnType:{name:InfixRule_returnType,referenceType:AbstractType_$type}},superTypes:[AbstractParserRule_$type]},InfixRuleOperatorList:{name:InfixRuleOperatorList_$type,properties:{associativity:{name:InfixRuleOperatorList_associativity},operators:{name:InfixRuleOperatorList_operators,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:InfixRuleOperators_$type,properties:{precedences:{name:InfixRuleOperators_precedences,defaultValue:[]}},superTypes:[]},Interface:{name:Interface_$type,properties:{attributes:{name:Interface_attributes,defaultValue:[]},name:{name:Interface_name},superTypes:{name:Interface_superTypes,defaultValue:[],referenceType:AbstractType_$type}},superTypes:[AbstractType_$type]},Keyword:{name:Keyword_$type,properties:{cardinality:{name:Keyword_cardinality},predicate:{name:Keyword_predicate},value:{name:Keyword_value}},superTypes:[AbstractElement_$type]},NamedArgument:{name:NamedArgument_$type,properties:{calledByName:{name:NamedArgument_calledByName,defaultValue:!1},parameter:{name:NamedArgument_parameter,referenceType:Parameter_$type},value:{name:NamedArgument_value}},superTypes:[]},NegatedToken:{name:NegatedToken_$type,properties:{cardinality:{name:NegatedToken_cardinality},lookahead:{name:NegatedToken_lookahead},parenthesized:{name:NegatedToken_parenthesized,defaultValue:!1},terminal:{name:NegatedToken_terminal}},superTypes:[TerminalElement_$type]},Negation:{name:Negation_$type,properties:{value:{name:Negation_value}},superTypes:[Condition_$type]},NumberLiteral:{name:NumberLiteral_$type,properties:{value:{name:NumberLiteral_value}},superTypes:[ValueLiteral_$type]},Parameter:{name:Parameter_$type,properties:{name:{name:Parameter_name}},superTypes:[]},ParameterReference:{name:ParameterReference_$type,properties:{parameter:{name:ParameterReference_parameter,referenceType:Parameter_$type}},superTypes:[Condition_$type]},ParserRule:{name:ParserRule_$type,properties:{dataType:{name:ParserRule_dataType},definition:{name:ParserRule_definition},entry:{name:ParserRule_entry,defaultValue:!1},fragment:{name:ParserRule_fragment,defaultValue:!1},inferredType:{name:ParserRule_inferredType},name:{name:ParserRule_name},parameters:{name:ParserRule_parameters,defaultValue:[]},returnType:{name:ParserRule_returnType,referenceType:AbstractType_$type}},superTypes:[AbstractParserRule_$type]},ReferenceType:{name:ReferenceType_$type,properties:{isMulti:{name:ReferenceType_isMulti,defaultValue:!1},referenceType:{name:ReferenceType_referenceType}},superTypes:[TypeDefinition_$type]},RegexToken:{name:RegexToken_$type,properties:{cardinality:{name:RegexToken_cardinality},lookahead:{name:RegexToken_lookahead},parenthesized:{name:RegexToken_parenthesized,defaultValue:!1},regex:{name:RegexToken_regex}},superTypes:[TerminalElement_$type]},ReturnType:{name:ReturnType_$type,properties:{name:{name:ReturnType_name}},superTypes:[]},RuleCall:{name:RuleCall_$type,properties:{arguments:{name:RuleCall_arguments,defaultValue:[]},cardinality:{name:RuleCall_cardinality},predicate:{name:RuleCall_predicate},rule:{name:RuleCall_rule,referenceType:AbstractRule_$type}},superTypes:[AbstractElement_$type]},SimpleType:{name:SimpleType_$type,properties:{primitiveType:{name:SimpleType_primitiveType},stringType:{name:SimpleType_stringType},typeRef:{name:SimpleType_typeRef,referenceType:AbstractType_$type}},superTypes:[TypeDefinition_$type]},StringLiteral:{name:StringLiteral_$type,properties:{value:{name:StringLiteral_value}},superTypes:[ValueLiteral_$type]},TerminalAlternatives:{name:TerminalAlternatives_$type,properties:{cardinality:{name:TerminalAlternatives_cardinality},elements:{name:TerminalAlternatives_elements,defaultValue:[]},lookahead:{name:TerminalAlternatives_lookahead},parenthesized:{name:TerminalAlternatives_parenthesized,defaultValue:!1}},superTypes:[TerminalElement_$type]},TerminalElement:{name:TerminalElement_$type,properties:{cardinality:{name:TerminalElement_cardinality},lookahead:{name:TerminalElement_lookahead},parenthesized:{name:TerminalElement_parenthesized,defaultValue:!1}},superTypes:[AbstractElement_$type]},TerminalGroup:{name:TerminalGroup_$type,properties:{cardinality:{name:TerminalGroup_cardinality},elements:{name:TerminalGroup_elements,defaultValue:[]},lookahead:{name:TerminalGroup_lookahead},parenthesized:{name:TerminalGroup_parenthesized,defaultValue:!1}},superTypes:[TerminalElement_$type]},TerminalRule:{name:TerminalRule_$type,properties:{definition:{name:TerminalRule_definition},fragment:{name:TerminalRule_fragment,defaultValue:!1},hidden:{name:TerminalRule_hidden,defaultValue:!1},name:{name:TerminalRule_name},type:{name:TerminalRule_type}},superTypes:[AbstractRule_$type]},TerminalRuleCall:{name:TerminalRuleCall_$type,properties:{cardinality:{name:TerminalRuleCall_cardinality},lookahead:{name:TerminalRuleCall_lookahead},parenthesized:{name:TerminalRuleCall_parenthesized,defaultValue:!1},rule:{name:TerminalRuleCall_rule,referenceType:TerminalRule_$type}},superTypes:[TerminalElement_$type]},Type:{name:Type_$type,properties:{name:{name:Type_name},type:{name:Type_type}},superTypes:[AbstractType_$type]},TypeAttribute:{name:TypeAttribute_$type,properties:{defaultValue:{name:TypeAttribute_defaultValue},isOptional:{name:TypeAttribute_isOptional,defaultValue:!1},name:{name:TypeAttribute_name},type:{name:TypeAttribute_type}},superTypes:[]},TypeDefinition:{name:TypeDefinition_$type,properties:{},superTypes:[]},UnionType:{name:UnionType_$type,properties:{types:{name:UnionType_types,defaultValue:[]}},superTypes:[TypeDefinition_$type]},UnorderedGroup:{name:UnorderedGroup_$type,properties:{cardinality:{name:UnorderedGroup_cardinality},elements:{name:UnorderedGroup_elements,defaultValue:[]}},superTypes:[AbstractElement_$type]},UntilToken:{name:UntilToken_$type,properties:{cardinality:{name:UntilToken_cardinality},lookahead:{name:UntilToken_lookahead},parenthesized:{name:UntilToken_parenthesized,defaultValue:!1},terminal:{name:UntilToken_terminal}},superTypes:[TerminalElement_$type]},ValueLiteral:{name:ValueLiteral_$type,properties:{},superTypes:[]},Wildcard:{name:Wildcard_$type,properties:{cardinality:{name:Wildcard_cardinality},lookahead:{name:Wildcard_lookahead},parenthesized:{name:Wildcard_parenthesized,defaultValue:!1}},superTypes:[TerminalElement_$type]}}}}const reflection$1=new LangiumGrammarAstReflection;function streamCst(node){return new TreeStreamImpl(node,element=>isCompositeCstNode(element)?element.content:[],{includeRoot:!0})}function tokenToRange(token){return{start:{character:token.startColumn-1,line:token.startLine-1},end:{character:token.endColumn,line:token.endLine-1}}}function toDocumentSegment(node){if(!node)return;const{offset:offset,end:end,range:range}=node;return{range:range,offset:offset,end:end,length:end-offset}}var RangeComparison,RangeComparison2;(RangeComparison2=RangeComparison||(RangeComparison={}))[RangeComparison2.Before=0]="Before",RangeComparison2[RangeComparison2.After=1]="After",RangeComparison2[RangeComparison2.OverlapFront=2]="OverlapFront",RangeComparison2[RangeComparison2.OverlapBack=3]="OverlapBack",RangeComparison2[RangeComparison2.Inside=4]="Inside",RangeComparison2[RangeComparison2.Outside=5]="Outside";const DefaultNameRegexp=/^[\w\p{L}]$/u;function isCommentNode(cstNode,commentNames){return isLeafCstNode(cstNode)&&commentNames.includes(cstNode.tokenType.name)}class ErrorWithLocation extends Error{constructor(node,message){super(node?`${message} at ${node.range.start.line}:${node.range.start.character}`:message)}}function assertUnreachable(_,message="Error: Got unexpected value."){throw new Error(message)}function cc(char){return char.charCodeAt(0)}function insertToSet(item,set){Array.isArray(item)?item.forEach(function(subItem){set.push(subItem)}):set.push(item)}function addFlag(flagObj,flagKey){if(!0===flagObj[flagKey])throw"duplicate flag "+flagKey;flagObj[flagKey],flagObj[flagKey]=!0}function ASSERT_EXISTS(obj){if(void 0===obj)throw Error("Internal Error - Should never get here!");return!0}function isCharacter(obj){return"Character"===obj.type}const digitsCharCodes=[];for(let i=cc("0");i<=cc("9");i++)digitsCharCodes.push(i);const wordCharCodes=[cc("_")].concat(digitsCharCodes);for(let i=cc("a");i<=cc("z");i++)wordCharCodes.push(i);for(let i=cc("A");i<=cc("Z");i++)wordCharCodes.push(i);const whitespaceCodes=[cc(" "),cc("\f"),cc("\n"),cc("\r"),cc("\t"),cc("\v"),cc("\t"),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc("\u2028"),cc("\u2029"),cc(" "),cc(" "),cc(" "),cc("\ufeff")],hexDigitPattern=/[0-9a-fA-F]/,decimalPattern=/[0-9]/,decimalPatternNoZero=/[1-9]/;class RegExpParser{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(newState2){this.idx=newState2.idx,this.input=newState2.input,this.groupIdx=newState2.groupIdx}pattern(input){this.idx=0,this.input=input,this.groupIdx=0,this.consumeChar("/");const value=this.disjunction();this.consumeChar("/");const flags={type:"Flags",loc:{begin:this.idx,end:input.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":addFlag(flags,"global");break;case"i":addFlag(flags,"ignoreCase");break;case"m":addFlag(flags,"multiLine");break;case"u":addFlag(flags,"unicode");break;case"y":addFlag(flags,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:flags,value:value,loc:this.loc(0)}}disjunction(){const alts=[],begin=this.idx;for(alts.push(this.alternative());"|"===this.peekChar();)this.consumeChar("|"),alts.push(this.alternative());return{type:"Disjunction",value:alts,loc:this.loc(begin)}}alternative(){const terms=[],begin=this.idx;for(;this.isTerm();)terms.push(this.term());return{type:"Alternative",value:terms,loc:this.loc(begin)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const begin=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(begin)};case"$":return{type:"EndAnchor",loc:this.loc(begin)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(begin)};case"B":return{type:"NonWordBoundary",loc:this.loc(begin)}}throw Error("Invalid Assertion Escape");case"(":let type;switch(this.consumeChar("?"),this.popChar()){case"=":type="Lookahead";break;case"!":type="NegativeLookahead";break;case"<":switch(this.popChar()){case"=":type="Lookbehind";break;case"!":type="NegativeLookbehind"}}ASSERT_EXISTS(type);const disjunction=this.disjunction();return this.consumeChar(")"),{type:type,value:disjunction,loc:this.loc(begin)}}return function(){throw Error("Internal Error - Should never get here!")}()}quantifier(isBacktracking=!1){let range;const begin=this.idx;switch(this.popChar()){case"*":range={atLeast:0,atMost:1/0};break;case"+":range={atLeast:1,atMost:1/0};break;case"?":range={atLeast:0,atMost:1};break;case"{":const atLeast=this.integerIncludingZero();switch(this.popChar()){case"}":range={atLeast:atLeast,atMost:atLeast};break;case",":let atMost;this.isDigit()?(atMost=this.integerIncludingZero(),range={atLeast:atLeast,atMost:atMost}):range={atLeast:atLeast,atMost:1/0},this.consumeChar("}")}if(!0===isBacktracking&&void 0===range)return;ASSERT_EXISTS(range)}if(!0!==isBacktracking||void 0!==range)return ASSERT_EXISTS(range)?("?"===this.peekChar(0)?(this.consumeChar("?"),range.greedy=!1):range.greedy=!0,range.type="Quantifier",range.loc=this.loc(begin),range):void 0}atom(){let atom2;const begin=this.idx;switch(this.peekChar()){case".":atom2=this.dotAll();break;case"\\":atom2=this.atomEscape();break;case"[":atom2=this.characterClass();break;case"(":atom2=this.group()}if(void 0===atom2&&this.isPatternCharacter()&&(atom2=this.patternCharacter()),ASSERT_EXISTS(atom2))return atom2.loc=this.loc(begin),this.isQuantifier()&&(atom2.quantifier=this.quantifier()),atom2}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[cc("\n"),cc("\r"),cc("\u2028"),cc("\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 set,complement=!1;switch(this.popChar()){case"d":set=digitsCharCodes;break;case"D":set=digitsCharCodes,complement=!0;break;case"s":set=whitespaceCodes;break;case"S":set=whitespaceCodes,complement=!0;break;case"w":set=wordCharCodes;break;case"W":set=wordCharCodes,complement=!0}if(ASSERT_EXISTS(set))return{type:"Set",value:set,complement:complement}}controlEscapeAtom(){let escapeCode;switch(this.popChar()){case"f":escapeCode=cc("\f");break;case"n":escapeCode=cc("\n");break;case"r":escapeCode=cc("\r");break;case"t":escapeCode=cc("\t");break;case"v":escapeCode=cc("\v")}if(ASSERT_EXISTS(escapeCode))return{type:"Character",value:escapeCode}}controlLetterEscapeAtom(){this.consumeChar("c");const letter=this.popChar();if(!1===/[a-zA-Z]/.test(letter))throw Error("Invalid ");return{type:"Character",value:letter.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:cc("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:cc(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:cc(this.popChar())}}}characterClass(){const set=[];let complement=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),complement=!0);this.isClassAtom();){const from=this.classAtom();if(from.type,isCharacter(from)&&this.isRangeDash()){this.consumeChar("-");const to=this.classAtom();if(to.type,isCharacter(to)){if(to.value<from.value)throw Error("Range out of order in character class");set.push({from:from.value,to:to.value})}else insertToSet(from.value,set),set.push(cc("-")),insertToSet(to.value,set)}else insertToSet(from.value,set)}return this.consumeChar("]"),{type:"Set",complement:complement,value:set}}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:cc("\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 capturing=!0;if(this.consumeChar("("),"?"===this.peekChar(0))this.consumeChar("?"),this.consumeChar(":"),capturing=!1;else this.groupIdx++;const value=this.disjunction();this.consumeChar(")");const groupAst={type:"Group",capturing:capturing,value:value};return capturing&&(groupAst.idx=this.groupIdx),groupAst}positiveInteger(){let number=this.popChar();if(!1===decimalPatternNoZero.test(number))throw Error("Expecting a positive integer");for(;decimalPattern.test(this.peekChar(0));)number+=this.popChar();return parseInt(number,10)}integerIncludingZero(){let number=this.popChar();if(!1===decimalPattern.test(number))throw Error("Expecting an integer");for(;decimalPattern.test(this.peekChar(0));)number+=this.popChar();return parseInt(number,10)}patternCharacter(){const nextChar=this.popChar();switch(nextChar){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:cc(nextChar)}}}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 decimalPattern.test(this.peekChar(0))}isClassAtom(howMuch=0){switch(this.peekChar(howMuch)){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)||"<"===this.peekChar(2)&&("="===this.peekChar(3)||"!"===this.peekChar(3)));default:return!1}}isQuantifier(){const prevState=this.saveState();try{return void 0!==this.quantifier(!0)}catch(e){return!1}finally{this.restoreState(prevState)}}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(howMany){let hexString="";for(let i=0;i<howMany;i++){const hexChar=this.popChar();if(!1===hexDigitPattern.test(hexChar))throw Error("Expecting a HexDecimal digits");hexString+=hexChar}return{type:"Character",value:parseInt(hexString,16)}}peekChar(howMuch=0){return this.input[this.idx+howMuch]}popChar(){const nextChar=this.peekChar(0);return this.consumeChar(void 0),nextChar}consumeChar(char){if(void 0!==char&&this.input[this.idx]!==char)throw Error("Expected: '"+char+"' 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(begin){return{begin:begin,end:this.idx}}}class BaseRegExpVisitor{visitChildren(node){for(const key in node){const child=node[key];node.hasOwnProperty(key)&&(void 0!==child.type?this.visit(child):Array.isArray(child)&&child.forEach(subChild=>{this.visit(subChild)},this))}}visit(node){switch(node.type){case"Pattern":this.visitPattern(node);break;case"Flags":this.visitFlags(node);break;case"Disjunction":this.visitDisjunction(node);break;case"Alternative":this.visitAlternative(node);break;case"StartAnchor":this.visitStartAnchor(node);break;case"EndAnchor":this.visitEndAnchor(node);break;case"WordBoundary":this.visitWordBoundary(node);break;case"NonWordBoundary":this.visitNonWordBoundary(node);break;case"Lookahead":this.visitLookahead(node);break;case"NegativeLookahead":this.visitNegativeLookahead(node);break;case"Lookbehind":this.visitLookbehind(node);break;case"NegativeLookbehind":this.visitNegativeLookbehind(node);break;case"Character":this.visitCharacter(node);break;case"Set":this.visitSet(node);break;case"Group":this.visitGroup(node);break;case"GroupBackReference":this.visitGroupBackReference(node);break;case"Quantifier":this.visitQuantifier(node)}this.visitChildren(node)}visitPattern(node){}visitFlags(node){}visitDisjunction(node){}visitAlternative(node){}visitStartAnchor(node){}visitEndAnchor(node){}visitWordBoundary(node){}visitNonWordBoundary(node){}visitLookahead(node){}visitNegativeLookahead(node){}visitLookbehind(node){}visitNegativeLookbehind(node){}visitCharacter(node){}visitSet(node){}visitGroup(node){}visitGroupBackReference(node){}visitQuantifier(node){}}const NEWLINE_REGEXP=/\r?\n/gm,regexpParser=new RegExpParser;const visitor=new class extends BaseRegExpVisitor{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(regex){this.multiline=!1,this.regex=regex,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(node){node.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(node){const char=String.fromCharCode(node.value);if(this.multiline||"\n"!==char||(this.multiline=!0),node.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const escapedChar=escapeRegExp(char);this.endRegexpStack.push(escapedChar),this.isStarting&&(this.startRegexp+=escapedChar)}}visitSet(node){if(!this.multiline){const set=this.regex.substring(node.loc.begin,node.loc.end),regex=new RegExp(set);this.multiline=Boolean("\n".match(regex))}if(node.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const set=this.regex.substring(node.loc.begin,node.loc.end);this.endRegexpStack.push(set),this.isStarting&&(this.startRegexp+=set)}}visitChildren(node){if("Group"===node.type){if(node.quantifier)return}super.visitChildren(node)}};function isMultilineComment(regexp){try{return"string"==typeof regexp&&(regexp=new RegExp(regexp)),regexp=regexp.toString(),visitor.reset(regexp),visitor.visit(regexpParser.pattern(regexp)),visitor.multiline}catch{return!1}}const whitespaceCharacters="\f\n\r\t\v              \u2028\u2029   \ufeff".split("");function isWhitespace(value){const regexp="string"==typeof value?new RegExp(value):value;return whitespaceCharacters.some(ws=>regexp.test(ws))}function escapeRegExp(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function partialMatches(regex,input){const partial=function(regex){"string"==typeof regex&&(regex=new RegExp(regex));const re=regex,source=regex.source;let i=0;function process2(){let tmp,result="";function appendRaw(nbChars){result+=source.substr(i,nbChars),i+=nbChars}function appendOptional(nbChars){result+="(?:"+source.substr(i,nbChars)+"|$)",i+=nbChars}for(;i<source.length;)switch(source[i]){case"\\":switch(source[i+1]){case"c":appendOptional(3);break;case"x":appendOptional(4);break;case"u":re.unicode?"{"===source[i+2]?appendOptional(source.indexOf("}",i)-i+1):appendOptional(6):appendOptional(2);break;case"p":case"P":re.unicode?appendOptional(source.indexOf("}",i)-i+1):appendOptional(2);break;case"k":appendOptional(source.indexOf(">",i)-i+1);break;default:appendOptional(2)}break;case"[":tmp=/\[(?:\\.|.)*?\]/g,tmp.lastIndex=i,tmp=tmp.exec(source)||[],appendOptional(tmp[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":appendRaw(1);break;case"{":tmp=/\{\d+,?\d*\}/g,tmp.lastIndex=i,tmp=tmp.exec(source),tmp?appendRaw(tmp[0].length):appendOptional(1);break;case"(":if("?"===source[i+1])switch(source[i+2]){case":":result+="(?:",i+=3,result+=process2()+"|$)";break;case"=":result+="(?=",i+=3,result+=process2()+")";break;case"!":tmp=i,i+=3,process2(),result+=source.substr(tmp,i-tmp);break;case"<":switch(source[i+3]){case"=":case"!":tmp=i,i+=4,process2(),result+=source.substr(tmp,i-tmp);break;default:appendRaw(source.indexOf(">",i)-i+1),result+=process2()+"|$)"}}else appendRaw(1),result+=process2()+"|$)";break;case")":return++i,result;default:appendOptional(1)}return result}return new RegExp(process2(),regex.flags)}(regex),match=input.match(partial);return!!match&&match[0].length>0}function getAllReachableRules(grammar,allTerminals){const ruleNames=new Set,entryRule=function(grammar){return grammar.rules.find(e=>isParserRule(e)&&e.entry)}(grammar);if(!entryRule)return new Set(grammar.rules);const topMostRules=[entryRule].concat(function(grammar){return grammar.rules.filter(e=>isTerminalRule(e)&&e.hidden)}(grammar));for(const rule of topMostRules)ruleDfs(rule,ruleNames,allTerminals);const rules=new Set;for(const rule of grammar.rules)(ruleNames.has(rule.name)||isTerminalRule(rule)&&rule.hidden)&&rules.add(rule);return rules}function ruleDfs(rule,visitedSet,allTerminals){visitedSet.add(rule.name),streamAllContents(rule).forEach(node=>{if(isRuleCall(node)||allTerminals){const refRule=node.rule.ref;refRule&&!visitedSet.has(refRule.name)&&ruleDfs(refRule,visitedSet,allTerminals)}})}function isCommentTerminal(terminalRule){return terminalRule.hidden&&!isWhitespace(terminalRegex(terminalRule))}function findNodeForProperty(node,property,index){if(!node||!property)return;const nodes=findNodesForPropertyInternal(node,property,node.astNode,!0);return 0!==nodes.length?nodes[index=void 0!==index?Math.max(0,Math.min(index,nodes.length-1)):0]:void 0}function findNodesForPropertyInternal(node,property,element,first2){if(!first2){const nodeFeature=getContainerOfType(node.grammarSource,isAssignment);if(nodeFeature&&nodeFeature.feature===property)return[node]}return isCompositeCstNode(node)&&node.astNode===element?node.content.flatMap(e=>findNodesForPropertyInternal(e,property,element,!1)):[]}function findNodeForKeyword(node,keyword,index){if(!node)return;const nodes=function(node,keyword,element){if(node.astNode!==element)return[];if(isKeyword(node.grammarSource)&&node.grammarSource.value===keyword)return[node];const treeIterator=streamCst(node).iterator();let result;const keywordNodes=[];do{if(result=treeIterator.next(),!result.done){const childNode=result.value;childNode.astNode===element?isKeyword(childNode.grammarSource)&&childNode.grammarSource.value===keyword&&keywordNodes.push(childNode):treeIterator.prune()}}while(!result.done);return keywordNodes}(node,keyword,null==node?void 0:node.astNode);return 0!==nodes.length?nodes[index=void 0!==index?Math.max(0,Math.min(index,nodes.length-1)):0]:void 0}function findNameAssignment(type){let startNode=type;return isInferredType(startNode)&&(isAction(startNode.$container)?startNode=startNode.$container.$container:isAbstractParserRule(startNode.$container)?startNode=startNode.$container:assertUnreachable(startNode.$container)),findNameAssignmentInternal(type,startNode,new Map)}function findNameAssignmentInternal(type,startNode,cache){var _a2;function go(node,refType){let childAssignment;return getContainerOfType(node,isAssignment)||(childAssignment=findNameAssignmentInternal(refType,refType,cache)),cache.set(type,childAssignment),childAssignment}if(cache.has(type))return cache.get(type);cache.set(type,void 0);for(const node of streamAllContents(startNode)){if(isAssignment(node)&&"name"===node.feature.toLowerCase())return cache.set(type,node),node;if(isRuleCall(node)&&isParserRule(node.rule.ref))return go(node,node.rule.ref);if(isSimpleType(node)&&(null==(_a2=node.typeRef)?void 0:_a2.ref))return go(node,node.typeRef.ref)}}function isDataTypeRule(rule){return isDataTypeRuleInternal(rule,new Set)}function isDataTypeRuleInternal(rule,visited){if(visited.has(rule))return!0;visited.add(rule);for(const node of streamAllContents(rule))if(isRuleCall(node)){if(!node.rule.ref)return!1;if(isParserRule(node.rule.ref)&&!isDataTypeRuleInternal(node.rule.ref,visited))return!1;if(isInfixRule(node.rule.ref))return!1}else{if(isAssignment(node))return!1;if(isAction(node))return!1}return Boolean(rule.definition)}function getExplicitRuleType(rule){if(!isTerminalRule(rule)){if(rule.inferredType)return rule.inferredType.name;if(rule.dataType)return rule.dataType;if(rule.returnType){const refType=rule.returnType.ref;if(refType)return refType.name}}}function getTypeName(type){if(isAbstractParserRule(type))return isParserRule(type)&&isDataTypeRule(type)?type.name:getExplicitRuleType(type)??type.name;if(item=type,reflection$1.isInstance(item,Interface_$type)||function(item){return reflection$1.isInstance(item,Type_$type)}(type)||function(item){return reflection$1.isInstance(item,ReturnType_$type)}(type))return type.name;if(isAction(type)){const actionType=function(action){var _a2;if(action.inferredType)return action.inferredType.name;if(null==(_a2=action.type)?void 0:_a2.ref)return getTypeName(action.type.ref);return}(type);if(actionType)return actionType}else if(isInferredType(type))return type.name;var item;throw new Error("Cannot get name of Unknown Type")}function terminalRegex(terminalRule){const flags={s:!1,i:!1,u:!1},source=abstractElementToRegex(terminalRule.definition,flags),flagText=Object.entries(flags).filter(([,value])=>value).map(([name])=>name).join("");return new RegExp(source,flagText)}const WILDCARD=/[\s\S]/.source;function abstractElementToRegex(element,flags){var _a2,until,negate,group,alternatives,item;if(item=element,reflection$1.isInstance(item,TerminalAlternatives_$type))return withCardinality((alternatives=element).elements.map(e=>abstractElementToRegex(e)).join("|"),{cardinality:alternatives.cardinality,lookahead:alternatives.lookahead,parenthesized:alternatives.parenthesized,wrap:!1});if(function(item){return reflection$1.isInstance(item,TerminalGroup_$type)}(element))return withCardinality((group=element).elements.map(e=>abstractElementToRegex(e)).join(""),{cardinality:group.cardinality,lookahead:group.lookahead,parenthesized:group.parenthesized,wrap:!1});if(function(item){return reflection$1.isInstance(item,CharacterRange_$type)}(element))return function(range){if(range.right)return withCardinality(`[${keywordToRegex(range.left)}-${keywordToRegex(range.right)}]`,{cardinality:range.cardinality,lookahead:range.lookahead,parenthesized:range.parenthesized,wrap:!1});return withCardinality(keywordToRegex(range.left),{cardinality:range.cardinality,lookahead:range.lookahead,parenthesized:range.parenthesized,wrap:!1})}(element);if(function(item){return reflection$1.isInstance(item,TerminalRuleCall_$type)}(element)){const rule=element.rule.ref;if(!rule)throw new Error("Missing rule reference.");return withCardinality(abstractElementToRegex(rule.definition),{cardinality:element.cardinality,lookahead:element.lookahead,parenthesized:element.parenthesized})}if(function(item){return reflection$1.isInstance(item,NegatedToken_$type)}(element))return withCardinality(`(?!${abstractElementToRegex((negate=element).terminal)})${WILDCARD}*?`,{cardinality:negate.cardinality,lookahead:negate.lookahead,parenthesized:negate.parenthesized});if(function(item){return reflection$1.isInstance(item,UntilToken_$type)}(element))return withCardinality(`${WILDCARD}*?${abstractElementToRegex((until=element).terminal)}`,{cardinality:until.cardinality,lookahead:until.lookahead,parenthesized:until.parenthesized});if(function(item){return reflection$1.isInstance(item,RegexToken_$type)}(element)){const lastSlash=element.regex.lastIndexOf("/"),source=element.regex.substring(1,lastSlash),regexFlags=element.regex.substring(lastSlash+1);return flags&&(flags.i=regexFlags.includes("i"),flags.s=regexFlags.includes("s"),flags.u=regexFlags.includes("u")),withCardinality(source,{cardinality:element.cardinality,lookahead:element.lookahead,parenthesized:element.parenthesized,wrap:!1})}if(function(item){return reflection$1.isInstance(item,Wildcard_$type)}(element))return withCardinality(WILDCARD,{cardinality:element.cardinality,lookahead:element.lookahead,parenthesized:element.parenthesized});throw new Error(`Invalid terminal element: ${null==element?void 0:element.$type}, ${null==(_a2=null==element?void 0:element.$cstNode)?void 0:_a2.text}`)}function keywordToRegex(keyword){return escapeRegExp(keyword.value)}function withCardinality(regex,options){if(options.parenthesized||options.lookahead||!1!==options.wrap){regex=`(${options.lookahead??(options.parenthesized?"":"?:")}${regex})`}return options.cardinality?`${regex}${options.cardinality}`:regex}function PRINT_ERROR(msg){console&&console.error&&console.error(`Error: ${msg}`)}function PRINT_WARNING(msg){console&&console.warn&&console.warn(`Warning: ${msg}`)}function timer(func){const start=(new Date).getTime(),val=func();return{time:(new Date).getTime()-start,value:val}}function toFastProperties(toBecomeFast){function FakeConstructor(){}FakeConstructor.prototype=toBecomeFast;const fakeInstance=new FakeConstructor;function fakeAccess(){return typeof fakeInstance.bar}return fakeAccess(),fakeAccess(),toBecomeFast}class AbstractProduction{get definition(){return this._definition}set definition(value){this._definition=value}constructor(_definition){this._definition=_definition}accept(visitor2){visitor2.visit(this),this.definition.forEach(prod=>{prod.accept(visitor2)})}}class NonTerminal extends AbstractProduction{constructor(options){super([]),this.idx=1,Object.assign(this,pickOnlyDefined(options))}set definition(definition){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(visitor2){visitor2.visit(this)}}class Rule extends AbstractProduction{constructor(options){super(options.definition),this.orgText="",Object.assign(this,pickOnlyDefined(options))}}class Alternative extends AbstractProduction{constructor(options){super(options.definition),this.ignoreAmbiguities=!1,Object.assign(this,pickOnlyDefined(options))}}let Option$1=class extends AbstractProduction{constructor(options){super(options.definition),this.idx=1,Object.assign(this,pickOnlyDefined(options))}};class RepetitionMandatory extends AbstractProduction{constructor(options){super(options.definition),this.idx=1,Object.assign(this,pickOnlyDefined(options))}}class RepetitionMandatoryWithSeparator extends AbstractProduction{constructor(options){super(options.definition),this.idx=1,Object.assign(this,pickOnlyDefined(options))}}class Repetition extends AbstractProduction{constructor(options){super(options.definition),this.idx=1,Object.assign(this,pickOnlyDefined(options))}}class RepetitionWithSeparator extends AbstractProduction{constructor(options){super(options.definition),this.idx=1,Object.assign(this,pickOnlyDefined(options))}}class Alternation extends AbstractProduction{get definition(){return this._definition}set definition(value){this._definition=value}constructor(options){super(options.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,pickOnlyDefined(options))}}class Terminal{constructor(options){this.idx=1,Object.assign(this,pickOnlyDefined(options))}accept(visitor2){visitor2.visit(this)}}function serializeProduction(node){function convertDefinition(definition){return definition.map(serializeProduction)}if(node instanceof NonTerminal){const serializedNonTerminal={type:"NonTerminal",name:node.nonTerminalName,idx:node.idx};return"string"==typeof node.label&&(serializedNonTerminal.label=node.label),serializedNonTerminal}if(node instanceof Alternative)return{type:"Alternative",definition:convertDefinition(node.definition)};if(node instanceof Option$1)return{type:"Option",idx:node.idx,definition:convertDefinition(node.definition)};if(node instanceof RepetitionMandatory)return{type:"RepetitionMandatory",idx:node.idx,definition:convertDefinition(node.definition)};if(node instanceof RepetitionMandatoryWithSeparator)return{type:"RepetitionMandatoryWithSeparator",idx:node.idx,separator:serializeProduction(new Terminal({terminalType:node.separator})),definition:convertDefinition(node.definition)};if(node instanceof RepetitionWithSeparator)return{type:"RepetitionWithSeparator",idx:node.idx,separator:serializeProduction(new Terminal({terminalType:node.separator})),definition:convertDefinition(node.definition)};if(node instanceof Repetition)return{type:"Repetition",idx:node.idx,definition:convertDefinition(node.definition)};if(node instanceof Alternation)return{type:"Alternation",idx:node.idx,definition:convertDefinition(node.definition)};if(node instanceof Terminal){const serializedTerminal={type:"Terminal",name:node.terminalType.name,label:(tokType=node.terminalType,"string"==typeof(obj=tokType).LABEL&&""!==obj.LABEL?tokType.LABEL:tokType.name),idx:node.idx};"string"==typeof node.label&&(serializedTerminal.terminalLabel=node.label);const pattern=node.terminalType.PATTERN;return node.terminalType.PATTERN&&(serializedTerminal.pattern=pattern instanceof RegExp?pattern.source:pattern),serializedTerminal}if(node instanceof Rule)return{type:"Rule",name:node.name,orgText:node.orgText,definition:convertDefinition(node.definition)};throw Error("non exhaustive match");var tokType,obj}function pickOnlyDefined(obj){return Object.fromEntries(Object.entries(obj).filter(([,v])=>void 0!==v))}class GAstVisitor{visit(node){const nodeAny=node;switch(nodeAny.constructor){case NonTerminal:return this.visitNonTerminal(nodeAny);case Alternative:return this.visitAlternative(nodeAny);case Option$1:return this.visitOption(nodeAny);case RepetitionMandatory:return this.visitRepetitionMandatory(nodeAny);case RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(nodeAny);case RepetitionWithSeparator:return this.visitRepetitionWithSeparator(nodeAny);case Repetition:return this.visitRepetition(nodeAny);case Alternation:return this.visitAlternation(nodeAny);case Terminal:return this.visitTerminal(nodeAny);case Rule:return this.visitRule(nodeAny);default:throw Error("non exhaustive match")}}visitNonTerminal(node){}visitAlternative(node){}visitOption(node){}visitRepetition(node){}visitRepetitionMandatory(node){}visitRepetitionMandatoryWithSeparator(node){}visitRepetitionWithSeparator(node){}visitAlternation(node){}visitTerminal(node){}visitRule(node){}}function isOptionalProd(prod,alreadyVisited=[]){return!!(prod instanceof Option$1||prod instanceof Repetition||prod instanceof RepetitionWithSeparator)||(prod instanceof Alternation?prod.definition.some(subProd=>isOptionalProd(subProd,alreadyVisited)):!(prod instanceof NonTerminal&&alreadyVisited.includes(prod))&&(prod instanceof AbstractProduction&&(prod instanceof NonTerminal&&alreadyVisited.push(prod),prod.definition.every(subProd=>isOptionalProd(subProd,alreadyVisited)))))}function getProductionDslName$1(prod){if(prod instanceof NonTerminal)return"SUBRULE";if(prod instanceof Option$1)return"OPTION";if(prod instanceof Alternation)return"OR";if(prod instanceof RepetitionMandatory)return"AT_LEAST_ONE";if(prod instanceof RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(prod instanceof RepetitionWithSeparator)return"MANY_SEP";if(prod instanceof Repetition)return"MANY";if(prod instanceof Terminal)return"CONSUME";throw Error("non exhaustive match")}class RestWalker{walk(prod,prevRest=[]){prod.definition.forEach((subProd,index)=>{const currRest=prod.definition.slice(index+1);if(subProd instanceof NonTerminal)this.walkProdRef(subProd,currRest,prevRest);else if(subProd instanceof Terminal)this.walkTerminal(subProd,currRest,prevRest);else if(subProd instanceof Alternative)this.walkFlat(subProd,currRest,prevRest);else if(subProd instanceof Option$1)this.walkOption(subProd,currRest,prevRest);else if(subProd instanceof RepetitionMandatory)this.walkAtLeastOne(subProd,currRest,prevRest);else if(subProd instanceof RepetitionMandatoryWithSeparator)this.walkAtLeastOneSep(subProd,currRest,prevRest);else if(subProd instanceof RepetitionWithSeparator)this.walkManySep(subProd,currRest,prevRest);else if(subProd instanceof Repetition)this.walkMany(subProd,currRest,prevRest);else{if(!(subProd instanceof Alternation))throw Error("non exhaustive match");this.walkOr(subProd,currRest,prevRest)}})}walkTerminal(terminal,currRest,prevRest){}walkProdRef(refProd,currRest,prevRest){}walkFlat(flatProd,currRest,prevRest){const fullOrRest=currRest.concat(prevRest);this.walk(flatProd,fullOrRest)}walkOption(optionProd,currRest,prevRest){const fullOrRest=currRest.concat(prevRest);this.walk(optionProd,fullOrRest)}walkAtLeastOne(atLeastOneProd,currRest,prevRest){const fullAtLeastOneRest=[new Option$1({definition:atLeastOneProd.definition})].concat(currRest,prevRest);this.walk(atLeastOneProd,fullAtLeastOneRest)}walkAtLeastOneSep(atLeastOneSepProd,currRest,prevRest){const fullAtLeastOneSepRest=restForRepetitionWithSeparator(atLeastOneSepProd,currRest,prevRest);this.walk(atLeastOneSepProd,fullAtLeastOneSepRest)}walkMany(manyProd,currRest,prevRest){const fullManyRest=[new Option$1({definition:manyProd.definition})].concat(currRest,prevRest);this.walk(manyProd,fullManyRest)}walkManySep(manySepProd,currRest,prevRest){const fullManySepRest=restForRepetitionWithSeparator(manySepProd,currRest,prevRest);this.walk(manySepProd,fullManySepRest)}walkOr(orProd,currRest,prevRest){const fullOrRest=currRest.concat(prevRest);orProd.definition.forEach(alt=>{const prodWrapper=new Alternative({definition:[alt]});this.walk(prodWrapper,fullOrRest)})}}function restForRepetitionWithSeparator(repSepProd,currRest,prevRest){return[new Option$1({definition:[new Terminal({terminalType:repSepProd.separator})].concat(repSepProd.definition)})].concat(currRest,prevRest)}function first(prod){if(prod instanceof NonTerminal)return first(prod.referencedRule);if(prod instanceof Terminal)return[prod.terminalType];if(function(prod){return prod instanceof Alternative||prod instanceof Option$1||prod instanceof Repetition||prod instanceof RepetitionMandatory||prod instanceof RepetitionMandatoryWithSeparator||prod instanceof RepetitionWithSeparator||prod instanceof Terminal||prod instanceof Rule}(prod))return function(prod){let firstSet=[];const seq=prod.definition;let currSubProd,nextSubProdIdx=0,hasInnerProdsRemaining=seq.length>nextSubProdIdx,isLastInnerProdOptional=!0;for(;hasInnerProdsRemaining&&isLastInnerProdOptional;)currSubProd=seq[nextSubProdIdx],isLastInnerProdOptional=isOptionalProd(currSubProd),firstSet=firstSet.concat(first(currSubProd)),nextSubProdIdx+=1,hasInnerProdsRemaining=seq.length>nextSubProdIdx;return[...new Set(firstSet)]}(prod);if(function(prod){return prod instanceof Alternation}(prod))return function(prod){const allAlternativesFirsts=prod.definition.map(innerProd=>first(innerProd));return[...new Set(allAlternativesFirsts.flat())]}(prod);throw Error("non exhaustive match")}const IN="_~IN~_";class ResyncFollowsWalker extends RestWalker{constructor(topProd){super(),this.topProd=topProd,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(terminal,currRest,prevRest){}walkProdRef(refProd,currRest,prevRest){const followName=(inner=refProd.referencedRule,occurenceInParent=refProd.idx,inner.name+occurenceInParent+IN+this.topProd.name);var inner,occurenceInParent;const fullRest=currRest.concat(prevRest),t_in_topProd_follows=first(new Alternative({definition:fullRest}));this.follows[followName]=t_in_topProd_follows}}let regExpAstCache={};const regExpParser=new RegExpParser;function getRegExpAst(regExp){const regExpStr=regExp.toString();if(regExpAstCache.hasOwnProperty(regExpStr))return regExpAstCache[regExpStr];{const regExpAst=regExpParser.pattern(regExpStr);return regExpAstCache[regExpStr]=regExpAst,regExpAst}}const failedOptimizationPrefixMsg='Unable to use "first char" lexer optimizations:\n';function getOptimizedStartCodesIndices(regExp,ensureOptimizations=!1){try{const ast=getRegExpAst(regExp);return firstCharOptimizedIndices(ast.value,{},ast.flags.ignoreCase)}catch(e){if("Complement Sets are not supported for first char optimization"===e.message)ensureOptimizations&&PRINT_WARNING(`${failedOptimizationPrefixMsg}\tUnable to optimize: < ${regExp.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 msgSuffix="";ensureOptimizations&&(msgSuffix="\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."),PRINT_ERROR(`${failedOptimizationPrefixMsg}\n\tFailed parsing: < ${regExp.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues`+msgSuffix)}}return[]}function firstCharOptimizedIndices(ast,result,ignoreCase){switch(ast.type){case"Disjunction":for(let i=0;i<ast.value.length;i++)firstCharOptimizedIndices(ast.value[i],result,ignoreCase);break;case"Alternative":const terms=ast.value;for(let i=0;i<terms.length;i++){const term=terms[i];switch(term.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const atom2=term;switch(atom2.type){case"Character":addOptimizedIdxToResult(atom2.value,result,ignoreCase);break;case"Set":if(!0===atom2.complement)throw Error("Complement Sets are not supported for first char optimization");atom2.value.forEach(code=>{if("number"==typeof code)addOptimizedIdxToResult(code,result,ignoreCase);else{const range=code;if(!0===ignoreCase)for(let rangeCode=range.from;rangeCode<=range.to;rangeCode++)addOptimizedIdxToResult(rangeCode,result,ignoreCase);else{for(let rangeCode=range.from;rangeCode<=range.to&&rangeCode<minOptimizationVal;rangeCode++)addOptimizedIdxToResult(rangeCode,result,ignoreCase);if(range.to>=minOptimizationVal){const minUnOptVal=range.from>=minOptimizationVal?range.from:minOptimizationVal,maxUnOptVal=range.to,minOptIdx=charCodeToOptimizedIndex(minUnOptVal),maxOptIdx=charCodeToOptimizedIndex(maxUnOptVal);for(let currOptIdx=minOptIdx;currOptIdx<=maxOptIdx;currOptIdx++)result[currOptIdx]=currOptIdx}}}});break;case"Group":firstCharOptimizedIndices(atom2.value,result,ignoreCase);break;default:throw Error("Non Exhaustive Match")}const isOptionalQuantifier=void 0!==atom2.quantifier&&0===atom2.quantifier.atLeast;if("Group"===atom2.type&&!1===isWholeOptional(atom2)||"Group"!==atom2.type&&!1===isOptionalQuantifier)break}break;default:throw Error("non exhaustive match!")}return Object.values(result)}function addOptimizedIdxToResult(code,result,ignoreCase){const optimizedCharIdx=charCodeToOptimizedIndex(code);result[optimizedCharIdx]=optimizedCharIdx,!0===ignoreCase&&function(code,result){const char=String.fromCharCode(code),upperChar=char.toUpperCase();if(upperChar!==char){const optimizedCharIdx=charCodeToOptimizedIndex(upperChar.charCodeAt(0));result[optimizedCharIdx]=optimizedCharIdx}else{const lowerChar=char.toLowerCase();if(lowerChar!==char){const optimizedCharIdx=charCodeToOptimizedIndex(lowerChar.charCodeAt(0));result[optimizedCharIdx]=optimizedCharIdx}}}(code,result)}function findCode(setNode,targetCharCodes){return setNode.value.find(codeOrRange=>{if("number"==typeof codeOrRange)return targetCharCodes.includes(codeOrRange);{const range=codeOrRange;return void 0!==targetCharCodes.find(targetCode=>range.from<=targetCode&&targetCode<=range.to)}})}function isWholeOptional(ast){const quantifier=ast.quantifier;return!(!quantifier||0!==quantifier.atLeast)||!!ast.value&&(Array.isArray(ast.value)?ast.value.every(isWholeOptional):isWholeOptional(ast.value))}class CharCodeFinder extends BaseRegExpVisitor{constructor(targetCharCodes){super(),this.targetCharCodes=targetCharCodes,this.found=!1}visitChildren(node){if(!0!==this.found){switch(node.type){case"Lookahead":return void this.visitLookahead(node);case"NegativeLookahead":return void this.visitNegativeLookahead(node);case"Lookbehind":return void this.visitLookbehind(node);case"NegativeLookbehind":return void this.visitNegativeLookbehind(node)}super.visitChildren(node)}}visitCharacter(node){this.targetCharCodes.includes(node.value)&&(this.found=!0)}visitSet(node){node.complement?void 0===findCode(node,this.targetCharCodes)&&(this.found=!0):void 0!==findCode(node,this.targetCharCodes)&&(this.found=!0)}}function canMatchCharCode(charCodes,pattern){if(pattern instanceof RegExp){const ast=getRegExpAst(pattern),charCodeFinder=new CharCodeFinder(charCodes);return charCodeFinder.visit(ast),charCodeFinder.found}for(const char of pattern){const charCode=char.charCodeAt(0);if(charCodes.includes(charCode))return!0}return!1}const PATTERN="PATTERN";function analyzeTokenTypes(tokenTypes,options){const tracer=(options=Object.assign({safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:(msg,action)=>action()},options)).tracer;let onlyRelevantTypes;tracer("initCharCodeToOptimizedIndexMap",()=>{!function(){if(0===charCodeToOptimizedIdxMap.length){charCodeToOptimizedIdxMap=new Array(65536);for(let i=0;i<65536;i++)charCodeToOptimizedIdxMap[i]=i>255?255+~~(i/255):i}}()}),tracer("Reject Lexer.NA",()=>{onlyRelevantTypes=tokenTypes.filter(currType=>currType.PATTERN!==Lexer.NA)});let allTransformedPatterns,patternIdxToType,patternIdxToGroup,patternIdxToLongerAltIdxArr,patternIdxToPushMode,patternIdxToPopMode,patternIdxToCanLineTerminator,patternIdxToIsCustom,patternIdxToShort,emptyGroups,patternIdxToConfig,hasCustom=!1;tracer("Transform Patterns",()=>{hasCustom=!1,allTransformedPatterns=onlyRelevantTypes.map(currType=>{const currPattern=currType.PATTERN;if(currPattern instanceof RegExp){const regExpSource=currPattern.source;return 1!==regExpSource.length||"^"===regExpSource||"$"===regExpSource||"."===regExpSource||currPattern.ignoreCase?2!==regExpSource.length||"\\"!==regExpSource[0]||["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"].includes(regExpSource[1])?addStickyFlag(currPattern):regExpSource[1]:regExpSource}if("function"==typeof currPattern)return hasCustom=!0,{exec:currPattern};if("object"==typeof currPattern)return hasCustom=!0,currPattern;if("string"==typeof currPattern){if(1===currPattern.length)return currPattern;{const escapedRegExpString=currPattern.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&");return addStickyFlag(new RegExp(escapedRegExpString))}}throw Error("non exhaustive match")})}),tracer("misc mapping",()=>{patternIdxToType=onlyRelevantTypes.map(currType=>currType.tokenTypeIdx),patternIdxToGroup=onlyRelevantTypes.map(clazz=>{const groupName=clazz.GROUP;if(groupName!==Lexer.SKIPPED){if("string"==typeof groupName)return groupName;if(void 0===groupName)return!1;throw Error("non exhaustive match")}}),patternIdxToLongerAltIdxArr=onlyRelevantTypes.map(clazz=>{const longerAltType=clazz.LONGER_ALT;if(longerAltType){return Array.isArray(longerAltType)?longerAltType.map(type=>onlyRelevantTypes.indexOf(type)):[onlyRelevantTypes.indexOf(longerAltType)]}}),patternIdxToPushMode=onlyRelevantTypes.map(clazz=>clazz.PUSH_MODE),patternIdxToPopMode=onlyRelevantTypes.map(clazz=>Object.hasOwn(clazz,"POP_MODE"))}),tracer("Line Terminator Handling",()=>{const lineTerminatorCharCodes=getCharCodes(options.lineTerminatorCharacters);patternIdxToCanLineTerminator=onlyRelevantTypes.map(tokType=>!1),"onlyOffset"!==options.positionTracking&&(patternIdxToCanLineTerminator=onlyRelevantTypes.map(tokType=>Object.hasOwn(tokType,"LINE_BREAKS")?!!tokType.LINE_BREAKS:!1===checkLineBreaksIssues(tokType,lineTerminatorCharCodes)&&canMatchCharCode(lineTerminatorCharCodes,tokType.PATTERN)))}),tracer("Misc Mapping #2",()=>{patternIdxToIsCustom=onlyRelevantTypes.map(isCustomPattern),patternIdxToShort=allTransformedPatterns.map(isShortPattern),emptyGroups=onlyRelevantTypes.reduce((acc,clazz)=>{const groupName=clazz.GROUP;return"string"==typeof groupName&&groupName!==Lexer.SKIPPED&&(acc[groupName]=[]),acc},{}),patternIdxToConfig=allTransformedPatterns.map((x,idx)=>({pattern:allTransformedPatterns[idx],longerAlt:patternIdxToLongerAltIdxArr[idx],canLineTerminator:patternIdxToCanLineTerminator[idx],isCustom:patternIdxToIsCustom[idx],short:patternIdxToShort[idx],group:patternIdxToGroup[idx],push:patternIdxToPushMode[idx],pop:patternIdxToPopMode[idx],tokenTypeIdx:patternIdxToType[idx],tokenType:onlyRelevantTypes[idx]}))});let canBeOptimized=!0,charCodeToPatternIdxToConfig=[];return options.safeMode||tracer("First Char Optimization",()=>{charCodeToPatternIdxToConfig=onlyRelevantTypes.reduce((result,currTokType,idx)=>{if("string"==typeof currTokType.PATTERN){const optimizedIdx=charCodeToOptimizedIndex(currTokType.PATTERN.charCodeAt(0));addToMapOfArrays(result,optimizedIdx,patternIdxToConfig[idx])}else if(Array.isArray(currTokType.START_CHARS_HINT)){let lastOptimizedIdx;currTokType.START_CHARS_HINT.forEach(charOrInt=>{const currOptimizedIdx=charCodeToOptimizedIndex("string"==typeof charOrInt?charOrInt.charCodeAt(0):charOrInt);lastOptimizedIdx!==currOptimizedIdx&&(lastOptimizedIdx=currOptimizedIdx,addToMapOfArrays(result,currOptimizedIdx,patternIdxToConfig[idx]))})}else if(currTokType.PATTERN instanceof RegExp)if(currTokType.PATTERN.unicode)canBeOptimized=!1,options.ensureOptimizations&&PRINT_ERROR(`${failedOptimizationPrefixMsg}\tUnable to analyze < ${currTokType.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 optimizedCodes=getOptimizedStartCodesIndices(currTokType.PATTERN,options.ensureOptimizations);0===optimizedCodes.length&&(canBeOptimized=!1),optimizedCodes.forEach(code=>{addToMapOfArrays(result,code,patternIdxToConfig[idx])})}else options.ensureOptimizations&&PRINT_ERROR(`${failedOptimizationPrefixMsg}\tTokenType: <${currTokType.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`),canBeOptimized=!1;return result},[])}),{emptyGroups:emptyGroups,patternIdxToConfig:patternIdxToConfig,charCodeToPatternIdxToConfig:charCodeToPatternIdxToConfig,hasCustom:hasCustom,canBeOptimized:canBeOptimized}}function validatePatterns(tokenTypes,validModesNames){let errors=[];const missingResult=function(tokenTypes){const tokenTypesWithMissingPattern=tokenTypes.filter(currType=>!Object.hasOwn(currType,"PATTERN")),errors=tokenTypesWithMissingPattern.map(currType=>({message:"Token Type: ->"+currType.name+"<- missing static 'PATTERN' property",type:LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[currType]})),valid=tokenTypes.filter(x=>!tokenTypesWithMissingPattern.includes(x));return{errors:errors,valid:valid}}(tokenTypes);errors=errors.concat(missingResult.errors);const invalidResult=function(tokenTypes){const tokenTypesWithInvalidPattern=tokenTypes.filter(currType=>{const pattern=currType.PATTERN;return!(pattern instanceof RegExp||"function"==typeof pattern||Object.hasOwn(pattern,"exec")||"string"==typeof pattern)}),errors=tokenTypesWithInvalidPattern.map(currType=>({message:"Token Type: ->"+currType.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[currType]})),valid=tokenTypes.filter(x=>!tokenTypesWithInvalidPattern.includes(x));return{errors:errors,valid:valid}}(missingResult.valid),validTokenTypes=invalidResult.valid;return errors=errors.concat(invalidResult.errors),errors=errors.concat(function(tokenTypes){let errors=[];const withRegExpPatterns=tokenTypes.filter(currTokType=>currTokType[PATTERN]instanceof RegExp);return errors=errors.concat(function(tokenTypes){class EndAnchorFinder extends BaseRegExpVisitor{constructor(){super(...arguments),this.found=!1}visitEndAnchor(node){this.found=!0}}const invalidRegex=tokenTypes.filter(currType=>{const pattern=currType.PATTERN;try{const regexpAst=getRegExpAst(pattern),endAnchorVisitor=new EndAnchorFinder;return endAnchorVisitor.visit(regexpAst),endAnchorVisitor.found}catch(e){return end_of_input.test(pattern.source)}}),errors=invalidRegex.map(currType=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+currType.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[currType]}));return errors}(withRegExpPatterns)),errors=errors.concat(function(tokenTypes){class StartAnchorFinder extends BaseRegExpVisitor{constructor(){super(...arguments),this.found=!1}visitStartAnchor(node){this.found=!0}}const invalidRegex=tokenTypes.filter(currType=>{const pattern=currType.PATTERN;try{const regexpAst=getRegExpAst(pattern),startAnchorVisitor=new StartAnchorFinder;return startAnchorVisitor.visit(regexpAst),startAnchorVisitor.found}catch(e){return start_of_input.test(pattern.source)}}),errors=invalidRegex.map(currType=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+currType.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[currType]}));return errors}(withRegExpPatterns)),errors=errors.concat(function(tokenTypes){const invalidFlags=tokenTypes.filter(currType=>{const pattern=currType[PATTERN];return pattern instanceof RegExp&&(pattern.multiline||pattern.global)}),errors=invalidFlags.map(currType=>({message:"Token Type: ->"+currType.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[currType]}));return errors}(withRegExpPatterns)),errors=errors.concat(function(tokenTypes){const found=[];let identicalPatterns=tokenTypes.map(outerType=>tokenTypes.reduce((result,innerType)=>(outerType.PATTERN.source!==innerType.PATTERN.source||found.includes(innerType)||innerType.PATTERN===Lexer.NA||(found.push(innerType),result.push(innerType)),result),[]));identicalPatterns=identicalPatterns.filter(Boolean);const errors=identicalPatterns.filter(currIdenticalSet=>currIdenticalSet.length>1).map(setOfIdentical=>{const tokenTypeNames=setOfIdentical.map(currType=>currType.name);return{message:`The same RegExp pattern ->${setOfIdentical[0].PATTERN}<-has been used in all of the following Token Types: ${tokenTypeNames.join(", ")} <-`,type:LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:setOfIdentical}});return errors}(withRegExpPatterns)),errors=errors.concat(function(tokenTypes){const matchesEmptyString=tokenTypes.filter(currType=>currType.PATTERN.test("")),errors=matchesEmptyString.map(currType=>({message:"Token Type: ->"+currType.name+"<- static 'PATTERN' must not match an empty string",type:LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[currType]}));return errors}(withRegExpPatterns)),errors}(validTokenTypes)),errors=errors.concat(function(tokenTypes){const invalidTypes=tokenTypes.filter(clazz=>{if(!Object.hasOwn(clazz,"GROUP"))return!1;const group=clazz.GROUP;return group!==Lexer.SKIPPED&&group!==Lexer.NA&&!("string"==typeof group)}),errors=invalidTypes.map(currType=>({message:"Token Type: ->"+currType.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[currType]}));return errors}(validTokenTypes)),errors=errors.concat(function(tokenTypes,validModes){const invalidModes=tokenTypes.filter(clazz=>void 0!==clazz.PUSH_MODE&&!validModes.includes(clazz.PUSH_MODE)),errors=invalidModes.map(tokType=>({message:`Token Type: ->${tokType.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${tokType.PUSH_MODE}<-which does not exist`,type:LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[tokType]}));return errors}(validTokenTypes,validModesNames)),errors=errors.concat(function(tokenTypes){const errors=[],canBeTested=tokenTypes.reduce((result,tokType,idx)=>{const pattern=tokType.PATTERN;return pattern===Lexer.NA||("string"==typeof pattern?result.push({str:pattern,idx:idx,tokenType:tokType}):pattern instanceof RegExp&&(regExp=pattern,void 0===[".","\\","[","]","|","^","$","(",")","?","*","+","{"].find(char=>-1!==regExp.source.indexOf(char)))&&result.push({str:pattern.source,idx:idx,tokenType:tokType})),result;var regExp},[]);return tokenTypes.forEach((aTokType,aIdx)=>{canBeTested.forEach(({str:bStr,idx:bIdx,tokenType:bTokType})=>{if(aIdx<bIdx&&function(str,pattern){if(pattern instanceof RegExp){if(/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(pattern.source))return!1;const regExpArray=pattern.exec(str);return null!==regExpArray&&0===regExpArray.index}if("function"==typeof pattern)return pattern(str,0,[],{});if(Object.hasOwn(pattern,"exec"))return pattern.exec(str,0,[],{});if("string"==typeof pattern)return pattern===str;throw Error("non exhaustive match")}(bStr,aTokType.PATTERN)){const msg=`Token: ->${bTokType.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${aTokType.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;errors.push({message:msg,type:LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[aTokType,bTokType]})}})}),errors}(validTokenTypes)),errors}const end_of_input=/[^\\][$]/;const start_of_input=/[^\\[][\^]|^\^/;function addStickyFlag(pattern){const flags=pattern.ignoreCase?"iy":"y";return new RegExp(`${pattern.source}`,flags)}function performWarningRuntimeChecks(lexerDefinition,trackLines,lineTerminatorCharacters){const warnings=[];let hasAnyLineBreak=!1;const concreteTokenTypes=Object.values(lexerDefinition.modes||{}).flat().filter(Boolean).filter(currType=>currType[PATTERN]!==Lexer.NA),terminatorCharCodes=getCharCodes(lineTerminatorCharacters);return trackLines&&concreteTokenTypes.forEach(tokType=>{const currIssue=checkLineBreaksIssues(tokType,terminatorCharCodes);if(!1!==currIssue){const message=function(tokType,details){if(details.issue===LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <${tokType.name}> Token Type\n\t Root cause: ${details.errMsg}.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(details.issue===LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <${tokType.name}> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}(tokType,currIssue),warningDescriptor={message:message,type:currIssue.issue,tokenType:tokType};warnings.push(warningDescriptor)}else Object.hasOwn(tokType,"LINE_BREAKS")?!0===tokType.LINE_BREAKS&&(hasAnyLineBreak=!0):canMatchCharCode(terminatorCharCodes,tokType.PATTERN)&&(hasAnyLineBreak=!0)}),trackLines&&!hasAnyLineBreak&&warnings.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:LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),warnings}function isCustomPattern(tokenType){const pattern=tokenType.PATTERN;if(pattern instanceof RegExp)return!1;if("function"==typeof pattern)return!0;if(Object.hasOwn(pattern,"exec"))return!0;if("string"==typeof pattern)return!1;throw Error("non exhaustive match")}function isShortPattern(pattern){return"string"==typeof pattern&&1===pattern.length&&pattern.charCodeAt(0)}const LineTerminatorOptimizedTester={test:function(text){const len=text.length;for(let i=this.lastIndex;i<len;i++){const c=text.charCodeAt(i);if(10===c)return this.lastIndex=i+1,!0;if(13===c)return 10===text.charCodeAt(i+1)?this.lastIndex=i+2:this.lastIndex=i+1,!0}return!1},lastIndex:0};function checkLineBreaksIssues(tokType,lineTerminatorCharCodes){if(Object.hasOwn(tokType,"LINE_BREAKS"))return!1;if(tokType.PATTERN instanceof RegExp){try{canMatchCharCode(lineTerminatorCharCodes,tokType.PATTERN)}catch(e){return{issue:LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if("string"==typeof tokType.PATTERN)return!1;if(isCustomPattern(tokType))return{issue:LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function getCharCodes(charsOrCodes){return charsOrCodes.map(numOrString=>"string"==typeof numOrString?numOrString.charCodeAt(0):numOrString)}function addToMapOfArrays(map2,key,value){void 0===map2[key]?map2[key]=[value]:map2[key].push(value)}const minOptimizationVal=256;let charCodeToOptimizedIdxMap=[];function charCodeToOptimizedIndex(charCode){return charCode<minOptimizationVal?charCode:charCodeToOptimizedIdxMap[charCode]}function tokenStructuredMatcher(tokInstance,tokConstructor){const instanceType=tokInstance.tokenTypeIdx;return instanceType===tokConstructor.tokenTypeIdx||!0===tokConstructor.isParent&&!0===tokConstructor.categoryMatchesMap[instanceType]}function tokenStructuredMatcherNoCategories(token,tokType){return token.tokenTypeIdx===tokType.tokenTypeIdx}let tokenShortNameIdx=1;const tokenIdxToClass={};function augmentTokenTypes(tokenTypes){const tokenTypesAndParents=function(tokenTypes){let result=[...tokenTypes],categories=tokenTypes,searching=!0;for(;searching;){categories=categories.map(currTokType=>currTokType.CATEGORIES).flat().filter(Boolean);const newCategories=categories.filter(x=>!result.includes(x));result=result.concat(newCategories),0===newCategories.length?searching=!1:categories=newCategories}return result}(tokenTypes);!function(tokenTypes){tokenTypes.forEach(currTokType=>{var tokType;hasShortKeyProperty(currTokType)||(tokenIdxToClass[tokenShortNameIdx]=currTokType,currTokType.tokenTypeIdx=tokenShortNameIdx++),hasCategoriesProperty(currTokType)&&!Array.isArray(currTokType.CATEGORIES)&&(currTokType.CATEGORIES=[currTokType.CATEGORIES]),hasCategoriesProperty(currTokType)||(currTokType.CATEGORIES=[]),tokType=currTokType,Object.hasOwn(null!=tokType?tokType:{},"categoryMatches")||(currTokType.categoryMatches=[]),function(tokType){return Object.hasOwn(null!=tokType?tokType:{},"categoryMatchesMap")}(currTokType)||(currTokType.categoryMatchesMap={})})}(tokenTypesAndParents),function(tokenTypes){tokenTypes.forEach(currTokType=>{singleAssignCategoriesToksMap([],currTokType)})}(tokenTypesAndParents),function(tokenTypes){tokenTypes.forEach(currTokType=>{currTokType.categoryMatches=[],Object.keys(currTokType.categoryMatchesMap).forEach(key=>{currTokType.categoryMatches.push(tokenIdxToClass[key].tokenTypeIdx)})})}(tokenTypesAndParents),tokenTypesAndParents.forEach(tokType=>{tokType.isParent=tokType.categoryMatches.length>0})}function singleAssignCategoriesToksMap(path,nextNode){path.forEach(pathNode=>{nextNode.categoryMatchesMap[pathNode.tokenTypeIdx]=!0}),nextNode.CATEGORIES.forEach(nextCategory=>{const newPath=path.concat(nextNode);newPath.includes(nextCategory)||singleAssignCategoriesToksMap(newPath,nextCategory)})}function hasShortKeyProperty(tokType){return Object.hasOwn(null!=tokType?tokType:{},"tokenTypeIdx")}function hasCategoriesProperty(tokType){return Object.hasOwn(null!=tokType?tokType:{},"CATEGORIES")}function isTokenType(tokType){return Object.hasOwn(null!=tokType?tokType:{},"tokenTypeIdx")}const defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:token=>`Unable to pop Lexer Mode after encountering Token ->${token.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(fullText,startOffset,length,line,column,mode)=>`unexpected character: ->${fullText.charAt(startOffset)}<- at offset: ${startOffset}, skipped ${length} characters.`};var LexerDefinitionErrorType,LexerDefinitionErrorType2;(LexerDefinitionErrorType2=LexerDefinitionErrorType||(LexerDefinitionErrorType={}))[LexerDefinitionErrorType2.MISSING_PATTERN=0]="MISSING_PATTERN",LexerDefinitionErrorType2[LexerDefinitionErrorType2.INVALID_PATTERN=1]="INVALID_PATTERN",LexerDefinitionErrorType2[LexerDefinitionErrorType2.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",LexerDefinitionErrorType2[LexerDefinitionErrorType2.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",LexerDefinitionErrorType2[LexerDefinitionErrorType2.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",LexerDefinitionErrorType2[LexerDefinitionErrorType2.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",LexerDefinitionErrorType2[LexerDefinitionErrorType2.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",LexerDefinitionErrorType2[LexerDefinitionErrorType2.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",LexerDefinitionErrorType2[LexerDefinitionErrorType2.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",LexerDefinitionErrorType2[LexerDefinitionErrorType2.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",LexerDefinitionErrorType2[LexerDefinitionErrorType2.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",LexerDefinitionErrorType2[LexerDefinitionErrorType2.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",LexerDefinitionErrorType2[LexerDefinitionErrorType2.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",LexerDefinitionErrorType2[LexerDefinitionErrorType2.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",LexerDefinitionErrorType2[LexerDefinitionErrorType2.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",LexerDefinitionErrorType2[LexerDefinitionErrorType2.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",LexerDefinitionErrorType2[LexerDefinitionErrorType2.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",LexerDefinitionErrorType2[LexerDefinitionErrorType2.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";const DEFAULT_LEXER_CONFIG={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(DEFAULT_LEXER_CONFIG);class Lexer{constructor(lexerDefinition,config=DEFAULT_LEXER_CONFIG){if(this.lexerDefinition=lexerDefinition,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=(phaseDesc,phaseImpl)=>{if(!0===this.traceInitPerf){this.traceInitIndent++;const indent=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${indent}--\x3e <${phaseDesc}>`);const{time:time,value:value}=timer(phaseImpl),traceMethod=time>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`),this.traceInitIndent--,value}return phaseImpl()},"boolean"==typeof config)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=Object.assign({},DEFAULT_LEXER_CONFIG,config);const traceInitVal=this.config.traceInitPerf;!0===traceInitVal?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof traceInitVal&&(this.traceInitMaxIdent=traceInitVal,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let actualDefinition,hasOnlySingleMode=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===DEFAULT_LEXER_CONFIG.lineTerminatorsPattern)this.config.lineTerminatorsPattern=LineTerminatorOptimizedTester;else if(this.config.lineTerminatorCharacters===DEFAULT_LEXER_CONFIG.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(config.safeMode&&config.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),Array.isArray(lexerDefinition)?actualDefinition={modes:{defaultMode:[...lexerDefinition]},defaultMode:"defaultMode"}:(hasOnlySingleMode=!1,actualDefinition=Object.assign({},lexerDefinition))}),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(lexerDefinition){const errors=[];return Object.hasOwn(lexerDefinition,"defaultMode")||errors.push({message:"A MultiMode Lexer cannot be initialized without a <defaultMode> property in its definition\n",type:LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(lexerDefinition,"modes")||errors.push({message:"A MultiMode Lexer cannot be initialized without a <modes> property in its definition\n",type:LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(lexerDefinition,"modes")&&Object.hasOwn(lexerDefinition,"defaultMode")&&!Object.hasOwn(lexerDefinition.modes,lexerDefinition.defaultMode)&&errors.push({message:`A MultiMode Lexer cannot be initialized with a defaultMode: <${lexerDefinition.defaultMode}>which does not exist\n`,type:LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(lexerDefinition,"modes")&&Object.keys(lexerDefinition.modes).forEach(currModeName=>{const currModeValue=lexerDefinition.modes[currModeName];currModeValue.forEach((currTokType,currIdx)=>{void 0===currTokType?errors.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${currModeName}> at index: <${currIdx}>\n`,type:LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(currTokType,"LONGER_ALT")&&(Array.isArray(currTokType.LONGER_ALT)?currTokType.LONGER_ALT:[currTokType.LONGER_ALT]).forEach(currLongerAlt=>{void 0===currLongerAlt||currModeValue.includes(currLongerAlt)||errors.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${currLongerAlt.name}> on token <${currTokType.name}> outside of mode <${currModeName}>\n`,type:LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),errors}(actualDefinition,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(performWarningRuntimeChecks(actualDefinition,this.trackStartLines,this.config.lineTerminatorCharacters))})),actualDefinition.modes=actualDefinition.modes?actualDefinition.modes:{},Object.entries(actualDefinition.modes).forEach(([currModeName,currModeValue])=>{actualDefinition.modes[currModeName]=currModeValue.filter(currTokType=>void 0!==currTokType)});const allModeNames=Object.keys(actualDefinition.modes);if(Object.entries(actualDefinition.modes).forEach(([currModName,currModDef])=>{this.TRACE_INIT(`Mode: <${currModName}> processing`,()=>{if(this.modes.push(currModName),!1===this.config.skipValidations&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(validatePatterns(currModDef,allModeNames))}),0===this.lexerDefinitionErrors.length){let currAnalyzeResult;augmentTokenTypes(currModDef),this.TRACE_INIT("analyzeTokenTypes",()=>{currAnalyzeResult=analyzeTokenTypes(currModDef,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:config.positionTracking,ensureOptimizations:config.ensureOptimizations,safeMode:config.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[currModName]=currAnalyzeResult.patternIdxToConfig,this.charCodeToPatternIdxToConfig[currModName]=currAnalyzeResult.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,currAnalyzeResult.emptyGroups),this.hasCustom=currAnalyzeResult.hasCustom||this.hasCustom,this.canModeBeOptimized[currModName]=currAnalyzeResult.canBeOptimized}})}),this.defaultMode=actualDefinition.defaultMode,this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){const allErrMessagesString=this.lexerDefinitionErrors.map(error=>error.message).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+allErrMessagesString)}this.lexerDefinitionWarning.forEach(warningDescriptor=>{PRINT_WARNING(warningDescriptor.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(hasOnlySingleMode&&(this.handleModes=()=>{}),!1===this.trackStartLines&&(this.computeNewColumn=x=>x),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=()=>{}),/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 unOptimizedModes=Object.entries(this.canModeBeOptimized).reduce((cannotBeOptimized,[modeName,canBeOptimized])=>(!1===canBeOptimized&&cannotBeOptimized.push(modeName),cannotBeOptimized),[]);if(config.ensureOptimizations&&unOptimizedModes.length>0)throw Error(`Lexer Modes: < ${unOptimizedModes.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",()=>{regExpAstCache={}}),this.TRACE_INIT("toFastProperties",()=>{toFastProperties(this)})})}tokenize(text,initialMode=this.defaultMode){if(this.lexerDefinitionErrors.length>0){const allErrMessagesString=this.lexerDefinitionErrors.map(error=>error.message).join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+allErrMessagesString)}return this.tokenizeInternal(text,initialMode)}tokenizeInternal(text,initialMode){let i,j,k,matchAltImage,longerAlt,matchedImage,payload,altPayload,imageLength,group,tokType,newToken,errLength,msg,match;const orgText=text,orgLength=orgText.length;let offset=0,matchedTokensIndex=0;const guessedNumberOfTokens=this.hasCustom?0:Math.floor(text.length/10),matchedTokens=new Array(guessedNumberOfTokens),errors=[];let line=this.trackStartLines?1:void 0,column=this.trackStartLines?1:void 0;const groups=function(emptyGroups){const clonedResult={};return Object.keys(emptyGroups).forEach(currKey=>{const currGroupValue=emptyGroups[currKey];if(!Array.isArray(currGroupValue))throw Error("non exhaustive match");clonedResult[currKey]=[]}),clonedResult}(this.emptyGroups),trackLines=this.trackStartLines,lineTerminatorPattern=this.config.lineTerminatorsPattern;let currModePatternsLength=0,patternIdxToConfig=[],currCharCodeToPatternIdxToConfig=[];const modeStack=[],emptyArray=[];Object.freeze(emptyArray);let isOptimizedMode=!1;const pop_mode=popToken=>{if(1===modeStack.length&&void 0===popToken.tokenType.PUSH_MODE){const msg2=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(popToken);errors.push({offset:popToken.startOffset,line:popToken.startLine,column:popToken.startColumn,length:popToken.image.length,message:msg2})}else{modeStack.pop();const newMode=modeStack.at(-1);patternIdxToConfig=this.patternIdxToConfig[newMode],currCharCodeToPatternIdxToConfig=this.charCodeToPatternIdxToConfig[newMode],currModePatternsLength=patternIdxToConfig.length;const modeCanBeOptimized=this.canModeBeOptimized[newMode]&&!1===this.config.safeMode;isOptimizedMode=!(!currCharCodeToPatternIdxToConfig||!modeCanBeOptimized)}};function push_mode(newMode){modeStack.push(newMode),currCharCodeToPatternIdxToConfig=this.charCodeToPatternIdxToConfig[newMode],patternIdxToConfig=this.patternIdxToConfig[newMode],currModePatternsLength=patternIdxToConfig.length,currModePatternsLength=patternIdxToConfig.length;const modeCanBeOptimized=this.canModeBeOptimized[newMode]&&!1===this.config.safeMode;isOptimizedMode=!(!currCharCodeToPatternIdxToConfig||!modeCanBeOptimized)}let currConfig;push_mode.call(this,initialMode);const recoveryEnabled=this.config.recoveryEnabled;for(;offset<orgLength;){matchedImage=null,imageLength=-1;const nextCharCode=orgText.charCodeAt(offset);let chosenPatternIdxToConfig;if(isOptimizedMode){const optimizedCharIdx=charCodeToOptimizedIndex(nextCharCode),possiblePatterns=currCharCodeToPatternIdxToConfig[optimizedCharIdx];chosenPatternIdxToConfig=void 0!==possiblePatterns?possiblePatterns:emptyArray}else chosenPatternIdxToConfig=patternIdxToConfig;const chosenPatternsLength=chosenPatternIdxToConfig.length;for(i=0;i<chosenPatternsLength;i++){currConfig=chosenPatternIdxToConfig[i];const currPattern=currConfig.pattern;payload=null;const singleCharCode=currConfig.short;if(!1!==singleCharCode?nextCharCode===singleCharCode&&(imageLength=1,matchedImage=currPattern):!0===currConfig.isCustom?(match=currPattern.exec(orgText,offset,matchedTokens,groups),null!==match?(matchedImage=match[0],imageLength=matchedImage.length,void 0!==match.payload&&(payload=match.payload)):matchedImage=null):(currPattern.lastIndex=offset,imageLength=this.matchLength(currPattern,text,offset)),-1!==imageLength){if(longerAlt=currConfig.longerAlt,void 0!==longerAlt){matchedImage=text.substring(offset,offset+imageLength);const longerAltLength=longerAlt.length;for(k=0;k<longerAltLength;k++){const longerAltConfig=patternIdxToConfig[longerAlt[k]],longerAltPattern=longerAltConfig.pattern;if(altPayload=null,!0===longerAltConfig.isCustom?(match=longerAltPattern.exec(orgText,offset,matchedTokens,groups),null!==match?(matchAltImage=match[0],void 0!==match.payload&&(altPayload=match.payload)):matchAltImage=null):(longerAltPattern.lastIndex=offset,matchAltImage=this.match(longerAltPattern,text,offset)),matchAltImage&&matchAltImage.length>matchedImage.length){matchedImage=matchAltImage,imageLength=matchAltImage.length,payload=altPayload,currConfig=longerAltConfig;break}}}break}}if(-1!==imageLength){if(group=currConfig.group,void 0!==group&&(matchedImage=null!==matchedImage?matchedImage:text.substring(offset,offset+imageLength),tokType=currConfig.tokenTypeIdx,newToken=this.createTokenInstance(matchedImage,offset,tokType,currConfig.tokenType,line,column,imageLength),this.handlePayload(newToken,payload),!1===group?matchedTokensIndex=this.addToken(matchedTokens,matchedTokensIndex,newToken):groups[group].push(newToken)),!0===trackLines&&!0===currConfig.canLineTerminator){let foundTerminator,lastLTEndOffset,numOfLTsInMatch=0;lineTerminatorPattern.lastIndex=0;do{matchedImage=null!==matchedImage?matchedImage:text.substring(offset,offset+imageLength),foundTerminator=lineTerminatorPattern.test(matchedImage),!0===foundTerminator&&(lastLTEndOffset=lineTerminatorPattern.lastIndex-1,numOfLTsInMatch++)}while(!0===foundTerminator);0!==numOfLTsInMatch?(line+=numOfLTsInMatch,column=imageLength-lastLTEndOffset,this.updateTokenEndLineColumnLocation(newToken,group,lastLTEndOffset,numOfLTsInMatch,line,column,imageLength)):column=this.computeNewColumn(column,imageLength)}else column=this.computeNewColumn(column,imageLength);offset+=imageLength,this.handleModes(currConfig,pop_mode,push_mode,newToken)}else{const errorStartOffset=offset,errorLine=line,errorColumn=column;let foundResyncPoint=!1===recoveryEnabled;for(;!1===foundResyncPoint&&offset<orgLength;)for(offset++,j=0;j<currModePatternsLength;j++){const currConfig2=patternIdxToConfig[j],currPattern=currConfig2.pattern,singleCharCode=currConfig2.short;if(!1!==singleCharCode?orgText.charCodeAt(offset)===singleCharCode&&(foundResyncPoint=!0):!0===currConfig2.isCustom?foundResyncPoint=null!==currPattern.exec(orgText,offset,matchedTokens,groups):(currPattern.lastIndex=offset,foundResyncPoint=null!==currPattern.exec(text)),!0===foundResyncPoint)break}if(errLength=offset-errorStartOffset,column=this.computeNewColumn(column,errLength),msg=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(orgText,errorStartOffset,errLength,errorLine,errorColumn,modeStack.at(-1)),errors.push({offset:errorStartOffset,line:errorLine,column:errorColumn,length:errLength,message:msg}),!1===recoveryEnabled)break}}return this.hasCustom||(matchedTokens.length=matchedTokensIndex),{tokens:matchedTokens,groups:groups,errors:errors}}handleModes(config,pop_mode,push_mode,newToken){if(!0===config.pop){const pushMode=config.push;pop_mode(newToken),void 0!==pushMode&&push_mode.call(this,pushMode)}else void 0!==config.push&&push_mode.call(this,config.push)}updateTokenEndLineColumnLocation(newToken,group,lastLTIdx,numOfLTsInMatch,line,column,imageLength){let lastCharIsLT,fixForEndingInLT;void 0!==group&&(lastCharIsLT=lastLTIdx===imageLength-1,fixForEndingInLT=lastCharIsLT?-1:0,1===numOfLTsInMatch&&!0===lastCharIsLT||(newToken.endLine=line+fixForEndingInLT,newToken.endColumn=column-1-fixForEndingInLT))}computeNewColumn(oldColumn,imageLength){return oldColumn+imageLength}createOffsetOnlyToken(image,startOffset,tokenTypeIdx,tokenType){return{image:image,startOffset:startOffset,tokenTypeIdx:tokenTypeIdx,tokenType:tokenType}}createStartOnlyToken(image,startOffset,tokenTypeIdx,tokenType,startLine,startColumn){return{image:image,startOffset:startOffset,startLine:startLine,startColumn:startColumn,tokenTypeIdx:tokenTypeIdx,tokenType:tokenType}}createFullToken(image,startOffset,tokenTypeIdx,tokenType,startLine,startColumn,imageLength){return{image:image,startOffset:startOffset,endOffset:startOffset+imageLength-1,startLine:startLine,endLine:startLine,startColumn:startColumn,endColumn:startColumn+imageLength-1,tokenTypeIdx:tokenTypeIdx,tokenType:tokenType}}addTokenUsingPush(tokenVector,index,tokenToAdd){return tokenVector.push(tokenToAdd),index}addTokenUsingMemberAccess(tokenVector,index,tokenToAdd){return tokenVector[index]=tokenToAdd,++index}handlePayloadNoCustom(token,payload){}handlePayloadWithCustom(token,payload){null!==payload&&(token.payload=payload)}match(pattern,text,offset){return!0===pattern.test(text)?text.substring(offset,pattern.lastIndex):null}matchLength(pattern,text,offset){return!0===pattern.test(text)?pattern.lastIndex-offset:-1}}function tokenLabel(tokType){return hasTokenLabel(tokType)?tokType.LABEL:tokType.name}function hasTokenLabel(obj){return"string"==typeof obj.LABEL&&""!==obj.LABEL}Lexer.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",Lexer.NA=/NOT_APPLICABLE/;function createToken(config){return function(config){const pattern=config.pattern,tokenType={};tokenType.name=config.name,void 0!==pattern&&(tokenType.PATTERN=pattern);if(Object.hasOwn(config,"parent"))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";Object.hasOwn(config,"categories")&&(tokenType.CATEGORIES=config.categories);augmentTokenTypes([tokenType]),Object.hasOwn(config,"label")&&(tokenType.LABEL=config.label);Object.hasOwn(config,"group")&&(tokenType.GROUP=config.group);Object.hasOwn(config,"pop_mode")&&(tokenType.POP_MODE=config.pop_mode);Object.hasOwn(config,"push_mode")&&(tokenType.PUSH_MODE=config.push_mode);Object.hasOwn(config,"longer_alt")&&(tokenType.LONGER_ALT=config.longer_alt);Object.hasOwn(config,"line_breaks")&&(tokenType.LINE_BREAKS=config.line_breaks);Object.hasOwn(config,"start_chars_hint")&&(tokenType.START_CHARS_HINT=config.start_chars_hint);return tokenType}(config)}const EOF=createToken({name:"EOF",pattern:Lexer.NA});function createTokenInstance(tokType,image,startOffset,endOffset,startLine,endLine,startColumn,endColumn){return{image:image,startOffset:startOffset,endOffset:endOffset,startLine:startLine,endLine:endLine,startColumn:startColumn,endColumn:endColumn,tokenTypeIdx:tokType.tokenTypeIdx,tokenType:tokType}}function tokenMatcher(token,tokType){return tokenStructuredMatcher(token,tokType)}augmentTokenTypes([EOF]);const defaultParserErrorProvider={buildMismatchTokenMessage:({expected:expected,actual:actual,previous:previous,ruleName:ruleName})=>`Expecting ${hasTokenLabel(expected)?`--\x3e ${tokenLabel(expected)} <--`:`token of type --\x3e ${expected.name} <--`} but found --\x3e '${actual.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:firstRedundant,ruleName:ruleName})=>"Redundant input, expecting EOF but found: "+firstRedundant.image,buildNoViableAltMessage({expectedPathsPerAlt:expectedPathsPerAlt,actual:actual,previous:previous,customUserDescription:customUserDescription,ruleName:ruleName}){const errSuffix="\nbut found: '"+actual[0].image+"'";if(customUserDescription)return"Expecting: "+customUserDescription+errSuffix;return"Expecting: "+`one of these possible Token sequences:\n${expectedPathsPerAlt.reduce((result,currAltPaths)=>result.concat(currAltPaths),[]).map(currPath=>`[${currPath.map(currTokenType=>tokenLabel(currTokenType)).join(", ")}]`).map((itemMsg,idx)=>` ${idx+1}. ${itemMsg}`).join("\n")}`+errSuffix},buildEarlyExitMessage({expectedIterationPaths:expectedIterationPaths,actual:actual,customUserDescription:customUserDescription,ruleName:ruleName}){const errSuffix="\nbut found: '"+actual[0].image+"'";if(customUserDescription)return"Expecting: "+customUserDescription+errSuffix;return"Expecting: "+`expecting at least one iteration which starts with one of these possible Token sequences::\n <${expectedIterationPaths.map(currPath=>`[${currPath.map(currTokenType=>tokenLabel(currTokenType)).join(",")}]`).join(" ,")}>`+errSuffix}};Object.freeze(defaultParserErrorProvider);const defaultGrammarResolverErrorProvider={buildRuleNotFoundError:(topLevelRule,undefinedRule)=>"Invalid grammar, reference to a rule which is not defined: ->"+undefinedRule.nonTerminalName+"<-\ninside top level rule: ->"+topLevelRule.name+"<-"},defaultGrammarValidatorErrorProvider={buildDuplicateFoundError(topLevelRule,duplicateProds){const topLevelName=topLevelRule.name,duplicateProd=duplicateProds[0],index=duplicateProd.idx,dslName=getProductionDslName$1(duplicateProd),extraArgument=(prod=duplicateProd)instanceof Terminal?prod.terminalType.name:prod instanceof NonTerminal?prod.nonTerminalName:"";var prod;let msg=`->${dslName}${index>0?index:""}<- ${extraArgument?`with argument: ->${extraArgument}<-`:""}\n appears more than once (${duplicateProds.length} times) in the top level rule: ->${topLevelName}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;return msg=msg.replace(/[ \t]+/g," "),msg=msg.replace(/\s\s+/g,"\n"),msg},buildNamespaceConflictError:rule=>`Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${rule.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(options){const pathMsg=options.prefixPath.map(currTok=>tokenLabel(currTok)).join(", "),occurrence=0===options.alternation.idx?"":options.alternation.idx;return`Ambiguous alternatives: <${options.ambiguityIndices.join(" ,")}> due to common lookahead prefix\nin <OR${occurrence}> inside <${options.topLevelRule.name}> Rule,\n<${pathMsg}> 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(options){const occurrence=0===options.alternation.idx?"":options.alternation.idx,isEmptyPath=0===options.prefixPath.length;let currMessage=`Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(" ,")}> in <OR${occurrence}> inside <${options.topLevelRule.name}> Rule,\n`;if(isEmptyPath)currMessage+="These alternatives are all empty (match no tokens), making them indistinguishable.\nOnly the last alternative may be empty.\n";else{currMessage+=`<${options.prefixPath.map(currtok=>tokenLabel(currtok)).join(", ")}> may appears as a prefix path in all these alternatives.\n`}return currMessage+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",currMessage},buildEmptyRepetitionError(options){let dslName=getProductionDslName$1(options.repetition);0!==options.repetition.idx&&(dslName+=options.repetition.idx);return`The repetition <${dslName}> within Rule <${options.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError:options=>"deprecated",buildEmptyAlternationError:options=>`Ambiguous empty alternative: <${options.emptyChoiceIdx+1}> in <OR${options.alternation.idx}> inside <${options.topLevelRule.name}> Rule.\nOnly the last alternative may be an empty alternative.`,buildTooManyAlternativesError:options=>`An Alternation cannot have more than 256 alternatives:\n<OR${options.alternation.idx}> inside <${options.topLevelRule.name}> Rule.\n has ${options.alternation.definition.length+1} alternatives.`,buildLeftRecursionError(options){const ruleName=options.topLevelRule.name;return`Left Recursion found in grammar.\nrule: <${ruleName}> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n ${`${ruleName} --\x3e ${options.leftRecursionPath.map(currRule=>currRule.name).concat([ruleName]).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:options=>"deprecated",buildDuplicateRuleNameError(options){let ruleName;ruleName=options.topLevelRule instanceof Rule?options.topLevelRule.name:options.topLevelRule;return`Duplicate definition, rule: ->${ruleName}<- is already defined in the grammar: ->${options.grammarName}<-`}};class GastRefResolverVisitor extends GAstVisitor{constructor(nameToTopRule,errMsgProvider){super(),this.nameToTopRule=nameToTopRule,this.errMsgProvider=errMsgProvider,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(prod=>{this.currTopLevel=prod,prod.accept(this)})}visitNonTerminal(node){const ref=this.nameToTopRule[node.nonTerminalName];if(ref)node.referencedRule=ref;else{const msg=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,node);this.errors.push({message:msg,type:ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:node.nonTerminalName})}}}class AbstractNextPossibleTokensWalker extends RestWalker{constructor(topProd,path){super(),this.topProd=topProd,this.path=path,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=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(prod,prevRest=[]){this.found||super.walk(prod,prevRest)}walkProdRef(refProd,currRest,prevRest){if(refProd.referencedRule.name===this.nextProductionName&&refProd.idx===this.nextProductionOccurrence){const fullRest=currRest.concat(prevRest);this.updateExpectedNext(),this.walk(refProd.referencedRule,fullRest)}}updateExpectedNext(){0===this.ruleStack.length?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class NextAfterTokenWalker extends AbstractNextPossibleTokensWalker{constructor(topProd,path){super(topProd,path),this.path=path,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(terminal,currRest,prevRest){if(this.isAtEndOfPath&&terminal.terminalType.name===this.nextTerminalName&&terminal.idx===this.nextTerminalOccurrence&&!this.found){const fullRest=currRest.concat(prevRest),restProd=new Alternative({definition:fullRest});this.possibleTokTypes=first(restProd),this.found=!0}}}class AbstractNextTerminalAfterProductionWalker extends RestWalker{constructor(topRule,occurrence){super(),this.topRule=topRule,this.occurrence=occurrence,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class NextTerminalAfterManyWalker extends AbstractNextTerminalAfterProductionWalker{walkMany(manyProd,currRest,prevRest){if(manyProd.idx===this.occurrence){const firstAfterMany=currRest.concat(prevRest)[0];this.result.isEndOfRule=void 0===firstAfterMany,firstAfterMany instanceof Terminal&&(this.result.token=firstAfterMany.terminalType,this.result.occurrence=firstAfterMany.idx)}else super.walkMany(manyProd,currRest,prevRest)}}class NextTerminalAfterManySepWalker extends AbstractNextTerminalAfterProductionWalker{walkManySep(manySepProd,currRest,prevRest){if(manySepProd.idx===this.occurrence){const firstAfterManySep=currRest.concat(prevRest)[0];this.result.isEndOfRule=void 0===firstAfterManySep,firstAfterManySep instanceof Terminal&&(this.result.token=firstAfterManySep.terminalType,this.result.occurrence=firstAfterManySep.idx)}else super.walkManySep(manySepProd,currRest,prevRest)}}class NextTerminalAfterAtLeastOneWalker extends AbstractNextTerminalAfterProductionWalker{walkAtLeastOne(atLeastOneProd,currRest,prevRest){if(atLeastOneProd.idx===this.occurrence){const firstAfterAtLeastOne=currRest.concat(prevRest)[0];this.result.isEndOfRule=void 0===firstAfterAtLeastOne,firstAfterAtLeastOne instanceof Terminal&&(this.result.token=firstAfterAtLeastOne.terminalType,this.result.occurrence=firstAfterAtLeastOne.idx)}else super.walkAtLeastOne(atLeastOneProd,currRest,prevRest)}}class NextTerminalAfterAtLeastOneSepWalker extends AbstractNextTerminalAfterProductionWalker{walkAtLeastOneSep(atleastOneSepProd,currRest,prevRest){if(atleastOneSepProd.idx===this.occurrence){const firstAfterfirstAfterAtLeastOneSep=currRest.concat(prevRest)[0];this.result.isEndOfRule=void 0===firstAfterfirstAfterAtLeastOneSep,firstAfterfirstAfterAtLeastOneSep instanceof Terminal&&(this.result.token=firstAfterfirstAfterAtLeastOneSep.terminalType,this.result.occurrence=firstAfterfirstAfterAtLeastOneSep.idx)}else super.walkAtLeastOneSep(atleastOneSepProd,currRest,prevRest)}}function possiblePathsFrom(targetDef,maxLength,currPath=[]){currPath=[...currPath];let result=[],i=0;function getAlternativesForProd(definition){const alternatives=possiblePathsFrom(definition.concat(targetDef.slice(i+1)),maxLength,currPath);return result.concat(alternatives)}for(;currPath.length<maxLength&&i<targetDef.length;){const prod=targetDef[i];if(prod instanceof Alternative)return getAlternativesForProd(prod.definition);if(prod instanceof NonTerminal)return getAlternativesForProd(prod.definition);if(prod instanceof Option$1)result=getAlternativesForProd(prod.definition);else{if(prod instanceof RepetitionMandatory){return getAlternativesForProd(prod.definition.concat([new Repetition({definition:prod.definition})]))}if(prod instanceof RepetitionMandatoryWithSeparator){return getAlternativesForProd([new Alternative({definition:prod.definition}),new Repetition({definition:[new Terminal({terminalType:prod.separator})].concat(prod.definition)})])}if(prod instanceof RepetitionWithSeparator){const newDef=prod.definition.concat([new Repetition({definition:[new Terminal({terminalType:prod.separator})].concat(prod.definition)})]);result=getAlternativesForProd(newDef)}else if(prod instanceof Repetition){const newDef=prod.definition.concat([new Repetition({definition:prod.definition})]);result=getAlternativesForProd(newDef)}else{if(prod instanceof Alternation)return prod.definition.forEach(currAlt=>{0!==currAlt.definition.length&&(result=getAlternativesForProd(currAlt.definition))}),result;if(!(prod instanceof Terminal))throw Error("non exhaustive match");currPath.push(prod.terminalType)}}i++}return result.push({partialPath:currPath,suffixDef:targetDef.slice(i)}),result}function expandTopLevelRule(topRule,currIdx,currRuleStack,currOccurrenceStack){const newRuleStack=[...currRuleStack];newRuleStack.push(topRule.name);const newCurrOccurrenceStack=[...currOccurrenceStack];return newCurrOccurrenceStack.push(1),{idx:currIdx,def:topRule.definition,ruleStack:newRuleStack,occurrenceStack:newCurrOccurrenceStack}}var PROD_TYPE,PROD_TYPE2;function getProdType$1(prod){if(prod instanceof Option$1||"Option"===prod)return PROD_TYPE.OPTION;if(prod instanceof Repetition||"Repetition"===prod)return PROD_TYPE.REPETITION;if(prod instanceof RepetitionMandatory||"RepetitionMandatory"===prod)return PROD_TYPE.REPETITION_MANDATORY;if(prod instanceof RepetitionMandatoryWithSeparator||"RepetitionMandatoryWithSeparator"===prod)return PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR;if(prod instanceof RepetitionWithSeparator||"RepetitionWithSeparator"===prod)return PROD_TYPE.REPETITION_WITH_SEPARATOR;if(prod instanceof Alternation||"Alternation"===prod)return PROD_TYPE.ALTERNATION;throw Error("non exhaustive match")}function getLookaheadPaths(options){const{occurrence:occurrence,rule:rule,prodType:prodType,maxLookahead:maxLookahead}=options,type=getProdType$1(prodType);return type===PROD_TYPE.ALTERNATION?getLookaheadPathsForOr(occurrence,rule,maxLookahead):getLookaheadPathsForOptionalProd(occurrence,rule,type,maxLookahead)}function buildAlternativesLookAheadFunc(alts,hasPredicates,tokenMatcher2,dynamicTokensEnabled){const numOfAlts=alts.length,areAllOneTokenLookahead=alts.every(currAlt=>currAlt.every(currPath=>1===currPath.length));if(hasPredicates)return function(orAlts){const predicates=orAlts.map(currAlt=>currAlt.GATE);for(let t=0;t<numOfAlts;t++){const currAlt=alts[t],currNumOfPaths=currAlt.length,currPredicate=predicates[t];if(void 0===currPredicate||!1!==currPredicate.call(this))nextPath:for(let j=0;j<currNumOfPaths;j++){const currPath=currAlt[j],currPathLength=currPath.length;for(let i=0;i<currPathLength;i++){const nextToken=this.LA_FAST(i+1);if(!1===tokenMatcher2(nextToken,currPath[i]))continue nextPath}return t}}};if(areAllOneTokenLookahead&&!dynamicTokensEnabled){const choiceToAlt=alts.map(currAlt=>currAlt.flat()).reduce((result,currAlt,idx)=>(currAlt.forEach(currTokType=>{currTokType.tokenTypeIdx in result||(result[currTokType.tokenTypeIdx]=idx),currTokType.categoryMatches.forEach(currExtendingType=>{Object.hasOwn(result,currExtendingType)||(result[currExtendingType]=idx)})}),result),{});return function(){const nextToken=this.LA_FAST(1);return choiceToAlt[nextToken.tokenTypeIdx]}}return function(){for(let t=0;t<numOfAlts;t++){const currAlt=alts[t],currNumOfPaths=currAlt.length;nextPath:for(let j=0;j<currNumOfPaths;j++){const currPath=currAlt[j],currPathLength=currPath.length;for(let i=0;i<currPathLength;i++){const nextToken=this.LA_FAST(i+1);if(!1===tokenMatcher2(nextToken,currPath[i]))continue nextPath}return t}}}}function buildSingleAlternativeLookaheadFunction(alt,tokenMatcher2,dynamicTokensEnabled){const areAllOneTokenLookahead=alt.every(currPath=>1===currPath.length),numOfPaths=alt.length;if(areAllOneTokenLookahead&&!dynamicTokensEnabled){const singleTokensTypes=alt.flat();if(1===singleTokensTypes.length&&0===singleTokensTypes[0].categoryMatches.length){const expectedTokenUniqueKey=singleTokensTypes[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===expectedTokenUniqueKey}}{const choiceToAlt=singleTokensTypes.reduce((result,currTokType,idx)=>(result[currTokType.tokenTypeIdx]=!0,currTokType.categoryMatches.forEach(currExtendingType=>{result[currExtendingType]=!0}),result),[]);return function(){const nextToken=this.LA_FAST(1);return!0===choiceToAlt[nextToken.tokenTypeIdx]}}}return function(){nextPath:for(let j=0;j<numOfPaths;j++){const currPath=alt[j],currPathLength=currPath.length;for(let i=0;i<currPathLength;i++){const nextToken=this.LA_FAST(i+1);if(!1===tokenMatcher2(nextToken,currPath[i]))continue nextPath}return!0}return!1}}(PROD_TYPE2=PROD_TYPE||(PROD_TYPE={}))[PROD_TYPE2.OPTION=0]="OPTION",PROD_TYPE2[PROD_TYPE2.REPETITION=1]="REPETITION",PROD_TYPE2[PROD_TYPE2.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",PROD_TYPE2[PROD_TYPE2.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",PROD_TYPE2[PROD_TYPE2.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",PROD_TYPE2[PROD_TYPE2.ALTERNATION=5]="ALTERNATION";class RestDefinitionFinderWalker extends RestWalker{constructor(topProd,targetOccurrence,targetProdType){super(),this.topProd=topProd,this.targetOccurrence=targetOccurrence,this.targetProdType=targetProdType}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(node,expectedProdType,currRest,prevRest){return node.idx===this.targetOccurrence&&this.targetProdType===expectedProdType&&(this.restDef=currRest.concat(prevRest),!0)}walkOption(optionProd,currRest,prevRest){this.checkIsTarget(optionProd,PROD_TYPE.OPTION,currRest,prevRest)||super.walkOption(optionProd,currRest,prevRest)}walkAtLeastOne(atLeastOneProd,currRest,prevRest){this.checkIsTarget(atLeastOneProd,PROD_TYPE.REPETITION_MANDATORY,currRest,prevRest)||super.walkOption(atLeastOneProd,currRest,prevRest)}walkAtLeastOneSep(atLeastOneSepProd,currRest,prevRest){this.checkIsTarget(atLeastOneSepProd,PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,currRest,prevRest)||super.walkOption(atLeastOneSepProd,currRest,prevRest)}walkMany(manyProd,currRest,prevRest){this.checkIsTarget(manyProd,PROD_TYPE.REPETITION,currRest,prevRest)||super.walkOption(manyProd,currRest,prevRest)}walkManySep(manySepProd,currRest,prevRest){this.checkIsTarget(manySepProd,PROD_TYPE.REPETITION_WITH_SEPARATOR,currRest,prevRest)||super.walkOption(manySepProd,currRest,prevRest)}}class InsideDefinitionFinderVisitor extends GAstVisitor{constructor(targetOccurrence,targetProdType,targetRef){super(),this.targetOccurrence=targetOccurrence,this.targetProdType=targetProdType,this.targetRef=targetRef,this.result=[]}checkIsTarget(node,expectedProdName){node.idx!==this.targetOccurrence||this.targetProdType!==expectedProdName||void 0!==this.targetRef&&node!==this.targetRef||(this.result=node.definition)}visitOption(node){this.checkIsTarget(node,PROD_TYPE.OPTION)}visitRepetition(node){this.checkIsTarget(node,PROD_TYPE.REPETITION)}visitRepetitionMandatory(node){this.checkIsTarget(node,PROD_TYPE.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(node){this.checkIsTarget(node,PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(node){this.checkIsTarget(node,PROD_TYPE.REPETITION_WITH_SEPARATOR)}visitAlternation(node){this.checkIsTarget(node,PROD_TYPE.ALTERNATION)}}function initializeArrayOfArrays(size){const result=new Array(size);for(let i=0;i<size;i++)result[i]=[];return result}function pathToHashKeys(path){let keys=[""];for(let i=0;i<path.length;i++){const tokType=path[i],longerKeys=[];for(let j=0;j<keys.length;j++){const currShorterKey=keys[j];longerKeys.push(currShorterKey+"_"+tokType.tokenTypeIdx);for(let t=0;t<tokType.categoryMatches.length;t++){const categoriesKeySuffix="_"+tokType.categoryMatches[t];longerKeys.push(currShorterKey+categoriesKeySuffix)}}keys=longerKeys}return keys}function isUniquePrefixHash(altKnownPathsKeys,searchPathKeys,idx){for(let currAltIdx=0;currAltIdx<altKnownPathsKeys.length;currAltIdx++){if(currAltIdx===idx)continue;const otherAltKnownPathsKeys=altKnownPathsKeys[currAltIdx];for(let searchIdx=0;searchIdx<searchPathKeys.length;searchIdx++){if(!0===otherAltKnownPathsKeys[searchPathKeys[searchIdx]])return!1}}return!0}function lookAheadSequenceFromAlternatives(altsDefs,k){const partialAlts=altsDefs.map(currAlt=>possiblePathsFrom([currAlt],1)),finalResult=initializeArrayOfArrays(partialAlts.length),altsHashes=partialAlts.map(currAltPaths=>{const dict={};return currAltPaths.forEach(item=>{pathToHashKeys(item.partialPath).forEach(currKey=>{dict[currKey]=!0})}),dict});let newData=partialAlts;for(let pathLength=1;pathLength<=k;pathLength++){const currDataset=newData;newData=initializeArrayOfArrays(currDataset.length);for(let altIdx=0;altIdx<currDataset.length;altIdx++){const currAltPathsAndSuffixes=currDataset[altIdx];for(let currPathIdx=0;currPathIdx<currAltPathsAndSuffixes.length;currPathIdx++){const currPathPrefix=currAltPathsAndSuffixes[currPathIdx].partialPath,suffixDef=currAltPathsAndSuffixes[currPathIdx].suffixDef,prefixKeys=pathToHashKeys(currPathPrefix);if(isUniquePrefixHash(altsHashes,prefixKeys,altIdx)||0===suffixDef.length||currPathPrefix.length===k){const currAltResult=finalResult[altIdx];if(!1===containsPath(currAltResult,currPathPrefix)){currAltResult.push(currPathPrefix);for(let j=0;j<prefixKeys.length;j++){const currKey=prefixKeys[j];altsHashes[altIdx][currKey]=!0}}}else{const newPartialPathsAndSuffixes=possiblePathsFrom(suffixDef,pathLength+1,currPathPrefix);newData[altIdx]=newData[altIdx].concat(newPartialPathsAndSuffixes),newPartialPathsAndSuffixes.forEach(item=>{pathToHashKeys(item.partialPath).forEach(key=>{altsHashes[altIdx][key]=!0})})}}}}return finalResult}function getLookaheadPathsForOr(occurrence,ruleGrammar,k,orProd){const visitor2=new InsideDefinitionFinderVisitor(occurrence,PROD_TYPE.ALTERNATION,orProd);return ruleGrammar.accept(visitor2),lookAheadSequenceFromAlternatives(visitor2.result,k)}function getLookaheadPathsForOptionalProd(occurrence,ruleGrammar,prodType,k){const insideDefVisitor=new InsideDefinitionFinderVisitor(occurrence,prodType);ruleGrammar.accept(insideDefVisitor);const insideDef=insideDefVisitor.result,afterDef=new RestDefinitionFinderWalker(ruleGrammar,occurrence,prodType).startWalking();return lookAheadSequenceFromAlternatives([new Alternative({definition:insideDef}),new Alternative({definition:afterDef})],k)}function containsPath(alternative,searchPath){compareOtherPath:for(let i=0;i<alternative.length;i++){const otherPath=alternative[i];if(otherPath.length===searchPath.length){for(let j=0;j<otherPath.length;j++){const searchTok=searchPath[j],otherTok=otherPath[j];if(!1===(searchTok===otherTok||void 0!==otherTok.categoryMatchesMap[searchTok.tokenTypeIdx]))continue compareOtherPath}return!0}}return!1}function areTokenCategoriesNotUsed(lookAheadPaths){return lookAheadPaths.every(singleAltPaths=>singleAltPaths.every(singlePath=>singlePath.every(token=>0===token.categoryMatches.length)))}function validateGrammar$1(topLevels,tokenTypes,errMsgProvider,grammarName){const duplicateErrors=topLevels.flatMap(currTopLevel=>function(topLevelRule,errMsgProvider){const collectorVisitor2=new OccurrenceValidationCollector;topLevelRule.accept(collectorVisitor2);const allRuleProductions=collectorVisitor2.allProductions,productionGroups=Object.groupBy(allRuleProductions,identifyProductionForDuplicates),duplicates=Object.fromEntries(Object.entries(productionGroups).filter(([_k2,currGroup])=>currGroup.length>1)),errors=Object.values(duplicates).map(currDuplicates=>{const firstProd=currDuplicates[0],msg=errMsgProvider.buildDuplicateFoundError(topLevelRule,currDuplicates),dslName=getProductionDslName$1(firstProd),defError={message:msg,type:ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:topLevelRule.name,dslName:dslName,occurrence:firstProd.idx},param=getExtraProductionArgument(firstProd);return param&&(defError.parameter=param),defError});return errors}(currTopLevel,errMsgProvider)),termsNamespaceConflictErrors=function(topLevels,tokenTypes,errMsgProvider){const errors=[],tokenNames=tokenTypes.map(currToken=>currToken.name);return topLevels.forEach(currRule=>{const currRuleName=currRule.name;if(tokenNames.includes(currRuleName)){const errMsg=errMsgProvider.buildNamespaceConflictError(currRule);errors.push({message:errMsg,type:ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:currRuleName})}}),errors}(topLevels,tokenTypes,errMsgProvider),tooManyAltsErrors=topLevels.flatMap(curRule=>function(topLevelRule,errMsgProvider){const orCollector=new OrCollector;topLevelRule.accept(orCollector);const errors=orCollector.alternations.flatMap(currOr=>currOr.definition.length>255?[{message:errMsgProvider.buildTooManyAlternativesError({topLevelRule:topLevelRule,alternation:currOr}),type:ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:topLevelRule.name,occurrence:currOr.idx}]:[]);return errors}(curRule,errMsgProvider)),duplicateRulesError=topLevels.flatMap(curRule=>function(rule,allRules,className,errMsgProvider){const errors=[],occurrences=allRules.reduce((result,curRule)=>curRule.name===rule.name?result+1:result,0);if(occurrences>1){const errMsg=errMsgProvider.buildDuplicateRuleNameError({topLevelRule:rule,grammarName:className});errors.push({message:errMsg,type:ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:rule.name})}return errors}(curRule,topLevels,grammarName,errMsgProvider));return duplicateErrors.concat(termsNamespaceConflictErrors,tooManyAltsErrors,duplicateRulesError)}function identifyProductionForDuplicates(prod){return`${getProductionDslName$1(prod)}_#_${prod.idx}_#_${getExtraProductionArgument(prod)}`}function getExtraProductionArgument(prod){return prod instanceof Terminal?prod.terminalType.name:prod instanceof NonTerminal?prod.nonTerminalName:""}class OccurrenceValidationCollector extends GAstVisitor{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(subrule){this.allProductions.push(subrule)}visitOption(option2){this.allProductions.push(option2)}visitRepetitionWithSeparator(manySep){this.allProductions.push(manySep)}visitRepetitionMandatory(atLeastOne){this.allProductions.push(atLeastOne)}visitRepetitionMandatoryWithSeparator(atLeastOneSep){this.allProductions.push(atLeastOneSep)}visitRepetition(many){this.allProductions.push(many)}visitAlternation(or){this.allProductions.push(or)}visitTerminal(terminal){this.allProductions.push(terminal)}}function validateNoLeftRecursion(topRule,currRule,errMsgProvider,path=[]){const errors=[],nextNonTerminals=getFirstNoneTerminal(currRule.definition);if(0===nextNonTerminals.length)return[];{const ruleName=topRule.name;nextNonTerminals.includes(topRule)&&errors.push({message:errMsgProvider.buildLeftRecursionError({topLevelRule:topRule,leftRecursionPath:path}),type:ParserDefinitionErrorType.LEFT_RECURSION,ruleName:ruleName});const excluded=path.concat([topRule]),errorsFromNextSteps=nextNonTerminals.filter(x=>!excluded.includes(x)).flatMap(currRefRule=>{const newPath=[...path];return newPath.push(currRefRule),validateNoLeftRecursion(topRule,currRefRule,errMsgProvider,newPath)});return errors.concat(errorsFromNextSteps)}}function getFirstNoneTerminal(definition){let result=[];if(0===definition.length)return result;const firstProd=definition[0];if(firstProd instanceof NonTerminal)result.push(firstProd.referencedRule);else if(firstProd instanceof Alternative||firstProd instanceof Option$1||firstProd instanceof RepetitionMandatory||firstProd instanceof RepetitionMandatoryWithSeparator||firstProd instanceof RepetitionWithSeparator||firstProd instanceof Repetition)result=result.concat(getFirstNoneTerminal(firstProd.definition));else if(firstProd instanceof Alternation)result=firstProd.definition.map(currSubDef=>getFirstNoneTerminal(currSubDef.definition)).flat();else if(!(firstProd instanceof Terminal))throw Error("non exhaustive match");const isFirstOptional=isOptionalProd(firstProd),hasMore=definition.length>1;if(isFirstOptional&&hasMore){const rest=definition.slice(1);return result.concat(getFirstNoneTerminal(rest))}return result}class OrCollector extends GAstVisitor{constructor(){super(...arguments),this.alternations=[]}visitAlternation(node){this.alternations.push(node)}}function validateEmptyOrAlternative(topLevelRule,errMsgProvider){const orCollector=new OrCollector;topLevelRule.accept(orCollector);return orCollector.alternations.flatMap(currOr=>currOr.definition.slice(0,-1).flatMap((currAlternative,currAltIdx)=>0===function(initialDef,tokenVector,tokMatcher,maxLookAhead){const EXIT_NON_TERMINAL_ARR=["EXIT_NONE_TERMINAL"];let foundCompletePath=!1;const tokenVectorLength=tokenVector.length,minimalAlternativesIndex=tokenVectorLength-maxLookAhead-1,result=[],possiblePaths=[];for(possiblePaths.push({idx:-1,def:initialDef,ruleStack:[],occurrenceStack:[]});0!==possiblePaths.length;){const currPath=possiblePaths.pop();if("EXIT_ALTERNATIVE"===currPath){foundCompletePath&&possiblePaths.at(-1).idx<=minimalAlternativesIndex&&possiblePaths.pop();continue}const currDef=currPath.def,currIdx=currPath.idx,currRuleStack=currPath.ruleStack,currOccurrenceStack=currPath.occurrenceStack;if(0===currDef.length)continue;const prod=currDef[0];if("EXIT_NONE_TERMINAL"===prod){const nextPath={idx:currIdx,def:currDef.slice(1),ruleStack:currRuleStack.slice(0,-1),occurrenceStack:currOccurrenceStack.slice(0,-1)};possiblePaths.push(nextPath)}else if(prod instanceof Terminal)if(currIdx<tokenVectorLength-1){const nextIdx=currIdx+1;if(tokMatcher(tokenVector[nextIdx],prod.terminalType)){const nextPath={idx:nextIdx,def:currDef.slice(1),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPath)}}else{if(currIdx!==tokenVectorLength-1)throw Error("non exhaustive match");result.push({nextTokenType:prod.terminalType,nextTokenOccurrence:prod.idx,ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack}),foundCompletePath=!0}else if(prod instanceof NonTerminal){const newRuleStack=[...currRuleStack];newRuleStack.push(prod.nonTerminalName);const newOccurrenceStack=[...currOccurrenceStack];newOccurrenceStack.push(prod.idx);const nextPath={idx:currIdx,def:prod.definition.concat(EXIT_NON_TERMINAL_ARR,currDef.slice(1)),ruleStack:newRuleStack,occurrenceStack:newOccurrenceStack};possiblePaths.push(nextPath)}else if(prod instanceof Option$1){const nextPathWithout={idx:currIdx,def:currDef.slice(1),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWithout),possiblePaths.push("EXIT_ALTERNATIVE");const nextPathWith={idx:currIdx,def:prod.definition.concat(currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWith)}else if(prod instanceof RepetitionMandatory){const secondIteration=new Repetition({definition:prod.definition,idx:prod.idx}),nextPath={idx:currIdx,def:prod.definition.concat([secondIteration],currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPath)}else if(prod instanceof RepetitionMandatoryWithSeparator){const separatorGast=new Terminal({terminalType:prod.separator}),secondIteration=new Repetition({definition:[separatorGast].concat(prod.definition),idx:prod.idx}),nextPath={idx:currIdx,def:prod.definition.concat([secondIteration],currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPath)}else if(prod instanceof RepetitionWithSeparator){const nextPathWithout={idx:currIdx,def:currDef.slice(1),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWithout),possiblePaths.push("EXIT_ALTERNATIVE");const separatorGast=new Terminal({terminalType:prod.separator}),nthRepetition=new Repetition({definition:[separatorGast].concat(prod.definition),idx:prod.idx}),nextPathWith={idx:currIdx,def:prod.definition.concat([nthRepetition],currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWith)}else if(prod instanceof Repetition){const nextPathWithout={idx:currIdx,def:currDef.slice(1),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWithout),possiblePaths.push("EXIT_ALTERNATIVE");const nthRepetition=new Repetition({definition:prod.definition,idx:prod.idx}),nextPathWith={idx:currIdx,def:prod.definition.concat([nthRepetition],currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWith)}else if(prod instanceof Alternation)for(let i=prod.definition.length-1;i>=0;i--){const currAltPath={idx:currIdx,def:prod.definition[i].definition.concat(currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(currAltPath),possiblePaths.push("EXIT_ALTERNATIVE")}else if(prod instanceof Alternative)possiblePaths.push({idx:currIdx,def:prod.definition.concat(currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack});else{if(!(prod instanceof Rule))throw Error("non exhaustive match");possiblePaths.push(expandTopLevelRule(prod,currIdx,currRuleStack,currOccurrenceStack))}}return result}([currAlternative],[],tokenStructuredMatcher,1).length?[{message:errMsgProvider.buildEmptyAlternationError({topLevelRule:topLevelRule,alternation:currOr,emptyChoiceIdx:currAltIdx}),type:ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:topLevelRule.name,occurrence:currOr.idx,alternative:currAltIdx+1}]:[]))}function validateAmbiguousAlternationAlternatives(topLevelRule,globalMaxLookahead,errMsgProvider){const orCollector=new OrCollector;topLevelRule.accept(orCollector);let ors=orCollector.alternations;ors=ors.filter(currOr=>!0!==currOr.ignoreAmbiguities);const errors=ors.flatMap(currOr=>{const currOccurrence=currOr.idx,actualMaxLookahead=currOr.maxLookahead||globalMaxLookahead,alternatives=getLookaheadPathsForOr(currOccurrence,topLevelRule,actualMaxLookahead,currOr),altsAmbiguityErrors=function(alternatives,alternation2,rule,errMsgProvider){const foundAmbiguousPaths=[],identicalAmbiguities=alternatives.reduce((result,currAlt,currAltIdx)=>(!0===alternation2.definition[currAltIdx].ignoreAmbiguities||currAlt.forEach(currPath=>{const altsCurrPathAppearsIn=[currAltIdx];alternatives.forEach((currOtherAlt,currOtherAltIdx)=>{currAltIdx!==currOtherAltIdx&&containsPath(currOtherAlt,currPath)&&!0!==alternation2.definition[currOtherAltIdx].ignoreAmbiguities&&altsCurrPathAppearsIn.push(currOtherAltIdx)}),altsCurrPathAppearsIn.length>1&&!containsPath(foundAmbiguousPaths,currPath)&&(foundAmbiguousPaths.push(currPath),result.push({alts:altsCurrPathAppearsIn,path:currPath}))}),result),[]),currErrors=identicalAmbiguities.map(currAmbDescriptor=>{const ambgIndices=currAmbDescriptor.alts.map(currAltIdx=>currAltIdx+1);return{message:errMsgProvider.buildAlternationAmbiguityError({topLevelRule:rule,alternation:alternation2,ambiguityIndices:ambgIndices,prefixPath:currAmbDescriptor.path}),type:ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:rule.name,occurrence:alternation2.idx,alternatives:currAmbDescriptor.alts}});return currErrors}(alternatives,currOr,topLevelRule,errMsgProvider),altsPrefixAmbiguityErrors=function(alternatives,alternation2,rule,errMsgProvider){const pathsAndIndices=alternatives.reduce((result,currAlt,idx)=>{const currPathsAndIdx=currAlt.map(currPath=>({idx:idx,path:currPath}));return result.concat(currPathsAndIdx)},[]),errors=pathsAndIndices.flatMap(currPathAndIdx=>{if(!0===alternation2.definition[currPathAndIdx.idx].ignoreAmbiguities)return[];const targetIdx=currPathAndIdx.idx,targetPath=currPathAndIdx.path;return pathsAndIndices.filter(searchPathAndIdx=>{return!0!==alternation2.definition[searchPathAndIdx.idx].ignoreAmbiguities&&searchPathAndIdx.idx<targetIdx&&(prefix=searchPathAndIdx.path,other=targetPath,prefix.length<other.length&&prefix.every((tokType,idx)=>{const otherTokType=other[idx];return tokType===otherTokType||otherTokType.categoryMatchesMap[tokType.tokenTypeIdx]}));var prefix,other}).map(currAmbPathAndIdx=>{const ambgIndices=[currAmbPathAndIdx.idx+1,targetIdx+1],occurrence=0===alternation2.idx?"":alternation2.idx;return{message:errMsgProvider.buildAlternationPrefixAmbiguityError({topLevelRule:rule,alternation:alternation2,ambiguityIndices:ambgIndices,prefixPath:currAmbPathAndIdx.path}),type:ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:rule.name,occurrence:occurrence,alternatives:ambgIndices}})});return errors}(alternatives,currOr,topLevelRule,errMsgProvider);return altsAmbiguityErrors.concat(altsPrefixAmbiguityErrors)});return errors}class RepetitionCollector extends GAstVisitor{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(manySep){this.allProductions.push(manySep)}visitRepetitionMandatory(atLeastOne){this.allProductions.push(atLeastOne)}visitRepetitionMandatoryWithSeparator(atLeastOneSep){this.allProductions.push(atLeastOneSep)}visitRepetition(many){this.allProductions.push(many)}}function resolveGrammar(options){const actualOptions=Object.assign({errMsgProvider:defaultGrammarResolverErrorProvider},options),topRulesTable={};return options.rules.forEach(rule=>{topRulesTable[rule.name]=rule}),function(topLevels,errMsgProvider){const refResolver=new GastRefResolverVisitor(topLevels,errMsgProvider);return refResolver.resolveRefs(),refResolver.errors}(topRulesTable,actualOptions.errMsgProvider)}const RECOGNITION_EXCEPTION_NAMES=["MismatchedTokenException","NoViableAltException","EarlyExitException","NotAllInputParsedException"];function isRecognitionException(error){return RECOGNITION_EXCEPTION_NAMES.includes(error.name)}Object.freeze(RECOGNITION_EXCEPTION_NAMES);class RecognitionException extends Error{constructor(message,token){super(message),this.token=token,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class MismatchedTokenException extends RecognitionException{constructor(message,token,previousToken){super(message,token),this.previousToken=previousToken,this.name="MismatchedTokenException"}}class NoViableAltException extends RecognitionException{constructor(message,token,previousToken){super(message,token),this.previousToken=previousToken,this.name="NoViableAltException"}}class NotAllInputParsedException extends RecognitionException{constructor(message,token){super(message,token),this.name="NotAllInputParsedException"}}class EarlyExitException extends RecognitionException{constructor(message,token,previousToken){super(message,token),this.previousToken=previousToken,this.name="EarlyExitException"}}const EOF_FOLLOW_KEY={};class InRuleRecoveryException extends Error{constructor(message){super(message),this.name="InRuleRecoveryException"}}function attemptInRepetitionRecovery(prodFunc,args,lookaheadFunc,dslMethodIdx,prodOccurrence,nextToksWalker,notStuck){const key=this.getKeyForAutomaticLookahead(dslMethodIdx,prodOccurrence);let firstAfterRepInfo=this.firstAfterRepMap[key];if(void 0===firstAfterRepInfo){const currRuleName=this.getCurrRuleFullName();firstAfterRepInfo=new nextToksWalker(this.getGAstProductions()[currRuleName],prodOccurrence).startWalking(),this.firstAfterRepMap[key]=firstAfterRepInfo}let expectTokAfterLastMatch=firstAfterRepInfo.token,nextTokIdx=firstAfterRepInfo.occurrence;const isEndOfRule=firstAfterRepInfo.isEndOfRule;0===this.RULE_STACK_IDX&&isEndOfRule&&void 0===expectTokAfterLastMatch&&(expectTokAfterLastMatch=EOF,nextTokIdx=1),void 0!==expectTokAfterLastMatch&&void 0!==nextTokIdx&&this.shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch,nextTokIdx,notStuck)&&this.tryInRepetitionRecovery(prodFunc,args,lookaheadFunc,expectTokAfterLastMatch)}function getKeyForAutomaticLookahead(ruleIdx,dslMethodIdx,occurrence){return occurrence|dslMethodIdx|ruleIdx}class LLkLookaheadStrategy{constructor(options){var _a2;this.maxLookahead=null!==(_a2=null==options?void 0:options.maxLookahead)&&void 0!==_a2?_a2:DEFAULT_PARSER_CONFIG.maxLookahead}validate(options){const leftRecursionErrors=this.validateNoLeftRecursion(options.rules);if(0===leftRecursionErrors.length){const emptyAltErrors=this.validateEmptyOrAlternatives(options.rules),ambiguousAltsErrors=this.validateAmbiguousAlternationAlternatives(options.rules,this.maxLookahead),emptyRepetitionErrors=this.validateSomeNonEmptyLookaheadPath(options.rules,this.maxLookahead);return[...leftRecursionErrors,...emptyAltErrors,...ambiguousAltsErrors,...emptyRepetitionErrors]}return leftRecursionErrors}validateNoLeftRecursion(rules){return rules.flatMap(currTopRule=>validateNoLeftRecursion(currTopRule,currTopRule,defaultGrammarValidatorErrorProvider))}validateEmptyOrAlternatives(rules){return rules.flatMap(currTopRule=>validateEmptyOrAlternative(currTopRule,defaultGrammarValidatorErrorProvider))}validateAmbiguousAlternationAlternatives(rules,maxLookahead){return rules.flatMap(currTopRule=>validateAmbiguousAlternationAlternatives(currTopRule,maxLookahead,defaultGrammarValidatorErrorProvider))}validateSomeNonEmptyLookaheadPath(rules,maxLookahead){return function(topLevelRules,maxLookahead,errMsgProvider){const errors=[];return topLevelRules.forEach(currTopRule=>{const collectorVisitor2=new RepetitionCollector;currTopRule.accept(collectorVisitor2),collectorVisitor2.allProductions.forEach(currProd=>{const prodType=getProdType$1(currProd),actualMaxLookahead=currProd.maxLookahead||maxLookahead;if(0===getLookaheadPathsForOptionalProd(currProd.idx,currTopRule,prodType,actualMaxLookahead)[0].flat().length){const errMsg=errMsgProvider.buildEmptyRepetitionError({topLevelRule:currTopRule,repetition:currProd});errors.push({message:errMsg,type:ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:currTopRule.name})}})}),errors}(rules,maxLookahead,defaultGrammarValidatorErrorProvider)}buildLookaheadForAlternation(options){return function(occurrence,ruleGrammar,maxLookahead,hasPredicates,dynamicTokensEnabled,laFuncBuilder){const lookAheadPaths=getLookaheadPathsForOr(occurrence,ruleGrammar,maxLookahead);return laFuncBuilder(lookAheadPaths,hasPredicates,areTokenCategoriesNotUsed(lookAheadPaths)?tokenStructuredMatcherNoCategories:tokenStructuredMatcher,dynamicTokensEnabled)}(options.prodOccurrence,options.rule,options.maxLookahead,options.hasPredicates,options.dynamicTokensEnabled,buildAlternativesLookAheadFunc)}buildLookaheadForOptional(options){return function(occurrence,ruleGrammar,k,dynamicTokensEnabled,prodType,lookaheadBuilder){const lookAheadPaths=getLookaheadPathsForOptionalProd(occurrence,ruleGrammar,prodType,k),tokenMatcher2=areTokenCategoriesNotUsed(lookAheadPaths)?tokenStructuredMatcherNoCategories:tokenStructuredMatcher;return lookaheadBuilder(lookAheadPaths[0],tokenMatcher2,dynamicTokensEnabled)}(options.prodOccurrence,options.rule,options.maxLookahead,options.dynamicTokensEnabled,getProdType$1(options.prodType),buildSingleAlternativeLookaheadFunction)}}const collectorVisitor=new class extends GAstVisitor{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(option2){this.dslMethods.option.push(option2)}visitRepetitionWithSeparator(manySep){this.dslMethods.repetitionWithSeparator.push(manySep)}visitRepetitionMandatory(atLeastOne){this.dslMethods.repetitionMandatory.push(atLeastOne)}visitRepetitionMandatoryWithSeparator(atLeastOneSep){this.dslMethods.repetitionMandatoryWithSeparator.push(atLeastOneSep)}visitRepetition(many){this.dslMethods.repetition.push(many)}visitAlternation(or){this.dslMethods.alternation.push(or)}};function setNodeLocationOnlyOffset(currNodeLocation,newLocationInfo){!0===isNaN(currNodeLocation.startOffset)?(currNodeLocation.startOffset=newLocationInfo.startOffset,currNodeLocation.endOffset=newLocationInfo.endOffset):currNodeLocation.endOffset<newLocationInfo.endOffset==!0&&(currNodeLocation.endOffset=newLocationInfo.endOffset)}function setNodeLocationFull(currNodeLocation,newLocationInfo){!0===isNaN(currNodeLocation.startOffset)?(currNodeLocation.startOffset=newLocationInfo.startOffset,currNodeLocation.startColumn=newLocationInfo.startColumn,currNodeLocation.startLine=newLocationInfo.startLine,currNodeLocation.endOffset=newLocationInfo.endOffset,currNodeLocation.endColumn=newLocationInfo.endColumn,currNodeLocation.endLine=newLocationInfo.endLine):currNodeLocation.endOffset<newLocationInfo.endOffset==!0&&(currNodeLocation.endOffset=newLocationInfo.endOffset,currNodeLocation.endColumn=newLocationInfo.endColumn,currNodeLocation.endLine=newLocationInfo.endLine)}function defineNameProp(obj,nameValue){Object.defineProperty(obj,"name",{enumerable:!1,configurable:!0,writable:!1,value:nameValue})}function defaultVisit(ctx,param){const childrenNames=Object.keys(ctx),childrenNamesLength=childrenNames.length;for(let i=0;i<childrenNamesLength;i++){const currChildArray=ctx[childrenNames[i]],currChildArrayLength=currChildArray.length;for(let j=0;j<currChildArrayLength;j++){const currChild=currChildArray[j];void 0===currChild.tokenTypeIdx&&this[currChild.name](currChild.children,param)}}}function createBaseSemanticVisitorConstructor(grammarName,ruleNames){const derivedConstructor=function(){};defineNameProp(derivedConstructor,grammarName+"BaseSemantics");const semanticProto={visit:function(cstNode,param){if(Array.isArray(cstNode)&&(cstNode=cstNode[0]),void 0!==cstNode)return this[cstNode.name](cstNode.children,param)},validateVisitor:function(){const semanticDefinitionErrors=function(visitorInstance,ruleNames){const missingErrors=function(visitorInstance,ruleNames){const missingRuleNames=ruleNames.filter(currRuleName=>"function"==typeof visitorInstance[currRuleName]==!1),errors=missingRuleNames.map(currRuleName=>({msg:`Missing visitor method: <${currRuleName}> on ${visitorInstance.constructor.name} CST Visitor.`,type:CstVisitorDefinitionError.MISSING_METHOD,methodName:currRuleName}));return errors.filter(Boolean)}(visitorInstance,ruleNames);return missingErrors}(this,ruleNames);if(0!==semanticDefinitionErrors.length){const errorMessages=semanticDefinitionErrors.map(currDefError=>currDefError.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${errorMessages.join("\n\n").replace(/\n/g,"\n\t")}`)}}};return(derivedConstructor.prototype=semanticProto).constructor=derivedConstructor,derivedConstructor._RULE_NAMES=ruleNames,derivedConstructor}var CstVisitorDefinitionError,CstVisitorDefinitionError2;(CstVisitorDefinitionError2=CstVisitorDefinitionError||(CstVisitorDefinitionError={}))[CstVisitorDefinitionError2.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",CstVisitorDefinitionError2[CstVisitorDefinitionError2.MISSING_METHOD=1]="MISSING_METHOD";const RECORDING_NULL_OBJECT={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(RECORDING_NULL_OBJECT);const MAX_METHOD_IDX=Math.pow(2,8)-1,RFT=createToken({name:"RECORDING_PHASE_TOKEN",pattern:Lexer.NA});augmentTokenTypes([RFT]);const RECORDING_PHASE_TOKEN=createTokenInstance(RFT,"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(RECORDING_PHASE_TOKEN);const RECORDING_PHASE_CSTNODE={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 recordProd(prodConstructor,mainProdArg,occurrence,handleSep=!1){assertMethodIdxIsValid(occurrence);const prevProd=this.recordingProdStack.at(-1),grammarAction="function"==typeof mainProdArg?mainProdArg:mainProdArg.DEF,newProd=new prodConstructor({definition:[],idx:occurrence});return handleSep&&(newProd.separator=mainProdArg.SEP),Object.hasOwn(mainProdArg,"MAX_LOOKAHEAD")&&(newProd.maxLookahead=mainProdArg.MAX_LOOKAHEAD),this.recordingProdStack.push(newProd),grammarAction.call(this),prevProd.definition.push(newProd),this.recordingProdStack.pop(),RECORDING_NULL_OBJECT}function recordOrProd(mainProdArg,occurrence){assertMethodIdxIsValid(occurrence);const prevProd=this.recordingProdStack.at(-1),hasOptions=!1===Array.isArray(mainProdArg),alts=!1===hasOptions?mainProdArg:mainProdArg.DEF,newOrProd=new Alternation({definition:[],idx:occurrence,ignoreAmbiguities:hasOptions&&!0===mainProdArg.IGNORE_AMBIGUITIES});Object.hasOwn(mainProdArg,"MAX_LOOKAHEAD")&&(newOrProd.maxLookahead=mainProdArg.MAX_LOOKAHEAD);const hasPredicates=alts.some(currAlt=>"function"==typeof currAlt.GATE);return newOrProd.hasPredicates=hasPredicates,prevProd.definition.push(newOrProd),alts.forEach(currAlt=>{const currAltFlat=new Alternative({definition:[]});newOrProd.definition.push(currAltFlat),Object.hasOwn(currAlt,"IGNORE_AMBIGUITIES")?currAltFlat.ignoreAmbiguities=currAlt.IGNORE_AMBIGUITIES:Object.hasOwn(currAlt,"GATE")&&(currAltFlat.ignoreAmbiguities=!0),this.recordingProdStack.push(currAltFlat),currAlt.ALT.call(this),this.recordingProdStack.pop()}),RECORDING_NULL_OBJECT}function getIdxSuffix(idx){return 0===idx?"":`${idx}`}function assertMethodIdxIsValid(idx){if(idx<0||idx>MAX_METHOD_IDX){const error=new Error(`Invalid DSL Method idx value: <${idx}>\n\tIdx value must be a none negative value smaller than ${MAX_METHOD_IDX+1}`);throw error.KNOWN_RECORDER_ERROR=!0,error}}const END_OF_FILE=createTokenInstance(EOF,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(END_OF_FILE);const DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var ParserDefinitionErrorType,ParserDefinitionErrorType2,derivedCtor;function EMPTY_ALT(value=void 0){return function(){return value}}(ParserDefinitionErrorType2=ParserDefinitionErrorType||(ParserDefinitionErrorType={}))[ParserDefinitionErrorType2.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",ParserDefinitionErrorType2[ParserDefinitionErrorType2.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",ParserDefinitionErrorType2[ParserDefinitionErrorType2.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",ParserDefinitionErrorType2[ParserDefinitionErrorType2.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",ParserDefinitionErrorType2[ParserDefinitionErrorType2.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",ParserDefinitionErrorType2[ParserDefinitionErrorType2.LEFT_RECURSION=5]="LEFT_RECURSION",ParserDefinitionErrorType2[ParserDefinitionErrorType2.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",ParserDefinitionErrorType2[ParserDefinitionErrorType2.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",ParserDefinitionErrorType2[ParserDefinitionErrorType2.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",ParserDefinitionErrorType2[ParserDefinitionErrorType2.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",ParserDefinitionErrorType2[ParserDefinitionErrorType2.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",ParserDefinitionErrorType2[ParserDefinitionErrorType2.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",ParserDefinitionErrorType2[ParserDefinitionErrorType2.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",ParserDefinitionErrorType2[ParserDefinitionErrorType2.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION";class Parser{static performSelfAnalysis(parserInstance){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 defErrorsMsgs;this.selfAnalysisDone=!0;const className=this.className;this.TRACE_INIT("toFastProps",()=>{toFastProperties(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),this.definedRulesNames.forEach(currRuleName=>{const originalGrammarAction=this[currRuleName].originalGrammarAction;let recordedRuleGast;this.TRACE_INIT(`${currRuleName} Rule`,()=>{recordedRuleGast=this.topLevelRuleRecord(currRuleName,originalGrammarAction)}),this.gastProductionsCache[currRuleName]=recordedRuleGast})}finally{this.disableRecording()}});let resolverErrors=[];if(this.TRACE_INIT("Grammar Resolving",()=>{resolverErrors=resolveGrammar({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(resolverErrors)}),this.TRACE_INIT("Grammar Validations",()=>{if(0===resolverErrors.length&&!1===this.skipValidations){const validationErrors=function(options){var _a2;const errMsgProvider=null!==(_a2=options.errMsgProvider)&&void 0!==_a2?_a2:defaultGrammarValidatorErrorProvider;return validateGrammar$1(options.rules,options.tokenTypes,errMsgProvider,options.grammarName)}({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:defaultGrammarValidatorErrorProvider,grammarName:className}),lookaheadValidationErrors=(options={lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:className}).lookaheadStrategy.validate({rules:options.rules,tokenTypes:options.tokenTypes,grammarName:options.grammarName}).map(errorMessage=>Object.assign({type:ParserDefinitionErrorType.CUSTOM_LOOKAHEAD_VALIDATION},errorMessage));this.definitionErrors=this.definitionErrors.concat(validationErrors,lookaheadValidationErrors)}var options}),0===this.definitionErrors.length&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const allFollows=function(topProductions){const reSyncFollows={};return topProductions.forEach(topProd=>{const currRefsFollow=new ResyncFollowsWalker(topProd).startWalking();Object.assign(reSyncFollows,currRefsFollow)}),reSyncFollows}(Object.values(this.gastProductionsCache));this.resyncFollows=allFollows}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var _a2,_b2;null===(_b2=(_a2=this.lookaheadStrategy).initialize)||void 0===_b2||_b2.call(_a2,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!Parser.DEFER_DEFINITION_ERRORS_HANDLING&&0!==this.definitionErrors.length)throw defErrorsMsgs=this.definitionErrors.map(defError=>defError.message),new Error(`Parser Definition Errors detected:\n ${defErrorsMsgs.join("\n-------------------------------\n")}`)})}constructor(tokenVocabulary,config){this.definitionErrors=[],this.selfAnalysisDone=!1;if(this.initErrorHandler(config),this.initLexerAdapter(),this.initLooksAhead(config),this.initRecognizerEngine(tokenVocabulary,config),this.initRecoverable(config),this.initTreeBuilder(config),this.initGastRecorder(config),this.initPerformanceTracer(config),Object.hasOwn(config,"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=Object.hasOwn(config,"skipValidations")?config.skipValidations:DEFAULT_PARSER_CONFIG.skipValidations}}Parser.DEFER_DEFINITION_ERRORS_HANDLING=!1,derivedCtor=Parser,[class{initRecoverable(config){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(config,"recoveryEnabled")?config.recoveryEnabled:DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=attemptInRepetitionRecovery)}getTokenToInsert(tokType){const tokToInsert=createTokenInstance(tokType,"",NaN,NaN,NaN,NaN,NaN,NaN);return tokToInsert.isInsertedInRecovery=!0,tokToInsert}canTokenTypeBeInsertedInRecovery(tokType){return!0}canTokenTypeBeDeletedInRecovery(tokType){return!0}tryInRepetitionRecovery(grammarRule,grammarRuleArgs,lookAheadFunc,expectedTokType){const reSyncTokType=this.findReSyncTokenType(),savedLexerState=this.exportLexerState(),resyncedTokens=[];let passedResyncPoint=!1;const nextTokenWithoutResync=this.LA_FAST(1);let currToken=this.LA_FAST(1);const generateErrorMessage=()=>{const previousToken=this.LA(0),msg=this.errorMessageProvider.buildMismatchTokenMessage({expected:expectedTokType,actual:nextTokenWithoutResync,previous:previousToken,ruleName:this.getCurrRuleFullName()}),error=new MismatchedTokenException(msg,nextTokenWithoutResync,this.LA(0));error.resyncedTokens=resyncedTokens.slice(0,-1),this.SAVE_ERROR(error)};for(;!passedResyncPoint;){if(this.tokenMatcher(currToken,expectedTokType))return void generateErrorMessage();if(lookAheadFunc.call(this))return generateErrorMessage(),void grammarRule.apply(this,grammarRuleArgs);this.tokenMatcher(currToken,reSyncTokType)?passedResyncPoint=!0:(currToken=this.SKIP_TOKEN(),this.addToResyncTokens(currToken,resyncedTokens))}this.importLexerState(savedLexerState)}shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch,nextTokIdx,notStuck){return!1!==notStuck&&!this.tokenMatcher(this.LA_FAST(1),expectTokAfterLastMatch)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(expectTokAfterLastMatch,this.getFollowsForInRuleRecovery(expectTokAfterLastMatch,nextTokIdx))}getNextPossibleTokenTypes(grammarPath){const topRuleName=grammarPath.ruleStack[0],topProduction=this.getGAstProductions()[topRuleName];return new NextAfterTokenWalker(topProduction,grammarPath).startWalking()}getFollowsForInRuleRecovery(tokType,tokIdxInRule){const grammarPath=this.getCurrentGrammarPath(tokType,tokIdxInRule);return this.getNextPossibleTokenTypes(grammarPath)}tryInRuleRecovery(expectedTokType,follows){if(this.canRecoverWithSingleTokenInsertion(expectedTokType,follows))return this.getTokenToInsert(expectedTokType);if(this.canRecoverWithSingleTokenDeletion(expectedTokType)){const nextTok=this.SKIP_TOKEN();return this.consumeToken(),nextTok}throw new InRuleRecoveryException("sad sad panda")}canPerformInRuleRecovery(expectedToken,follows){return this.canRecoverWithSingleTokenInsertion(expectedToken,follows)||this.canRecoverWithSingleTokenDeletion(expectedToken)}canRecoverWithSingleTokenInsertion(expectedTokType,follows){if(!this.canTokenTypeBeInsertedInRecovery(expectedTokType))return!1;if(0===follows.length)return!1;const mismatchedTok=this.LA_FAST(1);return void 0!==follows.find(possibleFollowsTokType=>this.tokenMatcher(mismatchedTok,possibleFollowsTokType))}canRecoverWithSingleTokenDeletion(expectedTokType){return!!this.canTokenTypeBeDeletedInRecovery(expectedTokType)&&this.tokenMatcher(this.LA(2),expectedTokType)}isInCurrentRuleReSyncSet(tokenTypeIdx){const followKey=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(followKey).includes(tokenTypeIdx)}findReSyncTokenType(){const allPossibleReSyncTokTypes=this.flattenFollowSet();let nextToken=this.LA_FAST(1),k=2;for(;;){const foundMatch=allPossibleReSyncTokTypes.find(resyncTokType=>tokenMatcher(nextToken,resyncTokType));if(void 0!==foundMatch)return foundMatch;nextToken=this.LA(k),k++}}getCurrFollowKey(){if(0===this.RULE_STACK_IDX)return EOF_FOLLOW_KEY;const currRuleShortName=this.currRuleShortName,currRuleIdx=this.getLastExplicitRuleOccurrenceIndex(),prevRuleShortName=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(currRuleShortName),idxInCallingRule:currRuleIdx,inRule:this.shortRuleNameToFullName(prevRuleShortName)}}buildFullFollowKeyStack(){const explicitRuleStack=this.RULE_STACK,explicitOccurrenceStack=this.RULE_OCCURRENCE_STACK,len=this.RULE_STACK_IDX+1,result=new Array(len);for(let idx=0;idx<len;idx++)result[idx]=0===idx?EOF_FOLLOW_KEY:{ruleName:this.shortRuleNameToFullName(explicitRuleStack[idx]),idxInCallingRule:explicitOccurrenceStack[idx],inRule:this.shortRuleNameToFullName(explicitRuleStack[idx-1])};return result}flattenFollowSet(){return this.buildFullFollowKeyStack().map(currKey=>this.getFollowSetFromFollowKey(currKey)).flat()}getFollowSetFromFollowKey(followKey){if(followKey===EOF_FOLLOW_KEY)return[EOF];const followName=followKey.ruleName+followKey.idxInCallingRule+IN+followKey.inRule;return this.resyncFollows[followName]}addToResyncTokens(token,resyncTokens){return this.tokenMatcher(token,EOF)||resyncTokens.push(token),resyncTokens}reSyncTo(tokType){const resyncedTokens=[];let nextTok=this.LA_FAST(1);for(;!1===this.tokenMatcher(nextTok,tokType);)nextTok=this.SKIP_TOKEN(),this.addToResyncTokens(nextTok,resyncedTokens);return resyncedTokens.slice(0,-1)}attemptInRepetitionRecovery(prodFunc,args,lookaheadFunc,dslMethodIdx,prodOccurrence,nextToksWalker,notStuck){}getCurrentGrammarPath(tokType,tokIdxInRule){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1),lastTok:tokType,lastTokOccurrence:tokIdxInRule}}getHumanReadableRuleStack(){const len=this.RULE_STACK_IDX+1,result=new Array(len);for(let i=0;i<len;i++)result[i]=this.shortRuleNameToFullName(this.RULE_STACK[i]);return result}},class{initLooksAhead(config){this.dynamicTokensEnabled=Object.hasOwn(config,"dynamicTokensEnabled")?config.dynamicTokensEnabled:DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(config,"maxLookahead")?config.maxLookahead:DEFAULT_PARSER_CONFIG.maxLookahead,this.lookaheadStrategy=Object.hasOwn(config,"lookaheadStrategy")?config.lookaheadStrategy:new LLkLookaheadStrategy({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(rules){rules.forEach(currRule=>{this.TRACE_INIT(`${currRule.name} Rule Lookahead`,()=>{const{alternation:alternation2,repetition:repetition2,option:option2,repetitionMandatory:repetitionMandatory2,repetitionMandatoryWithSeparator:repetitionMandatoryWithSeparator,repetitionWithSeparator:repetitionWithSeparator}=function(rule){collectorVisitor.reset(),rule.accept(collectorVisitor);const dslMethods=collectorVisitor.dslMethods;return collectorVisitor.reset(),dslMethods}(currRule);alternation2.forEach(currProd=>{const prodIdx=0===currProd.idx?"":currProd.idx;this.TRACE_INIT(`${getProductionDslName$1(currProd)}${prodIdx}`,()=>{const laFunc=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:currProd.idx,rule:currRule,maxLookahead:currProd.maxLookahead||this.maxLookahead,hasPredicates:currProd.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),key=getKeyForAutomaticLookahead(this.fullRuleNameToShort[currRule.name],256,currProd.idx);this.setLaFuncCache(key,laFunc)})}),repetition2.forEach(currProd=>{this.computeLookaheadFunc(currRule,currProd.idx,768,"Repetition",currProd.maxLookahead,getProductionDslName$1(currProd))}),option2.forEach(currProd=>{this.computeLookaheadFunc(currRule,currProd.idx,512,"Option",currProd.maxLookahead,getProductionDslName$1(currProd))}),repetitionMandatory2.forEach(currProd=>{this.computeLookaheadFunc(currRule,currProd.idx,1024,"RepetitionMandatory",currProd.maxLookahead,getProductionDslName$1(currProd))}),repetitionMandatoryWithSeparator.forEach(currProd=>{this.computeLookaheadFunc(currRule,currProd.idx,1536,"RepetitionMandatoryWithSeparator",currProd.maxLookahead,getProductionDslName$1(currProd))}),repetitionWithSeparator.forEach(currProd=>{this.computeLookaheadFunc(currRule,currProd.idx,1280,"RepetitionWithSeparator",currProd.maxLookahead,getProductionDslName$1(currProd))})})})}computeLookaheadFunc(rule,prodOccurrence,prodKey,prodType,prodMaxLookahead,dslMethodName){this.TRACE_INIT(`${dslMethodName}${0===prodOccurrence?"":prodOccurrence}`,()=>{const laFunc=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:prodOccurrence,rule:rule,maxLookahead:prodMaxLookahead||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:prodType}),key=getKeyForAutomaticLookahead(this.fullRuleNameToShort[rule.name],prodKey,prodOccurrence);this.setLaFuncCache(key,laFunc)})}getKeyForAutomaticLookahead(dslMethodIdx,occurrence){return getKeyForAutomaticLookahead(this.currRuleShortName,dslMethodIdx,occurrence)}getLaFuncFromCache(key){return this.lookAheadFuncsCache.get(key)}setLaFuncCache(key,value){this.lookAheadFuncsCache.set(key,value)}},class{initTreeBuilder(config){if(this.CST_STACK=[],this.outputCst=config.outputCst,this.nodeLocationTracking=Object.hasOwn(config,"nodeLocationTracking")?config.nodeLocationTracking:DEFAULT_PARSER_CONFIG.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=setNodeLocationFull,this.setNodeLocationFromNode=setNodeLocationFull,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=setNodeLocationOnlyOffset,this.setNodeLocationFromNode=setNodeLocationOnlyOffset,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error(`Invalid <nodeLocationTracking> config option: "${config.nodeLocationTracking}"`);this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{}}else this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{}}setInitialNodeLocationOnlyOffsetRecovery(cstNode){cstNode.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(cstNode){cstNode.location={startOffset:this.LA_FAST(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(cstNode){cstNode.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(cstNode){const nextToken=this.LA_FAST(1);cstNode.location={startOffset:nextToken.startOffset,startLine:nextToken.startLine,startColumn:nextToken.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(fullRuleName){const cstNode={name:fullRuleName,children:Object.create(null)};this.setInitialNodeLocation(cstNode),this.CST_STACK.push(cstNode)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(ruleCstNode){const prevToken=this.LA(0),loc=ruleCstNode.location;loc.startOffset<=prevToken.startOffset==1?(loc.endOffset=prevToken.endOffset,loc.endLine=prevToken.endLine,loc.endColumn=prevToken.endColumn):(loc.startOffset=NaN,loc.startLine=NaN,loc.startColumn=NaN)}cstPostRuleOnlyOffset(ruleCstNode){const prevToken=this.LA(0),loc=ruleCstNode.location;loc.startOffset<=prevToken.startOffset==1?loc.endOffset=prevToken.endOffset:loc.startOffset=NaN}cstPostTerminal(key,consumedToken){const rootCst=this.CST_STACK[this.CST_STACK.length-1];var node,token,tokenTypeName;token=consumedToken,tokenTypeName=key,void 0===(node=rootCst).children[tokenTypeName]?node.children[tokenTypeName]=[token]:node.children[tokenTypeName].push(token),this.setNodeLocationFromToken(rootCst.location,consumedToken)}cstPostNonTerminal(ruleCstResult,ruleName){const preCstNode=this.CST_STACK[this.CST_STACK.length-1];!function(node,ruleName,ruleResult){void 0===node.children[ruleName]?node.children[ruleName]=[ruleResult]:node.children[ruleName].push(ruleResult)}(preCstNode,ruleName,ruleCstResult),this.setNodeLocationFromNode(preCstNode.location,ruleCstResult.location)}getBaseCstVisitorConstructor(){if(void 0===this.baseCstVisitorConstructor){const newBaseCstVisitorConstructor=createBaseSemanticVisitorConstructor(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=newBaseCstVisitorConstructor,newBaseCstVisitorConstructor}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(void 0===this.baseCstVisitorWithDefaultsConstructor){const newConstructor=function(grammarName,ruleNames,baseConstructor){const derivedConstructor=function(){};defineNameProp(derivedConstructor,grammarName+"BaseSemanticsWithDefaults");const withDefaultsProto=Object.create(baseConstructor.prototype);return ruleNames.forEach(ruleName=>{withDefaultsProto[ruleName]=defaultVisit}),(derivedConstructor.prototype=withDefaultsProto).constructor=derivedConstructor,derivedConstructor}(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=newConstructor,newConstructor}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}},class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(newInput){if(!0!==this.selfAnalysisDone)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=newInput,this.tokVectorLength=newInput.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):END_OF_FILE}LA_FAST(howMuch){const soughtIdx=this.currIdx+howMuch;return this.tokVector[soughtIdx]}LA(howMuch){const soughtIdx=this.currIdx+howMuch;return soughtIdx<0||this.tokVectorLength<=soughtIdx?END_OF_FILE:this.tokVector[soughtIdx]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(newState2){this.currIdx=newState2}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}},class{initRecognizerEngine(tokenVocabulary,config){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=tokenStructuredMatcherNoCategories,this.subruleIdx=0,this.currRuleShortName=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(config,"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(Array.isArray(tokenVocabulary)){if(0===tokenVocabulary.length)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 tokenVocabulary[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(Array.isArray(tokenVocabulary))this.tokensMap=tokenVocabulary.reduce((acc,tokType)=>(acc[tokType.name]=tokType,acc),{});else if(Object.hasOwn(tokenVocabulary,"modes")&&Object.values(tokenVocabulary.modes).flat().every(isTokenType)){const allTokenTypes2=Object.values(tokenVocabulary.modes).flat(),uniqueTokens=[...new Set(allTokenTypes2)];this.tokensMap=uniqueTokens.reduce((acc,tokType)=>(acc[tokType.name]=tokType,acc),{})}else{if("object"!=typeof tokenVocabulary||null===tokenVocabulary)throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=Object.assign({},tokenVocabulary)}this.tokensMap.EOF=EOF;const noTokenCategoriesUsed=(Object.hasOwn(tokenVocabulary,"modes")?Object.values(tokenVocabulary.modes).flat():Object.values(tokenVocabulary)).every(tokenConstructor=>{var _a2;return 0==(null===(_a2=tokenConstructor.categoryMatches)||void 0===_a2?void 0:_a2.length)});this.tokenMatcher=noTokenCategoriesUsed?tokenStructuredMatcherNoCategories:tokenStructuredMatcher,augmentTokenTypes(Object.values(this.tokensMap))}defineRule(ruleName,impl,config){if(this.selfAnalysisDone)throw Error(`Grammar rule <${ruleName}> 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 resyncEnabled=Object.hasOwn(config,"resyncEnabled")?config.resyncEnabled:DEFAULT_RULE_CONFIG.resyncEnabled,recoveryValueFunc=Object.hasOwn(config,"recoveryValueFunc")?config.recoveryValueFunc:DEFAULT_RULE_CONFIG.recoveryValueFunc,shortName=this.ruleShortNameIdx<<12;let coreRuleFunction;return this.ruleShortNameIdx++,this.shortRuleNameToFull[shortName]=ruleName,this.fullRuleNameToShort[ruleName]=shortName,coreRuleFunction=!0===this.outputCst?function(...args){try{this.ruleInvocationStateUpdate(shortName,ruleName,this.subruleIdx),impl.apply(this,args);const cst=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(cst),cst}catch(e){return this.invokeRuleCatch(e,resyncEnabled,recoveryValueFunc)}finally{this.ruleFinallyStateUpdate()}}:function(...args){try{return this.ruleInvocationStateUpdate(shortName,ruleName,this.subruleIdx),impl.apply(this,args)}catch(e){return this.invokeRuleCatch(e,resyncEnabled,recoveryValueFunc)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...args){this.onBeforeParse(ruleName);try{return coreRuleFunction.apply(this,args)}finally{this.onAfterParse(ruleName)}},{ruleName:ruleName,originalGrammarAction:impl,coreRule:coreRuleFunction})}invokeRuleCatch(e,resyncEnabledConfig,recoveryValueFunc){const isFirstInvokedRule=0===this.RULE_STACK_IDX,reSyncEnabled=resyncEnabledConfig&&!this.isBackTracking()&&this.recoveryEnabled;if(isRecognitionException(e)){const recogError=e;if(reSyncEnabled){const reSyncTokType=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(reSyncTokType)){if(recogError.resyncedTokens=this.reSyncTo(reSyncTokType),this.outputCst){const partialCstResult=this.CST_STACK[this.CST_STACK.length-1];return partialCstResult.recoveredNode=!0,partialCstResult}return recoveryValueFunc(e)}if(this.outputCst){const partialCstResult=this.CST_STACK[this.CST_STACK.length-1];partialCstResult.recoveredNode=!0,recogError.partialCstResult=partialCstResult}throw recogError}if(isFirstInvokedRule)return this.moveToTerminatedState(),recoveryValueFunc(e);throw recogError}throw e}optionInternal(actionORMethodDef,occurrence){const key=this.getKeyForAutomaticLookahead(512,occurrence);return this.optionInternalLogic(actionORMethodDef,occurrence,key)}optionInternalLogic(actionORMethodDef,occurrence,key){let action,lookAheadFunc=this.getLaFuncFromCache(key);if("function"!=typeof actionORMethodDef){action=actionORMethodDef.DEF;const predicate=actionORMethodDef.GATE;if(void 0!==predicate){const orgLookaheadFunction=lookAheadFunc;lookAheadFunc=()=>predicate.call(this)&&orgLookaheadFunction.call(this)}}else action=actionORMethodDef;if(!0===lookAheadFunc.call(this))return action.call(this)}atLeastOneInternal(prodOccurrence,actionORMethodDef){const laKey=this.getKeyForAutomaticLookahead(1024,prodOccurrence);return this.atLeastOneInternalLogic(prodOccurrence,actionORMethodDef,laKey)}atLeastOneInternalLogic(prodOccurrence,actionORMethodDef,key){let action,lookAheadFunc=this.getLaFuncFromCache(key);if("function"!=typeof actionORMethodDef){action=actionORMethodDef.DEF;const predicate=actionORMethodDef.GATE;if(void 0!==predicate){const orgLookaheadFunction=lookAheadFunc;lookAheadFunc=()=>predicate.call(this)&&orgLookaheadFunction.call(this)}}else action=actionORMethodDef;if(!0!==lookAheadFunc.call(this))throw this.raiseEarlyExitException(prodOccurrence,PROD_TYPE.REPETITION_MANDATORY,actionORMethodDef.ERR_MSG);{let notStuck=this.doSingleRepetition(action);for(;!0===lookAheadFunc.call(this)&&!0===notStuck;)notStuck=this.doSingleRepetition(action)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[prodOccurrence,actionORMethodDef],lookAheadFunc,1024,prodOccurrence,NextTerminalAfterAtLeastOneWalker)}atLeastOneSepFirstInternal(prodOccurrence,options){const laKey=this.getKeyForAutomaticLookahead(1536,prodOccurrence);this.atLeastOneSepFirstInternalLogic(prodOccurrence,options,laKey)}atLeastOneSepFirstInternalLogic(prodOccurrence,options,key){const action=options.DEF,separator=options.SEP;if(!0!==this.getLaFuncFromCache(key).call(this))throw this.raiseEarlyExitException(prodOccurrence,PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,options.ERR_MSG);{action.call(this);const separatorLookAheadFunc=()=>this.tokenMatcher(this.LA_FAST(1),separator);for(;!0===this.tokenMatcher(this.LA_FAST(1),separator);)this.CONSUME(separator),action.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[prodOccurrence,separator,separatorLookAheadFunc,action,NextTerminalAfterAtLeastOneSepWalker],separatorLookAheadFunc,1536,prodOccurrence,NextTerminalAfterAtLeastOneSepWalker)}}manyInternal(prodOccurrence,actionORMethodDef){const laKey=this.getKeyForAutomaticLookahead(768,prodOccurrence);return this.manyInternalLogic(prodOccurrence,actionORMethodDef,laKey)}manyInternalLogic(prodOccurrence,actionORMethodDef,key){let action,lookaheadFunction=this.getLaFuncFromCache(key);if("function"!=typeof actionORMethodDef){action=actionORMethodDef.DEF;const predicate=actionORMethodDef.GATE;if(void 0!==predicate){const orgLookaheadFunction=lookaheadFunction;lookaheadFunction=()=>predicate.call(this)&&orgLookaheadFunction.call(this)}}else action=actionORMethodDef;let notStuck=!0;for(;!0===lookaheadFunction.call(this)&&!0===notStuck;)notStuck=this.doSingleRepetition(action);this.attemptInRepetitionRecovery(this.manyInternal,[prodOccurrence,actionORMethodDef],lookaheadFunction,768,prodOccurrence,NextTerminalAfterManyWalker,notStuck)}manySepFirstInternal(prodOccurrence,options){const laKey=this.getKeyForAutomaticLookahead(1280,prodOccurrence);this.manySepFirstInternalLogic(prodOccurrence,options,laKey)}manySepFirstInternalLogic(prodOccurrence,options,key){const action=options.DEF,separator=options.SEP;if(!0===this.getLaFuncFromCache(key).call(this)){action.call(this);const separatorLookAheadFunc=()=>this.tokenMatcher(this.LA_FAST(1),separator);for(;!0===this.tokenMatcher(this.LA_FAST(1),separator);)this.CONSUME(separator),action.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[prodOccurrence,separator,separatorLookAheadFunc,action,NextTerminalAfterManySepWalker],separatorLookAheadFunc,1280,prodOccurrence,NextTerminalAfterManySepWalker)}}repetitionSepSecondInternal(prodOccurrence,separator,separatorLookAheadFunc,action,nextTerminalAfterWalker){for(;separatorLookAheadFunc();)this.CONSUME(separator),action.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[prodOccurrence,separator,separatorLookAheadFunc,action,nextTerminalAfterWalker],separatorLookAheadFunc,1536,prodOccurrence,nextTerminalAfterWalker)}doSingleRepetition(action){const beforeIteration=this.getLexerPosition();return action.call(this),this.getLexerPosition()>beforeIteration}orInternal(altsOrOpts,occurrence){const laKey=this.getKeyForAutomaticLookahead(256,occurrence),alts=Array.isArray(altsOrOpts)?altsOrOpts:altsOrOpts.DEF,altIdxToTake=this.getLaFuncFromCache(laKey).call(this,alts);if(void 0!==altIdxToTake)return alts[altIdxToTake].ALT.call(this);this.raiseNoAltException(occurrence,altsOrOpts.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX]),this.cstFinallyStateUpdate()}subruleInternal(ruleToCall,idx,options){let ruleResult;try{const args=void 0!==options?options.ARGS:void 0;return this.subruleIdx=idx,ruleResult=ruleToCall.coreRule.apply(this,args),this.cstPostNonTerminal(ruleResult,void 0!==options&&void 0!==options.LABEL?options.LABEL:ruleToCall.ruleName),ruleResult}catch(e){throw this.subruleInternalError(e,options,ruleToCall.ruleName)}}subruleInternalError(e,options,ruleName){throw isRecognitionException(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==options&&void 0!==options.LABEL?options.LABEL:ruleName),delete e.partialCstResult),e}consumeInternal(tokType,idx,options){let consumedToken;try{const nextToken=this.LA_FAST(1);!0===this.tokenMatcher(nextToken,tokType)?(this.consumeToken(),consumedToken=nextToken):this.consumeInternalError(tokType,nextToken,options)}catch(eFromConsumption){consumedToken=this.consumeInternalRecovery(tokType,idx,eFromConsumption)}return this.cstPostTerminal(void 0!==options&&void 0!==options.LABEL?options.LABEL:tokType.name,consumedToken),consumedToken}consumeInternalError(tokType,nextToken,options){let msg;const previousToken=this.LA(0);throw msg=void 0!==options&&options.ERR_MSG?options.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:tokType,actual:nextToken,previous:previousToken,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new MismatchedTokenException(msg,nextToken,previousToken))}consumeInternalRecovery(tokType,idx,eFromConsumption){if(!this.recoveryEnabled||"MismatchedTokenException"!==eFromConsumption.name||this.isBackTracking())throw eFromConsumption;{const follows=this.getFollowsForInRuleRecovery(tokType,idx);try{return this.tryInRuleRecovery(tokType,follows)}catch(eFromInRuleRecovery){throw"InRuleRecoveryException"===eFromInRuleRecovery.name?eFromConsumption:eFromInRuleRecovery}}}saveRecogState(){const savedErrors=this.errors,savedRuleStack=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:savedErrors,lexerState:this.exportLexerState(),RULE_STACK:savedRuleStack,CST_STACK:this.CST_STACK}}reloadRecogState(newState2){this.errors=newState2.errors,this.importLexerState(newState2.lexerState);const saved=newState2.RULE_STACK;for(let i=0;i<saved.length;i++)this.RULE_STACK[i]=saved[i];this.RULE_STACK_IDX=saved.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX])}ruleInvocationStateUpdate(shortName,fullName,idxInCallingRule){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=idxInCallingRule,this.RULE_STACK[++this.RULE_STACK_IDX]=shortName,this.currRuleShortName=shortName,this.cstInvocationStateUpdate(fullName)}isBackTracking(){return 0!==this.isBackTrackingStack.length}getCurrRuleFullName(){const shortName=this.currRuleShortName;return this.shortRuleNameToFull[shortName]}shortRuleNameToFullName(shortName){return this.shortRuleNameToFull[shortName]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),EOF)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(ruleName){for(let i=0;i<this.maxLookahead+1;i++)this.tokVector.push(END_OF_FILE)}onAfterParse(ruleName){if(!1===this.isAtEndOfInput()){const firstRedundantTok=this.LA(1),errMsg=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:firstRedundantTok,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new NotAllInputParsedException(errMsg,firstRedundantTok))}for(;this.tokVector.at(-1)===END_OF_FILE;)this.tokVector.pop()}},class{ACTION(impl){return impl.call(this)}consume(idx,tokType,options){return this.consumeInternal(tokType,idx,options)}subrule(idx,ruleToCall,options){return this.subruleInternal(ruleToCall,idx,options)}option(idx,actionORMethodDef){return this.optionInternal(actionORMethodDef,idx)}or(idx,altsOrOpts){return this.orInternal(altsOrOpts,idx)}many(idx,actionORMethodDef){return this.manyInternal(idx,actionORMethodDef)}atLeastOne(idx,actionORMethodDef){return this.atLeastOneInternal(idx,actionORMethodDef)}CONSUME(tokType,options){return this.consumeInternal(tokType,0,options)}CONSUME1(tokType,options){return this.consumeInternal(tokType,1,options)}CONSUME2(tokType,options){return this.consumeInternal(tokType,2,options)}CONSUME3(tokType,options){return this.consumeInternal(tokType,3,options)}CONSUME4(tokType,options){return this.consumeInternal(tokType,4,options)}CONSUME5(tokType,options){return this.consumeInternal(tokType,5,options)}CONSUME6(tokType,options){return this.consumeInternal(tokType,6,options)}CONSUME7(tokType,options){return this.consumeInternal(tokType,7,options)}CONSUME8(tokType,options){return this.consumeInternal(tokType,8,options)}CONSUME9(tokType,options){return this.consumeInternal(tokType,9,options)}SUBRULE(ruleToCall,options){return this.subruleInternal(ruleToCall,0,options)}SUBRULE1(ruleToCall,options){return this.subruleInternal(ruleToCall,1,options)}SUBRULE2(ruleToCall,options){return this.subruleInternal(ruleToCall,2,options)}SUBRULE3(ruleToCall,options){return this.subruleInternal(ruleToCall,3,options)}SUBRULE4(ruleToCall,options){return this.subruleInternal(ruleToCall,4,options)}SUBRULE5(ruleToCall,options){return this.subruleInternal(ruleToCall,5,options)}SUBRULE6(ruleToCall,options){return this.subruleInternal(ruleToCall,6,options)}SUBRULE7(ruleToCall,options){return this.subruleInternal(ruleToCall,7,options)}SUBRULE8(ruleToCall,options){return this.subruleInternal(ruleToCall,8,options)}SUBRULE9(ruleToCall,options){return this.subruleInternal(ruleToCall,9,options)}OPTION(actionORMethodDef){return this.optionInternal(actionORMethodDef,0)}OPTION1(actionORMethodDef){return this.optionInternal(actionORMethodDef,1)}OPTION2(actionORMethodDef){return this.optionInternal(actionORMethodDef,2)}OPTION3(actionORMethodDef){return this.optionInternal(actionORMethodDef,3)}OPTION4(actionORMethodDef){return this.optionInternal(actionORMethodDef,4)}OPTION5(actionORMethodDef){return this.optionInternal(actionORMethodDef,5)}OPTION6(actionORMethodDef){return this.optionInternal(actionORMethodDef,6)}OPTION7(actionORMethodDef){return this.optionInternal(actionORMethodDef,7)}OPTION8(actionORMethodDef){return this.optionInternal(actionORMethodDef,8)}OPTION9(actionORMethodDef){return this.optionInternal(actionORMethodDef,9)}OR(altsOrOpts){return this.orInternal(altsOrOpts,0)}OR1(altsOrOpts){return this.orInternal(altsOrOpts,1)}OR2(altsOrOpts){return this.orInternal(altsOrOpts,2)}OR3(altsOrOpts){return this.orInternal(altsOrOpts,3)}OR4(altsOrOpts){return this.orInternal(altsOrOpts,4)}OR5(altsOrOpts){return this.orInternal(altsOrOpts,5)}OR6(altsOrOpts){return this.orInternal(altsOrOpts,6)}OR7(altsOrOpts){return this.orInternal(altsOrOpts,7)}OR8(altsOrOpts){return this.orInternal(altsOrOpts,8)}OR9(altsOrOpts){return this.orInternal(altsOrOpts,9)}MANY(actionORMethodDef){this.manyInternal(0,actionORMethodDef)}MANY1(actionORMethodDef){this.manyInternal(1,actionORMethodDef)}MANY2(actionORMethodDef){this.manyInternal(2,actionORMethodDef)}MANY3(actionORMethodDef){this.manyInternal(3,actionORMethodDef)}MANY4(actionORMethodDef){this.manyInternal(4,actionORMethodDef)}MANY5(actionORMethodDef){this.manyInternal(5,actionORMethodDef)}MANY6(actionORMethodDef){this.manyInternal(6,actionORMethodDef)}MANY7(actionORMethodDef){this.manyInternal(7,actionORMethodDef)}MANY8(actionORMethodDef){this.manyInternal(8,actionORMethodDef)}MANY9(actionORMethodDef){this.manyInternal(9,actionORMethodDef)}MANY_SEP(options){this.manySepFirstInternal(0,options)}MANY_SEP1(options){this.manySepFirstInternal(1,options)}MANY_SEP2(options){this.manySepFirstInternal(2,options)}MANY_SEP3(options){this.manySepFirstInternal(3,options)}MANY_SEP4(options){this.manySepFirstInternal(4,options)}MANY_SEP5(options){this.manySepFirstInternal(5,options)}MANY_SEP6(options){this.manySepFirstInternal(6,options)}MANY_SEP7(options){this.manySepFirstInternal(7,options)}MANY_SEP8(options){this.manySepFirstInternal(8,options)}MANY_SEP9(options){this.manySepFirstInternal(9,options)}AT_LEAST_ONE(actionORMethodDef){this.atLeastOneInternal(0,actionORMethodDef)}AT_LEAST_ONE1(actionORMethodDef){return this.atLeastOneInternal(1,actionORMethodDef)}AT_LEAST_ONE2(actionORMethodDef){this.atLeastOneInternal(2,actionORMethodDef)}AT_LEAST_ONE3(actionORMethodDef){this.atLeastOneInternal(3,actionORMethodDef)}AT_LEAST_ONE4(actionORMethodDef){this.atLeastOneInternal(4,actionORMethodDef)}AT_LEAST_ONE5(actionORMethodDef){this.atLeastOneInternal(5,actionORMethodDef)}AT_LEAST_ONE6(actionORMethodDef){this.atLeastOneInternal(6,actionORMethodDef)}AT_LEAST_ONE7(actionORMethodDef){this.atLeastOneInternal(7,actionORMethodDef)}AT_LEAST_ONE8(actionORMethodDef){this.atLeastOneInternal(8,actionORMethodDef)}AT_LEAST_ONE9(actionORMethodDef){this.atLeastOneInternal(9,actionORMethodDef)}AT_LEAST_ONE_SEP(options){this.atLeastOneSepFirstInternal(0,options)}AT_LEAST_ONE_SEP1(options){this.atLeastOneSepFirstInternal(1,options)}AT_LEAST_ONE_SEP2(options){this.atLeastOneSepFirstInternal(2,options)}AT_LEAST_ONE_SEP3(options){this.atLeastOneSepFirstInternal(3,options)}AT_LEAST_ONE_SEP4(options){this.atLeastOneSepFirstInternal(4,options)}AT_LEAST_ONE_SEP5(options){this.atLeastOneSepFirstInternal(5,options)}AT_LEAST_ONE_SEP6(options){this.atLeastOneSepFirstInternal(6,options)}AT_LEAST_ONE_SEP7(options){this.atLeastOneSepFirstInternal(7,options)}AT_LEAST_ONE_SEP8(options){this.atLeastOneSepFirstInternal(8,options)}AT_LEAST_ONE_SEP9(options){this.atLeastOneSepFirstInternal(9,options)}RULE(name,implementation,config=DEFAULT_RULE_CONFIG){if(this.definedRulesNames.includes(name)){const error={message:defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:name,grammarName:this.className}),type:ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:name};this.definitionErrors.push(error)}this.definedRulesNames.push(name);const ruleImplementation=this.defineRule(name,implementation,config);return this[name]=ruleImplementation,ruleImplementation}OVERRIDE_RULE(name,impl,config=DEFAULT_RULE_CONFIG){const ruleErrors=function(ruleName,definedRulesNames,className){const errors=[];let errMsg;return definedRulesNames.includes(ruleName)||(errMsg=`Invalid rule override, rule: ->${ruleName}<- cannot be overridden in the grammar: ->${className}<-as it is not defined in any of the super grammars `,errors.push({message:errMsg,type:ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:ruleName})),errors}(name,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(ruleErrors);const ruleImplementation=this.defineRule(name,impl,config);return this[name]=ruleImplementation,ruleImplementation}BACKTRACK(grammarRule,args){var _a2;const ruleToCall=null!==(_a2=grammarRule.coreRule)&&void 0!==_a2?_a2:grammarRule;return function(){this.isBackTrackingStack.push(1);const orgState=this.saveRecogState();try{return ruleToCall.apply(this,args),!0}catch(e){if(isRecognitionException(e))return!1;throw e}finally{this.reloadRecogState(orgState),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Object.values(this.gastProductionsCache).map(serializeProduction)}},class{initErrorHandler(config){this._errors=[],this.errorMessageProvider=Object.hasOwn(config,"errorMessageProvider")?config.errorMessageProvider:DEFAULT_PARSER_CONFIG.errorMessageProvider}SAVE_ERROR(error){if(isRecognitionException(error))return error.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(error),error;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return[...this._errors]}set errors(newErrors){this._errors=newErrors}raiseEarlyExitException(occurrence,prodType,userDefinedErrMsg){const ruleName=this.getCurrRuleFullName(),insideProdPaths=getLookaheadPathsForOptionalProd(occurrence,this.getGAstProductions()[ruleName],prodType,this.maxLookahead)[0],actualTokens=[];for(let i=1;i<=this.maxLookahead;i++)actualTokens.push(this.LA(i));const msg=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:insideProdPaths,actual:actualTokens,previous:this.LA(0),customUserDescription:userDefinedErrMsg,ruleName:ruleName});throw this.SAVE_ERROR(new EarlyExitException(msg,this.LA(1),this.LA(0)))}raiseNoAltException(occurrence,errMsgTypes){const ruleName=this.getCurrRuleFullName(),lookAheadPathsPerAlternative=getLookaheadPathsForOr(occurrence,this.getGAstProductions()[ruleName],this.maxLookahead),actualTokens=[];for(let i=1;i<=this.maxLookahead;i++)actualTokens.push(this.LA(i));const previousToken=this.LA(0),errMsg=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:lookAheadPathsPerAlternative,actual:actualTokens,previous:previousToken,customUserDescription:errMsgTypes,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new NoViableAltException(errMsg,this.LA(1),previousToken))}},class{initGastRecorder(config){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let i=0;i<10;i++){const idx=i>0?i:"";this[`CONSUME${idx}`]=function(arg1,arg2){return this.consumeInternalRecord(arg1,i,arg2)},this[`SUBRULE${idx}`]=function(arg1,arg2){return this.subruleInternalRecord(arg1,i,arg2)},this[`OPTION${idx}`]=function(arg1){return this.optionInternalRecord(arg1,i)},this[`OR${idx}`]=function(arg1){return this.orInternalRecord(arg1,i)},this[`MANY${idx}`]=function(arg1){this.manyInternalRecord(i,arg1)},this[`MANY_SEP${idx}`]=function(arg1){this.manySepFirstInternalRecord(i,arg1)},this[`AT_LEAST_ONE${idx}`]=function(arg1){this.atLeastOneInternalRecord(i,arg1)},this[`AT_LEAST_ONE_SEP${idx}`]=function(arg1){this.atLeastOneSepFirstInternalRecord(i,arg1)}}this.consume=function(idx,arg1,arg2){return this.consumeInternalRecord(arg1,idx,arg2)},this.subrule=function(idx,arg1,arg2){return this.subruleInternalRecord(arg1,idx,arg2)},this.option=function(idx,arg1){return this.optionInternalRecord(arg1,idx)},this.or=function(idx,arg1){return this.orInternalRecord(arg1,idx)},this.many=function(idx,arg1){this.manyInternalRecord(idx,arg1)},this.atLeastOne=function(idx,arg1){this.atLeastOneInternalRecord(idx,arg1)},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 that=this;for(let i=0;i<10;i++){const idx=i>0?i:"";delete that[`CONSUME${idx}`],delete that[`SUBRULE${idx}`],delete that[`OPTION${idx}`],delete that[`OR${idx}`],delete that[`MANY${idx}`],delete that[`MANY_SEP${idx}`],delete that[`AT_LEAST_ONE${idx}`],delete that[`AT_LEAST_ONE_SEP${idx}`]}delete that.consume,delete that.subrule,delete that.option,delete that.or,delete that.many,delete that.atLeastOne,delete that.ACTION,delete that.BACKTRACK,delete that.LA})}ACTION_RECORD(impl){}BACKTRACK_RECORD(grammarRule,args){return()=>!0}LA_RECORD(howMuch){return END_OF_FILE}topLevelRuleRecord(name,def){try{const newTopLevelRule=new Rule({definition:[],name:name});return newTopLevelRule.name=name,this.recordingProdStack.push(newTopLevelRule),def.call(this),this.recordingProdStack.pop(),newTopLevelRule}catch(originalError){if(!0!==originalError.KNOWN_RECORDER_ERROR)try{originalError.message=originalError.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(mutabilityError){throw originalError}throw originalError}}optionInternalRecord(actionORMethodDef,occurrence){return recordProd.call(this,Option$1,actionORMethodDef,occurrence)}atLeastOneInternalRecord(occurrence,actionORMethodDef){recordProd.call(this,RepetitionMandatory,actionORMethodDef,occurrence)}atLeastOneSepFirstInternalRecord(occurrence,options){recordProd.call(this,RepetitionMandatoryWithSeparator,options,occurrence,!0)}manyInternalRecord(occurrence,actionORMethodDef){recordProd.call(this,Repetition,actionORMethodDef,occurrence)}manySepFirstInternalRecord(occurrence,options){recordProd.call(this,RepetitionWithSeparator,options,occurrence,!0)}orInternalRecord(altsOrOpts,occurrence){return recordOrProd.call(this,altsOrOpts,occurrence)}subruleInternalRecord(ruleToCall,occurrence,options){if(assertMethodIdxIsValid(occurrence),!ruleToCall||!Object.hasOwn(ruleToCall,"ruleName")){const error=new Error(`<SUBRULE${getIdxSuffix(occurrence)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(ruleToCall)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw error.KNOWN_RECORDER_ERROR=!0,error}const prevProd=this.recordingProdStack.at(-1),ruleName=ruleToCall.ruleName,newNoneTerminal=new NonTerminal({idx:occurrence,nonTerminalName:ruleName,label:null==options?void 0:options.LABEL,referencedRule:void 0});return prevProd.definition.push(newNoneTerminal),this.outputCst?RECORDING_PHASE_CSTNODE:RECORDING_NULL_OBJECT}consumeInternalRecord(tokType,occurrence,options){if(assertMethodIdxIsValid(occurrence),!hasShortKeyProperty(tokType)){const error=new Error(`<CONSUME${getIdxSuffix(occurrence)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(tokType)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw error.KNOWN_RECORDER_ERROR=!0,error}const prevProd=this.recordingProdStack.at(-1),newNoneTerminal=new Terminal({idx:occurrence,terminalType:tokType,label:null==options?void 0:options.LABEL});return prevProd.definition.push(newNoneTerminal),RECORDING_PHASE_TOKEN}},class{initPerformanceTracer(config){if(Object.hasOwn(config,"traceInitPerf")){const userTraceInitPerf=config.traceInitPerf,traceIsNumber="number"==typeof userTraceInitPerf;this.traceInitMaxIdent=traceIsNumber?userTraceInitPerf:1/0,this.traceInitPerf=traceIsNumber?userTraceInitPerf>0:userTraceInitPerf}else this.traceInitMaxIdent=0,this.traceInitPerf=DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(phaseDesc,phaseImpl){if(!0===this.traceInitPerf){this.traceInitIndent++;const indent=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${indent}--\x3e <${phaseDesc}>`);const{time:time,value:value}=timer(phaseImpl),traceMethod=time>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`),this.traceInitIndent--,value}return phaseImpl()}}].forEach(baseCtor=>{const baseProto=baseCtor.prototype;Object.getOwnPropertyNames(baseProto).forEach(propName=>{if("constructor"===propName)return;const basePropDescriptor=Object.getOwnPropertyDescriptor(baseProto,propName);basePropDescriptor&&(basePropDescriptor.get||basePropDescriptor.set)?Object.defineProperty(derivedCtor.prototype,propName,basePropDescriptor):derivedCtor.prototype[propName]=baseCtor.prototype[propName]})});class EmbeddedActionsParser extends Parser{constructor(tokenVocabulary,config=DEFAULT_PARSER_CONFIG){const configClone=Object.assign({},config);configClone.outputCst=!1,super(tokenVocabulary,configClone)}}function buildATNKey(rule,type,occurrence){return`${rule.name}_${type}_${occurrence}`}class AbstractTransition{constructor(target){this.target=target}isEpsilon(){return!1}}class AtomTransition extends AbstractTransition{constructor(target,tokenType){super(target),this.tokenType=tokenType}}class EpsilonTransition extends AbstractTransition{constructor(target){super(target)}isEpsilon(){return!0}}class RuleTransition extends AbstractTransition{constructor(ruleStart,rule,followState){super(ruleStart),this.rule=rule,this.followState=followState}isEpsilon(){return!0}}function createATN(rules){const atn={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};!function(atn,rules){const ruleLength=rules.length;for(let i=0;i<ruleLength;i++){const rule=rules[i],start=newState(atn,rule,void 0,{type:2}),stop=newState(atn,rule,void 0,{type:7});start.stop=stop,atn.ruleToStartState.set(rule,start),atn.ruleToStopState.set(rule,stop)}}(atn,rules);const ruleLength=rules.length;for(let i=0;i<ruleLength;i++){const rule=rules[i],ruleBlock=block(atn,rule,rule);void 0!==ruleBlock&&buildRuleHandle(atn,rule,ruleBlock)}return atn}function atom(atn,rule,production){return production instanceof Terminal?tokenRef(atn,rule,production.terminalType,production):production instanceof NonTerminal?function(atn,currentRule,nonTerminal){const rule=nonTerminal.referencedRule,start=atn.ruleToStartState.get(rule),left=newState(atn,currentRule,nonTerminal,{type:1}),right=newState(atn,currentRule,nonTerminal,{type:1}),call=new RuleTransition(start,rule,right);return addTransition(left,call),{left:left,right:right}}(atn,rule,production):production instanceof Alternation?function(atn,rule,alternation2){const start=newState(atn,rule,alternation2,{type:1});defineDecisionState(atn,start);const alts=map(alternation2.definition,e=>atom(atn,rule,e)),handle=makeAlts(atn,rule,start,alternation2,...alts);return handle}(atn,rule,production):production instanceof Option$1?function(atn,rule,option2){const start=newState(atn,rule,option2,{type:1});defineDecisionState(atn,start);const handle=makeAlts(atn,rule,start,option2,block(atn,rule,option2));return function(atn,rule,optional2,handle){const start=handle.left,end=handle.right;return epsilon(start,end),atn.decisionMap[buildATNKey(rule,"Option",optional2.idx)]=start,handle}(atn,rule,option2,handle)}(atn,rule,production):production instanceof Repetition?function(atn,rule,repetition2){const starState=newState(atn,rule,repetition2,{type:5});defineDecisionState(atn,starState);const handle=makeAlts(atn,rule,starState,repetition2,block(atn,rule,repetition2));return star(atn,rule,repetition2,handle)}(atn,rule,production):production instanceof RepetitionWithSeparator?function(atn,rule,repetition2){const starState=newState(atn,rule,repetition2,{type:5});defineDecisionState(atn,starState);const handle=makeAlts(atn,rule,starState,repetition2,block(atn,rule,repetition2)),sep=tokenRef(atn,rule,repetition2.separator,repetition2);return star(atn,rule,repetition2,handle,sep)}(atn,rule,production):production instanceof RepetitionMandatory?function(atn,rule,repetition2){const plusState=newState(atn,rule,repetition2,{type:4});defineDecisionState(atn,plusState);const handle=makeAlts(atn,rule,plusState,repetition2,block(atn,rule,repetition2));return plus(atn,rule,repetition2,handle)}(atn,rule,production):production instanceof RepetitionMandatoryWithSeparator?function(atn,rule,repetition2){const plusState=newState(atn,rule,repetition2,{type:4});defineDecisionState(atn,plusState);const handle=makeAlts(atn,rule,plusState,repetition2,block(atn,rule,repetition2)),sep=tokenRef(atn,rule,repetition2.separator,repetition2);return plus(atn,rule,repetition2,handle,sep)}(atn,rule,production):block(atn,rule,production)}function block(atn,rule,block2){const handles=filter(map(block2.definition,e=>atom(atn,rule,e)),e=>void 0!==e);return 1===handles.length?handles[0]:0===handles.length?void 0:function(atn,alts){const altsLength=alts.length;for(let i=0;i<altsLength-1;i++){const handle=alts[i];let transition;1===handle.left.transitions.length&&(transition=handle.left.transitions[0]);const isRuleTransition=transition instanceof RuleTransition,ruleTransition=transition,next=alts[i+1].left;1===handle.left.type&&1===handle.right.type&&void 0!==transition&&(isRuleTransition&&ruleTransition.followState===handle.right||transition.target===handle.right)?(isRuleTransition?ruleTransition.followState=next:transition.target=next,removeState(atn,handle.right)):epsilon(handle.right,next)}const first2=alts[0],last=alts[altsLength-1];return{left:first2.left,right:last.right}}(atn,handles)}function plus(atn,rule,plus2,handle,sep){const blkStart=handle.left,blkEnd=handle.right,loop=newState(atn,rule,plus2,{type:11});defineDecisionState(atn,loop);const end=newState(atn,rule,plus2,{type:12});return blkStart.loopback=loop,end.loopback=loop,atn.decisionMap[buildATNKey(rule,sep?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",plus2.idx)]=loop,epsilon(blkEnd,loop),void 0===sep?(epsilon(loop,blkStart),epsilon(loop,end)):(epsilon(loop,end),epsilon(loop,sep.left),epsilon(sep.right,blkStart)),{left:blkStart,right:end}}function star(atn,rule,star2,handle,sep){const start=handle.left,end=handle.right,entry=newState(atn,rule,star2,{type:10});defineDecisionState(atn,entry);const loopEnd=newState(atn,rule,star2,{type:12}),loop=newState(atn,rule,star2,{type:9});return entry.loopback=loop,loopEnd.loopback=loop,epsilon(entry,start),epsilon(entry,loopEnd),epsilon(end,loop),void 0!==sep?(epsilon(loop,loopEnd),epsilon(loop,sep.left),epsilon(sep.right,start)):epsilon(loop,entry),atn.decisionMap[buildATNKey(rule,sep?"RepetitionWithSeparator":"Repetition",star2.idx)]=entry,{left:entry,right:loopEnd}}function defineDecisionState(atn,state){return atn.decisionStates.push(state),state.decision=atn.decisionStates.length-1,state.decision}function makeAlts(atn,rule,start,production,...alts){const end=newState(atn,rule,production,{type:8,start:start});start.end=end;for(const alt of alts)void 0!==alt?(epsilon(start,alt.left),epsilon(alt.right,end)):epsilon(start,end);const handle={left:start,right:end};return atn.decisionMap[buildATNKey(rule,function(production){if(production instanceof Alternation)return"Alternation";if(production instanceof Option$1)return"Option";if(production instanceof Repetition)return"Repetition";if(production instanceof RepetitionWithSeparator)return"RepetitionWithSeparator";if(production instanceof RepetitionMandatory)return"RepetitionMandatory";if(production instanceof RepetitionMandatoryWithSeparator)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}(production),production.idx)]=start,handle}function tokenRef(atn,rule,tokenType,production){const left=newState(atn,rule,production,{type:1}),right=newState(atn,rule,production,{type:1});return addTransition(left,new AtomTransition(right,tokenType)),{left:left,right:right}}function buildRuleHandle(atn,rule,block2){const start=atn.ruleToStartState.get(rule);epsilon(start,block2.left);const stop=atn.ruleToStopState.get(rule);epsilon(block2.right,stop);return{left:start,right:stop}}function epsilon(a,b){addTransition(a,new EpsilonTransition(b))}function newState(atn,rule,production,partial){const t=Object.assign({atn:atn,production:production,epsilonOnlyTransitions:!1,rule:rule,transitions:[],nextTokenWithinRule:[],stateNumber:atn.states.length},partial);return atn.states.push(t),t}function addTransition(state,transition){0===state.transitions.length&&(state.epsilonOnlyTransitions=transition.isEpsilon()),state.transitions.push(transition)}function removeState(atn,state){atn.states.splice(atn.states.indexOf(state),1)}const DFA_ERROR={};class ATNConfigSet{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(config){const key=getATNConfigKey(config);key in this.map||(this.map[key]=this.configs.length,this.configs.push(config))}get elements(){return this.configs}get alts(){return map(this.configs,e=>e.alt)}get key(){let value="";for(const k in this.map)value+=k+":";return value}}function getATNConfigKey(config,alt=!0){return`${alt?`a${config.alt}`:""}s${config.state.stateNumber}:${config.stack.map(e=>e.stateNumber.toString()).join("_")}`}function createDFACache(startState,decision){const map2={};return predicateSet=>{const key=predicateSet.toString();let existing=map2[key];return void 0!==existing||(existing={atnStartState:startState,decision:decision,states:{}},map2[key]=existing),existing}}class PredicateSet{constructor(){this.predicates=[]}is(index){return index>=this.predicates.length||this.predicates[index]}set(index,value){this.predicates[index]=value}toString(){let value="";const size=this.predicates.length;for(let i=0;i<size;i++)value+=!0===this.predicates[i]?"1":"0";return value}}const EMPTY_PREDICATES=new PredicateSet;class LLStarLookaheadStrategy extends LLkLookaheadStrategy{constructor(options){var _a2;super(),this.logging=null!==(_a2=null==options?void 0:options.logging)&&void 0!==_a2?_a2:message=>console.log(message)}initialize(options){this.atn=createATN(options.rules),this.dfas=function(atn){const decisionLength=atn.decisionStates.length,decisionToDFA=Array(decisionLength);for(let i=0;i<decisionLength;i++)decisionToDFA[i]=createDFACache(atn.decisionStates[i],i);return decisionToDFA}(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(options){const{prodOccurrence:prodOccurrence,rule:rule,hasPredicates:hasPredicates,dynamicTokensEnabled:dynamicTokensEnabled}=options,dfas=this.dfas,logging=this.logging,key=buildATNKey(rule,"Alternation",prodOccurrence),decisionIndex=this.atn.decisionMap[key].decision,partialAlts=map(getLookaheadPaths({maxLookahead:1,occurrence:prodOccurrence,prodType:"Alternation",rule:rule}),currAlt=>map(currAlt,path=>path[0]));if(isLL1Sequence(partialAlts,!1)&&!dynamicTokensEnabled){const choiceToAlt=reduce(partialAlts,(result,currAlt,idx)=>(forEach(currAlt,currTokType=>{currTokType&&(result[currTokType.tokenTypeIdx]=idx,forEach(currTokType.categoryMatches,currExtendingType=>{result[currExtendingType]=idx}))}),result),{});return hasPredicates?function(orAlts){var _a2;const nextToken=this.LA_FAST(1),prediction=choiceToAlt[nextToken.tokenTypeIdx];if(void 0!==orAlts&&void 0!==prediction){const gate=null===(_a2=orAlts[prediction])||void 0===_a2?void 0:_a2.GATE;if(void 0!==gate&&!1===gate.call(this))return}return prediction}:function(){const nextToken=this.LA_FAST(1);return choiceToAlt[nextToken.tokenTypeIdx]}}return hasPredicates?function(orAlts){const predicates=new PredicateSet,length=void 0===orAlts?0:orAlts.length;for(let i=0;i<length;i++){const gate=null==orAlts?void 0:orAlts[i].GATE;predicates.set(i,void 0===gate||gate.call(this))}const result=adaptivePredict.call(this,dfas,decisionIndex,predicates,logging);return"number"==typeof result?result:void 0}:function(){const result=adaptivePredict.call(this,dfas,decisionIndex,EMPTY_PREDICATES,logging);return"number"==typeof result?result:void 0}}buildLookaheadForOptional(options){const{prodOccurrence:prodOccurrence,rule:rule,prodType:prodType,dynamicTokensEnabled:dynamicTokensEnabled}=options,dfas=this.dfas,logging=this.logging,key=buildATNKey(rule,prodType,prodOccurrence),decisionIndex=this.atn.decisionMap[key].decision,alts=map(getLookaheadPaths({maxLookahead:1,occurrence:prodOccurrence,prodType:prodType,rule:rule}),e=>map(e,g=>g[0]));if(isLL1Sequence(alts)&&alts[0][0]&&!dynamicTokensEnabled){const alt=alts[0],singleTokensTypes=flatten(alt);if(1===singleTokensTypes.length&&isEmpty(singleTokensTypes[0].categoryMatches)){const expectedTokenUniqueKey=singleTokensTypes[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===expectedTokenUniqueKey}}{const choiceToAlt=reduce(singleTokensTypes,(result,currTokType)=>(void 0!==currTokType&&(result[currTokType.tokenTypeIdx]=!0,forEach(currTokType.categoryMatches,currExtendingType=>{result[currExtendingType]=!0})),result),{});return function(){const nextToken=this.LA_FAST(1);return!0===choiceToAlt[nextToken.tokenTypeIdx]}}}return function(){const result=adaptivePredict.call(this,dfas,decisionIndex,EMPTY_PREDICATES,logging);return"object"!=typeof result&&0===result}}}function isLL1Sequence(sequences,allowEmpty=!0){const fullSet=new Set;for(const alt of sequences){const altSet=new Set;for(const tokType of alt){if(void 0===tokType){if(allowEmpty)break;return!1}const indices=[tokType.tokenTypeIdx].concat(tokType.categoryMatches);for(const index of indices)if(fullSet.has(index)){if(!altSet.has(index))return!1}else fullSet.add(index),altSet.add(index)}}return!0}function adaptivePredict(dfaCaches,decision,predicateSet,logging){const dfa=dfaCaches[decision](predicateSet);let start=dfa.start;if(void 0===start){start=addDFAState(dfa,newDFAState(function(atnState){const configs=new ATNConfigSet,numberOfTransitions=atnState.transitions.length;for(let i=0;i<numberOfTransitions;i++){closure({state:atnState.transitions[i].target,alt:i,stack:[]},configs)}return configs}(dfa.atnStartState))),dfa.start=start}return performLookahead.apply(this,[dfa,start,predicateSet,logging])}function performLookahead(dfa,s0,predicateSet,logging){let previousD=s0,i=1;const path=[];let t=this.LA_FAST(i++);for(;;){let d=getExistingTargetState(previousD,t);if(void 0===d&&(d=computeLookaheadTarget.apply(this,[dfa,previousD,t,i,predicateSet,logging])),d===DFA_ERROR)return buildAdaptivePredictError(path,previousD,t);if(!0===d.isAcceptState)return d.prediction;previousD=d,path.push(t),t=this.LA(i++)}}function computeLookaheadTarget(dfa,previousD,token,lookahead,predicateSet,logging){const reach=function(configs,token,predicateSet){const intermediate=new ATNConfigSet,skippedStopStates=[];for(const c of configs.elements){if(!1===predicateSet.is(c.alt))continue;if(7===c.state.type){skippedStopStates.push(c);continue}const transitionLength=c.state.transitions.length;for(let i=0;i<transitionLength;i++){const target=getReachableTarget(c.state.transitions[i],token);void 0!==target&&intermediate.add({state:target,alt:c.alt,stack:c.stack})}}let reach;0===skippedStopStates.length&&1===intermediate.size&&(reach=intermediate);if(void 0===reach){reach=new ATNConfigSet;for(const c of intermediate.elements)closure(c,reach)}if(skippedStopStates.length>0&&!function(configs){for(const c of configs.elements)if(7===c.state.type)return!0;return!1}(reach))for(const c of skippedStopStates)reach.add(c);return reach}(previousD.configs,token,predicateSet);if(0===reach.size)return addDFAEdge(dfa,previousD,token,DFA_ERROR),DFA_ERROR;let newState2=newDFAState(reach);const predictedAlt=function(configs,predicateSet){let alt;for(const c of configs.elements)if(!0===predicateSet.is(c.alt))if(void 0===alt)alt=c.alt;else if(alt!==c.alt)return;return alt}(reach,predicateSet);if(void 0!==predictedAlt)newState2.isAcceptState=!0,newState2.prediction=predictedAlt,newState2.configs.uniqueAlt=predictedAlt;else if(function(configs){if(function(configs){for(const c of configs.elements)if(7!==c.state.type)return!1;return!0}(configs))return!0;const altSets=function(configs){const configToAlts=new Map;for(const c of configs){const key=getATNConfigKey(c,!1);let alts=configToAlts.get(key);void 0===alts&&(alts={},configToAlts.set(key,alts)),alts[c.alt]=!0}return configToAlts}(configs.elements);return function(altSets){for(const value of Array.from(altSets.values()))if(Object.keys(value).length>1)return!0;return!1}(altSets)&&!function(altSets){for(const value of Array.from(altSets.values()))if(1===Object.keys(value).length)return!0;return!1}(altSets)}(reach)){const prediction=min(reach.alts);newState2.isAcceptState=!0,newState2.prediction=prediction,newState2.configs.uniqueAlt=prediction,reportLookaheadAmbiguity.apply(this,[dfa,lookahead,reach.alts,logging])}return newState2=addDFAEdge(dfa,previousD,token,newState2),newState2}function reportLookaheadAmbiguity(dfa,lookahead,ambiguityIndices,logging){const prefixPath=[];for(let i=1;i<=lookahead;i++)prefixPath.push(this.LA(i).tokenType);const atnState=dfa.atnStartState;logging(function(options){const pathMsg=map(options.prefixPath,currtok=>tokenLabel(currtok)).join(", "),occurrence=0===options.production.idx?"":options.production.idx;let currMessage=`Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(", ")}> in <${function(prod){if(prod instanceof NonTerminal)return"SUBRULE";if(prod instanceof Option$1)return"OPTION";if(prod instanceof Alternation)return"OR";if(prod instanceof RepetitionMandatory)return"AT_LEAST_ONE";if(prod instanceof RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(prod instanceof RepetitionWithSeparator)return"MANY_SEP";if(prod instanceof Repetition)return"MANY";if(prod instanceof Terminal)return"CONSUME";throw Error("non exhaustive match")}(options.production)}${occurrence}> inside <${options.topLevelRule.name}> Rule,\n<${pathMsg}> may appears as a prefix path in all these alternatives.\n`;return currMessage+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",currMessage}({topLevelRule:atnState.rule,ambiguityIndices:ambiguityIndices,production:atnState.production,prefixPath:prefixPath}))}function buildAdaptivePredictError(path,previous,current){var collection;return{actualToken:current,possibleTokenTypes:function(array,iteratee){return array&&array.length?baseUniq(array,baseIteratee(iteratee)):[]}((collection=previous.configs.elements,baseFlatten(map(collection,e=>e.state.transitions))).filter(e=>e instanceof AtomTransition).map(e=>e.tokenType),e=>e.tokenTypeIdx),tokenPath:path}}function getExistingTargetState(state,token){return state.edges[token.tokenTypeIdx]}function getReachableTarget(transition,token){if(transition instanceof AtomTransition&&tokenMatcher(token,transition.tokenType))return transition.target}function newDFAState(closure2){return{configs:closure2,edges:{},isAcceptState:!1,prediction:-1}}function addDFAEdge(dfa,from,token,to){return to=addDFAState(dfa,to),from.edges[token.tokenTypeIdx]=to,to}function addDFAState(dfa,state){if(state===DFA_ERROR)return state;const mapKey=state.configs.key,existing=dfa.states[mapKey];return void 0!==existing?existing:(state.configs.finalize(),dfa.states[mapKey]=state,state)}function closure(config,configs){const p=config.state;if(7===p.type){if(config.stack.length>0){const atnStack=[...config.stack];closure({state:atnStack.pop(),alt:config.alt,stack:atnStack},configs)}else configs.add(config);return}p.epsilonOnlyTransitions||configs.add(config);const transitionLength=p.transitions.length;for(let i=0;i<transitionLength;i++){const c=getEpsilonTarget(config,p.transitions[i]);void 0!==c&&closure(c,configs)}}function getEpsilonTarget(config,transition){if(transition instanceof EpsilonTransition)return{state:transition.target,alt:config.alt,stack:config.stack};if(transition instanceof RuleTransition){const stack=[...config.stack,transition.followState];return{state:transition.target,alt:config.alt,stack:stack}}}var DocumentUri,URI$1,integer,integer2,uinteger,uinteger2,Position,Position2,Range,Range2,Location,Location2,LocationLink,LocationLink2,Color,Color2,ColorInformation,ColorInformation2,ColorPresentation,ColorPresentation2,FoldingRangeKind,FoldingRangeKind2,FoldingRange,FoldingRange2,DiagnosticRelatedInformation,DiagnosticRelatedInformation2,DiagnosticSeverity,DiagnosticSeverity2,DiagnosticTag,DiagnosticTag2,CodeDescription,Diagnostic,Diagnostic2,Command,Command2,TextEdit,TextEdit2,ChangeAnnotation,ChangeAnnotation2,ChangeAnnotationIdentifier,AnnotatedTextEdit,AnnotatedTextEdit2,TextDocumentEdit,TextDocumentEdit2,CreateFile,CreateFile2,RenameFile,RenameFile2,DeleteFile,DeleteFile2,WorkspaceEdit,TextDocumentIdentifier,TextDocumentIdentifier2,VersionedTextDocumentIdentifier,VersionedTextDocumentIdentifier2,OptionalVersionedTextDocumentIdentifier,OptionalVersionedTextDocumentIdentifier2,TextDocumentItem,TextDocumentItem2,MarkupKind,MarkupKind2,MarkupContent,CompletionItemKind,CompletionItemKind2,InsertTextFormat,InsertTextFormat2,CompletionItemTag,InsertReplaceEdit,InsertReplaceEdit2,InsertTextMode,InsertTextMode2,CompletionItemLabelDetails,CompletionItem,CompletionList,MarkedString,MarkedString2,Hover,ParameterInformation,SignatureInformation,DocumentHighlightKind,DocumentHighlightKind2,DocumentHighlight,SymbolKind,SymbolKind2,SymbolTag,SymbolInformation,WorkspaceSymbol,DocumentSymbol,DocumentSymbol2,CodeActionKind,CodeActionKind2,CodeActionTriggerKind,CodeActionTriggerKind2,CodeActionContext,CodeActionContext2,CodeAction,CodeAction2,CodeLens,CodeLens2,FormattingOptions,FormattingOptions2,DocumentLink,DocumentLink2,SelectionRange,SelectionRange2,SemanticTokenTypes,SemanticTokenTypes2,SemanticTokenModifiers,SemanticTokenModifiers2,SemanticTokens,InlineValueText,InlineValueText2,InlineValueVariableLookup,InlineValueVariableLookup2,InlineValueEvaluatableExpression,InlineValueEvaluatableExpression2,InlineValueContext,InlineValueContext2,InlayHintKind,InlayHintKind2,InlayHintLabelPart,InlayHintLabelPart2,InlayHint,InlayHint2,StringValue,InlineCompletionItem,InlineCompletionList,InlineCompletionTriggerKind,InlineCompletionTriggerKind2,SelectedCompletionInfo,InlineCompletionContext,WorkspaceFolder;(DocumentUri||(DocumentUri={})).is=function(value){return"string"==typeof value},(URI$1||(URI$1={})).is=function(value){return"string"==typeof value},(integer2=integer||(integer={})).MIN_VALUE=-2147483648,integer2.MAX_VALUE=2147483647,integer2.is=function(value){return"number"==typeof value&&integer2.MIN_VALUE<=value&&value<=integer2.MAX_VALUE},(uinteger2=uinteger||(uinteger={})).MIN_VALUE=0,uinteger2.MAX_VALUE=2147483647,uinteger2.is=function(value){return"number"==typeof value&&uinteger2.MIN_VALUE<=value&&value<=uinteger2.MAX_VALUE},(Position2=Position||(Position={})).create=function(line,character){return line===Number.MAX_VALUE&&(line=uinteger.MAX_VALUE),character===Number.MAX_VALUE&&(character=uinteger.MAX_VALUE),{line:line,character:character}},Position2.is=function(value){let candidate=value;return Is.objectLiteral(candidate)&&Is.uinteger(candidate.line)&&Is.uinteger(candidate.character)},(Range2=Range||(Range={})).create=function(one,two,three,four){if(Is.uinteger(one)&&Is.uinteger(two)&&Is.uinteger(three)&&Is.uinteger(four))return{start:Position.create(one,two),end:Position.create(three,four)};if(Position.is(one)&&Position.is(two))return{start:one,end:two};throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`)},Range2.is=function(value){let candidate=value;return Is.objectLiteral(candidate)&&Position.is(candidate.start)&&Position.is(candidate.end)},(Location2=Location||(Location={})).create=function(uri,range){return{uri:uri,range:range}},Location2.is=function(value){let candidate=value;return Is.objectLiteral(candidate)&&Range.is(candidate.range)&&(Is.string(candidate.uri)||Is.undefined(candidate.uri))},(LocationLink2=LocationLink||(LocationLink={})).create=function(targetUri,targetRange,targetSelectionRange,originSelectionRange){return{targetUri:targetUri,targetRange:targetRange,targetSelectionRange:targetSelectionRange,originSelectionRange:originSelectionRange}},LocationLink2.is=function(value){let candidate=value;return Is.objectLiteral(candidate)&&Range.is(candidate.targetRange)&&Is.string(candidate.targetUri)&&Range.is(candidate.targetSelectionRange)&&(Range.is(candidate.originSelectionRange)||Is.undefined(candidate.originSelectionRange))},(Color2=Color||(Color={})).create=function(red,green,blue,alpha){return{red:red,green:green,blue:blue,alpha:alpha}},Color2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.numberRange(candidate.red,0,1)&&Is.numberRange(candidate.green,0,1)&&Is.numberRange(candidate.blue,0,1)&&Is.numberRange(candidate.alpha,0,1)},(ColorInformation2=ColorInformation||(ColorInformation={})).create=function(range,color){return{range:range,color:color}},ColorInformation2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Range.is(candidate.range)&&Color.is(candidate.color)},(ColorPresentation2=ColorPresentation||(ColorPresentation={})).create=function(label,textEdit,additionalTextEdits){return{label:label,textEdit:textEdit,additionalTextEdits:additionalTextEdits}},ColorPresentation2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.string(candidate.label)&&(Is.undefined(candidate.textEdit)||TextEdit.is(candidate))&&(Is.undefined(candidate.additionalTextEdits)||Is.typedArray(candidate.additionalTextEdits,TextEdit.is))},(FoldingRangeKind2=FoldingRangeKind||(FoldingRangeKind={})).Comment="comment",FoldingRangeKind2.Imports="imports",FoldingRangeKind2.Region="region",(FoldingRange2=FoldingRange||(FoldingRange={})).create=function(startLine,endLine,startCharacter,endCharacter,kind,collapsedText){const result={startLine:startLine,endLine:endLine};return Is.defined(startCharacter)&&(result.startCharacter=startCharacter),Is.defined(endCharacter)&&(result.endCharacter=endCharacter),Is.defined(kind)&&(result.kind=kind),Is.defined(collapsedText)&&(result.collapsedText=collapsedText),result},FoldingRange2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.uinteger(candidate.startLine)&&Is.uinteger(candidate.startLine)&&(Is.undefined(candidate.startCharacter)||Is.uinteger(candidate.startCharacter))&&(Is.undefined(candidate.endCharacter)||Is.uinteger(candidate.endCharacter))&&(Is.undefined(candidate.kind)||Is.string(candidate.kind))},(DiagnosticRelatedInformation2=DiagnosticRelatedInformation||(DiagnosticRelatedInformation={})).create=function(location,message){return{location:location,message:message}},DiagnosticRelatedInformation2.is=function(value){let candidate=value;return Is.defined(candidate)&&Location.is(candidate.location)&&Is.string(candidate.message)},(DiagnosticSeverity2=DiagnosticSeverity||(DiagnosticSeverity={})).Error=1,DiagnosticSeverity2.Warning=2,DiagnosticSeverity2.Information=3,DiagnosticSeverity2.Hint=4,(DiagnosticTag2=DiagnosticTag||(DiagnosticTag={})).Unnecessary=1,DiagnosticTag2.Deprecated=2,(CodeDescription||(CodeDescription={})).is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.string(candidate.href)},(Diagnostic2=Diagnostic||(Diagnostic={})).create=function(range,message,severity,code,source,relatedInformation){let result={range:range,message:message};return Is.defined(severity)&&(result.severity=severity),Is.defined(code)&&(result.code=code),Is.defined(source)&&(result.source=source),Is.defined(relatedInformation)&&(result.relatedInformation=relatedInformation),result},Diagnostic2.is=function(value){var _a2;let candidate=value;return Is.defined(candidate)&&Range.is(candidate.range)&&Is.string(candidate.message)&&(Is.number(candidate.severity)||Is.undefined(candidate.severity))&&(Is.integer(candidate.code)||Is.string(candidate.code)||Is.undefined(candidate.code))&&(Is.undefined(candidate.codeDescription)||Is.string(null===(_a2=candidate.codeDescription)||void 0===_a2?void 0:_a2.href))&&(Is.string(candidate.source)||Is.undefined(candidate.source))&&(Is.undefined(candidate.relatedInformation)||Is.typedArray(candidate.relatedInformation,DiagnosticRelatedInformation.is))},(Command2=Command||(Command={})).create=function(title,command,...args){let result={title:title,command:command};return Is.defined(args)&&args.length>0&&(result.arguments=args),result},Command2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.string(candidate.title)&&Is.string(candidate.command)},(TextEdit2=TextEdit||(TextEdit={})).replace=function(range,newText){return{range:range,newText:newText}},TextEdit2.insert=function(position,newText){return{range:{start:position,end:position},newText:newText}},TextEdit2.del=function(range){return{range:range,newText:""}},TextEdit2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.string(candidate.newText)&&Range.is(candidate.range)},(ChangeAnnotation2=ChangeAnnotation||(ChangeAnnotation={})).create=function(label,needsConfirmation,description){const result={label:label};return void 0!==needsConfirmation&&(result.needsConfirmation=needsConfirmation),void 0!==description&&(result.description=description),result},ChangeAnnotation2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.string(candidate.label)&&(Is.boolean(candidate.needsConfirmation)||void 0===candidate.needsConfirmation)&&(Is.string(candidate.description)||void 0===candidate.description)},(ChangeAnnotationIdentifier||(ChangeAnnotationIdentifier={})).is=function(value){const candidate=value;return Is.string(candidate)},(AnnotatedTextEdit2=AnnotatedTextEdit||(AnnotatedTextEdit={})).replace=function(range,newText,annotation){return{range:range,newText:newText,annotationId:annotation}},AnnotatedTextEdit2.insert=function(position,newText,annotation){return{range:{start:position,end:position},newText:newText,annotationId:annotation}},AnnotatedTextEdit2.del=function(range,annotation){return{range:range,newText:"",annotationId:annotation}},AnnotatedTextEdit2.is=function(value){const candidate=value;return TextEdit.is(candidate)&&(ChangeAnnotation.is(candidate.annotationId)||ChangeAnnotationIdentifier.is(candidate.annotationId))},(TextDocumentEdit2=TextDocumentEdit||(TextDocumentEdit={})).create=function(textDocument,edits){return{textDocument:textDocument,edits:edits}},TextDocumentEdit2.is=function(value){let candidate=value;return Is.defined(candidate)&&OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)&&Array.isArray(candidate.edits)},(CreateFile2=CreateFile||(CreateFile={})).create=function(uri,options,annotation){let result={kind:"create",uri:uri};return void 0===options||void 0===options.overwrite&&void 0===options.ignoreIfExists||(result.options=options),void 0!==annotation&&(result.annotationId=annotation),result},CreateFile2.is=function(value){let candidate=value;return candidate&&"create"===candidate.kind&&Is.string(candidate.uri)&&(void 0===candidate.options||(void 0===candidate.options.overwrite||Is.boolean(candidate.options.overwrite))&&(void 0===candidate.options.ignoreIfExists||Is.boolean(candidate.options.ignoreIfExists)))&&(void 0===candidate.annotationId||ChangeAnnotationIdentifier.is(candidate.annotationId))},(RenameFile2=RenameFile||(RenameFile={})).create=function(oldUri,newUri,options,annotation){let result={kind:"rename",oldUri:oldUri,newUri:newUri};return void 0===options||void 0===options.overwrite&&void 0===options.ignoreIfExists||(result.options=options),void 0!==annotation&&(result.annotationId=annotation),result},RenameFile2.is=function(value){let candidate=value;return candidate&&"rename"===candidate.kind&&Is.string(candidate.oldUri)&&Is.string(candidate.newUri)&&(void 0===candidate.options||(void 0===candidate.options.overwrite||Is.boolean(candidate.options.overwrite))&&(void 0===candidate.options.ignoreIfExists||Is.boolean(candidate.options.ignoreIfExists)))&&(void 0===candidate.annotationId||ChangeAnnotationIdentifier.is(candidate.annotationId))},(DeleteFile2=DeleteFile||(DeleteFile={})).create=function(uri,options,annotation){let result={kind:"delete",uri:uri};return void 0===options||void 0===options.recursive&&void 0===options.ignoreIfNotExists||(result.options=options),void 0!==annotation&&(result.annotationId=annotation),result},DeleteFile2.is=function(value){let candidate=value;return candidate&&"delete"===candidate.kind&&Is.string(candidate.uri)&&(void 0===candidate.options||(void 0===candidate.options.recursive||Is.boolean(candidate.options.recursive))&&(void 0===candidate.options.ignoreIfNotExists||Is.boolean(candidate.options.ignoreIfNotExists)))&&(void 0===candidate.annotationId||ChangeAnnotationIdentifier.is(candidate.annotationId))},(WorkspaceEdit||(WorkspaceEdit={})).is=function(value){let candidate=value;return candidate&&(void 0!==candidate.changes||void 0!==candidate.documentChanges)&&(void 0===candidate.documentChanges||candidate.documentChanges.every(change=>Is.string(change.kind)?CreateFile.is(change)||RenameFile.is(change)||DeleteFile.is(change):TextDocumentEdit.is(change)))};class TextEditChangeImpl{constructor(edits,changeAnnotations){this.edits=edits,this.changeAnnotations=changeAnnotations}insert(position,newText,annotation){let edit,id;if(void 0===annotation?edit=TextEdit.insert(position,newText):ChangeAnnotationIdentifier.is(annotation)?(id=annotation,edit=AnnotatedTextEdit.insert(position,newText,annotation)):(this.assertChangeAnnotations(this.changeAnnotations),id=this.changeAnnotations.manage(annotation),edit=AnnotatedTextEdit.insert(position,newText,id)),this.edits.push(edit),void 0!==id)return id}replace(range,newText,annotation){let edit,id;if(void 0===annotation?edit=TextEdit.replace(range,newText):ChangeAnnotationIdentifier.is(annotation)?(id=annotation,edit=AnnotatedTextEdit.replace(range,newText,annotation)):(this.assertChangeAnnotations(this.changeAnnotations),id=this.changeAnnotations.manage(annotation),edit=AnnotatedTextEdit.replace(range,newText,id)),this.edits.push(edit),void 0!==id)return id}delete(range,annotation){let edit,id;if(void 0===annotation?edit=TextEdit.del(range):ChangeAnnotationIdentifier.is(annotation)?(id=annotation,edit=AnnotatedTextEdit.del(range,annotation)):(this.assertChangeAnnotations(this.changeAnnotations),id=this.changeAnnotations.manage(annotation),edit=AnnotatedTextEdit.del(range,id)),this.edits.push(edit),void 0!==id)return id}add(edit){this.edits.push(edit)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(value){if(void 0===value)throw new Error("Text edit change is not configured to manage change annotations.")}}class ChangeAnnotations{constructor(annotations){this._annotations=void 0===annotations?Object.create(null):annotations,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(idOrAnnotation,annotation){let id;if(ChangeAnnotationIdentifier.is(idOrAnnotation)?id=idOrAnnotation:(id=this.nextId(),annotation=idOrAnnotation),void 0!==this._annotations[id])throw new Error(`Id ${id} is already in use.`);if(void 0===annotation)throw new Error(`No annotation provided for id ${id}`);return this._annotations[id]=annotation,this._size++,id}nextId(){return this._counter++,this._counter.toString()}}(TextDocumentIdentifier2=TextDocumentIdentifier||(TextDocumentIdentifier={})).create=function(uri){return{uri:uri}},TextDocumentIdentifier2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.string(candidate.uri)},(VersionedTextDocumentIdentifier2=VersionedTextDocumentIdentifier||(VersionedTextDocumentIdentifier={})).create=function(uri,version){return{uri:uri,version:version}},VersionedTextDocumentIdentifier2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.string(candidate.uri)&&Is.integer(candidate.version)},(OptionalVersionedTextDocumentIdentifier2=OptionalVersionedTextDocumentIdentifier||(OptionalVersionedTextDocumentIdentifier={})).create=function(uri,version){return{uri:uri,version:version}},OptionalVersionedTextDocumentIdentifier2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.string(candidate.uri)&&(null===candidate.version||Is.integer(candidate.version))},(TextDocumentItem2=TextDocumentItem||(TextDocumentItem={})).create=function(uri,languageId,version,text){return{uri:uri,languageId:languageId,version:version,text:text}},TextDocumentItem2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.string(candidate.uri)&&Is.string(candidate.languageId)&&Is.integer(candidate.version)&&Is.string(candidate.text)},(MarkupKind2=MarkupKind||(MarkupKind={})).PlainText="plaintext",MarkupKind2.Markdown="markdown",MarkupKind2.is=function(value){const candidate=value;return candidate===MarkupKind2.PlainText||candidate===MarkupKind2.Markdown},(MarkupContent||(MarkupContent={})).is=function(value){const candidate=value;return Is.objectLiteral(value)&&MarkupKind.is(candidate.kind)&&Is.string(candidate.value)},(CompletionItemKind2=CompletionItemKind||(CompletionItemKind={})).Text=1,CompletionItemKind2.Method=2,CompletionItemKind2.Function=3,CompletionItemKind2.Constructor=4,CompletionItemKind2.Field=5,CompletionItemKind2.Variable=6,CompletionItemKind2.Class=7,CompletionItemKind2.Interface=8,CompletionItemKind2.Module=9,CompletionItemKind2.Property=10,CompletionItemKind2.Unit=11,CompletionItemKind2.Value=12,CompletionItemKind2.Enum=13,CompletionItemKind2.Keyword=14,CompletionItemKind2.Snippet=15,CompletionItemKind2.Color=16,CompletionItemKind2.File=17,CompletionItemKind2.Reference=18,CompletionItemKind2.Folder=19,CompletionItemKind2.EnumMember=20,CompletionItemKind2.Constant=21,CompletionItemKind2.Struct=22,CompletionItemKind2.Event=23,CompletionItemKind2.Operator=24,CompletionItemKind2.TypeParameter=25,(InsertTextFormat2=InsertTextFormat||(InsertTextFormat={})).PlainText=1,InsertTextFormat2.Snippet=2,(CompletionItemTag||(CompletionItemTag={})).Deprecated=1,(InsertReplaceEdit2=InsertReplaceEdit||(InsertReplaceEdit={})).create=function(newText,insert,replace){return{newText:newText,insert:insert,replace:replace}},InsertReplaceEdit2.is=function(value){const candidate=value;return candidate&&Is.string(candidate.newText)&&Range.is(candidate.insert)&&Range.is(candidate.replace)},(InsertTextMode2=InsertTextMode||(InsertTextMode={})).asIs=1,InsertTextMode2.adjustIndentation=2,(CompletionItemLabelDetails||(CompletionItemLabelDetails={})).is=function(value){const candidate=value;return candidate&&(Is.string(candidate.detail)||void 0===candidate.detail)&&(Is.string(candidate.description)||void 0===candidate.description)},(CompletionItem||(CompletionItem={})).create=function(label){return{label:label}},(CompletionList||(CompletionList={})).create=function(items,isIncomplete){return{items:items||[],isIncomplete:!!isIncomplete}},(MarkedString2=MarkedString||(MarkedString={})).fromPlainText=function(plainText){return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")},MarkedString2.is=function(value){const candidate=value;return Is.string(candidate)||Is.objectLiteral(candidate)&&Is.string(candidate.language)&&Is.string(candidate.value)},(Hover||(Hover={})).is=function(value){let candidate=value;return!!candidate&&Is.objectLiteral(candidate)&&(MarkupContent.is(candidate.contents)||MarkedString.is(candidate.contents)||Is.typedArray(candidate.contents,MarkedString.is))&&(void 0===value.range||Range.is(value.range))},(ParameterInformation||(ParameterInformation={})).create=function(label,documentation){return documentation?{label:label,documentation:documentation}:{label:label}},(SignatureInformation||(SignatureInformation={})).create=function(label,documentation,...parameters){let result={label:label};return Is.defined(documentation)&&(result.documentation=documentation),Is.defined(parameters)?result.parameters=parameters:result.parameters=[],result},(DocumentHighlightKind2=DocumentHighlightKind||(DocumentHighlightKind={})).Text=1,DocumentHighlightKind2.Read=2,DocumentHighlightKind2.Write=3,(DocumentHighlight||(DocumentHighlight={})).create=function(range,kind){let result={range:range};return Is.number(kind)&&(result.kind=kind),result},(SymbolKind2=SymbolKind||(SymbolKind={})).File=1,SymbolKind2.Module=2,SymbolKind2.Namespace=3,SymbolKind2.Package=4,SymbolKind2.Class=5,SymbolKind2.Method=6,SymbolKind2.Property=7,SymbolKind2.Field=8,SymbolKind2.Constructor=9,SymbolKind2.Enum=10,SymbolKind2.Interface=11,SymbolKind2.Function=12,SymbolKind2.Variable=13,SymbolKind2.Constant=14,SymbolKind2.String=15,SymbolKind2.Number=16,SymbolKind2.Boolean=17,SymbolKind2.Array=18,SymbolKind2.Object=19,SymbolKind2.Key=20,SymbolKind2.Null=21,SymbolKind2.EnumMember=22,SymbolKind2.Struct=23,SymbolKind2.Event=24,SymbolKind2.Operator=25,SymbolKind2.TypeParameter=26,(SymbolTag||(SymbolTag={})).Deprecated=1,(SymbolInformation||(SymbolInformation={})).create=function(name,kind,range,uri,containerName){let result={name:name,kind:kind,location:{uri:uri,range:range}};return containerName&&(result.containerName=containerName),result},(WorkspaceSymbol||(WorkspaceSymbol={})).create=function(name,kind,uri,range){return void 0!==range?{name:name,kind:kind,location:{uri:uri,range:range}}:{name:name,kind:kind,location:{uri:uri}}},(DocumentSymbol2=DocumentSymbol||(DocumentSymbol={})).create=function(name,detail,kind,range,selectionRange,children){let result={name:name,detail:detail,kind:kind,range:range,selectionRange:selectionRange};return void 0!==children&&(result.children=children),result},DocumentSymbol2.is=function(value){let candidate=value;return candidate&&Is.string(candidate.name)&&Is.number(candidate.kind)&&Range.is(candidate.range)&&Range.is(candidate.selectionRange)&&(void 0===candidate.detail||Is.string(candidate.detail))&&(void 0===candidate.deprecated||Is.boolean(candidate.deprecated))&&(void 0===candidate.children||Array.isArray(candidate.children))&&(void 0===candidate.tags||Array.isArray(candidate.tags))},(CodeActionKind2=CodeActionKind||(CodeActionKind={})).Empty="",CodeActionKind2.QuickFix="quickfix",CodeActionKind2.Refactor="refactor",CodeActionKind2.RefactorExtract="refactor.extract",CodeActionKind2.RefactorInline="refactor.inline",CodeActionKind2.RefactorRewrite="refactor.rewrite",CodeActionKind2.Source="source",CodeActionKind2.SourceOrganizeImports="source.organizeImports",CodeActionKind2.SourceFixAll="source.fixAll",(CodeActionTriggerKind2=CodeActionTriggerKind||(CodeActionTriggerKind={})).Invoked=1,CodeActionTriggerKind2.Automatic=2,(CodeActionContext2=CodeActionContext||(CodeActionContext={})).create=function(diagnostics,only,triggerKind){let result={diagnostics:diagnostics};return null!=only&&(result.only=only),null!=triggerKind&&(result.triggerKind=triggerKind),result},CodeActionContext2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.typedArray(candidate.diagnostics,Diagnostic.is)&&(void 0===candidate.only||Is.typedArray(candidate.only,Is.string))&&(void 0===candidate.triggerKind||candidate.triggerKind===CodeActionTriggerKind.Invoked||candidate.triggerKind===CodeActionTriggerKind.Automatic)},(CodeAction2=CodeAction||(CodeAction={})).create=function(title,kindOrCommandOrEdit,kind){let result={title:title},checkKind=!0;return"string"==typeof kindOrCommandOrEdit?(checkKind=!1,result.kind=kindOrCommandOrEdit):Command.is(kindOrCommandOrEdit)?result.command=kindOrCommandOrEdit:result.edit=kindOrCommandOrEdit,checkKind&&void 0!==kind&&(result.kind=kind),result},CodeAction2.is=function(value){let candidate=value;return candidate&&Is.string(candidate.title)&&(void 0===candidate.diagnostics||Is.typedArray(candidate.diagnostics,Diagnostic.is))&&(void 0===candidate.kind||Is.string(candidate.kind))&&(void 0!==candidate.edit||void 0!==candidate.command)&&(void 0===candidate.command||Command.is(candidate.command))&&(void 0===candidate.isPreferred||Is.boolean(candidate.isPreferred))&&(void 0===candidate.edit||WorkspaceEdit.is(candidate.edit))},(CodeLens2=CodeLens||(CodeLens={})).create=function(range,data){let result={range:range};return Is.defined(data)&&(result.data=data),result},CodeLens2.is=function(value){let candidate=value;return Is.defined(candidate)&&Range.is(candidate.range)&&(Is.undefined(candidate.command)||Command.is(candidate.command))},(FormattingOptions2=FormattingOptions||(FormattingOptions={})).create=function(tabSize,insertSpaces){return{tabSize:tabSize,insertSpaces:insertSpaces}},FormattingOptions2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.uinteger(candidate.tabSize)&&Is.boolean(candidate.insertSpaces)},(DocumentLink2=DocumentLink||(DocumentLink={})).create=function(range,target,data){return{range:range,target:target,data:data}},DocumentLink2.is=function(value){let candidate=value;return Is.defined(candidate)&&Range.is(candidate.range)&&(Is.undefined(candidate.target)||Is.string(candidate.target))},(SelectionRange2=SelectionRange||(SelectionRange={})).create=function(range,parent){return{range:range,parent:parent}},SelectionRange2.is=function(value){let candidate=value;return Is.objectLiteral(candidate)&&Range.is(candidate.range)&&(void 0===candidate.parent||SelectionRange2.is(candidate.parent))},(SemanticTokenTypes2=SemanticTokenTypes||(SemanticTokenTypes={})).namespace="namespace",SemanticTokenTypes2.type="type",SemanticTokenTypes2.class="class",SemanticTokenTypes2.enum="enum",SemanticTokenTypes2.interface="interface",SemanticTokenTypes2.struct="struct",SemanticTokenTypes2.typeParameter="typeParameter",SemanticTokenTypes2.parameter="parameter",SemanticTokenTypes2.variable="variable",SemanticTokenTypes2.property="property",SemanticTokenTypes2.enumMember="enumMember",SemanticTokenTypes2.event="event",SemanticTokenTypes2.function="function",SemanticTokenTypes2.method="method",SemanticTokenTypes2.macro="macro",SemanticTokenTypes2.keyword="keyword",SemanticTokenTypes2.modifier="modifier",SemanticTokenTypes2.comment="comment",SemanticTokenTypes2.string="string",SemanticTokenTypes2.number="number",SemanticTokenTypes2.regexp="regexp",SemanticTokenTypes2.operator="operator",SemanticTokenTypes2.decorator="decorator",(SemanticTokenModifiers2=SemanticTokenModifiers||(SemanticTokenModifiers={})).declaration="declaration",SemanticTokenModifiers2.definition="definition",SemanticTokenModifiers2.readonly="readonly",SemanticTokenModifiers2.static="static",SemanticTokenModifiers2.deprecated="deprecated",SemanticTokenModifiers2.abstract="abstract",SemanticTokenModifiers2.async="async",SemanticTokenModifiers2.modification="modification",SemanticTokenModifiers2.documentation="documentation",SemanticTokenModifiers2.defaultLibrary="defaultLibrary",(SemanticTokens||(SemanticTokens={})).is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&(void 0===candidate.resultId||"string"==typeof candidate.resultId)&&Array.isArray(candidate.data)&&(0===candidate.data.length||"number"==typeof candidate.data[0])},(InlineValueText2=InlineValueText||(InlineValueText={})).create=function(range,text){return{range:range,text:text}},InlineValueText2.is=function(value){const candidate=value;return null!=candidate&&Range.is(candidate.range)&&Is.string(candidate.text)},(InlineValueVariableLookup2=InlineValueVariableLookup||(InlineValueVariableLookup={})).create=function(range,variableName,caseSensitiveLookup){return{range:range,variableName:variableName,caseSensitiveLookup:caseSensitiveLookup}},InlineValueVariableLookup2.is=function(value){const candidate=value;return null!=candidate&&Range.is(candidate.range)&&Is.boolean(candidate.caseSensitiveLookup)&&(Is.string(candidate.variableName)||void 0===candidate.variableName)},(InlineValueEvaluatableExpression2=InlineValueEvaluatableExpression||(InlineValueEvaluatableExpression={})).create=function(range,expression){return{range:range,expression:expression}},InlineValueEvaluatableExpression2.is=function(value){const candidate=value;return null!=candidate&&Range.is(candidate.range)&&(Is.string(candidate.expression)||void 0===candidate.expression)},(InlineValueContext2=InlineValueContext||(InlineValueContext={})).create=function(frameId,stoppedLocation){return{frameId:frameId,stoppedLocation:stoppedLocation}},InlineValueContext2.is=function(value){const candidate=value;return Is.defined(candidate)&&Range.is(value.stoppedLocation)},(InlayHintKind2=InlayHintKind||(InlayHintKind={})).Type=1,InlayHintKind2.Parameter=2,InlayHintKind2.is=function(value){return 1===value||2===value},(InlayHintLabelPart2=InlayHintLabelPart||(InlayHintLabelPart={})).create=function(value){return{value:value}},InlayHintLabelPart2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&(void 0===candidate.tooltip||Is.string(candidate.tooltip)||MarkupContent.is(candidate.tooltip))&&(void 0===candidate.location||Location.is(candidate.location))&&(void 0===candidate.command||Command.is(candidate.command))},(InlayHint2=InlayHint||(InlayHint={})).create=function(position,label,kind){const result={position:position,label:label};return void 0!==kind&&(result.kind=kind),result},InlayHint2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Position.is(candidate.position)&&(Is.string(candidate.label)||Is.typedArray(candidate.label,InlayHintLabelPart.is))&&(void 0===candidate.kind||InlayHintKind.is(candidate.kind))&&void 0===candidate.textEdits||Is.typedArray(candidate.textEdits,TextEdit.is)&&(void 0===candidate.tooltip||Is.string(candidate.tooltip)||MarkupContent.is(candidate.tooltip))&&(void 0===candidate.paddingLeft||Is.boolean(candidate.paddingLeft))&&(void 0===candidate.paddingRight||Is.boolean(candidate.paddingRight))},(StringValue||(StringValue={})).createSnippet=function(value){return{kind:"snippet",value:value}},(InlineCompletionItem||(InlineCompletionItem={})).create=function(insertText,filterText,range,command){return{insertText:insertText,filterText:filterText,range:range,command:command}},(InlineCompletionList||(InlineCompletionList={})).create=function(items){return{items:items}},(InlineCompletionTriggerKind2=InlineCompletionTriggerKind||(InlineCompletionTriggerKind={})).Invoked=0,InlineCompletionTriggerKind2.Automatic=1,(SelectedCompletionInfo||(SelectedCompletionInfo={})).create=function(range,text){return{range:range,text:text}},(InlineCompletionContext||(InlineCompletionContext={})).create=function(triggerKind,selectedCompletionInfo){return{triggerKind:triggerKind,selectedCompletionInfo:selectedCompletionInfo}},(WorkspaceFolder||(WorkspaceFolder={})).is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&URI$1.is(candidate.uri)&&Is.string(candidate.name)};var TextDocument$1;!function(TextDocument2){function mergeSort2(data,compare){if(data.length<=1)return data;const p=data.length/2|0,left=data.slice(0,p),right=data.slice(p);mergeSort2(left,compare),mergeSort2(right,compare);let leftIdx=0,rightIdx=0,i=0;for(;leftIdx<left.length&&rightIdx<right.length;){let ret=compare(left[leftIdx],right[rightIdx]);data[i++]=ret<=0?left[leftIdx++]:right[rightIdx++]}for(;leftIdx<left.length;)data[i++]=left[leftIdx++];for(;rightIdx<right.length;)data[i++]=right[rightIdx++];return data}TextDocument2.create=function(uri,languageId,version,content){return new FullTextDocument$1(uri,languageId,version,content)},TextDocument2.is=function(value){let candidate=value;return!!(Is.defined(candidate)&&Is.string(candidate.uri)&&(Is.undefined(candidate.languageId)||Is.string(candidate.languageId))&&Is.uinteger(candidate.lineCount)&&Is.func(candidate.getText)&&Is.func(candidate.positionAt)&&Is.func(candidate.offsetAt))},TextDocument2.applyEdits=function(document,edits){let text=document.getText(),sortedEdits=mergeSort2(edits,(a,b)=>{let diff=a.range.start.line-b.range.start.line;return 0===diff?a.range.start.character-b.range.start.character:diff}),lastModifiedOffset=text.length;for(let i=sortedEdits.length-1;i>=0;i--){let e=sortedEdits[i],startOffset=document.offsetAt(e.range.start),endOffset=document.offsetAt(e.range.end);if(!(endOffset<=lastModifiedOffset))throw new Error("Overlapping edit");text=text.substring(0,startOffset)+e.newText+text.substring(endOffset,text.length),lastModifiedOffset=startOffset}return text}}(TextDocument$1||(TextDocument$1={}));let FullTextDocument$1=class{constructor(uri,languageId,version,content){this._uri=uri,this._languageId=languageId,this._version=version,this._content=content,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(range){if(range){let start=this.offsetAt(range.start),end=this.offsetAt(range.end);return this._content.substring(start,end)}return this._content}update(event,version){this._content=event.text,this._version=version,this._lineOffsets=void 0}getLineOffsets(){if(void 0===this._lineOffsets){let lineOffsets=[],text=this._content,isLineStart=!0;for(let i=0;i<text.length;i++){isLineStart&&(lineOffsets.push(i),isLineStart=!1);let ch=text.charAt(i);isLineStart="\r"===ch||"\n"===ch,"\r"===ch&&i+1<text.length&&"\n"===text.charAt(i+1)&&i++}isLineStart&&text.length>0&&lineOffsets.push(text.length),this._lineOffsets=lineOffsets}return this._lineOffsets}positionAt(offset){offset=Math.max(Math.min(offset,this._content.length),0);let lineOffsets=this.getLineOffsets(),low=0,high=lineOffsets.length;if(0===high)return Position.create(0,offset);for(;low<high;){let mid=Math.floor((low+high)/2);lineOffsets[mid]>offset?high=mid:low=mid+1}let line=low-1;return Position.create(line,offset-lineOffsets[line])}offsetAt(position){let lineOffsets=this.getLineOffsets();if(position.line>=lineOffsets.length)return this._content.length;if(position.line<0)return 0;let lineOffset=lineOffsets[position.line],nextLineOffset=position.line+1<lineOffsets.length?lineOffsets[position.line+1]:this._content.length;return Math.max(Math.min(lineOffset+position.character,nextLineOffset),lineOffset)}get lineCount(){return this.getLineOffsets().length}};var Is;!function(Is2){const toString2=Object.prototype.toString;Is2.defined=function(value){return void 0!==value},Is2.undefined=function(value){return void 0===value},Is2.boolean=function(value){return!0===value||!1===value},Is2.string=function(value){return"[object String]"===toString2.call(value)},Is2.number=function(value){return"[object Number]"===toString2.call(value)},Is2.numberRange=function(value,min2,max){return"[object Number]"===toString2.call(value)&&min2<=value&&value<=max},Is2.integer=function(value){return"[object Number]"===toString2.call(value)&&-2147483648<=value&&value<=2147483647},Is2.uinteger=function(value){return"[object Number]"===toString2.call(value)&&0<=value&&value<=2147483647},Is2.func=function(value){return"[object Function]"===toString2.call(value)},Is2.objectLiteral=function(value){return null!==value&&"object"==typeof value},Is2.typedArray=function(value,check){return Array.isArray(value)&&value.every(check)}}(Is||(Is={}));const main$2=Object.freeze(Object.defineProperty({__proto__:null,get AnnotatedTextEdit(){return AnnotatedTextEdit},get ChangeAnnotation(){return ChangeAnnotation},get ChangeAnnotationIdentifier(){return ChangeAnnotationIdentifier},get CodeAction(){return CodeAction},get CodeActionContext(){return CodeActionContext},get CodeActionKind(){return CodeActionKind},get CodeActionTriggerKind(){return CodeActionTriggerKind},get CodeDescription(){return CodeDescription},get CodeLens(){return CodeLens},get Color(){return Color},get ColorInformation(){return ColorInformation},get ColorPresentation(){return ColorPresentation},get Command(){return Command},get CompletionItem(){return CompletionItem},get CompletionItemKind(){return CompletionItemKind},get CompletionItemLabelDetails(){return CompletionItemLabelDetails},get CompletionItemTag(){return CompletionItemTag},get CompletionList(){return CompletionList},get CreateFile(){return CreateFile},get DeleteFile(){return DeleteFile},get Diagnostic(){return Diagnostic},get DiagnosticRelatedInformation(){return DiagnosticRelatedInformation},get DiagnosticSeverity(){return DiagnosticSeverity},get DiagnosticTag(){return DiagnosticTag},get DocumentHighlight(){return DocumentHighlight},get DocumentHighlightKind(){return DocumentHighlightKind},get DocumentLink(){return DocumentLink},get DocumentSymbol(){return DocumentSymbol},get DocumentUri(){return DocumentUri},EOL:["\n","\r\n","\r"],get FoldingRange(){return FoldingRange},get FoldingRangeKind(){return FoldingRangeKind},get FormattingOptions(){return FormattingOptions},get Hover(){return Hover},get InlayHint(){return InlayHint},get InlayHintKind(){return InlayHintKind},get InlayHintLabelPart(){return InlayHintLabelPart},get InlineCompletionContext(){return InlineCompletionContext},get InlineCompletionItem(){return InlineCompletionItem},get InlineCompletionList(){return InlineCompletionList},get InlineCompletionTriggerKind(){return InlineCompletionTriggerKind},get InlineValueContext(){return InlineValueContext},get InlineValueEvaluatableExpression(){return InlineValueEvaluatableExpression},get InlineValueText(){return InlineValueText},get InlineValueVariableLookup(){return InlineValueVariableLookup},get InsertReplaceEdit(){return InsertReplaceEdit},get InsertTextFormat(){return InsertTextFormat},get InsertTextMode(){return InsertTextMode},get Location(){return Location},get LocationLink(){return LocationLink},get MarkedString(){return MarkedString},get MarkupContent(){return MarkupContent},get MarkupKind(){return MarkupKind},get OptionalVersionedTextDocumentIdentifier(){return OptionalVersionedTextDocumentIdentifier},get ParameterInformation(){return ParameterInformation},get Position(){return Position},get Range(){return Range},get RenameFile(){return RenameFile},get SelectedCompletionInfo(){return SelectedCompletionInfo},get SelectionRange(){return SelectionRange},get SemanticTokenModifiers(){return SemanticTokenModifiers},get SemanticTokenTypes(){return SemanticTokenTypes},get SemanticTokens(){return SemanticTokens},get SignatureInformation(){return SignatureInformation},get StringValue(){return StringValue},get SymbolInformation(){return SymbolInformation},get SymbolKind(){return SymbolKind},get SymbolTag(){return SymbolTag},get TextDocument(){return TextDocument$1},get TextDocumentEdit(){return TextDocumentEdit},get TextDocumentIdentifier(){return TextDocumentIdentifier},get TextDocumentItem(){return TextDocumentItem},get TextEdit(){return TextEdit},get URI(){return URI$1},get VersionedTextDocumentIdentifier(){return VersionedTextDocumentIdentifier},WorkspaceChange:class{constructor(workspaceEdit){this._textEditChanges=Object.create(null),void 0!==workspaceEdit?(this._workspaceEdit=workspaceEdit,workspaceEdit.documentChanges?(this._changeAnnotations=new ChangeAnnotations(workspaceEdit.changeAnnotations),workspaceEdit.changeAnnotations=this._changeAnnotations.all(),workspaceEdit.documentChanges.forEach(change=>{if(TextDocumentEdit.is(change)){const textEditChange=new TextEditChangeImpl(change.edits,this._changeAnnotations);this._textEditChanges[change.textDocument.uri]=textEditChange}})):workspaceEdit.changes&&Object.keys(workspaceEdit.changes).forEach(key=>{const textEditChange=new TextEditChangeImpl(workspaceEdit.changes[key]);this._textEditChanges[key]=textEditChange})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),void 0!==this._changeAnnotations&&(0===this._changeAnnotations.size?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(key){if(OptionalVersionedTextDocumentIdentifier.is(key)){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");const textDocument={uri:key.uri,version:key.version};let result=this._textEditChanges[textDocument.uri];if(!result){const edits=[],textDocumentEdit={textDocument:textDocument,edits:edits};this._workspaceEdit.documentChanges.push(textDocumentEdit),result=new TextEditChangeImpl(edits,this._changeAnnotations),this._textEditChanges[textDocument.uri]=result}return result}{if(this.initChanges(),void 0===this._workspaceEdit.changes)throw new Error("Workspace edit is not configured for normal text edit changes.");let result=this._textEditChanges[key];if(!result){let edits=[];this._workspaceEdit.changes[key]=edits,result=new TextEditChangeImpl(edits),this._textEditChanges[key]=result}return result}}initDocumentChanges(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._changeAnnotations=new ChangeAnnotations,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._workspaceEdit.changes=Object.create(null))}createFile(uri,optionsOrAnnotation,options){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let annotation,operation,id;if(ChangeAnnotation.is(optionsOrAnnotation)||ChangeAnnotationIdentifier.is(optionsOrAnnotation)?annotation=optionsOrAnnotation:options=optionsOrAnnotation,void 0===annotation?operation=CreateFile.create(uri,options):(id=ChangeAnnotationIdentifier.is(annotation)?annotation:this._changeAnnotations.manage(annotation),operation=CreateFile.create(uri,options,id)),this._workspaceEdit.documentChanges.push(operation),void 0!==id)return id}renameFile(oldUri,newUri,optionsOrAnnotation,options){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let annotation,operation,id;if(ChangeAnnotation.is(optionsOrAnnotation)||ChangeAnnotationIdentifier.is(optionsOrAnnotation)?annotation=optionsOrAnnotation:options=optionsOrAnnotation,void 0===annotation?operation=RenameFile.create(oldUri,newUri,options):(id=ChangeAnnotationIdentifier.is(annotation)?annotation:this._changeAnnotations.manage(annotation),operation=RenameFile.create(oldUri,newUri,options,id)),this._workspaceEdit.documentChanges.push(operation),void 0!==id)return id}deleteFile(uri,optionsOrAnnotation,options){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let annotation,operation,id;if(ChangeAnnotation.is(optionsOrAnnotation)||ChangeAnnotationIdentifier.is(optionsOrAnnotation)?annotation=optionsOrAnnotation:options=optionsOrAnnotation,void 0===annotation?operation=DeleteFile.create(uri,options):(id=ChangeAnnotationIdentifier.is(annotation)?annotation:this._changeAnnotations.manage(annotation),operation=DeleteFile.create(uri,options,id)),this._workspaceEdit.documentChanges.push(operation),void 0!==id)return id}},get WorkspaceEdit(){return WorkspaceEdit},get WorkspaceFolder(){return WorkspaceFolder},get WorkspaceSymbol(){return WorkspaceSymbol},get integer(){return integer},get uinteger(){return uinteger}},Symbol.toStringTag,{value:"Module"}));class CstNodeBuilder{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(input){return this.rootNode=new RootCstNodeImpl(input),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(feature){const compositeNode=new CompositeCstNodeImpl;return compositeNode.grammarSource=feature,compositeNode.root=this.rootNode,this.current.content.push(compositeNode),this.nodeStack.push(compositeNode),compositeNode}buildLeafNode(token,feature){const leafNode=new LeafCstNodeImpl(token.startOffset,token.image.length,tokenToRange(token),token.tokenType,!feature);return leafNode.grammarSource=feature,leafNode.root=this.rootNode,this.current.content.push(leafNode),leafNode}removeNode(node){const parent=node.container;if(parent){const index=parent.content.indexOf(node);index>=0&&parent.content.splice(index,1)}}addHiddenNodes(tokens){const nodes=[];for(const token of tokens){const leafNode=new LeafCstNodeImpl(token.startOffset,token.image.length,tokenToRange(token),token.tokenType,!0);leafNode.root=this.rootNode,nodes.push(leafNode)}let current=this.current,added=!1;if(current.content.length>0)current.content.push(...nodes);else{for(;current.container;){const index=current.container.content.indexOf(current);if(index>0){current.container.content.splice(index,0,...nodes),added=!0;break}current=current.container}added||this.rootNode.content.unshift(...nodes)}}construct(item){const current=this.current;"string"!=typeof item.$type||item.$infixName||(this.current.astNode=item),item.$cstNode=current;const node=this.nodeStack.pop();0===(null==node?void 0:node.content.length)&&this.removeNode(node)}}class AbstractCstNode{get hidden(){return!1}get astNode(){var _a2,_b2;const node="string"==typeof(null==(_a2=this._astNode)?void 0:_a2.$type)?this._astNode:null==(_b2=this.container)?void 0:_b2.astNode;if(!node)throw new Error("This node has no associated AST element");return node}set astNode(value){this._astNode=value}get text(){return this.root.fullText.substring(this.offset,this.end)}}class LeafCstNodeImpl extends AbstractCstNode{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(offset,length,range,tokenType,hidden=!1){super(),this._hidden=hidden,this._offset=offset,this._tokenType=tokenType,this._length=length,this._range=range}}class CompositeCstNodeImpl extends AbstractCstNode{constructor(){super(...arguments),this.content=new CstNodeContainer(this)}get offset(){var _a2;return(null==(_a2=this.firstNonHiddenNode)?void 0:_a2.offset)??0}get length(){return this.end-this.offset}get end(){var _a2;return(null==(_a2=this.lastNonHiddenNode)?void 0:_a2.end)??0}get range(){const firstNode=this.firstNonHiddenNode,lastNode=this.lastNonHiddenNode;if(firstNode&&lastNode){if(void 0===this._rangeCache){const{range:firstRange}=firstNode,{range:lastRange}=lastNode;this._rangeCache={start:firstRange.start,end:lastRange.end.line<firstRange.start.line?firstRange.start:lastRange.end}}return this._rangeCache}return{start:Position.create(0,0),end:Position.create(0,0)}}get firstNonHiddenNode(){for(const child of this.content)if(!child.hidden)return child;return this.content[0]}get lastNonHiddenNode(){for(let i=this.content.length-1;i>=0;i--){const child=this.content[i];if(!child.hidden)return child}return this.content[this.content.length-1]}}class CstNodeContainer extends Array{constructor(parent){super(),this.parent=parent,Object.setPrototypeOf(this,CstNodeContainer.prototype)}push(...items){return this.addParents(items),super.push(...items)}unshift(...items){return this.addParents(items),super.unshift(...items)}splice(start,count,...items){return this.addParents(items),super.splice(start,count,...items)}addParents(items){for(const item of items)item.container=this.parent}}class RootCstNodeImpl extends CompositeCstNodeImpl{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(input){super(),this._text="",this._text=input??""}}const DatatypeSymbol=Symbol("Datatype");function isDataTypeNode(node){return node.$type===DatatypeSymbol}const withRuleSuffix=name=>name.endsWith("​")?name:name+"​";class AbstractLangiumParser{constructor(services){var _a2;this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=services.parser.Lexer;const tokens=this.lexer.definition,production="production"===services.LanguageMetaData.mode;(null==(_a2=services.shared.profilers.LangiumProfiler)?void 0:_a2.isActive("parsing"))?this.wrapper=new ProfilerWrapper(tokens,{...services.parser.ParserConfig,skipValidations:production,errorMessageProvider:services.parser.ParserErrorMessageProvider},services.shared.profilers.LangiumProfiler.createTask("parsing",services.LanguageMetaData.languageId)):this.wrapper=new ChevrotainWrapper(tokens,{...services.parser.ParserConfig,skipValidations:production,errorMessageProvider:services.parser.ParserErrorMessageProvider})}alternatives(idx,choices){this.wrapper.wrapOr(idx,choices)}optional(idx,callback){this.wrapper.wrapOption(idx,callback)}many(idx,callback){this.wrapper.wrapMany(idx,callback)}atLeastOne(idx,callback){this.wrapper.wrapAtLeastOne(idx,callback)}getRule(name){return this.allRules.get(name)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}}class LangiumParser extends AbstractLangiumParser{get current(){return this.stack[this.stack.length-1]}constructor(services){super(services),this.nodeBuilder=new CstNodeBuilder,this.stack=[],this.assignmentMap=new Map,this.operatorPrecedence=new Map,this.linker=services.references.Linker,this.converter=services.parser.ValueConverter,this.astReflection=services.shared.AstReflection}rule(rule,impl){const type=this.computeRuleType(rule);let infixName;isInfixRule(rule)&&(infixName=rule.name,this.registerPrecedenceMap(rule));const ruleMethod=this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name),this.startImplementation(type,infixName,impl).bind(this));return this.allRules.set(rule.name,ruleMethod),isParserRule(rule)&&rule.entry&&(this.mainRule=ruleMethod),ruleMethod}registerPrecedenceMap(rule){const name=rule.name,map2=new Map;for(let i=0;i<rule.operators.precedences.length;i++){const precedence=rule.operators.precedences[i];for(const keyword of precedence.operators)map2.set(keyword.value,{precedence:i,rightAssoc:"right"===precedence.associativity})}this.operatorPrecedence.set(name,map2)}computeRuleType(rule){return isInfixRule(rule)?getTypeName(rule):rule.fragment?void 0:isDataTypeRule(rule)?DatatypeSymbol:getTypeName(rule)}parse(input,options={}){this.nodeBuilder.buildRootNode(input);const lexerResult=this.lexerResult=this.lexer.tokenize(input);this.wrapper.input=lexerResult.tokens;const ruleMethod=options.rule?this.allRules.get(options.rule):this.mainRule;if(!ruleMethod)throw new Error(options.rule?`No rule found with name '${options.rule}'`:"No main rule available.");const result=this.doParse(ruleMethod);return this.nodeBuilder.addHiddenNodes(lexerResult.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,linkContentToContainer(result,{deep:!0}),{value:result,lexerErrors:lexerResult.errors,lexerReport:lexerResult.report,parserErrors:this.wrapper.errors}}doParse(rule){let result=this.wrapper.rule(rule);if(this.stack.length>0&&(result=this.construct()),void 0===result)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return result}startImplementation($type,infixName,implementation){return args=>{const createNode=!this.isRecording()&&void 0!==$type;if(createNode){const node={$type:$type};this.stack.push(node),$type===DatatypeSymbol?node.value="":void 0!==infixName&&(node.$infixName=infixName)}return implementation(args),createNode?this.construct():void 0}}extractHiddenTokens(token){const hiddenTokens=this.lexerResult.hidden;if(!hiddenTokens.length)return[];const offset=token.startOffset;for(let i=0;i<hiddenTokens.length;i++){if(hiddenTokens[i].startOffset>offset)return hiddenTokens.splice(0,i)}return hiddenTokens.splice(0,hiddenTokens.length)}consume(idx,tokenType,feature){const token=this.wrapper.wrapConsume(idx,tokenType);if(!this.isRecording()&&this.isValidToken(token)){const hiddenTokens=this.extractHiddenTokens(token);this.nodeBuilder.addHiddenNodes(hiddenTokens);const leafNode=this.nodeBuilder.buildLeafNode(token,feature),{assignment:assignment,crossRef:crossRef}=this.getAssignment(feature),current=this.current;if(assignment){const convertedValue=isKeyword(feature)?token.image:this.converter.convert(token.image,leafNode);this.assign(assignment.operator,assignment.feature,convertedValue,leafNode,crossRef)}else if(isDataTypeNode(current)){let text=token.image;isKeyword(feature)||(text=this.converter.convert(text,leafNode).toString()),current.value+=text}}}isValidToken(token){return!token.isInsertedInRecovery&&!isNaN(token.startOffset)&&"number"==typeof token.endOffset&&!isNaN(token.endOffset)}subrule(idx,rule,fragment,feature,args){let cstNode,result;this.isRecording()||fragment||(cstNode=this.nodeBuilder.buildCompositeNode(feature));try{result=this.wrapper.wrapSubrule(idx,rule,args)}finally{this.isRecording()||(void 0!==result||fragment||(result=this.construct()),void 0!==result&&cstNode&&cstNode.length>0&&this.performSubruleAssignment(result,feature,cstNode))}}performSubruleAssignment(result,feature,cstNode){const{assignment:assignment,crossRef:crossRef}=this.getAssignment(feature);if(assignment)this.assign(assignment.operator,assignment.feature,result,cstNode,crossRef);else if(!assignment){const current=this.current;if(isDataTypeNode(current))current.value+=result.toString();else if("object"==typeof result&&result){const newItem=this.assignWithoutOverride(result,current);this.stack.pop(),this.stack.push(newItem)}}}action($type,action){if(!this.isRecording()){let last=this.current;if(action.feature&&action.operator){last=this.construct(),this.nodeBuilder.removeNode(last.$cstNode);this.nodeBuilder.buildCompositeNode(action).content.push(last.$cstNode);const newItem={$type:$type};this.stack.push(newItem),this.assign(action.operator,action.feature,last,last.$cstNode)}else last.$type=$type}}construct(){if(this.isRecording())return;const obj=this.stack.pop();return this.nodeBuilder.construct(obj),"$infixName"in obj?this.constructInfix(obj,this.operatorPrecedence.get(obj.$infixName)):isDataTypeNode(obj)?this.converter.convert(obj.value,obj.$cstNode):(function(reflection2,node){const typeMetaData=reflection2.getTypeMetaData(node.$type),genericNode=node;for(const property of Object.values(typeMetaData.properties))void 0!==property.defaultValue&&void 0===genericNode[property.name]&&(genericNode[property.name]=copyDefaultValue(property.defaultValue))}(this.astReflection,obj),obj)}constructInfix(obj,precedence){const parts=obj.parts;if(!Array.isArray(parts)||0===parts.length)return;const operators=obj.operators;if(!Array.isArray(operators)||parts.length<2)return parts[0];let lowestPrecedenceIdx=0,lowestPrecedenceValue=-1;for(let i=0;i<operators.length;i++){const operator=operators[i],opPrecedence=precedence.get(operator)??{precedence:1/0,rightAssoc:!1};opPrecedence.precedence>lowestPrecedenceValue?(lowestPrecedenceValue=opPrecedence.precedence,lowestPrecedenceIdx=i):opPrecedence.precedence===lowestPrecedenceValue&&(opPrecedence.rightAssoc||(lowestPrecedenceIdx=i))}const leftOperators=operators.slice(0,lowestPrecedenceIdx),rightOperators=operators.slice(lowestPrecedenceIdx+1),leftParts=parts.slice(0,lowestPrecedenceIdx+1),rightParts=parts.slice(lowestPrecedenceIdx+1),leftInfix={$infixName:obj.$infixName,$type:obj.$type,$cstNode:obj.$cstNode,parts:leftParts,operators:leftOperators},rightInfix={$infixName:obj.$infixName,$type:obj.$type,$cstNode:obj.$cstNode,parts:rightParts,operators:rightOperators},leftTree=this.constructInfix(leftInfix,precedence),rightTree=this.constructInfix(rightInfix,precedence);return{$type:obj.$type,$cstNode:obj.$cstNode,left:leftTree,operator:operators[lowestPrecedenceIdx],right:rightTree}}getAssignment(feature){if(!this.assignmentMap.has(feature)){const assignment=getContainerOfType(feature,isAssignment);this.assignmentMap.set(feature,{assignment:assignment,crossRef:assignment&&isCrossReference(assignment.terminal)?assignment.terminal.isMulti?"multi":"single":void 0})}return this.assignmentMap.get(feature)}assign(operator,feature,value,cstNode,crossRef){const obj=this.current;let item;switch(item="single"===crossRef&&"string"==typeof value?this.linker.buildReference(obj,feature,cstNode,value):"multi"===crossRef&&"string"==typeof value?this.linker.buildMultiReference(obj,feature,cstNode,value):value,operator){case"=":obj[feature]=item;break;case"?=":obj[feature]=!0;break;case"+=":Array.isArray(obj[feature])||(obj[feature]=[]),obj[feature].push(item)}}assignWithoutOverride(target,source){for(const[name,existingValue]of Object.entries(source)){const newValue=target[name];void 0===newValue?target[name]=existingValue:Array.isArray(newValue)&&Array.isArray(existingValue)&&(existingValue.push(...newValue),target[name]=existingValue)}const targetCstNode=target.$cstNode;return targetCstNode&&(targetCstNode.astNode=void 0,target.$cstNode=void 0),target}get definitionErrors(){return this.wrapper.definitionErrors}}class AbstractParserErrorMessageProvider{buildMismatchTokenMessage(options){return defaultParserErrorProvider.buildMismatchTokenMessage(options)}buildNotAllInputParsedMessage(options){return defaultParserErrorProvider.buildNotAllInputParsedMessage(options)}buildNoViableAltMessage(options){return defaultParserErrorProvider.buildNoViableAltMessage(options)}buildEarlyExitMessage(options){return defaultParserErrorProvider.buildEarlyExitMessage(options)}}class LangiumParserErrorMessageProvider extends AbstractParserErrorMessageProvider{buildMismatchTokenMessage({expected:expected,actual:actual}){return`Expecting ${expected.LABEL?"`"+expected.LABEL+"`":expected.name.endsWith(":KW")?`keyword '${expected.name.substring(0,expected.name.length-3)}'`:`token of type '${expected.name}'`} but found \`${actual.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:firstRedundant}){return`Expecting end of file but found \`${firstRedundant.image}\`.`}}class LangiumCompletionParser extends AbstractLangiumParser{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(input){this.resetState();const tokens=this.lexer.tokenize(input,{mode:"partial"});return this.tokens=tokens.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(rule,impl){const ruleMethod=this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name),this.startImplementation(impl).bind(this));return this.allRules.set(rule.name,ruleMethod),rule.entry&&(this.mainRule=ruleMethod),ruleMethod}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(implementation){return args=>{const size=this.keepStackSize();try{implementation(args)}finally{this.resetStackSize(size)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){const size=this.elementStack.length;return this.stackSize=size,size}resetStackSize(size){this.removeUnexpectedElements(),this.stackSize=size}consume(idx,tokenType,feature){this.wrapper.wrapConsume(idx,tokenType),this.isRecording()||(this.lastElementStack=[...this.elementStack,feature],this.nextTokenIndex=this.currIdx+1)}subrule(idx,rule,fragment,feature,args){this.before(feature),this.wrapper.wrapSubrule(idx,rule,args),this.after(feature)}before(element){this.isRecording()||this.elementStack.push(element)}after(element){if(!this.isRecording()){const index=this.elementStack.lastIndexOf(element);index>=0&&this.elementStack.splice(index)}}get currIdx(){return this.wrapper.currIdx}}const defaultConfig={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new LangiumParserErrorMessageProvider};class ChevrotainWrapper extends EmbeddedActionsParser{constructor(tokens,config){super(tokens,{...defaultConfig,lookaheadStrategy:config&&"maxLookahead"in config?new LLkLookaheadStrategy({maxLookahead:config.maxLookahead}):new LLStarLookaheadStrategy({logging:config.skipValidations?()=>{}:void 0}),...config})}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(name,impl,config){return this.RULE(name,impl,config)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(idx,tokenType){return this.consume(idx,tokenType,void 0)}wrapSubrule(idx,rule,args){return this.subrule(idx,rule,{ARGS:[args]})}wrapOr(idx,choices){this.or(idx,choices)}wrapOption(idx,callback){this.option(idx,callback)}wrapMany(idx,callback){this.many(idx,callback)}wrapAtLeastOne(idx,callback){this.atLeastOne(idx,callback)}rule(rule){return rule.call(this,{})}}class ProfilerWrapper extends ChevrotainWrapper{constructor(tokens,config,task){super(tokens,config),this.task=task}rule(rule){this.task.start(),this.task.startSubTask(this.ruleName(rule));try{return super.rule(rule)}finally{this.task.stopSubTask(this.ruleName(rule)),this.task.stop()}}ruleName(rule){return rule.ruleName}subrule(idx,ruleToCall,options){this.task.startSubTask(this.ruleName(ruleToCall));try{return super.subrule(idx,ruleToCall,options)}finally{this.task.stopSubTask(this.ruleName(ruleToCall))}}}function createParser(grammar,parser,tokens){return function(parserContext,grammar){const reachable=getAllReachableRules(grammar,!1),parserRules=stream(grammar.rules).filter(isParserRule).filter(rule=>reachable.has(rule));for(const rule of parserRules){const ctx={...parserContext,consume:1,optional:1,subrule:1,many:1,or:1};parserContext.parser.rule(rule,buildElement(ctx,rule.definition))}const infixRules=stream(grammar.rules).filter(isInfixRule).filter(rule=>reachable.has(rule));for(const rule of infixRules)parserContext.parser.rule(rule,buildInfixRule(parserContext,rule))}({parser:parser,tokens:tokens,ruleNames:new Map},grammar),parser}function buildInfixRule(ctx,rule){const expressionRule=rule.call.rule.ref;if(!expressionRule)throw new Error("Could not resolve reference to infix operator rule: "+rule.call.rule.$refText);if(isTerminalRule(expressionRule))throw new Error("Cannot use terminal rule in infix expression");const allKeywords=rule.operators.precedences.flatMap(e=>e.operators),outerGroup={$type:"Group",elements:[]},part1Assignment={$container:outerGroup,$type:"Assignment",feature:"parts",operator:"+=",terminal:rule.call},innerGroup={$container:outerGroup,$type:"Group",elements:[],cardinality:"*"};outerGroup.elements.push(part1Assignment,innerGroup);const operatorAssignment={$container:innerGroup,$type:"Assignment",feature:"operators",operator:"+=",terminal:{$type:"Alternatives",elements:allKeywords}},part2Assignment={...part1Assignment,$container:innerGroup};innerGroup.elements.push(operatorAssignment,part2Assignment);const orAlts=allKeywords.map(e=>ctx.tokens[e.value]).map((token,index)=>({ALT:()=>ctx.parser.consume(index,token,operatorAssignment)}));let subrule;return args=>{subrule??(subrule=getRule(ctx,expressionRule)),ctx.parser.subrule(0,subrule,!1,part1Assignment,args),ctx.parser.many(0,{DEF:()=>{ctx.parser.alternatives(0,orAlts),ctx.parser.subrule(1,subrule,!1,part2Assignment,args)}})}}function buildElement(ctx,element,ignoreGuard=!1){let method;if(isKeyword(element))method=function(ctx,keyword){const idx=ctx.consume++,token=ctx.tokens[keyword.value];if(!token)throw new Error("Could not find token for keyword: "+keyword.value);return()=>ctx.parser.consume(idx,token,keyword)}(ctx,element);else if(isAction(element))method=function(ctx,action){const actionType=getTypeName(action);return()=>ctx.parser.action(actionType,action)}(ctx,element);else if(isAssignment(element))method=buildElement(ctx,element.terminal);else if(isCrossReference(element))method=buildCrossReference(ctx,element);else if(isRuleCall(element))method=function(ctx,ruleCall){const rule=ruleCall.rule.ref;if(isAbstractParserRule(rule)){const idx=ctx.subrule++,fragment=isParserRule(rule)&&rule.fragment,predicate=ruleCall.arguments.length>0?function(rule,namedArgs){if(namedArgs.some(arg=>arg.calledByName)){const namedPredicates=namedArgs.map(arg=>{var _a2,_b2;return{parameterName:null==(_b2=null==(_a2=arg.parameter)?void 0:_a2.ref)?void 0:_b2.name,predicate:buildPredicate(arg.value)}});return args=>{const ruleArgs={};for(const{parameterName:parameterName,predicate:predicate}of namedPredicates)parameterName&&(ruleArgs[parameterName]=predicate(args));return ruleArgs}}{const predicates=namedArgs.map(arg=>buildPredicate(arg.value));return args=>{const ruleArgs={};for(let i=0;i<predicates.length;i++)if(i<rule.parameters.length){const parameterName=rule.parameters[i].name,predicate=predicates[i];ruleArgs[parameterName]=predicate(args)}return ruleArgs}}}(rule,ruleCall.arguments):()=>({});let subrule;return args=>{subrule??(subrule=getRule(ctx,rule)),ctx.parser.subrule(idx,subrule,fragment,ruleCall,predicate(args))}}if(isTerminalRule(rule)){const idx=ctx.consume++,method=getToken(ctx,rule.name);return()=>ctx.parser.consume(idx,method,ruleCall)}if(!rule)throw new ErrorWithLocation(ruleCall.$cstNode,`Undefined rule: ${ruleCall.rule.$refText}`);assertUnreachable()}(ctx,element);else if(isAlternatives(element))method=function(ctx,alternatives){if(1===alternatives.elements.length)return buildElement(ctx,alternatives.elements[0]);{const methods=[];for(const element of alternatives.elements){const predicatedMethod={ALT:buildElement(ctx,element,!0)},guard=getGuardCondition(element);guard&&(predicatedMethod.GATE=buildPredicate(guard)),methods.push(predicatedMethod)}const idx=ctx.or++;return args=>ctx.parser.alternatives(idx,methods.map(method=>{const alt={ALT:()=>method.ALT(args)},gate=method.GATE;return gate&&(alt.GATE=()=>gate(args)),alt}))}}(ctx,element);else if(isUnorderedGroup(element))method=function(ctx,group){if(1===group.elements.length)return buildElement(ctx,group.elements[0]);const methods=[];for(const element of group.elements){const predicatedMethod={ALT:buildElement(ctx,element,!0)},guard=getGuardCondition(element);guard&&(predicatedMethod.GATE=buildPredicate(guard)),methods.push(predicatedMethod)}const orIdx=ctx.or++,idFunc=(groupIdx,lParser)=>`uGroup_${groupIdx}_${lParser.getRuleStack().join("-")}`,alternatives=args=>ctx.parser.alternatives(orIdx,methods.map((method,idx)=>{const alt={ALT:()=>!0},parser=ctx.parser;alt.ALT=()=>{if(method.ALT(args),!parser.isRecording()){const key=idFunc(orIdx,parser);parser.unorderedGroups.get(key)||parser.unorderedGroups.set(key,[]);const groupState=parser.unorderedGroups.get(key);void 0===(null==groupState?void 0:groupState[idx])&&(groupState[idx]=!0)}};const gate=method.GATE;return alt.GATE=gate?()=>gate(args):()=>{const trackedAlternatives=parser.unorderedGroups.get(idFunc(orIdx,parser));return!(null==trackedAlternatives?void 0:trackedAlternatives[idx])},alt})),wrapped=wrap(ctx,getGuardCondition(group),alternatives,"*");return args=>{wrapped(args),ctx.parser.isRecording()||ctx.parser.unorderedGroups.delete(idFunc(orIdx,ctx.parser))}}(ctx,element);else if(isGroup(element))method=function(ctx,group){const methods=group.elements.map(e=>buildElement(ctx,e));return args=>methods.forEach(method=>method(args))}(ctx,element);else{if(item=element,!reflection$1.isInstance(item,EndOfFile_$type))throw new ErrorWithLocation(element.$cstNode,`Unexpected element type: ${element.$type}`);{const idx=ctx.consume++;method=()=>ctx.parser.consume(idx,EOF,element)}}var item;return wrap(ctx,ignoreGuard?void 0:getGuardCondition(element),method,element.cardinality)}function buildPredicate(condition){if(item=condition,reflection$1.isInstance(item,Disjunction_$type)){const left=buildPredicate(condition.left),right=buildPredicate(condition.right);return args=>left(args)||right(args)}if(function(item){return reflection$1.isInstance(item,Conjunction_$type)}(condition)){const left=buildPredicate(condition.left),right=buildPredicate(condition.right);return args=>left(args)&&right(args)}if(function(item){return reflection$1.isInstance(item,Negation_$type)}(condition)){const value=buildPredicate(condition.value);return args=>!value(args)}if(function(item){return reflection$1.isInstance(item,ParameterReference_$type)}(condition)){const name=condition.parameter.ref.name;return args=>void 0!==args&&!0===args[name]}if(function(item){return reflection$1.isInstance(item,BooleanLiteral_$type)}(condition)){const value=Boolean(condition.true);return()=>value}var item;assertUnreachable()}function getGuardCondition(element){if(isGroup(element))return element.guardCondition}function buildCrossReference(ctx,crossRef,terminal=crossRef.terminal){if(terminal){if(isRuleCall(terminal)&&isParserRule(terminal.rule.ref)){const rule=terminal.rule.ref,idx=ctx.subrule++;let subrule;return args=>{subrule??(subrule=getRule(ctx,rule)),ctx.parser.subrule(idx,subrule,!1,crossRef,args)}}if(isRuleCall(terminal)&&isTerminalRule(terminal.rule.ref)){const idx=ctx.consume++,terminalRule=getToken(ctx,terminal.rule.ref.name);return()=>ctx.parser.consume(idx,terminalRule,crossRef)}if(isKeyword(terminal)){const idx=ctx.consume++,keyword=getToken(ctx,terminal.value);return()=>ctx.parser.consume(idx,keyword,crossRef)}throw new Error("Could not build cross reference parser")}{if(!crossRef.type.ref)throw new Error("Could not resolve reference to type: "+crossRef.type.$refText);const assignment=findNameAssignment(crossRef.type.ref),assignTerminal=null==assignment?void 0:assignment.terminal;if(!assignTerminal)throw new Error("Could not find name assignment for type: "+getTypeName(crossRef.type.ref));return buildCrossReference(ctx,crossRef,assignTerminal)}}function wrap(ctx,guard,method,cardinality){const gate=guard&&buildPredicate(guard);if(!cardinality){if(gate){const idx=ctx.or++;return args=>ctx.parser.alternatives(idx,[{ALT:()=>method(args),GATE:()=>gate(args)},{ALT:EMPTY_ALT(),GATE:()=>!gate(args)}])}return method}if("*"===cardinality){const idx=ctx.many++;return args=>ctx.parser.many(idx,{DEF:()=>method(args),GATE:gate?()=>gate(args):void 0})}if("+"===cardinality){const idx=ctx.many++;if(gate){const orIdx=ctx.or++;return args=>ctx.parser.alternatives(orIdx,[{ALT:()=>ctx.parser.atLeastOne(idx,{DEF:()=>method(args)}),GATE:()=>gate(args)},{ALT:EMPTY_ALT(),GATE:()=>!gate(args)}])}return args=>ctx.parser.atLeastOne(idx,{DEF:()=>method(args)})}if("?"===cardinality){const idx=ctx.optional++;return args=>ctx.parser.optional(idx,{DEF:()=>method(args),GATE:gate?()=>gate(args):void 0})}assertUnreachable()}function getRule(ctx,element){const name=function(ctx,element){if(isAbstractParserRule(element))return element.name;if(ctx.ruleNames.has(element))return ctx.ruleNames.get(element);{let item=element,parent=item.$container,ruleName=element.$type;for(;!isParserRule(parent);){if(isGroup(parent)||isAlternatives(parent)||isUnorderedGroup(parent)){ruleName=parent.elements.indexOf(item).toString()+":"+ruleName}item=parent,parent=parent.$container}return ruleName=parent.name+":"+ruleName,ctx.ruleNames.set(element,ruleName),ruleName}}(ctx,element),rule=ctx.parser.getRule(name);if(!rule)throw new Error(`Rule "${name}" not found."`);return rule}function getToken(ctx,name){const token=ctx.tokens[name];if(!token)throw new Error(`Token "${name}" not found."`);return token}function createLangiumParser(services){const parser=function(services){const grammar=services.Grammar,lexer=services.parser.Lexer,parser=new LangiumParser(services);return createParser(grammar,parser,lexer.definition)}(services);return parser.finalize(),parser}class DefaultTokenBuilder{constructor(){this.diagnostics=[]}buildTokens(grammar,options){const reachableRules=stream(getAllReachableRules(grammar,!1)),terminalTokens=this.buildTerminalTokens(reachableRules),tokens=this.buildKeywordTokens(reachableRules,terminalTokens,options);return tokens.push(...terminalTokens),tokens}flushLexingReport(text){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const diagnostics=[...this.diagnostics];return this.diagnostics=[],diagnostics}buildTerminalTokens(rules){return rules.filter(isTerminalRule).filter(e=>!e.fragment).map(terminal=>this.buildTerminalToken(terminal)).toArray()}buildTerminalToken(terminal){const regex=terminalRegex(terminal),pattern=this.requiresCustomPattern(regex)?this.regexPatternFunction(regex):regex,tokenType={name:terminal.name,PATTERN:pattern};return"function"==typeof pattern&&(tokenType.LINE_BREAKS=!0),terminal.hidden&&(tokenType.GROUP=isWhitespace(regex)?Lexer.SKIPPED:"hidden"),tokenType}requiresCustomPattern(regex){return!(!regex.flags.includes("u")&&!regex.flags.includes("s"))}regexPatternFunction(regex){const stickyRegex=new RegExp(regex,regex.flags+"y");return(text,offset)=>{stickyRegex.lastIndex=offset;return stickyRegex.exec(text)}}buildKeywordTokens(rules,terminalTokens,options){return rules.filter(isAbstractParserRule).flatMap(rule=>streamAllContents(rule).filter(isKeyword)).distinct(e=>e.value).toArray().sort((a,b)=>b.value.length-a.value.length).map(keyword=>this.buildKeywordToken(keyword,terminalTokens,Boolean(null==options?void 0:options.caseInsensitive)))}buildKeywordToken(keyword,terminalTokens,caseInsensitive){const keywordPattern=this.buildKeywordPattern(keyword,caseInsensitive),tokenType={name:keyword.value,PATTERN:keywordPattern,LONGER_ALT:this.findLongerAlt(keyword,terminalTokens)};return"function"==typeof keywordPattern&&(tokenType.LINE_BREAKS=!0),tokenType}buildKeywordPattern(keyword,caseInsensitive){return caseInsensitive?new RegExp(escapeRegExp(keyword.value),"i"):keyword.value}findLongerAlt(keyword,terminalTokens){return terminalTokens.reduce((longerAlts,token)=>{const pattern=null==token?void 0:token.PATTERN;return(null==pattern?void 0:pattern.source)&&partialMatches("^"+pattern.source+"$",keyword.value)&&longerAlts.push(token),longerAlts},[])}}class DefaultValueConverter{convert(input,cstNode){let feature=cstNode.grammarSource;if(isCrossReference(feature)&&(feature=function(crossRef){if(crossRef.terminal)return crossRef.terminal;if(crossRef.type.ref){const nameAssigment=findNameAssignment(crossRef.type.ref);return null==nameAssigment?void 0:nameAssigment.terminal}}(feature)),isRuleCall(feature)){const rule=feature.rule.ref;if(!rule)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(rule,input,cstNode)}return input}runConverter(rule,input,cstNode){var _a2;switch(rule.name.toUpperCase()){case"INT":return ValueConverter.convertInt(input);case"STRING":return ValueConverter.convertString(input);case"ID":return ValueConverter.convertID(input)}switch(null==(_a2=function(rule){var _a2;return isTerminalRule(rule)?(null==(_a2=rule.type)?void 0:_a2.name)??"string":getExplicitRuleType(rule)??rule.name}(rule))?void 0:_a2.toLowerCase()){case"number":return ValueConverter.convertNumber(input);case"boolean":return ValueConverter.convertBoolean(input);case"bigint":return ValueConverter.convertBigint(input);case"date":return ValueConverter.convertDate(input);default:return input}}}var ValueConverter;!function(ValueConverter2){function convertEscapeCharacter(char){switch(char){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 char}}ValueConverter2.convertString=function(input){let result="";for(let i=1;i<input.length-1;i++){const c=input.charAt(i);if("\\"===c){result+=convertEscapeCharacter(input.charAt(++i))}else result+=c}return result},ValueConverter2.convertID=function(input){return"^"===input.charAt(0)?input.substring(1):input},ValueConverter2.convertInt=function(input){return parseInt(input)},ValueConverter2.convertBigint=function(input){return BigInt(input)},ValueConverter2.convertDate=function(input){return new Date(input)},ValueConverter2.convertNumber=function(input){return Number(input)},ValueConverter2.convertBoolean=function(input){return"true"===input.toLowerCase()}}(ValueConverter||(ValueConverter={}));var hasRequiredRal,cancellation={},ral={};function requireRal(){if(hasRequiredRal)return ral;let _ral;function RAL(){if(void 0===_ral)throw new Error("No runtime abstraction layer installed");return _ral}return hasRequiredRal=1,Object.defineProperty(ral,"__esModule",{value:!0}),(RAL||(RAL={})).install=function(ral2){if(void 0===ral2)throw new Error("No runtime abstraction layer provided");_ral=ral2},ral.default=RAL,ral}var hasRequiredIs$1,is$1={};function requireIs$1(){if(hasRequiredIs$1)return is$1;function string(value){return"string"==typeof value||value instanceof String}function array(value){return Array.isArray(value)}return hasRequiredIs$1=1,Object.defineProperty(is$1,"__esModule",{value:!0}),is$1.stringArray=is$1.array=is$1.func=is$1.error=is$1.number=is$1.string=is$1.boolean=void 0,is$1.boolean=function(value){return!0===value||!1===value},is$1.string=string,is$1.number=function(value){return"number"==typeof value||value instanceof Number},is$1.error=function(value){return value instanceof Error},is$1.func=function(value){return"function"==typeof value},is$1.array=array,is$1.stringArray=function(value){return array(value)&&value.every(elem=>string(elem))},is$1}var hasRequiredEvents,hasRequiredCancellation,events={};function requireEvents(){if(hasRequiredEvents)return events;hasRequiredEvents=1,Object.defineProperty(events,"__esModule",{value:!0}),events.Emitter=events.Event=void 0;const ral_1=requireRal();var Event;!function(Event2){const _disposable={dispose(){}};Event2.None=function(){return _disposable}}(Event||(events.Event=Event={}));class CallbackList{add(callback,context=null,bucket){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(callback),this._contexts.push(context),Array.isArray(bucket)&&bucket.push({dispose:()=>this.remove(callback,context)})}remove(callback,context=null){if(!this._callbacks)return;let foundCallbackWithDifferentContext=!1;for(let i=0,len=this._callbacks.length;i<len;i++)if(this._callbacks[i]===callback){if(this._contexts[i]===context)return this._callbacks.splice(i,1),void this._contexts.splice(i,1);foundCallbackWithDifferentContext=!0}if(foundCallbackWithDifferentContext)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...args){if(!this._callbacks)return[];const ret=[],callbacks=this._callbacks.slice(0),contexts=this._contexts.slice(0);for(let i=0,len=callbacks.length;i<len;i++)try{ret.push(callbacks[i].apply(contexts[i],args))}catch(e){(0,ral_1.default)().console.error(e)}return ret}isEmpty(){return!this._callbacks||0===this._callbacks.length}dispose(){this._callbacks=void 0,this._contexts=void 0}}class Emitter{constructor(_options){this._options=_options}get event(){return this._event||(this._event=(listener,thisArgs,disposables)=>{this._callbacks||(this._callbacks=new CallbackList),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(listener,thisArgs);const result={dispose:()=>{this._callbacks&&(this._callbacks.remove(listener,thisArgs),result.dispose=Emitter._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(disposables)&&disposables.push(result),result}),this._event}fire(event){this._callbacks&&this._callbacks.invoke.call(this._callbacks,event)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return events.Emitter=Emitter,Emitter._noop=function(){},events}function requireCancellation(){if(hasRequiredCancellation)return cancellation;hasRequiredCancellation=1,Object.defineProperty(cancellation,"__esModule",{value:!0}),cancellation.CancellationTokenSource=cancellation.CancellationToken=void 0;const ral_1=requireRal(),Is2=requireIs$1(),events_1=requireEvents();var CancellationToken,CancellationToken2;(CancellationToken2=CancellationToken||(cancellation.CancellationToken=CancellationToken={})).None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:events_1.Event.None}),CancellationToken2.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:events_1.Event.None}),CancellationToken2.is=function(value){const candidate=value;return candidate&&(candidate===CancellationToken2.None||candidate===CancellationToken2.Cancelled||Is2.boolean(candidate.isCancellationRequested)&&!!candidate.onCancellationRequested)};const shortcutEvent=Object.freeze(function(callback,context){const handle=(0,ral_1.default)().timer.setTimeout(callback.bind(context),0);return{dispose(){handle.dispose()}}});class MutableToken{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?shortcutEvent:(this._emitter||(this._emitter=new events_1.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}return cancellation.CancellationTokenSource=class{get token(){return this._token||(this._token=new MutableToken),this._token}cancel(){this._token?this._token.cancel():this._token=CancellationToken.Cancelled}dispose(){this._token?this._token instanceof MutableToken&&this._token.dispose():this._token=CancellationToken.None}},cancellation}var cancellationExports=requireCancellation();let lastTick=0;const OperationCancelled=Symbol("OperationCancelled");function isOperationCancelled(err){return err===OperationCancelled}async function interruptAndCheck(token){if(token===cancellationExports.CancellationToken.None)return;const current=performance.now();if(current-lastTick>=10&&(lastTick=current,await new Promise(resolve=>{"undefined"==typeof setImmediate?setTimeout(resolve,0):setImmediate(resolve)}),lastTick=performance.now()),token.isCancellationRequested)throw OperationCancelled}class Deferred{constructor(){this.promise=new Promise((resolve,reject)=>{this.resolve=arg=>(resolve(arg),this),this.reject=err=>(reject(err),this)})}}class FullTextDocument2{constructor(uri,languageId,version,content){this._uri=uri,this._languageId=languageId,this._version=version,this._content=content,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(range){if(range){const start=this.offsetAt(range.start),end=this.offsetAt(range.end);return this._content.substring(start,end)}return this._content}update(changes,version){for(const change of changes)if(FullTextDocument2.isIncremental(change)){const range=getWellformedRange(change.range),startOffset=this.offsetAt(range.start),endOffset=this.offsetAt(range.end);this._content=this._content.substring(0,startOffset)+change.text+this._content.substring(endOffset,this._content.length);const startLine=Math.max(range.start.line,0),endLine=Math.max(range.end.line,0);let lineOffsets=this._lineOffsets;const addedLineOffsets=computeLineOffsets(change.text,!1,startOffset);if(endLine-startLine===addedLineOffsets.length)for(let i=0,len=addedLineOffsets.length;i<len;i++)lineOffsets[i+startLine+1]=addedLineOffsets[i];else addedLineOffsets.length<1e4?lineOffsets.splice(startLine+1,endLine-startLine,...addedLineOffsets):this._lineOffsets=lineOffsets=lineOffsets.slice(0,startLine+1).concat(addedLineOffsets,lineOffsets.slice(endLine+1));const diff=change.text.length-(endOffset-startOffset);if(0!==diff)for(let i=startLine+1+addedLineOffsets.length,len=lineOffsets.length;i<len;i++)lineOffsets[i]=lineOffsets[i]+diff}else{if(!FullTextDocument2.isFull(change))throw new Error("Unknown change event received");this._content=change.text,this._lineOffsets=void 0}this._version=version}getLineOffsets(){return void 0===this._lineOffsets&&(this._lineOffsets=computeLineOffsets(this._content,!0)),this._lineOffsets}positionAt(offset){offset=Math.max(Math.min(offset,this._content.length),0);const lineOffsets=this.getLineOffsets();let low=0,high=lineOffsets.length;if(0===high)return{line:0,character:offset};for(;low<high;){const mid=Math.floor((low+high)/2);lineOffsets[mid]>offset?high=mid:low=mid+1}const line=low-1;return{line:line,character:(offset=this.ensureBeforeEOL(offset,lineOffsets[line]))-lineOffsets[line]}}offsetAt(position){const lineOffsets=this.getLineOffsets();if(position.line>=lineOffsets.length)return this._content.length;if(position.line<0)return 0;const lineOffset=lineOffsets[position.line];if(position.character<=0)return lineOffset;const nextLineOffset=position.line+1<lineOffsets.length?lineOffsets[position.line+1]:this._content.length,offset=Math.min(lineOffset+position.character,nextLineOffset);return this.ensureBeforeEOL(offset,lineOffset)}ensureBeforeEOL(offset,lineOffset){for(;offset>lineOffset&&isEOL(this._content.charCodeAt(offset-1));)offset--;return offset}get lineCount(){return this.getLineOffsets().length}static isIncremental(event){const candidate=event;return null!=candidate&&"string"==typeof candidate.text&&void 0!==candidate.range&&(void 0===candidate.rangeLength||"number"==typeof candidate.rangeLength)}static isFull(event){const candidate=event;return null!=candidate&&"string"==typeof candidate.text&&void 0===candidate.range&&void 0===candidate.rangeLength}}var TextDocument,TextDocument2,LIB;function mergeSort(data,compare){if(data.length<=1)return data;const p=data.length/2|0,left=data.slice(0,p),right=data.slice(p);mergeSort(left,compare),mergeSort(right,compare);let leftIdx=0,rightIdx=0,i=0;for(;leftIdx<left.length&&rightIdx<right.length;){const ret=compare(left[leftIdx],right[rightIdx]);data[i++]=ret<=0?left[leftIdx++]:right[rightIdx++]}for(;leftIdx<left.length;)data[i++]=left[leftIdx++];for(;rightIdx<right.length;)data[i++]=right[rightIdx++];return data}function computeLineOffsets(text,isAtLineStart,textOffset=0){const result=isAtLineStart?[textOffset]:[];for(let i=0;i<text.length;i++){const ch=text.charCodeAt(i);isEOL(ch)&&(13===ch&&i+1<text.length&&10===text.charCodeAt(i+1)&&i++,result.push(textOffset+i+1))}return result}function isEOL(char){return 13===char||10===char}function getWellformedRange(range){const start=range.start,end=range.end;return start.line>end.line||start.line===end.line&&start.character>end.character?{start:end,end:start}:range}function getWellformedEdit(textEdit){const range=getWellformedRange(textEdit.range);return range!==textEdit.range?{newText:textEdit.newText,range:range}:textEdit}(TextDocument2=TextDocument||(TextDocument={})).create=function(uri,languageId,version,content){return new FullTextDocument2(uri,languageId,version,content)},TextDocument2.update=function(document,changes,version){if(document instanceof FullTextDocument2)return document.update(changes,version),document;throw new Error("TextDocument.update: document must be created by TextDocument.create")},TextDocument2.applyEdits=function(document,edits){const text=document.getText(),sortedEdits=mergeSort(edits.map(getWellformedEdit),(a,b)=>{const diff=a.range.start.line-b.range.start.line;return 0===diff?a.range.start.character-b.range.start.character:diff});let lastModifiedOffset=0;const spans=[];for(const e of sortedEdits){const startOffset=document.offsetAt(e.range.start);if(startOffset<lastModifiedOffset)throw new Error("Overlapping edit");startOffset>lastModifiedOffset&&spans.push(text.substring(lastModifiedOffset,startOffset)),e.newText.length&&spans.push(e.newText),lastModifiedOffset=document.offsetAt(e.range.end)}return spans.push(text.substr(lastModifiedOffset)),spans.join("")},(()=>{var t={975:t2=>{function e2(t3){if("string"!=typeof t3)throw new TypeError("Path must be a string. Received "+JSON.stringify(t3))}function r2(t3,e3){for(var r3,n3="",i2=0,o2=-1,s2=0,h2=0;h2<=t3.length;++h2){if(h2<t3.length)r3=t3.charCodeAt(h2);else{if(47===r3)break;r3=47}if(47===r3){if(o2===h2-1||1===s2);else if(o2!==h2-1&&2===s2){if(n3.length<2||2!==i2||46!==n3.charCodeAt(n3.length-1)||46!==n3.charCodeAt(n3.length-2))if(n3.length>2){var a2=n3.lastIndexOf("/");if(a2!==n3.length-1){-1===a2?(n3="",i2=0):i2=(n3=n3.slice(0,a2)).length-1-n3.lastIndexOf("/"),o2=h2,s2=0;continue}}else if(2===n3.length||1===n3.length){n3="",i2=0,o2=h2,s2=0;continue}e3&&(n3.length>0?n3+="/..":n3="..",i2=2)}else n3.length>0?n3+="/"+t3.slice(o2+1,h2):n3=t3.slice(o2+1,h2),i2=h2-o2-1;o2=h2,s2=0}else 46===r3&&-1!==s2?++s2:s2=-1}return n3}var n2={resolve:function(){for(var t3,n3="",i2=!1,o2=arguments.length-1;o2>=-1&&!i2;o2--){var s2;o2>=0?s2=arguments[o2]:(void 0===t3&&(t3=process.cwd()),s2=t3),e2(s2),0!==s2.length&&(n3=s2+"/"+n3,i2=47===s2.charCodeAt(0))}return n3=r2(n3,!i2),i2?n3.length>0?"/"+n3:"/":n3.length>0?n3:"."},normalize:function(t3){if(e2(t3),0===t3.length)return".";var n3=47===t3.charCodeAt(0),i2=47===t3.charCodeAt(t3.length-1);return 0!==(t3=r2(t3,!n3)).length||n3||(t3="."),t3.length>0&&i2&&(t3+="/"),n3?"/"+t3:t3},isAbsolute:function(t3){return e2(t3),t3.length>0&&47===t3.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t3,r3=0;r3<arguments.length;++r3){var i2=arguments[r3];e2(i2),i2.length>0&&(void 0===t3?t3=i2:t3+="/"+i2)}return void 0===t3?".":n2.normalize(t3)},relative:function(t3,r3){if(e2(t3),e2(r3),t3===r3)return"";if((t3=n2.resolve(t3))===(r3=n2.resolve(r3)))return"";for(var i2=1;i2<t3.length&&47===t3.charCodeAt(i2);++i2);for(var o2=t3.length,s2=o2-i2,h2=1;h2<r3.length&&47===r3.charCodeAt(h2);++h2);for(var a2=r3.length-h2,c2=s2<a2?s2:a2,f2=-1,u2=0;u2<=c2;++u2){if(u2===c2){if(a2>c2){if(47===r3.charCodeAt(h2+u2))return r3.slice(h2+u2+1);if(0===u2)return r3.slice(h2+u2)}else s2>c2&&(47===t3.charCodeAt(i2+u2)?f2=u2:0===u2&&(f2=0));break}var l2=t3.charCodeAt(i2+u2);if(l2!==r3.charCodeAt(h2+u2))break;47===l2&&(f2=u2)}var g2="";for(u2=i2+f2+1;u2<=o2;++u2)u2!==o2&&47!==t3.charCodeAt(u2)||(0===g2.length?g2+="..":g2+="/..");return g2.length>0?g2+r3.slice(h2+f2):(h2+=f2,47===r3.charCodeAt(h2)&&++h2,r3.slice(h2))},_makeLong:function(t3){return t3},dirname:function(t3){if(e2(t3),0===t3.length)return".";for(var r3=t3.charCodeAt(0),n3=47===r3,i2=-1,o2=!0,s2=t3.length-1;s2>=1;--s2)if(47===(r3=t3.charCodeAt(s2))){if(!o2){i2=s2;break}}else o2=!1;return-1===i2?n3?"/":".":n3&&1===i2?"//":t3.slice(0,i2)},basename:function(t3,r3){if(void 0!==r3&&"string"!=typeof r3)throw new TypeError('"ext" argument must be a string');e2(t3);var n3,i2=0,o2=-1,s2=!0;if(void 0!==r3&&r3.length>0&&r3.length<=t3.length){if(r3.length===t3.length&&r3===t3)return"";var h2=r3.length-1,a2=-1;for(n3=t3.length-1;n3>=0;--n3){var c2=t3.charCodeAt(n3);if(47===c2){if(!s2){i2=n3+1;break}}else-1===a2&&(s2=!1,a2=n3+1),h2>=0&&(c2===r3.charCodeAt(h2)?-1==--h2&&(o2=n3):(h2=-1,o2=a2))}return i2===o2?o2=a2:-1===o2&&(o2=t3.length),t3.slice(i2,o2)}for(n3=t3.length-1;n3>=0;--n3)if(47===t3.charCodeAt(n3)){if(!s2){i2=n3+1;break}}else-1===o2&&(s2=!1,o2=n3+1);return-1===o2?"":t3.slice(i2,o2)},extname:function(t3){e2(t3);for(var r3=-1,n3=0,i2=-1,o2=!0,s2=0,h2=t3.length-1;h2>=0;--h2){var a2=t3.charCodeAt(h2);if(47!==a2)-1===i2&&(o2=!1,i2=h2+1),46===a2?-1===r3?r3=h2:1!==s2&&(s2=1):-1!==r3&&(s2=-1);else if(!o2){n3=h2+1;break}}return-1===r3||-1===i2||0===s2||1===s2&&r3===i2-1&&r3===n3+1?"":t3.slice(r3,i2)},format:function(t3){if(null===t3||"object"!=typeof t3)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t3);return r3=(e3=t3).dir||e3.root,n3=e3.base||(e3.name||"")+(e3.ext||""),r3?r3===e3.root?r3+n3:r3+"/"+n3:n3;var e3,r3,n3},parse:function(t3){e2(t3);var r3={root:"",dir:"",base:"",ext:"",name:""};if(0===t3.length)return r3;var n3,i2=t3.charCodeAt(0),o2=47===i2;o2?(r3.root="/",n3=1):n3=0;for(var s2=-1,h2=0,a2=-1,c2=!0,f2=t3.length-1,u2=0;f2>=n3;--f2)if(47!==(i2=t3.charCodeAt(f2)))-1===a2&&(c2=!1,a2=f2+1),46===i2?-1===s2?s2=f2:1!==u2&&(u2=1):-1!==s2&&(u2=-1);else if(!c2){h2=f2+1;break}return-1===s2||-1===a2||0===u2||1===u2&&s2===a2-1&&s2===h2+1?-1!==a2&&(r3.base=r3.name=0===h2&&o2?t3.slice(1,a2):t3.slice(h2,a2)):(0===h2&&o2?(r3.name=t3.slice(1,s2),r3.base=t3.slice(1,a2)):(r3.name=t3.slice(h2,s2),r3.base=t3.slice(h2,a2)),r3.ext=t3.slice(s2,a2)),h2>0?r3.dir=t3.slice(0,h2-1):o2&&(r3.dir="/"),r3},sep:"/",delimiter:":",win32:null,posix:null};n2.posix=n2,t2.exports=n2}},e={};function r(n2){var i2=e[n2];if(void 0!==i2)return i2.exports;var o2=e[n2]={exports:{}};return t[n2](o2,o2.exports,r),o2.exports}r.d=(t2,e2)=>{for(var n2 in e2)r.o(e2,n2)&&!r.o(t2,n2)&&Object.defineProperty(t2,n2,{enumerable:!0,get:e2[n2]})},r.o=(t2,e2)=>Object.prototype.hasOwnProperty.call(t2,e2),r.r=t2=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t2,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t2,"__esModule",{value:!0})};var n={};let i;if(r.r(n),r.d(n,{URI:()=>l,Utils:()=>I}),"object"==typeof process)i="win32"===process.platform;else if("object"==typeof navigator){let t2=navigator.userAgent;i=t2.indexOf("Windows")>=0}const o=/^\w[\w\d+.-]*$/,s=/^\//,h=/^\/\//;function a(t2,e2){if(!t2.scheme&&e2)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${t2.authority}", path: "${t2.path}", query: "${t2.query}", fragment: "${t2.fragment}"}`);if(t2.scheme&&!o.test(t2.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t2.path)if(t2.authority){if(!s.test(t2.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(h.test(t2.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}const c="",f="/",u=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class l{constructor(t2,e2,r2,n2,i2,o2=!1){__publicField(this,"scheme"),__publicField(this,"authority"),__publicField(this,"path"),__publicField(this,"query"),__publicField(this,"fragment"),"object"==typeof t2?(this.scheme=t2.scheme||c,this.authority=t2.authority||c,this.path=t2.path||c,this.query=t2.query||c,this.fragment=t2.fragment||c):(this.scheme=function(t3,e3){return t3||e3?t3:"file"}(t2,o2),this.authority=e2||c,this.path=function(t3,e3){switch(t3){case"https":case"http":case"file":e3?e3[0]!==f&&(e3=f+e3):e3=f}return e3}(this.scheme,r2||c),this.query=n2||c,this.fragment=i2||c,a(this,o2))}static isUri(t2){return t2 instanceof l||!!t2&&"string"==typeof t2.authority&&"string"==typeof t2.fragment&&"string"==typeof t2.path&&"string"==typeof t2.query&&"string"==typeof t2.scheme&&"string"==typeof t2.fsPath&&"function"==typeof t2.with&&"function"==typeof t2.toString}get fsPath(){return v(this)}with(t2){if(!t2)return this;let{scheme:e2,authority:r2,path:n2,query:i2,fragment:o2}=t2;return void 0===e2?e2=this.scheme:null===e2&&(e2=c),void 0===r2?r2=this.authority:null===r2&&(r2=c),void 0===n2?n2=this.path:null===n2&&(n2=c),void 0===i2?i2=this.query:null===i2&&(i2=c),void 0===o2?o2=this.fragment:null===o2&&(o2=c),e2===this.scheme&&r2===this.authority&&n2===this.path&&i2===this.query&&o2===this.fragment?this:new d(e2,r2,n2,i2,o2)}static parse(t2,e2=!1){const r2=u.exec(t2);return r2?new d(r2[2]||c,w(r2[4]||c),w(r2[5]||c),w(r2[7]||c),w(r2[9]||c),e2):new d(c,c,c,c,c)}static file(t2){let e2=c;if(i&&(t2=t2.replace(/\\/g,f)),t2[0]===f&&t2[1]===f){const r2=t2.indexOf(f,2);-1===r2?(e2=t2.substring(2),t2=f):(e2=t2.substring(2,r2),t2=t2.substring(r2)||f)}return new d("file",e2,t2,c,c)}static from(t2){const e2=new d(t2.scheme,t2.authority,t2.path,t2.query,t2.fragment);return a(e2,!0),e2}toString(t2=!1){return b(this,t2)}toJSON(){return this}static revive(t2){if(t2){if(t2 instanceof l)return t2;{const e2=new d(t2);return e2._formatted=t2.external,e2._fsPath=t2._sep===g?t2.fsPath:null,e2}}return t2}}const g=i?1:void 0;class d extends l{constructor(){super(...arguments),__publicField(this,"_formatted",null),__publicField(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=v(this)),this._fsPath}toString(t2=!1){return t2?b(this,!0):(this._formatted||(this._formatted=b(this,!1)),this._formatted)}toJSON(){const t2={$mid:1};return this._fsPath&&(t2.fsPath=this._fsPath,t2._sep=g),this._formatted&&(t2.external=this._formatted),this.path&&(t2.path=this.path),this.scheme&&(t2.scheme=this.scheme),this.authority&&(t2.authority=this.authority),this.query&&(t2.query=this.query),this.fragment&&(t2.fragment=this.fragment),t2}}const p={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 m(t2,e2,r2){let n2,i2=-1;for(let o2=0;o2<t2.length;o2++){const s2=t2.charCodeAt(o2);if(s2>=97&&s2<=122||s2>=65&&s2<=90||s2>=48&&s2<=57||45===s2||46===s2||95===s2||126===s2||e2&&47===s2||r2&&91===s2||r2&&93===s2||r2&&58===s2)-1!==i2&&(n2+=encodeURIComponent(t2.substring(i2,o2)),i2=-1),void 0!==n2&&(n2+=t2.charAt(o2));else{void 0===n2&&(n2=t2.substr(0,o2));const e3=p[s2];void 0!==e3?(-1!==i2&&(n2+=encodeURIComponent(t2.substring(i2,o2)),i2=-1),n2+=e3):-1===i2&&(i2=o2)}}return-1!==i2&&(n2+=encodeURIComponent(t2.substring(i2))),void 0!==n2?n2:t2}function y(t2){let e2;for(let r2=0;r2<t2.length;r2++){const n2=t2.charCodeAt(r2);35===n2||63===n2?(void 0===e2&&(e2=t2.substr(0,r2)),e2+=p[n2]):void 0!==e2&&(e2+=t2[r2])}return void 0!==e2?e2:t2}function v(t2,e2){let r2;return r2=t2.authority&&t2.path.length>1&&"file"===t2.scheme?`//${t2.authority}${t2.path}`:47===t2.path.charCodeAt(0)&&(t2.path.charCodeAt(1)>=65&&t2.path.charCodeAt(1)<=90||t2.path.charCodeAt(1)>=97&&t2.path.charCodeAt(1)<=122)&&58===t2.path.charCodeAt(2)?t2.path[1].toLowerCase()+t2.path.substr(2):t2.path,i&&(r2=r2.replace(/\//g,"\\")),r2}function b(t2,e2){const r2=e2?y:m;let n2="",{scheme:i2,authority:o2,path:s2,query:h2,fragment:a2}=t2;if(i2&&(n2+=i2,n2+=":"),(o2||"file"===i2)&&(n2+=f,n2+=f),o2){let t3=o2.indexOf("@");if(-1!==t3){const e3=o2.substr(0,t3);o2=o2.substr(t3+1),t3=e3.lastIndexOf(":"),-1===t3?n2+=r2(e3,!1,!1):(n2+=r2(e3.substr(0,t3),!1,!1),n2+=":",n2+=r2(e3.substr(t3+1),!1,!0)),n2+="@"}o2=o2.toLowerCase(),t3=o2.lastIndexOf(":"),-1===t3?n2+=r2(o2,!1,!0):(n2+=r2(o2.substr(0,t3),!1,!0),n2+=o2.substr(t3))}if(s2){if(s2.length>=3&&47===s2.charCodeAt(0)&&58===s2.charCodeAt(2)){const t3=s2.charCodeAt(1);t3>=65&&t3<=90&&(s2=`/${String.fromCharCode(t3+32)}:${s2.substr(3)}`)}else if(s2.length>=2&&58===s2.charCodeAt(1)){const t3=s2.charCodeAt(0);t3>=65&&t3<=90&&(s2=`${String.fromCharCode(t3+32)}:${s2.substr(2)}`)}n2+=r2(s2,!0,!1)}return h2&&(n2+="?",n2+=r2(h2,!1,!1)),a2&&(n2+="#",n2+=e2?a2:m(a2,!1,!1)),n2}function C(t2){try{return decodeURIComponent(t2)}catch{return t2.length>3?t2.substr(0,3)+C(t2.substr(3)):t2}}const A=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function w(t2){return t2.match(A)?t2.replace(A,t3=>C(t3)):t2}var x=r(975);const P=x.posix||x,_="/";var I,t2;(t2=I||(I={})).joinPath=function(t3,...e2){return t3.with({path:P.join(t3.path,...e2)})},t2.resolvePath=function(t3,...e2){let r2=t3.path,n2=!1;r2[0]!==_&&(r2=_+r2,n2=!0);let i2=P.resolve(r2,...e2);return n2&&i2[0]===_&&!t3.authority&&(i2=i2.substring(1)),t3.with({path:i2})},t2.dirname=function(t3){if(0===t3.path.length||t3.path===_)return t3;let e2=P.dirname(t3.path);return 1===e2.length&&46===e2.charCodeAt(0)&&(e2=""),t3.with({path:e2})},t2.basename=function(t3){return P.basename(t3.path)},t2.extname=function(t3){return P.extname(t3.path)},LIB=n})();const{URI:URI,Utils:Utils}=LIB;var UriUtils,DocumentState,DocumentState2;!function(UriUtils2){UriUtils2.basename=Utils.basename,UriUtils2.dirname=Utils.dirname,UriUtils2.extname=Utils.extname,UriUtils2.joinPath=Utils.joinPath,UriUtils2.resolvePath=Utils.resolvePath;const isWindows="object"==typeof process&&"win32"===(null==process?void 0:process.platform);UriUtils2.equals=function(a,b){return(null==a?void 0:a.toString())===(null==b?void 0:b.toString())},UriUtils2.relative=function(from,to){const fromPath="string"==typeof from?URI.parse(from).path:from.path,toPath="string"==typeof to?URI.parse(to).path:to.path,fromParts=fromPath.split("/").filter(e=>e.length>0),toParts=toPath.split("/").filter(e=>e.length>0);if(isWindows){const upperCaseDriveLetter=/^[A-Z]:$/;if(fromParts[0]&&upperCaseDriveLetter.test(fromParts[0])&&(fromParts[0]=fromParts[0].toLowerCase()),toParts[0]&&upperCaseDriveLetter.test(toParts[0])&&(toParts[0]=toParts[0].toLowerCase()),fromParts[0]!==toParts[0])return toPath.substring(1)}let i=0;for(;i<fromParts.length&&fromParts[i]===toParts[i];i++);return"../".repeat(fromParts.length-i)+toParts.slice(i).join("/")},UriUtils2.normalize=function(uri){return URI.parse(uri.toString()).toString()},UriUtils2.contains=function(parent,child){let parentPath="string"==typeof parent?parent:parent.path,childPath="string"==typeof child?child:child.path;return"/"===childPath.charAt(childPath.length-1)&&(childPath=childPath.slice(0,-1)),"/"===parentPath.charAt(parentPath.length-1)&&(parentPath=parentPath.slice(0,-1)),childPath===parentPath||!(childPath.length<parentPath.length)&&("/"===childPath.charAt(parentPath.length)&&childPath.startsWith(parentPath))}}(UriUtils||(UriUtils={}));class UriTrie{constructor(){this.root={name:"",children:new Map}}normalizeUri(uri){return UriUtils.normalize(uri)}clear(){this.root.children.clear()}insert(uri,element){this.getNode(this.normalizeUri(uri),!0).element=element}delete(uri){const nodeToDelete=this.getNode(this.normalizeUri(uri),!1);(null==nodeToDelete?void 0:nodeToDelete.parent)&&nodeToDelete.parent.children.delete(nodeToDelete.name)}has(uri){var _a2;return void 0!==(null==(_a2=this.getNode(this.normalizeUri(uri),!1))?void 0:_a2.element)}hasNode(uri){return void 0!==this.getNode(this.normalizeUri(uri),!1)}find(uri){var _a2;return null==(_a2=this.getNode(this.normalizeUri(uri),!1))?void 0:_a2.element}findNode(uri){const uriString=this.normalizeUri(uri),node=this.getNode(uriString,!1);if(node)return{name:node.name,uri:UriUtils.joinPath(URI.parse(uriString),node.name).toString(),element:node.element}}findChildren(uri){const uriString=this.normalizeUri(uri),node=this.getNode(uriString,!1);return node?Array.from(node.children.values()).map(child=>({name:child.name,uri:UriUtils.joinPath(URI.parse(uriString),child.name).toString(),element:child.element})):[]}all(){return this.collectValues(this.root)}findAll(prefix){const node=this.getNode(UriUtils.normalize(prefix),!1);return node?this.collectValues(node):[]}getNode(uri,create){const parts=uri.split("/");"/"===uri.charAt(uri.length-1)&&parts.pop();let current=this.root;for(const part of parts){let child=current.children.get(part);if(!child){if(!create)return;child={name:part,children:new Map,parent:current},current.children.set(part,child)}current=child}return current}collectValues(node){const result=[];node.element&&result.push(node.element);for(const child of node.children.values())result.push(...this.collectValues(child));return result}}(DocumentState2=DocumentState||(DocumentState={}))[DocumentState2.Changed=0]="Changed",DocumentState2[DocumentState2.Parsed=1]="Parsed",DocumentState2[DocumentState2.IndexedContent=2]="IndexedContent",DocumentState2[DocumentState2.ComputedScopes=3]="ComputedScopes",DocumentState2[DocumentState2.Linked=4]="Linked",DocumentState2[DocumentState2.IndexedReferences=5]="IndexedReferences",DocumentState2[DocumentState2.Validated=6]="Validated";class DefaultLangiumDocumentFactory{constructor(services){this.serviceRegistry=services.ServiceRegistry,this.textDocuments=services.workspace.TextDocuments,this.fileSystemProvider=services.workspace.FileSystemProvider}async fromUri(uri,cancellationToken=cancellationExports.CancellationToken.None){const content=await this.fileSystemProvider.readFile(uri);return this.createAsync(uri,content,cancellationToken)}fromTextDocument(textDocument,uri,token){return uri=uri??URI.parse(textDocument.uri),cancellationExports.CancellationToken.is(token)?this.createAsync(uri,textDocument,token):this.create(uri,textDocument,token)}fromString(text,uri,token){return cancellationExports.CancellationToken.is(token)?this.createAsync(uri,text,token):this.create(uri,text,token)}fromModel(model,uri){return this.create(uri,{$model:model})}create(uri,content,options){if("string"==typeof content){const parseResult=this.parse(uri,content,options);return this.createLangiumDocument(parseResult,uri,void 0,content)}if("$model"in content){const parseResult={value:content.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(parseResult,uri)}{const parseResult=this.parse(uri,content.getText(),options);return this.createLangiumDocument(parseResult,uri,content)}}async createAsync(uri,content,cancelToken){if("string"==typeof content){const parseResult=await this.parseAsync(uri,content,cancelToken);return this.createLangiumDocument(parseResult,uri,void 0,content)}{const parseResult=await this.parseAsync(uri,content.getText(),cancelToken);return this.createLangiumDocument(parseResult,uri,content)}}createLangiumDocument(parseResult,uri,textDocument,text){let document;if(textDocument)document={parseResult:parseResult,uri:uri,state:DocumentState.Parsed,references:[],textDocument:textDocument};else{const textDocumentGetter=this.createTextDocumentGetter(uri,text);document={parseResult:parseResult,uri:uri,state:DocumentState.Parsed,references:[],get textDocument(){return textDocumentGetter()}}}return parseResult.value.$document=document,document}async update(document,cancellationToken){var _a2,_b2;const oldText=null==(_a2=document.parseResult.value.$cstNode)?void 0:_a2.root.fullText,textDocument=null==(_b2=this.textDocuments)?void 0:_b2.get(document.uri.toString()),text=textDocument?textDocument.getText():await this.fileSystemProvider.readFile(document.uri);if(textDocument)Object.defineProperty(document,"textDocument",{value:textDocument});else{const textDocumentGetter=this.createTextDocumentGetter(document.uri,text);Object.defineProperty(document,"textDocument",{get:textDocumentGetter})}return oldText!==text&&(document.parseResult=await this.parseAsync(document.uri,text,cancellationToken),document.parseResult.value.$document=document),document.state=DocumentState.Parsed,document}parse(uri,text,options){return this.serviceRegistry.getServices(uri).parser.LangiumParser.parse(text,options)}parseAsync(uri,text,cancellationToken){return this.serviceRegistry.getServices(uri).parser.AsyncParser.parse(text,cancellationToken)}createTextDocumentGetter(uri,text){const serviceRegistry=this.serviceRegistry;let textDoc;return()=>textDoc??(textDoc=TextDocument.create(uri.toString(),serviceRegistry.getServices(uri).LanguageMetaData.languageId,0,text??""))}}class DefaultLangiumDocuments{constructor(services){this.documentTrie=new UriTrie,this.services=services,this.langiumDocumentFactory=services.workspace.LangiumDocumentFactory,this.documentBuilder=()=>services.workspace.DocumentBuilder}get all(){return stream(this.documentTrie.all())}addDocument(document){const uriString=document.uri.toString();if(this.documentTrie.has(uriString))throw new Error(`A document with the URI '${uriString}' is already present.`);this.documentTrie.insert(uriString,document)}getDocument(uri){const uriString=uri.toString();return this.documentTrie.find(uriString)}getDocuments(folder){const uriString=folder.toString();return this.documentTrie.findAll(uriString)}async getOrCreateDocument(uri,cancellationToken){let document=this.getDocument(uri);return document||(document=await this.langiumDocumentFactory.fromUri(uri,cancellationToken),this.addDocument(document),document)}createDocument(uri,text,cancellationToken){if(cancellationToken)return this.langiumDocumentFactory.fromString(text,uri,cancellationToken).then(document=>(this.addDocument(document),document));{const document=this.langiumDocumentFactory.fromString(text,uri);return this.addDocument(document),document}}hasDocument(uri){return this.documentTrie.has(uri.toString())}invalidateDocument(uri){const uriString=uri.toString(),langiumDoc=this.documentTrie.find(uriString);return langiumDoc&&this.documentBuilder().resetToState(langiumDoc,DocumentState.Changed),langiumDoc}deleteDocument(uri){const uriString=uri.toString(),langiumDoc=this.documentTrie.find(uriString);return langiumDoc&&(langiumDoc.state=DocumentState.Changed,this.documentTrie.delete(uriString)),langiumDoc}deleteDocuments(folder){const uriString=folder.toString(),langiumDocs=this.documentTrie.findAll(uriString);for(const langiumDoc of langiumDocs)langiumDoc.state=DocumentState.Changed;return this.documentTrie.delete(uriString),langiumDocs}}const RefResolving=Symbol("RefResolving");class DefaultLinker{constructor(services){this.reflection=services.shared.AstReflection,this.langiumDocuments=()=>services.shared.workspace.LangiumDocuments,this.scopeProvider=services.references.ScopeProvider,this.astNodeLocator=services.workspace.AstNodeLocator,this.profiler=services.shared.profilers.LangiumProfiler,this.languageId=services.LanguageMetaData.languageId}async link(document,cancelToken=cancellationExports.CancellationToken.None){var _a2;if(null==(_a2=this.profiler)?void 0:_a2.isActive("linking")){const task=this.profiler.createTask("linking",this.languageId);task.start();try{for(const node of streamAst(document.parseResult.value))await interruptAndCheck(cancelToken),streamReferences(node).forEach(ref=>{const name=`${node.$type}:${ref.property}`;task.startSubTask(name);try{this.doLink(ref,document)}finally{task.stopSubTask(name)}})}finally{task.stop()}}else for(const node of streamAst(document.parseResult.value))await interruptAndCheck(cancelToken),streamReferences(node).forEach(ref=>this.doLink(ref,document))}doLink(refInfo,document){const ref=refInfo.reference;if("_ref"in ref&&void 0===ref._ref){ref._ref=RefResolving;try{const description=this.getCandidate(refInfo);if(isLinkingError(description))ref._ref=description;else{ref._nodeDescription=description;const linkedNode=this.loadAstNode(description);ref._ref=linkedNode??this.createLinkingError(refInfo,description)}}catch(err){console.error(`An error occurred while resolving reference to '${ref.$refText}':`,err);const errorMessage=err.message??String(err);ref._ref={info:refInfo,message:`An error occurred while resolving reference to '${ref.$refText}': ${errorMessage}`}}document.references.push(ref)}else if("_items"in ref&&void 0===ref._items){ref._items=RefResolving;try{const descriptions=this.getCandidates(refInfo),items=[];if(isLinkingError(descriptions))ref._linkingError=descriptions;else for(const description of descriptions){const linkedNode=this.loadAstNode(description);linkedNode&&items.push({ref:linkedNode,$nodeDescription:description})}ref._items=items}catch(err){ref._linkingError={info:refInfo,message:`An error occurred while resolving reference to '${ref.$refText}': ${err}`},ref._items=[]}document.references.push(ref)}}unlink(document){for(const ref of document.references)"_ref"in ref?(ref._ref=void 0,delete ref._nodeDescription):"_items"in ref&&(ref._items=void 0,delete ref._linkingError);document.references=[]}getCandidate(refInfo){return this.scopeProvider.getScope(refInfo).getElement(refInfo.reference.$refText)??this.createLinkingError(refInfo)}getCandidates(refInfo){const descriptions=this.scopeProvider.getScope(refInfo).getElements(refInfo.reference.$refText).distinct(desc=>`${desc.documentUri}#${desc.path}`).toArray();return descriptions.length>0?descriptions:this.createLinkingError(refInfo)}buildReference(node,property,refNode,refText){const linker=this,reference={$refNode:refNode,$refText:refText,_ref:void 0,get ref(){if(isAstNode(this._ref))return this._ref;if("object"==typeof(obj=this._nodeDescription)&&null!==obj&&"string"==typeof obj.name&&"string"==typeof obj.type&&"string"==typeof obj.path){const linkedNode=linker.loadAstNode(this._nodeDescription);this._ref=linkedNode??linker.createLinkingError({reference:reference,container:node,property:property},this._nodeDescription)}else if(void 0===this._ref){this._ref=RefResolving;const document=findRootNode(node).$document,refData=linker.getLinkedNode({reference:reference,container:node,property:property});if(refData.error&&document&&document.state<DocumentState.ComputedScopes)return this._ref=void 0;this._ref=refData.node??refData.error,this._nodeDescription=refData.descr,null==document||document.references.push(this)}else this._ref===RefResolving&&linker.throwCyclicReferenceError(node,property,refText);var obj;return isAstNode(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return isLinkingError(this._ref)?this._ref:void 0}};return reference}buildMultiReference(node,property,refNode,refText){const linker=this,reference={$refNode:refNode,$refText:refText,_items:void 0,get items(){if(Array.isArray(this._items))return this._items;if(void 0===this._items){this._items=RefResolving;const document=findRootNode(node).$document,descriptions=linker.getCandidates({reference:reference,container:node,property:property}),items=[];if(isLinkingError(descriptions))this._linkingError=descriptions;else for(const description of descriptions){const linkedNode=linker.loadAstNode(description);linkedNode&&items.push({ref:linkedNode,$nodeDescription:description})}this._items=items,null==document||document.references.push(this)}else this._items===RefResolving&&linker.throwCyclicReferenceError(node,property,refText);return Array.isArray(this._items)?this._items:[]},get error(){if(this._linkingError)return this._linkingError;return this.items.length>0?void 0:this._linkingError=linker.createLinkingError({reference:reference,container:node,property:property})}};return reference}throwCyclicReferenceError(node,property,refText){throw new Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(node)}/${property} (symbol '${refText}')`)}getLinkedNode(refInfo){try{const description=this.getCandidate(refInfo);if(isLinkingError(description))return{error:description};const linkedNode=this.loadAstNode(description);return linkedNode?{node:linkedNode,descr:description}:{descr:description,error:this.createLinkingError(refInfo,description)}}catch(err){console.error(`An error occurred while resolving reference to '${refInfo.reference.$refText}':`,err);const errorMessage=err.message??String(err);return{error:{info:refInfo,message:`An error occurred while resolving reference to '${refInfo.reference.$refText}': ${errorMessage}`}}}}loadAstNode(nodeDescription){if(nodeDescription.node)return nodeDescription.node;const doc=this.langiumDocuments().getDocument(nodeDescription.documentUri);return doc?this.astNodeLocator.getAstNode(doc.parseResult.value,nodeDescription.path):void 0}createLinkingError(refInfo,targetDescription){const document=findRootNode(refInfo.container).$document;document&&document.state<DocumentState.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${document.uri}).`);return{info:refInfo,message:`Could not resolve reference to ${this.reflection.getReferenceType(refInfo)} named '${refInfo.reference.$refText}'.`,targetDescription:targetDescription}}}class DefaultNameProvider{getName(node){if(function(node){return"string"==typeof node.name}(node))return node.name}getNameNode(node){return findNodeForProperty(node.$cstNode,"name")}}class DefaultReferences{constructor(services){this.nameProvider=services.references.NameProvider,this.index=services.shared.workspace.IndexManager,this.nodeLocator=services.workspace.AstNodeLocator,this.documents=services.shared.workspace.LangiumDocuments,this.hasMultiReference=streamAst(services.Grammar).some(node=>isCrossReference(node)&&node.isMulti)}findDeclarations(sourceCstNode){if(sourceCstNode){const assignment=function(cstNode){var _a2;const astNode=cstNode.astNode;for(;astNode===(null==(_a2=cstNode.container)?void 0:_a2.astNode);){const assignment=getContainerOfType(cstNode.grammarSource,isAssignment);if(assignment)return assignment;cstNode=cstNode.container}}(sourceCstNode),nodeElem=sourceCstNode.astNode;if(assignment&&nodeElem){const reference=nodeElem[assignment.feature];if(isReference(reference)||isMultiReference(reference))return getReferenceNodes(reference);if(Array.isArray(reference))for(const ref of reference)if((isReference(ref)||isMultiReference(ref))&&ref.$refNode&&ref.$refNode.offset<=sourceCstNode.offset&&ref.$refNode.end>=sourceCstNode.end)return getReferenceNodes(ref)}if(nodeElem){const nameNode=this.nameProvider.getNameNode(nodeElem);if(nameNode&&(nameNode===sourceCstNode||function(child,parent){for(;child.container;)if((child=child.container)===parent)return!0;return!1}(sourceCstNode,nameNode)))return this.getSelfNodes(nodeElem)}}return[]}getSelfNodes(node){if(this.hasMultiReference){const references=this.index.findAllReferences(node,this.nodeLocator.getAstNodePath(node)),headNode=this.getNodeFromReferenceDescription(references.head());if(headNode)for(const ref of streamReferences(headNode))if(isMultiReference(ref.reference)&&ref.reference.items.some(item=>item.ref===node))return ref.reference.items.map(item=>item.ref);return[node]}return[node]}getNodeFromReferenceDescription(ref){if(!ref)return;const doc=this.documents.getDocument(ref.sourceUri);return doc?this.nodeLocator.getAstNode(doc.parseResult.value,ref.sourcePath):void 0}findDeclarationNodes(sourceCstNode){const astNodes=this.findDeclarations(sourceCstNode),cstNodes=[];for(const astNode of astNodes){const cstNode=this.nameProvider.getNameNode(astNode)??astNode.$cstNode;cstNode&&cstNodes.push(cstNode)}return cstNodes}findReferences(targetNode,options){const refs=[];options.includeDeclaration&&refs.push(...this.getSelfReferences(targetNode));let indexReferences=this.index.findAllReferences(targetNode,this.nodeLocator.getAstNodePath(targetNode));return options.documentUri&&(indexReferences=indexReferences.filter(ref=>UriUtils.equals(ref.sourceUri,options.documentUri))),refs.push(...indexReferences),stream(refs)}getSelfReferences(targetNode){const selfNodes=this.getSelfNodes(targetNode),references=[];for(const selfNode of selfNodes){const nameNode=this.nameProvider.getNameNode(selfNode);if(nameNode){const doc=getDocument(selfNode),path=this.nodeLocator.getAstNodePath(selfNode);references.push({sourceUri:doc.uri,sourcePath:path,targetUri:doc.uri,targetPath:path,segment:toDocumentSegment(nameNode),local:!0})}}return references}}class MultiMap{constructor(elements){if(this.map=new Map,elements)for(const[key,value]of elements)this.add(key,value)}get size(){return Reduction.sum(stream(this.map.values()).map(a=>a.length))}clear(){this.map.clear()}delete(key,value){if(void 0===value)return this.map.delete(key);{const values=this.map.get(key);if(values){const index=values.indexOf(value);if(index>=0)return 1===values.length?this.map.delete(key):values.splice(index,1),!0}return!1}}get(key){return this.map.get(key)??[]}getStream(key){const values=this.map.get(key);return values?stream(values):EMPTY_STREAM}has(key,value){if(void 0===value)return this.map.has(key);{const values=this.map.get(key);return!!values&&values.indexOf(value)>=0}}add(key,value){return this.map.has(key)?this.map.get(key).push(value):this.map.set(key,[value]),this}addAll(key,values){return this.map.has(key)?this.map.get(key).push(...values):this.map.set(key,Array.from(values)),this}forEach(callbackfn){this.map.forEach((array,key)=>array.forEach(value=>callbackfn(value,key,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return stream(this.map.entries()).flatMap(([key,array])=>array.map(value=>[key,value]))}keys(){return stream(this.map.keys())}values(){return stream(this.map.values()).flat()}entriesGroupedByKey(){return stream(this.map.entries())}}class BiMap{get size(){return this.map.size}constructor(elements){if(this.map=new Map,this.inverse=new Map,elements)for(const[key,value]of elements)this.set(key,value)}clear(){this.map.clear(),this.inverse.clear()}set(key,value){return this.map.set(key,value),this.inverse.set(value,key),this}get(key){return this.map.get(key)}getKey(value){return this.inverse.get(value)}delete(key){const value=this.map.get(key);return void 0!==value&&(this.map.delete(key),this.inverse.delete(value),!0)}}class DefaultScopeComputation{constructor(services){this.nameProvider=services.references.NameProvider,this.descriptions=services.workspace.AstNodeDescriptionProvider}async collectExportedSymbols(document,cancelToken=cancellationExports.CancellationToken.None){return this.collectExportedSymbolsForNode(document.parseResult.value,document,void 0,cancelToken)}async collectExportedSymbolsForNode(parentNode,document,children=streamContents,cancelToken=cancellationExports.CancellationToken.None){const exports$1=[];this.addExportedSymbol(parentNode,exports$1,document);for(const node of children(parentNode))await interruptAndCheck(cancelToken),this.addExportedSymbol(node,exports$1,document);return exports$1}addExportedSymbol(node,exports$1,document){const name=this.nameProvider.getName(node);name&&exports$1.push(this.descriptions.createDescription(node,name,document))}async collectLocalSymbols(document,cancelToken=cancellationExports.CancellationToken.None){const rootNode=document.parseResult.value,symbols=new MultiMap;for(const node of streamAllContents(rootNode))await interruptAndCheck(cancelToken),this.addLocalSymbol(node,document,symbols);return symbols}addLocalSymbol(node,document,symbols){const container=node.$container;if(container){const name=this.nameProvider.getName(node);name&&symbols.add(container,this.descriptions.createDescription(node,name,document))}}}class StreamScope{constructor(elements,outerScope,options){this.elements=elements,this.outerScope=outerScope,this.caseInsensitive=(null==options?void 0:options.caseInsensitive)??!1,this.concatOuterScope=(null==options?void 0:options.concatOuterScope)??!0}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(name){const lowerCaseName=this.caseInsensitive?name.toLowerCase():name,local=this.caseInsensitive?this.elements.find(e=>e.name.toLowerCase()===lowerCaseName):this.elements.find(e=>e.name===name);return local||(this.outerScope?this.outerScope.getElement(name):void 0)}getElements(name){const lowerCaseName=this.caseInsensitive?name.toLowerCase():name,local=this.caseInsensitive?this.elements.filter(e=>e.name.toLowerCase()===lowerCaseName):this.elements.filter(e=>e.name===name);return(this.concatOuterScope||local.isEmpty())&&this.outerScope?local.concat(this.outerScope.getElements(name)):local}}class MultiMapScope{constructor(elements,outerScope,options){this.elements=new MultiMap,this.caseInsensitive=(null==options?void 0:options.caseInsensitive)??!1,this.concatOuterScope=(null==options?void 0:options.concatOuterScope)??!0;for(const element of elements){const name=this.caseInsensitive?element.name.toLowerCase():element.name;this.elements.add(name,element)}this.outerScope=outerScope}getElement(name){const localName=this.caseInsensitive?name.toLowerCase():name,local=this.elements.get(localName)[0];return local||(this.outerScope?this.outerScope.getElement(name):void 0)}getElements(name){const localName=this.caseInsensitive?name.toLowerCase():name,local=this.elements.get(localName);return(this.concatOuterScope||0===local.length)&&this.outerScope?stream(local).concat(this.outerScope.getElements(name)):stream(local)}getAllElements(){let elementStream=stream(this.elements.values());return this.outerScope&&(elementStream=elementStream.concat(this.outerScope.getAllElements())),elementStream}}class DisposableCache{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(disposable2){this.toDispose.push(disposable2)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(disposable2=>disposable2.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}}class SimpleCache extends DisposableCache{constructor(){super(...arguments),this.cache=new Map}has(key){return this.throwIfDisposed(),this.cache.has(key)}set(key,value){this.throwIfDisposed(),this.cache.set(key,value)}get(key,provider){if(this.throwIfDisposed(),this.cache.has(key))return this.cache.get(key);if(provider){const value=provider();return this.cache.set(key,value),value}}delete(key){return this.throwIfDisposed(),this.cache.delete(key)}clear(){this.throwIfDisposed(),this.cache.clear()}}class ContextCache extends DisposableCache{constructor(converter){super(),this.cache=new Map,this.converter=converter??(value=>value)}has(contextKey,key){return this.throwIfDisposed(),this.cacheForContext(contextKey).has(key)}set(contextKey,key,value){this.throwIfDisposed(),this.cacheForContext(contextKey).set(key,value)}get(contextKey,key,provider){this.throwIfDisposed();const contextCache=this.cacheForContext(contextKey);if(contextCache.has(key))return contextCache.get(key);if(provider){const value=provider();return contextCache.set(key,value),value}}delete(contextKey,key){return this.throwIfDisposed(),this.cacheForContext(contextKey).delete(key)}clear(contextKey){if(this.throwIfDisposed(),contextKey){const mapKey=this.converter(contextKey);this.cache.delete(mapKey)}else this.cache.clear()}cacheForContext(contextKey){const mapKey=this.converter(contextKey);let documentCache=this.cache.get(mapKey);return documentCache||(documentCache=new Map,this.cache.set(mapKey,documentCache)),documentCache}}class WorkspaceCache extends SimpleCache{constructor(sharedServices,state){super(),state?(this.toDispose.push(sharedServices.workspace.DocumentBuilder.onBuildPhase(state,()=>{this.clear()})),this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate((_changed,deleted)=>{deleted.length>0&&this.clear()}))):this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}class DefaultScopeProvider{constructor(services){this.reflection=services.shared.AstReflection,this.nameProvider=services.references.NameProvider,this.descriptions=services.workspace.AstNodeDescriptionProvider,this.indexManager=services.shared.workspace.IndexManager,this.globalScopeCache=new WorkspaceCache(services.shared)}getScope(context){const scopes=[],referenceType=this.reflection.getReferenceType(context),localSymbols=getDocument(context.container).localSymbols;if(localSymbols){let currentNode=context.container;do{localSymbols.has(currentNode)&&scopes.push(localSymbols.getStream(currentNode).filter(desc=>this.reflection.isSubtype(desc.type,referenceType))),currentNode=currentNode.$container}while(currentNode)}let result=this.getGlobalScope(referenceType,context);for(let i=scopes.length-1;i>=0;i--)result=this.createScope(scopes[i],result);return result}createScope(elements,outerScope,options){return new StreamScope(stream(elements),outerScope,options)}createScopeForNodes(elements,outerScope,options){const s=stream(elements).map(e=>{const name=this.nameProvider.getName(e);if(name)return this.descriptions.createDescription(e,name)}).nonNullable();return new StreamScope(s,outerScope,options)}getGlobalScope(referenceType,_context){return this.globalScopeCache.get(referenceType,()=>new MultiMapScope(this.indexManager.allElements(referenceType)))}}function isIntermediateReference(obj){return"object"==typeof obj&&!!obj&&("$ref"in obj||"$error"in obj)}class DefaultJsonSerializer{constructor(services){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=services.shared.workspace.LangiumDocuments,this.astNodeLocator=services.workspace.AstNodeLocator,this.nameProvider=services.references.NameProvider,this.commentProvider=services.documentation.CommentProvider}serialize(node,options){const serializeOptions=options??{},specificReplacer=null==options?void 0:options.replacer,defaultReplacer=(key,value)=>this.replacer(key,value,serializeOptions),replacer=specificReplacer?(key,value)=>specificReplacer(key,value,defaultReplacer):defaultReplacer;try{return this.currentDocument=getDocument(node),JSON.stringify(node,replacer,null==options?void 0:options.space)}finally{this.currentDocument=void 0}}deserialize(content,options){const deserializeOptions=options??{},root=JSON.parse(content);return this.linkNode(root,root,deserializeOptions),root}replacer(key,value,{refText:refText,sourceText:sourceText,textRegions:textRegions,comments:comments,uriConverter:uriConverter}){var _a2,_b2,_c2;if(!this.ignoreProperties.has(key)){if(isReference(value)){const refValue=value.ref,$refText=refText?value.$refText:void 0;if(refValue){const targetDocument=getDocument(refValue);let targetUri="";this.currentDocument&&this.currentDocument!==targetDocument&&(targetUri=uriConverter?uriConverter(targetDocument.uri,refValue):targetDocument.uri.toString());return{$ref:`${targetUri}#${this.astNodeLocator.getAstNodePath(refValue)}`,$refText:$refText}}return{$error:(null==(_a2=value.error)?void 0:_a2.message)??"Could not resolve reference",$refText:$refText}}if(isMultiReference(value)){const $refText=refText?value.$refText:void 0,$refs=[];for(const item of value.items){const refValue=item.ref,targetDocument=getDocument(item.ref);let targetUri="";this.currentDocument&&this.currentDocument!==targetDocument&&(targetUri=uriConverter?uriConverter(targetDocument.uri,refValue):targetDocument.uri.toString());const targetPath=this.astNodeLocator.getAstNodePath(refValue);$refs.push(`${targetUri}#${targetPath}`)}return{$refs:$refs,$refText:$refText}}if(isAstNode(value)){let astNode;if(textRegions&&(astNode=this.addAstNodeRegionWithAssignmentsTo({...value}),key&&!value.$document||!(null==astNode?void 0:astNode.$textRegion)||(astNode.$textRegion.documentURI=null==(_b2=this.currentDocument)?void 0:_b2.uri.toString())),sourceText&&!key&&(astNode??(astNode={...value}),astNode.$sourceText=null==(_c2=value.$cstNode)?void 0:_c2.text),comments){astNode??(astNode={...value});const comment=this.commentProvider.getComment(value);comment&&(astNode.$comment=comment.replace(/\r/g,""))}return astNode??value}return value}}addAstNodeRegionWithAssignmentsTo(node){const createDocumentSegment=cstNode=>({offset:cstNode.offset,end:cstNode.end,length:cstNode.length,range:cstNode.range});if(node.$cstNode){const assignments=(node.$textRegion=createDocumentSegment(node.$cstNode)).assignments={};return Object.keys(node).filter(key=>!key.startsWith("$")).forEach(key=>{const propertyAssignments=function(node,property){return node&&property?findNodesForPropertyInternal(node,property,node.astNode,!0):[]}(node.$cstNode,key).map(createDocumentSegment);0!==propertyAssignments.length&&(assignments[key]=propertyAssignments)}),node}}linkNode(node,root,options,container,containerProperty,containerIndex){for(const[propertyName,item]of Object.entries(node))if(Array.isArray(item))for(let index=0;index<item.length;index++){const element=item[index];isIntermediateReference(element)?item[index]=this.reviveReference(node,propertyName,root,element,options):isAstNode(element)&&this.linkNode(element,root,options,node,propertyName,index)}else isIntermediateReference(item)?node[propertyName]=this.reviveReference(node,propertyName,root,item,options):isAstNode(item)&&this.linkNode(item,root,options,node,propertyName);const mutable=node;mutable.$container=container,mutable.$containerProperty=containerProperty,mutable.$containerIndex=containerIndex}reviveReference(container,property,root,reference,options){let ref,refText=reference.$refText,error=reference.$error;if(reference.$ref){const refNode=this.getRefNode(root,reference.$ref,options.uriConverter);if(isAstNode(refNode))return refText||(refText=this.nameProvider.getName(refNode)),{$refText:refText??"",ref:refNode};error=refNode}else if(reference.$refs){const refs=[];for(const refUri of reference.$refs){const refNode=this.getRefNode(root,refUri,options.uriConverter);isAstNode(refNode)&&refs.push({ref:refNode})}if(0!==refs.length)return{$refText:refText??"",items:refs};ref={$refText:refText??"",items:refs},error??(error="Could not resolve multi-reference")}return error?(ref??(ref={$refText:refText??"",ref:void 0}),ref.error={info:{container:container,property:property,reference:ref},message:error},ref):void 0}getRefNode(root,uri,uriConverter){try{const fragmentIndex=uri.indexOf("#");if(0===fragmentIndex){const node2=this.astNodeLocator.getAstNode(root,uri.substring(1));return node2||"Could not resolve path: "+uri}if(fragmentIndex<0){const documentUri2=uriConverter?uriConverter(uri):URI.parse(uri),document2=this.langiumDocuments.getDocument(documentUri2);return document2?document2.parseResult.value:"Could not find document for URI: "+uri}const documentUri=uriConverter?uriConverter(uri.substring(0,fragmentIndex)):URI.parse(uri.substring(0,fragmentIndex)),document=this.langiumDocuments.getDocument(documentUri);if(!document)return"Could not find document for URI: "+uri;if(fragmentIndex===uri.length-1)return document.parseResult.value;const node=this.astNodeLocator.getAstNode(document.parseResult.value,uri.substring(fragmentIndex+1));return node||"Could not resolve URI: "+uri}catch(err){return String(err)}}}class DefaultServiceRegistry{get map(){return this.fileExtensionMap}constructor(services){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.fileNameMap=new Map,this.textDocuments=null==services?void 0:services.workspace.TextDocuments}register(language){const data=language.LanguageMetaData;for(const ext of data.fileExtensions)this.fileExtensionMap.has(ext)&&console.warn(`The file extension ${ext} is used by multiple languages. It is now assigned to '${data.languageId}'.`),this.fileExtensionMap.set(ext,language);if(data.fileNames)for(const name of data.fileNames)this.fileNameMap.has(name)&&console.warn(`The file name ${name} is used by multiple languages. It is now assigned to '${data.languageId}'.`),this.fileNameMap.set(name,language);this.languageIdMap.set(data.languageId,language)}getServices(uri){var _a2,_b2;if(0===this.languageIdMap.size)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const languageId=null==(_b2=null==(_a2=this.textDocuments)?void 0:_a2.get(uri))?void 0:_b2.languageId;if(void 0!==languageId){const services2=this.languageIdMap.get(languageId);if(services2)return services2}const ext=UriUtils.extname(uri),name=UriUtils.basename(uri),services=this.fileNameMap.get(name)??this.fileExtensionMap.get(ext);if(!services)throw languageId?new Error(`The service registry contains no services for the extension '${ext}' for language '${languageId}'.`):new Error(`The service registry contains no services for the extension '${ext}'.`);return services}hasServices(uri){try{return this.getServices(uri),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}}function diagnosticData(code){return{code:code}}var ValidationCategory,ValidationCategory2;(ValidationCategory2=ValidationCategory||(ValidationCategory={})).defaults=["fast","slow","built-in"],ValidationCategory2.all=ValidationCategory2.defaults;class ValidationRegistry{constructor(services){this.entries=new MultiMap,this.knownCategories=new Set(ValidationCategory.defaults),this.entriesBefore=[],this.entriesAfter=[],this.reflection=services.shared.AstReflection}register(checksRecord,thisObj=this,category="fast"){if("built-in"===category)throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");this.knownCategories.add(category);for(const[type,ch]of Object.entries(checksRecord)){const callbacks=ch;if(Array.isArray(callbacks))for(const check of callbacks){const entry={check:this.wrapValidationException(check,thisObj),category:category};this.addEntry(type,entry)}else if("function"==typeof callbacks){const entry={check:this.wrapValidationException(callbacks,thisObj),category:category};this.addEntry(type,entry)}else assertUnreachable()}}wrapValidationException(check,thisObj){return async(node,accept,cancelToken)=>{await this.handleException(()=>check.call(thisObj,node,accept,cancelToken),"An error occurred during validation",accept,node)}}async handleException(functionality,messageContext,accept,node){try{await functionality()}catch(err){if(isOperationCancelled(err))throw err;console.error(`${messageContext}:`,err),err instanceof Error&&err.stack&&console.error(err.stack);accept("error",`${messageContext}: ${err instanceof Error?err.message:String(err)}`,{node:node})}}addEntry(type,entry){if("AstNode"!==type)for(const subtype of this.reflection.getAllSubTypes(type))this.entries.add(subtype,entry);else this.entries.add("AstNode",entry)}getChecks(type,categories){let checks=stream(this.entries.get(type)).concat(this.entries.get("AstNode"));return categories&&(checks=checks.filter(entry=>categories.includes(entry.category))),checks.map(entry=>entry.check)}registerBeforeDocument(checkBefore,thisObj=this){this.entriesBefore.push(this.wrapPreparationException(checkBefore,"An error occurred during set-up of the validation",thisObj))}registerAfterDocument(checkAfter,thisObj=this){this.entriesAfter.push(this.wrapPreparationException(checkAfter,"An error occurred during tear-down of the validation",thisObj))}wrapPreparationException(check,messageContext,thisObj){return async(rootNode,accept,categories,cancelToken)=>{await this.handleException(()=>check.call(thisObj,rootNode,accept,categories,cancelToken),messageContext,accept,rootNode)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}getAllValidationCategories(_document){return this.knownCategories}}const VALIDATE_EACH_NODE=Object.freeze({validateNode:!0,validateChildren:!0});class DefaultDocumentValidator{constructor(services){this.validationRegistry=services.validation.ValidationRegistry,this.metadata=services.LanguageMetaData,this.profiler=services.shared.profilers.LangiumProfiler,this.languageId=services.LanguageMetaData.languageId}async validateDocument(document,options={},cancelToken=cancellationExports.CancellationToken.None){const parseResult=document.parseResult,diagnostics=[];if(await interruptAndCheck(cancelToken),!options.categories||options.categories.includes("built-in")){if(this.processLexingErrors(parseResult,diagnostics,options),options.stopAfterLexingErrors&&diagnostics.some(d=>{var _a2;return(null==(_a2=d.data)?void 0:_a2.code)===DocumentValidator.LexingError}))return diagnostics;if(this.processParsingErrors(parseResult,diagnostics,options),options.stopAfterParsingErrors&&diagnostics.some(d=>{var _a2;return(null==(_a2=d.data)?void 0:_a2.code)===DocumentValidator.ParsingError}))return diagnostics;if(this.processLinkingErrors(document,diagnostics,options),options.stopAfterLinkingErrors&&diagnostics.some(d=>{var _a2;return(null==(_a2=d.data)?void 0:_a2.code)===DocumentValidator.LinkingError}))return diagnostics}try{diagnostics.push(...await this.validateAst(parseResult.value,options,cancelToken))}catch(err){if(isOperationCancelled(err))throw err;console.error("An error occurred during validation:",err)}return await interruptAndCheck(cancelToken),diagnostics}processLexingErrors(parseResult,diagnostics,_options){var _a2;const lexerDiagnostics=[...parseResult.lexerErrors,...(null==(_a2=parseResult.lexerReport)?void 0:_a2.diagnostics)??[]];for(const lexerDiagnostic of lexerDiagnostics){const severity=lexerDiagnostic.severity??"error",diagnostic={severity:toDiagnosticSeverity(severity),range:{start:{line:lexerDiagnostic.line-1,character:lexerDiagnostic.column-1},end:{line:lexerDiagnostic.line-1,character:lexerDiagnostic.column+lexerDiagnostic.length-1}},message:lexerDiagnostic.message,data:toDiagnosticData(severity),source:this.getSource()};diagnostics.push(diagnostic)}}processParsingErrors(parseResult,diagnostics,_options){for(const parserError of parseResult.parserErrors){let range;if(isNaN(parserError.token.startOffset)){if("previousToken"in parserError){const token=parserError.previousToken;if(isNaN(token.startOffset)){const position={line:0,character:0};range={start:position,end:position}}else{const position={line:token.endLine-1,character:token.endColumn};range={start:position,end:position}}}}else range=tokenToRange(parserError.token);if(range){const diagnostic={severity:toDiagnosticSeverity("error"),range:range,message:parserError.message,data:diagnosticData(DocumentValidator.ParsingError),source:this.getSource()};diagnostics.push(diagnostic)}}}processLinkingErrors(document,diagnostics,_options){var _a2;for(const reference of document.references){const linkingError=reference.error;if(linkingError){const info={node:linkingError.info.container,range:null==(_a2=reference.$refNode)?void 0:_a2.range,property:linkingError.info.property,index:linkingError.info.index,data:{code:DocumentValidator.LinkingError,containerType:linkingError.info.container.$type,property:linkingError.info.property,refText:linkingError.info.reference.$refText}};diagnostics.push(this.toDiagnostic("error",linkingError.message,info))}}}async validateAst(rootNode,options,cancelToken=cancellationExports.CancellationToken.None){const validationItems=[],acceptor=(severity,message,info)=>{validationItems.push(this.toDiagnostic(severity,message,info))};return await this.validateAstBefore(rootNode,options,acceptor,cancelToken),await this.validateAstNodes(rootNode,options,acceptor,cancelToken),await this.validateAstAfter(rootNode,options,acceptor,cancelToken),validationItems}async validateAstBefore(rootNode,options,acceptor,cancelToken=cancellationExports.CancellationToken.None){const checksBefore=this.validationRegistry.checksBefore;for(const checkBefore of checksBefore)await interruptAndCheck(cancelToken),await checkBefore(rootNode,acceptor,options.categories??[],cancelToken)}async validateAstNodes(rootNode,options,acceptor,cancelToken=cancellationExports.CancellationToken.None){var _a2;if(null==(_a2=this.profiler)?void 0:_a2.isActive("validating")){const task=this.profiler.createTask("validating",this.languageId);task.start();try{const nodes=streamAst(rootNode).iterator();for(const node of nodes){task.startSubTask(node.$type);const nodeOptions=this.validateSingleNodeOptions(node,options);if(nodeOptions.validateNode)try{const checks=this.validationRegistry.getChecks(node.$type,options.categories);for(const check of checks)await check(node,acceptor,cancelToken)}finally{task.stopSubTask(node.$type)}nodeOptions.validateChildren||nodes.prune()}}finally{task.stop()}}else{const nodes=streamAst(rootNode).iterator();for(const node of nodes){await interruptAndCheck(cancelToken);const nodeOptions=this.validateSingleNodeOptions(node,options);if(nodeOptions.validateNode){const checks=this.validationRegistry.getChecks(node.$type,options.categories);for(const check of checks)await check(node,acceptor,cancelToken)}nodeOptions.validateChildren||nodes.prune()}}}validateSingleNodeOptions(_node,_options){return VALIDATE_EACH_NODE}async validateAstAfter(rootNode,options,acceptor,cancelToken=cancellationExports.CancellationToken.None){const checksAfter=this.validationRegistry.checksAfter;for(const checkAfter of checksAfter)await interruptAndCheck(cancelToken),await checkAfter(rootNode,acceptor,options.categories??[],cancelToken)}toDiagnostic(severity,message,info){return{message:message,range:getDiagnosticRange(info),severity:toDiagnosticSeverity(severity),code:info.code,codeDescription:info.codeDescription,tags:info.tags,relatedInformation:info.relatedInformation,data:info.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function getDiagnosticRange(info){if(info.range)return info.range;let cstNode;return"string"==typeof info.property?cstNode=findNodeForProperty(info.node.$cstNode,info.property,info.index):"string"==typeof info.keyword&&(cstNode=findNodeForKeyword(info.node.$cstNode,info.keyword,info.index)),cstNode??(cstNode=info.node.$cstNode),cstNode?cstNode.range:{start:{line:0,character:0},end:{line:0,character:0}}}function toDiagnosticSeverity(severity){switch(severity){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+severity)}}function toDiagnosticData(severity){switch(severity){case"error":return diagnosticData(DocumentValidator.LexingError);case"warning":return diagnosticData(DocumentValidator.LexingWarning);case"info":return diagnosticData(DocumentValidator.LexingInfo);case"hint":return diagnosticData(DocumentValidator.LexingHint);default:throw new Error("Invalid diagnostic severity: "+severity)}}var DocumentValidator,DocumentValidator2;(DocumentValidator2=DocumentValidator||(DocumentValidator={})).LexingError="lexing-error",DocumentValidator2.LexingWarning="lexing-warning",DocumentValidator2.LexingInfo="lexing-info",DocumentValidator2.LexingHint="lexing-hint",DocumentValidator2.ParsingError="parsing-error",DocumentValidator2.LinkingError="linking-error";class DefaultAstNodeDescriptionProvider{constructor(services){this.astNodeLocator=services.workspace.AstNodeLocator,this.nameProvider=services.references.NameProvider}createDescription(node,name,document){const doc=document??getDocument(node);name??(name=this.nameProvider.getName(node));const path=this.astNodeLocator.getAstNodePath(node);if(!name)throw new Error(`Node at path ${path} has no name.`);let nameNodeSegment;const nameSegmentGetter=()=>nameNodeSegment??(nameNodeSegment=toDocumentSegment(this.nameProvider.getNameNode(node)??node.$cstNode));return{node:node,name:name,get nameSegment(){return nameSegmentGetter()},selectionSegment:toDocumentSegment(node.$cstNode),type:node.$type,documentUri:doc.uri,path:path}}}class DefaultReferenceDescriptionProvider{constructor(services){this.nodeLocator=services.workspace.AstNodeLocator}async createDescriptions(document,cancelToken=cancellationExports.CancellationToken.None){const descr=[],rootNode=document.parseResult.value;for(const astNode of streamAst(rootNode))await interruptAndCheck(cancelToken),streamReferences(astNode).forEach(refInfo=>{refInfo.reference.error||descr.push(...this.createInfoDescriptions(refInfo))});return descr}createInfoDescriptions(refInfo){const reference=refInfo.reference;if(reference.error||!reference.$refNode)return[];let items=[];isReference(reference)&&reference.$nodeDescription?items=[reference.$nodeDescription]:isMultiReference(reference)&&(items=reference.items.map(e=>e.$nodeDescription).filter(e=>void 0!==e));const sourceUri=getDocument(refInfo.container).uri,sourcePath=this.nodeLocator.getAstNodePath(refInfo.container),descriptions=[],segment=toDocumentSegment(reference.$refNode);for(const item of items)descriptions.push({sourceUri:sourceUri,sourcePath:sourcePath,targetUri:item.documentUri,targetPath:item.path,segment:segment,local:UriUtils.equals(item.documentUri,sourceUri)});return descriptions}}class DefaultAstNodeLocator{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(node){if(node.$container){const containerPath=this.getAstNodePath(node.$container),newSegment=this.getPathSegment(node);return containerPath+this.segmentSeparator+newSegment}return""}getPathSegment({$containerProperty:$containerProperty,$containerIndex:$containerIndex}){if(!$containerProperty)throw new Error("Missing '$containerProperty' in AST node.");return void 0!==$containerIndex?$containerProperty+this.indexSeparator+$containerIndex:$containerProperty}getAstNode(node,path){return path.split(this.segmentSeparator).reduce((previousValue,currentValue)=>{if(!previousValue||0===currentValue.length)return previousValue;const propertyIndex=currentValue.indexOf(this.indexSeparator);if(propertyIndex>0){const property=currentValue.substring(0,propertyIndex),arrayIndex=parseInt(currentValue.substring(propertyIndex+1)),array=previousValue[property];return null==array?void 0:array[arrayIndex]}return previousValue[currentValue]},node)}}var eventsExports=requireEvents();class DefaultConfigurationProvider{constructor(services){this._ready=new Deferred,this.onConfigurationSectionUpdateEmitter=new eventsExports.Emitter,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=services.ServiceRegistry}get ready(){return this._ready.promise}initialize(params){var _a2;this.workspaceConfig=(null==(_a2=params.capabilities.workspace)?void 0:_a2.configuration)??!1}async initialized(params){if(this.workspaceConfig){if(params.register){const languages=this.serviceRegistry.all;params.register({section:languages.map(lang=>this.toSectionName(lang.LanguageMetaData.languageId))})}if(params.fetchConfiguration){const configToUpdate=this.serviceRegistry.all.map(lang=>({section:this.toSectionName(lang.LanguageMetaData.languageId)})),configs=await params.fetchConfiguration(configToUpdate);configToUpdate.forEach((conf,idx)=>{this.updateSectionConfiguration(conf.section,configs[idx])})}}this._ready.resolve()}updateConfiguration(change){"object"==typeof change.settings&&null!==change.settings&&Object.entries(change.settings).forEach(([section,configuration])=>{this.updateSectionConfiguration(section,configuration),this.onConfigurationSectionUpdateEmitter.fire({section:section,configuration:configuration})})}updateSectionConfiguration(section,configuration){this.settings[section]=configuration}async getConfiguration(language,configuration){await this.ready;const sectionName=this.toSectionName(language);if(this.settings[sectionName])return this.settings[sectionName][configuration]}toSectionName(languageId){return`${languageId}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}}var hasRequiredMessages$1,main$1={},main={},ril={},api$1={},messages$1={};function requireMessages$1(){if(hasRequiredMessages$1)return messages$1;hasRequiredMessages$1=1,Object.defineProperty(messages$1,"__esModule",{value:!0}),messages$1.Message=messages$1.NotificationType9=messages$1.NotificationType8=messages$1.NotificationType7=messages$1.NotificationType6=messages$1.NotificationType5=messages$1.NotificationType4=messages$1.NotificationType3=messages$1.NotificationType2=messages$1.NotificationType1=messages$1.NotificationType0=messages$1.NotificationType=messages$1.RequestType9=messages$1.RequestType8=messages$1.RequestType7=messages$1.RequestType6=messages$1.RequestType5=messages$1.RequestType4=messages$1.RequestType3=messages$1.RequestType2=messages$1.RequestType1=messages$1.RequestType=messages$1.RequestType0=messages$1.AbstractMessageSignature=messages$1.ParameterStructures=messages$1.ResponseError=messages$1.ErrorCodes=void 0;const is2=requireIs$1();var ErrorCodes,ErrorCodes2,Message,Message2;(ErrorCodes2=ErrorCodes||(messages$1.ErrorCodes=ErrorCodes={})).ParseError=-32700,ErrorCodes2.InvalidRequest=-32600,ErrorCodes2.MethodNotFound=-32601,ErrorCodes2.InvalidParams=-32602,ErrorCodes2.InternalError=-32603,ErrorCodes2.jsonrpcReservedErrorRangeStart=-32099,ErrorCodes2.serverErrorStart=-32099,ErrorCodes2.MessageWriteError=-32099,ErrorCodes2.MessageReadError=-32098,ErrorCodes2.PendingResponseRejected=-32097,ErrorCodes2.ConnectionInactive=-32096,ErrorCodes2.ServerNotInitialized=-32002,ErrorCodes2.UnknownErrorCode=-32001,ErrorCodes2.jsonrpcReservedErrorRangeEnd=-32e3,ErrorCodes2.serverErrorEnd=-32e3;class ResponseError extends Error{constructor(code,message,data){super(message),this.code=is2.number(code)?code:ErrorCodes.UnknownErrorCode,this.data=data,Object.setPrototypeOf(this,ResponseError.prototype)}toJson(){const result={code:this.code,message:this.message};return void 0!==this.data&&(result.data=this.data),result}}messages$1.ResponseError=ResponseError;class ParameterStructures{constructor(kind){this.kind=kind}static is(value){return value===ParameterStructures.auto||value===ParameterStructures.byName||value===ParameterStructures.byPosition}toString(){return this.kind}}messages$1.ParameterStructures=ParameterStructures,ParameterStructures.auto=new ParameterStructures("auto"),ParameterStructures.byPosition=new ParameterStructures("byPosition"),ParameterStructures.byName=new ParameterStructures("byName");class AbstractMessageSignature{constructor(method,numberOfParams){this.method=method,this.numberOfParams=numberOfParams}get parameterStructures(){return ParameterStructures.auto}}messages$1.AbstractMessageSignature=AbstractMessageSignature;messages$1.RequestType0=class extends AbstractMessageSignature{constructor(method){super(method,0)}};messages$1.RequestType=class extends AbstractMessageSignature{constructor(method,_parameterStructures=ParameterStructures.auto){super(method,1),this._parameterStructures=_parameterStructures}get parameterStructures(){return this._parameterStructures}};messages$1.RequestType1=class extends AbstractMessageSignature{constructor(method,_parameterStructures=ParameterStructures.auto){super(method,1),this._parameterStructures=_parameterStructures}get parameterStructures(){return this._parameterStructures}};messages$1.RequestType2=class extends AbstractMessageSignature{constructor(method){super(method,2)}};messages$1.RequestType3=class extends AbstractMessageSignature{constructor(method){super(method,3)}};messages$1.RequestType4=class extends AbstractMessageSignature{constructor(method){super(method,4)}};messages$1.RequestType5=class extends AbstractMessageSignature{constructor(method){super(method,5)}};messages$1.RequestType6=class extends AbstractMessageSignature{constructor(method){super(method,6)}};messages$1.RequestType7=class extends AbstractMessageSignature{constructor(method){super(method,7)}};messages$1.RequestType8=class extends AbstractMessageSignature{constructor(method){super(method,8)}};messages$1.RequestType9=class extends AbstractMessageSignature{constructor(method){super(method,9)}};messages$1.NotificationType=class extends AbstractMessageSignature{constructor(method,_parameterStructures=ParameterStructures.auto){super(method,1),this._parameterStructures=_parameterStructures}get parameterStructures(){return this._parameterStructures}};messages$1.NotificationType0=class extends AbstractMessageSignature{constructor(method){super(method,0)}};messages$1.NotificationType1=class extends AbstractMessageSignature{constructor(method,_parameterStructures=ParameterStructures.auto){super(method,1),this._parameterStructures=_parameterStructures}get parameterStructures(){return this._parameterStructures}};messages$1.NotificationType2=class extends AbstractMessageSignature{constructor(method){super(method,2)}};messages$1.NotificationType3=class extends AbstractMessageSignature{constructor(method){super(method,3)}};messages$1.NotificationType4=class extends AbstractMessageSignature{constructor(method){super(method,4)}};messages$1.NotificationType5=class extends AbstractMessageSignature{constructor(method){super(method,5)}};messages$1.NotificationType6=class extends AbstractMessageSignature{constructor(method){super(method,6)}};messages$1.NotificationType7=class extends AbstractMessageSignature{constructor(method){super(method,7)}};messages$1.NotificationType8=class extends AbstractMessageSignature{constructor(method){super(method,8)}};return messages$1.NotificationType9=class extends AbstractMessageSignature{constructor(method){super(method,9)}},(Message2=Message||(messages$1.Message=Message={})).isRequest=function(message){const candidate=message;return candidate&&is2.string(candidate.method)&&(is2.string(candidate.id)||is2.number(candidate.id))},Message2.isNotification=function(message){const candidate=message;return candidate&&is2.string(candidate.method)&&void 0===message.id},Message2.isResponse=function(message){const candidate=message;return candidate&&(void 0!==candidate.result||!!candidate.error)&&(is2.string(candidate.id)||is2.number(candidate.id)||null===candidate.id)},messages$1}var hasRequiredLinkedMap,linkedMap={};function requireLinkedMap(){if(hasRequiredLinkedMap)return linkedMap;var _a2,Touch,Touch2;hasRequiredLinkedMap=1,Object.defineProperty(linkedMap,"__esModule",{value:!0}),linkedMap.LRUCache=linkedMap.LinkedMap=linkedMap.Touch=void 0,(Touch2=Touch||(linkedMap.Touch=Touch={})).None=0,Touch2.First=1,Touch2.AsOld=Touch2.First,Touch2.Last=2,Touch2.AsNew=Touch2.Last;class LinkedMap{constructor(){this[_a2]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var _a3;return null==(_a3=this._head)?void 0:_a3.value}get last(){var _a3;return null==(_a3=this._tail)?void 0:_a3.value}has(key){return this._map.has(key)}get(key,touch=Touch.None){const item=this._map.get(key);if(item)return touch!==Touch.None&&this.touch(item,touch),item.value}set(key,value,touch=Touch.None){let item=this._map.get(key);if(item)item.value=value,touch!==Touch.None&&this.touch(item,touch);else{switch(item={key:key,value:value,next:void 0,previous:void 0},touch){case Touch.None:this.addItemLast(item);break;case Touch.First:this.addItemFirst(item);break;case Touch.Last:default:this.addItemLast(item)}this._map.set(key,item),this._size++}return this}delete(key){return!!this.remove(key)}remove(key){const item=this._map.get(key);if(item)return this._map.delete(key),this.removeItem(item),this._size--,item.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const item=this._head;return this._map.delete(item.key),this.removeItem(item),this._size--,item.value}forEach(callbackfn,thisArg){const state=this._state;let current=this._head;for(;current;){if(thisArg?callbackfn.bind(thisArg)(current.value,current.key,this):callbackfn(current.value,current.key,this),this._state!==state)throw new Error("LinkedMap got modified during iteration.");current=current.next}}keys(){const state=this._state;let current=this._head;const iterator={[Symbol.iterator]:()=>iterator,next:()=>{if(this._state!==state)throw new Error("LinkedMap got modified during iteration.");if(current){const result={value:current.key,done:!1};return current=current.next,result}return{value:void 0,done:!0}}};return iterator}values(){const state=this._state;let current=this._head;const iterator={[Symbol.iterator]:()=>iterator,next:()=>{if(this._state!==state)throw new Error("LinkedMap got modified during iteration.");if(current){const result={value:current.value,done:!1};return current=current.next,result}return{value:void 0,done:!0}}};return iterator}entries(){const state=this._state;let current=this._head;const iterator={[Symbol.iterator]:()=>iterator,next:()=>{if(this._state!==state)throw new Error("LinkedMap got modified during iteration.");if(current){const result={value:[current.key,current.value],done:!1};return current=current.next,result}return{value:void 0,done:!0}}};return iterator}[(_a2=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(newSize){if(newSize>=this.size)return;if(0===newSize)return void this.clear();let current=this._head,currentSize=this.size;for(;current&&currentSize>newSize;)this._map.delete(current.key),current=current.next,currentSize--;this._head=current,this._size=currentSize,current&&(current.previous=void 0),this._state++}addItemFirst(item){if(this._head||this._tail){if(!this._head)throw new Error("Invalid list");item.next=this._head,this._head.previous=item}else this._tail=item;this._head=item,this._state++}addItemLast(item){if(this._head||this._tail){if(!this._tail)throw new Error("Invalid list");item.previous=this._tail,this._tail.next=item}else this._head=item;this._tail=item,this._state++}removeItem(item){if(item===this._head&&item===this._tail)this._head=void 0,this._tail=void 0;else if(item===this._head){if(!item.next)throw new Error("Invalid list");item.next.previous=void 0,this._head=item.next}else if(item===this._tail){if(!item.previous)throw new Error("Invalid list");item.previous.next=void 0,this._tail=item.previous}else{const next=item.next,previous=item.previous;if(!next||!previous)throw new Error("Invalid list");next.previous=previous,previous.next=next}item.next=void 0,item.previous=void 0,this._state++}touch(item,touch){if(!this._head||!this._tail)throw new Error("Invalid list");if(touch===Touch.First||touch===Touch.Last)if(touch===Touch.First){if(item===this._head)return;const next=item.next,previous=item.previous;item===this._tail?(previous.next=void 0,this._tail=previous):(next.previous=previous,previous.next=next),item.previous=void 0,item.next=this._head,this._head.previous=item,this._head=item,this._state++}else if(touch===Touch.Last){if(item===this._tail)return;const next=item.next,previous=item.previous;item===this._head?(next.previous=void 0,this._head=next):(next.previous=previous,previous.next=next),item.next=void 0,item.previous=this._tail,this._tail.next=item,this._tail=item,this._state++}}toJSON(){const data=[];return this.forEach((value,key)=>{data.push([key,value])}),data}fromJSON(data){this.clear();for(const[key,value]of data)this.set(key,value)}}linkedMap.LinkedMap=LinkedMap;return linkedMap.LRUCache=class extends LinkedMap{constructor(limit,ratio=1){super(),this._limit=limit,this._ratio=Math.min(Math.max(0,ratio),1)}get limit(){return this._limit}set limit(limit){this._limit=limit,this.checkTrim()}get ratio(){return this._ratio}set ratio(ratio){this._ratio=Math.min(Math.max(0,ratio),1),this.checkTrim()}get(key,touch=Touch.AsNew){return super.get(key,touch)}peek(key){return super.get(key,Touch.None)}set(key,value){return super.set(key,value,Touch.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}},linkedMap}var hasRequiredDisposable,disposable={};var hasRequiredSharedArrayCancellation,sharedArrayCancellation={};var hasRequiredSemaphore,hasRequiredMessageReader,messageReader={},semaphore={};function requireSemaphore(){if(hasRequiredSemaphore)return semaphore;hasRequiredSemaphore=1,Object.defineProperty(semaphore,"__esModule",{value:!0}),semaphore.Semaphore=void 0;const ral_1=requireRal();return semaphore.Semaphore=class{constructor(capacity=1){if(capacity<=0)throw new Error("Capacity must be greater than 0");this._capacity=capacity,this._active=0,this._waiting=[]}lock(thunk){return new Promise((resolve,reject)=>{this._waiting.push({thunk:thunk,resolve:resolve,reject:reject}),this.runNext()})}get active(){return this._active}runNext(){0!==this._waiting.length&&this._active!==this._capacity&&(0,ral_1.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(0===this._waiting.length||this._active===this._capacity)return;const next=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const result=next.thunk();result instanceof Promise?result.then(value=>{this._active--,next.resolve(value),this.runNext()},err=>{this._active--,next.reject(err),this.runNext()}):(this._active--,next.resolve(result),this.runNext())}catch(err){this._active--,next.reject(err),this.runNext()}}},semaphore}var hasRequiredMessageWriter,messageWriter={};var hasRequiredMessageBuffer,messageBuffer={};var hasRequiredConnection$1,hasRequiredApi$1,hasRequiredRil,hasRequiredMain$1,browser,hasRequiredBrowser,connection$1={};function requireConnection$1(){return hasRequiredConnection$1||(hasRequiredConnection$1=1,function(exports$1){Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.createMessageConnection=exports$1.ConnectionOptions=exports$1.MessageStrategy=exports$1.CancellationStrategy=exports$1.CancellationSenderStrategy=exports$1.CancellationReceiverStrategy=exports$1.RequestCancellationReceiverStrategy=exports$1.IdCancellationReceiverStrategy=exports$1.ConnectionStrategy=exports$1.ConnectionError=exports$1.ConnectionErrors=exports$1.LogTraceNotification=exports$1.SetTraceNotification=exports$1.TraceFormat=exports$1.TraceValues=exports$1.Trace=exports$1.NullLogger=exports$1.ProgressType=exports$1.ProgressToken=void 0;const ral_1=requireRal(),Is2=requireIs$1(),messages_1=requireMessages$1(),linkedMap_1=requireLinkedMap(),events_1=requireEvents(),cancellation_1=requireCancellation();var CancelNotification,ProgressToken,ProgressNotification,StarRequestHandler,Trace,Trace2,TraceValues,TraceValues2,TraceFormat,TraceFormat2,SetTraceNotification,LogTraceNotification,ConnectionErrors,ConnectionErrors2,ConnectionStrategy,IdCancellationReceiverStrategy,RequestCancellationReceiverStrategy,CancellationReceiverStrategy,CancellationReceiverStrategy2,CancellationSenderStrategy,CancellationSenderStrategy2,CancellationStrategy,CancellationStrategy2,MessageStrategy,ConnectionOptions,ConnectionState,ConnectionState2;(CancelNotification||(CancelNotification={})).type=new messages_1.NotificationType("$/cancelRequest"),(ProgressToken||(exports$1.ProgressToken=ProgressToken={})).is=function(value){return"string"==typeof value||"number"==typeof value},(ProgressNotification||(ProgressNotification={})).type=new messages_1.NotificationType("$/progress");exports$1.ProgressType=class{constructor(){}},(StarRequestHandler||(StarRequestHandler={})).is=function(value){return Is2.func(value)},exports$1.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}}),(Trace2=Trace||(exports$1.Trace=Trace={}))[Trace2.Off=0]="Off",Trace2[Trace2.Messages=1]="Messages",Trace2[Trace2.Compact=2]="Compact",Trace2[Trace2.Verbose=3]="Verbose",(TraceValues2=TraceValues||(exports$1.TraceValues=TraceValues={})).Off="off",TraceValues2.Messages="messages",TraceValues2.Compact="compact",TraceValues2.Verbose="verbose",function(Trace2){Trace2.fromString=function(value){if(!Is2.string(value))return Trace2.Off;switch(value=value.toLowerCase()){case"off":default:return Trace2.Off;case"messages":return Trace2.Messages;case"compact":return Trace2.Compact;case"verbose":return Trace2.Verbose}},Trace2.toString=function(value){switch(value){case Trace2.Off:return"off";case Trace2.Messages:return"messages";case Trace2.Compact:return"compact";case Trace2.Verbose:return"verbose";default:return"off"}}}(Trace||(exports$1.Trace=Trace={})),(TraceFormat2=TraceFormat||(exports$1.TraceFormat=TraceFormat={})).Text="text",TraceFormat2.JSON="json",function(TraceFormat2){TraceFormat2.fromString=function(value){return Is2.string(value)&&"json"===(value=value.toLowerCase())?TraceFormat2.JSON:TraceFormat2.Text}}(TraceFormat||(exports$1.TraceFormat=TraceFormat={})),(SetTraceNotification||(exports$1.SetTraceNotification=SetTraceNotification={})).type=new messages_1.NotificationType("$/setTrace"),(LogTraceNotification||(exports$1.LogTraceNotification=LogTraceNotification={})).type=new messages_1.NotificationType("$/logTrace"),(ConnectionErrors2=ConnectionErrors||(exports$1.ConnectionErrors=ConnectionErrors={}))[ConnectionErrors2.Closed=1]="Closed",ConnectionErrors2[ConnectionErrors2.Disposed=2]="Disposed",ConnectionErrors2[ConnectionErrors2.AlreadyListening=3]="AlreadyListening";class ConnectionError extends Error{constructor(code,message){super(message),this.code=code,Object.setPrototypeOf(this,ConnectionError.prototype)}}exports$1.ConnectionError=ConnectionError,(ConnectionStrategy||(exports$1.ConnectionStrategy=ConnectionStrategy={})).is=function(value){const candidate=value;return candidate&&Is2.func(candidate.cancelUndispatched)},(IdCancellationReceiverStrategy||(exports$1.IdCancellationReceiverStrategy=IdCancellationReceiverStrategy={})).is=function(value){const candidate=value;return candidate&&(void 0===candidate.kind||"id"===candidate.kind)&&Is2.func(candidate.createCancellationTokenSource)&&(void 0===candidate.dispose||Is2.func(candidate.dispose))},(RequestCancellationReceiverStrategy||(exports$1.RequestCancellationReceiverStrategy=RequestCancellationReceiverStrategy={})).is=function(value){const candidate=value;return candidate&&"request"===candidate.kind&&Is2.func(candidate.createCancellationTokenSource)&&(void 0===candidate.dispose||Is2.func(candidate.dispose))},(CancellationReceiverStrategy2=CancellationReceiverStrategy||(exports$1.CancellationReceiverStrategy=CancellationReceiverStrategy={})).Message=Object.freeze({createCancellationTokenSource:_=>new cancellation_1.CancellationTokenSource}),CancellationReceiverStrategy2.is=function(value){return IdCancellationReceiverStrategy.is(value)||RequestCancellationReceiverStrategy.is(value)},(CancellationSenderStrategy2=CancellationSenderStrategy||(exports$1.CancellationSenderStrategy=CancellationSenderStrategy={})).Message=Object.freeze({sendCancellation:(conn,id)=>conn.sendNotification(CancelNotification.type,{id:id}),cleanup(_){}}),CancellationSenderStrategy2.is=function(value){const candidate=value;return candidate&&Is2.func(candidate.sendCancellation)&&Is2.func(candidate.cleanup)},(CancellationStrategy2=CancellationStrategy||(exports$1.CancellationStrategy=CancellationStrategy={})).Message=Object.freeze({receiver:CancellationReceiverStrategy.Message,sender:CancellationSenderStrategy.Message}),CancellationStrategy2.is=function(value){const candidate=value;return candidate&&CancellationReceiverStrategy.is(candidate.receiver)&&CancellationSenderStrategy.is(candidate.sender)},(MessageStrategy||(exports$1.MessageStrategy=MessageStrategy={})).is=function(value){const candidate=value;return candidate&&Is2.func(candidate.handleMessage)},(ConnectionOptions||(exports$1.ConnectionOptions=ConnectionOptions={})).is=function(value){const candidate=value;return candidate&&(CancellationStrategy.is(candidate.cancellationStrategy)||ConnectionStrategy.is(candidate.connectionStrategy)||MessageStrategy.is(candidate.messageStrategy))},(ConnectionState2=ConnectionState||(ConnectionState={}))[ConnectionState2.New=1]="New",ConnectionState2[ConnectionState2.Listening=2]="Listening",ConnectionState2[ConnectionState2.Closed=3]="Closed",ConnectionState2[ConnectionState2.Disposed=4]="Disposed",exports$1.createMessageConnection=function(messageReader2,messageWriter2,_logger,options){const logger=void 0!==_logger?_logger:exports$1.NullLogger;let starRequestHandler,sequenceNumber=0,notificationSequenceNumber=0,unknownResponseSequenceNumber=0;const requestHandlers=new Map;let starNotificationHandler;const notificationHandlers=new Map,progressHandlers=new Map;let timer2,tracer,messageQueue=new linkedMap_1.LinkedMap,responsePromises=new Map,knownCanceledRequests=new Set,requestTokens=new Map,trace=Trace.Off,traceFormat=TraceFormat.Text,state=ConnectionState.New;const errorEmitter=new events_1.Emitter,closeEmitter=new events_1.Emitter,unhandledNotificationEmitter=new events_1.Emitter,unhandledProgressEmitter=new events_1.Emitter,disposeEmitter=new events_1.Emitter,cancellationStrategy=options&&options.cancellationStrategy?options.cancellationStrategy:CancellationStrategy.Message;function createRequestQueueKey(id){if(null===id)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+id.toString()}function addMessageToQueue(queue,message){var id;messages_1.Message.isRequest(message)?queue.set(createRequestQueueKey(message.id),message):messages_1.Message.isResponse(message)?queue.set(null===(id=message.id)?"res-unknown-"+(++unknownResponseSequenceNumber).toString():"res-"+id.toString(),message):queue.set("not-"+(++notificationSequenceNumber).toString(),message)}function cancelUndispatched(_message){}function isListening(){return state===ConnectionState.Listening}function isClosed(){return state===ConnectionState.Closed}function isDisposed(){return state===ConnectionState.Disposed}function closeHandler(){state!==ConnectionState.New&&state!==ConnectionState.Listening||(state=ConnectionState.Closed,closeEmitter.fire(void 0))}function triggerMessageQueue(){timer2||0===messageQueue.size||(timer2=(0,ral_1.default)().timer.setImmediate(()=>{timer2=void 0,function(){if(0===messageQueue.size)return;const message=messageQueue.shift();try{const messageStrategy=null==options?void 0:options.messageStrategy;MessageStrategy.is(messageStrategy)?messageStrategy.handleMessage(message,handleMessage):handleMessage(message)}finally{triggerMessageQueue()}}()}))}function handleMessage(message){messages_1.Message.isRequest(message)?function(requestMessage){if(isDisposed())return;function reply(resultOrError,method,startTime2){const message={jsonrpc:"2.0",id:requestMessage.id};resultOrError instanceof messages_1.ResponseError?message.error=resultOrError.toJson():message.result=void 0===resultOrError?null:resultOrError,traceSendingResponse(message,method,startTime2),messageWriter2.write(message).catch(()=>logger.error("Sending response failed."))}function replyError(error,method,startTime2){const message={jsonrpc:"2.0",id:requestMessage.id,error:error.toJson()};traceSendingResponse(message,method,startTime2),messageWriter2.write(message).catch(()=>logger.error("Sending response failed."))}function replySuccess(result,method,startTime2){void 0===result&&(result=null);const message={jsonrpc:"2.0",id:requestMessage.id,result:result};traceSendingResponse(message,method,startTime2),messageWriter2.write(message).catch(()=>logger.error("Sending response failed."))}!function(message){if(trace===Trace.Off||!tracer)return;if(traceFormat===TraceFormat.Text){let data;trace!==Trace.Verbose&&trace!==Trace.Compact||!message.params||(data=`Params: ${stringifyTrace(message.params)}\n\n`),tracer.log(`Received request '${message.method} - (${message.id})'.`,data)}else logLSPMessage("receive-request",message)}(requestMessage);const element=requestHandlers.get(requestMessage.method);let type,requestHandler;element&&(type=element.type,requestHandler=element.handler);const startTime=Date.now();if(requestHandler||starRequestHandler){const tokenKey=requestMessage.id??String(Date.now()),cancellationSource=IdCancellationReceiverStrategy.is(cancellationStrategy.receiver)?cancellationStrategy.receiver.createCancellationTokenSource(tokenKey):cancellationStrategy.receiver.createCancellationTokenSource(requestMessage);null!==requestMessage.id&&knownCanceledRequests.has(requestMessage.id)&&cancellationSource.cancel(),null!==requestMessage.id&&requestTokens.set(tokenKey,cancellationSource);try{let handlerResult;if(requestHandler)if(void 0===requestMessage.params){if(void 0!==type&&0!==type.numberOfParams)return void replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams,`Request ${requestMessage.method} defines ${type.numberOfParams} params but received none.`),requestMessage.method,startTime);handlerResult=requestHandler(cancellationSource.token)}else if(Array.isArray(requestMessage.params)){if(void 0!==type&&type.parameterStructures===messages_1.ParameterStructures.byName)return void replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams,`Request ${requestMessage.method} defines parameters by name but received parameters by position`),requestMessage.method,startTime);handlerResult=requestHandler(...requestMessage.params,cancellationSource.token)}else{if(void 0!==type&&type.parameterStructures===messages_1.ParameterStructures.byPosition)return void replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams,`Request ${requestMessage.method} defines parameters by position but received parameters by name`),requestMessage.method,startTime);handlerResult=requestHandler(requestMessage.params,cancellationSource.token)}else starRequestHandler&&(handlerResult=starRequestHandler(requestMessage.method,requestMessage.params,cancellationSource.token));const promise=handlerResult;handlerResult?promise.then?promise.then(resultOrError=>{requestTokens.delete(tokenKey),reply(resultOrError,requestMessage.method,startTime)},error=>{requestTokens.delete(tokenKey),error instanceof messages_1.ResponseError?replyError(error,requestMessage.method,startTime):error&&Is2.string(error.message)?replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError,`Request ${requestMessage.method} failed with message: ${error.message}`),requestMessage.method,startTime):replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError,`Request ${requestMessage.method} failed unexpectedly without providing any details.`),requestMessage.method,startTime)}):(requestTokens.delete(tokenKey),reply(handlerResult,requestMessage.method,startTime)):(requestTokens.delete(tokenKey),replySuccess(handlerResult,requestMessage.method,startTime))}catch(error){requestTokens.delete(tokenKey),error instanceof messages_1.ResponseError?reply(error,requestMessage.method,startTime):error&&Is2.string(error.message)?replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError,`Request ${requestMessage.method} failed with message: ${error.message}`),requestMessage.method,startTime):replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError,`Request ${requestMessage.method} failed unexpectedly without providing any details.`),requestMessage.method,startTime)}}else replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound,`Unhandled method ${requestMessage.method}`),requestMessage.method,startTime)}(message):messages_1.Message.isNotification(message)?function(message){if(isDisposed())return;let type,notificationHandler;if(message.method===CancelNotification.type.method){const cancelId=message.params.id;return knownCanceledRequests.delete(cancelId),void traceReceivedNotification(message)}{const element=notificationHandlers.get(message.method);element&&(notificationHandler=element.handler,type=element.type)}if(notificationHandler||starNotificationHandler)try{if(traceReceivedNotification(message),notificationHandler)if(void 0===message.params)void 0!==type&&0!==type.numberOfParams&&type.parameterStructures!==messages_1.ParameterStructures.byName&&logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received none.`),notificationHandler();else if(Array.isArray(message.params)){const params=message.params;message.method===ProgressNotification.type.method&&2===params.length&&ProgressToken.is(params[0])?notificationHandler({token:params[0],value:params[1]}):(void 0!==type&&(type.parameterStructures===messages_1.ParameterStructures.byName&&logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`),type.numberOfParams!==message.params.length&&logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${params.length} arguments`)),notificationHandler(...params))}else void 0!==type&&type.parameterStructures===messages_1.ParameterStructures.byPosition&&logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`),notificationHandler(message.params);else starNotificationHandler&&starNotificationHandler(message.method,message.params)}catch(error){error.message?logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`):logger.error(`Notification handler '${message.method}' failed unexpectedly.`)}else unhandledNotificationEmitter.fire(message)}(message):messages_1.Message.isResponse(message)?function(responseMessage){if(isDisposed())return;if(null===responseMessage.id)responseMessage.error?logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error,void 0,4)}`):logger.error("Received response message without id. No further error information provided.");else{const key=responseMessage.id,responsePromise=responsePromises.get(key);if(function(message,responsePromise){if(trace===Trace.Off||!tracer)return;if(traceFormat===TraceFormat.Text){let data;if(trace!==Trace.Verbose&&trace!==Trace.Compact||(message.error&&message.error.data?data=`Error data: ${stringifyTrace(message.error.data)}\n\n`:message.result?data=`Result: ${stringifyTrace(message.result)}\n\n`:void 0===message.error&&(data="No result returned.\n\n")),responsePromise){const error=message.error?` Request failed: ${message.error.message} (${message.error.code}).`:"";tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now()-responsePromise.timerStart}ms.${error}`,data)}else tracer.log(`Received response ${message.id} without active response promise.`,data)}else logLSPMessage("receive-response",message)}(responseMessage,responsePromise),void 0!==responsePromise){responsePromises.delete(key);try{if(responseMessage.error){const error=responseMessage.error;responsePromise.reject(new messages_1.ResponseError(error.code,error.message,error.data))}else{if(void 0===responseMessage.result)throw new Error("Should never happen.");responsePromise.resolve(responseMessage.result)}}catch(error){error.message?logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`):logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`)}}}}(message):function(message){if(!message)return void logger.error("Received empty message.");logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message,null,4)}`);const responseMessage=message;if(Is2.string(responseMessage.id)||Is2.number(responseMessage.id)){const key=responseMessage.id,responseHandler=responsePromises.get(key);responseHandler&&responseHandler.reject(new Error("The received response has neither a result nor an error property."))}}(message)}messageReader2.onClose(closeHandler),messageReader2.onError(function(error){errorEmitter.fire([error,void 0,void 0])}),messageWriter2.onClose(closeHandler),messageWriter2.onError(function(data){errorEmitter.fire(data)});const callback=message=>{try{if(messages_1.Message.isNotification(message)&&message.method===CancelNotification.type.method){const cancelId=message.params.id,key=createRequestQueueKey(cancelId),toCancel=messageQueue.get(key);if(messages_1.Message.isRequest(toCancel)){const strategy=null==options?void 0:options.connectionStrategy,response=strategy&&strategy.cancelUndispatched?strategy.cancelUndispatched(toCancel,cancelUndispatched):void 0;if(response&&(void 0!==response.error||void 0!==response.result))return messageQueue.delete(key),requestTokens.delete(cancelId),response.id=toCancel.id,traceSendingResponse(response,message.method,Date.now()),void messageWriter2.write(response).catch(()=>logger.error("Sending response for canceled message failed."))}const cancellationToken=requestTokens.get(cancelId);if(void 0!==cancellationToken)return cancellationToken.cancel(),void traceReceivedNotification(message);knownCanceledRequests.add(cancelId)}addMessageToQueue(messageQueue,message)}finally{triggerMessageQueue()}};function stringifyTrace(params){if(null!=params)switch(trace){case Trace.Verbose:return JSON.stringify(params,null,4);case Trace.Compact:return JSON.stringify(params);default:return}}function traceSendingResponse(message,method,startTime){if(trace!==Trace.Off&&tracer)if(traceFormat===TraceFormat.Text){let data;trace!==Trace.Verbose&&trace!==Trace.Compact||(message.error&&message.error.data?data=`Error data: ${stringifyTrace(message.error.data)}\n\n`:message.result?data=`Result: ${stringifyTrace(message.result)}\n\n`:void 0===message.error&&(data="No result returned.\n\n")),tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now()-startTime}ms`,data)}else logLSPMessage("send-response",message)}function traceReceivedNotification(message){if(trace!==Trace.Off&&tracer&&message.method!==LogTraceNotification.type.method)if(traceFormat===TraceFormat.Text){let data;trace!==Trace.Verbose&&trace!==Trace.Compact||(data=message.params?`Params: ${stringifyTrace(message.params)}\n\n`:"No parameters provided.\n\n"),tracer.log(`Received notification '${message.method}'.`,data)}else logLSPMessage("receive-notification",message)}function logLSPMessage(type,message){if(!tracer||trace===Trace.Off)return;const lspMessage={isLSPMessage:!0,type:type,message:message,timestamp:Date.now()};tracer.log(lspMessage)}function throwIfClosedOrDisposed(){if(isClosed())throw new ConnectionError(ConnectionErrors.Closed,"Connection is closed.");if(isDisposed())throw new ConnectionError(ConnectionErrors.Disposed,"Connection is disposed.")}function undefinedToNull(param){return void 0===param?null:param}function nullToUndefined(param){return null===param?void 0:param}function isNamedParam(param){return null!=param&&!Array.isArray(param)&&"object"==typeof param}function computeSingleParam(parameterStructures,param){switch(parameterStructures){case messages_1.ParameterStructures.auto:return isNamedParam(param)?nullToUndefined(param):[undefinedToNull(param)];case messages_1.ParameterStructures.byName:if(!isNamedParam(param))throw new Error("Received parameters by name but param is not an object literal.");return nullToUndefined(param);case messages_1.ParameterStructures.byPosition:return[undefinedToNull(param)];default:throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`)}}function computeMessageParams(type,params){let result;const numberOfParams=type.numberOfParams;switch(numberOfParams){case 0:result=void 0;break;case 1:result=computeSingleParam(type.parameterStructures,params[0]);break;default:result=[];for(let i=0;i<params.length&&i<numberOfParams;i++)result.push(undefinedToNull(params[i]));if(params.length<numberOfParams)for(let i=params.length;i<numberOfParams;i++)result.push(null)}return result}const connection2={sendNotification:(type,...args)=>{let method,messageParams;if(throwIfClosedOrDisposed(),Is2.string(type)){method=type;const first2=args[0];let paramStart=0,parameterStructures=messages_1.ParameterStructures.auto;messages_1.ParameterStructures.is(first2)&&(paramStart=1,parameterStructures=first2);let paramEnd=args.length;const numberOfParams=paramEnd-paramStart;switch(numberOfParams){case 0:messageParams=void 0;break;case 1:messageParams=computeSingleParam(parameterStructures,args[paramStart]);break;default:if(parameterStructures===messages_1.ParameterStructures.byName)throw new Error(`Received ${numberOfParams} parameters for 'by Name' notification parameter structure.`);messageParams=args.slice(paramStart,paramEnd).map(value=>undefinedToNull(value))}}else{const params=args;method=type.method,messageParams=computeMessageParams(type,params)}const notificationMessage={jsonrpc:"2.0",method:method,params:messageParams};return function(message){if(trace!==Trace.Off&&tracer)if(traceFormat===TraceFormat.Text){let data;trace!==Trace.Verbose&&trace!==Trace.Compact||(data=message.params?`Params: ${stringifyTrace(message.params)}\n\n`:"No parameters provided.\n\n"),tracer.log(`Sending notification '${message.method}'.`,data)}else logLSPMessage("send-notification",message)}(notificationMessage),messageWriter2.write(notificationMessage).catch(error=>{throw logger.error("Sending notification failed."),error})},onNotification:(type,handler)=>{let method;return throwIfClosedOrDisposed(),Is2.func(type)?starNotificationHandler=type:handler&&(Is2.string(type)?(method=type,notificationHandlers.set(type,{type:void 0,handler:handler})):(method=type.method,notificationHandlers.set(type.method,{type:type,handler:handler}))),{dispose:()=>{void 0!==method?notificationHandlers.delete(method):starNotificationHandler=void 0}}},onProgress:(_type,token,handler)=>{if(progressHandlers.has(token))throw new Error(`Progress handler for token ${token} already registered`);return progressHandlers.set(token,handler),{dispose:()=>{progressHandlers.delete(token)}}},sendProgress:(_type,token,value)=>connection2.sendNotification(ProgressNotification.type,{token:token,value:value}),onUnhandledProgress:unhandledProgressEmitter.event,sendRequest:(type,...args)=>{let method,messageParams,token;if(throwIfClosedOrDisposed(),function(){if(!isListening())throw new Error("Call listen() first.")}(),Is2.string(type)){method=type;const first2=args[0],last=args[args.length-1];let paramStart=0,parameterStructures=messages_1.ParameterStructures.auto;messages_1.ParameterStructures.is(first2)&&(paramStart=1,parameterStructures=first2);let paramEnd=args.length;cancellation_1.CancellationToken.is(last)&&(paramEnd-=1,token=last);const numberOfParams=paramEnd-paramStart;switch(numberOfParams){case 0:messageParams=void 0;break;case 1:messageParams=computeSingleParam(parameterStructures,args[paramStart]);break;default:if(parameterStructures===messages_1.ParameterStructures.byName)throw new Error(`Received ${numberOfParams} parameters for 'by Name' request parameter structure.`);messageParams=args.slice(paramStart,paramEnd).map(value=>undefinedToNull(value))}}else{const params=args;method=type.method,messageParams=computeMessageParams(type,params);const numberOfParams=type.numberOfParams;token=cancellation_1.CancellationToken.is(params[numberOfParams])?params[numberOfParams]:void 0}const id=sequenceNumber++;let disposable2;token&&(disposable2=token.onCancellationRequested(()=>{const p=cancellationStrategy.sender.sendCancellation(connection2,id);return void 0===p?(logger.log(`Received no promise from cancellation strategy when cancelling id ${id}`),Promise.resolve()):p.catch(()=>{logger.log(`Sending cancellation messages for id ${id} failed`)})}));const requestMessage={jsonrpc:"2.0",id:id,method:method,params:messageParams};return function(message){if(trace!==Trace.Off&&tracer)if(traceFormat===TraceFormat.Text){let data;trace!==Trace.Verbose&&trace!==Trace.Compact||!message.params||(data=`Params: ${stringifyTrace(message.params)}\n\n`),tracer.log(`Sending request '${message.method} - (${message.id})'.`,data)}else logLSPMessage("send-request",message)}(requestMessage),"function"==typeof cancellationStrategy.sender.enableCancellation&&cancellationStrategy.sender.enableCancellation(requestMessage),new Promise(async(resolve,reject)=>{const responsePromise={method:method,timerStart:Date.now(),resolve:r=>{resolve(r),cancellationStrategy.sender.cleanup(id),null==disposable2||disposable2.dispose()},reject:r=>{reject(r),cancellationStrategy.sender.cleanup(id),null==disposable2||disposable2.dispose()}};try{await messageWriter2.write(requestMessage),responsePromises.set(id,responsePromise)}catch(error){throw logger.error("Sending request failed."),responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError,error.message?error.message:"Unknown reason")),error}})},onRequest:(type,handler)=>{throwIfClosedOrDisposed();let method=null;return StarRequestHandler.is(type)?(method=void 0,starRequestHandler=type):Is2.string(type)?(method=null,void 0!==handler&&(method=type,requestHandlers.set(type,{handler:handler,type:void 0}))):void 0!==handler&&(method=type.method,requestHandlers.set(type.method,{type:type,handler:handler})),{dispose:()=>{null!==method&&(void 0!==method?requestHandlers.delete(method):starRequestHandler=void 0)}}},hasPendingResponse:()=>responsePromises.size>0,trace:async(_value,_tracer,sendNotificationOrTraceOptions)=>{let _sendNotification=!1,_traceFormat=TraceFormat.Text;void 0!==sendNotificationOrTraceOptions&&(Is2.boolean(sendNotificationOrTraceOptions)?_sendNotification=sendNotificationOrTraceOptions:(_sendNotification=sendNotificationOrTraceOptions.sendNotification||!1,_traceFormat=sendNotificationOrTraceOptions.traceFormat||TraceFormat.Text)),trace=_value,traceFormat=_traceFormat,tracer=trace===Trace.Off?void 0:_tracer,!_sendNotification||isClosed()||isDisposed()||await connection2.sendNotification(SetTraceNotification.type,{value:Trace.toString(_value)})},onError:errorEmitter.event,onClose:closeEmitter.event,onUnhandledNotification:unhandledNotificationEmitter.event,onDispose:disposeEmitter.event,end:()=>{messageWriter2.end()},dispose:()=>{if(isDisposed())return;state=ConnectionState.Disposed,disposeEmitter.fire(void 0);const error=new messages_1.ResponseError(messages_1.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const promise of responsePromises.values())promise.reject(error);responsePromises=new Map,requestTokens=new Map,knownCanceledRequests=new Set,messageQueue=new linkedMap_1.LinkedMap,Is2.func(messageWriter2.dispose)&&messageWriter2.dispose(),Is2.func(messageReader2.dispose)&&messageReader2.dispose()},listen:()=>{throwIfClosedOrDisposed(),function(){if(isListening())throw new ConnectionError(ConnectionErrors.AlreadyListening,"Connection is already listening")}(),state=ConnectionState.Listening,messageReader2.listen(callback)},inspect:()=>{(0,ral_1.default)().console.log("inspect")}};return connection2.onNotification(LogTraceNotification.type,params=>{if(trace===Trace.Off||!tracer)return;const verbose=trace===Trace.Verbose||trace===Trace.Compact;tracer.log(params.message,verbose?params.verbose:void 0)}),connection2.onNotification(ProgressNotification.type,params=>{const handler=progressHandlers.get(params.token);handler?handler(params.value):unhandledProgressEmitter.fire(params)}),connection2}}(connection$1)),connection$1}function requireApi$1(){return hasRequiredApi$1||(hasRequiredApi$1=1,function(exports$1){Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.ProgressType=exports$1.ProgressToken=exports$1.createMessageConnection=exports$1.NullLogger=exports$1.ConnectionOptions=exports$1.ConnectionStrategy=exports$1.AbstractMessageBuffer=exports$1.WriteableStreamMessageWriter=exports$1.AbstractMessageWriter=exports$1.MessageWriter=exports$1.ReadableStreamMessageReader=exports$1.AbstractMessageReader=exports$1.MessageReader=exports$1.SharedArrayReceiverStrategy=exports$1.SharedArraySenderStrategy=exports$1.CancellationToken=exports$1.CancellationTokenSource=exports$1.Emitter=exports$1.Event=exports$1.Disposable=exports$1.LRUCache=exports$1.Touch=exports$1.LinkedMap=exports$1.ParameterStructures=exports$1.NotificationType9=exports$1.NotificationType8=exports$1.NotificationType7=exports$1.NotificationType6=exports$1.NotificationType5=exports$1.NotificationType4=exports$1.NotificationType3=exports$1.NotificationType2=exports$1.NotificationType1=exports$1.NotificationType0=exports$1.NotificationType=exports$1.ErrorCodes=exports$1.ResponseError=exports$1.RequestType9=exports$1.RequestType8=exports$1.RequestType7=exports$1.RequestType6=exports$1.RequestType5=exports$1.RequestType4=exports$1.RequestType3=exports$1.RequestType2=exports$1.RequestType1=exports$1.RequestType0=exports$1.RequestType=exports$1.Message=exports$1.RAL=void 0,exports$1.MessageStrategy=exports$1.CancellationStrategy=exports$1.CancellationSenderStrategy=exports$1.CancellationReceiverStrategy=exports$1.ConnectionError=exports$1.ConnectionErrors=exports$1.LogTraceNotification=exports$1.SetTraceNotification=exports$1.TraceFormat=exports$1.TraceValues=exports$1.Trace=void 0;const messages_1=requireMessages$1();Object.defineProperty(exports$1,"Message",{enumerable:!0,get:function(){return messages_1.Message}}),Object.defineProperty(exports$1,"RequestType",{enumerable:!0,get:function(){return messages_1.RequestType}}),Object.defineProperty(exports$1,"RequestType0",{enumerable:!0,get:function(){return messages_1.RequestType0}}),Object.defineProperty(exports$1,"RequestType1",{enumerable:!0,get:function(){return messages_1.RequestType1}}),Object.defineProperty(exports$1,"RequestType2",{enumerable:!0,get:function(){return messages_1.RequestType2}}),Object.defineProperty(exports$1,"RequestType3",{enumerable:!0,get:function(){return messages_1.RequestType3}}),Object.defineProperty(exports$1,"RequestType4",{enumerable:!0,get:function(){return messages_1.RequestType4}}),Object.defineProperty(exports$1,"RequestType5",{enumerable:!0,get:function(){return messages_1.RequestType5}}),Object.defineProperty(exports$1,"RequestType6",{enumerable:!0,get:function(){return messages_1.RequestType6}}),Object.defineProperty(exports$1,"RequestType7",{enumerable:!0,get:function(){return messages_1.RequestType7}}),Object.defineProperty(exports$1,"RequestType8",{enumerable:!0,get:function(){return messages_1.RequestType8}}),Object.defineProperty(exports$1,"RequestType9",{enumerable:!0,get:function(){return messages_1.RequestType9}}),Object.defineProperty(exports$1,"ResponseError",{enumerable:!0,get:function(){return messages_1.ResponseError}}),Object.defineProperty(exports$1,"ErrorCodes",{enumerable:!0,get:function(){return messages_1.ErrorCodes}}),Object.defineProperty(exports$1,"NotificationType",{enumerable:!0,get:function(){return messages_1.NotificationType}}),Object.defineProperty(exports$1,"NotificationType0",{enumerable:!0,get:function(){return messages_1.NotificationType0}}),Object.defineProperty(exports$1,"NotificationType1",{enumerable:!0,get:function(){return messages_1.NotificationType1}}),Object.defineProperty(exports$1,"NotificationType2",{enumerable:!0,get:function(){return messages_1.NotificationType2}}),Object.defineProperty(exports$1,"NotificationType3",{enumerable:!0,get:function(){return messages_1.NotificationType3}}),Object.defineProperty(exports$1,"NotificationType4",{enumerable:!0,get:function(){return messages_1.NotificationType4}}),Object.defineProperty(exports$1,"NotificationType5",{enumerable:!0,get:function(){return messages_1.NotificationType5}}),Object.defineProperty(exports$1,"NotificationType6",{enumerable:!0,get:function(){return messages_1.NotificationType6}}),Object.defineProperty(exports$1,"NotificationType7",{enumerable:!0,get:function(){return messages_1.NotificationType7}}),Object.defineProperty(exports$1,"NotificationType8",{enumerable:!0,get:function(){return messages_1.NotificationType8}}),Object.defineProperty(exports$1,"NotificationType9",{enumerable:!0,get:function(){return messages_1.NotificationType9}}),Object.defineProperty(exports$1,"ParameterStructures",{enumerable:!0,get:function(){return messages_1.ParameterStructures}});const linkedMap_1=requireLinkedMap();Object.defineProperty(exports$1,"LinkedMap",{enumerable:!0,get:function(){return linkedMap_1.LinkedMap}}),Object.defineProperty(exports$1,"LRUCache",{enumerable:!0,get:function(){return linkedMap_1.LRUCache}}),Object.defineProperty(exports$1,"Touch",{enumerable:!0,get:function(){return linkedMap_1.Touch}});const disposable_1=(hasRequiredDisposable||(hasRequiredDisposable=1,Object.defineProperty(disposable,"__esModule",{value:!0}),disposable.Disposable=void 0,(Disposable2||(disposable.Disposable=Disposable2={})).create=function(func){return{dispose:func}}),disposable);var Disposable2;Object.defineProperty(exports$1,"Disposable",{enumerable:!0,get:function(){return disposable_1.Disposable}});const events_1=requireEvents();Object.defineProperty(exports$1,"Event",{enumerable:!0,get:function(){return events_1.Event}}),Object.defineProperty(exports$1,"Emitter",{enumerable:!0,get:function(){return events_1.Emitter}});const cancellation_1=requireCancellation();Object.defineProperty(exports$1,"CancellationTokenSource",{enumerable:!0,get:function(){return cancellation_1.CancellationTokenSource}}),Object.defineProperty(exports$1,"CancellationToken",{enumerable:!0,get:function(){return cancellation_1.CancellationToken}});const sharedArrayCancellation_1=function(){if(hasRequiredSharedArrayCancellation)return sharedArrayCancellation;hasRequiredSharedArrayCancellation=1,Object.defineProperty(sharedArrayCancellation,"__esModule",{value:!0}),sharedArrayCancellation.SharedArrayReceiverStrategy=sharedArrayCancellation.SharedArraySenderStrategy=void 0;const cancellation_1=requireCancellation();var CancellationState,CancellationState2;(CancellationState2=CancellationState||(CancellationState={})).Continue=0,CancellationState2.Cancelled=1,sharedArrayCancellation.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(request){if(null===request.id)return;const buffer=new SharedArrayBuffer(4);new Int32Array(buffer,0,1)[0]=CancellationState.Continue,this.buffers.set(request.id,buffer),request.$cancellationData=buffer}async sendCancellation(_conn,id){const buffer=this.buffers.get(id);if(void 0===buffer)return;const data=new Int32Array(buffer,0,1);Atomics.store(data,0,CancellationState.Cancelled)}cleanup(id){this.buffers.delete(id)}dispose(){this.buffers.clear()}};class SharedArrayBufferCancellationToken{constructor(buffer){this.data=new Int32Array(buffer,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===CancellationState.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class SharedArrayBufferCancellationTokenSource{constructor(buffer){this.token=new SharedArrayBufferCancellationToken(buffer)}cancel(){}dispose(){}}return sharedArrayCancellation.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(request){const buffer=request.$cancellationData;return void 0===buffer?new cancellation_1.CancellationTokenSource:new SharedArrayBufferCancellationTokenSource(buffer)}},sharedArrayCancellation}();Object.defineProperty(exports$1,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return sharedArrayCancellation_1.SharedArraySenderStrategy}}),Object.defineProperty(exports$1,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return sharedArrayCancellation_1.SharedArrayReceiverStrategy}});const messageReader_1=function(){if(hasRequiredMessageReader)return messageReader;hasRequiredMessageReader=1,Object.defineProperty(messageReader,"__esModule",{value:!0}),messageReader.ReadableStreamMessageReader=messageReader.AbstractMessageReader=messageReader.MessageReader=void 0;const ral_1=requireRal(),Is2=requireIs$1(),events_1=requireEvents(),semaphore_1=requireSemaphore();var MessageReader,ResolvedMessageReaderOptions;(MessageReader||(messageReader.MessageReader=MessageReader={})).is=function(value){let candidate=value;return candidate&&Is2.func(candidate.listen)&&Is2.func(candidate.dispose)&&Is2.func(candidate.onError)&&Is2.func(candidate.onClose)&&Is2.func(candidate.onPartialMessage)};class AbstractMessageReader{constructor(){this.errorEmitter=new events_1.Emitter,this.closeEmitter=new events_1.Emitter,this.partialMessageEmitter=new events_1.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(error){this.errorEmitter.fire(this.asError(error))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(info){this.partialMessageEmitter.fire(info)}asError(error){return error instanceof Error?error:new Error(`Reader received error. Reason: ${Is2.string(error.message)?error.message:"unknown"}`)}}return messageReader.AbstractMessageReader=AbstractMessageReader,(ResolvedMessageReaderOptions||(ResolvedMessageReaderOptions={})).fromOptions=function(options){let charset,contentDecoder;const contentDecoders=new Map;let contentTypeDecoder;const contentTypeDecoders=new Map;if(void 0===options||"string"==typeof options)charset=options??"utf-8";else{if(charset=options.charset??"utf-8",void 0!==options.contentDecoder&&(contentDecoder=options.contentDecoder,contentDecoders.set(contentDecoder.name,contentDecoder)),void 0!==options.contentDecoders)for(const decoder of options.contentDecoders)contentDecoders.set(decoder.name,decoder);if(void 0!==options.contentTypeDecoder&&(contentTypeDecoder=options.contentTypeDecoder,contentTypeDecoders.set(contentTypeDecoder.name,contentTypeDecoder)),void 0!==options.contentTypeDecoders)for(const decoder of options.contentTypeDecoders)contentTypeDecoders.set(decoder.name,decoder)}return void 0===contentTypeDecoder&&(contentTypeDecoder=(0,ral_1.default)().applicationJson.decoder,contentTypeDecoders.set(contentTypeDecoder.name,contentTypeDecoder)),{charset:charset,contentDecoder:contentDecoder,contentDecoders:contentDecoders,contentTypeDecoder:contentTypeDecoder,contentTypeDecoders:contentTypeDecoders}},messageReader.ReadableStreamMessageReader=class extends AbstractMessageReader{constructor(readable,options){super(),this.readable=readable,this.options=ResolvedMessageReaderOptions.fromOptions(options),this.buffer=(0,ral_1.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new semaphore_1.Semaphore(1)}set partialMessageTimeout(timeout){this._partialMessageTimeout=timeout}get partialMessageTimeout(){return this._partialMessageTimeout}listen(callback){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=callback;const result=this.readable.onData(data=>{this.onData(data)});return this.readable.onError(error=>this.fireError(error)),this.readable.onClose(()=>this.fireClose()),result}onData(data){try{for(this.buffer.append(data);;){if(-1===this.nextMessageLength){const headers=this.buffer.tryReadHeaders(!0);if(!headers)return;const contentLength=headers.get("content-length");if(!contentLength)return void this.fireError(new Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(headers))}`));const length=parseInt(contentLength);if(isNaN(length))return void this.fireError(new Error(`Content-Length value must be a number. Got ${contentLength}`));this.nextMessageLength=length}const body=this.buffer.tryReadBody(this.nextMessageLength);if(void 0===body)return void this.setPartialMessageTimer();this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const bytes=void 0!==this.options.contentDecoder?await this.options.contentDecoder.decode(body):body,message=await this.options.contentTypeDecoder.decode(bytes,this.options);this.callback(message)}).catch(error=>{this.fireError(error)})}}catch(error){this.fireError(error)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),this._partialMessageTimeout<=0||(this.partialMessageTimer=(0,ral_1.default)().timer.setTimeout((token,timeout)=>{this.partialMessageTimer=void 0,token===this.messageToken&&(this.firePartialMessage({messageToken:token,waitingTime:timeout}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}},messageReader}();Object.defineProperty(exports$1,"MessageReader",{enumerable:!0,get:function(){return messageReader_1.MessageReader}}),Object.defineProperty(exports$1,"AbstractMessageReader",{enumerable:!0,get:function(){return messageReader_1.AbstractMessageReader}}),Object.defineProperty(exports$1,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return messageReader_1.ReadableStreamMessageReader}});const messageWriter_1=function(){if(hasRequiredMessageWriter)return messageWriter;hasRequiredMessageWriter=1,Object.defineProperty(messageWriter,"__esModule",{value:!0}),messageWriter.WriteableStreamMessageWriter=messageWriter.AbstractMessageWriter=messageWriter.MessageWriter=void 0;const ral_1=requireRal(),Is2=requireIs$1(),semaphore_1=requireSemaphore(),events_1=requireEvents();var MessageWriter,ResolvedMessageWriterOptions;(MessageWriter||(messageWriter.MessageWriter=MessageWriter={})).is=function(value){let candidate=value;return candidate&&Is2.func(candidate.dispose)&&Is2.func(candidate.onClose)&&Is2.func(candidate.onError)&&Is2.func(candidate.write)};class AbstractMessageWriter{constructor(){this.errorEmitter=new events_1.Emitter,this.closeEmitter=new events_1.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(error,message,count){this.errorEmitter.fire([this.asError(error),message,count])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(error){return error instanceof Error?error:new Error(`Writer received error. Reason: ${Is2.string(error.message)?error.message:"unknown"}`)}}return messageWriter.AbstractMessageWriter=AbstractMessageWriter,(ResolvedMessageWriterOptions||(ResolvedMessageWriterOptions={})).fromOptions=function(options){return void 0===options||"string"==typeof options?{charset:options??"utf-8",contentTypeEncoder:(0,ral_1.default)().applicationJson.encoder}:{charset:options.charset??"utf-8",contentEncoder:options.contentEncoder,contentTypeEncoder:options.contentTypeEncoder??(0,ral_1.default)().applicationJson.encoder}},messageWriter.WriteableStreamMessageWriter=class extends AbstractMessageWriter{constructor(writable,options){super(),this.writable=writable,this.options=ResolvedMessageWriterOptions.fromOptions(options),this.errorCount=0,this.writeSemaphore=new semaphore_1.Semaphore(1),this.writable.onError(error=>this.fireError(error)),this.writable.onClose(()=>this.fireClose())}async write(msg){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(msg,this.options).then(buffer=>void 0!==this.options.contentEncoder?this.options.contentEncoder.encode(buffer):buffer).then(buffer=>{const headers=[];return headers.push("Content-Length: ",buffer.byteLength.toString(),"\r\n"),headers.push("\r\n"),this.doWrite(msg,headers,buffer)},error=>{throw this.fireError(error),error}))}async doWrite(msg,headers,data){try{return await this.writable.write(headers.join(""),"ascii"),this.writable.write(data)}catch(error){return this.handleError(error,msg),Promise.reject(error)}}handleError(error,msg){this.errorCount++,this.fireError(error,msg,this.errorCount)}end(){this.writable.end()}},messageWriter}();Object.defineProperty(exports$1,"MessageWriter",{enumerable:!0,get:function(){return messageWriter_1.MessageWriter}}),Object.defineProperty(exports$1,"AbstractMessageWriter",{enumerable:!0,get:function(){return messageWriter_1.AbstractMessageWriter}}),Object.defineProperty(exports$1,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return messageWriter_1.WriteableStreamMessageWriter}});const messageBuffer_1=(hasRequiredMessageBuffer||(hasRequiredMessageBuffer=1,Object.defineProperty(messageBuffer,"__esModule",{value:!0}),messageBuffer.AbstractMessageBuffer=void 0,messageBuffer.AbstractMessageBuffer=class{constructor(encoding="utf-8"){this._encoding=encoding,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(chunk){const toAppend="string"==typeof chunk?this.fromString(chunk,this._encoding):chunk;this._chunks.push(toAppend),this._totalLength+=toAppend.byteLength}tryReadHeaders(lowerCaseKeys=!1){if(0===this._chunks.length)return;let state=0,chunkIndex=0,offset=0,chunkBytesRead=0;row:for(;chunkIndex<this._chunks.length;){const chunk=this._chunks[chunkIndex];for(offset=0;offset<chunk.length;){switch(chunk[offset]){case 13:switch(state){case 0:state=1;break;case 2:state=3;break;default:state=0}break;case 10:switch(state){case 1:state=2;break;case 3:state=4,offset++;break row;default:state=0}break;default:state=0}offset++}chunkBytesRead+=chunk.byteLength,chunkIndex++}if(4!==state)return;const buffer=this._read(chunkBytesRead+offset),result=new Map,headers=this.toString(buffer,"ascii").split("\r\n");if(headers.length<2)return result;for(let i=0;i<headers.length-2;i++){const header=headers[i],index=header.indexOf(":");if(-1===index)throw new Error(`Message header must separate key and value using ':'\n${header}`);const key=header.substr(0,index),value=header.substr(index+1).trim();result.set(lowerCaseKeys?key.toLowerCase():key,value)}return result}tryReadBody(length){if(!(this._totalLength<length))return this._read(length)}get numberOfBytes(){return this._totalLength}_read(byteCount){if(0===byteCount)return this.emptyBuffer();if(byteCount>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===byteCount){const chunk=this._chunks[0];return this._chunks.shift(),this._totalLength-=byteCount,this.asNative(chunk)}if(this._chunks[0].byteLength>byteCount){const chunk=this._chunks[0],result2=this.asNative(chunk,byteCount);return this._chunks[0]=chunk.slice(byteCount),this._totalLength-=byteCount,result2}const result=this.allocNative(byteCount);let resultOffset=0;for(;byteCount>0;){const chunk=this._chunks[0];if(chunk.byteLength>byteCount){const chunkPart=chunk.slice(0,byteCount);result.set(chunkPart,resultOffset),resultOffset+=byteCount,this._chunks[0]=chunk.slice(byteCount),this._totalLength-=byteCount,byteCount-=byteCount}else result.set(chunk,resultOffset),resultOffset+=chunk.byteLength,this._chunks.shift(),this._totalLength-=chunk.byteLength,byteCount-=chunk.byteLength}return result}}),messageBuffer);Object.defineProperty(exports$1,"AbstractMessageBuffer",{enumerable:!0,get:function(){return messageBuffer_1.AbstractMessageBuffer}});const connection_1=requireConnection$1();Object.defineProperty(exports$1,"ConnectionStrategy",{enumerable:!0,get:function(){return connection_1.ConnectionStrategy}}),Object.defineProperty(exports$1,"ConnectionOptions",{enumerable:!0,get:function(){return connection_1.ConnectionOptions}}),Object.defineProperty(exports$1,"NullLogger",{enumerable:!0,get:function(){return connection_1.NullLogger}}),Object.defineProperty(exports$1,"createMessageConnection",{enumerable:!0,get:function(){return connection_1.createMessageConnection}}),Object.defineProperty(exports$1,"ProgressToken",{enumerable:!0,get:function(){return connection_1.ProgressToken}}),Object.defineProperty(exports$1,"ProgressType",{enumerable:!0,get:function(){return connection_1.ProgressType}}),Object.defineProperty(exports$1,"Trace",{enumerable:!0,get:function(){return connection_1.Trace}}),Object.defineProperty(exports$1,"TraceValues",{enumerable:!0,get:function(){return connection_1.TraceValues}}),Object.defineProperty(exports$1,"TraceFormat",{enumerable:!0,get:function(){return connection_1.TraceFormat}}),Object.defineProperty(exports$1,"SetTraceNotification",{enumerable:!0,get:function(){return connection_1.SetTraceNotification}}),Object.defineProperty(exports$1,"LogTraceNotification",{enumerable:!0,get:function(){return connection_1.LogTraceNotification}}),Object.defineProperty(exports$1,"ConnectionErrors",{enumerable:!0,get:function(){return connection_1.ConnectionErrors}}),Object.defineProperty(exports$1,"ConnectionError",{enumerable:!0,get:function(){return connection_1.ConnectionError}}),Object.defineProperty(exports$1,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return connection_1.CancellationReceiverStrategy}}),Object.defineProperty(exports$1,"CancellationSenderStrategy",{enumerable:!0,get:function(){return connection_1.CancellationSenderStrategy}}),Object.defineProperty(exports$1,"CancellationStrategy",{enumerable:!0,get:function(){return connection_1.CancellationStrategy}}),Object.defineProperty(exports$1,"MessageStrategy",{enumerable:!0,get:function(){return connection_1.MessageStrategy}});const ral_1=requireRal();exports$1.RAL=ral_1.default}(api$1)),api$1}function requireMain$1(){return hasRequiredMain$1||(hasRequiredMain$1=1,function(exports$1){var __createBinding=main&&main.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&!("get"in desc?!m.__esModule:desc.writable||desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){void 0===k2&&(k2=k),o[k2]=m[k]}),__exportStar=main&&main.__exportStar||function(m,exports$12){for(var p in m)"default"===p||Object.prototype.hasOwnProperty.call(exports$12,p)||__createBinding(exports$12,m,p)};Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.createMessageConnection=exports$1.BrowserMessageWriter=exports$1.BrowserMessageReader=void 0;const ril_1=function(){if(hasRequiredRil)return ril;hasRequiredRil=1,Object.defineProperty(ril,"__esModule",{value:!0});const api_1=requireApi$1();class MessageBuffer extends api_1.AbstractMessageBuffer{constructor(encoding="utf-8"){super(encoding),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return MessageBuffer.emptyBuffer}fromString(value,_encoding){return(new TextEncoder).encode(value)}toString(value,encoding){return"ascii"===encoding?this.asciiDecoder.decode(value):new TextDecoder(encoding).decode(value)}asNative(buffer,length){return void 0===length?buffer:buffer.slice(0,length)}allocNative(length){return new Uint8Array(length)}}MessageBuffer.emptyBuffer=new Uint8Array(0);class ReadableStreamWrapper{constructor(socket){this.socket=socket,this._onData=new api_1.Emitter,this._messageListener=event=>{event.data.arrayBuffer().then(buffer=>{this._onData.fire(new Uint8Array(buffer))},()=>{(0,api_1.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(listener){return this.socket.addEventListener("close",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("close",listener))}onError(listener){return this.socket.addEventListener("error",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("error",listener))}onEnd(listener){return this.socket.addEventListener("end",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("end",listener))}onData(listener){return this._onData.event(listener)}}class WritableStreamWrapper{constructor(socket){this.socket=socket}onClose(listener){return this.socket.addEventListener("close",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("close",listener))}onError(listener){return this.socket.addEventListener("error",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("error",listener))}onEnd(listener){return this.socket.addEventListener("end",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("end",listener))}write(data,encoding){if("string"==typeof data){if(void 0!==encoding&&"utf-8"!==encoding)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${encoding}`);this.socket.send(data)}else this.socket.send(data);return Promise.resolve()}end(){this.socket.close()}}const _textEncoder=new TextEncoder,_ril=Object.freeze({messageBuffer:Object.freeze({create:encoding=>new MessageBuffer(encoding)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(msg,options)=>{if("utf-8"!==options.charset)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${options.charset}`);return Promise.resolve(_textEncoder.encode(JSON.stringify(msg,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(buffer,options)=>{if(!(buffer instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(options.charset).decode(buffer)))}})}),stream:Object.freeze({asReadableStream:socket=>new ReadableStreamWrapper(socket),asWritableStream:socket=>new WritableStreamWrapper(socket)}),console:console,timer:Object.freeze({setTimeout(callback,ms,...args){const handle=setTimeout(callback,ms,...args);return{dispose:()=>clearTimeout(handle)}},setImmediate(callback,...args){const handle=setTimeout(callback,0,...args);return{dispose:()=>clearTimeout(handle)}},setInterval(callback,ms,...args){const handle=setInterval(callback,ms,...args);return{dispose:()=>clearInterval(handle)}}})});function RIL(){return _ril}return(RIL||(RIL={})).install=function(){api_1.RAL.install(_ril)},ril.default=RIL,ril}();ril_1.default.install();const api_1=requireApi$1();__exportStar(requireApi$1(),exports$1);class BrowserMessageReader extends api_1.AbstractMessageReader{constructor(port){super(),this._onData=new api_1.Emitter,this._messageListener=event=>{this._onData.fire(event.data)},port.addEventListener("error",event=>this.fireError(event)),port.onmessage=this._messageListener}listen(callback){return this._onData.event(callback)}}exports$1.BrowserMessageReader=BrowserMessageReader;class BrowserMessageWriter extends api_1.AbstractMessageWriter{constructor(port){super(),this.port=port,this.errorCount=0,port.addEventListener("error",event=>this.fireError(event))}write(msg){try{return this.port.postMessage(msg),Promise.resolve()}catch(error){return this.handleError(error,msg),Promise.reject(error)}}handleError(error,msg){this.errorCount++,this.fireError(error,msg,this.errorCount)}end(){}}exports$1.BrowserMessageWriter=BrowserMessageWriter,exports$1.createMessageConnection=function(reader,writer,logger,options){return void 0===logger&&(logger=api_1.NullLogger),api_1.ConnectionStrategy.is(options)&&(options={connectionStrategy:options}),(0,api_1.createMessageConnection)(reader,writer,logger,options)}}(main)),main}function requireBrowser(){return hasRequiredBrowser?browser:(hasRequiredBrowser=1,browser=requireMain$1())}var api={};const require$$1=getAugmentedNamespace(main$2);var hasRequiredMessages,messages={};function requireMessages(){if(hasRequiredMessages)return messages;hasRequiredMessages=1,Object.defineProperty(messages,"__esModule",{value:!0}),messages.ProtocolNotificationType=messages.ProtocolNotificationType0=messages.ProtocolRequestType=messages.ProtocolRequestType0=messages.RegistrationType=messages.MessageDirection=void 0;const vscode_jsonrpc_1=requireMain$1();var MessageDirection,MessageDirection2;(MessageDirection2=MessageDirection||(messages.MessageDirection=MessageDirection={})).clientToServer="clientToServer",MessageDirection2.serverToClient="serverToClient",MessageDirection2.both="both";messages.RegistrationType=class{constructor(method){this.method=method}};class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0{constructor(method){super(method)}}messages.ProtocolRequestType0=ProtocolRequestType0;class ProtocolRequestType extends vscode_jsonrpc_1.RequestType{constructor(method){super(method,vscode_jsonrpc_1.ParameterStructures.byName)}}messages.ProtocolRequestType=ProtocolRequestType;class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0{constructor(method){super(method)}}messages.ProtocolNotificationType0=ProtocolNotificationType0;class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType{constructor(method){super(method,vscode_jsonrpc_1.ParameterStructures.byName)}}return messages.ProtocolNotificationType=ProtocolNotificationType,messages}var hasRequiredIs,protocol={},is={};function requireIs(){if(hasRequiredIs)return is;function string(value){return"string"==typeof value||value instanceof String}function array(value){return Array.isArray(value)}return hasRequiredIs=1,Object.defineProperty(is,"__esModule",{value:!0}),is.objectLiteral=is.typedArray=is.stringArray=is.array=is.func=is.error=is.number=is.string=is.boolean=void 0,is.boolean=function(value){return!0===value||!1===value},is.string=string,is.number=function(value){return"number"==typeof value||value instanceof Number},is.error=function(value){return value instanceof Error},is.func=function(value){return"function"==typeof value},is.array=array,is.stringArray=function(value){return array(value)&&value.every(elem=>string(elem))},is.typedArray=function(value,check){return Array.isArray(value)&&value.every(check)},is.objectLiteral=function(value){return null!==value&&"object"==typeof value},is}var hasRequiredProtocol_implementation,protocol_implementation={};var hasRequiredProtocol_typeDefinition,protocol_typeDefinition={};var hasRequiredProtocol_workspaceFolder,protocol_workspaceFolder={};var hasRequiredProtocol_configuration,protocol_configuration={};var hasRequiredProtocol_colorProvider,protocol_colorProvider={};var hasRequiredProtocol_foldingRange,protocol_foldingRange={};var hasRequiredProtocol_declaration,protocol_declaration={};var hasRequiredProtocol_selectionRange,protocol_selectionRange={};var hasRequiredProtocol_progress,protocol_progress={};var hasRequiredProtocol_callHierarchy,protocol_callHierarchy={};var hasRequiredProtocol_semanticTokens,protocol_semanticTokens={};var hasRequiredProtocol_showDocument,protocol_showDocument={};var hasRequiredProtocol_linkedEditingRange,protocol_linkedEditingRange={};var hasRequiredProtocol_fileOperations,protocol_fileOperations={};var hasRequiredProtocol_moniker,protocol_moniker={};var hasRequiredProtocol_typeHierarchy,protocol_typeHierarchy={};var hasRequiredProtocol_inlineValue,protocol_inlineValue={};var hasRequiredProtocol_inlayHint,protocol_inlayHint={};var hasRequiredProtocol_diagnostic,protocol_diagnostic={};var hasRequiredProtocol_notebook,protocol_notebook={};function requireProtocol_notebook(){if(hasRequiredProtocol_notebook)return protocol_notebook;hasRequiredProtocol_notebook=1,Object.defineProperty(protocol_notebook,"__esModule",{value:!0}),protocol_notebook.DidCloseNotebookDocumentNotification=protocol_notebook.DidSaveNotebookDocumentNotification=protocol_notebook.DidChangeNotebookDocumentNotification=protocol_notebook.NotebookCellArrayChange=protocol_notebook.DidOpenNotebookDocumentNotification=protocol_notebook.NotebookDocumentSyncRegistrationType=protocol_notebook.NotebookDocument=protocol_notebook.NotebookCell=protocol_notebook.ExecutionSummary=protocol_notebook.NotebookCellKind=void 0;const vscode_languageserver_types_1=require$$1,Is2=requireIs(),messages_1=requireMessages();var NotebookCellKind,NotebookCellKind2,ExecutionSummary,ExecutionSummary2,NotebookCell,NotebookDocument,NotebookDocument2,NotebookDocumentSyncRegistrationType,NotebookDocumentSyncRegistrationType2,DidOpenNotebookDocumentNotification,DidOpenNotebookDocumentNotification2,NotebookCellArrayChange,NotebookCellArrayChange2,DidChangeNotebookDocumentNotification,DidChangeNotebookDocumentNotification2,DidSaveNotebookDocumentNotification,DidSaveNotebookDocumentNotification2,DidCloseNotebookDocumentNotification,DidCloseNotebookDocumentNotification2;return(NotebookCellKind2=NotebookCellKind||(protocol_notebook.NotebookCellKind=NotebookCellKind={})).Markup=1,NotebookCellKind2.Code=2,NotebookCellKind2.is=function(value){return 1===value||2===value},(ExecutionSummary2=ExecutionSummary||(protocol_notebook.ExecutionSummary=ExecutionSummary={})).create=function(executionOrder,success){const result={executionOrder:executionOrder};return!0!==success&&!1!==success||(result.success=success),result},ExecutionSummary2.is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&vscode_languageserver_types_1.uinteger.is(candidate.executionOrder)&&(void 0===candidate.success||Is2.boolean(candidate.success))},ExecutionSummary2.equals=function(one,other){return one===other||null!=one&&null!=other&&one.executionOrder===other.executionOrder&&one.success===other.success},function(NotebookCell2){function equalsMetadata(one,other){if(one===other)return!0;if(null==one||null==other)return!1;if(typeof one!=typeof other)return!1;if("object"!=typeof one)return!1;const oneArray=Array.isArray(one),otherArray=Array.isArray(other);if(oneArray!==otherArray)return!1;if(oneArray&&otherArray){if(one.length!==other.length)return!1;for(let i=0;i<one.length;i++)if(!equalsMetadata(one[i],other[i]))return!1}if(Is2.objectLiteral(one)&&Is2.objectLiteral(other)){const oneKeys=Object.keys(one),otherKeys=Object.keys(other);if(oneKeys.length!==otherKeys.length)return!1;if(oneKeys.sort(),otherKeys.sort(),!equalsMetadata(oneKeys,otherKeys))return!1;for(let i=0;i<oneKeys.length;i++){const prop=oneKeys[i];if(!equalsMetadata(one[prop],other[prop]))return!1}}return!0}NotebookCell2.create=function(kind,document){return{kind:kind,document:document}},NotebookCell2.is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&NotebookCellKind.is(candidate.kind)&&vscode_languageserver_types_1.DocumentUri.is(candidate.document)&&(void 0===candidate.metadata||Is2.objectLiteral(candidate.metadata))},NotebookCell2.diff=function(one,two){const result=new Set;return one.document!==two.document&&result.add("document"),one.kind!==two.kind&&result.add("kind"),one.executionSummary!==two.executionSummary&&result.add("executionSummary"),void 0===one.metadata&&void 0===two.metadata||equalsMetadata(one.metadata,two.metadata)||result.add("metadata"),void 0===one.executionSummary&&void 0===two.executionSummary||ExecutionSummary.equals(one.executionSummary,two.executionSummary)||result.add("executionSummary"),result}}(NotebookCell||(protocol_notebook.NotebookCell=NotebookCell={})),(NotebookDocument2=NotebookDocument||(protocol_notebook.NotebookDocument=NotebookDocument={})).create=function(uri,notebookType,version,cells){return{uri:uri,notebookType:notebookType,version:version,cells:cells}},NotebookDocument2.is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&Is2.string(candidate.uri)&&vscode_languageserver_types_1.integer.is(candidate.version)&&Is2.typedArray(candidate.cells,NotebookCell.is)},(NotebookDocumentSyncRegistrationType2=NotebookDocumentSyncRegistrationType||(protocol_notebook.NotebookDocumentSyncRegistrationType=NotebookDocumentSyncRegistrationType={})).method="notebookDocument/sync",NotebookDocumentSyncRegistrationType2.messageDirection=messages_1.MessageDirection.clientToServer,NotebookDocumentSyncRegistrationType2.type=new messages_1.RegistrationType(NotebookDocumentSyncRegistrationType2.method),(DidOpenNotebookDocumentNotification2=DidOpenNotebookDocumentNotification||(protocol_notebook.DidOpenNotebookDocumentNotification=DidOpenNotebookDocumentNotification={})).method="notebookDocument/didOpen",DidOpenNotebookDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidOpenNotebookDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidOpenNotebookDocumentNotification2.method),DidOpenNotebookDocumentNotification2.registrationMethod=NotebookDocumentSyncRegistrationType.method,(NotebookCellArrayChange2=NotebookCellArrayChange||(protocol_notebook.NotebookCellArrayChange=NotebookCellArrayChange={})).is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&vscode_languageserver_types_1.uinteger.is(candidate.start)&&vscode_languageserver_types_1.uinteger.is(candidate.deleteCount)&&(void 0===candidate.cells||Is2.typedArray(candidate.cells,NotebookCell.is))},NotebookCellArrayChange2.create=function(start,deleteCount,cells){const result={start:start,deleteCount:deleteCount};return void 0!==cells&&(result.cells=cells),result},(DidChangeNotebookDocumentNotification2=DidChangeNotebookDocumentNotification||(protocol_notebook.DidChangeNotebookDocumentNotification=DidChangeNotebookDocumentNotification={})).method="notebookDocument/didChange",DidChangeNotebookDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidChangeNotebookDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidChangeNotebookDocumentNotification2.method),DidChangeNotebookDocumentNotification2.registrationMethod=NotebookDocumentSyncRegistrationType.method,(DidSaveNotebookDocumentNotification2=DidSaveNotebookDocumentNotification||(protocol_notebook.DidSaveNotebookDocumentNotification=DidSaveNotebookDocumentNotification={})).method="notebookDocument/didSave",DidSaveNotebookDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidSaveNotebookDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidSaveNotebookDocumentNotification2.method),DidSaveNotebookDocumentNotification2.registrationMethod=NotebookDocumentSyncRegistrationType.method,(DidCloseNotebookDocumentNotification2=DidCloseNotebookDocumentNotification||(protocol_notebook.DidCloseNotebookDocumentNotification=DidCloseNotebookDocumentNotification={})).method="notebookDocument/didClose",DidCloseNotebookDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidCloseNotebookDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidCloseNotebookDocumentNotification2.method),DidCloseNotebookDocumentNotification2.registrationMethod=NotebookDocumentSyncRegistrationType.method,protocol_notebook}var hasRequiredProtocol_inlineCompletion,hasRequiredProtocol,protocol_inlineCompletion={};function requireProtocol(){return hasRequiredProtocol||(hasRequiredProtocol=1,function(exports$1){Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.WorkspaceSymbolRequest=exports$1.CodeActionResolveRequest=exports$1.CodeActionRequest=exports$1.DocumentSymbolRequest=exports$1.DocumentHighlightRequest=exports$1.ReferencesRequest=exports$1.DefinitionRequest=exports$1.SignatureHelpRequest=exports$1.SignatureHelpTriggerKind=exports$1.HoverRequest=exports$1.CompletionResolveRequest=exports$1.CompletionRequest=exports$1.CompletionTriggerKind=exports$1.PublishDiagnosticsNotification=exports$1.WatchKind=exports$1.RelativePattern=exports$1.FileChangeType=exports$1.DidChangeWatchedFilesNotification=exports$1.WillSaveTextDocumentWaitUntilRequest=exports$1.WillSaveTextDocumentNotification=exports$1.TextDocumentSaveReason=exports$1.DidSaveTextDocumentNotification=exports$1.DidCloseTextDocumentNotification=exports$1.DidChangeTextDocumentNotification=exports$1.TextDocumentContentChangeEvent=exports$1.DidOpenTextDocumentNotification=exports$1.TextDocumentSyncKind=exports$1.TelemetryEventNotification=exports$1.LogMessageNotification=exports$1.ShowMessageRequest=exports$1.ShowMessageNotification=exports$1.MessageType=exports$1.DidChangeConfigurationNotification=exports$1.ExitNotification=exports$1.ShutdownRequest=exports$1.InitializedNotification=exports$1.InitializeErrorCodes=exports$1.InitializeRequest=exports$1.WorkDoneProgressOptions=exports$1.TextDocumentRegistrationOptions=exports$1.StaticRegistrationOptions=exports$1.PositionEncodingKind=exports$1.FailureHandlingKind=exports$1.ResourceOperationKind=exports$1.UnregistrationRequest=exports$1.RegistrationRequest=exports$1.DocumentSelector=exports$1.NotebookCellTextDocumentFilter=exports$1.NotebookDocumentFilter=exports$1.TextDocumentFilter=void 0,exports$1.MonikerRequest=exports$1.MonikerKind=exports$1.UniquenessLevel=exports$1.WillDeleteFilesRequest=exports$1.DidDeleteFilesNotification=exports$1.WillRenameFilesRequest=exports$1.DidRenameFilesNotification=exports$1.WillCreateFilesRequest=exports$1.DidCreateFilesNotification=exports$1.FileOperationPatternKind=exports$1.LinkedEditingRangeRequest=exports$1.ShowDocumentRequest=exports$1.SemanticTokensRegistrationType=exports$1.SemanticTokensRefreshRequest=exports$1.SemanticTokensRangeRequest=exports$1.SemanticTokensDeltaRequest=exports$1.SemanticTokensRequest=exports$1.TokenFormat=exports$1.CallHierarchyPrepareRequest=exports$1.CallHierarchyOutgoingCallsRequest=exports$1.CallHierarchyIncomingCallsRequest=exports$1.WorkDoneProgressCancelNotification=exports$1.WorkDoneProgressCreateRequest=exports$1.WorkDoneProgress=exports$1.SelectionRangeRequest=exports$1.DeclarationRequest=exports$1.FoldingRangeRefreshRequest=exports$1.FoldingRangeRequest=exports$1.ColorPresentationRequest=exports$1.DocumentColorRequest=exports$1.ConfigurationRequest=exports$1.DidChangeWorkspaceFoldersNotification=exports$1.WorkspaceFoldersRequest=exports$1.TypeDefinitionRequest=exports$1.ImplementationRequest=exports$1.ApplyWorkspaceEditRequest=exports$1.ExecuteCommandRequest=exports$1.PrepareRenameRequest=exports$1.RenameRequest=exports$1.PrepareSupportDefaultBehavior=exports$1.DocumentOnTypeFormattingRequest=exports$1.DocumentRangesFormattingRequest=exports$1.DocumentRangeFormattingRequest=exports$1.DocumentFormattingRequest=exports$1.DocumentLinkResolveRequest=exports$1.DocumentLinkRequest=exports$1.CodeLensRefreshRequest=exports$1.CodeLensResolveRequest=exports$1.CodeLensRequest=exports$1.WorkspaceSymbolResolveRequest=void 0,exports$1.InlineCompletionRequest=exports$1.DidCloseNotebookDocumentNotification=exports$1.DidSaveNotebookDocumentNotification=exports$1.DidChangeNotebookDocumentNotification=exports$1.NotebookCellArrayChange=exports$1.DidOpenNotebookDocumentNotification=exports$1.NotebookDocumentSyncRegistrationType=exports$1.NotebookDocument=exports$1.NotebookCell=exports$1.ExecutionSummary=exports$1.NotebookCellKind=exports$1.DiagnosticRefreshRequest=exports$1.WorkspaceDiagnosticRequest=exports$1.DocumentDiagnosticRequest=exports$1.DocumentDiagnosticReportKind=exports$1.DiagnosticServerCancellationData=exports$1.InlayHintRefreshRequest=exports$1.InlayHintResolveRequest=exports$1.InlayHintRequest=exports$1.InlineValueRefreshRequest=exports$1.InlineValueRequest=exports$1.TypeHierarchySupertypesRequest=exports$1.TypeHierarchySubtypesRequest=exports$1.TypeHierarchyPrepareRequest=void 0;const messages_1=requireMessages(),vscode_languageserver_types_1=require$$1,Is2=requireIs(),protocol_implementation_1=function(){if(hasRequiredProtocol_implementation)return protocol_implementation;hasRequiredProtocol_implementation=1,Object.defineProperty(protocol_implementation,"__esModule",{value:!0}),protocol_implementation.ImplementationRequest=void 0;const messages_1=requireMessages();var ImplementationRequest,ImplementationRequest2;return(ImplementationRequest2=ImplementationRequest||(protocol_implementation.ImplementationRequest=ImplementationRequest={})).method="textDocument/implementation",ImplementationRequest2.messageDirection=messages_1.MessageDirection.clientToServer,ImplementationRequest2.type=new messages_1.ProtocolRequestType(ImplementationRequest2.method),protocol_implementation}();Object.defineProperty(exports$1,"ImplementationRequest",{enumerable:!0,get:function(){return protocol_implementation_1.ImplementationRequest}});const protocol_typeDefinition_1=function(){if(hasRequiredProtocol_typeDefinition)return protocol_typeDefinition;hasRequiredProtocol_typeDefinition=1,Object.defineProperty(protocol_typeDefinition,"__esModule",{value:!0}),protocol_typeDefinition.TypeDefinitionRequest=void 0;const messages_1=requireMessages();var TypeDefinitionRequest,TypeDefinitionRequest2;return(TypeDefinitionRequest2=TypeDefinitionRequest||(protocol_typeDefinition.TypeDefinitionRequest=TypeDefinitionRequest={})).method="textDocument/typeDefinition",TypeDefinitionRequest2.messageDirection=messages_1.MessageDirection.clientToServer,TypeDefinitionRequest2.type=new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method),protocol_typeDefinition}();Object.defineProperty(exports$1,"TypeDefinitionRequest",{enumerable:!0,get:function(){return protocol_typeDefinition_1.TypeDefinitionRequest}});const protocol_workspaceFolder_1=function(){if(hasRequiredProtocol_workspaceFolder)return protocol_workspaceFolder;hasRequiredProtocol_workspaceFolder=1,Object.defineProperty(protocol_workspaceFolder,"__esModule",{value:!0}),protocol_workspaceFolder.DidChangeWorkspaceFoldersNotification=protocol_workspaceFolder.WorkspaceFoldersRequest=void 0;const messages_1=requireMessages();var WorkspaceFoldersRequest,WorkspaceFoldersRequest2,DidChangeWorkspaceFoldersNotification,DidChangeWorkspaceFoldersNotification2;return(WorkspaceFoldersRequest2=WorkspaceFoldersRequest||(protocol_workspaceFolder.WorkspaceFoldersRequest=WorkspaceFoldersRequest={})).method="workspace/workspaceFolders",WorkspaceFoldersRequest2.messageDirection=messages_1.MessageDirection.serverToClient,WorkspaceFoldersRequest2.type=new messages_1.ProtocolRequestType0(WorkspaceFoldersRequest2.method),(DidChangeWorkspaceFoldersNotification2=DidChangeWorkspaceFoldersNotification||(protocol_workspaceFolder.DidChangeWorkspaceFoldersNotification=DidChangeWorkspaceFoldersNotification={})).method="workspace/didChangeWorkspaceFolders",DidChangeWorkspaceFoldersNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidChangeWorkspaceFoldersNotification2.type=new messages_1.ProtocolNotificationType(DidChangeWorkspaceFoldersNotification2.method),protocol_workspaceFolder}();Object.defineProperty(exports$1,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return protocol_workspaceFolder_1.WorkspaceFoldersRequest}}),Object.defineProperty(exports$1,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return protocol_workspaceFolder_1.DidChangeWorkspaceFoldersNotification}});const protocol_configuration_1=function(){if(hasRequiredProtocol_configuration)return protocol_configuration;hasRequiredProtocol_configuration=1,Object.defineProperty(protocol_configuration,"__esModule",{value:!0}),protocol_configuration.ConfigurationRequest=void 0;const messages_1=requireMessages();var ConfigurationRequest,ConfigurationRequest2;return(ConfigurationRequest2=ConfigurationRequest||(protocol_configuration.ConfigurationRequest=ConfigurationRequest={})).method="workspace/configuration",ConfigurationRequest2.messageDirection=messages_1.MessageDirection.serverToClient,ConfigurationRequest2.type=new messages_1.ProtocolRequestType(ConfigurationRequest2.method),protocol_configuration}();Object.defineProperty(exports$1,"ConfigurationRequest",{enumerable:!0,get:function(){return protocol_configuration_1.ConfigurationRequest}});const protocol_colorProvider_1=function(){if(hasRequiredProtocol_colorProvider)return protocol_colorProvider;hasRequiredProtocol_colorProvider=1,Object.defineProperty(protocol_colorProvider,"__esModule",{value:!0}),protocol_colorProvider.ColorPresentationRequest=protocol_colorProvider.DocumentColorRequest=void 0;const messages_1=requireMessages();var DocumentColorRequest,DocumentColorRequest2,ColorPresentationRequest,ColorPresentationRequest2;return(DocumentColorRequest2=DocumentColorRequest||(protocol_colorProvider.DocumentColorRequest=DocumentColorRequest={})).method="textDocument/documentColor",DocumentColorRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentColorRequest2.type=new messages_1.ProtocolRequestType(DocumentColorRequest2.method),(ColorPresentationRequest2=ColorPresentationRequest||(protocol_colorProvider.ColorPresentationRequest=ColorPresentationRequest={})).method="textDocument/colorPresentation",ColorPresentationRequest2.messageDirection=messages_1.MessageDirection.clientToServer,ColorPresentationRequest2.type=new messages_1.ProtocolRequestType(ColorPresentationRequest2.method),protocol_colorProvider}();Object.defineProperty(exports$1,"DocumentColorRequest",{enumerable:!0,get:function(){return protocol_colorProvider_1.DocumentColorRequest}}),Object.defineProperty(exports$1,"ColorPresentationRequest",{enumerable:!0,get:function(){return protocol_colorProvider_1.ColorPresentationRequest}});const protocol_foldingRange_1=function(){if(hasRequiredProtocol_foldingRange)return protocol_foldingRange;hasRequiredProtocol_foldingRange=1,Object.defineProperty(protocol_foldingRange,"__esModule",{value:!0}),protocol_foldingRange.FoldingRangeRefreshRequest=protocol_foldingRange.FoldingRangeRequest=void 0;const messages_1=requireMessages();var FoldingRangeRequest,FoldingRangeRequest2,FoldingRangeRefreshRequest,FoldingRangeRefreshRequest2;return(FoldingRangeRequest2=FoldingRangeRequest||(protocol_foldingRange.FoldingRangeRequest=FoldingRangeRequest={})).method="textDocument/foldingRange",FoldingRangeRequest2.messageDirection=messages_1.MessageDirection.clientToServer,FoldingRangeRequest2.type=new messages_1.ProtocolRequestType(FoldingRangeRequest2.method),(FoldingRangeRefreshRequest2=FoldingRangeRefreshRequest||(protocol_foldingRange.FoldingRangeRefreshRequest=FoldingRangeRefreshRequest={})).method="workspace/foldingRange/refresh",FoldingRangeRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,FoldingRangeRefreshRequest2.type=new messages_1.ProtocolRequestType0(FoldingRangeRefreshRequest2.method),protocol_foldingRange}();Object.defineProperty(exports$1,"FoldingRangeRequest",{enumerable:!0,get:function(){return protocol_foldingRange_1.FoldingRangeRequest}}),Object.defineProperty(exports$1,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return protocol_foldingRange_1.FoldingRangeRefreshRequest}});const protocol_declaration_1=function(){if(hasRequiredProtocol_declaration)return protocol_declaration;hasRequiredProtocol_declaration=1,Object.defineProperty(protocol_declaration,"__esModule",{value:!0}),protocol_declaration.DeclarationRequest=void 0;const messages_1=requireMessages();var DeclarationRequest,DeclarationRequest2;return(DeclarationRequest2=DeclarationRequest||(protocol_declaration.DeclarationRequest=DeclarationRequest={})).method="textDocument/declaration",DeclarationRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DeclarationRequest2.type=new messages_1.ProtocolRequestType(DeclarationRequest2.method),protocol_declaration}();Object.defineProperty(exports$1,"DeclarationRequest",{enumerable:!0,get:function(){return protocol_declaration_1.DeclarationRequest}});const protocol_selectionRange_1=function(){if(hasRequiredProtocol_selectionRange)return protocol_selectionRange;hasRequiredProtocol_selectionRange=1,Object.defineProperty(protocol_selectionRange,"__esModule",{value:!0}),protocol_selectionRange.SelectionRangeRequest=void 0;const messages_1=requireMessages();var SelectionRangeRequest,SelectionRangeRequest2;return(SelectionRangeRequest2=SelectionRangeRequest||(protocol_selectionRange.SelectionRangeRequest=SelectionRangeRequest={})).method="textDocument/selectionRange",SelectionRangeRequest2.messageDirection=messages_1.MessageDirection.clientToServer,SelectionRangeRequest2.type=new messages_1.ProtocolRequestType(SelectionRangeRequest2.method),protocol_selectionRange}();Object.defineProperty(exports$1,"SelectionRangeRequest",{enumerable:!0,get:function(){return protocol_selectionRange_1.SelectionRangeRequest}});const protocol_progress_1=function(){if(hasRequiredProtocol_progress)return protocol_progress;hasRequiredProtocol_progress=1,Object.defineProperty(protocol_progress,"__esModule",{value:!0}),protocol_progress.WorkDoneProgressCancelNotification=protocol_progress.WorkDoneProgressCreateRequest=protocol_progress.WorkDoneProgress=void 0;const vscode_jsonrpc_1=requireMain$1(),messages_1=requireMessages();var WorkDoneProgress,WorkDoneProgress2,WorkDoneProgressCreateRequest,WorkDoneProgressCreateRequest2,WorkDoneProgressCancelNotification,WorkDoneProgressCancelNotification2;return(WorkDoneProgress2=WorkDoneProgress||(protocol_progress.WorkDoneProgress=WorkDoneProgress={})).type=new vscode_jsonrpc_1.ProgressType,WorkDoneProgress2.is=function(value){return value===WorkDoneProgress2.type},(WorkDoneProgressCreateRequest2=WorkDoneProgressCreateRequest||(protocol_progress.WorkDoneProgressCreateRequest=WorkDoneProgressCreateRequest={})).method="window/workDoneProgress/create",WorkDoneProgressCreateRequest2.messageDirection=messages_1.MessageDirection.serverToClient,WorkDoneProgressCreateRequest2.type=new messages_1.ProtocolRequestType(WorkDoneProgressCreateRequest2.method),(WorkDoneProgressCancelNotification2=WorkDoneProgressCancelNotification||(protocol_progress.WorkDoneProgressCancelNotification=WorkDoneProgressCancelNotification={})).method="window/workDoneProgress/cancel",WorkDoneProgressCancelNotification2.messageDirection=messages_1.MessageDirection.clientToServer,WorkDoneProgressCancelNotification2.type=new messages_1.ProtocolNotificationType(WorkDoneProgressCancelNotification2.method),protocol_progress}();Object.defineProperty(exports$1,"WorkDoneProgress",{enumerable:!0,get:function(){return protocol_progress_1.WorkDoneProgress}}),Object.defineProperty(exports$1,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return protocol_progress_1.WorkDoneProgressCreateRequest}}),Object.defineProperty(exports$1,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return protocol_progress_1.WorkDoneProgressCancelNotification}});const protocol_callHierarchy_1=function(){if(hasRequiredProtocol_callHierarchy)return protocol_callHierarchy;hasRequiredProtocol_callHierarchy=1,Object.defineProperty(protocol_callHierarchy,"__esModule",{value:!0}),protocol_callHierarchy.CallHierarchyOutgoingCallsRequest=protocol_callHierarchy.CallHierarchyIncomingCallsRequest=protocol_callHierarchy.CallHierarchyPrepareRequest=void 0;const messages_1=requireMessages();var CallHierarchyPrepareRequest,CallHierarchyPrepareRequest2,CallHierarchyIncomingCallsRequest,CallHierarchyIncomingCallsRequest2,CallHierarchyOutgoingCallsRequest,CallHierarchyOutgoingCallsRequest2;return(CallHierarchyPrepareRequest2=CallHierarchyPrepareRequest||(protocol_callHierarchy.CallHierarchyPrepareRequest=CallHierarchyPrepareRequest={})).method="textDocument/prepareCallHierarchy",CallHierarchyPrepareRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CallHierarchyPrepareRequest2.type=new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method),(CallHierarchyIncomingCallsRequest2=CallHierarchyIncomingCallsRequest||(protocol_callHierarchy.CallHierarchyIncomingCallsRequest=CallHierarchyIncomingCallsRequest={})).method="callHierarchy/incomingCalls",CallHierarchyIncomingCallsRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CallHierarchyIncomingCallsRequest2.type=new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method),(CallHierarchyOutgoingCallsRequest2=CallHierarchyOutgoingCallsRequest||(protocol_callHierarchy.CallHierarchyOutgoingCallsRequest=CallHierarchyOutgoingCallsRequest={})).method="callHierarchy/outgoingCalls",CallHierarchyOutgoingCallsRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CallHierarchyOutgoingCallsRequest2.type=new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method),protocol_callHierarchy}();Object.defineProperty(exports$1,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(exports$1,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(exports$1,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return protocol_callHierarchy_1.CallHierarchyPrepareRequest}});const protocol_semanticTokens_1=function(){if(hasRequiredProtocol_semanticTokens)return protocol_semanticTokens;hasRequiredProtocol_semanticTokens=1,Object.defineProperty(protocol_semanticTokens,"__esModule",{value:!0}),protocol_semanticTokens.SemanticTokensRefreshRequest=protocol_semanticTokens.SemanticTokensRangeRequest=protocol_semanticTokens.SemanticTokensDeltaRequest=protocol_semanticTokens.SemanticTokensRequest=protocol_semanticTokens.SemanticTokensRegistrationType=protocol_semanticTokens.TokenFormat=void 0;const messages_1=requireMessages();var TokenFormat,SemanticTokensRegistrationType,SemanticTokensRegistrationType2,SemanticTokensRequest,SemanticTokensRequest2,SemanticTokensDeltaRequest,SemanticTokensDeltaRequest2,SemanticTokensRangeRequest,SemanticTokensRangeRequest2,SemanticTokensRefreshRequest,SemanticTokensRefreshRequest2;return(TokenFormat||(protocol_semanticTokens.TokenFormat=TokenFormat={})).Relative="relative",(SemanticTokensRegistrationType2=SemanticTokensRegistrationType||(protocol_semanticTokens.SemanticTokensRegistrationType=SemanticTokensRegistrationType={})).method="textDocument/semanticTokens",SemanticTokensRegistrationType2.type=new messages_1.RegistrationType(SemanticTokensRegistrationType2.method),(SemanticTokensRequest2=SemanticTokensRequest||(protocol_semanticTokens.SemanticTokensRequest=SemanticTokensRequest={})).method="textDocument/semanticTokens/full",SemanticTokensRequest2.messageDirection=messages_1.MessageDirection.clientToServer,SemanticTokensRequest2.type=new messages_1.ProtocolRequestType(SemanticTokensRequest2.method),SemanticTokensRequest2.registrationMethod=SemanticTokensRegistrationType.method,(SemanticTokensDeltaRequest2=SemanticTokensDeltaRequest||(protocol_semanticTokens.SemanticTokensDeltaRequest=SemanticTokensDeltaRequest={})).method="textDocument/semanticTokens/full/delta",SemanticTokensDeltaRequest2.messageDirection=messages_1.MessageDirection.clientToServer,SemanticTokensDeltaRequest2.type=new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method),SemanticTokensDeltaRequest2.registrationMethod=SemanticTokensRegistrationType.method,(SemanticTokensRangeRequest2=SemanticTokensRangeRequest||(protocol_semanticTokens.SemanticTokensRangeRequest=SemanticTokensRangeRequest={})).method="textDocument/semanticTokens/range",SemanticTokensRangeRequest2.messageDirection=messages_1.MessageDirection.clientToServer,SemanticTokensRangeRequest2.type=new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method),SemanticTokensRangeRequest2.registrationMethod=SemanticTokensRegistrationType.method,(SemanticTokensRefreshRequest2=SemanticTokensRefreshRequest||(protocol_semanticTokens.SemanticTokensRefreshRequest=SemanticTokensRefreshRequest={})).method="workspace/semanticTokens/refresh",SemanticTokensRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,SemanticTokensRefreshRequest2.type=new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method),protocol_semanticTokens}();Object.defineProperty(exports$1,"TokenFormat",{enumerable:!0,get:function(){return protocol_semanticTokens_1.TokenFormat}}),Object.defineProperty(exports$1,"SemanticTokensRequest",{enumerable:!0,get:function(){return protocol_semanticTokens_1.SemanticTokensRequest}}),Object.defineProperty(exports$1,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return protocol_semanticTokens_1.SemanticTokensDeltaRequest}}),Object.defineProperty(exports$1,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return protocol_semanticTokens_1.SemanticTokensRangeRequest}}),Object.defineProperty(exports$1,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return protocol_semanticTokens_1.SemanticTokensRefreshRequest}}),Object.defineProperty(exports$1,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return protocol_semanticTokens_1.SemanticTokensRegistrationType}});const protocol_showDocument_1=function(){if(hasRequiredProtocol_showDocument)return protocol_showDocument;hasRequiredProtocol_showDocument=1,Object.defineProperty(protocol_showDocument,"__esModule",{value:!0}),protocol_showDocument.ShowDocumentRequest=void 0;const messages_1=requireMessages();var ShowDocumentRequest,ShowDocumentRequest2;return(ShowDocumentRequest2=ShowDocumentRequest||(protocol_showDocument.ShowDocumentRequest=ShowDocumentRequest={})).method="window/showDocument",ShowDocumentRequest2.messageDirection=messages_1.MessageDirection.serverToClient,ShowDocumentRequest2.type=new messages_1.ProtocolRequestType(ShowDocumentRequest2.method),protocol_showDocument}();Object.defineProperty(exports$1,"ShowDocumentRequest",{enumerable:!0,get:function(){return protocol_showDocument_1.ShowDocumentRequest}});const protocol_linkedEditingRange_1=function(){if(hasRequiredProtocol_linkedEditingRange)return protocol_linkedEditingRange;hasRequiredProtocol_linkedEditingRange=1,Object.defineProperty(protocol_linkedEditingRange,"__esModule",{value:!0}),protocol_linkedEditingRange.LinkedEditingRangeRequest=void 0;const messages_1=requireMessages();var LinkedEditingRangeRequest,LinkedEditingRangeRequest2;return(LinkedEditingRangeRequest2=LinkedEditingRangeRequest||(protocol_linkedEditingRange.LinkedEditingRangeRequest=LinkedEditingRangeRequest={})).method="textDocument/linkedEditingRange",LinkedEditingRangeRequest2.messageDirection=messages_1.MessageDirection.clientToServer,LinkedEditingRangeRequest2.type=new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method),protocol_linkedEditingRange}();Object.defineProperty(exports$1,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return protocol_linkedEditingRange_1.LinkedEditingRangeRequest}});const protocol_fileOperations_1=function(){if(hasRequiredProtocol_fileOperations)return protocol_fileOperations;hasRequiredProtocol_fileOperations=1,Object.defineProperty(protocol_fileOperations,"__esModule",{value:!0}),protocol_fileOperations.WillDeleteFilesRequest=protocol_fileOperations.DidDeleteFilesNotification=protocol_fileOperations.DidRenameFilesNotification=protocol_fileOperations.WillRenameFilesRequest=protocol_fileOperations.DidCreateFilesNotification=protocol_fileOperations.WillCreateFilesRequest=protocol_fileOperations.FileOperationPatternKind=void 0;const messages_1=requireMessages();var FileOperationPatternKind,FileOperationPatternKind2,WillCreateFilesRequest,WillCreateFilesRequest2,DidCreateFilesNotification,DidCreateFilesNotification2,WillRenameFilesRequest,WillRenameFilesRequest2,DidRenameFilesNotification,DidRenameFilesNotification2,DidDeleteFilesNotification,DidDeleteFilesNotification2,WillDeleteFilesRequest,WillDeleteFilesRequest2;return(FileOperationPatternKind2=FileOperationPatternKind||(protocol_fileOperations.FileOperationPatternKind=FileOperationPatternKind={})).file="file",FileOperationPatternKind2.folder="folder",(WillCreateFilesRequest2=WillCreateFilesRequest||(protocol_fileOperations.WillCreateFilesRequest=WillCreateFilesRequest={})).method="workspace/willCreateFiles",WillCreateFilesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WillCreateFilesRequest2.type=new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method),(DidCreateFilesNotification2=DidCreateFilesNotification||(protocol_fileOperations.DidCreateFilesNotification=DidCreateFilesNotification={})).method="workspace/didCreateFiles",DidCreateFilesNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidCreateFilesNotification2.type=new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method),(WillRenameFilesRequest2=WillRenameFilesRequest||(protocol_fileOperations.WillRenameFilesRequest=WillRenameFilesRequest={})).method="workspace/willRenameFiles",WillRenameFilesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WillRenameFilesRequest2.type=new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method),(DidRenameFilesNotification2=DidRenameFilesNotification||(protocol_fileOperations.DidRenameFilesNotification=DidRenameFilesNotification={})).method="workspace/didRenameFiles",DidRenameFilesNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidRenameFilesNotification2.type=new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method),(DidDeleteFilesNotification2=DidDeleteFilesNotification||(protocol_fileOperations.DidDeleteFilesNotification=DidDeleteFilesNotification={})).method="workspace/didDeleteFiles",DidDeleteFilesNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidDeleteFilesNotification2.type=new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method),(WillDeleteFilesRequest2=WillDeleteFilesRequest||(protocol_fileOperations.WillDeleteFilesRequest=WillDeleteFilesRequest={})).method="workspace/willDeleteFiles",WillDeleteFilesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WillDeleteFilesRequest2.type=new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method),protocol_fileOperations}();Object.defineProperty(exports$1,"FileOperationPatternKind",{enumerable:!0,get:function(){return protocol_fileOperations_1.FileOperationPatternKind}}),Object.defineProperty(exports$1,"DidCreateFilesNotification",{enumerable:!0,get:function(){return protocol_fileOperations_1.DidCreateFilesNotification}}),Object.defineProperty(exports$1,"WillCreateFilesRequest",{enumerable:!0,get:function(){return protocol_fileOperations_1.WillCreateFilesRequest}}),Object.defineProperty(exports$1,"DidRenameFilesNotification",{enumerable:!0,get:function(){return protocol_fileOperations_1.DidRenameFilesNotification}}),Object.defineProperty(exports$1,"WillRenameFilesRequest",{enumerable:!0,get:function(){return protocol_fileOperations_1.WillRenameFilesRequest}}),Object.defineProperty(exports$1,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return protocol_fileOperations_1.DidDeleteFilesNotification}}),Object.defineProperty(exports$1,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return protocol_fileOperations_1.WillDeleteFilesRequest}});const protocol_moniker_1=function(){if(hasRequiredProtocol_moniker)return protocol_moniker;hasRequiredProtocol_moniker=1,Object.defineProperty(protocol_moniker,"__esModule",{value:!0}),protocol_moniker.MonikerRequest=protocol_moniker.MonikerKind=protocol_moniker.UniquenessLevel=void 0;const messages_1=requireMessages();var UniquenessLevel,UniquenessLevel2,MonikerKind,MonikerKind2,MonikerRequest,MonikerRequest2;return(UniquenessLevel2=UniquenessLevel||(protocol_moniker.UniquenessLevel=UniquenessLevel={})).document="document",UniquenessLevel2.project="project",UniquenessLevel2.group="group",UniquenessLevel2.scheme="scheme",UniquenessLevel2.global="global",(MonikerKind2=MonikerKind||(protocol_moniker.MonikerKind=MonikerKind={})).$import="import",MonikerKind2.$export="export",MonikerKind2.local="local",(MonikerRequest2=MonikerRequest||(protocol_moniker.MonikerRequest=MonikerRequest={})).method="textDocument/moniker",MonikerRequest2.messageDirection=messages_1.MessageDirection.clientToServer,MonikerRequest2.type=new messages_1.ProtocolRequestType(MonikerRequest2.method),protocol_moniker}();Object.defineProperty(exports$1,"UniquenessLevel",{enumerable:!0,get:function(){return protocol_moniker_1.UniquenessLevel}}),Object.defineProperty(exports$1,"MonikerKind",{enumerable:!0,get:function(){return protocol_moniker_1.MonikerKind}}),Object.defineProperty(exports$1,"MonikerRequest",{enumerable:!0,get:function(){return protocol_moniker_1.MonikerRequest}});const protocol_typeHierarchy_1=function(){if(hasRequiredProtocol_typeHierarchy)return protocol_typeHierarchy;hasRequiredProtocol_typeHierarchy=1,Object.defineProperty(protocol_typeHierarchy,"__esModule",{value:!0}),protocol_typeHierarchy.TypeHierarchySubtypesRequest=protocol_typeHierarchy.TypeHierarchySupertypesRequest=protocol_typeHierarchy.TypeHierarchyPrepareRequest=void 0;const messages_1=requireMessages();var TypeHierarchyPrepareRequest,TypeHierarchyPrepareRequest2,TypeHierarchySupertypesRequest,TypeHierarchySupertypesRequest2,TypeHierarchySubtypesRequest,TypeHierarchySubtypesRequest2;return(TypeHierarchyPrepareRequest2=TypeHierarchyPrepareRequest||(protocol_typeHierarchy.TypeHierarchyPrepareRequest=TypeHierarchyPrepareRequest={})).method="textDocument/prepareTypeHierarchy",TypeHierarchyPrepareRequest2.messageDirection=messages_1.MessageDirection.clientToServer,TypeHierarchyPrepareRequest2.type=new messages_1.ProtocolRequestType(TypeHierarchyPrepareRequest2.method),(TypeHierarchySupertypesRequest2=TypeHierarchySupertypesRequest||(protocol_typeHierarchy.TypeHierarchySupertypesRequest=TypeHierarchySupertypesRequest={})).method="typeHierarchy/supertypes",TypeHierarchySupertypesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,TypeHierarchySupertypesRequest2.type=new messages_1.ProtocolRequestType(TypeHierarchySupertypesRequest2.method),(TypeHierarchySubtypesRequest2=TypeHierarchySubtypesRequest||(protocol_typeHierarchy.TypeHierarchySubtypesRequest=TypeHierarchySubtypesRequest={})).method="typeHierarchy/subtypes",TypeHierarchySubtypesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,TypeHierarchySubtypesRequest2.type=new messages_1.ProtocolRequestType(TypeHierarchySubtypesRequest2.method),protocol_typeHierarchy}();Object.defineProperty(exports$1,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return protocol_typeHierarchy_1.TypeHierarchyPrepareRequest}}),Object.defineProperty(exports$1,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return protocol_typeHierarchy_1.TypeHierarchySubtypesRequest}}),Object.defineProperty(exports$1,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return protocol_typeHierarchy_1.TypeHierarchySupertypesRequest}});const protocol_inlineValue_1=function(){if(hasRequiredProtocol_inlineValue)return protocol_inlineValue;hasRequiredProtocol_inlineValue=1,Object.defineProperty(protocol_inlineValue,"__esModule",{value:!0}),protocol_inlineValue.InlineValueRefreshRequest=protocol_inlineValue.InlineValueRequest=void 0;const messages_1=requireMessages();var InlineValueRequest,InlineValueRequest2,InlineValueRefreshRequest,InlineValueRefreshRequest2;return(InlineValueRequest2=InlineValueRequest||(protocol_inlineValue.InlineValueRequest=InlineValueRequest={})).method="textDocument/inlineValue",InlineValueRequest2.messageDirection=messages_1.MessageDirection.clientToServer,InlineValueRequest2.type=new messages_1.ProtocolRequestType(InlineValueRequest2.method),(InlineValueRefreshRequest2=InlineValueRefreshRequest||(protocol_inlineValue.InlineValueRefreshRequest=InlineValueRefreshRequest={})).method="workspace/inlineValue/refresh",InlineValueRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,InlineValueRefreshRequest2.type=new messages_1.ProtocolRequestType0(InlineValueRefreshRequest2.method),protocol_inlineValue}();Object.defineProperty(exports$1,"InlineValueRequest",{enumerable:!0,get:function(){return protocol_inlineValue_1.InlineValueRequest}}),Object.defineProperty(exports$1,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return protocol_inlineValue_1.InlineValueRefreshRequest}});const protocol_inlayHint_1=function(){if(hasRequiredProtocol_inlayHint)return protocol_inlayHint;hasRequiredProtocol_inlayHint=1,Object.defineProperty(protocol_inlayHint,"__esModule",{value:!0}),protocol_inlayHint.InlayHintRefreshRequest=protocol_inlayHint.InlayHintResolveRequest=protocol_inlayHint.InlayHintRequest=void 0;const messages_1=requireMessages();var InlayHintRequest,InlayHintRequest2,InlayHintResolveRequest,InlayHintResolveRequest2,InlayHintRefreshRequest,InlayHintRefreshRequest2;return(InlayHintRequest2=InlayHintRequest||(protocol_inlayHint.InlayHintRequest=InlayHintRequest={})).method="textDocument/inlayHint",InlayHintRequest2.messageDirection=messages_1.MessageDirection.clientToServer,InlayHintRequest2.type=new messages_1.ProtocolRequestType(InlayHintRequest2.method),(InlayHintResolveRequest2=InlayHintResolveRequest||(protocol_inlayHint.InlayHintResolveRequest=InlayHintResolveRequest={})).method="inlayHint/resolve",InlayHintResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,InlayHintResolveRequest2.type=new messages_1.ProtocolRequestType(InlayHintResolveRequest2.method),(InlayHintRefreshRequest2=InlayHintRefreshRequest||(protocol_inlayHint.InlayHintRefreshRequest=InlayHintRefreshRequest={})).method="workspace/inlayHint/refresh",InlayHintRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,InlayHintRefreshRequest2.type=new messages_1.ProtocolRequestType0(InlayHintRefreshRequest2.method),protocol_inlayHint}();Object.defineProperty(exports$1,"InlayHintRequest",{enumerable:!0,get:function(){return protocol_inlayHint_1.InlayHintRequest}}),Object.defineProperty(exports$1,"InlayHintResolveRequest",{enumerable:!0,get:function(){return protocol_inlayHint_1.InlayHintResolveRequest}}),Object.defineProperty(exports$1,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return protocol_inlayHint_1.InlayHintRefreshRequest}});const protocol_diagnostic_1=function(){if(hasRequiredProtocol_diagnostic)return protocol_diagnostic;hasRequiredProtocol_diagnostic=1,Object.defineProperty(protocol_diagnostic,"__esModule",{value:!0}),protocol_diagnostic.DiagnosticRefreshRequest=protocol_diagnostic.WorkspaceDiagnosticRequest=protocol_diagnostic.DocumentDiagnosticRequest=protocol_diagnostic.DocumentDiagnosticReportKind=protocol_diagnostic.DiagnosticServerCancellationData=void 0;const vscode_jsonrpc_1=requireMain$1(),Is2=requireIs(),messages_1=requireMessages();var DiagnosticServerCancellationData,DocumentDiagnosticReportKind,DocumentDiagnosticReportKind2,DocumentDiagnosticRequest,DocumentDiagnosticRequest2,WorkspaceDiagnosticRequest,WorkspaceDiagnosticRequest2,DiagnosticRefreshRequest,DiagnosticRefreshRequest2;return(DiagnosticServerCancellationData||(protocol_diagnostic.DiagnosticServerCancellationData=DiagnosticServerCancellationData={})).is=function(value){const candidate=value;return candidate&&Is2.boolean(candidate.retriggerRequest)},(DocumentDiagnosticReportKind2=DocumentDiagnosticReportKind||(protocol_diagnostic.DocumentDiagnosticReportKind=DocumentDiagnosticReportKind={})).Full="full",DocumentDiagnosticReportKind2.Unchanged="unchanged",(DocumentDiagnosticRequest2=DocumentDiagnosticRequest||(protocol_diagnostic.DocumentDiagnosticRequest=DocumentDiagnosticRequest={})).method="textDocument/diagnostic",DocumentDiagnosticRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentDiagnosticRequest2.type=new messages_1.ProtocolRequestType(DocumentDiagnosticRequest2.method),DocumentDiagnosticRequest2.partialResult=new vscode_jsonrpc_1.ProgressType,(WorkspaceDiagnosticRequest2=WorkspaceDiagnosticRequest||(protocol_diagnostic.WorkspaceDiagnosticRequest=WorkspaceDiagnosticRequest={})).method="workspace/diagnostic",WorkspaceDiagnosticRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WorkspaceDiagnosticRequest2.type=new messages_1.ProtocolRequestType(WorkspaceDiagnosticRequest2.method),WorkspaceDiagnosticRequest2.partialResult=new vscode_jsonrpc_1.ProgressType,(DiagnosticRefreshRequest2=DiagnosticRefreshRequest||(protocol_diagnostic.DiagnosticRefreshRequest=DiagnosticRefreshRequest={})).method="workspace/diagnostic/refresh",DiagnosticRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,DiagnosticRefreshRequest2.type=new messages_1.ProtocolRequestType0(DiagnosticRefreshRequest2.method),protocol_diagnostic}();Object.defineProperty(exports$1,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return protocol_diagnostic_1.DiagnosticServerCancellationData}}),Object.defineProperty(exports$1,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return protocol_diagnostic_1.DocumentDiagnosticReportKind}}),Object.defineProperty(exports$1,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return protocol_diagnostic_1.DocumentDiagnosticRequest}}),Object.defineProperty(exports$1,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return protocol_diagnostic_1.WorkspaceDiagnosticRequest}}),Object.defineProperty(exports$1,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return protocol_diagnostic_1.DiagnosticRefreshRequest}});const protocol_notebook_1=requireProtocol_notebook();Object.defineProperty(exports$1,"NotebookCellKind",{enumerable:!0,get:function(){return protocol_notebook_1.NotebookCellKind}}),Object.defineProperty(exports$1,"ExecutionSummary",{enumerable:!0,get:function(){return protocol_notebook_1.ExecutionSummary}}),Object.defineProperty(exports$1,"NotebookCell",{enumerable:!0,get:function(){return protocol_notebook_1.NotebookCell}}),Object.defineProperty(exports$1,"NotebookDocument",{enumerable:!0,get:function(){return protocol_notebook_1.NotebookDocument}}),Object.defineProperty(exports$1,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return protocol_notebook_1.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(exports$1,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return protocol_notebook_1.DidOpenNotebookDocumentNotification}}),Object.defineProperty(exports$1,"NotebookCellArrayChange",{enumerable:!0,get:function(){return protocol_notebook_1.NotebookCellArrayChange}}),Object.defineProperty(exports$1,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return protocol_notebook_1.DidChangeNotebookDocumentNotification}}),Object.defineProperty(exports$1,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return protocol_notebook_1.DidSaveNotebookDocumentNotification}}),Object.defineProperty(exports$1,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return protocol_notebook_1.DidCloseNotebookDocumentNotification}});const protocol_inlineCompletion_1=function(){if(hasRequiredProtocol_inlineCompletion)return protocol_inlineCompletion;hasRequiredProtocol_inlineCompletion=1,Object.defineProperty(protocol_inlineCompletion,"__esModule",{value:!0}),protocol_inlineCompletion.InlineCompletionRequest=void 0;const messages_1=requireMessages();var InlineCompletionRequest,InlineCompletionRequest2;return(InlineCompletionRequest2=InlineCompletionRequest||(protocol_inlineCompletion.InlineCompletionRequest=InlineCompletionRequest={})).method="textDocument/inlineCompletion",InlineCompletionRequest2.messageDirection=messages_1.MessageDirection.clientToServer,InlineCompletionRequest2.type=new messages_1.ProtocolRequestType(InlineCompletionRequest2.method),protocol_inlineCompletion}();var TextDocumentFilter,NotebookDocumentFilter,NotebookCellTextDocumentFilter,DocumentSelector,RegistrationRequest,RegistrationRequest2,UnregistrationRequest,UnregistrationRequest2,ResourceOperationKind,ResourceOperationKind2,FailureHandlingKind,FailureHandlingKind2,PositionEncodingKind,PositionEncodingKind2,StaticRegistrationOptions,TextDocumentRegistrationOptions,WorkDoneProgressOptions,WorkDoneProgressOptions2,InitializeRequest,InitializeRequest2,InitializeErrorCodes,InitializedNotification,InitializedNotification2,ShutdownRequest,ShutdownRequest2,ExitNotification,ExitNotification2,DidChangeConfigurationNotification,DidChangeConfigurationNotification2,MessageType,MessageType2,ShowMessageNotification,ShowMessageNotification2,ShowMessageRequest,ShowMessageRequest2,LogMessageNotification,LogMessageNotification2,TelemetryEventNotification,TelemetryEventNotification2,TextDocumentSyncKind,TextDocumentSyncKind2,DidOpenTextDocumentNotification,DidOpenTextDocumentNotification2,TextDocumentContentChangeEvent,TextDocumentContentChangeEvent2,DidChangeTextDocumentNotification,DidChangeTextDocumentNotification2,DidCloseTextDocumentNotification,DidCloseTextDocumentNotification2,DidSaveTextDocumentNotification,DidSaveTextDocumentNotification2,TextDocumentSaveReason,TextDocumentSaveReason2,WillSaveTextDocumentNotification,WillSaveTextDocumentNotification2,WillSaveTextDocumentWaitUntilRequest,WillSaveTextDocumentWaitUntilRequest2,DidChangeWatchedFilesNotification,DidChangeWatchedFilesNotification2,FileChangeType,FileChangeType2,RelativePattern,WatchKind,WatchKind2,PublishDiagnosticsNotification,PublishDiagnosticsNotification2,CompletionTriggerKind,CompletionTriggerKind2,CompletionRequest,CompletionRequest2,CompletionResolveRequest,CompletionResolveRequest2,HoverRequest,HoverRequest2,SignatureHelpTriggerKind,SignatureHelpTriggerKind2,SignatureHelpRequest,SignatureHelpRequest2,DefinitionRequest,DefinitionRequest2,ReferencesRequest,ReferencesRequest2,DocumentHighlightRequest,DocumentHighlightRequest2,DocumentSymbolRequest,DocumentSymbolRequest2,CodeActionRequest,CodeActionRequest2,CodeActionResolveRequest,CodeActionResolveRequest2,WorkspaceSymbolRequest,WorkspaceSymbolRequest2,WorkspaceSymbolResolveRequest,WorkspaceSymbolResolveRequest2,CodeLensRequest,CodeLensRequest2,CodeLensResolveRequest,CodeLensResolveRequest2,CodeLensRefreshRequest,CodeLensRefreshRequest2,DocumentLinkRequest,DocumentLinkRequest2,DocumentLinkResolveRequest,DocumentLinkResolveRequest2,DocumentFormattingRequest,DocumentFormattingRequest2,DocumentRangeFormattingRequest,DocumentRangeFormattingRequest2,DocumentRangesFormattingRequest,DocumentRangesFormattingRequest2,DocumentOnTypeFormattingRequest,DocumentOnTypeFormattingRequest2,PrepareSupportDefaultBehavior,RenameRequest,RenameRequest2,PrepareRenameRequest,PrepareRenameRequest2,ExecuteCommandRequest,ExecuteCommandRequest2,ApplyWorkspaceEditRequest,ApplyWorkspaceEditRequest2;Object.defineProperty(exports$1,"InlineCompletionRequest",{enumerable:!0,get:function(){return protocol_inlineCompletion_1.InlineCompletionRequest}}),(TextDocumentFilter||(exports$1.TextDocumentFilter=TextDocumentFilter={})).is=function(value){const candidate=value;return Is2.string(candidate)||Is2.string(candidate.language)||Is2.string(candidate.scheme)||Is2.string(candidate.pattern)},(NotebookDocumentFilter||(exports$1.NotebookDocumentFilter=NotebookDocumentFilter={})).is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&(Is2.string(candidate.notebookType)||Is2.string(candidate.scheme)||Is2.string(candidate.pattern))},(NotebookCellTextDocumentFilter||(exports$1.NotebookCellTextDocumentFilter=NotebookCellTextDocumentFilter={})).is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&(Is2.string(candidate.notebook)||NotebookDocumentFilter.is(candidate.notebook))&&(void 0===candidate.language||Is2.string(candidate.language))},(DocumentSelector||(exports$1.DocumentSelector=DocumentSelector={})).is=function(value){if(!Array.isArray(value))return!1;for(let elem of value)if(!Is2.string(elem)&&!TextDocumentFilter.is(elem)&&!NotebookCellTextDocumentFilter.is(elem))return!1;return!0},(RegistrationRequest2=RegistrationRequest||(exports$1.RegistrationRequest=RegistrationRequest={})).method="client/registerCapability",RegistrationRequest2.messageDirection=messages_1.MessageDirection.serverToClient,RegistrationRequest2.type=new messages_1.ProtocolRequestType(RegistrationRequest2.method),(UnregistrationRequest2=UnregistrationRequest||(exports$1.UnregistrationRequest=UnregistrationRequest={})).method="client/unregisterCapability",UnregistrationRequest2.messageDirection=messages_1.MessageDirection.serverToClient,UnregistrationRequest2.type=new messages_1.ProtocolRequestType(UnregistrationRequest2.method),(ResourceOperationKind2=ResourceOperationKind||(exports$1.ResourceOperationKind=ResourceOperationKind={})).Create="create",ResourceOperationKind2.Rename="rename",ResourceOperationKind2.Delete="delete",(FailureHandlingKind2=FailureHandlingKind||(exports$1.FailureHandlingKind=FailureHandlingKind={})).Abort="abort",FailureHandlingKind2.Transactional="transactional",FailureHandlingKind2.TextOnlyTransactional="textOnlyTransactional",FailureHandlingKind2.Undo="undo",(PositionEncodingKind2=PositionEncodingKind||(exports$1.PositionEncodingKind=PositionEncodingKind={})).UTF8="utf-8",PositionEncodingKind2.UTF16="utf-16",PositionEncodingKind2.UTF32="utf-32",(StaticRegistrationOptions||(exports$1.StaticRegistrationOptions=StaticRegistrationOptions={})).hasId=function(value){const candidate=value;return candidate&&Is2.string(candidate.id)&&candidate.id.length>0},(TextDocumentRegistrationOptions||(exports$1.TextDocumentRegistrationOptions=TextDocumentRegistrationOptions={})).is=function(value){const candidate=value;return candidate&&(null===candidate.documentSelector||DocumentSelector.is(candidate.documentSelector))},(WorkDoneProgressOptions2=WorkDoneProgressOptions||(exports$1.WorkDoneProgressOptions=WorkDoneProgressOptions={})).is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&(void 0===candidate.workDoneProgress||Is2.boolean(candidate.workDoneProgress))},WorkDoneProgressOptions2.hasWorkDoneProgress=function(value){const candidate=value;return candidate&&Is2.boolean(candidate.workDoneProgress)},(InitializeRequest2=InitializeRequest||(exports$1.InitializeRequest=InitializeRequest={})).method="initialize",InitializeRequest2.messageDirection=messages_1.MessageDirection.clientToServer,InitializeRequest2.type=new messages_1.ProtocolRequestType(InitializeRequest2.method),(InitializeErrorCodes||(exports$1.InitializeErrorCodes=InitializeErrorCodes={})).unknownProtocolVersion=1,(InitializedNotification2=InitializedNotification||(exports$1.InitializedNotification=InitializedNotification={})).method="initialized",InitializedNotification2.messageDirection=messages_1.MessageDirection.clientToServer,InitializedNotification2.type=new messages_1.ProtocolNotificationType(InitializedNotification2.method),(ShutdownRequest2=ShutdownRequest||(exports$1.ShutdownRequest=ShutdownRequest={})).method="shutdown",ShutdownRequest2.messageDirection=messages_1.MessageDirection.clientToServer,ShutdownRequest2.type=new messages_1.ProtocolRequestType0(ShutdownRequest2.method),(ExitNotification2=ExitNotification||(exports$1.ExitNotification=ExitNotification={})).method="exit",ExitNotification2.messageDirection=messages_1.MessageDirection.clientToServer,ExitNotification2.type=new messages_1.ProtocolNotificationType0(ExitNotification2.method),(DidChangeConfigurationNotification2=DidChangeConfigurationNotification||(exports$1.DidChangeConfigurationNotification=DidChangeConfigurationNotification={})).method="workspace/didChangeConfiguration",DidChangeConfigurationNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidChangeConfigurationNotification2.type=new messages_1.ProtocolNotificationType(DidChangeConfigurationNotification2.method),(MessageType2=MessageType||(exports$1.MessageType=MessageType={})).Error=1,MessageType2.Warning=2,MessageType2.Info=3,MessageType2.Log=4,MessageType2.Debug=5,(ShowMessageNotification2=ShowMessageNotification||(exports$1.ShowMessageNotification=ShowMessageNotification={})).method="window/showMessage",ShowMessageNotification2.messageDirection=messages_1.MessageDirection.serverToClient,ShowMessageNotification2.type=new messages_1.ProtocolNotificationType(ShowMessageNotification2.method),(ShowMessageRequest2=ShowMessageRequest||(exports$1.ShowMessageRequest=ShowMessageRequest={})).method="window/showMessageRequest",ShowMessageRequest2.messageDirection=messages_1.MessageDirection.serverToClient,ShowMessageRequest2.type=new messages_1.ProtocolRequestType(ShowMessageRequest2.method),(LogMessageNotification2=LogMessageNotification||(exports$1.LogMessageNotification=LogMessageNotification={})).method="window/logMessage",LogMessageNotification2.messageDirection=messages_1.MessageDirection.serverToClient,LogMessageNotification2.type=new messages_1.ProtocolNotificationType(LogMessageNotification2.method),(TelemetryEventNotification2=TelemetryEventNotification||(exports$1.TelemetryEventNotification=TelemetryEventNotification={})).method="telemetry/event",TelemetryEventNotification2.messageDirection=messages_1.MessageDirection.serverToClient,TelemetryEventNotification2.type=new messages_1.ProtocolNotificationType(TelemetryEventNotification2.method),(TextDocumentSyncKind2=TextDocumentSyncKind||(exports$1.TextDocumentSyncKind=TextDocumentSyncKind={})).None=0,TextDocumentSyncKind2.Full=1,TextDocumentSyncKind2.Incremental=2,(DidOpenTextDocumentNotification2=DidOpenTextDocumentNotification||(exports$1.DidOpenTextDocumentNotification=DidOpenTextDocumentNotification={})).method="textDocument/didOpen",DidOpenTextDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidOpenTextDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification2.method),(TextDocumentContentChangeEvent2=TextDocumentContentChangeEvent||(exports$1.TextDocumentContentChangeEvent=TextDocumentContentChangeEvent={})).isIncremental=function(event){let candidate=event;return null!=candidate&&"string"==typeof candidate.text&&void 0!==candidate.range&&(void 0===candidate.rangeLength||"number"==typeof candidate.rangeLength)},TextDocumentContentChangeEvent2.isFull=function(event){let candidate=event;return null!=candidate&&"string"==typeof candidate.text&&void 0===candidate.range&&void 0===candidate.rangeLength},(DidChangeTextDocumentNotification2=DidChangeTextDocumentNotification||(exports$1.DidChangeTextDocumentNotification=DidChangeTextDocumentNotification={})).method="textDocument/didChange",DidChangeTextDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidChangeTextDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification2.method),(DidCloseTextDocumentNotification2=DidCloseTextDocumentNotification||(exports$1.DidCloseTextDocumentNotification=DidCloseTextDocumentNotification={})).method="textDocument/didClose",DidCloseTextDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidCloseTextDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification2.method),(DidSaveTextDocumentNotification2=DidSaveTextDocumentNotification||(exports$1.DidSaveTextDocumentNotification=DidSaveTextDocumentNotification={})).method="textDocument/didSave",DidSaveTextDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidSaveTextDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method),(TextDocumentSaveReason2=TextDocumentSaveReason||(exports$1.TextDocumentSaveReason=TextDocumentSaveReason={})).Manual=1,TextDocumentSaveReason2.AfterDelay=2,TextDocumentSaveReason2.FocusOut=3,(WillSaveTextDocumentNotification2=WillSaveTextDocumentNotification||(exports$1.WillSaveTextDocumentNotification=WillSaveTextDocumentNotification={})).method="textDocument/willSave",WillSaveTextDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,WillSaveTextDocumentNotification2.type=new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method),(WillSaveTextDocumentWaitUntilRequest2=WillSaveTextDocumentWaitUntilRequest||(exports$1.WillSaveTextDocumentWaitUntilRequest=WillSaveTextDocumentWaitUntilRequest={})).method="textDocument/willSaveWaitUntil",WillSaveTextDocumentWaitUntilRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WillSaveTextDocumentWaitUntilRequest2.type=new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method),(DidChangeWatchedFilesNotification2=DidChangeWatchedFilesNotification||(exports$1.DidChangeWatchedFilesNotification=DidChangeWatchedFilesNotification={})).method="workspace/didChangeWatchedFiles",DidChangeWatchedFilesNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidChangeWatchedFilesNotification2.type=new messages_1.ProtocolNotificationType(DidChangeWatchedFilesNotification2.method),(FileChangeType2=FileChangeType||(exports$1.FileChangeType=FileChangeType={})).Created=1,FileChangeType2.Changed=2,FileChangeType2.Deleted=3,(RelativePattern||(exports$1.RelativePattern=RelativePattern={})).is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&(vscode_languageserver_types_1.URI.is(candidate.baseUri)||vscode_languageserver_types_1.WorkspaceFolder.is(candidate.baseUri))&&Is2.string(candidate.pattern)},(WatchKind2=WatchKind||(exports$1.WatchKind=WatchKind={})).Create=1,WatchKind2.Change=2,WatchKind2.Delete=4,(PublishDiagnosticsNotification2=PublishDiagnosticsNotification||(exports$1.PublishDiagnosticsNotification=PublishDiagnosticsNotification={})).method="textDocument/publishDiagnostics",PublishDiagnosticsNotification2.messageDirection=messages_1.MessageDirection.serverToClient,PublishDiagnosticsNotification2.type=new messages_1.ProtocolNotificationType(PublishDiagnosticsNotification2.method),(CompletionTriggerKind2=CompletionTriggerKind||(exports$1.CompletionTriggerKind=CompletionTriggerKind={})).Invoked=1,CompletionTriggerKind2.TriggerCharacter=2,CompletionTriggerKind2.TriggerForIncompleteCompletions=3,(CompletionRequest2=CompletionRequest||(exports$1.CompletionRequest=CompletionRequest={})).method="textDocument/completion",CompletionRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CompletionRequest2.type=new messages_1.ProtocolRequestType(CompletionRequest2.method),(CompletionResolveRequest2=CompletionResolveRequest||(exports$1.CompletionResolveRequest=CompletionResolveRequest={})).method="completionItem/resolve",CompletionResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CompletionResolveRequest2.type=new messages_1.ProtocolRequestType(CompletionResolveRequest2.method),(HoverRequest2=HoverRequest||(exports$1.HoverRequest=HoverRequest={})).method="textDocument/hover",HoverRequest2.messageDirection=messages_1.MessageDirection.clientToServer,HoverRequest2.type=new messages_1.ProtocolRequestType(HoverRequest2.method),(SignatureHelpTriggerKind2=SignatureHelpTriggerKind||(exports$1.SignatureHelpTriggerKind=SignatureHelpTriggerKind={})).Invoked=1,SignatureHelpTriggerKind2.TriggerCharacter=2,SignatureHelpTriggerKind2.ContentChange=3,(SignatureHelpRequest2=SignatureHelpRequest||(exports$1.SignatureHelpRequest=SignatureHelpRequest={})).method="textDocument/signatureHelp",SignatureHelpRequest2.messageDirection=messages_1.MessageDirection.clientToServer,SignatureHelpRequest2.type=new messages_1.ProtocolRequestType(SignatureHelpRequest2.method),(DefinitionRequest2=DefinitionRequest||(exports$1.DefinitionRequest=DefinitionRequest={})).method="textDocument/definition",DefinitionRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DefinitionRequest2.type=new messages_1.ProtocolRequestType(DefinitionRequest2.method),(ReferencesRequest2=ReferencesRequest||(exports$1.ReferencesRequest=ReferencesRequest={})).method="textDocument/references",ReferencesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,ReferencesRequest2.type=new messages_1.ProtocolRequestType(ReferencesRequest2.method),(DocumentHighlightRequest2=DocumentHighlightRequest||(exports$1.DocumentHighlightRequest=DocumentHighlightRequest={})).method="textDocument/documentHighlight",DocumentHighlightRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentHighlightRequest2.type=new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method),(DocumentSymbolRequest2=DocumentSymbolRequest||(exports$1.DocumentSymbolRequest=DocumentSymbolRequest={})).method="textDocument/documentSymbol",DocumentSymbolRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentSymbolRequest2.type=new messages_1.ProtocolRequestType(DocumentSymbolRequest2.method),(CodeActionRequest2=CodeActionRequest||(exports$1.CodeActionRequest=CodeActionRequest={})).method="textDocument/codeAction",CodeActionRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CodeActionRequest2.type=new messages_1.ProtocolRequestType(CodeActionRequest2.method),(CodeActionResolveRequest2=CodeActionResolveRequest||(exports$1.CodeActionResolveRequest=CodeActionResolveRequest={})).method="codeAction/resolve",CodeActionResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CodeActionResolveRequest2.type=new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method),(WorkspaceSymbolRequest2=WorkspaceSymbolRequest||(exports$1.WorkspaceSymbolRequest=WorkspaceSymbolRequest={})).method="workspace/symbol",WorkspaceSymbolRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WorkspaceSymbolRequest2.type=new messages_1.ProtocolRequestType(WorkspaceSymbolRequest2.method),(WorkspaceSymbolResolveRequest2=WorkspaceSymbolResolveRequest||(exports$1.WorkspaceSymbolResolveRequest=WorkspaceSymbolResolveRequest={})).method="workspaceSymbol/resolve",WorkspaceSymbolResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WorkspaceSymbolResolveRequest2.type=new messages_1.ProtocolRequestType(WorkspaceSymbolResolveRequest2.method),(CodeLensRequest2=CodeLensRequest||(exports$1.CodeLensRequest=CodeLensRequest={})).method="textDocument/codeLens",CodeLensRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CodeLensRequest2.type=new messages_1.ProtocolRequestType(CodeLensRequest2.method),(CodeLensResolveRequest2=CodeLensResolveRequest||(exports$1.CodeLensResolveRequest=CodeLensResolveRequest={})).method="codeLens/resolve",CodeLensResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CodeLensResolveRequest2.type=new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method),(CodeLensRefreshRequest2=CodeLensRefreshRequest||(exports$1.CodeLensRefreshRequest=CodeLensRefreshRequest={})).method="workspace/codeLens/refresh",CodeLensRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,CodeLensRefreshRequest2.type=new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method),(DocumentLinkRequest2=DocumentLinkRequest||(exports$1.DocumentLinkRequest=DocumentLinkRequest={})).method="textDocument/documentLink",DocumentLinkRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentLinkRequest2.type=new messages_1.ProtocolRequestType(DocumentLinkRequest2.method),(DocumentLinkResolveRequest2=DocumentLinkResolveRequest||(exports$1.DocumentLinkResolveRequest=DocumentLinkResolveRequest={})).method="documentLink/resolve",DocumentLinkResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentLinkResolveRequest2.type=new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method),(DocumentFormattingRequest2=DocumentFormattingRequest||(exports$1.DocumentFormattingRequest=DocumentFormattingRequest={})).method="textDocument/formatting",DocumentFormattingRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentFormattingRequest2.type=new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method),(DocumentRangeFormattingRequest2=DocumentRangeFormattingRequest||(exports$1.DocumentRangeFormattingRequest=DocumentRangeFormattingRequest={})).method="textDocument/rangeFormatting",DocumentRangeFormattingRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentRangeFormattingRequest2.type=new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method),(DocumentRangesFormattingRequest2=DocumentRangesFormattingRequest||(exports$1.DocumentRangesFormattingRequest=DocumentRangesFormattingRequest={})).method="textDocument/rangesFormatting",DocumentRangesFormattingRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentRangesFormattingRequest2.type=new messages_1.ProtocolRequestType(DocumentRangesFormattingRequest2.method),(DocumentOnTypeFormattingRequest2=DocumentOnTypeFormattingRequest||(exports$1.DocumentOnTypeFormattingRequest=DocumentOnTypeFormattingRequest={})).method="textDocument/onTypeFormatting",DocumentOnTypeFormattingRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentOnTypeFormattingRequest2.type=new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method),(PrepareSupportDefaultBehavior||(exports$1.PrepareSupportDefaultBehavior=PrepareSupportDefaultBehavior={})).Identifier=1,(RenameRequest2=RenameRequest||(exports$1.RenameRequest=RenameRequest={})).method="textDocument/rename",RenameRequest2.messageDirection=messages_1.MessageDirection.clientToServer,RenameRequest2.type=new messages_1.ProtocolRequestType(RenameRequest2.method),(PrepareRenameRequest2=PrepareRenameRequest||(exports$1.PrepareRenameRequest=PrepareRenameRequest={})).method="textDocument/prepareRename",PrepareRenameRequest2.messageDirection=messages_1.MessageDirection.clientToServer,PrepareRenameRequest2.type=new messages_1.ProtocolRequestType(PrepareRenameRequest2.method),(ExecuteCommandRequest2=ExecuteCommandRequest||(exports$1.ExecuteCommandRequest=ExecuteCommandRequest={})).method="workspace/executeCommand",ExecuteCommandRequest2.messageDirection=messages_1.MessageDirection.clientToServer,ExecuteCommandRequest2.type=new messages_1.ProtocolRequestType(ExecuteCommandRequest2.method),(ApplyWorkspaceEditRequest2=ApplyWorkspaceEditRequest||(exports$1.ApplyWorkspaceEditRequest=ApplyWorkspaceEditRequest={})).method="workspace/applyEdit",ApplyWorkspaceEditRequest2.messageDirection=messages_1.MessageDirection.serverToClient,ApplyWorkspaceEditRequest2.type=new messages_1.ProtocolRequestType("workspace/applyEdit")}(protocol)),protocol}var hasRequiredConnection,hasRequiredApi,hasRequiredMain,connection={};function requireApi(){return hasRequiredApi||(hasRequiredApi=1,function(exports$1){var __createBinding=api&&api.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&!("get"in desc?!m.__esModule:desc.writable||desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){void 0===k2&&(k2=k),o[k2]=m[k]}),__exportStar=api&&api.__exportStar||function(m,exports$12){for(var p in m)"default"===p||Object.prototype.hasOwnProperty.call(exports$12,p)||__createBinding(exports$12,m,p)};Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.LSPErrorCodes=exports$1.createProtocolConnection=void 0,__exportStar(requireMain$1(),exports$1),__exportStar(require$$1,exports$1),__exportStar(requireMessages(),exports$1),__exportStar(requireProtocol(),exports$1);var LSPErrorCodes,LSPErrorCodes2,connection_1=function(){if(hasRequiredConnection)return connection;hasRequiredConnection=1,Object.defineProperty(connection,"__esModule",{value:!0}),connection.createProtocolConnection=void 0;const vscode_jsonrpc_1=requireMain$1();return connection.createProtocolConnection=function(input,output,logger,options){return vscode_jsonrpc_1.ConnectionStrategy.is(options)&&(options={connectionStrategy:options}),(0,vscode_jsonrpc_1.createMessageConnection)(input,output,logger,options)},connection}();Object.defineProperty(exports$1,"createProtocolConnection",{enumerable:!0,get:function(){return connection_1.createProtocolConnection}}),(LSPErrorCodes2=LSPErrorCodes||(exports$1.LSPErrorCodes=LSPErrorCodes={})).lspReservedErrorRangeStart=-32899,LSPErrorCodes2.RequestFailed=-32803,LSPErrorCodes2.ServerCancelled=-32802,LSPErrorCodes2.ContentModified=-32801,LSPErrorCodes2.RequestCancelled=-32800,LSPErrorCodes2.lspReservedErrorRangeEnd=-32800}(api)),api}var Disposable,mainExports=(hasRequiredMain||(hasRequiredMain=1,function(exports$1){var __createBinding=main$1&&main$1.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&!("get"in desc?!m.__esModule:desc.writable||desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){void 0===k2&&(k2=k),o[k2]=m[k]}),__exportStar=main$1&&main$1.__exportStar||function(m,exports$12){for(var p in m)"default"===p||Object.prototype.hasOwnProperty.call(exports$12,p)||__createBinding(exports$12,m,p)};Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.createProtocolConnection=void 0;const browser_1=requireBrowser();__exportStar(requireBrowser(),exports$1),__exportStar(requireApi(),exports$1),exports$1.createProtocolConnection=function(reader,writer,logger,options){return(0,browser_1.createMessageConnection)(reader,writer,logger,options)}}(main$1)),main$1);(Disposable||(Disposable={})).create=function(callback){return{dispose:async()=>await callback()}};class DefaultDocumentBuilder{constructor(services){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new MultiMap,this.documentPhaseListeners=new MultiMap,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=DocumentState.Changed,this.langiumDocuments=services.workspace.LangiumDocuments,this.langiumDocumentFactory=services.workspace.LangiumDocumentFactory,this.textDocuments=services.workspace.TextDocuments,this.indexManager=services.workspace.IndexManager,this.fileSystemProvider=services.workspace.FileSystemProvider,this.workspaceManager=()=>services.workspace.WorkspaceManager,this.serviceRegistry=services.ServiceRegistry}async build(documents,options={},cancelToken=cancellationExports.CancellationToken.None){var _a2;for(const document of documents){const key=document.uri.toString();if(document.state===DocumentState.Validated){if("boolean"==typeof options.validation&&options.validation)this.resetToState(document,DocumentState.IndexedReferences);else if("object"==typeof options.validation){const categories=this.findMissingValidationCategories(document,options);categories.length>0&&(this.buildState.set(key,{completed:!1,options:{validation:{categories:categories}},result:null==(_a2=this.buildState.get(key))?void 0:_a2.result}),document.state=DocumentState.IndexedReferences)}}else this.buildState.delete(key)}this.currentState=DocumentState.Changed,await this.emitUpdate(documents.map(e=>e.uri),[]),await this.buildDocuments(documents,options,cancelToken)}async update(changed,deleted,cancelToken=cancellationExports.CancellationToken.None){this.currentState=DocumentState.Changed;const deletedUris=[];for(const deletedUri of deleted){const deletedDocs=this.langiumDocuments.deleteDocuments(deletedUri);for(const doc of deletedDocs)deletedUris.push(doc.uri),this.cleanUpDeleted(doc)}const changedUris=(await Promise.all(changed.map(uri=>this.findChangedUris(uri)))).flat();for(const changedUri of changedUris){let changedDocument=this.langiumDocuments.getDocument(changedUri);void 0===changedDocument&&(changedDocument=this.langiumDocumentFactory.fromModel({$type:"INVALID"},changedUri),changedDocument.state=DocumentState.Changed,this.langiumDocuments.addDocument(changedDocument)),this.resetToState(changedDocument,DocumentState.Changed)}const allChangedUris=stream(changedUris).concat(deletedUris).map(uri=>uri.toString()).toSet();this.langiumDocuments.all.filter(doc=>!allChangedUris.has(doc.uri.toString())&&this.shouldRelink(doc,allChangedUris)).forEach(doc=>this.resetToState(doc,DocumentState.ComputedScopes)),await this.emitUpdate(changedUris,deletedUris),await interruptAndCheck(cancelToken);const rebuildDocuments=this.sortDocuments(this.langiumDocuments.all.filter(doc=>{var _a2;return doc.state<DocumentState.Validated||!(null==(_a2=this.buildState.get(doc.uri.toString()))?void 0:_a2.completed)||this.resultsAreIncomplete(doc,this.updateBuildOptions)}).toArray());await this.buildDocuments(rebuildDocuments,this.updateBuildOptions,cancelToken)}resultsAreIncomplete(document,options){return this.findMissingValidationCategories(document,options).length>=1}findMissingValidationCategories(document,options){var _a2,_b2;const state=this.buildState.get(document.uri.toString()),allCategories=this.serviceRegistry.getServices(document.uri).validation.ValidationRegistry.getAllValidationCategories(document),executedCategories=(null==(_a2=null==state?void 0:state.result)?void 0:_a2.validationChecks)?new Set(null==(_b2=null==state?void 0:state.result)?void 0:_b2.validationChecks):(null==state?void 0:state.completed)?allCategories:new Set;return stream(void 0===options||!0===options.validation?allCategories:"object"==typeof options.validation?options.validation.categories??allCategories:[]).filter(requested=>!executedCategories.has(requested)).toArray()}async findChangedUris(changed){var _a2;if(this.langiumDocuments.getDocument(changed)??(null==(_a2=this.textDocuments)?void 0:_a2.get(changed)))return[changed];try{const stat=await this.fileSystemProvider.stat(changed);if(stat.isDirectory){return await this.workspaceManager().searchFolder(changed)}if(this.workspaceManager().shouldIncludeEntry(stat))return[changed]}catch{}return[]}async emitUpdate(changed,deleted){await Promise.all(this.updateListeners.map(listener=>listener(changed,deleted)))}sortDocuments(documents){let left=0,right=documents.length-1;for(;left<right;){for(;left<documents.length&&this.hasTextDocument(documents[left]);)left++;for(;right>=0&&!this.hasTextDocument(documents[right]);)right--;left<right&&([documents[left],documents[right]]=[documents[right],documents[left]])}return documents}hasTextDocument(doc){var _a2;return Boolean(null==(_a2=this.textDocuments)?void 0:_a2.get(doc.uri))}shouldRelink(document,changedUris){return!!document.references.some(ref=>void 0!==ref.error)||this.indexManager.isAffected(document,changedUris)}onUpdate(callback){return this.updateListeners.push(callback),Disposable.create(()=>{const index=this.updateListeners.indexOf(callback);index>=0&&this.updateListeners.splice(index,1)})}resetToState(document,state){switch(state){case DocumentState.Changed:case DocumentState.Parsed:this.indexManager.removeContent(document.uri);case DocumentState.IndexedContent:document.localSymbols=void 0;case DocumentState.ComputedScopes:this.serviceRegistry.getServices(document.uri).references.Linker.unlink(document);case DocumentState.Linked:this.indexManager.removeReferences(document.uri);case DocumentState.IndexedReferences:document.diagnostics=void 0,this.buildState.delete(document.uri.toString());case DocumentState.Validated:}document.state>state&&(document.state=state)}cleanUpDeleted(document){this.buildState.delete(document.uri.toString()),this.indexManager.remove(document.uri),document.state=DocumentState.Changed}async buildDocuments(documents,options,cancelToken){this.prepareBuild(documents,options),await this.runCancelable(documents,DocumentState.Parsed,cancelToken,doc=>this.langiumDocumentFactory.update(doc,cancelToken)),await this.runCancelable(documents,DocumentState.IndexedContent,cancelToken,doc=>this.indexManager.updateContent(doc,cancelToken)),await this.runCancelable(documents,DocumentState.ComputedScopes,cancelToken,async doc=>{const scopeComputation=this.serviceRegistry.getServices(doc.uri).references.ScopeComputation;doc.localSymbols=await scopeComputation.collectLocalSymbols(doc,cancelToken)});const toBeLinked=documents.filter(doc=>this.shouldLink(doc));await this.runCancelable(toBeLinked,DocumentState.Linked,cancelToken,doc=>this.serviceRegistry.getServices(doc.uri).references.Linker.link(doc,cancelToken)),await this.runCancelable(toBeLinked,DocumentState.IndexedReferences,cancelToken,doc=>this.indexManager.updateReferences(doc,cancelToken));const toBeValidated=documents.filter(doc=>!!this.shouldValidate(doc)||(this.markAsCompleted(doc),!1));await this.runCancelable(toBeValidated,DocumentState.Validated,cancelToken,async doc=>{await this.validate(doc,cancelToken),this.markAsCompleted(doc)})}markAsCompleted(document){const state=this.buildState.get(document.uri.toString());state&&(state.completed=!0)}prepareBuild(documents,options){for(const doc of documents){const key=doc.uri.toString(),state=this.buildState.get(key);state&&!state.completed||this.buildState.set(key,{completed:!1,options:options,result:null==state?void 0:state.result})}}async runCancelable(documents,targetState,cancelToken,callback){for(const document of documents)document.state<targetState&&(await interruptAndCheck(cancelToken),await callback(document),document.state=targetState,await this.notifyDocumentPhase(document,targetState,cancelToken));const targetStateDocs=documents.filter(doc=>doc.state===targetState);await this.notifyBuildPhase(targetStateDocs,targetState,cancelToken),this.currentState=targetState}onBuildPhase(targetState,callback){return this.buildPhaseListeners.add(targetState,callback),Disposable.create(()=>{this.buildPhaseListeners.delete(targetState,callback)})}onDocumentPhase(targetState,callback){return this.documentPhaseListeners.add(targetState,callback),Disposable.create(()=>{this.documentPhaseListeners.delete(targetState,callback)})}waitUntil(state,uriOrToken,cancelToken){let uri;return uriOrToken&&"path"in uriOrToken?uri=uriOrToken:cancelToken=uriOrToken,cancelToken??(cancelToken=cancellationExports.CancellationToken.None),uri?this.awaitDocumentState(state,uri,cancelToken):this.awaitBuilderState(state,cancelToken)}awaitDocumentState(state,uri,cancelToken){const document=this.langiumDocuments.getDocument(uri);return document?document.state>=state?Promise.resolve(uri):cancelToken.isCancellationRequested?Promise.reject(OperationCancelled):this.currentState>=state&&state>document.state?Promise.reject(new mainExports.ResponseError(mainExports.LSPErrorCodes.RequestFailed,`Document state of ${uri.toString()} is ${DocumentState[document.state]}, requiring ${DocumentState[state]}, but workspace state is already ${DocumentState[this.currentState]}. Returning undefined.`)):new Promise((resolve,reject)=>{const buildDisposable=this.onDocumentPhase(state,doc=>{UriUtils.equals(doc.uri,uri)&&(buildDisposable.dispose(),cancelDisposable.dispose(),resolve(doc.uri))}),cancelDisposable=cancelToken.onCancellationRequested(()=>{buildDisposable.dispose(),cancelDisposable.dispose(),reject(OperationCancelled)})}):Promise.reject(new mainExports.ResponseError(mainExports.LSPErrorCodes.ServerCancelled,`No document found for URI: ${uri.toString()}`))}awaitBuilderState(state,cancelToken){return this.currentState>=state?Promise.resolve():cancelToken.isCancellationRequested?Promise.reject(OperationCancelled):new Promise((resolve,reject)=>{const buildDisposable=this.onBuildPhase(state,()=>{buildDisposable.dispose(),cancelDisposable.dispose(),resolve()}),cancelDisposable=cancelToken.onCancellationRequested(()=>{buildDisposable.dispose(),cancelDisposable.dispose(),reject(OperationCancelled)})})}async notifyDocumentPhase(document,state,cancelToken){const listenersCopy=this.documentPhaseListeners.get(state).slice();for(const listener of listenersCopy)try{await interruptAndCheck(cancelToken),await listener(document,cancelToken)}catch(err){if(!isOperationCancelled(err))throw err}}async notifyBuildPhase(documents,state,cancelToken){if(0===documents.length)return;const listenersCopy=this.buildPhaseListeners.get(state).slice();for(const listener of listenersCopy)await interruptAndCheck(cancelToken),await listener(documents,cancelToken)}shouldLink(document){return this.getBuildOptions(document).eagerLinking??!0}shouldValidate(document){return Boolean(this.getBuildOptions(document).validation)}async validate(document,cancelToken){const validator=this.serviceRegistry.getServices(document.uri).validation.DocumentValidator,options=this.getBuildOptions(document),validationOptions="object"==typeof options.validation?{...options.validation}:{};validationOptions.categories=this.findMissingValidationCategories(document,options);const diagnostics=await validator.validateDocument(document,validationOptions,cancelToken);document.diagnostics?document.diagnostics.push(...diagnostics):document.diagnostics=diagnostics;const state=this.buildState.get(document.uri.toString());state&&(state.result??(state.result={}),state.result.validationChecks?state.result.validationChecks=stream(state.result.validationChecks).concat(validationOptions.categories).distinct().toArray():state.result.validationChecks=[...validationOptions.categories])}getBuildOptions(document){var _a2;return(null==(_a2=this.buildState.get(document.uri.toString()))?void 0:_a2.options)??{}}}class DefaultIndexManager{constructor(services){this.symbolIndex=new Map,this.symbolByTypeIndex=new ContextCache,this.referenceIndex=new Map,this.documents=services.workspace.LangiumDocuments,this.serviceRegistry=services.ServiceRegistry,this.astReflection=services.AstReflection}findAllReferences(targetNode,astNodePath){const targetDocUri=getDocument(targetNode).uri,result=[];return this.referenceIndex.forEach(docRefs=>{docRefs.forEach(refDescr=>{UriUtils.equals(refDescr.targetUri,targetDocUri)&&refDescr.targetPath===astNodePath&&result.push(refDescr)})}),stream(result)}allElements(nodeType,uris){let documentUris=stream(this.symbolIndex.keys());return uris&&(documentUris=documentUris.filter(uri=>!uris||uris.has(uri))),documentUris.map(uri=>this.getFileDescriptions(uri,nodeType)).flat()}getFileDescriptions(uri,nodeType){if(!nodeType)return this.symbolIndex.get(uri)??[];return this.symbolByTypeIndex.get(uri,nodeType,()=>(this.symbolIndex.get(uri)??[]).filter(e=>this.astReflection.isSubtype(e.type,nodeType)))}remove(uri){this.removeContent(uri),this.removeReferences(uri)}removeContent(uri){const uriString=uri.toString();this.symbolIndex.delete(uriString),this.symbolByTypeIndex.clear(uriString)}removeReferences(uri){const uriString=uri.toString();this.referenceIndex.delete(uriString)}async updateContent(document,cancelToken=cancellationExports.CancellationToken.None){const services=this.serviceRegistry.getServices(document.uri),exports$1=await services.references.ScopeComputation.collectExportedSymbols(document,cancelToken),uri=document.uri.toString();this.symbolIndex.set(uri,exports$1),this.symbolByTypeIndex.clear(uri)}async updateReferences(document,cancelToken=cancellationExports.CancellationToken.None){const services=this.serviceRegistry.getServices(document.uri),indexData=await services.workspace.ReferenceDescriptionProvider.createDescriptions(document,cancelToken);this.referenceIndex.set(document.uri.toString(),indexData)}isAffected(document,changedUris){const references=this.referenceIndex.get(document.uri.toString());return!!references&&references.some(ref=>!ref.local&&changedUris.has(ref.targetUri.toString()))}}class DefaultWorkspaceManager{constructor(services){this.initialBuildOptions={},this._ready=new Deferred,this.serviceRegistry=services.ServiceRegistry,this.langiumDocuments=services.workspace.LangiumDocuments,this.documentBuilder=services.workspace.DocumentBuilder,this.fileSystemProvider=services.workspace.FileSystemProvider,this.mutex=services.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(params){this.folders=params.workspaceFolders??void 0}initialized(_params){return this.mutex.write(token=>this.initializeWorkspace(this.folders??[],token))}async initializeWorkspace(folders,cancelToken=cancellationExports.CancellationToken.None){const documents=await this.performStartup(folders);await interruptAndCheck(cancelToken),await this.documentBuilder.build(documents,this.initialBuildOptions,cancelToken)}async performStartup(folders){const documents=[],collector=document=>{documents.push(document),this.langiumDocuments.hasDocument(document.uri)||this.langiumDocuments.addDocument(document)};await this.loadAdditionalDocuments(folders,collector);const uris=[];await Promise.all(folders.map(wf=>this.getRootFolder(wf)).map(async entry=>this.traverseFolder(entry,uris)));const uniqueUris=stream(uris).distinct(uri=>uri.toString()).filter(uri=>!this.langiumDocuments.hasDocument(uri));return await this.loadWorkspaceDocuments(uniqueUris,collector),this._ready.resolve(),documents}async loadWorkspaceDocuments(uris,collector){await Promise.all(uris.map(async uri=>{const document=await this.langiumDocuments.getOrCreateDocument(uri);collector(document)}))}loadAdditionalDocuments(_folders,_collector){return Promise.resolve()}getRootFolder(workspaceFolder){return URI.parse(workspaceFolder.uri)}async traverseFolder(folderPath,uris){try{const content=await this.fileSystemProvider.readDirectory(folderPath);await Promise.all(content.map(async entry=>{this.shouldIncludeEntry(entry)&&(entry.isDirectory?await this.traverseFolder(entry.uri,uris):entry.isFile&&uris.push(entry.uri))}))}catch(e){console.error("Failure to read directory content of "+folderPath.toString(!0),e)}}async searchFolder(uri){const uris=[];return await this.traverseFolder(uri,uris),uris}shouldIncludeEntry(entry){const name=UriUtils.basename(entry.uri);return!name.startsWith(".")&&(entry.isDirectory?"node_modules"!==name&&"out"!==name:!!entry.isFile&&this.serviceRegistry.hasServices(entry.uri))}}class DefaultLexerErrorMessageProvider{buildUnexpectedCharactersMessage(fullText,startOffset,length,line,column){return defaultLexerErrorProvider.buildUnexpectedCharactersMessage(fullText,startOffset,length,line,column)}buildUnableToPopLexerModeMessage(token){return defaultLexerErrorProvider.buildUnableToPopLexerModeMessage(token)}}const DEFAULT_TOKENIZE_OPTIONS={mode:"full"};class DefaultLexer{constructor(services){this.errorMessageProvider=services.parser.LexerErrorMessageProvider,this.tokenBuilder=services.parser.TokenBuilder;const tokens=this.tokenBuilder.buildTokens(services.Grammar,{caseInsensitive:services.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(tokens);const lexerTokens=isTokenTypeDictionary(tokens)?Object.values(tokens):tokens,production="production"===services.LanguageMetaData.mode;this.chevrotainLexer=new Lexer(lexerTokens,{positionTracking:"full",skipValidations:production,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(text,_options=DEFAULT_TOKENIZE_OPTIONS){var _a2,_b2;const chevrotainResult=this.chevrotainLexer.tokenize(text);return{tokens:chevrotainResult.tokens,errors:chevrotainResult.errors,hidden:chevrotainResult.groups.hidden??[],report:null==(_b2=(_a2=this.tokenBuilder).flushLexingReport)?void 0:_b2.call(_a2,text)}}toTokenTypeDictionary(buildTokens){if(isTokenTypeDictionary(buildTokens))return buildTokens;const tokens=isIMultiModeLexerDefinition(buildTokens)?Object.values(buildTokens.modes).flat():buildTokens,res={};return tokens.forEach(token=>res[token.name]=token),res}}function isIMultiModeLexerDefinition(tokenVocabulary){return tokenVocabulary&&"modes"in tokenVocabulary&&"defaultMode"in tokenVocabulary}function isTokenTypeDictionary(tokenVocabulary){return!function(tokenVocabulary){return Array.isArray(tokenVocabulary)&&(0===tokenVocabulary.length||"name"in tokenVocabulary[0])}(tokenVocabulary)&&!isIMultiModeLexerDefinition(tokenVocabulary)}function parseJSDoc(node,start,options){let opts,position;"string"==typeof node?(position=start,opts=options):(position=node.range.start,opts=start),position||(position=Position.create(0,0));const tokens=function(context){var _a2,_b2,_c2;const tokens=[];let currentLine=context.position.line,currentCharacter=context.position.character;for(let i=0;i<context.lines.length;i++){const first2=0===i,last=i===context.lines.length-1;let line=context.lines[i],index=0;if(first2&&context.options.start){const match=null==(_a2=context.options.start)?void 0:_a2.exec(line);match&&(index=match.index+match[0].length)}else{const match=null==(_b2=context.options.line)?void 0:_b2.exec(line);match&&(index=match.index+match[0].length)}if(last){const match=null==(_c2=context.options.end)?void 0:_c2.exec(line);match&&(line=line.substring(0,match.index))}line=line.substring(0,lastCharacter(line));if(skipWhitespace(line,index)>=line.length){if(tokens.length>0){const position=Position.create(currentLine,currentCharacter);tokens.push({type:"break",content:"",range:Range.create(position,position)})}}else{tagRegex.lastIndex=index;const tagMatch=tagRegex.exec(line);if(tagMatch){const fullMatch=tagMatch[0],value=tagMatch[1],start=Position.create(currentLine,currentCharacter+index),end=Position.create(currentLine,currentCharacter+index+fullMatch.length);tokens.push({type:"tag",content:value,range:Range.create(start,end)}),index+=fullMatch.length,index=skipWhitespace(line,index)}if(index<line.length){const rest=line.substring(index),inlineTagMatches=Array.from(rest.matchAll(inlineTagRegex));tokens.push(...buildInlineTokens(inlineTagMatches,rest,currentLine,currentCharacter+index))}}currentLine++,currentCharacter=0}if(tokens.length>0&&"break"===tokens[tokens.length-1].type)return tokens.slice(0,-1);return tokens}({lines:getLines(node),position:position,options:normalizeOptions(opts)});return function(context){var _a2,_b2;const startPosition=Position.create(context.position.line,context.position.character);if(0===context.tokens.length)return new JSDocCommentImpl([],Range.create(startPosition,startPosition));const elements=[];for(;context.index<context.tokens.length;){const element=parseJSDocElement(context,elements[elements.length-1]);element&&elements.push(element)}const start=(null==(_a2=elements[0])?void 0:_a2.range.start)??startPosition,end=(null==(_b2=elements[elements.length-1])?void 0:_b2.range.end)??startPosition;return new JSDocCommentImpl(elements,Range.create(start,end))}({index:0,tokens:tokens,position:position})}function getLines(node){let content="";content="string"==typeof node?node:node.text;return content.split(NEWLINE_REGEXP)}const tagRegex=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,inlineTagRegex=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function buildInlineTokens(tags,line,lineIndex,characterIndex){const tokens=[];if(0===tags.length){const start=Position.create(lineIndex,characterIndex),end=Position.create(lineIndex,characterIndex+line.length);tokens.push({type:"text",content:line,range:Range.create(start,end)})}else{let lastIndex=0;for(const match of tags){const matchIndex=match.index,startContent=line.substring(lastIndex,matchIndex);startContent.length>0&&tokens.push({type:"text",content:line.substring(lastIndex,matchIndex),range:Range.create(Position.create(lineIndex,lastIndex+characterIndex),Position.create(lineIndex,matchIndex+characterIndex))});let offset=startContent.length+1;const tagName=match[1];if(tokens.push({type:"inline-tag",content:tagName,range:Range.create(Position.create(lineIndex,lastIndex+offset+characterIndex),Position.create(lineIndex,lastIndex+offset+tagName.length+characterIndex))}),offset+=tagName.length,4===match.length){offset+=match[2].length;const value=match[3];tokens.push({type:"text",content:value,range:Range.create(Position.create(lineIndex,lastIndex+offset+characterIndex),Position.create(lineIndex,lastIndex+offset+value.length+characterIndex))})}else tokens.push({type:"text",content:"",range:Range.create(Position.create(lineIndex,lastIndex+offset+characterIndex),Position.create(lineIndex,lastIndex+offset+characterIndex))});lastIndex=matchIndex+match[0].length}const endContent=line.substring(lastIndex);endContent.length>0&&tokens.push({type:"text",content:endContent,range:Range.create(Position.create(lineIndex,lastIndex+characterIndex),Position.create(lineIndex,lastIndex+characterIndex+endContent.length))})}return tokens}const nonWhitespaceRegex=/\S/,whitespaceEndRegex=/\s*$/;function skipWhitespace(line,index){const match=line.substring(index).match(nonWhitespaceRegex);return match?index+match.index:line.length}function lastCharacter(line){const match=line.match(whitespaceEndRegex);if(match&&"number"==typeof match.index)return match.index}function parseJSDocElement(context,last){const next=context.tokens[context.index];return"tag"===next.type?parseJSDocTag(context,!1):"text"===next.type||"inline-tag"===next.type?parseJSDocText(context):(function(token,element){if(element){const line=new JSDocLineImpl("",token.range);"inlines"in element?element.inlines.push(line):element.content.inlines.push(line)}}(next,last),void context.index++)}function parseJSDocText(context){let token=context.tokens[context.index];const firstToken=token;let lastToken=token;const lines=[];for(;token&&"break"!==token.type&&"tag"!==token.type;)lines.push(parseJSDocInline(context)),lastToken=token,token=context.tokens[context.index];return new JSDocTextImpl(lines,Range.create(firstToken.range.start,lastToken.range.end))}function parseJSDocInline(context){return"inline-tag"===context.tokens[context.index].type?parseJSDocTag(context,!0):parseJSDocLine(context)}function parseJSDocTag(context,inline){const tagToken=context.tokens[context.index++],name=tagToken.content.substring(1),nextToken=context.tokens[context.index];if("text"===(null==nextToken?void 0:nextToken.type)){if(inline){const docLine=parseJSDocLine(context);return new JSDocTagImpl(name,new JSDocTextImpl([docLine],docLine.range),inline,Range.create(tagToken.range.start,docLine.range.end))}{const textDoc=parseJSDocText(context);return new JSDocTagImpl(name,textDoc,inline,Range.create(tagToken.range.start,textDoc.range.end))}}{const range=tagToken.range;return new JSDocTagImpl(name,new JSDocTextImpl([],range),inline,range)}}function parseJSDocLine(context){const token=context.tokens[context.index++];return new JSDocLineImpl(token.content,token.range)}function normalizeOptions(options){if(!options)return normalizeOptions({start:"/**",end:"*/",line:"*"});const{start:start,end:end,line:line}=options;return{start:normalizeOption(start,!0),end:normalizeOption(end,!1),line:normalizeOption(line,!0)}}function normalizeOption(option2,start){if("string"==typeof option2||"object"==typeof option2){const escaped="string"==typeof option2?escapeRegExp(option2):option2.source;return start?new RegExp(`^\\s*${escaped}`):new RegExp(`\\s*${escaped}\\s*$`)}return option2}class JSDocCommentImpl{constructor(elements,range){this.elements=elements,this.range=range}getTag(name){return this.getAllTags().find(e=>e.name===name)}getTags(name){return this.getAllTags().filter(e=>e.name===name)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let value="";for(const element of this.elements)if(0===value.length)value=element.toString();else{const text=element.toString();value+=fillNewlines(value)+text}return value.trim()}toMarkdown(options){let value="";for(const element of this.elements)if(0===value.length)value=element.toMarkdown(options);else{const text=element.toMarkdown(options);value+=fillNewlines(value)+text}return value.trim()}}class JSDocTagImpl{constructor(name,content,inline,range){this.name=name,this.content=content,this.inline=inline,this.range=range}toString(){let text=`@${this.name}`;const content=this.content.toString();return 1===this.content.inlines.length?text=`${text} ${content}`:this.content.inlines.length>1&&(text=`${text}\n${content}`),this.inline?`{${text}}`:text}toMarkdown(options){var _a2;return(null==(_a2=null==options?void 0:options.renderTag)?void 0:_a2.call(options,this))??this.toMarkdownDefault(options)}toMarkdownDefault(options){const content=this.content.toMarkdown(options);if(this.inline){const rendered=function(tag,content,options){var _a2;if("linkplain"===tag||"linkcode"===tag||"link"===tag){const index=content.indexOf(" ");let display=content;if(index>0){const displayStart=skipWhitespace(content,index);display=content.substring(displayStart),content=content.substring(0,index)}("linkcode"===tag||"link"===tag&&"code"===options.link)&&(display=`\`${display}\``);const renderedLink=(null==(_a2=options.renderLink)?void 0:_a2.call(options,content,display))??function(content,display){try{return URI.parse(content,!0),`[${display}](${content})`}catch{return content}}(content,display);return renderedLink}return}(this.name,content,options??{});if("string"==typeof rendered)return rendered}let marker="";"italic"===(null==options?void 0:options.tag)||void 0===(null==options?void 0:options.tag)?marker="*":"bold"===(null==options?void 0:options.tag)?marker="**":"bold-italic"===(null==options?void 0:options.tag)&&(marker="***");let text=`${marker}@${this.name}${marker}`;return 1===this.content.inlines.length?text=`${text} — ${content}`:this.content.inlines.length>1&&(text=`${text}\n${content}`),this.inline?`{${text}}`:text}}class JSDocTextImpl{constructor(lines,range){this.inlines=lines,this.range=range}toString(){let text="";for(let i=0;i<this.inlines.length;i++){const inline=this.inlines[i],next=this.inlines[i+1];text+=inline.toString(),next&&next.range.start.line>inline.range.start.line&&(text+="\n")}return text}toMarkdown(options){let text="";for(let i=0;i<this.inlines.length;i++){const inline=this.inlines[i],next=this.inlines[i+1];text+=inline.toMarkdown(options),next&&next.range.start.line>inline.range.start.line&&(text+="\n")}return text}}class JSDocLineImpl{constructor(text,range){this.text=text,this.range=range}toString(){return this.text}toMarkdown(){return this.text}}function fillNewlines(text){return text.endsWith("\n")?"\n":"\n\n"}class JSDocDocumentationProvider{constructor(services){this.indexManager=services.shared.workspace.IndexManager,this.commentProvider=services.documentation.CommentProvider}getDocumentation(node){const comment=this.commentProvider.getComment(node);if(comment&&function(node,options){const normalizedOptions=normalizeOptions(options),lines=getLines(node);if(0===lines.length)return!1;const first2=lines[0],last=lines[lines.length-1],firstRegex=normalizedOptions.start,lastRegex=normalizedOptions.end;return Boolean(null==firstRegex?void 0:firstRegex.exec(first2))&&Boolean(null==lastRegex?void 0:lastRegex.exec(last))}(comment)){return parseJSDoc(comment).toMarkdown({renderLink:(link,display)=>this.documentationLinkRenderer(node,link,display),renderTag:tag=>this.documentationTagRenderer(node,tag)})}}documentationLinkRenderer(node,name,display){const description=this.findNameInLocalSymbols(node,name)??this.findNameInGlobalScope(node,name);if(description&&description.nameSegment){const line=description.nameSegment.range.start.line+1,character=description.nameSegment.range.start.character+1;return`[${display}](${description.documentUri.with({fragment:`L${line},${character}`}).toString()})`}}documentationTagRenderer(_node,_tag){}findNameInLocalSymbols(node,name){const precomputed=getDocument(node).localSymbols;if(!precomputed)return;let currentNode=node;do{const description=precomputed.getStream(currentNode).find(e=>e.name===name);if(description)return description;currentNode=currentNode.$container}while(currentNode)}findNameInGlobalScope(node,name){return this.indexManager.allElements().find(e=>e.name===name)}}class DefaultCommentProvider{constructor(services){this.grammarConfig=()=>services.parser.GrammarConfig}getComment(node){var _a2;return function(node){return"string"==typeof node.$comment}(node)?node.$comment:null==(_a2=function(cstNode,commentNames){if(cstNode){const previous=function(node,hidden=!0){for(;node.container;){const parent=node.container;let index=parent.content.indexOf(node);for(;index>0;){index--;const previous=parent.content[index];if(hidden||!previous.hidden)return previous}node=parent}}(cstNode,!0);if(previous&&isCommentNode(previous,commentNames))return previous;if(isRootCstNode(cstNode))for(let i=cstNode.content.findIndex(e=>!e.hidden)-1;i>=0;i--){const child=cstNode.content[i];if(isCommentNode(child,commentNames))return child}}}(node.$cstNode,this.grammarConfig().multilineCommentRules))?void 0:_a2.text}}class DefaultAsyncParser{constructor(services){this.syncParser=services.parser.LangiumParser}parse(text,_cancelToken){return Promise.resolve(this.syncParser.parse(text))}}class DefaultWorkspaceLock{constructor(){this.previousTokenSource=new cancellationExports.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(action){this.cancelWrite();const tokenSource=(lastTick=performance.now(),new cancellationExports.CancellationTokenSource);return this.previousTokenSource=tokenSource,this.enqueue(this.writeQueue,action,tokenSource.token)}read(action){return this.enqueue(this.readQueue,action)}enqueue(queue,action,cancellationToken=cancellationExports.CancellationToken.None){const deferred=new Deferred,entry={action:action,deferred:deferred,cancellationToken:cancellationToken};return queue.push(entry),this.performNextOperation(),deferred.promise}async performNextOperation(){if(!this.done)return;const entries=[];if(this.writeQueue.length>0)entries.push(this.writeQueue.shift());else{if(!(this.readQueue.length>0))return;entries.push(...this.readQueue.splice(0,this.readQueue.length))}this.done=!1,await Promise.all(entries.map(async({action:action,deferred:deferred,cancellationToken:cancellationToken})=>{try{const result=await Promise.resolve().then(()=>action(cancellationToken));deferred.resolve(result)}catch(err){isOperationCancelled(err)?deferred.resolve(void 0):deferred.reject(err)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class DefaultHydrator{constructor(services){this.grammarElementIdMap=new BiMap,this.tokenTypeIdMap=new BiMap,this.grammar=services.Grammar,this.lexer=services.parser.Lexer,this.linker=services.references.Linker}dehydrate(result){return{lexerErrors:result.lexerErrors,lexerReport:result.lexerReport?this.dehydrateLexerReport(result.lexerReport):void 0,parserErrors:result.parserErrors.map(e=>({...e,message:e.message})),value:this.dehydrateAstNode(result.value,this.createDehyrationContext(result.value))}}dehydrateLexerReport(lexerReport){return lexerReport}createDehyrationContext(node){const astNodes=new Map,cstNodes=new Map;for(const astNode of streamAst(node))astNodes.set(astNode,{});if(node.$cstNode)for(const cstNode of streamCst(node.$cstNode))cstNodes.set(cstNode,{});return{astNodes:astNodes,cstNodes:cstNodes}}dehydrateAstNode(node,context){const obj=context.astNodes.get(node);obj.$type=node.$type,obj.$containerIndex=node.$containerIndex,obj.$containerProperty=node.$containerProperty,void 0!==node.$cstNode&&(obj.$cstNode=this.dehydrateCstNode(node.$cstNode,context));for(const[name,value]of Object.entries(node))if(!name.startsWith("$"))if(Array.isArray(value)){const arr=[];obj[name]=arr;for(const item of value)isAstNode(item)?arr.push(this.dehydrateAstNode(item,context)):isReference(item)?arr.push(this.dehydrateReference(item,context)):arr.push(item)}else isAstNode(value)?obj[name]=this.dehydrateAstNode(value,context):isReference(value)?obj[name]=this.dehydrateReference(value,context):void 0!==value&&(obj[name]=value);return obj}dehydrateReference(reference,context){const obj={};return obj.$refText=reference.$refText,reference.$refNode&&(obj.$refNode=context.cstNodes.get(reference.$refNode)),obj}dehydrateCstNode(node,context){const cstNode=context.cstNodes.get(node);return isRootCstNode(node)?cstNode.fullText=node.fullText:cstNode.grammarSource=this.getGrammarElementId(node.grammarSource),cstNode.hidden=node.hidden,cstNode.astNode=context.astNodes.get(node.astNode),isCompositeCstNode(node)?cstNode.content=node.content.map(child=>this.dehydrateCstNode(child,context)):isLeafCstNode(node)&&(cstNode.tokenType=node.tokenType.name,cstNode.offset=node.offset,cstNode.length=node.length,cstNode.startLine=node.range.start.line,cstNode.startColumn=node.range.start.character,cstNode.endLine=node.range.end.line,cstNode.endColumn=node.range.end.character),cstNode}hydrate(result){const node=result.value,context=this.createHydrationContext(node);return"$cstNode"in node&&this.hydrateCstNode(node.$cstNode,context),{lexerErrors:result.lexerErrors,lexerReport:result.lexerReport,parserErrors:result.parserErrors,value:this.hydrateAstNode(node,context)}}createHydrationContext(node){const astNodes=new Map,cstNodes=new Map;for(const astNode of streamAst(node))astNodes.set(astNode,{});let root;if(node.$cstNode)for(const cstNode of streamCst(node.$cstNode)){let cst;"fullText"in cstNode?(cst=new RootCstNodeImpl(cstNode.fullText),root=cst):"content"in cstNode?cst=new CompositeCstNodeImpl:"tokenType"in cstNode&&(cst=this.hydrateCstLeafNode(cstNode)),cst&&(cstNodes.set(cstNode,cst),cst.root=root)}return{astNodes:astNodes,cstNodes:cstNodes}}hydrateAstNode(node,context){const astNode=context.astNodes.get(node);astNode.$type=node.$type,astNode.$containerIndex=node.$containerIndex,astNode.$containerProperty=node.$containerProperty,node.$cstNode&&(astNode.$cstNode=context.cstNodes.get(node.$cstNode));for(const[name,value]of Object.entries(node))if(!name.startsWith("$"))if(Array.isArray(value)){const arr=[];astNode[name]=arr;for(const item of value)isAstNode(item)?arr.push(this.setParent(this.hydrateAstNode(item,context),astNode)):isReference(item)?arr.push(this.hydrateReference(item,astNode,name,context)):arr.push(item)}else isAstNode(value)?astNode[name]=this.setParent(this.hydrateAstNode(value,context),astNode):isReference(value)?astNode[name]=this.hydrateReference(value,astNode,name,context):void 0!==value&&(astNode[name]=value);return astNode}setParent(node,parent){return node.$container=parent,node}hydrateReference(reference,node,name,context){return this.linker.buildReference(node,name,context.cstNodes.get(reference.$refNode),reference.$refText)}hydrateCstNode(cstNode,context,num=0){const cstNodeObj=context.cstNodes.get(cstNode);if("number"==typeof cstNode.grammarSource&&(cstNodeObj.grammarSource=this.getGrammarElement(cstNode.grammarSource)),cstNodeObj.astNode=context.astNodes.get(cstNode.astNode),isCompositeCstNode(cstNodeObj))for(const child of cstNode.content){const hydrated=this.hydrateCstNode(child,context,num++);cstNodeObj.content.push(hydrated)}return cstNodeObj}hydrateCstLeafNode(cstNode){const tokenType=this.getTokenType(cstNode.tokenType),offset=cstNode.offset,length=cstNode.length,startLine=cstNode.startLine,startColumn=cstNode.startColumn,endLine=cstNode.endLine,endColumn=cstNode.endColumn,hidden=cstNode.hidden;return new LeafCstNodeImpl(offset,length,{start:{line:startLine,character:startColumn},end:{line:endLine,character:endColumn}},tokenType,hidden)}getTokenType(name){return this.lexer.definition[name]}getGrammarElementId(node){if(node)return 0===this.grammarElementIdMap.size&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(node)}getGrammarElement(id){0===this.grammarElementIdMap.size&&this.createGrammarElementIdMap();return this.grammarElementIdMap.getKey(id)}createGrammarElementIdMap(){let id=0;for(const element of streamAst(this.grammar))isAbstractElement(element)&&this.grammarElementIdMap.set(element,id++)}}function createDefaultCoreModule(context){return{documentation:{CommentProvider:services=>new DefaultCommentProvider(services),DocumentationProvider:services=>new JSDocDocumentationProvider(services)},parser:{AsyncParser:services=>new DefaultAsyncParser(services),GrammarConfig:services=>function(services){const rules=[],grammar=services.Grammar;for(const rule of grammar.rules)isTerminalRule(rule)&&isCommentTerminal(rule)&&isMultilineComment(terminalRegex(rule))&&rules.push(rule.name);return{multilineCommentRules:rules,nameRegexp:DefaultNameRegexp}}(services),LangiumParser:services=>createLangiumParser(services),CompletionParser:services=>function(services){const grammar=services.Grammar,lexer=services.parser.Lexer,parser=new LangiumCompletionParser(services);return createParser(grammar,parser,lexer.definition),parser.finalize(),parser}(services),ValueConverter:()=>new DefaultValueConverter,TokenBuilder:()=>new DefaultTokenBuilder,Lexer:services=>new DefaultLexer(services),ParserErrorMessageProvider:()=>new LangiumParserErrorMessageProvider,LexerErrorMessageProvider:()=>new DefaultLexerErrorMessageProvider},workspace:{AstNodeLocator:()=>new DefaultAstNodeLocator,AstNodeDescriptionProvider:services=>new DefaultAstNodeDescriptionProvider(services),ReferenceDescriptionProvider:services=>new DefaultReferenceDescriptionProvider(services)},references:{Linker:services=>new DefaultLinker(services),NameProvider:()=>new DefaultNameProvider,ScopeProvider:services=>new DefaultScopeProvider(services),ScopeComputation:services=>new DefaultScopeComputation(services),References:services=>new DefaultReferences(services)},serializer:{Hydrator:services=>new DefaultHydrator(services),JsonSerializer:services=>new DefaultJsonSerializer(services)},validation:{DocumentValidator:services=>new DefaultDocumentValidator(services),ValidationRegistry:services=>new ValidationRegistry(services)},shared:()=>context.shared}}function createDefaultSharedCoreModule(context){return{ServiceRegistry:services=>new DefaultServiceRegistry(services),workspace:{LangiumDocuments:services=>new DefaultLangiumDocuments(services),LangiumDocumentFactory:services=>new DefaultLangiumDocumentFactory(services),DocumentBuilder:services=>new DefaultDocumentBuilder(services),IndexManager:services=>new DefaultIndexManager(services),WorkspaceManager:services=>new DefaultWorkspaceManager(services),FileSystemProvider:services=>context.fileSystemProvider(services),WorkspaceLock:()=>new DefaultWorkspaceLock,ConfigurationProvider:services=>new DefaultConfigurationProvider(services)},profilers:{}}}var Module;function inject(module1,module2,module3,module4,module5,module6,module7,module8,module9){return _inject([module1,module2,module3,module4,module5,module6,module7,module8,module9].reduce(_merge,{}))}(Module||(Module={})).merge=(m1,m2)=>_merge(_merge({},m1),m2);const isProxy=Symbol("isProxy");function _inject(module,injector){const proxy=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(obj,prop)=>prop===isProxy||_resolve(obj,prop,module,injector||proxy),getOwnPropertyDescriptor:(obj,prop)=>(_resolve(obj,prop,module,injector||proxy),Object.getOwnPropertyDescriptor(obj,prop)),has:(_,prop)=>prop in module,ownKeys:()=>[...Object.getOwnPropertyNames(module)]});return proxy}const __requested__=Symbol();function _resolve(obj,prop,module,injector){if(prop in obj){if(obj[prop]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable. Cause: "+obj[prop]);if(obj[prop]===__requested__)throw new Error('Cycle detected. Please make "'+String(prop)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return obj[prop]}if(prop in module){const value=module[prop];obj[prop]=__requested__;try{obj[prop]="function"==typeof value?value(injector):_inject(value,injector)}catch(error){throw obj[prop]=error instanceof Error?error:void 0,error}return obj[prop]}}function _merge(target,source){if(source)for(const[key,sourceValue]of Object.entries(source))if(null!=sourceValue)if("object"==typeof sourceValue){const targetValue=target[key];target[key]=_merge("object"==typeof targetValue&&null!==targetValue?targetValue:{},sourceValue)}else target[key]=sourceValue;return target}class EmptyFileSystemProvider{stat(_uri){throw new Error("No file system is available.")}statSync(_uri){throw new Error("No file system is available.")}async exists(){return!1}existsSync(){return!1}readBinary(){throw new Error("No file system is available.")}readBinarySync(){throw new Error("No file system is available.")}readFile(){throw new Error("No file system is available.")}readFileSync(){throw new Error("No file system is available.")}async readDirectory(){return[]}readDirectorySync(){return[]}}const EmptyFileSystem={fileSystemProvider:()=>new EmptyFileSystemProvider},minimalGrammarModule={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},minimalSharedGrammarModule={AstReflection:()=>new LangiumGrammarAstReflection};function loadGrammarFromJson(json){const services=function(){const shared=inject(createDefaultSharedCoreModule(EmptyFileSystem),minimalSharedGrammarModule),grammar=inject(createDefaultCoreModule({shared:shared}),minimalGrammarModule);return shared.ServiceRegistry.register(grammar),grammar}(),astNode=services.serializer.JsonSerializer.deserialize(json);return services.shared.workspace.LangiumDocumentFactory.fromModel(astNode,URI.parse(`memory:/${astNode.name??"grammar"}.langium`)),astNode}var ArchitectureGrammar,GitGraphGrammar,InfoGrammar,PacketGrammar,PieGrammar,RadarGrammar,TreemapGrammar,TreeViewGrammar,WardleyGrammar,__defProp2=Object.defineProperty,__name=(target,value)=>__defProp2(target,"name",{value:value,configurable:!0});(ArchitectureGrammar||(ArchitectureGrammar={})).Terminals={ARROW_DIRECTION:/L|R|T|B/,ARROW_GROUP:/\{group\}/,ARROW_INTO:/<|>/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,ARCH_ICON:/\([\w-:]+\)/,ARCH_TITLE:/\[(?:"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|[\w ]+)\]/},(GitGraphGrammar||(GitGraphGrammar={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,REFERENCE:/\w([-\./\w]*[-\w])?/},(InfoGrammar||(InfoGrammar={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(PacketGrammar||(PacketGrammar={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(PieGrammar||(PieGrammar={})).Terminals={NUMBER_PIE:/(?:-?[0-9]+\.[0-9]+(?!\.))|(?:-?(0|[1-9][0-9]*)(?!\.))/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(RadarGrammar||(RadarGrammar={})).Terminals={GRATICULE:/circle|polygon/,BOOLEAN:/true|false/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NUMBER:/(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(TreemapGrammar||(TreemapGrammar={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,TREEMAP_KEYWORD:/treemap-beta|treemap/,CLASS_DEF:/classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/,STYLE_SEPARATOR:/:::/,SEPARATOR:/:/,COMMA:/,/,INDENTATION:/[ \t]{1,}/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,ID2:/[a-zA-Z_][a-zA-Z0-9_]*/,NUMBER2:/[0-9_\.\,]+/,STRING2:/"[^"]*"|'[^']*'/},(TreeViewGrammar||(TreeViewGrammar={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INDENTATION:/[ \t]{1,}/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,STRING2:/"[^"]*"|'[^']*'/},(WardleyGrammar||(WardleyGrammar={})).Terminals={WARDLEY_NUMBER:/[0-9]+\.[0-9]+/,ARROW:/->/,LINK_PORT:/\+<>|\+>|\+</,LINK_ARROW:/-->|-\.->|>|\+'[^']*'<>|\+'[^']*'<|\+'[^']*'>/,LINK_LABEL:/;[^\n\r]+/,STRATEGY:/build|buy|outsource|market/,KW_WARDLEY:/wardley-beta/,KW_SIZE:/size/,KW_EVOLUTION:/evolution/,KW_ANCHOR:/anchor/,KW_COMPONENT:/component/,KW_LABEL:/label/,KW_INERTIA:/inertia/,KW_EVOLVE:/evolve/,KW_PIPELINE:/pipeline/,KW_NOTE:/note/,KW_ANNOTATIONS:/annotations/,KW_ANNOTATION:/annotation/,KW_ACCELERATOR:/accelerator/,KW_DEACCELERATOR:/deaccelerator/,NAME_WITH_SPACES:/(?!title\s|accTitle|accDescr)[A-Za-z][A-Za-z0-9_()&]*(?:[ \t]+[A-Za-z(][A-Za-z0-9_()&]*)*/,WS:/[ \t]+/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},ArchitectureGrammar.Terminals,GitGraphGrammar.Terminals,InfoGrammar.Terminals,PacketGrammar.Terminals,PieGrammar.Terminals,RadarGrammar.Terminals,TreeViewGrammar.Terminals,TreemapGrammar.Terminals,WardleyGrammar.Terminals;var Accelerator_$type="Accelerator",Accelerator_name="name",Accelerator_x="x",Accelerator_y="y",Anchor_$type="Anchor",Anchor_evolution="evolution",Anchor_name="name",Anchor_visibility="visibility",Annotation_$type="Annotation",Annotation_number="number",Annotation_text="text",Annotation_x="x",Annotation_y="y",Annotations_$type="Annotations",Annotations_x="x",Annotations_y="y",Architecture_$type="Architecture",Architecture_accDescr="accDescr",Architecture_accTitle="accTitle",Architecture_edges="edges",Architecture_groups="groups",Architecture_junctions="junctions",Architecture_services="services",Architecture_title="title";__name(function(item){return reflection.isInstance(item,Architecture_$type)},"isArchitecture");var Axis_$type="Axis",Axis_label="label",Axis_name="name",Branch_$type="Branch",Branch_name="name",Branch_order="order";__name(function(item){return reflection.isInstance(item,Branch_$type)},"isBranch");var Checkout_$type="Checkout",Checkout_branch="branch",CherryPicking_$type="CherryPicking",CherryPicking_id="id",CherryPicking_parent="parent",CherryPicking_tags="tags",ClassDefStatement_$type="ClassDefStatement",ClassDefStatement_className="className",ClassDefStatement_styleText="styleText",Commit_$type="Commit",Commit_id="id",Commit_message="message",Commit_tags="tags",Commit_type="type";__name(function(item){return reflection.isInstance(item,Commit_$type)},"isCommit");var Component_$type="Component",Component_decorator="decorator",Component_evolution="evolution",Component_inertia="inertia",Component_label="label",Component_name="name",Component_visibility="visibility",Curve_$type="Curve",Curve_entries="entries",Curve_label="label",Curve_name="name",Deaccelerator_$type="Deaccelerator",Deaccelerator_name="name",Deaccelerator_x="x",Deaccelerator_y="y",Decorator_$type="Decorator",Decorator_strategy="strategy",Direction_$type="Direction",Direction_accDescr="accDescr",Direction_accTitle="accTitle",Direction_dir="dir",Direction_statements="statements",Direction_title="title",Edge_$type="Edge",Edge_lhsDir="lhsDir",Edge_lhsGroup="lhsGroup",Edge_lhsId="lhsId",Edge_lhsInto="lhsInto",Edge_rhsDir="rhsDir",Edge_rhsGroup="rhsGroup",Edge_rhsId="rhsId",Edge_rhsInto="rhsInto",Edge_title="title",Entry_$type="Entry",Entry_axis="axis",Entry_value="value",Evolution_$type="Evolution",Evolution_stages="stages",EvolutionStage_$type="EvolutionStage",EvolutionStage_boundary="boundary",EvolutionStage_name="name",EvolutionStage_secondName="secondName",Evolve_$type="Evolve",Evolve_component="component",Evolve_target="target",GitGraph_$type="GitGraph",GitGraph_accDescr="accDescr",GitGraph_accTitle="accTitle",GitGraph_statements="statements",GitGraph_title="title";__name(function(item){return reflection.isInstance(item,GitGraph_$type)},"isGitGraph");var Group_$type="Group",Group_icon="icon",Group_id="id",Group_in="in",Group_title="title",Info_$type="Info",Info_accDescr="accDescr",Info_accTitle="accTitle",Info_title="title";__name(function(item){return reflection.isInstance(item,Info_$type)},"isInfo");var Item_$type="Item",Item_classSelector="classSelector",Item_name="name",Junction_$type="Junction",Junction_id="id",Junction_in="in",Label_$type="Label",Label_negX="negX",Label_negY="negY",Label_offsetX="offsetX",Label_offsetY="offsetY",Leaf_$type="Leaf",Leaf_classSelector="classSelector",Leaf_name="name",Leaf_value="value",Link_$type="Link",Link_arrow="arrow",Link_from="from",Link_fromPort="fromPort",Link_linkLabel="linkLabel",Link_to="to",Link_toPort="toPort",Merge_$type="Merge",Merge_branch="branch",Merge_id="id",Merge_tags="tags",Merge_type="type";__name(function(item){return reflection.isInstance(item,Merge_$type)},"isMerge");var Note_$type="Note",Note_evolution="evolution",Note_text="text",Note_visibility="visibility",Option2_$type="Option",Option2_name="name",Option2_value="value",Packet_$type="Packet",Packet_accDescr="accDescr",Packet_accTitle="accTitle",Packet_blocks="blocks",Packet_title="title";__name(function(item){return reflection.isInstance(item,Packet_$type)},"isPacket");var PacketBlock_$type="PacketBlock",PacketBlock_bits="bits",PacketBlock_end="end",PacketBlock_label="label",PacketBlock_start="start";__name(function(item){return reflection.isInstance(item,PacketBlock_$type)},"isPacketBlock");var Pie_$type="Pie",Pie_accDescr="accDescr",Pie_accTitle="accTitle",Pie_sections="sections",Pie_showData="showData",Pie_title="title";__name(function(item){return reflection.isInstance(item,Pie_$type)},"isPie");var PieSection_$type="PieSection",PieSection_label="label",PieSection_value="value";__name(function(item){return reflection.isInstance(item,PieSection_$type)},"isPieSection");var Pipeline_$type="Pipeline",Pipeline_components="components",Pipeline_parent="parent",PipelineComponent_$type="PipelineComponent",PipelineComponent_evolution="evolution",PipelineComponent_label="label",PipelineComponent_name="name",Radar_$type="Radar",Radar_accDescr="accDescr",Radar_accTitle="accTitle",Radar_axes="axes",Radar_curves="curves",Radar_options="options",Radar_title="title",Section_$type="Section",Section_classSelector="classSelector",Section_name="name",Service_$type="Service",Service_icon="icon",Service_iconText="iconText",Service_id="id",Service_in="in",Service_title="title",Size_$type="Size",Size_height="height",Size_width="width",Statement_$type="Statement",Treemap_$type="Treemap",Treemap_accDescr="accDescr",Treemap_accTitle="accTitle",Treemap_title="title",Treemap_TreemapRows="TreemapRows";__name(function(item){return reflection.isInstance(item,Treemap_$type)},"isTreemap");var TreemapRow_$type="TreemapRow",TreemapRow_indent="indent",TreemapRow_item="item",TreeNode_$type="TreeNode",TreeNode_indent="indent",TreeNode_name="name",TreeView_$type="TreeView",TreeView_accDescr="accDescr",TreeView_accTitle="accTitle",TreeView_nodes="nodes",TreeView_title="title",Wardley_$type="Wardley",Wardley_accDescr="accDescr",Wardley_accelerators="accelerators",Wardley_accTitle="accTitle",Wardley_anchors="anchors",Wardley_annotation="annotation",Wardley_annotations="annotations",Wardley_components="components",Wardley_deaccelerators="deaccelerators",Wardley_evolution="evolution",Wardley_evolves="evolves",Wardley_links="links",Wardley_notes="notes",Wardley_pipelines="pipelines",Wardley_size="size",Wardley_title="title";__name(function(item){return reflection.isInstance(item,Wardley_$type)},"isWardley");var loadedArchitectureGrammarGrammar,loadedGitGraphGrammarGrammar,loadedInfoGrammarGrammar,loadedPacketGrammarGrammar,loadedPieGrammarGrammar,loadedRadarGrammarGrammar,loadedTreemapGrammarGrammar,loadedTreeViewGrammarGrammar,loadedWardleyGrammarGrammar,MermaidAstReflection=(__name(_a=class extends AbstractAstReflection{constructor(){super(...arguments),this.types={Accelerator:{name:Accelerator_$type,properties:{name:{name:Accelerator_name},x:{name:Accelerator_x},y:{name:Accelerator_y}},superTypes:[]},Anchor:{name:Anchor_$type,properties:{evolution:{name:Anchor_evolution},name:{name:Anchor_name},visibility:{name:Anchor_visibility}},superTypes:[]},Annotation:{name:Annotation_$type,properties:{number:{name:Annotation_number},text:{name:Annotation_text},x:{name:Annotation_x},y:{name:Annotation_y}},superTypes:[]},Annotations:{name:Annotations_$type,properties:{x:{name:Annotations_x},y:{name:Annotations_y}},superTypes:[]},Architecture:{name:Architecture_$type,properties:{accDescr:{name:Architecture_accDescr},accTitle:{name:Architecture_accTitle},edges:{name:Architecture_edges,defaultValue:[]},groups:{name:Architecture_groups,defaultValue:[]},junctions:{name:Architecture_junctions,defaultValue:[]},services:{name:Architecture_services,defaultValue:[]},title:{name:Architecture_title}},superTypes:[]},Axis:{name:Axis_$type,properties:{label:{name:Axis_label},name:{name:Axis_name}},superTypes:[]},Branch:{name:Branch_$type,properties:{name:{name:Branch_name},order:{name:Branch_order}},superTypes:[Statement_$type]},Checkout:{name:Checkout_$type,properties:{branch:{name:Checkout_branch}},superTypes:[Statement_$type]},CherryPicking:{name:CherryPicking_$type,properties:{id:{name:CherryPicking_id},parent:{name:CherryPicking_parent},tags:{name:CherryPicking_tags,defaultValue:[]}},superTypes:[Statement_$type]},ClassDefStatement:{name:ClassDefStatement_$type,properties:{className:{name:ClassDefStatement_className},styleText:{name:ClassDefStatement_styleText}},superTypes:[]},Commit:{name:Commit_$type,properties:{id:{name:Commit_id},message:{name:Commit_message},tags:{name:Commit_tags,defaultValue:[]},type:{name:Commit_type}},superTypes:[Statement_$type]},Component:{name:Component_$type,properties:{decorator:{name:Component_decorator},evolution:{name:Component_evolution},inertia:{name:Component_inertia,defaultValue:!1},label:{name:Component_label},name:{name:Component_name},visibility:{name:Component_visibility}},superTypes:[]},Curve:{name:Curve_$type,properties:{entries:{name:Curve_entries,defaultValue:[]},label:{name:Curve_label},name:{name:Curve_name}},superTypes:[]},Deaccelerator:{name:Deaccelerator_$type,properties:{name:{name:Deaccelerator_name},x:{name:Deaccelerator_x},y:{name:Deaccelerator_y}},superTypes:[]},Decorator:{name:Decorator_$type,properties:{strategy:{name:Decorator_strategy}},superTypes:[]},Direction:{name:Direction_$type,properties:{accDescr:{name:Direction_accDescr},accTitle:{name:Direction_accTitle},dir:{name:Direction_dir},statements:{name:Direction_statements,defaultValue:[]},title:{name:Direction_title}},superTypes:[GitGraph_$type]},Edge:{name:Edge_$type,properties:{lhsDir:{name:Edge_lhsDir},lhsGroup:{name:Edge_lhsGroup,defaultValue:!1},lhsId:{name:Edge_lhsId},lhsInto:{name:Edge_lhsInto,defaultValue:!1},rhsDir:{name:Edge_rhsDir},rhsGroup:{name:Edge_rhsGroup,defaultValue:!1},rhsId:{name:Edge_rhsId},rhsInto:{name:Edge_rhsInto,defaultValue:!1},title:{name:Edge_title}},superTypes:[]},Entry:{name:Entry_$type,properties:{axis:{name:Entry_axis,referenceType:Axis_$type},value:{name:Entry_value}},superTypes:[]},Evolution:{name:Evolution_$type,properties:{stages:{name:Evolution_stages,defaultValue:[]}},superTypes:[]},EvolutionStage:{name:EvolutionStage_$type,properties:{boundary:{name:EvolutionStage_boundary},name:{name:EvolutionStage_name},secondName:{name:EvolutionStage_secondName}},superTypes:[]},Evolve:{name:Evolve_$type,properties:{component:{name:Evolve_component},target:{name:Evolve_target}},superTypes:[]},GitGraph:{name:GitGraph_$type,properties:{accDescr:{name:GitGraph_accDescr},accTitle:{name:GitGraph_accTitle},statements:{name:GitGraph_statements,defaultValue:[]},title:{name:GitGraph_title}},superTypes:[]},Group:{name:Group_$type,properties:{icon:{name:Group_icon},id:{name:Group_id},in:{name:Group_in},title:{name:Group_title}},superTypes:[]},Info:{name:Info_$type,properties:{accDescr:{name:Info_accDescr},accTitle:{name:Info_accTitle},title:{name:Info_title}},superTypes:[]},Item:{name:Item_$type,properties:{classSelector:{name:Item_classSelector},name:{name:Item_name}},superTypes:[]},Junction:{name:Junction_$type,properties:{id:{name:Junction_id},in:{name:Junction_in}},superTypes:[]},Label:{name:Label_$type,properties:{negX:{name:Label_negX,defaultValue:!1},negY:{name:Label_negY,defaultValue:!1},offsetX:{name:Label_offsetX},offsetY:{name:Label_offsetY}},superTypes:[]},Leaf:{name:Leaf_$type,properties:{classSelector:{name:Leaf_classSelector},name:{name:Leaf_name},value:{name:Leaf_value}},superTypes:[Item_$type]},Link:{name:Link_$type,properties:{arrow:{name:Link_arrow},from:{name:Link_from},fromPort:{name:Link_fromPort},linkLabel:{name:Link_linkLabel},to:{name:Link_to},toPort:{name:Link_toPort}},superTypes:[]},Merge:{name:Merge_$type,properties:{branch:{name:Merge_branch},id:{name:Merge_id},tags:{name:Merge_tags,defaultValue:[]},type:{name:Merge_type}},superTypes:[Statement_$type]},Note:{name:Note_$type,properties:{evolution:{name:Note_evolution},text:{name:Note_text},visibility:{name:Note_visibility}},superTypes:[]},Option:{name:Option2_$type,properties:{name:{name:Option2_name},value:{name:Option2_value,defaultValue:!1}},superTypes:[]},Packet:{name:Packet_$type,properties:{accDescr:{name:Packet_accDescr},accTitle:{name:Packet_accTitle},blocks:{name:Packet_blocks,defaultValue:[]},title:{name:Packet_title}},superTypes:[]},PacketBlock:{name:PacketBlock_$type,properties:{bits:{name:PacketBlock_bits},end:{name:PacketBlock_end},label:{name:PacketBlock_label},start:{name:PacketBlock_start}},superTypes:[]},Pie:{name:Pie_$type,properties:{accDescr:{name:Pie_accDescr},accTitle:{name:Pie_accTitle},sections:{name:Pie_sections,defaultValue:[]},showData:{name:Pie_showData,defaultValue:!1},title:{name:Pie_title}},superTypes:[]},PieSection:{name:PieSection_$type,properties:{label:{name:PieSection_label},value:{name:PieSection_value}},superTypes:[]},Pipeline:{name:Pipeline_$type,properties:{components:{name:Pipeline_components,defaultValue:[]},parent:{name:Pipeline_parent}},superTypes:[]},PipelineComponent:{name:PipelineComponent_$type,properties:{evolution:{name:PipelineComponent_evolution},label:{name:PipelineComponent_label},name:{name:PipelineComponent_name}},superTypes:[]},Radar:{name:Radar_$type,properties:{accDescr:{name:Radar_accDescr},accTitle:{name:Radar_accTitle},axes:{name:Radar_axes,defaultValue:[]},curves:{name:Radar_curves,defaultValue:[]},options:{name:Radar_options,defaultValue:[]},title:{name:Radar_title}},superTypes:[]},Section:{name:Section_$type,properties:{classSelector:{name:Section_classSelector},name:{name:Section_name}},superTypes:[Item_$type]},Service:{name:Service_$type,properties:{icon:{name:Service_icon},iconText:{name:Service_iconText},id:{name:Service_id},in:{name:Service_in},title:{name:Service_title}},superTypes:[]},Size:{name:Size_$type,properties:{height:{name:Size_height},width:{name:Size_width}},superTypes:[]},Statement:{name:Statement_$type,properties:{},superTypes:[]},TreeNode:{name:TreeNode_$type,properties:{indent:{name:TreeNode_indent},name:{name:TreeNode_name}},superTypes:[]},TreeView:{name:TreeView_$type,properties:{accDescr:{name:TreeView_accDescr},accTitle:{name:TreeView_accTitle},nodes:{name:TreeView_nodes,defaultValue:[]},title:{name:TreeView_title}},superTypes:[]},Treemap:{name:Treemap_$type,properties:{accDescr:{name:Treemap_accDescr},accTitle:{name:Treemap_accTitle},title:{name:Treemap_title},TreemapRows:{name:Treemap_TreemapRows,defaultValue:[]}},superTypes:[]},TreemapRow:{name:TreemapRow_$type,properties:{indent:{name:TreemapRow_indent},item:{name:TreemapRow_item}},superTypes:[]},Wardley:{name:Wardley_$type,properties:{accDescr:{name:Wardley_accDescr},accelerators:{name:Wardley_accelerators,defaultValue:[]},accTitle:{name:Wardley_accTitle},anchors:{name:Wardley_anchors,defaultValue:[]},annotation:{name:Wardley_annotation,defaultValue:[]},annotations:{name:Wardley_annotations,defaultValue:[]},components:{name:Wardley_components,defaultValue:[]},deaccelerators:{name:Wardley_deaccelerators,defaultValue:[]},evolution:{name:Wardley_evolution},evolves:{name:Wardley_evolves,defaultValue:[]},links:{name:Wardley_links,defaultValue:[]},notes:{name:Wardley_notes,defaultValue:[]},pipelines:{name:Wardley_pipelines,defaultValue:[]},size:{name:Wardley_size},title:{name:Wardley_title}},superTypes:[]}}}},"MermaidAstReflection"),_a),reflection=new MermaidAstReflection,ArchitectureGrammarGrammar=__name(()=>loadedArchitectureGrammarGrammar??(loadedArchitectureGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"ArchitectureGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","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":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"LeftPort","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"RightPort","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"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@29"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@18"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[(?:\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'|[\\\\w ]+)\\\\]/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}')),"ArchitectureGrammarGrammar"),GitGraphGrammarGrammar=__name(()=>loadedGitGraphGrammarGrammar??(loadedGitGraphGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"GitGraphGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"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@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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"}]}},"entry":false,"fragment":false,"parameters":[]},{"$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@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}')),"GitGraphGrammarGrammar"),InfoGrammarGrammar=__name(()=>loadedInfoGrammarGrammar??(loadedInfoGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"InfoGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","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@1"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"InfoGrammarGrammar"),PacketGrammarGrammar=__name(()=>loadedPacketGrammarGrammar??(loadedPacketGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"PacketGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"PacketGrammarGrammar"),PieGrammarGrammar=__name(()=>loadedPieGrammarGrammar??(loadedPieGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"PieGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"PieGrammarGrammar"),RadarGrammarGrammar=__name(()=>loadedRadarGrammarGrammar??(loadedRadarGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"RadarGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}},"isMulti":false}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"types":[]}')),"RadarGrammarGrammar"),TreemapGrammarGrammar=__name(()=>loadedTreemapGrammarGrammar??(loadedTreemapGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"TreemapGrammar","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@15"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}')),"TreemapGrammarGrammar"),TreeViewGrammarGrammar=__name(()=>loadedTreeViewGrammarGrammar??(loadedTreeViewGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"TreeViewGrammar","rules":[{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"TreeView","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"treeView-beta"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"nodes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreeNode","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"TreeView","attributes":[{"$type":"TypeAttribute","name":"nodes","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@9"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * TreeView grammar for Langium\\n * Converted from treemap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treeView declaration.\\n */"}')),"TreeViewGrammarGrammar"),WardleyGrammarGrammar=__name(()=>loadedWardleyGrammarGrammar??(loadedWardleyGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"WardleyGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Wardley","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"size","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"anchors","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"links","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"evolves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"pipelines","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"notes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"annotations","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"annotation","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Assignment","feature":"deaccelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Size","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"width","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"height","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolution","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EvolutionStage","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"@"},{"$type":"Assignment","feature":"boundary","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"/"},{"$type":"Assignment","feature":"secondName","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Anchor","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Component","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"decorator","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Keyword","value":")"}]}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Label","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"negX","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetX","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"negY","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetY","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Decorator","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"strategy","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Link","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"fromPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"arrow","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]},"cardinality":"?"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"toPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"linkLabel","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolve","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]},{"$type":"Assignment","feature":"component","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Pipeline","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"+"},{"$type":"Keyword","value":"}"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PipelineComponent","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Note","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotations","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotation","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]},{"$type":"Assignment","feature":"number","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CoordinateValue","dataType":"number","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Accelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Deaccelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"WARDLEY_NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"->"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_PORT","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<>"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+>"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_ARROW","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"--\x3e"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-.->"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":">"},"parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+\'[^\']*\'<>/","parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+\'[^\']*\'</","parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+\'[^\']*\'>/","parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_LABEL","definition":{"$type":"RegexToken","regex":"/;[^\\\\n\\\\r]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRATEGY","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"build"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"buy"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"outsource"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"market"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_WARDLEY","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"wardley-beta"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_SIZE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"size"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLUTION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolution"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANCHOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"anchor"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_COMPONENT","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"component"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_LABEL","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"label"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_INERTIA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"inertia"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLVE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolve"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_PIPELINE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"pipeline"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_NOTE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"note"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATIONS","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotations"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotation"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"accelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_DEACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"deaccelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NAME_WITH_SPACES","definition":{"$type":"RegexToken","regex":"/(?!title\\\\s|accTitle|accDescr)[A-Za-z][A-Za-z0-9_()&]*(?:[ \\\\t]+[A-Za-z(][A-Za-z0-9_()&]*)*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@47"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@48"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"WardleyGrammarGrammar"),ArchitectureGrammarLanguageMetaData={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},GitGraphGrammarLanguageMetaData={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},InfoGrammarLanguageMetaData={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},PacketGrammarLanguageMetaData={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},PieGrammarLanguageMetaData={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},RadarGrammarLanguageMetaData={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},TreemapGrammarLanguageMetaData={languageId:"treemap",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},TreeViewGrammarLanguageMetaData={languageId:"treeView",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},WardleyGrammarLanguageMetaData={languageId:"wardley",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},MermaidGeneratedSharedModule={AstReflection:__name(()=>new MermaidAstReflection,"AstReflection")},ArchitectureGrammarGeneratedModule={Grammar:__name(()=>ArchitectureGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>ArchitectureGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},GitGraphGrammarGeneratedModule={Grammar:__name(()=>GitGraphGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>GitGraphGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},InfoGrammarGeneratedModule={Grammar:__name(()=>InfoGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>InfoGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},PacketGrammarGeneratedModule={Grammar:__name(()=>PacketGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>PacketGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},PieGrammarGeneratedModule={Grammar:__name(()=>PieGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>PieGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},RadarGrammarGeneratedModule={Grammar:__name(()=>RadarGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>RadarGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},TreemapGrammarGeneratedModule={Grammar:__name(()=>TreemapGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>TreemapGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},TreeViewGrammarGeneratedModule={Grammar:__name(()=>TreeViewGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>TreeViewGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},WardleyGrammarGeneratedModule={Grammar:__name(()=>WardleyGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>WardleyGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},rulesRegexes={ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/accTitle[\t ]*:([^\n\r]*)/,TITLE:/title([\t ][^\n\r]*|)/},AbstractMermaidValueConverter=(__name(_b=class extends DefaultValueConverter{runConverter(rule,input,cstNode){let value=this.runCommonConverter(rule,input,cstNode);return void 0===value&&(value=this.runCustomConverter(rule,input,cstNode)),void 0===value?super.runConverter(rule,input,cstNode):value}runCommonConverter(rule,input,_cstNode){const regex=rulesRegexes[rule.name];if(void 0===regex)return;const match=regex.exec(input);return null!==match?void 0!==match[1]?match[1].trim().replace(/[\t ]{2,}/gm," "):void 0!==match[2]?match[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,"\n"):void 0:void 0}},"AbstractMermaidValueConverter"),_b),CommonValueConverter=(__name(_c=class extends AbstractMermaidValueConverter{runCustomConverter(_rule,_input,_cstNode){}},"CommonValueConverter"),_c),AbstractMermaidTokenBuilder=(__name(_d=class extends DefaultTokenBuilder{constructor(keywords){super(),this.keywords=new Set(keywords)}buildKeywordTokens(rules,terminalTokens,options){const tokenTypes=super.buildKeywordTokens(rules,terminalTokens,options);return tokenTypes.forEach(tokenType=>{this.keywords.has(tokenType.name)&&void 0!==tokenType.PATTERN&&(tokenType.PATTERN=new RegExp(tokenType.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),tokenTypes}},"AbstractMermaidTokenBuilder"),_d);__name(class extends AbstractMermaidTokenBuilder{},"CommonTokenBuilder");var TreemapTokenBuilder=(__name(_f=class extends AbstractMermaidTokenBuilder{constructor(){super(["treemap"])}},"TreemapTokenBuilder"),_f),classDefRegex=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,TreemapValueConverter=(__name(_g=class extends AbstractMermaidValueConverter{runCustomConverter(rule,input,_cstNode){if("NUMBER2"===rule.name)return parseFloat(input.replace(/,/g,""));if("SEPARATOR"===rule.name)return input.substring(1,input.length-1);if("STRING2"===rule.name)return input.substring(1,input.length-1);if("INDENTATION"===rule.name)return input.length;if("ClassDef"===rule.name){if("string"!=typeof input)return input;const match=classDefRegex.exec(input);if(match)return{$type:"ClassDefStatement",className:match[1],styleText:match[2]||void 0}}}},"TreemapValueConverter"),_g);function registerValidationChecks(services){const validator=services.validation.TreemapValidator,registry=services.validation.ValidationRegistry;if(registry){const checks={Treemap:validator.checkSingleRoot.bind(validator)};registry.register(checks,validator)}}__name(registerValidationChecks,"registerValidationChecks");var TreemapValidator=(__name(_h=class{checkSingleRoot(doc,accept){let rootNodeIndentation;for(const row of doc.TreemapRows)row.item&&(void 0===rootNodeIndentation&&void 0===row.indent?rootNodeIndentation=0:(void 0===row.indent||void 0!==rootNodeIndentation&&rootNodeIndentation>=parseInt(row.indent,10))&&accept("error","Multiple root nodes are not allowed in a treemap.",{node:row,property:"item"}))}},"TreemapValidator"),_h),TreemapModule={parser:{TokenBuilder:__name(()=>new TreemapTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new TreemapValueConverter,"ValueConverter")},validation:{TreemapValidator:__name(()=>new TreemapValidator,"TreemapValidator")}};function createTreemapServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Treemap2=inject(createDefaultCoreModule({shared:shared}),TreemapGrammarGeneratedModule,TreemapModule);return shared.ServiceRegistry.register(Treemap2),registerValidationChecks(Treemap2),{shared:shared,Treemap:Treemap2}}__name(createTreemapServices,"createTreemapServices");var WardleyValueConverter=(__name(_i=class extends AbstractMermaidValueConverter{runCustomConverter(rule,input,_cstNode){if("LINK_LABEL"===rule.name.toUpperCase())return input.substring(1).trim()}},"WardleyValueConverter"),_i),WardleyModule={parser:{ValueConverter:__name(()=>new WardleyValueConverter,"ValueConverter")}};function createWardleyServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Wardley2=inject(createDefaultCoreModule({shared:shared}),WardleyGrammarGeneratedModule,WardleyModule);return shared.ServiceRegistry.register(Wardley2),{shared:shared,Wardley:Wardley2}}__name(createWardleyServices,"createWardleyServices");var GitGraphTokenBuilder=(__name(_j=class extends AbstractMermaidTokenBuilder{constructor(){super(["gitGraph"])}},"GitGraphTokenBuilder"),_j),GitGraphModule={parser:{TokenBuilder:__name(()=>new GitGraphTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new CommonValueConverter,"ValueConverter")}};function createGitGraphServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),GitGraph2=inject(createDefaultCoreModule({shared:shared}),GitGraphGrammarGeneratedModule,GitGraphModule);return shared.ServiceRegistry.register(GitGraph2),{shared:shared,GitGraph:GitGraph2}}__name(createGitGraphServices,"createGitGraphServices");var InfoTokenBuilder=(__name(_k=class extends AbstractMermaidTokenBuilder{constructor(){super(["info","showInfo"])}},"InfoTokenBuilder"),_k),InfoModule={parser:{TokenBuilder:__name(()=>new InfoTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new CommonValueConverter,"ValueConverter")}};function createInfoServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Info2=inject(createDefaultCoreModule({shared:shared}),InfoGrammarGeneratedModule,InfoModule);return shared.ServiceRegistry.register(Info2),{shared:shared,Info:Info2}}__name(createInfoServices,"createInfoServices");var PacketTokenBuilder=(__name(_l=class extends AbstractMermaidTokenBuilder{constructor(){super(["packet"])}},"PacketTokenBuilder"),_l),PacketModule={parser:{TokenBuilder:__name(()=>new PacketTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new CommonValueConverter,"ValueConverter")}};function createPacketServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Packet2=inject(createDefaultCoreModule({shared:shared}),PacketGrammarGeneratedModule,PacketModule);return shared.ServiceRegistry.register(Packet2),{shared:shared,Packet:Packet2}}__name(createPacketServices,"createPacketServices");var PieTokenBuilder=(__name(_m=class extends AbstractMermaidTokenBuilder{constructor(){super(["pie","showData"])}},"PieTokenBuilder"),_m),PieValueConverter=(__name(_n=class extends AbstractMermaidValueConverter{runCustomConverter(rule,input,_cstNode){if("PIE_SECTION_LABEL"===rule.name)return input.replace(/"/g,"").trim()}},"PieValueConverter"),_n),PieModule={parser:{TokenBuilder:__name(()=>new PieTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new PieValueConverter,"ValueConverter")}};function createPieServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Pie2=inject(createDefaultCoreModule({shared:shared}),PieGrammarGeneratedModule,PieModule);return shared.ServiceRegistry.register(Pie2),{shared:shared,Pie:Pie2}}__name(createPieServices,"createPieServices");var TreeViewValueConverter=(__name(_o=class extends AbstractMermaidValueConverter{runCustomConverter(rule,input,_cstNode){return"INDENTATION"===rule.name?(null==input?void 0:input.length)||0:"STRING2"===rule.name?input.substring(1,input.length-1):void 0}},"TreeViewValueConverter"),_o),TreeViewTokenBuilder=(__name(_p=class extends AbstractMermaidTokenBuilder{constructor(){super(["treeView-beta"])}},"TreeViewTokenBuilder"),_p),TreeViewModule={parser:{TokenBuilder:__name(()=>new TreeViewTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new TreeViewValueConverter,"ValueConverter")}};function createTreeViewServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),TreeView2=inject(createDefaultCoreModule({shared:shared}),TreeViewGrammarGeneratedModule,TreeViewModule);return shared.ServiceRegistry.register(TreeView2),{shared:shared,TreeView:TreeView2}}__name(createTreeViewServices,"createTreeViewServices");var ArchitectureTokenBuilder=(__name(_q=class extends AbstractMermaidTokenBuilder{constructor(){super(["architecture"])}},"ArchitectureTokenBuilder"),_q),ArchitectureValueConverter=(__name(_r=class extends AbstractMermaidValueConverter{runCustomConverter(rule,input,_cstNode){if("ARCH_ICON"===rule.name)return input.replace(/[()]/g,"").trim();if("ARCH_TEXT_ICON"===rule.name)return input.replace(/["()]/g,"");if("ARCH_TITLE"===rule.name){let result=input.replace(/^\[|]$/g,"").trim();return(result.startsWith('"')&&result.endsWith('"')||result.startsWith("'")&&result.endsWith("'"))&&(result=result.slice(1,-1),result=result.replace(/\\"/g,'"').replace(/\\'/g,"'")),result.trim()}}},"ArchitectureValueConverter"),_r),ArchitectureModule={parser:{TokenBuilder:__name(()=>new ArchitectureTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new ArchitectureValueConverter,"ValueConverter")}};function createArchitectureServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Architecture2=inject(createDefaultCoreModule({shared:shared}),ArchitectureGrammarGeneratedModule,ArchitectureModule);return shared.ServiceRegistry.register(Architecture2),{shared:shared,Architecture:Architecture2}}__name(createArchitectureServices,"createArchitectureServices");var RadarTokenBuilder=(__name(_s=class extends AbstractMermaidTokenBuilder{constructor(){super(["radar-beta"])}},"RadarTokenBuilder"),_s),RadarModule={parser:{TokenBuilder:__name(()=>new RadarTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new CommonValueConverter,"ValueConverter")}};function createRadarServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Radar2=inject(createDefaultCoreModule({shared:shared}),RadarGrammarGeneratedModule,RadarModule);return shared.ServiceRegistry.register(Radar2),{shared:shared,Radar:Radar2}}__name(createRadarServices,"createRadarServices");var parsers={},initializers={info:__name(async()=>{const{createInfoServices:createInfoServices2}=await __vitePreload(async()=>{const{createInfoServices:createInfoServices22}=await Promise.resolve().then(()=>infoOMHHGYJF);return{createInfoServices:createInfoServices22}},void 0),parser=createInfoServices2().Info.parser.LangiumParser;parsers.info=parser},"info"),packet:__name(async()=>{const{createPacketServices:createPacketServices2}=await __vitePreload(async()=>{const{createPacketServices:createPacketServices22}=await Promise.resolve().then(()=>packet4T2RLAQJ);return{createPacketServices:createPacketServices22}},void 0),parser=createPacketServices2().Packet.parser.LangiumParser;parsers.packet=parser},"packet"),pie:__name(async()=>{const{createPieServices:createPieServices2}=await __vitePreload(async()=>{const{createPieServices:createPieServices22}=await Promise.resolve().then(()=>pieZZUOXDRM);return{createPieServices:createPieServices22}},void 0),parser=createPieServices2().Pie.parser.LangiumParser;parsers.pie=parser},"pie"),treeView:__name(async()=>{const{createTreeViewServices:createTreeViewServices2}=await __vitePreload(async()=>{const{createTreeViewServices:createTreeViewServices22}=await Promise.resolve().then(()=>treeViewSZITEDCU);return{createTreeViewServices:createTreeViewServices22}},void 0),parser=createTreeViewServices2().TreeView.parser.LangiumParser;parsers.treeView=parser},"treeView"),architecture:__name(async()=>{const{createArchitectureServices:createArchitectureServices2}=await __vitePreload(async()=>{const{createArchitectureServices:createArchitectureServices22}=await Promise.resolve().then(()=>architectureYZFGNWBL);return{createArchitectureServices:createArchitectureServices22}},void 0),parser=createArchitectureServices2().Architecture.parser.LangiumParser;parsers.architecture=parser},"architecture"),gitGraph:__name(async()=>{const{createGitGraphServices:createGitGraphServices2}=await __vitePreload(async()=>{const{createGitGraphServices:createGitGraphServices22}=await Promise.resolve().then(()=>gitGraph7Q5UKJZL);return{createGitGraphServices:createGitGraphServices22}},void 0),parser=createGitGraphServices2().GitGraph.parser.LangiumParser;parsers.gitGraph=parser},"gitGraph"),radar:__name(async()=>{const{createRadarServices:createRadarServices2}=await __vitePreload(async()=>{const{createRadarServices:createRadarServices22}=await Promise.resolve().then(()=>radarPYXPWWZC);return{createRadarServices:createRadarServices22}},void 0),parser=createRadarServices2().Radar.parser.LangiumParser;parsers.radar=parser},"radar"),treemap:__name(async()=>{const{createTreemapServices:createTreemapServices2}=await __vitePreload(async()=>{const{createTreemapServices:createTreemapServices22}=await Promise.resolve().then(()=>treemapW4RFUUIX);return{createTreemapServices:createTreemapServices22}},void 0),parser=createTreemapServices2().Treemap.parser.LangiumParser;parsers.treemap=parser},"treemap"),wardley:__name(async()=>{const{createWardleyServices:createWardleyServices2}=await __vitePreload(async()=>{const{createWardleyServices:createWardleyServices22}=await Promise.resolve().then(()=>wardleyRL74JXVD);return{createWardleyServices:createWardleyServices22}},void 0),parser=createWardleyServices2().Wardley.parser.LangiumParser;parsers.wardley=parser},"wardley")};async function parse(diagramType,text){const initializer=initializers[diagramType];if(!initializer)throw new Error(`Unknown diagram type: ${diagramType}`);parsers[diagramType]||await initializer();const result=parsers[diagramType].parse(text);if(result.lexerErrors.length>0||result.parserErrors.length>0)throw new MermaidParseError(result);return result.value}__name(parse,"parse");var MermaidParseError=(__name(_t=class extends Error{constructor(result){super(`Parsing failed: ${result.lexerErrors.map(err=>`Lexer error on line ${void 0===err.line||isNaN(err.line)?"?":err.line}, column ${void 0===err.column||isNaN(err.column)?"?":err.column}: ${err.message}`).join("\n")} ${result.parserErrors.map(err=>`Parse error on line ${void 0===err.token.startLine||isNaN(err.token.startLine)?"?":err.token.startLine}, column ${void 0===err.token.startColumn||isNaN(err.token.startColumn)?"?":err.token.startColumn}: ${err.message}`).join("\n")}`),this.result=result}},"MermaidParseError"),_t);const infoOMHHGYJF=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:InfoModule,createInfoServices:createInfoServices},Symbol.toStringTag,{value:"Module"})),packet4T2RLAQJ=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:PacketModule,createPacketServices:createPacketServices},Symbol.toStringTag,{value:"Module"})),pieZZUOXDRM=Object.freeze(Object.defineProperty({__proto__:null,PieModule:PieModule,createPieServices:createPieServices},Symbol.toStringTag,{value:"Module"})),treeViewSZITEDCU=Object.freeze(Object.defineProperty({__proto__:null,TreeViewModule:TreeViewModule,createTreeViewServices:createTreeViewServices},Symbol.toStringTag,{value:"Module"})),architectureYZFGNWBL=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:ArchitectureModule,createArchitectureServices:createArchitectureServices},Symbol.toStringTag,{value:"Module"})),gitGraph7Q5UKJZL=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:GitGraphModule,createGitGraphServices:createGitGraphServices},Symbol.toStringTag,{value:"Module"})),radarPYXPWWZC=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:RadarModule,createRadarServices:createRadarServices},Symbol.toStringTag,{value:"Module"})),treemapW4RFUUIX=Object.freeze(Object.defineProperty({__proto__:null,TreemapModule:TreemapModule,createTreemapServices:createTreemapServices},Symbol.toStringTag,{value:"Module"})),wardleyRL74JXVD=Object.freeze(Object.defineProperty({__proto__:null,WardleyModule:WardleyModule,createWardleyServices:createWardleyServices},Symbol.toStringTag,{value:"Module"}));export{parse as p};
1
+ var _a,_b,_c,_d,_f,_g,_h,_i,_j,_k,_l,_m,_n,_o,_p,_q,_r,_s,_t,__defProp=Object.defineProperty,__publicField=(obj,key,value)=>((obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value)(obj,"symbol"!=typeof key?key+"":key,value);import{_ as __vitePreload}from"./vendor-mdxeditor-BFiCaYAL.js";import{m as map,f as flatten,d as min}from"./min-CDzial6q.js";import{b as baseFlatten,l as baseUniq,c as baseIteratee,m as filter,r as reduce,n as forEach}from"./_baseUniq-DGKwdzTD.js";import{b9 as isEmpty}from"./mermaid.core-f1mZHh7u.js";import{a9 as getAugmentedNamespace}from"./vendor-antd-jGWxgt_-.js";function isAstNode(obj){return"object"==typeof obj&&null!==obj&&"string"==typeof obj.$type}function isReference(obj){return"object"==typeof obj&&null!==obj&&"string"==typeof obj.$refText&&"ref"in obj}function isMultiReference(obj){return"object"==typeof obj&&null!==obj&&"string"==typeof obj.$refText&&"items"in obj}function isLinkingError(obj){return"object"==typeof obj&&null!==obj&&"object"==typeof obj.info&&"string"==typeof obj.message}class AbstractAstReflection{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(refInfo){var _a2;const metaData=this.types[refInfo.container.$type];if(!metaData)throw new Error(`Type ${refInfo.container.$type||"undefined"} not found.`);const referenceType=null==(_a2=metaData.properties[refInfo.property])?void 0:_a2.referenceType;if(!referenceType)throw new Error(`Property ${refInfo.property||"undefined"} of type ${refInfo.container.$type} is not a reference.`);return referenceType}getTypeMetaData(type){const result=this.types[type];return result||{name:type,properties:{},superTypes:[]}}isInstance(node,type){return isAstNode(node)&&this.isSubtype(node.$type,type)}isSubtype(subtype,supertype){if(subtype===supertype)return!0;let nested=this.subtypes[subtype];nested||(nested=this.subtypes[subtype]={});const existing=nested[supertype];if(void 0!==existing)return existing;{const metaData=this.types[subtype],result=!!metaData&&metaData.superTypes.some(s=>this.isSubtype(s,supertype));return nested[supertype]=result,result}}getAllSubTypes(type){const existing=this.allSubtypes[type];if(existing)return existing;{const allTypes=this.getAllTypes(),types=[];for(const possibleSubType of allTypes)this.isSubtype(possibleSubType,type)&&types.push(possibleSubType);return this.allSubtypes[type]=types,types}}}function isCompositeCstNode(node){return"object"==typeof node&&null!==node&&Array.isArray(node.content)}function isLeafCstNode(node){return"object"==typeof node&&null!==node&&"object"==typeof node.tokenType}function isRootCstNode(node){return isCompositeCstNode(node)&&"string"==typeof node.fullText}class StreamImpl{constructor(startFn,nextFn){this.startFn=startFn,this.nextFn=nextFn}iterator(){const iterator={state:this.startFn(),next:()=>this.nextFn(iterator.state),[Symbol.iterator]:()=>iterator};return iterator}[Symbol.iterator](){return this.iterator()}isEmpty(){const iterator=this.iterator();return Boolean(iterator.next().done)}count(){const iterator=this.iterator();let count=0,next=iterator.next();for(;!next.done;)count++,next=iterator.next();return count}toArray(){const result=[],iterator=this.iterator();let next;do{next=iterator.next(),void 0!==next.value&&result.push(next.value)}while(!next.done);return result}toSet(){return new Set(this)}toMap(keyFn,valueFn){const entryStream=this.map(element=>[keyFn?keyFn(element):element,valueFn?valueFn(element):element]);return new Map(entryStream)}toString(){return this.join()}concat(other){return new StreamImpl(()=>({first:this.startFn(),firstDone:!1,iterator:other[Symbol.iterator]()}),state=>{let result;if(!state.firstDone){do{if(result=this.nextFn(state.first),!result.done)return result}while(!result.done);state.firstDone=!0}do{if(result=state.iterator.next(),!result.done)return result}while(!result.done);return DONE_RESULT})}join(separator=","){const iterator=this.iterator();let result,value="",addSeparator=!1;do{result=iterator.next(),result.done||(addSeparator&&(value+=separator),value+=toString(result.value)),addSeparator=!0}while(!result.done);return value}indexOf(searchElement,fromIndex=0){const iterator=this.iterator();let index=0,next=iterator.next();for(;!next.done;){if(index>=fromIndex&&next.value===searchElement)return index;next=iterator.next(),index++}return-1}every(predicate){const iterator=this.iterator();let next=iterator.next();for(;!next.done;){if(!predicate(next.value))return!1;next=iterator.next()}return!0}some(predicate){const iterator=this.iterator();let next=iterator.next();for(;!next.done;){if(predicate(next.value))return!0;next=iterator.next()}return!1}forEach(callbackfn){const iterator=this.iterator();let index=0,next=iterator.next();for(;!next.done;)callbackfn(next.value,index),next=iterator.next(),index++}map(callbackfn){return new StreamImpl(this.startFn,state=>{const{done:done,value:value}=this.nextFn(state);return done?DONE_RESULT:{done:!1,value:callbackfn(value)}})}filter(predicate){return new StreamImpl(this.startFn,state=>{let result;do{if(result=this.nextFn(state),!result.done&&predicate(result.value))return result}while(!result.done);return DONE_RESULT})}nonNullable(){return this.filter(e=>null!=e)}reduce(callbackfn,initialValue){const iterator=this.iterator();let previousValue=initialValue,next=iterator.next();for(;!next.done;)previousValue=void 0===previousValue?next.value:callbackfn(previousValue,next.value),next=iterator.next();return previousValue}reduceRight(callbackfn,initialValue){return this.recursiveReduce(this.iterator(),callbackfn,initialValue)}recursiveReduce(iterator,callbackfn,initialValue){const next=iterator.next();if(next.done)return initialValue;const previousValue=this.recursiveReduce(iterator,callbackfn,initialValue);return void 0===previousValue?next.value:callbackfn(previousValue,next.value)}find(predicate){const iterator=this.iterator();let next=iterator.next();for(;!next.done;){if(predicate(next.value))return next.value;next=iterator.next()}}findIndex(predicate){const iterator=this.iterator();let index=0,next=iterator.next();for(;!next.done;){if(predicate(next.value))return index;next=iterator.next(),index++}return-1}includes(searchElement){const iterator=this.iterator();let next=iterator.next();for(;!next.done;){if(next.value===searchElement)return!0;next=iterator.next()}return!1}flatMap(callbackfn){return new StreamImpl(()=>({this:this.startFn()}),state=>{do{if(state.iterator){const next=state.iterator.next();if(!next.done)return next;state.iterator=void 0}const{done:done,value:value}=this.nextFn(state.this);if(!done){const mapped=callbackfn(value);if(!isIterable(mapped))return{done:!1,value:mapped};state.iterator=mapped[Symbol.iterator]()}}while(state.iterator);return DONE_RESULT})}flat(depth){if(void 0===depth&&(depth=1),depth<=0)return this;const stream2=depth>1?this.flat(depth-1):this;return new StreamImpl(()=>({this:stream2.startFn()}),state=>{do{if(state.iterator){const next=state.iterator.next();if(!next.done)return next;state.iterator=void 0}const{done:done,value:value}=stream2.nextFn(state.this);if(!done){if(!isIterable(value))return{done:!1,value:value};state.iterator=value[Symbol.iterator]()}}while(state.iterator);return DONE_RESULT})}head(){const result=this.iterator().next();if(!result.done)return result.value}tail(skipCount=1){return new StreamImpl(()=>{const state=this.startFn();for(let i=0;i<skipCount;i++){if(this.nextFn(state).done)return state}return state},this.nextFn)}limit(maxSize){return new StreamImpl(()=>({size:0,state:this.startFn()}),state=>(state.size++,state.size>maxSize?DONE_RESULT:this.nextFn(state.state)))}distinct(by){return new StreamImpl(()=>({set:new Set,internalState:this.startFn()}),state=>{let result;do{if(result=this.nextFn(state.internalState),!result.done){const value=by?by(result.value):result.value;if(!state.set.has(value))return state.set.add(value),result}}while(!result.done);return DONE_RESULT})}exclude(other,key){const otherKeySet=new Set;for(const item of other){const value=key?key(item):item;otherKeySet.add(value)}return this.filter(e=>{const ownKey=key?key(e):e;return!otherKeySet.has(ownKey)})}}function toString(item){return"string"==typeof item?item:void 0===item?"undefined":"function"==typeof item.toString?item.toString():Object.prototype.toString.call(item)}function isIterable(obj){return!!obj&&"function"==typeof obj[Symbol.iterator]}const EMPTY_STREAM=new StreamImpl(()=>{},()=>DONE_RESULT),DONE_RESULT=Object.freeze({done:!0,value:void 0});function stream(...collections){if(1===collections.length){const collection=collections[0];if(collection instanceof StreamImpl)return collection;if(isIterable(collection))return new StreamImpl(()=>collection[Symbol.iterator](),iterator=>iterator.next());if("number"==typeof collection.length)return new StreamImpl(()=>({index:0}),state=>state.index<collection.length?{done:!1,value:collection[state.index++]}:DONE_RESULT)}return collections.length>1?new StreamImpl(()=>({collIndex:0,arrIndex:0}),state=>{do{if(state.iterator){const next=state.iterator.next();if(!next.done)return next;state.iterator=void 0}if(state.array){if(state.arrIndex<state.array.length)return{done:!1,value:state.array[state.arrIndex++]};state.array=void 0,state.arrIndex=0}if(state.collIndex<collections.length){const collection=collections[state.collIndex++];isIterable(collection)?state.iterator=collection[Symbol.iterator]():collection&&"number"==typeof collection.length&&(state.array=collection)}}while(state.iterator||state.array||state.collIndex<collections.length);return DONE_RESULT}):EMPTY_STREAM}class TreeStreamImpl extends StreamImpl{constructor(root,children,options){super(()=>({iterators:(null==options?void 0:options.includeRoot)?[[root][Symbol.iterator]()]:[children(root)[Symbol.iterator]()],pruned:!1}),state=>{for(state.pruned&&(state.iterators.pop(),state.pruned=!1);state.iterators.length>0;){const next=state.iterators[state.iterators.length-1].next();if(!next.done)return state.iterators.push(children(next.value)[Symbol.iterator]()),next;state.iterators.pop()}return DONE_RESULT})}iterator(){const iterator={state:this.startFn(),next:()=>this.nextFn(iterator.state),prune:()=>{iterator.state.pruned=!0},[Symbol.iterator]:()=>iterator};return iterator}}var Reduction,Reduction2;function linkContentToContainer(node,options={}){for(const[name,value]of Object.entries(node))name.startsWith("$")||(Array.isArray(value)?value.forEach((item,index)=>{isAstNode(item)&&(item.$container=node,item.$containerProperty=name,item.$containerIndex=index,options.deep&&linkContentToContainer(item,options))}):isAstNode(value)&&(value.$container=node,value.$containerProperty=name,options.deep&&linkContentToContainer(value,options)))}function getContainerOfType(node,typePredicate){let item=node;for(;item;){if(typePredicate(item))return item;item=item.$container}}function getDocument(node){const result=findRootNode(node).$document;if(!result)throw new Error("AST node has no document.");return result}function findRootNode(node){for(;node.$container;)node=node.$container;return node}function getReferenceNodes(reference){return isReference(reference)?reference.ref?[reference.ref]:[]:isMultiReference(reference)?reference.items.map(item=>item.ref):[]}function streamContents(node,options){if(!node)throw new Error("Node must be an AstNode.");const range=null==options?void 0:options.range;return new StreamImpl(()=>({keys:Object.keys(node),keyIndex:0,arrayIndex:0}),state=>{for(;state.keyIndex<state.keys.length;){const property=state.keys[state.keyIndex];if(!property.startsWith("$")){const value=node[property];if(isAstNode(value)){if(state.keyIndex++,isAstNodeInRange(value,range))return{done:!1,value:value}}else if(Array.isArray(value)){for(;state.arrayIndex<value.length;){const element=value[state.arrayIndex++];if(isAstNode(element)&&isAstNodeInRange(element,range))return{done:!1,value:element}}state.arrayIndex=0}}state.keyIndex++}return DONE_RESULT})}function streamAllContents(root,options){if(!root)throw new Error("Root node must be an AstNode.");return new TreeStreamImpl(root,node=>streamContents(node,options))}function streamAst(root,options){if(!root)throw new Error("Root node must be an AstNode.");return new TreeStreamImpl(root,node=>streamContents(node,options),{includeRoot:!0})}function isAstNodeInRange(astNode,range){var _a2;if(!range)return!0;const nodeRange=null==(_a2=astNode.$cstNode)?void 0:_a2.range;return!!nodeRange&&function(range,to){const comparison=function(range,to){if(range.end.line<to.start.line||range.end.line===to.start.line&&range.end.character<=to.start.character)return RangeComparison.Before;if(range.start.line>to.end.line||range.start.line===to.end.line&&range.start.character>=to.end.character)return RangeComparison.After;const startInside=range.start.line>to.start.line||range.start.line===to.start.line&&range.start.character>=to.start.character,endInside=range.end.line<to.end.line||range.end.line===to.end.line&&range.end.character<=to.end.character;return startInside&&endInside?RangeComparison.Inside:startInside?RangeComparison.OverlapBack:endInside?RangeComparison.OverlapFront:RangeComparison.Outside}(range,to);return comparison>RangeComparison.After}(nodeRange,range)}function streamReferences(node){return new StreamImpl(()=>({keys:Object.keys(node),keyIndex:0,arrayIndex:0}),state=>{for(;state.keyIndex<state.keys.length;){const property=state.keys[state.keyIndex];if(!property.startsWith("$")){const value=node[property];if(isReference(value)||isMultiReference(value))return state.keyIndex++,{done:!1,value:{reference:value,container:node,property:property}};if(Array.isArray(value)){for(;state.arrayIndex<value.length;){const index=state.arrayIndex++,element=value[index];if(isReference(element)||isMultiReference(value))return{done:!1,value:{reference:element,container:node,property:property,index:index}}}state.arrayIndex=0}}state.keyIndex++}return DONE_RESULT})}function copyDefaultValue(propertyType){return Array.isArray(propertyType)?[...propertyType.map(copyDefaultValue)]:propertyType}(Reduction2=Reduction||(Reduction={})).sum=function(stream2){return stream2.reduce((a,b)=>a+b,0)},Reduction2.product=function(stream2){return stream2.reduce((a,b)=>a*b,0)},Reduction2.min=function(stream2){return stream2.reduce((a,b)=>Math.min(a,b))},Reduction2.max=function(stream2){return stream2.reduce((a,b)=>Math.max(a,b))};const AbstractElement_$type="AbstractElement",AbstractElement_cardinality="cardinality";function isAbstractElement(item){return reflection$1.isInstance(item,AbstractElement_$type)}const AbstractParserRule_$type="AbstractParserRule";function isAbstractParserRule(item){return reflection$1.isInstance(item,AbstractParserRule_$type)}const AbstractRule_$type="AbstractRule",AbstractType_$type="AbstractType",Action_$type="Action",Action_cardinality="cardinality",Action_feature="feature",Action_inferredType="inferredType",Action_operator="operator",Action_type="type";function isAction(item){return reflection$1.isInstance(item,Action_$type)}const Alternatives_$type="Alternatives",Alternatives_cardinality="cardinality",Alternatives_elements="elements";function isAlternatives(item){return reflection$1.isInstance(item,Alternatives_$type)}const ArrayLiteral_$type="ArrayLiteral",ArrayLiteral_elements="elements",ArrayType_$type="ArrayType",ArrayType_elementType="elementType",Assignment_$type="Assignment",Assignment_cardinality="cardinality",Assignment_feature="feature",Assignment_operator="operator",Assignment_predicate="predicate",Assignment_terminal="terminal";function isAssignment(item){return reflection$1.isInstance(item,Assignment_$type)}const BooleanLiteral_$type="BooleanLiteral",BooleanLiteral_true="true";const CharacterRange_$type="CharacterRange",CharacterRange_cardinality="cardinality",CharacterRange_left="left",CharacterRange_lookahead="lookahead",CharacterRange_parenthesized="parenthesized",CharacterRange_right="right";const Condition_$type="Condition",Conjunction_$type="Conjunction",Conjunction_left="left",Conjunction_right="right";const CrossReference_$type="CrossReference",CrossReference_cardinality="cardinality",CrossReference_deprecatedSyntax="deprecatedSyntax",CrossReference_isMulti="isMulti",CrossReference_terminal="terminal",CrossReference_type="type";function isCrossReference(item){return reflection$1.isInstance(item,CrossReference_$type)}const Disjunction_$type="Disjunction",Disjunction_left="left",Disjunction_right="right";const EndOfFile_$type="EndOfFile",EndOfFile_cardinality="cardinality";const Grammar_$type="Grammar",Grammar_imports="imports",Grammar_interfaces="interfaces",Grammar_isDeclared="isDeclared",Grammar_name="name",Grammar_rules="rules",Grammar_types="types",GrammarImport_$type="GrammarImport",GrammarImport_path="path",Group$1_$type="Group",Group$1_cardinality="cardinality",Group$1_elements="elements",Group$1_guardCondition="guardCondition",Group$1_predicate="predicate";function isGroup(item){return reflection$1.isInstance(item,Group$1_$type)}const InferredType_$type="InferredType",InferredType_name="name";function isInferredType(item){return reflection$1.isInstance(item,InferredType_$type)}const InfixRule_$type="InfixRule",InfixRule_call="call",InfixRule_dataType="dataType",InfixRule_inferredType="inferredType",InfixRule_name="name",InfixRule_operators="operators",InfixRule_parameters="parameters",InfixRule_returnType="returnType";function isInfixRule(item){return reflection$1.isInstance(item,InfixRule_$type)}const InfixRuleOperatorList_$type="InfixRuleOperatorList",InfixRuleOperatorList_associativity="associativity",InfixRuleOperatorList_operators="operators",InfixRuleOperators_$type="InfixRuleOperators",InfixRuleOperators_precedences="precedences",Interface_$type="Interface",Interface_attributes="attributes",Interface_name="name",Interface_superTypes="superTypes";const Keyword_$type="Keyword",Keyword_cardinality="cardinality",Keyword_predicate="predicate",Keyword_value="value";function isKeyword(item){return reflection$1.isInstance(item,Keyword_$type)}const NamedArgument_$type="NamedArgument",NamedArgument_calledByName="calledByName",NamedArgument_parameter="parameter",NamedArgument_value="value",NegatedToken_$type="NegatedToken",NegatedToken_cardinality="cardinality",NegatedToken_lookahead="lookahead",NegatedToken_parenthesized="parenthesized",NegatedToken_terminal="terminal";const Negation_$type="Negation",Negation_value="value";const NumberLiteral_$type="NumberLiteral",NumberLiteral_value="value",Parameter_$type="Parameter",Parameter_name="name",ParameterReference_$type="ParameterReference",ParameterReference_parameter="parameter";const ParserRule_$type="ParserRule",ParserRule_dataType="dataType",ParserRule_definition="definition",ParserRule_entry="entry",ParserRule_fragment="fragment",ParserRule_inferredType="inferredType",ParserRule_name="name",ParserRule_parameters="parameters",ParserRule_returnType="returnType";function isParserRule(item){return reflection$1.isInstance(item,ParserRule_$type)}const ReferenceType_$type="ReferenceType",ReferenceType_isMulti="isMulti",ReferenceType_referenceType="referenceType",RegexToken_$type="RegexToken",RegexToken_cardinality="cardinality",RegexToken_lookahead="lookahead",RegexToken_parenthesized="parenthesized",RegexToken_regex="regex";const ReturnType_$type="ReturnType",ReturnType_name="name";const RuleCall_$type="RuleCall",RuleCall_arguments="arguments",RuleCall_cardinality="cardinality",RuleCall_predicate="predicate",RuleCall_rule="rule";function isRuleCall(item){return reflection$1.isInstance(item,RuleCall_$type)}const SimpleType_$type="SimpleType",SimpleType_primitiveType="primitiveType",SimpleType_stringType="stringType",SimpleType_typeRef="typeRef";function isSimpleType(item){return reflection$1.isInstance(item,SimpleType_$type)}const StringLiteral_$type="StringLiteral",StringLiteral_value="value",TerminalAlternatives_$type="TerminalAlternatives",TerminalAlternatives_cardinality="cardinality",TerminalAlternatives_elements="elements",TerminalAlternatives_lookahead="lookahead",TerminalAlternatives_parenthesized="parenthesized";const TerminalElement_$type="TerminalElement",TerminalElement_cardinality="cardinality",TerminalElement_lookahead="lookahead",TerminalElement_parenthesized="parenthesized",TerminalGroup_$type="TerminalGroup",TerminalGroup_cardinality="cardinality",TerminalGroup_elements="elements",TerminalGroup_lookahead="lookahead",TerminalGroup_parenthesized="parenthesized";const TerminalRule_$type="TerminalRule",TerminalRule_definition="definition",TerminalRule_fragment="fragment",TerminalRule_hidden="hidden",TerminalRule_name="name",TerminalRule_type="type";function isTerminalRule(item){return reflection$1.isInstance(item,TerminalRule_$type)}const TerminalRuleCall_$type="TerminalRuleCall",TerminalRuleCall_cardinality="cardinality",TerminalRuleCall_lookahead="lookahead",TerminalRuleCall_parenthesized="parenthesized",TerminalRuleCall_rule="rule";const Type_$type="Type",Type_name="name",Type_type="type";const TypeAttribute_$type="TypeAttribute",TypeAttribute_defaultValue="defaultValue",TypeAttribute_isOptional="isOptional",TypeAttribute_name="name",TypeAttribute_type="type",TypeDefinition_$type="TypeDefinition",UnionType_$type="UnionType",UnionType_types="types",UnorderedGroup_$type="UnorderedGroup",UnorderedGroup_cardinality="cardinality",UnorderedGroup_elements="elements";function isUnorderedGroup(item){return reflection$1.isInstance(item,UnorderedGroup_$type)}const UntilToken_$type="UntilToken",UntilToken_cardinality="cardinality",UntilToken_lookahead="lookahead",UntilToken_parenthesized="parenthesized",UntilToken_terminal="terminal";const ValueLiteral_$type="ValueLiteral",Wildcard_$type="Wildcard",Wildcard_cardinality="cardinality",Wildcard_lookahead="lookahead",Wildcard_parenthesized="parenthesized";class LangiumGrammarAstReflection extends AbstractAstReflection{constructor(){super(...arguments),this.types={AbstractElement:{name:AbstractElement_$type,properties:{cardinality:{name:AbstractElement_cardinality}},superTypes:[]},AbstractParserRule:{name:AbstractParserRule_$type,properties:{},superTypes:[AbstractRule_$type,AbstractType_$type]},AbstractRule:{name:AbstractRule_$type,properties:{},superTypes:[]},AbstractType:{name:AbstractType_$type,properties:{},superTypes:[]},Action:{name:Action_$type,properties:{cardinality:{name:Action_cardinality},feature:{name:Action_feature},inferredType:{name:Action_inferredType},operator:{name:Action_operator},type:{name:Action_type,referenceType:AbstractType_$type}},superTypes:[AbstractElement_$type]},Alternatives:{name:Alternatives_$type,properties:{cardinality:{name:Alternatives_cardinality},elements:{name:Alternatives_elements,defaultValue:[]}},superTypes:[AbstractElement_$type]},ArrayLiteral:{name:ArrayLiteral_$type,properties:{elements:{name:ArrayLiteral_elements,defaultValue:[]}},superTypes:[ValueLiteral_$type]},ArrayType:{name:ArrayType_$type,properties:{elementType:{name:ArrayType_elementType}},superTypes:[TypeDefinition_$type]},Assignment:{name:Assignment_$type,properties:{cardinality:{name:Assignment_cardinality},feature:{name:Assignment_feature},operator:{name:Assignment_operator},predicate:{name:Assignment_predicate},terminal:{name:Assignment_terminal}},superTypes:[AbstractElement_$type]},BooleanLiteral:{name:BooleanLiteral_$type,properties:{true:{name:BooleanLiteral_true,defaultValue:!1}},superTypes:[Condition_$type,ValueLiteral_$type]},CharacterRange:{name:CharacterRange_$type,properties:{cardinality:{name:CharacterRange_cardinality},left:{name:CharacterRange_left},lookahead:{name:CharacterRange_lookahead},parenthesized:{name:CharacterRange_parenthesized,defaultValue:!1},right:{name:CharacterRange_right}},superTypes:[TerminalElement_$type]},Condition:{name:Condition_$type,properties:{},superTypes:[]},Conjunction:{name:Conjunction_$type,properties:{left:{name:Conjunction_left},right:{name:Conjunction_right}},superTypes:[Condition_$type]},CrossReference:{name:CrossReference_$type,properties:{cardinality:{name:CrossReference_cardinality},deprecatedSyntax:{name:CrossReference_deprecatedSyntax,defaultValue:!1},isMulti:{name:CrossReference_isMulti,defaultValue:!1},terminal:{name:CrossReference_terminal},type:{name:CrossReference_type,referenceType:AbstractType_$type}},superTypes:[AbstractElement_$type]},Disjunction:{name:Disjunction_$type,properties:{left:{name:Disjunction_left},right:{name:Disjunction_right}},superTypes:[Condition_$type]},EndOfFile:{name:EndOfFile_$type,properties:{cardinality:{name:EndOfFile_cardinality}},superTypes:[AbstractElement_$type]},Grammar:{name:Grammar_$type,properties:{imports:{name:Grammar_imports,defaultValue:[]},interfaces:{name:Grammar_interfaces,defaultValue:[]},isDeclared:{name:Grammar_isDeclared,defaultValue:!1},name:{name:Grammar_name},rules:{name:Grammar_rules,defaultValue:[]},types:{name:Grammar_types,defaultValue:[]}},superTypes:[]},GrammarImport:{name:GrammarImport_$type,properties:{path:{name:GrammarImport_path}},superTypes:[]},Group:{name:Group$1_$type,properties:{cardinality:{name:Group$1_cardinality},elements:{name:Group$1_elements,defaultValue:[]},guardCondition:{name:Group$1_guardCondition},predicate:{name:Group$1_predicate}},superTypes:[AbstractElement_$type]},InferredType:{name:InferredType_$type,properties:{name:{name:InferredType_name}},superTypes:[AbstractType_$type]},InfixRule:{name:InfixRule_$type,properties:{call:{name:InfixRule_call},dataType:{name:InfixRule_dataType},inferredType:{name:InfixRule_inferredType},name:{name:InfixRule_name},operators:{name:InfixRule_operators},parameters:{name:InfixRule_parameters,defaultValue:[]},returnType:{name:InfixRule_returnType,referenceType:AbstractType_$type}},superTypes:[AbstractParserRule_$type]},InfixRuleOperatorList:{name:InfixRuleOperatorList_$type,properties:{associativity:{name:InfixRuleOperatorList_associativity},operators:{name:InfixRuleOperatorList_operators,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:InfixRuleOperators_$type,properties:{precedences:{name:InfixRuleOperators_precedences,defaultValue:[]}},superTypes:[]},Interface:{name:Interface_$type,properties:{attributes:{name:Interface_attributes,defaultValue:[]},name:{name:Interface_name},superTypes:{name:Interface_superTypes,defaultValue:[],referenceType:AbstractType_$type}},superTypes:[AbstractType_$type]},Keyword:{name:Keyword_$type,properties:{cardinality:{name:Keyword_cardinality},predicate:{name:Keyword_predicate},value:{name:Keyword_value}},superTypes:[AbstractElement_$type]},NamedArgument:{name:NamedArgument_$type,properties:{calledByName:{name:NamedArgument_calledByName,defaultValue:!1},parameter:{name:NamedArgument_parameter,referenceType:Parameter_$type},value:{name:NamedArgument_value}},superTypes:[]},NegatedToken:{name:NegatedToken_$type,properties:{cardinality:{name:NegatedToken_cardinality},lookahead:{name:NegatedToken_lookahead},parenthesized:{name:NegatedToken_parenthesized,defaultValue:!1},terminal:{name:NegatedToken_terminal}},superTypes:[TerminalElement_$type]},Negation:{name:Negation_$type,properties:{value:{name:Negation_value}},superTypes:[Condition_$type]},NumberLiteral:{name:NumberLiteral_$type,properties:{value:{name:NumberLiteral_value}},superTypes:[ValueLiteral_$type]},Parameter:{name:Parameter_$type,properties:{name:{name:Parameter_name}},superTypes:[]},ParameterReference:{name:ParameterReference_$type,properties:{parameter:{name:ParameterReference_parameter,referenceType:Parameter_$type}},superTypes:[Condition_$type]},ParserRule:{name:ParserRule_$type,properties:{dataType:{name:ParserRule_dataType},definition:{name:ParserRule_definition},entry:{name:ParserRule_entry,defaultValue:!1},fragment:{name:ParserRule_fragment,defaultValue:!1},inferredType:{name:ParserRule_inferredType},name:{name:ParserRule_name},parameters:{name:ParserRule_parameters,defaultValue:[]},returnType:{name:ParserRule_returnType,referenceType:AbstractType_$type}},superTypes:[AbstractParserRule_$type]},ReferenceType:{name:ReferenceType_$type,properties:{isMulti:{name:ReferenceType_isMulti,defaultValue:!1},referenceType:{name:ReferenceType_referenceType}},superTypes:[TypeDefinition_$type]},RegexToken:{name:RegexToken_$type,properties:{cardinality:{name:RegexToken_cardinality},lookahead:{name:RegexToken_lookahead},parenthesized:{name:RegexToken_parenthesized,defaultValue:!1},regex:{name:RegexToken_regex}},superTypes:[TerminalElement_$type]},ReturnType:{name:ReturnType_$type,properties:{name:{name:ReturnType_name}},superTypes:[]},RuleCall:{name:RuleCall_$type,properties:{arguments:{name:RuleCall_arguments,defaultValue:[]},cardinality:{name:RuleCall_cardinality},predicate:{name:RuleCall_predicate},rule:{name:RuleCall_rule,referenceType:AbstractRule_$type}},superTypes:[AbstractElement_$type]},SimpleType:{name:SimpleType_$type,properties:{primitiveType:{name:SimpleType_primitiveType},stringType:{name:SimpleType_stringType},typeRef:{name:SimpleType_typeRef,referenceType:AbstractType_$type}},superTypes:[TypeDefinition_$type]},StringLiteral:{name:StringLiteral_$type,properties:{value:{name:StringLiteral_value}},superTypes:[ValueLiteral_$type]},TerminalAlternatives:{name:TerminalAlternatives_$type,properties:{cardinality:{name:TerminalAlternatives_cardinality},elements:{name:TerminalAlternatives_elements,defaultValue:[]},lookahead:{name:TerminalAlternatives_lookahead},parenthesized:{name:TerminalAlternatives_parenthesized,defaultValue:!1}},superTypes:[TerminalElement_$type]},TerminalElement:{name:TerminalElement_$type,properties:{cardinality:{name:TerminalElement_cardinality},lookahead:{name:TerminalElement_lookahead},parenthesized:{name:TerminalElement_parenthesized,defaultValue:!1}},superTypes:[AbstractElement_$type]},TerminalGroup:{name:TerminalGroup_$type,properties:{cardinality:{name:TerminalGroup_cardinality},elements:{name:TerminalGroup_elements,defaultValue:[]},lookahead:{name:TerminalGroup_lookahead},parenthesized:{name:TerminalGroup_parenthesized,defaultValue:!1}},superTypes:[TerminalElement_$type]},TerminalRule:{name:TerminalRule_$type,properties:{definition:{name:TerminalRule_definition},fragment:{name:TerminalRule_fragment,defaultValue:!1},hidden:{name:TerminalRule_hidden,defaultValue:!1},name:{name:TerminalRule_name},type:{name:TerminalRule_type}},superTypes:[AbstractRule_$type]},TerminalRuleCall:{name:TerminalRuleCall_$type,properties:{cardinality:{name:TerminalRuleCall_cardinality},lookahead:{name:TerminalRuleCall_lookahead},parenthesized:{name:TerminalRuleCall_parenthesized,defaultValue:!1},rule:{name:TerminalRuleCall_rule,referenceType:TerminalRule_$type}},superTypes:[TerminalElement_$type]},Type:{name:Type_$type,properties:{name:{name:Type_name},type:{name:Type_type}},superTypes:[AbstractType_$type]},TypeAttribute:{name:TypeAttribute_$type,properties:{defaultValue:{name:TypeAttribute_defaultValue},isOptional:{name:TypeAttribute_isOptional,defaultValue:!1},name:{name:TypeAttribute_name},type:{name:TypeAttribute_type}},superTypes:[]},TypeDefinition:{name:TypeDefinition_$type,properties:{},superTypes:[]},UnionType:{name:UnionType_$type,properties:{types:{name:UnionType_types,defaultValue:[]}},superTypes:[TypeDefinition_$type]},UnorderedGroup:{name:UnorderedGroup_$type,properties:{cardinality:{name:UnorderedGroup_cardinality},elements:{name:UnorderedGroup_elements,defaultValue:[]}},superTypes:[AbstractElement_$type]},UntilToken:{name:UntilToken_$type,properties:{cardinality:{name:UntilToken_cardinality},lookahead:{name:UntilToken_lookahead},parenthesized:{name:UntilToken_parenthesized,defaultValue:!1},terminal:{name:UntilToken_terminal}},superTypes:[TerminalElement_$type]},ValueLiteral:{name:ValueLiteral_$type,properties:{},superTypes:[]},Wildcard:{name:Wildcard_$type,properties:{cardinality:{name:Wildcard_cardinality},lookahead:{name:Wildcard_lookahead},parenthesized:{name:Wildcard_parenthesized,defaultValue:!1}},superTypes:[TerminalElement_$type]}}}}const reflection$1=new LangiumGrammarAstReflection;function streamCst(node){return new TreeStreamImpl(node,element=>isCompositeCstNode(element)?element.content:[],{includeRoot:!0})}function tokenToRange(token){return{start:{character:token.startColumn-1,line:token.startLine-1},end:{character:token.endColumn,line:token.endLine-1}}}function toDocumentSegment(node){if(!node)return;const{offset:offset,end:end,range:range}=node;return{range:range,offset:offset,end:end,length:end-offset}}var RangeComparison,RangeComparison2;(RangeComparison2=RangeComparison||(RangeComparison={}))[RangeComparison2.Before=0]="Before",RangeComparison2[RangeComparison2.After=1]="After",RangeComparison2[RangeComparison2.OverlapFront=2]="OverlapFront",RangeComparison2[RangeComparison2.OverlapBack=3]="OverlapBack",RangeComparison2[RangeComparison2.Inside=4]="Inside",RangeComparison2[RangeComparison2.Outside=5]="Outside";const DefaultNameRegexp=/^[\w\p{L}]$/u;function isCommentNode(cstNode,commentNames){return isLeafCstNode(cstNode)&&commentNames.includes(cstNode.tokenType.name)}class ErrorWithLocation extends Error{constructor(node,message){super(node?`${message} at ${node.range.start.line}:${node.range.start.character}`:message)}}function assertUnreachable(_,message="Error: Got unexpected value."){throw new Error(message)}function cc(char){return char.charCodeAt(0)}function insertToSet(item,set){Array.isArray(item)?item.forEach(function(subItem){set.push(subItem)}):set.push(item)}function addFlag(flagObj,flagKey){if(!0===flagObj[flagKey])throw"duplicate flag "+flagKey;flagObj[flagKey],flagObj[flagKey]=!0}function ASSERT_EXISTS(obj){if(void 0===obj)throw Error("Internal Error - Should never get here!");return!0}function isCharacter(obj){return"Character"===obj.type}const digitsCharCodes=[];for(let i=cc("0");i<=cc("9");i++)digitsCharCodes.push(i);const wordCharCodes=[cc("_")].concat(digitsCharCodes);for(let i=cc("a");i<=cc("z");i++)wordCharCodes.push(i);for(let i=cc("A");i<=cc("Z");i++)wordCharCodes.push(i);const whitespaceCodes=[cc(" "),cc("\f"),cc("\n"),cc("\r"),cc("\t"),cc("\v"),cc("\t"),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc(" "),cc("\u2028"),cc("\u2029"),cc(" "),cc(" "),cc(" "),cc("\ufeff")],hexDigitPattern=/[0-9a-fA-F]/,decimalPattern=/[0-9]/,decimalPatternNoZero=/[1-9]/;class RegExpParser{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(newState2){this.idx=newState2.idx,this.input=newState2.input,this.groupIdx=newState2.groupIdx}pattern(input){this.idx=0,this.input=input,this.groupIdx=0,this.consumeChar("/");const value=this.disjunction();this.consumeChar("/");const flags={type:"Flags",loc:{begin:this.idx,end:input.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":addFlag(flags,"global");break;case"i":addFlag(flags,"ignoreCase");break;case"m":addFlag(flags,"multiLine");break;case"u":addFlag(flags,"unicode");break;case"y":addFlag(flags,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:flags,value:value,loc:this.loc(0)}}disjunction(){const alts=[],begin=this.idx;for(alts.push(this.alternative());"|"===this.peekChar();)this.consumeChar("|"),alts.push(this.alternative());return{type:"Disjunction",value:alts,loc:this.loc(begin)}}alternative(){const terms=[],begin=this.idx;for(;this.isTerm();)terms.push(this.term());return{type:"Alternative",value:terms,loc:this.loc(begin)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const begin=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(begin)};case"$":return{type:"EndAnchor",loc:this.loc(begin)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(begin)};case"B":return{type:"NonWordBoundary",loc:this.loc(begin)}}throw Error("Invalid Assertion Escape");case"(":let type;switch(this.consumeChar("?"),this.popChar()){case"=":type="Lookahead";break;case"!":type="NegativeLookahead";break;case"<":switch(this.popChar()){case"=":type="Lookbehind";break;case"!":type="NegativeLookbehind"}}ASSERT_EXISTS(type);const disjunction=this.disjunction();return this.consumeChar(")"),{type:type,value:disjunction,loc:this.loc(begin)}}return function(){throw Error("Internal Error - Should never get here!")}()}quantifier(isBacktracking=!1){let range;const begin=this.idx;switch(this.popChar()){case"*":range={atLeast:0,atMost:1/0};break;case"+":range={atLeast:1,atMost:1/0};break;case"?":range={atLeast:0,atMost:1};break;case"{":const atLeast=this.integerIncludingZero();switch(this.popChar()){case"}":range={atLeast:atLeast,atMost:atLeast};break;case",":let atMost;this.isDigit()?(atMost=this.integerIncludingZero(),range={atLeast:atLeast,atMost:atMost}):range={atLeast:atLeast,atMost:1/0},this.consumeChar("}")}if(!0===isBacktracking&&void 0===range)return;ASSERT_EXISTS(range)}if(!0!==isBacktracking||void 0!==range)return ASSERT_EXISTS(range)?("?"===this.peekChar(0)?(this.consumeChar("?"),range.greedy=!1):range.greedy=!0,range.type="Quantifier",range.loc=this.loc(begin),range):void 0}atom(){let atom2;const begin=this.idx;switch(this.peekChar()){case".":atom2=this.dotAll();break;case"\\":atom2=this.atomEscape();break;case"[":atom2=this.characterClass();break;case"(":atom2=this.group()}if(void 0===atom2&&this.isPatternCharacter()&&(atom2=this.patternCharacter()),ASSERT_EXISTS(atom2))return atom2.loc=this.loc(begin),this.isQuantifier()&&(atom2.quantifier=this.quantifier()),atom2}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[cc("\n"),cc("\r"),cc("\u2028"),cc("\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 set,complement=!1;switch(this.popChar()){case"d":set=digitsCharCodes;break;case"D":set=digitsCharCodes,complement=!0;break;case"s":set=whitespaceCodes;break;case"S":set=whitespaceCodes,complement=!0;break;case"w":set=wordCharCodes;break;case"W":set=wordCharCodes,complement=!0}if(ASSERT_EXISTS(set))return{type:"Set",value:set,complement:complement}}controlEscapeAtom(){let escapeCode;switch(this.popChar()){case"f":escapeCode=cc("\f");break;case"n":escapeCode=cc("\n");break;case"r":escapeCode=cc("\r");break;case"t":escapeCode=cc("\t");break;case"v":escapeCode=cc("\v")}if(ASSERT_EXISTS(escapeCode))return{type:"Character",value:escapeCode}}controlLetterEscapeAtom(){this.consumeChar("c");const letter=this.popChar();if(!1===/[a-zA-Z]/.test(letter))throw Error("Invalid ");return{type:"Character",value:letter.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:cc("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:cc(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:cc(this.popChar())}}}characterClass(){const set=[];let complement=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),complement=!0);this.isClassAtom();){const from=this.classAtom();if(from.type,isCharacter(from)&&this.isRangeDash()){this.consumeChar("-");const to=this.classAtom();if(to.type,isCharacter(to)){if(to.value<from.value)throw Error("Range out of order in character class");set.push({from:from.value,to:to.value})}else insertToSet(from.value,set),set.push(cc("-")),insertToSet(to.value,set)}else insertToSet(from.value,set)}return this.consumeChar("]"),{type:"Set",complement:complement,value:set}}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:cc("\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 capturing=!0;if(this.consumeChar("("),"?"===this.peekChar(0))this.consumeChar("?"),this.consumeChar(":"),capturing=!1;else this.groupIdx++;const value=this.disjunction();this.consumeChar(")");const groupAst={type:"Group",capturing:capturing,value:value};return capturing&&(groupAst.idx=this.groupIdx),groupAst}positiveInteger(){let number=this.popChar();if(!1===decimalPatternNoZero.test(number))throw Error("Expecting a positive integer");for(;decimalPattern.test(this.peekChar(0));)number+=this.popChar();return parseInt(number,10)}integerIncludingZero(){let number=this.popChar();if(!1===decimalPattern.test(number))throw Error("Expecting an integer");for(;decimalPattern.test(this.peekChar(0));)number+=this.popChar();return parseInt(number,10)}patternCharacter(){const nextChar=this.popChar();switch(nextChar){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:cc(nextChar)}}}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 decimalPattern.test(this.peekChar(0))}isClassAtom(howMuch=0){switch(this.peekChar(howMuch)){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)||"<"===this.peekChar(2)&&("="===this.peekChar(3)||"!"===this.peekChar(3)));default:return!1}}isQuantifier(){const prevState=this.saveState();try{return void 0!==this.quantifier(!0)}catch(e){return!1}finally{this.restoreState(prevState)}}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(howMany){let hexString="";for(let i=0;i<howMany;i++){const hexChar=this.popChar();if(!1===hexDigitPattern.test(hexChar))throw Error("Expecting a HexDecimal digits");hexString+=hexChar}return{type:"Character",value:parseInt(hexString,16)}}peekChar(howMuch=0){return this.input[this.idx+howMuch]}popChar(){const nextChar=this.peekChar(0);return this.consumeChar(void 0),nextChar}consumeChar(char){if(void 0!==char&&this.input[this.idx]!==char)throw Error("Expected: '"+char+"' 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(begin){return{begin:begin,end:this.idx}}}class BaseRegExpVisitor{visitChildren(node){for(const key in node){const child=node[key];node.hasOwnProperty(key)&&(void 0!==child.type?this.visit(child):Array.isArray(child)&&child.forEach(subChild=>{this.visit(subChild)},this))}}visit(node){switch(node.type){case"Pattern":this.visitPattern(node);break;case"Flags":this.visitFlags(node);break;case"Disjunction":this.visitDisjunction(node);break;case"Alternative":this.visitAlternative(node);break;case"StartAnchor":this.visitStartAnchor(node);break;case"EndAnchor":this.visitEndAnchor(node);break;case"WordBoundary":this.visitWordBoundary(node);break;case"NonWordBoundary":this.visitNonWordBoundary(node);break;case"Lookahead":this.visitLookahead(node);break;case"NegativeLookahead":this.visitNegativeLookahead(node);break;case"Lookbehind":this.visitLookbehind(node);break;case"NegativeLookbehind":this.visitNegativeLookbehind(node);break;case"Character":this.visitCharacter(node);break;case"Set":this.visitSet(node);break;case"Group":this.visitGroup(node);break;case"GroupBackReference":this.visitGroupBackReference(node);break;case"Quantifier":this.visitQuantifier(node)}this.visitChildren(node)}visitPattern(node){}visitFlags(node){}visitDisjunction(node){}visitAlternative(node){}visitStartAnchor(node){}visitEndAnchor(node){}visitWordBoundary(node){}visitNonWordBoundary(node){}visitLookahead(node){}visitNegativeLookahead(node){}visitLookbehind(node){}visitNegativeLookbehind(node){}visitCharacter(node){}visitSet(node){}visitGroup(node){}visitGroupBackReference(node){}visitQuantifier(node){}}const NEWLINE_REGEXP=/\r?\n/gm,regexpParser=new RegExpParser;const visitor=new class extends BaseRegExpVisitor{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(regex){this.multiline=!1,this.regex=regex,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(node){node.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(node){const char=String.fromCharCode(node.value);if(this.multiline||"\n"!==char||(this.multiline=!0),node.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const escapedChar=escapeRegExp(char);this.endRegexpStack.push(escapedChar),this.isStarting&&(this.startRegexp+=escapedChar)}}visitSet(node){if(!this.multiline){const set=this.regex.substring(node.loc.begin,node.loc.end),regex=new RegExp(set);this.multiline=Boolean("\n".match(regex))}if(node.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const set=this.regex.substring(node.loc.begin,node.loc.end);this.endRegexpStack.push(set),this.isStarting&&(this.startRegexp+=set)}}visitChildren(node){if("Group"===node.type){if(node.quantifier)return}super.visitChildren(node)}};function isMultilineComment(regexp){try{return"string"==typeof regexp&&(regexp=new RegExp(regexp)),regexp=regexp.toString(),visitor.reset(regexp),visitor.visit(regexpParser.pattern(regexp)),visitor.multiline}catch{return!1}}const whitespaceCharacters="\f\n\r\t\v              \u2028\u2029   \ufeff".split("");function isWhitespace(value){const regexp="string"==typeof value?new RegExp(value):value;return whitespaceCharacters.some(ws=>regexp.test(ws))}function escapeRegExp(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function partialMatches(regex,input){const partial=function(regex){"string"==typeof regex&&(regex=new RegExp(regex));const re=regex,source=regex.source;let i=0;function process2(){let tmp,result="";function appendRaw(nbChars){result+=source.substr(i,nbChars),i+=nbChars}function appendOptional(nbChars){result+="(?:"+source.substr(i,nbChars)+"|$)",i+=nbChars}for(;i<source.length;)switch(source[i]){case"\\":switch(source[i+1]){case"c":appendOptional(3);break;case"x":appendOptional(4);break;case"u":re.unicode?"{"===source[i+2]?appendOptional(source.indexOf("}",i)-i+1):appendOptional(6):appendOptional(2);break;case"p":case"P":re.unicode?appendOptional(source.indexOf("}",i)-i+1):appendOptional(2);break;case"k":appendOptional(source.indexOf(">",i)-i+1);break;default:appendOptional(2)}break;case"[":tmp=/\[(?:\\.|.)*?\]/g,tmp.lastIndex=i,tmp=tmp.exec(source)||[],appendOptional(tmp[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":appendRaw(1);break;case"{":tmp=/\{\d+,?\d*\}/g,tmp.lastIndex=i,tmp=tmp.exec(source),tmp?appendRaw(tmp[0].length):appendOptional(1);break;case"(":if("?"===source[i+1])switch(source[i+2]){case":":result+="(?:",i+=3,result+=process2()+"|$)";break;case"=":result+="(?=",i+=3,result+=process2()+")";break;case"!":tmp=i,i+=3,process2(),result+=source.substr(tmp,i-tmp);break;case"<":switch(source[i+3]){case"=":case"!":tmp=i,i+=4,process2(),result+=source.substr(tmp,i-tmp);break;default:appendRaw(source.indexOf(">",i)-i+1),result+=process2()+"|$)"}}else appendRaw(1),result+=process2()+"|$)";break;case")":return++i,result;default:appendOptional(1)}return result}return new RegExp(process2(),regex.flags)}(regex),match=input.match(partial);return!!match&&match[0].length>0}function getAllReachableRules(grammar,allTerminals){const ruleNames=new Set,entryRule=function(grammar){return grammar.rules.find(e=>isParserRule(e)&&e.entry)}(grammar);if(!entryRule)return new Set(grammar.rules);const topMostRules=[entryRule].concat(function(grammar){return grammar.rules.filter(e=>isTerminalRule(e)&&e.hidden)}(grammar));for(const rule of topMostRules)ruleDfs(rule,ruleNames,allTerminals);const rules=new Set;for(const rule of grammar.rules)(ruleNames.has(rule.name)||isTerminalRule(rule)&&rule.hidden)&&rules.add(rule);return rules}function ruleDfs(rule,visitedSet,allTerminals){visitedSet.add(rule.name),streamAllContents(rule).forEach(node=>{if(isRuleCall(node)||allTerminals){const refRule=node.rule.ref;refRule&&!visitedSet.has(refRule.name)&&ruleDfs(refRule,visitedSet,allTerminals)}})}function isCommentTerminal(terminalRule){return terminalRule.hidden&&!isWhitespace(terminalRegex(terminalRule))}function findNodeForProperty(node,property,index){if(!node||!property)return;const nodes=findNodesForPropertyInternal(node,property,node.astNode,!0);return 0!==nodes.length?nodes[index=void 0!==index?Math.max(0,Math.min(index,nodes.length-1)):0]:void 0}function findNodesForPropertyInternal(node,property,element,first2){if(!first2){const nodeFeature=getContainerOfType(node.grammarSource,isAssignment);if(nodeFeature&&nodeFeature.feature===property)return[node]}return isCompositeCstNode(node)&&node.astNode===element?node.content.flatMap(e=>findNodesForPropertyInternal(e,property,element,!1)):[]}function findNodeForKeyword(node,keyword,index){if(!node)return;const nodes=function(node,keyword,element){if(node.astNode!==element)return[];if(isKeyword(node.grammarSource)&&node.grammarSource.value===keyword)return[node];const treeIterator=streamCst(node).iterator();let result;const keywordNodes=[];do{if(result=treeIterator.next(),!result.done){const childNode=result.value;childNode.astNode===element?isKeyword(childNode.grammarSource)&&childNode.grammarSource.value===keyword&&keywordNodes.push(childNode):treeIterator.prune()}}while(!result.done);return keywordNodes}(node,keyword,null==node?void 0:node.astNode);return 0!==nodes.length?nodes[index=void 0!==index?Math.max(0,Math.min(index,nodes.length-1)):0]:void 0}function findNameAssignment(type){let startNode=type;return isInferredType(startNode)&&(isAction(startNode.$container)?startNode=startNode.$container.$container:isAbstractParserRule(startNode.$container)?startNode=startNode.$container:assertUnreachable(startNode.$container)),findNameAssignmentInternal(type,startNode,new Map)}function findNameAssignmentInternal(type,startNode,cache){var _a2;function go(node,refType){let childAssignment;return getContainerOfType(node,isAssignment)||(childAssignment=findNameAssignmentInternal(refType,refType,cache)),cache.set(type,childAssignment),childAssignment}if(cache.has(type))return cache.get(type);cache.set(type,void 0);for(const node of streamAllContents(startNode)){if(isAssignment(node)&&"name"===node.feature.toLowerCase())return cache.set(type,node),node;if(isRuleCall(node)&&isParserRule(node.rule.ref))return go(node,node.rule.ref);if(isSimpleType(node)&&(null==(_a2=node.typeRef)?void 0:_a2.ref))return go(node,node.typeRef.ref)}}function isDataTypeRule(rule){return isDataTypeRuleInternal(rule,new Set)}function isDataTypeRuleInternal(rule,visited){if(visited.has(rule))return!0;visited.add(rule);for(const node of streamAllContents(rule))if(isRuleCall(node)){if(!node.rule.ref)return!1;if(isParserRule(node.rule.ref)&&!isDataTypeRuleInternal(node.rule.ref,visited))return!1;if(isInfixRule(node.rule.ref))return!1}else{if(isAssignment(node))return!1;if(isAction(node))return!1}return Boolean(rule.definition)}function getExplicitRuleType(rule){if(!isTerminalRule(rule)){if(rule.inferredType)return rule.inferredType.name;if(rule.dataType)return rule.dataType;if(rule.returnType){const refType=rule.returnType.ref;if(refType)return refType.name}}}function getTypeName(type){if(isAbstractParserRule(type))return isParserRule(type)&&isDataTypeRule(type)?type.name:getExplicitRuleType(type)??type.name;if(item=type,reflection$1.isInstance(item,Interface_$type)||function(item){return reflection$1.isInstance(item,Type_$type)}(type)||function(item){return reflection$1.isInstance(item,ReturnType_$type)}(type))return type.name;if(isAction(type)){const actionType=function(action){var _a2;if(action.inferredType)return action.inferredType.name;if(null==(_a2=action.type)?void 0:_a2.ref)return getTypeName(action.type.ref);return}(type);if(actionType)return actionType}else if(isInferredType(type))return type.name;var item;throw new Error("Cannot get name of Unknown Type")}function terminalRegex(terminalRule){const flags={s:!1,i:!1,u:!1},source=abstractElementToRegex(terminalRule.definition,flags),flagText=Object.entries(flags).filter(([,value])=>value).map(([name])=>name).join("");return new RegExp(source,flagText)}const WILDCARD=/[\s\S]/.source;function abstractElementToRegex(element,flags){var _a2,until,negate,group,alternatives,item;if(item=element,reflection$1.isInstance(item,TerminalAlternatives_$type))return withCardinality((alternatives=element).elements.map(e=>abstractElementToRegex(e)).join("|"),{cardinality:alternatives.cardinality,lookahead:alternatives.lookahead,parenthesized:alternatives.parenthesized,wrap:!1});if(function(item){return reflection$1.isInstance(item,TerminalGroup_$type)}(element))return withCardinality((group=element).elements.map(e=>abstractElementToRegex(e)).join(""),{cardinality:group.cardinality,lookahead:group.lookahead,parenthesized:group.parenthesized,wrap:!1});if(function(item){return reflection$1.isInstance(item,CharacterRange_$type)}(element))return function(range){if(range.right)return withCardinality(`[${keywordToRegex(range.left)}-${keywordToRegex(range.right)}]`,{cardinality:range.cardinality,lookahead:range.lookahead,parenthesized:range.parenthesized,wrap:!1});return withCardinality(keywordToRegex(range.left),{cardinality:range.cardinality,lookahead:range.lookahead,parenthesized:range.parenthesized,wrap:!1})}(element);if(function(item){return reflection$1.isInstance(item,TerminalRuleCall_$type)}(element)){const rule=element.rule.ref;if(!rule)throw new Error("Missing rule reference.");return withCardinality(abstractElementToRegex(rule.definition),{cardinality:element.cardinality,lookahead:element.lookahead,parenthesized:element.parenthesized})}if(function(item){return reflection$1.isInstance(item,NegatedToken_$type)}(element))return withCardinality(`(?!${abstractElementToRegex((negate=element).terminal)})${WILDCARD}*?`,{cardinality:negate.cardinality,lookahead:negate.lookahead,parenthesized:negate.parenthesized});if(function(item){return reflection$1.isInstance(item,UntilToken_$type)}(element))return withCardinality(`${WILDCARD}*?${abstractElementToRegex((until=element).terminal)}`,{cardinality:until.cardinality,lookahead:until.lookahead,parenthesized:until.parenthesized});if(function(item){return reflection$1.isInstance(item,RegexToken_$type)}(element)){const lastSlash=element.regex.lastIndexOf("/"),source=element.regex.substring(1,lastSlash),regexFlags=element.regex.substring(lastSlash+1);return flags&&(flags.i=regexFlags.includes("i"),flags.s=regexFlags.includes("s"),flags.u=regexFlags.includes("u")),withCardinality(source,{cardinality:element.cardinality,lookahead:element.lookahead,parenthesized:element.parenthesized,wrap:!1})}if(function(item){return reflection$1.isInstance(item,Wildcard_$type)}(element))return withCardinality(WILDCARD,{cardinality:element.cardinality,lookahead:element.lookahead,parenthesized:element.parenthesized});throw new Error(`Invalid terminal element: ${null==element?void 0:element.$type}, ${null==(_a2=null==element?void 0:element.$cstNode)?void 0:_a2.text}`)}function keywordToRegex(keyword){return escapeRegExp(keyword.value)}function withCardinality(regex,options){if(options.parenthesized||options.lookahead||!1!==options.wrap){regex=`(${options.lookahead??(options.parenthesized?"":"?:")}${regex})`}return options.cardinality?`${regex}${options.cardinality}`:regex}function PRINT_ERROR(msg){console&&console.error&&console.error(`Error: ${msg}`)}function PRINT_WARNING(msg){console&&console.warn&&console.warn(`Warning: ${msg}`)}function timer(func){const start=(new Date).getTime(),val=func();return{time:(new Date).getTime()-start,value:val}}function toFastProperties(toBecomeFast){function FakeConstructor(){}FakeConstructor.prototype=toBecomeFast;const fakeInstance=new FakeConstructor;function fakeAccess(){return typeof fakeInstance.bar}return fakeAccess(),fakeAccess(),toBecomeFast}class AbstractProduction{get definition(){return this._definition}set definition(value){this._definition=value}constructor(_definition){this._definition=_definition}accept(visitor2){visitor2.visit(this),this.definition.forEach(prod=>{prod.accept(visitor2)})}}class NonTerminal extends AbstractProduction{constructor(options){super([]),this.idx=1,Object.assign(this,pickOnlyDefined(options))}set definition(definition){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(visitor2){visitor2.visit(this)}}class Rule extends AbstractProduction{constructor(options){super(options.definition),this.orgText="",Object.assign(this,pickOnlyDefined(options))}}class Alternative extends AbstractProduction{constructor(options){super(options.definition),this.ignoreAmbiguities=!1,Object.assign(this,pickOnlyDefined(options))}}let Option$1=class extends AbstractProduction{constructor(options){super(options.definition),this.idx=1,Object.assign(this,pickOnlyDefined(options))}};class RepetitionMandatory extends AbstractProduction{constructor(options){super(options.definition),this.idx=1,Object.assign(this,pickOnlyDefined(options))}}class RepetitionMandatoryWithSeparator extends AbstractProduction{constructor(options){super(options.definition),this.idx=1,Object.assign(this,pickOnlyDefined(options))}}class Repetition extends AbstractProduction{constructor(options){super(options.definition),this.idx=1,Object.assign(this,pickOnlyDefined(options))}}class RepetitionWithSeparator extends AbstractProduction{constructor(options){super(options.definition),this.idx=1,Object.assign(this,pickOnlyDefined(options))}}class Alternation extends AbstractProduction{get definition(){return this._definition}set definition(value){this._definition=value}constructor(options){super(options.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,pickOnlyDefined(options))}}class Terminal{constructor(options){this.idx=1,Object.assign(this,pickOnlyDefined(options))}accept(visitor2){visitor2.visit(this)}}function serializeProduction(node){function convertDefinition(definition){return definition.map(serializeProduction)}if(node instanceof NonTerminal){const serializedNonTerminal={type:"NonTerminal",name:node.nonTerminalName,idx:node.idx};return"string"==typeof node.label&&(serializedNonTerminal.label=node.label),serializedNonTerminal}if(node instanceof Alternative)return{type:"Alternative",definition:convertDefinition(node.definition)};if(node instanceof Option$1)return{type:"Option",idx:node.idx,definition:convertDefinition(node.definition)};if(node instanceof RepetitionMandatory)return{type:"RepetitionMandatory",idx:node.idx,definition:convertDefinition(node.definition)};if(node instanceof RepetitionMandatoryWithSeparator)return{type:"RepetitionMandatoryWithSeparator",idx:node.idx,separator:serializeProduction(new Terminal({terminalType:node.separator})),definition:convertDefinition(node.definition)};if(node instanceof RepetitionWithSeparator)return{type:"RepetitionWithSeparator",idx:node.idx,separator:serializeProduction(new Terminal({terminalType:node.separator})),definition:convertDefinition(node.definition)};if(node instanceof Repetition)return{type:"Repetition",idx:node.idx,definition:convertDefinition(node.definition)};if(node instanceof Alternation)return{type:"Alternation",idx:node.idx,definition:convertDefinition(node.definition)};if(node instanceof Terminal){const serializedTerminal={type:"Terminal",name:node.terminalType.name,label:(tokType=node.terminalType,"string"==typeof(obj=tokType).LABEL&&""!==obj.LABEL?tokType.LABEL:tokType.name),idx:node.idx};"string"==typeof node.label&&(serializedTerminal.terminalLabel=node.label);const pattern=node.terminalType.PATTERN;return node.terminalType.PATTERN&&(serializedTerminal.pattern=pattern instanceof RegExp?pattern.source:pattern),serializedTerminal}if(node instanceof Rule)return{type:"Rule",name:node.name,orgText:node.orgText,definition:convertDefinition(node.definition)};throw Error("non exhaustive match");var tokType,obj}function pickOnlyDefined(obj){return Object.fromEntries(Object.entries(obj).filter(([,v])=>void 0!==v))}class GAstVisitor{visit(node){const nodeAny=node;switch(nodeAny.constructor){case NonTerminal:return this.visitNonTerminal(nodeAny);case Alternative:return this.visitAlternative(nodeAny);case Option$1:return this.visitOption(nodeAny);case RepetitionMandatory:return this.visitRepetitionMandatory(nodeAny);case RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(nodeAny);case RepetitionWithSeparator:return this.visitRepetitionWithSeparator(nodeAny);case Repetition:return this.visitRepetition(nodeAny);case Alternation:return this.visitAlternation(nodeAny);case Terminal:return this.visitTerminal(nodeAny);case Rule:return this.visitRule(nodeAny);default:throw Error("non exhaustive match")}}visitNonTerminal(node){}visitAlternative(node){}visitOption(node){}visitRepetition(node){}visitRepetitionMandatory(node){}visitRepetitionMandatoryWithSeparator(node){}visitRepetitionWithSeparator(node){}visitAlternation(node){}visitTerminal(node){}visitRule(node){}}function isOptionalProd(prod,alreadyVisited=[]){return!!(prod instanceof Option$1||prod instanceof Repetition||prod instanceof RepetitionWithSeparator)||(prod instanceof Alternation?prod.definition.some(subProd=>isOptionalProd(subProd,alreadyVisited)):!(prod instanceof NonTerminal&&alreadyVisited.includes(prod))&&(prod instanceof AbstractProduction&&(prod instanceof NonTerminal&&alreadyVisited.push(prod),prod.definition.every(subProd=>isOptionalProd(subProd,alreadyVisited)))))}function getProductionDslName$1(prod){if(prod instanceof NonTerminal)return"SUBRULE";if(prod instanceof Option$1)return"OPTION";if(prod instanceof Alternation)return"OR";if(prod instanceof RepetitionMandatory)return"AT_LEAST_ONE";if(prod instanceof RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(prod instanceof RepetitionWithSeparator)return"MANY_SEP";if(prod instanceof Repetition)return"MANY";if(prod instanceof Terminal)return"CONSUME";throw Error("non exhaustive match")}class RestWalker{walk(prod,prevRest=[]){prod.definition.forEach((subProd,index)=>{const currRest=prod.definition.slice(index+1);if(subProd instanceof NonTerminal)this.walkProdRef(subProd,currRest,prevRest);else if(subProd instanceof Terminal)this.walkTerminal(subProd,currRest,prevRest);else if(subProd instanceof Alternative)this.walkFlat(subProd,currRest,prevRest);else if(subProd instanceof Option$1)this.walkOption(subProd,currRest,prevRest);else if(subProd instanceof RepetitionMandatory)this.walkAtLeastOne(subProd,currRest,prevRest);else if(subProd instanceof RepetitionMandatoryWithSeparator)this.walkAtLeastOneSep(subProd,currRest,prevRest);else if(subProd instanceof RepetitionWithSeparator)this.walkManySep(subProd,currRest,prevRest);else if(subProd instanceof Repetition)this.walkMany(subProd,currRest,prevRest);else{if(!(subProd instanceof Alternation))throw Error("non exhaustive match");this.walkOr(subProd,currRest,prevRest)}})}walkTerminal(terminal,currRest,prevRest){}walkProdRef(refProd,currRest,prevRest){}walkFlat(flatProd,currRest,prevRest){const fullOrRest=currRest.concat(prevRest);this.walk(flatProd,fullOrRest)}walkOption(optionProd,currRest,prevRest){const fullOrRest=currRest.concat(prevRest);this.walk(optionProd,fullOrRest)}walkAtLeastOne(atLeastOneProd,currRest,prevRest){const fullAtLeastOneRest=[new Option$1({definition:atLeastOneProd.definition})].concat(currRest,prevRest);this.walk(atLeastOneProd,fullAtLeastOneRest)}walkAtLeastOneSep(atLeastOneSepProd,currRest,prevRest){const fullAtLeastOneSepRest=restForRepetitionWithSeparator(atLeastOneSepProd,currRest,prevRest);this.walk(atLeastOneSepProd,fullAtLeastOneSepRest)}walkMany(manyProd,currRest,prevRest){const fullManyRest=[new Option$1({definition:manyProd.definition})].concat(currRest,prevRest);this.walk(manyProd,fullManyRest)}walkManySep(manySepProd,currRest,prevRest){const fullManySepRest=restForRepetitionWithSeparator(manySepProd,currRest,prevRest);this.walk(manySepProd,fullManySepRest)}walkOr(orProd,currRest,prevRest){const fullOrRest=currRest.concat(prevRest);orProd.definition.forEach(alt=>{const prodWrapper=new Alternative({definition:[alt]});this.walk(prodWrapper,fullOrRest)})}}function restForRepetitionWithSeparator(repSepProd,currRest,prevRest){return[new Option$1({definition:[new Terminal({terminalType:repSepProd.separator})].concat(repSepProd.definition)})].concat(currRest,prevRest)}function first(prod){if(prod instanceof NonTerminal)return first(prod.referencedRule);if(prod instanceof Terminal)return[prod.terminalType];if(function(prod){return prod instanceof Alternative||prod instanceof Option$1||prod instanceof Repetition||prod instanceof RepetitionMandatory||prod instanceof RepetitionMandatoryWithSeparator||prod instanceof RepetitionWithSeparator||prod instanceof Terminal||prod instanceof Rule}(prod))return function(prod){let firstSet=[];const seq=prod.definition;let currSubProd,nextSubProdIdx=0,hasInnerProdsRemaining=seq.length>nextSubProdIdx,isLastInnerProdOptional=!0;for(;hasInnerProdsRemaining&&isLastInnerProdOptional;)currSubProd=seq[nextSubProdIdx],isLastInnerProdOptional=isOptionalProd(currSubProd),firstSet=firstSet.concat(first(currSubProd)),nextSubProdIdx+=1,hasInnerProdsRemaining=seq.length>nextSubProdIdx;return[...new Set(firstSet)]}(prod);if(function(prod){return prod instanceof Alternation}(prod))return function(prod){const allAlternativesFirsts=prod.definition.map(innerProd=>first(innerProd));return[...new Set(allAlternativesFirsts.flat())]}(prod);throw Error("non exhaustive match")}const IN="_~IN~_";class ResyncFollowsWalker extends RestWalker{constructor(topProd){super(),this.topProd=topProd,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(terminal,currRest,prevRest){}walkProdRef(refProd,currRest,prevRest){const followName=(inner=refProd.referencedRule,occurenceInParent=refProd.idx,inner.name+occurenceInParent+IN+this.topProd.name);var inner,occurenceInParent;const fullRest=currRest.concat(prevRest),t_in_topProd_follows=first(new Alternative({definition:fullRest}));this.follows[followName]=t_in_topProd_follows}}let regExpAstCache={};const regExpParser=new RegExpParser;function getRegExpAst(regExp){const regExpStr=regExp.toString();if(regExpAstCache.hasOwnProperty(regExpStr))return regExpAstCache[regExpStr];{const regExpAst=regExpParser.pattern(regExpStr);return regExpAstCache[regExpStr]=regExpAst,regExpAst}}const failedOptimizationPrefixMsg='Unable to use "first char" lexer optimizations:\n';function getOptimizedStartCodesIndices(regExp,ensureOptimizations=!1){try{const ast=getRegExpAst(regExp);return firstCharOptimizedIndices(ast.value,{},ast.flags.ignoreCase)}catch(e){if("Complement Sets are not supported for first char optimization"===e.message)ensureOptimizations&&PRINT_WARNING(`${failedOptimizationPrefixMsg}\tUnable to optimize: < ${regExp.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 msgSuffix="";ensureOptimizations&&(msgSuffix="\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."),PRINT_ERROR(`${failedOptimizationPrefixMsg}\n\tFailed parsing: < ${regExp.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues`+msgSuffix)}}return[]}function firstCharOptimizedIndices(ast,result,ignoreCase){switch(ast.type){case"Disjunction":for(let i=0;i<ast.value.length;i++)firstCharOptimizedIndices(ast.value[i],result,ignoreCase);break;case"Alternative":const terms=ast.value;for(let i=0;i<terms.length;i++){const term=terms[i];switch(term.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const atom2=term;switch(atom2.type){case"Character":addOptimizedIdxToResult(atom2.value,result,ignoreCase);break;case"Set":if(!0===atom2.complement)throw Error("Complement Sets are not supported for first char optimization");atom2.value.forEach(code=>{if("number"==typeof code)addOptimizedIdxToResult(code,result,ignoreCase);else{const range=code;if(!0===ignoreCase)for(let rangeCode=range.from;rangeCode<=range.to;rangeCode++)addOptimizedIdxToResult(rangeCode,result,ignoreCase);else{for(let rangeCode=range.from;rangeCode<=range.to&&rangeCode<minOptimizationVal;rangeCode++)addOptimizedIdxToResult(rangeCode,result,ignoreCase);if(range.to>=minOptimizationVal){const minUnOptVal=range.from>=minOptimizationVal?range.from:minOptimizationVal,maxUnOptVal=range.to,minOptIdx=charCodeToOptimizedIndex(minUnOptVal),maxOptIdx=charCodeToOptimizedIndex(maxUnOptVal);for(let currOptIdx=minOptIdx;currOptIdx<=maxOptIdx;currOptIdx++)result[currOptIdx]=currOptIdx}}}});break;case"Group":firstCharOptimizedIndices(atom2.value,result,ignoreCase);break;default:throw Error("Non Exhaustive Match")}const isOptionalQuantifier=void 0!==atom2.quantifier&&0===atom2.quantifier.atLeast;if("Group"===atom2.type&&!1===isWholeOptional(atom2)||"Group"!==atom2.type&&!1===isOptionalQuantifier)break}break;default:throw Error("non exhaustive match!")}return Object.values(result)}function addOptimizedIdxToResult(code,result,ignoreCase){const optimizedCharIdx=charCodeToOptimizedIndex(code);result[optimizedCharIdx]=optimizedCharIdx,!0===ignoreCase&&function(code,result){const char=String.fromCharCode(code),upperChar=char.toUpperCase();if(upperChar!==char){const optimizedCharIdx=charCodeToOptimizedIndex(upperChar.charCodeAt(0));result[optimizedCharIdx]=optimizedCharIdx}else{const lowerChar=char.toLowerCase();if(lowerChar!==char){const optimizedCharIdx=charCodeToOptimizedIndex(lowerChar.charCodeAt(0));result[optimizedCharIdx]=optimizedCharIdx}}}(code,result)}function findCode(setNode,targetCharCodes){return setNode.value.find(codeOrRange=>{if("number"==typeof codeOrRange)return targetCharCodes.includes(codeOrRange);{const range=codeOrRange;return void 0!==targetCharCodes.find(targetCode=>range.from<=targetCode&&targetCode<=range.to)}})}function isWholeOptional(ast){const quantifier=ast.quantifier;return!(!quantifier||0!==quantifier.atLeast)||!!ast.value&&(Array.isArray(ast.value)?ast.value.every(isWholeOptional):isWholeOptional(ast.value))}class CharCodeFinder extends BaseRegExpVisitor{constructor(targetCharCodes){super(),this.targetCharCodes=targetCharCodes,this.found=!1}visitChildren(node){if(!0!==this.found){switch(node.type){case"Lookahead":return void this.visitLookahead(node);case"NegativeLookahead":return void this.visitNegativeLookahead(node);case"Lookbehind":return void this.visitLookbehind(node);case"NegativeLookbehind":return void this.visitNegativeLookbehind(node)}super.visitChildren(node)}}visitCharacter(node){this.targetCharCodes.includes(node.value)&&(this.found=!0)}visitSet(node){node.complement?void 0===findCode(node,this.targetCharCodes)&&(this.found=!0):void 0!==findCode(node,this.targetCharCodes)&&(this.found=!0)}}function canMatchCharCode(charCodes,pattern){if(pattern instanceof RegExp){const ast=getRegExpAst(pattern),charCodeFinder=new CharCodeFinder(charCodes);return charCodeFinder.visit(ast),charCodeFinder.found}for(const char of pattern){const charCode=char.charCodeAt(0);if(charCodes.includes(charCode))return!0}return!1}const PATTERN="PATTERN";function analyzeTokenTypes(tokenTypes,options){const tracer=(options=Object.assign({safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:(msg,action)=>action()},options)).tracer;let onlyRelevantTypes;tracer("initCharCodeToOptimizedIndexMap",()=>{!function(){if(0===charCodeToOptimizedIdxMap.length){charCodeToOptimizedIdxMap=new Array(65536);for(let i=0;i<65536;i++)charCodeToOptimizedIdxMap[i]=i>255?255+~~(i/255):i}}()}),tracer("Reject Lexer.NA",()=>{onlyRelevantTypes=tokenTypes.filter(currType=>currType.PATTERN!==Lexer.NA)});let allTransformedPatterns,patternIdxToType,patternIdxToGroup,patternIdxToLongerAltIdxArr,patternIdxToPushMode,patternIdxToPopMode,patternIdxToCanLineTerminator,patternIdxToIsCustom,patternIdxToShort,emptyGroups,patternIdxToConfig,hasCustom=!1;tracer("Transform Patterns",()=>{hasCustom=!1,allTransformedPatterns=onlyRelevantTypes.map(currType=>{const currPattern=currType.PATTERN;if(currPattern instanceof RegExp){const regExpSource=currPattern.source;return 1!==regExpSource.length||"^"===regExpSource||"$"===regExpSource||"."===regExpSource||currPattern.ignoreCase?2!==regExpSource.length||"\\"!==regExpSource[0]||["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"].includes(regExpSource[1])?addStickyFlag(currPattern):regExpSource[1]:regExpSource}if("function"==typeof currPattern)return hasCustom=!0,{exec:currPattern};if("object"==typeof currPattern)return hasCustom=!0,currPattern;if("string"==typeof currPattern){if(1===currPattern.length)return currPattern;{const escapedRegExpString=currPattern.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&");return addStickyFlag(new RegExp(escapedRegExpString))}}throw Error("non exhaustive match")})}),tracer("misc mapping",()=>{patternIdxToType=onlyRelevantTypes.map(currType=>currType.tokenTypeIdx),patternIdxToGroup=onlyRelevantTypes.map(clazz=>{const groupName=clazz.GROUP;if(groupName!==Lexer.SKIPPED){if("string"==typeof groupName)return groupName;if(void 0===groupName)return!1;throw Error("non exhaustive match")}}),patternIdxToLongerAltIdxArr=onlyRelevantTypes.map(clazz=>{const longerAltType=clazz.LONGER_ALT;if(longerAltType){return Array.isArray(longerAltType)?longerAltType.map(type=>onlyRelevantTypes.indexOf(type)):[onlyRelevantTypes.indexOf(longerAltType)]}}),patternIdxToPushMode=onlyRelevantTypes.map(clazz=>clazz.PUSH_MODE),patternIdxToPopMode=onlyRelevantTypes.map(clazz=>Object.hasOwn(clazz,"POP_MODE"))}),tracer("Line Terminator Handling",()=>{const lineTerminatorCharCodes=getCharCodes(options.lineTerminatorCharacters);patternIdxToCanLineTerminator=onlyRelevantTypes.map(tokType=>!1),"onlyOffset"!==options.positionTracking&&(patternIdxToCanLineTerminator=onlyRelevantTypes.map(tokType=>Object.hasOwn(tokType,"LINE_BREAKS")?!!tokType.LINE_BREAKS:!1===checkLineBreaksIssues(tokType,lineTerminatorCharCodes)&&canMatchCharCode(lineTerminatorCharCodes,tokType.PATTERN)))}),tracer("Misc Mapping #2",()=>{patternIdxToIsCustom=onlyRelevantTypes.map(isCustomPattern),patternIdxToShort=allTransformedPatterns.map(isShortPattern),emptyGroups=onlyRelevantTypes.reduce((acc,clazz)=>{const groupName=clazz.GROUP;return"string"==typeof groupName&&groupName!==Lexer.SKIPPED&&(acc[groupName]=[]),acc},{}),patternIdxToConfig=allTransformedPatterns.map((x,idx)=>({pattern:allTransformedPatterns[idx],longerAlt:patternIdxToLongerAltIdxArr[idx],canLineTerminator:patternIdxToCanLineTerminator[idx],isCustom:patternIdxToIsCustom[idx],short:patternIdxToShort[idx],group:patternIdxToGroup[idx],push:patternIdxToPushMode[idx],pop:patternIdxToPopMode[idx],tokenTypeIdx:patternIdxToType[idx],tokenType:onlyRelevantTypes[idx]}))});let canBeOptimized=!0,charCodeToPatternIdxToConfig=[];return options.safeMode||tracer("First Char Optimization",()=>{charCodeToPatternIdxToConfig=onlyRelevantTypes.reduce((result,currTokType,idx)=>{if("string"==typeof currTokType.PATTERN){const optimizedIdx=charCodeToOptimizedIndex(currTokType.PATTERN.charCodeAt(0));addToMapOfArrays(result,optimizedIdx,patternIdxToConfig[idx])}else if(Array.isArray(currTokType.START_CHARS_HINT)){let lastOptimizedIdx;currTokType.START_CHARS_HINT.forEach(charOrInt=>{const currOptimizedIdx=charCodeToOptimizedIndex("string"==typeof charOrInt?charOrInt.charCodeAt(0):charOrInt);lastOptimizedIdx!==currOptimizedIdx&&(lastOptimizedIdx=currOptimizedIdx,addToMapOfArrays(result,currOptimizedIdx,patternIdxToConfig[idx]))})}else if(currTokType.PATTERN instanceof RegExp)if(currTokType.PATTERN.unicode)canBeOptimized=!1,options.ensureOptimizations&&PRINT_ERROR(`${failedOptimizationPrefixMsg}\tUnable to analyze < ${currTokType.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 optimizedCodes=getOptimizedStartCodesIndices(currTokType.PATTERN,options.ensureOptimizations);0===optimizedCodes.length&&(canBeOptimized=!1),optimizedCodes.forEach(code=>{addToMapOfArrays(result,code,patternIdxToConfig[idx])})}else options.ensureOptimizations&&PRINT_ERROR(`${failedOptimizationPrefixMsg}\tTokenType: <${currTokType.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`),canBeOptimized=!1;return result},[])}),{emptyGroups:emptyGroups,patternIdxToConfig:patternIdxToConfig,charCodeToPatternIdxToConfig:charCodeToPatternIdxToConfig,hasCustom:hasCustom,canBeOptimized:canBeOptimized}}function validatePatterns(tokenTypes,validModesNames){let errors=[];const missingResult=function(tokenTypes){const tokenTypesWithMissingPattern=tokenTypes.filter(currType=>!Object.hasOwn(currType,"PATTERN")),errors=tokenTypesWithMissingPattern.map(currType=>({message:"Token Type: ->"+currType.name+"<- missing static 'PATTERN' property",type:LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[currType]})),valid=tokenTypes.filter(x=>!tokenTypesWithMissingPattern.includes(x));return{errors:errors,valid:valid}}(tokenTypes);errors=errors.concat(missingResult.errors);const invalidResult=function(tokenTypes){const tokenTypesWithInvalidPattern=tokenTypes.filter(currType=>{const pattern=currType.PATTERN;return!(pattern instanceof RegExp||"function"==typeof pattern||Object.hasOwn(pattern,"exec")||"string"==typeof pattern)}),errors=tokenTypesWithInvalidPattern.map(currType=>({message:"Token Type: ->"+currType.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[currType]})),valid=tokenTypes.filter(x=>!tokenTypesWithInvalidPattern.includes(x));return{errors:errors,valid:valid}}(missingResult.valid),validTokenTypes=invalidResult.valid;return errors=errors.concat(invalidResult.errors),errors=errors.concat(function(tokenTypes){let errors=[];const withRegExpPatterns=tokenTypes.filter(currTokType=>currTokType[PATTERN]instanceof RegExp);return errors=errors.concat(function(tokenTypes){class EndAnchorFinder extends BaseRegExpVisitor{constructor(){super(...arguments),this.found=!1}visitEndAnchor(node){this.found=!0}}const invalidRegex=tokenTypes.filter(currType=>{const pattern=currType.PATTERN;try{const regexpAst=getRegExpAst(pattern),endAnchorVisitor=new EndAnchorFinder;return endAnchorVisitor.visit(regexpAst),endAnchorVisitor.found}catch(e){return end_of_input.test(pattern.source)}}),errors=invalidRegex.map(currType=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+currType.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[currType]}));return errors}(withRegExpPatterns)),errors=errors.concat(function(tokenTypes){class StartAnchorFinder extends BaseRegExpVisitor{constructor(){super(...arguments),this.found=!1}visitStartAnchor(node){this.found=!0}}const invalidRegex=tokenTypes.filter(currType=>{const pattern=currType.PATTERN;try{const regexpAst=getRegExpAst(pattern),startAnchorVisitor=new StartAnchorFinder;return startAnchorVisitor.visit(regexpAst),startAnchorVisitor.found}catch(e){return start_of_input.test(pattern.source)}}),errors=invalidRegex.map(currType=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+currType.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[currType]}));return errors}(withRegExpPatterns)),errors=errors.concat(function(tokenTypes){const invalidFlags=tokenTypes.filter(currType=>{const pattern=currType[PATTERN];return pattern instanceof RegExp&&(pattern.multiline||pattern.global)}),errors=invalidFlags.map(currType=>({message:"Token Type: ->"+currType.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[currType]}));return errors}(withRegExpPatterns)),errors=errors.concat(function(tokenTypes){const found=[];let identicalPatterns=tokenTypes.map(outerType=>tokenTypes.reduce((result,innerType)=>(outerType.PATTERN.source!==innerType.PATTERN.source||found.includes(innerType)||innerType.PATTERN===Lexer.NA||(found.push(innerType),result.push(innerType)),result),[]));identicalPatterns=identicalPatterns.filter(Boolean);const errors=identicalPatterns.filter(currIdenticalSet=>currIdenticalSet.length>1).map(setOfIdentical=>{const tokenTypeNames=setOfIdentical.map(currType=>currType.name);return{message:`The same RegExp pattern ->${setOfIdentical[0].PATTERN}<-has been used in all of the following Token Types: ${tokenTypeNames.join(", ")} <-`,type:LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:setOfIdentical}});return errors}(withRegExpPatterns)),errors=errors.concat(function(tokenTypes){const matchesEmptyString=tokenTypes.filter(currType=>currType.PATTERN.test("")),errors=matchesEmptyString.map(currType=>({message:"Token Type: ->"+currType.name+"<- static 'PATTERN' must not match an empty string",type:LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[currType]}));return errors}(withRegExpPatterns)),errors}(validTokenTypes)),errors=errors.concat(function(tokenTypes){const invalidTypes=tokenTypes.filter(clazz=>{if(!Object.hasOwn(clazz,"GROUP"))return!1;const group=clazz.GROUP;return group!==Lexer.SKIPPED&&group!==Lexer.NA&&!("string"==typeof group)}),errors=invalidTypes.map(currType=>({message:"Token Type: ->"+currType.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[currType]}));return errors}(validTokenTypes)),errors=errors.concat(function(tokenTypes,validModes){const invalidModes=tokenTypes.filter(clazz=>void 0!==clazz.PUSH_MODE&&!validModes.includes(clazz.PUSH_MODE)),errors=invalidModes.map(tokType=>({message:`Token Type: ->${tokType.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${tokType.PUSH_MODE}<-which does not exist`,type:LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[tokType]}));return errors}(validTokenTypes,validModesNames)),errors=errors.concat(function(tokenTypes){const errors=[],canBeTested=tokenTypes.reduce((result,tokType,idx)=>{const pattern=tokType.PATTERN;return pattern===Lexer.NA||("string"==typeof pattern?result.push({str:pattern,idx:idx,tokenType:tokType}):pattern instanceof RegExp&&(regExp=pattern,void 0===[".","\\","[","]","|","^","$","(",")","?","*","+","{"].find(char=>-1!==regExp.source.indexOf(char)))&&result.push({str:pattern.source,idx:idx,tokenType:tokType})),result;var regExp},[]);return tokenTypes.forEach((aTokType,aIdx)=>{canBeTested.forEach(({str:bStr,idx:bIdx,tokenType:bTokType})=>{if(aIdx<bIdx&&function(str,pattern){if(pattern instanceof RegExp){if(/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(pattern.source))return!1;const regExpArray=pattern.exec(str);return null!==regExpArray&&0===regExpArray.index}if("function"==typeof pattern)return pattern(str,0,[],{});if(Object.hasOwn(pattern,"exec"))return pattern.exec(str,0,[],{});if("string"==typeof pattern)return pattern===str;throw Error("non exhaustive match")}(bStr,aTokType.PATTERN)){const msg=`Token: ->${bTokType.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${aTokType.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;errors.push({message:msg,type:LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[aTokType,bTokType]})}})}),errors}(validTokenTypes)),errors}const end_of_input=/[^\\][$]/;const start_of_input=/[^\\[][\^]|^\^/;function addStickyFlag(pattern){const flags=pattern.ignoreCase?"iy":"y";return new RegExp(`${pattern.source}`,flags)}function performWarningRuntimeChecks(lexerDefinition,trackLines,lineTerminatorCharacters){const warnings=[];let hasAnyLineBreak=!1;const concreteTokenTypes=Object.values(lexerDefinition.modes||{}).flat().filter(Boolean).filter(currType=>currType[PATTERN]!==Lexer.NA),terminatorCharCodes=getCharCodes(lineTerminatorCharacters);return trackLines&&concreteTokenTypes.forEach(tokType=>{const currIssue=checkLineBreaksIssues(tokType,terminatorCharCodes);if(!1!==currIssue){const message=function(tokType,details){if(details.issue===LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <${tokType.name}> Token Type\n\t Root cause: ${details.errMsg}.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(details.issue===LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <${tokType.name}> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}(tokType,currIssue),warningDescriptor={message:message,type:currIssue.issue,tokenType:tokType};warnings.push(warningDescriptor)}else Object.hasOwn(tokType,"LINE_BREAKS")?!0===tokType.LINE_BREAKS&&(hasAnyLineBreak=!0):canMatchCharCode(terminatorCharCodes,tokType.PATTERN)&&(hasAnyLineBreak=!0)}),trackLines&&!hasAnyLineBreak&&warnings.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:LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),warnings}function isCustomPattern(tokenType){const pattern=tokenType.PATTERN;if(pattern instanceof RegExp)return!1;if("function"==typeof pattern)return!0;if(Object.hasOwn(pattern,"exec"))return!0;if("string"==typeof pattern)return!1;throw Error("non exhaustive match")}function isShortPattern(pattern){return"string"==typeof pattern&&1===pattern.length&&pattern.charCodeAt(0)}const LineTerminatorOptimizedTester={test:function(text){const len=text.length;for(let i=this.lastIndex;i<len;i++){const c=text.charCodeAt(i);if(10===c)return this.lastIndex=i+1,!0;if(13===c)return 10===text.charCodeAt(i+1)?this.lastIndex=i+2:this.lastIndex=i+1,!0}return!1},lastIndex:0};function checkLineBreaksIssues(tokType,lineTerminatorCharCodes){if(Object.hasOwn(tokType,"LINE_BREAKS"))return!1;if(tokType.PATTERN instanceof RegExp){try{canMatchCharCode(lineTerminatorCharCodes,tokType.PATTERN)}catch(e){return{issue:LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if("string"==typeof tokType.PATTERN)return!1;if(isCustomPattern(tokType))return{issue:LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function getCharCodes(charsOrCodes){return charsOrCodes.map(numOrString=>"string"==typeof numOrString?numOrString.charCodeAt(0):numOrString)}function addToMapOfArrays(map2,key,value){void 0===map2[key]?map2[key]=[value]:map2[key].push(value)}const minOptimizationVal=256;let charCodeToOptimizedIdxMap=[];function charCodeToOptimizedIndex(charCode){return charCode<minOptimizationVal?charCode:charCodeToOptimizedIdxMap[charCode]}function tokenStructuredMatcher(tokInstance,tokConstructor){const instanceType=tokInstance.tokenTypeIdx;return instanceType===tokConstructor.tokenTypeIdx||!0===tokConstructor.isParent&&!0===tokConstructor.categoryMatchesMap[instanceType]}function tokenStructuredMatcherNoCategories(token,tokType){return token.tokenTypeIdx===tokType.tokenTypeIdx}let tokenShortNameIdx=1;const tokenIdxToClass={};function augmentTokenTypes(tokenTypes){const tokenTypesAndParents=function(tokenTypes){let result=[...tokenTypes],categories=tokenTypes,searching=!0;for(;searching;){categories=categories.map(currTokType=>currTokType.CATEGORIES).flat().filter(Boolean);const newCategories=categories.filter(x=>!result.includes(x));result=result.concat(newCategories),0===newCategories.length?searching=!1:categories=newCategories}return result}(tokenTypes);!function(tokenTypes){tokenTypes.forEach(currTokType=>{var tokType;hasShortKeyProperty(currTokType)||(tokenIdxToClass[tokenShortNameIdx]=currTokType,currTokType.tokenTypeIdx=tokenShortNameIdx++),hasCategoriesProperty(currTokType)&&!Array.isArray(currTokType.CATEGORIES)&&(currTokType.CATEGORIES=[currTokType.CATEGORIES]),hasCategoriesProperty(currTokType)||(currTokType.CATEGORIES=[]),tokType=currTokType,Object.hasOwn(null!=tokType?tokType:{},"categoryMatches")||(currTokType.categoryMatches=[]),function(tokType){return Object.hasOwn(null!=tokType?tokType:{},"categoryMatchesMap")}(currTokType)||(currTokType.categoryMatchesMap={})})}(tokenTypesAndParents),function(tokenTypes){tokenTypes.forEach(currTokType=>{singleAssignCategoriesToksMap([],currTokType)})}(tokenTypesAndParents),function(tokenTypes){tokenTypes.forEach(currTokType=>{currTokType.categoryMatches=[],Object.keys(currTokType.categoryMatchesMap).forEach(key=>{currTokType.categoryMatches.push(tokenIdxToClass[key].tokenTypeIdx)})})}(tokenTypesAndParents),tokenTypesAndParents.forEach(tokType=>{tokType.isParent=tokType.categoryMatches.length>0})}function singleAssignCategoriesToksMap(path,nextNode){path.forEach(pathNode=>{nextNode.categoryMatchesMap[pathNode.tokenTypeIdx]=!0}),nextNode.CATEGORIES.forEach(nextCategory=>{const newPath=path.concat(nextNode);newPath.includes(nextCategory)||singleAssignCategoriesToksMap(newPath,nextCategory)})}function hasShortKeyProperty(tokType){return Object.hasOwn(null!=tokType?tokType:{},"tokenTypeIdx")}function hasCategoriesProperty(tokType){return Object.hasOwn(null!=tokType?tokType:{},"CATEGORIES")}function isTokenType(tokType){return Object.hasOwn(null!=tokType?tokType:{},"tokenTypeIdx")}const defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:token=>`Unable to pop Lexer Mode after encountering Token ->${token.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(fullText,startOffset,length,line,column,mode)=>`unexpected character: ->${fullText.charAt(startOffset)}<- at offset: ${startOffset}, skipped ${length} characters.`};var LexerDefinitionErrorType,LexerDefinitionErrorType2;(LexerDefinitionErrorType2=LexerDefinitionErrorType||(LexerDefinitionErrorType={}))[LexerDefinitionErrorType2.MISSING_PATTERN=0]="MISSING_PATTERN",LexerDefinitionErrorType2[LexerDefinitionErrorType2.INVALID_PATTERN=1]="INVALID_PATTERN",LexerDefinitionErrorType2[LexerDefinitionErrorType2.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",LexerDefinitionErrorType2[LexerDefinitionErrorType2.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",LexerDefinitionErrorType2[LexerDefinitionErrorType2.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",LexerDefinitionErrorType2[LexerDefinitionErrorType2.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",LexerDefinitionErrorType2[LexerDefinitionErrorType2.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",LexerDefinitionErrorType2[LexerDefinitionErrorType2.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",LexerDefinitionErrorType2[LexerDefinitionErrorType2.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",LexerDefinitionErrorType2[LexerDefinitionErrorType2.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",LexerDefinitionErrorType2[LexerDefinitionErrorType2.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",LexerDefinitionErrorType2[LexerDefinitionErrorType2.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",LexerDefinitionErrorType2[LexerDefinitionErrorType2.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",LexerDefinitionErrorType2[LexerDefinitionErrorType2.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",LexerDefinitionErrorType2[LexerDefinitionErrorType2.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",LexerDefinitionErrorType2[LexerDefinitionErrorType2.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",LexerDefinitionErrorType2[LexerDefinitionErrorType2.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",LexerDefinitionErrorType2[LexerDefinitionErrorType2.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";const DEFAULT_LEXER_CONFIG={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(DEFAULT_LEXER_CONFIG);class Lexer{constructor(lexerDefinition,config=DEFAULT_LEXER_CONFIG){if(this.lexerDefinition=lexerDefinition,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=(phaseDesc,phaseImpl)=>{if(!0===this.traceInitPerf){this.traceInitIndent++;const indent=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${indent}--\x3e <${phaseDesc}>`);const{time:time,value:value}=timer(phaseImpl),traceMethod=time>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`),this.traceInitIndent--,value}return phaseImpl()},"boolean"==typeof config)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=Object.assign({},DEFAULT_LEXER_CONFIG,config);const traceInitVal=this.config.traceInitPerf;!0===traceInitVal?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof traceInitVal&&(this.traceInitMaxIdent=traceInitVal,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let actualDefinition,hasOnlySingleMode=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===DEFAULT_LEXER_CONFIG.lineTerminatorsPattern)this.config.lineTerminatorsPattern=LineTerminatorOptimizedTester;else if(this.config.lineTerminatorCharacters===DEFAULT_LEXER_CONFIG.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(config.safeMode&&config.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),Array.isArray(lexerDefinition)?actualDefinition={modes:{defaultMode:[...lexerDefinition]},defaultMode:"defaultMode"}:(hasOnlySingleMode=!1,actualDefinition=Object.assign({},lexerDefinition))}),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(lexerDefinition){const errors=[];return Object.hasOwn(lexerDefinition,"defaultMode")||errors.push({message:"A MultiMode Lexer cannot be initialized without a <defaultMode> property in its definition\n",type:LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(lexerDefinition,"modes")||errors.push({message:"A MultiMode Lexer cannot be initialized without a <modes> property in its definition\n",type:LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(lexerDefinition,"modes")&&Object.hasOwn(lexerDefinition,"defaultMode")&&!Object.hasOwn(lexerDefinition.modes,lexerDefinition.defaultMode)&&errors.push({message:`A MultiMode Lexer cannot be initialized with a defaultMode: <${lexerDefinition.defaultMode}>which does not exist\n`,type:LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(lexerDefinition,"modes")&&Object.keys(lexerDefinition.modes).forEach(currModeName=>{const currModeValue=lexerDefinition.modes[currModeName];currModeValue.forEach((currTokType,currIdx)=>{void 0===currTokType?errors.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${currModeName}> at index: <${currIdx}>\n`,type:LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(currTokType,"LONGER_ALT")&&(Array.isArray(currTokType.LONGER_ALT)?currTokType.LONGER_ALT:[currTokType.LONGER_ALT]).forEach(currLongerAlt=>{void 0===currLongerAlt||currModeValue.includes(currLongerAlt)||errors.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${currLongerAlt.name}> on token <${currTokType.name}> outside of mode <${currModeName}>\n`,type:LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),errors}(actualDefinition,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(performWarningRuntimeChecks(actualDefinition,this.trackStartLines,this.config.lineTerminatorCharacters))})),actualDefinition.modes=actualDefinition.modes?actualDefinition.modes:{},Object.entries(actualDefinition.modes).forEach(([currModeName,currModeValue])=>{actualDefinition.modes[currModeName]=currModeValue.filter(currTokType=>void 0!==currTokType)});const allModeNames=Object.keys(actualDefinition.modes);if(Object.entries(actualDefinition.modes).forEach(([currModName,currModDef])=>{this.TRACE_INIT(`Mode: <${currModName}> processing`,()=>{if(this.modes.push(currModName),!1===this.config.skipValidations&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(validatePatterns(currModDef,allModeNames))}),0===this.lexerDefinitionErrors.length){let currAnalyzeResult;augmentTokenTypes(currModDef),this.TRACE_INIT("analyzeTokenTypes",()=>{currAnalyzeResult=analyzeTokenTypes(currModDef,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:config.positionTracking,ensureOptimizations:config.ensureOptimizations,safeMode:config.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[currModName]=currAnalyzeResult.patternIdxToConfig,this.charCodeToPatternIdxToConfig[currModName]=currAnalyzeResult.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,currAnalyzeResult.emptyGroups),this.hasCustom=currAnalyzeResult.hasCustom||this.hasCustom,this.canModeBeOptimized[currModName]=currAnalyzeResult.canBeOptimized}})}),this.defaultMode=actualDefinition.defaultMode,this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){const allErrMessagesString=this.lexerDefinitionErrors.map(error=>error.message).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+allErrMessagesString)}this.lexerDefinitionWarning.forEach(warningDescriptor=>{PRINT_WARNING(warningDescriptor.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(hasOnlySingleMode&&(this.handleModes=()=>{}),!1===this.trackStartLines&&(this.computeNewColumn=x=>x),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=()=>{}),/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 unOptimizedModes=Object.entries(this.canModeBeOptimized).reduce((cannotBeOptimized,[modeName,canBeOptimized])=>(!1===canBeOptimized&&cannotBeOptimized.push(modeName),cannotBeOptimized),[]);if(config.ensureOptimizations&&unOptimizedModes.length>0)throw Error(`Lexer Modes: < ${unOptimizedModes.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",()=>{regExpAstCache={}}),this.TRACE_INIT("toFastProperties",()=>{toFastProperties(this)})})}tokenize(text,initialMode=this.defaultMode){if(this.lexerDefinitionErrors.length>0){const allErrMessagesString=this.lexerDefinitionErrors.map(error=>error.message).join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+allErrMessagesString)}return this.tokenizeInternal(text,initialMode)}tokenizeInternal(text,initialMode){let i,j,k,matchAltImage,longerAlt,matchedImage,payload,altPayload,imageLength,group,tokType,newToken,errLength,msg,match;const orgText=text,orgLength=orgText.length;let offset=0,matchedTokensIndex=0;const guessedNumberOfTokens=this.hasCustom?0:Math.floor(text.length/10),matchedTokens=new Array(guessedNumberOfTokens),errors=[];let line=this.trackStartLines?1:void 0,column=this.trackStartLines?1:void 0;const groups=function(emptyGroups){const clonedResult={};return Object.keys(emptyGroups).forEach(currKey=>{const currGroupValue=emptyGroups[currKey];if(!Array.isArray(currGroupValue))throw Error("non exhaustive match");clonedResult[currKey]=[]}),clonedResult}(this.emptyGroups),trackLines=this.trackStartLines,lineTerminatorPattern=this.config.lineTerminatorsPattern;let currModePatternsLength=0,patternIdxToConfig=[],currCharCodeToPatternIdxToConfig=[];const modeStack=[],emptyArray=[];Object.freeze(emptyArray);let isOptimizedMode=!1;const pop_mode=popToken=>{if(1===modeStack.length&&void 0===popToken.tokenType.PUSH_MODE){const msg2=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(popToken);errors.push({offset:popToken.startOffset,line:popToken.startLine,column:popToken.startColumn,length:popToken.image.length,message:msg2})}else{modeStack.pop();const newMode=modeStack.at(-1);patternIdxToConfig=this.patternIdxToConfig[newMode],currCharCodeToPatternIdxToConfig=this.charCodeToPatternIdxToConfig[newMode],currModePatternsLength=patternIdxToConfig.length;const modeCanBeOptimized=this.canModeBeOptimized[newMode]&&!1===this.config.safeMode;isOptimizedMode=!(!currCharCodeToPatternIdxToConfig||!modeCanBeOptimized)}};function push_mode(newMode){modeStack.push(newMode),currCharCodeToPatternIdxToConfig=this.charCodeToPatternIdxToConfig[newMode],patternIdxToConfig=this.patternIdxToConfig[newMode],currModePatternsLength=patternIdxToConfig.length,currModePatternsLength=patternIdxToConfig.length;const modeCanBeOptimized=this.canModeBeOptimized[newMode]&&!1===this.config.safeMode;isOptimizedMode=!(!currCharCodeToPatternIdxToConfig||!modeCanBeOptimized)}let currConfig;push_mode.call(this,initialMode);const recoveryEnabled=this.config.recoveryEnabled;for(;offset<orgLength;){matchedImage=null,imageLength=-1;const nextCharCode=orgText.charCodeAt(offset);let chosenPatternIdxToConfig;if(isOptimizedMode){const optimizedCharIdx=charCodeToOptimizedIndex(nextCharCode),possiblePatterns=currCharCodeToPatternIdxToConfig[optimizedCharIdx];chosenPatternIdxToConfig=void 0!==possiblePatterns?possiblePatterns:emptyArray}else chosenPatternIdxToConfig=patternIdxToConfig;const chosenPatternsLength=chosenPatternIdxToConfig.length;for(i=0;i<chosenPatternsLength;i++){currConfig=chosenPatternIdxToConfig[i];const currPattern=currConfig.pattern;payload=null;const singleCharCode=currConfig.short;if(!1!==singleCharCode?nextCharCode===singleCharCode&&(imageLength=1,matchedImage=currPattern):!0===currConfig.isCustom?(match=currPattern.exec(orgText,offset,matchedTokens,groups),null!==match?(matchedImage=match[0],imageLength=matchedImage.length,void 0!==match.payload&&(payload=match.payload)):matchedImage=null):(currPattern.lastIndex=offset,imageLength=this.matchLength(currPattern,text,offset)),-1!==imageLength){if(longerAlt=currConfig.longerAlt,void 0!==longerAlt){matchedImage=text.substring(offset,offset+imageLength);const longerAltLength=longerAlt.length;for(k=0;k<longerAltLength;k++){const longerAltConfig=patternIdxToConfig[longerAlt[k]],longerAltPattern=longerAltConfig.pattern;if(altPayload=null,!0===longerAltConfig.isCustom?(match=longerAltPattern.exec(orgText,offset,matchedTokens,groups),null!==match?(matchAltImage=match[0],void 0!==match.payload&&(altPayload=match.payload)):matchAltImage=null):(longerAltPattern.lastIndex=offset,matchAltImage=this.match(longerAltPattern,text,offset)),matchAltImage&&matchAltImage.length>matchedImage.length){matchedImage=matchAltImage,imageLength=matchAltImage.length,payload=altPayload,currConfig=longerAltConfig;break}}}break}}if(-1!==imageLength){if(group=currConfig.group,void 0!==group&&(matchedImage=null!==matchedImage?matchedImage:text.substring(offset,offset+imageLength),tokType=currConfig.tokenTypeIdx,newToken=this.createTokenInstance(matchedImage,offset,tokType,currConfig.tokenType,line,column,imageLength),this.handlePayload(newToken,payload),!1===group?matchedTokensIndex=this.addToken(matchedTokens,matchedTokensIndex,newToken):groups[group].push(newToken)),!0===trackLines&&!0===currConfig.canLineTerminator){let foundTerminator,lastLTEndOffset,numOfLTsInMatch=0;lineTerminatorPattern.lastIndex=0;do{matchedImage=null!==matchedImage?matchedImage:text.substring(offset,offset+imageLength),foundTerminator=lineTerminatorPattern.test(matchedImage),!0===foundTerminator&&(lastLTEndOffset=lineTerminatorPattern.lastIndex-1,numOfLTsInMatch++)}while(!0===foundTerminator);0!==numOfLTsInMatch?(line+=numOfLTsInMatch,column=imageLength-lastLTEndOffset,this.updateTokenEndLineColumnLocation(newToken,group,lastLTEndOffset,numOfLTsInMatch,line,column,imageLength)):column=this.computeNewColumn(column,imageLength)}else column=this.computeNewColumn(column,imageLength);offset+=imageLength,this.handleModes(currConfig,pop_mode,push_mode,newToken)}else{const errorStartOffset=offset,errorLine=line,errorColumn=column;let foundResyncPoint=!1===recoveryEnabled;for(;!1===foundResyncPoint&&offset<orgLength;)for(offset++,j=0;j<currModePatternsLength;j++){const currConfig2=patternIdxToConfig[j],currPattern=currConfig2.pattern,singleCharCode=currConfig2.short;if(!1!==singleCharCode?orgText.charCodeAt(offset)===singleCharCode&&(foundResyncPoint=!0):!0===currConfig2.isCustom?foundResyncPoint=null!==currPattern.exec(orgText,offset,matchedTokens,groups):(currPattern.lastIndex=offset,foundResyncPoint=null!==currPattern.exec(text)),!0===foundResyncPoint)break}if(errLength=offset-errorStartOffset,column=this.computeNewColumn(column,errLength),msg=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(orgText,errorStartOffset,errLength,errorLine,errorColumn,modeStack.at(-1)),errors.push({offset:errorStartOffset,line:errorLine,column:errorColumn,length:errLength,message:msg}),!1===recoveryEnabled)break}}return this.hasCustom||(matchedTokens.length=matchedTokensIndex),{tokens:matchedTokens,groups:groups,errors:errors}}handleModes(config,pop_mode,push_mode,newToken){if(!0===config.pop){const pushMode=config.push;pop_mode(newToken),void 0!==pushMode&&push_mode.call(this,pushMode)}else void 0!==config.push&&push_mode.call(this,config.push)}updateTokenEndLineColumnLocation(newToken,group,lastLTIdx,numOfLTsInMatch,line,column,imageLength){let lastCharIsLT,fixForEndingInLT;void 0!==group&&(lastCharIsLT=lastLTIdx===imageLength-1,fixForEndingInLT=lastCharIsLT?-1:0,1===numOfLTsInMatch&&!0===lastCharIsLT||(newToken.endLine=line+fixForEndingInLT,newToken.endColumn=column-1-fixForEndingInLT))}computeNewColumn(oldColumn,imageLength){return oldColumn+imageLength}createOffsetOnlyToken(image,startOffset,tokenTypeIdx,tokenType){return{image:image,startOffset:startOffset,tokenTypeIdx:tokenTypeIdx,tokenType:tokenType}}createStartOnlyToken(image,startOffset,tokenTypeIdx,tokenType,startLine,startColumn){return{image:image,startOffset:startOffset,startLine:startLine,startColumn:startColumn,tokenTypeIdx:tokenTypeIdx,tokenType:tokenType}}createFullToken(image,startOffset,tokenTypeIdx,tokenType,startLine,startColumn,imageLength){return{image:image,startOffset:startOffset,endOffset:startOffset+imageLength-1,startLine:startLine,endLine:startLine,startColumn:startColumn,endColumn:startColumn+imageLength-1,tokenTypeIdx:tokenTypeIdx,tokenType:tokenType}}addTokenUsingPush(tokenVector,index,tokenToAdd){return tokenVector.push(tokenToAdd),index}addTokenUsingMemberAccess(tokenVector,index,tokenToAdd){return tokenVector[index]=tokenToAdd,++index}handlePayloadNoCustom(token,payload){}handlePayloadWithCustom(token,payload){null!==payload&&(token.payload=payload)}match(pattern,text,offset){return!0===pattern.test(text)?text.substring(offset,pattern.lastIndex):null}matchLength(pattern,text,offset){return!0===pattern.test(text)?pattern.lastIndex-offset:-1}}function tokenLabel(tokType){return hasTokenLabel(tokType)?tokType.LABEL:tokType.name}function hasTokenLabel(obj){return"string"==typeof obj.LABEL&&""!==obj.LABEL}Lexer.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",Lexer.NA=/NOT_APPLICABLE/;function createToken(config){return function(config){const pattern=config.pattern,tokenType={};tokenType.name=config.name,void 0!==pattern&&(tokenType.PATTERN=pattern);if(Object.hasOwn(config,"parent"))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";Object.hasOwn(config,"categories")&&(tokenType.CATEGORIES=config.categories);augmentTokenTypes([tokenType]),Object.hasOwn(config,"label")&&(tokenType.LABEL=config.label);Object.hasOwn(config,"group")&&(tokenType.GROUP=config.group);Object.hasOwn(config,"pop_mode")&&(tokenType.POP_MODE=config.pop_mode);Object.hasOwn(config,"push_mode")&&(tokenType.PUSH_MODE=config.push_mode);Object.hasOwn(config,"longer_alt")&&(tokenType.LONGER_ALT=config.longer_alt);Object.hasOwn(config,"line_breaks")&&(tokenType.LINE_BREAKS=config.line_breaks);Object.hasOwn(config,"start_chars_hint")&&(tokenType.START_CHARS_HINT=config.start_chars_hint);return tokenType}(config)}const EOF=createToken({name:"EOF",pattern:Lexer.NA});function createTokenInstance(tokType,image,startOffset,endOffset,startLine,endLine,startColumn,endColumn){return{image:image,startOffset:startOffset,endOffset:endOffset,startLine:startLine,endLine:endLine,startColumn:startColumn,endColumn:endColumn,tokenTypeIdx:tokType.tokenTypeIdx,tokenType:tokType}}function tokenMatcher(token,tokType){return tokenStructuredMatcher(token,tokType)}augmentTokenTypes([EOF]);const defaultParserErrorProvider={buildMismatchTokenMessage:({expected:expected,actual:actual,previous:previous,ruleName:ruleName})=>`Expecting ${hasTokenLabel(expected)?`--\x3e ${tokenLabel(expected)} <--`:`token of type --\x3e ${expected.name} <--`} but found --\x3e '${actual.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:firstRedundant,ruleName:ruleName})=>"Redundant input, expecting EOF but found: "+firstRedundant.image,buildNoViableAltMessage({expectedPathsPerAlt:expectedPathsPerAlt,actual:actual,previous:previous,customUserDescription:customUserDescription,ruleName:ruleName}){const errSuffix="\nbut found: '"+actual[0].image+"'";if(customUserDescription)return"Expecting: "+customUserDescription+errSuffix;return"Expecting: "+`one of these possible Token sequences:\n${expectedPathsPerAlt.reduce((result,currAltPaths)=>result.concat(currAltPaths),[]).map(currPath=>`[${currPath.map(currTokenType=>tokenLabel(currTokenType)).join(", ")}]`).map((itemMsg,idx)=>` ${idx+1}. ${itemMsg}`).join("\n")}`+errSuffix},buildEarlyExitMessage({expectedIterationPaths:expectedIterationPaths,actual:actual,customUserDescription:customUserDescription,ruleName:ruleName}){const errSuffix="\nbut found: '"+actual[0].image+"'";if(customUserDescription)return"Expecting: "+customUserDescription+errSuffix;return"Expecting: "+`expecting at least one iteration which starts with one of these possible Token sequences::\n <${expectedIterationPaths.map(currPath=>`[${currPath.map(currTokenType=>tokenLabel(currTokenType)).join(",")}]`).join(" ,")}>`+errSuffix}};Object.freeze(defaultParserErrorProvider);const defaultGrammarResolverErrorProvider={buildRuleNotFoundError:(topLevelRule,undefinedRule)=>"Invalid grammar, reference to a rule which is not defined: ->"+undefinedRule.nonTerminalName+"<-\ninside top level rule: ->"+topLevelRule.name+"<-"},defaultGrammarValidatorErrorProvider={buildDuplicateFoundError(topLevelRule,duplicateProds){const topLevelName=topLevelRule.name,duplicateProd=duplicateProds[0],index=duplicateProd.idx,dslName=getProductionDslName$1(duplicateProd),extraArgument=(prod=duplicateProd)instanceof Terminal?prod.terminalType.name:prod instanceof NonTerminal?prod.nonTerminalName:"";var prod;let msg=`->${dslName}${index>0?index:""}<- ${extraArgument?`with argument: ->${extraArgument}<-`:""}\n appears more than once (${duplicateProds.length} times) in the top level rule: ->${topLevelName}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;return msg=msg.replace(/[ \t]+/g," "),msg=msg.replace(/\s\s+/g,"\n"),msg},buildNamespaceConflictError:rule=>`Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${rule.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(options){const pathMsg=options.prefixPath.map(currTok=>tokenLabel(currTok)).join(", "),occurrence=0===options.alternation.idx?"":options.alternation.idx;return`Ambiguous alternatives: <${options.ambiguityIndices.join(" ,")}> due to common lookahead prefix\nin <OR${occurrence}> inside <${options.topLevelRule.name}> Rule,\n<${pathMsg}> 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(options){const occurrence=0===options.alternation.idx?"":options.alternation.idx,isEmptyPath=0===options.prefixPath.length;let currMessage=`Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(" ,")}> in <OR${occurrence}> inside <${options.topLevelRule.name}> Rule,\n`;if(isEmptyPath)currMessage+="These alternatives are all empty (match no tokens), making them indistinguishable.\nOnly the last alternative may be empty.\n";else{currMessage+=`<${options.prefixPath.map(currtok=>tokenLabel(currtok)).join(", ")}> may appears as a prefix path in all these alternatives.\n`}return currMessage+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",currMessage},buildEmptyRepetitionError(options){let dslName=getProductionDslName$1(options.repetition);0!==options.repetition.idx&&(dslName+=options.repetition.idx);return`The repetition <${dslName}> within Rule <${options.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError:options=>"deprecated",buildEmptyAlternationError:options=>`Ambiguous empty alternative: <${options.emptyChoiceIdx+1}> in <OR${options.alternation.idx}> inside <${options.topLevelRule.name}> Rule.\nOnly the last alternative may be an empty alternative.`,buildTooManyAlternativesError:options=>`An Alternation cannot have more than 256 alternatives:\n<OR${options.alternation.idx}> inside <${options.topLevelRule.name}> Rule.\n has ${options.alternation.definition.length+1} alternatives.`,buildLeftRecursionError(options){const ruleName=options.topLevelRule.name;return`Left Recursion found in grammar.\nrule: <${ruleName}> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n ${`${ruleName} --\x3e ${options.leftRecursionPath.map(currRule=>currRule.name).concat([ruleName]).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:options=>"deprecated",buildDuplicateRuleNameError(options){let ruleName;ruleName=options.topLevelRule instanceof Rule?options.topLevelRule.name:options.topLevelRule;return`Duplicate definition, rule: ->${ruleName}<- is already defined in the grammar: ->${options.grammarName}<-`}};class GastRefResolverVisitor extends GAstVisitor{constructor(nameToTopRule,errMsgProvider){super(),this.nameToTopRule=nameToTopRule,this.errMsgProvider=errMsgProvider,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(prod=>{this.currTopLevel=prod,prod.accept(this)})}visitNonTerminal(node){const ref=this.nameToTopRule[node.nonTerminalName];if(ref)node.referencedRule=ref;else{const msg=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,node);this.errors.push({message:msg,type:ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:node.nonTerminalName})}}}class AbstractNextPossibleTokensWalker extends RestWalker{constructor(topProd,path){super(),this.topProd=topProd,this.path=path,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=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(prod,prevRest=[]){this.found||super.walk(prod,prevRest)}walkProdRef(refProd,currRest,prevRest){if(refProd.referencedRule.name===this.nextProductionName&&refProd.idx===this.nextProductionOccurrence){const fullRest=currRest.concat(prevRest);this.updateExpectedNext(),this.walk(refProd.referencedRule,fullRest)}}updateExpectedNext(){0===this.ruleStack.length?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class NextAfterTokenWalker extends AbstractNextPossibleTokensWalker{constructor(topProd,path){super(topProd,path),this.path=path,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(terminal,currRest,prevRest){if(this.isAtEndOfPath&&terminal.terminalType.name===this.nextTerminalName&&terminal.idx===this.nextTerminalOccurrence&&!this.found){const fullRest=currRest.concat(prevRest),restProd=new Alternative({definition:fullRest});this.possibleTokTypes=first(restProd),this.found=!0}}}class AbstractNextTerminalAfterProductionWalker extends RestWalker{constructor(topRule,occurrence){super(),this.topRule=topRule,this.occurrence=occurrence,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class NextTerminalAfterManyWalker extends AbstractNextTerminalAfterProductionWalker{walkMany(manyProd,currRest,prevRest){if(manyProd.idx===this.occurrence){const firstAfterMany=currRest.concat(prevRest)[0];this.result.isEndOfRule=void 0===firstAfterMany,firstAfterMany instanceof Terminal&&(this.result.token=firstAfterMany.terminalType,this.result.occurrence=firstAfterMany.idx)}else super.walkMany(manyProd,currRest,prevRest)}}class NextTerminalAfterManySepWalker extends AbstractNextTerminalAfterProductionWalker{walkManySep(manySepProd,currRest,prevRest){if(manySepProd.idx===this.occurrence){const firstAfterManySep=currRest.concat(prevRest)[0];this.result.isEndOfRule=void 0===firstAfterManySep,firstAfterManySep instanceof Terminal&&(this.result.token=firstAfterManySep.terminalType,this.result.occurrence=firstAfterManySep.idx)}else super.walkManySep(manySepProd,currRest,prevRest)}}class NextTerminalAfterAtLeastOneWalker extends AbstractNextTerminalAfterProductionWalker{walkAtLeastOne(atLeastOneProd,currRest,prevRest){if(atLeastOneProd.idx===this.occurrence){const firstAfterAtLeastOne=currRest.concat(prevRest)[0];this.result.isEndOfRule=void 0===firstAfterAtLeastOne,firstAfterAtLeastOne instanceof Terminal&&(this.result.token=firstAfterAtLeastOne.terminalType,this.result.occurrence=firstAfterAtLeastOne.idx)}else super.walkAtLeastOne(atLeastOneProd,currRest,prevRest)}}class NextTerminalAfterAtLeastOneSepWalker extends AbstractNextTerminalAfterProductionWalker{walkAtLeastOneSep(atleastOneSepProd,currRest,prevRest){if(atleastOneSepProd.idx===this.occurrence){const firstAfterfirstAfterAtLeastOneSep=currRest.concat(prevRest)[0];this.result.isEndOfRule=void 0===firstAfterfirstAfterAtLeastOneSep,firstAfterfirstAfterAtLeastOneSep instanceof Terminal&&(this.result.token=firstAfterfirstAfterAtLeastOneSep.terminalType,this.result.occurrence=firstAfterfirstAfterAtLeastOneSep.idx)}else super.walkAtLeastOneSep(atleastOneSepProd,currRest,prevRest)}}function possiblePathsFrom(targetDef,maxLength,currPath=[]){currPath=[...currPath];let result=[],i=0;function getAlternativesForProd(definition){const alternatives=possiblePathsFrom(definition.concat(targetDef.slice(i+1)),maxLength,currPath);return result.concat(alternatives)}for(;currPath.length<maxLength&&i<targetDef.length;){const prod=targetDef[i];if(prod instanceof Alternative)return getAlternativesForProd(prod.definition);if(prod instanceof NonTerminal)return getAlternativesForProd(prod.definition);if(prod instanceof Option$1)result=getAlternativesForProd(prod.definition);else{if(prod instanceof RepetitionMandatory){return getAlternativesForProd(prod.definition.concat([new Repetition({definition:prod.definition})]))}if(prod instanceof RepetitionMandatoryWithSeparator){return getAlternativesForProd([new Alternative({definition:prod.definition}),new Repetition({definition:[new Terminal({terminalType:prod.separator})].concat(prod.definition)})])}if(prod instanceof RepetitionWithSeparator){const newDef=prod.definition.concat([new Repetition({definition:[new Terminal({terminalType:prod.separator})].concat(prod.definition)})]);result=getAlternativesForProd(newDef)}else if(prod instanceof Repetition){const newDef=prod.definition.concat([new Repetition({definition:prod.definition})]);result=getAlternativesForProd(newDef)}else{if(prod instanceof Alternation)return prod.definition.forEach(currAlt=>{0!==currAlt.definition.length&&(result=getAlternativesForProd(currAlt.definition))}),result;if(!(prod instanceof Terminal))throw Error("non exhaustive match");currPath.push(prod.terminalType)}}i++}return result.push({partialPath:currPath,suffixDef:targetDef.slice(i)}),result}function expandTopLevelRule(topRule,currIdx,currRuleStack,currOccurrenceStack){const newRuleStack=[...currRuleStack];newRuleStack.push(topRule.name);const newCurrOccurrenceStack=[...currOccurrenceStack];return newCurrOccurrenceStack.push(1),{idx:currIdx,def:topRule.definition,ruleStack:newRuleStack,occurrenceStack:newCurrOccurrenceStack}}var PROD_TYPE,PROD_TYPE2;function getProdType$1(prod){if(prod instanceof Option$1||"Option"===prod)return PROD_TYPE.OPTION;if(prod instanceof Repetition||"Repetition"===prod)return PROD_TYPE.REPETITION;if(prod instanceof RepetitionMandatory||"RepetitionMandatory"===prod)return PROD_TYPE.REPETITION_MANDATORY;if(prod instanceof RepetitionMandatoryWithSeparator||"RepetitionMandatoryWithSeparator"===prod)return PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR;if(prod instanceof RepetitionWithSeparator||"RepetitionWithSeparator"===prod)return PROD_TYPE.REPETITION_WITH_SEPARATOR;if(prod instanceof Alternation||"Alternation"===prod)return PROD_TYPE.ALTERNATION;throw Error("non exhaustive match")}function getLookaheadPaths(options){const{occurrence:occurrence,rule:rule,prodType:prodType,maxLookahead:maxLookahead}=options,type=getProdType$1(prodType);return type===PROD_TYPE.ALTERNATION?getLookaheadPathsForOr(occurrence,rule,maxLookahead):getLookaheadPathsForOptionalProd(occurrence,rule,type,maxLookahead)}function buildAlternativesLookAheadFunc(alts,hasPredicates,tokenMatcher2,dynamicTokensEnabled){const numOfAlts=alts.length,areAllOneTokenLookahead=alts.every(currAlt=>currAlt.every(currPath=>1===currPath.length));if(hasPredicates)return function(orAlts){const predicates=orAlts.map(currAlt=>currAlt.GATE);for(let t=0;t<numOfAlts;t++){const currAlt=alts[t],currNumOfPaths=currAlt.length,currPredicate=predicates[t];if(void 0===currPredicate||!1!==currPredicate.call(this))nextPath:for(let j=0;j<currNumOfPaths;j++){const currPath=currAlt[j],currPathLength=currPath.length;for(let i=0;i<currPathLength;i++){const nextToken=this.LA_FAST(i+1);if(!1===tokenMatcher2(nextToken,currPath[i]))continue nextPath}return t}}};if(areAllOneTokenLookahead&&!dynamicTokensEnabled){const choiceToAlt=alts.map(currAlt=>currAlt.flat()).reduce((result,currAlt,idx)=>(currAlt.forEach(currTokType=>{currTokType.tokenTypeIdx in result||(result[currTokType.tokenTypeIdx]=idx),currTokType.categoryMatches.forEach(currExtendingType=>{Object.hasOwn(result,currExtendingType)||(result[currExtendingType]=idx)})}),result),{});return function(){const nextToken=this.LA_FAST(1);return choiceToAlt[nextToken.tokenTypeIdx]}}return function(){for(let t=0;t<numOfAlts;t++){const currAlt=alts[t],currNumOfPaths=currAlt.length;nextPath:for(let j=0;j<currNumOfPaths;j++){const currPath=currAlt[j],currPathLength=currPath.length;for(let i=0;i<currPathLength;i++){const nextToken=this.LA_FAST(i+1);if(!1===tokenMatcher2(nextToken,currPath[i]))continue nextPath}return t}}}}function buildSingleAlternativeLookaheadFunction(alt,tokenMatcher2,dynamicTokensEnabled){const areAllOneTokenLookahead=alt.every(currPath=>1===currPath.length),numOfPaths=alt.length;if(areAllOneTokenLookahead&&!dynamicTokensEnabled){const singleTokensTypes=alt.flat();if(1===singleTokensTypes.length&&0===singleTokensTypes[0].categoryMatches.length){const expectedTokenUniqueKey=singleTokensTypes[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===expectedTokenUniqueKey}}{const choiceToAlt=singleTokensTypes.reduce((result,currTokType,idx)=>(result[currTokType.tokenTypeIdx]=!0,currTokType.categoryMatches.forEach(currExtendingType=>{result[currExtendingType]=!0}),result),[]);return function(){const nextToken=this.LA_FAST(1);return!0===choiceToAlt[nextToken.tokenTypeIdx]}}}return function(){nextPath:for(let j=0;j<numOfPaths;j++){const currPath=alt[j],currPathLength=currPath.length;for(let i=0;i<currPathLength;i++){const nextToken=this.LA_FAST(i+1);if(!1===tokenMatcher2(nextToken,currPath[i]))continue nextPath}return!0}return!1}}(PROD_TYPE2=PROD_TYPE||(PROD_TYPE={}))[PROD_TYPE2.OPTION=0]="OPTION",PROD_TYPE2[PROD_TYPE2.REPETITION=1]="REPETITION",PROD_TYPE2[PROD_TYPE2.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",PROD_TYPE2[PROD_TYPE2.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",PROD_TYPE2[PROD_TYPE2.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",PROD_TYPE2[PROD_TYPE2.ALTERNATION=5]="ALTERNATION";class RestDefinitionFinderWalker extends RestWalker{constructor(topProd,targetOccurrence,targetProdType){super(),this.topProd=topProd,this.targetOccurrence=targetOccurrence,this.targetProdType=targetProdType}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(node,expectedProdType,currRest,prevRest){return node.idx===this.targetOccurrence&&this.targetProdType===expectedProdType&&(this.restDef=currRest.concat(prevRest),!0)}walkOption(optionProd,currRest,prevRest){this.checkIsTarget(optionProd,PROD_TYPE.OPTION,currRest,prevRest)||super.walkOption(optionProd,currRest,prevRest)}walkAtLeastOne(atLeastOneProd,currRest,prevRest){this.checkIsTarget(atLeastOneProd,PROD_TYPE.REPETITION_MANDATORY,currRest,prevRest)||super.walkOption(atLeastOneProd,currRest,prevRest)}walkAtLeastOneSep(atLeastOneSepProd,currRest,prevRest){this.checkIsTarget(atLeastOneSepProd,PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,currRest,prevRest)||super.walkOption(atLeastOneSepProd,currRest,prevRest)}walkMany(manyProd,currRest,prevRest){this.checkIsTarget(manyProd,PROD_TYPE.REPETITION,currRest,prevRest)||super.walkOption(manyProd,currRest,prevRest)}walkManySep(manySepProd,currRest,prevRest){this.checkIsTarget(manySepProd,PROD_TYPE.REPETITION_WITH_SEPARATOR,currRest,prevRest)||super.walkOption(manySepProd,currRest,prevRest)}}class InsideDefinitionFinderVisitor extends GAstVisitor{constructor(targetOccurrence,targetProdType,targetRef){super(),this.targetOccurrence=targetOccurrence,this.targetProdType=targetProdType,this.targetRef=targetRef,this.result=[]}checkIsTarget(node,expectedProdName){node.idx!==this.targetOccurrence||this.targetProdType!==expectedProdName||void 0!==this.targetRef&&node!==this.targetRef||(this.result=node.definition)}visitOption(node){this.checkIsTarget(node,PROD_TYPE.OPTION)}visitRepetition(node){this.checkIsTarget(node,PROD_TYPE.REPETITION)}visitRepetitionMandatory(node){this.checkIsTarget(node,PROD_TYPE.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(node){this.checkIsTarget(node,PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(node){this.checkIsTarget(node,PROD_TYPE.REPETITION_WITH_SEPARATOR)}visitAlternation(node){this.checkIsTarget(node,PROD_TYPE.ALTERNATION)}}function initializeArrayOfArrays(size){const result=new Array(size);for(let i=0;i<size;i++)result[i]=[];return result}function pathToHashKeys(path){let keys=[""];for(let i=0;i<path.length;i++){const tokType=path[i],longerKeys=[];for(let j=0;j<keys.length;j++){const currShorterKey=keys[j];longerKeys.push(currShorterKey+"_"+tokType.tokenTypeIdx);for(let t=0;t<tokType.categoryMatches.length;t++){const categoriesKeySuffix="_"+tokType.categoryMatches[t];longerKeys.push(currShorterKey+categoriesKeySuffix)}}keys=longerKeys}return keys}function isUniquePrefixHash(altKnownPathsKeys,searchPathKeys,idx){for(let currAltIdx=0;currAltIdx<altKnownPathsKeys.length;currAltIdx++){if(currAltIdx===idx)continue;const otherAltKnownPathsKeys=altKnownPathsKeys[currAltIdx];for(let searchIdx=0;searchIdx<searchPathKeys.length;searchIdx++){if(!0===otherAltKnownPathsKeys[searchPathKeys[searchIdx]])return!1}}return!0}function lookAheadSequenceFromAlternatives(altsDefs,k){const partialAlts=altsDefs.map(currAlt=>possiblePathsFrom([currAlt],1)),finalResult=initializeArrayOfArrays(partialAlts.length),altsHashes=partialAlts.map(currAltPaths=>{const dict={};return currAltPaths.forEach(item=>{pathToHashKeys(item.partialPath).forEach(currKey=>{dict[currKey]=!0})}),dict});let newData=partialAlts;for(let pathLength=1;pathLength<=k;pathLength++){const currDataset=newData;newData=initializeArrayOfArrays(currDataset.length);for(let altIdx=0;altIdx<currDataset.length;altIdx++){const currAltPathsAndSuffixes=currDataset[altIdx];for(let currPathIdx=0;currPathIdx<currAltPathsAndSuffixes.length;currPathIdx++){const currPathPrefix=currAltPathsAndSuffixes[currPathIdx].partialPath,suffixDef=currAltPathsAndSuffixes[currPathIdx].suffixDef,prefixKeys=pathToHashKeys(currPathPrefix);if(isUniquePrefixHash(altsHashes,prefixKeys,altIdx)||0===suffixDef.length||currPathPrefix.length===k){const currAltResult=finalResult[altIdx];if(!1===containsPath(currAltResult,currPathPrefix)){currAltResult.push(currPathPrefix);for(let j=0;j<prefixKeys.length;j++){const currKey=prefixKeys[j];altsHashes[altIdx][currKey]=!0}}}else{const newPartialPathsAndSuffixes=possiblePathsFrom(suffixDef,pathLength+1,currPathPrefix);newData[altIdx]=newData[altIdx].concat(newPartialPathsAndSuffixes),newPartialPathsAndSuffixes.forEach(item=>{pathToHashKeys(item.partialPath).forEach(key=>{altsHashes[altIdx][key]=!0})})}}}}return finalResult}function getLookaheadPathsForOr(occurrence,ruleGrammar,k,orProd){const visitor2=new InsideDefinitionFinderVisitor(occurrence,PROD_TYPE.ALTERNATION,orProd);return ruleGrammar.accept(visitor2),lookAheadSequenceFromAlternatives(visitor2.result,k)}function getLookaheadPathsForOptionalProd(occurrence,ruleGrammar,prodType,k){const insideDefVisitor=new InsideDefinitionFinderVisitor(occurrence,prodType);ruleGrammar.accept(insideDefVisitor);const insideDef=insideDefVisitor.result,afterDef=new RestDefinitionFinderWalker(ruleGrammar,occurrence,prodType).startWalking();return lookAheadSequenceFromAlternatives([new Alternative({definition:insideDef}),new Alternative({definition:afterDef})],k)}function containsPath(alternative,searchPath){compareOtherPath:for(let i=0;i<alternative.length;i++){const otherPath=alternative[i];if(otherPath.length===searchPath.length){for(let j=0;j<otherPath.length;j++){const searchTok=searchPath[j],otherTok=otherPath[j];if(!1===(searchTok===otherTok||void 0!==otherTok.categoryMatchesMap[searchTok.tokenTypeIdx]))continue compareOtherPath}return!0}}return!1}function areTokenCategoriesNotUsed(lookAheadPaths){return lookAheadPaths.every(singleAltPaths=>singleAltPaths.every(singlePath=>singlePath.every(token=>0===token.categoryMatches.length)))}function validateGrammar$1(topLevels,tokenTypes,errMsgProvider,grammarName){const duplicateErrors=topLevels.flatMap(currTopLevel=>function(topLevelRule,errMsgProvider){const collectorVisitor2=new OccurrenceValidationCollector;topLevelRule.accept(collectorVisitor2);const allRuleProductions=collectorVisitor2.allProductions,productionGroups=Object.groupBy(allRuleProductions,identifyProductionForDuplicates),duplicates=Object.fromEntries(Object.entries(productionGroups).filter(([_k2,currGroup])=>currGroup.length>1)),errors=Object.values(duplicates).map(currDuplicates=>{const firstProd=currDuplicates[0],msg=errMsgProvider.buildDuplicateFoundError(topLevelRule,currDuplicates),dslName=getProductionDslName$1(firstProd),defError={message:msg,type:ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:topLevelRule.name,dslName:dslName,occurrence:firstProd.idx},param=getExtraProductionArgument(firstProd);return param&&(defError.parameter=param),defError});return errors}(currTopLevel,errMsgProvider)),termsNamespaceConflictErrors=function(topLevels,tokenTypes,errMsgProvider){const errors=[],tokenNames=tokenTypes.map(currToken=>currToken.name);return topLevels.forEach(currRule=>{const currRuleName=currRule.name;if(tokenNames.includes(currRuleName)){const errMsg=errMsgProvider.buildNamespaceConflictError(currRule);errors.push({message:errMsg,type:ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:currRuleName})}}),errors}(topLevels,tokenTypes,errMsgProvider),tooManyAltsErrors=topLevels.flatMap(curRule=>function(topLevelRule,errMsgProvider){const orCollector=new OrCollector;topLevelRule.accept(orCollector);const errors=orCollector.alternations.flatMap(currOr=>currOr.definition.length>255?[{message:errMsgProvider.buildTooManyAlternativesError({topLevelRule:topLevelRule,alternation:currOr}),type:ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:topLevelRule.name,occurrence:currOr.idx}]:[]);return errors}(curRule,errMsgProvider)),duplicateRulesError=topLevels.flatMap(curRule=>function(rule,allRules,className,errMsgProvider){const errors=[],occurrences=allRules.reduce((result,curRule)=>curRule.name===rule.name?result+1:result,0);if(occurrences>1){const errMsg=errMsgProvider.buildDuplicateRuleNameError({topLevelRule:rule,grammarName:className});errors.push({message:errMsg,type:ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:rule.name})}return errors}(curRule,topLevels,grammarName,errMsgProvider));return duplicateErrors.concat(termsNamespaceConflictErrors,tooManyAltsErrors,duplicateRulesError)}function identifyProductionForDuplicates(prod){return`${getProductionDslName$1(prod)}_#_${prod.idx}_#_${getExtraProductionArgument(prod)}`}function getExtraProductionArgument(prod){return prod instanceof Terminal?prod.terminalType.name:prod instanceof NonTerminal?prod.nonTerminalName:""}class OccurrenceValidationCollector extends GAstVisitor{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(subrule){this.allProductions.push(subrule)}visitOption(option2){this.allProductions.push(option2)}visitRepetitionWithSeparator(manySep){this.allProductions.push(manySep)}visitRepetitionMandatory(atLeastOne){this.allProductions.push(atLeastOne)}visitRepetitionMandatoryWithSeparator(atLeastOneSep){this.allProductions.push(atLeastOneSep)}visitRepetition(many){this.allProductions.push(many)}visitAlternation(or){this.allProductions.push(or)}visitTerminal(terminal){this.allProductions.push(terminal)}}function validateNoLeftRecursion(topRule,currRule,errMsgProvider,path=[]){const errors=[],nextNonTerminals=getFirstNoneTerminal(currRule.definition);if(0===nextNonTerminals.length)return[];{const ruleName=topRule.name;nextNonTerminals.includes(topRule)&&errors.push({message:errMsgProvider.buildLeftRecursionError({topLevelRule:topRule,leftRecursionPath:path}),type:ParserDefinitionErrorType.LEFT_RECURSION,ruleName:ruleName});const excluded=path.concat([topRule]),errorsFromNextSteps=nextNonTerminals.filter(x=>!excluded.includes(x)).flatMap(currRefRule=>{const newPath=[...path];return newPath.push(currRefRule),validateNoLeftRecursion(topRule,currRefRule,errMsgProvider,newPath)});return errors.concat(errorsFromNextSteps)}}function getFirstNoneTerminal(definition){let result=[];if(0===definition.length)return result;const firstProd=definition[0];if(firstProd instanceof NonTerminal)result.push(firstProd.referencedRule);else if(firstProd instanceof Alternative||firstProd instanceof Option$1||firstProd instanceof RepetitionMandatory||firstProd instanceof RepetitionMandatoryWithSeparator||firstProd instanceof RepetitionWithSeparator||firstProd instanceof Repetition)result=result.concat(getFirstNoneTerminal(firstProd.definition));else if(firstProd instanceof Alternation)result=firstProd.definition.map(currSubDef=>getFirstNoneTerminal(currSubDef.definition)).flat();else if(!(firstProd instanceof Terminal))throw Error("non exhaustive match");const isFirstOptional=isOptionalProd(firstProd),hasMore=definition.length>1;if(isFirstOptional&&hasMore){const rest=definition.slice(1);return result.concat(getFirstNoneTerminal(rest))}return result}class OrCollector extends GAstVisitor{constructor(){super(...arguments),this.alternations=[]}visitAlternation(node){this.alternations.push(node)}}function validateEmptyOrAlternative(topLevelRule,errMsgProvider){const orCollector=new OrCollector;topLevelRule.accept(orCollector);return orCollector.alternations.flatMap(currOr=>currOr.definition.slice(0,-1).flatMap((currAlternative,currAltIdx)=>0===function(initialDef,tokenVector,tokMatcher,maxLookAhead){const EXIT_NON_TERMINAL_ARR=["EXIT_NONE_TERMINAL"];let foundCompletePath=!1;const tokenVectorLength=tokenVector.length,minimalAlternativesIndex=tokenVectorLength-maxLookAhead-1,result=[],possiblePaths=[];for(possiblePaths.push({idx:-1,def:initialDef,ruleStack:[],occurrenceStack:[]});0!==possiblePaths.length;){const currPath=possiblePaths.pop();if("EXIT_ALTERNATIVE"===currPath){foundCompletePath&&possiblePaths.at(-1).idx<=minimalAlternativesIndex&&possiblePaths.pop();continue}const currDef=currPath.def,currIdx=currPath.idx,currRuleStack=currPath.ruleStack,currOccurrenceStack=currPath.occurrenceStack;if(0===currDef.length)continue;const prod=currDef[0];if("EXIT_NONE_TERMINAL"===prod){const nextPath={idx:currIdx,def:currDef.slice(1),ruleStack:currRuleStack.slice(0,-1),occurrenceStack:currOccurrenceStack.slice(0,-1)};possiblePaths.push(nextPath)}else if(prod instanceof Terminal)if(currIdx<tokenVectorLength-1){const nextIdx=currIdx+1;if(tokMatcher(tokenVector[nextIdx],prod.terminalType)){const nextPath={idx:nextIdx,def:currDef.slice(1),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPath)}}else{if(currIdx!==tokenVectorLength-1)throw Error("non exhaustive match");result.push({nextTokenType:prod.terminalType,nextTokenOccurrence:prod.idx,ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack}),foundCompletePath=!0}else if(prod instanceof NonTerminal){const newRuleStack=[...currRuleStack];newRuleStack.push(prod.nonTerminalName);const newOccurrenceStack=[...currOccurrenceStack];newOccurrenceStack.push(prod.idx);const nextPath={idx:currIdx,def:prod.definition.concat(EXIT_NON_TERMINAL_ARR,currDef.slice(1)),ruleStack:newRuleStack,occurrenceStack:newOccurrenceStack};possiblePaths.push(nextPath)}else if(prod instanceof Option$1){const nextPathWithout={idx:currIdx,def:currDef.slice(1),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWithout),possiblePaths.push("EXIT_ALTERNATIVE");const nextPathWith={idx:currIdx,def:prod.definition.concat(currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWith)}else if(prod instanceof RepetitionMandatory){const secondIteration=new Repetition({definition:prod.definition,idx:prod.idx}),nextPath={idx:currIdx,def:prod.definition.concat([secondIteration],currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPath)}else if(prod instanceof RepetitionMandatoryWithSeparator){const separatorGast=new Terminal({terminalType:prod.separator}),secondIteration=new Repetition({definition:[separatorGast].concat(prod.definition),idx:prod.idx}),nextPath={idx:currIdx,def:prod.definition.concat([secondIteration],currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPath)}else if(prod instanceof RepetitionWithSeparator){const nextPathWithout={idx:currIdx,def:currDef.slice(1),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWithout),possiblePaths.push("EXIT_ALTERNATIVE");const separatorGast=new Terminal({terminalType:prod.separator}),nthRepetition=new Repetition({definition:[separatorGast].concat(prod.definition),idx:prod.idx}),nextPathWith={idx:currIdx,def:prod.definition.concat([nthRepetition],currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWith)}else if(prod instanceof Repetition){const nextPathWithout={idx:currIdx,def:currDef.slice(1),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWithout),possiblePaths.push("EXIT_ALTERNATIVE");const nthRepetition=new Repetition({definition:prod.definition,idx:prod.idx}),nextPathWith={idx:currIdx,def:prod.definition.concat([nthRepetition],currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(nextPathWith)}else if(prod instanceof Alternation)for(let i=prod.definition.length-1;i>=0;i--){const currAltPath={idx:currIdx,def:prod.definition[i].definition.concat(currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack};possiblePaths.push(currAltPath),possiblePaths.push("EXIT_ALTERNATIVE")}else if(prod instanceof Alternative)possiblePaths.push({idx:currIdx,def:prod.definition.concat(currDef.slice(1)),ruleStack:currRuleStack,occurrenceStack:currOccurrenceStack});else{if(!(prod instanceof Rule))throw Error("non exhaustive match");possiblePaths.push(expandTopLevelRule(prod,currIdx,currRuleStack,currOccurrenceStack))}}return result}([currAlternative],[],tokenStructuredMatcher,1).length?[{message:errMsgProvider.buildEmptyAlternationError({topLevelRule:topLevelRule,alternation:currOr,emptyChoiceIdx:currAltIdx}),type:ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:topLevelRule.name,occurrence:currOr.idx,alternative:currAltIdx+1}]:[]))}function validateAmbiguousAlternationAlternatives(topLevelRule,globalMaxLookahead,errMsgProvider){const orCollector=new OrCollector;topLevelRule.accept(orCollector);let ors=orCollector.alternations;ors=ors.filter(currOr=>!0!==currOr.ignoreAmbiguities);const errors=ors.flatMap(currOr=>{const currOccurrence=currOr.idx,actualMaxLookahead=currOr.maxLookahead||globalMaxLookahead,alternatives=getLookaheadPathsForOr(currOccurrence,topLevelRule,actualMaxLookahead,currOr),altsAmbiguityErrors=function(alternatives,alternation2,rule,errMsgProvider){const foundAmbiguousPaths=[],identicalAmbiguities=alternatives.reduce((result,currAlt,currAltIdx)=>(!0===alternation2.definition[currAltIdx].ignoreAmbiguities||currAlt.forEach(currPath=>{const altsCurrPathAppearsIn=[currAltIdx];alternatives.forEach((currOtherAlt,currOtherAltIdx)=>{currAltIdx!==currOtherAltIdx&&containsPath(currOtherAlt,currPath)&&!0!==alternation2.definition[currOtherAltIdx].ignoreAmbiguities&&altsCurrPathAppearsIn.push(currOtherAltIdx)}),altsCurrPathAppearsIn.length>1&&!containsPath(foundAmbiguousPaths,currPath)&&(foundAmbiguousPaths.push(currPath),result.push({alts:altsCurrPathAppearsIn,path:currPath}))}),result),[]),currErrors=identicalAmbiguities.map(currAmbDescriptor=>{const ambgIndices=currAmbDescriptor.alts.map(currAltIdx=>currAltIdx+1);return{message:errMsgProvider.buildAlternationAmbiguityError({topLevelRule:rule,alternation:alternation2,ambiguityIndices:ambgIndices,prefixPath:currAmbDescriptor.path}),type:ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:rule.name,occurrence:alternation2.idx,alternatives:currAmbDescriptor.alts}});return currErrors}(alternatives,currOr,topLevelRule,errMsgProvider),altsPrefixAmbiguityErrors=function(alternatives,alternation2,rule,errMsgProvider){const pathsAndIndices=alternatives.reduce((result,currAlt,idx)=>{const currPathsAndIdx=currAlt.map(currPath=>({idx:idx,path:currPath}));return result.concat(currPathsAndIdx)},[]),errors=pathsAndIndices.flatMap(currPathAndIdx=>{if(!0===alternation2.definition[currPathAndIdx.idx].ignoreAmbiguities)return[];const targetIdx=currPathAndIdx.idx,targetPath=currPathAndIdx.path;return pathsAndIndices.filter(searchPathAndIdx=>{return!0!==alternation2.definition[searchPathAndIdx.idx].ignoreAmbiguities&&searchPathAndIdx.idx<targetIdx&&(prefix=searchPathAndIdx.path,other=targetPath,prefix.length<other.length&&prefix.every((tokType,idx)=>{const otherTokType=other[idx];return tokType===otherTokType||otherTokType.categoryMatchesMap[tokType.tokenTypeIdx]}));var prefix,other}).map(currAmbPathAndIdx=>{const ambgIndices=[currAmbPathAndIdx.idx+1,targetIdx+1],occurrence=0===alternation2.idx?"":alternation2.idx;return{message:errMsgProvider.buildAlternationPrefixAmbiguityError({topLevelRule:rule,alternation:alternation2,ambiguityIndices:ambgIndices,prefixPath:currAmbPathAndIdx.path}),type:ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:rule.name,occurrence:occurrence,alternatives:ambgIndices}})});return errors}(alternatives,currOr,topLevelRule,errMsgProvider);return altsAmbiguityErrors.concat(altsPrefixAmbiguityErrors)});return errors}class RepetitionCollector extends GAstVisitor{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(manySep){this.allProductions.push(manySep)}visitRepetitionMandatory(atLeastOne){this.allProductions.push(atLeastOne)}visitRepetitionMandatoryWithSeparator(atLeastOneSep){this.allProductions.push(atLeastOneSep)}visitRepetition(many){this.allProductions.push(many)}}function resolveGrammar(options){const actualOptions=Object.assign({errMsgProvider:defaultGrammarResolverErrorProvider},options),topRulesTable={};return options.rules.forEach(rule=>{topRulesTable[rule.name]=rule}),function(topLevels,errMsgProvider){const refResolver=new GastRefResolverVisitor(topLevels,errMsgProvider);return refResolver.resolveRefs(),refResolver.errors}(topRulesTable,actualOptions.errMsgProvider)}const RECOGNITION_EXCEPTION_NAMES=["MismatchedTokenException","NoViableAltException","EarlyExitException","NotAllInputParsedException"];function isRecognitionException(error){return RECOGNITION_EXCEPTION_NAMES.includes(error.name)}Object.freeze(RECOGNITION_EXCEPTION_NAMES);class RecognitionException extends Error{constructor(message,token){super(message),this.token=token,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class MismatchedTokenException extends RecognitionException{constructor(message,token,previousToken){super(message,token),this.previousToken=previousToken,this.name="MismatchedTokenException"}}class NoViableAltException extends RecognitionException{constructor(message,token,previousToken){super(message,token),this.previousToken=previousToken,this.name="NoViableAltException"}}class NotAllInputParsedException extends RecognitionException{constructor(message,token){super(message,token),this.name="NotAllInputParsedException"}}class EarlyExitException extends RecognitionException{constructor(message,token,previousToken){super(message,token),this.previousToken=previousToken,this.name="EarlyExitException"}}const EOF_FOLLOW_KEY={};class InRuleRecoveryException extends Error{constructor(message){super(message),this.name="InRuleRecoveryException"}}function attemptInRepetitionRecovery(prodFunc,args,lookaheadFunc,dslMethodIdx,prodOccurrence,nextToksWalker,notStuck){const key=this.getKeyForAutomaticLookahead(dslMethodIdx,prodOccurrence);let firstAfterRepInfo=this.firstAfterRepMap[key];if(void 0===firstAfterRepInfo){const currRuleName=this.getCurrRuleFullName();firstAfterRepInfo=new nextToksWalker(this.getGAstProductions()[currRuleName],prodOccurrence).startWalking(),this.firstAfterRepMap[key]=firstAfterRepInfo}let expectTokAfterLastMatch=firstAfterRepInfo.token,nextTokIdx=firstAfterRepInfo.occurrence;const isEndOfRule=firstAfterRepInfo.isEndOfRule;0===this.RULE_STACK_IDX&&isEndOfRule&&void 0===expectTokAfterLastMatch&&(expectTokAfterLastMatch=EOF,nextTokIdx=1),void 0!==expectTokAfterLastMatch&&void 0!==nextTokIdx&&this.shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch,nextTokIdx,notStuck)&&this.tryInRepetitionRecovery(prodFunc,args,lookaheadFunc,expectTokAfterLastMatch)}function getKeyForAutomaticLookahead(ruleIdx,dslMethodIdx,occurrence){return occurrence|dslMethodIdx|ruleIdx}class LLkLookaheadStrategy{constructor(options){var _a2;this.maxLookahead=null!==(_a2=null==options?void 0:options.maxLookahead)&&void 0!==_a2?_a2:DEFAULT_PARSER_CONFIG.maxLookahead}validate(options){const leftRecursionErrors=this.validateNoLeftRecursion(options.rules);if(0===leftRecursionErrors.length){const emptyAltErrors=this.validateEmptyOrAlternatives(options.rules),ambiguousAltsErrors=this.validateAmbiguousAlternationAlternatives(options.rules,this.maxLookahead),emptyRepetitionErrors=this.validateSomeNonEmptyLookaheadPath(options.rules,this.maxLookahead);return[...leftRecursionErrors,...emptyAltErrors,...ambiguousAltsErrors,...emptyRepetitionErrors]}return leftRecursionErrors}validateNoLeftRecursion(rules){return rules.flatMap(currTopRule=>validateNoLeftRecursion(currTopRule,currTopRule,defaultGrammarValidatorErrorProvider))}validateEmptyOrAlternatives(rules){return rules.flatMap(currTopRule=>validateEmptyOrAlternative(currTopRule,defaultGrammarValidatorErrorProvider))}validateAmbiguousAlternationAlternatives(rules,maxLookahead){return rules.flatMap(currTopRule=>validateAmbiguousAlternationAlternatives(currTopRule,maxLookahead,defaultGrammarValidatorErrorProvider))}validateSomeNonEmptyLookaheadPath(rules,maxLookahead){return function(topLevelRules,maxLookahead,errMsgProvider){const errors=[];return topLevelRules.forEach(currTopRule=>{const collectorVisitor2=new RepetitionCollector;currTopRule.accept(collectorVisitor2),collectorVisitor2.allProductions.forEach(currProd=>{const prodType=getProdType$1(currProd),actualMaxLookahead=currProd.maxLookahead||maxLookahead;if(0===getLookaheadPathsForOptionalProd(currProd.idx,currTopRule,prodType,actualMaxLookahead)[0].flat().length){const errMsg=errMsgProvider.buildEmptyRepetitionError({topLevelRule:currTopRule,repetition:currProd});errors.push({message:errMsg,type:ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:currTopRule.name})}})}),errors}(rules,maxLookahead,defaultGrammarValidatorErrorProvider)}buildLookaheadForAlternation(options){return function(occurrence,ruleGrammar,maxLookahead,hasPredicates,dynamicTokensEnabled,laFuncBuilder){const lookAheadPaths=getLookaheadPathsForOr(occurrence,ruleGrammar,maxLookahead);return laFuncBuilder(lookAheadPaths,hasPredicates,areTokenCategoriesNotUsed(lookAheadPaths)?tokenStructuredMatcherNoCategories:tokenStructuredMatcher,dynamicTokensEnabled)}(options.prodOccurrence,options.rule,options.maxLookahead,options.hasPredicates,options.dynamicTokensEnabled,buildAlternativesLookAheadFunc)}buildLookaheadForOptional(options){return function(occurrence,ruleGrammar,k,dynamicTokensEnabled,prodType,lookaheadBuilder){const lookAheadPaths=getLookaheadPathsForOptionalProd(occurrence,ruleGrammar,prodType,k),tokenMatcher2=areTokenCategoriesNotUsed(lookAheadPaths)?tokenStructuredMatcherNoCategories:tokenStructuredMatcher;return lookaheadBuilder(lookAheadPaths[0],tokenMatcher2,dynamicTokensEnabled)}(options.prodOccurrence,options.rule,options.maxLookahead,options.dynamicTokensEnabled,getProdType$1(options.prodType),buildSingleAlternativeLookaheadFunction)}}const collectorVisitor=new class extends GAstVisitor{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(option2){this.dslMethods.option.push(option2)}visitRepetitionWithSeparator(manySep){this.dslMethods.repetitionWithSeparator.push(manySep)}visitRepetitionMandatory(atLeastOne){this.dslMethods.repetitionMandatory.push(atLeastOne)}visitRepetitionMandatoryWithSeparator(atLeastOneSep){this.dslMethods.repetitionMandatoryWithSeparator.push(atLeastOneSep)}visitRepetition(many){this.dslMethods.repetition.push(many)}visitAlternation(or){this.dslMethods.alternation.push(or)}};function setNodeLocationOnlyOffset(currNodeLocation,newLocationInfo){!0===isNaN(currNodeLocation.startOffset)?(currNodeLocation.startOffset=newLocationInfo.startOffset,currNodeLocation.endOffset=newLocationInfo.endOffset):currNodeLocation.endOffset<newLocationInfo.endOffset==!0&&(currNodeLocation.endOffset=newLocationInfo.endOffset)}function setNodeLocationFull(currNodeLocation,newLocationInfo){!0===isNaN(currNodeLocation.startOffset)?(currNodeLocation.startOffset=newLocationInfo.startOffset,currNodeLocation.startColumn=newLocationInfo.startColumn,currNodeLocation.startLine=newLocationInfo.startLine,currNodeLocation.endOffset=newLocationInfo.endOffset,currNodeLocation.endColumn=newLocationInfo.endColumn,currNodeLocation.endLine=newLocationInfo.endLine):currNodeLocation.endOffset<newLocationInfo.endOffset==!0&&(currNodeLocation.endOffset=newLocationInfo.endOffset,currNodeLocation.endColumn=newLocationInfo.endColumn,currNodeLocation.endLine=newLocationInfo.endLine)}function defineNameProp(obj,nameValue){Object.defineProperty(obj,"name",{enumerable:!1,configurable:!0,writable:!1,value:nameValue})}function defaultVisit(ctx,param){const childrenNames=Object.keys(ctx),childrenNamesLength=childrenNames.length;for(let i=0;i<childrenNamesLength;i++){const currChildArray=ctx[childrenNames[i]],currChildArrayLength=currChildArray.length;for(let j=0;j<currChildArrayLength;j++){const currChild=currChildArray[j];void 0===currChild.tokenTypeIdx&&this[currChild.name](currChild.children,param)}}}function createBaseSemanticVisitorConstructor(grammarName,ruleNames){const derivedConstructor=function(){};defineNameProp(derivedConstructor,grammarName+"BaseSemantics");const semanticProto={visit:function(cstNode,param){if(Array.isArray(cstNode)&&(cstNode=cstNode[0]),void 0!==cstNode)return this[cstNode.name](cstNode.children,param)},validateVisitor:function(){const semanticDefinitionErrors=function(visitorInstance,ruleNames){const missingErrors=function(visitorInstance,ruleNames){const missingRuleNames=ruleNames.filter(currRuleName=>"function"==typeof visitorInstance[currRuleName]==!1),errors=missingRuleNames.map(currRuleName=>({msg:`Missing visitor method: <${currRuleName}> on ${visitorInstance.constructor.name} CST Visitor.`,type:CstVisitorDefinitionError.MISSING_METHOD,methodName:currRuleName}));return errors.filter(Boolean)}(visitorInstance,ruleNames);return missingErrors}(this,ruleNames);if(0!==semanticDefinitionErrors.length){const errorMessages=semanticDefinitionErrors.map(currDefError=>currDefError.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${errorMessages.join("\n\n").replace(/\n/g,"\n\t")}`)}}};return(derivedConstructor.prototype=semanticProto).constructor=derivedConstructor,derivedConstructor._RULE_NAMES=ruleNames,derivedConstructor}var CstVisitorDefinitionError,CstVisitorDefinitionError2;(CstVisitorDefinitionError2=CstVisitorDefinitionError||(CstVisitorDefinitionError={}))[CstVisitorDefinitionError2.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",CstVisitorDefinitionError2[CstVisitorDefinitionError2.MISSING_METHOD=1]="MISSING_METHOD";const RECORDING_NULL_OBJECT={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(RECORDING_NULL_OBJECT);const MAX_METHOD_IDX=Math.pow(2,8)-1,RFT=createToken({name:"RECORDING_PHASE_TOKEN",pattern:Lexer.NA});augmentTokenTypes([RFT]);const RECORDING_PHASE_TOKEN=createTokenInstance(RFT,"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(RECORDING_PHASE_TOKEN);const RECORDING_PHASE_CSTNODE={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 recordProd(prodConstructor,mainProdArg,occurrence,handleSep=!1){assertMethodIdxIsValid(occurrence);const prevProd=this.recordingProdStack.at(-1),grammarAction="function"==typeof mainProdArg?mainProdArg:mainProdArg.DEF,newProd=new prodConstructor({definition:[],idx:occurrence});return handleSep&&(newProd.separator=mainProdArg.SEP),Object.hasOwn(mainProdArg,"MAX_LOOKAHEAD")&&(newProd.maxLookahead=mainProdArg.MAX_LOOKAHEAD),this.recordingProdStack.push(newProd),grammarAction.call(this),prevProd.definition.push(newProd),this.recordingProdStack.pop(),RECORDING_NULL_OBJECT}function recordOrProd(mainProdArg,occurrence){assertMethodIdxIsValid(occurrence);const prevProd=this.recordingProdStack.at(-1),hasOptions=!1===Array.isArray(mainProdArg),alts=!1===hasOptions?mainProdArg:mainProdArg.DEF,newOrProd=new Alternation({definition:[],idx:occurrence,ignoreAmbiguities:hasOptions&&!0===mainProdArg.IGNORE_AMBIGUITIES});Object.hasOwn(mainProdArg,"MAX_LOOKAHEAD")&&(newOrProd.maxLookahead=mainProdArg.MAX_LOOKAHEAD);const hasPredicates=alts.some(currAlt=>"function"==typeof currAlt.GATE);return newOrProd.hasPredicates=hasPredicates,prevProd.definition.push(newOrProd),alts.forEach(currAlt=>{const currAltFlat=new Alternative({definition:[]});newOrProd.definition.push(currAltFlat),Object.hasOwn(currAlt,"IGNORE_AMBIGUITIES")?currAltFlat.ignoreAmbiguities=currAlt.IGNORE_AMBIGUITIES:Object.hasOwn(currAlt,"GATE")&&(currAltFlat.ignoreAmbiguities=!0),this.recordingProdStack.push(currAltFlat),currAlt.ALT.call(this),this.recordingProdStack.pop()}),RECORDING_NULL_OBJECT}function getIdxSuffix(idx){return 0===idx?"":`${idx}`}function assertMethodIdxIsValid(idx){if(idx<0||idx>MAX_METHOD_IDX){const error=new Error(`Invalid DSL Method idx value: <${idx}>\n\tIdx value must be a none negative value smaller than ${MAX_METHOD_IDX+1}`);throw error.KNOWN_RECORDER_ERROR=!0,error}}const END_OF_FILE=createTokenInstance(EOF,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(END_OF_FILE);const DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var ParserDefinitionErrorType,ParserDefinitionErrorType2,derivedCtor;function EMPTY_ALT(value=void 0){return function(){return value}}(ParserDefinitionErrorType2=ParserDefinitionErrorType||(ParserDefinitionErrorType={}))[ParserDefinitionErrorType2.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",ParserDefinitionErrorType2[ParserDefinitionErrorType2.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",ParserDefinitionErrorType2[ParserDefinitionErrorType2.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",ParserDefinitionErrorType2[ParserDefinitionErrorType2.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",ParserDefinitionErrorType2[ParserDefinitionErrorType2.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",ParserDefinitionErrorType2[ParserDefinitionErrorType2.LEFT_RECURSION=5]="LEFT_RECURSION",ParserDefinitionErrorType2[ParserDefinitionErrorType2.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",ParserDefinitionErrorType2[ParserDefinitionErrorType2.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",ParserDefinitionErrorType2[ParserDefinitionErrorType2.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",ParserDefinitionErrorType2[ParserDefinitionErrorType2.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",ParserDefinitionErrorType2[ParserDefinitionErrorType2.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",ParserDefinitionErrorType2[ParserDefinitionErrorType2.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",ParserDefinitionErrorType2[ParserDefinitionErrorType2.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",ParserDefinitionErrorType2[ParserDefinitionErrorType2.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION";class Parser{static performSelfAnalysis(parserInstance){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 defErrorsMsgs;this.selfAnalysisDone=!0;const className=this.className;this.TRACE_INIT("toFastProps",()=>{toFastProperties(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),this.definedRulesNames.forEach(currRuleName=>{const originalGrammarAction=this[currRuleName].originalGrammarAction;let recordedRuleGast;this.TRACE_INIT(`${currRuleName} Rule`,()=>{recordedRuleGast=this.topLevelRuleRecord(currRuleName,originalGrammarAction)}),this.gastProductionsCache[currRuleName]=recordedRuleGast})}finally{this.disableRecording()}});let resolverErrors=[];if(this.TRACE_INIT("Grammar Resolving",()=>{resolverErrors=resolveGrammar({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(resolverErrors)}),this.TRACE_INIT("Grammar Validations",()=>{if(0===resolverErrors.length&&!1===this.skipValidations){const validationErrors=function(options){var _a2;const errMsgProvider=null!==(_a2=options.errMsgProvider)&&void 0!==_a2?_a2:defaultGrammarValidatorErrorProvider;return validateGrammar$1(options.rules,options.tokenTypes,errMsgProvider,options.grammarName)}({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:defaultGrammarValidatorErrorProvider,grammarName:className}),lookaheadValidationErrors=(options={lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:className}).lookaheadStrategy.validate({rules:options.rules,tokenTypes:options.tokenTypes,grammarName:options.grammarName}).map(errorMessage=>Object.assign({type:ParserDefinitionErrorType.CUSTOM_LOOKAHEAD_VALIDATION},errorMessage));this.definitionErrors=this.definitionErrors.concat(validationErrors,lookaheadValidationErrors)}var options}),0===this.definitionErrors.length&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const allFollows=function(topProductions){const reSyncFollows={};return topProductions.forEach(topProd=>{const currRefsFollow=new ResyncFollowsWalker(topProd).startWalking();Object.assign(reSyncFollows,currRefsFollow)}),reSyncFollows}(Object.values(this.gastProductionsCache));this.resyncFollows=allFollows}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var _a2,_b2;null===(_b2=(_a2=this.lookaheadStrategy).initialize)||void 0===_b2||_b2.call(_a2,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!Parser.DEFER_DEFINITION_ERRORS_HANDLING&&0!==this.definitionErrors.length)throw defErrorsMsgs=this.definitionErrors.map(defError=>defError.message),new Error(`Parser Definition Errors detected:\n ${defErrorsMsgs.join("\n-------------------------------\n")}`)})}constructor(tokenVocabulary,config){this.definitionErrors=[],this.selfAnalysisDone=!1;if(this.initErrorHandler(config),this.initLexerAdapter(),this.initLooksAhead(config),this.initRecognizerEngine(tokenVocabulary,config),this.initRecoverable(config),this.initTreeBuilder(config),this.initGastRecorder(config),this.initPerformanceTracer(config),Object.hasOwn(config,"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=Object.hasOwn(config,"skipValidations")?config.skipValidations:DEFAULT_PARSER_CONFIG.skipValidations}}Parser.DEFER_DEFINITION_ERRORS_HANDLING=!1,derivedCtor=Parser,[class{initRecoverable(config){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(config,"recoveryEnabled")?config.recoveryEnabled:DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=attemptInRepetitionRecovery)}getTokenToInsert(tokType){const tokToInsert=createTokenInstance(tokType,"",NaN,NaN,NaN,NaN,NaN,NaN);return tokToInsert.isInsertedInRecovery=!0,tokToInsert}canTokenTypeBeInsertedInRecovery(tokType){return!0}canTokenTypeBeDeletedInRecovery(tokType){return!0}tryInRepetitionRecovery(grammarRule,grammarRuleArgs,lookAheadFunc,expectedTokType){const reSyncTokType=this.findReSyncTokenType(),savedLexerState=this.exportLexerState(),resyncedTokens=[];let passedResyncPoint=!1;const nextTokenWithoutResync=this.LA_FAST(1);let currToken=this.LA_FAST(1);const generateErrorMessage=()=>{const previousToken=this.LA(0),msg=this.errorMessageProvider.buildMismatchTokenMessage({expected:expectedTokType,actual:nextTokenWithoutResync,previous:previousToken,ruleName:this.getCurrRuleFullName()}),error=new MismatchedTokenException(msg,nextTokenWithoutResync,this.LA(0));error.resyncedTokens=resyncedTokens.slice(0,-1),this.SAVE_ERROR(error)};for(;!passedResyncPoint;){if(this.tokenMatcher(currToken,expectedTokType))return void generateErrorMessage();if(lookAheadFunc.call(this))return generateErrorMessage(),void grammarRule.apply(this,grammarRuleArgs);this.tokenMatcher(currToken,reSyncTokType)?passedResyncPoint=!0:(currToken=this.SKIP_TOKEN(),this.addToResyncTokens(currToken,resyncedTokens))}this.importLexerState(savedLexerState)}shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch,nextTokIdx,notStuck){return!1!==notStuck&&!this.tokenMatcher(this.LA_FAST(1),expectTokAfterLastMatch)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(expectTokAfterLastMatch,this.getFollowsForInRuleRecovery(expectTokAfterLastMatch,nextTokIdx))}getNextPossibleTokenTypes(grammarPath){const topRuleName=grammarPath.ruleStack[0],topProduction=this.getGAstProductions()[topRuleName];return new NextAfterTokenWalker(topProduction,grammarPath).startWalking()}getFollowsForInRuleRecovery(tokType,tokIdxInRule){const grammarPath=this.getCurrentGrammarPath(tokType,tokIdxInRule);return this.getNextPossibleTokenTypes(grammarPath)}tryInRuleRecovery(expectedTokType,follows){if(this.canRecoverWithSingleTokenInsertion(expectedTokType,follows))return this.getTokenToInsert(expectedTokType);if(this.canRecoverWithSingleTokenDeletion(expectedTokType)){const nextTok=this.SKIP_TOKEN();return this.consumeToken(),nextTok}throw new InRuleRecoveryException("sad sad panda")}canPerformInRuleRecovery(expectedToken,follows){return this.canRecoverWithSingleTokenInsertion(expectedToken,follows)||this.canRecoverWithSingleTokenDeletion(expectedToken)}canRecoverWithSingleTokenInsertion(expectedTokType,follows){if(!this.canTokenTypeBeInsertedInRecovery(expectedTokType))return!1;if(0===follows.length)return!1;const mismatchedTok=this.LA_FAST(1);return void 0!==follows.find(possibleFollowsTokType=>this.tokenMatcher(mismatchedTok,possibleFollowsTokType))}canRecoverWithSingleTokenDeletion(expectedTokType){return!!this.canTokenTypeBeDeletedInRecovery(expectedTokType)&&this.tokenMatcher(this.LA(2),expectedTokType)}isInCurrentRuleReSyncSet(tokenTypeIdx){const followKey=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(followKey).includes(tokenTypeIdx)}findReSyncTokenType(){const allPossibleReSyncTokTypes=this.flattenFollowSet();let nextToken=this.LA_FAST(1),k=2;for(;;){const foundMatch=allPossibleReSyncTokTypes.find(resyncTokType=>tokenMatcher(nextToken,resyncTokType));if(void 0!==foundMatch)return foundMatch;nextToken=this.LA(k),k++}}getCurrFollowKey(){if(0===this.RULE_STACK_IDX)return EOF_FOLLOW_KEY;const currRuleShortName=this.currRuleShortName,currRuleIdx=this.getLastExplicitRuleOccurrenceIndex(),prevRuleShortName=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(currRuleShortName),idxInCallingRule:currRuleIdx,inRule:this.shortRuleNameToFullName(prevRuleShortName)}}buildFullFollowKeyStack(){const explicitRuleStack=this.RULE_STACK,explicitOccurrenceStack=this.RULE_OCCURRENCE_STACK,len=this.RULE_STACK_IDX+1,result=new Array(len);for(let idx=0;idx<len;idx++)result[idx]=0===idx?EOF_FOLLOW_KEY:{ruleName:this.shortRuleNameToFullName(explicitRuleStack[idx]),idxInCallingRule:explicitOccurrenceStack[idx],inRule:this.shortRuleNameToFullName(explicitRuleStack[idx-1])};return result}flattenFollowSet(){return this.buildFullFollowKeyStack().map(currKey=>this.getFollowSetFromFollowKey(currKey)).flat()}getFollowSetFromFollowKey(followKey){if(followKey===EOF_FOLLOW_KEY)return[EOF];const followName=followKey.ruleName+followKey.idxInCallingRule+IN+followKey.inRule;return this.resyncFollows[followName]}addToResyncTokens(token,resyncTokens){return this.tokenMatcher(token,EOF)||resyncTokens.push(token),resyncTokens}reSyncTo(tokType){const resyncedTokens=[];let nextTok=this.LA_FAST(1);for(;!1===this.tokenMatcher(nextTok,tokType);)nextTok=this.SKIP_TOKEN(),this.addToResyncTokens(nextTok,resyncedTokens);return resyncedTokens.slice(0,-1)}attemptInRepetitionRecovery(prodFunc,args,lookaheadFunc,dslMethodIdx,prodOccurrence,nextToksWalker,notStuck){}getCurrentGrammarPath(tokType,tokIdxInRule){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1),lastTok:tokType,lastTokOccurrence:tokIdxInRule}}getHumanReadableRuleStack(){const len=this.RULE_STACK_IDX+1,result=new Array(len);for(let i=0;i<len;i++)result[i]=this.shortRuleNameToFullName(this.RULE_STACK[i]);return result}},class{initLooksAhead(config){this.dynamicTokensEnabled=Object.hasOwn(config,"dynamicTokensEnabled")?config.dynamicTokensEnabled:DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(config,"maxLookahead")?config.maxLookahead:DEFAULT_PARSER_CONFIG.maxLookahead,this.lookaheadStrategy=Object.hasOwn(config,"lookaheadStrategy")?config.lookaheadStrategy:new LLkLookaheadStrategy({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(rules){rules.forEach(currRule=>{this.TRACE_INIT(`${currRule.name} Rule Lookahead`,()=>{const{alternation:alternation2,repetition:repetition2,option:option2,repetitionMandatory:repetitionMandatory2,repetitionMandatoryWithSeparator:repetitionMandatoryWithSeparator,repetitionWithSeparator:repetitionWithSeparator}=function(rule){collectorVisitor.reset(),rule.accept(collectorVisitor);const dslMethods=collectorVisitor.dslMethods;return collectorVisitor.reset(),dslMethods}(currRule);alternation2.forEach(currProd=>{const prodIdx=0===currProd.idx?"":currProd.idx;this.TRACE_INIT(`${getProductionDslName$1(currProd)}${prodIdx}`,()=>{const laFunc=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:currProd.idx,rule:currRule,maxLookahead:currProd.maxLookahead||this.maxLookahead,hasPredicates:currProd.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),key=getKeyForAutomaticLookahead(this.fullRuleNameToShort[currRule.name],256,currProd.idx);this.setLaFuncCache(key,laFunc)})}),repetition2.forEach(currProd=>{this.computeLookaheadFunc(currRule,currProd.idx,768,"Repetition",currProd.maxLookahead,getProductionDslName$1(currProd))}),option2.forEach(currProd=>{this.computeLookaheadFunc(currRule,currProd.idx,512,"Option",currProd.maxLookahead,getProductionDslName$1(currProd))}),repetitionMandatory2.forEach(currProd=>{this.computeLookaheadFunc(currRule,currProd.idx,1024,"RepetitionMandatory",currProd.maxLookahead,getProductionDslName$1(currProd))}),repetitionMandatoryWithSeparator.forEach(currProd=>{this.computeLookaheadFunc(currRule,currProd.idx,1536,"RepetitionMandatoryWithSeparator",currProd.maxLookahead,getProductionDslName$1(currProd))}),repetitionWithSeparator.forEach(currProd=>{this.computeLookaheadFunc(currRule,currProd.idx,1280,"RepetitionWithSeparator",currProd.maxLookahead,getProductionDslName$1(currProd))})})})}computeLookaheadFunc(rule,prodOccurrence,prodKey,prodType,prodMaxLookahead,dslMethodName){this.TRACE_INIT(`${dslMethodName}${0===prodOccurrence?"":prodOccurrence}`,()=>{const laFunc=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:prodOccurrence,rule:rule,maxLookahead:prodMaxLookahead||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:prodType}),key=getKeyForAutomaticLookahead(this.fullRuleNameToShort[rule.name],prodKey,prodOccurrence);this.setLaFuncCache(key,laFunc)})}getKeyForAutomaticLookahead(dslMethodIdx,occurrence){return getKeyForAutomaticLookahead(this.currRuleShortName,dslMethodIdx,occurrence)}getLaFuncFromCache(key){return this.lookAheadFuncsCache.get(key)}setLaFuncCache(key,value){this.lookAheadFuncsCache.set(key,value)}},class{initTreeBuilder(config){if(this.CST_STACK=[],this.outputCst=config.outputCst,this.nodeLocationTracking=Object.hasOwn(config,"nodeLocationTracking")?config.nodeLocationTracking:DEFAULT_PARSER_CONFIG.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=setNodeLocationFull,this.setNodeLocationFromNode=setNodeLocationFull,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=setNodeLocationOnlyOffset,this.setNodeLocationFromNode=setNodeLocationOnlyOffset,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error(`Invalid <nodeLocationTracking> config option: "${config.nodeLocationTracking}"`);this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{}}else this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{}}setInitialNodeLocationOnlyOffsetRecovery(cstNode){cstNode.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(cstNode){cstNode.location={startOffset:this.LA_FAST(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(cstNode){cstNode.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(cstNode){const nextToken=this.LA_FAST(1);cstNode.location={startOffset:nextToken.startOffset,startLine:nextToken.startLine,startColumn:nextToken.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(fullRuleName){const cstNode={name:fullRuleName,children:Object.create(null)};this.setInitialNodeLocation(cstNode),this.CST_STACK.push(cstNode)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(ruleCstNode){const prevToken=this.LA(0),loc=ruleCstNode.location;loc.startOffset<=prevToken.startOffset==1?(loc.endOffset=prevToken.endOffset,loc.endLine=prevToken.endLine,loc.endColumn=prevToken.endColumn):(loc.startOffset=NaN,loc.startLine=NaN,loc.startColumn=NaN)}cstPostRuleOnlyOffset(ruleCstNode){const prevToken=this.LA(0),loc=ruleCstNode.location;loc.startOffset<=prevToken.startOffset==1?loc.endOffset=prevToken.endOffset:loc.startOffset=NaN}cstPostTerminal(key,consumedToken){const rootCst=this.CST_STACK[this.CST_STACK.length-1];var node,token,tokenTypeName;token=consumedToken,tokenTypeName=key,void 0===(node=rootCst).children[tokenTypeName]?node.children[tokenTypeName]=[token]:node.children[tokenTypeName].push(token),this.setNodeLocationFromToken(rootCst.location,consumedToken)}cstPostNonTerminal(ruleCstResult,ruleName){const preCstNode=this.CST_STACK[this.CST_STACK.length-1];!function(node,ruleName,ruleResult){void 0===node.children[ruleName]?node.children[ruleName]=[ruleResult]:node.children[ruleName].push(ruleResult)}(preCstNode,ruleName,ruleCstResult),this.setNodeLocationFromNode(preCstNode.location,ruleCstResult.location)}getBaseCstVisitorConstructor(){if(void 0===this.baseCstVisitorConstructor){const newBaseCstVisitorConstructor=createBaseSemanticVisitorConstructor(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=newBaseCstVisitorConstructor,newBaseCstVisitorConstructor}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(void 0===this.baseCstVisitorWithDefaultsConstructor){const newConstructor=function(grammarName,ruleNames,baseConstructor){const derivedConstructor=function(){};defineNameProp(derivedConstructor,grammarName+"BaseSemanticsWithDefaults");const withDefaultsProto=Object.create(baseConstructor.prototype);return ruleNames.forEach(ruleName=>{withDefaultsProto[ruleName]=defaultVisit}),(derivedConstructor.prototype=withDefaultsProto).constructor=derivedConstructor,derivedConstructor}(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=newConstructor,newConstructor}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}},class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(newInput){if(!0!==this.selfAnalysisDone)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=newInput,this.tokVectorLength=newInput.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):END_OF_FILE}LA_FAST(howMuch){const soughtIdx=this.currIdx+howMuch;return this.tokVector[soughtIdx]}LA(howMuch){const soughtIdx=this.currIdx+howMuch;return soughtIdx<0||this.tokVectorLength<=soughtIdx?END_OF_FILE:this.tokVector[soughtIdx]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(newState2){this.currIdx=newState2}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}},class{initRecognizerEngine(tokenVocabulary,config){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=tokenStructuredMatcherNoCategories,this.subruleIdx=0,this.currRuleShortName=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(config,"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(Array.isArray(tokenVocabulary)){if(0===tokenVocabulary.length)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 tokenVocabulary[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(Array.isArray(tokenVocabulary))this.tokensMap=tokenVocabulary.reduce((acc,tokType)=>(acc[tokType.name]=tokType,acc),{});else if(Object.hasOwn(tokenVocabulary,"modes")&&Object.values(tokenVocabulary.modes).flat().every(isTokenType)){const allTokenTypes2=Object.values(tokenVocabulary.modes).flat(),uniqueTokens=[...new Set(allTokenTypes2)];this.tokensMap=uniqueTokens.reduce((acc,tokType)=>(acc[tokType.name]=tokType,acc),{})}else{if("object"!=typeof tokenVocabulary||null===tokenVocabulary)throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=Object.assign({},tokenVocabulary)}this.tokensMap.EOF=EOF;const noTokenCategoriesUsed=(Object.hasOwn(tokenVocabulary,"modes")?Object.values(tokenVocabulary.modes).flat():Object.values(tokenVocabulary)).every(tokenConstructor=>{var _a2;return 0==(null===(_a2=tokenConstructor.categoryMatches)||void 0===_a2?void 0:_a2.length)});this.tokenMatcher=noTokenCategoriesUsed?tokenStructuredMatcherNoCategories:tokenStructuredMatcher,augmentTokenTypes(Object.values(this.tokensMap))}defineRule(ruleName,impl,config){if(this.selfAnalysisDone)throw Error(`Grammar rule <${ruleName}> 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 resyncEnabled=Object.hasOwn(config,"resyncEnabled")?config.resyncEnabled:DEFAULT_RULE_CONFIG.resyncEnabled,recoveryValueFunc=Object.hasOwn(config,"recoveryValueFunc")?config.recoveryValueFunc:DEFAULT_RULE_CONFIG.recoveryValueFunc,shortName=this.ruleShortNameIdx<<12;let coreRuleFunction;return this.ruleShortNameIdx++,this.shortRuleNameToFull[shortName]=ruleName,this.fullRuleNameToShort[ruleName]=shortName,coreRuleFunction=!0===this.outputCst?function(...args){try{this.ruleInvocationStateUpdate(shortName,ruleName,this.subruleIdx),impl.apply(this,args);const cst=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(cst),cst}catch(e){return this.invokeRuleCatch(e,resyncEnabled,recoveryValueFunc)}finally{this.ruleFinallyStateUpdate()}}:function(...args){try{return this.ruleInvocationStateUpdate(shortName,ruleName,this.subruleIdx),impl.apply(this,args)}catch(e){return this.invokeRuleCatch(e,resyncEnabled,recoveryValueFunc)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...args){this.onBeforeParse(ruleName);try{return coreRuleFunction.apply(this,args)}finally{this.onAfterParse(ruleName)}},{ruleName:ruleName,originalGrammarAction:impl,coreRule:coreRuleFunction})}invokeRuleCatch(e,resyncEnabledConfig,recoveryValueFunc){const isFirstInvokedRule=0===this.RULE_STACK_IDX,reSyncEnabled=resyncEnabledConfig&&!this.isBackTracking()&&this.recoveryEnabled;if(isRecognitionException(e)){const recogError=e;if(reSyncEnabled){const reSyncTokType=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(reSyncTokType)){if(recogError.resyncedTokens=this.reSyncTo(reSyncTokType),this.outputCst){const partialCstResult=this.CST_STACK[this.CST_STACK.length-1];return partialCstResult.recoveredNode=!0,partialCstResult}return recoveryValueFunc(e)}if(this.outputCst){const partialCstResult=this.CST_STACK[this.CST_STACK.length-1];partialCstResult.recoveredNode=!0,recogError.partialCstResult=partialCstResult}throw recogError}if(isFirstInvokedRule)return this.moveToTerminatedState(),recoveryValueFunc(e);throw recogError}throw e}optionInternal(actionORMethodDef,occurrence){const key=this.getKeyForAutomaticLookahead(512,occurrence);return this.optionInternalLogic(actionORMethodDef,occurrence,key)}optionInternalLogic(actionORMethodDef,occurrence,key){let action,lookAheadFunc=this.getLaFuncFromCache(key);if("function"!=typeof actionORMethodDef){action=actionORMethodDef.DEF;const predicate=actionORMethodDef.GATE;if(void 0!==predicate){const orgLookaheadFunction=lookAheadFunc;lookAheadFunc=()=>predicate.call(this)&&orgLookaheadFunction.call(this)}}else action=actionORMethodDef;if(!0===lookAheadFunc.call(this))return action.call(this)}atLeastOneInternal(prodOccurrence,actionORMethodDef){const laKey=this.getKeyForAutomaticLookahead(1024,prodOccurrence);return this.atLeastOneInternalLogic(prodOccurrence,actionORMethodDef,laKey)}atLeastOneInternalLogic(prodOccurrence,actionORMethodDef,key){let action,lookAheadFunc=this.getLaFuncFromCache(key);if("function"!=typeof actionORMethodDef){action=actionORMethodDef.DEF;const predicate=actionORMethodDef.GATE;if(void 0!==predicate){const orgLookaheadFunction=lookAheadFunc;lookAheadFunc=()=>predicate.call(this)&&orgLookaheadFunction.call(this)}}else action=actionORMethodDef;if(!0!==lookAheadFunc.call(this))throw this.raiseEarlyExitException(prodOccurrence,PROD_TYPE.REPETITION_MANDATORY,actionORMethodDef.ERR_MSG);{let notStuck=this.doSingleRepetition(action);for(;!0===lookAheadFunc.call(this)&&!0===notStuck;)notStuck=this.doSingleRepetition(action)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[prodOccurrence,actionORMethodDef],lookAheadFunc,1024,prodOccurrence,NextTerminalAfterAtLeastOneWalker)}atLeastOneSepFirstInternal(prodOccurrence,options){const laKey=this.getKeyForAutomaticLookahead(1536,prodOccurrence);this.atLeastOneSepFirstInternalLogic(prodOccurrence,options,laKey)}atLeastOneSepFirstInternalLogic(prodOccurrence,options,key){const action=options.DEF,separator=options.SEP;if(!0!==this.getLaFuncFromCache(key).call(this))throw this.raiseEarlyExitException(prodOccurrence,PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,options.ERR_MSG);{action.call(this);const separatorLookAheadFunc=()=>this.tokenMatcher(this.LA_FAST(1),separator);for(;!0===this.tokenMatcher(this.LA_FAST(1),separator);)this.CONSUME(separator),action.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[prodOccurrence,separator,separatorLookAheadFunc,action,NextTerminalAfterAtLeastOneSepWalker],separatorLookAheadFunc,1536,prodOccurrence,NextTerminalAfterAtLeastOneSepWalker)}}manyInternal(prodOccurrence,actionORMethodDef){const laKey=this.getKeyForAutomaticLookahead(768,prodOccurrence);return this.manyInternalLogic(prodOccurrence,actionORMethodDef,laKey)}manyInternalLogic(prodOccurrence,actionORMethodDef,key){let action,lookaheadFunction=this.getLaFuncFromCache(key);if("function"!=typeof actionORMethodDef){action=actionORMethodDef.DEF;const predicate=actionORMethodDef.GATE;if(void 0!==predicate){const orgLookaheadFunction=lookaheadFunction;lookaheadFunction=()=>predicate.call(this)&&orgLookaheadFunction.call(this)}}else action=actionORMethodDef;let notStuck=!0;for(;!0===lookaheadFunction.call(this)&&!0===notStuck;)notStuck=this.doSingleRepetition(action);this.attemptInRepetitionRecovery(this.manyInternal,[prodOccurrence,actionORMethodDef],lookaheadFunction,768,prodOccurrence,NextTerminalAfterManyWalker,notStuck)}manySepFirstInternal(prodOccurrence,options){const laKey=this.getKeyForAutomaticLookahead(1280,prodOccurrence);this.manySepFirstInternalLogic(prodOccurrence,options,laKey)}manySepFirstInternalLogic(prodOccurrence,options,key){const action=options.DEF,separator=options.SEP;if(!0===this.getLaFuncFromCache(key).call(this)){action.call(this);const separatorLookAheadFunc=()=>this.tokenMatcher(this.LA_FAST(1),separator);for(;!0===this.tokenMatcher(this.LA_FAST(1),separator);)this.CONSUME(separator),action.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[prodOccurrence,separator,separatorLookAheadFunc,action,NextTerminalAfterManySepWalker],separatorLookAheadFunc,1280,prodOccurrence,NextTerminalAfterManySepWalker)}}repetitionSepSecondInternal(prodOccurrence,separator,separatorLookAheadFunc,action,nextTerminalAfterWalker){for(;separatorLookAheadFunc();)this.CONSUME(separator),action.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[prodOccurrence,separator,separatorLookAheadFunc,action,nextTerminalAfterWalker],separatorLookAheadFunc,1536,prodOccurrence,nextTerminalAfterWalker)}doSingleRepetition(action){const beforeIteration=this.getLexerPosition();return action.call(this),this.getLexerPosition()>beforeIteration}orInternal(altsOrOpts,occurrence){const laKey=this.getKeyForAutomaticLookahead(256,occurrence),alts=Array.isArray(altsOrOpts)?altsOrOpts:altsOrOpts.DEF,altIdxToTake=this.getLaFuncFromCache(laKey).call(this,alts);if(void 0!==altIdxToTake)return alts[altIdxToTake].ALT.call(this);this.raiseNoAltException(occurrence,altsOrOpts.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX]),this.cstFinallyStateUpdate()}subruleInternal(ruleToCall,idx,options){let ruleResult;try{const args=void 0!==options?options.ARGS:void 0;return this.subruleIdx=idx,ruleResult=ruleToCall.coreRule.apply(this,args),this.cstPostNonTerminal(ruleResult,void 0!==options&&void 0!==options.LABEL?options.LABEL:ruleToCall.ruleName),ruleResult}catch(e){throw this.subruleInternalError(e,options,ruleToCall.ruleName)}}subruleInternalError(e,options,ruleName){throw isRecognitionException(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==options&&void 0!==options.LABEL?options.LABEL:ruleName),delete e.partialCstResult),e}consumeInternal(tokType,idx,options){let consumedToken;try{const nextToken=this.LA_FAST(1);!0===this.tokenMatcher(nextToken,tokType)?(this.consumeToken(),consumedToken=nextToken):this.consumeInternalError(tokType,nextToken,options)}catch(eFromConsumption){consumedToken=this.consumeInternalRecovery(tokType,idx,eFromConsumption)}return this.cstPostTerminal(void 0!==options&&void 0!==options.LABEL?options.LABEL:tokType.name,consumedToken),consumedToken}consumeInternalError(tokType,nextToken,options){let msg;const previousToken=this.LA(0);throw msg=void 0!==options&&options.ERR_MSG?options.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:tokType,actual:nextToken,previous:previousToken,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new MismatchedTokenException(msg,nextToken,previousToken))}consumeInternalRecovery(tokType,idx,eFromConsumption){if(!this.recoveryEnabled||"MismatchedTokenException"!==eFromConsumption.name||this.isBackTracking())throw eFromConsumption;{const follows=this.getFollowsForInRuleRecovery(tokType,idx);try{return this.tryInRuleRecovery(tokType,follows)}catch(eFromInRuleRecovery){throw"InRuleRecoveryException"===eFromInRuleRecovery.name?eFromConsumption:eFromInRuleRecovery}}}saveRecogState(){const savedErrors=this.errors,savedRuleStack=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:savedErrors,lexerState:this.exportLexerState(),RULE_STACK:savedRuleStack,CST_STACK:this.CST_STACK}}reloadRecogState(newState2){this.errors=newState2.errors,this.importLexerState(newState2.lexerState);const saved=newState2.RULE_STACK;for(let i=0;i<saved.length;i++)this.RULE_STACK[i]=saved[i];this.RULE_STACK_IDX=saved.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX])}ruleInvocationStateUpdate(shortName,fullName,idxInCallingRule){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=idxInCallingRule,this.RULE_STACK[++this.RULE_STACK_IDX]=shortName,this.currRuleShortName=shortName,this.cstInvocationStateUpdate(fullName)}isBackTracking(){return 0!==this.isBackTrackingStack.length}getCurrRuleFullName(){const shortName=this.currRuleShortName;return this.shortRuleNameToFull[shortName]}shortRuleNameToFullName(shortName){return this.shortRuleNameToFull[shortName]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),EOF)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(ruleName){for(let i=0;i<this.maxLookahead+1;i++)this.tokVector.push(END_OF_FILE)}onAfterParse(ruleName){if(!1===this.isAtEndOfInput()){const firstRedundantTok=this.LA(1),errMsg=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:firstRedundantTok,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new NotAllInputParsedException(errMsg,firstRedundantTok))}for(;this.tokVector.at(-1)===END_OF_FILE;)this.tokVector.pop()}},class{ACTION(impl){return impl.call(this)}consume(idx,tokType,options){return this.consumeInternal(tokType,idx,options)}subrule(idx,ruleToCall,options){return this.subruleInternal(ruleToCall,idx,options)}option(idx,actionORMethodDef){return this.optionInternal(actionORMethodDef,idx)}or(idx,altsOrOpts){return this.orInternal(altsOrOpts,idx)}many(idx,actionORMethodDef){return this.manyInternal(idx,actionORMethodDef)}atLeastOne(idx,actionORMethodDef){return this.atLeastOneInternal(idx,actionORMethodDef)}CONSUME(tokType,options){return this.consumeInternal(tokType,0,options)}CONSUME1(tokType,options){return this.consumeInternal(tokType,1,options)}CONSUME2(tokType,options){return this.consumeInternal(tokType,2,options)}CONSUME3(tokType,options){return this.consumeInternal(tokType,3,options)}CONSUME4(tokType,options){return this.consumeInternal(tokType,4,options)}CONSUME5(tokType,options){return this.consumeInternal(tokType,5,options)}CONSUME6(tokType,options){return this.consumeInternal(tokType,6,options)}CONSUME7(tokType,options){return this.consumeInternal(tokType,7,options)}CONSUME8(tokType,options){return this.consumeInternal(tokType,8,options)}CONSUME9(tokType,options){return this.consumeInternal(tokType,9,options)}SUBRULE(ruleToCall,options){return this.subruleInternal(ruleToCall,0,options)}SUBRULE1(ruleToCall,options){return this.subruleInternal(ruleToCall,1,options)}SUBRULE2(ruleToCall,options){return this.subruleInternal(ruleToCall,2,options)}SUBRULE3(ruleToCall,options){return this.subruleInternal(ruleToCall,3,options)}SUBRULE4(ruleToCall,options){return this.subruleInternal(ruleToCall,4,options)}SUBRULE5(ruleToCall,options){return this.subruleInternal(ruleToCall,5,options)}SUBRULE6(ruleToCall,options){return this.subruleInternal(ruleToCall,6,options)}SUBRULE7(ruleToCall,options){return this.subruleInternal(ruleToCall,7,options)}SUBRULE8(ruleToCall,options){return this.subruleInternal(ruleToCall,8,options)}SUBRULE9(ruleToCall,options){return this.subruleInternal(ruleToCall,9,options)}OPTION(actionORMethodDef){return this.optionInternal(actionORMethodDef,0)}OPTION1(actionORMethodDef){return this.optionInternal(actionORMethodDef,1)}OPTION2(actionORMethodDef){return this.optionInternal(actionORMethodDef,2)}OPTION3(actionORMethodDef){return this.optionInternal(actionORMethodDef,3)}OPTION4(actionORMethodDef){return this.optionInternal(actionORMethodDef,4)}OPTION5(actionORMethodDef){return this.optionInternal(actionORMethodDef,5)}OPTION6(actionORMethodDef){return this.optionInternal(actionORMethodDef,6)}OPTION7(actionORMethodDef){return this.optionInternal(actionORMethodDef,7)}OPTION8(actionORMethodDef){return this.optionInternal(actionORMethodDef,8)}OPTION9(actionORMethodDef){return this.optionInternal(actionORMethodDef,9)}OR(altsOrOpts){return this.orInternal(altsOrOpts,0)}OR1(altsOrOpts){return this.orInternal(altsOrOpts,1)}OR2(altsOrOpts){return this.orInternal(altsOrOpts,2)}OR3(altsOrOpts){return this.orInternal(altsOrOpts,3)}OR4(altsOrOpts){return this.orInternal(altsOrOpts,4)}OR5(altsOrOpts){return this.orInternal(altsOrOpts,5)}OR6(altsOrOpts){return this.orInternal(altsOrOpts,6)}OR7(altsOrOpts){return this.orInternal(altsOrOpts,7)}OR8(altsOrOpts){return this.orInternal(altsOrOpts,8)}OR9(altsOrOpts){return this.orInternal(altsOrOpts,9)}MANY(actionORMethodDef){this.manyInternal(0,actionORMethodDef)}MANY1(actionORMethodDef){this.manyInternal(1,actionORMethodDef)}MANY2(actionORMethodDef){this.manyInternal(2,actionORMethodDef)}MANY3(actionORMethodDef){this.manyInternal(3,actionORMethodDef)}MANY4(actionORMethodDef){this.manyInternal(4,actionORMethodDef)}MANY5(actionORMethodDef){this.manyInternal(5,actionORMethodDef)}MANY6(actionORMethodDef){this.manyInternal(6,actionORMethodDef)}MANY7(actionORMethodDef){this.manyInternal(7,actionORMethodDef)}MANY8(actionORMethodDef){this.manyInternal(8,actionORMethodDef)}MANY9(actionORMethodDef){this.manyInternal(9,actionORMethodDef)}MANY_SEP(options){this.manySepFirstInternal(0,options)}MANY_SEP1(options){this.manySepFirstInternal(1,options)}MANY_SEP2(options){this.manySepFirstInternal(2,options)}MANY_SEP3(options){this.manySepFirstInternal(3,options)}MANY_SEP4(options){this.manySepFirstInternal(4,options)}MANY_SEP5(options){this.manySepFirstInternal(5,options)}MANY_SEP6(options){this.manySepFirstInternal(6,options)}MANY_SEP7(options){this.manySepFirstInternal(7,options)}MANY_SEP8(options){this.manySepFirstInternal(8,options)}MANY_SEP9(options){this.manySepFirstInternal(9,options)}AT_LEAST_ONE(actionORMethodDef){this.atLeastOneInternal(0,actionORMethodDef)}AT_LEAST_ONE1(actionORMethodDef){return this.atLeastOneInternal(1,actionORMethodDef)}AT_LEAST_ONE2(actionORMethodDef){this.atLeastOneInternal(2,actionORMethodDef)}AT_LEAST_ONE3(actionORMethodDef){this.atLeastOneInternal(3,actionORMethodDef)}AT_LEAST_ONE4(actionORMethodDef){this.atLeastOneInternal(4,actionORMethodDef)}AT_LEAST_ONE5(actionORMethodDef){this.atLeastOneInternal(5,actionORMethodDef)}AT_LEAST_ONE6(actionORMethodDef){this.atLeastOneInternal(6,actionORMethodDef)}AT_LEAST_ONE7(actionORMethodDef){this.atLeastOneInternal(7,actionORMethodDef)}AT_LEAST_ONE8(actionORMethodDef){this.atLeastOneInternal(8,actionORMethodDef)}AT_LEAST_ONE9(actionORMethodDef){this.atLeastOneInternal(9,actionORMethodDef)}AT_LEAST_ONE_SEP(options){this.atLeastOneSepFirstInternal(0,options)}AT_LEAST_ONE_SEP1(options){this.atLeastOneSepFirstInternal(1,options)}AT_LEAST_ONE_SEP2(options){this.atLeastOneSepFirstInternal(2,options)}AT_LEAST_ONE_SEP3(options){this.atLeastOneSepFirstInternal(3,options)}AT_LEAST_ONE_SEP4(options){this.atLeastOneSepFirstInternal(4,options)}AT_LEAST_ONE_SEP5(options){this.atLeastOneSepFirstInternal(5,options)}AT_LEAST_ONE_SEP6(options){this.atLeastOneSepFirstInternal(6,options)}AT_LEAST_ONE_SEP7(options){this.atLeastOneSepFirstInternal(7,options)}AT_LEAST_ONE_SEP8(options){this.atLeastOneSepFirstInternal(8,options)}AT_LEAST_ONE_SEP9(options){this.atLeastOneSepFirstInternal(9,options)}RULE(name,implementation,config=DEFAULT_RULE_CONFIG){if(this.definedRulesNames.includes(name)){const error={message:defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:name,grammarName:this.className}),type:ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:name};this.definitionErrors.push(error)}this.definedRulesNames.push(name);const ruleImplementation=this.defineRule(name,implementation,config);return this[name]=ruleImplementation,ruleImplementation}OVERRIDE_RULE(name,impl,config=DEFAULT_RULE_CONFIG){const ruleErrors=function(ruleName,definedRulesNames,className){const errors=[];let errMsg;return definedRulesNames.includes(ruleName)||(errMsg=`Invalid rule override, rule: ->${ruleName}<- cannot be overridden in the grammar: ->${className}<-as it is not defined in any of the super grammars `,errors.push({message:errMsg,type:ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:ruleName})),errors}(name,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(ruleErrors);const ruleImplementation=this.defineRule(name,impl,config);return this[name]=ruleImplementation,ruleImplementation}BACKTRACK(grammarRule,args){var _a2;const ruleToCall=null!==(_a2=grammarRule.coreRule)&&void 0!==_a2?_a2:grammarRule;return function(){this.isBackTrackingStack.push(1);const orgState=this.saveRecogState();try{return ruleToCall.apply(this,args),!0}catch(e){if(isRecognitionException(e))return!1;throw e}finally{this.reloadRecogState(orgState),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Object.values(this.gastProductionsCache).map(serializeProduction)}},class{initErrorHandler(config){this._errors=[],this.errorMessageProvider=Object.hasOwn(config,"errorMessageProvider")?config.errorMessageProvider:DEFAULT_PARSER_CONFIG.errorMessageProvider}SAVE_ERROR(error){if(isRecognitionException(error))return error.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(error),error;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return[...this._errors]}set errors(newErrors){this._errors=newErrors}raiseEarlyExitException(occurrence,prodType,userDefinedErrMsg){const ruleName=this.getCurrRuleFullName(),insideProdPaths=getLookaheadPathsForOptionalProd(occurrence,this.getGAstProductions()[ruleName],prodType,this.maxLookahead)[0],actualTokens=[];for(let i=1;i<=this.maxLookahead;i++)actualTokens.push(this.LA(i));const msg=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:insideProdPaths,actual:actualTokens,previous:this.LA(0),customUserDescription:userDefinedErrMsg,ruleName:ruleName});throw this.SAVE_ERROR(new EarlyExitException(msg,this.LA(1),this.LA(0)))}raiseNoAltException(occurrence,errMsgTypes){const ruleName=this.getCurrRuleFullName(),lookAheadPathsPerAlternative=getLookaheadPathsForOr(occurrence,this.getGAstProductions()[ruleName],this.maxLookahead),actualTokens=[];for(let i=1;i<=this.maxLookahead;i++)actualTokens.push(this.LA(i));const previousToken=this.LA(0),errMsg=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:lookAheadPathsPerAlternative,actual:actualTokens,previous:previousToken,customUserDescription:errMsgTypes,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new NoViableAltException(errMsg,this.LA(1),previousToken))}},class{initGastRecorder(config){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let i=0;i<10;i++){const idx=i>0?i:"";this[`CONSUME${idx}`]=function(arg1,arg2){return this.consumeInternalRecord(arg1,i,arg2)},this[`SUBRULE${idx}`]=function(arg1,arg2){return this.subruleInternalRecord(arg1,i,arg2)},this[`OPTION${idx}`]=function(arg1){return this.optionInternalRecord(arg1,i)},this[`OR${idx}`]=function(arg1){return this.orInternalRecord(arg1,i)},this[`MANY${idx}`]=function(arg1){this.manyInternalRecord(i,arg1)},this[`MANY_SEP${idx}`]=function(arg1){this.manySepFirstInternalRecord(i,arg1)},this[`AT_LEAST_ONE${idx}`]=function(arg1){this.atLeastOneInternalRecord(i,arg1)},this[`AT_LEAST_ONE_SEP${idx}`]=function(arg1){this.atLeastOneSepFirstInternalRecord(i,arg1)}}this.consume=function(idx,arg1,arg2){return this.consumeInternalRecord(arg1,idx,arg2)},this.subrule=function(idx,arg1,arg2){return this.subruleInternalRecord(arg1,idx,arg2)},this.option=function(idx,arg1){return this.optionInternalRecord(arg1,idx)},this.or=function(idx,arg1){return this.orInternalRecord(arg1,idx)},this.many=function(idx,arg1){this.manyInternalRecord(idx,arg1)},this.atLeastOne=function(idx,arg1){this.atLeastOneInternalRecord(idx,arg1)},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 that=this;for(let i=0;i<10;i++){const idx=i>0?i:"";delete that[`CONSUME${idx}`],delete that[`SUBRULE${idx}`],delete that[`OPTION${idx}`],delete that[`OR${idx}`],delete that[`MANY${idx}`],delete that[`MANY_SEP${idx}`],delete that[`AT_LEAST_ONE${idx}`],delete that[`AT_LEAST_ONE_SEP${idx}`]}delete that.consume,delete that.subrule,delete that.option,delete that.or,delete that.many,delete that.atLeastOne,delete that.ACTION,delete that.BACKTRACK,delete that.LA})}ACTION_RECORD(impl){}BACKTRACK_RECORD(grammarRule,args){return()=>!0}LA_RECORD(howMuch){return END_OF_FILE}topLevelRuleRecord(name,def){try{const newTopLevelRule=new Rule({definition:[],name:name});return newTopLevelRule.name=name,this.recordingProdStack.push(newTopLevelRule),def.call(this),this.recordingProdStack.pop(),newTopLevelRule}catch(originalError){if(!0!==originalError.KNOWN_RECORDER_ERROR)try{originalError.message=originalError.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(mutabilityError){throw originalError}throw originalError}}optionInternalRecord(actionORMethodDef,occurrence){return recordProd.call(this,Option$1,actionORMethodDef,occurrence)}atLeastOneInternalRecord(occurrence,actionORMethodDef){recordProd.call(this,RepetitionMandatory,actionORMethodDef,occurrence)}atLeastOneSepFirstInternalRecord(occurrence,options){recordProd.call(this,RepetitionMandatoryWithSeparator,options,occurrence,!0)}manyInternalRecord(occurrence,actionORMethodDef){recordProd.call(this,Repetition,actionORMethodDef,occurrence)}manySepFirstInternalRecord(occurrence,options){recordProd.call(this,RepetitionWithSeparator,options,occurrence,!0)}orInternalRecord(altsOrOpts,occurrence){return recordOrProd.call(this,altsOrOpts,occurrence)}subruleInternalRecord(ruleToCall,occurrence,options){if(assertMethodIdxIsValid(occurrence),!ruleToCall||!Object.hasOwn(ruleToCall,"ruleName")){const error=new Error(`<SUBRULE${getIdxSuffix(occurrence)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(ruleToCall)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw error.KNOWN_RECORDER_ERROR=!0,error}const prevProd=this.recordingProdStack.at(-1),ruleName=ruleToCall.ruleName,newNoneTerminal=new NonTerminal({idx:occurrence,nonTerminalName:ruleName,label:null==options?void 0:options.LABEL,referencedRule:void 0});return prevProd.definition.push(newNoneTerminal),this.outputCst?RECORDING_PHASE_CSTNODE:RECORDING_NULL_OBJECT}consumeInternalRecord(tokType,occurrence,options){if(assertMethodIdxIsValid(occurrence),!hasShortKeyProperty(tokType)){const error=new Error(`<CONSUME${getIdxSuffix(occurrence)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(tokType)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw error.KNOWN_RECORDER_ERROR=!0,error}const prevProd=this.recordingProdStack.at(-1),newNoneTerminal=new Terminal({idx:occurrence,terminalType:tokType,label:null==options?void 0:options.LABEL});return prevProd.definition.push(newNoneTerminal),RECORDING_PHASE_TOKEN}},class{initPerformanceTracer(config){if(Object.hasOwn(config,"traceInitPerf")){const userTraceInitPerf=config.traceInitPerf,traceIsNumber="number"==typeof userTraceInitPerf;this.traceInitMaxIdent=traceIsNumber?userTraceInitPerf:1/0,this.traceInitPerf=traceIsNumber?userTraceInitPerf>0:userTraceInitPerf}else this.traceInitMaxIdent=0,this.traceInitPerf=DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(phaseDesc,phaseImpl){if(!0===this.traceInitPerf){this.traceInitIndent++;const indent=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${indent}--\x3e <${phaseDesc}>`);const{time:time,value:value}=timer(phaseImpl),traceMethod=time>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`),this.traceInitIndent--,value}return phaseImpl()}}].forEach(baseCtor=>{const baseProto=baseCtor.prototype;Object.getOwnPropertyNames(baseProto).forEach(propName=>{if("constructor"===propName)return;const basePropDescriptor=Object.getOwnPropertyDescriptor(baseProto,propName);basePropDescriptor&&(basePropDescriptor.get||basePropDescriptor.set)?Object.defineProperty(derivedCtor.prototype,propName,basePropDescriptor):derivedCtor.prototype[propName]=baseCtor.prototype[propName]})});class EmbeddedActionsParser extends Parser{constructor(tokenVocabulary,config=DEFAULT_PARSER_CONFIG){const configClone=Object.assign({},config);configClone.outputCst=!1,super(tokenVocabulary,configClone)}}function buildATNKey(rule,type,occurrence){return`${rule.name}_${type}_${occurrence}`}class AbstractTransition{constructor(target){this.target=target}isEpsilon(){return!1}}class AtomTransition extends AbstractTransition{constructor(target,tokenType){super(target),this.tokenType=tokenType}}class EpsilonTransition extends AbstractTransition{constructor(target){super(target)}isEpsilon(){return!0}}class RuleTransition extends AbstractTransition{constructor(ruleStart,rule,followState){super(ruleStart),this.rule=rule,this.followState=followState}isEpsilon(){return!0}}function createATN(rules){const atn={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};!function(atn,rules){const ruleLength=rules.length;for(let i=0;i<ruleLength;i++){const rule=rules[i],start=newState(atn,rule,void 0,{type:2}),stop=newState(atn,rule,void 0,{type:7});start.stop=stop,atn.ruleToStartState.set(rule,start),atn.ruleToStopState.set(rule,stop)}}(atn,rules);const ruleLength=rules.length;for(let i=0;i<ruleLength;i++){const rule=rules[i],ruleBlock=block(atn,rule,rule);void 0!==ruleBlock&&buildRuleHandle(atn,rule,ruleBlock)}return atn}function atom(atn,rule,production){return production instanceof Terminal?tokenRef(atn,rule,production.terminalType,production):production instanceof NonTerminal?function(atn,currentRule,nonTerminal){const rule=nonTerminal.referencedRule,start=atn.ruleToStartState.get(rule),left=newState(atn,currentRule,nonTerminal,{type:1}),right=newState(atn,currentRule,nonTerminal,{type:1}),call=new RuleTransition(start,rule,right);return addTransition(left,call),{left:left,right:right}}(atn,rule,production):production instanceof Alternation?function(atn,rule,alternation2){const start=newState(atn,rule,alternation2,{type:1});defineDecisionState(atn,start);const alts=map(alternation2.definition,e=>atom(atn,rule,e)),handle=makeAlts(atn,rule,start,alternation2,...alts);return handle}(atn,rule,production):production instanceof Option$1?function(atn,rule,option2){const start=newState(atn,rule,option2,{type:1});defineDecisionState(atn,start);const handle=makeAlts(atn,rule,start,option2,block(atn,rule,option2));return function(atn,rule,optional2,handle){const start=handle.left,end=handle.right;return epsilon(start,end),atn.decisionMap[buildATNKey(rule,"Option",optional2.idx)]=start,handle}(atn,rule,option2,handle)}(atn,rule,production):production instanceof Repetition?function(atn,rule,repetition2){const starState=newState(atn,rule,repetition2,{type:5});defineDecisionState(atn,starState);const handle=makeAlts(atn,rule,starState,repetition2,block(atn,rule,repetition2));return star(atn,rule,repetition2,handle)}(atn,rule,production):production instanceof RepetitionWithSeparator?function(atn,rule,repetition2){const starState=newState(atn,rule,repetition2,{type:5});defineDecisionState(atn,starState);const handle=makeAlts(atn,rule,starState,repetition2,block(atn,rule,repetition2)),sep=tokenRef(atn,rule,repetition2.separator,repetition2);return star(atn,rule,repetition2,handle,sep)}(atn,rule,production):production instanceof RepetitionMandatory?function(atn,rule,repetition2){const plusState=newState(atn,rule,repetition2,{type:4});defineDecisionState(atn,plusState);const handle=makeAlts(atn,rule,plusState,repetition2,block(atn,rule,repetition2));return plus(atn,rule,repetition2,handle)}(atn,rule,production):production instanceof RepetitionMandatoryWithSeparator?function(atn,rule,repetition2){const plusState=newState(atn,rule,repetition2,{type:4});defineDecisionState(atn,plusState);const handle=makeAlts(atn,rule,plusState,repetition2,block(atn,rule,repetition2)),sep=tokenRef(atn,rule,repetition2.separator,repetition2);return plus(atn,rule,repetition2,handle,sep)}(atn,rule,production):block(atn,rule,production)}function block(atn,rule,block2){const handles=filter(map(block2.definition,e=>atom(atn,rule,e)),e=>void 0!==e);return 1===handles.length?handles[0]:0===handles.length?void 0:function(atn,alts){const altsLength=alts.length;for(let i=0;i<altsLength-1;i++){const handle=alts[i];let transition;1===handle.left.transitions.length&&(transition=handle.left.transitions[0]);const isRuleTransition=transition instanceof RuleTransition,ruleTransition=transition,next=alts[i+1].left;1===handle.left.type&&1===handle.right.type&&void 0!==transition&&(isRuleTransition&&ruleTransition.followState===handle.right||transition.target===handle.right)?(isRuleTransition?ruleTransition.followState=next:transition.target=next,removeState(atn,handle.right)):epsilon(handle.right,next)}const first2=alts[0],last=alts[altsLength-1];return{left:first2.left,right:last.right}}(atn,handles)}function plus(atn,rule,plus2,handle,sep){const blkStart=handle.left,blkEnd=handle.right,loop=newState(atn,rule,plus2,{type:11});defineDecisionState(atn,loop);const end=newState(atn,rule,plus2,{type:12});return blkStart.loopback=loop,end.loopback=loop,atn.decisionMap[buildATNKey(rule,sep?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",plus2.idx)]=loop,epsilon(blkEnd,loop),void 0===sep?(epsilon(loop,blkStart),epsilon(loop,end)):(epsilon(loop,end),epsilon(loop,sep.left),epsilon(sep.right,blkStart)),{left:blkStart,right:end}}function star(atn,rule,star2,handle,sep){const start=handle.left,end=handle.right,entry=newState(atn,rule,star2,{type:10});defineDecisionState(atn,entry);const loopEnd=newState(atn,rule,star2,{type:12}),loop=newState(atn,rule,star2,{type:9});return entry.loopback=loop,loopEnd.loopback=loop,epsilon(entry,start),epsilon(entry,loopEnd),epsilon(end,loop),void 0!==sep?(epsilon(loop,loopEnd),epsilon(loop,sep.left),epsilon(sep.right,start)):epsilon(loop,entry),atn.decisionMap[buildATNKey(rule,sep?"RepetitionWithSeparator":"Repetition",star2.idx)]=entry,{left:entry,right:loopEnd}}function defineDecisionState(atn,state){return atn.decisionStates.push(state),state.decision=atn.decisionStates.length-1,state.decision}function makeAlts(atn,rule,start,production,...alts){const end=newState(atn,rule,production,{type:8,start:start});start.end=end;for(const alt of alts)void 0!==alt?(epsilon(start,alt.left),epsilon(alt.right,end)):epsilon(start,end);const handle={left:start,right:end};return atn.decisionMap[buildATNKey(rule,function(production){if(production instanceof Alternation)return"Alternation";if(production instanceof Option$1)return"Option";if(production instanceof Repetition)return"Repetition";if(production instanceof RepetitionWithSeparator)return"RepetitionWithSeparator";if(production instanceof RepetitionMandatory)return"RepetitionMandatory";if(production instanceof RepetitionMandatoryWithSeparator)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}(production),production.idx)]=start,handle}function tokenRef(atn,rule,tokenType,production){const left=newState(atn,rule,production,{type:1}),right=newState(atn,rule,production,{type:1});return addTransition(left,new AtomTransition(right,tokenType)),{left:left,right:right}}function buildRuleHandle(atn,rule,block2){const start=atn.ruleToStartState.get(rule);epsilon(start,block2.left);const stop=atn.ruleToStopState.get(rule);epsilon(block2.right,stop);return{left:start,right:stop}}function epsilon(a,b){addTransition(a,new EpsilonTransition(b))}function newState(atn,rule,production,partial){const t=Object.assign({atn:atn,production:production,epsilonOnlyTransitions:!1,rule:rule,transitions:[],nextTokenWithinRule:[],stateNumber:atn.states.length},partial);return atn.states.push(t),t}function addTransition(state,transition){0===state.transitions.length&&(state.epsilonOnlyTransitions=transition.isEpsilon()),state.transitions.push(transition)}function removeState(atn,state){atn.states.splice(atn.states.indexOf(state),1)}const DFA_ERROR={};class ATNConfigSet{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(config){const key=getATNConfigKey(config);key in this.map||(this.map[key]=this.configs.length,this.configs.push(config))}get elements(){return this.configs}get alts(){return map(this.configs,e=>e.alt)}get key(){let value="";for(const k in this.map)value+=k+":";return value}}function getATNConfigKey(config,alt=!0){return`${alt?`a${config.alt}`:""}s${config.state.stateNumber}:${config.stack.map(e=>e.stateNumber.toString()).join("_")}`}function createDFACache(startState,decision){const map2={};return predicateSet=>{const key=predicateSet.toString();let existing=map2[key];return void 0!==existing||(existing={atnStartState:startState,decision:decision,states:{}},map2[key]=existing),existing}}class PredicateSet{constructor(){this.predicates=[]}is(index){return index>=this.predicates.length||this.predicates[index]}set(index,value){this.predicates[index]=value}toString(){let value="";const size=this.predicates.length;for(let i=0;i<size;i++)value+=!0===this.predicates[i]?"1":"0";return value}}const EMPTY_PREDICATES=new PredicateSet;class LLStarLookaheadStrategy extends LLkLookaheadStrategy{constructor(options){var _a2;super(),this.logging=null!==(_a2=null==options?void 0:options.logging)&&void 0!==_a2?_a2:message=>console.log(message)}initialize(options){this.atn=createATN(options.rules),this.dfas=function(atn){const decisionLength=atn.decisionStates.length,decisionToDFA=Array(decisionLength);for(let i=0;i<decisionLength;i++)decisionToDFA[i]=createDFACache(atn.decisionStates[i],i);return decisionToDFA}(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(options){const{prodOccurrence:prodOccurrence,rule:rule,hasPredicates:hasPredicates,dynamicTokensEnabled:dynamicTokensEnabled}=options,dfas=this.dfas,logging=this.logging,key=buildATNKey(rule,"Alternation",prodOccurrence),decisionIndex=this.atn.decisionMap[key].decision,partialAlts=map(getLookaheadPaths({maxLookahead:1,occurrence:prodOccurrence,prodType:"Alternation",rule:rule}),currAlt=>map(currAlt,path=>path[0]));if(isLL1Sequence(partialAlts,!1)&&!dynamicTokensEnabled){const choiceToAlt=reduce(partialAlts,(result,currAlt,idx)=>(forEach(currAlt,currTokType=>{currTokType&&(result[currTokType.tokenTypeIdx]=idx,forEach(currTokType.categoryMatches,currExtendingType=>{result[currExtendingType]=idx}))}),result),{});return hasPredicates?function(orAlts){var _a2;const nextToken=this.LA_FAST(1),prediction=choiceToAlt[nextToken.tokenTypeIdx];if(void 0!==orAlts&&void 0!==prediction){const gate=null===(_a2=orAlts[prediction])||void 0===_a2?void 0:_a2.GATE;if(void 0!==gate&&!1===gate.call(this))return}return prediction}:function(){const nextToken=this.LA_FAST(1);return choiceToAlt[nextToken.tokenTypeIdx]}}return hasPredicates?function(orAlts){const predicates=new PredicateSet,length=void 0===orAlts?0:orAlts.length;for(let i=0;i<length;i++){const gate=null==orAlts?void 0:orAlts[i].GATE;predicates.set(i,void 0===gate||gate.call(this))}const result=adaptivePredict.call(this,dfas,decisionIndex,predicates,logging);return"number"==typeof result?result:void 0}:function(){const result=adaptivePredict.call(this,dfas,decisionIndex,EMPTY_PREDICATES,logging);return"number"==typeof result?result:void 0}}buildLookaheadForOptional(options){const{prodOccurrence:prodOccurrence,rule:rule,prodType:prodType,dynamicTokensEnabled:dynamicTokensEnabled}=options,dfas=this.dfas,logging=this.logging,key=buildATNKey(rule,prodType,prodOccurrence),decisionIndex=this.atn.decisionMap[key].decision,alts=map(getLookaheadPaths({maxLookahead:1,occurrence:prodOccurrence,prodType:prodType,rule:rule}),e=>map(e,g=>g[0]));if(isLL1Sequence(alts)&&alts[0][0]&&!dynamicTokensEnabled){const alt=alts[0],singleTokensTypes=flatten(alt);if(1===singleTokensTypes.length&&isEmpty(singleTokensTypes[0].categoryMatches)){const expectedTokenUniqueKey=singleTokensTypes[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===expectedTokenUniqueKey}}{const choiceToAlt=reduce(singleTokensTypes,(result,currTokType)=>(void 0!==currTokType&&(result[currTokType.tokenTypeIdx]=!0,forEach(currTokType.categoryMatches,currExtendingType=>{result[currExtendingType]=!0})),result),{});return function(){const nextToken=this.LA_FAST(1);return!0===choiceToAlt[nextToken.tokenTypeIdx]}}}return function(){const result=adaptivePredict.call(this,dfas,decisionIndex,EMPTY_PREDICATES,logging);return"object"!=typeof result&&0===result}}}function isLL1Sequence(sequences,allowEmpty=!0){const fullSet=new Set;for(const alt of sequences){const altSet=new Set;for(const tokType of alt){if(void 0===tokType){if(allowEmpty)break;return!1}const indices=[tokType.tokenTypeIdx].concat(tokType.categoryMatches);for(const index of indices)if(fullSet.has(index)){if(!altSet.has(index))return!1}else fullSet.add(index),altSet.add(index)}}return!0}function adaptivePredict(dfaCaches,decision,predicateSet,logging){const dfa=dfaCaches[decision](predicateSet);let start=dfa.start;if(void 0===start){start=addDFAState(dfa,newDFAState(function(atnState){const configs=new ATNConfigSet,numberOfTransitions=atnState.transitions.length;for(let i=0;i<numberOfTransitions;i++){closure({state:atnState.transitions[i].target,alt:i,stack:[]},configs)}return configs}(dfa.atnStartState))),dfa.start=start}return performLookahead.apply(this,[dfa,start,predicateSet,logging])}function performLookahead(dfa,s0,predicateSet,logging){let previousD=s0,i=1;const path=[];let t=this.LA_FAST(i++);for(;;){let d=getExistingTargetState(previousD,t);if(void 0===d&&(d=computeLookaheadTarget.apply(this,[dfa,previousD,t,i,predicateSet,logging])),d===DFA_ERROR)return buildAdaptivePredictError(path,previousD,t);if(!0===d.isAcceptState)return d.prediction;previousD=d,path.push(t),t=this.LA(i++)}}function computeLookaheadTarget(dfa,previousD,token,lookahead,predicateSet,logging){const reach=function(configs,token,predicateSet){const intermediate=new ATNConfigSet,skippedStopStates=[];for(const c of configs.elements){if(!1===predicateSet.is(c.alt))continue;if(7===c.state.type){skippedStopStates.push(c);continue}const transitionLength=c.state.transitions.length;for(let i=0;i<transitionLength;i++){const target=getReachableTarget(c.state.transitions[i],token);void 0!==target&&intermediate.add({state:target,alt:c.alt,stack:c.stack})}}let reach;0===skippedStopStates.length&&1===intermediate.size&&(reach=intermediate);if(void 0===reach){reach=new ATNConfigSet;for(const c of intermediate.elements)closure(c,reach)}if(skippedStopStates.length>0&&!function(configs){for(const c of configs.elements)if(7===c.state.type)return!0;return!1}(reach))for(const c of skippedStopStates)reach.add(c);return reach}(previousD.configs,token,predicateSet);if(0===reach.size)return addDFAEdge(dfa,previousD,token,DFA_ERROR),DFA_ERROR;let newState2=newDFAState(reach);const predictedAlt=function(configs,predicateSet){let alt;for(const c of configs.elements)if(!0===predicateSet.is(c.alt))if(void 0===alt)alt=c.alt;else if(alt!==c.alt)return;return alt}(reach,predicateSet);if(void 0!==predictedAlt)newState2.isAcceptState=!0,newState2.prediction=predictedAlt,newState2.configs.uniqueAlt=predictedAlt;else if(function(configs){if(function(configs){for(const c of configs.elements)if(7!==c.state.type)return!1;return!0}(configs))return!0;const altSets=function(configs){const configToAlts=new Map;for(const c of configs){const key=getATNConfigKey(c,!1);let alts=configToAlts.get(key);void 0===alts&&(alts={},configToAlts.set(key,alts)),alts[c.alt]=!0}return configToAlts}(configs.elements);return function(altSets){for(const value of Array.from(altSets.values()))if(Object.keys(value).length>1)return!0;return!1}(altSets)&&!function(altSets){for(const value of Array.from(altSets.values()))if(1===Object.keys(value).length)return!0;return!1}(altSets)}(reach)){const prediction=min(reach.alts);newState2.isAcceptState=!0,newState2.prediction=prediction,newState2.configs.uniqueAlt=prediction,reportLookaheadAmbiguity.apply(this,[dfa,lookahead,reach.alts,logging])}return newState2=addDFAEdge(dfa,previousD,token,newState2),newState2}function reportLookaheadAmbiguity(dfa,lookahead,ambiguityIndices,logging){const prefixPath=[];for(let i=1;i<=lookahead;i++)prefixPath.push(this.LA(i).tokenType);const atnState=dfa.atnStartState;logging(function(options){const pathMsg=map(options.prefixPath,currtok=>tokenLabel(currtok)).join(", "),occurrence=0===options.production.idx?"":options.production.idx;let currMessage=`Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(", ")}> in <${function(prod){if(prod instanceof NonTerminal)return"SUBRULE";if(prod instanceof Option$1)return"OPTION";if(prod instanceof Alternation)return"OR";if(prod instanceof RepetitionMandatory)return"AT_LEAST_ONE";if(prod instanceof RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(prod instanceof RepetitionWithSeparator)return"MANY_SEP";if(prod instanceof Repetition)return"MANY";if(prod instanceof Terminal)return"CONSUME";throw Error("non exhaustive match")}(options.production)}${occurrence}> inside <${options.topLevelRule.name}> Rule,\n<${pathMsg}> may appears as a prefix path in all these alternatives.\n`;return currMessage+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",currMessage}({topLevelRule:atnState.rule,ambiguityIndices:ambiguityIndices,production:atnState.production,prefixPath:prefixPath}))}function buildAdaptivePredictError(path,previous,current){var collection;return{actualToken:current,possibleTokenTypes:function(array,iteratee){return array&&array.length?baseUniq(array,baseIteratee(iteratee)):[]}((collection=previous.configs.elements,baseFlatten(map(collection,e=>e.state.transitions))).filter(e=>e instanceof AtomTransition).map(e=>e.tokenType),e=>e.tokenTypeIdx),tokenPath:path}}function getExistingTargetState(state,token){return state.edges[token.tokenTypeIdx]}function getReachableTarget(transition,token){if(transition instanceof AtomTransition&&tokenMatcher(token,transition.tokenType))return transition.target}function newDFAState(closure2){return{configs:closure2,edges:{},isAcceptState:!1,prediction:-1}}function addDFAEdge(dfa,from,token,to){return to=addDFAState(dfa,to),from.edges[token.tokenTypeIdx]=to,to}function addDFAState(dfa,state){if(state===DFA_ERROR)return state;const mapKey=state.configs.key,existing=dfa.states[mapKey];return void 0!==existing?existing:(state.configs.finalize(),dfa.states[mapKey]=state,state)}function closure(config,configs){const p=config.state;if(7===p.type){if(config.stack.length>0){const atnStack=[...config.stack];closure({state:atnStack.pop(),alt:config.alt,stack:atnStack},configs)}else configs.add(config);return}p.epsilonOnlyTransitions||configs.add(config);const transitionLength=p.transitions.length;for(let i=0;i<transitionLength;i++){const c=getEpsilonTarget(config,p.transitions[i]);void 0!==c&&closure(c,configs)}}function getEpsilonTarget(config,transition){if(transition instanceof EpsilonTransition)return{state:transition.target,alt:config.alt,stack:config.stack};if(transition instanceof RuleTransition){const stack=[...config.stack,transition.followState];return{state:transition.target,alt:config.alt,stack:stack}}}var DocumentUri,URI$1,integer,integer2,uinteger,uinteger2,Position,Position2,Range,Range2,Location,Location2,LocationLink,LocationLink2,Color,Color2,ColorInformation,ColorInformation2,ColorPresentation,ColorPresentation2,FoldingRangeKind,FoldingRangeKind2,FoldingRange,FoldingRange2,DiagnosticRelatedInformation,DiagnosticRelatedInformation2,DiagnosticSeverity,DiagnosticSeverity2,DiagnosticTag,DiagnosticTag2,CodeDescription,Diagnostic,Diagnostic2,Command,Command2,TextEdit,TextEdit2,ChangeAnnotation,ChangeAnnotation2,ChangeAnnotationIdentifier,AnnotatedTextEdit,AnnotatedTextEdit2,TextDocumentEdit,TextDocumentEdit2,CreateFile,CreateFile2,RenameFile,RenameFile2,DeleteFile,DeleteFile2,WorkspaceEdit,TextDocumentIdentifier,TextDocumentIdentifier2,VersionedTextDocumentIdentifier,VersionedTextDocumentIdentifier2,OptionalVersionedTextDocumentIdentifier,OptionalVersionedTextDocumentIdentifier2,TextDocumentItem,TextDocumentItem2,MarkupKind,MarkupKind2,MarkupContent,CompletionItemKind,CompletionItemKind2,InsertTextFormat,InsertTextFormat2,CompletionItemTag,InsertReplaceEdit,InsertReplaceEdit2,InsertTextMode,InsertTextMode2,CompletionItemLabelDetails,CompletionItem,CompletionList,MarkedString,MarkedString2,Hover,ParameterInformation,SignatureInformation,DocumentHighlightKind,DocumentHighlightKind2,DocumentHighlight,SymbolKind,SymbolKind2,SymbolTag,SymbolInformation,WorkspaceSymbol,DocumentSymbol,DocumentSymbol2,CodeActionKind,CodeActionKind2,CodeActionTriggerKind,CodeActionTriggerKind2,CodeActionContext,CodeActionContext2,CodeAction,CodeAction2,CodeLens,CodeLens2,FormattingOptions,FormattingOptions2,DocumentLink,DocumentLink2,SelectionRange,SelectionRange2,SemanticTokenTypes,SemanticTokenTypes2,SemanticTokenModifiers,SemanticTokenModifiers2,SemanticTokens,InlineValueText,InlineValueText2,InlineValueVariableLookup,InlineValueVariableLookup2,InlineValueEvaluatableExpression,InlineValueEvaluatableExpression2,InlineValueContext,InlineValueContext2,InlayHintKind,InlayHintKind2,InlayHintLabelPart,InlayHintLabelPart2,InlayHint,InlayHint2,StringValue,InlineCompletionItem,InlineCompletionList,InlineCompletionTriggerKind,InlineCompletionTriggerKind2,SelectedCompletionInfo,InlineCompletionContext,WorkspaceFolder;(DocumentUri||(DocumentUri={})).is=function(value){return"string"==typeof value},(URI$1||(URI$1={})).is=function(value){return"string"==typeof value},(integer2=integer||(integer={})).MIN_VALUE=-2147483648,integer2.MAX_VALUE=2147483647,integer2.is=function(value){return"number"==typeof value&&integer2.MIN_VALUE<=value&&value<=integer2.MAX_VALUE},(uinteger2=uinteger||(uinteger={})).MIN_VALUE=0,uinteger2.MAX_VALUE=2147483647,uinteger2.is=function(value){return"number"==typeof value&&uinteger2.MIN_VALUE<=value&&value<=uinteger2.MAX_VALUE},(Position2=Position||(Position={})).create=function(line,character){return line===Number.MAX_VALUE&&(line=uinteger.MAX_VALUE),character===Number.MAX_VALUE&&(character=uinteger.MAX_VALUE),{line:line,character:character}},Position2.is=function(value){let candidate=value;return Is.objectLiteral(candidate)&&Is.uinteger(candidate.line)&&Is.uinteger(candidate.character)},(Range2=Range||(Range={})).create=function(one,two,three,four){if(Is.uinteger(one)&&Is.uinteger(two)&&Is.uinteger(three)&&Is.uinteger(four))return{start:Position.create(one,two),end:Position.create(three,four)};if(Position.is(one)&&Position.is(two))return{start:one,end:two};throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`)},Range2.is=function(value){let candidate=value;return Is.objectLiteral(candidate)&&Position.is(candidate.start)&&Position.is(candidate.end)},(Location2=Location||(Location={})).create=function(uri,range){return{uri:uri,range:range}},Location2.is=function(value){let candidate=value;return Is.objectLiteral(candidate)&&Range.is(candidate.range)&&(Is.string(candidate.uri)||Is.undefined(candidate.uri))},(LocationLink2=LocationLink||(LocationLink={})).create=function(targetUri,targetRange,targetSelectionRange,originSelectionRange){return{targetUri:targetUri,targetRange:targetRange,targetSelectionRange:targetSelectionRange,originSelectionRange:originSelectionRange}},LocationLink2.is=function(value){let candidate=value;return Is.objectLiteral(candidate)&&Range.is(candidate.targetRange)&&Is.string(candidate.targetUri)&&Range.is(candidate.targetSelectionRange)&&(Range.is(candidate.originSelectionRange)||Is.undefined(candidate.originSelectionRange))},(Color2=Color||(Color={})).create=function(red,green,blue,alpha){return{red:red,green:green,blue:blue,alpha:alpha}},Color2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.numberRange(candidate.red,0,1)&&Is.numberRange(candidate.green,0,1)&&Is.numberRange(candidate.blue,0,1)&&Is.numberRange(candidate.alpha,0,1)},(ColorInformation2=ColorInformation||(ColorInformation={})).create=function(range,color){return{range:range,color:color}},ColorInformation2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Range.is(candidate.range)&&Color.is(candidate.color)},(ColorPresentation2=ColorPresentation||(ColorPresentation={})).create=function(label,textEdit,additionalTextEdits){return{label:label,textEdit:textEdit,additionalTextEdits:additionalTextEdits}},ColorPresentation2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.string(candidate.label)&&(Is.undefined(candidate.textEdit)||TextEdit.is(candidate))&&(Is.undefined(candidate.additionalTextEdits)||Is.typedArray(candidate.additionalTextEdits,TextEdit.is))},(FoldingRangeKind2=FoldingRangeKind||(FoldingRangeKind={})).Comment="comment",FoldingRangeKind2.Imports="imports",FoldingRangeKind2.Region="region",(FoldingRange2=FoldingRange||(FoldingRange={})).create=function(startLine,endLine,startCharacter,endCharacter,kind,collapsedText){const result={startLine:startLine,endLine:endLine};return Is.defined(startCharacter)&&(result.startCharacter=startCharacter),Is.defined(endCharacter)&&(result.endCharacter=endCharacter),Is.defined(kind)&&(result.kind=kind),Is.defined(collapsedText)&&(result.collapsedText=collapsedText),result},FoldingRange2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.uinteger(candidate.startLine)&&Is.uinteger(candidate.startLine)&&(Is.undefined(candidate.startCharacter)||Is.uinteger(candidate.startCharacter))&&(Is.undefined(candidate.endCharacter)||Is.uinteger(candidate.endCharacter))&&(Is.undefined(candidate.kind)||Is.string(candidate.kind))},(DiagnosticRelatedInformation2=DiagnosticRelatedInformation||(DiagnosticRelatedInformation={})).create=function(location,message){return{location:location,message:message}},DiagnosticRelatedInformation2.is=function(value){let candidate=value;return Is.defined(candidate)&&Location.is(candidate.location)&&Is.string(candidate.message)},(DiagnosticSeverity2=DiagnosticSeverity||(DiagnosticSeverity={})).Error=1,DiagnosticSeverity2.Warning=2,DiagnosticSeverity2.Information=3,DiagnosticSeverity2.Hint=4,(DiagnosticTag2=DiagnosticTag||(DiagnosticTag={})).Unnecessary=1,DiagnosticTag2.Deprecated=2,(CodeDescription||(CodeDescription={})).is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.string(candidate.href)},(Diagnostic2=Diagnostic||(Diagnostic={})).create=function(range,message,severity,code,source,relatedInformation){let result={range:range,message:message};return Is.defined(severity)&&(result.severity=severity),Is.defined(code)&&(result.code=code),Is.defined(source)&&(result.source=source),Is.defined(relatedInformation)&&(result.relatedInformation=relatedInformation),result},Diagnostic2.is=function(value){var _a2;let candidate=value;return Is.defined(candidate)&&Range.is(candidate.range)&&Is.string(candidate.message)&&(Is.number(candidate.severity)||Is.undefined(candidate.severity))&&(Is.integer(candidate.code)||Is.string(candidate.code)||Is.undefined(candidate.code))&&(Is.undefined(candidate.codeDescription)||Is.string(null===(_a2=candidate.codeDescription)||void 0===_a2?void 0:_a2.href))&&(Is.string(candidate.source)||Is.undefined(candidate.source))&&(Is.undefined(candidate.relatedInformation)||Is.typedArray(candidate.relatedInformation,DiagnosticRelatedInformation.is))},(Command2=Command||(Command={})).create=function(title,command,...args){let result={title:title,command:command};return Is.defined(args)&&args.length>0&&(result.arguments=args),result},Command2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.string(candidate.title)&&Is.string(candidate.command)},(TextEdit2=TextEdit||(TextEdit={})).replace=function(range,newText){return{range:range,newText:newText}},TextEdit2.insert=function(position,newText){return{range:{start:position,end:position},newText:newText}},TextEdit2.del=function(range){return{range:range,newText:""}},TextEdit2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.string(candidate.newText)&&Range.is(candidate.range)},(ChangeAnnotation2=ChangeAnnotation||(ChangeAnnotation={})).create=function(label,needsConfirmation,description){const result={label:label};return void 0!==needsConfirmation&&(result.needsConfirmation=needsConfirmation),void 0!==description&&(result.description=description),result},ChangeAnnotation2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Is.string(candidate.label)&&(Is.boolean(candidate.needsConfirmation)||void 0===candidate.needsConfirmation)&&(Is.string(candidate.description)||void 0===candidate.description)},(ChangeAnnotationIdentifier||(ChangeAnnotationIdentifier={})).is=function(value){const candidate=value;return Is.string(candidate)},(AnnotatedTextEdit2=AnnotatedTextEdit||(AnnotatedTextEdit={})).replace=function(range,newText,annotation){return{range:range,newText:newText,annotationId:annotation}},AnnotatedTextEdit2.insert=function(position,newText,annotation){return{range:{start:position,end:position},newText:newText,annotationId:annotation}},AnnotatedTextEdit2.del=function(range,annotation){return{range:range,newText:"",annotationId:annotation}},AnnotatedTextEdit2.is=function(value){const candidate=value;return TextEdit.is(candidate)&&(ChangeAnnotation.is(candidate.annotationId)||ChangeAnnotationIdentifier.is(candidate.annotationId))},(TextDocumentEdit2=TextDocumentEdit||(TextDocumentEdit={})).create=function(textDocument,edits){return{textDocument:textDocument,edits:edits}},TextDocumentEdit2.is=function(value){let candidate=value;return Is.defined(candidate)&&OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)&&Array.isArray(candidate.edits)},(CreateFile2=CreateFile||(CreateFile={})).create=function(uri,options,annotation){let result={kind:"create",uri:uri};return void 0===options||void 0===options.overwrite&&void 0===options.ignoreIfExists||(result.options=options),void 0!==annotation&&(result.annotationId=annotation),result},CreateFile2.is=function(value){let candidate=value;return candidate&&"create"===candidate.kind&&Is.string(candidate.uri)&&(void 0===candidate.options||(void 0===candidate.options.overwrite||Is.boolean(candidate.options.overwrite))&&(void 0===candidate.options.ignoreIfExists||Is.boolean(candidate.options.ignoreIfExists)))&&(void 0===candidate.annotationId||ChangeAnnotationIdentifier.is(candidate.annotationId))},(RenameFile2=RenameFile||(RenameFile={})).create=function(oldUri,newUri,options,annotation){let result={kind:"rename",oldUri:oldUri,newUri:newUri};return void 0===options||void 0===options.overwrite&&void 0===options.ignoreIfExists||(result.options=options),void 0!==annotation&&(result.annotationId=annotation),result},RenameFile2.is=function(value){let candidate=value;return candidate&&"rename"===candidate.kind&&Is.string(candidate.oldUri)&&Is.string(candidate.newUri)&&(void 0===candidate.options||(void 0===candidate.options.overwrite||Is.boolean(candidate.options.overwrite))&&(void 0===candidate.options.ignoreIfExists||Is.boolean(candidate.options.ignoreIfExists)))&&(void 0===candidate.annotationId||ChangeAnnotationIdentifier.is(candidate.annotationId))},(DeleteFile2=DeleteFile||(DeleteFile={})).create=function(uri,options,annotation){let result={kind:"delete",uri:uri};return void 0===options||void 0===options.recursive&&void 0===options.ignoreIfNotExists||(result.options=options),void 0!==annotation&&(result.annotationId=annotation),result},DeleteFile2.is=function(value){let candidate=value;return candidate&&"delete"===candidate.kind&&Is.string(candidate.uri)&&(void 0===candidate.options||(void 0===candidate.options.recursive||Is.boolean(candidate.options.recursive))&&(void 0===candidate.options.ignoreIfNotExists||Is.boolean(candidate.options.ignoreIfNotExists)))&&(void 0===candidate.annotationId||ChangeAnnotationIdentifier.is(candidate.annotationId))},(WorkspaceEdit||(WorkspaceEdit={})).is=function(value){let candidate=value;return candidate&&(void 0!==candidate.changes||void 0!==candidate.documentChanges)&&(void 0===candidate.documentChanges||candidate.documentChanges.every(change=>Is.string(change.kind)?CreateFile.is(change)||RenameFile.is(change)||DeleteFile.is(change):TextDocumentEdit.is(change)))};class TextEditChangeImpl{constructor(edits,changeAnnotations){this.edits=edits,this.changeAnnotations=changeAnnotations}insert(position,newText,annotation){let edit,id;if(void 0===annotation?edit=TextEdit.insert(position,newText):ChangeAnnotationIdentifier.is(annotation)?(id=annotation,edit=AnnotatedTextEdit.insert(position,newText,annotation)):(this.assertChangeAnnotations(this.changeAnnotations),id=this.changeAnnotations.manage(annotation),edit=AnnotatedTextEdit.insert(position,newText,id)),this.edits.push(edit),void 0!==id)return id}replace(range,newText,annotation){let edit,id;if(void 0===annotation?edit=TextEdit.replace(range,newText):ChangeAnnotationIdentifier.is(annotation)?(id=annotation,edit=AnnotatedTextEdit.replace(range,newText,annotation)):(this.assertChangeAnnotations(this.changeAnnotations),id=this.changeAnnotations.manage(annotation),edit=AnnotatedTextEdit.replace(range,newText,id)),this.edits.push(edit),void 0!==id)return id}delete(range,annotation){let edit,id;if(void 0===annotation?edit=TextEdit.del(range):ChangeAnnotationIdentifier.is(annotation)?(id=annotation,edit=AnnotatedTextEdit.del(range,annotation)):(this.assertChangeAnnotations(this.changeAnnotations),id=this.changeAnnotations.manage(annotation),edit=AnnotatedTextEdit.del(range,id)),this.edits.push(edit),void 0!==id)return id}add(edit){this.edits.push(edit)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(value){if(void 0===value)throw new Error("Text edit change is not configured to manage change annotations.")}}class ChangeAnnotations{constructor(annotations){this._annotations=void 0===annotations?Object.create(null):annotations,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(idOrAnnotation,annotation){let id;if(ChangeAnnotationIdentifier.is(idOrAnnotation)?id=idOrAnnotation:(id=this.nextId(),annotation=idOrAnnotation),void 0!==this._annotations[id])throw new Error(`Id ${id} is already in use.`);if(void 0===annotation)throw new Error(`No annotation provided for id ${id}`);return this._annotations[id]=annotation,this._size++,id}nextId(){return this._counter++,this._counter.toString()}}(TextDocumentIdentifier2=TextDocumentIdentifier||(TextDocumentIdentifier={})).create=function(uri){return{uri:uri}},TextDocumentIdentifier2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.string(candidate.uri)},(VersionedTextDocumentIdentifier2=VersionedTextDocumentIdentifier||(VersionedTextDocumentIdentifier={})).create=function(uri,version){return{uri:uri,version:version}},VersionedTextDocumentIdentifier2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.string(candidate.uri)&&Is.integer(candidate.version)},(OptionalVersionedTextDocumentIdentifier2=OptionalVersionedTextDocumentIdentifier||(OptionalVersionedTextDocumentIdentifier={})).create=function(uri,version){return{uri:uri,version:version}},OptionalVersionedTextDocumentIdentifier2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.string(candidate.uri)&&(null===candidate.version||Is.integer(candidate.version))},(TextDocumentItem2=TextDocumentItem||(TextDocumentItem={})).create=function(uri,languageId,version,text){return{uri:uri,languageId:languageId,version:version,text:text}},TextDocumentItem2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.string(candidate.uri)&&Is.string(candidate.languageId)&&Is.integer(candidate.version)&&Is.string(candidate.text)},(MarkupKind2=MarkupKind||(MarkupKind={})).PlainText="plaintext",MarkupKind2.Markdown="markdown",MarkupKind2.is=function(value){const candidate=value;return candidate===MarkupKind2.PlainText||candidate===MarkupKind2.Markdown},(MarkupContent||(MarkupContent={})).is=function(value){const candidate=value;return Is.objectLiteral(value)&&MarkupKind.is(candidate.kind)&&Is.string(candidate.value)},(CompletionItemKind2=CompletionItemKind||(CompletionItemKind={})).Text=1,CompletionItemKind2.Method=2,CompletionItemKind2.Function=3,CompletionItemKind2.Constructor=4,CompletionItemKind2.Field=5,CompletionItemKind2.Variable=6,CompletionItemKind2.Class=7,CompletionItemKind2.Interface=8,CompletionItemKind2.Module=9,CompletionItemKind2.Property=10,CompletionItemKind2.Unit=11,CompletionItemKind2.Value=12,CompletionItemKind2.Enum=13,CompletionItemKind2.Keyword=14,CompletionItemKind2.Snippet=15,CompletionItemKind2.Color=16,CompletionItemKind2.File=17,CompletionItemKind2.Reference=18,CompletionItemKind2.Folder=19,CompletionItemKind2.EnumMember=20,CompletionItemKind2.Constant=21,CompletionItemKind2.Struct=22,CompletionItemKind2.Event=23,CompletionItemKind2.Operator=24,CompletionItemKind2.TypeParameter=25,(InsertTextFormat2=InsertTextFormat||(InsertTextFormat={})).PlainText=1,InsertTextFormat2.Snippet=2,(CompletionItemTag||(CompletionItemTag={})).Deprecated=1,(InsertReplaceEdit2=InsertReplaceEdit||(InsertReplaceEdit={})).create=function(newText,insert,replace){return{newText:newText,insert:insert,replace:replace}},InsertReplaceEdit2.is=function(value){const candidate=value;return candidate&&Is.string(candidate.newText)&&Range.is(candidate.insert)&&Range.is(candidate.replace)},(InsertTextMode2=InsertTextMode||(InsertTextMode={})).asIs=1,InsertTextMode2.adjustIndentation=2,(CompletionItemLabelDetails||(CompletionItemLabelDetails={})).is=function(value){const candidate=value;return candidate&&(Is.string(candidate.detail)||void 0===candidate.detail)&&(Is.string(candidate.description)||void 0===candidate.description)},(CompletionItem||(CompletionItem={})).create=function(label){return{label:label}},(CompletionList||(CompletionList={})).create=function(items,isIncomplete){return{items:items||[],isIncomplete:!!isIncomplete}},(MarkedString2=MarkedString||(MarkedString={})).fromPlainText=function(plainText){return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")},MarkedString2.is=function(value){const candidate=value;return Is.string(candidate)||Is.objectLiteral(candidate)&&Is.string(candidate.language)&&Is.string(candidate.value)},(Hover||(Hover={})).is=function(value){let candidate=value;return!!candidate&&Is.objectLiteral(candidate)&&(MarkupContent.is(candidate.contents)||MarkedString.is(candidate.contents)||Is.typedArray(candidate.contents,MarkedString.is))&&(void 0===value.range||Range.is(value.range))},(ParameterInformation||(ParameterInformation={})).create=function(label,documentation){return documentation?{label:label,documentation:documentation}:{label:label}},(SignatureInformation||(SignatureInformation={})).create=function(label,documentation,...parameters){let result={label:label};return Is.defined(documentation)&&(result.documentation=documentation),Is.defined(parameters)?result.parameters=parameters:result.parameters=[],result},(DocumentHighlightKind2=DocumentHighlightKind||(DocumentHighlightKind={})).Text=1,DocumentHighlightKind2.Read=2,DocumentHighlightKind2.Write=3,(DocumentHighlight||(DocumentHighlight={})).create=function(range,kind){let result={range:range};return Is.number(kind)&&(result.kind=kind),result},(SymbolKind2=SymbolKind||(SymbolKind={})).File=1,SymbolKind2.Module=2,SymbolKind2.Namespace=3,SymbolKind2.Package=4,SymbolKind2.Class=5,SymbolKind2.Method=6,SymbolKind2.Property=7,SymbolKind2.Field=8,SymbolKind2.Constructor=9,SymbolKind2.Enum=10,SymbolKind2.Interface=11,SymbolKind2.Function=12,SymbolKind2.Variable=13,SymbolKind2.Constant=14,SymbolKind2.String=15,SymbolKind2.Number=16,SymbolKind2.Boolean=17,SymbolKind2.Array=18,SymbolKind2.Object=19,SymbolKind2.Key=20,SymbolKind2.Null=21,SymbolKind2.EnumMember=22,SymbolKind2.Struct=23,SymbolKind2.Event=24,SymbolKind2.Operator=25,SymbolKind2.TypeParameter=26,(SymbolTag||(SymbolTag={})).Deprecated=1,(SymbolInformation||(SymbolInformation={})).create=function(name,kind,range,uri,containerName){let result={name:name,kind:kind,location:{uri:uri,range:range}};return containerName&&(result.containerName=containerName),result},(WorkspaceSymbol||(WorkspaceSymbol={})).create=function(name,kind,uri,range){return void 0!==range?{name:name,kind:kind,location:{uri:uri,range:range}}:{name:name,kind:kind,location:{uri:uri}}},(DocumentSymbol2=DocumentSymbol||(DocumentSymbol={})).create=function(name,detail,kind,range,selectionRange,children){let result={name:name,detail:detail,kind:kind,range:range,selectionRange:selectionRange};return void 0!==children&&(result.children=children),result},DocumentSymbol2.is=function(value){let candidate=value;return candidate&&Is.string(candidate.name)&&Is.number(candidate.kind)&&Range.is(candidate.range)&&Range.is(candidate.selectionRange)&&(void 0===candidate.detail||Is.string(candidate.detail))&&(void 0===candidate.deprecated||Is.boolean(candidate.deprecated))&&(void 0===candidate.children||Array.isArray(candidate.children))&&(void 0===candidate.tags||Array.isArray(candidate.tags))},(CodeActionKind2=CodeActionKind||(CodeActionKind={})).Empty="",CodeActionKind2.QuickFix="quickfix",CodeActionKind2.Refactor="refactor",CodeActionKind2.RefactorExtract="refactor.extract",CodeActionKind2.RefactorInline="refactor.inline",CodeActionKind2.RefactorRewrite="refactor.rewrite",CodeActionKind2.Source="source",CodeActionKind2.SourceOrganizeImports="source.organizeImports",CodeActionKind2.SourceFixAll="source.fixAll",(CodeActionTriggerKind2=CodeActionTriggerKind||(CodeActionTriggerKind={})).Invoked=1,CodeActionTriggerKind2.Automatic=2,(CodeActionContext2=CodeActionContext||(CodeActionContext={})).create=function(diagnostics,only,triggerKind){let result={diagnostics:diagnostics};return null!=only&&(result.only=only),null!=triggerKind&&(result.triggerKind=triggerKind),result},CodeActionContext2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.typedArray(candidate.diagnostics,Diagnostic.is)&&(void 0===candidate.only||Is.typedArray(candidate.only,Is.string))&&(void 0===candidate.triggerKind||candidate.triggerKind===CodeActionTriggerKind.Invoked||candidate.triggerKind===CodeActionTriggerKind.Automatic)},(CodeAction2=CodeAction||(CodeAction={})).create=function(title,kindOrCommandOrEdit,kind){let result={title:title},checkKind=!0;return"string"==typeof kindOrCommandOrEdit?(checkKind=!1,result.kind=kindOrCommandOrEdit):Command.is(kindOrCommandOrEdit)?result.command=kindOrCommandOrEdit:result.edit=kindOrCommandOrEdit,checkKind&&void 0!==kind&&(result.kind=kind),result},CodeAction2.is=function(value){let candidate=value;return candidate&&Is.string(candidate.title)&&(void 0===candidate.diagnostics||Is.typedArray(candidate.diagnostics,Diagnostic.is))&&(void 0===candidate.kind||Is.string(candidate.kind))&&(void 0!==candidate.edit||void 0!==candidate.command)&&(void 0===candidate.command||Command.is(candidate.command))&&(void 0===candidate.isPreferred||Is.boolean(candidate.isPreferred))&&(void 0===candidate.edit||WorkspaceEdit.is(candidate.edit))},(CodeLens2=CodeLens||(CodeLens={})).create=function(range,data){let result={range:range};return Is.defined(data)&&(result.data=data),result},CodeLens2.is=function(value){let candidate=value;return Is.defined(candidate)&&Range.is(candidate.range)&&(Is.undefined(candidate.command)||Command.is(candidate.command))},(FormattingOptions2=FormattingOptions||(FormattingOptions={})).create=function(tabSize,insertSpaces){return{tabSize:tabSize,insertSpaces:insertSpaces}},FormattingOptions2.is=function(value){let candidate=value;return Is.defined(candidate)&&Is.uinteger(candidate.tabSize)&&Is.boolean(candidate.insertSpaces)},(DocumentLink2=DocumentLink||(DocumentLink={})).create=function(range,target,data){return{range:range,target:target,data:data}},DocumentLink2.is=function(value){let candidate=value;return Is.defined(candidate)&&Range.is(candidate.range)&&(Is.undefined(candidate.target)||Is.string(candidate.target))},(SelectionRange2=SelectionRange||(SelectionRange={})).create=function(range,parent){return{range:range,parent:parent}},SelectionRange2.is=function(value){let candidate=value;return Is.objectLiteral(candidate)&&Range.is(candidate.range)&&(void 0===candidate.parent||SelectionRange2.is(candidate.parent))},(SemanticTokenTypes2=SemanticTokenTypes||(SemanticTokenTypes={})).namespace="namespace",SemanticTokenTypes2.type="type",SemanticTokenTypes2.class="class",SemanticTokenTypes2.enum="enum",SemanticTokenTypes2.interface="interface",SemanticTokenTypes2.struct="struct",SemanticTokenTypes2.typeParameter="typeParameter",SemanticTokenTypes2.parameter="parameter",SemanticTokenTypes2.variable="variable",SemanticTokenTypes2.property="property",SemanticTokenTypes2.enumMember="enumMember",SemanticTokenTypes2.event="event",SemanticTokenTypes2.function="function",SemanticTokenTypes2.method="method",SemanticTokenTypes2.macro="macro",SemanticTokenTypes2.keyword="keyword",SemanticTokenTypes2.modifier="modifier",SemanticTokenTypes2.comment="comment",SemanticTokenTypes2.string="string",SemanticTokenTypes2.number="number",SemanticTokenTypes2.regexp="regexp",SemanticTokenTypes2.operator="operator",SemanticTokenTypes2.decorator="decorator",(SemanticTokenModifiers2=SemanticTokenModifiers||(SemanticTokenModifiers={})).declaration="declaration",SemanticTokenModifiers2.definition="definition",SemanticTokenModifiers2.readonly="readonly",SemanticTokenModifiers2.static="static",SemanticTokenModifiers2.deprecated="deprecated",SemanticTokenModifiers2.abstract="abstract",SemanticTokenModifiers2.async="async",SemanticTokenModifiers2.modification="modification",SemanticTokenModifiers2.documentation="documentation",SemanticTokenModifiers2.defaultLibrary="defaultLibrary",(SemanticTokens||(SemanticTokens={})).is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&(void 0===candidate.resultId||"string"==typeof candidate.resultId)&&Array.isArray(candidate.data)&&(0===candidate.data.length||"number"==typeof candidate.data[0])},(InlineValueText2=InlineValueText||(InlineValueText={})).create=function(range,text){return{range:range,text:text}},InlineValueText2.is=function(value){const candidate=value;return null!=candidate&&Range.is(candidate.range)&&Is.string(candidate.text)},(InlineValueVariableLookup2=InlineValueVariableLookup||(InlineValueVariableLookup={})).create=function(range,variableName,caseSensitiveLookup){return{range:range,variableName:variableName,caseSensitiveLookup:caseSensitiveLookup}},InlineValueVariableLookup2.is=function(value){const candidate=value;return null!=candidate&&Range.is(candidate.range)&&Is.boolean(candidate.caseSensitiveLookup)&&(Is.string(candidate.variableName)||void 0===candidate.variableName)},(InlineValueEvaluatableExpression2=InlineValueEvaluatableExpression||(InlineValueEvaluatableExpression={})).create=function(range,expression){return{range:range,expression:expression}},InlineValueEvaluatableExpression2.is=function(value){const candidate=value;return null!=candidate&&Range.is(candidate.range)&&(Is.string(candidate.expression)||void 0===candidate.expression)},(InlineValueContext2=InlineValueContext||(InlineValueContext={})).create=function(frameId,stoppedLocation){return{frameId:frameId,stoppedLocation:stoppedLocation}},InlineValueContext2.is=function(value){const candidate=value;return Is.defined(candidate)&&Range.is(value.stoppedLocation)},(InlayHintKind2=InlayHintKind||(InlayHintKind={})).Type=1,InlayHintKind2.Parameter=2,InlayHintKind2.is=function(value){return 1===value||2===value},(InlayHintLabelPart2=InlayHintLabelPart||(InlayHintLabelPart={})).create=function(value){return{value:value}},InlayHintLabelPart2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&(void 0===candidate.tooltip||Is.string(candidate.tooltip)||MarkupContent.is(candidate.tooltip))&&(void 0===candidate.location||Location.is(candidate.location))&&(void 0===candidate.command||Command.is(candidate.command))},(InlayHint2=InlayHint||(InlayHint={})).create=function(position,label,kind){const result={position:position,label:label};return void 0!==kind&&(result.kind=kind),result},InlayHint2.is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&Position.is(candidate.position)&&(Is.string(candidate.label)||Is.typedArray(candidate.label,InlayHintLabelPart.is))&&(void 0===candidate.kind||InlayHintKind.is(candidate.kind))&&void 0===candidate.textEdits||Is.typedArray(candidate.textEdits,TextEdit.is)&&(void 0===candidate.tooltip||Is.string(candidate.tooltip)||MarkupContent.is(candidate.tooltip))&&(void 0===candidate.paddingLeft||Is.boolean(candidate.paddingLeft))&&(void 0===candidate.paddingRight||Is.boolean(candidate.paddingRight))},(StringValue||(StringValue={})).createSnippet=function(value){return{kind:"snippet",value:value}},(InlineCompletionItem||(InlineCompletionItem={})).create=function(insertText,filterText,range,command){return{insertText:insertText,filterText:filterText,range:range,command:command}},(InlineCompletionList||(InlineCompletionList={})).create=function(items){return{items:items}},(InlineCompletionTriggerKind2=InlineCompletionTriggerKind||(InlineCompletionTriggerKind={})).Invoked=0,InlineCompletionTriggerKind2.Automatic=1,(SelectedCompletionInfo||(SelectedCompletionInfo={})).create=function(range,text){return{range:range,text:text}},(InlineCompletionContext||(InlineCompletionContext={})).create=function(triggerKind,selectedCompletionInfo){return{triggerKind:triggerKind,selectedCompletionInfo:selectedCompletionInfo}},(WorkspaceFolder||(WorkspaceFolder={})).is=function(value){const candidate=value;return Is.objectLiteral(candidate)&&URI$1.is(candidate.uri)&&Is.string(candidate.name)};var TextDocument$1;!function(TextDocument2){function mergeSort2(data,compare){if(data.length<=1)return data;const p=data.length/2|0,left=data.slice(0,p),right=data.slice(p);mergeSort2(left,compare),mergeSort2(right,compare);let leftIdx=0,rightIdx=0,i=0;for(;leftIdx<left.length&&rightIdx<right.length;){let ret=compare(left[leftIdx],right[rightIdx]);data[i++]=ret<=0?left[leftIdx++]:right[rightIdx++]}for(;leftIdx<left.length;)data[i++]=left[leftIdx++];for(;rightIdx<right.length;)data[i++]=right[rightIdx++];return data}TextDocument2.create=function(uri,languageId,version,content){return new FullTextDocument$1(uri,languageId,version,content)},TextDocument2.is=function(value){let candidate=value;return!!(Is.defined(candidate)&&Is.string(candidate.uri)&&(Is.undefined(candidate.languageId)||Is.string(candidate.languageId))&&Is.uinteger(candidate.lineCount)&&Is.func(candidate.getText)&&Is.func(candidate.positionAt)&&Is.func(candidate.offsetAt))},TextDocument2.applyEdits=function(document,edits){let text=document.getText(),sortedEdits=mergeSort2(edits,(a,b)=>{let diff=a.range.start.line-b.range.start.line;return 0===diff?a.range.start.character-b.range.start.character:diff}),lastModifiedOffset=text.length;for(let i=sortedEdits.length-1;i>=0;i--){let e=sortedEdits[i],startOffset=document.offsetAt(e.range.start),endOffset=document.offsetAt(e.range.end);if(!(endOffset<=lastModifiedOffset))throw new Error("Overlapping edit");text=text.substring(0,startOffset)+e.newText+text.substring(endOffset,text.length),lastModifiedOffset=startOffset}return text}}(TextDocument$1||(TextDocument$1={}));let FullTextDocument$1=class{constructor(uri,languageId,version,content){this._uri=uri,this._languageId=languageId,this._version=version,this._content=content,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(range){if(range){let start=this.offsetAt(range.start),end=this.offsetAt(range.end);return this._content.substring(start,end)}return this._content}update(event,version){this._content=event.text,this._version=version,this._lineOffsets=void 0}getLineOffsets(){if(void 0===this._lineOffsets){let lineOffsets=[],text=this._content,isLineStart=!0;for(let i=0;i<text.length;i++){isLineStart&&(lineOffsets.push(i),isLineStart=!1);let ch=text.charAt(i);isLineStart="\r"===ch||"\n"===ch,"\r"===ch&&i+1<text.length&&"\n"===text.charAt(i+1)&&i++}isLineStart&&text.length>0&&lineOffsets.push(text.length),this._lineOffsets=lineOffsets}return this._lineOffsets}positionAt(offset){offset=Math.max(Math.min(offset,this._content.length),0);let lineOffsets=this.getLineOffsets(),low=0,high=lineOffsets.length;if(0===high)return Position.create(0,offset);for(;low<high;){let mid=Math.floor((low+high)/2);lineOffsets[mid]>offset?high=mid:low=mid+1}let line=low-1;return Position.create(line,offset-lineOffsets[line])}offsetAt(position){let lineOffsets=this.getLineOffsets();if(position.line>=lineOffsets.length)return this._content.length;if(position.line<0)return 0;let lineOffset=lineOffsets[position.line],nextLineOffset=position.line+1<lineOffsets.length?lineOffsets[position.line+1]:this._content.length;return Math.max(Math.min(lineOffset+position.character,nextLineOffset),lineOffset)}get lineCount(){return this.getLineOffsets().length}};var Is;!function(Is2){const toString2=Object.prototype.toString;Is2.defined=function(value){return void 0!==value},Is2.undefined=function(value){return void 0===value},Is2.boolean=function(value){return!0===value||!1===value},Is2.string=function(value){return"[object String]"===toString2.call(value)},Is2.number=function(value){return"[object Number]"===toString2.call(value)},Is2.numberRange=function(value,min2,max){return"[object Number]"===toString2.call(value)&&min2<=value&&value<=max},Is2.integer=function(value){return"[object Number]"===toString2.call(value)&&-2147483648<=value&&value<=2147483647},Is2.uinteger=function(value){return"[object Number]"===toString2.call(value)&&0<=value&&value<=2147483647},Is2.func=function(value){return"[object Function]"===toString2.call(value)},Is2.objectLiteral=function(value){return null!==value&&"object"==typeof value},Is2.typedArray=function(value,check){return Array.isArray(value)&&value.every(check)}}(Is||(Is={}));const main$2=Object.freeze(Object.defineProperty({__proto__:null,get AnnotatedTextEdit(){return AnnotatedTextEdit},get ChangeAnnotation(){return ChangeAnnotation},get ChangeAnnotationIdentifier(){return ChangeAnnotationIdentifier},get CodeAction(){return CodeAction},get CodeActionContext(){return CodeActionContext},get CodeActionKind(){return CodeActionKind},get CodeActionTriggerKind(){return CodeActionTriggerKind},get CodeDescription(){return CodeDescription},get CodeLens(){return CodeLens},get Color(){return Color},get ColorInformation(){return ColorInformation},get ColorPresentation(){return ColorPresentation},get Command(){return Command},get CompletionItem(){return CompletionItem},get CompletionItemKind(){return CompletionItemKind},get CompletionItemLabelDetails(){return CompletionItemLabelDetails},get CompletionItemTag(){return CompletionItemTag},get CompletionList(){return CompletionList},get CreateFile(){return CreateFile},get DeleteFile(){return DeleteFile},get Diagnostic(){return Diagnostic},get DiagnosticRelatedInformation(){return DiagnosticRelatedInformation},get DiagnosticSeverity(){return DiagnosticSeverity},get DiagnosticTag(){return DiagnosticTag},get DocumentHighlight(){return DocumentHighlight},get DocumentHighlightKind(){return DocumentHighlightKind},get DocumentLink(){return DocumentLink},get DocumentSymbol(){return DocumentSymbol},get DocumentUri(){return DocumentUri},EOL:["\n","\r\n","\r"],get FoldingRange(){return FoldingRange},get FoldingRangeKind(){return FoldingRangeKind},get FormattingOptions(){return FormattingOptions},get Hover(){return Hover},get InlayHint(){return InlayHint},get InlayHintKind(){return InlayHintKind},get InlayHintLabelPart(){return InlayHintLabelPart},get InlineCompletionContext(){return InlineCompletionContext},get InlineCompletionItem(){return InlineCompletionItem},get InlineCompletionList(){return InlineCompletionList},get InlineCompletionTriggerKind(){return InlineCompletionTriggerKind},get InlineValueContext(){return InlineValueContext},get InlineValueEvaluatableExpression(){return InlineValueEvaluatableExpression},get InlineValueText(){return InlineValueText},get InlineValueVariableLookup(){return InlineValueVariableLookup},get InsertReplaceEdit(){return InsertReplaceEdit},get InsertTextFormat(){return InsertTextFormat},get InsertTextMode(){return InsertTextMode},get Location(){return Location},get LocationLink(){return LocationLink},get MarkedString(){return MarkedString},get MarkupContent(){return MarkupContent},get MarkupKind(){return MarkupKind},get OptionalVersionedTextDocumentIdentifier(){return OptionalVersionedTextDocumentIdentifier},get ParameterInformation(){return ParameterInformation},get Position(){return Position},get Range(){return Range},get RenameFile(){return RenameFile},get SelectedCompletionInfo(){return SelectedCompletionInfo},get SelectionRange(){return SelectionRange},get SemanticTokenModifiers(){return SemanticTokenModifiers},get SemanticTokenTypes(){return SemanticTokenTypes},get SemanticTokens(){return SemanticTokens},get SignatureInformation(){return SignatureInformation},get StringValue(){return StringValue},get SymbolInformation(){return SymbolInformation},get SymbolKind(){return SymbolKind},get SymbolTag(){return SymbolTag},get TextDocument(){return TextDocument$1},get TextDocumentEdit(){return TextDocumentEdit},get TextDocumentIdentifier(){return TextDocumentIdentifier},get TextDocumentItem(){return TextDocumentItem},get TextEdit(){return TextEdit},get URI(){return URI$1},get VersionedTextDocumentIdentifier(){return VersionedTextDocumentIdentifier},WorkspaceChange:class{constructor(workspaceEdit){this._textEditChanges=Object.create(null),void 0!==workspaceEdit?(this._workspaceEdit=workspaceEdit,workspaceEdit.documentChanges?(this._changeAnnotations=new ChangeAnnotations(workspaceEdit.changeAnnotations),workspaceEdit.changeAnnotations=this._changeAnnotations.all(),workspaceEdit.documentChanges.forEach(change=>{if(TextDocumentEdit.is(change)){const textEditChange=new TextEditChangeImpl(change.edits,this._changeAnnotations);this._textEditChanges[change.textDocument.uri]=textEditChange}})):workspaceEdit.changes&&Object.keys(workspaceEdit.changes).forEach(key=>{const textEditChange=new TextEditChangeImpl(workspaceEdit.changes[key]);this._textEditChanges[key]=textEditChange})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),void 0!==this._changeAnnotations&&(0===this._changeAnnotations.size?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(key){if(OptionalVersionedTextDocumentIdentifier.is(key)){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");const textDocument={uri:key.uri,version:key.version};let result=this._textEditChanges[textDocument.uri];if(!result){const edits=[],textDocumentEdit={textDocument:textDocument,edits:edits};this._workspaceEdit.documentChanges.push(textDocumentEdit),result=new TextEditChangeImpl(edits,this._changeAnnotations),this._textEditChanges[textDocument.uri]=result}return result}{if(this.initChanges(),void 0===this._workspaceEdit.changes)throw new Error("Workspace edit is not configured for normal text edit changes.");let result=this._textEditChanges[key];if(!result){let edits=[];this._workspaceEdit.changes[key]=edits,result=new TextEditChangeImpl(edits),this._textEditChanges[key]=result}return result}}initDocumentChanges(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._changeAnnotations=new ChangeAnnotations,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._workspaceEdit.changes=Object.create(null))}createFile(uri,optionsOrAnnotation,options){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let annotation,operation,id;if(ChangeAnnotation.is(optionsOrAnnotation)||ChangeAnnotationIdentifier.is(optionsOrAnnotation)?annotation=optionsOrAnnotation:options=optionsOrAnnotation,void 0===annotation?operation=CreateFile.create(uri,options):(id=ChangeAnnotationIdentifier.is(annotation)?annotation:this._changeAnnotations.manage(annotation),operation=CreateFile.create(uri,options,id)),this._workspaceEdit.documentChanges.push(operation),void 0!==id)return id}renameFile(oldUri,newUri,optionsOrAnnotation,options){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let annotation,operation,id;if(ChangeAnnotation.is(optionsOrAnnotation)||ChangeAnnotationIdentifier.is(optionsOrAnnotation)?annotation=optionsOrAnnotation:options=optionsOrAnnotation,void 0===annotation?operation=RenameFile.create(oldUri,newUri,options):(id=ChangeAnnotationIdentifier.is(annotation)?annotation:this._changeAnnotations.manage(annotation),operation=RenameFile.create(oldUri,newUri,options,id)),this._workspaceEdit.documentChanges.push(operation),void 0!==id)return id}deleteFile(uri,optionsOrAnnotation,options){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let annotation,operation,id;if(ChangeAnnotation.is(optionsOrAnnotation)||ChangeAnnotationIdentifier.is(optionsOrAnnotation)?annotation=optionsOrAnnotation:options=optionsOrAnnotation,void 0===annotation?operation=DeleteFile.create(uri,options):(id=ChangeAnnotationIdentifier.is(annotation)?annotation:this._changeAnnotations.manage(annotation),operation=DeleteFile.create(uri,options,id)),this._workspaceEdit.documentChanges.push(operation),void 0!==id)return id}},get WorkspaceEdit(){return WorkspaceEdit},get WorkspaceFolder(){return WorkspaceFolder},get WorkspaceSymbol(){return WorkspaceSymbol},get integer(){return integer},get uinteger(){return uinteger}},Symbol.toStringTag,{value:"Module"}));class CstNodeBuilder{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(input){return this.rootNode=new RootCstNodeImpl(input),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(feature){const compositeNode=new CompositeCstNodeImpl;return compositeNode.grammarSource=feature,compositeNode.root=this.rootNode,this.current.content.push(compositeNode),this.nodeStack.push(compositeNode),compositeNode}buildLeafNode(token,feature){const leafNode=new LeafCstNodeImpl(token.startOffset,token.image.length,tokenToRange(token),token.tokenType,!feature);return leafNode.grammarSource=feature,leafNode.root=this.rootNode,this.current.content.push(leafNode),leafNode}removeNode(node){const parent=node.container;if(parent){const index=parent.content.indexOf(node);index>=0&&parent.content.splice(index,1)}}addHiddenNodes(tokens){const nodes=[];for(const token of tokens){const leafNode=new LeafCstNodeImpl(token.startOffset,token.image.length,tokenToRange(token),token.tokenType,!0);leafNode.root=this.rootNode,nodes.push(leafNode)}let current=this.current,added=!1;if(current.content.length>0)current.content.push(...nodes);else{for(;current.container;){const index=current.container.content.indexOf(current);if(index>0){current.container.content.splice(index,0,...nodes),added=!0;break}current=current.container}added||this.rootNode.content.unshift(...nodes)}}construct(item){const current=this.current;"string"!=typeof item.$type||item.$infixName||(this.current.astNode=item),item.$cstNode=current;const node=this.nodeStack.pop();0===(null==node?void 0:node.content.length)&&this.removeNode(node)}}class AbstractCstNode{get hidden(){return!1}get astNode(){var _a2,_b2;const node="string"==typeof(null==(_a2=this._astNode)?void 0:_a2.$type)?this._astNode:null==(_b2=this.container)?void 0:_b2.astNode;if(!node)throw new Error("This node has no associated AST element");return node}set astNode(value){this._astNode=value}get text(){return this.root.fullText.substring(this.offset,this.end)}}class LeafCstNodeImpl extends AbstractCstNode{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(offset,length,range,tokenType,hidden=!1){super(),this._hidden=hidden,this._offset=offset,this._tokenType=tokenType,this._length=length,this._range=range}}class CompositeCstNodeImpl extends AbstractCstNode{constructor(){super(...arguments),this.content=new CstNodeContainer(this)}get offset(){var _a2;return(null==(_a2=this.firstNonHiddenNode)?void 0:_a2.offset)??0}get length(){return this.end-this.offset}get end(){var _a2;return(null==(_a2=this.lastNonHiddenNode)?void 0:_a2.end)??0}get range(){const firstNode=this.firstNonHiddenNode,lastNode=this.lastNonHiddenNode;if(firstNode&&lastNode){if(void 0===this._rangeCache){const{range:firstRange}=firstNode,{range:lastRange}=lastNode;this._rangeCache={start:firstRange.start,end:lastRange.end.line<firstRange.start.line?firstRange.start:lastRange.end}}return this._rangeCache}return{start:Position.create(0,0),end:Position.create(0,0)}}get firstNonHiddenNode(){for(const child of this.content)if(!child.hidden)return child;return this.content[0]}get lastNonHiddenNode(){for(let i=this.content.length-1;i>=0;i--){const child=this.content[i];if(!child.hidden)return child}return this.content[this.content.length-1]}}class CstNodeContainer extends Array{constructor(parent){super(),this.parent=parent,Object.setPrototypeOf(this,CstNodeContainer.prototype)}push(...items){return this.addParents(items),super.push(...items)}unshift(...items){return this.addParents(items),super.unshift(...items)}splice(start,count,...items){return this.addParents(items),super.splice(start,count,...items)}addParents(items){for(const item of items)item.container=this.parent}}class RootCstNodeImpl extends CompositeCstNodeImpl{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(input){super(),this._text="",this._text=input??""}}const DatatypeSymbol=Symbol("Datatype");function isDataTypeNode(node){return node.$type===DatatypeSymbol}const withRuleSuffix=name=>name.endsWith("​")?name:name+"​";class AbstractLangiumParser{constructor(services){var _a2;this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=services.parser.Lexer;const tokens=this.lexer.definition,production="production"===services.LanguageMetaData.mode;(null==(_a2=services.shared.profilers.LangiumProfiler)?void 0:_a2.isActive("parsing"))?this.wrapper=new ProfilerWrapper(tokens,{...services.parser.ParserConfig,skipValidations:production,errorMessageProvider:services.parser.ParserErrorMessageProvider},services.shared.profilers.LangiumProfiler.createTask("parsing",services.LanguageMetaData.languageId)):this.wrapper=new ChevrotainWrapper(tokens,{...services.parser.ParserConfig,skipValidations:production,errorMessageProvider:services.parser.ParserErrorMessageProvider})}alternatives(idx,choices){this.wrapper.wrapOr(idx,choices)}optional(idx,callback){this.wrapper.wrapOption(idx,callback)}many(idx,callback){this.wrapper.wrapMany(idx,callback)}atLeastOne(idx,callback){this.wrapper.wrapAtLeastOne(idx,callback)}getRule(name){return this.allRules.get(name)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}}class LangiumParser extends AbstractLangiumParser{get current(){return this.stack[this.stack.length-1]}constructor(services){super(services),this.nodeBuilder=new CstNodeBuilder,this.stack=[],this.assignmentMap=new Map,this.operatorPrecedence=new Map,this.linker=services.references.Linker,this.converter=services.parser.ValueConverter,this.astReflection=services.shared.AstReflection}rule(rule,impl){const type=this.computeRuleType(rule);let infixName;isInfixRule(rule)&&(infixName=rule.name,this.registerPrecedenceMap(rule));const ruleMethod=this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name),this.startImplementation(type,infixName,impl).bind(this));return this.allRules.set(rule.name,ruleMethod),isParserRule(rule)&&rule.entry&&(this.mainRule=ruleMethod),ruleMethod}registerPrecedenceMap(rule){const name=rule.name,map2=new Map;for(let i=0;i<rule.operators.precedences.length;i++){const precedence=rule.operators.precedences[i];for(const keyword of precedence.operators)map2.set(keyword.value,{precedence:i,rightAssoc:"right"===precedence.associativity})}this.operatorPrecedence.set(name,map2)}computeRuleType(rule){return isInfixRule(rule)?getTypeName(rule):rule.fragment?void 0:isDataTypeRule(rule)?DatatypeSymbol:getTypeName(rule)}parse(input,options={}){this.nodeBuilder.buildRootNode(input);const lexerResult=this.lexerResult=this.lexer.tokenize(input);this.wrapper.input=lexerResult.tokens;const ruleMethod=options.rule?this.allRules.get(options.rule):this.mainRule;if(!ruleMethod)throw new Error(options.rule?`No rule found with name '${options.rule}'`:"No main rule available.");const result=this.doParse(ruleMethod);return this.nodeBuilder.addHiddenNodes(lexerResult.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,linkContentToContainer(result,{deep:!0}),{value:result,lexerErrors:lexerResult.errors,lexerReport:lexerResult.report,parserErrors:this.wrapper.errors}}doParse(rule){let result=this.wrapper.rule(rule);if(this.stack.length>0&&(result=this.construct()),void 0===result)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return result}startImplementation($type,infixName,implementation){return args=>{const createNode=!this.isRecording()&&void 0!==$type;if(createNode){const node={$type:$type};this.stack.push(node),$type===DatatypeSymbol?node.value="":void 0!==infixName&&(node.$infixName=infixName)}return implementation(args),createNode?this.construct():void 0}}extractHiddenTokens(token){const hiddenTokens=this.lexerResult.hidden;if(!hiddenTokens.length)return[];const offset=token.startOffset;for(let i=0;i<hiddenTokens.length;i++){if(hiddenTokens[i].startOffset>offset)return hiddenTokens.splice(0,i)}return hiddenTokens.splice(0,hiddenTokens.length)}consume(idx,tokenType,feature){const token=this.wrapper.wrapConsume(idx,tokenType);if(!this.isRecording()&&this.isValidToken(token)){const hiddenTokens=this.extractHiddenTokens(token);this.nodeBuilder.addHiddenNodes(hiddenTokens);const leafNode=this.nodeBuilder.buildLeafNode(token,feature),{assignment:assignment,crossRef:crossRef}=this.getAssignment(feature),current=this.current;if(assignment){const convertedValue=isKeyword(feature)?token.image:this.converter.convert(token.image,leafNode);this.assign(assignment.operator,assignment.feature,convertedValue,leafNode,crossRef)}else if(isDataTypeNode(current)){let text=token.image;isKeyword(feature)||(text=this.converter.convert(text,leafNode).toString()),current.value+=text}}}isValidToken(token){return!token.isInsertedInRecovery&&!isNaN(token.startOffset)&&"number"==typeof token.endOffset&&!isNaN(token.endOffset)}subrule(idx,rule,fragment,feature,args){let cstNode,result;this.isRecording()||fragment||(cstNode=this.nodeBuilder.buildCompositeNode(feature));try{result=this.wrapper.wrapSubrule(idx,rule,args)}finally{this.isRecording()||(void 0!==result||fragment||(result=this.construct()),void 0!==result&&cstNode&&cstNode.length>0&&this.performSubruleAssignment(result,feature,cstNode))}}performSubruleAssignment(result,feature,cstNode){const{assignment:assignment,crossRef:crossRef}=this.getAssignment(feature);if(assignment)this.assign(assignment.operator,assignment.feature,result,cstNode,crossRef);else if(!assignment){const current=this.current;if(isDataTypeNode(current))current.value+=result.toString();else if("object"==typeof result&&result){const newItem=this.assignWithoutOverride(result,current);this.stack.pop(),this.stack.push(newItem)}}}action($type,action){if(!this.isRecording()){let last=this.current;if(action.feature&&action.operator){last=this.construct(),this.nodeBuilder.removeNode(last.$cstNode);this.nodeBuilder.buildCompositeNode(action).content.push(last.$cstNode);const newItem={$type:$type};this.stack.push(newItem),this.assign(action.operator,action.feature,last,last.$cstNode)}else last.$type=$type}}construct(){if(this.isRecording())return;const obj=this.stack.pop();return this.nodeBuilder.construct(obj),"$infixName"in obj?this.constructInfix(obj,this.operatorPrecedence.get(obj.$infixName)):isDataTypeNode(obj)?this.converter.convert(obj.value,obj.$cstNode):(function(reflection2,node){const typeMetaData=reflection2.getTypeMetaData(node.$type),genericNode=node;for(const property of Object.values(typeMetaData.properties))void 0!==property.defaultValue&&void 0===genericNode[property.name]&&(genericNode[property.name]=copyDefaultValue(property.defaultValue))}(this.astReflection,obj),obj)}constructInfix(obj,precedence){const parts=obj.parts;if(!Array.isArray(parts)||0===parts.length)return;const operators=obj.operators;if(!Array.isArray(operators)||parts.length<2)return parts[0];let lowestPrecedenceIdx=0,lowestPrecedenceValue=-1;for(let i=0;i<operators.length;i++){const operator=operators[i],opPrecedence=precedence.get(operator)??{precedence:1/0,rightAssoc:!1};opPrecedence.precedence>lowestPrecedenceValue?(lowestPrecedenceValue=opPrecedence.precedence,lowestPrecedenceIdx=i):opPrecedence.precedence===lowestPrecedenceValue&&(opPrecedence.rightAssoc||(lowestPrecedenceIdx=i))}const leftOperators=operators.slice(0,lowestPrecedenceIdx),rightOperators=operators.slice(lowestPrecedenceIdx+1),leftParts=parts.slice(0,lowestPrecedenceIdx+1),rightParts=parts.slice(lowestPrecedenceIdx+1),leftInfix={$infixName:obj.$infixName,$type:obj.$type,$cstNode:obj.$cstNode,parts:leftParts,operators:leftOperators},rightInfix={$infixName:obj.$infixName,$type:obj.$type,$cstNode:obj.$cstNode,parts:rightParts,operators:rightOperators},leftTree=this.constructInfix(leftInfix,precedence),rightTree=this.constructInfix(rightInfix,precedence);return{$type:obj.$type,$cstNode:obj.$cstNode,left:leftTree,operator:operators[lowestPrecedenceIdx],right:rightTree}}getAssignment(feature){if(!this.assignmentMap.has(feature)){const assignment=getContainerOfType(feature,isAssignment);this.assignmentMap.set(feature,{assignment:assignment,crossRef:assignment&&isCrossReference(assignment.terminal)?assignment.terminal.isMulti?"multi":"single":void 0})}return this.assignmentMap.get(feature)}assign(operator,feature,value,cstNode,crossRef){const obj=this.current;let item;switch(item="single"===crossRef&&"string"==typeof value?this.linker.buildReference(obj,feature,cstNode,value):"multi"===crossRef&&"string"==typeof value?this.linker.buildMultiReference(obj,feature,cstNode,value):value,operator){case"=":obj[feature]=item;break;case"?=":obj[feature]=!0;break;case"+=":Array.isArray(obj[feature])||(obj[feature]=[]),obj[feature].push(item)}}assignWithoutOverride(target,source){for(const[name,existingValue]of Object.entries(source)){const newValue=target[name];void 0===newValue?target[name]=existingValue:Array.isArray(newValue)&&Array.isArray(existingValue)&&(existingValue.push(...newValue),target[name]=existingValue)}const targetCstNode=target.$cstNode;return targetCstNode&&(targetCstNode.astNode=void 0,target.$cstNode=void 0),target}get definitionErrors(){return this.wrapper.definitionErrors}}class AbstractParserErrorMessageProvider{buildMismatchTokenMessage(options){return defaultParserErrorProvider.buildMismatchTokenMessage(options)}buildNotAllInputParsedMessage(options){return defaultParserErrorProvider.buildNotAllInputParsedMessage(options)}buildNoViableAltMessage(options){return defaultParserErrorProvider.buildNoViableAltMessage(options)}buildEarlyExitMessage(options){return defaultParserErrorProvider.buildEarlyExitMessage(options)}}class LangiumParserErrorMessageProvider extends AbstractParserErrorMessageProvider{buildMismatchTokenMessage({expected:expected,actual:actual}){return`Expecting ${expected.LABEL?"`"+expected.LABEL+"`":expected.name.endsWith(":KW")?`keyword '${expected.name.substring(0,expected.name.length-3)}'`:`token of type '${expected.name}'`} but found \`${actual.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:firstRedundant}){return`Expecting end of file but found \`${firstRedundant.image}\`.`}}class LangiumCompletionParser extends AbstractLangiumParser{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(input){this.resetState();const tokens=this.lexer.tokenize(input,{mode:"partial"});return this.tokens=tokens.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(rule,impl){const ruleMethod=this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name),this.startImplementation(impl).bind(this));return this.allRules.set(rule.name,ruleMethod),rule.entry&&(this.mainRule=ruleMethod),ruleMethod}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(implementation){return args=>{const size=this.keepStackSize();try{implementation(args)}finally{this.resetStackSize(size)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){const size=this.elementStack.length;return this.stackSize=size,size}resetStackSize(size){this.removeUnexpectedElements(),this.stackSize=size}consume(idx,tokenType,feature){this.wrapper.wrapConsume(idx,tokenType),this.isRecording()||(this.lastElementStack=[...this.elementStack,feature],this.nextTokenIndex=this.currIdx+1)}subrule(idx,rule,fragment,feature,args){this.before(feature),this.wrapper.wrapSubrule(idx,rule,args),this.after(feature)}before(element){this.isRecording()||this.elementStack.push(element)}after(element){if(!this.isRecording()){const index=this.elementStack.lastIndexOf(element);index>=0&&this.elementStack.splice(index)}}get currIdx(){return this.wrapper.currIdx}}const defaultConfig={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new LangiumParserErrorMessageProvider};class ChevrotainWrapper extends EmbeddedActionsParser{constructor(tokens,config){super(tokens,{...defaultConfig,lookaheadStrategy:config&&"maxLookahead"in config?new LLkLookaheadStrategy({maxLookahead:config.maxLookahead}):new LLStarLookaheadStrategy({logging:config.skipValidations?()=>{}:void 0}),...config})}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(name,impl,config){return this.RULE(name,impl,config)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(idx,tokenType){return this.consume(idx,tokenType,void 0)}wrapSubrule(idx,rule,args){return this.subrule(idx,rule,{ARGS:[args]})}wrapOr(idx,choices){this.or(idx,choices)}wrapOption(idx,callback){this.option(idx,callback)}wrapMany(idx,callback){this.many(idx,callback)}wrapAtLeastOne(idx,callback){this.atLeastOne(idx,callback)}rule(rule){return rule.call(this,{})}}class ProfilerWrapper extends ChevrotainWrapper{constructor(tokens,config,task){super(tokens,config),this.task=task}rule(rule){this.task.start(),this.task.startSubTask(this.ruleName(rule));try{return super.rule(rule)}finally{this.task.stopSubTask(this.ruleName(rule)),this.task.stop()}}ruleName(rule){return rule.ruleName}subrule(idx,ruleToCall,options){this.task.startSubTask(this.ruleName(ruleToCall));try{return super.subrule(idx,ruleToCall,options)}finally{this.task.stopSubTask(this.ruleName(ruleToCall))}}}function createParser(grammar,parser,tokens){return function(parserContext,grammar){const reachable=getAllReachableRules(grammar,!1),parserRules=stream(grammar.rules).filter(isParserRule).filter(rule=>reachable.has(rule));for(const rule of parserRules){const ctx={...parserContext,consume:1,optional:1,subrule:1,many:1,or:1};parserContext.parser.rule(rule,buildElement(ctx,rule.definition))}const infixRules=stream(grammar.rules).filter(isInfixRule).filter(rule=>reachable.has(rule));for(const rule of infixRules)parserContext.parser.rule(rule,buildInfixRule(parserContext,rule))}({parser:parser,tokens:tokens,ruleNames:new Map},grammar),parser}function buildInfixRule(ctx,rule){const expressionRule=rule.call.rule.ref;if(!expressionRule)throw new Error("Could not resolve reference to infix operator rule: "+rule.call.rule.$refText);if(isTerminalRule(expressionRule))throw new Error("Cannot use terminal rule in infix expression");const allKeywords=rule.operators.precedences.flatMap(e=>e.operators),outerGroup={$type:"Group",elements:[]},part1Assignment={$container:outerGroup,$type:"Assignment",feature:"parts",operator:"+=",terminal:rule.call},innerGroup={$container:outerGroup,$type:"Group",elements:[],cardinality:"*"};outerGroup.elements.push(part1Assignment,innerGroup);const operatorAssignment={$container:innerGroup,$type:"Assignment",feature:"operators",operator:"+=",terminal:{$type:"Alternatives",elements:allKeywords}},part2Assignment={...part1Assignment,$container:innerGroup};innerGroup.elements.push(operatorAssignment,part2Assignment);const orAlts=allKeywords.map(e=>ctx.tokens[e.value]).map((token,index)=>({ALT:()=>ctx.parser.consume(index,token,operatorAssignment)}));let subrule;return args=>{subrule??(subrule=getRule(ctx,expressionRule)),ctx.parser.subrule(0,subrule,!1,part1Assignment,args),ctx.parser.many(0,{DEF:()=>{ctx.parser.alternatives(0,orAlts),ctx.parser.subrule(1,subrule,!1,part2Assignment,args)}})}}function buildElement(ctx,element,ignoreGuard=!1){let method;if(isKeyword(element))method=function(ctx,keyword){const idx=ctx.consume++,token=ctx.tokens[keyword.value];if(!token)throw new Error("Could not find token for keyword: "+keyword.value);return()=>ctx.parser.consume(idx,token,keyword)}(ctx,element);else if(isAction(element))method=function(ctx,action){const actionType=getTypeName(action);return()=>ctx.parser.action(actionType,action)}(ctx,element);else if(isAssignment(element))method=buildElement(ctx,element.terminal);else if(isCrossReference(element))method=buildCrossReference(ctx,element);else if(isRuleCall(element))method=function(ctx,ruleCall){const rule=ruleCall.rule.ref;if(isAbstractParserRule(rule)){const idx=ctx.subrule++,fragment=isParserRule(rule)&&rule.fragment,predicate=ruleCall.arguments.length>0?function(rule,namedArgs){if(namedArgs.some(arg=>arg.calledByName)){const namedPredicates=namedArgs.map(arg=>{var _a2,_b2;return{parameterName:null==(_b2=null==(_a2=arg.parameter)?void 0:_a2.ref)?void 0:_b2.name,predicate:buildPredicate(arg.value)}});return args=>{const ruleArgs={};for(const{parameterName:parameterName,predicate:predicate}of namedPredicates)parameterName&&(ruleArgs[parameterName]=predicate(args));return ruleArgs}}{const predicates=namedArgs.map(arg=>buildPredicate(arg.value));return args=>{const ruleArgs={};for(let i=0;i<predicates.length;i++)if(i<rule.parameters.length){const parameterName=rule.parameters[i].name,predicate=predicates[i];ruleArgs[parameterName]=predicate(args)}return ruleArgs}}}(rule,ruleCall.arguments):()=>({});let subrule;return args=>{subrule??(subrule=getRule(ctx,rule)),ctx.parser.subrule(idx,subrule,fragment,ruleCall,predicate(args))}}if(isTerminalRule(rule)){const idx=ctx.consume++,method=getToken(ctx,rule.name);return()=>ctx.parser.consume(idx,method,ruleCall)}if(!rule)throw new ErrorWithLocation(ruleCall.$cstNode,`Undefined rule: ${ruleCall.rule.$refText}`);assertUnreachable()}(ctx,element);else if(isAlternatives(element))method=function(ctx,alternatives){if(1===alternatives.elements.length)return buildElement(ctx,alternatives.elements[0]);{const methods=[];for(const element of alternatives.elements){const predicatedMethod={ALT:buildElement(ctx,element,!0)},guard=getGuardCondition(element);guard&&(predicatedMethod.GATE=buildPredicate(guard)),methods.push(predicatedMethod)}const idx=ctx.or++;return args=>ctx.parser.alternatives(idx,methods.map(method=>{const alt={ALT:()=>method.ALT(args)},gate=method.GATE;return gate&&(alt.GATE=()=>gate(args)),alt}))}}(ctx,element);else if(isUnorderedGroup(element))method=function(ctx,group){if(1===group.elements.length)return buildElement(ctx,group.elements[0]);const methods=[];for(const element of group.elements){const predicatedMethod={ALT:buildElement(ctx,element,!0)},guard=getGuardCondition(element);guard&&(predicatedMethod.GATE=buildPredicate(guard)),methods.push(predicatedMethod)}const orIdx=ctx.or++,idFunc=(groupIdx,lParser)=>`uGroup_${groupIdx}_${lParser.getRuleStack().join("-")}`,alternatives=args=>ctx.parser.alternatives(orIdx,methods.map((method,idx)=>{const alt={ALT:()=>!0},parser=ctx.parser;alt.ALT=()=>{if(method.ALT(args),!parser.isRecording()){const key=idFunc(orIdx,parser);parser.unorderedGroups.get(key)||parser.unorderedGroups.set(key,[]);const groupState=parser.unorderedGroups.get(key);void 0===(null==groupState?void 0:groupState[idx])&&(groupState[idx]=!0)}};const gate=method.GATE;return alt.GATE=gate?()=>gate(args):()=>{const trackedAlternatives=parser.unorderedGroups.get(idFunc(orIdx,parser));return!(null==trackedAlternatives?void 0:trackedAlternatives[idx])},alt})),wrapped=wrap(ctx,getGuardCondition(group),alternatives,"*");return args=>{wrapped(args),ctx.parser.isRecording()||ctx.parser.unorderedGroups.delete(idFunc(orIdx,ctx.parser))}}(ctx,element);else if(isGroup(element))method=function(ctx,group){const methods=group.elements.map(e=>buildElement(ctx,e));return args=>methods.forEach(method=>method(args))}(ctx,element);else{if(item=element,!reflection$1.isInstance(item,EndOfFile_$type))throw new ErrorWithLocation(element.$cstNode,`Unexpected element type: ${element.$type}`);{const idx=ctx.consume++;method=()=>ctx.parser.consume(idx,EOF,element)}}var item;return wrap(ctx,ignoreGuard?void 0:getGuardCondition(element),method,element.cardinality)}function buildPredicate(condition){if(item=condition,reflection$1.isInstance(item,Disjunction_$type)){const left=buildPredicate(condition.left),right=buildPredicate(condition.right);return args=>left(args)||right(args)}if(function(item){return reflection$1.isInstance(item,Conjunction_$type)}(condition)){const left=buildPredicate(condition.left),right=buildPredicate(condition.right);return args=>left(args)&&right(args)}if(function(item){return reflection$1.isInstance(item,Negation_$type)}(condition)){const value=buildPredicate(condition.value);return args=>!value(args)}if(function(item){return reflection$1.isInstance(item,ParameterReference_$type)}(condition)){const name=condition.parameter.ref.name;return args=>void 0!==args&&!0===args[name]}if(function(item){return reflection$1.isInstance(item,BooleanLiteral_$type)}(condition)){const value=Boolean(condition.true);return()=>value}var item;assertUnreachable()}function getGuardCondition(element){if(isGroup(element))return element.guardCondition}function buildCrossReference(ctx,crossRef,terminal=crossRef.terminal){if(terminal){if(isRuleCall(terminal)&&isParserRule(terminal.rule.ref)){const rule=terminal.rule.ref,idx=ctx.subrule++;let subrule;return args=>{subrule??(subrule=getRule(ctx,rule)),ctx.parser.subrule(idx,subrule,!1,crossRef,args)}}if(isRuleCall(terminal)&&isTerminalRule(terminal.rule.ref)){const idx=ctx.consume++,terminalRule=getToken(ctx,terminal.rule.ref.name);return()=>ctx.parser.consume(idx,terminalRule,crossRef)}if(isKeyword(terminal)){const idx=ctx.consume++,keyword=getToken(ctx,terminal.value);return()=>ctx.parser.consume(idx,keyword,crossRef)}throw new Error("Could not build cross reference parser")}{if(!crossRef.type.ref)throw new Error("Could not resolve reference to type: "+crossRef.type.$refText);const assignment=findNameAssignment(crossRef.type.ref),assignTerminal=null==assignment?void 0:assignment.terminal;if(!assignTerminal)throw new Error("Could not find name assignment for type: "+getTypeName(crossRef.type.ref));return buildCrossReference(ctx,crossRef,assignTerminal)}}function wrap(ctx,guard,method,cardinality){const gate=guard&&buildPredicate(guard);if(!cardinality){if(gate){const idx=ctx.or++;return args=>ctx.parser.alternatives(idx,[{ALT:()=>method(args),GATE:()=>gate(args)},{ALT:EMPTY_ALT(),GATE:()=>!gate(args)}])}return method}if("*"===cardinality){const idx=ctx.many++;return args=>ctx.parser.many(idx,{DEF:()=>method(args),GATE:gate?()=>gate(args):void 0})}if("+"===cardinality){const idx=ctx.many++;if(gate){const orIdx=ctx.or++;return args=>ctx.parser.alternatives(orIdx,[{ALT:()=>ctx.parser.atLeastOne(idx,{DEF:()=>method(args)}),GATE:()=>gate(args)},{ALT:EMPTY_ALT(),GATE:()=>!gate(args)}])}return args=>ctx.parser.atLeastOne(idx,{DEF:()=>method(args)})}if("?"===cardinality){const idx=ctx.optional++;return args=>ctx.parser.optional(idx,{DEF:()=>method(args),GATE:gate?()=>gate(args):void 0})}assertUnreachable()}function getRule(ctx,element){const name=function(ctx,element){if(isAbstractParserRule(element))return element.name;if(ctx.ruleNames.has(element))return ctx.ruleNames.get(element);{let item=element,parent=item.$container,ruleName=element.$type;for(;!isParserRule(parent);){if(isGroup(parent)||isAlternatives(parent)||isUnorderedGroup(parent)){ruleName=parent.elements.indexOf(item).toString()+":"+ruleName}item=parent,parent=parent.$container}return ruleName=parent.name+":"+ruleName,ctx.ruleNames.set(element,ruleName),ruleName}}(ctx,element),rule=ctx.parser.getRule(name);if(!rule)throw new Error(`Rule "${name}" not found."`);return rule}function getToken(ctx,name){const token=ctx.tokens[name];if(!token)throw new Error(`Token "${name}" not found."`);return token}function createLangiumParser(services){const parser=function(services){const grammar=services.Grammar,lexer=services.parser.Lexer,parser=new LangiumParser(services);return createParser(grammar,parser,lexer.definition)}(services);return parser.finalize(),parser}class DefaultTokenBuilder{constructor(){this.diagnostics=[]}buildTokens(grammar,options){const reachableRules=stream(getAllReachableRules(grammar,!1)),terminalTokens=this.buildTerminalTokens(reachableRules),tokens=this.buildKeywordTokens(reachableRules,terminalTokens,options);return tokens.push(...terminalTokens),tokens}flushLexingReport(text){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const diagnostics=[...this.diagnostics];return this.diagnostics=[],diagnostics}buildTerminalTokens(rules){return rules.filter(isTerminalRule).filter(e=>!e.fragment).map(terminal=>this.buildTerminalToken(terminal)).toArray()}buildTerminalToken(terminal){const regex=terminalRegex(terminal),pattern=this.requiresCustomPattern(regex)?this.regexPatternFunction(regex):regex,tokenType={name:terminal.name,PATTERN:pattern};return"function"==typeof pattern&&(tokenType.LINE_BREAKS=!0),terminal.hidden&&(tokenType.GROUP=isWhitespace(regex)?Lexer.SKIPPED:"hidden"),tokenType}requiresCustomPattern(regex){return!(!regex.flags.includes("u")&&!regex.flags.includes("s"))}regexPatternFunction(regex){const stickyRegex=new RegExp(regex,regex.flags+"y");return(text,offset)=>{stickyRegex.lastIndex=offset;return stickyRegex.exec(text)}}buildKeywordTokens(rules,terminalTokens,options){return rules.filter(isAbstractParserRule).flatMap(rule=>streamAllContents(rule).filter(isKeyword)).distinct(e=>e.value).toArray().sort((a,b)=>b.value.length-a.value.length).map(keyword=>this.buildKeywordToken(keyword,terminalTokens,Boolean(null==options?void 0:options.caseInsensitive)))}buildKeywordToken(keyword,terminalTokens,caseInsensitive){const keywordPattern=this.buildKeywordPattern(keyword,caseInsensitive),tokenType={name:keyword.value,PATTERN:keywordPattern,LONGER_ALT:this.findLongerAlt(keyword,terminalTokens)};return"function"==typeof keywordPattern&&(tokenType.LINE_BREAKS=!0),tokenType}buildKeywordPattern(keyword,caseInsensitive){return caseInsensitive?new RegExp(escapeRegExp(keyword.value),"i"):keyword.value}findLongerAlt(keyword,terminalTokens){return terminalTokens.reduce((longerAlts,token)=>{const pattern=null==token?void 0:token.PATTERN;return(null==pattern?void 0:pattern.source)&&partialMatches("^"+pattern.source+"$",keyword.value)&&longerAlts.push(token),longerAlts},[])}}class DefaultValueConverter{convert(input,cstNode){let feature=cstNode.grammarSource;if(isCrossReference(feature)&&(feature=function(crossRef){if(crossRef.terminal)return crossRef.terminal;if(crossRef.type.ref){const nameAssigment=findNameAssignment(crossRef.type.ref);return null==nameAssigment?void 0:nameAssigment.terminal}}(feature)),isRuleCall(feature)){const rule=feature.rule.ref;if(!rule)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(rule,input,cstNode)}return input}runConverter(rule,input,cstNode){var _a2;switch(rule.name.toUpperCase()){case"INT":return ValueConverter.convertInt(input);case"STRING":return ValueConverter.convertString(input);case"ID":return ValueConverter.convertID(input)}switch(null==(_a2=function(rule){var _a2;return isTerminalRule(rule)?(null==(_a2=rule.type)?void 0:_a2.name)??"string":getExplicitRuleType(rule)??rule.name}(rule))?void 0:_a2.toLowerCase()){case"number":return ValueConverter.convertNumber(input);case"boolean":return ValueConverter.convertBoolean(input);case"bigint":return ValueConverter.convertBigint(input);case"date":return ValueConverter.convertDate(input);default:return input}}}var ValueConverter;!function(ValueConverter2){function convertEscapeCharacter(char){switch(char){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 char}}ValueConverter2.convertString=function(input){let result="";for(let i=1;i<input.length-1;i++){const c=input.charAt(i);if("\\"===c){result+=convertEscapeCharacter(input.charAt(++i))}else result+=c}return result},ValueConverter2.convertID=function(input){return"^"===input.charAt(0)?input.substring(1):input},ValueConverter2.convertInt=function(input){return parseInt(input)},ValueConverter2.convertBigint=function(input){return BigInt(input)},ValueConverter2.convertDate=function(input){return new Date(input)},ValueConverter2.convertNumber=function(input){return Number(input)},ValueConverter2.convertBoolean=function(input){return"true"===input.toLowerCase()}}(ValueConverter||(ValueConverter={}));var hasRequiredRal,cancellation={},ral={};function requireRal(){if(hasRequiredRal)return ral;let _ral;function RAL(){if(void 0===_ral)throw new Error("No runtime abstraction layer installed");return _ral}return hasRequiredRal=1,Object.defineProperty(ral,"__esModule",{value:!0}),(RAL||(RAL={})).install=function(ral2){if(void 0===ral2)throw new Error("No runtime abstraction layer provided");_ral=ral2},ral.default=RAL,ral}var hasRequiredIs$1,is$1={};function requireIs$1(){if(hasRequiredIs$1)return is$1;function string(value){return"string"==typeof value||value instanceof String}function array(value){return Array.isArray(value)}return hasRequiredIs$1=1,Object.defineProperty(is$1,"__esModule",{value:!0}),is$1.stringArray=is$1.array=is$1.func=is$1.error=is$1.number=is$1.string=is$1.boolean=void 0,is$1.boolean=function(value){return!0===value||!1===value},is$1.string=string,is$1.number=function(value){return"number"==typeof value||value instanceof Number},is$1.error=function(value){return value instanceof Error},is$1.func=function(value){return"function"==typeof value},is$1.array=array,is$1.stringArray=function(value){return array(value)&&value.every(elem=>string(elem))},is$1}var hasRequiredEvents,hasRequiredCancellation,events={};function requireEvents(){if(hasRequiredEvents)return events;hasRequiredEvents=1,Object.defineProperty(events,"__esModule",{value:!0}),events.Emitter=events.Event=void 0;const ral_1=requireRal();var Event;!function(Event2){const _disposable={dispose(){}};Event2.None=function(){return _disposable}}(Event||(events.Event=Event={}));class CallbackList{add(callback,context=null,bucket){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(callback),this._contexts.push(context),Array.isArray(bucket)&&bucket.push({dispose:()=>this.remove(callback,context)})}remove(callback,context=null){if(!this._callbacks)return;let foundCallbackWithDifferentContext=!1;for(let i=0,len=this._callbacks.length;i<len;i++)if(this._callbacks[i]===callback){if(this._contexts[i]===context)return this._callbacks.splice(i,1),void this._contexts.splice(i,1);foundCallbackWithDifferentContext=!0}if(foundCallbackWithDifferentContext)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...args){if(!this._callbacks)return[];const ret=[],callbacks=this._callbacks.slice(0),contexts=this._contexts.slice(0);for(let i=0,len=callbacks.length;i<len;i++)try{ret.push(callbacks[i].apply(contexts[i],args))}catch(e){(0,ral_1.default)().console.error(e)}return ret}isEmpty(){return!this._callbacks||0===this._callbacks.length}dispose(){this._callbacks=void 0,this._contexts=void 0}}class Emitter{constructor(_options){this._options=_options}get event(){return this._event||(this._event=(listener,thisArgs,disposables)=>{this._callbacks||(this._callbacks=new CallbackList),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(listener,thisArgs);const result={dispose:()=>{this._callbacks&&(this._callbacks.remove(listener,thisArgs),result.dispose=Emitter._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(disposables)&&disposables.push(result),result}),this._event}fire(event){this._callbacks&&this._callbacks.invoke.call(this._callbacks,event)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return events.Emitter=Emitter,Emitter._noop=function(){},events}function requireCancellation(){if(hasRequiredCancellation)return cancellation;hasRequiredCancellation=1,Object.defineProperty(cancellation,"__esModule",{value:!0}),cancellation.CancellationTokenSource=cancellation.CancellationToken=void 0;const ral_1=requireRal(),Is2=requireIs$1(),events_1=requireEvents();var CancellationToken,CancellationToken2;(CancellationToken2=CancellationToken||(cancellation.CancellationToken=CancellationToken={})).None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:events_1.Event.None}),CancellationToken2.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:events_1.Event.None}),CancellationToken2.is=function(value){const candidate=value;return candidate&&(candidate===CancellationToken2.None||candidate===CancellationToken2.Cancelled||Is2.boolean(candidate.isCancellationRequested)&&!!candidate.onCancellationRequested)};const shortcutEvent=Object.freeze(function(callback,context){const handle=(0,ral_1.default)().timer.setTimeout(callback.bind(context),0);return{dispose(){handle.dispose()}}});class MutableToken{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?shortcutEvent:(this._emitter||(this._emitter=new events_1.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}return cancellation.CancellationTokenSource=class{get token(){return this._token||(this._token=new MutableToken),this._token}cancel(){this._token?this._token.cancel():this._token=CancellationToken.Cancelled}dispose(){this._token?this._token instanceof MutableToken&&this._token.dispose():this._token=CancellationToken.None}},cancellation}var cancellationExports=requireCancellation();let lastTick=0;const OperationCancelled=Symbol("OperationCancelled");function isOperationCancelled(err){return err===OperationCancelled}async function interruptAndCheck(token){if(token===cancellationExports.CancellationToken.None)return;const current=performance.now();if(current-lastTick>=10&&(lastTick=current,await new Promise(resolve=>{"undefined"==typeof setImmediate?setTimeout(resolve,0):setImmediate(resolve)}),lastTick=performance.now()),token.isCancellationRequested)throw OperationCancelled}class Deferred{constructor(){this.promise=new Promise((resolve,reject)=>{this.resolve=arg=>(resolve(arg),this),this.reject=err=>(reject(err),this)})}}class FullTextDocument2{constructor(uri,languageId,version,content){this._uri=uri,this._languageId=languageId,this._version=version,this._content=content,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(range){if(range){const start=this.offsetAt(range.start),end=this.offsetAt(range.end);return this._content.substring(start,end)}return this._content}update(changes,version){for(const change of changes)if(FullTextDocument2.isIncremental(change)){const range=getWellformedRange(change.range),startOffset=this.offsetAt(range.start),endOffset=this.offsetAt(range.end);this._content=this._content.substring(0,startOffset)+change.text+this._content.substring(endOffset,this._content.length);const startLine=Math.max(range.start.line,0),endLine=Math.max(range.end.line,0);let lineOffsets=this._lineOffsets;const addedLineOffsets=computeLineOffsets(change.text,!1,startOffset);if(endLine-startLine===addedLineOffsets.length)for(let i=0,len=addedLineOffsets.length;i<len;i++)lineOffsets[i+startLine+1]=addedLineOffsets[i];else addedLineOffsets.length<1e4?lineOffsets.splice(startLine+1,endLine-startLine,...addedLineOffsets):this._lineOffsets=lineOffsets=lineOffsets.slice(0,startLine+1).concat(addedLineOffsets,lineOffsets.slice(endLine+1));const diff=change.text.length-(endOffset-startOffset);if(0!==diff)for(let i=startLine+1+addedLineOffsets.length,len=lineOffsets.length;i<len;i++)lineOffsets[i]=lineOffsets[i]+diff}else{if(!FullTextDocument2.isFull(change))throw new Error("Unknown change event received");this._content=change.text,this._lineOffsets=void 0}this._version=version}getLineOffsets(){return void 0===this._lineOffsets&&(this._lineOffsets=computeLineOffsets(this._content,!0)),this._lineOffsets}positionAt(offset){offset=Math.max(Math.min(offset,this._content.length),0);const lineOffsets=this.getLineOffsets();let low=0,high=lineOffsets.length;if(0===high)return{line:0,character:offset};for(;low<high;){const mid=Math.floor((low+high)/2);lineOffsets[mid]>offset?high=mid:low=mid+1}const line=low-1;return{line:line,character:(offset=this.ensureBeforeEOL(offset,lineOffsets[line]))-lineOffsets[line]}}offsetAt(position){const lineOffsets=this.getLineOffsets();if(position.line>=lineOffsets.length)return this._content.length;if(position.line<0)return 0;const lineOffset=lineOffsets[position.line];if(position.character<=0)return lineOffset;const nextLineOffset=position.line+1<lineOffsets.length?lineOffsets[position.line+1]:this._content.length,offset=Math.min(lineOffset+position.character,nextLineOffset);return this.ensureBeforeEOL(offset,lineOffset)}ensureBeforeEOL(offset,lineOffset){for(;offset>lineOffset&&isEOL(this._content.charCodeAt(offset-1));)offset--;return offset}get lineCount(){return this.getLineOffsets().length}static isIncremental(event){const candidate=event;return null!=candidate&&"string"==typeof candidate.text&&void 0!==candidate.range&&(void 0===candidate.rangeLength||"number"==typeof candidate.rangeLength)}static isFull(event){const candidate=event;return null!=candidate&&"string"==typeof candidate.text&&void 0===candidate.range&&void 0===candidate.rangeLength}}var TextDocument,TextDocument2,LIB;function mergeSort(data,compare){if(data.length<=1)return data;const p=data.length/2|0,left=data.slice(0,p),right=data.slice(p);mergeSort(left,compare),mergeSort(right,compare);let leftIdx=0,rightIdx=0,i=0;for(;leftIdx<left.length&&rightIdx<right.length;){const ret=compare(left[leftIdx],right[rightIdx]);data[i++]=ret<=0?left[leftIdx++]:right[rightIdx++]}for(;leftIdx<left.length;)data[i++]=left[leftIdx++];for(;rightIdx<right.length;)data[i++]=right[rightIdx++];return data}function computeLineOffsets(text,isAtLineStart,textOffset=0){const result=isAtLineStart?[textOffset]:[];for(let i=0;i<text.length;i++){const ch=text.charCodeAt(i);isEOL(ch)&&(13===ch&&i+1<text.length&&10===text.charCodeAt(i+1)&&i++,result.push(textOffset+i+1))}return result}function isEOL(char){return 13===char||10===char}function getWellformedRange(range){const start=range.start,end=range.end;return start.line>end.line||start.line===end.line&&start.character>end.character?{start:end,end:start}:range}function getWellformedEdit(textEdit){const range=getWellformedRange(textEdit.range);return range!==textEdit.range?{newText:textEdit.newText,range:range}:textEdit}(TextDocument2=TextDocument||(TextDocument={})).create=function(uri,languageId,version,content){return new FullTextDocument2(uri,languageId,version,content)},TextDocument2.update=function(document,changes,version){if(document instanceof FullTextDocument2)return document.update(changes,version),document;throw new Error("TextDocument.update: document must be created by TextDocument.create")},TextDocument2.applyEdits=function(document,edits){const text=document.getText(),sortedEdits=mergeSort(edits.map(getWellformedEdit),(a,b)=>{const diff=a.range.start.line-b.range.start.line;return 0===diff?a.range.start.character-b.range.start.character:diff});let lastModifiedOffset=0;const spans=[];for(const e of sortedEdits){const startOffset=document.offsetAt(e.range.start);if(startOffset<lastModifiedOffset)throw new Error("Overlapping edit");startOffset>lastModifiedOffset&&spans.push(text.substring(lastModifiedOffset,startOffset)),e.newText.length&&spans.push(e.newText),lastModifiedOffset=document.offsetAt(e.range.end)}return spans.push(text.substr(lastModifiedOffset)),spans.join("")},(()=>{var t={975:t2=>{function e2(t3){if("string"!=typeof t3)throw new TypeError("Path must be a string. Received "+JSON.stringify(t3))}function r2(t3,e3){for(var r3,n3="",i2=0,o2=-1,s2=0,h2=0;h2<=t3.length;++h2){if(h2<t3.length)r3=t3.charCodeAt(h2);else{if(47===r3)break;r3=47}if(47===r3){if(o2===h2-1||1===s2);else if(o2!==h2-1&&2===s2){if(n3.length<2||2!==i2||46!==n3.charCodeAt(n3.length-1)||46!==n3.charCodeAt(n3.length-2))if(n3.length>2){var a2=n3.lastIndexOf("/");if(a2!==n3.length-1){-1===a2?(n3="",i2=0):i2=(n3=n3.slice(0,a2)).length-1-n3.lastIndexOf("/"),o2=h2,s2=0;continue}}else if(2===n3.length||1===n3.length){n3="",i2=0,o2=h2,s2=0;continue}e3&&(n3.length>0?n3+="/..":n3="..",i2=2)}else n3.length>0?n3+="/"+t3.slice(o2+1,h2):n3=t3.slice(o2+1,h2),i2=h2-o2-1;o2=h2,s2=0}else 46===r3&&-1!==s2?++s2:s2=-1}return n3}var n2={resolve:function(){for(var t3,n3="",i2=!1,o2=arguments.length-1;o2>=-1&&!i2;o2--){var s2;o2>=0?s2=arguments[o2]:(void 0===t3&&(t3=process.cwd()),s2=t3),e2(s2),0!==s2.length&&(n3=s2+"/"+n3,i2=47===s2.charCodeAt(0))}return n3=r2(n3,!i2),i2?n3.length>0?"/"+n3:"/":n3.length>0?n3:"."},normalize:function(t3){if(e2(t3),0===t3.length)return".";var n3=47===t3.charCodeAt(0),i2=47===t3.charCodeAt(t3.length-1);return 0!==(t3=r2(t3,!n3)).length||n3||(t3="."),t3.length>0&&i2&&(t3+="/"),n3?"/"+t3:t3},isAbsolute:function(t3){return e2(t3),t3.length>0&&47===t3.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t3,r3=0;r3<arguments.length;++r3){var i2=arguments[r3];e2(i2),i2.length>0&&(void 0===t3?t3=i2:t3+="/"+i2)}return void 0===t3?".":n2.normalize(t3)},relative:function(t3,r3){if(e2(t3),e2(r3),t3===r3)return"";if((t3=n2.resolve(t3))===(r3=n2.resolve(r3)))return"";for(var i2=1;i2<t3.length&&47===t3.charCodeAt(i2);++i2);for(var o2=t3.length,s2=o2-i2,h2=1;h2<r3.length&&47===r3.charCodeAt(h2);++h2);for(var a2=r3.length-h2,c2=s2<a2?s2:a2,f2=-1,u2=0;u2<=c2;++u2){if(u2===c2){if(a2>c2){if(47===r3.charCodeAt(h2+u2))return r3.slice(h2+u2+1);if(0===u2)return r3.slice(h2+u2)}else s2>c2&&(47===t3.charCodeAt(i2+u2)?f2=u2:0===u2&&(f2=0));break}var l2=t3.charCodeAt(i2+u2);if(l2!==r3.charCodeAt(h2+u2))break;47===l2&&(f2=u2)}var g2="";for(u2=i2+f2+1;u2<=o2;++u2)u2!==o2&&47!==t3.charCodeAt(u2)||(0===g2.length?g2+="..":g2+="/..");return g2.length>0?g2+r3.slice(h2+f2):(h2+=f2,47===r3.charCodeAt(h2)&&++h2,r3.slice(h2))},_makeLong:function(t3){return t3},dirname:function(t3){if(e2(t3),0===t3.length)return".";for(var r3=t3.charCodeAt(0),n3=47===r3,i2=-1,o2=!0,s2=t3.length-1;s2>=1;--s2)if(47===(r3=t3.charCodeAt(s2))){if(!o2){i2=s2;break}}else o2=!1;return-1===i2?n3?"/":".":n3&&1===i2?"//":t3.slice(0,i2)},basename:function(t3,r3){if(void 0!==r3&&"string"!=typeof r3)throw new TypeError('"ext" argument must be a string');e2(t3);var n3,i2=0,o2=-1,s2=!0;if(void 0!==r3&&r3.length>0&&r3.length<=t3.length){if(r3.length===t3.length&&r3===t3)return"";var h2=r3.length-1,a2=-1;for(n3=t3.length-1;n3>=0;--n3){var c2=t3.charCodeAt(n3);if(47===c2){if(!s2){i2=n3+1;break}}else-1===a2&&(s2=!1,a2=n3+1),h2>=0&&(c2===r3.charCodeAt(h2)?-1==--h2&&(o2=n3):(h2=-1,o2=a2))}return i2===o2?o2=a2:-1===o2&&(o2=t3.length),t3.slice(i2,o2)}for(n3=t3.length-1;n3>=0;--n3)if(47===t3.charCodeAt(n3)){if(!s2){i2=n3+1;break}}else-1===o2&&(s2=!1,o2=n3+1);return-1===o2?"":t3.slice(i2,o2)},extname:function(t3){e2(t3);for(var r3=-1,n3=0,i2=-1,o2=!0,s2=0,h2=t3.length-1;h2>=0;--h2){var a2=t3.charCodeAt(h2);if(47!==a2)-1===i2&&(o2=!1,i2=h2+1),46===a2?-1===r3?r3=h2:1!==s2&&(s2=1):-1!==r3&&(s2=-1);else if(!o2){n3=h2+1;break}}return-1===r3||-1===i2||0===s2||1===s2&&r3===i2-1&&r3===n3+1?"":t3.slice(r3,i2)},format:function(t3){if(null===t3||"object"!=typeof t3)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t3);return r3=(e3=t3).dir||e3.root,n3=e3.base||(e3.name||"")+(e3.ext||""),r3?r3===e3.root?r3+n3:r3+"/"+n3:n3;var e3,r3,n3},parse:function(t3){e2(t3);var r3={root:"",dir:"",base:"",ext:"",name:""};if(0===t3.length)return r3;var n3,i2=t3.charCodeAt(0),o2=47===i2;o2?(r3.root="/",n3=1):n3=0;for(var s2=-1,h2=0,a2=-1,c2=!0,f2=t3.length-1,u2=0;f2>=n3;--f2)if(47!==(i2=t3.charCodeAt(f2)))-1===a2&&(c2=!1,a2=f2+1),46===i2?-1===s2?s2=f2:1!==u2&&(u2=1):-1!==s2&&(u2=-1);else if(!c2){h2=f2+1;break}return-1===s2||-1===a2||0===u2||1===u2&&s2===a2-1&&s2===h2+1?-1!==a2&&(r3.base=r3.name=0===h2&&o2?t3.slice(1,a2):t3.slice(h2,a2)):(0===h2&&o2?(r3.name=t3.slice(1,s2),r3.base=t3.slice(1,a2)):(r3.name=t3.slice(h2,s2),r3.base=t3.slice(h2,a2)),r3.ext=t3.slice(s2,a2)),h2>0?r3.dir=t3.slice(0,h2-1):o2&&(r3.dir="/"),r3},sep:"/",delimiter:":",win32:null,posix:null};n2.posix=n2,t2.exports=n2}},e={};function r(n2){var i2=e[n2];if(void 0!==i2)return i2.exports;var o2=e[n2]={exports:{}};return t[n2](o2,o2.exports,r),o2.exports}r.d=(t2,e2)=>{for(var n2 in e2)r.o(e2,n2)&&!r.o(t2,n2)&&Object.defineProperty(t2,n2,{enumerable:!0,get:e2[n2]})},r.o=(t2,e2)=>Object.prototype.hasOwnProperty.call(t2,e2),r.r=t2=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t2,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t2,"__esModule",{value:!0})};var n={};let i;if(r.r(n),r.d(n,{URI:()=>l,Utils:()=>I}),"object"==typeof process)i="win32"===process.platform;else if("object"==typeof navigator){let t2=navigator.userAgent;i=t2.indexOf("Windows")>=0}const o=/^\w[\w\d+.-]*$/,s=/^\//,h=/^\/\//;function a(t2,e2){if(!t2.scheme&&e2)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${t2.authority}", path: "${t2.path}", query: "${t2.query}", fragment: "${t2.fragment}"}`);if(t2.scheme&&!o.test(t2.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t2.path)if(t2.authority){if(!s.test(t2.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(h.test(t2.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}const c="",f="/",u=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class l{constructor(t2,e2,r2,n2,i2,o2=!1){__publicField(this,"scheme"),__publicField(this,"authority"),__publicField(this,"path"),__publicField(this,"query"),__publicField(this,"fragment"),"object"==typeof t2?(this.scheme=t2.scheme||c,this.authority=t2.authority||c,this.path=t2.path||c,this.query=t2.query||c,this.fragment=t2.fragment||c):(this.scheme=function(t3,e3){return t3||e3?t3:"file"}(t2,o2),this.authority=e2||c,this.path=function(t3,e3){switch(t3){case"https":case"http":case"file":e3?e3[0]!==f&&(e3=f+e3):e3=f}return e3}(this.scheme,r2||c),this.query=n2||c,this.fragment=i2||c,a(this,o2))}static isUri(t2){return t2 instanceof l||!!t2&&"string"==typeof t2.authority&&"string"==typeof t2.fragment&&"string"==typeof t2.path&&"string"==typeof t2.query&&"string"==typeof t2.scheme&&"string"==typeof t2.fsPath&&"function"==typeof t2.with&&"function"==typeof t2.toString}get fsPath(){return v(this)}with(t2){if(!t2)return this;let{scheme:e2,authority:r2,path:n2,query:i2,fragment:o2}=t2;return void 0===e2?e2=this.scheme:null===e2&&(e2=c),void 0===r2?r2=this.authority:null===r2&&(r2=c),void 0===n2?n2=this.path:null===n2&&(n2=c),void 0===i2?i2=this.query:null===i2&&(i2=c),void 0===o2?o2=this.fragment:null===o2&&(o2=c),e2===this.scheme&&r2===this.authority&&n2===this.path&&i2===this.query&&o2===this.fragment?this:new d(e2,r2,n2,i2,o2)}static parse(t2,e2=!1){const r2=u.exec(t2);return r2?new d(r2[2]||c,w(r2[4]||c),w(r2[5]||c),w(r2[7]||c),w(r2[9]||c),e2):new d(c,c,c,c,c)}static file(t2){let e2=c;if(i&&(t2=t2.replace(/\\/g,f)),t2[0]===f&&t2[1]===f){const r2=t2.indexOf(f,2);-1===r2?(e2=t2.substring(2),t2=f):(e2=t2.substring(2,r2),t2=t2.substring(r2)||f)}return new d("file",e2,t2,c,c)}static from(t2){const e2=new d(t2.scheme,t2.authority,t2.path,t2.query,t2.fragment);return a(e2,!0),e2}toString(t2=!1){return b(this,t2)}toJSON(){return this}static revive(t2){if(t2){if(t2 instanceof l)return t2;{const e2=new d(t2);return e2._formatted=t2.external,e2._fsPath=t2._sep===g?t2.fsPath:null,e2}}return t2}}const g=i?1:void 0;class d extends l{constructor(){super(...arguments),__publicField(this,"_formatted",null),__publicField(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=v(this)),this._fsPath}toString(t2=!1){return t2?b(this,!0):(this._formatted||(this._formatted=b(this,!1)),this._formatted)}toJSON(){const t2={$mid:1};return this._fsPath&&(t2.fsPath=this._fsPath,t2._sep=g),this._formatted&&(t2.external=this._formatted),this.path&&(t2.path=this.path),this.scheme&&(t2.scheme=this.scheme),this.authority&&(t2.authority=this.authority),this.query&&(t2.query=this.query),this.fragment&&(t2.fragment=this.fragment),t2}}const p={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 m(t2,e2,r2){let n2,i2=-1;for(let o2=0;o2<t2.length;o2++){const s2=t2.charCodeAt(o2);if(s2>=97&&s2<=122||s2>=65&&s2<=90||s2>=48&&s2<=57||45===s2||46===s2||95===s2||126===s2||e2&&47===s2||r2&&91===s2||r2&&93===s2||r2&&58===s2)-1!==i2&&(n2+=encodeURIComponent(t2.substring(i2,o2)),i2=-1),void 0!==n2&&(n2+=t2.charAt(o2));else{void 0===n2&&(n2=t2.substr(0,o2));const e3=p[s2];void 0!==e3?(-1!==i2&&(n2+=encodeURIComponent(t2.substring(i2,o2)),i2=-1),n2+=e3):-1===i2&&(i2=o2)}}return-1!==i2&&(n2+=encodeURIComponent(t2.substring(i2))),void 0!==n2?n2:t2}function y(t2){let e2;for(let r2=0;r2<t2.length;r2++){const n2=t2.charCodeAt(r2);35===n2||63===n2?(void 0===e2&&(e2=t2.substr(0,r2)),e2+=p[n2]):void 0!==e2&&(e2+=t2[r2])}return void 0!==e2?e2:t2}function v(t2,e2){let r2;return r2=t2.authority&&t2.path.length>1&&"file"===t2.scheme?`//${t2.authority}${t2.path}`:47===t2.path.charCodeAt(0)&&(t2.path.charCodeAt(1)>=65&&t2.path.charCodeAt(1)<=90||t2.path.charCodeAt(1)>=97&&t2.path.charCodeAt(1)<=122)&&58===t2.path.charCodeAt(2)?t2.path[1].toLowerCase()+t2.path.substr(2):t2.path,i&&(r2=r2.replace(/\//g,"\\")),r2}function b(t2,e2){const r2=e2?y:m;let n2="",{scheme:i2,authority:o2,path:s2,query:h2,fragment:a2}=t2;if(i2&&(n2+=i2,n2+=":"),(o2||"file"===i2)&&(n2+=f,n2+=f),o2){let t3=o2.indexOf("@");if(-1!==t3){const e3=o2.substr(0,t3);o2=o2.substr(t3+1),t3=e3.lastIndexOf(":"),-1===t3?n2+=r2(e3,!1,!1):(n2+=r2(e3.substr(0,t3),!1,!1),n2+=":",n2+=r2(e3.substr(t3+1),!1,!0)),n2+="@"}o2=o2.toLowerCase(),t3=o2.lastIndexOf(":"),-1===t3?n2+=r2(o2,!1,!0):(n2+=r2(o2.substr(0,t3),!1,!0),n2+=o2.substr(t3))}if(s2){if(s2.length>=3&&47===s2.charCodeAt(0)&&58===s2.charCodeAt(2)){const t3=s2.charCodeAt(1);t3>=65&&t3<=90&&(s2=`/${String.fromCharCode(t3+32)}:${s2.substr(3)}`)}else if(s2.length>=2&&58===s2.charCodeAt(1)){const t3=s2.charCodeAt(0);t3>=65&&t3<=90&&(s2=`${String.fromCharCode(t3+32)}:${s2.substr(2)}`)}n2+=r2(s2,!0,!1)}return h2&&(n2+="?",n2+=r2(h2,!1,!1)),a2&&(n2+="#",n2+=e2?a2:m(a2,!1,!1)),n2}function C(t2){try{return decodeURIComponent(t2)}catch{return t2.length>3?t2.substr(0,3)+C(t2.substr(3)):t2}}const A=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function w(t2){return t2.match(A)?t2.replace(A,t3=>C(t3)):t2}var x=r(975);const P=x.posix||x,_="/";var I,t2;(t2=I||(I={})).joinPath=function(t3,...e2){return t3.with({path:P.join(t3.path,...e2)})},t2.resolvePath=function(t3,...e2){let r2=t3.path,n2=!1;r2[0]!==_&&(r2=_+r2,n2=!0);let i2=P.resolve(r2,...e2);return n2&&i2[0]===_&&!t3.authority&&(i2=i2.substring(1)),t3.with({path:i2})},t2.dirname=function(t3){if(0===t3.path.length||t3.path===_)return t3;let e2=P.dirname(t3.path);return 1===e2.length&&46===e2.charCodeAt(0)&&(e2=""),t3.with({path:e2})},t2.basename=function(t3){return P.basename(t3.path)},t2.extname=function(t3){return P.extname(t3.path)},LIB=n})();const{URI:URI,Utils:Utils}=LIB;var UriUtils,DocumentState,DocumentState2;!function(UriUtils2){UriUtils2.basename=Utils.basename,UriUtils2.dirname=Utils.dirname,UriUtils2.extname=Utils.extname,UriUtils2.joinPath=Utils.joinPath,UriUtils2.resolvePath=Utils.resolvePath;const isWindows="object"==typeof process&&"win32"===(null==process?void 0:process.platform);UriUtils2.equals=function(a,b){return(null==a?void 0:a.toString())===(null==b?void 0:b.toString())},UriUtils2.relative=function(from,to){const fromPath="string"==typeof from?URI.parse(from).path:from.path,toPath="string"==typeof to?URI.parse(to).path:to.path,fromParts=fromPath.split("/").filter(e=>e.length>0),toParts=toPath.split("/").filter(e=>e.length>0);if(isWindows){const upperCaseDriveLetter=/^[A-Z]:$/;if(fromParts[0]&&upperCaseDriveLetter.test(fromParts[0])&&(fromParts[0]=fromParts[0].toLowerCase()),toParts[0]&&upperCaseDriveLetter.test(toParts[0])&&(toParts[0]=toParts[0].toLowerCase()),fromParts[0]!==toParts[0])return toPath.substring(1)}let i=0;for(;i<fromParts.length&&fromParts[i]===toParts[i];i++);return"../".repeat(fromParts.length-i)+toParts.slice(i).join("/")},UriUtils2.normalize=function(uri){return URI.parse(uri.toString()).toString()},UriUtils2.contains=function(parent,child){let parentPath="string"==typeof parent?parent:parent.path,childPath="string"==typeof child?child:child.path;return"/"===childPath.charAt(childPath.length-1)&&(childPath=childPath.slice(0,-1)),"/"===parentPath.charAt(parentPath.length-1)&&(parentPath=parentPath.slice(0,-1)),childPath===parentPath||!(childPath.length<parentPath.length)&&("/"===childPath.charAt(parentPath.length)&&childPath.startsWith(parentPath))}}(UriUtils||(UriUtils={}));class UriTrie{constructor(){this.root={name:"",children:new Map}}normalizeUri(uri){return UriUtils.normalize(uri)}clear(){this.root.children.clear()}insert(uri,element){this.getNode(this.normalizeUri(uri),!0).element=element}delete(uri){const nodeToDelete=this.getNode(this.normalizeUri(uri),!1);(null==nodeToDelete?void 0:nodeToDelete.parent)&&nodeToDelete.parent.children.delete(nodeToDelete.name)}has(uri){var _a2;return void 0!==(null==(_a2=this.getNode(this.normalizeUri(uri),!1))?void 0:_a2.element)}hasNode(uri){return void 0!==this.getNode(this.normalizeUri(uri),!1)}find(uri){var _a2;return null==(_a2=this.getNode(this.normalizeUri(uri),!1))?void 0:_a2.element}findNode(uri){const uriString=this.normalizeUri(uri),node=this.getNode(uriString,!1);if(node)return{name:node.name,uri:UriUtils.joinPath(URI.parse(uriString),node.name).toString(),element:node.element}}findChildren(uri){const uriString=this.normalizeUri(uri),node=this.getNode(uriString,!1);return node?Array.from(node.children.values()).map(child=>({name:child.name,uri:UriUtils.joinPath(URI.parse(uriString),child.name).toString(),element:child.element})):[]}all(){return this.collectValues(this.root)}findAll(prefix){const node=this.getNode(UriUtils.normalize(prefix),!1);return node?this.collectValues(node):[]}getNode(uri,create){const parts=uri.split("/");"/"===uri.charAt(uri.length-1)&&parts.pop();let current=this.root;for(const part of parts){let child=current.children.get(part);if(!child){if(!create)return;child={name:part,children:new Map,parent:current},current.children.set(part,child)}current=child}return current}collectValues(node){const result=[];node.element&&result.push(node.element);for(const child of node.children.values())result.push(...this.collectValues(child));return result}}(DocumentState2=DocumentState||(DocumentState={}))[DocumentState2.Changed=0]="Changed",DocumentState2[DocumentState2.Parsed=1]="Parsed",DocumentState2[DocumentState2.IndexedContent=2]="IndexedContent",DocumentState2[DocumentState2.ComputedScopes=3]="ComputedScopes",DocumentState2[DocumentState2.Linked=4]="Linked",DocumentState2[DocumentState2.IndexedReferences=5]="IndexedReferences",DocumentState2[DocumentState2.Validated=6]="Validated";class DefaultLangiumDocumentFactory{constructor(services){this.serviceRegistry=services.ServiceRegistry,this.textDocuments=services.workspace.TextDocuments,this.fileSystemProvider=services.workspace.FileSystemProvider}async fromUri(uri,cancellationToken=cancellationExports.CancellationToken.None){const content=await this.fileSystemProvider.readFile(uri);return this.createAsync(uri,content,cancellationToken)}fromTextDocument(textDocument,uri,token){return uri=uri??URI.parse(textDocument.uri),cancellationExports.CancellationToken.is(token)?this.createAsync(uri,textDocument,token):this.create(uri,textDocument,token)}fromString(text,uri,token){return cancellationExports.CancellationToken.is(token)?this.createAsync(uri,text,token):this.create(uri,text,token)}fromModel(model,uri){return this.create(uri,{$model:model})}create(uri,content,options){if("string"==typeof content){const parseResult=this.parse(uri,content,options);return this.createLangiumDocument(parseResult,uri,void 0,content)}if("$model"in content){const parseResult={value:content.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(parseResult,uri)}{const parseResult=this.parse(uri,content.getText(),options);return this.createLangiumDocument(parseResult,uri,content)}}async createAsync(uri,content,cancelToken){if("string"==typeof content){const parseResult=await this.parseAsync(uri,content,cancelToken);return this.createLangiumDocument(parseResult,uri,void 0,content)}{const parseResult=await this.parseAsync(uri,content.getText(),cancelToken);return this.createLangiumDocument(parseResult,uri,content)}}createLangiumDocument(parseResult,uri,textDocument,text){let document;if(textDocument)document={parseResult:parseResult,uri:uri,state:DocumentState.Parsed,references:[],textDocument:textDocument};else{const textDocumentGetter=this.createTextDocumentGetter(uri,text);document={parseResult:parseResult,uri:uri,state:DocumentState.Parsed,references:[],get textDocument(){return textDocumentGetter()}}}return parseResult.value.$document=document,document}async update(document,cancellationToken){var _a2,_b2;const oldText=null==(_a2=document.parseResult.value.$cstNode)?void 0:_a2.root.fullText,textDocument=null==(_b2=this.textDocuments)?void 0:_b2.get(document.uri.toString()),text=textDocument?textDocument.getText():await this.fileSystemProvider.readFile(document.uri);if(textDocument)Object.defineProperty(document,"textDocument",{value:textDocument});else{const textDocumentGetter=this.createTextDocumentGetter(document.uri,text);Object.defineProperty(document,"textDocument",{get:textDocumentGetter})}return oldText!==text&&(document.parseResult=await this.parseAsync(document.uri,text,cancellationToken),document.parseResult.value.$document=document),document.state=DocumentState.Parsed,document}parse(uri,text,options){return this.serviceRegistry.getServices(uri).parser.LangiumParser.parse(text,options)}parseAsync(uri,text,cancellationToken){return this.serviceRegistry.getServices(uri).parser.AsyncParser.parse(text,cancellationToken)}createTextDocumentGetter(uri,text){const serviceRegistry=this.serviceRegistry;let textDoc;return()=>textDoc??(textDoc=TextDocument.create(uri.toString(),serviceRegistry.getServices(uri).LanguageMetaData.languageId,0,text??""))}}class DefaultLangiumDocuments{constructor(services){this.documentTrie=new UriTrie,this.services=services,this.langiumDocumentFactory=services.workspace.LangiumDocumentFactory,this.documentBuilder=()=>services.workspace.DocumentBuilder}get all(){return stream(this.documentTrie.all())}addDocument(document){const uriString=document.uri.toString();if(this.documentTrie.has(uriString))throw new Error(`A document with the URI '${uriString}' is already present.`);this.documentTrie.insert(uriString,document)}getDocument(uri){const uriString=uri.toString();return this.documentTrie.find(uriString)}getDocuments(folder){const uriString=folder.toString();return this.documentTrie.findAll(uriString)}async getOrCreateDocument(uri,cancellationToken){let document=this.getDocument(uri);return document||(document=await this.langiumDocumentFactory.fromUri(uri,cancellationToken),this.addDocument(document),document)}createDocument(uri,text,cancellationToken){if(cancellationToken)return this.langiumDocumentFactory.fromString(text,uri,cancellationToken).then(document=>(this.addDocument(document),document));{const document=this.langiumDocumentFactory.fromString(text,uri);return this.addDocument(document),document}}hasDocument(uri){return this.documentTrie.has(uri.toString())}invalidateDocument(uri){const uriString=uri.toString(),langiumDoc=this.documentTrie.find(uriString);return langiumDoc&&this.documentBuilder().resetToState(langiumDoc,DocumentState.Changed),langiumDoc}deleteDocument(uri){const uriString=uri.toString(),langiumDoc=this.documentTrie.find(uriString);return langiumDoc&&(langiumDoc.state=DocumentState.Changed,this.documentTrie.delete(uriString)),langiumDoc}deleteDocuments(folder){const uriString=folder.toString(),langiumDocs=this.documentTrie.findAll(uriString);for(const langiumDoc of langiumDocs)langiumDoc.state=DocumentState.Changed;return this.documentTrie.delete(uriString),langiumDocs}}const RefResolving=Symbol("RefResolving");class DefaultLinker{constructor(services){this.reflection=services.shared.AstReflection,this.langiumDocuments=()=>services.shared.workspace.LangiumDocuments,this.scopeProvider=services.references.ScopeProvider,this.astNodeLocator=services.workspace.AstNodeLocator,this.profiler=services.shared.profilers.LangiumProfiler,this.languageId=services.LanguageMetaData.languageId}async link(document,cancelToken=cancellationExports.CancellationToken.None){var _a2;if(null==(_a2=this.profiler)?void 0:_a2.isActive("linking")){const task=this.profiler.createTask("linking",this.languageId);task.start();try{for(const node of streamAst(document.parseResult.value))await interruptAndCheck(cancelToken),streamReferences(node).forEach(ref=>{const name=`${node.$type}:${ref.property}`;task.startSubTask(name);try{this.doLink(ref,document)}finally{task.stopSubTask(name)}})}finally{task.stop()}}else for(const node of streamAst(document.parseResult.value))await interruptAndCheck(cancelToken),streamReferences(node).forEach(ref=>this.doLink(ref,document))}doLink(refInfo,document){const ref=refInfo.reference;if("_ref"in ref&&void 0===ref._ref){ref._ref=RefResolving;try{const description=this.getCandidate(refInfo);if(isLinkingError(description))ref._ref=description;else{ref._nodeDescription=description;const linkedNode=this.loadAstNode(description);ref._ref=linkedNode??this.createLinkingError(refInfo,description)}}catch(err){console.error(`An error occurred while resolving reference to '${ref.$refText}':`,err);const errorMessage=err.message??String(err);ref._ref={info:refInfo,message:`An error occurred while resolving reference to '${ref.$refText}': ${errorMessage}`}}document.references.push(ref)}else if("_items"in ref&&void 0===ref._items){ref._items=RefResolving;try{const descriptions=this.getCandidates(refInfo),items=[];if(isLinkingError(descriptions))ref._linkingError=descriptions;else for(const description of descriptions){const linkedNode=this.loadAstNode(description);linkedNode&&items.push({ref:linkedNode,$nodeDescription:description})}ref._items=items}catch(err){ref._linkingError={info:refInfo,message:`An error occurred while resolving reference to '${ref.$refText}': ${err}`},ref._items=[]}document.references.push(ref)}}unlink(document){for(const ref of document.references)"_ref"in ref?(ref._ref=void 0,delete ref._nodeDescription):"_items"in ref&&(ref._items=void 0,delete ref._linkingError);document.references=[]}getCandidate(refInfo){return this.scopeProvider.getScope(refInfo).getElement(refInfo.reference.$refText)??this.createLinkingError(refInfo)}getCandidates(refInfo){const descriptions=this.scopeProvider.getScope(refInfo).getElements(refInfo.reference.$refText).distinct(desc=>`${desc.documentUri}#${desc.path}`).toArray();return descriptions.length>0?descriptions:this.createLinkingError(refInfo)}buildReference(node,property,refNode,refText){const linker=this,reference={$refNode:refNode,$refText:refText,_ref:void 0,get ref(){if(isAstNode(this._ref))return this._ref;if("object"==typeof(obj=this._nodeDescription)&&null!==obj&&"string"==typeof obj.name&&"string"==typeof obj.type&&"string"==typeof obj.path){const linkedNode=linker.loadAstNode(this._nodeDescription);this._ref=linkedNode??linker.createLinkingError({reference:reference,container:node,property:property},this._nodeDescription)}else if(void 0===this._ref){this._ref=RefResolving;const document=findRootNode(node).$document,refData=linker.getLinkedNode({reference:reference,container:node,property:property});if(refData.error&&document&&document.state<DocumentState.ComputedScopes)return this._ref=void 0;this._ref=refData.node??refData.error,this._nodeDescription=refData.descr,null==document||document.references.push(this)}else this._ref===RefResolving&&linker.throwCyclicReferenceError(node,property,refText);var obj;return isAstNode(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return isLinkingError(this._ref)?this._ref:void 0}};return reference}buildMultiReference(node,property,refNode,refText){const linker=this,reference={$refNode:refNode,$refText:refText,_items:void 0,get items(){if(Array.isArray(this._items))return this._items;if(void 0===this._items){this._items=RefResolving;const document=findRootNode(node).$document,descriptions=linker.getCandidates({reference:reference,container:node,property:property}),items=[];if(isLinkingError(descriptions))this._linkingError=descriptions;else for(const description of descriptions){const linkedNode=linker.loadAstNode(description);linkedNode&&items.push({ref:linkedNode,$nodeDescription:description})}this._items=items,null==document||document.references.push(this)}else this._items===RefResolving&&linker.throwCyclicReferenceError(node,property,refText);return Array.isArray(this._items)?this._items:[]},get error(){if(this._linkingError)return this._linkingError;return this.items.length>0?void 0:this._linkingError=linker.createLinkingError({reference:reference,container:node,property:property})}};return reference}throwCyclicReferenceError(node,property,refText){throw new Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(node)}/${property} (symbol '${refText}')`)}getLinkedNode(refInfo){try{const description=this.getCandidate(refInfo);if(isLinkingError(description))return{error:description};const linkedNode=this.loadAstNode(description);return linkedNode?{node:linkedNode,descr:description}:{descr:description,error:this.createLinkingError(refInfo,description)}}catch(err){console.error(`An error occurred while resolving reference to '${refInfo.reference.$refText}':`,err);const errorMessage=err.message??String(err);return{error:{info:refInfo,message:`An error occurred while resolving reference to '${refInfo.reference.$refText}': ${errorMessage}`}}}}loadAstNode(nodeDescription){if(nodeDescription.node)return nodeDescription.node;const doc=this.langiumDocuments().getDocument(nodeDescription.documentUri);return doc?this.astNodeLocator.getAstNode(doc.parseResult.value,nodeDescription.path):void 0}createLinkingError(refInfo,targetDescription){const document=findRootNode(refInfo.container).$document;document&&document.state<DocumentState.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${document.uri}).`);return{info:refInfo,message:`Could not resolve reference to ${this.reflection.getReferenceType(refInfo)} named '${refInfo.reference.$refText}'.`,targetDescription:targetDescription}}}class DefaultNameProvider{getName(node){if(function(node){return"string"==typeof node.name}(node))return node.name}getNameNode(node){return findNodeForProperty(node.$cstNode,"name")}}class DefaultReferences{constructor(services){this.nameProvider=services.references.NameProvider,this.index=services.shared.workspace.IndexManager,this.nodeLocator=services.workspace.AstNodeLocator,this.documents=services.shared.workspace.LangiumDocuments,this.hasMultiReference=streamAst(services.Grammar).some(node=>isCrossReference(node)&&node.isMulti)}findDeclarations(sourceCstNode){if(sourceCstNode){const assignment=function(cstNode){var _a2;const astNode=cstNode.astNode;for(;astNode===(null==(_a2=cstNode.container)?void 0:_a2.astNode);){const assignment=getContainerOfType(cstNode.grammarSource,isAssignment);if(assignment)return assignment;cstNode=cstNode.container}}(sourceCstNode),nodeElem=sourceCstNode.astNode;if(assignment&&nodeElem){const reference=nodeElem[assignment.feature];if(isReference(reference)||isMultiReference(reference))return getReferenceNodes(reference);if(Array.isArray(reference))for(const ref of reference)if((isReference(ref)||isMultiReference(ref))&&ref.$refNode&&ref.$refNode.offset<=sourceCstNode.offset&&ref.$refNode.end>=sourceCstNode.end)return getReferenceNodes(ref)}if(nodeElem){const nameNode=this.nameProvider.getNameNode(nodeElem);if(nameNode&&(nameNode===sourceCstNode||function(child,parent){for(;child.container;)if((child=child.container)===parent)return!0;return!1}(sourceCstNode,nameNode)))return this.getSelfNodes(nodeElem)}}return[]}getSelfNodes(node){if(this.hasMultiReference){const references=this.index.findAllReferences(node,this.nodeLocator.getAstNodePath(node)),headNode=this.getNodeFromReferenceDescription(references.head());if(headNode)for(const ref of streamReferences(headNode))if(isMultiReference(ref.reference)&&ref.reference.items.some(item=>item.ref===node))return ref.reference.items.map(item=>item.ref);return[node]}return[node]}getNodeFromReferenceDescription(ref){if(!ref)return;const doc=this.documents.getDocument(ref.sourceUri);return doc?this.nodeLocator.getAstNode(doc.parseResult.value,ref.sourcePath):void 0}findDeclarationNodes(sourceCstNode){const astNodes=this.findDeclarations(sourceCstNode),cstNodes=[];for(const astNode of astNodes){const cstNode=this.nameProvider.getNameNode(astNode)??astNode.$cstNode;cstNode&&cstNodes.push(cstNode)}return cstNodes}findReferences(targetNode,options){const refs=[];options.includeDeclaration&&refs.push(...this.getSelfReferences(targetNode));let indexReferences=this.index.findAllReferences(targetNode,this.nodeLocator.getAstNodePath(targetNode));return options.documentUri&&(indexReferences=indexReferences.filter(ref=>UriUtils.equals(ref.sourceUri,options.documentUri))),refs.push(...indexReferences),stream(refs)}getSelfReferences(targetNode){const selfNodes=this.getSelfNodes(targetNode),references=[];for(const selfNode of selfNodes){const nameNode=this.nameProvider.getNameNode(selfNode);if(nameNode){const doc=getDocument(selfNode),path=this.nodeLocator.getAstNodePath(selfNode);references.push({sourceUri:doc.uri,sourcePath:path,targetUri:doc.uri,targetPath:path,segment:toDocumentSegment(nameNode),local:!0})}}return references}}class MultiMap{constructor(elements){if(this.map=new Map,elements)for(const[key,value]of elements)this.add(key,value)}get size(){return Reduction.sum(stream(this.map.values()).map(a=>a.length))}clear(){this.map.clear()}delete(key,value){if(void 0===value)return this.map.delete(key);{const values=this.map.get(key);if(values){const index=values.indexOf(value);if(index>=0)return 1===values.length?this.map.delete(key):values.splice(index,1),!0}return!1}}get(key){return this.map.get(key)??[]}getStream(key){const values=this.map.get(key);return values?stream(values):EMPTY_STREAM}has(key,value){if(void 0===value)return this.map.has(key);{const values=this.map.get(key);return!!values&&values.indexOf(value)>=0}}add(key,value){return this.map.has(key)?this.map.get(key).push(value):this.map.set(key,[value]),this}addAll(key,values){return this.map.has(key)?this.map.get(key).push(...values):this.map.set(key,Array.from(values)),this}forEach(callbackfn){this.map.forEach((array,key)=>array.forEach(value=>callbackfn(value,key,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return stream(this.map.entries()).flatMap(([key,array])=>array.map(value=>[key,value]))}keys(){return stream(this.map.keys())}values(){return stream(this.map.values()).flat()}entriesGroupedByKey(){return stream(this.map.entries())}}class BiMap{get size(){return this.map.size}constructor(elements){if(this.map=new Map,this.inverse=new Map,elements)for(const[key,value]of elements)this.set(key,value)}clear(){this.map.clear(),this.inverse.clear()}set(key,value){return this.map.set(key,value),this.inverse.set(value,key),this}get(key){return this.map.get(key)}getKey(value){return this.inverse.get(value)}delete(key){const value=this.map.get(key);return void 0!==value&&(this.map.delete(key),this.inverse.delete(value),!0)}}class DefaultScopeComputation{constructor(services){this.nameProvider=services.references.NameProvider,this.descriptions=services.workspace.AstNodeDescriptionProvider}async collectExportedSymbols(document,cancelToken=cancellationExports.CancellationToken.None){return this.collectExportedSymbolsForNode(document.parseResult.value,document,void 0,cancelToken)}async collectExportedSymbolsForNode(parentNode,document,children=streamContents,cancelToken=cancellationExports.CancellationToken.None){const exports$1=[];this.addExportedSymbol(parentNode,exports$1,document);for(const node of children(parentNode))await interruptAndCheck(cancelToken),this.addExportedSymbol(node,exports$1,document);return exports$1}addExportedSymbol(node,exports$1,document){const name=this.nameProvider.getName(node);name&&exports$1.push(this.descriptions.createDescription(node,name,document))}async collectLocalSymbols(document,cancelToken=cancellationExports.CancellationToken.None){const rootNode=document.parseResult.value,symbols=new MultiMap;for(const node of streamAllContents(rootNode))await interruptAndCheck(cancelToken),this.addLocalSymbol(node,document,symbols);return symbols}addLocalSymbol(node,document,symbols){const container=node.$container;if(container){const name=this.nameProvider.getName(node);name&&symbols.add(container,this.descriptions.createDescription(node,name,document))}}}class StreamScope{constructor(elements,outerScope,options){this.elements=elements,this.outerScope=outerScope,this.caseInsensitive=(null==options?void 0:options.caseInsensitive)??!1,this.concatOuterScope=(null==options?void 0:options.concatOuterScope)??!0}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(name){const lowerCaseName=this.caseInsensitive?name.toLowerCase():name,local=this.caseInsensitive?this.elements.find(e=>e.name.toLowerCase()===lowerCaseName):this.elements.find(e=>e.name===name);return local||(this.outerScope?this.outerScope.getElement(name):void 0)}getElements(name){const lowerCaseName=this.caseInsensitive?name.toLowerCase():name,local=this.caseInsensitive?this.elements.filter(e=>e.name.toLowerCase()===lowerCaseName):this.elements.filter(e=>e.name===name);return(this.concatOuterScope||local.isEmpty())&&this.outerScope?local.concat(this.outerScope.getElements(name)):local}}class MultiMapScope{constructor(elements,outerScope,options){this.elements=new MultiMap,this.caseInsensitive=(null==options?void 0:options.caseInsensitive)??!1,this.concatOuterScope=(null==options?void 0:options.concatOuterScope)??!0;for(const element of elements){const name=this.caseInsensitive?element.name.toLowerCase():element.name;this.elements.add(name,element)}this.outerScope=outerScope}getElement(name){const localName=this.caseInsensitive?name.toLowerCase():name,local=this.elements.get(localName)[0];return local||(this.outerScope?this.outerScope.getElement(name):void 0)}getElements(name){const localName=this.caseInsensitive?name.toLowerCase():name,local=this.elements.get(localName);return(this.concatOuterScope||0===local.length)&&this.outerScope?stream(local).concat(this.outerScope.getElements(name)):stream(local)}getAllElements(){let elementStream=stream(this.elements.values());return this.outerScope&&(elementStream=elementStream.concat(this.outerScope.getAllElements())),elementStream}}class DisposableCache{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(disposable2){this.toDispose.push(disposable2)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(disposable2=>disposable2.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}}class SimpleCache extends DisposableCache{constructor(){super(...arguments),this.cache=new Map}has(key){return this.throwIfDisposed(),this.cache.has(key)}set(key,value){this.throwIfDisposed(),this.cache.set(key,value)}get(key,provider){if(this.throwIfDisposed(),this.cache.has(key))return this.cache.get(key);if(provider){const value=provider();return this.cache.set(key,value),value}}delete(key){return this.throwIfDisposed(),this.cache.delete(key)}clear(){this.throwIfDisposed(),this.cache.clear()}}class ContextCache extends DisposableCache{constructor(converter){super(),this.cache=new Map,this.converter=converter??(value=>value)}has(contextKey,key){return this.throwIfDisposed(),this.cacheForContext(contextKey).has(key)}set(contextKey,key,value){this.throwIfDisposed(),this.cacheForContext(contextKey).set(key,value)}get(contextKey,key,provider){this.throwIfDisposed();const contextCache=this.cacheForContext(contextKey);if(contextCache.has(key))return contextCache.get(key);if(provider){const value=provider();return contextCache.set(key,value),value}}delete(contextKey,key){return this.throwIfDisposed(),this.cacheForContext(contextKey).delete(key)}clear(contextKey){if(this.throwIfDisposed(),contextKey){const mapKey=this.converter(contextKey);this.cache.delete(mapKey)}else this.cache.clear()}cacheForContext(contextKey){const mapKey=this.converter(contextKey);let documentCache=this.cache.get(mapKey);return documentCache||(documentCache=new Map,this.cache.set(mapKey,documentCache)),documentCache}}class WorkspaceCache extends SimpleCache{constructor(sharedServices,state){super(),state?(this.toDispose.push(sharedServices.workspace.DocumentBuilder.onBuildPhase(state,()=>{this.clear()})),this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate((_changed,deleted)=>{deleted.length>0&&this.clear()}))):this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}class DefaultScopeProvider{constructor(services){this.reflection=services.shared.AstReflection,this.nameProvider=services.references.NameProvider,this.descriptions=services.workspace.AstNodeDescriptionProvider,this.indexManager=services.shared.workspace.IndexManager,this.globalScopeCache=new WorkspaceCache(services.shared)}getScope(context){const scopes=[],referenceType=this.reflection.getReferenceType(context),localSymbols=getDocument(context.container).localSymbols;if(localSymbols){let currentNode=context.container;do{localSymbols.has(currentNode)&&scopes.push(localSymbols.getStream(currentNode).filter(desc=>this.reflection.isSubtype(desc.type,referenceType))),currentNode=currentNode.$container}while(currentNode)}let result=this.getGlobalScope(referenceType,context);for(let i=scopes.length-1;i>=0;i--)result=this.createScope(scopes[i],result);return result}createScope(elements,outerScope,options){return new StreamScope(stream(elements),outerScope,options)}createScopeForNodes(elements,outerScope,options){const s=stream(elements).map(e=>{const name=this.nameProvider.getName(e);if(name)return this.descriptions.createDescription(e,name)}).nonNullable();return new StreamScope(s,outerScope,options)}getGlobalScope(referenceType,_context){return this.globalScopeCache.get(referenceType,()=>new MultiMapScope(this.indexManager.allElements(referenceType)))}}function isIntermediateReference(obj){return"object"==typeof obj&&!!obj&&("$ref"in obj||"$error"in obj)}class DefaultJsonSerializer{constructor(services){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=services.shared.workspace.LangiumDocuments,this.astNodeLocator=services.workspace.AstNodeLocator,this.nameProvider=services.references.NameProvider,this.commentProvider=services.documentation.CommentProvider}serialize(node,options){const serializeOptions=options??{},specificReplacer=null==options?void 0:options.replacer,defaultReplacer=(key,value)=>this.replacer(key,value,serializeOptions),replacer=specificReplacer?(key,value)=>specificReplacer(key,value,defaultReplacer):defaultReplacer;try{return this.currentDocument=getDocument(node),JSON.stringify(node,replacer,null==options?void 0:options.space)}finally{this.currentDocument=void 0}}deserialize(content,options){const deserializeOptions=options??{},root=JSON.parse(content);return this.linkNode(root,root,deserializeOptions),root}replacer(key,value,{refText:refText,sourceText:sourceText,textRegions:textRegions,comments:comments,uriConverter:uriConverter}){var _a2,_b2,_c2;if(!this.ignoreProperties.has(key)){if(isReference(value)){const refValue=value.ref,$refText=refText?value.$refText:void 0;if(refValue){const targetDocument=getDocument(refValue);let targetUri="";this.currentDocument&&this.currentDocument!==targetDocument&&(targetUri=uriConverter?uriConverter(targetDocument.uri,refValue):targetDocument.uri.toString());return{$ref:`${targetUri}#${this.astNodeLocator.getAstNodePath(refValue)}`,$refText:$refText}}return{$error:(null==(_a2=value.error)?void 0:_a2.message)??"Could not resolve reference",$refText:$refText}}if(isMultiReference(value)){const $refText=refText?value.$refText:void 0,$refs=[];for(const item of value.items){const refValue=item.ref,targetDocument=getDocument(item.ref);let targetUri="";this.currentDocument&&this.currentDocument!==targetDocument&&(targetUri=uriConverter?uriConverter(targetDocument.uri,refValue):targetDocument.uri.toString());const targetPath=this.astNodeLocator.getAstNodePath(refValue);$refs.push(`${targetUri}#${targetPath}`)}return{$refs:$refs,$refText:$refText}}if(isAstNode(value)){let astNode;if(textRegions&&(astNode=this.addAstNodeRegionWithAssignmentsTo({...value}),key&&!value.$document||!(null==astNode?void 0:astNode.$textRegion)||(astNode.$textRegion.documentURI=null==(_b2=this.currentDocument)?void 0:_b2.uri.toString())),sourceText&&!key&&(astNode??(astNode={...value}),astNode.$sourceText=null==(_c2=value.$cstNode)?void 0:_c2.text),comments){astNode??(astNode={...value});const comment=this.commentProvider.getComment(value);comment&&(astNode.$comment=comment.replace(/\r/g,""))}return astNode??value}return value}}addAstNodeRegionWithAssignmentsTo(node){const createDocumentSegment=cstNode=>({offset:cstNode.offset,end:cstNode.end,length:cstNode.length,range:cstNode.range});if(node.$cstNode){const assignments=(node.$textRegion=createDocumentSegment(node.$cstNode)).assignments={};return Object.keys(node).filter(key=>!key.startsWith("$")).forEach(key=>{const propertyAssignments=function(node,property){return node&&property?findNodesForPropertyInternal(node,property,node.astNode,!0):[]}(node.$cstNode,key).map(createDocumentSegment);0!==propertyAssignments.length&&(assignments[key]=propertyAssignments)}),node}}linkNode(node,root,options,container,containerProperty,containerIndex){for(const[propertyName,item]of Object.entries(node))if(Array.isArray(item))for(let index=0;index<item.length;index++){const element=item[index];isIntermediateReference(element)?item[index]=this.reviveReference(node,propertyName,root,element,options):isAstNode(element)&&this.linkNode(element,root,options,node,propertyName,index)}else isIntermediateReference(item)?node[propertyName]=this.reviveReference(node,propertyName,root,item,options):isAstNode(item)&&this.linkNode(item,root,options,node,propertyName);const mutable=node;mutable.$container=container,mutable.$containerProperty=containerProperty,mutable.$containerIndex=containerIndex}reviveReference(container,property,root,reference,options){let ref,refText=reference.$refText,error=reference.$error;if(reference.$ref){const refNode=this.getRefNode(root,reference.$ref,options.uriConverter);if(isAstNode(refNode))return refText||(refText=this.nameProvider.getName(refNode)),{$refText:refText??"",ref:refNode};error=refNode}else if(reference.$refs){const refs=[];for(const refUri of reference.$refs){const refNode=this.getRefNode(root,refUri,options.uriConverter);isAstNode(refNode)&&refs.push({ref:refNode})}if(0!==refs.length)return{$refText:refText??"",items:refs};ref={$refText:refText??"",items:refs},error??(error="Could not resolve multi-reference")}return error?(ref??(ref={$refText:refText??"",ref:void 0}),ref.error={info:{container:container,property:property,reference:ref},message:error},ref):void 0}getRefNode(root,uri,uriConverter){try{const fragmentIndex=uri.indexOf("#");if(0===fragmentIndex){const node2=this.astNodeLocator.getAstNode(root,uri.substring(1));return node2||"Could not resolve path: "+uri}if(fragmentIndex<0){const documentUri2=uriConverter?uriConverter(uri):URI.parse(uri),document2=this.langiumDocuments.getDocument(documentUri2);return document2?document2.parseResult.value:"Could not find document for URI: "+uri}const documentUri=uriConverter?uriConverter(uri.substring(0,fragmentIndex)):URI.parse(uri.substring(0,fragmentIndex)),document=this.langiumDocuments.getDocument(documentUri);if(!document)return"Could not find document for URI: "+uri;if(fragmentIndex===uri.length-1)return document.parseResult.value;const node=this.astNodeLocator.getAstNode(document.parseResult.value,uri.substring(fragmentIndex+1));return node||"Could not resolve URI: "+uri}catch(err){return String(err)}}}class DefaultServiceRegistry{get map(){return this.fileExtensionMap}constructor(services){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.fileNameMap=new Map,this.textDocuments=null==services?void 0:services.workspace.TextDocuments}register(language){const data=language.LanguageMetaData;for(const ext of data.fileExtensions)this.fileExtensionMap.has(ext)&&console.warn(`The file extension ${ext} is used by multiple languages. It is now assigned to '${data.languageId}'.`),this.fileExtensionMap.set(ext,language);if(data.fileNames)for(const name of data.fileNames)this.fileNameMap.has(name)&&console.warn(`The file name ${name} is used by multiple languages. It is now assigned to '${data.languageId}'.`),this.fileNameMap.set(name,language);this.languageIdMap.set(data.languageId,language)}getServices(uri){var _a2,_b2;if(0===this.languageIdMap.size)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const languageId=null==(_b2=null==(_a2=this.textDocuments)?void 0:_a2.get(uri))?void 0:_b2.languageId;if(void 0!==languageId){const services2=this.languageIdMap.get(languageId);if(services2)return services2}const ext=UriUtils.extname(uri),name=UriUtils.basename(uri),services=this.fileNameMap.get(name)??this.fileExtensionMap.get(ext);if(!services)throw languageId?new Error(`The service registry contains no services for the extension '${ext}' for language '${languageId}'.`):new Error(`The service registry contains no services for the extension '${ext}'.`);return services}hasServices(uri){try{return this.getServices(uri),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}}function diagnosticData(code){return{code:code}}var ValidationCategory,ValidationCategory2;(ValidationCategory2=ValidationCategory||(ValidationCategory={})).defaults=["fast","slow","built-in"],ValidationCategory2.all=ValidationCategory2.defaults;class ValidationRegistry{constructor(services){this.entries=new MultiMap,this.knownCategories=new Set(ValidationCategory.defaults),this.entriesBefore=[],this.entriesAfter=[],this.reflection=services.shared.AstReflection}register(checksRecord,thisObj=this,category="fast"){if("built-in"===category)throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");this.knownCategories.add(category);for(const[type,ch]of Object.entries(checksRecord)){const callbacks=ch;if(Array.isArray(callbacks))for(const check of callbacks){const entry={check:this.wrapValidationException(check,thisObj),category:category};this.addEntry(type,entry)}else if("function"==typeof callbacks){const entry={check:this.wrapValidationException(callbacks,thisObj),category:category};this.addEntry(type,entry)}else assertUnreachable()}}wrapValidationException(check,thisObj){return async(node,accept,cancelToken)=>{await this.handleException(()=>check.call(thisObj,node,accept,cancelToken),"An error occurred during validation",accept,node)}}async handleException(functionality,messageContext,accept,node){try{await functionality()}catch(err){if(isOperationCancelled(err))throw err;console.error(`${messageContext}:`,err),err instanceof Error&&err.stack&&console.error(err.stack);accept("error",`${messageContext}: ${err instanceof Error?err.message:String(err)}`,{node:node})}}addEntry(type,entry){if("AstNode"!==type)for(const subtype of this.reflection.getAllSubTypes(type))this.entries.add(subtype,entry);else this.entries.add("AstNode",entry)}getChecks(type,categories){let checks=stream(this.entries.get(type)).concat(this.entries.get("AstNode"));return categories&&(checks=checks.filter(entry=>categories.includes(entry.category))),checks.map(entry=>entry.check)}registerBeforeDocument(checkBefore,thisObj=this){this.entriesBefore.push(this.wrapPreparationException(checkBefore,"An error occurred during set-up of the validation",thisObj))}registerAfterDocument(checkAfter,thisObj=this){this.entriesAfter.push(this.wrapPreparationException(checkAfter,"An error occurred during tear-down of the validation",thisObj))}wrapPreparationException(check,messageContext,thisObj){return async(rootNode,accept,categories,cancelToken)=>{await this.handleException(()=>check.call(thisObj,rootNode,accept,categories,cancelToken),messageContext,accept,rootNode)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}getAllValidationCategories(_document){return this.knownCategories}}const VALIDATE_EACH_NODE=Object.freeze({validateNode:!0,validateChildren:!0});class DefaultDocumentValidator{constructor(services){this.validationRegistry=services.validation.ValidationRegistry,this.metadata=services.LanguageMetaData,this.profiler=services.shared.profilers.LangiumProfiler,this.languageId=services.LanguageMetaData.languageId}async validateDocument(document,options={},cancelToken=cancellationExports.CancellationToken.None){const parseResult=document.parseResult,diagnostics=[];if(await interruptAndCheck(cancelToken),!options.categories||options.categories.includes("built-in")){if(this.processLexingErrors(parseResult,diagnostics,options),options.stopAfterLexingErrors&&diagnostics.some(d=>{var _a2;return(null==(_a2=d.data)?void 0:_a2.code)===DocumentValidator.LexingError}))return diagnostics;if(this.processParsingErrors(parseResult,diagnostics,options),options.stopAfterParsingErrors&&diagnostics.some(d=>{var _a2;return(null==(_a2=d.data)?void 0:_a2.code)===DocumentValidator.ParsingError}))return diagnostics;if(this.processLinkingErrors(document,diagnostics,options),options.stopAfterLinkingErrors&&diagnostics.some(d=>{var _a2;return(null==(_a2=d.data)?void 0:_a2.code)===DocumentValidator.LinkingError}))return diagnostics}try{diagnostics.push(...await this.validateAst(parseResult.value,options,cancelToken))}catch(err){if(isOperationCancelled(err))throw err;console.error("An error occurred during validation:",err)}return await interruptAndCheck(cancelToken),diagnostics}processLexingErrors(parseResult,diagnostics,_options){var _a2;const lexerDiagnostics=[...parseResult.lexerErrors,...(null==(_a2=parseResult.lexerReport)?void 0:_a2.diagnostics)??[]];for(const lexerDiagnostic of lexerDiagnostics){const severity=lexerDiagnostic.severity??"error",diagnostic={severity:toDiagnosticSeverity(severity),range:{start:{line:lexerDiagnostic.line-1,character:lexerDiagnostic.column-1},end:{line:lexerDiagnostic.line-1,character:lexerDiagnostic.column+lexerDiagnostic.length-1}},message:lexerDiagnostic.message,data:toDiagnosticData(severity),source:this.getSource()};diagnostics.push(diagnostic)}}processParsingErrors(parseResult,diagnostics,_options){for(const parserError of parseResult.parserErrors){let range;if(isNaN(parserError.token.startOffset)){if("previousToken"in parserError){const token=parserError.previousToken;if(isNaN(token.startOffset)){const position={line:0,character:0};range={start:position,end:position}}else{const position={line:token.endLine-1,character:token.endColumn};range={start:position,end:position}}}}else range=tokenToRange(parserError.token);if(range){const diagnostic={severity:toDiagnosticSeverity("error"),range:range,message:parserError.message,data:diagnosticData(DocumentValidator.ParsingError),source:this.getSource()};diagnostics.push(diagnostic)}}}processLinkingErrors(document,diagnostics,_options){var _a2;for(const reference of document.references){const linkingError=reference.error;if(linkingError){const info={node:linkingError.info.container,range:null==(_a2=reference.$refNode)?void 0:_a2.range,property:linkingError.info.property,index:linkingError.info.index,data:{code:DocumentValidator.LinkingError,containerType:linkingError.info.container.$type,property:linkingError.info.property,refText:linkingError.info.reference.$refText}};diagnostics.push(this.toDiagnostic("error",linkingError.message,info))}}}async validateAst(rootNode,options,cancelToken=cancellationExports.CancellationToken.None){const validationItems=[],acceptor=(severity,message,info)=>{validationItems.push(this.toDiagnostic(severity,message,info))};return await this.validateAstBefore(rootNode,options,acceptor,cancelToken),await this.validateAstNodes(rootNode,options,acceptor,cancelToken),await this.validateAstAfter(rootNode,options,acceptor,cancelToken),validationItems}async validateAstBefore(rootNode,options,acceptor,cancelToken=cancellationExports.CancellationToken.None){const checksBefore=this.validationRegistry.checksBefore;for(const checkBefore of checksBefore)await interruptAndCheck(cancelToken),await checkBefore(rootNode,acceptor,options.categories??[],cancelToken)}async validateAstNodes(rootNode,options,acceptor,cancelToken=cancellationExports.CancellationToken.None){var _a2;if(null==(_a2=this.profiler)?void 0:_a2.isActive("validating")){const task=this.profiler.createTask("validating",this.languageId);task.start();try{const nodes=streamAst(rootNode).iterator();for(const node of nodes){task.startSubTask(node.$type);const nodeOptions=this.validateSingleNodeOptions(node,options);if(nodeOptions.validateNode)try{const checks=this.validationRegistry.getChecks(node.$type,options.categories);for(const check of checks)await check(node,acceptor,cancelToken)}finally{task.stopSubTask(node.$type)}nodeOptions.validateChildren||nodes.prune()}}finally{task.stop()}}else{const nodes=streamAst(rootNode).iterator();for(const node of nodes){await interruptAndCheck(cancelToken);const nodeOptions=this.validateSingleNodeOptions(node,options);if(nodeOptions.validateNode){const checks=this.validationRegistry.getChecks(node.$type,options.categories);for(const check of checks)await check(node,acceptor,cancelToken)}nodeOptions.validateChildren||nodes.prune()}}}validateSingleNodeOptions(_node,_options){return VALIDATE_EACH_NODE}async validateAstAfter(rootNode,options,acceptor,cancelToken=cancellationExports.CancellationToken.None){const checksAfter=this.validationRegistry.checksAfter;for(const checkAfter of checksAfter)await interruptAndCheck(cancelToken),await checkAfter(rootNode,acceptor,options.categories??[],cancelToken)}toDiagnostic(severity,message,info){return{message:message,range:getDiagnosticRange(info),severity:toDiagnosticSeverity(severity),code:info.code,codeDescription:info.codeDescription,tags:info.tags,relatedInformation:info.relatedInformation,data:info.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function getDiagnosticRange(info){if(info.range)return info.range;let cstNode;return"string"==typeof info.property?cstNode=findNodeForProperty(info.node.$cstNode,info.property,info.index):"string"==typeof info.keyword&&(cstNode=findNodeForKeyword(info.node.$cstNode,info.keyword,info.index)),cstNode??(cstNode=info.node.$cstNode),cstNode?cstNode.range:{start:{line:0,character:0},end:{line:0,character:0}}}function toDiagnosticSeverity(severity){switch(severity){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+severity)}}function toDiagnosticData(severity){switch(severity){case"error":return diagnosticData(DocumentValidator.LexingError);case"warning":return diagnosticData(DocumentValidator.LexingWarning);case"info":return diagnosticData(DocumentValidator.LexingInfo);case"hint":return diagnosticData(DocumentValidator.LexingHint);default:throw new Error("Invalid diagnostic severity: "+severity)}}var DocumentValidator,DocumentValidator2;(DocumentValidator2=DocumentValidator||(DocumentValidator={})).LexingError="lexing-error",DocumentValidator2.LexingWarning="lexing-warning",DocumentValidator2.LexingInfo="lexing-info",DocumentValidator2.LexingHint="lexing-hint",DocumentValidator2.ParsingError="parsing-error",DocumentValidator2.LinkingError="linking-error";class DefaultAstNodeDescriptionProvider{constructor(services){this.astNodeLocator=services.workspace.AstNodeLocator,this.nameProvider=services.references.NameProvider}createDescription(node,name,document){const doc=document??getDocument(node);name??(name=this.nameProvider.getName(node));const path=this.astNodeLocator.getAstNodePath(node);if(!name)throw new Error(`Node at path ${path} has no name.`);let nameNodeSegment;const nameSegmentGetter=()=>nameNodeSegment??(nameNodeSegment=toDocumentSegment(this.nameProvider.getNameNode(node)??node.$cstNode));return{node:node,name:name,get nameSegment(){return nameSegmentGetter()},selectionSegment:toDocumentSegment(node.$cstNode),type:node.$type,documentUri:doc.uri,path:path}}}class DefaultReferenceDescriptionProvider{constructor(services){this.nodeLocator=services.workspace.AstNodeLocator}async createDescriptions(document,cancelToken=cancellationExports.CancellationToken.None){const descr=[],rootNode=document.parseResult.value;for(const astNode of streamAst(rootNode))await interruptAndCheck(cancelToken),streamReferences(astNode).forEach(refInfo=>{refInfo.reference.error||descr.push(...this.createInfoDescriptions(refInfo))});return descr}createInfoDescriptions(refInfo){const reference=refInfo.reference;if(reference.error||!reference.$refNode)return[];let items=[];isReference(reference)&&reference.$nodeDescription?items=[reference.$nodeDescription]:isMultiReference(reference)&&(items=reference.items.map(e=>e.$nodeDescription).filter(e=>void 0!==e));const sourceUri=getDocument(refInfo.container).uri,sourcePath=this.nodeLocator.getAstNodePath(refInfo.container),descriptions=[],segment=toDocumentSegment(reference.$refNode);for(const item of items)descriptions.push({sourceUri:sourceUri,sourcePath:sourcePath,targetUri:item.documentUri,targetPath:item.path,segment:segment,local:UriUtils.equals(item.documentUri,sourceUri)});return descriptions}}class DefaultAstNodeLocator{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(node){if(node.$container){const containerPath=this.getAstNodePath(node.$container),newSegment=this.getPathSegment(node);return containerPath+this.segmentSeparator+newSegment}return""}getPathSegment({$containerProperty:$containerProperty,$containerIndex:$containerIndex}){if(!$containerProperty)throw new Error("Missing '$containerProperty' in AST node.");return void 0!==$containerIndex?$containerProperty+this.indexSeparator+$containerIndex:$containerProperty}getAstNode(node,path){return path.split(this.segmentSeparator).reduce((previousValue,currentValue)=>{if(!previousValue||0===currentValue.length)return previousValue;const propertyIndex=currentValue.indexOf(this.indexSeparator);if(propertyIndex>0){const property=currentValue.substring(0,propertyIndex),arrayIndex=parseInt(currentValue.substring(propertyIndex+1)),array=previousValue[property];return null==array?void 0:array[arrayIndex]}return previousValue[currentValue]},node)}}var eventsExports=requireEvents();class DefaultConfigurationProvider{constructor(services){this._ready=new Deferred,this.onConfigurationSectionUpdateEmitter=new eventsExports.Emitter,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=services.ServiceRegistry}get ready(){return this._ready.promise}initialize(params){var _a2;this.workspaceConfig=(null==(_a2=params.capabilities.workspace)?void 0:_a2.configuration)??!1}async initialized(params){if(this.workspaceConfig){if(params.register){const languages=this.serviceRegistry.all;params.register({section:languages.map(lang=>this.toSectionName(lang.LanguageMetaData.languageId))})}if(params.fetchConfiguration){const configToUpdate=this.serviceRegistry.all.map(lang=>({section:this.toSectionName(lang.LanguageMetaData.languageId)})),configs=await params.fetchConfiguration(configToUpdate);configToUpdate.forEach((conf,idx)=>{this.updateSectionConfiguration(conf.section,configs[idx])})}}this._ready.resolve()}updateConfiguration(change){"object"==typeof change.settings&&null!==change.settings&&Object.entries(change.settings).forEach(([section,configuration])=>{this.updateSectionConfiguration(section,configuration),this.onConfigurationSectionUpdateEmitter.fire({section:section,configuration:configuration})})}updateSectionConfiguration(section,configuration){this.settings[section]=configuration}async getConfiguration(language,configuration){await this.ready;const sectionName=this.toSectionName(language);if(this.settings[sectionName])return this.settings[sectionName][configuration]}toSectionName(languageId){return`${languageId}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}}var hasRequiredMessages$1,main$1={},main={},ril={},api$1={},messages$1={};function requireMessages$1(){if(hasRequiredMessages$1)return messages$1;hasRequiredMessages$1=1,Object.defineProperty(messages$1,"__esModule",{value:!0}),messages$1.Message=messages$1.NotificationType9=messages$1.NotificationType8=messages$1.NotificationType7=messages$1.NotificationType6=messages$1.NotificationType5=messages$1.NotificationType4=messages$1.NotificationType3=messages$1.NotificationType2=messages$1.NotificationType1=messages$1.NotificationType0=messages$1.NotificationType=messages$1.RequestType9=messages$1.RequestType8=messages$1.RequestType7=messages$1.RequestType6=messages$1.RequestType5=messages$1.RequestType4=messages$1.RequestType3=messages$1.RequestType2=messages$1.RequestType1=messages$1.RequestType=messages$1.RequestType0=messages$1.AbstractMessageSignature=messages$1.ParameterStructures=messages$1.ResponseError=messages$1.ErrorCodes=void 0;const is2=requireIs$1();var ErrorCodes,ErrorCodes2,Message,Message2;(ErrorCodes2=ErrorCodes||(messages$1.ErrorCodes=ErrorCodes={})).ParseError=-32700,ErrorCodes2.InvalidRequest=-32600,ErrorCodes2.MethodNotFound=-32601,ErrorCodes2.InvalidParams=-32602,ErrorCodes2.InternalError=-32603,ErrorCodes2.jsonrpcReservedErrorRangeStart=-32099,ErrorCodes2.serverErrorStart=-32099,ErrorCodes2.MessageWriteError=-32099,ErrorCodes2.MessageReadError=-32098,ErrorCodes2.PendingResponseRejected=-32097,ErrorCodes2.ConnectionInactive=-32096,ErrorCodes2.ServerNotInitialized=-32002,ErrorCodes2.UnknownErrorCode=-32001,ErrorCodes2.jsonrpcReservedErrorRangeEnd=-32e3,ErrorCodes2.serverErrorEnd=-32e3;class ResponseError extends Error{constructor(code,message,data){super(message),this.code=is2.number(code)?code:ErrorCodes.UnknownErrorCode,this.data=data,Object.setPrototypeOf(this,ResponseError.prototype)}toJson(){const result={code:this.code,message:this.message};return void 0!==this.data&&(result.data=this.data),result}}messages$1.ResponseError=ResponseError;class ParameterStructures{constructor(kind){this.kind=kind}static is(value){return value===ParameterStructures.auto||value===ParameterStructures.byName||value===ParameterStructures.byPosition}toString(){return this.kind}}messages$1.ParameterStructures=ParameterStructures,ParameterStructures.auto=new ParameterStructures("auto"),ParameterStructures.byPosition=new ParameterStructures("byPosition"),ParameterStructures.byName=new ParameterStructures("byName");class AbstractMessageSignature{constructor(method,numberOfParams){this.method=method,this.numberOfParams=numberOfParams}get parameterStructures(){return ParameterStructures.auto}}messages$1.AbstractMessageSignature=AbstractMessageSignature;messages$1.RequestType0=class extends AbstractMessageSignature{constructor(method){super(method,0)}};messages$1.RequestType=class extends AbstractMessageSignature{constructor(method,_parameterStructures=ParameterStructures.auto){super(method,1),this._parameterStructures=_parameterStructures}get parameterStructures(){return this._parameterStructures}};messages$1.RequestType1=class extends AbstractMessageSignature{constructor(method,_parameterStructures=ParameterStructures.auto){super(method,1),this._parameterStructures=_parameterStructures}get parameterStructures(){return this._parameterStructures}};messages$1.RequestType2=class extends AbstractMessageSignature{constructor(method){super(method,2)}};messages$1.RequestType3=class extends AbstractMessageSignature{constructor(method){super(method,3)}};messages$1.RequestType4=class extends AbstractMessageSignature{constructor(method){super(method,4)}};messages$1.RequestType5=class extends AbstractMessageSignature{constructor(method){super(method,5)}};messages$1.RequestType6=class extends AbstractMessageSignature{constructor(method){super(method,6)}};messages$1.RequestType7=class extends AbstractMessageSignature{constructor(method){super(method,7)}};messages$1.RequestType8=class extends AbstractMessageSignature{constructor(method){super(method,8)}};messages$1.RequestType9=class extends AbstractMessageSignature{constructor(method){super(method,9)}};messages$1.NotificationType=class extends AbstractMessageSignature{constructor(method,_parameterStructures=ParameterStructures.auto){super(method,1),this._parameterStructures=_parameterStructures}get parameterStructures(){return this._parameterStructures}};messages$1.NotificationType0=class extends AbstractMessageSignature{constructor(method){super(method,0)}};messages$1.NotificationType1=class extends AbstractMessageSignature{constructor(method,_parameterStructures=ParameterStructures.auto){super(method,1),this._parameterStructures=_parameterStructures}get parameterStructures(){return this._parameterStructures}};messages$1.NotificationType2=class extends AbstractMessageSignature{constructor(method){super(method,2)}};messages$1.NotificationType3=class extends AbstractMessageSignature{constructor(method){super(method,3)}};messages$1.NotificationType4=class extends AbstractMessageSignature{constructor(method){super(method,4)}};messages$1.NotificationType5=class extends AbstractMessageSignature{constructor(method){super(method,5)}};messages$1.NotificationType6=class extends AbstractMessageSignature{constructor(method){super(method,6)}};messages$1.NotificationType7=class extends AbstractMessageSignature{constructor(method){super(method,7)}};messages$1.NotificationType8=class extends AbstractMessageSignature{constructor(method){super(method,8)}};return messages$1.NotificationType9=class extends AbstractMessageSignature{constructor(method){super(method,9)}},(Message2=Message||(messages$1.Message=Message={})).isRequest=function(message){const candidate=message;return candidate&&is2.string(candidate.method)&&(is2.string(candidate.id)||is2.number(candidate.id))},Message2.isNotification=function(message){const candidate=message;return candidate&&is2.string(candidate.method)&&void 0===message.id},Message2.isResponse=function(message){const candidate=message;return candidate&&(void 0!==candidate.result||!!candidate.error)&&(is2.string(candidate.id)||is2.number(candidate.id)||null===candidate.id)},messages$1}var hasRequiredLinkedMap,linkedMap={};function requireLinkedMap(){if(hasRequiredLinkedMap)return linkedMap;var _a2,Touch,Touch2;hasRequiredLinkedMap=1,Object.defineProperty(linkedMap,"__esModule",{value:!0}),linkedMap.LRUCache=linkedMap.LinkedMap=linkedMap.Touch=void 0,(Touch2=Touch||(linkedMap.Touch=Touch={})).None=0,Touch2.First=1,Touch2.AsOld=Touch2.First,Touch2.Last=2,Touch2.AsNew=Touch2.Last;class LinkedMap{constructor(){this[_a2]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var _a3;return null==(_a3=this._head)?void 0:_a3.value}get last(){var _a3;return null==(_a3=this._tail)?void 0:_a3.value}has(key){return this._map.has(key)}get(key,touch=Touch.None){const item=this._map.get(key);if(item)return touch!==Touch.None&&this.touch(item,touch),item.value}set(key,value,touch=Touch.None){let item=this._map.get(key);if(item)item.value=value,touch!==Touch.None&&this.touch(item,touch);else{switch(item={key:key,value:value,next:void 0,previous:void 0},touch){case Touch.None:this.addItemLast(item);break;case Touch.First:this.addItemFirst(item);break;case Touch.Last:default:this.addItemLast(item)}this._map.set(key,item),this._size++}return this}delete(key){return!!this.remove(key)}remove(key){const item=this._map.get(key);if(item)return this._map.delete(key),this.removeItem(item),this._size--,item.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const item=this._head;return this._map.delete(item.key),this.removeItem(item),this._size--,item.value}forEach(callbackfn,thisArg){const state=this._state;let current=this._head;for(;current;){if(thisArg?callbackfn.bind(thisArg)(current.value,current.key,this):callbackfn(current.value,current.key,this),this._state!==state)throw new Error("LinkedMap got modified during iteration.");current=current.next}}keys(){const state=this._state;let current=this._head;const iterator={[Symbol.iterator]:()=>iterator,next:()=>{if(this._state!==state)throw new Error("LinkedMap got modified during iteration.");if(current){const result={value:current.key,done:!1};return current=current.next,result}return{value:void 0,done:!0}}};return iterator}values(){const state=this._state;let current=this._head;const iterator={[Symbol.iterator]:()=>iterator,next:()=>{if(this._state!==state)throw new Error("LinkedMap got modified during iteration.");if(current){const result={value:current.value,done:!1};return current=current.next,result}return{value:void 0,done:!0}}};return iterator}entries(){const state=this._state;let current=this._head;const iterator={[Symbol.iterator]:()=>iterator,next:()=>{if(this._state!==state)throw new Error("LinkedMap got modified during iteration.");if(current){const result={value:[current.key,current.value],done:!1};return current=current.next,result}return{value:void 0,done:!0}}};return iterator}[(_a2=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(newSize){if(newSize>=this.size)return;if(0===newSize)return void this.clear();let current=this._head,currentSize=this.size;for(;current&&currentSize>newSize;)this._map.delete(current.key),current=current.next,currentSize--;this._head=current,this._size=currentSize,current&&(current.previous=void 0),this._state++}addItemFirst(item){if(this._head||this._tail){if(!this._head)throw new Error("Invalid list");item.next=this._head,this._head.previous=item}else this._tail=item;this._head=item,this._state++}addItemLast(item){if(this._head||this._tail){if(!this._tail)throw new Error("Invalid list");item.previous=this._tail,this._tail.next=item}else this._head=item;this._tail=item,this._state++}removeItem(item){if(item===this._head&&item===this._tail)this._head=void 0,this._tail=void 0;else if(item===this._head){if(!item.next)throw new Error("Invalid list");item.next.previous=void 0,this._head=item.next}else if(item===this._tail){if(!item.previous)throw new Error("Invalid list");item.previous.next=void 0,this._tail=item.previous}else{const next=item.next,previous=item.previous;if(!next||!previous)throw new Error("Invalid list");next.previous=previous,previous.next=next}item.next=void 0,item.previous=void 0,this._state++}touch(item,touch){if(!this._head||!this._tail)throw new Error("Invalid list");if(touch===Touch.First||touch===Touch.Last)if(touch===Touch.First){if(item===this._head)return;const next=item.next,previous=item.previous;item===this._tail?(previous.next=void 0,this._tail=previous):(next.previous=previous,previous.next=next),item.previous=void 0,item.next=this._head,this._head.previous=item,this._head=item,this._state++}else if(touch===Touch.Last){if(item===this._tail)return;const next=item.next,previous=item.previous;item===this._head?(next.previous=void 0,this._head=next):(next.previous=previous,previous.next=next),item.next=void 0,item.previous=this._tail,this._tail.next=item,this._tail=item,this._state++}}toJSON(){const data=[];return this.forEach((value,key)=>{data.push([key,value])}),data}fromJSON(data){this.clear();for(const[key,value]of data)this.set(key,value)}}linkedMap.LinkedMap=LinkedMap;return linkedMap.LRUCache=class extends LinkedMap{constructor(limit,ratio=1){super(),this._limit=limit,this._ratio=Math.min(Math.max(0,ratio),1)}get limit(){return this._limit}set limit(limit){this._limit=limit,this.checkTrim()}get ratio(){return this._ratio}set ratio(ratio){this._ratio=Math.min(Math.max(0,ratio),1),this.checkTrim()}get(key,touch=Touch.AsNew){return super.get(key,touch)}peek(key){return super.get(key,Touch.None)}set(key,value){return super.set(key,value,Touch.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}},linkedMap}var hasRequiredDisposable,disposable={};var hasRequiredSharedArrayCancellation,sharedArrayCancellation={};var hasRequiredSemaphore,hasRequiredMessageReader,messageReader={},semaphore={};function requireSemaphore(){if(hasRequiredSemaphore)return semaphore;hasRequiredSemaphore=1,Object.defineProperty(semaphore,"__esModule",{value:!0}),semaphore.Semaphore=void 0;const ral_1=requireRal();return semaphore.Semaphore=class{constructor(capacity=1){if(capacity<=0)throw new Error("Capacity must be greater than 0");this._capacity=capacity,this._active=0,this._waiting=[]}lock(thunk){return new Promise((resolve,reject)=>{this._waiting.push({thunk:thunk,resolve:resolve,reject:reject}),this.runNext()})}get active(){return this._active}runNext(){0!==this._waiting.length&&this._active!==this._capacity&&(0,ral_1.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(0===this._waiting.length||this._active===this._capacity)return;const next=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const result=next.thunk();result instanceof Promise?result.then(value=>{this._active--,next.resolve(value),this.runNext()},err=>{this._active--,next.reject(err),this.runNext()}):(this._active--,next.resolve(result),this.runNext())}catch(err){this._active--,next.reject(err),this.runNext()}}},semaphore}var hasRequiredMessageWriter,messageWriter={};var hasRequiredMessageBuffer,messageBuffer={};var hasRequiredConnection$1,hasRequiredApi$1,hasRequiredRil,hasRequiredMain$1,browser,hasRequiredBrowser,connection$1={};function requireConnection$1(){return hasRequiredConnection$1||(hasRequiredConnection$1=1,function(exports$1){Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.createMessageConnection=exports$1.ConnectionOptions=exports$1.MessageStrategy=exports$1.CancellationStrategy=exports$1.CancellationSenderStrategy=exports$1.CancellationReceiverStrategy=exports$1.RequestCancellationReceiverStrategy=exports$1.IdCancellationReceiverStrategy=exports$1.ConnectionStrategy=exports$1.ConnectionError=exports$1.ConnectionErrors=exports$1.LogTraceNotification=exports$1.SetTraceNotification=exports$1.TraceFormat=exports$1.TraceValues=exports$1.Trace=exports$1.NullLogger=exports$1.ProgressType=exports$1.ProgressToken=void 0;const ral_1=requireRal(),Is2=requireIs$1(),messages_1=requireMessages$1(),linkedMap_1=requireLinkedMap(),events_1=requireEvents(),cancellation_1=requireCancellation();var CancelNotification,ProgressToken,ProgressNotification,StarRequestHandler,Trace,Trace2,TraceValues,TraceValues2,TraceFormat,TraceFormat2,SetTraceNotification,LogTraceNotification,ConnectionErrors,ConnectionErrors2,ConnectionStrategy,IdCancellationReceiverStrategy,RequestCancellationReceiverStrategy,CancellationReceiverStrategy,CancellationReceiverStrategy2,CancellationSenderStrategy,CancellationSenderStrategy2,CancellationStrategy,CancellationStrategy2,MessageStrategy,ConnectionOptions,ConnectionState,ConnectionState2;(CancelNotification||(CancelNotification={})).type=new messages_1.NotificationType("$/cancelRequest"),(ProgressToken||(exports$1.ProgressToken=ProgressToken={})).is=function(value){return"string"==typeof value||"number"==typeof value},(ProgressNotification||(ProgressNotification={})).type=new messages_1.NotificationType("$/progress");exports$1.ProgressType=class{constructor(){}},(StarRequestHandler||(StarRequestHandler={})).is=function(value){return Is2.func(value)},exports$1.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}}),(Trace2=Trace||(exports$1.Trace=Trace={}))[Trace2.Off=0]="Off",Trace2[Trace2.Messages=1]="Messages",Trace2[Trace2.Compact=2]="Compact",Trace2[Trace2.Verbose=3]="Verbose",(TraceValues2=TraceValues||(exports$1.TraceValues=TraceValues={})).Off="off",TraceValues2.Messages="messages",TraceValues2.Compact="compact",TraceValues2.Verbose="verbose",function(Trace2){Trace2.fromString=function(value){if(!Is2.string(value))return Trace2.Off;switch(value=value.toLowerCase()){case"off":default:return Trace2.Off;case"messages":return Trace2.Messages;case"compact":return Trace2.Compact;case"verbose":return Trace2.Verbose}},Trace2.toString=function(value){switch(value){case Trace2.Off:return"off";case Trace2.Messages:return"messages";case Trace2.Compact:return"compact";case Trace2.Verbose:return"verbose";default:return"off"}}}(Trace||(exports$1.Trace=Trace={})),(TraceFormat2=TraceFormat||(exports$1.TraceFormat=TraceFormat={})).Text="text",TraceFormat2.JSON="json",function(TraceFormat2){TraceFormat2.fromString=function(value){return Is2.string(value)&&"json"===(value=value.toLowerCase())?TraceFormat2.JSON:TraceFormat2.Text}}(TraceFormat||(exports$1.TraceFormat=TraceFormat={})),(SetTraceNotification||(exports$1.SetTraceNotification=SetTraceNotification={})).type=new messages_1.NotificationType("$/setTrace"),(LogTraceNotification||(exports$1.LogTraceNotification=LogTraceNotification={})).type=new messages_1.NotificationType("$/logTrace"),(ConnectionErrors2=ConnectionErrors||(exports$1.ConnectionErrors=ConnectionErrors={}))[ConnectionErrors2.Closed=1]="Closed",ConnectionErrors2[ConnectionErrors2.Disposed=2]="Disposed",ConnectionErrors2[ConnectionErrors2.AlreadyListening=3]="AlreadyListening";class ConnectionError extends Error{constructor(code,message){super(message),this.code=code,Object.setPrototypeOf(this,ConnectionError.prototype)}}exports$1.ConnectionError=ConnectionError,(ConnectionStrategy||(exports$1.ConnectionStrategy=ConnectionStrategy={})).is=function(value){const candidate=value;return candidate&&Is2.func(candidate.cancelUndispatched)},(IdCancellationReceiverStrategy||(exports$1.IdCancellationReceiverStrategy=IdCancellationReceiverStrategy={})).is=function(value){const candidate=value;return candidate&&(void 0===candidate.kind||"id"===candidate.kind)&&Is2.func(candidate.createCancellationTokenSource)&&(void 0===candidate.dispose||Is2.func(candidate.dispose))},(RequestCancellationReceiverStrategy||(exports$1.RequestCancellationReceiverStrategy=RequestCancellationReceiverStrategy={})).is=function(value){const candidate=value;return candidate&&"request"===candidate.kind&&Is2.func(candidate.createCancellationTokenSource)&&(void 0===candidate.dispose||Is2.func(candidate.dispose))},(CancellationReceiverStrategy2=CancellationReceiverStrategy||(exports$1.CancellationReceiverStrategy=CancellationReceiverStrategy={})).Message=Object.freeze({createCancellationTokenSource:_=>new cancellation_1.CancellationTokenSource}),CancellationReceiverStrategy2.is=function(value){return IdCancellationReceiverStrategy.is(value)||RequestCancellationReceiverStrategy.is(value)},(CancellationSenderStrategy2=CancellationSenderStrategy||(exports$1.CancellationSenderStrategy=CancellationSenderStrategy={})).Message=Object.freeze({sendCancellation:(conn,id)=>conn.sendNotification(CancelNotification.type,{id:id}),cleanup(_){}}),CancellationSenderStrategy2.is=function(value){const candidate=value;return candidate&&Is2.func(candidate.sendCancellation)&&Is2.func(candidate.cleanup)},(CancellationStrategy2=CancellationStrategy||(exports$1.CancellationStrategy=CancellationStrategy={})).Message=Object.freeze({receiver:CancellationReceiverStrategy.Message,sender:CancellationSenderStrategy.Message}),CancellationStrategy2.is=function(value){const candidate=value;return candidate&&CancellationReceiverStrategy.is(candidate.receiver)&&CancellationSenderStrategy.is(candidate.sender)},(MessageStrategy||(exports$1.MessageStrategy=MessageStrategy={})).is=function(value){const candidate=value;return candidate&&Is2.func(candidate.handleMessage)},(ConnectionOptions||(exports$1.ConnectionOptions=ConnectionOptions={})).is=function(value){const candidate=value;return candidate&&(CancellationStrategy.is(candidate.cancellationStrategy)||ConnectionStrategy.is(candidate.connectionStrategy)||MessageStrategy.is(candidate.messageStrategy))},(ConnectionState2=ConnectionState||(ConnectionState={}))[ConnectionState2.New=1]="New",ConnectionState2[ConnectionState2.Listening=2]="Listening",ConnectionState2[ConnectionState2.Closed=3]="Closed",ConnectionState2[ConnectionState2.Disposed=4]="Disposed",exports$1.createMessageConnection=function(messageReader2,messageWriter2,_logger,options){const logger=void 0!==_logger?_logger:exports$1.NullLogger;let starRequestHandler,sequenceNumber=0,notificationSequenceNumber=0,unknownResponseSequenceNumber=0;const requestHandlers=new Map;let starNotificationHandler;const notificationHandlers=new Map,progressHandlers=new Map;let timer2,tracer,messageQueue=new linkedMap_1.LinkedMap,responsePromises=new Map,knownCanceledRequests=new Set,requestTokens=new Map,trace=Trace.Off,traceFormat=TraceFormat.Text,state=ConnectionState.New;const errorEmitter=new events_1.Emitter,closeEmitter=new events_1.Emitter,unhandledNotificationEmitter=new events_1.Emitter,unhandledProgressEmitter=new events_1.Emitter,disposeEmitter=new events_1.Emitter,cancellationStrategy=options&&options.cancellationStrategy?options.cancellationStrategy:CancellationStrategy.Message;function createRequestQueueKey(id){if(null===id)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+id.toString()}function addMessageToQueue(queue,message){var id;messages_1.Message.isRequest(message)?queue.set(createRequestQueueKey(message.id),message):messages_1.Message.isResponse(message)?queue.set(null===(id=message.id)?"res-unknown-"+(++unknownResponseSequenceNumber).toString():"res-"+id.toString(),message):queue.set("not-"+(++notificationSequenceNumber).toString(),message)}function cancelUndispatched(_message){}function isListening(){return state===ConnectionState.Listening}function isClosed(){return state===ConnectionState.Closed}function isDisposed(){return state===ConnectionState.Disposed}function closeHandler(){state!==ConnectionState.New&&state!==ConnectionState.Listening||(state=ConnectionState.Closed,closeEmitter.fire(void 0))}function triggerMessageQueue(){timer2||0===messageQueue.size||(timer2=(0,ral_1.default)().timer.setImmediate(()=>{timer2=void 0,function(){if(0===messageQueue.size)return;const message=messageQueue.shift();try{const messageStrategy=null==options?void 0:options.messageStrategy;MessageStrategy.is(messageStrategy)?messageStrategy.handleMessage(message,handleMessage):handleMessage(message)}finally{triggerMessageQueue()}}()}))}function handleMessage(message){messages_1.Message.isRequest(message)?function(requestMessage){if(isDisposed())return;function reply(resultOrError,method,startTime2){const message={jsonrpc:"2.0",id:requestMessage.id};resultOrError instanceof messages_1.ResponseError?message.error=resultOrError.toJson():message.result=void 0===resultOrError?null:resultOrError,traceSendingResponse(message,method,startTime2),messageWriter2.write(message).catch(()=>logger.error("Sending response failed."))}function replyError(error,method,startTime2){const message={jsonrpc:"2.0",id:requestMessage.id,error:error.toJson()};traceSendingResponse(message,method,startTime2),messageWriter2.write(message).catch(()=>logger.error("Sending response failed."))}function replySuccess(result,method,startTime2){void 0===result&&(result=null);const message={jsonrpc:"2.0",id:requestMessage.id,result:result};traceSendingResponse(message,method,startTime2),messageWriter2.write(message).catch(()=>logger.error("Sending response failed."))}!function(message){if(trace===Trace.Off||!tracer)return;if(traceFormat===TraceFormat.Text){let data;trace!==Trace.Verbose&&trace!==Trace.Compact||!message.params||(data=`Params: ${stringifyTrace(message.params)}\n\n`),tracer.log(`Received request '${message.method} - (${message.id})'.`,data)}else logLSPMessage("receive-request",message)}(requestMessage);const element=requestHandlers.get(requestMessage.method);let type,requestHandler;element&&(type=element.type,requestHandler=element.handler);const startTime=Date.now();if(requestHandler||starRequestHandler){const tokenKey=requestMessage.id??String(Date.now()),cancellationSource=IdCancellationReceiverStrategy.is(cancellationStrategy.receiver)?cancellationStrategy.receiver.createCancellationTokenSource(tokenKey):cancellationStrategy.receiver.createCancellationTokenSource(requestMessage);null!==requestMessage.id&&knownCanceledRequests.has(requestMessage.id)&&cancellationSource.cancel(),null!==requestMessage.id&&requestTokens.set(tokenKey,cancellationSource);try{let handlerResult;if(requestHandler)if(void 0===requestMessage.params){if(void 0!==type&&0!==type.numberOfParams)return void replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams,`Request ${requestMessage.method} defines ${type.numberOfParams} params but received none.`),requestMessage.method,startTime);handlerResult=requestHandler(cancellationSource.token)}else if(Array.isArray(requestMessage.params)){if(void 0!==type&&type.parameterStructures===messages_1.ParameterStructures.byName)return void replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams,`Request ${requestMessage.method} defines parameters by name but received parameters by position`),requestMessage.method,startTime);handlerResult=requestHandler(...requestMessage.params,cancellationSource.token)}else{if(void 0!==type&&type.parameterStructures===messages_1.ParameterStructures.byPosition)return void replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams,`Request ${requestMessage.method} defines parameters by position but received parameters by name`),requestMessage.method,startTime);handlerResult=requestHandler(requestMessage.params,cancellationSource.token)}else starRequestHandler&&(handlerResult=starRequestHandler(requestMessage.method,requestMessage.params,cancellationSource.token));const promise=handlerResult;handlerResult?promise.then?promise.then(resultOrError=>{requestTokens.delete(tokenKey),reply(resultOrError,requestMessage.method,startTime)},error=>{requestTokens.delete(tokenKey),error instanceof messages_1.ResponseError?replyError(error,requestMessage.method,startTime):error&&Is2.string(error.message)?replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError,`Request ${requestMessage.method} failed with message: ${error.message}`),requestMessage.method,startTime):replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError,`Request ${requestMessage.method} failed unexpectedly without providing any details.`),requestMessage.method,startTime)}):(requestTokens.delete(tokenKey),reply(handlerResult,requestMessage.method,startTime)):(requestTokens.delete(tokenKey),replySuccess(handlerResult,requestMessage.method,startTime))}catch(error){requestTokens.delete(tokenKey),error instanceof messages_1.ResponseError?reply(error,requestMessage.method,startTime):error&&Is2.string(error.message)?replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError,`Request ${requestMessage.method} failed with message: ${error.message}`),requestMessage.method,startTime):replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError,`Request ${requestMessage.method} failed unexpectedly without providing any details.`),requestMessage.method,startTime)}}else replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound,`Unhandled method ${requestMessage.method}`),requestMessage.method,startTime)}(message):messages_1.Message.isNotification(message)?function(message){if(isDisposed())return;let type,notificationHandler;if(message.method===CancelNotification.type.method){const cancelId=message.params.id;return knownCanceledRequests.delete(cancelId),void traceReceivedNotification(message)}{const element=notificationHandlers.get(message.method);element&&(notificationHandler=element.handler,type=element.type)}if(notificationHandler||starNotificationHandler)try{if(traceReceivedNotification(message),notificationHandler)if(void 0===message.params)void 0!==type&&0!==type.numberOfParams&&type.parameterStructures!==messages_1.ParameterStructures.byName&&logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received none.`),notificationHandler();else if(Array.isArray(message.params)){const params=message.params;message.method===ProgressNotification.type.method&&2===params.length&&ProgressToken.is(params[0])?notificationHandler({token:params[0],value:params[1]}):(void 0!==type&&(type.parameterStructures===messages_1.ParameterStructures.byName&&logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`),type.numberOfParams!==message.params.length&&logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${params.length} arguments`)),notificationHandler(...params))}else void 0!==type&&type.parameterStructures===messages_1.ParameterStructures.byPosition&&logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`),notificationHandler(message.params);else starNotificationHandler&&starNotificationHandler(message.method,message.params)}catch(error){error.message?logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`):logger.error(`Notification handler '${message.method}' failed unexpectedly.`)}else unhandledNotificationEmitter.fire(message)}(message):messages_1.Message.isResponse(message)?function(responseMessage){if(isDisposed())return;if(null===responseMessage.id)responseMessage.error?logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error,void 0,4)}`):logger.error("Received response message without id. No further error information provided.");else{const key=responseMessage.id,responsePromise=responsePromises.get(key);if(function(message,responsePromise){if(trace===Trace.Off||!tracer)return;if(traceFormat===TraceFormat.Text){let data;if(trace!==Trace.Verbose&&trace!==Trace.Compact||(message.error&&message.error.data?data=`Error data: ${stringifyTrace(message.error.data)}\n\n`:message.result?data=`Result: ${stringifyTrace(message.result)}\n\n`:void 0===message.error&&(data="No result returned.\n\n")),responsePromise){const error=message.error?` Request failed: ${message.error.message} (${message.error.code}).`:"";tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now()-responsePromise.timerStart}ms.${error}`,data)}else tracer.log(`Received response ${message.id} without active response promise.`,data)}else logLSPMessage("receive-response",message)}(responseMessage,responsePromise),void 0!==responsePromise){responsePromises.delete(key);try{if(responseMessage.error){const error=responseMessage.error;responsePromise.reject(new messages_1.ResponseError(error.code,error.message,error.data))}else{if(void 0===responseMessage.result)throw new Error("Should never happen.");responsePromise.resolve(responseMessage.result)}}catch(error){error.message?logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`):logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`)}}}}(message):function(message){if(!message)return void logger.error("Received empty message.");logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message,null,4)}`);const responseMessage=message;if(Is2.string(responseMessage.id)||Is2.number(responseMessage.id)){const key=responseMessage.id,responseHandler=responsePromises.get(key);responseHandler&&responseHandler.reject(new Error("The received response has neither a result nor an error property."))}}(message)}messageReader2.onClose(closeHandler),messageReader2.onError(function(error){errorEmitter.fire([error,void 0,void 0])}),messageWriter2.onClose(closeHandler),messageWriter2.onError(function(data){errorEmitter.fire(data)});const callback=message=>{try{if(messages_1.Message.isNotification(message)&&message.method===CancelNotification.type.method){const cancelId=message.params.id,key=createRequestQueueKey(cancelId),toCancel=messageQueue.get(key);if(messages_1.Message.isRequest(toCancel)){const strategy=null==options?void 0:options.connectionStrategy,response=strategy&&strategy.cancelUndispatched?strategy.cancelUndispatched(toCancel,cancelUndispatched):void 0;if(response&&(void 0!==response.error||void 0!==response.result))return messageQueue.delete(key),requestTokens.delete(cancelId),response.id=toCancel.id,traceSendingResponse(response,message.method,Date.now()),void messageWriter2.write(response).catch(()=>logger.error("Sending response for canceled message failed."))}const cancellationToken=requestTokens.get(cancelId);if(void 0!==cancellationToken)return cancellationToken.cancel(),void traceReceivedNotification(message);knownCanceledRequests.add(cancelId)}addMessageToQueue(messageQueue,message)}finally{triggerMessageQueue()}};function stringifyTrace(params){if(null!=params)switch(trace){case Trace.Verbose:return JSON.stringify(params,null,4);case Trace.Compact:return JSON.stringify(params);default:return}}function traceSendingResponse(message,method,startTime){if(trace!==Trace.Off&&tracer)if(traceFormat===TraceFormat.Text){let data;trace!==Trace.Verbose&&trace!==Trace.Compact||(message.error&&message.error.data?data=`Error data: ${stringifyTrace(message.error.data)}\n\n`:message.result?data=`Result: ${stringifyTrace(message.result)}\n\n`:void 0===message.error&&(data="No result returned.\n\n")),tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now()-startTime}ms`,data)}else logLSPMessage("send-response",message)}function traceReceivedNotification(message){if(trace!==Trace.Off&&tracer&&message.method!==LogTraceNotification.type.method)if(traceFormat===TraceFormat.Text){let data;trace!==Trace.Verbose&&trace!==Trace.Compact||(data=message.params?`Params: ${stringifyTrace(message.params)}\n\n`:"No parameters provided.\n\n"),tracer.log(`Received notification '${message.method}'.`,data)}else logLSPMessage("receive-notification",message)}function logLSPMessage(type,message){if(!tracer||trace===Trace.Off)return;const lspMessage={isLSPMessage:!0,type:type,message:message,timestamp:Date.now()};tracer.log(lspMessage)}function throwIfClosedOrDisposed(){if(isClosed())throw new ConnectionError(ConnectionErrors.Closed,"Connection is closed.");if(isDisposed())throw new ConnectionError(ConnectionErrors.Disposed,"Connection is disposed.")}function undefinedToNull(param){return void 0===param?null:param}function nullToUndefined(param){return null===param?void 0:param}function isNamedParam(param){return null!=param&&!Array.isArray(param)&&"object"==typeof param}function computeSingleParam(parameterStructures,param){switch(parameterStructures){case messages_1.ParameterStructures.auto:return isNamedParam(param)?nullToUndefined(param):[undefinedToNull(param)];case messages_1.ParameterStructures.byName:if(!isNamedParam(param))throw new Error("Received parameters by name but param is not an object literal.");return nullToUndefined(param);case messages_1.ParameterStructures.byPosition:return[undefinedToNull(param)];default:throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`)}}function computeMessageParams(type,params){let result;const numberOfParams=type.numberOfParams;switch(numberOfParams){case 0:result=void 0;break;case 1:result=computeSingleParam(type.parameterStructures,params[0]);break;default:result=[];for(let i=0;i<params.length&&i<numberOfParams;i++)result.push(undefinedToNull(params[i]));if(params.length<numberOfParams)for(let i=params.length;i<numberOfParams;i++)result.push(null)}return result}const connection2={sendNotification:(type,...args)=>{let method,messageParams;if(throwIfClosedOrDisposed(),Is2.string(type)){method=type;const first2=args[0];let paramStart=0,parameterStructures=messages_1.ParameterStructures.auto;messages_1.ParameterStructures.is(first2)&&(paramStart=1,parameterStructures=first2);let paramEnd=args.length;const numberOfParams=paramEnd-paramStart;switch(numberOfParams){case 0:messageParams=void 0;break;case 1:messageParams=computeSingleParam(parameterStructures,args[paramStart]);break;default:if(parameterStructures===messages_1.ParameterStructures.byName)throw new Error(`Received ${numberOfParams} parameters for 'by Name' notification parameter structure.`);messageParams=args.slice(paramStart,paramEnd).map(value=>undefinedToNull(value))}}else{const params=args;method=type.method,messageParams=computeMessageParams(type,params)}const notificationMessage={jsonrpc:"2.0",method:method,params:messageParams};return function(message){if(trace!==Trace.Off&&tracer)if(traceFormat===TraceFormat.Text){let data;trace!==Trace.Verbose&&trace!==Trace.Compact||(data=message.params?`Params: ${stringifyTrace(message.params)}\n\n`:"No parameters provided.\n\n"),tracer.log(`Sending notification '${message.method}'.`,data)}else logLSPMessage("send-notification",message)}(notificationMessage),messageWriter2.write(notificationMessage).catch(error=>{throw logger.error("Sending notification failed."),error})},onNotification:(type,handler)=>{let method;return throwIfClosedOrDisposed(),Is2.func(type)?starNotificationHandler=type:handler&&(Is2.string(type)?(method=type,notificationHandlers.set(type,{type:void 0,handler:handler})):(method=type.method,notificationHandlers.set(type.method,{type:type,handler:handler}))),{dispose:()=>{void 0!==method?notificationHandlers.delete(method):starNotificationHandler=void 0}}},onProgress:(_type,token,handler)=>{if(progressHandlers.has(token))throw new Error(`Progress handler for token ${token} already registered`);return progressHandlers.set(token,handler),{dispose:()=>{progressHandlers.delete(token)}}},sendProgress:(_type,token,value)=>connection2.sendNotification(ProgressNotification.type,{token:token,value:value}),onUnhandledProgress:unhandledProgressEmitter.event,sendRequest:(type,...args)=>{let method,messageParams,token;if(throwIfClosedOrDisposed(),function(){if(!isListening())throw new Error("Call listen() first.")}(),Is2.string(type)){method=type;const first2=args[0],last=args[args.length-1];let paramStart=0,parameterStructures=messages_1.ParameterStructures.auto;messages_1.ParameterStructures.is(first2)&&(paramStart=1,parameterStructures=first2);let paramEnd=args.length;cancellation_1.CancellationToken.is(last)&&(paramEnd-=1,token=last);const numberOfParams=paramEnd-paramStart;switch(numberOfParams){case 0:messageParams=void 0;break;case 1:messageParams=computeSingleParam(parameterStructures,args[paramStart]);break;default:if(parameterStructures===messages_1.ParameterStructures.byName)throw new Error(`Received ${numberOfParams} parameters for 'by Name' request parameter structure.`);messageParams=args.slice(paramStart,paramEnd).map(value=>undefinedToNull(value))}}else{const params=args;method=type.method,messageParams=computeMessageParams(type,params);const numberOfParams=type.numberOfParams;token=cancellation_1.CancellationToken.is(params[numberOfParams])?params[numberOfParams]:void 0}const id=sequenceNumber++;let disposable2;token&&(disposable2=token.onCancellationRequested(()=>{const p=cancellationStrategy.sender.sendCancellation(connection2,id);return void 0===p?(logger.log(`Received no promise from cancellation strategy when cancelling id ${id}`),Promise.resolve()):p.catch(()=>{logger.log(`Sending cancellation messages for id ${id} failed`)})}));const requestMessage={jsonrpc:"2.0",id:id,method:method,params:messageParams};return function(message){if(trace!==Trace.Off&&tracer)if(traceFormat===TraceFormat.Text){let data;trace!==Trace.Verbose&&trace!==Trace.Compact||!message.params||(data=`Params: ${stringifyTrace(message.params)}\n\n`),tracer.log(`Sending request '${message.method} - (${message.id})'.`,data)}else logLSPMessage("send-request",message)}(requestMessage),"function"==typeof cancellationStrategy.sender.enableCancellation&&cancellationStrategy.sender.enableCancellation(requestMessage),new Promise(async(resolve,reject)=>{const responsePromise={method:method,timerStart:Date.now(),resolve:r=>{resolve(r),cancellationStrategy.sender.cleanup(id),null==disposable2||disposable2.dispose()},reject:r=>{reject(r),cancellationStrategy.sender.cleanup(id),null==disposable2||disposable2.dispose()}};try{await messageWriter2.write(requestMessage),responsePromises.set(id,responsePromise)}catch(error){throw logger.error("Sending request failed."),responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError,error.message?error.message:"Unknown reason")),error}})},onRequest:(type,handler)=>{throwIfClosedOrDisposed();let method=null;return StarRequestHandler.is(type)?(method=void 0,starRequestHandler=type):Is2.string(type)?(method=null,void 0!==handler&&(method=type,requestHandlers.set(type,{handler:handler,type:void 0}))):void 0!==handler&&(method=type.method,requestHandlers.set(type.method,{type:type,handler:handler})),{dispose:()=>{null!==method&&(void 0!==method?requestHandlers.delete(method):starRequestHandler=void 0)}}},hasPendingResponse:()=>responsePromises.size>0,trace:async(_value,_tracer,sendNotificationOrTraceOptions)=>{let _sendNotification=!1,_traceFormat=TraceFormat.Text;void 0!==sendNotificationOrTraceOptions&&(Is2.boolean(sendNotificationOrTraceOptions)?_sendNotification=sendNotificationOrTraceOptions:(_sendNotification=sendNotificationOrTraceOptions.sendNotification||!1,_traceFormat=sendNotificationOrTraceOptions.traceFormat||TraceFormat.Text)),trace=_value,traceFormat=_traceFormat,tracer=trace===Trace.Off?void 0:_tracer,!_sendNotification||isClosed()||isDisposed()||await connection2.sendNotification(SetTraceNotification.type,{value:Trace.toString(_value)})},onError:errorEmitter.event,onClose:closeEmitter.event,onUnhandledNotification:unhandledNotificationEmitter.event,onDispose:disposeEmitter.event,end:()=>{messageWriter2.end()},dispose:()=>{if(isDisposed())return;state=ConnectionState.Disposed,disposeEmitter.fire(void 0);const error=new messages_1.ResponseError(messages_1.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const promise of responsePromises.values())promise.reject(error);responsePromises=new Map,requestTokens=new Map,knownCanceledRequests=new Set,messageQueue=new linkedMap_1.LinkedMap,Is2.func(messageWriter2.dispose)&&messageWriter2.dispose(),Is2.func(messageReader2.dispose)&&messageReader2.dispose()},listen:()=>{throwIfClosedOrDisposed(),function(){if(isListening())throw new ConnectionError(ConnectionErrors.AlreadyListening,"Connection is already listening")}(),state=ConnectionState.Listening,messageReader2.listen(callback)},inspect:()=>{(0,ral_1.default)().console.log("inspect")}};return connection2.onNotification(LogTraceNotification.type,params=>{if(trace===Trace.Off||!tracer)return;const verbose=trace===Trace.Verbose||trace===Trace.Compact;tracer.log(params.message,verbose?params.verbose:void 0)}),connection2.onNotification(ProgressNotification.type,params=>{const handler=progressHandlers.get(params.token);handler?handler(params.value):unhandledProgressEmitter.fire(params)}),connection2}}(connection$1)),connection$1}function requireApi$1(){return hasRequiredApi$1||(hasRequiredApi$1=1,function(exports$1){Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.ProgressType=exports$1.ProgressToken=exports$1.createMessageConnection=exports$1.NullLogger=exports$1.ConnectionOptions=exports$1.ConnectionStrategy=exports$1.AbstractMessageBuffer=exports$1.WriteableStreamMessageWriter=exports$1.AbstractMessageWriter=exports$1.MessageWriter=exports$1.ReadableStreamMessageReader=exports$1.AbstractMessageReader=exports$1.MessageReader=exports$1.SharedArrayReceiverStrategy=exports$1.SharedArraySenderStrategy=exports$1.CancellationToken=exports$1.CancellationTokenSource=exports$1.Emitter=exports$1.Event=exports$1.Disposable=exports$1.LRUCache=exports$1.Touch=exports$1.LinkedMap=exports$1.ParameterStructures=exports$1.NotificationType9=exports$1.NotificationType8=exports$1.NotificationType7=exports$1.NotificationType6=exports$1.NotificationType5=exports$1.NotificationType4=exports$1.NotificationType3=exports$1.NotificationType2=exports$1.NotificationType1=exports$1.NotificationType0=exports$1.NotificationType=exports$1.ErrorCodes=exports$1.ResponseError=exports$1.RequestType9=exports$1.RequestType8=exports$1.RequestType7=exports$1.RequestType6=exports$1.RequestType5=exports$1.RequestType4=exports$1.RequestType3=exports$1.RequestType2=exports$1.RequestType1=exports$1.RequestType0=exports$1.RequestType=exports$1.Message=exports$1.RAL=void 0,exports$1.MessageStrategy=exports$1.CancellationStrategy=exports$1.CancellationSenderStrategy=exports$1.CancellationReceiverStrategy=exports$1.ConnectionError=exports$1.ConnectionErrors=exports$1.LogTraceNotification=exports$1.SetTraceNotification=exports$1.TraceFormat=exports$1.TraceValues=exports$1.Trace=void 0;const messages_1=requireMessages$1();Object.defineProperty(exports$1,"Message",{enumerable:!0,get:function(){return messages_1.Message}}),Object.defineProperty(exports$1,"RequestType",{enumerable:!0,get:function(){return messages_1.RequestType}}),Object.defineProperty(exports$1,"RequestType0",{enumerable:!0,get:function(){return messages_1.RequestType0}}),Object.defineProperty(exports$1,"RequestType1",{enumerable:!0,get:function(){return messages_1.RequestType1}}),Object.defineProperty(exports$1,"RequestType2",{enumerable:!0,get:function(){return messages_1.RequestType2}}),Object.defineProperty(exports$1,"RequestType3",{enumerable:!0,get:function(){return messages_1.RequestType3}}),Object.defineProperty(exports$1,"RequestType4",{enumerable:!0,get:function(){return messages_1.RequestType4}}),Object.defineProperty(exports$1,"RequestType5",{enumerable:!0,get:function(){return messages_1.RequestType5}}),Object.defineProperty(exports$1,"RequestType6",{enumerable:!0,get:function(){return messages_1.RequestType6}}),Object.defineProperty(exports$1,"RequestType7",{enumerable:!0,get:function(){return messages_1.RequestType7}}),Object.defineProperty(exports$1,"RequestType8",{enumerable:!0,get:function(){return messages_1.RequestType8}}),Object.defineProperty(exports$1,"RequestType9",{enumerable:!0,get:function(){return messages_1.RequestType9}}),Object.defineProperty(exports$1,"ResponseError",{enumerable:!0,get:function(){return messages_1.ResponseError}}),Object.defineProperty(exports$1,"ErrorCodes",{enumerable:!0,get:function(){return messages_1.ErrorCodes}}),Object.defineProperty(exports$1,"NotificationType",{enumerable:!0,get:function(){return messages_1.NotificationType}}),Object.defineProperty(exports$1,"NotificationType0",{enumerable:!0,get:function(){return messages_1.NotificationType0}}),Object.defineProperty(exports$1,"NotificationType1",{enumerable:!0,get:function(){return messages_1.NotificationType1}}),Object.defineProperty(exports$1,"NotificationType2",{enumerable:!0,get:function(){return messages_1.NotificationType2}}),Object.defineProperty(exports$1,"NotificationType3",{enumerable:!0,get:function(){return messages_1.NotificationType3}}),Object.defineProperty(exports$1,"NotificationType4",{enumerable:!0,get:function(){return messages_1.NotificationType4}}),Object.defineProperty(exports$1,"NotificationType5",{enumerable:!0,get:function(){return messages_1.NotificationType5}}),Object.defineProperty(exports$1,"NotificationType6",{enumerable:!0,get:function(){return messages_1.NotificationType6}}),Object.defineProperty(exports$1,"NotificationType7",{enumerable:!0,get:function(){return messages_1.NotificationType7}}),Object.defineProperty(exports$1,"NotificationType8",{enumerable:!0,get:function(){return messages_1.NotificationType8}}),Object.defineProperty(exports$1,"NotificationType9",{enumerable:!0,get:function(){return messages_1.NotificationType9}}),Object.defineProperty(exports$1,"ParameterStructures",{enumerable:!0,get:function(){return messages_1.ParameterStructures}});const linkedMap_1=requireLinkedMap();Object.defineProperty(exports$1,"LinkedMap",{enumerable:!0,get:function(){return linkedMap_1.LinkedMap}}),Object.defineProperty(exports$1,"LRUCache",{enumerable:!0,get:function(){return linkedMap_1.LRUCache}}),Object.defineProperty(exports$1,"Touch",{enumerable:!0,get:function(){return linkedMap_1.Touch}});const disposable_1=(hasRequiredDisposable||(hasRequiredDisposable=1,Object.defineProperty(disposable,"__esModule",{value:!0}),disposable.Disposable=void 0,(Disposable2||(disposable.Disposable=Disposable2={})).create=function(func){return{dispose:func}}),disposable);var Disposable2;Object.defineProperty(exports$1,"Disposable",{enumerable:!0,get:function(){return disposable_1.Disposable}});const events_1=requireEvents();Object.defineProperty(exports$1,"Event",{enumerable:!0,get:function(){return events_1.Event}}),Object.defineProperty(exports$1,"Emitter",{enumerable:!0,get:function(){return events_1.Emitter}});const cancellation_1=requireCancellation();Object.defineProperty(exports$1,"CancellationTokenSource",{enumerable:!0,get:function(){return cancellation_1.CancellationTokenSource}}),Object.defineProperty(exports$1,"CancellationToken",{enumerable:!0,get:function(){return cancellation_1.CancellationToken}});const sharedArrayCancellation_1=function(){if(hasRequiredSharedArrayCancellation)return sharedArrayCancellation;hasRequiredSharedArrayCancellation=1,Object.defineProperty(sharedArrayCancellation,"__esModule",{value:!0}),sharedArrayCancellation.SharedArrayReceiverStrategy=sharedArrayCancellation.SharedArraySenderStrategy=void 0;const cancellation_1=requireCancellation();var CancellationState,CancellationState2;(CancellationState2=CancellationState||(CancellationState={})).Continue=0,CancellationState2.Cancelled=1,sharedArrayCancellation.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(request){if(null===request.id)return;const buffer=new SharedArrayBuffer(4);new Int32Array(buffer,0,1)[0]=CancellationState.Continue,this.buffers.set(request.id,buffer),request.$cancellationData=buffer}async sendCancellation(_conn,id){const buffer=this.buffers.get(id);if(void 0===buffer)return;const data=new Int32Array(buffer,0,1);Atomics.store(data,0,CancellationState.Cancelled)}cleanup(id){this.buffers.delete(id)}dispose(){this.buffers.clear()}};class SharedArrayBufferCancellationToken{constructor(buffer){this.data=new Int32Array(buffer,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===CancellationState.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class SharedArrayBufferCancellationTokenSource{constructor(buffer){this.token=new SharedArrayBufferCancellationToken(buffer)}cancel(){}dispose(){}}return sharedArrayCancellation.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(request){const buffer=request.$cancellationData;return void 0===buffer?new cancellation_1.CancellationTokenSource:new SharedArrayBufferCancellationTokenSource(buffer)}},sharedArrayCancellation}();Object.defineProperty(exports$1,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return sharedArrayCancellation_1.SharedArraySenderStrategy}}),Object.defineProperty(exports$1,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return sharedArrayCancellation_1.SharedArrayReceiverStrategy}});const messageReader_1=function(){if(hasRequiredMessageReader)return messageReader;hasRequiredMessageReader=1,Object.defineProperty(messageReader,"__esModule",{value:!0}),messageReader.ReadableStreamMessageReader=messageReader.AbstractMessageReader=messageReader.MessageReader=void 0;const ral_1=requireRal(),Is2=requireIs$1(),events_1=requireEvents(),semaphore_1=requireSemaphore();var MessageReader,ResolvedMessageReaderOptions;(MessageReader||(messageReader.MessageReader=MessageReader={})).is=function(value){let candidate=value;return candidate&&Is2.func(candidate.listen)&&Is2.func(candidate.dispose)&&Is2.func(candidate.onError)&&Is2.func(candidate.onClose)&&Is2.func(candidate.onPartialMessage)};class AbstractMessageReader{constructor(){this.errorEmitter=new events_1.Emitter,this.closeEmitter=new events_1.Emitter,this.partialMessageEmitter=new events_1.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(error){this.errorEmitter.fire(this.asError(error))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(info){this.partialMessageEmitter.fire(info)}asError(error){return error instanceof Error?error:new Error(`Reader received error. Reason: ${Is2.string(error.message)?error.message:"unknown"}`)}}return messageReader.AbstractMessageReader=AbstractMessageReader,(ResolvedMessageReaderOptions||(ResolvedMessageReaderOptions={})).fromOptions=function(options){let charset,contentDecoder;const contentDecoders=new Map;let contentTypeDecoder;const contentTypeDecoders=new Map;if(void 0===options||"string"==typeof options)charset=options??"utf-8";else{if(charset=options.charset??"utf-8",void 0!==options.contentDecoder&&(contentDecoder=options.contentDecoder,contentDecoders.set(contentDecoder.name,contentDecoder)),void 0!==options.contentDecoders)for(const decoder of options.contentDecoders)contentDecoders.set(decoder.name,decoder);if(void 0!==options.contentTypeDecoder&&(contentTypeDecoder=options.contentTypeDecoder,contentTypeDecoders.set(contentTypeDecoder.name,contentTypeDecoder)),void 0!==options.contentTypeDecoders)for(const decoder of options.contentTypeDecoders)contentTypeDecoders.set(decoder.name,decoder)}return void 0===contentTypeDecoder&&(contentTypeDecoder=(0,ral_1.default)().applicationJson.decoder,contentTypeDecoders.set(contentTypeDecoder.name,contentTypeDecoder)),{charset:charset,contentDecoder:contentDecoder,contentDecoders:contentDecoders,contentTypeDecoder:contentTypeDecoder,contentTypeDecoders:contentTypeDecoders}},messageReader.ReadableStreamMessageReader=class extends AbstractMessageReader{constructor(readable,options){super(),this.readable=readable,this.options=ResolvedMessageReaderOptions.fromOptions(options),this.buffer=(0,ral_1.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new semaphore_1.Semaphore(1)}set partialMessageTimeout(timeout){this._partialMessageTimeout=timeout}get partialMessageTimeout(){return this._partialMessageTimeout}listen(callback){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=callback;const result=this.readable.onData(data=>{this.onData(data)});return this.readable.onError(error=>this.fireError(error)),this.readable.onClose(()=>this.fireClose()),result}onData(data){try{for(this.buffer.append(data);;){if(-1===this.nextMessageLength){const headers=this.buffer.tryReadHeaders(!0);if(!headers)return;const contentLength=headers.get("content-length");if(!contentLength)return void this.fireError(new Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(headers))}`));const length=parseInt(contentLength);if(isNaN(length))return void this.fireError(new Error(`Content-Length value must be a number. Got ${contentLength}`));this.nextMessageLength=length}const body=this.buffer.tryReadBody(this.nextMessageLength);if(void 0===body)return void this.setPartialMessageTimer();this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const bytes=void 0!==this.options.contentDecoder?await this.options.contentDecoder.decode(body):body,message=await this.options.contentTypeDecoder.decode(bytes,this.options);this.callback(message)}).catch(error=>{this.fireError(error)})}}catch(error){this.fireError(error)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),this._partialMessageTimeout<=0||(this.partialMessageTimer=(0,ral_1.default)().timer.setTimeout((token,timeout)=>{this.partialMessageTimer=void 0,token===this.messageToken&&(this.firePartialMessage({messageToken:token,waitingTime:timeout}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}},messageReader}();Object.defineProperty(exports$1,"MessageReader",{enumerable:!0,get:function(){return messageReader_1.MessageReader}}),Object.defineProperty(exports$1,"AbstractMessageReader",{enumerable:!0,get:function(){return messageReader_1.AbstractMessageReader}}),Object.defineProperty(exports$1,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return messageReader_1.ReadableStreamMessageReader}});const messageWriter_1=function(){if(hasRequiredMessageWriter)return messageWriter;hasRequiredMessageWriter=1,Object.defineProperty(messageWriter,"__esModule",{value:!0}),messageWriter.WriteableStreamMessageWriter=messageWriter.AbstractMessageWriter=messageWriter.MessageWriter=void 0;const ral_1=requireRal(),Is2=requireIs$1(),semaphore_1=requireSemaphore(),events_1=requireEvents();var MessageWriter,ResolvedMessageWriterOptions;(MessageWriter||(messageWriter.MessageWriter=MessageWriter={})).is=function(value){let candidate=value;return candidate&&Is2.func(candidate.dispose)&&Is2.func(candidate.onClose)&&Is2.func(candidate.onError)&&Is2.func(candidate.write)};class AbstractMessageWriter{constructor(){this.errorEmitter=new events_1.Emitter,this.closeEmitter=new events_1.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(error,message,count){this.errorEmitter.fire([this.asError(error),message,count])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(error){return error instanceof Error?error:new Error(`Writer received error. Reason: ${Is2.string(error.message)?error.message:"unknown"}`)}}return messageWriter.AbstractMessageWriter=AbstractMessageWriter,(ResolvedMessageWriterOptions||(ResolvedMessageWriterOptions={})).fromOptions=function(options){return void 0===options||"string"==typeof options?{charset:options??"utf-8",contentTypeEncoder:(0,ral_1.default)().applicationJson.encoder}:{charset:options.charset??"utf-8",contentEncoder:options.contentEncoder,contentTypeEncoder:options.contentTypeEncoder??(0,ral_1.default)().applicationJson.encoder}},messageWriter.WriteableStreamMessageWriter=class extends AbstractMessageWriter{constructor(writable,options){super(),this.writable=writable,this.options=ResolvedMessageWriterOptions.fromOptions(options),this.errorCount=0,this.writeSemaphore=new semaphore_1.Semaphore(1),this.writable.onError(error=>this.fireError(error)),this.writable.onClose(()=>this.fireClose())}async write(msg){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(msg,this.options).then(buffer=>void 0!==this.options.contentEncoder?this.options.contentEncoder.encode(buffer):buffer).then(buffer=>{const headers=[];return headers.push("Content-Length: ",buffer.byteLength.toString(),"\r\n"),headers.push("\r\n"),this.doWrite(msg,headers,buffer)},error=>{throw this.fireError(error),error}))}async doWrite(msg,headers,data){try{return await this.writable.write(headers.join(""),"ascii"),this.writable.write(data)}catch(error){return this.handleError(error,msg),Promise.reject(error)}}handleError(error,msg){this.errorCount++,this.fireError(error,msg,this.errorCount)}end(){this.writable.end()}},messageWriter}();Object.defineProperty(exports$1,"MessageWriter",{enumerable:!0,get:function(){return messageWriter_1.MessageWriter}}),Object.defineProperty(exports$1,"AbstractMessageWriter",{enumerable:!0,get:function(){return messageWriter_1.AbstractMessageWriter}}),Object.defineProperty(exports$1,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return messageWriter_1.WriteableStreamMessageWriter}});const messageBuffer_1=(hasRequiredMessageBuffer||(hasRequiredMessageBuffer=1,Object.defineProperty(messageBuffer,"__esModule",{value:!0}),messageBuffer.AbstractMessageBuffer=void 0,messageBuffer.AbstractMessageBuffer=class{constructor(encoding="utf-8"){this._encoding=encoding,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(chunk){const toAppend="string"==typeof chunk?this.fromString(chunk,this._encoding):chunk;this._chunks.push(toAppend),this._totalLength+=toAppend.byteLength}tryReadHeaders(lowerCaseKeys=!1){if(0===this._chunks.length)return;let state=0,chunkIndex=0,offset=0,chunkBytesRead=0;row:for(;chunkIndex<this._chunks.length;){const chunk=this._chunks[chunkIndex];for(offset=0;offset<chunk.length;){switch(chunk[offset]){case 13:switch(state){case 0:state=1;break;case 2:state=3;break;default:state=0}break;case 10:switch(state){case 1:state=2;break;case 3:state=4,offset++;break row;default:state=0}break;default:state=0}offset++}chunkBytesRead+=chunk.byteLength,chunkIndex++}if(4!==state)return;const buffer=this._read(chunkBytesRead+offset),result=new Map,headers=this.toString(buffer,"ascii").split("\r\n");if(headers.length<2)return result;for(let i=0;i<headers.length-2;i++){const header=headers[i],index=header.indexOf(":");if(-1===index)throw new Error(`Message header must separate key and value using ':'\n${header}`);const key=header.substr(0,index),value=header.substr(index+1).trim();result.set(lowerCaseKeys?key.toLowerCase():key,value)}return result}tryReadBody(length){if(!(this._totalLength<length))return this._read(length)}get numberOfBytes(){return this._totalLength}_read(byteCount){if(0===byteCount)return this.emptyBuffer();if(byteCount>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===byteCount){const chunk=this._chunks[0];return this._chunks.shift(),this._totalLength-=byteCount,this.asNative(chunk)}if(this._chunks[0].byteLength>byteCount){const chunk=this._chunks[0],result2=this.asNative(chunk,byteCount);return this._chunks[0]=chunk.slice(byteCount),this._totalLength-=byteCount,result2}const result=this.allocNative(byteCount);let resultOffset=0;for(;byteCount>0;){const chunk=this._chunks[0];if(chunk.byteLength>byteCount){const chunkPart=chunk.slice(0,byteCount);result.set(chunkPart,resultOffset),resultOffset+=byteCount,this._chunks[0]=chunk.slice(byteCount),this._totalLength-=byteCount,byteCount-=byteCount}else result.set(chunk,resultOffset),resultOffset+=chunk.byteLength,this._chunks.shift(),this._totalLength-=chunk.byteLength,byteCount-=chunk.byteLength}return result}}),messageBuffer);Object.defineProperty(exports$1,"AbstractMessageBuffer",{enumerable:!0,get:function(){return messageBuffer_1.AbstractMessageBuffer}});const connection_1=requireConnection$1();Object.defineProperty(exports$1,"ConnectionStrategy",{enumerable:!0,get:function(){return connection_1.ConnectionStrategy}}),Object.defineProperty(exports$1,"ConnectionOptions",{enumerable:!0,get:function(){return connection_1.ConnectionOptions}}),Object.defineProperty(exports$1,"NullLogger",{enumerable:!0,get:function(){return connection_1.NullLogger}}),Object.defineProperty(exports$1,"createMessageConnection",{enumerable:!0,get:function(){return connection_1.createMessageConnection}}),Object.defineProperty(exports$1,"ProgressToken",{enumerable:!0,get:function(){return connection_1.ProgressToken}}),Object.defineProperty(exports$1,"ProgressType",{enumerable:!0,get:function(){return connection_1.ProgressType}}),Object.defineProperty(exports$1,"Trace",{enumerable:!0,get:function(){return connection_1.Trace}}),Object.defineProperty(exports$1,"TraceValues",{enumerable:!0,get:function(){return connection_1.TraceValues}}),Object.defineProperty(exports$1,"TraceFormat",{enumerable:!0,get:function(){return connection_1.TraceFormat}}),Object.defineProperty(exports$1,"SetTraceNotification",{enumerable:!0,get:function(){return connection_1.SetTraceNotification}}),Object.defineProperty(exports$1,"LogTraceNotification",{enumerable:!0,get:function(){return connection_1.LogTraceNotification}}),Object.defineProperty(exports$1,"ConnectionErrors",{enumerable:!0,get:function(){return connection_1.ConnectionErrors}}),Object.defineProperty(exports$1,"ConnectionError",{enumerable:!0,get:function(){return connection_1.ConnectionError}}),Object.defineProperty(exports$1,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return connection_1.CancellationReceiverStrategy}}),Object.defineProperty(exports$1,"CancellationSenderStrategy",{enumerable:!0,get:function(){return connection_1.CancellationSenderStrategy}}),Object.defineProperty(exports$1,"CancellationStrategy",{enumerable:!0,get:function(){return connection_1.CancellationStrategy}}),Object.defineProperty(exports$1,"MessageStrategy",{enumerable:!0,get:function(){return connection_1.MessageStrategy}});const ral_1=requireRal();exports$1.RAL=ral_1.default}(api$1)),api$1}function requireMain$1(){return hasRequiredMain$1||(hasRequiredMain$1=1,function(exports$1){var __createBinding=main&&main.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&!("get"in desc?!m.__esModule:desc.writable||desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){void 0===k2&&(k2=k),o[k2]=m[k]}),__exportStar=main&&main.__exportStar||function(m,exports$12){for(var p in m)"default"===p||Object.prototype.hasOwnProperty.call(exports$12,p)||__createBinding(exports$12,m,p)};Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.createMessageConnection=exports$1.BrowserMessageWriter=exports$1.BrowserMessageReader=void 0;const ril_1=function(){if(hasRequiredRil)return ril;hasRequiredRil=1,Object.defineProperty(ril,"__esModule",{value:!0});const api_1=requireApi$1();class MessageBuffer extends api_1.AbstractMessageBuffer{constructor(encoding="utf-8"){super(encoding),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return MessageBuffer.emptyBuffer}fromString(value,_encoding){return(new TextEncoder).encode(value)}toString(value,encoding){return"ascii"===encoding?this.asciiDecoder.decode(value):new TextDecoder(encoding).decode(value)}asNative(buffer,length){return void 0===length?buffer:buffer.slice(0,length)}allocNative(length){return new Uint8Array(length)}}MessageBuffer.emptyBuffer=new Uint8Array(0);class ReadableStreamWrapper{constructor(socket){this.socket=socket,this._onData=new api_1.Emitter,this._messageListener=event=>{event.data.arrayBuffer().then(buffer=>{this._onData.fire(new Uint8Array(buffer))},()=>{(0,api_1.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(listener){return this.socket.addEventListener("close",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("close",listener))}onError(listener){return this.socket.addEventListener("error",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("error",listener))}onEnd(listener){return this.socket.addEventListener("end",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("end",listener))}onData(listener){return this._onData.event(listener)}}class WritableStreamWrapper{constructor(socket){this.socket=socket}onClose(listener){return this.socket.addEventListener("close",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("close",listener))}onError(listener){return this.socket.addEventListener("error",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("error",listener))}onEnd(listener){return this.socket.addEventListener("end",listener),api_1.Disposable.create(()=>this.socket.removeEventListener("end",listener))}write(data,encoding){if("string"==typeof data){if(void 0!==encoding&&"utf-8"!==encoding)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${encoding}`);this.socket.send(data)}else this.socket.send(data);return Promise.resolve()}end(){this.socket.close()}}const _textEncoder=new TextEncoder,_ril=Object.freeze({messageBuffer:Object.freeze({create:encoding=>new MessageBuffer(encoding)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(msg,options)=>{if("utf-8"!==options.charset)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${options.charset}`);return Promise.resolve(_textEncoder.encode(JSON.stringify(msg,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(buffer,options)=>{if(!(buffer instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(options.charset).decode(buffer)))}})}),stream:Object.freeze({asReadableStream:socket=>new ReadableStreamWrapper(socket),asWritableStream:socket=>new WritableStreamWrapper(socket)}),console:console,timer:Object.freeze({setTimeout(callback,ms,...args){const handle=setTimeout(callback,ms,...args);return{dispose:()=>clearTimeout(handle)}},setImmediate(callback,...args){const handle=setTimeout(callback,0,...args);return{dispose:()=>clearTimeout(handle)}},setInterval(callback,ms,...args){const handle=setInterval(callback,ms,...args);return{dispose:()=>clearInterval(handle)}}})});function RIL(){return _ril}return(RIL||(RIL={})).install=function(){api_1.RAL.install(_ril)},ril.default=RIL,ril}();ril_1.default.install();const api_1=requireApi$1();__exportStar(requireApi$1(),exports$1);class BrowserMessageReader extends api_1.AbstractMessageReader{constructor(port){super(),this._onData=new api_1.Emitter,this._messageListener=event=>{this._onData.fire(event.data)},port.addEventListener("error",event=>this.fireError(event)),port.onmessage=this._messageListener}listen(callback){return this._onData.event(callback)}}exports$1.BrowserMessageReader=BrowserMessageReader;class BrowserMessageWriter extends api_1.AbstractMessageWriter{constructor(port){super(),this.port=port,this.errorCount=0,port.addEventListener("error",event=>this.fireError(event))}write(msg){try{return this.port.postMessage(msg),Promise.resolve()}catch(error){return this.handleError(error,msg),Promise.reject(error)}}handleError(error,msg){this.errorCount++,this.fireError(error,msg,this.errorCount)}end(){}}exports$1.BrowserMessageWriter=BrowserMessageWriter,exports$1.createMessageConnection=function(reader,writer,logger,options){return void 0===logger&&(logger=api_1.NullLogger),api_1.ConnectionStrategy.is(options)&&(options={connectionStrategy:options}),(0,api_1.createMessageConnection)(reader,writer,logger,options)}}(main)),main}function requireBrowser(){return hasRequiredBrowser?browser:(hasRequiredBrowser=1,browser=requireMain$1())}var api={};const require$$1=getAugmentedNamespace(main$2);var hasRequiredMessages,messages={};function requireMessages(){if(hasRequiredMessages)return messages;hasRequiredMessages=1,Object.defineProperty(messages,"__esModule",{value:!0}),messages.ProtocolNotificationType=messages.ProtocolNotificationType0=messages.ProtocolRequestType=messages.ProtocolRequestType0=messages.RegistrationType=messages.MessageDirection=void 0;const vscode_jsonrpc_1=requireMain$1();var MessageDirection,MessageDirection2;(MessageDirection2=MessageDirection||(messages.MessageDirection=MessageDirection={})).clientToServer="clientToServer",MessageDirection2.serverToClient="serverToClient",MessageDirection2.both="both";messages.RegistrationType=class{constructor(method){this.method=method}};class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0{constructor(method){super(method)}}messages.ProtocolRequestType0=ProtocolRequestType0;class ProtocolRequestType extends vscode_jsonrpc_1.RequestType{constructor(method){super(method,vscode_jsonrpc_1.ParameterStructures.byName)}}messages.ProtocolRequestType=ProtocolRequestType;class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0{constructor(method){super(method)}}messages.ProtocolNotificationType0=ProtocolNotificationType0;class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType{constructor(method){super(method,vscode_jsonrpc_1.ParameterStructures.byName)}}return messages.ProtocolNotificationType=ProtocolNotificationType,messages}var hasRequiredIs,protocol={},is={};function requireIs(){if(hasRequiredIs)return is;function string(value){return"string"==typeof value||value instanceof String}function array(value){return Array.isArray(value)}return hasRequiredIs=1,Object.defineProperty(is,"__esModule",{value:!0}),is.objectLiteral=is.typedArray=is.stringArray=is.array=is.func=is.error=is.number=is.string=is.boolean=void 0,is.boolean=function(value){return!0===value||!1===value},is.string=string,is.number=function(value){return"number"==typeof value||value instanceof Number},is.error=function(value){return value instanceof Error},is.func=function(value){return"function"==typeof value},is.array=array,is.stringArray=function(value){return array(value)&&value.every(elem=>string(elem))},is.typedArray=function(value,check){return Array.isArray(value)&&value.every(check)},is.objectLiteral=function(value){return null!==value&&"object"==typeof value},is}var hasRequiredProtocol_implementation,protocol_implementation={};var hasRequiredProtocol_typeDefinition,protocol_typeDefinition={};var hasRequiredProtocol_workspaceFolder,protocol_workspaceFolder={};var hasRequiredProtocol_configuration,protocol_configuration={};var hasRequiredProtocol_colorProvider,protocol_colorProvider={};var hasRequiredProtocol_foldingRange,protocol_foldingRange={};var hasRequiredProtocol_declaration,protocol_declaration={};var hasRequiredProtocol_selectionRange,protocol_selectionRange={};var hasRequiredProtocol_progress,protocol_progress={};var hasRequiredProtocol_callHierarchy,protocol_callHierarchy={};var hasRequiredProtocol_semanticTokens,protocol_semanticTokens={};var hasRequiredProtocol_showDocument,protocol_showDocument={};var hasRequiredProtocol_linkedEditingRange,protocol_linkedEditingRange={};var hasRequiredProtocol_fileOperations,protocol_fileOperations={};var hasRequiredProtocol_moniker,protocol_moniker={};var hasRequiredProtocol_typeHierarchy,protocol_typeHierarchy={};var hasRequiredProtocol_inlineValue,protocol_inlineValue={};var hasRequiredProtocol_inlayHint,protocol_inlayHint={};var hasRequiredProtocol_diagnostic,protocol_diagnostic={};var hasRequiredProtocol_notebook,protocol_notebook={};function requireProtocol_notebook(){if(hasRequiredProtocol_notebook)return protocol_notebook;hasRequiredProtocol_notebook=1,Object.defineProperty(protocol_notebook,"__esModule",{value:!0}),protocol_notebook.DidCloseNotebookDocumentNotification=protocol_notebook.DidSaveNotebookDocumentNotification=protocol_notebook.DidChangeNotebookDocumentNotification=protocol_notebook.NotebookCellArrayChange=protocol_notebook.DidOpenNotebookDocumentNotification=protocol_notebook.NotebookDocumentSyncRegistrationType=protocol_notebook.NotebookDocument=protocol_notebook.NotebookCell=protocol_notebook.ExecutionSummary=protocol_notebook.NotebookCellKind=void 0;const vscode_languageserver_types_1=require$$1,Is2=requireIs(),messages_1=requireMessages();var NotebookCellKind,NotebookCellKind2,ExecutionSummary,ExecutionSummary2,NotebookCell,NotebookDocument,NotebookDocument2,NotebookDocumentSyncRegistrationType,NotebookDocumentSyncRegistrationType2,DidOpenNotebookDocumentNotification,DidOpenNotebookDocumentNotification2,NotebookCellArrayChange,NotebookCellArrayChange2,DidChangeNotebookDocumentNotification,DidChangeNotebookDocumentNotification2,DidSaveNotebookDocumentNotification,DidSaveNotebookDocumentNotification2,DidCloseNotebookDocumentNotification,DidCloseNotebookDocumentNotification2;return(NotebookCellKind2=NotebookCellKind||(protocol_notebook.NotebookCellKind=NotebookCellKind={})).Markup=1,NotebookCellKind2.Code=2,NotebookCellKind2.is=function(value){return 1===value||2===value},(ExecutionSummary2=ExecutionSummary||(protocol_notebook.ExecutionSummary=ExecutionSummary={})).create=function(executionOrder,success){const result={executionOrder:executionOrder};return!0!==success&&!1!==success||(result.success=success),result},ExecutionSummary2.is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&vscode_languageserver_types_1.uinteger.is(candidate.executionOrder)&&(void 0===candidate.success||Is2.boolean(candidate.success))},ExecutionSummary2.equals=function(one,other){return one===other||null!=one&&null!=other&&one.executionOrder===other.executionOrder&&one.success===other.success},function(NotebookCell2){function equalsMetadata(one,other){if(one===other)return!0;if(null==one||null==other)return!1;if(typeof one!=typeof other)return!1;if("object"!=typeof one)return!1;const oneArray=Array.isArray(one),otherArray=Array.isArray(other);if(oneArray!==otherArray)return!1;if(oneArray&&otherArray){if(one.length!==other.length)return!1;for(let i=0;i<one.length;i++)if(!equalsMetadata(one[i],other[i]))return!1}if(Is2.objectLiteral(one)&&Is2.objectLiteral(other)){const oneKeys=Object.keys(one),otherKeys=Object.keys(other);if(oneKeys.length!==otherKeys.length)return!1;if(oneKeys.sort(),otherKeys.sort(),!equalsMetadata(oneKeys,otherKeys))return!1;for(let i=0;i<oneKeys.length;i++){const prop=oneKeys[i];if(!equalsMetadata(one[prop],other[prop]))return!1}}return!0}NotebookCell2.create=function(kind,document){return{kind:kind,document:document}},NotebookCell2.is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&NotebookCellKind.is(candidate.kind)&&vscode_languageserver_types_1.DocumentUri.is(candidate.document)&&(void 0===candidate.metadata||Is2.objectLiteral(candidate.metadata))},NotebookCell2.diff=function(one,two){const result=new Set;return one.document!==two.document&&result.add("document"),one.kind!==two.kind&&result.add("kind"),one.executionSummary!==two.executionSummary&&result.add("executionSummary"),void 0===one.metadata&&void 0===two.metadata||equalsMetadata(one.metadata,two.metadata)||result.add("metadata"),void 0===one.executionSummary&&void 0===two.executionSummary||ExecutionSummary.equals(one.executionSummary,two.executionSummary)||result.add("executionSummary"),result}}(NotebookCell||(protocol_notebook.NotebookCell=NotebookCell={})),(NotebookDocument2=NotebookDocument||(protocol_notebook.NotebookDocument=NotebookDocument={})).create=function(uri,notebookType,version,cells){return{uri:uri,notebookType:notebookType,version:version,cells:cells}},NotebookDocument2.is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&Is2.string(candidate.uri)&&vscode_languageserver_types_1.integer.is(candidate.version)&&Is2.typedArray(candidate.cells,NotebookCell.is)},(NotebookDocumentSyncRegistrationType2=NotebookDocumentSyncRegistrationType||(protocol_notebook.NotebookDocumentSyncRegistrationType=NotebookDocumentSyncRegistrationType={})).method="notebookDocument/sync",NotebookDocumentSyncRegistrationType2.messageDirection=messages_1.MessageDirection.clientToServer,NotebookDocumentSyncRegistrationType2.type=new messages_1.RegistrationType(NotebookDocumentSyncRegistrationType2.method),(DidOpenNotebookDocumentNotification2=DidOpenNotebookDocumentNotification||(protocol_notebook.DidOpenNotebookDocumentNotification=DidOpenNotebookDocumentNotification={})).method="notebookDocument/didOpen",DidOpenNotebookDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidOpenNotebookDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidOpenNotebookDocumentNotification2.method),DidOpenNotebookDocumentNotification2.registrationMethod=NotebookDocumentSyncRegistrationType.method,(NotebookCellArrayChange2=NotebookCellArrayChange||(protocol_notebook.NotebookCellArrayChange=NotebookCellArrayChange={})).is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&vscode_languageserver_types_1.uinteger.is(candidate.start)&&vscode_languageserver_types_1.uinteger.is(candidate.deleteCount)&&(void 0===candidate.cells||Is2.typedArray(candidate.cells,NotebookCell.is))},NotebookCellArrayChange2.create=function(start,deleteCount,cells){const result={start:start,deleteCount:deleteCount};return void 0!==cells&&(result.cells=cells),result},(DidChangeNotebookDocumentNotification2=DidChangeNotebookDocumentNotification||(protocol_notebook.DidChangeNotebookDocumentNotification=DidChangeNotebookDocumentNotification={})).method="notebookDocument/didChange",DidChangeNotebookDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidChangeNotebookDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidChangeNotebookDocumentNotification2.method),DidChangeNotebookDocumentNotification2.registrationMethod=NotebookDocumentSyncRegistrationType.method,(DidSaveNotebookDocumentNotification2=DidSaveNotebookDocumentNotification||(protocol_notebook.DidSaveNotebookDocumentNotification=DidSaveNotebookDocumentNotification={})).method="notebookDocument/didSave",DidSaveNotebookDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidSaveNotebookDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidSaveNotebookDocumentNotification2.method),DidSaveNotebookDocumentNotification2.registrationMethod=NotebookDocumentSyncRegistrationType.method,(DidCloseNotebookDocumentNotification2=DidCloseNotebookDocumentNotification||(protocol_notebook.DidCloseNotebookDocumentNotification=DidCloseNotebookDocumentNotification={})).method="notebookDocument/didClose",DidCloseNotebookDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidCloseNotebookDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidCloseNotebookDocumentNotification2.method),DidCloseNotebookDocumentNotification2.registrationMethod=NotebookDocumentSyncRegistrationType.method,protocol_notebook}var hasRequiredProtocol_inlineCompletion,hasRequiredProtocol,protocol_inlineCompletion={};function requireProtocol(){return hasRequiredProtocol||(hasRequiredProtocol=1,function(exports$1){Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.WorkspaceSymbolRequest=exports$1.CodeActionResolveRequest=exports$1.CodeActionRequest=exports$1.DocumentSymbolRequest=exports$1.DocumentHighlightRequest=exports$1.ReferencesRequest=exports$1.DefinitionRequest=exports$1.SignatureHelpRequest=exports$1.SignatureHelpTriggerKind=exports$1.HoverRequest=exports$1.CompletionResolveRequest=exports$1.CompletionRequest=exports$1.CompletionTriggerKind=exports$1.PublishDiagnosticsNotification=exports$1.WatchKind=exports$1.RelativePattern=exports$1.FileChangeType=exports$1.DidChangeWatchedFilesNotification=exports$1.WillSaveTextDocumentWaitUntilRequest=exports$1.WillSaveTextDocumentNotification=exports$1.TextDocumentSaveReason=exports$1.DidSaveTextDocumentNotification=exports$1.DidCloseTextDocumentNotification=exports$1.DidChangeTextDocumentNotification=exports$1.TextDocumentContentChangeEvent=exports$1.DidOpenTextDocumentNotification=exports$1.TextDocumentSyncKind=exports$1.TelemetryEventNotification=exports$1.LogMessageNotification=exports$1.ShowMessageRequest=exports$1.ShowMessageNotification=exports$1.MessageType=exports$1.DidChangeConfigurationNotification=exports$1.ExitNotification=exports$1.ShutdownRequest=exports$1.InitializedNotification=exports$1.InitializeErrorCodes=exports$1.InitializeRequest=exports$1.WorkDoneProgressOptions=exports$1.TextDocumentRegistrationOptions=exports$1.StaticRegistrationOptions=exports$1.PositionEncodingKind=exports$1.FailureHandlingKind=exports$1.ResourceOperationKind=exports$1.UnregistrationRequest=exports$1.RegistrationRequest=exports$1.DocumentSelector=exports$1.NotebookCellTextDocumentFilter=exports$1.NotebookDocumentFilter=exports$1.TextDocumentFilter=void 0,exports$1.MonikerRequest=exports$1.MonikerKind=exports$1.UniquenessLevel=exports$1.WillDeleteFilesRequest=exports$1.DidDeleteFilesNotification=exports$1.WillRenameFilesRequest=exports$1.DidRenameFilesNotification=exports$1.WillCreateFilesRequest=exports$1.DidCreateFilesNotification=exports$1.FileOperationPatternKind=exports$1.LinkedEditingRangeRequest=exports$1.ShowDocumentRequest=exports$1.SemanticTokensRegistrationType=exports$1.SemanticTokensRefreshRequest=exports$1.SemanticTokensRangeRequest=exports$1.SemanticTokensDeltaRequest=exports$1.SemanticTokensRequest=exports$1.TokenFormat=exports$1.CallHierarchyPrepareRequest=exports$1.CallHierarchyOutgoingCallsRequest=exports$1.CallHierarchyIncomingCallsRequest=exports$1.WorkDoneProgressCancelNotification=exports$1.WorkDoneProgressCreateRequest=exports$1.WorkDoneProgress=exports$1.SelectionRangeRequest=exports$1.DeclarationRequest=exports$1.FoldingRangeRefreshRequest=exports$1.FoldingRangeRequest=exports$1.ColorPresentationRequest=exports$1.DocumentColorRequest=exports$1.ConfigurationRequest=exports$1.DidChangeWorkspaceFoldersNotification=exports$1.WorkspaceFoldersRequest=exports$1.TypeDefinitionRequest=exports$1.ImplementationRequest=exports$1.ApplyWorkspaceEditRequest=exports$1.ExecuteCommandRequest=exports$1.PrepareRenameRequest=exports$1.RenameRequest=exports$1.PrepareSupportDefaultBehavior=exports$1.DocumentOnTypeFormattingRequest=exports$1.DocumentRangesFormattingRequest=exports$1.DocumentRangeFormattingRequest=exports$1.DocumentFormattingRequest=exports$1.DocumentLinkResolveRequest=exports$1.DocumentLinkRequest=exports$1.CodeLensRefreshRequest=exports$1.CodeLensResolveRequest=exports$1.CodeLensRequest=exports$1.WorkspaceSymbolResolveRequest=void 0,exports$1.InlineCompletionRequest=exports$1.DidCloseNotebookDocumentNotification=exports$1.DidSaveNotebookDocumentNotification=exports$1.DidChangeNotebookDocumentNotification=exports$1.NotebookCellArrayChange=exports$1.DidOpenNotebookDocumentNotification=exports$1.NotebookDocumentSyncRegistrationType=exports$1.NotebookDocument=exports$1.NotebookCell=exports$1.ExecutionSummary=exports$1.NotebookCellKind=exports$1.DiagnosticRefreshRequest=exports$1.WorkspaceDiagnosticRequest=exports$1.DocumentDiagnosticRequest=exports$1.DocumentDiagnosticReportKind=exports$1.DiagnosticServerCancellationData=exports$1.InlayHintRefreshRequest=exports$1.InlayHintResolveRequest=exports$1.InlayHintRequest=exports$1.InlineValueRefreshRequest=exports$1.InlineValueRequest=exports$1.TypeHierarchySupertypesRequest=exports$1.TypeHierarchySubtypesRequest=exports$1.TypeHierarchyPrepareRequest=void 0;const messages_1=requireMessages(),vscode_languageserver_types_1=require$$1,Is2=requireIs(),protocol_implementation_1=function(){if(hasRequiredProtocol_implementation)return protocol_implementation;hasRequiredProtocol_implementation=1,Object.defineProperty(protocol_implementation,"__esModule",{value:!0}),protocol_implementation.ImplementationRequest=void 0;const messages_1=requireMessages();var ImplementationRequest,ImplementationRequest2;return(ImplementationRequest2=ImplementationRequest||(protocol_implementation.ImplementationRequest=ImplementationRequest={})).method="textDocument/implementation",ImplementationRequest2.messageDirection=messages_1.MessageDirection.clientToServer,ImplementationRequest2.type=new messages_1.ProtocolRequestType(ImplementationRequest2.method),protocol_implementation}();Object.defineProperty(exports$1,"ImplementationRequest",{enumerable:!0,get:function(){return protocol_implementation_1.ImplementationRequest}});const protocol_typeDefinition_1=function(){if(hasRequiredProtocol_typeDefinition)return protocol_typeDefinition;hasRequiredProtocol_typeDefinition=1,Object.defineProperty(protocol_typeDefinition,"__esModule",{value:!0}),protocol_typeDefinition.TypeDefinitionRequest=void 0;const messages_1=requireMessages();var TypeDefinitionRequest,TypeDefinitionRequest2;return(TypeDefinitionRequest2=TypeDefinitionRequest||(protocol_typeDefinition.TypeDefinitionRequest=TypeDefinitionRequest={})).method="textDocument/typeDefinition",TypeDefinitionRequest2.messageDirection=messages_1.MessageDirection.clientToServer,TypeDefinitionRequest2.type=new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method),protocol_typeDefinition}();Object.defineProperty(exports$1,"TypeDefinitionRequest",{enumerable:!0,get:function(){return protocol_typeDefinition_1.TypeDefinitionRequest}});const protocol_workspaceFolder_1=function(){if(hasRequiredProtocol_workspaceFolder)return protocol_workspaceFolder;hasRequiredProtocol_workspaceFolder=1,Object.defineProperty(protocol_workspaceFolder,"__esModule",{value:!0}),protocol_workspaceFolder.DidChangeWorkspaceFoldersNotification=protocol_workspaceFolder.WorkspaceFoldersRequest=void 0;const messages_1=requireMessages();var WorkspaceFoldersRequest,WorkspaceFoldersRequest2,DidChangeWorkspaceFoldersNotification,DidChangeWorkspaceFoldersNotification2;return(WorkspaceFoldersRequest2=WorkspaceFoldersRequest||(protocol_workspaceFolder.WorkspaceFoldersRequest=WorkspaceFoldersRequest={})).method="workspace/workspaceFolders",WorkspaceFoldersRequest2.messageDirection=messages_1.MessageDirection.serverToClient,WorkspaceFoldersRequest2.type=new messages_1.ProtocolRequestType0(WorkspaceFoldersRequest2.method),(DidChangeWorkspaceFoldersNotification2=DidChangeWorkspaceFoldersNotification||(protocol_workspaceFolder.DidChangeWorkspaceFoldersNotification=DidChangeWorkspaceFoldersNotification={})).method="workspace/didChangeWorkspaceFolders",DidChangeWorkspaceFoldersNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidChangeWorkspaceFoldersNotification2.type=new messages_1.ProtocolNotificationType(DidChangeWorkspaceFoldersNotification2.method),protocol_workspaceFolder}();Object.defineProperty(exports$1,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return protocol_workspaceFolder_1.WorkspaceFoldersRequest}}),Object.defineProperty(exports$1,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return protocol_workspaceFolder_1.DidChangeWorkspaceFoldersNotification}});const protocol_configuration_1=function(){if(hasRequiredProtocol_configuration)return protocol_configuration;hasRequiredProtocol_configuration=1,Object.defineProperty(protocol_configuration,"__esModule",{value:!0}),protocol_configuration.ConfigurationRequest=void 0;const messages_1=requireMessages();var ConfigurationRequest,ConfigurationRequest2;return(ConfigurationRequest2=ConfigurationRequest||(protocol_configuration.ConfigurationRequest=ConfigurationRequest={})).method="workspace/configuration",ConfigurationRequest2.messageDirection=messages_1.MessageDirection.serverToClient,ConfigurationRequest2.type=new messages_1.ProtocolRequestType(ConfigurationRequest2.method),protocol_configuration}();Object.defineProperty(exports$1,"ConfigurationRequest",{enumerable:!0,get:function(){return protocol_configuration_1.ConfigurationRequest}});const protocol_colorProvider_1=function(){if(hasRequiredProtocol_colorProvider)return protocol_colorProvider;hasRequiredProtocol_colorProvider=1,Object.defineProperty(protocol_colorProvider,"__esModule",{value:!0}),protocol_colorProvider.ColorPresentationRequest=protocol_colorProvider.DocumentColorRequest=void 0;const messages_1=requireMessages();var DocumentColorRequest,DocumentColorRequest2,ColorPresentationRequest,ColorPresentationRequest2;return(DocumentColorRequest2=DocumentColorRequest||(protocol_colorProvider.DocumentColorRequest=DocumentColorRequest={})).method="textDocument/documentColor",DocumentColorRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentColorRequest2.type=new messages_1.ProtocolRequestType(DocumentColorRequest2.method),(ColorPresentationRequest2=ColorPresentationRequest||(protocol_colorProvider.ColorPresentationRequest=ColorPresentationRequest={})).method="textDocument/colorPresentation",ColorPresentationRequest2.messageDirection=messages_1.MessageDirection.clientToServer,ColorPresentationRequest2.type=new messages_1.ProtocolRequestType(ColorPresentationRequest2.method),protocol_colorProvider}();Object.defineProperty(exports$1,"DocumentColorRequest",{enumerable:!0,get:function(){return protocol_colorProvider_1.DocumentColorRequest}}),Object.defineProperty(exports$1,"ColorPresentationRequest",{enumerable:!0,get:function(){return protocol_colorProvider_1.ColorPresentationRequest}});const protocol_foldingRange_1=function(){if(hasRequiredProtocol_foldingRange)return protocol_foldingRange;hasRequiredProtocol_foldingRange=1,Object.defineProperty(protocol_foldingRange,"__esModule",{value:!0}),protocol_foldingRange.FoldingRangeRefreshRequest=protocol_foldingRange.FoldingRangeRequest=void 0;const messages_1=requireMessages();var FoldingRangeRequest,FoldingRangeRequest2,FoldingRangeRefreshRequest,FoldingRangeRefreshRequest2;return(FoldingRangeRequest2=FoldingRangeRequest||(protocol_foldingRange.FoldingRangeRequest=FoldingRangeRequest={})).method="textDocument/foldingRange",FoldingRangeRequest2.messageDirection=messages_1.MessageDirection.clientToServer,FoldingRangeRequest2.type=new messages_1.ProtocolRequestType(FoldingRangeRequest2.method),(FoldingRangeRefreshRequest2=FoldingRangeRefreshRequest||(protocol_foldingRange.FoldingRangeRefreshRequest=FoldingRangeRefreshRequest={})).method="workspace/foldingRange/refresh",FoldingRangeRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,FoldingRangeRefreshRequest2.type=new messages_1.ProtocolRequestType0(FoldingRangeRefreshRequest2.method),protocol_foldingRange}();Object.defineProperty(exports$1,"FoldingRangeRequest",{enumerable:!0,get:function(){return protocol_foldingRange_1.FoldingRangeRequest}}),Object.defineProperty(exports$1,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return protocol_foldingRange_1.FoldingRangeRefreshRequest}});const protocol_declaration_1=function(){if(hasRequiredProtocol_declaration)return protocol_declaration;hasRequiredProtocol_declaration=1,Object.defineProperty(protocol_declaration,"__esModule",{value:!0}),protocol_declaration.DeclarationRequest=void 0;const messages_1=requireMessages();var DeclarationRequest,DeclarationRequest2;return(DeclarationRequest2=DeclarationRequest||(protocol_declaration.DeclarationRequest=DeclarationRequest={})).method="textDocument/declaration",DeclarationRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DeclarationRequest2.type=new messages_1.ProtocolRequestType(DeclarationRequest2.method),protocol_declaration}();Object.defineProperty(exports$1,"DeclarationRequest",{enumerable:!0,get:function(){return protocol_declaration_1.DeclarationRequest}});const protocol_selectionRange_1=function(){if(hasRequiredProtocol_selectionRange)return protocol_selectionRange;hasRequiredProtocol_selectionRange=1,Object.defineProperty(protocol_selectionRange,"__esModule",{value:!0}),protocol_selectionRange.SelectionRangeRequest=void 0;const messages_1=requireMessages();var SelectionRangeRequest,SelectionRangeRequest2;return(SelectionRangeRequest2=SelectionRangeRequest||(protocol_selectionRange.SelectionRangeRequest=SelectionRangeRequest={})).method="textDocument/selectionRange",SelectionRangeRequest2.messageDirection=messages_1.MessageDirection.clientToServer,SelectionRangeRequest2.type=new messages_1.ProtocolRequestType(SelectionRangeRequest2.method),protocol_selectionRange}();Object.defineProperty(exports$1,"SelectionRangeRequest",{enumerable:!0,get:function(){return protocol_selectionRange_1.SelectionRangeRequest}});const protocol_progress_1=function(){if(hasRequiredProtocol_progress)return protocol_progress;hasRequiredProtocol_progress=1,Object.defineProperty(protocol_progress,"__esModule",{value:!0}),protocol_progress.WorkDoneProgressCancelNotification=protocol_progress.WorkDoneProgressCreateRequest=protocol_progress.WorkDoneProgress=void 0;const vscode_jsonrpc_1=requireMain$1(),messages_1=requireMessages();var WorkDoneProgress,WorkDoneProgress2,WorkDoneProgressCreateRequest,WorkDoneProgressCreateRequest2,WorkDoneProgressCancelNotification,WorkDoneProgressCancelNotification2;return(WorkDoneProgress2=WorkDoneProgress||(protocol_progress.WorkDoneProgress=WorkDoneProgress={})).type=new vscode_jsonrpc_1.ProgressType,WorkDoneProgress2.is=function(value){return value===WorkDoneProgress2.type},(WorkDoneProgressCreateRequest2=WorkDoneProgressCreateRequest||(protocol_progress.WorkDoneProgressCreateRequest=WorkDoneProgressCreateRequest={})).method="window/workDoneProgress/create",WorkDoneProgressCreateRequest2.messageDirection=messages_1.MessageDirection.serverToClient,WorkDoneProgressCreateRequest2.type=new messages_1.ProtocolRequestType(WorkDoneProgressCreateRequest2.method),(WorkDoneProgressCancelNotification2=WorkDoneProgressCancelNotification||(protocol_progress.WorkDoneProgressCancelNotification=WorkDoneProgressCancelNotification={})).method="window/workDoneProgress/cancel",WorkDoneProgressCancelNotification2.messageDirection=messages_1.MessageDirection.clientToServer,WorkDoneProgressCancelNotification2.type=new messages_1.ProtocolNotificationType(WorkDoneProgressCancelNotification2.method),protocol_progress}();Object.defineProperty(exports$1,"WorkDoneProgress",{enumerable:!0,get:function(){return protocol_progress_1.WorkDoneProgress}}),Object.defineProperty(exports$1,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return protocol_progress_1.WorkDoneProgressCreateRequest}}),Object.defineProperty(exports$1,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return protocol_progress_1.WorkDoneProgressCancelNotification}});const protocol_callHierarchy_1=function(){if(hasRequiredProtocol_callHierarchy)return protocol_callHierarchy;hasRequiredProtocol_callHierarchy=1,Object.defineProperty(protocol_callHierarchy,"__esModule",{value:!0}),protocol_callHierarchy.CallHierarchyOutgoingCallsRequest=protocol_callHierarchy.CallHierarchyIncomingCallsRequest=protocol_callHierarchy.CallHierarchyPrepareRequest=void 0;const messages_1=requireMessages();var CallHierarchyPrepareRequest,CallHierarchyPrepareRequest2,CallHierarchyIncomingCallsRequest,CallHierarchyIncomingCallsRequest2,CallHierarchyOutgoingCallsRequest,CallHierarchyOutgoingCallsRequest2;return(CallHierarchyPrepareRequest2=CallHierarchyPrepareRequest||(protocol_callHierarchy.CallHierarchyPrepareRequest=CallHierarchyPrepareRequest={})).method="textDocument/prepareCallHierarchy",CallHierarchyPrepareRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CallHierarchyPrepareRequest2.type=new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method),(CallHierarchyIncomingCallsRequest2=CallHierarchyIncomingCallsRequest||(protocol_callHierarchy.CallHierarchyIncomingCallsRequest=CallHierarchyIncomingCallsRequest={})).method="callHierarchy/incomingCalls",CallHierarchyIncomingCallsRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CallHierarchyIncomingCallsRequest2.type=new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method),(CallHierarchyOutgoingCallsRequest2=CallHierarchyOutgoingCallsRequest||(protocol_callHierarchy.CallHierarchyOutgoingCallsRequest=CallHierarchyOutgoingCallsRequest={})).method="callHierarchy/outgoingCalls",CallHierarchyOutgoingCallsRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CallHierarchyOutgoingCallsRequest2.type=new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method),protocol_callHierarchy}();Object.defineProperty(exports$1,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(exports$1,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(exports$1,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return protocol_callHierarchy_1.CallHierarchyPrepareRequest}});const protocol_semanticTokens_1=function(){if(hasRequiredProtocol_semanticTokens)return protocol_semanticTokens;hasRequiredProtocol_semanticTokens=1,Object.defineProperty(protocol_semanticTokens,"__esModule",{value:!0}),protocol_semanticTokens.SemanticTokensRefreshRequest=protocol_semanticTokens.SemanticTokensRangeRequest=protocol_semanticTokens.SemanticTokensDeltaRequest=protocol_semanticTokens.SemanticTokensRequest=protocol_semanticTokens.SemanticTokensRegistrationType=protocol_semanticTokens.TokenFormat=void 0;const messages_1=requireMessages();var TokenFormat,SemanticTokensRegistrationType,SemanticTokensRegistrationType2,SemanticTokensRequest,SemanticTokensRequest2,SemanticTokensDeltaRequest,SemanticTokensDeltaRequest2,SemanticTokensRangeRequest,SemanticTokensRangeRequest2,SemanticTokensRefreshRequest,SemanticTokensRefreshRequest2;return(TokenFormat||(protocol_semanticTokens.TokenFormat=TokenFormat={})).Relative="relative",(SemanticTokensRegistrationType2=SemanticTokensRegistrationType||(protocol_semanticTokens.SemanticTokensRegistrationType=SemanticTokensRegistrationType={})).method="textDocument/semanticTokens",SemanticTokensRegistrationType2.type=new messages_1.RegistrationType(SemanticTokensRegistrationType2.method),(SemanticTokensRequest2=SemanticTokensRequest||(protocol_semanticTokens.SemanticTokensRequest=SemanticTokensRequest={})).method="textDocument/semanticTokens/full",SemanticTokensRequest2.messageDirection=messages_1.MessageDirection.clientToServer,SemanticTokensRequest2.type=new messages_1.ProtocolRequestType(SemanticTokensRequest2.method),SemanticTokensRequest2.registrationMethod=SemanticTokensRegistrationType.method,(SemanticTokensDeltaRequest2=SemanticTokensDeltaRequest||(protocol_semanticTokens.SemanticTokensDeltaRequest=SemanticTokensDeltaRequest={})).method="textDocument/semanticTokens/full/delta",SemanticTokensDeltaRequest2.messageDirection=messages_1.MessageDirection.clientToServer,SemanticTokensDeltaRequest2.type=new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method),SemanticTokensDeltaRequest2.registrationMethod=SemanticTokensRegistrationType.method,(SemanticTokensRangeRequest2=SemanticTokensRangeRequest||(protocol_semanticTokens.SemanticTokensRangeRequest=SemanticTokensRangeRequest={})).method="textDocument/semanticTokens/range",SemanticTokensRangeRequest2.messageDirection=messages_1.MessageDirection.clientToServer,SemanticTokensRangeRequest2.type=new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method),SemanticTokensRangeRequest2.registrationMethod=SemanticTokensRegistrationType.method,(SemanticTokensRefreshRequest2=SemanticTokensRefreshRequest||(protocol_semanticTokens.SemanticTokensRefreshRequest=SemanticTokensRefreshRequest={})).method="workspace/semanticTokens/refresh",SemanticTokensRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,SemanticTokensRefreshRequest2.type=new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method),protocol_semanticTokens}();Object.defineProperty(exports$1,"TokenFormat",{enumerable:!0,get:function(){return protocol_semanticTokens_1.TokenFormat}}),Object.defineProperty(exports$1,"SemanticTokensRequest",{enumerable:!0,get:function(){return protocol_semanticTokens_1.SemanticTokensRequest}}),Object.defineProperty(exports$1,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return protocol_semanticTokens_1.SemanticTokensDeltaRequest}}),Object.defineProperty(exports$1,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return protocol_semanticTokens_1.SemanticTokensRangeRequest}}),Object.defineProperty(exports$1,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return protocol_semanticTokens_1.SemanticTokensRefreshRequest}}),Object.defineProperty(exports$1,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return protocol_semanticTokens_1.SemanticTokensRegistrationType}});const protocol_showDocument_1=function(){if(hasRequiredProtocol_showDocument)return protocol_showDocument;hasRequiredProtocol_showDocument=1,Object.defineProperty(protocol_showDocument,"__esModule",{value:!0}),protocol_showDocument.ShowDocumentRequest=void 0;const messages_1=requireMessages();var ShowDocumentRequest,ShowDocumentRequest2;return(ShowDocumentRequest2=ShowDocumentRequest||(protocol_showDocument.ShowDocumentRequest=ShowDocumentRequest={})).method="window/showDocument",ShowDocumentRequest2.messageDirection=messages_1.MessageDirection.serverToClient,ShowDocumentRequest2.type=new messages_1.ProtocolRequestType(ShowDocumentRequest2.method),protocol_showDocument}();Object.defineProperty(exports$1,"ShowDocumentRequest",{enumerable:!0,get:function(){return protocol_showDocument_1.ShowDocumentRequest}});const protocol_linkedEditingRange_1=function(){if(hasRequiredProtocol_linkedEditingRange)return protocol_linkedEditingRange;hasRequiredProtocol_linkedEditingRange=1,Object.defineProperty(protocol_linkedEditingRange,"__esModule",{value:!0}),protocol_linkedEditingRange.LinkedEditingRangeRequest=void 0;const messages_1=requireMessages();var LinkedEditingRangeRequest,LinkedEditingRangeRequest2;return(LinkedEditingRangeRequest2=LinkedEditingRangeRequest||(protocol_linkedEditingRange.LinkedEditingRangeRequest=LinkedEditingRangeRequest={})).method="textDocument/linkedEditingRange",LinkedEditingRangeRequest2.messageDirection=messages_1.MessageDirection.clientToServer,LinkedEditingRangeRequest2.type=new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method),protocol_linkedEditingRange}();Object.defineProperty(exports$1,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return protocol_linkedEditingRange_1.LinkedEditingRangeRequest}});const protocol_fileOperations_1=function(){if(hasRequiredProtocol_fileOperations)return protocol_fileOperations;hasRequiredProtocol_fileOperations=1,Object.defineProperty(protocol_fileOperations,"__esModule",{value:!0}),protocol_fileOperations.WillDeleteFilesRequest=protocol_fileOperations.DidDeleteFilesNotification=protocol_fileOperations.DidRenameFilesNotification=protocol_fileOperations.WillRenameFilesRequest=protocol_fileOperations.DidCreateFilesNotification=protocol_fileOperations.WillCreateFilesRequest=protocol_fileOperations.FileOperationPatternKind=void 0;const messages_1=requireMessages();var FileOperationPatternKind,FileOperationPatternKind2,WillCreateFilesRequest,WillCreateFilesRequest2,DidCreateFilesNotification,DidCreateFilesNotification2,WillRenameFilesRequest,WillRenameFilesRequest2,DidRenameFilesNotification,DidRenameFilesNotification2,DidDeleteFilesNotification,DidDeleteFilesNotification2,WillDeleteFilesRequest,WillDeleteFilesRequest2;return(FileOperationPatternKind2=FileOperationPatternKind||(protocol_fileOperations.FileOperationPatternKind=FileOperationPatternKind={})).file="file",FileOperationPatternKind2.folder="folder",(WillCreateFilesRequest2=WillCreateFilesRequest||(protocol_fileOperations.WillCreateFilesRequest=WillCreateFilesRequest={})).method="workspace/willCreateFiles",WillCreateFilesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WillCreateFilesRequest2.type=new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method),(DidCreateFilesNotification2=DidCreateFilesNotification||(protocol_fileOperations.DidCreateFilesNotification=DidCreateFilesNotification={})).method="workspace/didCreateFiles",DidCreateFilesNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidCreateFilesNotification2.type=new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method),(WillRenameFilesRequest2=WillRenameFilesRequest||(protocol_fileOperations.WillRenameFilesRequest=WillRenameFilesRequest={})).method="workspace/willRenameFiles",WillRenameFilesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WillRenameFilesRequest2.type=new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method),(DidRenameFilesNotification2=DidRenameFilesNotification||(protocol_fileOperations.DidRenameFilesNotification=DidRenameFilesNotification={})).method="workspace/didRenameFiles",DidRenameFilesNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidRenameFilesNotification2.type=new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method),(DidDeleteFilesNotification2=DidDeleteFilesNotification||(protocol_fileOperations.DidDeleteFilesNotification=DidDeleteFilesNotification={})).method="workspace/didDeleteFiles",DidDeleteFilesNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidDeleteFilesNotification2.type=new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method),(WillDeleteFilesRequest2=WillDeleteFilesRequest||(protocol_fileOperations.WillDeleteFilesRequest=WillDeleteFilesRequest={})).method="workspace/willDeleteFiles",WillDeleteFilesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WillDeleteFilesRequest2.type=new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method),protocol_fileOperations}();Object.defineProperty(exports$1,"FileOperationPatternKind",{enumerable:!0,get:function(){return protocol_fileOperations_1.FileOperationPatternKind}}),Object.defineProperty(exports$1,"DidCreateFilesNotification",{enumerable:!0,get:function(){return protocol_fileOperations_1.DidCreateFilesNotification}}),Object.defineProperty(exports$1,"WillCreateFilesRequest",{enumerable:!0,get:function(){return protocol_fileOperations_1.WillCreateFilesRequest}}),Object.defineProperty(exports$1,"DidRenameFilesNotification",{enumerable:!0,get:function(){return protocol_fileOperations_1.DidRenameFilesNotification}}),Object.defineProperty(exports$1,"WillRenameFilesRequest",{enumerable:!0,get:function(){return protocol_fileOperations_1.WillRenameFilesRequest}}),Object.defineProperty(exports$1,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return protocol_fileOperations_1.DidDeleteFilesNotification}}),Object.defineProperty(exports$1,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return protocol_fileOperations_1.WillDeleteFilesRequest}});const protocol_moniker_1=function(){if(hasRequiredProtocol_moniker)return protocol_moniker;hasRequiredProtocol_moniker=1,Object.defineProperty(protocol_moniker,"__esModule",{value:!0}),protocol_moniker.MonikerRequest=protocol_moniker.MonikerKind=protocol_moniker.UniquenessLevel=void 0;const messages_1=requireMessages();var UniquenessLevel,UniquenessLevel2,MonikerKind,MonikerKind2,MonikerRequest,MonikerRequest2;return(UniquenessLevel2=UniquenessLevel||(protocol_moniker.UniquenessLevel=UniquenessLevel={})).document="document",UniquenessLevel2.project="project",UniquenessLevel2.group="group",UniquenessLevel2.scheme="scheme",UniquenessLevel2.global="global",(MonikerKind2=MonikerKind||(protocol_moniker.MonikerKind=MonikerKind={})).$import="import",MonikerKind2.$export="export",MonikerKind2.local="local",(MonikerRequest2=MonikerRequest||(protocol_moniker.MonikerRequest=MonikerRequest={})).method="textDocument/moniker",MonikerRequest2.messageDirection=messages_1.MessageDirection.clientToServer,MonikerRequest2.type=new messages_1.ProtocolRequestType(MonikerRequest2.method),protocol_moniker}();Object.defineProperty(exports$1,"UniquenessLevel",{enumerable:!0,get:function(){return protocol_moniker_1.UniquenessLevel}}),Object.defineProperty(exports$1,"MonikerKind",{enumerable:!0,get:function(){return protocol_moniker_1.MonikerKind}}),Object.defineProperty(exports$1,"MonikerRequest",{enumerable:!0,get:function(){return protocol_moniker_1.MonikerRequest}});const protocol_typeHierarchy_1=function(){if(hasRequiredProtocol_typeHierarchy)return protocol_typeHierarchy;hasRequiredProtocol_typeHierarchy=1,Object.defineProperty(protocol_typeHierarchy,"__esModule",{value:!0}),protocol_typeHierarchy.TypeHierarchySubtypesRequest=protocol_typeHierarchy.TypeHierarchySupertypesRequest=protocol_typeHierarchy.TypeHierarchyPrepareRequest=void 0;const messages_1=requireMessages();var TypeHierarchyPrepareRequest,TypeHierarchyPrepareRequest2,TypeHierarchySupertypesRequest,TypeHierarchySupertypesRequest2,TypeHierarchySubtypesRequest,TypeHierarchySubtypesRequest2;return(TypeHierarchyPrepareRequest2=TypeHierarchyPrepareRequest||(protocol_typeHierarchy.TypeHierarchyPrepareRequest=TypeHierarchyPrepareRequest={})).method="textDocument/prepareTypeHierarchy",TypeHierarchyPrepareRequest2.messageDirection=messages_1.MessageDirection.clientToServer,TypeHierarchyPrepareRequest2.type=new messages_1.ProtocolRequestType(TypeHierarchyPrepareRequest2.method),(TypeHierarchySupertypesRequest2=TypeHierarchySupertypesRequest||(protocol_typeHierarchy.TypeHierarchySupertypesRequest=TypeHierarchySupertypesRequest={})).method="typeHierarchy/supertypes",TypeHierarchySupertypesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,TypeHierarchySupertypesRequest2.type=new messages_1.ProtocolRequestType(TypeHierarchySupertypesRequest2.method),(TypeHierarchySubtypesRequest2=TypeHierarchySubtypesRequest||(protocol_typeHierarchy.TypeHierarchySubtypesRequest=TypeHierarchySubtypesRequest={})).method="typeHierarchy/subtypes",TypeHierarchySubtypesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,TypeHierarchySubtypesRequest2.type=new messages_1.ProtocolRequestType(TypeHierarchySubtypesRequest2.method),protocol_typeHierarchy}();Object.defineProperty(exports$1,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return protocol_typeHierarchy_1.TypeHierarchyPrepareRequest}}),Object.defineProperty(exports$1,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return protocol_typeHierarchy_1.TypeHierarchySubtypesRequest}}),Object.defineProperty(exports$1,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return protocol_typeHierarchy_1.TypeHierarchySupertypesRequest}});const protocol_inlineValue_1=function(){if(hasRequiredProtocol_inlineValue)return protocol_inlineValue;hasRequiredProtocol_inlineValue=1,Object.defineProperty(protocol_inlineValue,"__esModule",{value:!0}),protocol_inlineValue.InlineValueRefreshRequest=protocol_inlineValue.InlineValueRequest=void 0;const messages_1=requireMessages();var InlineValueRequest,InlineValueRequest2,InlineValueRefreshRequest,InlineValueRefreshRequest2;return(InlineValueRequest2=InlineValueRequest||(protocol_inlineValue.InlineValueRequest=InlineValueRequest={})).method="textDocument/inlineValue",InlineValueRequest2.messageDirection=messages_1.MessageDirection.clientToServer,InlineValueRequest2.type=new messages_1.ProtocolRequestType(InlineValueRequest2.method),(InlineValueRefreshRequest2=InlineValueRefreshRequest||(protocol_inlineValue.InlineValueRefreshRequest=InlineValueRefreshRequest={})).method="workspace/inlineValue/refresh",InlineValueRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,InlineValueRefreshRequest2.type=new messages_1.ProtocolRequestType0(InlineValueRefreshRequest2.method),protocol_inlineValue}();Object.defineProperty(exports$1,"InlineValueRequest",{enumerable:!0,get:function(){return protocol_inlineValue_1.InlineValueRequest}}),Object.defineProperty(exports$1,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return protocol_inlineValue_1.InlineValueRefreshRequest}});const protocol_inlayHint_1=function(){if(hasRequiredProtocol_inlayHint)return protocol_inlayHint;hasRequiredProtocol_inlayHint=1,Object.defineProperty(protocol_inlayHint,"__esModule",{value:!0}),protocol_inlayHint.InlayHintRefreshRequest=protocol_inlayHint.InlayHintResolveRequest=protocol_inlayHint.InlayHintRequest=void 0;const messages_1=requireMessages();var InlayHintRequest,InlayHintRequest2,InlayHintResolveRequest,InlayHintResolveRequest2,InlayHintRefreshRequest,InlayHintRefreshRequest2;return(InlayHintRequest2=InlayHintRequest||(protocol_inlayHint.InlayHintRequest=InlayHintRequest={})).method="textDocument/inlayHint",InlayHintRequest2.messageDirection=messages_1.MessageDirection.clientToServer,InlayHintRequest2.type=new messages_1.ProtocolRequestType(InlayHintRequest2.method),(InlayHintResolveRequest2=InlayHintResolveRequest||(protocol_inlayHint.InlayHintResolveRequest=InlayHintResolveRequest={})).method="inlayHint/resolve",InlayHintResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,InlayHintResolveRequest2.type=new messages_1.ProtocolRequestType(InlayHintResolveRequest2.method),(InlayHintRefreshRequest2=InlayHintRefreshRequest||(protocol_inlayHint.InlayHintRefreshRequest=InlayHintRefreshRequest={})).method="workspace/inlayHint/refresh",InlayHintRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,InlayHintRefreshRequest2.type=new messages_1.ProtocolRequestType0(InlayHintRefreshRequest2.method),protocol_inlayHint}();Object.defineProperty(exports$1,"InlayHintRequest",{enumerable:!0,get:function(){return protocol_inlayHint_1.InlayHintRequest}}),Object.defineProperty(exports$1,"InlayHintResolveRequest",{enumerable:!0,get:function(){return protocol_inlayHint_1.InlayHintResolveRequest}}),Object.defineProperty(exports$1,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return protocol_inlayHint_1.InlayHintRefreshRequest}});const protocol_diagnostic_1=function(){if(hasRequiredProtocol_diagnostic)return protocol_diagnostic;hasRequiredProtocol_diagnostic=1,Object.defineProperty(protocol_diagnostic,"__esModule",{value:!0}),protocol_diagnostic.DiagnosticRefreshRequest=protocol_diagnostic.WorkspaceDiagnosticRequest=protocol_diagnostic.DocumentDiagnosticRequest=protocol_diagnostic.DocumentDiagnosticReportKind=protocol_diagnostic.DiagnosticServerCancellationData=void 0;const vscode_jsonrpc_1=requireMain$1(),Is2=requireIs(),messages_1=requireMessages();var DiagnosticServerCancellationData,DocumentDiagnosticReportKind,DocumentDiagnosticReportKind2,DocumentDiagnosticRequest,DocumentDiagnosticRequest2,WorkspaceDiagnosticRequest,WorkspaceDiagnosticRequest2,DiagnosticRefreshRequest,DiagnosticRefreshRequest2;return(DiagnosticServerCancellationData||(protocol_diagnostic.DiagnosticServerCancellationData=DiagnosticServerCancellationData={})).is=function(value){const candidate=value;return candidate&&Is2.boolean(candidate.retriggerRequest)},(DocumentDiagnosticReportKind2=DocumentDiagnosticReportKind||(protocol_diagnostic.DocumentDiagnosticReportKind=DocumentDiagnosticReportKind={})).Full="full",DocumentDiagnosticReportKind2.Unchanged="unchanged",(DocumentDiagnosticRequest2=DocumentDiagnosticRequest||(protocol_diagnostic.DocumentDiagnosticRequest=DocumentDiagnosticRequest={})).method="textDocument/diagnostic",DocumentDiagnosticRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentDiagnosticRequest2.type=new messages_1.ProtocolRequestType(DocumentDiagnosticRequest2.method),DocumentDiagnosticRequest2.partialResult=new vscode_jsonrpc_1.ProgressType,(WorkspaceDiagnosticRequest2=WorkspaceDiagnosticRequest||(protocol_diagnostic.WorkspaceDiagnosticRequest=WorkspaceDiagnosticRequest={})).method="workspace/diagnostic",WorkspaceDiagnosticRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WorkspaceDiagnosticRequest2.type=new messages_1.ProtocolRequestType(WorkspaceDiagnosticRequest2.method),WorkspaceDiagnosticRequest2.partialResult=new vscode_jsonrpc_1.ProgressType,(DiagnosticRefreshRequest2=DiagnosticRefreshRequest||(protocol_diagnostic.DiagnosticRefreshRequest=DiagnosticRefreshRequest={})).method="workspace/diagnostic/refresh",DiagnosticRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,DiagnosticRefreshRequest2.type=new messages_1.ProtocolRequestType0(DiagnosticRefreshRequest2.method),protocol_diagnostic}();Object.defineProperty(exports$1,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return protocol_diagnostic_1.DiagnosticServerCancellationData}}),Object.defineProperty(exports$1,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return protocol_diagnostic_1.DocumentDiagnosticReportKind}}),Object.defineProperty(exports$1,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return protocol_diagnostic_1.DocumentDiagnosticRequest}}),Object.defineProperty(exports$1,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return protocol_diagnostic_1.WorkspaceDiagnosticRequest}}),Object.defineProperty(exports$1,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return protocol_diagnostic_1.DiagnosticRefreshRequest}});const protocol_notebook_1=requireProtocol_notebook();Object.defineProperty(exports$1,"NotebookCellKind",{enumerable:!0,get:function(){return protocol_notebook_1.NotebookCellKind}}),Object.defineProperty(exports$1,"ExecutionSummary",{enumerable:!0,get:function(){return protocol_notebook_1.ExecutionSummary}}),Object.defineProperty(exports$1,"NotebookCell",{enumerable:!0,get:function(){return protocol_notebook_1.NotebookCell}}),Object.defineProperty(exports$1,"NotebookDocument",{enumerable:!0,get:function(){return protocol_notebook_1.NotebookDocument}}),Object.defineProperty(exports$1,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return protocol_notebook_1.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(exports$1,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return protocol_notebook_1.DidOpenNotebookDocumentNotification}}),Object.defineProperty(exports$1,"NotebookCellArrayChange",{enumerable:!0,get:function(){return protocol_notebook_1.NotebookCellArrayChange}}),Object.defineProperty(exports$1,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return protocol_notebook_1.DidChangeNotebookDocumentNotification}}),Object.defineProperty(exports$1,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return protocol_notebook_1.DidSaveNotebookDocumentNotification}}),Object.defineProperty(exports$1,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return protocol_notebook_1.DidCloseNotebookDocumentNotification}});const protocol_inlineCompletion_1=function(){if(hasRequiredProtocol_inlineCompletion)return protocol_inlineCompletion;hasRequiredProtocol_inlineCompletion=1,Object.defineProperty(protocol_inlineCompletion,"__esModule",{value:!0}),protocol_inlineCompletion.InlineCompletionRequest=void 0;const messages_1=requireMessages();var InlineCompletionRequest,InlineCompletionRequest2;return(InlineCompletionRequest2=InlineCompletionRequest||(protocol_inlineCompletion.InlineCompletionRequest=InlineCompletionRequest={})).method="textDocument/inlineCompletion",InlineCompletionRequest2.messageDirection=messages_1.MessageDirection.clientToServer,InlineCompletionRequest2.type=new messages_1.ProtocolRequestType(InlineCompletionRequest2.method),protocol_inlineCompletion}();var TextDocumentFilter,NotebookDocumentFilter,NotebookCellTextDocumentFilter,DocumentSelector,RegistrationRequest,RegistrationRequest2,UnregistrationRequest,UnregistrationRequest2,ResourceOperationKind,ResourceOperationKind2,FailureHandlingKind,FailureHandlingKind2,PositionEncodingKind,PositionEncodingKind2,StaticRegistrationOptions,TextDocumentRegistrationOptions,WorkDoneProgressOptions,WorkDoneProgressOptions2,InitializeRequest,InitializeRequest2,InitializeErrorCodes,InitializedNotification,InitializedNotification2,ShutdownRequest,ShutdownRequest2,ExitNotification,ExitNotification2,DidChangeConfigurationNotification,DidChangeConfigurationNotification2,MessageType,MessageType2,ShowMessageNotification,ShowMessageNotification2,ShowMessageRequest,ShowMessageRequest2,LogMessageNotification,LogMessageNotification2,TelemetryEventNotification,TelemetryEventNotification2,TextDocumentSyncKind,TextDocumentSyncKind2,DidOpenTextDocumentNotification,DidOpenTextDocumentNotification2,TextDocumentContentChangeEvent,TextDocumentContentChangeEvent2,DidChangeTextDocumentNotification,DidChangeTextDocumentNotification2,DidCloseTextDocumentNotification,DidCloseTextDocumentNotification2,DidSaveTextDocumentNotification,DidSaveTextDocumentNotification2,TextDocumentSaveReason,TextDocumentSaveReason2,WillSaveTextDocumentNotification,WillSaveTextDocumentNotification2,WillSaveTextDocumentWaitUntilRequest,WillSaveTextDocumentWaitUntilRequest2,DidChangeWatchedFilesNotification,DidChangeWatchedFilesNotification2,FileChangeType,FileChangeType2,RelativePattern,WatchKind,WatchKind2,PublishDiagnosticsNotification,PublishDiagnosticsNotification2,CompletionTriggerKind,CompletionTriggerKind2,CompletionRequest,CompletionRequest2,CompletionResolveRequest,CompletionResolveRequest2,HoverRequest,HoverRequest2,SignatureHelpTriggerKind,SignatureHelpTriggerKind2,SignatureHelpRequest,SignatureHelpRequest2,DefinitionRequest,DefinitionRequest2,ReferencesRequest,ReferencesRequest2,DocumentHighlightRequest,DocumentHighlightRequest2,DocumentSymbolRequest,DocumentSymbolRequest2,CodeActionRequest,CodeActionRequest2,CodeActionResolveRequest,CodeActionResolveRequest2,WorkspaceSymbolRequest,WorkspaceSymbolRequest2,WorkspaceSymbolResolveRequest,WorkspaceSymbolResolveRequest2,CodeLensRequest,CodeLensRequest2,CodeLensResolveRequest,CodeLensResolveRequest2,CodeLensRefreshRequest,CodeLensRefreshRequest2,DocumentLinkRequest,DocumentLinkRequest2,DocumentLinkResolveRequest,DocumentLinkResolveRequest2,DocumentFormattingRequest,DocumentFormattingRequest2,DocumentRangeFormattingRequest,DocumentRangeFormattingRequest2,DocumentRangesFormattingRequest,DocumentRangesFormattingRequest2,DocumentOnTypeFormattingRequest,DocumentOnTypeFormattingRequest2,PrepareSupportDefaultBehavior,RenameRequest,RenameRequest2,PrepareRenameRequest,PrepareRenameRequest2,ExecuteCommandRequest,ExecuteCommandRequest2,ApplyWorkspaceEditRequest,ApplyWorkspaceEditRequest2;Object.defineProperty(exports$1,"InlineCompletionRequest",{enumerable:!0,get:function(){return protocol_inlineCompletion_1.InlineCompletionRequest}}),(TextDocumentFilter||(exports$1.TextDocumentFilter=TextDocumentFilter={})).is=function(value){const candidate=value;return Is2.string(candidate)||Is2.string(candidate.language)||Is2.string(candidate.scheme)||Is2.string(candidate.pattern)},(NotebookDocumentFilter||(exports$1.NotebookDocumentFilter=NotebookDocumentFilter={})).is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&(Is2.string(candidate.notebookType)||Is2.string(candidate.scheme)||Is2.string(candidate.pattern))},(NotebookCellTextDocumentFilter||(exports$1.NotebookCellTextDocumentFilter=NotebookCellTextDocumentFilter={})).is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&(Is2.string(candidate.notebook)||NotebookDocumentFilter.is(candidate.notebook))&&(void 0===candidate.language||Is2.string(candidate.language))},(DocumentSelector||(exports$1.DocumentSelector=DocumentSelector={})).is=function(value){if(!Array.isArray(value))return!1;for(let elem of value)if(!Is2.string(elem)&&!TextDocumentFilter.is(elem)&&!NotebookCellTextDocumentFilter.is(elem))return!1;return!0},(RegistrationRequest2=RegistrationRequest||(exports$1.RegistrationRequest=RegistrationRequest={})).method="client/registerCapability",RegistrationRequest2.messageDirection=messages_1.MessageDirection.serverToClient,RegistrationRequest2.type=new messages_1.ProtocolRequestType(RegistrationRequest2.method),(UnregistrationRequest2=UnregistrationRequest||(exports$1.UnregistrationRequest=UnregistrationRequest={})).method="client/unregisterCapability",UnregistrationRequest2.messageDirection=messages_1.MessageDirection.serverToClient,UnregistrationRequest2.type=new messages_1.ProtocolRequestType(UnregistrationRequest2.method),(ResourceOperationKind2=ResourceOperationKind||(exports$1.ResourceOperationKind=ResourceOperationKind={})).Create="create",ResourceOperationKind2.Rename="rename",ResourceOperationKind2.Delete="delete",(FailureHandlingKind2=FailureHandlingKind||(exports$1.FailureHandlingKind=FailureHandlingKind={})).Abort="abort",FailureHandlingKind2.Transactional="transactional",FailureHandlingKind2.TextOnlyTransactional="textOnlyTransactional",FailureHandlingKind2.Undo="undo",(PositionEncodingKind2=PositionEncodingKind||(exports$1.PositionEncodingKind=PositionEncodingKind={})).UTF8="utf-8",PositionEncodingKind2.UTF16="utf-16",PositionEncodingKind2.UTF32="utf-32",(StaticRegistrationOptions||(exports$1.StaticRegistrationOptions=StaticRegistrationOptions={})).hasId=function(value){const candidate=value;return candidate&&Is2.string(candidate.id)&&candidate.id.length>0},(TextDocumentRegistrationOptions||(exports$1.TextDocumentRegistrationOptions=TextDocumentRegistrationOptions={})).is=function(value){const candidate=value;return candidate&&(null===candidate.documentSelector||DocumentSelector.is(candidate.documentSelector))},(WorkDoneProgressOptions2=WorkDoneProgressOptions||(exports$1.WorkDoneProgressOptions=WorkDoneProgressOptions={})).is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&(void 0===candidate.workDoneProgress||Is2.boolean(candidate.workDoneProgress))},WorkDoneProgressOptions2.hasWorkDoneProgress=function(value){const candidate=value;return candidate&&Is2.boolean(candidate.workDoneProgress)},(InitializeRequest2=InitializeRequest||(exports$1.InitializeRequest=InitializeRequest={})).method="initialize",InitializeRequest2.messageDirection=messages_1.MessageDirection.clientToServer,InitializeRequest2.type=new messages_1.ProtocolRequestType(InitializeRequest2.method),(InitializeErrorCodes||(exports$1.InitializeErrorCodes=InitializeErrorCodes={})).unknownProtocolVersion=1,(InitializedNotification2=InitializedNotification||(exports$1.InitializedNotification=InitializedNotification={})).method="initialized",InitializedNotification2.messageDirection=messages_1.MessageDirection.clientToServer,InitializedNotification2.type=new messages_1.ProtocolNotificationType(InitializedNotification2.method),(ShutdownRequest2=ShutdownRequest||(exports$1.ShutdownRequest=ShutdownRequest={})).method="shutdown",ShutdownRequest2.messageDirection=messages_1.MessageDirection.clientToServer,ShutdownRequest2.type=new messages_1.ProtocolRequestType0(ShutdownRequest2.method),(ExitNotification2=ExitNotification||(exports$1.ExitNotification=ExitNotification={})).method="exit",ExitNotification2.messageDirection=messages_1.MessageDirection.clientToServer,ExitNotification2.type=new messages_1.ProtocolNotificationType0(ExitNotification2.method),(DidChangeConfigurationNotification2=DidChangeConfigurationNotification||(exports$1.DidChangeConfigurationNotification=DidChangeConfigurationNotification={})).method="workspace/didChangeConfiguration",DidChangeConfigurationNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidChangeConfigurationNotification2.type=new messages_1.ProtocolNotificationType(DidChangeConfigurationNotification2.method),(MessageType2=MessageType||(exports$1.MessageType=MessageType={})).Error=1,MessageType2.Warning=2,MessageType2.Info=3,MessageType2.Log=4,MessageType2.Debug=5,(ShowMessageNotification2=ShowMessageNotification||(exports$1.ShowMessageNotification=ShowMessageNotification={})).method="window/showMessage",ShowMessageNotification2.messageDirection=messages_1.MessageDirection.serverToClient,ShowMessageNotification2.type=new messages_1.ProtocolNotificationType(ShowMessageNotification2.method),(ShowMessageRequest2=ShowMessageRequest||(exports$1.ShowMessageRequest=ShowMessageRequest={})).method="window/showMessageRequest",ShowMessageRequest2.messageDirection=messages_1.MessageDirection.serverToClient,ShowMessageRequest2.type=new messages_1.ProtocolRequestType(ShowMessageRequest2.method),(LogMessageNotification2=LogMessageNotification||(exports$1.LogMessageNotification=LogMessageNotification={})).method="window/logMessage",LogMessageNotification2.messageDirection=messages_1.MessageDirection.serverToClient,LogMessageNotification2.type=new messages_1.ProtocolNotificationType(LogMessageNotification2.method),(TelemetryEventNotification2=TelemetryEventNotification||(exports$1.TelemetryEventNotification=TelemetryEventNotification={})).method="telemetry/event",TelemetryEventNotification2.messageDirection=messages_1.MessageDirection.serverToClient,TelemetryEventNotification2.type=new messages_1.ProtocolNotificationType(TelemetryEventNotification2.method),(TextDocumentSyncKind2=TextDocumentSyncKind||(exports$1.TextDocumentSyncKind=TextDocumentSyncKind={})).None=0,TextDocumentSyncKind2.Full=1,TextDocumentSyncKind2.Incremental=2,(DidOpenTextDocumentNotification2=DidOpenTextDocumentNotification||(exports$1.DidOpenTextDocumentNotification=DidOpenTextDocumentNotification={})).method="textDocument/didOpen",DidOpenTextDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidOpenTextDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification2.method),(TextDocumentContentChangeEvent2=TextDocumentContentChangeEvent||(exports$1.TextDocumentContentChangeEvent=TextDocumentContentChangeEvent={})).isIncremental=function(event){let candidate=event;return null!=candidate&&"string"==typeof candidate.text&&void 0!==candidate.range&&(void 0===candidate.rangeLength||"number"==typeof candidate.rangeLength)},TextDocumentContentChangeEvent2.isFull=function(event){let candidate=event;return null!=candidate&&"string"==typeof candidate.text&&void 0===candidate.range&&void 0===candidate.rangeLength},(DidChangeTextDocumentNotification2=DidChangeTextDocumentNotification||(exports$1.DidChangeTextDocumentNotification=DidChangeTextDocumentNotification={})).method="textDocument/didChange",DidChangeTextDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidChangeTextDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification2.method),(DidCloseTextDocumentNotification2=DidCloseTextDocumentNotification||(exports$1.DidCloseTextDocumentNotification=DidCloseTextDocumentNotification={})).method="textDocument/didClose",DidCloseTextDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidCloseTextDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification2.method),(DidSaveTextDocumentNotification2=DidSaveTextDocumentNotification||(exports$1.DidSaveTextDocumentNotification=DidSaveTextDocumentNotification={})).method="textDocument/didSave",DidSaveTextDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidSaveTextDocumentNotification2.type=new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method),(TextDocumentSaveReason2=TextDocumentSaveReason||(exports$1.TextDocumentSaveReason=TextDocumentSaveReason={})).Manual=1,TextDocumentSaveReason2.AfterDelay=2,TextDocumentSaveReason2.FocusOut=3,(WillSaveTextDocumentNotification2=WillSaveTextDocumentNotification||(exports$1.WillSaveTextDocumentNotification=WillSaveTextDocumentNotification={})).method="textDocument/willSave",WillSaveTextDocumentNotification2.messageDirection=messages_1.MessageDirection.clientToServer,WillSaveTextDocumentNotification2.type=new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method),(WillSaveTextDocumentWaitUntilRequest2=WillSaveTextDocumentWaitUntilRequest||(exports$1.WillSaveTextDocumentWaitUntilRequest=WillSaveTextDocumentWaitUntilRequest={})).method="textDocument/willSaveWaitUntil",WillSaveTextDocumentWaitUntilRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WillSaveTextDocumentWaitUntilRequest2.type=new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method),(DidChangeWatchedFilesNotification2=DidChangeWatchedFilesNotification||(exports$1.DidChangeWatchedFilesNotification=DidChangeWatchedFilesNotification={})).method="workspace/didChangeWatchedFiles",DidChangeWatchedFilesNotification2.messageDirection=messages_1.MessageDirection.clientToServer,DidChangeWatchedFilesNotification2.type=new messages_1.ProtocolNotificationType(DidChangeWatchedFilesNotification2.method),(FileChangeType2=FileChangeType||(exports$1.FileChangeType=FileChangeType={})).Created=1,FileChangeType2.Changed=2,FileChangeType2.Deleted=3,(RelativePattern||(exports$1.RelativePattern=RelativePattern={})).is=function(value){const candidate=value;return Is2.objectLiteral(candidate)&&(vscode_languageserver_types_1.URI.is(candidate.baseUri)||vscode_languageserver_types_1.WorkspaceFolder.is(candidate.baseUri))&&Is2.string(candidate.pattern)},(WatchKind2=WatchKind||(exports$1.WatchKind=WatchKind={})).Create=1,WatchKind2.Change=2,WatchKind2.Delete=4,(PublishDiagnosticsNotification2=PublishDiagnosticsNotification||(exports$1.PublishDiagnosticsNotification=PublishDiagnosticsNotification={})).method="textDocument/publishDiagnostics",PublishDiagnosticsNotification2.messageDirection=messages_1.MessageDirection.serverToClient,PublishDiagnosticsNotification2.type=new messages_1.ProtocolNotificationType(PublishDiagnosticsNotification2.method),(CompletionTriggerKind2=CompletionTriggerKind||(exports$1.CompletionTriggerKind=CompletionTriggerKind={})).Invoked=1,CompletionTriggerKind2.TriggerCharacter=2,CompletionTriggerKind2.TriggerForIncompleteCompletions=3,(CompletionRequest2=CompletionRequest||(exports$1.CompletionRequest=CompletionRequest={})).method="textDocument/completion",CompletionRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CompletionRequest2.type=new messages_1.ProtocolRequestType(CompletionRequest2.method),(CompletionResolveRequest2=CompletionResolveRequest||(exports$1.CompletionResolveRequest=CompletionResolveRequest={})).method="completionItem/resolve",CompletionResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CompletionResolveRequest2.type=new messages_1.ProtocolRequestType(CompletionResolveRequest2.method),(HoverRequest2=HoverRequest||(exports$1.HoverRequest=HoverRequest={})).method="textDocument/hover",HoverRequest2.messageDirection=messages_1.MessageDirection.clientToServer,HoverRequest2.type=new messages_1.ProtocolRequestType(HoverRequest2.method),(SignatureHelpTriggerKind2=SignatureHelpTriggerKind||(exports$1.SignatureHelpTriggerKind=SignatureHelpTriggerKind={})).Invoked=1,SignatureHelpTriggerKind2.TriggerCharacter=2,SignatureHelpTriggerKind2.ContentChange=3,(SignatureHelpRequest2=SignatureHelpRequest||(exports$1.SignatureHelpRequest=SignatureHelpRequest={})).method="textDocument/signatureHelp",SignatureHelpRequest2.messageDirection=messages_1.MessageDirection.clientToServer,SignatureHelpRequest2.type=new messages_1.ProtocolRequestType(SignatureHelpRequest2.method),(DefinitionRequest2=DefinitionRequest||(exports$1.DefinitionRequest=DefinitionRequest={})).method="textDocument/definition",DefinitionRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DefinitionRequest2.type=new messages_1.ProtocolRequestType(DefinitionRequest2.method),(ReferencesRequest2=ReferencesRequest||(exports$1.ReferencesRequest=ReferencesRequest={})).method="textDocument/references",ReferencesRequest2.messageDirection=messages_1.MessageDirection.clientToServer,ReferencesRequest2.type=new messages_1.ProtocolRequestType(ReferencesRequest2.method),(DocumentHighlightRequest2=DocumentHighlightRequest||(exports$1.DocumentHighlightRequest=DocumentHighlightRequest={})).method="textDocument/documentHighlight",DocumentHighlightRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentHighlightRequest2.type=new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method),(DocumentSymbolRequest2=DocumentSymbolRequest||(exports$1.DocumentSymbolRequest=DocumentSymbolRequest={})).method="textDocument/documentSymbol",DocumentSymbolRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentSymbolRequest2.type=new messages_1.ProtocolRequestType(DocumentSymbolRequest2.method),(CodeActionRequest2=CodeActionRequest||(exports$1.CodeActionRequest=CodeActionRequest={})).method="textDocument/codeAction",CodeActionRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CodeActionRequest2.type=new messages_1.ProtocolRequestType(CodeActionRequest2.method),(CodeActionResolveRequest2=CodeActionResolveRequest||(exports$1.CodeActionResolveRequest=CodeActionResolveRequest={})).method="codeAction/resolve",CodeActionResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CodeActionResolveRequest2.type=new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method),(WorkspaceSymbolRequest2=WorkspaceSymbolRequest||(exports$1.WorkspaceSymbolRequest=WorkspaceSymbolRequest={})).method="workspace/symbol",WorkspaceSymbolRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WorkspaceSymbolRequest2.type=new messages_1.ProtocolRequestType(WorkspaceSymbolRequest2.method),(WorkspaceSymbolResolveRequest2=WorkspaceSymbolResolveRequest||(exports$1.WorkspaceSymbolResolveRequest=WorkspaceSymbolResolveRequest={})).method="workspaceSymbol/resolve",WorkspaceSymbolResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,WorkspaceSymbolResolveRequest2.type=new messages_1.ProtocolRequestType(WorkspaceSymbolResolveRequest2.method),(CodeLensRequest2=CodeLensRequest||(exports$1.CodeLensRequest=CodeLensRequest={})).method="textDocument/codeLens",CodeLensRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CodeLensRequest2.type=new messages_1.ProtocolRequestType(CodeLensRequest2.method),(CodeLensResolveRequest2=CodeLensResolveRequest||(exports$1.CodeLensResolveRequest=CodeLensResolveRequest={})).method="codeLens/resolve",CodeLensResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,CodeLensResolveRequest2.type=new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method),(CodeLensRefreshRequest2=CodeLensRefreshRequest||(exports$1.CodeLensRefreshRequest=CodeLensRefreshRequest={})).method="workspace/codeLens/refresh",CodeLensRefreshRequest2.messageDirection=messages_1.MessageDirection.serverToClient,CodeLensRefreshRequest2.type=new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method),(DocumentLinkRequest2=DocumentLinkRequest||(exports$1.DocumentLinkRequest=DocumentLinkRequest={})).method="textDocument/documentLink",DocumentLinkRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentLinkRequest2.type=new messages_1.ProtocolRequestType(DocumentLinkRequest2.method),(DocumentLinkResolveRequest2=DocumentLinkResolveRequest||(exports$1.DocumentLinkResolveRequest=DocumentLinkResolveRequest={})).method="documentLink/resolve",DocumentLinkResolveRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentLinkResolveRequest2.type=new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method),(DocumentFormattingRequest2=DocumentFormattingRequest||(exports$1.DocumentFormattingRequest=DocumentFormattingRequest={})).method="textDocument/formatting",DocumentFormattingRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentFormattingRequest2.type=new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method),(DocumentRangeFormattingRequest2=DocumentRangeFormattingRequest||(exports$1.DocumentRangeFormattingRequest=DocumentRangeFormattingRequest={})).method="textDocument/rangeFormatting",DocumentRangeFormattingRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentRangeFormattingRequest2.type=new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method),(DocumentRangesFormattingRequest2=DocumentRangesFormattingRequest||(exports$1.DocumentRangesFormattingRequest=DocumentRangesFormattingRequest={})).method="textDocument/rangesFormatting",DocumentRangesFormattingRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentRangesFormattingRequest2.type=new messages_1.ProtocolRequestType(DocumentRangesFormattingRequest2.method),(DocumentOnTypeFormattingRequest2=DocumentOnTypeFormattingRequest||(exports$1.DocumentOnTypeFormattingRequest=DocumentOnTypeFormattingRequest={})).method="textDocument/onTypeFormatting",DocumentOnTypeFormattingRequest2.messageDirection=messages_1.MessageDirection.clientToServer,DocumentOnTypeFormattingRequest2.type=new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method),(PrepareSupportDefaultBehavior||(exports$1.PrepareSupportDefaultBehavior=PrepareSupportDefaultBehavior={})).Identifier=1,(RenameRequest2=RenameRequest||(exports$1.RenameRequest=RenameRequest={})).method="textDocument/rename",RenameRequest2.messageDirection=messages_1.MessageDirection.clientToServer,RenameRequest2.type=new messages_1.ProtocolRequestType(RenameRequest2.method),(PrepareRenameRequest2=PrepareRenameRequest||(exports$1.PrepareRenameRequest=PrepareRenameRequest={})).method="textDocument/prepareRename",PrepareRenameRequest2.messageDirection=messages_1.MessageDirection.clientToServer,PrepareRenameRequest2.type=new messages_1.ProtocolRequestType(PrepareRenameRequest2.method),(ExecuteCommandRequest2=ExecuteCommandRequest||(exports$1.ExecuteCommandRequest=ExecuteCommandRequest={})).method="workspace/executeCommand",ExecuteCommandRequest2.messageDirection=messages_1.MessageDirection.clientToServer,ExecuteCommandRequest2.type=new messages_1.ProtocolRequestType(ExecuteCommandRequest2.method),(ApplyWorkspaceEditRequest2=ApplyWorkspaceEditRequest||(exports$1.ApplyWorkspaceEditRequest=ApplyWorkspaceEditRequest={})).method="workspace/applyEdit",ApplyWorkspaceEditRequest2.messageDirection=messages_1.MessageDirection.serverToClient,ApplyWorkspaceEditRequest2.type=new messages_1.ProtocolRequestType("workspace/applyEdit")}(protocol)),protocol}var hasRequiredConnection,hasRequiredApi,hasRequiredMain,connection={};function requireApi(){return hasRequiredApi||(hasRequiredApi=1,function(exports$1){var __createBinding=api&&api.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&!("get"in desc?!m.__esModule:desc.writable||desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){void 0===k2&&(k2=k),o[k2]=m[k]}),__exportStar=api&&api.__exportStar||function(m,exports$12){for(var p in m)"default"===p||Object.prototype.hasOwnProperty.call(exports$12,p)||__createBinding(exports$12,m,p)};Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.LSPErrorCodes=exports$1.createProtocolConnection=void 0,__exportStar(requireMain$1(),exports$1),__exportStar(require$$1,exports$1),__exportStar(requireMessages(),exports$1),__exportStar(requireProtocol(),exports$1);var LSPErrorCodes,LSPErrorCodes2,connection_1=function(){if(hasRequiredConnection)return connection;hasRequiredConnection=1,Object.defineProperty(connection,"__esModule",{value:!0}),connection.createProtocolConnection=void 0;const vscode_jsonrpc_1=requireMain$1();return connection.createProtocolConnection=function(input,output,logger,options){return vscode_jsonrpc_1.ConnectionStrategy.is(options)&&(options={connectionStrategy:options}),(0,vscode_jsonrpc_1.createMessageConnection)(input,output,logger,options)},connection}();Object.defineProperty(exports$1,"createProtocolConnection",{enumerable:!0,get:function(){return connection_1.createProtocolConnection}}),(LSPErrorCodes2=LSPErrorCodes||(exports$1.LSPErrorCodes=LSPErrorCodes={})).lspReservedErrorRangeStart=-32899,LSPErrorCodes2.RequestFailed=-32803,LSPErrorCodes2.ServerCancelled=-32802,LSPErrorCodes2.ContentModified=-32801,LSPErrorCodes2.RequestCancelled=-32800,LSPErrorCodes2.lspReservedErrorRangeEnd=-32800}(api)),api}var Disposable,mainExports=(hasRequiredMain||(hasRequiredMain=1,function(exports$1){var __createBinding=main$1&&main$1.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&!("get"in desc?!m.__esModule:desc.writable||desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){void 0===k2&&(k2=k),o[k2]=m[k]}),__exportStar=main$1&&main$1.__exportStar||function(m,exports$12){for(var p in m)"default"===p||Object.prototype.hasOwnProperty.call(exports$12,p)||__createBinding(exports$12,m,p)};Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.createProtocolConnection=void 0;const browser_1=requireBrowser();__exportStar(requireBrowser(),exports$1),__exportStar(requireApi(),exports$1),exports$1.createProtocolConnection=function(reader,writer,logger,options){return(0,browser_1.createMessageConnection)(reader,writer,logger,options)}}(main$1)),main$1);(Disposable||(Disposable={})).create=function(callback){return{dispose:async()=>await callback()}};class DefaultDocumentBuilder{constructor(services){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new MultiMap,this.documentPhaseListeners=new MultiMap,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=DocumentState.Changed,this.langiumDocuments=services.workspace.LangiumDocuments,this.langiumDocumentFactory=services.workspace.LangiumDocumentFactory,this.textDocuments=services.workspace.TextDocuments,this.indexManager=services.workspace.IndexManager,this.fileSystemProvider=services.workspace.FileSystemProvider,this.workspaceManager=()=>services.workspace.WorkspaceManager,this.serviceRegistry=services.ServiceRegistry}async build(documents,options={},cancelToken=cancellationExports.CancellationToken.None){var _a2;for(const document of documents){const key=document.uri.toString();if(document.state===DocumentState.Validated){if("boolean"==typeof options.validation&&options.validation)this.resetToState(document,DocumentState.IndexedReferences);else if("object"==typeof options.validation){const categories=this.findMissingValidationCategories(document,options);categories.length>0&&(this.buildState.set(key,{completed:!1,options:{validation:{categories:categories}},result:null==(_a2=this.buildState.get(key))?void 0:_a2.result}),document.state=DocumentState.IndexedReferences)}}else this.buildState.delete(key)}this.currentState=DocumentState.Changed,await this.emitUpdate(documents.map(e=>e.uri),[]),await this.buildDocuments(documents,options,cancelToken)}async update(changed,deleted,cancelToken=cancellationExports.CancellationToken.None){this.currentState=DocumentState.Changed;const deletedUris=[];for(const deletedUri of deleted){const deletedDocs=this.langiumDocuments.deleteDocuments(deletedUri);for(const doc of deletedDocs)deletedUris.push(doc.uri),this.cleanUpDeleted(doc)}const changedUris=(await Promise.all(changed.map(uri=>this.findChangedUris(uri)))).flat();for(const changedUri of changedUris){let changedDocument=this.langiumDocuments.getDocument(changedUri);void 0===changedDocument&&(changedDocument=this.langiumDocumentFactory.fromModel({$type:"INVALID"},changedUri),changedDocument.state=DocumentState.Changed,this.langiumDocuments.addDocument(changedDocument)),this.resetToState(changedDocument,DocumentState.Changed)}const allChangedUris=stream(changedUris).concat(deletedUris).map(uri=>uri.toString()).toSet();this.langiumDocuments.all.filter(doc=>!allChangedUris.has(doc.uri.toString())&&this.shouldRelink(doc,allChangedUris)).forEach(doc=>this.resetToState(doc,DocumentState.ComputedScopes)),await this.emitUpdate(changedUris,deletedUris),await interruptAndCheck(cancelToken);const rebuildDocuments=this.sortDocuments(this.langiumDocuments.all.filter(doc=>{var _a2;return doc.state<DocumentState.Validated||!(null==(_a2=this.buildState.get(doc.uri.toString()))?void 0:_a2.completed)||this.resultsAreIncomplete(doc,this.updateBuildOptions)}).toArray());await this.buildDocuments(rebuildDocuments,this.updateBuildOptions,cancelToken)}resultsAreIncomplete(document,options){return this.findMissingValidationCategories(document,options).length>=1}findMissingValidationCategories(document,options){var _a2,_b2;const state=this.buildState.get(document.uri.toString()),allCategories=this.serviceRegistry.getServices(document.uri).validation.ValidationRegistry.getAllValidationCategories(document),executedCategories=(null==(_a2=null==state?void 0:state.result)?void 0:_a2.validationChecks)?new Set(null==(_b2=null==state?void 0:state.result)?void 0:_b2.validationChecks):(null==state?void 0:state.completed)?allCategories:new Set;return stream(void 0===options||!0===options.validation?allCategories:"object"==typeof options.validation?options.validation.categories??allCategories:[]).filter(requested=>!executedCategories.has(requested)).toArray()}async findChangedUris(changed){var _a2;if(this.langiumDocuments.getDocument(changed)??(null==(_a2=this.textDocuments)?void 0:_a2.get(changed)))return[changed];try{const stat=await this.fileSystemProvider.stat(changed);if(stat.isDirectory){return await this.workspaceManager().searchFolder(changed)}if(this.workspaceManager().shouldIncludeEntry(stat))return[changed]}catch{}return[]}async emitUpdate(changed,deleted){await Promise.all(this.updateListeners.map(listener=>listener(changed,deleted)))}sortDocuments(documents){let left=0,right=documents.length-1;for(;left<right;){for(;left<documents.length&&this.hasTextDocument(documents[left]);)left++;for(;right>=0&&!this.hasTextDocument(documents[right]);)right--;left<right&&([documents[left],documents[right]]=[documents[right],documents[left]])}return documents}hasTextDocument(doc){var _a2;return Boolean(null==(_a2=this.textDocuments)?void 0:_a2.get(doc.uri))}shouldRelink(document,changedUris){return!!document.references.some(ref=>void 0!==ref.error)||this.indexManager.isAffected(document,changedUris)}onUpdate(callback){return this.updateListeners.push(callback),Disposable.create(()=>{const index=this.updateListeners.indexOf(callback);index>=0&&this.updateListeners.splice(index,1)})}resetToState(document,state){switch(state){case DocumentState.Changed:case DocumentState.Parsed:this.indexManager.removeContent(document.uri);case DocumentState.IndexedContent:document.localSymbols=void 0;case DocumentState.ComputedScopes:this.serviceRegistry.getServices(document.uri).references.Linker.unlink(document);case DocumentState.Linked:this.indexManager.removeReferences(document.uri);case DocumentState.IndexedReferences:document.diagnostics=void 0,this.buildState.delete(document.uri.toString());case DocumentState.Validated:}document.state>state&&(document.state=state)}cleanUpDeleted(document){this.buildState.delete(document.uri.toString()),this.indexManager.remove(document.uri),document.state=DocumentState.Changed}async buildDocuments(documents,options,cancelToken){this.prepareBuild(documents,options),await this.runCancelable(documents,DocumentState.Parsed,cancelToken,doc=>this.langiumDocumentFactory.update(doc,cancelToken)),await this.runCancelable(documents,DocumentState.IndexedContent,cancelToken,doc=>this.indexManager.updateContent(doc,cancelToken)),await this.runCancelable(documents,DocumentState.ComputedScopes,cancelToken,async doc=>{const scopeComputation=this.serviceRegistry.getServices(doc.uri).references.ScopeComputation;doc.localSymbols=await scopeComputation.collectLocalSymbols(doc,cancelToken)});const toBeLinked=documents.filter(doc=>this.shouldLink(doc));await this.runCancelable(toBeLinked,DocumentState.Linked,cancelToken,doc=>this.serviceRegistry.getServices(doc.uri).references.Linker.link(doc,cancelToken)),await this.runCancelable(toBeLinked,DocumentState.IndexedReferences,cancelToken,doc=>this.indexManager.updateReferences(doc,cancelToken));const toBeValidated=documents.filter(doc=>!!this.shouldValidate(doc)||(this.markAsCompleted(doc),!1));await this.runCancelable(toBeValidated,DocumentState.Validated,cancelToken,async doc=>{await this.validate(doc,cancelToken),this.markAsCompleted(doc)})}markAsCompleted(document){const state=this.buildState.get(document.uri.toString());state&&(state.completed=!0)}prepareBuild(documents,options){for(const doc of documents){const key=doc.uri.toString(),state=this.buildState.get(key);state&&!state.completed||this.buildState.set(key,{completed:!1,options:options,result:null==state?void 0:state.result})}}async runCancelable(documents,targetState,cancelToken,callback){for(const document of documents)document.state<targetState&&(await interruptAndCheck(cancelToken),await callback(document),document.state=targetState,await this.notifyDocumentPhase(document,targetState,cancelToken));const targetStateDocs=documents.filter(doc=>doc.state===targetState);await this.notifyBuildPhase(targetStateDocs,targetState,cancelToken),this.currentState=targetState}onBuildPhase(targetState,callback){return this.buildPhaseListeners.add(targetState,callback),Disposable.create(()=>{this.buildPhaseListeners.delete(targetState,callback)})}onDocumentPhase(targetState,callback){return this.documentPhaseListeners.add(targetState,callback),Disposable.create(()=>{this.documentPhaseListeners.delete(targetState,callback)})}waitUntil(state,uriOrToken,cancelToken){let uri;return uriOrToken&&"path"in uriOrToken?uri=uriOrToken:cancelToken=uriOrToken,cancelToken??(cancelToken=cancellationExports.CancellationToken.None),uri?this.awaitDocumentState(state,uri,cancelToken):this.awaitBuilderState(state,cancelToken)}awaitDocumentState(state,uri,cancelToken){const document=this.langiumDocuments.getDocument(uri);return document?document.state>=state?Promise.resolve(uri):cancelToken.isCancellationRequested?Promise.reject(OperationCancelled):this.currentState>=state&&state>document.state?Promise.reject(new mainExports.ResponseError(mainExports.LSPErrorCodes.RequestFailed,`Document state of ${uri.toString()} is ${DocumentState[document.state]}, requiring ${DocumentState[state]}, but workspace state is already ${DocumentState[this.currentState]}. Returning undefined.`)):new Promise((resolve,reject)=>{const buildDisposable=this.onDocumentPhase(state,doc=>{UriUtils.equals(doc.uri,uri)&&(buildDisposable.dispose(),cancelDisposable.dispose(),resolve(doc.uri))}),cancelDisposable=cancelToken.onCancellationRequested(()=>{buildDisposable.dispose(),cancelDisposable.dispose(),reject(OperationCancelled)})}):Promise.reject(new mainExports.ResponseError(mainExports.LSPErrorCodes.ServerCancelled,`No document found for URI: ${uri.toString()}`))}awaitBuilderState(state,cancelToken){return this.currentState>=state?Promise.resolve():cancelToken.isCancellationRequested?Promise.reject(OperationCancelled):new Promise((resolve,reject)=>{const buildDisposable=this.onBuildPhase(state,()=>{buildDisposable.dispose(),cancelDisposable.dispose(),resolve()}),cancelDisposable=cancelToken.onCancellationRequested(()=>{buildDisposable.dispose(),cancelDisposable.dispose(),reject(OperationCancelled)})})}async notifyDocumentPhase(document,state,cancelToken){const listenersCopy=this.documentPhaseListeners.get(state).slice();for(const listener of listenersCopy)try{await interruptAndCheck(cancelToken),await listener(document,cancelToken)}catch(err){if(!isOperationCancelled(err))throw err}}async notifyBuildPhase(documents,state,cancelToken){if(0===documents.length)return;const listenersCopy=this.buildPhaseListeners.get(state).slice();for(const listener of listenersCopy)await interruptAndCheck(cancelToken),await listener(documents,cancelToken)}shouldLink(document){return this.getBuildOptions(document).eagerLinking??!0}shouldValidate(document){return Boolean(this.getBuildOptions(document).validation)}async validate(document,cancelToken){const validator=this.serviceRegistry.getServices(document.uri).validation.DocumentValidator,options=this.getBuildOptions(document),validationOptions="object"==typeof options.validation?{...options.validation}:{};validationOptions.categories=this.findMissingValidationCategories(document,options);const diagnostics=await validator.validateDocument(document,validationOptions,cancelToken);document.diagnostics?document.diagnostics.push(...diagnostics):document.diagnostics=diagnostics;const state=this.buildState.get(document.uri.toString());state&&(state.result??(state.result={}),state.result.validationChecks?state.result.validationChecks=stream(state.result.validationChecks).concat(validationOptions.categories).distinct().toArray():state.result.validationChecks=[...validationOptions.categories])}getBuildOptions(document){var _a2;return(null==(_a2=this.buildState.get(document.uri.toString()))?void 0:_a2.options)??{}}}class DefaultIndexManager{constructor(services){this.symbolIndex=new Map,this.symbolByTypeIndex=new ContextCache,this.referenceIndex=new Map,this.documents=services.workspace.LangiumDocuments,this.serviceRegistry=services.ServiceRegistry,this.astReflection=services.AstReflection}findAllReferences(targetNode,astNodePath){const targetDocUri=getDocument(targetNode).uri,result=[];return this.referenceIndex.forEach(docRefs=>{docRefs.forEach(refDescr=>{UriUtils.equals(refDescr.targetUri,targetDocUri)&&refDescr.targetPath===astNodePath&&result.push(refDescr)})}),stream(result)}allElements(nodeType,uris){let documentUris=stream(this.symbolIndex.keys());return uris&&(documentUris=documentUris.filter(uri=>!uris||uris.has(uri))),documentUris.map(uri=>this.getFileDescriptions(uri,nodeType)).flat()}getFileDescriptions(uri,nodeType){if(!nodeType)return this.symbolIndex.get(uri)??[];return this.symbolByTypeIndex.get(uri,nodeType,()=>(this.symbolIndex.get(uri)??[]).filter(e=>this.astReflection.isSubtype(e.type,nodeType)))}remove(uri){this.removeContent(uri),this.removeReferences(uri)}removeContent(uri){const uriString=uri.toString();this.symbolIndex.delete(uriString),this.symbolByTypeIndex.clear(uriString)}removeReferences(uri){const uriString=uri.toString();this.referenceIndex.delete(uriString)}async updateContent(document,cancelToken=cancellationExports.CancellationToken.None){const services=this.serviceRegistry.getServices(document.uri),exports$1=await services.references.ScopeComputation.collectExportedSymbols(document,cancelToken),uri=document.uri.toString();this.symbolIndex.set(uri,exports$1),this.symbolByTypeIndex.clear(uri)}async updateReferences(document,cancelToken=cancellationExports.CancellationToken.None){const services=this.serviceRegistry.getServices(document.uri),indexData=await services.workspace.ReferenceDescriptionProvider.createDescriptions(document,cancelToken);this.referenceIndex.set(document.uri.toString(),indexData)}isAffected(document,changedUris){const references=this.referenceIndex.get(document.uri.toString());return!!references&&references.some(ref=>!ref.local&&changedUris.has(ref.targetUri.toString()))}}class DefaultWorkspaceManager{constructor(services){this.initialBuildOptions={},this._ready=new Deferred,this.serviceRegistry=services.ServiceRegistry,this.langiumDocuments=services.workspace.LangiumDocuments,this.documentBuilder=services.workspace.DocumentBuilder,this.fileSystemProvider=services.workspace.FileSystemProvider,this.mutex=services.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(params){this.folders=params.workspaceFolders??void 0}initialized(_params){return this.mutex.write(token=>this.initializeWorkspace(this.folders??[],token))}async initializeWorkspace(folders,cancelToken=cancellationExports.CancellationToken.None){const documents=await this.performStartup(folders);await interruptAndCheck(cancelToken),await this.documentBuilder.build(documents,this.initialBuildOptions,cancelToken)}async performStartup(folders){const documents=[],collector=document=>{documents.push(document),this.langiumDocuments.hasDocument(document.uri)||this.langiumDocuments.addDocument(document)};await this.loadAdditionalDocuments(folders,collector);const uris=[];await Promise.all(folders.map(wf=>this.getRootFolder(wf)).map(async entry=>this.traverseFolder(entry,uris)));const uniqueUris=stream(uris).distinct(uri=>uri.toString()).filter(uri=>!this.langiumDocuments.hasDocument(uri));return await this.loadWorkspaceDocuments(uniqueUris,collector),this._ready.resolve(),documents}async loadWorkspaceDocuments(uris,collector){await Promise.all(uris.map(async uri=>{const document=await this.langiumDocuments.getOrCreateDocument(uri);collector(document)}))}loadAdditionalDocuments(_folders,_collector){return Promise.resolve()}getRootFolder(workspaceFolder){return URI.parse(workspaceFolder.uri)}async traverseFolder(folderPath,uris){try{const content=await this.fileSystemProvider.readDirectory(folderPath);await Promise.all(content.map(async entry=>{this.shouldIncludeEntry(entry)&&(entry.isDirectory?await this.traverseFolder(entry.uri,uris):entry.isFile&&uris.push(entry.uri))}))}catch(e){console.error("Failure to read directory content of "+folderPath.toString(!0),e)}}async searchFolder(uri){const uris=[];return await this.traverseFolder(uri,uris),uris}shouldIncludeEntry(entry){const name=UriUtils.basename(entry.uri);return!name.startsWith(".")&&(entry.isDirectory?"node_modules"!==name&&"out"!==name:!!entry.isFile&&this.serviceRegistry.hasServices(entry.uri))}}class DefaultLexerErrorMessageProvider{buildUnexpectedCharactersMessage(fullText,startOffset,length,line,column){return defaultLexerErrorProvider.buildUnexpectedCharactersMessage(fullText,startOffset,length,line,column)}buildUnableToPopLexerModeMessage(token){return defaultLexerErrorProvider.buildUnableToPopLexerModeMessage(token)}}const DEFAULT_TOKENIZE_OPTIONS={mode:"full"};class DefaultLexer{constructor(services){this.errorMessageProvider=services.parser.LexerErrorMessageProvider,this.tokenBuilder=services.parser.TokenBuilder;const tokens=this.tokenBuilder.buildTokens(services.Grammar,{caseInsensitive:services.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(tokens);const lexerTokens=isTokenTypeDictionary(tokens)?Object.values(tokens):tokens,production="production"===services.LanguageMetaData.mode;this.chevrotainLexer=new Lexer(lexerTokens,{positionTracking:"full",skipValidations:production,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(text,_options=DEFAULT_TOKENIZE_OPTIONS){var _a2,_b2;const chevrotainResult=this.chevrotainLexer.tokenize(text);return{tokens:chevrotainResult.tokens,errors:chevrotainResult.errors,hidden:chevrotainResult.groups.hidden??[],report:null==(_b2=(_a2=this.tokenBuilder).flushLexingReport)?void 0:_b2.call(_a2,text)}}toTokenTypeDictionary(buildTokens){if(isTokenTypeDictionary(buildTokens))return buildTokens;const tokens=isIMultiModeLexerDefinition(buildTokens)?Object.values(buildTokens.modes).flat():buildTokens,res={};return tokens.forEach(token=>res[token.name]=token),res}}function isIMultiModeLexerDefinition(tokenVocabulary){return tokenVocabulary&&"modes"in tokenVocabulary&&"defaultMode"in tokenVocabulary}function isTokenTypeDictionary(tokenVocabulary){return!function(tokenVocabulary){return Array.isArray(tokenVocabulary)&&(0===tokenVocabulary.length||"name"in tokenVocabulary[0])}(tokenVocabulary)&&!isIMultiModeLexerDefinition(tokenVocabulary)}function parseJSDoc(node,start,options){let opts,position;"string"==typeof node?(position=start,opts=options):(position=node.range.start,opts=start),position||(position=Position.create(0,0));const tokens=function(context){var _a2,_b2,_c2;const tokens=[];let currentLine=context.position.line,currentCharacter=context.position.character;for(let i=0;i<context.lines.length;i++){const first2=0===i,last=i===context.lines.length-1;let line=context.lines[i],index=0;if(first2&&context.options.start){const match=null==(_a2=context.options.start)?void 0:_a2.exec(line);match&&(index=match.index+match[0].length)}else{const match=null==(_b2=context.options.line)?void 0:_b2.exec(line);match&&(index=match.index+match[0].length)}if(last){const match=null==(_c2=context.options.end)?void 0:_c2.exec(line);match&&(line=line.substring(0,match.index))}line=line.substring(0,lastCharacter(line));if(skipWhitespace(line,index)>=line.length){if(tokens.length>0){const position=Position.create(currentLine,currentCharacter);tokens.push({type:"break",content:"",range:Range.create(position,position)})}}else{tagRegex.lastIndex=index;const tagMatch=tagRegex.exec(line);if(tagMatch){const fullMatch=tagMatch[0],value=tagMatch[1],start=Position.create(currentLine,currentCharacter+index),end=Position.create(currentLine,currentCharacter+index+fullMatch.length);tokens.push({type:"tag",content:value,range:Range.create(start,end)}),index+=fullMatch.length,index=skipWhitespace(line,index)}if(index<line.length){const rest=line.substring(index),inlineTagMatches=Array.from(rest.matchAll(inlineTagRegex));tokens.push(...buildInlineTokens(inlineTagMatches,rest,currentLine,currentCharacter+index))}}currentLine++,currentCharacter=0}if(tokens.length>0&&"break"===tokens[tokens.length-1].type)return tokens.slice(0,-1);return tokens}({lines:getLines(node),position:position,options:normalizeOptions(opts)});return function(context){var _a2,_b2;const startPosition=Position.create(context.position.line,context.position.character);if(0===context.tokens.length)return new JSDocCommentImpl([],Range.create(startPosition,startPosition));const elements=[];for(;context.index<context.tokens.length;){const element=parseJSDocElement(context,elements[elements.length-1]);element&&elements.push(element)}const start=(null==(_a2=elements[0])?void 0:_a2.range.start)??startPosition,end=(null==(_b2=elements[elements.length-1])?void 0:_b2.range.end)??startPosition;return new JSDocCommentImpl(elements,Range.create(start,end))}({index:0,tokens:tokens,position:position})}function getLines(node){let content="";content="string"==typeof node?node:node.text;return content.split(NEWLINE_REGEXP)}const tagRegex=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,inlineTagRegex=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function buildInlineTokens(tags,line,lineIndex,characterIndex){const tokens=[];if(0===tags.length){const start=Position.create(lineIndex,characterIndex),end=Position.create(lineIndex,characterIndex+line.length);tokens.push({type:"text",content:line,range:Range.create(start,end)})}else{let lastIndex=0;for(const match of tags){const matchIndex=match.index,startContent=line.substring(lastIndex,matchIndex);startContent.length>0&&tokens.push({type:"text",content:line.substring(lastIndex,matchIndex),range:Range.create(Position.create(lineIndex,lastIndex+characterIndex),Position.create(lineIndex,matchIndex+characterIndex))});let offset=startContent.length+1;const tagName=match[1];if(tokens.push({type:"inline-tag",content:tagName,range:Range.create(Position.create(lineIndex,lastIndex+offset+characterIndex),Position.create(lineIndex,lastIndex+offset+tagName.length+characterIndex))}),offset+=tagName.length,4===match.length){offset+=match[2].length;const value=match[3];tokens.push({type:"text",content:value,range:Range.create(Position.create(lineIndex,lastIndex+offset+characterIndex),Position.create(lineIndex,lastIndex+offset+value.length+characterIndex))})}else tokens.push({type:"text",content:"",range:Range.create(Position.create(lineIndex,lastIndex+offset+characterIndex),Position.create(lineIndex,lastIndex+offset+characterIndex))});lastIndex=matchIndex+match[0].length}const endContent=line.substring(lastIndex);endContent.length>0&&tokens.push({type:"text",content:endContent,range:Range.create(Position.create(lineIndex,lastIndex+characterIndex),Position.create(lineIndex,lastIndex+characterIndex+endContent.length))})}return tokens}const nonWhitespaceRegex=/\S/,whitespaceEndRegex=/\s*$/;function skipWhitespace(line,index){const match=line.substring(index).match(nonWhitespaceRegex);return match?index+match.index:line.length}function lastCharacter(line){const match=line.match(whitespaceEndRegex);if(match&&"number"==typeof match.index)return match.index}function parseJSDocElement(context,last){const next=context.tokens[context.index];return"tag"===next.type?parseJSDocTag(context,!1):"text"===next.type||"inline-tag"===next.type?parseJSDocText(context):(function(token,element){if(element){const line=new JSDocLineImpl("",token.range);"inlines"in element?element.inlines.push(line):element.content.inlines.push(line)}}(next,last),void context.index++)}function parseJSDocText(context){let token=context.tokens[context.index];const firstToken=token;let lastToken=token;const lines=[];for(;token&&"break"!==token.type&&"tag"!==token.type;)lines.push(parseJSDocInline(context)),lastToken=token,token=context.tokens[context.index];return new JSDocTextImpl(lines,Range.create(firstToken.range.start,lastToken.range.end))}function parseJSDocInline(context){return"inline-tag"===context.tokens[context.index].type?parseJSDocTag(context,!0):parseJSDocLine(context)}function parseJSDocTag(context,inline){const tagToken=context.tokens[context.index++],name=tagToken.content.substring(1),nextToken=context.tokens[context.index];if("text"===(null==nextToken?void 0:nextToken.type)){if(inline){const docLine=parseJSDocLine(context);return new JSDocTagImpl(name,new JSDocTextImpl([docLine],docLine.range),inline,Range.create(tagToken.range.start,docLine.range.end))}{const textDoc=parseJSDocText(context);return new JSDocTagImpl(name,textDoc,inline,Range.create(tagToken.range.start,textDoc.range.end))}}{const range=tagToken.range;return new JSDocTagImpl(name,new JSDocTextImpl([],range),inline,range)}}function parseJSDocLine(context){const token=context.tokens[context.index++];return new JSDocLineImpl(token.content,token.range)}function normalizeOptions(options){if(!options)return normalizeOptions({start:"/**",end:"*/",line:"*"});const{start:start,end:end,line:line}=options;return{start:normalizeOption(start,!0),end:normalizeOption(end,!1),line:normalizeOption(line,!0)}}function normalizeOption(option2,start){if("string"==typeof option2||"object"==typeof option2){const escaped="string"==typeof option2?escapeRegExp(option2):option2.source;return start?new RegExp(`^\\s*${escaped}`):new RegExp(`\\s*${escaped}\\s*$`)}return option2}class JSDocCommentImpl{constructor(elements,range){this.elements=elements,this.range=range}getTag(name){return this.getAllTags().find(e=>e.name===name)}getTags(name){return this.getAllTags().filter(e=>e.name===name)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let value="";for(const element of this.elements)if(0===value.length)value=element.toString();else{const text=element.toString();value+=fillNewlines(value)+text}return value.trim()}toMarkdown(options){let value="";for(const element of this.elements)if(0===value.length)value=element.toMarkdown(options);else{const text=element.toMarkdown(options);value+=fillNewlines(value)+text}return value.trim()}}class JSDocTagImpl{constructor(name,content,inline,range){this.name=name,this.content=content,this.inline=inline,this.range=range}toString(){let text=`@${this.name}`;const content=this.content.toString();return 1===this.content.inlines.length?text=`${text} ${content}`:this.content.inlines.length>1&&(text=`${text}\n${content}`),this.inline?`{${text}}`:text}toMarkdown(options){var _a2;return(null==(_a2=null==options?void 0:options.renderTag)?void 0:_a2.call(options,this))??this.toMarkdownDefault(options)}toMarkdownDefault(options){const content=this.content.toMarkdown(options);if(this.inline){const rendered=function(tag,content,options){var _a2;if("linkplain"===tag||"linkcode"===tag||"link"===tag){const index=content.indexOf(" ");let display=content;if(index>0){const displayStart=skipWhitespace(content,index);display=content.substring(displayStart),content=content.substring(0,index)}("linkcode"===tag||"link"===tag&&"code"===options.link)&&(display=`\`${display}\``);const renderedLink=(null==(_a2=options.renderLink)?void 0:_a2.call(options,content,display))??function(content,display){try{return URI.parse(content,!0),`[${display}](${content})`}catch{return content}}(content,display);return renderedLink}return}(this.name,content,options??{});if("string"==typeof rendered)return rendered}let marker="";"italic"===(null==options?void 0:options.tag)||void 0===(null==options?void 0:options.tag)?marker="*":"bold"===(null==options?void 0:options.tag)?marker="**":"bold-italic"===(null==options?void 0:options.tag)&&(marker="***");let text=`${marker}@${this.name}${marker}`;return 1===this.content.inlines.length?text=`${text} — ${content}`:this.content.inlines.length>1&&(text=`${text}\n${content}`),this.inline?`{${text}}`:text}}class JSDocTextImpl{constructor(lines,range){this.inlines=lines,this.range=range}toString(){let text="";for(let i=0;i<this.inlines.length;i++){const inline=this.inlines[i],next=this.inlines[i+1];text+=inline.toString(),next&&next.range.start.line>inline.range.start.line&&(text+="\n")}return text}toMarkdown(options){let text="";for(let i=0;i<this.inlines.length;i++){const inline=this.inlines[i],next=this.inlines[i+1];text+=inline.toMarkdown(options),next&&next.range.start.line>inline.range.start.line&&(text+="\n")}return text}}class JSDocLineImpl{constructor(text,range){this.text=text,this.range=range}toString(){return this.text}toMarkdown(){return this.text}}function fillNewlines(text){return text.endsWith("\n")?"\n":"\n\n"}class JSDocDocumentationProvider{constructor(services){this.indexManager=services.shared.workspace.IndexManager,this.commentProvider=services.documentation.CommentProvider}getDocumentation(node){const comment=this.commentProvider.getComment(node);if(comment&&function(node,options){const normalizedOptions=normalizeOptions(options),lines=getLines(node);if(0===lines.length)return!1;const first2=lines[0],last=lines[lines.length-1],firstRegex=normalizedOptions.start,lastRegex=normalizedOptions.end;return Boolean(null==firstRegex?void 0:firstRegex.exec(first2))&&Boolean(null==lastRegex?void 0:lastRegex.exec(last))}(comment)){return parseJSDoc(comment).toMarkdown({renderLink:(link,display)=>this.documentationLinkRenderer(node,link,display),renderTag:tag=>this.documentationTagRenderer(node,tag)})}}documentationLinkRenderer(node,name,display){const description=this.findNameInLocalSymbols(node,name)??this.findNameInGlobalScope(node,name);if(description&&description.nameSegment){const line=description.nameSegment.range.start.line+1,character=description.nameSegment.range.start.character+1;return`[${display}](${description.documentUri.with({fragment:`L${line},${character}`}).toString()})`}}documentationTagRenderer(_node,_tag){}findNameInLocalSymbols(node,name){const precomputed=getDocument(node).localSymbols;if(!precomputed)return;let currentNode=node;do{const description=precomputed.getStream(currentNode).find(e=>e.name===name);if(description)return description;currentNode=currentNode.$container}while(currentNode)}findNameInGlobalScope(node,name){return this.indexManager.allElements().find(e=>e.name===name)}}class DefaultCommentProvider{constructor(services){this.grammarConfig=()=>services.parser.GrammarConfig}getComment(node){var _a2;return function(node){return"string"==typeof node.$comment}(node)?node.$comment:null==(_a2=function(cstNode,commentNames){if(cstNode){const previous=function(node,hidden=!0){for(;node.container;){const parent=node.container;let index=parent.content.indexOf(node);for(;index>0;){index--;const previous=parent.content[index];if(hidden||!previous.hidden)return previous}node=parent}}(cstNode,!0);if(previous&&isCommentNode(previous,commentNames))return previous;if(isRootCstNode(cstNode))for(let i=cstNode.content.findIndex(e=>!e.hidden)-1;i>=0;i--){const child=cstNode.content[i];if(isCommentNode(child,commentNames))return child}}}(node.$cstNode,this.grammarConfig().multilineCommentRules))?void 0:_a2.text}}class DefaultAsyncParser{constructor(services){this.syncParser=services.parser.LangiumParser}parse(text,_cancelToken){return Promise.resolve(this.syncParser.parse(text))}}class DefaultWorkspaceLock{constructor(){this.previousTokenSource=new cancellationExports.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(action){this.cancelWrite();const tokenSource=(lastTick=performance.now(),new cancellationExports.CancellationTokenSource);return this.previousTokenSource=tokenSource,this.enqueue(this.writeQueue,action,tokenSource.token)}read(action){return this.enqueue(this.readQueue,action)}enqueue(queue,action,cancellationToken=cancellationExports.CancellationToken.None){const deferred=new Deferred,entry={action:action,deferred:deferred,cancellationToken:cancellationToken};return queue.push(entry),this.performNextOperation(),deferred.promise}async performNextOperation(){if(!this.done)return;const entries=[];if(this.writeQueue.length>0)entries.push(this.writeQueue.shift());else{if(!(this.readQueue.length>0))return;entries.push(...this.readQueue.splice(0,this.readQueue.length))}this.done=!1,await Promise.all(entries.map(async({action:action,deferred:deferred,cancellationToken:cancellationToken})=>{try{const result=await Promise.resolve().then(()=>action(cancellationToken));deferred.resolve(result)}catch(err){isOperationCancelled(err)?deferred.resolve(void 0):deferred.reject(err)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class DefaultHydrator{constructor(services){this.grammarElementIdMap=new BiMap,this.tokenTypeIdMap=new BiMap,this.grammar=services.Grammar,this.lexer=services.parser.Lexer,this.linker=services.references.Linker}dehydrate(result){return{lexerErrors:result.lexerErrors,lexerReport:result.lexerReport?this.dehydrateLexerReport(result.lexerReport):void 0,parserErrors:result.parserErrors.map(e=>({...e,message:e.message})),value:this.dehydrateAstNode(result.value,this.createDehyrationContext(result.value))}}dehydrateLexerReport(lexerReport){return lexerReport}createDehyrationContext(node){const astNodes=new Map,cstNodes=new Map;for(const astNode of streamAst(node))astNodes.set(astNode,{});if(node.$cstNode)for(const cstNode of streamCst(node.$cstNode))cstNodes.set(cstNode,{});return{astNodes:astNodes,cstNodes:cstNodes}}dehydrateAstNode(node,context){const obj=context.astNodes.get(node);obj.$type=node.$type,obj.$containerIndex=node.$containerIndex,obj.$containerProperty=node.$containerProperty,void 0!==node.$cstNode&&(obj.$cstNode=this.dehydrateCstNode(node.$cstNode,context));for(const[name,value]of Object.entries(node))if(!name.startsWith("$"))if(Array.isArray(value)){const arr=[];obj[name]=arr;for(const item of value)isAstNode(item)?arr.push(this.dehydrateAstNode(item,context)):isReference(item)?arr.push(this.dehydrateReference(item,context)):arr.push(item)}else isAstNode(value)?obj[name]=this.dehydrateAstNode(value,context):isReference(value)?obj[name]=this.dehydrateReference(value,context):void 0!==value&&(obj[name]=value);return obj}dehydrateReference(reference,context){const obj={};return obj.$refText=reference.$refText,reference.$refNode&&(obj.$refNode=context.cstNodes.get(reference.$refNode)),obj}dehydrateCstNode(node,context){const cstNode=context.cstNodes.get(node);return isRootCstNode(node)?cstNode.fullText=node.fullText:cstNode.grammarSource=this.getGrammarElementId(node.grammarSource),cstNode.hidden=node.hidden,cstNode.astNode=context.astNodes.get(node.astNode),isCompositeCstNode(node)?cstNode.content=node.content.map(child=>this.dehydrateCstNode(child,context)):isLeafCstNode(node)&&(cstNode.tokenType=node.tokenType.name,cstNode.offset=node.offset,cstNode.length=node.length,cstNode.startLine=node.range.start.line,cstNode.startColumn=node.range.start.character,cstNode.endLine=node.range.end.line,cstNode.endColumn=node.range.end.character),cstNode}hydrate(result){const node=result.value,context=this.createHydrationContext(node);return"$cstNode"in node&&this.hydrateCstNode(node.$cstNode,context),{lexerErrors:result.lexerErrors,lexerReport:result.lexerReport,parserErrors:result.parserErrors,value:this.hydrateAstNode(node,context)}}createHydrationContext(node){const astNodes=new Map,cstNodes=new Map;for(const astNode of streamAst(node))astNodes.set(astNode,{});let root;if(node.$cstNode)for(const cstNode of streamCst(node.$cstNode)){let cst;"fullText"in cstNode?(cst=new RootCstNodeImpl(cstNode.fullText),root=cst):"content"in cstNode?cst=new CompositeCstNodeImpl:"tokenType"in cstNode&&(cst=this.hydrateCstLeafNode(cstNode)),cst&&(cstNodes.set(cstNode,cst),cst.root=root)}return{astNodes:astNodes,cstNodes:cstNodes}}hydrateAstNode(node,context){const astNode=context.astNodes.get(node);astNode.$type=node.$type,astNode.$containerIndex=node.$containerIndex,astNode.$containerProperty=node.$containerProperty,node.$cstNode&&(astNode.$cstNode=context.cstNodes.get(node.$cstNode));for(const[name,value]of Object.entries(node))if(!name.startsWith("$"))if(Array.isArray(value)){const arr=[];astNode[name]=arr;for(const item of value)isAstNode(item)?arr.push(this.setParent(this.hydrateAstNode(item,context),astNode)):isReference(item)?arr.push(this.hydrateReference(item,astNode,name,context)):arr.push(item)}else isAstNode(value)?astNode[name]=this.setParent(this.hydrateAstNode(value,context),astNode):isReference(value)?astNode[name]=this.hydrateReference(value,astNode,name,context):void 0!==value&&(astNode[name]=value);return astNode}setParent(node,parent){return node.$container=parent,node}hydrateReference(reference,node,name,context){return this.linker.buildReference(node,name,context.cstNodes.get(reference.$refNode),reference.$refText)}hydrateCstNode(cstNode,context,num=0){const cstNodeObj=context.cstNodes.get(cstNode);if("number"==typeof cstNode.grammarSource&&(cstNodeObj.grammarSource=this.getGrammarElement(cstNode.grammarSource)),cstNodeObj.astNode=context.astNodes.get(cstNode.astNode),isCompositeCstNode(cstNodeObj))for(const child of cstNode.content){const hydrated=this.hydrateCstNode(child,context,num++);cstNodeObj.content.push(hydrated)}return cstNodeObj}hydrateCstLeafNode(cstNode){const tokenType=this.getTokenType(cstNode.tokenType),offset=cstNode.offset,length=cstNode.length,startLine=cstNode.startLine,startColumn=cstNode.startColumn,endLine=cstNode.endLine,endColumn=cstNode.endColumn,hidden=cstNode.hidden;return new LeafCstNodeImpl(offset,length,{start:{line:startLine,character:startColumn},end:{line:endLine,character:endColumn}},tokenType,hidden)}getTokenType(name){return this.lexer.definition[name]}getGrammarElementId(node){if(node)return 0===this.grammarElementIdMap.size&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(node)}getGrammarElement(id){0===this.grammarElementIdMap.size&&this.createGrammarElementIdMap();return this.grammarElementIdMap.getKey(id)}createGrammarElementIdMap(){let id=0;for(const element of streamAst(this.grammar))isAbstractElement(element)&&this.grammarElementIdMap.set(element,id++)}}function createDefaultCoreModule(context){return{documentation:{CommentProvider:services=>new DefaultCommentProvider(services),DocumentationProvider:services=>new JSDocDocumentationProvider(services)},parser:{AsyncParser:services=>new DefaultAsyncParser(services),GrammarConfig:services=>function(services){const rules=[],grammar=services.Grammar;for(const rule of grammar.rules)isTerminalRule(rule)&&isCommentTerminal(rule)&&isMultilineComment(terminalRegex(rule))&&rules.push(rule.name);return{multilineCommentRules:rules,nameRegexp:DefaultNameRegexp}}(services),LangiumParser:services=>createLangiumParser(services),CompletionParser:services=>function(services){const grammar=services.Grammar,lexer=services.parser.Lexer,parser=new LangiumCompletionParser(services);return createParser(grammar,parser,lexer.definition),parser.finalize(),parser}(services),ValueConverter:()=>new DefaultValueConverter,TokenBuilder:()=>new DefaultTokenBuilder,Lexer:services=>new DefaultLexer(services),ParserErrorMessageProvider:()=>new LangiumParserErrorMessageProvider,LexerErrorMessageProvider:()=>new DefaultLexerErrorMessageProvider},workspace:{AstNodeLocator:()=>new DefaultAstNodeLocator,AstNodeDescriptionProvider:services=>new DefaultAstNodeDescriptionProvider(services),ReferenceDescriptionProvider:services=>new DefaultReferenceDescriptionProvider(services)},references:{Linker:services=>new DefaultLinker(services),NameProvider:()=>new DefaultNameProvider,ScopeProvider:services=>new DefaultScopeProvider(services),ScopeComputation:services=>new DefaultScopeComputation(services),References:services=>new DefaultReferences(services)},serializer:{Hydrator:services=>new DefaultHydrator(services),JsonSerializer:services=>new DefaultJsonSerializer(services)},validation:{DocumentValidator:services=>new DefaultDocumentValidator(services),ValidationRegistry:services=>new ValidationRegistry(services)},shared:()=>context.shared}}function createDefaultSharedCoreModule(context){return{ServiceRegistry:services=>new DefaultServiceRegistry(services),workspace:{LangiumDocuments:services=>new DefaultLangiumDocuments(services),LangiumDocumentFactory:services=>new DefaultLangiumDocumentFactory(services),DocumentBuilder:services=>new DefaultDocumentBuilder(services),IndexManager:services=>new DefaultIndexManager(services),WorkspaceManager:services=>new DefaultWorkspaceManager(services),FileSystemProvider:services=>context.fileSystemProvider(services),WorkspaceLock:()=>new DefaultWorkspaceLock,ConfigurationProvider:services=>new DefaultConfigurationProvider(services)},profilers:{}}}var Module;function inject(module1,module2,module3,module4,module5,module6,module7,module8,module9){return _inject([module1,module2,module3,module4,module5,module6,module7,module8,module9].reduce(_merge,{}))}(Module||(Module={})).merge=(m1,m2)=>_merge(_merge({},m1),m2);const isProxy=Symbol("isProxy");function _inject(module,injector){const proxy=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(obj,prop)=>prop===isProxy||_resolve(obj,prop,module,injector||proxy),getOwnPropertyDescriptor:(obj,prop)=>(_resolve(obj,prop,module,injector||proxy),Object.getOwnPropertyDescriptor(obj,prop)),has:(_,prop)=>prop in module,ownKeys:()=>[...Object.getOwnPropertyNames(module)]});return proxy}const __requested__=Symbol();function _resolve(obj,prop,module,injector){if(prop in obj){if(obj[prop]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable. Cause: "+obj[prop]);if(obj[prop]===__requested__)throw new Error('Cycle detected. Please make "'+String(prop)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return obj[prop]}if(prop in module){const value=module[prop];obj[prop]=__requested__;try{obj[prop]="function"==typeof value?value(injector):_inject(value,injector)}catch(error){throw obj[prop]=error instanceof Error?error:void 0,error}return obj[prop]}}function _merge(target,source){if(source)for(const[key,sourceValue]of Object.entries(source))if(null!=sourceValue)if("object"==typeof sourceValue){const targetValue=target[key];target[key]=_merge("object"==typeof targetValue&&null!==targetValue?targetValue:{},sourceValue)}else target[key]=sourceValue;return target}class EmptyFileSystemProvider{stat(_uri){throw new Error("No file system is available.")}statSync(_uri){throw new Error("No file system is available.")}async exists(){return!1}existsSync(){return!1}readBinary(){throw new Error("No file system is available.")}readBinarySync(){throw new Error("No file system is available.")}readFile(){throw new Error("No file system is available.")}readFileSync(){throw new Error("No file system is available.")}async readDirectory(){return[]}readDirectorySync(){return[]}}const EmptyFileSystem={fileSystemProvider:()=>new EmptyFileSystemProvider},minimalGrammarModule={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},minimalSharedGrammarModule={AstReflection:()=>new LangiumGrammarAstReflection};function loadGrammarFromJson(json){const services=function(){const shared=inject(createDefaultSharedCoreModule(EmptyFileSystem),minimalSharedGrammarModule),grammar=inject(createDefaultCoreModule({shared:shared}),minimalGrammarModule);return shared.ServiceRegistry.register(grammar),grammar}(),astNode=services.serializer.JsonSerializer.deserialize(json);return services.shared.workspace.LangiumDocumentFactory.fromModel(astNode,URI.parse(`memory:/${astNode.name??"grammar"}.langium`)),astNode}var ArchitectureGrammar,GitGraphGrammar,InfoGrammar,PacketGrammar,PieGrammar,RadarGrammar,TreemapGrammar,TreeViewGrammar,WardleyGrammar,__defProp2=Object.defineProperty,__name=(target,value)=>__defProp2(target,"name",{value:value,configurable:!0});(ArchitectureGrammar||(ArchitectureGrammar={})).Terminals={ARROW_DIRECTION:/L|R|T|B/,ARROW_GROUP:/\{group\}/,ARROW_INTO:/<|>/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,ARCH_ICON:/\([\w-:]+\)/,ARCH_TITLE:/\[(?:"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|[\w ]+)\]/},(GitGraphGrammar||(GitGraphGrammar={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,REFERENCE:/\w([-\./\w]*[-\w])?/},(InfoGrammar||(InfoGrammar={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(PacketGrammar||(PacketGrammar={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(PieGrammar||(PieGrammar={})).Terminals={NUMBER_PIE:/(?:-?[0-9]+\.[0-9]+(?!\.))|(?:-?(0|[1-9][0-9]*)(?!\.))/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(RadarGrammar||(RadarGrammar={})).Terminals={GRATICULE:/circle|polygon/,BOOLEAN:/true|false/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NUMBER:/(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(TreemapGrammar||(TreemapGrammar={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,TREEMAP_KEYWORD:/treemap-beta|treemap/,CLASS_DEF:/classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/,STYLE_SEPARATOR:/:::/,SEPARATOR:/:/,COMMA:/,/,INDENTATION:/[ \t]{1,}/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,ID2:/[a-zA-Z_][a-zA-Z0-9_]*/,NUMBER2:/[0-9_\.\,]+/,STRING2:/"[^"]*"|'[^']*'/},(TreeViewGrammar||(TreeViewGrammar={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INDENTATION:/[ \t]{1,}/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,STRING2:/"[^"]*"|'[^']*'/},(WardleyGrammar||(WardleyGrammar={})).Terminals={WARDLEY_NUMBER:/[0-9]+\.[0-9]+/,ARROW:/->/,LINK_PORT:/\+<>|\+>|\+</,LINK_ARROW:/-->|-\.->|>|\+'[^']*'<>|\+'[^']*'<|\+'[^']*'>/,LINK_LABEL:/;[^\n\r]+/,STRATEGY:/build|buy|outsource|market/,KW_WARDLEY:/wardley-beta/,KW_SIZE:/size/,KW_EVOLUTION:/evolution/,KW_ANCHOR:/anchor/,KW_COMPONENT:/component/,KW_LABEL:/label/,KW_INERTIA:/inertia/,KW_EVOLVE:/evolve/,KW_PIPELINE:/pipeline/,KW_NOTE:/note/,KW_ANNOTATIONS:/annotations/,KW_ANNOTATION:/annotation/,KW_ACCELERATOR:/accelerator/,KW_DEACCELERATOR:/deaccelerator/,NAME_WITH_SPACES:/(?!title\s|accTitle|accDescr)[A-Za-z][A-Za-z0-9_()&]*(?:[ \t]+[A-Za-z(][A-Za-z0-9_()&]*)*/,WS:/[ \t]+/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},ArchitectureGrammar.Terminals,GitGraphGrammar.Terminals,InfoGrammar.Terminals,PacketGrammar.Terminals,PieGrammar.Terminals,RadarGrammar.Terminals,TreeViewGrammar.Terminals,TreemapGrammar.Terminals,WardleyGrammar.Terminals;var Accelerator_$type="Accelerator",Accelerator_name="name",Accelerator_x="x",Accelerator_y="y",Anchor_$type="Anchor",Anchor_evolution="evolution",Anchor_name="name",Anchor_visibility="visibility",Annotation_$type="Annotation",Annotation_number="number",Annotation_text="text",Annotation_x="x",Annotation_y="y",Annotations_$type="Annotations",Annotations_x="x",Annotations_y="y",Architecture_$type="Architecture",Architecture_accDescr="accDescr",Architecture_accTitle="accTitle",Architecture_edges="edges",Architecture_groups="groups",Architecture_junctions="junctions",Architecture_services="services",Architecture_title="title";__name(function(item){return reflection.isInstance(item,Architecture_$type)},"isArchitecture");var Axis_$type="Axis",Axis_label="label",Axis_name="name",Branch_$type="Branch",Branch_name="name",Branch_order="order";__name(function(item){return reflection.isInstance(item,Branch_$type)},"isBranch");var Checkout_$type="Checkout",Checkout_branch="branch",CherryPicking_$type="CherryPicking",CherryPicking_id="id",CherryPicking_parent="parent",CherryPicking_tags="tags",ClassDefStatement_$type="ClassDefStatement",ClassDefStatement_className="className",ClassDefStatement_styleText="styleText",Commit_$type="Commit",Commit_id="id",Commit_message="message",Commit_tags="tags",Commit_type="type";__name(function(item){return reflection.isInstance(item,Commit_$type)},"isCommit");var Component_$type="Component",Component_decorator="decorator",Component_evolution="evolution",Component_inertia="inertia",Component_label="label",Component_name="name",Component_visibility="visibility",Curve_$type="Curve",Curve_entries="entries",Curve_label="label",Curve_name="name",Deaccelerator_$type="Deaccelerator",Deaccelerator_name="name",Deaccelerator_x="x",Deaccelerator_y="y",Decorator_$type="Decorator",Decorator_strategy="strategy",Direction_$type="Direction",Direction_accDescr="accDescr",Direction_accTitle="accTitle",Direction_dir="dir",Direction_statements="statements",Direction_title="title",Edge_$type="Edge",Edge_lhsDir="lhsDir",Edge_lhsGroup="lhsGroup",Edge_lhsId="lhsId",Edge_lhsInto="lhsInto",Edge_rhsDir="rhsDir",Edge_rhsGroup="rhsGroup",Edge_rhsId="rhsId",Edge_rhsInto="rhsInto",Edge_title="title",Entry_$type="Entry",Entry_axis="axis",Entry_value="value",Evolution_$type="Evolution",Evolution_stages="stages",EvolutionStage_$type="EvolutionStage",EvolutionStage_boundary="boundary",EvolutionStage_name="name",EvolutionStage_secondName="secondName",Evolve_$type="Evolve",Evolve_component="component",Evolve_target="target",GitGraph_$type="GitGraph",GitGraph_accDescr="accDescr",GitGraph_accTitle="accTitle",GitGraph_statements="statements",GitGraph_title="title";__name(function(item){return reflection.isInstance(item,GitGraph_$type)},"isGitGraph");var Group_$type="Group",Group_icon="icon",Group_id="id",Group_in="in",Group_title="title",Info_$type="Info",Info_accDescr="accDescr",Info_accTitle="accTitle",Info_title="title";__name(function(item){return reflection.isInstance(item,Info_$type)},"isInfo");var Item_$type="Item",Item_classSelector="classSelector",Item_name="name",Junction_$type="Junction",Junction_id="id",Junction_in="in",Label_$type="Label",Label_negX="negX",Label_negY="negY",Label_offsetX="offsetX",Label_offsetY="offsetY",Leaf_$type="Leaf",Leaf_classSelector="classSelector",Leaf_name="name",Leaf_value="value",Link_$type="Link",Link_arrow="arrow",Link_from="from",Link_fromPort="fromPort",Link_linkLabel="linkLabel",Link_to="to",Link_toPort="toPort",Merge_$type="Merge",Merge_branch="branch",Merge_id="id",Merge_tags="tags",Merge_type="type";__name(function(item){return reflection.isInstance(item,Merge_$type)},"isMerge");var Note_$type="Note",Note_evolution="evolution",Note_text="text",Note_visibility="visibility",Option2_$type="Option",Option2_name="name",Option2_value="value",Packet_$type="Packet",Packet_accDescr="accDescr",Packet_accTitle="accTitle",Packet_blocks="blocks",Packet_title="title";__name(function(item){return reflection.isInstance(item,Packet_$type)},"isPacket");var PacketBlock_$type="PacketBlock",PacketBlock_bits="bits",PacketBlock_end="end",PacketBlock_label="label",PacketBlock_start="start";__name(function(item){return reflection.isInstance(item,PacketBlock_$type)},"isPacketBlock");var Pie_$type="Pie",Pie_accDescr="accDescr",Pie_accTitle="accTitle",Pie_sections="sections",Pie_showData="showData",Pie_title="title";__name(function(item){return reflection.isInstance(item,Pie_$type)},"isPie");var PieSection_$type="PieSection",PieSection_label="label",PieSection_value="value";__name(function(item){return reflection.isInstance(item,PieSection_$type)},"isPieSection");var Pipeline_$type="Pipeline",Pipeline_components="components",Pipeline_parent="parent",PipelineComponent_$type="PipelineComponent",PipelineComponent_evolution="evolution",PipelineComponent_label="label",PipelineComponent_name="name",Radar_$type="Radar",Radar_accDescr="accDescr",Radar_accTitle="accTitle",Radar_axes="axes",Radar_curves="curves",Radar_options="options",Radar_title="title",Section_$type="Section",Section_classSelector="classSelector",Section_name="name",Service_$type="Service",Service_icon="icon",Service_iconText="iconText",Service_id="id",Service_in="in",Service_title="title",Size_$type="Size",Size_height="height",Size_width="width",Statement_$type="Statement",Treemap_$type="Treemap",Treemap_accDescr="accDescr",Treemap_accTitle="accTitle",Treemap_title="title",Treemap_TreemapRows="TreemapRows";__name(function(item){return reflection.isInstance(item,Treemap_$type)},"isTreemap");var TreemapRow_$type="TreemapRow",TreemapRow_indent="indent",TreemapRow_item="item",TreeNode_$type="TreeNode",TreeNode_indent="indent",TreeNode_name="name",TreeView_$type="TreeView",TreeView_accDescr="accDescr",TreeView_accTitle="accTitle",TreeView_nodes="nodes",TreeView_title="title",Wardley_$type="Wardley",Wardley_accDescr="accDescr",Wardley_accelerators="accelerators",Wardley_accTitle="accTitle",Wardley_anchors="anchors",Wardley_annotation="annotation",Wardley_annotations="annotations",Wardley_components="components",Wardley_deaccelerators="deaccelerators",Wardley_evolution="evolution",Wardley_evolves="evolves",Wardley_links="links",Wardley_notes="notes",Wardley_pipelines="pipelines",Wardley_size="size",Wardley_title="title";__name(function(item){return reflection.isInstance(item,Wardley_$type)},"isWardley");var loadedArchitectureGrammarGrammar,loadedGitGraphGrammarGrammar,loadedInfoGrammarGrammar,loadedPacketGrammarGrammar,loadedPieGrammarGrammar,loadedRadarGrammarGrammar,loadedTreemapGrammarGrammar,loadedTreeViewGrammarGrammar,loadedWardleyGrammarGrammar,MermaidAstReflection=(__name(_a=class extends AbstractAstReflection{constructor(){super(...arguments),this.types={Accelerator:{name:Accelerator_$type,properties:{name:{name:Accelerator_name},x:{name:Accelerator_x},y:{name:Accelerator_y}},superTypes:[]},Anchor:{name:Anchor_$type,properties:{evolution:{name:Anchor_evolution},name:{name:Anchor_name},visibility:{name:Anchor_visibility}},superTypes:[]},Annotation:{name:Annotation_$type,properties:{number:{name:Annotation_number},text:{name:Annotation_text},x:{name:Annotation_x},y:{name:Annotation_y}},superTypes:[]},Annotations:{name:Annotations_$type,properties:{x:{name:Annotations_x},y:{name:Annotations_y}},superTypes:[]},Architecture:{name:Architecture_$type,properties:{accDescr:{name:Architecture_accDescr},accTitle:{name:Architecture_accTitle},edges:{name:Architecture_edges,defaultValue:[]},groups:{name:Architecture_groups,defaultValue:[]},junctions:{name:Architecture_junctions,defaultValue:[]},services:{name:Architecture_services,defaultValue:[]},title:{name:Architecture_title}},superTypes:[]},Axis:{name:Axis_$type,properties:{label:{name:Axis_label},name:{name:Axis_name}},superTypes:[]},Branch:{name:Branch_$type,properties:{name:{name:Branch_name},order:{name:Branch_order}},superTypes:[Statement_$type]},Checkout:{name:Checkout_$type,properties:{branch:{name:Checkout_branch}},superTypes:[Statement_$type]},CherryPicking:{name:CherryPicking_$type,properties:{id:{name:CherryPicking_id},parent:{name:CherryPicking_parent},tags:{name:CherryPicking_tags,defaultValue:[]}},superTypes:[Statement_$type]},ClassDefStatement:{name:ClassDefStatement_$type,properties:{className:{name:ClassDefStatement_className},styleText:{name:ClassDefStatement_styleText}},superTypes:[]},Commit:{name:Commit_$type,properties:{id:{name:Commit_id},message:{name:Commit_message},tags:{name:Commit_tags,defaultValue:[]},type:{name:Commit_type}},superTypes:[Statement_$type]},Component:{name:Component_$type,properties:{decorator:{name:Component_decorator},evolution:{name:Component_evolution},inertia:{name:Component_inertia,defaultValue:!1},label:{name:Component_label},name:{name:Component_name},visibility:{name:Component_visibility}},superTypes:[]},Curve:{name:Curve_$type,properties:{entries:{name:Curve_entries,defaultValue:[]},label:{name:Curve_label},name:{name:Curve_name}},superTypes:[]},Deaccelerator:{name:Deaccelerator_$type,properties:{name:{name:Deaccelerator_name},x:{name:Deaccelerator_x},y:{name:Deaccelerator_y}},superTypes:[]},Decorator:{name:Decorator_$type,properties:{strategy:{name:Decorator_strategy}},superTypes:[]},Direction:{name:Direction_$type,properties:{accDescr:{name:Direction_accDescr},accTitle:{name:Direction_accTitle},dir:{name:Direction_dir},statements:{name:Direction_statements,defaultValue:[]},title:{name:Direction_title}},superTypes:[GitGraph_$type]},Edge:{name:Edge_$type,properties:{lhsDir:{name:Edge_lhsDir},lhsGroup:{name:Edge_lhsGroup,defaultValue:!1},lhsId:{name:Edge_lhsId},lhsInto:{name:Edge_lhsInto,defaultValue:!1},rhsDir:{name:Edge_rhsDir},rhsGroup:{name:Edge_rhsGroup,defaultValue:!1},rhsId:{name:Edge_rhsId},rhsInto:{name:Edge_rhsInto,defaultValue:!1},title:{name:Edge_title}},superTypes:[]},Entry:{name:Entry_$type,properties:{axis:{name:Entry_axis,referenceType:Axis_$type},value:{name:Entry_value}},superTypes:[]},Evolution:{name:Evolution_$type,properties:{stages:{name:Evolution_stages,defaultValue:[]}},superTypes:[]},EvolutionStage:{name:EvolutionStage_$type,properties:{boundary:{name:EvolutionStage_boundary},name:{name:EvolutionStage_name},secondName:{name:EvolutionStage_secondName}},superTypes:[]},Evolve:{name:Evolve_$type,properties:{component:{name:Evolve_component},target:{name:Evolve_target}},superTypes:[]},GitGraph:{name:GitGraph_$type,properties:{accDescr:{name:GitGraph_accDescr},accTitle:{name:GitGraph_accTitle},statements:{name:GitGraph_statements,defaultValue:[]},title:{name:GitGraph_title}},superTypes:[]},Group:{name:Group_$type,properties:{icon:{name:Group_icon},id:{name:Group_id},in:{name:Group_in},title:{name:Group_title}},superTypes:[]},Info:{name:Info_$type,properties:{accDescr:{name:Info_accDescr},accTitle:{name:Info_accTitle},title:{name:Info_title}},superTypes:[]},Item:{name:Item_$type,properties:{classSelector:{name:Item_classSelector},name:{name:Item_name}},superTypes:[]},Junction:{name:Junction_$type,properties:{id:{name:Junction_id},in:{name:Junction_in}},superTypes:[]},Label:{name:Label_$type,properties:{negX:{name:Label_negX,defaultValue:!1},negY:{name:Label_negY,defaultValue:!1},offsetX:{name:Label_offsetX},offsetY:{name:Label_offsetY}},superTypes:[]},Leaf:{name:Leaf_$type,properties:{classSelector:{name:Leaf_classSelector},name:{name:Leaf_name},value:{name:Leaf_value}},superTypes:[Item_$type]},Link:{name:Link_$type,properties:{arrow:{name:Link_arrow},from:{name:Link_from},fromPort:{name:Link_fromPort},linkLabel:{name:Link_linkLabel},to:{name:Link_to},toPort:{name:Link_toPort}},superTypes:[]},Merge:{name:Merge_$type,properties:{branch:{name:Merge_branch},id:{name:Merge_id},tags:{name:Merge_tags,defaultValue:[]},type:{name:Merge_type}},superTypes:[Statement_$type]},Note:{name:Note_$type,properties:{evolution:{name:Note_evolution},text:{name:Note_text},visibility:{name:Note_visibility}},superTypes:[]},Option:{name:Option2_$type,properties:{name:{name:Option2_name},value:{name:Option2_value,defaultValue:!1}},superTypes:[]},Packet:{name:Packet_$type,properties:{accDescr:{name:Packet_accDescr},accTitle:{name:Packet_accTitle},blocks:{name:Packet_blocks,defaultValue:[]},title:{name:Packet_title}},superTypes:[]},PacketBlock:{name:PacketBlock_$type,properties:{bits:{name:PacketBlock_bits},end:{name:PacketBlock_end},label:{name:PacketBlock_label},start:{name:PacketBlock_start}},superTypes:[]},Pie:{name:Pie_$type,properties:{accDescr:{name:Pie_accDescr},accTitle:{name:Pie_accTitle},sections:{name:Pie_sections,defaultValue:[]},showData:{name:Pie_showData,defaultValue:!1},title:{name:Pie_title}},superTypes:[]},PieSection:{name:PieSection_$type,properties:{label:{name:PieSection_label},value:{name:PieSection_value}},superTypes:[]},Pipeline:{name:Pipeline_$type,properties:{components:{name:Pipeline_components,defaultValue:[]},parent:{name:Pipeline_parent}},superTypes:[]},PipelineComponent:{name:PipelineComponent_$type,properties:{evolution:{name:PipelineComponent_evolution},label:{name:PipelineComponent_label},name:{name:PipelineComponent_name}},superTypes:[]},Radar:{name:Radar_$type,properties:{accDescr:{name:Radar_accDescr},accTitle:{name:Radar_accTitle},axes:{name:Radar_axes,defaultValue:[]},curves:{name:Radar_curves,defaultValue:[]},options:{name:Radar_options,defaultValue:[]},title:{name:Radar_title}},superTypes:[]},Section:{name:Section_$type,properties:{classSelector:{name:Section_classSelector},name:{name:Section_name}},superTypes:[Item_$type]},Service:{name:Service_$type,properties:{icon:{name:Service_icon},iconText:{name:Service_iconText},id:{name:Service_id},in:{name:Service_in},title:{name:Service_title}},superTypes:[]},Size:{name:Size_$type,properties:{height:{name:Size_height},width:{name:Size_width}},superTypes:[]},Statement:{name:Statement_$type,properties:{},superTypes:[]},TreeNode:{name:TreeNode_$type,properties:{indent:{name:TreeNode_indent},name:{name:TreeNode_name}},superTypes:[]},TreeView:{name:TreeView_$type,properties:{accDescr:{name:TreeView_accDescr},accTitle:{name:TreeView_accTitle},nodes:{name:TreeView_nodes,defaultValue:[]},title:{name:TreeView_title}},superTypes:[]},Treemap:{name:Treemap_$type,properties:{accDescr:{name:Treemap_accDescr},accTitle:{name:Treemap_accTitle},title:{name:Treemap_title},TreemapRows:{name:Treemap_TreemapRows,defaultValue:[]}},superTypes:[]},TreemapRow:{name:TreemapRow_$type,properties:{indent:{name:TreemapRow_indent},item:{name:TreemapRow_item}},superTypes:[]},Wardley:{name:Wardley_$type,properties:{accDescr:{name:Wardley_accDescr},accelerators:{name:Wardley_accelerators,defaultValue:[]},accTitle:{name:Wardley_accTitle},anchors:{name:Wardley_anchors,defaultValue:[]},annotation:{name:Wardley_annotation,defaultValue:[]},annotations:{name:Wardley_annotations,defaultValue:[]},components:{name:Wardley_components,defaultValue:[]},deaccelerators:{name:Wardley_deaccelerators,defaultValue:[]},evolution:{name:Wardley_evolution},evolves:{name:Wardley_evolves,defaultValue:[]},links:{name:Wardley_links,defaultValue:[]},notes:{name:Wardley_notes,defaultValue:[]},pipelines:{name:Wardley_pipelines,defaultValue:[]},size:{name:Wardley_size},title:{name:Wardley_title}},superTypes:[]}}}},"MermaidAstReflection"),_a),reflection=new MermaidAstReflection,ArchitectureGrammarGrammar=__name(()=>loadedArchitectureGrammarGrammar??(loadedArchitectureGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"ArchitectureGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","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":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"LeftPort","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"RightPort","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"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@29"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@18"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[(?:\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'|[\\\\w ]+)\\\\]/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}')),"ArchitectureGrammarGrammar"),GitGraphGrammarGrammar=__name(()=>loadedGitGraphGrammarGrammar??(loadedGitGraphGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"GitGraphGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"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@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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"}]}},"entry":false,"fragment":false,"parameters":[]},{"$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@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}')),"GitGraphGrammarGrammar"),InfoGrammarGrammar=__name(()=>loadedInfoGrammarGrammar??(loadedInfoGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"InfoGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","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@1"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"InfoGrammarGrammar"),PacketGrammarGrammar=__name(()=>loadedPacketGrammarGrammar??(loadedPacketGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"PacketGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"PacketGrammarGrammar"),PieGrammarGrammar=__name(()=>loadedPieGrammarGrammar??(loadedPieGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"PieGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"PieGrammarGrammar"),RadarGrammarGrammar=__name(()=>loadedRadarGrammarGrammar??(loadedRadarGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"RadarGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}},"isMulti":false}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"types":[]}')),"RadarGrammarGrammar"),TreemapGrammarGrammar=__name(()=>loadedTreemapGrammarGrammar??(loadedTreemapGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"TreemapGrammar","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@15"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}')),"TreemapGrammarGrammar"),TreeViewGrammarGrammar=__name(()=>loadedTreeViewGrammarGrammar??(loadedTreeViewGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"TreeViewGrammar","rules":[{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"TreeView","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"treeView-beta"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"nodes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreeNode","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"TreeView","attributes":[{"$type":"TypeAttribute","name":"nodes","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@9"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * TreeView grammar for Langium\\n * Converted from treemap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treeView declaration.\\n */"}')),"TreeViewGrammarGrammar"),WardleyGrammarGrammar=__name(()=>loadedWardleyGrammarGrammar??(loadedWardleyGrammarGrammar=loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"WardleyGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Wardley","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"size","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"anchors","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"links","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"evolves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"pipelines","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"notes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"annotations","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"annotation","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Assignment","feature":"deaccelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Size","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"width","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"height","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolution","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EvolutionStage","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"@"},{"$type":"Assignment","feature":"boundary","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"/"},{"$type":"Assignment","feature":"secondName","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Anchor","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Component","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"decorator","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Keyword","value":")"}]}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Label","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"negX","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetX","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"negY","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetY","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Decorator","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"strategy","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Link","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"fromPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"arrow","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]},"cardinality":"?"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"toPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"linkLabel","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolve","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]},{"$type":"Assignment","feature":"component","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Pipeline","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"+"},{"$type":"Keyword","value":"}"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PipelineComponent","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Note","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotations","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotation","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]},{"$type":"Assignment","feature":"number","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CoordinateValue","dataType":"number","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Accelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Deaccelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"WARDLEY_NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"->"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_PORT","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<>"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+>"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_ARROW","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"--\x3e"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-.->"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":">"},"parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+\'[^\']*\'<>/","parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+\'[^\']*\'</","parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+\'[^\']*\'>/","parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_LABEL","definition":{"$type":"RegexToken","regex":"/;[^\\\\n\\\\r]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRATEGY","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"build"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"buy"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"outsource"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"market"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_WARDLEY","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"wardley-beta"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_SIZE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"size"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLUTION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolution"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANCHOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"anchor"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_COMPONENT","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"component"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_LABEL","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"label"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_INERTIA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"inertia"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLVE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolve"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_PIPELINE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"pipeline"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_NOTE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"note"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATIONS","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotations"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotation"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"accelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_DEACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"deaccelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NAME_WITH_SPACES","definition":{"$type":"RegexToken","regex":"/(?!title\\\\s|accTitle|accDescr)[A-Za-z][A-Za-z0-9_()&]*(?:[ \\\\t]+[A-Za-z(][A-Za-z0-9_()&]*)*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@47"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@48"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"WardleyGrammarGrammar"),ArchitectureGrammarLanguageMetaData={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},GitGraphGrammarLanguageMetaData={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},InfoGrammarLanguageMetaData={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},PacketGrammarLanguageMetaData={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},PieGrammarLanguageMetaData={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},RadarGrammarLanguageMetaData={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},TreemapGrammarLanguageMetaData={languageId:"treemap",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},TreeViewGrammarLanguageMetaData={languageId:"treeView",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},WardleyGrammarLanguageMetaData={languageId:"wardley",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},MermaidGeneratedSharedModule={AstReflection:__name(()=>new MermaidAstReflection,"AstReflection")},ArchitectureGrammarGeneratedModule={Grammar:__name(()=>ArchitectureGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>ArchitectureGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},GitGraphGrammarGeneratedModule={Grammar:__name(()=>GitGraphGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>GitGraphGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},InfoGrammarGeneratedModule={Grammar:__name(()=>InfoGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>InfoGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},PacketGrammarGeneratedModule={Grammar:__name(()=>PacketGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>PacketGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},PieGrammarGeneratedModule={Grammar:__name(()=>PieGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>PieGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},RadarGrammarGeneratedModule={Grammar:__name(()=>RadarGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>RadarGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},TreemapGrammarGeneratedModule={Grammar:__name(()=>TreemapGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>TreemapGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},TreeViewGrammarGeneratedModule={Grammar:__name(()=>TreeViewGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>TreeViewGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},WardleyGrammarGeneratedModule={Grammar:__name(()=>WardleyGrammarGrammar(),"Grammar"),LanguageMetaData:__name(()=>WardleyGrammarLanguageMetaData,"LanguageMetaData"),parser:{}},rulesRegexes={ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/accTitle[\t ]*:([^\n\r]*)/,TITLE:/title([\t ][^\n\r]*|)/},AbstractMermaidValueConverter=(__name(_b=class extends DefaultValueConverter{runConverter(rule,input,cstNode){let value=this.runCommonConverter(rule,input,cstNode);return void 0===value&&(value=this.runCustomConverter(rule,input,cstNode)),void 0===value?super.runConverter(rule,input,cstNode):value}runCommonConverter(rule,input,_cstNode){const regex=rulesRegexes[rule.name];if(void 0===regex)return;const match=regex.exec(input);return null!==match?void 0!==match[1]?match[1].trim().replace(/[\t ]{2,}/gm," "):void 0!==match[2]?match[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,"\n"):void 0:void 0}},"AbstractMermaidValueConverter"),_b),CommonValueConverter=(__name(_c=class extends AbstractMermaidValueConverter{runCustomConverter(_rule,_input,_cstNode){}},"CommonValueConverter"),_c),AbstractMermaidTokenBuilder=(__name(_d=class extends DefaultTokenBuilder{constructor(keywords){super(),this.keywords=new Set(keywords)}buildKeywordTokens(rules,terminalTokens,options){const tokenTypes=super.buildKeywordTokens(rules,terminalTokens,options);return tokenTypes.forEach(tokenType=>{this.keywords.has(tokenType.name)&&void 0!==tokenType.PATTERN&&(tokenType.PATTERN=new RegExp(tokenType.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),tokenTypes}},"AbstractMermaidTokenBuilder"),_d);__name(class extends AbstractMermaidTokenBuilder{},"CommonTokenBuilder");var TreemapTokenBuilder=(__name(_f=class extends AbstractMermaidTokenBuilder{constructor(){super(["treemap"])}},"TreemapTokenBuilder"),_f),classDefRegex=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,TreemapValueConverter=(__name(_g=class extends AbstractMermaidValueConverter{runCustomConverter(rule,input,_cstNode){if("NUMBER2"===rule.name)return parseFloat(input.replace(/,/g,""));if("SEPARATOR"===rule.name)return input.substring(1,input.length-1);if("STRING2"===rule.name)return input.substring(1,input.length-1);if("INDENTATION"===rule.name)return input.length;if("ClassDef"===rule.name){if("string"!=typeof input)return input;const match=classDefRegex.exec(input);if(match)return{$type:"ClassDefStatement",className:match[1],styleText:match[2]||void 0}}}},"TreemapValueConverter"),_g);function registerValidationChecks(services){const validator=services.validation.TreemapValidator,registry=services.validation.ValidationRegistry;if(registry){const checks={Treemap:validator.checkSingleRoot.bind(validator)};registry.register(checks,validator)}}__name(registerValidationChecks,"registerValidationChecks");var TreemapValidator=(__name(_h=class{checkSingleRoot(doc,accept){let rootNodeIndentation;for(const row of doc.TreemapRows)row.item&&(void 0===rootNodeIndentation&&void 0===row.indent?rootNodeIndentation=0:(void 0===row.indent||void 0!==rootNodeIndentation&&rootNodeIndentation>=parseInt(row.indent,10))&&accept("error","Multiple root nodes are not allowed in a treemap.",{node:row,property:"item"}))}},"TreemapValidator"),_h),TreemapModule={parser:{TokenBuilder:__name(()=>new TreemapTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new TreemapValueConverter,"ValueConverter")},validation:{TreemapValidator:__name(()=>new TreemapValidator,"TreemapValidator")}};function createTreemapServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Treemap2=inject(createDefaultCoreModule({shared:shared}),TreemapGrammarGeneratedModule,TreemapModule);return shared.ServiceRegistry.register(Treemap2),registerValidationChecks(Treemap2),{shared:shared,Treemap:Treemap2}}__name(createTreemapServices,"createTreemapServices");var WardleyValueConverter=(__name(_i=class extends AbstractMermaidValueConverter{runCustomConverter(rule,input,_cstNode){if("LINK_LABEL"===rule.name.toUpperCase())return input.substring(1).trim()}},"WardleyValueConverter"),_i),WardleyModule={parser:{ValueConverter:__name(()=>new WardleyValueConverter,"ValueConverter")}};function createWardleyServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Wardley2=inject(createDefaultCoreModule({shared:shared}),WardleyGrammarGeneratedModule,WardleyModule);return shared.ServiceRegistry.register(Wardley2),{shared:shared,Wardley:Wardley2}}__name(createWardleyServices,"createWardleyServices");var GitGraphTokenBuilder=(__name(_j=class extends AbstractMermaidTokenBuilder{constructor(){super(["gitGraph"])}},"GitGraphTokenBuilder"),_j),GitGraphModule={parser:{TokenBuilder:__name(()=>new GitGraphTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new CommonValueConverter,"ValueConverter")}};function createGitGraphServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),GitGraph2=inject(createDefaultCoreModule({shared:shared}),GitGraphGrammarGeneratedModule,GitGraphModule);return shared.ServiceRegistry.register(GitGraph2),{shared:shared,GitGraph:GitGraph2}}__name(createGitGraphServices,"createGitGraphServices");var InfoTokenBuilder=(__name(_k=class extends AbstractMermaidTokenBuilder{constructor(){super(["info","showInfo"])}},"InfoTokenBuilder"),_k),InfoModule={parser:{TokenBuilder:__name(()=>new InfoTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new CommonValueConverter,"ValueConverter")}};function createInfoServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Info2=inject(createDefaultCoreModule({shared:shared}),InfoGrammarGeneratedModule,InfoModule);return shared.ServiceRegistry.register(Info2),{shared:shared,Info:Info2}}__name(createInfoServices,"createInfoServices");var PacketTokenBuilder=(__name(_l=class extends AbstractMermaidTokenBuilder{constructor(){super(["packet"])}},"PacketTokenBuilder"),_l),PacketModule={parser:{TokenBuilder:__name(()=>new PacketTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new CommonValueConverter,"ValueConverter")}};function createPacketServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Packet2=inject(createDefaultCoreModule({shared:shared}),PacketGrammarGeneratedModule,PacketModule);return shared.ServiceRegistry.register(Packet2),{shared:shared,Packet:Packet2}}__name(createPacketServices,"createPacketServices");var PieTokenBuilder=(__name(_m=class extends AbstractMermaidTokenBuilder{constructor(){super(["pie","showData"])}},"PieTokenBuilder"),_m),PieValueConverter=(__name(_n=class extends AbstractMermaidValueConverter{runCustomConverter(rule,input,_cstNode){if("PIE_SECTION_LABEL"===rule.name)return input.replace(/"/g,"").trim()}},"PieValueConverter"),_n),PieModule={parser:{TokenBuilder:__name(()=>new PieTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new PieValueConverter,"ValueConverter")}};function createPieServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Pie2=inject(createDefaultCoreModule({shared:shared}),PieGrammarGeneratedModule,PieModule);return shared.ServiceRegistry.register(Pie2),{shared:shared,Pie:Pie2}}__name(createPieServices,"createPieServices");var TreeViewValueConverter=(__name(_o=class extends AbstractMermaidValueConverter{runCustomConverter(rule,input,_cstNode){return"INDENTATION"===rule.name?(null==input?void 0:input.length)||0:"STRING2"===rule.name?input.substring(1,input.length-1):void 0}},"TreeViewValueConverter"),_o),TreeViewTokenBuilder=(__name(_p=class extends AbstractMermaidTokenBuilder{constructor(){super(["treeView-beta"])}},"TreeViewTokenBuilder"),_p),TreeViewModule={parser:{TokenBuilder:__name(()=>new TreeViewTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new TreeViewValueConverter,"ValueConverter")}};function createTreeViewServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),TreeView2=inject(createDefaultCoreModule({shared:shared}),TreeViewGrammarGeneratedModule,TreeViewModule);return shared.ServiceRegistry.register(TreeView2),{shared:shared,TreeView:TreeView2}}__name(createTreeViewServices,"createTreeViewServices");var ArchitectureTokenBuilder=(__name(_q=class extends AbstractMermaidTokenBuilder{constructor(){super(["architecture"])}},"ArchitectureTokenBuilder"),_q),ArchitectureValueConverter=(__name(_r=class extends AbstractMermaidValueConverter{runCustomConverter(rule,input,_cstNode){if("ARCH_ICON"===rule.name)return input.replace(/[()]/g,"").trim();if("ARCH_TEXT_ICON"===rule.name)return input.replace(/["()]/g,"");if("ARCH_TITLE"===rule.name){let result=input.replace(/^\[|]$/g,"").trim();return(result.startsWith('"')&&result.endsWith('"')||result.startsWith("'")&&result.endsWith("'"))&&(result=result.slice(1,-1),result=result.replace(/\\"/g,'"').replace(/\\'/g,"'")),result.trim()}}},"ArchitectureValueConverter"),_r),ArchitectureModule={parser:{TokenBuilder:__name(()=>new ArchitectureTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new ArchitectureValueConverter,"ValueConverter")}};function createArchitectureServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Architecture2=inject(createDefaultCoreModule({shared:shared}),ArchitectureGrammarGeneratedModule,ArchitectureModule);return shared.ServiceRegistry.register(Architecture2),{shared:shared,Architecture:Architecture2}}__name(createArchitectureServices,"createArchitectureServices");var RadarTokenBuilder=(__name(_s=class extends AbstractMermaidTokenBuilder{constructor(){super(["radar-beta"])}},"RadarTokenBuilder"),_s),RadarModule={parser:{TokenBuilder:__name(()=>new RadarTokenBuilder,"TokenBuilder"),ValueConverter:__name(()=>new CommonValueConverter,"ValueConverter")}};function createRadarServices(context=EmptyFileSystem){const shared=inject(createDefaultSharedCoreModule(context),MermaidGeneratedSharedModule),Radar2=inject(createDefaultCoreModule({shared:shared}),RadarGrammarGeneratedModule,RadarModule);return shared.ServiceRegistry.register(Radar2),{shared:shared,Radar:Radar2}}__name(createRadarServices,"createRadarServices");var parsers={},initializers={info:__name(async()=>{const{createInfoServices:createInfoServices2}=await __vitePreload(async()=>{const{createInfoServices:createInfoServices22}=await Promise.resolve().then(()=>infoOMHHGYJF);return{createInfoServices:createInfoServices22}},void 0),parser=createInfoServices2().Info.parser.LangiumParser;parsers.info=parser},"info"),packet:__name(async()=>{const{createPacketServices:createPacketServices2}=await __vitePreload(async()=>{const{createPacketServices:createPacketServices22}=await Promise.resolve().then(()=>packet4T2RLAQJ);return{createPacketServices:createPacketServices22}},void 0),parser=createPacketServices2().Packet.parser.LangiumParser;parsers.packet=parser},"packet"),pie:__name(async()=>{const{createPieServices:createPieServices2}=await __vitePreload(async()=>{const{createPieServices:createPieServices22}=await Promise.resolve().then(()=>pieZZUOXDRM);return{createPieServices:createPieServices22}},void 0),parser=createPieServices2().Pie.parser.LangiumParser;parsers.pie=parser},"pie"),treeView:__name(async()=>{const{createTreeViewServices:createTreeViewServices2}=await __vitePreload(async()=>{const{createTreeViewServices:createTreeViewServices22}=await Promise.resolve().then(()=>treeViewSZITEDCU);return{createTreeViewServices:createTreeViewServices22}},void 0),parser=createTreeViewServices2().TreeView.parser.LangiumParser;parsers.treeView=parser},"treeView"),architecture:__name(async()=>{const{createArchitectureServices:createArchitectureServices2}=await __vitePreload(async()=>{const{createArchitectureServices:createArchitectureServices22}=await Promise.resolve().then(()=>architectureYZFGNWBL);return{createArchitectureServices:createArchitectureServices22}},void 0),parser=createArchitectureServices2().Architecture.parser.LangiumParser;parsers.architecture=parser},"architecture"),gitGraph:__name(async()=>{const{createGitGraphServices:createGitGraphServices2}=await __vitePreload(async()=>{const{createGitGraphServices:createGitGraphServices22}=await Promise.resolve().then(()=>gitGraph7Q5UKJZL);return{createGitGraphServices:createGitGraphServices22}},void 0),parser=createGitGraphServices2().GitGraph.parser.LangiumParser;parsers.gitGraph=parser},"gitGraph"),radar:__name(async()=>{const{createRadarServices:createRadarServices2}=await __vitePreload(async()=>{const{createRadarServices:createRadarServices22}=await Promise.resolve().then(()=>radarPYXPWWZC);return{createRadarServices:createRadarServices22}},void 0),parser=createRadarServices2().Radar.parser.LangiumParser;parsers.radar=parser},"radar"),treemap:__name(async()=>{const{createTreemapServices:createTreemapServices2}=await __vitePreload(async()=>{const{createTreemapServices:createTreemapServices22}=await Promise.resolve().then(()=>treemapW4RFUUIX);return{createTreemapServices:createTreemapServices22}},void 0),parser=createTreemapServices2().Treemap.parser.LangiumParser;parsers.treemap=parser},"treemap"),wardley:__name(async()=>{const{createWardleyServices:createWardleyServices2}=await __vitePreload(async()=>{const{createWardleyServices:createWardleyServices22}=await Promise.resolve().then(()=>wardleyRL74JXVD);return{createWardleyServices:createWardleyServices22}},void 0),parser=createWardleyServices2().Wardley.parser.LangiumParser;parsers.wardley=parser},"wardley")};async function parse(diagramType,text){const initializer=initializers[diagramType];if(!initializer)throw new Error(`Unknown diagram type: ${diagramType}`);parsers[diagramType]||await initializer();const result=parsers[diagramType].parse(text);if(result.lexerErrors.length>0||result.parserErrors.length>0)throw new MermaidParseError(result);return result.value}__name(parse,"parse");var MermaidParseError=(__name(_t=class extends Error{constructor(result){super(`Parsing failed: ${result.lexerErrors.map(err=>`Lexer error on line ${void 0===err.line||isNaN(err.line)?"?":err.line}, column ${void 0===err.column||isNaN(err.column)?"?":err.column}: ${err.message}`).join("\n")} ${result.parserErrors.map(err=>`Parse error on line ${void 0===err.token.startLine||isNaN(err.token.startLine)?"?":err.token.startLine}, column ${void 0===err.token.startColumn||isNaN(err.token.startColumn)?"?":err.token.startColumn}: ${err.message}`).join("\n")}`),this.result=result}},"MermaidParseError"),_t);const infoOMHHGYJF=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:InfoModule,createInfoServices:createInfoServices},Symbol.toStringTag,{value:"Module"})),packet4T2RLAQJ=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:PacketModule,createPacketServices:createPacketServices},Symbol.toStringTag,{value:"Module"})),pieZZUOXDRM=Object.freeze(Object.defineProperty({__proto__:null,PieModule:PieModule,createPieServices:createPieServices},Symbol.toStringTag,{value:"Module"})),treeViewSZITEDCU=Object.freeze(Object.defineProperty({__proto__:null,TreeViewModule:TreeViewModule,createTreeViewServices:createTreeViewServices},Symbol.toStringTag,{value:"Module"})),architectureYZFGNWBL=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:ArchitectureModule,createArchitectureServices:createArchitectureServices},Symbol.toStringTag,{value:"Module"})),gitGraph7Q5UKJZL=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:GitGraphModule,createGitGraphServices:createGitGraphServices},Symbol.toStringTag,{value:"Module"})),radarPYXPWWZC=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:RadarModule,createRadarServices:createRadarServices},Symbol.toStringTag,{value:"Module"})),treemapW4RFUUIX=Object.freeze(Object.defineProperty({__proto__:null,TreemapModule:TreemapModule,createTreemapServices:createTreemapServices},Symbol.toStringTag,{value:"Module"})),wardleyRL74JXVD=Object.freeze(Object.defineProperty({__proto__:null,WardleyModule:WardleyModule,createWardleyServices:createWardleyServices},Symbol.toStringTag,{value:"Module"}));export{parse as p};